Skip to content

Commit f8fbbc4

Browse files
Zheng Yangrkhuangtao
authored andcommitted
drm: bridge: dw-hdmi: introduce mpll_cfg_420
RK3368/RK3399 mpll input clock rate is twice of mpll output in YCBCR420 mode. This patch introduce mpll_cfg_420 to get the platform YCBCR420 phy setting. If mpll_cfg_420 is not exist, use mpll_cfg. Change-Id: I7910a75394cf371a8008f8a83e3ab9ec14e9a68a Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
1 parent 1d2df55 commit f8fbbc4

3 files changed

Lines changed: 51 additions & 14 deletions

File tree

drivers/gpu/drm/bridge/dw-hdmi.c

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1418,6 +1418,10 @@ static int hdmi_phy_configure_dwc_hdmi_3d_tx(struct dw_hdmi *hdmi,
14181418
unsigned int depth =
14191419
hdmi_bus_fmt_color_depth(hdmi->hdmi_data.enc_out_bus_format);
14201420

1421+
if (hdmi_bus_fmt_is_yuv420(hdmi->hdmi_data.enc_out_bus_format) &&
1422+
pdata->mpll_cfg_420)
1423+
mpll_config = pdata->mpll_cfg_420;
1424+
14211425
/* PLL/MPLL Cfg - always match on final entry */
14221426
for (; mpll_config->mpixelclock != ~0UL; mpll_config++)
14231427
if (mpixelclock <= mpll_config->mpixelclock)
@@ -1443,18 +1447,8 @@ static int hdmi_phy_configure_dwc_hdmi_3d_tx(struct dw_hdmi *hdmi,
14431447
if (depth)
14441448
depth--;
14451449

1446-
/*
1447-
* RK3399 mpll clock source is vpll, also is vop clock source.
1448-
* vpll rate is twice of mpixelclock in YCBCR420 mode, we need
1449-
* to enable mpll output divider.
1450-
*/
1451-
if (hdmi_bus_fmt_is_yuv420(hdmi->hdmi_data.enc_out_bus_format) &&
1452-
(hdmi->dev_type == RK3399_HDMI || hdmi->dev_type == RK3368_HDMI))
1453-
dw_hdmi_phy_i2c_write(hdmi, mpll_config->res[depth].cpce | 1,
1454-
HDMI_3D_TX_PHY_CPCE_CTRL);
1455-
else
1456-
dw_hdmi_phy_i2c_write(hdmi, mpll_config->res[depth].cpce,
1457-
HDMI_3D_TX_PHY_CPCE_CTRL);
1450+
dw_hdmi_phy_i2c_write(hdmi, mpll_config->res[depth].cpce,
1451+
HDMI_3D_TX_PHY_CPCE_CTRL);
14581452
dw_hdmi_phy_i2c_write(hdmi, mpll_config->res[depth].gmp,
14591453
HDMI_3D_TX_PHY_GMPCTRL);
14601454
dw_hdmi_phy_i2c_write(hdmi, curr_ctrl->curr[depth],
@@ -1911,14 +1905,14 @@ static void hdmi_av_composer(struct dw_hdmi *hdmi,
19111905

19121906
vmode->previous_pixelclock = vmode->mpixelclock;
19131907
vmode->mpixelclock = mode->crtc_clock * 1000;
1914-
if (hdmi_bus_fmt_is_yuv420(hdmi->hdmi_data.enc_out_bus_format))
1915-
vmode->mpixelclock /= 2;
19161908
if ((mode->flags & DRM_MODE_FLAG_3D_MASK) ==
19171909
DRM_MODE_FLAG_3D_FRAME_PACKING)
19181910
vmode->mpixelclock *= 2;
19191911
dev_dbg(hdmi->dev, "final pixclk = %d\n", vmode->mpixelclock);
19201912
vmode->previous_tmdsclock = vmode->mtmdsclock;
19211913
vmode->mtmdsclock = hdmi_get_tmdsclock(hdmi, vmode->mpixelclock);
1914+
if (hdmi_bus_fmt_is_yuv420(hdmi->hdmi_data.enc_out_bus_format))
1915+
vmode->mtmdsclock /= 2;
19221916
dev_dbg(hdmi->dev, "final tmdsclk = %d\n", vmode->mtmdsclock);
19231917

19241918
/* Set up HDMI_FC_INVIDCONF

drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -290,6 +290,46 @@ static const struct dw_hdmi_mpll_config rockchip_mpll_cfg[] = {
290290
}
291291
};
292292

293+
static const struct dw_hdmi_mpll_config rockchip_mpll_cfg_420[] = {
294+
{
295+
30666000, {
296+
{ 0x00b7, 0x0000 },
297+
{ 0x2157, 0x0000 },
298+
{ 0x40f7, 0x0000 },
299+
},
300+
}, {
301+
92000000, {
302+
{ 0x00b7, 0x0000 },
303+
{ 0x2143, 0x0001 },
304+
{ 0x40a3, 0x0001 },
305+
},
306+
}, {
307+
184000000, {
308+
{ 0x0073, 0x0001 },
309+
{ 0x2146, 0x0002 },
310+
{ 0x4062, 0x0002 },
311+
},
312+
}, {
313+
340000000, {
314+
{ 0x0052, 0x0003 },
315+
{ 0x214d, 0x0003 },
316+
{ 0x4065, 0x0003 },
317+
},
318+
}, {
319+
600000000, {
320+
{ 0x0041, 0x0003 },
321+
{ 0x3b4d, 0x0003 },
322+
{ 0x5a65, 0x0003 },
323+
},
324+
}, {
325+
~0UL, {
326+
{ 0x0000, 0x0000 },
327+
{ 0x0000, 0x0000 },
328+
{ 0x0000, 0x0000 },
329+
},
330+
}
331+
};
332+
293333
static const struct dw_hdmi_curr_ctrl rockchip_cur_ctr[] = {
294334
/* pixelclk bpp8 bpp10 bpp12 */
295335
{
@@ -1052,6 +1092,7 @@ static const struct dw_hdmi_plat_data rk3366_hdmi_drv_data = {
10521092
static const struct dw_hdmi_plat_data rk3368_hdmi_drv_data = {
10531093
.mode_valid = dw_hdmi_rockchip_mode_valid,
10541094
.mpll_cfg = rockchip_mpll_cfg,
1095+
.mpll_cfg_420 = rockchip_mpll_cfg_420,
10551096
.cur_ctr = rockchip_cur_ctr,
10561097
.phy_config = rockchip_phy_config,
10571098
.dev_type = RK3368_HDMI,
@@ -1060,6 +1101,7 @@ static const struct dw_hdmi_plat_data rk3368_hdmi_drv_data = {
10601101
static const struct dw_hdmi_plat_data rk3399_hdmi_drv_data = {
10611102
.mode_valid = dw_hdmi_rockchip_mode_valid,
10621103
.mpll_cfg = rockchip_mpll_cfg,
1104+
.mpll_cfg_420 = rockchip_mpll_cfg_420,
10631105
.cur_ctr = rockchip_cur_ctr,
10641106
.phy_config = rockchip_phy_config,
10651107
.dev_type = RK3399_HDMI,

include/drm/bridge/dw_hdmi.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,7 @@ struct dw_hdmi_plat_data {
170170

171171
/* Synopsys PHY support */
172172
const struct dw_hdmi_mpll_config *mpll_cfg;
173+
const struct dw_hdmi_mpll_config *mpll_cfg_420;
173174
const struct dw_hdmi_curr_ctrl *cur_ctr;
174175
const struct dw_hdmi_phy_config *phy_config;
175176
int (*configure_phy)(struct dw_hdmi *hdmi,

0 commit comments

Comments
 (0)