Skip to content

Commit

Permalink
drm/mediatek: no change parent rate in round_rate() for MT2701 hdmi phy
Browse files Browse the repository at this point in the history
This is the third step to make MT2701 HDMI stable.
We should not change the rate of parent for hdmi phy when
doing round_rate for this clock. The parent clock of hdmi
phy must be the same as it. We change it when doing set_rate
only.

Signed-off-by: Wangyan Wang <[email protected]>
Signed-off-by: CK Hu <[email protected]>
  • Loading branch information
Wangyan Wang authored and ckhu-mediatek committed Apr 9, 2019
1 parent 8eeb394 commit 9ee7609
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 16 deletions.
14 changes: 0 additions & 14 deletions drivers/gpu/drm/mediatek/mtk_hdmi_phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,6 @@ static const struct phy_ops mtk_hdmi_phy_dev_ops = {
.owner = THIS_MODULE,
};

long mtk_hdmi_pll_round_rate(struct clk_hw *hw, unsigned long rate,
unsigned long *parent_rate)
{
struct mtk_hdmi_phy *hdmi_phy = to_mtk_hdmi_phy(hw);

hdmi_phy->pll_rate = rate;
if (rate <= 74250000)
*parent_rate = rate;
else
*parent_rate = rate / 2;

return rate;
}

void mtk_hdmi_phy_clear_bits(struct mtk_hdmi_phy *hdmi_phy, u32 offset,
u32 bits)
{
Expand Down
2 changes: 0 additions & 2 deletions drivers/gpu/drm/mediatek/mtk_hdmi_phy.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ void mtk_hdmi_phy_set_bits(struct mtk_hdmi_phy *hdmi_phy, u32 offset,
void mtk_hdmi_phy_mask(struct mtk_hdmi_phy *hdmi_phy, u32 offset,
u32 val, u32 mask);
struct mtk_hdmi_phy *to_mtk_hdmi_phy(struct clk_hw *hw);
long mtk_hdmi_pll_round_rate(struct clk_hw *hw, unsigned long rate,
unsigned long *parent_rate);

extern struct platform_driver mtk_hdmi_phy_driver;
extern struct mtk_hdmi_phy_conf mtk_hdmi_phy_8173_conf;
Expand Down
6 changes: 6 additions & 0 deletions drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,12 @@ static void mtk_hdmi_pll_unprepare(struct clk_hw *hw)
usleep_range(80, 100);
}

static long mtk_hdmi_pll_round_rate(struct clk_hw *hw, unsigned long rate,
unsigned long *parent_rate)
{
return rate;
}

static int mtk_hdmi_pll_set_rate(struct clk_hw *hw, unsigned long rate,
unsigned long parent_rate)
{
Expand Down
14 changes: 14 additions & 0 deletions drivers/gpu/drm/mediatek/mtk_mt8173_hdmi_phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,20 @@ static void mtk_hdmi_pll_unprepare(struct clk_hw *hw)
usleep_range(100, 150);
}

static long mtk_hdmi_pll_round_rate(struct clk_hw *hw, unsigned long rate,
unsigned long *parent_rate)
{
struct mtk_hdmi_phy *hdmi_phy = to_mtk_hdmi_phy(hw);

hdmi_phy->pll_rate = rate;
if (rate <= 74250000)
*parent_rate = rate;
else
*parent_rate = rate / 2;

return rate;
}

static int mtk_hdmi_pll_set_rate(struct clk_hw *hw, unsigned long rate,
unsigned long parent_rate)
{
Expand Down

0 comments on commit 9ee7609

Please sign in to comment.