Commit 965ccebc authored by Takashi Iwai's avatar Takashi Iwai

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: default avatarTakashi Iwai <tiwai@suse.de>
parent 62343997
...@@ -1342,8 +1342,12 @@ static void alc_auto_set_output_and_unmute(struct hda_codec *codec, ...@@ -1342,8 +1342,12 @@ static void alc_auto_set_output_and_unmute(struct hda_codec *codec,
hda_nid_t dac); hda_nid_t dac);
static hda_nid_t alc_auto_look_for_dac(struct hda_codec *codec, hda_nid_t pin, static hda_nid_t alc_auto_look_for_dac(struct hda_codec *codec, hda_nid_t pin,
bool is_digital); bool is_digital);
static bool add_new_out_path(struct hda_codec *codec, hda_nid_t pin, static bool parse_nid_path(struct hda_codec *codec, hda_nid_t from_nid,
hda_nid_t dac); hda_nid_t to_nid, int with_aa_mix,
struct nid_path *path);
static struct nid_path *add_new_nid_path(struct hda_codec *codec,
hda_nid_t from_nid, hda_nid_t to_nid,
int with_aa_mix);
/* /*
* Digital I/O handling * Digital I/O handling
...@@ -1371,7 +1375,7 @@ static void alc_auto_init_digital(struct hda_codec *codec) ...@@ -1371,7 +1375,7 @@ static void alc_auto_init_digital(struct hda_codec *codec)
static void alc_auto_parse_digital(struct hda_codec *codec) static void alc_auto_parse_digital(struct hda_codec *codec)
{ {
struct alc_spec *spec = codec->spec; struct alc_spec *spec = codec->spec;
int i, err, nums; int i, nums;
hda_nid_t dig_nid; hda_nid_t dig_nid;
/* support multiple SPDIFs; the secondary is set up as a slave */ /* 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,6 +1385,8 @@ static void alc_auto_parse_digital(struct hda_codec *codec)
dig_nid = alc_auto_look_for_dac(codec, pin, true); dig_nid = alc_auto_look_for_dac(codec, pin, true);
if (!dig_nid) if (!dig_nid)
continue; continue;
if (!add_new_nid_path(codec, dig_nid, pin, 2))
continue;
if (!nums) { if (!nums) {
spec->multiout.dig_out_nid = dig_nid; spec->multiout.dig_out_nid = dig_nid;
spec->dig_out_type = spec->autocfg.dig_out_type[0]; 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,7 +1396,6 @@ static void alc_auto_parse_digital(struct hda_codec *codec)
break; break;
spec->slave_dig_outs[nums - 1] = dig_nid; spec->slave_dig_outs[nums - 1] = dig_nid;
} }
add_new_out_path(codec, pin, dig_nid);
nums++; nums++;
} }
...@@ -1404,8 +1409,6 @@ static void alc_auto_parse_digital(struct hda_codec *codec) ...@@ -1404,8 +1409,6 @@ static void alc_auto_parse_digital(struct hda_codec *codec)
continue; continue;
if (!(wcaps & AC_WCAP_CONN_LIST)) if (!(wcaps & AC_WCAP_CONN_LIST))
continue; continue;
err = get_connection_index(codec, dig_nid,
spec->autocfg.dig_in_pin);
if (err >= 0) { if (err >= 0) {
spec->dig_in_nid = dig_nid; spec->dig_in_nid = dig_nid;
break; break;
...@@ -2343,10 +2346,6 @@ static const char *alc_get_line_out_pfx(struct alc_spec *spec, int ch, ...@@ -2343,10 +2346,6 @@ static const char *alc_get_line_out_pfx(struct alc_spec *spec, int ch,
return channel_name[ch]; return channel_name[ch];
} }
static bool 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);
#ifdef CONFIG_PM #ifdef CONFIG_PM
/* add the powersave loopback-list entry */ /* add the powersave loopback-list entry */
static void add_loopback_list(struct alc_spec *spec, hda_nid_t mix, int idx) static 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,11 +2379,8 @@ static int new_analog_input(struct hda_codec *codec, hda_nid_t pin,
!nid_has_mute(codec, mix_nid, HDA_INPUT)) !nid_has_mute(codec, mix_nid, HDA_INPUT))
return 0; /* no need for analog loopback */ return 0; /* no need for analog loopback */
path = snd_array_new(&spec->paths); path = add_new_nid_path(codec, pin, mix_nid, 2);
if (!path) if (!path)
return -ENOMEM;
memset(path, 0, sizeof(*path));
if (!parse_nid_path(codec, pin, mix_nid, 2, path))
return -EINVAL; return -EINVAL;
idx = path->idx[path->depth - 1]; idx = path->idx[path->depth - 1];
...@@ -2937,21 +2933,25 @@ static hda_nid_t alc_look_for_out_mute_nid(struct hda_codec *codec, ...@@ -2937,21 +2933,25 @@ static hda_nid_t alc_look_for_out_mute_nid(struct hda_codec *codec,
static hda_nid_t alc_look_for_out_vol_nid(struct hda_codec *codec, static hda_nid_t alc_look_for_out_vol_nid(struct hda_codec *codec,
struct nid_path *path); struct nid_path *path);
static bool add_new_out_path(struct hda_codec *codec, hda_nid_t pin, static struct nid_path *add_new_nid_path(struct hda_codec *codec,
hda_nid_t dac) hda_nid_t from_nid, hda_nid_t to_nid,
int with_aa_mix)
{ {
struct alc_spec *spec = codec->spec; struct alc_spec *spec = codec->spec;
struct nid_path *path; struct nid_path *path;
if (from_nid && to_nid && !is_reachable_path(codec, from_nid, to_nid))
return NULL;
path = snd_array_new(&spec->paths); path = snd_array_new(&spec->paths);
if (!path) if (!path)
return false; return NULL;
memset(path, 0, sizeof(*path)); memset(path, 0, sizeof(*path));
if (parse_nid_path(codec, dac, pin, 0, path)) if (parse_nid_path(codec, from_nid, to_nid, with_aa_mix, path))
return true; return path;
/* push back */ /* push back */
spec->paths.used--; spec->paths.used--;
return false; return NULL;
} }
/* get the path between the given NIDs; /* 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,7 +3093,7 @@ static int alc_auto_fill_dacs(struct hda_codec *codec, int num_outs,
else else
badness += bad->no_dac; badness += bad->no_dac;
} }
if (!add_new_out_path(codec, pin, dac)) if (!add_new_nid_path(codec, dac, pin, 0))
dac = dacs[i] = 0; dac = dacs[i] = 0;
if (dac) if (dac)
badness += assign_out_path_ctls(codec, pin, dac); badness += assign_out_path_ctls(codec, pin, dac);
...@@ -3118,7 +3118,7 @@ static bool alc_map_singles(struct hda_codec *codec, int outs, ...@@ -3118,7 +3118,7 @@ static bool alc_map_singles(struct hda_codec *codec, int outs,
dac = get_dac_if_single(codec, pins[i]); dac = get_dac_if_single(codec, pins[i]);
if (!dac) if (!dac)
continue; continue;
if (add_new_out_path(codec, pins[i], dac)) { if (add_new_nid_path(codec, dac, pins[i], 0)) {
dacs[i] = dac; dacs[i] = dac;
found = true; found = true;
} }
...@@ -4015,7 +4015,7 @@ static int alc_auto_fill_multi_ios(struct hda_codec *codec, ...@@ -4015,7 +4015,7 @@ static int alc_auto_fill_multi_ios(struct hda_codec *codec,
badness++; badness++;
continue; continue;
} }
if (!add_new_out_path(codec, nid, dac)) { if (!add_new_nid_path(codec, dac, nid, 0)) {
badness++; badness++;
continue; continue;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment