From patchwork Thu Jun 17 18:59:01 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Eric_B=C3=A9nard?= X-Patchwork-Id: 106728 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o5HIxH07011613 for ; Thu, 17 Jun 2010 18:59:17 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757373Ab0FQS7Q (ORCPT ); Thu, 17 Jun 2010 14:59:16 -0400 Received: from smtp3-g21.free.fr ([212.27.42.3]:60066 "EHLO smtp3-g21.free.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757354Ab0FQS7P (ORCPT ); Thu, 17 Jun 2010 14:59:15 -0400 Received: from localhost.localdomain (tal33-3-82-233-81-124.fbx.proxad.net [82.233.81.124]) by smtp3-g21.free.fr (Postfix) with ESMTP id 4C55A81817B; Thu, 17 Jun 2010 20:59:08 +0200 (CEST) From: =?utf-8?q?Eric=20B=C3=A9nard?= Cc: maramaopercheseimorto@gmail.com, linux-input@vger.kernel.org, dmitry.torokhov@gmail.com, linux-arm-kernel@lists.infradead.org Subject: [PATCH v2] input/imx_keypad: add PM support Date: Thu, 17 Jun 2010 20:59:01 +0200 Message-Id: <1276801147-4103-1-git-send-email-eric@eukrea.com> X-Mailer: git-send-email 1.6.3.3 MIME-Version: 1.0 To: unlisted-recipients:; (no To-header on input) Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Thu, 17 Jun 2010 18:59:17 +0000 (UTC) diff --git a/drivers/input/keyboard/imx_keypad.c b/drivers/input/keyboard/imx_keypad.c index d92c15c..9aa0005 100644 --- a/drivers/input/keyboard/imx_keypad.c +++ b/drivers/input/keyboard/imx_keypad.c @@ -364,6 +364,38 @@ static void imx_keypad_inhibit(struct imx_keypad *keypad) writew(0xff00, keypad->mmio_base + KPCR); } +#ifdef CONFIG_PM +static int mxc_kpp_suspend(struct device *dev) +{ + struct platform_device *pdev = to_platform_device(dev); + struct imx_keypad *keypad = platform_get_drvdata(pdev); + + keypad->enabled = false; + synchronize_irq(keypad->irq); + disable_irq(keypad->irq); + clk_disable(keypad->clk); + + return 0; +} + +static int mxc_kpp_resume(struct device *dev) +{ + struct platform_device *pdev = to_platform_device(dev); + struct imx_keypad *keypad = platform_get_drvdata(pdev); + + keypad->enabled = true; + clk_enable(keypad->clk); + enable_irq(keypad->irq); + + return 0; +} + +static const struct dev_pm_ops mxc_kpp_pm_ops = { + .suspend = mxc_kpp_suspend, + .resume = mxc_kpp_resume, +}; +#endif + static void imx_keypad_close(struct input_dev *dev) { struct imx_keypad *keypad = input_get_drvdata(dev); @@ -410,7 +442,8 @@ open_err: static int __devinit imx_keypad_probe(struct platform_device *pdev) { - const struct matrix_keymap_data *keymap_data = pdev->dev.platform_data; + const struct matrix_keypad_platform_data *keypad_data = pdev->dev.platform_data; + const struct matrix_keymap_data *keymap_data = keypad_data->keymap_data; struct imx_keypad *keypad; struct input_dev *input_dev; struct resource *res; @@ -525,7 +558,7 @@ static int __devinit imx_keypad_probe(struct platform_device *pdev) } platform_set_drvdata(pdev, keypad); - device_init_wakeup(&pdev->dev, 1); + device_init_wakeup(&pdev->dev, keypad_data->wakeup); return 0; @@ -571,6 +604,9 @@ static struct platform_driver imx_keypad_driver = { .driver = { .name = "imx-keypad", .owner = THIS_MODULE, +#ifdef CONFIG_PM + .pm = &mxc_kpp_pm_ops, +#endif }, .probe = imx_keypad_probe, .remove = __devexit_p(imx_keypad_remove),