Skip to contentSkip to conversation

You guessed it, it's generic parser patches

PATCH Applied David Henningsson 2 participants 5 messages Jan 18, 2013 Sound

lore
Share & tools
lore
#0 lore raw

cover You guessed it, it's generic parser patches

The third one seems to apply to the regular sound tree too.

David Henningsson (3):
ALSA: hda - make sure there are enough input labels and paths
ALSA: hda - don't compare with yourself in fill_input_pin_labels
ALSA: hda - Don't add unnecessary indices on HDMI and SPDIF

 sound/pci/hda/hda_auto_parser.c |   22 ++++++++++++----------
 sound/pci/hda/hda_generic.c     |    4 ++--
 sound/pci/hda/hda_generic.h     |    6 +++---
 3 files changed, 17 insertions(+), 15 deletions(-)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/3 ALSA: hda - make sure there are enough input labels and paths

I found a codec configuration which had six inputs, so the max of five was not appropriate.

---
 sound/pci/hda/hda_generic.c |    2 +-
 sound/pci/hda/hda_generic.h |    6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)
sound/pci/hda/hda_generic.c +1 -1
index cadfe65..13e13df 100644
@@ -2649,7 +2649,7 @@ static struct nid_path *get_input_path(struct hda_codec *codec, int adc_idx, int
 	}
 	if (spec->dyn_adc_switch)
 		adc_idx = spec->dyn_adc_idx[imux_idx];
-	if (adc_idx < 0 || adc_idx >= AUTO_CFG_MAX_OUTS) {
+	if (adc_idx < 0 || adc_idx >= AUTO_CFG_MAX_INS) {
 		snd_BUG();
 		return NULL;
 	}
sound/pci/hda/hda_generic.h +3 -3
index f6b88cd..94bf4bc 100644
@@ -105,8 +105,8 @@ struct hda_gen_spec {
 	hda_nid_t adc_nids[AUTO_CFG_MAX_OUTS];
 	hda_nid_t dig_in_nid;		/* digital-in NID; optional */
 	hda_nid_t mixer_nid;		/* analog-mixer NID */
-	const char *input_labels[AUTO_CFG_MAX_OUTS];
-	int input_label_idxs[AUTO_CFG_MAX_OUTS];
+	const char *input_labels[AUTO_CFG_MAX_INS];
+	int input_label_idxs[AUTO_CFG_MAX_INS];
 
 	/* capture setup for dynamic dual-adc switch */
 	hda_nid_t cur_adc;
@@ -159,7 +159,7 @@ struct hda_gen_spec {
 	int speaker_paths[AUTO_CFG_MAX_OUTS];
 	int aamix_out_paths[3];
 	int digout_paths[AUTO_CFG_MAX_OUTS];
-	int input_paths[HDA_MAX_NUM_INPUTS][AUTO_CFG_MAX_OUTS];
+	int input_paths[HDA_MAX_NUM_INPUTS][AUTO_CFG_MAX_INS];
 	int loopback_paths[HDA_MAX_NUM_INPUTS];
 	int digin_path;
 
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 2/3 ALSA: hda - don't compare with yourself in fill_input_pin_labels

In reply to David Henningsson

Just stumbled over this one while reading the code.

---
 sound/pci/hda/hda_generic.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
sound/pci/hda/hda_generic.c +1 -1
index 13e13df..a5b87c5 100644
@@ -2555,7 +2555,7 @@ static int fill_input_pin_labels(struct hda_codec *codec)
 
 		label = hda_get_autocfg_input_label(codec, cfg, i);
 		idx = 0;
-		for (j = i; j >= 0; j--) {
+		for (j = i-1; j >= 0; j--) {
 			if (spec->input_labels[j] &&
 			    !strcmp(spec->input_labels[j], label)) {
 				idx = spec->input_label_idxs[j] + 1;
Signature · 1 line
1.7.9.5
#3 lore raw

PATCH 3/3 ALSA: hda - Don't add unnecessary indices on HDMI and SPDIF

In reply to David Henningsson

If there's one each of HDMI and SPDIF, we should not add an index on the one that comes second.

---
 sound/pci/hda/hda_auto_parser.c |   22 ++++++++++++----------
 1 file changed, 12 insertions(+), 10 deletions(-)
sound/pci/hda/hda_auto_parser.c +12 -10
index a4810c7..dcb6575 100644
@@ -603,6 +603,7 @@ int snd_hda_get_pin_label(struct hda_codec *codec, hda_nid_t nid,
 	unsigned int def_conf = snd_hda_codec_get_pincfg(codec, nid);
 	const char *name = NULL;
 	int i;
+	bool hdmi;
 
 	if (indexp)
 		*indexp = 0;
@@ -621,16 +622,17 @@ int snd_hda_get_pin_label(struct hda_codec *codec, hda_nid_t nid,
 					   label, maxlen, indexp);
 	case AC_JACK_SPDIF_OUT:
 	case AC_JACK_DIG_OTHER_OUT:
-		if (get_defcfg_location(def_conf) == AC_JACK_LOC_HDMI)
-			name = "HDMI";
-		else
-			name = "SPDIF";
-		if (cfg && indexp) {
-			i = find_idx_in_nid_list(nid, cfg->dig_out_pins,
-						 cfg->dig_outs);
-			if (i >= 0)
-				*indexp = i;
-		}
+		hdmi = get_defcfg_location(def_conf) == AC_JACK_LOC_HDMI;
+		name = hdmi ? "HDMI" : "SPDIF";
+		if (cfg && indexp)
+			for (i = 0; i < cfg->dig_outs; i++) {
+				unsigned int c;
+				if (cfg->dig_out_pins[i] == nid)
+					break;
+				c = snd_hda_codec_get_pincfg(codec, cfg->dig_out_pins[i]);
+				if (hdmi == (get_defcfg_location(c) == AC_JACK_LOC_HDMI))
+					(*indexp)++;
+			}
 		break;
 	default:
 		if (cfg) {
Signature · 1 line
1.7.9.5
Applied
#4 lore raw
In reply to David Henningsson

At Fri, 18 Jan 2013 15:43:00 +0100,

Quoted 7 lines · David Henningsson

The third one seems to apply to the regular sound tree too.

David Henningsson (3):
ALSA: hda - make sure there are enough input labels and paths
ALSA: hda - don't compare with yourself in fill_input_pin_labels
ALSA: hda - Don't add unnecessary indices on HDMI and SPDIF

Thanks, applied now (with a slight code refactoring in the third patch).

Takashi

Quoted 9 lines
 sound/pci/hda/hda_auto_parser.c |   22 ++++++++++++----------
 sound/pci/hda/hda_generic.c     |    4 ++--
 sound/pci/hda/hda_generic.h     |    6 +++---
 3 files changed, 17 insertions(+), 15 deletions(-)
Signature · 1 line
1.7.9.5