From nobody Mon May 11 06:17:37 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 18720C4332F for ; Wed, 13 Apr 2022 03:33:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231566AbiDMDgE (ORCPT ); Tue, 12 Apr 2022 23:36:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34914 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231585AbiDMDgB (ORCPT ); Tue, 12 Apr 2022 23:36:01 -0400 Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B8D762603 for ; Tue, 12 Apr 2022 20:33:38 -0700 (PDT) Received: by mail-pl1-x62e.google.com with SMTP id p10so830370plf.9 for ; Tue, 12 Apr 2022 20:33:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=t5+17MwOfKkjlV7qFQ2T4jzjQQOl3tsJ8bcwnmeF1zs=; b=gbH9pYSjrXenr+hUMeYXKSMyWCpkwKnnto8bFtn/g1IZ1uI7kom4DXNkPWQSgFGQW5 by9E/tmsfTyEpyLgDkMsxkw6GAQJztqGH2edbwAAlvi2eU3wbhyZNwd+kfbQS3o9X146 tKxmkPIQ349/AiN2qc2+epD7kPXKjd8rsErwY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=t5+17MwOfKkjlV7qFQ2T4jzjQQOl3tsJ8bcwnmeF1zs=; b=2Zog+A8MJLKhojdrlM3gGTbDj9jC1CVr372bLap91EQ4smthCo6MGL4FbeAK71C5LL p30iALe0hd0YWNr9fOEbo+fbqu4YKoKHoR18QY5ZCSjf5GBF1XqCbmQYTGBpdUxnwiwA 4hyvkZvF0p1ybCK736dATrCYwpXhD+/JhUkmcQE/LWUrTwjF3xaOWLLwdUyFmWhToG34 LLAqSXq+Wnq/8RfahXCaA9yA+Cp6S7ZPKs06zT1Z6BknZ79268flFtUlQdK8aow8Ds9e Y3WQqL5ns7uirMUk8RfLt7n3gDbBz/CpmqpPFceNhYohzCHGuPU0AGAJT3Sn5govIImm lh6w== X-Gm-Message-State: AOAM531RdQvwwH9YQS35u288vS3nHkPYCZcManZD8Xk4iR4K+pcqC7D7 kL+h2Zoc+8utXUFQ9Vn65jo3/w== X-Google-Smtp-Source: ABdhPJw9jZo+lRdE1iLDIO0NPPq39p5vIfxagy7X9ANc7aXbHjJGphu1yS8zKqRb4HpQTnlksnxo4Q== X-Received: by 2002:a17:90a:8581:b0:1b2:7541:af6c with SMTP id m1-20020a17090a858100b001b27541af6cmr8534884pjn.48.1649820818315; Tue, 12 Apr 2022 20:33:38 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:201:87b3:e0ea:c924:6d1f]) by smtp.gmail.com with ESMTPSA id h10-20020a056a00230a00b004faa0f67c3esm39788276pfh.23.2022.04.12.20.33.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Apr 2022 20:33:38 -0700 (PDT) From: Stephen Boyd To: Dmitry Torokhov Cc: linux-kernel@vger.kernel.org, patches@lists.linux.dev, linux-input@vger.kernel.org, chrome-platform@lists.linux.dev, Benson Leung , Guenter Roeck , Douglas Anderson , Hsin-Yi Wang Subject: [PATCH 1/2] Input: cros-ec-keyb: Only register keyboard if rows/columns exist Date: Tue, 12 Apr 2022 20:33:33 -0700 Message-Id: <20220413033334.1514008-2-swboyd@chromium.org> X-Mailer: git-send-email 2.35.1.1178.g4f1659d476-goog In-Reply-To: <20220413033334.1514008-1-swboyd@chromium.org> References: <20220413033334.1514008-1-swboyd@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" If the device is a detachable, we may still probe this device because there are some button switches, e.g. volume buttons and power buttons, registered by this driver. Let's allow the device node to be missing row and column device properties to indicate that the keyboard matrix shouldn't be registered. This removes an input device on Trogdor devices such as Wormdingler that don't have a matrix keyboard, but still have power and volume buttons. That helps userspace understand there isn't a keyboard present when the detachable keyboard is disconnected. Cc: Benson Leung Cc: Guenter Roeck Cc: Douglas Anderson Cc: Hsin-Yi Wang Signed-off-by: Stephen Boyd Reviewed-by: Douglas Anderson --- I tried to use mkbp info to query the number of rows and columns, but my EC firmware doesn't have commit 8505881ed0b9 ("mkbp: Separate MKBP_INFO host command from the keyboard driver") so it always returns 8 and 13 for the rows and columns. Sigh. With updated firmware we could query it, or we could rely on DT like we do already. Originally I was setting the properties to 0, but matrix_keypad_parse_properties() spits out an error message in that case and so it seems better to delete the properties and check for their existence instead. Another alternative would be to change the compatible to be "google,cros-ec-keyb-switches" or something that indicates there are only switches and no matrix keyboard. drivers/input/keyboard/cros_ec_keyb.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/drivers/input/keyboard/cros_ec_keyb.c b/drivers/input/keyboard= /cros_ec_keyb.c index 6534dfca60b4..ac9a953bff02 100644 --- a/drivers/input/keyboard/cros_ec_keyb.c +++ b/drivers/input/keyboard/cros_ec_keyb.c @@ -537,6 +537,15 @@ static int cros_ec_keyb_register_matrix(struct cros_ec= _keyb *ckdev) u32 key_pos; unsigned int row, col, scancode, n_physmap; =20 + /* + * No rows and columns? There isn't a matrix but maybe there are + * switches to register in cros_ec_keyb_register_bs() because this is a + * detachable device. + */ + if (!device_property_read_bool(dev, "keypad,num-rows") && + !device_property_read_bool(dev, "keypad,num-cols")) + return 0; + err =3D matrix_keypad_parse_properties(dev, &ckdev->rows, &ckdev->cols); if (err) return err; --=20 https://chromeos.dev From nobody Mon May 11 06:17:37 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F3606C433EF for ; Wed, 13 Apr 2022 03:33:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232018AbiDMDgK (ORCPT ); Tue, 12 Apr 2022 23:36:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34910 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231552AbiDMDgA (ORCPT ); Tue, 12 Apr 2022 23:36:00 -0400 Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 00AC1B87D for ; Tue, 12 Apr 2022 20:33:39 -0700 (PDT) Received: by mail-pj1-x1033.google.com with SMTP id s14-20020a17090a880e00b001caaf6d3dd1so4992277pjn.3 for ; Tue, 12 Apr 2022 20:33:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=wWjcJ6txlWYmGPmWUa/lkqIm8X8YcOdSGrKx1dUT1Lo=; b=YgtAnaC55D0KkRpSdrIiP6T3P81urr5g/Wsyj5iqniK8Yo6uNqXmgNDQKU8guUyzhO jlSo+XbhOceULSlwk/0SCtnBuGDZkatovifAvcLcQayYQv1lEq7uY+F77RUJezmvxfNq FYphnBMKohDI4+o1T5n5ebz12m/dXUiLta+AQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=wWjcJ6txlWYmGPmWUa/lkqIm8X8YcOdSGrKx1dUT1Lo=; b=BLxz0D2sJtApZ1oCZOKRr2L2oBFeQmlC7r8HvrHygx7EPghund5WxzEXjEO4L8OtdY 1F7SGLZLONpZkF57BJjZ3Vtnp882KrWxmK3DeWBOLDoB7vcyi0KNbdwul43YAppBr4iG QYw+8brBKMDlNq0uEJqtNZWkxy/jTWA4hXemq+yXaMRa4vZjEN8hCgUvYJZKU6VF5CH7 66jhzI0cyO/cPjnGEAqrbhNz9XJkgTcAhUjxVi2P7Q2wonyRumDynORFTn+24YenbyX5 2K7kHYUNHE34qddOu6T9m1QVSe+nZbKH/VYTn614Dj1gaRTZYlhB/FWnuteV+eb1RlMH bFOg== X-Gm-Message-State: AOAM533daqukaeMymw76UHBT2DeSZkOXv7yWwHNwfa+WYpKU7I+W0pHv iqGo/ZJzBGtr09qv5InUtM39yA== X-Google-Smtp-Source: ABdhPJygH42DZ5/k1O8K6z1nX5nC/7dmhOUdeF3Vfk0lEF1VmUGlNmFOQQytziHcSMNRDQiwjuoVuw== X-Received: by 2002:a17:90a:aa96:b0:1cb:c57f:9218 with SMTP id l22-20020a17090aaa9600b001cbc57f9218mr7161259pjq.227.1649820819494; Tue, 12 Apr 2022 20:33:39 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:201:87b3:e0ea:c924:6d1f]) by smtp.gmail.com with ESMTPSA id h10-20020a056a00230a00b004faa0f67c3esm39788276pfh.23.2022.04.12.20.33.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Apr 2022 20:33:39 -0700 (PDT) From: Stephen Boyd To: Dmitry Torokhov Cc: linux-kernel@vger.kernel.org, patches@lists.linux.dev, linux-input@vger.kernel.org, chrome-platform@lists.linux.dev, Benson Leung , Guenter Roeck , Douglas Anderson , Hsin-Yi Wang Subject: [RFC/PATCH 2/2] arm64: dts: qcom: sc7180-trogdor: Remove cros-ec keyboard from detachables Date: Tue, 12 Apr 2022 20:33:34 -0700 Message-Id: <20220413033334.1514008-3-swboyd@chromium.org> X-Mailer: git-send-email 2.35.1.1178.g4f1659d476-goog In-Reply-To: <20220413033334.1514008-1-swboyd@chromium.org> References: <20220413033334.1514008-1-swboyd@chromium.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" Trogdor devices that have a detachable keyboard still have a non-detachable keyboard input device present because we include the cros-ec-keyboard.dtsi snippet in the top-level sc7180-trogdor.dtsi file that every variant board includes. We do this because the keyboard-controller node also provides some buttons like the power button and volume buttons. Unfortunately, this means we register a keyboard input device that doesn't do anything on boards with a detachable keyboard. Let's delete the rows/columns properties of the device node to indicate that there isn't a matrix keyboard on these boards. Cc: Benson Leung Cc: Guenter Roeck Cc: Douglas Anderson Cc: Hsin-Yi Wang Signed-off-by: Stephen Boyd --- This is mostly to show an example. The patch will be picked up by qcom maintainer if the first patch is accepted. arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi | 5 +++++ arch/arm64/boot/dts/qcom/sc7180-trogdor-homestar.dtsi | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi b/arch/arm= 64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi index c81805ef2250..4173623cc241 100644 --- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi +++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-coachz.dtsi @@ -119,6 +119,11 @@ &i2c9 { status =3D "disabled"; }; =20 +&keyboard_controller { + /delete-property/keypad,num-rows; + /delete-property/keypad,num-columns; +}; + &panel { compatible =3D "boe,nv110wtm-n61"; }; diff --git a/arch/arm64/boot/dts/qcom/sc7180-trogdor-homestar.dtsi b/arch/a= rm64/boot/dts/qcom/sc7180-trogdor-homestar.dtsi index bff2b556cc75..7205062e88b4 100644 --- a/arch/arm64/boot/dts/qcom/sc7180-trogdor-homestar.dtsi +++ b/arch/arm64/boot/dts/qcom/sc7180-trogdor-homestar.dtsi @@ -121,6 +121,11 @@ &camcc { status =3D "okay"; }; =20 +&keyboard_controller { + /delete-property/keypad,num-rows; + /delete-property/keypad,num-columns; +}; + &panel { compatible =3D "samsung,atna33xc20"; enable-gpios =3D <&tlmm 12 GPIO_ACTIVE_HIGH>; --=20 https://chromeos.dev