From patchwork Fri Apr 3 12:57:51 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomeu Vizoso X-Patchwork-Id: 6156701 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 5C9D0BF4A6 for ; Fri, 3 Apr 2015 13:00:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 899E7203DC for ; Fri, 3 Apr 2015 13:00:55 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id D72A5203DB for ; Fri, 3 Apr 2015 13:00:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753344AbbDCNAQ (ORCPT ); Fri, 3 Apr 2015 09:00:16 -0400 Received: from mail-wi0-f178.google.com ([209.85.212.178]:32952 "EHLO mail-wi0-f178.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753051AbbDCM63 (ORCPT ); Fri, 3 Apr 2015 08:58:29 -0400 Received: by wixm2 with SMTP id m2so73064604wix.0; Fri, 03 Apr 2015 05:58:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=LVel921v15iSW3orvLOXPwE0sl5aitptElXwvqB9J9o=; b=GOUHbmPsCjjPDeXhMV+AhZr18QMqR5WXNhd4CrFMAqmBmMQNPGqFZr1dVrHMty0p0C IsSCSmiTvpUkOR1rKBPlfe2MQunsfNweTf4FI2hE7heNmXZQnfoaMY6aqhPj3cahsv34 UC4ntxQ1PYwU9yh+LI4/OxC2ayHYoRU9d7qfC8w7w+RYwUe8FOY39Mqau7klswtoQSq0 oZYXIMltt7Q3O4mA39pviBU6Ebc9T3wCblKwf3IftSipdadlbqwH1bYIfXDAfxGIaILI Cda5igOojDRtNvYv+qcEOKwowAr3mR3Zzb7dTqU0uKv878Yix69nmcATZo5BN2Nl5QUw w0JA== X-Received: by 10.180.101.233 with SMTP id fj9mr33198098wib.65.1428065908202; Fri, 03 Apr 2015 05:58:28 -0700 (PDT) Received: from cizrna.lan ([109.72.12.93]) by mx.google.com with ESMTPSA id n6sm2664610wiw.6.2015.04.03.05.58.26 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 03 Apr 2015 05:58:27 -0700 (PDT) From: Tomeu Vizoso To: linux-pm@vger.kernel.org Cc: Tomeu Vizoso , Dmitry Torokhov , linux-input@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 2/7] Input: Add input_dev.stay_runtime_suspended flag Date: Fri, 3 Apr 2015 14:57:51 +0200 Message-Id: <1428065887-16017-3-git-send-email-tomeu.vizoso@collabora.com> X-Mailer: git-send-email 2.3.4 In-Reply-To: <1428065887-16017-1-git-send-email-tomeu.vizoso@collabora.com> References: <1428065887-16017-1-git-send-email-tomeu.vizoso@collabora.com> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,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 It indicates that if the device is runtime suspended when the system goes into a sleep state, it will be left in that state instead of suspended and resumed. It's useful for devices such as UVC that register an input device for the buttons that they may have and that should remain runtime suspended when the system suspends. Signed-off-by: Tomeu Vizoso --- drivers/input/input.c | 8 ++++++++ include/linux/input.h | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/drivers/input/input.c b/drivers/input/input.c index 9666309..2bcc708 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c @@ -1741,12 +1741,20 @@ static int input_dev_poweroff(struct device *dev) return 0; } +static int input_dev_prepare(struct device *dev) +{ + struct input_dev *input_dev = to_input_dev(dev); + + return input_dev->stay_runtime_suspended; +} + static const struct dev_pm_ops input_dev_pm_ops = { .suspend = input_dev_suspend, .resume = input_dev_resume, .freeze = input_dev_freeze, .poweroff = input_dev_poweroff, .restore = input_dev_resume, + .prepare = input_dev_prepare, }; static int input_class_prepare(struct device *dev) diff --git a/include/linux/input.h b/include/linux/input.h index 82ce323..7466961 100644 --- a/include/linux/input.h +++ b/include/linux/input.h @@ -117,6 +117,9 @@ struct input_value { * @vals: array of values queued in the current frame * @devres_managed: indicates that devices is managed with devres framework * and needs not be explicitly unregistered or freed. + * @stay_runtime_suspended: indicates that if the device is runtime suspended + * when the system goes into a sleep state, it will be left in that state + * instead of suspended and resumed */ struct input_dev { const char *name; @@ -187,6 +190,7 @@ struct input_dev { struct input_value *vals; bool devres_managed; + bool stay_runtime_suspended; }; #define to_input_dev(d) container_of(d, struct input_dev, dev)