Lines Matching refs:data
140 * Driver data (common to all clients)
163 * Client data (each client gets its own)
198 struct lm63_data *data = lm63_update_device(dev);
199 return sprintf(buf, "%d\n", FAN_FROM_REG(data->fan[attr->index]));
206 struct lm63_data *data = i2c_get_clientdata(client);
209 mutex_lock(&data->update_lock);
210 data->fan[1] = FAN_TO_REG(val);
212 data->fan[1] & 0xFF);
214 data->fan[1] >> 8);
215 mutex_unlock(&data->update_lock);
222 struct lm63_data *data = lm63_update_device(dev);
223 return sprintf(buf, "%d\n", data->pwm1_value >= 2 * data->pwm1_freq ?
224 255 : (data->pwm1_value * 255 + data->pwm1_freq) /
225 (2 * data->pwm1_freq));
232 struct lm63_data *data = i2c_get_clientdata(client);
235 if (!(data->config_fan & 0x20)) /* register is read-only */
239 mutex_lock(&data->update_lock);
240 data->pwm1_value = val <= 0 ? 0 :
241 val >= 255 ? 2 * data->pwm1_freq :
242 (val * data->pwm1_freq * 2 + 127) / 255;
243 i2c_smbus_write_byte_data(client, LM63_REG_PWM_VALUE, data->pwm1_value);
244 mutex_unlock(&data->update_lock);
251 struct lm63_data *data = lm63_update_device(dev);
252 return sprintf(buf, "%d\n", data->config_fan & 0x20 ? 1 : 2);
266 struct lm63_data *data = lm63_update_device(dev);
267 return sprintf(buf, "%d\n", TEMP8_FROM_REG(data->temp8[attr->index]));
275 struct lm63_data *data = lm63_update_device(dev);
276 return sprintf(buf, "%d\n", TEMP8_FROM_REG(data->temp8[attr->index])
277 + data->temp2_offset);
285 struct lm63_data *data = i2c_get_clientdata(client);
288 mutex_lock(&data->update_lock);
289 data->temp8[1] = TEMP8_TO_REG(val);
290 i2c_smbus_write_byte_data(client, LM63_REG_LOCAL_HIGH, data->temp8[1]);
291 mutex_unlock(&data->update_lock);
299 struct lm63_data *data = lm63_update_device(dev);
300 return sprintf(buf, "%d\n", TEMP11_FROM_REG(data->temp11[attr->index])
301 + data->temp2_offset);
316 struct lm63_data *data = i2c_get_clientdata(client);
320 mutex_lock(&data->update_lock);
321 data->temp11[nr] = TEMP11_TO_REG(val - data->temp2_offset);
323 data->temp11[nr] >> 8);
325 data->temp11[nr] & 0xff);
326 mutex_unlock(&data->update_lock);
335 struct lm63_data *data = lm63_update_device(dev);
336 return sprintf(buf, "%d\n", TEMP8_FROM_REG(data->temp8[2])
337 + data->temp2_offset
338 - TEMP8_FROM_REG(data->temp2_crit_hyst));
347 struct lm63_data *data = i2c_get_clientdata(client);
351 mutex_lock(&data->update_lock);
352 hyst = TEMP8_FROM_REG(data->temp8[2]) + data->temp2_offset - val;
355 mutex_unlock(&data->update_lock);
362 struct lm63_data *data = lm63_update_device(dev);
363 return sprintf(buf, "%u\n", data->alarms);
370 struct lm63_data *data = lm63_update_device(dev);
373 return sprintf(buf, "%u\n", (data->alarms >> bitnr) & 1);
499 struct lm63_data *data;
502 data = kzalloc(sizeof(struct lm63_data), GFP_KERNEL);
503 if (!data) {
508 i2c_set_clientdata(new_client, data);
509 data->valid = 0;
510 mutex_init(&data->update_lock);
513 data->kind = id->driver_data;
514 if (data->kind == lm64)
515 data->temp2_offset = 16000;
524 if (data->config & 0x04) { /* tachometer enabled */
530 data->hwmon_dev = hwmon_device_register(&new_client->dev);
531 if (IS_ERR(data->hwmon_dev)) {
532 err = PTR_ERR(data->hwmon_dev);
542 kfree(data);
551 struct lm63_data *data = i2c_get_clientdata(client);
553 data->config = i2c_smbus_read_byte_data(client, LM63_REG_CONFIG1);
554 data->config_fan = i2c_smbus_read_byte_data(client,
558 if (data->config & 0x40) { /* standby */
560 data->config &= 0xA7;
562 data->config);
565 /* We may need pwm1_freq before ever updating the client data */
566 data->pwm1_freq = i2c_smbus_read_byte_data(client, LM63_REG_PWM_FREQ);
567 if (data->pwm1_freq == 0)
568 data->pwm1_freq = 1;
572 (data->config & 0x04) ? "tachometer input" :
575 (data->config_fan & 0x08) ? "1.4" : "360",
576 ((data->config_fan & 0x08) ? 700 : 180000) / data->pwm1_freq);
578 (data->config_fan & 0x10) ? "low" : "high",
579 (data->config_fan & 0x20) ? "manual" : "auto");
584 struct lm63_data *data = i2c_get_clientdata(client);
586 hwmon_device_unregister(data->hwmon_dev);
590 kfree(data);
597 struct lm63_data *data = i2c_get_clientdata(client);
599 mutex_lock(&data->update_lock);
601 if (time_after(jiffies, data->last_updated + HZ) || !data->valid) {
602 if (data->config & 0x04) { /* tachometer enabled */
604 data->fan[0] = i2c_smbus_read_byte_data(client,
606 data->fan[0] |= i2c_smbus_read_byte_data(client,
608 data->fan[1] = (i2c_smbus_read_byte_data(client,
614 data->pwm1_freq = i2c_smbus_read_byte_data(client,
616 if (data->pwm1_freq == 0)
617 data->pwm1_freq = 1;
618 data->pwm1_value = i2c_smbus_read_byte_data(client,
621 data->temp8[0] = i2c_smbus_read_byte_data(client,
623 data->temp8[1] = i2c_smbus_read_byte_data(client,
627 data->temp11[0] = i2c_smbus_read_byte_data(client,
629 data->temp11[0] |= i2c_smbus_read_byte_data(client,
631 data->temp11[1] = (i2c_smbus_read_byte_data(client,
635 data->temp11[2] = (i2c_smbus_read_byte_data(client,
639 data->temp8[2] = i2c_smbus_read_byte_data(client,
641 data->temp2_crit_hyst = i2c_smbus_read_byte_data(client,
644 data->alarms = i2c_smbus_read_byte_data(client,
647 data->last_updated = jiffies;
648 data->valid = 1;
651 mutex_unlock(&data->update_lock);
653 return data;