Skip to contentSkip to conversation

patch for INTEL HDMI codec

ANNOUNCE Wu Fengguang 2 participants 6 messages Oct 28, 2008 – Oct 29, 2008 Sound

lore
Share & tools
lore
#0 lore raw

Hello,

We have recently enabled sound output for Intel HDMI codecs, and would like to share the good news and some early code :-)

The audio enabling code includes both ALSA and X.Org patches. Attached is one single patch against today's sound-2.6 tree. It contains very basic code for handling
- audio infoframe
- ELD(E-EDID Like Data)
- unsolicited response

The patch is full enough to produce stereo sound via HDMI.
But it still lacks features and contains many 'defined but unused' staffs.

It was tested OK on ASUS P5E-VM board and HP 2230s notebook. It _should_ also work on Intel DG45ID board.

Takashi, I can prepare a trimmed-down patch series, in doing so I'd like to know if you are interested in the basic DIP/ELD/UNSOL routines? Or should I only submit bare code comparable to the current patch_atihdmi.c?

Thank you,
Fengguang
---

PS: the patch can now produce the following ELD information:

[10340.656719] eldv = 1, pinp = 1
[10340.660711] ELD buffer size  is 64
[10340.660716] ELD baseline len is 10*4
[10340.660720] vendor block len is 20
[10340.660724] ELD version      is CEA-861D or below
[10340.660728] CEA-EDID version is CEA-861-B, C or D
[10340.660732] manufacture name is 0x4544
[10340.660736] product code     is 0xa02c
[10340.660740] port id          is 0x0
[10340.660743] HDCP support     is 0
[10340.660747] AI support       is 0
[10340.660751] SAD count        is 0
[10340.660754] audio sync delay is 0
[10340.660758] connection type  is HDMI
[10340.660763] speaker allocations:
[10340.660766] monitor name     is DELL 2408WFP
sound/pci/hda/hda_patch.h +2 -0
@@ -20,3 +20,5 @@ extern struct hda_codec_preset snd_hda_p
 extern struct hda_codec_preset snd_hda_preset_via[];
 /* NVIDIA HDMI codecs */
 extern struct hda_codec_preset snd_hda_preset_nvhdmi[];
+/* INTEL HDMI codecs */
+extern struct hda_codec_preset snd_hda_preset_intelhdmi[];
sound/pci/hda/Makefile +1 -0
@@ -16,5 +16,6 @@ snd-hda-intel-$(CONFIG_SND_HDA_CODEC_ATI
 snd-hda-intel-$(CONFIG_SND_HDA_CODEC_CONEXANT) += patch_conexant.o
 snd-hda-intel-$(CONFIG_SND_HDA_CODEC_VIA) += patch_via.o
 snd-hda-intel-$(CONFIG_SND_HDA_CODEC_NVHDMI) += patch_nvhdmi.o
+snd-hda-intel-$(CONFIG_SND_HDA_CODEC_INTELHDMI) += patch_intelhdmi.o
 
 obj-$(CONFIG_SND_HDA_INTEL) += snd-hda-intel.o
sound/pci/Kconfig +8 -0
@@ -574,6 +574,14 @@ config SND_HDA_CODEC_NVHDMI
 	  Say Y here to include NVIDIA HDMI HD-audio codec support in
 	  snd-hda-intel driver, such as NVIDIA MCP78 HDMI.
 
+config SND_HDA_CODEC_INTELHDMI
+	bool "Build INTEL HDMI HD-audio codec support"
+	depends on SND_HDA_INTEL
+	default y
+	help
+	  Say Y here to include INTEL HDMI HD-audio codec support in
+	  snd-hda-intel driver, such as Eaglelake integrated HDMI.
+
 config SND_HDA_CODEC_CONEXANT
 	bool "Build Conexant HD-audio codec support"
 	depends on SND_HDA_INTEL
sound/pci/hda/hda_codec.c +3 -0
@@ -97,6 +97,9 @@ static const struct hda_codec_preset *hd
 #ifdef CONFIG_SND_HDA_CODEC_NVHDMI
 	snd_hda_preset_nvhdmi,
 #endif
+#ifdef CONFIG_SND_HDA_CODEC_INTELHDMI
+	snd_hda_preset_intelhdmi,
+#endif
 	NULL
 };
 
sound/pci/hda/patch_intelhdmi.c new file +930 -0

930 lines not on this page · raw message

sound/pci/hda/hda_codec.h +4 -0
@@ -380,6 +380,10 @@ enum {
 #define AC_ELDD_ELD_VALID		(1<<31)
 #define AC_ELDD_ELD_DATA		0xff
 
+/* HDMI ELD version */
+#define AC_ELDD_ELD_VER_CEA_861D	(0x02)
+#define AC_ELDD_ELD_VER_PARTIAL 	(0x1f)
+
 /* HDMI DIP size */
 #define AC_DIPSIZE_ELD_BUF		(1<<3) /* ELD buf size of packet size */
 #define AC_DIPSIZE_PACK_IDX		(0x07<<0) /* packet index */
sound/pci/hda/patch_atihdmi.c +0 -1
@@ -193,7 +193,6 @@ struct hda_codec_preset snd_hda_preset_a
 	{ .id = 0x1002791a, .name = "ATI RS690/780 HDMI", .patch = patch_atihdmi },
 	{ .id = 0x1002aa01, .name = "ATI R6xx HDMI", .patch = patch_atihdmi },
 	{ .id = 0x10951390, .name = "SiI1390 HDMI", .patch = patch_atihdmi },
-	{ .id = 0x10951392, .name = "SiI1392 HDMI", .patch = patch_atihdmi },
 	{ .id = 0x17e80047, .name = "Chrontel HDMI",  .patch = patch_atihdmi },
 	{} /* terminator */
 };
sound/pci/hda/hda_intel.c +1 -1
@@ -1196,7 +1196,7 @@ static unsigned int azx_max_codecs[AZX_N
  * report wrongly the non-existing 4th slot availability
  */
 static unsigned int azx_default_codecs[AZX_NUM_DRIVERS] __devinitdata = {
-	[AZX_DRIVER_ICH] = 3,
+	[AZX_DRIVER_ICH] = 4,
 	[AZX_DRIVER_ATI] = 3,
 };
 

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#1 lore raw

At Tue, 28 Oct 2008 16:07:39 +0800,

Quoted 5 lines · Wu Fengguang

Hello,

We have recently enabled sound output for Intel HDMI codecs, and would like to share the good news and some early code :-)

Great!

Quoted 9 lines

The audio enabling code includes both ALSA and X.Org patches. Attached is one single patch against today's sound-2.6 tree. It contains very basic code for handling
- audio infoframe
- ELD(E-EDID Like Data)
- unsolicited response

The patch is full enough to produce stereo sound via HDMI.
But it still lacks features and contains many 'defined but unused' staffs.

Yeah I see.

Quoted 2 lines

It was tested OK on ASUS P5E-VM board and HP 2230s notebook. It _should_ also work on Intel DG45ID board.

Does the ALSA patch work alone without changes in x.org side?

Quoted 2 lines

Takashi, I can prepare a trimmed-down patch series, in doing so I'd like to know if you are interested in the basic DIP/ELD/UNSOL routines?

Yes. I wanted to write it by myself, but forgot for long time since I have no HDMI hardware for testing :)
Good to see someone finally adding it!

Quoted 1 line

Or should I only submit bare code comparable to the current patch_atihdmi.c?

If the codec is supposed to be (almost) compatible, it'd be a good idea. Otherwise (if you are uncertain), we can keep it separated as your original patch. I don't mind much about it.

And, maybe we'll need to move EDID handling to the common place, anyway.

Quoted 19 lines

PS: the patch can now produce the following ELD information:

[10340.656719] eldv = 1, pinp = 1
[10340.660711] ELD buffer size  is 64
[10340.660716] ELD baseline len is 10*4
[10340.660720] vendor block len is 20
[10340.660724] ELD version      is CEA-861D or below
[10340.660728] CEA-EDID version is CEA-861-B, C or D
[10340.660732] manufacture name is 0x4544
[10340.660736] product code     is 0xa02c
[10340.660740] port id          is 0x0
[10340.660743] HDCP support     is 0
[10340.660747] AI support       is 0
[10340.660751] SAD count        is 0
[10340.660754] audio sync delay is 0
[10340.660758] connection type  is HDMI
[10340.660763] speaker allocations:
[10340.660766] monitor name     is DELL 2408WFP

Looks good.

Quoted 2 lines
sound/pci/hda/patch_intelhdmi.c new file +0 -0

(snip)

sound/pci/hda/patch_intelhdmi.c line 77

Quoted 3 lines
sound/pci/hda/patch_intelhdmi.c new file +3 -0
+struct ELD_fixed_fields {
+	__u8 rsv_0		:3;
+	__u8 ELD_ver		:5;

We should avoid bitfields if it's used for communication with the hardware in general for portability reason. Simply take it as bytes, and use normal bit shift ops.

Also, no reason to use "__" prefix there.

sound/pci/hda/patch_intelhdmi.c line 432

Quoted 3 lines
sound/pci/hda/patch_intelhdmi.c new file +3 -0
+static void hdmi_debug_slot_mapping(struct hda_codec *codec)
+{
+#ifdef CONFIG_SND_DEBUG

I'd use CONFIG_SND_DEBUG_VERBOSE here. Most distros turn on CONFIG_SND_DEBUG=y, and this will be annoying.

Quoted 4 lines
sound/pci/hda/patch_intelhdmi.c new file +4 -0
+	int i;
+	int slot;
+
+	for (i = 0; i < 8; i++) {

sound/pci/hda/patch_intelhdmi.c line 463

Quoted 10 lines
sound/pci/hda/patch_intelhdmi.c new file +10 -0
+		slot = snd_hda_codec_read(codec, CVT_NID, 0,
+						AC_VERB_GET_HDMI_CHAN_SLOT, i);
+		printk(KERN_DEBUG "ASP channel %d => slot %d\n",
+				slot >> 4, slot & 0x7);
+	}
+#endif
+}
+static void hdmi_debug_present_sense(struct hda_codec *codec)
+{
+#ifdef CONFIG_SND_DEBUG

Ditto.

Quoted 12 lines
sound/pci/hda/patch_intelhdmi.c new file +12 -0
+static int hdmi_get_eldd(struct hda_codec *codec, char **eldd)
+{
+	int i;
+	int size;
+	char *buf;
+
+	i = hdmi_present_sense(codec) & AC_PINSENSE_ELDV;
+	if (!i)
+		return 0;
+
+	size = snd_hda_codec_read(codec, PIN_NID, 0, AC_VERB_GET_HDMI_DIP_SIZE,
+						     AC_DIPSIZE_ELD_BUF);

sound/pci/hda/patch_intelhdmi.c line 512

Quoted 10 lines
sound/pci/hda/patch_intelhdmi.c new file +10 -0
+	if (size == 0) {
+		/* wfg: workaround for ASUS P5E-VM HDMI board */
+		snd_printk(KERN_INFO "ELD buf size is 0, force 64\n");
+		size = 64;
+	}
+	if (size < sizeof(struct ELD_fixed_fields)) {
+		snd_printk(KERN_WARNING "Invalid ELD buf size %d\n", size);
+		return 0;
+	}
+	WARN_ON(size > PAGE_SIZE);

Better to check more explicity and show the value in the error message, and restrict the size.

sound/pci/hda/patch_intelhdmi.c line 581

Quoted 3 lines
sound/pci/hda/patch_intelhdmi.c new file +3 -0
+static void hdmi_parse_short_audio_desc(struct ELD_SAD *a)
+{
+	};

Unnecessary semicolon.

sound/pci/hda/hda_intel.c static unsigned int azx_max_codecs[AZX_N · line 1200

Quoted 9 lines
sound/pci/hda/hda_intel.c +1 -1
@@ -1196,7 +1196,7 @@ static unsigned int azx_max_codecs[AZX_N
  * report wrongly the non-existing 4th slot availability
  */
 static unsigned int azx_default_codecs[AZX_NUM_DRIVERS] __devinitdata = {
-	[AZX_DRIVER_ICH] = 3,
+	[AZX_DRIVER_ICH] = 4,
 	[AZX_DRIVER_ATI] = 3,

Well, this change should be done in a separate patch.
I guess your hardware has the HDMI code on the 4th slot, and the audio codec on other?

This number 3 was basically to avoid lock-up by a wrong detection on some hardwares such as thinkpad X60 with some old BIOS. I remember there were others, too.

I guess, however, this workaround is no longer necessary because we clear the slot bits beforehand properly. If any, a user can add probe_mask option manually, and we can put it in the blacklist.

So, I'd say, let's remove this azx_default_codecs[] stuff completely now.

thanks,

Takashi

#2 lore raw
Quoted 20 lines · Takashi Iwai

At Tue, 28 Oct 2008 16:07:39 +0800,

Quoted 5 lines · Wu Fengguang

Hello,

We have recently enabled sound output for Intel HDMI codecs, and would like to share the good news and some early code :-)

Great!

Quoted 9 lines

The audio enabling code includes both ALSA and X.Org patches. Attached is one single patch against today's sound-2.6 tree. It contains very basic code for handling
- audio infoframe
- ELD(E-EDID Like Data)
- unsolicited response

The patch is full enough to produce stereo sound via HDMI.
But it still lacks features and contains many 'defined but unused' staffs.

Quoted 6 lines

Yeah I see.

Quoted 2 lines

It was tested OK on ASUS P5E-VM board and HP 2230s notebook. It _should_ also work on Intel DG45ID board.

Does the ALSA patch work alone without changes in x.org side?

- P5E-VM: works in console, ALSA patch is enough
- HP 2230s: needs intel video driver to produce sound at all

- DG45ID: (if I remember it right)
- produces noise in console since booting(this is why I call hdmi_disable_output() in intel_hdmi_init(), will comment this case)
- sound OK both with vesa/intel video drivers

Quoted 6 lines
Quoted 2 lines

Takashi, I can prepare a trimmed-down patch series, in doing so I'd like to know if you are interested in the basic DIP/ELD/UNSOL routines?

Yes. I wanted to write it by myself, but forgot for long time since I have no HDMI hardware for testing :)
Good to see someone finally adding it!

Yeah, hardware is critical.
To do this work, we collected several HDMI boxes and monitors :-)

Quoted 5 lines
Quoted 1 line

Or should I only submit bare code comparable to the current patch_atihdmi.c?

If the codec is supposed to be (almost) compatible, it'd be a good idea. Otherwise (if you are uncertain), we can keep it separated as your original patch. I don't mind much about it.

OK. The main logic for ati/nv/intel HDMI codecs should be the same, except some possible quirks. One fact is, we migrated SiI1392 HDMI support from patch_atihdmi.c to patch_intelhdmi.c to make it work for our P5E-VM board.

Quoted 2 lines

And, maybe we'll need to move EDID handling to the common place, anyway.

Yes. But what if the intel driver evolve/expand fast enough to be the one real driver for HDMI/Display Port codecs? ;-)

Quoted 21 lines
Quoted 4 lines

PS: the patch can now produce the following ELD information:

Quoted 16 lines
[10340.656719] eldv = 1, pinp = 1
[10340.660711] ELD buffer size  is 64
[10340.660716] ELD baseline len is 10*4
[10340.660720] vendor block len is 20
[10340.660724] ELD version      is CEA-861D or below
[10340.660728] CEA-EDID version is CEA-861-B, C or D
[10340.660732] manufacture name is 0x4544
[10340.660736] product code     is 0xa02c
[10340.660740] port id          is 0x0
[10340.660743] HDCP support     is 0
[10340.660747] AI support       is 0
[10340.660751] SAD count        is 0
[10340.660754] audio sync delay is 0
[10340.660758] connection type  is HDMI
[10340.660763] speaker allocations:
[10340.660766] monitor name     is DELL 2408WFP
Quoted 1 line

Looks good.

I think those kernel messages would be valuable informations for both developers and end users. Such information are also good candidates for sysfs(or procfs) exports, I guess.

Quoted 11 lines
Quoted 3 lines
sound/pci/hda/patch_intelhdmi.c new file +0 -0

(snip)

sound/pci/hda/patch_intelhdmi.c line 77

Quoted 3 lines
sound/pci/hda/patch_intelhdmi.c new file +3 -0
+struct ELD_fixed_fields {
+	__u8 rsv_0		:3;
+	__u8 ELD_ver		:5;

We should avoid bitfields if it's used for communication with the hardware in general for portability reason. Simply take it as bytes, and use normal bit shift ops.

This structure is for communication with intel's video driver. ie. intel video driver reuses that struct for filling the ELD buffer, so I think it should be OK.

Quoted 2 lines

Also, no reason to use "__" prefix there.

OK.

Quoted 6 lines

sound/pci/hda/patch_intelhdmi.c line 432

Quoted 3 lines
sound/pci/hda/patch_intelhdmi.c new file +3 -0
+static void hdmi_debug_slot_mapping(struct hda_codec *codec)
+{
+#ifdef CONFIG_SND_DEBUG

I'd use CONFIG_SND_DEBUG_VERBOSE here. Most distros turn on CONFIG_SND_DEBUG=y, and this will be annoying.

Will use it - it wasn't only because I cannot find the _VERBOSE version at the time ;-)

Quoted 34 lines
Quoted 4 lines
sound/pci/hda/patch_intelhdmi.c new file +4 -0
+	int i;
+	int slot;
+
+	for (i = 0; i < 8; i++) {

sound/pci/hda/patch_intelhdmi.c line 463

Quoted 10 lines
sound/pci/hda/patch_intelhdmi.c new file +10 -0
+		slot = snd_hda_codec_read(codec, CVT_NID, 0,
+						AC_VERB_GET_HDMI_CHAN_SLOT, i);
+		printk(KERN_DEBUG "ASP channel %d => slot %d\n",
+				slot >> 4, slot & 0x7);
+	}
+#endif
+}
+static void hdmi_debug_present_sense(struct hda_codec *codec)
+{
+#ifdef CONFIG_SND_DEBUG

Ditto.

Quoted 17 lines
sound/pci/hda/patch_intelhdmi.c new file +17 -0
+static int hdmi_get_eldd(struct hda_codec *codec, char **eldd)
+{
+	int i;
+	int size;
+	char *buf;
+
+	i = hdmi_present_sense(codec) & AC_PINSENSE_ELDV;
+	if (!i)
+		return 0;
+
+	size = snd_hda_codec_read(codec, PIN_NID, 0, AC_VERB_GET_HDMI_DIP_SIZE,
+						     AC_DIPSIZE_ELD_BUF);
+	if (size == 0) {
+		/* wfg: workaround for ASUS P5E-VM HDMI board */
+		snd_printk(KERN_INFO "ELD buf size is 0, force 64\n");
+		size = 64;
+	}
Quoted 8 lines

sound/pci/hda/patch_intelhdmi.c line 512

Quoted 5 lines
sound/pci/hda/patch_intelhdmi.c new file +5 -0
+	if (size < sizeof(struct ELD_fixed_fields)) {
+		snd_printk(KERN_WARNING "Invalid ELD buf size %d\n", size);
+		return 0;
+	}
+	WARN_ON(size > PAGE_SIZE);

Better to check more explicity and show the value in the error message, and restrict the size.

Good idea!

Quoted 5 lines

sound/pci/hda/patch_intelhdmi.c line 581

Quoted 3 lines
sound/pci/hda/patch_intelhdmi.c new file +3 -0
+static void hdmi_parse_short_audio_desc(struct ELD_SAD *a)
+{
+	};

Unnecessary semicolon.

Good catch, fixed.

Quoted 11 lines

sound/pci/hda/hda_intel.c static unsigned int azx_max_codecs[AZX_N · line 1200

Quoted 9 lines
sound/pci/hda/hda_intel.c +1 -1
@@ -1196,7 +1196,7 @@ static unsigned int azx_max_codecs[AZX_N
  * report wrongly the non-existing 4th slot availability
  */
 static unsigned int azx_default_codecs[AZX_NUM_DRIVERS] __devinitdata = {
-	[AZX_DRIVER_ICH] = 3,
+	[AZX_DRIVER_ICH] = 4,
 	[AZX_DRIVER_ATI] = 3,

Well, this change should be done in a separate patch.

OK, it's a temp solution - I read about the same patch from you in latest linux-2.6 tree :-)

Quoted 2 lines

I guess your hardware has the HDMI code on the 4th slot, and the audio codec on other?

It's required for DG45ID, however I no longer have access to it now :-(

Quoted 10 lines

This number 3 was basically to avoid lock-up by a wrong detection on some hardwares such as thinkpad X60 with some old BIOS. I remember there were others, too.

I guess, however, this workaround is no longer necessary because we clear the slot bits beforehand properly. If any, a user can add probe_mask option manually, and we can put it in the blacklist.

So, I'd say, let's remove this azx_default_codecs[] stuff completely now.

Agreed, I wondered why probe_mask and max limits exist side by side...

Thank you,
Fengguang

#3 lore raw

At Tue, 28 Oct 2008 17:50:16 +0800,

Quoted 29 lines · Fengguang
Quoted 20 lines · Takashi Iwai

At Tue, 28 Oct 2008 16:07:39 +0800,

Quoted 5 lines · Wu Fengguang

Hello,

We have recently enabled sound output for Intel HDMI codecs, and would like to share the good news and some early code :-)

Great!

Quoted 9 lines

The audio enabling code includes both ALSA and X.Org patches. Attached is one single patch against today's sound-2.6 tree. It contains very basic code for handling
- audio infoframe
- ELD(E-EDID Like Data)
- unsolicited response

The patch is full enough to produce stereo sound via HDMI.
But it still lacks features and contains many 'defined but unused' staffs.

Quoted 6 lines

Yeah I see.

Quoted 2 lines

It was tested OK on ASUS P5E-VM board and HP 2230s notebook. It _should_ also work on Intel DG45ID board.

Does the ALSA patch work alone without changes in x.org side?

Quoted 7 lines

- P5E-VM: works in console, ALSA patch is enough
- HP 2230s: needs intel video driver to produce sound at all

- DG45ID: (if I remember it right)
- produces noise in console since booting(this is why I call hdmi_disable_output() in intel_hdmi_init(), will comment this case)
- sound OK both with vesa/intel video drivers

Thanks for detailed information.
If the ALSA patch doesn't do anything harmful, I'd happily apply it :)

Quoted 9 lines
Quoted 6 lines
Quoted 2 lines

Takashi, I can prepare a trimmed-down patch series, in doing so I'd like to know if you are interested in the basic DIP/ELD/UNSOL routines?

Yes. I wanted to write it by myself, but forgot for long time since I have no HDMI hardware for testing :)
Good to see someone finally adding it!

Yeah, hardware is critical.
To do this work, we collected several HDMI boxes and monitors :-)

Wow.

Right now my colleagues have some HDMI devices for testing, but they are ATI graphic boards (no surprise :)

Quoted 10 lines
Quoted 5 lines
Quoted 1 line

Or should I only submit bare code comparable to the current patch_atihdmi.c?

If the codec is supposed to be (almost) compatible, it'd be a good idea. Otherwise (if you are uncertain), we can keep it separated as your original patch. I don't mind much about it.

OK. The main logic for ati/nv/intel HDMI codecs should be the same, except some possible quirks. One fact is, we migrated SiI1392 HDMI support from patch_atihdmi.c to patch_intelhdmi.c to make it work for our P5E-VM board.

Right. I think SII1392 never worked properly with the current code. So, it's no problem to move it.

Quoted 5 lines
Quoted 2 lines

And, maybe we'll need to move EDID handling to the common place, anyway.

Yes. But what if the intel driver evolve/expand fast enough to be the one real driver for HDMI/Display Port codecs? ;-)

Heh, my grand plan is to have a perfect generic codec-parser. IOW, the codec-specific code should be merged into the generic parser in future.

Quoted 19 lines
Quoted 19 lines
Quoted 18 lines

PS: the patch can now produce the following ELD information:

[10340.656719] eldv = 1, pinp = 1
[10340.660711] ELD buffer size  is 64
[10340.660716] ELD baseline len is 10*4
[10340.660720] vendor block len is 20
[10340.660724] ELD version      is CEA-861D or below
[10340.660728] CEA-EDID version is CEA-861-B, C or D
[10340.660732] manufacture name is 0x4544
[10340.660736] product code     is 0xa02c
[10340.660740] port id          is 0x0
[10340.660743] HDCP support     is 0
[10340.660747] AI support       is 0
[10340.660751] SAD count        is 0
[10340.660754] audio sync delay is 0
[10340.660758] connection type  is HDMI
[10340.660763] speaker allocations:
[10340.660766] monitor name     is DELL 2408WFP
Quoted 5 lines
Quoted 1 line

Looks good.

I think those kernel messages would be valuable informations for both developers and end users. Such information are also good candidates for sysfs(or procfs) exports, I guess.

I thought of that, too. If you need a sysfs entry for a specific codec, you can easily attach to hwdep sysfs directory. See hda_hwdep.c:snd_hda_hwdep_add_sysfs().

Quoted 11 lines
Quoted 10 lines
Quoted 2 lines
sound/pci/hda/patch_intelhdmi.c new file +0 -0

(snip)

sound/pci/hda/patch_intelhdmi.c line 77

Quoted 3 lines
sound/pci/hda/patch_intelhdmi.c new file +3 -0
+struct ELD_fixed_fields {
+	__u8 rsv_0		:3;
+	__u8 ELD_ver		:5;

We should avoid bitfields if it's used for communication with the hardware in general for portability reason. Simply take it as bytes, and use normal bit shift ops.

Quoted 3 lines

This structure is for communication with intel's video driver. ie. intel video driver reuses that struct for filling the ELD buffer, so I think it should be OK.

Hm... Then this should work, although I don't agree fully with bitfields for any communication protocols.

Anyway, it's no big problem. This can be fixed if we see any incompatibilities.

Quoted 11 lines
Quoted 1 line

Also, no reason to use "__" prefix there.

OK.

Quoted 6 lines

sound/pci/hda/patch_intelhdmi.c line 432

Quoted 3 lines
sound/pci/hda/patch_intelhdmi.c new file +3 -0
+static void hdmi_debug_slot_mapping(struct hda_codec *codec)
+{
+#ifdef CONFIG_SND_DEBUG

I'd use CONFIG_SND_DEBUG_VERBOSE here. Most distros turn on CONFIG_SND_DEBUG=y, and this will be annoying.

Quoted 2 lines

Will use it - it wasn't only because I cannot find the _VERBOSE version at the time ;-)

That was renamed from CONFIG_SND_DEBUG_DETECT.

Quoted 12 lines
Quoted 11 lines

sound/pci/hda/hda_intel.c static unsigned int azx_max_codecs[AZX_N · line 1200

Quoted 9 lines
sound/pci/hda/hda_intel.c +1 -1
@@ -1196,7 +1196,7 @@ static unsigned int azx_max_codecs[AZX_N
  * report wrongly the non-existing 4th slot availability
  */
 static unsigned int azx_default_codecs[AZX_NUM_DRIVERS] __devinitdata = {
-	[AZX_DRIVER_ICH] = 3,
+	[AZX_DRIVER_ICH] = 4,
 	[AZX_DRIVER_ATI] = 3,

Well, this change should be done in a separate patch.

Quoted 2 lines

OK, it's a temp solution - I read about the same patch from you in latest linux-2.6 tree :-)

Oh yes, there were some issues around it.

Quoted 9 lines
Quoted 2 lines

I guess your hardware has the HDMI code on the 4th slot, and the audio codec on other?

It's required for DG45ID, however I no longer have access to it now :-(

Quoted 4 lines

This number 3 was basically to avoid lock-up by a wrong detection on some hardwares such as thinkpad X60 with some old BIOS. I remember there were others, too.

Quoted 8 lines
Quoted 6 lines

I guess, however, this workaround is no longer necessary because we clear the slot bits beforehand properly. If any, a user can add probe_mask option manually, and we can put it in the blacklist.

So, I'd say, let's remove this azx_default_codecs[] stuff completely now.

Agreed, I wondered why probe_mask and max limits exist side by side...

OK, I'll fix that now.

thanks,

Takashi

#4 lore raw
Quoted 5 lines · Takashi Iwai
Quoted 5 lines
Quoted 1 line

Does the ALSA patch work alone without changes in x.org side?

- P5E-VM: works in console, ALSA patch is enough
- HP 2230s: needs intel video driver to produce sound at all

Quoted 7 lines
Quoted 4 lines

- DG45ID: (if I remember it right)
- produces noise in console since booting(this is why I call hdmi_disable_output() in intel_hdmi_init(), will comment this case)
- sound OK both with vesa/intel video drivers

Thanks for detailed information.
If the ALSA patch doesn't do anything harmful, I'd happily apply it :)

Thank you!

In the long term, there will be kernel mode-setting code that takes charge of the EDID information; it can also do audio enabling on the video part, so that HDMI audio is available to console users.

Quoted 9 lines
Quoted 5 lines
Quoted 2 lines

And, maybe we'll need to move EDID handling to the common place, anyway.

Yes. But what if the intel driver evolve/expand fast enough to be the one real driver for HDMI/Display Port codecs? ;-)

Heh, my grand plan is to have a perfect generic codec-parser. IOW, the codec-specific code should be merged into the generic parser in future.

That's a good direction. Can you point the right place for EDID code, or I can simply put them in patch_intelhdmi.c for now?

Quoted 21 lines
Quoted 21 lines
Quoted 20 lines
Quoted 18 lines

PS: the patch can now produce the following ELD information:

[10340.656719] eldv = 1, pinp = 1
[10340.660711] ELD buffer size  is 64
[10340.660716] ELD baseline len is 10*4
[10340.660720] vendor block len is 20
[10340.660724] ELD version      is CEA-861D or below
[10340.660728] CEA-EDID version is CEA-861-B, C or D
[10340.660732] manufacture name is 0x4544
[10340.660736] product code     is 0xa02c
[10340.660740] port id          is 0x0
[10340.660743] HDCP support     is 0
[10340.660747] AI support       is 0
[10340.660751] SAD count        is 0
[10340.660754] audio sync delay is 0
[10340.660758] connection type  is HDMI
[10340.660763] speaker allocations:
[10340.660766] monitor name     is DELL 2408WFP

Looks good.

Quoted 7 lines
Quoted 3 lines

I think those kernel messages would be valuable informations for both developers and end users. Such information are also good candidates for sysfs(or procfs) exports, I guess.

I thought of that, too. If you need a sysfs entry for a specific codec, you can easily attach to hwdep sysfs directory. See hda_hwdep.c:snd_hda_hwdep_add_sysfs().

OK, I'll do it after sorting out the basic functions.

Quoted 16 lines
Quoted 12 lines
Quoted 11 lines
Quoted 3 lines
sound/pci/hda/patch_intelhdmi.c new file +0 -0

(snip)

sound/pci/hda/patch_intelhdmi.c line 77

Quoted 3 lines
sound/pci/hda/patch_intelhdmi.c new file +3 -0
+struct ELD_fixed_fields {
+	__u8 rsv_0		:3;
+	__u8 ELD_ver		:5;

We should avoid bitfields if it's used for communication with the hardware in general for portability reason. Simply take it as bytes, and use normal bit shift ops.

Quoted 3 lines

This structure is for communication with intel's video driver. ie. intel video driver reuses that struct for filling the ELD buffer, so I think it should be OK.

Quoted 5 lines

Hm... Then this should work, although I don't agree fully with bitfields for any communication protocols.

Anyway, it's no big problem. This can be fixed if we see any incompatibilities.

OK. I'll remove bit fields from struct hdmi_audio_infoframe and keep struct ELD_fixed_fields for internal use only.

Thank you,
Fengguang

#5 lore raw

At Wed, 29 Oct 2008 14:07:55 +0800,

Quoted 27 lines · Fengguang
Quoted 5 lines · Takashi Iwai
Quoted 5 lines
Quoted 1 line

Does the ALSA patch work alone without changes in x.org side?

- P5E-VM: works in console, ALSA patch is enough
- HP 2230s: needs intel video driver to produce sound at all

Quoted 7 lines
Quoted 4 lines

- DG45ID: (if I remember it right)
- produces noise in console since booting(this is why I call hdmi_disable_output() in intel_hdmi_init(), will comment this case)
- sound OK both with vesa/intel video drivers

Thanks for detailed information.
If the ALSA patch doesn't do anything harmful, I'd happily apply it :)

Thank you!

In the long term, there will be kernel mode-setting code that takes charge of the EDID information; it can also do audio enabling on the video part, so that HDMI audio is available to console users.

Quoted 6 lines
Quoted 5 lines
Quoted 2 lines

And, maybe we'll need to move EDID handling to the common place, anyway.

Yes. But what if the intel driver evolve/expand fast enough to be the one real driver for HDMI/Display Port codecs? ;-)

Quoted 6 lines
Quoted 3 lines

Heh, my grand plan is to have a perfect generic codec-parser. IOW, the codec-specific code should be merged into the generic parser in future.

That's a good direction. Can you point the right place for EDID code, or I can simply put them in patch_intelhdmi.c for now?

You can put them as they are right now.
My plan is just like the grand unification theory :)

Quoted 25 lines
Quoted 25 lines
Quoted 24 lines
Quoted 19 lines
Quoted 18 lines

PS: the patch can now produce the following ELD information:

[10340.656719] eldv = 1, pinp = 1
[10340.660711] ELD buffer size  is 64
[10340.660716] ELD baseline len is 10*4
[10340.660720] vendor block len is 20
[10340.660724] ELD version      is CEA-861D or below
[10340.660728] CEA-EDID version is CEA-861-B, C or D
[10340.660732] manufacture name is 0x4544
[10340.660736] product code     is 0xa02c
[10340.660740] port id          is 0x0
[10340.660743] HDCP support     is 0
[10340.660747] AI support       is 0
[10340.660751] SAD count        is 0
[10340.660754] audio sync delay is 0
[10340.660758] connection type  is HDMI
[10340.660763] speaker allocations:
[10340.660766] monitor name     is DELL 2408WFP
Quoted 1 line

Looks good.

I think those kernel messages would be valuable informations for both developers and end users. Such information are also good candidates for sysfs(or procfs) exports, I guess.

Quoted 5 lines
Quoted 3 lines

I thought of that, too. If you need a sysfs entry for a specific codec, you can easily attach to hwdep sysfs directory. See hda_hwdep.c:snd_hda_hwdep_add_sysfs().

OK, I'll do it after sorting out the basic functions.

Or, it can be procfs. It won't be easy as well.
Choose the way you like.

Quoted 15 lines
Quoted 15 lines
Quoted 14 lines
Quoted 10 lines
Quoted 2 lines
sound/pci/hda/patch_intelhdmi.c new file +0 -0

(snip)

sound/pci/hda/patch_intelhdmi.c line 77

Quoted 3 lines
sound/pci/hda/patch_intelhdmi.c new file +3 -0
+struct ELD_fixed_fields {
+	__u8 rsv_0		:3;
+	__u8 ELD_ver		:5;

We should avoid bitfields if it's used for communication with the hardware in general for portability reason. Simply take it as bytes, and use normal bit shift ops.

This structure is for communication with intel's video driver. ie. intel video driver reuses that struct for filling the ELD buffer, so I think it should be OK.

Quoted 8 lines
Quoted 5 lines

Hm... Then this should work, although I don't agree fully with bitfields for any communication protocols.

Anyway, it's no big problem. This can be fixed if we see any incompatibilities.

OK. I'll remove bit fields from struct hdmi_audio_infoframe and keep struct ELD_fixed_fields for internal use only.

That's great.

Thanks!

Takashi