]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - sound/pci/hda/hda_generic.c
ALSA: hda - No 'Headphone as Line-out' swich without line-outs
[linux-2.6-omap-h63xx.git] / sound / pci / hda / hda_generic.c
index c957eb58de5cb048c6bf9e4dca471dcd2ddc5a37..98ff010d5b95c7467791140ff003f13e46212740 100644 (file)
@@ -20,7 +20,6 @@
  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
  */
 
-#include <sound/driver.h>
 #include <linux/init.h>
 #include <linux/slab.h>
 #include <sound/core.h>
@@ -175,7 +174,8 @@ static int build_afg_tree(struct hda_codec *codec)
        int i, nodes, err;
        hda_nid_t nid;
 
-       snd_assert(spec, return -EINVAL);
+       if (snd_BUG_ON(!spec))
+               return -EINVAL;
 
        spec->def_amp_out_caps = snd_hda_param_read(codec, codec->afg, AC_PAR_AMP_OUT_CAP);
        spec->def_amp_in_caps = snd_hda_param_read(codec, codec->afg, AC_PAR_AMP_IN_CAP);
@@ -723,7 +723,8 @@ static int create_mixer(struct hda_codec *codec, struct hda_gnode *node,
                if (is_loopback)
                        add_input_loopback(codec, node->nid, HDA_INPUT, index);
                snd_printdd("[%s] NID=0x%x, DIR=IN, IDX=0x%x\n", name, node->nid, index);
-               if ((err = snd_ctl_add(codec->bus->card, snd_ctl_new1(&knew, codec))) < 0)
+               err = snd_hda_ctl_add(codec, snd_ctl_new1(&knew, codec));
+               if (err < 0)
                        return err;
                created = 1;
        } else if ((node->wid_caps & AC_WCAP_OUT_AMP) &&
@@ -732,7 +733,8 @@ static int create_mixer(struct hda_codec *codec, struct hda_gnode *node,
                if (is_loopback)
                        add_input_loopback(codec, node->nid, HDA_OUTPUT, 0);
                snd_printdd("[%s] NID=0x%x, DIR=OUT\n", name, node->nid);
-               if ((err = snd_ctl_add(codec->bus->card, snd_ctl_new1(&knew, codec))) < 0)
+               err = snd_hda_ctl_add(codec, snd_ctl_new1(&knew, codec));
+               if (err < 0)
                        return err;
                created = 1;
        }
@@ -745,14 +747,16 @@ static int create_mixer(struct hda_codec *codec, struct hda_gnode *node,
            (node->amp_in_caps & AC_AMPCAP_NUM_STEPS)) {
                knew = (struct snd_kcontrol_new)HDA_CODEC_VOLUME(name, node->nid, index, HDA_INPUT);
                snd_printdd("[%s] NID=0x%x, DIR=IN, IDX=0x%x\n", name, node->nid, index);
-               if ((err = snd_ctl_add(codec->bus->card, snd_ctl_new1(&knew, codec))) < 0)
+               err = snd_hda_ctl_add(codec, snd_ctl_new1(&knew, codec));
+               if (err < 0)
                        return err;
                created = 1;
        } else if ((node->wid_caps & AC_WCAP_OUT_AMP) &&
                   (node->amp_out_caps & AC_AMPCAP_NUM_STEPS)) {
                knew = (struct snd_kcontrol_new)HDA_CODEC_VOLUME(name, node->nid, 0, HDA_OUTPUT);
                snd_printdd("[%s] NID=0x%x, DIR=OUT\n", name, node->nid);
-               if ((err = snd_ctl_add(codec->bus->card, snd_ctl_new1(&knew, codec))) < 0)
+               err = snd_hda_ctl_add(codec, snd_ctl_new1(&knew, codec));
+               if (err < 0)
                        return err;
                created = 1;
        }
@@ -849,8 +853,8 @@ static int build_input_controls(struct hda_codec *codec)
        }
 
        /* create input MUX if multiple sources are available */
-       if ((err = snd_ctl_add(codec->bus->card,
-                              snd_ctl_new1(&cap_sel, codec))) < 0)
+       err = snd_hda_ctl_add(codec, snd_ctl_new1(&cap_sel, codec));
+       if (err < 0)
                return err;
 
        /* no volume control? */
@@ -867,8 +871,8 @@ static int build_input_controls(struct hda_codec *codec)
                        HDA_CODEC_VOLUME(name, adc_node->nid,
                                         spec->input_mux.items[i].index,
                                         HDA_INPUT);
-               if ((err = snd_ctl_add(codec->bus->card,
-                                      snd_ctl_new1(&knew, codec))) < 0)
+               err = snd_hda_ctl_add(codec, snd_ctl_new1(&knew, codec));
+               if (err < 0)
                        return err;
        }
 
@@ -1008,8 +1012,8 @@ static int generic_pcm2_cleanup(struct hda_pcm_stream *hinfo,
 {
        struct hda_gspec *spec = codec->spec;
 
-       snd_hda_codec_setup_stream(codec, hinfo->nid, 0, 0, 0);
-       snd_hda_codec_setup_stream(codec, spec->dac_node[1]->nid, 0, 0, 0);
+       snd_hda_codec_cleanup_stream(codec, hinfo->nid);
+       snd_hda_codec_cleanup_stream(codec, spec->dac_node[1]->nid);
        return 0;
 }