diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
commit | 8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch) | |
tree | a8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /drivers/hwmon/asb100.c | |
parent | 406089d01562f1e2bf9f089fd7637009ebaad589 (diff) |
Patched in Tegra support.
Diffstat (limited to 'drivers/hwmon/asb100.c')
-rw-r--r-- | drivers/hwmon/asb100.c | 227 |
1 files changed, 99 insertions, 128 deletions
diff --git a/drivers/hwmon/asb100.c b/drivers/hwmon/asb100.c index 520e5bf4f76..c02a052d308 100644 --- a/drivers/hwmon/asb100.c +++ b/drivers/hwmon/asb100.c | |||
@@ -1,40 +1,40 @@ | |||
1 | /* | 1 | /* |
2 | * asb100.c - Part of lm_sensors, Linux kernel modules for hardware | 2 | asb100.c - Part of lm_sensors, Linux kernel modules for hardware |
3 | * monitoring | 3 | monitoring |
4 | * | 4 | |
5 | * Copyright (C) 2004 Mark M. Hoffman <mhoffman@lightlink.com> | 5 | Copyright (C) 2004 Mark M. Hoffman <mhoffman@lightlink.com> |
6 | * | 6 | |
7 | * (derived from w83781d.c) | 7 | (derived from w83781d.c) |
8 | * | 8 | |
9 | * Copyright (C) 1998 - 2003 Frodo Looijaard <frodol@dds.nl>, | 9 | Copyright (C) 1998 - 2003 Frodo Looijaard <frodol@dds.nl>, |
10 | * Philip Edelbrock <phil@netroedge.com>, and | 10 | Philip Edelbrock <phil@netroedge.com>, and |
11 | * Mark Studebaker <mdsxyz123@yahoo.com> | 11 | Mark Studebaker <mdsxyz123@yahoo.com> |
12 | * | 12 | |
13 | * This program is free software; you can redistribute it and/or modify | 13 | This program is free software; you can redistribute it and/or modify |
14 | * it under the terms of the GNU General Public License as published by | 14 | it under the terms of the GNU General Public License as published by |
15 | * the Free Software Foundation; either version 2 of the License, or | 15 | the Free Software Foundation; either version 2 of the License, or |
16 | * (at your option) any later version. | 16 | (at your option) any later version. |
17 | * | 17 | |
18 | * This program is distributed in the hope that it will be useful, | 18 | This program is distributed in the hope that it will be useful, |
19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 19 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 20 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
21 | * GNU General Public License for more details. | 21 | GNU General Public License for more details. |
22 | * | 22 | |
23 | * You should have received a copy of the GNU General Public License | 23 | You should have received a copy of the GNU General Public License |
24 | * along with this program; if not, write to the Free Software | 24 | along with this program; if not, write to the Free Software |
25 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 25 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
26 | */ | 26 | */ |
27 | 27 | ||
28 | /* | 28 | /* |
29 | * This driver supports the hardware sensor chips: Asus ASB100 and | 29 | This driver supports the hardware sensor chips: Asus ASB100 and |
30 | * ASB100-A "BACH". | 30 | ASB100-A "BACH". |
31 | * | 31 | |
32 | * ASB100-A supports pwm1, while plain ASB100 does not. There is no known | 32 | ASB100-A supports pwm1, while plain ASB100 does not. There is no known |
33 | * way for the driver to tell which one is there. | 33 | way for the driver to tell which one is there. |
34 | * | 34 | |
35 | * Chip #vin #fanin #pwm #temp wchipid vendid i2c ISA | 35 | Chip #vin #fanin #pwm #temp wchipid vendid i2c ISA |
36 | * asb100 7 3 1 4 0x31 0x0694 yes no | 36 | asb100 7 3 1 4 0x31 0x0694 yes no |
37 | */ | 37 | */ |
38 | 38 | ||
39 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt | 39 | #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt |
40 | 40 | ||
@@ -99,19 +99,15 @@ static const u16 asb100_reg_temp_hyst[] = {0, 0x3a, 0x153, 0x253, 0x19}; | |||
99 | /* bit 7 -> enable, bits 0-3 -> duty cycle */ | 99 | /* bit 7 -> enable, bits 0-3 -> duty cycle */ |
100 | #define ASB100_REG_PWM1 0x59 | 100 | #define ASB100_REG_PWM1 0x59 |
101 | 101 | ||
102 | /* | 102 | /* CONVERSIONS |
103 | * CONVERSIONS | 103 | Rounding and limit checking is only done on the TO_REG variants. */ |
104 | * Rounding and limit checking is only done on the TO_REG variants. | ||
105 | */ | ||
106 | 104 | ||
107 | /* These constants are a guess, consistent w/ w83781d */ | 105 | /* These constants are a guess, consistent w/ w83781d */ |
108 | #define ASB100_IN_MIN 0 | 106 | #define ASB100_IN_MIN ( 0) |
109 | #define ASB100_IN_MAX 4080 | 107 | #define ASB100_IN_MAX (4080) |
110 | 108 | ||
111 | /* | 109 | /* IN: 1/1000 V (0V to 4.08V) |
112 | * IN: 1/1000 V (0V to 4.08V) | 110 | REG: 16mV/bit */ |
113 | * REG: 16mV/bit | ||
114 | */ | ||
115 | static u8 IN_TO_REG(unsigned val) | 111 | static u8 IN_TO_REG(unsigned val) |
116 | { | 112 | { |
117 | unsigned nval = SENSORS_LIMIT(val, ASB100_IN_MIN, ASB100_IN_MAX); | 113 | unsigned nval = SENSORS_LIMIT(val, ASB100_IN_MIN, ASB100_IN_MAX); |
@@ -135,21 +131,19 @@ static u8 FAN_TO_REG(long rpm, int div) | |||
135 | 131 | ||
136 | static int FAN_FROM_REG(u8 val, int div) | 132 | static int FAN_FROM_REG(u8 val, int div) |
137 | { | 133 | { |
138 | return val == 0 ? -1 : val == 255 ? 0 : 1350000 / (val * div); | 134 | return val==0 ? -1 : val==255 ? 0 : 1350000/(val*div); |
139 | } | 135 | } |
140 | 136 | ||
141 | /* These constants are a guess, consistent w/ w83781d */ | 137 | /* These constants are a guess, consistent w/ w83781d */ |
142 | #define ASB100_TEMP_MIN -128000 | 138 | #define ASB100_TEMP_MIN (-128000) |
143 | #define ASB100_TEMP_MAX 127000 | 139 | #define ASB100_TEMP_MAX ( 127000) |
144 | 140 | ||
145 | /* | 141 | /* TEMP: 0.001C/bit (-128C to +127C) |
146 | * TEMP: 0.001C/bit (-128C to +127C) | 142 | REG: 1C/bit, two's complement */ |
147 | * REG: 1C/bit, two's complement | ||
148 | */ | ||
149 | static u8 TEMP_TO_REG(long temp) | 143 | static u8 TEMP_TO_REG(long temp) |
150 | { | 144 | { |
151 | int ntemp = SENSORS_LIMIT(temp, ASB100_TEMP_MIN, ASB100_TEMP_MAX); | 145 | int ntemp = SENSORS_LIMIT(temp, ASB100_TEMP_MIN, ASB100_TEMP_MAX); |
152 | ntemp += (ntemp < 0 ? -500 : 500); | 146 | ntemp += (ntemp<0 ? -500 : 500); |
153 | return (u8)(ntemp / 1000); | 147 | return (u8)(ntemp / 1000); |
154 | } | 148 | } |
155 | 149 | ||
@@ -158,10 +152,8 @@ static int TEMP_FROM_REG(u8 reg) | |||
158 | return (s8)reg * 1000; | 152 | return (s8)reg * 1000; |
159 | } | 153 | } |
160 | 154 | ||
161 | /* | 155 | /* PWM: 0 - 255 per sensors documentation |
162 | * PWM: 0 - 255 per sensors documentation | 156 | REG: (6.25% duty cycle per bit) */ |
163 | * REG: (6.25% duty cycle per bit) | ||
164 | */ | ||
165 | static u8 ASB100_PWM_TO_REG(int pwm) | 157 | static u8 ASB100_PWM_TO_REG(int pwm) |
166 | { | 158 | { |
167 | pwm = SENSORS_LIMIT(pwm, 0, 255); | 159 | pwm = SENSORS_LIMIT(pwm, 0, 255); |
@@ -175,20 +167,16 @@ static int ASB100_PWM_FROM_REG(u8 reg) | |||
175 | 167 | ||
176 | #define DIV_FROM_REG(val) (1 << (val)) | 168 | #define DIV_FROM_REG(val) (1 << (val)) |
177 | 169 | ||
178 | /* | 170 | /* FAN DIV: 1, 2, 4, or 8 (defaults to 2) |
179 | * FAN DIV: 1, 2, 4, or 8 (defaults to 2) | 171 | REG: 0, 1, 2, or 3 (respectively) (defaults to 1) */ |
180 | * REG: 0, 1, 2, or 3 (respectively) (defaults to 1) | ||
181 | */ | ||
182 | static u8 DIV_TO_REG(long val) | 172 | static u8 DIV_TO_REG(long val) |
183 | { | 173 | { |
184 | return val == 8 ? 3 : val == 4 ? 2 : val == 1 ? 0 : 1; | 174 | return val==8 ? 3 : val==4 ? 2 : val==1 ? 0 : 1; |
185 | } | 175 | } |
186 | 176 | ||
187 | /* | 177 | /* For each registered client, we need to keep some data in memory. That |
188 | * For each registered client, we need to keep some data in memory. That | 178 | data is pointed to by client->data. The structure itself is |
189 | * data is pointed to by client->data. The structure itself is | 179 | dynamically allocated, at the same time the client itself is allocated. */ |
190 | * dynamically allocated, at the same time the client itself is allocated. | ||
191 | */ | ||
192 | struct asb100_data { | 180 | struct asb100_data { |
193 | struct device *hwmon_dev; | 181 | struct device *hwmon_dev; |
194 | struct mutex lock; | 182 | struct mutex lock; |
@@ -265,10 +253,8 @@ static ssize_t set_in_##reg(struct device *dev, struct device_attribute *attr, \ | |||
265 | int nr = to_sensor_dev_attr(attr)->index; \ | 253 | int nr = to_sensor_dev_attr(attr)->index; \ |
266 | struct i2c_client *client = to_i2c_client(dev); \ | 254 | struct i2c_client *client = to_i2c_client(dev); \ |
267 | struct asb100_data *data = i2c_get_clientdata(client); \ | 255 | struct asb100_data *data = i2c_get_clientdata(client); \ |
268 | unsigned long val; \ | 256 | unsigned long val = simple_strtoul(buf, NULL, 10); \ |
269 | int err = kstrtoul(buf, 10, &val); \ | 257 | \ |
270 | if (err) \ | ||
271 | return err; \ | ||
272 | mutex_lock(&data->update_lock); \ | 258 | mutex_lock(&data->update_lock); \ |
273 | data->in_##reg[nr] = IN_TO_REG(val); \ | 259 | data->in_##reg[nr] = IN_TO_REG(val); \ |
274 | asb100_write_value(client, ASB100_REG_IN_##REG(nr), \ | 260 | asb100_write_value(client, ASB100_REG_IN_##REG(nr), \ |
@@ -329,12 +315,7 @@ static ssize_t set_fan_min(struct device *dev, struct device_attribute *attr, | |||
329 | int nr = to_sensor_dev_attr(attr)->index; | 315 | int nr = to_sensor_dev_attr(attr)->index; |
330 | struct i2c_client *client = to_i2c_client(dev); | 316 | struct i2c_client *client = to_i2c_client(dev); |
331 | struct asb100_data *data = i2c_get_clientdata(client); | 317 | struct asb100_data *data = i2c_get_clientdata(client); |
332 | unsigned long val; | 318 | u32 val = simple_strtoul(buf, NULL, 10); |
333 | int err; | ||
334 | |||
335 | err = kstrtoul(buf, 10, &val); | ||
336 | if (err) | ||
337 | return err; | ||
338 | 319 | ||
339 | mutex_lock(&data->update_lock); | 320 | mutex_lock(&data->update_lock); |
340 | data->fan_min[nr] = FAN_TO_REG(val, DIV_FROM_REG(data->fan_div[nr])); | 321 | data->fan_min[nr] = FAN_TO_REG(val, DIV_FROM_REG(data->fan_div[nr])); |
@@ -343,12 +324,10 @@ static ssize_t set_fan_min(struct device *dev, struct device_attribute *attr, | |||
343 | return count; | 324 | return count; |
344 | } | 325 | } |
345 | 326 | ||
346 | /* | 327 | /* Note: we save and restore the fan minimum here, because its value is |
347 | * Note: we save and restore the fan minimum here, because its value is | 328 | determined in part by the fan divisor. This follows the principle of |
348 | * determined in part by the fan divisor. This follows the principle of | 329 | least surprise; the user doesn't expect the fan minimum to change just |
349 | * least surprise; the user doesn't expect the fan minimum to change just | 330 | because the divisor changed. */ |
350 | * because the divisor changed. | ||
351 | */ | ||
352 | static ssize_t set_fan_div(struct device *dev, struct device_attribute *attr, | 331 | static ssize_t set_fan_div(struct device *dev, struct device_attribute *attr, |
353 | const char *buf, size_t count) | 332 | const char *buf, size_t count) |
354 | { | 333 | { |
@@ -356,13 +335,8 @@ static ssize_t set_fan_div(struct device *dev, struct device_attribute *attr, | |||
356 | struct i2c_client *client = to_i2c_client(dev); | 335 | struct i2c_client *client = to_i2c_client(dev); |
357 | struct asb100_data *data = i2c_get_clientdata(client); | 336 | struct asb100_data *data = i2c_get_clientdata(client); |
358 | unsigned long min; | 337 | unsigned long min; |
338 | unsigned long val = simple_strtoul(buf, NULL, 10); | ||
359 | int reg; | 339 | int reg; |
360 | unsigned long val; | ||
361 | int err; | ||
362 | |||
363 | err = kstrtoul(buf, 10, &val); | ||
364 | if (err) | ||
365 | return err; | ||
366 | 340 | ||
367 | mutex_lock(&data->update_lock); | 341 | mutex_lock(&data->update_lock); |
368 | 342 | ||
@@ -447,10 +421,8 @@ static ssize_t set_##reg(struct device *dev, struct device_attribute *attr, \ | |||
447 | int nr = to_sensor_dev_attr(attr)->index; \ | 421 | int nr = to_sensor_dev_attr(attr)->index; \ |
448 | struct i2c_client *client = to_i2c_client(dev); \ | 422 | struct i2c_client *client = to_i2c_client(dev); \ |
449 | struct asb100_data *data = i2c_get_clientdata(client); \ | 423 | struct asb100_data *data = i2c_get_clientdata(client); \ |
450 | long val; \ | 424 | long val = simple_strtol(buf, NULL, 10); \ |
451 | int err = kstrtol(buf, 10, &val); \ | 425 | \ |
452 | if (err) \ | ||
453 | return err; \ | ||
454 | mutex_lock(&data->update_lock); \ | 426 | mutex_lock(&data->update_lock); \ |
455 | switch (nr) { \ | 427 | switch (nr) { \ |
456 | case 1: case 2: \ | 428 | case 1: case 2: \ |
@@ -504,13 +476,7 @@ static ssize_t set_vrm(struct device *dev, struct device_attribute *attr, | |||
504 | const char *buf, size_t count) | 476 | const char *buf, size_t count) |
505 | { | 477 | { |
506 | struct asb100_data *data = dev_get_drvdata(dev); | 478 | struct asb100_data *data = dev_get_drvdata(dev); |
507 | unsigned long val; | 479 | data->vrm = simple_strtoul(buf, NULL, 10); |
508 | int err; | ||
509 | |||
510 | err = kstrtoul(buf, 10, &val); | ||
511 | if (err) | ||
512 | return err; | ||
513 | data->vrm = val; | ||
514 | return count; | 480 | return count; |
515 | } | 481 | } |
516 | 482 | ||
@@ -558,12 +524,7 @@ static ssize_t set_pwm1(struct device *dev, struct device_attribute *attr, | |||
558 | { | 524 | { |
559 | struct i2c_client *client = to_i2c_client(dev); | 525 | struct i2c_client *client = to_i2c_client(dev); |
560 | struct asb100_data *data = i2c_get_clientdata(client); | 526 | struct asb100_data *data = i2c_get_clientdata(client); |
561 | unsigned long val; | 527 | unsigned long val = simple_strtoul(buf, NULL, 10); |
562 | int err; | ||
563 | |||
564 | err = kstrtoul(buf, 10, &val); | ||
565 | if (err) | ||
566 | return err; | ||
567 | 528 | ||
568 | mutex_lock(&data->update_lock); | 529 | mutex_lock(&data->update_lock); |
569 | data->pwm &= 0x80; /* keep the enable bit */ | 530 | data->pwm &= 0x80; /* keep the enable bit */ |
@@ -585,12 +546,7 @@ static ssize_t set_pwm_enable1(struct device *dev, | |||
585 | { | 546 | { |
586 | struct i2c_client *client = to_i2c_client(dev); | 547 | struct i2c_client *client = to_i2c_client(dev); |
587 | struct asb100_data *data = i2c_get_clientdata(client); | 548 | struct asb100_data *data = i2c_get_clientdata(client); |
588 | unsigned long val; | 549 | unsigned long val = simple_strtoul(buf, NULL, 10); |
589 | int err; | ||
590 | |||
591 | err = kstrtoul(buf, 10, &val); | ||
592 | if (err) | ||
593 | return err; | ||
594 | 550 | ||
595 | mutex_lock(&data->update_lock); | 551 | mutex_lock(&data->update_lock); |
596 | data->pwm &= 0x0f; /* keep the duty cycle bits */ | 552 | data->pwm &= 0x0f; /* keep the duty cycle bits */ |
@@ -787,10 +743,12 @@ static int asb100_probe(struct i2c_client *client, | |||
787 | int err; | 743 | int err; |
788 | struct asb100_data *data; | 744 | struct asb100_data *data; |
789 | 745 | ||
790 | data = devm_kzalloc(&client->dev, sizeof(struct asb100_data), | 746 | data = kzalloc(sizeof(struct asb100_data), GFP_KERNEL); |
791 | GFP_KERNEL); | 747 | if (!data) { |
792 | if (!data) | 748 | pr_debug("probe failed, kzalloc failed!\n"); |
793 | return -ENOMEM; | 749 | err = -ENOMEM; |
750 | goto ERROR0; | ||
751 | } | ||
794 | 752 | ||
795 | i2c_set_clientdata(client, data); | 753 | i2c_set_clientdata(client, data); |
796 | mutex_init(&data->lock); | 754 | mutex_init(&data->lock); |
@@ -799,7 +757,7 @@ static int asb100_probe(struct i2c_client *client, | |||
799 | /* Attach secondary lm75 clients */ | 757 | /* Attach secondary lm75 clients */ |
800 | err = asb100_detect_subclients(client); | 758 | err = asb100_detect_subclients(client); |
801 | if (err) | 759 | if (err) |
802 | return err; | 760 | goto ERROR1; |
803 | 761 | ||
804 | /* Initialize the chip */ | 762 | /* Initialize the chip */ |
805 | asb100_init_client(client); | 763 | asb100_init_client(client); |
@@ -810,8 +768,7 @@ static int asb100_probe(struct i2c_client *client, | |||
810 | data->fan_min[2] = asb100_read_value(client, ASB100_REG_FAN_MIN(2)); | 768 | data->fan_min[2] = asb100_read_value(client, ASB100_REG_FAN_MIN(2)); |
811 | 769 | ||
812 | /* Register sysfs hooks */ | 770 | /* Register sysfs hooks */ |
813 | err = sysfs_create_group(&client->dev.kobj, &asb100_group); | 771 | if ((err = sysfs_create_group(&client->dev.kobj, &asb100_group))) |
814 | if (err) | ||
815 | goto ERROR3; | 772 | goto ERROR3; |
816 | 773 | ||
817 | data->hwmon_dev = hwmon_device_register(&client->dev); | 774 | data->hwmon_dev = hwmon_device_register(&client->dev); |
@@ -827,6 +784,9 @@ ERROR4: | |||
827 | ERROR3: | 784 | ERROR3: |
828 | i2c_unregister_device(data->lm75[1]); | 785 | i2c_unregister_device(data->lm75[1]); |
829 | i2c_unregister_device(data->lm75[0]); | 786 | i2c_unregister_device(data->lm75[0]); |
787 | ERROR1: | ||
788 | kfree(data); | ||
789 | ERROR0: | ||
830 | return err; | 790 | return err; |
831 | } | 791 | } |
832 | 792 | ||
@@ -840,13 +800,13 @@ static int asb100_remove(struct i2c_client *client) | |||
840 | i2c_unregister_device(data->lm75[1]); | 800 | i2c_unregister_device(data->lm75[1]); |
841 | i2c_unregister_device(data->lm75[0]); | 801 | i2c_unregister_device(data->lm75[0]); |
842 | 802 | ||
803 | kfree(data); | ||
804 | |||
843 | return 0; | 805 | return 0; |
844 | } | 806 | } |
845 | 807 | ||
846 | /* | 808 | /* The SMBus locks itself, usually, but nothing may access the chip between |
847 | * The SMBus locks itself, usually, but nothing may access the chip between | 809 | bank switches. */ |
848 | * bank switches. | ||
849 | */ | ||
850 | static int asb100_read_value(struct i2c_client *client, u16 reg) | 810 | static int asb100_read_value(struct i2c_client *client, u16 reg) |
851 | { | 811 | { |
852 | struct asb100_data *data = i2c_get_clientdata(client); | 812 | struct asb100_data *data = i2c_get_clientdata(client); |
@@ -869,17 +829,17 @@ static int asb100_read_value(struct i2c_client *client, u16 reg) | |||
869 | /* convert from ISA to LM75 I2C addresses */ | 829 | /* convert from ISA to LM75 I2C addresses */ |
870 | switch (reg & 0xff) { | 830 | switch (reg & 0xff) { |
871 | case 0x50: /* TEMP */ | 831 | case 0x50: /* TEMP */ |
872 | res = i2c_smbus_read_word_swapped(cl, 0); | 832 | res = swab16(i2c_smbus_read_word_data(cl, 0)); |
873 | break; | 833 | break; |
874 | case 0x52: /* CONFIG */ | 834 | case 0x52: /* CONFIG */ |
875 | res = i2c_smbus_read_byte_data(cl, 1); | 835 | res = i2c_smbus_read_byte_data(cl, 1); |
876 | break; | 836 | break; |
877 | case 0x53: /* HYST */ | 837 | case 0x53: /* HYST */ |
878 | res = i2c_smbus_read_word_swapped(cl, 2); | 838 | res = swab16(i2c_smbus_read_word_data(cl, 2)); |
879 | break; | 839 | break; |
880 | case 0x55: /* MAX */ | 840 | case 0x55: /* MAX */ |
881 | default: | 841 | default: |
882 | res = i2c_smbus_read_word_swapped(cl, 3); | 842 | res = swab16(i2c_smbus_read_word_data(cl, 3)); |
883 | break; | 843 | break; |
884 | } | 844 | } |
885 | } | 845 | } |
@@ -917,10 +877,10 @@ static void asb100_write_value(struct i2c_client *client, u16 reg, u16 value) | |||
917 | i2c_smbus_write_byte_data(cl, 1, value & 0xff); | 877 | i2c_smbus_write_byte_data(cl, 1, value & 0xff); |
918 | break; | 878 | break; |
919 | case 0x53: /* HYST */ | 879 | case 0x53: /* HYST */ |
920 | i2c_smbus_write_word_swapped(cl, 2, value); | 880 | i2c_smbus_write_word_data(cl, 2, swab16(value)); |
921 | break; | 881 | break; |
922 | case 0x55: /* MAX */ | 882 | case 0x55: /* MAX */ |
923 | i2c_smbus_write_word_swapped(cl, 3, value); | 883 | i2c_smbus_write_word_data(cl, 3, swab16(value)); |
924 | break; | 884 | break; |
925 | } | 885 | } |
926 | } | 886 | } |
@@ -1011,8 +971,19 @@ static struct asb100_data *asb100_update_device(struct device *dev) | |||
1011 | return data; | 971 | return data; |
1012 | } | 972 | } |
1013 | 973 | ||
1014 | module_i2c_driver(asb100_driver); | 974 | static int __init asb100_init(void) |
975 | { | ||
976 | return i2c_add_driver(&asb100_driver); | ||
977 | } | ||
978 | |||
979 | static void __exit asb100_exit(void) | ||
980 | { | ||
981 | i2c_del_driver(&asb100_driver); | ||
982 | } | ||
1015 | 983 | ||
1016 | MODULE_AUTHOR("Mark M. Hoffman <mhoffman@lightlink.com>"); | 984 | MODULE_AUTHOR("Mark M. Hoffman <mhoffman@lightlink.com>"); |
1017 | MODULE_DESCRIPTION("ASB100 Bach driver"); | 985 | MODULE_DESCRIPTION("ASB100 Bach driver"); |
1018 | MODULE_LICENSE("GPL"); | 986 | MODULE_LICENSE("GPL"); |
987 | |||
988 | module_init(asb100_init); | ||
989 | module_exit(asb100_exit); | ||