platform: msm8996: separate core and pixel clocks

Provide different APIs to program core/ahb and pixel clocks
for HDMI. Core clocks are needed for HPD and cable detection.
Once the cable detection is successful, HDMI power on is done
which needs pixel clock. As they are two different code flows,
we need to separate out the pixel clocks.

Change-Id: Id9046f59d4f74b5d5801d9036279bbbca4691dca
diff --git a/platform/msm8996/acpuclock.c b/platform/msm8996/acpuclock.c
index 233508a..ec4820a 100644
--- a/platform/msm8996/acpuclock.c
+++ b/platform/msm8996/acpuclock.c
@@ -655,7 +655,7 @@
 	}
 }
 
-void hdmi_clk_enable(void)
+void hdmi_ahb_core_clk_enable(void)
 {
 	int ret;
 
@@ -672,18 +672,26 @@
 		dprintf(CRITICAL, "failed to set hdmi_core_clk ret = %d\n", ret);
 		ASSERT(0);
 	}
+}
+
+void hdmi_pixel_clk_enable(uint32_t rate) {
+	int ret;
 
 	/* Configure hdmi pixel clock */
-	ret = clk_get_set_enable("hdmi_extp_clk", 148500000, 1);
+	ret = clk_get_set_enable("hdmi_extp_clk", rate, 1);
 	if(ret) {
 		dprintf(CRITICAL, "failed to set hdmi_extp_clk ret = %d\n", ret);
 		ASSERT(0);
 	}
 }
 
-void hdmi_clk_disable(void)
+void hdmi_pixel_clk_disable(void)
 {
 	clk_disable(clk_get("hdmi_extp_clk"));
+}
+
+void hdmi_core_ahb_clk_disable(void)
+{
 	clk_disable(clk_get("hdmi_core_clk"));
 	clk_disable(clk_get("hdmi_ahb_clk"));
 }
diff --git a/platform/msm8996/include/platform/clock.h b/platform/msm8996/include/platform/clock.h
index c61708f..7cdd3d3 100644
--- a/platform/msm8996/include/platform/clock.h
+++ b/platform/msm8996/include/platform/clock.h
@@ -132,7 +132,8 @@
 void video_gdsc_disable();
 void clock_config_blsp_i2c(uint8_t blsp_id, uint8_t qup_id);
 
-void hdmi_clk_enable(void);
-void hdmi_clk_disable(void);
-
+void hdmi_ahb_core_clk_enable(void);
+void hdmi_pixel_clk_enable(uint32_t rate);
+void hdmi_pixel_clk_disable(void);
+void hdmi_core_ahb_clk_disable(void);
 #endif
diff --git a/target/msm8996/target_display.c b/target/msm8996/target_display.c
index 36ea77d..a05b5b0 100644
--- a/target/msm8996/target_display.c
+++ b/target/msm8996/target_display.c
@@ -175,24 +175,43 @@
 	return NO_ERROR;
 }
 
+int target_hdmi_pll_clock(uint8_t enable, struct msm_panel_info *pinfo)
+{
+    if (enable) {
+        hdmi_phy_reset();
+        hdmi_pll_config(pinfo->clk_rate);
+        hdmi_vco_enable();
+        hdmi_pixel_clk_enable(pinfo->clk_rate);
+    } else if(!target_cont_splash_screen()) {
+        /* Disable clocks if continuous splash off */
+        hdmi_pixel_clk_disable();
+        hdmi_vco_disable();
+    }
+
+    return NO_ERROR;
+}
+
 int target_hdmi_panel_clock(uint8_t enable, struct msm_panel_info *pinfo)
 {
 	dprintf(SPEW, "%s: target_panel_clock\n", __func__);
 
+	uint32_t board_version = board_soc_version();
+
+	if (board_version == 0x20000 || board_version == 0x20001)
+		video_gdsc_enable();
+
 	if (enable) {
 		mmss_gdsc_enable();
 		mmss_bus_clock_enable();
 		mdp_clock_enable();
-		hdmi_phy_reset();
-		hdmi_pll_config(pinfo->clk_rate);
-		hdmi_vco_enable();
-		hdmi_clk_enable();
+		hdmi_ahb_core_clk_enable();
 	} else if(!target_cont_splash_screen()) {
-		hdmi_clk_disable();
-		hdmi_vco_disable();
+		hdmi_core_ahb_clk_disable();
 		mdp_clock_disable();
 		mmss_bus_clock_disable();
 		mmss_gdsc_disable();
+		if (board_version == 0x20000 || board_version == 0x20001)
+			video_gdsc_disable();
 	}
 
 	return NO_ERROR;