diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2012-12-06 04:10:28 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2012-12-07 03:16:12 -0500 |
commit | 805f864ebefc39065b6b0cf2548f13c2fbf888d9 (patch) | |
tree | 08250172d9e0685eea2f1d728a0f4a236acb88bd | |
parent | 86605cfe8c7c166999bc7476b17940c68bf2f8b7 (diff) |
gpio: pcf857x: use client->irq for gpio_to_irq()
6e20a0a429bd4dc07d6de16d9c247270e04e4aa0
(gpio: pcf857x: enable gpio_to_irq() support)
added gpio_to_irq() support on pcf857x driver,
but it used pdata->irq.
This patch modifies driver to use client->irq instead of it.
It modifies kzm9g board platform settings,
and device probe information too.
This patch is tested on kzm9g board
Reported-by: Christian Engelmayer <christian.engelmayer@frequentis.com>
Acked-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r-- | arch/arm/mach-shmobile/board-kzm9g.c | 2 | ||||
-rw-r--r-- | drivers/gpio/gpio-pcf857x.c | 29 | ||||
-rw-r--r-- | include/linux/i2c/pcf857x.h | 3 |
3 files changed, 12 insertions, 22 deletions
diff --git a/arch/arm/mach-shmobile/board-kzm9g.c b/arch/arm/mach-shmobile/board-kzm9g.c index 0a43f3189c21..7a05de794a8c 100644 --- a/arch/arm/mach-shmobile/board-kzm9g.c +++ b/arch/arm/mach-shmobile/board-kzm9g.c | |||
@@ -548,7 +548,6 @@ static struct platform_device fsi_ak4648_device = { | |||
548 | /* I2C */ | 548 | /* I2C */ |
549 | static struct pcf857x_platform_data pcf8575_pdata = { | 549 | static struct pcf857x_platform_data pcf8575_pdata = { |
550 | .gpio_base = GPIO_PCF8575_BASE, | 550 | .gpio_base = GPIO_PCF8575_BASE, |
551 | .irq = intcs_evt2irq(0x3260), /* IRQ19 */ | ||
552 | }; | 551 | }; |
553 | 552 | ||
554 | static struct i2c_board_info i2c0_devices[] = { | 553 | static struct i2c_board_info i2c0_devices[] = { |
@@ -570,6 +569,7 @@ static struct i2c_board_info i2c1_devices[] = { | |||
570 | static struct i2c_board_info i2c3_devices[] = { | 569 | static struct i2c_board_info i2c3_devices[] = { |
571 | { | 570 | { |
572 | I2C_BOARD_INFO("pcf8575", 0x20), | 571 | I2C_BOARD_INFO("pcf8575", 0x20), |
572 | .irq = intcs_evt2irq(0x3260), /* IRQ19 */ | ||
573 | .platform_data = &pcf8575_pdata, | 573 | .platform_data = &pcf8575_pdata, |
574 | }, | 574 | }, |
575 | }; | 575 | }; |
diff --git a/drivers/gpio/gpio-pcf857x.c b/drivers/gpio/gpio-pcf857x.c index 16af35cd2b10..a19b7457a726 100644 --- a/drivers/gpio/gpio-pcf857x.c +++ b/drivers/gpio/gpio-pcf857x.c | |||
@@ -223,11 +223,11 @@ static void pcf857x_irq_domain_cleanup(struct pcf857x *gpio) | |||
223 | 223 | ||
224 | static int pcf857x_irq_domain_init(struct pcf857x *gpio, | 224 | static int pcf857x_irq_domain_init(struct pcf857x *gpio, |
225 | struct pcf857x_platform_data *pdata, | 225 | struct pcf857x_platform_data *pdata, |
226 | struct device *dev) | 226 | struct i2c_client *client) |
227 | { | 227 | { |
228 | int status; | 228 | int status; |
229 | 229 | ||
230 | gpio->irq_domain = irq_domain_add_linear(dev->of_node, | 230 | gpio->irq_domain = irq_domain_add_linear(client->dev.of_node, |
231 | gpio->chip.ngpio, | 231 | gpio->chip.ngpio, |
232 | &pcf857x_irq_domain_ops, | 232 | &pcf857x_irq_domain_ops, |
233 | NULL); | 233 | NULL); |
@@ -235,15 +235,15 @@ static int pcf857x_irq_domain_init(struct pcf857x *gpio, | |||
235 | goto fail; | 235 | goto fail; |
236 | 236 | ||
237 | /* enable real irq */ | 237 | /* enable real irq */ |
238 | status = request_irq(pdata->irq, pcf857x_irq_demux, 0, | 238 | status = request_irq(client->irq, pcf857x_irq_demux, 0, |
239 | dev_name(dev), gpio); | 239 | dev_name(&client->dev), gpio); |
240 | if (status) | 240 | if (status) |
241 | goto fail; | 241 | goto fail; |
242 | 242 | ||
243 | /* enable gpio_to_irq() */ | 243 | /* enable gpio_to_irq() */ |
244 | INIT_WORK(&gpio->work, pcf857x_irq_demux_work); | 244 | INIT_WORK(&gpio->work, pcf857x_irq_demux_work); |
245 | gpio->chip.to_irq = pcf857x_to_irq; | 245 | gpio->chip.to_irq = pcf857x_to_irq; |
246 | gpio->irq = pdata->irq; | 246 | gpio->irq = client->irq; |
247 | 247 | ||
248 | return 0; | 248 | return 0; |
249 | 249 | ||
@@ -285,8 +285,8 @@ static int pcf857x_probe(struct i2c_client *client, | |||
285 | gpio->chip.ngpio = id->driver_data; | 285 | gpio->chip.ngpio = id->driver_data; |
286 | 286 | ||
287 | /* enable gpio_to_irq() if platform has settings */ | 287 | /* enable gpio_to_irq() if platform has settings */ |
288 | if (pdata && pdata->irq) { | 288 | if (pdata && client->irq) { |
289 | status = pcf857x_irq_domain_init(gpio, pdata, &client->dev); | 289 | status = pcf857x_irq_domain_init(gpio, pdata, client); |
290 | if (status < 0) { | 290 | if (status < 0) { |
291 | dev_err(&client->dev, "irq_domain init failed\n"); | 291 | dev_err(&client->dev, "irq_domain init failed\n"); |
292 | goto fail; | 292 | goto fail; |
@@ -368,15 +368,6 @@ static int pcf857x_probe(struct i2c_client *client, | |||
368 | if (status < 0) | 368 | if (status < 0) |
369 | goto fail; | 369 | goto fail; |
370 | 370 | ||
371 | /* NOTE: these chips can issue "some pin-changed" IRQs, which we | ||
372 | * don't yet even try to use. Among other issues, the relevant | ||
373 | * genirq state isn't available to modular drivers; and most irq | ||
374 | * methods can't be called from sleeping contexts. | ||
375 | */ | ||
376 | |||
377 | dev_info(&client->dev, "%s\n", | ||
378 | client->irq ? " (irq ignored)" : ""); | ||
379 | |||
380 | /* Let platform code set up the GPIOs and their users. | 371 | /* Let platform code set up the GPIOs and their users. |
381 | * Now is the first time anyone could use them. | 372 | * Now is the first time anyone could use them. |
382 | */ | 373 | */ |
@@ -388,13 +379,15 @@ static int pcf857x_probe(struct i2c_client *client, | |||
388 | dev_warn(&client->dev, "setup --> %d\n", status); | 379 | dev_warn(&client->dev, "setup --> %d\n", status); |
389 | } | 380 | } |
390 | 381 | ||
382 | dev_info(&client->dev, "probed\n"); | ||
383 | |||
391 | return 0; | 384 | return 0; |
392 | 385 | ||
393 | fail: | 386 | fail: |
394 | dev_dbg(&client->dev, "probe error %d for '%s'\n", | 387 | dev_dbg(&client->dev, "probe error %d for '%s'\n", |
395 | status, client->name); | 388 | status, client->name); |
396 | 389 | ||
397 | if (pdata && pdata->irq) | 390 | if (pdata && client->irq) |
398 | pcf857x_irq_domain_cleanup(gpio); | 391 | pcf857x_irq_domain_cleanup(gpio); |
399 | 392 | ||
400 | kfree(gpio); | 393 | kfree(gpio); |
@@ -418,7 +411,7 @@ static int pcf857x_remove(struct i2c_client *client) | |||
418 | } | 411 | } |
419 | } | 412 | } |
420 | 413 | ||
421 | if (pdata && pdata->irq) | 414 | if (pdata && client->irq) |
422 | pcf857x_irq_domain_cleanup(gpio); | 415 | pcf857x_irq_domain_cleanup(gpio); |
423 | 416 | ||
424 | status = gpiochip_remove(&gpio->chip); | 417 | status = gpiochip_remove(&gpio->chip); |
diff --git a/include/linux/i2c/pcf857x.h b/include/linux/i2c/pcf857x.h index 781e6bd06c34..0767a2a6b2f1 100644 --- a/include/linux/i2c/pcf857x.h +++ b/include/linux/i2c/pcf857x.h | |||
@@ -10,7 +10,6 @@ | |||
10 | * @setup: optional callback issued once the GPIOs are valid | 10 | * @setup: optional callback issued once the GPIOs are valid |
11 | * @teardown: optional callback issued before the GPIOs are invalidated | 11 | * @teardown: optional callback issued before the GPIOs are invalidated |
12 | * @context: optional parameter passed to setup() and teardown() | 12 | * @context: optional parameter passed to setup() and teardown() |
13 | * @irq: optional interrupt number | ||
14 | * | 13 | * |
15 | * In addition to the I2C_BOARD_INFO() state appropriate to each chip, | 14 | * In addition to the I2C_BOARD_INFO() state appropriate to each chip, |
16 | * the i2c_board_info used with the pcf875x driver must provide its | 15 | * the i2c_board_info used with the pcf875x driver must provide its |
@@ -40,8 +39,6 @@ struct pcf857x_platform_data { | |||
40 | int gpio, unsigned ngpio, | 39 | int gpio, unsigned ngpio, |
41 | void *context); | 40 | void *context); |
42 | void *context; | 41 | void *context; |
43 | |||
44 | int irq; | ||
45 | }; | 42 | }; |
46 | 43 | ||
47 | #endif /* __LINUX_PCF857X_H */ | 44 | #endif /* __LINUX_PCF857X_H */ |