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@xxxxxxxxxxxx> > --- > 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