Re: [PATCH 06/11] drm: meson: add meson_dw_hdmi support for S4
From: Krzysztof Kozlowski
Date: Fri Jan 10 2025 - 09:09:43 EST
On 10/01/2025 06:39, Ao Xu via B4 Relay wrote:
> /* Setup PHY */
> - regmap_write(priv->hhi, HHI_HDMI_PHY_CNTL1, meson_dw_hdmi->data->cntl1_init);
> - regmap_write(priv->hhi, HHI_HDMI_PHY_CNTL0, meson_dw_hdmi->data->cntl0_init);
> + if (dw_hdmi_is_compatible(meson_dw_hdmi, "amlogic,meson-s4-dw-hdmi")) {
> + regmap_write(priv->hhi, ANACTRL_HDMIPHY_CTRL1,
> + meson_dw_hdmi->data->cntl1_init);
> + regmap_write(priv->hhi, ANACTRL_HDMIPHY_CTRL0,
> + meson_dw_hdmi->data->cntl0_init);
> + } else {
> + regmap_write(priv->hhi, HHI_HDMI_PHY_CNTL1, meson_dw_hdmi->data->cntl1_init);
> + regmap_write(priv->hhi, HHI_HDMI_PHY_CNTL0, meson_dw_hdmi->data->cntl0_init);
> + }
>
> /* Enable HDMI-TX Interrupt */
> meson_dw_hdmi->data->top_write(meson_dw_hdmi, HDMITX_TOP_INTR_STAT_CLR,
> @@ -766,10 +923,13 @@ static int meson_dw_hdmi_bind(struct device *dev, struct device *master,
> dw_plat_data->ycbcr_420_allowed = true;
> dw_plat_data->disable_cec = true;
> dw_plat_data->output_port = 1;
> + if (dw_hdmi_is_compatible(meson_dw_hdmi, "amlogic,meson-s4-dw-hdmi"))
> + dw_plat_data->phy_force_vendor = 1;
>
> if (dw_hdmi_is_compatible(meson_dw_hdmi, "amlogic,meson-gxl-dw-hdmi") ||
> dw_hdmi_is_compatible(meson_dw_hdmi, "amlogic,meson-gxm-dw-hdmi") ||
> - dw_hdmi_is_compatible(meson_dw_hdmi, "amlogic,meson-g12a-dw-hdmi"))
> + dw_hdmi_is_compatible(meson_dw_hdmi, "amlogic,meson-g12a-dw-hdmi") ||
> + dw_hdmi_is_compatible(meson_dw_hdmi, "amlogic,meson-s4-dw-hdmi"))
> dw_plat_data->use_drm_infoframe = true;
>
You should properly define driver/match data, instead of running
compatibility check 10 times in your driver.
This is unscalable and unmaintainable approach.
Best regards,
Krzysztof