Skip to content

Commit

Permalink
phy: rockchip: inno-hdmi: fix hdmi abnormal after set color depth
Browse files Browse the repository at this point in the history
reinstall hdmi TMDS clock when set color depth between 8bit and 10bit
to fix tmds clock frequency mismatch

Change-Id: I5ac951cd6cc0ac04b595009be7ae250e42290854
Signed-off-by: Huicong Xu <xhc@rock-chips.com>
  • Loading branch information
Huicong Xu authored and rkhuangtao committed Jan 23, 2018
1 parent 784560b commit bc980e7
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 6 deletions.
14 changes: 8 additions & 6 deletions drivers/gpu/drm/rockchip/dw_hdmi-rockchip.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,20 +106,22 @@ struct rockchip_hdmi {

#define to_rockchip_hdmi(x) container_of(x, struct rockchip_hdmi, x)

static int
inno_dw_hdmi_phy_init(struct dw_hdmi *dw_hdmi, void *data,
struct drm_display_mode *mode)
static void inno_dw_hdmi_phy_disable(struct dw_hdmi *dw_hdmi, void *data)
{
struct rockchip_hdmi *hdmi = (struct rockchip_hdmi *)data;

return phy_power_on(hdmi->phy);
while (hdmi->phy->power_count > 0)
phy_power_off(hdmi->phy);
}

static void inno_dw_hdmi_phy_disable(struct dw_hdmi *dw_hdmi, void *data)
static int
inno_dw_hdmi_phy_init(struct dw_hdmi *dw_hdmi, void *data,
struct drm_display_mode *mode)
{
struct rockchip_hdmi *hdmi = (struct rockchip_hdmi *)data;

phy_power_off(hdmi->phy);
inno_dw_hdmi_phy_disable(dw_hdmi, data);
return phy_power_on(hdmi->phy);
}

static enum drm_connector_status
Expand Down
9 changes: 9 additions & 0 deletions drivers/phy/rockchip/phy-rockchip-inno-hdmi-phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ struct inno_hdmi_phy {
struct clk_hw hw;
struct clk *pclk;
unsigned long pixclock;
unsigned long tmdsclock;
};

struct pre_pll_config {
Expand Down Expand Up @@ -360,6 +361,9 @@ static u32 inno_hdmi_phy_get_tmdsclk(struct inno_hdmi_phy *inno, int rate)
return tmdsclk;
}

static int inno_hdmi_phy_clk_set_rate(struct clk_hw *hw, unsigned long rate,
unsigned long parent_rate);

static int inno_hdmi_phy_power_on(struct phy *phy)
{
struct inno_hdmi_phy *inno = phy_get_drvdata(phy);
Expand Down Expand Up @@ -390,6 +394,7 @@ static int inno_hdmi_phy_power_on(struct phy *phy)
return -EINVAL;

dev_dbg(inno->dev, "Inno HDMI PHY Power On\n");
inno_hdmi_phy_clk_set_rate(&inno->hw, inno->pixclock, 0);

if (inno->plat_data->ops->power_on)
return inno->plat_data->ops->power_on(inno, cfg, phy_cfg);
Expand Down Expand Up @@ -492,6 +497,9 @@ static int inno_hdmi_phy_clk_set_rate(struct clk_hw *hw, unsigned long rate,
dev_dbg(inno->dev, "%s rate %lu tmdsclk %u\n",
__func__, rate, tmdsclock);

if (inno->tmdsclock == tmdsclock)
return 0;

for (; cfg->pixclock != ~0UL; cfg++)
if (cfg->pixclock == rate && cfg->tmdsclock == tmdsclock)
break;
Expand All @@ -505,6 +513,7 @@ static int inno_hdmi_phy_clk_set_rate(struct clk_hw *hw, unsigned long rate,
inno->plat_data->ops->pre_pll_update(inno, cfg);

inno->pixclock = rate;
inno->tmdsclock = tmdsclock;

return 0;
}
Expand Down

0 comments on commit bc980e7

Please sign in to comment.