alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: alsa-devel@alsa-project.org
Subject: [PATCH 077/112] ALSA: hda - Define HDA_PARSE_* for snd_hda_parse_nid_path() argument
Date: Tue,  8 Jan 2013 12:39:10 +0100	[thread overview]
Message-ID: <1357645185-7645-78-git-send-email-tiwai@suse.de> (raw)
In-Reply-To: <1357645185-7645-1-git-send-email-tiwai@suse.de>

... instead of numbers.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/hda/hda_generic.c | 28 +++++++++++++++-------------
 sound/pci/hda/hda_generic.h |  7 +++++++
 2 files changed, 22 insertions(+), 13 deletions(-)

diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
index b341450..18b5fae 100644
--- a/sound/pci/hda/hda_generic.c
+++ b/sound/pci/hda/hda_generic.c
@@ -211,9 +211,9 @@ static bool __parse_nid_path(struct hda_codec *codec,
 	int i, nums;
 
 	if (to_nid == spec->mixer_nid) {
-		if (!with_aa_mix)
+		if (with_aa_mix == HDA_PARSE_NO_AAMIX)
 			return false;
-		with_aa_mix = 2; /* mark aa-mix is included */
+		with_aa_mix = HDA_PARSE_ALL; /* mark aa-mix is included */
 	}
 
 	nums = snd_hda_get_connections(codec, to_nid, conn, ARRAY_SIZE(conn));
@@ -228,7 +228,7 @@ static bool __parse_nid_path(struct hda_codec *codec,
 				continue;
 		}
 		/* aa-mix is requested but not included? */
-		if (!(spec->mixer_nid && with_aa_mix == 1))
+		if (!(spec->mixer_nid && with_aa_mix == HDA_PARSE_ONLY_AAMIX))
 			goto found;
 	}
 	if (depth >= MAX_NID_PATH_DEPTH)
@@ -256,9 +256,11 @@ static bool __parse_nid_path(struct hda_codec *codec,
 
 /* parse the widget path from the given nid to the target nid;
  * when @from_nid is 0, try to find an empty DAC;
- * when @with_aa_mix is 0, paths with spec->mixer_nid are excluded.
- * when @with_aa_mix is 1, paths without spec->mixer_nid are excluded.
- * when @with_aa_mix is 2, no special handling about spec->mixer_nid.
+ * when @with_aa_mix is HDA_PARSE_NO_AAMIX, paths with spec->mixer_nid are
+ * excluded, only the paths that don't go through the mixer will be chosen.
+ * when @with_aa_mix is HDA_PARSE_ONLY_AAMIX, only the paths going through
+ * spec->mixer_nid will be chosen.
+ * when @with_aa_mix is HDA_PARSE_ALL, no special handling about mixer widget.
  */
 bool snd_hda_parse_nid_path(struct hda_codec *codec, hda_nid_t from_nid,
 			    hda_nid_t to_nid, int with_aa_mix,
@@ -861,7 +863,7 @@ static int try_assign_dacs(struct hda_codec *codec, int num_outs,
 			else
 				badness += bad->no_dac;
 		}
-		path = snd_hda_add_new_path(codec, dac, pin, 0);
+		path = snd_hda_add_new_path(codec, dac, pin, HDA_PARSE_NO_AAMIX);
 		if (!path)
 			dac = dacs[i] = 0;
 		else
@@ -977,7 +979,7 @@ static int fill_multi_ios(struct hda_codec *codec,
 				badness++;
 				continue;
 			}
-			path = snd_hda_add_new_path(codec, dac, nid, 0);
+			path = snd_hda_add_new_path(codec, dac, nid, HDA_PARSE_NO_AAMIX);
 			if (!path) {
 				badness++;
 				continue;
@@ -1028,7 +1030,7 @@ static bool map_singles(struct hda_codec *codec, int outs,
 		dac = get_dac_if_single(codec, pins[i]);
 		if (!dac)
 			continue;
-		path = snd_hda_add_new_path(codec, dac, pins[i], 0);
+		path = snd_hda_add_new_path(codec, dac, pins[i], HDA_PARSE_NO_AAMIX);
 		if (path) {
 			dacs[i] = dac;
 			found = true;
@@ -1677,7 +1679,7 @@ static int new_analog_input(struct hda_codec *codec, hda_nid_t pin,
 	    !nid_has_mute(codec, mix_nid, HDA_INPUT))
 		return 0; /* no need for analog loopback */
 
-	path = snd_hda_add_new_path(codec, pin, mix_nid, 2);
+	path = snd_hda_add_new_path(codec, pin, mix_nid, HDA_PARSE_ALL);
 	if (!path)
 		return -EINVAL;
 	print_nid_path("loopback", path);
@@ -1851,7 +1853,7 @@ static int create_input_ctls(struct hda_codec *codec)
 			if (!path)
 				return -ENOMEM;
 			memset(path, 0, sizeof(*path));
-			if (!snd_hda_parse_nid_path(codec, pin, adc, 2, path)) {
+			if (!snd_hda_parse_nid_path(codec, pin, adc, HDA_PARSE_ALL, path)) {
 				snd_printd(KERN_ERR
 					   "invalid input path 0x%x -> 0x%x\n",
 					   pin, adc);
@@ -2329,7 +2331,7 @@ static void parse_digital(struct hda_codec *codec)
 		dig_nid = look_for_dac(codec, pin, true);
 		if (!dig_nid)
 			continue;
-		path = snd_hda_add_new_path(codec, dig_nid, pin, 2);
+		path = snd_hda_add_new_path(codec, dig_nid, pin, HDA_PARSE_ALL);
 		if (!path)
 			continue;
 		print_nid_path("digout", path);
@@ -2355,7 +2357,7 @@ static void parse_digital(struct hda_codec *codec)
 				continue;
 			path = snd_hda_add_new_path(codec,
 						    spec->autocfg.dig_in_pin,
-						    dig_nid, 2);
+						    dig_nid, HDA_PARSE_ALL);
 			if (path) {
 				print_nid_path("digin", path);
 				path->active = true;
diff --git a/sound/pci/hda/hda_generic.h b/sound/pci/hda/hda_generic.h
index 6365140..85d138f 100644
--- a/sound/pci/hda/hda_generic.h
+++ b/sound/pci/hda/hda_generic.h
@@ -180,6 +180,13 @@ int snd_hda_gen_init(struct hda_codec *codec);
 
 struct nid_path *snd_hda_get_nid_path(struct hda_codec *codec,
 				      hda_nid_t from_nid, hda_nid_t to_nid);
+
+enum {
+	HDA_PARSE_NO_AAMIX,
+	HDA_PARSE_ONLY_AAMIX,
+	HDA_PARSE_ALL,
+};
+
 bool snd_hda_parse_nid_path(struct hda_codec *codec, hda_nid_t from_nid,
 			    hda_nid_t to_nid, int with_aa_mix,
 			    struct nid_path *path);
-- 
1.8.0.1

  parent reply	other threads:[~2013-01-08 11:40 UTC|newest]

Thread overview: 123+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-08 11:37 [PATCH RFC 000/112] HD-audio generic parser improvements Takashi Iwai
2013-01-08 11:37 ` [PATCH 001/112] ALSA: hda/realtek - Simplify alc_auto_is_dac_reachable() Takashi Iwai
2013-01-08 11:37 ` [PATCH 002/112] ALSA: hda/realtek - List up all available DACs Takashi Iwai
2013-01-08 11:37 ` [PATCH 003/112] ALSA: hda/realtek - Add output path parser Takashi Iwai
2013-01-08 11:37 ` [PATCH 004/112] ALSA: hda/realtek - Manage mixer controls in out_path list Takashi Iwai
2013-01-08 11:37 ` [PATCH 005/112] ALSA: hda - Fix mono amp values in proc output Takashi Iwai
2013-01-08 11:37 ` [PATCH 006/112] ALSA: hda/realtek - Reduce vol/mute ctl lookups at parsing codec Takashi Iwai
2013-01-08 11:38 ` [PATCH 007/112] ALSA: hda/realtek - Simplify the output volume initialization Takashi Iwai
2013-01-08 11:38 ` [PATCH 008/112] ALSA: hda/realtek - Make path->idx[] and path->multi[] consistent Takashi Iwai
2013-01-08 11:38 ` [PATCH 009/112] ALSA: hda/realtek - Parse input paths Takashi Iwai
2013-01-08 11:38 ` [PATCH 010/112] ALSA: hda/realtek - Parse analog loopback paths more generically Takashi Iwai
2013-01-08 11:38 ` [PATCH 011/112] ALSA: hda/realtek - Check amp capabilities of aa-mixer widget Takashi Iwai
2013-01-08 11:38 ` [PATCH 012/112] ALSA: hda/realtek - Fix initialization of input amps in output paths Takashi Iwai
2013-01-08 11:38 ` [PATCH 013/112] ALSA: hda - Remove snd_hda_codec_amp_update() call from patch_*.c Takashi Iwai
2013-01-08 11:38 ` [PATCH 014/112] ALSA: hda - Introduce cache & flush cmd / amp writes Takashi Iwai
2013-01-08 11:38 ` [PATCH 015/112] ALSA: hda - Introduce snd_hda_codec_amp_init*() Takashi Iwai
2013-01-08 11:38 ` [PATCH 016/112] ALSA: hda/realtek - Remove non-standard automute mode Takashi Iwai
2013-01-08 11:38 ` [PATCH 017/112] ALSA: hda/realtek - Add path active flag Takashi Iwai
2013-01-08 11:38 ` [PATCH 018/112] ALSA: hda/realtek - Consolidate is_reachable_path() Takashi Iwai
2013-01-08 11:38 ` [PATCH 019/112] ALSA: hda/realtek - Consolidate to a single path list Takashi Iwai
2013-01-08 11:38 ` [PATCH 020/112] ALSA: hda/realtek - Use path-based parser for digital outputs Takashi Iwai
2013-01-08 11:38 ` [PATCH 021/112] ALSA: hda/realtek - Rename get_out_path() to get_nid_path() Takashi Iwai
2013-01-08 11:38 ` [PATCH 022/112] ALSA: hda/realtek - Fix the initialization of pin amp-in Takashi Iwai
2013-01-08 11:38 ` [PATCH 023/112] ALSA: hda/realtek - Add missing initialization of multi-io routes Takashi Iwai
2013-01-08 11:38 ` [PATCH 024/112] ALSA: hda/realtek - Add boost volumes to path list Takashi Iwai
2013-01-08 11:38 ` [PATCH 025/112] ALSA: hda/realtek - Initialize loopback paths properly Takashi Iwai
2013-01-08 11:38 ` [PATCH 026/112] ALSA: hda/realtek - Don't change connection at path deactivation Takashi Iwai
2013-01-08 11:38 ` [PATCH 027/112] ALSA: hda/realtek - Make input path parser more generic Takashi Iwai
2013-01-08 11:38 ` [PATCH 028/112] ALSA: hda/realtek - Clean up some spec fields Takashi Iwai
2013-01-08 11:38 ` [PATCH 029/112] ALSA: hda/realtek - Remove superfluous input amp init Takashi Iwai
2013-01-08 11:38 ` [PATCH 030/112] ALSA: hda/realtek - Rename add_new_out_path() with add_new_nid_path() Takashi Iwai
2013-01-08 11:38 ` [PATCH 031/112] ALSA: hda/realtek - Parse digital input path Takashi Iwai
2013-01-08 11:38 ` [PATCH 032/112] ALSA: hda/realtek - Allow different pins for shared hp/mic vref check Takashi Iwai
2013-01-08 11:38 ` [PATCH 033/112] ALSA: hda/realtek - Drop auto_mic_valid_imux flag Takashi Iwai
2013-01-08 11:38 ` [PATCH 034/112] ALSA: hda/realtek - Remove unused fields and macro definitions Takashi Iwai
2013-01-08 11:38 ` [PATCH 035/112] ALSA: hda/realtek - Handle vmaster hook in the parser side Takashi Iwai
2013-01-08 11:38 ` [PATCH 036/112] ALSA: hda/realtek - Assign Master mixer when possible Takashi Iwai
2013-01-08 11:38 ` [PATCH 037/112] ALSA: hda/realtek - Merge a few split functions Takashi Iwai
2013-01-08 11:38 ` [PATCH 038/112] ALSA: hda/realtek - Allow passing name=NULL to alc_kcontrol_new() Takashi Iwai
2013-01-08 11:38 ` [PATCH 039/112] ALSA: hda/realtek - Allow multiple individual capture volume/switch controls Takashi Iwai
2013-01-08 11:38 ` [PATCH 040/112] ALSA: hda/realtek - Add conexant-style inverted dmic handling Takashi Iwai
2013-01-08 11:38 ` [PATCH 041/112] ALSA: hda - Move fixup code into struct hda_codec Takashi Iwai
2013-01-08 11:38 ` [PATCH 042/112] ALSA: hda/realtek - Fix split stereo dmic code Takashi Iwai
2013-01-08 11:38 ` [PATCH 043/112] ALSA: hda - Rearrange INPUT_PIN_ATTR_* Takashi Iwai
2013-01-08 11:38 ` [PATCH 044/112] ALSA: hda - More generic auto-mic switching for Realtek codecs Takashi Iwai
2013-01-10  0:41   ` Raymond Yau
2013-01-10 15:08     ` Takashi Iwai
2013-01-17  2:47       ` FF
2013-01-08 11:38 ` [PATCH 045/112] ALSA: hda/realtek - Remove redundant argument from alc_mux_select() Takashi Iwai
2013-01-08 11:38 ` [PATCH 046/112] ALSA: hda - Merge Realtek parser code to generic parser Takashi Iwai
2013-01-08 11:38 ` [PATCH 047/112] ALSA: hda - Add EAPD control " Takashi Iwai
2013-01-08 11:38 ` [PATCH 048/112] ALSA: hda - Export snd_hda_gen_add_kctl() Takashi Iwai
2013-01-08 11:38 ` [PATCH 049/112] ALSA: hda - Move the call of snd_hda_parse_pin_defcfg() from snd_hda_gen_parse_auto_config() Takashi Iwai
2013-01-08 11:38 ` [PATCH 050/112] ALSA: hda - Fix NULL dereference in snd_hda_gen_build_controls() Takashi Iwai
2013-01-08 11:38 ` [PATCH 051/112] ALSA: hda - Export standard jack event handlers for generic parser Takashi Iwai
2013-01-08 11:38 ` [PATCH 052/112] ALSA: hda - Use generic parser codes for Realtek driver Takashi Iwai
2013-01-08 11:38 ` [PATCH 053/112] ALSA: hda - Use "Capture Source" for single sources Takashi Iwai
2013-01-08 11:38 ` [PATCH 054/112] ALSA: hda - Allow one chance for zero NID in connection list Takashi Iwai
2013-01-08 11:38 ` [PATCH 055/112] ALSA: hda - Clear dirty flag upon cache write Takashi Iwai
2013-01-08 11:38 ` [PATCH 056/112] ALSA: hda - Clear cached_write flag in snd_hda_codec_resume_*() Takashi Iwai
2013-01-08 11:38 ` [PATCH 057/112] ALSA: hda - Check CORB overflow Takashi Iwai
2013-01-08 11:38 ` [PATCH 058/112] ALSA: hda - Flush dirty amp caches before writing inv_dmic fix Takashi Iwai
2013-01-08 11:38 ` [PATCH 059/112] ALSA: hda - Add snd_hda_codec_flush_*_cache() aliases Takashi Iwai
2013-01-08 11:38 ` [PATCH 060/112] ALSA: hda - Add missing amp cache flush for bound capture vol/sw ctls Takashi Iwai
2013-01-08 11:38 ` [PATCH 061/112] ALSA: hda - Add / fix comments about capture vol/sw controls in hda_generic.c Takashi Iwai
2013-01-08 11:38 ` [PATCH 062/112] ALSA: hda - Do sequential writes in snd_hda_gen_init() Takashi Iwai
2013-01-08 11:38 ` [PATCH 063/112] ALSA: hda - Fix wrong dirty check in snd_hda_codec_resume_amp() Takashi Iwai
2013-01-08 11:38 ` [PATCH 064/112] ALSA: hda - Avoid access of amp cache element outside mutex Takashi Iwai
2013-01-08 11:38 ` [PATCH 065/112] ALSA: hda - Increase the max depth of widget connections Takashi Iwai
2013-01-08 11:38 ` [PATCH 066/112] ALSA: hda - Begin HDA_GEN_* event tag from 1 Takashi Iwai
2013-01-08 11:39 ` [PATCH 067/112] ALSA: hda - Add spec->vmaster_mute_enum flag to generic parser Takashi Iwai
2013-01-08 11:39 ` [PATCH 068/112] ALSA: hda - Clear unsol enable bits on unused pins in " Takashi Iwai
2013-01-08 11:39 ` [PATCH 069/112] ALSA: hda - Refactor init_extra_out() in hda_generic.c Takashi Iwai
2013-01-08 11:39 ` [PATCH 070/112] ALSA: hda - Fix initialization of primary outputs " Takashi Iwai
2013-01-08 11:39 ` [PATCH 071/112] ALSA: hda - Dynamically turn on/off EAPD in generic codec driver Takashi Iwai
2013-01-08 11:39 ` [PATCH 072/112] ALSA: hda - Use cached version for changing pins in hda_generic.c Takashi Iwai
2013-01-08 11:39 ` [PATCH 073/112] ALSA: hda - Fix PCM name string for generic parser Takashi Iwai
2013-01-08 11:39 ` [PATCH 074/112] ALSA: hda - Drop spec->channel_mode field from hda_gen_spec Takashi Iwai
2013-01-08 11:39 ` [PATCH 075/112] ALSA: hda - Add more debug prints about new paths Takashi Iwai
2013-01-08 11:39 ` [PATCH 076/112] ALSA: hda - Fix typos in debug_show_configs() Takashi Iwai
2013-01-08 11:39 ` Takashi Iwai [this message]
2013-01-08 11:39 ` [PATCH 078/112] ALSA: hda - Allow aamix in the primary output path Takashi Iwai
2013-01-08 11:39 ` [PATCH 079/112] ALSA: hda - Implement independent HP control Takashi Iwai
2013-01-08 11:39 ` [PATCH 080/112] ALSA: hda - Add inv_eapd flag to struct hda_codec Takashi Iwai
2013-01-08 11:39 ` [PATCH 081/112] ALSA: hda - Add codec->inv_jack_detect flag Takashi Iwai
2013-01-08 11:39 ` [PATCH 082/112] ALSA: hda - Revive snd_hda_get_conn_list() Takashi Iwai
2013-01-08 11:39 ` [PATCH 083/112] ALSA: hda - Add hooks for HP/line/mic auto switching Takashi Iwai
2013-01-08 11:39 ` [PATCH 084/112] ALSA: hda - Don't skip amp init for activated paths Takashi Iwai
2013-01-08 11:39 ` [PATCH 085/112] ALSA: hda - Initialize output paths with current active states Takashi Iwai
2013-01-08 11:39 ` [PATCH 086/112] ALSA: hda - Avoid duplicated path creations Takashi Iwai
2013-01-08 11:39 ` [PATCH 087/112] ALSA: hda - Check the existing path in snd_hda_add_new_path() Takashi Iwai
2013-01-08 11:39 ` [PATCH 088/112] ALSA: hda - Simplify the multi-io assignment with multi speakers Takashi Iwai
2013-01-08 11:39 ` [PATCH 089/112] ALSA: hda - Fix multi-io pin assignment in create_multi_out_ctls() Takashi Iwai
2013-01-08 11:39 ` [PATCH 090/112] ALSA: hda - Manage using output/loopback path indices Takashi Iwai
2013-01-08 11:39 ` [PATCH 091/112] ALSA: hda - Initialize digital-input path properly Takashi Iwai
2013-01-08 11:39 ` [PATCH 092/112] ALSA: hda - Correct aamix output paths Takashi Iwai
2013-01-08 11:39 ` [PATCH 093/112] ALSA: hda - Add Loopback Mixing control Takashi Iwai
2013-01-08 11:39 ` [PATCH 094/112] ALSA: hda - Fix truncated control names Takashi Iwai
2013-01-08 11:39 ` [PATCH 095/112] ALSA: hda - Prefer binding the primary CLFE output Takashi Iwai
2013-01-08 11:39 ` [PATCH 096/112] ALSA: hda - Add missing slave names for Speaker Surround, etc Takashi Iwai
2013-01-08 11:39 ` [PATCH 097/112] ALSA: hda - Drop unneeded pin argument from set_output_and_unmute() Takashi Iwai
2013-01-08 11:39 ` [PATCH 098/112] ALSA: hda - Drop bind-volume workaround Takashi Iwai
2013-01-08 11:39 ` [PATCH 099/112] ALSA: hda - Add pcm_playback_hook to hda_gen_spec Takashi Iwai
2013-01-08 11:39 ` [PATCH 100/112] ALSA: hda - Allow jack detection when polling is enabled Takashi Iwai
2013-01-08 11:39 ` [PATCH 101/112] ALSA: hda - Add snd_hda_gen_free() and snd_hda_gen_check_power_status() Takashi Iwai
2013-01-08 11:39 ` [PATCH 102/112] ALSA: hda - Remove dead HDA_CTL_BIND_VOL and HDA_CTL_BIND_SW codes Takashi Iwai
2013-01-08 11:39 ` [PATCH 103/112] ALSA: hda - Add brief comments to exported snd_hda_gen_*_() functions Takashi Iwai
2013-01-08 11:39 ` [PATCH 104/112] ALSA: hda - Clear path indices properly at each re-evaluation Takashi Iwai
2013-01-08 11:39 ` [PATCH 105/112] ALSA: hda - Use direct path reference in assign_out_path_ctls() Takashi Iwai
2013-01-08 11:39 ` [PATCH 106/112] ALSA: hda - Remove unused dac reference in create_multi_out_ctls() Takashi Iwai
2013-01-08 11:39 ` [PATCH 107/112] ALSA: hda - Don't set up active streams twice Takashi Iwai
2013-01-08 11:39 ` [PATCH 108/112] ALSA: hda - Fix multi-io channel mode management Takashi Iwai
2013-02-21  8:03   ` Raymond Yau
2013-01-08 11:39 ` [PATCH 109/112] ALSA: hda - Manage input paths via path indices Takashi Iwai
2013-01-08 11:39 ` [PATCH 110/112] ALSA: hda - Re-define snd_hda_parse_nid_path() Takashi Iwai
2013-01-08 11:39 ` [PATCH 111/112] ALSA: hda - Handle BOTH jack port as a fixed output Takashi Iwai
2013-01-08 11:39 ` [PATCH 112/112] ALSA: hda - Add a flag to suppress mic auto-switch Takashi Iwai
2013-01-08 11:47 ` [PATCH RFC 000/112] HD-audio generic parser improvements Takashi Iwai
2013-01-08 12:20 ` David Henningsson
2013-01-08 12:44   ` Takashi Iwai
2013-01-08 13:03 ` Jaroslav Kysela
2013-01-08 13:20   ` Takashi Iwai
2013-01-08 14:10     ` Jaroslav Kysela

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1357645185-7645-78-git-send-email-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).