diff options
| author | Wolfram Sang <w.sang@pengutronix.de> | 2009-03-28 16:34:45 -0400 |
|---|---|---|
| committer | Jean Delvare <khali@linux-fr.org> | 2009-03-28 16:34:45 -0400 |
| commit | 6b110d13aacc9c4ef5f01af12a5e2b7f1d23f106 (patch) | |
| tree | b4706343f7ddf73c803225e2f952a57216a2bedf | |
| parent | 2378bc09b91b0702fac7823828a614fd8016a29f (diff) | |
i2c-pca-platform: Use defaults if no platform_data given
Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
| -rw-r--r-- | drivers/i2c/busses/i2c-pca-platform.c | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/drivers/i2c/busses/i2c-pca-platform.c b/drivers/i2c/busses/i2c-pca-platform.c index df5e593a1d76..7b23891b7d59 100644 --- a/drivers/i2c/busses/i2c-pca-platform.c +++ b/drivers/i2c/busses/i2c-pca-platform.c | |||
| @@ -177,10 +177,20 @@ static int __devinit i2c_pca_pf_probe(struct platform_device *pdev) | |||
| 177 | (unsigned long) res->start); | 177 | (unsigned long) res->start); |
| 178 | i2c->adap.algo_data = &i2c->algo_data; | 178 | i2c->adap.algo_data = &i2c->algo_data; |
| 179 | i2c->adap.dev.parent = &pdev->dev; | 179 | i2c->adap.dev.parent = &pdev->dev; |
| 180 | i2c->adap.timeout = platform_data->timeout; | ||
| 181 | 180 | ||
| 182 | i2c->algo_data.i2c_clock = platform_data->i2c_clock_speed; | 181 | if (platform_data) { |
| 182 | i2c->adap.timeout = platform_data->timeout; | ||
| 183 | i2c->algo_data.i2c_clock = platform_data->i2c_clock_speed; | ||
| 184 | i2c->gpio = platform_data->gpio; | ||
| 185 | } else { | ||
| 186 | i2c->adap.timeout = HZ; | ||
| 187 | i2c->algo_data.i2c_clock = 59000; | ||
| 188 | i2c->gpio = -1; | ||
| 189 | } | ||
| 190 | |||
| 183 | i2c->algo_data.data = i2c; | 191 | i2c->algo_data.data = i2c; |
| 192 | i2c->algo_data.wait_for_completion = i2c_pca_pf_waitforcompletion; | ||
| 193 | i2c->algo_data.reset_chip = i2c_pca_pf_dummyreset; | ||
| 184 | 194 | ||
| 185 | switch (res->flags & IORESOURCE_MEM_TYPE_MASK) { | 195 | switch (res->flags & IORESOURCE_MEM_TYPE_MASK) { |
| 186 | case IORESOURCE_MEM_32BIT: | 196 | case IORESOURCE_MEM_32BIT: |
| @@ -198,11 +208,6 @@ static int __devinit i2c_pca_pf_probe(struct platform_device *pdev) | |||
| 198 | break; | 208 | break; |
| 199 | } | 209 | } |
| 200 | 210 | ||
| 201 | i2c->algo_data.wait_for_completion = i2c_pca_pf_waitforcompletion; | ||
| 202 | |||
| 203 | i2c->gpio = platform_data->gpio; | ||
| 204 | i2c->algo_data.reset_chip = i2c_pca_pf_dummyreset; | ||
| 205 | |||
| 206 | /* Use gpio_is_valid() when in mainline */ | 211 | /* Use gpio_is_valid() when in mainline */ |
| 207 | if (i2c->gpio > -1) { | 212 | if (i2c->gpio > -1) { |
| 208 | ret = gpio_request(i2c->gpio, i2c->adap.name); | 213 | ret = gpio_request(i2c->gpio, i2c->adap.name); |
