aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2012-03-12 07:25:03 -0400
committerTakashi Iwai <tiwai@suse.de>2012-03-12 09:52:28 -0400
commit29e5853d618282d8277ce8a8304f7424eb60deb5 (patch)
treee6f2990534e3656f9bbdc1a13cb3fc3cf41934c9 /sound/pci
parent2ad787e9aae8bfac14fa96748c0f2b034577be6a (diff)
ALSA: hda - Return the created kcontrol in __snd_hda_add_vmaster()
It'll be used for adding hooks in later patches. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/hda/hda_codec.c9
-rw-r--r--sound/pci/hda/hda_local.h7
-rw-r--r--sound/pci/hda/patch_analog.c2
3 files changed, 13 insertions, 5 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 0c0ac0e1d504..b79ee3444654 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -2399,6 +2399,7 @@ static int init_slave_unmute(void *data, struct snd_kcontrol *slave)
2399 * @slaves: slave control names (optional) 2399 * @slaves: slave control names (optional)
2400 * @suffix: suffix string to each slave name (optional) 2400 * @suffix: suffix string to each slave name (optional)
2401 * @init_slave_vol: initialize slaves to unmute/0dB 2401 * @init_slave_vol: initialize slaves to unmute/0dB
2402 * @ctl_ret: store the vmaster kcontrol in return
2402 * 2403 *
2403 * Create a virtual master control with the given name. The TLV data 2404 * Create a virtual master control with the given name. The TLV data
2404 * must be either NULL or a valid data. 2405 * must be either NULL or a valid data.
@@ -2411,11 +2412,15 @@ static int init_slave_unmute(void *data, struct snd_kcontrol *slave)
2411 */ 2412 */
2412int __snd_hda_add_vmaster(struct hda_codec *codec, char *name, 2413int __snd_hda_add_vmaster(struct hda_codec *codec, char *name,
2413 unsigned int *tlv, const char * const *slaves, 2414 unsigned int *tlv, const char * const *slaves,
2414 const char *suffix, bool init_slave_vol) 2415 const char *suffix, bool init_slave_vol,
2416 struct snd_kcontrol **ctl_ret)
2415{ 2417{
2416 struct snd_kcontrol *kctl; 2418 struct snd_kcontrol *kctl;
2417 int err; 2419 int err;
2418 2420
2421 if (ctl_ret)
2422 *ctl_ret = NULL;
2423
2419 err = map_slaves(codec, slaves, suffix, check_slave_present, NULL); 2424 err = map_slaves(codec, slaves, suffix, check_slave_present, NULL);
2420 if (err != 1) { 2425 if (err != 1) {
2421 snd_printdd("No slave found for %s\n", name); 2426 snd_printdd("No slave found for %s\n", name);
@@ -2439,6 +2444,8 @@ int __snd_hda_add_vmaster(struct hda_codec *codec, char *name,
2439 map_slaves(codec, slaves, suffix, 2444 map_slaves(codec, slaves, suffix,
2440 tlv ? init_slave_0dB : init_slave_unmute, kctl); 2445 tlv ? init_slave_0dB : init_slave_unmute, kctl);
2441 2446
2447 if (ctl_ret)
2448 *ctl_ret = kctl;
2442 return 0; 2449 return 0;
2443} 2450}
2444EXPORT_SYMBOL_HDA(__snd_hda_add_vmaster); 2451EXPORT_SYMBOL_HDA(__snd_hda_add_vmaster);
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h
index caa64686267b..c3ee4ede4482 100644
--- a/sound/pci/hda/hda_local.h
+++ b/sound/pci/hda/hda_local.h
@@ -140,10 +140,11 @@ void snd_hda_set_vmaster_tlv(struct hda_codec *codec, hda_nid_t nid, int dir,
140struct snd_kcontrol *snd_hda_find_mixer_ctl(struct hda_codec *codec, 140struct snd_kcontrol *snd_hda_find_mixer_ctl(struct hda_codec *codec,
141 const char *name); 141 const char *name);
142int __snd_hda_add_vmaster(struct hda_codec *codec, char *name, 142int __snd_hda_add_vmaster(struct hda_codec *codec, char *name,
143 unsigned int *tlv, const char * const *slaves, 143 unsigned int *tlv, const char * const *slaves,
144 const char *suffix, bool init_slave_vol); 144 const char *suffix, bool init_slave_vol,
145 struct snd_kcontrol **ctl_ret);
145#define snd_hda_add_vmaster(codec, name, tlv, slaves, suffix) \ 146#define snd_hda_add_vmaster(codec, name, tlv, slaves, suffix) \
146 __snd_hda_add_vmaster(codec, name, tlv, slaves, suffix, true) 147 __snd_hda_add_vmaster(codec, name, tlv, slaves, suffix, true, NULL)
147int snd_hda_codec_reset(struct hda_codec *codec); 148int snd_hda_codec_reset(struct hda_codec *codec);
148 149
149/* amp value bits */ 150/* amp value bits */
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
index fa97a0c5ced0..7143393927da 100644
--- a/sound/pci/hda/patch_analog.c
+++ b/sound/pci/hda/patch_analog.c
@@ -229,7 +229,7 @@ static int ad198x_build_controls(struct hda_codec *codec)
229 (spec->slave_vols ? 229 (spec->slave_vols ?
230 spec->slave_vols : ad_slave_pfxs), 230 spec->slave_vols : ad_slave_pfxs),
231 "Playback Volume", 231 "Playback Volume",
232 !spec->avoid_init_slave_vol); 232 !spec->avoid_init_slave_vol, NULL);
233 if (err < 0) 233 if (err < 0)
234 return err; 234 return err;
235 } 235 }