From patchwork Thu Apr 10 09:29:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: "H. Nikolaus Schaller" X-Patchwork-Id: 3961181 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 7ADF59F336 for ; Thu, 10 Apr 2014 09:49:42 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AD47120632 for ; Thu, 10 Apr 2014 09:49:41 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id CCC5520625 for ; Thu, 10 Apr 2014 09:49:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965536AbaDJJgJ (ORCPT ); Thu, 10 Apr 2014 05:36:09 -0400 Received: from mo4-p00-ob.smtp.rzone.de ([81.169.146.160]:45996 "EHLO mo4-p00-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934852AbaDJJgH convert rfc822-to-8bit (ORCPT ); Thu, 10 Apr 2014 05:36:07 -0400 X-Greylist: delayed 363 seconds by postgrey-1.27 at vger.kernel.org; Thu, 10 Apr 2014 05:36:06 EDT DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; t=1397122565; l=2393; s=domk; d=dsitri.de; h=Mime-Version:To:Cc:Date:Subject:Content-Transfer-Encoding: Content-Type:From:X-RZG-CLASS-ID:X-RZG-AUTH; bh=LGumW4GDpLHpZwn1QRI/AojiHTk=; b=P3nShPQQV+MtR0Jh893Elw45FY1T8lLq3QYFXeykS868G5ziZYkRjcoVlsaSqwqgDvD fNpeht9WFtqfxzhC1dx+mdYA4xT7wdenZ8+ZEt9Vs/41m0CiBa1IXLULgO9SEjJiGmnhm hj3rgvz2OnE6z1aaMe1R2Qq93VYlau3w/KI= X-RZG-AUTH: :JGIXVUS7cutRB/49FwqZ7WcKdUCnXG6JabOfSXKWrat4jNPvwo0= X-RZG-CLASS-ID: mo00 Received: from [192.168.2.104] (p57AE3112.dip0.t-ipconnect.de [87.174.49.18]) by post.strato.de (RZmta 32.33 DYNA|AUTH) with ESMTPA id 200980q3A9Tt75c; Thu, 10 Apr 2014 11:29:55 +0200 (CEST) From: "Dr. H. Nikolaus Schaller" Subject: [PATCH] gpio_keys, twl4030-pwrbutton: stay awake for 1sec on resume Date: Thu, 10 Apr 2014 11:29:55 +0200 Message-Id: Cc: Sachin Kamat , Sebastian Reichel , Aaro Koskinen , Kumar Gala , linux-input@vger.kernel.org, LKML , Marek Belisko , Lukas Maerdian To: Dmitry Torokhov Mime-Version: 1.0 (Apple Message framework v1085) X-Mailer: Apple Mail (2.1085) Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-7.3 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,RP_MATCHES_RCVD,T_DKIM_INVALID,T_HK_NAME_DR, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This gives the userspace (e.g. Replicant) a chance to fully handle the pm_wakeup_event, before autosleep suspends the system alltogether again. This fixes suspend/resume on the OpenPhoenux GTA04, in combination with the Replicant 4.2.2 userspace, which needs to execute this to stay awake: 'echo on > /sys/power/state' Signed-off-by: Lukas M?§rdian Signed-off-by: H. Nikolaus Schaller --- drivers/input/keyboard/gpio_keys.c | 7 ++----- drivers/input/misc/twl4030-pwrbutton.c | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c index 2db1324..be8c62e 100644 --- a/drivers/input/keyboard/gpio_keys.c +++ b/drivers/input/keyboard/gpio_keys.c @@ -345,9 +345,6 @@ static void gpio_keys_gpio_work_func(struct work_struct *work) container_of(work, struct gpio_button_data, work); gpio_keys_gpio_report_event(bdata); - - if (bdata->button->wakeup) - pm_relax(bdata->input->dev.parent); } static void gpio_keys_gpio_timer(unsigned long _data) @@ -364,7 +361,7 @@ static irqreturn_t gpio_keys_gpio_isr(int irq, void *dev_id) BUG_ON(irq != bdata->irq); if (bdata->button->wakeup) - pm_stay_awake(bdata->input->dev.parent); + pm_wakeup_event(bdata->input->dev.parent, 1000); if (bdata->timer_debounce) mod_timer(&bdata->timer, jiffies + msecs_to_jiffies(bdata->timer_debounce)); @@ -402,7 +399,7 @@ static irqreturn_t gpio_keys_irq_isr(int irq, void *dev_id) if (!bdata->key_pressed) { if (bdata->button->wakeup) - pm_wakeup_event(bdata->input->dev.parent, 0); + pm_wakeup_event(bdata->input->dev.parent, 1000); input_event(input, EV_KEY, button->code, 1); input_sync(input); diff --git a/drivers/input/misc/twl4030-pwrbutton.c b/drivers/input/misc/twl4030-pwrbutton.c index fb3b63b..8622e43 100644 --- a/drivers/input/misc/twl4030-pwrbutton.c +++ b/drivers/input/misc/twl4030-pwrbutton.c @@ -41,7 +41,7 @@ static irqreturn_t powerbutton_irq(int irq, void *_pwr) err = twl_i2c_read_u8(TWL_MODULE_PM_MASTER, &value, STS_HW_CONDITIONS); if (!err) { - pm_wakeup_event(pwr->dev.parent, 0); + pm_wakeup_event(pwr->dev.parent, 1000); input_report_key(pwr, KEY_POWER, value & PWR_PWRON_IRQ); input_sync(pwr); } else {