The pre-emphasis and drive-strength values in inno_hdmi_phy_config, and the registers they are written to, belong to the PHY integrated into the controller. A platform whose PHY is a separate device has neither, and its own .mode_valid already validates the pixel clock against the real PHY, so the table only bounds the generic check.
Let such a platform omit the table: skip the table-driven pre-emphasis and drive-strength writes in the power-up path and the table lookup in .mode_valid when it is absent. Platforms that supply one are unaffected. Tested-by: Byron Stanoszek <[email protected]> Tested-by: Owen O'Hehir <[email protected]> Signed-off-by: Michal Wilczynski <[email protected]> --- drivers/gpu/drm/bridge/inno-hdmi.c | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/bridge/inno-hdmi.c b/drivers/gpu/drm/bridge/inno-hdmi.c index da6f8f693c58b66348e020a79943be55a8ee9fb4..70766dff23b5e557d68dcb369ae5a469a4945e8a 100644 --- a/drivers/gpu/drm/bridge/inno-hdmi.c +++ b/drivers/gpu/drm/bridge/inno-hdmi.c @@ -533,8 +533,14 @@ static void inno_hdmi_power_up(struct inno_hdmi *hdmi, unsigned long mpixelclock) { struct inno_hdmi_phy_config *phy_config; - int ret = inno_hdmi_find_phy_config(hdmi, mpixelclock); + int ret; + + inno_hdmi_sys_power(hdmi, false); + + if (!hdmi->plat_data->phy_configs) + goto out; + ret = inno_hdmi_find_phy_config(hdmi, mpixelclock); if (ret < 0) { phy_config = hdmi->plat_data->default_phy_config; DRM_DEV_ERROR(hdmi->dev, @@ -544,8 +550,6 @@ static void inno_hdmi_power_up(struct inno_hdmi *hdmi, phy_config = &hdmi->plat_data->phy_configs[ret]; } - inno_hdmi_sys_power(hdmi, false); - hdmi_writeb(hdmi, HDMI_PHY_PRE_EMPHASIS, phy_config->pre_emphasis); hdmi_writeb(hdmi, HDMI_PHY_DRIVER, phy_config->voltage_level_control); hdmi_writeb(hdmi, HDMI_PHY_SYS_CTL, 0x15); @@ -555,6 +559,7 @@ static void inno_hdmi_power_up(struct inno_hdmi *hdmi, hdmi_writeb(hdmi, HDMI_PHY_SYNC, 0x00); hdmi_writeb(hdmi, HDMI_PHY_SYNC, 0x01); +out: inno_hdmi_sys_power(hdmi, true); }; @@ -831,7 +836,8 @@ static enum drm_mode_status inno_hdmi_bridge_mode_valid(struct drm_bridge *bridg if (mpixelclk < HDMI_TMDS_CHAR_RATE_MIN_HZ) return MODE_CLOCK_LOW; - if (inno_hdmi_find_phy_config(hdmi, mpixelclk) < 0) + if (hdmi->plat_data->phy_configs && + inno_hdmi_find_phy_config(hdmi, mpixelclk) < 0) return MODE_CLOCK_HIGH; if (plat_ops && plat_ops->mode_valid) { @@ -1107,11 +1113,6 @@ struct inno_hdmi *inno_hdmi_probe(struct platform_device *pdev, int irq; int ret; - if (!plat_data->phy_configs || !plat_data->default_phy_config) { - dev_err(dev, "Missing platform PHY ops\n"); - return ERR_PTR(-ENODEV); - } - hdmi = devm_drm_bridge_alloc(dev, struct inno_hdmi, bridge, &inno_hdmi_bridge_funcs); if (IS_ERR(hdmi)) return ERR_CAST(hdmi); -- 2.34.1
