disp: msm: dsi: update PHY configuration to support cphy

Add support to read cphy boolean flag from panel dtsi
and configure DSI PHY registers accordingly. Update the
bit/byte clock calculation according to cphy specifications.
Update clock parents so that the relevant divider blocks
are configured to support cphy.

Change-Id: Iaca61eec01a488657b086f59910c52f8c79e26a4
Signed-off-by: Chandan Uddaraju <chandanu@codeaurora.org>
Signed-off-by: Yuan Zhao <yzhao@codeaurora.org>
这个提交包含在:
Yuan Zhao
2020-05-07 00:34:24 +08:00
提交者 Gerrit - the friendly Code Review server
父节点 43069ad44a
当前提交 5139cad2d4
修改 9 个文件,包含 240 行新增35 行删除

查看文件

@@ -2316,6 +2316,20 @@ static int dsi_display_set_clk_src(struct dsi_display *display)
int i;
struct dsi_display_ctrl *m_ctrl, *ctrl;
/*
* For CPHY mode, the parent of mux_clks need to be set
* to Cphy_clks to have correct dividers for byte and
* pixel clocks.
*/
if (display->panel->host_config.phy_type == DSI_PHY_TYPE_CPHY) {
rc = dsi_clk_update_parent(&display->clock_info.cphy_clks,
&display->clock_info.mux_clks);
if (rc) {
DSI_ERR("failed update mux parent to shadow\n");
return rc;
}
}
/*
* In case of split DSI usecases, the clock for master controller should
* be enabled before the other controller. Master controller in the
@@ -2382,8 +2396,12 @@ static void dsi_display_toggle_resync_fifo(struct dsi_display *display)
/*
* After retime buffer synchronization we need to turn of clk_en_sel
* bit on each phy.
* bit on each phy. Avoid this for Cphy.
*/
if (display->panel->host_config.phy_type == DSI_PHY_TYPE_CPHY)
return;
display_for_each_ctrl(i, display) {
ctrl = &display->ctrl[i];
dsi_phy_reset_clk_en_sel(ctrl->phy);
@@ -3038,10 +3056,12 @@ static int dsi_display_clocks_init(struct dsi_display *display)
const char *clk_name;
const char *src_byte = "src_byte", *src_pixel = "src_pixel";
const char *mux_byte = "mux_byte", *mux_pixel = "mux_pixel";
const char *cphy_byte = "cphy_byte", *cphy_pixel = "cphy_pixel";
const char *shadow_byte = "shadow_byte", *shadow_pixel = "shadow_pixel";
struct clk *dsi_clk;
struct dsi_clk_link_set *src = &display->clock_info.src_clks;
struct dsi_clk_link_set *mux = &display->clock_info.mux_clks;
struct dsi_clk_link_set *cphy = &display->clock_info.cphy_clks;
struct dsi_clk_link_set *shadow = &display->clock_info.shadow_clks;
struct dsi_dyn_clk_caps *dyn_clk_caps = &(display->panel->dyn_clk_caps);
char *dsi_clock_name;
@@ -3076,6 +3096,15 @@ static int dsi_display_clocks_init(struct dsi_display *display)
goto error;
}
if (dsi_display_check_prefix(cphy_byte, clk_name)) {
cphy->byte_clk = NULL;
goto error;
}
if (dsi_display_check_prefix(cphy_pixel, clk_name)) {
cphy->pixel_clk = NULL;
goto error;
}
if (dyn_clk_caps->dyn_clk_support &&
(display->panel->panel_mode ==
DSI_OP_VIDEO_MODE)) {
@@ -3107,6 +3136,16 @@ static int dsi_display_clocks_init(struct dsi_display *display)
continue;
}
if (dsi_display_check_prefix(cphy_byte, clk_name)) {
cphy->byte_clk = dsi_clk;
continue;
}
if (dsi_display_check_prefix(cphy_pixel, clk_name)) {
cphy->pixel_clk = dsi_clk;
continue;
}
if (dsi_display_check_prefix(mux_byte, clk_name)) {
mux->byte_clk = dsi_clk;
continue;
@@ -3729,6 +3768,8 @@ static int dsi_display_res_init(struct dsi_display *display)
phy->cfg.force_clk_lane_hs =
display->panel->host_config.force_hs_clk_lane;
phy->cfg.phy_type =
display->panel->host_config.phy_type;
}
rc = dsi_display_parse_lane_map(display);
@@ -3942,6 +3983,7 @@ static int dsi_display_update_dsi_bitrate(struct dsi_display *display,
u32 num_of_lanes = 0, bpp, byte_intf_clk_div;
u64 bit_rate, pclk_rate, bit_rate_per_lane, byte_clk_rate,
byte_intf_clk_rate;
u32 bits_per_symbol = 16, num_of_symbols = 7; /* For Cphy */
struct dsi_host_common_cfg *host_cfg;
mutex_lock(&ctrl->ctrl_lock);
@@ -3969,11 +4011,24 @@ static int dsi_display_update_dsi_bitrate(struct dsi_display *display,
do_div(bit_rate_per_lane, num_of_lanes);
pclk_rate = bit_rate;
do_div(pclk_rate, bpp);
byte_clk_rate = bit_rate_per_lane;
do_div(byte_clk_rate, 8);
byte_intf_clk_rate = byte_clk_rate;
byte_intf_clk_div = host_cfg->byte_intf_clk_div;
do_div(byte_intf_clk_rate, byte_intf_clk_div);
if (host_cfg->phy_type == DSI_PHY_TYPE_DPHY) {
bit_rate_per_lane = bit_rate;
do_div(bit_rate_per_lane, num_of_lanes);
byte_clk_rate = bit_rate_per_lane;
do_div(byte_clk_rate, 8);
byte_intf_clk_rate = byte_clk_rate;
byte_intf_clk_div = host_cfg->byte_intf_clk_div;
do_div(byte_intf_clk_rate, byte_intf_clk_div);
} else {
do_div(bit_rate, bits_per_symbol);
bit_rate *= num_of_symbols;
bit_rate_per_lane = bit_rate;
do_div(bit_rate_per_lane, num_of_lanes);
byte_clk_rate = bit_rate_per_lane;
do_div(byte_clk_rate, 7);
/* For CPHY, byte_intf_clk is same as byte_clk */
byte_intf_clk_rate = byte_clk_rate;
}
DSI_DEBUG("bit_clk_rate = %llu, bit_clk_rate_per_lane = %llu\n",
bit_rate, bit_rate_per_lane);