aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/ac97
diff options
context:
space:
mode:
authorGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
committerGlenn Elliott <gelliott@cs.unc.edu>2012-03-04 19:47:13 -0500
commitc71c03bda1e86c9d5198c5d83f712e695c4f2a1e (patch)
treeecb166cb3e2b7e2adb3b5e292245fefd23381ac8 /sound/pci/ac97
parentea53c912f8a86a8567697115b6a0d8152beee5c8 (diff)
parent6a00f206debf8a5c8899055726ad127dbeeed098 (diff)
Merge branch 'mpi-master' into wip-k-fmlpwip-k-fmlp
Conflicts: litmus/sched_cedf.c
Diffstat (limited to 'sound/pci/ac97')
-rw-r--r--sound/pci/ac97/ac97_codec.c98
-rw-r--r--sound/pci/ac97/ac97_patch.c114
2 files changed, 142 insertions, 70 deletions
diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c
index a7630e9edf8a..7f4d619f4ddb 100644
--- a/sound/pci/ac97/ac97_codec.c
+++ b/sound/pci/ac97/ac97_codec.c
@@ -71,6 +71,12 @@ static const struct ac97_codec_id snd_ac97_codec_id_vendors[] = {
71{ 0x414b4d00, 0xffffff00, "Asahi Kasei", NULL, NULL }, 71{ 0x414b4d00, 0xffffff00, "Asahi Kasei", NULL, NULL },
72{ 0x414c4300, 0xffffff00, "Realtek", NULL, NULL }, 72{ 0x414c4300, 0xffffff00, "Realtek", NULL, NULL },
73{ 0x414c4700, 0xffffff00, "Realtek", NULL, NULL }, 73{ 0x414c4700, 0xffffff00, "Realtek", NULL, NULL },
74/*
75 * This is an _inofficial_ Aztech Labs entry
76 * (value might differ from unknown official Aztech ID),
77 * currently used by the AC97 emulation of the almost-AC97 PCI168 card.
78 */
79{ 0x415a5400, 0xffffff00, "Aztech Labs (emulated)", NULL, NULL },
74{ 0x434d4900, 0xffffff00, "C-Media Electronics", NULL, NULL }, 80{ 0x434d4900, 0xffffff00, "C-Media Electronics", NULL, NULL },
75{ 0x43525900, 0xffffff00, "Cirrus Logic", NULL, NULL }, 81{ 0x43525900, 0xffffff00, "Cirrus Logic", NULL, NULL },
76{ 0x43585400, 0xffffff00, "Conexant", NULL, NULL }, 82{ 0x43585400, 0xffffff00, "Conexant", NULL, NULL },
@@ -127,6 +133,7 @@ static const struct ac97_codec_id snd_ac97_codec_ids[] = {
127{ 0x414c4781, 0xffffffff, "ALC658D", NULL, NULL }, /* already patched */ 133{ 0x414c4781, 0xffffffff, "ALC658D", NULL, NULL }, /* already patched */
128{ 0x414c4780, 0xfffffff0, "ALC658", patch_alc655, NULL }, 134{ 0x414c4780, 0xfffffff0, "ALC658", patch_alc655, NULL },
129{ 0x414c4790, 0xfffffff0, "ALC850", patch_alc850, NULL }, 135{ 0x414c4790, 0xfffffff0, "ALC850", patch_alc850, NULL },
136{ 0x415a5401, 0xffffffff, "AZF3328", patch_aztech_azf3328, NULL },
130{ 0x434d4941, 0xffffffff, "CMI9738", patch_cm9738, NULL }, 137{ 0x434d4941, 0xffffffff, "CMI9738", patch_cm9738, NULL },
131{ 0x434d4961, 0xffffffff, "CMI9739", patch_cm9739, NULL }, 138{ 0x434d4961, 0xffffffff, "CMI9739", patch_cm9739, NULL },
132{ 0x434d4969, 0xffffffff, "CMI9780", patch_cm9780, NULL }, 139{ 0x434d4969, 0xffffffff, "CMI9780", patch_cm9780, NULL },
@@ -590,9 +597,9 @@ static int snd_ac97_put_volsw(struct snd_kcontrol *kcontrol,
590 snd_ac97_page_restore(ac97, page_save); 597 snd_ac97_page_restore(ac97, page_save);
591#ifdef CONFIG_SND_AC97_POWER_SAVE 598#ifdef CONFIG_SND_AC97_POWER_SAVE
592 /* check analog mixer power-down */ 599 /* check analog mixer power-down */
593 if ((val_mask & 0x8000) && 600 if ((val_mask & AC97_PD_EAPD) &&
594 (kcontrol->private_value & (1<<30))) { 601 (kcontrol->private_value & (1<<30))) {
595 if (val & 0x8000) 602 if (val & AC97_PD_EAPD)
596 ac97->power_up &= ~(1 << (reg>>1)); 603 ac97->power_up &= ~(1 << (reg>>1));
597 else 604 else
598 ac97->power_up |= 1 << (reg>>1); 605 ac97->power_up |= 1 << (reg>>1);
@@ -1014,8 +1021,7 @@ static int snd_ac97_free(struct snd_ac97 *ac97)
1014{ 1021{
1015 if (ac97) { 1022 if (ac97) {
1016#ifdef CONFIG_SND_AC97_POWER_SAVE 1023#ifdef CONFIG_SND_AC97_POWER_SAVE
1017 cancel_delayed_work(&ac97->power_work); 1024 cancel_delayed_work_sync(&ac97->power_work);
1018 flush_scheduled_work();
1019#endif 1025#endif
1020 snd_ac97_proc_done(ac97); 1026 snd_ac97_proc_done(ac97);
1021 if (ac97->bus) 1027 if (ac97->bus)
@@ -1036,20 +1042,20 @@ static int snd_ac97_dev_free(struct snd_device *device)
1036 1042
1037static int snd_ac97_try_volume_mix(struct snd_ac97 * ac97, int reg) 1043static int snd_ac97_try_volume_mix(struct snd_ac97 * ac97, int reg)
1038{ 1044{
1039 unsigned short val, mask = 0x8000; 1045 unsigned short val, mask = AC97_MUTE_MASK_MONO;
1040 1046
1041 if (! snd_ac97_valid_reg(ac97, reg)) 1047 if (! snd_ac97_valid_reg(ac97, reg))
1042 return 0; 1048 return 0;
1043 1049
1044 switch (reg) { 1050 switch (reg) {
1045 case AC97_MASTER_TONE: 1051 case AC97_MASTER_TONE:
1046 return ac97->caps & 0x04 ? 1 : 0; 1052 return ac97->caps & AC97_BC_BASS_TREBLE ? 1 : 0;
1047 case AC97_HEADPHONE: 1053 case AC97_HEADPHONE:
1048 return ac97->caps & 0x10 ? 1 : 0; 1054 return ac97->caps & AC97_BC_HEADPHONE ? 1 : 0;
1049 case AC97_REC_GAIN_MIC: 1055 case AC97_REC_GAIN_MIC:
1050 return ac97->caps & 0x01 ? 1 : 0; 1056 return ac97->caps & AC97_BC_DEDICATED_MIC ? 1 : 0;
1051 case AC97_3D_CONTROL: 1057 case AC97_3D_CONTROL:
1052 if (ac97->caps & 0x7c00) { 1058 if (ac97->caps & AC97_BC_3D_TECH_ID_MASK) {
1053 val = snd_ac97_read(ac97, reg); 1059 val = snd_ac97_read(ac97, reg);
1054 /* if nonzero - fixed and we can't set it */ 1060 /* if nonzero - fixed and we can't set it */
1055 return val == 0; 1061 return val == 0;
@@ -1105,7 +1111,10 @@ static void check_volume_resolution(struct snd_ac97 *ac97, int reg, unsigned cha
1105 *lo_max = *hi_max = 0; 1111 *lo_max = *hi_max = 0;
1106 for (i = 0 ; i < ARRAY_SIZE(cbit); i++) { 1112 for (i = 0 ; i < ARRAY_SIZE(cbit); i++) {
1107 unsigned short val; 1113 unsigned short val;
1108 snd_ac97_write(ac97, reg, 0x8080 | cbit[i] | (cbit[i] << 8)); 1114 snd_ac97_write(
1115 ac97, reg,
1116 AC97_MUTE_MASK_STEREO | cbit[i] | (cbit[i] << 8)
1117 );
1109 /* Do the read twice due to buffers on some ac97 codecs. 1118 /* Do the read twice due to buffers on some ac97 codecs.
1110 * e.g. The STAC9704 returns exactly what you wrote to the register 1119 * e.g. The STAC9704 returns exactly what you wrote to the register
1111 * if you read it immediately. This causes the detect routine to fail. 1120 * if you read it immediately. This causes the detect routine to fail.
@@ -1140,14 +1149,14 @@ static void snd_ac97_change_volume_params2(struct snd_ac97 * ac97, int reg, int
1140 unsigned short val, val1; 1149 unsigned short val, val1;
1141 1150
1142 *max = 63; 1151 *max = 63;
1143 val = 0x8080 | (0x20 << shift); 1152 val = AC97_MUTE_MASK_STEREO | (0x20 << shift);
1144 snd_ac97_write(ac97, reg, val); 1153 snd_ac97_write(ac97, reg, val);
1145 val1 = snd_ac97_read(ac97, reg); 1154 val1 = snd_ac97_read(ac97, reg);
1146 if (val != val1) { 1155 if (val != val1) {
1147 *max = 31; 1156 *max = 31;
1148 } 1157 }
1149 /* reset volume to zero */ 1158 /* reset volume to zero */
1150 snd_ac97_write_cache(ac97, reg, 0x8080); 1159 snd_ac97_write_cache(ac97, reg, AC97_MUTE_MASK_STEREO);
1151} 1160}
1152 1161
1153static inline int printable(unsigned int x) 1162static inline int printable(unsigned int x)
@@ -1184,16 +1193,16 @@ static int snd_ac97_cmute_new_stereo(struct snd_card *card, char *name, int reg,
1184 if (! snd_ac97_valid_reg(ac97, reg)) 1193 if (! snd_ac97_valid_reg(ac97, reg))
1185 return 0; 1194 return 0;
1186 1195
1187 mute_mask = 0x8000; 1196 mute_mask = AC97_MUTE_MASK_MONO;
1188 val = snd_ac97_read(ac97, reg); 1197 val = snd_ac97_read(ac97, reg);
1189 if (check_stereo || (ac97->flags & AC97_STEREO_MUTES)) { 1198 if (check_stereo || (ac97->flags & AC97_STEREO_MUTES)) {
1190 /* check whether both mute bits work */ 1199 /* check whether both mute bits work */
1191 val1 = val | 0x8080; 1200 val1 = val | AC97_MUTE_MASK_STEREO;
1192 snd_ac97_write(ac97, reg, val1); 1201 snd_ac97_write(ac97, reg, val1);
1193 if (val1 == snd_ac97_read(ac97, reg)) 1202 if (val1 == snd_ac97_read(ac97, reg))
1194 mute_mask = 0x8080; 1203 mute_mask = AC97_MUTE_MASK_STEREO;
1195 } 1204 }
1196 if (mute_mask == 0x8080) { 1205 if (mute_mask == AC97_MUTE_MASK_STEREO) {
1197 struct snd_kcontrol_new tmp = AC97_DOUBLE(name, reg, 15, 7, 1, 1); 1206 struct snd_kcontrol_new tmp = AC97_DOUBLE(name, reg, 15, 7, 1, 1);
1198 if (check_amix) 1207 if (check_amix)
1199 tmp.private_value |= (1 << 30); 1208 tmp.private_value |= (1 << 30);
@@ -1269,9 +1278,11 @@ static int snd_ac97_cvol_new(struct snd_card *card, char *name, int reg, unsigne
1269 err = snd_ctl_add(card, kctl); 1278 err = snd_ctl_add(card, kctl);
1270 if (err < 0) 1279 if (err < 0)
1271 return err; 1280 return err;
1272 snd_ac97_write_cache(ac97, reg, 1281 snd_ac97_write_cache(
1273 (snd_ac97_read(ac97, reg) & 0x8080) | 1282 ac97, reg,
1274 lo_max | (hi_max << 8)); 1283 (snd_ac97_read(ac97, reg) & AC97_MUTE_MASK_STEREO)
1284 | lo_max | (hi_max << 8)
1285 );
1275 return 0; 1286 return 0;
1276} 1287}
1277 1288
@@ -1333,7 +1344,7 @@ static int snd_ac97_mixer_build(struct snd_ac97 * ac97)
1333 return err; 1344 return err;
1334 } 1345 }
1335 1346
1336 ac97->regs[AC97_CENTER_LFE_MASTER] = 0x8080; 1347 ac97->regs[AC97_CENTER_LFE_MASTER] = AC97_MUTE_MASK_STEREO;
1337 1348
1338 /* build center controls */ 1349 /* build center controls */
1339 if ((snd_ac97_try_volume_mix(ac97, AC97_CENTER_LFE_MASTER)) 1350 if ((snd_ac97_try_volume_mix(ac97, AC97_CENTER_LFE_MASTER))
@@ -1411,8 +1422,12 @@ static int snd_ac97_mixer_build(struct snd_ac97 * ac97)
1411 if ((err = snd_ctl_add(card, kctl = snd_ac97_cnew(&snd_ac97_controls_pc_beep[idx], ac97))) < 0) 1422 if ((err = snd_ctl_add(card, kctl = snd_ac97_cnew(&snd_ac97_controls_pc_beep[idx], ac97))) < 0)
1412 return err; 1423 return err;
1413 set_tlv_db_scale(kctl, db_scale_4bit); 1424 set_tlv_db_scale(kctl, db_scale_4bit);
1414 snd_ac97_write_cache(ac97, AC97_PC_BEEP, 1425 snd_ac97_write_cache(
1415 snd_ac97_read(ac97, AC97_PC_BEEP) | 0x801e); 1426 ac97,
1427 AC97_PC_BEEP,
1428 (snd_ac97_read(ac97, AC97_PC_BEEP)
1429 | AC97_MUTE_MASK_MONO | 0x001e)
1430 );
1416 } 1431 }
1417 1432
1418 /* build Phone controls */ 1433 /* build Phone controls */
@@ -1546,7 +1561,7 @@ static int snd_ac97_mixer_build(struct snd_ac97 * ac97)
1546 } 1561 }
1547 1562
1548 /* build Simulated Stereo Enhancement control */ 1563 /* build Simulated Stereo Enhancement control */
1549 if (ac97->caps & 0x0008) { 1564 if (ac97->caps & AC97_BC_SIM_STEREO) {
1550 if ((err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_general[AC97_GENERAL_STEREO_ENHANCEMENT], ac97))) < 0) 1565 if ((err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_general[AC97_GENERAL_STEREO_ENHANCEMENT], ac97))) < 0)
1551 return err; 1566 return err;
1552 } 1567 }
@@ -1558,7 +1573,7 @@ static int snd_ac97_mixer_build(struct snd_ac97 * ac97)
1558 } 1573 }
1559 1574
1560 /* build Loudness control */ 1575 /* build Loudness control */
1561 if (ac97->caps & 0x0020) { 1576 if (ac97->caps & AC97_BC_LOUDNESS) {
1562 if ((err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_general[AC97_GENERAL_LOUDNESS], ac97))) < 0) 1577 if ((err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_general[AC97_GENERAL_LOUDNESS], ac97))) < 0)
1563 return err; 1578 return err;
1564 } 1579 }
@@ -1962,7 +1977,7 @@ static int snd_ac97_dev_disconnect(struct snd_device *device)
1962} 1977}
1963 1978
1964/* build_ops to do nothing */ 1979/* build_ops to do nothing */
1965static struct snd_ac97_build_ops null_build_ops; 1980static const struct snd_ac97_build_ops null_build_ops;
1966 1981
1967#ifdef CONFIG_SND_AC97_POWER_SAVE 1982#ifdef CONFIG_SND_AC97_POWER_SAVE
1968static void do_update_power(struct work_struct *work) 1983static void do_update_power(struct work_struct *work)
@@ -2456,8 +2471,7 @@ void snd_ac97_suspend(struct snd_ac97 *ac97)
2456 if (ac97->build_ops->suspend) 2471 if (ac97->build_ops->suspend)
2457 ac97->build_ops->suspend(ac97); 2472 ac97->build_ops->suspend(ac97);
2458#ifdef CONFIG_SND_AC97_POWER_SAVE 2473#ifdef CONFIG_SND_AC97_POWER_SAVE
2459 cancel_delayed_work(&ac97->power_work); 2474 cancel_delayed_work_sync(&ac97->power_work);
2460 flush_scheduled_work();
2461#endif 2475#endif
2462 snd_ac97_powerdown(ac97); 2476 snd_ac97_powerdown(ac97);
2463} 2477}
@@ -2544,8 +2558,8 @@ void snd_ac97_resume(struct snd_ac97 *ac97)
2544 schedule_timeout_uninterruptible(1); 2558 schedule_timeout_uninterruptible(1);
2545 } while (time_after_eq(end_time, jiffies)); 2559 } while (time_after_eq(end_time, jiffies));
2546 /* FIXME: extra delay */ 2560 /* FIXME: extra delay */
2547 ac97->bus->ops->write(ac97, AC97_MASTER, 0x8000); 2561 ac97->bus->ops->write(ac97, AC97_MASTER, AC97_MUTE_MASK_MONO);
2548 if (snd_ac97_read(ac97, AC97_MASTER) != 0x8000) 2562 if (snd_ac97_read(ac97, AC97_MASTER) != AC97_MUTE_MASK_MONO)
2549 msleep(250); 2563 msleep(250);
2550 } else { 2564 } else {
2551 end_time = jiffies + msecs_to_jiffies(100); 2565 end_time = jiffies + msecs_to_jiffies(100);
@@ -2749,12 +2763,12 @@ static int master_mute_sw_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem
2749 int rshift = (kcontrol->private_value >> 12) & 0x0f; 2763 int rshift = (kcontrol->private_value >> 12) & 0x0f;
2750 unsigned short mask; 2764 unsigned short mask;
2751 if (shift != rshift) 2765 if (shift != rshift)
2752 mask = 0x8080; 2766 mask = AC97_MUTE_MASK_STEREO;
2753 else 2767 else
2754 mask = 0x8000; 2768 mask = AC97_MUTE_MASK_MONO;
2755 snd_ac97_update_bits(ac97, AC97_POWERDOWN, 0x8000, 2769 snd_ac97_update_bits(ac97, AC97_POWERDOWN, AC97_PD_EAPD,
2756 (ac97->regs[AC97_MASTER] & mask) == mask ? 2770 (ac97->regs[AC97_MASTER] & mask) == mask ?
2757 0x8000 : 0); 2771 AC97_PD_EAPD : 0);
2758 } 2772 }
2759 return err; 2773 return err;
2760} 2774}
@@ -2767,7 +2781,10 @@ static int tune_mute_led(struct snd_ac97 *ac97)
2767 return -ENOENT; 2781 return -ENOENT;
2768 msw->put = master_mute_sw_put; 2782 msw->put = master_mute_sw_put;
2769 snd_ac97_remove_ctl(ac97, "External Amplifier", NULL); 2783 snd_ac97_remove_ctl(ac97, "External Amplifier", NULL);
2770 snd_ac97_update_bits(ac97, AC97_POWERDOWN, 0x8000, 0x8000); /* mute LED on */ 2784 snd_ac97_update_bits(
2785 ac97, AC97_POWERDOWN,
2786 AC97_PD_EAPD, AC97_PD_EAPD /* mute LED on */
2787 );
2771 ac97->scaps |= AC97_SCAP_EAPD_LED; 2788 ac97->scaps |= AC97_SCAP_EAPD_LED;
2772 return 0; 2789 return 0;
2773} 2790}
@@ -2782,12 +2799,12 @@ static int hp_master_mute_sw_put(struct snd_kcontrol *kcontrol,
2782 int rshift = (kcontrol->private_value >> 12) & 0x0f; 2799 int rshift = (kcontrol->private_value >> 12) & 0x0f;
2783 unsigned short mask; 2800 unsigned short mask;
2784 if (shift != rshift) 2801 if (shift != rshift)
2785 mask = 0x8080; 2802 mask = AC97_MUTE_MASK_STEREO;
2786 else 2803 else
2787 mask = 0x8000; 2804 mask = AC97_MUTE_MASK_MONO;
2788 snd_ac97_update_bits(ac97, AC97_POWERDOWN, 0x8000, 2805 snd_ac97_update_bits(ac97, AC97_POWERDOWN, AC97_PD_EAPD,
2789 (ac97->regs[AC97_MASTER] & mask) == mask ? 2806 (ac97->regs[AC97_MASTER] & mask) == mask ?
2790 0x8000 : 0); 2807 AC97_PD_EAPD : 0);
2791 } 2808 }
2792 return err; 2809 return err;
2793} 2810}
@@ -2803,7 +2820,10 @@ static int tune_hp_mute_led(struct snd_ac97 *ac97)
2803 snd_ac97_remove_ctl(ac97, "External Amplifier", NULL); 2820 snd_ac97_remove_ctl(ac97, "External Amplifier", NULL);
2804 snd_ac97_remove_ctl(ac97, "Headphone Playback", "Switch"); 2821 snd_ac97_remove_ctl(ac97, "Headphone Playback", "Switch");
2805 snd_ac97_remove_ctl(ac97, "Headphone Playback", "Volume"); 2822 snd_ac97_remove_ctl(ac97, "Headphone Playback", "Volume");
2806 snd_ac97_update_bits(ac97, AC97_POWERDOWN, 0x8000, 0x8000); /* mute LED on */ 2823 snd_ac97_update_bits(
2824 ac97, AC97_POWERDOWN,
2825 AC97_PD_EAPD, AC97_PD_EAPD /* mute LED on */
2826 );
2807 return 0; 2827 return 0;
2808} 2828}
2809 2829
diff --git a/sound/pci/ac97/ac97_patch.c b/sound/pci/ac97/ac97_patch.c
index e68c98ef4041..200c9a1d48b7 100644
--- a/sound/pci/ac97/ac97_patch.c
+++ b/sound/pci/ac97/ac97_patch.c
@@ -27,6 +27,15 @@
27#include "ac97_patch.h" 27#include "ac97_patch.h"
28 28
29/* 29/*
30 * Forward declarations
31 */
32
33static struct snd_kcontrol *snd_ac97_find_mixer_ctl(struct snd_ac97 *ac97,
34 const char *name);
35static int snd_ac97_add_vmaster(struct snd_ac97 *ac97, char *name,
36 const unsigned int *tlv, const char **slaves);
37
38/*
30 * Chip specific initialization 39 * Chip specific initialization
31 */ 40 */
32 41
@@ -371,7 +380,7 @@ static int patch_yamaha_ymf743_build_spdif(struct snd_ac97 *ac97)
371 return 0; 380 return 0;
372} 381}
373 382
374static struct snd_ac97_build_ops patch_yamaha_ymf743_ops = { 383static const struct snd_ac97_build_ops patch_yamaha_ymf743_ops = {
375 .build_spdif = patch_yamaha_ymf743_build_spdif, 384 .build_spdif = patch_yamaha_ymf743_build_spdif,
376 .build_3d = patch_yamaha_ymf7x3_3d, 385 .build_3d = patch_yamaha_ymf7x3_3d,
377}; 386};
@@ -455,7 +464,7 @@ static int patch_yamaha_ymf753_post_spdif(struct snd_ac97 * ac97)
455 return 0; 464 return 0;
456} 465}
457 466
458static struct snd_ac97_build_ops patch_yamaha_ymf753_ops = { 467static const struct snd_ac97_build_ops patch_yamaha_ymf753_ops = {
459 .build_3d = patch_yamaha_ymf7x3_3d, 468 .build_3d = patch_yamaha_ymf7x3_3d,
460 .build_post_spdif = patch_yamaha_ymf753_post_spdif 469 .build_post_spdif = patch_yamaha_ymf753_post_spdif
461}; 470};
@@ -502,7 +511,7 @@ static int patch_wolfson_wm9703_specific(struct snd_ac97 * ac97)
502 return 0; 511 return 0;
503} 512}
504 513
505static struct snd_ac97_build_ops patch_wolfson_wm9703_ops = { 514static const struct snd_ac97_build_ops patch_wolfson_wm9703_ops = {
506 .build_specific = patch_wolfson_wm9703_specific, 515 .build_specific = patch_wolfson_wm9703_specific,
507}; 516};
508 517
@@ -533,7 +542,7 @@ static int patch_wolfson_wm9704_specific(struct snd_ac97 * ac97)
533 return 0; 542 return 0;
534} 543}
535 544
536static struct snd_ac97_build_ops patch_wolfson_wm9704_ops = { 545static const struct snd_ac97_build_ops patch_wolfson_wm9704_ops = {
537 .build_specific = patch_wolfson_wm9704_specific, 546 .build_specific = patch_wolfson_wm9704_specific,
538}; 547};
539 548
@@ -677,7 +686,7 @@ static int patch_wolfson_wm9711_specific(struct snd_ac97 * ac97)
677 return 0; 686 return 0;
678} 687}
679 688
680static struct snd_ac97_build_ops patch_wolfson_wm9711_ops = { 689static const struct snd_ac97_build_ops patch_wolfson_wm9711_ops = {
681 .build_specific = patch_wolfson_wm9711_specific, 690 .build_specific = patch_wolfson_wm9711_specific,
682}; 691};
683 692
@@ -871,7 +880,7 @@ static void patch_wolfson_wm9713_resume (struct snd_ac97 * ac97)
871} 880}
872#endif 881#endif
873 882
874static struct snd_ac97_build_ops patch_wolfson_wm9713_ops = { 883static const struct snd_ac97_build_ops patch_wolfson_wm9713_ops = {
875 .build_specific = patch_wolfson_wm9713_specific, 884 .build_specific = patch_wolfson_wm9713_specific,
876 .build_3d = patch_wolfson_wm9713_3d, 885 .build_3d = patch_wolfson_wm9713_3d,
877#ifdef CONFIG_PM 886#ifdef CONFIG_PM
@@ -976,7 +985,7 @@ static int patch_sigmatel_stac97xx_specific(struct snd_ac97 * ac97)
976 return 0; 985 return 0;
977} 986}
978 987
979static struct snd_ac97_build_ops patch_sigmatel_stac9700_ops = { 988static const struct snd_ac97_build_ops patch_sigmatel_stac9700_ops = {
980 .build_3d = patch_sigmatel_stac9700_3d, 989 .build_3d = patch_sigmatel_stac9700_3d,
981 .build_specific = patch_sigmatel_stac97xx_specific 990 .build_specific = patch_sigmatel_stac97xx_specific
982}; 991};
@@ -1023,7 +1032,7 @@ static int patch_sigmatel_stac9708_specific(struct snd_ac97 *ac97)
1023 return patch_sigmatel_stac97xx_specific(ac97); 1032 return patch_sigmatel_stac97xx_specific(ac97);
1024} 1033}
1025 1034
1026static struct snd_ac97_build_ops patch_sigmatel_stac9708_ops = { 1035static const struct snd_ac97_build_ops patch_sigmatel_stac9708_ops = {
1027 .build_3d = patch_sigmatel_stac9708_3d, 1036 .build_3d = patch_sigmatel_stac9708_3d,
1028 .build_specific = patch_sigmatel_stac9708_specific 1037 .build_specific = patch_sigmatel_stac9708_specific
1029}; 1038};
@@ -1252,7 +1261,7 @@ static int patch_sigmatel_stac9758_specific(struct snd_ac97 *ac97)
1252 return 0; 1261 return 0;
1253} 1262}
1254 1263
1255static struct snd_ac97_build_ops patch_sigmatel_stac9758_ops = { 1264static const struct snd_ac97_build_ops patch_sigmatel_stac9758_ops = {
1256 .build_3d = patch_sigmatel_stac9700_3d, 1265 .build_3d = patch_sigmatel_stac9700_3d,
1257 .build_specific = patch_sigmatel_stac9758_specific 1266 .build_specific = patch_sigmatel_stac9758_specific
1258}; 1267};
@@ -1327,7 +1336,7 @@ static int patch_cirrus_build_spdif(struct snd_ac97 * ac97)
1327 return 0; 1336 return 0;
1328} 1337}
1329 1338
1330static struct snd_ac97_build_ops patch_cirrus_ops = { 1339static const struct snd_ac97_build_ops patch_cirrus_ops = {
1331 .build_spdif = patch_cirrus_build_spdif 1340 .build_spdif = patch_cirrus_build_spdif
1332}; 1341};
1333 1342
@@ -1384,7 +1393,7 @@ static int patch_conexant_build_spdif(struct snd_ac97 * ac97)
1384 return 0; 1393 return 0;
1385} 1394}
1386 1395
1387static struct snd_ac97_build_ops patch_conexant_ops = { 1396static const struct snd_ac97_build_ops patch_conexant_ops = {
1388 .build_spdif = patch_conexant_build_spdif 1397 .build_spdif = patch_conexant_build_spdif
1389}; 1398};
1390 1399
@@ -1560,7 +1569,7 @@ static void patch_ad1881_chained(struct snd_ac97 * ac97, int unchained_idx, int
1560 } 1569 }
1561} 1570}
1562 1571
1563static struct snd_ac97_build_ops patch_ad1881_build_ops = { 1572static const struct snd_ac97_build_ops patch_ad1881_build_ops = {
1564#ifdef CONFIG_PM 1573#ifdef CONFIG_PM
1565 .resume = ad18xx_resume 1574 .resume = ad18xx_resume
1566#endif 1575#endif
@@ -1647,7 +1656,7 @@ static int patch_ad1885_specific(struct snd_ac97 * ac97)
1647 return 0; 1656 return 0;
1648} 1657}
1649 1658
1650static struct snd_ac97_build_ops patch_ad1885_build_ops = { 1659static const struct snd_ac97_build_ops patch_ad1885_build_ops = {
1651 .build_specific = &patch_ad1885_specific, 1660 .build_specific = &patch_ad1885_specific,
1652#ifdef CONFIG_PM 1661#ifdef CONFIG_PM
1653 .resume = ad18xx_resume 1662 .resume = ad18xx_resume
@@ -1674,7 +1683,7 @@ static int patch_ad1886_specific(struct snd_ac97 * ac97)
1674 return 0; 1683 return 0;
1675} 1684}
1676 1685
1677static struct snd_ac97_build_ops patch_ad1886_build_ops = { 1686static const struct snd_ac97_build_ops patch_ad1886_build_ops = {
1678 .build_specific = &patch_ad1886_specific, 1687 .build_specific = &patch_ad1886_specific,
1679#ifdef CONFIG_PM 1688#ifdef CONFIG_PM
1680 .resume = ad18xx_resume 1689 .resume = ad18xx_resume
@@ -1881,7 +1890,7 @@ static int patch_ad1981a_specific(struct snd_ac97 * ac97)
1881 ARRAY_SIZE(snd_ac97_ad1981x_jack_sense)); 1890 ARRAY_SIZE(snd_ac97_ad1981x_jack_sense));
1882} 1891}
1883 1892
1884static struct snd_ac97_build_ops patch_ad1981a_build_ops = { 1893static const struct snd_ac97_build_ops patch_ad1981a_build_ops = {
1885 .build_post_spdif = patch_ad198x_post_spdif, 1894 .build_post_spdif = patch_ad198x_post_spdif,
1886 .build_specific = patch_ad1981a_specific, 1895 .build_specific = patch_ad1981a_specific,
1887#ifdef CONFIG_PM 1896#ifdef CONFIG_PM
@@ -1936,7 +1945,7 @@ static int patch_ad1981b_specific(struct snd_ac97 *ac97)
1936 ARRAY_SIZE(snd_ac97_ad1981x_jack_sense)); 1945 ARRAY_SIZE(snd_ac97_ad1981x_jack_sense));
1937} 1946}
1938 1947
1939static struct snd_ac97_build_ops patch_ad1981b_build_ops = { 1948static const struct snd_ac97_build_ops patch_ad1981b_build_ops = {
1940 .build_post_spdif = patch_ad198x_post_spdif, 1949 .build_post_spdif = patch_ad198x_post_spdif,
1941 .build_specific = patch_ad1981b_specific, 1950 .build_specific = patch_ad1981b_specific,
1942#ifdef CONFIG_PM 1951#ifdef CONFIG_PM
@@ -2075,7 +2084,7 @@ static int patch_ad1888_specific(struct snd_ac97 *ac97)
2075 return patch_build_controls(ac97, snd_ac97_ad1888_controls, ARRAY_SIZE(snd_ac97_ad1888_controls)); 2084 return patch_build_controls(ac97, snd_ac97_ad1888_controls, ARRAY_SIZE(snd_ac97_ad1888_controls));
2076} 2085}
2077 2086
2078static struct snd_ac97_build_ops patch_ad1888_build_ops = { 2087static const struct snd_ac97_build_ops patch_ad1888_build_ops = {
2079 .build_post_spdif = patch_ad198x_post_spdif, 2088 .build_post_spdif = patch_ad198x_post_spdif,
2080 .build_specific = patch_ad1888_specific, 2089 .build_specific = patch_ad1888_specific,
2081#ifdef CONFIG_PM 2090#ifdef CONFIG_PM
@@ -2124,7 +2133,7 @@ static int patch_ad1980_specific(struct snd_ac97 *ac97)
2124 return patch_build_controls(ac97, &snd_ac97_ad198x_2cmic, 1); 2133 return patch_build_controls(ac97, &snd_ac97_ad198x_2cmic, 1);
2125} 2134}
2126 2135
2127static struct snd_ac97_build_ops patch_ad1980_build_ops = { 2136static const struct snd_ac97_build_ops patch_ad1980_build_ops = {
2128 .build_post_spdif = patch_ad198x_post_spdif, 2137 .build_post_spdif = patch_ad198x_post_spdif,
2129 .build_specific = patch_ad1980_specific, 2138 .build_specific = patch_ad1980_specific,
2130#ifdef CONFIG_PM 2139#ifdef CONFIG_PM
@@ -2239,7 +2248,7 @@ static int patch_ad1985_specific(struct snd_ac97 *ac97)
2239 ARRAY_SIZE(snd_ac97_ad1985_controls)); 2248 ARRAY_SIZE(snd_ac97_ad1985_controls));
2240} 2249}
2241 2250
2242static struct snd_ac97_build_ops patch_ad1985_build_ops = { 2251static const struct snd_ac97_build_ops patch_ad1985_build_ops = {
2243 .build_post_spdif = patch_ad198x_post_spdif, 2252 .build_post_spdif = patch_ad198x_post_spdif,
2244 .build_specific = patch_ad1985_specific, 2253 .build_specific = patch_ad1985_specific,
2245#ifdef CONFIG_PM 2254#ifdef CONFIG_PM
@@ -2531,7 +2540,7 @@ static int patch_ad1986_specific(struct snd_ac97 *ac97)
2531 ARRAY_SIZE(snd_ac97_ad1985_controls)); 2540 ARRAY_SIZE(snd_ac97_ad1985_controls));
2532} 2541}
2533 2542
2534static struct snd_ac97_build_ops patch_ad1986_build_ops = { 2543static const struct snd_ac97_build_ops patch_ad1986_build_ops = {
2535 .build_post_spdif = patch_ad198x_post_spdif, 2544 .build_post_spdif = patch_ad198x_post_spdif,
2536 .build_specific = patch_ad1986_specific, 2545 .build_specific = patch_ad1986_specific,
2537#ifdef CONFIG_PM 2546#ifdef CONFIG_PM
@@ -2636,7 +2645,7 @@ static int patch_alc650_specific(struct snd_ac97 * ac97)
2636 return 0; 2645 return 0;
2637} 2646}
2638 2647
2639static struct snd_ac97_build_ops patch_alc650_ops = { 2648static const struct snd_ac97_build_ops patch_alc650_ops = {
2640 .build_specific = patch_alc650_specific, 2649 .build_specific = patch_alc650_specific,
2641 .update_jacks = alc650_update_jacks 2650 .update_jacks = alc650_update_jacks
2642}; 2651};
@@ -2788,7 +2797,7 @@ static int patch_alc655_specific(struct snd_ac97 * ac97)
2788 return 0; 2797 return 0;
2789} 2798}
2790 2799
2791static struct snd_ac97_build_ops patch_alc655_ops = { 2800static const struct snd_ac97_build_ops patch_alc655_ops = {
2792 .build_specific = patch_alc655_specific, 2801 .build_specific = patch_alc655_specific,
2793 .update_jacks = alc655_update_jacks 2802 .update_jacks = alc655_update_jacks
2794}; 2803};
@@ -2900,7 +2909,7 @@ static int patch_alc850_specific(struct snd_ac97 *ac97)
2900 return 0; 2909 return 0;
2901} 2910}
2902 2911
2903static struct snd_ac97_build_ops patch_alc850_ops = { 2912static const struct snd_ac97_build_ops patch_alc850_ops = {
2904 .build_specific = patch_alc850_specific, 2913 .build_specific = patch_alc850_specific,
2905 .update_jacks = alc850_update_jacks 2914 .update_jacks = alc850_update_jacks
2906}; 2915};
@@ -2940,6 +2949,49 @@ static int patch_alc850(struct snd_ac97 *ac97)
2940 return 0; 2949 return 0;
2941} 2950}
2942 2951
2952static int patch_aztech_azf3328_specific(struct snd_ac97 *ac97)
2953{
2954 struct snd_kcontrol *kctl_3d_center =
2955 snd_ac97_find_mixer_ctl(ac97, "3D Control - Center");
2956 struct snd_kcontrol *kctl_3d_depth =
2957 snd_ac97_find_mixer_ctl(ac97, "3D Control - Depth");
2958
2959 /*
2960 * 3D register is different from AC97 standard layout
2961 * (also do some renaming, to resemble Windows driver naming)
2962 */
2963 if (kctl_3d_center) {
2964 kctl_3d_center->private_value =
2965 AC97_SINGLE_VALUE(AC97_3D_CONTROL, 1, 0x07, 0);
2966 snd_ac97_rename_vol_ctl(ac97,
2967 "3D Control - Center", "3D Control - Width"
2968 );
2969 }
2970 if (kctl_3d_depth)
2971 kctl_3d_depth->private_value =
2972 AC97_SINGLE_VALUE(AC97_3D_CONTROL, 8, 0x03, 0);
2973
2974 /* Aztech Windows driver calls the
2975 equivalent control "Modem Playback", thus rename it: */
2976 snd_ac97_rename_vol_ctl(ac97,
2977 "Master Mono Playback", "Modem Playback"
2978 );
2979 snd_ac97_rename_vol_ctl(ac97,
2980 "Headphone Playback", "FM Synth Playback"
2981 );
2982
2983 return 0;
2984}
2985
2986static const struct snd_ac97_build_ops patch_aztech_azf3328_ops = {
2987 .build_specific = patch_aztech_azf3328_specific
2988};
2989
2990static int patch_aztech_azf3328(struct snd_ac97 *ac97)
2991{
2992 ac97->build_ops = &patch_aztech_azf3328_ops;
2993 return 0;
2994}
2943 2995
2944/* 2996/*
2945 * C-Media CM97xx codecs 2997 * C-Media CM97xx codecs
@@ -2962,7 +3014,7 @@ static int patch_cm9738_specific(struct snd_ac97 * ac97)
2962 return patch_build_controls(ac97, snd_ac97_cm9738_controls, ARRAY_SIZE(snd_ac97_cm9738_controls)); 3014 return patch_build_controls(ac97, snd_ac97_cm9738_controls, ARRAY_SIZE(snd_ac97_cm9738_controls));
2963} 3015}
2964 3016
2965static struct snd_ac97_build_ops patch_cm9738_ops = { 3017static const struct snd_ac97_build_ops patch_cm9738_ops = {
2966 .build_specific = patch_cm9738_specific, 3018 .build_specific = patch_cm9738_specific,
2967 .update_jacks = cm9738_update_jacks 3019 .update_jacks = cm9738_update_jacks
2968}; 3020};
@@ -3053,7 +3105,7 @@ static int patch_cm9739_post_spdif(struct snd_ac97 * ac97)
3053 return patch_build_controls(ac97, snd_ac97_cm9739_controls_spdif, ARRAY_SIZE(snd_ac97_cm9739_controls_spdif)); 3105 return patch_build_controls(ac97, snd_ac97_cm9739_controls_spdif, ARRAY_SIZE(snd_ac97_cm9739_controls_spdif));
3054} 3106}
3055 3107
3056static struct snd_ac97_build_ops patch_cm9739_ops = { 3108static const struct snd_ac97_build_ops patch_cm9739_ops = {
3057 .build_specific = patch_cm9739_specific, 3109 .build_specific = patch_cm9739_specific,
3058 .build_post_spdif = patch_cm9739_post_spdif, 3110 .build_post_spdif = patch_cm9739_post_spdif,
3059 .update_jacks = cm9739_update_jacks 3111 .update_jacks = cm9739_update_jacks
@@ -3227,7 +3279,7 @@ static int patch_cm9761_specific(struct snd_ac97 * ac97)
3227 return patch_build_controls(ac97, snd_ac97_cm9761_controls, ARRAY_SIZE(snd_ac97_cm9761_controls)); 3279 return patch_build_controls(ac97, snd_ac97_cm9761_controls, ARRAY_SIZE(snd_ac97_cm9761_controls));
3228} 3280}
3229 3281
3230static struct snd_ac97_build_ops patch_cm9761_ops = { 3282static const struct snd_ac97_build_ops patch_cm9761_ops = {
3231 .build_specific = patch_cm9761_specific, 3283 .build_specific = patch_cm9761_specific,
3232 .build_post_spdif = patch_cm9761_post_spdif, 3284 .build_post_spdif = patch_cm9761_post_spdif,
3233 .update_jacks = cm9761_update_jacks 3285 .update_jacks = cm9761_update_jacks
@@ -3323,7 +3375,7 @@ static int patch_cm9780_specific(struct snd_ac97 *ac97)
3323 return patch_build_controls(ac97, cm9780_controls, ARRAY_SIZE(cm9780_controls)); 3375 return patch_build_controls(ac97, cm9780_controls, ARRAY_SIZE(cm9780_controls));
3324} 3376}
3325 3377
3326static struct snd_ac97_build_ops patch_cm9780_ops = { 3378static const struct snd_ac97_build_ops patch_cm9780_ops = {
3327 .build_specific = patch_cm9780_specific, 3379 .build_specific = patch_cm9780_specific,
3328 .build_post_spdif = patch_cm9761_post_spdif /* identical with CM9761 */ 3380 .build_post_spdif = patch_cm9761_post_spdif /* identical with CM9761 */
3329}; 3381};
@@ -3443,7 +3495,7 @@ static int patch_vt1616_specific(struct snd_ac97 * ac97)
3443 return 0; 3495 return 0;
3444} 3496}
3445 3497
3446static struct snd_ac97_build_ops patch_vt1616_ops = { 3498static const struct snd_ac97_build_ops patch_vt1616_ops = {
3447 .build_specific = patch_vt1616_specific 3499 .build_specific = patch_vt1616_specific
3448}; 3500};
3449 3501
@@ -3797,7 +3849,7 @@ static int patch_it2646_specific(struct snd_ac97 * ac97)
3797 return 0; 3849 return 0;
3798} 3850}
3799 3851
3800static struct snd_ac97_build_ops patch_it2646_ops = { 3852static const struct snd_ac97_build_ops patch_it2646_ops = {
3801 .build_specific = patch_it2646_specific, 3853 .build_specific = patch_it2646_specific,
3802 .update_jacks = it2646_update_jacks 3854 .update_jacks = it2646_update_jacks
3803}; 3855};
@@ -3831,7 +3883,7 @@ static int patch_si3036_specific(struct snd_ac97 * ac97)
3831 return 0; 3883 return 0;
3832} 3884}
3833 3885
3834static struct snd_ac97_build_ops patch_si3036_ops = { 3886static const struct snd_ac97_build_ops patch_si3036_ops = {
3835 .build_specific = patch_si3036_specific, 3887 .build_specific = patch_si3036_specific,
3836}; 3888};
3837 3889
@@ -3898,7 +3950,7 @@ static int patch_ucb1400_specific(struct snd_ac97 * ac97)
3898 return 0; 3950 return 0;
3899} 3951}
3900 3952
3901static struct snd_ac97_build_ops patch_ucb1400_ops = { 3953static const struct snd_ac97_build_ops patch_ucb1400_ops = {
3902 .build_specific = patch_ucb1400_specific, 3954 .build_specific = patch_ucb1400_specific,
3903}; 3955};
3904 3956