From nobody Sun May 10 17:53:29 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 CEBAEC433EF for ; Wed, 27 Apr 2022 20:30:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236613AbiD0Uds (ORCPT ); Wed, 27 Apr 2022 16:33:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230488AbiD0Udm (ORCPT ); Wed, 27 Apr 2022 16:33:42 -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 1F3E6E0B1 for ; Wed, 27 Apr 2022 13:30:30 -0700 (PDT) Received: by mail-pl1-x62e.google.com with SMTP id b12so2570870plg.4 for ; Wed, 27 Apr 2022 13:30:30 -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=TyZE4JpHRVYo+b1SEajVG8GhKCg8WLvC1BfKNFX1vtU=; b=jirR79zAFiifoqz7FtzliwnKnv17qWOW+UwmHM2v9GRUTPDv6LWEOC80Ih6So3HBj2 Rb4lp1LlQIXWsNIzcpYnrW5NyOrOrDAWZ7idusCJSEzWfpBRSxMGltfIy3gBPaaZ1Y9K aQbvc5XyxPyBFLhwhizo2B378UZOQkt+iRc+4= 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=TyZE4JpHRVYo+b1SEajVG8GhKCg8WLvC1BfKNFX1vtU=; b=T9p3U250gKDIiWtTnSvaO1BXQ5HOruoiKLGvpKZWMefwtPdJGgMREllaAdnEmGKnYG vVcVnVAyFZiHDh+rSWuYjDB2jCVh7WJTWapcvqjZUx0kVTDQtGlUa8EKtbtZNgv77QwI P6aE4Um+iflisW7NlJJ0BdHYwibYlw3F8rSFehkjpQ5Uz8MXFz0RDojaFN7rsnNNJluZ 78D2j2qYF2XzwTz/bfQ4jhZ3fhpoChhpJGbMFRCQ3LKT8/yvuszE/rQVGRIiKdWvN1la cSE71aKdbjERe9GuqE+IoQNyiVFNOJtXyYSmRrvcPfikr7vNk9VOWWXKtf/2RK726gwf eUrw== X-Gm-Message-State: AOAM531JWNfBXncMttWxTdrnpEjDq9tIaB+ySmMVVLSJS7C9o/hz/CNs h9JT/UO8Brdq2lgiupFqxya6Cw== X-Google-Smtp-Source: ABdhPJzUplOYCCpBIP7HPJMb8z9JjKFKfxTZoNnut9NrCdsHgehpOduEV/HjLmFf905jcUmVzMOtUA== X-Received: by 2002:a17:902:b7c1:b0:15b:3c09:3ed3 with SMTP id v1-20020a170902b7c100b0015b3c093ed3mr30053180plz.73.1651091429660; Wed, 27 Apr 2022 13:30:29 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:201:482e:60bc:84d1:bf5c]) by smtp.gmail.com with ESMTPSA id 7-20020a17090a000700b001da3920d985sm3858552pja.12.2022.04.27.13.30.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Apr 2022 13:30:29 -0700 (PDT) From: Stephen Boyd To: Dmitry Torokhov Cc: linux-kernel@vger.kernel.org, patches@lists.linux.dev, Krzysztof Kozlowski , Rob Herring , devicetree@vger.kernel.org, Benson Leung , Guenter Roeck , Douglas Anderson , Hsin-Yi Wang , "Joseph S. Barrera III" Subject: [PATCH 1/2] dt-bindings: google,cros-ec-keyb: Introduce switches only compatible Date: Wed, 27 Apr 2022 13:30:25 -0700 Message-Id: <20220427203026.828183-2-swboyd@chromium.org> X-Mailer: git-send-email 2.36.0.rc2.479.g8af0fa9b8e-goog In-Reply-To: <20220427203026.828183-1-swboyd@chromium.org> References: <20220427203026.828183-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, this device won't have a matrix keyboard but it may have some button switches, e.g. volume buttons and power buttons. Let's add a more specific compatible for this type of device that indicates to the OS that there are only switches and no matrix keyboard present. Cc: Krzysztof Kozlowski Cc: Rob Herring Cc: Cc: Benson Leung Cc: Guenter Roeck Cc: Douglas Anderson Cc: Hsin-Yi Wang Cc: "Joseph S. Barrera III" Signed-off-by: Stephen Boyd Acked-by: Krzysztof Kozlowski --- .../bindings/input/google,cros-ec-keyb.yaml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/Documentation/devicetree/bindings/input/google,cros-ec-keyb.ya= ml b/Documentation/devicetree/bindings/input/google,cros-ec-keyb.yaml index e8f137abb03c..edc1194d558d 100644 --- a/Documentation/devicetree/bindings/input/google,cros-ec-keyb.yaml +++ b/Documentation/devicetree/bindings/input/google,cros-ec-keyb.yaml @@ -15,14 +15,20 @@ description: | Google's ChromeOS EC Keyboard is a simple matrix keyboard implemented on a separate EC (Embedded Controller) device. It provides a message for reading key scans from the EC. These are then converted - into keycodes for processing by the kernel. + into keycodes for processing by the kernel. This device also supports + switches/buttons like power and volume buttons. =20 allOf: - $ref: "/schemas/input/matrix-keymap.yaml#" =20 properties: compatible: - const: google,cros-ec-keyb + oneOf: + - items: + - const: google,cros-ec-keyb-switches + - const: google,cros-ec-keyb + - items: + - const: google,cros-ec-keyb =20 google,needs-ghost-filter: description: @@ -50,7 +56,7 @@ examples: - | #include cros-ec-keyb { - compatible =3D "google,cros-ec-keyb"; + compatible =3D "google,cros-ec-keyb-switches", "google,cros-ec-key= b"; keypad,num-rows =3D <8>; keypad,num-columns =3D <13>; google,needs-ghost-filter; --=20 https://chromeos.dev From nobody Sun May 10 17:53:29 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 25046C433F5 for ; Wed, 27 Apr 2022 20:30:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236687AbiD0Udz (ORCPT ); Wed, 27 Apr 2022 16:33:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41482 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236434AbiD0Udn (ORCPT ); Wed, 27 Apr 2022 16:33:43 -0400 Received: from mail-pf1-x436.google.com (mail-pf1-x436.google.com [IPv6:2607:f8b0:4864:20::436]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4CAE7E0F7 for ; Wed, 27 Apr 2022 13:30:31 -0700 (PDT) Received: by mail-pf1-x436.google.com with SMTP id i24so2506225pfa.7 for ; Wed, 27 Apr 2022 13:30:31 -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=IpCynwQxacKO8WLHFNnGebdUOh75AKsVNF+KM51gd5U=; b=l4aXmxf/nG6W6h7TIfQ0DdV6M3rWFuHGW2DExMx5CGh0IdMQiusZ0LQ22tZ79NJZKZ RIY2K6dGq1VQSD3y51D8PwNCX1cmgsp7r3ZS5Q8RMLO+AnUciIqrcgKRD8wsAYIpED+H iqMMHj6h3j6ibhw2P7+4l/S6tBL/kcb7zK18w= 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=IpCynwQxacKO8WLHFNnGebdUOh75AKsVNF+KM51gd5U=; b=PKeVyOQUA/BmYii4S8vj7SRL/lguQDem88RnAWu1Sn56bGwC11ilzb7yhBageGgL7B nkDPBcFQQYLaBhXTGTHghdY1dTJFdQqoibSupwIPjVcCV1g2fWjDQRIyd001sopBWaU4 zAwtrZZHcb12v94mYBVdJ4nLt4MLkybsc/HIm+xZt81WDdJfUK3vDBLNuPIH7b9W/pAp Eiq3DQKb+wOv0YjHK1jwrXqQUXqvTc3ZVgYHe35IaMpcg/BuUzFzrxa0c6LKL6PNsqHH AoNpNNDXeP6GSeiZKqEdEx1QzouYeZY2GAJrwUpgSee9j4B2PjIHDdlEkNw/tFSZrVrU 7SNQ== X-Gm-Message-State: AOAM5312r1T9U0a7dkGlZqFwmhmg9r5VYVzvOhHS+UkPyGgehKV38p3a BoAGQNUo1nXgvSrZVMEpNiCGdw== X-Google-Smtp-Source: ABdhPJxTpWupCS/ZGgFFXFEKo4b7bi+CMWqBawKIbaqVW+rKbkiItxThebdIjAM7EinixRBinS+hng== X-Received: by 2002:a65:6807:0:b0:3c1:424a:2a5b with SMTP id l7-20020a656807000000b003c1424a2a5bmr4844042pgt.499.1651091430819; Wed, 27 Apr 2022 13:30:30 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:201:482e:60bc:84d1:bf5c]) by smtp.gmail.com with ESMTPSA id 7-20020a17090a000700b001da3920d985sm3858552pja.12.2022.04.27.13.30.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 27 Apr 2022 13:30:30 -0700 (PDT) From: Stephen Boyd To: Dmitry Torokhov Cc: linux-kernel@vger.kernel.org, patches@lists.linux.dev, Krzysztof Kozlowski , Rob Herring , devicetree@vger.kernel.org, Benson Leung , Guenter Roeck , Douglas Anderson , Hsin-Yi Wang , "Joseph S. Barrera III" Subject: [PATCH 2/2] Input: cros-ec-keyb - skip keyboard registration for switches compatible Date: Wed, 27 Apr 2022 13:30:26 -0700 Message-Id: <20220427203026.828183-3-swboyd@chromium.org> X-Mailer: git-send-email 2.36.0.rc2.479.g8af0fa9b8e-goog In-Reply-To: <20220427203026.828183-1-swboyd@chromium.org> References: <20220427203026.828183-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" In commit 4352e23a7ff2 ("Input: cros-ec-keyb - only register keyboard if rows/columns exist") we skipped registration of the keyboard if the row/columns property didn't exist, but that has a slight problem for existing DTBs. The DTBs have the rows/columns properties, so removing the properties to indicate only switches exist makes this keyboard driver fail to probe, resulting in broken power and volume buttons. Ease the migration of existing DTBs by skipping keyboard registration if the google,cros-ec-keyb-switches compatible exists. The end result is that new DTBs can either choose to remove the matrix keymap properties or leave them in place and add this new compatible indicating the matrix keyboard properties should be ignored. Existing DTBs will continue to work, but they will keep registering the keyboard that does nothing. To fix that problem we can add this extra compatible to existing DTBs and the keyboard will stop being registered. Cc: Krzysztof Kozlowski Cc: Rob Herring Cc: Cc: Benson Leung Cc: Guenter Roeck Cc: Douglas Anderson Cc: Hsin-Yi Wang Cc: "Joseph S. Barrera III" Fixes: 4352e23a7ff2 ("Input: cros-ec-keyb - only register keyboard if rows/= columns exist") Signed-off-by: Stephen Boyd --- I treat the compatible as the deciding factor so that the keypad,num-{rows,cols} properties didn't have to be removed. An alternative would be for the driver to look for missing rows/cols if the new compatible was present and otherwise treat them missing as an error. That doesn't work though because an existing DTB could add the new compatible and remove the rows/cols properties and then break an older driver, i.e. we couldn't use a newer DTB on an older kernel. This seems to be the best approach. drivers/input/keyboard/cros_ec_keyb.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/input/keyboard/cros_ec_keyb.c b/drivers/input/keyboard= /cros_ec_keyb.c index eef909e52e23..a544be1d52d4 100644 --- a/drivers/input/keyboard/cros_ec_keyb.c +++ b/drivers/input/keyboard/cros_ec_keyb.c @@ -546,6 +546,14 @@ static int cros_ec_keyb_register_matrix(struct cros_ec= _keyb *ckdev) !device_property_present(dev, "keypad,num-cols")) return 0; =20 + /* + * Some devices only have switches but define keypad,num-{rows,cols} so + * we add a more specific compatible in this situation indicating there + * isn't a keyboard. + */ + if (of_device_is_compatible(dev->of_node, "google,cros-ec-keyb-switches")) + return 0; + err =3D matrix_keypad_parse_properties(dev, &ckdev->rows, &ckdev->cols); if (err) return err; --=20 https://chromeos.dev