drm/msm/hdmi: move msm_hdmi_get_phy() to msm_hdmi_dev_probe()
To continue the idea of failing the probe() rather than failing the bind(), move the call to msm_hdmi_get_phy() function to msm_hdmi_dev_probe(), so that the driver fails the probe if PHY is not yet available rather than succeeding the probe and then failing the bind() with -EPROBE_DEFER. Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org> Reviewed-by: Abhinav Kumar <quic_abhinavk@quicinc.com> Patchwork: https://patchwork.freedesktop.org/patch/499652/ Link: https://lore.kernel.org/r/20220826093927.851597-6-dmitry.baryshkov@linaro.org Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
This commit is contained in:
parent
248adb815b
commit
4373654640
@ -68,14 +68,17 @@ static void msm_hdmi_destroy(struct hdmi *hdmi)
|
||||
destroy_workqueue(hdmi->workq);
|
||||
msm_hdmi_hdcp_destroy(hdmi);
|
||||
|
||||
if (hdmi->i2c)
|
||||
msm_hdmi_i2c_destroy(hdmi->i2c);
|
||||
}
|
||||
|
||||
static void msm_hdmi_put_phy(struct hdmi *hdmi)
|
||||
{
|
||||
if (hdmi->phy_dev) {
|
||||
put_device(hdmi->phy_dev);
|
||||
hdmi->phy = NULL;
|
||||
hdmi->phy_dev = NULL;
|
||||
}
|
||||
|
||||
if (hdmi->i2c)
|
||||
msm_hdmi_i2c_destroy(hdmi->i2c);
|
||||
}
|
||||
|
||||
static int msm_hdmi_get_phy(struct hdmi *hdmi)
|
||||
@ -91,19 +94,15 @@ static int msm_hdmi_get_phy(struct hdmi *hdmi)
|
||||
}
|
||||
|
||||
phy_pdev = of_find_device_by_node(phy_node);
|
||||
if (phy_pdev)
|
||||
hdmi->phy = platform_get_drvdata(phy_pdev);
|
||||
|
||||
of_node_put(phy_node);
|
||||
|
||||
if (!phy_pdev) {
|
||||
DRM_DEV_ERROR(&pdev->dev, "phy driver is not ready\n");
|
||||
return -EPROBE_DEFER;
|
||||
}
|
||||
if (!phy_pdev)
|
||||
return dev_err_probe(&pdev->dev, -EPROBE_DEFER, "phy driver is not ready\n");
|
||||
|
||||
hdmi->phy = platform_get_drvdata(phy_pdev);
|
||||
if (!hdmi->phy) {
|
||||
DRM_DEV_ERROR(&pdev->dev, "phy driver is not ready\n");
|
||||
put_device(&phy_pdev->dev);
|
||||
return -EPROBE_DEFER;
|
||||
return dev_err_probe(&pdev->dev, -EPROBE_DEFER, "phy driver is not ready\n");
|
||||
}
|
||||
|
||||
hdmi->phy_dev = &phy_pdev->dev;
|
||||
@ -130,12 +129,6 @@ static int msm_hdmi_init(struct hdmi *hdmi)
|
||||
goto fail;
|
||||
}
|
||||
|
||||
ret = msm_hdmi_get_phy(hdmi);
|
||||
if (ret) {
|
||||
DRM_DEV_ERROR(&pdev->dev, "failed to get phy\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
hdmi->hdcp_ctrl = msm_hdmi_hdcp_init(hdmi);
|
||||
if (IS_ERR(hdmi->hdcp_ctrl)) {
|
||||
dev_warn(&pdev->dev, "failed to init hdcp: disabled\n");
|
||||
@ -532,6 +525,12 @@ static int msm_hdmi_dev_probe(struct platform_device *pdev)
|
||||
if (hdmi->hpd_gpiod)
|
||||
gpiod_set_consumer_name(hdmi->hpd_gpiod, "HDMI_HPD");
|
||||
|
||||
ret = msm_hdmi_get_phy(hdmi);
|
||||
if (ret) {
|
||||
DRM_DEV_ERROR(&pdev->dev, "failed to get phy\n");
|
||||
return ret;
|
||||
}
|
||||
|
||||
ret = devm_pm_runtime_enable(&pdev->dev);
|
||||
if (ret)
|
||||
return ret;
|
||||
@ -543,7 +542,12 @@ static int msm_hdmi_dev_probe(struct platform_device *pdev)
|
||||
|
||||
static int msm_hdmi_dev_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct hdmi *hdmi = dev_get_drvdata(&pdev->dev);
|
||||
|
||||
component_del(&pdev->dev, &msm_hdmi_ops);
|
||||
|
||||
msm_hdmi_put_phy(hdmi);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user