| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 1 | /* | 
|  | 2 | i2c-viapro.c - Part of lm_sensors, Linux kernel modules for hardware | 
|  | 3 | monitoring | 
|  | 4 | Copyright (c) 1998 - 2002  Frodo Looijaard <frodol@dds.nl>, | 
|  | 5 | Philip Edelbrock <phil@netroedge.com>, Kyösti Mälkki <kmalkki@cc.hut.fi>, | 
|  | 6 | Mark D. Studebaker <mdsxyz123@yahoo.com> | 
|  | 7 |  | 
|  | 8 | This program is free software; you can redistribute it and/or modify | 
|  | 9 | it under the terms of the GNU General Public License as published by | 
|  | 10 | the Free Software Foundation; either version 2 of the License, or | 
|  | 11 | (at your option) any later version. | 
|  | 12 |  | 
|  | 13 | This program is distributed in the hope that it will be useful, | 
|  | 14 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|  | 15 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|  | 16 | GNU General Public License for more details. | 
|  | 17 |  | 
|  | 18 | You should have received a copy of the GNU General Public License | 
|  | 19 | along with this program; if not, write to the Free Software | 
|  | 20 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 
|  | 21 | */ | 
|  | 22 |  | 
|  | 23 | /* | 
|  | 24 | Supports Via devices: | 
|  | 25 | 82C596A/B (0x3050) | 
|  | 26 | 82C596B (0x3051) | 
|  | 27 | 82C686A/B | 
|  | 28 | 8231 | 
|  | 29 | 8233 | 
|  | 30 | 8233A (0x3147 and 0x3177) | 
|  | 31 | 8235 | 
|  | 32 | 8237 | 
|  | 33 | Note: we assume there can only be one device, with one SMBus interface. | 
|  | 34 | */ | 
|  | 35 |  | 
| Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 36 | #include <linux/module.h> | 
|  | 37 | #include <linux/delay.h> | 
|  | 38 | #include <linux/pci.h> | 
|  | 39 | #include <linux/kernel.h> | 
|  | 40 | #include <linux/stddef.h> | 
|  | 41 | #include <linux/sched.h> | 
|  | 42 | #include <linux/ioport.h> | 
|  | 43 | #include <linux/i2c.h> | 
|  | 44 | #include <linux/init.h> | 
|  | 45 | #include <asm/io.h> | 
|  | 46 |  | 
|  | 47 | static struct pci_dev *vt596_pdev; | 
|  | 48 |  | 
|  | 49 | #define SMBBA1	   	 0x90 | 
|  | 50 | #define SMBBA2     	 0x80 | 
|  | 51 | #define SMBBA3     	 0xD0 | 
|  | 52 |  | 
|  | 53 | /* SMBus address offsets */ | 
|  | 54 | static unsigned short vt596_smba; | 
|  | 55 | #define SMBHSTSTS	(vt596_smba + 0) | 
|  | 56 | #define SMBHSLVSTS	(vt596_smba + 1) | 
|  | 57 | #define SMBHSTCNT	(vt596_smba + 2) | 
|  | 58 | #define SMBHSTCMD	(vt596_smba + 3) | 
|  | 59 | #define SMBHSTADD	(vt596_smba + 4) | 
|  | 60 | #define SMBHSTDAT0	(vt596_smba + 5) | 
|  | 61 | #define SMBHSTDAT1	(vt596_smba + 6) | 
|  | 62 | #define SMBBLKDAT	(vt596_smba + 7) | 
|  | 63 | #define SMBSLVCNT	(vt596_smba + 8) | 
|  | 64 | #define SMBSHDWCMD	(vt596_smba + 9) | 
|  | 65 | #define SMBSLVEVT	(vt596_smba + 0xA) | 
|  | 66 | #define SMBSLVDAT	(vt596_smba + 0xC) | 
|  | 67 |  | 
|  | 68 | /* PCI Address Constants */ | 
|  | 69 |  | 
|  | 70 | /* SMBus data in configuration space can be found in two places, | 
|  | 71 | We try to select the better one*/ | 
|  | 72 |  | 
|  | 73 | static unsigned short smb_cf_hstcfg = 0xD2; | 
|  | 74 |  | 
|  | 75 | #define SMBHSTCFG   (smb_cf_hstcfg) | 
|  | 76 | #define SMBSLVC     (smb_cf_hstcfg + 1) | 
|  | 77 | #define SMBSHDW1    (smb_cf_hstcfg + 2) | 
|  | 78 | #define SMBSHDW2    (smb_cf_hstcfg + 3) | 
|  | 79 | #define SMBREV      (smb_cf_hstcfg + 4) | 
|  | 80 |  | 
|  | 81 | /* Other settings */ | 
|  | 82 | #define MAX_TIMEOUT	500 | 
|  | 83 | #define ENABLE_INT9	0 | 
|  | 84 |  | 
|  | 85 | /* VT82C596 constants */ | 
|  | 86 | #define VT596_QUICK      0x00 | 
|  | 87 | #define VT596_BYTE       0x04 | 
|  | 88 | #define VT596_BYTE_DATA  0x08 | 
|  | 89 | #define VT596_WORD_DATA  0x0C | 
|  | 90 | #define VT596_BLOCK_DATA 0x14 | 
|  | 91 |  | 
|  | 92 |  | 
|  | 93 | /* If force is set to anything different from 0, we forcibly enable the | 
|  | 94 | VT596. DANGEROUS! */ | 
|  | 95 | static int force; | 
|  | 96 | module_param(force, bool, 0); | 
|  | 97 | MODULE_PARM_DESC(force, "Forcibly enable the SMBus. DANGEROUS!"); | 
|  | 98 |  | 
|  | 99 | /* If force_addr is set to anything different from 0, we forcibly enable | 
|  | 100 | the VT596 at the given address. VERY DANGEROUS! */ | 
|  | 101 | static u16 force_addr; | 
|  | 102 | module_param(force_addr, ushort, 0); | 
|  | 103 | MODULE_PARM_DESC(force_addr, | 
|  | 104 | "Forcibly enable the SMBus at the given address. " | 
|  | 105 | "EXTREMELY DANGEROUS!"); | 
|  | 106 |  | 
|  | 107 |  | 
|  | 108 | static struct i2c_adapter vt596_adapter; | 
|  | 109 |  | 
|  | 110 | /* Another internally used function */ | 
|  | 111 | static int vt596_transaction(void) | 
|  | 112 | { | 
|  | 113 | int temp; | 
|  | 114 | int result = 0; | 
|  | 115 | int timeout = 0; | 
|  | 116 |  | 
|  | 117 | dev_dbg(&vt596_adapter.dev, "Transaction (pre): CNT=%02x, CMD=%02x, " | 
|  | 118 | "ADD=%02x, DAT0=%02x, DAT1=%02x\n", inb_p(SMBHSTCNT), | 
|  | 119 | inb_p(SMBHSTCMD), inb_p(SMBHSTADD), inb_p(SMBHSTDAT0), | 
|  | 120 | inb_p(SMBHSTDAT1)); | 
|  | 121 |  | 
|  | 122 | /* Make sure the SMBus host is ready to start transmitting */ | 
|  | 123 | if ((temp = inb_p(SMBHSTSTS)) & 0x1F) { | 
|  | 124 | dev_dbg(&vt596_adapter.dev, "SMBus busy (0x%02x). " | 
|  | 125 | "Resetting...\n", temp); | 
|  | 126 |  | 
|  | 127 | outb_p(temp, SMBHSTSTS); | 
|  | 128 | if ((temp = inb_p(SMBHSTSTS)) & 0x1F) { | 
|  | 129 | dev_dbg(&vt596_adapter.dev, "Failed! (0x%02x)\n", temp); | 
|  | 130 |  | 
|  | 131 | return -1; | 
|  | 132 | } else { | 
|  | 133 | dev_dbg(&vt596_adapter.dev, "Successfull!\n"); | 
|  | 134 | } | 
|  | 135 | } | 
|  | 136 |  | 
|  | 137 | /* start the transaction by setting bit 6 */ | 
|  | 138 | outb_p(inb(SMBHSTCNT) | 0x040, SMBHSTCNT); | 
|  | 139 |  | 
|  | 140 | /* We will always wait for a fraction of a second! | 
|  | 141 | I don't know if VIA needs this, Intel did  */ | 
|  | 142 | do { | 
|  | 143 | msleep(1); | 
|  | 144 | temp = inb_p(SMBHSTSTS); | 
|  | 145 | } while ((temp & 0x01) && (timeout++ < MAX_TIMEOUT)); | 
|  | 146 |  | 
|  | 147 | /* If the SMBus is still busy, we give up */ | 
|  | 148 | if (timeout >= MAX_TIMEOUT) { | 
|  | 149 | result = -1; | 
|  | 150 | dev_dbg(&vt596_adapter.dev, "SMBus Timeout!\n"); | 
|  | 151 | } | 
|  | 152 |  | 
|  | 153 | if (temp & 0x10) { | 
|  | 154 | result = -1; | 
|  | 155 | dev_dbg(&vt596_adapter.dev, "Error: Failed bus transaction\n"); | 
|  | 156 | } | 
|  | 157 |  | 
|  | 158 | if (temp & 0x08) { | 
|  | 159 | result = -1; | 
|  | 160 | dev_info(&vt596_adapter.dev, "Bus collision! SMBus may be " | 
|  | 161 | "locked until next hard\nreset. (sorry!)\n"); | 
|  | 162 | /* Clock stops and slave is stuck in mid-transmission */ | 
|  | 163 | } | 
|  | 164 |  | 
|  | 165 | if (temp & 0x04) { | 
|  | 166 | result = -1; | 
|  | 167 | dev_dbg(&vt596_adapter.dev, "Error: no response!\n"); | 
|  | 168 | } | 
|  | 169 |  | 
|  | 170 | if ((temp = inb_p(SMBHSTSTS)) & 0x1F) { | 
|  | 171 | outb_p(temp, SMBHSTSTS); | 
|  | 172 | if ((temp = inb_p(SMBHSTSTS)) & 0x1F) { | 
|  | 173 | dev_warn(&vt596_adapter.dev, "Failed reset at end " | 
|  | 174 | "of transaction (%02x)\n", temp); | 
|  | 175 | } | 
|  | 176 | } | 
|  | 177 |  | 
|  | 178 | dev_dbg(&vt596_adapter.dev, "Transaction (post): CNT=%02x, CMD=%02x, " | 
|  | 179 | "ADD=%02x, DAT0=%02x, DAT1=%02x\n", inb_p(SMBHSTCNT), | 
|  | 180 | inb_p(SMBHSTCMD), inb_p(SMBHSTADD), inb_p(SMBHSTDAT0), | 
|  | 181 | inb_p(SMBHSTDAT1)); | 
|  | 182 |  | 
|  | 183 | return result; | 
|  | 184 | } | 
|  | 185 |  | 
|  | 186 | /* Return -1 on error. */ | 
|  | 187 | static s32 vt596_access(struct i2c_adapter *adap, u16 addr, | 
|  | 188 | unsigned short flags,  char read_write, u8 command, | 
|  | 189 | int size,  union i2c_smbus_data *data) | 
|  | 190 | { | 
|  | 191 | int i, len; | 
|  | 192 |  | 
|  | 193 | switch (size) { | 
|  | 194 | case I2C_SMBUS_PROC_CALL: | 
|  | 195 | dev_info(&vt596_adapter.dev, | 
|  | 196 | "I2C_SMBUS_PROC_CALL not supported!\n"); | 
|  | 197 | return -1; | 
|  | 198 | case I2C_SMBUS_QUICK: | 
|  | 199 | outb_p(((addr & 0x7f) << 1) | (read_write & 0x01), | 
|  | 200 | SMBHSTADD); | 
|  | 201 | size = VT596_QUICK; | 
|  | 202 | break; | 
|  | 203 | case I2C_SMBUS_BYTE: | 
|  | 204 | outb_p(((addr & 0x7f) << 1) | (read_write & 0x01), | 
|  | 205 | SMBHSTADD); | 
|  | 206 | if (read_write == I2C_SMBUS_WRITE) | 
|  | 207 | outb_p(command, SMBHSTCMD); | 
|  | 208 | size = VT596_BYTE; | 
|  | 209 | break; | 
|  | 210 | case I2C_SMBUS_BYTE_DATA: | 
|  | 211 | outb_p(((addr & 0x7f) << 1) | (read_write & 0x01), | 
|  | 212 | SMBHSTADD); | 
|  | 213 | outb_p(command, SMBHSTCMD); | 
|  | 214 | if (read_write == I2C_SMBUS_WRITE) | 
|  | 215 | outb_p(data->byte, SMBHSTDAT0); | 
|  | 216 | size = VT596_BYTE_DATA; | 
|  | 217 | break; | 
|  | 218 | case I2C_SMBUS_WORD_DATA: | 
|  | 219 | outb_p(((addr & 0x7f) << 1) | (read_write & 0x01), | 
|  | 220 | SMBHSTADD); | 
|  | 221 | outb_p(command, SMBHSTCMD); | 
|  | 222 | if (read_write == I2C_SMBUS_WRITE) { | 
|  | 223 | outb_p(data->word & 0xff, SMBHSTDAT0); | 
|  | 224 | outb_p((data->word & 0xff00) >> 8, SMBHSTDAT1); | 
|  | 225 | } | 
|  | 226 | size = VT596_WORD_DATA; | 
|  | 227 | break; | 
|  | 228 | case I2C_SMBUS_BLOCK_DATA: | 
|  | 229 | outb_p(((addr & 0x7f) << 1) | (read_write & 0x01), | 
|  | 230 | SMBHSTADD); | 
|  | 231 | outb_p(command, SMBHSTCMD); | 
|  | 232 | if (read_write == I2C_SMBUS_WRITE) { | 
|  | 233 | len = data->block[0]; | 
|  | 234 | if (len < 0) | 
|  | 235 | len = 0; | 
|  | 236 | if (len > I2C_SMBUS_BLOCK_MAX) | 
|  | 237 | len = I2C_SMBUS_BLOCK_MAX; | 
|  | 238 | outb_p(len, SMBHSTDAT0); | 
|  | 239 | i = inb_p(SMBHSTCNT);	/* Reset SMBBLKDAT */ | 
|  | 240 | for (i = 1; i <= len; i++) | 
|  | 241 | outb_p(data->block[i], SMBBLKDAT); | 
|  | 242 | } | 
|  | 243 | size = VT596_BLOCK_DATA; | 
|  | 244 | break; | 
|  | 245 | } | 
|  | 246 |  | 
|  | 247 | outb_p((size & 0x1C) + (ENABLE_INT9 & 1), SMBHSTCNT); | 
|  | 248 |  | 
|  | 249 | if (vt596_transaction()) /* Error in transaction */ | 
|  | 250 | return -1; | 
|  | 251 |  | 
|  | 252 | if ((read_write == I2C_SMBUS_WRITE) || (size == VT596_QUICK)) | 
|  | 253 | return 0; | 
|  | 254 |  | 
|  | 255 | switch (size) { | 
|  | 256 | case VT596_BYTE: | 
|  | 257 | /* Where is the result put? I assume here it is in | 
|  | 258 | * SMBHSTDAT0 but it might just as well be in the | 
|  | 259 | * SMBHSTCMD. No clue in the docs | 
|  | 260 | */ | 
|  | 261 | data->byte = inb_p(SMBHSTDAT0); | 
|  | 262 | break; | 
|  | 263 | case VT596_BYTE_DATA: | 
|  | 264 | data->byte = inb_p(SMBHSTDAT0); | 
|  | 265 | break; | 
|  | 266 | case VT596_WORD_DATA: | 
|  | 267 | data->word = inb_p(SMBHSTDAT0) + (inb_p(SMBHSTDAT1) << 8); | 
|  | 268 | break; | 
|  | 269 | case VT596_BLOCK_DATA: | 
|  | 270 | data->block[0] = inb_p(SMBHSTDAT0); | 
|  | 271 | if (data->block[0] > I2C_SMBUS_BLOCK_MAX) | 
|  | 272 | data->block[0] = I2C_SMBUS_BLOCK_MAX; | 
|  | 273 | i = inb_p(SMBHSTCNT);	/* Reset SMBBLKDAT */ | 
|  | 274 | for (i = 1; i <= data->block[0]; i++) | 
|  | 275 | data->block[i] = inb_p(SMBBLKDAT); | 
|  | 276 | break; | 
|  | 277 | } | 
|  | 278 | return 0; | 
|  | 279 | } | 
|  | 280 |  | 
|  | 281 | static u32 vt596_func(struct i2c_adapter *adapter) | 
|  | 282 | { | 
|  | 283 | return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | | 
|  | 284 | I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA | | 
|  | 285 | I2C_FUNC_SMBUS_BLOCK_DATA; | 
|  | 286 | } | 
|  | 287 |  | 
|  | 288 | static struct i2c_algorithm smbus_algorithm = { | 
|  | 289 | .name		= "Non-I2C SMBus adapter", | 
|  | 290 | .id		= I2C_ALGO_SMBUS, | 
|  | 291 | .smbus_xfer	= vt596_access, | 
|  | 292 | .functionality	= vt596_func, | 
|  | 293 | }; | 
|  | 294 |  | 
|  | 295 | static struct i2c_adapter vt596_adapter = { | 
|  | 296 | .owner		= THIS_MODULE, | 
|  | 297 | .class		= I2C_CLASS_HWMON, | 
|  | 298 | .algo		= &smbus_algorithm, | 
|  | 299 | .name		= "unset", | 
|  | 300 | }; | 
|  | 301 |  | 
|  | 302 | static int __devinit vt596_probe(struct pci_dev *pdev, | 
|  | 303 | const struct pci_device_id *id) | 
|  | 304 | { | 
|  | 305 | unsigned char temp; | 
|  | 306 | int error = -ENODEV; | 
|  | 307 |  | 
|  | 308 | /* Determine the address of the SMBus areas */ | 
|  | 309 | if (force_addr) { | 
|  | 310 | vt596_smba = force_addr & 0xfff0; | 
|  | 311 | force = 0; | 
|  | 312 | goto found; | 
|  | 313 | } | 
|  | 314 |  | 
|  | 315 | if ((pci_read_config_word(pdev, id->driver_data, &vt596_smba)) || | 
|  | 316 | !(vt596_smba & 0x1)) { | 
|  | 317 | /* try 2nd address and config reg. for 596 */ | 
|  | 318 | if (id->device == PCI_DEVICE_ID_VIA_82C596_3 && | 
|  | 319 | !pci_read_config_word(pdev, SMBBA2, &vt596_smba) && | 
|  | 320 | (vt596_smba & 0x1)) { | 
|  | 321 | smb_cf_hstcfg = 0x84; | 
|  | 322 | } else { | 
|  | 323 | /* no matches at all */ | 
|  | 324 | dev_err(&pdev->dev, "Cannot configure " | 
|  | 325 | "SMBus I/O Base address\n"); | 
|  | 326 | return -ENODEV; | 
|  | 327 | } | 
|  | 328 | } | 
|  | 329 |  | 
|  | 330 | vt596_smba &= 0xfff0; | 
|  | 331 | if (vt596_smba == 0) { | 
|  | 332 | dev_err(&pdev->dev, "SMBus base address " | 
|  | 333 | "uninitialized - upgrade BIOS or use " | 
|  | 334 | "force_addr=0xaddr\n"); | 
|  | 335 | return -ENODEV; | 
|  | 336 | } | 
|  | 337 |  | 
|  | 338 | found: | 
|  | 339 | if (!request_region(vt596_smba, 8, "viapro-smbus")) { | 
|  | 340 | dev_err(&pdev->dev, "SMBus region 0x%x already in use!\n", | 
|  | 341 | vt596_smba); | 
|  | 342 | return -ENODEV; | 
|  | 343 | } | 
|  | 344 |  | 
|  | 345 | pci_read_config_byte(pdev, SMBHSTCFG, &temp); | 
|  | 346 | /* If force_addr is set, we program the new address here. Just to make | 
|  | 347 | sure, we disable the VT596 first. */ | 
|  | 348 | if (force_addr) { | 
|  | 349 | pci_write_config_byte(pdev, SMBHSTCFG, temp & 0xfe); | 
|  | 350 | pci_write_config_word(pdev, id->driver_data, vt596_smba); | 
|  | 351 | pci_write_config_byte(pdev, SMBHSTCFG, temp | 0x01); | 
|  | 352 | dev_warn(&pdev->dev, "WARNING: SMBus interface set to new " | 
|  | 353 | "address 0x%04x!\n", vt596_smba); | 
|  | 354 | } else if ((temp & 1) == 0) { | 
|  | 355 | if (force) { | 
|  | 356 | /* NOTE: This assumes I/O space and other allocations | 
|  | 357 | * WERE done by the Bios!  Don't complain if your | 
|  | 358 | * hardware does weird things after enabling this. | 
|  | 359 | * :') Check for Bios updates before resorting to | 
|  | 360 | * this. | 
|  | 361 | */ | 
|  | 362 | pci_write_config_byte(pdev, SMBHSTCFG, temp | 1); | 
|  | 363 | dev_info(&pdev->dev, "Enabling SMBus device\n"); | 
|  | 364 | } else { | 
|  | 365 | dev_err(&pdev->dev, "SMBUS: Error: Host SMBus " | 
|  | 366 | "controller not enabled! - upgrade BIOS or " | 
|  | 367 | "use force=1\n"); | 
|  | 368 | goto release_region; | 
|  | 369 | } | 
|  | 370 | } | 
|  | 371 |  | 
|  | 372 | if ((temp & 0x0E) == 8) | 
|  | 373 | dev_dbg(&pdev->dev, "using Interrupt 9 for SMBus.\n"); | 
|  | 374 | else if ((temp & 0x0E) == 0) | 
|  | 375 | dev_dbg(&pdev->dev, "using Interrupt SMI# for SMBus.\n"); | 
|  | 376 | else | 
|  | 377 | dev_dbg(&pdev->dev, "Illegal Interrupt configuration " | 
|  | 378 | "(or code out of date)!\n"); | 
|  | 379 |  | 
|  | 380 | pci_read_config_byte(pdev, SMBREV, &temp); | 
|  | 381 | dev_dbg(&pdev->dev, "SMBREV = 0x%X\n", temp); | 
|  | 382 | dev_dbg(&pdev->dev, "VT596_smba = 0x%X\n", vt596_smba); | 
|  | 383 |  | 
|  | 384 | vt596_adapter.dev.parent = &pdev->dev; | 
|  | 385 | snprintf(vt596_adapter.name, I2C_NAME_SIZE, | 
|  | 386 | "SMBus Via Pro adapter at %04x", vt596_smba); | 
|  | 387 |  | 
|  | 388 | vt596_pdev = pci_dev_get(pdev); | 
|  | 389 | if (i2c_add_adapter(&vt596_adapter)) { | 
|  | 390 | pci_dev_put(vt596_pdev); | 
|  | 391 | vt596_pdev = NULL; | 
|  | 392 | } | 
|  | 393 |  | 
|  | 394 | /* Always return failure here.  This is to allow other drivers to bind | 
|  | 395 | * to this pci device.  We don't really want to have control over the | 
|  | 396 | * pci device, we only wanted to read as few register values from it. | 
|  | 397 | */ | 
|  | 398 | return -ENODEV; | 
|  | 399 |  | 
|  | 400 | release_region: | 
|  | 401 | release_region(vt596_smba, 8); | 
|  | 402 | return error; | 
|  | 403 | } | 
|  | 404 |  | 
|  | 405 | static struct pci_device_id vt596_ids[] = { | 
|  | 406 | { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C596_3), | 
|  | 407 | .driver_data = SMBBA1 }, | 
|  | 408 | { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C596B_3), | 
|  | 409 | .driver_data = SMBBA1 }, | 
|  | 410 | { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C686_4), | 
|  | 411 | .driver_data = SMBBA1 }, | 
|  | 412 | { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8233_0), | 
|  | 413 | .driver_data = SMBBA3 }, | 
|  | 414 | { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8233A), | 
|  | 415 | .driver_data = SMBBA3 }, | 
|  | 416 | { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8235), | 
|  | 417 | .driver_data = SMBBA3 }, | 
|  | 418 | { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8237), | 
|  | 419 | .driver_data = SMBBA3 }, | 
|  | 420 | { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8231_4), | 
|  | 421 | .driver_data = SMBBA1 }, | 
|  | 422 | { 0, } | 
|  | 423 | }; | 
|  | 424 |  | 
|  | 425 | MODULE_DEVICE_TABLE (pci, vt596_ids); | 
|  | 426 |  | 
|  | 427 | static struct pci_driver vt596_driver = { | 
|  | 428 | .name		= "vt596_smbus", | 
|  | 429 | .id_table	= vt596_ids, | 
|  | 430 | .probe		= vt596_probe, | 
|  | 431 | }; | 
|  | 432 |  | 
|  | 433 | static int __init i2c_vt596_init(void) | 
|  | 434 | { | 
|  | 435 | return pci_register_driver(&vt596_driver); | 
|  | 436 | } | 
|  | 437 |  | 
|  | 438 |  | 
|  | 439 | static void __exit i2c_vt596_exit(void) | 
|  | 440 | { | 
|  | 441 | pci_unregister_driver(&vt596_driver); | 
|  | 442 | if (vt596_pdev != NULL) { | 
|  | 443 | i2c_del_adapter(&vt596_adapter); | 
|  | 444 | release_region(vt596_smba, 8); | 
|  | 445 | pci_dev_put(vt596_pdev); | 
|  | 446 | vt596_pdev = NULL; | 
|  | 447 | } | 
|  | 448 | } | 
|  | 449 |  | 
|  | 450 | MODULE_AUTHOR( | 
|  | 451 | "Frodo Looijaard <frodol@dds.nl> and " | 
|  | 452 | "Philip Edelbrock <phil@netroedge.com>"); | 
|  | 453 | MODULE_DESCRIPTION("vt82c596 SMBus driver"); | 
|  | 454 | MODULE_LICENSE("GPL"); | 
|  | 455 |  | 
|  | 456 | module_init(i2c_vt596_init); | 
|  | 457 | module_exit(i2c_vt596_exit); |