Add a power_off callback function for imx8qm hdmi to avoid hdmi phy abnormality when hdmi components are bound and unbind multiple times
Signed-off-by: Xiaolei Wang <[email protected]> --- .../gpu/drm/bridge/cadence/cdns-hdmi-core.c | 1 + drivers/gpu/drm/imx/mhdp/cdns-mhdp-imx.h | 1 + drivers/gpu/drm/imx/mhdp/cdns-mhdp-imx8qm.c | 28 +++++++++++++++++++ drivers/gpu/drm/imx/mhdp/cdns-mhdp-imxdrv.c | 1 + 4 files changed, 31 insertions(+) diff --git a/drivers/gpu/drm/bridge/cadence/cdns-hdmi-core.c b/drivers/gpu/drm/bridge/cadence/cdns-hdmi-core.c index 9ddf0fd02d3a..58ff13f06a17 100644 --- a/drivers/gpu/drm/bridge/cadence/cdns-hdmi-core.c +++ b/drivers/gpu/drm/bridge/cadence/cdns-hdmi-core.c @@ -818,6 +818,7 @@ void cdns_hdmi_unbind(struct device *dev) { struct cdns_mhdp_device *mhdp = dev_get_drvdata(dev); + cdns_mhdp_plat_call(mhdp, power_off); __cdns_hdmi_remove(mhdp); } EXPORT_SYMBOL_GPL(cdns_hdmi_unbind); diff --git a/drivers/gpu/drm/imx/mhdp/cdns-mhdp-imx.h b/drivers/gpu/drm/imx/mhdp/cdns-mhdp-imx.h index e5ec3cc4073e..f83e5d5fdc3e 100644 --- a/drivers/gpu/drm/imx/mhdp/cdns-mhdp-imx.h +++ b/drivers/gpu/drm/imx/mhdp/cdns-mhdp-imx.h @@ -70,6 +70,7 @@ int cdns_mhdp_firmware_init_imx8qm(struct cdns_mhdp_device *mhdp); int cdns_mhdp_resume_imx8qm(struct cdns_mhdp_device *mhdp); int cdns_mhdp_suspend_imx8qm(struct cdns_mhdp_device *mhdp); int cdns_mhdp_power_on_imx8qm(struct cdns_mhdp_device *mhdp); +int cdns_mhdp_power_off_imx8qm(struct cdns_mhdp_device *mhdp); int cdns_mhdp_power_on_ls1028a(struct cdns_mhdp_device *mhdp); void cdns_mhdp_pclk_rate_ls1028a(struct cdns_mhdp_device *mhdp); void imx8qm_phy_reset(u8 reset); diff --git a/drivers/gpu/drm/imx/mhdp/cdns-mhdp-imx8qm.c b/drivers/gpu/drm/imx/mhdp/cdns-mhdp-imx8qm.c index 4fca888c3991..bbfc4df76b11 100644 --- a/drivers/gpu/drm/imx/mhdp/cdns-mhdp-imx8qm.c +++ b/drivers/gpu/drm/imx/mhdp/cdns-mhdp-imx8qm.c @@ -373,6 +373,22 @@ static int imx8qm_ipg_clk_enable(struct imx_mhdp_device *imx_mhdp) return ret; } +static void imx8qm_ipg_clk_disable(struct imx_mhdp_device *imx_mhdp) +{ + struct imx_hdp_clks *clks = &imx_mhdp->clks; + + clk_disable_unprepare(clks->clk_i2s_bypass); + clk_disable_unprepare(clks->lpcg_i2s); + clk_disable_unprepare(clks->lpcg_apb_ctrl); + clk_disable_unprepare(clks->lpcg_apb_csr); + clk_disable_unprepare(clks->lpcg_msi); + clk_disable_unprepare(clks->lpcg_lis); + clk_disable_unprepare(clks->lpcg_apb); + clk_disable_unprepare(clks->clk_core); + clk_disable_unprepare(clks->clk_ipg); + clk_disable_unprepare(clks->dig_pll); +} + static void imx8qm_ipg_clk_set_rate(struct imx_mhdp_device *imx_mhdp) { struct imx_hdp_clks *clks = &imx_mhdp->clks; @@ -487,6 +503,18 @@ int cdns_mhdp_power_on_imx8qm(struct cdns_mhdp_device *mhdp) return 0; } +int cdns_mhdp_power_off_imx8qm(struct cdns_mhdp_device *mhdp) +{ + struct imx_mhdp_device *imx_mhdp = + container_of(mhdp, struct imx_mhdp_device, mhdp); + + imx8qm_pixel_clk_disable(imx_mhdp); + imx8qm_ipg_clk_disable(imx_mhdp); + imx8qm_phy_reset(0); + imx8qm_detach_pm_domains(imx_mhdp); + return 0; +} + void cdns_mhdp_plat_deinit_imx8qm(struct cdns_mhdp_device *mhdp) { struct imx_mhdp_device *imx_mhdp = diff --git a/drivers/gpu/drm/imx/mhdp/cdns-mhdp-imxdrv.c b/drivers/gpu/drm/imx/mhdp/cdns-mhdp-imxdrv.c index 4ec44e84d008..a5e189311afd 100644 --- a/drivers/gpu/drm/imx/mhdp/cdns-mhdp-imxdrv.c +++ b/drivers/gpu/drm/imx/mhdp/cdns-mhdp-imxdrv.c @@ -97,6 +97,7 @@ static struct cdns_plat_data imx8qm_hdmi_drv_data = { .phy_set = cdns_hdmi_phy_set_imx8qm, .phy_video_valid = cdns_hdmi_phy_video_valid_imx8qm, .power_on = cdns_mhdp_power_on_imx8qm, + .power_off = cdns_mhdp_power_off_imx8qm, .firmware_init = cdns_mhdp_firmware_init_imx8qm, .resume = cdns_mhdp_resume_imx8qm, .suspend = cdns_mhdp_suspend_imx8qm, -- 2.25.1
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#12421): https://lists.yoctoproject.org/g/linux-yocto/message/12421 Mute This Topic: https://lists.yoctoproject.org/mt/98527211/21656 Group Owner: [email protected] Unsubscribe: https://lists.yoctoproject.org/g/linux-yocto/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
