diff options
| -rw-r--r-- | drivers/i2c/busses/i2c-pca-isa.c | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/drivers/i2c/busses/i2c-pca-isa.c b/drivers/i2c/busses/i2c-pca-isa.c index a119784bae10..f80df9ae5054 100644 --- a/drivers/i2c/busses/i2c-pca-isa.c +++ b/drivers/i2c/busses/i2c-pca-isa.c | |||
| @@ -36,8 +36,8 @@ | |||
| 36 | #define DRIVER "i2c-pca-isa" | 36 | #define DRIVER "i2c-pca-isa" |
| 37 | #define IO_SIZE 4 | 37 | #define IO_SIZE 4 |
| 38 | 38 | ||
| 39 | static unsigned long base = 0x330; | 39 | static unsigned long base; |
| 40 | static int irq = 10; | 40 | static int irq = -1; |
| 41 | 41 | ||
| 42 | /* Data sheet recommends 59kHz for 100kHz operation due to variation | 42 | /* Data sheet recommends 59kHz for 100kHz operation due to variation |
| 43 | * in the actual clock rate */ | 43 | * in the actual clock rate */ |
| @@ -107,6 +107,19 @@ static struct i2c_adapter pca_isa_ops = { | |||
| 107 | .timeout = 100, | 107 | .timeout = 100, |
| 108 | }; | 108 | }; |
| 109 | 109 | ||
| 110 | static int __devinit pca_isa_match(struct device *dev, unsigned int id) | ||
| 111 | { | ||
| 112 | int match = base != 0; | ||
| 113 | |||
| 114 | if (match) { | ||
| 115 | if (irq <= -1) | ||
| 116 | dev_warn(dev, "Using polling mode (specify irq)\n"); | ||
| 117 | } else | ||
| 118 | dev_err(dev, "Please specify I/O base\n"); | ||
| 119 | |||
| 120 | return match; | ||
| 121 | } | ||
| 122 | |||
| 110 | static int __devinit pca_isa_probe(struct device *dev, unsigned int id) | 123 | static int __devinit pca_isa_probe(struct device *dev, unsigned int id) |
| 111 | { | 124 | { |
| 112 | init_waitqueue_head(&pca_wait); | 125 | init_waitqueue_head(&pca_wait); |
| @@ -153,7 +166,7 @@ static int __devexit pca_isa_remove(struct device *dev, unsigned int id) | |||
| 153 | { | 166 | { |
| 154 | i2c_del_adapter(&pca_isa_ops); | 167 | i2c_del_adapter(&pca_isa_ops); |
| 155 | 168 | ||
| 156 | if (irq > 0) { | 169 | if (irq > -1) { |
| 157 | disable_irq(irq); | 170 | disable_irq(irq); |
| 158 | free_irq(irq, &pca_isa_ops); | 171 | free_irq(irq, &pca_isa_ops); |
| 159 | } | 172 | } |
| @@ -163,6 +176,7 @@ static int __devexit pca_isa_remove(struct device *dev, unsigned int id) | |||
| 163 | } | 176 | } |
| 164 | 177 | ||
| 165 | static struct isa_driver pca_isa_driver = { | 178 | static struct isa_driver pca_isa_driver = { |
| 179 | .match = pca_isa_match, | ||
| 166 | .probe = pca_isa_probe, | 180 | .probe = pca_isa_probe, |
| 167 | .remove = __devexit_p(pca_isa_remove), | 181 | .remove = __devexit_p(pca_isa_remove), |
| 168 | .driver = { | 182 | .driver = { |
