Commit 12c93df6 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: hda - Export snd_hda_gen_add_kctl()

It may be used in other codec drivers, so let it free.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 731dc301
...@@ -43,9 +43,9 @@ int snd_hda_gen_spec_init(struct hda_gen_spec *spec) ...@@ -43,9 +43,9 @@ int snd_hda_gen_spec_init(struct hda_gen_spec *spec)
} }
EXPORT_SYMBOL_HDA(snd_hda_gen_spec_init); EXPORT_SYMBOL_HDA(snd_hda_gen_spec_init);
static struct snd_kcontrol_new * struct snd_kcontrol_new *
add_kctl(struct hda_gen_spec *spec, const char *name, snd_hda_gen_add_kctl(struct hda_gen_spec *spec, const char *name,
const struct snd_kcontrol_new *temp) const struct snd_kcontrol_new *temp)
{ {
struct snd_kcontrol_new *knew = snd_array_new(&spec->kctls); struct snd_kcontrol_new *knew = snd_array_new(&spec->kctls);
if (!knew) if (!knew)
...@@ -59,6 +59,7 @@ add_kctl(struct hda_gen_spec *spec, const char *name, ...@@ -59,6 +59,7 @@ add_kctl(struct hda_gen_spec *spec, const char *name,
return NULL; return NULL;
return knew; return knew;
} }
EXPORT_SYMBOL_HDA(snd_hda_gen_add_kctl);
static void free_kctls(struct hda_gen_spec *spec) static void free_kctls(struct hda_gen_spec *spec)
{ {
...@@ -548,7 +549,7 @@ static int add_control(struct hda_gen_spec *spec, int type, const char *name, ...@@ -548,7 +549,7 @@ static int add_control(struct hda_gen_spec *spec, int type, const char *name,
{ {
struct snd_kcontrol_new *knew; struct snd_kcontrol_new *knew;
knew = add_kctl(spec, name, &control_templates[type]); knew = snd_hda_gen_add_kctl(spec, name, &control_templates[type]);
if (!knew) if (!knew)
return -ENOMEM; return -ENOMEM;
knew->index = cidx; knew->index = cidx;
...@@ -1527,7 +1528,7 @@ static int create_multi_channel_mode(struct hda_codec *codec) ...@@ -1527,7 +1528,7 @@ static int create_multi_channel_mode(struct hda_codec *codec)
struct hda_gen_spec *spec = codec->spec; struct hda_gen_spec *spec = codec->spec;
if (spec->multi_ios > 0) { if (spec->multi_ios > 0) {
if (!add_kctl(spec, NULL, &channel_mode_enum)) if (!snd_hda_gen_add_kctl(spec, NULL, &channel_mode_enum))
return -ENOMEM; return -ENOMEM;
} }
return 0; return 0;
...@@ -2086,7 +2087,7 @@ static int create_bind_cap_vol_ctl(struct hda_codec *codec, int idx, ...@@ -2086,7 +2087,7 @@ static int create_bind_cap_vol_ctl(struct hda_codec *codec, int idx,
struct snd_kcontrol_new *knew; struct snd_kcontrol_new *knew;
if (vol_ctl) { if (vol_ctl) {
knew = add_kctl(spec, NULL, &cap_vol_temp); knew = snd_hda_gen_add_kctl(spec, NULL, &cap_vol_temp);
if (!knew) if (!knew)
return -ENOMEM; return -ENOMEM;
knew->index = idx; knew->index = idx;
...@@ -2094,7 +2095,7 @@ static int create_bind_cap_vol_ctl(struct hda_codec *codec, int idx, ...@@ -2094,7 +2095,7 @@ static int create_bind_cap_vol_ctl(struct hda_codec *codec, int idx,
knew->subdevice = HDA_SUBDEV_AMP_FLAG; knew->subdevice = HDA_SUBDEV_AMP_FLAG;
} }
if (sw_ctl) { if (sw_ctl) {
knew = add_kctl(spec, NULL, &cap_sw_temp); knew = snd_hda_gen_add_kctl(spec, NULL, &cap_sw_temp);
if (!knew) if (!knew)
return -ENOMEM; return -ENOMEM;
knew->index = idx; knew->index = idx;
...@@ -2171,7 +2172,7 @@ static int create_capture_mixers(struct hda_codec *codec) ...@@ -2171,7 +2172,7 @@ static int create_capture_mixers(struct hda_codec *codec)
if (!spec->auto_mic && imux->num_items > 1) { if (!spec->auto_mic && imux->num_items > 1) {
struct snd_kcontrol_new *knew; struct snd_kcontrol_new *knew;
knew = add_kctl(spec, NULL, &cap_src_temp); knew = snd_hda_gen_add_kctl(spec, NULL, &cap_src_temp);
if (!knew) if (!knew)
return -ENOMEM; return -ENOMEM;
knew->count = nums; knew->count = nums;
...@@ -2592,7 +2593,7 @@ static int add_automute_mode_enum(struct hda_codec *codec) ...@@ -2592,7 +2593,7 @@ static int add_automute_mode_enum(struct hda_codec *codec)
{ {
struct hda_gen_spec *spec = codec->spec; struct hda_gen_spec *spec = codec->spec;
if (!add_kctl(spec, NULL, &automute_mode_enum)) if (!snd_hda_gen_add_kctl(spec, NULL, &automute_mode_enum))
return -ENOMEM; return -ENOMEM;
return 0; return 0;
} }
......
...@@ -192,6 +192,10 @@ snd_hda_add_new_path(struct hda_codec *codec, hda_nid_t from_nid, ...@@ -192,6 +192,10 @@ snd_hda_add_new_path(struct hda_codec *codec, hda_nid_t from_nid,
void snd_hda_activate_path(struct hda_codec *codec, struct nid_path *path, void snd_hda_activate_path(struct hda_codec *codec, struct nid_path *path,
bool enable, bool add_aamix); bool enable, bool add_aamix);
struct snd_kcontrol_new *
snd_hda_gen_add_kctl(struct hda_gen_spec *spec, const char *name,
const struct snd_kcontrol_new *temp);
int snd_hda_gen_parse_auto_config(struct hda_codec *codec, int snd_hda_gen_parse_auto_config(struct hda_codec *codec,
const hda_nid_t *ignore_nids); const hda_nid_t *ignore_nids);
int snd_hda_gen_build_controls(struct hda_codec *codec); int snd_hda_gen_build_controls(struct hda_codec *codec);
......
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