From patchwork Sat Oct 29 12:03:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Eray_Or=C3=A7unus?= X-Patchwork-Id: 12695 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1315472wru; Sat, 29 Oct 2022 05:07:47 -0700 (PDT) X-Google-Smtp-Source: AMsMyM453+oW6jtwp+Db4uJUM8nOLgfQuSAtMTmtlrNYsrwnZCLy9babae6UhxqhLvqQ7w6BsIpf X-Received: by 2002:a05:6402:50cf:b0:462:352e:f4a7 with SMTP id h15-20020a05640250cf00b00462352ef4a7mr3911427edb.317.1667045267101; Sat, 29 Oct 2022 05:07:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667045267; cv=none; d=google.com; s=arc-20160816; b=yWlaqs9Pee9PVgakxoT+gjApxc6P3GmtMTWTgam3ra2kbdR8VtRiW0F+gqjcM7dzvj xYl7xnfkz1R62tVcKwijqa0Ocgl9/GGTE3bucWQ+ElVxa7ydAdRKOkUBLdfw1DZP5vqx JgLoQCKKLbiP2vX0bsN2oTe5JqXgZfvNzRaLstWflSKXbnzq1fZebgnUHW9KfpHehrCz eAxWZwOVpoYgHonHnyYp2mDhx/8/vRV7WatenoKPuWOahKioJz8+sJJ6zeBJt6DW0XPj 3cx8JNjtEp+S10qQcvIb1b3Kp+6fGIAAtLGCmDXkCZiuhchoaboHXyl8rG9hOp5dtBn7 Jh2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=gzOvAyGDXhsFFUVp58xr8wzl/ct2UtB9GMmORTrIQvw=; b=R5egjslWus6UpUgFGwkNu7yfcVj6E4vE0M4Wti6d86wdf+45STUdFB9tmZ+o4dbeWe xG/YDNm+RHUxZ1omyXGFkk7zUkELU6NLc1G6WkTfu4rqlJKbVMj8dJs6DA889gjrVKmw mCxbcFXTtzEj5ovjfu0jYWarFXmuf8fa3pGut5qBAgdaORzsUv+OkJBPEOFRjvKOMc8w m3pvvAOa7o7SlQ7d5UXZky9RrY8c30Xwkos6Tl96BHghYD85o9tHndl1hycFS62+k8ou 1do8S2GUEgOJ1NpHS7ThzCQH0xODTPbWfrsh/bX0kwX4u45+z00OR1CfsvjTzd29eW0Y mG0w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=B1sbLOE0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id du5-20020a17090772c500b007a8c58b51a1si1759410ejc.179.2022.10.29.05.07.22; Sat, 29 Oct 2022 05:07:47 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=B1sbLOE0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229817AbiJ2MEb (ORCPT + 99 others); Sat, 29 Oct 2022 08:04:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33446 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229789AbiJ2ME1 (ORCPT ); Sat, 29 Oct 2022 08:04:27 -0400 Received: from mail-wm1-x32c.google.com (mail-wm1-x32c.google.com [IPv6:2a00:1450:4864:20::32c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3D7274B85; Sat, 29 Oct 2022 05:04:24 -0700 (PDT) Received: by mail-wm1-x32c.google.com with SMTP id c7-20020a05600c0ac700b003c6cad86f38so8033444wmr.2; Sat, 29 Oct 2022 05:04:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=gzOvAyGDXhsFFUVp58xr8wzl/ct2UtB9GMmORTrIQvw=; b=B1sbLOE0BM4c0GsdSFUmM6NZvGRW76oTkt7BxEPlqKUIwlBOoJJZ0HKla36bv/DnuF KbsTbtMI0VLBBUuvWl0k2pQoNp6RLY2S2GUmtGVewbO+vW7vc8P015KC72a5QH2bD8xB 6Sq4H2DurFxuddYdKZ7WVZsBNTMqH5ZOkV4baF15MkBXbTA8CQtbZNApYzvLRASd9KVo FrO0bbsIlyWO6+yxtbtRLRyPLH/1l2Ma+GDwtJOh8Wng/KNQDnHzXE7nyE2sbbm5eU7Z HCjlugnC6Hjck61NtpKZfUGsXY2d08uOfXJSabWU+CTrlnqyNzUrnww6RTG++URhVyNe qNQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gzOvAyGDXhsFFUVp58xr8wzl/ct2UtB9GMmORTrIQvw=; b=eq9sNAebE8IrJjUoVNdYYibCGVNdMZnfYSxR2IR8oP2XKZWdvmqu6mr9t+ZctwyzUl czlE6vi/yQkzwERWQNSVaDG2LWqznSdGobGksS5yULNwACUlk1v3OJ0ia13PsS6g4U4q zy1gT9Q+IuIrXDQyDRsJcDojOSmbjwgvLk9UaaOLvKNSgoIdPW1zjTpE63Lb2NOjxnDH 04u7tvqzZ0cYaUSKpKH1DNNENnEEOgDWTo4U9ObU2gDiJd5IPgQ3Rn03rcnhYiB2eKG1 fxadHSn6Nlq5FCjp7OR9LleHUMBjA0YaZz6ZcfJaoiEI+okVRfrsfEYEYa7JMMMKwNOb gCKw== X-Gm-Message-State: ACrzQf2MEdUFSqP0MQe+5OG1y35R9AgWQsDCnm8uHgxPWQkaoiBJxWn/ N2Z/PIlFK0vD2N5X6aa4Q1XApiJ1fCxIMg== X-Received: by 2002:a1c:27c6:0:b0:3c2:e6df:c79b with SMTP id n189-20020a1c27c6000000b003c2e6dfc79bmr12025245wmn.14.1667045062904; Sat, 29 Oct 2022 05:04:22 -0700 (PDT) Received: from eray-Lenovo-Z50-70.. ([188.132.247.187]) by smtp.googlemail.com with ESMTPSA id z17-20020a05600c0a1100b003b492753826sm1472439wmp.43.2022.10.29.05.04.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 Oct 2022 05:04:22 -0700 (PDT) From: =?utf-8?q?Eray_Or=C3=A7unus?= To: platform-driver-x86@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, ike.pan@canonical.com, jikos@kernel.org, benjamin.tissoires@redhat.com, dmitry.torokhov@gmail.com, hdegoede@redhat.com, mgross@linux.intel.com, pobrn@protonmail.com, =?utf-8?q?Eray_Or=C3=A7unus?= Subject: [PATCH v2 1/7] Revert "platform/x86: ideapad-laptop: check for touchpad support in _CFG" Date: Sat, 29 Oct 2022 15:03:06 +0300 Message-Id: <20221029120311.11152-2-erayorcunus@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221029120311.11152-1-erayorcunus@gmail.com> References: <20221029120311.11152-1-erayorcunus@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748023658336380631?= X-GMAIL-MSGID: =?utf-8?q?1748023658336380631?= Last 8 bit of _CFG started being used in later IdeaPads, thus 30th bit doesn't always show whether device supports touchpad or touchpad switch. Remove checking bit 30 of _CFG, so older IdeaPads like S10-3 can switch touchpad again via touchpad attribute. This reverts commit b3ed1b7fe3786c8fe795c16ca07cf3bda67b652f. Signed-off-by: Eray Orçunus --- drivers/platform/x86/ideapad-laptop.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c index e7a1299e3776..b67bac457a7a 100644 --- a/drivers/platform/x86/ideapad-laptop.c +++ b/drivers/platform/x86/ideapad-laptop.c @@ -46,11 +46,10 @@ static const char *const ideapad_wmi_fnesc_events[] = { #endif enum { - CFG_CAP_BT_BIT = 16, - CFG_CAP_3G_BIT = 17, - CFG_CAP_WIFI_BIT = 18, - CFG_CAP_CAM_BIT = 19, - CFG_CAP_TOUCHPAD_BIT = 30, + CFG_CAP_BT_BIT = 16, + CFG_CAP_3G_BIT = 17, + CFG_CAP_WIFI_BIT = 18, + CFG_CAP_CAM_BIT = 19, }; enum { @@ -367,8 +366,6 @@ static int debugfs_cfg_show(struct seq_file *s, void *data) seq_puts(s, " wifi"); if (test_bit(CFG_CAP_CAM_BIT, &priv->cfg)) seq_puts(s, " camera"); - if (test_bit(CFG_CAP_TOUCHPAD_BIT, &priv->cfg)) - seq_puts(s, " touchpad"); seq_puts(s, "\n"); seq_puts(s, "Graphics: "); @@ -661,8 +658,7 @@ static umode_t ideapad_is_visible(struct kobject *kobj, else if (attr == &dev_attr_fn_lock.attr) supported = priv->features.fn_lock; else if (attr == &dev_attr_touchpad.attr) - supported = priv->features.touchpad_ctrl_via_ec && - test_bit(CFG_CAP_TOUCHPAD_BIT, &priv->cfg); + supported = priv->features.touchpad_ctrl_via_ec; else if (attr == &dev_attr_usb_charging.attr) supported = priv->features.usb_charging; From patchwork Sat Oct 29 12:03:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Eray_Or=C3=A7unus?= X-Patchwork-Id: 12696 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1315604wru; Sat, 29 Oct 2022 05:08:05 -0700 (PDT) X-Google-Smtp-Source: AMsMyM6QA7Ap/huTq5Y3XDVOdMVh0yJjaOkeBZdrau+X8WGGm2adfUPBUYYtUgtLdQeD/LaAw43C X-Received: by 2002:a05:6402:5291:b0:45c:3f6a:d4bc with SMTP id en17-20020a056402529100b0045c3f6ad4bcmr4022636edb.285.1667045285218; Sat, 29 Oct 2022 05:08:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667045285; cv=none; d=google.com; s=arc-20160816; b=tBX14kl9I/ME1URQDcjqfZyQMpLUkbfI2tT7BbN//ZLRfLDvcu/vA8859BXgqBReCa ZTPDlDKV6D57TTNf7ZDggj6bWqNHvxe//9rBYjXkEp9ZPyp3HYpx0iZ3JogtBDhTh/Xi YokXA4E0uKydWWVdIBIp1zX/Zxcop5jvc9syOMKNioRhkytB6GiPoBrXXF92BDHmyB1K L+EoNGEHBoTV/6lW9zxH/jNf/QHtE+tj6T6K8B2xZ4EJpSr0GcKGhr5e45fVOp6XNrF7 6Ur7PQpjf6vbzP6agq2VG45nyWp9uecRah9qFQ1HquB3lRTpVJexyiViMdzFE/G574nY MBrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+Bb6ASl23RrFIKXOSlIN+mXfWnuBP94uLLqr0AkpKDA=; b=L1lmfpJytkaSOKRFYrYD/gVa2K5+bKzqRUzSr4eiwhdErjrSifkabws93HSd0paJlA LOnnWOkxA1YH4WUA1K9t+tR9ZN7Yyn5XoUS7t7I+ORScmqXnVbiVbcbXPjhXoEcVRMgq 8vECV9cdrXhkdfXG/hXfvkh5cgbDjDa3UTZf1tTS/xwA7blwHXrscp4qyPd4t6ZaUbf+ sFvjxaSVCymdXyqQaVnDnTbsY+CAhdOmTFJiiHaRy0ePVJhKCf95L0ChGQEaK+9KZKYE O0cdzctEIz4+/R33jO5WstoUEQ/xtweMICl7wcQsAD9/LHNF7RkKa1ojEXBN5wNVgGM2 Xwqw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=UKY4lfhg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id v21-20020aa7d655000000b0045a11b60c57si1483460edr.121.2022.10.29.05.07.41; Sat, 29 Oct 2022 05:08:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=UKY4lfhg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229824AbiJ2MEe (ORCPT + 99 others); Sat, 29 Oct 2022 08:04:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229792AbiJ2ME3 (ORCPT ); Sat, 29 Oct 2022 08:04:29 -0400 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38F1F315; Sat, 29 Oct 2022 05:04:27 -0700 (PDT) Received: by mail-wm1-x32e.google.com with SMTP id c7-20020a05600c0ac700b003c6cad86f38so8033512wmr.2; Sat, 29 Oct 2022 05:04:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+Bb6ASl23RrFIKXOSlIN+mXfWnuBP94uLLqr0AkpKDA=; b=UKY4lfhgMvDyzlpHGK828TVKM8bLmKYfTAbbSosf7Z9b84uk2IIBBGreNKB7zsd0Oe YhsjFdEHsTFBOH9hvI5wWplfWVVRKTdlg3VdEkA+rkxHnzl7ZwQcCdinB/clMYnxXFRP W7lTS0jxMLMzV0kIVLxjSNXsLxW1ckwMdyP/zWsBOXOJXEA8UElXeqTB5wWzzie+1rVm bPV6gcn2brP9Cg+2I83F4U/IV5o10Krrqv8ZY9eng4gOYGNRBjk3621/sLepeXIthPDE 0EHXPhsmdSFBK0nXg/5SsuNUk2hkYFjhM8vWD82cJU/l9T6WUBrdkoyvl4qjKgz14Oci sJUw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+Bb6ASl23RrFIKXOSlIN+mXfWnuBP94uLLqr0AkpKDA=; b=Hu7DAdn4GRI9napf+xc7pHBP5EICA/9c3V42/9/6sM8GCPcRoxvlBMKzhYR1hb4Ttc mnKswA8ECsF+v5QQuGn66FzjiTHejzMRU/d9R/E8LN/DwEkrC3vTqc/XiZbpq3uWDAnB qkArHTPgkwCVULz+3Kmk015CZA+0ZWFyzJywyK5TXJDTNmElVv4F8SDiTOAuIbu3Yj4I onF/X8GZC527zqTeMd0aCMTtie4M8T/YF/DOkRFXU3n+3Po8Tw2xHgLTBYVe94QzCAQ9 tW3nwXtu5VOUrxS7JqGLBt5j4ZLdIpc7rgWmTSaWiuyMH1aoAkSYJrhBOlbxpkT0QorX zo2Q== X-Gm-Message-State: ACrzQf1vGmpjmbZ2xBkeuEHfjx1eonkVjWkT+ymEkd0iHBcd8kZFGX3S TJEP8BN74MgyBBsTmz9bcW9qgkJB9OEkWA== X-Received: by 2002:a05:600c:1da7:b0:3ce:a1:f961 with SMTP id p39-20020a05600c1da700b003ce00a1f961mr12107085wms.175.1667045065486; Sat, 29 Oct 2022 05:04:25 -0700 (PDT) Received: from eray-Lenovo-Z50-70.. ([188.132.247.187]) by smtp.googlemail.com with ESMTPSA id z17-20020a05600c0a1100b003b492753826sm1472439wmp.43.2022.10.29.05.04.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 Oct 2022 05:04:25 -0700 (PDT) From: =?utf-8?q?Eray_Or=C3=A7unus?= To: platform-driver-x86@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, ike.pan@canonical.com, jikos@kernel.org, benjamin.tissoires@redhat.com, dmitry.torokhov@gmail.com, hdegoede@redhat.com, mgross@linux.intel.com, pobrn@protonmail.com, =?utf-8?q?Eray_Or=C3=A7unus?= Subject: [PATCH v2 2/7] HID: add mapping for camera access keys Date: Sat, 29 Oct 2022 15:03:07 +0300 Message-Id: <20221029120311.11152-3-erayorcunus@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221029120311.11152-1-erayorcunus@gmail.com> References: <20221029120311.11152-1-erayorcunus@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748023676797369381?= X-GMAIL-MSGID: =?utf-8?q?1748023676797369381?= HUTRR72 added 3 new usage codes for keys that are supposed to enable, disable and toggle camera access. These are useful, considering many laptops today have key(s) for toggling access to camera. This patch adds new key definitions for KEY_CAMERA_ACCESS_ENABLE, KEY_CAMERA_ACCESS_DISABLE and KEY_CAMERA_ACCESS_TOGGLE. Additionally hid-debug is adjusted to recognize this new usage codes as well. Signed-off-by: Eray Orçunus Acked-by: Dmitry Torokhov Acked-by: Jiri Kosina Acked-by: Jiri Kosina --- drivers/hid/hid-debug.c | 3 +++ drivers/hid/hid-input.c | 3 +++ include/uapi/linux/input-event-codes.h | 3 +++ 3 files changed, 9 insertions(+) diff --git a/drivers/hid/hid-debug.c b/drivers/hid/hid-debug.c index f48d3534e020..991f880fdbd4 100644 --- a/drivers/hid/hid-debug.c +++ b/drivers/hid/hid-debug.c @@ -936,6 +936,9 @@ static const char *keys[KEY_MAX + 1] = { [KEY_ASSISTANT] = "Assistant", [KEY_KBD_LAYOUT_NEXT] = "KbdLayoutNext", [KEY_EMOJI_PICKER] = "EmojiPicker", + [KEY_CAMERA_ACCESS_ENABLE] = "CameraAccessEnable", + [KEY_CAMERA_ACCESS_DISABLE] = "CameraAccessDisable", + [KEY_CAMERA_ACCESS_TOGGLE] = "CameraAccessToggle", [KEY_DICTATE] = "Dictate", [KEY_BRIGHTNESS_MIN] = "BrightnessMin", [KEY_BRIGHTNESS_MAX] = "BrightnessMax", diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c index f197aed6444a..f8e6513e77b8 100644 --- a/drivers/hid/hid-input.c +++ b/drivers/hid/hid-input.c @@ -995,6 +995,9 @@ static void hidinput_configure_usage(struct hid_input *hidinput, struct hid_fiel case 0x0cd: map_key_clear(KEY_PLAYPAUSE); break; case 0x0cf: map_key_clear(KEY_VOICECOMMAND); break; + case 0x0d5: map_key_clear(KEY_CAMERA_ACCESS_ENABLE); break; + case 0x0d6: map_key_clear(KEY_CAMERA_ACCESS_DISABLE); break; + case 0x0d7: map_key_clear(KEY_CAMERA_ACCESS_TOGGLE); break; case 0x0d8: map_key_clear(KEY_DICTATE); break; case 0x0d9: map_key_clear(KEY_EMOJI_PICKER); break; diff --git a/include/uapi/linux/input-event-codes.h b/include/uapi/linux/input-event-codes.h index 7989d9483ea7..ef392d0f943f 100644 --- a/include/uapi/linux/input-event-codes.h +++ b/include/uapi/linux/input-event-codes.h @@ -614,6 +614,9 @@ #define KEY_KBD_LAYOUT_NEXT 0x248 /* AC Next Keyboard Layout Select */ #define KEY_EMOJI_PICKER 0x249 /* Show/hide emoji picker (HUTRR101) */ #define KEY_DICTATE 0x24a /* Start or Stop Voice Dictation Session (HUTRR99) */ +#define KEY_CAMERA_ACCESS_ENABLE 0x24b /* Enables programmatic access to camera devices. (HUTRR72) */ +#define KEY_CAMERA_ACCESS_DISABLE 0x24c /* Disables programmatic access to camera devices. (HUTRR72) */ +#define KEY_CAMERA_ACCESS_TOGGLE 0x24d /* Toggles the current state of the camera access control. (HUTRR72) */ #define KEY_BRIGHTNESS_MIN 0x250 /* Set Brightness to Minimum */ #define KEY_BRIGHTNESS_MAX 0x251 /* Set Brightness to Maximum */ From patchwork Sat Oct 29 12:03:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Eray_Or=C3=A7unus?= X-Patchwork-Id: 12690 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1314832wru; Sat, 29 Oct 2022 05:06:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM5GNJvcyM8LD/LMXtDI0Ijf2a0oxmlliK0Ecv8caElHFBJBbIGBSb3HqiqSltaQeEevcjb7 X-Received: by 2002:a17:906:9bc8:b0:7ad:7e6a:50ac with SMTP id de8-20020a1709069bc800b007ad7e6a50acmr3779642ejc.66.1667045193810; Sat, 29 Oct 2022 05:06:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667045193; cv=none; d=google.com; s=arc-20160816; b=dnZZR4xArImMIdoBtNoK5oHgH0EGHkq99xB4HZDpKIS+0B3dBUQAl56cY8cejQLwv/ HSD4gnrRHdGDOaZqESwx42cf9VbT03ZANcOFF9c4GHEbyrvGHmI0pgRY9TBOdo6XV68D t4oeazfWjr/tMfuyqQP3026kY249NVhRRvG55NTeFSmyfh3DU2mi9mAlCNGKsNbmVG82 Ctu+IQTCU6EjAbWtBPsfMbFytwqzRA23Pd6gfwmBtdo+CxQvYZHzBTnX+/lbHjIhqUby EX1pPAk0emtjDBJlgOtDxhiKDKimP054vA6hlnzu9Kzni6lMktiVJt8q0Hxf3RyVOAJU upOg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=dxceK4h9km4GtO20VnsGtzfG02HWM3iZYATl3ehVRaM=; b=c2d5+gC/+UxNYfOlKrqMzl4PDVbnldCIB/c3GXa2srtF0fsQuS9NpNA+3oVZberVeN QqALYLSClfvZg82AzE842Eui1BE3WGJ60kmoaLgMHPQSrkDCGnsM47inxXI3WC5mqvzz U5beevHvYDAK9xae1jF2onGaOap2qdgM8/pkWe8jhPuD9qlBB7i0F9VWjklIzU00bDil 5WKQdi0VJYRM9mzjPTZjlxATMPpFaC6847RBaKv4pX1LnxaCNY4UQ+G1YJ7UlUGEhCxC GfZTnCGZXnN4QvHCWsBCs+N+63KyroxtfbT6SQ45UGmWJBULwTj8U7XZevhbu970AWLF Hp1A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=FWIbQyJh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id l13-20020a056402254d00b00460ce6c3a1asi1579909edb.454.2022.10.29.05.06.09; Sat, 29 Oct 2022 05:06:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=FWIbQyJh; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229866AbiJ2MEs (ORCPT + 99 others); Sat, 29 Oct 2022 08:04:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33878 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229833AbiJ2MEo (ORCPT ); Sat, 29 Oct 2022 08:04:44 -0400 Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 132F8A449; Sat, 29 Oct 2022 05:04:29 -0700 (PDT) Received: by mail-wm1-x32d.google.com with SMTP id fn7-20020a05600c688700b003b4fb113b86so5372101wmb.0; Sat, 29 Oct 2022 05:04:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=dxceK4h9km4GtO20VnsGtzfG02HWM3iZYATl3ehVRaM=; b=FWIbQyJhzY7HCJanl24skL2GSGNxq6sAVg1aer2Wqb/acbszlNYVkq16F4OOMoq+AV xMNccTxQ+q7rgmZjvE2ShT+0gMS1adXEw1HeBWvAd/DmL9jmKRRSyuYElTFIin6kkcwL ovzthrlffpvRDpQ86beWWHGFCehKjlv3ccF/S4Eq/UfJgSyqg2myipJ5+er06pBnjbSL 1U8gWIXIB2AhyjEqWG+HMNxitZr+YRnXbwCaZ8rRHNrxjaDGIEVE5LLzLfsS/UepvZ27 a3uMEE+M/jJaY9DgSfhlKLeX708197Ah67A3s9zkJzBI0DukTBtxmIHYnQGPNrSIShY4 4T4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=dxceK4h9km4GtO20VnsGtzfG02HWM3iZYATl3ehVRaM=; b=VdTDVHe3hyWhjJL6BBWg9jFjOYUCnb0r3aD0XQ6MCJvXl52haigNlaeLNmFeKXW17k r1NXHUG7WWjYxigOh/YHiH/hkuOcMCgyw6Rft8v1oC+k07zIZzPQYL/StEefYlhltflA 8m3t54v1p/dUDKI/36NnAMqnAcTQrIqy4J2CnIw0dJ5WD2LuXqf6kQzSCgE9KXGA3jPR FfUvNEgIzilVJ+KqkAgznxa27s6eXY+kjJRdOKozD0g+7so7+A87aXbBnCTLkaaQei6S 2PVzj35mFfxagOvoXsEmP6C8qO6/PNK4KPzRJ6TMWbiitSQbljlinNWnMbzsJAe6lFhr DXkQ== X-Gm-Message-State: ACrzQf3pPhjDH2WAR+hE4UbUb8qOIDrBc00Ax8oaG7zD8Ln5GD+Cr8qx E5UkLkJ/V2SR/g4Y+J/nQYGsIJbKf7BUTQ== X-Received: by 2002:a05:600c:4f87:b0:3cf:693b:3386 with SMTP id n7-20020a05600c4f8700b003cf693b3386mr876608wmq.55.1667045067861; Sat, 29 Oct 2022 05:04:27 -0700 (PDT) Received: from eray-Lenovo-Z50-70.. ([188.132.247.187]) by smtp.googlemail.com with ESMTPSA id z17-20020a05600c0a1100b003b492753826sm1472439wmp.43.2022.10.29.05.04.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 Oct 2022 05:04:27 -0700 (PDT) From: =?utf-8?q?Eray_Or=C3=A7unus?= To: platform-driver-x86@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, ike.pan@canonical.com, jikos@kernel.org, benjamin.tissoires@redhat.com, dmitry.torokhov@gmail.com, hdegoede@redhat.com, mgross@linux.intel.com, pobrn@protonmail.com, =?utf-8?q?Eray_Or=C3=A7unus?= Subject: [PATCH v2 3/7] platform/x86: ideapad-laptop: Report KEY_CAMERA_ACCESS_TOGGLE instead of KEY_CAMERA Date: Sat, 29 Oct 2022 15:03:08 +0300 Message-Id: <20221029120311.11152-4-erayorcunus@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221029120311.11152-1-erayorcunus@gmail.com> References: <20221029120311.11152-1-erayorcunus@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748023581444800901?= X-GMAIL-MSGID: =?utf-8?q?1748023581444800901?= Reporting KEY_CAMERA when pressing camera switch key is wrong, since KEY_CAMERA is supposed to be used for taking snapshot. Change it with KEY_CAMERA_ACCESS_TOGGLE, so user-space can act correctly. This patch needs KEY_CAMERA_ACCESS_TOGGLE to be defined, thus depends on "HID: add mapping for camera access keys" patch. Signed-off-by: Eray Orçunus --- drivers/platform/x86/ideapad-laptop.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c index b67bac457a7a..0ef40b88b240 100644 --- a/drivers/platform/x86/ideapad-laptop.c +++ b/drivers/platform/x86/ideapad-laptop.c @@ -1038,7 +1038,7 @@ static void ideapad_sysfs_exit(struct ideapad_private *priv) */ static const struct key_entry ideapad_keymap[] = { { KE_KEY, 6, { KEY_SWITCHVIDEOMODE } }, - { KE_KEY, 7, { KEY_CAMERA } }, + { KE_KEY, 7, { KEY_CAMERA_ACCESS_TOGGLE } }, { KE_KEY, 8, { KEY_MICMUTE } }, { KE_KEY, 11, { KEY_F16 } }, { KE_KEY, 13, { KEY_WLAN } }, From patchwork Sat Oct 29 12:03:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Eray_Or=C3=A7unus?= X-Patchwork-Id: 12692 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1315196wru; Sat, 29 Oct 2022 05:07:12 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4Ke2QOu1TkyI56NybVEEZYBiAS0ylKzE+1BGn7RYctxI+5CrJYA+nFz7Ed/U/5L6eJyyKK X-Received: by 2002:a05:6402:4312:b0:45c:c1e9:9dc8 with SMTP id m18-20020a056402431200b0045cc1e99dc8mr4018736edc.154.1667045232744; Sat, 29 Oct 2022 05:07:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667045232; cv=none; d=google.com; s=arc-20160816; b=SaqR/WuyL4JCZhRwwkRRwwvIrx9gM2cNlRmo7sjLNLbuMusHBPlmou4I+nOhsuvZFE dRF7YKjuRjPVLMUMG/wbwEa+WFBa4jOJq46VCPcT7l+DKCCngLrsPFAlKJ8KNHJFBqzN qXsv/rP4cxptG9mea5Rzhndt8MVZCfnT9fsoF6dLUi0/vGj3c/ybRbzKYXSuyho3qQUM hK/eA9CVYCf/jh5rbx/AHUhKGdTA4OIJQSRTyU+r/vnseUztCI2tS729+DM4YwT6uMkf dW4QFxfBmoYofwobtWw7i2K6Akcg5r5ZuFeE+RRoQtIePajKPHk1whvUHSP/NQ/DYpue dnsA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=ZJQTmtw1LKn8R21PdJOf+BsVQdKZOWcICNuuo0tryIQ=; b=EvW353BMsbxD0qZy4cCsWYz7ir+yqwnIawweVVnOTTE5J7F4UI02Uaqfi9UFFVzwnp zUP2CD59IxX3O/XZk/kLGAevAifLzRzaqIsz7xE18fooas/kYQsl6dXT5JEcNRQSWQHs 6Tb4mNmvTU0WBS3tkPKMIit1BHhMhNWvqSlTShO6UAAJGQTknWyN4NpvOs1m6xSjjW6H vGrmzzu/0qN9c5Esm+erwKuS5lCbDKaSg3JMguNxgVrpdXvbzzM9VuaXfwy3lIsGNS/8 oRd5ZrKXk/qz+lgh/0yc1q70cVt+HRgfa1nFMUaYW6TmRg7d0oPFHu4pz4ZVovTjt6yW Mt2A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=hj63AntO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dm19-20020a170907949300b007919f213511si1353851ejc.951.2022.10.29.05.06.48; Sat, 29 Oct 2022 05:07:12 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=hj63AntO; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229849AbiJ2MEq (ORCPT + 99 others); Sat, 29 Oct 2022 08:04:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229850AbiJ2MEn (ORCPT ); Sat, 29 Oct 2022 08:04:43 -0400 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35B401005C; Sat, 29 Oct 2022 05:04:32 -0700 (PDT) Received: by mail-wr1-x430.google.com with SMTP id j15so9730492wrq.3; Sat, 29 Oct 2022 05:04:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=ZJQTmtw1LKn8R21PdJOf+BsVQdKZOWcICNuuo0tryIQ=; b=hj63AntOayLxGuhmd58BTJfnSBtEsisiCc4yTtPlicPA/vqQRHwocJeXFMOZBBAUis OrGl0YhFMzlRDqEYYqWWMd2ipJb7mf8yB+DnMlbO5Mz5/j3woffowngqthtWzVDjbwX7 +M6l8hd/tf1kXrCsiBs0H8eJ5pOrkuyNAjGi/5ANOs+c/gMEbl/tUARRR/YOI0JnjXFt Ospy3Gl6sb59dTzyVYlp/YwJMsITljO61XAArV2qXP9yrqi277G3AGaaJsnXyK1ocJtB DegxftzOYqKeE1R2KpAGWhB3tbXOW/lC/Hjr87zDkRU1U1AsLyg+rhoW3aX6HCUGtkiL y98g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZJQTmtw1LKn8R21PdJOf+BsVQdKZOWcICNuuo0tryIQ=; b=1DJHjjefWCuhCke6r7ZIBjGE9X0lxUquEO5a3tvb5Q2tcJcqljYa+wi6s09imD90X7 H3haiRmvXxaUIjDL8RffC+BQfcXVbeARiuVtr+P3pF7ezE0Hb/mNRhngDuXxaLY/LxE+ bnGMSv+m9sVUExu8ewHy+nvsgTiVW+ZEK5lZAiXDNoLI+CE1Db+HVdBhmJNOFr/pQ6fr iIb1koG1Z8Gz3lmjCyj/QfdmPBFqrzq8OAKPabVMjGK0pQ6vC4jiE858DDaqpI/qK/C8 q7uHezxcDzurIGO1mYhas1fT2hm88IfD910djY+edcwz75NE7GSkjcb+QWu8EhrOVpvY 1PSg== X-Gm-Message-State: ACrzQf2TQ9TcOm/fL3t4rQ65pRSUH5kOD3ZPtrBacs5zmokZHEasnROt /evkSgKzJBJKYH56S02Qk6HyCCeLKZ4aWw== X-Received: by 2002:adf:dd4d:0:b0:236:6e72:be17 with SMTP id u13-20020adfdd4d000000b002366e72be17mr2138838wrm.460.1667045070606; Sat, 29 Oct 2022 05:04:30 -0700 (PDT) Received: from eray-Lenovo-Z50-70.. ([188.132.247.187]) by smtp.googlemail.com with ESMTPSA id z17-20020a05600c0a1100b003b492753826sm1472439wmp.43.2022.10.29.05.04.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 Oct 2022 05:04:30 -0700 (PDT) From: =?utf-8?q?Eray_Or=C3=A7unus?= To: platform-driver-x86@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, ike.pan@canonical.com, jikos@kernel.org, benjamin.tissoires@redhat.com, dmitry.torokhov@gmail.com, hdegoede@redhat.com, mgross@linux.intel.com, pobrn@protonmail.com, =?utf-8?q?Eray_Or=C3=A7unus?= Subject: [PATCH v2 4/7] platform/x86: ideapad-laptop: Add new _CFG bit numbers for future use Date: Sat, 29 Oct 2022 15:03:09 +0300 Message-Id: <20221029120311.11152-5-erayorcunus@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221029120311.11152-1-erayorcunus@gmail.com> References: <20221029120311.11152-1-erayorcunus@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748023622334598227?= X-GMAIL-MSGID: =?utf-8?q?1748023622334598227?= Later IdeaPads report various things in last 8 bits of _CFG, at least 5 of them represent supported on-screen-displays. Add those bit numbers to the enum, and use CFG_OSD_ as prefix of their names. Also expose the values of these bits to debugfs, since they can be useful. Signed-off-by: Eray Orçunus --- drivers/platform/x86/ideapad-laptop.c | 33 +++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c index 0ef40b88b240..f3d4f2beda07 100644 --- a/drivers/platform/x86/ideapad-laptop.c +++ b/drivers/platform/x86/ideapad-laptop.c @@ -46,10 +46,22 @@ static const char *const ideapad_wmi_fnesc_events[] = { #endif enum { - CFG_CAP_BT_BIT = 16, - CFG_CAP_3G_BIT = 17, - CFG_CAP_WIFI_BIT = 18, - CFG_CAP_CAM_BIT = 19, + CFG_CAP_BT_BIT = 16, + CFG_CAP_3G_BIT = 17, + CFG_CAP_WIFI_BIT = 18, + CFG_CAP_CAM_BIT = 19, + + /* + * These are OnScreenDisplay support bits that can be useful to determine + * whether a hotkey exists/should show OSD. But they aren't particularly + * meaningful since they were introduced later, i.e. 2010 IdeaPads + * don't have these, but they still have had OSD for hotkeys. + */ + CFG_OSD_NUMLK_BIT = 27, + CFG_OSD_CAPSLK_BIT = 28, + CFG_OSD_MICMUTE_BIT = 29, + CFG_OSD_TOUCHPAD_BIT = 30, + CFG_OSD_CAM_BIT = 31, }; enum { @@ -368,6 +380,19 @@ static int debugfs_cfg_show(struct seq_file *s, void *data) seq_puts(s, " camera"); seq_puts(s, "\n"); + seq_puts(s, "OSD support:"); + if (test_bit(CFG_OSD_NUMLK_BIT, &priv->cfg)) + seq_puts(s, " num-lock"); + if (test_bit(CFG_OSD_CAPSLK_BIT, &priv->cfg)) + seq_puts(s, " caps-lock"); + if (test_bit(CFG_OSD_MICMUTE_BIT, &priv->cfg)) + seq_puts(s, " mic-mute"); + if (test_bit(CFG_OSD_TOUCHPAD_BIT, &priv->cfg)) + seq_puts(s, " touchpad"); + if (test_bit(CFG_OSD_CAM_BIT, &priv->cfg)) + seq_puts(s, " camera"); + seq_puts(s, "\n"); + seq_puts(s, "Graphics: "); switch (priv->cfg & 0x700) { case 0x100: From patchwork Sat Oct 29 12:03:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Eray_Or=C3=A7unus?= X-Patchwork-Id: 12693 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1315298wru; Sat, 29 Oct 2022 05:07:25 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7JepxjE9pSFZDoqf3Ne1mv7V/adWQ+yIpVA63d6Zv1BLLge4j5SNPcm5fr1VdvoW98pu6n X-Received: by 2002:a17:906:3607:b0:7ad:a798:cdc0 with SMTP id q7-20020a170906360700b007ada798cdc0mr3547556ejb.357.1667045245659; Sat, 29 Oct 2022 05:07:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667045245; cv=none; d=google.com; s=arc-20160816; b=udcX6ZiGPEExXHHbtm6Alcifzm61h3LA7oDO9ykyq8gNbelmQl6Vcw8uBo5JfOXXDa R4n70wd4GKN+Nod45bPDKsSe3MuJRNUXHav5Dxq7rBkgIWcWg+KZfdV7+8pQowtdtmmi 8waq/PfXgSTZj2pnzXfupMrjonntjyANFDlBO5hQN/85qAz2wiWxBZ+0vkzdDTyMBVA7 ns5EkpYCMujtRfi9M66Hpei90KJw9eX48PGNJT7HA7K7Jhfd756otg2HlThgaCj056o1 j/aJrj2O/R/0Wjs+c0xV7tcs3Nd3BNXuS+elkbVhNWrh//34x4qjyzfsInIIXTwBJvVJ dnjw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=wGXCA0Znhtrtl7WIWCmuh0pNAj0t973nks/+SqSOkMk=; b=oXQuRVl9M7Cb9dLqoCRfAAHxMudR/C5iMG8Fxbzpz/8USaCrzF4wYvsyLHiw/sE0SU Wo6XjwTSz9JYMl/B10s3klmCQabC9hrPZhouHRZ9JLV9whSn5IYOkbaoSc+GBOCG7s6u 6jdDHXNs1jSmfWVrBXZaqDcLl+ZEMh7HxEatEpLX9lxYpFZxnLf4Q5ZyXFLGG2Egv+Zq EC2El3Q7ThsbqTPjSJ7yYfyeoXjLVbAJJ6qy8ZDL1uLQ8/iGEYn9DcDmlgWdV2s6n1Oz ANBTVWdOAUfWSzkuzwohfODJcJg1EeaHVpT9GqSXryMiHcXcW02qMFHRaFuL4mjQjGmP fsjw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Kq8d9swE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id be16-20020a0564021a3000b00462bd784df2si1271631edb.542.2022.10.29.05.07.01; Sat, 29 Oct 2022 05:07:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Kq8d9swE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229767AbiJ2MFG (ORCPT + 99 others); Sat, 29 Oct 2022 08:05:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229875AbiJ2ME6 (ORCPT ); Sat, 29 Oct 2022 08:04:58 -0400 Received: from mail-wr1-x430.google.com (mail-wr1-x430.google.com [IPv6:2a00:1450:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 59F56264D; Sat, 29 Oct 2022 05:04:34 -0700 (PDT) Received: by mail-wr1-x430.google.com with SMTP id k8so9742786wrh.1; Sat, 29 Oct 2022 05:04:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=wGXCA0Znhtrtl7WIWCmuh0pNAj0t973nks/+SqSOkMk=; b=Kq8d9swEZJC+nW0K/BpjOuYHo34ZPHFZEu1GdCBJ2Ryp6xRclVEF8I5xy5YRvHJkea Zc3lRb5iduKxGyXp5ZVk90Qt6j1cLtyfl69DYFhj/P5dLwu0AbkBWyOJunzG14QgX+ZR UpuXyr3ukJ/J+uv2Hq2eBNlWGFH67LA+aU/L3pDs8JBiXiIq9M1SfwptnHLJqHyWEilr EHIhivbySeLMFSwx2a7hSPIiKQqPEtKpbqbQ+EbiElZ+Jk3upszJSrN0k5E5417rgK/L qwIktXArFlXrqJrtW4jGoMQ4bXI0igdrJ7b+Gut0bglwfLP9DLWSoUQCvrSvUfyyV7o/ +Dkw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=wGXCA0Znhtrtl7WIWCmuh0pNAj0t973nks/+SqSOkMk=; b=uJ06JhYMcyuRTo7XWFD2yrE9g3tLZ9EBCQQ/ltLHgruNMydvPpl/Dqvw8ttKobtZND jq/8xVfV6X8bWl54WAzPI6uIEvScatBHj/wJcI/rHBPOwWv2gPjTAJlhkYFObBAFOSOM crOVkY6dhnsh/A6qxwp+aCBZfzshBr3qaIINJ9AP90Q4xhw1s921IfSkZZU5EdK4Za7e MEjZ0G06OvJR75japOK6ztNmNAo2CXPiaVfpEdff16rRCsFPLaSNcowq/mfVfDKm5Mng CoVTT1BDx6WcXP+xrQGslniocg/VYDFMluvL1/g7b/2b+CshF4xrueMMVqefCfHyoIsV OPPA== X-Gm-Message-State: ACrzQf31u6Wcpaz7Fc3RqZ1n1y35UpzQKcPoWTRD7JYS2Vy+A9q1/C3S HKvnolSAvCS9SwKuB49iWSeCYTSJkAAicg== X-Received: by 2002:a05:6000:184:b0:236:7685:7e6d with SMTP id p4-20020a056000018400b0023676857e6dmr2196773wrx.305.1667045073003; Sat, 29 Oct 2022 05:04:33 -0700 (PDT) Received: from eray-Lenovo-Z50-70.. ([188.132.247.187]) by smtp.googlemail.com with ESMTPSA id z17-20020a05600c0a1100b003b492753826sm1472439wmp.43.2022.10.29.05.04.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 Oct 2022 05:04:32 -0700 (PDT) From: =?utf-8?q?Eray_Or=C3=A7unus?= To: platform-driver-x86@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, ike.pan@canonical.com, jikos@kernel.org, benjamin.tissoires@redhat.com, dmitry.torokhov@gmail.com, hdegoede@redhat.com, mgross@linux.intel.com, pobrn@protonmail.com, =?utf-8?q?Eray_Or=C3=A7unus?= Subject: [PATCH v2 5/7] platform/x86: ideapad-laptop: Expose camera_power only if supported Date: Sat, 29 Oct 2022 15:03:10 +0300 Message-Id: <20221029120311.11152-6-erayorcunus@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221029120311.11152-1-erayorcunus@gmail.com> References: <20221029120311.11152-1-erayorcunus@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748023635492744820?= X-GMAIL-MSGID: =?utf-8?q?1748023635492744820?= IdeaPads dropped support for VPCCMD_W_CAMERA somewhere between 2014-2016, none of the IdeaPads produced after that I tested supports it. Fortunately I found a way to check it; if the DSDT has camera device(s) defined, it shouldn't have working VPCCMD_W_CAMERA, thus camera_power shouldn't be exposed to sysfs. To accomplish this, walk the ACPI namespace in ideapad_check_features and check the devices starting with "CAM". Tested on 520-15IKB and Legion Y520, which successfully didn't expose the camera_power attribute. Link: https://www.spinics.net/lists/platform-driver-x86/msg26147.html Signed-off-by: Eray Orçunus --- drivers/platform/x86/ideapad-laptop.c | 52 ++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c index f3d4f2beda07..e8c088e7a53d 100644 --- a/drivers/platform/x86/ideapad-laptop.c +++ b/drivers/platform/x86/ideapad-laptop.c @@ -149,6 +149,7 @@ struct ideapad_private { bool fn_lock : 1; bool hw_rfkill_switch : 1; bool kbd_bl : 1; + bool cam_ctrl_via_ec : 1; bool touchpad_ctrl_via_ec : 1; bool usb_charging : 1; } features; @@ -163,6 +164,24 @@ static bool no_bt_rfkill; module_param(no_bt_rfkill, bool, 0444); MODULE_PARM_DESC(no_bt_rfkill, "No rfkill for bluetooth."); +static acpi_status acpi_find_device_callback(acpi_handle handle, u32 level, + void *context, void **return_value) +{ + struct acpi_buffer ret_buf; + char buffer[8]; + + ret_buf.length = sizeof(buffer); + ret_buf.pointer = buffer; + + if (ACPI_SUCCESS(acpi_get_name(handle, ACPI_SINGLE_NAME, &ret_buf))) + if (strstarts(ret_buf.pointer, context)) { + *return_value = handle; + return AE_CTRL_TERMINATE; + } + + return AE_OK; +} + /* * ACPI Helpers */ @@ -675,7 +694,7 @@ static umode_t ideapad_is_visible(struct kobject *kobj, bool supported = true; if (attr == &dev_attr_camera_power.attr) - supported = test_bit(CFG_CAP_CAM_BIT, &priv->cfg); + supported = priv->features.cam_ctrl_via_ec; else if (attr == &dev_attr_conservation_mode.attr) supported = priv->features.conservation_mode; else if (attr == &dev_attr_fan_mode.attr) @@ -1527,6 +1546,37 @@ static void ideapad_check_features(struct ideapad_private *priv) priv->features.hw_rfkill_switch = dmi_check_system(hw_rfkill_list); + /* + * Some IdeaPads have camera switch via EC (mostly older ones), + * some don't. Fortunately we know that if DSDT contains device + * object for the camera, camera isn't switchable via EC. + * So, let's walk the namespace and try to find CAM* object. + * If we can't find it, set cam_ctrl_via_ec to true. + */ + + priv->features.cam_ctrl_via_ec = false; + + if (test_bit(CFG_CAP_CAM_BIT, &priv->cfg)) { + acpi_handle temp_handle = NULL; + acpi_handle pci_handle; + acpi_status status; + + status = acpi_get_handle(handle, "^^^", &pci_handle); + if (ACPI_SUCCESS(status)) { + status = acpi_walk_namespace(ACPI_TYPE_DEVICE, pci_handle, + ACPI_UINT32_MAX, + acpi_find_device_callback, + NULL, "CAM", + &temp_handle); + + if (ACPI_SUCCESS(status) && temp_handle == NULL) + priv->features.cam_ctrl_via_ec = true; + + } else + dev_warn(&priv->platform_device->dev, + "Could not find PCI* node in the namespace\n"); + } + /* Most ideapads with ELAN0634 touchpad don't use EC touchpad switch */ priv->features.touchpad_ctrl_via_ec = !acpi_dev_present("ELAN0634", NULL, -1); From patchwork Sat Oct 29 12:03:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Eray_Or=C3=A7unus?= X-Patchwork-Id: 12694 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1315372wru; Sat, 29 Oct 2022 05:07:34 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4CbVB8CYliLOm29l9IIAeQqAjvFw28Ib4soS+g0rtfWQd3G1E9+P5/dznm6FXpF1WIeivX X-Received: by 2002:a17:906:6a18:b0:78d:7228:7a52 with SMTP id qw24-20020a1709066a1800b0078d72287a52mr3587636ejc.363.1667045253955; Sat, 29 Oct 2022 05:07:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667045253; cv=none; d=google.com; s=arc-20160816; b=y0Z7aECJLgJDd7lTPpobtGlp6wHOaGlTaRdEvvFg4OFhGrMxPXkb0O2WaN/KBHsxPv Qn+ydMpY+D3G/xRPDbIJly46vcfS6Z9OiSRldbuRbHxMwYr5RjuisqGiWstukguA551A i6dSJNm9XVKA8BdRDfNwnHNQD6vYb+LlPYmPulgZaocIkRqElej04Eg05HARve99wYGY nLuwf+Kb/gCq8Hh6AvD0WNHx9WLJ1DzfcOtJacx+2nLYzj56KhwqccKKKEnzxaLW2mk8 TstMli46laVt9t7mbx4PolkYuK6ab5h236xhm4rXS5uvPShRRF11y4b8Sk/SlEk3IcVO VCbg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=t0H3gS6ENUsKWeShTc04Oxh9TJLnxL4twvq+6xgLItU=; b=A6ht278uxgrOe7peMexLOkzhL8QAelb9QNS7rn+d9zPYZOQgwActVicelWKSmOHKLK FWH6Gy+TloeRgptp3e6LtdsJjUyX9N6md1yYaImAxpz+JY8NtsjSVvK9/3u4/P2Mq2ko ifX5jHR+gvZl9he2SJm3vhukLWy5/fUwxObaF1wMkt4pY2INmIbOOV20cuGQh7gjw5Mk ZuyYFqqtBFawnqaHwjEloJuI4B11ZJy3/iw2suf73RFGeCooSZ8mbPNoxL6GYMhsebia v3C/Ifbl8WUvrw2o0g4ci6u9+/vbWG6H9nPIjmY4vr+Sgo+nQUJEDuc22pdBPm0uO21/ 8Vsw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=qmjvl3Yw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id a13-20020a50e70d000000b00461d02225a3si1418274edn.448.2022.10.29.05.07.10; Sat, 29 Oct 2022 05:07:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=qmjvl3Yw; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229954AbiJ2MFM (ORCPT + 99 others); Sat, 29 Oct 2022 08:05:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35048 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229900AbiJ2ME7 (ORCPT ); Sat, 29 Oct 2022 08:04:59 -0400 Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9D62113DFA; Sat, 29 Oct 2022 05:04:37 -0700 (PDT) Received: by mail-wr1-x435.google.com with SMTP id k8so9742877wrh.1; Sat, 29 Oct 2022 05:04:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=t0H3gS6ENUsKWeShTc04Oxh9TJLnxL4twvq+6xgLItU=; b=qmjvl3YwbZ9mkYjbQnkigZC7V3qmEQ2UkKRzeSCA2PEwioQMDglgswpCaUnqSfH9Xc 3j5TVf51w7mEQcoFE8Gn2UqEGZNW1D/TCM635RxBGHovBX3n776hU4C8kyzKTO7BQ7IL LXxys5AXgm6dTws9lozGV9I+zF0lLsIKSLvAYtPWDC9aRFE7DnwHl9sLDfY88+2CM0Mu AmpmlSJa6xnU52SXAOa9eYXUvGfNH/B2k69svh5tiFZRSGkqoe2bvWdTAzLMhhJkMDOS nNiJTZYwHuRWx27K+gLFTKkFS03rPTKMeja5i0uNUePqfoN3znGR/KbTMMoXrfA2Dp+6 Du3Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=t0H3gS6ENUsKWeShTc04Oxh9TJLnxL4twvq+6xgLItU=; b=omOXRDDqNj5p4KM7H2e6CZDgsZuogpsQAu6tqvrmHLzLSyggskuJa1vvGLcyyixEZI Hu384tYWB45bZOQFd5JMFGrBCO/t6av8FlShgSN5gcwIqZJ9nKOUBD2rDEEtIKEpZPR+ IK35EIfw1urGmaABHnRNbByhDdfGNQLEQtOGu9ADf8OSg0pRqA323pnvcWNDE17Ene8z 6E9UehiofAyupnl0qYzmawufnQ4P3H20htKH4fJ9DIxcgadzKmZ8KDvE61OuI5avy/AO 0KDj7S8D3/Iy0gWiKShxX93AsOVmmoly8Xpq97uNz0qdoTn/F1VgG+F/8OQTT3/QfvMR tR/g== X-Gm-Message-State: ACrzQf01XlAzBiHIR+j67OXAQvuPucdnY5eqkVsMm5NffDoIyDoL2He+ T4VZ972K+PQPd9owpgPfnkm8tEqXf6WyPg== X-Received: by 2002:adf:e38d:0:b0:236:7217:827e with SMTP id e13-20020adfe38d000000b002367217827emr2283094wrm.652.1667045075620; Sat, 29 Oct 2022 05:04:35 -0700 (PDT) Received: from eray-Lenovo-Z50-70.. ([188.132.247.187]) by smtp.googlemail.com with ESMTPSA id z17-20020a05600c0a1100b003b492753826sm1472439wmp.43.2022.10.29.05.04.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 Oct 2022 05:04:35 -0700 (PDT) From: =?utf-8?q?Eray_Or=C3=A7unus?= To: platform-driver-x86@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, ike.pan@canonical.com, jikos@kernel.org, benjamin.tissoires@redhat.com, dmitry.torokhov@gmail.com, hdegoede@redhat.com, mgross@linux.intel.com, pobrn@protonmail.com, =?utf-8?q?Eray_Or=C3=A7unus?= Subject: [PATCH v2 6/7] platform/x86: ideapad-laptop: Keyboard backlight support for more IdeaPads Date: Sat, 29 Oct 2022 15:03:11 +0300 Message-Id: <20221029120311.11152-7-erayorcunus@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221029120311.11152-1-erayorcunus@gmail.com> References: <20221029120311.11152-1-erayorcunus@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748023644114471828?= X-GMAIL-MSGID: =?utf-8?q?1748023644114471828?= IdeaPads with HALS_KBD_BL_SUPPORT_BIT have full keyboard light support, and they send an event via ACPI on light state change. Whereas some IdeaPads that don't have this bit set, i.e. 520-15ikb, 330-17ich and 5 (15), don't send an event, yet they still support switching keyboard light via KBLO object on DSDT. Detect these IdeaPads with searching for KBLO object, set their kbd_bl_partial to true and register led device for them. Tested on 520-15ikb. Signed-off-by: Eray Orçunus --- drivers/platform/x86/ideapad-laptop.c | 79 ++++++++++++++++++++++++--- 1 file changed, 70 insertions(+), 9 deletions(-) diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c index e8c088e7a53d..b34fbc4d741c 100644 --- a/drivers/platform/x86/ideapad-laptop.c +++ b/drivers/platform/x86/ideapad-laptop.c @@ -149,6 +149,7 @@ struct ideapad_private { bool fn_lock : 1; bool hw_rfkill_switch : 1; bool kbd_bl : 1; + bool kbd_bl_partial : 1; bool cam_ctrl_via_ec : 1; bool touchpad_ctrl_via_ec : 1; bool usb_charging : 1; @@ -157,6 +158,9 @@ struct ideapad_private { bool initialized; struct led_classdev led; unsigned int last_brightness; + /* Below are used only if kbd_bl_partial is set */ + acpi_handle lfcm_mutex; + acpi_handle kblo_obj; } kbd_bl; }; @@ -1300,19 +1304,52 @@ static void ideapad_backlight_notify_brightness(struct ideapad_private *priv) backlight_force_update(priv->blightdev, BACKLIGHT_UPDATE_HOTKEY); } +#define IDEAPAD_ACPI_MUTEX_TIMEOUT 1500 + /* * keyboard backlight */ static int ideapad_kbd_bl_brightness_get(struct ideapad_private *priv) { - unsigned long hals; + unsigned long ret_val; int err; + acpi_status status; - err = eval_hals(priv->adev->handle, &hals); + /* + * Some IdeaPads with partially implemented keyboard lights don't give + * us the light state on HALS_KBD_BL_STATE_BIT in the return value of HALS, + * i.e. 5 (15) and 330-17ich. Fortunately we know how to gather it. + * Even if it won't work, we will still give HALS a try, because + * some IdeaPads with kbd_bl_partial, i.e. 520-15ikb, + * correctly sets HALS_KBD_BL_STATE_BIT in HALS return value. + */ + + if (priv->features.kbd_bl_partial && + priv->kbd_bl.lfcm_mutex != NULL && priv->kbd_bl.kblo_obj != NULL) { + + status = acpi_acquire_mutex(priv->kbd_bl.lfcm_mutex, NULL, + IDEAPAD_ACPI_MUTEX_TIMEOUT); + + if (ACPI_SUCCESS(status)) { + err = eval_int(priv->kbd_bl.kblo_obj, NULL, &ret_val); + + status = acpi_release_mutex(priv->kbd_bl.lfcm_mutex, NULL); + if (ACPI_FAILURE(status)) + dev_err(&priv->platform_device->dev, + "Failed to release LFCM mutex"); + + if (err) + return err; + + return !!ret_val; + } + } + + err = eval_hals(priv->adev->handle, &ret_val); if (err) return err; - return !!test_bit(HALS_KBD_BL_STATE_BIT, &hals); + return !!test_bit(HALS_KBD_BL_STATE_BIT, &ret_val); } static enum led_brightness ideapad_kbd_bl_led_cdev_brightness_get(struct led_classdev *led_cdev) @@ -1329,7 +1366,8 @@ static int ideapad_kbd_bl_brightness_set(struct ideapad_private *priv, unsigned if (err) return err; - priv->kbd_bl.last_brightness = brightness; + if (!priv->features.kbd_bl_partial) + priv->kbd_bl.last_brightness = brightness; return 0; } @@ -1349,6 +1387,9 @@ static void ideapad_kbd_bl_notify(struct ideapad_private *priv) if (!priv->kbd_bl.initialized) return; + if (priv->features.kbd_bl_partial) + return; + brightness = ideapad_kbd_bl_brightness_get(priv); if (brightness < 0) return; @@ -1371,17 +1412,20 @@ static int ideapad_kbd_bl_init(struct ideapad_private *priv) if (WARN_ON(priv->kbd_bl.initialized)) return -EEXIST; - brightness = ideapad_kbd_bl_brightness_get(priv); - if (brightness < 0) - return brightness; + /* IdeaPads with kbd_bl_partial don't have keyboard backlight event */ + if (!priv->features.kbd_bl_partial) { + brightness = ideapad_kbd_bl_brightness_get(priv); + if (brightness < 0) + return brightness; - priv->kbd_bl.last_brightness = brightness; + priv->kbd_bl.last_brightness = brightness; + priv->kbd_bl.led.flags = LED_BRIGHT_HW_CHANGED; + } priv->kbd_bl.led.name = "platform::" LED_FUNCTION_KBD_BACKLIGHT; priv->kbd_bl.led.max_brightness = 1; priv->kbd_bl.led.brightness_get = ideapad_kbd_bl_led_cdev_brightness_get; priv->kbd_bl.led.brightness_set_blocking = ideapad_kbd_bl_led_cdev_brightness_set; - priv->kbd_bl.led.flags = LED_BRIGHT_HW_CHANGED; err = led_classdev_register(&priv->platform_device->dev, &priv->kbd_bl.led); if (err) @@ -1594,8 +1638,25 @@ static void ideapad_check_features(struct ideapad_private *priv) if (test_bit(HALS_FNLOCK_SUPPORT_BIT, &val)) priv->features.fn_lock = true; + /* + * IdeaPads with HALS_KBD_BL_SUPPORT_BIT have full keyboard + * light support, and they send an event via ACPI on light + * state change. Whereas some IdeaPads, at least 520-15ikb + * and 5 (15), don't send an event, yet they still have + * KBLO object. In this case, set kbd_bl_partial to true + * and cache the LFCM mutex, it might be useful while + * getting the brightness. + */ + if (test_bit(HALS_KBD_BL_SUPPORT_BIT, &val)) priv->features.kbd_bl = true; + else if (ACPI_SUCCESS(acpi_get_handle(handle, "^KBLO", + &priv->kbd_bl.kblo_obj))) { + priv->features.kbd_bl = true; + priv->features.kbd_bl_partial = true; + (void)acpi_get_handle(handle, "^LFCM", + &priv->kbd_bl.lfcm_mutex); + } if (test_bit(HALS_USB_CHARGING_SUPPORT_BIT, &val)) priv->features.usb_charging = true; From patchwork Sat Oct 29 12:03:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Eray_Or=C3=A7unus?= X-Patchwork-Id: 12691 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp1315067wru; Sat, 29 Oct 2022 05:06:59 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7Gh+3vHOZZ17N1fRiVhXwlsg0CQY0dAgVv/g/inBJmCl9DA7VymEVJ4FrVGvkd5vWxo77N X-Received: by 2002:a17:907:7d8b:b0:78e:2534:4fd3 with SMTP id oz11-20020a1709077d8b00b0078e25344fd3mr3715434ejc.141.1667045219562; Sat, 29 Oct 2022 05:06:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667045219; cv=none; d=google.com; s=arc-20160816; b=UJhrIhz6n0XO7bzV1dp7gmrFMUHICVDpP8vOsR3BRbYLXLEAJQ6VW8JIwrI9jNGf4k 4ROci6KmsuHkgLuMxUBK2LGvINmyLRFf3WQfrFUd0J3gEebFSYFFcBnz2/Z50+dCh4UE h+cij5v+FETSczi/OZ0RBVN6tYee0y7kLf4Twhk8MYVsBCQgv8RYWZgTJFeYpVQc8amT e8zmYy4aUdrD72gw35csEKCB7P5779rkmb7quXFImmausZt75TK0FzwJvscc++utmQ2O b4tMALLhfczY4npMU86gLUsvMIlvqY/dqJXmYBw5E1O3ORbQsQpwmq0OldtoFRdXr+Ne bUYg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=DYj6Sp/cMz1QQGhnefYTJGzG4F2mZ1RWGEdTPlv3qKQ=; b=t3bavGevbNJwLFsEF2pIiHYRVlZnbJ6yT2JdpKUNqEfjWDqC00gJOA8kDemBU8OS5j 3cKFwuWD/5k6qkH/ea7711HpML6DWA7reVBSu9M+G7ZeNrvo/8OoLWlVJh9Ge/mynjXl kxrKGP1kTRqSxcBpp6RHB0wqEZc/9VGFvD7RdzHgLDdyzIVgCZSSWuWccmoavUjacsFc qFBc83WjvU5nI3UYiIIl1CB7eWISkqEi0E8nzJXh7quARcKr57Z0/FLTok+oOcxPmHv9 QSOMrz9cGwj5naVzXheG89rQbfXwpryDhoTkcThhjpPYz3Jej0ETi/mAJ88aoandF2pp mUZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=dBztWbMd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sz15-20020a1709078b0f00b0078c47b4478esi1062522ejc.106.2022.10.29.05.06.35; Sat, 29 Oct 2022 05:06:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=dBztWbMd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229893AbiJ2MFE (ORCPT + 99 others); Sat, 29 Oct 2022 08:05:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34982 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229891AbiJ2ME6 (ORCPT ); Sat, 29 Oct 2022 08:04:58 -0400 Received: from mail-wr1-x436.google.com (mail-wr1-x436.google.com [IPv6:2a00:1450:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9FB7715FFC; Sat, 29 Oct 2022 05:04:39 -0700 (PDT) Received: by mail-wr1-x436.google.com with SMTP id y16so9680900wrt.12; Sat, 29 Oct 2022 05:04:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DYj6Sp/cMz1QQGhnefYTJGzG4F2mZ1RWGEdTPlv3qKQ=; b=dBztWbMdS8h8kYTzJohC6XiLtiEU7jiY2iKeUlLFpIZlu0uOolzIB3RdRmnLZHtImj tLHvzRD3/Kei173N7Am8Xd3FBCOk2VSiD2KnMI40kCIf1evjqtxSfVCDb8NK3KV6k3GW NPQ72X3AQ8lGxV9PnBDkjXJLYAtuVOTXqT4a5dzlBQ5AkQuLSkeUQ2Tl2gK4mOB/30zY USbqwfBMeki5H4LfiwLsGIBXFfbwCDWrBCcY12ciV3Dur6o4c7qMfkgYTf0wIr+y59Jg 0lD4NrWn9Jh3i2A0z3OTxlZnQQi6wkdeRLNP3GSD1psBn74q1oF+qTlQLanJRiBzS4e+ vdwQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DYj6Sp/cMz1QQGhnefYTJGzG4F2mZ1RWGEdTPlv3qKQ=; b=XDwYVbG9urlsdYnw4LwW6JnL6K4a4fSPRdyS/90bzI5idWoRfsu4phXrug2JezaZsq 38Z8ikewoZLT2kyBnx0+Ht4QnXWC1+4FTjPM4PHobZm0u1LwJkV98Jx4GGmMoIysopEy rE27bmUIk0dkUHYukcVCbOuedLY5ZFUrkNf3X5V/zTbNOe5UMUQQ03nWeFQuJX+ipczm thsno1AZjshBuA2aV4TuVQEF5z6T9s6ePAd7hMR51sgAiRsS9NjHx/gaWdIyov+JQeoM N8wZTCFVkwFDcylRAjgKNk81nZ/jspnGp3GSTxB8ZgoxzsW5lT3fIPFFSld2sYH4sFCv XCUA== X-Gm-Message-State: ACrzQf3005jQ/353c37hM22hQYh8upFUSspYlle+U3Ykp+IvJJzO9jMP Tc+xKlNpZQ9ievgEZrcg2Cy7+hKkSAXjwg== X-Received: by 2002:a5d:6484:0:b0:230:7cad:c268 with SMTP id o4-20020a5d6484000000b002307cadc268mr2294941wri.335.1667045077968; Sat, 29 Oct 2022 05:04:37 -0700 (PDT) Received: from eray-Lenovo-Z50-70.. ([188.132.247.187]) by smtp.googlemail.com with ESMTPSA id z17-20020a05600c0a1100b003b492753826sm1472439wmp.43.2022.10.29.05.04.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 29 Oct 2022 05:04:37 -0700 (PDT) From: =?utf-8?q?Eray_Or=C3=A7unus?= To: platform-driver-x86@vger.kernel.org Cc: linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, ike.pan@canonical.com, jikos@kernel.org, benjamin.tissoires@redhat.com, dmitry.torokhov@gmail.com, hdegoede@redhat.com, mgross@linux.intel.com, pobrn@protonmail.com, =?utf-8?q?Eray_Or=C3=A7unus?= Subject: [PATCH v2 7/7] platform/x86: ideapad-laptop: Don't expose touchpad attr on IdeaPads with SYNA2B33 Date: Sat, 29 Oct 2022 15:03:12 +0300 Message-Id: <20221029120311.11152-8-erayorcunus@gmail.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221029120311.11152-1-erayorcunus@gmail.com> References: <20221029120311.11152-1-erayorcunus@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748023608294329883?= X-GMAIL-MSGID: =?utf-8?q?1748023608294329883?= My 520-15IKB (2017) with SYNA2B33 doesn't have working VPCCMD_W_TOUCHPAD command - it's the touchpad program switches the touchpad instead on Windows. Considering all IdeaPads with SYNA2B33 touchpad produced in 2017/2018, it's very likely that none of the IdeaPads with SYNA2B33 support touchpad switching via EC. So let's add SYNA2B33 to the touchpads not switchable via EC. Signed-off-by: Eray Orçunus --- drivers/platform/x86/ideapad-laptop.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/platform/x86/ideapad-laptop.c b/drivers/platform/x86/ideapad-laptop.c index b34fbc4d741c..937126c62a14 100644 --- a/drivers/platform/x86/ideapad-laptop.c +++ b/drivers/platform/x86/ideapad-laptop.c @@ -1621,8 +1621,12 @@ static void ideapad_check_features(struct ideapad_private *priv) "Could not find PCI* node in the namespace\n"); } - /* Most ideapads with ELAN0634 touchpad don't use EC touchpad switch */ - priv->features.touchpad_ctrl_via_ec = !acpi_dev_present("ELAN0634", NULL, -1); + /* + * Most ideapads with ELAN0634 and SYNA2B33 touchpads don't use + * EC touchpad switch + */ + priv->features.touchpad_ctrl_via_ec = !acpi_dev_present("ELAN0634", NULL, -1) && + !acpi_dev_present("SYNA2B33", NULL, -1); if (!read_ec_data(handle, VPCCMD_R_FAN, &val)) priv->features.fan_mode = true;