From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dmitry Torokhov 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 Message-ID: <20091203031709.GE9121@core.coreip.homeip.net> References: <20090930200746.GA1384@ucw.cz> <20091006050649.GH27881@core.coreip.homeip.net> <20091006075816.GA1362@ucw.cz> <20091007043603.GC10204@core.coreip.homeip.net> <20091007163327.GA12053@core.coreip.homeip.net> <20091007211225.GB17805@elf.ucw.cz> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mail-pw0-f42.google.com ([209.85.160.42]:49793 "EHLO mail-pw0-f42.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752914AbZLCDRI (ORCPT ); Wed, 2 Dec 2009 22:17:08 -0500 Content-Disposition: inline In-Reply-To: <20091007211225.GB17805@elf.ucw.cz> Sender: linux-input-owner@vger.kernel.org List-Id: linux-input@vger.kernel.org To: Pavel Machek Cc: Eric Miao , rpurdie@rpsys.net, lenz@cs.wisc.edu, kernel list , Dirk@opfer-online.de, arminlitzel@web.de, Cyril Hrubis , thommycheck@gmail.com, linux-arm-kernel , dbaryshkov@gmail.com, omegamoon@gmail.com, utx@penguin.cz, linux-input@vger.kernel.org, "Rafael J. Wysocki" 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 Signed-off-by: Dmitry Torokhov --- 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);