From: Dmitry Torokhov <dmitry.torokhov@gmail.com> To: Pavel Machek <pavel@ucw.cz> Cc: Eric Miao <eric.y.miao@gmail.com>, rpurdie@rpsys.net, lenz@cs.wisc.edu, kernel list <linux-kernel@vger.kernel.org>, Dirk@opfer-online.de, arminlitzel@web.de, Cyril Hrubis <metan@ucw.cz>, thommycheck@gmail.com, linux-arm-kernel <linux-arm-kernel@lists.infradead.org>, dbaryshkov@gmail.com, omegamoon@gmail.com, utx@penguin.cz, linux-input@vger.kernel.org, "Rafael J. Wysocki" <rjw@sisk.pl> Subject: Re: 32-rc1 aka 32-rc2: warning at manage.c:361 (set_irq_wake), matrix-keypad related? Date: Wed, 2 Dec 2009 19:17:09 -0800 [thread overview] Message-ID: <20091203031709.GE9121@core.coreip.homeip.net> (raw) In-Reply-To: <20091007211225.GB17805@elf.ucw.cz> On Wed, Oct 07, 2009 at 11:12:26PM +0200, Pavel Machek wrote: > > > > > OK, so it looks like your box refuses to set up one of the GPIOs as a > > > > wakeup source... Hmm, either your box is wrong ;) or matrix_keypad > > > > driver needs to maintain a separate list of wakeup GPIOs. > > > > > > > > > > This is due to the nature of PXA processor, where not every GPIO can > > > be configured as a wakeup source. Mmm.... we can either return a > > > pseudo value indicating setting wakeup on that GPIO is OK (which > > > doesn't sound like a good idea), or we can just ignore the failure of > > > enable_irq_wake() in matrix_keypad? > > > > We ignore the failure right now in the mainline but that causes stack > > traces on resume as we trying to disable not enabled wakeup GPIOs. That > > was original Pavel's complaint. > > Yep... > > I'd say that BUG() simply should not trigger if wakeup can not be > enabled/disabled for particular source...? Pavel, Could you please try the patch below and let me know if it fixes the problem for you? Thanks. -- Dmitry Input: matrix-keypad - handle cases when GPIOs can't be wakeup sources From: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru> --- drivers/input/keyboard/matrix_keypad.c | 29 ++++++++++++++++++++++------- 1 files changed, 22 insertions(+), 7 deletions(-) diff --git a/drivers/input/keyboard/matrix_keypad.c b/drivers/input/keyboard/matrix_keypad.c index 91cfe51..a1152ba 100644 --- a/drivers/input/keyboard/matrix_keypad.c +++ b/drivers/input/keyboard/matrix_keypad.c @@ -29,11 +29,13 @@ struct matrix_keypad { unsigned short *keycodes; unsigned int row_shift; + DECLARE_BITMAP(disabled_gpios, MATRIX_MAX_ROWS); + uint32_t last_key_state[MATRIX_MAX_COLS]; struct delayed_work work; + spinlock_t lock; bool scan_pending; bool stopped; - spinlock_t lock; }; /* @@ -221,9 +223,16 @@ static int matrix_keypad_suspend(struct platform_device *pdev, pm_message_t stat matrix_keypad_stop(keypad->input_dev); - if (device_may_wakeup(&pdev->dev)) - for (i = 0; i < pdata->num_row_gpios; i++) - enable_irq_wake(gpio_to_irq(pdata->row_gpios[i])); + if (device_may_wakeup(&pdev->dev)) { + for (i = 0; i < pdata->num_row_gpios; i++) { + if (!test_bit(i, keypad->disabled_gpios)) { + unsigned int gpio = pdata->row_gpios[i]; + + if (enable_irq_wake(gpio_to_irq(gpio)) == 0) + __set_bit(i, keypad->disabled_gpios); + } + } + } return 0; } @@ -234,9 +243,15 @@ static int matrix_keypad_resume(struct platform_device *pdev) const struct matrix_keypad_platform_data *pdata = keypad->pdata; int i; - if (device_may_wakeup(&pdev->dev)) - for (i = 0; i < pdata->num_row_gpios; i++) - disable_irq_wake(gpio_to_irq(pdata->row_gpios[i])); + if (device_may_wakeup(&pdev->dev)) { + for (i = 0; i < pdata->num_row_gpios; i++) { + if (test_and_clear_bit(i, keypad->disabled_gpios)) { + unsigned int gpio = pdata->row_gpios[i]; + + disable_irq_wake(gpio_to_irq(gpio)); + } + } + } matrix_keypad_start(keypad->input_dev);
WARNING: multiple messages have this Message-ID (diff)
From: dmitry.torokhov@gmail.com (Dmitry Torokhov) To: linux-arm-kernel@lists.infradead.org Subject: 32-rc1 aka 32-rc2: warning at manage.c:361 (set_irq_wake), matrix-keypad related? Date: Wed, 2 Dec 2009 19:17:09 -0800 [thread overview] Message-ID: <20091203031709.GE9121@core.coreip.homeip.net> (raw) In-Reply-To: <20091007211225.GB17805@elf.ucw.cz> On Wed, Oct 07, 2009 at 11:12:26PM +0200, Pavel Machek wrote: > > > > > OK, so it looks like your box refuses to set up one of the GPIOs as a > > > > wakeup source... Hmm, either your box is wrong ;) or matrix_keypad > > > > driver needs to maintain a separate list of wakeup GPIOs. > > > > > > > > > > This is due to the nature of PXA processor, where not every GPIO can > > > be configured as a wakeup source. Mmm.... we can either return a > > > pseudo value indicating setting wakeup on that GPIO is OK (which > > > doesn't sound like a good idea), or we can just ignore the failure of > > > enable_irq_wake() in matrix_keypad? > > > > We ignore the failure right now in the mainline but that causes stack > > traces on resume as we trying to disable not enabled wakeup GPIOs. That > > was original Pavel's complaint. > > Yep... > > I'd say that BUG() simply should not trigger if wakeup can not be > enabled/disabled for particular source...? Pavel, Could you please try the patch below and let me know if it fixes the problem for you? Thanks. -- Dmitry Input: matrix-keypad - handle cases when GPIOs can't be wakeup sources From: Dmitry Torokhov <dmitry.torokhov@gmail.com> Signed-off-by: Dmitry Torokhov <dtor@mail.ru> --- drivers/input/keyboard/matrix_keypad.c | 29 ++++++++++++++++++++++------- 1 files changed, 22 insertions(+), 7 deletions(-) diff --git a/drivers/input/keyboard/matrix_keypad.c b/drivers/input/keyboard/matrix_keypad.c index 91cfe51..a1152ba 100644 --- a/drivers/input/keyboard/matrix_keypad.c +++ b/drivers/input/keyboard/matrix_keypad.c @@ -29,11 +29,13 @@ struct matrix_keypad { unsigned short *keycodes; unsigned int row_shift; + DECLARE_BITMAP(disabled_gpios, MATRIX_MAX_ROWS); + uint32_t last_key_state[MATRIX_MAX_COLS]; struct delayed_work work; + spinlock_t lock; bool scan_pending; bool stopped; - spinlock_t lock; }; /* @@ -221,9 +223,16 @@ static int matrix_keypad_suspend(struct platform_device *pdev, pm_message_t stat matrix_keypad_stop(keypad->input_dev); - if (device_may_wakeup(&pdev->dev)) - for (i = 0; i < pdata->num_row_gpios; i++) - enable_irq_wake(gpio_to_irq(pdata->row_gpios[i])); + if (device_may_wakeup(&pdev->dev)) { + for (i = 0; i < pdata->num_row_gpios; i++) { + if (!test_bit(i, keypad->disabled_gpios)) { + unsigned int gpio = pdata->row_gpios[i]; + + if (enable_irq_wake(gpio_to_irq(gpio)) == 0) + __set_bit(i, keypad->disabled_gpios); + } + } + } return 0; } @@ -234,9 +243,15 @@ static int matrix_keypad_resume(struct platform_device *pdev) const struct matrix_keypad_platform_data *pdata = keypad->pdata; int i; - if (device_may_wakeup(&pdev->dev)) - for (i = 0; i < pdata->num_row_gpios; i++) - disable_irq_wake(gpio_to_irq(pdata->row_gpios[i])); + if (device_may_wakeup(&pdev->dev)) { + for (i = 0; i < pdata->num_row_gpios; i++) { + if (test_and_clear_bit(i, keypad->disabled_gpios)) { + unsigned int gpio = pdata->row_gpios[i]; + + disable_irq_wake(gpio_to_irq(gpio)); + } + } + } matrix_keypad_start(keypad->input_dev);
next prev parent reply other threads:[~2009-12-03 3:17 UTC|newest] Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top 2009-09-30 20:07 32-rc1 aka 32-rc2: warning at manage.c:361 (set_irq_wake), matrix-keypad related? Pavel Machek 2009-09-30 20:07 ` Pavel Machek 2009-09-30 20:07 ` Pavel Machek 2009-10-06 5:06 ` Dmitry Torokhov 2009-10-06 5:06 ` Dmitry Torokhov 2009-10-06 5:06 ` Dmitry Torokhov 2009-10-06 7:58 ` Pavel Machek 2009-10-06 7:58 ` Pavel Machek 2009-10-07 4:36 ` Dmitry Torokhov 2009-10-07 4:36 ` Dmitry Torokhov 2009-10-07 4:36 ` Dmitry Torokhov 2009-10-07 14:42 ` Eric Miao 2009-10-07 14:42 ` Eric Miao 2009-10-07 14:42 ` Eric Miao 2009-10-07 16:33 ` Dmitry Torokhov 2009-10-07 16:33 ` Dmitry Torokhov 2009-10-07 16:33 ` Dmitry Torokhov 2009-10-07 21:12 ` Pavel Machek 2009-10-07 21:12 ` Pavel Machek 2009-10-07 21:12 ` Pavel Machek 2009-12-03 3:17 ` Dmitry Torokhov [this message] 2009-12-03 3:17 ` Dmitry Torokhov 2010-01-02 13:56 ` Pavel Machek 2010-01-02 13:56 ` Pavel Machek 2010-01-02 15:27 ` Pavel Machek 2010-01-02 15:27 ` Pavel Machek 2010-01-02 21:06 ` Pavel Machek 2010-01-02 21:06 ` Pavel Machek 2010-01-03 7:57 ` Dmitry Torokhov 2010-01-03 7:57 ` Dmitry Torokhov 2010-01-03 8:00 ` Pavel Machek 2010-01-03 8:00 ` Pavel Machek
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20091203031709.GE9121@core.coreip.homeip.net \ --to=dmitry.torokhov@gmail.com \ --cc=Dirk@opfer-online.de \ --cc=arminlitzel@web.de \ --cc=dbaryshkov@gmail.com \ --cc=eric.y.miao@gmail.com \ --cc=lenz@cs.wisc.edu \ --cc=linux-arm-kernel@lists.infradead.org \ --cc=linux-input@vger.kernel.org \ --cc=linux-kernel@vger.kernel.org \ --cc=metan@ucw.cz \ --cc=omegamoon@gmail.com \ --cc=pavel@ucw.cz \ --cc=rjw@sisk.pl \ --cc=rpurdie@rpsys.net \ --cc=thommycheck@gmail.com \ --cc=utx@penguin.cz \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.