| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* | 
|  | 2 | smsc47b397.c - Part of lm_sensors, Linux kernel modules | 
|  | 3 | for hardware monitoring | 
|  | 4 |  | 
|  | 5 | Supports the SMSC LPC47B397-NC Super-I/O chip. | 
|  | 6 |  | 
|  | 7 | Author/Maintainer: Mark M. Hoffman <mhoffman@lightlink.com> | 
|  | 8 | Copyright (C) 2004 Utilitek Systems, Inc. | 
|  | 9 |  | 
|  | 10 | derived in part from smsc47m1.c: | 
|  | 11 | Copyright (C) 2002 Mark D. Studebaker <mdsxyz123@yahoo.com> | 
|  | 12 | Copyright (C) 2004 Jean Delvare <khali@linux-fr.org> | 
|  | 13 |  | 
|  | 14 | This program is free software; you can redistribute it and/or modify | 
|  | 15 | it under the terms of the GNU General Public License as published by | 
|  | 16 | the Free Software Foundation; either version 2 of the License, or | 
|  | 17 | (at your option) any later version. | 
|  | 18 |  | 
|  | 19 | This program is distributed in the hope that it will be useful, | 
|  | 20 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|  | 21 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|  | 22 | GNU General Public License for more details. | 
|  | 23 |  | 
|  | 24 | You should have received a copy of the GNU General Public License | 
|  | 25 | along with this program; if not, write to the Free Software | 
|  | 26 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 
|  | 27 | */ | 
|  | 28 |  | 
|  | 29 | #include <linux/module.h> | 
|  | 30 | #include <linux/slab.h> | 
|  | 31 | #include <linux/ioport.h> | 
|  | 32 | #include <linux/jiffies.h> | 
|  | 33 | #include <linux/i2c.h> | 
| Jean Delvare | fde0950 | 2005-07-19 23:51:07 +0200 | [diff] [blame] | 34 | #include <linux/i2c-isa.h> | 
| Mark M. Hoffman | 943b083 | 2005-07-15 21:39:18 -0400 | [diff] [blame] | 35 | #include <linux/hwmon.h> | 
|  | 36 | #include <linux/err.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 37 | #include <linux/init.h> | 
| Ingo Molnar | 9a61bf6 | 2006-01-18 23:19:26 +0100 | [diff] [blame] | 38 | #include <linux/mutex.h> | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 39 | #include <asm/io.h> | 
|  | 40 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 41 | /* Address is autodetected, there is no default value */ | 
| Jean Delvare | 2d8672c | 2005-07-19 23:56:35 +0200 | [diff] [blame] | 42 | static unsigned short address; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 43 |  | 
|  | 44 | /* Super-I/0 registers and commands */ | 
|  | 45 |  | 
|  | 46 | #define	REG	0x2e	/* The register to read/write */ | 
|  | 47 | #define	VAL	0x2f	/* The value to read/write */ | 
|  | 48 |  | 
|  | 49 | static inline void superio_outb(int reg, int val) | 
|  | 50 | { | 
|  | 51 | outb(reg, REG); | 
|  | 52 | outb(val, VAL); | 
|  | 53 | } | 
|  | 54 |  | 
|  | 55 | static inline int superio_inb(int reg) | 
|  | 56 | { | 
|  | 57 | outb(reg, REG); | 
|  | 58 | return inb(VAL); | 
|  | 59 | } | 
|  | 60 |  | 
|  | 61 | /* select superio logical device */ | 
|  | 62 | static inline void superio_select(int ld) | 
|  | 63 | { | 
|  | 64 | superio_outb(0x07, ld); | 
|  | 65 | } | 
|  | 66 |  | 
|  | 67 | static inline void superio_enter(void) | 
|  | 68 | { | 
|  | 69 | outb(0x55, REG); | 
|  | 70 | } | 
|  | 71 |  | 
|  | 72 | static inline void superio_exit(void) | 
|  | 73 | { | 
|  | 74 | outb(0xAA, REG); | 
|  | 75 | } | 
|  | 76 |  | 
|  | 77 | #define SUPERIO_REG_DEVID	0x20 | 
|  | 78 | #define SUPERIO_REG_DEVREV	0x21 | 
|  | 79 | #define SUPERIO_REG_BASE_MSB	0x60 | 
|  | 80 | #define SUPERIO_REG_BASE_LSB	0x61 | 
|  | 81 | #define SUPERIO_REG_LD8		0x08 | 
|  | 82 |  | 
|  | 83 | #define SMSC_EXTENT		0x02 | 
|  | 84 |  | 
|  | 85 | /* 0 <= nr <= 3 */ | 
|  | 86 | static u8 smsc47b397_reg_temp[] = {0x25, 0x26, 0x27, 0x80}; | 
|  | 87 | #define SMSC47B397_REG_TEMP(nr)	(smsc47b397_reg_temp[(nr)]) | 
|  | 88 |  | 
|  | 89 | /* 0 <= nr <= 3 */ | 
|  | 90 | #define SMSC47B397_REG_FAN_LSB(nr) (0x28 + 2 * (nr)) | 
|  | 91 | #define SMSC47B397_REG_FAN_MSB(nr) (0x29 + 2 * (nr)) | 
|  | 92 |  | 
|  | 93 | struct smsc47b397_data { | 
|  | 94 | struct i2c_client client; | 
| Mark M. Hoffman | 943b083 | 2005-07-15 21:39:18 -0400 | [diff] [blame] | 95 | struct class_device *class_dev; | 
| Ingo Molnar | 9a61bf6 | 2006-01-18 23:19:26 +0100 | [diff] [blame] | 96 | struct mutex lock; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 97 |  | 
| Ingo Molnar | 9a61bf6 | 2006-01-18 23:19:26 +0100 | [diff] [blame] | 98 | struct mutex update_lock; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 99 | unsigned long last_updated; /* in jiffies */ | 
|  | 100 | int valid; | 
|  | 101 |  | 
|  | 102 | /* register values */ | 
|  | 103 | u16 fan[4]; | 
|  | 104 | u8 temp[4]; | 
|  | 105 | }; | 
|  | 106 |  | 
|  | 107 | static int smsc47b397_read_value(struct i2c_client *client, u8 reg) | 
|  | 108 | { | 
|  | 109 | struct smsc47b397_data *data = i2c_get_clientdata(client); | 
|  | 110 | int res; | 
|  | 111 |  | 
| Ingo Molnar | 9a61bf6 | 2006-01-18 23:19:26 +0100 | [diff] [blame] | 112 | mutex_lock(&data->lock); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 113 | outb(reg, client->addr); | 
|  | 114 | res = inb_p(client->addr + 1); | 
| Ingo Molnar | 9a61bf6 | 2006-01-18 23:19:26 +0100 | [diff] [blame] | 115 | mutex_unlock(&data->lock); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 116 | return res; | 
|  | 117 | } | 
|  | 118 |  | 
|  | 119 | static struct smsc47b397_data *smsc47b397_update_device(struct device *dev) | 
|  | 120 | { | 
|  | 121 | struct i2c_client *client = to_i2c_client(dev); | 
|  | 122 | struct smsc47b397_data *data = i2c_get_clientdata(client); | 
|  | 123 | int i; | 
|  | 124 |  | 
| Ingo Molnar | 9a61bf6 | 2006-01-18 23:19:26 +0100 | [diff] [blame] | 125 | mutex_lock(&data->update_lock); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 126 |  | 
|  | 127 | if (time_after(jiffies, data->last_updated + HZ) || !data->valid) { | 
|  | 128 | dev_dbg(&client->dev, "starting device update...\n"); | 
|  | 129 |  | 
|  | 130 | /* 4 temperature inputs, 4 fan inputs */ | 
|  | 131 | for (i = 0; i < 4; i++) { | 
|  | 132 | data->temp[i] = smsc47b397_read_value(client, | 
|  | 133 | SMSC47B397_REG_TEMP(i)); | 
|  | 134 |  | 
|  | 135 | /* must read LSB first */ | 
|  | 136 | data->fan[i]  = smsc47b397_read_value(client, | 
|  | 137 | SMSC47B397_REG_FAN_LSB(i)); | 
|  | 138 | data->fan[i] |= smsc47b397_read_value(client, | 
|  | 139 | SMSC47B397_REG_FAN_MSB(i)) << 8; | 
|  | 140 | } | 
|  | 141 |  | 
|  | 142 | data->last_updated = jiffies; | 
|  | 143 | data->valid = 1; | 
|  | 144 |  | 
|  | 145 | dev_dbg(&client->dev, "... device update complete\n"); | 
|  | 146 | } | 
|  | 147 |  | 
| Ingo Molnar | 9a61bf6 | 2006-01-18 23:19:26 +0100 | [diff] [blame] | 148 | mutex_unlock(&data->update_lock); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 149 |  | 
|  | 150 | return data; | 
|  | 151 | } | 
|  | 152 |  | 
|  | 153 | /* TEMP: 0.001C/bit (-128C to +127C) | 
|  | 154 | REG: 1C/bit, two's complement */ | 
|  | 155 | static int temp_from_reg(u8 reg) | 
|  | 156 | { | 
|  | 157 | return (s8)reg * 1000; | 
|  | 158 | } | 
|  | 159 |  | 
|  | 160 | /* 0 <= nr <= 3 */ | 
|  | 161 | static ssize_t show_temp(struct device *dev, char *buf, int nr) | 
|  | 162 | { | 
|  | 163 | struct smsc47b397_data *data = smsc47b397_update_device(dev); | 
|  | 164 | return sprintf(buf, "%d\n", temp_from_reg(data->temp[nr])); | 
|  | 165 | } | 
|  | 166 |  | 
|  | 167 | #define sysfs_temp(num) \ | 
| Yani Ioannou | a5099cf | 2005-05-17 06:42:25 -0400 | [diff] [blame] | 168 | static ssize_t show_temp##num(struct device *dev, struct device_attribute *attr, char *buf) \ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 169 | { \ | 
|  | 170 | return show_temp(dev, buf, num-1); \ | 
|  | 171 | } \ | 
|  | 172 | static DEVICE_ATTR(temp##num##_input, S_IRUGO, show_temp##num, NULL) | 
|  | 173 |  | 
|  | 174 | sysfs_temp(1); | 
|  | 175 | sysfs_temp(2); | 
|  | 176 | sysfs_temp(3); | 
|  | 177 | sysfs_temp(4); | 
|  | 178 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 179 | /* FAN: 1 RPM/bit | 
|  | 180 | REG: count of 90kHz pulses / revolution */ | 
|  | 181 | static int fan_from_reg(u16 reg) | 
|  | 182 | { | 
|  | 183 | return 90000 * 60 / reg; | 
|  | 184 | } | 
|  | 185 |  | 
|  | 186 | /* 0 <= nr <= 3 */ | 
|  | 187 | static ssize_t show_fan(struct device *dev, char *buf, int nr) | 
|  | 188 | { | 
|  | 189 | struct smsc47b397_data *data = smsc47b397_update_device(dev); | 
|  | 190 | return sprintf(buf, "%d\n", fan_from_reg(data->fan[nr])); | 
|  | 191 | } | 
|  | 192 |  | 
|  | 193 | #define sysfs_fan(num) \ | 
| Yani Ioannou | a5099cf | 2005-05-17 06:42:25 -0400 | [diff] [blame] | 194 | static ssize_t show_fan##num(struct device *dev, struct device_attribute *attr, char *buf) \ | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 195 | { \ | 
|  | 196 | return show_fan(dev, buf, num-1); \ | 
|  | 197 | } \ | 
|  | 198 | static DEVICE_ATTR(fan##num##_input, S_IRUGO, show_fan##num, NULL) | 
|  | 199 |  | 
|  | 200 | sysfs_fan(1); | 
|  | 201 | sysfs_fan(2); | 
|  | 202 | sysfs_fan(3); | 
|  | 203 | sysfs_fan(4); | 
|  | 204 |  | 
| Mark M. Hoffman | c1685f6 | 2006-09-24 20:59:49 +0200 | [diff] [blame] | 205 | static struct attribute *smsc47b397_attributes[] = { | 
|  | 206 | &dev_attr_temp1_input.attr, | 
|  | 207 | &dev_attr_temp2_input.attr, | 
|  | 208 | &dev_attr_temp3_input.attr, | 
|  | 209 | &dev_attr_temp4_input.attr, | 
|  | 210 | &dev_attr_fan1_input.attr, | 
|  | 211 | &dev_attr_fan2_input.attr, | 
|  | 212 | &dev_attr_fan3_input.attr, | 
|  | 213 | &dev_attr_fan4_input.attr, | 
|  | 214 |  | 
|  | 215 | NULL | 
|  | 216 | }; | 
|  | 217 |  | 
|  | 218 | static const struct attribute_group smsc47b397_group = { | 
|  | 219 | .attrs = smsc47b397_attributes, | 
|  | 220 | }; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 221 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 222 | static int smsc47b397_detach_client(struct i2c_client *client) | 
|  | 223 | { | 
| Mark M. Hoffman | 943b083 | 2005-07-15 21:39:18 -0400 | [diff] [blame] | 224 | struct smsc47b397_data *data = i2c_get_clientdata(client); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 225 | int err; | 
|  | 226 |  | 
| Mark M. Hoffman | 943b083 | 2005-07-15 21:39:18 -0400 | [diff] [blame] | 227 | hwmon_device_unregister(data->class_dev); | 
| Mark M. Hoffman | c1685f6 | 2006-09-24 20:59:49 +0200 | [diff] [blame] | 228 | sysfs_remove_group(&client->dev.kobj, &smsc47b397_group); | 
| Mark M. Hoffman | 943b083 | 2005-07-15 21:39:18 -0400 | [diff] [blame] | 229 |  | 
| Jean Delvare | 7bef559 | 2005-07-27 22:14:49 +0200 | [diff] [blame] | 230 | if ((err = i2c_detach_client(client))) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 231 | return err; | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 232 |  | 
|  | 233 | release_region(client->addr, SMSC_EXTENT); | 
| Mark M. Hoffman | 943b083 | 2005-07-15 21:39:18 -0400 | [diff] [blame] | 234 | kfree(data); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 235 |  | 
|  | 236 | return 0; | 
|  | 237 | } | 
|  | 238 |  | 
| Jean Delvare | 2d8672c | 2005-07-19 23:56:35 +0200 | [diff] [blame] | 239 | static int smsc47b397_detect(struct i2c_adapter *adapter); | 
|  | 240 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 241 | static struct i2c_driver smsc47b397_driver = { | 
| Laurent Riffard | cdaf793 | 2005-11-26 20:37:41 +0100 | [diff] [blame] | 242 | .driver = { | 
| Jean Delvare | 8721884 | 2006-09-03 22:36:14 +0200 | [diff] [blame] | 243 | .owner	= THIS_MODULE, | 
| Laurent Riffard | cdaf793 | 2005-11-26 20:37:41 +0100 | [diff] [blame] | 244 | .name	= "smsc47b397", | 
|  | 245 | }, | 
| Jean Delvare | 2d8672c | 2005-07-19 23:56:35 +0200 | [diff] [blame] | 246 | .attach_adapter	= smsc47b397_detect, | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 247 | .detach_client	= smsc47b397_detach_client, | 
|  | 248 | }; | 
|  | 249 |  | 
| Jean Delvare | 2d8672c | 2005-07-19 23:56:35 +0200 | [diff] [blame] | 250 | static int smsc47b397_detect(struct i2c_adapter *adapter) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 251 | { | 
|  | 252 | struct i2c_client *new_client; | 
|  | 253 | struct smsc47b397_data *data; | 
|  | 254 | int err = 0; | 
|  | 255 |  | 
| Laurent Riffard | cdaf793 | 2005-11-26 20:37:41 +0100 | [diff] [blame] | 256 | if (!request_region(address, SMSC_EXTENT, | 
|  | 257 | smsc47b397_driver.driver.name)) { | 
| Jean Delvare | 2d8672c | 2005-07-19 23:56:35 +0200 | [diff] [blame] | 258 | dev_err(&adapter->dev, "Region 0x%x already in use!\n", | 
|  | 259 | address); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 260 | return -EBUSY; | 
|  | 261 | } | 
|  | 262 |  | 
| Deepak Saxena | ba9c2e8 | 2005-10-17 23:08:32 +0200 | [diff] [blame] | 263 | if (!(data = kzalloc(sizeof(struct smsc47b397_data), GFP_KERNEL))) { | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 264 | err = -ENOMEM; | 
|  | 265 | goto error_release; | 
|  | 266 | } | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 267 |  | 
|  | 268 | new_client = &data->client; | 
|  | 269 | i2c_set_clientdata(new_client, data); | 
| Jean Delvare | 2d8672c | 2005-07-19 23:56:35 +0200 | [diff] [blame] | 270 | new_client->addr = address; | 
| Ingo Molnar | 9a61bf6 | 2006-01-18 23:19:26 +0100 | [diff] [blame] | 271 | mutex_init(&data->lock); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 272 | new_client->adapter = adapter; | 
|  | 273 | new_client->driver = &smsc47b397_driver; | 
|  | 274 | new_client->flags = 0; | 
|  | 275 |  | 
|  | 276 | strlcpy(new_client->name, "smsc47b397", I2C_NAME_SIZE); | 
|  | 277 |  | 
| Ingo Molnar | 9a61bf6 | 2006-01-18 23:19:26 +0100 | [diff] [blame] | 278 | mutex_init(&data->update_lock); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 279 |  | 
|  | 280 | if ((err = i2c_attach_client(new_client))) | 
|  | 281 | goto error_free; | 
|  | 282 |  | 
| Mark M. Hoffman | c1685f6 | 2006-09-24 20:59:49 +0200 | [diff] [blame] | 283 | if ((err = sysfs_create_group(&new_client->dev.kobj, &smsc47b397_group))) | 
|  | 284 | goto error_detach; | 
|  | 285 |  | 
| Mark M. Hoffman | 943b083 | 2005-07-15 21:39:18 -0400 | [diff] [blame] | 286 | data->class_dev = hwmon_device_register(&new_client->dev); | 
|  | 287 | if (IS_ERR(data->class_dev)) { | 
|  | 288 | err = PTR_ERR(data->class_dev); | 
| Mark M. Hoffman | c1685f6 | 2006-09-24 20:59:49 +0200 | [diff] [blame] | 289 | goto error_remove; | 
| Mark M. Hoffman | 943b083 | 2005-07-15 21:39:18 -0400 | [diff] [blame] | 290 | } | 
|  | 291 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 292 | return 0; | 
|  | 293 |  | 
| Mark M. Hoffman | c1685f6 | 2006-09-24 20:59:49 +0200 | [diff] [blame] | 294 | error_remove: | 
|  | 295 | sysfs_remove_group(&new_client->dev.kobj, &smsc47b397_group); | 
| Mark M. Hoffman | 943b083 | 2005-07-15 21:39:18 -0400 | [diff] [blame] | 296 | error_detach: | 
|  | 297 | i2c_detach_client(new_client); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 298 | error_free: | 
| Alexey Dobriyan | 1f57ff8 | 2005-08-26 01:49:14 +0400 | [diff] [blame] | 299 | kfree(data); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 300 | error_release: | 
| Jean Delvare | 2d8672c | 2005-07-19 23:56:35 +0200 | [diff] [blame] | 301 | release_region(address, SMSC_EXTENT); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 302 | return err; | 
|  | 303 | } | 
|  | 304 |  | 
| Jean Delvare | 2d8672c | 2005-07-19 23:56:35 +0200 | [diff] [blame] | 305 | static int __init smsc47b397_find(unsigned short *addr) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 306 | { | 
|  | 307 | u8 id, rev; | 
|  | 308 |  | 
|  | 309 | superio_enter(); | 
|  | 310 | id = superio_inb(SUPERIO_REG_DEVID); | 
|  | 311 |  | 
| Mark M. Hoffman | 7ab83a9 | 2005-10-17 23:01:45 +0200 | [diff] [blame] | 312 | if ((id != 0x6f) && (id != 0x81)) { | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 313 | superio_exit(); | 
|  | 314 | return -ENODEV; | 
|  | 315 | } | 
|  | 316 |  | 
|  | 317 | rev = superio_inb(SUPERIO_REG_DEVREV); | 
|  | 318 |  | 
|  | 319 | superio_select(SUPERIO_REG_LD8); | 
|  | 320 | *addr = (superio_inb(SUPERIO_REG_BASE_MSB) << 8) | 
|  | 321 | |  superio_inb(SUPERIO_REG_BASE_LSB); | 
|  | 322 |  | 
| Mark M. Hoffman | 7ab83a9 | 2005-10-17 23:01:45 +0200 | [diff] [blame] | 323 | printk(KERN_INFO "smsc47b397: found SMSC %s " | 
|  | 324 | "(base address 0x%04x, revision %u)\n", | 
|  | 325 | id == 0x81 ? "SCH5307-NS" : "LPC47B397-NC", *addr, rev); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 326 |  | 
|  | 327 | superio_exit(); | 
|  | 328 | return 0; | 
|  | 329 | } | 
|  | 330 |  | 
|  | 331 | static int __init smsc47b397_init(void) | 
|  | 332 | { | 
|  | 333 | int ret; | 
|  | 334 |  | 
| Jean Delvare | 2d8672c | 2005-07-19 23:56:35 +0200 | [diff] [blame] | 335 | if ((ret = smsc47b397_find(&address))) | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 336 | return ret; | 
|  | 337 |  | 
| Jean Delvare | fde0950 | 2005-07-19 23:51:07 +0200 | [diff] [blame] | 338 | return i2c_isa_add_driver(&smsc47b397_driver); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 339 | } | 
|  | 340 |  | 
|  | 341 | static void __exit smsc47b397_exit(void) | 
|  | 342 | { | 
| Jean Delvare | fde0950 | 2005-07-19 23:51:07 +0200 | [diff] [blame] | 343 | i2c_isa_del_driver(&smsc47b397_driver); | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 344 | } | 
|  | 345 |  | 
|  | 346 | MODULE_AUTHOR("Mark M. Hoffman <mhoffman@lightlink.com>"); | 
|  | 347 | MODULE_DESCRIPTION("SMSC LPC47B397 driver"); | 
|  | 348 | MODULE_LICENSE("GPL"); | 
|  | 349 |  | 
|  | 350 | module_init(smsc47b397_init); | 
|  | 351 | module_exit(smsc47b397_exit); |