summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2014-12-19 14:13:57 (GMT)
committerHans de Goede <hdegoede@redhat.com>2015-01-14 13:56:38 (GMT)
commit518cef20f88d1c020a57febf69ed220bdda746df (patch)
tree16cb6c96cd59ae9c15f089b50c29a9cf6c655cb5
parent5f33993b7e9a3a3bfc6887780d4101e684b11359 (diff)
downloadu-boot-518cef20f88d1c020a57febf69ed220bdda746df.tar.xz
sunxi: video: Add hpd option
Allow the user to specify hpd=0 as option in the video-mode env. variable, if hpd is set to 0 then the hdmi output will be brought up even if no cable is connected. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Acked-by: Ian Campbell <ijc@hellion.org.uk> Acked-by: Anatolij Gustschin <agust@denx.de>
-rw-r--r--drivers/video/sunxi_display.c26
1 files changed, 17 insertions, 9 deletions
diff --git a/drivers/video/sunxi_display.c b/drivers/video/sunxi_display.c
index cf81e45..18fa83d 100644
--- a/drivers/video/sunxi_display.c
+++ b/drivers/video/sunxi_display.c
@@ -53,10 +53,16 @@ static int sunxi_hdmi_hpd_detect(void)
udelay(1000);
- if (readl(&hdmi->hpd) & SUNXI_HDMI_HPD_DETECT)
- return 1;
+ return (readl(&hdmi->hpd) & SUNXI_HDMI_HPD_DETECT) ? 1 : 0;
+}
+
+static void sunxi_hdmi_shutdown(void)
+{
+ struct sunxi_ccm_reg * const ccm =
+ (struct sunxi_ccm_reg *)SUNXI_CCM_BASE;
+ struct sunxi_hdmi_reg * const hdmi =
+ (struct sunxi_hdmi_reg *)SUNXI_HDMI_BASE;
- /* No need to keep these running */
clrbits_le32(&hdmi->ctrl, SUNXI_HDMI_CTRL_ENABLE);
clrbits_le32(&ccm->hdmi_clk_cfg, CCM_HDMI_CTRL_GATE);
clrbits_le32(&ccm->ahb_gate1, 1 << AHB_GATE_OFFSET_HDMI);
@@ -64,8 +70,6 @@ static int sunxi_hdmi_hpd_detect(void)
clrbits_le32(&ccm->ahb_reset1_cfg, 1 << AHB_RESET_OFFSET_HDMI);
#endif
clock_set_pll3(0);
-
- return 0;
}
/*
@@ -361,7 +365,7 @@ void *video_hw_init(void)
const struct ctfb_res_modes *mode;
const char *options;
unsigned int depth;
- int ret;
+ int ret, hpd;
memset(&sunxi_display, 0, sizeof(struct sunxi_display));
@@ -370,12 +374,16 @@ void *video_hw_init(void)
gd->fb_base = gd->ram_top;
video_get_ctfb_res_modes(RES_MODE_1024x768, 24, &mode, &depth, &options);
+ hpd = video_get_option_int(options, "hpd", 1);
+ /* Always call hdp_detect, as it also enables various clocks, etc. */
ret = sunxi_hdmi_hpd_detect();
- if (!ret)
+ if (hpd && !ret) {
+ sunxi_hdmi_shutdown();
return NULL;
-
- printf("HDMI connected.\n");
+ }
+ if (ret)
+ printf("HDMI connected: ");
if (mode->vmode != FB_VMODE_NONINTERLACED) {
printf("Only non-interlaced modes supported, falling back to 1024x768\n");