Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp2501008iob; Sat, 30 Apr 2022 10:11:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJy5xBLvLm8wMo1rmUFBdh6fSy/KmSZgJWlKhzInGU2kLrI9Za6bVXlr2uuJ+p+nn8eLF2/v X-Received: by 2002:aa7:8893:0:b0:4fb:10e1:8976 with SMTP id z19-20020aa78893000000b004fb10e18976mr4189885pfe.36.1651338701107; Sat, 30 Apr 2022 10:11:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651338701; cv=none; d=google.com; s=arc-20160816; b=IegNyXLR6ROffxajUL61IJh1+GG/Ye1nWja55oAD1xkIXUA7MwYRw5MXCtItR7b2fr koouqA5dd5hiM6TgS/Hq/R/uKFrKamkD6X/ELCxaD1jPPd2FCrAMlnH5HW3FKzH4+2fH gGgU7JEoC/GY/KWQZAklqXNXJayw9+B9QErgSxHpu12znPCFiR4W8u7vEAGOf6LhI8dj td78dZZ5FCVLNzU3QmHxQ7Xg3UZFgsGNWXArfDWRth+8dm48Wu6iWWmOI3VravdJjZ+e OL/OR2m63uVjnwfK7q1pjCRa+QmMjMVk+XJ9QSb16yUFx61zBzXjkDWtPnIkASB+5F73 zyaA== 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=kWF9sCGDLZUK2sgoEIyeIZNot5TI6mJu4iu2/5YFEbs=; b=req/ti1E2EVLLQEuDPEOi9w9X+gLg5QU1EcGgx2FZ/7zbJfNmBANGXSiYZP1ykFEVw /iDSHrNy7u9VuIz5XVJoe76vFe24ZjrL9HC51V4Zdf3Q1cqeVB33//P/vyNAp8PcRKHA 7Zyf6HmPNN2Zg+suuw/8ZafLSq0nk7S1MAIEfOlbbsVWvjVyfcABC2FDL9/DkuPMbDBR O3gx8+122QL+tFUV99Z0U3sAzYNKp+wbzQBfLiARqHNbcLxyf0FFDMvAAKBzTpqhNpcz 52Nm0V2wbW2X4qMfZdZtXxB1lEGocSvXo+/weqkb8eVoB3/hK4pe+Ow6YBTVMgmbttms V3mQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=I4ZrQ02q; 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 n7-20020a170902d2c700b00158d0436f45si12529605plc.76.2022.04.30.10.11.22; Sat, 30 Apr 2022 10:11:41 -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=I4ZrQ02q; 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 S1381887AbiD2XfH (ORCPT + 99 others); Fri, 29 Apr 2022 19:35:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1381857AbiD2Xew (ORCPT ); Fri, 29 Apr 2022 19:34:52 -0400 Received: from mail-pf1-x429.google.com (mail-pf1-x429.google.com [IPv6:2607:f8b0:4864:20::429]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3AE96DB498 for ; Fri, 29 Apr 2022 16:31:17 -0700 (PDT) Received: by mail-pf1-x429.google.com with SMTP id a11so8117053pff.1 for ; Fri, 29 Apr 2022 16:31:17 -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=kWF9sCGDLZUK2sgoEIyeIZNot5TI6mJu4iu2/5YFEbs=; b=I4ZrQ02qj5Y2kq+RsM7F/x4rltUPs85PI2jsCeDO07YWMOe6ICw4kN17iLW+muuqND 2bWJtIApxcoKrH7Rg0IB1waVaa3UXApFafxIED0m+uPDHTF/qJAhg5tYHoAsW/JXVomS IxQh1fKEWGgxxaxu1B9nw7vg8ahhN4fv107mQ= 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=kWF9sCGDLZUK2sgoEIyeIZNot5TI6mJu4iu2/5YFEbs=; b=U03E6CTIDk5R02hOR+rlXLaAW3jPgVcqBZ7mSrsPcDIkfb5F9AgHT1xU9NhjVQGiFP hmi8SnBOabnVBiBlokBpXM8Zf6u81BCwhrElttF3zoOkhNW+wfOnwzESb0U7lBWEJ7t7 OHVfkvHAmAos3n4GvmArATpfq3f3S7o0enH7wLyk2sykhsChr3nBha51N35uc3MphMs4 AJFk+WDer4cnlW+9SSOjrzH2NmzH6i9PZYaib1qwKGSmJFoIxNGzSe6AxWrJdPygmzdU p1EPfwDSw4cQLKSrTM4x2Ypf85RxR1Aw03dfFaBiTnUDtB/4lpzzOL4TyJ77k3Y6pjsZ 9uUw== X-Gm-Message-State: AOAM532q3RjHhU38mCf3PlfbmWC1hGeQ2qB1CbKV6GeZk/0X7amNct9E GQlVH94MZqWBFrjNZ6TC+Vlb0g== X-Received: by 2002:a05:6a00:24ce:b0:50d:c14b:b655 with SMTP id d14-20020a056a0024ce00b0050dc14bb655mr1240258pfv.57.1651275076720; Fri, 29 Apr 2022 16:31:16 -0700 (PDT) Received: from smtp.gmail.com ([2620:15c:202:201:5172:14b3:3687:1fb0]) by smtp.gmail.com with ESMTPSA id i24-20020aa78b58000000b0050dc762818esm223037pfd.104.2022.04.29.16.31.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Apr 2022 16:31:16 -0700 (PDT) From: Stephen Boyd To: Dmitry Torokhov Cc: linux-kernel@vger.kernel.org, patches@lists.linux.dev, chrome-platform@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 v2 2/2] Input: cros-ec-keyb - skip keyboard registration for switches compatible Date: Fri, 29 Apr 2022 16:31:12 -0700 Message-Id: <20220429233112.2851665-3-swboyd@chromium.org> X-Mailer: git-send-email 2.36.0.464.gb9c8b46e94-goog In-Reply-To: <20220429233112.2851665-1-swboyd@chromium.org> References: <20220429233112.2851665-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=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 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. Finally, if google,cros-ec-keyb is missing then this driver won't even attempt to register the matrix keyboard. 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 --- drivers/input/keyboard/cros_ec_keyb.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/input/keyboard/cros_ec_keyb.c b/drivers/input/keyboard/cros_ec_keyb.c index eef909e52e23..1bbe2987bf52 100644 --- a/drivers/input/keyboard/cros_ec_keyb.c +++ b/drivers/input/keyboard/cros_ec_keyb.c @@ -536,6 +536,12 @@ static int cros_ec_keyb_register_matrix(struct cros_ec_keyb *ckdev) u32 *physmap; u32 key_pos; unsigned int row, col, scancode, n_physmap; + bool register_keyboard; + + /* Skip matrix registration if no keyboard */ + register_keyboard = device_get_match_data(dev); + if (!register_keyboard) + return 0; /* * No rows and columns? There isn't a matrix but maybe there are @@ -718,8 +724,13 @@ static int cros_ec_keyb_remove(struct platform_device *pdev) #ifdef CONFIG_OF static const struct of_device_id cros_ec_keyb_of_match[] = { - { .compatible = "google,cros-ec-keyb" }, - {}, + { + /* Must be first */ + .compatible = "google,cros-ec-keyb", + .data = (void *)true + }, + { .compatible = "google,cros-ec-keyb-switches" }, + {} }; MODULE_DEVICE_TABLE(of, cros_ec_keyb_of_match); #endif -- https://chromeos.dev