aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c/algos/i2c-algo-pca.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/i2c/algos/i2c-algo-pca.c')
-rw-r--r--drivers/i2c/algos/i2c-algo-pca.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/drivers/i2c/algos/i2c-algo-pca.c b/drivers/i2c/algos/i2c-algo-pca.c
index 6f5f98d69af7..f892a424009b 100644
--- a/drivers/i2c/algos/i2c-algo-pca.c
+++ b/drivers/i2c/algos/i2c-algo-pca.c
@@ -46,14 +46,19 @@ static int i2c_debug;
46#define pca_set_con(adap, val) pca_outw(adap, I2C_PCA_CON, val) 46#define pca_set_con(adap, val) pca_outw(adap, I2C_PCA_CON, val)
47#define pca_get_con(adap) pca_inw(adap, I2C_PCA_CON) 47#define pca_get_con(adap) pca_inw(adap, I2C_PCA_CON)
48#define pca_wait(adap) adap->wait_for_completion(adap->data) 48#define pca_wait(adap) adap->wait_for_completion(adap->data)
49#define pca_reset(adap) adap->reset_chip(adap->data)
50 49
51static void pca9665_reset(void *pd) 50static void pca_reset(struct i2c_algo_pca_data *adap)
52{ 51{
53 struct i2c_algo_pca_data *adap = pd; 52 if (adap->chip == I2C_PCA_CHIP_9665) {
54 pca_outw(adap, I2C_PCA_INDPTR, I2C_PCA_IPRESET); 53 /* Ignore the reset function from the module,
55 pca_outw(adap, I2C_PCA_IND, 0xA5); 54 * we can use the parallel bus reset.
56 pca_outw(adap, I2C_PCA_IND, 0x5A); 55 */
56 pca_outw(adap, I2C_PCA_INDPTR, I2C_PCA_IPRESET);
57 pca_outw(adap, I2C_PCA_IND, 0xA5);
58 pca_outw(adap, I2C_PCA_IND, 0x5A);
59 } else {
60 adap->reset_chip(adap->data);
61 }
57} 62}
58 63
59/* 64/*
@@ -378,11 +383,12 @@ static unsigned int pca_probe_chip(struct i2c_adapter *adap)
378 pca_outw(pca_data, I2C_PCA_INDPTR, I2C_PCA_IADR); 383 pca_outw(pca_data, I2C_PCA_INDPTR, I2C_PCA_IADR);
379 if (pca_inw(pca_data, I2C_PCA_IND) == 0xAA) { 384 if (pca_inw(pca_data, I2C_PCA_IND) == 0xAA) {
380 printk(KERN_INFO "%s: PCA9665 detected.\n", adap->name); 385 printk(KERN_INFO "%s: PCA9665 detected.\n", adap->name);
381 return I2C_PCA_CHIP_9665; 386 pca_data->chip = I2C_PCA_CHIP_9665;
382 } else { 387 } else {
383 printk(KERN_INFO "%s: PCA9564 detected.\n", adap->name); 388 printk(KERN_INFO "%s: PCA9564 detected.\n", adap->name);
384 return I2C_PCA_CHIP_9564; 389 pca_data->chip = I2C_PCA_CHIP_9564;
385 } 390 }
391 return pca_data->chip;
386} 392}
387 393
388static int pca_init(struct i2c_adapter *adap) 394static int pca_init(struct i2c_adapter *adap)
@@ -456,11 +462,6 @@ static int pca_init(struct i2c_adapter *adap)
456 */ 462 */
457 int raise_fall_time; 463 int raise_fall_time;
458 464
459 /* Ignore the reset function from the module,
460 * we can use the parallel bus reset
461 */
462 pca_data->reset_chip = pca9665_reset;
463
464 if (pca_data->i2c_clock > 1265800) { 465 if (pca_data->i2c_clock > 1265800) {
465 printk(KERN_WARNING "%s: I2C clock speed too high." 466 printk(KERN_WARNING "%s: I2C clock speed too high."
466 " Using 1265.8kHz.\n", adap->name); 467 " Using 1265.8kHz.\n", adap->name);