Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp226681iob; Thu, 28 Apr 2022 00:35:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwexIQt1gCCfqn53VUuZlPmv7ohqgY5H6qMBSOHPalZIcZBB7T8FQ/inMhov0TsABdWrblp X-Received: by 2002:aa7:962e:0:b0:50d:5ed8:aa23 with SMTP id r14-20020aa7962e000000b0050d5ed8aa23mr11633135pfg.43.1651131340911; Thu, 28 Apr 2022 00:35:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651131340; cv=none; d=google.com; s=arc-20160816; b=YdeWM1cDSBbN+I8ImF6EULiCPyIdatJYf0KWugMnly21DfHdE5n0rDl4HQrQ7ZAIbD 6/s4+FIngxNDdHot1dUZlJQGoF9TxfPWBtLfi6PDTG7FPagVwGMUAmRHHwc4StG9ba2c rW77qQoiNSSCwnkqlYTpylIERSj2VE6285FEiUOmzlTkgKUeYQgsL13ekVB0vWpPVUPd z+s45WbeiwjCwoPFkG/UfEBEBdozFTuLhu937/N0uRip+Cy59MR76toRq54M8/yQB0cb BNde5Lcu6XJofV/oYMQhrw/8mK57hAfPb1p1tFd+NhGPY57rmRE8l8JTymIJLs655lNr 44Yw== 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=IpCynwQxacKO8WLHFNnGebdUOh75AKsVNF+KM51gd5U=; b=UBzr+NoEiEgEnnJGagk9VYxO/5FUpJJFAr7SIvZTP3CXcdHMxQmNeuLwrRygmmIgFs rJ08C1gboWcWSk3p8IIf7j+jRuydHpwAlCLpfdK+dcjgdVvokViRTDQmjOk7Bfbj776N LCtzOn7lpGGdTLDEvlpbaphETS3a225d2qfWXHvDW9+S4Y7AeRS/KwcnhnwcvLpMdqB/ yYyUKdbHrENCeORLua8YkC2UYvX4LzLrit2HcLv8xQSjfk08j/IvoEPYyzDsSa7p0rYf uN7Oc9224xkqiRk5fdMy2THGefZPmdtbCA4lvReejW40NHWTkkuHShN/0+xAAK1mZwuY /3JQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="l4aXmxf/"; 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=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i2-20020a631302000000b003aa5e43f974si3770708pgl.327.2022.04.28.00.35.25; Thu, 28 Apr 2022 00:35:40 -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=@chromium.org header.s=google header.b="l4aXmxf/"; 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=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236666AbiD0Udy (ORCPT + 99 others); Wed, 27 Apr 2022 16:33:54 -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-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: 8bit X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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 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; + /* + * 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 = matrix_keypad_parse_properties(dev, &ckdev->rows, &ckdev->cols); if (err) return err; -- https://chromeos.dev