blob: 5418a675bb607f4e119f15d19d7e7362bf93b665 [file] [log] [blame]
Linus Torvalds1da177e2005-04-16 15:20:36 -07001/*
2 adm1021.c - Part of lm_sensors, Linux kernel modules for hardware
Krzysztof Heltc83c41e2007-07-19 08:00:17 +02003 monitoring
Linus Torvalds1da177e2005-04-16 15:20:36 -07004 Copyright (c) 1998, 1999 Frodo Looijaard <frodol@dds.nl> and
5 Philip Edelbrock <phil@netroedge.com>
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 2 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20*/
21
Linus Torvalds1da177e2005-04-16 15:20:36 -070022#include <linux/module.h>
23#include <linux/init.h>
24#include <linux/slab.h>
25#include <linux/jiffies.h>
26#include <linux/i2c.h>
Mark M. Hoffman943b0832005-07-15 21:39:18 -040027#include <linux/hwmon.h>
28#include <linux/err.h>
Ingo Molnar9a61bf62006-01-18 23:19:26 +010029#include <linux/mutex.h>
Linus Torvalds1da177e2005-04-16 15:20:36 -070030
31
32/* Addresses to scan */
33static unsigned short normal_i2c[] = { 0x18, 0x19, 0x1a,
34 0x29, 0x2a, 0x2b,
Krzysztof Heltc83c41e2007-07-19 08:00:17 +020035 0x4c, 0x4d, 0x4e,
Linus Torvalds1da177e2005-04-16 15:20:36 -070036 I2C_CLIENT_END };
Linus Torvalds1da177e2005-04-16 15:20:36 -070037
38/* Insmod parameters */
Krzysztof Heltc83c41e2007-07-19 08:00:17 +020039I2C_CLIENT_INSMOD_8(adm1021, adm1023, max1617, max1617a, thmc10, lm84, gl523sm,
40 mc1066);
Linus Torvalds1da177e2005-04-16 15:20:36 -070041
42/* adm1021 constants specified below */
43
44/* The adm1021 registers */
45/* Read-only */
46#define ADM1021_REG_TEMP 0x00
47#define ADM1021_REG_REMOTE_TEMP 0x01
48#define ADM1021_REG_STATUS 0x02
Krzysztof Heltc83c41e2007-07-19 08:00:17 +020049/* 0x41 = AD, 0x49 = TI, 0x4D = Maxim, 0x23 = Genesys , 0x54 = Onsemi */
50#define ADM1021_REG_MAN_ID 0xFE
51/* ADM1021 = 0x0X, ADM1023 = 0x3X */
52#define ADM1021_REG_DEV_ID 0xFF
Linus Torvalds1da177e2005-04-16 15:20:36 -070053/* These use different addresses for reading/writing */
54#define ADM1021_REG_CONFIG_R 0x03
55#define ADM1021_REG_CONFIG_W 0x09
56#define ADM1021_REG_CONV_RATE_R 0x04
57#define ADM1021_REG_CONV_RATE_W 0x0A
58/* These are for the ADM1023's additional precision on the remote temp sensor */
Krzysztof Heltc83c41e2007-07-19 08:00:17 +020059#define ADM1023_REG_REM_TEMP_PREC 0x10
60#define ADM1023_REG_REM_OFFSET 0x11
61#define ADM1023_REG_REM_OFFSET_PREC 0x12
62#define ADM1023_REG_REM_TOS_PREC 0x13
63#define ADM1023_REG_REM_THYST_PREC 0x14
Linus Torvalds1da177e2005-04-16 15:20:36 -070064/* limits */
65#define ADM1021_REG_TOS_R 0x05
66#define ADM1021_REG_TOS_W 0x0B
67#define ADM1021_REG_REMOTE_TOS_R 0x07
68#define ADM1021_REG_REMOTE_TOS_W 0x0D
69#define ADM1021_REG_THYST_R 0x06
70#define ADM1021_REG_THYST_W 0x0C
71#define ADM1021_REG_REMOTE_THYST_R 0x08
72#define ADM1021_REG_REMOTE_THYST_W 0x0E
73/* write-only */
74#define ADM1021_REG_ONESHOT 0x0F
75
76
77/* Conversions. Rounding and limit checking is only done on the TO_REG
78 variants. Note that you should be a bit careful with which arguments
79 these macros are called: arguments may be evaluated more than once.
80 Fixing this is just not worth it. */
81/* Conversions note: 1021 uses normal integer signed-byte format*/
Krzysztof Heltc83c41e2007-07-19 08:00:17 +020082#define TEMP_TO_REG(val) SENSORS_LIMIT((val) / 1000, -128, 127)
Linus Torvalds1da177e2005-04-16 15:20:36 -070083
84/* Initial values */
85
Krzysztof Heltc83c41e2007-07-19 08:00:17 +020086/* Note: Even though I left the low and high limits named os and hyst,
87they don't quite work like a thermostat the way the LM75 does. I.e.,
88a lower temp than THYST actually triggers an alarm instead of
Linus Torvalds1da177e2005-04-16 15:20:36 -070089clearing it. Weird, ey? --Phil */
90
91/* Each client has this additional data */
92struct adm1021_data {
93 struct i2c_client client;
Mark M. Hoffman943b0832005-07-15 21:39:18 -040094 struct class_device *class_dev;
Linus Torvalds1da177e2005-04-16 15:20:36 -070095 enum chips type;
96
Ingo Molnar9a61bf62006-01-18 23:19:26 +010097 struct mutex update_lock;
Linus Torvalds1da177e2005-04-16 15:20:36 -070098 char valid; /* !=0 if following fields are valid */
99 unsigned long last_updated; /* In jiffies */
100
Krzysztof Heltc83c41e2007-07-19 08:00:17 +0200101 s8 temp_max; /* Register values */
102 s8 temp_hyst;
103 s8 temp_input;
104 s8 remote_temp_max;
105 s8 remote_temp_hyst;
106 s8 remote_temp_input;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700107 u8 alarms;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700108 /* Special values for ADM1023 only */
109 u8 remote_temp_prec;
110 u8 remote_temp_os_prec;
111 u8 remote_temp_hyst_prec;
112 u8 remote_temp_offset;
113 u8 remote_temp_offset_prec;
114};
115
116static int adm1021_attach_adapter(struct i2c_adapter *adapter);
117static int adm1021_detect(struct i2c_adapter *adapter, int address, int kind);
118static void adm1021_init_client(struct i2c_client *client);
119static int adm1021_detach_client(struct i2c_client *client);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700120static struct adm1021_data *adm1021_update_device(struct device *dev);
121
122/* (amalysh) read only mode, otherwise any limit's writing confuse BIOS */
Jean Delvare02002962005-09-25 16:26:44 +0200123static int read_only;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700124
125
126/* This is the driver that will be inserted */
127static struct i2c_driver adm1021_driver = {
Laurent Riffardcdaf7932005-11-26 20:37:41 +0100128 .driver = {
Laurent Riffardcdaf7932005-11-26 20:37:41 +0100129 .name = "adm1021",
130 },
Linus Torvalds1da177e2005-04-16 15:20:36 -0700131 .id = I2C_DRIVERID_ADM1021,
Linus Torvalds1da177e2005-04-16 15:20:36 -0700132 .attach_adapter = adm1021_attach_adapter,
133 .detach_client = adm1021_detach_client,
134};
135
Krzysztof Heltc83c41e2007-07-19 08:00:17 +0200136#define show(value) \
137static ssize_t show_##value(struct device *dev, \
138 struct device_attribute *attr, char *buf) \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700139{ \
140 struct adm1021_data *data = adm1021_update_device(dev); \
Krzysztof Heltc83c41e2007-07-19 08:00:17 +0200141 return sprintf(buf, "%d\n", 1000 * data->value); \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700142}
143show(temp_max);
144show(temp_hyst);
145show(temp_input);
146show(remote_temp_max);
147show(remote_temp_hyst);
148show(remote_temp_input);
149
Krzysztof Heltc83c41e2007-07-19 08:00:17 +0200150static ssize_t show_alarms(struct device *dev,
151 struct device_attribute *attr,
152 char *buf)
153{
154 struct adm1021_data *data = adm1021_update_device(dev);
155 return sprintf(buf, "%u\n", data->alarms);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700156}
Linus Torvalds1da177e2005-04-16 15:20:36 -0700157
Krzysztof Heltc83c41e2007-07-19 08:00:17 +0200158#define set(value, reg) \
159static ssize_t set_##value(struct device *dev, \
160 struct device_attribute *attr, \
161 const char *buf, size_t count) \
162{ \
163 struct i2c_client *client = to_i2c_client(dev); \
164 struct adm1021_data *data = i2c_get_clientdata(client); \
165 int temp = simple_strtoul(buf, NULL, 10); \
166 \
167 mutex_lock(&data->update_lock); \
168 data->value = TEMP_TO_REG(temp); \
169 if (!read_only) \
170 i2c_smbus_write_byte_data(client, reg, data->value); \
171 mutex_unlock(&data->update_lock); \
172 return count; \
Linus Torvalds1da177e2005-04-16 15:20:36 -0700173}
174set(temp_max, ADM1021_REG_TOS_W);
175set(temp_hyst, ADM1021_REG_THYST_W);
176set(remote_temp_max, ADM1021_REG_REMOTE_TOS_W);
177set(remote_temp_hyst, ADM1021_REG_REMOTE_THYST_W);
178
179static DEVICE_ATTR(temp1_max, S_IWUSR | S_IRUGO, show_temp_max, set_temp_max);
180static DEVICE_ATTR(temp1_min, S_IWUSR | S_IRUGO, show_temp_hyst, set_temp_hyst);
181static DEVICE_ATTR(temp1_input, S_IRUGO, show_temp_input, NULL);
182static DEVICE_ATTR(temp2_max, S_IWUSR | S_IRUGO, show_remote_temp_max, set_remote_temp_max);
183static DEVICE_ATTR(temp2_min, S_IWUSR | S_IRUGO, show_remote_temp_hyst, set_remote_temp_hyst);
184static DEVICE_ATTR(temp2_input, S_IRUGO, show_remote_temp_input, NULL);
185static DEVICE_ATTR(alarms, S_IRUGO, show_alarms, NULL);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700186
187
188static int adm1021_attach_adapter(struct i2c_adapter *adapter)
189{
190 if (!(adapter->class & I2C_CLASS_HWMON))
191 return 0;
Jean Delvare2ed2dc32005-07-31 21:42:02 +0200192 return i2c_probe(adapter, &addr_data, adm1021_detect);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700193}
194
Mark M. Hoffman681c6f72006-09-24 21:15:35 +0200195static struct attribute *adm1021_attributes[] = {
196 &dev_attr_temp1_max.attr,
197 &dev_attr_temp1_min.attr,
198 &dev_attr_temp1_input.attr,
199 &dev_attr_temp2_max.attr,
200 &dev_attr_temp2_min.attr,
201 &dev_attr_temp2_input.attr,
202 &dev_attr_alarms.attr,
203 NULL
204};
205
206static const struct attribute_group adm1021_group = {
207 .attrs = adm1021_attributes,
208};
209
Linus Torvalds1da177e2005-04-16 15:20:36 -0700210static int adm1021_detect(struct i2c_adapter *adapter, int address, int kind)
211{
212 int i;
Krzysztof Heltc83c41e2007-07-19 08:00:17 +0200213 struct i2c_client *client;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700214 struct adm1021_data *data;
215 int err = 0;
216 const char *type_name = "";
Krzysztof Heltc83c41e2007-07-19 08:00:17 +0200217 int conv_rate, status, config;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700218
Krzysztof Heltc83c41e2007-07-19 08:00:17 +0200219 if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) {
220 pr_debug("adm1021: detect failed, "
221 "smbus byte data not supported!\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700222 goto error0;
Krzysztof Heltc83c41e2007-07-19 08:00:17 +0200223 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700224
225 /* OK. For now, we presume we have a valid client. We now create the
226 client structure, even though we cannot fill it completely yet.
Krzysztof Heltc83c41e2007-07-19 08:00:17 +0200227 But it allows us to access adm1021 register values. */
Linus Torvalds1da177e2005-04-16 15:20:36 -0700228
Deepak Saxenaba9c2e82005-10-17 23:08:32 +0200229 if (!(data = kzalloc(sizeof(struct adm1021_data), GFP_KERNEL))) {
Krzysztof Heltc83c41e2007-07-19 08:00:17 +0200230 pr_debug("adm1021: detect failed, kzalloc failed!\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700231 err = -ENOMEM;
232 goto error0;
233 }
Linus Torvalds1da177e2005-04-16 15:20:36 -0700234
Krzysztof Heltc83c41e2007-07-19 08:00:17 +0200235 client = &data->client;
236 i2c_set_clientdata(client, data);
237 client->addr = address;
238 client->adapter = adapter;
239 client->driver = &adm1021_driver;
240 status = i2c_smbus_read_byte_data(client, ADM1021_REG_STATUS);
241 conv_rate = i2c_smbus_read_byte_data(client,
242 ADM1021_REG_CONV_RATE_R);
243 config = i2c_smbus_read_byte_data(client, ADM1021_REG_CONFIG_R);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700244
245 /* Now, we do the remaining detection. */
246 if (kind < 0) {
Krzysztof Heltc83c41e2007-07-19 08:00:17 +0200247 if ((status & 0x03) != 0x00 || (config & 0x3F) != 0x00
248 || (conv_rate & 0xF8) != 0x00) {
249 pr_debug("adm1021: detect failed, "
250 "chip not detected!\n");
Linus Torvalds1da177e2005-04-16 15:20:36 -0700251 err = -ENODEV;
252 goto error1;
253 }
254 }
255
256 /* Determine the chip type. */
257 if (kind <= 0) {
Krzysztof Heltc83c41e2007-07-19 08:00:17 +0200258 i = i2c_smbus_read_byte_data(client, ADM1021_REG_MAN_ID);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700259 if (i == 0x41)
Krzysztof Heltc83c41e2007-07-19 08:00:17 +0200260 if ((i2c_smbus_read_byte_data(client,
261 ADM1021_REG_DEV_ID) & 0xF0) == 0x30)
Linus Torvalds1da177e2005-04-16 15:20:36 -0700262 kind = adm1023;
263 else
264 kind = adm1021;
265 else if (i == 0x49)
266 kind = thmc10;
267 else if (i == 0x23)
268 kind = gl523sm;
269 else if ((i == 0x4d) &&
Krzysztof Heltc83c41e2007-07-19 08:00:17 +0200270 (i2c_smbus_read_byte_data(client,
271 ADM1021_REG_DEV_ID) == 0x01))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700272 kind = max1617a;
273 else if (i == 0x54)
274 kind = mc1066;
275 /* LM84 Mfr ID in a different place, and it has more unused bits */
Krzysztof Heltc83c41e2007-07-19 08:00:17 +0200276 else if (conv_rate == 0x00
277 && (kind == 0 /* skip extra detection */
278 || ((config & 0x7F) == 0x00
279 && (status & 0xAB) == 0x00)))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700280 kind = lm84;
281 else
282 kind = max1617;
283 }
284
285 if (kind == max1617) {
286 type_name = "max1617";
287 } else if (kind == max1617a) {
288 type_name = "max1617a";
289 } else if (kind == adm1021) {
290 type_name = "adm1021";
291 } else if (kind == adm1023) {
292 type_name = "adm1023";
293 } else if (kind == thmc10) {
294 type_name = "thmc10";
295 } else if (kind == lm84) {
296 type_name = "lm84";
297 } else if (kind == gl523sm) {
298 type_name = "gl523sm";
299 } else if (kind == mc1066) {
300 type_name = "mc1066";
301 }
Krzysztof Heltc83c41e2007-07-19 08:00:17 +0200302 pr_debug("adm1021: Detected chip %s at adapter %d, address 0x%02x.\n",
303 type_name, i2c_adapter_id(adapter), address);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700304
Krzysztof Heltc83c41e2007-07-19 08:00:17 +0200305 /* Fill in the remaining client fields */
306 strlcpy(client->name, type_name, I2C_NAME_SIZE);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700307 data->type = kind;
Ingo Molnar9a61bf62006-01-18 23:19:26 +0100308 mutex_init(&data->update_lock);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700309
310 /* Tell the I2C layer a new client has arrived */
Krzysztof Heltc83c41e2007-07-19 08:00:17 +0200311 if ((err = i2c_attach_client(client)))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700312 goto error1;
313
314 /* Initialize the ADM1021 chip */
Krzysztof Heltc83c41e2007-07-19 08:00:17 +0200315 if (kind != lm84 && !read_only)
316 adm1021_init_client(client);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700317
318 /* Register sysfs hooks */
Krzysztof Heltc83c41e2007-07-19 08:00:17 +0200319 if ((err = sysfs_create_group(&client->dev.kobj, &adm1021_group)))
Mark M. Hoffman681c6f72006-09-24 21:15:35 +0200320 goto error2;
321
Krzysztof Heltc83c41e2007-07-19 08:00:17 +0200322 data->class_dev = hwmon_device_register(&client->dev);
Mark M. Hoffman943b0832005-07-15 21:39:18 -0400323 if (IS_ERR(data->class_dev)) {
324 err = PTR_ERR(data->class_dev);
Mark M. Hoffman681c6f72006-09-24 21:15:35 +0200325 goto error3;
Mark M. Hoffman943b0832005-07-15 21:39:18 -0400326 }
327
Linus Torvalds1da177e2005-04-16 15:20:36 -0700328 return 0;
329
Mark M. Hoffman681c6f72006-09-24 21:15:35 +0200330error3:
Krzysztof Heltc83c41e2007-07-19 08:00:17 +0200331 sysfs_remove_group(&client->dev.kobj, &adm1021_group);
Mark M. Hoffman943b0832005-07-15 21:39:18 -0400332error2:
Krzysztof Heltc83c41e2007-07-19 08:00:17 +0200333 i2c_detach_client(client);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700334error1:
335 kfree(data);
336error0:
337 return err;
338}
339
340static void adm1021_init_client(struct i2c_client *client)
341{
342 /* Enable ADC and disable suspend mode */
Krzysztof Heltc83c41e2007-07-19 08:00:17 +0200343 i2c_smbus_write_byte_data(client, ADM1021_REG_CONFIG_W,
344 i2c_smbus_read_byte_data(client, ADM1021_REG_CONFIG_R) & 0xBF);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700345 /* Set Conversion rate to 1/sec (this can be tinkered with) */
Krzysztof Heltc83c41e2007-07-19 08:00:17 +0200346 i2c_smbus_write_byte_data(client, ADM1021_REG_CONV_RATE_W, 0x04);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700347}
348
349static int adm1021_detach_client(struct i2c_client *client)
350{
Mark M. Hoffman943b0832005-07-15 21:39:18 -0400351 struct adm1021_data *data = i2c_get_clientdata(client);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700352 int err;
353
Mark M. Hoffman943b0832005-07-15 21:39:18 -0400354 hwmon_device_unregister(data->class_dev);
Mark M. Hoffman681c6f72006-09-24 21:15:35 +0200355 sysfs_remove_group(&client->dev.kobj, &adm1021_group);
Mark M. Hoffman943b0832005-07-15 21:39:18 -0400356
Jean Delvare7bef5592005-07-27 22:14:49 +0200357 if ((err = i2c_detach_client(client)))
Linus Torvalds1da177e2005-04-16 15:20:36 -0700358 return err;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700359
Mark M. Hoffman943b0832005-07-15 21:39:18 -0400360 kfree(data);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700361 return 0;
362}
363
Linus Torvalds1da177e2005-04-16 15:20:36 -0700364static struct adm1021_data *adm1021_update_device(struct device *dev)
365{
366 struct i2c_client *client = to_i2c_client(dev);
367 struct adm1021_data *data = i2c_get_clientdata(client);
368
Ingo Molnar9a61bf62006-01-18 23:19:26 +0100369 mutex_lock(&data->update_lock);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700370
371 if (time_after(jiffies, data->last_updated + HZ + HZ / 2)
372 || !data->valid) {
373 dev_dbg(&client->dev, "Starting adm1021 update\n");
374
Krzysztof Heltc83c41e2007-07-19 08:00:17 +0200375 data->temp_input = i2c_smbus_read_byte_data(client,
376 ADM1021_REG_TEMP);
377 data->temp_max = i2c_smbus_read_byte_data(client,
378 ADM1021_REG_TOS_R);
379 data->temp_hyst = i2c_smbus_read_byte_data(client,
380 ADM1021_REG_THYST_R);
381 data->remote_temp_input = i2c_smbus_read_byte_data(client,
382 ADM1021_REG_REMOTE_TEMP);
383 data->remote_temp_max = i2c_smbus_read_byte_data(client,
384 ADM1021_REG_REMOTE_TOS_R);
385 data->remote_temp_hyst = i2c_smbus_read_byte_data(client,
386 ADM1021_REG_REMOTE_THYST_R);
387 data->alarms = i2c_smbus_read_byte_data(client,
388 ADM1021_REG_STATUS) & 0x7c;
Linus Torvalds1da177e2005-04-16 15:20:36 -0700389 if (data->type == adm1023) {
Krzysztof Heltc83c41e2007-07-19 08:00:17 +0200390 data->remote_temp_prec =
391 i2c_smbus_read_byte_data(client,
392 ADM1023_REG_REM_TEMP_PREC);
393 data->remote_temp_os_prec =
394 i2c_smbus_read_byte_data(client,
395 ADM1023_REG_REM_TOS_PREC);
396 data->remote_temp_hyst_prec =
397 i2c_smbus_read_byte_data(client,
398 ADM1023_REG_REM_THYST_PREC);
399 data->remote_temp_offset =
400 i2c_smbus_read_byte_data(client,
401 ADM1023_REG_REM_OFFSET);
402 data->remote_temp_offset_prec =
403 i2c_smbus_read_byte_data(client,
404 ADM1023_REG_REM_OFFSET_PREC);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700405 }
406 data->last_updated = jiffies;
407 data->valid = 1;
408 }
409
Ingo Molnar9a61bf62006-01-18 23:19:26 +0100410 mutex_unlock(&data->update_lock);
Linus Torvalds1da177e2005-04-16 15:20:36 -0700411
412 return data;
413}
414
415static int __init sensors_adm1021_init(void)
416{
417 return i2c_add_driver(&adm1021_driver);
418}
419
420static void __exit sensors_adm1021_exit(void)
421{
422 i2c_del_driver(&adm1021_driver);
423}
424
425MODULE_AUTHOR ("Frodo Looijaard <frodol@dds.nl> and "
426 "Philip Edelbrock <phil@netroedge.com>");
427MODULE_DESCRIPTION("adm1021 driver");
428MODULE_LICENSE("GPL");
429
430module_param(read_only, bool, 0);
431MODULE_PARM_DESC(read_only, "Don't set any values, read only mode");
432
433module_init(sensors_adm1021_init)
434module_exit(sensors_adm1021_exit)