Commit a723d434 authored by Marek Vasut's avatar Marek Vasut Committed by Robert Foss

drm/bridge: tc358767: Use tc_pxl_pll_calc() to correct adjusted_mode clock

Use tc_pxl_pll_calc() to find out the exact clock frequency generated by the
Pixel PLL. Use the Pixel PLL frequency as adjusted_mode clock frequency and
pass it down the display pipeline to obtain exactly this frequency on input
into this bridge.

The precise input frequency that matches the Pixel PLL frequency is
important for this bridge, as if the frequencies do not match, the
bridge does suffer VFIFO overruns or underruns.
Reviewed-by: default avatarAlexander Stein <alexander.stein@ew.tq-group.com>
Signed-off-by: default avatarMarek Vasut <marex@denx.de>
Signed-off-by: default avatarRobert Foss <rfoss@kernel.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20240625120334.145320-2-marex@denx.de
parent 84708c2d
...@@ -1624,6 +1624,18 @@ static int tc_dpi_atomic_check(struct drm_bridge *bridge, ...@@ -1624,6 +1624,18 @@ static int tc_dpi_atomic_check(struct drm_bridge *bridge,
struct drm_crtc_state *crtc_state, struct drm_crtc_state *crtc_state,
struct drm_connector_state *conn_state) struct drm_connector_state *conn_state)
{ {
struct tc_data *tc = bridge_to_tc(bridge);
int adjusted_clock = 0;
int ret;
ret = tc_pxl_pll_calc(tc, clk_get_rate(tc->refclk),
crtc_state->mode.clock * 1000,
&adjusted_clock, NULL);
if (ret)
return ret;
crtc_state->adjusted_mode.clock = adjusted_clock / 1000;
/* DSI->DPI interface clock limitation: upto 100 MHz */ /* DSI->DPI interface clock limitation: upto 100 MHz */
if (crtc_state->adjusted_mode.clock > 100000) if (crtc_state->adjusted_mode.clock > 100000)
return -EINVAL; return -EINVAL;
...@@ -1636,6 +1648,18 @@ static int tc_edp_atomic_check(struct drm_bridge *bridge, ...@@ -1636,6 +1648,18 @@ static int tc_edp_atomic_check(struct drm_bridge *bridge,
struct drm_crtc_state *crtc_state, struct drm_crtc_state *crtc_state,
struct drm_connector_state *conn_state) struct drm_connector_state *conn_state)
{ {
struct tc_data *tc = bridge_to_tc(bridge);
int adjusted_clock = 0;
int ret;
ret = tc_pxl_pll_calc(tc, clk_get_rate(tc->refclk),
crtc_state->mode.clock * 1000,
&adjusted_clock, NULL);
if (ret)
return ret;
crtc_state->adjusted_mode.clock = adjusted_clock / 1000;
/* DPI->(e)DP interface clock limitation: upto 154 MHz */ /* DPI->(e)DP interface clock limitation: upto 154 MHz */
if (crtc_state->adjusted_mode.clock > 154000) if (crtc_state->adjusted_mode.clock > 154000)
return -EINVAL; return -EINVAL;
......
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