From patchwork Wed Mar 16 05:32:02 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 638541 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.3) with ESMTP id p2G5W9dB014497 for ; Wed, 16 Mar 2011 05:32:28 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751226Ab1CPFcJ (ORCPT ); Wed, 16 Mar 2011 01:32:09 -0400 Received: from mail-gw0-f46.google.com ([74.125.83.46]:40269 "EHLO mail-gw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751165Ab1CPFcI (ORCPT ); Wed, 16 Mar 2011 01:32:08 -0400 Received: by gwaa18 with SMTP id a18so521494gwa.19 for ; Tue, 15 Mar 2011 22:32:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:date:from:to:cc:subject:message-id:references :mime-version:content-type:content-disposition:in-reply-to :user-agent; bh=cJ9YID/vxyhLCxhF3AyAA9DzwwYwd2YU4dcs85GumkY=; b=dK5nqY+0ORnd0o09rmFH/If+e+YIp1SWrMne5G0skyXhAVTW71O9/ovMDQTK2scisT H6nOh4XcQCgJfDpjMqsgNnt+k8OIPZPjq9yZAplxYrHL9/KlEU20YD3h0NQeeBszErFR LUStLBOKjlnk/vdti7x0KPWrlUeVAQwX89XFw= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; b=BqOOESa5xZg8SyoImoEcbhmtfg1AFVB5ybMixw9tbY//b3QbgdCrfWcy4OFjd9bOwt XLFwR9bVo7J6Jo4469THGRtFQRbdrZYAlmwyrpPAZi5ZF1klpQCWvW9HJbudxVrbgzlB 7mIdvKJkjIwsUSHVB8+ytnFhXqKh9QsicEmR8= Received: by 10.236.75.200 with SMTP id z48mr285066yhd.75.1300253527831; Tue, 15 Mar 2011 22:32:07 -0700 (PDT) Received: from mailhub.coreip.homeip.net (c-98-234-113-65.hsd1.ca.comcast.net [98.234.113.65]) by mx.google.com with ESMTPS id k5sm386780yhm.21.2011.03.15.22.32.05 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 15 Mar 2011 22:32:06 -0700 (PDT) Date: Tue, 15 Mar 2011 22:32:02 -0700 From: Dmitry Torokhov To: Magnus Damm Cc: srk@ti.com, linux-sh@vger.kernel.org, chinyeow.sim.xt@renesas.com, linux-input@vger.kernel.org Subject: Re: [PATCH] Input: tca6416-keypad: Suspend/Resume wakeup support Message-ID: <20110316053202.GA14604@core.coreip.homeip.net> References: <20110316051030.2399.19707.sendpatchset@t400s> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20110316051030.2399.19707.sendpatchset@t400s> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Wed, 16 Mar 2011 05:32:47 +0000 (UTC) diff --git a/drivers/input/keyboard/tca6416-keypad.c b/drivers/input/keyboard/tca6416-keypad.c index 800fbcc..3afea3f 100644 --- a/drivers/input/keyboard/tca6416-keypad.c +++ b/drivers/input/keyboard/tca6416-keypad.c @@ -297,6 +297,7 @@ static int __devinit tca6416_keypad_probe(struct i2c_client *client, } i2c_set_clientdata(client, chip); + device_init_wakeup(&client->dev, 1); return 0; @@ -326,10 +327,37 @@ static int __devexit tca6416_keypad_remove(struct i2c_client *client) return 0; } +#ifdef CONFIG_PM_SLEEP +static int tca6416_keypad_suspend(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct tca6416_keypad_chip *chip = i2c_get_clientdata(client); + + if (device_may_wakeup(dev)) + enable_irq_wake(chip->irqnum); + + return 0; +} + +static int tca6416_keypad_resume(struct device *dev) +{ + struct i2c_client *client = to_i2c_client(dev); + struct tca6416_keypad_chip *chip = i2c_get_clientdata(client); + + if (device_may_wakeup(dev)) + disable_irq_wake(chip->irqnum); + + return 0; +} +#endif + +static SIMPLE_DEV_PM_OPS(tca6416_keypad_dev_pm_ops, + tca6416_keypad_suspend, tca6416_keypad_resume); static struct i2c_driver tca6416_keypad_driver = { .driver = { .name = "tca6416-keypad", + .pm = &tca6416_keypad_dev_pm_ops, }, .probe = tca6416_keypad_probe, .remove = __devexit_p(tca6416_keypad_remove),