~ubuntu-branches/ubuntu/trusty/linux-linaro-omap/trusty

« back to all changes in this revision

Viewing changes to sound/pci/hda/patch_cirrus.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-57i0gl3v99b3lkfg
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:
51
51
        unsigned int cur_adc_format;
52
52
        hda_nid_t dig_in;
53
53
 
54
 
        struct hda_bind_ctls *capture_bind[2];
 
54
        const struct hda_bind_ctls *capture_bind[2];
55
55
 
56
56
        unsigned int gpio_mask;
57
57
        unsigned int gpio_dir;
231
231
 
232
232
/*
233
233
 */
234
 
static struct hda_pcm_stream cs_pcm_analog_playback = {
 
234
static const struct hda_pcm_stream cs_pcm_analog_playback = {
235
235
        .substreams = 1,
236
236
        .channels_min = 2,
237
237
        .channels_max = 2,
242
242
        },
243
243
};
244
244
 
245
 
static struct hda_pcm_stream cs_pcm_analog_capture = {
 
245
static const struct hda_pcm_stream cs_pcm_analog_capture = {
246
246
        .substreams = 1,
247
247
        .channels_min = 2,
248
248
        .channels_max = 2,
252
252
        },
253
253
};
254
254
 
255
 
static struct hda_pcm_stream cs_pcm_digital_playback = {
 
255
static const struct hda_pcm_stream cs_pcm_digital_playback = {
256
256
        .substreams = 1,
257
257
        .channels_min = 2,
258
258
        .channels_max = 2,
264
264
        },
265
265
};
266
266
 
267
 
static struct hda_pcm_stream cs_pcm_digital_capture = {
 
267
static const struct hda_pcm_stream cs_pcm_digital_capture = {
268
268
        .substreams = 1,
269
269
        .channels_min = 2,
270
270
        .channels_max = 2,
331
331
        struct cs_spec *spec = codec->spec;
332
332
        struct auto_pin_cfg *cfg = &spec->autocfg;
333
333
        hda_nid_t pin = cfg->inputs[idx].pin;
334
 
        unsigned int val = snd_hda_query_pin_caps(codec, pin);
335
 
        if (!(val & AC_PINCAP_PRES_DETECT))
 
334
        unsigned int val;
 
335
        if (!is_jack_detectable(codec, pin))
336
336
                return 0;
337
337
        val = snd_hda_codec_get_pincfg(codec, pin);
338
338
        return (snd_hda_get_input_pin_attr(val) != INPUT_PIN_ATTR_INT);
349
349
                hda_nid_t pins[2];
350
350
                unsigned int type;
351
351
                int j, nums;
352
 
                type = (get_wcaps(codec, nid) & AC_WCAP_TYPE)
353
 
                        >> AC_WCAP_TYPE_SHIFT;
 
352
                type = get_wcaps_type(get_wcaps(codec, nid));
354
353
                if (type != AC_WID_AUD_IN)
355
354
                        continue;
356
355
                nums = snd_hda_get_connections(codec, nid, pins,
559
558
        const char *name;
560
559
        int err, index;
561
560
        struct snd_kcontrol *kctl;
562
 
        static char *speakers[] = {
 
561
        static const char * const speakers[] = {
563
562
                "Front Speaker", "Surround Speaker", "Bass Speaker"
564
563
        };
565
 
        static char *line_outs[] = {
 
564
        static const char * const line_outs[] = {
566
565
                "Front Line-Out", "Surround Line-Out", "Bass Line-Out"
567
566
        };
568
567
 
642
641
/*
643
642
 */
644
643
 
645
 
static struct snd_kcontrol_new cs_capture_ctls[] = {
 
644
static const struct snd_kcontrol_new cs_capture_ctls[] = {
646
645
        HDA_BIND_SW("Capture Switch", 0),
647
646
        HDA_BIND_VOL("Capture Volume", 0),
648
647
};
710
709
        return change_cur_input(codec, idx, 0);
711
710
}
712
711
 
713
 
static struct snd_kcontrol_new cs_capture_source = {
 
712
static const struct snd_kcontrol_new cs_capture_source = {
714
713
        .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
715
714
        .name = "Capture Source",
716
715
        .access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
719
718
        .put = cs_capture_source_put,
720
719
};
721
720
 
722
 
static struct hda_bind_ctls *make_bind_capture(struct hda_codec *codec,
 
721
static const struct hda_bind_ctls *make_bind_capture(struct hda_codec *codec,
723
722
                                               struct hda_ctl_ops *ops)
724
723
{
725
724
        struct cs_spec *spec = codec->spec;
847
846
{
848
847
        struct cs_spec *spec = codec->spec;
849
848
        struct auto_pin_cfg *cfg = &spec->autocfg;
850
 
        unsigned int caps, hp_present;
 
849
        unsigned int hp_present;
851
850
        hda_nid_t nid;
852
851
        int i;
853
852
 
854
853
        hp_present = 0;
855
854
        for (i = 0; i < cfg->hp_outs; i++) {
856
855
                nid = cfg->hp_pins[i];
857
 
                caps = snd_hda_query_pin_caps(codec, nid);
858
 
                if (!(caps & AC_PINCAP_PRES_DETECT))
 
856
                if (!is_jack_detectable(codec, nid))
859
857
                        continue;
860
858
                hp_present = snd_hda_jack_detect(codec, nid);
861
859
                if (hp_present)
924
922
                                    AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
925
923
                if (!cfg->speaker_outs)
926
924
                        continue;
927
 
                if (get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP) {
 
925
                if (is_jack_detectable(codec, nid)) {
928
926
                        snd_hda_codec_write(codec, nid, 0,
929
927
                                            AC_VERB_SET_UNSOLICITED_ENABLE,
930
928
                                            AC_USRSP_EN | HP_EVENT);
983
981
        cs_vendor_coef_set(codec, IDX_ADC_CFG, coef);
984
982
}
985
983
 
986
 
static struct hda_verb cs_coef_init_verbs[] = {
 
984
static const struct hda_verb cs_coef_init_verbs[] = {
987
985
        {0x11, AC_VERB_SET_PROC_STATE, 1},
988
986
        {0x11, AC_VERB_SET_COEF_INDEX, IDX_DAC_CFG},
989
987
        {0x11, AC_VERB_SET_PROC_COEF,
1017
1015
 * blocks, which will alleviate the issue.
1018
1016
 */
1019
1017
 
1020
 
static struct hda_verb cs_errata_init_verbs[] = {
 
1018
static const struct hda_verb cs_errata_init_verbs[] = {
1021
1019
        {0x01, AC_VERB_SET_POWER_STATE, 0x00}, /* AFG: D0 */
1022
1020
        {0x11, AC_VERB_SET_PROC_STATE, 0x01},  /* VPW: processing on */
1023
1021
 
1126
1124
        }
1127
1125
}
1128
1126
 
1129
 
static struct hda_codec_ops cs_patch_ops = {
 
1127
static const struct hda_codec_ops cs_patch_ops = {
1130
1128
        .build_controls = cs_build_controls,
1131
1129
        .build_pcms = cs_build_pcms,
1132
1130
        .init = cs_init,
1166
1164
};
1167
1165
 
1168
1166
 
1169
 
static struct snd_pci_quirk cs420x_cfg_tbl[] = {
 
1167
static const struct snd_pci_quirk cs420x_cfg_tbl[] = {
1170
1168
        SND_PCI_QUIRK(0x10de, 0x0ac0, "MacBookPro 5,3", CS420X_MBP53),
1171
1169
        SND_PCI_QUIRK(0x10de, 0x0d94, "MacBookAir 3,1(2)", CS420X_MBP55),
1172
1170
        SND_PCI_QUIRK(0x10de, 0xcb79, "MacBookPro 5,5", CS420X_MBP55),
1180
1178
        u32 val;
1181
1179
};
1182
1180
 
1183
 
static struct cs_pincfg mbp53_pincfgs[] = {
 
1181
static const struct cs_pincfg mbp53_pincfgs[] = {
1184
1182
        { 0x09, 0x012b4050 },
1185
1183
        { 0x0a, 0x90100141 },
1186
1184
        { 0x0b, 0x90100140 },
1194
1192
        {} /* terminator */
1195
1193
};
1196
1194
 
1197
 
static struct cs_pincfg mbp55_pincfgs[] = {
 
1195
static const struct cs_pincfg mbp55_pincfgs[] = {
1198
1196
        { 0x09, 0x012b4030 },
1199
1197
        { 0x0a, 0x90100121 },
1200
1198
        { 0x0b, 0x90100120 },
1208
1206
        {} /* terminator */
1209
1207
};
1210
1208
 
1211
 
static struct cs_pincfg imac27_pincfgs[] = {
 
1209
static const struct cs_pincfg imac27_pincfgs[] = {
1212
1210
        { 0x09, 0x012b4050 },
1213
1211
        { 0x0a, 0x90100140 },
1214
1212
        { 0x0b, 0x90100142 },
1222
1220
        {} /* terminator */
1223
1221
};
1224
1222
 
1225
 
static struct cs_pincfg *cs_pincfgs[CS420X_MODELS] = {
 
1223
static const struct cs_pincfg *cs_pincfgs[CS420X_MODELS] = {
1226
1224
        [CS420X_MBP53] = mbp53_pincfgs,
1227
1225
        [CS420X_MBP55] = mbp55_pincfgs,
1228
1226
        [CS420X_IMAC27] = imac27_pincfgs,
1283
1281
/*
1284
1282
 * patch entries
1285
1283
 */
1286
 
static struct hda_codec_preset snd_hda_preset_cirrus[] = {
 
1284
static const struct hda_codec_preset snd_hda_preset_cirrus[] = {
1287
1285
        { .id = 0x10134206, .name = "CS4206", .patch = patch_cs420x },
1288
1286
        { .id = 0x10134207, .name = "CS4207", .patch = patch_cs420x },
1289
1287
        {} /* terminator */