~ubuntu-branches/ubuntu/quantal/linux-linaro-mx51/quantal

« back to all changes in this revision

Viewing changes to sound/pci/hda/patch_analog.c

  • Committer: Package Import Robot
  • Author(s): John Rigby, John Rigby
  • Date: 2011-09-26 10:44:23 UTC
  • Revision ID: package-import@ubuntu.com-20110926104423-3o58a3c1bj7x00rs
Tags: 3.0.0-1007.9
[ John Rigby ]

Enable crypto modules and remove crypto-modules from
exclude-module files
LP: #826021

Show diffs side-by-side

added added

removed removed

Lines of Context:
30
30
#include "hda_beep.h"
31
31
 
32
32
struct ad198x_spec {
33
 
        struct snd_kcontrol_new *mixers[6];
 
33
        const struct snd_kcontrol_new *mixers[6];
34
34
        int num_mixers;
35
35
        unsigned int beep_amp;  /* beep amp value, set via set_beep_amp() */
36
36
        const struct hda_verb *init_verbs[6];   /* initialization verbs
46
46
        unsigned int cur_eapd;
47
47
        unsigned int need_dac_fix;
48
48
 
49
 
        hda_nid_t *alt_dac_nid;
50
 
        struct hda_pcm_stream *stream_analog_alt_playback;
 
49
        const hda_nid_t *alt_dac_nid;
 
50
        const struct hda_pcm_stream *stream_analog_alt_playback;
51
51
 
52
52
        /* capture */
53
53
        unsigned int num_adc_nids;
54
 
        hda_nid_t *adc_nids;
 
54
        const hda_nid_t *adc_nids;
55
55
        hda_nid_t dig_in_nid;           /* digital-in NID; optional */
56
56
 
57
57
        /* capture source */
58
58
        const struct hda_input_mux *input_mux;
59
 
        hda_nid_t *capsrc_nids;
 
59
        const hda_nid_t *capsrc_nids;
60
60
        unsigned int cur_mux[3];
61
61
 
62
62
        /* channel model */
182
182
 
183
183
#ifdef CONFIG_SND_HDA_INPUT_BEEP
184
184
/* additional beep mixers; the actual parameters are overwritten at build */
185
 
static struct snd_kcontrol_new ad_beep_mixer[] = {
 
185
static const struct snd_kcontrol_new ad_beep_mixer[] = {
186
186
        HDA_CODEC_VOLUME("Beep Playback Volume", 0, 0, HDA_OUTPUT),
187
187
        HDA_CODEC_MUTE_BEEP("Beep Playback Switch", 0, 0, HDA_OUTPUT),
188
188
        { } /* end */
189
189
};
190
190
 
191
 
static struct snd_kcontrol_new ad_beep2_mixer[] = {
 
191
static const struct snd_kcontrol_new ad_beep2_mixer[] = {
192
192
        HDA_CODEC_VOLUME("Digital Beep Playback Volume", 0, 0, HDA_OUTPUT),
193
193
        HDA_CODEC_MUTE_BEEP("Digital Beep Playback Switch", 0, 0, HDA_OUTPUT),
194
194
        { } /* end */
231
231
        /* create beep controls if needed */
232
232
#ifdef CONFIG_SND_HDA_INPUT_BEEP
233
233
        if (spec->beep_amp) {
234
 
                struct snd_kcontrol_new *knew;
 
234
                const struct snd_kcontrol_new *knew;
235
235
                knew = spec->analog_beep ? ad_beep2_mixer : ad_beep_mixer;
236
236
                for ( ; knew->name; knew++) {
237
237
                        struct snd_kcontrol *kctl;
331
331
        return snd_hda_multi_out_analog_cleanup(codec, &spec->multiout);
332
332
}
333
333
 
334
 
static struct hda_pcm_stream ad198x_pcm_analog_alt_playback = {
 
334
static const struct hda_pcm_stream ad198x_pcm_analog_alt_playback = {
335
335
        .substreams = 1,
336
336
        .channels_min = 2,
337
337
        .channels_max = 2,
403
403
 
404
404
/*
405
405
 */
406
 
static struct hda_pcm_stream ad198x_pcm_analog_playback = {
 
406
static const struct hda_pcm_stream ad198x_pcm_analog_playback = {
407
407
        .substreams = 1,
408
408
        .channels_min = 2,
409
409
        .channels_max = 6, /* changed later */
415
415
        },
416
416
};
417
417
 
418
 
static struct hda_pcm_stream ad198x_pcm_analog_capture = {
 
418
static const struct hda_pcm_stream ad198x_pcm_analog_capture = {
419
419
        .substreams = 1,
420
420
        .channels_min = 2,
421
421
        .channels_max = 2,
426
426
        },
427
427
};
428
428
 
429
 
static struct hda_pcm_stream ad198x_pcm_digital_playback = {
 
429
static const struct hda_pcm_stream ad198x_pcm_digital_playback = {
430
430
        .substreams = 1,
431
431
        .channels_min = 2,
432
432
        .channels_max = 2,
439
439
        },
440
440
};
441
441
 
442
 
static struct hda_pcm_stream ad198x_pcm_digital_capture = {
 
442
static const struct hda_pcm_stream ad198x_pcm_digital_capture = {
443
443
        .substreams = 1,
444
444
        .channels_min = 2,
445
445
        .channels_max = 2,
489
489
        return 0;
490
490
}
491
491
 
492
 
static inline void ad198x_shutup(struct hda_codec *codec)
493
 
{
494
 
        snd_hda_shutup_pins(codec);
495
 
}
496
 
 
497
492
static void ad198x_free_kctls(struct hda_codec *codec)
498
493
{
499
494
        struct ad198x_spec *spec = codec->spec;
511
506
                                hda_nid_t hp)
512
507
{
513
508
        struct ad198x_spec *spec = codec->spec;
514
 
        snd_hda_codec_write(codec, front, 0, AC_VERB_SET_EAPD_BTLENABLE,
 
509
        if (snd_hda_query_pin_caps(codec, front) & AC_PINCAP_EAPD)
 
510
                snd_hda_codec_write(codec, front, 0, AC_VERB_SET_EAPD_BTLENABLE,
515
511
                            !spec->inv_eapd ? 0x00 : 0x02);
516
 
        snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_EAPD_BTLENABLE,
 
512
        if (snd_hda_query_pin_caps(codec, hp) & AC_PINCAP_EAPD)
 
513
                snd_hda_codec_write(codec, hp, 0, AC_VERB_SET_EAPD_BTLENABLE,
517
514
                            !spec->inv_eapd ? 0x00 : 0x02);
518
515
}
519
516
 
529
526
        case 0x11d4184a:
530
527
        case 0x11d4194a:
531
528
        case 0x11d4194b:
 
529
        case 0x11d41988:
 
530
        case 0x11d4198b:
 
531
        case 0x11d4989a:
 
532
        case 0x11d4989b:
532
533
                ad198x_power_eapd_write(codec, 0x12, 0x11);
533
534
                break;
534
535
        case 0x11d41981:
538
539
        case 0x11d41986:
539
540
                ad198x_power_eapd_write(codec, 0x1b, 0x1a);
540
541
                break;
541
 
        case 0x11d41988:
542
 
        case 0x11d4198b:
543
 
        case 0x11d4989a:
544
 
        case 0x11d4989b:
545
 
                ad198x_power_eapd_write(codec, 0x29, 0x22);
546
 
                break;
547
542
        }
548
543
}
549
544
 
 
545
static void ad198x_shutup(struct hda_codec *codec)
 
546
{
 
547
        snd_hda_shutup_pins(codec);
 
548
        ad198x_power_eapd(codec);
 
549
}
 
550
 
550
551
static void ad198x_free(struct hda_codec *codec)
551
552
{
552
553
        struct ad198x_spec *spec = codec->spec;
564
565
static int ad198x_suspend(struct hda_codec *codec, pm_message_t state)
565
566
{
566
567
        ad198x_shutup(codec);
567
 
        ad198x_power_eapd(codec);
568
568
        return 0;
569
569
}
570
570
#endif
571
571
 
572
 
static struct hda_codec_ops ad198x_patch_ops = {
 
572
static const struct hda_codec_ops ad198x_patch_ops = {
573
573
        .build_controls = ad198x_build_controls,
574
574
        .build_pcms = ad198x_build_pcms,
575
575
        .init = ad198x_init,
639
639
#define AD1986A_CLFE_DAC        0x05
640
640
#define AD1986A_ADC             0x06
641
641
 
642
 
static hda_nid_t ad1986a_dac_nids[3] = {
 
642
static const hda_nid_t ad1986a_dac_nids[3] = {
643
643
        AD1986A_FRONT_DAC, AD1986A_SURR_DAC, AD1986A_CLFE_DAC
644
644
};
645
 
static hda_nid_t ad1986a_adc_nids[1] = { AD1986A_ADC };
646
 
static hda_nid_t ad1986a_capsrc_nids[1] = { 0x12 };
 
645
static const hda_nid_t ad1986a_adc_nids[1] = { AD1986A_ADC };
 
646
static const hda_nid_t ad1986a_capsrc_nids[1] = { 0x12 };
647
647
 
648
 
static struct hda_input_mux ad1986a_capture_source = {
 
648
static const struct hda_input_mux ad1986a_capture_source = {
649
649
        .num_items = 7,
650
650
        .items = {
651
651
                { "Mic", 0x0 },
659
659
};
660
660
 
661
661
 
662
 
static struct hda_bind_ctls ad1986a_bind_pcm_vol = {
 
662
static const struct hda_bind_ctls ad1986a_bind_pcm_vol = {
663
663
        .ops = &snd_hda_bind_vol,
664
664
        .values = {
665
665
                HDA_COMPOSE_AMP_VAL(AD1986A_FRONT_DAC, 3, 0, HDA_OUTPUT),
669
669
        },
670
670
};
671
671
 
672
 
static struct hda_bind_ctls ad1986a_bind_pcm_sw = {
 
672
static const struct hda_bind_ctls ad1986a_bind_pcm_sw = {
673
673
        .ops = &snd_hda_bind_sw,
674
674
        .values = {
675
675
                HDA_COMPOSE_AMP_VAL(AD1986A_FRONT_DAC, 3, 0, HDA_OUTPUT),
682
682
/*
683
683
 * mixers
684
684
 */
685
 
static struct snd_kcontrol_new ad1986a_mixers[] = {
 
685
static const struct snd_kcontrol_new ad1986a_mixers[] = {
686
686
        /*
687
687
         * bind volumes/mutes of 3 DACs as a single PCM control for simplicity
688
688
         */
723
723
};
724
724
 
725
725
/* additional mixers for 3stack mode */
726
 
static struct snd_kcontrol_new ad1986a_3st_mixers[] = {
 
726
static const struct snd_kcontrol_new ad1986a_3st_mixers[] = {
727
727
        {
728
728
                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
729
729
                .name = "Channel Mode",
735
735
};
736
736
 
737
737
/* laptop model - 2ch only */
738
 
static hda_nid_t ad1986a_laptop_dac_nids[1] = { AD1986A_FRONT_DAC };
 
738
static const hda_nid_t ad1986a_laptop_dac_nids[1] = { AD1986A_FRONT_DAC };
739
739
 
740
740
/* master controls both pins 0x1a and 0x1b */
741
 
static struct hda_bind_ctls ad1986a_laptop_master_vol = {
 
741
static const struct hda_bind_ctls ad1986a_laptop_master_vol = {
742
742
        .ops = &snd_hda_bind_vol,
743
743
        .values = {
744
744
                HDA_COMPOSE_AMP_VAL(0x1a, 3, 0, HDA_OUTPUT),
747
747
        },
748
748
};
749
749
 
750
 
static struct hda_bind_ctls ad1986a_laptop_master_sw = {
 
750
static const struct hda_bind_ctls ad1986a_laptop_master_sw = {
751
751
        .ops = &snd_hda_bind_sw,
752
752
        .values = {
753
753
                HDA_COMPOSE_AMP_VAL(0x1a, 3, 0, HDA_OUTPUT),
756
756
        },
757
757
};
758
758
 
759
 
static struct snd_kcontrol_new ad1986a_laptop_mixers[] = {
 
759
static const struct snd_kcontrol_new ad1986a_laptop_mixers[] = {
760
760
        HDA_CODEC_VOLUME("PCM Playback Volume", 0x03, 0x0, HDA_OUTPUT),
761
761
        HDA_CODEC_MUTE("PCM Playback Switch", 0x03, 0x0, HDA_OUTPUT),
762
762
        HDA_BIND_VOL("Master Playback Volume", &ad1986a_laptop_master_vol),
787
787
 
788
788
/* laptop-eapd model - 2ch only */
789
789
 
790
 
static struct hda_input_mux ad1986a_laptop_eapd_capture_source = {
 
790
static const struct hda_input_mux ad1986a_laptop_eapd_capture_source = {
791
791
        .num_items = 3,
792
792
        .items = {
793
793
                { "Mic", 0x0 },
796
796
        },
797
797
};
798
798
 
799
 
static struct hda_input_mux ad1986a_automic_capture_source = {
 
799
static const struct hda_input_mux ad1986a_automic_capture_source = {
800
800
        .num_items = 2,
801
801
        .items = {
802
802
                { "Mic", 0x0 },
804
804
        },
805
805
};
806
806
 
807
 
static struct snd_kcontrol_new ad1986a_laptop_master_mixers[] = {
 
807
static const struct snd_kcontrol_new ad1986a_laptop_master_mixers[] = {
808
808
        HDA_BIND_VOL("Master Playback Volume", &ad1986a_laptop_master_vol),
809
809
        HDA_BIND_SW("Master Playback Switch", &ad1986a_laptop_master_sw),
810
810
        { } /* end */
811
811
};
812
812
 
813
 
static struct snd_kcontrol_new ad1986a_laptop_eapd_mixers[] = {
 
813
static const struct snd_kcontrol_new ad1986a_laptop_eapd_mixers[] = {
814
814
        HDA_CODEC_VOLUME("PCM Playback Volume", 0x03, 0x0, HDA_OUTPUT),
815
815
        HDA_CODEC_MUTE("PCM Playback Switch", 0x03, 0x0, HDA_OUTPUT),
816
816
        HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT),
837
837
        { } /* end */
838
838
};
839
839
 
840
 
static struct snd_kcontrol_new ad1986a_laptop_intmic_mixers[] = {
 
840
static const struct snd_kcontrol_new ad1986a_laptop_intmic_mixers[] = {
841
841
        HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x17, 0, HDA_OUTPUT),
842
842
        HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x17, 0, HDA_OUTPUT),
843
843
        { } /* end */
931
931
        return change;
932
932
}
933
933
 
934
 
static struct snd_kcontrol_new ad1986a_automute_master_mixers[] = {
 
934
static const struct snd_kcontrol_new ad1986a_automute_master_mixers[] = {
935
935
        HDA_BIND_VOL("Master Playback Volume", &ad1986a_laptop_master_vol),
936
936
        {
937
937
                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
949
949
/*
950
950
 * initialization verbs
951
951
 */
952
 
static struct hda_verb ad1986a_init_verbs[] = {
 
952
static const struct hda_verb ad1986a_init_verbs[] = {
953
953
        /* Front, Surround, CLFE DAC; mute as default */
954
954
        {0x03, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080},
955
955
        {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080},
1004
1004
        { } /* end */
1005
1005
};
1006
1006
 
1007
 
static struct hda_verb ad1986a_ch2_init[] = {
 
1007
static const struct hda_verb ad1986a_ch2_init[] = {
1008
1008
        /* Surround out -> Line In */
1009
1009
        { 0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
1010
1010
        /* Line-in selectors */
1016
1016
        { } /* end */
1017
1017
};
1018
1018
 
1019
 
static struct hda_verb ad1986a_ch4_init[] = {
 
1019
static const struct hda_verb ad1986a_ch4_init[] = {
1020
1020
        /* Surround out -> Surround */
1021
1021
        { 0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1022
1022
        { 0x10, AC_VERB_SET_CONNECT_SEL, 0x0 },
1026
1026
        { } /* end */
1027
1027
};
1028
1028
 
1029
 
static struct hda_verb ad1986a_ch6_init[] = {
 
1029
static const struct hda_verb ad1986a_ch6_init[] = {
1030
1030
        /* Surround out -> Surround out */
1031
1031
        { 0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1032
1032
        { 0x10, AC_VERB_SET_CONNECT_SEL, 0x0 },
1036
1036
        { } /* end */
1037
1037
};
1038
1038
 
1039
 
static struct hda_channel_mode ad1986a_modes[3] = {
 
1039
static const struct hda_channel_mode ad1986a_modes[3] = {
1040
1040
        { 2, ad1986a_ch2_init },
1041
1041
        { 4, ad1986a_ch4_init },
1042
1042
        { 6, ad1986a_ch6_init },
1043
1043
};
1044
1044
 
1045
1045
/* eapd initialization */
1046
 
static struct hda_verb ad1986a_eapd_init_verbs[] = {
 
1046
static const struct hda_verb ad1986a_eapd_init_verbs[] = {
1047
1047
        {0x1b, AC_VERB_SET_EAPD_BTLENABLE, 0x00 },
1048
1048
        {}
1049
1049
};
1050
1050
 
1051
 
static struct hda_verb ad1986a_automic_verbs[] = {
 
1051
static const struct hda_verb ad1986a_automic_verbs[] = {
1052
1052
        {0x1d, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1053
1053
        {0x1f, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1054
1054
        /*{0x20, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},*/
1058
1058
};
1059
1059
 
1060
1060
/* Ultra initialization */
1061
 
static struct hda_verb ad1986a_ultra_init[] = {
 
1061
static const struct hda_verb ad1986a_ultra_init[] = {
1062
1062
        /* eapd initialization */
1063
1063
        { 0x1b, AC_VERB_SET_EAPD_BTLENABLE, 0x00 },
1064
1064
        /* CLFE -> Mic in */
1069
1069
};
1070
1070
 
1071
1071
/* pin sensing on HP jack */
1072
 
static struct hda_verb ad1986a_hp_init_verbs[] = {
 
1072
static const struct hda_verb ad1986a_hp_init_verbs[] = {
1073
1073
        {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1986A_HP_EVENT},
1074
1074
        {}
1075
1075
};
1120
1120
        [AD1986A_SAMSUNG_P50]   = "samsung-p50",
1121
1121
};
1122
1122
 
1123
 
static struct snd_pci_quirk ad1986a_cfg_tbl[] = {
 
1123
static const struct snd_pci_quirk ad1986a_cfg_tbl[] = {
1124
1124
        SND_PCI_QUIRK(0x103c, 0x30af, "HP B2800", AD1986A_LAPTOP_EAPD),
1125
1125
        SND_PCI_QUIRK(0x1043, 0x1153, "ASUS M9", AD1986A_LAPTOP_EAPD),
1126
1126
        SND_PCI_QUIRK(0x1043, 0x11f7, "ASUS U5A", AD1986A_LAPTOP_EAPD),
1152
1152
};
1153
1153
 
1154
1154
#ifdef CONFIG_SND_HDA_POWER_SAVE
1155
 
static struct hda_amp_list ad1986a_loopbacks[] = {
 
1155
static const struct hda_amp_list ad1986a_loopbacks[] = {
1156
1156
        { 0x13, HDA_OUTPUT, 0 }, /* Mic */
1157
1157
        { 0x14, HDA_OUTPUT, 0 }, /* Phone */
1158
1158
        { 0x15, HDA_OUTPUT, 0 }, /* CD */
1329
1329
#define AD1983_DAC              0x03
1330
1330
#define AD1983_ADC              0x04
1331
1331
 
1332
 
static hda_nid_t ad1983_dac_nids[1] = { AD1983_DAC };
1333
 
static hda_nid_t ad1983_adc_nids[1] = { AD1983_ADC };
1334
 
static hda_nid_t ad1983_capsrc_nids[1] = { 0x15 };
 
1332
static const hda_nid_t ad1983_dac_nids[1] = { AD1983_DAC };
 
1333
static const hda_nid_t ad1983_adc_nids[1] = { AD1983_ADC };
 
1334
static const hda_nid_t ad1983_capsrc_nids[1] = { 0x15 };
1335
1335
 
1336
 
static struct hda_input_mux ad1983_capture_source = {
 
1336
static const struct hda_input_mux ad1983_capture_source = {
1337
1337
        .num_items = 4,
1338
1338
        .items = {
1339
1339
                { "Mic", 0x0 },
1348
1348
 */
1349
1349
static int ad1983_spdif_route_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
1350
1350
{
1351
 
        static char *texts[] = { "PCM", "ADC" };
 
1351
        static const char * const texts[] = { "PCM", "ADC" };
1352
1352
 
1353
1353
        uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
1354
1354
        uinfo->count = 1;
1385
1385
        return 0;
1386
1386
}
1387
1387
 
1388
 
static struct snd_kcontrol_new ad1983_mixers[] = {
 
1388
static const struct snd_kcontrol_new ad1983_mixers[] = {
1389
1389
        HDA_CODEC_VOLUME("Front Playback Volume", 0x05, 0x0, HDA_OUTPUT),
1390
1390
        HDA_CODEC_MUTE("Front Playback Switch", 0x05, 0x0, HDA_OUTPUT),
1391
1391
        HDA_CODEC_VOLUME("Headphone Playback Volume", 0x06, 0x0, HDA_OUTPUT),
1418
1418
        { } /* end */
1419
1419
};
1420
1420
 
1421
 
static struct hda_verb ad1983_init_verbs[] = {
 
1421
static const struct hda_verb ad1983_init_verbs[] = {
1422
1422
        /* Front, HP, Mono; mute as default */
1423
1423
        {0x05, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080},
1424
1424
        {0x06, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080},
1458
1458
};
1459
1459
 
1460
1460
#ifdef CONFIG_SND_HDA_POWER_SAVE
1461
 
static struct hda_amp_list ad1983_loopbacks[] = {
 
1461
static const struct hda_amp_list ad1983_loopbacks[] = {
1462
1462
        { 0x12, HDA_OUTPUT, 0 }, /* Mic */
1463
1463
        { 0x13, HDA_OUTPUT, 0 }, /* Line */
1464
1464
        { } /* end */
1518
1518
#define AD1981_DAC              0x03
1519
1519
#define AD1981_ADC              0x04
1520
1520
 
1521
 
static hda_nid_t ad1981_dac_nids[1] = { AD1981_DAC };
1522
 
static hda_nid_t ad1981_adc_nids[1] = { AD1981_ADC };
1523
 
static hda_nid_t ad1981_capsrc_nids[1] = { 0x15 };
 
1521
static const hda_nid_t ad1981_dac_nids[1] = { AD1981_DAC };
 
1522
static const hda_nid_t ad1981_adc_nids[1] = { AD1981_ADC };
 
1523
static const hda_nid_t ad1981_capsrc_nids[1] = { 0x15 };
1524
1524
 
1525
1525
/* 0x0c, 0x09, 0x0e, 0x0f, 0x19, 0x05, 0x18, 0x17 */
1526
 
static struct hda_input_mux ad1981_capture_source = {
 
1526
static const struct hda_input_mux ad1981_capture_source = {
1527
1527
        .num_items = 7,
1528
1528
        .items = {
1529
1529
                { "Front Mic", 0x0 },
1536
1536
        },
1537
1537
};
1538
1538
 
1539
 
static struct snd_kcontrol_new ad1981_mixers[] = {
 
1539
static const struct snd_kcontrol_new ad1981_mixers[] = {
1540
1540
        HDA_CODEC_VOLUME("Front Playback Volume", 0x05, 0x0, HDA_OUTPUT),
1541
1541
        HDA_CODEC_MUTE("Front Playback Switch", 0x05, 0x0, HDA_OUTPUT),
1542
1542
        HDA_CODEC_VOLUME("Headphone Playback Volume", 0x06, 0x0, HDA_OUTPUT),
1577
1577
        { } /* end */
1578
1578
};
1579
1579
 
1580
 
static struct hda_verb ad1981_init_verbs[] = {
 
1580
static const struct hda_verb ad1981_init_verbs[] = {
1581
1581
        /* Front, HP, Mono; mute as default */
1582
1582
        {0x05, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080},
1583
1583
        {0x06, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080},
1625
1625
};
1626
1626
 
1627
1627
#ifdef CONFIG_SND_HDA_POWER_SAVE
1628
 
static struct hda_amp_list ad1981_loopbacks[] = {
 
1628
static const struct hda_amp_list ad1981_loopbacks[] = {
1629
1629
        { 0x12, HDA_OUTPUT, 0 }, /* Front Mic */
1630
1630
        { 0x13, HDA_OUTPUT, 0 }, /* Line */
1631
1631
        { 0x1b, HDA_OUTPUT, 0 }, /* Aux */
1645
1645
#define AD1981_HP_EVENT         0x37
1646
1646
#define AD1981_MIC_EVENT        0x38
1647
1647
 
1648
 
static struct hda_verb ad1981_hp_init_verbs[] = {
 
1648
static const struct hda_verb ad1981_hp_init_verbs[] = {
1649
1649
        {0x05, AC_VERB_SET_EAPD_BTLENABLE, 0x00 }, /* default off */
1650
1650
        /* pin sensing on HP and Mic jacks */
1651
1651
        {0x06, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1981_HP_EVENT},
1674
1674
}
1675
1675
 
1676
1676
/* bind volumes of both NID 0x05 and 0x06 */
1677
 
static struct hda_bind_ctls ad1981_hp_bind_master_vol = {
 
1677
static const struct hda_bind_ctls ad1981_hp_bind_master_vol = {
1678
1678
        .ops = &snd_hda_bind_vol,
1679
1679
        .values = {
1680
1680
                HDA_COMPOSE_AMP_VAL(0x05, 3, 0, HDA_OUTPUT),
1696
1696
/* toggle input of built-in and mic jack appropriately */
1697
1697
static void ad1981_hp_automic(struct hda_codec *codec)
1698
1698
{
1699
 
        static struct hda_verb mic_jack_on[] = {
 
1699
        static const struct hda_verb mic_jack_on[] = {
1700
1700
                {0x1f, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080},
1701
1701
                {0x1e, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
1702
1702
                {}
1703
1703
        };
1704
 
        static struct hda_verb mic_jack_off[] = {
 
1704
        static const struct hda_verb mic_jack_off[] = {
1705
1705
                {0x1e, AC_VERB_SET_AMP_GAIN_MUTE, 0xb080},
1706
1706
                {0x1f, AC_VERB_SET_AMP_GAIN_MUTE, 0xb000},
1707
1707
                {}
1730
1730
        }
1731
1731
}
1732
1732
 
1733
 
static struct hda_input_mux ad1981_hp_capture_source = {
 
1733
static const struct hda_input_mux ad1981_hp_capture_source = {
1734
1734
        .num_items = 3,
1735
1735
        .items = {
1736
1736
                { "Mic", 0x0 },
1739
1739
        },
1740
1740
};
1741
1741
 
1742
 
static struct snd_kcontrol_new ad1981_hp_mixers[] = {
 
1742
static const struct snd_kcontrol_new ad1981_hp_mixers[] = {
1743
1743
        HDA_BIND_VOL("Master Playback Volume", &ad1981_hp_bind_master_vol),
1744
1744
        {
1745
1745
                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1790
1790
}
1791
1791
 
1792
1792
/* configuration for Toshiba Laptops */
1793
 
static struct hda_verb ad1981_toshiba_init_verbs[] = {
 
1793
static const struct hda_verb ad1981_toshiba_init_verbs[] = {
1794
1794
        {0x05, AC_VERB_SET_EAPD_BTLENABLE, 0x01 }, /* default on */
1795
1795
        /* pin sensing on HP and Mic jacks */
1796
1796
        {0x06, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | AD1981_HP_EVENT},
1798
1798
        {}
1799
1799
};
1800
1800
 
1801
 
static struct snd_kcontrol_new ad1981_toshiba_mixers[] = {
 
1801
static const struct snd_kcontrol_new ad1981_toshiba_mixers[] = {
1802
1802
        HDA_CODEC_VOLUME("Amp Volume", 0x1a, 0x0, HDA_OUTPUT),
1803
1803
        HDA_CODEC_MUTE("Amp Switch", 0x1a, 0x0, HDA_OUTPUT),
1804
1804
        { }
1805
1805
};
1806
1806
 
1807
1807
/* configuration for Lenovo Thinkpad T60 */
1808
 
static struct snd_kcontrol_new ad1981_thinkpad_mixers[] = {
 
1808
static const struct snd_kcontrol_new ad1981_thinkpad_mixers[] = {
1809
1809
        HDA_CODEC_VOLUME("Master Playback Volume", 0x05, 0x0, HDA_OUTPUT),
1810
1810
        HDA_CODEC_MUTE("Master Playback Switch", 0x05, 0x0, HDA_OUTPUT),
1811
1811
        HDA_CODEC_VOLUME("PCM Playback Volume", 0x11, 0x0, HDA_OUTPUT),
1835
1835
        { } /* end */
1836
1836
};
1837
1837
 
1838
 
static struct hda_input_mux ad1981_thinkpad_capture_source = {
 
1838
static const struct hda_input_mux ad1981_thinkpad_capture_source = {
1839
1839
        .num_items = 3,
1840
1840
        .items = {
1841
1841
                { "Mic", 0x0 },
1860
1860
        [AD1981_TOSHIBA]        = "toshiba"
1861
1861
};
1862
1862
 
1863
 
static struct snd_pci_quirk ad1981_cfg_tbl[] = {
 
1863
static const struct snd_pci_quirk ad1981_cfg_tbl[] = {
1864
1864
        SND_PCI_QUIRK(0x1014, 0x0597, "Lenovo Z60", AD1981_THINKPAD),
1865
1865
        SND_PCI_QUIRK(0x1014, 0x05b7, "Lenovo Z60m", AD1981_THINKPAD),
1866
1866
        /* All HP models */
2075
2075
 * mixers
2076
2076
 */
2077
2077
 
2078
 
static hda_nid_t ad1988_6stack_dac_nids[4] = {
 
2078
static const hda_nid_t ad1988_6stack_dac_nids[4] = {
2079
2079
        0x04, 0x06, 0x05, 0x0a
2080
2080
};
2081
2081
 
2082
 
static hda_nid_t ad1988_3stack_dac_nids[3] = {
 
2082
static const hda_nid_t ad1988_3stack_dac_nids[3] = {
2083
2083
        0x04, 0x05, 0x0a
2084
2084
};
2085
2085
 
2086
2086
/* for AD1988A revision-2, DAC2-4 are swapped */
2087
 
static hda_nid_t ad1988_6stack_dac_nids_rev2[4] = {
 
2087
static const hda_nid_t ad1988_6stack_dac_nids_rev2[4] = {
2088
2088
        0x04, 0x05, 0x0a, 0x06
2089
2089
};
2090
2090
 
2091
 
static hda_nid_t ad1988_alt_dac_nid[1] = {
 
2091
static const hda_nid_t ad1988_alt_dac_nid[1] = {
2092
2092
        0x03
2093
2093
};
2094
2094
 
2095
 
static hda_nid_t ad1988_3stack_dac_nids_rev2[3] = {
 
2095
static const hda_nid_t ad1988_3stack_dac_nids_rev2[3] = {
2096
2096
        0x04, 0x0a, 0x06
2097
2097
};
2098
2098
 
2099
 
static hda_nid_t ad1988_adc_nids[3] = {
 
2099
static const hda_nid_t ad1988_adc_nids[3] = {
2100
2100
        0x08, 0x09, 0x0f
2101
2101
};
2102
2102
 
2103
 
static hda_nid_t ad1988_capsrc_nids[3] = {
 
2103
static const hda_nid_t ad1988_capsrc_nids[3] = {
2104
2104
        0x0c, 0x0d, 0x0e
2105
2105
};
2106
2106
 
2108
2108
#define AD1988_SPDIF_OUT_HDMI   0x0b
2109
2109
#define AD1988_SPDIF_IN         0x07
2110
2110
 
2111
 
static hda_nid_t ad1989b_slave_dig_outs[] = {
 
2111
static const hda_nid_t ad1989b_slave_dig_outs[] = {
2112
2112
        AD1988_SPDIF_OUT, AD1988_SPDIF_OUT_HDMI, 0
2113
2113
};
2114
2114
 
2115
 
static struct hda_input_mux ad1988_6stack_capture_source = {
 
2115
static const struct hda_input_mux ad1988_6stack_capture_source = {
2116
2116
        .num_items = 5,
2117
2117
        .items = {
2118
2118
                { "Front Mic", 0x1 },   /* port-B */
2123
2123
        },
2124
2124
};
2125
2125
 
2126
 
static struct hda_input_mux ad1988_laptop_capture_source = {
 
2126
static const struct hda_input_mux ad1988_laptop_capture_source = {
2127
2127
        .num_items = 3,
2128
2128
        .items = {
2129
2129
                { "Mic/Line", 0x1 },    /* port-B */
2166
2166
}
2167
2167
 
2168
2168
/* 6-stack mode */
2169
 
static struct snd_kcontrol_new ad1988_6stack_mixers1[] = {
 
2169
static const struct snd_kcontrol_new ad1988_6stack_mixers1[] = {
2170
2170
        HDA_CODEC_VOLUME("Front Playback Volume", 0x04, 0x0, HDA_OUTPUT),
2171
2171
        HDA_CODEC_VOLUME("Surround Playback Volume", 0x06, 0x0, HDA_OUTPUT),
2172
2172
        HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x05, 1, 0x0, HDA_OUTPUT),
2175
2175
        { } /* end */
2176
2176
};
2177
2177
 
2178
 
static struct snd_kcontrol_new ad1988_6stack_mixers1_rev2[] = {
 
2178
static const struct snd_kcontrol_new ad1988_6stack_mixers1_rev2[] = {
2179
2179
        HDA_CODEC_VOLUME("Front Playback Volume", 0x04, 0x0, HDA_OUTPUT),
2180
2180
        HDA_CODEC_VOLUME("Surround Playback Volume", 0x05, 0x0, HDA_OUTPUT),
2181
2181
        HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0a, 1, 0x0, HDA_OUTPUT),
2184
2184
        { } /* end */
2185
2185
};
2186
2186
 
2187
 
static struct snd_kcontrol_new ad1988_6stack_mixers2[] = {
 
2187
static const struct snd_kcontrol_new ad1988_6stack_mixers2[] = {
2188
2188
        HDA_BIND_MUTE("Front Playback Switch", 0x29, 2, HDA_INPUT),
2189
2189
        HDA_BIND_MUTE("Surround Playback Switch", 0x2a, 2, HDA_INPUT),
2190
2190
        HDA_BIND_MUTE_MONO("Center Playback Switch", 0x27, 1, 2, HDA_INPUT),
2211
2211
        { } /* end */
2212
2212
};
2213
2213
 
2214
 
static struct snd_kcontrol_new ad1988_6stack_fp_mixers[] = {
 
2214
static const struct snd_kcontrol_new ad1988_6stack_fp_mixers[] = {
2215
2215
        HDA_CODEC_VOLUME("Headphone Playback Volume", 0x03, 0x0, HDA_OUTPUT),
2216
2216
 
2217
2217
        { } /* end */
2218
2218
};
2219
2219
 
2220
2220
/* 3-stack mode */
2221
 
static struct snd_kcontrol_new ad1988_3stack_mixers1[] = {
 
2221
static const struct snd_kcontrol_new ad1988_3stack_mixers1[] = {
2222
2222
        HDA_CODEC_VOLUME("Front Playback Volume", 0x04, 0x0, HDA_OUTPUT),
2223
2223
        HDA_CODEC_VOLUME("Surround Playback Volume", 0x0a, 0x0, HDA_OUTPUT),
2224
2224
        HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x05, 1, 0x0, HDA_OUTPUT),
2226
2226
        { } /* end */
2227
2227
};
2228
2228
 
2229
 
static struct snd_kcontrol_new ad1988_3stack_mixers1_rev2[] = {
 
2229
static const struct snd_kcontrol_new ad1988_3stack_mixers1_rev2[] = {
2230
2230
        HDA_CODEC_VOLUME("Front Playback Volume", 0x04, 0x0, HDA_OUTPUT),
2231
2231
        HDA_CODEC_VOLUME("Surround Playback Volume", 0x0a, 0x0, HDA_OUTPUT),
2232
2232
        HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x06, 1, 0x0, HDA_OUTPUT),
2234
2234
        { } /* end */
2235
2235
};
2236
2236
 
2237
 
static struct snd_kcontrol_new ad1988_3stack_mixers2[] = {
 
2237
static const struct snd_kcontrol_new ad1988_3stack_mixers2[] = {
2238
2238
        HDA_BIND_MUTE("Front Playback Switch", 0x29, 2, HDA_INPUT),
2239
2239
        HDA_BIND_MUTE("Surround Playback Switch", 0x2c, 2, HDA_INPUT),
2240
2240
        HDA_BIND_MUTE_MONO("Center Playback Switch", 0x26, 1, 2, HDA_INPUT),
2268
2268
};
2269
2269
 
2270
2270
/* laptop mode */
2271
 
static struct snd_kcontrol_new ad1988_laptop_mixers[] = {
 
2271
static const struct snd_kcontrol_new ad1988_laptop_mixers[] = {
2272
2272
        HDA_CODEC_VOLUME("PCM Playback Volume", 0x04, 0x0, HDA_OUTPUT),
2273
2273
        HDA_CODEC_MUTE("PCM Playback Switch", 0x29, 0x0, HDA_INPUT),
2274
2274
        HDA_BIND_MUTE("Mono Playback Switch", 0x1e, 2, HDA_INPUT),
2299
2299
};
2300
2300
 
2301
2301
/* capture */
2302
 
static struct snd_kcontrol_new ad1988_capture_mixers[] = {
 
2302
static const struct snd_kcontrol_new ad1988_capture_mixers[] = {
2303
2303
        HDA_CODEC_VOLUME("Capture Volume", 0x0c, 0x0, HDA_OUTPUT),
2304
2304
        HDA_CODEC_MUTE("Capture Switch", 0x0c, 0x0, HDA_OUTPUT),
2305
2305
        HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x0d, 0x0, HDA_OUTPUT),
2324
2324
static int ad1988_spdif_playback_source_info(struct snd_kcontrol *kcontrol,
2325
2325
                                             struct snd_ctl_elem_info *uinfo)
2326
2326
{
2327
 
        static char *texts[] = {
 
2327
        static const char * const texts[] = {
2328
2328
                "PCM", "ADC1", "ADC2", "ADC3"
2329
2329
        };
2330
2330
        uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2405
2405
        return change;
2406
2406
}
2407
2407
 
2408
 
static struct snd_kcontrol_new ad1988_spdif_out_mixers[] = {
 
2408
static const struct snd_kcontrol_new ad1988_spdif_out_mixers[] = {
2409
2409
        HDA_CODEC_VOLUME("IEC958 Playback Volume", 0x1b, 0x0, HDA_OUTPUT),
2410
2410
        {
2411
2411
                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2418
2418
        { } /* end */
2419
2419
};
2420
2420
 
2421
 
static struct snd_kcontrol_new ad1988_spdif_in_mixers[] = {
 
2421
static const struct snd_kcontrol_new ad1988_spdif_in_mixers[] = {
2422
2422
        HDA_CODEC_VOLUME("IEC958 Capture Volume", 0x1c, 0x0, HDA_INPUT),
2423
2423
        { } /* end */
2424
2424
};
2425
2425
 
2426
 
static struct snd_kcontrol_new ad1989_spdif_out_mixers[] = {
 
2426
static const struct snd_kcontrol_new ad1989_spdif_out_mixers[] = {
2427
2427
        HDA_CODEC_VOLUME("IEC958 Playback Volume", 0x1b, 0x0, HDA_OUTPUT),
2428
2428
        HDA_CODEC_VOLUME("HDMI Playback Volume", 0x1d, 0x0, HDA_OUTPUT),
2429
2429
        { } /* end */
2436
2436
/*
2437
2437
 * for 6-stack (+dig)
2438
2438
 */
2439
 
static struct hda_verb ad1988_6stack_init_verbs[] = {
 
2439
static const struct hda_verb ad1988_6stack_init_verbs[] = {
2440
2440
        /* Front, Surround, CLFE, side DAC; unmute as default */
2441
2441
        {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2442
2442
        {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2496
2496
        { }
2497
2497
};
2498
2498
 
2499
 
static struct hda_verb ad1988_6stack_fp_init_verbs[] = {
 
2499
static const struct hda_verb ad1988_6stack_fp_init_verbs[] = {
2500
2500
        /* Headphone; unmute as default */
2501
2501
        {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2502
2502
        /* Port-A front headphon path */
2509
2509
        { }
2510
2510
};
2511
2511
 
2512
 
static struct hda_verb ad1988_capture_init_verbs[] = {
 
2512
static const struct hda_verb ad1988_capture_init_verbs[] = {
2513
2513
        /* mute analog mix */
2514
2514
        {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2515
2515
        {0x20, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2527
2527
        { }
2528
2528
};
2529
2529
 
2530
 
static struct hda_verb ad1988_spdif_init_verbs[] = {
 
2530
static const struct hda_verb ad1988_spdif_init_verbs[] = {
2531
2531
        /* SPDIF out sel */
2532
2532
        {0x02, AC_VERB_SET_CONNECT_SEL, 0x0}, /* PCM */
2533
2533
        {0x0b, AC_VERB_SET_CONNECT_SEL, 0x0}, /* ADC1 */
2539
2539
        { }
2540
2540
};
2541
2541
 
2542
 
static struct hda_verb ad1988_spdif_in_init_verbs[] = {
 
2542
static const struct hda_verb ad1988_spdif_in_init_verbs[] = {
2543
2543
        /* unmute SPDIF input pin */
2544
2544
        {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2545
2545
        { }
2546
2546
};
2547
2547
 
2548
2548
/* AD1989 has no ADC -> SPDIF route */
2549
 
static struct hda_verb ad1989_spdif_init_verbs[] = {
 
2549
static const struct hda_verb ad1989_spdif_init_verbs[] = {
2550
2550
        /* SPDIF-1 out pin */
2551
2551
        {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2552
2552
        {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE | 0x27}, /* 0dB */
2559
2559
/*
2560
2560
 * verbs for 3stack (+dig)
2561
2561
 */
2562
 
static struct hda_verb ad1988_3stack_ch2_init[] = {
 
2562
static const struct hda_verb ad1988_3stack_ch2_init[] = {
2563
2563
        /* set port-C to line-in */
2564
2564
        { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2565
2565
        { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2569
2569
        { } /* end */
2570
2570
};
2571
2571
 
2572
 
static struct hda_verb ad1988_3stack_ch6_init[] = {
 
2572
static const struct hda_verb ad1988_3stack_ch6_init[] = {
2573
2573
        /* set port-C to surround out */
2574
2574
        { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2575
2575
        { 0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2579
2579
        { } /* end */
2580
2580
};
2581
2581
 
2582
 
static struct hda_channel_mode ad1988_3stack_modes[2] = {
 
2582
static const struct hda_channel_mode ad1988_3stack_modes[2] = {
2583
2583
        { 2, ad1988_3stack_ch2_init },
2584
2584
        { 6, ad1988_3stack_ch6_init },
2585
2585
};
2586
2586
 
2587
 
static struct hda_verb ad1988_3stack_init_verbs[] = {
 
2587
static const struct hda_verb ad1988_3stack_init_verbs[] = {
2588
2588
        /* Front, Surround, CLFE, side DAC; unmute as default */
2589
2589
        {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2590
2590
        {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2644
2644
/*
2645
2645
 * verbs for laptop mode (+dig)
2646
2646
 */
2647
 
static struct hda_verb ad1988_laptop_hp_on[] = {
 
2647
static const struct hda_verb ad1988_laptop_hp_on[] = {
2648
2648
        /* unmute port-A and mute port-D */
2649
2649
        { 0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2650
2650
        { 0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2651
2651
        { } /* end */
2652
2652
};
2653
 
static struct hda_verb ad1988_laptop_hp_off[] = {
 
2653
static const struct hda_verb ad1988_laptop_hp_off[] = {
2654
2654
        /* mute port-A and unmute port-D */
2655
2655
        { 0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2656
2656
        { 0x12, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2659
2659
 
2660
2660
#define AD1988_HP_EVENT 0x01
2661
2661
 
2662
 
static struct hda_verb ad1988_laptop_init_verbs[] = {
 
2662
static const struct hda_verb ad1988_laptop_init_verbs[] = {
2663
2663
        /* Front, Surround, CLFE, side DAC; unmute as default */
2664
2664
        {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2665
2665
        {0x06, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2723
2723
2724
2724
 
2725
2725
#ifdef CONFIG_SND_HDA_POWER_SAVE
2726
 
static struct hda_amp_list ad1988_loopbacks[] = {
 
2726
static const struct hda_amp_list ad1988_loopbacks[] = {
2727
2727
        { 0x20, HDA_INPUT, 0 }, /* Front Mic */
2728
2728
        { 0x20, HDA_INPUT, 1 }, /* Line */
2729
2729
        { 0x20, HDA_INPUT, 4 }, /* Mic */
2741
2741
        AD_CTL_WIDGET_MUTE,
2742
2742
        AD_CTL_BIND_MUTE,
2743
2743
};
2744
 
static struct snd_kcontrol_new ad1988_control_templates[] = {
 
2744
static const struct snd_kcontrol_new ad1988_control_templates[] = {
2745
2745
        HDA_CODEC_VOLUME(NULL, 0, 0, 0),
2746
2746
        HDA_CODEC_MUTE(NULL, 0, 0, 0),
2747
2747
        HDA_BIND_MUTE(NULL, 0, 0, 0),
2770
2770
#define AD1988_PIN_CD_NID               0x18
2771
2771
#define AD1988_PIN_BEEP_NID             0x10
2772
2772
 
2773
 
static hda_nid_t ad1988_mixer_nids[8] = {
 
2773
static const hda_nid_t ad1988_mixer_nids[8] = {
2774
2774
        /* A     B     C     D     E     F     G     H */
2775
2775
        0x22, 0x2b, 0x2c, 0x29, 0x26, 0x2a, 0x27, 0x28
2776
2776
};
2777
2777
 
2778
2778
static inline hda_nid_t ad1988_idx_to_dac(struct hda_codec *codec, int idx)
2779
2779
{
2780
 
        static hda_nid_t idx_to_dac[8] = {
 
2780
        static const hda_nid_t idx_to_dac[8] = {
2781
2781
                /* A     B     C     D     E     F     G     H */
2782
2782
                0x04, 0x06, 0x05, 0x04, 0x0a, 0x06, 0x05, 0x0a
2783
2783
        };
2784
 
        static hda_nid_t idx_to_dac_rev2[8] = {
 
2784
        static const hda_nid_t idx_to_dac_rev2[8] = {
2785
2785
                /* A     B     C     D     E     F     G     H */
2786
2786
                0x04, 0x05, 0x0a, 0x04, 0x06, 0x05, 0x0a, 0x06
2787
2787
        };
2791
2791
                return idx_to_dac[idx];
2792
2792
}
2793
2793
 
2794
 
static hda_nid_t ad1988_boost_nids[8] = {
 
2794
static const hda_nid_t ad1988_boost_nids[8] = {
2795
2795
        0x38, 0x39, 0x3a, 0x3d, 0x3c, 0x3b, 0, 0
2796
2796
};
2797
2797
 
2798
2798
static int ad1988_pin_idx(hda_nid_t nid)
2799
2799
{
2800
 
        static hda_nid_t ad1988_io_pins[8] = {
 
2800
        static const hda_nid_t ad1988_io_pins[8] = {
2801
2801
                0x11, 0x14, 0x15, 0x12, 0x17, 0x16, 0x24, 0x25
2802
2802
        };
2803
2803
        int i;
2809
2809
 
2810
2810
static int ad1988_pin_to_loopback_idx(hda_nid_t nid)
2811
2811
{
2812
 
        static int loopback_idx[8] = {
 
2812
        static const int loopback_idx[8] = {
2813
2813
                2, 0, 1, 3, 4, 5, 1, 4
2814
2814
        };
2815
2815
        switch (nid) {
2822
2822
 
2823
2823
static int ad1988_pin_to_adc_idx(hda_nid_t nid)
2824
2824
{
2825
 
        static int adc_idx[8] = {
 
2825
        static const int adc_idx[8] = {
2826
2826
                0, 1, 2, 8, 4, 3, 6, 7
2827
2827
        };
2828
2828
        switch (nid) {
2845
2845
        /* check the pins hardwired to audio widget */
2846
2846
        for (i = 0; i < cfg->line_outs; i++) {
2847
2847
                idx = ad1988_pin_idx(cfg->line_out_pins[i]);
2848
 
                spec->multiout.dac_nids[i] = ad1988_idx_to_dac(codec, idx);
 
2848
                spec->private_dac_nids[i] = ad1988_idx_to_dac(codec, idx);
2849
2849
        }
2850
2850
        spec->multiout.num_dacs = cfg->line_outs;
2851
2851
        return 0;
3155
3155
        [AD1988_AUTO]           = "auto",
3156
3156
};
3157
3157
 
3158
 
static struct snd_pci_quirk ad1988_cfg_tbl[] = {
 
3158
static const struct snd_pci_quirk ad1988_cfg_tbl[] = {
3159
3159
        SND_PCI_QUIRK(0x1043, 0x81ec, "Asus P5B-DLX", AD1988_6STACK_DIG),
3160
3160
        SND_PCI_QUIRK(0x1043, 0x81f6, "Asus M2N-SLI", AD1988_6STACK_DIG),
3161
3161
        SND_PCI_QUIRK(0x1043, 0x8277, "Asus P5K-E/WIFI-AP", AD1988_6STACK_DIG),
 
3162
        SND_PCI_QUIRK(0x1043, 0x82c0, "Asus M3N-HT Deluxe", AD1988_6STACK_DIG),
3162
3163
        SND_PCI_QUIRK(0x1043, 0x8311, "Asus P5Q-Premium/Pro", AD1988_6STACK_DIG),
3163
3164
        {}
3164
3165
};
3343
3344
 * but no build-up framework is given, so far.
3344
3345
 */
3345
3346
 
3346
 
static hda_nid_t ad1884_dac_nids[1] = {
 
3347
static const hda_nid_t ad1884_dac_nids[1] = {
3347
3348
        0x04,
3348
3349
};
3349
3350
 
3350
 
static hda_nid_t ad1884_adc_nids[2] = {
 
3351
static const hda_nid_t ad1884_adc_nids[2] = {
3351
3352
        0x08, 0x09,
3352
3353
};
3353
3354
 
3354
 
static hda_nid_t ad1884_capsrc_nids[2] = {
 
3355
static const hda_nid_t ad1884_capsrc_nids[2] = {
3355
3356
        0x0c, 0x0d,
3356
3357
};
3357
3358
 
3358
3359
#define AD1884_SPDIF_OUT        0x02
3359
3360
 
3360
 
static struct hda_input_mux ad1884_capture_source = {
 
3361
static const struct hda_input_mux ad1884_capture_source = {
3361
3362
        .num_items = 4,
3362
3363
        .items = {
3363
3364
                { "Front Mic", 0x0 },
3367
3368
        },
3368
3369
};
3369
3370
 
3370
 
static struct snd_kcontrol_new ad1884_base_mixers[] = {
 
3371
static const struct snd_kcontrol_new ad1884_base_mixers[] = {
3371
3372
        HDA_CODEC_VOLUME("PCM Playback Volume", 0x04, 0x0, HDA_OUTPUT),
3372
3373
        /* HDA_CODEC_VOLUME_IDX("PCM Playback Volume", 1, 0x03, 0x0, HDA_OUTPUT), */
3373
3374
        HDA_CODEC_MUTE("Headphone Playback Switch", 0x11, 0x0, HDA_OUTPUT),
3411
3412
        { } /* end */
3412
3413
};
3413
3414
 
3414
 
static struct snd_kcontrol_new ad1984_dmic_mixers[] = {
 
3415
static const struct snd_kcontrol_new ad1984_dmic_mixers[] = {
3415
3416
        HDA_CODEC_VOLUME("Digital Mic Capture Volume", 0x05, 0x0, HDA_INPUT),
3416
3417
        HDA_CODEC_MUTE("Digital Mic Capture Switch", 0x05, 0x0, HDA_INPUT),
3417
3418
        HDA_CODEC_VOLUME_IDX("Digital Mic Capture Volume", 1, 0x06, 0x0,
3424
3425
/*
3425
3426
 * initialization verbs
3426
3427
 */
3427
 
static struct hda_verb ad1884_init_verbs[] = {
 
3428
static const struct hda_verb ad1884_init_verbs[] = {
3428
3429
        /* DACs; mute as default */
3429
3430
        {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3430
3431
        {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
3470
3471
};
3471
3472
 
3472
3473
#ifdef CONFIG_SND_HDA_POWER_SAVE
3473
 
static struct hda_amp_list ad1884_loopbacks[] = {
 
3474
static const struct hda_amp_list ad1884_loopbacks[] = {
3474
3475
        { 0x20, HDA_INPUT, 0 }, /* Front Mic */
3475
3476
        { 0x20, HDA_INPUT, 1 }, /* Mic */
3476
3477
        { 0x20, HDA_INPUT, 2 }, /* CD */
3542
3543
/*
3543
3544
 * Lenovo Thinkpad T61/X61
3544
3545
 */
3545
 
static struct hda_input_mux ad1984_thinkpad_capture_source = {
 
3546
static const struct hda_input_mux ad1984_thinkpad_capture_source = {
3546
3547
        .num_items = 4,
3547
3548
        .items = {
3548
3549
                { "Mic", 0x0 },
3556
3557
/*
3557
3558
 * Dell Precision T3400
3558
3559
 */
3559
 
static struct hda_input_mux ad1984_dell_desktop_capture_source = {
 
3560
static const struct hda_input_mux ad1984_dell_desktop_capture_source = {
3560
3561
        .num_items = 3,
3561
3562
        .items = {
3562
3563
                { "Front Mic", 0x0 },
3566
3567
};
3567
3568
 
3568
3569
 
3569
 
static struct snd_kcontrol_new ad1984_thinkpad_mixers[] = {
 
3570
static const struct snd_kcontrol_new ad1984_thinkpad_mixers[] = {
3570
3571
        HDA_CODEC_VOLUME("PCM Playback Volume", 0x04, 0x0, HDA_OUTPUT),
3571
3572
        /* HDA_CODEC_VOLUME_IDX("PCM Playback Volume", 1, 0x03, 0x0, HDA_OUTPUT), */
3572
3573
        HDA_CODEC_MUTE("Headphone Playback Switch", 0x11, 0x0, HDA_OUTPUT),
3612
3613
};
3613
3614
 
3614
3615
/* additional verbs */
3615
 
static struct hda_verb ad1984_thinkpad_init_verbs[] = {
 
3616
static const struct hda_verb ad1984_thinkpad_init_verbs[] = {
3616
3617
        /* Port-E (docking station mic) pin */
3617
3618
        {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
3618
3619
        {0x1c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
3630
3631
/*
3631
3632
 * Dell Precision T3400
3632
3633
 */
3633
 
static struct snd_kcontrol_new ad1984_dell_desktop_mixers[] = {
 
3634
static const struct snd_kcontrol_new ad1984_dell_desktop_mixers[] = {
3634
3635
        HDA_CODEC_VOLUME("PCM Playback Volume", 0x04, 0x0, HDA_OUTPUT),
3635
3636
        HDA_CODEC_MUTE("Headphone Playback Switch", 0x11, 0x0, HDA_OUTPUT),
3636
3637
        HDA_CODEC_MUTE("Speaker Playback Switch", 0x12, 0x0, HDA_OUTPUT),
3681
3682
        return 0;
3682
3683
}
3683
3684
 
3684
 
static struct hda_pcm_stream ad1984_pcm_dmic_capture = {
 
3685
static const struct hda_pcm_stream ad1984_pcm_dmic_capture = {
3685
3686
        .substreams = 2,
3686
3687
        .channels_min = 2,
3687
3688
        .channels_max = 2,
3723
3724
        [AD1984_DELL_DESKTOP]   = "dell_desktop",
3724
3725
};
3725
3726
 
3726
 
static struct snd_pci_quirk ad1984_cfg_tbl[] = {
 
3727
static const struct snd_pci_quirk ad1984_cfg_tbl[] = {
3727
3728
        /* Lenovo Thinkpad T61/X61 */
3728
3729
        SND_PCI_QUIRK_VENDOR(0x17aa, "Lenovo Thinkpad", AD1984_THINKPAD),
3729
3730
        SND_PCI_QUIRK(0x1028, 0x0214, "Dell T3400", AD1984_DELL_DESKTOP),
3788
3789
 * We share the single DAC for both HP and line-outs (see AD1884/1984).
3789
3790
 */
3790
3791
 
3791
 
static hda_nid_t ad1884a_dac_nids[1] = {
 
3792
static const hda_nid_t ad1884a_dac_nids[1] = {
3792
3793
        0x03,
3793
3794
};
3794
3795
 
3797
3798
 
3798
3799
#define AD1884A_SPDIF_OUT       0x02
3799
3800
 
3800
 
static struct hda_input_mux ad1884a_capture_source = {
 
3801
static const struct hda_input_mux ad1884a_capture_source = {
3801
3802
        .num_items = 5,
3802
3803
        .items = {
3803
3804
                { "Front Mic", 0x0 },
3808
3809
        },
3809
3810
};
3810
3811
 
3811
 
static struct snd_kcontrol_new ad1884a_base_mixers[] = {
 
3812
static const struct snd_kcontrol_new ad1884a_base_mixers[] = {
3812
3813
        HDA_CODEC_VOLUME("Master Playback Volume", 0x21, 0x0, HDA_OUTPUT),
3813
3814
        HDA_CODEC_MUTE("Master Playback Switch", 0x21, 0x0, HDA_OUTPUT),
3814
3815
        HDA_CODEC_MUTE("Headphone Playback Switch", 0x11, 0x0, HDA_OUTPUT),
3860
3861
/*
3861
3862
 * initialization verbs
3862
3863
 */
3863
 
static struct hda_verb ad1884a_init_verbs[] = {
 
3864
static const struct hda_verb ad1884a_init_verbs[] = {
3864
3865
        /* DACs; unmute as default */
3865
3866
        {0x03, AC_VERB_SET_AMP_GAIN_MUTE, 0x27}, /* 0dB */
3866
3867
        {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x27}, /* 0dB */
3915
3916
};
3916
3917
 
3917
3918
#ifdef CONFIG_SND_HDA_POWER_SAVE
3918
 
static struct hda_amp_list ad1884a_loopbacks[] = {
 
3919
static const struct hda_amp_list ad1884a_loopbacks[] = {
3919
3920
        { 0x20, HDA_INPUT, 0 }, /* Front Mic */
3920
3921
        { 0x20, HDA_INPUT, 1 }, /* Mic */
3921
3922
        { 0x20, HDA_INPUT, 2 }, /* CD */
3948
3949
        return ret;
3949
3950
}
3950
3951
 
3951
 
static struct snd_kcontrol_new ad1884a_laptop_mixers[] = {
 
3952
static const struct snd_kcontrol_new ad1884a_laptop_mixers[] = {
3952
3953
        HDA_CODEC_VOLUME("Master Playback Volume", 0x21, 0x0, HDA_OUTPUT),
3953
3954
        {
3954
3955
                .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3976
3977
        { } /* end */
3977
3978
};
3978
3979
 
3979
 
static struct snd_kcontrol_new ad1884a_mobile_mixers[] = {
 
3980
static const struct snd_kcontrol_new ad1884a_mobile_mixers[] = {
3980
3981
        HDA_CODEC_VOLUME("Master Playback Volume", 0x21, 0x0, HDA_OUTPUT),
3981
3982
        /*HDA_CODEC_MUTE("Master Playback Switch", 0x21, 0x0, HDA_OUTPUT),*/
3982
3983
        {
4096
4097
}
4097
4098
 
4098
4099
/* additional verbs for laptop model */
4099
 
static struct hda_verb ad1884a_laptop_verbs[] = {
 
4100
static const struct hda_verb ad1884a_laptop_verbs[] = {
4100
4101
        /* Port-A (HP) pin - always unmuted */
4101
4102
        {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4102
4103
        /* Port-F (int speaker) mixer - route only from analog mixer */
4127
4128
        { } /* end */
4128
4129
};
4129
4130
 
4130
 
static struct hda_verb ad1884a_mobile_verbs[] = {
 
4131
static const struct hda_verb ad1884a_mobile_verbs[] = {
4131
4132
        /* DACs; unmute as default */
4132
4133
        {0x03, AC_VERB_SET_AMP_GAIN_MUTE, 0x27}, /* 0dB */
4133
4134
        {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x27}, /* 0dB */
4182
4183
 * 0x17 - built-in mic
4183
4184
 */
4184
4185
 
4185
 
static struct hda_verb ad1984a_thinkpad_verbs[] = {
 
4186
static const struct hda_verb ad1984a_thinkpad_verbs[] = {
4186
4187
        /* HP unmute */
4187
4188
        {0x11, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
4188
4189
        /* analog mix */
4199
4200
        { } /* end */
4200
4201
};
4201
4202
 
4202
 
static struct snd_kcontrol_new ad1984a_thinkpad_mixers[] = {
 
4203
static const struct snd_kcontrol_new ad1984a_thinkpad_mixers[] = {
4203
4204
        HDA_CODEC_VOLUME("Master Playback Volume", 0x21, 0x0, HDA_OUTPUT),
4204
4205
        HDA_CODEC_MUTE("Master Playback Switch", 0x21, 0x0, HDA_OUTPUT),
4205
4206
        HDA_CODEC_VOLUME("PCM Playback Volume", 0x20, 0x5, HDA_INPUT),
4220
4221
        { } /* end */
4221
4222
};
4222
4223
 
4223
 
static struct hda_input_mux ad1984a_thinkpad_capture_source = {
 
4224
static const struct hda_input_mux ad1984a_thinkpad_capture_source = {
4224
4225
        .num_items = 3,
4225
4226
        .items = {
4226
4227
                { "Mic", 0x0 },
4263
4264
 * 0x15 - mic-in
4264
4265
 */
4265
4266
 
4266
 
static struct hda_verb ad1984a_precision_verbs[] = {
 
4267
static const struct hda_verb ad1984a_precision_verbs[] = {
4267
4268
        /* Unmute main output path */
4268
4269
        {0x03, AC_VERB_SET_AMP_GAIN_MUTE, 0x27}, /* 0dB */
4269
4270
        {0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE + 0x1f}, /* 0dB */
4289
4290
        { } /* end */
4290
4291
};
4291
4292
 
4292
 
static struct snd_kcontrol_new ad1984a_precision_mixers[] = {
 
4293
static const struct snd_kcontrol_new ad1984a_precision_mixers[] = {
4293
4294
        HDA_CODEC_VOLUME("Master Playback Volume", 0x21, 0x0, HDA_OUTPUT),
4294
4295
        HDA_CODEC_MUTE("Master Playback Switch", 0x21, 0x0, HDA_OUTPUT),
4295
4296
        HDA_CODEC_VOLUME("PCM Playback Volume", 0x20, 0x5, HDA_INPUT),
4345
4346
 * digital-mic (0x17) - Internal mic
4346
4347
 */
4347
4348
 
4348
 
static struct hda_verb ad1984a_touchsmart_verbs[] = {
 
4349
static const struct hda_verb ad1984a_touchsmart_verbs[] = {
4349
4350
        /* DACs; unmute as default */
4350
4351
        {0x03, AC_VERB_SET_AMP_GAIN_MUTE, 0x27}, /* 0dB */
4351
4352
        {0x04, AC_VERB_SET_AMP_GAIN_MUTE, 0x27}, /* 0dB */
4397
4398
        { } /* end */
4398
4399
};
4399
4400
 
4400
 
static struct snd_kcontrol_new ad1984a_touchsmart_mixers[] = {
 
4401
static const struct snd_kcontrol_new ad1984a_touchsmart_mixers[] = {
4401
4402
        HDA_CODEC_VOLUME("Master Playback Volume", 0x21, 0x0, HDA_OUTPUT),
4402
4403
/*      HDA_CODEC_MUTE("Master Playback Switch", 0x21, 0x0, HDA_OUTPUT),*/
4403
4404
        {
4476
4477
        [AD1984A_PRECISION]     = "precision",
4477
4478
};
4478
4479
 
4479
 
static struct snd_pci_quirk ad1884a_cfg_tbl[] = {
 
4480
static const struct snd_pci_quirk ad1884a_cfg_tbl[] = {
4480
4481
        SND_PCI_QUIRK(0x1028, 0x04ac, "Precision R5500", AD1984A_PRECISION),
4481
4482
        SND_PCI_QUIRK(0x103c, 0x3030, "HP", AD1884A_MOBILE),
4482
4483
        SND_PCI_QUIRK(0x103c, 0x3037, "HP 2230s", AD1884A_LAPTOP),
4615
4616
 * port-G - rear clfe-out (6stack)
4616
4617
 */
4617
4618
 
4618
 
static hda_nid_t ad1882_dac_nids[3] = {
 
4619
static const hda_nid_t ad1882_dac_nids[3] = {
4619
4620
        0x04, 0x03, 0x05
4620
4621
};
4621
4622
 
4622
 
static hda_nid_t ad1882_adc_nids[2] = {
 
4623
static const hda_nid_t ad1882_adc_nids[2] = {
4623
4624
        0x08, 0x09,
4624
4625
};
4625
4626
 
4626
 
static hda_nid_t ad1882_capsrc_nids[2] = {
 
4627
static const hda_nid_t ad1882_capsrc_nids[2] = {
4627
4628
        0x0c, 0x0d,
4628
4629
};
4629
4630
 
4630
4631
#define AD1882_SPDIF_OUT        0x02
4631
4632
 
4632
4633
/* list: 0x11, 0x39, 0x3a, 0x18, 0x3c, 0x3b, 0x12, 0x20 */
4633
 
static struct hda_input_mux ad1882_capture_source = {
 
4634
static const struct hda_input_mux ad1882_capture_source = {
4634
4635
        .num_items = 5,
4635
4636
        .items = {
4636
4637
                { "Front Mic", 0x1 },
4642
4643
};
4643
4644
 
4644
4645
/* list: 0x11, 0x39, 0x3a, 0x3c, 0x18, 0x1f, 0x12, 0x20 */
4645
 
static struct hda_input_mux ad1882a_capture_source = {
 
4646
static const struct hda_input_mux ad1882a_capture_source = {
4646
4647
        .num_items = 5,
4647
4648
        .items = {
4648
4649
                { "Front Mic", 0x1 },
4653
4654
        },
4654
4655
};
4655
4656
 
4656
 
static struct snd_kcontrol_new ad1882_base_mixers[] = {
 
4657
static const struct snd_kcontrol_new ad1882_base_mixers[] = {
4657
4658
        HDA_CODEC_VOLUME("Front Playback Volume", 0x04, 0x0, HDA_OUTPUT),
4658
4659
        HDA_CODEC_VOLUME("Surround Playback Volume", 0x03, 0x0, HDA_OUTPUT),
4659
4660
        HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x05, 1, 0x0, HDA_OUTPUT),
4695
4696
        { } /* end */
4696
4697
};
4697
4698
 
4698
 
static struct snd_kcontrol_new ad1882_loopback_mixers[] = {
 
4699
static const struct snd_kcontrol_new ad1882_loopback_mixers[] = {
4699
4700
        HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x20, 0x00, HDA_INPUT),
4700
4701
        HDA_CODEC_MUTE("Front Mic Playback Switch", 0x20, 0x00, HDA_INPUT),
4701
4702
        HDA_CODEC_VOLUME("Mic Playback Volume", 0x20, 0x01, HDA_INPUT),
4707
4708
        { } /* end */
4708
4709
};
4709
4710
 
4710
 
static struct snd_kcontrol_new ad1882a_loopback_mixers[] = {
 
4711
static const struct snd_kcontrol_new ad1882a_loopback_mixers[] = {
4711
4712
        HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x20, 0x00, HDA_INPUT),
4712
4713
        HDA_CODEC_MUTE("Front Mic Playback Switch", 0x20, 0x00, HDA_INPUT),
4713
4714
        HDA_CODEC_VOLUME("Mic Playback Volume", 0x20, 0x04, HDA_INPUT),
4720
4721
        { } /* end */
4721
4722
};
4722
4723
 
4723
 
static struct snd_kcontrol_new ad1882_3stack_mixers[] = {
 
4724
static const struct snd_kcontrol_new ad1882_3stack_mixers[] = {
4724
4725
        HDA_CODEC_MUTE("Surround Playback Switch", 0x15, 0x0, HDA_OUTPUT),
4725
4726
        HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x17, 1, 0x0, HDA_OUTPUT),
4726
4727
        HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x17, 2, 0x0, HDA_OUTPUT),
4734
4735
        { } /* end */
4735
4736
};
4736
4737
 
4737
 
static struct snd_kcontrol_new ad1882_6stack_mixers[] = {
 
4738
static const struct snd_kcontrol_new ad1882_6stack_mixers[] = {
4738
4739
        HDA_CODEC_MUTE("Surround Playback Switch", 0x16, 0x0, HDA_OUTPUT),
4739
4740
        HDA_CODEC_MUTE_MONO("Center Playback Switch", 0x24, 1, 0x0, HDA_OUTPUT),
4740
4741
        HDA_CODEC_MUTE_MONO("LFE Playback Switch", 0x24, 2, 0x0, HDA_OUTPUT),
4741
4742
        { } /* end */
4742
4743
};
4743
4744
 
4744
 
static struct hda_verb ad1882_ch2_init[] = {
 
4745
static const struct hda_verb ad1882_ch2_init[] = {
4745
4746
        {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
4746
4747
        {0x2c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
4747
4748
        {0x2c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
4751
4752
        { } /* end */
4752
4753
};
4753
4754
 
4754
 
static struct hda_verb ad1882_ch4_init[] = {
 
4755
static const struct hda_verb ad1882_ch4_init[] = {
4755
4756
        {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4756
4757
        {0x2c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4757
4758
        {0x2c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4761
4762
        { } /* end */
4762
4763
};
4763
4764
 
4764
 
static struct hda_verb ad1882_ch6_init[] = {
 
4765
static const struct hda_verb ad1882_ch6_init[] = {
4765
4766
        {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
4766
4767
        {0x2c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
4767
4768
        {0x2c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
4771
4772
        { } /* end */
4772
4773
};
4773
4774
 
4774
 
static struct hda_channel_mode ad1882_modes[3] = {
 
4775
static const struct hda_channel_mode ad1882_modes[3] = {
4775
4776
        { 2, ad1882_ch2_init },
4776
4777
        { 4, ad1882_ch4_init },
4777
4778
        { 6, ad1882_ch6_init },
4780
4781
/*
4781
4782
 * initialization verbs
4782
4783
 */
4783
 
static struct hda_verb ad1882_init_verbs[] = {
 
4784
static const struct hda_verb ad1882_init_verbs[] = {
4784
4785
        /* DACs; mute as default */
4785
4786
        {0x03, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4786
4787
        {0x04, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
4849
4850
};
4850
4851
 
4851
4852
#ifdef CONFIG_SND_HDA_POWER_SAVE
4852
 
static struct hda_amp_list ad1882_loopbacks[] = {
 
4853
static const struct hda_amp_list ad1882_loopbacks[] = {
4853
4854
        { 0x20, HDA_INPUT, 0 }, /* Front Mic */
4854
4855
        { 0x20, HDA_INPUT, 1 }, /* Mic */
4855
4856
        { 0x20, HDA_INPUT, 4 }, /* Line */
4946
4947
/*
4947
4948
 * patch entries
4948
4949
 */
4949
 
static struct hda_codec_preset snd_hda_preset_analog[] = {
 
4950
static const struct hda_codec_preset snd_hda_preset_analog[] = {
4950
4951
        { .id = 0x11d4184a, .name = "AD1884A", .patch = patch_ad1884a },
4951
4952
        { .id = 0x11d41882, .name = "AD1882", .patch = patch_ad1882 },
4952
4953
        { .id = 0x11d41883, .name = "AD1883", .patch = patch_ad1884a },