diff mbox series

[v5,3/7] drm/mediatek: disable tmds on mt2701

Message ID 20200819081752.4805-4-linux@fw-web.de (mailing list archive)
State New, archived
Headers show
Series make hdmi work on bananapi-r2 | expand

Commit Message

Frank Wunderlich Aug. 19, 2020, 8:17 a.m. UTC
From: chunhui dai <chunhui.dai@mediatek.com>

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

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(+)

Comments

Matthias Brugger Aug. 19, 2020, 5:12 p.m. UTC | #1
On 19/08/2020 10:17, Frank Wunderlich wrote:
> From: chunhui dai <chunhui.dai@mediatek.com>
> 
> disable tmds on phy on mt2701 to support other resolutions like 1280x1024
> 

Isn't that worth a Fixes tag?

Regards,
Matthias

> 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);
> +
>   	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,
>
Frank Wunderlich Aug. 19, 2020, 7:04 p.m. UTC | #2
Am 19. August 2020 19:12:29 MESZ schrieb Matthias Brugger <matthias.bgg@gmail.com>:

>Isn't that worth a Fixes tag?

This could be

https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0fc721b2968e3cadec520c60d2fc63498d865055 (add support for mt2701/mt7623).

It uses existing framework which calls mtk_hdmi_phy_enable_tmds by default in mtk_hdmi_phy_power_on.

Another way to fix it maybe not enabling it (use the flag in mtk_hdmi_phy_power_on) there instead of disabling after enabling it.

Maybe this is less hacky than current way (as ck hu pointed in v2).
regards Frank
Frank Wunderlich Aug. 21, 2020, 11:13 a.m. UTC | #3
> Gesendet: Mittwoch, 19. August 2020 um 21:04 Uhr
> Von: "Frank Wunderlich" <frank-w@public-files.de>
> Another way to fix it maybe not enabling it (use the flag in mtk_hdmi_phy_power_on) there instead of disabling after enabling it.
>
> Maybe this is less hacky than current way (as ck hu pointed in v2).

seems my last mail is not send right (did not got it from mailinglist and it's not mapped in patchwork).

i tried this approach, but this does not work, with checking the new flag in mtk_hdmi_phy_power_on and only enabling tmds if this flag is not set results in same behaviour like without the Patch (horizontally distorted image flickering on 1280x1024)

- hdmi_phy->conf->hdmi_phy_enable_tmds(hdmi_phy);
+ if (!hdmi_phy->conf->pll_default_off)
+ hdmi_phy->conf->hdmi_phy_enable_tmds(hdmi_phy);

seems like tmds needs to be initially enabled and can only disabled later

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,