All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support
@ 2013-10-24 18:10 Anssi Hannula
  2013-10-24 18:10 ` [PATCH 1/5] ALSA: hda - hdmi: Allow HDA patches to customize more operations Anssi Hannula
                   ` (8 more replies)
  0 siblings, 9 replies; 71+ messages in thread
From: Anssi Hannula @ 2013-10-24 18:10 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: Olivier Langlois, alsa-devel, Peter Frühberger

Hi all!

Here's another revision of the ATI/AMD multichannel+HBR patchset.

Changes:
- added customizable callbacks instead of polluting generic code
- fixed wrong codec id in rev3+ check (as previously noted)
- cosmetics

I've only tested this on NVIDIA/Intel, but I'd guess at least Peter
should be able to test this on AMD in a few days or so. The earlier
revisions were tested to fully work.

Combined patch can be found at: http://onse.fi/files/atihdmi5.patch
However, this patchset is on top recent sound-next commits so it does not
directly apply on older kernels.

Olivier, I hope you will be able to test this at some point as well
(same things as last time), even though it will be a bit more work :)

Anssi Hannula (5):
      ALSA: hda - hdmi: Allow HDA patches to customize more operations
      ALSA: hda - hdmi: Add ATI/AMD multi-channel audio support
      ALSA: hda - hdmi: Add ELD emulation for ATI/AMD codecs
      ALSA: hda - hdmi: Add HBR bitstreaming support for ATI/AMD HDMI codecs
      ALSA: hda - hdmi: Disable ramp-up/down for non-PCM on AMD codecs

 sound/pci/hda/hda_eld.c    | 151 +++++++++++
 sound/pci/hda/hda_local.h  |   4 +
 sound/pci/hda/patch_hdmi.c | 643 +++++++++++++++++++++++++++++++++++++--------
 3 files changed, 689 insertions(+), 109 deletions(-)

-- 
Anssi Hannula

^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 1/5] ALSA: hda - hdmi: Allow HDA patches to customize more operations
  2013-10-24 18:10 [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support Anssi Hannula
@ 2013-10-24 18:10 ` Anssi Hannula
  2013-10-24 18:10 ` [PATCH 2/5] ALSA: hda - hdmi: Add ATI/AMD multi-channel audio support Anssi Hannula
                   ` (7 subsequent siblings)
  8 siblings, 0 replies; 71+ messages in thread
From: Anssi Hannula @ 2013-10-24 18:10 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: Olivier Langlois, alsa-devel, Peter Frühberger

Upcoming AMD multichannel support requires many customized operations
(channel mapping, ELD, HBR) but can otherwise share most of its code
with the generic patch.

Add a local struct hdmi_ops containing customizable HDMI-specific
callbacks and move the current code to those callbacks. Functionality is
unaltered.

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
---
 sound/pci/hda/patch_hdmi.c | 275 ++++++++++++++++++++++++++++++++-------------
 1 file changed, 195 insertions(+), 80 deletions(-)

diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index a1fe4bb..b11cbe0 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -82,6 +82,39 @@ struct hdmi_spec_per_pin {
 #endif
 };
 
+struct cea_channel_speaker_allocation;
+
+/* operations used by generic code that can be overridden by patches */
+struct hdmi_ops {
+	int (*pin_get_eld)(struct hda_codec *codec, hda_nid_t pin_nid,
+			   unsigned char *buf, int *eld_size);
+
+	/* get and set channel assigned to each HDMI ASP (audio sample packet) slot */
+	int (*pin_get_slot_channel)(struct hda_codec *codec, hda_nid_t pin_nid,
+				    int asp_slot);
+	int (*pin_set_slot_channel)(struct hda_codec *codec, hda_nid_t pin_nid,
+				    int asp_slot, int channel);
+
+	void (*pin_setup_infoframe)(struct hda_codec *codec, hda_nid_t pin_nid,
+				    int ca, int active_channels, int conn_type);
+
+	/* enable/disable HBR (HD passthrough) */
+	int (*pin_hbr_setup)(struct hda_codec *codec, hda_nid_t pin_nid, bool hbr);
+
+	int (*setup_stream)(struct hda_codec *codec, hda_nid_t cvt_nid,
+			    hda_nid_t pin_nid, u32 stream_tag, int format);
+
+	/* Helpers for producing the channel map TLVs. These can be overridden
+	 * for devices that have non-standard mapping requirements. */
+	int (*chmap_cea_alloc_validate_get_type)(struct cea_channel_speaker_allocation *cap,
+						 int channels);
+	void (*cea_alloc_to_tlv_chmap)(struct cea_channel_speaker_allocation *cap,
+				       unsigned int *chmap, int channels);
+
+	/* check that the user-given chmap is supported */
+	int (*chmap_validate)(int ca, int channels, unsigned char *chmap);
+};
+
 struct hdmi_spec {
 	int num_cvts;
 	struct snd_array cvts; /* struct hdmi_spec_per_cvt */
@@ -93,6 +126,7 @@ struct hdmi_spec {
 	unsigned int channels_max; /* max over all cvts */
 
 	struct hdmi_eld temp_eld;
+	struct hdmi_ops ops;
 	/*
 	 * Non-generic ATI/NVIDIA specific
 	 */
@@ -648,24 +682,24 @@ static void hdmi_debug_channel_mapping(struct hda_codec *codec,
 				       hda_nid_t pin_nid)
 {
 #ifdef CONFIG_SND_DEBUG_VERBOSE
+	struct hdmi_spec *spec = codec->spec;
 	int i;
-	int slot;
+	int channel;
 
 	for (i = 0; i < 8; i++) {
-		slot = snd_hda_codec_read(codec, pin_nid, 0,
-						AC_VERB_GET_HDMI_CHAN_SLOT, i);
+		channel = spec->ops.pin_get_slot_channel(codec, pin_nid, i);
 		printk(KERN_DEBUG "HDMI: ASP channel %d => slot %d\n",
-						slot >> 4, slot & 0xf);
+						channel, i);
 	}
 #endif
 }
 
-
 static void hdmi_std_setup_channel_mapping(struct hda_codec *codec,
 				       hda_nid_t pin_nid,
 				       bool non_pcm,
 				       int ca)
 {
+	struct hdmi_spec *spec = codec->spec;
 	struct cea_channel_speaker_allocation *ch_alloc;
 	int i;
 	int err;
@@ -698,9 +732,10 @@ static void hdmi_std_setup_channel_mapping(struct hda_codec *codec,
 	}
 
 	for (i = 0; i < 8; i++) {
-		err = snd_hda_codec_write(codec, pin_nid, 0,
-					  AC_VERB_SET_HDMI_CHAN_SLOT,
-					  non_pcm ? non_pcm_mapping[i] : hdmi_channel_mapping[ca][i]);
+		int slotsetup = non_pcm ? non_pcm_mapping[i] : hdmi_channel_mapping[ca][i];
+		int hdmi_slot = slotsetup & 0x0f;
+		int channel = (slotsetup & 0xf0) >> 4;
+		err = spec->ops.pin_set_slot_channel(codec, pin_nid, hdmi_slot, channel);
 		if (err) {
 			snd_printdd(KERN_NOTICE
 				    "HDMI: channel mapping failed\n");
@@ -810,6 +845,7 @@ static int hdmi_manual_setup_channel_mapping(struct hda_codec *codec,
 					     int chs, unsigned char *map,
 					     int ca)
 {
+	struct hdmi_spec *spec = codec->spec;
 	int ordered_ca = get_channel_allocation_order(ca);
 	int alsa_pos, hdmi_slot;
 	int assignments[8] = {[0 ... 7] = 0xf};
@@ -825,11 +861,10 @@ static int hdmi_manual_setup_channel_mapping(struct hda_codec *codec,
 	}
 
 	for (hdmi_slot = 0; hdmi_slot < 8; hdmi_slot++) {
-		int val, err;
+		int err;
 
-		val = (assignments[hdmi_slot] << 4) | hdmi_slot;
-		err = snd_hda_codec_write(codec, pin_nid, 0,
-					  AC_VERB_SET_HDMI_CHAN_SLOT, val);
+		err = spec->ops.pin_set_slot_channel(codec, pin_nid, hdmi_slot,
+						     assignments[hdmi_slot]);
 		if (err)
 			return -EINVAL;
 	}
@@ -865,6 +900,22 @@ static void hdmi_setup_channel_mapping(struct hda_codec *codec,
 	hdmi_debug_channel_mapping(codec, pin_nid);
 }
 
+static int hdmi_pin_set_slot_channel(struct hda_codec *codec, hda_nid_t pin_nid,
+				     int asp_slot, int channel)
+{
+	return snd_hda_codec_write(codec, pin_nid, 0,
+				   AC_VERB_SET_HDMI_CHAN_SLOT,
+				   (channel << 4) | asp_slot);
+}
+
+static int hdmi_pin_get_slot_channel(struct hda_codec *codec, hda_nid_t pin_nid,
+				     int asp_slot)
+{
+	return (snd_hda_codec_read(codec, pin_nid, 0,
+				   AC_VERB_GET_HDMI_CHAN_SLOT,
+				   asp_slot) & 0xf0) >> 4;
+}
+
 /*
  * Audio InfoFrame routines
  */
@@ -986,16 +1037,64 @@ static bool hdmi_infoframe_uptodate(struct hda_codec *codec, hda_nid_t pin_nid,
 	return true;
 }
 
+static void hdmi_pin_setup_infoframe(struct hda_codec *codec,
+				     hda_nid_t pin_nid,
+				     int ca, int active_channels,
+				     int conn_type)
+{
+	union audio_infoframe ai;
+
+	if (conn_type == 0) { /* HDMI */
+		struct hdmi_audio_infoframe *hdmi_ai = &ai.hdmi;
+
+		hdmi_ai->type		= 0x84;
+		hdmi_ai->ver		= 0x01;
+		hdmi_ai->len		= 0x0a;
+		hdmi_ai->CC02_CT47	= active_channels - 1;
+		hdmi_ai->CA		= ca;
+		hdmi_checksum_audio_infoframe(hdmi_ai);
+	} else if (conn_type == 1) { /* DisplayPort */
+		struct dp_audio_infoframe *dp_ai = &ai.dp;
+
+		dp_ai->type		= 0x84;
+		dp_ai->len		= 0x1b;
+		dp_ai->ver		= 0x11 << 2;
+		dp_ai->CC02_CT47	= active_channels - 1;
+		dp_ai->CA		= ca;
+	} else {
+		snd_printd("HDMI: unknown connection type at pin %d\n",
+			    pin_nid);
+		return;
+	}
+
+	/*
+	 * sizeof(ai) is used instead of sizeof(*hdmi_ai) or
+	 * sizeof(*dp_ai) to avoid partial match/update problems when
+	 * the user switches between HDMI/DP monitors.
+	 */
+	if (!hdmi_infoframe_uptodate(codec, pin_nid, ai.bytes,
+					sizeof(ai))) {
+		snd_printdd("hdmi_pin_setup_infoframe: "
+			    "pin=%d channels=%d ca=0x%02x\n",
+			    pin_nid,
+			    active_channels, ca);
+		hdmi_stop_infoframe_trans(codec, pin_nid);
+		hdmi_fill_audio_infoframe(codec, pin_nid,
+					    ai.bytes, sizeof(ai));
+		hdmi_start_infoframe_trans(codec, pin_nid);
+	}
+}
+
 static void hdmi_setup_audio_infoframe(struct hda_codec *codec,
 				       struct hdmi_spec_per_pin *per_pin,
 				       bool non_pcm)
 {
+	struct hdmi_spec *spec = codec->spec;
 	hda_nid_t pin_nid = per_pin->pin_nid;
 	int channels = per_pin->channels;
 	int active_channels;
 	struct hdmi_eld *eld;
 	int ca, ordered_ca;
-	union audio_infoframe ai;
 
 	if (!channels)
 		return;
@@ -1021,30 +1120,6 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec,
 
 	hdmi_set_channel_count(codec, per_pin->cvt_nid, active_channels);
 
-	memset(&ai, 0, sizeof(ai));
-	if (eld->info.conn_type == 0) { /* HDMI */
-		struct hdmi_audio_infoframe *hdmi_ai = &ai.hdmi;
-
-		hdmi_ai->type		= 0x84;
-		hdmi_ai->ver		= 0x01;
-		hdmi_ai->len		= 0x0a;
-		hdmi_ai->CC02_CT47	= active_channels - 1;
-		hdmi_ai->CA		= ca;
-		hdmi_checksum_audio_infoframe(hdmi_ai);
-	} else if (eld->info.conn_type == 1) { /* DisplayPort */
-		struct dp_audio_infoframe *dp_ai = &ai.dp;
-
-		dp_ai->type		= 0x84;
-		dp_ai->len		= 0x1b;
-		dp_ai->ver		= 0x11 << 2;
-		dp_ai->CC02_CT47	= active_channels - 1;
-		dp_ai->CA		= ca;
-	} else {
-		snd_printd("HDMI: unknown connection type at pin %d\n",
-			    pin_nid);
-		return;
-	}
-
 	/*
 	 * always configure channel mapping, it may have been changed by the
 	 * user in the meantime
@@ -1053,27 +1128,12 @@ static void hdmi_setup_audio_infoframe(struct hda_codec *codec,
 				   channels, per_pin->chmap,
 				   per_pin->chmap_set);
 
-	/*
-	 * sizeof(ai) is used instead of sizeof(*hdmi_ai) or
-	 * sizeof(*dp_ai) to avoid partial match/update problems when
-	 * the user switches between HDMI/DP monitors.
-	 */
-	if (!hdmi_infoframe_uptodate(codec, pin_nid, ai.bytes,
-					sizeof(ai))) {
-		snd_printdd("hdmi_setup_audio_infoframe: "
-			    "pin=%d channels=%d ca=0x%02x\n",
-			    pin_nid,
-			    active_channels, ca);
-		hdmi_stop_infoframe_trans(codec, pin_nid);
-		hdmi_fill_audio_infoframe(codec, pin_nid,
-					    ai.bytes, sizeof(ai));
-		hdmi_start_infoframe_trans(codec, pin_nid);
-	}
+	spec->ops.pin_setup_infoframe(codec, pin_nid, ca, active_channels,
+				      eld->info.conn_type);
 
 	per_pin->non_pcm = non_pcm;
 }
 
-
 /*
  * Unsolicited events
  */
@@ -1176,26 +1236,22 @@ static void haswell_verify_D0(struct hda_codec *codec,
 #define is_hbr_format(format) \
 	((format & AC_FMT_TYPE_NON_PCM) && (format & AC_FMT_CHAN_MASK) == 7)
 
-static int hdmi_setup_stream(struct hda_codec *codec, hda_nid_t cvt_nid,
-			      hda_nid_t pin_nid, u32 stream_tag, int format)
+static int hdmi_pin_hbr_setup(struct hda_codec *codec, hda_nid_t pin_nid,
+			      bool hbr)
 {
-	int pinctl;
-	int new_pinctl = 0;
-
-	if (is_haswell(codec))
-		haswell_verify_D0(codec, cvt_nid, pin_nid);
+	int pinctl, new_pinctl;
 
 	if (snd_hda_query_pin_caps(codec, pin_nid) & AC_PINCAP_HBR) {
 		pinctl = snd_hda_codec_read(codec, pin_nid, 0,
 					    AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
 
 		new_pinctl = pinctl & ~AC_PINCTL_EPT;
-		if (is_hbr_format(format))
+		if (hbr)
 			new_pinctl |= AC_PINCTL_EPT_HBR;
 		else
 			new_pinctl |= AC_PINCTL_EPT_NATIVE;
 
-		snd_printdd("hdmi_setup_stream: "
+		snd_printdd("hdmi_pin_hbr_setup: "
 			    "NID=0x%x, %spinctl=0x%x\n",
 			    pin_nid,
 			    pinctl == new_pinctl ? "" : "new-",
@@ -1205,11 +1261,26 @@ static int hdmi_setup_stream(struct hda_codec *codec, hda_nid_t cvt_nid,
 			snd_hda_codec_write(codec, pin_nid, 0,
 					    AC_VERB_SET_PIN_WIDGET_CONTROL,
 					    new_pinctl);
+	} else if (hbr)
+		return -EINVAL;
 
-	}
-	if (is_hbr_format(format) && !new_pinctl) {
+	return 0;
+}
+
+static int hdmi_setup_stream(struct hda_codec *codec, hda_nid_t cvt_nid,
+			      hda_nid_t pin_nid, u32 stream_tag, int format)
+{
+	struct hdmi_spec *spec = codec->spec;
+	int err;
+
+	if (is_haswell(codec))
+		haswell_verify_D0(codec, cvt_nid, pin_nid);
+
+	err = spec->ops.pin_hbr_setup(codec, pin_nid, is_hbr_format(format));
+
+	if (err) {
 		snd_printdd("hdmi_setup_stream: HBR is not supported\n");
-		return -EINVAL;
+		return err;
 	}
 
 	snd_hda_codec_setup_stream(codec, cvt_nid, stream_tag, 0, format);
@@ -1424,7 +1495,7 @@ static void hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll)
 		codec->addr, pin_nid, pin_eld->monitor_present, eld->eld_valid);
 
 	if (eld->eld_valid) {
-		if (snd_hdmi_get_eld(codec, pin_nid, eld->eld_buffer,
+		if (spec->ops.pin_get_eld(codec, pin_nid, eld->eld_buffer,
 						     &eld->eld_size) < 0)
 			eld->eld_valid = false;
 		else {
@@ -1655,7 +1726,7 @@ static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
 	hdmi_setup_audio_infoframe(codec, per_pin, non_pcm);
 	mutex_unlock(&per_pin->lock);
 
-	return hdmi_setup_stream(codec, cvt_nid, pin_nid, stream_tag, format);
+	return spec->ops.setup_stream(codec, cvt_nid, pin_nid, stream_tag, format);
 }
 
 static int generic_hdmi_playback_pcm_cleanup(struct hda_pcm_stream *hinfo,
@@ -1727,6 +1798,34 @@ static int hdmi_chmap_ctl_info(struct snd_kcontrol *kcontrol,
 	return 0;
 }
 
+static int hdmi_chmap_cea_alloc_validate_get_type(struct cea_channel_speaker_allocation *cap,
+						  int channels)
+{
+	/* If the speaker allocation matches the channel count, it is OK.*/
+	if (cap->channels != channels)
+		return -1;
+
+	/* all channels are remappable freely */
+	return SNDRV_CTL_TLVT_CHMAP_VAR;
+}
+
+static void hdmi_cea_alloc_to_tlv_chmap(struct cea_channel_speaker_allocation *cap,
+					unsigned int *chmap, int channels)
+{
+	int count = 0;
+	int c;
+
+	for (c = 7; c >= 0; c--) {
+		int spk = cap->speakers[c];
+		if (!spk)
+			continue;
+
+		chmap[count++] = spk_to_chmap(spk);
+	}
+
+	WARN_ON(count != channels);
+}
+
 static int hdmi_chmap_ctl_tlv(struct snd_kcontrol *kcontrol, int op_flag,
 			      unsigned int size, unsigned int __user *tlv)
 {
@@ -1743,16 +1842,19 @@ static int hdmi_chmap_ctl_tlv(struct snd_kcontrol *kcontrol, int op_flag,
 	size -= 8;
 	dst = tlv + 2;
 	for (chs = 2; chs <= spec->channels_max; chs++) {
-		int i, c;
+		int i;
 		struct cea_channel_speaker_allocation *cap;
 		cap = channel_allocations;
 		for (i = 0; i < ARRAY_SIZE(channel_allocations); i++, cap++) {
 			int chs_bytes = chs * 4;
-			if (cap->channels != chs)
+			int type = spec->ops.chmap_cea_alloc_validate_get_type(cap, chs);
+			unsigned int tlv_chmap[8];
+
+			if (type < 0)
 				continue;
 			if (size < 8)
 				return -ENOMEM;
-			if (put_user(SNDRV_CTL_TLVT_CHMAP_VAR, dst) ||
+			if (put_user(type, dst) ||
 			    put_user(chs_bytes, dst + 1))
 				return -EFAULT;
 			dst += 2;
@@ -1762,14 +1864,10 @@ static int hdmi_chmap_ctl_tlv(struct snd_kcontrol *kcontrol, int op_flag,
 				return -ENOMEM;
 			size -= chs_bytes;
 			count += chs_bytes;
-			for (c = 7; c >= 0; c--) {
-				int spk = cap->speakers[c];
-				if (!spk)
-					continue;
-				if (put_user(spk_to_chmap(spk), dst))
-					return -EFAULT;
-				dst++;
-			}
+			spec->ops.cea_alloc_to_tlv_chmap(cap, tlv_chmap, chs);
+			if (copy_to_user(dst, tlv_chmap, chs_bytes))
+				return -EFAULT;
+			dst += chs;
 		}
 	}
 	if (put_user(count, tlv + 1))
@@ -1803,7 +1901,7 @@ static int hdmi_chmap_ctl_put(struct snd_kcontrol *kcontrol,
 	unsigned int ctl_idx;
 	struct snd_pcm_substream *substream;
 	unsigned char chmap[8];
-	int i, ca, prepared = 0;
+	int i, err, ca, prepared = 0;
 
 	ctl_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
 	substream = snd_pcm_chmap_substream(info, ctl_idx);
@@ -1827,6 +1925,11 @@ static int hdmi_chmap_ctl_put(struct snd_kcontrol *kcontrol,
 	ca = hdmi_manual_channel_allocation(ARRAY_SIZE(chmap), chmap);
 	if (ca < 0)
 		return -EINVAL;
+	if (spec->ops.chmap_validate) {
+		err = spec->ops.chmap_validate(ca, ARRAY_SIZE(chmap), chmap);
+		if (err)
+			return err;
+	}
 	mutex_lock(&per_pin->lock);
 	per_pin->chmap_set = true;
 	memcpy(per_pin->chmap, chmap, sizeof(chmap));
@@ -2033,6 +2136,17 @@ static const struct hda_codec_ops generic_hdmi_patch_ops = {
 #endif
 };
 
+static const struct hdmi_ops generic_standard_hdmi_ops = {
+	.pin_get_eld				= snd_hdmi_get_eld,
+	.pin_get_slot_channel			= hdmi_pin_get_slot_channel,
+	.pin_set_slot_channel			= hdmi_pin_set_slot_channel,
+	.pin_setup_infoframe			= hdmi_pin_setup_infoframe,
+	.pin_hbr_setup				= hdmi_pin_hbr_setup,
+	.setup_stream				= hdmi_setup_stream,
+	.chmap_cea_alloc_validate_get_type	= hdmi_chmap_cea_alloc_validate_get_type,
+	.cea_alloc_to_tlv_chmap			= hdmi_cea_alloc_to_tlv_chmap,
+};
+
 
 static void intel_haswell_fixup_connect_list(struct hda_codec *codec,
 					     hda_nid_t nid)
@@ -2115,6 +2229,7 @@ static int patch_generic_hdmi(struct hda_codec *codec)
 	if (spec == NULL)
 		return -ENOMEM;
 
+	spec->ops = generic_standard_hdmi_ops;
 	codec->spec = spec;
 	hdmi_array_init(spec, 4);
 
-- 
1.8.1.5

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH 2/5] ALSA: hda - hdmi: Add ATI/AMD multi-channel audio support
  2013-10-24 18:10 [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support Anssi Hannula
  2013-10-24 18:10 ` [PATCH 1/5] ALSA: hda - hdmi: Allow HDA patches to customize more operations Anssi Hannula
@ 2013-10-24 18:10 ` Anssi Hannula
  2013-10-24 18:10 ` [PATCH 3/5] ALSA: hda - hdmi: Add ELD emulation for ATI/AMD codecs Anssi Hannula
                   ` (6 subsequent siblings)
  8 siblings, 0 replies; 71+ messages in thread
From: Anssi Hannula @ 2013-10-24 18:10 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: Olivier Langlois, alsa-devel, Peter Frühberger

ATI/AMD codecs do not support all the standard HDA HDMI/DP functions,
instead various vendor-specific verbs are provided.

This commit addresses these missing functions:
- standard channel mapping support
- standard infoframe configuration support

ATI/AMD provides their own verbs that allow the following:
- setting CA for infoframe
- setting down-mix information for infoframe
- channel pair remapping
- individual channel remapping (revision ID 3+, 0x100300+)

The documentation for the verbs has now been released by AMD:
http://www.x.org/docs/AMD/AMD_HDA_verbs_v2.pdf

Add support for the ATI/AMD specific verbs and use them instead of the
generic methods on ATI/AMD codecs. This allows multi-channel PCM audio
to work.

Channel remapping is restricted to pairwise mapping on codecs with
revision ID 2 (0x100200 as reported by procfs codec#X) or lower. This
means cards up to Radeon HD7670 as far as I know. This will not affect
standard multi-channel modes since these codecs support automatic
FC-LFE swapping for HDMI.

ATI/AMD codecs do not advertise all of their supported rates, formats
and channel counts, therefore that information is forced accordingly so
that all HDMI 1.x PCM parameters are marked as supported.

Support for multiple ports is also added to patch_atihdmi so that
0x1002aa01 codecs with multiple ports will work properly when switched
back to that patch.

v2: splitted ELD emulation to a separate patch, tlv fixes
v3: adapted to the new hdmi_ops infrastructure, fixed rev3+ vendor id

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Tested-by: Peter Frühberger <fritsch@xbmc.org> # v2
Tested-by: Olivier Langlois <olivier@trillion01.com> # v2+rev3fix
---
 sound/pci/hda/patch_hdmi.c | 302 ++++++++++++++++++++++++++++++++++++++++-----
 1 file changed, 273 insertions(+), 29 deletions(-)

diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index b11cbe0..4ef5676 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -6,6 +6,7 @@
  *  Copyright (c) 2006 ATI Technologies Inc.
  *  Copyright (c) 2008 NVIDIA Corp.  All rights reserved.
  *  Copyright (c) 2008 Wei Ni <wni@nvidia.com>
+ *  Copyright (c) 2013 Anssi Hannula <anssi.hannula@iki.fi>
  *
  *  Authors:
  *			Wu Fengguang <wfg@linux.intel.com>
@@ -128,7 +129,7 @@ struct hdmi_spec {
 	struct hdmi_eld temp_eld;
 	struct hdmi_ops ops;
 	/*
-	 * Non-generic ATI/NVIDIA specific
+	 * Non-generic VIA/NVIDIA specific
 	 */
 	struct hda_multi_out multiout;
 	struct hda_pcm_stream pcm_playback;
@@ -2785,49 +2786,292 @@ static int patch_nvhdmi_8ch_7x(struct hda_codec *codec)
 }
 
 /*
- * ATI-specific implementations
- *
- * FIXME: we may omit the whole this and use the generic code once after
- * it's confirmed to work.
+ * ATI/AMD-specific implementations
  */
 
-#define ATIHDMI_CVT_NID		0x02	/* audio converter */
-#define ATIHDMI_PIN_NID		0x03	/* HDMI output pin */
+#define is_amdhdmi_rev3_or_later(codec) \
+	((codec)->vendor_id == 0x1002aa01 && ((codec)->revision_id & 0xff00) >= 0x0300)
+#define has_amd_full_remap_support(codec) is_amdhdmi_rev3_or_later(codec)
+
+/* ATI/AMD specific HDA pin verbs, see the AMD HDA Verbs specification */
+#define ATI_VERB_SET_CHANNEL_ALLOCATION	0x771
+#define ATI_VERB_SET_DOWNMIX_INFO	0x772
+#define ATI_VERB_SET_MULTICHANNEL_01	0x777
+#define ATI_VERB_SET_MULTICHANNEL_23	0x778
+#define ATI_VERB_SET_MULTICHANNEL_45	0x779
+#define ATI_VERB_SET_MULTICHANNEL_67	0x77a
+#define ATI_VERB_SET_MULTICHANNEL_1	0x785
+#define ATI_VERB_SET_MULTICHANNEL_3	0x786
+#define ATI_VERB_SET_MULTICHANNEL_5	0x787
+#define ATI_VERB_SET_MULTICHANNEL_7	0x788
+#define ATI_VERB_SET_MULTICHANNEL_MODE	0x789
+#define ATI_VERB_GET_CHANNEL_ALLOCATION	0xf71
+#define ATI_VERB_GET_DOWNMIX_INFO	0xf72
+#define ATI_VERB_GET_MULTICHANNEL_01	0xf77
+#define ATI_VERB_GET_MULTICHANNEL_23	0xf78
+#define ATI_VERB_GET_MULTICHANNEL_45	0xf79
+#define ATI_VERB_GET_MULTICHANNEL_67	0xf7a
+#define ATI_VERB_GET_MULTICHANNEL_1	0xf85
+#define ATI_VERB_GET_MULTICHANNEL_3	0xf86
+#define ATI_VERB_GET_MULTICHANNEL_5	0xf87
+#define ATI_VERB_GET_MULTICHANNEL_7	0xf88
+#define ATI_VERB_GET_MULTICHANNEL_MODE	0xf89
+
+#define ATI_OUT_ENABLE 0x1
+
+#define ATI_MULTICHANNEL_MODE_PAIRED	0
+#define ATI_MULTICHANNEL_MODE_SINGLE	1
+
+static void atihdmi_pin_setup_infoframe(struct hda_codec *codec, hda_nid_t pin_nid, int ca,
+					int active_channels, int conn_type)
+{
+	snd_hda_codec_write(codec, pin_nid, 0, ATI_VERB_SET_CHANNEL_ALLOCATION, ca);
+}
+
+static int atihdmi_paired_swap_fc_lfe(int pos)
+{
+	/*
+	 * ATI/AMD have automatic FC/LFE swap built-in
+	 * when in pairwise mapping mode.
+	 */
+
+	switch (pos) {
+		/* see channel_allocations[].speakers[] */
+		case 2: return 3;
+		case 3: return 2;
+		default: break;
+	}
+
+	return pos;
+}
+
+static int atihdmi_paired_chmap_validate(int ca, int chs, unsigned char *map)
+{
+	struct cea_channel_speaker_allocation *cap;
+	int i, j;
+
+	/* check that only channel pairs need to be remapped on old pre-rev3 ATI/AMD */
+
+	cap = &channel_allocations[get_channel_allocation_order(ca)];
+	for (i = 0; i < chs; ++i) {
+		int mask = to_spk_mask(map[i]);
+		bool ok = false;
+		bool companion_ok = false;
+
+		if (!mask)
+			continue;
+
+		for (j = 0 + i % 2; j < 8; j += 2) {
+			int chan_idx = 7 - atihdmi_paired_swap_fc_lfe(j);
+			if (cap->speakers[chan_idx] == mask) {
+				/* channel is in a supported position */
+				ok = true;
+
+				if (i % 2 == 0 && i + 1 < chs) {
+					/* even channel, check the odd companion */
+					int comp_chan_idx = 7 - atihdmi_paired_swap_fc_lfe(j + 1);
+					int comp_mask_req = to_spk_mask(map[i+1]);
+					int comp_mask_act = cap->speakers[comp_chan_idx];
+
+					if (comp_mask_req == comp_mask_act)
+						companion_ok = true;
+					else
+						return -EINVAL;
+				}
+				break;
+			}
+		}
+
+		if (!ok)
+			return -EINVAL;
+
+		if (companion_ok)
+			i++; /* companion channel already checked */
+	}
+
+	return 0;
+}
+
+static int atihdmi_pin_set_slot_channel(struct hda_codec *codec, hda_nid_t pin_nid,
+					int hdmi_slot, int stream_channel)
+{
+	int verb;
+	int ati_channel_setup = 0;
+
+	if (hdmi_slot > 7)
+		return -EINVAL;
+
+	if (!has_amd_full_remap_support(codec)) {
+		hdmi_slot = atihdmi_paired_swap_fc_lfe(hdmi_slot);
+
+		/* In case this is an odd slot but without stream channel, do not
+		 * disable the slot since the corresponding even slot could have a
+		 * channel. In case neither have a channel, the slot pair will be
+		 * disabled when this function is called for the even slot. */
+		if (hdmi_slot % 2 != 0 && stream_channel == 0xf)
+			return 0;
+
+		hdmi_slot -= hdmi_slot % 2;
+
+		if (stream_channel != 0xf)
+			stream_channel -= stream_channel % 2;
+	}
+
+	verb = ATI_VERB_SET_MULTICHANNEL_01 + hdmi_slot/2 + (hdmi_slot % 2) * 0x00e;
+
+	/* ati_channel_setup format: [7..4] = stream_channel_id, [1] = mute, [0] = enable */
+
+	if (stream_channel != 0xf)
+		ati_channel_setup = (stream_channel << 4) | ATI_OUT_ENABLE;
+
+	return snd_hda_codec_write(codec, pin_nid, 0, verb, ati_channel_setup);
+}
+
+static int atihdmi_pin_get_slot_channel(struct hda_codec *codec, hda_nid_t pin_nid,
+					int asp_slot)
+{
+	bool was_odd = false;
+	int ati_asp_slot = asp_slot;
+	int verb;
+	int ati_channel_setup;
+
+	if (asp_slot > 7)
+		return -EINVAL;
+
+	if (!has_amd_full_remap_support(codec)) {
+		ati_asp_slot = atihdmi_paired_swap_fc_lfe(asp_slot);
+		if (ati_asp_slot % 2 != 0) {
+			ati_asp_slot -= 1;
+			was_odd = true;
+		}
+	}
+
+	verb = ATI_VERB_GET_MULTICHANNEL_01 + ati_asp_slot/2 + (ati_asp_slot % 2) * 0x00e;
+
+	ati_channel_setup = snd_hda_codec_read(codec, pin_nid, 0, verb, 0);
+
+	if (!(ati_channel_setup & ATI_OUT_ENABLE))
+		return 0xf;
+
+	return ((ati_channel_setup & 0xf0) >> 4) + !!was_odd;
+}
 
-static int atihdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
-					struct hda_codec *codec,
-					unsigned int stream_tag,
-					unsigned int format,
-					struct snd_pcm_substream *substream)
+static int atihdmi_paired_chmap_cea_alloc_validate_get_type(struct cea_channel_speaker_allocation *cap,
+							    int channels)
+{
+	int c;
+
+	/*
+	 * Pre-rev3 ATI/AMD codecs operate in a paired channel mode, so
+	 * we need to take that into account (a single channel may take 2
+	 * channel slots if we need to carry a silent channel next to it).
+	 * On Rev3+ AMD codecs this function is not used.
+	 */
+	int chanpairs = 0;
+
+	/* We only produce even-numbered channel count TLVs */
+	if ((channels % 2) != 0)
+		return -1;
+
+	for (c = 0; c < 7; c += 2) {
+		if (cap->speakers[c] || cap->speakers[c+1])
+			chanpairs++;
+	}
+
+	if (chanpairs * 2 != channels)
+		return -1;
+
+	return SNDRV_CTL_TLVT_CHMAP_PAIRED;
+}
+
+static void atihdmi_paired_cea_alloc_to_tlv_chmap(struct cea_channel_speaker_allocation *cap,
+						  unsigned int *chmap, int channels)
+{
+	/* produce paired maps for pre-rev3 ATI/AMD codecs */
+	int count = 0;
+	int c;
+
+	for (c = 7; c >= 0; c--) {
+		int chan = 7 - atihdmi_paired_swap_fc_lfe(7 - c);
+		int spk = cap->speakers[chan];
+		if (!spk) {
+			/* add N/A channel if the companion channel is occupied */
+			if (cap->speakers[chan + (chan % 2 ? -1 : 1)])
+				chmap[count++] = SNDRV_CHMAP_NA;
+
+			continue;
+		}
+
+		chmap[count++] = spk_to_chmap(spk);
+	}
+
+	WARN_ON(count != channels);
+}
+
+static int atihdmi_init(struct hda_codec *codec)
 {
 	struct hdmi_spec *spec = codec->spec;
-	struct hdmi_spec_per_cvt *per_cvt = get_cvt(spec, 0);
-	int chans = substream->runtime->channels;
-	int i, err;
+	int pin_idx, err;
 
-	err = simple_playback_pcm_prepare(hinfo, codec, stream_tag, format,
-					  substream);
-	if (err < 0)
+	err = generic_hdmi_init(codec);
+
+	if (err)
 		return err;
-	snd_hda_codec_write(codec, per_cvt->cvt_nid, 0,
-			    AC_VERB_SET_CVT_CHAN_COUNT, chans - 1);
-	/* FIXME: XXX */
-	for (i = 0; i < chans; i++) {
-		snd_hda_codec_write(codec, per_cvt->cvt_nid, 0,
-				    AC_VERB_SET_HDMI_CHAN_SLOT,
-				    (i << 4) | i);
+
+	for (pin_idx = 0; pin_idx < spec->num_pins; pin_idx++) {
+		struct hdmi_spec_per_pin *per_pin = get_pin(spec, pin_idx);
+
+		/* make sure downmix information in infoframe is zero */
+		snd_hda_codec_write(codec, per_pin->pin_nid, 0, ATI_VERB_SET_DOWNMIX_INFO, 0);
+
+		/* enable channel-wise remap mode if supported */
+		if (has_amd_full_remap_support(codec))
+			snd_hda_codec_write(codec, per_pin->pin_nid, 0,
+					    ATI_VERB_SET_MULTICHANNEL_MODE,
+					    ATI_MULTICHANNEL_MODE_SINGLE);
 	}
+
 	return 0;
 }
 
 static int patch_atihdmi(struct hda_codec *codec)
 {
 	struct hdmi_spec *spec;
-	int err = patch_simple_hdmi(codec, ATIHDMI_CVT_NID, ATIHDMI_PIN_NID);
-	if (err < 0)
+	struct hdmi_spec_per_cvt *per_cvt;
+	int err, cvt_idx;
+
+	err = patch_generic_hdmi(codec);
+
+	if (err)
 		return err;
+
+	codec->patch_ops.init = atihdmi_init;
+
 	spec = codec->spec;
-	spec->pcm_playback.ops.prepare = atihdmi_playback_pcm_prepare;
+
+	spec->ops.pin_get_slot_channel = atihdmi_pin_get_slot_channel;
+	spec->ops.pin_set_slot_channel = atihdmi_pin_set_slot_channel;
+	spec->ops.pin_setup_infoframe = atihdmi_pin_setup_infoframe;
+
+	if (!has_amd_full_remap_support(codec)) {
+		/* override to ATI/AMD-specific versions with pairwise mapping */
+		spec->ops.chmap_cea_alloc_validate_get_type =
+			atihdmi_paired_chmap_cea_alloc_validate_get_type;
+		spec->ops.cea_alloc_to_tlv_chmap = atihdmi_paired_cea_alloc_to_tlv_chmap;
+		spec->ops.chmap_validate = atihdmi_paired_chmap_validate;
+	}
+
+	/* ATI/AMD converters do not advertise all of their capabilities */
+	for (cvt_idx = 0; cvt_idx < spec->num_cvts; cvt_idx++) {
+		per_cvt = get_cvt(spec, cvt_idx);
+		per_cvt->channels_max = max(per_cvt->channels_max, 8u);
+		per_cvt->rates |= SUPPORTED_RATES;
+		per_cvt->formats |= SUPPORTED_FORMATS;
+		per_cvt->maxbps = max(per_cvt->maxbps, 24u);
+	}
+
+	spec->channels_max = max(spec->channels_max, 8u);
+
 	return 0;
 }
 
@@ -2847,7 +3091,7 @@ static const struct hda_codec_preset snd_hda_preset_hdmi[] = {
 { .id = 0x1002793c, .name = "RS600 HDMI",	.patch = patch_atihdmi },
 { .id = 0x10027919, .name = "RS600 HDMI",	.patch = patch_atihdmi },
 { .id = 0x1002791a, .name = "RS690/780 HDMI",	.patch = patch_atihdmi },
-{ .id = 0x1002aa01, .name = "R6xx HDMI",	.patch = patch_generic_hdmi },
+{ .id = 0x1002aa01, .name = "R6xx HDMI",	.patch = patch_atihdmi },
 { .id = 0x10951390, .name = "SiI1390 HDMI",	.patch = patch_generic_hdmi },
 { .id = 0x10951392, .name = "SiI1392 HDMI",	.patch = patch_generic_hdmi },
 { .id = 0x17e80047, .name = "Chrontel HDMI",	.patch = patch_generic_hdmi },
-- 
1.8.1.5

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH 3/5] ALSA: hda - hdmi: Add ELD emulation for ATI/AMD codecs
  2013-10-24 18:10 [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support Anssi Hannula
  2013-10-24 18:10 ` [PATCH 1/5] ALSA: hda - hdmi: Allow HDA patches to customize more operations Anssi Hannula
  2013-10-24 18:10 ` [PATCH 2/5] ALSA: hda - hdmi: Add ATI/AMD multi-channel audio support Anssi Hannula
@ 2013-10-24 18:10 ` Anssi Hannula
  2013-10-24 18:10 ` [PATCH 4/5] ALSA: hda - hdmi: Add HBR bitstreaming support for ATI/AMD HDMI codecs Anssi Hannula
                   ` (5 subsequent siblings)
  8 siblings, 0 replies; 71+ messages in thread
From: Anssi Hannula @ 2013-10-24 18:10 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: Olivier Langlois, alsa-devel, Peter Frühberger

ATI/AMD HDMI/DP codecs do not include standard HDA ELD (EDID-like data)
support.

In place of providing access to an ELD buffer, various vendor-specific
verbs are provided to provide the relevant information. Revision ID 3
and later (0x100300 as reported by procfs codec#X) have support for
providing more information than the previous revisions (but only if
supported by the display driver).

Generate ELD from the information provided by the vendor-specific verbs
on ATI/AMD codecs.

The specification is available at:
http://www.x.org/docs/AMD/AMD_HDA_verbs_v2.pdf

v2: moved code to hda_eld.c and cleaned it up
v3: adapted to hdmi_ops infrastructure

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Tested-by: Peter Frühberger <fritsch@xbmc.org> # v2
Tested-by: Olivier Langlois <olivier@trillion01.com> # v2
---
 sound/pci/hda/hda_eld.c    | 151 +++++++++++++++++++++++++++++++++++++++++++++
 sound/pci/hda/hda_local.h  |   4 ++
 sound/pci/hda/patch_hdmi.c |   9 +++
 3 files changed, 164 insertions(+)

diff --git a/sound/pci/hda/hda_eld.c b/sound/pci/hda/hda_eld.c
index f62356c..32d3e38 100644
--- a/sound/pci/hda/hda_eld.c
+++ b/sound/pci/hda/hda_eld.c
@@ -2,6 +2,7 @@
  * Generic routines and proc interface for ELD(EDID Like Data) information
  *
  * Copyright(c) 2008 Intel Corporation.
+ * Copyright (c) 2013 Anssi Hannula <anssi.hannula@iki.fi>
  *
  * Authors:
  * 		Wu Fengguang <wfg@linux.intel.com>
@@ -633,3 +634,153 @@ void snd_hdmi_eld_update_pcm_info(struct parsed_hdmi_eld *e,
 	hinfo->maxbps = min(hinfo->maxbps, maxbps);
 	hinfo->channels_max = min(hinfo->channels_max, channels_max);
 }
+
+
+/* ATI/AMD specific stuff (ELD emulation) */
+
+#define ATI_VERB_SET_AUDIO_DESCRIPTOR	0x776
+#define ATI_VERB_SET_SINK_INFO_INDEX	0x780
+#define ATI_VERB_GET_SPEAKER_ALLOCATION	0xf70
+#define ATI_VERB_GET_AUDIO_DESCRIPTOR	0xf76
+#define ATI_VERB_GET_AUDIO_VIDEO_DELAY	0xf7b
+#define ATI_VERB_GET_SINK_INFO_INDEX	0xf80
+#define ATI_VERB_GET_SINK_INFO_DATA	0xf81
+
+#define ATI_SPKALLOC_SPKALLOC		0x007f
+#define ATI_SPKALLOC_TYPE_HDMI		0x0100
+#define ATI_SPKALLOC_TYPE_DISPLAYPORT	0x0200
+
+/* first three bytes are just standard SAD */
+#define ATI_AUDIODESC_CHANNELS		0x00000007
+#define ATI_AUDIODESC_RATES		0x0000ff00
+#define ATI_AUDIODESC_LPCM_STEREO_RATES	0xff000000
+
+/* in standard HDMI VSDB format */
+#define ATI_DELAY_VIDEO_LATENCY		0x000000ff
+#define ATI_DELAY_AUDIO_LATENCY		0x0000ff00
+
+enum ati_sink_info_idx {
+	ATI_INFO_IDX_MANUFACTURER_ID	= 0,
+	ATI_INFO_IDX_PRODUCT_ID		= 1,
+	ATI_INFO_IDX_SINK_DESC_LEN	= 2,
+	ATI_INFO_IDX_PORT_ID_LOW	= 3,
+	ATI_INFO_IDX_PORT_ID_HIGH	= 4,
+	ATI_INFO_IDX_SINK_DESC_FIRST	= 5,
+	ATI_INFO_IDX_SINK_DESC_LAST	= 22, /* max len 18 bytes */
+};
+
+int snd_hdmi_get_eld_ati(struct hda_codec *codec, hda_nid_t nid,
+			 unsigned char *buf, int *eld_size, bool rev3_or_later)
+{
+	int spkalloc, ati_sad, aud_synch;
+	int sink_desc_len = 0;
+	int pos, i;
+
+	/* ATI/AMD does not have ELD, emulate it */
+
+	spkalloc = snd_hda_codec_read(codec, nid, 0, ATI_VERB_GET_SPEAKER_ALLOCATION, 0);
+
+	if (!spkalloc) {
+		snd_printd(KERN_INFO "HDMI ATI/AMD: no speaker allocation for ELD\n");
+		return -EINVAL;
+	}
+
+	memset(buf, 0, ELD_FIXED_BYTES + ELD_MAX_MNL + ELD_MAX_SAD * 3);
+
+	/* version */
+	buf[0] = ELD_VER_CEA_861D << 3;
+
+	/* speaker allocation from EDID */
+	buf[7] = spkalloc & ATI_SPKALLOC_SPKALLOC;
+
+	/* is DisplayPort? */
+	if (spkalloc & ATI_SPKALLOC_TYPE_DISPLAYPORT)
+		buf[5] |= 0x04;
+
+	pos = ELD_FIXED_BYTES;
+
+	if (rev3_or_later) {
+		int sink_info;
+
+		snd_hda_codec_write(codec, nid, 0, ATI_VERB_SET_SINK_INFO_INDEX, ATI_INFO_IDX_PORT_ID_LOW);
+		sink_info = snd_hda_codec_read(codec, nid, 0, ATI_VERB_GET_SINK_INFO_DATA, 0);
+		put_unaligned_le32(sink_info, buf + 8);
+
+		snd_hda_codec_write(codec, nid, 0, ATI_VERB_SET_SINK_INFO_INDEX, ATI_INFO_IDX_PORT_ID_HIGH);
+		sink_info = snd_hda_codec_read(codec, nid, 0, ATI_VERB_GET_SINK_INFO_DATA, 0);
+		put_unaligned_le32(sink_info, buf + 12);
+
+		snd_hda_codec_write(codec, nid, 0, ATI_VERB_SET_SINK_INFO_INDEX, ATI_INFO_IDX_MANUFACTURER_ID);
+		sink_info = snd_hda_codec_read(codec, nid, 0, ATI_VERB_GET_SINK_INFO_DATA, 0);
+		put_unaligned_le16(sink_info, buf + 16);
+
+		snd_hda_codec_write(codec, nid, 0, ATI_VERB_SET_SINK_INFO_INDEX, ATI_INFO_IDX_PRODUCT_ID);
+		sink_info = snd_hda_codec_read(codec, nid, 0, ATI_VERB_GET_SINK_INFO_DATA, 0);
+		put_unaligned_le16(sink_info, buf + 18);
+
+		snd_hda_codec_write(codec, nid, 0, ATI_VERB_SET_SINK_INFO_INDEX, ATI_INFO_IDX_SINK_DESC_LEN);
+		sink_desc_len = snd_hda_codec_read(codec, nid, 0, ATI_VERB_GET_SINK_INFO_DATA, 0);
+
+		if (sink_desc_len > ELD_MAX_MNL) {
+			snd_printd(KERN_INFO "HDMI ATI/AMD: Truncating HDMI sink description with length %d\n",
+				   sink_desc_len);
+			sink_desc_len = ELD_MAX_MNL;
+		}
+
+		buf[4] |= sink_desc_len;
+
+		for (i = 0; i < sink_desc_len; i++) {
+			snd_hda_codec_write(codec, nid, 0, ATI_VERB_SET_SINK_INFO_INDEX, ATI_INFO_IDX_SINK_DESC_FIRST + i);
+			buf[pos++] = snd_hda_codec_read(codec, nid, 0, ATI_VERB_GET_SINK_INFO_DATA, 0);
+		}
+	}
+
+	for (i = AUDIO_CODING_TYPE_LPCM; i <= AUDIO_CODING_TYPE_WMAPRO; i++) {
+		if (i == AUDIO_CODING_TYPE_SACD || i == AUDIO_CODING_TYPE_DST)
+			continue; /* not handled by ATI/AMD */
+
+		snd_hda_codec_write(codec, nid, 0, ATI_VERB_SET_AUDIO_DESCRIPTOR, i << 3);
+		ati_sad = snd_hda_codec_read(codec, nid, 0, ATI_VERB_GET_AUDIO_DESCRIPTOR, 0);
+
+		if (ati_sad & ATI_AUDIODESC_RATES) {
+			/* format is supported, copy SAD as-is */
+			buf[pos++] = (ati_sad & 0x0000ff) >> 0;
+			buf[pos++] = (ati_sad & 0x00ff00) >> 8;
+			buf[pos++] = (ati_sad & 0xff0000) >> 16;
+		}
+
+		if (i == AUDIO_CODING_TYPE_LPCM
+		    && (ati_sad & ATI_AUDIODESC_LPCM_STEREO_RATES)
+		    && (ati_sad & ATI_AUDIODESC_LPCM_STEREO_RATES) >> 16 != (ati_sad & ATI_AUDIODESC_RATES)) {
+			/* for PCM there is a separate stereo rate mask */
+			buf[pos++] = ((ati_sad & 0x000000ff) & ~ATI_AUDIODESC_CHANNELS) | 0x1;
+			/* rates from the extra byte */
+			buf[pos++] = (ati_sad & 0xff000000) >> 24;
+			buf[pos++] = (ati_sad & 0x00ff0000) >> 16;
+		}
+	}
+
+	if (pos == ELD_FIXED_BYTES + sink_desc_len) {
+		snd_printd(KERN_INFO "HDMI ATI/AMD: no audio descriptors for ELD\n");
+		return -EINVAL;
+	}
+
+	aud_synch = snd_hda_codec_read(codec, nid, 0, ATI_VERB_GET_AUDIO_VIDEO_DELAY, 0);
+	if ((aud_synch & ATI_DELAY_VIDEO_LATENCY) && (aud_synch & ATI_DELAY_AUDIO_LATENCY)) {
+		int video_latency = (aud_synch & ATI_DELAY_VIDEO_LATENCY) - 1;
+		int audio_latency = ((aud_synch & ATI_DELAY_AUDIO_LATENCY) >> 8) - 1;
+
+		if (video_latency > audio_latency)
+			buf[6] = min(video_latency - audio_latency, 0xfa);
+	}
+
+	/* Baseline length */
+	buf[2] = pos - 4;
+
+	/* SAD count */
+	buf[5] |= ((pos - ELD_FIXED_BYTES - sink_desc_len) / 3) << 4;
+
+	*eld_size = pos;
+
+	return 0;
+}
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h
index 46cddd4..d398b64 100644
--- a/sound/pci/hda/hda_local.h
+++ b/sound/pci/hda/hda_local.h
@@ -763,6 +763,10 @@ void snd_hdmi_show_eld(struct parsed_hdmi_eld *e);
 void snd_hdmi_eld_update_pcm_info(struct parsed_hdmi_eld *e,
 			      struct hda_pcm_stream *hinfo);
 
+int snd_hdmi_get_eld_ati(struct hda_codec *codec, hda_nid_t nid,
+			 unsigned char *buf, int *eld_size,
+			 bool rev3_or_later);
+
 #ifdef CONFIG_PROC_FS
 void snd_hdmi_print_eld_info(struct hdmi_eld *eld,
 			     struct snd_info_buffer *buffer);
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index 4ef5676..75ba933 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -2822,6 +2822,14 @@ static int patch_nvhdmi_8ch_7x(struct hda_codec *codec)
 #define ATI_MULTICHANNEL_MODE_PAIRED	0
 #define ATI_MULTICHANNEL_MODE_SINGLE	1
 
+static int atihdmi_pin_get_eld(struct hda_codec *codec, hda_nid_t nid,
+			   unsigned char *buf, int *eld_size)
+{
+	/* call hda_eld.c ATI/AMD-specific function */
+	return snd_hdmi_get_eld_ati(codec, nid, buf, eld_size,
+				    is_amdhdmi_rev3_or_later(codec));
+}
+
 static void atihdmi_pin_setup_infoframe(struct hda_codec *codec, hda_nid_t pin_nid, int ca,
 					int active_channels, int conn_type)
 {
@@ -3049,6 +3057,7 @@ static int patch_atihdmi(struct hda_codec *codec)
 
 	spec = codec->spec;
 
+	spec->ops.pin_get_eld = atihdmi_pin_get_eld;
 	spec->ops.pin_get_slot_channel = atihdmi_pin_get_slot_channel;
 	spec->ops.pin_set_slot_channel = atihdmi_pin_set_slot_channel;
 	spec->ops.pin_setup_infoframe = atihdmi_pin_setup_infoframe;
-- 
1.8.1.5

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH 4/5] ALSA: hda - hdmi: Add HBR bitstreaming support for ATI/AMD HDMI codecs
  2013-10-24 18:10 [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support Anssi Hannula
                   ` (2 preceding siblings ...)
  2013-10-24 18:10 ` [PATCH 3/5] ALSA: hda - hdmi: Add ELD emulation for ATI/AMD codecs Anssi Hannula
@ 2013-10-24 18:10 ` Anssi Hannula
  2013-10-24 18:10 ` [PATCH 5/5] ALSA: hda - hdmi: Disable ramp-up/down for non-PCM on AMD codecs Anssi Hannula
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 71+ messages in thread
From: Anssi Hannula @ 2013-10-24 18:10 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: Olivier Langlois, alsa-devel, Peter Frühberger

ATI/AMD HDMI codecs do not include standard HDA HDMI HBR support (which
is required for bitstreaming DTS-HD and Dolby TrueHD), instead they have
custom verbs for checking and enabling it.

Add support for the ATI/AMD HDMI HBR verbs.

The specification is available at:
http://www.x.org/docs/AMD/AMD_HDA_verbs_v2.pdf

v2: adapted to hdmi_ops infrastructure

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Tested-by: Peter Frühberger <fritsch@xbmc.org> # v1
---
 sound/pci/hda/patch_hdmi.c | 35 +++++++++++++++++++++++++++++++++++
 1 file changed, 35 insertions(+)

diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index 75ba933..2c45591 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -2800,6 +2800,7 @@ static int patch_nvhdmi_8ch_7x(struct hda_codec *codec)
 #define ATI_VERB_SET_MULTICHANNEL_23	0x778
 #define ATI_VERB_SET_MULTICHANNEL_45	0x779
 #define ATI_VERB_SET_MULTICHANNEL_67	0x77a
+#define ATI_VERB_SET_HBR_CONTROL	0x77c
 #define ATI_VERB_SET_MULTICHANNEL_1	0x785
 #define ATI_VERB_SET_MULTICHANNEL_3	0x786
 #define ATI_VERB_SET_MULTICHANNEL_5	0x787
@@ -2811,6 +2812,7 @@ static int patch_nvhdmi_8ch_7x(struct hda_codec *codec)
 #define ATI_VERB_GET_MULTICHANNEL_23	0xf78
 #define ATI_VERB_GET_MULTICHANNEL_45	0xf79
 #define ATI_VERB_GET_MULTICHANNEL_67	0xf7a
+#define ATI_VERB_GET_HBR_CONTROL	0xf7c
 #define ATI_VERB_GET_MULTICHANNEL_1	0xf85
 #define ATI_VERB_GET_MULTICHANNEL_3	0xf86
 #define ATI_VERB_GET_MULTICHANNEL_5	0xf87
@@ -2822,6 +2824,9 @@ static int patch_nvhdmi_8ch_7x(struct hda_codec *codec)
 #define ATI_MULTICHANNEL_MODE_PAIRED	0
 #define ATI_MULTICHANNEL_MODE_SINGLE	1
 
+#define ATI_HBR_CAPABLE 0x01
+#define ATI_HBR_ENABLE 0x10
+
 static int atihdmi_pin_get_eld(struct hda_codec *codec, hda_nid_t nid,
 			   unsigned char *buf, int *eld_size)
 {
@@ -3016,6 +3021,35 @@ static void atihdmi_paired_cea_alloc_to_tlv_chmap(struct cea_channel_speaker_all
 	WARN_ON(count != channels);
 }
 
+static int atihdmi_pin_hbr_setup(struct hda_codec *codec, hda_nid_t pin_nid,
+				 bool hbr)
+{
+	int hbr_ctl, hbr_ctl_new;
+
+	hbr_ctl = snd_hda_codec_read(codec, pin_nid, 0, ATI_VERB_GET_HBR_CONTROL, 0);
+	if (hbr_ctl & ATI_HBR_CAPABLE) {
+		if (hbr)
+			hbr_ctl_new = hbr_ctl | ATI_HBR_ENABLE;
+		else
+			hbr_ctl_new = hbr_ctl & ~ATI_HBR_ENABLE;
+
+		snd_printdd("atihdmi_pin_hbr_setup: "
+				"NID=0x%x, %shbr-ctl=0x%x\n",
+				pin_nid,
+				hbr_ctl == hbr_ctl_new ? "" : "new-",
+				hbr_ctl_new);
+
+		if (hbr_ctl != hbr_ctl_new)
+			snd_hda_codec_write(codec, pin_nid, 0,
+						ATI_VERB_SET_HBR_CONTROL,
+						hbr_ctl_new);
+
+	} else if (hbr)
+		return -EINVAL;
+
+	return 0;
+}
+
 static int atihdmi_init(struct hda_codec *codec)
 {
 	struct hdmi_spec *spec = codec->spec;
@@ -3061,6 +3095,7 @@ static int patch_atihdmi(struct hda_codec *codec)
 	spec->ops.pin_get_slot_channel = atihdmi_pin_get_slot_channel;
 	spec->ops.pin_set_slot_channel = atihdmi_pin_set_slot_channel;
 	spec->ops.pin_setup_infoframe = atihdmi_pin_setup_infoframe;
+	spec->ops.pin_hbr_setup = atihdmi_pin_hbr_setup;
 
 	if (!has_amd_full_remap_support(codec)) {
 		/* override to ATI/AMD-specific versions with pairwise mapping */
-- 
1.8.1.5

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH 5/5] ALSA: hda - hdmi: Disable ramp-up/down for non-PCM on AMD codecs
  2013-10-24 18:10 [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support Anssi Hannula
                   ` (3 preceding siblings ...)
  2013-10-24 18:10 ` [PATCH 4/5] ALSA: hda - hdmi: Add HBR bitstreaming support for ATI/AMD HDMI codecs Anssi Hannula
@ 2013-10-24 18:10 ` Anssi Hannula
  2013-10-24 19:00   ` Anssi Hannula
  2013-10-24 18:26 ` [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support Anssi Hannula
                   ` (3 subsequent siblings)
  8 siblings, 1 reply; 71+ messages in thread
From: Anssi Hannula @ 2013-10-24 18:10 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: Olivier Langlois, alsa-devel, Peter Frühberger

Recent AMD HDMI codecs (revision ID 3 and later, 0x100300 as reported by
procfs codec#0) have a configurable ramp-up/down functionality.

The documentation ( http://www.x.org/docs/AMD/AMD_HDA_verbs_v2.pdf )
specifies that 180 ("180/256 =~ 0.7") is recommended for PCM and 0 for
non-PCM.

Apply the recommended values according to provided S/PDIF AES0 settings
since ramp-up/down does not make sense for non-PCM.

v2: adapted to hdmi_ops infrastructure

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Tested-by: Olivier Langlois <olivier@trillion01.com> # v1
---
 sound/pci/hda/patch_hdmi.c | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index 2c45591..74bd2e63ce 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -2819,6 +2819,10 @@ static int patch_nvhdmi_8ch_7x(struct hda_codec *codec)
 #define ATI_VERB_GET_MULTICHANNEL_7	0xf88
 #define ATI_VERB_GET_MULTICHANNEL_MODE	0xf89
 
+/* AMD specific HDA cvt verbs */
+#define ATI_VERB_SET_RAMP_RATE		0x770
+#define ATI_VERB_GET_RAMP_RATE		0xf70
+
 #define ATI_OUT_ENABLE 0x1
 
 #define ATI_MULTICHANNEL_MODE_PAIRED	0
@@ -3050,6 +3054,23 @@ static int atihdmi_pin_hbr_setup(struct hda_codec *codec, hda_nid_t pin_nid,
 	return 0;
 }
 
+static int atihdmi_setup_stream(struct hda_codec *codec, hda_nid_t cvt_nid,
+				hda_nid_t pin_nid, u32 stream_tag, int format)
+{
+
+	if (is_amdhdmi_rev3_or_later(codec)) {
+		int ramp_rate = 180; /* default as per AMD spec */
+		/* disable ramp-up/down for non-pcm as per AMD spec */
+		if (format & AC_FMT_TYPE_NON_PCM)
+			ramp_rate = 0;
+
+		snd_hda_codec_write(codec, cvt_nid, 0, ATI_VERB_SET_RAMP_RATE, ramp_rate);
+	}
+
+	return hdmi_setup_stream(codec, cvt_nid, pin_nid, stream_tag, format);
+}
+
+
 static int atihdmi_init(struct hda_codec *codec)
 {
 	struct hdmi_spec *spec = codec->spec;
@@ -3096,6 +3117,7 @@ static int patch_atihdmi(struct hda_codec *codec)
 	spec->ops.pin_set_slot_channel = atihdmi_pin_set_slot_channel;
 	spec->ops.pin_setup_infoframe = atihdmi_pin_setup_infoframe;
 	spec->ops.pin_hbr_setup = atihdmi_pin_hbr_setup;
+	spec->ops.setup_stream = atihdmi_setup_stream;
 
 	if (!has_amd_full_remap_support(codec)) {
 		/* override to ATI/AMD-specific versions with pairwise mapping */
-- 
1.8.1.5

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* Re: [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support
  2013-10-24 18:10 [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support Anssi Hannula
                   ` (4 preceding siblings ...)
  2013-10-24 18:10 ` [PATCH 5/5] ALSA: hda - hdmi: Disable ramp-up/down for non-PCM on AMD codecs Anssi Hannula
@ 2013-10-24 18:26 ` Anssi Hannula
  2013-11-08  5:08   ` Olivier Langlois
  2013-10-24 23:04 ` Takashi Iwai
                   ` (2 subsequent siblings)
  8 siblings, 1 reply; 71+ messages in thread
From: Anssi Hannula @ 2013-10-24 18:26 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: Olivier Langlois, alsa-devel, Peter Frühberger

24.10.2013 21:10, Anssi Hannula kirjoitti:
> Hi all!
> 
> Here's another revision of the ATI/AMD multichannel+HBR patchset.
> 
> Changes:
> - added customizable callbacks instead of polluting generic code
> - fixed wrong codec id in rev3+ check (as previously noted)
> - cosmetics
> 
> I've only tested this on NVIDIA/Intel, but I'd guess at least Peter
> should be able to test this on AMD in a few days or so. The earlier
> revisions were tested to fully work.
> 
> Combined patch can be found at: http://onse.fi/files/atihdmi5.patch
> However, this patchset is on top recent sound-next commits so it does not
> directly apply on older kernels.

Aand that would be http://onse.fi/files/atihdmi6.patch not 5.

> Olivier, I hope you will be able to test this at some point as well
> (same things as last time), even though it will be a bit more work :)

-- 
Anssi Hannula

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH 5/5] ALSA: hda - hdmi: Disable ramp-up/down for non-PCM on AMD codecs
  2013-10-24 18:10 ` [PATCH 5/5] ALSA: hda - hdmi: Disable ramp-up/down for non-PCM on AMD codecs Anssi Hannula
@ 2013-10-24 19:00   ` Anssi Hannula
  0 siblings, 0 replies; 71+ messages in thread
From: Anssi Hannula @ 2013-10-24 19:00 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: Olivier Langlois, alsa-devel, Peter Frühberger

24.10.2013 21:10, Anssi Hannula kirjoitti:
> Recent AMD HDMI codecs (revision ID 3 and later, 0x100300 as reported by
> procfs codec#0) have a configurable ramp-up/down functionality.
> 
> The documentation ( http://www.x.org/docs/AMD/AMD_HDA_verbs_v2.pdf )
> specifies that 180 ("180/256 =~ 0.7") is recommended for PCM and 0 for
> non-PCM.
> 
> Apply the recommended values according to provided S/PDIF AES0 settings
> since ramp-up/down does not make sense for non-PCM.
> 
> v2: adapted to hdmi_ops infrastructure
> 
> Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
> Tested-by: Olivier Langlois <olivier@trillion01.com> # v1

Hmm, actually, re-reading mails reveals that Olivier didn't find the
expected difference with this setting, except for "maybe slightly slower
startup with AES0=6" (i.e. value 0, which is unexpected).

So maybe
a) it makes too unnoticiable a difference, or
b) only affects certain hardware (card and/or sink), or
c) ramp-up/down is only triggered with the MUTE bit of
   ATI_VERB_SET_MULTICHANNEL_xx which is also rev3+ specific,
   but is not presently used by the driver,
or something else.

So there's a significant chance setting ramp rate is useless for us ATM,
but probably does not do actual harm either.

Takashi, I'll leave it to you whether to apply this one (if you apply,
feel free to add to patch description e.g. "No actual playback
difference has been found in testing, so possibly something more is
needed for ramp-up/down.").

I guess I might investigate the ramp-up/down/MUTE-bit stuff more at some
point, but probably not in the next few months...


> ---
>  sound/pci/hda/patch_hdmi.c | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
> 
> diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
> index 2c45591..74bd2e63ce 100644
> --- a/sound/pci/hda/patch_hdmi.c
> +++ b/sound/pci/hda/patch_hdmi.c
> @@ -2819,6 +2819,10 @@ static int patch_nvhdmi_8ch_7x(struct hda_codec *codec)
>  #define ATI_VERB_GET_MULTICHANNEL_7	0xf88
>  #define ATI_VERB_GET_MULTICHANNEL_MODE	0xf89
>  
> +/* AMD specific HDA cvt verbs */
> +#define ATI_VERB_SET_RAMP_RATE		0x770
> +#define ATI_VERB_GET_RAMP_RATE		0xf70
> +
>  #define ATI_OUT_ENABLE 0x1
>  
>  #define ATI_MULTICHANNEL_MODE_PAIRED	0
> @@ -3050,6 +3054,23 @@ static int atihdmi_pin_hbr_setup(struct hda_codec *codec, hda_nid_t pin_nid,
>  	return 0;
>  }
>  
> +static int atihdmi_setup_stream(struct hda_codec *codec, hda_nid_t cvt_nid,
> +				hda_nid_t pin_nid, u32 stream_tag, int format)
> +{
> +
> +	if (is_amdhdmi_rev3_or_later(codec)) {
> +		int ramp_rate = 180; /* default as per AMD spec */
> +		/* disable ramp-up/down for non-pcm as per AMD spec */
> +		if (format & AC_FMT_TYPE_NON_PCM)
> +			ramp_rate = 0;
> +
> +		snd_hda_codec_write(codec, cvt_nid, 0, ATI_VERB_SET_RAMP_RATE, ramp_rate);
> +	}
> +
> +	return hdmi_setup_stream(codec, cvt_nid, pin_nid, stream_tag, format);
> +}
> +
> +
>  static int atihdmi_init(struct hda_codec *codec)
>  {
>  	struct hdmi_spec *spec = codec->spec;
> @@ -3096,6 +3117,7 @@ static int patch_atihdmi(struct hda_codec *codec)
>  	spec->ops.pin_set_slot_channel = atihdmi_pin_set_slot_channel;
>  	spec->ops.pin_setup_infoframe = atihdmi_pin_setup_infoframe;
>  	spec->ops.pin_hbr_setup = atihdmi_pin_hbr_setup;
> +	spec->ops.setup_stream = atihdmi_setup_stream;
>  
>  	if (!has_amd_full_remap_support(codec)) {
>  		/* override to ATI/AMD-specific versions with pairwise mapping */
> 
-- 
Anssi Hannula

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support
  2013-10-24 18:10 [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support Anssi Hannula
                   ` (5 preceding siblings ...)
  2013-10-24 18:26 ` [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support Anssi Hannula
@ 2013-10-24 23:04 ` Takashi Iwai
  2013-10-25 16:54   ` Andre Heider
  2013-11-02 15:32 ` [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support Anssi Hannula
  2013-11-23  1:05 ` James Le Cuirot
  8 siblings, 1 reply; 71+ messages in thread
From: Takashi Iwai @ 2013-10-24 23:04 UTC (permalink / raw)
  To: Anssi Hannula; +Cc: Olivier Langlois, alsa-devel, Peter Frühberger

At Thu, 24 Oct 2013 21:10:33 +0300,
Anssi Hannula wrote:
> 
> Hi all!
> 
> Here's another revision of the ATI/AMD multichannel+HBR patchset.
> 
> Changes:
> - added customizable callbacks instead of polluting generic code
> - fixed wrong codec id in rev3+ check (as previously noted)
> - cosmetics
> 
> I've only tested this on NVIDIA/Intel, but I'd guess at least Peter
> should be able to test this on AMD in a few days or so. The earlier
> revisions were tested to fully work.
> 
> Combined patch can be found at: http://onse.fi/files/atihdmi5.patch
> However, this patchset is on top recent sound-next commits so it does not
> directly apply on older kernels.
> 
> Olivier, I hope you will be able to test this at some point as well
> (same things as last time), even though it will be a bit more work :)

I applied all patches now.  You can try sound git tree either master
or for-next branch.


thanks,

Takashi

> 
> Anssi Hannula (5):
>       ALSA: hda - hdmi: Allow HDA patches to customize more operations
>       ALSA: hda - hdmi: Add ATI/AMD multi-channel audio support
>       ALSA: hda - hdmi: Add ELD emulation for ATI/AMD codecs
>       ALSA: hda - hdmi: Add HBR bitstreaming support for ATI/AMD HDMI codecs
>       ALSA: hda - hdmi: Disable ramp-up/down for non-PCM on AMD codecs
> 
>  sound/pci/hda/hda_eld.c    | 151 +++++++++++
>  sound/pci/hda/hda_local.h  |   4 +
>  sound/pci/hda/patch_hdmi.c | 643 +++++++++++++++++++++++++++++++++++++--------
>  3 files changed, 689 insertions(+), 109 deletions(-)
> 
> -- 
> Anssi Hannula
> 
> 

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support
  2013-10-24 23:04 ` Takashi Iwai
@ 2013-10-25 16:54   ` Andre Heider
  2013-10-25 17:13     ` Takashi Iwai
  2013-10-25 17:23     ` Anssi Hannula
  0 siblings, 2 replies; 71+ messages in thread
From: Andre Heider @ 2013-10-25 16:54 UTC (permalink / raw)
  To: Takashi Iwai
  Cc: Anssi Hannula, alsa-devel, Peter Frühberger, Olivier Langlois

On Fri, Oct 25, 2013 at 01:04:45AM +0200, Takashi Iwai wrote:
> At Thu, 24 Oct 2013 21:10:33 +0300,
> Anssi Hannula wrote:
> > 
> > Hi all!
> > 
> > Here's another revision of the ATI/AMD multichannel+HBR patchset.
> > 
> > Changes:
> > - added customizable callbacks instead of polluting generic code
> > - fixed wrong codec id in rev3+ check (as previously noted)
> > - cosmetics
> > 
> > I've only tested this on NVIDIA/Intel, but I'd guess at least Peter
> > should be able to test this on AMD in a few days or so. The earlier
> > revisions were tested to fully work.
> > 
> > Combined patch can be found at: http://onse.fi/files/atihdmi5.patch
> > However, this patchset is on top recent sound-next commits so it does not
> > directly apply on older kernels.
> > 
> > Olivier, I hope you will be able to test this at some point as well
> > (same things as last time), even though it will be a bit more work :)
> 
> I applied all patches now.  You can try sound git tree either master
> or for-next branch.

Takashi,

with today's Linus' master and your master branch merged in I get:
ERROR: "gen_pool_free" [sound/core/snd-page-alloc.ko] undefined!

my .config had CONFIG_HAS_DMA=y but no CONFIG_GENERIC_ALLOCATOR, is
there a select missing?


Anssi,

I gave this a quick test, and it works on my 6850! Nice work!
The HDMI output is connected to a Onkyo receiver from the future ;) :
	EDID for output HDMI-0
	Manufacturer: ONK  Model: 1  Serial#: 16777216
	Year: 2245  Week: 255
	EDID Version: 1.3
	EDID (in hex):
		00ffffffffffff003dcb010000000001
		ffff0103800000780a0dc9a057479827
		12484c00000001010101010101010101
		010101010101011d8018711c1620582c
		2500c48e2100009e011d007251d01e20
		6e285500c48e2100001e000000fc0054
		582d53523637342020202020000000fd
		00313d0f2e08000a202020202020019b
		02032f724f8504030f0e07069413121e
		1d1615012f097f070f1f071707503707
		503f07c0834f000066030c00ffff808c
		0ad08a20e02d10103e9600c48e210000
		18011d80d0721c1620102c2580c48e21
		00009e011d00bc52d01e20b8285540c4
		8e2100001e8c0ad090204031200c4055
		00c48e210000180000000000000000a8

No DTS-HD/TrueHD support, but all 5.1 channels are working correctly.

cat /proc/asound/card0/codec\#0
	Codec: ATI R6xx HDMI
	Address: 0
	AFG Function Id: 0x1 (unsol 0)
	Vendor Id: 0x1002aa01
	Subsystem Id: 0x00aa0100
	Revision Id: 0x100200
	No Modem Function Group found
	Default PCM:
		rates [0x70]: 32000 44100 48000
		bits [0x2]: 16
		formats [0x1]: PCM
	Default Amp-In caps: N/A
	Default Amp-Out caps: N/A
	State of AFG node 0x01:
	  Power states:  D0 D3
	  Power: setting=D0, actual=D0
	GPIO: io=0, o=0, i=0, unsolicited=0, wake=0
	Node 0x02 [Audio Output] wcaps 0x201: Stereo Digital
	  Device: name="HDMI 0", type="HDMI", device=3
	  Converter: stream=1, channel=0
	  Digital: Enabled GenLevel
	  Digital category: 0x2
	  IEC Coding Type: 0x0
	Node 0x03 [Pin Complex] wcaps 0x400381: Stereo Digital
	  Control: name="HDMI/DP,pcm=3 Jack", index=0, device=0
	  Control: name="IEC958 Playback Con Mask", index=0, device=0
	  Control: name="IEC958 Playback Pro Mask", index=0, device=0
	  Control: name="IEC958 Playback Default", index=0, device=0
	  Control: name="IEC958 Playback Switch", index=0, device=0
	  Control: name="ELD", index=0, device=3
	  Pincap 0x00000094: OUT Detect HDMI
	  Pin Default 0x18560010: [Jack] Digital Out at Int HDMI
		Conn = Digital, Color = Unknown
		DefAssociation = 0x1, Sequence = 0x0
	  Pin-ctls: 0x40: OUT
	  Unsolicited: tag=01, enabled=1
	  Connection: 1
		 0x02

cat /proc/asound/card0/eld\#0.0
	monitor_present		1
	eld_valid		0

Regards,
Andre

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support
  2013-10-25 16:54   ` Andre Heider
@ 2013-10-25 17:13     ` Takashi Iwai
  2013-10-25 17:23     ` Anssi Hannula
  1 sibling, 0 replies; 71+ messages in thread
From: Takashi Iwai @ 2013-10-25 17:13 UTC (permalink / raw)
  To: Andre Heider
  Cc: Anssi Hannula, alsa-devel, Peter Frühberger, Olivier Langlois

At Fri, 25 Oct 2013 18:54:52 +0200,
Andre Heider wrote:
> 
> On Fri, Oct 25, 2013 at 01:04:45AM +0200, Takashi Iwai wrote:
> > At Thu, 24 Oct 2013 21:10:33 +0300,
> > Anssi Hannula wrote:
> > > 
> > > Hi all!
> > > 
> > > Here's another revision of the ATI/AMD multichannel+HBR patchset.
> > > 
> > > Changes:
> > > - added customizable callbacks instead of polluting generic code
> > > - fixed wrong codec id in rev3+ check (as previously noted)
> > > - cosmetics
> > > 
> > > I've only tested this on NVIDIA/Intel, but I'd guess at least Peter
> > > should be able to test this on AMD in a few days or so. The earlier
> > > revisions were tested to fully work.
> > > 
> > > Combined patch can be found at: http://onse.fi/files/atihdmi5.patch
> > > However, this patchset is on top recent sound-next commits so it does not
> > > directly apply on older kernels.
> > > 
> > > Olivier, I hope you will be able to test this at some point as well
> > > (same things as last time), even though it will be a bit more work :)
> > 
> > I applied all patches now.  You can try sound git tree either master
> > or for-next branch.
> 
> Takashi,
> 
> with today's Linus' master and your master branch merged in I get:
> ERROR: "gen_pool_free" [sound/core/snd-page-alloc.ko] undefined!
> 
> my .config had CONFIG_HAS_DMA=y but no CONFIG_GENERIC_ALLOCATOR, is
> there a select missing?

This should have been already fixed.  Let me know if the problem still
happens with the latest tree.


thanks,

Takashi

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support
  2013-10-25 16:54   ` Andre Heider
  2013-10-25 17:13     ` Takashi Iwai
@ 2013-10-25 17:23     ` Anssi Hannula
  2013-10-25 18:25       ` Andre Heider
  2013-10-28 17:52       ` Andre Heider
  1 sibling, 2 replies; 71+ messages in thread
From: Anssi Hannula @ 2013-10-25 17:23 UTC (permalink / raw)
  To: Andre Heider
  Cc: Takashi Iwai, Olivier Langlois, alsa-devel, Peter Frühberger

25.10.2013 19:54, Andre Heider kirjoitti:
> On Fri, Oct 25, 2013 at 01:04:45AM +0200, Takashi Iwai wrote:
>> At Thu, 24 Oct 2013 21:10:33 +0300,
>> Anssi Hannula wrote:
>>>
>>> Hi all!
>>>
>>> Here's another revision of the ATI/AMD multichannel+HBR patchset.
>>>
>>> Changes:
>>> - added customizable callbacks instead of polluting generic code
>>> - fixed wrong codec id in rev3+ check (as previously noted)
>>> - cosmetics
>>>
>>> I've only tested this on NVIDIA/Intel, but I'd guess at least Peter
>>> should be able to test this on AMD in a few days or so. The earlier
>>> revisions were tested to fully work.
>>>
>>> Combined patch can be found at: http://onse.fi/files/atihdmi5.patch
>>> However, this patchset is on top recent sound-next commits so it does not
>>> directly apply on older kernels.
>>>
>>> Olivier, I hope you will be able to test this at some point as well
>>> (same things as last time), even though it will be a bit more work :)
>>
>> I applied all patches now.  You can try sound git tree either master
>> or for-next branch.
> 
[...]
> Anssi,
> 
> I gave this a quick test, and it works on my 6850! Nice work!
> The HDMI output is connected to a Onkyo receiver from the future ;) :
> 	EDID for output HDMI-0
> 	Manufacturer: ONK  Model: 1  Serial#: 16777216
> 	Year: 2245  Week: 255
> 	EDID Version: 1.3
> 	EDID (in hex):
[...]
> 
> No DTS-HD/TrueHD support, but all 5.1 channels are working correctly.

Good to hear :)

[...]
> cat /proc/asound/card0/eld\#0.0
> 	monitor_present		1
> 	eld_valid		0

However, this should have eld_valid=1 and contain more info. To get a
hint on whether it is a bug in audio or video driver, could you give a
log with CONFIG_SND_DEBUG ?

AFAICS the sound git master tree should have the necessary support in
the radeon video driver to allow the audio driver to generate a valid
ELD with your card.

-- 
Anssi Hannula

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support
  2013-10-25 17:23     ` Anssi Hannula
@ 2013-10-25 18:25       ` Andre Heider
  2013-10-28 17:52       ` Andre Heider
  1 sibling, 0 replies; 71+ messages in thread
From: Andre Heider @ 2013-10-25 18:25 UTC (permalink / raw)
  To: Anssi Hannula
  Cc: Takashi Iwai, Olivier Langlois, alsa-devel, Peter Frühberger

On Fri, Oct 25, 2013 at 08:23:48PM +0300, Anssi Hannula wrote:
> 25.10.2013 19:54, Andre Heider kirjoitti:
> > cat /proc/asound/card0/eld\#0.0
> > 	monitor_present		1
> > 	eld_valid		0
> 
> However, this should have eld_valid=1 and contain more info. To get a
> hint on whether it is a bug in audio or video driver, could you give a
> log with CONFIG_SND_DEBUG ?
> 
> AFAICS the sound git master tree should have the necessary support in
> the radeon video driver to allow the audio driver to generate a valid
> ELD with your card.

I'm away from that box now, but will give that a try next week.

Regards,
Andre

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support
  2013-10-25 17:23     ` Anssi Hannula
  2013-10-25 18:25       ` Andre Heider
@ 2013-10-28 17:52       ` Andre Heider
  2013-10-28 18:12         ` Anssi Hannula
  1 sibling, 1 reply; 71+ messages in thread
From: Andre Heider @ 2013-10-28 17:52 UTC (permalink / raw)
  To: Anssi Hannula
  Cc: Takashi Iwai, Olivier Langlois, alsa-devel, Peter Frühberger

On Fri, Oct 25, 2013 at 08:23:48PM +0300, Anssi Hannula wrote:
> 25.10.2013 19:54, Andre Heider kirjoitti:
> > cat /proc/asound/card0/eld\#0.0
> > 	monitor_present		1
> > 	eld_valid		0
> 
> However, this should have eld_valid=1 and contain more info. To get a
> hint on whether it is a bug in audio or video driver, could you give a
> log with CONFIG_SND_DEBUG ?
> 
> AFAICS the sound git master tree should have the necessary support in
> the radeon video driver to allow the audio driver to generate a valid
> ELD with your card.

With CONFIG_SND_DEBUG=y I get a bunch of
"HDMI ATI/AMD: no speaker allocation for ELD"
but afaics that's about it.

Regards,
Andre

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support
  2013-10-28 17:52       ` Andre Heider
@ 2013-10-28 18:12         ` Anssi Hannula
  2013-10-28 18:17           ` Andre Heider
  0 siblings, 1 reply; 71+ messages in thread
From: Anssi Hannula @ 2013-10-28 18:12 UTC (permalink / raw)
  To: Andre Heider
  Cc: Takashi Iwai, Olivier Langlois, alsa-devel, Peter Frühberger

28.10.2013 19:52, Andre Heider kirjoitti:
> On Fri, Oct 25, 2013 at 08:23:48PM +0300, Anssi Hannula wrote:
>> 25.10.2013 19:54, Andre Heider kirjoitti:
>>> cat /proc/asound/card0/eld\#0.0
>>> 	monitor_present		1
>>> 	eld_valid		0
>>
>> However, this should have eld_valid=1 and contain more info. To get a
>> hint on whether it is a bug in audio or video driver, could you give a
>> log with CONFIG_SND_DEBUG ?
>>
>> AFAICS the sound git master tree should have the necessary support in
>> the radeon video driver to allow the audio driver to generate a valid
>> ELD with your card.
> 
> With CONFIG_SND_DEBUG=y I get a bunch of
> "HDMI ATI/AMD: no speaker allocation for ELD"
> but afaics that's about it.

Thanks, that is exactly what I was looking for.

Looks like a radeon driver issue - it does not seem to setup the speaker
allocation registers properly (so that ALSA could read them from there),
and I verified that the EDID you posted has a valid speaker allocation
byte 0x4f.

Just to recheck - you are running sound git master, or something else?

-- 
Anssi Hannula

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support
  2013-10-28 18:12         ` Anssi Hannula
@ 2013-10-28 18:17           ` Andre Heider
  2013-10-28 18:25             ` Anssi Hannula
  0 siblings, 1 reply; 71+ messages in thread
From: Andre Heider @ 2013-10-28 18:17 UTC (permalink / raw)
  To: Anssi Hannula
  Cc: Takashi Iwai, Olivier Langlois, alsa-devel, Peter Frühberger

On Mon, Oct 28, 2013 at 08:12:43PM +0200, Anssi Hannula wrote:
> 28.10.2013 19:52, Andre Heider kirjoitti:
> > On Fri, Oct 25, 2013 at 08:23:48PM +0300, Anssi Hannula wrote:
> >> 25.10.2013 19:54, Andre Heider kirjoitti:
> >>> cat /proc/asound/card0/eld\#0.0
> >>> 	monitor_present		1
> >>> 	eld_valid		0
> >>
> >> However, this should have eld_valid=1 and contain more info. To get a
> >> hint on whether it is a bug in audio or video driver, could you give a
> >> log with CONFIG_SND_DEBUG ?
> >>
> >> AFAICS the sound git master tree should have the necessary support in
> >> the radeon video driver to allow the audio driver to generate a valid
> >> ELD with your card.
> > 
> > With CONFIG_SND_DEBUG=y I get a bunch of
> > "HDMI ATI/AMD: no speaker allocation for ELD"
> > but afaics that's about it.
> 
> Thanks, that is exactly what I was looking for.
> 
> Looks like a radeon driver issue - it does not seem to setup the speaker
> allocation registers properly (so that ALSA could read them from there),
> and I verified that the EDID you posted has a valid speaker allocation
> byte 0x4f.
> 
> Just to recheck - you are running sound git master, or something else?

This is from 3.12-rc7 with today's sound/master (3fbdaf9b) merged on top.

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support
  2013-10-28 18:17           ` Andre Heider
@ 2013-10-28 18:25             ` Anssi Hannula
  2013-10-28 18:35               ` Andre Heider
  0 siblings, 1 reply; 71+ messages in thread
From: Anssi Hannula @ 2013-10-28 18:25 UTC (permalink / raw)
  To: Andre Heider
  Cc: Takashi Iwai, Olivier Langlois, alsa-devel, Peter Frühberger

28.10.2013 20:17, Andre Heider kirjoitti:
> On Mon, Oct 28, 2013 at 08:12:43PM +0200, Anssi Hannula wrote:
>> 28.10.2013 19:52, Andre Heider kirjoitti:
>>> On Fri, Oct 25, 2013 at 08:23:48PM +0300, Anssi Hannula wrote:
>>>> 25.10.2013 19:54, Andre Heider kirjoitti:
>>>>> cat /proc/asound/card0/eld\#0.0
>>>>> 	monitor_present		1
>>>>> 	eld_valid		0
>>>>
>>>> However, this should have eld_valid=1 and contain more info. To get a
>>>> hint on whether it is a bug in audio or video driver, could you give a
>>>> log with CONFIG_SND_DEBUG ?
>>>>
>>>> AFAICS the sound git master tree should have the necessary support in
>>>> the radeon video driver to allow the audio driver to generate a valid
>>>> ELD with your card.
>>>
>>> With CONFIG_SND_DEBUG=y I get a bunch of
>>> "HDMI ATI/AMD: no speaker allocation for ELD"
>>> but afaics that's about it.
>>
>> Thanks, that is exactly what I was looking for.
>>
>> Looks like a radeon driver issue - it does not seem to setup the speaker
>> allocation registers properly (so that ALSA could read them from there),
>> and I verified that the EDID you posted has a valid speaker allocation
>> byte 0x4f.
>>
>> Just to recheck - you are running sound git master, or something else?
> 
> This is from 3.12-rc7 with today's sound/master (3fbdaf9b) merged on top.
> 

Ah, OK, that certainly explains it. 3.12-x has this one:
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/drivers/gpu/drm/radeon?id=555b1b651acf44bf27ebbb04235d38a8fd2d58dc

Could you revert that for testing, just to see if you get proper ELD
info then?

Thanks.

-- 
Anssi Hannula

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support
  2013-10-28 18:25             ` Anssi Hannula
@ 2013-10-28 18:35               ` Andre Heider
  2013-10-28 20:35                 ` Anssi Hannula
  0 siblings, 1 reply; 71+ messages in thread
From: Andre Heider @ 2013-10-28 18:35 UTC (permalink / raw)
  To: Anssi Hannula
  Cc: Takashi Iwai, Olivier Langlois, alsa-devel, Peter Frühberger

On Mon, Oct 28, 2013 at 08:25:22PM +0200, Anssi Hannula wrote:
> 28.10.2013 20:17, Andre Heider kirjoitti:
> > On Mon, Oct 28, 2013 at 08:12:43PM +0200, Anssi Hannula wrote:
> >> 28.10.2013 19:52, Andre Heider kirjoitti:
> >>> On Fri, Oct 25, 2013 at 08:23:48PM +0300, Anssi Hannula wrote:
> >>>> 25.10.2013 19:54, Andre Heider kirjoitti:
> >>>>> cat /proc/asound/card0/eld\#0.0
> >>>>> 	monitor_present		1
> >>>>> 	eld_valid		0
> >>>>
> >>>> However, this should have eld_valid=1 and contain more info. To get a
> >>>> hint on whether it is a bug in audio or video driver, could you give a
> >>>> log with CONFIG_SND_DEBUG ?
> >>>>
> >>>> AFAICS the sound git master tree should have the necessary support in
> >>>> the radeon video driver to allow the audio driver to generate a valid
> >>>> ELD with your card.
> >>>
> >>> With CONFIG_SND_DEBUG=y I get a bunch of
> >>> "HDMI ATI/AMD: no speaker allocation for ELD"
> >>> but afaics that's about it.
> >>
> >> Thanks, that is exactly what I was looking for.
> >>
> >> Looks like a radeon driver issue - it does not seem to setup the speaker
> >> allocation registers properly (so that ALSA could read them from there),
> >> and I verified that the EDID you posted has a valid speaker allocation
> >> byte 0x4f.
> >>
> >> Just to recheck - you are running sound git master, or something else?
> > 
> > This is from 3.12-rc7 with today's sound/master (3fbdaf9b) merged on top.
> > 
> 
> Ah, OK, that certainly explains it. 3.12-x has this one:
> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/drivers/gpu/drm/radeon?id=555b1b651acf44bf27ebbb04235d38a8fd2d58dc
> 
> Could you revert that for testing, just to see if you get proper ELD
> info then?

Blergh, guess that's my fault for not just using sound/master.

But that looks better:

cat /proc/asound/card0/eld\#0.0
	monitor_present		1
	eld_valid		1
	monitor_name		
	connection_type		HDMI
	eld_version		[0x2] CEA-861D or below
	edid_version		[0x0] no CEA EDID Timing Extension block present
	manufacture_id		0x0
	product_id		0x0
	port_id			0x0
	support_hdcp		0
	support_ai		0
	audio_sync_delay	0
	speakers		[0x4f] FL/FR LFE FC RL/RR RLC/RRC
	sad_count		4
	sad0_coding_type	[0x1] LPCM
	sad0_channels		2
	sad0_rates		[0x1ee0] 32000 44100 48000 88200 96000 176400 192000
	sad0_bits		[0xe0000] 16 20 24
	sad1_coding_type	[0x2] AC-3
	sad1_channels		8
	sad1_rates		[0xe0] 32000 44100 48000
	sad1_max_bitrate	640000
	sad2_coding_type	[0x6] AAC-LC
	sad2_channels		8
	sad2_rates		[0xe0] 32000 44100 48000
	sad2_max_bitrate	640000
	sad3_coding_type	[0x7] DTS
	sad3_channels		8
	sad3_rates		[0xe0] 32000 44100 48000
	sad3_max_bitrate	1536000

Thanks,
Andre

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support
  2013-10-28 18:35               ` Andre Heider
@ 2013-10-28 20:35                 ` Anssi Hannula
  2013-10-28 22:00                   ` Andre Heider
  0 siblings, 1 reply; 71+ messages in thread
From: Anssi Hannula @ 2013-10-28 20:35 UTC (permalink / raw)
  To: Andre Heider; +Cc: Takashi Iwai, alsa-devel, Peter Frühberger

[-- Attachment #1: Type: text/plain, Size: 2929 bytes --]

28.10.2013 20:35, Andre Heider kirjoitti:
> On Mon, Oct 28, 2013 at 08:25:22PM +0200, Anssi Hannula wrote:
>> 28.10.2013 20:17, Andre Heider kirjoitti:
>>> On Mon, Oct 28, 2013 at 08:12:43PM +0200, Anssi Hannula wrote:
>>>> 28.10.2013 19:52, Andre Heider kirjoitti:
>>>>> On Fri, Oct 25, 2013 at 08:23:48PM +0300, Anssi Hannula wrote:
>>>>>> 25.10.2013 19:54, Andre Heider kirjoitti:
>>>>>>> cat /proc/asound/card0/eld\#0.0
>>>>>>> 	monitor_present		1
>>>>>>> 	eld_valid		0
>>>>>>
>>>>>> However, this should have eld_valid=1 and contain more info. To get a
>>>>>> hint on whether it is a bug in audio or video driver, could you give a
>>>>>> log with CONFIG_SND_DEBUG ?
>>>>>>
>>>>>> AFAICS the sound git master tree should have the necessary support in
>>>>>> the radeon video driver to allow the audio driver to generate a valid
>>>>>> ELD with your card.
>>>>>
>>>>> With CONFIG_SND_DEBUG=y I get a bunch of
>>>>> "HDMI ATI/AMD: no speaker allocation for ELD"
>>>>> but afaics that's about it.
>>>>
>>>> Thanks, that is exactly what I was looking for.
>>>>
>>>> Looks like a radeon driver issue - it does not seem to setup the speaker
>>>> allocation registers properly (so that ALSA could read them from there),
>>>> and I verified that the EDID you posted has a valid speaker allocation
>>>> byte 0x4f.
>>>>
>>>> Just to recheck - you are running sound git master, or something else?
>>>
>>> This is from 3.12-rc7 with today's sound/master (3fbdaf9b) merged on top.
>>>
>>
>> Ah, OK, that certainly explains it. 3.12-x has this one:
>> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/drivers/gpu/drm/radeon?id=555b1b651acf44bf27ebbb04235d38a8fd2d58dc
>>
>> Could you revert that for testing, just to see if you get proper ELD
>> info then?
> 
> Blergh, guess that's my fault for not just using sound/master.
> 
> But that looks better:
> 
> cat /proc/asound/card0/eld\#0.0
> 	monitor_present		1
> 	eld_valid		1
> 	monitor_name		
> 	connection_type		HDMI
> 	eld_version		[0x2] CEA-861D or below
> 	edid_version		[0x0] no CEA EDID Timing Extension block present
> 	manufacture_id		0x0
> 	product_id		0x0
> 	port_id			0x0
> 	support_hdcp		0
> 	support_ai		0
> 	audio_sync_delay	0
> 	speakers		[0x4f] FL/FR LFE FC RL/RR RLC/RRC
> 	sad_count		4
> 	sad0_coding_type	[0x1] LPCM
> 	sad0_channels		2
> 	sad0_rates		[0x1ee0] 32000 44100 48000 88200 96000 176400 192000
> 	sad0_bits		[0xe0000] 16 20 24

Thanks.

Hmm, seems we have bug in the radeon driver, we are missing the
8-channel PCM SAD here.

Can you try the attached patch?

> 	sad1_coding_type	[0x2] AC-3
> 	sad1_channels		8
> 	sad1_rates		[0xe0] 32000 44100 48000
> 	sad1_max_bitrate	640000
> 	sad2_coding_type	[0x6] AAC-LC
> 	sad2_channels		8
> 	sad2_rates		[0xe0] 32000 44100 48000
> 	sad2_max_bitrate	640000
> 	sad3_coding_type	[0x7] DTS
> 	sad3_channels		8
> 	sad3_rates		[0xe0] 32000 44100 48000
> 	sad3_max_bitrate	1536000


-- 
Anssi Hannula

[-- Attachment #2: 0001-drm-radeon-audio-fix-missing-multichannel-PCM-SAD-in.patch --]
[-- Type: text/x-patch, Size: 4961 bytes --]

>From e9b1708c50a5679eabf0af9489b1a3265e2081bb Mon Sep 17 00:00:00 2001
From: Anssi Hannula <anssi.hannula@iki.fi>
Date: Mon, 28 Oct 2013 22:18:10 +0200
Subject: [PATCH] drm/radeon/audio: fix missing multichannel PCM SAD in some
 cases

The current code writing SADs to the audio registers seems to assume
that there is at most a single SAD per audio format.

However, that is not the case. Especially for PCM it is somewhat common
for sinks to have two SADs, one for 8-channel and one for 2-channel
audio, which may have different supported sample rates (i.e. the sink
supports stereo audio at higher sample rates than multichannel audio).
While multiple SADs per non-PCM audio format is also allowed, I have not
seen this and it would indeed not be useful in normal circumstances.

Because of this, only the 2-channel SAD may be used if it appears before
the 8-channel SAD.

Fix the code to pick the PCM SAD with the highest number of channels,
while merging the rate masks of PCM SADs with lower amount of channels
into the stereo rate mask.

Reported-by: Andre Heider <a.heider@gmail.com>
Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>

---
 drivers/gpu/drm/radeon/dce6_afmt.c      | 20 +++++++++++++++-----
 drivers/gpu/drm/radeon/evergreen_hdmi.c | 20 +++++++++++++++-----
 drivers/gpu/drm/radeon/r600_hdmi.c      | 20 +++++++++++++++-----
 3 files changed, 45 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/radeon/dce6_afmt.c b/drivers/gpu/drm/radeon/dce6_afmt.c
index 85a69d2..0a0fcee 100644
--- a/drivers/gpu/drm/radeon/dce6_afmt.c
+++ b/drivers/gpu/drm/radeon/dce6_afmt.c
@@ -198,20 +198,30 @@ void dce6_afmt_write_sad_regs(struct drm_encoder *encoder)
 
 	for (i = 0; i < ARRAY_SIZE(eld_reg_to_type); i++) {
 		u32 value = 0;
+		u8 stereo_freqs = 0;
+		int max_channels = -1;
 		int j;
 
 		for (j = 0; j < sad_count; j++) {
 			struct cea_sad *sad = &sads[j];
 
 			if (sad->format == eld_reg_to_type[i][1]) {
-				value = MAX_CHANNELS(sad->channels) |
-					DESCRIPTOR_BYTE_2(sad->byte2) |
-					SUPPORTED_FREQUENCIES(sad->freq);
+				if (sad->channels > max_channels) {
+					value = MAX_CHANNELS(sad->channels) |
+						DESCRIPTOR_BYTE_2(sad->byte2) |
+						SUPPORTED_FREQUENCIES(sad->freq);
+					max_channels = sad->channels;
+				}
+
 				if (sad->format == HDMI_AUDIO_CODING_TYPE_PCM)
-					value |= SUPPORTED_FREQUENCIES_STEREO(sad->freq);
-				break;
+					stereo_freqs |= sad->freq;
+				else
+					break;
 			}
 		}
+
+		value |= SUPPORTED_FREQUENCIES_STEREO(stereo_freqs);
+
 		WREG32_ENDPOINT(offset, eld_reg_to_type[i][0], value);
 	}
 
diff --git a/drivers/gpu/drm/radeon/evergreen_hdmi.c b/drivers/gpu/drm/radeon/evergreen_hdmi.c
index f71ce39..2a4837d 100644
--- a/drivers/gpu/drm/radeon/evergreen_hdmi.c
+++ b/drivers/gpu/drm/radeon/evergreen_hdmi.c
@@ -139,20 +139,30 @@ static void evergreen_hdmi_write_sad_regs(struct drm_encoder *encoder)
 
 	for (i = 0; i < ARRAY_SIZE(eld_reg_to_type); i++) {
 		u32 value = 0;
+		u8 stereo_freqs = 0;
+		int max_channels = -1;
 		int j;
 
 		for (j = 0; j < sad_count; j++) {
 			struct cea_sad *sad = &sads[j];
 
 			if (sad->format == eld_reg_to_type[i][1]) {
-				value = MAX_CHANNELS(sad->channels) |
-					DESCRIPTOR_BYTE_2(sad->byte2) |
-					SUPPORTED_FREQUENCIES(sad->freq);
+				if (sad->channels > max_channels) {
+					value = MAX_CHANNELS(sad->channels) |
+						DESCRIPTOR_BYTE_2(sad->byte2) |
+						SUPPORTED_FREQUENCIES(sad->freq);
+					max_channels = sad->channels;
+				}
+
 				if (sad->format == HDMI_AUDIO_CODING_TYPE_PCM)
-					value |= SUPPORTED_FREQUENCIES_STEREO(sad->freq);
-				break;
+					stereo_freqs |= sad->freq;
+				else
+					break;
 			}
 		}
+
+		value |= SUPPORTED_FREQUENCIES_STEREO(stereo_freqs);
+
 		WREG32(eld_reg_to_type[i][0], value);
 	}
 
diff --git a/drivers/gpu/drm/radeon/r600_hdmi.c b/drivers/gpu/drm/radeon/r600_hdmi.c
index f443010..da5cfa4 100644
--- a/drivers/gpu/drm/radeon/r600_hdmi.c
+++ b/drivers/gpu/drm/radeon/r600_hdmi.c
@@ -364,20 +364,30 @@ static void dce3_2_afmt_write_sad_regs(struct drm_encoder *encoder)
 
 	for (i = 0; i < ARRAY_SIZE(eld_reg_to_type); i++) {
 		u32 value = 0;
+		u8 stereo_freqs = 0;
+		int max_channels = -1;
 		int j;
 
 		for (j = 0; j < sad_count; j++) {
 			struct cea_sad *sad = &sads[j];
 
 			if (sad->format == eld_reg_to_type[i][1]) {
-				value = MAX_CHANNELS(sad->channels) |
-					DESCRIPTOR_BYTE_2(sad->byte2) |
-					SUPPORTED_FREQUENCIES(sad->freq);
+				if (sad->channels > max_channels) {
+					value = MAX_CHANNELS(sad->channels) |
+						DESCRIPTOR_BYTE_2(sad->byte2) |
+						SUPPORTED_FREQUENCIES(sad->freq);
+					max_channels = sad->channels;
+				}
+
 				if (sad->format == HDMI_AUDIO_CODING_TYPE_PCM)
-					value |= SUPPORTED_FREQUENCIES_STEREO(sad->freq);
-				break;
+					stereo_freqs |= sad->freq;
+				else
+					break;
 			}
 		}
+
+		value |= SUPPORTED_FREQUENCIES_STEREO(stereo_freqs);
+
 		WREG32(eld_reg_to_type[i][0], value);
 	}
 
-- 
1.8.1.5


[-- Attachment #3: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply related	[flat|nested] 71+ messages in thread

* Re: [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support
  2013-10-28 20:35                 ` Anssi Hannula
@ 2013-10-28 22:00                   ` Andre Heider
  2013-10-28 22:42                     ` Anssi Hannula
  0 siblings, 1 reply; 71+ messages in thread
From: Andre Heider @ 2013-10-28 22:00 UTC (permalink / raw)
  To: Anssi Hannula; +Cc: Takashi Iwai, alsa-devel, Peter Frühberger

On Mon, Oct 28, 2013 at 10:35:56PM +0200, Anssi Hannula wrote:
> 28.10.2013 20:35, Andre Heider kirjoitti:
> > On Mon, Oct 28, 2013 at 08:25:22PM +0200, Anssi Hannula wrote:
> >> 28.10.2013 20:17, Andre Heider kirjoitti:
> >>> On Mon, Oct 28, 2013 at 08:12:43PM +0200, Anssi Hannula wrote:
> >>>> 28.10.2013 19:52, Andre Heider kirjoitti:
> >>>>> On Fri, Oct 25, 2013 at 08:23:48PM +0300, Anssi Hannula wrote:
> >>>>>> 25.10.2013 19:54, Andre Heider kirjoitti:
> >>>>>>> cat /proc/asound/card0/eld\#0.0
> >>>>>>> 	monitor_present		1
> >>>>>>> 	eld_valid		0
> >>>>>>
> >>>>>> However, this should have eld_valid=1 and contain more info. To get a
> >>>>>> hint on whether it is a bug in audio or video driver, could you give a
> >>>>>> log with CONFIG_SND_DEBUG ?
> >>>>>>
> >>>>>> AFAICS the sound git master tree should have the necessary support in
> >>>>>> the radeon video driver to allow the audio driver to generate a valid
> >>>>>> ELD with your card.
> >>>>>
> >>>>> With CONFIG_SND_DEBUG=y I get a bunch of
> >>>>> "HDMI ATI/AMD: no speaker allocation for ELD"
> >>>>> but afaics that's about it.
> >>>>
> >>>> Thanks, that is exactly what I was looking for.
> >>>>
> >>>> Looks like a radeon driver issue - it does not seem to setup the speaker
> >>>> allocation registers properly (so that ALSA could read them from there),
> >>>> and I verified that the EDID you posted has a valid speaker allocation
> >>>> byte 0x4f.
> >>>>
> >>>> Just to recheck - you are running sound git master, or something else?
> >>>
> >>> This is from 3.12-rc7 with today's sound/master (3fbdaf9b) merged on top.
> >>>
> >>
> >> Ah, OK, that certainly explains it. 3.12-x has this one:
> >> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/drivers/gpu/drm/radeon?id=555b1b651acf44bf27ebbb04235d38a8fd2d58dc
> >>
> >> Could you revert that for testing, just to see if you get proper ELD
> >> info then?
> > 
> > Blergh, guess that's my fault for not just using sound/master.
> > 
> > But that looks better:
> > 
> > cat /proc/asound/card0/eld\#0.0
> > 	monitor_present		1
> > 	eld_valid		1
> > 	monitor_name		
> > 	connection_type		HDMI
> > 	eld_version		[0x2] CEA-861D or below
> > 	edid_version		[0x0] no CEA EDID Timing Extension block present
> > 	manufacture_id		0x0
> > 	product_id		0x0
> > 	port_id			0x0
> > 	support_hdcp		0
> > 	support_ai		0
> > 	audio_sync_delay	0
> > 	speakers		[0x4f] FL/FR LFE FC RL/RR RLC/RRC
> > 	sad_count		4
> > 	sad0_coding_type	[0x1] LPCM
> > 	sad0_channels		2
> > 	sad0_rates		[0x1ee0] 32000 44100 48000 88200 96000 176400 192000
> > 	sad0_bits		[0xe0000] 16 20 24
> 
> Thanks.
> 
> Hmm, seems we have bug in the radeon driver, we are missing the
> 8-channel PCM SAD here.
> 
> Can you try the attached patch?

Sure, with that patch I get:

	monitor_present		1
	eld_valid		1
	monitor_name		
	connection_type		HDMI
	eld_version		[0x2] CEA-861D or below
	edid_version		[0x0] no CEA EDID Timing Extension block present
	manufacture_id		0x0
	product_id		0x0
	port_id			0x0
	support_hdcp		0
	support_ai		0
	audio_sync_delay	0
	speakers		[0x4f] FL/FR LFE FC RL/RR RLC/RRC
	sad_count		5
	sad0_coding_type	[0x1] LPCM
	sad0_channels		8
	sad0_rates		[0x6e0] 32000 44100 48000 88200 96000
	sad0_bits		[0xe0000] 16 20 24
	sad1_coding_type	[0x1] LPCM
	sad1_channels		2
	sad1_rates		[0x1ee0] 32000 44100 48000 88200 96000 176400 192000
	sad1_bits		[0xe0000] 16 20 24
	sad2_coding_type	[0x2] AC-3
	sad2_channels		8
	sad2_rates		[0xe0] 32000 44100 48000
	sad2_max_bitrate	640000
	sad3_coding_type	[0x6] AAC-LC
	sad3_channels		8
	sad3_rates		[0xe0] 32000 44100 48000
	sad3_max_bitrate	640000
	sad4_coding_type	[0x7] DTS
	sad4_channels		8
	sad4_rates		[0xe0] 32000 44100 48000
	sad4_max_bitrate	1536000

Those are supposed to be hardware capabilities, right? Because I'm
pretty sure this dated receiver doesn't support AAC bitstreams.

Thanks,
Andre

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support
  2013-10-28 22:00                   ` Andre Heider
@ 2013-10-28 22:42                     ` Anssi Hannula
  2013-10-28 23:15                       ` Andre Heider
  2013-10-28 23:19                       ` [PATCH] drm/radeon/audio: fix missing multichannel PCM SAD in some cases Anssi Hannula
  0 siblings, 2 replies; 71+ messages in thread
From: Anssi Hannula @ 2013-10-28 22:42 UTC (permalink / raw)
  To: Andre Heider; +Cc: Takashi Iwai, alsa-devel, Peter Frühberger

29.10.2013 00:00, Andre Heider kirjoitti:
> On Mon, Oct 28, 2013 at 10:35:56PM +0200, Anssi Hannula wrote:
>> 28.10.2013 20:35, Andre Heider kirjoitti:
>>> On Mon, Oct 28, 2013 at 08:25:22PM +0200, Anssi Hannula wrote:
>>>> 28.10.2013 20:17, Andre Heider kirjoitti:
>>>>> On Mon, Oct 28, 2013 at 08:12:43PM +0200, Anssi Hannula wrote:
>>>>>> 28.10.2013 19:52, Andre Heider kirjoitti:
>>>>>>> On Fri, Oct 25, 2013 at 08:23:48PM +0300, Anssi Hannula wrote:
>>>>>>>> 25.10.2013 19:54, Andre Heider kirjoitti:
>>>>>>>>> cat /proc/asound/card0/eld\#0.0
>>>>>>>>> 	monitor_present		1
>>>>>>>>> 	eld_valid		0
>>>>>>>>
>>>>>>>> However, this should have eld_valid=1 and contain more info. To get a
>>>>>>>> hint on whether it is a bug in audio or video driver, could you give a
>>>>>>>> log with CONFIG_SND_DEBUG ?
>>>>>>>>
>>>>>>>> AFAICS the sound git master tree should have the necessary support in
>>>>>>>> the radeon video driver to allow the audio driver to generate a valid
>>>>>>>> ELD with your card.
>>>>>>>
>>>>>>> With CONFIG_SND_DEBUG=y I get a bunch of
>>>>>>> "HDMI ATI/AMD: no speaker allocation for ELD"
>>>>>>> but afaics that's about it.
>>>>>>
>>>>>> Thanks, that is exactly what I was looking for.
>>>>>>
>>>>>> Looks like a radeon driver issue - it does not seem to setup the speaker
>>>>>> allocation registers properly (so that ALSA could read them from there),
>>>>>> and I verified that the EDID you posted has a valid speaker allocation
>>>>>> byte 0x4f.
>>>>>>
>>>>>> Just to recheck - you are running sound git master, or something else?
>>>>>
>>>>> This is from 3.12-rc7 with today's sound/master (3fbdaf9b) merged on top.
>>>>>
>>>>
>>>> Ah, OK, that certainly explains it. 3.12-x has this one:
>>>> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/drivers/gpu/drm/radeon?id=555b1b651acf44bf27ebbb04235d38a8fd2d58dc
>>>>
>>>> Could you revert that for testing, just to see if you get proper ELD
>>>> info then?
>>>
>>> Blergh, guess that's my fault for not just using sound/master.
>>>
>>> But that looks better:
>>>
>>> cat /proc/asound/card0/eld\#0.0
>>> 	monitor_present		1
>>> 	eld_valid		1
>>> 	monitor_name		
>>> 	connection_type		HDMI
>>> 	eld_version		[0x2] CEA-861D or below
>>> 	edid_version		[0x0] no CEA EDID Timing Extension block present
>>> 	manufacture_id		0x0
>>> 	product_id		0x0
>>> 	port_id			0x0
>>> 	support_hdcp		0
>>> 	support_ai		0
>>> 	audio_sync_delay	0
>>> 	speakers		[0x4f] FL/FR LFE FC RL/RR RLC/RRC
>>> 	sad_count		4
>>> 	sad0_coding_type	[0x1] LPCM
>>> 	sad0_channels		2
>>> 	sad0_rates		[0x1ee0] 32000 44100 48000 88200 96000 176400 192000
>>> 	sad0_bits		[0xe0000] 16 20 24
>>
>> Thanks.
>>
>> Hmm, seems we have bug in the radeon driver, we are missing the
>> 8-channel PCM SAD here.
>>
>> Can you try the attached patch?
> 
> Sure, with that patch I get:
> 
> 	monitor_present		1
> 	eld_valid		1
> 	monitor_name		
> 	connection_type		HDMI
> 	eld_version		[0x2] CEA-861D or below
> 	edid_version		[0x0] no CEA EDID Timing Extension block present
> 	manufacture_id		0x0
> 	product_id		0x0
> 	port_id			0x0
> 	support_hdcp		0
> 	support_ai		0
> 	audio_sync_delay	0
> 	speakers		[0x4f] FL/FR LFE FC RL/RR RLC/RRC
> 	sad_count		5
> 	sad0_coding_type	[0x1] LPCM
> 	sad0_channels		8
> 	sad0_rates		[0x6e0] 32000 44100 48000 88200 96000
> 	sad0_bits		[0xe0000] 16 20 24
> 	sad1_coding_type	[0x1] LPCM
> 	sad1_channels		2
> 	sad1_rates		[0x1ee0] 32000 44100 48000 88200 96000 176400 192000
> 	sad1_bits		[0xe0000] 16 20 24
> 	sad2_coding_type	[0x2] AC-3
> 	sad2_channels		8
> 	sad2_rates		[0xe0] 32000 44100 48000
> 	sad2_max_bitrate	640000
> 	sad3_coding_type	[0x6] AAC-LC
> 	sad3_channels		8
> 	sad3_rates		[0xe0] 32000 44100 48000
> 	sad3_max_bitrate	640000
> 	sad4_coding_type	[0x7] DTS
> 	sad4_channels		8
> 	sad4_rates		[0xe0] 32000 44100 48000
> 	sad4_max_bitrate	1536000

OK, looks good, I'll submit the patch to radeon people then.

> Those are supposed to be hardware capabilities, right? Because I'm
> pretty sure this dated receiver doesn't support AAC bitstreams.

Yep. I did manually verify that your EDID really claims AAC support,
though. It could be wrong I guess, and the reported max_bitrate is
suspiciously the same as for AC-3.

If you want to try AAC bitstreaming, you can download this:
http://onse.fi/files/testi.aac.lc.unconfirmed.spdif
and play it back using:
aplay -Dhdmi:CARD=Generic,DEV=0,AES0=6 -r44100 -f s16_le -c2 \
	testi.aac.lc.unconfirmed.spdif

(file unconfirmed as I don't have AAC HW)

-- 
Anssi Hannula

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support
  2013-10-28 22:42                     ` Anssi Hannula
@ 2013-10-28 23:15                       ` Andre Heider
  2013-10-29 19:52                         ` LANGLOIS Olivier PIS -EXT
  2013-10-28 23:19                       ` [PATCH] drm/radeon/audio: fix missing multichannel PCM SAD in some cases Anssi Hannula
  1 sibling, 1 reply; 71+ messages in thread
From: Andre Heider @ 2013-10-28 23:15 UTC (permalink / raw)
  To: Anssi Hannula; +Cc: Takashi Iwai, alsa-devel, Peter Frühberger

On Tue, Oct 29, 2013 at 12:42:12AM +0200, Anssi Hannula wrote:
> 29.10.2013 00:00, Andre Heider kirjoitti:
> > On Mon, Oct 28, 2013 at 10:35:56PM +0200, Anssi Hannula wrote:
> >> 28.10.2013 20:35, Andre Heider kirjoitti:
> >>> On Mon, Oct 28, 2013 at 08:25:22PM +0200, Anssi Hannula wrote:
> >>>> 28.10.2013 20:17, Andre Heider kirjoitti:
> >>>>> On Mon, Oct 28, 2013 at 08:12:43PM +0200, Anssi Hannula wrote:
> >>>>>> 28.10.2013 19:52, Andre Heider kirjoitti:
> >>>>>>> On Fri, Oct 25, 2013 at 08:23:48PM +0300, Anssi Hannula wrote:
> >>>>>>>> 25.10.2013 19:54, Andre Heider kirjoitti:
> >>>>>>>>> cat /proc/asound/card0/eld\#0.0
> >>>>>>>>> 	monitor_present		1
> >>>>>>>>> 	eld_valid		0
> >>>>>>>>
> >>>>>>>> However, this should have eld_valid=1 and contain more info. To get a
> >>>>>>>> hint on whether it is a bug in audio or video driver, could you give a
> >>>>>>>> log with CONFIG_SND_DEBUG ?
> >>>>>>>>
> >>>>>>>> AFAICS the sound git master tree should have the necessary support in
> >>>>>>>> the radeon video driver to allow the audio driver to generate a valid
> >>>>>>>> ELD with your card.
> >>>>>>>
> >>>>>>> With CONFIG_SND_DEBUG=y I get a bunch of
> >>>>>>> "HDMI ATI/AMD: no speaker allocation for ELD"
> >>>>>>> but afaics that's about it.
> >>>>>>
> >>>>>> Thanks, that is exactly what I was looking for.
> >>>>>>
> >>>>>> Looks like a radeon driver issue - it does not seem to setup the speaker
> >>>>>> allocation registers properly (so that ALSA could read them from there),
> >>>>>> and I verified that the EDID you posted has a valid speaker allocation
> >>>>>> byte 0x4f.
> >>>>>>
> >>>>>> Just to recheck - you are running sound git master, or something else?
> >>>>>
> >>>>> This is from 3.12-rc7 with today's sound/master (3fbdaf9b) merged on top.
> >>>>>
> >>>>
> >>>> Ah, OK, that certainly explains it. 3.12-x has this one:
> >>>> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/drivers/gpu/drm/radeon?id=555b1b651acf44bf27ebbb04235d38a8fd2d58dc
> >>>>
> >>>> Could you revert that for testing, just to see if you get proper ELD
> >>>> info then?
> >>>
> >>> Blergh, guess that's my fault for not just using sound/master.
> >>>
> >>> But that looks better:
> >>>
> >>> cat /proc/asound/card0/eld\#0.0
> >>> 	monitor_present		1
> >>> 	eld_valid		1
> >>> 	monitor_name		
> >>> 	connection_type		HDMI
> >>> 	eld_version		[0x2] CEA-861D or below
> >>> 	edid_version		[0x0] no CEA EDID Timing Extension block present
> >>> 	manufacture_id		0x0
> >>> 	product_id		0x0
> >>> 	port_id			0x0
> >>> 	support_hdcp		0
> >>> 	support_ai		0
> >>> 	audio_sync_delay	0
> >>> 	speakers		[0x4f] FL/FR LFE FC RL/RR RLC/RRC
> >>> 	sad_count		4
> >>> 	sad0_coding_type	[0x1] LPCM
> >>> 	sad0_channels		2
> >>> 	sad0_rates		[0x1ee0] 32000 44100 48000 88200 96000 176400 192000
> >>> 	sad0_bits		[0xe0000] 16 20 24
> >>
> >> Thanks.
> >>
> >> Hmm, seems we have bug in the radeon driver, we are missing the
> >> 8-channel PCM SAD here.
> >>
> >> Can you try the attached patch?
> > 
> > Sure, with that patch I get:
> > 
> > 	monitor_present		1
> > 	eld_valid		1
> > 	monitor_name		
> > 	connection_type		HDMI
> > 	eld_version		[0x2] CEA-861D or below
> > 	edid_version		[0x0] no CEA EDID Timing Extension block present
> > 	manufacture_id		0x0
> > 	product_id		0x0
> > 	port_id			0x0
> > 	support_hdcp		0
> > 	support_ai		0
> > 	audio_sync_delay	0
> > 	speakers		[0x4f] FL/FR LFE FC RL/RR RLC/RRC
> > 	sad_count		5
> > 	sad0_coding_type	[0x1] LPCM
> > 	sad0_channels		8
> > 	sad0_rates		[0x6e0] 32000 44100 48000 88200 96000
> > 	sad0_bits		[0xe0000] 16 20 24
> > 	sad1_coding_type	[0x1] LPCM
> > 	sad1_channels		2
> > 	sad1_rates		[0x1ee0] 32000 44100 48000 88200 96000 176400 192000
> > 	sad1_bits		[0xe0000] 16 20 24
> > 	sad2_coding_type	[0x2] AC-3
> > 	sad2_channels		8
> > 	sad2_rates		[0xe0] 32000 44100 48000
> > 	sad2_max_bitrate	640000
> > 	sad3_coding_type	[0x6] AAC-LC
> > 	sad3_channels		8
> > 	sad3_rates		[0xe0] 32000 44100 48000
> > 	sad3_max_bitrate	640000
> > 	sad4_coding_type	[0x7] DTS
> > 	sad4_channels		8
> > 	sad4_rates		[0xe0] 32000 44100 48000
> > 	sad4_max_bitrate	1536000
> 
> OK, looks good, I'll submit the patch to radeon people then.
> 
> > Those are supposed to be hardware capabilities, right? Because I'm
> > pretty sure this dated receiver doesn't support AAC bitstreams.
> 
> Yep. I did manually verify that your EDID really claims AAC support,
> though. It could be wrong I guess, and the reported max_bitrate is
> suspiciously the same as for AC-3.
> 
> If you want to try AAC bitstreaming, you can download this:
> http://onse.fi/files/testi.aac.lc.unconfirmed.spdif
> and play it back using:
> aplay -Dhdmi:CARD=Generic,DEV=0,AES0=6 -r44100 -f s16_le -c2 \
> 	testi.aac.lc.unconfirmed.spdif
> 
> (file unconfirmed as I don't have AAC HW)

That looks like its playing something, but there's no sound at all. The
receiver claims there's a Dolby Digital stream active while that aplay
command is running... so yeah, looks like the EDID is lying.
(Same with another raw AAC LE file I just googled).

But on the good side, multichannel AC3 and DTS passthrough is working
flawlessly with XBMC ;)

Thanks again,
Andre

^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH] drm/radeon/audio: fix missing multichannel PCM SAD in some cases
  2013-10-28 22:42                     ` Anssi Hannula
  2013-10-28 23:15                       ` Andre Heider
@ 2013-10-28 23:19                       ` Anssi Hannula
  2013-10-31 23:38                         ` Rafał Miłecki
                                           ` (2 more replies)
  1 sibling, 3 replies; 71+ messages in thread
From: Anssi Hannula @ 2013-10-28 23:19 UTC (permalink / raw)
  To: Alex Deucher
  Cc: Takashi Iwai, alsa-devel, Andre Heider, Rafał Miłecki,
	dri-devel

The current code writing SADs to the audio registers seems to assume
that there is at most a single SAD per audio format.

However, that is not the case. Especially for PCM it is somewhat common
for sinks to have two SADs, one for 8-channel and one for 2-channel
audio, which may have different supported sample rates (i.e. the sink
supports stereo audio at higher sample rates than multichannel audio).

Because of this, only the 2-channel SAD may be used if it appears before
the 8-channel SAD. Unless other SADs require otherwise, this may cause
the ALSA HDA driver to allow stereo playback only.

Fix the code to pick the PCM SAD with the highest number of channels,
while merging the rate masks of PCM SADs with lower amount of channels
into the additional stereo rate mask byte.

Technically there are even more cases to handle (multiple non-PCM SADs
of the same type, more than two PCM SADs with varying channel counts,
etc), but those have not actually been encountered in the field and
handling them would be non-trivial.

Example affected EDID from Onkyo TX-SR674 specifying 192kHz stereo
support and 96kHz 8-channel support (and other 8-channel compressed
formats):
00ffffffffffff003dcb010000000001
ffff0103800000780a0dc9a057479827
12484c00000001010101010101010101
010101010101011d8018711c1620582c
2500c48e2100009e011d007251d01e20
6e285500c48e2100001e000000fc0054
582d53523637342020202020000000fd
00313d0f2e08000a202020202020019b
02032f724f8504030f0e07069413121e
1d1615012f097f070f1f071707503707
503f07c0834f000066030c00ffff808c
0ad08a20e02d10103e9600c48e210000
18011d80d0721c1620102c2580c48e21
00009e011d00bc52d01e20b8285540c4
8e2100001e8c0ad090204031200c4055
00c48e210000180000000000000000a8

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
Tested-by: Andre Heider <a.heider@gmail.com>
Cc: Rafał Miłecki <zajec5@gmail.com>
---
 drivers/gpu/drm/radeon/dce6_afmt.c      | 20 +++++++++++++++-----
 drivers/gpu/drm/radeon/evergreen_hdmi.c | 20 +++++++++++++++-----
 drivers/gpu/drm/radeon/r600_hdmi.c      | 20 +++++++++++++++-----
 3 files changed, 45 insertions(+), 15 deletions(-)

diff --git a/drivers/gpu/drm/radeon/dce6_afmt.c b/drivers/gpu/drm/radeon/dce6_afmt.c
index 85a69d2..0a0fcee 100644
--- a/drivers/gpu/drm/radeon/dce6_afmt.c
+++ b/drivers/gpu/drm/radeon/dce6_afmt.c
@@ -198,20 +198,30 @@ void dce6_afmt_write_sad_regs(struct drm_encoder *encoder)
 
 	for (i = 0; i < ARRAY_SIZE(eld_reg_to_type); i++) {
 		u32 value = 0;
+		u8 stereo_freqs = 0;
+		int max_channels = -1;
 		int j;
 
 		for (j = 0; j < sad_count; j++) {
 			struct cea_sad *sad = &sads[j];
 
 			if (sad->format == eld_reg_to_type[i][1]) {
-				value = MAX_CHANNELS(sad->channels) |
-					DESCRIPTOR_BYTE_2(sad->byte2) |
-					SUPPORTED_FREQUENCIES(sad->freq);
+				if (sad->channels > max_channels) {
+					value = MAX_CHANNELS(sad->channels) |
+						DESCRIPTOR_BYTE_2(sad->byte2) |
+						SUPPORTED_FREQUENCIES(sad->freq);
+					max_channels = sad->channels;
+				}
+
 				if (sad->format == HDMI_AUDIO_CODING_TYPE_PCM)
-					value |= SUPPORTED_FREQUENCIES_STEREO(sad->freq);
-				break;
+					stereo_freqs |= sad->freq;
+				else
+					break;
 			}
 		}
+
+		value |= SUPPORTED_FREQUENCIES_STEREO(stereo_freqs);
+
 		WREG32_ENDPOINT(offset, eld_reg_to_type[i][0], value);
 	}
 
diff --git a/drivers/gpu/drm/radeon/evergreen_hdmi.c b/drivers/gpu/drm/radeon/evergreen_hdmi.c
index f71ce39..2a4837d 100644
--- a/drivers/gpu/drm/radeon/evergreen_hdmi.c
+++ b/drivers/gpu/drm/radeon/evergreen_hdmi.c
@@ -139,20 +139,30 @@ static void evergreen_hdmi_write_sad_regs(struct drm_encoder *encoder)
 
 	for (i = 0; i < ARRAY_SIZE(eld_reg_to_type); i++) {
 		u32 value = 0;
+		u8 stereo_freqs = 0;
+		int max_channels = -1;
 		int j;
 
 		for (j = 0; j < sad_count; j++) {
 			struct cea_sad *sad = &sads[j];
 
 			if (sad->format == eld_reg_to_type[i][1]) {
-				value = MAX_CHANNELS(sad->channels) |
-					DESCRIPTOR_BYTE_2(sad->byte2) |
-					SUPPORTED_FREQUENCIES(sad->freq);
+				if (sad->channels > max_channels) {
+					value = MAX_CHANNELS(sad->channels) |
+						DESCRIPTOR_BYTE_2(sad->byte2) |
+						SUPPORTED_FREQUENCIES(sad->freq);
+					max_channels = sad->channels;
+				}
+
 				if (sad->format == HDMI_AUDIO_CODING_TYPE_PCM)
-					value |= SUPPORTED_FREQUENCIES_STEREO(sad->freq);
-				break;
+					stereo_freqs |= sad->freq;
+				else
+					break;
 			}
 		}
+
+		value |= SUPPORTED_FREQUENCIES_STEREO(stereo_freqs);
+
 		WREG32(eld_reg_to_type[i][0], value);
 	}
 
diff --git a/drivers/gpu/drm/radeon/r600_hdmi.c b/drivers/gpu/drm/radeon/r600_hdmi.c
index f443010..da5cfa4 100644
--- a/drivers/gpu/drm/radeon/r600_hdmi.c
+++ b/drivers/gpu/drm/radeon/r600_hdmi.c
@@ -364,20 +364,30 @@ static void dce3_2_afmt_write_sad_regs(struct drm_encoder *encoder)
 
 	for (i = 0; i < ARRAY_SIZE(eld_reg_to_type); i++) {
 		u32 value = 0;
+		u8 stereo_freqs = 0;
+		int max_channels = -1;
 		int j;
 
 		for (j = 0; j < sad_count; j++) {
 			struct cea_sad *sad = &sads[j];
 
 			if (sad->format == eld_reg_to_type[i][1]) {
-				value = MAX_CHANNELS(sad->channels) |
-					DESCRIPTOR_BYTE_2(sad->byte2) |
-					SUPPORTED_FREQUENCIES(sad->freq);
+				if (sad->channels > max_channels) {
+					value = MAX_CHANNELS(sad->channels) |
+						DESCRIPTOR_BYTE_2(sad->byte2) |
+						SUPPORTED_FREQUENCIES(sad->freq);
+					max_channels = sad->channels;
+				}
+
 				if (sad->format == HDMI_AUDIO_CODING_TYPE_PCM)
-					value |= SUPPORTED_FREQUENCIES_STEREO(sad->freq);
-				break;
+					stereo_freqs |= sad->freq;
+				else
+					break;
 			}
 		}
+
+		value |= SUPPORTED_FREQUENCIES_STEREO(stereo_freqs);
+
 		WREG32(eld_reg_to_type[i][0], value);
 	}
 
-- 
1.8.1.5

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* Re: [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support
  2013-10-28 23:15                       ` Andre Heider
@ 2013-10-29 19:52                         ` LANGLOIS Olivier PIS -EXT
  2013-10-29 20:30                           ` Anssi Hannula
  0 siblings, 1 reply; 71+ messages in thread
From: LANGLOIS Olivier PIS -EXT @ 2013-10-29 19:52 UTC (permalink / raw)
  To: Andre Heider, Anssi Hannula
  Cc: Takashi Iwai, alsa-devel, Peter Frühberger

> >
> > Yep. I did manually verify that your EDID really claims AAC support,
> > though. It could be wrong I guess, and the reported max_bitrate is
> > suspiciously the same as for AC-3.
> >
> > If you want to try AAC bitstreaming, you can download this:
> > http://onse.fi/files/testi.aac.lc.unconfirmed.spdif
> > and play it back using:
> > aplay -Dhdmi:CARD=Generic,DEV=0,AES0=6 -r44100 -f s16_le -c2 \
> >     testi.aac.lc.unconfirmed.spdif
> >
> > (file unconfirmed as I don't have AAC HW)
>
> That looks like its playing something, but there's no sound at all. The receiver
> claims there's a Dolby Digital stream active while that aplay command is
> running... so yeah, looks like the EDID is lying.
> (Same with another raw AAC LE file I just googled).
>
> But on the good side, multichannel AC3 and DTS passthrough is working
> flawlessly with XBMC ;)
>
> Thanks again,
> Andre

Just throwing an idea like this. There is a small voice telling me that maybe HDMI receiver supporting AAC expect it wrapped inside ADTS packets rather than just raw AAC stream.

Also note that ffmpeg report formatting problem:

lano1106@hpmini ~ $ ffprobe testi.aac.lc.unconfirmed.spdif
ffprobe version 2.1 Copyright (c) 2007-2013 the FFmpeg developers
  built on Oct 29 2013 15:37:36 with gcc 4.8.2 (GCC)
  configuration: --prefix=/usr --disable-debug --disable-static --enable-avresample --enable-dxva2 --enable-fontconfig --enable-gnutls --enable-gpl --enable-libass --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libv4l2 --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-pic --enable-postproc --enable-runtime-cpudetect --enable-shared --enable-swresample --disable-vdpau --disable-vaapi --arch=native --cpu=native --enable-version3 --enable-x11grab
  libavutil      52. 48.100 / 52. 48.100
  libavcodec     55. 39.100 / 55. 39.100
  libavformat    55. 19.104 / 55. 19.104
  libavdevice    55.  5.100 / 55.  5.100
  libavfilter     3. 90.100 /  3. 90.100
  libavresample   1.  1.  0 /  1.  1.  0
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100
[spdif @ 0x8afc6b0] Invalid AAC packet in IEC 61937
testi.aac.lc.unconfirmed.spdif: Invalid data found when processing input


________________________________
CONFIDENTIALITY : This e-mail and any attachments are confidential and may be privileged. If you are not a named recipient, please notify the sender immediately and do not disclose the contents to another person, use it for any purpose or store or copy the information in any medium.

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support
  2013-10-29 19:52                         ` LANGLOIS Olivier PIS -EXT
@ 2013-10-29 20:30                           ` Anssi Hannula
  0 siblings, 0 replies; 71+ messages in thread
From: Anssi Hannula @ 2013-10-29 20:30 UTC (permalink / raw)
  To: LANGLOIS Olivier PIS -EXT, Andre Heider
  Cc: Takashi Iwai, alsa-devel, Peter Frühberger

[-- Attachment #1: Type: text/plain, Size: 2964 bytes --]

29.10.2013 21:52, LANGLOIS Olivier PIS -EXT kirjoitti:
>>>
>>> Yep. I did manually verify that your EDID really claims AAC support,
>>> though. It could be wrong I guess, and the reported max_bitrate is
>>> suspiciously the same as for AC-3.
>>>
>>> If you want to try AAC bitstreaming, you can download this:
>>> http://onse.fi/files/testi.aac.lc.unconfirmed.spdif
>>> and play it back using:
>>> aplay -Dhdmi:CARD=Generic,DEV=0,AES0=6 -r44100 -f s16_le -c2 \
>>>     testi.aac.lc.unconfirmed.spdif
>>>
>>> (file unconfirmed as I don't have AAC HW)
>>
>> That looks like its playing something, but there's no sound at all. The receiver
>> claims there's a Dolby Digital stream active while that aplay command is
>> running... so yeah, looks like the EDID is lying.
>> (Same with another raw AAC LE file I just googled).

Note that compressed audio (except some cases of DTS) requires IEC-61937
encapsulation before output (this can be done e.g. with ffmpeg, "-f
spdif"). Not sure if the other file you got was like that, maybe.

But yes, looks like the receiver lies in EDID.

>> But on the good side, multichannel AC3 and DTS passthrough is working
>> flawlessly with XBMC ;)
>>
>> Thanks again,
>> Andre
> 
> Just throwing an idea like this. There is a small voice telling me that maybe HDMI receiver supporting AAC expect it wrapped inside ADTS packets rather than just raw AAC stream.

Yep, and my sample file is ADTS :)

> Also note that ffmpeg report formatting problem:
> 
> lano1106@hpmini ~ $ ffprobe testi.aac.lc.unconfirmed.spdif
> ffprobe version 2.1 Copyright (c) 2007-2013 the FFmpeg developers
>   built on Oct 29 2013 15:37:36 with gcc 4.8.2 (GCC)
>   configuration: --prefix=/usr --disable-debug --disable-static --enable-avresample --enable-dxva2 --enable-fontconfig --enable-gnutls --enable-gpl --enable-libass --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopus --enable-libpulse --enable-librtmp --enable-libschroedinger --enable-libspeex --enable-libtheora --enable-libv4l2 --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libxvid --enable-pic --enable-postproc --enable-runtime-cpudetect --enable-shared --enable-swresample --disable-vdpau --disable-vaapi --arch=native --cpu=native --enable-version3 --enable-x11grab
>   libavutil      52. 48.100 / 52. 48.100
>   libavcodec     55. 39.100 / 55. 39.100
>   libavformat    55. 19.104 / 55. 19.104
>   libavdevice    55.  5.100 / 55.  5.100
>   libavfilter     3. 90.100 /  3. 90.100
>   libavresample   1.  1.  0 /  1.  1.  0
>   libswscale      2.  5.101 /  2.  5.101
>   libswresample   0. 17.104 /  0. 17.104
>   libpostproc    52.  3.100 / 52.  3.100
> [spdif @ 0x8afc6b0] Invalid AAC packet in IEC 61937
> testi.aac.lc.unconfirmed.spdif: Invalid data found when processing input

FFmpeg bug. Patch attached (and sent to ffmpeg-devel@).

-- 
Anssi Hannula


[-- Attachment #2: 0001-lavf-spdifdec-fix-demuxing-of-AAC-in-IEC-61937.patch --]
[-- Type: text/x-patch, Size: 1063 bytes --]

>From 24f271570ec3fb533126b22649651b52160ac232 Mon Sep 17 00:00:00 2001
From: Anssi Hannula <anssi.hannula@iki.fi>
Date: Tue, 29 Oct 2013 22:22:34 +0200
Subject: [PATCH] lavf/spdifdec: fix demuxing of AAC in IEC 61937

Return value of avpriv_aac_parse_header() is not checked correctly. Fix
it.

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
---
 libavformat/spdifdec.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/spdifdec.c b/libavformat/spdifdec.c
index 6984350..7da16c9 100644
--- a/libavformat/spdifdec.c
+++ b/libavformat/spdifdec.c
@@ -57,7 +57,7 @@ static int spdif_get_offset_and_codec(AVFormatContext *s,
         break;
     case IEC61937_MPEG2_AAC:
         init_get_bits(&gbc, buf, AAC_ADTS_HEADER_SIZE * 8);
-        if (avpriv_aac_parse_header(&gbc, &aac_hdr)) {
+        if (avpriv_aac_parse_header(&gbc, &aac_hdr) < 0) {
             if (s) /* be silent during a probe */
                 av_log(s, AV_LOG_ERROR, "Invalid AAC packet in IEC 61937\n");
             return AVERROR_INVALIDDATA;
-- 
1.8.1.5


[-- Attachment #3: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply related	[flat|nested] 71+ messages in thread

* Re: [PATCH] drm/radeon/audio: fix missing multichannel PCM SAD in some cases
  2013-10-28 23:19                       ` [PATCH] drm/radeon/audio: fix missing multichannel PCM SAD in some cases Anssi Hannula
@ 2013-10-31 23:38                         ` Rafał Miłecki
  2013-10-31 23:46                           ` Rafał Miłecki
  2013-10-31 23:52                           ` Anssi Hannula
  2013-11-02  1:01                         ` Rafał Miłecki
  2013-11-02  1:03                         ` Rafał Miłecki
  2 siblings, 2 replies; 71+ messages in thread
From: Rafał Miłecki @ 2013-10-31 23:38 UTC (permalink / raw)
  To: Anssi Hannula; +Cc: Alex Deucher, Takashi Iwai, alsa-devel, dri-devel

2013/10/29 Anssi Hannula <anssi.hannula@iki.fi>:
> Because of this, only the 2-channel SAD may be used if it appears before
> the 8-channel SAD. Unless other SADs require otherwise, this may cause
> the ALSA HDA driver to allow stereo playback only.

I can confirm that the problem exists. My SADs (Onkyo TX-SR605):
Format: 1 (PCM)        Channels:1    Freq:0x7F (32-192)    B2:0x07 (16-24b)
Format: 1 (PCM)        Channels:7    Freq:0x7F (32-192)    B2:0x07 (16-24b)
Format: 2 (AC3)        Channels:7    Freq:0x07 (32-48)    B2:0x50 (640?)
Format: 7 (DTS)        Channels:7    Freq:0x06 (44-48)    B2:0xC0 (1536?)
Format: 10 (EAC3)    Channels:7    Freq:0x06 (44-48)    B2:0x00
Format: 11 (DTS_HD)    Channels:7    Freq:0x7E (44-192)    B2:0x01
Format: 12 (MLP)    Channels:7    Freq:0x1E (44-96)    B2:0x00

Unfortunately I get only 1 emulated SAD entry for PCM
(/proc/asound/card1/eld#0.0):
sad0_coding_type        [0x1] LPCM
sad0_channels           2
sad0_rates              [0x1ee0] 32000 44100 48000 88200 96000 176400 192000
sad0_bits               [0xe0000] 16 20 24

So I can not play 8 channel LPCM "legally" (without forcing player to do so).


> Fix the code to pick the PCM SAD with the highest number of channels,
> while merging the rate masks of PCM SADs with lower amount of channels
> into the additional stereo rate mask byte.

Does it mean that now instead of 2 real SADs:
1) 192kHz support for 2 channels
2) 96kHz support for 8 channels
you will only get:
1) 192kHz support for 8 channels
?
Does it mean alsa may try to play 8channels audio at 192kHz and fail at this?
That doesn't sound good, but on the other hand I can't propose
anything better :|
Out of curiosity, what does fglrx set in the verbs?


> Technically there are even more cases to handle (multiple non-PCM SADs
> of the same type, more than two PCM SADs with varying channel counts,
> etc), but those have not actually been encountered in the field and
> handling them would be non-trivial.
>
> Example affected EDID from Onkyo TX-SR674 specifying 192kHz stereo
> support and 96kHz 8-channel support (and other 8-channel compressed
> formats):

-- 
Rafał
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH] drm/radeon/audio: fix missing multichannel PCM SAD in some cases
  2013-10-31 23:38                         ` Rafał Miłecki
@ 2013-10-31 23:46                           ` Rafał Miłecki
  2013-10-31 23:52                           ` Anssi Hannula
  1 sibling, 0 replies; 71+ messages in thread
From: Rafał Miłecki @ 2013-10-31 23:46 UTC (permalink / raw)
  To: Anssi Hannula; +Cc: Alex Deucher, Takashi Iwai, alsa-devel, dri-devel

2013/11/1 Rafał Miłecki <zajec5@gmail.com>:
> 2013/10/29 Anssi Hannula <anssi.hannula@iki.fi>:
>> Fix the code to pick the PCM SAD with the highest number of channels,
>> while merging the rate masks of PCM SADs with lower amount of channels
>> into the additional stereo rate mask byte.
>
> Does it mean that now instead of 2 real SADs:
> 1) 192kHz support for 2 channels
> 2) 96kHz support for 8 channels
> you will only get:
> 1) 192kHz support for 8 channels
> ?
> Does it mean alsa may try to play 8channels audio at 192kHz and fail at this?
> That doesn't sound good, but on the other hand I can't propose
> anything better :|

Ahh, wait. I just noticed you're using SUPPORTED_FREQUENCIES and
(different one) SUPPORTED_FREQUENCIES_STEREO there. Sorry I missed
that earlier.

Yeah, just code makes much more sense, I just think the logic in
setting that frequency may be a bit bad... Let me think about this
clearly tomorrow and I'll let you know :)

-- 
Rafał
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH] drm/radeon/audio: fix missing multichannel PCM SAD in some cases
  2013-10-31 23:38                         ` Rafał Miłecki
  2013-10-31 23:46                           ` Rafał Miłecki
@ 2013-10-31 23:52                           ` Anssi Hannula
  1 sibling, 0 replies; 71+ messages in thread
From: Anssi Hannula @ 2013-10-31 23:52 UTC (permalink / raw)
  To: Rafał Miłecki; +Cc: Alex Deucher, Takashi Iwai, alsa-devel, dri-devel

01.11.2013 01:38, Rafał Miłecki kirjoitti:
> 2013/10/29 Anssi Hannula <anssi.hannula@iki.fi>:
>> Because of this, only the 2-channel SAD may be used if it appears before
>> the 8-channel SAD. Unless other SADs require otherwise, this may cause
>> the ALSA HDA driver to allow stereo playback only.
> 
> I can confirm that the problem exists. My SADs (Onkyo TX-SR605):
> Format: 1 (PCM)        Channels:1    Freq:0x7F (32-192)    B2:0x07 (16-24b)
> Format: 1 (PCM)        Channels:7    Freq:0x7F (32-192)    B2:0x07 (16-24b)
> Format: 2 (AC3)        Channels:7    Freq:0x07 (32-48)    B2:0x50 (640?)
> Format: 7 (DTS)        Channels:7    Freq:0x06 (44-48)    B2:0xC0 (1536?)
> Format: 10 (EAC3)    Channels:7    Freq:0x06 (44-48)    B2:0x00
> Format: 11 (DTS_HD)    Channels:7    Freq:0x7E (44-192)    B2:0x01
> Format: 12 (MLP)    Channels:7    Freq:0x1E (44-96)    B2:0x00
> 
> Unfortunately I get only 1 emulated SAD entry for PCM
> (/proc/asound/card1/eld#0.0):
> sad0_coding_type        [0x1] LPCM
> sad0_channels           2
> sad0_rates              [0x1ee0] 32000 44100 48000 88200 96000 176400 192000
> sad0_bits               [0xe0000] 16 20 24
> 
> So I can not play 8 channel LPCM "legally" (without forcing player to do so).
> 
> 
>> Fix the code to pick the PCM SAD with the highest number of channels,
>> while merging the rate masks of PCM SADs with lower amount of channels
>> into the additional stereo rate mask byte.
> 
> Does it mean that now instead of 2 real SADs:
> 1) 192kHz support for 2 channels
> 2) 96kHz support for 8 channels
> you will only get:
> 1) 192kHz support for 8 channels
> ?

No, the SADs will be separated again by the ATI/AMD ELD generator in
hda_eld.c (as the 4th byte in the register contains the PCM stereo rate
mask).

I.e., assuming a receiver with 96kHz PCM multichannel limitation, with
the patch the video-side sets the three standard SAD bytes according to
the SAD with the highest number of channels (8ch+96kHz+24b), and the
extra byte contains the or'ed rate mask of all PCM SADs (i.e. 192kHz).
The audio-side then notices that 96kHz (in SAD) != 192kHz (in extra
byte) and generates two SADs, one with 8ch 96kHz and one with 2ch 192kHz.

> Does it mean alsa may try to play 8channels audio at 192kHz and fail at this?
> That doesn't sound good, but on the other hand I can't propose
> anything better :|

Well, ALSA does not restrict that currently in any case (the ALSA HDMI
code currently only takes the maximum channels/rate/etc into account, it
doesn't check if the specific combination is allowed by SADs), but that
is mostly just because nobody has added such code yet.

> Out of curiosity, what does fglrx set in the verbs?

I don't know, though I'd expect it to put the same values that get put
there with this patch.

>> Technically there are even more cases to handle (multiple non-PCM SADs
>> of the same type, more than two PCM SADs with varying channel counts,
>> etc), but those have not actually been encountered in the field and
>> handling them would be non-trivial.
>>
>> Example affected EDID from Onkyo TX-SR674 specifying 192kHz stereo
>> support and 96kHz 8-channel support (and other 8-channel compressed
>> formats):
> 

-- 
Anssi Hannula
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH] drm/radeon/audio: fix missing multichannel PCM SAD in some cases
  2013-10-28 23:19                       ` [PATCH] drm/radeon/audio: fix missing multichannel PCM SAD in some cases Anssi Hannula
  2013-10-31 23:38                         ` Rafał Miłecki
@ 2013-11-02  1:01                         ` Rafał Miłecki
  2013-11-02  1:08                           ` Anssi Hannula
  2013-11-02  1:03                         ` Rafał Miłecki
  2 siblings, 1 reply; 71+ messages in thread
From: Rafał Miłecki @ 2013-11-02  1:01 UTC (permalink / raw)
  To: Anssi Hannula; +Cc: Alex Deucher, Takashi Iwai, alsa-devel, dri-devel

2013/10/29 Anssi Hannula <anssi.hannula@iki.fi>:
> Fix the code to pick the PCM SAD with the highest number of channels,
> while merging the rate masks of PCM SADs with lower amount of channels
> into the additional stereo rate mask byte.

Don't you think that we should use SUPPORTED_FREQUENCIES_STEREO for
stereo frequencies only?


>                                 if (sad->format == HDMI_AUDIO_CODING_TYPE_PCM)
> +                                       stereo_freqs |= sad->freq;

I mean making that (... && sad->channels == 1)

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH] drm/radeon/audio: fix missing multichannel PCM SAD in some cases
  2013-10-28 23:19                       ` [PATCH] drm/radeon/audio: fix missing multichannel PCM SAD in some cases Anssi Hannula
  2013-10-31 23:38                         ` Rafał Miłecki
  2013-11-02  1:01                         ` Rafał Miłecki
@ 2013-11-02  1:03                         ` Rafał Miłecki
  2 siblings, 0 replies; 71+ messages in thread
From: Rafał Miłecki @ 2013-11-02  1:03 UTC (permalink / raw)
  To: Anssi Hannula; +Cc: Alex Deucher, Takashi Iwai, alsa-devel, dri-devel

2013/10/29 Anssi Hannula <anssi.hannula@iki.fi>:
> +                               if (sad->channels > max_channels) {
> +                                       value = MAX_CHANNELS(sad->channels) |
> +                                               DESCRIPTOR_BYTE_2(sad->byte2) |
> +                                               SUPPORTED_FREQUENCIES(sad->freq);
> +                                       max_channels = sad->channels;
> +                               }

Just for a record. I was wondering if fglrx sets both:
SUPPORTED_FREQUENCIES and SUPPORTED_FREQUENCIES_STEREO for receiver
with LPCM stereo only. It does:
00005f84 07070701 (117901057)
00005f88 00000000 (0)
00005f8c 00000000 (0)
00005f90 00000000 (0)
00005f94 00000000 (0)
00005f98 00000000 (0)
00005f9c 00000000 (0)
00005fa0 00000000 (0)
00005fa4 00000000 (0)
00005fa8 00000000 (0)
00005fac 00000000 (0)
00005fb0 00000000 (0)
00005fb4 00000000 (0)
00005fb8 00000000 (0)

So with the above code we'll be compatible with fglrx about that.
Nice. Just wanted to note that :)

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH] drm/radeon/audio: fix missing multichannel PCM SAD in some cases
  2013-11-02  1:01                         ` Rafał Miłecki
@ 2013-11-02  1:08                           ` Anssi Hannula
  2013-11-02  1:15                             ` Rafał Miłecki
  0 siblings, 1 reply; 71+ messages in thread
From: Anssi Hannula @ 2013-11-02  1:08 UTC (permalink / raw)
  To: Rafał Miłecki; +Cc: Alex Deucher, Takashi Iwai, alsa-devel, dri-devel

02.11.2013 03:01, Rafał Miłecki kirjoitti:
> 2013/10/29 Anssi Hannula <anssi.hannula@iki.fi>:
>> Fix the code to pick the PCM SAD with the highest number of channels,
>> while merging the rate masks of PCM SADs with lower amount of channels
>> into the additional stereo rate mask byte.
> 
> Don't you think that we should use SUPPORTED_FREQUENCIES_STEREO for
> stereo frequencies only?
> 
> 
>>                                 if (sad->format == HDMI_AUDIO_CODING_TYPE_PCM)
>> +                                       stereo_freqs |= sad->freq;
> 
> I mean making that (... && sad->channels == 1)
> 

SAD with channels=6,freqs=32..96kHz,bits=16..24 implies that those freqs
and bps are supported for all channel counts up to 6 (since it is "Max
Number of channels"). Therefore the specified rates are supported in
stereo mode as well and I believe should be included in the stereo bitmask.

As per AMD HDA Verbs documentation the 4th byte is "Rates supported for
stereo". And since those rates _are_ supported by stereo, IMO they
should be there.

-- 
Anssi Hannula
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH] drm/radeon/audio: fix missing multichannel PCM SAD in some cases
  2013-11-02  1:08                           ` Anssi Hannula
@ 2013-11-02  1:15                             ` Rafał Miłecki
  0 siblings, 0 replies; 71+ messages in thread
From: Rafał Miłecki @ 2013-11-02  1:15 UTC (permalink / raw)
  To: Anssi Hannula; +Cc: Alex Deucher, Takashi Iwai, alsa-devel, dri-devel

2013/11/2 Anssi Hannula <anssi.hannula@iki.fi>:
> SAD with channels=6,freqs=32..96kHz,bits=16..24 implies that those freqs
> and bps are supported for all channel counts up to 6 (since it is "Max
> Number of channels"). Therefore the specified rates are supported in
> stereo mode as well and I believe should be included in the stereo bitmask.
>
> As per AMD HDA Verbs documentation the 4th byte is "Rates supported for
> stereo". And since those rates _are_ supported by stereo, IMO they
> should be there.

OK, that sounds sane. Thanks for explaining.

Acked-by: Rafał Miłecki <zajec5@gmail.com>

-- 
Rafał
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support
  2013-10-24 18:10 [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support Anssi Hannula
                   ` (6 preceding siblings ...)
  2013-10-24 23:04 ` Takashi Iwai
@ 2013-11-02 15:32 ` Anssi Hannula
  2013-11-23  1:05 ` James Le Cuirot
  8 siblings, 0 replies; 71+ messages in thread
From: Anssi Hannula @ 2013-11-02 15:32 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: Olivier Langlois, alsa-devel, Peter Frühberger

24.10.2013 21:10, Anssi Hannula kirjoitti:
> Hi all!
> 
> Here's another revision of the ATI/AMD multichannel+HBR patchset.
> 
> Changes:
> - added customizable callbacks instead of polluting generic code
> - fixed wrong codec id in rev3+ check (as previously noted)
> - cosmetics
> 
> I've only tested this on NVIDIA/Intel, but I'd guess at least Peter
> should be able to test this on AMD in a few days or so. The earlier
> revisions were tested to fully work.

The pairwise channel remapping code seems to indeed still work fine per
testing on Peter's system.

> Combined patch can be found at: http://onse.fi/files/atihdmi5.patch
> However, this patchset is on top recent sound-next commits so it does not
> directly apply on older kernels.
> 
> Olivier, I hope you will be able to test this at some point as well
> (same things as last time), even though it will be a bit more work :)
> 
> Anssi Hannula (5):
>       ALSA: hda - hdmi: Allow HDA patches to customize more operations
>       ALSA: hda - hdmi: Add ATI/AMD multi-channel audio support
>       ALSA: hda - hdmi: Add ELD emulation for ATI/AMD codecs
>       ALSA: hda - hdmi: Add HBR bitstreaming support for ATI/AMD HDMI codecs
>       ALSA: hda - hdmi: Disable ramp-up/down for non-PCM on AMD codecs
> 
>  sound/pci/hda/hda_eld.c    | 151 +++++++++++
>  sound/pci/hda/hda_local.h  |   4 +
>  sound/pci/hda/patch_hdmi.c | 643 +++++++++++++++++++++++++++++++++++++--------
>  3 files changed, 689 insertions(+), 109 deletions(-)
> 


-- 
Anssi Hannula

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support
  2013-10-24 18:26 ` [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support Anssi Hannula
@ 2013-11-08  5:08   ` Olivier Langlois
  2013-11-08 10:27     ` Anssi Hannula
  0 siblings, 1 reply; 71+ messages in thread
From: Olivier Langlois @ 2013-11-08  5:08 UTC (permalink / raw)
  To: Anssi Hannula; +Cc: Takashi Iwai, alsa-devel, Peter Frühberger

On Thu, 2013-10-24 at 21:26 +0300, Anssi Hannula wrote:
> 24.10.2013 21:10, Anssi Hannula kirjoitti:
> > Hi all!
> > 
> > Here's another revision of the ATI/AMD multichannel+HBR patchset.
> > 
> > Changes:
> > - added customizable callbacks instead of polluting generic code
> > - fixed wrong codec id in rev3+ check (as previously noted)
> > - cosmetics
> > 
> > I've only tested this on NVIDIA/Intel, but I'd guess at least Peter
> > should be able to test this on AMD in a few days or so. The earlier
> > revisions were tested to fully work.
> > 
> > Combined patch can be found at: http://onse.fi/files/atihdmi5.patch
> > However, this patchset is on top recent sound-next commits so it does not
> > directly apply on older kernels.
> 
> Aand that would be http://onse.fi/files/atihdmi6.patch not 5.
> 
> > Olivier, I hope you will be able to test this at some point as well
> > (same things as last time), even though it will be a bit more work :)
> 
Anssi,

I have tried to patch 3.11.7 and the code in patch_hdmi.c looks too
different to be able to able to manually merge the rejected hunks.

What is sound-next? A git branch? Where can I get it?

How independant is the sound subsystem from the rest of the kernel? My
guess is that it is not that tightly coupled with the rest and dropping
sound-next version of patch_hdmi.c into my 3.11.7 source tree could work
or require minimal work. Will upgrade to 3.12 in a couple of day....

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support
  2013-11-08  5:08   ` Olivier Langlois
@ 2013-11-08 10:27     ` Anssi Hannula
  2013-11-08 18:17       ` Olivier Langlois
  0 siblings, 1 reply; 71+ messages in thread
From: Anssi Hannula @ 2013-11-08 10:27 UTC (permalink / raw)
  To: Olivier Langlois; +Cc: Takashi Iwai, alsa-devel, Peter Frühberger

08.11.2013 07:08, Olivier Langlois kirjoitti:
> On Thu, 2013-10-24 at 21:26 +0300, Anssi Hannula wrote:
>> 24.10.2013 21:10, Anssi Hannula kirjoitti:
>>> Hi all!
>>>
>>> Here's another revision of the ATI/AMD multichannel+HBR patchset.
>>>
>>> Changes:
>>> - added customizable callbacks instead of polluting generic code
>>> - fixed wrong codec id in rev3+ check (as previously noted)
>>> - cosmetics
>>>
>>> I've only tested this on NVIDIA/Intel, but I'd guess at least Peter
>>> should be able to test this on AMD in a few days or so. The earlier
>>> revisions were tested to fully work.
>>>
>>> Combined patch can be found at: http://onse.fi/files/atihdmi5.patch
>>> However, this patchset is on top recent sound-next commits so it does not
>>> directly apply on older kernels.
>>
>> Aand that would be http://onse.fi/files/atihdmi6.patch not 5.
>>
>>> Olivier, I hope you will be able to test this at some point as well
>>> (same things as last time), even though it will be a bit more work :)
>>
> Anssi,
> 
> I have tried to patch 3.11.7 and the code in patch_hdmi.c looks too
> different to be able to able to manually merge the rejected hunks.
> 
> What is sound-next? A git branch? Where can I get it?

The sound tree is at:
https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/

You can use the master branch now, it has been merged there.

> How independant is the sound subsystem from the rest of the kernel? My
> guess is that it is not that tightly coupled with the rest and dropping
> sound-next version of patch_hdmi.c into my 3.11.7 source tree could work
> or require minimal work. Will upgrade to 3.12 in a couple of day....

Often you can just copy the sound/pci/hda directory from a newer kernel
and then build the modules for the current kernel
("make -C/lib/modules/$(uname -r)/build M=$PWD") with only minimal
changes and possibly disabling unused modules in Makefile.

-- 
Anssi Hannula

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support
  2013-11-08 10:27     ` Anssi Hannula
@ 2013-11-08 18:17       ` Olivier Langlois
  2013-11-08 21:28         ` Olivier Langlois
  2013-11-09  8:35         ` Takashi Iwai
  0 siblings, 2 replies; 71+ messages in thread
From: Olivier Langlois @ 2013-11-08 18:17 UTC (permalink / raw)
  To: Anssi Hannula; +Cc: Takashi Iwai, alsa-devel, Peter Frühberger


> > 
> > What is sound-next? A git branch? Where can I get it?
> 
> The sound tree is at:
> https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/
> 
> You can use the master branch now, it has been merged there.
> 
I'm no git expert but I had problem cloning the repository:

lano1106@whippet2 ~/dev $ git clone
https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/
Cloning into 'sound'...
error: Unable to find 97c4de8fc0a47b99220b1209c7457c7dde05637a under
https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git
Cannot obtain needed object 97c4de8fc0a47b99220b1209c7457c7dde05637a
while processing commit ff8c5075a3b474cd9e422eb7e5a97e48f38a9b08.


but I did cherrypicked successfully hda_codec,hda_jack,hda_eld and
patch_hdmi modules from the browser interface of the repo and 3.11.7 did
compile fine.

I'll probably be able to report the testing of your patch sometime later
this afternoon.

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support
  2013-11-08 18:17       ` Olivier Langlois
@ 2013-11-08 21:28         ` Olivier Langlois
  2013-11-08 22:03           ` Anssi Hannula
  2013-11-09  8:35         ` Takashi Iwai
  1 sibling, 1 reply; 71+ messages in thread
From: Olivier Langlois @ 2013-11-08 21:28 UTC (permalink / raw)
  To: Anssi Hannula; +Cc: Takashi Iwai, alsa-devel, Peter Frühberger

On Fri, 2013-11-08 at 13:17 -0500, Olivier Langlois wrote:
> > > 
> > > What is sound-next? A git branch? Where can I get it?
> > 
> > The sound tree is at:
> > https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/
> > 
> > You can use the master branch now, it has been merged there.
> > 
> I'm no git expert but I had problem cloning the repository:
> 
> lano1106@whippet2 ~/dev $ git clone
> https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/
> Cloning into 'sound'...
> error: Unable to find 97c4de8fc0a47b99220b1209c7457c7dde05637a under
> https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git
> Cannot obtain needed object 97c4de8fc0a47b99220b1209c7457c7dde05637a
> while processing commit ff8c5075a3b474cd9e422eb7e5a97e48f38a9b08.
> 
> 
> but I did cherrypicked successfully hda_codec,hda_jack,hda_eld and
> patch_hdmi modules from the browser interface of the repo and 3.11.7 did
> compile fine.
> 
> I'll probably be able to report the testing of your patch sometime later
> this afternoon.
> 
Hi Anssi,

here is initial result of my testing of v3 of your patch.

Either my backporting missed something or a regression has slipped into
the newest version but speaker mapping looks slightly broken. I have
this:

lano1106@whippet2 ~ $ speaker-test -D hdmi:CARD=HDMI,DEV=0 -c8 -r192000
-F S32_LE

speaker-test 1.0.27.2

Playback device is hdmi:CARD=HDMI,DEV=0
Stream parameters are 192000Hz, S32_LE, 8 channels
Using 16 octaves of pink noise
Rate set to 192000Hz (requested 192000Hz)
Buffer size range from 8 to 131072
Period size range from 4 to 65536
Using max buffer size 131072
Periods = 4
was set period_size = 32768
was set buffer_size = 131072
 0 - Front Left
 4 - Center
 1 - Front Right
 7 - Side Right
 7 - Side Right
 6 - Side Left
 6 - Side Left
 5 - LFE

With v2, rear channels were there.

Codec: ATI R6xx HDMI
Address: 0
AFG Function Id: 0x1 (unsol 0)
Vendor Id: 0x1002aa01
Subsystem Id: 0x00aa0100
Revision Id: 0x100300

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support
  2013-11-08 21:28         ` Olivier Langlois
@ 2013-11-08 22:03           ` Anssi Hannula
  2013-11-10  5:42             ` Olivier Langlois
  0 siblings, 1 reply; 71+ messages in thread
From: Anssi Hannula @ 2013-11-08 22:03 UTC (permalink / raw)
  To: Olivier Langlois; +Cc: Takashi Iwai, alsa-devel, Peter Frühberger

[-- Attachment #1: Type: text/plain, Size: 2474 bytes --]

08.11.2013 23:28, Olivier Langlois kirjoitti:
> On Fri, 2013-11-08 at 13:17 -0500, Olivier Langlois wrote:
>>>>
>>>> What is sound-next? A git branch? Where can I get it?
>>>
>>> The sound tree is at:
>>> https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/
>>>
>>> You can use the master branch now, it has been merged there.
>>>
>> I'm no git expert but I had problem cloning the repository:
>>
>> lano1106@whippet2 ~/dev $ git clone
>> https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/
>> Cloning into 'sound'...
>> error: Unable to find 97c4de8fc0a47b99220b1209c7457c7dde05637a under
>> https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git
>> Cannot obtain needed object 97c4de8fc0a47b99220b1209c7457c7dde05637a
>> while processing commit ff8c5075a3b474cd9e422eb7e5a97e48f38a9b08.

That is just a web URL, in there you can see the checkoutable URL:
git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound.git

>>
>> but I did cherrypicked successfully hda_codec,hda_jack,hda_eld and
>> patch_hdmi modules from the browser interface of the repo and 3.11.7 did
>> compile fine.

You mean you just downloaded the files and put them in-tree, right?

If it built without warnings, it is probably OK...

>> I'll probably be able to report the testing of your patch sometime later
>> this afternoon.
>>
> Hi Anssi,
> 
> here is initial result of my testing of v3 of your patch.
> 
> Either my backporting missed something or a regression has slipped into
> the newest version but speaker mapping looks slightly broken. I have
> this:
> 
> lano1106@whippet2 ~ $ speaker-test -D hdmi:CARD=HDMI,DEV=0 -c8 -r192000
> -F S32_LE
> 
> speaker-test 1.0.27.2
> 
> Playback device is hdmi:CARD=HDMI,DEV=0
> Stream parameters are 192000Hz, S32_LE, 8 channels
> Using 16 octaves of pink noise
> Rate set to 192000Hz (requested 192000Hz)
> Buffer size range from 8 to 131072
> Period size range from 4 to 65536
> Using max buffer size 131072
> Periods = 4
> was set period_size = 32768
> was set buffer_size = 131072
>  0 - Front Left
>  4 - Center
>  1 - Front Right
>  7 - Side Right
>  7 - Side Right
>  6 - Side Left
>  6 - Side Left
>  5 - LFE
> 
> With v2, rear channels were there.

OK, this is pretty weird indeed. Could you apply the attached debugging
prints and then provide dmesg?


> Codec: ATI R6xx HDMI
> Address: 0
> AFG Function Id: 0x1 (unsol 0)
> Vendor Id: 0x1002aa01
> Subsystem Id: 0x00aa0100
> Revision Id: 0x100300


-- 
Anssi Hannula

[-- Attachment #2: chmap-hdmi-debug.patch --]
[-- Type: text/x-patch, Size: 647 bytes --]

diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index a96403a828af..2dc47c53d379 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -878,9 +878,13 @@ static void hdmi_setup_fake_chmap(unsigned char *map, int ca)
 {
 	int i;
 	int ordered_ca = get_channel_allocation_order(ca);
+	printk(KERN_INFO "CA XX %d => %d\n", ca, ordered_ca);
 	for (i = 0; i < 8; i++) {
 		if (i < channel_allocations[ordered_ca].channels)
+		{
+			printk(KERN_INFO "XX hdmi_map %02x\n", hdmi_channel_mapping[ca][i]);
 			map[i] = from_cea_slot(ordered_ca, hdmi_channel_mapping[ca][i] & 0x0f);
+		}
 		else
 			map[i] = 0;
 	}

[-- Attachment #3: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply related	[flat|nested] 71+ messages in thread

* Re: [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support
  2013-11-08 18:17       ` Olivier Langlois
  2013-11-08 21:28         ` Olivier Langlois
@ 2013-11-09  8:35         ` Takashi Iwai
  1 sibling, 0 replies; 71+ messages in thread
From: Takashi Iwai @ 2013-11-09  8:35 UTC (permalink / raw)
  To: Olivier Langlois; +Cc: Anssi Hannula, alsa-devel, Peter Frühberger

At Fri, 08 Nov 2013 13:17:02 -0500,
Olivier Langlois wrote:
> 
> 
> > > 
> > > What is sound-next? A git branch? Where can I get it?
> > 
> > The sound tree is at:
> > https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/
> > 
> > You can use the master branch now, it has been merged there.
> > 
> I'm no git expert but I had problem cloning the repository:
> 
> lano1106@whippet2 ~/dev $ git clone
> https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/
> Cloning into 'sound'...
> error: Unable to find 97c4de8fc0a47b99220b1209c7457c7dde05637a under
> https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git
> Cannot obtain needed object 97c4de8fc0a47b99220b1209c7457c7dde05637a
> while processing commit ff8c5075a3b474cd9e422eb7e5a97e48f38a9b08.

Use git protocol instead of http.

  git clone git://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git

Also, if you already have a Linus git tree, you can save lots of
download and spaces by linking to it

  git clone --reference /somewhere/linux.git \
    git://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git


Takashi

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support
  2013-11-08 22:03           ` Anssi Hannula
@ 2013-11-10  5:42             ` Olivier Langlois
  2013-11-10  6:01               ` Anssi Hannula
  0 siblings, 1 reply; 71+ messages in thread
From: Olivier Langlois @ 2013-11-10  5:42 UTC (permalink / raw)
  To: Anssi Hannula; +Cc: Takashi Iwai, alsa-devel, Peter Frühberger

Hi Anssi,

On Sat, 2013-11-09 at 00:03 +0200, Anssi Hannula wrote:

> 
> You mean you just downloaded the files and put them in-tree, right?

Right. Here are the files that I have replaced in 3.11.7 tree:

lano1106@whippet2 ~/dev/linux-ck/src/linux-3.11/sound/pci/hda $ ls
*.orig
hda_codec.c.orig  hda_codec.h.orig  hda_eld.c.orig  hda_jack.c.orig
hda_jack.h.orig  hda_local.h.orig  patch_hdmi.c.orig


> 
> If it built without warnings, it is probably OK...

It has built flawlessly.

> 
> OK, this is pretty weird indeed. Could you apply the attached debugging
> prints and then provide dmesg?
> 
> 
Sure, here is the output:

[   78.384821] ALSA sound/pci/hda/patch_hdmi.c:1167 HDMI hot plug event:
Codec=0 Pin=3 Device=0 Inactive=0 Presence_Detect=0 ELD_Valid=1
[   78.384834] ALSA sound/pci/hda/patch_hdmi.c:1512 HDMI status: Codec=0
Pin=3 Presence_Detect=1 ELD_Valid=1
[  128.437676] ALSA sound/pci/hda/patch_hdmi.c:678 HDMI: select CA 0x13
for 8-channel allocation:  FL/FR LFE FC RL/RR RLC/RRC
[  128.437797] CA XX 19 => 8
[  128.437799] XX hdmi_map 00
[  128.437801] XX hdmi_map 11
[  128.437802] XX hdmi_map 26
[  128.437804] XX hdmi_map 37
[  128.437806] XX hdmi_map 43
[  128.437807] XX hdmi_map 52
[  128.437809] XX hdmi_map 64
[  128.437810] XX hdmi_map 75
[  128.437957] ALSA sound/pci/hda/patch_hdmi.c:3108
atihdmi_pin_hbr_setup: NID=0x3, hbr-ctl=0x1

This is looking good. Maybe this is coming from how the channel mapping
is communicated to speaker-test through ALSA API but I don't know much
about that.

I'll try to understand as well on my side what is going on.

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support
  2013-11-10  5:42             ` Olivier Langlois
@ 2013-11-10  6:01               ` Anssi Hannula
  2013-11-10  7:25                 ` speaker-test chmap bugs (was: [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support) Anssi Hannula
  2013-11-12  6:35                 ` [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support Olivier Langlois
  0 siblings, 2 replies; 71+ messages in thread
From: Anssi Hannula @ 2013-11-10  6:01 UTC (permalink / raw)
  To: Olivier Langlois; +Cc: Takashi Iwai, alsa-devel, Peter Frühberger

10.11.2013 07:42, Olivier Langlois kirjoitti:
> Hi Anssi,
> 
> On Sat, 2013-11-09 at 00:03 +0200, Anssi Hannula wrote:
> 
>>
>> You mean you just downloaded the files and put them in-tree, right?
> 
> Right. Here are the files that I have replaced in 3.11.7 tree:
> 
> lano1106@whippet2 ~/dev/linux-ck/src/linux-3.11/sound/pci/hda $ ls
> *.orig
> hda_codec.c.orig  hda_codec.h.orig  hda_eld.c.orig  hda_jack.c.orig
> hda_jack.h.orig  hda_local.h.orig  patch_hdmi.c.orig
> 
> 
>>
>> If it built without warnings, it is probably OK...
> 
> It has built flawlessly.
> 
>>
>> OK, this is pretty weird indeed. Could you apply the attached debugging
>> prints and then provide dmesg?
>>
>>
> Sure, here is the output:
> 
> [   78.384821] ALSA sound/pci/hda/patch_hdmi.c:1167 HDMI hot plug event:
> Codec=0 Pin=3 Device=0 Inactive=0 Presence_Detect=0 ELD_Valid=1
> [   78.384834] ALSA sound/pci/hda/patch_hdmi.c:1512 HDMI status: Codec=0
> Pin=3 Presence_Detect=1 ELD_Valid=1
> [  128.437676] ALSA sound/pci/hda/patch_hdmi.c:678 HDMI: select CA 0x13
> for 8-channel allocation:  FL/FR LFE FC RL/RR RLC/RRC
> [  128.437797] CA XX 19 => 8
> [  128.437799] XX hdmi_map 00
> [  128.437801] XX hdmi_map 11
> [  128.437802] XX hdmi_map 26
> [  128.437804] XX hdmi_map 37
> [  128.437806] XX hdmi_map 43
> [  128.437807] XX hdmi_map 52
> [  128.437809] XX hdmi_map 64
> [  128.437810] XX hdmi_map 75
> [  128.437957] ALSA sound/pci/hda/patch_hdmi.c:3108
> atihdmi_pin_hbr_setup: NID=0x3, hbr-ctl=0x1
> 
> This is looking good. Maybe this is coming from how the channel mapping
> is communicated to speaker-test through ALSA API but I don't know much
> about that.
> 
> I'll try to understand as well on my side what is going on.

Hmm seems I can reproduce this issue just fine on my side now on
non-AMD, so I'm going to look into this myself as well. Looks a bit like
a speaker-test bug to me (since the printed channel numbers are
duplicated, and amixer shows proper chmap), though if that is the case I
wonder why I didn't see this before... I'll take a look.

-- 
Anssi Hannula

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: speaker-test chmap bugs (was: [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support)
  2013-11-10  6:01               ` Anssi Hannula
@ 2013-11-10  7:25                 ` Anssi Hannula
  2013-11-10 18:29                   ` [PATCH 1/3] speaker-test: Fix chmapped channel selection without specified chmap Anssi Hannula
  2013-11-12  6:35                 ` [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support Olivier Langlois
  1 sibling, 1 reply; 71+ messages in thread
From: Anssi Hannula @ 2013-11-10  7:25 UTC (permalink / raw)
  To: Olivier Langlois, Takashi Iwai; +Cc: alsa-devel, Peter Frühberger

10.11.2013 08:01, Anssi Hannula kirjoitti:
> 10.11.2013 07:42, Olivier Langlois kirjoitti:
>> On Sat, 2013-11-09 at 00:03 +0200, Anssi Hannula wrote:
>>> 08.11.2013 23:28, Olivier Langlois kirjoitti:
>>>> lano1106@whippet2 ~ $ speaker-test -D hdmi:CARD=HDMI,DEV=0 -c8 -r192000
>>>> -F S32_LE
>>>> 
>>>> speaker-test 1.0.27.2
>>>> 
>>>> Playback device is hdmi:CARD=HDMI,DEV=0
>>>> Stream parameters are 192000Hz, S32_LE, 8 channels
>>>> Using 16 octaves of pink noise
>>>> Rate set to 192000Hz (requested 192000Hz)
>>>> Buffer size range from 8 to 131072
>>>> Period size range from 4 to 65536
>>>> Using max buffer size 131072
>>>> Periods = 4
>>>> was set period_size = 32768
>>>> was set buffer_size = 131072
>>>>  0 - Front Left
>>>>  4 - Center
>>>>  1 - Front Right
>>>>  7 - Side Right
>>>>  7 - Side Right
>>>>  6 - Side Left
>>>>  6 - Side Left
>>>>  5 - LFE
[...]

OK, speaker-test bug (affecting all generic HDMI codecs).

This is triggered by the fact that the standard CEA/HDMI 8 channel
mapping contains RL/RR and RLC/RRC instead of SL/SR and RL/RR. I.e. what
one usually considers side speakers is RL/RR and then the rear speakers
are RLC/RRC (rear-left-center, rear-right-center).

Speaker-test tries to play back channels in the following order:
  0, /* Front Left  */
  4, /* Center      */
  1, /* Front Right */
  7, /* Side Right  */
  3, /* Rear Right  */
  2, /* Rear Left   */
  6, /* Side Left   */
  5, /* LFE         */

When it is time to play back Side Left/Right, speaker-test tries to look
for SL/SR in the chmap, but doesn't find it, so it just plays back
channels 6/7 which are actually "SL/SR" but with a different name (RL/RR).

When it becomes time to playback Rear Left/Right, speaker-test again
tries to find RL/RR in the chmap, and this time it does. However, of
course the chmap RL/RR corresponds to the HDMI/CEA RL/RR which is
traditionally SL/SR. So SL/SR is outputted again.

AFAICS the most straight-forward way to fix this is to check that the
chmap actually comprises of the assumed regular channels before trying
to apply the predefined playback order, and then fallback to playing
channels in-order 0-7 (maybe also provide a predefined ordering for the
CEA/HDMI 8ch chmap, though).
I can do that later, right now I'm too tired.


BTW, currently speaker-test always uses its own hardcoded channel
number=>name mappings for showing the channel name, unless a channel map
was manually specified. This is clearly wrong since there may be a
device-specific non-standard channelmap.

I can fix that as well, but of course that would mess up the output for
HDMI when this is not applied:
https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/sound/pci/hda?id=56cac413dd6d43af8355f5d1f90a199b540f73fc

So what to do, can we show wrong channel names on broken kernels or
should we wait a bit?
I guess that one really should be pushed to -stable in any case...


(There is also the question if we want to change the HDMI channel
mapping to appear as traditional side+rear instead of the CEA
rear+rearcenter. I don't have a strong preference on this so I'm fine
with status quo.)

-- 
Anssi Hannula

^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 1/3] speaker-test: Fix chmapped channel selection without specified chmap
  2013-11-10  7:25                 ` speaker-test chmap bugs (was: [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support) Anssi Hannula
@ 2013-11-10 18:29                   ` Anssi Hannula
  2013-11-10 18:29                     ` [PATCH 2/3] speaker-test: Always show chmap channel names if available Anssi Hannula
                                       ` (2 more replies)
  0 siblings, 3 replies; 71+ messages in thread
From: Anssi Hannula @ 2013-11-10 18:29 UTC (permalink / raw)
  To: Takashi Iwai, alsa-devel; +Cc: Olivier Langlois, Peter Frühberger

The channel selection currently does not work properly when there is a
driver-provided non-ALSA-traditional channel map but no manual channel
map was explicitely requested with "-m".

For example, the CEA/HDMI 8ch map is FL,FR,RLC,RRC,FC,LFE,RL,RR. Note
that it is otherwise the same as the traditional ALSA channel map,
except that the traditional rear speakers are considered
rear-center speakers and the traditional side speakers are considered
rear speakers.

Speaker-test tries to play back channels in this following order:
  0, /* Front Left  */
  4, /* Center      */
  1, /* Front Right */
  7, /* Side Right  */
  3, /* Rear Right  */
  2, /* Rear Left   */
  6, /* Side Left   */
  5, /* LFE         */

When it is the time to play back Side Left/Right, speaker-test tries to
look for SL/SR in the chmap, but doesn't find it, so it just plays back
channels 6/7 (which indeed are the side speakers, or RL/RR in this
channel map - so the correct channels are selected).

When it becomes the time to playback Rear Left/Right, speaker-test again
tries to find RL/RR in the chmap, and this time it does find them in the
chmap positions 6/7.

So the channels 6/7 are tested twice and 2/3 are never tested.

To fix this, define a generic playback order to be used when a channel
map is present and assign the speaker numbers (i.e. playback order) in
the following order:
1. channels in map found in map_order[] in the map_order[] order,
2. channels in map not found in map_order[] in map order,
3. channels outside the map.

When the channel mapping is specified manually, the specified order is
used for playback as before.

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
---
 speaker-test/speaker-test.c | 86 +++++++++++++++++++++++++++++++++++----------
 1 file changed, 67 insertions(+), 19 deletions(-)

diff --git a/speaker-test/speaker-test.c b/speaker-test/speaker-test.c
index d35065f..274007d 100644
--- a/speaker-test/speaker-test.c
+++ b/speaker-test/speaker-test.c
@@ -88,6 +88,8 @@ enum {
 #define BE_INT(v)		(v)
 #endif
 
+#define ARRAY_SIZE(x) (int)(sizeof(x)/sizeof(x[0]))
+
 static char              *device      = "default";       /* playback device */
 static snd_pcm_format_t   format      = SND_PCM_FORMAT_S16; /* sample format */
 static unsigned int       rate        = 48000;	            /* stream rate */
@@ -156,36 +158,82 @@ static const int	channels8[] = {
   5, /* LFE         */
 };
 
+#ifdef CONFIG_SUPPORT_CHMAP
+/* generic version of the above channelsX[] */
+static const int map_order[] = {
+  SND_CHMAP_FLW,
+  SND_CHMAP_FL,
+  SND_CHMAP_TFL,
+  SND_CHMAP_FLC,
+  SND_CHMAP_TFLC,
+  SND_CHMAP_FC,
+  SND_CHMAP_TFC,
+  SND_CHMAP_FRC,
+  SND_CHMAP_TFRC,
+  SND_CHMAP_FR,
+  SND_CHMAP_TFR,
+  SND_CHMAP_FRW,
+  SND_CHMAP_SR,
+  SND_CHMAP_TSR,
+  SND_CHMAP_RR,
+  SND_CHMAP_TRR,
+  SND_CHMAP_RRC,
+  SND_CHMAP_RC,
+  SND_CHMAP_TRC,
+  SND_CHMAP_RLC,
+  SND_CHMAP_RL,
+  SND_CHMAP_TRL,
+  SND_CHMAP_SL,
+  SND_CHMAP_TSL,
+  SND_CHMAP_BC,
+  SND_CHMAP_TC,
+  SND_CHMAP_LLFE,
+  SND_CHMAP_LFE,
+  SND_CHMAP_RLFE,
+};
+
 static int get_mapped_channel(int chn)
 {
-#ifdef CONFIG_SUPPORT_CHMAP
-  static const int maps[MAX_CHANNELS] = {
-    SND_CHMAP_FL,
-    SND_CHMAP_FR,
-    SND_CHMAP_RL,
-    SND_CHMAP_RR,
-    SND_CHMAP_FC,
-    SND_CHMAP_LFE,
-    SND_CHMAP_SL,
-    SND_CHMAP_SR,
-  };
+  int found_count = 0;
+  int i, j;
+
+  if (chn >= channel_map->channels)
+    return chn; /* out of map */
 
-  if (channel_map && maps[chn]) {
-    int i;
-    for (i = 0; i < channel_map->channels; i++) {
-      if (channel_map->pos[i] == maps[chn])
-	return i;
+  for (i = 0; i < ARRAY_SIZE(map_order) && found_count <= chn; i++) {
+    for (j = 0; j < channel_map->channels; j++) {
+      if (channel_map->pos[j] == map_order[i]) {
+        found_count++;
+	break;
+      }
     }
   }
-#endif
-  return chn;
+
+  if (found_count == chn + 1)
+    return j;
+
+  /* chn is bigger than the amount of present map_order[] channels, find
+   * the non-map_order[] channels */
+  for (j = 0; j < channel_map->channels && found_count <= chn; j++) {
+    for (i = 0; i < ARRAY_SIZE(map_order); i++) {
+      if (channel_map->pos[j] == map_order[i])
+        break;
+    }
+    if (i == ARRAY_SIZE(map_order))
+      found_count++;
+  }
+
+  return j - 1;
 }
+#endif
 
 static int get_speaker_channel(int chn)
 {
 #ifdef CONFIG_SUPPORT_CHMAP
   if (channel_map_set)
     return chn;
+  if (channel_map)
+    return get_mapped_channel(chn);
 #endif
 
   switch (channels) {
@@ -200,7 +248,7 @@ static int get_speaker_channel(int chn)
     break;
   }
 
-  return get_mapped_channel(chn);
+  return chn;
 }
 
 static const char *get_channel_name(int chn)
-- 
1.8.1.5

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH 2/3] speaker-test: Always show chmap channel names if available
  2013-11-10 18:29                   ` [PATCH 1/3] speaker-test: Fix chmapped channel selection without specified chmap Anssi Hannula
@ 2013-11-10 18:29                     ` Anssi Hannula
  2013-11-10 18:29                     ` [PATCH 3/3] speaker-test: Show out-of-chmap channels as Unknown Anssi Hannula
  2013-11-11 15:56                     ` [PATCH 1/3] speaker-test: Fix chmapped channel selection without specified chmap Takashi Iwai
  2 siblings, 0 replies; 71+ messages in thread
From: Anssi Hannula @ 2013-11-10 18:29 UTC (permalink / raw)
  To: Takashi Iwai, alsa-devel; +Cc: Olivier Langlois, Peter Frühberger

Currently speaker-test only uses channel names retrieved by
snd_pcm_chmap_long_name() when a channel map has been manually set.

However, the device may provide a default (or fixed) channel map that
differs from the traditional ALSA map, in which case wrong channel names
are shown.

Fix that by always using the name from the channel map when a channel
map is present.

Note that the names retrieved by snd_pcm_chmap_long_name() are not
currently localized via gettext.

Also note that Linux kernel HDMI driver reported wrong default channel
maps before 56cac413dd6d43af8355f5d1f90a199b540f73fc ("ALSA: hda - hdmi:
Fix reported channel map on common default layouts").

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
---
 speaker-test/speaker-test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/speaker-test/speaker-test.c b/speaker-test/speaker-test.c
index 274007d..82cc3b1 100644
--- a/speaker-test/speaker-test.c
+++ b/speaker-test/speaker-test.c
@@ -254,7 +254,7 @@ static int get_speaker_channel(int chn)
 static const char *get_channel_name(int chn)
 {
 #ifdef CONFIG_SUPPORT_CHMAP
-  if (channel_map_set && chn < channel_map->channels) {
+  if (channel_map && chn < channel_map->channels) {
     const char *name = snd_pcm_chmap_long_name(channel_map->pos[chn]);
     return name ? name : "Unknown";
   }
-- 
1.8.1.5

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* [PATCH 3/3] speaker-test: Show out-of-chmap channels as Unknown
  2013-11-10 18:29                   ` [PATCH 1/3] speaker-test: Fix chmapped channel selection without specified chmap Anssi Hannula
  2013-11-10 18:29                     ` [PATCH 2/3] speaker-test: Always show chmap channel names if available Anssi Hannula
@ 2013-11-10 18:29                     ` Anssi Hannula
  2013-11-11 15:56                     ` [PATCH 1/3] speaker-test: Fix chmapped channel selection without specified chmap Takashi Iwai
  2 siblings, 0 replies; 71+ messages in thread
From: Anssi Hannula @ 2013-11-10 18:29 UTC (permalink / raw)
  To: Takashi Iwai, alsa-devel; +Cc: Olivier Langlois, Peter Frühberger

Currently speaker-test falls back to ALSA default channel names for
channels out-of-chmap.

This causes e.g. the 4th channel of
$ speaker-test -c4 -Dhdmi -m "FR,FL,FC"
to be shown as "Rear Right".

Change the code to show such channels as Unknown instead, similar to
when snd_pcm_chmap_long_name() does not know the name.

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
---
 speaker-test/speaker-test.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/speaker-test/speaker-test.c b/speaker-test/speaker-test.c
index 82cc3b1..8ab5011 100644
--- a/speaker-test/speaker-test.c
+++ b/speaker-test/speaker-test.c
@@ -254,8 +254,10 @@ static int get_speaker_channel(int chn)
 static const char *get_channel_name(int chn)
 {
 #ifdef CONFIG_SUPPORT_CHMAP
-  if (channel_map && chn < channel_map->channels) {
-    const char *name = snd_pcm_chmap_long_name(channel_map->pos[chn]);
+  if (channel_map) {
+    const char *name = NULL;
+    if (chn < channel_map->channels)
+      name = snd_pcm_chmap_long_name(channel_map->pos[chn]);
     return name ? name : "Unknown";
   }
 #endif
-- 
1.8.1.5

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* Re: [PATCH 1/3] speaker-test: Fix chmapped channel selection without specified chmap
  2013-11-10 18:29                   ` [PATCH 1/3] speaker-test: Fix chmapped channel selection without specified chmap Anssi Hannula
  2013-11-10 18:29                     ` [PATCH 2/3] speaker-test: Always show chmap channel names if available Anssi Hannula
  2013-11-10 18:29                     ` [PATCH 3/3] speaker-test: Show out-of-chmap channels as Unknown Anssi Hannula
@ 2013-11-11 15:56                     ` Takashi Iwai
  2013-11-11 20:23                       ` Anssi Hannula
  2 siblings, 1 reply; 71+ messages in thread
From: Takashi Iwai @ 2013-11-11 15:56 UTC (permalink / raw)
  To: Anssi Hannula; +Cc: Olivier Langlois, alsa-devel, Peter Frühberger

At Sun, 10 Nov 2013 20:29:17 +0200,
Anssi Hannula wrote:
> 
> The channel selection currently does not work properly when there is a
> driver-provided non-ALSA-traditional channel map but no manual channel
> map was explicitely requested with "-m".
> 
> For example, the CEA/HDMI 8ch map is FL,FR,RLC,RRC,FC,LFE,RL,RR. Note
> that it is otherwise the same as the traditional ALSA channel map,
> except that the traditional rear speakers are considered
> rear-center speakers and the traditional side speakers are considered
> rear speakers.
> 
> Speaker-test tries to play back channels in this following order:
>   0, /* Front Left  */
>   4, /* Center      */
>   1, /* Front Right */
>   7, /* Side Right  */
>   3, /* Rear Right  */
>   2, /* Rear Left   */
>   6, /* Side Left   */
>   5, /* LFE         */
> 
> When it is the time to play back Side Left/Right, speaker-test tries to
> look for SL/SR in the chmap, but doesn't find it, so it just plays back
> channels 6/7 (which indeed are the side speakers, or RL/RR in this
> channel map - so the correct channels are selected).
> 
> When it becomes the time to playback Rear Left/Right, speaker-test again
> tries to find RL/RR in the chmap, and this time it does find them in the
> chmap positions 6/7.
> 
> So the channels 6/7 are tested twice and 2/3 are never tested.
> 
> To fix this, define a generic playback order to be used when a channel
> map is present and assign the speaker numbers (i.e. playback order) in
> the following order:
> 1. channels in map found in map_order[] in the map_order[] order,
> 2. channels in map not found in map_order[] in map order,
> 3. channels outside the map.

You are referring to the teaching of Zen, aren't you...? ;)

I prefer something a bit more easier to understand.
For example, how about to sort the given channels once using a weight
table?


thanks,

Takashi

> When the channel mapping is specified manually, the specified order is
> used for playback as before.
> 
> Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
> ---
>  speaker-test/speaker-test.c | 86 +++++++++++++++++++++++++++++++++++----------
>  1 file changed, 67 insertions(+), 19 deletions(-)
> 
> diff --git a/speaker-test/speaker-test.c b/speaker-test/speaker-test.c
> index d35065f..274007d 100644
> --- a/speaker-test/speaker-test.c
> +++ b/speaker-test/speaker-test.c
> @@ -88,6 +88,8 @@ enum {
>  #define BE_INT(v)		(v)
>  #endif
>  
> +#define ARRAY_SIZE(x) (int)(sizeof(x)/sizeof(x[0]))
> +
>  static char              *device      = "default";       /* playback device */
>  static snd_pcm_format_t   format      = SND_PCM_FORMAT_S16; /* sample format */
>  static unsigned int       rate        = 48000;	            /* stream rate */
> @@ -156,36 +158,82 @@ static const int	channels8[] = {
>    5, /* LFE         */
>  };
>  
> +#ifdef CONFIG_SUPPORT_CHMAP
> +/* generic version of the above channelsX[] */
> +static const int map_order[] = {
> +  SND_CHMAP_FLW,
> +  SND_CHMAP_FL,
> +  SND_CHMAP_TFL,
> +  SND_CHMAP_FLC,
> +  SND_CHMAP_TFLC,
> +  SND_CHMAP_FC,
> +  SND_CHMAP_TFC,
> +  SND_CHMAP_FRC,
> +  SND_CHMAP_TFRC,
> +  SND_CHMAP_FR,
> +  SND_CHMAP_TFR,
> +  SND_CHMAP_FRW,
> +  SND_CHMAP_SR,
> +  SND_CHMAP_TSR,
> +  SND_CHMAP_RR,
> +  SND_CHMAP_TRR,
> +  SND_CHMAP_RRC,
> +  SND_CHMAP_RC,
> +  SND_CHMAP_TRC,
> +  SND_CHMAP_RLC,
> +  SND_CHMAP_RL,
> +  SND_CHMAP_TRL,
> +  SND_CHMAP_SL,
> +  SND_CHMAP_TSL,
> +  SND_CHMAP_BC,
> +  SND_CHMAP_TC,
> +  SND_CHMAP_LLFE,
> +  SND_CHMAP_LFE,
> +  SND_CHMAP_RLFE,
> +};
> +
>  static int get_mapped_channel(int chn)
>  {
> -#ifdef CONFIG_SUPPORT_CHMAP
> -  static const int maps[MAX_CHANNELS] = {
> -    SND_CHMAP_FL,
> -    SND_CHMAP_FR,
> -    SND_CHMAP_RL,
> -    SND_CHMAP_RR,
> -    SND_CHMAP_FC,
> -    SND_CHMAP_LFE,
> -    SND_CHMAP_SL,
> -    SND_CHMAP_SR,
> -  };
> +  int found_count = 0;
> +  int i, j;
> +
> +  if (chn >= channel_map->channels)
> +    return chn; /* out of map */
>  
> -  if (channel_map && maps[chn]) {
> -    int i;
> -    for (i = 0; i < channel_map->channels; i++) {
> -      if (channel_map->pos[i] == maps[chn])
> -	return i;
> +  for (i = 0; i < ARRAY_SIZE(map_order) && found_count <= chn; i++) {
> +    for (j = 0; j < channel_map->channels; j++) {
> +      if (channel_map->pos[j] == map_order[i]) {
> +        found_count++;
> +	break;
> +      }
>      }
>    }
> -#endif
> -  return chn;
> +
> +  if (found_count == chn + 1)
> +    return j;
> +
> +  /* chn is bigger than the amount of present map_order[] channels, find
> +   * the non-map_order[] channels */
> +  for (j = 0; j < channel_map->channels && found_count <= chn; j++) {
> +    for (i = 0; i < ARRAY_SIZE(map_order); i++) {
> +      if (channel_map->pos[j] == map_order[i])
> +        break;
> +    }
> +    if (i == ARRAY_SIZE(map_order))
> +      found_count++;
> +  }
> +
> +  return j - 1;
>  }
> +#endif
>  
>  static int get_speaker_channel(int chn)
>  {
>  #ifdef CONFIG_SUPPORT_CHMAP
>    if (channel_map_set)
>      return chn;
> +  if (channel_map)
> +    return get_mapped_channel(chn);
>  #endif
>  
>    switch (channels) {
> @@ -200,7 +248,7 @@ static int get_speaker_channel(int chn)
>      break;
>    }
>  
> -  return get_mapped_channel(chn);
> +  return chn;
>  }
>  
>  static const char *get_channel_name(int chn)
> -- 
> 1.8.1.5
> 

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH 1/3] speaker-test: Fix chmapped channel selection without specified chmap
  2013-11-11 15:56                     ` [PATCH 1/3] speaker-test: Fix chmapped channel selection without specified chmap Takashi Iwai
@ 2013-11-11 20:23                       ` Anssi Hannula
  2013-11-11 22:04                         ` [PATCH 1/3 v2] " Anssi Hannula
  0 siblings, 1 reply; 71+ messages in thread
From: Anssi Hannula @ 2013-11-11 20:23 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: Olivier Langlois, alsa-devel, Peter Frühberger

11.11.2013 17:56, Takashi Iwai kirjoitti:
> At Sun, 10 Nov 2013 20:29:17 +0200,
> Anssi Hannula wrote:
>>
>> The channel selection currently does not work properly when there is a
>> driver-provided non-ALSA-traditional channel map but no manual channel
>> map was explicitely requested with "-m".
>>
>> For example, the CEA/HDMI 8ch map is FL,FR,RLC,RRC,FC,LFE,RL,RR. Note
>> that it is otherwise the same as the traditional ALSA channel map,
>> except that the traditional rear speakers are considered
>> rear-center speakers and the traditional side speakers are considered
>> rear speakers.
>>
>> Speaker-test tries to play back channels in this following order:
>>   0, /* Front Left  */
>>   4, /* Center      */
>>   1, /* Front Right */
>>   7, /* Side Right  */
>>   3, /* Rear Right  */
>>   2, /* Rear Left   */
>>   6, /* Side Left   */
>>   5, /* LFE         */
>>
>> When it is the time to play back Side Left/Right, speaker-test tries to
>> look for SL/SR in the chmap, but doesn't find it, so it just plays back
>> channels 6/7 (which indeed are the side speakers, or RL/RR in this
>> channel map - so the correct channels are selected).
>>
>> When it becomes the time to playback Rear Left/Right, speaker-test again
>> tries to find RL/RR in the chmap, and this time it does find them in the
>> chmap positions 6/7.
>>
>> So the channels 6/7 are tested twice and 2/3 are never tested.
>>
>> To fix this, define a generic playback order to be used when a channel
>> map is present and assign the speaker numbers (i.e. playback order) in
>> the following order:
>> 1. channels in map found in map_order[] in the map_order[] order,
>> 2. channels in map not found in map_order[] in map order,
>> 3. channels outside the map.
> 
> You are referring to the teaching of Zen, aren't you...? ;)

Heh, I only realized afterwards how confusing that map order stuff sounds :p

> I prefer something a bit more easier to understand.
> For example, how about to sort the given channels once using a weight
> table?

OK, I'll try something like that.

> thanks,
> 
> Takashi
> 
>> When the channel mapping is specified manually, the specified order is
>> used for playback as before.
>>
>> Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
>> ---
>>  speaker-test/speaker-test.c | 86 +++++++++++++++++++++++++++++++++++----------
>>  1 file changed, 67 insertions(+), 19 deletions(-)
>>
>> diff --git a/speaker-test/speaker-test.c b/speaker-test/speaker-test.c
>> index d35065f..274007d 100644
>> --- a/speaker-test/speaker-test.c
>> +++ b/speaker-test/speaker-test.c
>> @@ -88,6 +88,8 @@ enum {
>>  #define BE_INT(v)		(v)
>>  #endif
>>  
>> +#define ARRAY_SIZE(x) (int)(sizeof(x)/sizeof(x[0]))
>> +
>>  static char              *device      = "default";       /* playback device */
>>  static snd_pcm_format_t   format      = SND_PCM_FORMAT_S16; /* sample format */
>>  static unsigned int       rate        = 48000;	            /* stream rate */
>> @@ -156,36 +158,82 @@ static const int	channels8[] = {
>>    5, /* LFE         */
>>  };
>>  
>> +#ifdef CONFIG_SUPPORT_CHMAP
>> +/* generic version of the above channelsX[] */
>> +static const int map_order[] = {
>> +  SND_CHMAP_FLW,
>> +  SND_CHMAP_FL,
>> +  SND_CHMAP_TFL,
>> +  SND_CHMAP_FLC,
>> +  SND_CHMAP_TFLC,
>> +  SND_CHMAP_FC,
>> +  SND_CHMAP_TFC,
>> +  SND_CHMAP_FRC,
>> +  SND_CHMAP_TFRC,
>> +  SND_CHMAP_FR,
>> +  SND_CHMAP_TFR,
>> +  SND_CHMAP_FRW,
>> +  SND_CHMAP_SR,
>> +  SND_CHMAP_TSR,
>> +  SND_CHMAP_RR,
>> +  SND_CHMAP_TRR,
>> +  SND_CHMAP_RRC,
>> +  SND_CHMAP_RC,
>> +  SND_CHMAP_TRC,
>> +  SND_CHMAP_RLC,
>> +  SND_CHMAP_RL,
>> +  SND_CHMAP_TRL,
>> +  SND_CHMAP_SL,
>> +  SND_CHMAP_TSL,
>> +  SND_CHMAP_BC,
>> +  SND_CHMAP_TC,
>> +  SND_CHMAP_LLFE,
>> +  SND_CHMAP_LFE,
>> +  SND_CHMAP_RLFE,
>> +};
>> +
>>  static int get_mapped_channel(int chn)
>>  {
>> -#ifdef CONFIG_SUPPORT_CHMAP
>> -  static const int maps[MAX_CHANNELS] = {
>> -    SND_CHMAP_FL,
>> -    SND_CHMAP_FR,
>> -    SND_CHMAP_RL,
>> -    SND_CHMAP_RR,
>> -    SND_CHMAP_FC,
>> -    SND_CHMAP_LFE,
>> -    SND_CHMAP_SL,
>> -    SND_CHMAP_SR,
>> -  };
>> +  int found_count = 0;
>> +  int i, j;
>> +
>> +  if (chn >= channel_map->channels)
>> +    return chn; /* out of map */
>>  
>> -  if (channel_map && maps[chn]) {
>> -    int i;
>> -    for (i = 0; i < channel_map->channels; i++) {
>> -      if (channel_map->pos[i] == maps[chn])
>> -	return i;
>> +  for (i = 0; i < ARRAY_SIZE(map_order) && found_count <= chn; i++) {
>> +    for (j = 0; j < channel_map->channels; j++) {
>> +      if (channel_map->pos[j] == map_order[i]) {
>> +        found_count++;
>> +	break;
>> +      }
>>      }
>>    }
>> -#endif
>> -  return chn;
>> +
>> +  if (found_count == chn + 1)
>> +    return j;
>> +
>> +  /* chn is bigger than the amount of present map_order[] channels, find
>> +   * the non-map_order[] channels */
>> +  for (j = 0; j < channel_map->channels && found_count <= chn; j++) {
>> +    for (i = 0; i < ARRAY_SIZE(map_order); i++) {
>> +      if (channel_map->pos[j] == map_order[i])
>> +        break;
>> +    }
>> +    if (i == ARRAY_SIZE(map_order))
>> +      found_count++;
>> +  }
>> +
>> +  return j - 1;
>>  }
>> +#endif
>>  
>>  static int get_speaker_channel(int chn)
>>  {
>>  #ifdef CONFIG_SUPPORT_CHMAP
>>    if (channel_map_set)
>>      return chn;
>> +  if (channel_map)
>> +    return get_mapped_channel(chn);
>>  #endif
>>  
>>    switch (channels) {
>> @@ -200,7 +248,7 @@ static int get_speaker_channel(int chn)
>>      break;
>>    }
>>  
>> -  return get_mapped_channel(chn);
>> +  return chn;
>>  }
>>  
>>  static const char *get_channel_name(int chn)
>> -- 
>> 1.8.1.5
>>


-- 
Anssi Hannula

^ permalink raw reply	[flat|nested] 71+ messages in thread

* [PATCH 1/3 v2] speaker-test: Fix chmapped channel selection without specified chmap
  2013-11-11 20:23                       ` Anssi Hannula
@ 2013-11-11 22:04                         ` Anssi Hannula
  2013-11-12  8:11                           ` Takashi Iwai
  0 siblings, 1 reply; 71+ messages in thread
From: Anssi Hannula @ 2013-11-11 22:04 UTC (permalink / raw)
  To: Takashi Iwai, alsa-devel; +Cc: Olivier Langlois, Peter Frühberger

The channel selection currently does not work properly when there is a
driver-provided non-ALSA-traditional channel map but no manual channel
map was explicitely requested with "-m".

For example, the CEA/HDMI 8ch map is FL,FR,RLC,RRC,FC,LFE,RL,RR. Note
that it is otherwise the same as the traditional ALSA channel map,
except that the traditional rear speakers are considered
rear-center speakers and the traditional side speakers are considered
rear speakers.

Speaker-test tries to play back channels in this following order:
  0, /* Front Left  */
  4, /* Center      */
  1, /* Front Right */
  7, /* Side Right  */
  3, /* Rear Right  */
  2, /* Rear Left   */
  6, /* Side Left   */
  5, /* LFE         */

When it is the time to play back Side Left/Right, speaker-test tries to
look for SL/SR in the chmap, but doesn't find it, so it just plays back
channels 6/7 (which indeed are the side speakers, or RL/RR in this
channel map - so the correct channels are selected).

When it becomes the time to playback Rear Left/Right, speaker-test again
tries to find RL/RR in the chmap, and this time it does find them in the
chmap positions 6/7.

So the channels 6/7 are tested twice and 2/3 are never tested.

To fix this, define a generic playback order channel_order[] to be used
when the channel map is present (but not user-defined) and generate a
(speaker/playback number => channel number) mapping with the channels
ordered in the following order:
1. regular channels found in channel_order[] in the defined order,
2. channels not found in channel_order[] ordered by channel number.
3. UNKNOWN channels ordered by channel number.
4. NA channels ordered by channel number.
For channels outside the channel map just use their channel numbers (so
they will be last after all of the above).

For example, if the playback device has a fictional default channel map
of FR,FL,UNKNOWN1,FOO,BAR,RR,RL,UNKNOWN2, the playback order will be
FL,FR,RR,RL,FOO,BAR,UNKNOWN1,UNKNOWN2(,any_extra_channels).

When the channel mapping is specified manually, the specified order is
used for playback as before.

Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>
---
 speaker-test/speaker-test.c | 113 +++++++++++++++++++++++++++++++++++---------
 1 file changed, 91 insertions(+), 22 deletions(-)

diff --git a/speaker-test/speaker-test.c b/speaker-test/speaker-test.c
index 45e92e5..261f399 100644
--- a/speaker-test/speaker-test.c
+++ b/speaker-test/speaker-test.c
@@ -88,6 +88,8 @@ enum {
 #define BE_INT(v)		(v)
 #endif
 
+#define ARRAY_SIZE(x) (int)(sizeof(x)/sizeof(x[0]))
+
 static char              *device      = "default";       /* playback device */
 static snd_pcm_format_t   format      = SND_PCM_FORMAT_S16; /* sample format */
 static unsigned int       rate        = 48000;	            /* stream rate */
@@ -110,6 +112,7 @@ static snd_pcm_t *pcm_handle = NULL;
 #ifdef CONFIG_SUPPORT_CHMAP
 static snd_pcm_chmap_t *channel_map;
 static int channel_map_set;
+static unsigned int *ordered_channels;
 #endif
 
 static const char *const channel_name[MAX_CHANNELS] = {
@@ -156,36 +159,94 @@ static const int	channels8[] = {
   5, /* LFE         */
 };
 
-static int get_mapped_channel(int chn)
-{
 #ifdef CONFIG_SUPPORT_CHMAP
-  static const int maps[MAX_CHANNELS] = {
-    SND_CHMAP_FL,
-    SND_CHMAP_FR,
-    SND_CHMAP_RL,
-    SND_CHMAP_RR,
-    SND_CHMAP_FC,
-    SND_CHMAP_LFE,
-    SND_CHMAP_SL,
-    SND_CHMAP_SR,
-  };
+/* circular clockwise and bottom-to-top order */
+static const int channel_order[] = {
+  [SND_CHMAP_FLW]  =  10,
+  [SND_CHMAP_FL]   =  20,
+  [SND_CHMAP_TFL]  =  30,
+  [SND_CHMAP_FLC]  =  40,
+  [SND_CHMAP_TFLC] =  50,
+  [SND_CHMAP_FC]   =  60,
+  [SND_CHMAP_TFC]  =  70,
+  [SND_CHMAP_FRC]  =  80,
+  [SND_CHMAP_TFRC] =  90,
+  [SND_CHMAP_FR]   = 100,
+  [SND_CHMAP_TFR]  = 110,
+  [SND_CHMAP_FRW]  = 120,
+  [SND_CHMAP_SR]   = 130,
+  [SND_CHMAP_TSR]  = 140,
+  [SND_CHMAP_RR]   = 150,
+  [SND_CHMAP_TRR]  = 160,
+  [SND_CHMAP_RRC]  = 170,
+  [SND_CHMAP_RC]   = 180,
+  [SND_CHMAP_TRC]  = 190,
+  [SND_CHMAP_RLC]  = 200,
+  [SND_CHMAP_RL]   = 210,
+  [SND_CHMAP_TRL]  = 220,
+  [SND_CHMAP_SL]   = 230,
+  [SND_CHMAP_TSL]  = 240,
+  [SND_CHMAP_BC]   = 250,
+  [SND_CHMAP_TC]   = 260,
+  [SND_CHMAP_LLFE] = 270,
+  [SND_CHMAP_LFE]  = 280,
+  [SND_CHMAP_RLFE] = 290,
+  /* not in table  = 10000 */
+  [SND_CHMAP_UNKNOWN] = 20000,
+  [SND_CHMAP_NA]      = 30000,
+};
 
-  if (channel_map && maps[chn]) {
-    int i;
-    for (i = 0; i < channel_map->channels; i++) {
-      if (channel_map->pos[i] == maps[chn])
-	return i;
-    }
+static int chpos_cmp(const void *chnum1p, const void *chnum2p)
+{
+  int chnum1 = *(int *)chnum1p;
+  int chnum2 = *(int *)chnum2p;
+  int chpos1 = channel_map->pos[chnum1];
+  int chpos2 = channel_map->pos[chnum2];
+  int weight1 = 10000;
+  int weight2 = 10000;
+
+  if (chpos1 < ARRAY_SIZE(channel_order) && channel_order[chpos1])
+    weight1 = channel_order[chpos1];
+  if (chpos2 < ARRAY_SIZE(channel_order) && channel_order[chpos2])
+    weight2 = channel_order[chpos2];
+
+  if (weight1 == weight2) {
+    /* order by channel number if both have the same position (e.g. UNKNOWN)
+     * or if neither is in channel_order[] */
+    return chnum1 - chnum2;
   }
-#endif
-  return chn;
+
+  /* order according to channel_order[] */
+  return weight1 - weight2;
+}
+
+static int *order_channels(void)
+{
+  /* create a (playback order => channel number) table with channels ordered
+   * according to channel_order[] values */
+  int i;
+  int *ordered_chs;
+
+  ordered_chs = calloc(channel_map->channels, sizeof(*ordered_chs));
+  if (!ordered_chs)
+    return NULL;
+
+  for (i = 0; i < channel_map->channels; i++)
+    ordered_chs[i] = i;
+
+  qsort(ordered_chs, channel_map->channels, sizeof(*ordered_chs), chpos_cmp);
+
+  return ordered_chs;
 }
+#endif
 
 static int get_speaker_channel(int chn)
 {
 #ifdef CONFIG_SUPPORT_CHMAP
-  if (channel_map_set)
+  if (channel_map_set || (ordered_channels && chn >= channel_map->channels))
     return chn;
+  if (ordered_channels)
+    return ordered_channels[chn];
 #endif
 
   switch (channels) {
@@ -200,7 +261,7 @@ static int get_speaker_channel(int chn)
     break;
   }
 
-  return get_mapped_channel(chn);
+  return chn;
 }
 
 static const char *get_channel_name(int chn)
@@ -613,6 +674,11 @@ static int config_chmap(snd_pcm_t *handle, const char *mapstr)
   }
 
   channel_map = snd_pcm_get_chmap(handle);
+
+  /* create a channel order table for default layouts */
+  if (channel_map)
+    ordered_channels = order_channels();
+
   return 0;
 }
 #endif
@@ -1232,6 +1298,9 @@ int main(int argc, char *argv[]) {
 
 
   free(frames);
+#ifdef CONFIG_SUPPORT_CHMAP
+  free(ordered_channels);
+#endif
 
   return prg_exit(EXIT_SUCCESS);
 }
-- 
1.8.1.5

^ permalink raw reply related	[flat|nested] 71+ messages in thread

* Re: [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support
  2013-11-10  6:01               ` Anssi Hannula
  2013-11-10  7:25                 ` speaker-test chmap bugs (was: [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support) Anssi Hannula
@ 2013-11-12  6:35                 ` Olivier Langlois
  2013-11-14  0:04                   ` Anssi Hannula
  1 sibling, 1 reply; 71+ messages in thread
From: Olivier Langlois @ 2013-11-12  6:35 UTC (permalink / raw)
  To: Anssi Hannula; +Cc: Takashi Iwai, alsa-devel, Peter Frühberger

Anssi,

With your speaker-test patch (v1), I have been able to make sure that I
could use the 8 channels with my AMD card.

for the ramp up/down testing. I have the same result than with v2 of
your patch.

eld#0.0 file content is identical as well.

DTS-HD and Dolby True-HD are sent correctly and recognized by the
receiver by using the files from:

http://phoronix.com/forums/showthread.php?27348-TrueHD-DTS-HD-E-AC3-Over-HDMI-On-Linux

with the command:s

aplay -Dhdmi:CARD=HDMI,DEV=0,AES0=6 -c8  -r192000 -f s16_le thd.spdif
aplay -Dhdmi:CARD=HDMI,DEV=0,AES0=6 -c8  -r192000 -f s16_le dts.spdif



> >>
> >>
> > Sure, here is the output:
> > 
> > [   78.384821] ALSA sound/pci/hda/patch_hdmi.c:1167 HDMI hot plug event:
> > Codec=0 Pin=3 Device=0 Inactive=0 Presence_Detect=0 ELD_Valid=1
> > [   78.384834] ALSA sound/pci/hda/patch_hdmi.c:1512 HDMI status: Codec=0
> > Pin=3 Presence_Detect=1 ELD_Valid=1
> > [  128.437676] ALSA sound/pci/hda/patch_hdmi.c:678 HDMI: select CA 0x13
> > for 8-channel allocation:  FL/FR LFE FC RL/RR RLC/RRC
> > [  128.437797] CA XX 19 => 8
> > [  128.437799] XX hdmi_map 00
> > [  128.437801] XX hdmi_map 11
> > [  128.437802] XX hdmi_map 26
> > [  128.437804] XX hdmi_map 37
> > [  128.437806] XX hdmi_map 43
> > [  128.437807] XX hdmi_map 52
> > [  128.437809] XX hdmi_map 64
> > [  128.437810] XX hdmi_map 75
> > [  128.437957] ALSA sound/pci/hda/patch_hdmi.c:3108
> > atihdmi_pin_hbr_setup: NID=0x3, hbr-ctl=0x1
> > 
> > This is looking good. Maybe this is coming from how the channel mapping
> > is communicated to speaker-test through ALSA API but I don't know much
> > about that.
> > 
> > I'll try to understand as well on my side what is going on.
> 
> Hmm seems I can reproduce this issue just fine on my side now on
> non-AMD, so I'm going to look into this myself as well. Looks a bit like
> a speaker-test bug to me (since the printed channel numbers are
> duplicated, and amixer shows proper chmap), though if that is the case I
> wonder why I didn't see this before... I'll take a look.
> 

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH 1/3 v2] speaker-test: Fix chmapped channel selection without specified chmap
  2013-11-11 22:04                         ` [PATCH 1/3 v2] " Anssi Hannula
@ 2013-11-12  8:11                           ` Takashi Iwai
  2013-11-12 12:34                             ` Anssi Hannula
  0 siblings, 1 reply; 71+ messages in thread
From: Takashi Iwai @ 2013-11-12  8:11 UTC (permalink / raw)
  To: Anssi Hannula; +Cc: Olivier Langlois, alsa-devel, Peter Frühberger

At Tue, 12 Nov 2013 00:04:02 +0200,
Anssi Hannula wrote:
> 
> The channel selection currently does not work properly when there is a
> driver-provided non-ALSA-traditional channel map but no manual channel
> map was explicitely requested with "-m".
> 
> For example, the CEA/HDMI 8ch map is FL,FR,RLC,RRC,FC,LFE,RL,RR. Note
> that it is otherwise the same as the traditional ALSA channel map,
> except that the traditional rear speakers are considered
> rear-center speakers and the traditional side speakers are considered
> rear speakers.
> 
> Speaker-test tries to play back channels in this following order:
>   0, /* Front Left  */
>   4, /* Center      */
>   1, /* Front Right */
>   7, /* Side Right  */
>   3, /* Rear Right  */
>   2, /* Rear Left   */
>   6, /* Side Left   */
>   5, /* LFE         */
> 
> When it is the time to play back Side Left/Right, speaker-test tries to
> look for SL/SR in the chmap, but doesn't find it, so it just plays back
> channels 6/7 (which indeed are the side speakers, or RL/RR in this
> channel map - so the correct channels are selected).
> 
> When it becomes the time to playback Rear Left/Right, speaker-test again
> tries to find RL/RR in the chmap, and this time it does find them in the
> chmap positions 6/7.
> 
> So the channels 6/7 are tested twice and 2/3 are never tested.
> 
> To fix this, define a generic playback order channel_order[] to be used
> when the channel map is present (but not user-defined) and generate a
> (speaker/playback number => channel number) mapping with the channels
> ordered in the following order:
> 1. regular channels found in channel_order[] in the defined order,
> 2. channels not found in channel_order[] ordered by channel number.
> 3. UNKNOWN channels ordered by channel number.
> 4. NA channels ordered by channel number.
> For channels outside the channel map just use their channel numbers (so
> they will be last after all of the above).
> 
> For example, if the playback device has a fictional default channel map
> of FR,FL,UNKNOWN1,FOO,BAR,RR,RL,UNKNOWN2, the playback order will be
> FL,FR,RR,RL,FOO,BAR,UNKNOWN1,UNKNOWN2(,any_extra_channels).
> 
> When the channel mapping is specified manually, the specified order is
> used for playback as before.
> 
> Signed-off-by: Anssi Hannula <anssi.hannula@iki.fi>

Thanks, applied all three patches now.


Takashi

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH 1/3 v2] speaker-test: Fix chmapped channel selection without specified chmap
  2013-11-12  8:11                           ` Takashi Iwai
@ 2013-11-12 12:34                             ` Anssi Hannula
  2013-11-12 13:08                               ` Takashi Iwai
  0 siblings, 1 reply; 71+ messages in thread
From: Anssi Hannula @ 2013-11-12 12:34 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: Olivier Langlois, alsa-devel, Peter Frühberger

Takashi Iwai kirjoitti 2013-11-12 10:11:
> At Tue, 12 Nov 2013 00:04:02 +0200,
> Anssi Hannula wrote:
> 
> The channel selection currently does not work properly when there is a
> driver-provided non-ALSA-traditional channel map but no manual channel
> map was explicitely requested with "-m".
[...]
> 
> Thanks, applied all three patches now.

OK, will you also be sending this to stable as I suggested a few 
messages before (otherwise the patch 2 will work badly, as noted in the 
patch description as well)?
https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/sound/pci/hda/patch_hdmi.c?id=56cac413dd6d43af8355f5d1f90a199b540f73fc

--
Anssi Hannula

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH 1/3 v2] speaker-test: Fix chmapped channel selection without specified chmap
  2013-11-12 12:34                             ` Anssi Hannula
@ 2013-11-12 13:08                               ` Takashi Iwai
  0 siblings, 0 replies; 71+ messages in thread
From: Takashi Iwai @ 2013-11-12 13:08 UTC (permalink / raw)
  To: Anssi Hannula; +Cc: Olivier Langlois, alsa-devel, Peter Frühberger

At Tue, 12 Nov 2013 14:34:22 +0200,
Anssi Hannula wrote:
> 
> Takashi Iwai kirjoitti 2013-11-12 10:11:
> > At Tue, 12 Nov 2013 00:04:02 +0200,
> > Anssi Hannula wrote:
> > 
> > The channel selection currently does not work properly when there is a
> > driver-provided non-ALSA-traditional channel map but no manual channel
> > map was explicitely requested with "-m".
> [...]
> > 
> > Thanks, applied all three patches now.
> 
> OK, will you also be sending this to stable as I suggested a few 
> messages before (otherwise the patch 2 will work badly, as noted in the 
> patch description as well)?
> https://git.kernel.org/cgit/linux/kernel/git/tiwai/sound.git/commit/sound/pci/hda/patch_hdmi.c?id=56cac413dd6d43af8355f5d1f90a199b540f73fc

It's been merged to Linus tree, so feel free to send a mail to stable
ML.  You just need to tell Greg the commit IDs to pick up.


Takashi

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support
  2013-11-12  6:35                 ` [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support Olivier Langlois
@ 2013-11-14  0:04                   ` Anssi Hannula
  0 siblings, 0 replies; 71+ messages in thread
From: Anssi Hannula @ 2013-11-14  0:04 UTC (permalink / raw)
  To: Olivier Langlois; +Cc: Takashi Iwai, alsa-devel, Peter Frühberger

12.11.2013 08:35, Olivier Langlois kirjoitti:
> Anssi,
> 
> With your speaker-test patch (v1), I have been able to make sure that I
> could use the 8 channels with my AMD card.
> 
> for the ramp up/down testing. I have the same result than with v2 of
> your patch.
> 
> eld#0.0 file content is identical as well.
> 
> DTS-HD and Dolby True-HD are sent correctly and recognized by the
> receiver by using the files from:
> 
> http://phoronix.com/forums/showthread.php?27348-TrueHD-DTS-HD-E-AC3-Over-HDMI-On-Linux
> 
> with the command:s
> 
> aplay -Dhdmi:CARD=HDMI,DEV=0,AES0=6 -c8  -r192000 -f s16_le thd.spdif
> aplay -Dhdmi:CARD=HDMI,DEV=0,AES0=6 -c8  -r192000 -f s16_le dts.spdif

OK, good.

Thanks a lot for testing :)

> 
> 
>>>>
>>>>
>>> Sure, here is the output:
>>>
>>> [   78.384821] ALSA sound/pci/hda/patch_hdmi.c:1167 HDMI hot plug event:
>>> Codec=0 Pin=3 Device=0 Inactive=0 Presence_Detect=0 ELD_Valid=1
>>> [   78.384834] ALSA sound/pci/hda/patch_hdmi.c:1512 HDMI status: Codec=0
>>> Pin=3 Presence_Detect=1 ELD_Valid=1
>>> [  128.437676] ALSA sound/pci/hda/patch_hdmi.c:678 HDMI: select CA 0x13
>>> for 8-channel allocation:  FL/FR LFE FC RL/RR RLC/RRC
>>> [  128.437797] CA XX 19 => 8
>>> [  128.437799] XX hdmi_map 00
>>> [  128.437801] XX hdmi_map 11
>>> [  128.437802] XX hdmi_map 26
>>> [  128.437804] XX hdmi_map 37
>>> [  128.437806] XX hdmi_map 43
>>> [  128.437807] XX hdmi_map 52
>>> [  128.437809] XX hdmi_map 64
>>> [  128.437810] XX hdmi_map 75
>>> [  128.437957] ALSA sound/pci/hda/patch_hdmi.c:3108
>>> atihdmi_pin_hbr_setup: NID=0x3, hbr-ctl=0x1
>>>
>>> This is looking good. Maybe this is coming from how the channel mapping
>>> is communicated to speaker-test through ALSA API but I don't know much
>>> about that.
>>>
>>> I'll try to understand as well on my side what is going on.
>>
>> Hmm seems I can reproduce this issue just fine on my side now on
>> non-AMD, so I'm going to look into this myself as well. Looks a bit like
>> a speaker-test bug to me (since the printed channel numbers are
>> duplicated, and amixer shows proper chmap), though if that is the case I
>> wonder why I didn't see this before... I'll take a look.
>>
> 
> 
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
> 


-- 
Anssi Hannula

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support
  2013-10-24 18:10 [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support Anssi Hannula
                   ` (7 preceding siblings ...)
  2013-11-02 15:32 ` [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support Anssi Hannula
@ 2013-11-23  1:05 ` James Le Cuirot
  2013-11-23  1:29   ` Anssi Hannula
  2013-11-25 15:07   ` Raymond Yau
  8 siblings, 2 replies; 71+ messages in thread
From: James Le Cuirot @ 2013-11-23  1:05 UTC (permalink / raw)
  To: alsa-devel

Anssi Hannula <anssi.hannula <at> iki.fi> writes:

> Here's another revision of the ATI/AMD multichannel+HBR patchset.

Hi Anssi. Many thanks for your work on this. I am very keen to test this 
new code but have so far been unsuccessful. I have a Radeon 4670 (Sapphire 
branded) connected to a Yamaha RX-V773. I am running the sound/for-next 
kernel (82755ab) with your "missing PCM SAD" patch applied.

The new kernel has allowed ALSA to recognise the card as multichannel and I 
can issue the following speaker-test command but I still only hear "Front 
Left" and "Front Right" and the Yahama seems to report the signal as stereo.

# speaker-test -Dhdmi:CARD=HDMI,DEV=0 -c6 -t wav

speaker-test 1.0.27.2

Playback device is hdmi:CARD=HDMI,DEV=0
Stream parameters are 48000Hz, S16_LE, 6 channels
WAV file(s)
Rate set to 48000Hz (requested 48000Hz)
Buffer size range from 64 to 5440
Period size range from 32 to 2720
Using max buffer size 5440
Periods = 4
was set period_size = 1088
was set buffer_size = 5440
 0 - Front Left
 4 - Center
 1 - Front Right
 3 - Rear Right
 2 - Rear Left
 5 - LFE

I have tried various sample rates. I have the HDMI cable plugged into the 
secondary output as my speakerless DVI monitor is plugged into the primary 
but I have also tried the HDMI cable in the primary output by itself. I 
even bought the "official" HIS HHDMI4071 adapter as the unbranded one that 
came with my card looked quite different. None of these things have helped. 
I must admit that I don't fully understand what this ELD stuff is about but 
I can tell you that it's not looking too good on my system.

/proc/asound/HDMI/eld#0.0:
monitor_present	    1
eld_valid           0

I'm guessing the codec file may provide some useful information.

/proc/asound/HDMI/codec#0:
Codec: ATI R6xx HDMI
Address: 0
AFG Function Id: 0x1 (unsol 0)
Vendor Id: 0x1002aa01
Subsystem Id: 0x00aa0100
Revision Id: 0x100100
No Modem Function Group found
Default PCM:
    rates [0x70]: 32000 44100 48000
    bits [0x2]: 16
    formats [0x1]: PCM
Default Amp-In caps: N/A
Default Amp-Out caps: N/A
State of AFG node 0x01:
  Power states:  D0 D3
  Power: setting=D0, actual=D0
GPIO: io=0, o=0, i=0, unsolicited=0, wake=0
Node 0x02 [Audio Output] wcaps 0x201: Stereo Digital
  Converter: stream=1, channel=0
  Digital: Enabled
  Digital category: 0x0
  IEC Coding Type: 0x0
Node 0x03 [Pin Complex] wcaps 0x400381: Stereo Digital
  Control: name="HDMI/DP,pcm=3 Jack", index=0, device=0
  Control: name="IEC958 Playback Con Mask", index=0, device=0
  Control: name="IEC958 Playback Pro Mask", index=0, device=0
  Control: name="IEC958 Playback Default", index=0, device=0
  Control: name="IEC958 Playback Switch", index=0, device=0
  Control: name="ELD", index=0, device=3
  Pincap 0x00000094: OUT Detect HDMI
  Pin Default 0x18560010: [Jack] Digital Out at Int HDMI
    Conn = Digital, Color = Unknown
    DefAssociation = 0x1, Sequence = 0x0
  Pin-ctls: 0x40: OUT
  Unsolicited: tag=01, enabled=1
  Connection: 1
     0x02

If it rules anything out, I have had the ALSA a52 plugin working but 
obviously this isn't an ideal solution. Any help would be appreciated and 
I'll gladly provide more information. I've done some light kernel hacking 
but I'm no expert.

Thanks,
James

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support
  2013-11-23  1:05 ` James Le Cuirot
@ 2013-11-23  1:29   ` Anssi Hannula
  2013-11-23 15:40     ` James Le Cuirot
  2013-11-25 15:07   ` Raymond Yau
  1 sibling, 1 reply; 71+ messages in thread
From: Anssi Hannula @ 2013-11-23  1:29 UTC (permalink / raw)
  To: James Le Cuirot, alsa-devel

23.11.2013 03:05, James Le Cuirot kirjoitti:
> Anssi Hannula <anssi.hannula <at> iki.fi> writes:
> 
>> Here's another revision of the ATI/AMD multichannel+HBR patchset.
> 
> Hi Anssi. Many thanks for your work on this. I am very keen to test this 
> new code but have so far been unsuccessful. I have a Radeon 4670 (Sapphire 
> branded) connected to a Yamaha RX-V773. I am running the sound/for-next 
> kernel (82755ab) with your "missing PCM SAD" patch applied.
> 
> The new kernel has allowed ALSA to recognise the card as multichannel and I 
> can issue the following speaker-test command but I still only hear "Front 
> Left" and "Front Right" and the Yahama seems to report the signal as stereo.
> 
> # speaker-test -Dhdmi:CARD=HDMI,DEV=0 -c6 -t wav
> 
> speaker-test 1.0.27.2
> 
> Playback device is hdmi:CARD=HDMI,DEV=0
> Stream parameters are 48000Hz, S16_LE, 6 channels
> WAV file(s)
> Rate set to 48000Hz (requested 48000Hz)
> Buffer size range from 64 to 5440
> Period size range from 32 to 2720
> Using max buffer size 5440
> Periods = 4
> was set period_size = 1088
> was set buffer_size = 5440
>  0 - Front Left
>  4 - Center
>  1 - Front Right
>  3 - Rear Right
>  2 - Rear Left
>  5 - LFE

I guess it is the same without "-t wav"?

> I have tried various sample rates. I have the HDMI cable plugged into the 
> secondary output as my speakerless DVI monitor is plugged into the primary 
> but I have also tried the HDMI cable in the primary output by itself. I 
> even bought the "official" HIS HHDMI4071 adapter as the unbranded one that 
> came with my card looked quite different. None of these things have helped.

Hmm, I'm not sure what the behavior is supposed to be with multiple
video outputs when we have only a single audio output (HDA pin)...

What happens if you plug both of your outputs to the A/V receiver, will
only one output get audio?

In any case, I'd guess trying the HDMI cable by itself should've ruled
issues with that out...

> I must admit that I don't fully understand what this ELD stuff is about but 
> I can tell you that it's not looking too good on my system.
> 
> /proc/asound/HDMI/eld#0.0:
> monitor_present	    1
> eld_valid           0

ELD stuff is not necessary for playback, it is mostly for information
(and providing the necessary info for ELD is disabled on radeon DRI
drivers on some kernels on some GPUs ATM due to some issues).

> I'm guessing the codec file may provide some useful information.
> 
> /proc/asound/HDMI/codec#0:
> Codec: ATI R6xx HDMI
> Address: 0
> AFG Function Id: 0x1 (unsol 0)
> Vendor Id: 0x1002aa01
> Subsystem Id: 0x00aa0100
> Revision Id: 0x100100
> No Modem Function Group found
> Default PCM:
>     rates [0x70]: 32000 44100 48000
>     bits [0x2]: 16
>     formats [0x1]: PCM
> Default Amp-In caps: N/A
> Default Amp-Out caps: N/A
> State of AFG node 0x01:
>   Power states:  D0 D3
>   Power: setting=D0, actual=D0
> GPIO: io=0, o=0, i=0, unsolicited=0, wake=0
> Node 0x02 [Audio Output] wcaps 0x201: Stereo Digital
>   Converter: stream=1, channel=0
>   Digital: Enabled
>   Digital category: 0x0
>   IEC Coding Type: 0x0
> Node 0x03 [Pin Complex] wcaps 0x400381: Stereo Digital
>   Control: name="HDMI/DP,pcm=3 Jack", index=0, device=0
>   Control: name="IEC958 Playback Con Mask", index=0, device=0
>   Control: name="IEC958 Playback Pro Mask", index=0, device=0
>   Control: name="IEC958 Playback Default", index=0, device=0
>   Control: name="IEC958 Playback Switch", index=0, device=0
>   Control: name="ELD", index=0, device=3
>   Pincap 0x00000094: OUT Detect HDMI
>   Pin Default 0x18560010: [Jack] Digital Out at Int HDMI
>     Conn = Digital, Color = Unknown
>     DefAssociation = 0x1, Sequence = 0x0
>   Pin-ctls: 0x40: OUT
>   Unsolicited: tag=01, enabled=1
>   Connection: 1
>      0x02
> 
> If it rules anything out, I have had the ALSA a52 plugin working but 
> obviously this isn't an ideal solution. Any help would be appreciated and 
> I'll gladly provide more information. I've done some light kernel hacking 
> but I'm no expert.

Is there anything interesting in "dmesg"?

-- 
Anssi Hannula

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support
  2013-11-23  1:29   ` Anssi Hannula
@ 2013-11-23 15:40     ` James Le Cuirot
  2013-11-23 15:45       ` Anssi Hannula
  0 siblings, 1 reply; 71+ messages in thread
From: James Le Cuirot @ 2013-11-23 15:40 UTC (permalink / raw)
  To: Anssi Hannula; +Cc: alsa-devel

[-- Attachment #1: Type: text/plain, Size: 2217 bytes --]

On Sat, 23 Nov 2013 03:29:28 +0200
Anssi Hannula <anssi.hannula@iki.fi> wrote:

> 23.11.2013 03:05, James Le Cuirot kirjoitti:
> > Anssi Hannula <anssi.hannula <at> iki.fi> writes:
> > 
> >> Here's another revision of the ATI/AMD multichannel+HBR patchset.
> > 
> > Hi Anssi. Many thanks for your work on this. I am very keen to test
> > this new code but have so far been unsuccessful. I have a Radeon
> > 4670 (Sapphire branded) connected to a Yamaha RX-V773. I am running
> > the sound/for-next kernel (82755ab) with your "missing PCM SAD"
> > patch applied.
> > 
> > The new kernel has allowed ALSA to recognise the card as
> > multichannel and I can issue the following speaker-test command but
> > I still only hear "Front Left" and "Front Right" and the Yahama
> > seems to report the signal as stereo.
> > 
> > # speaker-test -Dhdmi:CARD=HDMI,DEV=0 -c6 -t wav
> 
> I guess it is the same without "-t wav"?

Yes.

> > I have the HDMI cable plugged
> > into the secondary output as my speakerless DVI monitor is plugged
> > into the primary but I have also tried the HDMI cable in the
> > primary output by itself.
> 
> Hmm, I'm not sure what the behavior is supposed to be with multiple
> video outputs when we have only a single audio output (HDA pin)...
> 
> What happens if you plug both of your outputs to the A/V receiver,
> will only one output get audio?

I tried this and as I expected, it sent the same audio to both outputs.
Still stereo only though.

> ELD stuff is not necessary for playback, it is mostly for information
> (and providing the necessary info for ELD is disabled on radeon DRI
> drivers on some kernels on some GPUs ATM due to some issues).
> 
> Is there anything interesting in "dmesg"?

I have attached my dmesg. I enabled ALSA debug and verbose printk but
disabled the on-board HDA audio in the BIOS to make it less confusing,
and also to see if it made any difference, which it didn't. The only
entry I find noteworthy is about the ELD but you say this isn't
required.

There seems to be little to go on here. Would it be worth enabling
CONFIG_SND_DEBUG_VERBOSE? I gather it's very noisy but maybe that level
of detail is needed. Hopefully you have a better idea.

Regards,
James

[-- Attachment #2: dmesg.txt --]
[-- Type: text/plain, Size: 64630 bytes --]

[    0.000000] Linux version 3.12.0-gentoo (root@symphony.aura-online.co.uk) (gcc version 4.8.2 (Gentoo 4.8.2 p1.0, pie-0.5.8) ) #4 SMP PREEMPT Sat Nov 23 11:56:35 GMT 2013
[    0.000000] Command line: BOOT_IMAGE=/vmlinuz-3.12.0-gentoo root=/dev/sdb6 ro radeon.dpm=1 radeon.pcie_gen2=1 radeon.audio=1 modprobe.blacklist=fglrx
[    0.000000] e820: BIOS-provided physical RAM map:
[    0.000000] BIOS-e820: [mem 0x0000000000000000-0x000000000009dbff] usable
[    0.000000] BIOS-e820: [mem 0x000000000009f800-0x000000000009ffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff] reserved
[    0.000000] BIOS-e820: [mem 0x0000000000100000-0x00000000df7affff] usable
[    0.000000] BIOS-e820: [mem 0x00000000df7b0000-0x00000000df7e1fff] ACPI NVS
[    0.000000] BIOS-e820: [mem 0x00000000df7e2000-0x00000000df7effff] ACPI data
[    0.000000] BIOS-e820: [mem 0x00000000df7f0000-0x00000000df7fffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000f4000000-0x00000000f7ffffff] reserved
[    0.000000] BIOS-e820: [mem 0x00000000fec00000-0x00000000ffffffff] reserved
[    0.000000] BIOS-e820: [mem 0x0000000100000000-0x000000021fffffff] usable
[    0.000000] NX (Execute Disable) protection: active
[    0.000000] SMBIOS 2.4 present.
[    0.000000] DMI: Gigabyte Technology Co., Ltd. P55A-UD6(C)/P55A-UD6(C), BIOS F10 06/30/2010
[    0.000000] e820: update [mem 0x00000000-0x00000fff] usable ==> reserved
[    0.000000] e820: remove [mem 0x000a0000-0x000fffff] usable
[    0.000000] No AGP bridge found
[    0.000000] e820: last_pfn = 0x220000 max_arch_pfn = 0x400000000
[    0.000000] MTRR default type: uncachable
[    0.000000] MTRR fixed ranges enabled:
[    0.000000]   00000-9FFFF write-back
[    0.000000]   A0000-BFFFF uncachable
[    0.000000]   C0000-CEFFF write-protect
[    0.000000]   CF000-EFFFF uncachable
[    0.000000]   F0000-FFFFF write-through
[    0.000000] MTRR variable ranges enabled:
[    0.000000]   0 base 000000000 mask F00000000 write-back
[    0.000000]   1 base 0E0000000 mask FE0000000 uncachable
[    0.000000]   2 base 100000000 mask F00000000 write-back
[    0.000000]   3 base 200000000 mask FE0000000 write-back
[    0.000000]   4 disabled
[    0.000000]   5 disabled
[    0.000000]   6 disabled
[    0.000000]   7 disabled
[    0.000000] x86 PAT enabled: cpu 0, old 0x7040600070406, new 0x7010600070106
[    0.000000] e820: update [mem 0xe0000000-0xffffffff] usable ==> reserved
[    0.000000] e820: last_pfn = 0xdf7b0 max_arch_pfn = 0x400000000
[    0.000000] Base memory trampoline at [ffff880000097000] 97000 size 24576
[    0.000000] init_memory_mapping: [mem 0x00000000-0x000fffff]
[    0.000000]  [mem 0x00000000-0x000fffff] page 4k
[    0.000000] BRK [0x01871000, 0x01871fff] PGTABLE
[    0.000000] BRK [0x01872000, 0x01872fff] PGTABLE
[    0.000000] BRK [0x01873000, 0x01873fff] PGTABLE
[    0.000000] init_memory_mapping: [mem 0x21fe00000-0x21fffffff]
[    0.000000]  [mem 0x21fe00000-0x21fffffff] page 2M
[    0.000000] BRK [0x01874000, 0x01874fff] PGTABLE
[    0.000000] init_memory_mapping: [mem 0x21c000000-0x21fdfffff]
[    0.000000]  [mem 0x21c000000-0x21fdfffff] page 2M
[    0.000000] init_memory_mapping: [mem 0x200000000-0x21bffffff]
[    0.000000]  [mem 0x200000000-0x21bffffff] page 2M
[    0.000000] init_memory_mapping: [mem 0x00100000-0xdf7affff]
[    0.000000]  [mem 0x00100000-0x001fffff] page 4k
[    0.000000]  [mem 0x00200000-0xdf5fffff] page 2M
[    0.000000]  [mem 0xdf600000-0xdf7affff] page 4k
[    0.000000] init_memory_mapping: [mem 0x100000000-0x1ffffffff]
[    0.000000]  [mem 0x100000000-0x1ffffffff] page 2M
[    0.000000] BRK [0x01875000, 0x01875fff] PGTABLE
[    0.000000] BRK [0x01876000, 0x01876fff] PGTABLE
[    0.000000] ACPI: RSDP 00000000000f77a0 00014 (v00 GBT   )
[    0.000000] ACPI: RSDT 00000000df7e2040 00040 (v01 GBT    GBTUACPI 42302E31 GBTU 01010101)
[    0.000000] ACPI: FACP 00000000df7e20c0 00074 (v01 GBT    GBTUACPI 42302E31 GBTU 01010101)
[    0.000000] ACPI: DSDT 00000000df7e2180 0543D (v01 GBT    GBTUACPI 00001000 MSFT 0100000C)
[    0.000000] ACPI: FACS 00000000df7b0000 00040
[    0.000000] ACPI: HPET 00000000df7e7700 00038 (v01 GBT    GBTUACPI 42302E31 GBTU 00000098)
[    0.000000] ACPI: MCFG 00000000df7e7780 0003C (v01 GBT    GBTUACPI 42302E31 GBTU 01010101)
[    0.000000] ACPI: EUDS 00000000df7e7840 00560 (v01 GBT             00000000      00000000)
[    0.000000] ACPI: TAMG 00000000df7e7da0 00A32 (v01 GBT    GBT   B0 5455312E BG?? 53450101)
[    0.000000] ACPI: APIC 00000000df7e7600 000BC (v01 GBT    GBTUACPI 42302E31 GBTU 01010101)
[    0.000000] ACPI: SSDT 00000000df7e8800 034FC (v01  INTEL PPM RCM  80000001 INTL 20061109)
[    0.000000] ACPI: Local APIC address 0xfee00000
[    0.000000]  [ffffea0000000000-ffffea00087fffff] PMD -> [ffff880217600000-ffff88021f5fffff] on node 0
[    0.000000] Zone ranges:
[    0.000000]   DMA      [mem 0x00001000-0x00ffffff]
[    0.000000]   DMA32    [mem 0x01000000-0xffffffff]
[    0.000000]   Normal   [mem 0x100000000-0x21fffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x00001000-0x0009cfff]
[    0.000000]   node   0: [mem 0x00100000-0xdf7affff]
[    0.000000]   node   0: [mem 0x100000000-0x21fffffff]
[    0.000000] On node 0 totalpages: 2094924
[    0.000000]   DMA zone: 64 pages used for memmap
[    0.000000]   DMA zone: 21 pages reserved
[    0.000000]   DMA zone: 3996 pages, LIFO batch:0
[    0.000000]   DMA32 zone: 14239 pages used for memmap
[    0.000000]   DMA32 zone: 911280 pages, LIFO batch:31
[    0.000000]   Normal zone: 18432 pages used for memmap
[    0.000000]   Normal zone: 1179648 pages, LIFO batch:31
[    0.000000] ACPI: PM-Timer IO Port: 0x408
[    0.000000] ACPI: Local APIC address 0xfee00000
[    0.000000] ACPI: LAPIC (acpi_id[0x00] lapic_id[0x00] enabled)
[    0.000000] ACPI: LAPIC (acpi_id[0x01] lapic_id[0x02] enabled)
[    0.000000] ACPI: LAPIC (acpi_id[0x02] lapic_id[0x04] enabled)
[    0.000000] ACPI: LAPIC (acpi_id[0x03] lapic_id[0x06] enabled)
[    0.000000] ACPI: LAPIC (acpi_id[0x04] lapic_id[0x01] enabled)
[    0.000000] ACPI: LAPIC (acpi_id[0x05] lapic_id[0x03] enabled)
[    0.000000] ACPI: LAPIC (acpi_id[0x06] lapic_id[0x05] enabled)
[    0.000000] ACPI: LAPIC (acpi_id[0x07] lapic_id[0x07] enabled)
[    0.000000] ACPI: LAPIC_NMI (acpi_id[0x00] dfl dfl lint[0x1])
[    0.000000] ACPI: LAPIC_NMI (acpi_id[0x01] dfl dfl lint[0x1])
[    0.000000] ACPI: LAPIC_NMI (acpi_id[0x02] dfl dfl lint[0x1])
[    0.000000] ACPI: LAPIC_NMI (acpi_id[0x03] dfl dfl lint[0x1])
[    0.000000] ACPI: LAPIC_NMI (acpi_id[0x04] dfl dfl lint[0x1])
[    0.000000] ACPI: LAPIC_NMI (acpi_id[0x05] dfl dfl lint[0x1])
[    0.000000] ACPI: LAPIC_NMI (acpi_id[0x06] dfl dfl lint[0x1])
[    0.000000] ACPI: LAPIC_NMI (acpi_id[0x07] dfl dfl lint[0x1])
[    0.000000] ACPI: IOAPIC (id[0x02] address[0xfec00000] gsi_base[0])
[    0.000000] IOAPIC[0]: apic_id 2, version 32, address 0xfec00000, GSI 0-23
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 0 global_irq 2 dfl dfl)
[    0.000000] ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 high level)
[    0.000000] ACPI: IRQ0 used by override.
[    0.000000] ACPI: IRQ2 used by override.
[    0.000000] ACPI: IRQ9 used by override.
[    0.000000] Using ACPI (MADT) for SMP configuration information
[    0.000000] ACPI: HPET id: 0x8086a201 base: 0xfed00000
[    0.000000] smpboot: Allowing 8 CPUs, 0 hotplug CPUs
[    0.000000] nr_irqs_gsi: 40
[    0.000000] e820: [mem 0xdf800000-0xf3ffffff] available for PCI devices
[    0.000000] setup_percpu: NR_CPUS:8 nr_cpumask_bits:8 nr_cpu_ids:8 nr_node_ids:1
[    0.000000] PERCPU: Embedded 26 pages/cpu @ffff88021fc00000 s75136 r8192 d23168 u262144
[    0.000000] pcpu-alloc: s75136 r8192 d23168 u262144 alloc=1*2097152
[    0.000000] pcpu-alloc: [0] 0 1 2 3 4 5 6 7 
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 2062168
[    0.000000] Kernel command line: BOOT_IMAGE=/vmlinuz-3.12.0-gentoo root=/dev/sdb6 ro radeon.dpm=1 radeon.pcie_gen2=1 radeon.audio=1 modprobe.blacklist=fglrx
[    0.000000] PID hash table entries: 4096 (order: 3, 32768 bytes)
[    0.000000] Dentry cache hash table entries: 1048576 (order: 11, 8388608 bytes)
[    0.000000] Inode-cache hash table entries: 524288 (order: 10, 4194304 bytes)
[    0.000000] Checking aperture...
[    0.000000] No AGP bridge found
[    0.000000] Memory: 8160528K/8379696K available (4850K kernel code, 413K rwdata, 1544K rodata, 780K init, 1016K bss, 219168K reserved)
[    0.000000] SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=8, Nodes=1
[    0.000000] Preemptible hierarchical RCU implementation.
[    0.000000] 	Dump stacks of tasks blocking RCU-preempt GP.
[    0.000000] 	Offload RCU callbacks from all CPUs
[    0.000000] 	Offload RCU callbacks from CPUs: 0-7.
[    0.000000] NR_IRQS:4352 nr_irqs:744 16
[    0.000000] Console: colour VGA+ 80x25
[    0.000000] console [tty0] enabled
[    0.000000] hpet clockevent registered
[    0.000000] tsc: Fast TSC calibration using PIT
[    0.001000] tsc: Detected 2930.995 MHz processor
[    0.000001] Calibrating delay loop (skipped), value calculated using timer frequency.. 5861.99 BogoMIPS (lpj=2930995)
[    0.000090] pid_max: default: 32768 minimum: 301
[    0.000147] Security Framework initialized
[    0.000193] Mount-cache hash table entries: 256
[    0.000351] CPU: Physical Processor ID: 0
[    0.000393] CPU: Processor Core ID: 0
[    0.000435] mce: CPU supports 9 MCE banks
[    0.000482] CPU0: Thermal monitoring enabled (TM1)
[    0.000530] Last level iTLB entries: 4KB 512, 2MB 7, 4MB 7
Last level dTLB entries: 4KB 512, 2MB 32, 4MB 32
tlb_flushall_shift: 6
[    0.000671] Freeing SMP alternatives memory: 20K (ffffffff8176d000 - ffffffff81772000)
[    0.000719] ACPI: Core revision 20130725
[    0.001960] ACPI: All ACPI Tables successfully acquired
[    0.006125] ..TIMER: vector=0x30 apic1=0 pin1=2 apic2=-1 pin2=-1
[    0.016160] smpboot: CPU0: Intel(R) Core(TM) i7 CPU       K 875  @ 2.93GHz (fam: 06, model: 1e, stepping: 05)
[    0.117466] Performance Events: PEBS fmt1+, 16-deep LBR, Nehalem events, Intel PMU driver.
[    0.117619] perf_event_intel: CPU erratum AAJ80 worked around
[    0.117663] perf_event_intel: CPUID marked event: 'bus cycles' unavailable
[    0.117709] ... version:                3
[    0.117751] ... bit width:              48
[    0.117792] ... generic registers:      4
[    0.117833] ... value mask:             0000ffffffffffff
[    0.117876] ... max period:             000000007fffffff
[    0.117919] ... fixed-purpose events:   3
[    0.117959] ... event mask:             000000070000000f
[    0.123522] smpboot: Booting Node   0, Processors  #   1 #   2 #   3 #   4 #   5 #   6 #   7 OK
[    0.226723] Brought up 8 CPUs
[    0.226766] smpboot: Total of 8 processors activated (46895.92 BogoMIPS)
[    0.231508] devtmpfs: initialized
[    0.231809] NET: Registered protocol family 16
[    0.232016] cpuidle: using governor ladder
[    0.232058] cpuidle: using governor menu
[    0.232120] ACPI: bus type PCI registered
[    0.232172] PCI: MMCONFIG for domain 0000 [bus 00-3f] at [mem 0xf4000000-0xf7ffffff] (base 0xf4000000)
[    0.232233] PCI: MMCONFIG at [mem 0xf4000000-0xf7ffffff] reserved in E820
[    0.234935] PCI: Using configuration type 1 for base access
[    0.237724] bio: create slab <bio-0> at 0
[    0.237877] ACPI: Added _OSI(Module Device)
[    0.237918] ACPI: Added _OSI(Processor Device)
[    0.237960] ACPI: Added _OSI(3.0 _SCP Extensions)
[    0.238003] ACPI: Added _OSI(Processor Aggregator Device)
[    0.238512] ACPI: EC: Look up EC in DSDT
[    0.241151] ACPI BIOS Warning (bug): Incorrect checksum in table [TAMG] - 0x10, should be 0x0F (20130725/tbprint-204)
[    0.241929] ACPI: Interpreter enabled
[    0.241973] ACPI: (supports S0 S5)
[    0.242013] ACPI: Using IOAPIC for interrupt routing
[    0.242085] PCI: Using host bridge windows from ACPI; if necessary, use "pci=nocrs" and report a bug
[    0.242210] ACPI: No dock devices found.
[    0.246479] ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-3f])
[    0.246526] acpi PNP0A03:00: ACPI _OSC support notification failed, disabling PCIe ASPM
[    0.246574] acpi PNP0A03:00: Unable to request _OSC control (_OSC support mask: 0x08)
[    0.246725] PCI host bridge to bus 0000:00
[    0.246768] pci_bus 0000:00: root bus resource [bus 00-3f]
[    0.246812] pci_bus 0000:00: root bus resource [io  0x0000-0x0cf7]
[    0.246857] pci_bus 0000:00: root bus resource [io  0x0d00-0xffff]
[    0.246902] pci_bus 0000:00: root bus resource [mem 0x000a0000-0x000bffff]
[    0.246947] pci_bus 0000:00: root bus resource [mem 0x000c0000-0x000dffff]
[    0.246993] pci_bus 0000:00: root bus resource [mem 0xfed40000-0xfed44fff]
[    0.247039] pci_bus 0000:00: root bus resource [mem 0xdf800000-0xfebfffff]
[    0.247091] pci 0000:00:00.0: [8086:d131] type 00 class 0x060000
[    0.247184] pci 0000:00:03.0: [8086:d138] type 01 class 0x060400
[    0.247225] pci 0000:00:03.0: PME# supported from D0 D3hot D3cold
[    0.247290] pci 0000:00:08.0: [8086:d155] type 00 class 0x088000
[    0.247379] pci 0000:00:08.1: [8086:d156] type 00 class 0x088000
[    0.247469] pci 0000:00:08.2: [8086:d157] type 00 class 0x088000
[    0.247555] pci 0000:00:08.3: [8086:d158] type 00 class 0x088000
[    0.247636] pci 0000:00:10.0: [8086:d150] type 00 class 0x088000
[    0.247720] pci 0000:00:10.1: [8086:d151] type 00 class 0x088000
[    0.247811] pci 0000:00:1a.0: [8086:3b3b] type 00 class 0x0c0300
[    0.247848] pci 0000:00:1a.0: reg 0x20: [io  0xff00-0xff1f]
[    0.247942] pci 0000:00:1a.1: [8086:3b3e] type 00 class 0x0c0300
[    0.247979] pci 0000:00:1a.1: reg 0x20: [io  0xfe00-0xfe1f]
[    0.248072] pci 0000:00:1a.2: [8086:3b3f] type 00 class 0x0c0300
[    0.248108] pci 0000:00:1a.2: reg 0x20: [io  0xfd00-0xfd1f]
[    0.248208] pci 0000:00:1a.7: [8086:3b3c] type 00 class 0x0c0320
[    0.248227] pci 0000:00:1a.7: reg 0x10: [mem 0xfbfff000-0xfbfff3ff]
[    0.248306] pci 0000:00:1a.7: PME# supported from D0 D3hot D3cold
[    0.248376] pci 0000:00:1c.0: [8086:3b42] type 01 class 0x060400
[    0.248435] pci 0000:00:1c.0: PME# supported from D0 D3hot D3cold
[    0.248502] pci 0000:00:1c.1: [8086:3b44] type 01 class 0x060400
[    0.248562] pci 0000:00:1c.1: PME# supported from D0 D3hot D3cold
[    0.248635] pci 0000:00:1d.0: [8086:3b36] type 00 class 0x0c0300
[    0.248674] pci 0000:00:1d.0: reg 0x20: [io  0xfc00-0xfc1f]
[    0.248768] pci 0000:00:1d.1: [8086:3b37] type 00 class 0x0c0300
[    0.248805] pci 0000:00:1d.1: reg 0x20: [io  0xfb00-0xfb1f]
[    0.248897] pci 0000:00:1d.2: [8086:3b38] type 00 class 0x0c0300
[    0.248934] pci 0000:00:1d.2: reg 0x20: [io  0xfa00-0xfa1f]
[    0.249027] pci 0000:00:1d.3: [8086:3b39] type 00 class 0x0c0300
[    0.249063] pci 0000:00:1d.3: reg 0x20: [io  0xf900-0xf91f]
[    0.249163] pci 0000:00:1d.7: [8086:3b34] type 00 class 0x0c0320
[    0.249181] pci 0000:00:1d.7: reg 0x10: [mem 0xfbffe000-0xfbffe3ff]
[    0.249260] pci 0000:00:1d.7: PME# supported from D0 D3hot D3cold
[    0.249328] pci 0000:00:1e.0: [8086:244e] type 01 class 0x060401
[    0.249433] pci 0000:00:1f.0: [8086:3b02] type 00 class 0x060100
[    0.249592] pci 0000:00:1f.2: [8086:3b22] type 00 class 0x010601
[    0.249608] pci 0000:00:1f.2: reg 0x10: [io  0xf800-0xf807]
[    0.249614] pci 0000:00:1f.2: reg 0x14: [io  0xf700-0xf703]
[    0.249620] pci 0000:00:1f.2: reg 0x18: [io  0xf600-0xf607]
[    0.249627] pci 0000:00:1f.2: reg 0x1c: [io  0xf500-0xf503]
[    0.249633] pci 0000:00:1f.2: reg 0x20: [io  0xf400-0xf41f]
[    0.249639] pci 0000:00:1f.2: reg 0x24: [mem 0xfbffd000-0xfbffd7ff]
[    0.249682] pci 0000:00:1f.2: PME# supported from D3hot
[    0.249754] pci 0000:00:1f.3: [8086:3b30] type 00 class 0x0c0500
[    0.249767] pci 0000:00:1f.3: reg 0x10: [mem 0xfbffc000-0xfbffc0ff 64bit]
[    0.249784] pci 0000:00:1f.3: reg 0x20: [io  0x0500-0x051f]
[    0.249907] pci 0000:01:00.0: [1002:9490] type 00 class 0x030000
[    0.249918] pci 0000:01:00.0: reg 0x10: [mem 0xe0000000-0xefffffff 64bit pref]
[    0.249927] pci 0000:01:00.0: reg 0x18: [mem 0xfbce0000-0xfbceffff 64bit]
[    0.249933] pci 0000:01:00.0: reg 0x20: [io  0xee00-0xeeff]
[    0.249943] pci 0000:01:00.0: reg 0x30: [mem 0x00000000-0x0001ffff pref]
[    0.249970] pci 0000:01:00.0: supports D1 D2
[    0.250012] pci 0000:01:00.1: [1002:aa38] type 00 class 0x040300
[    0.250023] pci 0000:01:00.1: reg 0x10: [mem 0xfbcfc000-0xfbcfffff 64bit]
[    0.250073] pci 0000:01:00.1: supports D1 D2
[    0.251673] pci 0000:00:03.0: PCI bridge to [bus 01]
[    0.251729] pci 0000:00:03.0:   bridge window [io  0xe000-0xefff]
[    0.251734] pci 0000:00:03.0:   bridge window [mem 0xfbc00000-0xfbcfffff]
[    0.251740] pci 0000:00:03.0:   bridge window [mem 0xe0000000-0xefffffff 64bit pref]
[    0.251822] pci 0000:02:00.0: [10ec:8168] type 00 class 0x020000
[    0.251837] pci 0000:02:00.0: reg 0x10: [io  0xce00-0xceff]
[    0.251862] pci 0000:02:00.0: reg 0x18: [mem 0xfbaff000-0xfbafffff 64bit pref]
[    0.251877] pci 0000:02:00.0: reg 0x20: [mem 0xfbaf8000-0xfbafbfff 64bit pref]
[    0.251888] pci 0000:02:00.0: reg 0x30: [mem 0x00000000-0x0001ffff pref]
[    0.251947] pci 0000:02:00.0: supports D1 D2
[    0.251948] pci 0000:02:00.0: PME# supported from D0 D1 D2 D3hot D3cold
[    0.253676] pci 0000:00:1c.0: PCI bridge to [bus 02]
[    0.253730] pci 0000:00:1c.0:   bridge window [io  0xc000-0xcfff]
[    0.253735] pci 0000:00:1c.0:   bridge window [mem 0xfbb00000-0xfbbfffff]
[    0.253742] pci 0000:00:1c.0:   bridge window [mem 0xfba00000-0xfbafffff 64bit pref]
[    0.253824] pci 0000:03:00.0: [10ec:8168] type 00 class 0x020000
[    0.253839] pci 0000:03:00.0: reg 0x10: [io  0xbe00-0xbeff]
[    0.253864] pci 0000:03:00.0: reg 0x18: [mem 0xfbdff000-0xfbdfffff 64bit pref]
[    0.253880] pci 0000:03:00.0: reg 0x20: [mem 0xfbdf8000-0xfbdfbfff 64bit pref]
[    0.253891] pci 0000:03:00.0: reg 0x30: [mem 0x00000000-0x0001ffff pref]
[    0.253950] pci 0000:03:00.0: supports D1 D2
[    0.253951] pci 0000:03:00.0: PME# supported from D0 D1 D2 D3hot D3cold
[    0.255684] pci 0000:00:1c.1: PCI bridge to [bus 03]
[    0.255739] pci 0000:00:1c.1:   bridge window [io  0xb000-0xbfff]
[    0.255744] pci 0000:00:1c.1:   bridge window [mem 0xfbe00000-0xfbefffff]
[    0.255751] pci 0000:00:1c.1:   bridge window [mem 0xfbd00000-0xfbdfffff 64bit pref]
[    0.255819] pci 0000:04:07.0: [1283:8213] type 00 class 0x010185
[    0.255833] pci 0000:04:07.0: reg 0x10: [io  0xdf00-0xdf07]
[    0.255841] pci 0000:04:07.0: reg 0x14: [io  0xde00-0xde03]
[    0.255848] pci 0000:04:07.0: reg 0x18: [io  0xdd00-0xdd07]
[    0.255856] pci 0000:04:07.0: reg 0x1c: [io  0xdc00-0xdc03]
[    0.255864] pci 0000:04:07.0: reg 0x20: [io  0xdb00-0xdb0f]
[    0.255957] pci 0000:00:1e.0: PCI bridge to [bus 04] (subtractive decode)
[    0.256005] pci 0000:00:1e.0:   bridge window [io  0xd000-0xdfff]
[    0.256010] pci 0000:00:1e.0:   bridge window [io  0x0000-0x0cf7] (subtractive decode)
[    0.256011] pci 0000:00:1e.0:   bridge window [io  0x0d00-0xffff] (subtractive decode)
[    0.256014] pci 0000:00:1e.0:   bridge window [mem 0x000a0000-0x000bffff] (subtractive decode)
[    0.256015] pci 0000:00:1e.0:   bridge window [mem 0x000c0000-0x000dffff] (subtractive decode)
[    0.256016] pci 0000:00:1e.0:   bridge window [mem 0xfed40000-0xfed44fff] (subtractive decode)
[    0.256017] pci 0000:00:1e.0:   bridge window [mem 0xdf800000-0xfebfffff] (subtractive decode)
[    0.256037] pci_bus 0000:00: on NUMA node 0
[    0.256300] ACPI: PCI Interrupt Link [LNKA] (IRQs 3 4 5 6 7 9 10 *11 12 14 15)
[    0.256727] ACPI: PCI Interrupt Link [LNKB] (IRQs 3 4 5 6 7 9 10 11 *12 14 15)
[    0.257142] ACPI: PCI Interrupt Link [LNKC] (IRQs 3 4 5 6 *7 9 10 11 12 14 15)
[    0.257559] ACPI: PCI Interrupt Link [LNKD] (IRQs 3 4 5 6 7 9 *10 11 12 14 15)
[    0.257976] ACPI: PCI Interrupt Link [LNKE] (IRQs 3 4 5 6 7 9 10 11 12 14 15) *0, disabled.
[    0.258445] ACPI: PCI Interrupt Link [LNKF] (IRQs *3 4 5 6 7 9 10 11 12 14 15)
[    0.258863] ACPI: PCI Interrupt Link [LNK0] (IRQs 3 4 5 6 7 9 10 11 12 14 15) *0, disabled.
[    0.259331] ACPI: PCI Interrupt Link [LNK1] (IRQs 3 4 *5 6 7 9 10 11 12 14 15)
[    0.259785] ACPI: \_SB_.PCI0: notify handler is installed
[    0.259808] Found 1 acpi root devices
[    0.259877] vgaarb: device added: PCI:0000:01:00.0,decodes=io+mem,owns=io+mem,locks=none
[    0.259925] vgaarb: loaded
[    0.259964] vgaarb: bridge control possible 0000:01:00.0
[    0.260075] SCSI subsystem initialized
[    0.260173] libata version 3.00 loaded.
[    0.260174] ACPI: bus type USB registered
[    0.260249] usbcore: registered new interface driver usbfs
[    0.260309] usbcore: registered new interface driver hub
[    0.260378] usbcore: registered new device driver usb
[    0.260467] Linux video capture interface: v2.00
[    0.260553] EDAC MC: Ver: 3.0.0
[    0.260717] PCI: Using ACPI for IRQ routing
[    0.262031] PCI: Discovered peer bus 3f
[    0.262072] PCI: root bus 3f: using default resources
[    0.262073] PCI: Probing PCI hardware (bus 3f)
[    0.262098] PCI host bridge to bus 0000:3f
[    0.262140] pci_bus 0000:3f: root bus resource [io  0x0000-0xffff]
[    0.262185] pci_bus 0000:3f: root bus resource [mem 0x00000000-0xfffffffff]
[    0.262231] pci_bus 0000:3f: No busn resource found for root bus, will use [bus 3f-ff]
[    0.262279] pci_bus 0000:3f: busn_res: can not insert [bus 3f-ff] under domain [bus 00-ff] (conflicts with (null) [bus 00-3f])
[    0.262283] pci 0000:3f:00.0: [8086:2c51] type 00 class 0x060000
[    0.262322] pci 0000:3f:00.1: [8086:2c81] type 00 class 0x060000
[    0.262361] pci 0000:3f:02.0: [8086:2c90] type 00 class 0x060000
[    0.262400] pci 0000:3f:02.1: [8086:2c91] type 00 class 0x060000
[    0.262437] pci 0000:3f:03.0: [8086:2c98] type 00 class 0x060000
[    0.262473] pci 0000:3f:03.1: [8086:2c99] type 00 class 0x060000
[    0.262511] pci 0000:3f:03.4: [8086:2c9c] type 00 class 0x060000
[    0.262547] pci 0000:3f:04.0: [8086:2ca0] type 00 class 0x060000
[    0.262583] pci 0000:3f:04.1: [8086:2ca1] type 00 class 0x060000
[    0.262619] pci 0000:3f:04.2: [8086:2ca2] type 00 class 0x060000
[    0.262658] pci 0000:3f:04.3: [8086:2ca3] type 00 class 0x060000
[    0.262698] pci 0000:3f:05.0: [8086:2ca8] type 00 class 0x060000
[    0.262734] pci 0000:3f:05.1: [8086:2ca9] type 00 class 0x060000
[    0.262770] pci 0000:3f:05.2: [8086:2caa] type 00 class 0x060000
[    0.262806] pci 0000:3f:05.3: [8086:2cab] type 00 class 0x060000
[    0.262851] pci_bus 0000:3f: busn_res: [bus 3f-ff] end is updated to 3f
[    0.262854] PCI: pci_cache_line_size set to 64 bytes
[    0.262913] e820: reserve RAM buffer [mem 0x0009dc00-0x0009ffff]
[    0.262914] e820: reserve RAM buffer [mem 0xdf7b0000-0xdfffffff]
[    0.263052] HPET: 8 timers in total, 5 timers will be used for per-cpu timer
[    0.263103] hpet0: at MMIO 0xfed00000, IRQs 2, 8, 40, 41, 42, 43, 44, 0
[    0.263382] hpet0: 8 comparators, 64-bit 14.318180 MHz counter
[    0.265456] hpet: hpet2 irq 40 for MSI
[    0.265488] hpet: hpet3 irq 41 for MSI
[    0.265518] hpet: hpet4 irq 42 for MSI
[    0.265548] hpet: hpet5 irq 43 for MSI
[    0.265575] hpet: hpet6 irq 44 for MSI
[    0.265640] Switched to clocksource hpet
[    0.268997] pnp: PnP ACPI init
[    0.269042] ACPI: bus type PNP registered
[    0.269204] system 00:00: [io  0x04d0-0x04d1] has been reserved
[    0.269249] system 00:00: [io  0x0290-0x029f] has been reserved
[    0.269294] system 00:00: [io  0x0800-0x0805] has been reserved
[    0.269339] system 00:00: [io  0x0290-0x0294] has been reserved
[    0.269383] system 00:00: [io  0x0880-0x088f] has been reserved
[    0.269428] system 00:00: Plug and Play ACPI device, IDs PNP0c02 (active)
[    0.269436] pnp 00:01: [dma 4]
[    0.269476] pnp 00:01: Plug and Play ACPI device, IDs PNP0200 (active)
[    0.269553] pnp 00:02: Plug and Play ACPI device, IDs PNP0103 (active)
[    0.269612] pnp 00:03: Plug and Play ACPI device, IDs PNP0b00 (active)
[    0.269657] pnp 00:04: Plug and Play ACPI device, IDs PNP0800 (active)
[    0.269703] pnp 00:05: Plug and Play ACPI device, IDs PNP0c04 (active)
[    0.269783] pnp 00:06: [dma 2]
[    0.269834] pnp 00:06: Plug and Play ACPI device, IDs PNP0700 (active)
[    0.269998] pnp 00:07: Plug and Play ACPI device, IDs PNP0501 (active)
[    0.270087] system 00:08: [io  0x0400-0x047f] could not be reserved
[    0.270133] system 00:08: [io  0x0580-0x05ff] has been reserved
[    0.270178] system 00:08: Plug and Play ACPI device, IDs PNP0c02 (active)
[    0.270337] system 00:09: [mem 0xf4000000-0xf7ffffff] has been reserved
[    0.270384] system 00:09: Plug and Play ACPI device, IDs PNP0c02 (active)
[    0.270537] system 00:0a: [mem 0x000d1a00-0x000d3fff] has been reserved
[    0.270583] system 00:0a: [mem 0x000f0000-0x000f7fff] could not be reserved
[    0.270629] system 00:0a: [mem 0x000f8000-0x000fbfff] could not be reserved
[    0.271230] system 00:0a: [mem 0x000fc000-0x000fffff] could not be reserved
[    0.271276] system 00:0a: [mem 0xdf7b0000-0xdf7effff] could not be reserved
[    0.271323] system 00:0a: [mem 0x00000000-0x0009ffff] could not be reserved
[    0.271369] system 00:0a: [mem 0x00100000-0xdf7affff] could not be reserved
[    0.271415] system 00:0a: [mem 0xdf7f0000-0xdf7fffff] has been reserved
[    0.271460] system 00:0a: [mem 0xfec00000-0xfec00fff] could not be reserved
[    0.271507] system 00:0a: [mem 0xfed10000-0xfed1dfff] has been reserved
[    0.271552] system 00:0a: [mem 0xfed20000-0xfed8ffff] could not be reserved
[    0.271598] system 00:0a: [mem 0xfee00000-0xfee00fff] has been reserved
[    0.271652] system 00:0a: [mem 0xffb00000-0xffb7ffff] has been reserved
[    0.271699] system 00:0a: [mem 0xfff00000-0xffffffff] has been reserved
[    0.271744] system 00:0a: [mem 0x000e0000-0x000effff] has been reserved
[    0.271790] system 00:0a: Plug and Play ACPI device, IDs PNP0c01 (active)
[    0.271846] pnp 00:0b: Plug and Play ACPI device, IDs INT0800 (active)
[    0.271850] pnp: PnP ACPI: found 12 devices
[    0.271891] ACPI: bus type PNP unregistered
[    0.276530] pci 0000:01:00.0: BAR 6: assigned [mem 0xfbc00000-0xfbc1ffff pref]
[    0.276578] pci 0000:00:03.0: PCI bridge to [bus 01]
[    0.276621] pci 0000:00:03.0:   bridge window [io  0xe000-0xefff]
[    0.276673] pci 0000:00:03.0:   bridge window [mem 0xfbc00000-0xfbcfffff]
[    0.276720] pci 0000:00:03.0:   bridge window [mem 0xe0000000-0xefffffff 64bit pref]
[    0.276770] pci 0000:02:00.0: BAR 6: assigned [mem 0xfba00000-0xfba1ffff pref]
[    0.276816] pci 0000:00:1c.0: PCI bridge to [bus 02]
[    0.276859] pci 0000:00:1c.0:   bridge window [io  0xc000-0xcfff]
[    0.276906] pci 0000:00:1c.0:   bridge window [mem 0xfbb00000-0xfbbfffff]
[    0.276953] pci 0000:00:1c.0:   bridge window [mem 0xfba00000-0xfbafffff 64bit pref]
[    0.277004] pci 0000:03:00.0: BAR 6: assigned [mem 0xfbd00000-0xfbd1ffff pref]
[    0.277050] pci 0000:00:1c.1: PCI bridge to [bus 03]
[    0.277093] pci 0000:00:1c.1:   bridge window [io  0xb000-0xbfff]
[    0.277140] pci 0000:00:1c.1:   bridge window [mem 0xfbe00000-0xfbefffff]
[    0.277187] pci 0000:00:1c.1:   bridge window [mem 0xfbd00000-0xfbdfffff 64bit pref]
[    0.277238] pci 0000:00:1e.0: PCI bridge to [bus 04]
[    0.277281] pci 0000:00:1e.0:   bridge window [io  0xd000-0xdfff]
[    0.277333] pci_bus 0000:00: resource 4 [io  0x0000-0x0cf7]
[    0.277334] pci_bus 0000:00: resource 5 [io  0x0d00-0xffff]
[    0.277335] pci_bus 0000:00: resource 6 [mem 0x000a0000-0x000bffff]
[    0.277336] pci_bus 0000:00: resource 7 [mem 0x000c0000-0x000dffff]
[    0.277337] pci_bus 0000:00: resource 8 [mem 0xfed40000-0xfed44fff]
[    0.277338] pci_bus 0000:00: resource 9 [mem 0xdf800000-0xfebfffff]
[    0.277339] pci_bus 0000:01: resource 0 [io  0xe000-0xefff]
[    0.277340] pci_bus 0000:01: resource 1 [mem 0xfbc00000-0xfbcfffff]
[    0.277341] pci_bus 0000:01: resource 2 [mem 0xe0000000-0xefffffff 64bit pref]
[    0.277342] pci_bus 0000:02: resource 0 [io  0xc000-0xcfff]
[    0.277343] pci_bus 0000:02: resource 1 [mem 0xfbb00000-0xfbbfffff]
[    0.277344] pci_bus 0000:02: resource 2 [mem 0xfba00000-0xfbafffff 64bit pref]
[    0.277345] pci_bus 0000:03: resource 0 [io  0xb000-0xbfff]
[    0.277346] pci_bus 0000:03: resource 1 [mem 0xfbe00000-0xfbefffff]
[    0.277347] pci_bus 0000:03: resource 2 [mem 0xfbd00000-0xfbdfffff 64bit pref]
[    0.277348] pci_bus 0000:04: resource 0 [io  0xd000-0xdfff]
[    0.277349] pci_bus 0000:04: resource 4 [io  0x0000-0x0cf7]
[    0.277351] pci_bus 0000:04: resource 5 [io  0x0d00-0xffff]
[    0.277352] pci_bus 0000:04: resource 6 [mem 0x000a0000-0x000bffff]
[    0.277353] pci_bus 0000:04: resource 7 [mem 0x000c0000-0x000dffff]
[    0.277354] pci_bus 0000:04: resource 8 [mem 0xfed40000-0xfed44fff]
[    0.277355] pci_bus 0000:04: resource 9 [mem 0xdf800000-0xfebfffff]
[    0.277356] pci_bus 0000:3f: resource 4 [io  0x0000-0xffff]
[    0.277357] pci_bus 0000:3f: resource 5 [mem 0x00000000-0xfffffffff]
[    0.277373] NET: Registered protocol family 2
[    0.277497] TCP established hash table entries: 65536 (order: 8, 1048576 bytes)
[    0.277787] TCP bind hash table entries: 65536 (order: 8, 1048576 bytes)
[    0.278065] TCP: Hash tables configured (established 65536 bind 65536)
[    0.278125] TCP: reno registered
[    0.278167] UDP hash table entries: 4096 (order: 5, 131072 bytes)
[    0.278253] UDP-Lite hash table entries: 4096 (order: 5, 131072 bytes)
[    0.278376] NET: Registered protocol family 1
[    0.300744] pci 0000:01:00.0: Boot video device
[    0.300764] PCI: CLS 64 bytes, default 64
[    0.300789] PCI-DMA: Using software bounce buffering for IO (SWIOTLB)
[    0.300836] software IO TLB [mem 0xdb7b0000-0xdf7b0000] (64MB) mapped at [ffff8800db7b0000-ffff8800df7affff]
[    0.301936] microcode: CPU0 sig=0x106e5, pf=0x2, revision=0x4
[    0.301983] microcode: CPU1 sig=0x106e5, pf=0x2, revision=0x4
[    0.302031] microcode: CPU2 sig=0x106e5, pf=0x2, revision=0x4
[    0.302078] microcode: CPU3 sig=0x106e5, pf=0x2, revision=0x4
[    0.302125] microcode: CPU4 sig=0x106e5, pf=0x2, revision=0x4
[    0.302173] microcode: CPU5 sig=0x106e5, pf=0x2, revision=0x4
[    0.302220] microcode: CPU6 sig=0x106e5, pf=0x2, revision=0x4
[    0.302266] microcode: CPU7 sig=0x106e5, pf=0x2, revision=0x4
[    0.302359] microcode: Microcode Update Driver: v2.00 <tigran@aivazian.fsnet.co.uk>, Peter Oruba
[    0.306317] fuse init (API version 7.22)
[    0.306529] msgmni has been set to 15938
[    0.307060] Block layer SCSI generic (bsg) driver version 0.4 loaded (major 253)
[    0.307107] io scheduler noop registered
[    0.307191] io scheduler cfq registered (default)
[    0.330537] Serial: 8250/16550 driver, 4 ports, IRQ sharing disabled
[    0.351115] 00:07: ttyS0 at I/O 0x3f8 (irq = 4, base_baud = 115200) is a 16550A
[    0.351793] intel_idle: MWAIT substates: 0x1120
[    0.351801] intel_idle: v0.4 model 0x1E
[    0.351801] intel_idle: lapic_timer_reliable_states 0x2
[    0.352013] input: Power Button as /devices/LNXSYSTM:00/device:00/PNP0C0C:00/input/input0
[    0.352063] ACPI: Power Button [PWRB]
[    0.352159] input: Power Button as /devices/LNXSYSTM:00/LNXPWRBN:00/input/input1
[    0.352206] ACPI: Power Button [PWRF]
[    0.352345] ACPI: Requesting acpi_cpufreq
[    0.355541] brd: module loaded
[    0.355967] ahci 0000:00:1f.2: version 3.0
[    0.356060] ahci 0000:00:1f.2: irq 45 for MSI/MSI-X
[    0.356082] ahci 0000:00:1f.2: SSS flag set, parallel bus scan disabled
[    0.366577] ahci 0000:00:1f.2: AHCI 0001.0300 32 slots 6 ports 3 Gbps 0x3f impl SATA mode
[    0.366626] ahci 0000:00:1f.2: flags: 64bit ncq sntf stag pm led clo pmp pio slum part ems apst 
[    0.366687] ahci 0000:00:1f.2: setting latency timer to 64
[    0.378138] scsi0 : ahci
[    0.378276] scsi1 : ahci
[    0.378407] scsi2 : ahci
[    0.378540] scsi3 : ahci
[    0.378670] scsi4 : ahci
[    0.378801] scsi5 : ahci
[    0.378914] ata1: SATA max UDMA/133 abar m2048@0xfbffd000 port 0xfbffd100 irq 45
[    0.378961] ata2: SATA max UDMA/133 abar m2048@0xfbffd000 port 0xfbffd180 irq 45
[    0.379007] ata3: SATA max UDMA/133 abar m2048@0xfbffd000 port 0xfbffd200 irq 45
[    0.379054] ata4: SATA max UDMA/133 abar m2048@0xfbffd000 port 0xfbffd280 irq 45
[    0.379101] ata5: SATA max UDMA/133 abar m2048@0xfbffd000 port 0xfbffd300 irq 45
[    0.379148] ata6: SATA max UDMA/133 abar m2048@0xfbffd000 port 0xfbffd380 irq 45
[    0.379448] pata_it8213 0000:04:07.0: version 0.0.3
[    0.379454] pci 0000:00:1e.0: setting latency timer to 64
[    0.379501] pata_it8213 0000:04:07.0: setting latency timer to 64
[    0.380316] scsi6 : pata_it8213
[    0.380605] scsi7 : pata_it8213
[    0.380864] ata7: PATA max UDMA/133 cmd 0xdf00 ctl 0xde00 bmdma 0xdb00 irq 16
[    0.380910] ata8: DUMMY
[    0.381418] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver
[    0.381464] ehci-pci: EHCI PCI platform driver
[    0.381587] ehci-pci 0000:00:1a.7: setting latency timer to 64
[    0.381596] ehci-pci 0000:00:1a.7: EHCI Host Controller
[    0.381642] ehci-pci 0000:00:1a.7: new USB bus registered, assigned bus number 1
[    0.381698] ehci-pci 0000:00:1a.7: debug port 2
[    0.385637] ehci-pci 0000:00:1a.7: cache line size of 64 is not supported
[    0.385647] ehci-pci 0000:00:1a.7: irq 18, io mem 0xfbfff000
[    0.391530] ehci-pci 0000:00:1a.7: USB 2.0 started, EHCI 1.00
[    0.391789] hub 1-0:1.0: USB hub found
[    0.391840] hub 1-0:1.0: 6 ports detected
[    0.392072] ehci-pci 0000:00:1d.7: setting latency timer to 64
[    0.392078] ehci-pci 0000:00:1d.7: EHCI Host Controller
[    0.392123] ehci-pci 0000:00:1d.7: new USB bus registered, assigned bus number 2
[    0.392177] ehci-pci 0000:00:1d.7: debug port 2
[    0.396144] ehci-pci 0000:00:1d.7: cache line size of 64 is not supported
[    0.396154] ehci-pci 0000:00:1d.7: irq 23, io mem 0xfbffe000
[    0.401629] ehci-pci 0000:00:1d.7: USB 2.0 started, EHCI 1.00
[    0.401986] hub 2-0:1.0: USB hub found
[    0.402043] hub 2-0:1.0: 8 ports detected
[    0.402407] uhci_hcd: USB Universal Host Controller Interface driver
[    0.402641] uhci_hcd 0000:00:1a.0: setting latency timer to 64
[    0.402643] uhci_hcd 0000:00:1a.0: UHCI Host Controller
[    0.402692] uhci_hcd 0000:00:1a.0: new USB bus registered, assigned bus number 3
[    0.402756] uhci_hcd 0000:00:1a.0: irq 16, io base 0x0000ff00
[    0.403159] hub 3-0:1.0: USB hub found
[    0.403214] hub 3-0:1.0: 2 ports detected
[    0.403384] uhci_hcd 0000:00:1a.1: setting latency timer to 64
[    0.403386] uhci_hcd 0000:00:1a.1: UHCI Host Controller
[    0.403431] uhci_hcd 0000:00:1a.1: new USB bus registered, assigned bus number 4
[    0.403502] uhci_hcd 0000:00:1a.1: irq 21, io base 0x0000fe00
[    0.403910] hub 4-0:1.0: USB hub found
[    0.403968] hub 4-0:1.0: 2 ports detected
[    0.404143] uhci_hcd 0000:00:1a.2: setting latency timer to 64
[    0.404145] uhci_hcd 0000:00:1a.2: UHCI Host Controller
[    0.404190] uhci_hcd 0000:00:1a.2: new USB bus registered, assigned bus number 5
[    0.404253] uhci_hcd 0000:00:1a.2: irq 18, io base 0x0000fd00
[    0.404647] hub 5-0:1.0: USB hub found
[    0.404700] hub 5-0:1.0: 2 ports detected
[    0.404872] uhci_hcd 0000:00:1d.0: setting latency timer to 64
[    0.404874] uhci_hcd 0000:00:1d.0: UHCI Host Controller
[    0.404919] uhci_hcd 0000:00:1d.0: new USB bus registered, assigned bus number 6
[    0.404982] uhci_hcd 0000:00:1d.0: irq 23, io base 0x0000fc00
[    0.405343] hub 6-0:1.0: USB hub found
[    0.405395] hub 6-0:1.0: 2 ports detected
[    0.405649] uhci_hcd 0000:00:1d.1: setting latency timer to 64
[    0.405652] uhci_hcd 0000:00:1d.1: UHCI Host Controller
[    0.405699] uhci_hcd 0000:00:1d.1: new USB bus registered, assigned bus number 7
[    0.405770] uhci_hcd 0000:00:1d.1: irq 19, io base 0x0000fb00
[    0.406156] hub 7-0:1.0: USB hub found
[    0.406208] hub 7-0:1.0: 2 ports detected
[    0.406379] uhci_hcd 0000:00:1d.2: setting latency timer to 64
[    0.406381] uhci_hcd 0000:00:1d.2: UHCI Host Controller
[    0.406426] uhci_hcd 0000:00:1d.2: new USB bus registered, assigned bus number 8
[    0.406490] uhci_hcd 0000:00:1d.2: irq 18, io base 0x0000fa00
[    0.406836] hub 8-0:1.0: USB hub found
[    0.406886] hub 8-0:1.0: 2 ports detected
[    0.407060] uhci_hcd 0000:00:1d.3: setting latency timer to 64
[    0.407062] uhci_hcd 0000:00:1d.3: UHCI Host Controller
[    0.407107] uhci_hcd 0000:00:1d.3: new USB bus registered, assigned bus number 9
[    0.407172] uhci_hcd 0000:00:1d.3: irq 16, io base 0x0000f900
[    0.407411] hub 9-0:1.0: USB hub found
[    0.407462] hub 9-0:1.0: 2 ports detected
[    0.407799] i8042: PNP: No PS/2 controller found. Probing ports directly.
[    0.440801] i8042: Failed to disable AUX port, but continuing anyway... Is this a SiS?
[    0.440847] i8042: If AUX port is really absent please use the 'i8042.noaux' option
[    0.690320] serio: i8042 KBD port at 0x60,0x64 irq 1
[    0.691400] mousedev: PS/2 mouse device common for all mice
[    0.692827] rtc_cmos 00:03: RTC can wake from S4
[    0.693135] rtc_cmos 00:03: rtc core: registered rtc_cmos as rtc0
[    0.693217] rtc_cmos 00:03: alarms up to one month, 242 bytes nvram, hpet irqs
[    0.693501] i2c /dev entries driver
[    0.693836] i801_smbus 0000:00:1f.3: SMBus using PCI Interrupt
[    0.695092] it87: Found IT8720F chip at 0x290, revision 8
[    0.695141] it87: VID is disabled (pins used for GPIO)
[    0.695192] it87: Routing internal VCCH to in7
[    0.695242] it87: Beeping is supported
[    0.695790] it87_wdt: Chip IT8720 revision 8 initialized. timeout=60 sec (nowayout=0 testmode=0 exclusive=1 nogameport=0)
[    0.696398] device-mapper: ioctl: 4.26.0-ioctl (2013-08-15) initialised: dm-devel@redhat.com
[    0.697401] EDAC MC0: Giving out device to 'i7core_edac.c' 'i7 core #0': DEV 0000:3f:03.0
[    0.697546] EDAC PCI0: Giving out device to module 'i7core_edac' controller 'EDAC PCI controller': DEV '0000:3f:03.0' (POLLED)
[    0.697611] EDAC i7core: Driver loaded, 1 memory controller(s) found.
[    0.697774] hidraw: raw HID events driver (C) Jiri Kosina
[    0.698298] usbcore: registered new interface driver usbhid
[    0.698341] usbhid: USB HID core driver
[    0.698398] u32 classifier
[    0.698437]     Actions configured
[    0.698515] TCP: cubic registered
[    0.698555] Initializing XFRM netlink socket
[    0.698822] NET: Registered protocol family 10
[    0.698958] sit: IPv6 over IPv4 tunneling driver
[    0.699167] NET: Registered protocol family 17
[    0.699211] NET: Registered protocol family 15
[    0.699343] Bridge firewalling registered
[    0.699389] Key type dns_resolver registered
[    0.700558] registered taskstats version 1
[    0.701142] rtc_cmos 00:03: setting system clock to 2013-11-23 13:43:38 UTC (1385214218)
[    0.838213] ata1: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
[    0.838840] ata1.00: ATA-7: WDC WD400BD-75LRA0, 09.01D09, max UDMA/133
[    0.838886] ata1.00: 78125000 sectors, multi 0: LBA48 
[    0.839579] ata1.00: configured for UDMA/133
[    0.839816] scsi 0:0:0:0: Direct-Access     ATA      WDC WD400BD-75LR 09.0 PQ: 0 ANSI: 5
[    0.840959] sd 0:0:0:0: [sda] 78125000 512-byte logical blocks: (40.0 GB/37.2 GiB)
[    0.841063] sd 0:0:0:0: [sda] Write Protect is off
[    0.841201] sd 0:0:0:0: Attached scsi generic sg0 type 0
[    0.841891] sd 0:0:0:0: [sda] Mode Sense: 00 3a 00 00
[    0.841903] sd 0:0:0:0: [sda] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[    0.848313] usb 2-1: new high-speed USB device number 2 using ehci-pci
[    0.857574]  sda: sda1
[    0.858339] sd 0:0:0:0: [sda] Attached SCSI disk
[    1.300761] ata2: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
[    1.301709] tsc: Refined TSC clocksource calibration: 2931.249 MHz
[    1.307362] ata2.00: ATA-7: SAMSUNG HD103UJ, 1AA01113, max UDMA7
[    1.307407] ata2.00: 1953525168 sectors, multi 0: LBA48 NCQ (depth 31/32), AA
[    1.314098] ata2.00: configured for UDMA/133
[    1.314314] scsi 1:0:0:0: Direct-Access     ATA      SAMSUNG HD103UJ  1AA0 PQ: 0 ANSI: 5
[    1.315312] sd 1:0:0:0: [sdb] 1953525168 512-byte logical blocks: (1.00 TB/931 GiB)
[    1.315496] sd 1:0:0:0: [sdb] Write Protect is off
[    1.315544] sd 1:0:0:0: [sdb] Mode Sense: 00 3a 00 00
[    1.315555] sd 1:0:0:0: Attached scsi generic sg1 type 0
[    1.315559] sd 1:0:0:0: [sdb] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[    1.403335]  sdb: sdb1 < sdb5 sdb6 sdb7 sdb8 sdb9 sdb10 sdb11 >
[    1.405004] sd 1:0:0:0: [sdb] Attached SCSI disk
[    1.531501] usb 4-1: new low-speed USB device number 2 using uhci_hcd
[    1.775299] ata3: SATA link up 1.5 Gbps (SStatus 113 SControl 300)
[    1.775946] ata3.00: ATAPI: ATAPI   iHOS104, WL0F, max UDMA/100
[    1.776830] ata3.00: configured for UDMA/100
[    1.781767] scsi 2:0:0:0: CD-ROM            ATAPI    iHOS104          WL0F PQ: 0 ANSI: 5
[    1.786124] sr0: scsi3-mmc drive: 32x/32x cd/rw xa/form2 cdda tray
[    1.786191] cdrom: Uniform CD-ROM driver Revision: 3.20
[    1.787049] sr 2:0:0:0: Attached scsi CD-ROM sr0
[    1.787706] sr 2:0:0:0: Attached scsi generic sg2 type 5
[    1.842707] hid-generic 0003:0764:0501.0001: hiddev0,hidraw0: USB HID v1.10 Device [CPS DX600E] on usb-0000:00:1a.1-1/input0
[    2.048048] usb 8-1: new low-speed USB device number 2 using uhci_hcd
[    2.247839] ata4: SATA link up 3.0 Gbps (SStatus 123 SControl 300)
[    2.248993] ata4.00: ATA-8: Hitachi HTS725016A9A362, PCBOC70E, max UDMA/133
[    2.249051] ata4.00: 312581808 sectors, multi 0: LBA48 NCQ (depth 31/32), AA
[    2.250445] ata4.00: configured for UDMA/133
[    2.250851] scsi 3:0:0:0: Direct-Access     ATA      Hitachi HTS72501 PCBO PQ: 0 ANSI: 5
[    2.251606] sd 3:0:0:0: [sdc] 312581808 512-byte logical blocks: (160 GB/149 GiB)
[    2.251706] sd 3:0:0:0: [sdc] Write Protect is off
[    2.251760] sd 3:0:0:0: [sdc] Mode Sense: 00 3a 00 00
[    2.251798] sd 3:0:0:0: [sdc] Write cache: enabled, read cache: enabled, doesn't support DPO or FUA
[    2.251972] sd 3:0:0:0: Attached scsi generic sg3 type 0
[    2.301258] Switched to clocksource tsc
[    2.429582] input: Logitech Optical USB Mouse as /devices/pci0000:00/0000:00:1d.2/usb8/8-1/8-1:1.0/input/input3
[    2.430523] hid-generic 0003:046D:C016.0002: input,hidraw1: USB HID v1.10 Mouse [Logitech Optical USB Mouse] on usb-0000:00:1d.2-1/input0
[    2.556594] ata5: SATA link down (SStatus 0 SControl 300)
[    2.580990]  sdc: sdc1 < sdc5 >
[    2.581961] sd 3:0:0:0: [sdc] Attached SCSI disk
[    2.636471] usb 8-2: new low-speed USB device number 3 using uhci_hcd
[    2.861238] ata6: SATA link down (SStatus 0 SControl 300)
[    2.881961] EXT4-fs (sdb6): couldn't mount as ext3 due to feature incompatibilities
[    2.882425] EXT4-fs (sdb6): couldn't mount as ext2 due to feature incompatibilities
[    2.902097] EXT4-fs (sdb6): mounted filesystem with ordered data mode. Opts: (null)
[    2.902148] VFS: Mounted root (ext4 filesystem) readonly on device 8:22.
[    2.908843] devtmpfs: mounted
[    2.909198] Freeing unused kernel memory: 780K (ffffffff816aa000 - ffffffff8176d000)
[    2.936908] input:   USB Keyboard as /devices/pci0000:00/0000:00:1d.2/usb8/8-2/8-2:1.0/input/input4
[    2.937368] hid-generic 0003:1241:1503.0003: input,hidraw2: USB HID v1.10 Keyboard [  USB Keyboard] on usb-0000:00:1d.2-2/input0
[    3.026231] input:   USB Keyboard as /devices/pci0000:00/0000:00:1d.2/usb8/8-2/8-2:1.1/input/input5
[    3.026737] hid-generic 0003:1241:1503.0004: input,hidraw3: USB HID v1.10 Device [  USB Keyboard] on usb-0000:00:1d.2-2/input1
[    3.231836] usb 9-1: new full-speed USB device number 2 using uhci_hcd
[    4.701204] systemd-udevd[1643]: starting version 208
[    5.281869] Floppy drive(s): fd0 is 1.44M
[    5.296486] FDC 0 is a post-1991 82077
[    5.330641] [drm] Initialized drm 1.1.0 20060810
[    5.495120] [drm] radeon kernel modesetting enabled.
[    5.495158] pcieport 0000:00:03.0: driver skip pci_set_master, fix it!
[    5.495340] [drm] initializing kernel modesetting (RV730 0x1002:0x9490 0x174B:0xE880).
[    5.495351] [drm] register mmio base: 0xFBCE0000
[    5.495351] [drm] register mmio size: 65536
[    5.495387] ATOM BIOS: 
[    5.495419] radeon 0000:01:00.0: VRAM: 512M 0x0000000000000000 - 0x000000001FFFFFFF (512M used)
[    5.495420] radeon 0000:01:00.0: GTT: 1024M 0x0000000020000000 - 0x000000005FFFFFFF
[    5.495421] [drm] Detected VRAM RAM=512M, BAR=256M
[    5.495421] [drm] RAM width 128bits DDR
[    5.495527] [TTM] Zone  kernel: Available graphics memory: 4080664 kiB
[    5.495528] [TTM] Zone   dma32: Available graphics memory: 2097152 kiB
[    5.495528] [TTM] Initializing pool allocator
[    5.495531] [TTM] Initializing DMA pool allocator
[    5.495542] [drm] radeon: 512M of VRAM memory ready
[    5.495542] [drm] radeon: 1024M of GTT memory ready.
[    5.652444] r8168 Gigabit Ethernet driver 8.037.00-NAPI loaded
[    5.652457] pcieport 0000:00:1c.0: driver skip pci_set_master, fix it!
[    5.652547] r8168 0000:02:00.0: irq 46 for MSI/MSI-X
[    5.653202] eth%d: 0xffffc90000028000, 6c:f0:49:51:d7:f3, IRQ 46
[    5.653292] r8168: This product is covered by one or more of the following patents: US6,570,884, US6,115,776, and US6,327,625.
[    5.653295] r8168  Copyright (C) 2013  Realtek NIC software team <nicfae@realtek.com> 
 This program comes with ABSOLUTELY NO WARRANTY; for details, please see <http://www.gnu.org/licenses/>. 
 This is free software, and you are welcome to redistribute it under certain conditions; see <http://www.gnu.org/licenses/>. 
[    5.653303] r8168 Gigabit Ethernet driver 8.037.00-NAPI loaded
[    5.653395] pcieport 0000:00:1c.1: driver skip pci_set_master, fix it!
[    5.653474] r8168 0000:03:00.0: irq 47 for MSI/MSI-X
[    5.654125] eth%d: 0xffffc900044f2000, 6c:f0:49:51:d7:e3, IRQ 47
[    5.654198] r8168: This product is covered by one or more of the following patents: US6,570,884, US6,115,776, and US6,327,625.
[    5.654200] r8168  Copyright (C) 2013  Realtek NIC software team <nicfae@realtek.com> 
 This program comes with ABSOLUTELY NO WARRANTY; for details, please see <http://www.gnu.org/licenses/>. 
 This is free software, and you are welcome to redistribute it under certain conditions; see <http://www.gnu.org/licenses/>. 
[    5.862247] [drm] GART: num cpu pages 262144, num gpu pages 262144
[    5.863226] [drm] enabling PCIE gen 2 link speeds, disable with radeon.pcie_gen2=0
[    5.884969] [drm] Loading RV730 Microcode
[    5.935640] [drm] PCIE GART of 1024M enabled (table at 0x000000000025D000).
[    5.935692] radeon 0000:01:00.0: WB enabled
[    5.935694] radeon 0000:01:00.0: fence driver on ring 0 use gpu addr 0x0000000020000c00 and cpu addr 0xffff880213cedc00
[    5.935695] radeon 0000:01:00.0: fence driver on ring 3 use gpu addr 0x0000000020000c0c and cpu addr 0xffff880213cedc0c
[    5.936389] radeon 0000:01:00.0: fence driver on ring 5 use gpu addr 0x000000000005c598 and cpu addr 0xffffc9000491c598
[    5.936391] [drm] Supports vblank timestamp caching Rev 1 (10.10.2010).
[    5.936391] [drm] Driver supports precise vblank timestamp query.
[    5.936404] radeon 0000:01:00.0: irq 48 for MSI/MSI-X
[    5.936411] radeon 0000:01:00.0: radeon: using MSI.
[    5.936432] [drm] radeon: irq initialized.
[    5.983174] [drm] ring test on 0 succeeded in 1 usecs
[    5.983233] [drm] ring test on 3 succeeded in 1 usecs
[    5.990767] usb-storage 2-1:1.0: USB Mass Storage device detected
[    5.990839] scsi8 : usb-storage 2-1:1.0
[    5.990927] usb-storage 9-1:1.0: USB Mass Storage device detected
[    5.990964] scsi9 : usb-storage 9-1:1.0
[    5.990996] usbcore: registered new interface driver usb-storage
[    6.023315] systemd-udevd[1661]: renamed network interface eth0 to lan0
[    6.035245] systemd-udevd[1670]: renamed network interface eth1 to wan0
[    6.079307] kvm: VM_EXIT_LOAD_IA32_PERF_GLOBAL_CTRL does not work properly. Using workaround
[    6.169128] [drm] ring test on 5 succeeded in 1 usecs
[    6.169131] [drm] UVD initialized successfully.
[    6.169282] [drm] Enabling audio 0 support
[    6.169300] [drm] ib test on ring 0 succeeded in 0 usecs
[    6.169318] [drm] ib test on ring 3 succeeded in 0 usecs
[    6.319946] [drm] ib test on ring 5 succeeded
[    6.320314] [drm] Radeon Display Connectors
[    6.320315] [drm] Connector 0:
[    6.320315] [drm]   DVI-I-1
[    6.320316] [drm]   HPD2
[    6.320317] [drm]   DDC: 0x7f10 0x7f10 0x7f14 0x7f14 0x7f18 0x7f18 0x7f1c 0x7f1c
[    6.320318] [drm]   Encoders:
[    6.320318] [drm]     CRT2: INTERNAL_KLDSCP_DAC2
[    6.320319] [drm]     DFP2: INTERNAL_UNIPHY1
[    6.320319] [drm] Connector 1:
[    6.320320] [drm]   DIN-1
[    6.320320] [drm]   Encoders:
[    6.320321] [drm]     TV1: INTERNAL_KLDSCP_DAC2
[    6.320321] [drm] Connector 2:
[    6.320321] [drm]   DVI-I-2
[    6.320322] [drm]   HPD1
[    6.320323] [drm]   DDC: 0x7e20 0x7e20 0x7e24 0x7e24 0x7e28 0x7e28 0x7e2c 0x7e2c
[    6.320323] [drm]   Encoders:
[    6.320324] [drm]     CRT1: INTERNAL_KLDSCP_DAC1
[    6.320324] [drm]     DFP1: INTERNAL_UNIPHY
[    6.320341] [drm] Internal thermal controller with fan control
[    6.320359] == power state 0 ==
[    6.320360] 	ui class: none
[    6.320361] 	internal class: boot 
[    6.320362] 	caps: video 
[    6.320363] 	uvd    vclk: 0 dclk: 0
[    6.320364] 		power level 0    sclk: 75000 mclk: 100000 vddc: 1250
[    6.320365] 		power level 1    sclk: 75000 mclk: 100000 vddc: 1250
[    6.320365] 		power level 2    sclk: 75000 mclk: 100000 vddc: 1250
[    6.320366] 	status: c r b 
[    6.320367] == power state 1 ==
[    6.320367] 	ui class: performance
[    6.320368] 	internal class: none
[    6.320369] 	caps: single_disp video 
[    6.320370] 	uvd    vclk: 0 dclk: 0
[    6.320371] 		power level 0    sclk: 30000 mclk: 100000 vddc: 1250
[    6.320371] 		power level 1    sclk: 30000 mclk: 100000 vddc: 1250
[    6.320372] 		power level 2    sclk: 75000 mclk: 100000 vddc: 1250
[    6.320372] 	status: 
[    6.320373] == power state 2 ==
[    6.320373] 	ui class: none
[    6.320374] 	internal class: uvd 
[    6.320374] 	caps: video 
[    6.320375] 	uvd    vclk: 53300 dclk: 40000
[    6.320376] 		power level 0    sclk: 75000 mclk: 100000 vddc: 1250
[    6.320377] 		power level 1    sclk: 75000 mclk: 100000 vddc: 1250
[    6.320377] 		power level 2    sclk: 75000 mclk: 100000 vddc: 1250
[    6.320378] 	status: 
[    6.320378] == power state 3 ==
[    6.320378] 	ui class: performance
[    6.320379] 	internal class: none
[    6.320380] 	caps: video 
[    6.320381] 	uvd    vclk: 0 dclk: 0
[    6.320381] 		power level 0    sclk: 30000 mclk: 100000 vddc: 1250
[    6.320382] 		power level 1    sclk: 30000 mclk: 100000 vddc: 1250
[    6.320383] 		power level 2    sclk: 75000 mclk: 100000 vddc: 1250
[    6.320383] 	status: 
[    6.324820] switching from power state:
[    6.324820] 	ui class: none
[    6.324821] 	internal class: boot 
[    6.324822] 	caps: video 
[    6.324823] 	uvd    vclk: 0 dclk: 0
[    6.324823] 		power level 0    sclk: 75000 mclk: 100000 vddc: 1250
[    6.324824] 		power level 1    sclk: 75000 mclk: 100000 vddc: 1250
[    6.324824] 		power level 2    sclk: 75000 mclk: 100000 vddc: 1250
[    6.324825] 	status: c b 
[    6.324826] switching to power state:
[    6.324826] 	ui class: performance
[    6.324827] 	internal class: none
[    6.324827] 	caps: single_disp video 
[    6.324829] 	uvd    vclk: 0 dclk: 0
[    6.324829] 		power level 0    sclk: 30000 mclk: 100000 vddc: 1250
[    6.324830] 		power level 1    sclk: 30000 mclk: 100000 vddc: 1250
[    6.324830] 		power level 2    sclk: 75000 mclk: 100000 vddc: 1250
[    6.324831] 	status: r 
[    6.325174] [drm] radeon: dpm initialized
[    6.425137] [drm] fb mappable at 0xE045E000
[    6.425138] [drm] vram apper at 0xE0000000
[    6.425138] [drm] size 8294400
[    6.425139] [drm] fb depth is 24
[    6.425139] [drm]    pitch is 7680
[    6.425172] fbcon: radeondrmfb (fb0) is primary device
[    6.430511] switching from power state:
[    6.430511] 	ui class: performance
[    6.430512] 	internal class: none
[    6.430513] 	caps: single_disp video 
[    6.430513] 	uvd    vclk: 0 dclk: 0
[    6.430513] 		power level 0    sclk: 30000 mclk: 100000 vddc: 1250
[    6.430514] 		power level 1    sclk: 30000 mclk: 100000 vddc: 1250
[    6.430514] 		power level 2    sclk: 75000 mclk: 100000 vddc: 1250
[    6.430515] 	status: c 
[    6.430515] switching to power state:
[    6.430515] 	ui class: performance
[    6.430516] 	internal class: none
[    6.430516] 	caps: video 
[    6.430516] 	uvd    vclk: 0 dclk: 0
[    6.430517] 		power level 0    sclk: 30000 mclk: 100000 vddc: 1250
[    6.430517] 		power level 1    sclk: 30000 mclk: 100000 vddc: 1250
[    6.430518] 		power level 2    sclk: 75000 mclk: 100000 vddc: 1250
[    6.430518] 	status: r 
[    6.438291] Console: switching to colour frame buffer device 160x64
[    6.440909] radeon 0000:01:00.0: fb0: radeondrmfb frame buffer device
[    6.440910] radeon 0000:01:00.0: registered panic notifier
[    6.440912] [drm] Initialized radeon 2.34.0 20080528 for 0000:01:00.0 on minor 0
[    6.441119] ALSA sound/pci/hda/hda_intel.c:3378 0000:01:00.1: Using LPIB position fix
[    6.441144] snd_hda_intel 0000:01:00.1: irq 49 for MSI/MSI-X
[    6.443583] ALSA sound/pci/hda/hda_intel.c:1799 0000:01:00.1: Enable sync_write for stable communication
[    6.512361] ALSA sound/pci/hda/hda_eld.c:684 HDMI ATI/AMD: no speaker allocation for ELD
[    6.512486] input: HDA ATI HDMI HDMI/DP,pcm=3 as /devices/pci0000:00/0000:00:03.0/0000:01:00.1/sound/card0/input6
[    6.992188] scsi 8:0:0:0: Direct-Access     Lexar    USB Flash Drive  8.07 PQ: 0 ANSI: 4
[    6.992497] sd 8:0:0:0: Attached scsi generic sg4 type 0
[    6.993964] sd 8:0:0:0: [sdd] 15659008 512-byte logical blocks: (8.01 GB/7.46 GiB)
[    6.995125] sd 8:0:0:0: [sdd] Write Protect is off
[    6.995131] sd 8:0:0:0: [sdd] Mode Sense: 23 00 00 00
[    6.996525] sd 8:0:0:0: [sdd] Write cache: disabled, read cache: enabled, doesn't support DPO or FUA
[    7.001863]  sdd: sdd1
[    7.006214] sd 8:0:0:0: [sdd] Attached SCSI removable disk
[    7.314644] scsi 9:0:0:0: Direct-Access     Motorola K1               2.31 PQ: 0 ANSI: 2
[    7.314868] sd 9:0:0:0: Attached scsi generic sg5 type 0
[    7.634309] sd 9:0:0:0: [sde] Attached SCSI removable disk
[    7.941631] loop: module loaded
[    7.981604] PPP generic driver version 2.4.2
[    8.471421] bio: create slab <bio-1> at 1
[   10.058169] usb 4-1: USB disconnect, device number 2
[   11.403947] usb 4-1: new low-speed USB device number 3 using uhci_hcd
[   11.715913] hid-generic 0003:0764:0501.0005: hiddev0,hidraw0: USB HID v1.10 Device [CPS DX600E] on usb-0000:00:1a.1-1/input0
[   13.787987] bio: create slab <bio-2> at 2
[   16.309926] EXT4-fs (sdb6): re-mounted. Opts: barrier=0,commit=30,acl
[   16.709805] Adding 5242876k swap on /dev/mapper/symphony-swap.  Priority:-1 extents:1 across:5242876k 
[   16.781483] EXT4-fs (dm-1): mounted filesystem with ordered data mode. Opts: barrier=1,commit=15
[   16.813388] EXT4-fs (dm-10): mounted filesystem with ordered data mode. Opts: barrier=1,commit=30
[   16.856788] EXT4-fs (dm-3): mounted filesystem with ordered data mode. Opts: barrier=1,commit=30
[   16.884705] REISERFS (device dm-14): found reiserfs format "3.6" with standard journal
[   16.884713] REISERFS (device dm-14): using ordered data mode
[   16.889449] REISERFS (device dm-14): journal params: device dm-14, size 8192, journal first block 18, max trans len 1024, max batch 900, max commit age 30, max trans age 30
[   16.889674] REISERFS (device dm-14): checking transaction log (dm-14)
[   16.926468] REISERFS (device dm-14): Using r5 hash to sort names
[   16.998670] EXT4-fs (dm-2): barriers disabled
[   17.007714] EXT4-fs (dm-2): mounted filesystem with ordered data mode. Opts: barrier=0,commit=30
[   17.030005] EXT4-fs (dm-11): barriers disabled
[   17.039373] EXT4-fs (dm-11): mounted filesystem with ordered data mode. Opts: barrier=0,commit=30
[   17.083511] EXT4-fs (dm-5): barriers disabled
[   17.093808] EXT4-fs (dm-5): mounted filesystem with writeback data mode. Opts: barrier=0,commit=30,data=writeback
[   17.118251] EXT4-fs (dm-15): barriers disabled
[   17.126644] EXT4-fs (dm-15): mounted filesystem with ordered data mode. Opts: barrier=0,commit=30,acl
[   17.292691] ISO 9660 Extensions: Microsoft Joliet Level 3
[   17.305162] ISO 9660 Extensions: RRIP_1991A
[   17.386748] ISO 9660 Extensions: Microsoft Joliet Level 3
[   17.395161] ISO 9660 Extensions: RRIP_1991A
[   18.764870] microcode: CPU0 sig=0x106e5, pf=0x2, revision=0x4
[   18.765467] microcode: CPU0 updated to revision 0x6, date = 2013-07-01
[   18.765623] microcode: CPU1 sig=0x106e5, pf=0x2, revision=0x4
[   18.765816] microcode: CPU1 updated to revision 0x6, date = 2013-07-01
[   18.766056] microcode: CPU2 sig=0x106e5, pf=0x2, revision=0x4
[   18.766284] microcode: CPU2 updated to revision 0x6, date = 2013-07-01
[   18.766531] microcode: CPU3 sig=0x106e5, pf=0x2, revision=0x4
[   18.766757] microcode: CPU3 updated to revision 0x6, date = 2013-07-01
[   18.767001] microcode: CPU4 sig=0x106e5, pf=0x2, revision=0x4
[   18.767504] microcode: CPU4 updated to revision 0x6, date = 2013-07-01
[   18.767656] microcode: CPU5 sig=0x106e5, pf=0x2, revision=0x4
[   18.767839] microcode: CPU5 updated to revision 0x6, date = 2013-07-01
[   18.768046] microcode: CPU6 sig=0x106e5, pf=0x2, revision=0x4
[   18.768541] microcode: CPU6 updated to revision 0x6, date = 2013-07-01
[   18.768802] microcode: CPU7 sig=0x106e5, pf=0x2, revision=0x4
[   18.769026] microcode: CPU7 updated to revision 0x6, date = 2013-07-01
[   19.206607] IPv6: ADDRCONF(NETDEV_UP): wan0: link is not ready
[   21.365817] Bluetooth: Core ver 2.16
[   21.365822] NET: Registered protocol family 31
[   21.365899] Bluetooth: HCI device and connection manager initialized
[   21.365907] Bluetooth: HCI socket layer initialized
[   21.365910] Bluetooth: L2CAP socket layer initialized
[   21.365913] Bluetooth: SCO socket layer initialized
[   21.402371] Bluetooth: BNEP (Ethernet Emulation) ver 1.3
[   21.402372] Bluetooth: BNEP filters: protocol multicast
[   21.402375] Bluetooth: BNEP socket layer initialized
[   22.121398] FS-Cache: Loaded
[   22.138881] CacheFiles: Loaded
[   22.402325] FS-Cache: Cache "mycache" added (type cachefiles)
[   22.402328] CacheFiles: File cache on sdb6 registered
[   23.280878] r8168: wan0: link up
[   23.280899] IPv6: ADDRCONF(NETDEV_CHANGE): wan0: link becomes ready
[   32.285734] usb 4-1: USB disconnect, device number 3
[   32.821791] ALSA sound/pci/hda/hda_eld.c:684 HDMI ATI/AMD: no speaker allocation for ELD
[   33.121906] ALSA sound/pci/hda/hda_eld.c:684 HDMI ATI/AMD: no speaker allocation for ELD
[   33.407632] usb 4-1: new low-speed USB device number 4 using uhci_hcd
[   33.422643] ALSA sound/pci/hda/hda_eld.c:684 HDMI ATI/AMD: no speaker allocation for ELD
[   33.606813] ALSA sound/pci/hda/hda_eld.c:684 HDMI ATI/AMD: no speaker allocation for ELD
[   33.649626] switching from power state:
[   33.649628] 	ui class: performance
[   33.649629] 	internal class: none
[   33.649631] 	caps: video 
[   33.649633] 	uvd    vclk: 0 dclk: 0
[   33.649634] 		power level 0    sclk: 30000 mclk: 100000 vddc: 1250
[   33.649635] 		power level 1    sclk: 30000 mclk: 100000 vddc: 1250
[   33.649636] 		power level 2    sclk: 75000 mclk: 100000 vddc: 1250
[   33.649637] 	status: c 
[   33.649638] switching to power state:
[   33.649638] 	ui class: performance
[   33.649639] 	internal class: none
[   33.649641] 	caps: single_disp video 
[   33.649643] 	uvd    vclk: 0 dclk: 0
[   33.649644] 		power level 0    sclk: 30000 mclk: 100000 vddc: 1250
[   33.649645] 		power level 1    sclk: 30000 mclk: 100000 vddc: 1250
[   33.649646] 		power level 2    sclk: 75000 mclk: 100000 vddc: 1250
[   33.649646] 	status: r 
[   33.658123] switching from power state:
[   33.658124] 	ui class: performance
[   33.658125] 	internal class: none
[   33.658126] 	caps: single_disp video 
[   33.658127] 	uvd    vclk: 0 dclk: 0
[   33.658128] 		power level 0    sclk: 30000 mclk: 100000 vddc: 1250
[   33.658128] 		power level 1    sclk: 30000 mclk: 100000 vddc: 1250
[   33.658129] 		power level 2    sclk: 75000 mclk: 100000 vddc: 1250
[   33.658129] 	status: c 
[   33.658130] switching to power state:
[   33.658130] 	ui class: performance
[   33.658130] 	internal class: none
[   33.658131] 	caps: video 
[   33.658132] 	uvd    vclk: 0 dclk: 0
[   33.658133] 		power level 0    sclk: 30000 mclk: 100000 vddc: 1250
[   33.658133] 		power level 1    sclk: 30000 mclk: 100000 vddc: 1250
[   33.658134] 		power level 2    sclk: 75000 mclk: 100000 vddc: 1250
[   33.658134] 	status: r 
[   33.664290] ALSA sound/pci/hda/hda_eld.c:684 HDMI ATI/AMD: no speaker allocation for ELD
[   33.720682] hid-generic 0003:0764:0501.0006: hiddev0,hidraw0: USB HID v1.10 Device [CPS DX600E] on usb-0000:00:1a.1-1/input0
[   33.723224] ALSA sound/pci/hda/hda_eld.c:684 HDMI ATI/AMD: no speaker allocation for ELD
[   34.023971] ALSA sound/pci/hda/hda_eld.c:684 HDMI ATI/AMD: no speaker allocation for ELD
[   34.297094] RPC: Registered named UNIX socket transport module.
[   34.297095] RPC: Registered udp transport module.
[   34.297096] RPC: Registered tcp transport module.
[   34.297097] RPC: Registered tcp NFSv4.1 backchannel transport module.
[   34.324619] ALSA sound/pci/hda/hda_eld.c:684 HDMI ATI/AMD: no speaker allocation for ELD
[   34.625483] ALSA sound/pci/hda/hda_eld.c:684 HDMI ATI/AMD: no speaker allocation for ELD
[   34.866736] Installing knfsd (copyright (C) 1996 okir@monad.swb.de).
[   34.926125] ALSA sound/pci/hda/hda_eld.c:684 HDMI ATI/AMD: no speaker allocation for ELD
[   35.226909] ALSA sound/pci/hda/hda_eld.c:684 HDMI ATI/AMD: no speaker allocation for ELD
[   35.583740] NFSD: Using /var/lib/nfs/v4recovery as the NFSv4 state recovery directory
[   35.599336] NFSD: starting 90-second grace period (net ffffffff81690e00)
[   36.037803] ip_tables: (C) 2000-2006 Netfilter Core Team
[   38.720168] nf_conntrack version 0.5.0 (16384 buckets, 65536 max)
[   39.650672] EXT4-fs (sdb6): Unrecognized mount option "commit=-1" or missing value
[   40.165493] EXT4-fs (dm-1): Unrecognized mount option "commit=-1" or missing value
[   40.175371] EXT4-fs (dm-10): Unrecognized mount option "commit=-1" or missing value
[   40.177546] EXT4-fs (dm-3): Unrecognized mount option "commit=-1" or missing value
[   40.191102] EXT4-fs (dm-2): Unrecognized mount option "commit=-1" or missing value
[   40.193204] EXT4-fs (dm-11): Unrecognized mount option "commit=-1" or missing value
[   40.195672] EXT4-fs (dm-5): Unrecognized mount option "commit=-1" or missing value
[   40.198505] EXT4-fs (dm-15): Unrecognized mount option "commit=-1" or missing value
[   40.216199] ipt_ULOG: ULOG is deprecated and it will be removed soon, use NFLOG instead
[   41.988738] switching from power state:
[   41.988739] 	ui class: performance
[   41.988740] 	internal class: none
[   41.988740] 	caps: video 
[   41.988741] 	uvd    vclk: 0 dclk: 0
[   41.988741] 		power level 0    sclk: 30000 mclk: 100000 vddc: 1250
[   41.988742] 		power level 1    sclk: 30000 mclk: 100000 vddc: 1250
[   41.988742] 		power level 2    sclk: 75000 mclk: 100000 vddc: 1250
[   41.988743] 	status: c 
[   41.988743] switching to power state:
[   41.988743] 	ui class: performance
[   41.988744] 	internal class: none
[   41.988744] 	caps: single_disp video 
[   41.988745] 	uvd    vclk: 0 dclk: 0
[   41.988745] 		power level 0    sclk: 30000 mclk: 100000 vddc: 1250
[   41.988745] 		power level 1    sclk: 30000 mclk: 100000 vddc: 1250
[   41.988746] 		power level 2    sclk: 75000 mclk: 100000 vddc: 1250
[   41.988746] 	status: r 
[   42.001343] switching from power state:
[   42.001343] 	ui class: performance
[   42.001344] 	internal class: none
[   42.001344] 	caps: single_disp video 
[   42.001345] 	uvd    vclk: 0 dclk: 0
[   42.001345] 		power level 0    sclk: 30000 mclk: 100000 vddc: 1250
[   42.001345] 		power level 1    sclk: 30000 mclk: 100000 vddc: 1250
[   42.001346] 		power level 2    sclk: 75000 mclk: 100000 vddc: 1250
[   42.001346] 	status: c 
[   42.001346] switching to power state:
[   42.001347] 	ui class: performance
[   42.001347] 	internal class: none
[   42.001348] 	caps: video 
[   42.001348] 	uvd    vclk: 0 dclk: 0
[   42.001348] 		power level 0    sclk: 30000 mclk: 100000 vddc: 1250
[   42.001349] 		power level 1    sclk: 30000 mclk: 100000 vddc: 1250
[   42.001349] 		power level 2    sclk: 75000 mclk: 100000 vddc: 1250
[   42.001349] 	status: r 

[-- Attachment #3: Type: text/plain, Size: 0 bytes --]



^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support
  2013-11-23 15:40     ` James Le Cuirot
@ 2013-11-23 15:45       ` Anssi Hannula
  2013-11-24 14:57         ` James Le Cuirot
  0 siblings, 1 reply; 71+ messages in thread
From: Anssi Hannula @ 2013-11-23 15:45 UTC (permalink / raw)
  To: James Le Cuirot; +Cc: alsa-devel

23.11.2013 17:40, James Le Cuirot kirjoitti:
> On Sat, 23 Nov 2013 03:29:28 +0200
> Anssi Hannula <anssi.hannula@iki.fi> wrote:
> 
>> 23.11.2013 03:05, James Le Cuirot kirjoitti:
>>> Anssi Hannula <anssi.hannula <at> iki.fi> writes:
>>>
>>>> Here's another revision of the ATI/AMD multichannel+HBR patchset.
>>>
>>> Hi Anssi. Many thanks for your work on this. I am very keen to test
>>> this new code but have so far been unsuccessful. I have a Radeon
>>> 4670 (Sapphire branded) connected to a Yamaha RX-V773. I am running
>>> the sound/for-next kernel (82755ab) with your "missing PCM SAD"
>>> patch applied.
>>>
>>> The new kernel has allowed ALSA to recognise the card as
>>> multichannel and I can issue the following speaker-test command but
>>> I still only hear "Front Left" and "Front Right" and the Yahama
>>> seems to report the signal as stereo.
>>>
>>> # speaker-test -Dhdmi:CARD=HDMI,DEV=0 -c6 -t wav
>>
>> I guess it is the same without "-t wav"?
> 
> Yes.
> 
>>> I have the HDMI cable plugged
>>> into the secondary output as my speakerless DVI monitor is plugged
>>> into the primary but I have also tried the HDMI cable in the
>>> primary output by itself.
>>
>> Hmm, I'm not sure what the behavior is supposed to be with multiple
>> video outputs when we have only a single audio output (HDA pin)...
>>
>> What happens if you plug both of your outputs to the A/V receiver,
>> will only one output get audio?
> 
> I tried this and as I expected, it sent the same audio to both outputs.
> Still stereo only though.
> 
>> ELD stuff is not necessary for playback, it is mostly for information
>> (and providing the necessary info for ELD is disabled on radeon DRI
>> drivers on some kernels on some GPUs ATM due to some issues).
>>
>> Is there anything interesting in "dmesg"?
> 
> I have attached my dmesg. I enabled ALSA debug and verbose printk but
> disabled the on-board HDA audio in the BIOS to make it less confusing,
> and also to see if it made any difference, which it didn't. The only
> entry I find noteworthy is about the ELD but you say this isn't
> required.
> 
> There seems to be little to go on here. Would it be worth enabling
> CONFIG_SND_DEBUG_VERBOSE? I gather it's very noisy but maybe that level
> of detail is needed. Hopefully you have a better idea.

Yeah, that would be useful.

Also, forgot to mention, but next time please indicate the part of the
log where you start the multichannel speaker-test command (e.g. timestamps).

-- 
Anssi Hannula

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support
  2013-11-23 15:45       ` Anssi Hannula
@ 2013-11-24 14:57         ` James Le Cuirot
  2013-11-25 13:20           ` Anssi Hannula
  0 siblings, 1 reply; 71+ messages in thread
From: James Le Cuirot @ 2013-11-24 14:57 UTC (permalink / raw)
  To: Anssi Hannula; +Cc: alsa-devel

On Sat, 23 Nov 2013 17:45:00 +0200
Anssi Hannula <anssi.hannula@iki.fi> wrote:

> 23.11.2013 17:40, James Le Cuirot kirjoitti:
> > On Sat, 23 Nov 2013 03:29:28 +0200
> > Anssi Hannula <anssi.hannula@iki.fi> wrote:
> > 
> >> 23.11.2013 03:05, James Le Cuirot kirjoitti:
> >>> Anssi Hannula <anssi.hannula <at> iki.fi> writes:
> >>>
> >>>> Here's another revision of the ATI/AMD multichannel+HBR patchset.
> >>>
> >>> Hi Anssi. Many thanks for your work on this. I am very keen to
> >>> test this new code but have so far been unsuccessful. I have a
> >>> Radeon 4670 (Sapphire branded) connected to a Yamaha RX-V773. I
> >>> am running the sound/for-next kernel (82755ab) with your "missing
> >>> PCM SAD" patch applied.
> >>>
> >>> The new kernel has allowed ALSA to recognise the card as
> >>> multichannel and I can issue the following speaker-test command
> >>> but I still only hear "Front Left" and "Front Right" and the
> >>> Yahama seems to report the signal as stereo.
> >>>
> >>> # speaker-test -Dhdmi:CARD=HDMI,DEV=0 -c6 -t wav
> > 
> > 
> >> ELD stuff is not necessary for playback, it is mostly for
> >> information (and providing the necessary info for ELD is disabled
> >> on radeon DRI drivers on some kernels on some GPUs ATM due to some
> >> issues).
> >>
> >> Is there anything interesting in "dmesg"?
> > 
> > I have attached my dmesg. I enabled ALSA debug and verbose printk
> > but disabled the on-board HDA audio in the BIOS to make it less
> > confusing, and also to see if it made any difference, which it
> > didn't. The only entry I find noteworthy is about the ELD but you
> > say this isn't required.
> > 
> > There seems to be little to go on here. Would it be worth enabling
> > CONFIG_SND_DEBUG_VERBOSE? I gather it's very noisy but maybe that
> > level of detail is needed. Hopefully you have a better idea.
> 
> Yeah, that would be useful.

I have now done that. It was not as noisy as I expected and only added a
few more messages. I broke the message size limit last time so I have
posted the log to Gist instead. The timings are noted there.

https://gist.github.com/chewi/7628058

Regards,
James

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support
  2013-11-24 14:57         ` James Le Cuirot
@ 2013-11-25 13:20           ` Anssi Hannula
  2013-11-25 14:32             ` James Le Cuirot
  0 siblings, 1 reply; 71+ messages in thread
From: Anssi Hannula @ 2013-11-25 13:20 UTC (permalink / raw)
  To: James Le Cuirot; +Cc: alsa-devel

24.11.2013 16:57, James Le Cuirot kirjoitti:
> On Sat, 23 Nov 2013 17:45:00 +0200
> Anssi Hannula <anssi.hannula@iki.fi> wrote:
> 
>> 23.11.2013 17:40, James Le Cuirot kirjoitti:
>>> On Sat, 23 Nov 2013 03:29:28 +0200
>>> Anssi Hannula <anssi.hannula@iki.fi> wrote:
>>>
>>>> 23.11.2013 03:05, James Le Cuirot kirjoitti:
>>>>> Anssi Hannula <anssi.hannula <at> iki.fi> writes:
>>>>>
>>>>>> Here's another revision of the ATI/AMD multichannel+HBR patchset.
>>>>>
>>>>> Hi Anssi. Many thanks for your work on this. I am very keen to
>>>>> test this new code but have so far been unsuccessful. I have a
>>>>> Radeon 4670 (Sapphire branded) connected to a Yamaha RX-V773. I
>>>>> am running the sound/for-next kernel (82755ab) with your "missing
>>>>> PCM SAD" patch applied.
>>>>>
>>>>> The new kernel has allowed ALSA to recognise the card as
>>>>> multichannel and I can issue the following speaker-test command
>>>>> but I still only hear "Front Left" and "Front Right" and the
>>>>> Yahama seems to report the signal as stereo.
>>>>>
>>>>> # speaker-test -Dhdmi:CARD=HDMI,DEV=0 -c6 -t wav
>>>
>>>
>>>> ELD stuff is not necessary for playback, it is mostly for
>>>> information (and providing the necessary info for ELD is disabled
>>>> on radeon DRI drivers on some kernels on some GPUs ATM due to some
>>>> issues).
>>>>
>>>> Is there anything interesting in "dmesg"?
>>>
>>> I have attached my dmesg. I enabled ALSA debug and verbose printk
>>> but disabled the on-board HDA audio in the BIOS to make it less
>>> confusing, and also to see if it made any difference, which it
>>> didn't. The only entry I find noteworthy is about the ELD but you
>>> say this isn't required.
>>>
>>> There seems to be little to go on here. Would it be worth enabling
>>> CONFIG_SND_DEBUG_VERBOSE? I gather it's very noisy but maybe that
>>> level of detail is needed. Hopefully you have a better idea.
>>
>> Yeah, that would be useful.
> 
> I have now done that. It was not as noisy as I expected and only added a
> few more messages. I broke the message size limit last time so I have
> posted the log to Gist instead. The timings are noted there.
> 
> https://gist.github.com/chewi/7628058

Unfortunately everything looks OK.

Do you have any custom configuration in /etc/asound.conf or ~/.asoundrc?

To narrow it down a bit, are you able to test any of the following:
- same card on Windows,
- same card on fglrx,
- same receiver with a different AMD card,
- same receiver with an Intel/NVIDIA card?


-- 
Anssi Hannula

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support
  2013-11-25 13:20           ` Anssi Hannula
@ 2013-11-25 14:32             ` James Le Cuirot
  2013-11-25 14:56               ` Anssi Hannula
  0 siblings, 1 reply; 71+ messages in thread
From: James Le Cuirot @ 2013-11-25 14:32 UTC (permalink / raw)
  To: Anssi Hannula; +Cc: alsa-devel

On Mon, 25 Nov 2013 15:20:23 +0200
Anssi Hannula <anssi.hannula@iki.fi> wrote:

> 24.11.2013 16:57, James Le Cuirot kirjoitti:
> > On Sat, 23 Nov 2013 17:45:00 +0200
> > Anssi Hannula <anssi.hannula@iki.fi> wrote:
> > 
> >> 23.11.2013 17:40, James Le Cuirot kirjoitti:
> >>> On Sat, 23 Nov 2013 03:29:28 +0200
> >>> Anssi Hannula <anssi.hannula@iki.fi> wrote:
> >>>
> >>>> 23.11.2013 03:05, James Le Cuirot kirjoitti:
> >>>>> Anssi Hannula <anssi.hannula <at> iki.fi> writes:
> >>>>>
> >>>>>> Here's another revision of the ATI/AMD multichannel+HBR
> >>>>>> patchset.
> >>>>>
> >>>>> Hi Anssi. Many thanks for your work on this. I am very keen to
> >>>>> test this new code but have so far been unsuccessful. I have a
> >>>>> Radeon 4670 (Sapphire branded) connected to a Yamaha RX-V773. I
> >>>>> am running the sound/for-next kernel (82755ab) with your
> >>>>> "missing PCM SAD" patch applied.
> >>>>>
> >>>>> The new kernel has allowed ALSA to recognise the card as
> >>>>> multichannel and I can issue the following speaker-test command
> >>>>> but I still only hear "Front Left" and "Front Right" and the
> >>>>> Yahama seems to report the signal as stereo.
> >>>>>
> >>>>> # speaker-test -Dhdmi:CARD=HDMI,DEV=0 -c6 -t wav
> >>>
> >>>
> >>>> ELD stuff is not necessary for playback, it is mostly for
> >>>> information (and providing the necessary info for ELD is disabled
> >>>> on radeon DRI drivers on some kernels on some GPUs ATM due to
> >>>> some issues).
> >>>>
> >>>> Is there anything interesting in "dmesg"?
> >>>
> >>> I have attached my dmesg. I enabled ALSA debug and verbose printk
> >>> but disabled the on-board HDA audio in the BIOS to make it less
> >>> confusing, and also to see if it made any difference, which it
> >>> didn't. The only entry I find noteworthy is about the ELD but you
> >>> say this isn't required.
> > 
> > https://gist.github.com/chewi/7628058
> 
> Unfortunately everything looks OK.

I had a horrible feeling you'd say that.

> Do you have any custom configuration in /etc/asound.conf or
> ~/.asoundrc?

Just the usual PulseAudio overrides. I don't like PA starting
automatically so I have that disabled and run speaker-test without it.
I think the -D option bypasses it anyway. I have also run speaker-test
through PA just to see and get the same result.

> To narrow it down a bit, are you able to test any of the following:
> - same card on Windows,
> - same card on fglrx,
> - same receiver with a different AMD card,
> - same receiver with an Intel/NVIDIA card?

I banished real Windows installs from my main desktop after a nasty
incident some years ago. ;) I might be able to dedicate the card to a
QEMU instance but I've never tried that before.

I could easily try fglrx but I thought it didn't support multichannel?
Or this new ALSA code fixes that too?

Unfortunately I don't have any other AMD cards handy. I could try my
wife's Ivy Bridge based laptop though.

I'll report back soon.

Regards,
James

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support
  2013-11-25 14:32             ` James Le Cuirot
@ 2013-11-25 14:56               ` Anssi Hannula
  2014-05-13 12:01                 ` James Le Cuirot
  0 siblings, 1 reply; 71+ messages in thread
From: Anssi Hannula @ 2013-11-25 14:56 UTC (permalink / raw)
  To: James Le Cuirot; +Cc: alsa-devel

25.11.2013 16:32, James Le Cuirot kirjoitti:
> On Mon, 25 Nov 2013 15:20:23 +0200
> Anssi Hannula <anssi.hannula@iki.fi> wrote:
> 
>> 24.11.2013 16:57, James Le Cuirot kirjoitti:
>>> On Sat, 23 Nov 2013 17:45:00 +0200
>>> Anssi Hannula <anssi.hannula@iki.fi> wrote:
>>>
>>>> 23.11.2013 17:40, James Le Cuirot kirjoitti:
>>>>> On Sat, 23 Nov 2013 03:29:28 +0200
>>>>> Anssi Hannula <anssi.hannula@iki.fi> wrote:
>>>>>
>>>>>> 23.11.2013 03:05, James Le Cuirot kirjoitti:
>>>>>>> Anssi Hannula <anssi.hannula <at> iki.fi> writes:
>>>>>>>
>>>>>>>> Here's another revision of the ATI/AMD multichannel+HBR
>>>>>>>> patchset.
>>>>>>>
>>>>>>> Hi Anssi. Many thanks for your work on this. I am very keen to
>>>>>>> test this new code but have so far been unsuccessful. I have a
>>>>>>> Radeon 4670 (Sapphire branded) connected to a Yamaha RX-V773. I
>>>>>>> am running the sound/for-next kernel (82755ab) with your
>>>>>>> "missing PCM SAD" patch applied.
>>>>>>>
>>>>>>> The new kernel has allowed ALSA to recognise the card as
>>>>>>> multichannel and I can issue the following speaker-test command
>>>>>>> but I still only hear "Front Left" and "Front Right" and the
>>>>>>> Yahama seems to report the signal as stereo.
>>>>>>>
>>>>>>> # speaker-test -Dhdmi:CARD=HDMI,DEV=0 -c6 -t wav
>>>>>
>>>>>
>>>>>> ELD stuff is not necessary for playback, it is mostly for
>>>>>> information (and providing the necessary info for ELD is disabled
>>>>>> on radeon DRI drivers on some kernels on some GPUs ATM due to
>>>>>> some issues).
>>>>>>
>>>>>> Is there anything interesting in "dmesg"?
>>>>>
>>>>> I have attached my dmesg. I enabled ALSA debug and verbose printk
>>>>> but disabled the on-board HDA audio in the BIOS to make it less
>>>>> confusing, and also to see if it made any difference, which it
>>>>> didn't. The only entry I find noteworthy is about the ELD but you
>>>>> say this isn't required.
>>>
>>> https://gist.github.com/chewi/7628058
>>
>> Unfortunately everything looks OK.
> 
> I had a horrible feeling you'd say that.
> 
>> Do you have any custom configuration in /etc/asound.conf or
>> ~/.asoundrc?
> 
> Just the usual PulseAudio overrides. I don't like PA starting
> automatically so I have that disabled and run speaker-test without it.
> I think the -D option bypasses it anyway. I have also run speaker-test
> through PA just to see and get the same result.

OK.

>> To narrow it down a bit, are you able to test any of the following:
>> - same card on Windows,
>> - same card on fglrx,
>> - same receiver with a different AMD card,
>> - same receiver with an Intel/NVIDIA card?
> 
> I banished real Windows installs from my main desktop after a nasty
> incident some years ago. ;) I might be able to dedicate the card to a
> QEMU instance but I've never tried that before.
> 
> I could easily try fglrx but I thought it didn't support multichannel?
> Or this new ALSA code fixes that too?

Yes, it was only the ALSA code that was missing for multichannel, it
works with fglrx as well. With fglrx you should also see the ELD info as
it is not disabled there.

> Unfortunately I don't have any other AMD cards handy. I could try my
> wife's Ivy Bridge based laptop though.
> 
> I'll report back soon.


-- 
Anssi Hannula

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support
  2013-11-23  1:05 ` James Le Cuirot
  2013-11-23  1:29   ` Anssi Hannula
@ 2013-11-25 15:07   ` Raymond Yau
  2013-11-25 15:32     ` James Le Cuirot
  2013-11-25 19:35     ` Anssi Hannula
  1 sibling, 2 replies; 71+ messages in thread
From: Raymond Yau @ 2013-11-25 15:07 UTC (permalink / raw)
  To: James Le Cuirot; +Cc: alsa-devel

>
> I have a Radeon 4670 (Sapphire
> branded) connected to a Yamaha RX-V773. I am running the sound/for-next
> kernel (82755ab) with your "missing PCM SAD" patch applied.
>
> The new kernel has allowed ALSA to recognise the card as multichannel and
I
> can issue the following speaker-test command but I still only hear "Front
> Left" and "Front Right" and the Yahama seems to report the signal as
stereo.
>
> # speaker-test -Dhdmi:CARD=HDMI,DEV=0 -c6 -t wav

Why do you use -c6 when your HDMI codec only support stereo

Node 0x02 [Audio Output] wcaps 0x201: Stereo Digital
   Converter: stream=1, channel=0
Node 0x03 [Pin Complex] wcaps 0x400381: Stereo Digital

>
> I'm guessing the codec file may provide some useful information.
>
> /proc/asound/HDMI/codec#0:
> Codec: ATI R6xx HDMI
> Address: 0
> AFG Function Id: 0x1 (unsol 0)
> Vendor Id: 0x1002aa01
> Subsystem Id: 0x00aa0100
> Revision Id: 0x100100
> No Modem Function Group found
> Default PCM:
>     rates [0x70]: 32000 44100 48000
>     bits [0x2]: 16
>     formats [0x1]: PCM
> Default Amp-In caps: N/A
> Default Amp-Out caps: N/A
> State of AFG node 0x01:
>   Power states:  D0 D3
>   Power: setting=D0, actual=D0
> GPIO: io=0, o=0, i=0, unsolicited=0, wake=0
> Node 0x02 [Audio Output] wcaps 0x201: Stereo Digital
>   Converter: stream=1, channel=0
>   Digital: Enabled
>   Digital category: 0x0
>   IEC Coding Type: 0x0
> Node 0x03 [Pin Complex] wcaps 0x400381: Stereo Digital
>   Control: name="HDMI/DP,pcm=3 Jack", index=0, device=0
>   Control: name="IEC958 Playback Con Mask", index=0, device=0
>   Control: name="IEC958 Playback Pro Mask", index=0, device=0
>   Control: name="IEC958 Playback Default", index=0, device=0
>   Control: name="IEC958 Playback Switch", index=0, device=0
>   Control: name="ELD", index=0, device=3
>   Pincap 0x00000094: OUT Detect HDMI
>   Pin Default 0x18560010: [Jack] Digital Out at Int HDMI
>     Conn = Digital, Color = Unknown
>     DefAssociation = 0x1, Sequence = 0x0
>   Pin-ctls: 0x40: OUT
>   Unsolicited: tag=01, enabled=1
>   Connection: 1
>      0x02
>

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support
  2013-11-25 15:07   ` Raymond Yau
@ 2013-11-25 15:32     ` James Le Cuirot
  2013-11-25 19:35     ` Anssi Hannula
  1 sibling, 0 replies; 71+ messages in thread
From: James Le Cuirot @ 2013-11-25 15:32 UTC (permalink / raw)
  To: Raymond Yau; +Cc: alsa-devel

On Mon, 25 Nov 2013 23:07:09 +0800
Raymond Yau <superquad.vortex2@gmail.com> wrote:

> >
> > I have a Radeon 4670 (Sapphire
> > branded) connected to a Yamaha RX-V773. I am running the
> > sound/for-next kernel (82755ab) with your "missing PCM SAD" patch
> > applied.
> >
> > The new kernel has allowed ALSA to recognise the card as
> > multichannel and
> I
> > can issue the following speaker-test command but I still only hear
> > "Front Left" and "Front Right" and the Yahama seems to report the
> > signal as
> stereo.
> >
> > # speaker-test -Dhdmi:CARD=HDMI,DEV=0 -c6 -t wav
> 
> Why do you use -c6 when your HDMI codec only support stereo
> 
> Node 0x02 [Audio Output] wcaps 0x201: Stereo Digital
>    Converter: stream=1, channel=0
> Node 0x03 [Pin Complex] wcaps 0x400381: Stereo Digital

I was under the impression that this card, and all cards in the
Radeon 4000 series, are capable of 7.1 LPCM. Are you suggesting
otherwise? Either it really isn't, or this information is being wrongly
detected, and that could point to the source of the problem.

I was not aware of the significance of these lines before so thanks
for pointing this out. Before I tried the new kernel, ALSA wouldn't let
me do 6 channel output at all and PulseAudio detected the card as stereo
only. Now ALSA doesn't complain and PA detects it as 5.1 so I figured it
should work now. Having said that, I'm not sure why PA doesn't report
7.1 but I only have 5.1 speakers anyway.

Regards,
James

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support
  2013-11-25 15:07   ` Raymond Yau
  2013-11-25 15:32     ` James Le Cuirot
@ 2013-11-25 19:35     ` Anssi Hannula
  1 sibling, 0 replies; 71+ messages in thread
From: Anssi Hannula @ 2013-11-25 19:35 UTC (permalink / raw)
  To: Raymond Yau; +Cc: alsa-devel, James Le Cuirot

25.11.2013 17:07, Raymond Yau kirjoitti:
>>
>> I have a Radeon 4670 (Sapphire
>> branded) connected to a Yamaha RX-V773. I am running the sound/for-next
>> kernel (82755ab) with your "missing PCM SAD" patch applied.
>>
>> The new kernel has allowed ALSA to recognise the card as multichannel and
> I
>> can issue the following speaker-test command but I still only hear "Front
>> Left" and "Front Right" and the Yahama seems to report the signal as
> stereo.
>>
>> # speaker-test -Dhdmi:CARD=HDMI,DEV=0 -c6 -t wav
> 
> Why do you use -c6 when your HDMI codec only support stereo
> 
> Node 0x02 [Audio Output] wcaps 0x201: Stereo Digital
>    Converter: stream=1, channel=0
> Node 0x03 [Pin Complex] wcaps 0x400381: Stereo Digital

All ATI/AMD HDMI codecs report stereo only here, their multichannel
support is non-standard (probably predates the HDA spec).

-- 
Anssi Hannula

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support
  2013-11-25 14:56               ` Anssi Hannula
@ 2014-05-13 12:01                 ` James Le Cuirot
  2014-05-13 12:27                   ` Anssi Hannula
  0 siblings, 1 reply; 71+ messages in thread
From: James Le Cuirot @ 2014-05-13 12:01 UTC (permalink / raw)
  To: Anssi Hannula; +Cc: alsa-devel

On Mon, 25 Nov 2013 16:56:55 +0200
Anssi Hannula <anssi.hannula@iki.fi> wrote:

> 25.11.2013 16:32, James Le Cuirot kirjoitti:
> > On Mon, 25 Nov 2013 15:20:23 +0200
> > Anssi Hannula <anssi.hannula@iki.fi> wrote:
> > 
> >> 24.11.2013 16:57, James Le Cuirot kirjoitti:
> >>> On Sat, 23 Nov 2013 17:45:00 +0200
> >>> Anssi Hannula <anssi.hannula@iki.fi> wrote:
> >>>
> >>>> 23.11.2013 17:40, James Le Cuirot kirjoitti:
> >>>>> On Sat, 23 Nov 2013 03:29:28 +0200
> >>>>> Anssi Hannula <anssi.hannula@iki.fi> wrote:
> >>>>>
> >>>>>> 23.11.2013 03:05, James Le Cuirot kirjoitti:
> >>>>>>> Anssi Hannula <anssi.hannula <at> iki.fi> writes:
> >>>>>>>
> >>>>>>>> Here's another revision of the ATI/AMD multichannel+HBR
> >>>>>>>> patchset.
> >>>>>>>
> >>>>>>> Hi Anssi. Many thanks for your work on this. I am very keen to
> >>>>>>> test this new code but have so far been unsuccessful. I have a
> >>>>>>> Radeon 4670 (Sapphire branded) connected to a Yamaha RX-V773.
> >>>>>>> I am running the sound/for-next kernel (82755ab) with your
> >>>>>>> "missing PCM SAD" patch applied.
> >>>>>>>
> >>>>>>> The new kernel has allowed ALSA to recognise the card as
> >>>>>>> multichannel and I can issue the following speaker-test
> >>>>>>> command but I still only hear "Front Left" and "Front Right"
> >>>>>>> and the Yahama seems to report the signal as stereo.
> >>>>>>>
> >>>>>>> # speaker-test -Dhdmi:CARD=HDMI,DEV=0 -c6 -t wav
> >>>>>
> >>>>>
> >>>>>> ELD stuff is not necessary for playback, it is mostly for
> >>>>>> information (and providing the necessary info for ELD is
> >>>>>> disabled on radeon DRI drivers on some kernels on some GPUs
> >>>>>> ATM due to some issues).
> >>>>>>
> >>>>>> Is there anything interesting in "dmesg"?
> >>>>>
> >>>>> I have attached my dmesg. I enabled ALSA debug and verbose
> >>>>> printk but disabled the on-board HDA audio in the BIOS to make
> >>>>> it less confusing, and also to see if it made any difference,
> >>>>> which it didn't. The only entry I find noteworthy is about the
> >>>>> ELD but you say this isn't required.
> >>>
> >>> https://gist.github.com/chewi/7628058
> >>
> >> Unfortunately everything looks OK.
> > 
> > I had a horrible feeling you'd say that.
> > 
> >> Do you have any custom configuration in /etc/asound.conf or
> >> ~/.asoundrc?
> > 
> > Just the usual PulseAudio overrides. I don't like PA starting
> > automatically so I have that disabled and run speaker-test without
> > it. I think the -D option bypasses it anyway. I have also run
> > speaker-test through PA just to see and get the same result.
> 
> OK.
> 
> >> To narrow it down a bit, are you able to test any of the following:
> >> - same card on Windows,
> >> - same card on fglrx,
> >> - same receiver with a different AMD card,
> >> - same receiver with an Intel/NVIDIA card?
> > 
> > I banished real Windows installs from my main desktop after a nasty
> > incident some years ago. ;) I might be able to dedicate the card to
> > a QEMU instance but I've never tried that before.
> > 
> > I could easily try fglrx but I thought it didn't support
> > multichannel? Or this new ALSA code fixes that too?
> 
> Yes, it was only the ALSA code that was missing for multichannel, it
> works with fglrx as well. With fglrx you should also see the ELD info
> as it is not disabled there.
> 
> > Unfortunately I don't have any other AMD cards handy. I could try my
> > wife's Ivy Bridge based laptop though.
> > 
> > I'll report back soon.

Hi Anssi,

Guess it wasn't so "soon" after all. This dropped down my priority
list and then my receiver blew up. I ended up getting the newer
equivalent model, the RX-V775. Despite that, the problem persists,
even on a current sound "master" kernel.

There has been a little change though. I now get an ELD. This shows
what I would expect based on my receiver.

https://gist.github.com/chewi/7628058

I note that speaker-test doesn't allow me to specify -c6 anymore, only
-c8. Maybe that's because of the ELD. I do have a kernel log but not to
hand right now. It only seems to show what appears to be normal output
anyway.

I was keen to try fglrx but realised I can't because this card is only
supported by the legacy driver and that only works with kernels up to
around 3.7.

I did try my wife's Ivy Bridge laptop and that worked straight away
with no difficulties using the same HDMI cable so it seems that the
receiver isn't to blame.

I wanted to rule my Gentoo system out so I booted with Ubuntu 14.04 on
a USB stick and got exactly the same results.

I've tried everything else I can think of like not having my stereo
monitor connected at the same time. I would dig in to the code but as
you have previously commented, everything *looks* fine, so I don't know
where to begin. I may just have to get a newer card but that wasn't an
investment I was planning to make just yet. :( Any further suggestions
are appreciated.

Regards,
James

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support
  2014-05-13 12:01                 ` James Le Cuirot
@ 2014-05-13 12:27                   ` Anssi Hannula
  2014-05-13 16:16                     ` James Le Cuirot
  0 siblings, 1 reply; 71+ messages in thread
From: Anssi Hannula @ 2014-05-13 12:27 UTC (permalink / raw)
  To: James Le Cuirot; +Cc: alsa-devel

Hi,

13.05.2014 15:01, James Le Cuirot kirjoitti:
>>>>>>>>>
>>>>>>>>> Hi Anssi. Many thanks for your work on this. I am very keen to
>>>>>>>>> test this new code but have so far been unsuccessful. I have a
>>>>>>>>> Radeon 4670 (Sapphire branded) connected to a Yamaha RX-V773.
>>>>>>>>> I am running the sound/for-next kernel (82755ab) with your
>>>>>>>>> "missing PCM SAD" patch applied.
>>>>>>>>>
[...]
> Guess it wasn't so "soon" after all. This dropped down my priority
> list and then my receiver blew up. I ended up getting the newer
> equivalent model, the RX-V775. Despite that, the problem persists,
> even on a current sound "master" kernel.
> 
> There has been a little change though. I now get an ELD. This shows
> what I would expect based on my receiver.
> 
> https://gist.github.com/chewi/7628058
> 
> I note that speaker-test doesn't allow me to specify -c6 anymore, only
> -c8. Maybe that's because of the ELD. I do have a kernel log but not to
> hand right now. It only seems to show what appears to be normal output
> anyway.
> 
> I was keen to try fglrx but realised I can't because this card is only
> supported by the legacy driver and that only works with kernels up to
> around 3.7.
> 
> I did try my wife's Ivy Bridge laptop and that worked straight away
> with no difficulties using the same HDMI cable so it seems that the
> receiver isn't to blame.
> 
> I wanted to rule my Gentoo system out so I booted with Ubuntu 14.04 on
> a USB stick and got exactly the same results.
> 
> I've tried everything else I can think of like not having my stereo
> monitor connected at the same time. I would dig in to the code but as
> you have previously commented, everything *looks* fine, so I don't know
> where to begin. I may just have to get a newer card but that wasn't an
> investment I was planning to make just yet. :( Any further suggestions
> are appreciated.

Unfortunately I've been told that HD 4xxx cards and older do not support
multichannel playback, which I didn't know at the time (and I had
forgotten your case, hence I didn't get back to you - sorry about that).

It is a bug that the driver allows the user to try to playback more than
2 channels on such cards as well, which I have in my TODO list to fix.
Thanks for the reminder, though I guess it doesn't help much with your
situation.

-- 
Anssi Hannula

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support
  2014-05-13 12:27                   ` Anssi Hannula
@ 2014-05-13 16:16                     ` James Le Cuirot
  2014-05-13 21:10                       ` James Le Cuirot
  0 siblings, 1 reply; 71+ messages in thread
From: James Le Cuirot @ 2014-05-13 16:16 UTC (permalink / raw)
  To: Anssi Hannula; +Cc: alsa-devel

On Tue, 13 May 2014 15:27:47 +0300
Anssi Hannula <anssi.hannula@iki.fi> wrote:

> Unfortunately I've been told that HD 4xxx cards and older do not
> support multichannel playback, which I didn't know at the time (and I
> had forgotten your case, hence I didn't get back to you - sorry about
> that).

Thank you for the quick reply. I'm not sure whether that's strictly
true. Wikipedia (though not always correct, I grant you) states that:

"The RV770 series GPU also supports xvYCC color space output and 7.1
surround sound output (LPCM, AC3, DTS) over HDMI."

http://en.wikipedia.org/wiki/Radeon_HD_4000_Series#Multimedia_features

The HD 4670 has the RV730XT chip. It isn't clear in the above statement
whether it is referring to the higher models in the range or the range
as a whole, given that the RV770 is the foundation chip. Based on my
experiences and what you have heard, it's probably the former. This
news piece at AnandTech also seems to back it up.

"All of AMD's Radeon HD graphics cards have shipped with their own
audio codec, but the Radeon HD 4800 series of cards finally adds
support for 8-channel LPCM output over HDMI."

http://www.anandtech.com/show/2556

Looks like a new card for me then. Thanks for your help.

Regards,
James

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support
  2014-05-13 16:16                     ` James Le Cuirot
@ 2014-05-13 21:10                       ` James Le Cuirot
  2014-05-13 21:50                         ` Anssi Hannula
  0 siblings, 1 reply; 71+ messages in thread
From: James Le Cuirot @ 2014-05-13 21:10 UTC (permalink / raw)
  To: James Le Cuirot; +Cc: Anssi Hannula, alsa-devel

On Tue, 13 May 2014 17:16:17 +0100
James Le Cuirot <chewi@aura-online.co.uk> wrote:

> On Tue, 13 May 2014 15:27:47 +0300
> Anssi Hannula <anssi.hannula@iki.fi> wrote:
> 
> > Unfortunately I've been told that HD 4xxx cards and older do not
> > support multichannel playback, which I didn't know at the time (and
> > I had forgotten your case, hence I didn't get back to you - sorry
> > about that).
> 
> Thank you for the quick reply. I'm not sure whether that's strictly
> true. Wikipedia (though not always correct, I grant you) states that:
> 
> "The RV770 series GPU also supports xvYCC color space output and 7.1
> surround sound output (LPCM, AC3, DTS) over HDMI."
> 
> http://en.wikipedia.org/wiki/Radeon_HD_4000_Series#Multimedia_features
> 
> The HD 4670 has the RV730XT chip. It isn't clear in the above
> statement whether it is referring to the higher models in the range
> or the range as a whole, given that the RV770 is the foundation chip.
> Based on my experiences and what you have heard, it's probably the
> former. This news piece at AnandTech also seems to back it up.
> 
> "All of AMD's Radeon HD graphics cards have shipped with their own
> audio codec, but the Radeon HD 4800 series of cards finally adds
> support for 8-channel LPCM output over HDMI."
> 
> http://www.anandtech.com/show/2556
> 
> Looks like a new card for me then. Thanks for your help.

Aaaand after all that, I dig out the box for the old card to get ready
to sell it and what do I see printed on the front? 7.1 Channel Sound!
The box looks almost identical to this one:

http://www.overclockers.ua/video/ati-radeon-hd4670-ddr4/01-ati-radeon-hd4670-sapphire.jpg

This is very confusing. Any thoughts?

Regards,
James

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support
  2014-05-13 21:10                       ` James Le Cuirot
@ 2014-05-13 21:50                         ` Anssi Hannula
  2014-05-14 13:04                           ` Deucher, Alexander
  0 siblings, 1 reply; 71+ messages in thread
From: Anssi Hannula @ 2014-05-13 21:50 UTC (permalink / raw)
  To: Alex Deucher; +Cc: alsa-devel, James Le Cuirot

Hi Alex,

14.05.2014 00:10, James Le Cuirot kirjoitti:
> On Tue, 13 May 2014 17:16:17 +0100
> James Le Cuirot <chewi@aura-online.co.uk> wrote:
> 
>> On Tue, 13 May 2014 15:27:47 +0300
>> Anssi Hannula <anssi.hannula@iki.fi> wrote:
>>
>>> Unfortunately I've been told that HD 4xxx cards and older do not
>>> support multichannel playback, which I didn't know at the time (and
>>> I had forgotten your case, hence I didn't get back to you - sorry
>>> about that).
>>
>> Thank you for the quick reply. I'm not sure whether that's strictly
>> true. Wikipedia (though not always correct, I grant you) states that:
>>
>> "The RV770 series GPU also supports xvYCC color space output and 7.1
>> surround sound output (LPCM, AC3, DTS) over HDMI."
>>
>> http://en.wikipedia.org/wiki/Radeon_HD_4000_Series#Multimedia_features
>>
>> The HD 4670 has the RV730XT chip. It isn't clear in the above
>> statement whether it is referring to the higher models in the range
>> or the range as a whole, given that the RV770 is the foundation chip.
>> Based on my experiences and what you have heard, it's probably the
>> former. This news piece at AnandTech also seems to back it up.
>>
>> "All of AMD's Radeon HD graphics cards have shipped with their own
>> audio codec, but the Radeon HD 4800 series of cards finally adds
>> support for 8-channel LPCM output over HDMI."
>>
>> http://www.anandtech.com/show/2556
>>
>> Looks like a new card for me then. Thanks for your help.
> 
> Aaaand after all that, I dig out the box for the old card to get ready
> to sell it and what do I see printed on the front? 7.1 Channel Sound!
> The box looks almost identical to this one:
> 
> http://www.overclockers.ua/video/ati-radeon-hd4670-ddr4/01-ati-radeon-hd4670-sapphire.jpg
> 
> This is very confusing. Any thoughts?

Alex, you told me in IRC some time ago that pre-DCE4 cards do no support
multi-channel PCM. Do you know what is going on above?
AFAIU James has HD 4670, which is RV730 and therefore has DCE3.2 only,
but seems like it should still have multi-channel support.

Multichannel LPCM support seems to be corroborated by various other
sources as well, e.g.
http://www.avsforum.com/t/1029603/ati-radeon-hd-4600-4800-series-support-7-1-channel-hdmi-audio#user_ATIHDMIDriver

It doesn't appear to work, though. Is it possible some of those early
cards had some other way of getting multichannel LPCM?
Looks like the above forum post directs people to use a "ATI HDMI Audio
Device" driver from Realtek for Vista/7...
(
http://www.realtek.com.tw/downloads/downloadsView.aspx?Langid=1&PNid=24&PFid=24&Level=4&Conn=3&DownTypeID=3&GetDown=false
)

-- 
Anssi Hannula

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support
  2014-05-13 21:50                         ` Anssi Hannula
@ 2014-05-14 13:04                           ` Deucher, Alexander
  2014-05-14 13:19                             ` James Le Cuirot
  0 siblings, 1 reply; 71+ messages in thread
From: Deucher, Alexander @ 2014-05-14 13:04 UTC (permalink / raw)
  To: Anssi Hannula; +Cc: alsa-devel, James Le Cuirot

> -----Original Message-----
> From: Anssi Hannula [mailto:anssi.hannula@iki.fi]
> Sent: Tuesday, May 13, 2014 5:51 PM
> To: Deucher, Alexander
> Cc: James Le Cuirot; alsa-devel@alsa-project.org
> Subject: Re: [alsa-devel] [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-
> channel and HBR support
> 
> Hi Alex,
> 
> 14.05.2014 00:10, James Le Cuirot kirjoitti:
> > On Tue, 13 May 2014 17:16:17 +0100
> > James Le Cuirot <chewi@aura-online.co.uk> wrote:
> >
> >> On Tue, 13 May 2014 15:27:47 +0300
> >> Anssi Hannula <anssi.hannula@iki.fi> wrote:
> >>
> >>> Unfortunately I've been told that HD 4xxx cards and older do not
> >>> support multichannel playback, which I didn't know at the time (and
> >>> I had forgotten your case, hence I didn't get back to you - sorry
> >>> about that).
> >>
> >> Thank you for the quick reply. I'm not sure whether that's strictly
> >> true. Wikipedia (though not always correct, I grant you) states that:
> >>
> >> "The RV770 series GPU also supports xvYCC color space output and 7.1
> >> surround sound output (LPCM, AC3, DTS) over HDMI."
> >>
> >>
> http://en.wikipedia.org/wiki/Radeon_HD_4000_Series#Multimedia_feature
> s
> >>
> >> The HD 4670 has the RV730XT chip. It isn't clear in the above
> >> statement whether it is referring to the higher models in the range
> >> or the range as a whole, given that the RV770 is the foundation chip.
> >> Based on my experiences and what you have heard, it's probably the
> >> former. This news piece at AnandTech also seems to back it up.
> >>
> >> "All of AMD's Radeon HD graphics cards have shipped with their own
> >> audio codec, but the Radeon HD 4800 series of cards finally adds
> >> support for 8-channel LPCM output over HDMI."
> >>
> >> http://www.anandtech.com/show/2556
> >>
> >> Looks like a new card for me then. Thanks for your help.
> >
> > Aaaand after all that, I dig out the box for the old card to get ready
> > to sell it and what do I see printed on the front? 7.1 Channel Sound!
> > The box looks almost identical to this one:
> >
> > http://www.overclockers.ua/video/ati-radeon-hd4670-ddr4/01-ati-
> radeon-hd4670-sapphire.jpg
> >
> > This is very confusing. Any thoughts?
> 
> Alex, you told me in IRC some time ago that pre-DCE4 cards do no support
> multi-channel PCM. Do you know what is going on above?
> AFAIU James has HD 4670, which is RV730 and therefore has DCE3.2 only,
> but seems like it should still have multi-channel support.
> 
> Multichannel LPCM support seems to be corroborated by various other
> sources as well, e.g.
> http://www.avsforum.com/t/1029603/ati-radeon-hd-4600-4800-series-
> support-7-1-channel-hdmi-audio#user_ATIHDMIDriver
> 
> It doesn't appear to work, though. Is it possible some of those early
> cards had some other way of getting multichannel LPCM?

Does it work with a 3.15 kernel?  It looks like DCE3.1  (RV770) and 3.2 (RV7xx) systems may support multichannel LPCM.  IIRC, setting the SADs was disabled in older kernels since it seemed to cause problems on some systems, but it's been re-enabled in 3.15.

Alex

> Looks like the above forum post directs people to use a "ATI HDMI Audio
> Device" driver from Realtek for Vista/7...
> (
> http://www.realtek.com.tw/downloads/downloadsView.aspx?Langid=1&PN
> id=24&PFid=24&Level=4&Conn=3&DownTypeID=3&GetDown=false
> )
> 
> --
> Anssi Hannula

^ permalink raw reply	[flat|nested] 71+ messages in thread

* Re: [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support
  2014-05-14 13:04                           ` Deucher, Alexander
@ 2014-05-14 13:19                             ` James Le Cuirot
  0 siblings, 0 replies; 71+ messages in thread
From: James Le Cuirot @ 2014-05-14 13:19 UTC (permalink / raw)
  To: Deucher, Alexander; +Cc: Anssi Hannula, alsa-devel

On Wed, 14 May 2014 13:04:13 +0000
"Deucher, Alexander" <Alexander.Deucher@amd.com> wrote:

> > -----Original Message-----
> > From: Anssi Hannula [mailto:anssi.hannula@iki.fi]
> > Sent: Tuesday, May 13, 2014 5:51 PM
> > To: Deucher, Alexander
> > Cc: James Le Cuirot; alsa-devel@alsa-project.org
> > Subject: Re: [alsa-devel] [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD
> > multi- channel and HBR support
> > 
> > Hi Alex,
> > 
> > 14.05.2014 00:10, James Le Cuirot kirjoitti:  
> > > On Tue, 13 May 2014 17:16:17 +0100
> > > James Le Cuirot <chewi@aura-online.co.uk> wrote:
> > >  
> > >> On Tue, 13 May 2014 15:27:47 +0300
> > >> Anssi Hannula <anssi.hannula@iki.fi> wrote:
> > >>  
> > >>> Unfortunately I've been told that HD 4xxx cards and older do not
> > >>> support multichannel playback, which I didn't know at the time
> > >>> (and I had forgotten your case, hence I didn't get back to you
> > >>> - sorry about that).  
> > >>
> > >> Thank you for the quick reply. I'm not sure whether that's
> > >> strictly true. Wikipedia (though not always correct, I grant
> > >> you) states that:
> > >>
> > >> "The RV770 series GPU also supports xvYCC color space output and
> > >> 7.1 surround sound output (LPCM, AC3, DTS) over HDMI."
> > >>
> > >>  
> > http://en.wikipedia.org/wiki/Radeon_HD_4000_Series#Multimedia_feature
> > s  
> > >>
> > >> The HD 4670 has the RV730XT chip. It isn't clear in the above
> > >> statement whether it is referring to the higher models in the
> > >> range or the range as a whole, given that the RV770 is the
> > >> foundation chip. Based on my experiences and what you have
> > >> heard, it's probably the former. This news piece at AnandTech
> > >> also seems to back it up.
> > >>
> > >> "All of AMD's Radeon HD graphics cards have shipped with their
> > >> own audio codec, but the Radeon HD 4800 series of cards finally
> > >> adds support for 8-channel LPCM output over HDMI."
> > >>
> > >> http://www.anandtech.com/show/2556
> > >>
> > >> Looks like a new card for me then. Thanks for your help.  
> > >
> > > Aaaand after all that, I dig out the box for the old card to get
> > > ready to sell it and what do I see printed on the front? 7.1
> > > Channel Sound! The box looks almost identical to this one:
> > >
> > > http://www.overclockers.ua/video/ati-radeon-hd4670-ddr4/01-ati-  
> > radeon-hd4670-sapphire.jpg  
> > >
> > > This is very confusing. Any thoughts?  
> > 
> > Alex, you told me in IRC some time ago that pre-DCE4 cards do no
> > support multi-channel PCM. Do you know what is going on above?
> > AFAIU James has HD 4670, which is RV730 and therefore has DCE3.2
> > only, but seems like it should still have multi-channel support.
> > 
> > Multichannel LPCM support seems to be corroborated by various other
> > sources as well, e.g.
> > http://www.avsforum.com/t/1029603/ati-radeon-hd-4600-4800-series-
> > support-7-1-channel-hdmi-audio#user_ATIHDMIDriver
> > 
> > It doesn't appear to work, though. Is it possible some of those
> > early cards had some other way of getting multichannel LPCM?  
> 
> Does it work with a 3.15 kernel?  It looks like DCE3.1  (RV770) and
> 3.2 (RV7xx) systems may support multichannel LPCM.  IIRC, setting the
> SADs was disabled in older kernels since it seemed to cause problems
> on some systems, but it's been re-enabled in 3.15.

Hi Alex,

If you follow back up this thread, you'll see that I have tried a
recent sound "master" kernel (post 3.15-rc5) and I get this ELD.

https://gist.github.com/chewi/7628058

Also note that I am using the so-called "proprietary" DVI/HDMI adapter,
the HIS HHDMI4071, which I gather is required.

Regards,
James

^ permalink raw reply	[flat|nested] 71+ messages in thread

end of thread, other threads:[~2014-05-14 13:19 UTC | newest]

Thread overview: 71+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-24 18:10 [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support Anssi Hannula
2013-10-24 18:10 ` [PATCH 1/5] ALSA: hda - hdmi: Allow HDA patches to customize more operations Anssi Hannula
2013-10-24 18:10 ` [PATCH 2/5] ALSA: hda - hdmi: Add ATI/AMD multi-channel audio support Anssi Hannula
2013-10-24 18:10 ` [PATCH 3/5] ALSA: hda - hdmi: Add ELD emulation for ATI/AMD codecs Anssi Hannula
2013-10-24 18:10 ` [PATCH 4/5] ALSA: hda - hdmi: Add HBR bitstreaming support for ATI/AMD HDMI codecs Anssi Hannula
2013-10-24 18:10 ` [PATCH 5/5] ALSA: hda - hdmi: Disable ramp-up/down for non-PCM on AMD codecs Anssi Hannula
2013-10-24 19:00   ` Anssi Hannula
2013-10-24 18:26 ` [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support Anssi Hannula
2013-11-08  5:08   ` Olivier Langlois
2013-11-08 10:27     ` Anssi Hannula
2013-11-08 18:17       ` Olivier Langlois
2013-11-08 21:28         ` Olivier Langlois
2013-11-08 22:03           ` Anssi Hannula
2013-11-10  5:42             ` Olivier Langlois
2013-11-10  6:01               ` Anssi Hannula
2013-11-10  7:25                 ` speaker-test chmap bugs (was: [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support) Anssi Hannula
2013-11-10 18:29                   ` [PATCH 1/3] speaker-test: Fix chmapped channel selection without specified chmap Anssi Hannula
2013-11-10 18:29                     ` [PATCH 2/3] speaker-test: Always show chmap channel names if available Anssi Hannula
2013-11-10 18:29                     ` [PATCH 3/3] speaker-test: Show out-of-chmap channels as Unknown Anssi Hannula
2013-11-11 15:56                     ` [PATCH 1/3] speaker-test: Fix chmapped channel selection without specified chmap Takashi Iwai
2013-11-11 20:23                       ` Anssi Hannula
2013-11-11 22:04                         ` [PATCH 1/3 v2] " Anssi Hannula
2013-11-12  8:11                           ` Takashi Iwai
2013-11-12 12:34                             ` Anssi Hannula
2013-11-12 13:08                               ` Takashi Iwai
2013-11-12  6:35                 ` [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support Olivier Langlois
2013-11-14  0:04                   ` Anssi Hannula
2013-11-09  8:35         ` Takashi Iwai
2013-10-24 23:04 ` Takashi Iwai
2013-10-25 16:54   ` Andre Heider
2013-10-25 17:13     ` Takashi Iwai
2013-10-25 17:23     ` Anssi Hannula
2013-10-25 18:25       ` Andre Heider
2013-10-28 17:52       ` Andre Heider
2013-10-28 18:12         ` Anssi Hannula
2013-10-28 18:17           ` Andre Heider
2013-10-28 18:25             ` Anssi Hannula
2013-10-28 18:35               ` Andre Heider
2013-10-28 20:35                 ` Anssi Hannula
2013-10-28 22:00                   ` Andre Heider
2013-10-28 22:42                     ` Anssi Hannula
2013-10-28 23:15                       ` Andre Heider
2013-10-29 19:52                         ` LANGLOIS Olivier PIS -EXT
2013-10-29 20:30                           ` Anssi Hannula
2013-10-28 23:19                       ` [PATCH] drm/radeon/audio: fix missing multichannel PCM SAD in some cases Anssi Hannula
2013-10-31 23:38                         ` Rafał Miłecki
2013-10-31 23:46                           ` Rafał Miłecki
2013-10-31 23:52                           ` Anssi Hannula
2013-11-02  1:01                         ` Rafał Miłecki
2013-11-02  1:08                           ` Anssi Hannula
2013-11-02  1:15                             ` Rafał Miłecki
2013-11-02  1:03                         ` Rafał Miłecki
2013-11-02 15:32 ` [PATCH v3 0/5] ALSA: hda - hdmi: ATI/AMD multi-channel and HBR support Anssi Hannula
2013-11-23  1:05 ` James Le Cuirot
2013-11-23  1:29   ` Anssi Hannula
2013-11-23 15:40     ` James Le Cuirot
2013-11-23 15:45       ` Anssi Hannula
2013-11-24 14:57         ` James Le Cuirot
2013-11-25 13:20           ` Anssi Hannula
2013-11-25 14:32             ` James Le Cuirot
2013-11-25 14:56               ` Anssi Hannula
2014-05-13 12:01                 ` James Le Cuirot
2014-05-13 12:27                   ` Anssi Hannula
2014-05-13 16:16                     ` James Le Cuirot
2014-05-13 21:10                       ` James Le Cuirot
2014-05-13 21:50                         ` Anssi Hannula
2014-05-14 13:04                           ` Deucher, Alexander
2014-05-14 13:19                             ` James Le Cuirot
2013-11-25 15:07   ` Raymond Yau
2013-11-25 15:32     ` James Le Cuirot
2013-11-25 19:35     ` Anssi Hannula

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.