[U-Boot] [PATCH 3/5] fdt: add fdt_add_display_timings(..)

Christian Gmeiner christian.gmeiner at gmail.com
Thu Jan 16 12:44:57 CET 2014


Hi all

2014/1/14 Christian Gmeiner <christian.gmeiner at gmail.com>:
> 2014/1/12 Anatolij Gustschin <agust at denx.de>:
>> Hi Stefano,
>>
>> On Wed, 08 Jan 2014 11:53:39 +0100
>> Stefano Babic <sbabic at denx.de> wrote:
>> ...
>>> Agree that we have to sync u-boot and kernel, and this can be a way in
>>> the short term.
>>>
>>> I am asking if this is in the long term the best way to do it. You are
>>> converting EDID values to fb_videomode *mode, and then again to the
>>> device node as required by DT.
>>> We have already had some talks about moving U-Boot configuration to DT,
>>> that is U-Boot can be also configured by a DT file (see for example
>>> support for Nvidia processors, they already support DT in U-Boot).
>>>
>>> Anatolji, what do you think as best solution we have to follow for
>>> display setting ?
>>
>> many drivers use struct fb_videomode internally and this display-timings
>> binding already exists in linux, so I think a function for converting
>> from fb_videomode to DT is useful. However we should probably extend
>> this current implementation of the function, e.g. rename it to
>> fdt_update_display_timings() and pass more arguments: node compatible
>> and the name of the parent node containing the display-timings node.
>> The code for searching the display-timings node is also needed for
>> other boards, so if it is in the function itself, it will simplify
>> the usage.
>>
>> This function could look for display-timings node and create it if
>> it doesn't exist. Or update the existing node with new info.
>>
>
> Thanks for your comments... will come up with something in the next version
> of the patch series.
>

I have some time to work on this patch.

Anatolij are you happy witht the following functions?

int fdt_find_display_timings(void *fdt, const char *compat, const char *parent)
{
    int coff = fdt_node_offset_by_compatible(fdt, -1, compat);
    int poff = fdt_subnode_offset(fdt, coff, parent);
    int timings = fdt_subnode_offset(fdt, poff, "display-timings");

    return timings;
}

int fdt_update_display_timings(void *fdt, const char *compat, const
char *parent, struct fb_videomode *mode)
{
    int timings = fdt_find_display_timings(fdt, compat, parent);

    /* check if display-timings subnode does exist */
    if (timings == -FDT_ERR_NOTFOUND) {
        return timings;
    }

    /* set all needed properties */
    if (timings != -FDT_ERR_NOTFOUND) {
        fdt_setprop_u32(fdt, noff, "clock-frequency", mode->pixclock);
        fdt_setprop_u32(fdt, noff, "hactive", mode->xres);
        fdt_setprop_u32(fdt, noff, "vactive", mode->yres);
        fdt_setprop_u32(fdt, noff, "hback-porch", mode->left_margin);
        fdt_setprop_u32(fdt, noff, "hfront-porch", mode->right_margin);
        fdt_setprop_u32(fdt, noff, "vback-porch", mode->upper_margin);
        fdt_setprop_u32(fdt, noff, "vfront-porch", mode->lower_margin);
        fdt_setprop_u32(fdt, noff, "hsync-len", mode->hsync_len);
        fdt_setprop_u32(fdt, noff, "vsync-len", mode->vsync_len);
    }

    return 0;
}

This would allow us to update an existing display-timings node via

fdt_update_display_timings(blob, "fsl,imx6q-ldb", "lvds-channel", mode);


Note: not even compile tested :)

thanks
--
Christian Gmeiner, MSc


More information about the U-Boot mailing list