diff options
author | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-13 19:28:23 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-02-13 19:28:23 -0500 |
commit | 33e563c1190c26b6bf61990c505cdcb5cdbba7e4 (patch) | |
tree | e0d7e383d4ea54fd5fe3595bd032dddea60275bf /drivers | |
parent | 463020ce428e2f00d4f33a383d6f39c7453a6854 (diff) | |
parent | 5dd3ffae0afe355738eca14da1b47284bdae6240 (diff) |
Merge branch 'i2c-for-linus' of git://jdelvare.pck.nerim.net/jdelvare-2.6
* 'i2c-for-linus' of git://jdelvare.pck.nerim.net/jdelvare-2.6:
i2c: Stop using i2c_adapter.class_dev
i2c: Remove the warning on missing adapter device
i2c: Declare more i2c_adapter parent devices
i2c: PA Semi SMBus driver
i2c-amd8111: Proposed cleanups
i2c-parport: Add support for One For All remote JP1 interface
i2c-viapro: Add support for the VIA CX700 south bridge
i2c: Add IDs to adapters
i2c: Update the list of bus IDs
i2c: Add driver suspend/resume/shutdown support
i2c: completion header cleanups
i2c-i801: Document the SMBus unhiding quirk
i2c-i801: Spelling fix
i2c: Fix typo in SMBus Write Word Data description
i2c-piix4: Add support for the ATI SB600
i2c-nforce2: Drop unused reference to pci_dev
i2c/vt8231: Remove superfluous initialization
i2c-ali1563: Fix device initialization
i2c-ali1563: Improve the status messages
Diffstat (limited to 'drivers')
44 files changed, 616 insertions, 95 deletions
diff --git a/drivers/acpi/i2c_ec.c b/drivers/acpi/i2c_ec.c index 8338be0990bc..bb54b6cdb30b 100644 --- a/drivers/acpi/i2c_ec.c +++ b/drivers/acpi/i2c_ec.c | |||
@@ -340,6 +340,7 @@ static int acpi_ec_hc_add(struct acpi_device *device) | |||
340 | smbus->adapter.owner = THIS_MODULE; | 340 | smbus->adapter.owner = THIS_MODULE; |
341 | smbus->adapter.algo = &acpi_ec_smbus_algorithm; | 341 | smbus->adapter.algo = &acpi_ec_smbus_algorithm; |
342 | smbus->adapter.algo_data = smbus; | 342 | smbus->adapter.algo_data = smbus; |
343 | smbus->adapter.dev.parent = &device->dev; | ||
343 | 344 | ||
344 | if (i2c_add_adapter(&smbus->adapter)) { | 345 | if (i2c_add_adapter(&smbus->adapter)) { |
345 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, | 346 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, |
diff --git a/drivers/hwmon/vt8231.c b/drivers/hwmon/vt8231.c index 93f93d4fb8ae..a6a4aa0eee16 100644 --- a/drivers/hwmon/vt8231.c +++ b/drivers/hwmon/vt8231.c | |||
@@ -727,7 +727,6 @@ int vt8231_detect(struct i2c_adapter *adapter) | |||
727 | client->addr = isa_address; | 727 | client->addr = isa_address; |
728 | client->adapter = adapter; | 728 | client->adapter = adapter; |
729 | client->driver = &vt8231_driver; | 729 | client->driver = &vt8231_driver; |
730 | client->dev.parent = &adapter->dev; | ||
731 | 730 | ||
732 | /* Fill in the remaining client fields and put into the global list */ | 731 | /* Fill in the remaining client fields and put into the global list */ |
733 | strlcpy(client->name, "vt8231", I2C_NAME_SIZE); | 732 | strlcpy(client->name, "vt8231", I2C_NAME_SIZE); |
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig index 9367c4cfe936..4d44a2db29dd 100644 --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig | |||
@@ -183,6 +183,7 @@ config I2C_PIIX4 | |||
183 | ATI IXP200 | 183 | ATI IXP200 |
184 | ATI IXP300 | 184 | ATI IXP300 |
185 | ATI IXP400 | 185 | ATI IXP400 |
186 | ATI SB600 | ||
186 | Serverworks OSB4 | 187 | Serverworks OSB4 |
187 | Serverworks CSB5 | 188 | Serverworks CSB5 |
188 | Serverworks CSB6 | 189 | Serverworks CSB6 |
@@ -341,6 +342,13 @@ config I2C_PARPORT_LIGHT | |||
341 | This support is also available as a module. If so, the module | 342 | This support is also available as a module. If so, the module |
342 | will be called i2c-parport-light. | 343 | will be called i2c-parport-light. |
343 | 344 | ||
345 | config I2C_PASEMI | ||
346 | tristate "PA Semi SMBus interface" | ||
347 | # depends on PPC_PASEMI && I2C && PCI | ||
348 | depends on I2C && PCI | ||
349 | help | ||
350 | Supports the PA Semi PWRficient on-chip SMBus interfaces. | ||
351 | |||
344 | config I2C_PROSAVAGE | 352 | config I2C_PROSAVAGE |
345 | tristate "S3/VIA (Pro)Savage" | 353 | tristate "S3/VIA (Pro)Savage" |
346 | depends on I2C && PCI | 354 | depends on I2C && PCI |
@@ -499,11 +507,11 @@ config I2C_VIA | |||
499 | will be called i2c-via. | 507 | will be called i2c-via. |
500 | 508 | ||
501 | config I2C_VIAPRO | 509 | config I2C_VIAPRO |
502 | tristate "VIA 82C596/82C686/82xx" | 510 | tristate "VIA VT82C596/82C686/82xx and CX700" |
503 | depends on I2C && PCI | 511 | depends on I2C && PCI |
504 | help | 512 | help |
505 | If you say yes to this option, support will be included for the VIA | 513 | If you say yes to this option, support will be included for the VIA |
506 | 82C596/82C686/82xx I2C interfaces. Specifically, the following | 514 | VT82C596 and later SMBus interface. Specifically, the following |
507 | chipsets are supported: | 515 | chipsets are supported: |
508 | VT82C596A/B | 516 | VT82C596A/B |
509 | VT82C686A/B | 517 | VT82C686A/B |
@@ -512,6 +520,7 @@ config I2C_VIAPRO | |||
512 | VT8235 | 520 | VT8235 |
513 | VT8237R/A | 521 | VT8237R/A |
514 | VT8251 | 522 | VT8251 |
523 | CX700 | ||
515 | 524 | ||
516 | This driver can also be built as a module. If so, the module | 525 | This driver can also be built as a module. If so, the module |
517 | will be called i2c-viapro. | 526 | will be called i2c-viapro. |
diff --git a/drivers/i2c/busses/Makefile b/drivers/i2c/busses/Makefile index 37196c1d0794..03505aa44bbf 100644 --- a/drivers/i2c/busses/Makefile +++ b/drivers/i2c/busses/Makefile | |||
@@ -27,6 +27,7 @@ obj-$(CONFIG_I2C_OCORES) += i2c-ocores.o | |||
27 | obj-$(CONFIG_I2C_OMAP) += i2c-omap.o | 27 | obj-$(CONFIG_I2C_OMAP) += i2c-omap.o |
28 | obj-$(CONFIG_I2C_PARPORT) += i2c-parport.o | 28 | obj-$(CONFIG_I2C_PARPORT) += i2c-parport.o |
29 | obj-$(CONFIG_I2C_PARPORT_LIGHT) += i2c-parport-light.o | 29 | obj-$(CONFIG_I2C_PARPORT_LIGHT) += i2c-parport-light.o |
30 | obj-$(CONFIG_I2C_PASEMI) += i2c-pasemi.o | ||
30 | obj-$(CONFIG_I2C_PCA_ISA) += i2c-pca-isa.o | 31 | obj-$(CONFIG_I2C_PCA_ISA) += i2c-pca-isa.o |
31 | obj-$(CONFIG_I2C_PIIX4) += i2c-piix4.o | 32 | obj-$(CONFIG_I2C_PIIX4) += i2c-piix4.o |
32 | obj-$(CONFIG_I2C_PNX) += i2c-pnx.o | 33 | obj-$(CONFIG_I2C_PNX) += i2c-pnx.o |
diff --git a/drivers/i2c/busses/i2c-ali1535.c b/drivers/i2c/busses/i2c-ali1535.c index e75d339a3481..0b0a87b8d107 100644 --- a/drivers/i2c/busses/i2c-ali1535.c +++ b/drivers/i2c/busses/i2c-ali1535.c | |||
@@ -475,6 +475,7 @@ static const struct i2c_algorithm smbus_algorithm = { | |||
475 | 475 | ||
476 | static struct i2c_adapter ali1535_adapter = { | 476 | static struct i2c_adapter ali1535_adapter = { |
477 | .owner = THIS_MODULE, | 477 | .owner = THIS_MODULE, |
478 | .id = I2C_HW_SMBUS_ALI1535, | ||
478 | .class = I2C_CLASS_HWMON, | 479 | .class = I2C_CLASS_HWMON, |
479 | .algo = &smbus_algorithm, | 480 | .algo = &smbus_algorithm, |
480 | }; | 481 | }; |
diff --git a/drivers/i2c/busses/i2c-ali1563.c b/drivers/i2c/busses/i2c-ali1563.c index 8e1e3f8e40a4..6b68074e518a 100644 --- a/drivers/i2c/busses/i2c-ali1563.c +++ b/drivers/i2c/busses/i2c-ali1563.c | |||
@@ -314,35 +314,11 @@ static u32 ali1563_func(struct i2c_adapter * a) | |||
314 | } | 314 | } |
315 | 315 | ||
316 | 316 | ||
317 | static void ali1563_enable(struct pci_dev * dev) | ||
318 | { | ||
319 | u16 ctrl; | ||
320 | |||
321 | pci_read_config_word(dev,ALI1563_SMBBA,&ctrl); | ||
322 | ctrl |= 0x7; | ||
323 | pci_write_config_word(dev,ALI1563_SMBBA,ctrl); | ||
324 | } | ||
325 | |||
326 | static int __devinit ali1563_setup(struct pci_dev * dev) | 317 | static int __devinit ali1563_setup(struct pci_dev * dev) |
327 | { | 318 | { |
328 | u16 ctrl; | 319 | u16 ctrl; |
329 | 320 | ||
330 | pci_read_config_word(dev,ALI1563_SMBBA,&ctrl); | 321 | pci_read_config_word(dev,ALI1563_SMBBA,&ctrl); |
331 | printk("ali1563: SMBus control = %04x\n",ctrl); | ||
332 | |||
333 | /* Check if device is even enabled first */ | ||
334 | if (!(ctrl & ALI1563_SMB_IOEN)) { | ||
335 | dev_warn(&dev->dev,"I/O space not enabled, trying manually\n"); | ||
336 | ali1563_enable(dev); | ||
337 | } | ||
338 | if (!(ctrl & ALI1563_SMB_IOEN)) { | ||
339 | dev_warn(&dev->dev,"I/O space still not enabled, giving up\n"); | ||
340 | goto Err; | ||
341 | } | ||
342 | if (!(ctrl & ALI1563_SMB_HOSTEN)) { | ||
343 | dev_warn(&dev->dev,"Host Controller not enabled\n"); | ||
344 | goto Err; | ||
345 | } | ||
346 | 322 | ||
347 | /* SMB I/O Base in high 12 bits and must be aligned with the | 323 | /* SMB I/O Base in high 12 bits and must be aligned with the |
348 | * size of the I/O space. */ | 324 | * size of the I/O space. */ |
@@ -351,11 +327,31 @@ static int __devinit ali1563_setup(struct pci_dev * dev) | |||
351 | dev_warn(&dev->dev,"ali1563_smba Uninitialized\n"); | 327 | dev_warn(&dev->dev,"ali1563_smba Uninitialized\n"); |
352 | goto Err; | 328 | goto Err; |
353 | } | 329 | } |
330 | |||
331 | /* Check if device is enabled */ | ||
332 | if (!(ctrl & ALI1563_SMB_HOSTEN)) { | ||
333 | dev_warn(&dev->dev, "Host Controller not enabled\n"); | ||
334 | goto Err; | ||
335 | } | ||
336 | if (!(ctrl & ALI1563_SMB_IOEN)) { | ||
337 | dev_warn(&dev->dev, "I/O space not enabled, trying manually\n"); | ||
338 | pci_write_config_word(dev, ALI1563_SMBBA, | ||
339 | ctrl | ALI1563_SMB_IOEN); | ||
340 | pci_read_config_word(dev, ALI1563_SMBBA, &ctrl); | ||
341 | if (!(ctrl & ALI1563_SMB_IOEN)) { | ||
342 | dev_err(&dev->dev, "I/O space still not enabled, " | ||
343 | "giving up\n"); | ||
344 | goto Err; | ||
345 | } | ||
346 | } | ||
347 | |||
354 | if (!request_region(ali1563_smba, ALI1563_SMB_IOSIZE, | 348 | if (!request_region(ali1563_smba, ALI1563_SMB_IOSIZE, |
355 | ali1563_pci_driver.name)) { | 349 | ali1563_pci_driver.name)) { |
356 | dev_warn(&dev->dev,"Could not allocate I/O space"); | 350 | dev_err(&dev->dev, "Could not allocate I/O space at 0x%04x\n", |
351 | ali1563_smba); | ||
357 | goto Err; | 352 | goto Err; |
358 | } | 353 | } |
354 | dev_info(&dev->dev, "Found ALi1563 SMBus at 0x%04x\n", ali1563_smba); | ||
359 | 355 | ||
360 | return 0; | 356 | return 0; |
361 | Err: | 357 | Err: |
@@ -374,6 +370,7 @@ static const struct i2c_algorithm ali1563_algorithm = { | |||
374 | 370 | ||
375 | static struct i2c_adapter ali1563_adapter = { | 371 | static struct i2c_adapter ali1563_adapter = { |
376 | .owner = THIS_MODULE, | 372 | .owner = THIS_MODULE, |
373 | .id = I2C_HW_SMBUS_ALI1563, | ||
377 | .class = I2C_CLASS_HWMON, | 374 | .class = I2C_CLASS_HWMON, |
378 | .algo = &ali1563_algorithm, | 375 | .algo = &ali1563_algorithm, |
379 | }; | 376 | }; |
@@ -384,13 +381,18 @@ static int __devinit ali1563_probe(struct pci_dev * dev, | |||
384 | int error; | 381 | int error; |
385 | 382 | ||
386 | if ((error = ali1563_setup(dev))) | 383 | if ((error = ali1563_setup(dev))) |
387 | return error; | 384 | goto exit; |
388 | ali1563_adapter.dev.parent = &dev->dev; | 385 | ali1563_adapter.dev.parent = &dev->dev; |
389 | sprintf(ali1563_adapter.name,"SMBus ALi 1563 Adapter @ %04x", | 386 | sprintf(ali1563_adapter.name,"SMBus ALi 1563 Adapter @ %04x", |
390 | ali1563_smba); | 387 | ali1563_smba); |
391 | if ((error = i2c_add_adapter(&ali1563_adapter))) | 388 | if ((error = i2c_add_adapter(&ali1563_adapter))) |
392 | ali1563_shutdown(dev); | 389 | goto exit_shutdown; |
393 | printk("%s: Returning %d\n",__FUNCTION__,error); | 390 | return 0; |
391 | |||
392 | exit_shutdown: | ||
393 | ali1563_shutdown(dev); | ||
394 | exit: | ||
395 | dev_warn(&dev->dev, "ALi1563 SMBus probe failed (%d)\n", error); | ||
394 | return error; | 396 | return error; |
395 | } | 397 | } |
396 | 398 | ||
diff --git a/drivers/i2c/busses/i2c-ali15x3.c b/drivers/i2c/busses/i2c-ali15x3.c index 3f11b6e1a341..c537441ac038 100644 --- a/drivers/i2c/busses/i2c-ali15x3.c +++ b/drivers/i2c/busses/i2c-ali15x3.c | |||
@@ -470,6 +470,7 @@ static const struct i2c_algorithm smbus_algorithm = { | |||
470 | 470 | ||
471 | static struct i2c_adapter ali15x3_adapter = { | 471 | static struct i2c_adapter ali15x3_adapter = { |
472 | .owner = THIS_MODULE, | 472 | .owner = THIS_MODULE, |
473 | .id = I2C_HW_SMBUS_ALI15X3, | ||
473 | .class = I2C_CLASS_HWMON, | 474 | .class = I2C_CLASS_HWMON, |
474 | .algo = &smbus_algorithm, | 475 | .algo = &smbus_algorithm, |
475 | }; | 476 | }; |
diff --git a/drivers/i2c/busses/i2c-amd756-s4882.c b/drivers/i2c/busses/i2c-amd756-s4882.c index 08e915730caf..e5e96c817566 100644 --- a/drivers/i2c/busses/i2c-amd756-s4882.c +++ b/drivers/i2c/busses/i2c-amd756-s4882.c | |||
@@ -184,12 +184,14 @@ static int __init amd756_s4882_init(void) | |||
184 | s4882_algo[0].smbus_xfer = amd756_access_virt0; | 184 | s4882_algo[0].smbus_xfer = amd756_access_virt0; |
185 | s4882_adapter[0] = amd756_smbus; | 185 | s4882_adapter[0] = amd756_smbus; |
186 | s4882_adapter[0].algo = s4882_algo; | 186 | s4882_adapter[0].algo = s4882_algo; |
187 | s4882_adapter[0].dev.parent = amd756_smbus.dev.parent; | ||
187 | for (i = 1; i < 5; i++) { | 188 | for (i = 1; i < 5; i++) { |
188 | s4882_algo[i] = *(amd756_smbus.algo); | 189 | s4882_algo[i] = *(amd756_smbus.algo); |
189 | s4882_adapter[i] = amd756_smbus; | 190 | s4882_adapter[i] = amd756_smbus; |
190 | sprintf(s4882_adapter[i].name, | 191 | sprintf(s4882_adapter[i].name, |
191 | "SMBus 8111 adapter (CPU%d)", i-1); | 192 | "SMBus 8111 adapter (CPU%d)", i-1); |
192 | s4882_adapter[i].algo = s4882_algo+i; | 193 | s4882_adapter[i].algo = s4882_algo+i; |
194 | s4882_adapter[i].dev.parent = amd756_smbus.dev.parent; | ||
193 | } | 195 | } |
194 | s4882_algo[1].smbus_xfer = amd756_access_virt1; | 196 | s4882_algo[1].smbus_xfer = amd756_access_virt1; |
195 | s4882_algo[2].smbus_xfer = amd756_access_virt2; | 197 | s4882_algo[2].smbus_xfer = amd756_access_virt2; |
diff --git a/drivers/i2c/busses/i2c-amd756.c b/drivers/i2c/busses/i2c-amd756.c index 2d21afdc5b1c..91fbc0ee439c 100644 --- a/drivers/i2c/busses/i2c-amd756.c +++ b/drivers/i2c/busses/i2c-amd756.c | |||
@@ -301,6 +301,7 @@ static const struct i2c_algorithm smbus_algorithm = { | |||
301 | 301 | ||
302 | struct i2c_adapter amd756_smbus = { | 302 | struct i2c_adapter amd756_smbus = { |
303 | .owner = THIS_MODULE, | 303 | .owner = THIS_MODULE, |
304 | .id = I2C_HW_SMBUS_AMD756, | ||
304 | .class = I2C_CLASS_HWMON, | 305 | .class = I2C_CLASS_HWMON, |
305 | .algo = &smbus_algorithm, | 306 | .algo = &smbus_algorithm, |
306 | }; | 307 | }; |
diff --git a/drivers/i2c/busses/i2c-amd8111.c b/drivers/i2c/busses/i2c-amd8111.c index 0fbc7186c91a..14ad9912f204 100644 --- a/drivers/i2c/busses/i2c-amd8111.c +++ b/drivers/i2c/busses/i2c-amd8111.c | |||
@@ -76,7 +76,8 @@ static unsigned int amd_ec_wait_write(struct amd_smbus *smbus) | |||
76 | udelay(1); | 76 | udelay(1); |
77 | 77 | ||
78 | if (!timeout) { | 78 | if (!timeout) { |
79 | dev_warn(&smbus->dev->dev, "Timeout while waiting for IBF to clear\n"); | 79 | dev_warn(&smbus->dev->dev, |
80 | "Timeout while waiting for IBF to clear\n"); | ||
80 | return -1; | 81 | return -1; |
81 | } | 82 | } |
82 | 83 | ||
@@ -91,14 +92,16 @@ static unsigned int amd_ec_wait_read(struct amd_smbus *smbus) | |||
91 | udelay(1); | 92 | udelay(1); |
92 | 93 | ||
93 | if (!timeout) { | 94 | if (!timeout) { |
94 | dev_warn(&smbus->dev->dev, "Timeout while waiting for OBF to set\n"); | 95 | dev_warn(&smbus->dev->dev, |
96 | "Timeout while waiting for OBF to set\n"); | ||
95 | return -1; | 97 | return -1; |
96 | } | 98 | } |
97 | 99 | ||
98 | return 0; | 100 | return 0; |
99 | } | 101 | } |
100 | 102 | ||
101 | static unsigned int amd_ec_read(struct amd_smbus *smbus, unsigned char address, unsigned char *data) | 103 | static unsigned int amd_ec_read(struct amd_smbus *smbus, unsigned char address, |
104 | unsigned char *data) | ||
102 | { | 105 | { |
103 | if (amd_ec_wait_write(smbus)) | 106 | if (amd_ec_wait_write(smbus)) |
104 | return -1; | 107 | return -1; |
@@ -115,7 +118,8 @@ static unsigned int amd_ec_read(struct amd_smbus *smbus, unsigned char address, | |||
115 | return 0; | 118 | return 0; |
116 | } | 119 | } |
117 | 120 | ||
118 | static unsigned int amd_ec_write(struct amd_smbus *smbus, unsigned char address, unsigned char data) | 121 | static unsigned int amd_ec_write(struct amd_smbus *smbus, unsigned char address, |
122 | unsigned char data) | ||
119 | { | 123 | { |
120 | if (amd_ec_wait_write(smbus)) | 124 | if (amd_ec_wait_write(smbus)) |
121 | return -1; | 125 | return -1; |
@@ -175,18 +179,19 @@ static unsigned int amd_ec_write(struct amd_smbus *smbus, unsigned char address, | |||
175 | #define AMD_SMB_PRTCL_PEC 0x80 | 179 | #define AMD_SMB_PRTCL_PEC 0x80 |
176 | 180 | ||
177 | 181 | ||
178 | static s32 amd8111_access(struct i2c_adapter * adap, u16 addr, unsigned short flags, | 182 | static s32 amd8111_access(struct i2c_adapter * adap, u16 addr, |
179 | char read_write, u8 command, int size, union i2c_smbus_data * data) | 183 | unsigned short flags, char read_write, u8 command, int size, |
184 | union i2c_smbus_data * data) | ||
180 | { | 185 | { |
181 | struct amd_smbus *smbus = adap->algo_data; | 186 | struct amd_smbus *smbus = adap->algo_data; |
182 | unsigned char protocol, len, pec, temp[2]; | 187 | unsigned char protocol, len, pec, temp[2]; |
183 | int i; | 188 | int i; |
184 | 189 | ||
185 | protocol = (read_write == I2C_SMBUS_READ) ? AMD_SMB_PRTCL_READ : AMD_SMB_PRTCL_WRITE; | 190 | protocol = (read_write == I2C_SMBUS_READ) ? AMD_SMB_PRTCL_READ |
191 | : AMD_SMB_PRTCL_WRITE; | ||
186 | pec = (flags & I2C_CLIENT_PEC) ? AMD_SMB_PRTCL_PEC : 0; | 192 | pec = (flags & I2C_CLIENT_PEC) ? AMD_SMB_PRTCL_PEC : 0; |
187 | 193 | ||
188 | switch (size) { | 194 | switch (size) { |
189 | |||
190 | case I2C_SMBUS_QUICK: | 195 | case I2C_SMBUS_QUICK: |
191 | protocol |= AMD_SMB_PRTCL_QUICK; | 196 | protocol |= AMD_SMB_PRTCL_QUICK; |
192 | read_write = I2C_SMBUS_WRITE; | 197 | read_write = I2C_SMBUS_WRITE; |
@@ -208,8 +213,10 @@ static s32 amd8111_access(struct i2c_adapter * adap, u16 addr, unsigned short fl | |||
208 | case I2C_SMBUS_WORD_DATA: | 213 | case I2C_SMBUS_WORD_DATA: |
209 | amd_ec_write(smbus, AMD_SMB_CMD, command); | 214 | amd_ec_write(smbus, AMD_SMB_CMD, command); |
210 | if (read_write == I2C_SMBUS_WRITE) { | 215 | if (read_write == I2C_SMBUS_WRITE) { |
211 | amd_ec_write(smbus, AMD_SMB_DATA, data->word); | 216 | amd_ec_write(smbus, AMD_SMB_DATA, |
212 | amd_ec_write(smbus, AMD_SMB_DATA + 1, data->word >> 8); | 217 | data->word & 0xff); |
218 | amd_ec_write(smbus, AMD_SMB_DATA + 1, | ||
219 | data->word >> 8); | ||
213 | } | 220 | } |
214 | protocol |= AMD_SMB_PRTCL_WORD_DATA | pec; | 221 | protocol |= AMD_SMB_PRTCL_WORD_DATA | pec; |
215 | break; | 222 | break; |
@@ -217,27 +224,31 @@ static s32 amd8111_access(struct i2c_adapter * adap, u16 addr, unsigned short fl | |||
217 | case I2C_SMBUS_BLOCK_DATA: | 224 | case I2C_SMBUS_BLOCK_DATA: |
218 | amd_ec_write(smbus, AMD_SMB_CMD, command); | 225 | amd_ec_write(smbus, AMD_SMB_CMD, command); |
219 | if (read_write == I2C_SMBUS_WRITE) { | 226 | if (read_write == I2C_SMBUS_WRITE) { |
220 | len = min_t(u8, data->block[0], 32); | 227 | len = min_t(u8, data->block[0], |
228 | I2C_SMBUS_BLOCK_MAX); | ||
221 | amd_ec_write(smbus, AMD_SMB_BCNT, len); | 229 | amd_ec_write(smbus, AMD_SMB_BCNT, len); |
222 | for (i = 0; i < len; i++) | 230 | for (i = 0; i < len; i++) |
223 | amd_ec_write(smbus, AMD_SMB_DATA + i, data->block[i + 1]); | 231 | amd_ec_write(smbus, AMD_SMB_DATA + i, |
232 | data->block[i + 1]); | ||
224 | } | 233 | } |
225 | protocol |= AMD_SMB_PRTCL_BLOCK_DATA | pec; | 234 | protocol |= AMD_SMB_PRTCL_BLOCK_DATA | pec; |
226 | break; | 235 | break; |
227 | 236 | ||
228 | case I2C_SMBUS_I2C_BLOCK_DATA: | 237 | case I2C_SMBUS_I2C_BLOCK_DATA: |
229 | len = min_t(u8, data->block[0], 32); | 238 | len = min_t(u8, data->block[0], |
239 | I2C_SMBUS_BLOCK_MAX); | ||
230 | amd_ec_write(smbus, AMD_SMB_CMD, command); | 240 | amd_ec_write(smbus, AMD_SMB_CMD, command); |
231 | amd_ec_write(smbus, AMD_SMB_BCNT, len); | 241 | amd_ec_write(smbus, AMD_SMB_BCNT, len); |
232 | if (read_write == I2C_SMBUS_WRITE) | 242 | if (read_write == I2C_SMBUS_WRITE) |
233 | for (i = 0; i < len; i++) | 243 | for (i = 0; i < len; i++) |
234 | amd_ec_write(smbus, AMD_SMB_DATA + i, data->block[i + 1]); | 244 | amd_ec_write(smbus, AMD_SMB_DATA + i, |
245 | data->block[i + 1]); | ||
235 | protocol |= AMD_SMB_PRTCL_I2C_BLOCK_DATA; | 246 | protocol |= AMD_SMB_PRTCL_I2C_BLOCK_DATA; |
236 | break; | 247 | break; |
237 | 248 | ||
238 | case I2C_SMBUS_PROC_CALL: | 249 | case I2C_SMBUS_PROC_CALL: |
239 | amd_ec_write(smbus, AMD_SMB_CMD, command); | 250 | amd_ec_write(smbus, AMD_SMB_CMD, command); |
240 | amd_ec_write(smbus, AMD_SMB_DATA, data->word); | 251 | amd_ec_write(smbus, AMD_SMB_DATA, data->word & 0xff); |
241 | amd_ec_write(smbus, AMD_SMB_DATA + 1, data->word >> 8); | 252 | amd_ec_write(smbus, AMD_SMB_DATA + 1, data->word >> 8); |
242 | protocol = AMD_SMB_PRTCL_PROC_CALL | pec; | 253 | protocol = AMD_SMB_PRTCL_PROC_CALL | pec; |
243 | read_write = I2C_SMBUS_READ; | 254 | read_write = I2C_SMBUS_READ; |
@@ -248,7 +259,8 @@ static s32 amd8111_access(struct i2c_adapter * adap, u16 addr, unsigned short fl | |||
248 | amd_ec_write(smbus, AMD_SMB_CMD, command); | 259 | amd_ec_write(smbus, AMD_SMB_CMD, command); |
249 | amd_ec_write(smbus, AMD_SMB_BCNT, len); | 260 | amd_ec_write(smbus, AMD_SMB_BCNT, len); |
250 | for (i = 0; i < len; i++) | 261 | for (i = 0; i < len; i++) |
251 | amd_ec_write(smbus, AMD_SMB_DATA + i, data->block[i + 1]); | 262 | amd_ec_write(smbus, AMD_SMB_DATA + i, |
263 | data->block[i + 1]); | ||
252 | protocol = AMD_SMB_PRTCL_BLOCK_PROC_CALL | pec; | 264 | protocol = AMD_SMB_PRTCL_BLOCK_PROC_CALL | pec; |
253 | read_write = I2C_SMBUS_READ; | 265 | read_write = I2C_SMBUS_READ; |
254 | break; | 266 | break; |
@@ -280,7 +292,6 @@ static s32 amd8111_access(struct i2c_adapter * adap, u16 addr, unsigned short fl | |||
280 | return 0; | 292 | return 0; |
281 | 293 | ||
282 | switch (size) { | 294 | switch (size) { |
283 | |||
284 | case I2C_SMBUS_BYTE: | 295 | case I2C_SMBUS_BYTE: |
285 | case I2C_SMBUS_BYTE_DATA: | 296 | case I2C_SMBUS_BYTE_DATA: |
286 | amd_ec_read(smbus, AMD_SMB_DATA, &data->byte); | 297 | amd_ec_read(smbus, AMD_SMB_DATA, &data->byte); |
@@ -296,10 +307,11 @@ static s32 amd8111_access(struct i2c_adapter * adap, u16 addr, unsigned short fl | |||
296 | case I2C_SMBUS_BLOCK_DATA: | 307 | case I2C_SMBUS_BLOCK_DATA: |
297 | case I2C_SMBUS_BLOCK_PROC_CALL: | 308 | case I2C_SMBUS_BLOCK_PROC_CALL: |
298 | amd_ec_read(smbus, AMD_SMB_BCNT, &len); | 309 | amd_ec_read(smbus, AMD_SMB_BCNT, &len); |
299 | len = min_t(u8, len, 32); | 310 | len = min_t(u8, len, I2C_SMBUS_BLOCK_MAX); |
300 | case I2C_SMBUS_I2C_BLOCK_DATA: | 311 | case I2C_SMBUS_I2C_BLOCK_DATA: |
301 | for (i = 0; i < len; i++) | 312 | for (i = 0; i < len; i++) |
302 | amd_ec_read(smbus, AMD_SMB_DATA + i, data->block + i + 1); | 313 | amd_ec_read(smbus, AMD_SMB_DATA + i, |
314 | data->block + i + 1); | ||
303 | data->block[0] = len; | 315 | data->block[0] = len; |
304 | break; | 316 | break; |
305 | } | 317 | } |
@@ -310,7 +322,8 @@ static s32 amd8111_access(struct i2c_adapter * adap, u16 addr, unsigned short fl | |||
310 | 322 | ||
311 | static u32 amd8111_func(struct i2c_adapter *adapter) | 323 | static u32 amd8111_func(struct i2c_adapter *adapter) |
312 | { | 324 | { |
313 | return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | I2C_FUNC_SMBUS_BYTE_DATA | | 325 | return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | |
326 | I2C_FUNC_SMBUS_BYTE_DATA | | ||
314 | I2C_FUNC_SMBUS_WORD_DATA | I2C_FUNC_SMBUS_BLOCK_DATA | | 327 | I2C_FUNC_SMBUS_WORD_DATA | I2C_FUNC_SMBUS_BLOCK_DATA | |
315 | I2C_FUNC_SMBUS_PROC_CALL | I2C_FUNC_SMBUS_BLOCK_PROC_CALL | | 328 | I2C_FUNC_SMBUS_PROC_CALL | I2C_FUNC_SMBUS_BLOCK_PROC_CALL | |
316 | I2C_FUNC_SMBUS_I2C_BLOCK | I2C_FUNC_SMBUS_HWPEC_CALC; | 329 | I2C_FUNC_SMBUS_I2C_BLOCK | I2C_FUNC_SMBUS_HWPEC_CALC; |
@@ -329,12 +342,13 @@ static struct pci_device_id amd8111_ids[] = { | |||
329 | 342 | ||
330 | MODULE_DEVICE_TABLE (pci, amd8111_ids); | 343 | MODULE_DEVICE_TABLE (pci, amd8111_ids); |
331 | 344 | ||
332 | static int __devinit amd8111_probe(struct pci_dev *dev, const struct pci_device_id *id) | 345 | static int __devinit amd8111_probe(struct pci_dev *dev, |
346 | const struct pci_device_id *id) | ||
333 | { | 347 | { |
334 | struct amd_smbus *smbus; | 348 | struct amd_smbus *smbus; |
335 | int error = -ENODEV; | 349 | int error; |
336 | 350 | ||
337 | if (~pci_resource_flags(dev, 0) & IORESOURCE_IO) | 351 | if (!(pci_resource_flags(dev, 0) & IORESOURCE_IO)) |
338 | return -ENODEV; | 352 | return -ENODEV; |
339 | 353 | ||
340 | smbus = kzalloc(sizeof(struct amd_smbus), GFP_KERNEL); | 354 | smbus = kzalloc(sizeof(struct amd_smbus), GFP_KERNEL); |
@@ -345,12 +359,15 @@ static int __devinit amd8111_probe(struct pci_dev *dev, const struct pci_device_ | |||
345 | smbus->base = pci_resource_start(dev, 0); | 359 | smbus->base = pci_resource_start(dev, 0); |
346 | smbus->size = pci_resource_len(dev, 0); | 360 | smbus->size = pci_resource_len(dev, 0); |
347 | 361 | ||
348 | if (!request_region(smbus->base, smbus->size, amd8111_driver.name)) | 362 | if (!request_region(smbus->base, smbus->size, amd8111_driver.name)) { |
363 | error = -EBUSY; | ||
349 | goto out_kfree; | 364 | goto out_kfree; |
365 | } | ||
350 | 366 | ||
351 | smbus->adapter.owner = THIS_MODULE; | 367 | smbus->adapter.owner = THIS_MODULE; |
352 | snprintf(smbus->adapter.name, I2C_NAME_SIZE, | 368 | snprintf(smbus->adapter.name, I2C_NAME_SIZE, |
353 | "SMBus2 AMD8111 adapter at %04x", smbus->base); | 369 | "SMBus2 AMD8111 adapter at %04x", smbus->base); |
370 | smbus->adapter.id = I2C_HW_SMBUS_AMD8111; | ||
354 | smbus->adapter.class = I2C_CLASS_HWMON; | 371 | smbus->adapter.class = I2C_CLASS_HWMON; |
355 | smbus->adapter.algo = &smbus_algorithm; | 372 | smbus->adapter.algo = &smbus_algorithm; |
356 | smbus->adapter.algo_data = smbus; | 373 | smbus->adapter.algo_data = smbus; |
@@ -358,11 +375,11 @@ static int __devinit amd8111_probe(struct pci_dev *dev, const struct pci_device_ | |||
358 | /* set up the driverfs linkage to our parent device */ | 375 | /* set up the driverfs linkage to our parent device */ |
359 | smbus->adapter.dev.parent = &dev->dev; | 376 | smbus->adapter.dev.parent = &dev->dev; |
360 | 377 | ||
378 | pci_write_config_dword(smbus->dev, AMD_PCI_MISC, 0); | ||
361 | error = i2c_add_adapter(&smbus->adapter); | 379 | error = i2c_add_adapter(&smbus->adapter); |
362 | if (error) | 380 | if (error) |
363 | goto out_release_region; | 381 | goto out_release_region; |
364 | 382 | ||
365 | pci_write_config_dword(smbus->dev, AMD_PCI_MISC, 0); | ||
366 | pci_set_drvdata(dev, smbus); | 383 | pci_set_drvdata(dev, smbus); |
367 | return 0; | 384 | return 0; |
368 | 385 | ||
@@ -370,10 +387,9 @@ static int __devinit amd8111_probe(struct pci_dev *dev, const struct pci_device_ | |||
370 | release_region(smbus->base, smbus->size); | 387 | release_region(smbus->base, smbus->size); |
371 | out_kfree: | 388 | out_kfree: |
372 | kfree(smbus); | 389 | kfree(smbus); |
373 | return -1; | 390 | return error; |
374 | } | 391 | } |
375 | 392 | ||
376 | |||
377 | static void __devexit amd8111_remove(struct pci_dev *dev) | 393 | static void __devexit amd8111_remove(struct pci_dev *dev) |
378 | { | 394 | { |
379 | struct amd_smbus *smbus = pci_get_drvdata(dev); | 395 | struct amd_smbus *smbus = pci_get_drvdata(dev); |
@@ -395,7 +411,6 @@ static int __init i2c_amd8111_init(void) | |||
395 | return pci_register_driver(&amd8111_driver); | 411 | return pci_register_driver(&amd8111_driver); |
396 | } | 412 | } |
397 | 413 | ||
398 | |||
399 | static void __exit i2c_amd8111_exit(void) | 414 | static void __exit i2c_amd8111_exit(void) |
400 | { | 415 | { |
401 | pci_unregister_driver(&amd8111_driver); | 416 | pci_unregister_driver(&amd8111_driver); |
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index ae625b854470..8c3569a9775b 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c | |||
@@ -123,7 +123,7 @@ static int i801_transaction(void) | |||
123 | dev_dbg(&I801_dev->dev, "Failed! (%02x)\n", temp); | 123 | dev_dbg(&I801_dev->dev, "Failed! (%02x)\n", temp); |
124 | return -1; | 124 | return -1; |
125 | } else { | 125 | } else { |
126 | dev_dbg(&I801_dev->dev, "Successfull!\n"); | 126 | dev_dbg(&I801_dev->dev, "Successful!\n"); |
127 | } | 127 | } |
128 | } | 128 | } |
129 | 129 | ||
@@ -442,6 +442,7 @@ static const struct i2c_algorithm smbus_algorithm = { | |||
442 | 442 | ||
443 | static struct i2c_adapter i801_adapter = { | 443 | static struct i2c_adapter i801_adapter = { |
444 | .owner = THIS_MODULE, | 444 | .owner = THIS_MODULE, |
445 | .id = I2C_HW_SMBUS_I801, | ||
445 | .class = I2C_CLASS_HWMON, | 446 | .class = I2C_CLASS_HWMON, |
446 | .algo = &smbus_algorithm, | 447 | .algo = &smbus_algorithm, |
447 | }; | 448 | }; |
diff --git a/drivers/i2c/busses/i2c-i810.c b/drivers/i2c/busses/i2c-i810.c index 10c98bc88aa6..42e8d94c276f 100644 --- a/drivers/i2c/busses/i2c-i810.c +++ b/drivers/i2c/busses/i2c-i810.c | |||
@@ -171,6 +171,7 @@ static struct i2c_algo_bit_data i810_i2c_bit_data = { | |||
171 | 171 | ||
172 | static struct i2c_adapter i810_i2c_adapter = { | 172 | static struct i2c_adapter i810_i2c_adapter = { |
173 | .owner = THIS_MODULE, | 173 | .owner = THIS_MODULE, |
174 | .id = I2C_HW_B_I810, | ||
174 | .name = "I810/I815 I2C Adapter", | 175 | .name = "I810/I815 I2C Adapter", |
175 | .algo_data = &i810_i2c_bit_data, | 176 | .algo_data = &i810_i2c_bit_data, |
176 | }; | 177 | }; |
@@ -186,6 +187,7 @@ static struct i2c_algo_bit_data i810_ddc_bit_data = { | |||
186 | 187 | ||
187 | static struct i2c_adapter i810_ddc_adapter = { | 188 | static struct i2c_adapter i810_ddc_adapter = { |
188 | .owner = THIS_MODULE, | 189 | .owner = THIS_MODULE, |
190 | .id = I2C_HW_B_I810, | ||
189 | .name = "I810/I815 DDC Adapter", | 191 | .name = "I810/I815 DDC Adapter", |
190 | .algo_data = &i810_ddc_bit_data, | 192 | .algo_data = &i810_ddc_bit_data, |
191 | }; | 193 | }; |
diff --git a/drivers/i2c/busses/i2c-ibm_iic.c b/drivers/i2c/busses/i2c-ibm_iic.c index 1898e9987021..8b14d14e60ca 100644 --- a/drivers/i2c/busses/i2c-ibm_iic.c +++ b/drivers/i2c/busses/i2c-ibm_iic.c | |||
@@ -727,6 +727,7 @@ static int __devinit iic_probe(struct ocp_device *ocp){ | |||
727 | 727 | ||
728 | /* Register it with i2c layer */ | 728 | /* Register it with i2c layer */ |
729 | adap = &dev->adap; | 729 | adap = &dev->adap; |
730 | adap->dev.parent = &ocp->dev; | ||
730 | strcpy(adap->name, "IBM IIC"); | 731 | strcpy(adap->name, "IBM IIC"); |
731 | i2c_set_adapdata(adap, dev); | 732 | i2c_set_adapdata(adap, dev); |
732 | adap->id = I2C_HW_OCP; | 733 | adap->id = I2C_HW_OCP; |
diff --git a/drivers/i2c/busses/i2c-isa.c b/drivers/i2c/busses/i2c-isa.c index 8ed59a2dff53..5f33bc9c1e02 100644 --- a/drivers/i2c/busses/i2c-isa.c +++ b/drivers/i2c/busses/i2c-isa.c | |||
@@ -39,6 +39,7 @@ | |||
39 | #include <linux/i2c.h> | 39 | #include <linux/i2c.h> |
40 | #include <linux/i2c-isa.h> | 40 | #include <linux/i2c-isa.h> |
41 | #include <linux/platform_device.h> | 41 | #include <linux/platform_device.h> |
42 | #include <linux/completion.h> | ||
42 | 43 | ||
43 | static u32 isa_func(struct i2c_adapter *adapter); | 44 | static u32 isa_func(struct i2c_adapter *adapter); |
44 | 45 | ||
diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c index 490173611d6b..a3283b907eb8 100644 --- a/drivers/i2c/busses/i2c-mv64xxx.c +++ b/drivers/i2c/busses/i2c-mv64xxx.c | |||
@@ -520,6 +520,7 @@ mv64xxx_i2c_probe(struct platform_device *pd) | |||
520 | rc = -ENXIO; | 520 | rc = -ENXIO; |
521 | goto exit_unmap_regs; | 521 | goto exit_unmap_regs; |
522 | } | 522 | } |
523 | drv_data->adapter.dev.parent = &pd->dev; | ||
523 | drv_data->adapter.id = I2C_HW_MV64XXX; | 524 | drv_data->adapter.id = I2C_HW_MV64XXX; |
524 | drv_data->adapter.algo = &mv64xxx_i2c_algo; | 525 | drv_data->adapter.algo = &mv64xxx_i2c_algo; |
525 | drv_data->adapter.owner = THIS_MODULE; | 526 | drv_data->adapter.owner = THIS_MODULE; |
diff --git a/drivers/i2c/busses/i2c-nforce2.c b/drivers/i2c/busses/i2c-nforce2.c index ad37c10e7fec..653555184a64 100644 --- a/drivers/i2c/busses/i2c-nforce2.c +++ b/drivers/i2c/busses/i2c-nforce2.c | |||
@@ -57,7 +57,6 @@ MODULE_DESCRIPTION("nForce2/3/4/5xx SMBus driver"); | |||
57 | 57 | ||
58 | 58 | ||
59 | struct nforce2_smbus { | 59 | struct nforce2_smbus { |
60 | struct pci_dev *dev; | ||
61 | struct i2c_adapter adapter; | 60 | struct i2c_adapter adapter; |
62 | int base; | 61 | int base; |
63 | int size; | 62 | int size; |
@@ -230,7 +229,6 @@ static int __devinit nforce2_probe_smb (struct pci_dev *dev, int bar, | |||
230 | smbus->base = iobase & PCI_BASE_ADDRESS_IO_MASK; | 229 | smbus->base = iobase & PCI_BASE_ADDRESS_IO_MASK; |
231 | smbus->size = 64; | 230 | smbus->size = 64; |
232 | } | 231 | } |
233 | smbus->dev = dev; | ||
234 | 232 | ||
235 | if (!request_region(smbus->base, smbus->size, nforce2_driver.name)) { | 233 | if (!request_region(smbus->base, smbus->size, nforce2_driver.name)) { |
236 | dev_err(&smbus->adapter.dev, "Error requesting region %02x .. %02X for %s\n", | 234 | dev_err(&smbus->adapter.dev, "Error requesting region %02x .. %02X for %s\n", |
@@ -238,6 +236,7 @@ static int __devinit nforce2_probe_smb (struct pci_dev *dev, int bar, | |||
238 | return -1; | 236 | return -1; |
239 | } | 237 | } |
240 | smbus->adapter.owner = THIS_MODULE; | 238 | smbus->adapter.owner = THIS_MODULE; |
239 | smbus->adapter.id = I2C_HW_SMBUS_NFORCE2; | ||
241 | smbus->adapter.class = I2C_CLASS_HWMON; | 240 | smbus->adapter.class = I2C_CLASS_HWMON; |
242 | smbus->adapter.algo = &smbus_algorithm; | 241 | smbus->adapter.algo = &smbus_algorithm; |
243 | smbus->adapter.algo_data = smbus; | 242 | smbus->adapter.algo_data = smbus; |
diff --git a/drivers/i2c/busses/i2c-parport.h b/drivers/i2c/busses/i2c-parport.h index 9ddd816d5d0f..ed69d846cb95 100644 --- a/drivers/i2c/busses/i2c-parport.h +++ b/drivers/i2c/busses/i2c-parport.h | |||
@@ -88,6 +88,13 @@ static struct adapter_parm adapter_parm[] = { | |||
88 | .getscl = { 0x40, STAT, 0 }, | 88 | .getscl = { 0x40, STAT, 0 }, |
89 | .init = { 0xfc, DATA, 0 }, | 89 | .init = { 0xfc, DATA, 0 }, |
90 | }, | 90 | }, |
91 | /* type 7: One For All JP1 parallel port adapter */ | ||
92 | { | ||
93 | .setsda = { 0x01, DATA, 0 }, | ||
94 | .setscl = { 0x02, DATA, 0 }, | ||
95 | .getsda = { 0x80, STAT, 1 }, | ||
96 | .init = { 0x04, DATA, 1 }, | ||
97 | }, | ||
91 | }; | 98 | }; |
92 | 99 | ||
93 | static int type = -1; | 100 | static int type = -1; |
@@ -101,4 +108,5 @@ MODULE_PARM_DESC(type, | |||
101 | " 4 = ADM1032 evaluation board\n" | 108 | " 4 = ADM1032 evaluation board\n" |
102 | " 5 = ADM1025, ADM1030 and ADM1031 evaluation boards\n" | 109 | " 5 = ADM1025, ADM1030 and ADM1031 evaluation boards\n" |
103 | " 6 = Barco LPT->DVI (K5800236) adapter\n" | 110 | " 6 = Barco LPT->DVI (K5800236) adapter\n" |
111 | " 7 = One For All JP1 parallel port adapter\n" | ||
104 | ); | 112 | ); |
diff --git a/drivers/i2c/busses/i2c-pasemi.c b/drivers/i2c/busses/i2c-pasemi.c new file mode 100644 index 000000000000..f54fb5d65cc4 --- /dev/null +++ b/drivers/i2c/busses/i2c-pasemi.c | |||
@@ -0,0 +1,426 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2006-2007 PA Semi, Inc | ||
3 | * | ||
4 | * SMBus host driver for PA Semi PWRficient | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | */ | ||
19 | |||
20 | #include <linux/module.h> | ||
21 | #include <linux/pci.h> | ||
22 | #include <linux/kernel.h> | ||
23 | #include <linux/stddef.h> | ||
24 | #include <linux/sched.h> | ||
25 | #include <linux/i2c.h> | ||
26 | #include <linux/delay.h> | ||
27 | #include <asm/io.h> | ||
28 | |||
29 | static struct pci_driver pasemi_smb_driver; | ||
30 | |||
31 | struct pasemi_smbus { | ||
32 | struct pci_dev *dev; | ||
33 | struct i2c_adapter adapter; | ||
34 | unsigned long base; | ||
35 | int size; | ||
36 | }; | ||
37 | |||
38 | /* Register offsets */ | ||
39 | #define REG_MTXFIFO 0x00 | ||
40 | #define REG_MRXFIFO 0x04 | ||
41 | #define REG_SMSTA 0x14 | ||
42 | #define REG_CTL 0x1c | ||
43 | |||
44 | /* Register defs */ | ||
45 | #define MTXFIFO_READ 0x00000400 | ||
46 | #define MTXFIFO_STOP 0x00000200 | ||
47 | #define MTXFIFO_START 0x00000100 | ||
48 | #define MTXFIFO_DATA_M 0x000000ff | ||
49 | |||
50 | #define MRXFIFO_EMPTY 0x00000100 | ||
51 | #define MRXFIFO_DATA_M 0x000000ff | ||
52 | |||
53 | #define SMSTA_XEN 0x08000000 | ||
54 | |||
55 | #define CTL_MRR 0x00000400 | ||
56 | #define CTL_MTR 0x00000200 | ||
57 | #define CTL_CLK_M 0x000000ff | ||
58 | |||
59 | #define CLK_100K_DIV 84 | ||
60 | #define CLK_400K_DIV 21 | ||
61 | |||
62 | static inline void reg_write(struct pasemi_smbus *smbus, int reg, int val) | ||
63 | { | ||
64 | dev_dbg(&smbus->dev->dev, "smbus write reg %lx val %08x\n", | ||
65 | smbus->base + reg, val); | ||
66 | outl(val, smbus->base + reg); | ||
67 | } | ||
68 | |||
69 | static inline int reg_read(struct pasemi_smbus *smbus, int reg) | ||
70 | { | ||
71 | int ret; | ||
72 | ret = inl(smbus->base + reg); | ||
73 | dev_dbg(&smbus->dev->dev, "smbus read reg %lx val %08x\n", | ||
74 | smbus->base + reg, ret); | ||
75 | return ret; | ||
76 | } | ||
77 | |||
78 | #define TXFIFO_WR(smbus, reg) reg_write((smbus), REG_MTXFIFO, (reg)) | ||
79 | #define RXFIFO_RD(smbus) reg_read((smbus), REG_MRXFIFO) | ||
80 | |||
81 | static void pasemi_smb_clear(struct pasemi_smbus *smbus) | ||
82 | { | ||
83 | unsigned int status; | ||
84 | |||
85 | status = reg_read(smbus, REG_SMSTA); | ||
86 | reg_write(smbus, REG_SMSTA, status); | ||
87 | } | ||
88 | |||
89 | static unsigned int pasemi_smb_waitready(struct pasemi_smbus *smbus) | ||
90 | { | ||
91 | int timeout = 10; | ||
92 | unsigned int status; | ||
93 | |||
94 | status = reg_read(smbus, REG_SMSTA); | ||
95 | |||
96 | while (!(status & SMSTA_XEN) && timeout--) { | ||
97 | msleep(1); | ||
98 | status = reg_read(smbus, REG_SMSTA); | ||
99 | } | ||
100 | |||
101 | if (timeout < 0) { | ||
102 | dev_warn(&smbus->dev->dev, "Timeout, status 0x%08x\n", status); | ||
103 | reg_write(smbus, REG_SMSTA, status); | ||
104 | return -ETIME; | ||
105 | } | ||
106 | |||
107 | /* Clear XEN */ | ||
108 | reg_write(smbus, REG_SMSTA, SMSTA_XEN); | ||
109 | |||
110 | return 0; | ||
111 | } | ||
112 | |||
113 | static int pasemi_i2c_xfer_msg(struct i2c_adapter *adapter, | ||
114 | struct i2c_msg *msg, int stop) | ||
115 | { | ||
116 | struct pasemi_smbus *smbus = adapter->algo_data; | ||
117 | int read, i, err; | ||
118 | u32 rd; | ||
119 | |||
120 | read = msg->flags & I2C_M_RD ? 1 : 0; | ||
121 | |||
122 | TXFIFO_WR(smbus, MTXFIFO_START | (msg->addr << 1) | read); | ||
123 | |||
124 | if (read) { | ||
125 | TXFIFO_WR(smbus, msg->len | MTXFIFO_READ | | ||
126 | (stop ? MTXFIFO_STOP : 0)); | ||
127 | |||
128 | err = pasemi_smb_waitready(smbus); | ||
129 | if (err) | ||
130 | goto reset_out; | ||
131 | |||
132 | for (i = 0; i < msg->len; i++) { | ||
133 | rd = RXFIFO_RD(smbus); | ||
134 | if (rd & MRXFIFO_EMPTY) { | ||
135 | err = -ENODATA; | ||
136 | goto reset_out; | ||
137 | } | ||
138 | msg->buf[i] = rd & MRXFIFO_DATA_M; | ||
139 | } | ||
140 | } else { | ||
141 | for (i = 0; i < msg->len - 1; i++) | ||
142 | TXFIFO_WR(smbus, msg->buf[i]); | ||
143 | |||
144 | TXFIFO_WR(smbus, msg->buf[msg->len] | | ||
145 | (stop ? MTXFIFO_STOP : 0)); | ||
146 | } | ||
147 | |||
148 | return 0; | ||
149 | |||
150 | reset_out: | ||
151 | reg_write(smbus, REG_CTL, (CTL_MTR | CTL_MRR | | ||
152 | (CLK_100K_DIV & CTL_CLK_M))); | ||
153 | return err; | ||
154 | } | ||
155 | |||
156 | static int pasemi_i2c_xfer(struct i2c_adapter *adapter, | ||
157 | struct i2c_msg *msgs, int num) | ||
158 | { | ||
159 | struct pasemi_smbus *smbus = adapter->algo_data; | ||
160 | int ret, i; | ||
161 | |||
162 | pasemi_smb_clear(smbus); | ||
163 | |||
164 | ret = 0; | ||
165 | |||
166 | for (i = 0; i < num && !ret; i++) | ||
167 | ret = pasemi_i2c_xfer_msg(adapter, &msgs[i], (i == (num - 1))); | ||
168 | |||
169 | return ret ? ret : num; | ||
170 | } | ||
171 | |||
172 | static int pasemi_smb_xfer(struct i2c_adapter *adapter, | ||
173 | u16 addr, unsigned short flags, char read_write, u8 command, | ||
174 | int size, union i2c_smbus_data *data) | ||
175 | { | ||
176 | struct pasemi_smbus *smbus = adapter->algo_data; | ||
177 | unsigned int rd; | ||
178 | int read_flag, err; | ||
179 | int len = 0, i; | ||
180 | |||
181 | /* All our ops take 8-bit shifted addresses */ | ||
182 | addr <<= 1; | ||
183 | read_flag = read_write == I2C_SMBUS_READ; | ||
184 | |||
185 | pasemi_smb_clear(smbus); | ||
186 | |||
187 | switch (size) { | ||
188 | case I2C_SMBUS_QUICK: | ||
189 | TXFIFO_WR(smbus, addr | read_flag | MTXFIFO_START | | ||
190 | MTXFIFO_STOP); | ||
191 | break; | ||
192 | case I2C_SMBUS_BYTE: | ||
193 | TXFIFO_WR(smbus, addr | read_flag | MTXFIFO_START); | ||
194 | if (read_write) | ||
195 | TXFIFO_WR(smbus, 1 | MTXFIFO_STOP | MTXFIFO_READ); | ||
196 | else | ||
197 | TXFIFO_WR(smbus, MTXFIFO_STOP | command); | ||
198 | break; | ||
199 | case I2C_SMBUS_BYTE_DATA: | ||
200 | TXFIFO_WR(smbus, addr | MTXFIFO_START); | ||
201 | TXFIFO_WR(smbus, command); | ||
202 | if (read_write) { | ||
203 | TXFIFO_WR(smbus, addr | I2C_SMBUS_READ | MTXFIFO_START); | ||
204 | TXFIFO_WR(smbus, 1 | MTXFIFO_READ | MTXFIFO_STOP); | ||
205 | } else { | ||
206 | TXFIFO_WR(smbus, MTXFIFO_STOP | data->byte); | ||
207 | } | ||
208 | break; | ||
209 | case I2C_SMBUS_WORD_DATA: | ||
210 | TXFIFO_WR(smbus, addr | MTXFIFO_START); | ||
211 | TXFIFO_WR(smbus, command); | ||
212 | if (read_write) { | ||
213 | TXFIFO_WR(smbus, addr | I2C_SMBUS_READ | MTXFIFO_START); | ||
214 | TXFIFO_WR(smbus, 2 | MTXFIFO_READ | MTXFIFO_STOP); | ||
215 | } else { | ||
216 | TXFIFO_WR(smbus, data->word & MTXFIFO_DATA_M); | ||
217 | TXFIFO_WR(smbus, MTXFIFO_STOP | (data->word >> 8)); | ||
218 | } | ||
219 | break; | ||
220 | case I2C_SMBUS_BLOCK_DATA: | ||
221 | TXFIFO_WR(smbus, addr | MTXFIFO_START); | ||
222 | TXFIFO_WR(smbus, command); | ||
223 | if (read_write) { | ||
224 | TXFIFO_WR(smbus, addr | I2C_SMBUS_READ | MTXFIFO_START); | ||
225 | TXFIFO_WR(smbus, 1 | MTXFIFO_READ); | ||
226 | rd = RXFIFO_RD(smbus); | ||
227 | len = min_t(u8, (rd & MRXFIFO_DATA_M), | ||
228 | I2C_SMBUS_BLOCK_MAX); | ||
229 | TXFIFO_WR(smbus, (len + 1) | MTXFIFO_READ | | ||
230 | MTXFIFO_STOP); | ||
231 | } else { | ||
232 | len = min_t(u8, data->block[0], I2C_SMBUS_BLOCK_MAX); | ||
233 | TXFIFO_WR(smbus, len); | ||
234 | for (i = 1; i < len; i++) | ||
235 | TXFIFO_WR(smbus, data->block[i]); | ||
236 | TXFIFO_WR(smbus, data->block[len] | MTXFIFO_STOP); | ||
237 | } | ||
238 | break; | ||
239 | case I2C_SMBUS_PROC_CALL: | ||
240 | read_write = I2C_SMBUS_READ; | ||
241 | TXFIFO_WR(smbus, addr | MTXFIFO_START); | ||
242 | TXFIFO_WR(smbus, command); | ||
243 | TXFIFO_WR(smbus, data->word & MTXFIFO_DATA_M); | ||
244 | TXFIFO_WR(smbus, (data->word >> 8) & MTXFIFO_DATA_M); | ||
245 | TXFIFO_WR(smbus, addr | I2C_SMBUS_READ | MTXFIFO_START); | ||
246 | TXFIFO_WR(smbus, 2 | MTXFIFO_STOP | MTXFIFO_READ); | ||
247 | break; | ||
248 | case I2C_SMBUS_BLOCK_PROC_CALL: | ||
249 | len = min_t(u8, data->block[0], I2C_SMBUS_BLOCK_MAX - 1); | ||
250 | read_write = I2C_SMBUS_READ; | ||
251 | TXFIFO_WR(smbus, addr | MTXFIFO_START); | ||
252 | TXFIFO_WR(smbus, command); | ||
253 | TXFIFO_WR(smbus, len); | ||
254 | for (i = 1; i <= len; i++) | ||
255 | TXFIFO_WR(smbus, data->block[i]); | ||
256 | TXFIFO_WR(smbus, addr | I2C_SMBUS_READ); | ||
257 | TXFIFO_WR(smbus, MTXFIFO_READ | 1); | ||
258 | rd = RXFIFO_RD(smbus); | ||
259 | len = min_t(u8, (rd & MRXFIFO_DATA_M), | ||
260 | I2C_SMBUS_BLOCK_MAX - len); | ||
261 | TXFIFO_WR(smbus, (len + 1) | MTXFIFO_READ | MTXFIFO_STOP); | ||
262 | break; | ||
263 | |||
264 | default: | ||
265 | dev_warn(&adapter->dev, "Unsupported transaction %d\n", size); | ||
266 | return -EINVAL; | ||
267 | } | ||
268 | |||
269 | err = pasemi_smb_waitready(smbus); | ||
270 | if (err) | ||
271 | goto reset_out; | ||
272 | |||
273 | if (read_write == I2C_SMBUS_WRITE) | ||
274 | return 0; | ||
275 | |||
276 | switch (size) { | ||
277 | case I2C_SMBUS_BYTE: | ||
278 | case I2C_SMBUS_BYTE_DATA: | ||
279 | rd = RXFIFO_RD(smbus); | ||
280 | if (rd & MRXFIFO_EMPTY) { | ||
281 | err = -ENODATA; | ||
282 | goto reset_out; | ||
283 | } | ||
284 | data->byte = rd & MRXFIFO_DATA_M; | ||
285 | break; | ||
286 | case I2C_SMBUS_WORD_DATA: | ||
287 | case I2C_SMBUS_PROC_CALL: | ||
288 | rd = RXFIFO_RD(smbus); | ||
289 | if (rd & MRXFIFO_EMPTY) { | ||
290 | err = -ENODATA; | ||
291 | goto reset_out; | ||
292 | } | ||
293 | data->word = rd & MRXFIFO_DATA_M; | ||
294 | rd = RXFIFO_RD(smbus); | ||
295 | if (rd & MRXFIFO_EMPTY) { | ||
296 | err = -ENODATA; | ||
297 | goto reset_out; | ||
298 | } | ||
299 | data->word |= (rd & MRXFIFO_DATA_M) << 8; | ||
300 | break; | ||
301 | case I2C_SMBUS_BLOCK_DATA: | ||
302 | case I2C_SMBUS_BLOCK_PROC_CALL: | ||
303 | data->block[0] = len; | ||
304 | for (i = 1; i <= len; i ++) { | ||
305 | rd = RXFIFO_RD(smbus); | ||
306 | if (rd & MRXFIFO_EMPTY) { | ||
307 | err = -ENODATA; | ||
308 | goto reset_out; | ||
309 | } | ||
310 | data->block[i] = rd & MRXFIFO_DATA_M; | ||
311 | } | ||
312 | break; | ||
313 | } | ||
314 | |||
315 | return 0; | ||
316 | |||
317 | reset_out: | ||
318 | reg_write(smbus, REG_CTL, (CTL_MTR | CTL_MRR | | ||
319 | (CLK_100K_DIV & CTL_CLK_M))); | ||
320 | return err; | ||
321 | } | ||
322 | |||
323 | static u32 pasemi_smb_func(struct i2c_adapter *adapter) | ||
324 | { | ||
325 | return I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | | ||
326 | I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA | | ||
327 | I2C_FUNC_SMBUS_BLOCK_DATA | I2C_FUNC_SMBUS_PROC_CALL | | ||
328 | I2C_FUNC_SMBUS_BLOCK_PROC_CALL | I2C_FUNC_I2C; | ||
329 | } | ||
330 | |||
331 | static const struct i2c_algorithm smbus_algorithm = { | ||
332 | .master_xfer = pasemi_i2c_xfer, | ||
333 | .smbus_xfer = pasemi_smb_xfer, | ||
334 | .functionality = pasemi_smb_func, | ||
335 | }; | ||
336 | |||
337 | static int __devinit pasemi_smb_probe(struct pci_dev *dev, | ||
338 | const struct pci_device_id *id) | ||
339 | { | ||
340 | struct pasemi_smbus *smbus; | ||
341 | int error; | ||
342 | |||
343 | if (!(pci_resource_flags(dev, 0) & IORESOURCE_IO)) | ||
344 | return -ENODEV; | ||
345 | |||
346 | smbus = kzalloc(sizeof(struct pasemi_smbus), GFP_KERNEL); | ||
347 | if (!smbus) | ||
348 | return -ENOMEM; | ||
349 | |||
350 | smbus->dev = dev; | ||
351 | smbus->base = pci_resource_start(dev, 0); | ||
352 | smbus->size = pci_resource_len(dev, 0); | ||
353 | |||
354 | if (!request_region(smbus->base, smbus->size, | ||
355 | pasemi_smb_driver.name)) { | ||
356 | error = -EBUSY; | ||
357 | goto out_kfree; | ||
358 | } | ||
359 | |||
360 | smbus->adapter.owner = THIS_MODULE; | ||
361 | snprintf(smbus->adapter.name, I2C_NAME_SIZE, | ||
362 | "PA Semi SMBus adapter at 0x%lx", smbus->base); | ||
363 | smbus->adapter.class = I2C_CLASS_HWMON; | ||
364 | smbus->adapter.algo = &smbus_algorithm; | ||
365 | smbus->adapter.algo_data = smbus; | ||
366 | |||
367 | /* set up the driverfs linkage to our parent device */ | ||
368 | smbus->adapter.dev.parent = &dev->dev; | ||
369 | |||
370 | reg_write(smbus, REG_CTL, (CTL_MTR | CTL_MRR | | ||
371 | (CLK_100K_DIV & CTL_CLK_M))); | ||
372 | |||
373 | error = i2c_add_adapter(&smbus->adapter); | ||
374 | if (error) | ||
375 | goto out_release_region; | ||
376 | |||
377 | pci_set_drvdata(dev, smbus); | ||
378 | |||
379 | return 0; | ||
380 | |||
381 | out_release_region: | ||
382 | release_region(smbus->base, smbus->size); | ||
383 | out_kfree: | ||
384 | kfree(smbus); | ||
385 | return error; | ||
386 | } | ||
387 | |||
388 | static void __devexit pasemi_smb_remove(struct pci_dev *dev) | ||
389 | { | ||
390 | struct pasemi_smbus *smbus = pci_get_drvdata(dev); | ||
391 | |||
392 | i2c_del_adapter(&smbus->adapter); | ||
393 | release_region(smbus->base, smbus->size); | ||
394 | kfree(smbus); | ||
395 | } | ||
396 | |||
397 | static struct pci_device_id pasemi_smb_ids[] = { | ||
398 | { PCI_DEVICE(0x1959, 0xa003) }, | ||
399 | { 0, } | ||
400 | }; | ||
401 | |||
402 | MODULE_DEVICE_TABLE(pci, pasemi_smb_ids); | ||
403 | |||
404 | static struct pci_driver pasemi_smb_driver = { | ||
405 | .name = "i2c-pasemi", | ||
406 | .id_table = pasemi_smb_ids, | ||
407 | .probe = pasemi_smb_probe, | ||
408 | .remove = __devexit_p(pasemi_smb_remove), | ||
409 | }; | ||
410 | |||
411 | static int __init pasemi_smb_init(void) | ||
412 | { | ||
413 | return pci_register_driver(&pasemi_smb_driver); | ||
414 | } | ||
415 | |||
416 | static void __exit pasemi_smb_exit(void) | ||
417 | { | ||
418 | pci_unregister_driver(&pasemi_smb_driver); | ||
419 | } | ||
420 | |||
421 | MODULE_LICENSE("GPL"); | ||
422 | MODULE_AUTHOR ("Olof Johansson <olof@lixom.net>"); | ||
423 | MODULE_DESCRIPTION("PA Semi PWRficient SMBus driver"); | ||
424 | |||
425 | module_init(pasemi_smb_init); | ||
426 | module_exit(pasemi_smb_exit); | ||
diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c index 30c7a1b38cbd..03d0aeea0189 100644 --- a/drivers/i2c/busses/i2c-piix4.c +++ b/drivers/i2c/busses/i2c-piix4.c | |||
@@ -23,6 +23,7 @@ | |||
23 | Supports: | 23 | Supports: |
24 | Intel PIIX4, 440MX | 24 | Intel PIIX4, 440MX |
25 | Serverworks OSB4, CSB5, CSB6, HT-1000 | 25 | Serverworks OSB4, CSB5, CSB6, HT-1000 |
26 | ATI IXP200, IXP300, IXP400, SB600 | ||
26 | SMSC Victory66 | 27 | SMSC Victory66 |
27 | 28 | ||
28 | Note: we assume there can only be one device, with one SMBus interface. | 29 | Note: we assume there can only be one device, with one SMBus interface. |
@@ -383,6 +384,7 @@ static const struct i2c_algorithm smbus_algorithm = { | |||
383 | 384 | ||
384 | static struct i2c_adapter piix4_adapter = { | 385 | static struct i2c_adapter piix4_adapter = { |
385 | .owner = THIS_MODULE, | 386 | .owner = THIS_MODULE, |
387 | .id = I2C_HW_SMBUS_PIIX4, | ||
386 | .class = I2C_CLASS_HWMON, | 388 | .class = I2C_CLASS_HWMON, |
387 | .algo = &smbus_algorithm, | 389 | .algo = &smbus_algorithm, |
388 | }; | 390 | }; |
@@ -396,6 +398,8 @@ static struct pci_device_id piix4_ids[] = { | |||
396 | .driver_data = 0 }, | 398 | .driver_data = 0 }, |
397 | { PCI_DEVICE(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP400_SMBUS), | 399 | { PCI_DEVICE(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP400_SMBUS), |
398 | .driver_data = 0 }, | 400 | .driver_data = 0 }, |
401 | { PCI_DEVICE(PCI_VENDOR_ID_ATI, PCI_DEVICE_ID_ATI_IXP600_SMBUS), | ||
402 | .driver_data = 0 }, | ||
399 | { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_OSB4), | 403 | { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_OSB4), |
400 | .driver_data = 0 }, | 404 | .driver_data = 0 }, |
401 | { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB5), | 405 | { PCI_DEVICE(PCI_VENDOR_ID_SERVERWORKS, PCI_DEVICE_ID_SERVERWORKS_CSB5), |
diff --git a/drivers/i2c/busses/i2c-powermac.c b/drivers/i2c/busses/i2c-powermac.c index 648d55533d87..1425d2245c82 100644 --- a/drivers/i2c/busses/i2c-powermac.c +++ b/drivers/i2c/busses/i2c-powermac.c | |||
@@ -25,7 +25,6 @@ | |||
25 | #include <linux/types.h> | 25 | #include <linux/types.h> |
26 | #include <linux/i2c.h> | 26 | #include <linux/i2c.h> |
27 | #include <linux/init.h> | 27 | #include <linux/init.h> |
28 | #include <linux/completion.h> | ||
29 | #include <linux/device.h> | 28 | #include <linux/device.h> |
30 | #include <linux/platform_device.h> | 29 | #include <linux/platform_device.h> |
31 | #include <asm/prom.h> | 30 | #include <asm/prom.h> |
diff --git a/drivers/i2c/busses/i2c-savage4.c b/drivers/i2c/busses/i2c-savage4.c index 844b4ff90893..b7fb65c30112 100644 --- a/drivers/i2c/busses/i2c-savage4.c +++ b/drivers/i2c/busses/i2c-savage4.c | |||
@@ -145,6 +145,7 @@ static struct i2c_algo_bit_data sav_i2c_bit_data = { | |||
145 | 145 | ||
146 | static struct i2c_adapter savage4_i2c_adapter = { | 146 | static struct i2c_adapter savage4_i2c_adapter = { |
147 | .owner = THIS_MODULE, | 147 | .owner = THIS_MODULE, |
148 | .id = I2C_HW_B_SAVAGE, | ||
148 | .name = "I2C Savage4 adapter", | 149 | .name = "I2C Savage4 adapter", |
149 | .algo_data = &sav_i2c_bit_data, | 150 | .algo_data = &sav_i2c_bit_data, |
150 | }; | 151 | }; |
diff --git a/drivers/i2c/busses/i2c-sis5595.c b/drivers/i2c/busses/i2c-sis5595.c index 38bbfd840b6b..d333babe4ad3 100644 --- a/drivers/i2c/busses/i2c-sis5595.c +++ b/drivers/i2c/busses/i2c-sis5595.c | |||
@@ -365,6 +365,7 @@ static const struct i2c_algorithm smbus_algorithm = { | |||
365 | 365 | ||
366 | static struct i2c_adapter sis5595_adapter = { | 366 | static struct i2c_adapter sis5595_adapter = { |
367 | .owner = THIS_MODULE, | 367 | .owner = THIS_MODULE, |
368 | .id = I2C_HW_SMBUS_SIS5595, | ||
368 | .class = I2C_CLASS_HWMON, | 369 | .class = I2C_CLASS_HWMON, |
369 | .algo = &smbus_algorithm, | 370 | .algo = &smbus_algorithm, |
370 | }; | 371 | }; |
diff --git a/drivers/i2c/busses/i2c-sis630.c b/drivers/i2c/busses/i2c-sis630.c index dec0bafb52ab..172bacf932a6 100644 --- a/drivers/i2c/busses/i2c-sis630.c +++ b/drivers/i2c/busses/i2c-sis630.c | |||
@@ -457,6 +457,7 @@ static const struct i2c_algorithm smbus_algorithm = { | |||
457 | 457 | ||
458 | static struct i2c_adapter sis630_adapter = { | 458 | static struct i2c_adapter sis630_adapter = { |
459 | .owner = THIS_MODULE, | 459 | .owner = THIS_MODULE, |
460 | .id = I2C_HW_SMBUS_SIS630, | ||
460 | .class = I2C_CLASS_HWMON, | 461 | .class = I2C_CLASS_HWMON, |
461 | .algo = &smbus_algorithm, | 462 | .algo = &smbus_algorithm, |
462 | }; | 463 | }; |
diff --git a/drivers/i2c/busses/i2c-sis96x.c b/drivers/i2c/busses/i2c-sis96x.c index 7fd07fbac336..869a635d37e9 100644 --- a/drivers/i2c/busses/i2c-sis96x.c +++ b/drivers/i2c/busses/i2c-sis96x.c | |||
@@ -249,6 +249,7 @@ static const struct i2c_algorithm smbus_algorithm = { | |||
249 | 249 | ||
250 | static struct i2c_adapter sis96x_adapter = { | 250 | static struct i2c_adapter sis96x_adapter = { |
251 | .owner = THIS_MODULE, | 251 | .owner = THIS_MODULE, |
252 | .id = I2C_HW_SMBUS_SIS96X, | ||
252 | .class = I2C_CLASS_HWMON, | 253 | .class = I2C_CLASS_HWMON, |
253 | .algo = &smbus_algorithm, | 254 | .algo = &smbus_algorithm, |
254 | }; | 255 | }; |
diff --git a/drivers/i2c/busses/i2c-via.c b/drivers/i2c/busses/i2c-via.c index 15d7e00e47e6..bbcc62151f7c 100644 --- a/drivers/i2c/busses/i2c-via.c +++ b/drivers/i2c/busses/i2c-via.c | |||
@@ -86,6 +86,7 @@ static struct i2c_algo_bit_data bit_data = { | |||
86 | 86 | ||
87 | static struct i2c_adapter vt586b_adapter = { | 87 | static struct i2c_adapter vt586b_adapter = { |
88 | .owner = THIS_MODULE, | 88 | .owner = THIS_MODULE, |
89 | .id = I2C_HW_B_VIA, | ||
89 | .class = I2C_CLASS_HWMON, | 90 | .class = I2C_CLASS_HWMON, |
90 | .name = "VIA i2c", | 91 | .name = "VIA i2c", |
91 | .algo_data = &bit_data, | 92 | .algo_data = &bit_data, |
diff --git a/drivers/i2c/busses/i2c-viapro.c b/drivers/i2c/busses/i2c-viapro.c index efc6bbf0cc0a..03c5fc868548 100644 --- a/drivers/i2c/busses/i2c-viapro.c +++ b/drivers/i2c/busses/i2c-viapro.c | |||
@@ -4,7 +4,7 @@ | |||
4 | Copyright (c) 1998 - 2002 Frodo Looijaard <frodol@dds.nl>, | 4 | Copyright (c) 1998 - 2002 Frodo Looijaard <frodol@dds.nl>, |
5 | Philip Edelbrock <phil@netroedge.com>, Kyösti Mälkki <kmalkki@cc.hut.fi>, | 5 | Philip Edelbrock <phil@netroedge.com>, Kyösti Mälkki <kmalkki@cc.hut.fi>, |
6 | Mark D. Studebaker <mdsxyz123@yahoo.com> | 6 | Mark D. Studebaker <mdsxyz123@yahoo.com> |
7 | Copyright (C) 2005 Jean Delvare <khali@linux-fr.org> | 7 | Copyright (C) 2005 - 2007 Jean Delvare <khali@linux-fr.org> |
8 | 8 | ||
9 | This program is free software; you can redistribute it and/or modify | 9 | This program is free software; you can redistribute it and/or modify |
10 | it under the terms of the GNU General Public License as published by | 10 | it under the terms of the GNU General Public License as published by |
@@ -36,6 +36,7 @@ | |||
36 | VT8237R 0x3227 yes | 36 | VT8237R 0x3227 yes |
37 | VT8237A 0x3337 yes | 37 | VT8237A 0x3337 yes |
38 | VT8251 0x3287 yes | 38 | VT8251 0x3287 yes |
39 | CX700 0x8324 yes | ||
39 | 40 | ||
40 | Note: we assume there can only be one device, with one SMBus interface. | 41 | Note: we assume there can only be one device, with one SMBus interface. |
41 | */ | 42 | */ |
@@ -306,6 +307,7 @@ static const struct i2c_algorithm smbus_algorithm = { | |||
306 | 307 | ||
307 | static struct i2c_adapter vt596_adapter = { | 308 | static struct i2c_adapter vt596_adapter = { |
308 | .owner = THIS_MODULE, | 309 | .owner = THIS_MODULE, |
310 | .id = I2C_HW_SMBUS_VIA2, | ||
309 | .class = I2C_CLASS_HWMON, | 311 | .class = I2C_CLASS_HWMON, |
310 | .algo = &smbus_algorithm, | 312 | .algo = &smbus_algorithm, |
311 | }; | 313 | }; |
@@ -383,6 +385,7 @@ found: | |||
383 | dev_dbg(&pdev->dev, "VT596_smba = 0x%X\n", vt596_smba); | 385 | dev_dbg(&pdev->dev, "VT596_smba = 0x%X\n", vt596_smba); |
384 | 386 | ||
385 | switch (pdev->device) { | 387 | switch (pdev->device) { |
388 | case PCI_DEVICE_ID_VIA_CX700: | ||
386 | case PCI_DEVICE_ID_VIA_8251: | 389 | case PCI_DEVICE_ID_VIA_8251: |
387 | case PCI_DEVICE_ID_VIA_8237: | 390 | case PCI_DEVICE_ID_VIA_8237: |
388 | case PCI_DEVICE_ID_VIA_8237A: | 391 | case PCI_DEVICE_ID_VIA_8237A: |
@@ -442,6 +445,8 @@ static struct pci_device_id vt596_ids[] = { | |||
442 | .driver_data = SMBBA1 }, | 445 | .driver_data = SMBBA1 }, |
443 | { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8251), | 446 | { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8251), |
444 | .driver_data = SMBBA3 }, | 447 | .driver_data = SMBBA3 }, |
448 | { PCI_DEVICE(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_CX700), | ||
449 | .driver_data = SMBBA3 }, | ||
445 | { 0, } | 450 | { 0, } |
446 | }; | 451 | }; |
447 | 452 | ||
diff --git a/drivers/i2c/busses/i2c-voodoo3.c b/drivers/i2c/busses/i2c-voodoo3.c index b0377b81744b..88a3447e11e1 100644 --- a/drivers/i2c/busses/i2c-voodoo3.c +++ b/drivers/i2c/busses/i2c-voodoo3.c | |||
@@ -165,6 +165,7 @@ static struct i2c_algo_bit_data voo_i2c_bit_data = { | |||
165 | 165 | ||
166 | static struct i2c_adapter voodoo3_i2c_adapter = { | 166 | static struct i2c_adapter voodoo3_i2c_adapter = { |
167 | .owner = THIS_MODULE, | 167 | .owner = THIS_MODULE, |
168 | .id = I2C_HW_B_VOO, | ||
168 | .class = I2C_CLASS_TV_ANALOG, | 169 | .class = I2C_CLASS_TV_ANALOG, |
169 | .name = "I2C Voodoo3/Banshee adapter", | 170 | .name = "I2C Voodoo3/Banshee adapter", |
170 | .algo_data = &voo_i2c_bit_data, | 171 | .algo_data = &voo_i2c_bit_data, |
@@ -181,6 +182,7 @@ static struct i2c_algo_bit_data voo_ddc_bit_data = { | |||
181 | 182 | ||
182 | static struct i2c_adapter voodoo3_ddc_adapter = { | 183 | static struct i2c_adapter voodoo3_ddc_adapter = { |
183 | .owner = THIS_MODULE, | 184 | .owner = THIS_MODULE, |
185 | .id = I2C_HW_B_VOO, | ||
184 | .class = I2C_CLASS_DDC, | 186 | .class = I2C_CLASS_DDC, |
185 | .name = "DDC Voodoo3/Banshee adapter", | 187 | .name = "DDC Voodoo3/Banshee adapter", |
186 | .algo_data = &voo_ddc_bit_data, | 188 | .algo_data = &voo_ddc_bit_data, |
diff --git a/drivers/i2c/busses/scx200_acb.c b/drivers/i2c/busses/scx200_acb.c index 714bae780953..0b082c5a0195 100644 --- a/drivers/i2c/busses/scx200_acb.c +++ b/drivers/i2c/busses/scx200_acb.c | |||
@@ -428,7 +428,7 @@ static __init int scx200_acb_probe(struct scx200_acb_iface *iface) | |||
428 | } | 428 | } |
429 | 429 | ||
430 | static __init struct scx200_acb_iface *scx200_create_iface(const char *text, | 430 | static __init struct scx200_acb_iface *scx200_create_iface(const char *text, |
431 | int index) | 431 | struct device *dev, int index) |
432 | { | 432 | { |
433 | struct scx200_acb_iface *iface; | 433 | struct scx200_acb_iface *iface; |
434 | struct i2c_adapter *adapter; | 434 | struct i2c_adapter *adapter; |
@@ -446,6 +446,7 @@ static __init struct scx200_acb_iface *scx200_create_iface(const char *text, | |||
446 | adapter->id = I2C_HW_SMBUS_SCX200; | 446 | adapter->id = I2C_HW_SMBUS_SCX200; |
447 | adapter->algo = &scx200_acb_algorithm; | 447 | adapter->algo = &scx200_acb_algorithm; |
448 | adapter->class = I2C_CLASS_HWMON; | 448 | adapter->class = I2C_CLASS_HWMON; |
449 | adapter->dev.parent = dev; | ||
449 | 450 | ||
450 | mutex_init(&iface->mutex); | 451 | mutex_init(&iface->mutex); |
451 | 452 | ||
@@ -486,7 +487,7 @@ static __init int scx200_create_pci(const char *text, struct pci_dev *pdev, | |||
486 | struct scx200_acb_iface *iface; | 487 | struct scx200_acb_iface *iface; |
487 | int rc; | 488 | int rc; |
488 | 489 | ||
489 | iface = scx200_create_iface(text, 0); | 490 | iface = scx200_create_iface(text, &pdev->dev, 0); |
490 | 491 | ||
491 | if (iface == NULL) | 492 | if (iface == NULL) |
492 | return -ENOMEM; | 493 | return -ENOMEM; |
@@ -524,7 +525,7 @@ static int __init scx200_create_isa(const char *text, unsigned long base, | |||
524 | struct scx200_acb_iface *iface; | 525 | struct scx200_acb_iface *iface; |
525 | int rc; | 526 | int rc; |
526 | 527 | ||
527 | iface = scx200_create_iface(text, index); | 528 | iface = scx200_create_iface(text, NULL, index); |
528 | 529 | ||
529 | if (iface == NULL) | 530 | if (iface == NULL) |
530 | return -ENOMEM; | 531 | return -ENOMEM; |
diff --git a/drivers/i2c/busses/scx200_i2c.c b/drivers/i2c/busses/scx200_i2c.c index 6cd96e43aa72..c3022a023449 100644 --- a/drivers/i2c/busses/scx200_i2c.c +++ b/drivers/i2c/busses/scx200_i2c.c | |||
@@ -81,6 +81,7 @@ static struct i2c_algo_bit_data scx200_i2c_data = { | |||
81 | 81 | ||
82 | static struct i2c_adapter scx200_i2c_ops = { | 82 | static struct i2c_adapter scx200_i2c_ops = { |
83 | .owner = THIS_MODULE, | 83 | .owner = THIS_MODULE, |
84 | .id = I2C_HW_B_SCX200, | ||
84 | .algo_data = &scx200_i2c_data, | 85 | .algo_data = &scx200_i2c_data, |
85 | .name = "NatSemi SCx200 I2C", | 86 | .name = "NatSemi SCx200 I2C", |
86 | }; | 87 | }; |
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index b05378a3d673..21fe1406c8b4 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/seq_file.h> | 32 | #include <linux/seq_file.h> |
33 | #include <linux/platform_device.h> | 33 | #include <linux/platform_device.h> |
34 | #include <linux/mutex.h> | 34 | #include <linux/mutex.h> |
35 | #include <linux/completion.h> | ||
35 | #include <asm/uaccess.h> | 36 | #include <asm/uaccess.h> |
36 | 37 | ||
37 | 38 | ||
@@ -40,49 +41,72 @@ static LIST_HEAD(drivers); | |||
40 | static DEFINE_MUTEX(core_lists); | 41 | static DEFINE_MUTEX(core_lists); |
41 | static DEFINE_IDR(i2c_adapter_idr); | 42 | static DEFINE_IDR(i2c_adapter_idr); |
42 | 43 | ||
44 | |||
45 | /* ------------------------------------------------------------------------- */ | ||
46 | |||
43 | /* match always succeeds, as we want the probe() to tell if we really accept this match */ | 47 | /* match always succeeds, as we want the probe() to tell if we really accept this match */ |
44 | static int i2c_device_match(struct device *dev, struct device_driver *drv) | 48 | static int i2c_device_match(struct device *dev, struct device_driver *drv) |
45 | { | 49 | { |
46 | return 1; | 50 | return 1; |
47 | } | 51 | } |
48 | 52 | ||
49 | static int i2c_bus_suspend(struct device * dev, pm_message_t state) | 53 | static int i2c_device_probe(struct device *dev) |
50 | { | 54 | { |
51 | int rc = 0; | 55 | return -ENODEV; |
56 | } | ||
52 | 57 | ||
53 | if (dev->driver && dev->driver->suspend) | 58 | static int i2c_device_remove(struct device *dev) |
54 | rc = dev->driver->suspend(dev, state); | 59 | { |
55 | return rc; | 60 | return 0; |
56 | } | 61 | } |
57 | 62 | ||
58 | static int i2c_bus_resume(struct device * dev) | 63 | static void i2c_device_shutdown(struct device *dev) |
59 | { | 64 | { |
60 | int rc = 0; | 65 | struct i2c_driver *driver; |
61 | 66 | ||
62 | if (dev->driver && dev->driver->resume) | 67 | if (!dev->driver) |
63 | rc = dev->driver->resume(dev); | 68 | return; |
64 | return rc; | 69 | driver = to_i2c_driver(dev->driver); |
70 | if (driver->shutdown) | ||
71 | driver->shutdown(to_i2c_client(dev)); | ||
65 | } | 72 | } |
66 | 73 | ||
67 | static int i2c_device_probe(struct device *dev) | 74 | static int i2c_device_suspend(struct device * dev, pm_message_t mesg) |
68 | { | 75 | { |
69 | return -ENODEV; | 76 | struct i2c_driver *driver; |
77 | |||
78 | if (!dev->driver) | ||
79 | return 0; | ||
80 | driver = to_i2c_driver(dev->driver); | ||
81 | if (!driver->suspend) | ||
82 | return 0; | ||
83 | return driver->suspend(to_i2c_client(dev), mesg); | ||
70 | } | 84 | } |
71 | 85 | ||
72 | static int i2c_device_remove(struct device *dev) | 86 | static int i2c_device_resume(struct device * dev) |
73 | { | 87 | { |
74 | return 0; | 88 | struct i2c_driver *driver; |
89 | |||
90 | if (!dev->driver) | ||
91 | return 0; | ||
92 | driver = to_i2c_driver(dev->driver); | ||
93 | if (!driver->resume) | ||
94 | return 0; | ||
95 | return driver->resume(to_i2c_client(dev)); | ||
75 | } | 96 | } |
76 | 97 | ||
77 | struct bus_type i2c_bus_type = { | 98 | struct bus_type i2c_bus_type = { |
78 | .name = "i2c", | 99 | .name = "i2c", |
79 | .match = i2c_device_match, | 100 | .match = i2c_device_match, |
80 | .probe = i2c_device_probe, | 101 | .probe = i2c_device_probe, |
81 | .remove = i2c_device_remove, | 102 | .remove = i2c_device_remove, |
82 | .suspend = i2c_bus_suspend, | 103 | .shutdown = i2c_device_shutdown, |
83 | .resume = i2c_bus_resume, | 104 | .suspend = i2c_device_suspend, |
105 | .resume = i2c_device_resume, | ||
84 | }; | 106 | }; |
85 | 107 | ||
108 | /* ------------------------------------------------------------------------- */ | ||
109 | |||
86 | void i2c_adapter_dev_release(struct device *dev) | 110 | void i2c_adapter_dev_release(struct device *dev) |
87 | { | 111 | { |
88 | struct i2c_adapter *adap = dev_to_i2c_adapter(dev); | 112 | struct i2c_adapter *adap = dev_to_i2c_adapter(dev); |
@@ -193,9 +217,8 @@ int i2c_add_adapter(struct i2c_adapter *adap) | |||
193 | */ | 217 | */ |
194 | if (adap->dev.parent == NULL) { | 218 | if (adap->dev.parent == NULL) { |
195 | adap->dev.parent = &platform_bus; | 219 | adap->dev.parent = &platform_bus; |
196 | printk(KERN_WARNING "**WARNING** I2C adapter driver [%s] " | 220 | pr_debug("I2C adapter driver [%s] forgot to specify " |
197 | "forgot to specify physical device; fix it!\n", | 221 | "physical device\n", adap->name); |
198 | adap->name); | ||
199 | } | 222 | } |
200 | sprintf(adap->dev.bus_id, "i2c-%d", adap->nr); | 223 | sprintf(adap->dev.bus_id, "i2c-%d", adap->nr); |
201 | adap->dev.driver = &i2c_adapter_driver; | 224 | adap->dev.driver = &i2c_adapter_driver; |
diff --git a/drivers/ieee1394/pcilynx.c b/drivers/ieee1394/pcilynx.c index fbb7f14ec509..0742befe9227 100644 --- a/drivers/ieee1394/pcilynx.c +++ b/drivers/ieee1394/pcilynx.c | |||
@@ -1434,6 +1434,7 @@ static int __devinit add_card(struct pci_dev *dev, | |||
1434 | i2c_adapter_data = bit_data; | 1434 | i2c_adapter_data = bit_data; |
1435 | i2c_ad->algo_data = &i2c_adapter_data; | 1435 | i2c_ad->algo_data = &i2c_adapter_data; |
1436 | i2c_adapter_data.data = lynx; | 1436 | i2c_adapter_data.data = lynx; |
1437 | i2c_ad->dev.parent = &dev->dev; | ||
1437 | 1438 | ||
1438 | PRINTD(KERN_DEBUG, lynx->id,"original eeprom control: %d", | 1439 | PRINTD(KERN_DEBUG, lynx->id,"original eeprom control: %d", |
1439 | reg_read(lynx, SERIAL_EEPROM_CONTROL)); | 1440 | reg_read(lynx, SERIAL_EEPROM_CONTROL)); |
diff --git a/drivers/media/dvb/b2c2/flexcop-i2c.c b/drivers/media/dvb/b2c2/flexcop-i2c.c index e0bd2d8f0f0c..5347a406fff7 100644 --- a/drivers/media/dvb/b2c2/flexcop-i2c.c +++ b/drivers/media/dvb/b2c2/flexcop-i2c.c | |||
@@ -190,6 +190,7 @@ int flexcop_i2c_init(struct flexcop_device *fc) | |||
190 | fc->i2c_adap.class = I2C_CLASS_TV_DIGITAL; | 190 | fc->i2c_adap.class = I2C_CLASS_TV_DIGITAL; |
191 | fc->i2c_adap.algo = &flexcop_algo; | 191 | fc->i2c_adap.algo = &flexcop_algo; |
192 | fc->i2c_adap.algo_data = NULL; | 192 | fc->i2c_adap.algo_data = NULL; |
193 | fc->i2c_adap.dev.parent = fc->dev; | ||
193 | 194 | ||
194 | if ((ret = i2c_add_adapter(&fc->i2c_adap)) < 0) | 195 | if ((ret = i2c_add_adapter(&fc->i2c_adap)) < 0) |
195 | return ret; | 196 | return ret; |
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c b/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c index 55ba020386c9..70df31b0a8a9 100644 --- a/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c +++ b/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c | |||
@@ -27,6 +27,7 @@ int dvb_usb_i2c_init(struct dvb_usb_device *d) | |||
27 | #endif | 27 | #endif |
28 | d->i2c_adap.algo = d->props.i2c_algo; | 28 | d->i2c_adap.algo = d->props.i2c_algo; |
29 | d->i2c_adap.algo_data = NULL; | 29 | d->i2c_adap.algo_data = NULL; |
30 | d->i2c_adap.dev.parent = &d->udev->dev; | ||
30 | 31 | ||
31 | i2c_set_adapdata(&d->i2c_adap, d); | 32 | i2c_set_adapdata(&d->i2c_adap, d); |
32 | 33 | ||
diff --git a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c index 60820deb900b..b60cdc93d6db 100644 --- a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c +++ b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c | |||
@@ -1690,6 +1690,7 @@ static int ttusb_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
1690 | #endif | 1690 | #endif |
1691 | ttusb->i2c_adap.algo = &ttusb_dec_algo; | 1691 | ttusb->i2c_adap.algo = &ttusb_dec_algo; |
1692 | ttusb->i2c_adap.algo_data = NULL; | 1692 | ttusb->i2c_adap.algo_data = NULL; |
1693 | ttusb->i2c_adap.dev.parent = &udev->dev; | ||
1693 | 1694 | ||
1694 | result = i2c_add_adapter(&ttusb->i2c_adap); | 1695 | result = i2c_add_adapter(&ttusb->i2c_adap); |
1695 | if (result) { | 1696 | if (result) { |
diff --git a/drivers/media/video/cafe_ccic.c b/drivers/media/video/cafe_ccic.c index fb1410c6f864..4dae8925667f 100644 --- a/drivers/media/video/cafe_ccic.c +++ b/drivers/media/video/cafe_ccic.c | |||
@@ -549,6 +549,7 @@ static int cafe_smbus_setup(struct cafe_camera *cam) | |||
549 | adap->client_unregister = cafe_smbus_detach; | 549 | adap->client_unregister = cafe_smbus_detach; |
550 | adap->algo = &cafe_smbus_algo; | 550 | adap->algo = &cafe_smbus_algo; |
551 | strcpy(adap->name, "cafe_ccic"); | 551 | strcpy(adap->name, "cafe_ccic"); |
552 | adap->dev.parent = &cam->pdev->dev; | ||
552 | i2c_set_adapdata(adap, cam); | 553 | i2c_set_adapdata(adap, cam); |
553 | ret = i2c_add_adapter(adap); | 554 | ret = i2c_add_adapter(adap); |
554 | if (ret) | 555 | if (ret) |
diff --git a/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c b/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c index f9bb41d8f4f3..62a7cfca837d 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c +++ b/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c | |||
@@ -977,6 +977,7 @@ void pvr2_i2c_core_init(struct pvr2_hdw *hdw) | |||
977 | memcpy(&hdw->i2c_adap,&pvr2_i2c_adap_template,sizeof(hdw->i2c_adap)); | 977 | memcpy(&hdw->i2c_adap,&pvr2_i2c_adap_template,sizeof(hdw->i2c_adap)); |
978 | memcpy(&hdw->i2c_algo,&pvr2_i2c_algo_template,sizeof(hdw->i2c_algo)); | 978 | memcpy(&hdw->i2c_algo,&pvr2_i2c_algo_template,sizeof(hdw->i2c_algo)); |
979 | strlcpy(hdw->i2c_adap.name,hdw->name,sizeof(hdw->i2c_adap.name)); | 979 | strlcpy(hdw->i2c_adap.name,hdw->name,sizeof(hdw->i2c_adap.name)); |
980 | hdw->i2c_adap.dev.parent = &hdw->usb_dev->dev; | ||
980 | hdw->i2c_adap.algo = &hdw->i2c_algo; | 981 | hdw->i2c_adap.algo = &hdw->i2c_algo; |
981 | hdw->i2c_adap.algo_data = hdw; | 982 | hdw->i2c_adap.algo_data = hdw; |
982 | hdw->i2c_pend_mask = 0; | 983 | hdw->i2c_pend_mask = 0; |
diff --git a/drivers/media/video/usbvision/usbvision-i2c.c b/drivers/media/video/usbvision/usbvision-i2c.c index 858252c15084..a242b76aea89 100644 --- a/drivers/media/video/usbvision/usbvision-i2c.c +++ b/drivers/media/video/usbvision/usbvision-i2c.c | |||
@@ -258,6 +258,7 @@ int usbvision_init_i2c(struct usb_usbvision *usbvision) | |||
258 | sprintf(usbvision->i2c_adap.name + strlen(usbvision->i2c_adap.name), | 258 | sprintf(usbvision->i2c_adap.name + strlen(usbvision->i2c_adap.name), |
259 | " #%d", usbvision->vdev->minor & 0x1f); | 259 | " #%d", usbvision->vdev->minor & 0x1f); |
260 | PDEBUG(DBG_I2C,"Adaptername: %s", usbvision->i2c_adap.name); | 260 | PDEBUG(DBG_I2C,"Adaptername: %s", usbvision->i2c_adap.name); |
261 | usbvision->i2c_adap.dev.parent = &usbvision->dev->dev; | ||
261 | 262 | ||
262 | i2c_set_adapdata(&usbvision->i2c_adap, usbvision); | 263 | i2c_set_adapdata(&usbvision->i2c_adap, usbvision); |
263 | i2c_set_clientdata(&usbvision->i2c_client, usbvision); | 264 | i2c_set_clientdata(&usbvision->i2c_client, usbvision); |
diff --git a/drivers/media/video/w9968cf.c b/drivers/media/video/w9968cf.c index 6e64af293be5..8f31613b9903 100644 --- a/drivers/media/video/w9968cf.c +++ b/drivers/media/video/w9968cf.c | |||
@@ -1573,6 +1573,7 @@ static int w9968cf_i2c_init(struct w9968cf_device* cam) | |||
1573 | 1573 | ||
1574 | memcpy(&cam->i2c_adapter, &adap, sizeof(struct i2c_adapter)); | 1574 | memcpy(&cam->i2c_adapter, &adap, sizeof(struct i2c_adapter)); |
1575 | strcpy(cam->i2c_adapter.name, "w9968cf"); | 1575 | strcpy(cam->i2c_adapter.name, "w9968cf"); |
1576 | cam->i2c_adapter.dev.parent = &cam->usbdev->dev; | ||
1576 | i2c_set_adapdata(&cam->i2c_adapter, cam); | 1577 | i2c_set_adapdata(&cam->i2c_adapter, cam); |
1577 | 1578 | ||
1578 | DBG(6, "Registering I2C adapter with kernel...") | 1579 | DBG(6, "Registering I2C adapter with kernel...") |
diff --git a/drivers/media/video/zoran_card.c b/drivers/media/video/zoran_card.c index 4d1eb2fba34a..73162a3a61dd 100644 --- a/drivers/media/video/zoran_card.c +++ b/drivers/media/video/zoran_card.c | |||
@@ -843,6 +843,7 @@ zoran_register_i2c (struct zoran *zr) | |||
843 | sizeof(I2C_NAME(&zr->i2c_adapter)) - 1); | 843 | sizeof(I2C_NAME(&zr->i2c_adapter)) - 1); |
844 | i2c_set_adapdata(&zr->i2c_adapter, zr); | 844 | i2c_set_adapdata(&zr->i2c_adapter, zr); |
845 | zr->i2c_adapter.algo_data = &zr->i2c_algo; | 845 | zr->i2c_adapter.algo_data = &zr->i2c_algo; |
846 | zr->i2c_adapter.dev.parent = &zr->pci_dev->dev; | ||
846 | return i2c_bit_add_bus(&zr->i2c_adapter); | 847 | return i2c_bit_add_bus(&zr->i2c_adapter); |
847 | } | 848 | } |
848 | 849 | ||
diff --git a/drivers/rtc/rtc-ds1672.c b/drivers/rtc/rtc-ds1672.c index 205fa28593b7..dfef1637bfb8 100644 --- a/drivers/rtc/rtc-ds1672.c +++ b/drivers/rtc/rtc-ds1672.c | |||
@@ -199,7 +199,7 @@ static int ds1672_probe(struct i2c_adapter *adapter, int address, int kind) | |||
199 | struct i2c_client *client; | 199 | struct i2c_client *client; |
200 | struct rtc_device *rtc; | 200 | struct rtc_device *rtc; |
201 | 201 | ||
202 | dev_dbg(adapter->class_dev.dev, "%s\n", __FUNCTION__); | 202 | dev_dbg(&adapter->dev, "%s\n", __FUNCTION__); |
203 | 203 | ||
204 | if (!i2c_check_functionality(adapter, I2C_FUNC_I2C)) { | 204 | if (!i2c_check_functionality(adapter, I2C_FUNC_I2C)) { |
205 | err = -ENODEV; | 205 | err = -ENODEV; |
diff --git a/drivers/rtc/rtc-pcf8563.c b/drivers/rtc/rtc-pcf8563.c index 038118bbfaea..0242d803ebe5 100644 --- a/drivers/rtc/rtc-pcf8563.c +++ b/drivers/rtc/rtc-pcf8563.c | |||
@@ -279,7 +279,7 @@ static int pcf8563_probe(struct i2c_adapter *adapter, int address, int kind) | |||
279 | 279 | ||
280 | int err = 0; | 280 | int err = 0; |
281 | 281 | ||
282 | dev_dbg(adapter->class_dev.dev, "%s\n", __FUNCTION__); | 282 | dev_dbg(&adapter->dev, "%s\n", __FUNCTION__); |
283 | 283 | ||
284 | if (!i2c_check_functionality(adapter, I2C_FUNC_I2C)) { | 284 | if (!i2c_check_functionality(adapter, I2C_FUNC_I2C)) { |
285 | err = -ENODEV; | 285 | err = -ENODEV; |
diff --git a/drivers/rtc/rtc-rs5c372.c b/drivers/rtc/rtc-rs5c372.c index e7851e3739ab..09bbe575647b 100644 --- a/drivers/rtc/rtc-rs5c372.c +++ b/drivers/rtc/rtc-rs5c372.c | |||
@@ -499,7 +499,7 @@ static int rs5c372_probe(struct i2c_adapter *adapter, int address, int kind) | |||
499 | struct rs5c372 *rs5c372; | 499 | struct rs5c372 *rs5c372; |
500 | struct rtc_time tm; | 500 | struct rtc_time tm; |
501 | 501 | ||
502 | dev_dbg(adapter->class_dev.dev, "%s\n", __FUNCTION__); | 502 | dev_dbg(&adapter->dev, "%s\n", __FUNCTION__); |
503 | 503 | ||
504 | if (!i2c_check_functionality(adapter, I2C_FUNC_I2C)) { | 504 | if (!i2c_check_functionality(adapter, I2C_FUNC_I2C)) { |
505 | err = -ENODEV; | 505 | err = -ENODEV; |
diff --git a/drivers/rtc/rtc-x1205.c b/drivers/rtc/rtc-x1205.c index 019ae255b0c8..513d1a611aab 100644 --- a/drivers/rtc/rtc-x1205.c +++ b/drivers/rtc/rtc-x1205.c | |||
@@ -506,7 +506,7 @@ static int x1205_probe(struct i2c_adapter *adapter, int address, int kind) | |||
506 | struct i2c_client *client; | 506 | struct i2c_client *client; |
507 | struct rtc_device *rtc; | 507 | struct rtc_device *rtc; |
508 | 508 | ||
509 | dev_dbg(adapter->class_dev.dev, "%s\n", __FUNCTION__); | 509 | dev_dbg(&adapter->dev, "%s\n", __FUNCTION__); |
510 | 510 | ||
511 | if (!i2c_check_functionality(adapter, I2C_FUNC_I2C)) { | 511 | if (!i2c_check_functionality(adapter, I2C_FUNC_I2C)) { |
512 | err = -ENODEV; | 512 | err = -ENODEV; |
diff --git a/drivers/video/matrox/i2c-matroxfb.c b/drivers/video/matrox/i2c-matroxfb.c index f64c4a0984cd..5ec718a5fe22 100644 --- a/drivers/video/matrox/i2c-matroxfb.c +++ b/drivers/video/matrox/i2c-matroxfb.c | |||
@@ -115,6 +115,7 @@ static int i2c_bus_reg(struct i2c_bit_adapter* b, struct matrox_fb_info* minfo, | |||
115 | minfo->fbcon.node); | 115 | minfo->fbcon.node); |
116 | i2c_set_adapdata(&b->adapter, b); | 116 | i2c_set_adapdata(&b->adapter, b); |
117 | b->adapter.algo_data = &b->bac; | 117 | b->adapter.algo_data = &b->bac; |
118 | b->adapter.dev.parent = &ACCESS_FBINFO(pcidev)->dev; | ||
118 | b->bac = matrox_i2c_algo_template; | 119 | b->bac = matrox_i2c_algo_template; |
119 | b->bac.data = b; | 120 | b->bac.data = b; |
120 | err = i2c_bit_add_bus(&b->adapter); | 121 | err = i2c_bit_add_bus(&b->adapter); |