Skip to contentSkip to conversation

Haswell HDMI/DP audio enable

PATCH Superseded Wang Xingchao 3 participants 7 messages Aug 6, 2012 – Aug 7, 2012

Subsystems (2)

v4 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v4 cover Haswell HDMI/DP audio enable

This patch series enable HDMI audio on Haswell platform, not DP audio. The DP enablement will come after the DP patches are upstream.

I tested this patch on Sharkbay machine and i could hear clear sound from HDMI port.

V2 patches fixed one warning and some type errors.

V3 patches changes:
- change some registers definitions
- use macro for IBX/CPT/HSW to get registers
- remove some unused variable intended to use in TODO list.

v4 patches changes:
- remove alsa related hack patch

Here're some notes useful for you to test the patches on Sharkbay machine:
I> please make sure your branch include below three patches in Takashi's sound tree, othersiwe there's no proper Haswell ID and HDMI ID.
http://git.alsa-project.org/?p=alsa-kmirror.git;a=commitdiff;h=79fc901301d6115b11457e8240ed6abc4b3f5c65
http://git.alsa-project.org/?p=alsa-kmirror.git;a=commitdiff;h=e269cee227a2b2297b79bfc71094c709b9387061
http://git.alsa-project.org/?p=alsa-kmirror.git;a=commitdiff;h=cb192625233496ac3d96cce667ebf4e322dab678

II> No sound from HDMI/DP.
we found it's not stable in current stage, sometimes you may not heard sound from HDMI or DP port, but most of the time you can heard clear sound. After some investigation, we suspect the HDA verb didnot really make codec change,and we regard the GPU register as the right one. (see III explanation) the easy way is to use intel_audio_dump to compare related registers, and make sure the port is enabled and unmute, otherwise there's no sound. intel_audio_tools has no support on Haswell yet, i wrote patches to make that happen, if you need the patches, please feel free to let me know. Here's part of the snapshot about port enable and mute status from intel_audio_dump:

AUD_PORT_EN_HD_CFG  Port_B_Out_Enable			1
AUD_PORT_EN_HD_CFG  Port_C_Out_Enable			1
AUD_PORT_EN_HD_CFG  Port_D_Out_Enable			1
AUD_PORT_EN_HD_CFG  Port_B_Amp_Mute_Status		1
AUD_PORT_EN_HD_CFG  Port_C_Amp_Mute_Status		0
AUD_PORT_EN_HD_CFG  Port_D_Amp_Mute_Status		1

you can see from above message, the Port C is enabled and unmute, that's what we expect.

III> HDA Codec dependency. When you found there's no sound from HDMI, please use intel_audio_dump to check Port enable/mute status in II and also check related Pipe/Transcoder/DDI port status. Sometimes the pipe and transcoder was disabled in dpms and will not work anymore, that results in the HDMI port no sound. HDA codec's three converters are somehow hardwired to audio Pipes and if you choose the pipe, that means the regarding Codec converter should be enabled too, and only one digital Pin's HDA verbs could work, that depends on whehter your Pin select the converter as input. Here's one example about the Pipe/Transcoder/DDI port(Pipe B, DDI Port C):

DDI_BUF_CTL_A         0x00000080  DDI Buffer Controler A
DDI_BUF_CTL_B         0x00000000  DDI Buffer Controler B
DDI_BUF_CTL_C         0x80000000  DDI Buffer Controler C
DDI_BUF_CTL_D         0x00000000  DDI Buffer Controler D
DDI_BUF_CTL_E         0x80000002  DDI Buffer Controler E
PIPE_CONF_A           0xc0000000  PIPE Configuration A
PIPE_CONF_B           0xc0000000  PIPE Configuration B
PIPE_CONF_C           0x00000000  PIPE Configuration C
PIPE_CONF_EDP         0x00000000  PIPE Configuration EDP
PIPE_DDI_FUNC_CTL_A   0xc4034002  PIPE DDI Function Control A
PIPE_DDI_FUNC_CTL_B   0xa0035000  PIPE DDI Function Control B
PIPE_DDI_FUNC_CTL_C   0x00030000  PIPE DDI Function Control C
PIPE_DDI_FUNC_CTL_EDP 0x00030000  PIPE DDI Function Control EDP

Wang Xingchao (3):
drm/i915: HSW audio registers definition
drm/i915: write eld info for HDMI audio
drm/i915: Haswell HDMI audio enable

 drivers/gpu/drm/i915/i915_reg.h      |   76 ++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_ddi.c     |    6 ++-
 drivers/gpu/drm/i915/intel_display.c |   52 ++++++++++++++++++-----
 3 files changed, 123 insertions(+), 11 deletions(-)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH v4 1/3 drm/i915: HSW audio registers definition

Add hsw audio registers definition

---
 drivers/gpu/drm/i915/i915_reg.h |   48 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +48 -0
index 1310caa..ed87de9 100644
@@ -4277,6 +4277,54 @@
 #define   AUD_CONFIG_PIXEL_CLOCK_HDMI		(0xf << 16)
 #define   AUD_CONFIG_DISABLE_NCTS		(1 << 3)
 
+/* HSW Audio */
+#define   HSW_AUD_CONFIG_A		0x65000 /*Audio Configuration Transcoder A*/
+#define   HSW_AUD_CONFIG_B		0x65100 /*Audio Configuration Transcoder B*/
+#define   HSW_AUD_CFG(pipe) _PIPE(pipe, \
+					HSW_AUD_CONFIG_A, \
+					HSW_AUD_CONFIG_B)
+#define   HSW_AUD_MISC_CTRL_A		0x65010 /*Audio Misc Control Convert 1*/
+#define   HSW_AUD_MISC_CTRL_B		0x65110 /*Audio Misc Control Convert 2*/
+#define   HSW_AUD_MISC_CTRL(pipe) _PIPE(pipe, \
+					HSW_AUD_MISC_CTRL_A, \
+					HSW_AUD_MISC_CTRL_B)
+
+#define   HSW_AUD_DIP_ELD_CTRL_ST_A	0x650b4 /*Audio DIP and ELD Control State Transcoder A*/
+#define   HSW_AUD_DIP_ELD_CTRL_ST_B	0x651b4 /*Audio DIP and ELD Control State Transcoder B*/
+#define   HSW_AUD_DIP_ELD_CTRL(pipe) _PIPE(pipe, \
+					HSW_AUD_DIP_ELD_CTRL_ST_A, \
+					HSW_AUD_DIP_ELD_CTRL_ST_B)
+
+#define   HSW_AUD_PIPE_CONV_CFG		0x6507c /*Audio pipe and converter configs*/
+#define   HSW_AUD_PIN_ELD_CP_VL		0x650c0 /*Audio ELD and CP Ready Status*/
+#define   AUDIO_INACTIVE_C		(1<<11)
+#define   AUDIO_INACTIVE_B		(1<<7)
+#define   AUDIO_INACTIVE_A		(1<<3)
+#define   AUDIO_OUTPUT_ENABLE_A		(1<<2)
+#define   AUDIO_OUTPUT_ENABLE_B		(1<<6)
+#define   AUDIO_OUTPUT_ENABLE_C		(1<<10)
+#define   AUDIO_ELD_VALID_A		(1<<0)
+#define   AUDIO_ELD_VALID_B		(1<<4)
+#define   AUDIO_ELD_VALID_C		(1<<8)
+#define   AUDIO_CP_READY_A		(1<<1)
+#define   AUDIO_CP_READY_B		(1<<5)
+#define   AUDIO_CP_READY_C		(1<<9)
+
+/* Audio Digital Converter*/
+#define   HSW_AUD_DIG_CNVT_1		0x65080 /*Audio Converter 1*/
+#define   HSW_AUD_DIG_CNVT_2		0x65180 /*Audio Converter 1*/
+#define AUD_DIG_CNVT(pipe) _PIPE(pipe, \
+					HSW_AUD_DIG_CNVT_1, \
+					HSW_AUD_DIG_CNVT_2)
+
+#define   HSW_AUD_EDID_DATA		0x65050
+
+#define   TRANS_CONF_A			0xf0008
+#define   AUD_PB_UNSL_DEV_CP		0x65fb0
+#define   AUD_PC_UNSL_DEV_CP		0x65fb4
+#define   AUD_PD_UNSL_DEV_CP		0x65fb8
+
+
 /* HSW Power Wells */
 #define HSW_PWR_WELL_CTL1		0x45400		/* BIOS */
 #define HSW_PWR_WELL_CTL2		0x45404		/* Driver */
Signature · 1 line
1.7.9.5
#2 lore raw

Re: [PATCH v4 1/3] drm/i915: HSW audio registers definition

Hi

Comments inline:

2012/8/6 Wang Xingchao <[email protected]>:

Quoted 12 lines

Add hsw audio registers definition

---
 drivers/gpu/drm/i915/i915_reg.h |   48 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +0 -0
index 1310caa..ed87de9 100644

drivers/gpu/drm/i915/i915_reg.h line 4282

Quoted 6 lines
drivers/gpu/drm/i915/i915_reg.h +3 -0
@@ -4277,6 +4277,54 @@
 #define   AUD_CONFIG_PIXEL_CLOCK_HDMI          (0xf << 16)
 #define   AUD_CONFIG_DISABLE_NCTS              (1 << 3)
 
+/* HSW Audio */
+#define   HSW_AUD_CONFIG_A             0x65000 /*Audio Configuration Transcoder A*/
+#define   HSW_AUD_CONFIG_B             0x65100 /*Audio Configuration Transcoder B*/

We usually use /* Comment */ instead of /*Comment*/... There are more comments like this below.

Quoted 30 lines
drivers/gpu/drm/i915/i915_reg.h +30 -0
+#define   HSW_AUD_CFG(pipe) _PIPE(pipe, \
+                                       HSW_AUD_CONFIG_A, \
+                                       HSW_AUD_CONFIG_B)
+#define   HSW_AUD_MISC_CTRL_A          0x65010 /*Audio Misc Control Convert 1*/
+#define   HSW_AUD_MISC_CTRL_B          0x65110 /*Audio Misc Control Convert 2*/
+#define   HSW_AUD_MISC_CTRL(pipe) _PIPE(pipe, \
+                                       HSW_AUD_MISC_CTRL_A, \
+                                       HSW_AUD_MISC_CTRL_B)
+
+#define   HSW_AUD_DIP_ELD_CTRL_ST_A    0x650b4 /*Audio DIP and ELD Control State Transcoder A*/
+#define   HSW_AUD_DIP_ELD_CTRL_ST_B    0x651b4 /*Audio DIP and ELD Control State Transcoder B*/
+#define   HSW_AUD_DIP_ELD_CTRL(pipe) _PIPE(pipe, \
+                                       HSW_AUD_DIP_ELD_CTRL_ST_A, \
+                                       HSW_AUD_DIP_ELD_CTRL_ST_B)
+
+#define   HSW_AUD_PIPE_CONV_CFG                0x6507c /*Audio pipe and converter configs*/
+#define   HSW_AUD_PIN_ELD_CP_VL                0x650c0 /*Audio ELD and CP Ready Status*/
+#define   AUDIO_INACTIVE_C             (1<<11)
+#define   AUDIO_INACTIVE_B             (1<<7)
+#define   AUDIO_INACTIVE_A             (1<<3)
+#define   AUDIO_OUTPUT_ENABLE_A                (1<<2)
+#define   AUDIO_OUTPUT_ENABLE_B                (1<<6)
+#define   AUDIO_OUTPUT_ENABLE_C                (1<<10)
+#define   AUDIO_ELD_VALID_A            (1<<0)
+#define   AUDIO_ELD_VALID_B            (1<<4)
+#define   AUDIO_ELD_VALID_C            (1<<8)
+#define   AUDIO_CP_READY_A             (1<<1)
+#define   AUDIO_CP_READY_B             (1<<5)
+#define   AUDIO_CP_READY_C             (1<<9)
+

drivers/gpu/drm/i915/i915_reg.h line 4322

Quoted 10 lines
drivers/gpu/drm/i915/i915_reg.h +10 -0
+/* Audio Digital Converter*/
+#define   HSW_AUD_DIG_CNVT_1           0x65080 /*Audio Converter 1*/
+#define   HSW_AUD_DIG_CNVT_2           0x65180 /*Audio Converter 1*/
+#define AUD_DIG_CNVT(pipe) _PIPE(pipe, \
+                                       HSW_AUD_DIG_CNVT_1, \
+                                       HSW_AUD_DIG_CNVT_2)
+
+#define   HSW_AUD_EDID_DATA            0x65050
+
+#define   TRANS_CONF_A                 0xf0008

This is unused by your patch series now. In fact, it's even defined elsewhere.

Quoted 15 lines
drivers/gpu/drm/i915/i915_reg.h +5 -1
+#define   AUD_PB_UNSL_DEV_CP           0x65fb0
+#define   AUD_PC_UNSL_DEV_CP           0x65fb4
+#define   AUD_PD_UNSL_DEV_CP           0x65fb8
+
+
 /* HSW Power Wells */
 #define HSW_PWR_WELL_CTL1              0x45400         /* BIOS */
 #define HSW_PWR_WELL_CTL2              0x45404         /* Driver */
--

1.7.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 1 line
Paulo Zanoni
#3 lore raw

PATCH v4 2/3 drm/i915: write eld info for HDMI audio

In reply to Wang Xingchao

HDMI audio related registers will be configured in write_eld callback.

---
 drivers/gpu/drm/i915/intel_ddi.c |    6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_ddi.c +5 -1
index 32604ac..4c12371 100644
@@ -718,8 +718,12 @@ void intel_ddi_mode_set(struct drm_encoder *encoder,
 		/* Proper support for digital audio needs a new logic and a new set
 		 * of registers, so we leave it for future patch bombing.
 		 */
-		DRM_DEBUG_DRIVER("HDMI audio on pipe %c not yet supported on DDI\n",
+		DRM_DEBUG_DRIVER("HDMI audio on pipe %c on DDI\n",
 				 pipe_name(intel_crtc->pipe));
+
+		/* write eld */
+		DRM_DEBUG_DRIVER("HDMI audio: write eld information\n");
+		intel_write_eld(encoder, adjusted_mode);
 	}
 
 	/* Enable PIPE_DDI_FUNC_CTL for the pipe to work in HDMI mode */
Signature · 1 line
1.7.9.5
#4 lore raw

PATCH v4 3/3 drm/i915: Haswell HDMI audio enable

In reply to Wang Xingchao

Configure the related HDMI audio register to generate an unsolicited response to the audio controller driver to indicate that the controller sequence should start.

Use "pipe" way to get correct register definitions for IBX/CPT/HSW.

---
 drivers/gpu/drm/i915/i915_reg.h      |   32 +++++++++++++++++++--
 drivers/gpu/drm/i915/intel_display.c |   52 +++++++++++++++++++++++++++-------
 2 files changed, 72 insertions(+), 12 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +30 -2
index ed87de9..9588dd4 100644
@@ -4247,7 +4247,15 @@
 #define G4X_HDMIW_HDMIEDID		0x6210C
 
 #define IBX_HDMIW_HDMIEDID_A		0xE2050
+#define IBX_HDMIW_HDMIEDID_B		0xE2150
+#define IBX_HDMIW_HDMIEDID(pipe) _PIPE(pipe, \
+					IBX_HDMIW_HDMIEDID_A, \
+					IBX_HDMIW_HDMIEDID_B)
 #define IBX_AUD_CNTL_ST_A		0xE20B4
+#define IBX_AUD_CNTL_ST_B		0xE21B4
+#define IBX_AUD_CNTL_ST(pipe) _PIPE(pipe, \
+					IBX_AUD_CNTL_ST_A, \
+					IBX_AUD_CNTL_ST_B)
 #define IBX_ELD_BUFFER_SIZE		(0x1f << 10)
 #define IBX_ELD_ADDRESS			(0x1f << 5)
 #define IBX_ELD_ACK			(1 << 4)
@@ -4256,7 +4264,15 @@
 #define IBX_CP_READYB			(1 << 1)
 
 #define CPT_HDMIW_HDMIEDID_A		0xE5050
+#define CPT_HDMIW_HDMIEDID_B		0xE5150
+#define CPT_HDMIW_HDMIEDID(pipe) _PIPE(pipe, \
+					CPT_HDMIW_HDMIEDID_A, \
+					CPT_HDMIW_HDMIEDID_B)
 #define CPT_AUD_CNTL_ST_A		0xE50B4
+#define CPT_AUD_CNTL_ST_B		0xE51B4
+#define CPT_AUD_CNTL_ST(pipe) _PIPE(pipe, \
+					CPT_AUD_CNTL_ST_A, \
+					CPT_AUD_CNTL_ST_B)
 #define CPT_AUD_CNTRL_ST2		0xE50C0
 
 /* These are the 4 32-bit write offset registers for each stream
@@ -4266,7 +4282,15 @@
 #define GEN7_SO_WRITE_OFFSET(n)		(0x5280 + (n) * 4)
 
 #define IBX_AUD_CONFIG_A			0xe2000
+#define IBX_AUD_CONFIG_B			0xe2100
+#define IBX_AUD_CFG(pipe) _PIPE(pipe, \
+					IBX_AUD_CONFIG_A, \
+					IBX_AUD_CONFIG_B)
 #define CPT_AUD_CONFIG_A			0xe5000
+#define CPT_AUD_CONFIG_B			0xe5100
+#define CPT_AUD_CFG(pipe) _PIPE(pipe, \
+					CPT_AUD_CONFIG_A, \
+					CPT_AUD_CONFIG_B)
 #define   AUD_CONFIG_N_VALUE_INDEX		(1 << 29)
 #define   AUD_CONFIG_N_PROG_ENABLE		(1 << 28)
 #define   AUD_CONFIG_UPPER_N_SHIFT		20
@@ -4296,7 +4320,7 @@
 					HSW_AUD_DIP_ELD_CTRL_ST_B)
 
 #define   HSW_AUD_PIPE_CONV_CFG		0x6507c /*Audio pipe and converter configs*/
-#define   HSW_AUD_PIN_ELD_CP_VL		0x650c0 /*Audio ELD and CP Ready Status*/
+#define   HSW_AUD_PIN_ELD_CP_VLD	0x650c0 /*Audio ELD and CP Ready Status*/
 #define   AUDIO_INACTIVE_C		(1<<11)
 #define   AUDIO_INACTIVE_B		(1<<7)
 #define   AUDIO_INACTIVE_A		(1<<3)
@@ -4317,7 +4341,11 @@
 					HSW_AUD_DIG_CNVT_1, \
 					HSW_AUD_DIG_CNVT_2)
 
-#define   HSW_AUD_EDID_DATA		0x65050
+#define   HSW_AUD_EDID_DATA_A		0x65050
+#define   HSW_AUD_EDID_DATA_B		0x65150
+#define HSW_AUD_EDID_DATA(pipe) _PIPE(pipe, \
+					HSW_AUD_EDID_DATA_A, \
+					HSW_AUD_EDID_DATA_B)
 
 #define   TRANS_CONF_A			0xf0008
 #define   AUD_PB_UNSL_DEV_CP		0x65fb0
drivers/gpu/drm/i915/intel_display.c +42 -10

77 lines not on this page · raw message

Signature · 1 line
1.7.9.5
#5 lore raw

Re: [PATCH v4 3/3] drm/i915: Haswell HDMI audio enable

Hi

2012/8/6 Wang Xingchao <[email protected]>:

Quoted 5 lines

Configure the related HDMI audio register to generate an unsolicited response to the audio controller driver to indicate that the controller sequence should start.

Use "pipe" way to get correct register definitions for IBX/CPT/HSW.

Please split this patch in 2: one that just converts the IBX/CPT into the PIPE macro, and another that adds the HSW regs.

Thanks,
Paulo

Quoted 172 lines
---
 drivers/gpu/drm/i915/i915_reg.h      |   32 +++++++++++++++++++--
 drivers/gpu/drm/i915/intel_display.c |   52 +++++++++++++++++++++++++++-------
 2 files changed, 72 insertions(+), 12 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +30 -2
index ed87de9..9588dd4 100644
@@ -4247,7 +4247,15 @@
 #define G4X_HDMIW_HDMIEDID             0x6210C
 
 #define IBX_HDMIW_HDMIEDID_A           0xE2050
+#define IBX_HDMIW_HDMIEDID_B           0xE2150
+#define IBX_HDMIW_HDMIEDID(pipe) _PIPE(pipe, \
+                                       IBX_HDMIW_HDMIEDID_A, \
+                                       IBX_HDMIW_HDMIEDID_B)
 #define IBX_AUD_CNTL_ST_A              0xE20B4
+#define IBX_AUD_CNTL_ST_B              0xE21B4
+#define IBX_AUD_CNTL_ST(pipe) _PIPE(pipe, \
+                                       IBX_AUD_CNTL_ST_A, \
+                                       IBX_AUD_CNTL_ST_B)
 #define IBX_ELD_BUFFER_SIZE            (0x1f << 10)
 #define IBX_ELD_ADDRESS                        (0x1f << 5)
 #define IBX_ELD_ACK                    (1 << 4)
@@ -4256,7 +4264,15 @@
 #define IBX_CP_READYB                  (1 << 1)
 
 #define CPT_HDMIW_HDMIEDID_A           0xE5050
+#define CPT_HDMIW_HDMIEDID_B           0xE5150
+#define CPT_HDMIW_HDMIEDID(pipe) _PIPE(pipe, \
+                                       CPT_HDMIW_HDMIEDID_A, \
+                                       CPT_HDMIW_HDMIEDID_B)
 #define CPT_AUD_CNTL_ST_A              0xE50B4
+#define CPT_AUD_CNTL_ST_B              0xE51B4
+#define CPT_AUD_CNTL_ST(pipe) _PIPE(pipe, \
+                                       CPT_AUD_CNTL_ST_A, \
+                                       CPT_AUD_CNTL_ST_B)
 #define CPT_AUD_CNTRL_ST2              0xE50C0
 
 /* These are the 4 32-bit write offset registers for each stream
@@ -4266,7 +4282,15 @@
 #define GEN7_SO_WRITE_OFFSET(n)                (0x5280 + (n) * 4)
 
 #define IBX_AUD_CONFIG_A                       0xe2000
+#define IBX_AUD_CONFIG_B                       0xe2100
+#define IBX_AUD_CFG(pipe) _PIPE(pipe, \
+                                       IBX_AUD_CONFIG_A, \
+                                       IBX_AUD_CONFIG_B)
 #define CPT_AUD_CONFIG_A                       0xe5000
+#define CPT_AUD_CONFIG_B                       0xe5100
+#define CPT_AUD_CFG(pipe) _PIPE(pipe, \
+                                       CPT_AUD_CONFIG_A, \
+                                       CPT_AUD_CONFIG_B)
 #define   AUD_CONFIG_N_VALUE_INDEX             (1 << 29)
 #define   AUD_CONFIG_N_PROG_ENABLE             (1 << 28)
 #define   AUD_CONFIG_UPPER_N_SHIFT             20
@@ -4296,7 +4320,7 @@
                                        HSW_AUD_DIP_ELD_CTRL_ST_B)
 
 #define   HSW_AUD_PIPE_CONV_CFG                0x6507c /*Audio pipe and converter configs*/
-#define   HSW_AUD_PIN_ELD_CP_VL                0x650c0 /*Audio ELD and CP Ready Status*/
+#define   HSW_AUD_PIN_ELD_CP_VLD       0x650c0 /*Audio ELD and CP Ready Status*/
 #define   AUDIO_INACTIVE_C             (1<<11)
 #define   AUDIO_INACTIVE_B             (1<<7)
 #define   AUDIO_INACTIVE_A             (1<<3)
@@ -4317,7 +4341,11 @@
                                        HSW_AUD_DIG_CNVT_1, \
                                        HSW_AUD_DIG_CNVT_2)
 
-#define   HSW_AUD_EDID_DATA            0x65050
+#define   HSW_AUD_EDID_DATA_A          0x65050
+#define   HSW_AUD_EDID_DATA_B          0x65150
+#define HSW_AUD_EDID_DATA(pipe) _PIPE(pipe, \
+                                       HSW_AUD_EDID_DATA_A, \
+                                       HSW_AUD_EDID_DATA_B)
 
 #define   TRANS_CONF_A                 0xf0008
 #define   AUD_PB_UNSL_DEV_CP           0x65fb0
drivers/gpu/drm/i915/intel_display.c +42 -11
index 17020cd..103de56 100644
@@ -5071,6 +5071,7 @@ static void ironlake_write_eld(struct drm_connector *connector,
                                     struct drm_crtc *crtc)
 {
        struct drm_i915_private *dev_priv = connector->dev->dev_private;
+       struct drm_device *dev = crtc->dev;
        uint8_t *eld = connector->eld;
        uint32_t eldv;
        uint32_t i;
@@ -5079,23 +5080,52 @@ static void ironlake_write_eld(struct drm_connector *connector,
        int aud_config;
        int aud_cntl_st;
        int aud_cntrl_st2;
+       int pipe = to_intel_crtc(crtc)->pipe;
 
        if (HAS_PCH_IBX(connector->dev)) {
-               hdmiw_hdmiedid = IBX_HDMIW_HDMIEDID_A;
-               aud_config = IBX_AUD_CONFIG_A;
-               aud_cntl_st = IBX_AUD_CNTL_ST_A;
+               hdmiw_hdmiedid = IBX_HDMIW_HDMIEDID(pipe);
+               aud_config = IBX_AUD_CFG(pipe);
+               aud_cntl_st = IBX_AUD_CNTL_ST(pipe);
                aud_cntrl_st2 = IBX_AUD_CNTL_ST2;
+       } else if (IS_HASWELL(dev)) {
+               hdmiw_hdmiedid = HSW_AUD_EDID_DATA(pipe);
+               aud_cntl_st = HSW_AUD_DIP_ELD_CTRL(pipe);
+               aud_config = HSW_AUD_CFG(pipe);
+               aud_cntrl_st2 = HSW_AUD_PIN_ELD_CP_VLD;
        } else {
-               hdmiw_hdmiedid = CPT_HDMIW_HDMIEDID_A;
-               aud_config = CPT_AUD_CONFIG_A;
-               aud_cntl_st = CPT_AUD_CNTL_ST_A;
+               hdmiw_hdmiedid = CPT_HDMIW_HDMIEDID(pipe);
+               aud_config = CPT_AUD_CFG(pipe);
+               aud_cntl_st = CPT_AUD_CNTL_ST(pipe);
                aud_cntrl_st2 = CPT_AUD_CNTRL_ST2;
        }
 
-       i = to_intel_crtc(crtc)->pipe;
-       hdmiw_hdmiedid += i * 0x100;
-       aud_cntl_st += i * 0x100;
-       aud_config += i * 0x100;
+       if (IS_HASWELL(dev)) {
+               int tmp;
+               int aud_vld = HSW_AUD_PIN_ELD_CP_VLD;
+
+               DRM_DEBUG_DRIVER("HDMI: Haswell Audio initialize....\n");
+
+               /* Audio output enable */
+               DRM_DEBUG_DRIVER("HDMI audio: enable codec\n");
+               tmp = I915_READ(aud_vld);
+               tmp |= (AUDIO_OUTPUT_ENABLE_A | AUDIO_OUTPUT_ENABLE_B | AUDIO_OUTPUT_ENABLE_C);
+               I915_WRITE(aud_vld, tmp);
+
+               /* Set ELD valid state */
+               tmp = I915_READ(aud_vld);
+               DRM_DEBUG_DRIVER("HDMI audio: pin eld vld status=0x%8x\n", tmp);
+               tmp |= (AUDIO_ELD_VALID_A | AUDIO_ELD_VALID_B | AUDIO_ELD_VALID_C);
+               I915_WRITE(aud_vld, tmp);
+               tmp = I915_READ(aud_vld);
+               DRM_DEBUG_DRIVER("HDMI audio: eld vld status=0x%8x\n", tmp);
+
+               /* Enable HDMI mode */
+               tmp = I915_READ(aud_config);
+               DRM_DEBUG_DRIVER("HDMI audio: audio conf: 0x%8x\n", tmp);
+               /* clear N_programing_enable and N_value_index */
+               tmp &= ~(AUD_CONFIG_N_VALUE_INDEX | AUD_CONFIG_N_PROG_ENABLE);
+               I915_WRITE(aud_config, tmp);
+       }
 
        DRM_DEBUG_DRIVER("ELD on pipe %c\n", pipe_name(i));
 
@@ -5135,6 +5165,8 @@ static void ironlake_write_eld(struct drm_connector *connector,
        i = I915_READ(aud_cntl_st);
        i &= ~IBX_ELD_ADDRESS;
        I915_WRITE(aud_cntl_st, i);
+       i = (i >> 29) & 0x3;            /* DIP_Port_Select, 0x1 = PortB */
+       DRM_DEBUG_DRIVER("port num:%d\n", i);
 
        len = min_t(uint8_t, eld[2], 21);       /* 84 bytes of hw ELD buffer */
        DRM_DEBUG_DRIVER("ELD size %d\n", len);
--

1.7.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

Signature · 1 line
Paulo Zanoni
#6 lore raw
In reply to Wang Xingchao

At Mon, 6 Aug 2012 18:43:57 +0800,

Quoted 17 lines · Wang Xingchao

This patch series enable HDMI audio on Haswell platform, not DP audio. The DP enablement will come after the DP patches are upstream.

I tested this patch on Sharkbay machine and i could hear clear sound from HDMI port.

V2 patches fixed one warning and some type errors.

V3 patches changes:
- change some registers definitions
- use macro for IBX/CPT/HSW to get registers
- remove some unused variable intended to use in TODO list.

v4 patches changes:
- remove alsa related hack patch

Quoted 6 lines

Here're some notes useful for you to test the patches on Sharkbay machine:
I> please make sure your branch include below three patches in Takashi's sound tree, othersiwe there's no proper Haswell ID and HDMI ID.
http://git.alsa-project.org/?p=alsa-kmirror.git;a=commitdiff;h=79fc901301d6115b11457e8240ed6abc4b3f5c65
http://git.alsa-project.org/?p=alsa-kmirror.git;a=commitdiff;h=e269cee227a2b2297b79bfc71094c709b9387061
http://git.alsa-project.org/?p=alsa-kmirror.git;a=commitdiff;h=cb192625233496ac3d96cce667ebf4e322dab678

Well, alsa-kmirror is not my tree. Please avoid using it. It's no kernel tree, thus the commit ids are different from the upstream (they have been cherry-picked).

For the upstream tree, please refer to sound git tree

git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git

You can just pull for-linus branch.
The all commits above are found in 3.6-rc1.

e926f2c850c472f813f9bab486c68a3fe0b03ae4
1c76684d2752b3a24bb7da183cc18e5d126dbcc9
bdbe34dece4942f4d8df9865dba7785bb813366a

thanks,

Takashi

Quoted 64 lines

II> No sound from HDMI/DP.
we found it's not stable in current stage, sometimes you may not heard sound from HDMI or DP port, but most of the time you can heard clear sound. After some investigation, we suspect the HDA verb didnot really make codec change,and we regard the GPU register as the right one. (see III explanation) the easy way is to use intel_audio_dump to compare related registers, and make sure the port is enabled and unmute, otherwise there's no sound. intel_audio_tools has no support on Haswell yet, i wrote patches to make that happen, if you need the patches, please feel free to let me know. Here's part of the snapshot about port enable and mute status from intel_audio_dump:

AUD_PORT_EN_HD_CFG  Port_B_Out_Enable			1
AUD_PORT_EN_HD_CFG  Port_C_Out_Enable			1
AUD_PORT_EN_HD_CFG  Port_D_Out_Enable			1
AUD_PORT_EN_HD_CFG  Port_B_Amp_Mute_Status		1
AUD_PORT_EN_HD_CFG  Port_C_Amp_Mute_Status		0
AUD_PORT_EN_HD_CFG  Port_D_Amp_Mute_Status		1

you can see from above message, the Port C is enabled and unmute, that's what we expect.

III> HDA Codec dependency. When you found there's no sound from HDMI, please use intel_audio_dump to check Port enable/mute status in II and also check related Pipe/Transcoder/DDI port status. Sometimes the pipe and transcoder was disabled in dpms and will not work anymore, that results in the HDMI port no sound. HDA codec's three converters are somehow hardwired to audio Pipes and if you choose the pipe, that means the regarding Codec converter should be enabled too, and only one digital Pin's HDA verbs could work, that depends on whehter your Pin select the converter as input. Here's one example about the Pipe/Transcoder/DDI port(Pipe B, DDI Port C):

DDI_BUF_CTL_A         0x00000080  DDI Buffer Controler A
DDI_BUF_CTL_B         0x00000000  DDI Buffer Controler B
DDI_BUF_CTL_C         0x80000000  DDI Buffer Controler C
DDI_BUF_CTL_D         0x00000000  DDI Buffer Controler D
DDI_BUF_CTL_E         0x80000002  DDI Buffer Controler E
PIPE_CONF_A           0xc0000000  PIPE Configuration A
PIPE_CONF_B           0xc0000000  PIPE Configuration B
PIPE_CONF_C           0x00000000  PIPE Configuration C
PIPE_CONF_EDP         0x00000000  PIPE Configuration EDP
PIPE_DDI_FUNC_CTL_A   0xc4034002  PIPE DDI Function Control A
PIPE_DDI_FUNC_CTL_B   0xa0035000  PIPE DDI Function Control B
PIPE_DDI_FUNC_CTL_C   0x00030000  PIPE DDI Function Control C
PIPE_DDI_FUNC_CTL_EDP 0x00030000  PIPE DDI Function Control EDP

Wang Xingchao (3):
drm/i915: HSW audio registers definition
drm/i915: write eld info for HDMI audio
drm/i915: Haswell HDMI audio enable

 drivers/gpu/drm/i915/i915_reg.h      |   76 ++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_ddi.c     |    6 ++-
 drivers/gpu/drm/i915/intel_display.c |   52 ++++++++++++++++++-----
 3 files changed, 123 insertions(+), 11 deletions(-)
Signature · 6 lines
1.7.9.5

_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx