ALSA: hda - Add missing SPDIF I/O setup for CA0132
authorTakashi Iwai <tiwai@suse.de>
Wed, 8 Aug 2012 15:26:54 +0000 (17:26 +0200)
committerTakashi Iwai <tiwai@suse.de>
Wed, 8 Aug 2012 15:27:50 +0000 (17:27 +0200)
CA0132 driver had some codes to handle the S/PDIF I/O, but the actual
setups of pins and converters were missing.  Now the pins are added.

Also, fixed a few points triggering invalid codec verbs and mixer
elements since the digital I/O audio widgets on CA0132 have no amp.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/patch_ca0132.c

index 31512a0..9c0ec0a 100644 (file)
@@ -246,7 +246,7 @@ static void init_output(struct hda_codec *codec, hda_nid_t pin, hda_nid_t dac)
                                            AC_VERB_SET_AMP_GAIN_MUTE,
                                            AMP_OUT_UNMUTE);
        }
-       if (dac)
+       if (dac && (get_wcaps(codec, dac) & AC_WCAP_OUT_AMP))
                snd_hda_codec_write(codec, dac, 0,
                                    AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO);
 }
@@ -261,7 +261,7 @@ static void init_input(struct hda_codec *codec, hda_nid_t pin, hda_nid_t adc)
                                            AC_VERB_SET_AMP_GAIN_MUTE,
                                            AMP_IN_UNMUTE(0));
        }
-       if (adc)
+       if (adc && (get_wcaps(codec, adc) & AC_WCAP_IN_AMP))
                snd_hda_codec_write(codec, adc, 0, AC_VERB_SET_AMP_GAIN_MUTE,
                                    AMP_IN_UNMUTE(0));
 }
@@ -841,18 +841,16 @@ static int ca0132_build_controls(struct hda_codec *codec)
                                                    spec->dig_out);
                if (err < 0)
                        return err;
-               err = add_out_volume(codec, spec->dig_out, "IEC958");
+               err = snd_hda_create_spdif_share_sw(codec, &spec->multiout);
                if (err < 0)
                        return err;
+               /* spec->multiout.share_spdif = 1; */
        }
 
        if (spec->dig_in) {
                err = snd_hda_create_spdif_in_ctls(codec, spec->dig_in);
                if (err < 0)
                        return err;
-               err = add_in_volume(codec, spec->dig_in, "IEC958");
-               if (err < 0)
-                       return err;
        }
        return 0;
 }
@@ -912,6 +910,16 @@ static void ca0132_config(struct hda_codec *codec)
        spec->input_labels[1] = "Line";
        spec->adcs[1] = 0x08;
        spec->num_inputs = 2;
+
+       /* SPDIF I/O */
+       spec->dig_out = 0x05;
+       spec->multiout.dig_out_nid = spec->dig_out;
+       cfg->dig_out_pins[0] = 0x0c;
+       cfg->dig_outs = 1;
+       cfg->dig_out_type[0] = HDA_PCM_TYPE_SPDIF;
+       spec->dig_in = 0x09;
+       cfg->dig_in_pin = 0x0e;
+       cfg->dig_in_type = HDA_PCM_TYPE_SPDIF;
 }
 
 static void ca0132_init_chip(struct hda_codec *codec)