aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/hwmon/max1111.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/drivers/hwmon/max1111.c b/drivers/hwmon/max1111.c
index 84ef3a898707..482ca901db30 100644
--- a/drivers/hwmon/max1111.c
+++ b/drivers/hwmon/max1111.c
@@ -106,11 +106,14 @@ static ssize_t show_adc(struct device *dev,
106 if (ret < 0) 106 if (ret < 0)
107 return ret; 107 return ret;
108 108
109 return sprintf(buf, "%d\n", ret); 109 /* assume the reference voltage to be 2.048V, with an 8-bit sample,
110 * the LSB weight is 8mV
111 */
112 return sprintf(buf, "%d\n", ret * 8);
110} 113}
111 114
112#define MAX1111_ADC_ATTR(_id) \ 115#define MAX1111_ADC_ATTR(_id) \
113 SENSOR_DEVICE_ATTR(adc##_id##_in, S_IRUGO, show_adc, NULL, _id) 116 SENSOR_DEVICE_ATTR(in##_id##_input, S_IRUGO, show_adc, NULL, _id)
114 117
115static DEVICE_ATTR(name, S_IRUGO, show_name, NULL); 118static DEVICE_ATTR(name, S_IRUGO, show_name, NULL);
116static MAX1111_ADC_ATTR(0); 119static MAX1111_ADC_ATTR(0);
@@ -120,10 +123,10 @@ static MAX1111_ADC_ATTR(3);
120 123
121static struct attribute *max1111_attributes[] = { 124static struct attribute *max1111_attributes[] = {
122 &dev_attr_name.attr, 125 &dev_attr_name.attr,
123 &sensor_dev_attr_adc0_in.dev_attr.attr, 126 &sensor_dev_attr_in0_input.dev_attr.attr,
124 &sensor_dev_attr_adc1_in.dev_attr.attr, 127 &sensor_dev_attr_in1_input.dev_attr.attr,
125 &sensor_dev_attr_adc2_in.dev_attr.attr, 128 &sensor_dev_attr_in2_input.dev_attr.attr,
126 &sensor_dev_attr_adc3_in.dev_attr.attr, 129 &sensor_dev_attr_in3_input.dev_attr.attr,
127 NULL, 130 NULL,
128}; 131};
129 132