diff options
author | Tim Harvey <tharvey@gateworks.com> | 2015-04-08 11:45:39 -0700 |
---|---|---|
committer | Stefano Babic <sbabic@denx.de> | 2015-04-22 14:39:06 +0200 |
commit | 08daa258e6a87c452d242d5e2d667710184156b2 (patch) | |
tree | b928cd94f00e2e2b40173435fff000ba1f6ae8fe /common | |
parent | 78c5a180871d4337d4cfd41d6739a04b271b2e4d (diff) | |
download | u-boot-08daa258e6a87c452d242d5e2d667710184156b2.tar.gz u-boot-08daa258e6a87c452d242d5e2d667710184156b2.tar.xz u-boot-08daa258e6a87c452d242d5e2d667710184156b2.zip |
fdt: add new fdt_fixup_display function to configure display
Add 'fdt_fixup_display' function to fixup device-tree native-mode property
of display-timings node to select timings for a specific display.
This is useful if a device-tree has configurations for multiple
display timings for undetectable displays.
see kernel Documentation/devicetree/bindings/video/display-timing.txt
Signed-off-by: Tim Harvey <tharvey@gateworks.com>
Acked-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common')
-rw-r--r-- | common/fdt_support.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/common/fdt_support.c b/common/fdt_support.c index 8266bca7d6..c5ed5ad89e 100644 --- a/common/fdt_support.c +++ b/common/fdt_support.c @@ -1560,3 +1560,32 @@ int fdt_setup_simplefb_node(void *fdt, int node, u64 base_address, u32 width, return 0; } + +/* + * Update native-mode in display-timings from display environment variable. + * The node to update are specified by path. + */ +int fdt_fixup_display(void *blob, const char *path, const char *display) +{ + int off, toff; + + if (!display || !path) + return -FDT_ERR_NOTFOUND; + + toff = fdt_path_offset(blob, path); + if (toff >= 0) + toff = fdt_subnode_offset(blob, toff, "display-timings"); + if (toff < 0) + return toff; + + for (off = fdt_first_subnode(blob, toff); + off >= 0; + off = fdt_next_subnode(blob, off)) { + uint32_t h = fdt_get_phandle(blob, off); + debug("%s:0x%x\n", fdt_get_name(blob, off, NULL), + fdt32_to_cpu(h)); + if (strcasecmp(fdt_get_name(blob, off, NULL), display) == 0) + return fdt_setprop_u32(blob, toff, "native-mode", h); + } + return toff; +} |