From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 91AC3C2D2; Fri, 10 Nov 2023 21:07:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=none Received: from mail-oi1-f181.google.com (mail-oi1-f181.google.com [209.85.167.181]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 510C21A5; Fri, 10 Nov 2023 13:07:19 -0800 (PST) Received: by mail-oi1-f181.google.com with SMTP id 5614622812f47-3b2df2fb611so1568097b6e.0; Fri, 10 Nov 2023 13:07:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699650438; x=1700255238; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=ZhcaUbufGGCGl+oelTC2ECkW5UU6FCUTDhDK/m2sCfs=; b=XCxhNq2i+SJco4U/QUBzzTNEJYDRGbSemA/Ytn390VKM9D6ORpAJeXH6l9J2eFTLHI lOARsjKojknd0b3vydqzBxcZfzVgG7CPCT36kPQ+f7VH2Hoa36YpEJi8Cmq/Ttr/Mtl7 Y/am0CYLXqw+istz8BKTl9nOYLJsKSSk4STpej+zVz/z6YlcOkCMbh4caWEcFw42hhpa K0JDcdQdXUD2XnUV9wRpoC/VTU1KXXE0WZTBVFjptUU4sOz6OB72ft7KNwv8tQf2c6h1 biYLUi0jlOIFt+s8+v4zK7R21LYBDjc/7/7LuAVjJZY/2/akL864lU6fxv22h6hehybp y71w== X-Gm-Message-State: AOJu0YxVeOVSvITd6YYeuxYEs4dgWusvyeeFkTpCA0jqF3qovYCkT3ka 3r/DJaS/T/o8Dcv8B2kiaA== X-Google-Smtp-Source: AGHT+IEQ7c/sxZ5ogUqRUDBd0ii59Sbjxux7vfokGIfN/0AadRuyYuXRaQGnZx2kQuCJ3B3CfRxsGA== X-Received: by 2002:a05:6870:2b13:b0:1ef:b809:3f26 with SMTP id ld19-20020a0568702b1300b001efb8093f26mr476789oab.17.1699650438610; Fri, 10 Nov 2023 13:07:18 -0800 (PST) Received: from herring.priv (66-90-144-107.dyn.grandenetworks.net. [66.90.144.107]) by smtp.gmail.com with ESMTPSA id e5-20020a056870920500b001e9b02b00e9sm67574oaf.22.2023.11.10.13.07.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Nov 2023 13:07:18 -0800 (PST) Received: (nullmailer pid 434762 invoked by uid 1000); Fri, 10 Nov 2023 21:07:16 -0000 Date: Fri, 10 Nov 2023 15:07:16 -0600 From: Rob Herring To: Chen-Yu Tsai Cc: Frank Rowand , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno , 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, petr.tesarik.ext@huawei.com, rafael@kernel.org, tglx@linutronix.de, Jeff LaBundy , linux-input@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, Douglas Anderson , Johan Hovold Subject: Re: [RFC PATCH v2 5/7] of: hw_prober: Support Chromebook SKU ID based component selection Message-ID: <20231110210716.GB419831-robh@kernel.org> References: <20231109100606.1245545-1-wenst@chromium.org> <20231109100606.1245545-6-wenst@chromium.org> Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231109100606.1245545-6-wenst@chromium.org> On Thu, Nov 09, 2023 at 06:06:02PM +0800, Chen-Yu Tsai wrote: > In cases where the same Chromebook model is manufactured with different > components (MIPI DSI panels, MIPI CSI camera sensors, or trackpad / > touchscreens with conflicting addresses), a different SKU ID is > allocated to each specific combination. This SKU ID is exported by the > bootloader into the device tree, and can be used to "discover" which > combination is present on the current machine. > > This change adds a hardware prober that will match the SKU ID against > a provided table, and enable the component for the matched entry based > on the given compatible string. In the MIPI DSI panel and MIPI CSI > camera sensor cases which have OF graphs, it will also update the > remote endpoint to point to the enabled component. This assumes a single > endpoint only. > > This will provide a path to reducing the number of Chromebook device > trees. > > Signed-off-by: Chen-Yu Tsai > --- > drivers/of/hw_prober.c | 160 +++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 160 insertions(+) This certainly does not belong in drivers/of/. > diff --git a/drivers/of/hw_prober.c b/drivers/of/hw_prober.c > index 442da6eff896..4345e5aed6d8 100644 > --- a/drivers/of/hw_prober.c > +++ b/drivers/of/hw_prober.c > @@ -8,6 +8,7 @@ > #include > #include > #include > +#include > #include > > #define DRV_NAME "hw_prober" > @@ -108,9 +109,168 @@ static int i2c_component_prober(struct platform_device *pdev, const void *data) > return ret; > } > > +static int cros_get_coreboot_sku_id(struct device *dev, u32 *sku_id) > +{ > + struct device_node *node = NULL; > + int ret; > + > + node = of_find_node_by_path("/firmware/coreboot"); > + if (!node) > + return dev_err_probe(dev, -EINVAL, "Cannot find coreboot firmware node\n"); > + > + ret = of_property_read_u32(node, "sku-id", sku_id); Not documented. Rob From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 32D68C4332F for ; Fri, 10 Nov 2023 21:07:51 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=x2E9r6Ikr436EpDB6fM3BOFH1OyEPKplHrXrYRRdiAQ=; b=uGwFwuR2nTRX0r EumZHqnp157svdjWwgWA8PBOPNN3adAFJlf8OLfgTFLAVCi8BxxcLacpIqsHy1WvUT1+wj/cmLxyx 0/zXzAYH3yoplO2FXS0/rE0g/smRbvIVXgREk/pDQLM8G+DRc3mawjifLKEu1BVz2VASwlZqCIWnl PYp/X5hHPixN9M1iQvj+xWb0kd5BSzTJplycfJ/wvPpj9kYIEVAEYdo7IFDmsIKU+ZGL2TUUnT9nB perCh4dxktiC+2IfLsiNLpSq1UDZ0zZTfj9mhHl3iozS4Uj/z9T7925dnn/Ku8LvCyURgL8VN6rP1 92FiQF4xwdTNOe/x4ugQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r1Yiu-009SAH-1c; Fri, 10 Nov 2023 21:07:28 +0000 Received: from mail-oa1-f42.google.com ([209.85.160.42]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r1Yir-009S99-2i; Fri, 10 Nov 2023 21:07:27 +0000 Received: by mail-oa1-f42.google.com with SMTP id 586e51a60fabf-1f03d9ad89fso1292453fac.1; Fri, 10 Nov 2023 13:07:19 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699650438; x=1700255238; h=in-reply-to:content-disposition:mime-version:references:message-id :subject:cc:to:from:date:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=ZhcaUbufGGCGl+oelTC2ECkW5UU6FCUTDhDK/m2sCfs=; b=VH6gTpl2ys7e8Smrhc7qtMnm7hUHYsvZQ+AbnI4s409SBk/Gt4WHQ48ieMCB3iWid/ vH6yRwoUS6Ft6jv2Fdxxs/haUHNtRSLofA+Zj5rGRB2Wql8Pez5HmQGnNHVHI2y6ok2/ 6kq+buigbRG8cEa/Wki1vz1ZETKhWb0wXh7kCj/dNJmj6BV949K5fXvy5GYumARPEbBT c+bKWJCBqMpbtgEK58R4C2Ae0bcrknR1zCr3FjR2T11oI3gEO5nQIbTT9bJS2+iCNuHF nCHwqPoAAcxw0W7QiSfsEgDtdIgcIC4RlQTPqk2WNXnEuHO0Vy/zQVQHLuTqmTu/BbMI 2GWA== X-Gm-Message-State: AOJu0YyCta/tjq8JKCGAtSs76oN6JCWgjekNUZ5eK4SQRczJ3GqZ66dR WUTEwLvYnVKb+y5b6KAGcg== X-Google-Smtp-Source: AGHT+IEQ7c/sxZ5ogUqRUDBd0ii59Sbjxux7vfokGIfN/0AadRuyYuXRaQGnZx2kQuCJ3B3CfRxsGA== X-Received: by 2002:a05:6870:2b13:b0:1ef:b809:3f26 with SMTP id ld19-20020a0568702b1300b001efb8093f26mr476789oab.17.1699650438610; Fri, 10 Nov 2023 13:07:18 -0800 (PST) Received: from herring.priv (66-90-144-107.dyn.grandenetworks.net. [66.90.144.107]) by smtp.gmail.com with ESMTPSA id e5-20020a056870920500b001e9b02b00e9sm67574oaf.22.2023.11.10.13.07.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Nov 2023 13:07:18 -0800 (PST) Received: (nullmailer pid 434762 invoked by uid 1000); Fri, 10 Nov 2023 21:07:16 -0000 Date: Fri, 10 Nov 2023 15:07:16 -0600 From: Rob Herring To: Chen-Yu Tsai Cc: Frank Rowand , Krzysztof Kozlowski , Conor Dooley , Matthias Brugger , AngeloGioacchino Del Regno , 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, petr.tesarik.ext@huawei.com, rafael@kernel.org, tglx@linutronix.de, Jeff LaBundy , linux-input@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, Douglas Anderson , Johan Hovold Subject: Re: [RFC PATCH v2 5/7] of: hw_prober: Support Chromebook SKU ID based component selection Message-ID: <20231110210716.GB419831-robh@kernel.org> References: <20231109100606.1245545-1-wenst@chromium.org> <20231109100606.1245545-6-wenst@chromium.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20231109100606.1245545-6-wenst@chromium.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231110_130725_880577_4AECD843 X-CRM114-Status: GOOD ( 23.43 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Thu, Nov 09, 2023 at 06:06:02PM +0800, Chen-Yu Tsai wrote: > In cases where the same Chromebook model is manufactured with different > components (MIPI DSI panels, MIPI CSI camera sensors, or trackpad / > touchscreens with conflicting addresses), a different SKU ID is > allocated to each specific combination. This SKU ID is exported by the > bootloader into the device tree, and can be used to "discover" which > combination is present on the current machine. > > This change adds a hardware prober that will match the SKU ID against > a provided table, and enable the component for the matched entry based > on the given compatible string. In the MIPI DSI panel and MIPI CSI > camera sensor cases which have OF graphs, it will also update the > remote endpoint to point to the enabled component. This assumes a single > endpoint only. > > This will provide a path to reducing the number of Chromebook device > trees. > > Signed-off-by: Chen-Yu Tsai > --- > drivers/of/hw_prober.c | 160 +++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 160 insertions(+) This certainly does not belong in drivers/of/. > diff --git a/drivers/of/hw_prober.c b/drivers/of/hw_prober.c > index 442da6eff896..4345e5aed6d8 100644 > --- a/drivers/of/hw_prober.c > +++ b/drivers/of/hw_prober.c > @@ -8,6 +8,7 @@ > #include > #include > #include > +#include > #include > > #define DRV_NAME "hw_prober" > @@ -108,9 +109,168 @@ static int i2c_component_prober(struct platform_device *pdev, const void *data) > return ret; > } > > +static int cros_get_coreboot_sku_id(struct device *dev, u32 *sku_id) > +{ > + struct device_node *node = NULL; > + int ret; > + > + node = of_find_node_by_path("/firmware/coreboot"); > + if (!node) > + return dev_err_probe(dev, -EINVAL, "Cannot find coreboot firmware node\n"); > + > + ret = of_property_read_u32(node, "sku-id", sku_id); Not documented. Rob _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel