Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp242915iob; Mon, 2 May 2022 18:17:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyoq6ZHOMIP0UVqv+JqZwsM9RUXpdSIhPX3RNh9ZnOmHGJiVXBLM7fvWAbF/dKmj1mjVfMi X-Received: by 2002:a17:90a:a58d:b0:1db:ed34:e46d with SMTP id b13-20020a17090aa58d00b001dbed34e46dmr2127055pjq.124.1651540644618; Mon, 02 May 2022 18:17:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651540644; cv=none; d=google.com; s=arc-20160816; b=B8KCk2dUx2wgtbCIqGOgjUSgIMAYlwm0zw5FxhRN7MUBPg3kxi2boUmsBq4qEadk4u NSbJjOAHFDerg47xUVb9oZAmRHoitVVBOR0PI0VLKNn+TW+f5SGhZLXtMz5/bvEXtCp+ pJL90rc7gLLRHdePn2n7tMU4NQBuKOV602IWqgbjcODaedgjjhNzDrkoTk/khKWtUpql QBMt631PoAOYjEV52Pw+W5BlMQg75Csnev9D6VOXnyqbgfwdIEnG7vOqbOivcy17ZRjb Eef818djVTPP+8DvM3pIHb6Uu3caqoZwChMh7p8FKoBJQlvopb2qUJ5QxJBgMKa+6wm9 afCg== 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=RBsJxNxvImpl296Mus5mWmdnOpmXdmLbthaIxAskrPQ=; b=L5ws2bQxnXgpwO8I2atACTHYE4v5YUFz2Ia0+idOADMzZPtj5urqYIx4bnGEun1SNZ niZVU5Rk3txnzB+E+8Av5g2f1/o12p98bMPqPQn1r+W7Q2/G9neeVLd8jOxOLqYxkYiT 38l0cxCsoXdKnPCEzoDyVwK90edqqpaTuPGsXiY8bayagrvZaVGXxTulustGz/iQCX8j dQceJ+NV9RtVvOETLBTX3coJ1ljawQWdFEkUdkI77aF/a2HG8Q1acMWiIywbjyawJehT v+OEp3MPuHYDChA6Ny3TrvvxZrV74+Bocge7Hky8BFmzerp/EOziWtIaOFhSq8/m5k3M sN6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=MFziamnY; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id x1-20020a170902ec8100b0015bf16b686fsi4872556plg.410.2022.05.02.18.17.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 May 2022 18:17:24 -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=@gmail.com header.s=20210112 header.b=MFziamnY; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 73E053D1E8; Mon, 2 May 2022 17:56:58 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1356820AbiEBRqz (ORCPT + 99 others); Mon, 2 May 2022 13:46:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349355AbiEBRqt (ORCPT ); Mon, 2 May 2022 13:46:49 -0400 Received: from mail-vs1-xe2b.google.com (mail-vs1-xe2b.google.com [IPv6:2607:f8b0:4864:20::e2b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 861DC2BC4; Mon, 2 May 2022 10:43:19 -0700 (PDT) Received: by mail-vs1-xe2b.google.com with SMTP id c62so14222997vsc.10; Mon, 02 May 2022 10:43:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=RBsJxNxvImpl296Mus5mWmdnOpmXdmLbthaIxAskrPQ=; b=MFziamnY/d5gQwsIytBkVyPWmrtDfVrIM4oN59ExACT6YnNwihwZwKUjTOt0fdmzu+ jC7DCGdVdeTWPzseZ3xQYauT3dbRslDf+5Oa5gx7ZbgSVT80aQVEjQm/z6t4Er0X6IPE YXiahUCLDnFlwur/uAmnmtwoci9OqHfcEY7tyTZS3Nt7+aRS55NvsPcGA+vaJU9aceHo 1KfqO0NXdwKJQVxeclp24NkGn2nu7Qo9dPdF30M8CELnx8Azx7Z3S7eBr7FyonxVStCm 8q/aXlC+EzH6M2Nkoe1n2PclHw/zn5psRZsuC+hobZZDXJ8vq1UZIs1DyKKzVCU3Eatx x53w== 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=RBsJxNxvImpl296Mus5mWmdnOpmXdmLbthaIxAskrPQ=; b=temQPQs4gFZHTYkpFVdlGNLcW+NwPArDtChE0oesUJZb6qVAVAhdKQoxc8a4VdW/Zr dApHjVCUgOT+29l0z35onlnYZ0r0J0pXhKIhVLReTTjhM5lNUbWplulkxyvid4Zavli2 m5yZZ960xkr4yemNCDIqrbKVIsx0+44iZ0twv1hlOGL1BeHeGaIk6VfkHJy8zRQaPxWH Y155PboWsuYi/SymLq82zLvJ+EDcKxSWESdqxKCcPVnY4YJlAACJaQ+nYW8iY9fg1RmE HaUsmPl3nihlwxVQ56b3X40pn3nGFmWhJ0bwXJru6n6Q0GUgNXGD2Aq2Ma8SFqPVRjt1 rZWg== X-Gm-Message-State: AOAM53279698gnZXkac2MTIiTXHnB6uzukmeEx0xfb5xQ5pRmwa3D25f fq3ys/kRc+KTgGD5N2TSAtNQMiBOG0+v0f66ksk= X-Received: by 2002:a67:ee90:0:b0:32a:6b7f:777c with SMTP id n16-20020a67ee90000000b0032a6b7f777cmr3764471vsp.83.1651513398507; Mon, 02 May 2022 10:43:18 -0700 (PDT) MIME-Version: 1.0 References: <20220429233112.2851665-1-swboyd@chromium.org> <20220429233112.2851665-2-swboyd@chromium.org> In-Reply-To: From: Dmitry Torokhov Date: Mon, 2 May 2022 10:43:06 -0700 Message-ID: Subject: Re: [PATCH v2 1/2] dt-bindings: google,cros-ec-keyb: Introduce switches only compatible To: Doug Anderson Cc: Stephen Boyd , 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=-1.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 On Mon, May 2, 2022 at 10:00 AM Doug Anderson wrote: > > Hi, > > On Fri, Apr 29, 2022 at 4:31 PM Stephen Boyd wrote: > > > > 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. If only the switches compatible is present, then the > > matrix keyboard properties are denied. This lets us gracefully migrate > > devices that only have switches over to the new compatible string. > > I know the history here so I know the reasons for the 3 choices, but > I'm not sure I'd fully understand it just from the description above. > Maybe a summary in the CL desc would help? > > Summary: > > 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" > > > > Similarly, start enforcing that the keypad rows/cols and keymap > > properties exist if the google,cros-ec-keyb compatible is present. This > > more clearly describes what the driver is expecting, i.e. that the > > kernel driver will fail to probe if the row or column or keymap > > properties are missing and only the google,cros-ec-keyb compatible is > > 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 > > --- > > .../bindings/input/google,cros-ec-keyb.yaml | 95 +++++++++++++++++-- > > 1 file changed, 89 insertions(+), 6 deletions(-) > > > > diff --git a/Documentation/devicetree/bindings/input/google,cros-ec-keyb.yaml b/Documentation/devicetree/bindings/input/google,cros-ec-keyb.yaml > > index e8f137abb03c..c1b079449cf3 100644 > > --- a/Documentation/devicetree/bindings/input/google,cros-ec-keyb.yaml > > +++ b/Documentation/devicetree/bindings/input/google,cros-ec-keyb.yaml > > @@ -15,14 +15,19 @@ 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. > > - > > -allOf: > > - - $ref: "/schemas/input/matrix-keymap.yaml#" > > + into keycodes for processing by the kernel. This device also supports > > + switches/buttons like power and volume buttons. > > > > properties: > > compatible: > > - const: google,cros-ec-keyb > > + oneOf: > > + - items: > > + - const: google,cros-ec-keyb-switches > > + - items: > > + - const: google,cros-ec-keyb-switches > > + - const: google,cros-ec-keyb > > + - items: > > + - const: google,cros-ec-keyb > > > > google,needs-ghost-filter: > > description: > > @@ -41,15 +46,40 @@ properties: > > where the lower 16 bits are reserved. This property is specified only > > when the keyboard has a custom design for the top row keys. > > > > +dependencies: > > + function-row-phsymap: [ 'linux,keymap' ] > > + google,needs-ghost-filter: [ 'linux,keymap' ] > > + > > required: > > - compatible > > > > +allOf: > > + - if: > > + properties: > > + compatible: > > + contains: > > + const: google,cros-ec-keyb > > + then: > > + allOf: > > + - $ref: "/schemas/input/matrix-keymap.yaml#" > > + - if: > > + not: > > + properties: > > + compatible: > > + contains: > > + const: google,cros-ec-keyb-switches > > + then: > > + required: > > + - keypad,num-rows > > + - keypad,num-columns > > + - linux,keymap > > I think that: > > 1. If you only have buttons/switches and care about backward > compatibility, you use the "two compatibles" version. > > 2. If you care about backward compatibility then you _must_ include > the matrix properties. > > Thus I would be tempted to say that we should just have one "if" test > that says that if matrix properties are allowed then they're also > required. > > That goes against the recently landed commit 4352e23a7ff2 ("Input: > cros-ec-keyb - only register keyboard if rows/columns exist") but > perhaps we should just _undo_ that that since it landed pretty > recently and say that the truly supported way to specify that you only > have keyboards/switches is with the compatible. > > What do you think? I am sorry, I am still confused on what exactly we are trying to solve here? Having a device with the new device tree somehow run an older kernel and fail? Why exactly do we care about this case? We have implemented the notion that without rows/columns properties we will not be creating input device for the matrix portion, all older devices should have it defined, so the newer driver is compatible with them... Thanks. -- Dmitry