From 03da4cbee023df8ac77fd85784968c72041996d0 Mon Sep 17 00:00:00 2001 From: Sean Paul Date: Thu, 15 Nov 2012 11:24:27 -0500 Subject: [PATCH] drm/exynos: Implement DPMS_STANDBY for HDMI MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Enable the "blue screen" when we get a DPMS_STANDBY request for HDMI. This allows us to turn off the mixer, but maintain audio over HDMI when we turn the screen idle. BUG=chrome-os-partner:15709 TEST=Tested on snow by ensuring audio continues to play during idle Change-Id: I2639c0d1cd7384881b5fd651039fef71b27c76ed Signed-off-by: Sean Paul Reviewed-on: https://gerrit.chromium.org/gerrit/38122 Reviewed-by: Stéphane Marchesin Reviewed-by: Daniel Kurtz --- drivers/gpu/drm/exynos/exynos_hdmi.c | 40 +++++++++++++++++++++++++--- drivers/gpu/drm/exynos/regs-hdmi.h | 8 +++--- 2 files changed, 40 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_hdmi.c b/drivers/gpu/drm/exynos/exynos_hdmi.c index 91516ec79fec..900d7e1f7bee 100644 --- a/drivers/gpu/drm/exynos/exynos_hdmi.c +++ b/drivers/gpu/drm/exynos/exynos_hdmi.c @@ -136,6 +136,7 @@ struct hdmi_context { bool has_hdmi_audio; bool is_soc_exynos5; bool is_hdmi_powered_on; + bool video_enabled; struct resource *regs_res; void __iomem *regs; @@ -1238,6 +1239,33 @@ static void hdmi_conf_reset(struct hdmi_context *hdata) hdata->hpd_handle = true; } +static void hdmi_enable_video(struct hdmi_context *hdata) +{ + if (hdata->is_v13) + return; + + hdata->video_enabled = true; + hdmi_reg_writemask(hdata, HDMI_CON_0, 0, HDMI_BLUE_SCR_EN); +} + +static void hdmi_disable_video(struct hdmi_context *hdata) +{ + if (hdata->is_v13) + return; + + /* Set the blue screen color to black */ + hdmi_reg_writeb(hdata, HDMI_BLUE_SCREEN_R_0, 0); + hdmi_reg_writeb(hdata, HDMI_BLUE_SCREEN_R_1, 0); + hdmi_reg_writeb(hdata, HDMI_BLUE_SCREEN_G_0, 0); + hdmi_reg_writeb(hdata, HDMI_BLUE_SCREEN_G_1, 0); + hdmi_reg_writeb(hdata, HDMI_BLUE_SCREEN_B_0, 0); + hdmi_reg_writeb(hdata, HDMI_BLUE_SCREEN_B_1, 0); + + /* Enable the "blue screen", which effectively disconnects the mixer */ + hdata->video_enabled = false; + hdmi_reg_writemask(hdata, HDMI_CON_0, ~0, HDMI_BLUE_SCR_EN); +} + static void hdmi_conf_init(struct hdmi_context *hdata) { struct hdmi_infoframe infoframe; @@ -1254,8 +1282,11 @@ static void hdmi_conf_init(struct hdmi_context *hdata) /* choose HDMI mode */ hdmi_reg_writemask(hdata, HDMI_MODE_SEL, HDMI_MODE_HDMI_EN, HDMI_MODE_MASK); - /* disable bluescreen */ - hdmi_reg_writemask(hdata, HDMI_CON_0, 0, HDMI_BLUE_SCR_EN); + + if (hdata->video_enabled) + hdmi_enable_video(hdata); + else + hdmi_disable_video(hdata); if (!hdata->has_hdmi_sink) { /* choose DVI mode */ @@ -2022,12 +2053,13 @@ static int hdmi_power(void *ctx, int mode) case DRM_MODE_DPMS_ON: if (!hdata->is_hdmi_powered_on) hdmi_resource_poweron(hdata); + hdmi_enable_video(hdata); break; case DRM_MODE_DPMS_STANDBY: - break; - case DRM_MODE_DPMS_SUSPEND: + hdmi_disable_video(hdata); break; case DRM_MODE_DPMS_OFF: + case DRM_MODE_DPMS_SUSPEND: if (hdata->is_hdmi_powered_on) hdmi_resource_poweroff(hdata); break; diff --git a/drivers/gpu/drm/exynos/regs-hdmi.h b/drivers/gpu/drm/exynos/regs-hdmi.h index 3a72091a5035..b0cd5645dda0 100644 --- a/drivers/gpu/drm/exynos/regs-hdmi.h +++ b/drivers/gpu/drm/exynos/regs-hdmi.h @@ -386,12 +386,12 @@ #define HDMI_VACT_SPACE_B_0 HDMI_CORE_BASE(0xD514) #define HDMI_VACT_SPACE_B_1 HDMI_CORE_BASE(0xD518) -#define HDMI_BLUE_SCREEN_B_0 HDMI_CORE_BASE(0xD520) -#define HDMI_BLUE_SCREEN_B_1 HDMI_CORE_BASE(0xD524) +#define HDMI_BLUE_SCREEN_R_0 HDMI_CORE_BASE(0xD520) +#define HDMI_BLUE_SCREEN_R_1 HDMI_CORE_BASE(0xD524) #define HDMI_BLUE_SCREEN_G_0 HDMI_CORE_BASE(0xD528) #define HDMI_BLUE_SCREEN_G_1 HDMI_CORE_BASE(0xD52C) -#define HDMI_BLUE_SCREEN_R_0 HDMI_CORE_BASE(0xD530) -#define HDMI_BLUE_SCREEN_R_1 HDMI_CORE_BASE(0xD534) +#define HDMI_BLUE_SCREEN_B_0 HDMI_CORE_BASE(0xD530) +#define HDMI_BLUE_SCREEN_B_1 HDMI_CORE_BASE(0xD534) /* HDMI I2S register */ #define HDMI_I2S_CLK_CON HDMI_I2S_BASE(0x000) -- 2.20.1