From patchwork Sun Feb 12 23:43:33 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 9568653 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 6289360476 for ; Sun, 12 Feb 2017 23:43:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 53E6E28066 for ; Sun, 12 Feb 2017 23:43:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4677128113; Sun, 12 Feb 2017 23:43:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 69AAB28066 for ; Sun, 12 Feb 2017 23:43:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751229AbdBLXni (ORCPT ); Sun, 12 Feb 2017 18:43:38 -0500 Received: from mail-pg0-f65.google.com ([74.125.83.65]:36225 "EHLO mail-pg0-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750882AbdBLXnh (ORCPT ); Sun, 12 Feb 2017 18:43:37 -0500 Received: by mail-pg0-f65.google.com with SMTP id 75so8059214pgf.3; Sun, 12 Feb 2017 15:43:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:mime-version:content-disposition :user-agent; bh=qfvUEaeJCb49bx9TBC3swcw2k4QBIfo3hz3chnBTF+w=; b=p6G7FvdkSPz07h8s6rgwfvbjUKZ/5NHUmAoPLead3ZebS6seY04tsrPIEz2LDNIMUc yhKwlhha3+OOLoxRw0YXWuCr3m+1PLviYNwOFlazlFkok/1SR/CCZAl18/QZJLTN5+gt xGYgHMJUT3M8UuPm1FzzPCquFZOHho4zXZQC/FDHSqzacPg/tZbPeDrTAESNHz5YnkT0 iq3HhShz9bRbWFBYghCCYsIlkCBbAyw6SKtppYyFoJEFQc26witK10BpzlTVGgjZv9Ug prwVruc8PE/uTkwRAy1qdi+/VmL+JH/EUN36KCi0mZlE0ptYgAMjt/x/eAfDK5JGUrSQ ueBg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition:user-agent; bh=qfvUEaeJCb49bx9TBC3swcw2k4QBIfo3hz3chnBTF+w=; b=UgrB8OyPd3lT1eVygufeU0IYg74EeX7CIsgrcvLpRD5wGYXgjuT8JX63CO6kzCSPOD dmckZ2pmLHSEjov1St7U+lrSm0Vr1vTEbeLtDMxlEzLAXtNjRVsQ9ciCG6PeCloOUjoP BV9AUeP7oZxFe+NAldEbl1eAArwv5f15nDZ9z/sbikf2xkdhEgSNJpV6WscbqAYO7k9q DdkdQRsvo6VYYDa6opBoVaPTTDa2tAtCi+NFtw5bNUIyRE4yV0boL0i6EpepdniOTL+m WTXbp+d0JDsenK7l/WmIzwOdrT2V/M23uXgwkZspQwUTm7nsmXTqDwX0e9APQ2gVew/3 lIBQ== X-Gm-Message-State: AMke39lqYMR132SKCvFvqTK+tNAot+wRd9QWc9B3nxmfaA+Sd2HQaTJp8t9zwSWhD/Bfhw== X-Received: by 10.84.196.36 with SMTP id k33mr26433699pld.125.1486943016770; Sun, 12 Feb 2017 15:43:36 -0800 (PST) Received: from dtor-ws ([2620:0:1000:1311:7531:2f4f:130e:34ea]) by smtp.gmail.com with ESMTPSA id 75sm10502283pfw.103.2017.02.12.15.43.35 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Sun, 12 Feb 2017 15:43:36 -0800 (PST) Date: Sun, 12 Feb 2017 15:43:33 -0800 From: Dmitry Torokhov To: linux-input@vger.kernel.org Cc: Pavel Machek , Sebastian Reichel , Pali =?iso-8859-1?Q?Roh=E1r?= , Michael Welling , linux-kernel@vger.kernel.org Subject: [PATCH] Input: tsc2004/5 - do not use irq_set_irq_wake() directly Message-ID: <20170212234333.GA25725@dtor-ws> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Instead of setting irq_set_irq_wake() directly in probe(), mark the device as wakeup-capable, and use enable_irq_wake() and disable_irq_wake() in suspend/resume path. Signed-off-by: Dmitry Torokhov Reviewed-By: Sebastian Reichel --- drivers/input/touchscreen/tsc200x-core.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/input/touchscreen/tsc200x-core.c b/drivers/input/touchscreen/tsc200x-core.c index 88ea5e1b72ae..d1c40c803d61 100644 --- a/drivers/input/touchscreen/tsc200x-core.c +++ b/drivers/input/touchscreen/tsc200x-core.c @@ -114,7 +114,9 @@ struct tsc200x { struct gpio_desc *reset_gpio; int (*tsc200x_cmd)(struct device *dev, u8 cmd); + int irq; + bool wake_irq_enabled; }; static void tsc200x_update_pen_state(struct tsc200x *ts, @@ -573,7 +575,8 @@ int tsc200x_probe(struct device *dev, int irq, const struct input_id *tsc_id, goto err_remove_sysfs; } - irq_set_irq_wake(irq, 1); + device_init_wakeup(dev, true); + return 0; err_remove_sysfs: @@ -607,6 +610,9 @@ static int __maybe_unused tsc200x_suspend(struct device *dev) ts->suspended = true; + if (device_may_wakeup(dev)) + ts->wake_irq_enabled = enable_irq_wake(ts->irq) == 0; + mutex_unlock(&ts->mutex); return 0; @@ -618,6 +624,11 @@ static int __maybe_unused tsc200x_resume(struct device *dev) mutex_lock(&ts->mutex); + if (ts->wake_irq_enabled) { + disable_irq_wake(ts->irq); + ts->wake_irq_enabled = false; + } + if (ts->suspended && ts->opened) __tsc200x_enable(ts);