diff options
| author | Nikhil M Jain <[email protected]> | 2023-01-31 15:35:14 +0530 |
|---|---|---|
| committer | Anatolij Gustschin <[email protected]> | 2023-02-04 18:13:21 +0100 |
| commit | 0347cc7732703bdf94bba5ce8a157c2174f01067 (patch) | |
| tree | c7affe83505501a069be4109748a980f0a206367 /drivers | |
| parent | f4cf8710a16c0fe1c98e8265b50ac2826869becf (diff) | |
drivers: core: ofnode: Add panel timing decode.
ofnode_decode_display_timing supports reading timing parameters from
subnode of display-timings node, for displays supporting multiple
resolution, in case if a display supports single resolution, it fails
reading directly from display-timings node, to support it
ofnode_decode_panel_timing is added.
Signed-off-by: Nikhil M Jain <[email protected]>
Reviewed-by: Simon Glass <[email protected]>
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/core/ofnode.c | 47 | ||||
| -rw-r--r-- | drivers/core/read.c | 6 |
2 files changed, 53 insertions, 0 deletions
diff --git a/drivers/core/ofnode.c b/drivers/core/ofnode.c index 4d56b1a7675..d08578e9c4f 100644 --- a/drivers/core/ofnode.c +++ b/drivers/core/ofnode.c @@ -991,6 +991,53 @@ int ofnode_decode_display_timing(ofnode parent, int index, return ret; } +int ofnode_decode_panel_timing(ofnode parent, + struct display_timing *dt) +{ + ofnode timings; + u32 val = 0; + int ret = 0; + + timings = ofnode_find_subnode(parent, "panel-timings"); + if (!ofnode_valid(timings)) + return -EINVAL; + memset(dt, 0, sizeof(*dt)); + ret |= decode_timing_property(timings, "hback-porch", &dt->hback_porch); + ret |= decode_timing_property(timings, "hfront-porch", &dt->hfront_porch); + ret |= decode_timing_property(timings, "hactive", &dt->hactive); + ret |= decode_timing_property(timings, "hsync-len", &dt->hsync_len); + ret |= decode_timing_property(timings, "vback-porch", &dt->vback_porch); + ret |= decode_timing_property(timings, "vfront-porch", &dt->vfront_porch); + ret |= decode_timing_property(timings, "vactive", &dt->vactive); + ret |= decode_timing_property(timings, "vsync-len", &dt->vsync_len); + ret |= decode_timing_property(timings, "clock-frequency", &dt->pixelclock); + dt->flags = 0; + if (!ofnode_read_u32(timings, "vsync-active", &val)) { + dt->flags |= val ? DISPLAY_FLAGS_VSYNC_HIGH : + DISPLAY_FLAGS_VSYNC_LOW; + } + if (!ofnode_read_u32(timings, "hsync-active", &val)) { + dt->flags |= val ? DISPLAY_FLAGS_HSYNC_HIGH : + DISPLAY_FLAGS_HSYNC_LOW; + } + if (!ofnode_read_u32(timings, "de-active", &val)) { + dt->flags |= val ? DISPLAY_FLAGS_DE_HIGH : + DISPLAY_FLAGS_DE_LOW; + } + if (!ofnode_read_u32(timings, "pixelclk-active", &val)) { + dt->flags |= val ? DISPLAY_FLAGS_PIXDATA_POSEDGE : + DISPLAY_FLAGS_PIXDATA_NEGEDGE; + } + if (ofnode_read_bool(timings, "interlaced")) + dt->flags |= DISPLAY_FLAGS_INTERLACED; + if (ofnode_read_bool(timings, "doublescan")) + dt->flags |= DISPLAY_FLAGS_DOUBLESCAN; + if (ofnode_read_bool(timings, "doubleclk")) + dt->flags |= DISPLAY_FLAGS_DOUBLECLK; + + return ret; +} + const void *ofnode_get_property(ofnode node, const char *propname, int *lenp) { if (ofnode_is_np(node)) diff --git a/drivers/core/read.c b/drivers/core/read.c index 3e5fea87d84..e0543bbad59 100644 --- a/drivers/core/read.c +++ b/drivers/core/read.c @@ -420,6 +420,12 @@ int dev_decode_display_timing(const struct udevice *dev, int index, return ofnode_decode_display_timing(dev_ofnode(dev), index, config); } +int dev_decode_panel_timing(const struct udevice *dev, + struct display_timing *config) +{ + return ofnode_decode_panel_timing(dev_ofnode(dev), config); +} + ofnode dev_get_phy_node(const struct udevice *dev) { return ofnode_get_phy_node(dev_ofnode(dev)); |
