From c8b307dd019c90235b84938dbd915ba92665bb82 Mon Sep 17 00:00:00 2001 From: Zheng Yang Date: Thu, 1 Mar 2018 12:23:54 +0800 Subject: [PATCH] phy: rockchip: inno-hdmi: set sync detection counter length The RK3328 HDMI PHY adds a method to detect the TMDS Data sync enable status. The counter length is defined as: Fref * 495 * 4 / Ftmdsclk If sync enable counter match the counter length, the sync status defined in reg0xdd will be set to true. Change-Id: Ib6a58cb50127e84399011cb398e7fa36f72b3a45 Signed-off-by: Zheng Yang --- drivers/phy/rockchip/phy-rockchip-inno-hdmi-phy.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/phy/rockchip/phy-rockchip-inno-hdmi-phy.c b/drivers/phy/rockchip/phy-rockchip-inno-hdmi-phy.c index ca50c8f58c50..c4af0ebe689f 100644 --- a/drivers/phy/rockchip/phy-rockchip-inno-hdmi-phy.c +++ b/drivers/phy/rockchip/phy-rockchip-inno-hdmi-phy.c @@ -732,6 +732,7 @@ inno_hdmi_phy_rk3328_power_on(struct inno_hdmi_phy *inno, const struct phy_config *phy_cfg) { u32 val; + u64 temp; /* set pdata_en to 0 */ inno_update_bits(inno, 0x02, 1, 0); @@ -785,6 +786,12 @@ inno_hdmi_phy_rk3328_power_on(struct inno_hdmi_phy *inno, inno_write(inno, 0xcb, 0x10); } + /* set TMDS sync detection counter length */ + temp = 47520000000; + do_div(temp, inno->tmdsclock); + inno_write(inno, 0xd8, (temp >> 8) & 0xff); + inno_write(inno, 0xd9, temp & 0xff); + /* Power up post PLL */ inno_update_bits(inno, 0xaa, 1, 0); /* Power up tmds driver */