Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp2548741rdb; Sun, 3 Dec 2023 23:55:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IHC8AFQzxmDUd+vagKnKh3KjFOC4A8t4F31QI1zjs8873QnRNHhIDlOscgjkBoPIhzAgEMA X-Received: by 2002:a05:6a20:daa7:b0:18b:a2a9:9158 with SMTP id iy39-20020a056a20daa700b0018ba2a99158mr1546502pzb.25.1701676556313; Sun, 03 Dec 2023 23:55:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701676556; cv=none; d=google.com; s=arc-20160816; b=uHlIFJrKXSs7VYYq3zq5fS18e4fJqG6iveH9iY2/9Spwb0NG5xC0plyWcLDp+8PBdR 7Bu8vUxyz0aGYK/G8RF3AmRiW4IOL7FURr6Hw+rFdx3oWVP71ZjJTw8hEY7lL6ov93JT gtgACU+r5mtLH8+AHv9JdN7Z5RQOJP9yTVsQKE5/EahhDCluACIiQ6ggef2mg2rIzps5 Di/o3NkC0lDLkcRrfZOAIgIKcXnOtaa8Jq8h2cEuvqqp3bKx3bt/QDUnGX9YZQXKDKnA HUHsxLtoYmPtGRGPhyMu3jffibA9qQGU+GG/rAjVeWMjttf/36efT3XrInURGi9Pj71r l8Ow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=2SzWfC6WDG0HEDP8yk1dI76L7Vjoulwh6flVXPbKqmw=; fh=p/SGz1E48p8PkBKSYlXYb5M1KcI/kJgjwlVP+sRZCI4=; b=doLns+sGbK2sIdwivpykJipvyE+kpPNvJ9GPnSjzo4ebv/lXzC66pPoQ3Yf/3R5RYW Wj3zfUHUmIWN31e82/fSHLzRpfyVJgEUcumn5ANcB+mlRNSzuzcfBHINq9DakJ86fO9C 0kCbd+V5P/vUlGMga2zJRqv8Aemsn9e0pzgjcrHrt5mukE0QjRlhV/oEDwQxKSmjgpkh cii46kOdmVWRJvMSxh9ZbsRQmG6zlbCN7TJwfib1a2NpL+wZIOHTM3Prh9791xxFgfe/ Qv+ufJLRaTyBn4BTnk/Mxuc0QN9S0F3gL9i+kGvqbtMGavy8+Ab7tBG9rqrJDYcA5PhI WKFA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=G1gmXNpr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 groat.vger.email (groat.vger.email. [23.128.96.35]) by mx.google.com with ESMTPS id e15-20020a056a001a8f00b006c2cb9a884fsi7526017pfv.293.2023.12.03.23.55.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 03 Dec 2023 23:55:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 as permitted sender) client-ip=23.128.96.35; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=G1gmXNpr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.35 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 out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id B361D807C558; Sun, 3 Dec 2023 23:55:38 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234730AbjLDHzR (ORCPT + 99 others); Mon, 4 Dec 2023 02:55:17 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47190 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234750AbjLDHzF (ORCPT ); Mon, 4 Dec 2023 02:55:05 -0500 Received: from mail-lf1-x136.google.com (mail-lf1-x136.google.com [IPv6:2a00:1450:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AFC882722 for ; Sun, 3 Dec 2023 23:53:46 -0800 (PST) Received: by mail-lf1-x136.google.com with SMTP id 2adb3069b0e04-50bf32c0140so910389e87.1 for ; Sun, 03 Dec 2023 23:53:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1701676423; x=1702281223; darn=vger.kernel.org; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=2SzWfC6WDG0HEDP8yk1dI76L7Vjoulwh6flVXPbKqmw=; b=G1gmXNprbCprtMygGCN3TP+iUIH45Nhj5aH5ytMuBnhD4sYtRVa9bgvHZwHLStsUl3 5nxZ2yBAzaYFot27FHzpvORKMtOK6RcoVFrRe0tDMVSjhYjyaUuZvw3B+C18WHWmIzC4 Rqu9/Jcq/bJu306I6WCfqZROzwFqQwyxegI+k= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701676423; x=1702281223; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2SzWfC6WDG0HEDP8yk1dI76L7Vjoulwh6flVXPbKqmw=; b=RmEeZ3chD9AyJUXxaJJ60rRhqjvkaOxjHMdA+oTNk3iBXZ6F7Pgz2w4XpKkZnzb4nl L1tB87IsARU/mTJSrIG+MmitAb1v7RBZ2dyyaR437mTxLadZ4npaIUSUxYzgIwx0Tprm lwj2ZE+J3Qucj2pql7Y2wxPX2JQQNrLtYhhrMA9E68P2oAgP89YnNC3Rw5YXpT52x0OR dYa8yzhoIBtasCLcIOLA9TLuzIIrCA+osfsOTNatPY+jeqfAwotF5ONQEV9Tfhgq6yUe dlMN6ynbfCHT4OMFxV1gSZEkNJICLXM0hpQAK3jfwCP4vNd3Z85K4/W9Xqv88xnOLHba yPQg== X-Gm-Message-State: AOJu0YxVY3H2s/Vf9jNyr2lnSjUs0NOIJcowjEzzWRgdqtLWvzoHUsPp f6QWXC/Io2ZAxUoKV0+SgJWHgg1R0dHYAEOcVSOh6w== X-Received: by 2002:a05:6512:3088:b0:50b:d764:64a7 with SMTP id z8-20020a056512308800b0050bd76464a7mr2985712lfd.92.1701676422869; Sun, 03 Dec 2023 23:53:42 -0800 (PST) MIME-Version: 1.0 References: <20231128084236.157152-1-wenst@chromium.org> <20231128084236.157152-4-wenst@chromium.org> In-Reply-To: From: Chen-Yu Tsai Date: Mon, 4 Dec 2023 15:53:31 +0800 Message-ID: Subject: Re: [RFC PATCH v3 3/5] platform/chrome: Introduce device tree hardware prober To: Doug Anderson Cc: Rob Herring , Frank Rowand , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno , Wolfram Sang , Benson Leung , Tzung-Bi Shih , chrome-platform@lists.linux.dev, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, Johan Hovold , Hsin-Yi Wang , Dmitry Torokhov , andriy.shevchenko@linux.intel.com, Jiri Kosina , linus.walleij@linaro.org, broonie@kernel.org, gregkh@linuxfoundation.org, hdegoede@redhat.com, james.clark@arm.com, james@equiv.tech, keescook@chromium.org, rafael@kernel.org, tglx@linutronix.de, Jeff LaBundy , linux-input@vger.kernel.org, linux-i2c@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,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 groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Sun, 03 Dec 2023 23:55:39 -0800 (PST) On Mon, Dec 4, 2023 at 3:24=E2=80=AFPM Chen-Yu Tsai wr= ote: > > On Sat, Dec 2, 2023 at 8:58=E2=80=AFAM Doug Anderson wrote: > > > > Hi, > > > > On Tue, Nov 28, 2023 at 12:45=E2=80=AFAM Chen-Yu Tsai wrote: > > > > > > @@ -61,6 +61,17 @@ config CHROMEOS_TBMC > > > To compile this driver as a module, choose M here: the > > > module will be called chromeos_tbmc. > > > > > > +config CHROMEOS_OF_HW_PROBER > > > + bool "ChromeOS Device Tree Hardware Prober" > > > > Any reason that it can't be a module? > > No technical one. However if it's a module, the user has to manually load > it. So I think it's more of a usability thing. We could probably manually add module aliases. I thought about aliases against the machine compatibles, but there doesn't seem to be a device for it to trigger. Or target something common to ChromeOS devices like the EC? It's really hacky though. ChenYu > OOTH I think this needs to be a module if I2C is built as a module. > Somehow I had thought of it at one point but then it slipped my mind. > > > > + depends on OF > > > + depends on I2C > > > + select OF_DYNAMIC > > > + default OF > > > > You probably don't want "default OF". This means that everyone will > > automatically get this new driver enabled which is unlikely to be > > right. > > I thought this whole section was guarded behind KCONFIG_CHROME_PLATFORMS. > So if the user has CHROME_PLATFORMS enabled and has OF enabled, they > likely need the prober. > > > > +static int chromeos_of_hw_prober_probe(struct platform_device *pdev) > > > +{ > > > + for (size_t i =3D 0; i < ARRAY_SIZE(hw_prober_platforms); i++= ) > > > + if (of_machine_is_compatible(hw_prober_platforms[i].c= ompatible)) { > > > + int ret; > > > + > > > + ret =3D hw_prober_platforms[i].prober(&pdev->= dev, > > > + hw_prober= _platforms[i].data); > > > + if (ret) > > > > Should it only check for -EPROBE_DEFER here? ...and then maybe warn > > for other cases and go through the loop? If there's some error > > enabling the touchscreen I'd still want the trackpad to probe... > > Makes sense. However there's no extra information to give in the > warning though. > > > > + return ret; > > > + } > > > + > > > + return 0; > > > > Random thought: once we get here, the driver is useless / just wasting > > memory. Any way to have it freed? ;-) > > I don't think there is a good way to do that, except maybe marking all > the functions as __init? But that likely doesn't work in combination > with deferred probing (say the i2c driver is a module). > > ChenYu