Commit 6518f7ac authored by Takashi Iwai's avatar Takashi Iwai

ALSA: hda/realtek - Rename get_out_path() to get_nid_path()

The function can be used not only for output paths but generically.
Also swap the argument order.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent fef7fbbc
...@@ -3064,11 +3064,11 @@ static bool add_new_out_path(struct hda_codec *codec, hda_nid_t pin, ...@@ -3064,11 +3064,11 @@ static bool add_new_out_path(struct hda_codec *codec, hda_nid_t pin,
return false; return false;
} }
/* get the path pointing from the given dac to pin; /* get the path between the given NIDs;
* passing 0 to either @pin or @dac behaves as a wildcard * passing 0 to either @pin or @dac behaves as a wildcard
*/ */
static struct nid_path *get_out_path(struct hda_codec *codec, hda_nid_t pin, static struct nid_path *
hda_nid_t dac) get_nid_path(struct hda_codec *codec, hda_nid_t from_nid, hda_nid_t to_nid)
{ {
struct alc_spec *spec = codec->spec; struct alc_spec *spec = codec->spec;
int i; int i;
...@@ -3077,8 +3077,8 @@ static struct nid_path *get_out_path(struct hda_codec *codec, hda_nid_t pin, ...@@ -3077,8 +3077,8 @@ static struct nid_path *get_out_path(struct hda_codec *codec, hda_nid_t pin,
struct nid_path *path = snd_array_elem(&spec->paths, i); struct nid_path *path = snd_array_elem(&spec->paths, i);
if (path->depth <= 0) if (path->depth <= 0)
continue; continue;
if ((!dac || path->path[0] == dac) && if ((!from_nid || path->path[0] == from_nid) &&
(!pin || path->path[path->depth - 1] == pin)) (!to_nid || path->path[path->depth - 1] == to_nid))
return path; return path;
} }
return NULL; return NULL;
...@@ -3094,7 +3094,7 @@ static struct nid_path *get_out_path(struct hda_codec *codec, hda_nid_t pin, ...@@ -3094,7 +3094,7 @@ static struct nid_path *get_out_path(struct hda_codec *codec, hda_nid_t pin,
static int assign_out_path_ctls(struct hda_codec *codec, hda_nid_t pin, static int assign_out_path_ctls(struct hda_codec *codec, hda_nid_t pin,
hda_nid_t dac) hda_nid_t dac)
{ {
struct nid_path *path = get_out_path(codec, pin, dac); struct nid_path *path = get_nid_path(codec, dac, pin);
hda_nid_t nid; hda_nid_t nid;
unsigned int val; unsigned int val;
int badness = 0; int badness = 0;
...@@ -3495,9 +3495,9 @@ static int alc_auto_fill_dac_nids(struct hda_codec *codec) ...@@ -3495,9 +3495,9 @@ static int alc_auto_fill_dac_nids(struct hda_codec *codec)
debug_show_configs(spec, cfg); debug_show_configs(spec, cfg);
if (cfg->line_out_pins[0]) { if (cfg->line_out_pins[0]) {
struct nid_path *path = get_out_path(codec, struct nid_path *path = get_nid_path(codec,
cfg->line_out_pins[0], spec->multiout.dac_nids[0],
spec->multiout.dac_nids[0]); cfg->line_out_pins[0]);
if (path) if (path)
spec->vmaster_nid = alc_look_for_out_vol_nid(codec, path); spec->vmaster_nid = alc_look_for_out_vol_nid(codec, path);
} }
...@@ -3641,7 +3641,7 @@ static int alc_auto_create_multi_out_ctls(struct hda_codec *codec, ...@@ -3641,7 +3641,7 @@ static int alc_auto_create_multi_out_ctls(struct hda_codec *codec,
name = alc_get_line_out_pfx(spec, i, true, &index); name = alc_get_line_out_pfx(spec, i, true, &index);
} }
path = get_out_path(codec, pin, dac); path = get_nid_path(codec, dac, pin);
if (!path) if (!path)
continue; continue;
if (!name || !strcmp(name, "CLFE")) { if (!name || !strcmp(name, "CLFE")) {
...@@ -3677,7 +3677,7 @@ static int alc_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin, ...@@ -3677,7 +3677,7 @@ static int alc_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
struct nid_path *path; struct nid_path *path;
int err; int err;
path = get_out_path(codec, pin, dac); path = get_nid_path(codec, dac, pin);
if (!path) if (!path)
return 0; return 0;
/* bind volume control will be created in the case of dac = 0 */ /* bind volume control will be created in the case of dac = 0 */
...@@ -3763,7 +3763,7 @@ static int alc_auto_create_extra_outs(struct hda_codec *codec, int num_pins, ...@@ -3763,7 +3763,7 @@ static int alc_auto_create_extra_outs(struct hda_codec *codec, int num_pins,
struct nid_path *path; struct nid_path *path;
if (!pins[i] || !dacs[i]) if (!pins[i] || !dacs[i])
continue; continue;
path = get_out_path(codec, pins[i], dacs[i]); path = get_nid_path(codec, dacs[i], pins[i]);
if (!path) if (!path)
continue; continue;
vol = alc_look_for_out_vol_nid(codec, path); vol = alc_look_for_out_vol_nid(codec, path);
...@@ -3975,7 +3975,7 @@ static void alc_auto_set_output_and_unmute(struct hda_codec *codec, ...@@ -3975,7 +3975,7 @@ static void alc_auto_set_output_and_unmute(struct hda_codec *codec,
struct nid_path *path; struct nid_path *path;
snd_hda_set_pin_ctl_cache(codec, pin, pin_type); snd_hda_set_pin_ctl_cache(codec, pin, pin_type);
path = get_out_path(codec, pin, dac); path = get_nid_path(codec, dac, pin);
if (!path) if (!path)
return; return;
activate_path(codec, path, true); activate_path(codec, path, true);
...@@ -4183,7 +4183,7 @@ static int alc_set_multi_io(struct hda_codec *codec, int idx, bool output) ...@@ -4183,7 +4183,7 @@ static int alc_set_multi_io(struct hda_codec *codec, int idx, bool output)
hda_nid_t nid = spec->multi_io[idx].pin; hda_nid_t nid = spec->multi_io[idx].pin;
struct nid_path *path; struct nid_path *path;
path = get_out_path(codec, nid, spec->multi_io[idx].dac); path = get_nid_path(codec, spec->multi_io[idx].dac, nid);
if (!path) if (!path)
return -EINVAL; return -EINVAL;
......
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