[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231110210716.GB419831-robh@kernel.org>
Date: Fri, 10 Nov 2023 15:07:16 -0600
From: Rob Herring <robh@...nel.org>
To: Chen-Yu Tsai <wenst@...omium.org>
Cc: Frank Rowand <frowand.list@...il.com>,
Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
Conor Dooley <conor+dt@...nel.org>,
Matthias Brugger <matthias.bgg@...il.com>,
AngeloGioacchino Del Regno
<angelogioacchino.delregno@...labora.com>,
Hsin-Yi Wang <hsinyi@...omium.org>,
Dmitry Torokhov <dmitry.torokhov@...il.com>,
andriy.shevchenko@...ux.intel.com, Jiri Kosina <jikos@...nel.org>,
linus.walleij@...aro.org, broonie@...nel.org,
gregkh@...uxfoundation.org, hdegoede@...hat.com,
james.clark@....com, james@...iv.tech, keescook@...omium.org,
petr.tesarik.ext@...wei.com, rafael@...nel.org, tglx@...utronix.de,
Jeff LaBundy <jeff@...undy.com>, linux-input@...r.kernel.org,
devicetree@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-mediatek@...ts.infradead.org, linux-kernel@...r.kernel.org,
Douglas Anderson <dianders@...omium.org>,
Johan Hovold <johan@...nel.org>
Subject: Re: [RFC PATCH v2 5/7] of: hw_prober: Support Chromebook SKU ID
based component selection
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 <wenst@...omium.org>
> ---
> 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 <linux/array_size.h>
> #include <linux/i2c.h>
> #include <linux/of.h>
> +#include <linux/of_graph.h>
> #include <linux/platform_device.h>
>
> #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
Powered by blists - more mailing lists