From 9737dd813b872f5671d40685d2174a928da809a3 Mon Sep 17 00:00:00 2001
From: Wen He <wen.he_1@nxp.com>
Date: Tue, 17 Sep 2019 15:23:51 +0800
Subject: [PATCH] drm: bridge: cadence: Add power_on to __cdns_dp_probe

Add power_on of the cnds_plat_data to __cdns_dp_probe as to update
Board related configuration initalization.

Signed-off-by: Wen He <wen.he_1@nxp.com>
---
 drivers/gpu/drm/bridge/cadence/cdns-dp-core.c   | 2 ++
 drivers/gpu/drm/bridge/cadence/cdns-hdmi-core.c | 2 ++
 drivers/gpu/drm/imx/cdn-mhdp-imx8qm.c           | 6 +++---
 drivers/gpu/drm/imx/cdn-mhdp-imxdrv.c           | 2 ++
 drivers/gpu/drm/imx/cdns-mhdp-imx.h             | 1 +
 5 files changed, 10 insertions(+), 3 deletions(-)

--- a/drivers/gpu/drm/bridge/cadence/cdns-dp-core.c
+++ b/drivers/gpu/drm/bridge/cadence/cdns-dp-core.c
@@ -457,6 +457,8 @@ static int __cdns_dp_probe(struct platfo
 
 	cdns_dp_parse_dt(mhdp);
 
+	cdns_mhdp_plat_call(mhdp, power_on);
+
 //	mhdp->dual_mode = false;
 	cdns_mhdp_plat_call(mhdp, firmware_init);
 
--- a/drivers/gpu/drm/bridge/cadence/cdns-hdmi-core.c
+++ b/drivers/gpu/drm/bridge/cadence/cdns-hdmi-core.c
@@ -449,6 +449,8 @@ static int __cdns_hdmi_probe(struct plat
 	/* Initialize dual_mode to false */
 //	hdmi->dual_mode = false;
 
+	cdns_mhdp_plat_call(mhdp, power_on);
+
 	/* Initialize FW */
 	cdns_mhdp_plat_call(mhdp, firmware_init);
 
--- a/drivers/gpu/drm/imx/cdn-mhdp-imx8qm.c
+++ b/drivers/gpu/drm/imx/cdn-mhdp-imx8qm.c
@@ -440,7 +440,7 @@ fail:
 	return ret;
 }
 
-static void imx8qm_mhdp_power_on(struct cdns_mhdp_device *mhdp)
+int cdns_mhdp_power_on_imx8qm(struct cdns_mhdp_device *mhdp)
 {
 	struct imx_mhdp_device *imx_mhdp =
 				container_of(mhdp, struct imx_mhdp_device, mhdp);
@@ -463,6 +463,8 @@ static void imx8qm_mhdp_power_on(struct
 	imx8qm_pixel_clk_enable(imx_mhdp);
 
 	imx8qm_phy_reset(1);
+
+	return 0;
 }
 
 void cdns_mhdp_plat_init_imx8qm(struct cdns_mhdp_device *mhdp)
@@ -506,8 +508,6 @@ int cdns_mhdp_firmware_init_imx8qm(struc
 	u32 rate;
 	int ret;
 
-	imx8qm_mhdp_power_on(mhdp);
-
 	/* configure HDMI/DP core clock */
 	rate = clk_get_rate(imx_mhdp->clks.clk_core);
 	cdns_mhdp_set_fw_clk(&imx_mhdp->mhdp, rate);
--- a/drivers/gpu/drm/imx/cdn-mhdp-imxdrv.c
+++ b/drivers/gpu/drm/imx/cdn-mhdp-imxdrv.c
@@ -71,6 +71,7 @@ static struct cdns_plat_data imx8qm_hdmi
 	.bind	= cdns_hdmi_bind,
 	.unbind	= cdns_hdmi_unbind,
 	.phy_set = cdns_hdmi_phy_set_imx8qm,
+	.power_on = cdns_mhdp_power_on_imx8qm,
 	.firmware_init = cdns_mhdp_firmware_init_imx8qm,
 	.pclk_rate = cdns_mhdp_pclk_rate_imx8qm,
 	.plat_init = cdns_mhdp_plat_init_imx8qm,
@@ -83,6 +84,7 @@ static struct cdns_plat_data imx8qm_dp_d
 	.bind	= cdns_dp_bind,
 	.unbind	= cdns_dp_unbind,
 	.phy_set = cdns_dp_phy_set_imx8qm,
+	.power_on = cdns_mhdp_power_on_imx8qm,
 	.firmware_init = cdns_mhdp_firmware_init_imx8qm,
 	.pclk_rate = cdns_mhdp_pclk_rate_imx8qm,
 	.plat_init = cdns_mhdp_plat_init_imx8qm,
--- a/drivers/gpu/drm/imx/cdns-mhdp-imx.h
+++ b/drivers/gpu/drm/imx/cdns-mhdp-imx.h
@@ -77,4 +77,5 @@ void cdns_mhdp_plat_init_imx8qm(struct c
 void cdns_mhdp_plat_deinit_imx8qm(struct cdns_mhdp_device *mhdp);
 void cdns_mhdp_pclk_rate_imx8qm(struct cdns_mhdp_device *mhdp);
 int cdns_mhdp_firmware_init_imx8qm(struct cdns_mhdp_device *mhdp);
+int cdns_mhdp_power_on_imx8qm(struct cdns_mhdp_device *mhdp);
 #endif /* CDNS_MHDP_IMX_H_ */
