diff options
author | Geert Uytterhoeven <geert+renesas@glider.be> | 2015-02-05 10:49:09 -0500 |
---|---|---|
committer | Linus Walleij <linus.walleij@linaro.org> | 2015-03-04 07:50:46 -0500 |
commit | b80eef95beb04760629822fa130aeed54cdfafca (patch) | |
tree | 5f85930eeef54094193cebd575640b42aeb2d621 | |
parent | a39294bdf4b03803156c771968a6e2ba6ebb505b (diff) |
gpio: pcf857x: Propagate wake-up setting to parent irq controller
The pcf857x GPIO and interrupt controller uses dummy_irq_chip, which
does not implement irq_chip.irq_set_wake() and does not set
IRQCHIP_SKIP_SET_WAKE.
This causes two s2ram issues if wake-up is enabled for the pcf857x GPIO
pins:
1. During resume from s2ram, the following warning is printed:
WARNING: CPU: 0 PID: 1046 at kernel/irq/manage.c:537 irq_set_irq_wake+0x9c/0xf8()
Unbalanced IRQ 113 wake disable
2. Wake-up through the pcf857x GPIO pins may fail, as the parent
interrupt controller may be suspended.
Migrate the pcf857x GPIO and interrupt controller from dummy_irq_chip to
its own irq_chip. This irq chip implements irq_chip.irq_set_wake() to
propagate its wake-up setting to the parent interrupt controller.
This fixes wake-up through gpio-keys on sh73a0/kzm9g, where the pcf857x
interrupt is cascaded to irq-renesas-intc-irqpin, and the latter must
not be suspended when wake-up is enabled.
Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
-rw-r--r-- | drivers/gpio/gpio-pcf857x.c | 37 |
1 files changed, 34 insertions, 3 deletions
diff --git a/drivers/gpio/gpio-pcf857x.c b/drivers/gpio/gpio-pcf857x.c index 126c93732101..945f0cda8529 100644 --- a/drivers/gpio/gpio-pcf857x.c +++ b/drivers/gpio/gpio-pcf857x.c | |||
@@ -204,6 +204,36 @@ static irqreturn_t pcf857x_irq(int irq, void *data) | |||
204 | return IRQ_HANDLED; | 204 | return IRQ_HANDLED; |
205 | } | 205 | } |
206 | 206 | ||
207 | /* | ||
208 | * NOP functions | ||
209 | */ | ||
210 | static void noop(struct irq_data *data) { } | ||
211 | |||
212 | static unsigned int noop_ret(struct irq_data *data) | ||
213 | { | ||
214 | return 0; | ||
215 | } | ||
216 | |||
217 | static int pcf857x_irq_set_wake(struct irq_data *data, unsigned int on) | ||
218 | { | ||
219 | struct pcf857x *gpio = irq_data_get_irq_chip_data(data); | ||
220 | |||
221 | irq_set_irq_wake(gpio->client->irq, on); | ||
222 | return 0; | ||
223 | } | ||
224 | |||
225 | static struct irq_chip pcf857x_irq_chip = { | ||
226 | .name = "pcf857x", | ||
227 | .irq_startup = noop_ret, | ||
228 | .irq_shutdown = noop, | ||
229 | .irq_enable = noop, | ||
230 | .irq_disable = noop, | ||
231 | .irq_ack = noop, | ||
232 | .irq_mask = noop, | ||
233 | .irq_unmask = noop, | ||
234 | .irq_set_wake = pcf857x_irq_set_wake, | ||
235 | }; | ||
236 | |||
207 | /*-------------------------------------------------------------------------*/ | 237 | /*-------------------------------------------------------------------------*/ |
208 | 238 | ||
209 | static int pcf857x_probe(struct i2c_client *client, | 239 | static int pcf857x_probe(struct i2c_client *client, |
@@ -317,8 +347,9 @@ static int pcf857x_probe(struct i2c_client *client, | |||
317 | 347 | ||
318 | /* Enable irqchip if we have an interrupt */ | 348 | /* Enable irqchip if we have an interrupt */ |
319 | if (client->irq) { | 349 | if (client->irq) { |
320 | status = gpiochip_irqchip_add(&gpio->chip, &dummy_irq_chip, 0, | 350 | status = gpiochip_irqchip_add(&gpio->chip, &pcf857x_irq_chip, |
321 | handle_level_irq, IRQ_TYPE_NONE); | 351 | 0, handle_level_irq, |
352 | IRQ_TYPE_NONE); | ||
322 | if (status) { | 353 | if (status) { |
323 | dev_err(&client->dev, "cannot add irqchip\n"); | 354 | dev_err(&client->dev, "cannot add irqchip\n"); |
324 | goto fail_irq; | 355 | goto fail_irq; |
@@ -331,7 +362,7 @@ static int pcf857x_probe(struct i2c_client *client, | |||
331 | if (status) | 362 | if (status) |
332 | goto fail_irq; | 363 | goto fail_irq; |
333 | 364 | ||
334 | gpiochip_set_chained_irqchip(&gpio->chip, &dummy_irq_chip, | 365 | gpiochip_set_chained_irqchip(&gpio->chip, &pcf857x_irq_chip, |
335 | client->irq, NULL); | 366 | client->irq, NULL); |
336 | } | 367 | } |
337 | 368 | ||