On 11/04/2025, Marek Vasut wrote:
> On 11/4/25 3:39 AM, Liu Ying wrote:
>
> Hello Liu,
Hello Marek,
>
>>> @@ -61,24 +62,13 @@ enum fsl_ldb_devtype {
>>> };
>>> struct fsl_ldb_devdata {
>>> - u32 ldb_ctrl;
>>> - u32 lvds_ctrl;
>>> bool lvds_en_bit;
>>> - bool single_ctrl_reg;
>>> };
>>> static const struct fsl_ldb_devdata fsl_ldb_devdata[] = {
>>
>> As I pointed out in v1 comment, this patch should remove struct
>> fsl_ldb_devdata.
>
> The lvds_en_bit is still needed , and I plan to add MX95 support here,
> which would extend this again. Going back and forth makes little sense.
lvds_en_bit is indeed needed and it doesn't have to be in struct
fsl_ldb_devdata. Given that it's not clear if i.MX95 LDB support would
be in fsl-ldb.c or not and it's trivial to add struct fsl_ldb_devdata
back if needed, I think this patch should remove struct fsl_ldb_devdata.
>
> [...]
>
>>> @@ -309,6 +302,27 @@ static int fsl_ldb_probe(struct platform_device *pdev)
>>> fsl_ldb->dev = &pdev->dev;
>>> fsl_ldb->bridge.of_node = dev->of_node;
>>> + /* No "reg-names" property likely means single-register LDB */
>>> + idx = of_property_match_string(dev->of_node, "reg-names", "ldb");
>>
>> You don't need to match reg-names. Instead, just call of_property_read_reg()
>> twice to get the first reg and the second reg by passing indexes 0 and 1 to
>> it.
>> If the second reg is not found, then set fsl_ldb->single_ctrl_reg to true.
>
> This wouldn't work if the two entries were ordered the other way around in,
> DT, i.e. first "ldb" second "lvds" and vice-versa. That's why properties
> with multiple values also have the -names property that goes with them.
Isn't the order checked by schema fsl,ldb.yaml? Let the schema do it's job.
"ldb" is the first item and "lvds" is the second one. If you swap the two
for the example in the schema, dt_binding_check would complain:
DTC [C] Documentation/devicetree/bindings/display/bridge/fsl,ldb.example.dtb
Documentation/devicetree/bindings/display/bridge/fsl,ldb.example.dtb: bridge@5c
(fsl,imx8mp-ldb): reg-names:0: 'ldb' was expected
from schema $id:
http://devicetree.org/schemas/display/bridge/fsl,ldb.yaml#
Documentation/devicetree/bindings/display/bridge/fsl,ldb.example.dtb: bridge@5c
(fsl,imx8mp-ldb): reg-names:1: 'lvds' was expected
from schema $id:
http://devicetree.org/schemas/display/bridge/fsl,ldb.yaml#
--
Regards,
Liu Ying