Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/ieee1394...
[pandora-kernel.git] / sound / pci / hda / patch_analog.c
index dd4e00a..076365b 100644 (file)
@@ -488,9 +488,13 @@ static struct snd_kcontrol_new ad1986a_mixers[] = {
        {
                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
                .name = "PCM Playback Volume",
+               .access = SNDRV_CTL_ELEM_ACCESS_READWRITE |
+                         SNDRV_CTL_ELEM_ACCESS_TLV_READ |
+                         SNDRV_CTL_ELEM_ACCESS_TLV_CALLBACK,
                .info = ad1986a_pcm_amp_vol_info,
                .get = ad1986a_pcm_amp_vol_get,
                .put = ad1986a_pcm_amp_vol_put,
+               .tlv = { .c = snd_hda_mixer_amp_tlv },
                .private_value = HDA_COMPOSE_AMP_VAL(AD1986A_FRONT_DAC, 3, 0, HDA_OUTPUT)
        },
        {
@@ -637,6 +641,7 @@ static struct snd_kcontrol_new ad1986a_laptop_eapd_mixers[] = {
                .info = snd_hda_mixer_amp_volume_info,
                .get = snd_hda_mixer_amp_volume_get,
                .put = ad1986a_laptop_master_vol_put,
+               .tlv = { .c = snd_hda_mixer_amp_tlv },
                .private_value = HDA_COMPOSE_AMP_VAL(0x1a, 3, 0, HDA_OUTPUT),
        },
        {
@@ -789,8 +794,12 @@ static struct hda_board_config ad1986a_cfg_tbl[] = {
        { .modelname = "3stack",        .config = AD1986A_3STACK },
        { .pci_subvendor = 0x10de, .pci_subdevice = 0xcb84,
          .config = AD1986A_3STACK }, /* ASUS A8N-VM CSM */
+       { .pci_subvendor = 0x1043, .pci_subdevice = 0x817f,
+         .config = AD1986A_3STACK }, /* ASUS P5P-L2 */
        { .pci_subvendor = 0x1043, .pci_subdevice = 0x81b3,
          .config = AD1986A_3STACK }, /* ASUS P5RD2-VM / P5GPL-X SE */
+       { .pci_subvendor = 0x1043, .pci_subdevice = 0x81cb,
+         .config = AD1986A_3STACK }, /* ASUS M2NPV-VM */
        { .modelname = "laptop",        .config = AD1986A_LAPTOP },
        { .pci_subvendor = 0x144d, .pci_subdevice = 0xc01e,
          .config = AD1986A_LAPTOP }, /* FSC V2060 */
@@ -799,16 +808,24 @@ static struct hda_board_config ad1986a_cfg_tbl[] = {
        { .pci_subvendor = 0x1043, .pci_subdevice = 0x818f,
          .config = AD1986A_LAPTOP }, /* ASUS P5GV-MX */
        { .modelname = "laptop-eapd",   .config = AD1986A_LAPTOP_EAPD },
+       { .pci_subvendor = 0x144d, .pci_subdevice = 0xc023,
+         .config = AD1986A_LAPTOP_EAPD }, /* Samsung X60 Chane */
        { .pci_subvendor = 0x144d, .pci_subdevice = 0xc024,
          .config = AD1986A_LAPTOP_EAPD }, /* Samsung R65-T2300 Charis */
+       { .pci_subvendor = 0x144d, .pci_subdevice = 0xc026,
+         .config = AD1986A_LAPTOP_EAPD }, /* Samsung X11-T2300 Culesa */
        { .pci_subvendor = 0x1043, .pci_subdevice = 0x1153,
          .config = AD1986A_LAPTOP_EAPD }, /* ASUS M9 */
        { .pci_subvendor = 0x1043, .pci_subdevice = 0x1213,
          .config = AD1986A_LAPTOP_EAPD }, /* ASUS A6J */
        { .pci_subvendor = 0x1043, .pci_subdevice = 0x11f7,
          .config = AD1986A_LAPTOP_EAPD }, /* ASUS U5A */
+       { .pci_subvendor = 0x1043, .pci_subdevice = 0x1263,
+         .config = AD1986A_LAPTOP_EAPD }, /* ASUS U5F */
        { .pci_subvendor = 0x1043, .pci_subdevice = 0x1297,
          .config = AD1986A_LAPTOP_EAPD }, /* ASUS Z62F */
+       { .pci_subvendor = 0x1043, .pci_subdevice = 0x12b3,
+         .config = AD1986A_LAPTOP_EAPD }, /* ASUS V1j */
        { .pci_subvendor = 0x103c, .pci_subdevice = 0x30af,
          .config = AD1986A_LAPTOP_EAPD }, /* HP Compaq Presario B2800 */
        { .pci_subvendor = 0x17aa, .pci_subdevice = 0x2066,
@@ -1543,6 +1560,9 @@ enum {
 /* reivision id to check workarounds */
 #define AD1988A_REV2           0x100200
 
+#define is_rev2(codec) \
+       ((codec)->vendor_id == 0x11d41988 && \
+        (codec)->revision_id == AD1988A_REV2)
 
 /*
  * mixers
@@ -1621,10 +1641,12 @@ static int ad198x_ch_mode_put(struct snd_kcontrol *kcontrol,
 {
        struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
        struct ad198x_spec *spec = codec->spec;
-       if (spec->need_dac_fix)
+       int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
+                                     spec->num_channel_mode,
+                                     &spec->multiout.max_channels);
+       if (err >= 0 && spec->need_dac_fix)
                spec->multiout.num_dacs = spec->multiout.max_channels / 2;
-       return snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
-                                  spec->num_channel_mode, &spec->multiout.max_channels);
+       return err;
 }
 
 /* 6-stack mode */
@@ -1634,6 +1656,7 @@ static struct snd_kcontrol_new ad1988_6stack_mixers1[] = {
        HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x05, 1, 0x0, HDA_OUTPUT),
        HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x05, 2, 0x0, HDA_OUTPUT),
        HDA_CODEC_VOLUME("Side Playback Volume", 0x0a, 0x0, HDA_OUTPUT),
+       { } /* end */
 };
 
 static struct snd_kcontrol_new ad1988_6stack_mixers1_rev2[] = {
@@ -1642,6 +1665,7 @@ static struct snd_kcontrol_new ad1988_6stack_mixers1_rev2[] = {
        HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
        HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0a, 2, 0x0, HDA_OUTPUT),
        HDA_CODEC_VOLUME("Side Playback Volume", 0x06, 0x0, HDA_OUTPUT),
+       { } /* end */
 };
 
 static struct snd_kcontrol_new ad1988_6stack_mixers2[] = {
@@ -1680,6 +1704,7 @@ static struct snd_kcontrol_new ad1988_3stack_mixers1[] = {
        HDA_CODEC_VOLUME("Surround Playback Volume", 0x0a, 0x0, HDA_OUTPUT),
        HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x05, 1, 0x0, HDA_OUTPUT),
        HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x05, 2, 0x0, HDA_OUTPUT),
+       { } /* end */
 };
 
 static struct snd_kcontrol_new ad1988_3stack_mixers1_rev2[] = {
@@ -1687,6 +1712,7 @@ static struct snd_kcontrol_new ad1988_3stack_mixers1_rev2[] = {
        HDA_CODEC_VOLUME("Surround Playback Volume", 0x0a, 0x0, HDA_OUTPUT),
        HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x06, 1, 0x0, HDA_OUTPUT),
        HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x06, 2, 0x0, HDA_OUTPUT),
+       { } /* end */
 };
 
 static struct snd_kcontrol_new ad1988_3stack_mixers2[] = {
@@ -2193,7 +2219,7 @@ static inline hda_nid_t ad1988_idx_to_dac(struct hda_codec *codec, int idx)
                /* A     B     C     D     E     F     G     H */
                0x04, 0x05, 0x0a, 0x04, 0x06, 0x05, 0x0a, 0x06
        };
-       if (codec->revision_id == AD1988A_REV2)
+       if (is_rev2(codec))
                return idx_to_dac_rev2[idx];
        else
                return idx_to_dac[idx];
@@ -2451,7 +2477,7 @@ static void ad1988_auto_init_extra_out(struct hda_codec *codec)
        pin = spec->autocfg.speaker_pins[0];
        if (pin) /* connect to front */
                ad1988_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0);
-       pin = spec->autocfg.hp_pin;
+       pin = spec->autocfg.hp_pins[0];
        if (pin) /* connect to front */
                ad1988_auto_set_output_and_unmute(codec, pin, PIN_HP, 0);
 }
@@ -2503,7 +2529,7 @@ static int ad1988_parse_auto_config(struct hda_codec *codec)
            (err = ad1988_auto_create_extra_out(codec,
                                                spec->autocfg.speaker_pins[0],
                                                "Speaker")) < 0 ||
-           (err = ad1988_auto_create_extra_out(codec, spec->autocfg.hp_pin,
+           (err = ad1988_auto_create_extra_out(codec, spec->autocfg.hp_pins[0],
                                                "Headphone")) < 0 ||
            (err = ad1988_auto_create_analog_input_ctls(spec, &spec->autocfg)) < 0)
                return err;
@@ -2562,7 +2588,7 @@ static int patch_ad1988(struct hda_codec *codec)
        mutex_init(&spec->amp_mutex);
        codec->spec = spec;
 
-       if (codec->revision_id == AD1988A_REV2)
+       if (is_rev2(codec))
                snd_printk(KERN_INFO "patch_analog: AD1988A rev.2 is detected, enable workarounds\n");
 
        board_config = snd_hda_check_board_config(codec, ad1988_cfg_tbl);
@@ -2588,13 +2614,13 @@ static int patch_ad1988(struct hda_codec *codec)
        case AD1988_6STACK_DIG:
                spec->multiout.max_channels = 8;
                spec->multiout.num_dacs = 4;
-               if (codec->revision_id == AD1988A_REV2)
+               if (is_rev2(codec))
                        spec->multiout.dac_nids = ad1988_6stack_dac_nids_rev2;
                else
                        spec->multiout.dac_nids = ad1988_6stack_dac_nids;
                spec->input_mux = &ad1988_6stack_capture_source;
                spec->num_mixers = 2;
-               if (codec->revision_id == AD1988A_REV2)
+               if (is_rev2(codec))
                        spec->mixers[0] = ad1988_6stack_mixers1_rev2;
                else
                        spec->mixers[0] = ad1988_6stack_mixers1;
@@ -2610,7 +2636,7 @@ static int patch_ad1988(struct hda_codec *codec)
        case AD1988_3STACK_DIG:
                spec->multiout.max_channels = 6;
                spec->multiout.num_dacs = 3;
-               if (codec->revision_id == AD1988A_REV2)
+               if (is_rev2(codec))
                        spec->multiout.dac_nids = ad1988_3stack_dac_nids_rev2;
                else
                        spec->multiout.dac_nids = ad1988_3stack_dac_nids;
@@ -2618,7 +2644,7 @@ static int patch_ad1988(struct hda_codec *codec)
                spec->channel_mode = ad1988_3stack_modes;
                spec->num_channel_mode = ARRAY_SIZE(ad1988_3stack_modes);
                spec->num_mixers = 2;
-               if (codec->revision_id == AD1988A_REV2)
+               if (is_rev2(codec))
                        spec->mixers[0] = ad1988_3stack_mixers1_rev2;
                else
                        spec->mixers[0] = ad1988_3stack_mixers1;