aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2012-12-18 05:46:37 -0500
committerTakashi Iwai <tiwai@suse.de>2013-01-12 02:30:27 -0500
commit965ccebccdf7199bef866414e56817b18ea6268e (patch)
tree2d03d7eb3beec85c090847f438699f02fa523e7e /sound
parent62343997e475b8c33fef0d8549eef49f6855ae0a (diff)
ALSA: hda/realtek - Rename add_new_out_path() with add_new_nid_path()
Make the function more generic for both input and output directions, and returns the assigned path pointer. The argument order is changed to follow the standard (from, to) way. Now this new function is used for analog input and loopback path parser codes, too. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound')
-rw-r--r--sound/pci/hda/patch_realtek.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 954f4a8db004..d9c3b4af41d4 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -1342,8 +1342,12 @@ static void alc_auto_set_output_and_unmute(struct hda_codec *codec,
1342 hda_nid_t dac); 1342 hda_nid_t dac);
1343static hda_nid_t alc_auto_look_for_dac(struct hda_codec *codec, hda_nid_t pin, 1343static hda_nid_t alc_auto_look_for_dac(struct hda_codec *codec, hda_nid_t pin,
1344 bool is_digital); 1344 bool is_digital);
1345static bool add_new_out_path(struct hda_codec *codec, hda_nid_t pin, 1345static bool parse_nid_path(struct hda_codec *codec, hda_nid_t from_nid,
1346 hda_nid_t dac); 1346 hda_nid_t to_nid, int with_aa_mix,
1347 struct nid_path *path);
1348static struct nid_path *add_new_nid_path(struct hda_codec *codec,
1349 hda_nid_t from_nid, hda_nid_t to_nid,
1350 int with_aa_mix);
1347 1351
1348/* 1352/*
1349 * Digital I/O handling 1353 * Digital I/O handling
@@ -1371,7 +1375,7 @@ static void alc_auto_init_digital(struct hda_codec *codec)
1371static void alc_auto_parse_digital(struct hda_codec *codec) 1375static void alc_auto_parse_digital(struct hda_codec *codec)
1372{ 1376{
1373 struct alc_spec *spec = codec->spec; 1377 struct alc_spec *spec = codec->spec;
1374 int i, err, nums; 1378 int i, nums;
1375 hda_nid_t dig_nid; 1379 hda_nid_t dig_nid;
1376 1380
1377 /* support multiple SPDIFs; the secondary is set up as a slave */ 1381 /* support multiple SPDIFs; the secondary is set up as a slave */
@@ -1381,6 +1385,8 @@ static void alc_auto_parse_digital(struct hda_codec *codec)
1381 dig_nid = alc_auto_look_for_dac(codec, pin, true); 1385 dig_nid = alc_auto_look_for_dac(codec, pin, true);
1382 if (!dig_nid) 1386 if (!dig_nid)
1383 continue; 1387 continue;
1388 if (!add_new_nid_path(codec, dig_nid, pin, 2))
1389 continue;
1384 if (!nums) { 1390 if (!nums) {
1385 spec->multiout.dig_out_nid = dig_nid; 1391 spec->multiout.dig_out_nid = dig_nid;
1386 spec->dig_out_type = spec->autocfg.dig_out_type[0]; 1392 spec->dig_out_type = spec->autocfg.dig_out_type[0];
@@ -1390,7 +1396,6 @@ static void alc_auto_parse_digital(struct hda_codec *codec)
1390 break; 1396 break;
1391 spec->slave_dig_outs[nums - 1] = dig_nid; 1397 spec->slave_dig_outs[nums - 1] = dig_nid;
1392 } 1398 }
1393 add_new_out_path(codec, pin, dig_nid);
1394 nums++; 1399 nums++;
1395 } 1400 }
1396 1401
@@ -1404,8 +1409,6 @@ static void alc_auto_parse_digital(struct hda_codec *codec)
1404 continue; 1409 continue;
1405 if (!(wcaps & AC_WCAP_CONN_LIST)) 1410 if (!(wcaps & AC_WCAP_CONN_LIST))
1406 continue; 1411 continue;
1407 err = get_connection_index(codec, dig_nid,
1408 spec->autocfg.dig_in_pin);
1409 if (err >= 0) { 1412 if (err >= 0) {
1410 spec->dig_in_nid = dig_nid; 1413 spec->dig_in_nid = dig_nid;
1411 break; 1414 break;
@@ -2343,10 +2346,6 @@ static const char *alc_get_line_out_pfx(struct alc_spec *spec, int ch,
2343 return channel_name[ch]; 2346 return channel_name[ch];
2344} 2347}
2345 2348
2346static bool parse_nid_path(struct hda_codec *codec, hda_nid_t from_nid,
2347 hda_nid_t to_nid, int with_aa_mix,
2348 struct nid_path *path);
2349
2350#ifdef CONFIG_PM 2349#ifdef CONFIG_PM
2351/* add the powersave loopback-list entry */ 2350/* add the powersave loopback-list entry */
2352static void add_loopback_list(struct alc_spec *spec, hda_nid_t mix, int idx) 2351static void add_loopback_list(struct alc_spec *spec, hda_nid_t mix, int idx)
@@ -2380,11 +2379,8 @@ static int new_analog_input(struct hda_codec *codec, hda_nid_t pin,
2380 !nid_has_mute(codec, mix_nid, HDA_INPUT)) 2379 !nid_has_mute(codec, mix_nid, HDA_INPUT))
2381 return 0; /* no need for analog loopback */ 2380 return 0; /* no need for analog loopback */
2382 2381
2383 path = snd_array_new(&spec->paths); 2382 path = add_new_nid_path(codec, pin, mix_nid, 2);
2384 if (!path) 2383 if (!path)
2385 return -ENOMEM;
2386 memset(path, 0, sizeof(*path));
2387 if (!parse_nid_path(codec, pin, mix_nid, 2, path))
2388 return -EINVAL; 2384 return -EINVAL;
2389 2385
2390 idx = path->idx[path->depth - 1]; 2386 idx = path->idx[path->depth - 1];
@@ -2937,21 +2933,25 @@ static hda_nid_t alc_look_for_out_mute_nid(struct hda_codec *codec,
2937static hda_nid_t alc_look_for_out_vol_nid(struct hda_codec *codec, 2933static hda_nid_t alc_look_for_out_vol_nid(struct hda_codec *codec,
2938 struct nid_path *path); 2934 struct nid_path *path);
2939 2935
2940static bool add_new_out_path(struct hda_codec *codec, hda_nid_t pin, 2936static struct nid_path *add_new_nid_path(struct hda_codec *codec,
2941 hda_nid_t dac) 2937 hda_nid_t from_nid, hda_nid_t to_nid,
2938 int with_aa_mix)
2942{ 2939{
2943 struct alc_spec *spec = codec->spec; 2940 struct alc_spec *spec = codec->spec;
2944 struct nid_path *path; 2941 struct nid_path *path;
2945 2942
2943 if (from_nid && to_nid && !is_reachable_path(codec, from_nid, to_nid))
2944 return NULL;
2945
2946 path = snd_array_new(&spec->paths); 2946 path = snd_array_new(&spec->paths);
2947 if (!path) 2947 if (!path)
2948 return false; 2948 return NULL;
2949 memset(path, 0, sizeof(*path)); 2949 memset(path, 0, sizeof(*path));
2950 if (parse_nid_path(codec, dac, pin, 0, path)) 2950 if (parse_nid_path(codec, from_nid, to_nid, with_aa_mix, path))
2951 return true; 2951 return path;
2952 /* push back */ 2952 /* push back */
2953 spec->paths.used--; 2953 spec->paths.used--;
2954 return false; 2954 return NULL;
2955} 2955}
2956 2956
2957/* get the path between the given NIDs; 2957/* get the path between the given NIDs;
@@ -3093,7 +3093,7 @@ static int alc_auto_fill_dacs(struct hda_codec *codec, int num_outs,
3093 else 3093 else
3094 badness += bad->no_dac; 3094 badness += bad->no_dac;
3095 } 3095 }
3096 if (!add_new_out_path(codec, pin, dac)) 3096 if (!add_new_nid_path(codec, dac, pin, 0))
3097 dac = dacs[i] = 0; 3097 dac = dacs[i] = 0;
3098 if (dac) 3098 if (dac)
3099 badness += assign_out_path_ctls(codec, pin, dac); 3099 badness += assign_out_path_ctls(codec, pin, dac);
@@ -3118,7 +3118,7 @@ static bool alc_map_singles(struct hda_codec *codec, int outs,
3118 dac = get_dac_if_single(codec, pins[i]); 3118 dac = get_dac_if_single(codec, pins[i]);
3119 if (!dac) 3119 if (!dac)
3120 continue; 3120 continue;
3121 if (add_new_out_path(codec, pins[i], dac)) { 3121 if (add_new_nid_path(codec, dac, pins[i], 0)) {
3122 dacs[i] = dac; 3122 dacs[i] = dac;
3123 found = true; 3123 found = true;
3124 } 3124 }
@@ -4015,7 +4015,7 @@ static int alc_auto_fill_multi_ios(struct hda_codec *codec,
4015 badness++; 4015 badness++;
4016 continue; 4016 continue;
4017 } 4017 }
4018 if (!add_new_out_path(codec, nid, dac)) { 4018 if (!add_new_nid_path(codec, dac, nid, 0)) {
4019 badness++; 4019 badness++;
4020 continue; 4020 continue;
4021 } 4021 }