Skip to contentSkip to conversation

add the nvidia HDMI codec driver for MCP77/79

PATCH In review peerchen 5 participants 19 messages Sep 3, 2008 – Sep 26, 2008 Sound

lore
Share & tools
lore

peerchen

author
#0 lore raw

PATCH 1/1 add the nvidia HDMI codec driver for MCP77/79

Add the nvidia HDMI codec driver for MCP77/79.
The patch based on kernel 2.6.27-rc5.

---

sound/pci/hda/hda_intel.c +2 -2
diff -uprN -X linux-2.6.26-Orig/Documentation/dontdiff linux-2.6.26-Orig/sound/pci/hda/hda_intel.c linux-2.6.26-New/sound/pci/hda/hda_intel.c
@@ -223,8 +223,8 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO
 #define RIRB_INT_MASK		0x05
 
 /* STATESTS int mask: SD2,SD1,SD0 */
-#define AZX_MAX_CODECS		3
-#define STATESTS_INT_MASK	0x07
+#define AZX_MAX_CODECS		4
+#define STATESTS_INT_MASK	0x0f
 
 /* SD_CTL bits */
 #define SD_CTL_STREAM_RESET	0x01	/* stream reset bit */
sound/pci/hda/hda_patch.h +2 -0
diff -uprN -X linux-2.6.26-Orig/Documentation/dontdiff linux-2.6.26-Orig/sound/pci/hda/hda_patch.h linux-2.6.26-New/sound/pci/hda/hda_patch.h
@@ -18,3 +18,5 @@ extern struct hda_codec_preset snd_hda_p
 extern struct hda_codec_preset snd_hda_preset_conexant[];
 /* VIA codecs */
 extern struct hda_codec_preset snd_hda_preset_via[];
+/* NVIDIA HDMI codecs */
+extern struct hda_codec_preset snd_hda_preset_nvhdmi[];
sound/pci/hda/Makefile +1 -0
diff -uprN -X linux-2.6.26-Orig/Documentation/dontdiff linux-2.6.26-Orig/sound/pci/hda/Makefile linux-2.6.26-New/sound/pci/hda/Makefile
@@ -14,5 +14,6 @@ snd-hda-intel-$(CONFIG_SND_HDA_CODEC_SI3
 snd-hda-intel-$(CONFIG_SND_HDA_CODEC_ATIHDMI) += patch_atihdmi.o
 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
 
 obj-$(CONFIG_SND_HDA_INTEL) += snd-hda-intel.o
sound/pci/hda/patch_nvhdmi.c +379 -0

379 lines not on this page · raw message

sound/pci/Kconfig +8 -0
diff -uprN -X linux-2.6.26-Orig/Documentation/dontdiff linux-2.6.26-Orig/sound/pci/Kconfig linux-2.6.26-New/sound/pci/Kconfig
@@ -557,6 +557,14 @@ config SND_HDA_CODEC_ATIHDMI
 	  Say Y here to include ATI HDMI HD-audio codec support in
 	  snd-hda-intel driver, such as ATI RS600 HDMI.
 
+config SND_HDA_CODEC_NVHDMI
+	bool "Build Nvidia HDMI HD-audio codec support"
+	depends on SND_HDA_INTEL
+	default y
+	help
+	  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_CONEXANT
 	bool "Build Conexant HD-audio codec support"
 	depends on SND_HDA_INTEL

-

#1 lore raw

At Wed, 3 Sep 2008 15:58:17 +0800,

Quoted 6 lines · peerchen

Add the nvidia HDMI codec driver for MCP77/79.
The patch based on kernel 2.6.27-rc5.

Thanks for the patch. Some comments below.

sound/pci/hda/hda_intel.c enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO · line 227

Quoted 11 lines

diff -uprN -X linux-2.6.26-Orig/Documentation/dontdiff linux-2.6.26-Orig/sound/pci/hda/hda_intel.c linux-2.6.26-New/sound/pci/hda/hda_intel.c

sound/pci/hda/hda_intel.c +2 -2
@@ -223,8 +223,8 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO
 #define RIRB_INT_MASK		0x05
 
 /* STATESTS int mask: SD2,SD1,SD0 */
-#define AZX_MAX_CODECS		3
-#define STATESTS_INT_MASK	0x07
+#define AZX_MAX_CODECS		4
+#define STATESTS_INT_MASK	0x0f

This may break other platforms. Expanding STATESTS_INT_MASK is OK and would be harmless, but AZX_MAX_CODECS is not. AZX_MAX_CODECS is the default number of max codecs. The chipset specific max number of codecs is defined in azx_max_codecs[]. If Nvidia chipsets supports properly more than 3, change azx_max_codecs[AZX_DRIVER_NVIDIA] to 4.

Quoted 149 lines
sound/pci/hda/hda_intel.c +149 -0
+static unsigned short convert_from_spdif_status_nv(unsigned int sbits)
+{
+        unsigned short val = 0;
+
+        if (sbits & IEC958_AES0_PROFESSIONAL)
+                val |= AC_DIG1_PROFESSIONAL;
+        if (sbits & IEC958_AES0_NONAUDIO)
+                val |= AC_DIG1_NONAUDIO;
+        if (sbits & IEC958_AES0_PROFESSIONAL) {
+                if ((sbits & IEC958_AES0_PRO_EMPHASIS) ==
+                    IEC958_AES0_PRO_EMPHASIS_5015)
+                        val |= AC_DIG1_EMPHASIS;
+        } else {
+                if ((sbits & IEC958_AES0_CON_EMPHASIS) ==
+                    IEC958_AES0_CON_EMPHASIS_5015)
+                        val |= AC_DIG1_EMPHASIS;
+                if (!(sbits & IEC958_AES0_CON_NOT_COPYRIGHT))
+                        val |= AC_DIG1_COPYRIGHT;
+                if (sbits & (IEC958_AES1_CON_ORIGINAL << 8))
+                        val |= AC_DIG1_LEVEL;
+                val |= sbits & (IEC958_AES1_CON_CATEGORY << 8);
+        }
+        return val;
+}
+
+static unsigned int convert_to_spdif_status_nv(unsigned short val)
+{
+        unsigned int sbits = 0;
+
+        if (val & AC_DIG1_NONAUDIO)
+                sbits |= IEC958_AES0_NONAUDIO;
+        if (val & AC_DIG1_PROFESSIONAL)
+                sbits |= IEC958_AES0_PROFESSIONAL;
+        if (sbits & IEC958_AES0_PROFESSIONAL) {
+                if (sbits & AC_DIG1_EMPHASIS)
+                        sbits |= IEC958_AES0_PRO_EMPHASIS_5015;
+        } else {
+                if (val & AC_DIG1_EMPHASIS)
+                        sbits |= IEC958_AES0_CON_EMPHASIS_5015;
+                if (!(val & AC_DIG1_COPYRIGHT))
+                        sbits |= IEC958_AES0_CON_NOT_COPYRIGHT;
+                if (val & AC_DIG1_LEVEL)
+                        sbits |= (IEC958_AES1_CON_ORIGINAL << 8);
+                sbits |= val & (0x7f << 8);
+        }
+        return sbits;
+}
+
+static int snd_hda_hdmi_cmask_get(struct snd_kcontrol *kcontrol,
+                                   struct snd_ctl_elem_value *ucontrol)
+{
+        ucontrol->value.iec958.status[0] = IEC958_AES0_PROFESSIONAL |
+                                           IEC958_AES0_NONAUDIO |
+                                           IEC958_AES0_CON_EMPHASIS_5015 |
+                                           IEC958_AES0_CON_NOT_COPYRIGHT;
+        ucontrol->value.iec958.status[1] = IEC958_AES1_CON_CATEGORY |
+                                           IEC958_AES1_CON_ORIGINAL;
+        return 0;
+}
+
+static int snd_hda_hdmi_pmask_get(struct snd_kcontrol *kcontrol,
+                                   struct snd_ctl_elem_value *ucontrol)
+{
+        ucontrol->value.iec958.status[0] = IEC958_AES0_PROFESSIONAL |
+                                           IEC958_AES0_NONAUDIO |
+                                           IEC958_AES0_PRO_EMPHASIS_5015;
+        return 0;
+}
+
+static int snd_hda_hdmi_mask_info(struct snd_kcontrol *kcontrol,
+                                   struct snd_ctl_elem_info *uinfo)
+{
+        uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958;
+        uinfo->count = 1;
+        return 0;
+}
+
+static int snd_hda_hdmi_default_get(struct snd_kcontrol *kcontrol,
+                                     struct snd_ctl_elem_value *ucontrol)
+{
+        struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
+
+        ucontrol->value.iec958.status[0] = codec->spdif_status & 0xff;
+        ucontrol->value.iec958.status[1] = (codec->spdif_status >> 8) & 0xff;
+        ucontrol->value.iec958.status[2] = (codec->spdif_status >> 16) & 0xff;
+        ucontrol->value.iec958.status[3] = (codec->spdif_status >> 24) & 0xff;
+
+        return 0;
+}
+
+static int snd_hda_hdmi_default_put(struct snd_kcontrol *kcontrol,
+                                     struct snd_ctl_elem_value *ucontrol)
+{
+        struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
+        hda_nid_t nid = kcontrol->private_value;
+        unsigned short val;
+        int change;
+
+        mutex_lock(&codec->spdif_mutex);
+        codec->spdif_status = ucontrol->value.iec958.status[0] |
+                ((unsigned int)ucontrol->value.iec958.status[1] << 8) |
+                ((unsigned int)ucontrol->value.iec958.status[2] << 16) |
+                ((unsigned int)ucontrol->value.iec958.status[3] << 24);
+        val = convert_from_spdif_status_nv(codec->spdif_status);
+        val |= codec->spdif_ctls & 1;
+        change = codec->spdif_ctls != val;
+        codec->spdif_ctls = val;
+
+        if (change) {
+                snd_hda_codec_write_cache(codec, nid, 0,
+                                          AC_VERB_SET_DIGI_CONVERT_1,
+                                          val & 0xff);
+                snd_hda_codec_write_cache(codec, nid, 0,
+                                          AC_VERB_SET_DIGI_CONVERT_2,
+                                          val >> 8);
+        }
+
+        mutex_unlock(&codec->spdif_mutex);
+        return change;
+}
+
+#define snd_hda_hdmi_out_switch_info   snd_ctl_boolean_mono_info
+
+static int snd_hda_hdmi_out_switch_get(struct snd_kcontrol *kcontrol,
+                                        struct snd_ctl_elem_value *ucontrol)
+{
+        struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
+
+        ucontrol->value.integer.value[0] = codec->spdif_ctls & AC_DIG1_ENABLE;
+        return 0;
+}
+
+static int snd_hda_hdmi_out_switch_put(struct snd_kcontrol *kcontrol,
+                                        struct snd_ctl_elem_value *ucontrol)
+{
+        struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
+        hda_nid_t nid = kcontrol->private_value;
+        unsigned short val;
+        int change;
+
+        mutex_lock(&codec->spdif_mutex);
+        val = codec->spdif_ctls & ~AC_DIG1_ENABLE;
+        if (ucontrol->value.integer.value[0])
+                val |= AC_DIG1_ENABLE;
+        change = codec->spdif_ctls != val;
+        if (change) {
+                codec->spdif_ctls = val;
+                snd_hda_codec_write_cache(codec, nid, 0,
+                                          AC_VERB_SET_DIGI_CONVERT_1,

sound/pci/hda/hda_intel.c enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO

Quoted 10 lines
sound/pci/hda/hda_intel.c +10 -0
+                                          val & 0xff);
+                /* unmute amp switch (if any) */
+                if ((get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) &&
+                    (val & AC_DIG1_ENABLE))
+                        snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
+                                                 HDA_AMP_MUTE, 0);
+        }
+        mutex_unlock(&codec->spdif_mutex);
+        return change;
+}

These are almost identical with the functions in hda_codec.c. Is your intention to allow a different set of IEC958 status bits controls for HDMI *in addition* to SPDIF? If so, we should change the codes in hda_codec.c to allow other control names.

sound/pci/hda/hda_intel.c

Quoted 8 lines
sound/pci/hda/hda_intel.c +8 -0
+struct snd_kcontrol_new hdmi_mixes[] = {
+    {
+        .access = SNDRV_CTL_ELEM_ACCESS_READ,
+        .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+        .name = "IEC958 Playback Con Mask HDMI",
+        .info = snd_hda_hdmi_mask_info,
+        .get = snd_hda_hdmi_cmask_get,
+    },

These have also different names from the standard ones. Any reason?

sound/pci/hda/hda_intel.c

Quoted 8 lines
sound/pci/hda/hda_intel.c +8 -0
+static struct hda_pcm_stream nvhdmi_pcm_digital_playback = {
+	.substreams = 1,
+	.channels_min = 2,
+	.channels_max = 2,
+	.nid = 0x4, /* NID to query formats and rates and setup streams */
+        .rates = SNDRV_PCM_RATE_48000,
+        .maxbps = 16,
+        .formats = SNDRV_PCM_FMTBIT_S16_LE,

Use tabs please.

sound/pci/hda/hda_intel.c

Quoted 10 lines
sound/pci/hda/hda_intel.c +10 -0
+static int nvhdmi_build_pcms(struct hda_codec *codec)
+{
+	struct nvhdmi_spec *spec = codec->spec;
+	struct hda_pcm *info = &spec->pcm_rec;
+
+	codec->num_pcms = 1;
+	codec->pcm_info = info;
+
+	info->name = "NVIDIA HDMI";
+        info->pcm_type = HDA_PCM_TYPE_HDMI

Ditto.

thanks,

Takashi

#2 lore raw

Thanks for your comments. Some reply below:

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Wednesday, September 03, 2008 4:52 PM
To: peerchen
Cc: alsa-devel; linux-kernel; akpm; Peer Chen; Wei Ni
Subject: Re: [alsa-devel][PATCH] add the nvidia HDMI codec driver for MCP77/79

At Wed, 3 Sep 2008 15:58:17 +0800,

Quoted 6 lines · peerchen

Add the nvidia HDMI codec driver for MCP77/79.
The patch based on kernel 2.6.27-rc5.

Thanks for the patch. Some comments below.

Quoted 1 line

diff -uprN -X linux-2.6.26-Orig/Documentation/dontdiff

linux-2.6.26-Orig/sound/pci/hda/hda_intel.c
linux-2.6.26-New/sound/pci/hda/hda_intel.c

Quoted 1 line

--- linux-2.6.26-Orig/sound/pci/hda/hda_intel.c 2008-08-28

13:47:20.000000000 +0800

Quoted 1 line

+++ linux-2.6.26-New/sound/pci/hda/hda_intel.c 2008-08-28

15:33:51.000000000 +0800

sound/pci/hda/hda_intel.c enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO · line 227

Quoted 8 lines
sound/pci/hda/hda_intel.c +2 -2
@@ -223,8 +223,8 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO
 #define RIRB_INT_MASK		0x05
 
 /* STATESTS int mask: SD2,SD1,SD0 */
-#define AZX_MAX_CODECS		3
-#define STATESTS_INT_MASK	0x07
+#define AZX_MAX_CODECS		4
+#define STATESTS_INT_MASK	0x0f

This may break other platforms. Expanding STATESTS_INT_MASK is OK and would be harmless, but AZX_MAX_CODECS is not. AZX_MAX_CODECS is the default number of max codecs. The chipset specific max number of codecs is defined in azx_max_codecs[]. If Nvidia chipsets supports properly more than 3, change azx_max_codecs[AZX_DRIVER_NVIDIA] to 4.

==========Wei Ni's Answer: ==============
There are 2 codec connect to the nvidia AZA controller, one is realtek, and the other is nvidia HDMI codec.
In azx_codec_create(), the chip->codec_mask indicate codec connection. This chip->codec_mask=0x9, bit0 indicate realtek codec, and bit3 indicate hdmi codec.
In this routine, it use:
......

for (c = 0; c < AZX_MAX_CODECS; c++) {
		if ((chip->codec_mask & (1 << c)) & codec_probe_mask) {
			struct hda_codec *codec;
			err = snd_hda_codec_new(chip->bus, c, &codec);
			if (err < 0)
				continue;
			codecs++;
			if (codec->afg)
				audio_codecs++;
		}
	}
if (!audio_codecs) {
		/* probe additional slots if no codec is found */
		for (; c < azx_max_codecs[chip->driver_type]; c++) {
			if ((chip->codec_mask & (1 << c)) &
codec_probe_mask) {
				err = snd_hda_codec_new(chip->bus, c,
NULL);
				if (err < 0)
					continue;
				codecs++;
			}
		}
	}

......
According to these codes, It only can get the realtek codec and can not get hdmi codec, if just change azx_max_codecs[AZX_DRIVER_NVIDIA] to 4 I think if remove "if (!audio_codecs)", it will be better, and I only need to chang azx_max_codecs[AZX_DRIVER_NVIDIA] to 4
=====================================

Review enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO · line 228

Quoted 1 line
(quoted diff) +1 -0
+static unsigned short convert_from_spdif_status_nv(unsigned int

sbits)

Quoted 39 lines
sound/pci/hda/patch_nvhdmi.c +39 -0
+{
+        unsigned short val = 0;
+
+        if (sbits & IEC958_AES0_PROFESSIONAL)
+                val |= AC_DIG1_PROFESSIONAL;
+        if (sbits & IEC958_AES0_NONAUDIO)
+                val |= AC_DIG1_NONAUDIO;
+        if (sbits & IEC958_AES0_PROFESSIONAL) {
+                if ((sbits & IEC958_AES0_PRO_EMPHASIS) ==
+                    IEC958_AES0_PRO_EMPHASIS_5015)
+                        val |= AC_DIG1_EMPHASIS;
+        } else {
+                if ((sbits & IEC958_AES0_CON_EMPHASIS) ==
+                    IEC958_AES0_CON_EMPHASIS_5015)
+                        val |= AC_DIG1_EMPHASIS;
+                if (!(sbits & IEC958_AES0_CON_NOT_COPYRIGHT))
+                        val |= AC_DIG1_COPYRIGHT;
+                if (sbits & (IEC958_AES1_CON_ORIGINAL << 8))
+                        val |= AC_DIG1_LEVEL;
+                val |= sbits & (IEC958_AES1_CON_CATEGORY << 8);
+        }
+        return val;
+}
+
+static unsigned int convert_to_spdif_status_nv(unsigned short val)
+{
+        unsigned int sbits = 0;
+
+        if (val & AC_DIG1_NONAUDIO)
+                sbits |= IEC958_AES0_NONAUDIO;
+        if (val & AC_DIG1_PROFESSIONAL)
+                sbits |= IEC958_AES0_PROFESSIONAL;
+        if (sbits & IEC958_AES0_PROFESSIONAL) {
+                if (sbits & AC_DIG1_EMPHASIS)
+                        sbits |= IEC958_AES0_PRO_EMPHASIS_5015;
+        } else {
+                if (val & AC_DIG1_EMPHASIS)
+                        sbits |= IEC958_AES0_CON_EMPHASIS_5015;
+                if (!(val & AC_DIG1_COPYRIGHT))

sound/pci/hda/patch_nvhdmi.c

Quoted 10 lines
sound/pci/hda/patch_nvhdmi.c +10 -0
+                        sbits |= IEC958_AES0_CON_NOT_COPYRIGHT;
+                if (val & AC_DIG1_LEVEL)
+                        sbits |= (IEC958_AES1_CON_ORIGINAL << 8);
+                sbits |= val & (0x7f << 8);
+        }
+        return sbits;
+}
+
+static int snd_hda_hdmi_cmask_get(struct snd_kcontrol *kcontrol,
+                                   struct snd_ctl_elem_value

*ucontrol)

sound/pci/hda/patch_nvhdmi.c line 105

Quoted 4 lines
sound/pci/hda/patch_nvhdmi.c +4 -0
+{
+        ucontrol->value.iec958.status[0] = IEC958_AES0_PROFESSIONAL |
+                                           IEC958_AES0_NONAUDIO |
+

IEC958_AES0_CON_EMPHASIS_5015 |

Quoted 1 line

+

IEC958_AES0_CON_NOT_COPYRIGHT;

sound/pci/hda/patch_nvhdmi.c

Quoted 7 lines
sound/pci/hda/patch_nvhdmi.c +7 -0
+        ucontrol->value.iec958.status[1] = IEC958_AES1_CON_CATEGORY |
+                                           IEC958_AES1_CON_ORIGINAL;
+        return 0;
+}
+
+static int snd_hda_hdmi_pmask_get(struct snd_kcontrol *kcontrol,
+                                   struct snd_ctl_elem_value

*ucontrol)

sound/pci/hda/patch_nvhdmi.c line 105

Quoted 4 lines
sound/pci/hda/patch_nvhdmi.c +4 -0
+{
+        ucontrol->value.iec958.status[0] = IEC958_AES0_PROFESSIONAL |
+                                           IEC958_AES0_NONAUDIO |
+

IEC958_AES0_PRO_EMPHASIS_5015;

sound/pci/hda/patch_nvhdmi.c

Quoted 13 lines
sound/pci/hda/patch_nvhdmi.c +13 -0
+        return 0;
+}
+
+static int snd_hda_hdmi_mask_info(struct snd_kcontrol *kcontrol,
+                                   struct snd_ctl_elem_info *uinfo)
+{
+        uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958;
+        uinfo->count = 1;
+        return 0;
+}
+
+static int snd_hda_hdmi_default_get(struct snd_kcontrol *kcontrol,
+                                     struct snd_ctl_elem_value

*ucontrol)

sound/pci/hda/patch_nvhdmi.c

Quoted 4 lines
sound/pci/hda/patch_nvhdmi.c +4 -0
+{
+        struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
+
+        ucontrol->value.iec958.status[0] = codec->spdif_status &

0xff;

Quoted 1 line

+ ucontrol->value.iec958.status[1] = (codec->spdif_status >> 8)

& 0xff;

Quoted 1 line

+ ucontrol->value.iec958.status[2] = (codec->spdif_status >>

16) & 0xff;

Quoted 1 line

+ ucontrol->value.iec958.status[3] = (codec->spdif_status >>

24) & 0xff;

sound/pci/hda/patch_nvhdmi.c

Quoted 6 lines
sound/pci/hda/patch_nvhdmi.c +6 -0
+
+        return 0;
+}
+
+static int snd_hda_hdmi_default_put(struct snd_kcontrol *kcontrol,
+                                     struct snd_ctl_elem_value

*ucontrol)

sound/pci/hda/patch_nvhdmi.c

Quoted 9 lines
sound/pci/hda/patch_nvhdmi.c +9 -0
+{
+        struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
+        hda_nid_t nid = kcontrol->private_value;
+        unsigned short val;
+        int change;
+
+        mutex_lock(&codec->spdif_mutex);
+        codec->spdif_status = ucontrol->value.iec958.status[0] |
+                ((unsigned int)ucontrol->value.iec958.status[1] << 8)

|

Quoted 1 line

+ ((unsigned int)ucontrol->value.iec958.status[2] <<

16) |

Quoted 1 line

+ ((unsigned int)ucontrol->value.iec958.status[3] <<

24);

Quoted 12 lines
sound/pci/hda/patch_nvhdmi.c +12 -0
+        val = convert_from_spdif_status_nv(codec->spdif_status);
+        val |= codec->spdif_ctls & 1;
+        change = codec->spdif_ctls != val;
+        codec->spdif_ctls = val;
+
+        if (change) {
+                snd_hda_codec_write_cache(codec, nid, 0,
+                                          AC_VERB_SET_DIGI_CONVERT_1,
+                                          val & 0xff);
+                snd_hda_codec_write_cache(codec, nid, 0,
+                                          AC_VERB_SET_DIGI_CONVERT_2,
+                                          val >> 8);

sound/pci/hda/patch_nvhdmi.c

Quoted 10 lines
sound/pci/hda/patch_nvhdmi.c +10 -0
+        }
+
+        mutex_unlock(&codec->spdif_mutex);
+        return change;
+}
+
+#define snd_hda_hdmi_out_switch_info   snd_ctl_boolean_mono_info
+
+static int snd_hda_hdmi_out_switch_get(struct snd_kcontrol *kcontrol,
+                                        struct snd_ctl_elem_value

*ucontrol)

sound/pci/hda/patch_nvhdmi.c

Quoted 4 lines
sound/pci/hda/patch_nvhdmi.c +4 -0
+{
+        struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
+
+        ucontrol->value.integer.value[0] = codec->spdif_ctls &

AC_DIG1_ENABLE;

sound/pci/hda/patch_nvhdmi.c

Quoted 5 lines
sound/pci/hda/patch_nvhdmi.c +5 -0
+        return 0;
+}
+
+static int snd_hda_hdmi_out_switch_put(struct snd_kcontrol *kcontrol,
+                                        struct snd_ctl_elem_value

*ucontrol)

Quoted 10 lines
sound/pci/hda/patch_nvhdmi.c +10 -0
+{
+        struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
+        hda_nid_t nid = kcontrol->private_value;
+        unsigned short val;
+        int change;
+
+        mutex_lock(&codec->spdif_mutex);
+        val = codec->spdif_ctls & ~AC_DIG1_ENABLE;
+        if (ucontrol->value.integer.value[0])
+                val |= AC_DIG1_ENABLE;

sound/pci/hda/patch_nvhdmi.c

Quoted 10 lines
sound/pci/hda/patch_nvhdmi.c +10 -0
+        change = codec->spdif_ctls != val;
+        if (change) {
+                codec->spdif_ctls = val;
+                snd_hda_codec_write_cache(codec, nid, 0,
+                                          AC_VERB_SET_DIGI_CONVERT_1,
+                                          val & 0xff);
+                /* unmute amp switch (if any) */
+                if ((get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) &&
+                    (val & AC_DIG1_ENABLE))
+                        snd_hda_codec_amp_stereo(codec, nid,

HDA_OUTPUT, 0,

sound/pci/hda/patch_nvhdmi.c line 204

Quoted 5 lines
sound/pci/hda/patch_nvhdmi.c +5 -0
+                                                 HDA_AMP_MUTE, 0);
+        }
+        mutex_unlock(&codec->spdif_mutex);
+        return change;
+}

These are almost identical with the functions in hda_codec.c. Is your intention to allow a different set of IEC958 status bits controls for HDMI *in addition* to SPDIF? If so, we should change the codes in hda_codec.c to allow other control names.

==========Wei Ni's Answer: ==============
There are 2 codec connect to the nvidia AZA controller, one is realtek, the other is nvidia HDMI codec.
If I use the default SPDIF routine: snd_hda_create_spdif_out_ctls(), the driver can not be insmod success.
I traced this issue, the realtek's SPDIF used this IEC958 first, and then HDMI codec can't use IEC958 again.
( I traced it based on linux-2.6.25 )
So I write some routines for HDMI which are same as SPDIF routine, and the driver can work.
=====================================

sound/pci/hda/patch_nvhdmi.c line 213

Quoted 8 lines
sound/pci/hda/patch_nvhdmi.c +8 -0
+struct snd_kcontrol_new hdmi_mixes[] = {
+    {
+        .access = SNDRV_CTL_ELEM_ACCESS_READ,
+        .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+        .name = "IEC958 Playback Con Mask HDMI",
+        .info = snd_hda_hdmi_mask_info,
+        .get = snd_hda_hdmi_cmask_get,
+    },

These have also different names from the standard ones. Any reason?

==========Wei Ni's Answer: ==============
Ditto
=====================================

sound/pci/hda/patch_nvhdmi.c

Quoted 5 lines
sound/pci/hda/patch_nvhdmi.c +5 -0
+static struct hda_pcm_stream nvhdmi_pcm_digital_playback = {
+	.substreams = 1,
+	.channels_min = 2,
+	.channels_max = 2,
+	.nid = 0x4, /* NID to query formats and rates and setup streams

*/

sound/pci/hda/patch_nvhdmi.c line 316

Quoted 3 lines
sound/pci/hda/patch_nvhdmi.c +3 -0
+        .rates = SNDRV_PCM_RATE_48000,
+        .maxbps = 16,
+        .formats = SNDRV_PCM_FMTBIT_S16_LE,

Use tabs please.

==========Wei Ni's Answer: ==============
Thanks, I will modify it.
=====================================

sound/pci/hda/patch_nvhdmi.c line 333

Quoted 10 lines
sound/pci/hda/patch_nvhdmi.c +10 -0
+static int nvhdmi_build_pcms(struct hda_codec *codec)
+{
+	struct nvhdmi_spec *spec = codec->spec;
+	struct hda_pcm *info = &spec->pcm_rec;
+
+	codec->num_pcms = 1;
+	codec->pcm_info = info;
+
+	info->name = "NVIDIA HDMI";
+        info->pcm_type = HDA_PCM_TYPE_HDMI

Ditto.

==========Wei Ni's Answer: ==============
Thanks, I will modify it.
=====================================

thanks,

Takashi
-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------

#3 lore raw

At Wed, 3 Sep 2008 19:05:47 +0800,

Quoted 79 lines · Wei Ni

Thanks for your comments. Some reply below:

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Wednesday, September 03, 2008 4:52 PM
To: peerchen
Cc: alsa-devel; linux-kernel; akpm; Peer Chen; Wei Ni
Subject: Re: [alsa-devel][PATCH] add the nvidia HDMI codec driver for MCP77/79

At Wed, 3 Sep 2008 15:58:17 +0800,

Quoted 6 lines · peerchen

Add the nvidia HDMI codec driver for MCP77/79.
The patch based on kernel 2.6.27-rc5.

Thanks for the patch. Some comments below.

Quoted 1 line

diff -uprN -X linux-2.6.26-Orig/Documentation/dontdiff

linux-2.6.26-Orig/sound/pci/hda/hda_intel.c
linux-2.6.26-New/sound/pci/hda/hda_intel.c

Quoted 1 line

--- linux-2.6.26-Orig/sound/pci/hda/hda_intel.c 2008-08-28

13:47:20.000000000 +0800

Quoted 1 line

+++ linux-2.6.26-New/sound/pci/hda/hda_intel.c 2008-08-28

15:33:51.000000000 +0800

sound/pci/hda/hda_intel.c enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO · line 227

Quoted 8 lines
sound/pci/hda/hda_intel.c +2 -2
@@ -223,8 +223,8 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO
 #define RIRB_INT_MASK		0x05
 
 /* STATESTS int mask: SD2,SD1,SD0 */
-#define AZX_MAX_CODECS		3
-#define STATESTS_INT_MASK	0x07
+#define AZX_MAX_CODECS		4
+#define STATESTS_INT_MASK	0x0f

This may break other platforms. Expanding STATESTS_INT_MASK is OK and would be harmless, but AZX_MAX_CODECS is not. AZX_MAX_CODECS is the default number of max codecs. The chipset specific max number of codecs is defined in azx_max_codecs[]. If Nvidia chipsets supports properly more than 3, change azx_max_codecs[AZX_DRIVER_NVIDIA] to 4.

==========Wei Ni's Answer: ==============
There are 2 codec connect to the nvidia AZA controller, one is realtek, and the other is nvidia HDMI codec.
In azx_codec_create(), the chip->codec_mask indicate codec connection. This chip->codec_mask=0x9, bit0 indicate realtek codec, and bit3 indicate hdmi codec.
In this routine, it use:
......

for (c = 0; c < AZX_MAX_CODECS; c++) {
		if ((chip->codec_mask & (1 << c)) & codec_probe_mask) {
			struct hda_codec *codec;
			err = snd_hda_codec_new(chip->bus, c, &codec);
			if (err < 0)
				continue;
			codecs++;
			if (codec->afg)
				audio_codecs++;
		}
	}
if (!audio_codecs) {
		/* probe additional slots if no codec is found */
		for (; c < azx_max_codecs[chip->driver_type]; c++) {
			if ((chip->codec_mask & (1 << c)) &
codec_probe_mask) {
				err = snd_hda_codec_new(chip->bus, c,
NULL);
				if (err < 0)
					continue;
				codecs++;
			}
		}
	}
Quoted 5 lines

......
According to these codes, It only can get the realtek codec and can not get hdmi codec, if just change azx_max_codecs[AZX_DRIVER_NVIDIA] to 4 I think if remove "if (!audio_codecs)", it will be better, and I only need to chang azx_max_codecs[AZX_DRIVER_NVIDIA] to 4

Well, the check is there for a good reason.

There are many machines with broken BIOS reporting the 4th slot available although it isn't actually. It's a workaround to skip such a bogus information. So, it cannot be changed so easily.

We need to sort out this in a better way... Oh well.

Quoted 2 lines

Review enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO · line 228

Quoted 1 line
(quoted diff) +1 -0
+static unsigned short convert_from_spdif_status_nv(unsigned int

sbits)

(snip)

Quoted 5 lines

These are almost identical with the functions in hda_codec.c. Is your intention to allow a different set of IEC958 status bits controls for HDMI *in addition* to SPDIF? If so, we should change the codes in hda_codec.c to allow other control names.

Quoted 8 lines

==========Wei Ni's Answer: ==============
There are 2 codec connect to the nvidia AZA controller, one is realtek, the other is nvidia HDMI codec.
If I use the default SPDIF routine: snd_hda_create_spdif_out_ctls(), the driver can not be insmod success.
I traced this issue, the realtek's SPDIF used this IEC958 first, and then HDMI codec can't use IEC958 again.
( I traced it based on linux-2.6.25 )

2.6.25 is too old as a reference. The fix for multiple SPDIF devices is already on the recent kernel.

Takashi

#4 lore raw
Quoted 7 lines
Quoted 6 lines

......
According to these codes, It only can get the realtek codec and can not get hdmi codec, if just change azx_max_codecs[AZX_DRIVER_NVIDIA] to 4 I think if remove "if (!audio_codecs)", it will be better, and I only need to chang azx_max_codecs[AZX_DRIVER_NVIDIA] to 4

Quoted 7 lines

Well, the check is there for a good reason.

There are many machines with broken BIOS reporting the 4th slot available although it isn't actually. It's a workaround to skip such a bogus information. So, it cannot be changed so easily.

We need to sort out this in a better way... Oh well.

Please, please, put the above information as a comment to the respective place. These "hacks" should be commented :)

Thanks a lot,

Pavel.

#5 lore raw

At Wed, 03 Sep 2008 14:11:16 +0200,

Quoted 14 lines · Pavel Hofman
Quoted 14 lines
Quoted 7 lines

......
According to these codes, It only can get the realtek codec and can not get hdmi codec, if just change azx_max_codecs[AZX_DRIVER_NVIDIA] to 4 I think if remove "if (!audio_codecs)", it will be better, and I only need to chang azx_max_codecs[AZX_DRIVER_NVIDIA] to 4

Well, the check is there for a good reason.

There are many machines with broken BIOS reporting the 4th slot available although it isn't actually. It's a workaround to skip such a bogus information. So, it cannot be changed so easily.

Quoted 5 lines
Quoted 1 line

We need to sort out this in a better way... Oh well.

Please, please, put the above information as a comment to the respective place. These "hacks" should be commented :)

I changed that code yesterday with a little bit more comment.

Wei, Peer, could you regenerate the patch based on the latest sound git tree?

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

or use the snapshot tarball from

ftp://ftp.kernel.org/pub/linux/tiwai/snapshot/

This already contains the fix for the 4th slot probe on Nvidia chipset.

thanks,

Takashi

#6 lore raw

Thanks for your reply, I will generate the pach based on the latest sound git tree.

Wei

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Thursday, September 04, 2008 3:04 PM
To: Pavel Hofman
Cc: Wei Ni; Peer Chen; alsa-devel; linux-kernel; akpm
Subject: Re: [alsa-devel] [PATCH] add the nvidia HDMI codec driver for MCP77/79

At Wed, 03 Sep 2008 14:11:16 +0200,

Quoted 4 lines · Pavel Hofman
Quoted 4 lines
Quoted 4 lines

......
According to these codes, It only can get the realtek codec and can

not

Quoted 1 line
Quoted 1 line
Quoted 1 line

get hdmi codec, if just change azx_max_codecs[AZX_DRIVER_NVIDIA] to

4

Quoted 1 line
Quoted 1 line
Quoted 1 line

I think if remove "if (!audio_codecs)", it will be better, and I

only

Quoted 6 lines
Quoted 6 lines
Quoted 1 line

need to chang azx_max_codecs[AZX_DRIVER_NVIDIA] to 4

Well, the check is there for a good reason.

There are many machines with broken BIOS reporting the 4th slot available although it isn't actually. It's a workaround to skip

such

Quoted 6 lines
Quoted 3 lines

a bogus information. So, it cannot be changed so easily.

We need to sort out this in a better way... Oh well.

Please, please, put the above information as a comment to the

respective

Quoted 1 line

place. These "hacks" should be commented :)

I changed that code yesterday with a little bit more comment.

Wei, Peer, could you regenerate the patch based on the latest sound git tree?

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

or use the snapshot tarball from

ftp://ftp.kernel.org/pub/linux/tiwai/snapshot/

This already contains the fix for the 4th slot probe on Nvidia chipset.

thanks,

Takashi
-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------

author
#7 lore raw

Re: Re: [alsa-devel] [PATCH] add the nvidia HDMI codec driverfor MCP77/79

new patch base on git tree.

---

sound/pci/hda/hda_codec.c +3 -0
diff -uprN -X linux-2.6-tiwai-sound/Documentation/dontdiff linux-2.6-tiwai-sound/sound/pci/hda/hda_codec.c linux-2.6-tiwai-sound-niwei/sound/pci/hda/hda_codec.c
@@ -94,6 +94,9 @@ static const struct hda_codec_preset *hd
 #ifdef CONFIG_SND_HDA_CODEC_VIA
 	snd_hda_preset_via,
 #endif
+#ifdef CONFIG_SND_HDA_CODEC_NVHDMI
+	snd_hda_preset_nvhdmi,
+#endif
 	NULL
 };
 
sound/pci/hda/hda_intel.c +3 -0
diff -uprN -X linux-2.6-tiwai-sound/Documentation/dontdiff linux-2.6-tiwai-sound/sound/pci/hda/hda_intel.c linux-2.6-tiwai-sound-niwei/sound/pci/hda/hda_intel.c
@@ -1220,6 +1220,9 @@ static int __devinit azx_codec_create(st
 	if (err < 0)
 		return err;
 
+	if (chip->driver_type == AZX_DRIVER_NVIDIA)
+		chip->bus->needs_damn_long_delay = 1;
+
 	codecs = audio_codecs = 0;
 	max_slots = azx_max_codecs[chip->driver_type];
 	if (!max_slots)
sound/pci/hda/hda_patch.h +2 -0
diff -uprN -X linux-2.6-tiwai-sound/Documentation/dontdiff linux-2.6-tiwai-sound/sound/pci/hda/hda_patch.h linux-2.6-tiwai-sound-niwei/sound/pci/hda/hda_patch.h
@@ -18,3 +18,5 @@ extern struct hda_codec_preset snd_hda_p
 extern struct hda_codec_preset snd_hda_preset_conexant[];
 /* VIA codecs */
 extern struct hda_codec_preset snd_hda_preset_via[];
+/* NVIDIA HDMI codecs */
+extern struct hda_codec_preset snd_hda_preset_nvhdmi[];
sound/pci/hda/Makefile +1 -0
diff -uprN -X linux-2.6-tiwai-sound/Documentation/dontdiff linux-2.6-tiwai-sound/sound/pci/hda/Makefile linux-2.6-tiwai-sound-niwei/sound/pci/hda/Makefile
@@ -15,5 +15,6 @@ snd-hda-intel-$(CONFIG_SND_HDA_CODEC_SI3
 snd-hda-intel-$(CONFIG_SND_HDA_CODEC_ATIHDMI) += patch_atihdmi.o
 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
 
 obj-$(CONFIG_SND_HDA_INTEL) += snd-hda-intel.o
sound/pci/hda/patch_nvhdmi.c +164 -0

164 lines not on this page · raw message

sound/pci/Kconfig +8 -0
diff -uprN -X linux-2.6-tiwai-sound/Documentation/dontdiff linux-2.6-tiwai-sound/sound/pci/Kconfig linux-2.6-tiwai-sound-niwei/sound/pci/Kconfig
@@ -565,6 +565,14 @@ config SND_HDA_CODEC_ATIHDMI
 	  Say Y here to include ATI HDMI HD-audio codec support in
 	  snd-hda-intel driver, such as ATI RS600 HDMI.
 
+config SND_HDA_CODEC_NVHDMI
+	bool "Build NVIDIA HDMI HD-audio codec support"
+	depends on SND_HDA_INTEL
+	default y
+	help
+	  Say Y here to include NVIDIA HDMI HD-audio codec support in
+	  snd-hda-intel driver, such as NVIDIA MCP77/78 HDMI.
+
 config SND_HDA_CODEC_CONEXANT
 	bool "Build Conexant HD-audio codec support"
 	depends on SND_HDA_INTEL

-

#8 lore raw

Re: [alsa-devel] [PATCH] add the nvidia HDMI codec driverfor MCP77/79

At Wed, 17 Sep 2008 17:00:04 +0800,

Quoted 5 lines · peerchen

new patch base on git tree.

Thanks!

But, the patch looks like no "rebase". You secretly added a new function call that wasn't in your previous patch, namely...

sound/pci/hda/hda_intel.c static int __devinit azx_codec_create(st · line 1225

Quoted 10 lines

diff -uprN -X linux-2.6-tiwai-sound/Documentation/dontdiff linux-2.6-tiwai-sound/sound/pci/hda/hda_intel.c linux-2.6-tiwai-sound-niwei/sound/pci/hda/hda_intel.c

sound/pci/hda/hda_intel.c +3 -0
@@ -1220,6 +1220,9 @@ static int __devinit azx_codec_create(st
 	if (err < 0)
 		return err;
 
+	if (chip->driver_type == AZX_DRIVER_NVIDIA)
+		chip->bus->needs_damn_long_delay = 1;
+

Do we really need this inevitably? I don't think so -- otherwise I would have far more bug reports.

This flag is the last resort and should be avoided as much as possible. This results in a significant slow down of suspend/resume speed, for example.

If it's really needed with some devices and there is no other way to fix it, add this flag rather in the codec-initialization part.

Also, if you resend a patch, please add the original patch description again. This helps my patch work a lot indeed.

thanks,

Takashi

#9 lore raw

RE: [alsa-devel] [PATCH] add the nvidia HDMI codec driverfor MCP77/79

Thanks for your reply.

About the "long delay", we had some problems on reading RIRB buffer when testing this driver, so we add this "delay"
We will try to find a best way to fix this issue.

And we didn't familiar with git, we will research it more such as "rebase" and then submit the patch file again.

Thanks

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Wednesday, September 17, 2008 10:05 PM
To: peerchen
Cc: Wei Ni; Pavel Hofman; Peer Chen; alsa-devel; linux-kernel; akpm
Subject: Re: [alsa-devel] [PATCH] add the nvidia HDMI codec driverfor MCP77/79

At Wed, 17 Sep 2008 17:00:04 +0800,

Quoted 5 lines · peerchen

new patch base on git tree.

Thanks!

But, the patch looks like no "rebase". You secretly added a new function call that wasn't in your previous patch, namely...

Quoted 1 line

diff -uprN -X linux-2.6-tiwai-sound/Documentation/dontdiff

linux-2.6-tiwai-sound/sound/pci/hda/hda_intel.c linux-2.6-tiwai-sound-niwei/sound/pci/hda/hda_intel.c

Quoted 1 line

--- linux-2.6-tiwai-sound/sound/pci/hda/hda_intel.c 2008-09-10

17:40:52.000000000 +0800

Quoted 1 line

+++ linux-2.6-tiwai-sound-niwei/sound/pci/hda/hda_intel.c

2008-09-10 17:49:31.000000000 +0800

sound/pci/hda/hda_intel.c static int __devinit azx_codec_create(st · line 1225

Quoted 7 lines
sound/pci/hda/hda_intel.c +3 -0
@@ -1220,6 +1220,9 @@ static int __devinit azx_codec_create(st
 	if (err < 0)
 		return err;
 
+	if (chip->driver_type == AZX_DRIVER_NVIDIA)
+		chip->bus->needs_damn_long_delay = 1;
+

Do we really need this inevitably? I don't think so -- otherwise I would have far more bug reports.

This flag is the last resort and should be avoided as much as possible. This results in a significant slow down of suspend/resume speed, for example.

If it's really needed with some devices and there is no other way to fix it, add this flag rather in the codec-initialization part.

Also, if you resend a patch, please add the original patch description again. This helps my patch work a lot indeed.

thanks,

Takashi
-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------

#10 lore raw

RE: [alsa-devel] [PATCH] add the nvidia HDMI codec driverfor MCP77/79

In reply to Takashi Iwai

Hi, Takashi

About the "long delay", it seemed that we need to add this "delay" to fix some issue on our aza controller.
Because it related with the controller, not just codec, so I think this flag should not be added in codec-initialization part.
I think it's better to add the flag in that place which I submitted.

Thanks

-----Original Message-----
From: Wei Ni
Sent: Friday, September 19, 2008 12:43 PM
To: 'Takashi Iwai'; peerchen
Cc: Pavel Hofman; Peer Chen; alsa-devel; linux-kernel; akpm
Subject: RE: [alsa-devel] [PATCH] add the nvidia HDMI codec driverfor MCP77/79

Thanks for your reply.

About the "long delay", we had some problems on reading RIRB buffer when testing this driver, so we add this "delay"
We will try to find a best way to fix this issue.

And we didn't familiar with git, we will research it more such as "rebase" and then submit the patch file again.

Thanks

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Wednesday, September 17, 2008 10:05 PM
To: peerchen
Cc: Wei Ni; Pavel Hofman; Peer Chen; alsa-devel; linux-kernel; akpm
Subject: Re: [alsa-devel] [PATCH] add the nvidia HDMI codec driverfor MCP77/79

At Wed, 17 Sep 2008 17:00:04 +0800,

Quoted 5 lines · peerchen

new patch base on git tree.

Thanks!

But, the patch looks like no "rebase". You secretly added a new function call that wasn't in your previous patch, namely...

Quoted 1 line

diff -uprN -X linux-2.6-tiwai-sound/Documentation/dontdiff

linux-2.6-tiwai-sound/sound/pci/hda/hda_intel.c linux-2.6-tiwai-sound-niwei/sound/pci/hda/hda_intel.c

Quoted 1 line

--- linux-2.6-tiwai-sound/sound/pci/hda/hda_intel.c 2008-09-10

17:40:52.000000000 +0800

Quoted 1 line

+++ linux-2.6-tiwai-sound-niwei/sound/pci/hda/hda_intel.c

2008-09-10 17:49:31.000000000 +0800

sound/pci/hda/hda_intel.c static int __devinit azx_codec_create(st · line 1225

Quoted 7 lines
sound/pci/hda/hda_intel.c +3 -0
@@ -1220,6 +1220,9 @@ static int __devinit azx_codec_create(st
 	if (err < 0)
 		return err;
 
+	if (chip->driver_type == AZX_DRIVER_NVIDIA)
+		chip->bus->needs_damn_long_delay = 1;
+

Do we really need this inevitably? I don't think so -- otherwise I would have far more bug reports.

This flag is the last resort and should be avoided as much as possible. This results in a significant slow down of suspend/resume speed, for example.

If it's really needed with some devices and there is no other way to fix it, add this flag rather in the codec-initialization part.

Also, if you resend a patch, please add the original patch description again. This helps my patch work a lot indeed.

thanks,

Takashi
-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------

#11 lore raw

Re: [alsa-devel] [PATCH] add the nvidia HDMI codec driverfor MCP77/79

At Mon, 22 Sep 2008 14:33:58 +0800,

Quoted 8 lines · Wei Ni

Hi, Takashi

About the "long delay", it seemed that we need to add this "delay" to fix some issue on our aza controller.
Because it related with the controller, not just codec, so I think this flag should not be added in codec-initialization part.
I think it's better to add the flag in that place which I submitted.

OK, then could you split the patch to separate ones, i.e. one for the fix for this problem regarding Nvidia controller chip, and one for the addition of HDMI?

Don't forget to add a proper description for each patch, please ;)

As mentioned, that flag is a last resort, and I think it can be fixed in a saner way. But, the flag is surely safe, and we can track down the problem later on.

thanks,

Takashi

Quoted 82 lines

Thanks

-----Original Message-----
From: Wei Ni
Sent: Friday, September 19, 2008 12:43 PM
To: 'Takashi Iwai'; peerchen
Cc: Pavel Hofman; Peer Chen; alsa-devel; linux-kernel; akpm
Subject: RE: [alsa-devel] [PATCH] add the nvidia HDMI codec driverfor MCP77/79

Thanks for your reply.

About the "long delay", we had some problems on reading RIRB buffer when testing this driver, so we add this "delay"
We will try to find a best way to fix this issue.

And we didn't familiar with git, we will research it more such as "rebase" and then submit the patch file again.

Thanks

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Wednesday, September 17, 2008 10:05 PM
To: peerchen
Cc: Wei Ni; Pavel Hofman; Peer Chen; alsa-devel; linux-kernel; akpm
Subject: Re: [alsa-devel] [PATCH] add the nvidia HDMI codec driverfor MCP77/79

At Wed, 17 Sep 2008 17:00:04 +0800,

Quoted 5 lines · peerchen

new patch base on git tree.

Thanks!

But, the patch looks like no "rebase". You secretly added a new function call that wasn't in your previous patch, namely...

Quoted 1 line

diff -uprN -X linux-2.6-tiwai-sound/Documentation/dontdiff

linux-2.6-tiwai-sound/sound/pci/hda/hda_intel.c linux-2.6-tiwai-sound-niwei/sound/pci/hda/hda_intel.c

Quoted 1 line

--- linux-2.6-tiwai-sound/sound/pci/hda/hda_intel.c 2008-09-10

17:40:52.000000000 +0800

Quoted 1 line

+++ linux-2.6-tiwai-sound-niwei/sound/pci/hda/hda_intel.c

2008-09-10 17:49:31.000000000 +0800

sound/pci/hda/hda_intel.c static int __devinit azx_codec_create(st · line 1225

Quoted 7 lines
sound/pci/hda/hda_intel.c +3 -0
@@ -1220,6 +1220,9 @@ static int __devinit azx_codec_create(st
 	if (err < 0)
 		return err;
 
+	if (chip->driver_type == AZX_DRIVER_NVIDIA)
+		chip->bus->needs_damn_long_delay = 1;
+

Do we really need this inevitably? I don't think so -- otherwise I would have far more bug reports.

This flag is the last resort and should be avoided as much as possible. This results in a significant slow down of suspend/resume speed, for example.

If it's really needed with some devices and there is no other way to fix it, add this flag rather in the codec-initialization part.

Also, if you resend a patch, please add the original patch description again. This helps my patch work a lot indeed.

thanks,

Takashi
-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may contain confidential information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------

#12 lore raw

RE: [alsa-devel] [PATCH] add the nvidia HDMI codec driverfor MCP77/79

Hi, Takashi
I use git to generate patches. (I run git-fetch origin, git-fetch-rebase origin, and git-format-patch origin)

There are two patch, one for the addition of HDMI, and one for the fix for our aza controller.

Please check it.

Thanks

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Monday, September 22, 2008 5:58 PM
To: Wei Ni
Cc: peerchen; Pavel Hofman; Peer Chen; alsa-devel; linux-kernel; akpm
Subject: Re: [alsa-devel] [PATCH] add the nvidia HDMI codec driverfor MCP77/79

At Mon, 22 Sep 2008 14:33:58 +0800,

Quoted 6 lines · Wei Ni

Hi, Takashi

About the "long delay", it seemed that we need to add this "delay" to fix some issue on our aza controller.
Because it related with the controller, not just codec, so I think

this

Quoted 2 lines

flag should not be added in codec-initialization part.
I think it's better to add the flag in that place which I submitted.

OK, then could you split the patch to separate ones, i.e. one for the fix for this problem regarding Nvidia controller chip, and one for the addition of HDMI?

Don't forget to add a proper description for each patch, please ;)

As mentioned, that flag is a last resort, and I think it can be fixed in a saner way. But, the flag is surely safe, and we can track down the problem later on.

thanks,

Takashi

Quoted 11 lines

Thanks

-----Original Message-----
From: Wei Ni
Sent: Friday, September 19, 2008 12:43 PM
To: 'Takashi Iwai'; peerchen
Cc: Pavel Hofman; Peer Chen; alsa-devel; linux-kernel; akpm
Subject: RE: [alsa-devel] [PATCH] add the nvidia HDMI codec driverfor MCP77/79

Quoted 3 lines

Thanks for your reply.

About the "long delay", we had some problems on reading RIRB buffer

when

Quoted 54 lines

testing this driver, so we add this "delay"
We will try to find a best way to fix this issue.

And we didn't familiar with git, we will research it more such as "rebase" and then submit the patch file again.

Thanks

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Wednesday, September 17, 2008 10:05 PM
To: peerchen
Cc: Wei Ni; Pavel Hofman; Peer Chen; alsa-devel; linux-kernel; akpm
Subject: Re: [alsa-devel] [PATCH] add the nvidia HDMI codec driverfor MCP77/79

At Wed, 17 Sep 2008 17:00:04 +0800,

Quoted 5 lines · peerchen

new patch base on git tree.

Thanks!

But, the patch looks like no "rebase". You secretly added a new function call that wasn't in your previous patch, namely...

Quoted 1 line

diff -uprN -X linux-2.6-tiwai-sound/Documentation/dontdiff

linux-2.6-tiwai-sound/sound/pci/hda/hda_intel.c linux-2.6-tiwai-sound-niwei/sound/pci/hda/hda_intel.c

Quoted 1 line

--- linux-2.6-tiwai-sound/sound/pci/hda/hda_intel.c 2008-09-10

17:40:52.000000000 +0800

Quoted 1 line

+++ linux-2.6-tiwai-sound-niwei/sound/pci/hda/hda_intel.c

2008-09-10 17:49:31.000000000 +0800

Review static int __devinit azx_codec_create(st · line 1225

Quoted 7 lines
(quoted diff) +3 -0
@@ -1220,6 +1220,9 @@ static int __devinit azx_codec_create(st
 	if (err < 0)
 		return err;
 
+	if (chip->driver_type == AZX_DRIVER_NVIDIA)
+		chip->bus->needs_damn_long_delay = 1;
+

Do we really need this inevitably? I don't think so -- otherwise I would have far more bug reports.

This flag is the last resort and should be avoided as much as possible. This results in a significant slow down of suspend/resume speed, for example.

If it's really needed with some devices and there is no other way to fix it, add this flag rather in the codec-initialization part.

Quoted 9 lines

Also, if you resend a patch, please add the original patch description

again. This helps my patch work a lot indeed.

thanks,

Takashi

------------------------------------------------------------------------
-----------

Quoted 1 line

This email message is for the sole use of the intended recipient(s)

and may contain

Quoted 1 line

confidential information. Any unauthorized review, use, disclosure or

distribution

Quoted 1 line

is prohibited. If you are not the intended recipient, please contact

the sender by

Quoted 2 lines

reply email and destroy all copies of the original message.

------------------------------------------------------------------------
-----------

Quoted 1 line

From df8aab53c51f4b285dfc22f6ee1f982f6e81a377 Mon Sep 17 00:00:00 2001
From: root <[email protected]>
Date: Thu, 25 Sep 2008 14:49:54 +0800
Subject: [PATCH] Support NVIDIA MCP78 HDMI audio

---
 sound/pci/Kconfig            |    8 ++
 sound/pci/hda/Makefile       |    1 +
 sound/pci/hda/hda_codec.c    |    3 +
 sound/pci/hda/hda_patch.h    |    2 +
 sound/pci/hda/patch_nvhdmi.c |  164 ++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 178 insertions(+), 0 deletions(-)
 create mode 100644 sound/pci/hda/patch_nvhdmi.c
sound/pci/Kconfig +8 -0
index 1f8b796..7003711 100644
@@ -565,6 +565,14 @@ config SND_HDA_CODEC_ATIHDMI
 	  Say Y here to include ATI HDMI HD-audio codec support in
 	  snd-hda-intel driver, such as ATI RS600 HDMI.
 
+config SND_HDA_CODEC_NVHDMI
+	bool "Build NVIDIA HDMI HD-audio codec support"
+	depends on SND_HDA_INTEL
+	default y
+	help
+	  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_CONEXANT
 	bool "Build Conexant HD-audio codec support"
 	depends on SND_HDA_INTEL
sound/pci/hda/Makefile +1 -0
index 6db92fd..1980c6d 100644
@@ -15,5 +15,6 @@ snd-hda-intel-$(CONFIG_SND_HDA_CODEC_SI3054) += patch_si3054.o
 snd-hda-intel-$(CONFIG_SND_HDA_CODEC_ATIHDMI) += patch_atihdmi.o
 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
 
 obj-$(CONFIG_SND_HDA_INTEL) += snd-hda-intel.o
sound/pci/hda/hda_codec.c +3 -0
index c742e10..0da3a64 100644
@@ -94,6 +94,9 @@ static const struct hda_codec_preset *hda_preset_tables[] = {
 #ifdef CONFIG_SND_HDA_CODEC_VIA
 	snd_hda_preset_via,
 #endif
+#ifdef CONFIG_SND_HDA_CODEC_NVHDMI
+	snd_hda_preset_nvhdmi,
+#endif
 	NULL
 };
 
sound/pci/hda/hda_patch.h +2 -0
index 2fdf235..dfbcfa8 100644
@@ -18,3 +18,5 @@ extern struct hda_codec_preset snd_hda_preset_atihdmi[];
 extern struct hda_codec_preset snd_hda_preset_conexant[];
 /* VIA codecs */
 extern struct hda_codec_preset snd_hda_preset_via[];
+/* NVIDIA HDMI codecs */
+extern struct hda_codec_preset snd_hda_preset_nvhdmi[];
sound/pci/hda/patch_nvhdmi.c new file +164 -0

164 lines not on this page · raw message

Signature · 1 line
1.5.6

From 2b9a1e62b9ce599703d7dd73a0df5d82e9482a31 Mon Sep 17 00:00:00 2001
From: root <[email protected]>
Date: Thu, 25 Sep 2008 14:56:28 +0800
Subject: [PATCH] Fix for reading RIRB buffer on NVIDIA aza controller

---
 sound/pci/hda/hda_intel.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
sound/pci/hda/hda_intel.c +3 -0
index 60cc44a..9f316c1 100644
@@ -1220,6 +1220,9 @@ static int __devinit azx_codec_create(struct azx *chip, const char *model,
 	if (err < 0)
 		return err;
 
+	if (chip->driver_type == AZX_DRIVER_NVIDIA)
+		chip->bus->needs_damn_long_delay = 1;
+
 	codecs = audio_codecs = 0;
 	max_slots = azx_max_codecs[chip->driver_type];
 	if (!max_slots)
Signature · 1 line
1.5.6

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

#13 lore raw

Re: [alsa-devel] [PATCH] add the nvidia HDMI codec driverfor MCP77/79

At Thu, 25 Sep 2008 15:14:50 +0800,

Quoted 9 lines · Wei Ni

Hi, Takashi
I use git to generate patches. (I run git-fetch origin, git-fetch-rebase origin, and git-format-patch origin)

There are two patch, one for the addition of HDMI, and one for the fix for our aza controller.

Please check it.

Thanks for patches. It's good that you are using git now. The code changes look good, but there are small issues in the patches:

- The author line is bogus. Edit your ~/.gitconfig and add like the following:
[user]
name = Wei Ni
email = [email protected]
Then reset and commit patches again.

- Missing sign-off. Add --sign option when you do git-commit.

- No proper change log. Only a subject line isn't enough for many (most) cases, especially for a patch like workaround for nvidia controller.
Please describe why this change is needed more precisely.

Could you fix and repost again?

Thanks!

Takashi

Quoted 134 lines

Thanks

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Monday, September 22, 2008 5:58 PM
To: Wei Ni
Cc: peerchen; Pavel Hofman; Peer Chen; alsa-devel; linux-kernel; akpm
Subject: Re: [alsa-devel] [PATCH] add the nvidia HDMI codec driverfor MCP77/79

At Mon, 22 Sep 2008 14:33:58 +0800,

Quoted 6 lines · Wei Ni

Hi, Takashi

About the "long delay", it seemed that we need to add this "delay" to fix some issue on our aza controller.
Because it related with the controller, not just codec, so I think

this

Quoted 2 lines

flag should not be added in codec-initialization part.
I think it's better to add the flag in that place which I submitted.

OK, then could you split the patch to separate ones, i.e. one for the fix for this problem regarding Nvidia controller chip, and one for the addition of HDMI?

Don't forget to add a proper description for each patch, please ;)

As mentioned, that flag is a last resort, and I think it can be fixed in a saner way. But, the flag is surely safe, and we can track down the problem later on.

thanks,

Takashi

Quoted 11 lines

Thanks

-----Original Message-----
From: Wei Ni
Sent: Friday, September 19, 2008 12:43 PM
To: 'Takashi Iwai'; peerchen
Cc: Pavel Hofman; Peer Chen; alsa-devel; linux-kernel; akpm
Subject: RE: [alsa-devel] [PATCH] add the nvidia HDMI codec driverfor MCP77/79

Quoted 3 lines

Thanks for your reply.

About the "long delay", we had some problems on reading RIRB buffer

when

Quoted 54 lines

testing this driver, so we add this "delay"
We will try to find a best way to fix this issue.

And we didn't familiar with git, we will research it more such as "rebase" and then submit the patch file again.

Thanks

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Wednesday, September 17, 2008 10:05 PM
To: peerchen
Cc: Wei Ni; Pavel Hofman; Peer Chen; alsa-devel; linux-kernel; akpm
Subject: Re: [alsa-devel] [PATCH] add the nvidia HDMI codec driverfor MCP77/79

At Wed, 17 Sep 2008 17:00:04 +0800,

Quoted 5 lines · peerchen

new patch base on git tree.

Thanks!

But, the patch looks like no "rebase". You secretly added a new function call that wasn't in your previous patch, namely...

Quoted 1 line

diff -uprN -X linux-2.6-tiwai-sound/Documentation/dontdiff

linux-2.6-tiwai-sound/sound/pci/hda/hda_intel.c linux-2.6-tiwai-sound-niwei/sound/pci/hda/hda_intel.c

Quoted 1 line

--- linux-2.6-tiwai-sound/sound/pci/hda/hda_intel.c 2008-09-10

17:40:52.000000000 +0800

Quoted 1 line

+++ linux-2.6-tiwai-sound-niwei/sound/pci/hda/hda_intel.c

2008-09-10 17:49:31.000000000 +0800

sound/pci/hda/hda_intel.c static int __devinit azx_codec_create(st · line 1225

Quoted 7 lines
sound/pci/hda/hda_intel.c +3 -0
@@ -1220,6 +1220,9 @@ static int __devinit azx_codec_create(st
 	if (err < 0)
 		return err;
 
+	if (chip->driver_type == AZX_DRIVER_NVIDIA)
+		chip->bus->needs_damn_long_delay = 1;
+

Do we really need this inevitably? I don't think so -- otherwise I would have far more bug reports.

This flag is the last resort and should be avoided as much as possible. This results in a significant slow down of suspend/resume speed, for example.

If it's really needed with some devices and there is no other way to fix it, add this flag rather in the codec-initialization part.

Quoted 9 lines

Also, if you resend a patch, please add the original patch description

again. This helps my patch work a lot indeed.

thanks,

Takashi

------------------------------------------------------------------------
-----------

Quoted 1 line

This email message is for the sole use of the intended recipient(s)

and may contain

Quoted 1 line

confidential information. Any unauthorized review, use, disclosure or

distribution

Quoted 1 line

is prohibited. If you are not the intended recipient, please contact

the sender by

Quoted 2 lines

reply email and destroy all copies of the original message.

------------------------------------------------------------------------
-----------

Quoted 1 line

[2 0001-Support-NVIDIA-MCP78-HDMI-audio.patch <application/octet-stream (base64)>]

[3 0002-Fix-for-reading-RIRB-buffer-on-NVIDIA-aza-controller.patch <application/octet-stream (base64)>]

#14 lore raw

RE: [alsa-devel] [PATCH] add the nvidia HDMI codec driverfor MCP77/79

Thanks for your comments, I will fix and repost again.

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Thursday, September 25, 2008 5:55 PM
To: Wei Ni
Cc: peerchen; Pavel Hofman; Peer Chen; alsa-devel; linux-kernel; akpm
Subject: Re: [alsa-devel] [PATCH] add the nvidia HDMI codec driverfor MCP77/79

At Thu, 25 Sep 2008 15:14:50 +0800,

Quoted 3 lines · Wei Ni

Hi, Takashi
I use git to generate patches. (I run git-fetch origin,

git-fetch-rebase

Quoted 6 lines

origin, and git-format-patch origin)

There are two patch, one for the addition of HDMI, and one for the fix for our aza controller.

Please check it.

Thanks for patches. It's good that you are using git now. The code changes look good, but there are small issues in the patches:

- The author line is bogus. Edit your ~/.gitconfig and add like the following:
[user]
name = Wei Ni
email = [email protected]
Then reset and commit patches again.

- Missing sign-off. Add --sign option when you do git-commit.

- No proper change log. Only a subject line isn't enough for many (most) cases, especially for a patch like workaround for nvidia controller.
Please describe why this change is needed more precisely.

Could you fix and repost again?

Thanks!

Takashi

Quoted 11 lines

Thanks

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Monday, September 22, 2008 5:58 PM
To: Wei Ni
Cc: peerchen; Pavel Hofman; Peer Chen; alsa-devel; linux-kernel; akpm
Subject: Re: [alsa-devel] [PATCH] add the nvidia HDMI codec driverfor MCP77/79

Quoted 6 lines

At Mon, 22 Sep 2008 14:33:58 +0800,

Quoted 4 lines · Wei Ni

Hi, Takashi

About the "long delay", it seemed that we need to add this "delay"

to

Quoted 12 lines
Quoted 2 lines

fix some issue on our aza controller.
Because it related with the controller, not just codec, so I think

this

Quoted 2 lines

flag should not be added in codec-initialization part.
I think it's better to add the flag in that place which I submitted.

OK, then could you split the patch to separate ones, i.e. one for the fix for this problem regarding Nvidia controller chip, and one for the addition of HDMI?

Don't forget to add a proper description for each patch, please ;)

Quoted 19 lines

As mentioned, that flag is a last resort, and I think it can be fixed in a saner way. But, the flag is surely safe, and we can track down the problem later on.

thanks,

Takashi

Quoted 9 lines

Thanks

-----Original Message-----
From: Wei Ni
Sent: Friday, September 19, 2008 12:43 PM
To: 'Takashi Iwai'; peerchen
Cc: Pavel Hofman; Peer Chen; alsa-devel; linux-kernel; akpm
Subject: RE: [alsa-devel] [PATCH] add the nvidia HDMI codec

driverfor

Quoted 20 lines
Quoted 5 lines

MCP77/79

Thanks for your reply.

About the "long delay", we had some problems on reading RIRB buffer

when

Quoted 14 lines

testing this driver, so we add this "delay"
We will try to find a best way to fix this issue.

And we didn't familiar with git, we will research it more such as "rebase" and then submit the patch file again.

Thanks

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Wednesday, September 17, 2008 10:05 PM
To: peerchen
Cc: Wei Ni; Pavel Hofman; Peer Chen; alsa-devel; linux-kernel; akpm
Subject: Re: [alsa-devel] [PATCH] add the nvidia HDMI codec

driverfor

Quoted 12 lines
Quoted 12 lines

MCP77/79

At Wed, 17 Sep 2008 17:00:04 +0800,

Quoted 5 lines · peerchen

new patch base on git tree.

Thanks!

Quoted 7 lines
Quoted 7 lines

But, the patch looks like no "rebase". You secretly added a new function call that wasn't in your previous patch, namely...

Quoted 1 line

diff -uprN -X linux-2.6-tiwai-sound/Documentation/dontdiff

linux-2.6-tiwai-sound/sound/pci/hda/hda_intel.c linux-2.6-tiwai-sound-niwei/sound/pci/hda/hda_intel.c

Quoted 1 line

--- linux-2.6-tiwai-sound/sound/pci/hda/hda_intel.c

2008-09-10

Quoted 14 lines
Quoted 14 lines

17:40:52.000000000 +0800

Quoted 1 line

+++ linux-2.6-tiwai-sound-niwei/sound/pci/hda/hda_intel.c

2008-09-10 17:49:31.000000000 +0800

sound/pci/hda/hda_intel.c static int __devinit azx_codec_create(st · line 1225

Quoted 7 lines
sound/pci/hda/hda_intel.c +3 -0
@@ -1220,6 +1220,9 @@ static int __devinit azx_codec_create(st
 	if (err < 0)
 		return err;
 
+	if (chip->driver_type == AZX_DRIVER_NVIDIA)
+		chip->bus->needs_damn_long_delay = 1;
+

Do we really need this inevitably? I don't think so -- otherwise I would have far more bug reports.

Quoted 8 lines
Quoted 8 lines

This flag is the last resort and should be avoided as much as possible. This results in a significant slow down of suspend/resume speed, for example.

If it's really needed with some devices and there is no other way to fix it, add this flag rather in the codec-initialization part.

Also, if you resend a patch, please add the original patch

description

Quoted 9 lines
Quoted 8 lines

again. This helps my patch work a lot indeed.

thanks,

Takashi

------------------------------------------------------------------------

Quoted 4 lines

-----------

Quoted 1 line

This email message is for the sole use of the intended recipient(s)

and may contain

Quoted 1 line

confidential information. Any unauthorized review, use, disclosure

or

Quoted 2 lines

distribution

Quoted 1 line

is prohibited. If you are not the intended recipient, please

contact

Quoted 4 lines

the sender by

Quoted 2 lines

reply email and destroy all copies of the original message.

------------------------------------------------------------------------

Quoted 3 lines

-----------

Quoted 1 line

[2 0001-Support-NVIDIA-MCP78-HDMI-audio.patch

<application/octet-stream (base64)>]

Quoted 2 lines

[3 0002-Fix-for-reading-RIRB-buffer-on-NVIDIA-aza-controller.patch

<application/octet-stream (base64)>]

Quoted 1 line
#17 lore raw

RE: [alsa-devel] [PATCH] add the nvidia HDMI codec driverfor MCP77/79

In reply to Takashi Iwai

Hi, Takashi
I fixed something based on your comments, please check the patch files.

Thanks

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Thursday, September 25, 2008 5:55 PM
To: Wei Ni
Cc: peerchen; Pavel Hofman; Peer Chen; alsa-devel; linux-kernel; akpm
Subject: Re: [alsa-devel] [PATCH] add the nvidia HDMI codec driverfor MCP77/79

At Thu, 25 Sep 2008 15:14:50 +0800,

Quoted 3 lines · Wei Ni

Hi, Takashi
I use git to generate patches. (I run git-fetch origin,

git-fetch-rebase

Quoted 6 lines

origin, and git-format-patch origin)

There are two patch, one for the addition of HDMI, and one for the fix for our aza controller.

Please check it.

Thanks for patches. It's good that you are using git now. The code changes look good, but there are small issues in the patches:

- The author line is bogus. Edit your ~/.gitconfig and add like the following:
[user]
name = Wei Ni
email = [email protected]
Then reset and commit patches again.

- Missing sign-off. Add --sign option when you do git-commit.

- No proper change log. Only a subject line isn't enough for many (most) cases, especially for a patch like workaround for nvidia controller.
Please describe why this change is needed more precisely.

Could you fix and repost again?

Thanks!

Takashi

Quoted 11 lines

Thanks

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Monday, September 22, 2008 5:58 PM
To: Wei Ni
Cc: peerchen; Pavel Hofman; Peer Chen; alsa-devel; linux-kernel; akpm
Subject: Re: [alsa-devel] [PATCH] add the nvidia HDMI codec driverfor MCP77/79

Quoted 6 lines

At Mon, 22 Sep 2008 14:33:58 +0800,

Quoted 4 lines · Wei Ni

Hi, Takashi

About the "long delay", it seemed that we need to add this "delay"

to

Quoted 12 lines
Quoted 2 lines

fix some issue on our aza controller.
Because it related with the controller, not just codec, so I think

this

Quoted 2 lines

flag should not be added in codec-initialization part.
I think it's better to add the flag in that place which I submitted.

OK, then could you split the patch to separate ones, i.e. one for the fix for this problem regarding Nvidia controller chip, and one for the addition of HDMI?

Don't forget to add a proper description for each patch, please ;)

Quoted 19 lines

As mentioned, that flag is a last resort, and I think it can be fixed in a saner way. But, the flag is surely safe, and we can track down the problem later on.

thanks,

Takashi

Quoted 9 lines

Thanks

-----Original Message-----
From: Wei Ni
Sent: Friday, September 19, 2008 12:43 PM
To: 'Takashi Iwai'; peerchen
Cc: Pavel Hofman; Peer Chen; alsa-devel; linux-kernel; akpm
Subject: RE: [alsa-devel] [PATCH] add the nvidia HDMI codec

driverfor

Quoted 20 lines
Quoted 5 lines

MCP77/79

Thanks for your reply.

About the "long delay", we had some problems on reading RIRB buffer

when

Quoted 14 lines

testing this driver, so we add this "delay"
We will try to find a best way to fix this issue.

And we didn't familiar with git, we will research it more such as "rebase" and then submit the patch file again.

Thanks

-----Original Message-----
From: Takashi Iwai [mailto:[email protected]]
Sent: Wednesday, September 17, 2008 10:05 PM
To: peerchen
Cc: Wei Ni; Pavel Hofman; Peer Chen; alsa-devel; linux-kernel; akpm
Subject: Re: [alsa-devel] [PATCH] add the nvidia HDMI codec

driverfor

Quoted 12 lines
Quoted 12 lines

MCP77/79

At Wed, 17 Sep 2008 17:00:04 +0800,

Quoted 5 lines · peerchen

new patch base on git tree.

Thanks!

Quoted 7 lines
Quoted 7 lines

But, the patch looks like no "rebase". You secretly added a new function call that wasn't in your previous patch, namely...

Quoted 1 line

diff -uprN -X linux-2.6-tiwai-sound/Documentation/dontdiff

linux-2.6-tiwai-sound/sound/pci/hda/hda_intel.c linux-2.6-tiwai-sound-niwei/sound/pci/hda/hda_intel.c

Quoted 1 line

--- linux-2.6-tiwai-sound/sound/pci/hda/hda_intel.c

2008-09-10

Quoted 14 lines
Quoted 14 lines

17:40:52.000000000 +0800

Quoted 1 line

+++ linux-2.6-tiwai-sound-niwei/sound/pci/hda/hda_intel.c

2008-09-10 17:49:31.000000000 +0800

Review static int __devinit azx_codec_create(st · line 1225

Quoted 7 lines
(quoted diff) +3 -0
@@ -1220,6 +1220,9 @@ static int __devinit azx_codec_create(st
 	if (err < 0)
 		return err;
 
+	if (chip->driver_type == AZX_DRIVER_NVIDIA)
+		chip->bus->needs_damn_long_delay = 1;
+

Do we really need this inevitably? I don't think so -- otherwise I would have far more bug reports.

Quoted 8 lines
Quoted 8 lines

This flag is the last resort and should be avoided as much as possible. This results in a significant slow down of suspend/resume speed, for example.

If it's really needed with some devices and there is no other way to fix it, add this flag rather in the codec-initialization part.

Also, if you resend a patch, please add the original patch

description

Quoted 9 lines
Quoted 8 lines

again. This helps my patch work a lot indeed.

thanks,

Takashi

------------------------------------------------------------------------

Quoted 4 lines

-----------

Quoted 1 line

This email message is for the sole use of the intended recipient(s)

and may contain

Quoted 1 line

confidential information. Any unauthorized review, use, disclosure

or

Quoted 2 lines

distribution

Quoted 1 line

is prohibited. If you are not the intended recipient, please

contact

Quoted 4 lines

the sender by

Quoted 2 lines

reply email and destroy all copies of the original message.

------------------------------------------------------------------------

Quoted 3 lines

-----------

Quoted 1 line

[2 0001-Support-NVIDIA-MCP78-HDMI-audio.patch

<application/octet-stream (base64)>]

Quoted 2 lines

[3 0002-Fix-for-reading-RIRB-buffer-on-NVIDIA-aza-controller.patch

<application/octet-stream (base64)>]

Quoted 1 line

From 982290df7077cef44dc6f7dca679ae6c6f85b9bd Mon Sep 17 00:00:00 2001
From: Wei Ni <[email protected]>
Date: Fri, 26 Sep 2008 13:45:46 +0800
Subject: [PATCH] Support NVIDIA MCP78/7A HDMI audio

Add NVIDIA HDMI HD-audio codec support in snd-hda-intel driver, include NVIDIA MCP78/7A HDMI.

---
 sound/pci/Kconfig            |    8 ++
 sound/pci/hda/Makefile       |    1 +
 sound/pci/hda/hda_codec.c    |    3 +
 sound/pci/hda/hda_patch.h    |    2 +
 sound/pci/hda/patch_nvhdmi.c |  164 ++++++++++++++++++++++++++++++++++++++++++
 5 files changed, 178 insertions(+), 0 deletions(-)
 create mode 100644 sound/pci/hda/patch_nvhdmi.c
sound/pci/Kconfig +8 -0
index 1f8b796..7003711 100644
@@ -565,6 +565,14 @@ config SND_HDA_CODEC_ATIHDMI
 	  Say Y here to include ATI HDMI HD-audio codec support in
 	  snd-hda-intel driver, such as ATI RS600 HDMI.
 
+config SND_HDA_CODEC_NVHDMI
+	bool "Build NVIDIA HDMI HD-audio codec support"
+	depends on SND_HDA_INTEL
+	default y
+	help
+	  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_CONEXANT
 	bool "Build Conexant HD-audio codec support"
 	depends on SND_HDA_INTEL
sound/pci/hda/Makefile +1 -0
index 6db92fd..1980c6d 100644
@@ -15,5 +15,6 @@ snd-hda-intel-$(CONFIG_SND_HDA_CODEC_SI3054) += patch_si3054.o
 snd-hda-intel-$(CONFIG_SND_HDA_CODEC_ATIHDMI) += patch_atihdmi.o
 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
 
 obj-$(CONFIG_SND_HDA_INTEL) += snd-hda-intel.o
sound/pci/hda/hda_codec.c +3 -0
index 94ea654..fdb6d55 100644
@@ -94,6 +94,9 @@ static const struct hda_codec_preset *hda_preset_tables[] = {
 #ifdef CONFIG_SND_HDA_CODEC_VIA
 	snd_hda_preset_via,
 #endif
+#ifdef CONFIG_SND_HDA_CODEC_NVHDMI
+	snd_hda_preset_nvhdmi,
+#endif
 	NULL
 };
 
sound/pci/hda/hda_patch.h +2 -0
index 2fdf235..dfbcfa8 100644
@@ -18,3 +18,5 @@ extern struct hda_codec_preset snd_hda_preset_atihdmi[];
 extern struct hda_codec_preset snd_hda_preset_conexant[];
 /* VIA codecs */
 extern struct hda_codec_preset snd_hda_preset_via[];
+/* NVIDIA HDMI codecs */
+extern struct hda_codec_preset snd_hda_preset_nvhdmi[];
sound/pci/hda/patch_nvhdmi.c new file +164 -0

164 lines not on this page · raw message

Signature · 1 line
1.5.6

From 2e77787cae6652a76f48f499c61218acb70baee8 Mon Sep 17 00:00:00 2001
From: Wei Ni <[email protected]>
Date: Fri, 26 Sep 2008 13:55:56 +0800
Subject: [PATCH] Fix for reading RIRB buffer on NVIDIA aza controller with AMD Phenom cpu

When read RIRB buffer immediately after RIRB interrupt received, sometimes the data will be "0x0". If we wait for some time, the data in buffer will be correct. This issue only occurred with AMD Phenom cpu. So we set this "needs_damn_long_delay" flag.

---
 sound/pci/hda/hda_intel.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
sound/pci/hda/hda_intel.c +3 -0
index 60cc44a..9f316c1 100644
@@ -1220,6 +1220,9 @@ static int __devinit azx_codec_create(struct azx *chip, const char *model,
 	if (err < 0)
 		return err;
 
+	if (chip->driver_type == AZX_DRIVER_NVIDIA)
+		chip->bus->needs_damn_long_delay = 1;
+
 	codecs = audio_codecs = 0;
 	max_slots = azx_max_codecs[chip->driver_type];
 	if (!max_slots)
Signature · 1 line
1.5.6

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

#18 lore raw

Re: [alsa-devel] [PATCH] add the nvidia HDMI codec driverfor MCP77/79

At Fri, 26 Sep 2008 14:19:46 +0800,

Quoted 3 lines · Wei Ni

Hi, Takashi
I fixed something based on your comments, please check the patch files.

Thanks! I applied both patches now after formatting comments. These will be included in 2.6.28.

(At the next time, please put your sign-off at the end of commit log,
and add line breaks appropriately to keep commit log in 80 or less column letters.)

Takashi

#15 lore raw

Re: [PATCH] add the nvidia HDMI codec driverfor MCP77/79

In reply to Wei Ni

Hi,

did we forgot alsa-driver/pci/hda/patch_nvhdmi.c file?

this is my first posting to the list so be tolerant, please.

regards,

Signature · 1 line
Pawel
Quoted 1 line

From bc19dfbcc8458ebecd8f458b6566ccef119a3d4c Mon Sep 17 00:00:00 2001

From: Pawel Krzesniak <[email protected]>
Date: Fri, 26 Sep 2008 11:39:02 +0200
Subject: [PATCH] Missing file for NVIDIA HDMI HD-audio support.

Missing file for NVIDIA HDMI HD-audio support.

---
 pci/hda/patch_nvhdmi.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
 create mode 100644 pci/hda/patch_nvhdmi.c
pci/hda/patch_nvhdmi.c new file +3 -0
new file mode 100644
index 0000000..3e700fd
@@ -0,0 +1,3 @@
+#define __NO_VERSION__
+#include "adriver.h"
+#include "../../alsa-kernel/pci/hda/patch_nvhdmi.c"
Signature · 1 line
1.5.4.3

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

#16 lore raw

Re: [PATCH] add the nvidia HDMI codec driverfor MCP77/79

At Fri, 26 Sep 2008 12:22:51 +0200,

Quoted 6 lines · Pawel Krzesniak

Hi,

did we forgot alsa-driver/pci/hda/patch_nvhdmi.c file?

this is my first posting to the list so be tolerant, please.

Heh, you're right. Forgot that one.
Now pushed out to my git tree.

thanks,

Takashi