Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp270781iob; Mon, 2 May 2022 19:18:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwtmXi1yjLBmuMnx95qlV/ye7nMq+9IF3aw7q4rZe/NMgQ5Xyd/efBkGb0AHcn1n6XD8vIW X-Received: by 2002:a65:4646:0:b0:3c2:2f7c:cc75 with SMTP id k6-20020a654646000000b003c22f7ccc75mr5436067pgr.327.1651544305557; Mon, 02 May 2022 19:18:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651544305; cv=none; d=google.com; s=arc-20160816; b=zWSpo8/BiYTla0ExoFc8xzwnrTbDaSPv6gbFVGQUIKuGMfM3RjTBJGuiNu4haX08ll M1iEZOZP4QDdTskekKXC1f/tEOvC2AM+VRYhGbdYy+0w3pNXFCYbz/ElFOmQS5sHC1a7 CKgwx0G+QHX1RjIKenoJou8QByEbsgu5wAZ/t5HfCaMeqHnv0Wqfstt82ccmdG8YuHaO JowsrDLrBoK3boRvEmxioZdMhzLJ/ZDlKx9Qvhoz3JSktz1nUP1M2DE5cxn8oTavPK2x xtmOzSqx988YCxKijuSt58Jm2KG3ORVpSsVY8W4Mv/skbj1eCH8AaLgqKjsBUSGwFsRl /9Tg== 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:user-agent:from :references:in-reply-to:mime-version:dkim-signature; bh=laGkwi2JMs5cKXNdFPiuyuaZlbZLsdgpAHyD6QKor6E=; b=JvVQBJXoWbT30yASSiBYOi9gqy7IW4dnB/FS03AkIsKTeotcW7w6JLGgtpAUJh3Gql XfcueeHoSVQHnbPJI/G1Ij97wayYSJi0xMH77TmObvHGgtgIEXrV4CJNEErwP9ZMUYpr vGK8MwMgvQym7iIaz2zjAjR2HD99oOyb1bswB8rjcqoGohz9eQdm6EiHQFOMyWJaHqK5 c3BkGzVS1utXrByCQa6UftS7YjHQAbRCn3kLDJ1W4Fm/oKMbhq1zrl9sszBkgO4cGxET QxZie2ovayrFx8EXCgrO+hX4RO/W9mx2/pVwupncKJ3Bjo/doOV4sv72VHrBQXyXiIZ4 S2PQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=jEi963cY; 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 s6-20020a170902ea0600b0015d0062ecc6si5851016plg.228.2022.05.02.19.18.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 02 May 2022 19:18:25 -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=jEi963cY; 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 852A12315E; Mon, 2 May 2022 19:18:23 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229995AbiECCVt (ORCPT + 99 others); Mon, 2 May 2022 22:21:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229935AbiECCVp (ORCPT ); Mon, 2 May 2022 22:21:45 -0400 Received: from mail-oi1-x235.google.com (mail-oi1-x235.google.com [IPv6:2607:f8b0:4864:20::235]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F17792126D for ; Mon, 2 May 2022 19:18:14 -0700 (PDT) Received: by mail-oi1-x235.google.com with SMTP id q8so16557934oif.13 for ; Mon, 02 May 2022 19:18:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:in-reply-to:references:from:user-agent:date:message-id :subject:to:cc; bh=laGkwi2JMs5cKXNdFPiuyuaZlbZLsdgpAHyD6QKor6E=; b=jEi963cY0xSdF6MSjXXJz/sx7W/ReDryUgIFdwijSV6cirSdAl0OISyAOGKPQvvYLS VDDd/DogiFDG4NWFJBaqKvRacbPPQrQGSjdnQC6xIoVSplCgt6eysx3zeYAvOfRMr337 7t4wjETW0dbuPRAqA4bNaP8sKag+zRo2ceatk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:in-reply-to:references:from :user-agent:date:message-id:subject:to:cc; bh=laGkwi2JMs5cKXNdFPiuyuaZlbZLsdgpAHyD6QKor6E=; b=1OcQPs5IumuxZwhs3usiwdwz42HJzlLJp63TLKr1EDH7Wc3e1+hwdCGI5T4JNWCQLD aEqImfvL5ZVEoAeDJbtEW0QOEmNV/iD+ULxW1x65dm2X1LZD88uJgOkbvZS9b08fuEKM 71Rrfh8yudnqqRzLGvwDr5h2dYL7Cf3b4+DjD7yRyADb2e1VadQEMA2dv47PemtB3A+O p/NB2P0AZYR3XxjwIwOgR8JxK8NZT6nHGwCuYLDF0gwQq6buS4WVQ0Kp1Ff9fZsA8XYj GqZAOKpZOkzBZY97JEXwQXs9OBz23zTDBcieHNjnh/nQLeVCvV5tRo9BtOEIYJ9Y/UBg j/RA== X-Gm-Message-State: AOAM530EzoQ4RdWp6Amzi7WvAuWvTvqLZd0DvKIK9dkbcM2hTqoyn1ui tcEG/BMubyMsJJlkkuFeHWcqBUzhJPWpejwak2aBow== X-Received: by 2002:aca:bd41:0:b0:2ec:ff42:814f with SMTP id n62-20020acabd41000000b002ecff42814fmr977960oif.63.1651544294289; Mon, 02 May 2022 19:18:14 -0700 (PDT) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Mon, 2 May 2022 19:18:13 -0700 MIME-Version: 1.0 In-Reply-To: References: <20220429233112.2851665-1-swboyd@chromium.org> <20220429233112.2851665-3-swboyd@chromium.org> From: Stephen Boyd User-Agent: alot/0.10 Date: Mon, 2 May 2022 19:18:13 -0700 Message-ID: Subject: Re: [PATCH v2 2/2] Input: cros-ec-keyb - skip keyboard registration for switches compatible To: Doug Anderson Cc: Dmitry Torokhov , LKML , patches@lists.linux.dev, chrome-platform@lists.linux.dev, Krzysztof Kozlowski , Rob Herring , devicetree@vger.kernel.org, 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 Quoting Doug Anderson (2022-05-02 18:06:39) > 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: Alright, I'm glad I misunderstood. > > 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. > Another important point is that the matrix properties are willfully ignored by the new driver if the "google,cros-ec-keyb-switches" compatible is present. Maybe it should be "google,cros-ec-no-keyb" to describe the true intent, i.e. ignore the keyboard properties. Or "google,cros-ec-keyboardless". I think it's confusing that I put "switches" in the compatible. It really should be about not registering the keyboard input device. Anyway, I agree that we don't need to use the matrix keyboard properties to figure out what to do. In fact, it isn't possible to remove the properties if "google,cros-ec-keyb" is present, so checking for them is redundant.