aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon/ltc4215.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/hwmon/ltc4215.c')
-rw-r--r--drivers/hwmon/ltc4215.c28
1 files changed, 11 insertions, 17 deletions
diff --git a/drivers/hwmon/ltc4215.c b/drivers/hwmon/ltc4215.c
index c7e6d8e81656..429c5b2b66fd 100644
--- a/drivers/hwmon/ltc4215.c
+++ b/drivers/hwmon/ltc4215.c
@@ -91,8 +91,10 @@ static int ltc4215_get_voltage(struct device *dev, u8 reg)
91 voltage = regval * 605 / 10; 91 voltage = regval * 605 / 10;
92 break; 92 break;
93 case LTC4215_ADIN: 93 case LTC4215_ADIN:
94 /* The ADIN input is divided by 12.5, and has 4.82 mV 94 /*
95 * per increment, so we have the additional multiply */ 95 * The ADIN input is divided by 12.5, and has 4.82 mV
96 * per increment, so we have the additional multiply
97 */
96 voltage = regval * 482 * 125 / 1000; 98 voltage = regval * 482 * 125 / 1000;
97 break; 99 break;
98 default: 100 default:
@@ -109,7 +111,8 @@ static unsigned int ltc4215_get_current(struct device *dev)
109{ 111{
110 struct ltc4215_data *data = ltc4215_update_device(dev); 112 struct ltc4215_data *data = ltc4215_update_device(dev);
111 113
112 /* The strange looking conversions that follow are fixed-point 114 /*
115 * The strange looking conversions that follow are fixed-point
113 * math, since we cannot do floating point in the kernel. 116 * math, since we cannot do floating point in the kernel.
114 * 117 *
115 * Step 1: convert sense register to microVolts 118 * Step 1: convert sense register to microVolts
@@ -176,7 +179,8 @@ static ssize_t ltc4215_show_alarm(struct device *dev,
176 return snprintf(buf, PAGE_SIZE, "%u\n", (reg & mask) ? 1 : 0); 179 return snprintf(buf, PAGE_SIZE, "%u\n", (reg & mask) ? 1 : 0);
177} 180}
178 181
179/* These macros are used below in constructing device attribute objects 182/*
183 * These macros are used below in constructing device attribute objects
180 * for use with sysfs_create_group() to make a sysfs device file 184 * for use with sysfs_create_group() to make a sysfs device file
181 * for each register. 185 * for each register.
182 */ 186 */
@@ -215,7 +219,8 @@ LTC4215_ALARM(in1_min_alarm, (1 << 1), LTC4215_STATUS);
215LTC4215_VOLTAGE(in2_input, LTC4215_SOURCE); 219LTC4215_VOLTAGE(in2_input, LTC4215_SOURCE);
216LTC4215_ALARM(in2_min_alarm, (1 << 3), LTC4215_STATUS); 220LTC4215_ALARM(in2_min_alarm, (1 << 3), LTC4215_STATUS);
217 221
218/* Finally, construct an array of pointers to members of the above objects, 222/*
223 * Finally, construct an array of pointers to members of the above objects,
219 * as required for sysfs_create_group() 224 * as required for sysfs_create_group()
220 */ 225 */
221static struct attribute *ltc4215_attributes[] = { 226static struct attribute *ltc4215_attributes[] = {
@@ -309,19 +314,8 @@ static struct i2c_driver ltc4215_driver = {
309 .id_table = ltc4215_id, 314 .id_table = ltc4215_id,
310}; 315};
311 316
312static int __init ltc4215_init(void) 317module_i2c_driver(ltc4215_driver);
313{
314 return i2c_add_driver(&ltc4215_driver);
315}
316
317static void __exit ltc4215_exit(void)
318{
319 i2c_del_driver(&ltc4215_driver);
320}
321 318
322MODULE_AUTHOR("Ira W. Snyder <iws@ovro.caltech.edu>"); 319MODULE_AUTHOR("Ira W. Snyder <iws@ovro.caltech.edu>");
323MODULE_DESCRIPTION("LTC4215 driver"); 320MODULE_DESCRIPTION("LTC4215 driver");
324MODULE_LICENSE("GPL"); 321MODULE_LICENSE("GPL");
325
326module_init(ltc4215_init);
327module_exit(ltc4215_exit);