aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pobox.com>2005-09-01 18:02:01 -0400
committerJeff Garzik <jgarzik@pobox.com>2005-09-01 18:02:01 -0400
commite3ee3b78f83688a0ae4315e8be71b2eac559904a (patch)
treedeb03bcdd020262af450ed23382d7c921263f5cf /sound/pci
parent91cb70c1769d9b72dd1efe40c31f01005820b09e (diff)
parent6b39374a27eb4be7e9d82145ae270ba02ea90dc8 (diff)
/spare/repo/netdev-2.6 branch 'master'
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/Kconfig10
-rw-r--r--sound/pci/ac97/Makefile2
-rw-r--r--sound/pci/ac97/ac97_bus.c79
-rw-r--r--sound/pci/ac97/ac97_codec.c85
-rw-r--r--sound/pci/ac97/ac97_patch.c449
-rw-r--r--sound/pci/ac97/ac97_patch.h1
-rw-r--r--sound/pci/ali5451/ali5451.c6
-rw-r--r--sound/pci/atiixp.c10
-rw-r--r--sound/pci/au88x0/au88x0_pcm.c10
-rw-r--r--sound/pci/ca0106/ca0106_main.c8
-rw-r--r--sound/pci/ca0106/ca0106_mixer.c4
-rw-r--r--sound/pci/cmipci.c2
-rw-r--r--sound/pci/cs46xx/cs46xx.c2
-rw-r--r--sound/pci/cs46xx/cs46xx_lib.c18
-rw-r--r--sound/pci/emu10k1/emu10k1.c2
-rw-r--r--sound/pci/emu10k1/emu10k1_main.c8
-rw-r--r--sound/pci/emu10k1/emu10k1x.c4
-rw-r--r--sound/pci/emu10k1/emufx.c26
-rw-r--r--sound/pci/emu10k1/emumixer.c23
-rw-r--r--sound/pci/emu10k1/emupcm.c7
-rw-r--r--sound/pci/ens1370.c2
-rw-r--r--sound/pci/fm801.c8
-rw-r--r--sound/pci/hda/Makefile2
-rw-r--r--sound/pci/hda/hda_codec.c97
-rw-r--r--sound/pci/hda/hda_codec.h1
-rw-r--r--sound/pci/hda/hda_generic.c5
-rw-r--r--sound/pci/hda/hda_intel.c157
-rw-r--r--sound/pci/hda/hda_patch.h3
-rw-r--r--sound/pci/hda/patch_analog.c4
-rw-r--r--sound/pci/hda/patch_cmedia.c1
-rw-r--r--sound/pci/hda/patch_realtek.c9
-rw-r--r--sound/pci/hda/patch_si3054.c300
-rw-r--r--sound/pci/ice1712/delta.c10
-rw-r--r--sound/pci/ice1712/ice1712.c10
-rw-r--r--sound/pci/ice1712/ice1724.c6
-rw-r--r--sound/pci/intel8x0.c57
-rw-r--r--sound/pci/korg1212/korg1212.c4
-rw-r--r--sound/pci/nm256/nm256.c93
-rw-r--r--sound/pci/rme32.c4
-rw-r--r--sound/pci/rme96.c4
-rw-r--r--sound/pci/rme9652/hdsp.c55
-rw-r--r--sound/pci/rme9652/hdspm.c33
-rw-r--r--sound/pci/rme9652/rme9652.c24
-rw-r--r--sound/pci/trident/trident_main.c10
-rw-r--r--sound/pci/via82xx.c17
-rw-r--r--sound/pci/via82xx_modem.c3
-rw-r--r--sound/pci/ymfpci/ymfpci_main.c232
47 files changed, 1483 insertions, 424 deletions
diff --git a/sound/pci/Kconfig b/sound/pci/Kconfig
index 26b42bb20a0a..1e458919cce6 100644
--- a/sound/pci/Kconfig
+++ b/sound/pci/Kconfig
@@ -1,11 +1,15 @@
1# ALSA PCI drivers 1# ALSA PCI drivers
2 2
3menu "PCI devices"
4 depends on SND!=n && PCI
5
6config SND_AC97_CODEC 3config SND_AC97_CODEC
7 tristate 4 tristate
8 select SND_PCM 5 select SND_PCM
6 select SND_AC97_BUS
7
8config SND_AC97_BUS
9 tristate
10
11menu "PCI devices"
12 depends on SND!=n && PCI
9 13
10config SND_ALI5451 14config SND_ALI5451
11 tristate "ALi M5451 PCI Audio Controller" 15 tristate "ALi M5451 PCI Audio Controller"
diff --git a/sound/pci/ac97/Makefile b/sound/pci/ac97/Makefile
index 3c3222122d8b..77b3482cb133 100644
--- a/sound/pci/ac97/Makefile
+++ b/sound/pci/ac97/Makefile
@@ -10,9 +10,11 @@ snd-ac97-codec-objs += ac97_proc.o
10endif 10endif
11 11
12snd-ak4531-codec-objs := ak4531_codec.o 12snd-ak4531-codec-objs := ak4531_codec.o
13snd-ac97-bus-objs := ac97_bus.o
13 14
14# Toplevel Module Dependency 15# Toplevel Module Dependency
15obj-$(CONFIG_SND_AC97_CODEC) += snd-ac97-codec.o 16obj-$(CONFIG_SND_AC97_CODEC) += snd-ac97-codec.o
16obj-$(CONFIG_SND_ENS1370) += snd-ak4531-codec.o 17obj-$(CONFIG_SND_ENS1370) += snd-ak4531-codec.o
18obj-$(CONFIG_SND_AC97_BUS) += snd-ac97-bus.o
17 19
18obj-m := $(sort $(obj-m)) 20obj-m := $(sort $(obj-m))
diff --git a/sound/pci/ac97/ac97_bus.c b/sound/pci/ac97/ac97_bus.c
new file mode 100644
index 000000000000..227f8b9f67ce
--- /dev/null
+++ b/sound/pci/ac97/ac97_bus.c
@@ -0,0 +1,79 @@
1/*
2 * Linux driver model AC97 bus interface
3 *
4 * Author: Nicolas Pitre
5 * Created: Jan 14, 2005
6 * Copyright: (C) MontaVista Software Inc.
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
12 */
13
14#include <linux/module.h>
15#include <linux/init.h>
16#include <linux/device.h>
17#include <linux/string.h>
18
19/*
20 * Codec families have names seperated by commas, so we search for an
21 * individual codec name within the family string.
22 */
23static int ac97_bus_match(struct device *dev, struct device_driver *drv)
24{
25 return (strstr(dev->bus_id, drv->name) != NULL);
26}
27
28static int ac97_bus_suspend(struct device *dev, pm_message_t state)
29{
30 int ret = 0;
31
32 if (dev->driver && dev->driver->suspend) {
33 ret = dev->driver->suspend(dev, state, SUSPEND_DISABLE);
34 if (ret == 0)
35 ret = dev->driver->suspend(dev, state, SUSPEND_SAVE_STATE);
36 if (ret == 0)
37 ret = dev->driver->suspend(dev, state, SUSPEND_POWER_DOWN);
38 }
39 return ret;
40}
41
42static int ac97_bus_resume(struct device *dev)
43{
44 int ret = 0;
45
46 if (dev->driver && dev->driver->resume) {
47 ret = dev->driver->resume(dev, RESUME_POWER_ON);
48 if (ret == 0)
49 ret = dev->driver->resume(dev, RESUME_RESTORE_STATE);
50 if (ret == 0)
51 ret = dev->driver->resume(dev, RESUME_ENABLE);
52 }
53 return ret;
54}
55
56struct bus_type ac97_bus_type = {
57 .name = "ac97",
58 .match = ac97_bus_match,
59 .suspend = ac97_bus_suspend,
60 .resume = ac97_bus_resume,
61};
62
63static int __init ac97_bus_init(void)
64{
65 return bus_register(&ac97_bus_type);
66}
67
68subsys_initcall(ac97_bus_init);
69
70static void __exit ac97_bus_exit(void)
71{
72 bus_unregister(&ac97_bus_type);
73}
74
75module_exit(ac97_bus_exit);
76
77EXPORT_SYMBOL(ac97_bus_type);
78
79MODULE_LICENSE("GPL");
diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c
index 6983eea226da..5501f4440c92 100644
--- a/sound/pci/ac97/ac97_codec.c
+++ b/sound/pci/ac97/ac97_codec.c
@@ -157,6 +157,7 @@ static const ac97_codec_id_t snd_ac97_codec_ids[] = {
157{ 0x54524123, 0xffffffff, "TR28602", NULL, NULL }, // only guess --jk [TR28023 = eMicro EM28023 (new CT1297)] 157{ 0x54524123, 0xffffffff, "TR28602", NULL, NULL }, // only guess --jk [TR28023 = eMicro EM28023 (new CT1297)]
158{ 0x54584e20, 0xffffffff, "TLC320AD9xC", NULL, NULL }, 158{ 0x54584e20, 0xffffffff, "TLC320AD9xC", NULL, NULL },
159{ 0x56494161, 0xffffffff, "VIA1612A", NULL, NULL }, // modified ICE1232 with S/PDIF 159{ 0x56494161, 0xffffffff, "VIA1612A", NULL, NULL }, // modified ICE1232 with S/PDIF
160{ 0x56494170, 0xffffffff, "VIA1617A", patch_vt1617a, NULL }, // modified VT1616 with S/PDIF
160{ 0x57454301, 0xffffffff, "W83971D", NULL, NULL }, 161{ 0x57454301, 0xffffffff, "W83971D", NULL, NULL },
161{ 0x574d4c00, 0xffffffff, "WM9701A", NULL, NULL }, 162{ 0x574d4c00, 0xffffffff, "WM9701A", NULL, NULL },
162{ 0x574d4C03, 0xffffffff, "WM9703,WM9707,WM9708,WM9717", patch_wolfson03, NULL}, 163{ 0x574d4C03, 0xffffffff, "WM9703,WM9707,WM9708,WM9717", patch_wolfson03, NULL},
@@ -1307,16 +1308,18 @@ static int snd_ac97_mixer_build(ac97_t * ac97)
1307 } 1308 }
1308 1309
1309 /* build master tone controls */ 1310 /* build master tone controls */
1310 if (snd_ac97_try_volume_mix(ac97, AC97_MASTER_TONE)) { 1311 if (!(ac97->flags & AC97_HAS_NO_TONE)) {
1311 for (idx = 0; idx < 2; idx++) { 1312 if (snd_ac97_try_volume_mix(ac97, AC97_MASTER_TONE)) {
1312 if ((err = snd_ctl_add(card, kctl = snd_ac97_cnew(&snd_ac97_controls_tone[idx], ac97))) < 0) 1313 for (idx = 0; idx < 2; idx++) {
1313 return err; 1314 if ((err = snd_ctl_add(card, kctl = snd_ac97_cnew(&snd_ac97_controls_tone[idx], ac97))) < 0)
1314 if (ac97->id == AC97_ID_YMF753) { 1315 return err;
1315 kctl->private_value &= ~(0xff << 16); 1316 if (ac97->id == AC97_ID_YMF753) {
1316 kctl->private_value |= 7 << 16; 1317 kctl->private_value &= ~(0xff << 16);
1318 kctl->private_value |= 7 << 16;
1319 }
1317 } 1320 }
1321 snd_ac97_write_cache(ac97, AC97_MASTER_TONE, 0x0f0f);
1318 } 1322 }
1319 snd_ac97_write_cache(ac97, AC97_MASTER_TONE, 0x0f0f);
1320 } 1323 }
1321 1324
1322 /* build PC Speaker controls */ 1325 /* build PC Speaker controls */
@@ -1339,11 +1342,13 @@ static int snd_ac97_mixer_build(ac97_t * ac97)
1339 } 1342 }
1340 1343
1341 /* build MIC controls */ 1344 /* build MIC controls */
1342 if (snd_ac97_try_volume_mix(ac97, AC97_MIC)) { 1345 if (!(ac97->flags & AC97_HAS_NO_MIC)) {
1343 if ((err = snd_ac97_cmix_new(card, "Mic Playback", AC97_MIC, ac97)) < 0) 1346 if (snd_ac97_try_volume_mix(ac97, AC97_MIC)) {
1344 return err; 1347 if ((err = snd_ac97_cmix_new(card, "Mic Playback", AC97_MIC, ac97)) < 0)
1345 if ((err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_mic_boost, ac97))) < 0) 1348 return err;
1346 return err; 1349 if ((err = snd_ctl_add(card, snd_ac97_cnew(&snd_ac97_controls_mic_boost, ac97))) < 0)
1350 return err;
1351 }
1347 } 1352 }
1348 1353
1349 /* build Line controls */ 1354 /* build Line controls */
@@ -1402,12 +1407,14 @@ static int snd_ac97_mixer_build(ac97_t * ac97)
1402 } 1407 }
1403 snd_ac97_write_cache(ac97, AC97_PCM, init_val); 1408 snd_ac97_write_cache(ac97, AC97_PCM, init_val);
1404 } else { 1409 } else {
1405 if (ac97->flags & AC97_HAS_NO_PCM_VOL) 1410 if (!(ac97->flags & AC97_HAS_NO_STD_PCM)) {
1406 err = snd_ac97_cmute_new(card, "PCM Playback Switch", AC97_PCM, ac97); 1411 if (ac97->flags & AC97_HAS_NO_PCM_VOL)
1407 else 1412 err = snd_ac97_cmute_new(card, "PCM Playback Switch", AC97_PCM, ac97);
1408 err = snd_ac97_cmix_new(card, "PCM Playback", AC97_PCM, ac97); 1413 else
1409 if (err < 0) 1414 err = snd_ac97_cmix_new(card, "PCM Playback", AC97_PCM, ac97);
1410 return err; 1415 if (err < 0)
1416 return err;
1417 }
1411 } 1418 }
1412 1419
1413 /* build Capture controls */ 1420 /* build Capture controls */
@@ -1807,6 +1814,39 @@ int snd_ac97_bus(snd_card_t *card, int num, ac97_bus_ops_t *ops,
1807 return 0; 1814 return 0;
1808} 1815}
1809 1816
1817/* stop no dev release warning */
1818static void ac97_device_release(struct device * dev)
1819{
1820}
1821
1822/* register ac97 codec to bus */
1823static int snd_ac97_dev_register(snd_device_t *device)
1824{
1825 ac97_t *ac97 = device->device_data;
1826 int err;
1827
1828 ac97->dev.bus = &ac97_bus_type;
1829 ac97->dev.parent = ac97->bus->card->dev;
1830 ac97->dev.platform_data = ac97;
1831 ac97->dev.release = ac97_device_release;
1832 snprintf(ac97->dev.bus_id, BUS_ID_SIZE, "card%d-%d", ac97->bus->card->number, ac97->num);
1833 if ((err = device_register(&ac97->dev)) < 0) {
1834 snd_printk(KERN_ERR "Can't register ac97 bus\n");
1835 ac97->dev.bus = NULL;
1836 return err;
1837 }
1838 return 0;
1839}
1840
1841/* unregister ac97 codec */
1842static int snd_ac97_dev_unregister(snd_device_t *device)
1843{
1844 ac97_t *ac97 = device->device_data;
1845 if (ac97->dev.bus)
1846 device_unregister(&ac97->dev);
1847 return snd_ac97_free(ac97);
1848}
1849
1810/* build_ops to do nothing */ 1850/* build_ops to do nothing */
1811static struct snd_ac97_build_ops null_build_ops; 1851static struct snd_ac97_build_ops null_build_ops;
1812 1852
@@ -1840,6 +1880,8 @@ int snd_ac97_mixer(ac97_bus_t *bus, ac97_template_t *template, ac97_t **rac97)
1840 const ac97_codec_id_t *pid; 1880 const ac97_codec_id_t *pid;
1841 static snd_device_ops_t ops = { 1881 static snd_device_ops_t ops = {
1842 .dev_free = snd_ac97_dev_free, 1882 .dev_free = snd_ac97_dev_free,
1883 .dev_register = snd_ac97_dev_register,
1884 .dev_unregister = snd_ac97_dev_unregister,
1843 }; 1885 };
1844 1886
1845 snd_assert(rac97 != NULL, return -EINVAL); 1887 snd_assert(rac97 != NULL, return -EINVAL);
@@ -2539,8 +2581,6 @@ int snd_ac97_tune_hardware(ac97_t *ac97, struct ac97_quirk *quirk, const char *o
2539{ 2581{
2540 int result; 2582 int result;
2541 2583
2542 snd_assert(quirk, return -EINVAL);
2543
2544 /* quirk overriden? */ 2584 /* quirk overriden? */
2545 if (override && strcmp(override, "-1") && strcmp(override, "default")) { 2585 if (override && strcmp(override, "-1") && strcmp(override, "default")) {
2546 result = apply_quirk_str(ac97, override); 2586 result = apply_quirk_str(ac97, override);
@@ -2549,6 +2589,9 @@ int snd_ac97_tune_hardware(ac97_t *ac97, struct ac97_quirk *quirk, const char *o
2549 return result; 2589 return result;
2550 } 2590 }
2551 2591
2592 if (! quirk)
2593 return -EINVAL;
2594
2552 for (; quirk->subvendor; quirk++) { 2595 for (; quirk->subvendor; quirk++) {
2553 if (quirk->subvendor != ac97->subsystem_vendor) 2596 if (quirk->subvendor != ac97->subsystem_vendor)
2554 continue; 2597 continue;
diff --git a/sound/pci/ac97/ac97_patch.c b/sound/pci/ac97/ac97_patch.c
index 66edc857d3e6..b584172c1104 100644
--- a/sound/pci/ac97/ac97_patch.c
+++ b/sound/pci/ac97/ac97_patch.c
@@ -370,141 +370,387 @@ int patch_yamaha_ymf753(ac97_t * ac97)
370 * added support for WM9705,WM9708,WM9709,WM9710,WM9711,WM9712 and WM9717. 370 * added support for WM9705,WM9708,WM9709,WM9710,WM9711,WM9712 and WM9717.
371 */ 371 */
372 372
373int patch_wolfson03(ac97_t * ac97) 373static const snd_kcontrol_new_t wm97xx_snd_ac97_controls[] = {
374AC97_DOUBLE("Front Playback Volume", AC97_WM97XX_FMIXER_VOL, 8, 0, 31, 1),
375AC97_SINGLE("Front Playback Switch", AC97_WM97XX_FMIXER_VOL, 15, 1, 1),
376};
377
378static int patch_wolfson_wm9703_specific(ac97_t * ac97)
374{ 379{
375 /* This is known to work for the ViewSonic ViewPad 1000 380 /* This is known to work for the ViewSonic ViewPad 1000
376 Randolph Bentson <bentson@holmsjoen.com> */ 381 * Randolph Bentson <bentson@holmsjoen.com>
382 * WM9703/9707/9708/9717
383 */
384 int err, i;
385
386 for (i = 0; i < ARRAY_SIZE(wm97xx_snd_ac97_controls); i++) {
387 if ((err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&wm97xx_snd_ac97_controls[i], ac97))) < 0)
388 return err;
389 }
390 snd_ac97_write_cache(ac97, AC97_WM97XX_FMIXER_VOL, 0x0808);
391 return 0;
392}
393
394static struct snd_ac97_build_ops patch_wolfson_wm9703_ops = {
395 .build_specific = patch_wolfson_wm9703_specific,
396};
377 397
378 // WM9703/9707/9708/9717 398int patch_wolfson03(ac97_t * ac97)
379 snd_ac97_write_cache(ac97, AC97_WM97XX_FMIXER_VOL, 0x0808); 399{
380 snd_ac97_write_cache(ac97, AC97_GENERAL_PURPOSE, 0x8000); 400 ac97->build_ops = &patch_wolfson_wm9703_ops;
381 return 0; 401 return 0;
382} 402}
383 403
384int patch_wolfson04(ac97_t * ac97) 404static const snd_kcontrol_new_t wm9704_snd_ac97_controls[] = {
405AC97_DOUBLE("Front Playback Volume", AC97_WM97XX_FMIXER_VOL, 8, 0, 31, 1),
406AC97_SINGLE("Front Playback Switch", AC97_WM97XX_FMIXER_VOL, 15, 1, 1),
407AC97_DOUBLE("Rear Playback Volume", AC97_WM9704_RMIXER_VOL, 8, 0, 31, 1),
408AC97_SINGLE("Rear Playback Switch", AC97_WM9704_RMIXER_VOL, 15, 1, 1),
409AC97_DOUBLE("Rear DAC Volume", AC97_WM9704_RPCM_VOL, 8, 0, 31, 1),
410AC97_DOUBLE("Surround Volume", AC97_SURROUND_MASTER, 8, 0, 31, 1),
411};
412
413static int patch_wolfson_wm9704_specific(ac97_t * ac97)
385{ 414{
386 // WM9704M/9704Q 415 int err, i;
387 // set front and rear mixer volume 416 for (i = 0; i < ARRAY_SIZE(wm9704_snd_ac97_controls); i++) {
388 snd_ac97_write_cache(ac97, AC97_WM97XX_FMIXER_VOL, 0x0808); 417 if ((err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&wm9704_snd_ac97_controls[i], ac97))) < 0)
389 snd_ac97_write_cache(ac97, AC97_WM9704_RMIXER_VOL, 0x0808); 418 return err;
390 419 }
391 // patch for DVD noise 420 /* patch for DVD noise */
392 snd_ac97_write_cache(ac97, AC97_WM9704_TEST, 0x0200); 421 snd_ac97_write_cache(ac97, AC97_WM9704_TEST, 0x0200);
393
394 // init vol
395 snd_ac97_write_cache(ac97, AC97_WM9704_RPCM_VOL, 0x0808);
396
397 // set rear surround volume
398 snd_ac97_write_cache(ac97, AC97_SURROUND_MASTER, 0x0000);
399 return 0; 422 return 0;
400} 423}
401 424
425static struct snd_ac97_build_ops patch_wolfson_wm9704_ops = {
426 .build_specific = patch_wolfson_wm9704_specific,
427};
428
429int patch_wolfson04(ac97_t * ac97)
430{
431 /* WM9704M/9704Q */
432 ac97->build_ops = &patch_wolfson_wm9704_ops;
433 return 0;
434}
435
436static int patch_wolfson_wm9705_specific(ac97_t * ac97)
437{
438 int err, i;
439 for (i = 0; i < ARRAY_SIZE(wm97xx_snd_ac97_controls); i++) {
440 if ((err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&wm97xx_snd_ac97_controls[i], ac97))) < 0)
441 return err;
442 }
443 snd_ac97_write_cache(ac97, 0x72, 0x0808);
444 return 0;
445}
446
447static struct snd_ac97_build_ops patch_wolfson_wm9705_ops = {
448 .build_specific = patch_wolfson_wm9705_specific,
449};
450
402int patch_wolfson05(ac97_t * ac97) 451int patch_wolfson05(ac97_t * ac97)
403{ 452{
404 // WM9705, WM9710 453 /* WM9705, WM9710 */
405 // set front mixer volume 454 ac97->build_ops = &patch_wolfson_wm9705_ops;
406 snd_ac97_write_cache(ac97, AC97_WM97XX_FMIXER_VOL, 0x0808); 455 return 0;
456}
457
458static const char* wm9711_alc_select[] = {"None", "Left", "Right", "Stereo"};
459static const char* wm9711_alc_mix[] = {"Stereo", "Right", "Left", "None"};
460static const char* wm9711_out3_src[] = {"Left", "VREF", "Left + Right", "Mono"};
461static const char* wm9711_out3_lrsrc[] = {"Master Mix", "Headphone Mix"};
462static const char* wm9711_rec_adc[] = {"Stereo", "Left", "Right", "Mute"};
463static const char* wm9711_base[] = {"Linear Control", "Adaptive Boost"};
464static const char* wm9711_rec_gain[] = {"+1.5dB Steps", "+0.75dB Steps"};
465static const char* wm9711_mic[] = {"Mic 1", "Differential", "Mic 2", "Stereo"};
466static const char* wm9711_rec_sel[] =
467 {"Mic 1", "NC", "NC", "Master Mix", "Line", "Headphone Mix", "Phone Mix", "Phone"};
468static const char* wm9711_ng_type[] = {"Constant Gain", "Mute"};
469
470static const struct ac97_enum wm9711_enum[] = {
471AC97_ENUM_SINGLE(AC97_PCI_SVID, 14, 4, wm9711_alc_select),
472AC97_ENUM_SINGLE(AC97_VIDEO, 10, 4, wm9711_alc_mix),
473AC97_ENUM_SINGLE(AC97_AUX, 9, 4, wm9711_out3_src),
474AC97_ENUM_SINGLE(AC97_AUX, 8, 2, wm9711_out3_lrsrc),
475AC97_ENUM_SINGLE(AC97_REC_SEL, 12, 4, wm9711_rec_adc),
476AC97_ENUM_SINGLE(AC97_MASTER_TONE, 15, 2, wm9711_base),
477AC97_ENUM_DOUBLE(AC97_REC_GAIN, 14, 6, 2, wm9711_rec_gain),
478AC97_ENUM_SINGLE(AC97_MIC, 5, 4, wm9711_mic),
479AC97_ENUM_DOUBLE(AC97_REC_SEL, 8, 0, 8, wm9711_rec_sel),
480AC97_ENUM_SINGLE(AC97_PCI_SVID, 5, 2, wm9711_ng_type),
481};
482
483static const snd_kcontrol_new_t wm9711_snd_ac97_controls[] = {
484AC97_SINGLE("ALC Target Volume", AC97_CODEC_CLASS_REV, 12, 15, 0),
485AC97_SINGLE("ALC Hold Time", AC97_CODEC_CLASS_REV, 8, 15, 0),
486AC97_SINGLE("ALC Decay Time", AC97_CODEC_CLASS_REV, 4, 15, 0),
487AC97_SINGLE("ALC Attack Time", AC97_CODEC_CLASS_REV, 0, 15, 0),
488AC97_ENUM("ALC Function", wm9711_enum[0]),
489AC97_SINGLE("ALC Max Volume", AC97_PCI_SVID, 11, 7, 1),
490AC97_SINGLE("ALC ZC Timeout", AC97_PCI_SVID, 9, 3, 1),
491AC97_SINGLE("ALC ZC Switch", AC97_PCI_SVID, 8, 1, 0),
492AC97_SINGLE("ALC NG Switch", AC97_PCI_SVID, 7, 1, 0),
493AC97_ENUM("ALC NG Type", wm9711_enum[9]),
494AC97_SINGLE("ALC NG Threshold", AC97_PCI_SVID, 0, 31, 1),
495
496AC97_SINGLE("Side Tone Switch", AC97_VIDEO, 15, 1, 1),
497AC97_SINGLE("Side Tone Volume", AC97_VIDEO, 12, 7, 1),
498AC97_ENUM("ALC Headphone Mux", wm9711_enum[1]),
499AC97_SINGLE("ALC Headphone Volume", AC97_VIDEO, 7, 7, 1),
500
501AC97_SINGLE("Out3 Switch", AC97_AUX, 15, 1, 1),
502AC97_SINGLE("Out3 ZC Switch", AC97_AUX, 7, 1, 1),
503AC97_ENUM("Out3 Mux", wm9711_enum[2]),
504AC97_ENUM("Out3 LR Mux", wm9711_enum[3]),
505AC97_SINGLE("Out3 Volume", AC97_AUX, 0, 31, 1),
506
507AC97_SINGLE("Beep to Headphone Switch", AC97_PC_BEEP, 15, 1, 1),
508AC97_SINGLE("Beep to Headphone Volume", AC97_PC_BEEP, 12, 7, 1),
509AC97_SINGLE("Beep to Side Tone Switch", AC97_PC_BEEP, 11, 1, 1),
510AC97_SINGLE("Beep to Side Tone Volume", AC97_PC_BEEP, 8, 7, 1),
511AC97_SINGLE("Beep to Phone Switch", AC97_PC_BEEP, 7, 1, 1),
512AC97_SINGLE("Beep to Phone Volume", AC97_PC_BEEP, 4, 7, 1),
513
514AC97_SINGLE("Aux to Headphone Switch", AC97_CD, 15, 1, 1),
515AC97_SINGLE("Aux to Headphone Volume", AC97_CD, 12, 7, 1),
516AC97_SINGLE("Aux to Side Tone Switch", AC97_CD, 11, 1, 1),
517AC97_SINGLE("Aux to Side Tone Volume", AC97_CD, 8, 7, 1),
518AC97_SINGLE("Aux to Phone Switch", AC97_CD, 7, 1, 1),
519AC97_SINGLE("Aux to Phone Volume", AC97_CD, 4, 7, 1),
520
521AC97_SINGLE("Phone to Headphone Switch", AC97_PHONE, 15, 1, 1),
522AC97_SINGLE("Phone to Master Switch", AC97_PHONE, 14, 1, 1),
523
524AC97_SINGLE("Line to Headphone Switch", AC97_LINE, 15, 1, 1),
525AC97_SINGLE("Line to Master Switch", AC97_LINE, 14, 1, 1),
526AC97_SINGLE("Line to Phone Switch", AC97_LINE, 13, 1, 1),
527
528AC97_SINGLE("PCM Playback to Headphone Switch", AC97_PCM, 15, 1, 1),
529AC97_SINGLE("PCM Playback to Master Switch", AC97_PCM, 14, 1, 1),
530AC97_SINGLE("PCM Playback to Phone Switch", AC97_PCM, 13, 1, 1),
531
532AC97_SINGLE("Capture 20dB Boost Switch", AC97_REC_SEL, 14, 1, 0),
533AC97_ENUM("Capture to Phone Mux", wm9711_enum[4]),
534AC97_SINGLE("Capture to Phone 20dB Boost Switch", AC97_REC_SEL, 11, 1, 1),
535AC97_ENUM("Capture Select", wm9711_enum[8]),
536
537AC97_SINGLE("3D Upper Cut-off Switch", AC97_3D_CONTROL, 5, 1, 1),
538AC97_SINGLE("3D Lower Cut-off Switch", AC97_3D_CONTROL, 4, 1, 1),
539
540AC97_ENUM("Bass Control", wm9711_enum[5]),
541AC97_SINGLE("Bass Cut-off Switch", AC97_MASTER_TONE, 12, 1, 1),
542AC97_SINGLE("Tone Cut-off Switch", AC97_MASTER_TONE, 4, 1, 1),
543AC97_SINGLE("Playback Attenuate (-6dB) Switch", AC97_MASTER_TONE, 6, 1, 0),
544
545AC97_SINGLE("ADC Switch", AC97_REC_GAIN, 15, 1, 1),
546AC97_ENUM("Capture Volume Steps", wm9711_enum[6]),
547AC97_DOUBLE("Capture Volume", AC97_REC_GAIN, 8, 0, 15, 1),
548AC97_SINGLE("Capture ZC Switch", AC97_REC_GAIN, 7, 1, 0),
549
550AC97_SINGLE("Mic 1 to Phone Switch", AC97_MIC, 14, 1, 1),
551AC97_SINGLE("Mic 2 to Phone Switch", AC97_MIC, 13, 1, 1),
552AC97_ENUM("Mic Select Source", wm9711_enum[7]),
553AC97_SINGLE("Mic 1 Volume", AC97_MIC, 8, 32, 1),
554AC97_SINGLE("Mic 20dB Boost Switch", AC97_MIC, 7, 1, 0),
555
556AC97_SINGLE("Master ZC Switch", AC97_MASTER, 7, 1, 0),
557AC97_SINGLE("Headphone ZC Switch", AC97_HEADPHONE, 7, 1, 0),
558AC97_SINGLE("Mono ZC Switch", AC97_MASTER_MONO, 7, 1, 0),
559};
560
561static int patch_wolfson_wm9711_specific(ac97_t * ac97)
562{
563 int err, i;
564
565 for (i = 0; i < ARRAY_SIZE(wm9711_snd_ac97_controls); i++) {
566 if ((err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&wm9711_snd_ac97_controls[i], ac97))) < 0)
567 return err;
568 }
569 snd_ac97_write_cache(ac97, AC97_CODEC_CLASS_REV, 0x0808);
570 snd_ac97_write_cache(ac97, AC97_PCI_SVID, 0x0808);
571 snd_ac97_write_cache(ac97, AC97_VIDEO, 0x0808);
572 snd_ac97_write_cache(ac97, AC97_AUX, 0x0808);
573 snd_ac97_write_cache(ac97, AC97_PC_BEEP, 0x0808);
574 snd_ac97_write_cache(ac97, AC97_CD, 0x0000);
407 return 0; 575 return 0;
408} 576}
409 577
578static struct snd_ac97_build_ops patch_wolfson_wm9711_ops = {
579 .build_specific = patch_wolfson_wm9711_specific,
580};
581
410int patch_wolfson11(ac97_t * ac97) 582int patch_wolfson11(ac97_t * ac97)
411{ 583{
412 // WM9711, WM9712 584 /* WM9711, WM9712 */
413 // set out3 volume 585 ac97->build_ops = &patch_wolfson_wm9711_ops;
414 snd_ac97_write_cache(ac97, AC97_WM9711_OUT3VOL, 0x0808); 586
587 ac97->flags |= AC97_HAS_NO_REC_GAIN | AC97_STEREO_MUTES | AC97_HAS_NO_MIC |
588 AC97_HAS_NO_PC_BEEP | AC97_HAS_NO_VIDEO | AC97_HAS_NO_CD;
589
415 return 0; 590 return 0;
416} 591}
417 592
418static const char* wm9713_mic_mixer[] = {"Stereo", "Mic1", "Mic2", "Mute"}; 593static const char* wm9713_mic_mixer[] = {"Stereo", "Mic 1", "Mic 2", "Mute"};
419static const char* wm9713_rec_mux[] = {"Stereo", "Left", "Right", "Mute"}; 594static const char* wm9713_rec_mux[] = {"Stereo", "Left", "Right", "Mute"};
420static const char* wm9713_rec_src_l[] = {"Mic1", "Mic2", "Line L", "Mono In", "HP Mix L", "Spk Mix", "Mono Mix", "Zh"}; 595static const char* wm9713_rec_src[] =
421static const char* wm9713_rec_src_r[] = {"Mic1", "Mic2", "Line R", "Mono In", "HP Mix R", "Spk Mix", "Mono Mix", "Zh"}; 596 {"Mic 1", "Mic 2", "Line", "Mono In", "Headphone Mix", "Master Mix",
597 "Mono Mix", "Zh"};
598static const char* wm9713_rec_gain[] = {"+1.5dB Steps", "+0.75dB Steps"};
599static const char* wm9713_alc_select[] = {"None", "Left", "Right", "Stereo"};
600static const char* wm9713_mono_pga[] = {"Vmid", "Zh", "Mono Mix", "Inv 1"};
601static const char* wm9713_spk_pga[] =
602 {"Vmid", "Zh", "Headphone Mix", "Master Mix", "Inv", "NC", "NC", "NC"};
603static const char* wm9713_hp_pga[] = {"Vmid", "Zh", "Headphone Mix", "NC"};
604static const char* wm9713_out3_pga[] = {"Vmid", "Zh", "Inv 1", "NC"};
605static const char* wm9713_out4_pga[] = {"Vmid", "Zh", "Inv 2", "NC"};
606static const char* wm9713_dac_inv[] =
607 {"Off", "Mono Mix", "Master Mix", "Headphone Mix L", "Headphone Mix R",
608 "Headphone Mix Mono", "NC", "Vmid"};
609static const char* wm9713_base[] = {"Linear Control", "Adaptive Boost"};
610static const char* wm9713_ng_type[] = {"Constant Gain", "Mute"};
422 611
423static const struct ac97_enum wm9713_enum[] = { 612static const struct ac97_enum wm9713_enum[] = {
424AC97_ENUM_SINGLE(AC97_LINE, 3, 4, wm9713_mic_mixer), 613AC97_ENUM_SINGLE(AC97_LINE, 3, 4, wm9713_mic_mixer),
425AC97_ENUM_SINGLE(AC97_VIDEO, 14, 4, wm9713_rec_mux), 614AC97_ENUM_SINGLE(AC97_VIDEO, 14, 4, wm9713_rec_mux),
426AC97_ENUM_SINGLE(AC97_VIDEO, 9, 4, wm9713_rec_mux), 615AC97_ENUM_SINGLE(AC97_VIDEO, 9, 4, wm9713_rec_mux),
427AC97_ENUM_SINGLE(AC97_VIDEO, 3, 8, wm9713_rec_src_l), 616AC97_ENUM_DOUBLE(AC97_VIDEO, 3, 0, 8, wm9713_rec_src),
428AC97_ENUM_SINGLE(AC97_VIDEO, 0, 8, wm9713_rec_src_r), 617AC97_ENUM_DOUBLE(AC97_CD, 14, 6, 2, wm9713_rec_gain),
618AC97_ENUM_SINGLE(AC97_PCI_SVID, 14, 4, wm9713_alc_select),
619AC97_ENUM_SINGLE(AC97_REC_GAIN, 14, 4, wm9713_mono_pga),
620AC97_ENUM_DOUBLE(AC97_REC_GAIN, 11, 8, 8, wm9713_spk_pga),
621AC97_ENUM_DOUBLE(AC97_REC_GAIN, 6, 4, 4, wm9713_hp_pga),
622AC97_ENUM_SINGLE(AC97_REC_GAIN, 2, 4, wm9713_out3_pga),
623AC97_ENUM_SINGLE(AC97_REC_GAIN, 0, 4, wm9713_out4_pga),
624AC97_ENUM_DOUBLE(AC97_REC_GAIN_MIC, 13, 10, 8, wm9713_dac_inv),
625AC97_ENUM_SINGLE(AC97_GENERAL_PURPOSE, 15, 2, wm9713_base),
626AC97_ENUM_SINGLE(AC97_PCI_SVID, 5, 2, wm9713_ng_type),
429}; 627};
430 628
431static const snd_kcontrol_new_t wm13_snd_ac97_controls_line_in[] = { 629static const snd_kcontrol_new_t wm13_snd_ac97_controls[] = {
432AC97_DOUBLE("Line In Volume", AC97_PC_BEEP, 8, 0, 31, 1), 630AC97_DOUBLE("Line In Volume", AC97_PC_BEEP, 8, 0, 31, 1),
433AC97_SINGLE("Line In to Headphone Mute", AC97_PC_BEEP, 15, 1, 1), 631AC97_SINGLE("Line In to Headphone Switch", AC97_PC_BEEP, 15, 1, 1),
434AC97_SINGLE("Line In to Speaker Mute", AC97_PC_BEEP, 14, 1, 1), 632AC97_SINGLE("Line In to Master Switch", AC97_PC_BEEP, 14, 1, 1),
435AC97_SINGLE("Line In to Mono Mute", AC97_PC_BEEP, 13, 1, 1), 633AC97_SINGLE("Line In to Mono Switch", AC97_PC_BEEP, 13, 1, 1),
634
635AC97_DOUBLE("PCM Playback Volume", AC97_PHONE, 8, 0, 31, 1),
636AC97_SINGLE("PCM Playback to Headphone Switch", AC97_PHONE, 15, 1, 1),
637AC97_SINGLE("PCM Playback to Master Switch", AC97_PHONE, 14, 1, 1),
638AC97_SINGLE("PCM Playback to Mono Switch", AC97_PHONE, 13, 1, 1),
639
640AC97_SINGLE("Mic 1 Volume", AC97_MIC, 8, 31, 1),
641AC97_SINGLE("Mic 2 Volume", AC97_MIC, 0, 31, 1),
642AC97_SINGLE("Mic 1 to Mono Switch", AC97_LINE, 7, 1, 1),
643AC97_SINGLE("Mic 2 to Mono Switch", AC97_LINE, 6, 1, 1),
644AC97_SINGLE("Mic Boost (+20dB) Switch", AC97_LINE, 5, 1, 0),
645AC97_ENUM("Mic to Headphone Mux", wm9713_enum[0]),
646AC97_SINGLE("Mic Headphone Mixer Volume", AC97_LINE, 0, 7, 1),
647
648AC97_SINGLE("Capture Switch", AC97_CD, 15, 1, 1),
649AC97_ENUM("Capture Volume Steps", wm9713_enum[4]),
650AC97_DOUBLE("Capture Volume", AC97_CD, 8, 0, 15, 0),
651AC97_SINGLE("Capture ZC Switch", AC97_CD, 7, 1, 0),
652
653AC97_ENUM("Capture to Headphone Mux", wm9713_enum[1]),
654AC97_SINGLE("Capture to Headphone Volume", AC97_VIDEO, 11, 7, 1),
655AC97_ENUM("Capture to Mono Mux", wm9713_enum[2]),
656AC97_SINGLE("Capture to Mono Boost (+20dB) Switch", AC97_VIDEO, 8, 1, 0),
657AC97_SINGLE("Capture ADC Boost (+20dB) Switch", AC97_VIDEO, 6, 1, 0),
658AC97_ENUM("Capture Select", wm9713_enum[3]),
659
660AC97_SINGLE("ALC Target Volume", AC97_CODEC_CLASS_REV, 12, 15, 0),
661AC97_SINGLE("ALC Hold Time", AC97_CODEC_CLASS_REV, 8, 15, 0),
662AC97_SINGLE("ALC Decay Time ", AC97_CODEC_CLASS_REV, 4, 15, 0),
663AC97_SINGLE("ALC Attack Time", AC97_CODEC_CLASS_REV, 0, 15, 0),
664AC97_ENUM("ALC Function", wm9713_enum[5]),
665AC97_SINGLE("ALC Max Volume", AC97_PCI_SVID, 11, 7, 0),
666AC97_SINGLE("ALC ZC Timeout", AC97_PCI_SVID, 9, 3, 0),
667AC97_SINGLE("ALC ZC Switch", AC97_PCI_SVID, 8, 1, 0),
668AC97_SINGLE("ALC NG Switch", AC97_PCI_SVID, 7, 1, 0),
669AC97_ENUM("ALC NG Type", wm9713_enum[13]),
670AC97_SINGLE("ALC NG Threshold", AC97_PCI_SVID, 0, 31, 0),
671
672AC97_DOUBLE("Master ZC Switch", AC97_MASTER, 14, 6, 1, 0),
673AC97_DOUBLE("Headphone ZC Switch", AC97_HEADPHONE, 14, 6, 1, 0),
674AC97_DOUBLE("Out3/4 ZC Switch", AC97_MASTER_MONO, 14, 6, 1, 0),
675AC97_SINGLE("Master Right Switch", AC97_MASTER, 7, 1, 1),
676AC97_SINGLE("Headphone Right Switch", AC97_HEADPHONE, 7, 1, 1),
677AC97_SINGLE("Out3/4 Right Switch", AC97_MASTER_MONO, 7, 1, 1),
678
679AC97_SINGLE("Mono In to Headphone Switch", AC97_MASTER_TONE, 15, 1, 1),
680AC97_SINGLE("Mono In to Master Switch", AC97_MASTER_TONE, 14, 1, 1),
681AC97_SINGLE("Mono In Volume", AC97_MASTER_TONE, 8, 31, 1),
682AC97_SINGLE("Mono Switch", AC97_MASTER_TONE, 7, 1, 1),
683AC97_SINGLE("Mono ZC Switch", AC97_MASTER_TONE, 6, 1, 0),
684AC97_SINGLE("Mono Volume", AC97_MASTER_TONE, 0, 31, 1),
685
686AC97_SINGLE("PC Beep to Headphone Switch", AC97_AUX, 15, 1, 1),
687AC97_SINGLE("PC Beep to Headphone Volume", AC97_AUX, 12, 7, 1),
688AC97_SINGLE("PC Beep to Master Switch", AC97_AUX, 11, 1, 1),
689AC97_SINGLE("PC Beep to Master Volume", AC97_AUX, 8, 7, 1),
690AC97_SINGLE("PC Beep to Mono Switch", AC97_AUX, 7, 1, 1),
691AC97_SINGLE("PC Beep to Mono Volume", AC97_AUX, 4, 7, 1),
692
693AC97_SINGLE("Voice to Headphone Switch", AC97_PCM, 15, 1, 1),
694AC97_SINGLE("Voice to Headphone Volume", AC97_PCM, 12, 7, 1),
695AC97_SINGLE("Voice to Master Switch", AC97_PCM, 11, 1, 1),
696AC97_SINGLE("Voice to Master Volume", AC97_PCM, 8, 7, 1),
697AC97_SINGLE("Voice to Mono Switch", AC97_PCM, 7, 1, 1),
698AC97_SINGLE("Voice to Mono Volume", AC97_PCM, 4, 7, 1),
699
700AC97_SINGLE("Aux to Headphone Switch", AC97_REC_SEL, 15, 1, 1),
701AC97_SINGLE("Aux to Headphone Volume", AC97_REC_SEL, 12, 7, 1),
702AC97_SINGLE("Aux to Master Switch", AC97_REC_SEL, 11, 1, 1),
703AC97_SINGLE("Aux to Master Volume", AC97_REC_SEL, 8, 7, 1),
704AC97_SINGLE("Aux to Mono Switch", AC97_REC_SEL, 7, 1, 1),
705AC97_SINGLE("Aux to Mono Volume", AC97_REC_SEL, 4, 7, 1),
706
707AC97_ENUM("Mono Input Mux", wm9713_enum[6]),
708AC97_ENUM("Master Input Mux", wm9713_enum[7]),
709AC97_ENUM("Headphone Input Mux", wm9713_enum[8]),
710AC97_ENUM("Out 3 Input Mux", wm9713_enum[9]),
711AC97_ENUM("Out 4 Input Mux", wm9713_enum[10]),
712
713AC97_ENUM("Bass Control", wm9713_enum[12]),
714AC97_SINGLE("Bass Cut-off Switch", AC97_GENERAL_PURPOSE, 12, 1, 1),
715AC97_SINGLE("Tone Cut-off Switch", AC97_GENERAL_PURPOSE, 4, 1, 1),
716AC97_SINGLE("Playback Attenuate (-6dB) Switch", AC97_GENERAL_PURPOSE, 6, 1, 0),
717AC97_SINGLE("Bass Volume", AC97_GENERAL_PURPOSE, 8, 15, 1),
718AC97_SINGLE("Tone Volume", AC97_GENERAL_PURPOSE, 0, 15, 1),
436}; 719};
437 720
438static const snd_kcontrol_new_t wm13_snd_ac97_controls_dac[] = { 721static const snd_kcontrol_new_t wm13_snd_ac97_controls_3d[] = {
439AC97_DOUBLE("DAC Volume", AC97_PHONE, 8, 0, 31, 1), 722AC97_ENUM("Inv Input Mux", wm9713_enum[11]),
440AC97_SINGLE("DAC to Headphone Mute", AC97_PHONE, 15, 1, 1), 723AC97_SINGLE("3D Upper Cut-off Switch", AC97_REC_GAIN_MIC, 5, 1, 0),
441AC97_SINGLE("DAC to Speaker Mute", AC97_PHONE, 14, 1, 1), 724AC97_SINGLE("3D Lower Cut-off Switch", AC97_REC_GAIN_MIC, 4, 1, 0),
442AC97_SINGLE("DAC to Mono Mute", AC97_PHONE, 13, 1, 1), 725AC97_SINGLE("3D Depth", AC97_REC_GAIN_MIC, 0, 15, 1),
443}; 726};
444 727
445static const snd_kcontrol_new_t wm13_snd_ac97_controls_mic[] = { 728static int patch_wolfson_wm9713_3d (ac97_t * ac97)
446AC97_SINGLE("MICA Volume", AC97_MIC, 8, 31, 1), 729{
447AC97_SINGLE("MICB Volume", AC97_MIC, 0, 31, 1), 730 int err, i;
448AC97_SINGLE("MICA to Mono Mute", AC97_LINE, 7, 1, 1), 731
449AC97_SINGLE("MICB to Mono Mute", AC97_LINE, 6, 1, 1), 732 for (i = 0; i < ARRAY_SIZE(wm13_snd_ac97_controls_3d); i++) {
450AC97_SINGLE("MIC Boost (+20dB)", AC97_LINE, 5, 1, 1), 733 if ((err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&wm13_snd_ac97_controls_3d[i], ac97))) < 0)
451AC97_ENUM("MIC Headphone Routing", wm9713_enum[0]), 734 return err;
452AC97_SINGLE("MIC Headphone Mixer Volume", AC97_LINE, 0, 7, 1) 735 }
453}; 736 return 0;
454 737}
455static const snd_kcontrol_new_t wm13_snd_ac97_controls_adc[] = {
456AC97_SINGLE("ADC Mute", AC97_CD, 15, 1, 1),
457AC97_DOUBLE("Gain Step Size (1.5dB/0.75dB)", AC97_CD, 14, 6, 1, 1),
458AC97_DOUBLE("ADC Volume",AC97_CD, 8, 0, 15, 0),
459AC97_SINGLE("ADC Zero Cross", AC97_CD, 7, 1, 1),
460};
461
462static const snd_kcontrol_new_t wm13_snd_ac97_controls_recsel[] = {
463AC97_ENUM("Record to Headphone Path", wm9713_enum[1]),
464AC97_SINGLE("Record to Headphone Volume", AC97_VIDEO, 11, 7, 0),
465AC97_ENUM("Record to Mono Path", wm9713_enum[2]),
466AC97_SINGLE("Record to Mono Boost (+20dB)", AC97_VIDEO, 8, 1, 0),
467AC97_SINGLE("Record ADC Boost (+20dB)", AC97_VIDEO, 6, 1, 0),
468AC97_ENUM("Record Select Left", wm9713_enum[3]),
469AC97_ENUM("Record Select Right", wm9713_enum[4]),
470};
471 738
472static int patch_wolfson_wm9713_specific(ac97_t * ac97) 739static int patch_wolfson_wm9713_specific(ac97_t * ac97)
473{ 740{
474 int err, i; 741 int err, i;
475 742
476 for (i = 0; i < ARRAY_SIZE(wm13_snd_ac97_controls_line_in); i++) { 743 for (i = 0; i < ARRAY_SIZE(wm13_snd_ac97_controls); i++) {
477 if ((err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&wm13_snd_ac97_controls_line_in[i], ac97))) < 0) 744 if ((err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&wm13_snd_ac97_controls[i], ac97))) < 0)
478 return err; 745 return err;
479 } 746 }
480 snd_ac97_write_cache(ac97, AC97_PC_BEEP, 0x0808); 747 snd_ac97_write_cache(ac97, AC97_PC_BEEP, 0x0808);
481
482 for (i = 0; i < ARRAY_SIZE(wm13_snd_ac97_controls_dac); i++) {
483 if ((err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&wm13_snd_ac97_controls_dac[i], ac97))) < 0)
484 return err;
485 }
486 snd_ac97_write_cache(ac97, AC97_PHONE, 0x0808); 748 snd_ac97_write_cache(ac97, AC97_PHONE, 0x0808);
487
488 for (i = 0; i < ARRAY_SIZE(wm13_snd_ac97_controls_mic); i++) {
489 if ((err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&wm13_snd_ac97_controls_mic[i], ac97))) < 0)
490 return err;
491 }
492 snd_ac97_write_cache(ac97, AC97_MIC, 0x0808); 749 snd_ac97_write_cache(ac97, AC97_MIC, 0x0808);
493 snd_ac97_write_cache(ac97, AC97_LINE, 0x00da); 750 snd_ac97_write_cache(ac97, AC97_LINE, 0x00da);
494
495 for (i = 0; i < ARRAY_SIZE(wm13_snd_ac97_controls_adc); i++) {
496 if ((err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&wm13_snd_ac97_controls_adc[i], ac97))) < 0)
497 return err;
498 }
499 snd_ac97_write_cache(ac97, AC97_CD, 0x0808); 751 snd_ac97_write_cache(ac97, AC97_CD, 0x0808);
500
501 for (i = 0; i < ARRAY_SIZE(wm13_snd_ac97_controls_recsel); i++) {
502 if ((err = snd_ctl_add(ac97->bus->card, snd_ac97_cnew(&wm13_snd_ac97_controls_recsel[i], ac97))) < 0)
503 return err;
504 }
505 snd_ac97_write_cache(ac97, AC97_VIDEO, 0xd612); 752 snd_ac97_write_cache(ac97, AC97_VIDEO, 0xd612);
506 snd_ac97_write_cache(ac97, AC97_REC_GAIN, 0x1ba0); 753 snd_ac97_write_cache(ac97, AC97_REC_GAIN, 0x1ba0);
507
508 return 0; 754 return 0;
509} 755}
510 756
@@ -525,6 +771,7 @@ static void patch_wolfson_wm9713_resume (ac97_t * ac97)
525 771
526static struct snd_ac97_build_ops patch_wolfson_wm9713_ops = { 772static struct snd_ac97_build_ops patch_wolfson_wm9713_ops = {
527 .build_specific = patch_wolfson_wm9713_specific, 773 .build_specific = patch_wolfson_wm9713_specific,
774 .build_3d = patch_wolfson_wm9713_3d,
528#ifdef CONFIG_PM 775#ifdef CONFIG_PM
529 .suspend = patch_wolfson_wm9713_suspend, 776 .suspend = patch_wolfson_wm9713_suspend,
530 .resume = patch_wolfson_wm9713_resume 777 .resume = patch_wolfson_wm9713_resume
@@ -533,10 +780,13 @@ static struct snd_ac97_build_ops patch_wolfson_wm9713_ops = {
533 780
534int patch_wolfson13(ac97_t * ac97) 781int patch_wolfson13(ac97_t * ac97)
535{ 782{
783 /* WM9713, WM9714 */
536 ac97->build_ops = &patch_wolfson_wm9713_ops; 784 ac97->build_ops = &patch_wolfson_wm9713_ops;
537 785
538 ac97->flags |= AC97_HAS_NO_REC_GAIN | AC97_STEREO_MUTES | AC97_HAS_NO_PHONE | 786 ac97->flags |= AC97_HAS_NO_REC_GAIN | AC97_STEREO_MUTES | AC97_HAS_NO_PHONE |
539 AC97_HAS_NO_PC_BEEP | AC97_HAS_NO_VIDEO | AC97_HAS_NO_CD; 787 AC97_HAS_NO_PC_BEEP | AC97_HAS_NO_VIDEO | AC97_HAS_NO_CD | AC97_HAS_NO_TONE |
788 AC97_HAS_NO_STD_PCM;
789 ac97->scaps &= ~AC97_SCAP_MODEM;
540 790
541 snd_ac97_write_cache(ac97, AC97_EXTENDED_MID, 0xda00); 791 snd_ac97_write_cache(ac97, AC97_EXTENDED_MID, 0xda00);
542 snd_ac97_write_cache(ac97, AC97_EXTENDED_MSTATUS, 0x3810); 792 snd_ac97_write_cache(ac97, AC97_EXTENDED_MSTATUS, 0x3810);
@@ -1379,6 +1629,7 @@ static void check_ad1981_hp_jack_sense(ac97_t *ac97)
1379 u32 subid = ((u32)ac97->subsystem_vendor << 16) | ac97->subsystem_device; 1629 u32 subid = ((u32)ac97->subsystem_vendor << 16) | ac97->subsystem_device;
1380 switch (subid) { 1630 switch (subid) {
1381 case 0x103c0890: /* HP nc6000 */ 1631 case 0x103c0890: /* HP nc6000 */
1632 case 0x103c099c: /* HP nx6110 */
1382 case 0x103c006d: /* HP nx9105 */ 1633 case 0x103c006d: /* HP nx9105 */
1383 case 0x17340088: /* FSC Scenic-W */ 1634 case 0x17340088: /* FSC Scenic-W */
1384 /* enable headphone jack sense */ 1635 /* enable headphone jack sense */
@@ -1706,7 +1957,7 @@ static const snd_kcontrol_new_t snd_ac97_controls_alc650[] = {
1706}; 1957};
1707 1958
1708static const snd_kcontrol_new_t snd_ac97_spdif_controls_alc650[] = { 1959static const snd_kcontrol_new_t snd_ac97_spdif_controls_alc650[] = {
1709 AC97_SINGLE("IEC958 Capture Switch", AC97_ALC650_MULTICH, 11, 1, 0), 1960 AC97_SINGLE(SNDRV_CTL_NAME_IEC958("",CAPTURE,SWITCH), AC97_ALC650_MULTICH, 11, 1, 0),
1710 AC97_SINGLE("Analog to IEC958 Output", AC97_ALC650_MULTICH, 12, 1, 0), 1961 AC97_SINGLE("Analog to IEC958 Output", AC97_ALC650_MULTICH, 12, 1, 0),
1711 /* disable this controls since it doesn't work as expected */ 1962 /* disable this controls since it doesn't work as expected */
1712 /* AC97_SINGLE("IEC958 Input Monitor", AC97_ALC650_MULTICH, 13, 1, 0), */ 1963 /* AC97_SINGLE("IEC958 Input Monitor", AC97_ALC650_MULTICH, 13, 1, 0), */
@@ -1849,12 +2100,12 @@ static int alc655_iec958_route_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_
1849} 2100}
1850 2101
1851static const snd_kcontrol_new_t snd_ac97_spdif_controls_alc655[] = { 2102static const snd_kcontrol_new_t snd_ac97_spdif_controls_alc655[] = {
1852 AC97_PAGE_SINGLE("IEC958 Capture Switch", AC97_ALC650_MULTICH, 11, 1, 0, 0), 2103 AC97_PAGE_SINGLE(SNDRV_CTL_NAME_IEC958("",CAPTURE,SWITCH), AC97_ALC650_MULTICH, 11, 1, 0, 0),
1853 /* disable this controls since it doesn't work as expected */ 2104 /* disable this controls since it doesn't work as expected */
1854 /* AC97_PAGE_SINGLE("IEC958 Input Monitor", AC97_ALC650_MULTICH, 14, 1, 0, 0), */ 2105 /* AC97_PAGE_SINGLE("IEC958 Input Monitor", AC97_ALC650_MULTICH, 14, 1, 0, 0), */
1855 { 2106 {
1856 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2107 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1857 .name = "IEC958 Playback Route", 2108 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,NONE) "Route",
1858 .info = alc655_iec958_route_info, 2109 .info = alc655_iec958_route_info,
1859 .get = alc655_iec958_route_get, 2110 .get = alc655_iec958_route_get,
1860 .put = alc655_iec958_route_put, 2111 .put = alc655_iec958_route_put,
@@ -2416,6 +2667,16 @@ int patch_vt1616(ac97_t * ac97)
2416} 2667}
2417 2668
2418/* 2669/*
2670 * VT1617A codec
2671 */
2672int patch_vt1617a(ac97_t * ac97)
2673{
2674 ac97->ext_id |= AC97_EI_SPDIF; /* force the detection of spdif */
2675 ac97->rates[AC97_RATES_SPDIF] = SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000;
2676 return 0;
2677}
2678
2679/*
2419 */ 2680 */
2420static void it2646_update_jacks(ac97_t *ac97) 2681static void it2646_update_jacks(ac97_t *ac97)
2421{ 2682{
@@ -2433,7 +2694,7 @@ static const snd_kcontrol_new_t snd_ac97_controls_it2646[] = {
2433}; 2694};
2434 2695
2435static const snd_kcontrol_new_t snd_ac97_spdif_controls_it2646[] = { 2696static const snd_kcontrol_new_t snd_ac97_spdif_controls_it2646[] = {
2436 AC97_SINGLE("IEC958 Capture Switch", 0x76, 11, 1, 0), 2697 AC97_SINGLE(SNDRV_CTL_NAME_IEC958("",CAPTURE,SWITCH), 0x76, 11, 1, 0),
2437 AC97_SINGLE("Analog to IEC958 Output", 0x76, 12, 1, 0), 2698 AC97_SINGLE("Analog to IEC958 Output", 0x76, 12, 1, 0),
2438 AC97_SINGLE("IEC958 Input Monitor", 0x76, 13, 1, 0), 2699 AC97_SINGLE("IEC958 Input Monitor", 0x76, 13, 1, 0),
2439}; 2700};
diff --git a/sound/pci/ac97/ac97_patch.h b/sound/pci/ac97/ac97_patch.h
index 7b7377d0f2ae..ec1811320106 100644
--- a/sound/pci/ac97/ac97_patch.h
+++ b/sound/pci/ac97/ac97_patch.h
@@ -56,5 +56,6 @@ int patch_cm9739(ac97_t * ac97);
56int patch_cm9761(ac97_t * ac97); 56int patch_cm9761(ac97_t * ac97);
57int patch_cm9780(ac97_t * ac97); 57int patch_cm9780(ac97_t * ac97);
58int patch_vt1616(ac97_t * ac97); 58int patch_vt1616(ac97_t * ac97);
59int patch_vt1617a(ac97_t * ac97);
59int patch_it2646(ac97_t * ac97); 60int patch_it2646(ac97_t * ac97);
60int mpatch_si3036(ac97_t * ac97); 61int mpatch_si3036(ac97_t * ac97);
diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c
index f08ae71f902d..ce6c9fadb594 100644
--- a/sound/pci/ali5451/ali5451.c
+++ b/sound/pci/ali5451/ali5451.c
@@ -1842,7 +1842,7 @@ static int __devinit snd_ali_pcm(ali_t * codec, int device, struct ali_pcm_descr
1842 return 0; 1842 return 0;
1843} 1843}
1844 1844
1845struct ali_pcm_description ali_pcms[] = { 1845static struct ali_pcm_description ali_pcms[] = {
1846 { "ALI 5451", ALI_CHANNELS, 1, &snd_ali_playback_ops, &snd_ali_capture_ops }, 1846 { "ALI 5451", ALI_CHANNELS, 1, &snd_ali_playback_ops, &snd_ali_capture_ops },
1847 { "ALI 5451 modem", 1, 1, &snd_ali_modem_playback_ops, &snd_ali_modem_capture_ops } 1847 { "ALI 5451 modem", 1, 1, &snd_ali_modem_playback_ops, &snd_ali_modem_capture_ops }
1848}; 1848};
@@ -1959,9 +1959,9 @@ static int snd_ali5451_spdif_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t
1959static snd_kcontrol_new_t snd_ali5451_mixer_spdif[] __devinitdata = { 1959static snd_kcontrol_new_t snd_ali5451_mixer_spdif[] __devinitdata = {
1960 /* spdif aplayback switch */ 1960 /* spdif aplayback switch */
1961 /* FIXME: "IEC958 Playback Switch" may conflict with one on ac97_codec */ 1961 /* FIXME: "IEC958 Playback Switch" may conflict with one on ac97_codec */
1962 ALI5451_SPDIF("IEC958 Output switch", 0, 0), 1962 ALI5451_SPDIF(SNDRV_CTL_NAME_IEC958("Output ",NONE,SWITCH), 0, 0),
1963 /* spdif out to spdif channel */ 1963 /* spdif out to spdif channel */
1964 ALI5451_SPDIF("IEC958 Channel Output Switch", 0, 1), 1964 ALI5451_SPDIF(SNDRV_CTL_NAME_IEC958("Channel Output ",NONE,SWITCH), 0, 1),
1965 /* spdif in from spdif channel */ 1965 /* spdif in from spdif channel */
1966 ALI5451_SPDIF(SNDRV_CTL_NAME_IEC958("",CAPTURE,SWITCH), 0, 2) 1966 ALI5451_SPDIF(SNDRV_CTL_NAME_IEC958("",CAPTURE,SWITCH), 0, 2)
1967}; 1967};
diff --git a/sound/pci/atiixp.c b/sound/pci/atiixp.c
index cafab4af5c57..904d17394e1c 100644
--- a/sound/pci/atiixp.c
+++ b/sound/pci/atiixp.c
@@ -248,6 +248,7 @@ struct snd_atiixp_dma {
248 unsigned int period_bytes, periods; 248 unsigned int period_bytes, periods;
249 int opened; 249 int opened;
250 int running; 250 int running;
251 int suspended;
251 int pcm_open_flag; 252 int pcm_open_flag;
252 int ac97_pcm_type; /* index # of ac97_pcm to access, -1 = not used */ 253 int ac97_pcm_type; /* index # of ac97_pcm to access, -1 = not used */
253 unsigned int saved_curptr; 254 unsigned int saved_curptr;
@@ -699,12 +700,18 @@ static int snd_atiixp_pcm_trigger(snd_pcm_substream_t *substream, int cmd)
699 spin_lock(&chip->reg_lock); 700 spin_lock(&chip->reg_lock);
700 switch (cmd) { 701 switch (cmd) {
701 case SNDRV_PCM_TRIGGER_START: 702 case SNDRV_PCM_TRIGGER_START:
703 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
704 case SNDRV_PCM_TRIGGER_RESUME:
702 dma->ops->enable_transfer(chip, 1); 705 dma->ops->enable_transfer(chip, 1);
703 dma->running = 1; 706 dma->running = 1;
707 dma->suspended = 0;
704 break; 708 break;
705 case SNDRV_PCM_TRIGGER_STOP: 709 case SNDRV_PCM_TRIGGER_STOP:
710 case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
711 case SNDRV_PCM_TRIGGER_SUSPEND:
706 dma->ops->enable_transfer(chip, 0); 712 dma->ops->enable_transfer(chip, 0);
707 dma->running = 0; 713 dma->running = 0;
714 dma->suspended = cmd == SNDRV_PCM_TRIGGER_SUSPEND;
708 break; 715 break;
709 default: 716 default:
710 err = -EINVAL; 717 err = -EINVAL;
@@ -975,6 +982,7 @@ static snd_pcm_hardware_t snd_atiixp_pcm_hw =
975{ 982{
976 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | 983 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
977 SNDRV_PCM_INFO_BLOCK_TRANSFER | 984 SNDRV_PCM_INFO_BLOCK_TRANSFER |
985 SNDRV_PCM_INFO_PAUSE |
978 SNDRV_PCM_INFO_RESUME | 986 SNDRV_PCM_INFO_RESUME |
979 SNDRV_PCM_INFO_MMAP_VALID), 987 SNDRV_PCM_INFO_MMAP_VALID),
980 .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S32_LE, 988 .formats = SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S32_LE,
@@ -1443,7 +1451,7 @@ static int snd_atiixp_resume(snd_card_t *card)
1443 for (i = 0; i < NUM_ATI_PCMDEVS; i++) 1451 for (i = 0; i < NUM_ATI_PCMDEVS; i++)
1444 if (chip->pcmdevs[i]) { 1452 if (chip->pcmdevs[i]) {
1445 atiixp_dma_t *dma = &chip->dmas[i]; 1453 atiixp_dma_t *dma = &chip->dmas[i];
1446 if (dma->substream && dma->running) { 1454 if (dma->substream && dma->suspended) {
1447 dma->ops->enable_dma(chip, 1); 1455 dma->ops->enable_dma(chip, 1);
1448 writel((u32)dma->desc_buf.addr | ATI_REG_LINKPTR_EN, 1456 writel((u32)dma->desc_buf.addr | ATI_REG_LINKPTR_EN,
1449 chip->remap_addr + dma->ops->llp_offset); 1457 chip->remap_addr + dma->ops->llp_offset);
diff --git a/sound/pci/au88x0/au88x0_pcm.c b/sound/pci/au88x0/au88x0_pcm.c
index 04dcefd8b8ff..38bd2b5dd434 100644
--- a/sound/pci/au88x0/au88x0_pcm.c
+++ b/sound/pci/au88x0/au88x0_pcm.c
@@ -33,7 +33,7 @@
33/* hardware definition */ 33/* hardware definition */
34static snd_pcm_hardware_t snd_vortex_playback_hw_adb = { 34static snd_pcm_hardware_t snd_vortex_playback_hw_adb = {
35 .info = 35 .info =
36 (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_RESUME | 36 (SNDRV_PCM_INFO_MMAP | /* SNDRV_PCM_INFO_RESUME | */
37 SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_INTERLEAVED | 37 SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_INTERLEAVED |
38 SNDRV_PCM_INFO_MMAP_VALID), 38 SNDRV_PCM_INFO_MMAP_VALID),
39 .formats = 39 .formats =
@@ -58,7 +58,7 @@ static snd_pcm_hardware_t snd_vortex_playback_hw_adb = {
58#ifndef CHIP_AU8820 58#ifndef CHIP_AU8820
59static snd_pcm_hardware_t snd_vortex_playback_hw_a3d = { 59static snd_pcm_hardware_t snd_vortex_playback_hw_a3d = {
60 .info = 60 .info =
61 (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_RESUME | 61 (SNDRV_PCM_INFO_MMAP | /* SNDRV_PCM_INFO_RESUME | */
62 SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_INTERLEAVED | 62 SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_INTERLEAVED |
63 SNDRV_PCM_INFO_MMAP_VALID), 63 SNDRV_PCM_INFO_MMAP_VALID),
64 .formats = 64 .formats =
@@ -78,7 +78,7 @@ static snd_pcm_hardware_t snd_vortex_playback_hw_a3d = {
78#endif 78#endif
79static snd_pcm_hardware_t snd_vortex_playback_hw_spdif = { 79static snd_pcm_hardware_t snd_vortex_playback_hw_spdif = {
80 .info = 80 .info =
81 (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_RESUME | 81 (SNDRV_PCM_INFO_MMAP | /* SNDRV_PCM_INFO_RESUME | */
82 SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_INTERLEAVED | 82 SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_INTERLEAVED |
83 SNDRV_PCM_INFO_MMAP_VALID), 83 SNDRV_PCM_INFO_MMAP_VALID),
84 .formats = 84 .formats =
@@ -220,8 +220,10 @@ snd_vortex_pcm_hw_params(snd_pcm_substream_t * substream,
220 vortex_adb_allocroute(chip, -1, 220 vortex_adb_allocroute(chip, -1,
221 params_channels(hw_params), 221 params_channels(hw_params),
222 substream->stream, type); 222 substream->stream, type);
223 if (dma < 0) 223 if (dma < 0) {
224 spin_unlock_irq(&chip->lock);
224 return dma; 225 return dma;
226 }
225 stream = substream->runtime->private_data = &chip->dma_adb[dma]; 227 stream = substream->runtime->private_data = &chip->dma_adb[dma];
226 stream->substream = substream; 228 stream->substream = substream;
227 /* Setup Buffers. */ 229 /* Setup Buffers. */
diff --git a/sound/pci/ca0106/ca0106_main.c b/sound/pci/ca0106/ca0106_main.c
index 95c289284267..7e27bfc37439 100644
--- a/sound/pci/ca0106/ca0106_main.c
+++ b/sound/pci/ca0106/ca0106_main.c
@@ -188,6 +188,14 @@ static ca0106_details_t ca0106_chip_details[] = {
188 .name = "MSI K8N Diamond MB [SB0438]", 188 .name = "MSI K8N Diamond MB [SB0438]",
189 .gpio_type = 1, 189 .gpio_type = 1,
190 .i2c_adc = 1 } , 190 .i2c_adc = 1 } ,
191 /* Shuttle XPC SD31P which has an onboard Creative Labs Sound Blaster Live! 24-bit EAX
192 * high-definition 7.1 audio processor".
193 * Added using info from andrewvegan in alsa bug #1298
194 */
195 { .serial = 0x30381297,
196 .name = "Shuttle XPC SD31P [SD31P]",
197 .gpio_type = 1,
198 .i2c_adc = 1 } ,
191 { .serial = 0, 199 { .serial = 0,
192 .name = "AudigyLS [Unknown]" } 200 .name = "AudigyLS [Unknown]" }
193}; 201};
diff --git a/sound/pci/ca0106/ca0106_mixer.c b/sound/pci/ca0106/ca0106_mixer.c
index 0e5e9ce0ff28..b6b8882ce704 100644
--- a/sound/pci/ca0106/ca0106_mixer.c
+++ b/sound/pci/ca0106/ca0106_mixer.c
@@ -297,7 +297,7 @@ static int snd_ca0106_spdif_put(snd_kcontrol_t * kcontrol,
297static snd_kcontrol_new_t snd_ca0106_spdif_mask_control = 297static snd_kcontrol_new_t snd_ca0106_spdif_mask_control =
298{ 298{
299 .access = SNDRV_CTL_ELEM_ACCESS_READ, 299 .access = SNDRV_CTL_ELEM_ACCESS_READ,
300 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 300 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
301 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,MASK), 301 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,MASK),
302 .count = 4, 302 .count = 4,
303 .info = snd_ca0106_spdif_info, 303 .info = snd_ca0106_spdif_info,
@@ -306,7 +306,7 @@ static snd_kcontrol_new_t snd_ca0106_spdif_mask_control =
306 306
307static snd_kcontrol_new_t snd_ca0106_spdif_control = 307static snd_kcontrol_new_t snd_ca0106_spdif_control =
308{ 308{
309 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 309 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
310 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT), 310 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT),
311 .count = 4, 311 .count = 4,
312 .info = snd_ca0106_spdif_info, 312 .info = snd_ca0106_spdif_info,
diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c
index f5a4ac1ceef9..b098b51099c2 100644
--- a/sound/pci/cmipci.c
+++ b/sound/pci/cmipci.c
@@ -1029,7 +1029,7 @@ static int snd_cmipci_spdif_mask_get(snd_kcontrol_t * kcontrol,
1029static snd_kcontrol_new_t snd_cmipci_spdif_mask __devinitdata = 1029static snd_kcontrol_new_t snd_cmipci_spdif_mask __devinitdata =
1030{ 1030{
1031 .access = SNDRV_CTL_ELEM_ACCESS_READ, 1031 .access = SNDRV_CTL_ELEM_ACCESS_READ,
1032 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1032 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
1033 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,CON_MASK), 1033 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,CON_MASK),
1034 .info = snd_cmipci_spdif_mask_info, 1034 .info = snd_cmipci_spdif_mask_info,
1035 .get = snd_cmipci_spdif_mask_get, 1035 .get = snd_cmipci_spdif_mask_get,
diff --git a/sound/pci/cs46xx/cs46xx.c b/sound/pci/cs46xx/cs46xx.c
index db212ecd792a..b9fff4ee6f9d 100644
--- a/sound/pci/cs46xx/cs46xx.c
+++ b/sound/pci/cs46xx/cs46xx.c
@@ -113,7 +113,7 @@ static int __devinit snd_card_cs46xx_probe(struct pci_dev *pci,
113 return err; 113 return err;
114 } 114 }
115#endif 115#endif
116 if ((err = snd_cs46xx_mixer(chip)) < 0) { 116 if ((err = snd_cs46xx_mixer(chip, 2)) < 0) {
117 snd_card_free(card); 117 snd_card_free(card);
118 return err; 118 return err;
119 } 119 }
diff --git a/sound/pci/cs46xx/cs46xx_lib.c b/sound/pci/cs46xx/cs46xx_lib.c
index ff28af1f658e..4b052158ee33 100644
--- a/sound/pci/cs46xx/cs46xx_lib.c
+++ b/sound/pci/cs46xx/cs46xx_lib.c
@@ -1243,8 +1243,8 @@ static snd_pcm_hardware_t snd_cs46xx_playback =
1243{ 1243{
1244 .info = (SNDRV_PCM_INFO_MMAP | 1244 .info = (SNDRV_PCM_INFO_MMAP |
1245 SNDRV_PCM_INFO_INTERLEAVED | 1245 SNDRV_PCM_INFO_INTERLEAVED |
1246 SNDRV_PCM_INFO_BLOCK_TRANSFER | 1246 SNDRV_PCM_INFO_BLOCK_TRANSFER /*|*/
1247 SNDRV_PCM_INFO_RESUME), 1247 /*SNDRV_PCM_INFO_RESUME*/),
1248 .formats = (SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_U8 | 1248 .formats = (SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_U8 |
1249 SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S16_BE | 1249 SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S16_BE |
1250 SNDRV_PCM_FMTBIT_U16_LE | SNDRV_PCM_FMTBIT_U16_BE), 1250 SNDRV_PCM_FMTBIT_U16_LE | SNDRV_PCM_FMTBIT_U16_BE),
@@ -1265,8 +1265,8 @@ static snd_pcm_hardware_t snd_cs46xx_capture =
1265{ 1265{
1266 .info = (SNDRV_PCM_INFO_MMAP | 1266 .info = (SNDRV_PCM_INFO_MMAP |
1267 SNDRV_PCM_INFO_INTERLEAVED | 1267 SNDRV_PCM_INFO_INTERLEAVED |
1268 SNDRV_PCM_INFO_BLOCK_TRANSFER | 1268 SNDRV_PCM_INFO_BLOCK_TRANSFER /*|*/
1269 SNDRV_PCM_INFO_RESUME), 1269 /*SNDRV_PCM_INFO_RESUME*/),
1270 .formats = SNDRV_PCM_FMTBIT_S16_LE, 1270 .formats = SNDRV_PCM_FMTBIT_S16_LE,
1271 .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000, 1271 .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000,
1272 .rate_min = 5500, 1272 .rate_min = 5500,
@@ -2231,7 +2231,7 @@ static snd_kcontrol_new_t snd_cs46xx_controls[] __devinitdata = {
2231}, 2231},
2232{ 2232{
2233 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2233 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2234 .name = "IEC958 Output Switch", 2234 .name = SNDRV_CTL_NAME_IEC958("Output ",NONE,SWITCH),
2235 .info = snd_mixer_boolean_info, 2235 .info = snd_mixer_boolean_info,
2236 .get = snd_cs46xx_iec958_get, 2236 .get = snd_cs46xx_iec958_get,
2237 .put = snd_cs46xx_iec958_put, 2237 .put = snd_cs46xx_iec958_put,
@@ -2239,7 +2239,7 @@ static snd_kcontrol_new_t snd_cs46xx_controls[] __devinitdata = {
2239}, 2239},
2240{ 2240{
2241 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2241 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2242 .name = "IEC958 Input Switch", 2242 .name = SNDRV_CTL_NAME_IEC958("Input ",NONE,SWITCH),
2243 .info = snd_mixer_boolean_info, 2243 .info = snd_mixer_boolean_info,
2244 .get = snd_cs46xx_iec958_get, 2244 .get = snd_cs46xx_iec958_get,
2245 .put = snd_cs46xx_iec958_put, 2245 .put = snd_cs46xx_iec958_put,
@@ -2249,7 +2249,7 @@ static snd_kcontrol_new_t snd_cs46xx_controls[] __devinitdata = {
2249/* Input IEC958 volume does not work for the moment. (Benny) */ 2249/* Input IEC958 volume does not work for the moment. (Benny) */
2250{ 2250{
2251 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2251 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2252 .name = "IEC958 Input Volume", 2252 .name = SNDRV_CTL_NAME_IEC958("Input ",NONE,VOLUME),
2253 .info = snd_cs46xx_vol_info, 2253 .info = snd_cs46xx_vol_info,
2254 .get = snd_cs46xx_vol_iec958_get, 2254 .get = snd_cs46xx_vol_iec958_get,
2255 .put = snd_cs46xx_vol_iec958_put, 2255 .put = snd_cs46xx_vol_iec958_put,
@@ -2440,7 +2440,7 @@ static int __devinit cs46xx_detect_codec(cs46xx_t *chip, int codec)
2440 return -ENXIO; 2440 return -ENXIO;
2441} 2441}
2442 2442
2443int __devinit snd_cs46xx_mixer(cs46xx_t *chip) 2443int __devinit snd_cs46xx_mixer(cs46xx_t *chip, int spdif_device)
2444{ 2444{
2445 snd_card_t *card = chip->card; 2445 snd_card_t *card = chip->card;
2446 snd_ctl_elem_id_t id; 2446 snd_ctl_elem_id_t id;
@@ -2476,6 +2476,8 @@ int __devinit snd_cs46xx_mixer(cs46xx_t *chip)
2476 for (idx = 0; idx < ARRAY_SIZE(snd_cs46xx_controls); idx++) { 2476 for (idx = 0; idx < ARRAY_SIZE(snd_cs46xx_controls); idx++) {
2477 snd_kcontrol_t *kctl; 2477 snd_kcontrol_t *kctl;
2478 kctl = snd_ctl_new1(&snd_cs46xx_controls[idx], chip); 2478 kctl = snd_ctl_new1(&snd_cs46xx_controls[idx], chip);
2479 if (kctl && kctl->id.iface == SNDRV_CTL_ELEM_IFACE_PCM)
2480 kctl->id.device = spdif_device;
2479 if ((err = snd_ctl_add(card, kctl)) < 0) 2481 if ((err = snd_ctl_add(card, kctl)) < 0)
2480 return err; 2482 return err;
2481 } 2483 }
diff --git a/sound/pci/emu10k1/emu10k1.c b/sound/pci/emu10k1/emu10k1.c
index b17142cabead..fc377c4b666c 100644
--- a/sound/pci/emu10k1/emu10k1.c
+++ b/sound/pci/emu10k1/emu10k1.c
@@ -149,7 +149,7 @@ static int __devinit snd_card_emu10k1_probe(struct pci_dev *pci,
149 } 149 }
150 } 150 }
151 151
152 if ((err = snd_emu10k1_mixer(emu)) < 0) { 152 if ((err = snd_emu10k1_mixer(emu, 0, 3)) < 0) {
153 snd_card_free(card); 153 snd_card_free(card);
154 return err; 154 return err;
155 } 155 }
diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c
index 746b51ef3966..e69d5b739e80 100644
--- a/sound/pci/emu10k1/emu10k1_main.c
+++ b/sound/pci/emu10k1/emu10k1_main.c
@@ -741,12 +741,20 @@ static emu_chip_details_t emu_chip_details[] = {
741 .emu10k1_chip = 1, 741 .emu10k1_chip = 1,
742 .ac97_chip = 1, 742 .ac97_chip = 1,
743 .sblive51 = 1} , 743 .sblive51 = 1} ,
744 /* Tested by Thomas Zehetbauer 27th Aug 2005 */
745 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80651102,
746 .driver = "EMU10K1", .name = "SB Live 5.1 [SB0220]",
747 .id = "Live",
748 .emu10k1_chip = 1,
749 .ac97_chip = 1,
750 .sblive51 = 1} ,
744 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80641102, 751 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80641102,
745 .driver = "EMU10K1", .name = "SB Live 5.1", 752 .driver = "EMU10K1", .name = "SB Live 5.1",
746 .id = "Live", 753 .id = "Live",
747 .emu10k1_chip = 1, 754 .emu10k1_chip = 1,
748 .ac97_chip = 1, 755 .ac97_chip = 1,
749 .sblive51 = 1} , 756 .sblive51 = 1} ,
757 /* Tested by alsa bugtrack user "hus" 12th Sept 2005 */
750 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80611102, 758 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80611102,
751 .driver = "EMU10K1", .name = "SBLive! Player 5.1 [SB0060]", 759 .driver = "EMU10K1", .name = "SBLive! Player 5.1 [SB0060]",
752 .id = "Live", 760 .id = "Live",
diff --git a/sound/pci/emu10k1/emu10k1x.c b/sound/pci/emu10k1/emu10k1x.c
index e90c5ddd1d17..52c7826df440 100644
--- a/sound/pci/emu10k1/emu10k1x.c
+++ b/sound/pci/emu10k1/emu10k1x.c
@@ -1183,7 +1183,7 @@ static int snd_emu10k1x_spdif_put(snd_kcontrol_t * kcontrol,
1183static snd_kcontrol_new_t snd_emu10k1x_spdif_mask_control = 1183static snd_kcontrol_new_t snd_emu10k1x_spdif_mask_control =
1184{ 1184{
1185 .access = SNDRV_CTL_ELEM_ACCESS_READ, 1185 .access = SNDRV_CTL_ELEM_ACCESS_READ,
1186 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1186 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
1187 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,MASK), 1187 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,MASK),
1188 .count = 3, 1188 .count = 3,
1189 .info = snd_emu10k1x_spdif_info, 1189 .info = snd_emu10k1x_spdif_info,
@@ -1192,7 +1192,7 @@ static snd_kcontrol_new_t snd_emu10k1x_spdif_mask_control =
1192 1192
1193static snd_kcontrol_new_t snd_emu10k1x_spdif_control = 1193static snd_kcontrol_new_t snd_emu10k1x_spdif_control =
1194{ 1194{
1195 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1195 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
1196 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT), 1196 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT),
1197 .count = 3, 1197 .count = 3,
1198 .info = snd_emu10k1x_spdif_info, 1198 .info = snd_emu10k1x_spdif_info,
diff --git a/sound/pci/emu10k1/emufx.c b/sound/pci/emu10k1/emufx.c
index 0529fb281125..637c555cfdb1 100644
--- a/sound/pci/emu10k1/emufx.c
+++ b/sound/pci/emu10k1/emufx.c
@@ -1159,12 +1159,12 @@ A_OP(icode, &ptr, iMAC0, A_GPR(var), A_GPR(var), A_GPR(vol), A_EXTIN(input))
1159 /* Optical SPDIF Playback Volume */ 1159 /* Optical SPDIF Playback Volume */
1160 A_ADD_VOLUME_IN(stereo_mix, gpr, A_EXTIN_OPT_SPDIF_L); 1160 A_ADD_VOLUME_IN(stereo_mix, gpr, A_EXTIN_OPT_SPDIF_L);
1161 A_ADD_VOLUME_IN(stereo_mix+1, gpr+1, A_EXTIN_OPT_SPDIF_R); 1161 A_ADD_VOLUME_IN(stereo_mix+1, gpr+1, A_EXTIN_OPT_SPDIF_R);
1162 snd_emu10k1_init_stereo_control(&controls[nctl++], "IEC958 Optical Playback Volume", gpr, 0); 1162 snd_emu10k1_init_stereo_control(&controls[nctl++], SNDRV_CTL_NAME_IEC958("Optical ",PLAYBACK,VOLUME), gpr, 0);
1163 gpr += 2; 1163 gpr += 2;
1164 /* Optical SPDIF Capture Volume */ 1164 /* Optical SPDIF Capture Volume */
1165 A_ADD_VOLUME_IN(capture, gpr, A_EXTIN_OPT_SPDIF_L); 1165 A_ADD_VOLUME_IN(capture, gpr, A_EXTIN_OPT_SPDIF_L);
1166 A_ADD_VOLUME_IN(capture+1, gpr+1, A_EXTIN_OPT_SPDIF_R); 1166 A_ADD_VOLUME_IN(capture+1, gpr+1, A_EXTIN_OPT_SPDIF_R);
1167 snd_emu10k1_init_stereo_control(&controls[nctl++], "IEC958 Optical Capture Volume", gpr, 0); 1167 snd_emu10k1_init_stereo_control(&controls[nctl++], SNDRV_CTL_NAME_IEC958("Optical ",CAPTURE,VOLUME), gpr, 0);
1168 gpr += 2; 1168 gpr += 2;
1169 1169
1170 /* Line2 Playback Volume */ 1170 /* Line2 Playback Volume */
@@ -1389,7 +1389,7 @@ A_OP(icode, &ptr, iMAC0, A_GPR(var), A_GPR(var), A_GPR(vol), A_EXTIN(input))
1389 A_OP(icode, &ptr, iACC3, A_EXTOUT(A_EXTOUT_FRONT_L + z), A_GPR(tmp + 0), A_GPR(tmp + 1), A_C_00000000); 1389 A_OP(icode, &ptr, iACC3, A_EXTOUT(A_EXTOUT_FRONT_L + z), A_GPR(tmp + 0), A_GPR(tmp + 1), A_C_00000000);
1390 } 1390 }
1391 } 1391 }
1392 snd_emu10k1_init_stereo_onoff_control(controls + nctl++, "IEC958 Optical Raw Playback Switch", gpr, 0); 1392 snd_emu10k1_init_stereo_onoff_control(controls + nctl++, SNDRV_CTL_NAME_IEC958("Optical Raw ",PLAYBACK,SWITCH), gpr, 0);
1393 gpr += 2; 1393 gpr += 2;
1394 1394
1395 A_PUT_STEREO_OUTPUT(A_EXTOUT_REAR_L, A_EXTOUT_REAR_R, playback+2 + SND_EMU10K1_PLAYBACK_CHANNELS); 1395 A_PUT_STEREO_OUTPUT(A_EXTOUT_REAR_L, A_EXTOUT_REAR_R, playback+2 + SND_EMU10K1_PLAYBACK_CHANNELS);
@@ -1716,7 +1716,7 @@ static int __devinit _snd_emu10k1_init_efx(emu10k1_t *emu)
1716 /* IEC958 TTL Playback Volume */ 1716 /* IEC958 TTL Playback Volume */
1717 for (z = 0; z < 2; z++) 1717 for (z = 0; z < 2; z++)
1718 VOLUME_ADDIN(icode, &ptr, playback + z, EXTIN_SPDIF_CD_L + z, gpr + z); 1718 VOLUME_ADDIN(icode, &ptr, playback + z, EXTIN_SPDIF_CD_L + z, gpr + z);
1719 snd_emu10k1_init_stereo_control(controls + i++, "IEC958 TTL Playback Volume", gpr, 0); 1719 snd_emu10k1_init_stereo_control(controls + i++, SNDRV_CTL_NAME_IEC958("TTL ",PLAYBACK,VOLUME), gpr, 0);
1720 gpr += 2; 1720 gpr += 2;
1721 1721
1722 /* IEC958 TTL Capture Volume + Switch */ 1722 /* IEC958 TTL Capture Volume + Switch */
@@ -1724,8 +1724,8 @@ static int __devinit _snd_emu10k1_init_efx(emu10k1_t *emu)
1724 SWITCH_IN(icode, &ptr, tmp + 0, EXTIN_SPDIF_CD_L + z, gpr + 2 + z); 1724 SWITCH_IN(icode, &ptr, tmp + 0, EXTIN_SPDIF_CD_L + z, gpr + 2 + z);
1725 VOLUME_ADD(icode, &ptr, capture + z, tmp + 0, gpr + z); 1725 VOLUME_ADD(icode, &ptr, capture + z, tmp + 0, gpr + z);
1726 } 1726 }
1727 snd_emu10k1_init_stereo_control(controls + i++, "IEC958 TTL Capture Volume", gpr, 0); 1727 snd_emu10k1_init_stereo_control(controls + i++, SNDRV_CTL_NAME_IEC958("TTL ",CAPTURE,VOLUME), gpr, 0);
1728 snd_emu10k1_init_stereo_onoff_control(controls + i++, "IEC958 TTL Capture Switch", gpr + 2, 0); 1728 snd_emu10k1_init_stereo_onoff_control(controls + i++, SNDRV_CTL_NAME_IEC958("TTL ",CAPTURE,SWITCH), gpr + 2, 0);
1729 gpr += 4; 1729 gpr += 4;
1730 } 1730 }
1731 1731
@@ -1750,7 +1750,7 @@ static int __devinit _snd_emu10k1_init_efx(emu10k1_t *emu)
1750 /* IEC958 Optical Playback Volume */ 1750 /* IEC958 Optical Playback Volume */
1751 for (z = 0; z < 2; z++) 1751 for (z = 0; z < 2; z++)
1752 VOLUME_ADDIN(icode, &ptr, playback + z, EXTIN_TOSLINK_L + z, gpr + z); 1752 VOLUME_ADDIN(icode, &ptr, playback + z, EXTIN_TOSLINK_L + z, gpr + z);
1753 snd_emu10k1_init_stereo_control(controls + i++, "IEC958 LiveDrive Playback Volume", gpr, 0); 1753 snd_emu10k1_init_stereo_control(controls + i++, SNDRV_CTL_NAME_IEC958("LiveDrive ",PLAYBACK,VOLUME), gpr, 0);
1754 gpr += 2; 1754 gpr += 2;
1755 1755
1756 /* IEC958 Optical Capture Volume */ 1756 /* IEC958 Optical Capture Volume */
@@ -1758,8 +1758,8 @@ static int __devinit _snd_emu10k1_init_efx(emu10k1_t *emu)
1758 SWITCH_IN(icode, &ptr, tmp + 0, EXTIN_TOSLINK_L + z, gpr + 2 + z); 1758 SWITCH_IN(icode, &ptr, tmp + 0, EXTIN_TOSLINK_L + z, gpr + 2 + z);
1759 VOLUME_ADD(icode, &ptr, capture + z, tmp + 0, gpr + z); 1759 VOLUME_ADD(icode, &ptr, capture + z, tmp + 0, gpr + z);
1760 } 1760 }
1761 snd_emu10k1_init_stereo_control(controls + i++, "IEC958 LiveDrive Capture Volume", gpr, 0); 1761 snd_emu10k1_init_stereo_control(controls + i++, SNDRV_CTL_NAME_IEC958("LiveDrive ",CAPTURE,VOLUME), gpr, 0);
1762 snd_emu10k1_init_stereo_onoff_control(controls + i++, "IEC958 LiveDrive Capture Switch", gpr + 2, 0); 1762 snd_emu10k1_init_stereo_onoff_control(controls + i++, SNDRV_CTL_NAME_IEC958("LiveDrive ",CAPTURE,SWITCH), gpr + 2, 0);
1763 gpr += 4; 1763 gpr += 4;
1764 } 1764 }
1765 1765
@@ -1784,7 +1784,7 @@ static int __devinit _snd_emu10k1_init_efx(emu10k1_t *emu)
1784 /* IEC958 Coax Playback Volume */ 1784 /* IEC958 Coax Playback Volume */
1785 for (z = 0; z < 2; z++) 1785 for (z = 0; z < 2; z++)
1786 VOLUME_ADDIN(icode, &ptr, playback + z, EXTIN_COAX_SPDIF_L + z, gpr + z); 1786 VOLUME_ADDIN(icode, &ptr, playback + z, EXTIN_COAX_SPDIF_L + z, gpr + z);
1787 snd_emu10k1_init_stereo_control(controls + i++, "IEC958 Coaxial Playback Volume", gpr, 0); 1787 snd_emu10k1_init_stereo_control(controls + i++, SNDRV_CTL_NAME_IEC958("Coaxial ",PLAYBACK,VOLUME), gpr, 0);
1788 gpr += 2; 1788 gpr += 2;
1789 1789
1790 /* IEC958 Coax Capture Volume + Switch */ 1790 /* IEC958 Coax Capture Volume + Switch */
@@ -1792,8 +1792,8 @@ static int __devinit _snd_emu10k1_init_efx(emu10k1_t *emu)
1792 SWITCH_IN(icode, &ptr, tmp + 0, EXTIN_COAX_SPDIF_L + z, gpr + 2 + z); 1792 SWITCH_IN(icode, &ptr, tmp + 0, EXTIN_COAX_SPDIF_L + z, gpr + 2 + z);
1793 VOLUME_ADD(icode, &ptr, capture + z, tmp + 0, gpr + z); 1793 VOLUME_ADD(icode, &ptr, capture + z, tmp + 0, gpr + z);
1794 } 1794 }
1795 snd_emu10k1_init_stereo_control(controls + i++, "IEC958 Coaxial Capture Volume", gpr, 0); 1795 snd_emu10k1_init_stereo_control(controls + i++, SNDRV_CTL_NAME_IEC958("Coaxial ",CAPTURE,VOLUME), gpr, 0);
1796 snd_emu10k1_init_stereo_onoff_control(controls + i++, "IEC958 Coaxial Capture Switch", gpr + 2, 0); 1796 snd_emu10k1_init_stereo_onoff_control(controls + i++, SNDRV_CTL_NAME_IEC958("Coaxial ",CAPTURE,SWITCH), gpr + 2, 0);
1797 gpr += 4; 1797 gpr += 4;
1798 } 1798 }
1799 1799
@@ -1920,7 +1920,7 @@ static int __devinit _snd_emu10k1_init_efx(emu10k1_t *emu)
1920#endif 1920#endif
1921 } 1921 }
1922 1922
1923 snd_emu10k1_init_stereo_onoff_control(controls + i++, "IEC958 Optical Raw Playback Switch", gpr, 0); 1923 snd_emu10k1_init_stereo_onoff_control(controls + i++, SNDRV_CTL_NAME_IEC958("Optical Raw ",PLAYBACK,SWITCH), gpr, 0);
1924 gpr += 2; 1924 gpr += 2;
1925 } 1925 }
1926 1926
diff --git a/sound/pci/emu10k1/emumixer.c b/sound/pci/emu10k1/emumixer.c
index 6be82c5fe138..d71a72e84bcc 100644
--- a/sound/pci/emu10k1/emumixer.c
+++ b/sound/pci/emu10k1/emumixer.c
@@ -181,7 +181,7 @@ static int snd_emu10k1_spdif_put(snd_kcontrol_t * kcontrol,
181static snd_kcontrol_new_t snd_emu10k1_spdif_mask_control = 181static snd_kcontrol_new_t snd_emu10k1_spdif_mask_control =
182{ 182{
183 .access = SNDRV_CTL_ELEM_ACCESS_READ, 183 .access = SNDRV_CTL_ELEM_ACCESS_READ,
184 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 184 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
185 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,MASK), 185 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,MASK),
186 .count = 4, 186 .count = 4,
187 .info = snd_emu10k1_spdif_info, 187 .info = snd_emu10k1_spdif_info,
@@ -190,7 +190,7 @@ static snd_kcontrol_new_t snd_emu10k1_spdif_mask_control =
190 190
191static snd_kcontrol_new_t snd_emu10k1_spdif_control = 191static snd_kcontrol_new_t snd_emu10k1_spdif_control =
192{ 192{
193 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 193 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
194 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT), 194 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT),
195 .count = 4, 195 .count = 4,
196 .info = snd_emu10k1_spdif_info, 196 .info = snd_emu10k1_spdif_info,
@@ -295,7 +295,7 @@ static int snd_emu10k1_send_routing_put(snd_kcontrol_t * kcontrol,
295static snd_kcontrol_new_t snd_emu10k1_send_routing_control = 295static snd_kcontrol_new_t snd_emu10k1_send_routing_control =
296{ 296{
297 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_INACTIVE, 297 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_INACTIVE,
298 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 298 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
299 .name = "EMU10K1 PCM Send Routing", 299 .name = "EMU10K1 PCM Send Routing",
300 .count = 32, 300 .count = 32,
301 .info = snd_emu10k1_send_routing_info, 301 .info = snd_emu10k1_send_routing_info,
@@ -364,7 +364,7 @@ static int snd_emu10k1_send_volume_put(snd_kcontrol_t * kcontrol,
364static snd_kcontrol_new_t snd_emu10k1_send_volume_control = 364static snd_kcontrol_new_t snd_emu10k1_send_volume_control =
365{ 365{
366 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_INACTIVE, 366 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_INACTIVE,
367 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 367 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
368 .name = "EMU10K1 PCM Send Volume", 368 .name = "EMU10K1 PCM Send Volume",
369 .count = 32, 369 .count = 32,
370 .info = snd_emu10k1_send_volume_info, 370 .info = snd_emu10k1_send_volume_info,
@@ -427,7 +427,7 @@ static int snd_emu10k1_attn_put(snd_kcontrol_t * kcontrol,
427static snd_kcontrol_new_t snd_emu10k1_attn_control = 427static snd_kcontrol_new_t snd_emu10k1_attn_control =
428{ 428{
429 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_INACTIVE, 429 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_INACTIVE,
430 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 430 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
431 .name = "EMU10K1 PCM Volume", 431 .name = "EMU10K1 PCM Volume",
432 .count = 32, 432 .count = 32,
433 .info = snd_emu10k1_attn_info, 433 .info = snd_emu10k1_attn_info,
@@ -737,7 +737,8 @@ static int rename_ctl(snd_card_t *card, const char *src, const char *dst)
737 return -ENOENT; 737 return -ENOENT;
738} 738}
739 739
740int __devinit snd_emu10k1_mixer(emu10k1_t *emu) 740int __devinit snd_emu10k1_mixer(emu10k1_t *emu,
741 int pcm_device, int multi_device)
741{ 742{
742 int err, pcm; 743 int err, pcm;
743 snd_kcontrol_t *kctl; 744 snd_kcontrol_t *kctl;
@@ -852,29 +853,35 @@ int __devinit snd_emu10k1_mixer(emu10k1_t *emu)
852 853
853 if ((kctl = emu->ctl_send_routing = snd_ctl_new1(&snd_emu10k1_send_routing_control, emu)) == NULL) 854 if ((kctl = emu->ctl_send_routing = snd_ctl_new1(&snd_emu10k1_send_routing_control, emu)) == NULL)
854 return -ENOMEM; 855 return -ENOMEM;
856 kctl->id.device = pcm_device;
855 if ((err = snd_ctl_add(card, kctl))) 857 if ((err = snd_ctl_add(card, kctl)))
856 return err; 858 return err;
857 if ((kctl = emu->ctl_send_volume = snd_ctl_new1(&snd_emu10k1_send_volume_control, emu)) == NULL) 859 if ((kctl = emu->ctl_send_volume = snd_ctl_new1(&snd_emu10k1_send_volume_control, emu)) == NULL)
858 return -ENOMEM; 860 return -ENOMEM;
861 kctl->id.device = pcm_device;
859 if ((err = snd_ctl_add(card, kctl))) 862 if ((err = snd_ctl_add(card, kctl)))
860 return err; 863 return err;
861 if ((kctl = emu->ctl_attn = snd_ctl_new1(&snd_emu10k1_attn_control, emu)) == NULL) 864 if ((kctl = emu->ctl_attn = snd_ctl_new1(&snd_emu10k1_attn_control, emu)) == NULL)
862 return -ENOMEM; 865 return -ENOMEM;
866 kctl->id.device = pcm_device;
863 if ((err = snd_ctl_add(card, kctl))) 867 if ((err = snd_ctl_add(card, kctl)))
864 return err; 868 return err;
865 869
866 if ((kctl = emu->ctl_efx_send_routing = snd_ctl_new1(&snd_emu10k1_efx_send_routing_control, emu)) == NULL) 870 if ((kctl = emu->ctl_efx_send_routing = snd_ctl_new1(&snd_emu10k1_efx_send_routing_control, emu)) == NULL)
867 return -ENOMEM; 871 return -ENOMEM;
872 kctl->id.device = multi_device;
868 if ((err = snd_ctl_add(card, kctl))) 873 if ((err = snd_ctl_add(card, kctl)))
869 return err; 874 return err;
870 875
871 if ((kctl = emu->ctl_efx_send_volume = snd_ctl_new1(&snd_emu10k1_efx_send_volume_control, emu)) == NULL) 876 if ((kctl = emu->ctl_efx_send_volume = snd_ctl_new1(&snd_emu10k1_efx_send_volume_control, emu)) == NULL)
872 return -ENOMEM; 877 return -ENOMEM;
878 kctl->id.device = multi_device;
873 if ((err = snd_ctl_add(card, kctl))) 879 if ((err = snd_ctl_add(card, kctl)))
874 return err; 880 return err;
875 881
876 if ((kctl = emu->ctl_efx_attn = snd_ctl_new1(&snd_emu10k1_efx_attn_control, emu)) == NULL) 882 if ((kctl = emu->ctl_efx_attn = snd_ctl_new1(&snd_emu10k1_efx_attn_control, emu)) == NULL)
877 return -ENOMEM; 883 return -ENOMEM;
884 kctl->id.device = multi_device;
878 if ((err = snd_ctl_add(card, kctl))) 885 if ((err = snd_ctl_add(card, kctl)))
879 return err; 886 return err;
880 887
@@ -924,10 +931,14 @@ int __devinit snd_emu10k1_mixer(emu10k1_t *emu)
924 /* sb live! and audigy */ 931 /* sb live! and audigy */
925 if ((kctl = snd_ctl_new1(&snd_emu10k1_spdif_mask_control, emu)) == NULL) 932 if ((kctl = snd_ctl_new1(&snd_emu10k1_spdif_mask_control, emu)) == NULL)
926 return -ENOMEM; 933 return -ENOMEM;
934 if (!emu->audigy)
935 kctl->id.device = emu->pcm_efx->device;
927 if ((err = snd_ctl_add(card, kctl))) 936 if ((err = snd_ctl_add(card, kctl)))
928 return err; 937 return err;
929 if ((kctl = snd_ctl_new1(&snd_emu10k1_spdif_control, emu)) == NULL) 938 if ((kctl = snd_ctl_new1(&snd_emu10k1_spdif_control, emu)) == NULL)
930 return -ENOMEM; 939 return -ENOMEM;
940 if (!emu->audigy)
941 kctl->id.device = emu->pcm_efx->device;
931 if ((err = snd_ctl_add(card, kctl))) 942 if ((err = snd_ctl_add(card, kctl)))
932 return err; 943 return err;
933 } 944 }
diff --git a/sound/pci/emu10k1/emupcm.c b/sound/pci/emu10k1/emupcm.c
index 520b99af5f55..9c35f6dde1b5 100644
--- a/sound/pci/emu10k1/emupcm.c
+++ b/sound/pci/emu10k1/emupcm.c
@@ -1682,6 +1682,7 @@ static void snd_emu10k1_pcm_efx_free(snd_pcm_t *pcm)
1682int __devinit snd_emu10k1_pcm_efx(emu10k1_t * emu, int device, snd_pcm_t ** rpcm) 1682int __devinit snd_emu10k1_pcm_efx(emu10k1_t * emu, int device, snd_pcm_t ** rpcm)
1683{ 1683{
1684 snd_pcm_t *pcm; 1684 snd_pcm_t *pcm;
1685 snd_kcontrol_t *kctl;
1685 int err; 1686 int err;
1686 1687
1687 if (rpcm) 1688 if (rpcm)
@@ -1714,7 +1715,11 @@ int __devinit snd_emu10k1_pcm_efx(emu10k1_t * emu, int device, snd_pcm_t ** rpcm
1714 emu->efx_voices_mask[0] = 0xffff0000; 1715 emu->efx_voices_mask[0] = 0xffff0000;
1715 emu->efx_voices_mask[1] = 0; 1716 emu->efx_voices_mask[1] = 0;
1716 } 1717 }
1717 snd_ctl_add(emu->card, snd_ctl_new1(&snd_emu10k1_pcm_efx_voices_mask, emu)); 1718 kctl = snd_ctl_new1(&snd_emu10k1_pcm_efx_voices_mask, emu);
1719 if (!kctl)
1720 return -ENOMEM;
1721 kctl->id.device = device;
1722 snd_ctl_add(emu->card, kctl);
1718 1723
1719 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(emu->pci), 64*1024, 64*1024); 1724 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(emu->pci), 64*1024, 64*1024);
1720 1725
diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c
index 78a81f3912a1..f06b95f41a1d 100644
--- a/sound/pci/ens1370.c
+++ b/sound/pci/ens1370.c
@@ -1444,7 +1444,7 @@ static int snd_es1371_spdif_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t
1444 1444
1445/* spdif controls */ 1445/* spdif controls */
1446static snd_kcontrol_new_t snd_es1371_mixer_spdif[] __devinitdata = { 1446static snd_kcontrol_new_t snd_es1371_mixer_spdif[] __devinitdata = {
1447 ES1371_SPDIF("IEC958 Playback Switch"), 1447 ES1371_SPDIF(SNDRV_CTL_NAME_IEC958("",PLAYBACK,SWITCH)),
1448 { 1448 {
1449 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 1449 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
1450 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT), 1450 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT),
diff --git a/sound/pci/fm801.c b/sound/pci/fm801.c
index ff10e637a95e..36b2f62e8573 100644
--- a/sound/pci/fm801.c
+++ b/sound/pci/fm801.c
@@ -1155,10 +1155,10 @@ FM801_SINGLE("FM Playback Switch", FM801_FM_VOL, 15, 1, 1),
1155static snd_kcontrol_new_t snd_fm801_controls_multi[] __devinitdata = { 1155static snd_kcontrol_new_t snd_fm801_controls_multi[] __devinitdata = {
1156FM801_SINGLE("AC97 2ch->4ch Copy Switch", FM801_CODEC_CTRL, 7, 1, 0), 1156FM801_SINGLE("AC97 2ch->4ch Copy Switch", FM801_CODEC_CTRL, 7, 1, 0),
1157FM801_SINGLE("AC97 18-bit Switch", FM801_CODEC_CTRL, 10, 1, 0), 1157FM801_SINGLE("AC97 18-bit Switch", FM801_CODEC_CTRL, 10, 1, 0),
1158FM801_SINGLE("IEC958 Capture Switch", FM801_I2S_MODE, 8, 1, 0), 1158FM801_SINGLE(SNDRV_CTL_NAME_IEC958("",CAPTURE,SWITCH), FM801_I2S_MODE, 8, 1, 0),
1159FM801_SINGLE("IEC958 Raw Data Playback Switch", FM801_I2S_MODE, 9, 1, 0), 1159FM801_SINGLE(SNDRV_CTL_NAME_IEC958("Raw Data ",PLAYBACK,SWITCH), FM801_I2S_MODE, 9, 1, 0),
1160FM801_SINGLE("IEC958 Raw Data Capture Switch", FM801_I2S_MODE, 10, 1, 0), 1160FM801_SINGLE(SNDRV_CTL_NAME_IEC958("Raw Data ",CAPTURE,SWITCH), FM801_I2S_MODE, 10, 1, 0),
1161FM801_SINGLE("IEC958 Playback Switch", FM801_GEN_CTRL, 2, 1, 0), 1161FM801_SINGLE(SNDRV_CTL_NAME_IEC958("",PLAYBACK,SWITCH), FM801_GEN_CTRL, 2, 1, 0),
1162}; 1162};
1163 1163
1164static void snd_fm801_mixer_free_ac97_bus(ac97_bus_t *bus) 1164static void snd_fm801_mixer_free_ac97_bus(ac97_bus_t *bus)
diff --git a/sound/pci/hda/Makefile b/sound/pci/hda/Makefile
index bd8cb33c4fb4..ddfb5ff7fb8f 100644
--- a/sound/pci/hda/Makefile
+++ b/sound/pci/hda/Makefile
@@ -1,5 +1,5 @@
1snd-hda-intel-objs := hda_intel.o 1snd-hda-intel-objs := hda_intel.o
2snd-hda-codec-objs := hda_codec.o hda_generic.o patch_realtek.o patch_cmedia.o patch_analog.o patch_sigmatel.o 2snd-hda-codec-objs := hda_codec.o hda_generic.o patch_realtek.o patch_cmedia.o patch_analog.o patch_sigmatel.o patch_si3054.o
3ifdef CONFIG_PROC_FS 3ifdef CONFIG_PROC_FS
4snd-hda-codec-objs += hda_proc.o 4snd-hda-codec-objs += hda_proc.o
5endif 5endif
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index e2cf02387289..20f7762f7144 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -432,22 +432,26 @@ void snd_hda_get_codec_name(struct hda_codec *codec,
432} 432}
433 433
434/* 434/*
435 * look for an AFG node 435 * look for an AFG and MFG nodes
436 *
437 * return 0 if not found
438 */ 436 */
439static int look_for_afg_node(struct hda_codec *codec) 437static void setup_fg_nodes(struct hda_codec *codec)
440{ 438{
441 int i, total_nodes; 439 int i, total_nodes;
442 hda_nid_t nid; 440 hda_nid_t nid;
443 441
444 total_nodes = snd_hda_get_sub_nodes(codec, AC_NODE_ROOT, &nid); 442 total_nodes = snd_hda_get_sub_nodes(codec, AC_NODE_ROOT, &nid);
445 for (i = 0; i < total_nodes; i++, nid++) { 443 for (i = 0; i < total_nodes; i++, nid++) {
446 if ((snd_hda_param_read(codec, nid, AC_PAR_FUNCTION_TYPE) & 0xff) == 444 switch((snd_hda_param_read(codec, nid, AC_PAR_FUNCTION_TYPE) & 0xff)) {
447 AC_GRP_AUDIO_FUNCTION) 445 case AC_GRP_AUDIO_FUNCTION:
448 return nid; 446 codec->afg = nid;
447 break;
448 case AC_GRP_MODEM_FUNCTION:
449 codec->mfg = nid;
450 break;
451 default:
452 break;
453 }
449 } 454 }
450 return 0;
451} 455}
452 456
453/* 457/*
@@ -507,10 +511,9 @@ int snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr,
507 codec->subsystem_id = snd_hda_param_read(codec, AC_NODE_ROOT, AC_PAR_SUBSYSTEM_ID); 511 codec->subsystem_id = snd_hda_param_read(codec, AC_NODE_ROOT, AC_PAR_SUBSYSTEM_ID);
508 codec->revision_id = snd_hda_param_read(codec, AC_NODE_ROOT, AC_PAR_REV_ID); 512 codec->revision_id = snd_hda_param_read(codec, AC_NODE_ROOT, AC_PAR_REV_ID);
509 513
510 /* FIXME: support for multiple AFGs? */ 514 setup_fg_nodes(codec);
511 codec->afg = look_for_afg_node(codec); 515 if (! codec->afg && ! codec->mfg) {
512 if (! codec->afg) { 516 snd_printdd("hda_codec: no AFG or MFG node found\n");
513 snd_printdd("hda_codec: no AFG node found\n");
514 snd_hda_codec_free(codec); 517 snd_hda_codec_free(codec);
515 return -ENODEV; 518 return -ENODEV;
516 } 519 }
@@ -749,12 +752,14 @@ int snd_hda_mixer_amp_volume_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t
749 long *valp = ucontrol->value.integer.value; 752 long *valp = ucontrol->value.integer.value;
750 int change = 0; 753 int change = 0;
751 754
752 if (chs & 1) 755 if (chs & 1) {
753 change = snd_hda_codec_amp_update(codec, nid, 0, dir, idx, 756 change = snd_hda_codec_amp_update(codec, nid, 0, dir, idx,
754 0x7f, *valp); 757 0x7f, *valp);
758 valp++;
759 }
755 if (chs & 2) 760 if (chs & 2)
756 change |= snd_hda_codec_amp_update(codec, nid, 1, dir, idx, 761 change |= snd_hda_codec_amp_update(codec, nid, 1, dir, idx,
757 0x7f, valp[1]); 762 0x7f, *valp);
758 return change; 763 return change;
759} 764}
760 765
@@ -796,12 +801,15 @@ int snd_hda_mixer_amp_switch_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t
796 long *valp = ucontrol->value.integer.value; 801 long *valp = ucontrol->value.integer.value;
797 int change = 0; 802 int change = 0;
798 803
799 if (chs & 1) 804 if (chs & 1) {
800 change = snd_hda_codec_amp_update(codec, nid, 0, dir, idx, 805 change = snd_hda_codec_amp_update(codec, nid, 0, dir, idx,
801 0x80, *valp ? 0 : 0x80); 806 0x80, *valp ? 0 : 0x80);
807 valp++;
808 }
802 if (chs & 2) 809 if (chs & 2)
803 change |= snd_hda_codec_amp_update(codec, nid, 1, dir, idx, 810 change |= snd_hda_codec_amp_update(codec, nid, 1, dir, idx,
804 0x80, valp[1] ? 0 : 0x80); 811 0x80, *valp ? 0 : 0x80);
812
805 return change; 813 return change;
806} 814}
807 815
@@ -1155,8 +1163,16 @@ int snd_hda_build_controls(struct hda_bus *bus)
1155/* 1163/*
1156 * stream formats 1164 * stream formats
1157 */ 1165 */
1158static unsigned int rate_bits[][3] = { 1166struct hda_rate_tbl {
1167 unsigned int hz;
1168 unsigned int alsa_bits;
1169 unsigned int hda_fmt;
1170};
1171
1172static struct hda_rate_tbl rate_bits[] = {
1159 /* rate in Hz, ALSA rate bitmask, HDA format value */ 1173 /* rate in Hz, ALSA rate bitmask, HDA format value */
1174
1175 /* autodetected value used in snd_hda_query_supported_pcm */
1160 { 8000, SNDRV_PCM_RATE_8000, 0x0500 }, /* 1/6 x 48 */ 1176 { 8000, SNDRV_PCM_RATE_8000, 0x0500 }, /* 1/6 x 48 */
1161 { 11025, SNDRV_PCM_RATE_11025, 0x4300 }, /* 1/4 x 44 */ 1177 { 11025, SNDRV_PCM_RATE_11025, 0x4300 }, /* 1/4 x 44 */
1162 { 16000, SNDRV_PCM_RATE_16000, 0x0200 }, /* 1/3 x 48 */ 1178 { 16000, SNDRV_PCM_RATE_16000, 0x0200 }, /* 1/3 x 48 */
@@ -1168,7 +1184,11 @@ static unsigned int rate_bits[][3] = {
1168 { 96000, SNDRV_PCM_RATE_96000, 0x0800 }, /* 2 x 48 */ 1184 { 96000, SNDRV_PCM_RATE_96000, 0x0800 }, /* 2 x 48 */
1169 { 176400, SNDRV_PCM_RATE_176400, 0x5800 },/* 4 x 44 */ 1185 { 176400, SNDRV_PCM_RATE_176400, 0x5800 },/* 4 x 44 */
1170 { 192000, SNDRV_PCM_RATE_192000, 0x1800 }, /* 4 x 48 */ 1186 { 192000, SNDRV_PCM_RATE_192000, 0x1800 }, /* 4 x 48 */
1171 { 0 } 1187
1188 /* not autodetected value */
1189 { 9600, SNDRV_PCM_RATE_KNOT, 0x0400 }, /* 1/5 x 48 */
1190
1191 { 0 } /* terminator */
1172}; 1192};
1173 1193
1174/** 1194/**
@@ -1190,12 +1210,12 @@ unsigned int snd_hda_calc_stream_format(unsigned int rate,
1190 int i; 1210 int i;
1191 unsigned int val = 0; 1211 unsigned int val = 0;
1192 1212
1193 for (i = 0; rate_bits[i][0]; i++) 1213 for (i = 0; rate_bits[i].hz; i++)
1194 if (rate_bits[i][0] == rate) { 1214 if (rate_bits[i].hz == rate) {
1195 val = rate_bits[i][2]; 1215 val = rate_bits[i].hda_fmt;
1196 break; 1216 break;
1197 } 1217 }
1198 if (! rate_bits[i][0]) { 1218 if (! rate_bits[i].hz) {
1199 snd_printdd("invalid rate %d\n", rate); 1219 snd_printdd("invalid rate %d\n", rate);
1200 return 0; 1220 return 0;
1201 } 1221 }
@@ -1258,9 +1278,9 @@ int snd_hda_query_supported_pcm(struct hda_codec *codec, hda_nid_t nid,
1258 1278
1259 if (ratesp) { 1279 if (ratesp) {
1260 u32 rates = 0; 1280 u32 rates = 0;
1261 for (i = 0; rate_bits[i][0]; i++) { 1281 for (i = 0; rate_bits[i].hz; i++) {
1262 if (val & (1 << i)) 1282 if (val & (1 << i))
1263 rates |= rate_bits[i][1]; 1283 rates |= rate_bits[i].alsa_bits;
1264 } 1284 }
1265 *ratesp = rates; 1285 *ratesp = rates;
1266 } 1286 }
@@ -1352,13 +1372,13 @@ int snd_hda_is_supported_format(struct hda_codec *codec, hda_nid_t nid,
1352 } 1372 }
1353 1373
1354 rate = format & 0xff00; 1374 rate = format & 0xff00;
1355 for (i = 0; rate_bits[i][0]; i++) 1375 for (i = 0; rate_bits[i].hz; i++)
1356 if (rate_bits[i][2] == rate) { 1376 if (rate_bits[i].hda_fmt == rate) {
1357 if (val & (1 << i)) 1377 if (val & (1 << i))
1358 break; 1378 break;
1359 return 0; 1379 return 0;
1360 } 1380 }
1361 if (! rate_bits[i][0]) 1381 if (! rate_bits[i].hz)
1362 return 0; 1382 return 0;
1363 1383
1364 stream = snd_hda_param_read(codec, nid, AC_PAR_STREAM); 1384 stream = snd_hda_param_read(codec, nid, AC_PAR_STREAM);
@@ -1541,8 +1561,11 @@ int snd_hda_check_board_config(struct hda_codec *codec, const struct hda_board_c
1541 for (c = tbl; c->modelname || c->pci_subvendor; c++) { 1561 for (c = tbl; c->modelname || c->pci_subvendor; c++) {
1542 if (c->pci_subvendor == subsystem_vendor && 1562 if (c->pci_subvendor == subsystem_vendor &&
1543 (! c->pci_subdevice /* all match */|| 1563 (! c->pci_subdevice /* all match */||
1544 (c->pci_subdevice == subsystem_device))) 1564 (c->pci_subdevice == subsystem_device))) {
1565 snd_printdd(KERN_INFO "hda_codec: PCI %x:%x, codec config %d is selected\n",
1566 subsystem_vendor, subsystem_device, c->config);
1545 return c->config; 1567 return c->config;
1568 }
1546 } 1569 }
1547 } 1570 }
1548 return -1; 1571 return -1;
@@ -1803,11 +1826,25 @@ int snd_hda_parse_pin_def_config(struct hda_codec *codec, struct auto_pin_cfg *c
1803 cfg->line_out_pins[j] = nid; 1826 cfg->line_out_pins[j] = nid;
1804 } 1827 }
1805 1828
1806 /* Swap surround and CLFE: the association order is front/CLFE/surr/back */ 1829 /* Reorder the surround channels
1807 if (cfg->line_outs >= 3) { 1830 * ALSA sequence is front/surr/clfe/side
1831 * HDA sequence is:
1832 * 4-ch: front/surr => OK as it is
1833 * 6-ch: front/clfe/surr
1834 * 8-ch: front/clfe/side/surr
1835 */
1836 switch (cfg->line_outs) {
1837 case 3:
1808 nid = cfg->line_out_pins[1]; 1838 nid = cfg->line_out_pins[1];
1809 cfg->line_out_pins[1] = cfg->line_out_pins[2]; 1839 cfg->line_out_pins[1] = cfg->line_out_pins[2];
1810 cfg->line_out_pins[2] = nid; 1840 cfg->line_out_pins[2] = nid;
1841 break;
1842 case 4:
1843 nid = cfg->line_out_pins[1];
1844 cfg->line_out_pins[1] = cfg->line_out_pins[3];
1845 cfg->line_out_pins[3] = cfg->line_out_pins[2];
1846 cfg->line_out_pins[2] = nid;
1847 break;
1811 } 1848 }
1812 1849
1813 return 0; 1850 return 0;
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h
index dd0d99d2ad27..63a29a8a2860 100644
--- a/sound/pci/hda/hda_codec.h
+++ b/sound/pci/hda/hda_codec.h
@@ -514,6 +514,7 @@ struct hda_codec {
514 struct list_head list; /* list point */ 514 struct list_head list; /* list point */
515 515
516 hda_nid_t afg; /* AFG node id */ 516 hda_nid_t afg; /* AFG node id */
517 hda_nid_t mfg; /* MFG node id */
517 518
518 /* ids */ 519 /* ids */
519 u32 vendor_id; 520 u32 vendor_id;
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
index 2d046abb5911..1229227af5b5 100644
--- a/sound/pci/hda/hda_generic.c
+++ b/sound/pci/hda/hda_generic.c
@@ -881,6 +881,11 @@ int snd_hda_parse_generic_codec(struct hda_codec *codec)
881 struct hda_gspec *spec; 881 struct hda_gspec *spec;
882 int err; 882 int err;
883 883
884 if(!codec->afg) {
885 snd_printdd("hda_generic: no generic modem yet\n");
886 return -ENODEV;
887 }
888
884 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); 889 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
885 if (spec == NULL) { 890 if (spec == NULL) {
886 printk(KERN_ERR "hda_generic: can't allocate spec\n"); 891 printk(KERN_ERR "hda_generic: can't allocate spec\n");
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 288ab0764830..15107df1f490 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -71,7 +71,9 @@ MODULE_SUPPORTED_DEVICE("{{Intel, ICH6},"
71 "{Intel, ESB2}," 71 "{Intel, ESB2},"
72 "{ATI, SB450}," 72 "{ATI, SB450},"
73 "{VIA, VT8251}," 73 "{VIA, VT8251},"
74 "{VIA, VT8237A}}"); 74 "{VIA, VT8237A},"
75 "{SiS, SIS966},"
76 "{ULI, M5461}}");
75MODULE_DESCRIPTION("Intel HDA driver"); 77MODULE_DESCRIPTION("Intel HDA driver");
76 78
77#define SFX "hda-intel: " 79#define SFX "hda-intel: "
@@ -141,9 +143,24 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 };
141 */ 143 */
142 144
143/* max number of SDs */ 145/* max number of SDs */
144#define MAX_ICH6_DEV 8 146/* ICH, ATI and VIA have 4 playback and 4 capture */
147#define ICH6_CAPTURE_INDEX 0
148#define ICH6_NUM_CAPTURE 4
149#define ICH6_PLAYBACK_INDEX 4
150#define ICH6_NUM_PLAYBACK 4
151
152/* ULI has 6 playback and 5 capture */
153#define ULI_CAPTURE_INDEX 0
154#define ULI_NUM_CAPTURE 5
155#define ULI_PLAYBACK_INDEX 5
156#define ULI_NUM_PLAYBACK 6
157
158/* this number is statically defined for simplicity */
159#define MAX_AZX_DEV 16
160
145/* max number of fragments - we may use more if allocating more pages for BDL */ 161/* max number of fragments - we may use more if allocating more pages for BDL */
146#define AZX_MAX_FRAG (PAGE_SIZE / (MAX_ICH6_DEV * 16)) 162#define BDL_SIZE PAGE_ALIGN(8192)
163#define AZX_MAX_FRAG (BDL_SIZE / (MAX_AZX_DEV * 16))
147/* max buffer size - no h/w limit, you can increase as you like */ 164/* max buffer size - no h/w limit, you can increase as you like */
148#define AZX_MAX_BUF_SIZE (1024*1024*1024) 165#define AZX_MAX_BUF_SIZE (1024*1024*1024)
149/* max number of PCM devics per card */ 166/* max number of PCM devics per card */
@@ -200,7 +217,6 @@ enum {
200}; 217};
201 218
202/* Defines for ATI HD Audio support in SB450 south bridge */ 219/* Defines for ATI HD Audio support in SB450 south bridge */
203#define ATI_SB450_HDAUDIO_PCI_DEVICE_ID 0x437b
204#define ATI_SB450_HDAUDIO_MISC_CNTR2_ADDR 0x42 220#define ATI_SB450_HDAUDIO_MISC_CNTR2_ADDR 0x42
205#define ATI_SB450_HDAUDIO_ENABLE_SNOOP 0x02 221#define ATI_SB450_HDAUDIO_ENABLE_SNOOP 0x02
206 222
@@ -258,6 +274,14 @@ struct snd_azx {
258 snd_card_t *card; 274 snd_card_t *card;
259 struct pci_dev *pci; 275 struct pci_dev *pci;
260 276
277 /* chip type specific */
278 int driver_type;
279 int playback_streams;
280 int playback_index_offset;
281 int capture_streams;
282 int capture_index_offset;
283 int num_streams;
284
261 /* pci resources */ 285 /* pci resources */
262 unsigned long addr; 286 unsigned long addr;
263 void __iomem *remap_addr; 287 void __iomem *remap_addr;
@@ -267,8 +291,8 @@ struct snd_azx {
267 spinlock_t reg_lock; 291 spinlock_t reg_lock;
268 struct semaphore open_mutex; 292 struct semaphore open_mutex;
269 293
270 /* streams */ 294 /* streams (x num_streams) */
271 azx_dev_t azx_dev[MAX_ICH6_DEV]; 295 azx_dev_t *azx_dev;
272 296
273 /* PCM */ 297 /* PCM */
274 unsigned int pcm_devs; 298 unsigned int pcm_devs;
@@ -292,6 +316,23 @@ struct snd_azx {
292 unsigned int initialized: 1; 316 unsigned int initialized: 1;
293}; 317};
294 318
319/* driver types */
320enum {
321 AZX_DRIVER_ICH,
322 AZX_DRIVER_ATI,
323 AZX_DRIVER_VIA,
324 AZX_DRIVER_SIS,
325 AZX_DRIVER_ULI,
326};
327
328static char *driver_short_names[] __devinitdata = {
329 [AZX_DRIVER_ICH] = "HDA Intel",
330 [AZX_DRIVER_ATI] = "HDA ATI SB",
331 [AZX_DRIVER_VIA] = "HDA VIA VT82xx",
332 [AZX_DRIVER_SIS] = "HDA SIS966",
333 [AZX_DRIVER_ULI] = "HDA ULI M5461"
334};
335
295/* 336/*
296 * macros for easy use 337 * macros for easy use
297 */ 338 */
@@ -360,6 +401,8 @@ static void azx_init_cmd_io(azx_t *chip)
360 azx_writel(chip, CORBLBASE, (u32)chip->corb.addr); 401 azx_writel(chip, CORBLBASE, (u32)chip->corb.addr);
361 azx_writel(chip, CORBUBASE, upper_32bit(chip->corb.addr)); 402 azx_writel(chip, CORBUBASE, upper_32bit(chip->corb.addr));
362 403
404 /* set the corb size to 256 entries (ULI requires explicitly) */
405 azx_writeb(chip, CORBSIZE, 0x02);
363 /* set the corb write pointer to 0 */ 406 /* set the corb write pointer to 0 */
364 azx_writew(chip, CORBWP, 0); 407 azx_writew(chip, CORBWP, 0);
365 /* reset the corb hw read pointer */ 408 /* reset the corb hw read pointer */
@@ -373,6 +416,8 @@ static void azx_init_cmd_io(azx_t *chip)
373 azx_writel(chip, RIRBLBASE, (u32)chip->rirb.addr); 416 azx_writel(chip, RIRBLBASE, (u32)chip->rirb.addr);
374 azx_writel(chip, RIRBUBASE, upper_32bit(chip->rirb.addr)); 417 azx_writel(chip, RIRBUBASE, upper_32bit(chip->rirb.addr));
375 418
419 /* set the rirb size to 256 entries (ULI requires explicitly) */
420 azx_writeb(chip, RIRBSIZE, 0x02);
376 /* reset the rirb hw write pointer */ 421 /* reset the rirb hw write pointer */
377 azx_writew(chip, RIRBWP, ICH6_RBRWP_CLR); 422 azx_writew(chip, RIRBWP, ICH6_RBRWP_CLR);
378 /* set N=1, get RIRB response interrupt for new entry */ 423 /* set N=1, get RIRB response interrupt for new entry */
@@ -596,7 +641,7 @@ static void azx_int_disable(azx_t *chip)
596 int i; 641 int i;
597 642
598 /* disable interrupts in stream descriptor */ 643 /* disable interrupts in stream descriptor */
599 for (i = 0; i < MAX_ICH6_DEV; i++) { 644 for (i = 0; i < chip->num_streams; i++) {
600 azx_dev_t *azx_dev = &chip->azx_dev[i]; 645 azx_dev_t *azx_dev = &chip->azx_dev[i];
601 azx_sd_writeb(azx_dev, SD_CTL, 646 azx_sd_writeb(azx_dev, SD_CTL,
602 azx_sd_readb(azx_dev, SD_CTL) & ~SD_INT_MASK); 647 azx_sd_readb(azx_dev, SD_CTL) & ~SD_INT_MASK);
@@ -616,7 +661,7 @@ static void azx_int_clear(azx_t *chip)
616 int i; 661 int i;
617 662
618 /* clear stream status */ 663 /* clear stream status */
619 for (i = 0; i < MAX_ICH6_DEV; i++) { 664 for (i = 0; i < chip->num_streams; i++) {
620 azx_dev_t *azx_dev = &chip->azx_dev[i]; 665 azx_dev_t *azx_dev = &chip->azx_dev[i];
621 azx_sd_writeb(azx_dev, SD_STS, SD_INT_MASK); 666 azx_sd_writeb(azx_dev, SD_STS, SD_INT_MASK);
622 } 667 }
@@ -686,8 +731,7 @@ static void azx_init_chip(azx_t *chip)
686 } 731 }
687 732
688 /* For ATI SB450 azalia HD audio, we need to enable snoop */ 733 /* For ATI SB450 azalia HD audio, we need to enable snoop */
689 if (chip->pci->vendor == PCI_VENDOR_ID_ATI && 734 if (chip->driver_type == AZX_DRIVER_ATI) {
690 chip->pci->device == ATI_SB450_HDAUDIO_PCI_DEVICE_ID) {
691 pci_read_config_byte(chip->pci, ATI_SB450_HDAUDIO_MISC_CNTR2_ADDR, 735 pci_read_config_byte(chip->pci, ATI_SB450_HDAUDIO_MISC_CNTR2_ADDR,
692 &ati_misc_cntl2); 736 &ati_misc_cntl2);
693 pci_write_config_byte(chip->pci, ATI_SB450_HDAUDIO_MISC_CNTR2_ADDR, 737 pci_write_config_byte(chip->pci, ATI_SB450_HDAUDIO_MISC_CNTR2_ADDR,
@@ -714,7 +758,7 @@ static irqreturn_t azx_interrupt(int irq, void* dev_id, struct pt_regs *regs)
714 return IRQ_NONE; 758 return IRQ_NONE;
715 } 759 }
716 760
717 for (i = 0; i < MAX_ICH6_DEV; i++) { 761 for (i = 0; i < chip->num_streams; i++) {
718 azx_dev = &chip->azx_dev[i]; 762 azx_dev = &chip->azx_dev[i];
719 if (status & azx_dev->sd_int_sta_mask) { 763 if (status & azx_dev->sd_int_sta_mask) {
720 azx_sd_writeb(azx_dev, SD_STS, SD_INT_MASK); 764 azx_sd_writeb(azx_dev, SD_STS, SD_INT_MASK);
@@ -879,9 +923,15 @@ static int __devinit azx_codec_create(azx_t *chip, const char *model)
879/* assign a stream for the PCM */ 923/* assign a stream for the PCM */
880static inline azx_dev_t *azx_assign_device(azx_t *chip, int stream) 924static inline azx_dev_t *azx_assign_device(azx_t *chip, int stream)
881{ 925{
882 int dev, i; 926 int dev, i, nums;
883 dev = stream == SNDRV_PCM_STREAM_PLAYBACK ? 4 : 0; 927 if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
884 for (i = 0; i < 4; i++, dev++) 928 dev = chip->playback_index_offset;
929 nums = chip->playback_streams;
930 } else {
931 dev = chip->capture_index_offset;
932 nums = chip->capture_streams;
933 }
934 for (i = 0; i < nums; i++, dev++)
885 if (! chip->azx_dev[dev].opened) { 935 if (! chip->azx_dev[dev].opened) {
886 chip->azx_dev[dev].opened = 1; 936 chip->azx_dev[dev].opened = 1;
887 return &chip->azx_dev[dev]; 937 return &chip->azx_dev[dev];
@@ -899,8 +949,8 @@ static snd_pcm_hardware_t azx_pcm_hw = {
899 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | 949 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
900 SNDRV_PCM_INFO_BLOCK_TRANSFER | 950 SNDRV_PCM_INFO_BLOCK_TRANSFER |
901 SNDRV_PCM_INFO_MMAP_VALID | 951 SNDRV_PCM_INFO_MMAP_VALID |
902 SNDRV_PCM_INFO_PAUSE | 952 SNDRV_PCM_INFO_PAUSE /*|*/
903 SNDRV_PCM_INFO_RESUME), 953 /*SNDRV_PCM_INFO_RESUME*/),
904 .formats = SNDRV_PCM_FMTBIT_S16_LE, 954 .formats = SNDRV_PCM_FMTBIT_S16_LE,
905 .rates = SNDRV_PCM_RATE_48000, 955 .rates = SNDRV_PCM_RATE_48000,
906 .rate_min = 48000, 956 .rate_min = 48000,
@@ -1049,6 +1099,7 @@ static int azx_pcm_trigger(snd_pcm_substream_t *substream, int cmd)
1049 azx_dev->running = 1; 1099 azx_dev->running = 1;
1050 break; 1100 break;
1051 case SNDRV_PCM_TRIGGER_PAUSE_PUSH: 1101 case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
1102 case SNDRV_PCM_TRIGGER_SUSPEND:
1052 case SNDRV_PCM_TRIGGER_STOP: 1103 case SNDRV_PCM_TRIGGER_STOP:
1053 azx_stream_stop(chip, azx_dev); 1104 azx_stream_stop(chip, azx_dev);
1054 azx_dev->running = 0; 1105 azx_dev->running = 0;
@@ -1058,6 +1109,7 @@ static int azx_pcm_trigger(snd_pcm_substream_t *substream, int cmd)
1058 } 1109 }
1059 spin_unlock(&chip->reg_lock); 1110 spin_unlock(&chip->reg_lock);
1060 if (cmd == SNDRV_PCM_TRIGGER_PAUSE_PUSH || 1111 if (cmd == SNDRV_PCM_TRIGGER_PAUSE_PUSH ||
1112 cmd == SNDRV_PCM_TRIGGER_SUSPEND ||
1061 cmd == SNDRV_PCM_TRIGGER_STOP) { 1113 cmd == SNDRV_PCM_TRIGGER_STOP) {
1062 int timeout = 5000; 1114 int timeout = 5000;
1063 while (azx_sd_readb(azx_dev, SD_CTL) & SD_CTL_DMA_START && --timeout) 1115 while (azx_sd_readb(azx_dev, SD_CTL) & SD_CTL_DMA_START && --timeout)
@@ -1136,6 +1188,7 @@ static int __devinit create_codec_pcm(azx_t *chip, struct hda_codec *codec,
1136 snd_dma_pci_data(chip->pci), 1188 snd_dma_pci_data(chip->pci),
1137 1024 * 64, 1024 * 128); 1189 1024 * 64, 1024 * 128);
1138 chip->pcm[pcm_dev] = pcm; 1190 chip->pcm[pcm_dev] = pcm;
1191 chip->pcm_devs = pcm_dev + 1;
1139 1192
1140 return 0; 1193 return 0;
1141} 1194}
@@ -1186,7 +1239,7 @@ static int __devinit azx_init_stream(azx_t *chip)
1186 /* initialize each stream (aka device) 1239 /* initialize each stream (aka device)
1187 * assign the starting bdl address to each stream (device) and initialize 1240 * assign the starting bdl address to each stream (device) and initialize
1188 */ 1241 */
1189 for (i = 0; i < MAX_ICH6_DEV; i++) { 1242 for (i = 0; i < chip->num_streams; i++) {
1190 unsigned int off = sizeof(u32) * (i * AZX_MAX_FRAG * 4); 1243 unsigned int off = sizeof(u32) * (i * AZX_MAX_FRAG * 4);
1191 azx_dev_t *azx_dev = &chip->azx_dev[i]; 1244 azx_dev_t *azx_dev = &chip->azx_dev[i];
1192 azx_dev->bdl = (u32 *)(chip->bdl.area + off); 1245 azx_dev->bdl = (u32 *)(chip->bdl.area + off);
@@ -1245,7 +1298,7 @@ static int azx_free(azx_t *chip)
1245 if (chip->initialized) { 1298 if (chip->initialized) {
1246 int i; 1299 int i;
1247 1300
1248 for (i = 0; i < MAX_ICH6_DEV; i++) 1301 for (i = 0; i < chip->num_streams; i++)
1249 azx_stream_stop(chip, &chip->azx_dev[i]); 1302 azx_stream_stop(chip, &chip->azx_dev[i]);
1250 1303
1251 /* disable interrupts */ 1304 /* disable interrupts */
@@ -1261,10 +1314,10 @@ static int azx_free(azx_t *chip)
1261 1314
1262 /* wait a little for interrupts to finish */ 1315 /* wait a little for interrupts to finish */
1263 msleep(1); 1316 msleep(1);
1264
1265 iounmap(chip->remap_addr);
1266 } 1317 }
1267 1318
1319 if (chip->remap_addr)
1320 iounmap(chip->remap_addr);
1268 if (chip->irq >= 0) 1321 if (chip->irq >= 0)
1269 free_irq(chip->irq, (void*)chip); 1322 free_irq(chip->irq, (void*)chip);
1270 1323
@@ -1276,6 +1329,7 @@ static int azx_free(azx_t *chip)
1276 snd_dma_free_pages(&chip->posbuf); 1329 snd_dma_free_pages(&chip->posbuf);
1277 pci_release_regions(chip->pci); 1330 pci_release_regions(chip->pci);
1278 pci_disable_device(chip->pci); 1331 pci_disable_device(chip->pci);
1332 kfree(chip->azx_dev);
1279 kfree(chip); 1333 kfree(chip);
1280 1334
1281 return 0; 1335 return 0;
@@ -1290,7 +1344,8 @@ static int azx_dev_free(snd_device_t *device)
1290 * constructor 1344 * constructor
1291 */ 1345 */
1292static int __devinit azx_create(snd_card_t *card, struct pci_dev *pci, 1346static int __devinit azx_create(snd_card_t *card, struct pci_dev *pci,
1293 int posfix, azx_t **rchip) 1347 int posfix, int driver_type,
1348 azx_t **rchip)
1294{ 1349{
1295 azx_t *chip; 1350 azx_t *chip;
1296 int err = 0; 1351 int err = 0;
@@ -1316,9 +1371,20 @@ static int __devinit azx_create(snd_card_t *card, struct pci_dev *pci,
1316 chip->card = card; 1371 chip->card = card;
1317 chip->pci = pci; 1372 chip->pci = pci;
1318 chip->irq = -1; 1373 chip->irq = -1;
1374 chip->driver_type = driver_type;
1319 1375
1320 chip->position_fix = posfix; 1376 chip->position_fix = posfix;
1321 1377
1378#if BITS_PER_LONG != 64
1379 /* Fix up base address on ULI M5461 */
1380 if (chip->driver_type == AZX_DRIVER_ULI) {
1381 u16 tmp3;
1382 pci_read_config_word(pci, 0x40, &tmp3);
1383 pci_write_config_word(pci, 0x40, tmp3 | 0x10);
1384 pci_write_config_dword(pci, PCI_BASE_ADDRESS_1, 0);
1385 }
1386#endif
1387
1322 if ((err = pci_request_regions(pci, "ICH HD audio")) < 0) { 1388 if ((err = pci_request_regions(pci, "ICH HD audio")) < 0) {
1323 kfree(chip); 1389 kfree(chip);
1324 pci_disable_device(pci); 1390 pci_disable_device(pci);
@@ -1344,16 +1410,37 @@ static int __devinit azx_create(snd_card_t *card, struct pci_dev *pci,
1344 pci_set_master(pci); 1410 pci_set_master(pci);
1345 synchronize_irq(chip->irq); 1411 synchronize_irq(chip->irq);
1346 1412
1413 switch (chip->driver_type) {
1414 case AZX_DRIVER_ULI:
1415 chip->playback_streams = ULI_NUM_PLAYBACK;
1416 chip->capture_streams = ULI_NUM_CAPTURE;
1417 chip->playback_index_offset = ULI_PLAYBACK_INDEX;
1418 chip->capture_index_offset = ULI_CAPTURE_INDEX;
1419 break;
1420 default:
1421 chip->playback_streams = ICH6_NUM_PLAYBACK;
1422 chip->capture_streams = ICH6_NUM_CAPTURE;
1423 chip->playback_index_offset = ICH6_PLAYBACK_INDEX;
1424 chip->capture_index_offset = ICH6_CAPTURE_INDEX;
1425 break;
1426 }
1427 chip->num_streams = chip->playback_streams + chip->capture_streams;
1428 chip->azx_dev = kcalloc(chip->num_streams, sizeof(*chip->azx_dev), GFP_KERNEL);
1429 if (! chip->azx_dev) {
1430 snd_printk(KERN_ERR "cannot malloc azx_dev\n");
1431 goto errout;
1432 }
1433
1347 /* allocate memory for the BDL for each stream */ 1434 /* allocate memory for the BDL for each stream */
1348 if ((err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(chip->pci), 1435 if ((err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(chip->pci),
1349 PAGE_SIZE, &chip->bdl)) < 0) { 1436 BDL_SIZE, &chip->bdl)) < 0) {
1350 snd_printk(KERN_ERR SFX "cannot allocate BDL\n"); 1437 snd_printk(KERN_ERR SFX "cannot allocate BDL\n");
1351 goto errout; 1438 goto errout;
1352 } 1439 }
1353 if (chip->position_fix == POS_FIX_POSBUF) { 1440 if (chip->position_fix == POS_FIX_POSBUF) {
1354 /* allocate memory for the position buffer */ 1441 /* allocate memory for the position buffer */
1355 if ((err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(chip->pci), 1442 if ((err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(chip->pci),
1356 MAX_ICH6_DEV * 8, &chip->posbuf)) < 0) { 1443 chip->num_streams * 8, &chip->posbuf)) < 0) {
1357 snd_printk(KERN_ERR SFX "cannot allocate posbuf\n"); 1444 snd_printk(KERN_ERR SFX "cannot allocate posbuf\n");
1358 goto errout; 1445 goto errout;
1359 } 1446 }
@@ -1382,6 +1469,10 @@ static int __devinit azx_create(snd_card_t *card, struct pci_dev *pci,
1382 goto errout; 1469 goto errout;
1383 } 1470 }
1384 1471
1472 strcpy(card->driver, "HDA-Intel");
1473 strcpy(card->shortname, driver_short_names[chip->driver_type]);
1474 sprintf(card->longname, "%s at 0x%lx irq %i", card->shortname, chip->addr, chip->irq);
1475
1385 *rchip = chip; 1476 *rchip = chip;
1386 return 0; 1477 return 0;
1387 1478
@@ -1410,15 +1501,12 @@ static int __devinit azx_probe(struct pci_dev *pci, const struct pci_device_id *
1410 return -ENOMEM; 1501 return -ENOMEM;
1411 } 1502 }
1412 1503
1413 if ((err = azx_create(card, pci, position_fix[dev], &chip)) < 0) { 1504 if ((err = azx_create(card, pci, position_fix[dev], pci_id->driver_data,
1505 &chip)) < 0) {
1414 snd_card_free(card); 1506 snd_card_free(card);
1415 return err; 1507 return err;
1416 } 1508 }
1417 1509
1418 strcpy(card->driver, "HDA-Intel");
1419 strcpy(card->shortname, "HDA Intel");
1420 sprintf(card->longname, "%s at 0x%lx irq %i", card->shortname, chip->addr, chip->irq);
1421
1422 /* create codec instances */ 1510 /* create codec instances */
1423 if ((err = azx_codec_create(chip, model[dev])) < 0) { 1511 if ((err = azx_codec_create(chip, model[dev])) < 0) {
1424 snd_card_free(card); 1512 snd_card_free(card);
@@ -1459,12 +1547,13 @@ static void __devexit azx_remove(struct pci_dev *pci)
1459 1547
1460/* PCI IDs */ 1548/* PCI IDs */
1461static struct pci_device_id azx_ids[] = { 1549static struct pci_device_id azx_ids[] = {
1462 { 0x8086, 0x2668, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* ICH6 */ 1550 { 0x8086, 0x2668, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ICH }, /* ICH6 */
1463 { 0x8086, 0x27d8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* ICH7 */ 1551 { 0x8086, 0x27d8, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ICH }, /* ICH7 */
1464 { 0x8086, 0x269a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* ESB2 */ 1552 { 0x8086, 0x269a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ICH }, /* ESB2 */
1465 { 0x1002, 0x437b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* ATI SB450 */ 1553 { 0x1002, 0x437b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ATI }, /* ATI SB450 */
1466 { 0x1106, 0x3288, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* VIA VT8251/VT8237A */ 1554 { 0x1106, 0x3288, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_VIA }, /* VIA VT8251/VT8237A */
1467 { 0x10b9, 0x5461, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* ALI 5461? */ 1555 { 0x1039, 0x7502, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_SIS }, /* SIS966 */
1556 { 0x10b9, 0x5461, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ULI }, /* ULI M5461 */
1468 { 0, } 1557 { 0, }
1469}; 1558};
1470MODULE_DEVICE_TABLE(pci, azx_ids); 1559MODULE_DEVICE_TABLE(pci, azx_ids);
diff --git a/sound/pci/hda/hda_patch.h b/sound/pci/hda/hda_patch.h
index a5de684b6944..acaef3c811b8 100644
--- a/sound/pci/hda/hda_patch.h
+++ b/sound/pci/hda/hda_patch.h
@@ -10,11 +10,14 @@ extern struct hda_codec_preset snd_hda_preset_cmedia[];
10extern struct hda_codec_preset snd_hda_preset_analog[]; 10extern struct hda_codec_preset snd_hda_preset_analog[];
11/* SigmaTel codecs */ 11/* SigmaTel codecs */
12extern struct hda_codec_preset snd_hda_preset_sigmatel[]; 12extern struct hda_codec_preset snd_hda_preset_sigmatel[];
13/* SiLabs 3054/3055 modem codecs */
14extern struct hda_codec_preset snd_hda_preset_si3054[];
13 15
14static const struct hda_codec_preset *hda_preset_tables[] = { 16static const struct hda_codec_preset *hda_preset_tables[] = {
15 snd_hda_preset_realtek, 17 snd_hda_preset_realtek,
16 snd_hda_preset_cmedia, 18 snd_hda_preset_cmedia,
17 snd_hda_preset_analog, 19 snd_hda_preset_analog,
18 snd_hda_preset_sigmatel, 20 snd_hda_preset_sigmatel,
21 snd_hda_preset_si3054,
19 NULL 22 NULL
20}; 23};
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
index 2fd05bb84136..bceb83a42a38 100644
--- a/sound/pci/hda/patch_analog.c
+++ b/sound/pci/hda/patch_analog.c
@@ -572,7 +572,7 @@ static snd_kcontrol_new_t ad1983_mixers[] = {
572 }, 572 },
573 { 573 {
574 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 574 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
575 .name = "IEC958 Playback Route", 575 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,NONE) "Route",
576 .info = ad1983_spdif_route_info, 576 .info = ad1983_spdif_route_info,
577 .get = ad1983_spdif_route_get, 577 .get = ad1983_spdif_route_get,
578 .put = ad1983_spdif_route_put, 578 .put = ad1983_spdif_route_put,
@@ -705,7 +705,7 @@ static snd_kcontrol_new_t ad1981_mixers[] = {
705 /* identical with AD1983 */ 705 /* identical with AD1983 */
706 { 706 {
707 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 707 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
708 .name = "IEC958 Playback Route", 708 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,NONE) "Route",
709 .info = ad1983_spdif_route_info, 709 .info = ad1983_spdif_route_info,
710 .get = ad1983_spdif_route_get, 710 .get = ad1983_spdif_route_get,
711 .put = ad1983_spdif_route_put, 711 .put = ad1983_spdif_route_put,
diff --git a/sound/pci/hda/patch_cmedia.c b/sound/pci/hda/patch_cmedia.c
index 86f195f19eef..07fb4f5a54b3 100644
--- a/sound/pci/hda/patch_cmedia.c
+++ b/sound/pci/hda/patch_cmedia.c
@@ -647,6 +647,7 @@ static struct hda_board_config cmi9880_cfg_tbl[] = {
647 { .modelname = "min_fp", .config = CMI_MIN_FP }, 647 { .modelname = "min_fp", .config = CMI_MIN_FP },
648 { .modelname = "full", .config = CMI_FULL }, 648 { .modelname = "full", .config = CMI_FULL },
649 { .modelname = "full_dig", .config = CMI_FULL_DIG }, 649 { .modelname = "full_dig", .config = CMI_FULL_DIG },
650 { .pci_subvendor = 0x1043, .pci_subdevice = 0x813d, .config = CMI_FULL_DIG }, /* ASUS P5AD2 */
650 { .modelname = "allout", .config = CMI_ALLOUT }, 651 { .modelname = "allout", .config = CMI_ALLOUT },
651 { .modelname = "auto", .config = CMI_AUTO }, 652 { .modelname = "auto", .config = CMI_AUTO },
652 {} /* terminator */ 653 {} /* terminator */
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 9b8569900787..eeb900ab79af 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -687,6 +687,12 @@ static snd_kcontrol_new_t alc880_asus_w1v_mixer[] = {
687 { } /* end */ 687 { } /* end */
688}; 688};
689 689
690/* additional mixers to alc880_asus_mixer */
691static snd_kcontrol_new_t alc880_pcbeep_mixer[] = {
692 HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
693 HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
694 { } /* end */
695};
690 696
691/* 697/*
692 * build control elements 698 * build control elements
@@ -1524,6 +1530,7 @@ static struct hda_board_config alc880_cfg_tbl[] = {
1524 /* Back 3 jack plus 1 SPDIF out jack, front 2 jack */ 1530 /* Back 3 jack plus 1 SPDIF out jack, front 2 jack */
1525 { .modelname = "3stack-digout", .config = ALC880_3ST_DIG }, 1531 { .modelname = "3stack-digout", .config = ALC880_3ST_DIG },
1526 { .pci_subvendor = 0x8086, .pci_subdevice = 0xe308, .config = ALC880_3ST_DIG }, 1532 { .pci_subvendor = 0x8086, .pci_subdevice = 0xe308, .config = ALC880_3ST_DIG },
1533 { .pci_subvendor = 0x1025, .pci_subdevice = 0x0070, .config = ALC880_3ST_DIG },
1527 1534
1528 /* Back 3 jack plus 1 SPDIF out jack, front 2 jack (Internal add Aux-In)*/ 1535 /* Back 3 jack plus 1 SPDIF out jack, front 2 jack (Internal add Aux-In)*/
1529 { .pci_subvendor = 0x8086, .pci_subdevice = 0xe305, .config = ALC880_3ST_DIG }, 1536 { .pci_subvendor = 0x8086, .pci_subdevice = 0xe305, .config = ALC880_3ST_DIG },
@@ -1734,7 +1741,7 @@ static struct alc_config_preset alc880_presets[] = {
1734 .input_mux = &alc880_capture_source, 1741 .input_mux = &alc880_capture_source,
1735 }, 1742 },
1736 [ALC880_UNIWILL_DIG] = { 1743 [ALC880_UNIWILL_DIG] = {
1737 .mixers = { alc880_asus_mixer }, 1744 .mixers = { alc880_asus_mixer, alc880_pcbeep_mixer },
1738 .init_verbs = { alc880_volume_init_verbs, alc880_pin_asus_init_verbs }, 1745 .init_verbs = { alc880_volume_init_verbs, alc880_pin_asus_init_verbs },
1739 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids), 1746 .num_dacs = ARRAY_SIZE(alc880_asus_dac_nids),
1740 .dac_nids = alc880_asus_dac_nids, 1747 .dac_nids = alc880_asus_dac_nids,
diff --git a/sound/pci/hda/patch_si3054.c b/sound/pci/hda/patch_si3054.c
new file mode 100644
index 000000000000..b0270d1b64ce
--- /dev/null
+++ b/sound/pci/hda/patch_si3054.c
@@ -0,0 +1,300 @@
1/*
2 * Universal Interface for Intel High Definition Audio Codec
3 *
4 * HD audio interface patch for Silicon Labs 3054/5 modem codec
5 *
6 * Copyright (c) 2005 Sasha Khapyorsky <sashak@smlink.com>
7 * Takashi Iwai <tiwai@suse.de>
8 *
9 *
10 * This driver is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
14 *
15 * This driver is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 */
24
25#include <sound/driver.h>
26#include <linux/init.h>
27#include <linux/delay.h>
28#include <linux/slab.h>
29#include <linux/pci.h>
30#include <sound/core.h>
31#include "hda_codec.h"
32#include "hda_local.h"
33
34
35/* si3054 verbs */
36#define SI3054_VERB_READ_NODE 0x900
37#define SI3054_VERB_WRITE_NODE 0x100
38
39/* si3054 nodes (registers) */
40#define SI3054_EXTENDED_MID 2
41#define SI3054_LINE_RATE 3
42#define SI3054_LINE_LEVEL 4
43#define SI3054_GPIO_CFG 5
44#define SI3054_GPIO_POLARITY 6
45#define SI3054_GPIO_STICKY 7
46#define SI3054_GPIO_WAKEUP 8
47#define SI3054_GPIO_STATUS 9
48#define SI3054_GPIO_CONTROL 10
49#define SI3054_MISC_AFE 11
50#define SI3054_CHIPID 12
51#define SI3054_LINE_CFG1 13
52#define SI3054_LINE_STATUS 14
53#define SI3054_DC_TERMINATION 15
54#define SI3054_LINE_CONFIG 16
55#define SI3054_CALLPROG_ATT 17
56#define SI3054_SQ_CONTROL 18
57#define SI3054_MISC_CONTROL 19
58#define SI3054_RING_CTRL1 20
59#define SI3054_RING_CTRL2 21
60
61/* extended MID */
62#define SI3054_MEI_READY 0xf
63
64/* line level */
65#define SI3054_ATAG_MASK 0x00f0
66#define SI3054_DTAG_MASK 0xf000
67
68/* GPIO bits */
69#define SI3054_GPIO_OH 0x0001
70#define SI3054_GPIO_CID 0x0002
71
72/* chipid and revisions */
73#define SI3054_CHIPID_CODEC_REV_MASK 0x000f
74#define SI3054_CHIPID_DAA_REV_MASK 0x00f0
75#define SI3054_CHIPID_INTERNATIONAL 0x0100
76#define SI3054_CHIPID_DAA_ID 0x0f00
77#define SI3054_CHIPID_CODEC_ID (1<<12)
78
79/* si3054 codec registers (nodes) access macros */
80#define GET_REG(codec,reg) (snd_hda_codec_read(codec,reg,0,SI3054_VERB_READ_NODE,0))
81#define SET_REG(codec,reg,val) (snd_hda_codec_write(codec,reg,0,SI3054_VERB_WRITE_NODE,val))
82
83
84struct si3054_spec {
85 unsigned international;
86 struct hda_pcm pcm;
87};
88
89
90/*
91 * Modem mixer
92 */
93
94#define PRIVATE_VALUE(reg,mask) ((reg<<16)|(mask&0xffff))
95#define PRIVATE_REG(val) ((val>>16)&0xffff)
96#define PRIVATE_MASK(val) (val&0xffff)
97
98static int si3054_switch_info(snd_kcontrol_t *kcontrol,
99 snd_ctl_elem_info_t *uinfo)
100{
101 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
102 uinfo->count = 1;
103 uinfo->value.integer.min = 0;
104 uinfo->value.integer.max = 1;
105 return 0;
106}
107
108static int si3054_switch_get(snd_kcontrol_t *kcontrol,
109 snd_ctl_elem_value_t *uvalue)
110{
111 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
112 u16 reg = PRIVATE_REG(kcontrol->private_value);
113 u16 mask = PRIVATE_MASK(kcontrol->private_value);
114 uvalue->value.integer.value[0] = (GET_REG(codec, reg)) & mask ? 1 : 0 ;
115 return 0;
116}
117
118static int si3054_switch_put(snd_kcontrol_t *kcontrol,
119 snd_ctl_elem_value_t *uvalue)
120{
121 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
122 u16 reg = PRIVATE_REG(kcontrol->private_value);
123 u16 mask = PRIVATE_MASK(kcontrol->private_value);
124 if (uvalue->value.integer.value[0])
125 SET_REG(codec, reg, (GET_REG(codec, reg)) | mask);
126 else
127 SET_REG(codec, reg, (GET_REG(codec, reg)) & ~mask);
128 return 0;
129}
130
131#define SI3054_KCONTROL(kname,reg,mask) { \
132 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
133 .name = kname, \
134 .info = si3054_switch_info, \
135 .get = si3054_switch_get, \
136 .put = si3054_switch_put, \
137 .private_value = PRIVATE_VALUE(reg,mask), \
138}
139
140
141static snd_kcontrol_new_t si3054_modem_mixer[] = {
142 SI3054_KCONTROL("Off-hook Switch", SI3054_GPIO_CONTROL, SI3054_GPIO_OH),
143 SI3054_KCONTROL("Caller ID Switch", SI3054_GPIO_CONTROL, SI3054_GPIO_CID),
144 {}
145};
146
147static int si3054_build_controls(struct hda_codec *codec)
148{
149 return snd_hda_add_new_ctls(codec, si3054_modem_mixer);
150}
151
152
153/*
154 * PCM callbacks
155 */
156
157static int si3054_pcm_prepare(struct hda_pcm_stream *hinfo,
158 struct hda_codec *codec,
159 unsigned int stream_tag,
160 unsigned int format,
161 snd_pcm_substream_t *substream)
162{
163 u16 val;
164
165 SET_REG(codec, SI3054_LINE_RATE, substream->runtime->rate);
166 val = GET_REG(codec, SI3054_LINE_LEVEL);
167 val &= 0xff << (8 * (substream->stream != SNDRV_PCM_STREAM_PLAYBACK));
168 val |= ((stream_tag & 0xf) << 4) << (8 * (substream->stream == SNDRV_PCM_STREAM_PLAYBACK));
169 SET_REG(codec, SI3054_LINE_LEVEL, val);
170
171 snd_hda_codec_setup_stream(codec, hinfo->nid,
172 stream_tag, 0, format);
173 return 0;
174}
175
176static int si3054_pcm_open(struct hda_pcm_stream *hinfo,
177 struct hda_codec *codec,
178 snd_pcm_substream_t *substream)
179{
180 static unsigned int rates[] = { 8000, 9600, 16000 };
181 static snd_pcm_hw_constraint_list_t hw_constraints_rates = {
182 .count = ARRAY_SIZE(rates),
183 .list = rates,
184 .mask = 0,
185 };
186 substream->runtime->hw.period_bytes_min = 80;
187 return snd_pcm_hw_constraint_list(substream->runtime, 0,
188 SNDRV_PCM_HW_PARAM_RATE, &hw_constraints_rates);
189}
190
191
192static struct hda_pcm_stream si3054_pcm = {
193 .substreams = 1,
194 .channels_min = 1,
195 .channels_max = 1,
196 .nid = 0x1,
197 .rates = SNDRV_PCM_RATE_8000|SNDRV_PCM_RATE_16000|SNDRV_PCM_RATE_KNOT,
198 .formats = SNDRV_PCM_FMTBIT_S16_LE,
199 .maxbps = 16,
200 .ops = {
201 .open = si3054_pcm_open,
202 .prepare = si3054_pcm_prepare,
203 },
204};
205
206
207static int si3054_build_pcms(struct hda_codec *codec)
208{
209 struct si3054_spec *spec = codec->spec;
210 struct hda_pcm *info = &spec->pcm;
211 si3054_pcm.nid = codec->mfg;
212 codec->num_pcms = 1;
213 codec->pcm_info = info;
214 info->name = "Si3054 Modem";
215 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = si3054_pcm;
216 info->stream[SNDRV_PCM_STREAM_CAPTURE] = si3054_pcm;
217 return 0;
218}
219
220
221/*
222 * Init part
223 */
224
225static int si3054_init(struct hda_codec *codec)
226{
227 struct si3054_spec *spec = codec->spec;
228 unsigned wait_count;
229 u16 val;
230
231 snd_hda_codec_write(codec, AC_NODE_ROOT, 0, AC_VERB_SET_CODEC_RESET, 0);
232 snd_hda_codec_write(codec, codec->mfg, 0, AC_VERB_SET_STREAM_FORMAT, 0);
233 SET_REG(codec, SI3054_LINE_RATE, 9600);
234 SET_REG(codec, SI3054_LINE_LEVEL, SI3054_DTAG_MASK|SI3054_ATAG_MASK);
235 SET_REG(codec, SI3054_EXTENDED_MID, 0);
236
237 wait_count = 10;
238 do {
239 msleep(2);
240 val = GET_REG(codec, SI3054_EXTENDED_MID);
241 } while ((val & SI3054_MEI_READY) != SI3054_MEI_READY && wait_count--);
242
243 if((val&SI3054_MEI_READY) != SI3054_MEI_READY) {
244 snd_printk(KERN_ERR "si3054: cannot initialize. EXT MID = %04x\n", val);
245 return -EACCES;
246 }
247
248 SET_REG(codec, SI3054_GPIO_POLARITY, 0xffff);
249 SET_REG(codec, SI3054_GPIO_CFG, 0x0);
250 SET_REG(codec, SI3054_MISC_AFE, 0);
251 SET_REG(codec, SI3054_LINE_CFG1,0x200);
252
253 if((GET_REG(codec,SI3054_LINE_STATUS) & (1<<6)) == 0) {
254 snd_printd("Link Frame Detect(FDT) is not ready (line status: %04x)\n",
255 GET_REG(codec,SI3054_LINE_STATUS));
256 }
257
258 spec->international = GET_REG(codec, SI3054_CHIPID) & SI3054_CHIPID_INTERNATIONAL;
259
260 return 0;
261}
262
263static void si3054_free(struct hda_codec *codec)
264{
265 kfree(codec->spec);
266}
267
268
269/*
270 */
271
272static struct hda_codec_ops si3054_patch_ops = {
273 .build_controls = si3054_build_controls,
274 .build_pcms = si3054_build_pcms,
275 .init = si3054_init,
276 .free = si3054_free,
277#ifdef CONFIG_PM
278 //.suspend = si3054_suspend,
279 .resume = si3054_init,
280#endif
281};
282
283static int patch_si3054(struct hda_codec *codec)
284{
285 struct si3054_spec *spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
286 if (spec == NULL)
287 return -ENOMEM;
288 codec->spec = spec;
289 codec->patch_ops = si3054_patch_ops;
290 return 0;
291}
292
293/*
294 * patch entries
295 */
296struct hda_codec_preset snd_hda_preset_si3054[] = {
297 { .id = 0x163c3155, .name = "Si3054", .patch = patch_si3054 },
298 {}
299};
300
diff --git a/sound/pci/ice1712/delta.c b/sound/pci/ice1712/delta.c
index eb20f73be61a..39fbe662965d 100644
--- a/sound/pci/ice1712/delta.c
+++ b/sound/pci/ice1712/delta.c
@@ -618,15 +618,15 @@ static int __devinit snd_ice1712_delta_init(ice1712_t *ice)
618 */ 618 */
619 619
620static snd_kcontrol_new_t snd_ice1712_delta1010_wordclock_select __devinitdata = 620static snd_kcontrol_new_t snd_ice1712_delta1010_wordclock_select __devinitdata =
621ICE1712_GPIO(SNDRV_CTL_ELEM_IFACE_PCM, "Word Clock Sync", 0, ICE1712_DELTA_WORD_CLOCK_SELECT, 1, 0); 621ICE1712_GPIO(SNDRV_CTL_ELEM_IFACE_MIXER, "Word Clock Sync", 0, ICE1712_DELTA_WORD_CLOCK_SELECT, 1, 0);
622static snd_kcontrol_new_t snd_ice1712_delta1010lt_wordclock_select __devinitdata = 622static snd_kcontrol_new_t snd_ice1712_delta1010lt_wordclock_select __devinitdata =
623ICE1712_GPIO(SNDRV_CTL_ELEM_IFACE_PCM, "Word Clock Sync", 0, ICE1712_DELTA_1010LT_WORDCLOCK, 1, 0); 623ICE1712_GPIO(SNDRV_CTL_ELEM_IFACE_MIXER, "Word Clock Sync", 0, ICE1712_DELTA_1010LT_WORDCLOCK, 1, 0);
624static snd_kcontrol_new_t snd_ice1712_delta1010_wordclock_status __devinitdata = 624static snd_kcontrol_new_t snd_ice1712_delta1010_wordclock_status __devinitdata =
625ICE1712_GPIO(SNDRV_CTL_ELEM_IFACE_PCM, "Word Clock Status", 0, ICE1712_DELTA_WORD_CLOCK_STATUS, 1, SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE); 625ICE1712_GPIO(SNDRV_CTL_ELEM_IFACE_MIXER, "Word Clock Status", 0, ICE1712_DELTA_WORD_CLOCK_STATUS, 1, SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE);
626static snd_kcontrol_new_t snd_ice1712_deltadio2496_spdif_in_select __devinitdata = 626static snd_kcontrol_new_t snd_ice1712_deltadio2496_spdif_in_select __devinitdata =
627ICE1712_GPIO(SNDRV_CTL_ELEM_IFACE_PCM, "IEC958 Input Optical", 0, ICE1712_DELTA_SPDIF_INPUT_SELECT, 0, 0); 627ICE1712_GPIO(SNDRV_CTL_ELEM_IFACE_MIXER, "IEC958 Input Optical", 0, ICE1712_DELTA_SPDIF_INPUT_SELECT, 0, 0);
628static snd_kcontrol_new_t snd_ice1712_delta_spdif_in_status __devinitdata = 628static snd_kcontrol_new_t snd_ice1712_delta_spdif_in_status __devinitdata =
629ICE1712_GPIO(SNDRV_CTL_ELEM_IFACE_PCM, "Delta IEC958 Input Status", 0, ICE1712_DELTA_SPDIF_IN_STAT, 1, SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE); 629ICE1712_GPIO(SNDRV_CTL_ELEM_IFACE_MIXER, "Delta IEC958 Input Status", 0, ICE1712_DELTA_SPDIF_IN_STAT, 1, SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE);
630 630
631 631
632static int __devinit snd_ice1712_delta_add_controls(ice1712_t *ice) 632static int __devinit snd_ice1712_delta_add_controls(ice1712_t *ice)
diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c
index a2545a5b26c4..b97f50d10ba3 100644
--- a/sound/pci/ice1712/ice1712.c
+++ b/sound/pci/ice1712/ice1712.c
@@ -1422,7 +1422,7 @@ static snd_kcontrol_new_t snd_ice1712_multi_capture_analog_switch __devinitdata
1422 1422
1423static snd_kcontrol_new_t snd_ice1712_multi_capture_spdif_switch __devinitdata = { 1423static snd_kcontrol_new_t snd_ice1712_multi_capture_spdif_switch __devinitdata = {
1424 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1424 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1425 .name = "IEC958 Multi Capture Switch", 1425 .name = SNDRV_CTL_NAME_IEC958("Multi ",CAPTURE,SWITCH),
1426 .info = snd_ice1712_pro_mixer_switch_info, 1426 .info = snd_ice1712_pro_mixer_switch_info,
1427 .get = snd_ice1712_pro_mixer_switch_get, 1427 .get = snd_ice1712_pro_mixer_switch_get,
1428 .put = snd_ice1712_pro_mixer_switch_put, 1428 .put = snd_ice1712_pro_mixer_switch_put,
@@ -1441,7 +1441,7 @@ static snd_kcontrol_new_t snd_ice1712_multi_capture_analog_volume __devinitdata
1441 1441
1442static snd_kcontrol_new_t snd_ice1712_multi_capture_spdif_volume __devinitdata = { 1442static snd_kcontrol_new_t snd_ice1712_multi_capture_spdif_volume __devinitdata = {
1443 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1443 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1444 .name = "IEC958 Multi Capture Volume", 1444 .name = SNDRV_CTL_NAME_IEC958("Multi ",CAPTURE,VOLUME),
1445 .info = snd_ice1712_pro_mixer_volume_info, 1445 .info = snd_ice1712_pro_mixer_volume_info,
1446 .get = snd_ice1712_pro_mixer_volume_get, 1446 .get = snd_ice1712_pro_mixer_volume_get,
1447 .put = snd_ice1712_pro_mixer_volume_put, 1447 .put = snd_ice1712_pro_mixer_volume_put,
@@ -1715,7 +1715,7 @@ static int snd_ice1712_spdif_maskp_get(snd_kcontrol_t * kcontrol,
1715static snd_kcontrol_new_t snd_ice1712_spdif_maskc __devinitdata = 1715static snd_kcontrol_new_t snd_ice1712_spdif_maskc __devinitdata =
1716{ 1716{
1717 .access = SNDRV_CTL_ELEM_ACCESS_READ, 1717 .access = SNDRV_CTL_ELEM_ACCESS_READ,
1718 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1718 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
1719 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,CON_MASK), 1719 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,CON_MASK),
1720 .info = snd_ice1712_spdif_info, 1720 .info = snd_ice1712_spdif_info,
1721 .get = snd_ice1712_spdif_maskc_get, 1721 .get = snd_ice1712_spdif_maskc_get,
@@ -1724,7 +1724,7 @@ static snd_kcontrol_new_t snd_ice1712_spdif_maskc __devinitdata =
1724static snd_kcontrol_new_t snd_ice1712_spdif_maskp __devinitdata = 1724static snd_kcontrol_new_t snd_ice1712_spdif_maskp __devinitdata =
1725{ 1725{
1726 .access = SNDRV_CTL_ELEM_ACCESS_READ, 1726 .access = SNDRV_CTL_ELEM_ACCESS_READ,
1727 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1727 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
1728 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,PRO_MASK), 1728 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,PRO_MASK),
1729 .info = snd_ice1712_spdif_info, 1729 .info = snd_ice1712_spdif_info,
1730 .get = snd_ice1712_spdif_maskp_get, 1730 .get = snd_ice1712_spdif_maskp_get,
@@ -2203,7 +2203,7 @@ static snd_kcontrol_new_t snd_ice1712_mixer_pro_analog_route __devinitdata = {
2203 2203
2204static snd_kcontrol_new_t snd_ice1712_mixer_pro_spdif_route __devinitdata = { 2204static snd_kcontrol_new_t snd_ice1712_mixer_pro_spdif_route __devinitdata = {
2205 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2205 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2206 .name = "IEC958 Playback Route", 2206 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,NONE) "Route",
2207 .info = snd_ice1712_pro_route_info, 2207 .info = snd_ice1712_pro_route_info,
2208 .get = snd_ice1712_pro_route_spdif_get, 2208 .get = snd_ice1712_pro_route_spdif_get,
2209 .put = snd_ice1712_pro_route_spdif_put, 2209 .put = snd_ice1712_pro_route_spdif_put,
diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c
index 79b5f12e06fc..c7af5e5fee13 100644
--- a/sound/pci/ice1712/ice1724.c
+++ b/sound/pci/ice1712/ice1724.c
@@ -1414,7 +1414,7 @@ static int snd_vt1724_spdif_maskp_get(snd_kcontrol_t * kcontrol,
1414static snd_kcontrol_new_t snd_vt1724_spdif_maskc __devinitdata = 1414static snd_kcontrol_new_t snd_vt1724_spdif_maskc __devinitdata =
1415{ 1415{
1416 .access = SNDRV_CTL_ELEM_ACCESS_READ, 1416 .access = SNDRV_CTL_ELEM_ACCESS_READ,
1417 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1417 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
1418 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,CON_MASK), 1418 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,CON_MASK),
1419 .info = snd_vt1724_spdif_info, 1419 .info = snd_vt1724_spdif_info,
1420 .get = snd_vt1724_spdif_maskc_get, 1420 .get = snd_vt1724_spdif_maskc_get,
@@ -1423,7 +1423,7 @@ static snd_kcontrol_new_t snd_vt1724_spdif_maskc __devinitdata =
1423static snd_kcontrol_new_t snd_vt1724_spdif_maskp __devinitdata = 1423static snd_kcontrol_new_t snd_vt1724_spdif_maskp __devinitdata =
1424{ 1424{
1425 .access = SNDRV_CTL_ELEM_ACCESS_READ, 1425 .access = SNDRV_CTL_ELEM_ACCESS_READ,
1426 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1426 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
1427 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,PRO_MASK), 1427 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,PRO_MASK),
1428 .info = snd_vt1724_spdif_info, 1428 .info = snd_vt1724_spdif_info,
1429 .get = snd_vt1724_spdif_maskp_get, 1429 .get = snd_vt1724_spdif_maskp_get,
@@ -1466,7 +1466,7 @@ static snd_kcontrol_new_t snd_vt1724_spdif_switch __devinitdata =
1466 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1466 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1467 /* FIXME: the following conflict with IEC958 Playback Route */ 1467 /* FIXME: the following conflict with IEC958 Playback Route */
1468 // .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,SWITCH), 1468 // .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,SWITCH),
1469 .name = "IEC958 Output Switch", 1469 .name = SNDRV_CTL_NAME_IEC958("Output ",NONE,SWITCH),
1470 .info = snd_vt1724_spdif_sw_info, 1470 .info = snd_vt1724_spdif_sw_info,
1471 .get = snd_vt1724_spdif_sw_get, 1471 .get = snd_vt1724_spdif_sw_get,
1472 .put = snd_vt1724_spdif_sw_put 1472 .put = snd_vt1724_spdif_sw_put
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c
index d7af3e474432..7b548416dcef 100644
--- a/sound/pci/intel8x0.c
+++ b/sound/pci/intel8x0.c
@@ -389,6 +389,7 @@ typedef struct {
389 struct ac97_pcm *pcm; 389 struct ac97_pcm *pcm;
390 int pcm_open_flag; 390 int pcm_open_flag;
391 unsigned int page_attr_changed: 1; 391 unsigned int page_attr_changed: 1;
392 unsigned int suspended: 1;
392} ichdev_t; 393} ichdev_t;
393 394
394typedef struct _snd_intel8x0 intel8x0_t; 395typedef struct _snd_intel8x0 intel8x0_t;
@@ -862,12 +863,16 @@ static int snd_intel8x0_pcm_trigger(snd_pcm_substream_t *substream, int cmd)
862 unsigned long port = ichdev->reg_offset; 863 unsigned long port = ichdev->reg_offset;
863 864
864 switch (cmd) { 865 switch (cmd) {
865 case SNDRV_PCM_TRIGGER_START:
866 case SNDRV_PCM_TRIGGER_RESUME: 866 case SNDRV_PCM_TRIGGER_RESUME:
867 ichdev->suspended = 0;
868 /* fallthru */
869 case SNDRV_PCM_TRIGGER_START:
867 val = ICH_IOCE | ICH_STARTBM; 870 val = ICH_IOCE | ICH_STARTBM;
868 break; 871 break;
869 case SNDRV_PCM_TRIGGER_STOP:
870 case SNDRV_PCM_TRIGGER_SUSPEND: 872 case SNDRV_PCM_TRIGGER_SUSPEND:
873 ichdev->suspended = 1;
874 /* fallthru */
875 case SNDRV_PCM_TRIGGER_STOP:
871 val = 0; 876 val = 0;
872 break; 877 break;
873 case SNDRV_PCM_TRIGGER_PAUSE_PUSH: 878 case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
@@ -899,9 +904,11 @@ static int snd_intel8x0_ali_trigger(snd_pcm_substream_t *substream, int cmd)
899 904
900 val = igetdword(chip, ICHREG(ALI_DMACR)); 905 val = igetdword(chip, ICHREG(ALI_DMACR));
901 switch (cmd) { 906 switch (cmd) {
907 case SNDRV_PCM_TRIGGER_RESUME:
908 ichdev->suspended = 0;
909 /* fallthru */
902 case SNDRV_PCM_TRIGGER_START: 910 case SNDRV_PCM_TRIGGER_START:
903 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: 911 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
904 case SNDRV_PCM_TRIGGER_RESUME:
905 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { 912 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
906 /* clear FIFO for synchronization of channels */ 913 /* clear FIFO for synchronization of channels */
907 fifo = igetdword(chip, fiforeg[ichdev->ali_slot / 4]); 914 fifo = igetdword(chip, fiforeg[ichdev->ali_slot / 4]);
@@ -913,9 +920,11 @@ static int snd_intel8x0_ali_trigger(snd_pcm_substream_t *substream, int cmd)
913 val &= ~(1 << (ichdev->ali_slot + 16)); /* clear PAUSE flag */ 920 val &= ~(1 << (ichdev->ali_slot + 16)); /* clear PAUSE flag */
914 iputdword(chip, ICHREG(ALI_DMACR), val | (1 << ichdev->ali_slot)); /* start DMA */ 921 iputdword(chip, ICHREG(ALI_DMACR), val | (1 << ichdev->ali_slot)); /* start DMA */
915 break; 922 break;
923 case SNDRV_PCM_TRIGGER_SUSPEND:
924 ichdev->suspended = 1;
925 /* fallthru */
916 case SNDRV_PCM_TRIGGER_STOP: 926 case SNDRV_PCM_TRIGGER_STOP:
917 case SNDRV_PCM_TRIGGER_PAUSE_PUSH: 927 case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
918 case SNDRV_PCM_TRIGGER_SUSPEND:
919 iputdword(chip, ICHREG(ALI_DMACR), val | (1 << (ichdev->ali_slot + 16))); /* pause */ 928 iputdword(chip, ICHREG(ALI_DMACR), val | (1 << (ichdev->ali_slot + 16))); /* pause */
920 iputbyte(chip, port + ICH_REG_OFF_CR, 0); 929 iputbyte(chip, port + ICH_REG_OFF_CR, 0);
921 while (igetbyte(chip, port + ICH_REG_OFF_CR)) 930 while (igetbyte(chip, port + ICH_REG_OFF_CR))
@@ -994,6 +1003,8 @@ static void snd_intel8x0_setup_pcm_out(intel8x0_t *chip,
994{ 1003{
995 unsigned int cnt; 1004 unsigned int cnt;
996 int dbl = runtime->rate > 48000; 1005 int dbl = runtime->rate > 48000;
1006
1007 spin_lock_irq(&chip->reg_lock);
997 switch (chip->device_type) { 1008 switch (chip->device_type) {
998 case DEVICE_ALI: 1009 case DEVICE_ALI:
999 cnt = igetdword(chip, ICHREG(ALI_SCR)); 1010 cnt = igetdword(chip, ICHREG(ALI_SCR));
@@ -1037,6 +1048,7 @@ static void snd_intel8x0_setup_pcm_out(intel8x0_t *chip,
1037 iputdword(chip, ICHREG(GLOB_CNT), cnt); 1048 iputdword(chip, ICHREG(GLOB_CNT), cnt);
1038 break; 1049 break;
1039 } 1050 }
1051 spin_unlock_irq(&chip->reg_lock);
1040} 1052}
1041 1053
1042static int snd_intel8x0_pcm_prepare(snd_pcm_substream_t * substream) 1054static int snd_intel8x0_pcm_prepare(snd_pcm_substream_t * substream)
@@ -1048,15 +1060,12 @@ static int snd_intel8x0_pcm_prepare(snd_pcm_substream_t * substream)
1048 ichdev->physbuf = runtime->dma_addr; 1060 ichdev->physbuf = runtime->dma_addr;
1049 ichdev->size = snd_pcm_lib_buffer_bytes(substream); 1061 ichdev->size = snd_pcm_lib_buffer_bytes(substream);
1050 ichdev->fragsize = snd_pcm_lib_period_bytes(substream); 1062 ichdev->fragsize = snd_pcm_lib_period_bytes(substream);
1051 spin_lock_irq(&chip->reg_lock);
1052 if (ichdev->ichd == ICHD_PCMOUT) { 1063 if (ichdev->ichd == ICHD_PCMOUT) {
1053 snd_intel8x0_setup_pcm_out(chip, runtime); 1064 snd_intel8x0_setup_pcm_out(chip, runtime);
1054 if (chip->device_type == DEVICE_INTEL_ICH4) { 1065 if (chip->device_type == DEVICE_INTEL_ICH4)
1055 ichdev->pos_shift = (runtime->sample_bits > 16) ? 2 : 1; 1066 ichdev->pos_shift = (runtime->sample_bits > 16) ? 2 : 1;
1056 }
1057 } 1067 }
1058 snd_intel8x0_setup_periods(chip, ichdev); 1068 snd_intel8x0_setup_periods(chip, ichdev);
1059 spin_unlock_irq(&chip->reg_lock);
1060 return 0; 1069 return 0;
1061} 1070}
1062 1071
@@ -1817,6 +1826,18 @@ static struct ac97_quirk ac97_quirks[] __devinitdata = {
1817 }, 1826 },
1818 { 1827 {
1819 .subvendor = 0x103c, 1828 .subvendor = 0x103c,
1829 .subdevice = 0x0934,
1830 .name = "HP nx8220",
1831 .type = AC97_TUNE_MUTE_LED
1832 },
1833 {
1834 .subvendor = 0x103c,
1835 .subdevice = 0x099c,
1836 .name = "HP nx6110", /* AD1981B */
1837 .type = AC97_TUNE_HP_ONLY
1838 },
1839 {
1840 .subvendor = 0x103c,
1820 .subdevice = 0x129d, 1841 .subdevice = 0x129d,
1821 .name = "HP xw8000", 1842 .name = "HP xw8000",
1822 .type = AC97_TUNE_HP_ONLY 1843 .type = AC97_TUNE_HP_ONLY
@@ -1870,6 +1891,12 @@ static struct ac97_quirk ac97_quirks[] __devinitdata = {
1870 .type = AC97_TUNE_HP_ONLY 1891 .type = AC97_TUNE_HP_ONLY
1871 }, 1892 },
1872 { 1893 {
1894 .subvendor = 0x10cf,
1895 .subdevice = 0x12ec,
1896 .name = "Fujitsu-Siemens 4010",
1897 .type = AC97_TUNE_HP_ONLY
1898 },
1899 {
1873 .subvendor = 0x10f1, 1900 .subvendor = 0x10f1,
1874 .subdevice = 0x2665, 1901 .subdevice = 0x2665,
1875 .name = "Fujitsu-Siemens Celsius", /* AD1981? */ 1902 .name = "Fujitsu-Siemens Celsius", /* AD1981? */
@@ -2424,6 +2451,20 @@ static int intel8x0_resume(snd_card_t *card)
2424 } 2451 }
2425 } 2452 }
2426 2453
2454 /* resume status */
2455 for (i = 0; i < chip->bdbars_count; i++) {
2456 ichdev_t *ichdev = &chip->ichd[i];
2457 unsigned long port = ichdev->reg_offset;
2458 if (! ichdev->substream || ! ichdev->suspended)
2459 continue;
2460 if (ichdev->ichd == ICHD_PCMOUT)
2461 snd_intel8x0_setup_pcm_out(chip, ichdev->substream->runtime);
2462 iputdword(chip, port + ICH_REG_OFF_BDBAR, ichdev->bdbar_addr);
2463 iputbyte(chip, port + ICH_REG_OFF_LVI, ichdev->lvi);
2464 iputbyte(chip, port + ICH_REG_OFF_CIV, ichdev->civ);
2465 iputbyte(chip, port + ichdev->roff_sr, ICH_FIFOE | ICH_BCIS | ICH_LVBCI);
2466 }
2467
2427 return 0; 2468 return 0;
2428} 2469}
2429#endif /* CONFIG_PM */ 2470#endif /* CONFIG_PM */
diff --git a/sound/pci/korg1212/korg1212.c b/sound/pci/korg1212/korg1212.c
index 79d8eda54f0d..d2aa9c82d41e 100644
--- a/sound/pci/korg1212/korg1212.c
+++ b/sound/pci/korg1212/korg1212.c
@@ -2067,7 +2067,7 @@ static int snd_korg1212_control_sync_put(snd_kcontrol_t * kcontrol, snd_ctl_elem
2067 }, \ 2067 }, \
2068 { \ 2068 { \
2069 .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_WRITE, \ 2069 .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_WRITE, \
2070 .iface = SNDRV_CTL_ELEM_IFACE_PCM, \ 2070 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2071 .name = c_name " Monitor Phase Invert", \ 2071 .name = c_name " Monitor Phase Invert", \
2072 .info = snd_korg1212_control_phase_info, \ 2072 .info = snd_korg1212_control_phase_info, \
2073 .get = snd_korg1212_control_phase_get, \ 2073 .get = snd_korg1212_control_phase_get, \
@@ -2082,7 +2082,7 @@ static snd_kcontrol_new_t snd_korg1212_controls[] = {
2082 MON_MIXER(4, "ADAT-5"), MON_MIXER(5, "ADAT-6"), MON_MIXER(6, "ADAT-7"), MON_MIXER(7, "ADAT-8"), 2082 MON_MIXER(4, "ADAT-5"), MON_MIXER(5, "ADAT-6"), MON_MIXER(6, "ADAT-7"), MON_MIXER(7, "ADAT-8"),
2083 { 2083 {
2084 .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_WRITE, 2084 .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_WRITE,
2085 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 2085 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2086 .name = "Sync Source", 2086 .name = "Sync Source",
2087 .info = snd_korg1212_control_sync_info, 2087 .info = snd_korg1212_control_sync_info,
2088 .get = snd_korg1212_control_sync_get, 2088 .get = snd_korg1212_control_sync_get,
diff --git a/sound/pci/nm256/nm256.c b/sound/pci/nm256/nm256.c
index 7eb20b8f89f6..2bbeb10ff7c4 100644
--- a/sound/pci/nm256/nm256.c
+++ b/sound/pci/nm256/nm256.c
@@ -189,6 +189,7 @@ struct snd_nm256_stream {
189 nm256_t *chip; 189 nm256_t *chip;
190 snd_pcm_substream_t *substream; 190 snd_pcm_substream_t *substream;
191 int running; 191 int running;
192 int suspended;
192 193
193 u32 buf; /* offset from chip->buffer */ 194 u32 buf; /* offset from chip->buffer */
194 int bufsize; /* buffer size in bytes */ 195 int bufsize; /* buffer size in bytes */
@@ -231,8 +232,10 @@ struct snd_nm256 {
231 int mixer_status_mask; /* bit mask to test the mixer status */ 232 int mixer_status_mask; /* bit mask to test the mixer status */
232 233
233 int irq; 234 int irq;
235 int irq_acks;
234 irqreturn_t (*interrupt)(int, void *, struct pt_regs *); 236 irqreturn_t (*interrupt)(int, void *, struct pt_regs *);
235 int badintrcount; /* counter to check bogus interrupts */ 237 int badintrcount; /* counter to check bogus interrupts */
238 struct semaphore irq_mutex;
236 239
237 nm256_stream_t streams[2]; 240 nm256_stream_t streams[2];
238 241
@@ -464,6 +467,37 @@ snd_nm256_set_format(nm256_t *chip, nm256_stream_t *s, snd_pcm_substream_t *subs
464 } 467 }
465} 468}
466 469
470/* acquire interrupt */
471static int snd_nm256_acquire_irq(nm256_t *chip)
472{
473 down(&chip->irq_mutex);
474 if (chip->irq < 0) {
475 if (request_irq(chip->pci->irq, chip->interrupt, SA_INTERRUPT|SA_SHIRQ,
476 chip->card->driver, (void*)chip)) {
477 snd_printk("unable to grab IRQ %d\n", chip->pci->irq);
478 up(&chip->irq_mutex);
479 return -EBUSY;
480 }
481 chip->irq = chip->pci->irq;
482 }
483 chip->irq_acks++;
484 up(&chip->irq_mutex);
485 return 0;
486}
487
488/* release interrupt */
489static void snd_nm256_release_irq(nm256_t *chip)
490{
491 down(&chip->irq_mutex);
492 if (chip->irq_acks > 0)
493 chip->irq_acks--;
494 if (chip->irq_acks == 0 && chip->irq >= 0) {
495 free_irq(chip->irq, (void*)chip);
496 chip->irq = -1;
497 }
498 up(&chip->irq_mutex);
499}
500
467/* 501/*
468 * start / stop 502 * start / stop
469 */ 503 */
@@ -538,15 +572,19 @@ snd_nm256_playback_trigger(snd_pcm_substream_t *substream, int cmd)
538 572
539 spin_lock(&chip->reg_lock); 573 spin_lock(&chip->reg_lock);
540 switch (cmd) { 574 switch (cmd) {
541 case SNDRV_PCM_TRIGGER_START:
542 case SNDRV_PCM_TRIGGER_RESUME: 575 case SNDRV_PCM_TRIGGER_RESUME:
576 s->suspended = 0;
577 /* fallthru */
578 case SNDRV_PCM_TRIGGER_START:
543 if (! s->running) { 579 if (! s->running) {
544 snd_nm256_playback_start(chip, s, substream); 580 snd_nm256_playback_start(chip, s, substream);
545 s->running = 1; 581 s->running = 1;
546 } 582 }
547 break; 583 break;
548 case SNDRV_PCM_TRIGGER_STOP:
549 case SNDRV_PCM_TRIGGER_SUSPEND: 584 case SNDRV_PCM_TRIGGER_SUSPEND:
585 s->suspended = 1;
586 /* fallthru */
587 case SNDRV_PCM_TRIGGER_STOP:
550 if (s->running) { 588 if (s->running) {
551 snd_nm256_playback_stop(chip); 589 snd_nm256_playback_stop(chip);
552 s->running = 0; 590 s->running = 0;
@@ -818,6 +856,8 @@ snd_nm256_playback_open(snd_pcm_substream_t *substream)
818{ 856{
819 nm256_t *chip = snd_pcm_substream_chip(substream); 857 nm256_t *chip = snd_pcm_substream_chip(substream);
820 858
859 if (snd_nm256_acquire_irq(chip) < 0)
860 return -EBUSY;
821 snd_nm256_setup_stream(chip, &chip->streams[SNDRV_PCM_STREAM_PLAYBACK], 861 snd_nm256_setup_stream(chip, &chip->streams[SNDRV_PCM_STREAM_PLAYBACK],
822 substream, &snd_nm256_playback); 862 substream, &snd_nm256_playback);
823 return 0; 863 return 0;
@@ -828,6 +868,8 @@ snd_nm256_capture_open(snd_pcm_substream_t *substream)
828{ 868{
829 nm256_t *chip = snd_pcm_substream_chip(substream); 869 nm256_t *chip = snd_pcm_substream_chip(substream);
830 870
871 if (snd_nm256_acquire_irq(chip) < 0)
872 return -EBUSY;
831 snd_nm256_setup_stream(chip, &chip->streams[SNDRV_PCM_STREAM_CAPTURE], 873 snd_nm256_setup_stream(chip, &chip->streams[SNDRV_PCM_STREAM_CAPTURE],
832 substream, &snd_nm256_capture); 874 substream, &snd_nm256_capture);
833 return 0; 875 return 0;
@@ -839,6 +881,9 @@ snd_nm256_capture_open(snd_pcm_substream_t *substream)
839static int 881static int
840snd_nm256_playback_close(snd_pcm_substream_t *substream) 882snd_nm256_playback_close(snd_pcm_substream_t *substream)
841{ 883{
884 nm256_t *chip = snd_pcm_substream_chip(substream);
885
886 snd_nm256_release_irq(chip);
842 return 0; 887 return 0;
843} 888}
844 889
@@ -846,6 +891,9 @@ snd_nm256_playback_close(snd_pcm_substream_t *substream)
846static int 891static int
847snd_nm256_capture_close(snd_pcm_substream_t *substream) 892snd_nm256_capture_close(snd_pcm_substream_t *substream)
848{ 893{
894 nm256_t *chip = snd_pcm_substream_chip(substream);
895
896 snd_nm256_release_irq(chip);
849 return 0; 897 return 0;
850} 898}
851 899
@@ -915,18 +963,16 @@ snd_nm256_pcm(nm256_t *chip, int device)
915static void 963static void
916snd_nm256_init_chip(nm256_t *chip) 964snd_nm256_init_chip(nm256_t *chip)
917{ 965{
918 spin_lock_irq(&chip->reg_lock);
919 /* Reset everything. */ 966 /* Reset everything. */
920 snd_nm256_writeb(chip, 0x0, 0x11); 967 snd_nm256_writeb(chip, 0x0, 0x11);
921 snd_nm256_writew(chip, 0x214, 0); 968 snd_nm256_writew(chip, 0x214, 0);
922 /* stop sounds.. */ 969 /* stop sounds.. */
923 //snd_nm256_playback_stop(chip); 970 //snd_nm256_playback_stop(chip);
924 //snd_nm256_capture_stop(chip); 971 //snd_nm256_capture_stop(chip);
925 spin_unlock_irq(&chip->reg_lock);
926} 972}
927 973
928 974
929static inline void 975static irqreturn_t
930snd_nm256_intr_check(nm256_t *chip) 976snd_nm256_intr_check(nm256_t *chip)
931{ 977{
932 if (chip->badintrcount++ > 1000) { 978 if (chip->badintrcount++ > 1000) {
@@ -947,7 +993,9 @@ snd_nm256_intr_check(nm256_t *chip)
947 if (chip->streams[SNDRV_PCM_STREAM_CAPTURE].running) 993 if (chip->streams[SNDRV_PCM_STREAM_CAPTURE].running)
948 snd_nm256_capture_stop(chip); 994 snd_nm256_capture_stop(chip);
949 chip->badintrcount = 0; 995 chip->badintrcount = 0;
996 return IRQ_HANDLED;
950 } 997 }
998 return IRQ_NONE;
951} 999}
952 1000
953/* 1001/*
@@ -969,10 +1017,8 @@ snd_nm256_interrupt(int irq, void *dev_id, struct pt_regs *dummy)
969 status = snd_nm256_readw(chip, NM_INT_REG); 1017 status = snd_nm256_readw(chip, NM_INT_REG);
970 1018
971 /* Not ours. */ 1019 /* Not ours. */
972 if (status == 0) { 1020 if (status == 0)
973 snd_nm256_intr_check(chip); 1021 return snd_nm256_intr_check(chip);
974 return IRQ_NONE;
975 }
976 1022
977 chip->badintrcount = 0; 1023 chip->badintrcount = 0;
978 1024
@@ -1036,10 +1082,8 @@ snd_nm256_interrupt_zx(int irq, void *dev_id, struct pt_regs *dummy)
1036 status = snd_nm256_readl(chip, NM_INT_REG); 1082 status = snd_nm256_readl(chip, NM_INT_REG);
1037 1083
1038 /* Not ours. */ 1084 /* Not ours. */
1039 if (status == 0) { 1085 if (status == 0)
1040 snd_nm256_intr_check(chip); 1086 return snd_nm256_intr_check(chip);
1041 return IRQ_NONE;
1042 }
1043 1087
1044 chip->badintrcount = 0; 1088 chip->badintrcount = 0;
1045 1089
@@ -1192,7 +1236,7 @@ snd_nm256_mixer(nm256_t *chip)
1192 AC97_PC_BEEP, AC97_PHONE, AC97_MIC, AC97_LINE, AC97_CD, 1236 AC97_PC_BEEP, AC97_PHONE, AC97_MIC, AC97_LINE, AC97_CD,
1193 AC97_VIDEO, AC97_AUX, AC97_PCM, AC97_REC_SEL, 1237 AC97_VIDEO, AC97_AUX, AC97_PCM, AC97_REC_SEL,
1194 AC97_REC_GAIN, AC97_GENERAL_PURPOSE, AC97_3D_CONTROL, 1238 AC97_REC_GAIN, AC97_GENERAL_PURPOSE, AC97_3D_CONTROL,
1195 AC97_EXTENDED_ID, 1239 /*AC97_EXTENDED_ID,*/
1196 AC97_VENDOR_ID1, AC97_VENDOR_ID2, 1240 AC97_VENDOR_ID1, AC97_VENDOR_ID2,
1197 -1 1241 -1
1198 }; 1242 };
@@ -1206,6 +1250,7 @@ snd_nm256_mixer(nm256_t *chip)
1206 for (i = 0; mixer_regs[i] >= 0; i++) 1250 for (i = 0; mixer_regs[i] >= 0; i++)
1207 set_bit(mixer_regs[i], ac97.reg_accessed); 1251 set_bit(mixer_regs[i], ac97.reg_accessed);
1208 ac97.private_data = chip; 1252 ac97.private_data = chip;
1253 pbus->no_vra = 1;
1209 err = snd_ac97_mixer(pbus, &ac97, &chip->ac97); 1254 err = snd_ac97_mixer(pbus, &ac97, &chip->ac97);
1210 if (err < 0) 1255 if (err < 0)
1211 return err; 1256 return err;
@@ -1281,6 +1326,7 @@ static int nm256_suspend(snd_card_t *card, pm_message_t state)
1281static int nm256_resume(snd_card_t *card) 1326static int nm256_resume(snd_card_t *card)
1282{ 1327{
1283 nm256_t *chip = card->pm_private_data; 1328 nm256_t *chip = card->pm_private_data;
1329 int i;
1284 1330
1285 /* Perform a full reset on the hardware */ 1331 /* Perform a full reset on the hardware */
1286 pci_enable_device(chip->pci); 1332 pci_enable_device(chip->pci);
@@ -1289,6 +1335,15 @@ static int nm256_resume(snd_card_t *card)
1289 /* restore ac97 */ 1335 /* restore ac97 */
1290 snd_ac97_resume(chip->ac97); 1336 snd_ac97_resume(chip->ac97);
1291 1337
1338 for (i = 0; i < 2; i++) {
1339 nm256_stream_t *s = &chip->streams[i];
1340 if (s->substream && s->suspended) {
1341 spin_lock_irq(&chip->reg_lock);
1342 snd_nm256_set_format(chip, s, s->substream);
1343 spin_unlock_irq(&chip->reg_lock);
1344 }
1345 }
1346
1292 return 0; 1347 return 0;
1293} 1348}
1294#endif /* CONFIG_PM */ 1349#endif /* CONFIG_PM */
@@ -1360,6 +1415,7 @@ snd_nm256_create(snd_card_t *card, struct pci_dev *pci,
1360 chip->use_cache = usecache; 1415 chip->use_cache = usecache;
1361 spin_lock_init(&chip->reg_lock); 1416 spin_lock_init(&chip->reg_lock);
1362 chip->irq = -1; 1417 chip->irq = -1;
1418 init_MUTEX(&chip->irq_mutex);
1363 1419
1364 chip->streams[SNDRV_PCM_STREAM_PLAYBACK].bufsize = play_bufsize; 1420 chip->streams[SNDRV_PCM_STREAM_PLAYBACK].bufsize = play_bufsize;
1365 chip->streams[SNDRV_PCM_STREAM_CAPTURE].bufsize = capt_bufsize; 1421 chip->streams[SNDRV_PCM_STREAM_CAPTURE].bufsize = capt_bufsize;
@@ -1470,15 +1526,6 @@ snd_nm256_create(snd_card_t *card, struct pci_dev *pci,
1470 chip->coeff_buf[SNDRV_PCM_STREAM_CAPTURE] = addr; 1526 chip->coeff_buf[SNDRV_PCM_STREAM_CAPTURE] = addr;
1471 } 1527 }
1472 1528
1473 /* acquire interrupt */
1474 if (request_irq(pci->irq, chip->interrupt, SA_INTERRUPT|SA_SHIRQ,
1475 card->driver, (void*)chip)) {
1476 err = -EBUSY;
1477 snd_printk("unable to grab IRQ %d\n", pci->irq);
1478 goto __error;
1479 }
1480 chip->irq = pci->irq;
1481
1482 /* Fixed setting. */ 1529 /* Fixed setting. */
1483 chip->mixer_base = NM_MIXER_OFFSET; 1530 chip->mixer_base = NM_MIXER_OFFSET;
1484 1531
diff --git a/sound/pci/rme32.c b/sound/pci/rme32.c
index b7b554df6705..456be39e8e4a 100644
--- a/sound/pci/rme32.c
+++ b/sound/pci/rme32.c
@@ -1900,7 +1900,7 @@ static snd_kcontrol_new_t snd_rme32_controls[] = {
1900 }, 1900 },
1901 { 1901 {
1902 .access = SNDRV_CTL_ELEM_ACCESS_READ, 1902 .access = SNDRV_CTL_ELEM_ACCESS_READ,
1903 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1903 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
1904 .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, CON_MASK), 1904 .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, CON_MASK),
1905 .info = snd_rme32_control_spdif_mask_info, 1905 .info = snd_rme32_control_spdif_mask_info,
1906 .get = snd_rme32_control_spdif_mask_get, 1906 .get = snd_rme32_control_spdif_mask_get,
@@ -1908,7 +1908,7 @@ static snd_kcontrol_new_t snd_rme32_controls[] = {
1908 }, 1908 },
1909 { 1909 {
1910 .access = SNDRV_CTL_ELEM_ACCESS_READ, 1910 .access = SNDRV_CTL_ELEM_ACCESS_READ,
1911 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1911 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
1912 .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, PRO_MASK), 1912 .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, PRO_MASK),
1913 .info = snd_rme32_control_spdif_mask_info, 1913 .info = snd_rme32_control_spdif_mask_info,
1914 .get = snd_rme32_control_spdif_mask_get, 1914 .get = snd_rme32_control_spdif_mask_get,
diff --git a/sound/pci/rme96.c b/sound/pci/rme96.c
index 10c4f45a913c..9645e9004a48 100644
--- a/sound/pci/rme96.c
+++ b/sound/pci/rme96.c
@@ -2266,7 +2266,7 @@ static snd_kcontrol_new_t snd_rme96_controls[] = {
2266}, 2266},
2267{ 2267{
2268 .access = SNDRV_CTL_ELEM_ACCESS_READ, 2268 .access = SNDRV_CTL_ELEM_ACCESS_READ,
2269 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2269 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
2270 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,CON_MASK), 2270 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,CON_MASK),
2271 .info = snd_rme96_control_spdif_mask_info, 2271 .info = snd_rme96_control_spdif_mask_info,
2272 .get = snd_rme96_control_spdif_mask_get, 2272 .get = snd_rme96_control_spdif_mask_get,
@@ -2276,7 +2276,7 @@ static snd_kcontrol_new_t snd_rme96_controls[] = {
2276}, 2276},
2277{ 2277{
2278 .access = SNDRV_CTL_ELEM_ACCESS_READ, 2278 .access = SNDRV_CTL_ELEM_ACCESS_READ,
2279 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2279 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
2280 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,PRO_MASK), 2280 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,PRO_MASK),
2281 .info = snd_rme96_control_spdif_mask_info, 2281 .info = snd_rme96_control_spdif_mask_info,
2282 .get = snd_rme96_control_spdif_mask_get, 2282 .get = snd_rme96_control_spdif_mask_get,
diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c
index 796621de5009..6694866089b5 100644
--- a/sound/pci/rme9652/hdsp.c
+++ b/sound/pci/rme9652/hdsp.c
@@ -1524,7 +1524,7 @@ static int snd_hdsp_control_spdif_mask_get(snd_kcontrol_t * kcontrol, snd_ctl_el
1524} 1524}
1525 1525
1526#define HDSP_SPDIF_IN(xname, xindex) \ 1526#define HDSP_SPDIF_IN(xname, xindex) \
1527{ .iface = SNDRV_CTL_ELEM_IFACE_PCM, \ 1527{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1528 .name = xname, \ 1528 .name = xname, \
1529 .index = xindex, \ 1529 .index = xindex, \
1530 .info = snd_hdsp_info_spdif_in, \ 1530 .info = snd_hdsp_info_spdif_in, \
@@ -1584,7 +1584,7 @@ static int snd_hdsp_put_spdif_in(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t
1584} 1584}
1585 1585
1586#define HDSP_SPDIF_OUT(xname, xindex) \ 1586#define HDSP_SPDIF_OUT(xname, xindex) \
1587{ .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, .name = xname, .index = xindex, \ 1587{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \
1588 .info = snd_hdsp_info_spdif_bits, \ 1588 .info = snd_hdsp_info_spdif_bits, \
1589 .get = snd_hdsp_get_spdif_out, .put = snd_hdsp_put_spdif_out } 1589 .get = snd_hdsp_get_spdif_out, .put = snd_hdsp_put_spdif_out }
1590 1590
@@ -1638,7 +1638,7 @@ static int snd_hdsp_put_spdif_out(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_
1638} 1638}
1639 1639
1640#define HDSP_SPDIF_PROFESSIONAL(xname, xindex) \ 1640#define HDSP_SPDIF_PROFESSIONAL(xname, xindex) \
1641{ .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, .name = xname, .index = xindex, \ 1641{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \
1642 .info = snd_hdsp_info_spdif_bits, \ 1642 .info = snd_hdsp_info_spdif_bits, \
1643 .get = snd_hdsp_get_spdif_professional, .put = snd_hdsp_put_spdif_professional } 1643 .get = snd_hdsp_get_spdif_professional, .put = snd_hdsp_put_spdif_professional }
1644 1644
@@ -1683,7 +1683,7 @@ static int snd_hdsp_put_spdif_professional(snd_kcontrol_t * kcontrol, snd_ctl_el
1683} 1683}
1684 1684
1685#define HDSP_SPDIF_EMPHASIS(xname, xindex) \ 1685#define HDSP_SPDIF_EMPHASIS(xname, xindex) \
1686{ .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, .name = xname, .index = xindex, \ 1686{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \
1687 .info = snd_hdsp_info_spdif_bits, \ 1687 .info = snd_hdsp_info_spdif_bits, \
1688 .get = snd_hdsp_get_spdif_emphasis, .put = snd_hdsp_put_spdif_emphasis } 1688 .get = snd_hdsp_get_spdif_emphasis, .put = snd_hdsp_put_spdif_emphasis }
1689 1689
@@ -1728,7 +1728,7 @@ static int snd_hdsp_put_spdif_emphasis(snd_kcontrol_t * kcontrol, snd_ctl_elem_v
1728} 1728}
1729 1729
1730#define HDSP_SPDIF_NON_AUDIO(xname, xindex) \ 1730#define HDSP_SPDIF_NON_AUDIO(xname, xindex) \
1731{ .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, .name = xname, .index = xindex, \ 1731{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \
1732 .info = snd_hdsp_info_spdif_bits, \ 1732 .info = snd_hdsp_info_spdif_bits, \
1733 .get = snd_hdsp_get_spdif_nonaudio, .put = snd_hdsp_put_spdif_nonaudio } 1733 .get = snd_hdsp_get_spdif_nonaudio, .put = snd_hdsp_put_spdif_nonaudio }
1734 1734
@@ -1773,7 +1773,7 @@ static int snd_hdsp_put_spdif_nonaudio(snd_kcontrol_t * kcontrol, snd_ctl_elem_v
1773} 1773}
1774 1774
1775#define HDSP_SPDIF_SAMPLE_RATE(xname, xindex) \ 1775#define HDSP_SPDIF_SAMPLE_RATE(xname, xindex) \
1776{ .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ 1776{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1777 .name = xname, \ 1777 .name = xname, \
1778 .index = xindex, \ 1778 .index = xindex, \
1779 .access = SNDRV_CTL_ELEM_ACCESS_READ, \ 1779 .access = SNDRV_CTL_ELEM_ACCESS_READ, \
@@ -1834,7 +1834,7 @@ static int snd_hdsp_get_spdif_sample_rate(snd_kcontrol_t * kcontrol, snd_ctl_ele
1834} 1834}
1835 1835
1836#define HDSP_SYSTEM_SAMPLE_RATE(xname, xindex) \ 1836#define HDSP_SYSTEM_SAMPLE_RATE(xname, xindex) \
1837{ .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ 1837{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1838 .name = xname, \ 1838 .name = xname, \
1839 .index = xindex, \ 1839 .index = xindex, \
1840 .access = SNDRV_CTL_ELEM_ACCESS_READ, \ 1840 .access = SNDRV_CTL_ELEM_ACCESS_READ, \
@@ -1858,7 +1858,7 @@ static int snd_hdsp_get_system_sample_rate(snd_kcontrol_t * kcontrol, snd_ctl_el
1858} 1858}
1859 1859
1860#define HDSP_AUTOSYNC_SAMPLE_RATE(xname, xindex) \ 1860#define HDSP_AUTOSYNC_SAMPLE_RATE(xname, xindex) \
1861{ .iface = SNDRV_CTL_ELEM_IFACE_PCM, \ 1861{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1862 .name = xname, \ 1862 .name = xname, \
1863 .index = xindex, \ 1863 .index = xindex, \
1864 .access = SNDRV_CTL_ELEM_ACCESS_READ, \ 1864 .access = SNDRV_CTL_ELEM_ACCESS_READ, \
@@ -1918,7 +1918,7 @@ static int snd_hdsp_get_autosync_sample_rate(snd_kcontrol_t * kcontrol, snd_ctl_
1918} 1918}
1919 1919
1920#define HDSP_SYSTEM_CLOCK_MODE(xname, xindex) \ 1920#define HDSP_SYSTEM_CLOCK_MODE(xname, xindex) \
1921{ .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ 1921{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1922 .name = xname, \ 1922 .name = xname, \
1923 .index = xindex, \ 1923 .index = xindex, \
1924 .access = SNDRV_CTL_ELEM_ACCESS_READ, \ 1924 .access = SNDRV_CTL_ELEM_ACCESS_READ, \
@@ -1958,7 +1958,7 @@ static int snd_hdsp_get_system_clock_mode(snd_kcontrol_t * kcontrol, snd_ctl_ele
1958} 1958}
1959 1959
1960#define HDSP_CLOCK_SOURCE(xname, xindex) \ 1960#define HDSP_CLOCK_SOURCE(xname, xindex) \
1961{ .iface = SNDRV_CTL_ELEM_IFACE_PCM, \ 1961{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1962 .name = xname, \ 1962 .name = xname, \
1963 .index = xindex, \ 1963 .index = xindex, \
1964 .info = snd_hdsp_info_clock_source, \ 1964 .info = snd_hdsp_info_clock_source, \
@@ -2124,7 +2124,7 @@ static int snd_hdsp_put_clock_source_lock(snd_kcontrol_t * kcontrol, snd_ctl_ele
2124} 2124}
2125 2125
2126#define HDSP_DA_GAIN(xname, xindex) \ 2126#define HDSP_DA_GAIN(xname, xindex) \
2127{ .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ 2127{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2128 .name = xname, \ 2128 .name = xname, \
2129 .index = xindex, \ 2129 .index = xindex, \
2130 .info = snd_hdsp_info_da_gain, \ 2130 .info = snd_hdsp_info_da_gain, \
@@ -2210,7 +2210,7 @@ static int snd_hdsp_put_da_gain(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t
2210} 2210}
2211 2211
2212#define HDSP_AD_GAIN(xname, xindex) \ 2212#define HDSP_AD_GAIN(xname, xindex) \
2213{ .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ 2213{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2214 .name = xname, \ 2214 .name = xname, \
2215 .index = xindex, \ 2215 .index = xindex, \
2216 .info = snd_hdsp_info_ad_gain, \ 2216 .info = snd_hdsp_info_ad_gain, \
@@ -2296,7 +2296,7 @@ static int snd_hdsp_put_ad_gain(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t
2296} 2296}
2297 2297
2298#define HDSP_PHONE_GAIN(xname, xindex) \ 2298#define HDSP_PHONE_GAIN(xname, xindex) \
2299{ .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ 2299{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2300 .name = xname, \ 2300 .name = xname, \
2301 .index = xindex, \ 2301 .index = xindex, \
2302 .info = snd_hdsp_info_phone_gain, \ 2302 .info = snd_hdsp_info_phone_gain, \
@@ -2382,7 +2382,7 @@ static int snd_hdsp_put_phone_gain(snd_kcontrol_t * kcontrol, snd_ctl_elem_value
2382} 2382}
2383 2383
2384#define HDSP_XLR_BREAKOUT_CABLE(xname, xindex) \ 2384#define HDSP_XLR_BREAKOUT_CABLE(xname, xindex) \
2385{ .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ 2385{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2386 .name = xname, \ 2386 .name = xname, \
2387 .index = xindex, \ 2387 .index = xindex, \
2388 .info = snd_hdsp_info_xlr_breakout_cable, \ 2388 .info = snd_hdsp_info_xlr_breakout_cable, \
@@ -2447,7 +2447,7 @@ static int snd_hdsp_put_xlr_breakout_cable(snd_kcontrol_t * kcontrol, snd_ctl_el
2447 Switching this on desactivates external ADAT 2447 Switching this on desactivates external ADAT
2448*/ 2448*/
2449#define HDSP_AEB(xname, xindex) \ 2449#define HDSP_AEB(xname, xindex) \
2450{ .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ 2450{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2451 .name = xname, \ 2451 .name = xname, \
2452 .index = xindex, \ 2452 .index = xindex, \
2453 .info = snd_hdsp_info_aeb, \ 2453 .info = snd_hdsp_info_aeb, \
@@ -2508,7 +2508,7 @@ static int snd_hdsp_put_aeb(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * uc
2508} 2508}
2509 2509
2510#define HDSP_PREF_SYNC_REF(xname, xindex) \ 2510#define HDSP_PREF_SYNC_REF(xname, xindex) \
2511{ .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ 2511{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2512 .name = xname, \ 2512 .name = xname, \
2513 .index = xindex, \ 2513 .index = xindex, \
2514 .info = snd_hdsp_info_pref_sync_ref, \ 2514 .info = snd_hdsp_info_pref_sync_ref, \
@@ -2641,7 +2641,7 @@ static int snd_hdsp_put_pref_sync_ref(snd_kcontrol_t * kcontrol, snd_ctl_elem_va
2641} 2641}
2642 2642
2643#define HDSP_AUTOSYNC_REF(xname, xindex) \ 2643#define HDSP_AUTOSYNC_REF(xname, xindex) \
2644{ .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ 2644{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2645 .name = xname, \ 2645 .name = xname, \
2646 .index = xindex, \ 2646 .index = xindex, \
2647 .access = SNDRV_CTL_ELEM_ACCESS_READ, \ 2647 .access = SNDRV_CTL_ELEM_ACCESS_READ, \
@@ -2697,7 +2697,7 @@ static int snd_hdsp_get_autosync_ref(snd_kcontrol_t * kcontrol, snd_ctl_elem_val
2697} 2697}
2698 2698
2699#define HDSP_LINE_OUT(xname, xindex) \ 2699#define HDSP_LINE_OUT(xname, xindex) \
2700{ .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ 2700{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2701 .name = xname, \ 2701 .name = xname, \
2702 .index = xindex, \ 2702 .index = xindex, \
2703 .info = snd_hdsp_info_line_out, \ 2703 .info = snd_hdsp_info_line_out, \
@@ -2757,7 +2757,7 @@ static int snd_hdsp_put_line_out(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t
2757} 2757}
2758 2758
2759#define HDSP_PRECISE_POINTER(xname, xindex) \ 2759#define HDSP_PRECISE_POINTER(xname, xindex) \
2760{ .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ 2760{ .iface = SNDRV_CTL_ELEM_IFACE_CARD, \
2761 .name = xname, \ 2761 .name = xname, \
2762 .index = xindex, \ 2762 .index = xindex, \
2763 .info = snd_hdsp_info_precise_pointer, \ 2763 .info = snd_hdsp_info_precise_pointer, \
@@ -2811,7 +2811,7 @@ static int snd_hdsp_put_precise_pointer(snd_kcontrol_t * kcontrol, snd_ctl_elem_
2811} 2811}
2812 2812
2813#define HDSP_USE_MIDI_TASKLET(xname, xindex) \ 2813#define HDSP_USE_MIDI_TASKLET(xname, xindex) \
2814{ .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ 2814{ .iface = SNDRV_CTL_ELEM_IFACE_CARD, \
2815 .name = xname, \ 2815 .name = xname, \
2816 .index = xindex, \ 2816 .index = xindex, \
2817 .info = snd_hdsp_info_use_midi_tasklet, \ 2817 .info = snd_hdsp_info_use_midi_tasklet, \
@@ -2868,6 +2868,7 @@ static int snd_hdsp_put_use_midi_tasklet(snd_kcontrol_t * kcontrol, snd_ctl_elem
2868{ .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ 2868{ .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \
2869 .name = xname, \ 2869 .name = xname, \
2870 .index = xindex, \ 2870 .index = xindex, \
2871 .device = 0, \
2871 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | \ 2872 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | \
2872 SNDRV_CTL_ELEM_ACCESS_VOLATILE, \ 2873 SNDRV_CTL_ELEM_ACCESS_VOLATILE, \
2873 .info = snd_hdsp_info_mixer, \ 2874 .info = snd_hdsp_info_mixer, \
@@ -2939,7 +2940,7 @@ static int snd_hdsp_put_mixer(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t *
2939} 2940}
2940 2941
2941#define HDSP_WC_SYNC_CHECK(xname, xindex) \ 2942#define HDSP_WC_SYNC_CHECK(xname, xindex) \
2942{ .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ 2943{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2943 .name = xname, \ 2944 .name = xname, \
2944 .index = xindex, \ 2945 .index = xindex, \
2945 .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, \ 2946 .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, \
@@ -2983,7 +2984,7 @@ static int snd_hdsp_get_wc_sync_check(snd_kcontrol_t * kcontrol, snd_ctl_elem_va
2983} 2984}
2984 2985
2985#define HDSP_SPDIF_SYNC_CHECK(xname, xindex) \ 2986#define HDSP_SPDIF_SYNC_CHECK(xname, xindex) \
2986{ .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ 2987{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2987 .name = xname, \ 2988 .name = xname, \
2988 .index = xindex, \ 2989 .index = xindex, \
2989 .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, \ 2990 .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, \
@@ -3015,7 +3016,7 @@ static int snd_hdsp_get_spdif_sync_check(snd_kcontrol_t * kcontrol, snd_ctl_elem
3015} 3016}
3016 3017
3017#define HDSP_ADATSYNC_SYNC_CHECK(xname, xindex) \ 3018#define HDSP_ADATSYNC_SYNC_CHECK(xname, xindex) \
3018{ .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ 3019{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3019 .name = xname, \ 3020 .name = xname, \
3020 .index = xindex, \ 3021 .index = xindex, \
3021 .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, \ 3022 .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, \
@@ -3046,7 +3047,7 @@ static int snd_hdsp_get_adatsync_sync_check(snd_kcontrol_t * kcontrol, snd_ctl_e
3046} 3047}
3047 3048
3048#define HDSP_ADAT_SYNC_CHECK \ 3049#define HDSP_ADAT_SYNC_CHECK \
3049{ .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ 3050{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3050 .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, \ 3051 .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, \
3051 .info = snd_hdsp_info_sync_check, \ 3052 .info = snd_hdsp_info_sync_check, \
3052 .get = snd_hdsp_get_adat_sync_check \ 3053 .get = snd_hdsp_get_adat_sync_check \
@@ -3119,7 +3120,7 @@ static snd_kcontrol_new_t snd_hdsp_controls[] = {
3119}, 3120},
3120{ 3121{
3121 .access = SNDRV_CTL_ELEM_ACCESS_READ, 3122 .access = SNDRV_CTL_ELEM_ACCESS_READ,
3122 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 3123 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
3123 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,CON_MASK), 3124 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,CON_MASK),
3124 .info = snd_hdsp_control_spdif_mask_info, 3125 .info = snd_hdsp_control_spdif_mask_info,
3125 .get = snd_hdsp_control_spdif_mask_get, 3126 .get = snd_hdsp_control_spdif_mask_get,
@@ -3129,7 +3130,7 @@ static snd_kcontrol_new_t snd_hdsp_controls[] = {
3129}, 3130},
3130{ 3131{
3131 .access = SNDRV_CTL_ELEM_ACCESS_READ, 3132 .access = SNDRV_CTL_ELEM_ACCESS_READ,
3132 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 3133 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
3133 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,PRO_MASK), 3134 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,PRO_MASK),
3134 .info = snd_hdsp_control_spdif_mask_info, 3135 .info = snd_hdsp_control_spdif_mask_info,
3135 .get = snd_hdsp_control_spdif_mask_get, 3136 .get = snd_hdsp_control_spdif_mask_get,
@@ -3146,8 +3147,6 @@ HDSP_SPDIF_NON_AUDIO("IEC958 Non-audio Bit", 0),
3146/* 'Sample Clock Source' complies with the alsa control naming scheme */ 3147/* 'Sample Clock Source' complies with the alsa control naming scheme */
3147HDSP_CLOCK_SOURCE("Sample Clock Source", 0), 3148HDSP_CLOCK_SOURCE("Sample Clock Source", 0),
3148{ 3149{
3149 /* FIXME: should be PCM or MIXER? */
3150 /* .iface = SNDRV_CTL_ELEM_IFACE_PCM, */
3151 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 3150 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3152 .name = "Sample Clock Source Locking", 3151 .name = "Sample Clock Source Locking",
3153 .info = snd_hdsp_info_clock_source_lock, 3152 .info = snd_hdsp_info_clock_source_lock,
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c
index 9e86d0eb41ce..5d786d113b25 100644
--- a/sound/pci/rme9652/hdspm.c
+++ b/sound/pci/rme9652/hdspm.c
@@ -65,7 +65,7 @@ module_param_array(enable, bool, NULL, 0444);
65MODULE_PARM_DESC(enable, "Enable/disable specific HDSPM soundcards."); 65MODULE_PARM_DESC(enable, "Enable/disable specific HDSPM soundcards.");
66 66
67module_param_array(precise_ptr, bool, NULL, 0444); 67module_param_array(precise_ptr, bool, NULL, 0444);
68MODULE_PARM_DESC(precise_ptr, "Enable precise pointer, or disable."); 68MODULE_PARM_DESC(precise_ptr, "Enable or disable precise pointer.");
69 69
70module_param_array(line_outs_monitor, bool, NULL, 0444); 70module_param_array(line_outs_monitor, bool, NULL, 0444);
71MODULE_PARM_DESC(line_outs_monitor, 71MODULE_PARM_DESC(line_outs_monitor,
@@ -1104,14 +1104,14 @@ static int snd_hdspm_midi_output_close(snd_rawmidi_substream_t * substream)
1104 return 0; 1104 return 0;
1105} 1105}
1106 1106
1107snd_rawmidi_ops_t snd_hdspm_midi_output = 1107static snd_rawmidi_ops_t snd_hdspm_midi_output =
1108{ 1108{
1109 .open = snd_hdspm_midi_output_open, 1109 .open = snd_hdspm_midi_output_open,
1110 .close = snd_hdspm_midi_output_close, 1110 .close = snd_hdspm_midi_output_close,
1111 .trigger = snd_hdspm_midi_output_trigger, 1111 .trigger = snd_hdspm_midi_output_trigger,
1112}; 1112};
1113 1113
1114snd_rawmidi_ops_t snd_hdspm_midi_input = 1114static snd_rawmidi_ops_t snd_hdspm_midi_input =
1115{ 1115{
1116 .open = snd_hdspm_midi_input_open, 1116 .open = snd_hdspm_midi_input_open,
1117 .close = snd_hdspm_midi_input_close, 1117 .close = snd_hdspm_midi_input_close,
@@ -1168,7 +1168,7 @@ static void hdspm_midi_tasklet(unsigned long arg)
1168/* get the system sample rate which is set */ 1168/* get the system sample rate which is set */
1169 1169
1170#define HDSPM_SYSTEM_SAMPLE_RATE(xname, xindex) \ 1170#define HDSPM_SYSTEM_SAMPLE_RATE(xname, xindex) \
1171{ .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ 1171{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1172 .name = xname, \ 1172 .name = xname, \
1173 .index = xindex, \ 1173 .index = xindex, \
1174 .access = SNDRV_CTL_ELEM_ACCESS_READ, \ 1174 .access = SNDRV_CTL_ELEM_ACCESS_READ, \
@@ -1195,7 +1195,7 @@ static int snd_hdspm_get_system_sample_rate(snd_kcontrol_t * kcontrol,
1195} 1195}
1196 1196
1197#define HDSPM_AUTOSYNC_SAMPLE_RATE(xname, xindex) \ 1197#define HDSPM_AUTOSYNC_SAMPLE_RATE(xname, xindex) \
1198{ .iface = SNDRV_CTL_ELEM_IFACE_PCM, \ 1198{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1199 .name = xname, \ 1199 .name = xname, \
1200 .index = xindex, \ 1200 .index = xindex, \
1201 .access = SNDRV_CTL_ELEM_ACCESS_READ, \ 1201 .access = SNDRV_CTL_ELEM_ACCESS_READ, \
@@ -1264,7 +1264,7 @@ static int snd_hdspm_get_autosync_sample_rate(snd_kcontrol_t * kcontrol,
1264} 1264}
1265 1265
1266#define HDSPM_SYSTEM_CLOCK_MODE(xname, xindex) \ 1266#define HDSPM_SYSTEM_CLOCK_MODE(xname, xindex) \
1267{ .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ 1267{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1268 .name = xname, \ 1268 .name = xname, \
1269 .index = xindex, \ 1269 .index = xindex, \
1270 .access = SNDRV_CTL_ELEM_ACCESS_READ, \ 1270 .access = SNDRV_CTL_ELEM_ACCESS_READ, \
@@ -1310,7 +1310,7 @@ static int snd_hdspm_get_system_clock_mode(snd_kcontrol_t * kcontrol,
1310} 1310}
1311 1311
1312#define HDSPM_CLOCK_SOURCE(xname, xindex) \ 1312#define HDSPM_CLOCK_SOURCE(xname, xindex) \
1313{ .iface = SNDRV_CTL_ELEM_IFACE_PCM, \ 1313{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1314 .name = xname, \ 1314 .name = xname, \
1315 .index = xindex, \ 1315 .index = xindex, \
1316 .info = snd_hdspm_info_clock_source, \ 1316 .info = snd_hdspm_info_clock_source, \
@@ -1457,7 +1457,7 @@ static int snd_hdspm_put_clock_source(snd_kcontrol_t * kcontrol,
1457} 1457}
1458 1458
1459#define HDSPM_PREF_SYNC_REF(xname, xindex) \ 1459#define HDSPM_PREF_SYNC_REF(xname, xindex) \
1460{ .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ 1460{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1461 .name = xname, \ 1461 .name = xname, \
1462 .index = xindex, \ 1462 .index = xindex, \
1463 .info = snd_hdspm_info_pref_sync_ref, \ 1463 .info = snd_hdspm_info_pref_sync_ref, \
@@ -1547,7 +1547,7 @@ static int snd_hdspm_put_pref_sync_ref(snd_kcontrol_t * kcontrol,
1547} 1547}
1548 1548
1549#define HDSPM_AUTOSYNC_REF(xname, xindex) \ 1549#define HDSPM_AUTOSYNC_REF(xname, xindex) \
1550{ .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ 1550{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1551 .name = xname, \ 1551 .name = xname, \
1552 .index = xindex, \ 1552 .index = xindex, \
1553 .access = SNDRV_CTL_ELEM_ACCESS_READ, \ 1553 .access = SNDRV_CTL_ELEM_ACCESS_READ, \
@@ -1604,7 +1604,7 @@ static int snd_hdspm_get_autosync_ref(snd_kcontrol_t * kcontrol,
1604} 1604}
1605 1605
1606#define HDSPM_LINE_OUT(xname, xindex) \ 1606#define HDSPM_LINE_OUT(xname, xindex) \
1607{ .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ 1607{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1608 .name = xname, \ 1608 .name = xname, \
1609 .index = xindex, \ 1609 .index = xindex, \
1610 .info = snd_hdspm_info_line_out, \ 1610 .info = snd_hdspm_info_line_out, \
@@ -1668,7 +1668,7 @@ static int snd_hdspm_put_line_out(snd_kcontrol_t * kcontrol,
1668} 1668}
1669 1669
1670#define HDSPM_TX_64(xname, xindex) \ 1670#define HDSPM_TX_64(xname, xindex) \
1671{ .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ 1671{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1672 .name = xname, \ 1672 .name = xname, \
1673 .index = xindex, \ 1673 .index = xindex, \
1674 .info = snd_hdspm_info_tx_64, \ 1674 .info = snd_hdspm_info_tx_64, \
@@ -1731,7 +1731,7 @@ static int snd_hdspm_put_tx_64(snd_kcontrol_t * kcontrol,
1731} 1731}
1732 1732
1733#define HDSPM_C_TMS(xname, xindex) \ 1733#define HDSPM_C_TMS(xname, xindex) \
1734{ .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ 1734{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1735 .name = xname, \ 1735 .name = xname, \
1736 .index = xindex, \ 1736 .index = xindex, \
1737 .info = snd_hdspm_info_c_tms, \ 1737 .info = snd_hdspm_info_c_tms, \
@@ -1794,7 +1794,7 @@ static int snd_hdspm_put_c_tms(snd_kcontrol_t * kcontrol,
1794} 1794}
1795 1795
1796#define HDSPM_SAFE_MODE(xname, xindex) \ 1796#define HDSPM_SAFE_MODE(xname, xindex) \
1797{ .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ 1797{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1798 .name = xname, \ 1798 .name = xname, \
1799 .index = xindex, \ 1799 .index = xindex, \
1800 .info = snd_hdspm_info_safe_mode, \ 1800 .info = snd_hdspm_info_safe_mode, \
@@ -1857,7 +1857,7 @@ static int snd_hdspm_put_safe_mode(snd_kcontrol_t * kcontrol,
1857} 1857}
1858 1858
1859#define HDSPM_INPUT_SELECT(xname, xindex) \ 1859#define HDSPM_INPUT_SELECT(xname, xindex) \
1860{ .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ 1860{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
1861 .name = xname, \ 1861 .name = xname, \
1862 .index = xindex, \ 1862 .index = xindex, \
1863 .info = snd_hdspm_info_input_select, \ 1863 .info = snd_hdspm_info_input_select, \
@@ -1941,6 +1941,7 @@ static int snd_hdspm_put_input_select(snd_kcontrol_t * kcontrol,
1941{ .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ 1941{ .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \
1942 .name = xname, \ 1942 .name = xname, \
1943 .index = xindex, \ 1943 .index = xindex, \
1944 .device = 0, \
1944 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | \ 1945 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | \
1945 SNDRV_CTL_ELEM_ACCESS_VOLATILE, \ 1946 SNDRV_CTL_ELEM_ACCESS_VOLATILE, \
1946 .info = snd_hdspm_info_mixer, \ 1947 .info = snd_hdspm_info_mixer, \
@@ -2124,7 +2125,7 @@ static int snd_hdspm_put_playback_mixer(snd_kcontrol_t * kcontrol,
2124} 2125}
2125 2126
2126#define HDSPM_WC_SYNC_CHECK(xname, xindex) \ 2127#define HDSPM_WC_SYNC_CHECK(xname, xindex) \
2127{ .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ 2128{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2128 .name = xname, \ 2129 .name = xname, \
2129 .index = xindex, \ 2130 .index = xindex, \
2130 .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, \ 2131 .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, \
@@ -2170,7 +2171,7 @@ static int snd_hdspm_get_wc_sync_check(snd_kcontrol_t * kcontrol,
2170 2171
2171 2172
2172#define HDSPM_MADI_SYNC_CHECK(xname, xindex) \ 2173#define HDSPM_MADI_SYNC_CHECK(xname, xindex) \
2173{ .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, \ 2174{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2174 .name = xname, \ 2175 .name = xname, \
2175 .index = xindex, \ 2176 .index = xindex, \
2176 .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, \ 2177 .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, \
diff --git a/sound/pci/rme9652/rme9652.c b/sound/pci/rme9652/rme9652.c
index 1bc9d0df8516..8ee4d6fd6ea7 100644
--- a/sound/pci/rme9652/rme9652.c
+++ b/sound/pci/rme9652/rme9652.c
@@ -893,7 +893,7 @@ static int snd_rme9652_control_spdif_mask_get(snd_kcontrol_t * kcontrol, snd_ctl
893} 893}
894 894
895#define RME9652_ADAT1_IN(xname, xindex) \ 895#define RME9652_ADAT1_IN(xname, xindex) \
896{ .iface = SNDRV_CTL_ELEM_IFACE_PCM, .name = xname, .index = xindex, \ 896{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \
897 .info = snd_rme9652_info_adat1_in, \ 897 .info = snd_rme9652_info_adat1_in, \
898 .get = snd_rme9652_get_adat1_in, \ 898 .get = snd_rme9652_get_adat1_in, \
899 .put = snd_rme9652_put_adat1_in } 899 .put = snd_rme9652_put_adat1_in }
@@ -971,7 +971,7 @@ static int snd_rme9652_put_adat1_in(snd_kcontrol_t * kcontrol, snd_ctl_elem_valu
971} 971}
972 972
973#define RME9652_SPDIF_IN(xname, xindex) \ 973#define RME9652_SPDIF_IN(xname, xindex) \
974{ .iface = SNDRV_CTL_ELEM_IFACE_PCM, .name = xname, .index = xindex, \ 974{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \
975 .info = snd_rme9652_info_spdif_in, \ 975 .info = snd_rme9652_info_spdif_in, \
976 .get = snd_rme9652_get_spdif_in, .put = snd_rme9652_put_spdif_in } 976 .get = snd_rme9652_get_spdif_in, .put = snd_rme9652_put_spdif_in }
977 977
@@ -1042,7 +1042,7 @@ static int snd_rme9652_put_spdif_in(snd_kcontrol_t * kcontrol, snd_ctl_elem_valu
1042} 1042}
1043 1043
1044#define RME9652_SPDIF_OUT(xname, xindex) \ 1044#define RME9652_SPDIF_OUT(xname, xindex) \
1045{ .iface = SNDRV_CTL_ELEM_IFACE_PCM, .name = xname, .index = xindex, \ 1045{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \
1046 .info = snd_rme9652_info_spdif_out, \ 1046 .info = snd_rme9652_info_spdif_out, \
1047 .get = snd_rme9652_get_spdif_out, .put = snd_rme9652_put_spdif_out } 1047 .get = snd_rme9652_get_spdif_out, .put = snd_rme9652_put_spdif_out }
1048 1048
@@ -1110,7 +1110,7 @@ static int snd_rme9652_put_spdif_out(snd_kcontrol_t * kcontrol, snd_ctl_elem_val
1110} 1110}
1111 1111
1112#define RME9652_SYNC_MODE(xname, xindex) \ 1112#define RME9652_SYNC_MODE(xname, xindex) \
1113{ .iface = SNDRV_CTL_ELEM_IFACE_PCM, .name = xname, .index = xindex, \ 1113{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \
1114 .info = snd_rme9652_info_sync_mode, \ 1114 .info = snd_rme9652_info_sync_mode, \
1115 .get = snd_rme9652_get_sync_mode, .put = snd_rme9652_put_sync_mode } 1115 .get = snd_rme9652_get_sync_mode, .put = snd_rme9652_put_sync_mode }
1116 1116
@@ -1195,7 +1195,7 @@ static int snd_rme9652_put_sync_mode(snd_kcontrol_t * kcontrol, snd_ctl_elem_val
1195} 1195}
1196 1196
1197#define RME9652_SYNC_PREF(xname, xindex) \ 1197#define RME9652_SYNC_PREF(xname, xindex) \
1198{ .iface = SNDRV_CTL_ELEM_IFACE_PCM, .name = xname, .index = xindex, \ 1198{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \
1199 .info = snd_rme9652_info_sync_pref, \ 1199 .info = snd_rme9652_info_sync_pref, \
1200 .get = snd_rme9652_get_sync_pref, .put = snd_rme9652_put_sync_pref } 1200 .get = snd_rme9652_get_sync_pref, .put = snd_rme9652_put_sync_pref }
1201 1201
@@ -1340,7 +1340,7 @@ static int snd_rme9652_put_thru(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t
1340} 1340}
1341 1341
1342#define RME9652_PASSTHRU(xname, xindex) \ 1342#define RME9652_PASSTHRU(xname, xindex) \
1343{ .iface = SNDRV_CTL_ELEM_IFACE_PCM, .name = xname, .index = xindex, \ 1343{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \
1344 .info = snd_rme9652_info_passthru, \ 1344 .info = snd_rme9652_info_passthru, \
1345 .put = snd_rme9652_put_passthru, \ 1345 .put = snd_rme9652_put_passthru, \
1346 .get = snd_rme9652_get_passthru } 1346 .get = snd_rme9652_get_passthru }
@@ -1386,7 +1386,7 @@ static int snd_rme9652_put_passthru(snd_kcontrol_t * kcontrol, snd_ctl_elem_valu
1386/* Read-only switches */ 1386/* Read-only switches */
1387 1387
1388#define RME9652_SPDIF_RATE(xname, xindex) \ 1388#define RME9652_SPDIF_RATE(xname, xindex) \
1389{ .iface = SNDRV_CTL_ELEM_IFACE_PCM, .name = xname, .index = xindex, \ 1389{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \
1390 .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, \ 1390 .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, \
1391 .info = snd_rme9652_info_spdif_rate, \ 1391 .info = snd_rme9652_info_spdif_rate, \
1392 .get = snd_rme9652_get_spdif_rate } 1392 .get = snd_rme9652_get_spdif_rate }
@@ -1411,7 +1411,7 @@ static int snd_rme9652_get_spdif_rate(snd_kcontrol_t * kcontrol, snd_ctl_elem_va
1411} 1411}
1412 1412
1413#define RME9652_ADAT_SYNC(xname, xindex, xidx) \ 1413#define RME9652_ADAT_SYNC(xname, xindex, xidx) \
1414{ .iface = SNDRV_CTL_ELEM_IFACE_PCM, .name = xname, .index = xindex, \ 1414{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \
1415 .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, \ 1415 .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, \
1416 .info = snd_rme9652_info_adat_sync, \ 1416 .info = snd_rme9652_info_adat_sync, \
1417 .get = snd_rme9652_get_adat_sync, .private_value = xidx } 1417 .get = snd_rme9652_get_adat_sync, .private_value = xidx }
@@ -1447,7 +1447,7 @@ static int snd_rme9652_get_adat_sync(snd_kcontrol_t * kcontrol, snd_ctl_elem_val
1447} 1447}
1448 1448
1449#define RME9652_TC_VALID(xname, xindex) \ 1449#define RME9652_TC_VALID(xname, xindex) \
1450{ .iface = SNDRV_CTL_ELEM_IFACE_PCM, .name = xname, .index = xindex, \ 1450{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \
1451 .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, \ 1451 .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, \
1452 .info = snd_rme9652_info_tc_valid, \ 1452 .info = snd_rme9652_info_tc_valid, \
1453 .get = snd_rme9652_get_tc_valid } 1453 .get = snd_rme9652_get_tc_valid }
@@ -1545,7 +1545,7 @@ static snd_kcontrol_new_t snd_rme9652_controls[] = {
1545}, 1545},
1546{ 1546{
1547 .access = SNDRV_CTL_ELEM_ACCESS_READ, 1547 .access = SNDRV_CTL_ELEM_ACCESS_READ,
1548 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1548 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
1549 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,CON_MASK), 1549 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,CON_MASK),
1550 .info = snd_rme9652_control_spdif_mask_info, 1550 .info = snd_rme9652_control_spdif_mask_info,
1551 .get = snd_rme9652_control_spdif_mask_get, 1551 .get = snd_rme9652_control_spdif_mask_get,
@@ -1555,7 +1555,7 @@ static snd_kcontrol_new_t snd_rme9652_controls[] = {
1555}, 1555},
1556{ 1556{
1557 .access = SNDRV_CTL_ELEM_ACCESS_READ, 1557 .access = SNDRV_CTL_ELEM_ACCESS_READ,
1558 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1558 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
1559 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,PRO_MASK), 1559 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,PRO_MASK),
1560 .info = snd_rme9652_control_spdif_mask_info, 1560 .info = snd_rme9652_control_spdif_mask_info,
1561 .get = snd_rme9652_control_spdif_mask_get, 1561 .get = snd_rme9652_control_spdif_mask_get,
@@ -1568,7 +1568,7 @@ RME9652_SPDIF_OUT("IEC958 Output also on ADAT1", 0),
1568RME9652_SYNC_MODE("Sync Mode", 0), 1568RME9652_SYNC_MODE("Sync Mode", 0),
1569RME9652_SYNC_PREF("Preferred Sync Source", 0), 1569RME9652_SYNC_PREF("Preferred Sync Source", 0),
1570{ 1570{
1571 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 1571 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1572 .name = "Channels Thru", 1572 .name = "Channels Thru",
1573 .index = 0, 1573 .index = 0,
1574 .info = snd_rme9652_info_thru, 1574 .info = snd_rme9652_info_thru,
diff --git a/sound/pci/trident/trident_main.c b/sound/pci/trident/trident_main.c
index 29d89bfba0a4..f30d9d947862 100644
--- a/sound/pci/trident/trident_main.c
+++ b/sound/pci/trident/trident_main.c
@@ -1689,7 +1689,7 @@ static snd_pcm_hardware_t snd_trident_playback =
1689 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | 1689 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
1690 SNDRV_PCM_INFO_BLOCK_TRANSFER | 1690 SNDRV_PCM_INFO_BLOCK_TRANSFER |
1691 SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_SYNC_START | 1691 SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_SYNC_START |
1692 SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME), 1692 SNDRV_PCM_INFO_PAUSE /* | SNDRV_PCM_INFO_RESUME */),
1693 .formats = (SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE | 1693 .formats = (SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE |
1694 SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_U16_LE), 1694 SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_U16_LE),
1695 .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000, 1695 .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000,
@@ -1714,7 +1714,7 @@ static snd_pcm_hardware_t snd_trident_capture =
1714 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | 1714 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
1715 SNDRV_PCM_INFO_BLOCK_TRANSFER | 1715 SNDRV_PCM_INFO_BLOCK_TRANSFER |
1716 SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_SYNC_START | 1716 SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_SYNC_START |
1717 SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME), 1717 SNDRV_PCM_INFO_PAUSE /* | SNDRV_PCM_INFO_RESUME */),
1718 .formats = (SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE | 1718 .formats = (SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE |
1719 SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_U16_LE), 1719 SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_U16_LE),
1720 .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000, 1720 .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000,
@@ -1739,7 +1739,7 @@ static snd_pcm_hardware_t snd_trident_foldback =
1739 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | 1739 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
1740 SNDRV_PCM_INFO_BLOCK_TRANSFER | 1740 SNDRV_PCM_INFO_BLOCK_TRANSFER |
1741 SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_SYNC_START | 1741 SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_SYNC_START |
1742 SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME), 1742 SNDRV_PCM_INFO_PAUSE /* | SNDRV_PCM_INFO_RESUME */),
1743 .formats = SNDRV_PCM_FMTBIT_S16_LE, 1743 .formats = SNDRV_PCM_FMTBIT_S16_LE,
1744 .rates = SNDRV_PCM_RATE_48000, 1744 .rates = SNDRV_PCM_RATE_48000,
1745 .rate_min = 48000, 1745 .rate_min = 48000,
@@ -1763,7 +1763,7 @@ static snd_pcm_hardware_t snd_trident_spdif =
1763 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | 1763 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
1764 SNDRV_PCM_INFO_BLOCK_TRANSFER | 1764 SNDRV_PCM_INFO_BLOCK_TRANSFER |
1765 SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_SYNC_START | 1765 SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_SYNC_START |
1766 SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME), 1766 SNDRV_PCM_INFO_PAUSE /* | SNDRV_PCM_INFO_RESUME */),
1767 .formats = SNDRV_PCM_FMTBIT_S16_LE, 1767 .formats = SNDRV_PCM_FMTBIT_S16_LE,
1768 .rates = (SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | 1768 .rates = (SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 |
1769 SNDRV_PCM_RATE_48000), 1769 SNDRV_PCM_RATE_48000),
@@ -1784,7 +1784,7 @@ static snd_pcm_hardware_t snd_trident_spdif_7018 =
1784 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | 1784 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
1785 SNDRV_PCM_INFO_BLOCK_TRANSFER | 1785 SNDRV_PCM_INFO_BLOCK_TRANSFER |
1786 SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_SYNC_START | 1786 SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_SYNC_START |
1787 SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME), 1787 SNDRV_PCM_INFO_PAUSE /* | SNDRV_PCM_INFO_RESUME */),
1788 .formats = SNDRV_PCM_FMTBIT_S16_LE, 1788 .formats = SNDRV_PCM_FMTBIT_S16_LE,
1789 .rates = SNDRV_PCM_RATE_48000, 1789 .rates = SNDRV_PCM_RATE_48000,
1790 .rate_min = 48000, 1790 .rate_min = 48000,
diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c
index 4889600387c8..56c6e52d7264 100644
--- a/sound/pci/via82xx.c
+++ b/sound/pci/via82xx.c
@@ -663,10 +663,12 @@ static int snd_via82xx_pcm_trigger(snd_pcm_substream_t * substream, int cmd)
663 val = 0; 663 val = 0;
664 switch (cmd) { 664 switch (cmd) {
665 case SNDRV_PCM_TRIGGER_START: 665 case SNDRV_PCM_TRIGGER_START:
666 case SNDRV_PCM_TRIGGER_RESUME:
666 val |= VIA_REG_CTRL_START; 667 val |= VIA_REG_CTRL_START;
667 viadev->running = 1; 668 viadev->running = 1;
668 break; 669 break;
669 case SNDRV_PCM_TRIGGER_STOP: 670 case SNDRV_PCM_TRIGGER_STOP:
671 case SNDRV_PCM_TRIGGER_SUSPEND:
670 val = VIA_REG_CTRL_TERMINATE; 672 val = VIA_REG_CTRL_TERMINATE;
671 viadev->running = 0; 673 viadev->running = 0;
672 break; 674 break;
@@ -929,12 +931,12 @@ static int snd_via8233_playback_prepare(snd_pcm_substream_t *substream)
929 931
930 if ((rate_changed = via_lock_rate(&chip->rates[0], ac97_rate)) < 0) 932 if ((rate_changed = via_lock_rate(&chip->rates[0], ac97_rate)) < 0)
931 return rate_changed; 933 return rate_changed;
932 if (rate_changed) { 934 if (rate_changed)
933 snd_ac97_set_rate(chip->ac97, AC97_PCM_FRONT_DAC_RATE, 935 snd_ac97_set_rate(chip->ac97, AC97_PCM_FRONT_DAC_RATE,
934 chip->no_vra ? 48000 : runtime->rate); 936 chip->no_vra ? 48000 : runtime->rate);
935 snd_ac97_set_rate(chip->ac97, AC97_SPDIF, 937 if (chip->spdif_on && viadev->reg_offset == 0x30)
936 chip->no_vra ? 48000 : runtime->rate); 938 snd_ac97_set_rate(chip->ac97, AC97_SPDIF, runtime->rate);
937 } 939
938 if (runtime->rate == 48000) 940 if (runtime->rate == 48000)
939 rbits = 0xfffff; 941 rbits = 0xfffff;
940 else 942 else
@@ -1035,7 +1037,7 @@ static snd_pcm_hardware_t snd_via82xx_hw =
1035 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | 1037 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
1036 SNDRV_PCM_INFO_BLOCK_TRANSFER | 1038 SNDRV_PCM_INFO_BLOCK_TRANSFER |
1037 SNDRV_PCM_INFO_MMAP_VALID | 1039 SNDRV_PCM_INFO_MMAP_VALID |
1038 SNDRV_PCM_INFO_RESUME | 1040 /* SNDRV_PCM_INFO_RESUME | */
1039 SNDRV_PCM_INFO_PAUSE), 1041 SNDRV_PCM_INFO_PAUSE),
1040 .formats = SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE, 1042 .formats = SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE,
1041 .rates = SNDRV_PCM_RATE_48000, 1043 .rates = SNDRV_PCM_RATE_48000,
@@ -1484,7 +1486,7 @@ static int snd_via8233_dxs3_spdif_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_val
1484} 1486}
1485 1487
1486static snd_kcontrol_new_t snd_via8233_dxs3_spdif_control __devinitdata = { 1488static snd_kcontrol_new_t snd_via8233_dxs3_spdif_control __devinitdata = {
1487 .name = "IEC958 Output Switch", 1489 .name = SNDRV_CTL_NAME_IEC958("Output ",NONE,SWITCH),
1488 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1490 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1489 .info = snd_via8233_dxs3_spdif_info, 1491 .info = snd_via8233_dxs3_spdif_info,
1490 .get = snd_via8233_dxs3_spdif_get, 1492 .get = snd_via8233_dxs3_spdif_get,
@@ -2153,6 +2155,7 @@ static int __devinit check_dxs_list(struct pci_dev *pci)
2153 { .subvendor = 0x1019, .subdevice = 0x0a81, .action = VIA_DXS_NO_VRA }, /* ECS K7VTA3 v8.0 */ 2155 { .subvendor = 0x1019, .subdevice = 0x0a81, .action = VIA_DXS_NO_VRA }, /* ECS K7VTA3 v8.0 */
2154 { .subvendor = 0x1019, .subdevice = 0x0a85, .action = VIA_DXS_NO_VRA }, /* ECS L7VMM2 */ 2156 { .subvendor = 0x1019, .subdevice = 0x0a85, .action = VIA_DXS_NO_VRA }, /* ECS L7VMM2 */
2155 { .subvendor = 0x1025, .subdevice = 0x0033, .action = VIA_DXS_NO_VRA }, /* Acer Inspire 1353LM */ 2157 { .subvendor = 0x1025, .subdevice = 0x0033, .action = VIA_DXS_NO_VRA }, /* Acer Inspire 1353LM */
2158 { .subvendor = 0x1025, .subdevice = 0x0046, .action = VIA_DXS_SRC }, /* Acer Aspire 1524 WLMi */
2156 { .subvendor = 0x1043, .subdevice = 0x8095, .action = VIA_DXS_NO_VRA }, /* ASUS A7V8X (FIXME: possibly VIA_DXS_ENABLE?)*/ 2159 { .subvendor = 0x1043, .subdevice = 0x8095, .action = VIA_DXS_NO_VRA }, /* ASUS A7V8X (FIXME: possibly VIA_DXS_ENABLE?)*/
2157 { .subvendor = 0x1043, .subdevice = 0x80a1, .action = VIA_DXS_NO_VRA }, /* ASUS A7V8-X */ 2160 { .subvendor = 0x1043, .subdevice = 0x80a1, .action = VIA_DXS_NO_VRA }, /* ASUS A7V8-X */
2158 { .subvendor = 0x1043, .subdevice = 0x80b0, .action = VIA_DXS_NO_VRA }, /* ASUS A7V600 & K8V*/ 2161 { .subvendor = 0x1043, .subdevice = 0x80b0, .action = VIA_DXS_NO_VRA }, /* ASUS A7V600 & K8V*/
@@ -2168,10 +2171,12 @@ static int __devinit check_dxs_list(struct pci_dev *pci)
2168 { .subvendor = 0x1297, .subdevice = 0xc160, .action = VIA_DXS_ENABLE }, /* Shuttle SK41G */ 2171 { .subvendor = 0x1297, .subdevice = 0xc160, .action = VIA_DXS_ENABLE }, /* Shuttle SK41G */
2169 { .subvendor = 0x1458, .subdevice = 0xa002, .action = VIA_DXS_ENABLE }, /* Gigabyte GA-7VAXP */ 2172 { .subvendor = 0x1458, .subdevice = 0xa002, .action = VIA_DXS_ENABLE }, /* Gigabyte GA-7VAXP */
2170 { .subvendor = 0x1462, .subdevice = 0x0080, .action = VIA_DXS_SRC }, /* MSI K8T Neo-FIS2R */ 2173 { .subvendor = 0x1462, .subdevice = 0x0080, .action = VIA_DXS_SRC }, /* MSI K8T Neo-FIS2R */
2174 { .subvendor = 0x1462, .subdevice = 0x0430, .action = VIA_DXS_SRC }, /* MSI 7142 (K8MM-V) */
2171 { .subvendor = 0x1462, .subdevice = 0x3800, .action = VIA_DXS_ENABLE }, /* MSI KT266 */ 2175 { .subvendor = 0x1462, .subdevice = 0x3800, .action = VIA_DXS_ENABLE }, /* MSI KT266 */
2172 { .subvendor = 0x1462, .subdevice = 0x5901, .action = VIA_DXS_NO_VRA }, /* MSI KT6 Delta-SR */ 2176 { .subvendor = 0x1462, .subdevice = 0x5901, .action = VIA_DXS_NO_VRA }, /* MSI KT6 Delta-SR */
2173 { .subvendor = 0x1462, .subdevice = 0x7023, .action = VIA_DXS_NO_VRA }, /* MSI K8T Neo2-FI */ 2177 { .subvendor = 0x1462, .subdevice = 0x7023, .action = VIA_DXS_NO_VRA }, /* MSI K8T Neo2-FI */
2174 { .subvendor = 0x1462, .subdevice = 0x7120, .action = VIA_DXS_ENABLE }, /* MSI KT4V */ 2178 { .subvendor = 0x1462, .subdevice = 0x7120, .action = VIA_DXS_ENABLE }, /* MSI KT4V */
2179 { .subvendor = 0x1462, .subdevice = 0x7142, .action = VIA_DXS_ENABLE }, /* MSI K8MM-V */
2175 { .subvendor = 0x147b, .subdevice = 0x1401, .action = VIA_DXS_ENABLE }, /* ABIT KD7(-RAID) */ 2180 { .subvendor = 0x147b, .subdevice = 0x1401, .action = VIA_DXS_ENABLE }, /* ABIT KD7(-RAID) */
2176 { .subvendor = 0x147b, .subdevice = 0x1411, .action = VIA_DXS_ENABLE }, /* ABIT VA-20 */ 2181 { .subvendor = 0x147b, .subdevice = 0x1411, .action = VIA_DXS_ENABLE }, /* ABIT VA-20 */
2177 { .subvendor = 0x147b, .subdevice = 0x1413, .action = VIA_DXS_ENABLE }, /* ABIT KV8 Pro */ 2182 { .subvendor = 0x147b, .subdevice = 0x1413, .action = VIA_DXS_ENABLE }, /* ABIT KV8 Pro */
diff --git a/sound/pci/via82xx_modem.c b/sound/pci/via82xx_modem.c
index 4a9779cc9733..5872d438a04a 100644
--- a/sound/pci/via82xx_modem.c
+++ b/sound/pci/via82xx_modem.c
@@ -521,6 +521,7 @@ static int snd_via82xx_pcm_trigger(snd_pcm_substream_t * substream, int cmd)
521 521
522 switch (cmd) { 522 switch (cmd) {
523 case SNDRV_PCM_TRIGGER_START: 523 case SNDRV_PCM_TRIGGER_START:
524 case SNDRV_PCM_TRIGGER_SUSPEND:
524 val |= VIA_REG_CTRL_START; 525 val |= VIA_REG_CTRL_START;
525 viadev->running = 1; 526 viadev->running = 1;
526 break; 527 break;
@@ -697,7 +698,7 @@ static snd_pcm_hardware_t snd_via82xx_hw =
697 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | 698 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
698 SNDRV_PCM_INFO_BLOCK_TRANSFER | 699 SNDRV_PCM_INFO_BLOCK_TRANSFER |
699 SNDRV_PCM_INFO_MMAP_VALID | 700 SNDRV_PCM_INFO_MMAP_VALID |
700 SNDRV_PCM_INFO_RESUME | 701 /* SNDRV_PCM_INFO_RESUME | */
701 SNDRV_PCM_INFO_PAUSE), 702 SNDRV_PCM_INFO_PAUSE),
702 .formats = SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE, 703 .formats = SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE,
703 .rates = SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_KNOT, 704 .rates = SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_KNOT,
diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c
index d54f88a1b525..054836412dc4 100644
--- a/sound/pci/ymfpci/ymfpci_main.c
+++ b/sound/pci/ymfpci/ymfpci_main.c
@@ -321,6 +321,26 @@ static void snd_ymfpci_pcm_interrupt(ymfpci_t *chip, ymfpci_voice_t *voice)
321 snd_pcm_period_elapsed(ypcm->substream); 321 snd_pcm_period_elapsed(ypcm->substream);
322 spin_lock(&chip->reg_lock); 322 spin_lock(&chip->reg_lock);
323 } 323 }
324
325 if (unlikely(ypcm->update_pcm_vol)) {
326 unsigned int subs = ypcm->substream->number;
327 unsigned int next_bank = 1 - chip->active_bank;
328 snd_ymfpci_playback_bank_t *bank;
329 u32 volume;
330
331 bank = &voice->bank[next_bank];
332 volume = cpu_to_le32(chip->pcm_mixer[subs].left << 15);
333 bank->left_gain_end = volume;
334 if (ypcm->output_rear)
335 bank->eff2_gain_end = volume;
336 if (ypcm->voices[1])
337 bank = &ypcm->voices[1]->bank[next_bank];
338 volume = cpu_to_le32(chip->pcm_mixer[subs].right << 15);
339 bank->right_gain_end = volume;
340 if (ypcm->output_rear)
341 bank->eff3_gain_end = volume;
342 ypcm->update_pcm_vol--;
343 }
324 } 344 }
325 spin_unlock(&chip->reg_lock); 345 spin_unlock(&chip->reg_lock);
326} 346}
@@ -451,87 +471,74 @@ static int snd_ymfpci_pcm_voice_alloc(ymfpci_pcm_t *ypcm, int voices)
451 return 0; 471 return 0;
452} 472}
453 473
454static void snd_ymfpci_pcm_init_voice(ymfpci_voice_t *voice, int stereo, 474static void snd_ymfpci_pcm_init_voice(ymfpci_pcm_t *ypcm, unsigned int voiceidx,
455 int rate, int w_16, unsigned long addr, 475 snd_pcm_runtime_t *runtime,
456 unsigned int end, 476 int has_pcm_volume)
457 int output_front, int output_rear)
458{ 477{
478 ymfpci_voice_t *voice = ypcm->voices[voiceidx];
459 u32 format; 479 u32 format;
460 u32 delta = snd_ymfpci_calc_delta(rate); 480 u32 delta = snd_ymfpci_calc_delta(runtime->rate);
461 u32 lpfQ = snd_ymfpci_calc_lpfQ(rate); 481 u32 lpfQ = snd_ymfpci_calc_lpfQ(runtime->rate);
462 u32 lpfK = snd_ymfpci_calc_lpfK(rate); 482 u32 lpfK = snd_ymfpci_calc_lpfK(runtime->rate);
463 snd_ymfpci_playback_bank_t *bank; 483 snd_ymfpci_playback_bank_t *bank;
464 unsigned int nbank; 484 unsigned int nbank;
485 u32 vol_left, vol_right;
486 u8 use_left, use_right;
465 487
466 snd_assert(voice != NULL, return); 488 snd_assert(voice != NULL, return);
467 format = (stereo ? 0x00010000 : 0) | (w_16 ? 0 : 0x80000000); 489 if (runtime->channels == 1) {
490 use_left = 1;
491 use_right = 1;
492 } else {
493 use_left = (voiceidx & 1) == 0;
494 use_right = !use_left;
495 }
496 if (has_pcm_volume) {
497 vol_left = cpu_to_le32(ypcm->chip->pcm_mixer
498 [ypcm->substream->number].left << 15);
499 vol_right = cpu_to_le32(ypcm->chip->pcm_mixer
500 [ypcm->substream->number].right << 15);
501 } else {
502 vol_left = cpu_to_le32(0x40000000);
503 vol_right = cpu_to_le32(0x40000000);
504 }
505 format = runtime->channels == 2 ? 0x00010000 : 0;
506 if (snd_pcm_format_width(runtime->format) == 8)
507 format |= 0x80000000;
508 if (runtime->channels == 2 && (voiceidx & 1) != 0)
509 format |= 1;
468 for (nbank = 0; nbank < 2; nbank++) { 510 for (nbank = 0; nbank < 2; nbank++) {
469 bank = &voice->bank[nbank]; 511 bank = &voice->bank[nbank];
512 memset(bank, 0, sizeof(*bank));
470 bank->format = cpu_to_le32(format); 513 bank->format = cpu_to_le32(format);
471 bank->loop_default = 0; 514 bank->base = cpu_to_le32(runtime->dma_addr);
472 bank->base = cpu_to_le32(addr); 515 bank->loop_end = cpu_to_le32(ypcm->buffer_size);
473 bank->loop_start = 0;
474 bank->loop_end = cpu_to_le32(end);
475 bank->loop_frac = 0;
476 bank->eg_gain_end = cpu_to_le32(0x40000000);
477 bank->lpfQ = cpu_to_le32(lpfQ); 516 bank->lpfQ = cpu_to_le32(lpfQ);
478 bank->status = 0;
479 bank->num_of_frames = 0;
480 bank->loop_count = 0;
481 bank->start = 0;
482 bank->start_frac = 0;
483 bank->delta = 517 bank->delta =
484 bank->delta_end = cpu_to_le32(delta); 518 bank->delta_end = cpu_to_le32(delta);
485 bank->lpfK = 519 bank->lpfK =
486 bank->lpfK_end = cpu_to_le32(lpfK); 520 bank->lpfK_end = cpu_to_le32(lpfK);
487 bank->eg_gain = cpu_to_le32(0x40000000); 521 bank->eg_gain =
488 bank->lpfD1 = 522 bank->eg_gain_end = cpu_to_le32(0x40000000);
489 bank->lpfD2 = 0; 523
490 524 if (ypcm->output_front) {
491 bank->left_gain = 525 if (use_left) {
492 bank->right_gain = 526 bank->left_gain =
493 bank->left_gain_end = 527 bank->left_gain_end = vol_left;
494 bank->right_gain_end = 528 }
495 bank->eff1_gain = 529 if (use_right) {
496 bank->eff2_gain =
497 bank->eff3_gain =
498 bank->eff1_gain_end =
499 bank->eff2_gain_end =
500 bank->eff3_gain_end = 0;
501
502 if (!stereo) {
503 if (output_front) {
504 bank->left_gain =
505 bank->right_gain = 530 bank->right_gain =
506 bank->left_gain_end = 531 bank->right_gain_end = vol_right;
507 bank->right_gain_end = cpu_to_le32(0x40000000);
508 } 532 }
509 if (output_rear) { 533 }
534 if (ypcm->output_rear) {
535 if (use_left) {
510 bank->eff2_gain = 536 bank->eff2_gain =
511 bank->eff2_gain_end = 537 bank->eff2_gain_end = vol_left;
512 bank->eff3_gain =
513 bank->eff3_gain_end = cpu_to_le32(0x40000000);
514 }
515 } else {
516 if (output_front) {
517 if ((voice->number & 1) == 0) {
518 bank->left_gain =
519 bank->left_gain_end = cpu_to_le32(0x40000000);
520 } else {
521 bank->format |= cpu_to_le32(1);
522 bank->right_gain =
523 bank->right_gain_end = cpu_to_le32(0x40000000);
524 }
525 } 538 }
526 if (output_rear) { 539 if (use_right) {
527 if ((voice->number & 1) == 0) { 540 bank->eff3_gain =
528 bank->eff3_gain = 541 bank->eff3_gain_end = vol_right;
529 bank->eff3_gain_end = cpu_to_le32(0x40000000);
530 } else {
531 bank->format |= cpu_to_le32(1);
532 bank->eff2_gain =
533 bank->eff2_gain_end = cpu_to_le32(0x40000000);
534 }
535 } 542 }
536 } 543 }
537 } 544 }
@@ -613,7 +620,7 @@ static int snd_ymfpci_playback_hw_free(snd_pcm_substream_t * substream)
613 620
614static int snd_ymfpci_playback_prepare(snd_pcm_substream_t * substream) 621static int snd_ymfpci_playback_prepare(snd_pcm_substream_t * substream)
615{ 622{
616 // ymfpci_t *chip = snd_pcm_substream_chip(substream); 623 ymfpci_t *chip = snd_pcm_substream_chip(substream);
617 snd_pcm_runtime_t *runtime = substream->runtime; 624 snd_pcm_runtime_t *runtime = substream->runtime;
618 ymfpci_pcm_t *ypcm = runtime->private_data; 625 ymfpci_pcm_t *ypcm = runtime->private_data;
619 unsigned int nvoice; 626 unsigned int nvoice;
@@ -623,14 +630,8 @@ static int snd_ymfpci_playback_prepare(snd_pcm_substream_t * substream)
623 ypcm->period_pos = 0; 630 ypcm->period_pos = 0;
624 ypcm->last_pos = 0; 631 ypcm->last_pos = 0;
625 for (nvoice = 0; nvoice < runtime->channels; nvoice++) 632 for (nvoice = 0; nvoice < runtime->channels; nvoice++)
626 snd_ymfpci_pcm_init_voice(ypcm->voices[nvoice], 633 snd_ymfpci_pcm_init_voice(ypcm, nvoice, runtime,
627 runtime->channels == 2, 634 substream->pcm == chip->pcm);
628 runtime->rate,
629 snd_pcm_format_width(runtime->format) == 16,
630 runtime->dma_addr,
631 ypcm->buffer_size,
632 ypcm->output_front,
633 ypcm->output_rear);
634 return 0; 635 return 0;
635} 636}
636 637
@@ -882,6 +883,7 @@ static int snd_ymfpci_playback_open(snd_pcm_substream_t * substream)
882 ymfpci_t *chip = snd_pcm_substream_chip(substream); 883 ymfpci_t *chip = snd_pcm_substream_chip(substream);
883 snd_pcm_runtime_t *runtime = substream->runtime; 884 snd_pcm_runtime_t *runtime = substream->runtime;
884 ymfpci_pcm_t *ypcm; 885 ymfpci_pcm_t *ypcm;
886 snd_kcontrol_t *kctl;
885 int err; 887 int err;
886 888
887 if ((err = snd_ymfpci_playback_open_1(substream)) < 0) 889 if ((err = snd_ymfpci_playback_open_1(substream)) < 0)
@@ -895,6 +897,10 @@ static int snd_ymfpci_playback_open(snd_pcm_substream_t * substream)
895 chip->rear_opened++; 897 chip->rear_opened++;
896 } 898 }
897 spin_unlock_irq(&chip->reg_lock); 899 spin_unlock_irq(&chip->reg_lock);
900
901 kctl = chip->pcm_mixer[substream->number].ctl;
902 kctl->vd[0].access &= ~SNDRV_CTL_ELEM_ACCESS_INACTIVE;
903 snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_INFO, &kctl->id);
898 return 0; 904 return 0;
899} 905}
900 906
@@ -987,6 +993,7 @@ static int snd_ymfpci_playback_close(snd_pcm_substream_t * substream)
987{ 993{
988 ymfpci_t *chip = snd_pcm_substream_chip(substream); 994 ymfpci_t *chip = snd_pcm_substream_chip(substream);
989 ymfpci_pcm_t *ypcm = substream->runtime->private_data; 995 ymfpci_pcm_t *ypcm = substream->runtime->private_data;
996 snd_kcontrol_t *kctl;
990 997
991 spin_lock_irq(&chip->reg_lock); 998 spin_lock_irq(&chip->reg_lock);
992 if (ypcm->output_rear && chip->rear_opened > 0) { 999 if (ypcm->output_rear && chip->rear_opened > 0) {
@@ -994,6 +1001,9 @@ static int snd_ymfpci_playback_close(snd_pcm_substream_t * substream)
994 ymfpci_close_extension(chip); 1001 ymfpci_close_extension(chip);
995 } 1002 }
996 spin_unlock_irq(&chip->reg_lock); 1003 spin_unlock_irq(&chip->reg_lock);
1004 kctl = chip->pcm_mixer[substream->number].ctl;
1005 kctl->vd[0].access |= SNDRV_CTL_ELEM_ACCESS_INACTIVE;
1006 snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_INFO, &kctl->id);
997 return snd_ymfpci_playback_close_1(substream); 1007 return snd_ymfpci_playback_close_1(substream);
998} 1008}
999 1009
@@ -1665,6 +1675,66 @@ static snd_kcontrol_new_t snd_ymfpci_rear_shared __devinitdata = {
1665 .private_value = 2, 1675 .private_value = 2,
1666}; 1676};
1667 1677
1678/*
1679 * PCM voice volume
1680 */
1681
1682static int snd_ymfpci_pcm_vol_info(snd_kcontrol_t *kcontrol,
1683 snd_ctl_elem_info_t *uinfo)
1684{
1685 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
1686 uinfo->count = 2;
1687 uinfo->value.integer.min = 0;
1688 uinfo->value.integer.max = 0x8000;
1689 return 0;
1690}
1691
1692static int snd_ymfpci_pcm_vol_get(snd_kcontrol_t *kcontrol,
1693 snd_ctl_elem_value_t *ucontrol)
1694{
1695 ymfpci_t *chip = snd_kcontrol_chip(kcontrol);
1696 unsigned int subs = kcontrol->id.subdevice;
1697
1698 ucontrol->value.integer.value[0] = chip->pcm_mixer[subs].left;
1699 ucontrol->value.integer.value[1] = chip->pcm_mixer[subs].right;
1700 return 0;
1701}
1702
1703static int snd_ymfpci_pcm_vol_put(snd_kcontrol_t *kcontrol,
1704 snd_ctl_elem_value_t *ucontrol)
1705{
1706 ymfpci_t *chip = snd_kcontrol_chip(kcontrol);
1707 unsigned int subs = kcontrol->id.subdevice;
1708 snd_pcm_substream_t *substream;
1709 unsigned long flags;
1710
1711 if (ucontrol->value.integer.value[0] != chip->pcm_mixer[subs].left ||
1712 ucontrol->value.integer.value[1] != chip->pcm_mixer[subs].right) {
1713 chip->pcm_mixer[subs].left = ucontrol->value.integer.value[0];
1714 chip->pcm_mixer[subs].right = ucontrol->value.integer.value[1];
1715
1716 substream = (snd_pcm_substream_t *)kcontrol->private_value;
1717 spin_lock_irqsave(&chip->voice_lock, flags);
1718 if (substream->runtime && substream->runtime->private_data) {
1719 ymfpci_pcm_t *ypcm = substream->runtime->private_data;
1720 ypcm->update_pcm_vol = 2;
1721 }
1722 spin_unlock_irqrestore(&chip->voice_lock, flags);
1723 return 1;
1724 }
1725 return 0;
1726}
1727
1728static snd_kcontrol_new_t snd_ymfpci_pcm_volume __devinitdata = {
1729 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
1730 .name = "PCM Playback Volume",
1731 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE |
1732 SNDRV_CTL_ELEM_ACCESS_INACTIVE,
1733 .info = snd_ymfpci_pcm_vol_info,
1734 .get = snd_ymfpci_pcm_vol_get,
1735 .put = snd_ymfpci_pcm_vol_put,
1736};
1737
1668 1738
1669/* 1739/*
1670 * Mixer routines 1740 * Mixer routines
@@ -1686,6 +1756,7 @@ int __devinit snd_ymfpci_mixer(ymfpci_t *chip, int rear_switch)
1686{ 1756{
1687 ac97_template_t ac97; 1757 ac97_template_t ac97;
1688 snd_kcontrol_t *kctl; 1758 snd_kcontrol_t *kctl;
1759 snd_pcm_substream_t *substream;
1689 unsigned int idx; 1760 unsigned int idx;
1690 int err; 1761 int err;
1691 static ac97_bus_ops_t ops = { 1762 static ac97_bus_ops_t ops = {
@@ -1739,6 +1810,23 @@ int __devinit snd_ymfpci_mixer(ymfpci_t *chip, int rear_switch)
1739 return err; 1810 return err;
1740 } 1811 }
1741 1812
1813 /* per-voice volume */
1814 substream = chip->pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream;
1815 for (idx = 0; idx < 32; ++idx) {
1816 kctl = snd_ctl_new1(&snd_ymfpci_pcm_volume, chip);
1817 if (!kctl)
1818 return -ENOMEM;
1819 kctl->id.device = chip->pcm->device;
1820 kctl->id.subdevice = idx;
1821 kctl->private_value = (unsigned long)substream;
1822 if ((err = snd_ctl_add(chip->card, kctl)) < 0)
1823 return err;
1824 chip->pcm_mixer[idx].left = 0x8000;
1825 chip->pcm_mixer[idx].right = 0x8000;
1826 chip->pcm_mixer[idx].ctl = kctl;
1827 substream = substream->next;
1828 }
1829
1742 return 0; 1830 return 0;
1743} 1831}
1744 1832