Skip to contentSkip to conversation

...and three more fixes for the new generic parser

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

lore
Share & tools
lore
#0 lore raw

cover ...and three more fixes for the new generic parser

These regressions were found when running the test tool over even more alsa-infos.

Btw, would you mind updating the hda-migrate branch too? It's useful to have your latest fixes from the hda-gen-parser branch when I'm running pre-release QA testing.

David Henningsson (3):
ALSA: hda - do not add non-existing Mic boost controls
ALSA: hda - force different capture controls if amp caps differ
ALSA: hda - Make sure fill_all_dac_nids is called for digital only
codecs

 sound/pci/hda/hda_generic.c |   31 ++++++++++++++++++++++++++-----
 1 file changed, 26 insertions(+), 5 deletions(-)
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/3 ALSA: hda - do not add non-existing Mic boost controls

If the input node does not have any volume capable input amp, don't add such a control.

---
 sound/pci/hda/hda_generic.c |    3 +++
 1 file changed, 3 insertions(+)
sound/pci/hda/hda_generic.c +3 -0
index 3ef38da..72325a9 100644
@@ -2820,6 +2820,9 @@ static int parse_mic_boost(struct hda_codec *codec)
 			struct nid_path *path;
 			unsigned int val;
 
+			if (!nid_has_volume(codec, nid, HDA_INPUT))
+				continue;
+
 			label = hda_get_autocfg_input_label(codec, cfg, i);
 			if (prev_label && !strcmp(label, prev_label))
 				type_idx++;
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH 2/3 ALSA: hda - force different capture controls if amp caps differ

In reply to David Henningsson

Otherwise setting the capture volume for amps will be weird and inconsistent (it will try to set values outside the range of the second amp based on capabilities of the first amp).

---
 sound/pci/hda/hda_generic.c |   24 +++++++++++++++++++++---
 1 file changed, 21 insertions(+), 3 deletions(-)
sound/pci/hda/hda_generic.c +21 -3
index 72325a9..a05cbab 100644
@@ -484,6 +484,15 @@ static bool check_amp_caps(struct hda_codec *codec, hda_nid_t nid,
 	return false;
 }
 
+static bool same_amp_caps(struct hda_codec *codec, hda_nid_t nid1,
+			  hda_nid_t nid2, int dir)
+{
+	if (!(get_wcaps(codec, nid1) & (1 << (dir + 1))))
+		return !(get_wcaps(codec, nid2) & (1 << (dir + 1)));
+	return (query_amp_caps(codec, nid1, dir) ==
+		query_amp_caps(codec, nid2, dir));
+}
+
 #define nid_has_mute(codec, nid, dir) \
 	check_amp_caps(codec, nid, dir, AC_AMPCAP_MUTE)
 #define nid_has_volume(codec, nid, dir) \
@@ -2762,6 +2771,7 @@ static int create_capture_mixers(struct hda_codec *codec)
 
 	for (n = 0; n < nums; n++) {
 		bool multi = false;
+		bool multi_cap_vol = spec->multi_cap_vol;
 		bool inv_dmic = false;
 		int vol, sw;
 
@@ -2774,12 +2784,20 @@ static int create_capture_mixers(struct hda_codec *codec)
 			parse_capvol_in_path(codec, path);
 			if (!vol)
 				vol = path->ctls[NID_PATH_VOL_CTL];
-			else if (vol != path->ctls[NID_PATH_VOL_CTL])
+			else if (vol != path->ctls[NID_PATH_VOL_CTL]) {
 				multi = true;
+				if (!same_amp_caps(codec, vol,
+				    path->ctls[NID_PATH_VOL_CTL], HDA_INPUT))
+					multi_cap_vol = true;
+			}
 			if (!sw)
 				sw = path->ctls[NID_PATH_MUTE_CTL];
-			else if (sw != path->ctls[NID_PATH_MUTE_CTL])
+			else if (sw != path->ctls[NID_PATH_MUTE_CTL]) {
 				multi = true;
+				if (!same_amp_caps(codec, sw,
+				    path->ctls[NID_PATH_MUTE_CTL], HDA_INPUT))
+					multi_cap_vol = true;
+			}
 			if (is_inv_dmic_pin(codec, spec->imux_pins[i]))
 				inv_dmic = true;
 		}
@@ -2787,7 +2805,7 @@ static int create_capture_mixers(struct hda_codec *codec)
 		if (!multi)
 			err = create_single_cap_vol_ctl(codec, n, vol, sw,
 							inv_dmic);
-		else if (!spec->multi_cap_vol)
+		else if (!multi_cap_vol)
 			err = create_bind_cap_vol_ctl(codec, n, vol, sw);
 		else
 			err = create_multi_cap_vol_ctl(codec);
Signature · 1 line
1.7.9.5
#3 lore raw

PATCH 3/3 ALSA: hda - Make sure fill_all_dac_nids is called for digital only codecs

In reply to David Henningsson

Otherwise no PCM will be built for codecs without analog I/O.

---
 sound/pci/hda/hda_generic.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
sound/pci/hda/hda_generic.c +2 -2
index a05cbab..e671c77 100644
@@ -1510,8 +1510,6 @@ static int parse_output_paths(struct hda_codec *codec)
 	bool best_wired = true, best_mio = true;
 	bool hp_spk_swapped = false;
 
-	fill_all_dac_nids(codec);
-
 	best_cfg = kmalloc(sizeof(*best_cfg), GFP_KERNEL);
 	if (!best_cfg)
 		return -ENOMEM;
@@ -3422,6 +3420,8 @@ int snd_hda_gen_parse_auto_config(struct hda_codec *codec,
 		cfg = &spec->autocfg;
 	}
 
+	fill_all_dac_nids(codec);
+
 	if (!cfg->line_outs) {
 		if (cfg->dig_outs || cfg->dig_in_pin) {
 			spec->multiout.max_channels = 2;
Signature · 1 line
1.7.9.5
Applied
#4 lore raw
In reply to David Henningsson

At Wed, 16 Jan 2013 15:58:42 +0100,

Quoted 3 lines · David Henningsson

These regressions were found when running the test tool over even more alsa-infos.

Thanks, applied now.

Quoted 3 lines

Btw, would you mind updating the hda-migrate branch too? It's useful to have your latest fixes from the hda-gen-parser branch when I'm running pre-release QA testing.

OK, done.

Takashi

Quoted 12 lines

David Henningsson (3):
ALSA: hda - do not add non-existing Mic boost controls
ALSA: hda - force different capture controls if amp caps differ
ALSA: hda - Make sure fill_all_dac_nids is called for digital only
codecs

 sound/pci/hda/hda_generic.c |   31 ++++++++++++++++++++++++++-----
 1 file changed, 26 insertions(+), 5 deletions(-)
Signature · 1 line
1.7.9.5