aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_cirrus.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-05-23 11:52:38 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-05-23 11:52:38 -0400
commit710421cc7d295cc59eb2676fe2ba3bc3252c124e (patch)
tree4aa11cd7ee64b394871195cb585f16700553f540 /sound/pci/hda/patch_cirrus.c
parentd7ef64a9f9987b29e3d911369a9d40122d5be2dd (diff)
parentf686c74cc3e78349d16d46fc72807354574b1516 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6: (346 commits) ASoC: core: Don't set "(null)" as a driver name ALSA: hda - Use LPIB for ATI/AMD chipsets as default Revert "ALSA: hda - Use position_fix=3 as default for AMD chipsets" ASoC: Tegra: Fix compile when debugfs not enabled ASoC: spdif-dit: Add missing MODULE_* SOUND: OSS: Remove Au1550 driver. ALSA: hda - add Intel Panther Point HDMI codec id ALSA: emu10k1 - Add dB range to Bass and Treble for SB Live! ALSA: hda - Remove PCM mixer elements from Virtual Master of realtek ALSA: hda - Fix input-src parse in patch_analog.c ASoC: davinci-mcasp: enable ping-pong SRAM buffers ASoC: add iPAQ hx4700 machine driver ASoC: Asahi Kasei AK4641 codec driver ALSA: hda - Enable Realtek ALC269 codec input layer beep ALSA: intel8x0m: enable AMD8111 modem ALSA: HDA: Add jack detection for HDMI ALSA: sound, core, pcm_lib: fix xrun_log ASoC: Max98095: Move existing NULL check before pointer dereference. ALSA: sound, core, pcm_lib: xrun_log: log also in_interrupt ALSA: usb-audio - Add support for USB X-Fi S51 Pro ...
Diffstat (limited to 'sound/pci/hda/patch_cirrus.c')
-rw-r--r--sound/pci/hda/patch_cirrus.c52
1 files changed, 25 insertions, 27 deletions
diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c
index 067982f4f182..26a1521045bb 100644
--- a/sound/pci/hda/patch_cirrus.c
+++ b/sound/pci/hda/patch_cirrus.c
@@ -51,7 +51,7 @@ struct cs_spec {
51 unsigned int cur_adc_format; 51 unsigned int cur_adc_format;
52 hda_nid_t dig_in; 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 unsigned int gpio_mask; 56 unsigned int gpio_mask;
57 unsigned int gpio_dir; 57 unsigned int gpio_dir;
@@ -231,7 +231,7 @@ static int cs_capture_pcm_cleanup(struct hda_pcm_stream *hinfo,
231 231
232/* 232/*
233 */ 233 */
234static struct hda_pcm_stream cs_pcm_analog_playback = { 234static const struct hda_pcm_stream cs_pcm_analog_playback = {
235 .substreams = 1, 235 .substreams = 1,
236 .channels_min = 2, 236 .channels_min = 2,
237 .channels_max = 2, 237 .channels_max = 2,
@@ -242,7 +242,7 @@ static struct hda_pcm_stream cs_pcm_analog_playback = {
242 }, 242 },
243}; 243};
244 244
245static struct hda_pcm_stream cs_pcm_analog_capture = { 245static const struct hda_pcm_stream cs_pcm_analog_capture = {
246 .substreams = 1, 246 .substreams = 1,
247 .channels_min = 2, 247 .channels_min = 2,
248 .channels_max = 2, 248 .channels_max = 2,
@@ -252,7 +252,7 @@ static struct hda_pcm_stream cs_pcm_analog_capture = {
252 }, 252 },
253}; 253};
254 254
255static struct hda_pcm_stream cs_pcm_digital_playback = { 255static const struct hda_pcm_stream cs_pcm_digital_playback = {
256 .substreams = 1, 256 .substreams = 1,
257 .channels_min = 2, 257 .channels_min = 2,
258 .channels_max = 2, 258 .channels_max = 2,
@@ -264,7 +264,7 @@ static struct hda_pcm_stream cs_pcm_digital_playback = {
264 }, 264 },
265}; 265};
266 266
267static struct hda_pcm_stream cs_pcm_digital_capture = { 267static const struct hda_pcm_stream cs_pcm_digital_capture = {
268 .substreams = 1, 268 .substreams = 1,
269 .channels_min = 2, 269 .channels_min = 2,
270 .channels_max = 2, 270 .channels_max = 2,
@@ -331,8 +331,8 @@ static int is_ext_mic(struct hda_codec *codec, unsigned int idx)
331 struct cs_spec *spec = codec->spec; 331 struct cs_spec *spec = codec->spec;
332 struct auto_pin_cfg *cfg = &spec->autocfg; 332 struct auto_pin_cfg *cfg = &spec->autocfg;
333 hda_nid_t pin = cfg->inputs[idx].pin; 333 hda_nid_t pin = cfg->inputs[idx].pin;
334 unsigned int val = snd_hda_query_pin_caps(codec, pin); 334 unsigned int val;
335 if (!(val & AC_PINCAP_PRES_DETECT)) 335 if (!is_jack_detectable(codec, pin))
336 return 0; 336 return 0;
337 val = snd_hda_codec_get_pincfg(codec, pin); 337 val = snd_hda_codec_get_pincfg(codec, pin);
338 return (snd_hda_get_input_pin_attr(val) != INPUT_PIN_ATTR_INT); 338 return (snd_hda_get_input_pin_attr(val) != INPUT_PIN_ATTR_INT);
@@ -349,8 +349,7 @@ static hda_nid_t get_adc(struct hda_codec *codec, hda_nid_t pin,
349 hda_nid_t pins[2]; 349 hda_nid_t pins[2];
350 unsigned int type; 350 unsigned int type;
351 int j, nums; 351 int j, nums;
352 type = (get_wcaps(codec, nid) & AC_WCAP_TYPE) 352 type = get_wcaps_type(get_wcaps(codec, nid));
353 >> AC_WCAP_TYPE_SHIFT;
354 if (type != AC_WID_AUD_IN) 353 if (type != AC_WID_AUD_IN)
355 continue; 354 continue;
356 nums = snd_hda_get_connections(codec, nid, pins, 355 nums = snd_hda_get_connections(codec, nid, pins,
@@ -559,10 +558,10 @@ static int add_output(struct hda_codec *codec, hda_nid_t dac, int idx,
559 const char *name; 558 const char *name;
560 int err, index; 559 int err, index;
561 struct snd_kcontrol *kctl; 560 struct snd_kcontrol *kctl;
562 static char *speakers[] = { 561 static const char * const speakers[] = {
563 "Front Speaker", "Surround Speaker", "Bass Speaker" 562 "Front Speaker", "Surround Speaker", "Bass Speaker"
564 }; 563 };
565 static char *line_outs[] = { 564 static const char * const line_outs[] = {
566 "Front Line-Out", "Surround Line-Out", "Bass Line-Out" 565 "Front Line-Out", "Surround Line-Out", "Bass Line-Out"
567 }; 566 };
568 567
@@ -642,7 +641,7 @@ static int build_output(struct hda_codec *codec)
642/* 641/*
643 */ 642 */
644 643
645static struct snd_kcontrol_new cs_capture_ctls[] = { 644static const struct snd_kcontrol_new cs_capture_ctls[] = {
646 HDA_BIND_SW("Capture Switch", 0), 645 HDA_BIND_SW("Capture Switch", 0),
647 HDA_BIND_VOL("Capture Volume", 0), 646 HDA_BIND_VOL("Capture Volume", 0),
648}; 647};
@@ -710,7 +709,7 @@ static int cs_capture_source_put(struct snd_kcontrol *kcontrol,
710 return change_cur_input(codec, idx, 0); 709 return change_cur_input(codec, idx, 0);
711} 710}
712 711
713static struct snd_kcontrol_new cs_capture_source = { 712static const struct snd_kcontrol_new cs_capture_source = {
714 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 713 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
715 .name = "Capture Source", 714 .name = "Capture Source",
716 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, 715 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
@@ -719,7 +718,7 @@ static struct snd_kcontrol_new cs_capture_source = {
719 .put = cs_capture_source_put, 718 .put = cs_capture_source_put,
720}; 719};
721 720
722static struct hda_bind_ctls *make_bind_capture(struct hda_codec *codec, 721static const struct hda_bind_ctls *make_bind_capture(struct hda_codec *codec,
723 struct hda_ctl_ops *ops) 722 struct hda_ctl_ops *ops)
724{ 723{
725 struct cs_spec *spec = codec->spec; 724 struct cs_spec *spec = codec->spec;
@@ -847,15 +846,14 @@ static void cs_automute(struct hda_codec *codec)
847{ 846{
848 struct cs_spec *spec = codec->spec; 847 struct cs_spec *spec = codec->spec;
849 struct auto_pin_cfg *cfg = &spec->autocfg; 848 struct auto_pin_cfg *cfg = &spec->autocfg;
850 unsigned int caps, hp_present; 849 unsigned int hp_present;
851 hda_nid_t nid; 850 hda_nid_t nid;
852 int i; 851 int i;
853 852
854 hp_present = 0; 853 hp_present = 0;
855 for (i = 0; i < cfg->hp_outs; i++) { 854 for (i = 0; i < cfg->hp_outs; i++) {
856 nid = cfg->hp_pins[i]; 855 nid = cfg->hp_pins[i];
857 caps = snd_hda_query_pin_caps(codec, nid); 856 if (!is_jack_detectable(codec, nid))
858 if (!(caps & AC_PINCAP_PRES_DETECT))
859 continue; 857 continue;
860 hp_present = snd_hda_jack_detect(codec, nid); 858 hp_present = snd_hda_jack_detect(codec, nid);
861 if (hp_present) 859 if (hp_present)
@@ -924,7 +922,7 @@ static void init_output(struct hda_codec *codec)
924 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP); 922 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP);
925 if (!cfg->speaker_outs) 923 if (!cfg->speaker_outs)
926 continue; 924 continue;
927 if (get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP) { 925 if (is_jack_detectable(codec, nid)) {
928 snd_hda_codec_write(codec, nid, 0, 926 snd_hda_codec_write(codec, nid, 0,
929 AC_VERB_SET_UNSOLICITED_ENABLE, 927 AC_VERB_SET_UNSOLICITED_ENABLE,
930 AC_USRSP_EN | HP_EVENT); 928 AC_USRSP_EN | HP_EVENT);
@@ -983,7 +981,7 @@ static void init_input(struct hda_codec *codec)
983 cs_vendor_coef_set(codec, IDX_ADC_CFG, coef); 981 cs_vendor_coef_set(codec, IDX_ADC_CFG, coef);
984} 982}
985 983
986static struct hda_verb cs_coef_init_verbs[] = { 984static const struct hda_verb cs_coef_init_verbs[] = {
987 {0x11, AC_VERB_SET_PROC_STATE, 1}, 985 {0x11, AC_VERB_SET_PROC_STATE, 1},
988 {0x11, AC_VERB_SET_COEF_INDEX, IDX_DAC_CFG}, 986 {0x11, AC_VERB_SET_COEF_INDEX, IDX_DAC_CFG},
989 {0x11, AC_VERB_SET_PROC_COEF, 987 {0x11, AC_VERB_SET_PROC_COEF,
@@ -1017,7 +1015,7 @@ static struct hda_verb cs_coef_init_verbs[] = {
1017 * blocks, which will alleviate the issue. 1015 * blocks, which will alleviate the issue.
1018 */ 1016 */
1019 1017
1020static struct hda_verb cs_errata_init_verbs[] = { 1018static const struct hda_verb cs_errata_init_verbs[] = {
1021 {0x01, AC_VERB_SET_POWER_STATE, 0x00}, /* AFG: D0 */ 1019 {0x01, AC_VERB_SET_POWER_STATE, 0x00}, /* AFG: D0 */
1022 {0x11, AC_VERB_SET_PROC_STATE, 0x01}, /* VPW: processing on */ 1020 {0x11, AC_VERB_SET_PROC_STATE, 0x01}, /* VPW: processing on */
1023 1021
@@ -1126,7 +1124,7 @@ static void cs_unsol_event(struct hda_codec *codec, unsigned int res)
1126 } 1124 }
1127} 1125}
1128 1126
1129static struct hda_codec_ops cs_patch_ops = { 1127static const struct hda_codec_ops cs_patch_ops = {
1130 .build_controls = cs_build_controls, 1128 .build_controls = cs_build_controls,
1131 .build_pcms = cs_build_pcms, 1129 .build_pcms = cs_build_pcms,
1132 .init = cs_init, 1130 .init = cs_init,
@@ -1166,7 +1164,7 @@ static const char * const cs420x_models[CS420X_MODELS] = {
1166}; 1164};
1167 1165
1168 1166
1169static struct snd_pci_quirk cs420x_cfg_tbl[] = { 1167static const struct snd_pci_quirk cs420x_cfg_tbl[] = {
1170 SND_PCI_QUIRK(0x10de, 0x0ac0, "MacBookPro 5,3", CS420X_MBP53), 1168 SND_PCI_QUIRK(0x10de, 0x0ac0, "MacBookPro 5,3", CS420X_MBP53),
1171 SND_PCI_QUIRK(0x10de, 0x0d94, "MacBookAir 3,1(2)", CS420X_MBP55), 1169 SND_PCI_QUIRK(0x10de, 0x0d94, "MacBookAir 3,1(2)", CS420X_MBP55),
1172 SND_PCI_QUIRK(0x10de, 0xcb79, "MacBookPro 5,5", CS420X_MBP55), 1170 SND_PCI_QUIRK(0x10de, 0xcb79, "MacBookPro 5,5", CS420X_MBP55),
@@ -1180,7 +1178,7 @@ struct cs_pincfg {
1180 u32 val; 1178 u32 val;
1181}; 1179};
1182 1180
1183static struct cs_pincfg mbp53_pincfgs[] = { 1181static const struct cs_pincfg mbp53_pincfgs[] = {
1184 { 0x09, 0x012b4050 }, 1182 { 0x09, 0x012b4050 },
1185 { 0x0a, 0x90100141 }, 1183 { 0x0a, 0x90100141 },
1186 { 0x0b, 0x90100140 }, 1184 { 0x0b, 0x90100140 },
@@ -1194,7 +1192,7 @@ static struct cs_pincfg mbp53_pincfgs[] = {
1194 {} /* terminator */ 1192 {} /* terminator */
1195}; 1193};
1196 1194
1197static struct cs_pincfg mbp55_pincfgs[] = { 1195static const struct cs_pincfg mbp55_pincfgs[] = {
1198 { 0x09, 0x012b4030 }, 1196 { 0x09, 0x012b4030 },
1199 { 0x0a, 0x90100121 }, 1197 { 0x0a, 0x90100121 },
1200 { 0x0b, 0x90100120 }, 1198 { 0x0b, 0x90100120 },
@@ -1208,7 +1206,7 @@ static struct cs_pincfg mbp55_pincfgs[] = {
1208 {} /* terminator */ 1206 {} /* terminator */
1209}; 1207};
1210 1208
1211static struct cs_pincfg imac27_pincfgs[] = { 1209static const struct cs_pincfg imac27_pincfgs[] = {
1212 { 0x09, 0x012b4050 }, 1210 { 0x09, 0x012b4050 },
1213 { 0x0a, 0x90100140 }, 1211 { 0x0a, 0x90100140 },
1214 { 0x0b, 0x90100142 }, 1212 { 0x0b, 0x90100142 },
@@ -1222,7 +1220,7 @@ static struct cs_pincfg imac27_pincfgs[] = {
1222 {} /* terminator */ 1220 {} /* terminator */
1223}; 1221};
1224 1222
1225static struct cs_pincfg *cs_pincfgs[CS420X_MODELS] = { 1223static const struct cs_pincfg *cs_pincfgs[CS420X_MODELS] = {
1226 [CS420X_MBP53] = mbp53_pincfgs, 1224 [CS420X_MBP53] = mbp53_pincfgs,
1227 [CS420X_MBP55] = mbp55_pincfgs, 1225 [CS420X_MBP55] = mbp55_pincfgs,
1228 [CS420X_IMAC27] = imac27_pincfgs, 1226 [CS420X_IMAC27] = imac27_pincfgs,
@@ -1283,7 +1281,7 @@ static int patch_cs420x(struct hda_codec *codec)
1283/* 1281/*
1284 * patch entries 1282 * patch entries
1285 */ 1283 */
1286static struct hda_codec_preset snd_hda_preset_cirrus[] = { 1284static const struct hda_codec_preset snd_hda_preset_cirrus[] = {
1287 { .id = 0x10134206, .name = "CS4206", .patch = patch_cs420x }, 1285 { .id = 0x10134206, .name = "CS4206", .patch = patch_cs420x },
1288 { .id = 0x10134207, .name = "CS4207", .patch = patch_cs420x }, 1286 { .id = 0x10134207, .name = "CS4207", .patch = patch_cs420x },
1289 {} /* terminator */ 1287 {} /* terminator */