Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp186496iob; Mon, 2 May 2022 16:37:09 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwkWGkMNKQDqRaZIBvrfDqKgjmm5WlaM1w2EzHPqjeLzcHug+cfcMA8rVX2C27fuGhD7AAT X-Received: by 2002:a63:554c:0:b0:3c1:65f2:5543 with SMTP id f12-20020a63554c000000b003c165f25543mr11741856pgm.4.1651534629181; Mon, 02 May 2022 16:37:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651534629; cv=none; d=google.com; s=arc-20160816; b=cDegnuUrOXogp0FR313dfDZIuQdAO1eiBo3wh20RUQiFUG2RNHHw51OiYkFzl9ilmQ Ou48nFxXZZ3HXFCR9ewaSAbjAdh/ynuiTHdJEB/+4q/f4oxEf5Y6VGQG79RDxfnFQiDV QvAsr3PxAh8fOOo8vAcKNVRgSvb06kzawvjioPvdmMoO1aNvcb1sUTna+nRH1EpXHkL+ BdjTzu2WXmMYJ3+g5VI6qUpGzUkuVelhroCHoVr8KnXnYXurmq5q1YjqhXWKWS6IKvCN cTeNjrysIdXA+ljtiyfZ5yNYPAjVyGLAjAuwh70x3KASfSkq2y6jIohfvJLiowPrq6t+ 11Eg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=/u6ctPDMxVgGjtnFGMUjLT8WYXeEvvG7PHjNe0QwddI=; b=kQWZD44BlnUH5x8g1Ryq4YCVyPl9CaKCxm/KQjeDEzhrdHUQDJJVmZ0LxCAX6Zq2CN UZyC13bZXzyaSODLezqCJlImSDHgCpcBVOEVEkEs9/4Y8nCmt2HHl1yXuAHSbAZ35oR0 eJKdYkOU0BAjuvkdyvGONh3y++nHQOT1ixSOr0tux/bSQQ2d/udkT52MlQ08cdcmLxfu d6mQN6XPj1ZGNaSKDhtWGRq+EXSfibZdkGNdYko40zu/m6d/AFryz2chU5K17M37IomJ LWzKf/KBB1VN1oOcII+NDG2bpKOcoZkZkJjAbuHmDwKZXmJ5IA+Oh9DtAPP8DaY1fmxM WUQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=U+6pAjMk; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id f20-20020a63e314000000b003ab8129839asi15717130pgh.325.2022.05.02.16.37.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 May 2022 16:37:09 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=U+6pAjMk; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id C9CB4255AE; Mon, 2 May 2022 16:37:05 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1386395AbiEBRGm (ORCPT + 99 others); Mon, 2 May 2022 13:06:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46102 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1357301AbiEBRGj (ORCPT ); Mon, 2 May 2022 13:06:39 -0400 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5926725EA for ; Mon, 2 May 2022 10:03:10 -0700 (PDT) Received: by mail-ed1-x529.google.com with SMTP id be20so17293732edb.12 for ; Mon, 02 May 2022 10:03:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=/u6ctPDMxVgGjtnFGMUjLT8WYXeEvvG7PHjNe0QwddI=; b=U+6pAjMkfydxMfXGeTmt3HKbxbXevcplbal5L1ckkQu9nHhDDr4SDRGgBekVn87CJd YrmGEanXaLZSZ82VJResvpoYyRkLUcrMX7ZgkOFM7hnObCOd86KUkbaj6zmv9dig+Cl6 pXz5+eXdWfU0Vqp7yPjv4dFgsa7Lo+L0IpdMk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=/u6ctPDMxVgGjtnFGMUjLT8WYXeEvvG7PHjNe0QwddI=; b=X7E1nvoI6giUgDmrhFUzNjCsPJzEpVJHY/3FzBWlxmdiIdVZV2+UJCV9T1ZGdieyaf trZ3+T8mIV/wnQjOm+OWmoaaj1Q7UVIWVq6ePJeW0v2I8YZ+gmizehk1MSJVhF0GbrMg OcqzoKLBL/kV45zytNmLgkC6NRSJKSPYKF6Lmv5ty1eS313+KGlNr245OvS9/hqNy8bF 36yvF8i4hLT6JMujNbRtiA6W3tVbfnMobQDuzsarpuP0ACyvL9asc9Oq5AghvDv5kZ1g R6mIye70lwFv++g1zxuSJub5Ak2v34yLmZe0o/fQUO9KiRbRTHXuOTB0Z6UNB7ith+aG Setg== X-Gm-Message-State: AOAM531u1UD6sIkUI401l4WHN2eNIjfSVpQNz2RiV/aCQhR1eyOmh8pP 9TKgoxnfsLF78R1xp4Ec6lnmXfGM5ht4i9hn X-Received: by 2002:a05:6402:5107:b0:427:ded9:9234 with SMTP id m7-20020a056402510700b00427ded99234mr646768edd.275.1651510988667; Mon, 02 May 2022 10:03:08 -0700 (PDT) Received: from mail-wr1-f43.google.com (mail-wr1-f43.google.com. [209.85.221.43]) by smtp.gmail.com with ESMTPSA id cy19-20020a0564021c9300b0042617ba6386sm6761042edb.16.2022.05.02.10.03.06 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 02 May 2022 10:03:07 -0700 (PDT) Received: by mail-wr1-f43.google.com with SMTP id k2so20323333wrd.5 for ; Mon, 02 May 2022 10:03:06 -0700 (PDT) X-Received: by 2002:a5d:6d09:0:b0:20c:53a9:cc30 with SMTP id e9-20020a5d6d09000000b0020c53a9cc30mr9166713wrq.513.1651510986299; Mon, 02 May 2022 10:03:06 -0700 (PDT) MIME-Version: 1.0 References: <20220429233112.2851665-1-swboyd@chromium.org> <20220429233112.2851665-3-swboyd@chromium.org> In-Reply-To: <20220429233112.2851665-3-swboyd@chromium.org> From: Doug Anderson Date: Mon, 2 May 2022 10:02:54 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH v2 2/2] Input: cros-ec-keyb - skip keyboard registration for switches compatible To: Stephen Boyd Cc: Dmitry Torokhov , LKML , patches@lists.linux.dev, chrome-platform@lists.linux.dev, Krzysztof Kozlowski , Rob Herring , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Benson Leung , Guenter Roeck , Hsin-Yi Wang , "Joseph S. Barrera III" Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE 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 Hi, On Fri, Apr 29, 2022 at 4:31 PM Stephen Boyd wrote: > > 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 As per my comments in patch #1, I wonder if it makes sense to delete the "No rows and columns?" logic and settle on the compatible as the one true way to specify this. -Doug