Commit db8f92a5 authored by Ricardo Cañuelo's avatar Ricardo Cañuelo Committed by Sam Ravnborg

drm/bridge: tfp410: fix de-skew value retrieval from DT

The tfp410 has a data de-skew feature that allows the user to compensate
the skew between IDCK and the pixel data and control signals.

In the driver, the setup and hold times are calculated from the de-skew
value. This retrieves the deskew value from the DT using the proper
datatype and range check as described by the binding (u32 from 0 to 7).

This fix results from a change in the ti,tfp410 DT binding.
Signed-off-by: default avatarRicardo Cañuelo <ricardo.canuelo@collabora.com>
Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200617094633.19663-4-ricardo.canuelo@collabora.com
parent 520a994d
...@@ -220,7 +220,7 @@ static int tfp410_parse_timings(struct tfp410 *dvi, bool i2c) ...@@ -220,7 +220,7 @@ static int tfp410_parse_timings(struct tfp410 *dvi, bool i2c)
struct device_node *ep; struct device_node *ep;
u32 pclk_sample = 0; u32 pclk_sample = 0;
u32 bus_width = 24; u32 bus_width = 24;
s32 deskew = 0; u32 deskew = 0;
/* Start with defaults. */ /* Start with defaults. */
*timings = tfp410_default_timings; *timings = tfp410_default_timings;
...@@ -274,12 +274,12 @@ static int tfp410_parse_timings(struct tfp410 *dvi, bool i2c) ...@@ -274,12 +274,12 @@ static int tfp410_parse_timings(struct tfp410 *dvi, bool i2c)
} }
/* Get the setup and hold time from vendor-specific properties. */ /* Get the setup and hold time from vendor-specific properties. */
of_property_read_u32(dvi->dev->of_node, "ti,deskew", (u32 *)&deskew); of_property_read_u32(dvi->dev->of_node, "ti,deskew", &deskew);
if (deskew < -4 || deskew > 3) if (deskew > 7)
return -EINVAL; return -EINVAL;
timings->setup_time_ps = min(0, 1200 - 350 * deskew); timings->setup_time_ps = min(0, 1200 - 350 * ((s32)deskew - 4));
timings->hold_time_ps = min(0, 1300 + 350 * deskew); timings->hold_time_ps = min(0, 1300 + 350 * ((s32)deskew - 4));
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment