diff mbox series

[v2,2/5] drm/mediatek: fix boot up for 720 and 480 but 1080

Message ID 20200728111800.77641-3-frank-w@public-files.de (mailing list archive)
State New, archived
Headers show
Series make hdmi work on bananapi-r2 | expand

Commit Message

Frank Wunderlich July 28, 2020, 11:17 a.m. UTC
From: chunhui dai <chunhui.dai@mediatek.com>

- disable tmds on phy on mt2701
- support other resolutions like 1280x1024

without this Patch i see flickering on my TFT (1280x1024),
so i guess clock is wrong.

Signed-off-by: chunhui dai <chunhui.dai@mediatek.com>
Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
Tested-by: Frank Wunderlich <frank-w@public-files.de>
---
 drivers/gpu/drm/mediatek/mtk_hdmi_phy.c        | 3 +++
 drivers/gpu/drm/mediatek/mtk_hdmi_phy.h        | 1 +
 drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c | 1 +
 3 files changed, 5 insertions(+)

--
2.25.1

Comments

Chun-Kuang Hu Aug. 2, 2020, 12:08 a.m. UTC | #1
Hi, Frank:

Frank Wunderlich <frank-w@public-files.de> 於 2020年7月28日 週二 下午7:19寫道:
>
> From: chunhui dai <chunhui.dai@mediatek.com>
>
> - disable tmds on phy on mt2701
> - support other resolutions like 1280x1024

If this patch does two things, it should be broken into two patches.

>
> without this Patch i see flickering on my TFT (1280x1024),
> so i guess clock is wrong.
>
> Signed-off-by: chunhui dai <chunhui.dai@mediatek.com>
> Signed-off-by: Frank Wunderlich <frank-w@public-files.de>
> Tested-by: Frank Wunderlich <frank-w@public-files.de>
> ---
>  drivers/gpu/drm/mediatek/mtk_hdmi_phy.c        | 3 +++
>  drivers/gpu/drm/mediatek/mtk_hdmi_phy.h        | 1 +
>  drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c | 1 +
>  3 files changed, 5 insertions(+)
>
> diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi_phy.c b/drivers/gpu/drm/mediatek/mtk_hdmi_phy.c
> index 5223498502c4..edadb7a700f1 100644
> --- a/drivers/gpu/drm/mediatek/mtk_hdmi_phy.c
> +++ b/drivers/gpu/drm/mediatek/mtk_hdmi_phy.c
> @@ -184,6 +184,9 @@ static int mtk_hdmi_phy_probe(struct platform_device *pdev)
>                 return PTR_ERR(phy_provider);
>         }
>
> +       if (hdmi_phy->conf->pll_default_off)
> +               hdmi_phy->conf->hdmi_phy_disable_tmds(hdmi_phy);

I think every pll is default off, so you should turn on pll rather
than disable tmds.

Regards,
Chun-Kuang.

> +
>         return of_clk_add_provider(dev->of_node, of_clk_src_simple_get,
>                                    hdmi_phy->pll);
>  }
> diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi_phy.h b/drivers/gpu/drm/mediatek/mtk_hdmi_phy.h
> index 2d8b3182470d..f472fdeb63dc 100644
> --- a/drivers/gpu/drm/mediatek/mtk_hdmi_phy.h
> +++ b/drivers/gpu/drm/mediatek/mtk_hdmi_phy.h
> @@ -22,6 +22,7 @@ struct mtk_hdmi_phy;
>  struct mtk_hdmi_phy_conf {
>         bool tz_disabled;
>         unsigned long flags;
> +       bool pll_default_off;
>         const struct clk_ops *hdmi_phy_clk_ops;
>         void (*hdmi_phy_enable_tmds)(struct mtk_hdmi_phy *hdmi_phy);
>         void (*hdmi_phy_disable_tmds)(struct mtk_hdmi_phy *hdmi_phy);
> diff --git a/drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c b/drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c
> index d3cc4022e988..6fbedacfc1e8 100644
> --- a/drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c
> +++ b/drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c
> @@ -239,6 +239,7 @@ static void mtk_hdmi_phy_disable_tmds(struct mtk_hdmi_phy *hdmi_phy)
>  struct mtk_hdmi_phy_conf mtk_hdmi_phy_2701_conf = {
>         .tz_disabled = true,
>         .flags = CLK_SET_RATE_GATE,
> +       .pll_default_off = true,
>         .hdmi_phy_clk_ops = &mtk_hdmi_phy_pll_ops,
>         .hdmi_phy_enable_tmds = mtk_hdmi_phy_enable_tmds,
>         .hdmi_phy_disable_tmds = mtk_hdmi_phy_disable_tmds,
> --
> 2.25.1
>
Frank Wunderlich Aug. 2, 2020, 4:42 a.m. UTC | #2
Hi,

Am 2. August 2020 02:08:44 MESZ schrieb Chun-Kuang Hu <chunkuang.hu@kernel.org>:
>Hi, Frank:
>> - disable tmds on phy on mt2701
>> - support other resolutions like 1280x1024
>
>If this patch does two things, it should be broken into two patches.
As far as i see,it only disable tmds and so fix specific resolutions like the the one below.some other (like 1080p) does not have this Problem.

> I think every pll is default off, so you should turn on pll rather
> than disable tmds

Is disabling tmds wrong here? Which pll is needed here? What does tmds? I got only the Patches for testing....

>> without this Patch i see flickering on my TFT (1280x1024),
>> so i guess clock is wrong.

regards Frank
Chun-Kuang Hu Aug. 2, 2020, 11:38 p.m. UTC | #3
Hi, Frank:

Frank Wunderlich <frank-w@public-files.de> 於 2020年8月2日 週日 下午12:44寫道:
>
> Hi,
>
> Am 2. August 2020 02:08:44 MESZ schrieb Chun-Kuang Hu <chunkuang.hu@kernel.org>:
> >Hi, Frank:
> >> - disable tmds on phy on mt2701
> >> - support other resolutions like 1280x1024
> >
> >If this patch does two things, it should be broken into two patches.
> As far as i see,it only disable tmds and so fix specific resolutions like the the one below.some other (like 1080p) does not have this Problem.

OK, this is one thing, "disable tmds on phy on mt2701 to support other
resolutions like 1280x1024"

>
> > I think every pll is default off, so you should turn on pll rather
> > than disable tmds
>
> Is disabling tmds wrong here? Which pll is needed here? What does tmds? I got only the Patches for testing....

I don't know how does this pll and tmds work. I think you and me are
both not familiar with this hdmi phy. I agree this modification could
fix some problem, but does this patch have side effect which trigger
another problem? I need some reasonable description so I could have
confidence on this patch. tmds is a function in mt2701 but you disable
it. This mean you disable some function of this hardware. Why mt2701
does not need it?

Regards,
Chun-Kuang.

>
> >> without this Patch i see flickering on my TFT (1280x1024),
> >> so i guess clock is wrong.
>
> regards Frank
diff mbox series

Patch

diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi_phy.c b/drivers/gpu/drm/mediatek/mtk_hdmi_phy.c
index 5223498502c4..edadb7a700f1 100644
--- a/drivers/gpu/drm/mediatek/mtk_hdmi_phy.c
+++ b/drivers/gpu/drm/mediatek/mtk_hdmi_phy.c
@@ -184,6 +184,9 @@  static int mtk_hdmi_phy_probe(struct platform_device *pdev)
 		return PTR_ERR(phy_provider);
 	}

+	if (hdmi_phy->conf->pll_default_off)
+		hdmi_phy->conf->hdmi_phy_disable_tmds(hdmi_phy);
+
 	return of_clk_add_provider(dev->of_node, of_clk_src_simple_get,
 				   hdmi_phy->pll);
 }
diff --git a/drivers/gpu/drm/mediatek/mtk_hdmi_phy.h b/drivers/gpu/drm/mediatek/mtk_hdmi_phy.h
index 2d8b3182470d..f472fdeb63dc 100644
--- a/drivers/gpu/drm/mediatek/mtk_hdmi_phy.h
+++ b/drivers/gpu/drm/mediatek/mtk_hdmi_phy.h
@@ -22,6 +22,7 @@  struct mtk_hdmi_phy;
 struct mtk_hdmi_phy_conf {
 	bool tz_disabled;
 	unsigned long flags;
+	bool pll_default_off;
 	const struct clk_ops *hdmi_phy_clk_ops;
 	void (*hdmi_phy_enable_tmds)(struct mtk_hdmi_phy *hdmi_phy);
 	void (*hdmi_phy_disable_tmds)(struct mtk_hdmi_phy *hdmi_phy);
diff --git a/drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c b/drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c
index d3cc4022e988..6fbedacfc1e8 100644
--- a/drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c
+++ b/drivers/gpu/drm/mediatek/mtk_mt2701_hdmi_phy.c
@@ -239,6 +239,7 @@  static void mtk_hdmi_phy_disable_tmds(struct mtk_hdmi_phy *hdmi_phy)
 struct mtk_hdmi_phy_conf mtk_hdmi_phy_2701_conf = {
 	.tz_disabled = true,
 	.flags = CLK_SET_RATE_GATE,
+	.pll_default_off = true,
 	.hdmi_phy_clk_ops = &mtk_hdmi_phy_pll_ops,
 	.hdmi_phy_enable_tmds = mtk_hdmi_phy_enable_tmds,
 	.hdmi_phy_disable_tmds = mtk_hdmi_phy_disable_tmds,