ALSA: hda - Return the created kcontrol in __snd_hda_add_vmaster()
authorTakashi Iwai <tiwai@suse.de>
Mon, 12 Mar 2012 11:25:03 +0000 (12:25 +0100)
committerTakashi Iwai <tiwai@suse.de>
Mon, 12 Mar 2012 13:52:28 +0000 (14:52 +0100)
It'll be used for adding hooks in later patches.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/hda_codec.c
sound/pci/hda/hda_local.h
sound/pci/hda/patch_analog.c

index 0c0ac0e1d5043865d7303af5c2aecea49cb06eaa..b79ee3444654fc04f2fb13c599db4cd5d67cf2d4 100644 (file)
@@ -2399,6 +2399,7 @@ static int init_slave_unmute(void *data, struct snd_kcontrol *slave)
  * @slaves: slave control names (optional)
  * @suffix: suffix string to each slave name (optional)
  * @init_slave_vol: initialize slaves to unmute/0dB
+ * @ctl_ret: store the vmaster kcontrol in return
  *
  * Create a virtual master control with the given name.  The TLV data
  * must be either NULL or a valid data.
@@ -2411,11 +2412,15 @@ static int init_slave_unmute(void *data, struct snd_kcontrol *slave)
  */
 int __snd_hda_add_vmaster(struct hda_codec *codec, char *name,
                        unsigned int *tlv, const char * const *slaves,
-                       const char *suffix, bool init_slave_vol)
+                         const char *suffix, bool init_slave_vol,
+                         struct snd_kcontrol **ctl_ret)
 {
        struct snd_kcontrol *kctl;
        int err;
 
+       if (ctl_ret)
+               *ctl_ret = NULL;
+
        err = map_slaves(codec, slaves, suffix, check_slave_present, NULL);
        if (err != 1) {
                snd_printdd("No slave found for %s\n", name);
@@ -2439,6 +2444,8 @@ int __snd_hda_add_vmaster(struct hda_codec *codec, char *name,
                map_slaves(codec, slaves, suffix,
                           tlv ? init_slave_0dB : init_slave_unmute, kctl);
 
+       if (ctl_ret)
+               *ctl_ret = kctl;
        return 0;
 }
 EXPORT_SYMBOL_HDA(__snd_hda_add_vmaster);
index caa64686267be88131083eda277f1d9ce2b60d43..c3ee4ede4482d0421dbe22f1e8b16d0c628fd4d8 100644 (file)
@@ -140,10 +140,11 @@ void snd_hda_set_vmaster_tlv(struct hda_codec *codec, hda_nid_t nid, int dir,
 struct snd_kcontrol *snd_hda_find_mixer_ctl(struct hda_codec *codec,
                                            const char *name);
 int __snd_hda_add_vmaster(struct hda_codec *codec, char *name,
-                       unsigned int *tlv, const char * const *slaves,
-                       const char *suffix, bool init_slave_vol);
+                         unsigned int *tlv, const char * const *slaves,
+                         const char *suffix, bool init_slave_vol,
+                         struct snd_kcontrol **ctl_ret);
 #define snd_hda_add_vmaster(codec, name, tlv, slaves, suffix) \
-       __snd_hda_add_vmaster(codec, name, tlv, slaves, suffix, true)
+       __snd_hda_add_vmaster(codec, name, tlv, slaves, suffix, true, NULL)
 int snd_hda_codec_reset(struct hda_codec *codec);
 
 /* amp value bits */
index fa97a0c5ced00aa7fac39232b8d93601de4bf7f9..7143393927da34ddeac2c86ce6538c669e85d16a 100644 (file)
@@ -229,7 +229,7 @@ static int ad198x_build_controls(struct hda_codec *codec)
                                          (spec->slave_vols ?
                                           spec->slave_vols : ad_slave_pfxs),
                                          "Playback Volume",
-                                         !spec->avoid_init_slave_vol);
+                                         !spec->avoid_init_slave_vol, NULL);
                if (err < 0)
                        return err;
        }