I'm working on a embedded device with Yocto Linux. Recently the display type was replaced. I was able to make the changes in the kernel and device tree. But now I'm suffering to enable both types in the same image.
How can I add two panel-lcd definitions with status="disabled" and activate one OR the other by calling of_fixup_status() in Barebox?
My dtsi looks like this:
/ {
panel-lcd-tn {
compatible = "powertip,ph320240t023_iha";
backlight = <&backlight_peb>;
status = "disabled";
port {
panel_in: endpoint {
remote-endpoint = <&display_out>;
};
};
};
panel-lcd-ips {
compatible = "powertip,ph320240t028_zha";
backlight = <&backlight_peb>;
status = "disabled";
port {
panel_in: endpoint {
remote-endpoint = <&display_out>;
};
};
};
...
...
...
};
&lcdif {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_lcdif_dat>;
status = "disabled";
port {
display_out: endpoint {
remote-endpoint = <&panel_in>;
};
};
};
The compiler tells me
Duplicate label 'panel_in'
Note: The only difference is the compatible string.
I've tried to rename panel_in to panel_in1 and panel_in2, but then the reference to this label is no longer valid at &lcdif. So I've doubled this one a well. The DT compiles then, but the display does not work any more. On bootup the error
mxsfb 21c8000.lcdif: Cannot connect bridge: -19
appears. Does anybody have a clue how to solve it?
In general, having two device tree nodes and enabling one or the other is a good approach. Panels are a bit special though, because they use the device tree graph binding, where the panel points at the display controller (or an in-between bridge) and the display points back. Duplicating the panel and choosing one or the other thus means that you also need to fix up the link in the display controller node. That's doable, but it's easier to just keep a single panel node and fix up only the compatible dynamically.
Provided your kernel device tree looks like this:
It's then quite trivial to rewrite the kernel device tree in barebox:
-fregisters a fixup, i.e. the change is applied to the kernel device tree on boot and not to the barebox device tree.-smeans to set the property.displayis the alias we choose (We could also have used/panel-lcd).You can add this script into your barebox environment
initdirectory, so it's automatically sourced on startup.You can also achieve the same in C board code. This can be better than a script, when you e.g. disable the shell interpreter in a secure booting system, if you do more complex fixups or if you need to parse some more complex EEPROM format to determine what panel you have. Here's an example:
This code is usually placed in your board code directory, e.g.
arch/arm/boards/my-customboard/board.c.my,imx6q-customboardis the compatible of your board (as written in the barebox device tree).Finally, barebox also supports applying device tree overlays, which it will translate into fixups under the hood. For you simple case, explicitly using a fixup may be the easier way though.