aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMengdong Lin <mengdong.lin@intel.com>2013-11-01 00:17:03 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2013-11-05 01:57:26 -0500
commit9ca2fe731b3f12afbc97cf0050dfa4184bd2234c (patch)
tree141d726d7eb6cf7e5a9b80d1594d4cfc8d009c3b
parent48f34e10169dbb3dd7a19af64e328492b7f54af4 (diff)
drm/i915/vlv: enable HDA display audio for Valleyview2
This patch defines HD-Audio configuration registers and enables display audio from HDA controller for Valleyview2. v2: fix missing offset VLV_DISPLAY_BASE v3: rename patch from 'enable HDMI audio' to 'enable HDA display audio', since it's for both HDMI and DP audio v4: use enc_to_dig_port() to get port number, instead of using Haswell specific function intel_ddi_get_encoder_port() Signed-off-by: Mengdong Lin <mengdong.lin@intel.com> Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r--drivers/gpu/drm/i915/i915_reg.h18
-rw-r--r--drivers/gpu/drm/i915/intel_display.c23
2 files changed, 38 insertions, 3 deletions
diff --git a/drivers/gpu/drm/i915/i915_reg.h b/drivers/gpu/drm/i915/i915_reg.h
index 3f303ba995c5..98d7263fba67 100644
--- a/drivers/gpu/drm/i915/i915_reg.h
+++ b/drivers/gpu/drm/i915/i915_reg.h
@@ -4948,6 +4948,18 @@
4948 CPT_AUD_CNTL_ST_B) 4948 CPT_AUD_CNTL_ST_B)
4949#define CPT_AUD_CNTRL_ST2 0xE50C0 4949#define CPT_AUD_CNTRL_ST2 0xE50C0
4950 4950
4951#define VLV_HDMIW_HDMIEDID_A (VLV_DISPLAY_BASE + 0x62050)
4952#define VLV_HDMIW_HDMIEDID_B (VLV_DISPLAY_BASE + 0x62150)
4953#define VLV_HDMIW_HDMIEDID(pipe) _PIPE(pipe, \
4954 VLV_HDMIW_HDMIEDID_A, \
4955 VLV_HDMIW_HDMIEDID_B)
4956#define VLV_AUD_CNTL_ST_A (VLV_DISPLAY_BASE + 0x620B4)
4957#define VLV_AUD_CNTL_ST_B (VLV_DISPLAY_BASE + 0x621B4)
4958#define VLV_AUD_CNTL_ST(pipe) _PIPE(pipe, \
4959 VLV_AUD_CNTL_ST_A, \
4960 VLV_AUD_CNTL_ST_B)
4961#define VLV_AUD_CNTL_ST2 (VLV_DISPLAY_BASE + 0x620C0)
4962
4951/* These are the 4 32-bit write offset registers for each stream 4963/* These are the 4 32-bit write offset registers for each stream
4952 * output buffer. It determines the offset from the 4964 * output buffer. It determines the offset from the
4953 * 3DSTATE_SO_BUFFERs that the next streamed vertex output goes to. 4965 * 3DSTATE_SO_BUFFERs that the next streamed vertex output goes to.
@@ -4964,6 +4976,12 @@
4964#define CPT_AUD_CFG(pipe) _PIPE(pipe, \ 4976#define CPT_AUD_CFG(pipe) _PIPE(pipe, \
4965 CPT_AUD_CONFIG_A, \ 4977 CPT_AUD_CONFIG_A, \
4966 CPT_AUD_CONFIG_B) 4978 CPT_AUD_CONFIG_B)
4979#define VLV_AUD_CONFIG_A (VLV_DISPLAY_BASE + 0x62000)
4980#define VLV_AUD_CONFIG_B (VLV_DISPLAY_BASE + 0x62100)
4981#define VLV_AUD_CFG(pipe) _PIPE(pipe, \
4982 VLV_AUD_CONFIG_A, \
4983 VLV_AUD_CONFIG_B)
4984
4967#define AUD_CONFIG_N_VALUE_INDEX (1 << 29) 4985#define AUD_CONFIG_N_VALUE_INDEX (1 << 29)
4968#define AUD_CONFIG_N_PROG_ENABLE (1 << 28) 4986#define AUD_CONFIG_N_PROG_ENABLE (1 << 28)
4969#define AUD_CONFIG_UPPER_N_SHIFT 20 4987#define AUD_CONFIG_UPPER_N_SHIFT 20
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index f34252d134b6..e31a740e1663 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -6989,6 +6989,11 @@ static void ironlake_write_eld(struct drm_connector *connector,
6989 aud_config = IBX_AUD_CFG(pipe); 6989 aud_config = IBX_AUD_CFG(pipe);
6990 aud_cntl_st = IBX_AUD_CNTL_ST(pipe); 6990 aud_cntl_st = IBX_AUD_CNTL_ST(pipe);
6991 aud_cntrl_st2 = IBX_AUD_CNTL_ST2; 6991 aud_cntrl_st2 = IBX_AUD_CNTL_ST2;
6992 } else if (IS_VALLEYVIEW(connector->dev)) {
6993 hdmiw_hdmiedid = VLV_HDMIW_HDMIEDID(pipe);
6994 aud_config = VLV_AUD_CFG(pipe);
6995 aud_cntl_st = VLV_AUD_CNTL_ST(pipe);
6996 aud_cntrl_st2 = VLV_AUD_CNTL_ST2;
6992 } else { 6997 } else {
6993 hdmiw_hdmiedid = CPT_HDMIW_HDMIEDID(pipe); 6998 hdmiw_hdmiedid = CPT_HDMIW_HDMIEDID(pipe);
6994 aud_config = CPT_AUD_CFG(pipe); 6999 aud_config = CPT_AUD_CFG(pipe);
@@ -6998,8 +7003,19 @@ static void ironlake_write_eld(struct drm_connector *connector,
6998 7003
6999 DRM_DEBUG_DRIVER("ELD on pipe %c\n", pipe_name(pipe)); 7004 DRM_DEBUG_DRIVER("ELD on pipe %c\n", pipe_name(pipe));
7000 7005
7001 i = I915_READ(aud_cntl_st); 7006 if (IS_VALLEYVIEW(connector->dev)) {
7002 i = (i >> 29) & DIP_PORT_SEL_MASK; /* DIP_Port_Select, 0x1 = PortB */ 7007 struct intel_encoder *intel_encoder;
7008 struct intel_digital_port *intel_dig_port;
7009
7010 intel_encoder = intel_attached_encoder(connector);
7011 intel_dig_port = enc_to_dig_port(&intel_encoder->base);
7012 i = intel_dig_port->port;
7013 } else {
7014 i = I915_READ(aud_cntl_st);
7015 i = (i >> 29) & DIP_PORT_SEL_MASK;
7016 /* DIP_Port_Select, 0x1 = PortB */
7017 }
7018
7003 if (!i) { 7019 if (!i) {
7004 DRM_DEBUG_DRIVER("Audio directed to unknown port\n"); 7020 DRM_DEBUG_DRIVER("Audio directed to unknown port\n");
7005 /* operate blindly on all ports */ 7021 /* operate blindly on all ports */
@@ -10317,7 +10333,8 @@ static void intel_init_display(struct drm_device *dev)
10317 } 10333 }
10318 } else if (IS_G4X(dev)) { 10334 } else if (IS_G4X(dev)) {
10319 dev_priv->display.write_eld = g4x_write_eld; 10335 dev_priv->display.write_eld = g4x_write_eld;
10320 } 10336 } else if (IS_VALLEYVIEW(dev))
10337 dev_priv->display.write_eld = ironlake_write_eld;
10321 10338
10322 /* Default just returns -ENODEV to indicate unsupported */ 10339 /* Default just returns -ENODEV to indicate unsupported */
10323 dev_priv->display.queue_flip = intel_default_queue_flip; 10340 dev_priv->display.queue_flip = intel_default_queue_flip;