Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp248624iob; Mon, 2 May 2022 18:29:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzcZ+r0BgMdDLF+DRsBRMTF+Qg5fRV9AS6KJJjJMZ+cbyX0KVQXIyX7F81Z3K4bQfkzmV8q X-Received: by 2002:a17:90b:1c04:b0:1dc:32dd:3212 with SMTP id oc4-20020a17090b1c0400b001dc32dd3212mr2192322pjb.35.1651541363962; Mon, 02 May 2022 18:29:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651541363; cv=none; d=google.com; s=arc-20160816; b=M72l36QjDtUCIOlI89pswgvvBBL8xZJM9U4NHAstXGrbzJMFrxaOI2rLg0xRRn+tB8 spp01tNlHIEXe9mzYdqpamwPFnVAgoUyc/gQO3kphRBVVq343QzLA+miYuO5ZY4myg66 UJeq1P6O0Pi5bdENEFV9dIgHj+OOiEnDuAflOPz3ujBsBHI2kF+eG8yqFBHHuvfRGhrU DLIlljuxL6xE5ySt2ZD2rCcF7vg1iH6IypOeyKvH56T+An45gJ3bcG7ZedQMQZMKFqRp bR0kmid+BeClpR/DbwCoY4w84fsArq0Xnmb0qU1jyqbviLhXqcxJtKQfFlGHI+xz6scf ZovQ== 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=+GS/UD7rTSn/SrbnLBVwvNdcnYAN1i32IbtuzZWmvMs=; b=hDax8czMvg69OtyLN+89q2I/u/3WRCvyPUe5/6GyZ5o3SncVUFWI3ML8wnKgtUe4nC PLMgoDbUN4wI9DpjUdoEdMcO1511eTVXi2MFP9o7ql+/VI02UJTuYmrJxFUtYnq7ggUA JX2Pbs62SK/nBnxtqEqCSjqMvHuv7kbRYWXFlVHVt4HdwhudsWScr7z8Q02amUtV0Hxo ceGNZnKOTsAoYlDggqo5J1fGyW9l9W0mmXynEefQd4WgVRATZJynBN66/k2OS4uWp+3i aMX9Prx+8S3UHLqlhwADfWlrOlOfajtaJvJCiedOf4gJkkr9zz18h0fPN56tWqZraUP3 31dg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=GjPF8T0L; 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 k12-20020a6555cc000000b003ab2952c596si16067212pgs.487.2022.05.02.18.29.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 May 2022 18:29:23 -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=GjPF8T0L; 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 05F644F45A; Mon, 2 May 2022 18:09:31 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229780AbiECBMt (ORCPT + 99 others); Mon, 2 May 2022 21:12:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229505AbiECBMq (ORCPT ); Mon, 2 May 2022 21:12:46 -0400 Received: from mail-ed1-x534.google.com (mail-ed1-x534.google.com [IPv6:2a00:1450:4864:20::534]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E2A4837A10 for ; Mon, 2 May 2022 18:09:09 -0700 (PDT) Received: by mail-ed1-x534.google.com with SMTP id z19so18328838edx.9 for ; Mon, 02 May 2022 18:09:09 -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=+GS/UD7rTSn/SrbnLBVwvNdcnYAN1i32IbtuzZWmvMs=; b=GjPF8T0LFSfzHmDfzTyaQdTHc7/c7Au3dfdO9t7Jo7HNtVLIYTlK7boOyvbs8TaHWd u9Fc4NyJgxlRHYIObzxW3VHsk8uI5SiIRPIDVCqgNVN2nW1uFL7RyBgX5amGCEBX1Dqa wMPbnPQOsxEp8F4lvG7gMmlYdyq2+7Bca8HEw= 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=+GS/UD7rTSn/SrbnLBVwvNdcnYAN1i32IbtuzZWmvMs=; b=ItyWNTTUeC9SfAYUIz8xpqLx+JrKZnWK8Gm7sTDb3mdLlHCgI9ftV6MzNK1qy2Hl9u 9Uv1xajYhJlEl/4KpLepoKhY0O45087PzPU5oeeaTA27+LmGCoQtHbkshncHNdM9TAnc R4tgTFqO7AmAky/CtUqJeRNu7JgFlYncMrDzawiChNp6VWnJirWN0n0KuxlDLv20Q6e1 n0DF7OYnlyyFXVz/Nm3Qq2Et96+zQsh6iUqEJuucsMw1NnX9A+aWt0p7ZlSsdfqMPd/R l77cSrHW9Va4KQ7Be+c+xC5PrZK00BSI2RCrqBOYPANuu/JqUEJZI+npoalP9FrW1272 ofEA== X-Gm-Message-State: AOAM5325Q6BR4E1D2/SJCv1jwDmMkDkzswlWMkAa3l0JbsbhgFwWMDSz d2RPq86Lv8BD6bmPIEQmD5JnKdTFYwJK9QLE X-Received: by 2002:a05:6402:4384:b0:427:b5c0:4bf with SMTP id o4-20020a056402438400b00427b5c004bfmr11072939edc.127.1651540012503; Mon, 02 May 2022 18:06:52 -0700 (PDT) Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com. [209.85.221.47]) by smtp.gmail.com with ESMTPSA id em20-20020a170907289400b006f3ef214e05sm4087995ejc.107.2022.05.02.18.06.51 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 02 May 2022 18:06:51 -0700 (PDT) Received: by mail-wr1-f47.google.com with SMTP id i5so21456484wrc.13 for ; Mon, 02 May 2022 18:06:51 -0700 (PDT) X-Received: by 2002:a5d:6d09:0:b0:20c:53a9:cc30 with SMTP id e9-20020a5d6d09000000b0020c53a9cc30mr10094457wrq.513.1651540011049; Mon, 02 May 2022 18:06:51 -0700 (PDT) MIME-Version: 1.0 References: <20220429233112.2851665-1-swboyd@chromium.org> <20220429233112.2851665-3-swboyd@chromium.org> In-Reply-To: From: Doug Anderson Date: Mon, 2 May 2022 18:06:39 -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 Mon, May 2, 2022 at 3:02 PM Stephen Boyd wrote: > > Quoting Doug Anderson (2022-05-02 10:02:54) > > On Fri, Apr 29, 2022 at 4:31 PM Stephen Boyd wrote: > > > > > > > > > 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. > > > > Ok. My only concern is that means we have to check for both compatibles > which is not really how DT compatible strings work. The compatible > string usually finds the more specific compatible that is first in the > list of compatibles in DT. You're essentially proposing that the > switches compatible could be first or last, the order doesn't matter. It's not quite what I was proposing. I think my summary really sums it up: 1. If you have a matrix keyboard and maybe also some buttons/switches then use the compatible: google,cros-ec-keyb 2. If you only have buttons/switches but you want to be compatible with the old driver in Linux that looked for the compatible "google,cros-ec-keyb" and required the matrix properties, use the compatible: "google,cros-ec-keyb-switches", "google,cros-ec-keyb" 3. If you have only buttons/switches and don't need compatibility with old Linux drivers, use the compatible: "google,cros-ec-keyb-switches" ...but just to say it another way: * If you have the compatible "google,cros-ec-keyb-switches" I mean to say that you _only_ have switches and buttons. You'd _never_ have this compatible string if you truly have a matrix keyboard. If you have this, it will always be first. * If you only have switches and buttons but you care about backward compatibility then you can add a fallback compatible second: "google,cros-ec-keyb" * In order for the fallback compatible to be at all useful as a fallback (it's only useful at all if you're on an old driver), if you specify it you should pretend that you have matrix properties even though you don't really have them, just like we used to do. -Doug