Skip to content

Commit

Permalink
drm/bridge: dw-mipi-dsi: permit configuring the escape clock rate
Browse files Browse the repository at this point in the history
The Amlogic D-PHY in the Amlogic AXG SoC Family does support a frequency
higher than 10MHz for the TX Escape Clock, thus make the target rate
configurable.

Signed-off-by: Neil Armstrong <narmstrong@baylibre.com>
Reviewed-by: Philippe Cornu <philippe.cornu@st.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200904125531.15248-1-narmstrong@baylibre.com
  • Loading branch information
Neil Armstrong committed Sep 11, 2020
1 parent 33f2908 commit a328ca7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
25 changes: 20 additions & 5 deletions drivers/gpu/drm/bridge/synopsys/dw-mipi-dsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -605,15 +605,30 @@ static void dw_mipi_dsi_disable(struct dw_mipi_dsi *dsi)

static void dw_mipi_dsi_init(struct dw_mipi_dsi *dsi)
{
const struct dw_mipi_dsi_phy_ops *phy_ops = dsi->plat_data->phy_ops;
unsigned int esc_rate; /* in MHz */
u32 esc_clk_division;
int ret;

/*
* The maximum permitted escape clock is 20MHz and it is derived from
* lanebyteclk, which is running at "lane_mbps / 8". Thus we want:
*
* (lane_mbps >> 3) / esc_clk_division < 20
* lanebyteclk, which is running at "lane_mbps / 8".
*/
if (phy_ops->get_esc_clk_rate) {
ret = phy_ops->get_esc_clk_rate(dsi->plat_data->priv_data,
&esc_rate);
if (ret)
DRM_DEBUG_DRIVER("Phy get_esc_clk_rate() failed\n");
} else
esc_rate = 20; /* Default to 20MHz */

/*
* We want :
* (lane_mbps >> 3) / esc_clk_division < X
* which is:
* (lane_mbps >> 3) / 20 > esc_clk_division
* (lane_mbps >> 3) / X > esc_clk_division
*/
u32 esc_clk_division = (dsi->lane_mbps >> 3) / 20 + 1;
esc_clk_division = (dsi->lane_mbps >> 3) / esc_rate + 1;

dsi_write(dsi, DSI_PWR_UP, RESET);

Expand Down
1 change: 1 addition & 0 deletions include/drm/bridge/dw_mipi_dsi.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ struct dw_mipi_dsi_phy_ops {
unsigned int *lane_mbps);
int (*get_timing)(void *priv_data, unsigned int lane_mbps,
struct dw_mipi_dsi_dphy_timing *timing);
int (*get_esc_clk_rate)(void *priv_data, unsigned int *esc_clk_rate);
};

struct dw_mipi_dsi_host_ops {
Expand Down

0 comments on commit a328ca7

Please sign in to comment.