Skip to content

Commit 6d20589

Browse files
author
Zheng Yang
committed
phy: rockchip-inno-hdmi-phy: update 3328 phy pixclock in the recalc_rate
If default phy pre-pll output pixclock is same to the requested rate, the set_rate function is not called, inno->pixclock is zero and make phy work not ok. This patch update inno->pixclock both in the recalc_rate and set_rate, make pixclock be the real value. Change-Id: Ifd4e145c499c2e82f96918ca62235627bf326734 Signed-off-by: Zheng Yang <zhengyang@rock-chips.com>
1 parent cb4f52e commit 6d20589

1 file changed

Lines changed: 18 additions & 6 deletions

File tree

drivers/phy/phy-rockchip-inno-hdmi-phy.c

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -365,20 +365,25 @@ static int inno_hdmi_phy_power_on(struct phy *phy)
365365
struct inno_hdmi_phy *inno = phy_get_drvdata(phy);
366366
const struct post_pll_config *cfg = post_pll_cfg_table;
367367
const struct phy_config *phy_cfg = inno->plat_data->phy_cfg_table;
368-
u32 tmdsclk = inno_hdmi_phy_get_tmdsclk(inno, inno->pixclock);
368+
u32 tmdsclock = inno_hdmi_phy_get_tmdsclk(inno, inno->pixclock);
369369
u32 chipversion = 1;
370370

371+
if (!tmdsclock) {
372+
dev_err(inno->dev, "TMDS clock is zero!\n");
373+
return -EINVAL;
374+
}
375+
371376
if (inno->plat_data->dev_type == INNO_HDMI_PHY_RK3328 &&
372377
rockchip_get_cpu_version())
373378
chipversion = 2;
374379

375380
for (; cfg->tmdsclock != ~0UL; cfg++)
376-
if (tmdsclk <= cfg->tmdsclock &&
381+
if (tmdsclock <= cfg->tmdsclock &&
377382
cfg->version & chipversion)
378383
break;
379384

380385
for (; phy_cfg->tmdsclock != ~0UL; phy_cfg++)
381-
if (tmdsclk <= phy_cfg->tmdsclock)
386+
if (tmdsclock <= phy_cfg->tmdsclock)
382387
break;
383388

384389
if (cfg->tmdsclock == ~0UL || phy_cfg->tmdsclock == ~0UL)
@@ -444,7 +449,7 @@ static void inno_hdmi_phy_clk_unprepare(struct clk_hw *hw)
444449
inno_update_bits(inno, 0xe0, PRE_PLL_POWER_MASK,
445450
PRE_PLL_POWER_DOWN);
446451
else
447-
inno_update_bits(inno, 0xa0, 1, 0);
452+
inno_update_bits(inno, 0xa0, 1, 1);
448453
}
449454

450455
static unsigned long inno_hdmi_phy_clk_recalc_rate(struct clk_hw *hw,
@@ -482,10 +487,13 @@ static int inno_hdmi_phy_clk_set_rate(struct clk_hw *hw, unsigned long rate,
482487
{
483488
struct inno_hdmi_phy *inno = to_inno_hdmi_phy(hw);
484489
const struct pre_pll_config *cfg = pre_pll_cfg_table;
485-
u32 tmdsclk = inno_hdmi_phy_get_tmdsclk(inno, rate);
490+
u32 tmdsclock = inno_hdmi_phy_get_tmdsclk(inno, rate);
491+
492+
dev_dbg(inno->dev, "%s rate %lu tmdsclk %u\n",
493+
__func__, rate, tmdsclock);
486494

487495
for (; cfg->pixclock != ~0UL; cfg++)
488-
if (cfg->pixclock == rate && cfg->tmdsclock == tmdsclk)
496+
if (cfg->pixclock == rate && cfg->tmdsclock == tmdsclock)
489497
break;
490498

491499
if (cfg->pixclock == ~0UL) {
@@ -901,6 +909,10 @@ inno_hdmi_3328_phy_pll_recalc_rate(struct inno_hdmi_phy *inno,
901909
rate = vco / (nd * no_a * no_d * 2);
902910
}
903911

912+
inno->pixclock = rate;
913+
914+
dev_dbg(inno->dev, "%s rate %lu\n", __func__, inno->pixclock);
915+
904916
return rate;
905917
}
906918

0 commit comments

Comments
 (0)