From patchwork Wed May 5 21:39:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 431404 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E4242C43462 for ; Wed, 5 May 2021 21:40:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CF0F0613F0 for ; Wed, 5 May 2021 21:40:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234919AbhEEVlB (ORCPT ); Wed, 5 May 2021 17:41:01 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:23402 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234780AbhEEVkm (ORCPT ); Wed, 5 May 2021 17:40:42 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620250785; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=Fot0NGl2ai1R4LucSAk0T+YoOHYuoLoy5rq36GvX/iQ=; b=MqU5wSXSu/C4y1jMb0jb7eGcwoJXNUFx6znLh/GK39rXi2ETMO+q3KZuj8D1lcOhBQitIO yz73fle2LsERK/gNcddYi9XbF5WGR3dRhlM1EN7+UUTd3NPaVDGVC9LyUrS7RkEsnsY0xf bHqNY3ZYxfgCPnRoGOHBBRzzGLl3fLA= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-592-O8SGOd2GN4-hrlxiwcFHOg-1; Wed, 05 May 2021 17:39:43 -0400 X-MC-Unique: O8SGOd2GN4-hrlxiwcFHOg-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 36C34100A67A; Wed, 5 May 2021 21:39:42 +0000 (UTC) Received: from x1.localdomain.com (ovpn-112-71.ams2.redhat.com [10.36.112.71]) by smtp.corp.redhat.com (Postfix) with ESMTP id 4B15E5D6A8; Wed, 5 May 2021 21:39:41 +0000 (UTC) From: Hans de Goede To: Jiri Kosina , Benjamin Tissoires Cc: Hans de Goede , linux-input@vger.kernel.org Subject: [PATCH v2 1/6] HID: core: Remove extraneous empty line before EXPORT_SYMBOL_GPL(hid_check_keys_pressed) Date: Wed, 5 May 2021 23:39:30 +0200 Message-Id: <20210505213935.631351-2-hdegoede@redhat.com> In-Reply-To: <20210505213935.631351-1-hdegoede@redhat.com> References: <20210505213935.631351-1-hdegoede@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Normally the EXPORT_SYMBOL of a function immediately follows the declaration of the function and all the other functions in hid-core.c follow this pattern, drop the extraneous empty line before the EXPORT_SYMBOL_GPL(hid_check_keys_pressed); line. Signed-off-by: Hans de Goede --- drivers/hid/hid-core.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 097cb1ee3126..b593dff411a6 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c @@ -2588,7 +2588,6 @@ int hid_check_keys_pressed(struct hid_device *hid) return 0; } - EXPORT_SYMBOL_GPL(hid_check_keys_pressed); static int __init hid_init(void) From patchwork Wed May 5 21:39:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 431403 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 91CA5C43460 for ; Wed, 5 May 2021 21:40:12 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 786B7613D6 for ; Wed, 5 May 2021 21:40:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234961AbhEEVlI (ORCPT ); Wed, 5 May 2021 17:41:08 -0400 Received: from us-smtp-delivery-124.mimecast.com ([216.205.24.124]:25728 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233492AbhEEVkp (ORCPT ); Wed, 5 May 2021 17:40:45 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620250788; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NEdvRvx4IJ+xRqGwkaz89HqKIJ2w+9EsUd+uP2+Gk28=; b=Jas35SyRQZCRbrybNrtZZrEBVW2+M6dQFsujF9TjpzUybA+Xb1yOc8NOWnpF6hdQhiDxLx KyNm5arWS07Dj15C3dWvYLk3xMrAY2W6Zt1D1dXYy5lZEfGjNmhWSwVt+363R83if1iOpE zYImYNKCyIMiVkPQV412psGMEKnKw+s= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-591-_8u4x6W3PTaJPDZarOF5rw-1; Wed, 05 May 2021 17:39:46 -0400 X-MC-Unique: _8u4x6W3PTaJPDZarOF5rw-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id C6FBC801B14; Wed, 5 May 2021 21:39:45 +0000 (UTC) Received: from x1.localdomain.com (ovpn-112-71.ams2.redhat.com [10.36.112.71]) by smtp.corp.redhat.com (Postfix) with ESMTP id DC5565D6A8; Wed, 5 May 2021 21:39:44 +0000 (UTC) From: Hans de Goede To: Jiri Kosina , Benjamin Tissoires Cc: Hans de Goede , linux-input@vger.kernel.org Subject: [PATCH v2 4/6] HID: multitouch: Disable event reporting on suspend when our parent is not a wakeup-source Date: Wed, 5 May 2021 23:39:33 +0200 Message-Id: <20210505213935.631351-5-hdegoede@redhat.com> In-Reply-To: <20210505213935.631351-1-hdegoede@redhat.com> References: <20210505213935.631351-1-hdegoede@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Disable event reporting on suspend when our parent is not a wakeup-source. This should help save some extra power in this case. Signed-off-by: Hans de Goede --- Changes in v2: - Use new hid_is_usb_device() helper --- drivers/hid/hid-multitouch.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/drivers/hid/hid-multitouch.c b/drivers/hid/hid-multitouch.c index cfb68e443ddd..24b4a54f7224 100644 --- a/drivers/hid/hid-multitouch.c +++ b/drivers/hid/hid-multitouch.c @@ -1759,12 +1759,33 @@ static int mt_probe(struct hid_device *hdev, const struct hid_device_id *id) } #ifdef CONFIG_PM + +/* Check if the parent which has the power/wakeup* sysfs attributes may wake the hdev */ +static bool mt_parent_may_wake(struct hid_device *hdev) +{ + struct device *parent = hdev->dev.parent; + + /* + * USB-HID is attached to the usb_interface (our parent), the + * power/wakeup* attr are part of the usb-device which is its parent. + */ + if (hid_is_usb_device(hdev) && parent) + parent = parent->parent; + + if (parent) + return device_may_wakeup(parent); + + /* Huh? Play it safe and keep reporting events. */ + return true; +} + static int mt_suspend(struct hid_device *hdev, pm_message_t state) { struct mt_device *td = hid_get_drvdata(hdev); /* High latency is desirable for power savings during S3/S0ix */ - if (td->mtclass.quirks & MT_QUIRK_DISABLE_WAKEUP) + if ((td->mtclass.quirks & MT_QUIRK_DISABLE_WAKEUP) || + !mt_parent_may_wake(hdev)) mt_set_modes(hdev, HID_LATENCY_HIGH, false, false); else mt_set_modes(hdev, HID_LATENCY_HIGH, true, true); From patchwork Wed May 5 21:39:35 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 431402 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.4 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER, INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A8079C43462 for ; Wed, 5 May 2021 21:40:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8809E613D6 for ; Wed, 5 May 2021 21:40:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233772AbhEEVlJ (ORCPT ); Wed, 5 May 2021 17:41:09 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.133.124]:52706 "EHLO us-smtp-delivery-124.mimecast.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233722AbhEEVkt (ORCPT ); Wed, 5 May 2021 17:40:49 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1620250792; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=KJpnGKsjgIiuxbsc1ISPgJdjzVr1zEzqG2Jggbdhcdk=; b=WqMI8kWXuOmoVJt0MBkGsYm1Cu6txENThjgLXmFbv6zZAxjwbnylpchL8oOqdbUWmj4ePw sbXEZNQIXdMDpOPYxzAHKKJv/CI6iPPu6uUfgRQbbDWLDLYmEZ93qycDb8sSzphAKam0YS l3b65xCgltkBNXyVV6J58DSn2hgcpEM= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-188-ik9t_UfVPuqfoEzwmswfhA-1; Wed, 05 May 2021 17:39:49 -0400 X-MC-Unique: ik9t_UfVPuqfoEzwmswfhA-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 60AD4801B13; Wed, 5 May 2021 21:39:48 +0000 (UTC) Received: from x1.localdomain.com (ovpn-112-71.ams2.redhat.com [10.36.112.71]) by smtp.corp.redhat.com (Postfix) with ESMTP id 741C75D6A8; Wed, 5 May 2021 21:39:47 +0000 (UTC) From: Hans de Goede To: Jiri Kosina , Benjamin Tissoires Cc: Hans de Goede , linux-input@vger.kernel.org Subject: [PATCH v2 6/6] HID: asus: Switch to the new hid_is_usb_device() helper Date: Wed, 5 May 2021 23:39:35 +0200 Message-Id: <20210505213935.631351-7-hdegoede@redhat.com> In-Reply-To: <20210505213935.631351-1-hdegoede@redhat.com> References: <20210505213935.631351-1-hdegoede@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Switch to the new hid_is_usb_device() helper. With this new helper building without USB_HID being enabled should work, so also change the Kconfig depends on from USB_HID to plain HID. Signed-off-by: Hans de Goede --- drivers/hid/Kconfig | 2 +- drivers/hid/hid-asus.c | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig index 786b71ef7738..6b244e67c272 100644 --- a/drivers/hid/Kconfig +++ b/drivers/hid/Kconfig @@ -149,7 +149,7 @@ config HID_APPLEIR config HID_ASUS tristate "Asus" - depends on USB_HID + depends on HID depends on LEDS_CLASS depends on ASUS_WMI || ASUS_WMI=n select POWER_SUPPLY diff --git a/drivers/hid/hid-asus.c b/drivers/hid/hid-asus.c index 6e24f48f211c..41bc34aaaf09 100644 --- a/drivers/hid/hid-asus.c +++ b/drivers/hid/hid-asus.c @@ -1009,8 +1009,7 @@ static int asus_probe(struct hid_device *hdev, const struct hid_device_id *id) if (drvdata->quirks & QUIRK_IS_MULTITOUCH) drvdata->tp = &asus_i2c_tp; - if ((drvdata->quirks & QUIRK_T100_KEYBOARD) && - hid_is_using_ll_driver(hdev, &usb_hid_driver)) { + if ((drvdata->quirks & QUIRK_T100_KEYBOARD) && hid_is_usb_device(hdev)) { struct usb_interface *intf = to_usb_interface(hdev->dev.parent); if (intf->altsetting->desc.bInterfaceNumber == T100_TPAD_INTF) { @@ -1038,8 +1037,7 @@ static int asus_probe(struct hid_device *hdev, const struct hid_device_id *id) drvdata->tp = &asus_t100chi_tp; } - if ((drvdata->quirks & QUIRK_MEDION_E1239T) && - hid_is_using_ll_driver(hdev, &usb_hid_driver)) { + if ((drvdata->quirks & QUIRK_MEDION_E1239T) && hid_is_usb_device(hdev)) { struct usb_host_interface *alt = to_usb_interface(hdev->dev.parent)->altsetting;