31 #include <linux/kernel.h>
32 #include <linux/module.h>
35 #include <linux/slab.h>
36 #include <linux/i2c.h>
42 #define LTC4151_SENSE_H 0x00
43 #define LTC4151_SENSE_L 0x01
44 #define LTC4151_VIN_H 0x02
45 #define LTC4151_VIN_L 0x03
46 #define LTC4151_ADIN_H 0x04
47 #define LTC4151_ADIN_L 0x05
75 dev_dbg(&client->
dev,
"Starting ltc4151 update\n");
84 "Failed to read ADC value: error %d\n",
104 val = (data->
regs[
reg] << 4) + (data->
regs[reg + 1] >> 4);
109 val = val * 500 / 1000;
140 return PTR_ERR(data);
142 value = ltc4151_get_value(data, attr->
index);
162 static struct attribute *ltc4151_attributes[] = {
163 &sensor_dev_attr_in1_input.dev_attr.attr,
164 &sensor_dev_attr_in2_input.dev_attr.attr,
166 &sensor_dev_attr_curr1_input.dev_attr.attr,
172 .attrs = ltc4151_attributes,
189 i2c_set_clientdata(client, data);
200 goto out_hwmon_device_register;
205 out_hwmon_device_register:
210 static int ltc4151_remove(
struct i2c_client *client)
231 .probe = ltc4151_probe,
232 .remove = ltc4151_remove,
233 .id_table = ltc4151_id,