Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit 04703bf

Browse files
jbrun3tsuperna9999
authored andcommitted
drm/meson: dw-hdmi: power up phy on device init
The phy is not in a useful state right after init. It will become useful, including for auxiliary function such as CEC or ARC, after the first mode is set. This is a problem on systems where the display is using another interface like DSI or CVBS. This change refactor the init and mode change callback to power up the PHY on init and leave only what is necessary for mode changes in the related function. This is enough to fix CEC operation when HDMI display is not enabled. Fixes: 3f68be7 ("drm/meson: Add support for HDMI encoder and DW-HDMI bridge + PHY") Signed-off-by: Jerome Brunet <jbrunet@baylibre.com> Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org> Link: https://lore.kernel.org/r/20240426160256.3089978-2-jbrunet@baylibre.com Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org> Link: https://patchwork.freedesktop.org/patch/msgid/20240426160256.3089978-2-jbrunet@baylibre.com
1 parent da85f0a commit 04703bf

File tree

1 file changed

+17
-34
lines changed

1 file changed

+17
-34
lines changed

drivers/gpu/drm/meson/meson_dw_hdmi.c

Lines changed: 17 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -384,26 +384,6 @@ static int dw_hdmi_phy_init(struct dw_hdmi *hdmi, void *data,
384384
dw_hdmi_bus_fmt_is_420(hdmi))
385385
mode_is_420 = true;
386386

387-
/* Enable clocks */
388-
regmap_update_bits(priv->hhi, HHI_HDMI_CLK_CNTL, 0xffff, 0x100);
389-
390-
/* Bring HDMITX MEM output of power down */
391-
regmap_update_bits(priv->hhi, HHI_MEM_PD_REG0, 0xff << 8, 0);
392-
393-
/* Bring out of reset */
394-
dw_hdmi->data->top_write(dw_hdmi, HDMITX_TOP_SW_RESET, 0);
395-
396-
/* Enable internal pixclk, tmds_clk, spdif_clk, i2s_clk, cecclk */
397-
dw_hdmi_top_write_bits(dw_hdmi, HDMITX_TOP_CLK_CNTL,
398-
0x3, 0x3);
399-
400-
/* Enable cec_clk and hdcp22_tmdsclk_en */
401-
dw_hdmi_top_write_bits(dw_hdmi, HDMITX_TOP_CLK_CNTL,
402-
0x3 << 4, 0x3 << 4);
403-
404-
/* Enable normal output to PHY */
405-
dw_hdmi->data->top_write(dw_hdmi, HDMITX_TOP_BIST_CNTL, BIT(12));
406-
407387
/* TMDS pattern setup */
408388
if (mode->clock > 340000 && !mode_is_420) {
409389
dw_hdmi->data->top_write(dw_hdmi, HDMITX_TOP_TMDS_CLK_PTTN_01,
@@ -425,20 +405,6 @@ static int dw_hdmi_phy_init(struct dw_hdmi *hdmi, void *data,
425405
/* Setup PHY parameters */
426406
meson_hdmi_phy_setup_mode(dw_hdmi, mode, mode_is_420);
427407

428-
/* Setup PHY */
429-
regmap_update_bits(priv->hhi, HHI_HDMI_PHY_CNTL1,
430-
0xffff << 16, 0x0390 << 16);
431-
432-
/* BIT_INVERT */
433-
if (dw_hdmi_is_compatible(dw_hdmi, "amlogic,meson-gxl-dw-hdmi") ||
434-
dw_hdmi_is_compatible(dw_hdmi, "amlogic,meson-gxm-dw-hdmi") ||
435-
dw_hdmi_is_compatible(dw_hdmi, "amlogic,meson-g12a-dw-hdmi"))
436-
regmap_update_bits(priv->hhi, HHI_HDMI_PHY_CNTL1,
437-
BIT(17), 0);
438-
else
439-
regmap_update_bits(priv->hhi, HHI_HDMI_PHY_CNTL1,
440-
BIT(17), BIT(17));
441-
442408
/* Disable clock, fifo, fifo_wr */
443409
regmap_update_bits(priv->hhi, HHI_HDMI_PHY_CNTL1, 0xf, 0);
444410

@@ -656,6 +622,23 @@ static void meson_dw_hdmi_init(struct meson_dw_hdmi *meson_dw_hdmi)
656622
meson_dw_hdmi->data->top_write(meson_dw_hdmi,
657623
HDMITX_TOP_CLK_CNTL, 0xff);
658624

625+
/* Enable normal output to PHY */
626+
meson_dw_hdmi->data->top_write(meson_dw_hdmi, HDMITX_TOP_BIST_CNTL, BIT(12));
627+
628+
/* Setup PHY */
629+
regmap_update_bits(priv->hhi, HHI_HDMI_PHY_CNTL1,
630+
0xffff << 16, 0x0390 << 16);
631+
632+
/* BIT_INVERT */
633+
if (dw_hdmi_is_compatible(meson_dw_hdmi, "amlogic,meson-gxl-dw-hdmi") ||
634+
dw_hdmi_is_compatible(meson_dw_hdmi, "amlogic,meson-gxm-dw-hdmi") ||
635+
dw_hdmi_is_compatible(meson_dw_hdmi, "amlogic,meson-g12a-dw-hdmi"))
636+
regmap_update_bits(priv->hhi, HHI_HDMI_PHY_CNTL1,
637+
BIT(17), 0);
638+
else
639+
regmap_update_bits(priv->hhi, HHI_HDMI_PHY_CNTL1,
640+
BIT(17), BIT(17));
641+
659642
/* Enable HDMI-TX Interrupt */
660643
meson_dw_hdmi->data->top_write(meson_dw_hdmi, HDMITX_TOP_INTR_STAT_CLR,
661644
HDMITX_TOP_INTR_CORE);

0 commit comments

Comments
 (0)