platform: msm_shared: configure hdmi core
Adjust HDMI power on sequence and add definitions
for HDMI support.
Change-Id: If996f24fbec8c4cc48d1d247ee883b2ff16d8fb9
diff --git a/platform/msm_shared/include/mdss_hdmi.h b/platform/msm_shared/include/mdss_hdmi.h
new file mode 100644
index 0000000..da0c5b7
--- /dev/null
+++ b/platform/msm_shared/include/mdss_hdmi.h
@@ -0,0 +1,38 @@
+/* Copyright (c) 2015, The Linux Foundation. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ */
+
+#ifndef _PLATFORM_MSM_SHARED_MDSS_HDMI_H_
+#define _PLATFORM_MSM_SHARED_MDSS_HDMI_H_
+
+void hdmi_phy_reset(void);
+uint32_t hdmi_pll_config(void);
+int hdmi_vco_enable(void);
+int hdmi_vco_disable(void);
+void mdss_hdmi_display_init(uint32_t rev, void *base);
+#endif
diff --git a/platform/msm_shared/mdp5.c b/platform/msm_shared/mdp5.c
index b48efb7..a9d9d0b 100755
--- a/platform/msm_shared/mdp5.c
+++ b/platform/msm_shared/mdp5.c
@@ -951,8 +951,10 @@
int mdss_hdmi_config(struct msm_panel_info *pinfo, struct fbcon_config *fb)
{
uint32_t left_pipe, right_pipe;
+ dprintf(SPEW, "ENTER: %s\n", __func__);
- mdss_intf_tg_setup(pinfo, MDP_INTF_3_BASE);
+ mdss_intf_tg_setup(pinfo, MDP_INTF_3_BASE + mdss_mdp_intf_offset());
+ pinfo->pipe_type = MDSS_MDP_PIPE_TYPE_RGB;
mdp_select_pipe_type(pinfo, &left_pipe, &right_pipe);
mdp_clk_gating_ctrl();
diff --git a/platform/msm_shared/mdss_hdmi.c b/platform/msm_shared/mdss_hdmi.c
index e0c8573..b9e12e8 100644
--- a/platform/msm_shared/mdss_hdmi.c
+++ b/platform/msm_shared/mdss_hdmi.c
@@ -29,13 +29,19 @@
#include <err.h>
#include <debug.h>
#include <reg.h>
+#include <malloc.h>
+#include <string.h>
#include <msm_panel.h>
#include <platform/timer.h>
#include <platform/clock.h>
+#include "mdp5.h"
#include <platform/iomap.h>
+#include "mdss_hdmi.h"
static struct msm_fb_panel_data panel;
+extern int msm_display_init(struct msm_fb_panel_data *pdata);
+
/* AVI INFOFRAME DATA */
#define NUM_MODES_AVI 20
#define AVI_MAX_DATA_BYTES 13
@@ -221,9 +227,9 @@
static void mdss_hdmi_audio_playback(void)
{
- uint32_t base_addr;
+ char *base_addr;
- base_addr = memalign(4096, 0x1000);
+ base_addr = (char *) memalign(4096, 0x1000);
if (base_addr == NULL) {
dprintf(CRITICAL, "%s: Error audio buffer alloc\n", __func__);
return;
@@ -239,7 +245,7 @@
writel(0x00002000, HDMI_VBI_PKT_CTRL);
writel(0x00000000, HDMI_GEN_PKT_CTRL);
writel(0x0000096E, LPASS_LPAIF_RDDMA_CTL0);
- writel(base_addr, LPASS_LPAIF_RDDMA_BASE0);
+ writel((uint32_t) base_addr, LPASS_LPAIF_RDDMA_BASE0);
writel(0x000005FF, LPASS_LPAIF_RDDMA_BUFF_LEN0);
writel(0x000005FF, LPASS_LPAIF_RDDMA_PER_LEN0);
writel(0x0000096F, LPASS_LPAIF_RDDMA_CTL0);
@@ -258,7 +264,7 @@
writel(0x00000081, HDMI_AUDIO_CFG);
}
-static int mdss_hdmi_panel_clock(uint8_t enable, struct msm_panel_info *pinfo)
+static uint32_t mdss_hdmi_panel_clock(uint8_t enable, struct msm_panel_info *pinfo)
{
return target_hdmi_panel_clock(enable, pinfo);
}
@@ -267,12 +273,6 @@
{
int ret = NO_ERROR;
- ret = target_ldo_ctrl(enable, pinfo);
- if (ret) {
- dprintf(CRITICAL, "LDO control enable failed\n");
- goto bail_ldo_fail;
- }
-
ret = target_hdmi_regulator_ctrl(enable);
if (ret) {
dprintf(CRITICAL, "hdmi regulator control enable failed\n");
@@ -293,9 +293,6 @@
target_hdmi_regulator_ctrl(0);
bail_regulator_fail:
- target_ldo_ctrl(0, pinfo);
-
-bail_ldo_fail:
return ret;
}
@@ -472,12 +469,8 @@
int mdss_hdmi_init(void)
{
- uint32_t hotplug_control;
-
mdss_hdmi_set_mode(false);
- hdmi_phy_init();
-
/* Enable USEC REF timer */
writel(0x0001001B, HDMI_USEC_REFTIMER);
diff --git a/target/msm8994/include/target/display.h b/target/msm8994/include/target/display.h
index c426ee2..d47bde9 100644
--- a/target/msm8994/include/target/display.h
+++ b/target/msm8994/include/target/display.h
@@ -33,6 +33,7 @@
/* HEADER files */
/*---------------------------------------------------------------------------*/
#include <display_resource.h>
+#include <msm_panel.h>
#define TOTAL_LDO_DEFINED 3
@@ -97,5 +98,8 @@
int target_display_get_base_offset(uint32_t base);
void target_force_cont_splash_disable(uint8_t override);
uint8_t target_panel_auto_detect_enabled();
+int target_hdmi_panel_clock(uint8_t enable, struct msm_panel_info *pinfo);
+int target_hdmi_regulator_ctrl(uint8_t enable);
+int target_hdmi_gpio_ctrl(uint8_t enable);