aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
Diffstat (limited to 'sound')
-rw-r--r--sound/Kconfig3
-rw-r--r--sound/arm/aaci.c18
-rw-r--r--sound/arm/pxa2xx-ac97-lib.c28
-rw-r--r--sound/arm/pxa2xx-ac97.c6
-rw-r--r--sound/atmel/abdac.c8
-rw-r--r--sound/atmel/ac97c.c10
-rw-r--r--sound/core/oss/pcm_plugin.c6
-rw-r--r--sound/core/pcm.c3
-rw-r--r--sound/core/pcm_compat.c20
-rw-r--r--sound/core/pcm_lib.c57
-rw-r--r--sound/core/pcm_native.c4
-rw-r--r--sound/core/seq/seq_device.c2
-rw-r--r--sound/drivers/Kconfig2
-rw-r--r--sound/drivers/aloop.c52
-rw-r--r--sound/drivers/dummy.c87
-rw-r--r--sound/drivers/ml403-ac97cr.c10
-rw-r--r--sound/drivers/mpu401/mpu401.c18
-rw-r--r--sound/drivers/mtpav.c14
-rw-r--r--sound/drivers/mts64.c40
-rw-r--r--sound/drivers/pcsp/pcsp.c14
-rw-r--r--sound/drivers/pcsp/pcsp_input.c2
-rw-r--r--sound/drivers/pcsp/pcsp_input.h2
-rw-r--r--sound/drivers/pcsp/pcsp_lib.c2
-rw-r--r--sound/drivers/pcsp/pcsp_mixer.c10
-rw-r--r--sound/drivers/portman2x4.c18
-rw-r--r--sound/drivers/serial-u16550.c32
-rw-r--r--sound/drivers/virmidi.c6
-rw-r--r--sound/drivers/vx/vx_hwdep.c139
-rw-r--r--sound/firewire/Kconfig13
-rw-r--r--sound/firewire/Makefile2
-rw-r--r--sound/firewire/scs1x.c527
-rw-r--r--sound/firewire/speakers.c8
-rw-r--r--sound/isa/Kconfig4
-rw-r--r--sound/isa/ad1816a/ad1816a.c18
-rw-r--r--sound/isa/ad1816a/ad1816a_lib.c19
-rw-r--r--sound/isa/ad1848/ad1848.c8
-rw-r--r--sound/isa/adlib.c8
-rw-r--r--sound/isa/als100.c22
-rw-r--r--sound/isa/azt2320.c26
-rw-r--r--sound/isa/cmi8328.c8
-rw-r--r--sound/isa/cmi8330.c42
-rw-r--r--sound/isa/cs423x/cs4231.c8
-rw-r--r--sound/isa/cs423x/cs4236.c50
-rw-r--r--sound/isa/es1688/es1688.c28
-rw-r--r--sound/isa/es18xx.c80
-rw-r--r--sound/isa/galaxy/galaxy.c26
-rw-r--r--sound/isa/gus/gusclassic.c15
-rw-r--r--sound/isa/gus/gusextreme.c24
-rw-r--r--sound/isa/gus/gusmax.c16
-rw-r--r--sound/isa/gus/interwave.c54
-rw-r--r--sound/isa/msnd/msnd.h2
-rw-r--r--sound/isa/msnd/msnd_pinnacle.c44
-rw-r--r--sound/isa/msnd/msnd_pinnacle_mixer.c2
-rw-r--r--sound/isa/opl3sa2.c40
-rw-r--r--sound/isa/opti9xx/miro.c68
-rw-r--r--sound/isa/opti9xx/opti92x-ad1848.c42
-rw-r--r--sound/isa/sb/emu8000.c30
-rw-r--r--sound/isa/sb/jazz16.c18
-rw-r--r--sound/isa/sb/sb16.c26
-rw-r--r--sound/isa/sb/sb8.c8
-rw-r--r--sound/isa/sc6000.c38
-rw-r--r--sound/isa/sscape.c32
-rw-r--r--sound/isa/wavefront/wavefront.c53
-rw-r--r--sound/isa/wavefront/wavefront_fx.c2
-rw-r--r--sound/isa/wavefront/wavefront_midi.c2
-rw-r--r--sound/isa/wavefront/wavefront_synth.c14
-rw-r--r--sound/mips/au1x00.c4
-rw-r--r--sound/mips/hal2.c14
-rw-r--r--sound/mips/sgio2audio.c28
-rw-r--r--sound/oss/ad1848.c2
-rw-r--r--sound/oss/kahlua.c10
-rw-r--r--sound/oss/pas2_card.c5
-rw-r--r--sound/oss/sb_audio.c3
-rw-r--r--sound/parisc/harmony.c12
-rw-r--r--sound/pci/Kconfig5
-rw-r--r--sound/pci/ad1889.c18
-rw-r--r--sound/pci/ak4531_codec.c10
-rw-r--r--sound/pci/ali5451/ali5451.c32
-rw-r--r--sound/pci/als300.c14
-rw-r--r--sound/pci/als4000.c12
-rw-r--r--sound/pci/asihpi/asihpi.c55
-rw-r--r--sound/pci/asihpi/hpidspcd.c22
-rw-r--r--sound/pci/asihpi/hpioctl.c23
-rw-r--r--sound/pci/asihpi/hpioctl.h6
-rw-r--r--sound/pci/atiixp.c32
-rw-r--r--sound/pci/atiixp_modem.c20
-rw-r--r--sound/pci/au88x0/au88x0.c10
-rw-r--r--sound/pci/au88x0/au88x0_a3d.c6
-rw-r--r--sound/pci/au88x0/au88x0_core.c9
-rw-r--r--sound/pci/au88x0/au88x0_eq.c10
-rw-r--r--sound/pci/au88x0/au88x0_game.c2
-rw-r--r--sound/pci/au88x0/au88x0_mixer.c2
-rw-r--r--sound/pci/au88x0/au88x0_mpu401.c2
-rw-r--r--sound/pci/au88x0/au88x0_pcm.c6
-rw-r--r--sound/pci/au88x0/au88x0_synth.c2
-rw-r--r--sound/pci/aw2/aw2-alsa.c28
-rw-r--r--sound/pci/azt3328.c22
-rw-r--r--sound/pci/bt87x.c22
-rw-r--r--sound/pci/ca0106/ca0106_main.c12
-rw-r--r--sound/pci/ca0106/ca0106_mixer.c26
-rw-r--r--sound/pci/ca0106/ca0106_proc.c2
-rw-r--r--sound/pci/ca0106/ca_midi.c2
-rw-r--r--sound/pci/cmipci.c48
-rw-r--r--sound/pci/cs4281.c30
-rw-r--r--sound/pci/cs46xx/cs46xx.c8
-rw-r--r--sound/pci/cs46xx/cs46xx_lib.c35
-rw-r--r--sound/pci/cs5530.c16
-rw-r--r--sound/pci/cs5535audio/cs5535audio.c18
-rw-r--r--sound/pci/cs5535audio/cs5535audio.h10
-rw-r--r--sound/pci/cs5535audio/cs5535audio_olpc.c10
-rw-r--r--sound/pci/cs5535audio/cs5535audio_pcm.c2
-rw-r--r--sound/pci/ctxfi/ctatc.c20
-rw-r--r--sound/pci/ctxfi/ctatc.h8
-rw-r--r--sound/pci/ctxfi/cthardware.c4
-rw-r--r--sound/pci/ctxfi/cthw20k1.c4
-rw-r--r--sound/pci/ctxfi/cthw20k2.c4
-rw-r--r--sound/pci/ctxfi/xfi.c6
-rw-r--r--sound/pci/echoaudio/echoaudio.c46
-rw-r--r--sound/pci/echoaudio/echoaudio.h4
-rw-r--r--sound/pci/echoaudio/midi.c4
-rw-r--r--sound/pci/emu10k1/emu10k1.c12
-rw-r--r--sound/pci/emu10k1/emu10k1_main.c96
-rw-r--r--sound/pci/emu10k1/emu10k1_patch.c2
-rw-r--r--sound/pci/emu10k1/emu10k1x.c29
-rw-r--r--sound/pci/emu10k1/emufx.c25
-rw-r--r--sound/pci/emu10k1/emumixer.c22
-rw-r--r--sound/pci/emu10k1/emumpu401.c6
-rw-r--r--sound/pci/emu10k1/emupcm.c11
-rw-r--r--sound/pci/emu10k1/emuproc.c2
-rw-r--r--sound/pci/emu10k1/p16v.c8
-rw-r--r--sound/pci/emu10k1/timer.c2
-rw-r--r--sound/pci/ens1370.c52
-rw-r--r--sound/pci/es1938.c20
-rw-r--r--sound/pci/es1968.c44
-rw-r--r--sound/pci/fm801.c26
-rw-r--r--sound/pci/hda/Kconfig5
-rw-r--r--sound/pci/hda/Makefile1
-rw-r--r--sound/pci/hda/hda_auto_parser.c106
-rw-r--r--sound/pci/hda/hda_codec.c216
-rw-r--r--sound/pci/hda/hda_codec.h6
-rw-r--r--sound/pci/hda/hda_hwdep.c2
-rw-r--r--sound/pci/hda/hda_intel.c435
-rw-r--r--sound/pci/hda/hda_intel_trace.h62
-rw-r--r--sound/pci/hda/hda_jack.c93
-rw-r--r--sound/pci/hda/hda_jack.h6
-rw-r--r--sound/pci/hda/hda_local.h17
-rw-r--r--sound/pci/hda/patch_analog.c73
-rw-r--r--sound/pci/hda/patch_cirrus.c47
-rw-r--r--sound/pci/hda/patch_conexant.c99
-rw-r--r--sound/pci/hda/patch_hdmi.c68
-rw-r--r--sound/pci/hda/patch_realtek.c227
-rw-r--r--sound/pci/hda/patch_sigmatel.c152
-rw-r--r--sound/pci/hda/patch_via.c186
-rw-r--r--sound/pci/ice1712/Makefile2
-rw-r--r--sound/pci/ice1712/amp.c7
-rw-r--r--sound/pci/ice1712/aureon.c28
-rw-r--r--sound/pci/ice1712/delta.c45
-rw-r--r--sound/pci/ice1712/ews.c33
-rw-r--r--sound/pci/ice1712/hoontech.c27
-rw-r--r--sound/pci/ice1712/ice1712.c103
-rw-r--r--sound/pci/ice1712/ice1712.h12
-rw-r--r--sound/pci/ice1712/ice1724.c85
-rw-r--r--sound/pci/ice1712/juli.c26
-rw-r--r--sound/pci/ice1712/maya44.c21
-rw-r--r--sound/pci/ice1712/phase.c25
-rw-r--r--sound/pci/ice1712/pontis.c11
-rw-r--r--sound/pci/ice1712/prodigy192.c17
-rw-r--r--sound/pci/ice1712/prodigy_hifi.c21
-rw-r--r--sound/pci/ice1712/psc724.c464
-rw-r--r--sound/pci/ice1712/psc724.h13
-rw-r--r--sound/pci/ice1712/quartet.c32
-rw-r--r--sound/pci/ice1712/revo.c29
-rw-r--r--sound/pci/ice1712/se.c31
-rw-r--r--sound/pci/ice1712/vt1720_mobo.c11
-rw-r--r--sound/pci/ice1712/wm8766.c361
-rw-r--r--sound/pci/ice1712/wm8766.h163
-rw-r--r--sound/pci/ice1712/wm8776.c633
-rw-r--r--sound/pci/ice1712/wm8776.h226
-rw-r--r--sound/pci/ice1712/wtm.c11
-rw-r--r--sound/pci/intel8x0.c56
-rw-r--r--sound/pci/intel8x0m.c30
-rw-r--r--sound/pci/korg1212/korg1212.c12
-rw-r--r--sound/pci/lola/lola.c14
-rw-r--r--sound/pci/lola/lola_clock.c2
-rw-r--r--sound/pci/lola/lola_mixer.c32
-rw-r--r--sound/pci/lola/lola_pcm.c4
-rw-r--r--sound/pci/lola/lola_proc.c2
-rw-r--r--sound/pci/lx6464es/lx6464es.c30
-rw-r--r--sound/pci/lx6464es/lx_core.c2
-rw-r--r--sound/pci/lx6464es/lx_core.h2
-rw-r--r--sound/pci/maestro3.c24
-rw-r--r--sound/pci/mixart/mixart.c12
-rw-r--r--sound/pci/mixart/mixart_hwdep.c76
-rw-r--r--sound/pci/nm256/nm256.c18
-rw-r--r--sound/pci/oxygen/oxygen.c10
-rw-r--r--sound/pci/oxygen/virtuoso.c11
-rw-r--r--sound/pci/oxygen/xonar_cs43xx.c4
-rw-r--r--sound/pci/oxygen/xonar_pcm179x.c4
-rw-r--r--sound/pci/oxygen/xonar_wm87x6.c10
-rw-r--r--sound/pci/pcxhr/pcxhr.c14
-rw-r--r--sound/pci/pcxhr/pcxhr_hwdep.c86
-rw-r--r--sound/pci/riptide/riptide.c20
-rw-r--r--sound/pci/rme32.c10
-rw-r--r--sound/pci/rme96.c14
-rw-r--r--sound/pci/rme9652/hdsp.c77
-rw-r--r--sound/pci/rme9652/hdspm.c439
-rw-r--r--sound/pci/rme9652/rme9652.c22
-rw-r--r--sound/pci/sis7019.c18
-rw-r--r--sound/pci/sonicvibes.c37
-rw-r--r--sound/pci/trident/trident.c8
-rw-r--r--sound/pci/trident/trident_main.c46
-rw-r--r--sound/pci/via82xx.c50
-rw-r--r--sound/pci/via82xx_modem.c26
-rw-r--r--sound/pci/vx222/vx222.c14
-rw-r--r--sound/pci/ymfpci/ymfpci.c12
-rw-r--r--sound/pci/ymfpci/ymfpci_main.c50
-rw-r--r--sound/ppc/awacs.c54
-rw-r--r--sound/ppc/beep.c2
-rw-r--r--sound/ppc/burgundy.c22
-rw-r--r--sound/ppc/daca.c2
-rw-r--r--sound/ppc/keywest.c4
-rw-r--r--sound/ppc/pmac.c12
-rw-r--r--sound/ppc/powermac.c6
-rw-r--r--sound/ppc/snd_ps3.c12
-rw-r--r--sound/ppc/tumbler.c16
-rw-r--r--sound/sh/aica.c13
-rw-r--r--sound/sh/sh_dac_audio.c10
-rw-r--r--sound/soc/codecs/arizona.c9
-rw-r--r--sound/soc/codecs/arizona.h18
-rw-r--r--sound/soc/codecs/cs4271.c6
-rw-r--r--sound/soc/codecs/cs42l52.c4
-rw-r--r--sound/soc/codecs/lm49453.c106
-rw-r--r--sound/soc/codecs/sgtl5000.c4
-rw-r--r--sound/soc/codecs/wm5102.c48
-rw-r--r--sound/soc/fsl/imx-pcm-fiq.c1
-rw-r--r--sound/soc/fsl/imx-ssi.c1
-rw-r--r--sound/soc/omap/am3517evm.c2
-rw-r--r--sound/soc/omap/n810.c1
-rw-r--r--sound/soc/omap/omap-pcm.c9
-rw-r--r--sound/soc/omap/osk5912.c1
-rw-r--r--sound/soc/omap/sdp3430.c2
-rw-r--r--sound/soc/soc-core.c35
-rw-r--r--sound/soc/soc-pcm.c1
-rw-r--r--sound/soc/tegra/tegra30_ahub.c1
-rw-r--r--sound/soc/tegra/tegra_pcm.h2
-rw-r--r--sound/soc/ux500/ux500_pcm.c3
-rw-r--r--sound/sound_core.c3
-rw-r--r--sound/sparc/amd7930.c16
-rw-r--r--sound/sparc/cs4231.c38
-rw-r--r--sound/sparc/dbri.c28
-rw-r--r--sound/spi/at73c213.c20
-rw-r--r--sound/usb/6fire/chip.c4
-rw-r--r--sound/usb/6fire/comm.c5
-rw-r--r--sound/usb/6fire/comm.h2
-rw-r--r--sound/usb/6fire/control.c8
-rw-r--r--sound/usb/6fire/control.h2
-rw-r--r--sound/usb/6fire/firmware.h2
-rw-r--r--sound/usb/6fire/midi.c2
-rw-r--r--sound/usb/6fire/midi.h2
-rw-r--r--sound/usb/6fire/pcm.c11
-rw-r--r--sound/usb/6fire/pcm.h2
-rw-r--r--sound/usb/Kconfig2
-rw-r--r--sound/usb/caiaq/control.c8
-rw-r--r--sound/usb/caiaq/device.c6
-rw-r--r--sound/usb/card.c7
-rw-r--r--sound/usb/card.h2
-rw-r--r--sound/usb/endpoint.c53
-rw-r--r--sound/usb/endpoint.h5
-rw-r--r--sound/usb/format.c10
-rw-r--r--sound/usb/midi.c91
-rw-r--r--sound/usb/mixer.c74
-rw-r--r--sound/usb/mixer.h1
-rw-r--r--sound/usb/mixer_quirks.c223
-rw-r--r--sound/usb/pcm.c175
-rw-r--r--sound/usb/quirks-table.h343
-rw-r--r--sound/usb/quirks.c93
-rw-r--r--sound/usb/stream.c230
-rw-r--r--sound/usb/usbaudio.h1
278 files changed, 7134 insertions, 3442 deletions
diff --git a/sound/Kconfig b/sound/Kconfig
index 261a03c8a209..c710ce2c5c37 100644
--- a/sound/Kconfig
+++ b/sound/Kconfig
@@ -52,9 +52,6 @@ config SOUND_OSS_CORE_PRECLAIM
52 52
53 Disabling this allows alternative OSS implementations. 53 Disabling this allows alternative OSS implementations.
54 54
55 Please read Documentation/feature-removal-schedule.txt for
56 details.
57
58 If unsure, say Y. 55 If unsure, say Y.
59 56
60source "sound/oss/dmasound/Kconfig" 57source "sound/oss/dmasound/Kconfig"
diff --git a/sound/arm/aaci.c b/sound/arm/aaci.c
index 5119fdabcb98..aa5d8034890b 100644
--- a/sound/arm/aaci.c
+++ b/sound/arm/aaci.c
@@ -786,7 +786,7 @@ static int aaci_resume(struct amba_device *dev)
786#endif 786#endif
787 787
788 788
789static struct ac97_pcm ac97_defs[] __devinitdata = { 789static struct ac97_pcm ac97_defs[] = {
790 [0] = { /* Front PCM */ 790 [0] = { /* Front PCM */
791 .exclusive = 1, 791 .exclusive = 1,
792 .r = { 792 .r = {
@@ -832,7 +832,7 @@ static struct snd_ac97_bus_ops aaci_bus_ops = {
832 .read = aaci_ac97_read, 832 .read = aaci_ac97_read,
833}; 833};
834 834
835static int __devinit aaci_probe_ac97(struct aaci *aaci) 835static int aaci_probe_ac97(struct aaci *aaci)
836{ 836{
837 struct snd_ac97_template ac97_template; 837 struct snd_ac97_template ac97_template;
838 struct snd_ac97_bus *ac97_bus; 838 struct snd_ac97_bus *ac97_bus;
@@ -893,7 +893,7 @@ static void aaci_free_card(struct snd_card *card)
893 iounmap(aaci->base); 893 iounmap(aaci->base);
894} 894}
895 895
896static struct aaci * __devinit aaci_init_card(struct amba_device *dev) 896static struct aaci *aaci_init_card(struct amba_device *dev)
897{ 897{
898 struct aaci *aaci; 898 struct aaci *aaci;
899 struct snd_card *card; 899 struct snd_card *card;
@@ -926,7 +926,7 @@ static struct aaci * __devinit aaci_init_card(struct amba_device *dev)
926 return aaci; 926 return aaci;
927} 927}
928 928
929static int __devinit aaci_init_pcm(struct aaci *aaci) 929static int aaci_init_pcm(struct aaci *aaci)
930{ 930{
931 struct snd_pcm *pcm; 931 struct snd_pcm *pcm;
932 int ret; 932 int ret;
@@ -948,7 +948,7 @@ static int __devinit aaci_init_pcm(struct aaci *aaci)
948 return ret; 948 return ret;
949} 949}
950 950
951static unsigned int __devinit aaci_size_fifo(struct aaci *aaci) 951static unsigned int aaci_size_fifo(struct aaci *aaci)
952{ 952{
953 struct aaci_runtime *aacirun = &aaci->playback; 953 struct aaci_runtime *aacirun = &aaci->playback;
954 int i; 954 int i;
@@ -984,8 +984,8 @@ static unsigned int __devinit aaci_size_fifo(struct aaci *aaci)
984 return i; 984 return i;
985} 985}
986 986
987static int __devinit aaci_probe(struct amba_device *dev, 987static int aaci_probe(struct amba_device *dev,
988 const struct amba_id *id) 988 const struct amba_id *id)
989{ 989{
990 struct aaci *aaci; 990 struct aaci *aaci;
991 int ret, i; 991 int ret, i;
@@ -1072,7 +1072,7 @@ static int __devinit aaci_probe(struct amba_device *dev,
1072 return ret; 1072 return ret;
1073} 1073}
1074 1074
1075static int __devexit aaci_remove(struct amba_device *dev) 1075static int aaci_remove(struct amba_device *dev)
1076{ 1076{
1077 struct snd_card *card = amba_get_drvdata(dev); 1077 struct snd_card *card = amba_get_drvdata(dev);
1078 1078
@@ -1104,7 +1104,7 @@ static struct amba_driver aaci_driver = {
1104 .name = DRIVER_NAME, 1104 .name = DRIVER_NAME,
1105 }, 1105 },
1106 .probe = aaci_probe, 1106 .probe = aaci_probe,
1107 .remove = __devexit_p(aaci_remove), 1107 .remove = aaci_remove,
1108 .suspend = aaci_suspend, 1108 .suspend = aaci_suspend,
1109 .resume = aaci_resume, 1109 .resume = aaci_resume,
1110 .id_table = aaci_ids, 1110 .id_table = aaci_ids,
diff --git a/sound/arm/pxa2xx-ac97-lib.c b/sound/arm/pxa2xx-ac97-lib.c
index 48d7c0aa5073..fff7753e35c1 100644
--- a/sound/arm/pxa2xx-ac97-lib.c
+++ b/sound/arm/pxa2xx-ac97-lib.c
@@ -18,6 +18,7 @@
18#include <linux/delay.h> 18#include <linux/delay.h>
19#include <linux/module.h> 19#include <linux/module.h>
20#include <linux/io.h> 20#include <linux/io.h>
21#include <linux/gpio.h>
21 22
22#include <sound/ac97_codec.h> 23#include <sound/ac97_codec.h>
23#include <sound/pxa2xx-lib.h> 24#include <sound/pxa2xx-lib.h>
@@ -148,6 +149,8 @@ static inline void pxa_ac97_warm_pxa27x(void)
148 149
149static inline void pxa_ac97_cold_pxa27x(void) 150static inline void pxa_ac97_cold_pxa27x(void)
150{ 151{
152 unsigned int timeout;
153
151 GCR &= GCR_COLD_RST; /* clear everything but nCRST */ 154 GCR &= GCR_COLD_RST; /* clear everything but nCRST */
152 GCR &= ~GCR_COLD_RST; /* then assert nCRST */ 155 GCR &= ~GCR_COLD_RST; /* then assert nCRST */
153 156
@@ -157,8 +160,10 @@ static inline void pxa_ac97_cold_pxa27x(void)
157 clk_enable(ac97conf_clk); 160 clk_enable(ac97conf_clk);
158 udelay(5); 161 udelay(5);
159 clk_disable(ac97conf_clk); 162 clk_disable(ac97conf_clk);
160 GCR = GCR_COLD_RST; 163 GCR = GCR_COLD_RST | GCR_WARM_RST;
161 udelay(50); 164 timeout = 100; /* wait for the codec-ready bit to be set */
165 while (!((GSR | gsr_bits) & (GSR_PCR | GSR_SCR)) && timeout--)
166 mdelay(1);
162} 167}
163#endif 168#endif
164 169
@@ -314,7 +319,7 @@ int pxa2xx_ac97_hw_resume(void)
314EXPORT_SYMBOL_GPL(pxa2xx_ac97_hw_resume); 319EXPORT_SYMBOL_GPL(pxa2xx_ac97_hw_resume);
315#endif 320#endif
316 321
317int __devinit pxa2xx_ac97_hw_probe(struct platform_device *dev) 322int pxa2xx_ac97_hw_probe(struct platform_device *dev)
318{ 323{
319 int ret; 324 int ret;
320 pxa2xx_audio_ops_t *pdata = dev->dev.platform_data; 325 pxa2xx_audio_ops_t *pdata = dev->dev.platform_data;
@@ -340,8 +345,21 @@ int __devinit pxa2xx_ac97_hw_probe(struct platform_device *dev)
340 } 345 }
341 346
342 if (cpu_is_pxa27x()) { 347 if (cpu_is_pxa27x()) {
343 /* Use GPIO 113 as AC97 Reset on Bulverde */ 348 /*
349 * This gpio is needed for a work-around to a bug in the ac97
350 * controller during warm reset. The direction and level is set
351 * here so that it is an output driven high when switching from
352 * AC97_nRESET alt function to generic gpio.
353 */
354 ret = gpio_request_one(reset_gpio, GPIOF_OUT_INIT_HIGH,
355 "pxa27x ac97 reset");
356 if (ret < 0) {
357 pr_err("%s: gpio_request_one() failed: %d\n",
358 __func__, ret);
359 goto err_conf;
360 }
344 pxa27x_assert_ac97reset(reset_gpio, 0); 361 pxa27x_assert_ac97reset(reset_gpio, 0);
362
345 ac97conf_clk = clk_get(&dev->dev, "AC97CONFCLK"); 363 ac97conf_clk = clk_get(&dev->dev, "AC97CONFCLK");
346 if (IS_ERR(ac97conf_clk)) { 364 if (IS_ERR(ac97conf_clk)) {
347 ret = PTR_ERR(ac97conf_clk); 365 ret = PTR_ERR(ac97conf_clk);
@@ -384,6 +402,8 @@ EXPORT_SYMBOL_GPL(pxa2xx_ac97_hw_probe);
384 402
385void pxa2xx_ac97_hw_remove(struct platform_device *dev) 403void pxa2xx_ac97_hw_remove(struct platform_device *dev)
386{ 404{
405 if (cpu_is_pxa27x())
406 gpio_free(reset_gpio);
387 GCR |= GCR_ACLINK_OFF; 407 GCR |= GCR_ACLINK_OFF;
388 free_irq(IRQ_AC97, NULL); 408 free_irq(IRQ_AC97, NULL);
389 if (ac97conf_clk) { 409 if (ac97conf_clk) {
diff --git a/sound/arm/pxa2xx-ac97.c b/sound/arm/pxa2xx-ac97.c
index 4e1fda75c1c9..ec54be4efff0 100644
--- a/sound/arm/pxa2xx-ac97.c
+++ b/sound/arm/pxa2xx-ac97.c
@@ -163,7 +163,7 @@ static int pxa2xx_ac97_resume(struct device *dev)
163static SIMPLE_DEV_PM_OPS(pxa2xx_ac97_pm_ops, pxa2xx_ac97_suspend, pxa2xx_ac97_resume); 163static SIMPLE_DEV_PM_OPS(pxa2xx_ac97_pm_ops, pxa2xx_ac97_suspend, pxa2xx_ac97_resume);
164#endif 164#endif
165 165
166static int __devinit pxa2xx_ac97_probe(struct platform_device *dev) 166static int pxa2xx_ac97_probe(struct platform_device *dev)
167{ 167{
168 struct snd_card *card; 168 struct snd_card *card;
169 struct snd_ac97_bus *ac97_bus; 169 struct snd_ac97_bus *ac97_bus;
@@ -224,7 +224,7 @@ err_dev:
224 return ret; 224 return ret;
225} 225}
226 226
227static int __devexit pxa2xx_ac97_remove(struct platform_device *dev) 227static int pxa2xx_ac97_remove(struct platform_device *dev)
228{ 228{
229 struct snd_card *card = platform_get_drvdata(dev); 229 struct snd_card *card = platform_get_drvdata(dev);
230 230
@@ -239,7 +239,7 @@ static int __devexit pxa2xx_ac97_remove(struct platform_device *dev)
239 239
240static struct platform_driver pxa2xx_ac97_driver = { 240static struct platform_driver pxa2xx_ac97_driver = {
241 .probe = pxa2xx_ac97_probe, 241 .probe = pxa2xx_ac97_probe,
242 .remove = __devexit_p(pxa2xx_ac97_remove), 242 .remove = pxa2xx_ac97_remove,
243 .driver = { 243 .driver = {
244 .name = "pxa2xx-ac97", 244 .name = "pxa2xx-ac97",
245 .owner = THIS_MODULE, 245 .owner = THIS_MODULE,
diff --git a/sound/atmel/abdac.c b/sound/atmel/abdac.c
index 277ebce23a45..071ce1b5f2b4 100644
--- a/sound/atmel/abdac.c
+++ b/sound/atmel/abdac.c
@@ -309,7 +309,7 @@ static struct snd_pcm_ops atmel_abdac_ops = {
309 .pointer = atmel_abdac_pointer, 309 .pointer = atmel_abdac_pointer,
310}; 310};
311 311
312static int __devinit atmel_abdac_pcm_new(struct atmel_abdac *dac) 312static int atmel_abdac_pcm_new(struct atmel_abdac *dac)
313{ 313{
314 struct snd_pcm_hardware hw = atmel_abdac_hw; 314 struct snd_pcm_hardware hw = atmel_abdac_hw;
315 struct snd_pcm *pcm; 315 struct snd_pcm *pcm;
@@ -386,7 +386,7 @@ static int set_sample_rates(struct atmel_abdac *dac)
386 return retval; 386 return retval;
387} 387}
388 388
389static int __devinit atmel_abdac_probe(struct platform_device *pdev) 389static int atmel_abdac_probe(struct platform_device *pdev)
390{ 390{
391 struct snd_card *card; 391 struct snd_card *card;
392 struct atmel_abdac *dac; 392 struct atmel_abdac *dac;
@@ -567,7 +567,7 @@ static SIMPLE_DEV_PM_OPS(atmel_abdac_pm, atmel_abdac_suspend, atmel_abdac_resume
567#define ATMEL_ABDAC_PM_OPS NULL 567#define ATMEL_ABDAC_PM_OPS NULL
568#endif 568#endif
569 569
570static int __devexit atmel_abdac_remove(struct platform_device *pdev) 570static int atmel_abdac_remove(struct platform_device *pdev)
571{ 571{
572 struct snd_card *card = platform_get_drvdata(pdev); 572 struct snd_card *card = platform_get_drvdata(pdev);
573 struct atmel_abdac *dac = get_dac(card); 573 struct atmel_abdac *dac = get_dac(card);
@@ -589,7 +589,7 @@ static int __devexit atmel_abdac_remove(struct platform_device *pdev)
589} 589}
590 590
591static struct platform_driver atmel_abdac_driver = { 591static struct platform_driver atmel_abdac_driver = {
592 .remove = __devexit_p(atmel_abdac_remove), 592 .remove = atmel_abdac_remove,
593 .driver = { 593 .driver = {
594 .name = "atmel_abdac", 594 .name = "atmel_abdac",
595 .owner = THIS_MODULE, 595 .owner = THIS_MODULE,
diff --git a/sound/atmel/ac97c.c b/sound/atmel/ac97c.c
index 9052aff37f64..79d6bda58753 100644
--- a/sound/atmel/ac97c.c
+++ b/sound/atmel/ac97c.c
@@ -728,7 +728,7 @@ static irqreturn_t atmel_ac97c_interrupt(int irq, void *dev)
728 return retval; 728 return retval;
729} 729}
730 730
731static struct ac97_pcm at91_ac97_pcm_defs[] __devinitdata = { 731static struct ac97_pcm at91_ac97_pcm_defs[] = {
732 /* Playback */ 732 /* Playback */
733 { 733 {
734 .exclusive = 1, 734 .exclusive = 1,
@@ -756,7 +756,7 @@ static struct ac97_pcm at91_ac97_pcm_defs[] __devinitdata = {
756 }, 756 },
757}; 757};
758 758
759static int __devinit atmel_ac97c_pcm_new(struct atmel_ac97c *chip) 759static int atmel_ac97c_pcm_new(struct atmel_ac97c *chip)
760{ 760{
761 struct snd_pcm *pcm; 761 struct snd_pcm *pcm;
762 struct snd_pcm_hardware hw = atmel_ac97c_hw; 762 struct snd_pcm_hardware hw = atmel_ac97c_hw;
@@ -902,7 +902,7 @@ static void atmel_ac97c_reset(struct atmel_ac97c *chip)
902 } 902 }
903} 903}
904 904
905static int __devinit atmel_ac97c_probe(struct platform_device *pdev) 905static int atmel_ac97c_probe(struct platform_device *pdev)
906{ 906{
907 struct snd_card *card; 907 struct snd_card *card;
908 struct atmel_ac97c *chip; 908 struct atmel_ac97c *chip;
@@ -1168,7 +1168,7 @@ static SIMPLE_DEV_PM_OPS(atmel_ac97c_pm, atmel_ac97c_suspend, atmel_ac97c_resume
1168#define ATMEL_AC97C_PM_OPS NULL 1168#define ATMEL_AC97C_PM_OPS NULL
1169#endif 1169#endif
1170 1170
1171static int __devexit atmel_ac97c_remove(struct platform_device *pdev) 1171static int atmel_ac97c_remove(struct platform_device *pdev)
1172{ 1172{
1173 struct snd_card *card = platform_get_drvdata(pdev); 1173 struct snd_card *card = platform_get_drvdata(pdev);
1174 struct atmel_ac97c *chip = get_chip(card); 1174 struct atmel_ac97c *chip = get_chip(card);
@@ -1205,7 +1205,7 @@ static int __devexit atmel_ac97c_remove(struct platform_device *pdev)
1205} 1205}
1206 1206
1207static struct platform_driver atmel_ac97c_driver = { 1207static struct platform_driver atmel_ac97c_driver = {
1208 .remove = __devexit_p(atmel_ac97c_remove), 1208 .remove = atmel_ac97c_remove,
1209 .driver = { 1209 .driver = {
1210 .name = "atmel_ac97c", 1210 .name = "atmel_ac97c",
1211 .owner = THIS_MODULE, 1211 .owner = THIS_MODULE,
diff --git a/sound/core/oss/pcm_plugin.c b/sound/core/oss/pcm_plugin.c
index 71cc3ddf5c15..727ac44d39f4 100644
--- a/sound/core/oss/pcm_plugin.c
+++ b/sound/core/oss/pcm_plugin.c
@@ -199,12 +199,13 @@ int snd_pcm_plugin_free(struct snd_pcm_plugin *plugin)
199snd_pcm_sframes_t snd_pcm_plug_client_size(struct snd_pcm_substream *plug, snd_pcm_uframes_t drv_frames) 199snd_pcm_sframes_t snd_pcm_plug_client_size(struct snd_pcm_substream *plug, snd_pcm_uframes_t drv_frames)
200{ 200{
201 struct snd_pcm_plugin *plugin, *plugin_prev, *plugin_next; 201 struct snd_pcm_plugin *plugin, *plugin_prev, *plugin_next;
202 int stream = snd_pcm_plug_stream(plug); 202 int stream;
203 203
204 if (snd_BUG_ON(!plug)) 204 if (snd_BUG_ON(!plug))
205 return -ENXIO; 205 return -ENXIO;
206 if (drv_frames == 0) 206 if (drv_frames == 0)
207 return 0; 207 return 0;
208 stream = snd_pcm_plug_stream(plug);
208 if (stream == SNDRV_PCM_STREAM_PLAYBACK) { 209 if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
209 plugin = snd_pcm_plug_last(plug); 210 plugin = snd_pcm_plug_last(plug);
210 while (plugin && drv_frames > 0) { 211 while (plugin && drv_frames > 0) {
@@ -230,13 +231,14 @@ snd_pcm_sframes_t snd_pcm_plug_slave_size(struct snd_pcm_substream *plug, snd_pc
230{ 231{
231 struct snd_pcm_plugin *plugin, *plugin_prev, *plugin_next; 232 struct snd_pcm_plugin *plugin, *plugin_prev, *plugin_next;
232 snd_pcm_sframes_t frames; 233 snd_pcm_sframes_t frames;
233 int stream = snd_pcm_plug_stream(plug); 234 int stream;
234 235
235 if (snd_BUG_ON(!plug)) 236 if (snd_BUG_ON(!plug))
236 return -ENXIO; 237 return -ENXIO;
237 if (clt_frames == 0) 238 if (clt_frames == 0)
238 return 0; 239 return 0;
239 frames = clt_frames; 240 frames = clt_frames;
241 stream = snd_pcm_plug_stream(plug);
240 if (stream == SNDRV_PCM_STREAM_PLAYBACK) { 242 if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
241 plugin = snd_pcm_plug_first(plug); 243 plugin = snd_pcm_plug_first(plug);
242 while (plugin && frames > 0) { 244 while (plugin && frames > 0) {
diff --git a/sound/core/pcm.c b/sound/core/pcm.c
index 030102caeee9..61798f85d030 100644
--- a/sound/core/pcm.c
+++ b/sound/core/pcm.c
@@ -981,8 +981,7 @@ void snd_pcm_detach_substream(struct snd_pcm_substream *substream)
981 PAGE_ALIGN(sizeof(struct snd_pcm_mmap_control))); 981 PAGE_ALIGN(sizeof(struct snd_pcm_mmap_control)));
982 kfree(runtime->hw_constraints.rules); 982 kfree(runtime->hw_constraints.rules);
983#ifdef CONFIG_SND_PCM_XRUN_DEBUG 983#ifdef CONFIG_SND_PCM_XRUN_DEBUG
984 if (runtime->hwptr_log) 984 kfree(runtime->hwptr_log);
985 kfree(runtime->hwptr_log);
986#endif 985#endif
987 kfree(runtime); 986 kfree(runtime);
988 substream->runtime = NULL; 987 substream->runtime = NULL;
diff --git a/sound/core/pcm_compat.c b/sound/core/pcm_compat.c
index 91cdf9435fec..af49721ba0e3 100644
--- a/sound/core/pcm_compat.c
+++ b/sound/core/pcm_compat.c
@@ -190,7 +190,9 @@ struct snd_pcm_status32 {
190 u32 avail_max; 190 u32 avail_max;
191 u32 overrange; 191 u32 overrange;
192 s32 suspended_state; 192 s32 suspended_state;
193 unsigned char reserved[60]; 193 u32 reserved_alignment;
194 struct compat_timespec audio_tstamp;
195 unsigned char reserved[56-sizeof(struct compat_timespec)];
194} __attribute__((packed)); 196} __attribute__((packed));
195 197
196 198
@@ -205,17 +207,16 @@ static int snd_pcm_status_user_compat(struct snd_pcm_substream *substream,
205 return err; 207 return err;
206 208
207 if (put_user(status.state, &src->state) || 209 if (put_user(status.state, &src->state) ||
208 put_user(status.trigger_tstamp.tv_sec, &src->trigger_tstamp.tv_sec) || 210 compat_put_timespec(&status.trigger_tstamp, &src->trigger_tstamp) ||
209 put_user(status.trigger_tstamp.tv_nsec, &src->trigger_tstamp.tv_nsec) || 211 compat_put_timespec(&status.tstamp, &src->tstamp) ||
210 put_user(status.tstamp.tv_sec, &src->tstamp.tv_sec) ||
211 put_user(status.tstamp.tv_nsec, &src->tstamp.tv_nsec) ||
212 put_user(status.appl_ptr, &src->appl_ptr) || 212 put_user(status.appl_ptr, &src->appl_ptr) ||
213 put_user(status.hw_ptr, &src->hw_ptr) || 213 put_user(status.hw_ptr, &src->hw_ptr) ||
214 put_user(status.delay, &src->delay) || 214 put_user(status.delay, &src->delay) ||
215 put_user(status.avail, &src->avail) || 215 put_user(status.avail, &src->avail) ||
216 put_user(status.avail_max, &src->avail_max) || 216 put_user(status.avail_max, &src->avail_max) ||
217 put_user(status.overrange, &src->overrange) || 217 put_user(status.overrange, &src->overrange) ||
218 put_user(status.suspended_state, &src->suspended_state)) 218 put_user(status.suspended_state, &src->suspended_state) ||
219 compat_put_timespec(&status.audio_tstamp, &src->audio_tstamp))
219 return -EFAULT; 220 return -EFAULT;
220 221
221 return err; 222 return err;
@@ -364,6 +365,7 @@ struct snd_pcm_mmap_status32 {
364 u32 hw_ptr; 365 u32 hw_ptr;
365 struct compat_timespec tstamp; 366 struct compat_timespec tstamp;
366 s32 suspended_state; 367 s32 suspended_state;
368 struct compat_timespec audio_tstamp;
367} __attribute__((packed)); 369} __attribute__((packed));
368 370
369struct snd_pcm_mmap_control32 { 371struct snd_pcm_mmap_control32 {
@@ -426,12 +428,14 @@ static int snd_pcm_ioctl_sync_ptr_compat(struct snd_pcm_substream *substream,
426 sstatus.hw_ptr = status->hw_ptr % boundary; 428 sstatus.hw_ptr = status->hw_ptr % boundary;
427 sstatus.tstamp = status->tstamp; 429 sstatus.tstamp = status->tstamp;
428 sstatus.suspended_state = status->suspended_state; 430 sstatus.suspended_state = status->suspended_state;
431 sstatus.audio_tstamp = status->audio_tstamp;
429 snd_pcm_stream_unlock_irq(substream); 432 snd_pcm_stream_unlock_irq(substream);
430 if (put_user(sstatus.state, &src->s.status.state) || 433 if (put_user(sstatus.state, &src->s.status.state) ||
431 put_user(sstatus.hw_ptr, &src->s.status.hw_ptr) || 434 put_user(sstatus.hw_ptr, &src->s.status.hw_ptr) ||
432 put_user(sstatus.tstamp.tv_sec, &src->s.status.tstamp.tv_sec) || 435 compat_put_timespec(&sstatus.tstamp, &src->s.status.tstamp) ||
433 put_user(sstatus.tstamp.tv_nsec, &src->s.status.tstamp.tv_nsec) ||
434 put_user(sstatus.suspended_state, &src->s.status.suspended_state) || 436 put_user(sstatus.suspended_state, &src->s.status.suspended_state) ||
437 compat_put_timespec(&sstatus.audio_tstamp,
438 &src->s.status.audio_tstamp) ||
435 put_user(scontrol.appl_ptr, &src->c.control.appl_ptr) || 439 put_user(scontrol.appl_ptr, &src->c.control.appl_ptr) ||
436 put_user(scontrol.avail_min, &src->c.control.avail_min)) 440 put_user(scontrol.avail_min, &src->c.control.avail_min))
437 return -EFAULT; 441 return -EFAULT;
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
index f42c10a43315..c4840ff75d00 100644
--- a/sound/core/pcm_lib.c
+++ b/sound/core/pcm_lib.c
@@ -316,6 +316,8 @@ static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream,
316 unsigned long jdelta; 316 unsigned long jdelta;
317 unsigned long curr_jiffies; 317 unsigned long curr_jiffies;
318 struct timespec curr_tstamp; 318 struct timespec curr_tstamp;
319 struct timespec audio_tstamp;
320 int crossed_boundary = 0;
319 321
320 old_hw_ptr = runtime->status->hw_ptr; 322 old_hw_ptr = runtime->status->hw_ptr;
321 323
@@ -327,9 +329,14 @@ static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream,
327 */ 329 */
328 pos = substream->ops->pointer(substream); 330 pos = substream->ops->pointer(substream);
329 curr_jiffies = jiffies; 331 curr_jiffies = jiffies;
330 if (runtime->tstamp_mode == SNDRV_PCM_TSTAMP_ENABLE) 332 if (runtime->tstamp_mode == SNDRV_PCM_TSTAMP_ENABLE) {
331 snd_pcm_gettime(runtime, (struct timespec *)&curr_tstamp); 333 snd_pcm_gettime(runtime, (struct timespec *)&curr_tstamp);
332 334
335 if ((runtime->hw.info & SNDRV_PCM_INFO_HAS_WALL_CLOCK) &&
336 (substream->ops->wall_clock))
337 substream->ops->wall_clock(substream, &audio_tstamp);
338 }
339
333 if (pos == SNDRV_PCM_POS_XRUN) { 340 if (pos == SNDRV_PCM_POS_XRUN) {
334 xrun(substream); 341 xrun(substream);
335 return -EPIPE; 342 return -EPIPE;
@@ -360,8 +367,10 @@ static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream,
360 hdelta = curr_jiffies - runtime->hw_ptr_jiffies; 367 hdelta = curr_jiffies - runtime->hw_ptr_jiffies;
361 if (hdelta > runtime->hw_ptr_buffer_jiffies/2) { 368 if (hdelta > runtime->hw_ptr_buffer_jiffies/2) {
362 hw_base += runtime->buffer_size; 369 hw_base += runtime->buffer_size;
363 if (hw_base >= runtime->boundary) 370 if (hw_base >= runtime->boundary) {
364 hw_base = 0; 371 hw_base = 0;
372 crossed_boundary++;
373 }
365 new_hw_ptr = hw_base + pos; 374 new_hw_ptr = hw_base + pos;
366 goto __delta; 375 goto __delta;
367 } 376 }
@@ -371,8 +380,10 @@ static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream,
371 /* pointer crosses the end of the ring buffer */ 380 /* pointer crosses the end of the ring buffer */
372 if (new_hw_ptr < old_hw_ptr) { 381 if (new_hw_ptr < old_hw_ptr) {
373 hw_base += runtime->buffer_size; 382 hw_base += runtime->buffer_size;
374 if (hw_base >= runtime->boundary) 383 if (hw_base >= runtime->boundary) {
375 hw_base = 0; 384 hw_base = 0;
385 crossed_boundary++;
386 }
376 new_hw_ptr = hw_base + pos; 387 new_hw_ptr = hw_base + pos;
377 } 388 }
378 __delta: 389 __delta:
@@ -410,8 +421,10 @@ static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream,
410 while (hdelta > xrun_threshold) { 421 while (hdelta > xrun_threshold) {
411 delta += runtime->buffer_size; 422 delta += runtime->buffer_size;
412 hw_base += runtime->buffer_size; 423 hw_base += runtime->buffer_size;
413 if (hw_base >= runtime->boundary) 424 if (hw_base >= runtime->boundary) {
414 hw_base = 0; 425 hw_base = 0;
426 crossed_boundary++;
427 }
415 new_hw_ptr = hw_base + pos; 428 new_hw_ptr = hw_base + pos;
416 hdelta -= runtime->hw_ptr_buffer_jiffies; 429 hdelta -= runtime->hw_ptr_buffer_jiffies;
417 } 430 }
@@ -456,8 +469,10 @@ static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream,
456 /* the delta value is small or zero in most cases */ 469 /* the delta value is small or zero in most cases */
457 while (delta > 0) { 470 while (delta > 0) {
458 new_hw_ptr += runtime->period_size; 471 new_hw_ptr += runtime->period_size;
459 if (new_hw_ptr >= runtime->boundary) 472 if (new_hw_ptr >= runtime->boundary) {
460 new_hw_ptr -= runtime->boundary; 473 new_hw_ptr -= runtime->boundary;
474 crossed_boundary--;
475 }
461 delta--; 476 delta--;
462 } 477 }
463 /* align hw_base to buffer_size */ 478 /* align hw_base to buffer_size */
@@ -507,9 +522,35 @@ static int snd_pcm_update_hw_ptr0(struct snd_pcm_substream *substream,
507 runtime->hw_ptr_base = hw_base; 522 runtime->hw_ptr_base = hw_base;
508 runtime->status->hw_ptr = new_hw_ptr; 523 runtime->status->hw_ptr = new_hw_ptr;
509 runtime->hw_ptr_jiffies = curr_jiffies; 524 runtime->hw_ptr_jiffies = curr_jiffies;
510 if (runtime->tstamp_mode == SNDRV_PCM_TSTAMP_ENABLE) 525 if (crossed_boundary) {
526 snd_BUG_ON(crossed_boundary != 1);
527 runtime->hw_ptr_wrap += runtime->boundary;
528 }
529 if (runtime->tstamp_mode == SNDRV_PCM_TSTAMP_ENABLE) {
511 runtime->status->tstamp = curr_tstamp; 530 runtime->status->tstamp = curr_tstamp;
512 531
532 if (!(runtime->hw.info & SNDRV_PCM_INFO_HAS_WALL_CLOCK)) {
533 /*
534 * no wall clock available, provide audio timestamp
535 * derived from pointer position+delay
536 */
537 u64 audio_frames, audio_nsecs;
538
539 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
540 audio_frames = runtime->hw_ptr_wrap
541 + runtime->status->hw_ptr
542 - runtime->delay;
543 else
544 audio_frames = runtime->hw_ptr_wrap
545 + runtime->status->hw_ptr
546 + runtime->delay;
547 audio_nsecs = div_u64(audio_frames * 1000000000LL,
548 runtime->rate);
549 audio_tstamp = ns_to_timespec(audio_nsecs);
550 }
551 runtime->status->audio_tstamp = audio_tstamp;
552 }
553
513 return snd_pcm_update_state(substream, runtime); 554 return snd_pcm_update_state(substream, runtime);
514} 555}
515 556
@@ -1661,8 +1702,10 @@ static int snd_pcm_lib_ioctl_reset(struct snd_pcm_substream *substream,
1661 if (snd_pcm_running(substream) && 1702 if (snd_pcm_running(substream) &&
1662 snd_pcm_update_hw_ptr(substream) >= 0) 1703 snd_pcm_update_hw_ptr(substream) >= 0)
1663 runtime->status->hw_ptr %= runtime->buffer_size; 1704 runtime->status->hw_ptr %= runtime->buffer_size;
1664 else 1705 else {
1665 runtime->status->hw_ptr = 0; 1706 runtime->status->hw_ptr = 0;
1707 runtime->hw_ptr_wrap = 0;
1708 }
1666 snd_pcm_stream_unlock_irqrestore(substream, flags); 1709 snd_pcm_stream_unlock_irqrestore(substream, flags);
1667 return 0; 1710 return 0;
1668} 1711}
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index f9ddecf2f4cd..09b4286c65f9 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -602,6 +602,8 @@ int snd_pcm_status(struct snd_pcm_substream *substream,
602 snd_pcm_update_hw_ptr(substream); 602 snd_pcm_update_hw_ptr(substream);
603 if (runtime->tstamp_mode == SNDRV_PCM_TSTAMP_ENABLE) { 603 if (runtime->tstamp_mode == SNDRV_PCM_TSTAMP_ENABLE) {
604 status->tstamp = runtime->status->tstamp; 604 status->tstamp = runtime->status->tstamp;
605 status->audio_tstamp =
606 runtime->status->audio_tstamp;
605 goto _tstamp_end; 607 goto _tstamp_end;
606 } 608 }
607 } 609 }
@@ -1998,7 +2000,7 @@ int snd_pcm_hw_constraints_complete(struct snd_pcm_substream *substream)
1998 if (runtime->dma_bytes) { 2000 if (runtime->dma_bytes) {
1999 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, 0, runtime->dma_bytes); 2001 err = snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_BUFFER_BYTES, 0, runtime->dma_bytes);
2000 if (err < 0) 2002 if (err < 0)
2001 return -EINVAL; 2003 return err;
2002 } 2004 }
2003 2005
2004 if (!(hw->rates & (SNDRV_PCM_RATE_KNOT | SNDRV_PCM_RATE_CONTINUOUS))) { 2006 if (!(hw->rates & (SNDRV_PCM_RATE_KNOT | SNDRV_PCM_RATE_CONTINUOUS))) {
diff --git a/sound/core/seq/seq_device.c b/sound/core/seq/seq_device.c
index 60e8fc1b3440..040c60e1da28 100644
--- a/sound/core/seq/seq_device.c
+++ b/sound/core/seq/seq_device.c
@@ -66,7 +66,7 @@ struct ops_list {
66 /* operators */ 66 /* operators */
67 struct snd_seq_dev_ops ops; 67 struct snd_seq_dev_ops ops;
68 68
69 /* registred devices */ 69 /* registered devices */
70 struct list_head dev_list; /* list of devices */ 70 struct list_head dev_list; /* list of devices */
71 int num_devices; /* number of associated devices */ 71 int num_devices; /* number of associated devices */
72 int num_init_devices; /* number of initialized devices */ 72 int num_init_devices; /* number of initialized devices */
diff --git a/sound/drivers/Kconfig b/sound/drivers/Kconfig
index fe5ae09ffccb..7d02c322ed93 100644
--- a/sound/drivers/Kconfig
+++ b/sound/drivers/Kconfig
@@ -14,6 +14,7 @@ config SND_OPL4_LIB
14 14
15config SND_VX_LIB 15config SND_VX_LIB
16 tristate 16 tristate
17 select FW_LOADER
17 select SND_HWDEP 18 select SND_HWDEP
18 select SND_PCM 19 select SND_PCM
19 20
@@ -35,7 +36,6 @@ config SND_PCSP
35 tristate "PC-Speaker support (READ HELP!)" 36 tristate "PC-Speaker support (READ HELP!)"
36 depends on PCSPKR_PLATFORM && X86 && HIGH_RES_TIMERS 37 depends on PCSPKR_PLATFORM && X86 && HIGH_RES_TIMERS
37 depends on INPUT 38 depends on INPUT
38 depends on EXPERIMENTAL
39 select SND_PCM 39 select SND_PCM
40 help 40 help
41 If you don't have a sound card in your computer, you can include a 41 If you don't have a sound card in your computer, you can include a
diff --git a/sound/drivers/aloop.c b/sound/drivers/aloop.c
index 0fe6d64ff840..3d822328d383 100644
--- a/sound/drivers/aloop.c
+++ b/sound/drivers/aloop.c
@@ -120,7 +120,6 @@ struct loopback_pcm {
120 unsigned int last_drift; 120 unsigned int last_drift;
121 unsigned long last_jiffies; 121 unsigned long last_jiffies;
122 struct timer_list timer; 122 struct timer_list timer;
123 spinlock_t timer_lock;
124}; 123};
125 124
126static struct platform_device *devices[SNDRV_CARDS]; 125static struct platform_device *devices[SNDRV_CARDS];
@@ -166,12 +165,12 @@ static inline unsigned int get_rate_shift(struct loopback_pcm *dpcm)
166 return get_setup(dpcm)->rate_shift; 165 return get_setup(dpcm)->rate_shift;
167} 166}
168 167
168/* call in cable->lock */
169static void loopback_timer_start(struct loopback_pcm *dpcm) 169static void loopback_timer_start(struct loopback_pcm *dpcm)
170{ 170{
171 unsigned long tick; 171 unsigned long tick;
172 unsigned int rate_shift = get_rate_shift(dpcm); 172 unsigned int rate_shift = get_rate_shift(dpcm);
173 173
174 spin_lock(&dpcm->timer_lock);
175 if (rate_shift != dpcm->pcm_rate_shift) { 174 if (rate_shift != dpcm->pcm_rate_shift) {
176 dpcm->pcm_rate_shift = rate_shift; 175 dpcm->pcm_rate_shift = rate_shift;
177 dpcm->period_size_frac = frac_pos(dpcm, dpcm->pcm_period_size); 176 dpcm->period_size_frac = frac_pos(dpcm, dpcm->pcm_period_size);
@@ -184,15 +183,13 @@ static void loopback_timer_start(struct loopback_pcm *dpcm)
184 tick = (tick + dpcm->pcm_bps - 1) / dpcm->pcm_bps; 183 tick = (tick + dpcm->pcm_bps - 1) / dpcm->pcm_bps;
185 dpcm->timer.expires = jiffies + tick; 184 dpcm->timer.expires = jiffies + tick;
186 add_timer(&dpcm->timer); 185 add_timer(&dpcm->timer);
187 spin_unlock(&dpcm->timer_lock);
188} 186}
189 187
188/* call in cable->lock */
190static inline void loopback_timer_stop(struct loopback_pcm *dpcm) 189static inline void loopback_timer_stop(struct loopback_pcm *dpcm)
191{ 190{
192 spin_lock(&dpcm->timer_lock);
193 del_timer(&dpcm->timer); 191 del_timer(&dpcm->timer);
194 dpcm->timer.expires = 0; 192 dpcm->timer.expires = 0;
195 spin_unlock(&dpcm->timer_lock);
196} 193}
197 194
198#define CABLE_VALID_PLAYBACK (1 << SNDRV_PCM_STREAM_PLAYBACK) 195#define CABLE_VALID_PLAYBACK (1 << SNDRV_PCM_STREAM_PLAYBACK)
@@ -274,8 +271,8 @@ static int loopback_trigger(struct snd_pcm_substream *substream, int cmd)
274 spin_lock(&cable->lock); 271 spin_lock(&cable->lock);
275 cable->running |= stream; 272 cable->running |= stream;
276 cable->pause &= ~stream; 273 cable->pause &= ~stream;
277 spin_unlock(&cable->lock);
278 loopback_timer_start(dpcm); 274 loopback_timer_start(dpcm);
275 spin_unlock(&cable->lock);
279 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) 276 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
280 loopback_active_notify(dpcm); 277 loopback_active_notify(dpcm);
281 break; 278 break;
@@ -283,23 +280,23 @@ static int loopback_trigger(struct snd_pcm_substream *substream, int cmd)
283 spin_lock(&cable->lock); 280 spin_lock(&cable->lock);
284 cable->running &= ~stream; 281 cable->running &= ~stream;
285 cable->pause &= ~stream; 282 cable->pause &= ~stream;
286 spin_unlock(&cable->lock);
287 loopback_timer_stop(dpcm); 283 loopback_timer_stop(dpcm);
284 spin_unlock(&cable->lock);
288 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) 285 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
289 loopback_active_notify(dpcm); 286 loopback_active_notify(dpcm);
290 break; 287 break;
291 case SNDRV_PCM_TRIGGER_PAUSE_PUSH: 288 case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
292 spin_lock(&cable->lock); 289 spin_lock(&cable->lock);
293 cable->pause |= stream; 290 cable->pause |= stream;
294 spin_unlock(&cable->lock);
295 loopback_timer_stop(dpcm); 291 loopback_timer_stop(dpcm);
292 spin_unlock(&cable->lock);
296 break; 293 break;
297 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: 294 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
298 spin_lock(&cable->lock); 295 spin_lock(&cable->lock);
299 dpcm->last_jiffies = jiffies; 296 dpcm->last_jiffies = jiffies;
300 cable->pause &= ~stream; 297 cable->pause &= ~stream;
301 spin_unlock(&cable->lock);
302 loopback_timer_start(dpcm); 298 loopback_timer_start(dpcm);
299 spin_unlock(&cable->lock);
303 break; 300 break;
304 default: 301 default:
305 return -EINVAL; 302 return -EINVAL;
@@ -477,6 +474,7 @@ static inline void bytepos_finish(struct loopback_pcm *dpcm,
477 dpcm->buf_pos %= dpcm->pcm_buffer_size; 474 dpcm->buf_pos %= dpcm->pcm_buffer_size;
478} 475}
479 476
477/* call in cable->lock */
480static unsigned int loopback_pos_update(struct loopback_cable *cable) 478static unsigned int loopback_pos_update(struct loopback_cable *cable)
481{ 479{
482 struct loopback_pcm *dpcm_play = 480 struct loopback_pcm *dpcm_play =
@@ -485,9 +483,7 @@ static unsigned int loopback_pos_update(struct loopback_cable *cable)
485 cable->streams[SNDRV_PCM_STREAM_CAPTURE]; 483 cable->streams[SNDRV_PCM_STREAM_CAPTURE];
486 unsigned long delta_play = 0, delta_capt = 0; 484 unsigned long delta_play = 0, delta_capt = 0;
487 unsigned int running, count1, count2; 485 unsigned int running, count1, count2;
488 unsigned long flags;
489 486
490 spin_lock_irqsave(&cable->lock, flags);
491 running = cable->running ^ cable->pause; 487 running = cable->running ^ cable->pause;
492 if (running & (1 << SNDRV_PCM_STREAM_PLAYBACK)) { 488 if (running & (1 << SNDRV_PCM_STREAM_PLAYBACK)) {
493 delta_play = jiffies - dpcm_play->last_jiffies; 489 delta_play = jiffies - dpcm_play->last_jiffies;
@@ -529,32 +525,39 @@ static unsigned int loopback_pos_update(struct loopback_cable *cable)
529 bytepos_finish(dpcm_play, count1); 525 bytepos_finish(dpcm_play, count1);
530 bytepos_finish(dpcm_capt, count1); 526 bytepos_finish(dpcm_capt, count1);
531 unlock: 527 unlock:
532 spin_unlock_irqrestore(&cable->lock, flags);
533 return running; 528 return running;
534} 529}
535 530
536static void loopback_timer_function(unsigned long data) 531static void loopback_timer_function(unsigned long data)
537{ 532{
538 struct loopback_pcm *dpcm = (struct loopback_pcm *)data; 533 struct loopback_pcm *dpcm = (struct loopback_pcm *)data;
539 unsigned int running; 534 unsigned long flags;
540 535
541 running = loopback_pos_update(dpcm->cable); 536 spin_lock_irqsave(&dpcm->cable->lock, flags);
542 if (running & (1 << dpcm->substream->stream)) { 537 if (loopback_pos_update(dpcm->cable) & (1 << dpcm->substream->stream)) {
543 loopback_timer_start(dpcm); 538 loopback_timer_start(dpcm);
544 if (dpcm->period_update_pending) { 539 if (dpcm->period_update_pending) {
545 dpcm->period_update_pending = 0; 540 dpcm->period_update_pending = 0;
541 spin_unlock_irqrestore(&dpcm->cable->lock, flags);
542 /* need to unlock before calling below */
546 snd_pcm_period_elapsed(dpcm->substream); 543 snd_pcm_period_elapsed(dpcm->substream);
544 return;
547 } 545 }
548 } 546 }
547 spin_unlock_irqrestore(&dpcm->cable->lock, flags);
549} 548}
550 549
551static snd_pcm_uframes_t loopback_pointer(struct snd_pcm_substream *substream) 550static snd_pcm_uframes_t loopback_pointer(struct snd_pcm_substream *substream)
552{ 551{
553 struct snd_pcm_runtime *runtime = substream->runtime; 552 struct snd_pcm_runtime *runtime = substream->runtime;
554 struct loopback_pcm *dpcm = runtime->private_data; 553 struct loopback_pcm *dpcm = runtime->private_data;
554 snd_pcm_uframes_t pos;
555 555
556 spin_lock(&dpcm->cable->lock);
556 loopback_pos_update(dpcm->cable); 557 loopback_pos_update(dpcm->cable);
557 return bytes_to_frames(runtime, dpcm->buf_pos); 558 pos = dpcm->buf_pos;
559 spin_unlock(&dpcm->cable->lock);
560 return bytes_to_frames(runtime, pos);
558} 561}
559 562
560static struct snd_pcm_hardware loopback_pcm_hardware = 563static struct snd_pcm_hardware loopback_pcm_hardware =
@@ -672,7 +675,6 @@ static int loopback_open(struct snd_pcm_substream *substream)
672 dpcm->substream = substream; 675 dpcm->substream = substream;
673 setup_timer(&dpcm->timer, loopback_timer_function, 676 setup_timer(&dpcm->timer, loopback_timer_function,
674 (unsigned long)dpcm); 677 (unsigned long)dpcm);
675 spin_lock_init(&dpcm->timer_lock);
676 678
677 cable = loopback->cables[substream->number][dev]; 679 cable = loopback->cables[substream->number][dev];
678 if (!cable) { 680 if (!cable) {
@@ -772,8 +774,8 @@ static struct snd_pcm_ops loopback_capture_ops = {
772 .mmap = snd_pcm_lib_mmap_vmalloc, 774 .mmap = snd_pcm_lib_mmap_vmalloc,
773}; 775};
774 776
775static int __devinit loopback_pcm_new(struct loopback *loopback, 777static int loopback_pcm_new(struct loopback *loopback,
776 int device, int substreams) 778 int device, int substreams)
777{ 779{
778 struct snd_pcm *pcm; 780 struct snd_pcm *pcm;
779 int err; 781 int err;
@@ -947,7 +949,7 @@ static int loopback_channels_get(struct snd_kcontrol *kcontrol,
947 return 0; 949 return 0;
948} 950}
949 951
950static struct snd_kcontrol_new loopback_controls[] __devinitdata = { 952static struct snd_kcontrol_new loopback_controls[] = {
951{ 953{
952 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 954 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
953 .name = "PCM Rate Shift 100000", 955 .name = "PCM Rate Shift 100000",
@@ -996,7 +998,7 @@ static struct snd_kcontrol_new loopback_controls[] __devinitdata = {
996} 998}
997}; 999};
998 1000
999static int __devinit loopback_mixer_new(struct loopback *loopback, int notify) 1001static int loopback_mixer_new(struct loopback *loopback, int notify)
1000{ 1002{
1001 struct snd_card *card = loopback->card; 1003 struct snd_card *card = loopback->card;
1002 struct snd_pcm *pcm; 1004 struct snd_pcm *pcm;
@@ -1109,7 +1111,7 @@ static void print_cable_info(struct snd_info_entry *entry,
1109 mutex_unlock(&loopback->cable_lock); 1111 mutex_unlock(&loopback->cable_lock);
1110} 1112}
1111 1113
1112static int __devinit loopback_proc_new(struct loopback *loopback, int cidx) 1114static int loopback_proc_new(struct loopback *loopback, int cidx)
1113{ 1115{
1114 char name[32]; 1116 char name[32];
1115 struct snd_info_entry *entry; 1117 struct snd_info_entry *entry;
@@ -1130,7 +1132,7 @@ static int __devinit loopback_proc_new(struct loopback *loopback, int cidx)
1130 1132
1131#endif 1133#endif
1132 1134
1133static int __devinit loopback_probe(struct platform_device *devptr) 1135static int loopback_probe(struct platform_device *devptr)
1134{ 1136{
1135 struct snd_card *card; 1137 struct snd_card *card;
1136 struct loopback *loopback; 1138 struct loopback *loopback;
@@ -1175,7 +1177,7 @@ static int __devinit loopback_probe(struct platform_device *devptr)
1175 return err; 1177 return err;
1176} 1178}
1177 1179
1178static int __devexit loopback_remove(struct platform_device *devptr) 1180static int loopback_remove(struct platform_device *devptr)
1179{ 1181{
1180 snd_card_free(platform_get_drvdata(devptr)); 1182 snd_card_free(platform_get_drvdata(devptr));
1181 platform_set_drvdata(devptr, NULL); 1183 platform_set_drvdata(devptr, NULL);
@@ -1213,7 +1215,7 @@ static SIMPLE_DEV_PM_OPS(loopback_pm, loopback_suspend, loopback_resume);
1213 1215
1214static struct platform_driver loopback_driver = { 1216static struct platform_driver loopback_driver = {
1215 .probe = loopback_probe, 1217 .probe = loopback_probe,
1216 .remove = __devexit_p(loopback_remove), 1218 .remove = loopback_remove,
1217 .driver = { 1219 .driver = {
1218 .name = SND_LOOPBACK_DRIVER, 1220 .name = SND_LOOPBACK_DRIVER,
1219 .owner = THIS_MODULE, 1221 .owner = THIS_MODULE,
diff --git a/sound/drivers/dummy.c b/sound/drivers/dummy.c
index 54bb6644a598..fd798f753609 100644
--- a/sound/drivers/dummy.c
+++ b/sound/drivers/dummy.c
@@ -134,6 +134,9 @@ struct snd_dummy {
134 spinlock_t mixer_lock; 134 spinlock_t mixer_lock;
135 int mixer_volume[MIXER_ADDR_LAST+1][2]; 135 int mixer_volume[MIXER_ADDR_LAST+1][2];
136 int capture_source[MIXER_ADDR_LAST+1][2]; 136 int capture_source[MIXER_ADDR_LAST+1][2];
137 int iobox;
138 struct snd_kcontrol *cd_volume_ctl;
139 struct snd_kcontrol *cd_switch_ctl;
137 const struct dummy_timer_ops *timer_ops; 140 const struct dummy_timer_ops *timer_ops;
138}; 141};
139 142
@@ -685,8 +688,8 @@ static struct snd_pcm_ops dummy_pcm_ops_no_buf = {
685 .page = dummy_pcm_page, 688 .page = dummy_pcm_page,
686}; 689};
687 690
688static int __devinit snd_card_dummy_pcm(struct snd_dummy *dummy, int device, 691static int snd_card_dummy_pcm(struct snd_dummy *dummy, int device,
689 int substreams) 692 int substreams)
690{ 693{
691 struct snd_pcm *pcm; 694 struct snd_pcm *pcm;
692 struct snd_pcm_ops *ops; 695 struct snd_pcm_ops *ops;
@@ -817,6 +820,57 @@ static int snd_dummy_capsrc_put(struct snd_kcontrol *kcontrol, struct snd_ctl_el
817 return change; 820 return change;
818} 821}
819 822
823static int snd_dummy_iobox_info(struct snd_kcontrol *kcontrol,
824 struct snd_ctl_elem_info *info)
825{
826 const char *const names[] = { "None", "CD Player" };
827
828 return snd_ctl_enum_info(info, 1, 2, names);
829}
830
831static int snd_dummy_iobox_get(struct snd_kcontrol *kcontrol,
832 struct snd_ctl_elem_value *value)
833{
834 struct snd_dummy *dummy = snd_kcontrol_chip(kcontrol);
835
836 value->value.enumerated.item[0] = dummy->iobox;
837 return 0;
838}
839
840static int snd_dummy_iobox_put(struct snd_kcontrol *kcontrol,
841 struct snd_ctl_elem_value *value)
842{
843 struct snd_dummy *dummy = snd_kcontrol_chip(kcontrol);
844 int changed;
845
846 if (value->value.enumerated.item[0] > 1)
847 return -EINVAL;
848
849 changed = value->value.enumerated.item[0] != dummy->iobox;
850 if (changed) {
851 dummy->iobox = value->value.enumerated.item[0];
852
853 if (dummy->iobox) {
854 dummy->cd_volume_ctl->vd[0].access &=
855 ~SNDRV_CTL_ELEM_ACCESS_INACTIVE;
856 dummy->cd_switch_ctl->vd[0].access &=
857 ~SNDRV_CTL_ELEM_ACCESS_INACTIVE;
858 } else {
859 dummy->cd_volume_ctl->vd[0].access |=
860 SNDRV_CTL_ELEM_ACCESS_INACTIVE;
861 dummy->cd_switch_ctl->vd[0].access |=
862 SNDRV_CTL_ELEM_ACCESS_INACTIVE;
863 }
864
865 snd_ctl_notify(dummy->card, SNDRV_CTL_EVENT_MASK_INFO,
866 &dummy->cd_volume_ctl->id);
867 snd_ctl_notify(dummy->card, SNDRV_CTL_EVENT_MASK_INFO,
868 &dummy->cd_switch_ctl->id);
869 }
870
871 return changed;
872}
873
820static struct snd_kcontrol_new snd_dummy_controls[] = { 874static struct snd_kcontrol_new snd_dummy_controls[] = {
821DUMMY_VOLUME("Master Volume", 0, MIXER_ADDR_MASTER), 875DUMMY_VOLUME("Master Volume", 0, MIXER_ADDR_MASTER),
822DUMMY_CAPSRC("Master Capture Switch", 0, MIXER_ADDR_MASTER), 876DUMMY_CAPSRC("Master Capture Switch", 0, MIXER_ADDR_MASTER),
@@ -827,22 +881,37 @@ DUMMY_CAPSRC("Line Capture Switch", 0, MIXER_ADDR_LINE),
827DUMMY_VOLUME("Mic Volume", 0, MIXER_ADDR_MIC), 881DUMMY_VOLUME("Mic Volume", 0, MIXER_ADDR_MIC),
828DUMMY_CAPSRC("Mic Capture Switch", 0, MIXER_ADDR_MIC), 882DUMMY_CAPSRC("Mic Capture Switch", 0, MIXER_ADDR_MIC),
829DUMMY_VOLUME("CD Volume", 0, MIXER_ADDR_CD), 883DUMMY_VOLUME("CD Volume", 0, MIXER_ADDR_CD),
830DUMMY_CAPSRC("CD Capture Switch", 0, MIXER_ADDR_CD) 884DUMMY_CAPSRC("CD Capture Switch", 0, MIXER_ADDR_CD),
885{
886 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
887 .name = "External I/O Box",
888 .info = snd_dummy_iobox_info,
889 .get = snd_dummy_iobox_get,
890 .put = snd_dummy_iobox_put,
891},
831}; 892};
832 893
833static int __devinit snd_card_dummy_new_mixer(struct snd_dummy *dummy) 894static int snd_card_dummy_new_mixer(struct snd_dummy *dummy)
834{ 895{
835 struct snd_card *card = dummy->card; 896 struct snd_card *card = dummy->card;
897 struct snd_kcontrol *kcontrol;
836 unsigned int idx; 898 unsigned int idx;
837 int err; 899 int err;
838 900
839 spin_lock_init(&dummy->mixer_lock); 901 spin_lock_init(&dummy->mixer_lock);
840 strcpy(card->mixername, "Dummy Mixer"); 902 strcpy(card->mixername, "Dummy Mixer");
903 dummy->iobox = 1;
841 904
842 for (idx = 0; idx < ARRAY_SIZE(snd_dummy_controls); idx++) { 905 for (idx = 0; idx < ARRAY_SIZE(snd_dummy_controls); idx++) {
843 err = snd_ctl_add(card, snd_ctl_new1(&snd_dummy_controls[idx], dummy)); 906 kcontrol = snd_ctl_new1(&snd_dummy_controls[idx], dummy);
907 err = snd_ctl_add(card, kcontrol);
844 if (err < 0) 908 if (err < 0)
845 return err; 909 return err;
910 if (!strcmp(kcontrol->id.name, "CD Volume"))
911 dummy->cd_volume_ctl = kcontrol;
912 else if (!strcmp(kcontrol->id.name, "CD Capture Switch"))
913 dummy->cd_switch_ctl = kcontrol;
914
846 } 915 }
847 return 0; 916 return 0;
848} 917}
@@ -962,7 +1031,7 @@ static void dummy_proc_write(struct snd_info_entry *entry,
962 } 1031 }
963} 1032}
964 1033
965static void __devinit dummy_proc_init(struct snd_dummy *chip) 1034static void dummy_proc_init(struct snd_dummy *chip)
966{ 1035{
967 struct snd_info_entry *entry; 1036 struct snd_info_entry *entry;
968 1037
@@ -977,7 +1046,7 @@ static void __devinit dummy_proc_init(struct snd_dummy *chip)
977#define dummy_proc_init(x) 1046#define dummy_proc_init(x)
978#endif /* CONFIG_SND_DEBUG && CONFIG_PROC_FS */ 1047#endif /* CONFIG_SND_DEBUG && CONFIG_PROC_FS */
979 1048
980static int __devinit snd_dummy_probe(struct platform_device *devptr) 1049static int snd_dummy_probe(struct platform_device *devptr)
981{ 1050{
982 struct snd_card *card; 1051 struct snd_card *card;
983 struct snd_dummy *dummy; 1052 struct snd_dummy *dummy;
@@ -1057,7 +1126,7 @@ static int __devinit snd_dummy_probe(struct platform_device *devptr)
1057 return err; 1126 return err;
1058} 1127}
1059 1128
1060static int __devexit snd_dummy_remove(struct platform_device *devptr) 1129static int snd_dummy_remove(struct platform_device *devptr)
1061{ 1130{
1062 snd_card_free(platform_get_drvdata(devptr)); 1131 snd_card_free(platform_get_drvdata(devptr));
1063 platform_set_drvdata(devptr, NULL); 1132 platform_set_drvdata(devptr, NULL);
@@ -1093,7 +1162,7 @@ static SIMPLE_DEV_PM_OPS(snd_dummy_pm, snd_dummy_suspend, snd_dummy_resume);
1093 1162
1094static struct platform_driver snd_dummy_driver = { 1163static struct platform_driver snd_dummy_driver = {
1095 .probe = snd_dummy_probe, 1164 .probe = snd_dummy_probe,
1096 .remove = __devexit_p(snd_dummy_remove), 1165 .remove = snd_dummy_remove,
1097 .driver = { 1166 .driver = {
1098 .name = SND_DUMMY_DRIVER, 1167 .name = SND_DUMMY_DRIVER,
1099 .owner = THIS_MODULE, 1168 .owner = THIS_MODULE,
diff --git a/sound/drivers/ml403-ac97cr.c b/sound/drivers/ml403-ac97cr.c
index 6c83b1aed288..8125a7e95ee4 100644
--- a/sound/drivers/ml403-ac97cr.c
+++ b/sound/drivers/ml403-ac97cr.c
@@ -1063,7 +1063,7 @@ snd_ml403_ac97cr_codec_write(struct snd_ac97 *ac97, unsigned short reg,
1063 return; 1063 return;
1064} 1064}
1065 1065
1066static int __devinit 1066static int
1067snd_ml403_ac97cr_chip_init(struct snd_ml403_ac97cr *ml403_ac97cr) 1067snd_ml403_ac97cr_chip_init(struct snd_ml403_ac97cr *ml403_ac97cr)
1068{ 1068{
1069 unsigned long end_time; 1069 unsigned long end_time;
@@ -1108,7 +1108,7 @@ static int snd_ml403_ac97cr_dev_free(struct snd_device *snddev)
1108 return snd_ml403_ac97cr_free(ml403_ac97cr); 1108 return snd_ml403_ac97cr_free(ml403_ac97cr);
1109} 1109}
1110 1110
1111static int __devinit 1111static int
1112snd_ml403_ac97cr_create(struct snd_card *card, struct platform_device *pfdev, 1112snd_ml403_ac97cr_create(struct snd_card *card, struct platform_device *pfdev,
1113 struct snd_ml403_ac97cr **rml403_ac97cr) 1113 struct snd_ml403_ac97cr **rml403_ac97cr)
1114{ 1114{
@@ -1204,7 +1204,7 @@ static void snd_ml403_ac97cr_mixer_free(struct snd_ac97 *ac97)
1204 PDEBUG(INIT_INFO, "mixer_free(): (done)\n"); 1204 PDEBUG(INIT_INFO, "mixer_free(): (done)\n");
1205} 1205}
1206 1206
1207static int __devinit 1207static int
1208snd_ml403_ac97cr_mixer(struct snd_ml403_ac97cr *ml403_ac97cr) 1208snd_ml403_ac97cr_mixer(struct snd_ml403_ac97cr *ml403_ac97cr)
1209{ 1209{
1210 struct snd_ac97_bus *bus; 1210 struct snd_ac97_bus *bus;
@@ -1237,7 +1237,7 @@ snd_ml403_ac97cr_mixer(struct snd_ml403_ac97cr *ml403_ac97cr)
1237 return err; 1237 return err;
1238} 1238}
1239 1239
1240static int __devinit 1240static int
1241snd_ml403_ac97cr_pcm(struct snd_ml403_ac97cr *ml403_ac97cr, int device, 1241snd_ml403_ac97cr_pcm(struct snd_ml403_ac97cr *ml403_ac97cr, int device,
1242 struct snd_pcm **rpcm) 1242 struct snd_pcm **rpcm)
1243{ 1243{
@@ -1268,7 +1268,7 @@ snd_ml403_ac97cr_pcm(struct snd_ml403_ac97cr *ml403_ac97cr, int device,
1268 return 0; 1268 return 0;
1269} 1269}
1270 1270
1271static int __devinit snd_ml403_ac97cr_probe(struct platform_device *pfdev) 1271static int snd_ml403_ac97cr_probe(struct platform_device *pfdev)
1272{ 1272{
1273 struct snd_card *card; 1273 struct snd_card *card;
1274 struct snd_ml403_ac97cr *ml403_ac97cr = NULL; 1274 struct snd_ml403_ac97cr *ml403_ac97cr = NULL;
diff --git a/sound/drivers/mpu401/mpu401.c b/sound/drivers/mpu401/mpu401.c
index bc03a2046c9c..da1a29bfc85d 100644
--- a/sound/drivers/mpu401/mpu401.c
+++ b/sound/drivers/mpu401/mpu401.c
@@ -100,7 +100,7 @@ static int snd_mpu401_create(int dev, struct snd_card **rcard)
100 return err; 100 return err;
101} 101}
102 102
103static int __devinit snd_mpu401_probe(struct platform_device *devptr) 103static int snd_mpu401_probe(struct platform_device *devptr)
104{ 104{
105 int dev = devptr->id; 105 int dev = devptr->id;
106 int err; 106 int err;
@@ -126,7 +126,7 @@ static int __devinit snd_mpu401_probe(struct platform_device *devptr)
126 return 0; 126 return 0;
127} 127}
128 128
129static int __devexit snd_mpu401_remove(struct platform_device *devptr) 129static int snd_mpu401_remove(struct platform_device *devptr)
130{ 130{
131 snd_card_free(platform_get_drvdata(devptr)); 131 snd_card_free(platform_get_drvdata(devptr));
132 platform_set_drvdata(devptr, NULL); 132 platform_set_drvdata(devptr, NULL);
@@ -137,7 +137,7 @@ static int __devexit snd_mpu401_remove(struct platform_device *devptr)
137 137
138static struct platform_driver snd_mpu401_driver = { 138static struct platform_driver snd_mpu401_driver = {
139 .probe = snd_mpu401_probe, 139 .probe = snd_mpu401_probe,
140 .remove = __devexit_p(snd_mpu401_remove), 140 .remove = snd_mpu401_remove,
141 .driver = { 141 .driver = {
142 .name = SND_MPU401_DRIVER, 142 .name = SND_MPU401_DRIVER,
143 .owner = THIS_MODULE, 143 .owner = THIS_MODULE,
@@ -156,8 +156,8 @@ static struct pnp_device_id snd_mpu401_pnpids[] = {
156 156
157MODULE_DEVICE_TABLE(pnp, snd_mpu401_pnpids); 157MODULE_DEVICE_TABLE(pnp, snd_mpu401_pnpids);
158 158
159static int __devinit snd_mpu401_pnp(int dev, struct pnp_dev *device, 159static int snd_mpu401_pnp(int dev, struct pnp_dev *device,
160 const struct pnp_device_id *id) 160 const struct pnp_device_id *id)
161{ 161{
162 if (!pnp_port_valid(device, 0) || 162 if (!pnp_port_valid(device, 0) ||
163 pnp_port_flags(device, 0) & IORESOURCE_DISABLED) { 163 pnp_port_flags(device, 0) & IORESOURCE_DISABLED) {
@@ -182,8 +182,8 @@ static int __devinit snd_mpu401_pnp(int dev, struct pnp_dev *device,
182 return 0; 182 return 0;
183} 183}
184 184
185static int __devinit snd_mpu401_pnp_probe(struct pnp_dev *pnp_dev, 185static int snd_mpu401_pnp_probe(struct pnp_dev *pnp_dev,
186 const struct pnp_device_id *id) 186 const struct pnp_device_id *id)
187{ 187{
188 static int dev; 188 static int dev;
189 struct snd_card *card; 189 struct snd_card *card;
@@ -211,7 +211,7 @@ static int __devinit snd_mpu401_pnp_probe(struct pnp_dev *pnp_dev,
211 return -ENODEV; 211 return -ENODEV;
212} 212}
213 213
214static void __devexit snd_mpu401_pnp_remove(struct pnp_dev *dev) 214static void snd_mpu401_pnp_remove(struct pnp_dev *dev)
215{ 215{
216 struct snd_card *card = (struct snd_card *) pnp_get_drvdata(dev); 216 struct snd_card *card = (struct snd_card *) pnp_get_drvdata(dev);
217 217
@@ -223,7 +223,7 @@ static struct pnp_driver snd_mpu401_pnp_driver = {
223 .name = "mpu401", 223 .name = "mpu401",
224 .id_table = snd_mpu401_pnpids, 224 .id_table = snd_mpu401_pnpids,
225 .probe = snd_mpu401_pnp_probe, 225 .probe = snd_mpu401_pnp_probe,
226 .remove = __devexit_p(snd_mpu401_pnp_remove), 226 .remove = snd_mpu401_pnp_remove,
227}; 227};
228#else 228#else
229static struct pnp_driver snd_mpu401_pnp_driver; 229static struct pnp_driver snd_mpu401_pnp_driver;
diff --git a/sound/drivers/mtpav.c b/sound/drivers/mtpav.c
index cad73af3860c..9f1815b99a15 100644
--- a/sound/drivers/mtpav.c
+++ b/sound/drivers/mtpav.c
@@ -583,7 +583,7 @@ static irqreturn_t snd_mtpav_irqh(int irq, void *dev_id)
583/* 583/*
584 * get ISA resources 584 * get ISA resources
585 */ 585 */
586static int __devinit snd_mtpav_get_ISA(struct mtpav * mcard) 586static int snd_mtpav_get_ISA(struct mtpav *mcard)
587{ 587{
588 if ((mcard->res_port = request_region(port, 3, "MotuMTPAV MIDI")) == NULL) { 588 if ((mcard->res_port = request_region(port, 3, "MotuMTPAV MIDI")) == NULL) {
589 snd_printk(KERN_ERR "MTVAP port 0x%lx is busy\n", port); 589 snd_printk(KERN_ERR "MTVAP port 0x%lx is busy\n", port);
@@ -619,8 +619,8 @@ static struct snd_rawmidi_ops snd_mtpav_input = {
619 * get RAWMIDI resources 619 * get RAWMIDI resources
620 */ 620 */
621 621
622static void __devinit snd_mtpav_set_name(struct mtpav *chip, 622static void snd_mtpav_set_name(struct mtpav *chip,
623 struct snd_rawmidi_substream *substream) 623 struct snd_rawmidi_substream *substream)
624{ 624{
625 if (substream->number >= 0 && substream->number < chip->num_ports) 625 if (substream->number >= 0 && substream->number < chip->num_ports)
626 sprintf(substream->name, "MTP direct %d", (substream->number % chip->num_ports) + 1); 626 sprintf(substream->name, "MTP direct %d", (substream->number % chip->num_ports) + 1);
@@ -634,7 +634,7 @@ static void __devinit snd_mtpav_set_name(struct mtpav *chip,
634 strcpy(substream->name, "MTP broadcast"); 634 strcpy(substream->name, "MTP broadcast");
635} 635}
636 636
637static int __devinit snd_mtpav_get_RAWMIDI(struct mtpav *mcard) 637static int snd_mtpav_get_RAWMIDI(struct mtpav *mcard)
638{ 638{
639 int rval; 639 int rval;
640 struct snd_rawmidi *rawmidi; 640 struct snd_rawmidi *rawmidi;
@@ -691,7 +691,7 @@ static void snd_mtpav_free(struct snd_card *card)
691 691
692/* 692/*
693 */ 693 */
694static int __devinit snd_mtpav_probe(struct platform_device *dev) 694static int snd_mtpav_probe(struct platform_device *dev)
695{ 695{
696 struct snd_card *card; 696 struct snd_card *card;
697 int err; 697 int err;
@@ -746,7 +746,7 @@ static int __devinit snd_mtpav_probe(struct platform_device *dev)
746 return err; 746 return err;
747} 747}
748 748
749static int __devexit snd_mtpav_remove(struct platform_device *devptr) 749static int snd_mtpav_remove(struct platform_device *devptr)
750{ 750{
751 snd_card_free(platform_get_drvdata(devptr)); 751 snd_card_free(platform_get_drvdata(devptr));
752 platform_set_drvdata(devptr, NULL); 752 platform_set_drvdata(devptr, NULL);
@@ -757,7 +757,7 @@ static int __devexit snd_mtpav_remove(struct platform_device *devptr)
757 757
758static struct platform_driver snd_mtpav_driver = { 758static struct platform_driver snd_mtpav_driver = {
759 .probe = snd_mtpav_probe, 759 .probe = snd_mtpav_probe,
760 .remove = __devexit_p(snd_mtpav_remove), 760 .remove = snd_mtpav_remove,
761 .driver = { 761 .driver = {
762 .name = SND_MTPAV_DRIVER, 762 .name = SND_MTPAV_DRIVER,
763 .owner = THIS_MODULE, 763 .owner = THIS_MODULE,
diff --git a/sound/drivers/mts64.c b/sound/drivers/mts64.c
index 2d5514b0a290..4e0dd22ba08e 100644
--- a/sound/drivers/mts64.c
+++ b/sound/drivers/mts64.c
@@ -83,9 +83,9 @@ static int snd_mts64_free(struct mts64 *mts)
83 return 0; 83 return 0;
84} 84}
85 85
86static int __devinit snd_mts64_create(struct snd_card *card, 86static int snd_mts64_create(struct snd_card *card,
87 struct pardevice *pardev, 87 struct pardevice *pardev,
88 struct mts64 **rchip) 88 struct mts64 **rchip)
89{ 89{
90 struct mts64 *mts; 90 struct mts64 *mts;
91 91
@@ -214,7 +214,7 @@ static int mts64_device_ready(struct parport *p)
214 * 0 init ok 214 * 0 init ok
215 * -EIO failure 215 * -EIO failure
216 */ 216 */
217static int __devinit mts64_device_init(struct parport *p) 217static int mts64_device_init(struct parport *p)
218{ 218{
219 int i; 219 int i;
220 220
@@ -290,7 +290,7 @@ static u8 mts64_map_midi_input(u8 c)
290 * 0 device found 290 * 0 device found
291 * -ENODEV no device 291 * -ENODEV no device
292 */ 292 */
293static int __devinit mts64_probe(struct parport *p) 293static int mts64_probe(struct parport *p)
294{ 294{
295 u8 c; 295 u8 c;
296 296
@@ -483,7 +483,7 @@ __out:
483 return changed; 483 return changed;
484} 484}
485 485
486static struct snd_kcontrol_new mts64_ctl_smpte_switch __devinitdata = { 486static struct snd_kcontrol_new mts64_ctl_smpte_switch = {
487 .iface = SNDRV_CTL_ELEM_IFACE_RAWMIDI, 487 .iface = SNDRV_CTL_ELEM_IFACE_RAWMIDI,
488 .name = "SMPTE Playback Switch", 488 .name = "SMPTE Playback Switch",
489 .index = 0, 489 .index = 0,
@@ -556,7 +556,7 @@ static int snd_mts64_ctl_smpte_time_put(struct snd_kcontrol *kctl,
556 return changed; 556 return changed;
557} 557}
558 558
559static struct snd_kcontrol_new mts64_ctl_smpte_time_hours __devinitdata = { 559static struct snd_kcontrol_new mts64_ctl_smpte_time_hours = {
560 .iface = SNDRV_CTL_ELEM_IFACE_RAWMIDI, 560 .iface = SNDRV_CTL_ELEM_IFACE_RAWMIDI,
561 .name = "SMPTE Time Hours", 561 .name = "SMPTE Time Hours",
562 .index = 0, 562 .index = 0,
@@ -567,7 +567,7 @@ static struct snd_kcontrol_new mts64_ctl_smpte_time_hours __devinitdata = {
567 .put = snd_mts64_ctl_smpte_time_put 567 .put = snd_mts64_ctl_smpte_time_put
568}; 568};
569 569
570static struct snd_kcontrol_new mts64_ctl_smpte_time_minutes __devinitdata = { 570static struct snd_kcontrol_new mts64_ctl_smpte_time_minutes = {
571 .iface = SNDRV_CTL_ELEM_IFACE_RAWMIDI, 571 .iface = SNDRV_CTL_ELEM_IFACE_RAWMIDI,
572 .name = "SMPTE Time Minutes", 572 .name = "SMPTE Time Minutes",
573 .index = 0, 573 .index = 0,
@@ -578,7 +578,7 @@ static struct snd_kcontrol_new mts64_ctl_smpte_time_minutes __devinitdata = {
578 .put = snd_mts64_ctl_smpte_time_put 578 .put = snd_mts64_ctl_smpte_time_put
579}; 579};
580 580
581static struct snd_kcontrol_new mts64_ctl_smpte_time_seconds __devinitdata = { 581static struct snd_kcontrol_new mts64_ctl_smpte_time_seconds = {
582 .iface = SNDRV_CTL_ELEM_IFACE_RAWMIDI, 582 .iface = SNDRV_CTL_ELEM_IFACE_RAWMIDI,
583 .name = "SMPTE Time Seconds", 583 .name = "SMPTE Time Seconds",
584 .index = 0, 584 .index = 0,
@@ -589,7 +589,7 @@ static struct snd_kcontrol_new mts64_ctl_smpte_time_seconds __devinitdata = {
589 .put = snd_mts64_ctl_smpte_time_put 589 .put = snd_mts64_ctl_smpte_time_put
590}; 590};
591 591
592static struct snd_kcontrol_new mts64_ctl_smpte_time_frames __devinitdata = { 592static struct snd_kcontrol_new mts64_ctl_smpte_time_frames = {
593 .iface = SNDRV_CTL_ELEM_IFACE_RAWMIDI, 593 .iface = SNDRV_CTL_ELEM_IFACE_RAWMIDI,
594 .name = "SMPTE Time Frames", 594 .name = "SMPTE Time Frames",
595 .index = 0, 595 .index = 0,
@@ -651,7 +651,7 @@ static int snd_mts64_ctl_smpte_fps_put(struct snd_kcontrol *kctl,
651 return changed; 651 return changed;
652} 652}
653 653
654static struct snd_kcontrol_new mts64_ctl_smpte_fps __devinitdata = { 654static struct snd_kcontrol_new mts64_ctl_smpte_fps = {
655 .iface = SNDRV_CTL_ELEM_IFACE_RAWMIDI, 655 .iface = SNDRV_CTL_ELEM_IFACE_RAWMIDI,
656 .name = "SMPTE Fps", 656 .name = "SMPTE Fps",
657 .index = 0, 657 .index = 0,
@@ -663,11 +663,11 @@ static struct snd_kcontrol_new mts64_ctl_smpte_fps __devinitdata = {
663}; 663};
664 664
665 665
666static int __devinit snd_mts64_ctl_create(struct snd_card *card, 666static int snd_mts64_ctl_create(struct snd_card *card,
667 struct mts64 *mts) 667 struct mts64 *mts)
668{ 668{
669 int err, i; 669 int err, i;
670 static struct snd_kcontrol_new *control[] __devinitdata = { 670 static struct snd_kcontrol_new *control[] = {
671 &mts64_ctl_smpte_switch, 671 &mts64_ctl_smpte_switch,
672 &mts64_ctl_smpte_time_hours, 672 &mts64_ctl_smpte_time_hours,
673 &mts64_ctl_smpte_time_minutes, 673 &mts64_ctl_smpte_time_minutes,
@@ -774,7 +774,7 @@ static struct snd_rawmidi_ops snd_mts64_rawmidi_input_ops = {
774}; 774};
775 775
776/* Create and initialize the rawmidi component */ 776/* Create and initialize the rawmidi component */
777static int __devinit snd_mts64_rawmidi_create(struct snd_card *card) 777static int snd_mts64_rawmidi_create(struct snd_card *card)
778{ 778{
779 struct mts64 *mts = card->private_data; 779 struct mts64 *mts = card->private_data;
780 struct snd_rawmidi *rmidi; 780 struct snd_rawmidi *rmidi;
@@ -860,7 +860,7 @@ __out:
860 spin_unlock(&mts->lock); 860 spin_unlock(&mts->lock);
861} 861}
862 862
863static int __devinit snd_mts64_probe_port(struct parport *p) 863static int snd_mts64_probe_port(struct parport *p)
864{ 864{
865 struct pardevice *pardev; 865 struct pardevice *pardev;
866 int res; 866 int res;
@@ -884,7 +884,7 @@ static int __devinit snd_mts64_probe_port(struct parport *p)
884 return res; 884 return res;
885} 885}
886 886
887static void __devinit snd_mts64_attach(struct parport *p) 887static void snd_mts64_attach(struct parport *p)
888{ 888{
889 struct platform_device *device; 889 struct platform_device *device;
890 890
@@ -940,7 +940,7 @@ static void snd_mts64_card_private_free(struct snd_card *card)
940 snd_mts64_free(mts); 940 snd_mts64_free(mts);
941} 941}
942 942
943static int __devinit snd_mts64_probe(struct platform_device *pdev) 943static int snd_mts64_probe(struct platform_device *pdev)
944{ 944{
945 struct pardevice *pardev; 945 struct pardevice *pardev;
946 struct parport *p; 946 struct parport *p;
@@ -1025,7 +1025,7 @@ __err:
1025 return err; 1025 return err;
1026} 1026}
1027 1027
1028static int __devexit snd_mts64_remove(struct platform_device *pdev) 1028static int snd_mts64_remove(struct platform_device *pdev)
1029{ 1029{
1030 struct snd_card *card = platform_get_drvdata(pdev); 1030 struct snd_card *card = platform_get_drvdata(pdev);
1031 1031
@@ -1038,7 +1038,7 @@ static int __devexit snd_mts64_remove(struct platform_device *pdev)
1038 1038
1039static struct platform_driver snd_mts64_driver = { 1039static struct platform_driver snd_mts64_driver = {
1040 .probe = snd_mts64_probe, 1040 .probe = snd_mts64_probe,
1041 .remove = __devexit_p(snd_mts64_remove), 1041 .remove = snd_mts64_remove,
1042 .driver = { 1042 .driver = {
1043 .name = PLATFORM_DRIVER, 1043 .name = PLATFORM_DRIVER,
1044 .owner = THIS_MODULE, 1044 .owner = THIS_MODULE,
diff --git a/sound/drivers/pcsp/pcsp.c b/sound/drivers/pcsp/pcsp.c
index ef171295f6d4..7a5fdb9b0afc 100644
--- a/sound/drivers/pcsp/pcsp.c
+++ b/sound/drivers/pcsp/pcsp.c
@@ -39,7 +39,7 @@ MODULE_PARM_DESC(nopcm, "Disable PC-Speaker PCM sound. Only beeps remain.");
39 39
40struct snd_pcsp pcsp_chip; 40struct snd_pcsp pcsp_chip;
41 41
42static int __devinit snd_pcsp_create(struct snd_card *card) 42static int snd_pcsp_create(struct snd_card *card)
43{ 43{
44 static struct snd_device_ops ops = { }; 44 static struct snd_device_ops ops = { };
45 struct timespec tp; 45 struct timespec tp;
@@ -93,7 +93,7 @@ static int __devinit snd_pcsp_create(struct snd_card *card)
93 return 0; 93 return 0;
94} 94}
95 95
96static int __devinit snd_card_pcsp_probe(int devnum, struct device *dev) 96static int snd_card_pcsp_probe(int devnum, struct device *dev)
97{ 97{
98 struct snd_card *card; 98 struct snd_card *card;
99 int err; 99 int err;
@@ -142,7 +142,7 @@ static int __devinit snd_card_pcsp_probe(int devnum, struct device *dev)
142 return 0; 142 return 0;
143} 143}
144 144
145static int __devinit alsa_card_pcsp_init(struct device *dev) 145static int alsa_card_pcsp_init(struct device *dev)
146{ 146{
147 int err; 147 int err;
148 148
@@ -161,12 +161,12 @@ static int __devinit alsa_card_pcsp_init(struct device *dev)
161 return 0; 161 return 0;
162} 162}
163 163
164static void __devexit alsa_card_pcsp_exit(struct snd_pcsp *chip) 164static void alsa_card_pcsp_exit(struct snd_pcsp *chip)
165{ 165{
166 snd_card_free(chip->card); 166 snd_card_free(chip->card);
167} 167}
168 168
169static int __devinit pcsp_probe(struct platform_device *dev) 169static int pcsp_probe(struct platform_device *dev)
170{ 170{
171 int err; 171 int err;
172 172
@@ -184,7 +184,7 @@ static int __devinit pcsp_probe(struct platform_device *dev)
184 return 0; 184 return 0;
185} 185}
186 186
187static int __devexit pcsp_remove(struct platform_device *dev) 187static int pcsp_remove(struct platform_device *dev)
188{ 188{
189 struct snd_pcsp *chip = platform_get_drvdata(dev); 189 struct snd_pcsp *chip = platform_get_drvdata(dev);
190 alsa_card_pcsp_exit(chip); 190 alsa_card_pcsp_exit(chip);
@@ -227,7 +227,7 @@ static struct platform_driver pcsp_platform_driver = {
227 .pm = PCSP_PM_OPS, 227 .pm = PCSP_PM_OPS,
228 }, 228 },
229 .probe = pcsp_probe, 229 .probe = pcsp_probe,
230 .remove = __devexit_p(pcsp_remove), 230 .remove = pcsp_remove,
231 .shutdown = pcsp_shutdown, 231 .shutdown = pcsp_shutdown,
232}; 232};
233 233
diff --git a/sound/drivers/pcsp/pcsp_input.c b/sound/drivers/pcsp/pcsp_input.c
index b5e2b54c2604..b874b0ad99cd 100644
--- a/sound/drivers/pcsp/pcsp_input.c
+++ b/sound/drivers/pcsp/pcsp_input.c
@@ -77,7 +77,7 @@ static int pcspkr_input_event(struct input_dev *dev, unsigned int type,
77 return 0; 77 return 0;
78} 78}
79 79
80int __devinit pcspkr_input_init(struct input_dev **rdev, struct device *dev) 80int pcspkr_input_init(struct input_dev **rdev, struct device *dev)
81{ 81{
82 int err; 82 int err;
83 83
diff --git a/sound/drivers/pcsp/pcsp_input.h b/sound/drivers/pcsp/pcsp_input.h
index e66738c78333..d692749b8c9b 100644
--- a/sound/drivers/pcsp/pcsp_input.h
+++ b/sound/drivers/pcsp/pcsp_input.h
@@ -7,7 +7,7 @@
7#ifndef __PCSP_INPUT_H__ 7#ifndef __PCSP_INPUT_H__
8#define __PCSP_INPUT_H__ 8#define __PCSP_INPUT_H__
9 9
10int __devinit pcspkr_input_init(struct input_dev **rdev, struct device *dev); 10int pcspkr_input_init(struct input_dev **rdev, struct device *dev);
11int pcspkr_input_remove(struct input_dev *dev); 11int pcspkr_input_remove(struct input_dev *dev);
12void pcspkr_stop_sound(void); 12void pcspkr_stop_sound(void);
13 13
diff --git a/sound/drivers/pcsp/pcsp_lib.c b/sound/drivers/pcsp/pcsp_lib.c
index 434981dd4a61..29ebaa4ec0fd 100644
--- a/sound/drivers/pcsp/pcsp_lib.c
+++ b/sound/drivers/pcsp/pcsp_lib.c
@@ -334,7 +334,7 @@ static struct snd_pcm_ops snd_pcsp_playback_ops = {
334 .pointer = snd_pcsp_playback_pointer, 334 .pointer = snd_pcsp_playback_pointer,
335}; 335};
336 336
337int __devinit snd_pcsp_new_pcm(struct snd_pcsp *chip) 337int snd_pcsp_new_pcm(struct snd_pcsp *chip)
338{ 338{
339 int err; 339 int err;
340 340
diff --git a/sound/drivers/pcsp/pcsp_mixer.c b/sound/drivers/pcsp/pcsp_mixer.c
index 6f633f4f3b96..f1e1defc09b1 100644
--- a/sound/drivers/pcsp/pcsp_mixer.c
+++ b/sound/drivers/pcsp/pcsp_mixer.c
@@ -119,17 +119,17 @@ static int pcsp_pcspkr_put(struct snd_kcontrol *kcontrol,
119 .put = pcsp_##ctl_type##_put, \ 119 .put = pcsp_##ctl_type##_put, \
120} 120}
121 121
122static struct snd_kcontrol_new __devinitdata snd_pcsp_controls_pcm[] = { 122static struct snd_kcontrol_new snd_pcsp_controls_pcm[] = {
123 PCSP_MIXER_CONTROL(enable, "Master Playback Switch"), 123 PCSP_MIXER_CONTROL(enable, "Master Playback Switch"),
124 PCSP_MIXER_CONTROL(treble, "BaseFRQ Playback Volume"), 124 PCSP_MIXER_CONTROL(treble, "BaseFRQ Playback Volume"),
125}; 125};
126 126
127static struct snd_kcontrol_new __devinitdata snd_pcsp_controls_spkr[] = { 127static struct snd_kcontrol_new snd_pcsp_controls_spkr[] = {
128 PCSP_MIXER_CONTROL(pcspkr, "Beep Playback Switch"), 128 PCSP_MIXER_CONTROL(pcspkr, "Beep Playback Switch"),
129}; 129};
130 130
131static int __devinit snd_pcsp_ctls_add(struct snd_pcsp *chip, 131static int snd_pcsp_ctls_add(struct snd_pcsp *chip,
132 struct snd_kcontrol_new *ctls, int num) 132 struct snd_kcontrol_new *ctls, int num)
133{ 133{
134 int i, err; 134 int i, err;
135 struct snd_card *card = chip->card; 135 struct snd_card *card = chip->card;
@@ -141,7 +141,7 @@ static int __devinit snd_pcsp_ctls_add(struct snd_pcsp *chip,
141 return 0; 141 return 0;
142} 142}
143 143
144int __devinit snd_pcsp_new_mixer(struct snd_pcsp *chip, int nopcm) 144int snd_pcsp_new_mixer(struct snd_pcsp *chip, int nopcm)
145{ 145{
146 int err; 146 int err;
147 struct snd_card *card = chip->card; 147 struct snd_card *card = chip->card;
diff --git a/sound/drivers/portman2x4.c b/sound/drivers/portman2x4.c
index 8364855ed14f..991018df7131 100644
--- a/sound/drivers/portman2x4.c
+++ b/sound/drivers/portman2x4.c
@@ -96,9 +96,9 @@ static int portman_free(struct portman *pm)
96 return 0; 96 return 0;
97} 97}
98 98
99static int __devinit portman_create(struct snd_card *card, 99static int portman_create(struct snd_card *card,
100 struct pardevice *pardev, 100 struct pardevice *pardev,
101 struct portman **rchip) 101 struct portman **rchip)
102{ 102{
103 struct portman *pm; 103 struct portman *pm;
104 104
@@ -561,7 +561,7 @@ static struct snd_rawmidi_ops snd_portman_midi_input = {
561}; 561};
562 562
563/* Create and initialize the rawmidi component */ 563/* Create and initialize the rawmidi component */
564static int __devinit snd_portman_rawmidi_create(struct snd_card *card) 564static int snd_portman_rawmidi_create(struct snd_card *card)
565{ 565{
566 struct portman *pm = card->private_data; 566 struct portman *pm = card->private_data;
567 struct snd_rawmidi *rmidi; 567 struct snd_rawmidi *rmidi;
@@ -648,7 +648,7 @@ static void snd_portman_interrupt(void *userdata)
648 spin_unlock(&pm->reg_lock); 648 spin_unlock(&pm->reg_lock);
649} 649}
650 650
651static int __devinit snd_portman_probe_port(struct parport *p) 651static int snd_portman_probe_port(struct parport *p)
652{ 652{
653 struct pardevice *pardev; 653 struct pardevice *pardev;
654 int res; 654 int res;
@@ -672,7 +672,7 @@ static int __devinit snd_portman_probe_port(struct parport *p)
672 return res ? -EIO : 0; 672 return res ? -EIO : 0;
673} 673}
674 674
675static void __devinit snd_portman_attach(struct parport *p) 675static void snd_portman_attach(struct parport *p)
676{ 676{
677 struct platform_device *device; 677 struct platform_device *device;
678 678
@@ -728,7 +728,7 @@ static void snd_portman_card_private_free(struct snd_card *card)
728 portman_free(pm); 728 portman_free(pm);
729} 729}
730 730
731static int __devinit snd_portman_probe(struct platform_device *pdev) 731static int snd_portman_probe(struct platform_device *pdev)
732{ 732{
733 struct pardevice *pardev; 733 struct pardevice *pardev;
734 struct parport *p; 734 struct parport *p;
@@ -814,7 +814,7 @@ __err:
814 return err; 814 return err;
815} 815}
816 816
817static int __devexit snd_portman_remove(struct platform_device *pdev) 817static int snd_portman_remove(struct platform_device *pdev)
818{ 818{
819 struct snd_card *card = platform_get_drvdata(pdev); 819 struct snd_card *card = platform_get_drvdata(pdev);
820 820
@@ -827,7 +827,7 @@ static int __devexit snd_portman_remove(struct platform_device *pdev)
827 827
828static struct platform_driver snd_portman_driver = { 828static struct platform_driver snd_portman_driver = {
829 .probe = snd_portman_probe, 829 .probe = snd_portman_probe,
830 .remove = __devexit_p(snd_portman_remove), 830 .remove = snd_portman_remove,
831 .driver = { 831 .driver = {
832 .name = PLATFORM_DRIVER, 832 .name = PLATFORM_DRIVER,
833 .owner = THIS_MODULE, 833 .owner = THIS_MODULE,
diff --git a/sound/drivers/serial-u16550.c b/sound/drivers/serial-u16550.c
index 86700671d1ac..7425dd8c1f09 100644
--- a/sound/drivers/serial-u16550.c
+++ b/sound/drivers/serial-u16550.c
@@ -328,7 +328,7 @@ static void snd_uart16550_buffer_timer(unsigned long data)
328 * return 0 if found 328 * return 0 if found
329 * return negative error if not found 329 * return negative error if not found
330 */ 330 */
331static int __devinit snd_uart16550_detect(struct snd_uart16550 *uart) 331static int snd_uart16550_detect(struct snd_uart16550 *uart)
332{ 332{
333 unsigned long io_base = uart->base; 333 unsigned long io_base = uart->base;
334 int ok; 334 int ok;
@@ -783,14 +783,14 @@ static int snd_uart16550_dev_free(struct snd_device *device)
783 return snd_uart16550_free(uart); 783 return snd_uart16550_free(uart);
784} 784}
785 785
786static int __devinit snd_uart16550_create(struct snd_card *card, 786static int snd_uart16550_create(struct snd_card *card,
787 unsigned long iobase, 787 unsigned long iobase,
788 int irq, 788 int irq,
789 unsigned int speed, 789 unsigned int speed,
790 unsigned int base, 790 unsigned int base,
791 int adaptor, 791 int adaptor,
792 int droponfull, 792 int droponfull,
793 struct snd_uart16550 **ruart) 793 struct snd_uart16550 **ruart)
794{ 794{
795 static struct snd_device_ops ops = { 795 static struct snd_device_ops ops = {
796 .dev_free = snd_uart16550_dev_free, 796 .dev_free = snd_uart16550_dev_free,
@@ -863,7 +863,7 @@ static int __devinit snd_uart16550_create(struct snd_card *card,
863 return 0; 863 return 0;
864} 864}
865 865
866static void __devinit snd_uart16550_substreams(struct snd_rawmidi_str *stream) 866static void snd_uart16550_substreams(struct snd_rawmidi_str *stream)
867{ 867{
868 struct snd_rawmidi_substream *substream; 868 struct snd_rawmidi_substream *substream;
869 869
@@ -872,9 +872,9 @@ static void __devinit snd_uart16550_substreams(struct snd_rawmidi_str *stream)
872 } 872 }
873} 873}
874 874
875static int __devinit snd_uart16550_rmidi(struct snd_uart16550 *uart, int device, 875static int snd_uart16550_rmidi(struct snd_uart16550 *uart, int device,
876 int outs, int ins, 876 int outs, int ins,
877 struct snd_rawmidi **rmidi) 877 struct snd_rawmidi **rmidi)
878{ 878{
879 struct snd_rawmidi *rrawmidi; 879 struct snd_rawmidi *rrawmidi;
880 int err; 880 int err;
@@ -899,7 +899,7 @@ static int __devinit snd_uart16550_rmidi(struct snd_uart16550 *uart, int device,
899 return 0; 899 return 0;
900} 900}
901 901
902static int __devinit snd_serial_probe(struct platform_device *devptr) 902static int snd_serial_probe(struct platform_device *devptr)
903{ 903{
904 struct snd_card *card; 904 struct snd_card *card;
905 struct snd_uart16550 *uart; 905 struct snd_uart16550 *uart;
@@ -982,7 +982,7 @@ static int __devinit snd_serial_probe(struct platform_device *devptr)
982 return err; 982 return err;
983} 983}
984 984
985static int __devexit snd_serial_remove(struct platform_device *devptr) 985static int snd_serial_remove(struct platform_device *devptr)
986{ 986{
987 snd_card_free(platform_get_drvdata(devptr)); 987 snd_card_free(platform_get_drvdata(devptr));
988 platform_set_drvdata(devptr, NULL); 988 platform_set_drvdata(devptr, NULL);
@@ -993,7 +993,7 @@ static int __devexit snd_serial_remove(struct platform_device *devptr)
993 993
994static struct platform_driver snd_serial_driver = { 994static struct platform_driver snd_serial_driver = {
995 .probe = snd_serial_probe, 995 .probe = snd_serial_probe,
996 .remove = __devexit_p( snd_serial_remove), 996 .remove = snd_serial_remove,
997 .driver = { 997 .driver = {
998 .name = SND_SERIAL_DRIVER, 998 .name = SND_SERIAL_DRIVER,
999 .owner = THIS_MODULE, 999 .owner = THIS_MODULE,
diff --git a/sound/drivers/virmidi.c b/sound/drivers/virmidi.c
index d7d514df9058..cc4be88d7318 100644
--- a/sound/drivers/virmidi.c
+++ b/sound/drivers/virmidi.c
@@ -83,7 +83,7 @@ struct snd_card_virmidi {
83static struct platform_device *devices[SNDRV_CARDS]; 83static struct platform_device *devices[SNDRV_CARDS];
84 84
85 85
86static int __devinit snd_virmidi_probe(struct platform_device *devptr) 86static int snd_virmidi_probe(struct platform_device *devptr)
87{ 87{
88 struct snd_card *card; 88 struct snd_card *card;
89 struct snd_card_virmidi *vmidi; 89 struct snd_card_virmidi *vmidi;
@@ -129,7 +129,7 @@ static int __devinit snd_virmidi_probe(struct platform_device *devptr)
129 return err; 129 return err;
130} 130}
131 131
132static int __devexit snd_virmidi_remove(struct platform_device *devptr) 132static int snd_virmidi_remove(struct platform_device *devptr)
133{ 133{
134 snd_card_free(platform_get_drvdata(devptr)); 134 snd_card_free(platform_get_drvdata(devptr));
135 platform_set_drvdata(devptr, NULL); 135 platform_set_drvdata(devptr, NULL);
@@ -140,7 +140,7 @@ static int __devexit snd_virmidi_remove(struct platform_device *devptr)
140 140
141static struct platform_driver snd_virmidi_driver = { 141static struct platform_driver snd_virmidi_driver = {
142 .probe = snd_virmidi_probe, 142 .probe = snd_virmidi_probe,
143 .remove = __devexit_p(snd_virmidi_remove), 143 .remove = snd_virmidi_remove,
144 .driver = { 144 .driver = {
145 .name = SND_VIRMIDI_DRIVER, 145 .name = SND_VIRMIDI_DRIVER,
146 .owner = THIS_MODULE, 146 .owner = THIS_MODULE,
diff --git a/sound/drivers/vx/vx_hwdep.c b/sound/drivers/vx/vx_hwdep.c
index 4a1fae99ac55..3014b86362bd 100644
--- a/sound/drivers/vx/vx_hwdep.c
+++ b/sound/drivers/vx/vx_hwdep.c
@@ -29,8 +29,6 @@
29#include <sound/hwdep.h> 29#include <sound/hwdep.h>
30#include <sound/vx_core.h> 30#include <sound/vx_core.h>
31 31
32#ifdef SND_VX_FW_LOADER
33
34MODULE_FIRMWARE("vx/bx_1_vxp.b56"); 32MODULE_FIRMWARE("vx/bx_1_vxp.b56");
35MODULE_FIRMWARE("vx/bx_1_vp4.b56"); 33MODULE_FIRMWARE("vx/bx_1_vp4.b56");
36MODULE_FIRMWARE("vx/x1_1_vx2.xlx"); 34MODULE_FIRMWARE("vx/x1_1_vx2.xlx");
@@ -119,142 +117,5 @@ void snd_vx_free_firmware(struct vx_core *chip)
119#endif 117#endif
120} 118}
121 119
122#else /* old style firmware loading */
123
124static int vx_hwdep_dsp_status(struct snd_hwdep *hw,
125 struct snd_hwdep_dsp_status *info)
126{
127 static char *type_ids[VX_TYPE_NUMS] = {
128 [VX_TYPE_BOARD] = "vxboard",
129 [VX_TYPE_V2] = "vx222",
130 [VX_TYPE_MIC] = "vx222",
131 [VX_TYPE_VXPOCKET] = "vxpocket",
132 [VX_TYPE_VXP440] = "vxp440",
133 };
134 struct vx_core *vx = hw->private_data;
135
136 if (snd_BUG_ON(!type_ids[vx->type]))
137 return -EINVAL;
138 strcpy(info->id, type_ids[vx->type]);
139 if (vx_is_pcmcia(vx))
140 info->num_dsps = 4;
141 else
142 info->num_dsps = 3;
143 if (vx->chip_status & VX_STAT_CHIP_INIT)
144 info->chip_ready = 1;
145 info->version = VX_DRIVER_VERSION;
146 return 0;
147}
148
149static void free_fw(const struct firmware *fw)
150{
151 if (fw) {
152 vfree(fw->data);
153 kfree(fw);
154 }
155}
156
157static int vx_hwdep_dsp_load(struct snd_hwdep *hw,
158 struct snd_hwdep_dsp_image *dsp)
159{
160 struct vx_core *vx = hw->private_data;
161 int index, err;
162 struct firmware *fw;
163
164 if (snd_BUG_ON(!vx->ops->load_dsp))
165 return -ENXIO;
166
167 fw = kmalloc(sizeof(*fw), GFP_KERNEL);
168 if (! fw) {
169 snd_printk(KERN_ERR "cannot allocate firmware\n");
170 return -ENOMEM;
171 }
172 fw->size = dsp->length;
173 fw->data = vmalloc(fw->size);
174 if (! fw->data) {
175 snd_printk(KERN_ERR "cannot allocate firmware image (length=%d)\n",
176 (int)fw->size);
177 kfree(fw);
178 return -ENOMEM;
179 }
180 if (copy_from_user((void *)fw->data, dsp->image, dsp->length)) {
181 free_fw(fw);
182 return -EFAULT;
183 }
184
185 index = dsp->index;
186 if (! vx_is_pcmcia(vx))
187 index++;
188 err = vx->ops->load_dsp(vx, index, fw);
189 if (err < 0) {
190 free_fw(fw);
191 return err;
192 }
193#ifdef CONFIG_PM
194 vx->firmware[index] = fw;
195#else
196 free_fw(fw);
197#endif
198
199 if (index == 1)
200 vx->chip_status |= VX_STAT_XILINX_LOADED;
201 if (index < 3)
202 return 0;
203
204 /* ok, we reached to the last one */
205 /* create the devices if not built yet */
206 if (! (vx->chip_status & VX_STAT_DEVICE_INIT)) {
207 if ((err = snd_vx_pcm_new(vx)) < 0)
208 return err;
209
210 if ((err = snd_vx_mixer_new(vx)) < 0)
211 return err;
212
213 if (vx->ops->add_controls)
214 if ((err = vx->ops->add_controls(vx)) < 0)
215 return err;
216
217 if ((err = snd_card_register(vx->card)) < 0)
218 return err;
219
220 vx->chip_status |= VX_STAT_DEVICE_INIT;
221 }
222 vx->chip_status |= VX_STAT_CHIP_INIT;
223 return 0;
224}
225
226
227/* exported */
228int snd_vx_setup_firmware(struct vx_core *chip)
229{
230 int err;
231 struct snd_hwdep *hw;
232
233 if ((err = snd_hwdep_new(chip->card, SND_VX_HWDEP_ID, 0, &hw)) < 0)
234 return err;
235
236 hw->iface = SNDRV_HWDEP_IFACE_VX;
237 hw->private_data = chip;
238 hw->ops.dsp_status = vx_hwdep_dsp_status;
239 hw->ops.dsp_load = vx_hwdep_dsp_load;
240 hw->exclusive = 1;
241 sprintf(hw->name, "VX Loader (%s)", chip->card->driver);
242 chip->hwdep = hw;
243
244 return snd_card_register(chip->card);
245}
246
247/* exported */
248void snd_vx_free_firmware(struct vx_core *chip)
249{
250#ifdef CONFIG_PM
251 int i;
252 for (i = 0; i < 4; i++)
253 free_fw(chip->firmware[i]);
254#endif
255}
256
257#endif /* SND_VX_FW_LOADER */
258
259EXPORT_SYMBOL(snd_vx_setup_firmware); 120EXPORT_SYMBOL(snd_vx_setup_firmware);
260EXPORT_SYMBOL(snd_vx_free_firmware); 121EXPORT_SYMBOL(snd_vx_free_firmware);
diff --git a/sound/firewire/Kconfig b/sound/firewire/Kconfig
index 26071489970b..ea063e1f8722 100644
--- a/sound/firewire/Kconfig
+++ b/sound/firewire/Kconfig
@@ -33,4 +33,17 @@ config SND_ISIGHT
33 To compile this driver as a module, choose M here: the module 33 To compile this driver as a module, choose M here: the module
34 will be called snd-isight. 34 will be called snd-isight.
35 35
36config SND_SCS1X
37 tristate "Stanton Control System 1 MIDI"
38 select SND_PCM
39 select SND_RAWMIDI
40 select SND_FIREWIRE_LIB
41 help
42 Say Y here to include support for the MIDI ports of the Stanton
43 SCS.1d/SCS.1m DJ controllers. (SCS.1m audio is still handled
44 by FFADO.)
45
46 To compile this driver as a module, choose M here: the module
47 will be called snd-scs1x.
48
36endif # SND_FIREWIRE 49endif # SND_FIREWIRE
diff --git a/sound/firewire/Makefile b/sound/firewire/Makefile
index d71ed8935f76..460179df5bb5 100644
--- a/sound/firewire/Makefile
+++ b/sound/firewire/Makefile
@@ -2,7 +2,9 @@ snd-firewire-lib-objs := lib.o iso-resources.o packets-buffer.o \
2 fcp.o cmp.o amdtp.o 2 fcp.o cmp.o amdtp.o
3snd-firewire-speakers-objs := speakers.o 3snd-firewire-speakers-objs := speakers.o
4snd-isight-objs := isight.o 4snd-isight-objs := isight.o
5snd-scs1x-objs := scs1x.o
5 6
6obj-$(CONFIG_SND_FIREWIRE_LIB) += snd-firewire-lib.o 7obj-$(CONFIG_SND_FIREWIRE_LIB) += snd-firewire-lib.o
7obj-$(CONFIG_SND_FIREWIRE_SPEAKERS) += snd-firewire-speakers.o 8obj-$(CONFIG_SND_FIREWIRE_SPEAKERS) += snd-firewire-speakers.o
8obj-$(CONFIG_SND_ISIGHT) += snd-isight.o 9obj-$(CONFIG_SND_ISIGHT) += snd-isight.o
10obj-$(CONFIG_SND_SCS1X) += snd-scs1x.o
diff --git a/sound/firewire/scs1x.c b/sound/firewire/scs1x.c
new file mode 100644
index 000000000000..844a555c3b1e
--- /dev/null
+++ b/sound/firewire/scs1x.c
@@ -0,0 +1,527 @@
1/*
2 * Stanton Control System 1 MIDI driver
3 *
4 * Copyright (c) Clemens Ladisch <clemens@ladisch.de>
5 * Licensed under the terms of the GNU General Public License, version 2.
6 */
7
8#include <linux/device.h>
9#include <linux/firewire.h>
10#include <linux/firewire-constants.h>
11#include <linux/interrupt.h>
12#include <linux/module.h>
13#include <linux/mod_devicetable.h>
14#include <linux/slab.h>
15#include <linux/string.h>
16#include <linux/wait.h>
17#include <sound/core.h>
18#include <sound/initval.h>
19#include <sound/rawmidi.h>
20#include "lib.h"
21
22#define OUI_STANTON 0x001260
23#define MODEL_SCS_1M 0x001000
24#define MODEL_SCS_1D 0x002000
25
26#define HSS1394_ADDRESS 0xc007dedadadaULL
27#define HSS1394_MAX_PACKET_SIZE 64
28
29#define HSS1394_TAG_USER_DATA 0x00
30#define HSS1394_TAG_CHANGE_ADDRESS 0xf1
31
32struct scs {
33 struct snd_card *card;
34 struct fw_unit *unit;
35 struct fw_address_handler hss_handler;
36 struct fw_transaction transaction;
37 bool transaction_running;
38 bool output_idle;
39 u8 output_status;
40 u8 output_bytes;
41 bool output_escaped;
42 bool output_escape_high_nibble;
43 u8 input_escape_count;
44 struct snd_rawmidi_substream *output;
45 struct snd_rawmidi_substream *input;
46 struct tasklet_struct tasklet;
47 wait_queue_head_t idle_wait;
48 u8 *buffer;
49};
50
51static const u8 sysex_escape_prefix[] = {
52 0xf0, /* SysEx begin */
53 0x00, 0x01, 0x60, /* Stanton DJ */
54 0x48, 0x53, 0x53, /* "HSS" */
55};
56
57static int scs_output_open(struct snd_rawmidi_substream *stream)
58{
59 struct scs *scs = stream->rmidi->private_data;
60
61 scs->output_status = 0;
62 scs->output_bytes = 1;
63 scs->output_escaped = false;
64
65 return 0;
66}
67
68static int scs_output_close(struct snd_rawmidi_substream *stream)
69{
70 return 0;
71}
72
73static void scs_output_trigger(struct snd_rawmidi_substream *stream, int up)
74{
75 struct scs *scs = stream->rmidi->private_data;
76
77 ACCESS_ONCE(scs->output) = up ? stream : NULL;
78 if (up) {
79 scs->output_idle = false;
80 tasklet_schedule(&scs->tasklet);
81 }
82}
83
84static void scs_write_callback(struct fw_card *card, int rcode,
85 void *data, size_t length, void *callback_data)
86{
87 struct scs *scs = callback_data;
88
89 if (rcode == RCODE_GENERATION) {
90 /* TODO: retry this packet */
91 }
92
93 scs->transaction_running = false;
94 tasklet_schedule(&scs->tasklet);
95}
96
97static bool is_valid_running_status(u8 status)
98{
99 return status >= 0x80 && status <= 0xef;
100}
101
102static bool is_one_byte_cmd(u8 status)
103{
104 return status == 0xf6 ||
105 status >= 0xf8;
106}
107
108static bool is_two_bytes_cmd(u8 status)
109{
110 return (status >= 0xc0 && status <= 0xdf) ||
111 status == 0xf1 ||
112 status == 0xf3;
113}
114
115static bool is_three_bytes_cmd(u8 status)
116{
117 return (status >= 0x80 && status <= 0xbf) ||
118 (status >= 0xe0 && status <= 0xef) ||
119 status == 0xf2;
120}
121
122static bool is_invalid_cmd(u8 status)
123{
124 return status == 0xf4 ||
125 status == 0xf5 ||
126 status == 0xf9 ||
127 status == 0xfd;
128}
129
130static void scs_output_tasklet(unsigned long data)
131{
132 struct scs *scs = (void *)data;
133 struct snd_rawmidi_substream *stream;
134 unsigned int i;
135 u8 byte;
136 struct fw_device *dev;
137 int generation;
138
139 if (scs->transaction_running)
140 return;
141
142 stream = ACCESS_ONCE(scs->output);
143 if (!stream) {
144 scs->output_idle = true;
145 wake_up(&scs->idle_wait);
146 return;
147 }
148
149 i = scs->output_bytes;
150 for (;;) {
151 if (snd_rawmidi_transmit(stream, &byte, 1) != 1) {
152 scs->output_bytes = i;
153 scs->output_idle = true;
154 wake_up(&scs->idle_wait);
155 return;
156 }
157 /*
158 * Convert from real MIDI to what I think the device expects (no
159 * running status, one command per packet, unescaped SysExs).
160 */
161 if (scs->output_escaped && byte < 0x80) {
162 if (scs->output_escape_high_nibble) {
163 if (i < HSS1394_MAX_PACKET_SIZE) {
164 scs->buffer[i] = byte << 4;
165 scs->output_escape_high_nibble = false;
166 }
167 } else {
168 scs->buffer[i++] |= byte & 0x0f;
169 scs->output_escape_high_nibble = true;
170 }
171 } else if (byte < 0x80) {
172 if (i == 1) {
173 if (!is_valid_running_status(scs->output_status))
174 continue;
175 scs->buffer[0] = HSS1394_TAG_USER_DATA;
176 scs->buffer[i++] = scs->output_status;
177 }
178 scs->buffer[i++] = byte;
179 if ((i == 3 && is_two_bytes_cmd(scs->output_status)) ||
180 (i == 4 && is_three_bytes_cmd(scs->output_status)))
181 break;
182 if (i == 1 + ARRAY_SIZE(sysex_escape_prefix) &&
183 !memcmp(scs->buffer + 1, sysex_escape_prefix,
184 ARRAY_SIZE(sysex_escape_prefix))) {
185 scs->output_escaped = true;
186 scs->output_escape_high_nibble = true;
187 i = 0;
188 }
189 if (i >= HSS1394_MAX_PACKET_SIZE)
190 i = 1;
191 } else if (byte == 0xf7) {
192 if (scs->output_escaped) {
193 if (i >= 1 && scs->output_escape_high_nibble &&
194 scs->buffer[0] != HSS1394_TAG_CHANGE_ADDRESS)
195 break;
196 } else {
197 if (i > 1 && scs->output_status == 0xf0) {
198 scs->buffer[i++] = 0xf7;
199 break;
200 }
201 }
202 i = 1;
203 scs->output_escaped = false;
204 } else if (!is_invalid_cmd(byte) &&
205 byte < 0xf8) {
206 i = 1;
207 scs->buffer[0] = HSS1394_TAG_USER_DATA;
208 scs->buffer[i++] = byte;
209 scs->output_status = byte;
210 scs->output_escaped = false;
211 if (is_one_byte_cmd(byte))
212 break;
213 }
214 }
215 scs->output_bytes = 1;
216 scs->output_escaped = false;
217
218 scs->transaction_running = true;
219 dev = fw_parent_device(scs->unit);
220 generation = dev->generation;
221 smp_rmb(); /* node_id vs. generation */
222 fw_send_request(dev->card, &scs->transaction, TCODE_WRITE_BLOCK_REQUEST,
223 dev->node_id, generation, dev->max_speed,
224 HSS1394_ADDRESS, scs->buffer, i,
225 scs_write_callback, scs);
226}
227
228static void scs_output_drain(struct snd_rawmidi_substream *stream)
229{
230 struct scs *scs = stream->rmidi->private_data;
231
232 wait_event(scs->idle_wait, scs->output_idle);
233}
234
235static struct snd_rawmidi_ops output_ops = {
236 .open = scs_output_open,
237 .close = scs_output_close,
238 .trigger = scs_output_trigger,
239 .drain = scs_output_drain,
240};
241
242static int scs_input_open(struct snd_rawmidi_substream *stream)
243{
244 struct scs *scs = stream->rmidi->private_data;
245
246 scs->input_escape_count = 0;
247
248 return 0;
249}
250
251static int scs_input_close(struct snd_rawmidi_substream *stream)
252{
253 return 0;
254}
255
256static void scs_input_trigger(struct snd_rawmidi_substream *stream, int up)
257{
258 struct scs *scs = stream->rmidi->private_data;
259
260 ACCESS_ONCE(scs->input) = up ? stream : NULL;
261}
262
263static void scs_input_escaped_byte(struct snd_rawmidi_substream *stream,
264 u8 byte)
265{
266 u8 nibbles[2];
267
268 nibbles[0] = byte >> 4;
269 nibbles[1] = byte & 0x0f;
270 snd_rawmidi_receive(stream, nibbles, 2);
271}
272
273static void scs_input_midi_byte(struct scs *scs,
274 struct snd_rawmidi_substream *stream,
275 u8 byte)
276{
277 if (scs->input_escape_count > 0) {
278 scs_input_escaped_byte(stream, byte);
279 scs->input_escape_count--;
280 if (scs->input_escape_count == 0)
281 snd_rawmidi_receive(stream, (const u8[]) { 0xf7 }, 1);
282 } else if (byte == 0xf9) {
283 snd_rawmidi_receive(stream, sysex_escape_prefix,
284 ARRAY_SIZE(sysex_escape_prefix));
285 scs_input_escaped_byte(stream, 0x00);
286 scs_input_escaped_byte(stream, 0xf9);
287 scs->input_escape_count = 3;
288 } else {
289 snd_rawmidi_receive(stream, &byte, 1);
290 }
291}
292
293static void scs_input_packet(struct scs *scs,
294 struct snd_rawmidi_substream *stream,
295 const u8 *data, unsigned int bytes)
296{
297 unsigned int i;
298
299 if (data[0] == HSS1394_TAG_USER_DATA) {
300 for (i = 1; i < bytes; ++i)
301 scs_input_midi_byte(scs, stream, data[i]);
302 } else {
303 snd_rawmidi_receive(stream, sysex_escape_prefix,
304 ARRAY_SIZE(sysex_escape_prefix));
305 for (i = 0; i < bytes; ++i)
306 scs_input_escaped_byte(stream, data[i]);
307 snd_rawmidi_receive(stream, (const u8[]) { 0xf7 }, 1);
308 }
309}
310
311static struct snd_rawmidi_ops input_ops = {
312 .open = scs_input_open,
313 .close = scs_input_close,
314 .trigger = scs_input_trigger,
315};
316
317static int scs_create_midi(struct scs *scs)
318{
319 struct snd_rawmidi *rmidi;
320 int err;
321
322 err = snd_rawmidi_new(scs->card, "SCS.1x", 0, 1, 1, &rmidi);
323 if (err < 0)
324 return err;
325 snprintf(rmidi->name, sizeof(rmidi->name),
326 "%s MIDI", scs->card->shortname);
327 rmidi->info_flags = SNDRV_RAWMIDI_INFO_OUTPUT |
328 SNDRV_RAWMIDI_INFO_INPUT |
329 SNDRV_RAWMIDI_INFO_DUPLEX;
330 rmidi->private_data = scs;
331 snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_OUTPUT, &output_ops);
332 snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_INPUT, &input_ops);
333
334 return 0;
335}
336
337static void handle_hss(struct fw_card *card, struct fw_request *request,
338 int tcode, int destination, int source, int generation,
339 unsigned long long offset, void *data, size_t length,
340 void *callback_data)
341{
342 struct scs *scs = callback_data;
343 struct snd_rawmidi_substream *stream;
344
345 if (offset != scs->hss_handler.offset) {
346 fw_send_response(card, request, RCODE_ADDRESS_ERROR);
347 return;
348 }
349 if (tcode != TCODE_WRITE_QUADLET_REQUEST &&
350 tcode != TCODE_WRITE_BLOCK_REQUEST) {
351 fw_send_response(card, request, RCODE_TYPE_ERROR);
352 return;
353 }
354
355 if (length >= 1) {
356 stream = ACCESS_ONCE(scs->input);
357 if (stream)
358 scs_input_packet(scs, stream, data, length);
359 }
360
361 fw_send_response(card, request, RCODE_COMPLETE);
362}
363
364static int scs_init_hss_address(struct scs *scs)
365{
366 __be64 data;
367 int err;
368
369 data = cpu_to_be64(((u64)HSS1394_TAG_CHANGE_ADDRESS << 56) |
370 scs->hss_handler.offset);
371 err = snd_fw_transaction(scs->unit, TCODE_WRITE_BLOCK_REQUEST,
372 HSS1394_ADDRESS, &data, 8);
373 if (err < 0)
374 dev_err(&scs->unit->device, "HSS1394 communication failed\n");
375
376 return err;
377}
378
379static void scs_card_free(struct snd_card *card)
380{
381 struct scs *scs = card->private_data;
382
383 fw_core_remove_address_handler(&scs->hss_handler);
384 kfree(scs->buffer);
385}
386
387static int scs_probe(struct device *unit_dev)
388{
389 struct fw_unit *unit = fw_unit(unit_dev);
390 struct fw_device *fw_dev = fw_parent_device(unit);
391 struct snd_card *card;
392 struct scs *scs;
393 int err;
394
395 err = snd_card_create(-16, NULL, THIS_MODULE, sizeof(*scs), &card);
396 if (err < 0)
397 return err;
398 snd_card_set_dev(card, unit_dev);
399
400 scs = card->private_data;
401 scs->card = card;
402 scs->unit = unit;
403 tasklet_init(&scs->tasklet, scs_output_tasklet, (unsigned long)scs);
404 init_waitqueue_head(&scs->idle_wait);
405 scs->output_idle = true;
406
407 scs->buffer = kmalloc(HSS1394_MAX_PACKET_SIZE, GFP_KERNEL);
408 if (!scs->buffer)
409 goto err_card;
410
411 scs->hss_handler.length = HSS1394_MAX_PACKET_SIZE;
412 scs->hss_handler.address_callback = handle_hss;
413 scs->hss_handler.callback_data = scs;
414 err = fw_core_add_address_handler(&scs->hss_handler,
415 &fw_high_memory_region);
416 if (err < 0)
417 goto err_buffer;
418
419 card->private_free = scs_card_free;
420
421 strcpy(card->driver, "SCS.1x");
422 strcpy(card->shortname, "SCS.1x");
423 fw_csr_string(unit->directory, CSR_MODEL,
424 card->shortname, sizeof(card->shortname));
425 snprintf(card->longname, sizeof(card->longname),
426 "Stanton DJ %s (GUID %08x%08x) at %s, S%d",
427 card->shortname, fw_dev->config_rom[3], fw_dev->config_rom[4],
428 dev_name(&unit->device), 100 << fw_dev->max_speed);
429 strcpy(card->mixername, card->shortname);
430
431 err = scs_init_hss_address(scs);
432 if (err < 0)
433 goto err_card;
434
435 err = scs_create_midi(scs);
436 if (err < 0)
437 goto err_card;
438
439 err = snd_card_register(card);
440 if (err < 0)
441 goto err_card;
442
443 dev_set_drvdata(unit_dev, scs);
444
445 return 0;
446
447err_buffer:
448 kfree(scs->buffer);
449err_card:
450 snd_card_free(card);
451 return err;
452}
453
454static int scs_remove(struct device *dev)
455{
456 struct scs *scs = dev_get_drvdata(dev);
457
458 snd_card_disconnect(scs->card);
459
460 ACCESS_ONCE(scs->output) = NULL;
461 ACCESS_ONCE(scs->input) = NULL;
462
463 wait_event(scs->idle_wait, scs->output_idle);
464
465 tasklet_kill(&scs->tasklet);
466
467 snd_card_free_when_closed(scs->card);
468
469 return 0;
470}
471
472static void scs_update(struct fw_unit *unit)
473{
474 struct scs *scs = dev_get_drvdata(&unit->device);
475 __be64 data;
476
477 data = cpu_to_be64(((u64)HSS1394_TAG_CHANGE_ADDRESS << 56) |
478 scs->hss_handler.offset);
479 snd_fw_transaction(scs->unit, TCODE_WRITE_BLOCK_REQUEST,
480 HSS1394_ADDRESS, &data, 8);
481}
482
483static const struct ieee1394_device_id scs_id_table[] = {
484 {
485 .match_flags = IEEE1394_MATCH_VENDOR_ID |
486 IEEE1394_MATCH_MODEL_ID,
487 .vendor_id = OUI_STANTON,
488 .model_id = MODEL_SCS_1M,
489 },
490 {
491 .match_flags = IEEE1394_MATCH_VENDOR_ID |
492 IEEE1394_MATCH_MODEL_ID,
493 .vendor_id = OUI_STANTON,
494 .model_id = MODEL_SCS_1D,
495 },
496 {}
497};
498MODULE_DEVICE_TABLE(ieee1394, scs_id_table);
499
500MODULE_DESCRIPTION("SCS.1x MIDI driver");
501MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>");
502MODULE_LICENSE("GPL v2");
503
504static struct fw_driver scs_driver = {
505 .driver = {
506 .owner = THIS_MODULE,
507 .name = KBUILD_MODNAME,
508 .bus = &fw_bus_type,
509 .probe = scs_probe,
510 .remove = scs_remove,
511 },
512 .update = scs_update,
513 .id_table = scs_id_table,
514};
515
516static int __init alsa_scs1x_init(void)
517{
518 return driver_register(&scs_driver.driver);
519}
520
521static void __exit alsa_scs1x_exit(void)
522{
523 driver_unregister(&scs_driver.driver);
524}
525
526module_init(alsa_scs1x_init);
527module_exit(alsa_scs1x_exit);
diff --git a/sound/firewire/speakers.c b/sound/firewire/speakers.c
index 297244e658d9..d6846557f270 100644
--- a/sound/firewire/speakers.c
+++ b/sound/firewire/speakers.c
@@ -663,7 +663,7 @@ static void fwspk_card_free(struct snd_card *card)
663 mutex_destroy(&fwspk->mutex); 663 mutex_destroy(&fwspk->mutex);
664} 664}
665 665
666static const struct device_info *__devinit fwspk_detect(struct fw_device *dev) 666static const struct device_info *fwspk_detect(struct fw_device *dev)
667{ 667{
668 static const struct device_info griffin_firewave = { 668 static const struct device_info griffin_firewave = {
669 .driver_name = "FireWave", 669 .driver_name = "FireWave",
@@ -699,7 +699,7 @@ static const struct device_info *__devinit fwspk_detect(struct fw_device *dev)
699 return NULL; 699 return NULL;
700} 700}
701 701
702static int __devinit fwspk_probe(struct device *unit_dev) 702static int fwspk_probe(struct device *unit_dev)
703{ 703{
704 struct fw_unit *unit = fw_unit(unit_dev); 704 struct fw_unit *unit = fw_unit(unit_dev);
705 struct fw_device *fw_dev = fw_parent_device(unit); 705 struct fw_device *fw_dev = fw_parent_device(unit);
@@ -770,7 +770,7 @@ error:
770 return err; 770 return err;
771} 771}
772 772
773static int __devexit fwspk_remove(struct device *dev) 773static int fwspk_remove(struct device *dev)
774{ 774{
775 struct fwspk *fwspk = dev_get_drvdata(dev); 775 struct fwspk *fwspk = dev_get_drvdata(dev);
776 776
@@ -834,7 +834,7 @@ static struct fw_driver fwspk_driver = {
834 .name = KBUILD_MODNAME, 834 .name = KBUILD_MODNAME,
835 .bus = &fw_bus_type, 835 .bus = &fw_bus_type,
836 .probe = fwspk_probe, 836 .probe = fwspk_probe,
837 .remove = __devexit_p(fwspk_remove), 837 .remove = fwspk_remove,
838 }, 838 },
839 .update = fwspk_bus_reset, 839 .update = fwspk_bus_reset,
840 .id_table = fwspk_id_table, 840 .id_table = fwspk_id_table,
diff --git a/sound/isa/Kconfig b/sound/isa/Kconfig
index a38d9643e9d8..affa13480659 100644
--- a/sound/isa/Kconfig
+++ b/sound/isa/Kconfig
@@ -425,7 +425,7 @@ config SND_WAVEFRONT
425 425
426config SND_MSND_PINNACLE 426config SND_MSND_PINNACLE
427 tristate "Turtle Beach MultiSound Pinnacle/Fiji driver" 427 tristate "Turtle Beach MultiSound Pinnacle/Fiji driver"
428 depends on X86 && EXPERIMENTAL 428 depends on X86
429 select FW_LOADER 429 select FW_LOADER
430 select SND_MPU401_UART 430 select SND_MPU401_UART
431 select SND_PCM 431 select SND_PCM
@@ -438,7 +438,7 @@ config SND_MSND_PINNACLE
438 438
439config SND_MSND_CLASSIC 439config SND_MSND_CLASSIC
440 tristate "Support for Turtle Beach MultiSound Classic, Tahiti, Monterey" 440 tristate "Support for Turtle Beach MultiSound Classic, Tahiti, Monterey"
441 depends on X86 && EXPERIMENTAL 441 depends on X86
442 select FW_LOADER 442 select FW_LOADER
443 select SND_MPU401_UART 443 select SND_MPU401_UART
444 select SND_PCM 444 select SND_PCM
diff --git a/sound/isa/ad1816a/ad1816a.c b/sound/isa/ad1816a/ad1816a.c
index 2c2f829c3fd7..26ce26a5884d 100644
--- a/sound/isa/ad1816a/ad1816a.c
+++ b/sound/isa/ad1816a/ad1816a.c
@@ -94,8 +94,8 @@ MODULE_DEVICE_TABLE(pnp_card, snd_ad1816a_pnpids);
94#define DRIVER_NAME "snd-card-ad1816a" 94#define DRIVER_NAME "snd-card-ad1816a"
95 95
96 96
97static int __devinit snd_card_ad1816a_pnp(int dev, struct pnp_card_link *card, 97static int snd_card_ad1816a_pnp(int dev, struct pnp_card_link *card,
98 const struct pnp_card_device_id *id) 98 const struct pnp_card_device_id *id)
99{ 99{
100 struct pnp_dev *pdev; 100 struct pnp_dev *pdev;
101 int err; 101 int err;
@@ -135,8 +135,8 @@ static int __devinit snd_card_ad1816a_pnp(int dev, struct pnp_card_link *card,
135 return 0; 135 return 0;
136} 136}
137 137
138static int __devinit snd_card_ad1816a_probe(int dev, struct pnp_card_link *pcard, 138static int snd_card_ad1816a_probe(int dev, struct pnp_card_link *pcard,
139 const struct pnp_card_device_id *pid) 139 const struct pnp_card_device_id *pid)
140{ 140{
141 int error; 141 int error;
142 struct snd_card *card; 142 struct snd_card *card;
@@ -217,10 +217,10 @@ static int __devinit snd_card_ad1816a_probe(int dev, struct pnp_card_link *pcard
217 return 0; 217 return 0;
218} 218}
219 219
220static unsigned int __devinitdata ad1816a_devices; 220static unsigned int ad1816a_devices;
221 221
222static int __devinit snd_ad1816a_pnp_detect(struct pnp_card_link *card, 222static int snd_ad1816a_pnp_detect(struct pnp_card_link *card,
223 const struct pnp_card_device_id *id) 223 const struct pnp_card_device_id *id)
224{ 224{
225 static int dev; 225 static int dev;
226 int res; 226 int res;
@@ -238,7 +238,7 @@ static int __devinit snd_ad1816a_pnp_detect(struct pnp_card_link *card,
238 return -ENODEV; 238 return -ENODEV;
239} 239}
240 240
241static void __devexit snd_ad1816a_pnp_remove(struct pnp_card_link * pcard) 241static void snd_ad1816a_pnp_remove(struct pnp_card_link *pcard)
242{ 242{
243 snd_card_free(pnp_get_card_drvdata(pcard)); 243 snd_card_free(pnp_get_card_drvdata(pcard));
244 pnp_set_card_drvdata(pcard, NULL); 244 pnp_set_card_drvdata(pcard, NULL);
@@ -270,7 +270,7 @@ static struct pnp_card_driver ad1816a_pnpc_driver = {
270 .name = "ad1816a", 270 .name = "ad1816a",
271 .id_table = snd_ad1816a_pnpids, 271 .id_table = snd_ad1816a_pnpids,
272 .probe = snd_ad1816a_pnp_detect, 272 .probe = snd_ad1816a_pnp_detect,
273 .remove = __devexit_p(snd_ad1816a_pnp_remove), 273 .remove = snd_ad1816a_pnp_remove,
274#ifdef CONFIG_PM 274#ifdef CONFIG_PM
275 .suspend = snd_ad1816a_pnp_suspend, 275 .suspend = snd_ad1816a_pnp_suspend,
276 .resume = snd_ad1816a_pnp_resume, 276 .resume = snd_ad1816a_pnp_resume,
diff --git a/sound/isa/ad1816a/ad1816a_lib.c b/sound/isa/ad1816a/ad1816a_lib.c
index db64df6023e0..f0fd98e695e3 100644
--- a/sound/isa/ad1816a/ad1816a_lib.c
+++ b/sound/isa/ad1816a/ad1816a_lib.c
@@ -537,7 +537,7 @@ void snd_ad1816a_resume(struct snd_ad1816a *chip)
537} 537}
538#endif 538#endif
539 539
540static int __devinit snd_ad1816a_probe(struct snd_ad1816a *chip) 540static int snd_ad1816a_probe(struct snd_ad1816a *chip)
541{ 541{
542 unsigned long flags; 542 unsigned long flags;
543 543
@@ -583,7 +583,7 @@ static int snd_ad1816a_dev_free(struct snd_device *device)
583 return snd_ad1816a_free(chip); 583 return snd_ad1816a_free(chip);
584} 584}
585 585
586static const char __devinit *snd_ad1816a_chip_id(struct snd_ad1816a *chip) 586static const char *snd_ad1816a_chip_id(struct snd_ad1816a *chip)
587{ 587{
588 switch (chip->hardware) { 588 switch (chip->hardware) {
589 case AD1816A_HW_AD1816A: return "AD1816A"; 589 case AD1816A_HW_AD1816A: return "AD1816A";
@@ -596,9 +596,9 @@ static const char __devinit *snd_ad1816a_chip_id(struct snd_ad1816a *chip)
596 } 596 }
597} 597}
598 598
599int __devinit snd_ad1816a_create(struct snd_card *card, 599int snd_ad1816a_create(struct snd_card *card,
600 unsigned long port, int irq, int dma1, int dma2, 600 unsigned long port, int irq, int dma1, int dma2,
601 struct snd_ad1816a *chip) 601 struct snd_ad1816a *chip)
602{ 602{
603 static struct snd_device_ops ops = { 603 static struct snd_device_ops ops = {
604 .dev_free = snd_ad1816a_dev_free, 604 .dev_free = snd_ad1816a_dev_free,
@@ -675,7 +675,7 @@ static struct snd_pcm_ops snd_ad1816a_capture_ops = {
675 .pointer = snd_ad1816a_capture_pointer, 675 .pointer = snd_ad1816a_capture_pointer,
676}; 676};
677 677
678int __devinit snd_ad1816a_pcm(struct snd_ad1816a *chip, int device, struct snd_pcm **rpcm) 678int snd_ad1816a_pcm(struct snd_ad1816a *chip, int device, struct snd_pcm **rpcm)
679{ 679{
680 int error; 680 int error;
681 struct snd_pcm *pcm; 681 struct snd_pcm *pcm;
@@ -702,7 +702,8 @@ int __devinit snd_ad1816a_pcm(struct snd_ad1816a *chip, int device, struct snd_p
702 return 0; 702 return 0;
703} 703}
704 704
705int __devinit snd_ad1816a_timer(struct snd_ad1816a *chip, int device, struct snd_timer **rtimer) 705int snd_ad1816a_timer(struct snd_ad1816a *chip, int device,
706 struct snd_timer **rtimer)
706{ 707{
707 struct snd_timer *timer; 708 struct snd_timer *timer;
708 struct snd_timer_id tid; 709 struct snd_timer_id tid;
@@ -923,7 +924,7 @@ static const DECLARE_TLV_DB_SCALE(db_scale_6bit, -9450, 150, 0);
923static const DECLARE_TLV_DB_SCALE(db_scale_5bit_12db_max, -3450, 150, 0); 924static const DECLARE_TLV_DB_SCALE(db_scale_5bit_12db_max, -3450, 150, 0);
924static const DECLARE_TLV_DB_SCALE(db_scale_rec_gain, 0, 150, 0); 925static const DECLARE_TLV_DB_SCALE(db_scale_rec_gain, 0, 150, 0);
925 926
926static struct snd_kcontrol_new snd_ad1816a_controls[] __devinitdata = { 927static struct snd_kcontrol_new snd_ad1816a_controls[] = {
927AD1816A_DOUBLE("Master Playback Switch", AD1816A_MASTER_ATT, 15, 7, 1, 1), 928AD1816A_DOUBLE("Master Playback Switch", AD1816A_MASTER_ATT, 15, 7, 1, 1),
928AD1816A_DOUBLE_TLV("Master Playback Volume", AD1816A_MASTER_ATT, 8, 0, 31, 1, 929AD1816A_DOUBLE_TLV("Master Playback Volume", AD1816A_MASTER_ATT, 8, 0, 31, 1,
929 db_scale_5bit), 930 db_scale_5bit),
@@ -969,7 +970,7 @@ AD1816A_SINGLE("3D Control - Switch", AD1816A_3D_PHAT_CTRL, 15, 1, 1),
969AD1816A_SINGLE("3D Control - Level", AD1816A_3D_PHAT_CTRL, 0, 15, 0), 970AD1816A_SINGLE("3D Control - Level", AD1816A_3D_PHAT_CTRL, 0, 15, 0),
970}; 971};
971 972
972int __devinit snd_ad1816a_mixer(struct snd_ad1816a *chip) 973int snd_ad1816a_mixer(struct snd_ad1816a *chip)
973{ 974{
974 struct snd_card *card; 975 struct snd_card *card;
975 unsigned int idx; 976 unsigned int idx;
diff --git a/sound/isa/ad1848/ad1848.c b/sound/isa/ad1848/ad1848.c
index 2af77faefbb1..c214ecf45400 100644
--- a/sound/isa/ad1848/ad1848.c
+++ b/sound/isa/ad1848/ad1848.c
@@ -64,7 +64,7 @@ MODULE_PARM_DESC(dma1, "DMA1 # for " CRD_NAME " driver.");
64module_param_array(thinkpad, bool, NULL, 0444); 64module_param_array(thinkpad, bool, NULL, 0444);
65MODULE_PARM_DESC(thinkpad, "Enable only for the onboard CS4248 of IBM Thinkpad 360/750/755 series."); 65MODULE_PARM_DESC(thinkpad, "Enable only for the onboard CS4248 of IBM Thinkpad 360/750/755 series.");
66 66
67static int __devinit snd_ad1848_match(struct device *dev, unsigned int n) 67static int snd_ad1848_match(struct device *dev, unsigned int n)
68{ 68{
69 if (!enable[n]) 69 if (!enable[n])
70 return 0; 70 return 0;
@@ -84,7 +84,7 @@ static int __devinit snd_ad1848_match(struct device *dev, unsigned int n)
84 return 1; 84 return 1;
85} 85}
86 86
87static int __devinit snd_ad1848_probe(struct device *dev, unsigned int n) 87static int snd_ad1848_probe(struct device *dev, unsigned int n)
88{ 88{
89 struct snd_card *card; 89 struct snd_card *card;
90 struct snd_wss *chip; 90 struct snd_wss *chip;
@@ -132,7 +132,7 @@ out: snd_card_free(card);
132 return error; 132 return error;
133} 133}
134 134
135static int __devexit snd_ad1848_remove(struct device *dev, unsigned int n) 135static int snd_ad1848_remove(struct device *dev, unsigned int n)
136{ 136{
137 snd_card_free(dev_get_drvdata(dev)); 137 snd_card_free(dev_get_drvdata(dev));
138 dev_set_drvdata(dev, NULL); 138 dev_set_drvdata(dev, NULL);
@@ -164,7 +164,7 @@ static int snd_ad1848_resume(struct device *dev, unsigned int n)
164static struct isa_driver snd_ad1848_driver = { 164static struct isa_driver snd_ad1848_driver = {
165 .match = snd_ad1848_match, 165 .match = snd_ad1848_match,
166 .probe = snd_ad1848_probe, 166 .probe = snd_ad1848_probe,
167 .remove = __devexit_p(snd_ad1848_remove), 167 .remove = snd_ad1848_remove,
168#ifdef CONFIG_PM 168#ifdef CONFIG_PM
169 .suspend = snd_ad1848_suspend, 169 .suspend = snd_ad1848_suspend,
170 .resume = snd_ad1848_resume, 170 .resume = snd_ad1848_resume,
diff --git a/sound/isa/adlib.c b/sound/isa/adlib.c
index 4d50c69f3290..d26545543732 100644
--- a/sound/isa/adlib.c
+++ b/sound/isa/adlib.c
@@ -30,7 +30,7 @@ MODULE_PARM_DESC(enable, "Enable " CRD_NAME " soundcard.");
30module_param_array(port, long, NULL, 0444); 30module_param_array(port, long, NULL, 0444);
31MODULE_PARM_DESC(port, "Port # for " CRD_NAME " driver."); 31MODULE_PARM_DESC(port, "Port # for " CRD_NAME " driver.");
32 32
33static int __devinit snd_adlib_match(struct device *dev, unsigned int n) 33static int snd_adlib_match(struct device *dev, unsigned int n)
34{ 34{
35 if (!enable[n]) 35 if (!enable[n])
36 return 0; 36 return 0;
@@ -47,7 +47,7 @@ static void snd_adlib_free(struct snd_card *card)
47 release_and_free_resource(card->private_data); 47 release_and_free_resource(card->private_data);
48} 48}
49 49
50static int __devinit snd_adlib_probe(struct device *dev, unsigned int n) 50static int snd_adlib_probe(struct device *dev, unsigned int n)
51{ 51{
52 struct snd_card *card; 52 struct snd_card *card;
53 struct snd_opl3 *opl3; 53 struct snd_opl3 *opl3;
@@ -98,7 +98,7 @@ out: snd_card_free(card);
98 return error; 98 return error;
99} 99}
100 100
101static int __devexit snd_adlib_remove(struct device *dev, unsigned int n) 101static int snd_adlib_remove(struct device *dev, unsigned int n)
102{ 102{
103 snd_card_free(dev_get_drvdata(dev)); 103 snd_card_free(dev_get_drvdata(dev));
104 dev_set_drvdata(dev, NULL); 104 dev_set_drvdata(dev, NULL);
@@ -108,7 +108,7 @@ static int __devexit snd_adlib_remove(struct device *dev, unsigned int n)
108static struct isa_driver snd_adlib_driver = { 108static struct isa_driver snd_adlib_driver = {
109 .match = snd_adlib_match, 109 .match = snd_adlib_match,
110 .probe = snd_adlib_probe, 110 .probe = snd_adlib_probe,
111 .remove = __devexit_p(snd_adlib_remove), 111 .remove = snd_adlib_remove,
112 112
113 .driver = { 113 .driver = {
114 .name = DEV_NAME 114 .name = DEV_NAME
diff --git a/sound/isa/als100.c b/sound/isa/als100.c
index f7cdaf51512d..10f08a18fe3b 100644
--- a/sound/isa/als100.c
+++ b/sound/isa/als100.c
@@ -117,9 +117,9 @@ static struct pnp_card_device_id snd_als100_pnpids[] = {
117 117
118MODULE_DEVICE_TABLE(pnp_card, snd_als100_pnpids); 118MODULE_DEVICE_TABLE(pnp_card, snd_als100_pnpids);
119 119
120static int __devinit snd_card_als100_pnp(int dev, struct snd_card_als100 *acard, 120static int snd_card_als100_pnp(int dev, struct snd_card_als100 *acard,
121 struct pnp_card_link *card, 121 struct pnp_card_link *card,
122 const struct pnp_card_device_id *id) 122 const struct pnp_card_device_id *id)
123{ 123{
124 struct pnp_dev *pdev; 124 struct pnp_dev *pdev;
125 int err; 125 int err;
@@ -183,9 +183,9 @@ static int __devinit snd_card_als100_pnp(int dev, struct snd_card_als100 *acard,
183 return 0; 183 return 0;
184} 184}
185 185
186static int __devinit snd_card_als100_probe(int dev, 186static int snd_card_als100_probe(int dev,
187 struct pnp_card_link *pcard, 187 struct pnp_card_link *pcard,
188 const struct pnp_card_device_id *pid) 188 const struct pnp_card_device_id *pid)
189{ 189{
190 int error; 190 int error;
191 struct snd_sb *chip; 191 struct snd_sb *chip;
@@ -286,10 +286,10 @@ static int __devinit snd_card_als100_probe(int dev,
286 return 0; 286 return 0;
287} 287}
288 288
289static unsigned int __devinitdata als100_devices; 289static unsigned int als100_devices;
290 290
291static int __devinit snd_als100_pnp_detect(struct pnp_card_link *card, 291static int snd_als100_pnp_detect(struct pnp_card_link *card,
292 const struct pnp_card_device_id *id) 292 const struct pnp_card_device_id *id)
293{ 293{
294 static int dev; 294 static int dev;
295 int res; 295 int res;
@@ -307,7 +307,7 @@ static int __devinit snd_als100_pnp_detect(struct pnp_card_link *card,
307 return -ENODEV; 307 return -ENODEV;
308} 308}
309 309
310static void __devexit snd_als100_pnp_remove(struct pnp_card_link * pcard) 310static void snd_als100_pnp_remove(struct pnp_card_link *pcard)
311{ 311{
312 snd_card_free(pnp_get_card_drvdata(pcard)); 312 snd_card_free(pnp_get_card_drvdata(pcard));
313 pnp_set_card_drvdata(pcard, NULL); 313 pnp_set_card_drvdata(pcard, NULL);
@@ -344,7 +344,7 @@ static struct pnp_card_driver als100_pnpc_driver = {
344 .name = "als100", 344 .name = "als100",
345 .id_table = snd_als100_pnpids, 345 .id_table = snd_als100_pnpids,
346 .probe = snd_als100_pnp_detect, 346 .probe = snd_als100_pnp_detect,
347 .remove = __devexit_p(snd_als100_pnp_remove), 347 .remove = snd_als100_pnp_remove,
348#ifdef CONFIG_PM 348#ifdef CONFIG_PM
349 .suspend = snd_als100_pnp_suspend, 349 .suspend = snd_als100_pnp_suspend,
350 .resume = snd_als100_pnp_resume, 350 .resume = snd_als100_pnp_resume,
diff --git a/sound/isa/azt2320.c b/sound/isa/azt2320.c
index 6a2c78ef1d8f..db301ff94ec2 100644
--- a/sound/isa/azt2320.c
+++ b/sound/isa/azt2320.c
@@ -99,9 +99,9 @@ MODULE_DEVICE_TABLE(pnp_card, snd_azt2320_pnpids);
99 99
100#define DRIVER_NAME "snd-card-azt2320" 100#define DRIVER_NAME "snd-card-azt2320"
101 101
102static int __devinit snd_card_azt2320_pnp(int dev, struct snd_card_azt2320 *acard, 102static int snd_card_azt2320_pnp(int dev, struct snd_card_azt2320 *acard,
103 struct pnp_card_link *card, 103 struct pnp_card_link *card,
104 const struct pnp_card_device_id *id) 104 const struct pnp_card_device_id *id)
105{ 105{
106 struct pnp_dev *pdev; 106 struct pnp_dev *pdev;
107 int err; 107 int err;
@@ -147,7 +147,7 @@ static int __devinit snd_card_azt2320_pnp(int dev, struct snd_card_azt2320 *acar
147} 147}
148 148
149/* same of snd_sbdsp_command by Jaroslav Kysela */ 149/* same of snd_sbdsp_command by Jaroslav Kysela */
150static int __devinit snd_card_azt2320_command(unsigned long port, unsigned char val) 150static int snd_card_azt2320_command(unsigned long port, unsigned char val)
151{ 151{
152 int i; 152 int i;
153 unsigned long limit; 153 unsigned long limit;
@@ -161,7 +161,7 @@ static int __devinit snd_card_azt2320_command(unsigned long port, unsigned char
161 return -EBUSY; 161 return -EBUSY;
162} 162}
163 163
164static int __devinit snd_card_azt2320_enable_wss(unsigned long port) 164static int snd_card_azt2320_enable_wss(unsigned long port)
165{ 165{
166 int error; 166 int error;
167 167
@@ -174,9 +174,9 @@ static int __devinit snd_card_azt2320_enable_wss(unsigned long port)
174 return 0; 174 return 0;
175} 175}
176 176
177static int __devinit snd_card_azt2320_probe(int dev, 177static int snd_card_azt2320_probe(int dev,
178 struct pnp_card_link *pcard, 178 struct pnp_card_link *pcard,
179 const struct pnp_card_device_id *pid) 179 const struct pnp_card_device_id *pid)
180{ 180{
181 int error; 181 int error;
182 struct snd_card *card; 182 struct snd_card *card;
@@ -264,10 +264,10 @@ static int __devinit snd_card_azt2320_probe(int dev,
264 return 0; 264 return 0;
265} 265}
266 266
267static unsigned int __devinitdata azt2320_devices; 267static unsigned int azt2320_devices;
268 268
269static int __devinit snd_azt2320_pnp_detect(struct pnp_card_link *card, 269static int snd_azt2320_pnp_detect(struct pnp_card_link *card,
270 const struct pnp_card_device_id *id) 270 const struct pnp_card_device_id *id)
271{ 271{
272 static int dev; 272 static int dev;
273 int res; 273 int res;
@@ -285,7 +285,7 @@ static int __devinit snd_azt2320_pnp_detect(struct pnp_card_link *card,
285 return -ENODEV; 285 return -ENODEV;
286} 286}
287 287
288static void __devexit snd_azt2320_pnp_remove(struct pnp_card_link * pcard) 288static void snd_azt2320_pnp_remove(struct pnp_card_link *pcard)
289{ 289{
290 snd_card_free(pnp_get_card_drvdata(pcard)); 290 snd_card_free(pnp_get_card_drvdata(pcard));
291 pnp_set_card_drvdata(pcard, NULL); 291 pnp_set_card_drvdata(pcard, NULL);
@@ -320,7 +320,7 @@ static struct pnp_card_driver azt2320_pnpc_driver = {
320 .name = "azt2320", 320 .name = "azt2320",
321 .id_table = snd_azt2320_pnpids, 321 .id_table = snd_azt2320_pnpids,
322 .probe = snd_azt2320_pnp_detect, 322 .probe = snd_azt2320_pnp_detect,
323 .remove = __devexit_p(snd_azt2320_pnp_remove), 323 .remove = snd_azt2320_pnp_remove,
324#ifdef CONFIG_PM 324#ifdef CONFIG_PM
325 .suspend = snd_azt2320_pnp_suspend, 325 .suspend = snd_azt2320_pnp_suspend,
326 .resume = snd_azt2320_pnp_resume, 326 .resume = snd_azt2320_pnp_resume,
diff --git a/sound/isa/cmi8328.c b/sound/isa/cmi8328.c
index bde60139bb95..a7369fe19a6f 100644
--- a/sound/isa/cmi8328.c
+++ b/sound/isa/cmi8328.c
@@ -140,7 +140,7 @@ static void snd_cmi8328_cfg_restore(u16 port, u8 cfg[])
140 snd_cmi8328_cfg_write(port, CFG3, cfg[2]); 140 snd_cmi8328_cfg_write(port, CFG3, cfg[2]);
141} 141}
142 142
143static int __devinit snd_cmi8328_mixer(struct snd_wss *chip) 143static int snd_cmi8328_mixer(struct snd_wss *chip)
144{ 144{
145 struct snd_card *card; 145 struct snd_card *card;
146 struct snd_ctl_elem_id id1, id2; 146 struct snd_ctl_elem_id id1, id2;
@@ -212,7 +212,7 @@ int array_find_l(long array[], long item)
212 return -1; 212 return -1;
213} 213}
214 214
215static int __devinit snd_cmi8328_probe(struct device *pdev, unsigned int ndev) 215static int snd_cmi8328_probe(struct device *pdev, unsigned int ndev)
216{ 216{
217 struct snd_card *card; 217 struct snd_card *card;
218 struct snd_opl3 *opl3; 218 struct snd_opl3 *opl3;
@@ -401,7 +401,7 @@ error:
401 return err; 401 return err;
402} 402}
403 403
404static int __devexit snd_cmi8328_remove(struct device *pdev, unsigned int dev) 404static int snd_cmi8328_remove(struct device *pdev, unsigned int dev)
405{ 405{
406 struct snd_card *card = dev_get_drvdata(pdev); 406 struct snd_card *card = dev_get_drvdata(pdev);
407 struct snd_cmi8328 *cmi = card->private_data; 407 struct snd_cmi8328 *cmi = card->private_data;
@@ -459,7 +459,7 @@ static int snd_cmi8328_resume(struct device *pdev, unsigned int n)
459 459
460static struct isa_driver snd_cmi8328_driver = { 460static struct isa_driver snd_cmi8328_driver = {
461 .probe = snd_cmi8328_probe, 461 .probe = snd_cmi8328_probe,
462 .remove = __devexit_p(snd_cmi8328_remove), 462 .remove = snd_cmi8328_remove,
463#ifdef CONFIG_PM 463#ifdef CONFIG_PM
464 .suspend = snd_cmi8328_suspend, 464 .suspend = snd_cmi8328_suspend,
465 .resume = snd_cmi8328_resume, 465 .resume = snd_cmi8328_resume,
diff --git a/sound/isa/cmi8330.c b/sound/isa/cmi8330.c
index 7bd5e337ee93..c707c52268ab 100644
--- a/sound/isa/cmi8330.c
+++ b/sound/isa/cmi8330.c
@@ -193,7 +193,7 @@ MODULE_DEVICE_TABLE(pnp_card, snd_cmi8330_pnpids);
193#endif 193#endif
194 194
195 195
196static struct snd_kcontrol_new snd_cmi8330_controls[] __devinitdata = { 196static struct snd_kcontrol_new snd_cmi8330_controls[] = {
197WSS_DOUBLE("Master Playback Volume", 0, 197WSS_DOUBLE("Master Playback Volume", 0,
198 CMI8330_MASTVOL, CMI8330_MASTVOL, 4, 0, 15, 0), 198 CMI8330_MASTVOL, CMI8330_MASTVOL, 4, 0, 15, 0),
199WSS_SINGLE("Loud Playback Switch", 0, 199WSS_SINGLE("Loud Playback Switch", 0,
@@ -249,7 +249,7 @@ WSS_SINGLE(SNDRV_CTL_NAME_IEC958("Input ", PLAYBACK, SWITCH), 0,
249}; 249};
250 250
251#ifdef ENABLE_SB_MIXER 251#ifdef ENABLE_SB_MIXER
252static struct sbmix_elem cmi8330_sb_mixers[] __devinitdata = { 252static struct sbmix_elem cmi8330_sb_mixers[] = {
253SB_DOUBLE("SB Master Playback Volume", SB_DSP4_MASTER_DEV, (SB_DSP4_MASTER_DEV + 1), 3, 3, 31), 253SB_DOUBLE("SB Master Playback Volume", SB_DSP4_MASTER_DEV, (SB_DSP4_MASTER_DEV + 1), 3, 3, 31),
254SB_DOUBLE("Tone Control - Bass", SB_DSP4_BASS_DEV, (SB_DSP4_BASS_DEV + 1), 4, 4, 15), 254SB_DOUBLE("Tone Control - Bass", SB_DSP4_BASS_DEV, (SB_DSP4_BASS_DEV + 1), 4, 4, 15),
255SB_DOUBLE("Tone Control - Treble", SB_DSP4_TREBLE_DEV, (SB_DSP4_TREBLE_DEV + 1), 4, 4, 15), 255SB_DOUBLE("Tone Control - Treble", SB_DSP4_TREBLE_DEV, (SB_DSP4_TREBLE_DEV + 1), 4, 4, 15),
@@ -267,7 +267,7 @@ SB_DOUBLE("SB Playback Volume", SB_DSP4_OGAIN_DEV, (SB_DSP4_OGAIN_DEV + 1), 6, 6
267SB_SINGLE("SB Mic Auto Gain", SB_DSP4_MIC_AGC, 0, 1), 267SB_SINGLE("SB Mic Auto Gain", SB_DSP4_MIC_AGC, 0, 1),
268}; 268};
269 269
270static unsigned char cmi8330_sb_init_values[][2] __devinitdata = { 270static unsigned char cmi8330_sb_init_values[][2] = {
271 { SB_DSP4_MASTER_DEV + 0, 0 }, 271 { SB_DSP4_MASTER_DEV + 0, 0 },
272 { SB_DSP4_MASTER_DEV + 1, 0 }, 272 { SB_DSP4_MASTER_DEV + 1, 0 },
273 { SB_DSP4_PCM_DEV + 0, 0 }, 273 { SB_DSP4_PCM_DEV + 0, 0 },
@@ -281,7 +281,7 @@ static unsigned char cmi8330_sb_init_values[][2] __devinitdata = {
281}; 281};
282 282
283 283
284static int __devinit cmi8330_add_sb_mixers(struct snd_sb *chip) 284static int cmi8330_add_sb_mixers(struct snd_sb *chip)
285{ 285{
286 int idx, err; 286 int idx, err;
287 unsigned long flags; 287 unsigned long flags;
@@ -306,7 +306,7 @@ static int __devinit cmi8330_add_sb_mixers(struct snd_sb *chip)
306} 306}
307#endif 307#endif
308 308
309static int __devinit snd_cmi8330_mixer(struct snd_card *card, struct snd_cmi8330 *acard) 309static int snd_cmi8330_mixer(struct snd_card *card, struct snd_cmi8330 *acard)
310{ 310{
311 unsigned int idx; 311 unsigned int idx;
312 int err; 312 int err;
@@ -329,9 +329,9 @@ static int __devinit snd_cmi8330_mixer(struct snd_card *card, struct snd_cmi8330
329} 329}
330 330
331#ifdef CONFIG_PNP 331#ifdef CONFIG_PNP
332static int __devinit snd_cmi8330_pnp(int dev, struct snd_cmi8330 *acard, 332static int snd_cmi8330_pnp(int dev, struct snd_cmi8330 *acard,
333 struct pnp_card_link *card, 333 struct pnp_card_link *card,
334 const struct pnp_card_device_id *id) 334 const struct pnp_card_device_id *id)
335{ 335{
336 struct pnp_dev *pdev; 336 struct pnp_dev *pdev;
337 int err; 337 int err;
@@ -437,7 +437,7 @@ static int snd_cmi8330_capture_open(struct snd_pcm_substream *substream)
437 return chip->streams[SNDRV_PCM_STREAM_CAPTURE].open(substream); 437 return chip->streams[SNDRV_PCM_STREAM_CAPTURE].open(substream);
438} 438}
439 439
440static int __devinit snd_cmi8330_pcm(struct snd_card *card, struct snd_cmi8330 *chip) 440static int snd_cmi8330_pcm(struct snd_card *card, struct snd_cmi8330 *chip)
441{ 441{
442 struct snd_pcm *pcm; 442 struct snd_pcm *pcm;
443 const struct snd_pcm_ops *ops; 443 const struct snd_pcm_ops *ops;
@@ -532,7 +532,7 @@ static int snd_cmi8330_card_new(int dev, struct snd_card **cardp)
532 return 0; 532 return 0;
533} 533}
534 534
535static int __devinit snd_cmi8330_probe(struct snd_card *card, int dev) 535static int snd_cmi8330_probe(struct snd_card *card, int dev)
536{ 536{
537 struct snd_cmi8330 *acard; 537 struct snd_cmi8330 *acard;
538 int i, err; 538 int i, err;
@@ -613,8 +613,8 @@ static int __devinit snd_cmi8330_probe(struct snd_card *card, int dev)
613 return snd_card_register(card); 613 return snd_card_register(card);
614} 614}
615 615
616static int __devinit snd_cmi8330_isa_match(struct device *pdev, 616static int snd_cmi8330_isa_match(struct device *pdev,
617 unsigned int dev) 617 unsigned int dev)
618{ 618{
619 if (!enable[dev] || is_isapnp_selected(dev)) 619 if (!enable[dev] || is_isapnp_selected(dev))
620 return 0; 620 return 0;
@@ -629,8 +629,8 @@ static int __devinit snd_cmi8330_isa_match(struct device *pdev,
629 return 1; 629 return 1;
630} 630}
631 631
632static int __devinit snd_cmi8330_isa_probe(struct device *pdev, 632static int snd_cmi8330_isa_probe(struct device *pdev,
633 unsigned int dev) 633 unsigned int dev)
634{ 634{
635 struct snd_card *card; 635 struct snd_card *card;
636 int err; 636 int err;
@@ -647,8 +647,8 @@ static int __devinit snd_cmi8330_isa_probe(struct device *pdev,
647 return 0; 647 return 0;
648} 648}
649 649
650static int __devexit snd_cmi8330_isa_remove(struct device *devptr, 650static int snd_cmi8330_isa_remove(struct device *devptr,
651 unsigned int dev) 651 unsigned int dev)
652{ 652{
653 snd_card_free(dev_get_drvdata(devptr)); 653 snd_card_free(dev_get_drvdata(devptr));
654 dev_set_drvdata(devptr, NULL); 654 dev_set_drvdata(devptr, NULL);
@@ -673,7 +673,7 @@ static int snd_cmi8330_isa_resume(struct device *dev, unsigned int n)
673static struct isa_driver snd_cmi8330_driver = { 673static struct isa_driver snd_cmi8330_driver = {
674 .match = snd_cmi8330_isa_match, 674 .match = snd_cmi8330_isa_match,
675 .probe = snd_cmi8330_isa_probe, 675 .probe = snd_cmi8330_isa_probe,
676 .remove = __devexit_p(snd_cmi8330_isa_remove), 676 .remove = snd_cmi8330_isa_remove,
677#ifdef CONFIG_PM 677#ifdef CONFIG_PM
678 .suspend = snd_cmi8330_isa_suspend, 678 .suspend = snd_cmi8330_isa_suspend,
679 .resume = snd_cmi8330_isa_resume, 679 .resume = snd_cmi8330_isa_resume,
@@ -685,8 +685,8 @@ static struct isa_driver snd_cmi8330_driver = {
685 685
686 686
687#ifdef CONFIG_PNP 687#ifdef CONFIG_PNP
688static int __devinit snd_cmi8330_pnp_detect(struct pnp_card_link *pcard, 688static int snd_cmi8330_pnp_detect(struct pnp_card_link *pcard,
689 const struct pnp_card_device_id *pid) 689 const struct pnp_card_device_id *pid)
690{ 690{
691 static int dev; 691 static int dev;
692 struct snd_card *card; 692 struct snd_card *card;
@@ -717,7 +717,7 @@ static int __devinit snd_cmi8330_pnp_detect(struct pnp_card_link *pcard,
717 return 0; 717 return 0;
718} 718}
719 719
720static void __devexit snd_cmi8330_pnp_remove(struct pnp_card_link * pcard) 720static void snd_cmi8330_pnp_remove(struct pnp_card_link *pcard)
721{ 721{
722 snd_card_free(pnp_get_card_drvdata(pcard)); 722 snd_card_free(pnp_get_card_drvdata(pcard));
723 pnp_set_card_drvdata(pcard, NULL); 723 pnp_set_card_drvdata(pcard, NULL);
@@ -740,7 +740,7 @@ static struct pnp_card_driver cmi8330_pnpc_driver = {
740 .name = "cmi8330", 740 .name = "cmi8330",
741 .id_table = snd_cmi8330_pnpids, 741 .id_table = snd_cmi8330_pnpids,
742 .probe = snd_cmi8330_pnp_detect, 742 .probe = snd_cmi8330_pnp_detect,
743 .remove = __devexit_p(snd_cmi8330_pnp_remove), 743 .remove = snd_cmi8330_pnp_remove,
744#ifdef CONFIG_PM 744#ifdef CONFIG_PM
745 .suspend = snd_cmi8330_pnp_suspend, 745 .suspend = snd_cmi8330_pnp_suspend,
746 .resume = snd_cmi8330_pnp_resume, 746 .resume = snd_cmi8330_pnp_resume,
diff --git a/sound/isa/cs423x/cs4231.c b/sound/isa/cs423x/cs4231.c
index 99dda45e82f5..aa7a5d86e480 100644
--- a/sound/isa/cs423x/cs4231.c
+++ b/sound/isa/cs423x/cs4231.c
@@ -68,7 +68,7 @@ MODULE_PARM_DESC(dma1, "DMA1 # for " CRD_NAME " driver.");
68module_param_array(dma2, int, NULL, 0444); 68module_param_array(dma2, int, NULL, 0444);
69MODULE_PARM_DESC(dma2, "DMA2 # for " CRD_NAME " driver."); 69MODULE_PARM_DESC(dma2, "DMA2 # for " CRD_NAME " driver.");
70 70
71static int __devinit snd_cs4231_match(struct device *dev, unsigned int n) 71static int snd_cs4231_match(struct device *dev, unsigned int n)
72{ 72{
73 if (!enable[n]) 73 if (!enable[n])
74 return 0; 74 return 0;
@@ -88,7 +88,7 @@ static int __devinit snd_cs4231_match(struct device *dev, unsigned int n)
88 return 1; 88 return 1;
89} 89}
90 90
91static int __devinit snd_cs4231_probe(struct device *dev, unsigned int n) 91static int snd_cs4231_probe(struct device *dev, unsigned int n)
92{ 92{
93 struct snd_card *card; 93 struct snd_card *card;
94 struct snd_wss *chip; 94 struct snd_wss *chip;
@@ -148,7 +148,7 @@ out: snd_card_free(card);
148 return error; 148 return error;
149} 149}
150 150
151static int __devexit snd_cs4231_remove(struct device *dev, unsigned int n) 151static int snd_cs4231_remove(struct device *dev, unsigned int n)
152{ 152{
153 snd_card_free(dev_get_drvdata(dev)); 153 snd_card_free(dev_get_drvdata(dev));
154 dev_set_drvdata(dev, NULL); 154 dev_set_drvdata(dev, NULL);
@@ -180,7 +180,7 @@ static int snd_cs4231_resume(struct device *dev, unsigned int n)
180static struct isa_driver snd_cs4231_driver = { 180static struct isa_driver snd_cs4231_driver = {
181 .match = snd_cs4231_match, 181 .match = snd_cs4231_match,
182 .probe = snd_cs4231_probe, 182 .probe = snd_cs4231_probe,
183 .remove = __devexit_p(snd_cs4231_remove), 183 .remove = snd_cs4231_remove,
184#ifdef CONFIG_PM 184#ifdef CONFIG_PM
185 .suspend = snd_cs4231_suspend, 185 .suspend = snd_cs4231_suspend,
186 .resume = snd_cs4231_resume, 186 .resume = snd_cs4231_resume,
diff --git a/sound/isa/cs423x/cs4236.c b/sound/isa/cs423x/cs4236.c
index 740c51a1ed7b..252e9fb37db3 100644
--- a/sound/isa/cs423x/cs4236.c
+++ b/sound/isa/cs423x/cs4236.c
@@ -251,7 +251,7 @@ static struct pnp_card_device_id snd_cs423x_pnpids[] = {
251MODULE_DEVICE_TABLE(pnp_card, snd_cs423x_pnpids); 251MODULE_DEVICE_TABLE(pnp_card, snd_cs423x_pnpids);
252 252
253/* WSS initialization */ 253/* WSS initialization */
254static int __devinit snd_cs423x_pnp_init_wss(int dev, struct pnp_dev *pdev) 254static int snd_cs423x_pnp_init_wss(int dev, struct pnp_dev *pdev)
255{ 255{
256 if (pnp_activate_dev(pdev) < 0) { 256 if (pnp_activate_dev(pdev) < 0) {
257 printk(KERN_ERR IDENT " WSS PnP configure failed for WSS (out of resources?)\n"); 257 printk(KERN_ERR IDENT " WSS PnP configure failed for WSS (out of resources?)\n");
@@ -272,7 +272,7 @@ static int __devinit snd_cs423x_pnp_init_wss(int dev, struct pnp_dev *pdev)
272} 272}
273 273
274/* CTRL initialization */ 274/* CTRL initialization */
275static int __devinit snd_cs423x_pnp_init_ctrl(int dev, struct pnp_dev *pdev) 275static int snd_cs423x_pnp_init_ctrl(int dev, struct pnp_dev *pdev)
276{ 276{
277 if (pnp_activate_dev(pdev) < 0) { 277 if (pnp_activate_dev(pdev) < 0) {
278 printk(KERN_ERR IDENT " CTRL PnP configure failed for WSS (out of resources?)\n"); 278 printk(KERN_ERR IDENT " CTRL PnP configure failed for WSS (out of resources?)\n");
@@ -284,7 +284,7 @@ static int __devinit snd_cs423x_pnp_init_ctrl(int dev, struct pnp_dev *pdev)
284} 284}
285 285
286/* MPU initialization */ 286/* MPU initialization */
287static int __devinit snd_cs423x_pnp_init_mpu(int dev, struct pnp_dev *pdev) 287static int snd_cs423x_pnp_init_mpu(int dev, struct pnp_dev *pdev)
288{ 288{
289 if (pnp_activate_dev(pdev) < 0) { 289 if (pnp_activate_dev(pdev) < 0) {
290 printk(KERN_ERR IDENT " MPU401 PnP configure failed for WSS (out of resources?)\n"); 290 printk(KERN_ERR IDENT " MPU401 PnP configure failed for WSS (out of resources?)\n");
@@ -303,9 +303,9 @@ static int __devinit snd_cs423x_pnp_init_mpu(int dev, struct pnp_dev *pdev)
303 return 0; 303 return 0;
304} 304}
305 305
306static int __devinit snd_card_cs423x_pnp(int dev, struct snd_card_cs4236 *acard, 306static int snd_card_cs423x_pnp(int dev, struct snd_card_cs4236 *acard,
307 struct pnp_dev *pdev, 307 struct pnp_dev *pdev,
308 struct pnp_dev *cdev) 308 struct pnp_dev *cdev)
309{ 309{
310 acard->wss = pdev; 310 acard->wss = pdev;
311 if (snd_cs423x_pnp_init_wss(dev, acard->wss) < 0) 311 if (snd_cs423x_pnp_init_wss(dev, acard->wss) < 0)
@@ -317,9 +317,9 @@ static int __devinit snd_card_cs423x_pnp(int dev, struct snd_card_cs4236 *acard,
317 return 0; 317 return 0;
318} 318}
319 319
320static int __devinit snd_card_cs423x_pnpc(int dev, struct snd_card_cs4236 *acard, 320static int snd_card_cs423x_pnpc(int dev, struct snd_card_cs4236 *acard,
321 struct pnp_card_link *card, 321 struct pnp_card_link *card,
322 const struct pnp_card_device_id *id) 322 const struct pnp_card_device_id *id)
323{ 323{
324 acard->wss = pnp_request_card_device(card, id->devs[0].id, NULL); 324 acard->wss = pnp_request_card_device(card, id->devs[0].id, NULL);
325 if (acard->wss == NULL) 325 if (acard->wss == NULL)
@@ -378,7 +378,7 @@ static int snd_cs423x_card_new(int dev, struct snd_card **cardp)
378 return 0; 378 return 0;
379} 379}
380 380
381static int __devinit snd_cs423x_probe(struct snd_card *card, int dev) 381static int snd_cs423x_probe(struct snd_card *card, int dev)
382{ 382{
383 struct snd_card_cs4236 *acard; 383 struct snd_card_cs4236 *acard;
384 struct snd_pcm *pcm; 384 struct snd_pcm *pcm;
@@ -456,8 +456,8 @@ static int __devinit snd_cs423x_probe(struct snd_card *card, int dev)
456 return snd_card_register(card); 456 return snd_card_register(card);
457} 457}
458 458
459static int __devinit snd_cs423x_isa_match(struct device *pdev, 459static int snd_cs423x_isa_match(struct device *pdev,
460 unsigned int dev) 460 unsigned int dev)
461{ 461{
462 if (!enable[dev] || is_isapnp_selected(dev)) 462 if (!enable[dev] || is_isapnp_selected(dev))
463 return 0; 463 return 0;
@@ -481,8 +481,8 @@ static int __devinit snd_cs423x_isa_match(struct device *pdev,
481 return 1; 481 return 1;
482} 482}
483 483
484static int __devinit snd_cs423x_isa_probe(struct device *pdev, 484static int snd_cs423x_isa_probe(struct device *pdev,
485 unsigned int dev) 485 unsigned int dev)
486{ 486{
487 struct snd_card *card; 487 struct snd_card *card;
488 int err; 488 int err;
@@ -500,8 +500,8 @@ static int __devinit snd_cs423x_isa_probe(struct device *pdev,
500 return 0; 500 return 0;
501} 501}
502 502
503static int __devexit snd_cs423x_isa_remove(struct device *pdev, 503static int snd_cs423x_isa_remove(struct device *pdev,
504 unsigned int dev) 504 unsigned int dev)
505{ 505{
506 snd_card_free(dev_get_drvdata(pdev)); 506 snd_card_free(dev_get_drvdata(pdev));
507 dev_set_drvdata(pdev, NULL); 507 dev_set_drvdata(pdev, NULL);
@@ -540,7 +540,7 @@ static int snd_cs423x_isa_resume(struct device *dev, unsigned int n)
540static struct isa_driver cs423x_isa_driver = { 540static struct isa_driver cs423x_isa_driver = {
541 .match = snd_cs423x_isa_match, 541 .match = snd_cs423x_isa_match,
542 .probe = snd_cs423x_isa_probe, 542 .probe = snd_cs423x_isa_probe,
543 .remove = __devexit_p(snd_cs423x_isa_remove), 543 .remove = snd_cs423x_isa_remove,
544#ifdef CONFIG_PM 544#ifdef CONFIG_PM
545 .suspend = snd_cs423x_isa_suspend, 545 .suspend = snd_cs423x_isa_suspend,
546 .resume = snd_cs423x_isa_resume, 546 .resume = snd_cs423x_isa_resume,
@@ -552,8 +552,8 @@ static struct isa_driver cs423x_isa_driver = {
552 552
553 553
554#ifdef CONFIG_PNP 554#ifdef CONFIG_PNP
555static int __devinit snd_cs423x_pnpbios_detect(struct pnp_dev *pdev, 555static int snd_cs423x_pnpbios_detect(struct pnp_dev *pdev,
556 const struct pnp_device_id *id) 556 const struct pnp_device_id *id)
557{ 557{
558 static int dev; 558 static int dev;
559 int err; 559 int err;
@@ -597,7 +597,7 @@ static int __devinit snd_cs423x_pnpbios_detect(struct pnp_dev *pdev,
597 return 0; 597 return 0;
598} 598}
599 599
600static void __devexit snd_cs423x_pnp_remove(struct pnp_dev *pdev) 600static void snd_cs423x_pnp_remove(struct pnp_dev *pdev)
601{ 601{
602 snd_card_free(pnp_get_drvdata(pdev)); 602 snd_card_free(pnp_get_drvdata(pdev));
603 pnp_set_drvdata(pdev, NULL); 603 pnp_set_drvdata(pdev, NULL);
@@ -619,15 +619,15 @@ static struct pnp_driver cs423x_pnp_driver = {
619 .name = "cs423x-pnpbios", 619 .name = "cs423x-pnpbios",
620 .id_table = snd_cs423x_pnpbiosids, 620 .id_table = snd_cs423x_pnpbiosids,
621 .probe = snd_cs423x_pnpbios_detect, 621 .probe = snd_cs423x_pnpbios_detect,
622 .remove = __devexit_p(snd_cs423x_pnp_remove), 622 .remove = snd_cs423x_pnp_remove,
623#ifdef CONFIG_PM 623#ifdef CONFIG_PM
624 .suspend = snd_cs423x_pnp_suspend, 624 .suspend = snd_cs423x_pnp_suspend,
625 .resume = snd_cs423x_pnp_resume, 625 .resume = snd_cs423x_pnp_resume,
626#endif 626#endif
627}; 627};
628 628
629static int __devinit snd_cs423x_pnpc_detect(struct pnp_card_link *pcard, 629static int snd_cs423x_pnpc_detect(struct pnp_card_link *pcard,
630 const struct pnp_card_device_id *pid) 630 const struct pnp_card_device_id *pid)
631{ 631{
632 static int dev; 632 static int dev;
633 struct snd_card *card; 633 struct snd_card *card;
@@ -659,7 +659,7 @@ static int __devinit snd_cs423x_pnpc_detect(struct pnp_card_link *pcard,
659 return 0; 659 return 0;
660} 660}
661 661
662static void __devexit snd_cs423x_pnpc_remove(struct pnp_card_link * pcard) 662static void snd_cs423x_pnpc_remove(struct pnp_card_link *pcard)
663{ 663{
664 snd_card_free(pnp_get_card_drvdata(pcard)); 664 snd_card_free(pnp_get_card_drvdata(pcard));
665 pnp_set_card_drvdata(pcard, NULL); 665 pnp_set_card_drvdata(pcard, NULL);
@@ -682,7 +682,7 @@ static struct pnp_card_driver cs423x_pnpc_driver = {
682 .name = CS423X_ISAPNP_DRIVER, 682 .name = CS423X_ISAPNP_DRIVER,
683 .id_table = snd_cs423x_pnpids, 683 .id_table = snd_cs423x_pnpids,
684 .probe = snd_cs423x_pnpc_detect, 684 .probe = snd_cs423x_pnpc_detect,
685 .remove = __devexit_p(snd_cs423x_pnpc_remove), 685 .remove = snd_cs423x_pnpc_remove,
686#ifdef CONFIG_PM 686#ifdef CONFIG_PM
687 .suspend = snd_cs423x_pnpc_suspend, 687 .suspend = snd_cs423x_pnpc_suspend,
688 .resume = snd_cs423x_pnpc_resume, 688 .resume = snd_cs423x_pnpc_resume,
diff --git a/sound/isa/es1688/es1688.c b/sound/isa/es1688/es1688.c
index b036e60f62d1..102874a703d4 100644
--- a/sound/isa/es1688/es1688.c
+++ b/sound/isa/es1688/es1688.c
@@ -90,13 +90,13 @@ MODULE_PARM_DESC(dma8, "8-bit DMA # for " CRD_NAME " driver.");
90#define is_isapnp_selected(dev) 0 90#define is_isapnp_selected(dev) 0
91#endif 91#endif
92 92
93static int __devinit snd_es1688_match(struct device *dev, unsigned int n) 93static int snd_es1688_match(struct device *dev, unsigned int n)
94{ 94{
95 return enable[n] && !is_isapnp_selected(n); 95 return enable[n] && !is_isapnp_selected(n);
96} 96}
97 97
98static int __devinit snd_es1688_legacy_create(struct snd_card *card, 98static int snd_es1688_legacy_create(struct snd_card *card,
99 struct device *dev, unsigned int n) 99 struct device *dev, unsigned int n)
100{ 100{
101 struct snd_es1688 *chip = card->private_data; 101 struct snd_es1688 *chip = card->private_data;
102 static long possible_ports[] = {0x220, 0x240, 0x260}; 102 static long possible_ports[] = {0x220, 0x240, 0x260};
@@ -134,7 +134,7 @@ static int __devinit snd_es1688_legacy_create(struct snd_card *card,
134 return error; 134 return error;
135} 135}
136 136
137static int __devinit snd_es1688_probe(struct snd_card *card, unsigned int n) 137static int snd_es1688_probe(struct snd_card *card, unsigned int n)
138{ 138{
139 struct snd_es1688 *chip = card->private_data; 139 struct snd_es1688 *chip = card->private_data;
140 struct snd_opl3 *opl3; 140 struct snd_opl3 *opl3;
@@ -182,7 +182,7 @@ static int __devinit snd_es1688_probe(struct snd_card *card, unsigned int n)
182 return snd_card_register(card); 182 return snd_card_register(card);
183} 183}
184 184
185static int __devinit snd_es1688_isa_probe(struct device *dev, unsigned int n) 185static int snd_es1688_isa_probe(struct device *dev, unsigned int n)
186{ 186{
187 struct snd_card *card; 187 struct snd_card *card;
188 int error; 188 int error;
@@ -210,7 +210,7 @@ out:
210 return error; 210 return error;
211} 211}
212 212
213static int __devexit snd_es1688_isa_remove(struct device *dev, unsigned int n) 213static int snd_es1688_isa_remove(struct device *dev, unsigned int n)
214{ 214{
215 snd_card_free(dev_get_drvdata(dev)); 215 snd_card_free(dev_get_drvdata(dev));
216 dev_set_drvdata(dev, NULL); 216 dev_set_drvdata(dev, NULL);
@@ -220,7 +220,7 @@ static int __devexit snd_es1688_isa_remove(struct device *dev, unsigned int n)
220static struct isa_driver snd_es1688_driver = { 220static struct isa_driver snd_es1688_driver = {
221 .match = snd_es1688_match, 221 .match = snd_es1688_match,
222 .probe = snd_es1688_isa_probe, 222 .probe = snd_es1688_isa_probe,
223 .remove = __devexit_p(snd_es1688_isa_remove), 223 .remove = snd_es1688_isa_remove,
224#if 0 /* FIXME */ 224#if 0 /* FIXME */
225 .suspend = snd_es1688_suspend, 225 .suspend = snd_es1688_suspend,
226 .resume = snd_es1688_resume, 226 .resume = snd_es1688_resume,
@@ -233,9 +233,9 @@ static struct isa_driver snd_es1688_driver = {
233static int snd_es968_pnp_is_probed; 233static int snd_es968_pnp_is_probed;
234 234
235#ifdef CONFIG_PNP 235#ifdef CONFIG_PNP
236static int __devinit snd_card_es968_pnp(struct snd_card *card, unsigned int n, 236static int snd_card_es968_pnp(struct snd_card *card, unsigned int n,
237 struct pnp_card_link *pcard, 237 struct pnp_card_link *pcard,
238 const struct pnp_card_device_id *pid) 238 const struct pnp_card_device_id *pid)
239{ 239{
240 struct snd_es1688 *chip = card->private_data; 240 struct snd_es1688 *chip = card->private_data;
241 struct pnp_dev *pdev; 241 struct pnp_dev *pdev;
@@ -258,8 +258,8 @@ static int __devinit snd_card_es968_pnp(struct snd_card *card, unsigned int n,
258 mpu_irq[n], dma8[n], ES1688_HW_AUTO); 258 mpu_irq[n], dma8[n], ES1688_HW_AUTO);
259} 259}
260 260
261static int __devinit snd_es968_pnp_detect(struct pnp_card_link *pcard, 261static int snd_es968_pnp_detect(struct pnp_card_link *pcard,
262 const struct pnp_card_device_id *pid) 262 const struct pnp_card_device_id *pid)
263{ 263{
264 struct snd_card *card; 264 struct snd_card *card;
265 static unsigned int dev; 265 static unsigned int dev;
@@ -295,7 +295,7 @@ static int __devinit snd_es968_pnp_detect(struct pnp_card_link *pcard,
295 return 0; 295 return 0;
296} 296}
297 297
298static void __devexit snd_es968_pnp_remove(struct pnp_card_link * pcard) 298static void snd_es968_pnp_remove(struct pnp_card_link *pcard)
299{ 299{
300 snd_card_free(pnp_get_card_drvdata(pcard)); 300 snd_card_free(pnp_get_card_drvdata(pcard));
301 pnp_set_card_drvdata(pcard, NULL); 301 pnp_set_card_drvdata(pcard, NULL);
@@ -338,7 +338,7 @@ static struct pnp_card_driver es968_pnpc_driver = {
338 .name = DEV_NAME " PnP", 338 .name = DEV_NAME " PnP",
339 .id_table = snd_es968_pnpids, 339 .id_table = snd_es968_pnpids,
340 .probe = snd_es968_pnp_detect, 340 .probe = snd_es968_pnp_detect,
341 .remove = __devexit_p(snd_es968_pnp_remove), 341 .remove = snd_es968_pnp_remove,
342#ifdef CONFIG_PM 342#ifdef CONFIG_PM
343 .suspend = snd_es968_pnp_suspend, 343 .suspend = snd_es968_pnp_suspend,
344 .resume = snd_es968_pnp_resume, 344 .resume = snd_es968_pnp_resume,
diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c
index c20baafd9b7c..24380efe31a1 100644
--- a/sound/isa/es18xx.c
+++ b/sound/isa/es18xx.c
@@ -348,7 +348,7 @@ static inline int snd_es18xx_mixer_writable(struct snd_es18xx *chip, unsigned ch
348} 348}
349 349
350 350
351static int __devinit snd_es18xx_reset(struct snd_es18xx *chip) 351static int snd_es18xx_reset(struct snd_es18xx *chip)
352{ 352{
353 int i; 353 int i;
354 outb(0x03, chip->port + 0x06); 354 outb(0x03, chip->port + 0x06);
@@ -1363,7 +1363,7 @@ static struct snd_kcontrol_new snd_es18xx_hw_volume_controls[] = {
1363ES18XX_SINGLE("Hardware Master Volume Split", 0, 0x64, 7, 1, 0), 1363ES18XX_SINGLE("Hardware Master Volume Split", 0, 0x64, 7, 1, 0),
1364}; 1364};
1365 1365
1366static int __devinit snd_es18xx_config_read(struct snd_es18xx *chip, unsigned char reg) 1366static int snd_es18xx_config_read(struct snd_es18xx *chip, unsigned char reg)
1367{ 1367{
1368 int data; 1368 int data;
1369 1369
@@ -1372,8 +1372,8 @@ static int __devinit snd_es18xx_config_read(struct snd_es18xx *chip, unsigned ch
1372 return data; 1372 return data;
1373} 1373}
1374 1374
1375static void __devinit snd_es18xx_config_write(struct snd_es18xx *chip, 1375static void snd_es18xx_config_write(struct snd_es18xx *chip,
1376 unsigned char reg, unsigned char data) 1376 unsigned char reg, unsigned char data)
1377{ 1377{
1378 /* No need for spinlocks, this function is used only in 1378 /* No need for spinlocks, this function is used only in
1379 otherwise protected init code */ 1379 otherwise protected init code */
@@ -1384,9 +1384,9 @@ static void __devinit snd_es18xx_config_write(struct snd_es18xx *chip,
1384#endif 1384#endif
1385} 1385}
1386 1386
1387static int __devinit snd_es18xx_initialize(struct snd_es18xx *chip, 1387static int snd_es18xx_initialize(struct snd_es18xx *chip,
1388 unsigned long mpu_port, 1388 unsigned long mpu_port,
1389 unsigned long fm_port) 1389 unsigned long fm_port)
1390{ 1390{
1391 int mask = 0; 1391 int mask = 0;
1392 1392
@@ -1549,7 +1549,7 @@ static int __devinit snd_es18xx_initialize(struct snd_es18xx *chip,
1549 return 0; 1549 return 0;
1550} 1550}
1551 1551
1552static int __devinit snd_es18xx_identify(struct snd_es18xx *chip) 1552static int snd_es18xx_identify(struct snd_es18xx *chip)
1553{ 1553{
1554 int hi,lo; 1554 int hi,lo;
1555 1555
@@ -1618,9 +1618,9 @@ static int __devinit snd_es18xx_identify(struct snd_es18xx *chip)
1618 return 0; 1618 return 0;
1619} 1619}
1620 1620
1621static int __devinit snd_es18xx_probe(struct snd_es18xx *chip, 1621static int snd_es18xx_probe(struct snd_es18xx *chip,
1622 unsigned long mpu_port, 1622 unsigned long mpu_port,
1623 unsigned long fm_port) 1623 unsigned long fm_port)
1624{ 1624{
1625 if (snd_es18xx_identify(chip) < 0) { 1625 if (snd_es18xx_identify(chip) < 0) {
1626 snd_printk(KERN_ERR PFX "[0x%lx] ESS chip not found\n", chip->port); 1626 snd_printk(KERN_ERR PFX "[0x%lx] ESS chip not found\n", chip->port);
@@ -1680,8 +1680,8 @@ static struct snd_pcm_ops snd_es18xx_capture_ops = {
1680 .pointer = snd_es18xx_capture_pointer, 1680 .pointer = snd_es18xx_capture_pointer,
1681}; 1681};
1682 1682
1683static int __devinit snd_es18xx_pcm(struct snd_card *card, int device, 1683static int snd_es18xx_pcm(struct snd_card *card, int device,
1684 struct snd_pcm **rpcm) 1684 struct snd_pcm **rpcm)
1685{ 1685{
1686 struct snd_es18xx *chip = card->private_data; 1686 struct snd_es18xx *chip = card->private_data;
1687 struct snd_pcm *pcm; 1687 struct snd_pcm *pcm;
@@ -1777,11 +1777,11 @@ static int snd_es18xx_dev_free(struct snd_device *device)
1777 return snd_es18xx_free(device->card); 1777 return snd_es18xx_free(device->card);
1778} 1778}
1779 1779
1780static int __devinit snd_es18xx_new_device(struct snd_card *card, 1780static int snd_es18xx_new_device(struct snd_card *card,
1781 unsigned long port, 1781 unsigned long port,
1782 unsigned long mpu_port, 1782 unsigned long mpu_port,
1783 unsigned long fm_port, 1783 unsigned long fm_port,
1784 int irq, int dma1, int dma2) 1784 int irq, int dma1, int dma2)
1785{ 1785{
1786 struct snd_es18xx *chip = card->private_data; 1786 struct snd_es18xx *chip = card->private_data;
1787 static struct snd_device_ops ops = { 1787 static struct snd_device_ops ops = {
@@ -1839,7 +1839,7 @@ static int __devinit snd_es18xx_new_device(struct snd_card *card,
1839 return 0; 1839 return 0;
1840} 1840}
1841 1841
1842static int __devinit snd_es18xx_mixer(struct snd_card *card) 1842static int snd_es18xx_mixer(struct snd_card *card)
1843{ 1843{
1844 struct snd_es18xx *chip = card->private_data; 1844 struct snd_es18xx *chip = card->private_data;
1845 int err; 1845 int err;
@@ -2016,7 +2016,7 @@ static struct pnp_device_id snd_audiodrive_pnpbiosids[] = {
2016MODULE_DEVICE_TABLE(pnp, snd_audiodrive_pnpbiosids); 2016MODULE_DEVICE_TABLE(pnp, snd_audiodrive_pnpbiosids);
2017 2017
2018/* PnP main device initialization */ 2018/* PnP main device initialization */
2019static int __devinit snd_audiodrive_pnp_init_main(int dev, struct pnp_dev *pdev) 2019static int snd_audiodrive_pnp_init_main(int dev, struct pnp_dev *pdev)
2020{ 2020{
2021 if (pnp_activate_dev(pdev) < 0) { 2021 if (pnp_activate_dev(pdev) < 0) {
2022 snd_printk(KERN_ERR PFX "PnP configure failure (out of resources?)\n"); 2022 snd_printk(KERN_ERR PFX "PnP configure failure (out of resources?)\n");
@@ -2043,8 +2043,8 @@ static int __devinit snd_audiodrive_pnp_init_main(int dev, struct pnp_dev *pdev)
2043 return 0; 2043 return 0;
2044} 2044}
2045 2045
2046static int __devinit snd_audiodrive_pnp(int dev, struct snd_es18xx *chip, 2046static int snd_audiodrive_pnp(int dev, struct snd_es18xx *chip,
2047 struct pnp_dev *pdev) 2047 struct pnp_dev *pdev)
2048{ 2048{
2049 chip->dev = pdev; 2049 chip->dev = pdev;
2050 if (snd_audiodrive_pnp_init_main(dev, chip->dev) < 0) 2050 if (snd_audiodrive_pnp_init_main(dev, chip->dev) < 0)
@@ -2073,9 +2073,9 @@ static struct pnp_card_device_id snd_audiodrive_pnpids[] = {
2073 2073
2074MODULE_DEVICE_TABLE(pnp_card, snd_audiodrive_pnpids); 2074MODULE_DEVICE_TABLE(pnp_card, snd_audiodrive_pnpids);
2075 2075
2076static int __devinit snd_audiodrive_pnpc(int dev, struct snd_es18xx *chip, 2076static int snd_audiodrive_pnpc(int dev, struct snd_es18xx *chip,
2077 struct pnp_card_link *card, 2077 struct pnp_card_link *card,
2078 const struct pnp_card_device_id *id) 2078 const struct pnp_card_device_id *id)
2079{ 2079{
2080 chip->dev = pnp_request_card_device(card, id->devs[0].id, NULL); 2080 chip->dev = pnp_request_card_device(card, id->devs[0].id, NULL);
2081 if (chip->dev == NULL) 2081 if (chip->dev == NULL)
@@ -2111,7 +2111,7 @@ static int snd_es18xx_card_new(int dev, struct snd_card **cardp)
2111 sizeof(struct snd_es18xx), cardp); 2111 sizeof(struct snd_es18xx), cardp);
2112} 2112}
2113 2113
2114static int __devinit snd_audiodrive_probe(struct snd_card *card, int dev) 2114static int snd_audiodrive_probe(struct snd_card *card, int dev)
2115{ 2115{
2116 struct snd_es18xx *chip = card->private_data; 2116 struct snd_es18xx *chip = card->private_data;
2117 struct snd_opl3 *opl3; 2117 struct snd_opl3 *opl3;
@@ -2169,12 +2169,12 @@ static int __devinit snd_audiodrive_probe(struct snd_card *card, int dev)
2169 return snd_card_register(card); 2169 return snd_card_register(card);
2170} 2170}
2171 2171
2172static int __devinit snd_es18xx_isa_match(struct device *pdev, unsigned int dev) 2172static int snd_es18xx_isa_match(struct device *pdev, unsigned int dev)
2173{ 2173{
2174 return enable[dev] && !is_isapnp_selected(dev); 2174 return enable[dev] && !is_isapnp_selected(dev);
2175} 2175}
2176 2176
2177static int __devinit snd_es18xx_isa_probe1(int dev, struct device *devptr) 2177static int snd_es18xx_isa_probe1(int dev, struct device *devptr)
2178{ 2178{
2179 struct snd_card *card; 2179 struct snd_card *card;
2180 int err; 2180 int err;
@@ -2191,7 +2191,7 @@ static int __devinit snd_es18xx_isa_probe1(int dev, struct device *devptr)
2191 return 0; 2191 return 0;
2192} 2192}
2193 2193
2194static int __devinit snd_es18xx_isa_probe(struct device *pdev, unsigned int dev) 2194static int snd_es18xx_isa_probe(struct device *pdev, unsigned int dev)
2195{ 2195{
2196 int err; 2196 int err;
2197 static int possible_irqs[] = {5, 9, 10, 7, 11, 12, -1}; 2197 static int possible_irqs[] = {5, 9, 10, 7, 11, 12, -1};
@@ -2231,8 +2231,8 @@ static int __devinit snd_es18xx_isa_probe(struct device *pdev, unsigned int dev)
2231 } 2231 }
2232} 2232}
2233 2233
2234static int __devexit snd_es18xx_isa_remove(struct device *devptr, 2234static int snd_es18xx_isa_remove(struct device *devptr,
2235 unsigned int dev) 2235 unsigned int dev)
2236{ 2236{
2237 snd_card_free(dev_get_drvdata(devptr)); 2237 snd_card_free(dev_get_drvdata(devptr));
2238 dev_set_drvdata(devptr, NULL); 2238 dev_set_drvdata(devptr, NULL);
@@ -2257,7 +2257,7 @@ static int snd_es18xx_isa_resume(struct device *dev, unsigned int n)
2257static struct isa_driver snd_es18xx_isa_driver = { 2257static struct isa_driver snd_es18xx_isa_driver = {
2258 .match = snd_es18xx_isa_match, 2258 .match = snd_es18xx_isa_match,
2259 .probe = snd_es18xx_isa_probe, 2259 .probe = snd_es18xx_isa_probe,
2260 .remove = __devexit_p(snd_es18xx_isa_remove), 2260 .remove = snd_es18xx_isa_remove,
2261#ifdef CONFIG_PM 2261#ifdef CONFIG_PM
2262 .suspend = snd_es18xx_isa_suspend, 2262 .suspend = snd_es18xx_isa_suspend,
2263 .resume = snd_es18xx_isa_resume, 2263 .resume = snd_es18xx_isa_resume,
@@ -2269,8 +2269,8 @@ static struct isa_driver snd_es18xx_isa_driver = {
2269 2269
2270 2270
2271#ifdef CONFIG_PNP 2271#ifdef CONFIG_PNP
2272static int __devinit snd_audiodrive_pnp_detect(struct pnp_dev *pdev, 2272static int snd_audiodrive_pnp_detect(struct pnp_dev *pdev,
2273 const struct pnp_device_id *id) 2273 const struct pnp_device_id *id)
2274{ 2274{
2275 static int dev; 2275 static int dev;
2276 int err; 2276 int err;
@@ -2302,7 +2302,7 @@ static int __devinit snd_audiodrive_pnp_detect(struct pnp_dev *pdev,
2302 return 0; 2302 return 0;
2303} 2303}
2304 2304
2305static void __devexit snd_audiodrive_pnp_remove(struct pnp_dev * pdev) 2305static void snd_audiodrive_pnp_remove(struct pnp_dev *pdev)
2306{ 2306{
2307 snd_card_free(pnp_get_drvdata(pdev)); 2307 snd_card_free(pnp_get_drvdata(pdev));
2308 pnp_set_drvdata(pdev, NULL); 2308 pnp_set_drvdata(pdev, NULL);
@@ -2323,15 +2323,15 @@ static struct pnp_driver es18xx_pnp_driver = {
2323 .name = "es18xx-pnpbios", 2323 .name = "es18xx-pnpbios",
2324 .id_table = snd_audiodrive_pnpbiosids, 2324 .id_table = snd_audiodrive_pnpbiosids,
2325 .probe = snd_audiodrive_pnp_detect, 2325 .probe = snd_audiodrive_pnp_detect,
2326 .remove = __devexit_p(snd_audiodrive_pnp_remove), 2326 .remove = snd_audiodrive_pnp_remove,
2327#ifdef CONFIG_PM 2327#ifdef CONFIG_PM
2328 .suspend = snd_audiodrive_pnp_suspend, 2328 .suspend = snd_audiodrive_pnp_suspend,
2329 .resume = snd_audiodrive_pnp_resume, 2329 .resume = snd_audiodrive_pnp_resume,
2330#endif 2330#endif
2331}; 2331};
2332 2332
2333static int __devinit snd_audiodrive_pnpc_detect(struct pnp_card_link *pcard, 2333static int snd_audiodrive_pnpc_detect(struct pnp_card_link *pcard,
2334 const struct pnp_card_device_id *pid) 2334 const struct pnp_card_device_id *pid)
2335{ 2335{
2336 static int dev; 2336 static int dev;
2337 struct snd_card *card; 2337 struct snd_card *card;
@@ -2363,7 +2363,7 @@ static int __devinit snd_audiodrive_pnpc_detect(struct pnp_card_link *pcard,
2363 return 0; 2363 return 0;
2364} 2364}
2365 2365
2366static void __devexit snd_audiodrive_pnpc_remove(struct pnp_card_link * pcard) 2366static void snd_audiodrive_pnpc_remove(struct pnp_card_link *pcard)
2367{ 2367{
2368 snd_card_free(pnp_get_card_drvdata(pcard)); 2368 snd_card_free(pnp_get_card_drvdata(pcard));
2369 pnp_set_card_drvdata(pcard, NULL); 2369 pnp_set_card_drvdata(pcard, NULL);
@@ -2387,7 +2387,7 @@ static struct pnp_card_driver es18xx_pnpc_driver = {
2387 .name = "es18xx", 2387 .name = "es18xx",
2388 .id_table = snd_audiodrive_pnpids, 2388 .id_table = snd_audiodrive_pnpids,
2389 .probe = snd_audiodrive_pnpc_detect, 2389 .probe = snd_audiodrive_pnpc_detect,
2390 .remove = __devexit_p(snd_audiodrive_pnpc_remove), 2390 .remove = snd_audiodrive_pnpc_remove,
2391#ifdef CONFIG_PM 2391#ifdef CONFIG_PM
2392 .suspend = snd_audiodrive_pnpc_suspend, 2392 .suspend = snd_audiodrive_pnpc_suspend,
2393 .resume = snd_audiodrive_pnpc_resume, 2393 .resume = snd_audiodrive_pnpc_resume,
diff --git a/sound/isa/galaxy/galaxy.c b/sound/isa/galaxy/galaxy.c
index 55e20782858d..672184e3221a 100644
--- a/sound/isa/galaxy/galaxy.c
+++ b/sound/isa/galaxy/galaxy.c
@@ -84,7 +84,7 @@ MODULE_PARM_DESC(dma2, "Capture DMA # for " CRD_NAME " driver.");
84 84
85#define DSP_COMMAND_GET_VERSION 0xe1 85#define DSP_COMMAND_GET_VERSION 0xe1
86 86
87static int __devinit dsp_get_byte(void __iomem *port, u8 *val) 87static int dsp_get_byte(void __iomem *port, u8 *val)
88{ 88{
89 int loops = 1000; 89 int loops = 1000;
90 90
@@ -97,7 +97,7 @@ static int __devinit dsp_get_byte(void __iomem *port, u8 *val)
97 return 0; 97 return 0;
98} 98}
99 99
100static int __devinit dsp_reset(void __iomem *port) 100static int dsp_reset(void __iomem *port)
101{ 101{
102 u8 val; 102 u8 val;
103 103
@@ -111,7 +111,7 @@ static int __devinit dsp_reset(void __iomem *port)
111 return 0; 111 return 0;
112} 112}
113 113
114static int __devinit dsp_command(void __iomem *port, u8 cmd) 114static int dsp_command(void __iomem *port, u8 cmd)
115{ 115{
116 int loops = 1000; 116 int loops = 1000;
117 117
@@ -124,7 +124,7 @@ static int __devinit dsp_command(void __iomem *port, u8 cmd)
124 return 0; 124 return 0;
125} 125}
126 126
127static int __devinit dsp_get_version(void __iomem *port, u8 *major, u8 *minor) 127static int dsp_get_version(void __iomem *port, u8 *major, u8 *minor)
128{ 128{
129 int err; 129 int err;
130 130
@@ -161,7 +161,7 @@ static int __devinit dsp_get_version(void __iomem *port, u8 *major, u8 *minor)
161 161
162#define WSS_SIGNATURE 4 162#define WSS_SIGNATURE 4
163 163
164static int __devinit wss_detect(void __iomem *wss_port) 164static int wss_detect(void __iomem *wss_port)
165{ 165{
166 if ((ioread8(wss_port + WSS_PORT_SIGNATURE) & 0x3f) != WSS_SIGNATURE) 166 if ((ioread8(wss_port + WSS_PORT_SIGNATURE) & 0x3f) != WSS_SIGNATURE)
167 return -ENODEV; 167 return -ENODEV;
@@ -204,7 +204,7 @@ struct snd_galaxy {
204static u32 config[SNDRV_CARDS]; 204static u32 config[SNDRV_CARDS];
205static u8 wss_config[SNDRV_CARDS]; 205static u8 wss_config[SNDRV_CARDS];
206 206
207static int __devinit snd_galaxy_match(struct device *dev, unsigned int n) 207static int snd_galaxy_match(struct device *dev, unsigned int n)
208{ 208{
209 if (!enable[n]) 209 if (!enable[n])
210 return 0; 210 return 0;
@@ -379,7 +379,7 @@ fm:
379 return 1; 379 return 1;
380} 380}
381 381
382static int __devinit galaxy_init(struct snd_galaxy *galaxy, u8 *type) 382static int galaxy_init(struct snd_galaxy *galaxy, u8 *type)
383{ 383{
384 u8 major; 384 u8 major;
385 u8 minor; 385 u8 minor;
@@ -411,7 +411,7 @@ static int __devinit galaxy_init(struct snd_galaxy *galaxy, u8 *type)
411 return 0; 411 return 0;
412} 412}
413 413
414static int __devinit galaxy_set_mode(struct snd_galaxy *galaxy, u8 mode) 414static int galaxy_set_mode(struct snd_galaxy *galaxy, u8 mode)
415{ 415{
416 int err; 416 int err;
417 417
@@ -449,7 +449,7 @@ static void galaxy_set_config(struct snd_galaxy *galaxy, u32 config)
449 msleep(10); 449 msleep(10);
450} 450}
451 451
452static void __devinit galaxy_config(struct snd_galaxy *galaxy, u32 config) 452static void galaxy_config(struct snd_galaxy *galaxy, u32 config)
453{ 453{
454 int i; 454 int i;
455 455
@@ -461,7 +461,7 @@ static void __devinit galaxy_config(struct snd_galaxy *galaxy, u32 config)
461 galaxy_set_config(galaxy, config); 461 galaxy_set_config(galaxy, config);
462} 462}
463 463
464static int __devinit galaxy_wss_config(struct snd_galaxy *galaxy, u8 wss_config) 464static int galaxy_wss_config(struct snd_galaxy *galaxy, u8 wss_config)
465{ 465{
466 int err; 466 int err;
467 467
@@ -498,7 +498,7 @@ static void snd_galaxy_free(struct snd_card *card)
498 } 498 }
499} 499}
500 500
501static int __devinit snd_galaxy_probe(struct device *dev, unsigned int n) 501static int snd_galaxy_probe(struct device *dev, unsigned int n)
502{ 502{
503 struct snd_galaxy *galaxy; 503 struct snd_galaxy *galaxy;
504 struct snd_wss *chip; 504 struct snd_wss *chip;
@@ -620,7 +620,7 @@ error:
620 return err; 620 return err;
621} 621}
622 622
623static int __devexit snd_galaxy_remove(struct device *dev, unsigned int n) 623static int snd_galaxy_remove(struct device *dev, unsigned int n)
624{ 624{
625 snd_card_free(dev_get_drvdata(dev)); 625 snd_card_free(dev_get_drvdata(dev));
626 dev_set_drvdata(dev, NULL); 626 dev_set_drvdata(dev, NULL);
@@ -630,7 +630,7 @@ static int __devexit snd_galaxy_remove(struct device *dev, unsigned int n)
630static struct isa_driver snd_galaxy_driver = { 630static struct isa_driver snd_galaxy_driver = {
631 .match = snd_galaxy_match, 631 .match = snd_galaxy_match,
632 .probe = snd_galaxy_probe, 632 .probe = snd_galaxy_probe,
633 .remove = __devexit_p(snd_galaxy_remove), 633 .remove = snd_galaxy_remove,
634 634
635 .driver = { 635 .driver = {
636 .name = DEV_NAME 636 .name = DEV_NAME
diff --git a/sound/isa/gus/gusclassic.c b/sound/isa/gus/gusclassic.c
index bf6333671613..16bca4e96c08 100644
--- a/sound/isa/gus/gusclassic.c
+++ b/sound/isa/gus/gusclassic.c
@@ -73,13 +73,14 @@ MODULE_PARM_DESC(channels, "GF1 channels for " CRD_NAME " driver.");
73module_param_array(pcm_channels, int, NULL, 0444); 73module_param_array(pcm_channels, int, NULL, 0444);
74MODULE_PARM_DESC(pcm_channels, "Reserved PCM channels for " CRD_NAME " driver."); 74MODULE_PARM_DESC(pcm_channels, "Reserved PCM channels for " CRD_NAME " driver.");
75 75
76static int __devinit snd_gusclassic_match(struct device *dev, unsigned int n) 76static int snd_gusclassic_match(struct device *dev, unsigned int n)
77{ 77{
78 return enable[n]; 78 return enable[n];
79} 79}
80 80
81static int __devinit snd_gusclassic_create(struct snd_card *card, 81static int snd_gusclassic_create(struct snd_card *card,
82 struct device *dev, unsigned int n, struct snd_gus_card **rgus) 82 struct device *dev, unsigned int n,
83 struct snd_gus_card **rgus)
83{ 84{
84 static long possible_ports[] = {0x220, 0x230, 0x240, 0x250, 0x260}; 85 static long possible_ports[] = {0x220, 0x230, 0x240, 0x250, 0x260};
85 static int possible_irqs[] = {5, 11, 12, 9, 7, 15, 3, 4, -1}; 86 static int possible_irqs[] = {5, 11, 12, 9, 7, 15, 3, 4, -1};
@@ -123,7 +124,7 @@ static int __devinit snd_gusclassic_create(struct snd_card *card,
123 return error; 124 return error;
124} 125}
125 126
126static int __devinit snd_gusclassic_detect(struct snd_gus_card *gus) 127static int snd_gusclassic_detect(struct snd_gus_card *gus)
127{ 128{
128 unsigned char d; 129 unsigned char d;
129 130
@@ -142,7 +143,7 @@ static int __devinit snd_gusclassic_detect(struct snd_gus_card *gus)
142 return 0; 143 return 0;
143} 144}
144 145
145static int __devinit snd_gusclassic_probe(struct device *dev, unsigned int n) 146static int snd_gusclassic_probe(struct device *dev, unsigned int n)
146{ 147{
147 struct snd_card *card; 148 struct snd_card *card;
148 struct snd_gus_card *gus; 149 struct snd_gus_card *gus;
@@ -211,7 +212,7 @@ out: snd_card_free(card);
211 return error; 212 return error;
212} 213}
213 214
214static int __devexit snd_gusclassic_remove(struct device *dev, unsigned int n) 215static int snd_gusclassic_remove(struct device *dev, unsigned int n)
215{ 216{
216 snd_card_free(dev_get_drvdata(dev)); 217 snd_card_free(dev_get_drvdata(dev));
217 dev_set_drvdata(dev, NULL); 218 dev_set_drvdata(dev, NULL);
@@ -221,7 +222,7 @@ static int __devexit snd_gusclassic_remove(struct device *dev, unsigned int n)
221static struct isa_driver snd_gusclassic_driver = { 222static struct isa_driver snd_gusclassic_driver = {
222 .match = snd_gusclassic_match, 223 .match = snd_gusclassic_match,
223 .probe = snd_gusclassic_probe, 224 .probe = snd_gusclassic_probe,
224 .remove = __devexit_p(snd_gusclassic_remove), 225 .remove = snd_gusclassic_remove,
225#if 0 /* FIXME */ 226#if 0 /* FIXME */
226 .suspend = snd_gusclassic_suspend, 227 .suspend = snd_gusclassic_suspend,
227 .remove = snd_gusclassic_remove, 228 .remove = snd_gusclassic_remove,
diff --git a/sound/isa/gus/gusextreme.c b/sound/isa/gus/gusextreme.c
index bc10cc26e5f9..0b9c2426b49f 100644
--- a/sound/isa/gus/gusextreme.c
+++ b/sound/isa/gus/gusextreme.c
@@ -89,13 +89,14 @@ MODULE_PARM_DESC(channels, "GF1 channels for " CRD_NAME " driver.");
89module_param_array(pcm_channels, int, NULL, 0444); 89module_param_array(pcm_channels, int, NULL, 0444);
90MODULE_PARM_DESC(pcm_channels, "Reserved PCM channels for " CRD_NAME " driver."); 90MODULE_PARM_DESC(pcm_channels, "Reserved PCM channels for " CRD_NAME " driver.");
91 91
92static int __devinit snd_gusextreme_match(struct device *dev, unsigned int n) 92static int snd_gusextreme_match(struct device *dev, unsigned int n)
93{ 93{
94 return enable[n]; 94 return enable[n];
95} 95}
96 96
97static int __devinit snd_gusextreme_es1688_create(struct snd_card *card, 97static int snd_gusextreme_es1688_create(struct snd_card *card,
98 struct snd_es1688 *chip, struct device *dev, unsigned int n) 98 struct snd_es1688 *chip,
99 struct device *dev, unsigned int n)
99{ 100{
100 static long possible_ports[] = {0x220, 0x240, 0x260}; 101 static long possible_ports[] = {0x220, 0x240, 0x260};
101 static int possible_irqs[] = {5, 9, 10, 7, -1}; 102 static int possible_irqs[] = {5, 9, 10, 7, -1};
@@ -132,8 +133,9 @@ static int __devinit snd_gusextreme_es1688_create(struct snd_card *card,
132 return error; 133 return error;
133} 134}
134 135
135static int __devinit snd_gusextreme_gus_card_create(struct snd_card *card, 136static int snd_gusextreme_gus_card_create(struct snd_card *card,
136 struct device *dev, unsigned int n, struct snd_gus_card **rgus) 137 struct device *dev, unsigned int n,
138 struct snd_gus_card **rgus)
137{ 139{
138 static int possible_irqs[] = {11, 12, 15, 9, 5, 7, 3, -1}; 140 static int possible_irqs[] = {11, 12, 15, 9, 5, 7, 3, -1};
139 static int possible_dmas[] = {5, 6, 7, 3, 1, -1}; 141 static int possible_dmas[] = {5, 6, 7, 3, 1, -1};
@@ -156,8 +158,8 @@ static int __devinit snd_gusextreme_gus_card_create(struct snd_card *card,
156 0, channels[n], pcm_channels[n], 0, rgus); 158 0, channels[n], pcm_channels[n], 0, rgus);
157} 159}
158 160
159static int __devinit snd_gusextreme_detect(struct snd_gus_card *gus, 161static int snd_gusextreme_detect(struct snd_gus_card *gus,
160 struct snd_es1688 *es1688) 162 struct snd_es1688 *es1688)
161{ 163{
162 unsigned long flags; 164 unsigned long flags;
163 unsigned char d; 165 unsigned char d;
@@ -206,7 +208,7 @@ static int __devinit snd_gusextreme_detect(struct snd_gus_card *gus,
206 return 0; 208 return 0;
207} 209}
208 210
209static int __devinit snd_gusextreme_mixer(struct snd_card *card) 211static int snd_gusextreme_mixer(struct snd_card *card)
210{ 212{
211 struct snd_ctl_elem_id id1, id2; 213 struct snd_ctl_elem_id id1, id2;
212 int error; 214 int error;
@@ -232,7 +234,7 @@ static int __devinit snd_gusextreme_mixer(struct snd_card *card)
232 return 0; 234 return 0;
233} 235}
234 236
235static int __devinit snd_gusextreme_probe(struct device *dev, unsigned int n) 237static int snd_gusextreme_probe(struct device *dev, unsigned int n)
236{ 238{
237 struct snd_card *card; 239 struct snd_card *card;
238 struct snd_gus_card *gus; 240 struct snd_gus_card *gus;
@@ -339,7 +341,7 @@ out: snd_card_free(card);
339 return error; 341 return error;
340} 342}
341 343
342static int __devexit snd_gusextreme_remove(struct device *dev, unsigned int n) 344static int snd_gusextreme_remove(struct device *dev, unsigned int n)
343{ 345{
344 snd_card_free(dev_get_drvdata(dev)); 346 snd_card_free(dev_get_drvdata(dev));
345 dev_set_drvdata(dev, NULL); 347 dev_set_drvdata(dev, NULL);
@@ -349,7 +351,7 @@ static int __devexit snd_gusextreme_remove(struct device *dev, unsigned int n)
349static struct isa_driver snd_gusextreme_driver = { 351static struct isa_driver snd_gusextreme_driver = {
350 .match = snd_gusextreme_match, 352 .match = snd_gusextreme_match,
351 .probe = snd_gusextreme_probe, 353 .probe = snd_gusextreme_probe,
352 .remove = __devexit_p(snd_gusextreme_remove), 354 .remove = snd_gusextreme_remove,
353#if 0 /* FIXME */ 355#if 0 /* FIXME */
354 .suspend = snd_gusextreme_suspend, 356 .suspend = snd_gusextreme_suspend,
355 .resume = snd_gusextreme_resume, 357 .resume = snd_gusextreme_resume,
diff --git a/sound/isa/gus/gusmax.c b/sound/isa/gus/gusmax.c
index 41c3f448745f..c309a5d0e7e1 100644
--- a/sound/isa/gus/gusmax.c
+++ b/sound/isa/gus/gusmax.c
@@ -82,7 +82,7 @@ struct snd_gusmax {
82 82
83#define PFX "gusmax: " 83#define PFX "gusmax: "
84 84
85static int __devinit snd_gusmax_detect(struct snd_gus_card * gus) 85static int snd_gusmax_detect(struct snd_gus_card *gus)
86{ 86{
87 unsigned char d; 87 unsigned char d;
88 88
@@ -124,8 +124,8 @@ static irqreturn_t snd_gusmax_interrupt(int irq, void *dev_id)
124 return IRQ_RETVAL(handled); 124 return IRQ_RETVAL(handled);
125} 125}
126 126
127static void __devinit snd_gusmax_init(int dev, struct snd_card *card, 127static void snd_gusmax_init(int dev, struct snd_card *card,
128 struct snd_gus_card * gus) 128 struct snd_gus_card *gus)
129{ 129{
130 gus->equal_irq = 1; 130 gus->equal_irq = 1;
131 gus->codec_flag = 1; 131 gus->codec_flag = 1;
@@ -140,7 +140,7 @@ static void __devinit snd_gusmax_init(int dev, struct snd_card *card,
140 outb(gus->max_cntrl_val, GUSP(gus, MAXCNTRLPORT)); 140 outb(gus->max_cntrl_val, GUSP(gus, MAXCNTRLPORT));
141} 141}
142 142
143static int __devinit snd_gusmax_mixer(struct snd_wss *chip) 143static int snd_gusmax_mixer(struct snd_wss *chip)
144{ 144{
145 struct snd_card *card = chip->card; 145 struct snd_card *card = chip->card;
146 struct snd_ctl_elem_id id1, id2; 146 struct snd_ctl_elem_id id1, id2;
@@ -199,12 +199,12 @@ static void snd_gusmax_free(struct snd_card *card)
199 free_irq(maxcard->irq, (void *)maxcard); 199 free_irq(maxcard->irq, (void *)maxcard);
200} 200}
201 201
202static int __devinit snd_gusmax_match(struct device *pdev, unsigned int dev) 202static int snd_gusmax_match(struct device *pdev, unsigned int dev)
203{ 203{
204 return enable[dev]; 204 return enable[dev];
205} 205}
206 206
207static int __devinit snd_gusmax_probe(struct device *pdev, unsigned int dev) 207static int snd_gusmax_probe(struct device *pdev, unsigned int dev)
208{ 208{
209 static int possible_irqs[] = {5, 11, 12, 9, 7, 15, 3, -1}; 209 static int possible_irqs[] = {5, 11, 12, 9, 7, 15, 3, -1};
210 static int possible_dmas[] = {5, 6, 7, 1, 3, -1}; 210 static int possible_dmas[] = {5, 6, 7, 1, 3, -1};
@@ -354,7 +354,7 @@ static int __devinit snd_gusmax_probe(struct device *pdev, unsigned int dev)
354 return err; 354 return err;
355} 355}
356 356
357static int __devexit snd_gusmax_remove(struct device *devptr, unsigned int dev) 357static int snd_gusmax_remove(struct device *devptr, unsigned int dev)
358{ 358{
359 snd_card_free(dev_get_drvdata(devptr)); 359 snd_card_free(dev_get_drvdata(devptr));
360 dev_set_drvdata(devptr, NULL); 360 dev_set_drvdata(devptr, NULL);
@@ -366,7 +366,7 @@ static int __devexit snd_gusmax_remove(struct device *devptr, unsigned int dev)
366static struct isa_driver snd_gusmax_driver = { 366static struct isa_driver snd_gusmax_driver = {
367 .match = snd_gusmax_match, 367 .match = snd_gusmax_match,
368 .probe = snd_gusmax_probe, 368 .probe = snd_gusmax_probe,
369 .remove = __devexit_p(snd_gusmax_remove), 369 .remove = snd_gusmax_remove,
370 /* FIXME: suspend/resume */ 370 /* FIXME: suspend/resume */
371 .driver = { 371 .driver = {
372 .name = DEV_NAME 372 .name = DEV_NAME
diff --git a/sound/isa/gus/interwave.c b/sound/isa/gus/interwave.c
index 3fc8b66fd167..78bc5744e89a 100644
--- a/sound/isa/gus/interwave.c
+++ b/sound/isa/gus/interwave.c
@@ -207,9 +207,9 @@ static struct snd_i2c_bit_ops snd_interwave_i2c_bit_ops = {
207 .getdata = snd_interwave_i2c_getdataline, 207 .getdata = snd_interwave_i2c_getdataline,
208}; 208};
209 209
210static int __devinit snd_interwave_detect_stb(struct snd_interwave *iwcard, 210static int snd_interwave_detect_stb(struct snd_interwave *iwcard,
211 struct snd_gus_card * gus, int dev, 211 struct snd_gus_card *gus, int dev,
212 struct snd_i2c_bus **rbus) 212 struct snd_i2c_bus **rbus)
213{ 213{
214 unsigned long port; 214 unsigned long port;
215 struct snd_i2c_bus *bus; 215 struct snd_i2c_bus *bus;
@@ -249,11 +249,11 @@ static int __devinit snd_interwave_detect_stb(struct snd_interwave *iwcard,
249} 249}
250#endif 250#endif
251 251
252static int __devinit snd_interwave_detect(struct snd_interwave *iwcard, 252static int snd_interwave_detect(struct snd_interwave *iwcard,
253 struct snd_gus_card * gus, 253 struct snd_gus_card *gus,
254 int dev 254 int dev
255#ifdef SNDRV_STB 255#ifdef SNDRV_STB
256 , struct snd_i2c_bus **rbus 256 , struct snd_i2c_bus **rbus
257#endif 257#endif
258 ) 258 )
259{ 259{
@@ -318,7 +318,7 @@ static irqreturn_t snd_interwave_interrupt(int irq, void *dev_id)
318 return IRQ_RETVAL(handled); 318 return IRQ_RETVAL(handled);
319} 319}
320 320
321static void __devinit snd_interwave_reset(struct snd_gus_card * gus) 321static void snd_interwave_reset(struct snd_gus_card *gus)
322{ 322{
323 snd_gf1_write8(gus, SNDRV_GF1_GB_RESET, 0x00); 323 snd_gf1_write8(gus, SNDRV_GF1_GB_RESET, 0x00);
324 udelay(160); 324 udelay(160);
@@ -326,7 +326,7 @@ static void __devinit snd_interwave_reset(struct snd_gus_card * gus)
326 udelay(160); 326 udelay(160);
327} 327}
328 328
329static void __devinit snd_interwave_bank_sizes(struct snd_gus_card * gus, int *sizes) 329static void snd_interwave_bank_sizes(struct snd_gus_card *gus, int *sizes)
330{ 330{
331 unsigned int idx; 331 unsigned int idx;
332 unsigned int local; 332 unsigned int local;
@@ -377,7 +377,7 @@ struct rom_hdr {
377 /* 511 */ unsigned char csum; 377 /* 511 */ unsigned char csum;
378}; 378};
379 379
380static void __devinit snd_interwave_detect_memory(struct snd_gus_card * gus) 380static void snd_interwave_detect_memory(struct snd_gus_card *gus)
381{ 381{
382 static unsigned int lmc[13] = 382 static unsigned int lmc[13] =
383 { 383 {
@@ -475,7 +475,7 @@ static void __devinit snd_interwave_detect_memory(struct snd_gus_card * gus)
475 snd_interwave_reset(gus); 475 snd_interwave_reset(gus);
476} 476}
477 477
478static void __devinit snd_interwave_init(int dev, struct snd_gus_card * gus) 478static void snd_interwave_init(int dev, struct snd_gus_card *gus)
479{ 479{
480 unsigned long flags; 480 unsigned long flags;
481 481
@@ -508,7 +508,7 @@ WSS_DOUBLE("Mic Playback Volume", 0,
508 CS4231_LEFT_MIC_INPUT, CS4231_RIGHT_MIC_INPUT, 0, 0, 31, 1) 508 CS4231_LEFT_MIC_INPUT, CS4231_RIGHT_MIC_INPUT, 0, 0, 31, 1)
509}; 509};
510 510
511static int __devinit snd_interwave_mixer(struct snd_wss *chip) 511static int snd_interwave_mixer(struct snd_wss *chip)
512{ 512{
513 struct snd_card *card = chip->card; 513 struct snd_card *card = chip->card;
514 struct snd_ctl_elem_id id1, id2; 514 struct snd_ctl_elem_id id1, id2;
@@ -558,9 +558,9 @@ static int __devinit snd_interwave_mixer(struct snd_wss *chip)
558 558
559#ifdef CONFIG_PNP 559#ifdef CONFIG_PNP
560 560
561static int __devinit snd_interwave_pnp(int dev, struct snd_interwave *iwcard, 561static int snd_interwave_pnp(int dev, struct snd_interwave *iwcard,
562 struct pnp_card_link *card, 562 struct pnp_card_link *card,
563 const struct pnp_card_device_id *id) 563 const struct pnp_card_device_id *id)
564{ 564{
565 struct pnp_dev *pdev; 565 struct pnp_dev *pdev;
566 int err; 566 int err;
@@ -644,7 +644,7 @@ static int snd_interwave_card_new(int dev, struct snd_card **cardp)
644 return 0; 644 return 0;
645} 645}
646 646
647static int __devinit snd_interwave_probe(struct snd_card *card, int dev) 647static int snd_interwave_probe(struct snd_card *card, int dev)
648{ 648{
649 int xirq, xdma1, xdma2; 649 int xirq, xdma1, xdma2;
650 struct snd_interwave *iwcard = card->private_data; 650 struct snd_interwave *iwcard = card->private_data;
@@ -775,7 +775,7 @@ static int __devinit snd_interwave_probe(struct snd_card *card, int dev)
775 return 0; 775 return 0;
776} 776}
777 777
778static int __devinit snd_interwave_isa_probe1(int dev, struct device *devptr) 778static int snd_interwave_isa_probe1(int dev, struct device *devptr)
779{ 779{
780 struct snd_card *card; 780 struct snd_card *card;
781 int err; 781 int err;
@@ -793,8 +793,8 @@ static int __devinit snd_interwave_isa_probe1(int dev, struct device *devptr)
793 return 0; 793 return 0;
794} 794}
795 795
796static int __devinit snd_interwave_isa_match(struct device *pdev, 796static int snd_interwave_isa_match(struct device *pdev,
797 unsigned int dev) 797 unsigned int dev)
798{ 798{
799 if (!enable[dev]) 799 if (!enable[dev])
800 return 0; 800 return 0;
@@ -805,8 +805,8 @@ static int __devinit snd_interwave_isa_match(struct device *pdev,
805 return 1; 805 return 1;
806} 806}
807 807
808static int __devinit snd_interwave_isa_probe(struct device *pdev, 808static int snd_interwave_isa_probe(struct device *pdev,
809 unsigned int dev) 809 unsigned int dev)
810{ 810{
811 int err; 811 int err;
812 static int possible_irqs[] = {5, 11, 12, 9, 7, 15, 3, -1}; 812 static int possible_irqs[] = {5, 11, 12, 9, 7, 15, 3, -1};
@@ -846,7 +846,7 @@ static int __devinit snd_interwave_isa_probe(struct device *pdev,
846 } 846 }
847} 847}
848 848
849static int __devexit snd_interwave_isa_remove(struct device *devptr, unsigned int dev) 849static int snd_interwave_isa_remove(struct device *devptr, unsigned int dev)
850{ 850{
851 snd_card_free(dev_get_drvdata(devptr)); 851 snd_card_free(dev_get_drvdata(devptr));
852 dev_set_drvdata(devptr, NULL); 852 dev_set_drvdata(devptr, NULL);
@@ -856,7 +856,7 @@ static int __devexit snd_interwave_isa_remove(struct device *devptr, unsigned in
856static struct isa_driver snd_interwave_driver = { 856static struct isa_driver snd_interwave_driver = {
857 .match = snd_interwave_isa_match, 857 .match = snd_interwave_isa_match,
858 .probe = snd_interwave_isa_probe, 858 .probe = snd_interwave_isa_probe,
859 .remove = __devexit_p(snd_interwave_isa_remove), 859 .remove = snd_interwave_isa_remove,
860 /* FIXME: suspend,resume */ 860 /* FIXME: suspend,resume */
861 .driver = { 861 .driver = {
862 .name = INTERWAVE_DRIVER 862 .name = INTERWAVE_DRIVER
@@ -864,8 +864,8 @@ static struct isa_driver snd_interwave_driver = {
864}; 864};
865 865
866#ifdef CONFIG_PNP 866#ifdef CONFIG_PNP
867static int __devinit snd_interwave_pnp_detect(struct pnp_card_link *pcard, 867static int snd_interwave_pnp_detect(struct pnp_card_link *pcard,
868 const struct pnp_card_device_id *pid) 868 const struct pnp_card_device_id *pid)
869{ 869{
870 static int dev; 870 static int dev;
871 struct snd_card *card; 871 struct snd_card *card;
@@ -896,7 +896,7 @@ static int __devinit snd_interwave_pnp_detect(struct pnp_card_link *pcard,
896 return 0; 896 return 0;
897} 897}
898 898
899static void __devexit snd_interwave_pnp_remove(struct pnp_card_link * pcard) 899static void snd_interwave_pnp_remove(struct pnp_card_link *pcard)
900{ 900{
901 snd_card_free(pnp_get_card_drvdata(pcard)); 901 snd_card_free(pnp_get_card_drvdata(pcard));
902 pnp_set_card_drvdata(pcard, NULL); 902 pnp_set_card_drvdata(pcard, NULL);
@@ -907,7 +907,7 @@ static struct pnp_card_driver interwave_pnpc_driver = {
907 .name = INTERWAVE_PNP_DRIVER, 907 .name = INTERWAVE_PNP_DRIVER,
908 .id_table = snd_interwave_pnpids, 908 .id_table = snd_interwave_pnpids,
909 .probe = snd_interwave_pnp_detect, 909 .probe = snd_interwave_pnp_detect,
910 .remove = __devexit_p(snd_interwave_pnp_remove), 910 .remove = snd_interwave_pnp_remove,
911 /* FIXME: suspend,resume */ 911 /* FIXME: suspend,resume */
912}; 912};
913 913
diff --git a/sound/isa/msnd/msnd.h b/sound/isa/msnd/msnd.h
index a168ba3313ac..dbac3a42347b 100644
--- a/sound/isa/msnd/msnd.h
+++ b/sound/isa/msnd/msnd.h
@@ -303,6 +303,6 @@ int snd_msndmidi_new(struct snd_card *card, int device);
303void snd_msndmidi_input_read(void *mpu); 303void snd_msndmidi_input_read(void *mpu);
304 304
305void snd_msndmix_setup(struct snd_msnd *chip); 305void snd_msndmix_setup(struct snd_msnd *chip);
306int __devinit snd_msndmix_new(struct snd_card *card); 306int snd_msndmix_new(struct snd_card *card);
307int snd_msndmix_force_recsrc(struct snd_msnd *chip, int recsrc); 307int snd_msndmix_force_recsrc(struct snd_msnd *chip, int recsrc);
308#endif /* __MSND_H */ 308#endif /* __MSND_H */
diff --git a/sound/isa/msnd/msnd_pinnacle.c b/sound/isa/msnd/msnd_pinnacle.c
index 29cc8e162b02..ddabb406b14c 100644
--- a/sound/isa/msnd/msnd_pinnacle.c
+++ b/sound/isa/msnd/msnd_pinnacle.c
@@ -78,7 +78,7 @@
78# define LOGNAME "snd_msnd_pinnacle" 78# define LOGNAME "snd_msnd_pinnacle"
79#endif 79#endif
80 80
81static void __devinit set_default_audio_parameters(struct snd_msnd *chip) 81static void set_default_audio_parameters(struct snd_msnd *chip)
82{ 82{
83 chip->play_sample_size = DEFSAMPLESIZE; 83 chip->play_sample_size = DEFSAMPLESIZE;
84 chip->play_sample_rate = DEFSAMPLERATE; 84 chip->play_sample_rate = DEFSAMPLERATE;
@@ -213,7 +213,7 @@ static int snd_msnd_reset_dsp(long io, unsigned char *info)
213 return -EIO; 213 return -EIO;
214} 214}
215 215
216static int __devinit snd_msnd_probe(struct snd_card *card) 216static int snd_msnd_probe(struct snd_card *card)
217{ 217{
218 struct snd_msnd *chip = card->private_data; 218 struct snd_msnd *chip = card->private_data;
219 unsigned char info; 219 unsigned char info;
@@ -497,7 +497,7 @@ static int snd_msnd_send_dsp_cmd_chk(struct snd_msnd *chip, u8 cmd)
497 return snd_msnd_send_dsp_cmd(chip, cmd); 497 return snd_msnd_send_dsp_cmd(chip, cmd);
498} 498}
499 499
500static int __devinit snd_msnd_calibrate_adc(struct snd_msnd *chip, u16 srate) 500static int snd_msnd_calibrate_adc(struct snd_msnd *chip, u16 srate)
501{ 501{
502 snd_printdd("snd_msnd_calibrate_adc(%i)\n", srate); 502 snd_printdd("snd_msnd_calibrate_adc(%i)\n", srate);
503 writew(srate, chip->SMA + SMA_wCalFreqAtoD); 503 writew(srate, chip->SMA + SMA_wCalFreqAtoD);
@@ -535,7 +535,7 @@ static void snd_msnd_mpu401_close(struct snd_mpu401 *mpu)
535static long mpu_io[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; 535static long mpu_io[SNDRV_CARDS] = SNDRV_DEFAULT_PORT;
536static int mpu_irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; 536static int mpu_irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ;
537 537
538static int __devinit snd_msnd_attach(struct snd_card *card) 538static int snd_msnd_attach(struct snd_card *card)
539{ 539{
540 struct snd_msnd *chip = card->private_data; 540 struct snd_msnd *chip = card->private_data;
541 int err; 541 int err;
@@ -634,7 +634,7 @@ err_release_region:
634} 634}
635 635
636 636
637static void __devexit snd_msnd_unload(struct snd_card *card) 637static void snd_msnd_unload(struct snd_card *card)
638{ 638{
639 struct snd_msnd *chip = card->private_data; 639 struct snd_msnd *chip = card->private_data;
640 640
@@ -649,7 +649,7 @@ static void __devexit snd_msnd_unload(struct snd_card *card)
649 649
650/* Pinnacle/Fiji Logical Device Configuration */ 650/* Pinnacle/Fiji Logical Device Configuration */
651 651
652static int __devinit snd_msnd_write_cfg(int cfg, int reg, int value) 652static int snd_msnd_write_cfg(int cfg, int reg, int value)
653{ 653{
654 outb(reg, cfg); 654 outb(reg, cfg);
655 outb(value, cfg + 1); 655 outb(value, cfg + 1);
@@ -660,7 +660,7 @@ static int __devinit snd_msnd_write_cfg(int cfg, int reg, int value)
660 return 0; 660 return 0;
661} 661}
662 662
663static int __devinit snd_msnd_write_cfg_io0(int cfg, int num, u16 io) 663static int snd_msnd_write_cfg_io0(int cfg, int num, u16 io)
664{ 664{
665 if (snd_msnd_write_cfg(cfg, IREG_LOGDEVICE, num)) 665 if (snd_msnd_write_cfg(cfg, IREG_LOGDEVICE, num))
666 return -EIO; 666 return -EIO;
@@ -671,7 +671,7 @@ static int __devinit snd_msnd_write_cfg_io0(int cfg, int num, u16 io)
671 return 0; 671 return 0;
672} 672}
673 673
674static int __devinit snd_msnd_write_cfg_io1(int cfg, int num, u16 io) 674static int snd_msnd_write_cfg_io1(int cfg, int num, u16 io)
675{ 675{
676 if (snd_msnd_write_cfg(cfg, IREG_LOGDEVICE, num)) 676 if (snd_msnd_write_cfg(cfg, IREG_LOGDEVICE, num))
677 return -EIO; 677 return -EIO;
@@ -682,7 +682,7 @@ static int __devinit snd_msnd_write_cfg_io1(int cfg, int num, u16 io)
682 return 0; 682 return 0;
683} 683}
684 684
685static int __devinit snd_msnd_write_cfg_irq(int cfg, int num, u16 irq) 685static int snd_msnd_write_cfg_irq(int cfg, int num, u16 irq)
686{ 686{
687 if (snd_msnd_write_cfg(cfg, IREG_LOGDEVICE, num)) 687 if (snd_msnd_write_cfg(cfg, IREG_LOGDEVICE, num))
688 return -EIO; 688 return -EIO;
@@ -693,7 +693,7 @@ static int __devinit snd_msnd_write_cfg_irq(int cfg, int num, u16 irq)
693 return 0; 693 return 0;
694} 694}
695 695
696static int __devinit snd_msnd_write_cfg_mem(int cfg, int num, int mem) 696static int snd_msnd_write_cfg_mem(int cfg, int num, int mem)
697{ 697{
698 u16 wmem; 698 u16 wmem;
699 699
@@ -711,7 +711,7 @@ static int __devinit snd_msnd_write_cfg_mem(int cfg, int num, int mem)
711 return 0; 711 return 0;
712} 712}
713 713
714static int __devinit snd_msnd_activate_logical(int cfg, int num) 714static int snd_msnd_activate_logical(int cfg, int num)
715{ 715{
716 if (snd_msnd_write_cfg(cfg, IREG_LOGDEVICE, num)) 716 if (snd_msnd_write_cfg(cfg, IREG_LOGDEVICE, num))
717 return -EIO; 717 return -EIO;
@@ -720,8 +720,8 @@ static int __devinit snd_msnd_activate_logical(int cfg, int num)
720 return 0; 720 return 0;
721} 721}
722 722
723static int __devinit snd_msnd_write_cfg_logical(int cfg, int num, u16 io0, 723static int snd_msnd_write_cfg_logical(int cfg, int num, u16 io0,
724 u16 io1, u16 irq, int mem) 724 u16 io1, u16 irq, int mem)
725{ 725{
726 if (snd_msnd_write_cfg(cfg, IREG_LOGDEVICE, num)) 726 if (snd_msnd_write_cfg(cfg, IREG_LOGDEVICE, num))
727 return -EIO; 727 return -EIO;
@@ -738,7 +738,7 @@ static int __devinit snd_msnd_write_cfg_logical(int cfg, int num, u16 io0,
738 return 0; 738 return 0;
739} 739}
740 740
741static int __devinit snd_msnd_pinnacle_cfg_reset(int cfg) 741static int snd_msnd_pinnacle_cfg_reset(int cfg)
742{ 742{
743 int i; 743 int i;
744 744
@@ -818,7 +818,7 @@ module_param_array(joystick_io, long, NULL, S_IRUGO);
818#endif 818#endif
819 819
820 820
821static int __devinit snd_msnd_isa_match(struct device *pdev, unsigned int i) 821static int snd_msnd_isa_match(struct device *pdev, unsigned int i)
822{ 822{
823 if (io[i] == SNDRV_AUTO_PORT) 823 if (io[i] == SNDRV_AUTO_PORT)
824 return 0; 824 return 0;
@@ -888,7 +888,7 @@ static int __devinit snd_msnd_isa_match(struct device *pdev, unsigned int i)
888 return 1; 888 return 1;
889} 889}
890 890
891static int __devinit snd_msnd_isa_probe(struct device *pdev, unsigned int idx) 891static int snd_msnd_isa_probe(struct device *pdev, unsigned int idx)
892{ 892{
893 int err; 893 int err;
894 struct snd_card *card; 894 struct snd_card *card;
@@ -1061,7 +1061,7 @@ cfg_error:
1061#endif 1061#endif
1062} 1062}
1063 1063
1064static int __devexit snd_msnd_isa_remove(struct device *pdev, unsigned int dev) 1064static int snd_msnd_isa_remove(struct device *pdev, unsigned int dev)
1065{ 1065{
1066 snd_msnd_unload(dev_get_drvdata(pdev)); 1066 snd_msnd_unload(dev_get_drvdata(pdev));
1067 dev_set_drvdata(pdev, NULL); 1067 dev_set_drvdata(pdev, NULL);
@@ -1073,7 +1073,7 @@ static int __devexit snd_msnd_isa_remove(struct device *pdev, unsigned int dev)
1073static struct isa_driver snd_msnd_driver = { 1073static struct isa_driver snd_msnd_driver = {
1074 .match = snd_msnd_isa_match, 1074 .match = snd_msnd_isa_match,
1075 .probe = snd_msnd_isa_probe, 1075 .probe = snd_msnd_isa_probe,
1076 .remove = __devexit_p(snd_msnd_isa_remove), 1076 .remove = snd_msnd_isa_remove,
1077 /* FIXME: suspend, resume */ 1077 /* FIXME: suspend, resume */
1078 .driver = { 1078 .driver = {
1079 .name = DEV_NAME 1079 .name = DEV_NAME
@@ -1081,8 +1081,8 @@ static struct isa_driver snd_msnd_driver = {
1081}; 1081};
1082 1082
1083#ifdef CONFIG_PNP 1083#ifdef CONFIG_PNP
1084static int __devinit snd_msnd_pnp_detect(struct pnp_card_link *pcard, 1084static int snd_msnd_pnp_detect(struct pnp_card_link *pcard,
1085 const struct pnp_card_device_id *pid) 1085 const struct pnp_card_device_id *pid)
1086{ 1086{
1087 static int idx; 1087 static int idx;
1088 struct pnp_dev *pnp_dev; 1088 struct pnp_dev *pnp_dev;
@@ -1185,7 +1185,7 @@ _release_card:
1185 return ret; 1185 return ret;
1186} 1186}
1187 1187
1188static void __devexit snd_msnd_pnp_remove(struct pnp_card_link *pcard) 1188static void snd_msnd_pnp_remove(struct pnp_card_link *pcard)
1189{ 1189{
1190 snd_msnd_unload(pnp_get_card_drvdata(pcard)); 1190 snd_msnd_unload(pnp_get_card_drvdata(pcard));
1191 pnp_set_card_drvdata(pcard, NULL); 1191 pnp_set_card_drvdata(pcard, NULL);
@@ -1207,7 +1207,7 @@ static struct pnp_card_driver msnd_pnpc_driver = {
1207 .name = "msnd_pinnacle", 1207 .name = "msnd_pinnacle",
1208 .id_table = msnd_pnpids, 1208 .id_table = msnd_pnpids,
1209 .probe = snd_msnd_pnp_detect, 1209 .probe = snd_msnd_pnp_detect,
1210 .remove = __devexit_p(snd_msnd_pnp_remove), 1210 .remove = snd_msnd_pnp_remove,
1211}; 1211};
1212#endif /* CONFIG_PNP */ 1212#endif /* CONFIG_PNP */
1213 1213
diff --git a/sound/isa/msnd/msnd_pinnacle_mixer.c b/sound/isa/msnd/msnd_pinnacle_mixer.c
index 1de59d441426..031dc69b7470 100644
--- a/sound/isa/msnd/msnd_pinnacle_mixer.c
+++ b/sound/isa/msnd/msnd_pinnacle_mixer.c
@@ -302,7 +302,7 @@ DUMMY_VOLUME("Monitor", 0, MSND_MIXER_IMIX),
302}; 302};
303 303
304 304
305int __devinit snd_msndmix_new(struct snd_card *card) 305int snd_msndmix_new(struct snd_card *card)
306{ 306{
307 struct snd_msnd *chip = card->private_data; 307 struct snd_msnd *chip = card->private_data;
308 unsigned int idx; 308 unsigned int idx;
diff --git a/sound/isa/opl3sa2.c b/sound/isa/opl3sa2.c
index f6cc0b917ef0..075777a6cf0b 100644
--- a/sound/isa/opl3sa2.c
+++ b/sound/isa/opl3sa2.c
@@ -221,7 +221,7 @@ static void snd_opl3sa2_write(struct snd_opl3sa2 *chip, unsigned char reg, unsig
221 spin_unlock_irqrestore(&chip->reg_lock, flags); 221 spin_unlock_irqrestore(&chip->reg_lock, flags);
222} 222}
223 223
224static int __devinit snd_opl3sa2_detect(struct snd_card *card) 224static int snd_opl3sa2_detect(struct snd_card *card)
225{ 225{
226 struct snd_opl3sa2 *chip = card->private_data; 226 struct snd_opl3sa2 *chip = card->private_data;
227 unsigned long port; 227 unsigned long port;
@@ -496,7 +496,7 @@ static void snd_opl3sa2_master_free(struct snd_kcontrol *kcontrol)
496 chip->master_volume = NULL; 496 chip->master_volume = NULL;
497} 497}
498 498
499static int __devinit snd_opl3sa2_mixer(struct snd_card *card) 499static int snd_opl3sa2_mixer(struct snd_card *card)
500{ 500{
501 struct snd_opl3sa2 *chip = card->private_data; 501 struct snd_opl3sa2 *chip = card->private_data;
502 struct snd_ctl_elem_id id1, id2; 502 struct snd_ctl_elem_id id1, id2;
@@ -596,8 +596,8 @@ static int snd_opl3sa2_resume(struct snd_card *card)
596#endif /* CONFIG_PM */ 596#endif /* CONFIG_PM */
597 597
598#ifdef CONFIG_PNP 598#ifdef CONFIG_PNP
599static int __devinit snd_opl3sa2_pnp(int dev, struct snd_opl3sa2 *chip, 599static int snd_opl3sa2_pnp(int dev, struct snd_opl3sa2 *chip,
600 struct pnp_dev *pdev) 600 struct pnp_dev *pdev)
601{ 601{
602 if (pnp_activate_dev(pdev) < 0) { 602 if (pnp_activate_dev(pdev) < 0) {
603 snd_printk(KERN_ERR "PnP configure failure (out of resources?)\n"); 603 snd_printk(KERN_ERR "PnP configure failure (out of resources?)\n");
@@ -647,7 +647,7 @@ static int snd_opl3sa2_card_new(int dev, struct snd_card **cardp)
647 return 0; 647 return 0;
648} 648}
649 649
650static int __devinit snd_opl3sa2_probe(struct snd_card *card, int dev) 650static int snd_opl3sa2_probe(struct snd_card *card, int dev)
651{ 651{
652 int xirq, xdma1, xdma2; 652 int xirq, xdma1, xdma2;
653 struct snd_opl3sa2 *chip; 653 struct snd_opl3sa2 *chip;
@@ -721,8 +721,8 @@ static int __devinit snd_opl3sa2_probe(struct snd_card *card, int dev)
721} 721}
722 722
723#ifdef CONFIG_PNP 723#ifdef CONFIG_PNP
724static int __devinit snd_opl3sa2_pnp_detect(struct pnp_dev *pdev, 724static int snd_opl3sa2_pnp_detect(struct pnp_dev *pdev,
725 const struct pnp_device_id *id) 725 const struct pnp_device_id *id)
726{ 726{
727 static int dev; 727 static int dev;
728 int err; 728 int err;
@@ -754,7 +754,7 @@ static int __devinit snd_opl3sa2_pnp_detect(struct pnp_dev *pdev,
754 return 0; 754 return 0;
755} 755}
756 756
757static void __devexit snd_opl3sa2_pnp_remove(struct pnp_dev * pdev) 757static void snd_opl3sa2_pnp_remove(struct pnp_dev *pdev)
758{ 758{
759 snd_card_free(pnp_get_drvdata(pdev)); 759 snd_card_free(pnp_get_drvdata(pdev));
760 pnp_set_drvdata(pdev, NULL); 760 pnp_set_drvdata(pdev, NULL);
@@ -775,15 +775,15 @@ static struct pnp_driver opl3sa2_pnp_driver = {
775 .name = "snd-opl3sa2-pnpbios", 775 .name = "snd-opl3sa2-pnpbios",
776 .id_table = snd_opl3sa2_pnpbiosids, 776 .id_table = snd_opl3sa2_pnpbiosids,
777 .probe = snd_opl3sa2_pnp_detect, 777 .probe = snd_opl3sa2_pnp_detect,
778 .remove = __devexit_p(snd_opl3sa2_pnp_remove), 778 .remove = snd_opl3sa2_pnp_remove,
779#ifdef CONFIG_PM 779#ifdef CONFIG_PM
780 .suspend = snd_opl3sa2_pnp_suspend, 780 .suspend = snd_opl3sa2_pnp_suspend,
781 .resume = snd_opl3sa2_pnp_resume, 781 .resume = snd_opl3sa2_pnp_resume,
782#endif 782#endif
783}; 783};
784 784
785static int __devinit snd_opl3sa2_pnp_cdetect(struct pnp_card_link *pcard, 785static int snd_opl3sa2_pnp_cdetect(struct pnp_card_link *pcard,
786 const struct pnp_card_device_id *id) 786 const struct pnp_card_device_id *id)
787{ 787{
788 static int dev; 788 static int dev;
789 struct pnp_dev *pdev; 789 struct pnp_dev *pdev;
@@ -820,7 +820,7 @@ static int __devinit snd_opl3sa2_pnp_cdetect(struct pnp_card_link *pcard,
820 return 0; 820 return 0;
821} 821}
822 822
823static void __devexit snd_opl3sa2_pnp_cremove(struct pnp_card_link * pcard) 823static void snd_opl3sa2_pnp_cremove(struct pnp_card_link *pcard)
824{ 824{
825 snd_card_free(pnp_get_card_drvdata(pcard)); 825 snd_card_free(pnp_get_card_drvdata(pcard));
826 pnp_set_card_drvdata(pcard, NULL); 826 pnp_set_card_drvdata(pcard, NULL);
@@ -842,7 +842,7 @@ static struct pnp_card_driver opl3sa2_pnpc_driver = {
842 .name = "snd-opl3sa2-cpnp", 842 .name = "snd-opl3sa2-cpnp",
843 .id_table = snd_opl3sa2_pnpids, 843 .id_table = snd_opl3sa2_pnpids,
844 .probe = snd_opl3sa2_pnp_cdetect, 844 .probe = snd_opl3sa2_pnp_cdetect,
845 .remove = __devexit_p(snd_opl3sa2_pnp_cremove), 845 .remove = snd_opl3sa2_pnp_cremove,
846#ifdef CONFIG_PM 846#ifdef CONFIG_PM
847 .suspend = snd_opl3sa2_pnp_csuspend, 847 .suspend = snd_opl3sa2_pnp_csuspend,
848 .resume = snd_opl3sa2_pnp_cresume, 848 .resume = snd_opl3sa2_pnp_cresume,
@@ -850,8 +850,8 @@ static struct pnp_card_driver opl3sa2_pnpc_driver = {
850}; 850};
851#endif /* CONFIG_PNP */ 851#endif /* CONFIG_PNP */
852 852
853static int __devinit snd_opl3sa2_isa_match(struct device *pdev, 853static int snd_opl3sa2_isa_match(struct device *pdev,
854 unsigned int dev) 854 unsigned int dev)
855{ 855{
856 if (!enable[dev]) 856 if (!enable[dev])
857 return 0; 857 return 0;
@@ -878,8 +878,8 @@ static int __devinit snd_opl3sa2_isa_match(struct device *pdev,
878 return 1; 878 return 1;
879} 879}
880 880
881static int __devinit snd_opl3sa2_isa_probe(struct device *pdev, 881static int snd_opl3sa2_isa_probe(struct device *pdev,
882 unsigned int dev) 882 unsigned int dev)
883{ 883{
884 struct snd_card *card; 884 struct snd_card *card;
885 int err; 885 int err;
@@ -896,8 +896,8 @@ static int __devinit snd_opl3sa2_isa_probe(struct device *pdev,
896 return 0; 896 return 0;
897} 897}
898 898
899static int __devexit snd_opl3sa2_isa_remove(struct device *devptr, 899static int snd_opl3sa2_isa_remove(struct device *devptr,
900 unsigned int dev) 900 unsigned int dev)
901{ 901{
902 snd_card_free(dev_get_drvdata(devptr)); 902 snd_card_free(dev_get_drvdata(devptr));
903 dev_set_drvdata(devptr, NULL); 903 dev_set_drvdata(devptr, NULL);
@@ -922,7 +922,7 @@ static int snd_opl3sa2_isa_resume(struct device *dev, unsigned int n)
922static struct isa_driver snd_opl3sa2_isa_driver = { 922static struct isa_driver snd_opl3sa2_isa_driver = {
923 .match = snd_opl3sa2_isa_match, 923 .match = snd_opl3sa2_isa_match,
924 .probe = snd_opl3sa2_isa_probe, 924 .probe = snd_opl3sa2_isa_probe,
925 .remove = __devexit_p(snd_opl3sa2_isa_remove), 925 .remove = snd_opl3sa2_isa_remove,
926#ifdef CONFIG_PM 926#ifdef CONFIG_PM
927 .suspend = snd_opl3sa2_isa_suspend, 927 .suspend = snd_opl3sa2_isa_suspend,
928 .resume = snd_opl3sa2_isa_resume, 928 .resume = snd_opl3sa2_isa_resume,
diff --git a/sound/isa/opti9xx/miro.c b/sound/isa/opti9xx/miro.c
index 4a7ff4e8985b..c3da1df9371d 100644
--- a/sound/isa/opti9xx/miro.c
+++ b/sound/isa/opti9xx/miro.c
@@ -587,7 +587,7 @@ static int snd_miro_put_double(struct snd_kcontrol *kcontrol,
587 return change; 587 return change;
588} 588}
589 589
590static struct snd_kcontrol_new snd_miro_controls[] __devinitdata = { 590static struct snd_kcontrol_new snd_miro_controls[] = {
591MIRO_DOUBLE("Master Playback Volume", 0, ACI_GET_MASTER, ACI_SET_MASTER), 591MIRO_DOUBLE("Master Playback Volume", 0, ACI_GET_MASTER, ACI_SET_MASTER),
592MIRO_DOUBLE("Mic Playback Volume", 1, ACI_GET_MIC, ACI_SET_MIC), 592MIRO_DOUBLE("Mic Playback Volume", 1, ACI_GET_MIC, ACI_SET_MIC),
593MIRO_DOUBLE("Line Playback Volume", 1, ACI_GET_LINE, ACI_SET_LINE), 593MIRO_DOUBLE("Line Playback Volume", 1, ACI_GET_LINE, ACI_SET_LINE),
@@ -599,7 +599,7 @@ MIRO_DOUBLE("Aux Playback Volume", 2, ACI_GET_LINE2, ACI_SET_LINE2),
599 599
600/* Equalizer with seven bands (only PCM20) 600/* Equalizer with seven bands (only PCM20)
601 from -12dB up to +12dB on each band */ 601 from -12dB up to +12dB on each band */
602static struct snd_kcontrol_new snd_miro_eq_controls[] __devinitdata = { 602static struct snd_kcontrol_new snd_miro_eq_controls[] = {
603MIRO_DOUBLE("Tone Control - 28 Hz", 0, ACI_GET_EQ1, ACI_SET_EQ1), 603MIRO_DOUBLE("Tone Control - 28 Hz", 0, ACI_GET_EQ1, ACI_SET_EQ1),
604MIRO_DOUBLE("Tone Control - 160 Hz", 0, ACI_GET_EQ2, ACI_SET_EQ2), 604MIRO_DOUBLE("Tone Control - 160 Hz", 0, ACI_GET_EQ2, ACI_SET_EQ2),
605MIRO_DOUBLE("Tone Control - 400 Hz", 0, ACI_GET_EQ3, ACI_SET_EQ3), 605MIRO_DOUBLE("Tone Control - 400 Hz", 0, ACI_GET_EQ3, ACI_SET_EQ3),
@@ -609,15 +609,15 @@ MIRO_DOUBLE("Tone Control - 6.3 kHz", 0, ACI_GET_EQ6, ACI_SET_EQ6),
609MIRO_DOUBLE("Tone Control - 16 kHz", 0, ACI_GET_EQ7, ACI_SET_EQ7), 609MIRO_DOUBLE("Tone Control - 16 kHz", 0, ACI_GET_EQ7, ACI_SET_EQ7),
610}; 610};
611 611
612static struct snd_kcontrol_new snd_miro_radio_control[] __devinitdata = { 612static struct snd_kcontrol_new snd_miro_radio_control[] = {
613MIRO_DOUBLE("Radio Playback Volume", 0, ACI_GET_LINE1, ACI_SET_LINE1), 613MIRO_DOUBLE("Radio Playback Volume", 0, ACI_GET_LINE1, ACI_SET_LINE1),
614}; 614};
615 615
616static struct snd_kcontrol_new snd_miro_line_control[] __devinitdata = { 616static struct snd_kcontrol_new snd_miro_line_control[] = {
617MIRO_DOUBLE("Line Playback Volume", 2, ACI_GET_LINE1, ACI_SET_LINE1), 617MIRO_DOUBLE("Line Playback Volume", 2, ACI_GET_LINE1, ACI_SET_LINE1),
618}; 618};
619 619
620static struct snd_kcontrol_new snd_miro_preamp_control[] __devinitdata = { 620static struct snd_kcontrol_new snd_miro_preamp_control[] = {
621{ 621{
622 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 622 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
623 .name = "Mic Boost", 623 .name = "Mic Boost",
@@ -627,7 +627,7 @@ static struct snd_kcontrol_new snd_miro_preamp_control[] __devinitdata = {
627 .put = snd_miro_put_preamp, 627 .put = snd_miro_put_preamp,
628}}; 628}};
629 629
630static struct snd_kcontrol_new snd_miro_amp_control[] __devinitdata = { 630static struct snd_kcontrol_new snd_miro_amp_control[] = {
631{ 631{
632 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 632 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
633 .name = "Line Boost", 633 .name = "Line Boost",
@@ -637,7 +637,7 @@ static struct snd_kcontrol_new snd_miro_amp_control[] __devinitdata = {
637 .put = snd_miro_put_amp, 637 .put = snd_miro_put_amp,
638}}; 638}};
639 639
640static struct snd_kcontrol_new snd_miro_capture_control[] __devinitdata = { 640static struct snd_kcontrol_new snd_miro_capture_control[] = {
641{ 641{
642 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 642 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
643 .name = "PCM Capture Switch", 643 .name = "PCM Capture Switch",
@@ -647,7 +647,7 @@ static struct snd_kcontrol_new snd_miro_capture_control[] __devinitdata = {
647 .put = snd_miro_put_capture, 647 .put = snd_miro_put_capture,
648}}; 648}};
649 649
650static unsigned char aci_init_values[][2] __devinitdata = { 650static unsigned char aci_init_values[][2] = {
651 { ACI_SET_MUTE, 0x00 }, 651 { ACI_SET_MUTE, 0x00 },
652 { ACI_SET_POWERAMP, 0x00 }, 652 { ACI_SET_POWERAMP, 0x00 },
653 { ACI_SET_PREAMP, 0x00 }, 653 { ACI_SET_PREAMP, 0x00 },
@@ -670,7 +670,7 @@ static unsigned char aci_init_values[][2] __devinitdata = {
670 { ACI_SET_MASTER + 1, 0x20 }, 670 { ACI_SET_MASTER + 1, 0x20 },
671}; 671};
672 672
673static int __devinit snd_set_aci_init_values(struct snd_miro *miro) 673static int snd_set_aci_init_values(struct snd_miro *miro)
674{ 674{
675 int idx, error; 675 int idx, error;
676 struct snd_miro_aci *aci = miro->aci; 676 struct snd_miro_aci *aci = miro->aci;
@@ -713,8 +713,8 @@ static int __devinit snd_set_aci_init_values(struct snd_miro *miro)
713 return 0; 713 return 0;
714} 714}
715 715
716static int __devinit snd_miro_mixer(struct snd_card *card, 716static int snd_miro_mixer(struct snd_card *card,
717 struct snd_miro *miro) 717 struct snd_miro *miro)
718{ 718{
719 unsigned int idx; 719 unsigned int idx;
720 int err; 720 int err;
@@ -771,8 +771,8 @@ static int __devinit snd_miro_mixer(struct snd_card *card,
771 return 0; 771 return 0;
772} 772}
773 773
774static int __devinit snd_miro_init(struct snd_miro *chip, 774static int snd_miro_init(struct snd_miro *chip,
775 unsigned short hardware) 775 unsigned short hardware)
776{ 776{
777 static int opti9xx_mc_size[] = {7, 7, 10, 10, 2, 2, 2}; 777 static int opti9xx_mc_size[] = {7, 7, 10, 10, 2, 2, 2};
778 778
@@ -989,8 +989,8 @@ static void snd_miro_proc_read(struct snd_info_entry * entry,
989 snd_iprintf(buffer, " preamp : 0x%x\n", aci->aci_preamp); 989 snd_iprintf(buffer, " preamp : 0x%x\n", aci->aci_preamp);
990} 990}
991 991
992static void __devinit snd_miro_proc_init(struct snd_card *card, 992static void snd_miro_proc_init(struct snd_card *card,
993 struct snd_miro *miro) 993 struct snd_miro *miro)
994{ 994{
995 struct snd_info_entry *entry; 995 struct snd_info_entry *entry;
996 996
@@ -1002,7 +1002,7 @@ static void __devinit snd_miro_proc_init(struct snd_card *card,
1002 * Init 1002 * Init
1003 */ 1003 */
1004 1004
1005static int __devinit snd_miro_configure(struct snd_miro *chip) 1005static int snd_miro_configure(struct snd_miro *chip)
1006{ 1006{
1007 unsigned char wss_base_bits; 1007 unsigned char wss_base_bits;
1008 unsigned char irq_bits; 1008 unsigned char irq_bits;
@@ -1162,7 +1162,7 @@ __skip_mpu:
1162 return 0; 1162 return 0;
1163} 1163}
1164 1164
1165static int __devinit snd_miro_opti_check(struct snd_miro *chip) 1165static int snd_miro_opti_check(struct snd_miro *chip)
1166{ 1166{
1167 unsigned char value; 1167 unsigned char value;
1168 1168
@@ -1182,8 +1182,8 @@ static int __devinit snd_miro_opti_check(struct snd_miro *chip)
1182 return -ENODEV; 1182 return -ENODEV;
1183} 1183}
1184 1184
1185static int __devinit snd_card_miro_detect(struct snd_card *card, 1185static int snd_card_miro_detect(struct snd_card *card,
1186 struct snd_miro *chip) 1186 struct snd_miro *chip)
1187{ 1187{
1188 int i, err; 1188 int i, err;
1189 1189
@@ -1200,8 +1200,8 @@ static int __devinit snd_card_miro_detect(struct snd_card *card,
1200 return -ENODEV; 1200 return -ENODEV;
1201} 1201}
1202 1202
1203static int __devinit snd_card_miro_aci_detect(struct snd_card *card, 1203static int snd_card_miro_aci_detect(struct snd_card *card,
1204 struct snd_miro *miro) 1204 struct snd_miro *miro)
1205{ 1205{
1206 unsigned char regval; 1206 unsigned char regval;
1207 int i; 1207 int i;
@@ -1265,7 +1265,7 @@ static void snd_card_miro_free(struct snd_card *card)
1265 release_and_free_resource(miro->res_mc_base); 1265 release_and_free_resource(miro->res_mc_base);
1266} 1266}
1267 1267
1268static int __devinit snd_miro_probe(struct snd_card *card) 1268static int snd_miro_probe(struct snd_card *card)
1269{ 1269{
1270 int error; 1270 int error;
1271 struct snd_miro *miro = card->private_data; 1271 struct snd_miro *miro = card->private_data;
@@ -1386,7 +1386,7 @@ static int __devinit snd_miro_probe(struct snd_card *card)
1386 return snd_card_register(card); 1386 return snd_card_register(card);
1387} 1387}
1388 1388
1389static int __devinit snd_miro_isa_match(struct device *devptr, unsigned int n) 1389static int snd_miro_isa_match(struct device *devptr, unsigned int n)
1390{ 1390{
1391#ifdef CONFIG_PNP 1391#ifdef CONFIG_PNP
1392 if (snd_miro_pnp_is_probed) 1392 if (snd_miro_pnp_is_probed)
@@ -1397,7 +1397,7 @@ static int __devinit snd_miro_isa_match(struct device *devptr, unsigned int n)
1397 return 1; 1397 return 1;
1398} 1398}
1399 1399
1400static int __devinit snd_miro_isa_probe(struct device *devptr, unsigned int n) 1400static int snd_miro_isa_probe(struct device *devptr, unsigned int n)
1401{ 1401{
1402 static long possible_ports[] = {0x530, 0xe80, 0xf40, 0x604, -1}; 1402 static long possible_ports[] = {0x530, 0xe80, 0xf40, 0x604, -1};
1403 static long possible_mpu_ports[] = {0x330, 0x300, 0x310, 0x320, -1}; 1403 static long possible_mpu_ports[] = {0x330, 0x300, 0x310, 0x320, -1};
@@ -1491,8 +1491,8 @@ static int __devinit snd_miro_isa_probe(struct device *devptr, unsigned int n)
1491 return 0; 1491 return 0;
1492} 1492}
1493 1493
1494static int __devexit snd_miro_isa_remove(struct device *devptr, 1494static int snd_miro_isa_remove(struct device *devptr,
1495 unsigned int dev) 1495 unsigned int dev)
1496{ 1496{
1497 snd_card_free(dev_get_drvdata(devptr)); 1497 snd_card_free(dev_get_drvdata(devptr));
1498 dev_set_drvdata(devptr, NULL); 1498 dev_set_drvdata(devptr, NULL);
@@ -1504,7 +1504,7 @@ static int __devexit snd_miro_isa_remove(struct device *devptr,
1504static struct isa_driver snd_miro_driver = { 1504static struct isa_driver snd_miro_driver = {
1505 .match = snd_miro_isa_match, 1505 .match = snd_miro_isa_match,
1506 .probe = snd_miro_isa_probe, 1506 .probe = snd_miro_isa_probe,
1507 .remove = __devexit_p(snd_miro_isa_remove), 1507 .remove = snd_miro_isa_remove,
1508 /* FIXME: suspend/resume */ 1508 /* FIXME: suspend/resume */
1509 .driver = { 1509 .driver = {
1510 .name = DEV_NAME 1510 .name = DEV_NAME
@@ -1513,9 +1513,9 @@ static struct isa_driver snd_miro_driver = {
1513 1513
1514#ifdef CONFIG_PNP 1514#ifdef CONFIG_PNP
1515 1515
1516static int __devinit snd_card_miro_pnp(struct snd_miro *chip, 1516static int snd_card_miro_pnp(struct snd_miro *chip,
1517 struct pnp_card_link *card, 1517 struct pnp_card_link *card,
1518 const struct pnp_card_device_id *pid) 1518 const struct pnp_card_device_id *pid)
1519{ 1519{
1520 struct pnp_dev *pdev; 1520 struct pnp_dev *pdev;
1521 int err; 1521 int err;
@@ -1574,8 +1574,8 @@ static int __devinit snd_card_miro_pnp(struct snd_miro *chip,
1574 return 0; 1574 return 0;
1575} 1575}
1576 1576
1577static int __devinit snd_miro_pnp_probe(struct pnp_card_link *pcard, 1577static int snd_miro_pnp_probe(struct pnp_card_link *pcard,
1578 const struct pnp_card_device_id *pid) 1578 const struct pnp_card_device_id *pid)
1579{ 1579{
1580 struct snd_card *card; 1580 struct snd_card *card;
1581 int err; 1581 int err;
@@ -1624,7 +1624,7 @@ static int __devinit snd_miro_pnp_probe(struct pnp_card_link *pcard,
1624 return 0; 1624 return 0;
1625} 1625}
1626 1626
1627static void __devexit snd_miro_pnp_remove(struct pnp_card_link * pcard) 1627static void snd_miro_pnp_remove(struct pnp_card_link *pcard)
1628{ 1628{
1629 snd_card_free(pnp_get_card_drvdata(pcard)); 1629 snd_card_free(pnp_get_card_drvdata(pcard));
1630 pnp_set_card_drvdata(pcard, NULL); 1630 pnp_set_card_drvdata(pcard, NULL);
@@ -1636,7 +1636,7 @@ static struct pnp_card_driver miro_pnpc_driver = {
1636 .name = "miro", 1636 .name = "miro",
1637 .id_table = snd_miro_pnpids, 1637 .id_table = snd_miro_pnpids,
1638 .probe = snd_miro_pnp_probe, 1638 .probe = snd_miro_pnp_probe,
1639 .remove = __devexit_p(snd_miro_pnp_remove), 1639 .remove = snd_miro_pnp_remove,
1640}; 1640};
1641#endif 1641#endif
1642 1642
diff --git a/sound/isa/opti9xx/opti92x-ad1848.c b/sound/isa/opti9xx/opti92x-ad1848.c
index 2899c9fd1ceb..b41ed8661b23 100644
--- a/sound/isa/opti9xx/opti92x-ad1848.c
+++ b/sound/isa/opti9xx/opti92x-ad1848.c
@@ -186,8 +186,8 @@ static char * snd_opti9xx_names[] = {
186 "82C930", "82C931", "82C933" 186 "82C930", "82C931", "82C933"
187}; 187};
188 188
189static int __devinit snd_opti9xx_init(struct snd_opti9xx *chip, 189static int snd_opti9xx_init(struct snd_opti9xx *chip,
190 unsigned short hardware) 190 unsigned short hardware)
191{ 191{
192 static int opti9xx_mc_size[] = {7, 7, 10, 10, 2, 2, 2}; 192 static int opti9xx_mc_size[] = {7, 7, 10, 10, 2, 2, 2};
193 193
@@ -593,7 +593,7 @@ WSS_DOUBLE_TLV("Aux Playback Volume", 0,
593 db_scale_4bit_12db_max), 593 db_scale_4bit_12db_max),
594}; 594};
595 595
596static int __devinit snd_opti93x_mixer(struct snd_wss *chip) 596static int snd_opti93x_mixer(struct snd_wss *chip)
597{ 597{
598 struct snd_card *card; 598 struct snd_card *card;
599 unsigned int idx; 599 unsigned int idx;
@@ -666,7 +666,7 @@ static irqreturn_t snd_opti93x_interrupt(int irq, void *dev_id)
666 666
667#endif /* OPTi93X */ 667#endif /* OPTi93X */
668 668
669static int __devinit snd_opti9xx_read_check(struct snd_opti9xx *chip) 669static int snd_opti9xx_read_check(struct snd_opti9xx *chip)
670{ 670{
671 unsigned char value; 671 unsigned char value;
672#ifdef OPTi93X 672#ifdef OPTi93X
@@ -707,8 +707,8 @@ static int __devinit snd_opti9xx_read_check(struct snd_opti9xx *chip)
707 return -ENODEV; 707 return -ENODEV;
708} 708}
709 709
710static int __devinit snd_card_opti9xx_detect(struct snd_card *card, 710static int snd_card_opti9xx_detect(struct snd_card *card,
711 struct snd_opti9xx *chip) 711 struct snd_opti9xx *chip)
712{ 712{
713 int i, err; 713 int i, err;
714 714
@@ -732,9 +732,9 @@ static int __devinit snd_card_opti9xx_detect(struct snd_card *card,
732} 732}
733 733
734#ifdef CONFIG_PNP 734#ifdef CONFIG_PNP
735static int __devinit snd_card_opti9xx_pnp(struct snd_opti9xx *chip, 735static int snd_card_opti9xx_pnp(struct snd_opti9xx *chip,
736 struct pnp_card_link *card, 736 struct pnp_card_link *card,
737 const struct pnp_card_device_id *pid) 737 const struct pnp_card_device_id *pid)
738{ 738{
739 struct pnp_dev *pdev; 739 struct pnp_dev *pdev;
740 int err; 740 int err;
@@ -817,7 +817,7 @@ static void snd_card_opti9xx_free(struct snd_card *card)
817 } 817 }
818} 818}
819 819
820static int __devinit snd_opti9xx_probe(struct snd_card *card) 820static int snd_opti9xx_probe(struct snd_card *card)
821{ 821{
822 static long possible_ports[] = {0x530, 0xe80, 0xf40, 0x604, -1}; 822 static long possible_ports[] = {0x530, 0xe80, 0xf40, 0x604, -1};
823 int error; 823 int error;
@@ -952,8 +952,8 @@ static int snd_opti9xx_card_new(struct snd_card **cardp)
952 return 0; 952 return 0;
953} 953}
954 954
955static int __devinit snd_opti9xx_isa_match(struct device *devptr, 955static int snd_opti9xx_isa_match(struct device *devptr,
956 unsigned int dev) 956 unsigned int dev)
957{ 957{
958#ifdef CONFIG_PNP 958#ifdef CONFIG_PNP
959 if (snd_opti9xx_pnp_is_probed) 959 if (snd_opti9xx_pnp_is_probed)
@@ -964,8 +964,8 @@ static int __devinit snd_opti9xx_isa_match(struct device *devptr,
964 return 1; 964 return 1;
965} 965}
966 966
967static int __devinit snd_opti9xx_isa_probe(struct device *devptr, 967static int snd_opti9xx_isa_probe(struct device *devptr,
968 unsigned int dev) 968 unsigned int dev)
969{ 969{
970 struct snd_card *card; 970 struct snd_card *card;
971 int error; 971 int error;
@@ -1031,8 +1031,8 @@ static int __devinit snd_opti9xx_isa_probe(struct device *devptr,
1031 return 0; 1031 return 0;
1032} 1032}
1033 1033
1034static int __devexit snd_opti9xx_isa_remove(struct device *devptr, 1034static int snd_opti9xx_isa_remove(struct device *devptr,
1035 unsigned int dev) 1035 unsigned int dev)
1036{ 1036{
1037 snd_card_free(dev_get_drvdata(devptr)); 1037 snd_card_free(dev_get_drvdata(devptr));
1038 dev_set_drvdata(devptr, NULL); 1038 dev_set_drvdata(devptr, NULL);
@@ -1083,7 +1083,7 @@ static int snd_opti9xx_isa_resume(struct device *dev, unsigned int n)
1083static struct isa_driver snd_opti9xx_driver = { 1083static struct isa_driver snd_opti9xx_driver = {
1084 .match = snd_opti9xx_isa_match, 1084 .match = snd_opti9xx_isa_match,
1085 .probe = snd_opti9xx_isa_probe, 1085 .probe = snd_opti9xx_isa_probe,
1086 .remove = __devexit_p(snd_opti9xx_isa_remove), 1086 .remove = snd_opti9xx_isa_remove,
1087#ifdef CONFIG_PM 1087#ifdef CONFIG_PM
1088 .suspend = snd_opti9xx_isa_suspend, 1088 .suspend = snd_opti9xx_isa_suspend,
1089 .resume = snd_opti9xx_isa_resume, 1089 .resume = snd_opti9xx_isa_resume,
@@ -1094,8 +1094,8 @@ static struct isa_driver snd_opti9xx_driver = {
1094}; 1094};
1095 1095
1096#ifdef CONFIG_PNP 1096#ifdef CONFIG_PNP
1097static int __devinit snd_opti9xx_pnp_probe(struct pnp_card_link *pcard, 1097static int snd_opti9xx_pnp_probe(struct pnp_card_link *pcard,
1098 const struct pnp_card_device_id *pid) 1098 const struct pnp_card_device_id *pid)
1099{ 1099{
1100 struct snd_card *card; 1100 struct snd_card *card;
1101 int error, hw; 1101 int error, hw;
@@ -1146,7 +1146,7 @@ static int __devinit snd_opti9xx_pnp_probe(struct pnp_card_link *pcard,
1146 return 0; 1146 return 0;
1147} 1147}
1148 1148
1149static void __devexit snd_opti9xx_pnp_remove(struct pnp_card_link * pcard) 1149static void snd_opti9xx_pnp_remove(struct pnp_card_link *pcard)
1150{ 1150{
1151 snd_card_free(pnp_get_card_drvdata(pcard)); 1151 snd_card_free(pnp_get_card_drvdata(pcard));
1152 pnp_set_card_drvdata(pcard, NULL); 1152 pnp_set_card_drvdata(pcard, NULL);
@@ -1171,7 +1171,7 @@ static struct pnp_card_driver opti9xx_pnpc_driver = {
1171 .name = "opti9xx", 1171 .name = "opti9xx",
1172 .id_table = snd_opti9xx_pnpids, 1172 .id_table = snd_opti9xx_pnpids,
1173 .probe = snd_opti9xx_pnp_probe, 1173 .probe = snd_opti9xx_pnp_probe,
1174 .remove = __devexit_p(snd_opti9xx_pnp_remove), 1174 .remove = snd_opti9xx_pnp_remove,
1175#ifdef CONFIG_PM 1175#ifdef CONFIG_PM
1176 .suspend = snd_opti9xx_pnp_suspend, 1176 .suspend = snd_opti9xx_pnp_suspend,
1177 .resume = snd_opti9xx_pnp_resume, 1177 .resume = snd_opti9xx_pnp_resume,
diff --git a/sound/isa/sb/emu8000.c b/sound/isa/sb/emu8000.c
index 2aae6a0efbcd..45fcdff611f9 100644
--- a/sound/isa/sb/emu8000.c
+++ b/sound/isa/sb/emu8000.c
@@ -131,7 +131,7 @@ snd_emu8000_dma_chan(struct snd_emu8000 *emu, int ch, int mode)
131 131
132/* 132/*
133 */ 133 */
134static void __devinit 134static void
135snd_emu8000_read_wait(struct snd_emu8000 *emu) 135snd_emu8000_read_wait(struct snd_emu8000 *emu)
136{ 136{
137 while ((EMU8000_SMALR_READ(emu) & 0x80000000) != 0) { 137 while ((EMU8000_SMALR_READ(emu) & 0x80000000) != 0) {
@@ -143,7 +143,7 @@ snd_emu8000_read_wait(struct snd_emu8000 *emu)
143 143
144/* 144/*
145 */ 145 */
146static void __devinit 146static void
147snd_emu8000_write_wait(struct snd_emu8000 *emu) 147snd_emu8000_write_wait(struct snd_emu8000 *emu)
148{ 148{
149 while ((EMU8000_SMALW_READ(emu) & 0x80000000) != 0) { 149 while ((EMU8000_SMALW_READ(emu) & 0x80000000) != 0) {
@@ -156,7 +156,7 @@ snd_emu8000_write_wait(struct snd_emu8000 *emu)
156/* 156/*
157 * detect a card at the given port 157 * detect a card at the given port
158 */ 158 */
159static int __devinit 159static int
160snd_emu8000_detect(struct snd_emu8000 *emu) 160snd_emu8000_detect(struct snd_emu8000 *emu)
161{ 161{
162 /* Initialise */ 162 /* Initialise */
@@ -182,7 +182,7 @@ snd_emu8000_detect(struct snd_emu8000 *emu)
182/* 182/*
183 * intiailize audio channels 183 * intiailize audio channels
184 */ 184 */
185static void __devinit 185static void
186init_audio(struct snd_emu8000 *emu) 186init_audio(struct snd_emu8000 *emu)
187{ 187{
188 int ch; 188 int ch;
@@ -223,7 +223,7 @@ init_audio(struct snd_emu8000 *emu)
223/* 223/*
224 * initialize DMA address 224 * initialize DMA address
225 */ 225 */
226static void __devinit 226static void
227init_dma(struct snd_emu8000 *emu) 227init_dma(struct snd_emu8000 *emu)
228{ 228{
229 EMU8000_SMALR_WRITE(emu, 0); 229 EMU8000_SMALR_WRITE(emu, 0);
@@ -235,7 +235,7 @@ init_dma(struct snd_emu8000 *emu)
235/* 235/*
236 * initialization arrays; from ADIP 236 * initialization arrays; from ADIP
237 */ 237 */
238static unsigned short init1[128] /*__devinitdata*/ = { 238static unsigned short init1[128] = {
239 0x03ff, 0x0030, 0x07ff, 0x0130, 0x0bff, 0x0230, 0x0fff, 0x0330, 239 0x03ff, 0x0030, 0x07ff, 0x0130, 0x0bff, 0x0230, 0x0fff, 0x0330,
240 0x13ff, 0x0430, 0x17ff, 0x0530, 0x1bff, 0x0630, 0x1fff, 0x0730, 240 0x13ff, 0x0430, 0x17ff, 0x0530, 0x1bff, 0x0630, 0x1fff, 0x0730,
241 0x23ff, 0x0830, 0x27ff, 0x0930, 0x2bff, 0x0a30, 0x2fff, 0x0b30, 241 0x23ff, 0x0830, 0x27ff, 0x0930, 0x2bff, 0x0a30, 0x2fff, 0x0b30,
@@ -257,7 +257,7 @@ static unsigned short init1[128] /*__devinitdata*/ = {
257 0xf3ff, 0x0c30, 0xf7ff, 0x0d30, 0xfbff, 0x0e30, 0xffff, 0x0f30, 257 0xf3ff, 0x0c30, 0xf7ff, 0x0d30, 0xfbff, 0x0e30, 0xffff, 0x0f30,
258}; 258};
259 259
260static unsigned short init2[128] /*__devinitdata*/ = { 260static unsigned short init2[128] = {
261 0x03ff, 0x8030, 0x07ff, 0x8130, 0x0bff, 0x8230, 0x0fff, 0x8330, 261 0x03ff, 0x8030, 0x07ff, 0x8130, 0x0bff, 0x8230, 0x0fff, 0x8330,
262 0x13ff, 0x8430, 0x17ff, 0x8530, 0x1bff, 0x8630, 0x1fff, 0x8730, 262 0x13ff, 0x8430, 0x17ff, 0x8530, 0x1bff, 0x8630, 0x1fff, 0x8730,
263 0x23ff, 0x8830, 0x27ff, 0x8930, 0x2bff, 0x8a30, 0x2fff, 0x8b30, 263 0x23ff, 0x8830, 0x27ff, 0x8930, 0x2bff, 0x8a30, 0x2fff, 0x8b30,
@@ -279,7 +279,7 @@ static unsigned short init2[128] /*__devinitdata*/ = {
279 0xf3ff, 0x8c30, 0xf7ff, 0x8d30, 0xfbff, 0x8e30, 0xffff, 0x8f30, 279 0xf3ff, 0x8c30, 0xf7ff, 0x8d30, 0xfbff, 0x8e30, 0xffff, 0x8f30,
280}; 280};
281 281
282static unsigned short init3[128] /*__devinitdata*/ = { 282static unsigned short init3[128] = {
283 0x0C10, 0x8470, 0x14FE, 0xB488, 0x167F, 0xA470, 0x18E7, 0x84B5, 283 0x0C10, 0x8470, 0x14FE, 0xB488, 0x167F, 0xA470, 0x18E7, 0x84B5,
284 0x1B6E, 0x842A, 0x1F1D, 0x852A, 0x0DA3, 0x8F7C, 0x167E, 0xF254, 284 0x1B6E, 0x842A, 0x1F1D, 0x852A, 0x0DA3, 0x8F7C, 0x167E, 0xF254,
285 0x0000, 0x842A, 0x0001, 0x852A, 0x18E6, 0x8BAA, 0x1B6D, 0xF234, 285 0x0000, 0x842A, 0x0001, 0x852A, 0x18E6, 0x8BAA, 0x1B6D, 0xF234,
@@ -301,7 +301,7 @@ static unsigned short init3[128] /*__devinitdata*/ = {
301 0x1342, 0xD36E, 0x3EC7, 0xB3FF, 0x0000, 0x8365, 0x1420, 0x9570, 301 0x1342, 0xD36E, 0x3EC7, 0xB3FF, 0x0000, 0x8365, 0x1420, 0x9570,
302}; 302};
303 303
304static unsigned short init4[128] /*__devinitdata*/ = { 304static unsigned short init4[128] = {
305 0x0C10, 0x8470, 0x14FE, 0xB488, 0x167F, 0xA470, 0x18E7, 0x84B5, 305 0x0C10, 0x8470, 0x14FE, 0xB488, 0x167F, 0xA470, 0x18E7, 0x84B5,
306 0x1B6E, 0x842A, 0x1F1D, 0x852A, 0x0DA3, 0x0F7C, 0x167E, 0x7254, 306 0x1B6E, 0x842A, 0x1F1D, 0x852A, 0x0DA3, 0x0F7C, 0x167E, 0x7254,
307 0x0000, 0x842A, 0x0001, 0x852A, 0x18E6, 0x0BAA, 0x1B6D, 0x7234, 307 0x0000, 0x842A, 0x0001, 0x852A, 0x18E6, 0x0BAA, 0x1B6D, 0x7234,
@@ -327,7 +327,7 @@ static unsigned short init4[128] /*__devinitdata*/ = {
327 * Taken from the oss driver, not obvious from the doc how this 327 * Taken from the oss driver, not obvious from the doc how this
328 * is meant to work 328 * is meant to work
329 */ 329 */
330static void __devinit 330static void
331send_array(struct snd_emu8000 *emu, unsigned short *data, int size) 331send_array(struct snd_emu8000 *emu, unsigned short *data, int size)
332{ 332{
333 int i; 333 int i;
@@ -349,7 +349,7 @@ send_array(struct snd_emu8000 *emu, unsigned short *data, int size)
349 * Send initialization arrays to start up, this just follows the 349 * Send initialization arrays to start up, this just follows the
350 * initialisation sequence in the adip. 350 * initialisation sequence in the adip.
351 */ 351 */
352static void __devinit 352static void
353init_arrays(struct snd_emu8000 *emu) 353init_arrays(struct snd_emu8000 *emu)
354{ 354{
355 send_array(emu, init1, ARRAY_SIZE(init1)/4); 355 send_array(emu, init1, ARRAY_SIZE(init1)/4);
@@ -375,7 +375,7 @@ init_arrays(struct snd_emu8000 *emu)
375 * seems that the only way to do this is to use the one channel and keep 375 * seems that the only way to do this is to use the one channel and keep
376 * reallocating between read and write. 376 * reallocating between read and write.
377 */ 377 */
378static void __devinit 378static void
379size_dram(struct snd_emu8000 *emu) 379size_dram(struct snd_emu8000 *emu)
380{ 380{
381 int i, size, detected_size; 381 int i, size, detected_size;
@@ -512,7 +512,7 @@ snd_emu8000_init_fm(struct snd_emu8000 *emu)
512/* 512/*
513 * The main initialization routine. 513 * The main initialization routine.
514 */ 514 */
515static void __devinit 515static void
516snd_emu8000_init_hw(struct snd_emu8000 *emu) 516snd_emu8000_init_hw(struct snd_emu8000 *emu)
517{ 517{
518 int i; 518 int i;
@@ -1031,7 +1031,7 @@ static struct snd_kcontrol_new *mixer_defs[EMU8000_NUM_CONTROLS] = {
1031/* 1031/*
1032 * create and attach mixer elements for WaveTable treble/bass controls 1032 * create and attach mixer elements for WaveTable treble/bass controls
1033 */ 1033 */
1034static int __devinit 1034static int
1035snd_emu8000_create_mixer(struct snd_card *card, struct snd_emu8000 *emu) 1035snd_emu8000_create_mixer(struct snd_card *card, struct snd_emu8000 *emu)
1036{ 1036{
1037 int i, err = 0; 1037 int i, err = 0;
@@ -1082,7 +1082,7 @@ static int snd_emu8000_dev_free(struct snd_device *device)
1082/* 1082/*
1083 * initialize and register emu8000 synth device. 1083 * initialize and register emu8000 synth device.
1084 */ 1084 */
1085int __devinit 1085int
1086snd_emu8000_new(struct snd_card *card, int index, long port, int seq_ports, 1086snd_emu8000_new(struct snd_card *card, int index, long port, int seq_ports,
1087 struct snd_seq_device **awe_ret) 1087 struct snd_seq_device **awe_ret)
1088{ 1088{
diff --git a/sound/isa/sb/jazz16.c b/sound/isa/sb/jazz16.c
index 410758c68090..4961da4e627c 100644
--- a/sound/isa/sb/jazz16.c
+++ b/sound/isa/sb/jazz16.c
@@ -78,8 +78,8 @@ static irqreturn_t jazz16_interrupt(int irq, void *chip)
78 return snd_sb8dsp_interrupt(chip); 78 return snd_sb8dsp_interrupt(chip);
79} 79}
80 80
81static int __devinit jazz16_configure_ports(unsigned long port, 81static int jazz16_configure_ports(unsigned long port,
82 unsigned long mpu_port, int idx) 82 unsigned long mpu_port, int idx)
83{ 83{
84 unsigned char val; 84 unsigned char val;
85 85
@@ -99,8 +99,8 @@ static int __devinit jazz16_configure_ports(unsigned long port,
99 return 0; 99 return 0;
100} 100}
101 101
102static int __devinit jazz16_detect_board(unsigned long port, 102static int jazz16_detect_board(unsigned long port,
103 unsigned long mpu_port) 103 unsigned long mpu_port)
104{ 104{
105 int err; 105 int err;
106 int val; 106 int val;
@@ -156,7 +156,7 @@ err_unmap:
156 return err; 156 return err;
157} 157}
158 158
159static int __devinit jazz16_configure_board(struct snd_sb *chip, int mpu_irq) 159static int jazz16_configure_board(struct snd_sb *chip, int mpu_irq)
160{ 160{
161 static unsigned char jazz_irq_bits[] = { 0, 0, 2, 3, 0, 1, 0, 4, 161 static unsigned char jazz_irq_bits[] = { 0, 0, 2, 3, 0, 1, 0, 4,
162 0, 2, 5, 0, 0, 0, 0, 6 }; 162 0, 2, 5, 0, 0, 0, 0, 6 };
@@ -183,7 +183,7 @@ static int __devinit jazz16_configure_board(struct snd_sb *chip, int mpu_irq)
183 return 0; 183 return 0;
184} 184}
185 185
186static int __devinit snd_jazz16_match(struct device *devptr, unsigned int dev) 186static int snd_jazz16_match(struct device *devptr, unsigned int dev)
187{ 187{
188 if (!enable[dev]) 188 if (!enable[dev])
189 return 0; 189 return 0;
@@ -218,7 +218,7 @@ static int __devinit snd_jazz16_match(struct device *devptr, unsigned int dev)
218 return 1; 218 return 1;
219} 219}
220 220
221static int __devinit snd_jazz16_probe(struct device *devptr, unsigned int dev) 221static int snd_jazz16_probe(struct device *devptr, unsigned int dev)
222{ 222{
223 struct snd_card *card; 223 struct snd_card *card;
224 struct snd_card_jazz16 *jazz16; 224 struct snd_card_jazz16 *jazz16;
@@ -341,7 +341,7 @@ err_free:
341 return err; 341 return err;
342} 342}
343 343
344static int __devexit snd_jazz16_remove(struct device *devptr, unsigned int dev) 344static int snd_jazz16_remove(struct device *devptr, unsigned int dev)
345{ 345{
346 struct snd_card *card = dev_get_drvdata(devptr); 346 struct snd_card *card = dev_get_drvdata(devptr);
347 347
@@ -380,7 +380,7 @@ static int snd_jazz16_resume(struct device *pdev, unsigned int n)
380static struct isa_driver snd_jazz16_driver = { 380static struct isa_driver snd_jazz16_driver = {
381 .match = snd_jazz16_match, 381 .match = snd_jazz16_match,
382 .probe = snd_jazz16_probe, 382 .probe = snd_jazz16_probe,
383 .remove = __devexit_p(snd_jazz16_remove), 383 .remove = snd_jazz16_remove,
384#ifdef CONFIG_PM 384#ifdef CONFIG_PM
385 .suspend = snd_jazz16_suspend, 385 .suspend = snd_jazz16_suspend,
386 .resume = snd_jazz16_resume, 386 .resume = snd_jazz16_resume,
diff --git a/sound/isa/sb/sb16.c b/sound/isa/sb/sb16.c
index 39b8eca15213..50dbec454f98 100644
--- a/sound/isa/sb/sb16.c
+++ b/sound/isa/sb/sb16.c
@@ -250,9 +250,9 @@ MODULE_DEVICE_TABLE(pnp_card, snd_sb16_pnpids);
250 250
251#ifdef CONFIG_PNP 251#ifdef CONFIG_PNP
252 252
253static int __devinit snd_card_sb16_pnp(int dev, struct snd_card_sb16 *acard, 253static int snd_card_sb16_pnp(int dev, struct snd_card_sb16 *acard,
254 struct pnp_card_link *card, 254 struct pnp_card_link *card,
255 const struct pnp_card_device_id *id) 255 const struct pnp_card_device_id *id)
256{ 256{
257 struct pnp_dev *pdev; 257 struct pnp_dev *pdev;
258 int err; 258 int err;
@@ -337,7 +337,7 @@ static int snd_sb16_card_new(int dev, struct snd_card **cardp)
337 return 0; 337 return 0;
338} 338}
339 339
340static int __devinit snd_sb16_probe(struct snd_card *card, int dev) 340static int snd_sb16_probe(struct snd_card *card, int dev)
341{ 341{
342 int xirq, xdma8, xdma16; 342 int xirq, xdma8, xdma16;
343 struct snd_sb *chip; 343 struct snd_sb *chip;
@@ -487,7 +487,7 @@ static int snd_sb16_resume(struct snd_card *card)
487} 487}
488#endif 488#endif
489 489
490static int __devinit snd_sb16_isa_probe1(int dev, struct device *pdev) 490static int snd_sb16_isa_probe1(int dev, struct device *pdev)
491{ 491{
492 struct snd_card_sb16 *acard; 492 struct snd_card_sb16 *acard;
493 struct snd_card *card; 493 struct snd_card *card;
@@ -517,12 +517,12 @@ static int __devinit snd_sb16_isa_probe1(int dev, struct device *pdev)
517} 517}
518 518
519 519
520static int __devinit snd_sb16_isa_match(struct device *pdev, unsigned int dev) 520static int snd_sb16_isa_match(struct device *pdev, unsigned int dev)
521{ 521{
522 return enable[dev] && !is_isapnp_selected(dev); 522 return enable[dev] && !is_isapnp_selected(dev);
523} 523}
524 524
525static int __devinit snd_sb16_isa_probe(struct device *pdev, unsigned int dev) 525static int snd_sb16_isa_probe(struct device *pdev, unsigned int dev)
526{ 526{
527 int err; 527 int err;
528 static int possible_irqs[] = {5, 9, 10, 7, -1}; 528 static int possible_irqs[] = {5, 9, 10, 7, -1};
@@ -563,7 +563,7 @@ static int __devinit snd_sb16_isa_probe(struct device *pdev, unsigned int dev)
563 } 563 }
564} 564}
565 565
566static int __devexit snd_sb16_isa_remove(struct device *pdev, unsigned int dev) 566static int snd_sb16_isa_remove(struct device *pdev, unsigned int dev)
567{ 567{
568 snd_card_free(dev_get_drvdata(pdev)); 568 snd_card_free(dev_get_drvdata(pdev));
569 dev_set_drvdata(pdev, NULL); 569 dev_set_drvdata(pdev, NULL);
@@ -592,7 +592,7 @@ static int snd_sb16_isa_resume(struct device *dev, unsigned int n)
592static struct isa_driver snd_sb16_isa_driver = { 592static struct isa_driver snd_sb16_isa_driver = {
593 .match = snd_sb16_isa_match, 593 .match = snd_sb16_isa_match,
594 .probe = snd_sb16_isa_probe, 594 .probe = snd_sb16_isa_probe,
595 .remove = __devexit_p(snd_sb16_isa_remove), 595 .remove = snd_sb16_isa_remove,
596#ifdef CONFIG_PM 596#ifdef CONFIG_PM
597 .suspend = snd_sb16_isa_suspend, 597 .suspend = snd_sb16_isa_suspend,
598 .resume = snd_sb16_isa_resume, 598 .resume = snd_sb16_isa_resume,
@@ -604,8 +604,8 @@ static struct isa_driver snd_sb16_isa_driver = {
604 604
605 605
606#ifdef CONFIG_PNP 606#ifdef CONFIG_PNP
607static int __devinit snd_sb16_pnp_detect(struct pnp_card_link *pcard, 607static int snd_sb16_pnp_detect(struct pnp_card_link *pcard,
608 const struct pnp_card_device_id *pid) 608 const struct pnp_card_device_id *pid)
609{ 609{
610 static int dev; 610 static int dev;
611 struct snd_card *card; 611 struct snd_card *card;
@@ -631,7 +631,7 @@ static int __devinit snd_sb16_pnp_detect(struct pnp_card_link *pcard,
631 return -ENODEV; 631 return -ENODEV;
632} 632}
633 633
634static void __devexit snd_sb16_pnp_remove(struct pnp_card_link * pcard) 634static void snd_sb16_pnp_remove(struct pnp_card_link *pcard)
635{ 635{
636 snd_card_free(pnp_get_card_drvdata(pcard)); 636 snd_card_free(pnp_get_card_drvdata(pcard));
637 pnp_set_card_drvdata(pcard, NULL); 637 pnp_set_card_drvdata(pcard, NULL);
@@ -657,7 +657,7 @@ static struct pnp_card_driver sb16_pnpc_driver = {
657#endif 657#endif
658 .id_table = snd_sb16_pnpids, 658 .id_table = snd_sb16_pnpids,
659 .probe = snd_sb16_pnp_detect, 659 .probe = snd_sb16_pnp_detect,
660 .remove = __devexit_p(snd_sb16_pnp_remove), 660 .remove = snd_sb16_pnp_remove,
661#ifdef CONFIG_PM 661#ifdef CONFIG_PM
662 .suspend = snd_sb16_pnp_suspend, 662 .suspend = snd_sb16_pnp_suspend,
663 .resume = snd_sb16_pnp_resume, 663 .resume = snd_sb16_pnp_resume,
diff --git a/sound/isa/sb/sb8.c b/sound/isa/sb/sb8.c
index ab5cebea52e1..237d964ff8a6 100644
--- a/sound/isa/sb/sb8.c
+++ b/sound/isa/sb/sb8.c
@@ -79,7 +79,7 @@ static void snd_sb8_free(struct snd_card *card)
79 release_and_free_resource(acard->fm_res); 79 release_and_free_resource(acard->fm_res);
80} 80}
81 81
82static int __devinit snd_sb8_match(struct device *pdev, unsigned int dev) 82static int snd_sb8_match(struct device *pdev, unsigned int dev)
83{ 83{
84 if (!enable[dev]) 84 if (!enable[dev])
85 return 0; 85 return 0;
@@ -94,7 +94,7 @@ static int __devinit snd_sb8_match(struct device *pdev, unsigned int dev)
94 return 1; 94 return 1;
95} 95}
96 96
97static int __devinit snd_sb8_probe(struct device *pdev, unsigned int dev) 97static int snd_sb8_probe(struct device *pdev, unsigned int dev)
98{ 98{
99 struct snd_sb *chip; 99 struct snd_sb *chip;
100 struct snd_card *card; 100 struct snd_card *card;
@@ -205,7 +205,7 @@ static int __devinit snd_sb8_probe(struct device *pdev, unsigned int dev)
205 return err; 205 return err;
206} 206}
207 207
208static int __devexit snd_sb8_remove(struct device *pdev, unsigned int dev) 208static int snd_sb8_remove(struct device *pdev, unsigned int dev)
209{ 209{
210 snd_card_free(dev_get_drvdata(pdev)); 210 snd_card_free(dev_get_drvdata(pdev));
211 dev_set_drvdata(pdev, NULL); 211 dev_set_drvdata(pdev, NULL);
@@ -244,7 +244,7 @@ static int snd_sb8_resume(struct device *dev, unsigned int n)
244static struct isa_driver snd_sb8_driver = { 244static struct isa_driver snd_sb8_driver = {
245 .match = snd_sb8_match, 245 .match = snd_sb8_match,
246 .probe = snd_sb8_probe, 246 .probe = snd_sb8_probe,
247 .remove = __devexit_p(snd_sb8_remove), 247 .remove = snd_sb8_remove,
248#ifdef CONFIG_PM 248#ifdef CONFIG_PM
249 .suspend = snd_sb8_suspend, 249 .suspend = snd_sb8_suspend,
250 .resume = snd_sb8_resume, 250 .resume = snd_sb8_resume,
diff --git a/sound/isa/sc6000.c b/sound/isa/sc6000.c
index d97d0f381817..5376ebff845e 100644
--- a/sound/isa/sc6000.c
+++ b/sound/isa/sc6000.c
@@ -121,7 +121,7 @@ MODULE_PARM_DESC(joystick, "Enable gameport.");
121/* 121/*
122 * sc6000_irq_to_softcfg - Decode irq number into cfg code. 122 * sc6000_irq_to_softcfg - Decode irq number into cfg code.
123 */ 123 */
124static __devinit unsigned char sc6000_irq_to_softcfg(int irq) 124static unsigned char sc6000_irq_to_softcfg(int irq)
125{ 125{
126 unsigned char val = 0; 126 unsigned char val = 0;
127 127
@@ -150,7 +150,7 @@ static __devinit unsigned char sc6000_irq_to_softcfg(int irq)
150/* 150/*
151 * sc6000_dma_to_softcfg - Decode dma number into cfg code. 151 * sc6000_dma_to_softcfg - Decode dma number into cfg code.
152 */ 152 */
153static __devinit unsigned char sc6000_dma_to_softcfg(int dma) 153static unsigned char sc6000_dma_to_softcfg(int dma)
154{ 154{
155 unsigned char val = 0; 155 unsigned char val = 0;
156 156
@@ -173,7 +173,7 @@ static __devinit unsigned char sc6000_dma_to_softcfg(int dma)
173/* 173/*
174 * sc6000_mpu_irq_to_softcfg - Decode MPU-401 irq number into cfg code. 174 * sc6000_mpu_irq_to_softcfg - Decode MPU-401 irq number into cfg code.
175 */ 175 */
176static __devinit unsigned char sc6000_mpu_irq_to_softcfg(int mpu_irq) 176static unsigned char sc6000_mpu_irq_to_softcfg(int mpu_irq)
177{ 177{
178 unsigned char val = 0; 178 unsigned char val = 0;
179 179
@@ -242,8 +242,8 @@ static int sc6000_write(char __iomem *vport, int cmd)
242 return -EIO; 242 return -EIO;
243} 243}
244 244
245static int __devinit sc6000_dsp_get_answer(char __iomem *vport, int command, 245static int sc6000_dsp_get_answer(char __iomem *vport, int command,
246 char *data, int data_len) 246 char *data, int data_len)
247{ 247{
248 int len = 0; 248 int len = 0;
249 249
@@ -269,7 +269,7 @@ static int __devinit sc6000_dsp_get_answer(char __iomem *vport, int command,
269 return len ? len : -EIO; 269 return len ? len : -EIO;
270} 270}
271 271
272static int __devinit sc6000_dsp_reset(char __iomem *vport) 272static int sc6000_dsp_reset(char __iomem *vport)
273{ 273{
274 iowrite8(1, vport + DSP_RESET); 274 iowrite8(1, vport + DSP_RESET);
275 udelay(10); 275 udelay(10);
@@ -281,7 +281,7 @@ static int __devinit sc6000_dsp_reset(char __iomem *vport)
281} 281}
282 282
283/* detection and initialization */ 283/* detection and initialization */
284static int __devinit sc6000_hw_cfg_write(char __iomem *vport, const int *cfg) 284static int sc6000_hw_cfg_write(char __iomem *vport, const int *cfg)
285{ 285{
286 if (sc6000_write(vport, COMMAND_6C) < 0) { 286 if (sc6000_write(vport, COMMAND_6C) < 0) {
287 snd_printk(KERN_WARNING "CMD 0x%x: failed!\n", COMMAND_6C); 287 snd_printk(KERN_WARNING "CMD 0x%x: failed!\n", COMMAND_6C);
@@ -345,8 +345,8 @@ static int sc6000_setup_board(char __iomem *vport, int config)
345 return 0; 345 return 0;
346} 346}
347 347
348static int __devinit sc6000_init_mss(char __iomem *vport, int config, 348static int sc6000_init_mss(char __iomem *vport, int config,
349 char __iomem *vmss_port, int mss_config) 349 char __iomem *vmss_port, int mss_config)
350{ 350{
351 if (sc6000_write(vport, DSP_INIT_MSS)) { 351 if (sc6000_write(vport, DSP_INIT_MSS)) {
352 snd_printk(KERN_ERR "sc6000_init_mss [0x%x]: failed!\n", 352 snd_printk(KERN_ERR "sc6000_init_mss [0x%x]: failed!\n",
@@ -364,9 +364,9 @@ static int __devinit sc6000_init_mss(char __iomem *vport, int config,
364 return 0; 364 return 0;
365} 365}
366 366
367static void __devinit sc6000_hw_cfg_encode(char __iomem *vport, int *cfg, 367static void sc6000_hw_cfg_encode(char __iomem *vport, int *cfg,
368 long xport, long xmpu, 368 long xport, long xmpu,
369 long xmss_port, int joystick) 369 long xmss_port, int joystick)
370{ 370{
371 cfg[0] = 0; 371 cfg[0] = 0;
372 cfg[1] = 0; 372 cfg[1] = 0;
@@ -386,8 +386,8 @@ static void __devinit sc6000_hw_cfg_encode(char __iomem *vport, int *cfg,
386 snd_printd("hw cfg %x, %x\n", cfg[0], cfg[1]); 386 snd_printd("hw cfg %x, %x\n", cfg[0], cfg[1]);
387} 387}
388 388
389static int __devinit sc6000_init_board(char __iomem *vport, 389static int sc6000_init_board(char __iomem *vport,
390 char __iomem *vmss_port, int dev) 390 char __iomem *vmss_port, int dev)
391{ 391{
392 char answer[15]; 392 char answer[15];
393 char version[2]; 393 char version[2];
@@ -467,7 +467,7 @@ static int __devinit sc6000_init_board(char __iomem *vport,
467 return 0; 467 return 0;
468} 468}
469 469
470static int __devinit snd_sc6000_mixer(struct snd_wss *chip) 470static int snd_sc6000_mixer(struct snd_wss *chip)
471{ 471{
472 struct snd_card *card = chip->card; 472 struct snd_card *card = chip->card;
473 struct snd_ctl_elem_id id1, id2; 473 struct snd_ctl_elem_id id1, id2;
@@ -502,7 +502,7 @@ static int __devinit snd_sc6000_mixer(struct snd_wss *chip)
502 return 0; 502 return 0;
503} 503}
504 504
505static int __devinit snd_sc6000_match(struct device *devptr, unsigned int dev) 505static int snd_sc6000_match(struct device *devptr, unsigned int dev)
506{ 506{
507 if (!enable[dev]) 507 if (!enable[dev])
508 return 0; 508 return 0;
@@ -545,7 +545,7 @@ static int __devinit snd_sc6000_match(struct device *devptr, unsigned int dev)
545 return 1; 545 return 1;
546} 546}
547 547
548static int __devinit snd_sc6000_probe(struct device *devptr, unsigned int dev) 548static int snd_sc6000_probe(struct device *devptr, unsigned int dev)
549{ 549{
550 static int possible_irqs[] = { 5, 7, 9, 10, 11, -1 }; 550 static int possible_irqs[] = { 5, 7, 9, 10, 11, -1 };
551 static int possible_dmas[] = { 1, 3, 0, -1 }; 551 static int possible_dmas[] = { 1, 3, 0, -1 };
@@ -687,7 +687,7 @@ err_exit:
687 return err; 687 return err;
688} 688}
689 689
690static int __devexit snd_sc6000_remove(struct device *devptr, unsigned int dev) 690static int snd_sc6000_remove(struct device *devptr, unsigned int dev)
691{ 691{
692 struct snd_card *card = dev_get_drvdata(devptr); 692 struct snd_card *card = dev_get_drvdata(devptr);
693 char __iomem **vport = card->private_data; 693 char __iomem **vport = card->private_data;
@@ -706,7 +706,7 @@ static int __devexit snd_sc6000_remove(struct device *devptr, unsigned int dev)
706static struct isa_driver snd_sc6000_driver = { 706static struct isa_driver snd_sc6000_driver = {
707 .match = snd_sc6000_match, 707 .match = snd_sc6000_match,
708 .probe = snd_sc6000_probe, 708 .probe = snd_sc6000_probe,
709 .remove = __devexit_p(snd_sc6000_remove), 709 .remove = snd_sc6000_remove,
710 /* FIXME: suspend/resume */ 710 /* FIXME: suspend/resume */
711 .driver = { 711 .driver = {
712 .name = DRV_NAME, 712 .name = DRV_NAME,
diff --git a/sound/isa/sscape.c b/sound/isa/sscape.c
index 8490f59709bb..42a009720b29 100644
--- a/sound/isa/sscape.c
+++ b/sound/isa/sscape.c
@@ -683,7 +683,7 @@ static struct snd_kcontrol_new midi_mixer_ctl = {
683 * These IRQs are encoded as bit patterns so that they can be 683 * These IRQs are encoded as bit patterns so that they can be
684 * written to the control registers. 684 * written to the control registers.
685 */ 685 */
686static unsigned __devinit get_irq_config(int sscape_type, int irq) 686static unsigned get_irq_config(int sscape_type, int irq)
687{ 687{
688 static const int valid_irq[] = { 9, 5, 7, 10 }; 688 static const int valid_irq[] = { 9, 5, 7, 10 };
689 static const int old_irq[] = { 9, 7, 5, 15 }; 689 static const int old_irq[] = { 9, 7, 5, 15 };
@@ -706,7 +706,7 @@ static unsigned __devinit get_irq_config(int sscape_type, int irq)
706 * Perform certain arcane port-checks to see whether there 706 * Perform certain arcane port-checks to see whether there
707 * is a SoundScape board lurking behind the given ports. 707 * is a SoundScape board lurking behind the given ports.
708 */ 708 */
709static int __devinit detect_sscape(struct soundscape *s, long wss_io) 709static int detect_sscape(struct soundscape *s, long wss_io)
710{ 710{
711 unsigned long flags; 711 unsigned long flags;
712 unsigned d; 712 unsigned d;
@@ -817,8 +817,8 @@ static int mpu401_open(struct snd_mpu401 *mpu)
817/* 817/*
818 * Initialse an MPU-401 subdevice for MIDI support on the SoundScape. 818 * Initialse an MPU-401 subdevice for MIDI support on the SoundScape.
819 */ 819 */
820static int __devinit create_mpu401(struct snd_card *card, int devnum, 820static int create_mpu401(struct snd_card *card, int devnum,
821 unsigned long port, int irq) 821 unsigned long port, int irq)
822{ 822{
823 struct soundscape *sscape = get_card_soundscape(card); 823 struct soundscape *sscape = get_card_soundscape(card);
824 struct snd_rawmidi *rawmidi; 824 struct snd_rawmidi *rawmidi;
@@ -845,8 +845,8 @@ static int __devinit create_mpu401(struct snd_card *card, int devnum,
845 * try to support at least some of the extra bits by overriding 845 * try to support at least some of the extra bits by overriding
846 * some of the CS4231 callback. 846 * some of the CS4231 callback.
847 */ 847 */
848static int __devinit create_ad1845(struct snd_card *card, unsigned port, 848static int create_ad1845(struct snd_card *card, unsigned port,
849 int irq, int dma1, int dma2) 849 int irq, int dma1, int dma2)
850{ 850{
851 register struct soundscape *sscape = get_card_soundscape(card); 851 register struct soundscape *sscape = get_card_soundscape(card);
852 struct snd_wss *chip; 852 struct snd_wss *chip;
@@ -937,7 +937,7 @@ _error:
937 * Create an ALSA soundcard entry for the SoundScape, using 937 * Create an ALSA soundcard entry for the SoundScape, using
938 * the given list of port, IRQ and DMA resources. 938 * the given list of port, IRQ and DMA resources.
939 */ 939 */
940static int __devinit create_sscape(int dev, struct snd_card *card) 940static int create_sscape(int dev, struct snd_card *card)
941{ 941{
942 struct soundscape *sscape = get_card_soundscape(card); 942 struct soundscape *sscape = get_card_soundscape(card);
943 unsigned dma_cfg; 943 unsigned dma_cfg;
@@ -1143,7 +1143,7 @@ _release_region:
1143} 1143}
1144 1144
1145 1145
1146static int __devinit snd_sscape_match(struct device *pdev, unsigned int i) 1146static int snd_sscape_match(struct device *pdev, unsigned int i)
1147{ 1147{
1148 /* 1148 /*
1149 * Make sure we were given ALL of the other parameters. 1149 * Make sure we were given ALL of the other parameters.
@@ -1163,7 +1163,7 @@ static int __devinit snd_sscape_match(struct device *pdev, unsigned int i)
1163 return 1; 1163 return 1;
1164} 1164}
1165 1165
1166static int __devinit snd_sscape_probe(struct device *pdev, unsigned int dev) 1166static int snd_sscape_probe(struct device *pdev, unsigned int dev)
1167{ 1167{
1168 struct snd_card *card; 1168 struct snd_card *card;
1169 struct soundscape *sscape; 1169 struct soundscape *sscape;
@@ -1197,7 +1197,7 @@ _release_card:
1197 return ret; 1197 return ret;
1198} 1198}
1199 1199
1200static int __devexit snd_sscape_remove(struct device *devptr, unsigned int dev) 1200static int snd_sscape_remove(struct device *devptr, unsigned int dev)
1201{ 1201{
1202 snd_card_free(dev_get_drvdata(devptr)); 1202 snd_card_free(dev_get_drvdata(devptr));
1203 dev_set_drvdata(devptr, NULL); 1203 dev_set_drvdata(devptr, NULL);
@@ -1209,7 +1209,7 @@ static int __devexit snd_sscape_remove(struct device *devptr, unsigned int dev)
1209static struct isa_driver snd_sscape_driver = { 1209static struct isa_driver snd_sscape_driver = {
1210 .match = snd_sscape_match, 1210 .match = snd_sscape_match,
1211 .probe = snd_sscape_probe, 1211 .probe = snd_sscape_probe,
1212 .remove = __devexit_p(snd_sscape_remove), 1212 .remove = snd_sscape_remove,
1213 /* FIXME: suspend/resume */ 1213 /* FIXME: suspend/resume */
1214 .driver = { 1214 .driver = {
1215 .name = DEV_NAME 1215 .name = DEV_NAME
@@ -1217,7 +1217,7 @@ static struct isa_driver snd_sscape_driver = {
1217}; 1217};
1218 1218
1219#ifdef CONFIG_PNP 1219#ifdef CONFIG_PNP
1220static inline int __devinit get_next_autoindex(int i) 1220static inline int get_next_autoindex(int i)
1221{ 1221{
1222 while (i < SNDRV_CARDS && port[i] != SNDRV_AUTO_PORT) 1222 while (i < SNDRV_CARDS && port[i] != SNDRV_AUTO_PORT)
1223 ++i; 1223 ++i;
@@ -1225,8 +1225,8 @@ static inline int __devinit get_next_autoindex(int i)
1225} 1225}
1226 1226
1227 1227
1228static int __devinit sscape_pnp_detect(struct pnp_card_link *pcard, 1228static int sscape_pnp_detect(struct pnp_card_link *pcard,
1229 const struct pnp_card_device_id *pid) 1229 const struct pnp_card_device_id *pid)
1230{ 1230{
1231 static int idx = 0; 1231 static int idx = 0;
1232 struct pnp_dev *dev; 1232 struct pnp_dev *dev;
@@ -1310,7 +1310,7 @@ _release_card:
1310 return ret; 1310 return ret;
1311} 1311}
1312 1312
1313static void __devexit sscape_pnp_remove(struct pnp_card_link * pcard) 1313static void sscape_pnp_remove(struct pnp_card_link *pcard)
1314{ 1314{
1315 snd_card_free(pnp_get_card_drvdata(pcard)); 1315 snd_card_free(pnp_get_card_drvdata(pcard));
1316 pnp_set_card_drvdata(pcard, NULL); 1316 pnp_set_card_drvdata(pcard, NULL);
@@ -1321,7 +1321,7 @@ static struct pnp_card_driver sscape_pnpc_driver = {
1321 .name = "sscape", 1321 .name = "sscape",
1322 .id_table = sscape_pnpids, 1322 .id_table = sscape_pnpids,
1323 .probe = sscape_pnp_detect, 1323 .probe = sscape_pnp_detect,
1324 .remove = __devexit_p(sscape_pnp_remove), 1324 .remove = sscape_pnp_remove,
1325}; 1325};
1326 1326
1327#endif /* CONFIG_PNP */ 1327#endif /* CONFIG_PNP */
diff --git a/sound/isa/wavefront/wavefront.c b/sound/isa/wavefront/wavefront.c
index e0a73271cb91..fe5dd982bd23 100644
--- a/sound/isa/wavefront/wavefront.c
+++ b/sound/isa/wavefront/wavefront.c
@@ -98,7 +98,7 @@ static struct pnp_card_device_id snd_wavefront_pnpids[] = {
98 98
99MODULE_DEVICE_TABLE(pnp_card, snd_wavefront_pnpids); 99MODULE_DEVICE_TABLE(pnp_card, snd_wavefront_pnpids);
100 100
101static int __devinit 101static int
102snd_wavefront_pnp (int dev, snd_wavefront_card_t *acard, struct pnp_card_link *card, 102snd_wavefront_pnp (int dev, snd_wavefront_card_t *acard, struct pnp_card_link *card,
103 const struct pnp_card_device_id *id) 103 const struct pnp_card_device_id *id)
104{ 104{
@@ -231,10 +231,9 @@ static irqreturn_t snd_wavefront_ics2115_interrupt(int irq, void *dev_id)
231 return IRQ_HANDLED; 231 return IRQ_HANDLED;
232} 232}
233 233
234static struct snd_hwdep * __devinit 234static struct snd_hwdep *snd_wavefront_new_synth(struct snd_card *card,
235snd_wavefront_new_synth (struct snd_card *card, 235 int hw_dev,
236 int hw_dev, 236 snd_wavefront_card_t *acard)
237 snd_wavefront_card_t *acard)
238{ 237{
239 struct snd_hwdep *wavefront_synth; 238 struct snd_hwdep *wavefront_synth;
240 239
@@ -257,11 +256,10 @@ snd_wavefront_new_synth (struct snd_card *card,
257 return wavefront_synth; 256 return wavefront_synth;
258} 257}
259 258
260static struct snd_hwdep * __devinit 259static struct snd_hwdep *snd_wavefront_new_fx(struct snd_card *card,
261snd_wavefront_new_fx (struct snd_card *card, 260 int hw_dev,
262 int hw_dev, 261 snd_wavefront_card_t *acard,
263 snd_wavefront_card_t *acard, 262 unsigned long port)
264 unsigned long port)
265 263
266{ 264{
267 struct snd_hwdep *fx_processor; 265 struct snd_hwdep *fx_processor;
@@ -284,12 +282,11 @@ snd_wavefront_new_fx (struct snd_card *card,
284static snd_wavefront_mpu_id internal_id = internal_mpu; 282static snd_wavefront_mpu_id internal_id = internal_mpu;
285static snd_wavefront_mpu_id external_id = external_mpu; 283static snd_wavefront_mpu_id external_id = external_mpu;
286 284
287static struct snd_rawmidi *__devinit 285static struct snd_rawmidi *snd_wavefront_new_midi(struct snd_card *card,
288snd_wavefront_new_midi (struct snd_card *card, 286 int midi_dev,
289 int midi_dev, 287 snd_wavefront_card_t *acard,
290 snd_wavefront_card_t *acard, 288 unsigned long port,
291 unsigned long port, 289 snd_wavefront_mpu_id mpu)
292 snd_wavefront_mpu_id mpu)
293 290
294{ 291{
295 struct snd_rawmidi *rmidi; 292 struct snd_rawmidi *rmidi;
@@ -361,7 +358,7 @@ static int snd_wavefront_card_new(int dev, struct snd_card **cardp)
361 return 0; 358 return 0;
362} 359}
363 360
364static int __devinit 361static int
365snd_wavefront_probe (struct snd_card *card, int dev) 362snd_wavefront_probe (struct snd_card *card, int dev)
366{ 363{
367 snd_wavefront_card_t *acard = card->private_data; 364 snd_wavefront_card_t *acard = card->private_data;
@@ -541,8 +538,8 @@ snd_wavefront_probe (struct snd_card *card, int dev)
541 return snd_card_register(card); 538 return snd_card_register(card);
542} 539}
543 540
544static int __devinit snd_wavefront_isa_match(struct device *pdev, 541static int snd_wavefront_isa_match(struct device *pdev,
545 unsigned int dev) 542 unsigned int dev)
546{ 543{
547 if (!enable[dev]) 544 if (!enable[dev])
548 return 0; 545 return 0;
@@ -561,8 +558,8 @@ static int __devinit snd_wavefront_isa_match(struct device *pdev,
561 return 1; 558 return 1;
562} 559}
563 560
564static int __devinit snd_wavefront_isa_probe(struct device *pdev, 561static int snd_wavefront_isa_probe(struct device *pdev,
565 unsigned int dev) 562 unsigned int dev)
566{ 563{
567 struct snd_card *card; 564 struct snd_card *card;
568 int err; 565 int err;
@@ -580,8 +577,8 @@ static int __devinit snd_wavefront_isa_probe(struct device *pdev,
580 return 0; 577 return 0;
581} 578}
582 579
583static int __devexit snd_wavefront_isa_remove(struct device *devptr, 580static int snd_wavefront_isa_remove(struct device *devptr,
584 unsigned int dev) 581 unsigned int dev)
585{ 582{
586 snd_card_free(dev_get_drvdata(devptr)); 583 snd_card_free(dev_get_drvdata(devptr));
587 dev_set_drvdata(devptr, NULL); 584 dev_set_drvdata(devptr, NULL);
@@ -593,7 +590,7 @@ static int __devexit snd_wavefront_isa_remove(struct device *devptr,
593static struct isa_driver snd_wavefront_driver = { 590static struct isa_driver snd_wavefront_driver = {
594 .match = snd_wavefront_isa_match, 591 .match = snd_wavefront_isa_match,
595 .probe = snd_wavefront_isa_probe, 592 .probe = snd_wavefront_isa_probe,
596 .remove = __devexit_p(snd_wavefront_isa_remove), 593 .remove = snd_wavefront_isa_remove,
597 /* FIXME: suspend, resume */ 594 /* FIXME: suspend, resume */
598 .driver = { 595 .driver = {
599 .name = DEV_NAME 596 .name = DEV_NAME
@@ -602,8 +599,8 @@ static struct isa_driver snd_wavefront_driver = {
602 599
603 600
604#ifdef CONFIG_PNP 601#ifdef CONFIG_PNP
605static int __devinit snd_wavefront_pnp_detect(struct pnp_card_link *pcard, 602static int snd_wavefront_pnp_detect(struct pnp_card_link *pcard,
606 const struct pnp_card_device_id *pid) 603 const struct pnp_card_device_id *pid)
607{ 604{
608 static int dev; 605 static int dev;
609 struct snd_card *card; 606 struct snd_card *card;
@@ -637,7 +634,7 @@ static int __devinit snd_wavefront_pnp_detect(struct pnp_card_link *pcard,
637 return 0; 634 return 0;
638} 635}
639 636
640static void __devexit snd_wavefront_pnp_remove(struct pnp_card_link * pcard) 637static void snd_wavefront_pnp_remove(struct pnp_card_link *pcard)
641{ 638{
642 snd_card_free(pnp_get_card_drvdata(pcard)); 639 snd_card_free(pnp_get_card_drvdata(pcard));
643 pnp_set_card_drvdata(pcard, NULL); 640 pnp_set_card_drvdata(pcard, NULL);
@@ -648,7 +645,7 @@ static struct pnp_card_driver wavefront_pnpc_driver = {
648 .name = "wavefront", 645 .name = "wavefront",
649 .id_table = snd_wavefront_pnpids, 646 .id_table = snd_wavefront_pnpids,
650 .probe = snd_wavefront_pnp_detect, 647 .probe = snd_wavefront_pnp_detect,
651 .remove = __devexit_p(snd_wavefront_pnp_remove), 648 .remove = snd_wavefront_pnp_remove,
652 /* FIXME: suspend,resume */ 649 /* FIXME: suspend,resume */
653}; 650};
654 651
diff --git a/sound/isa/wavefront/wavefront_fx.c b/sound/isa/wavefront/wavefront_fx.c
index e51e0906050b..b77883c7ee76 100644
--- a/sound/isa/wavefront/wavefront_fx.c
+++ b/sound/isa/wavefront/wavefront_fx.c
@@ -240,7 +240,7 @@ snd_wavefront_fx_ioctl (struct snd_hwdep *sdev, struct file *file,
240 that outputs it. 240 that outputs it.
241*/ 241*/
242 242
243int __devinit 243int
244snd_wavefront_fx_start (snd_wavefront_t *dev) 244snd_wavefront_fx_start (snd_wavefront_t *dev)
245{ 245{
246 unsigned int i; 246 unsigned int i;
diff --git a/sound/isa/wavefront/wavefront_midi.c b/sound/isa/wavefront/wavefront_midi.c
index 65329f3abc30..7dc991682297 100644
--- a/sound/isa/wavefront/wavefront_midi.c
+++ b/sound/isa/wavefront/wavefront_midi.c
@@ -481,7 +481,7 @@ snd_wavefront_midi_disable_virtual (snd_wavefront_card_t *card)
481 spin_unlock_irqrestore (&card->wavefront.midi.virtual, flags); 481 spin_unlock_irqrestore (&card->wavefront.midi.virtual, flags);
482} 482}
483 483
484int __devinit 484int
485snd_wavefront_midi_start (snd_wavefront_card_t *card) 485snd_wavefront_midi_start (snd_wavefront_card_t *card)
486 486
487{ 487{
diff --git a/sound/isa/wavefront/wavefront_synth.c b/sound/isa/wavefront/wavefront_synth.c
index b1bf8d4e6494..a2f87f9488ee 100644
--- a/sound/isa/wavefront/wavefront_synth.c
+++ b/sound/isa/wavefront/wavefront_synth.c
@@ -1739,7 +1739,7 @@ snd_wavefront_internal_interrupt (snd_wavefront_card_t *card)
17397 Unused 17397 Unused
1740*/ 1740*/
1741 1741
1742static int __devinit 1742static int
1743snd_wavefront_interrupt_bits (int irq) 1743snd_wavefront_interrupt_bits (int irq)
1744 1744
1745{ 1745{
@@ -1767,7 +1767,7 @@ snd_wavefront_interrupt_bits (int irq)
1767 return bits; 1767 return bits;
1768} 1768}
1769 1769
1770static void __devinit 1770static void
1771wavefront_should_cause_interrupt (snd_wavefront_t *dev, 1771wavefront_should_cause_interrupt (snd_wavefront_t *dev,
1772 int val, int port, unsigned long timeout) 1772 int val, int port, unsigned long timeout)
1773 1773
@@ -1786,7 +1786,7 @@ wavefront_should_cause_interrupt (snd_wavefront_t *dev,
1786 } 1786 }
1787} 1787}
1788 1788
1789static int __devinit 1789static int
1790wavefront_reset_to_cleanliness (snd_wavefront_t *dev) 1790wavefront_reset_to_cleanliness (snd_wavefront_t *dev)
1791 1791
1792{ 1792{
@@ -1937,7 +1937,7 @@ wavefront_reset_to_cleanliness (snd_wavefront_t *dev)
1937 return (1); 1937 return (1);
1938} 1938}
1939 1939
1940static int __devinit 1940static int
1941wavefront_download_firmware (snd_wavefront_t *dev, char *path) 1941wavefront_download_firmware (snd_wavefront_t *dev, char *path)
1942 1942
1943{ 1943{
@@ -2010,7 +2010,7 @@ wavefront_download_firmware (snd_wavefront_t *dev, char *path)
2010} 2010}
2011 2011
2012 2012
2013static int __devinit 2013static int
2014wavefront_do_reset (snd_wavefront_t *dev) 2014wavefront_do_reset (snd_wavefront_t *dev)
2015 2015
2016{ 2016{
@@ -2099,7 +2099,7 @@ wavefront_do_reset (snd_wavefront_t *dev)
2099 return 1; 2099 return 1;
2100} 2100}
2101 2101
2102int __devinit 2102int
2103snd_wavefront_start (snd_wavefront_t *dev) 2103snd_wavefront_start (snd_wavefront_t *dev)
2104 2104
2105{ 2105{
@@ -2141,7 +2141,7 @@ snd_wavefront_start (snd_wavefront_t *dev)
2141 return (0); 2141 return (0);
2142} 2142}
2143 2143
2144int __devinit 2144int
2145snd_wavefront_detect (snd_wavefront_card_t *card) 2145snd_wavefront_detect (snd_wavefront_card_t *card)
2146 2146
2147{ 2147{
diff --git a/sound/mips/au1x00.c b/sound/mips/au1x00.c
index 3f3ec0bec067..224f54be15a6 100644
--- a/sound/mips/au1x00.c
+++ b/sound/mips/au1x00.c
@@ -439,7 +439,7 @@ static struct snd_pcm_ops snd_card_au1000_capture_ops = {
439 .pointer = snd_au1000_pointer, 439 .pointer = snd_au1000_pointer,
440}; 440};
441 441
442static int __devinit 442static int
443snd_au1000_pcm_new(struct snd_au1000 *au1000) 443snd_au1000_pcm_new(struct snd_au1000 *au1000)
444{ 444{
445 struct snd_pcm *pcm; 445 struct snd_pcm *pcm;
@@ -552,7 +552,7 @@ get the interrupt driven case to work efficiently */
552 spin_unlock(&au1000->ac97_lock); 552 spin_unlock(&au1000->ac97_lock);
553} 553}
554 554
555static int __devinit 555static int
556snd_au1000_ac97_new(struct snd_au1000 *au1000) 556snd_au1000_ac97_new(struct snd_au1000 *au1000)
557{ 557{
558 int err; 558 int err;
diff --git a/sound/mips/hal2.c b/sound/mips/hal2.c
index 5f88d1f09ffe..7420c59444ab 100644
--- a/sound/mips/hal2.c
+++ b/sound/mips/hal2.c
@@ -260,7 +260,7 @@ static int hal2_gain_put(struct snd_kcontrol *kcontrol,
260 return old != new; 260 return old != new;
261} 261}
262 262
263static struct snd_kcontrol_new hal2_ctrl_headphone __devinitdata = { 263static struct snd_kcontrol_new hal2_ctrl_headphone = {
264 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 264 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
265 .name = "Headphone Playback Volume", 265 .name = "Headphone Playback Volume",
266 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, 266 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
@@ -270,7 +270,7 @@ static struct snd_kcontrol_new hal2_ctrl_headphone __devinitdata = {
270 .put = hal2_gain_put, 270 .put = hal2_gain_put,
271}; 271};
272 272
273static struct snd_kcontrol_new hal2_ctrl_mic __devinitdata = { 273static struct snd_kcontrol_new hal2_ctrl_mic = {
274 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 274 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
275 .name = "Mic Capture Volume", 275 .name = "Mic Capture Volume",
276 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, 276 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
@@ -280,7 +280,7 @@ static struct snd_kcontrol_new hal2_ctrl_mic __devinitdata = {
280 .put = hal2_gain_put, 280 .put = hal2_gain_put,
281}; 281};
282 282
283static int __devinit hal2_mixer_create(struct snd_hal2 *hal2) 283static int hal2_mixer_create(struct snd_hal2 *hal2)
284{ 284{
285 int err; 285 int err;
286 286
@@ -733,7 +733,7 @@ static struct snd_pcm_ops hal2_capture_ops = {
733 .ack = hal2_capture_ack, 733 .ack = hal2_capture_ack,
734}; 734};
735 735
736static int __devinit hal2_pcm_create(struct snd_hal2 *hal2) 736static int hal2_pcm_create(struct snd_hal2 *hal2)
737{ 737{
738 struct snd_pcm *pcm; 738 struct snd_pcm *pcm;
739 int err; 739 int err;
@@ -874,7 +874,7 @@ static int hal2_create(struct snd_card *card, struct snd_hal2 **rchip)
874 return 0; 874 return 0;
875} 875}
876 876
877static int __devinit hal2_probe(struct platform_device *pdev) 877static int hal2_probe(struct platform_device *pdev)
878{ 878{
879 struct snd_card *card; 879 struct snd_card *card;
880 struct snd_hal2 *chip; 880 struct snd_hal2 *chip;
@@ -917,7 +917,7 @@ static int __devinit hal2_probe(struct platform_device *pdev)
917 return 0; 917 return 0;
918} 918}
919 919
920static int __devexit hal2_remove(struct platform_device *pdev) 920static int hal2_remove(struct platform_device *pdev)
921{ 921{
922 struct snd_card *card = platform_get_drvdata(pdev); 922 struct snd_card *card = platform_get_drvdata(pdev);
923 923
@@ -928,7 +928,7 @@ static int __devexit hal2_remove(struct platform_device *pdev)
928 928
929static struct platform_driver hal2_driver = { 929static struct platform_driver hal2_driver = {
930 .probe = hal2_probe, 930 .probe = hal2_probe,
931 .remove = __devexit_p(hal2_remove), 931 .remove = hal2_remove,
932 .driver = { 932 .driver = {
933 .name = "sgihal2", 933 .name = "sgihal2",
934 .owner = THIS_MODULE, 934 .owner = THIS_MODULE,
diff --git a/sound/mips/sgio2audio.c b/sound/mips/sgio2audio.c
index ceaa593ea4ef..01a03efdc8b0 100644
--- a/sound/mips/sgio2audio.c
+++ b/sound/mips/sgio2audio.c
@@ -237,7 +237,7 @@ static int sgio2audio_source_put(struct snd_kcontrol *kcontrol,
237} 237}
238 238
239/* dac1/pcm0 mixer control */ 239/* dac1/pcm0 mixer control */
240static struct snd_kcontrol_new sgio2audio_ctrl_pcm0 __devinitdata = { 240static struct snd_kcontrol_new sgio2audio_ctrl_pcm0 = {
241 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 241 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
242 .name = "PCM Playback Volume", 242 .name = "PCM Playback Volume",
243 .index = 0, 243 .index = 0,
@@ -249,7 +249,7 @@ static struct snd_kcontrol_new sgio2audio_ctrl_pcm0 __devinitdata = {
249}; 249};
250 250
251/* dac2/pcm1 mixer control */ 251/* dac2/pcm1 mixer control */
252static struct snd_kcontrol_new sgio2audio_ctrl_pcm1 __devinitdata = { 252static struct snd_kcontrol_new sgio2audio_ctrl_pcm1 = {
253 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 253 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
254 .name = "PCM Playback Volume", 254 .name = "PCM Playback Volume",
255 .index = 1, 255 .index = 1,
@@ -261,7 +261,7 @@ static struct snd_kcontrol_new sgio2audio_ctrl_pcm1 __devinitdata = {
261}; 261};
262 262
263/* record level mixer control */ 263/* record level mixer control */
264static struct snd_kcontrol_new sgio2audio_ctrl_reclevel __devinitdata = { 264static struct snd_kcontrol_new sgio2audio_ctrl_reclevel = {
265 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 265 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
266 .name = "Capture Volume", 266 .name = "Capture Volume",
267 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, 267 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
@@ -272,7 +272,7 @@ static struct snd_kcontrol_new sgio2audio_ctrl_reclevel __devinitdata = {
272}; 272};
273 273
274/* record level source control */ 274/* record level source control */
275static struct snd_kcontrol_new sgio2audio_ctrl_recsource __devinitdata = { 275static struct snd_kcontrol_new sgio2audio_ctrl_recsource = {
276 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 276 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
277 .name = "Capture Source", 277 .name = "Capture Source",
278 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, 278 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
@@ -282,7 +282,7 @@ static struct snd_kcontrol_new sgio2audio_ctrl_recsource __devinitdata = {
282}; 282};
283 283
284/* line mixer control */ 284/* line mixer control */
285static struct snd_kcontrol_new sgio2audio_ctrl_line __devinitdata = { 285static struct snd_kcontrol_new sgio2audio_ctrl_line = {
286 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 286 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
287 .name = "Line Playback Volume", 287 .name = "Line Playback Volume",
288 .index = 0, 288 .index = 0,
@@ -294,7 +294,7 @@ static struct snd_kcontrol_new sgio2audio_ctrl_line __devinitdata = {
294}; 294};
295 295
296/* cd mixer control */ 296/* cd mixer control */
297static struct snd_kcontrol_new sgio2audio_ctrl_cd __devinitdata = { 297static struct snd_kcontrol_new sgio2audio_ctrl_cd = {
298 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 298 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
299 .name = "Line Playback Volume", 299 .name = "Line Playback Volume",
300 .index = 1, 300 .index = 1,
@@ -306,7 +306,7 @@ static struct snd_kcontrol_new sgio2audio_ctrl_cd __devinitdata = {
306}; 306};
307 307
308/* mic mixer control */ 308/* mic mixer control */
309static struct snd_kcontrol_new sgio2audio_ctrl_mic __devinitdata = { 309static struct snd_kcontrol_new sgio2audio_ctrl_mic = {
310 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 310 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
311 .name = "Mic Playback Volume", 311 .name = "Mic Playback Volume",
312 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, 312 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
@@ -317,7 +317,7 @@ static struct snd_kcontrol_new sgio2audio_ctrl_mic __devinitdata = {
317}; 317};
318 318
319 319
320static int __devinit snd_sgio2audio_new_mixer(struct snd_sgio2audio *chip) 320static int snd_sgio2audio_new_mixer(struct snd_sgio2audio *chip)
321{ 321{
322 int err; 322 int err;
323 323
@@ -726,7 +726,7 @@ static struct snd_pcm_ops snd_sgio2audio_capture_ops = {
726 */ 726 */
727 727
728/* create a pcm device */ 728/* create a pcm device */
729static int __devinit snd_sgio2audio_new_pcm(struct snd_sgio2audio *chip) 729static int snd_sgio2audio_new_pcm(struct snd_sgio2audio *chip)
730{ 730{
731 struct snd_pcm *pcm; 731 struct snd_pcm *pcm;
732 int err; 732 int err;
@@ -834,8 +834,8 @@ static struct snd_device_ops ops = {
834 .dev_free = snd_sgio2audio_dev_free, 834 .dev_free = snd_sgio2audio_dev_free,
835}; 835};
836 836
837static int __devinit snd_sgio2audio_create(struct snd_card *card, 837static int snd_sgio2audio_create(struct snd_card *card,
838 struct snd_sgio2audio **rchip) 838 struct snd_sgio2audio **rchip)
839{ 839{
840 struct snd_sgio2audio *chip; 840 struct snd_sgio2audio *chip;
841 int i, err; 841 int i, err;
@@ -914,7 +914,7 @@ static int __devinit snd_sgio2audio_create(struct snd_card *card,
914 return 0; 914 return 0;
915} 915}
916 916
917static int __devinit snd_sgio2audio_probe(struct platform_device *pdev) 917static int snd_sgio2audio_probe(struct platform_device *pdev)
918{ 918{
919 struct snd_card *card; 919 struct snd_card *card;
920 struct snd_sgio2audio *chip; 920 struct snd_sgio2audio *chip;
@@ -958,7 +958,7 @@ static int __devinit snd_sgio2audio_probe(struct platform_device *pdev)
958 return 0; 958 return 0;
959} 959}
960 960
961static int __devexit snd_sgio2audio_remove(struct platform_device *pdev) 961static int snd_sgio2audio_remove(struct platform_device *pdev)
962{ 962{
963 struct snd_card *card = platform_get_drvdata(pdev); 963 struct snd_card *card = platform_get_drvdata(pdev);
964 964
@@ -969,7 +969,7 @@ static int __devexit snd_sgio2audio_remove(struct platform_device *pdev)
969 969
970static struct platform_driver sgio2audio_driver = { 970static struct platform_driver sgio2audio_driver = {
971 .probe = snd_sgio2audio_probe, 971 .probe = snd_sgio2audio_probe,
972 .remove = __devexit_p(snd_sgio2audio_remove), 972 .remove = snd_sgio2audio_remove,
973 .driver = { 973 .driver = {
974 .name = "sgio2audio", 974 .name = "sgio2audio",
975 .owner = THIS_MODULE, 975 .owner = THIS_MODULE,
diff --git a/sound/oss/ad1848.c b/sound/oss/ad1848.c
index 98d23bdcaf21..4918b7145b73 100644
--- a/sound/oss/ad1848.c
+++ b/sound/oss/ad1848.c
@@ -2864,7 +2864,7 @@ static struct {
2864 {NULL} 2864 {NULL}
2865}; 2865};
2866 2866
2867static struct isapnp_device_id id_table[] __devinitdata = { 2867static struct isapnp_device_id id_table[] = {
2868 { ISAPNP_VENDOR('C','M','I'), ISAPNP_DEVICE(0x0001), 2868 { ISAPNP_VENDOR('C','M','I'), ISAPNP_DEVICE(0x0001),
2869 ISAPNP_VENDOR('@','@','@'), ISAPNP_FUNCTION(0x0001), 0 }, 2869 ISAPNP_VENDOR('@','@','@'), ISAPNP_FUNCTION(0x0001), 0 },
2870 { ISAPNP_ANY_ID, ISAPNP_ANY_ID, 2870 { ISAPNP_ANY_ID, ISAPNP_ANY_ID,
diff --git a/sound/oss/kahlua.c b/sound/oss/kahlua.c
index 52d06a334e8f..2a44cc106459 100644
--- a/sound/oss/kahlua.c
+++ b/sound/oss/kahlua.c
@@ -43,7 +43,7 @@
43 * not real hardware. 43 * not real hardware.
44 */ 44 */
45 45
46static u8 __devinit mixer_read(unsigned long io, u8 reg) 46static u8 mixer_read(unsigned long io, u8 reg)
47{ 47{
48 outb(reg, io + 4); 48 outb(reg, io + 4);
49 udelay(20); 49 udelay(20);
@@ -52,7 +52,7 @@ static u8 __devinit mixer_read(unsigned long io, u8 reg)
52 return reg; 52 return reg;
53} 53}
54 54
55static int __devinit probe_one(struct pci_dev *pdev, const struct pci_device_id *ent) 55static int probe_one(struct pci_dev *pdev, const struct pci_device_id *ent)
56{ 56{
57 struct address_info *hw_config; 57 struct address_info *hw_config;
58 unsigned long base; 58 unsigned long base;
@@ -183,7 +183,7 @@ err_out_free:
183 return 1; 183 return 1;
184} 184}
185 185
186static void __devexit remove_one(struct pci_dev *pdev) 186static void remove_one(struct pci_dev *pdev)
187{ 187{
188 struct address_info *hw_config = pci_get_drvdata(pdev); 188 struct address_info *hw_config = pci_get_drvdata(pdev);
189 sb_dsp_unload(hw_config, 0); 189 sb_dsp_unload(hw_config, 0);
@@ -210,7 +210,7 @@ static struct pci_driver kahlua_driver = {
210 .name = "kahlua", 210 .name = "kahlua",
211 .id_table = id_tbl, 211 .id_table = id_tbl,
212 .probe = probe_one, 212 .probe = probe_one,
213 .remove = __devexit_p(remove_one), 213 .remove = remove_one,
214}; 214};
215 215
216 216
@@ -220,7 +220,7 @@ static int __init kahlua_init_module(void)
220 return pci_register_driver(&kahlua_driver); 220 return pci_register_driver(&kahlua_driver);
221} 221}
222 222
223static void __devexit kahlua_cleanup_module(void) 223static void kahlua_cleanup_module(void)
224{ 224{
225 pci_unregister_driver(&kahlua_driver); 225 pci_unregister_driver(&kahlua_driver);
226} 226}
diff --git a/sound/oss/pas2_card.c b/sound/oss/pas2_card.c
index dabf8a871dcc..7004e24d209f 100644
--- a/sound/oss/pas2_card.c
+++ b/sound/oss/pas2_card.c
@@ -333,6 +333,11 @@ static void __init attach_pas_card(struct address_info *hw_config)
333 { 333 {
334 char temp[100]; 334 char temp[100];
335 335
336 if (pas_model < 0 ||
337 pas_model >= ARRAY_SIZE(pas_model_names)) {
338 printk(KERN_ERR "pas2 unrecognized model.\n");
339 return;
340 }
336 sprintf(temp, 341 sprintf(temp,
337 "%s rev %d", pas_model_names[(int) pas_model], 342 "%s rev %d", pas_model_names[(int) pas_model],
338 pas_read(0x2789)); 343 pas_read(0x2789));
diff --git a/sound/oss/sb_audio.c b/sound/oss/sb_audio.c
index b2b3c014221a..048439a16000 100644
--- a/sound/oss/sb_audio.c
+++ b/sound/oss/sb_audio.c
@@ -442,7 +442,7 @@ static int sb201_audio_set_speed(int dev, int speed)
442{ 442{
443 sb_devc *devc = audio_devs[dev]->devc; 443 sb_devc *devc = audio_devs[dev]->devc;
444 int tmp; 444 int tmp;
445 int s = speed * devc->channels; 445 int s;
446 446
447 if (speed > 0) 447 if (speed > 0)
448 { 448 {
@@ -452,6 +452,7 @@ static int sb201_audio_set_speed(int dev, int speed)
452 speed = 44100; 452 speed = 44100;
453 if (devc->opened & OPEN_READ && speed > 15000) 453 if (devc->opened & OPEN_READ && speed > 15000)
454 speed = 15000; 454 speed = 15000;
455 s = speed * devc->channels;
455 devc->tconst = (256 - ((1000000 + s / 2) / s)) & 0xff; 456 devc->tconst = (256 - ((1000000 + s / 2) / s)) & 0xff;
456 tmp = 256 - devc->tconst; 457 tmp = 256 - devc->tconst;
457 speed = ((1000000 + tmp / 2) / tmp) / devc->channels; 458 speed = ((1000000 + tmp / 2) / tmp) / devc->channels;
diff --git a/sound/parisc/harmony.c b/sound/parisc/harmony.c
index f47f9e226b08..0e66ba48d453 100644
--- a/sound/parisc/harmony.c
+++ b/sound/parisc/harmony.c
@@ -856,7 +856,7 @@ static struct snd_kcontrol_new snd_harmony_controls[] = {
856 HARMONY_GAIN_HE_SHIFT, 1, 0), 856 HARMONY_GAIN_HE_SHIFT, 1, 0),
857}; 857};
858 858
859static void __devinit 859static void
860snd_harmony_mixer_reset(struct snd_harmony *h) 860snd_harmony_mixer_reset(struct snd_harmony *h)
861{ 861{
862 harmony_mute(h); 862 harmony_mute(h);
@@ -865,7 +865,7 @@ snd_harmony_mixer_reset(struct snd_harmony *h)
865 harmony_unmute(h); 865 harmony_unmute(h);
866} 866}
867 867
868static int __devinit 868static int
869snd_harmony_mixer_init(struct snd_harmony *h) 869snd_harmony_mixer_init(struct snd_harmony *h)
870{ 870{
871 struct snd_card *card; 871 struct snd_card *card;
@@ -915,7 +915,7 @@ snd_harmony_dev_free(struct snd_device *dev)
915 return snd_harmony_free(h); 915 return snd_harmony_free(h);
916} 916}
917 917
918static int __devinit 918static int
919snd_harmony_create(struct snd_card *card, 919snd_harmony_create(struct snd_card *card,
920 struct parisc_device *padev, 920 struct parisc_device *padev,
921 struct snd_harmony **rchip) 921 struct snd_harmony **rchip)
@@ -972,7 +972,7 @@ free_and_ret:
972 return err; 972 return err;
973} 973}
974 974
975static int __devinit 975static int
976snd_harmony_probe(struct parisc_device *padev) 976snd_harmony_probe(struct parisc_device *padev)
977{ 977{
978 int err; 978 int err;
@@ -1012,7 +1012,7 @@ free_and_ret:
1012 return err; 1012 return err;
1013} 1013}
1014 1014
1015static int __devexit 1015static int
1016snd_harmony_remove(struct parisc_device *padev) 1016snd_harmony_remove(struct parisc_device *padev)
1017{ 1017{
1018 snd_card_free(parisc_get_drvdata(padev)); 1018 snd_card_free(parisc_get_drvdata(padev));
@@ -1024,7 +1024,7 @@ static struct parisc_driver snd_harmony_driver = {
1024 .name = "harmony", 1024 .name = "harmony",
1025 .id_table = snd_harmony_devtable, 1025 .id_table = snd_harmony_devtable,
1026 .probe = snd_harmony_probe, 1026 .probe = snd_harmony_probe,
1027 .remove = __devexit_p(snd_harmony_remove), 1027 .remove = snd_harmony_remove,
1028}; 1028};
1029 1029
1030static int __init 1030static int __init
diff --git a/sound/pci/Kconfig b/sound/pci/Kconfig
index f99fa2512286..947cfb4eb30c 100644
--- a/sound/pci/Kconfig
+++ b/sound/pci/Kconfig
@@ -572,6 +572,7 @@ source "sound/pci/hda/Kconfig"
572 572
573config SND_HDSP 573config SND_HDSP
574 tristate "RME Hammerfall DSP Audio" 574 tristate "RME Hammerfall DSP Audio"
575 select FW_LOADER
575 select SND_HWDEP 576 select SND_HWDEP
576 select SND_RAWMIDI 577 select SND_RAWMIDI
577 select SND_PCM 578 select SND_PCM
@@ -630,7 +631,7 @@ config SND_ICE1724
630 AudioTrak Prodigy 192, 7.1 (HIFI/LT/XT), HD2; Hercules 631 AudioTrak Prodigy 192, 7.1 (HIFI/LT/XT), HD2; Hercules
631 Fortissimo IV; ESI Juli@; Pontis MS300; EGO-SYS WaveTerminal 632 Fortissimo IV; ESI Juli@; Pontis MS300; EGO-SYS WaveTerminal
632 192M; Albatron K8X800 Pro II; Chaintech ZNF3-150/250, 9CJS, 633 192M; Albatron K8X800 Pro II; Chaintech ZNF3-150/250, 9CJS,
633 AV-710; Shuttle SN25P. 634 AV-710; Shuttle SN25P; Philips PSC724 Ultimate Edge.
634 635
635 To compile this driver as a module, choose M here: the module 636 To compile this driver as a module, choose M here: the module
636 will be called snd-ice1724. 637 will be called snd-ice1724.
@@ -707,6 +708,7 @@ config SND_MAESTRO3_INPUT
707 708
708config SND_MIXART 709config SND_MIXART
709 tristate "Digigram miXart" 710 tristate "Digigram miXart"
711 select FW_LOADER
710 select SND_HWDEP 712 select SND_HWDEP
711 select SND_PCM 713 select SND_PCM
712 help 714 help
@@ -727,6 +729,7 @@ config SND_NM256
727 729
728config SND_PCXHR 730config SND_PCXHR
729 tristate "Digigram PCXHR" 731 tristate "Digigram PCXHR"
732 select FW_LOADER
730 select SND_PCM 733 select SND_PCM
731 select SND_HWDEP 734 select SND_HWDEP
732 help 735 help
diff --git a/sound/pci/ad1889.c b/sound/pci/ad1889.c
index e672ff4df2da..ad8a31173939 100644
--- a/sound/pci/ad1889.c
+++ b/sound/pci/ad1889.c
@@ -624,7 +624,7 @@ snd_ad1889_interrupt(int irq, void *dev_id)
624 return IRQ_HANDLED; 624 return IRQ_HANDLED;
625} 625}
626 626
627static int __devinit 627static int
628snd_ad1889_pcm_init(struct snd_ad1889 *chip, int device, struct snd_pcm **rpcm) 628snd_ad1889_pcm_init(struct snd_ad1889 *chip, int device, struct snd_pcm **rpcm)
629{ 629{
630 int err; 630 int err;
@@ -747,7 +747,7 @@ snd_ad1889_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffe
747 snd_iprintf(buffer, "Resampler samplerate: %u Hz\n", reg); 747 snd_iprintf(buffer, "Resampler samplerate: %u Hz\n", reg);
748} 748}
749 749
750static void __devinit 750static void
751snd_ad1889_proc_init(struct snd_ad1889 *chip) 751snd_ad1889_proc_init(struct snd_ad1889 *chip)
752{ 752{
753 struct snd_info_entry *entry; 753 struct snd_info_entry *entry;
@@ -767,7 +767,7 @@ static struct ac97_quirk ac97_quirks[] = {
767 { } /* terminator */ 767 { } /* terminator */
768}; 768};
769 769
770static void __devinit 770static void
771snd_ad1889_ac97_xinit(struct snd_ad1889 *chip) 771snd_ad1889_ac97_xinit(struct snd_ad1889 *chip)
772{ 772{
773 u16 reg; 773 u16 reg;
@@ -805,7 +805,7 @@ snd_ad1889_ac97_free(struct snd_ac97 *ac97)
805 chip->ac97 = NULL; 805 chip->ac97 = NULL;
806} 806}
807 807
808static int __devinit 808static int
809snd_ad1889_ac97_init(struct snd_ad1889 *chip, const char *quirk_override) 809snd_ad1889_ac97_init(struct snd_ad1889 *chip, const char *quirk_override)
810{ 810{
811 int err; 811 int err;
@@ -878,7 +878,7 @@ snd_ad1889_dev_free(struct snd_device *device)
878 return snd_ad1889_free(chip); 878 return snd_ad1889_free(chip);
879} 879}
880 880
881static int __devinit 881static int
882snd_ad1889_init(struct snd_ad1889 *chip) 882snd_ad1889_init(struct snd_ad1889 *chip)
883{ 883{
884 ad1889_writew(chip, AD_DS_CCS, AD_DS_CCS_CLKEN); /* turn on clock */ 884 ad1889_writew(chip, AD_DS_CCS, AD_DS_CCS_CLKEN); /* turn on clock */
@@ -892,7 +892,7 @@ snd_ad1889_init(struct snd_ad1889 *chip)
892 return 0; 892 return 0;
893} 893}
894 894
895static int __devinit 895static int
896snd_ad1889_create(struct snd_card *card, 896snd_ad1889_create(struct snd_card *card,
897 struct pci_dev *pci, 897 struct pci_dev *pci,
898 struct snd_ad1889 **rchip) 898 struct snd_ad1889 **rchip)
@@ -978,7 +978,7 @@ free_and_ret:
978 return err; 978 return err;
979} 979}
980 980
981static int __devinit 981static int
982snd_ad1889_probe(struct pci_dev *pci, 982snd_ad1889_probe(struct pci_dev *pci,
983 const struct pci_device_id *pci_id) 983 const struct pci_device_id *pci_id)
984{ 984{
@@ -1042,7 +1042,7 @@ free_and_ret:
1042 return err; 1042 return err;
1043} 1043}
1044 1044
1045static void __devexit 1045static void
1046snd_ad1889_remove(struct pci_dev *pci) 1046snd_ad1889_remove(struct pci_dev *pci)
1047{ 1047{
1048 snd_card_free(pci_get_drvdata(pci)); 1048 snd_card_free(pci_get_drvdata(pci));
@@ -1059,7 +1059,7 @@ static struct pci_driver ad1889_pci_driver = {
1059 .name = KBUILD_MODNAME, 1059 .name = KBUILD_MODNAME,
1060 .id_table = snd_ad1889_ids, 1060 .id_table = snd_ad1889_ids,
1061 .probe = snd_ad1889_probe, 1061 .probe = snd_ad1889_probe,
1062 .remove = __devexit_p(snd_ad1889_remove), 1062 .remove = snd_ad1889_remove,
1063}; 1063};
1064 1064
1065module_pci_driver(ad1889_pci_driver); 1065module_pci_driver(ad1889_pci_driver);
diff --git a/sound/pci/ak4531_codec.c b/sound/pci/ak4531_codec.c
index cadf7b962e30..3bf0dc53360a 100644
--- a/sound/pci/ak4531_codec.c
+++ b/sound/pci/ak4531_codec.c
@@ -274,7 +274,7 @@ static const DECLARE_TLV_DB_SCALE(db_scale_master, -6200, 200, 0);
274static const DECLARE_TLV_DB_SCALE(db_scale_mono, -2800, 400, 0); 274static const DECLARE_TLV_DB_SCALE(db_scale_mono, -2800, 400, 0);
275static const DECLARE_TLV_DB_SCALE(db_scale_input, -5000, 200, 0); 275static const DECLARE_TLV_DB_SCALE(db_scale_input, -5000, 200, 0);
276 276
277static struct snd_kcontrol_new snd_ak4531_controls[] __devinitdata = { 277static struct snd_kcontrol_new snd_ak4531_controls[] = {
278 278
279AK4531_DOUBLE_TLV("Master Playback Switch", 0, 279AK4531_DOUBLE_TLV("Master Playback Switch", 0,
280 AK4531_LMASTER, AK4531_RMASTER, 7, 7, 1, 1, 280 AK4531_LMASTER, AK4531_RMASTER, 7, 7, 1, 1,
@@ -383,9 +383,9 @@ static u8 snd_ak4531_initial_map[0x19 + 1] = {
383 0x01 /* 19: Mic Amp Setup */ 383 0x01 /* 19: Mic Amp Setup */
384}; 384};
385 385
386int __devinit snd_ak4531_mixer(struct snd_card *card, 386int snd_ak4531_mixer(struct snd_card *card,
387 struct snd_ak4531 *_ak4531, 387 struct snd_ak4531 *_ak4531,
388 struct snd_ak4531 **rak4531) 388 struct snd_ak4531 **rak4531)
389{ 389{
390 unsigned int idx; 390 unsigned int idx;
391 int err; 391 int err;
@@ -483,7 +483,7 @@ static void snd_ak4531_proc_read(struct snd_info_entry *entry,
483 ak4531->regs[AK4531_MIC_GAIN] & 1 ? "+30dB" : "+0dB"); 483 ak4531->regs[AK4531_MIC_GAIN] & 1 ? "+30dB" : "+0dB");
484} 484}
485 485
486static void __devinit 486static void
487snd_ak4531_proc_init(struct snd_card *card, struct snd_ak4531 *ak4531) 487snd_ak4531_proc_init(struct snd_card *card, struct snd_ak4531 *ak4531)
488{ 488{
489 struct snd_info_entry *entry; 489 struct snd_info_entry *entry;
diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c
index c7e3c533316e..136a393b70ab 100644
--- a/sound/pci/ali5451/ali5451.c
+++ b/sound/pci/ali5451/ali5451.c
@@ -1678,8 +1678,8 @@ static void snd_ali_pcm_free(struct snd_pcm *pcm)
1678} 1678}
1679 1679
1680 1680
1681static int __devinit snd_ali_pcm(struct snd_ali * codec, int device, 1681static int snd_ali_pcm(struct snd_ali *codec, int device,
1682 struct ali_pcm_description *desc) 1682 struct ali_pcm_description *desc)
1683{ 1683{
1684 struct snd_pcm *pcm; 1684 struct snd_pcm *pcm;
1685 int err; 1685 int err;
@@ -1727,7 +1727,7 @@ static struct ali_pcm_description ali_pcms[] = {
1727 } 1727 }
1728}; 1728};
1729 1729
1730static int __devinit snd_ali_build_pcms(struct snd_ali *codec) 1730static int snd_ali_build_pcms(struct snd_ali *codec)
1731{ 1731{
1732 int i, err; 1732 int i, err;
1733 for (i = 0; i < codec->num_of_codecs && i < ARRAY_SIZE(ali_pcms); i++) { 1733 for (i = 0; i < codec->num_of_codecs && i < ARRAY_SIZE(ali_pcms); i++) {
@@ -1832,7 +1832,7 @@ static int snd_ali5451_spdif_put(struct snd_kcontrol *kcontrol,
1832 return change; 1832 return change;
1833} 1833}
1834 1834
1835static struct snd_kcontrol_new snd_ali5451_mixer_spdif[] __devinitdata = { 1835static struct snd_kcontrol_new snd_ali5451_mixer_spdif[] = {
1836 /* spdif aplayback switch */ 1836 /* spdif aplayback switch */
1837 /* FIXME: "IEC958 Playback Switch" may conflict with one on ac97_codec */ 1837 /* FIXME: "IEC958 Playback Switch" may conflict with one on ac97_codec */
1838 ALI5451_SPDIF(SNDRV_CTL_NAME_IEC958("Output ",NONE,SWITCH), 0, 0), 1838 ALI5451_SPDIF(SNDRV_CTL_NAME_IEC958("Output ",NONE,SWITCH), 0, 0),
@@ -1842,7 +1842,7 @@ static struct snd_kcontrol_new snd_ali5451_mixer_spdif[] __devinitdata = {
1842 ALI5451_SPDIF(SNDRV_CTL_NAME_IEC958("",CAPTURE,SWITCH), 0, 2) 1842 ALI5451_SPDIF(SNDRV_CTL_NAME_IEC958("",CAPTURE,SWITCH), 0, 2)
1843}; 1843};
1844 1844
1845static int __devinit snd_ali_mixer(struct snd_ali * codec) 1845static int snd_ali_mixer(struct snd_ali *codec)
1846{ 1846{
1847 struct snd_ac97_template ac97; 1847 struct snd_ac97_template ac97;
1848 unsigned int idx; 1848 unsigned int idx;
@@ -2079,14 +2079,14 @@ static void snd_ali_proc_read(struct snd_info_entry *entry,
2079 snd_iprintf(buf, "%02x: %08x\n", i, inl(ALI_REG(codec, i))); 2079 snd_iprintf(buf, "%02x: %08x\n", i, inl(ALI_REG(codec, i)));
2080} 2080}
2081 2081
2082static void __devinit snd_ali_proc_init(struct snd_ali *codec) 2082static void snd_ali_proc_init(struct snd_ali *codec)
2083{ 2083{
2084 struct snd_info_entry *entry; 2084 struct snd_info_entry *entry;
2085 if (!snd_card_proc_new(codec->card, "ali5451", &entry)) 2085 if (!snd_card_proc_new(codec->card, "ali5451", &entry))
2086 snd_info_set_text_ops(entry, codec, snd_ali_proc_read); 2086 snd_info_set_text_ops(entry, codec, snd_ali_proc_read);
2087} 2087}
2088 2088
2089static int __devinit snd_ali_resources(struct snd_ali *codec) 2089static int snd_ali_resources(struct snd_ali *codec)
2090{ 2090{
2091 int err; 2091 int err;
2092 2092
@@ -2112,11 +2112,11 @@ static int snd_ali_dev_free(struct snd_device *device)
2112 return 0; 2112 return 0;
2113} 2113}
2114 2114
2115static int __devinit snd_ali_create(struct snd_card *card, 2115static int snd_ali_create(struct snd_card *card,
2116 struct pci_dev *pci, 2116 struct pci_dev *pci,
2117 int pcm_streams, 2117 int pcm_streams,
2118 int spdif_support, 2118 int spdif_support,
2119 struct snd_ali ** r_ali) 2119 struct snd_ali **r_ali)
2120{ 2120{
2121 struct snd_ali *codec; 2121 struct snd_ali *codec;
2122 int i, err; 2122 int i, err;
@@ -2246,8 +2246,8 @@ static int __devinit snd_ali_create(struct snd_card *card,
2246 return 0; 2246 return 0;
2247} 2247}
2248 2248
2249static int __devinit snd_ali_probe(struct pci_dev *pci, 2249static int snd_ali_probe(struct pci_dev *pci,
2250 const struct pci_device_id *pci_id) 2250 const struct pci_device_id *pci_id)
2251{ 2251{
2252 struct snd_card *card; 2252 struct snd_card *card;
2253 struct snd_ali *codec; 2253 struct snd_ali *codec;
@@ -2295,7 +2295,7 @@ static int __devinit snd_ali_probe(struct pci_dev *pci,
2295 return err; 2295 return err;
2296} 2296}
2297 2297
2298static void __devexit snd_ali_remove(struct pci_dev *pci) 2298static void snd_ali_remove(struct pci_dev *pci)
2299{ 2299{
2300 snd_card_free(pci_get_drvdata(pci)); 2300 snd_card_free(pci_get_drvdata(pci));
2301 pci_set_drvdata(pci, NULL); 2301 pci_set_drvdata(pci, NULL);
@@ -2305,7 +2305,7 @@ static struct pci_driver ali5451_driver = {
2305 .name = KBUILD_MODNAME, 2305 .name = KBUILD_MODNAME,
2306 .id_table = snd_ali_ids, 2306 .id_table = snd_ali_ids,
2307 .probe = snd_ali_probe, 2307 .probe = snd_ali_probe,
2308 .remove = __devexit_p(snd_ali_remove), 2308 .remove = snd_ali_remove,
2309 .driver = { 2309 .driver = {
2310 .pm = ALI_PM_OPS, 2310 .pm = ALI_PM_OPS,
2311 }, 2311 },
diff --git a/sound/pci/als300.c b/sound/pci/als300.c
index 5af3cb6b0c18..864c4310366b 100644
--- a/sound/pci/als300.c
+++ b/sound/pci/als300.c
@@ -278,7 +278,7 @@ static irqreturn_t snd_als300plus_interrupt(int irq, void *dev_id)
278 return IRQ_HANDLED; 278 return IRQ_HANDLED;
279} 279}
280 280
281static void __devexit snd_als300_remove(struct pci_dev *pci) 281static void snd_als300_remove(struct pci_dev *pci)
282{ 282{
283 snd_als300_dbgcallenter(); 283 snd_als300_dbgcallenter();
284 snd_card_free(pci_get_drvdata(pci)); 284 snd_card_free(pci_get_drvdata(pci));
@@ -622,7 +622,7 @@ static struct snd_pcm_ops snd_als300_capture_ops = {
622 .pointer = snd_als300_pointer, 622 .pointer = snd_als300_pointer,
623}; 623};
624 624
625static int __devinit snd_als300_new_pcm(struct snd_als300 *chip) 625static int snd_als300_new_pcm(struct snd_als300 *chip)
626{ 626{
627 struct snd_pcm *pcm; 627 struct snd_pcm *pcm;
628 int err; 628 int err;
@@ -683,9 +683,9 @@ static void snd_als300_init(struct snd_als300 *chip)
683 snd_als300_dbgcallleave(); 683 snd_als300_dbgcallleave();
684} 684}
685 685
686static int __devinit snd_als300_create(struct snd_card *card, 686static int snd_als300_create(struct snd_card *card,
687 struct pci_dev *pci, int chip_type, 687 struct pci_dev *pci, int chip_type,
688 struct snd_als300 **rchip) 688 struct snd_als300 **rchip)
689{ 689{
690 struct snd_als300 *chip; 690 struct snd_als300 *chip;
691 void *irq_handler; 691 void *irq_handler;
@@ -815,7 +815,7 @@ static SIMPLE_DEV_PM_OPS(snd_als300_pm, snd_als300_suspend, snd_als300_resume);
815#define SND_ALS300_PM_OPS NULL 815#define SND_ALS300_PM_OPS NULL
816#endif 816#endif
817 817
818static int __devinit snd_als300_probe(struct pci_dev *pci, 818static int snd_als300_probe(struct pci_dev *pci,
819 const struct pci_device_id *pci_id) 819 const struct pci_device_id *pci_id)
820{ 820{
821 static int dev; 821 static int dev;
@@ -867,7 +867,7 @@ static struct pci_driver als300_driver = {
867 .name = KBUILD_MODNAME, 867 .name = KBUILD_MODNAME,
868 .id_table = snd_als300_ids, 868 .id_table = snd_als300_ids,
869 .probe = snd_als300_probe, 869 .probe = snd_als300_probe,
870 .remove = __devexit_p(snd_als300_remove), 870 .remove = snd_als300_remove,
871 .driver = { 871 .driver = {
872 .pm = SND_ALS300_PM_OPS, 872 .pm = SND_ALS300_PM_OPS,
873 }, 873 },
diff --git a/sound/pci/als4000.c b/sound/pci/als4000.c
index feb2a1436830..61efda2a4d94 100644
--- a/sound/pci/als4000.c
+++ b/sound/pci/als4000.c
@@ -694,7 +694,7 @@ static struct snd_pcm_ops snd_als4000_capture_ops = {
694 .pointer = snd_als4000_capture_pointer 694 .pointer = snd_als4000_capture_pointer
695}; 695};
696 696
697static int __devinit snd_als4000_pcm(struct snd_sb *chip, int device) 697static int snd_als4000_pcm(struct snd_sb *chip, int device)
698{ 698{
699 struct snd_pcm *pcm; 699 struct snd_pcm *pcm;
700 int err; 700 int err;
@@ -770,7 +770,7 @@ static void snd_als4000_configure(struct snd_sb *chip)
770} 770}
771 771
772#ifdef SUPPORT_JOYSTICK 772#ifdef SUPPORT_JOYSTICK
773static int __devinit snd_als4000_create_gameport(struct snd_card_als4000 *acard, int dev) 773static int snd_als4000_create_gameport(struct snd_card_als4000 *acard, int dev)
774{ 774{
775 struct gameport *gp; 775 struct gameport *gp;
776 struct resource *r; 776 struct resource *r;
@@ -847,8 +847,8 @@ static void snd_card_als4000_free( struct snd_card *card )
847 pci_disable_device(acard->pci); 847 pci_disable_device(acard->pci);
848} 848}
849 849
850static int __devinit snd_card_als4000_probe(struct pci_dev *pci, 850static int snd_card_als4000_probe(struct pci_dev *pci,
851 const struct pci_device_id *pci_id) 851 const struct pci_device_id *pci_id)
852{ 852{
853 static int dev; 853 static int dev;
854 struct snd_card *card; 854 struct snd_card *card;
@@ -981,7 +981,7 @@ out:
981 return err; 981 return err;
982} 982}
983 983
984static void __devexit snd_card_als4000_remove(struct pci_dev *pci) 984static void snd_card_als4000_remove(struct pci_dev *pci)
985{ 985{
986 snd_card_free(pci_get_drvdata(pci)); 986 snd_card_free(pci_get_drvdata(pci));
987 pci_set_drvdata(pci, NULL); 987 pci_set_drvdata(pci, NULL);
@@ -1046,7 +1046,7 @@ static struct pci_driver als4000_driver = {
1046 .name = KBUILD_MODNAME, 1046 .name = KBUILD_MODNAME,
1047 .id_table = snd_als4000_ids, 1047 .id_table = snd_als4000_ids,
1048 .probe = snd_card_als4000_probe, 1048 .probe = snd_card_als4000_probe,
1049 .remove = __devexit_p(snd_card_als4000_remove), 1049 .remove = snd_card_als4000_remove,
1050 .driver = { 1050 .driver = {
1051 .pm = SND_ALS4000_PM_OPS, 1051 .pm = SND_ALS4000_PM_OPS,
1052 }, 1052 },
diff --git a/sound/pci/asihpi/asihpi.c b/sound/pci/asihpi/asihpi.c
index eedc017c1cd8..3536b076b529 100644
--- a/sound/pci/asihpi/asihpi.c
+++ b/sound/pci/asihpi/asihpi.c
@@ -1235,8 +1235,7 @@ static struct snd_pcm_ops snd_card_asihpi_capture_mmap_ops = {
1235 .pointer = snd_card_asihpi_capture_pointer, 1235 .pointer = snd_card_asihpi_capture_pointer,
1236}; 1236};
1237 1237
1238static int __devinit snd_card_asihpi_pcm_new( 1238static int snd_card_asihpi_pcm_new(struct snd_card_asihpi *asihpi, int device)
1239 struct snd_card_asihpi *asihpi, int device)
1240{ 1239{
1241 struct snd_pcm *pcm; 1240 struct snd_pcm *pcm;
1242 int err; 1241 int err;
@@ -1497,8 +1496,8 @@ static int snd_asihpi_volume_mute_put(struct snd_kcontrol *kcontrol,
1497 return change; 1496 return change;
1498} 1497}
1499 1498
1500static int __devinit snd_asihpi_volume_add(struct snd_card_asihpi *asihpi, 1499static int snd_asihpi_volume_add(struct snd_card_asihpi *asihpi,
1501 struct hpi_control *hpi_ctl) 1500 struct hpi_control *hpi_ctl)
1502{ 1501{
1503 struct snd_card *card = asihpi->card; 1502 struct snd_card *card = asihpi->card;
1504 struct snd_kcontrol_new snd_control; 1503 struct snd_kcontrol_new snd_control;
@@ -1593,8 +1592,8 @@ static int snd_asihpi_level_put(struct snd_kcontrol *kcontrol,
1593 1592
1594static const DECLARE_TLV_DB_SCALE(db_scale_level, -1000, 100, 0); 1593static const DECLARE_TLV_DB_SCALE(db_scale_level, -1000, 100, 0);
1595 1594
1596static int __devinit snd_asihpi_level_add(struct snd_card_asihpi *asihpi, 1595static int snd_asihpi_level_add(struct snd_card_asihpi *asihpi,
1597 struct hpi_control *hpi_ctl) 1596 struct hpi_control *hpi_ctl)
1598{ 1597{
1599 struct snd_card *card = asihpi->card; 1598 struct snd_card *card = asihpi->card;
1600 struct snd_kcontrol_new snd_control; 1599 struct snd_kcontrol_new snd_control;
@@ -1715,8 +1714,8 @@ static int snd_asihpi_aesebu_rxstatus_get(struct snd_kcontrol *kcontrol,
1715 return 0; 1714 return 0;
1716} 1715}
1717 1716
1718static int __devinit snd_asihpi_aesebu_rx_add(struct snd_card_asihpi *asihpi, 1717static int snd_asihpi_aesebu_rx_add(struct snd_card_asihpi *asihpi,
1719 struct hpi_control *hpi_ctl) 1718 struct hpi_control *hpi_ctl)
1720{ 1719{
1721 struct snd_card *card = asihpi->card; 1720 struct snd_card *card = asihpi->card;
1722 struct snd_kcontrol_new snd_control; 1721 struct snd_kcontrol_new snd_control;
@@ -1753,8 +1752,8 @@ static int snd_asihpi_aesebu_tx_format_put(struct snd_kcontrol *kcontrol,
1753} 1752}
1754 1753
1755 1754
1756static int __devinit snd_asihpi_aesebu_tx_add(struct snd_card_asihpi *asihpi, 1755static int snd_asihpi_aesebu_tx_add(struct snd_card_asihpi *asihpi,
1757 struct hpi_control *hpi_ctl) 1756 struct hpi_control *hpi_ctl)
1758{ 1757{
1759 struct snd_card *card = asihpi->card; 1758 struct snd_card *card = asihpi->card;
1760 struct snd_kcontrol_new snd_control; 1759 struct snd_kcontrol_new snd_control;
@@ -1996,8 +1995,8 @@ static int snd_asihpi_tuner_freq_put(struct snd_kcontrol *kcontrol,
1996} 1995}
1997 1996
1998/* Tuner control group initializer */ 1997/* Tuner control group initializer */
1999static int __devinit snd_asihpi_tuner_add(struct snd_card_asihpi *asihpi, 1998static int snd_asihpi_tuner_add(struct snd_card_asihpi *asihpi,
2000 struct hpi_control *hpi_ctl) 1999 struct hpi_control *hpi_ctl)
2001{ 2000{
2002 struct snd_card *card = asihpi->card; 2001 struct snd_card *card = asihpi->card;
2003 struct snd_kcontrol_new snd_control; 2002 struct snd_kcontrol_new snd_control;
@@ -2100,8 +2099,8 @@ static int snd_asihpi_meter_get(struct snd_kcontrol *kcontrol,
2100 return 0; 2099 return 0;
2101} 2100}
2102 2101
2103static int __devinit snd_asihpi_meter_add(struct snd_card_asihpi *asihpi, 2102static int snd_asihpi_meter_add(struct snd_card_asihpi *asihpi,
2104 struct hpi_control *hpi_ctl, int subidx) 2103 struct hpi_control *hpi_ctl, int subidx)
2105{ 2104{
2106 struct snd_card *card = asihpi->card; 2105 struct snd_card *card = asihpi->card;
2107 struct snd_kcontrol_new snd_control; 2106 struct snd_kcontrol_new snd_control;
@@ -2214,8 +2213,8 @@ static int snd_asihpi_mux_put(struct snd_kcontrol *kcontrol,
2214} 2213}
2215 2214
2216 2215
2217static int __devinit snd_asihpi_mux_add(struct snd_card_asihpi *asihpi, 2216static int snd_asihpi_mux_add(struct snd_card_asihpi *asihpi,
2218 struct hpi_control *hpi_ctl) 2217 struct hpi_control *hpi_ctl)
2219{ 2218{
2220 struct snd_card *card = asihpi->card; 2219 struct snd_card *card = asihpi->card;
2221 struct snd_kcontrol_new snd_control; 2220 struct snd_kcontrol_new snd_control;
@@ -2303,8 +2302,8 @@ static int snd_asihpi_cmode_put(struct snd_kcontrol *kcontrol,
2303} 2302}
2304 2303
2305 2304
2306static int __devinit snd_asihpi_cmode_add(struct snd_card_asihpi *asihpi, 2305static int snd_asihpi_cmode_add(struct snd_card_asihpi *asihpi,
2307 struct hpi_control *hpi_ctl) 2306 struct hpi_control *hpi_ctl)
2308{ 2307{
2309 struct snd_card *card = asihpi->card; 2308 struct snd_card *card = asihpi->card;
2310 struct snd_kcontrol_new snd_control; 2309 struct snd_kcontrol_new snd_control;
@@ -2471,8 +2470,8 @@ static int snd_asihpi_clkrate_get(struct snd_kcontrol *kcontrol,
2471 return 0; 2470 return 0;
2472} 2471}
2473 2472
2474static int __devinit snd_asihpi_sampleclock_add(struct snd_card_asihpi *asihpi, 2473static int snd_asihpi_sampleclock_add(struct snd_card_asihpi *asihpi,
2475 struct hpi_control *hpi_ctl) 2474 struct hpi_control *hpi_ctl)
2476{ 2475{
2477 struct snd_card *card = asihpi->card; 2476 struct snd_card *card = asihpi->card;
2478 struct snd_kcontrol_new snd_control; 2477 struct snd_kcontrol_new snd_control;
@@ -2548,7 +2547,7 @@ static int __devinit snd_asihpi_sampleclock_add(struct snd_card_asihpi *asihpi,
2548 Mixer 2547 Mixer
2549 ------------------------------------------------------------*/ 2548 ------------------------------------------------------------*/
2550 2549
2551static int __devinit snd_card_asihpi_mixer_new(struct snd_card_asihpi *asihpi) 2550static int snd_card_asihpi_mixer_new(struct snd_card_asihpi *asihpi)
2552{ 2551{
2553 struct snd_card *card = asihpi->card; 2552 struct snd_card *card = asihpi->card;
2554 unsigned int idx = 0; 2553 unsigned int idx = 0;
@@ -2722,7 +2721,7 @@ snd_asihpi_proc_read(struct snd_info_entry *entry,
2722 } 2721 }
2723} 2722}
2724 2723
2725static void __devinit snd_asihpi_proc_init(struct snd_card_asihpi *asihpi) 2724static void snd_asihpi_proc_init(struct snd_card_asihpi *asihpi)
2726{ 2725{
2727 struct snd_info_entry *entry; 2726 struct snd_info_entry *entry;
2728 2727
@@ -2764,8 +2763,8 @@ static int snd_asihpi_hpi_ioctl(struct snd_hwdep *hw, struct file *file,
2764/* results in /dev/snd/hwC#D0 file for each card with index # 2763/* results in /dev/snd/hwC#D0 file for each card with index #
2765 also /proc/asound/hwdep will contain '#-00: asihpi (HPI) for each card' 2764 also /proc/asound/hwdep will contain '#-00: asihpi (HPI) for each card'
2766*/ 2765*/
2767static int __devinit snd_asihpi_hpi_new(struct snd_card_asihpi *asihpi, 2766static int snd_asihpi_hpi_new(struct snd_card_asihpi *asihpi,
2768 int device, struct snd_hwdep **rhwdep) 2767 int device, struct snd_hwdep **rhwdep)
2769{ 2768{
2770 struct snd_hwdep *hw; 2769 struct snd_hwdep *hw;
2771 int err; 2770 int err;
@@ -2789,8 +2788,8 @@ static int __devinit snd_asihpi_hpi_new(struct snd_card_asihpi *asihpi,
2789/*------------------------------------------------------------ 2788/*------------------------------------------------------------
2790 CARD 2789 CARD
2791 ------------------------------------------------------------*/ 2790 ------------------------------------------------------------*/
2792static int __devinit snd_asihpi_probe(struct pci_dev *pci_dev, 2791static int snd_asihpi_probe(struct pci_dev *pci_dev,
2793 const struct pci_device_id *pci_id) 2792 const struct pci_device_id *pci_id)
2794{ 2793{
2795 int err; 2794 int err;
2796 struct hpi_adapter *hpi; 2795 struct hpi_adapter *hpi;
@@ -2944,7 +2943,7 @@ __nodev:
2944 2943
2945} 2944}
2946 2945
2947static void __devexit snd_asihpi_remove(struct pci_dev *pci_dev) 2946static void snd_asihpi_remove(struct pci_dev *pci_dev)
2948{ 2947{
2949 struct hpi_adapter *hpi = pci_get_drvdata(pci_dev); 2948 struct hpi_adapter *hpi = pci_get_drvdata(pci_dev);
2950 snd_card_free(hpi->snd_card); 2949 snd_card_free(hpi->snd_card);
@@ -2967,7 +2966,7 @@ static struct pci_driver driver = {
2967 .name = KBUILD_MODNAME, 2966 .name = KBUILD_MODNAME,
2968 .id_table = asihpi_pci_tbl, 2967 .id_table = asihpi_pci_tbl,
2969 .probe = snd_asihpi_probe, 2968 .probe = snd_asihpi_probe,
2970 .remove = __devexit_p(snd_asihpi_remove), 2969 .remove = snd_asihpi_remove,
2971#ifdef CONFIG_PM_SLEEP 2970#ifdef CONFIG_PM_SLEEP
2972/* .suspend = snd_asihpi_suspend, 2971/* .suspend = snd_asihpi_suspend,
2973 .resume = snd_asihpi_resume, */ 2972 .resume = snd_asihpi_resume, */
diff --git a/sound/pci/asihpi/hpidspcd.c b/sound/pci/asihpi/hpidspcd.c
index 456a758f04f6..ac9163770013 100644
--- a/sound/pci/asihpi/hpidspcd.c
+++ b/sound/pci/asihpi/hpidspcd.c
@@ -49,14 +49,12 @@ short hpi_dsp_code_open(u32 adapter, void *os_data, struct dsp_code *dsp_code,
49 err = request_firmware(&firmware, fw_name, &dev->dev); 49 err = request_firmware(&firmware, fw_name, &dev->dev);
50 50
51 if (err || !firmware) { 51 if (err || !firmware) {
52 dev_printk(KERN_ERR, &dev->dev, 52 dev_err(&dev->dev, "%d, request_firmware failed for %s\n",
53 "%d, request_firmware failed for %s\n", err, 53 err, fw_name);
54 fw_name);
55 goto error1; 54 goto error1;
56 } 55 }
57 if (firmware->size < sizeof(header)) { 56 if (firmware->size < sizeof(header)) {
58 dev_printk(KERN_ERR, &dev->dev, "Header size too small %s\n", 57 dev_err(&dev->dev, "Header size too small %s\n", fw_name);
59 fw_name);
60 goto error2; 58 goto error2;
61 } 59 }
62 memcpy(&header, firmware->data, sizeof(header)); 60 memcpy(&header, firmware->data, sizeof(header));
@@ -64,7 +62,7 @@ short hpi_dsp_code_open(u32 adapter, void *os_data, struct dsp_code *dsp_code,
64 if ((header.type != 0x45444F43) || /* "CODE" */ 62 if ((header.type != 0x45444F43) || /* "CODE" */
65 (header.adapter != adapter) 63 (header.adapter != adapter)
66 || (header.size != firmware->size)) { 64 || (header.size != firmware->size)) {
67 dev_printk(KERN_ERR, &dev->dev, 65 dev_err(&dev->dev,
68 "Invalid firmware header size %d != file %zd\n", 66 "Invalid firmware header size %d != file %zd\n",
69 header.size, firmware->size); 67 header.size, firmware->size);
70 goto error2; 68 goto error2;
@@ -72,17 +70,15 @@ short hpi_dsp_code_open(u32 adapter, void *os_data, struct dsp_code *dsp_code,
72 70
73 if ((header.version >> 9) != (HPI_VER >> 9)) { 71 if ((header.version >> 9) != (HPI_VER >> 9)) {
74 /* Consider even and subsequent odd minor versions to be compatible */ 72 /* Consider even and subsequent odd minor versions to be compatible */
75 dev_printk(KERN_ERR, &dev->dev, 73 dev_err(&dev->dev, "Incompatible firmware version DSP image %X != Driver %X\n",
76 "Incompatible firmware version " 74 header.version, HPI_VER);
77 "DSP image %X != Driver %X\n", header.version,
78 HPI_VER);
79 goto error2; 75 goto error2;
80 } 76 }
81 77
82 if (header.version != HPI_VER) { 78 if (header.version != HPI_VER) {
83 dev_printk(KERN_INFO, &dev->dev, 79 dev_info(&dev->dev,
84 "Firmware: release version mismatch DSP image %X != Driver %X\n", 80 "Firmware: release version mismatch DSP image %X != Driver %X\n",
85 header.version, HPI_VER); 81 header.version, HPI_VER);
86 } 82 }
87 83
88 HPI_DEBUG_LOG(DEBUG, "dsp code %s opened\n", fw_name); 84 HPI_DEBUG_LOG(DEBUG, "dsp code %s opened\n", fw_name);
diff --git a/sound/pci/asihpi/hpioctl.c b/sound/pci/asihpi/hpioctl.c
index 609156205562..ef5019fe5193 100644
--- a/sound/pci/asihpi/hpioctl.c
+++ b/sound/pci/asihpi/hpioctl.c
@@ -307,8 +307,8 @@ out:
307 return err; 307 return err;
308} 308}
309 309
310int __devinit asihpi_adapter_probe(struct pci_dev *pci_dev, 310int asihpi_adapter_probe(struct pci_dev *pci_dev,
311 const struct pci_device_id *pci_id) 311 const struct pci_device_id *pci_id)
312{ 312{
313 int idx, nm; 313 int idx, nm;
314 int adapter_index; 314 int adapter_index;
@@ -326,7 +326,7 @@ int __devinit asihpi_adapter_probe(struct pci_dev *pci_dev,
326 pci_dev->subsystem_device, pci_dev->devfn); 326 pci_dev->subsystem_device, pci_dev->devfn);
327 327
328 if (pci_enable_device(pci_dev) < 0) { 328 if (pci_enable_device(pci_dev) < 0) {
329 dev_printk(KERN_ERR, &pci_dev->dev, 329 dev_err(&pci_dev->dev,
330 "pci_enable_device failed, disabling device\n"); 330 "pci_enable_device failed, disabling device\n");
331 return -EIO; 331 return -EIO;
332 } 332 }
@@ -398,9 +398,8 @@ int __devinit asihpi_adapter_probe(struct pci_dev *pci_dev,
398 mutex_init(&adapters[adapter_index].mutex); 398 mutex_init(&adapters[adapter_index].mutex);
399 pci_set_drvdata(pci_dev, &adapters[adapter_index]); 399 pci_set_drvdata(pci_dev, &adapters[adapter_index]);
400 400
401 dev_printk(KERN_INFO, &pci_dev->dev, 401 dev_info(&pci_dev->dev, "probe succeeded for ASI%04X HPI index %d\n",
402 "probe succeeded for ASI%04X HPI index %d\n", 402 adapter.adapter->type, adapter_index);
403 adapter.adapter->type, adapter_index);
404 403
405 return 0; 404 return 0;
406 405
@@ -421,7 +420,7 @@ err:
421 return -ENODEV; 420 return -ENODEV;
422} 421}
423 422
424void __devexit asihpi_adapter_remove(struct pci_dev *pci_dev) 423void asihpi_adapter_remove(struct pci_dev *pci_dev)
425{ 424{
426 int idx; 425 int idx;
427 struct hpi_message hm; 426 struct hpi_message hm;
@@ -448,11 +447,11 @@ void __devexit asihpi_adapter_remove(struct pci_dev *pci_dev)
448 447
449 pci_set_drvdata(pci_dev, NULL); 448 pci_set_drvdata(pci_dev, NULL);
450 if (1) 449 if (1)
451 dev_printk(KERN_INFO, &pci_dev->dev, 450 dev_info(&pci_dev->dev,
452 "remove %04x:%04x,%04x:%04x,%04x," " HPI index %d.\n", 451 "remove %04x:%04x,%04x:%04x,%04x, HPI index %d\n",
453 pci_dev->vendor, pci_dev->device, 452 pci_dev->vendor, pci_dev->device,
454 pci_dev->subsystem_vendor, pci_dev->subsystem_device, 453 pci_dev->subsystem_vendor, pci_dev->subsystem_device,
455 pci_dev->devfn, pa->adapter->index); 454 pci_dev->devfn, pa->adapter->index);
456 455
457 memset(pa, 0, sizeof(*pa)); 456 memset(pa, 0, sizeof(*pa));
458} 457}
diff --git a/sound/pci/asihpi/hpioctl.h b/sound/pci/asihpi/hpioctl.h
index 2614aff672e2..0d767e10ac48 100644
--- a/sound/pci/asihpi/hpioctl.h
+++ b/sound/pci/asihpi/hpioctl.h
@@ -19,9 +19,9 @@
19Linux HPI ioctl, and shared module init functions 19Linux HPI ioctl, and shared module init functions
20*******************************************************************************/ 20*******************************************************************************/
21 21
22int __devinit asihpi_adapter_probe(struct pci_dev *pci_dev, 22int asihpi_adapter_probe(struct pci_dev *pci_dev,
23 const struct pci_device_id *pci_id); 23 const struct pci_device_id *pci_id);
24void __devexit asihpi_adapter_remove(struct pci_dev *pci_dev); 24void asihpi_adapter_remove(struct pci_dev *pci_dev);
25void __init asihpi_init(void); 25void __init asihpi_init(void);
26void __exit asihpi_exit(void); 26void __exit asihpi_exit(void);
27 27
diff --git a/sound/pci/atiixp.c b/sound/pci/atiixp.c
index 368df8b0853e..a67743183aaf 100644
--- a/sound/pci/atiixp.c
+++ b/sound/pci/atiixp.c
@@ -296,7 +296,7 @@ static DEFINE_PCI_DEVICE_TABLE(snd_atiixp_ids) = {
296 296
297MODULE_DEVICE_TABLE(pci, snd_atiixp_ids); 297MODULE_DEVICE_TABLE(pci, snd_atiixp_ids);
298 298
299static struct snd_pci_quirk atiixp_quirks[] __devinitdata = { 299static struct snd_pci_quirk atiixp_quirks[] = {
300 SND_PCI_QUIRK(0x105b, 0x0c81, "Foxconn RC4107MA-RS2", 0), 300 SND_PCI_QUIRK(0x105b, 0x0c81, "Foxconn RC4107MA-RS2", 0),
301 SND_PCI_QUIRK(0x15bd, 0x3100, "DFI RS482", 0), 301 SND_PCI_QUIRK(0x15bd, 0x3100, "DFI RS482", 0),
302 { } /* terminator */ 302 { } /* terminator */
@@ -561,7 +561,7 @@ static int snd_atiixp_aclink_down(struct atiixp *chip)
561 ATI_REG_ISR_CODEC2_NOT_READY) 561 ATI_REG_ISR_CODEC2_NOT_READY)
562#define CODEC_CHECK_BITS (ALL_CODEC_NOT_READY|ATI_REG_ISR_NEW_FRAME) 562#define CODEC_CHECK_BITS (ALL_CODEC_NOT_READY|ATI_REG_ISR_NEW_FRAME)
563 563
564static int __devinit ac97_probing_bugs(struct pci_dev *pci) 564static int ac97_probing_bugs(struct pci_dev *pci)
565{ 565{
566 const struct snd_pci_quirk *q; 566 const struct snd_pci_quirk *q;
567 567
@@ -575,7 +575,7 @@ static int __devinit ac97_probing_bugs(struct pci_dev *pci)
575 return -1; 575 return -1;
576} 576}
577 577
578static int __devinit snd_atiixp_codec_detect(struct atiixp *chip) 578static int snd_atiixp_codec_detect(struct atiixp *chip)
579{ 579{
580 int timeout; 580 int timeout;
581 581
@@ -1183,7 +1183,7 @@ static struct snd_pcm_ops snd_atiixp_spdif_ops = {
1183 .pointer = snd_atiixp_pcm_pointer, 1183 .pointer = snd_atiixp_pcm_pointer,
1184}; 1184};
1185 1185
1186static struct ac97_pcm atiixp_pcm_defs[] __devinitdata = { 1186static struct ac97_pcm atiixp_pcm_defs[] = {
1187 /* front PCM */ 1187 /* front PCM */
1188 { 1188 {
1189 .exclusive = 1, 1189 .exclusive = 1,
@@ -1247,7 +1247,7 @@ static struct atiixp_dma_ops snd_atiixp_spdif_dma_ops = {
1247}; 1247};
1248 1248
1249 1249
1250static int __devinit snd_atiixp_pcm_new(struct atiixp *chip) 1250static int snd_atiixp_pcm_new(struct atiixp *chip)
1251{ 1251{
1252 struct snd_pcm *pcm; 1252 struct snd_pcm *pcm;
1253 struct snd_pcm_chmap *chmap; 1253 struct snd_pcm_chmap *chmap;
@@ -1390,7 +1390,7 @@ static irqreturn_t snd_atiixp_interrupt(int irq, void *dev_id)
1390 * ac97 mixer section 1390 * ac97 mixer section
1391 */ 1391 */
1392 1392
1393static struct ac97_quirk ac97_quirks[] __devinitdata = { 1393static struct ac97_quirk ac97_quirks[] = {
1394 { 1394 {
1395 .subvendor = 0x103c, 1395 .subvendor = 0x103c,
1396 .subdevice = 0x006b, 1396 .subdevice = 0x006b,
@@ -1412,8 +1412,8 @@ static struct ac97_quirk ac97_quirks[] __devinitdata = {
1412 { } /* terminator */ 1412 { } /* terminator */
1413}; 1413};
1414 1414
1415static int __devinit snd_atiixp_mixer_new(struct atiixp *chip, int clock, 1415static int snd_atiixp_mixer_new(struct atiixp *chip, int clock,
1416 const char *quirk_override) 1416 const char *quirk_override)
1417{ 1417{
1418 struct snd_ac97_bus *pbus; 1418 struct snd_ac97_bus *pbus;
1419 struct snd_ac97_template ac97; 1419 struct snd_ac97_template ac97;
@@ -1560,7 +1560,7 @@ static void snd_atiixp_proc_read(struct snd_info_entry *entry,
1560 snd_iprintf(buffer, "%02x: %08x\n", i, readl(chip->remap_addr + i)); 1560 snd_iprintf(buffer, "%02x: %08x\n", i, readl(chip->remap_addr + i));
1561} 1561}
1562 1562
1563static void __devinit snd_atiixp_proc_init(struct atiixp *chip) 1563static void snd_atiixp_proc_init(struct atiixp *chip)
1564{ 1564{
1565 struct snd_info_entry *entry; 1565 struct snd_info_entry *entry;
1566 1566
@@ -1602,9 +1602,9 @@ static int snd_atiixp_dev_free(struct snd_device *device)
1602/* 1602/*
1603 * constructor for chip instance 1603 * constructor for chip instance
1604 */ 1604 */
1605static int __devinit snd_atiixp_create(struct snd_card *card, 1605static int snd_atiixp_create(struct snd_card *card,
1606 struct pci_dev *pci, 1606 struct pci_dev *pci,
1607 struct atiixp **r_chip) 1607 struct atiixp **r_chip)
1608{ 1608{
1609 static struct snd_device_ops ops = { 1609 static struct snd_device_ops ops = {
1610 .dev_free = snd_atiixp_dev_free, 1610 .dev_free = snd_atiixp_dev_free,
@@ -1661,8 +1661,8 @@ static int __devinit snd_atiixp_create(struct snd_card *card,
1661} 1661}
1662 1662
1663 1663
1664static int __devinit snd_atiixp_probe(struct pci_dev *pci, 1664static int snd_atiixp_probe(struct pci_dev *pci,
1665 const struct pci_device_id *pci_id) 1665 const struct pci_device_id *pci_id)
1666{ 1666{
1667 struct snd_card *card; 1667 struct snd_card *card;
1668 struct atiixp *chip; 1668 struct atiixp *chip;
@@ -1710,7 +1710,7 @@ static int __devinit snd_atiixp_probe(struct pci_dev *pci,
1710 return err; 1710 return err;
1711} 1711}
1712 1712
1713static void __devexit snd_atiixp_remove(struct pci_dev *pci) 1713static void snd_atiixp_remove(struct pci_dev *pci)
1714{ 1714{
1715 snd_card_free(pci_get_drvdata(pci)); 1715 snd_card_free(pci_get_drvdata(pci));
1716 pci_set_drvdata(pci, NULL); 1716 pci_set_drvdata(pci, NULL);
@@ -1720,7 +1720,7 @@ static struct pci_driver atiixp_driver = {
1720 .name = KBUILD_MODNAME, 1720 .name = KBUILD_MODNAME,
1721 .id_table = snd_atiixp_ids, 1721 .id_table = snd_atiixp_ids,
1722 .probe = snd_atiixp_probe, 1722 .probe = snd_atiixp_probe,
1723 .remove = __devexit_p(snd_atiixp_remove), 1723 .remove = snd_atiixp_remove,
1724 .driver = { 1724 .driver = {
1725 .pm = SND_ATIIXP_PM_OPS, 1725 .pm = SND_ATIIXP_PM_OPS,
1726 }, 1726 },
diff --git a/sound/pci/atiixp_modem.c b/sound/pci/atiixp_modem.c
index 6fc03d9f2cff..d0bec7ba3b0d 100644
--- a/sound/pci/atiixp_modem.c
+++ b/sound/pci/atiixp_modem.c
@@ -988,7 +988,7 @@ static struct atiixp_dma_ops snd_atiixp_capture_dma_ops = {
988 .flush_dma = atiixp_in_flush_dma, 988 .flush_dma = atiixp_in_flush_dma,
989}; 989};
990 990
991static int __devinit snd_atiixp_pcm_new(struct atiixp_modem *chip) 991static int snd_atiixp_pcm_new(struct atiixp_modem *chip)
992{ 992{
993 struct snd_pcm *pcm; 993 struct snd_pcm *pcm;
994 int err; 994 int err;
@@ -1061,7 +1061,7 @@ static irqreturn_t snd_atiixp_interrupt(int irq, void *dev_id)
1061 * ac97 mixer section 1061 * ac97 mixer section
1062 */ 1062 */
1063 1063
1064static int __devinit snd_atiixp_mixer_new(struct atiixp_modem *chip, int clock) 1064static int snd_atiixp_mixer_new(struct atiixp_modem *chip, int clock)
1065{ 1065{
1066 struct snd_ac97_bus *pbus; 1066 struct snd_ac97_bus *pbus;
1067 struct snd_ac97_template ac97; 1067 struct snd_ac97_template ac97;
@@ -1186,7 +1186,7 @@ static void snd_atiixp_proc_read(struct snd_info_entry *entry,
1186 snd_iprintf(buffer, "%02x: %08x\n", i, readl(chip->remap_addr + i)); 1186 snd_iprintf(buffer, "%02x: %08x\n", i, readl(chip->remap_addr + i));
1187} 1187}
1188 1188
1189static void __devinit snd_atiixp_proc_init(struct atiixp_modem *chip) 1189static void snd_atiixp_proc_init(struct atiixp_modem *chip)
1190{ 1190{
1191 struct snd_info_entry *entry; 1191 struct snd_info_entry *entry;
1192 1192
@@ -1228,9 +1228,9 @@ static int snd_atiixp_dev_free(struct snd_device *device)
1228/* 1228/*
1229 * constructor for chip instance 1229 * constructor for chip instance
1230 */ 1230 */
1231static int __devinit snd_atiixp_create(struct snd_card *card, 1231static int snd_atiixp_create(struct snd_card *card,
1232 struct pci_dev *pci, 1232 struct pci_dev *pci,
1233 struct atiixp_modem **r_chip) 1233 struct atiixp_modem **r_chip)
1234{ 1234{
1235 static struct snd_device_ops ops = { 1235 static struct snd_device_ops ops = {
1236 .dev_free = snd_atiixp_dev_free, 1236 .dev_free = snd_atiixp_dev_free,
@@ -1287,8 +1287,8 @@ static int __devinit snd_atiixp_create(struct snd_card *card,
1287} 1287}
1288 1288
1289 1289
1290static int __devinit snd_atiixp_probe(struct pci_dev *pci, 1290static int snd_atiixp_probe(struct pci_dev *pci,
1291 const struct pci_device_id *pci_id) 1291 const struct pci_device_id *pci_id)
1292{ 1292{
1293 struct snd_card *card; 1293 struct snd_card *card;
1294 struct atiixp_modem *chip; 1294 struct atiixp_modem *chip;
@@ -1331,7 +1331,7 @@ static int __devinit snd_atiixp_probe(struct pci_dev *pci,
1331 return err; 1331 return err;
1332} 1332}
1333 1333
1334static void __devexit snd_atiixp_remove(struct pci_dev *pci) 1334static void snd_atiixp_remove(struct pci_dev *pci)
1335{ 1335{
1336 snd_card_free(pci_get_drvdata(pci)); 1336 snd_card_free(pci_get_drvdata(pci));
1337 pci_set_drvdata(pci, NULL); 1337 pci_set_drvdata(pci, NULL);
@@ -1341,7 +1341,7 @@ static struct pci_driver atiixp_modem_driver = {
1341 .name = KBUILD_MODNAME, 1341 .name = KBUILD_MODNAME,
1342 .id_table = snd_atiixp_ids, 1342 .id_table = snd_atiixp_ids,
1343 .probe = snd_atiixp_probe, 1343 .probe = snd_atiixp_probe,
1344 .remove = __devexit_p(snd_atiixp_remove), 1344 .remove = snd_atiixp_remove,
1345 .driver = { 1345 .driver = {
1346 .pm = SND_ATIIXP_PM_OPS, 1346 .pm = SND_ATIIXP_PM_OPS,
1347 }, 1347 },
diff --git a/sound/pci/au88x0/au88x0.c b/sound/pci/au88x0/au88x0.c
index ffc376f9f4e4..b157e1fadd8f 100644
--- a/sound/pci/au88x0/au88x0.c
+++ b/sound/pci/au88x0/au88x0.c
@@ -78,7 +78,7 @@ static void vortex_fix_agp_bridge(struct pci_dev *via)
78 } 78 }
79} 79}
80 80
81static void __devinit snd_vortex_workaround(struct pci_dev *vortex, int fix) 81static void snd_vortex_workaround(struct pci_dev *vortex, int fix)
82{ 82{
83 struct pci_dev *via = NULL; 83 struct pci_dev *via = NULL;
84 84
@@ -137,7 +137,7 @@ static int snd_vortex_dev_free(struct snd_device *device)
137 137
138// chip-specific constructor 138// chip-specific constructor
139// (see "Management of Cards and Components") 139// (see "Management of Cards and Components")
140static int __devinit 140static int
141snd_vortex_create(struct snd_card *card, struct pci_dev *pci, vortex_t ** rchip) 141snd_vortex_create(struct snd_card *card, struct pci_dev *pci, vortex_t ** rchip)
142{ 142{
143 vortex_t *chip; 143 vortex_t *chip;
@@ -234,7 +234,7 @@ snd_vortex_create(struct snd_card *card, struct pci_dev *pci, vortex_t ** rchip)
234} 234}
235 235
236// constructor -- see "Constructor" sub-section 236// constructor -- see "Constructor" sub-section
237static int __devinit 237static int
238snd_vortex_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) 238snd_vortex_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
239{ 239{
240 static int dev; 240 static int dev;
@@ -368,7 +368,7 @@ snd_vortex_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
368} 368}
369 369
370// destructor -- see "Destructor" sub-section 370// destructor -- see "Destructor" sub-section
371static void __devexit snd_vortex_remove(struct pci_dev *pci) 371static void snd_vortex_remove(struct pci_dev *pci)
372{ 372{
373 snd_card_free(pci_get_drvdata(pci)); 373 snd_card_free(pci_get_drvdata(pci));
374 pci_set_drvdata(pci, NULL); 374 pci_set_drvdata(pci, NULL);
@@ -379,7 +379,7 @@ static struct pci_driver vortex_driver = {
379 .name = KBUILD_MODNAME, 379 .name = KBUILD_MODNAME,
380 .id_table = snd_vortex_ids, 380 .id_table = snd_vortex_ids,
381 .probe = snd_vortex_probe, 381 .probe = snd_vortex_probe,
382 .remove = __devexit_p(snd_vortex_remove), 382 .remove = snd_vortex_remove,
383}; 383};
384 384
385module_pci_driver(vortex_driver); 385module_pci_driver(vortex_driver);
diff --git a/sound/pci/au88x0/au88x0_a3d.c b/sound/pci/au88x0/au88x0_a3d.c
index 9ae8b3b17651..aad831acbb17 100644
--- a/sound/pci/au88x0/au88x0_a3d.c
+++ b/sound/pci/au88x0/au88x0_a3d.c
@@ -594,7 +594,7 @@ static int Vort3DRend_Initialize(vortex_t * v, unsigned short mode)
594static int vortex_a3d_register_controls(vortex_t * vortex); 594static int vortex_a3d_register_controls(vortex_t * vortex);
595static void vortex_a3d_unregister_controls(vortex_t * vortex); 595static void vortex_a3d_unregister_controls(vortex_t * vortex);
596/* A3D base support init/shudown */ 596/* A3D base support init/shudown */
597static void __devinit vortex_Vort3D_enable(vortex_t * v) 597static void vortex_Vort3D_enable(vortex_t *v)
598{ 598{
599 int i; 599 int i;
600 600
@@ -845,7 +845,7 @@ snd_vortex_a3d_filter_put(struct snd_kcontrol *kcontrol,
845 return changed; 845 return changed;
846} 846}
847 847
848static struct snd_kcontrol_new vortex_a3d_kcontrol __devinitdata = { 848static struct snd_kcontrol_new vortex_a3d_kcontrol = {
849 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 849 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
850 .name = "Playback PCM advanced processing", 850 .name = "Playback PCM advanced processing",
851 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, 851 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
@@ -855,7 +855,7 @@ static struct snd_kcontrol_new vortex_a3d_kcontrol __devinitdata = {
855}; 855};
856 856
857/* Control (un)registration. */ 857/* Control (un)registration. */
858static int __devinit vortex_a3d_register_controls(vortex_t * vortex) 858static int vortex_a3d_register_controls(vortex_t *vortex)
859{ 859{
860 struct snd_kcontrol *kcontrol; 860 struct snd_kcontrol *kcontrol;
861 int err, i; 861 int err, i;
diff --git a/sound/pci/au88x0/au88x0_core.c b/sound/pci/au88x0/au88x0_core.c
index 525f881f0409..ae59dbaa53d9 100644
--- a/sound/pci/au88x0/au88x0_core.c
+++ b/sound/pci/au88x0/au88x0_core.c
@@ -2461,7 +2461,12 @@ static irqreturn_t vortex_interrupt(int irq, void *dev_id)
2461#ifndef CHIP_AU8810 2461#ifndef CHIP_AU8810
2462 for (i = 0; i < NR_WT; i++) { 2462 for (i = 0; i < NR_WT; i++) {
2463 if (vortex->dma_wt[i].fifo_status == FIFO_START) { 2463 if (vortex->dma_wt[i].fifo_status == FIFO_START) {
2464 if (vortex_wtdma_bufshift(vortex, i)) ; 2464 /* FIXME: we ignore the return value from
2465 * vortex_wtdma_bufshift() below as the delta
2466 * calculation seems not working for wavetable
2467 * by some reason
2468 */
2469 vortex_wtdma_bufshift(vortex, i);
2465 spin_unlock(&vortex->lock); 2470 spin_unlock(&vortex->lock);
2466 snd_pcm_period_elapsed(vortex->dma_wt[i]. 2471 snd_pcm_period_elapsed(vortex->dma_wt[i].
2467 substream); 2472 substream);
@@ -2675,7 +2680,7 @@ static void vortex_spdif_init(vortex_t * vortex, int spdif_sr, int spdif_mode)
2675 2680
2676/* Initialization */ 2681/* Initialization */
2677 2682
2678static int __devinit vortex_core_init(vortex_t * vortex) 2683static int vortex_core_init(vortex_t *vortex)
2679{ 2684{
2680 2685
2681 printk(KERN_INFO "Vortex: init.... "); 2686 printk(KERN_INFO "Vortex: init.... ");
diff --git a/sound/pci/au88x0/au88x0_eq.c b/sound/pci/au88x0/au88x0_eq.c
index 278ed8189fca..e7220533ecfc 100644
--- a/sound/pci/au88x0/au88x0_eq.c
+++ b/sound/pci/au88x0/au88x0_eq.c
@@ -757,7 +757,7 @@ snd_vortex_eqtoggle_put(struct snd_kcontrol *kcontrol,
757 return 1; /* Allways changes */ 757 return 1; /* Allways changes */
758} 758}
759 759
760static struct snd_kcontrol_new vortex_eqtoggle_kcontrol __devinitdata = { 760static struct snd_kcontrol_new vortex_eqtoggle_kcontrol = {
761 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 761 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
762 .name = "EQ Enable", 762 .name = "EQ Enable",
763 .index = 0, 763 .index = 0,
@@ -815,7 +815,7 @@ snd_vortex_eq_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucon
815 return changed; 815 return changed;
816} 816}
817 817
818static struct snd_kcontrol_new vortex_eq_kcontrol __devinitdata = { 818static struct snd_kcontrol_new vortex_eq_kcontrol = {
819 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 819 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
820 .name = " .", 820 .name = " .",
821 .index = 0, 821 .index = 0,
@@ -854,7 +854,7 @@ snd_vortex_peaks_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *u
854 return 0; 854 return 0;
855} 855}
856 856
857static struct snd_kcontrol_new vortex_levels_kcontrol __devinitdata = { 857static struct snd_kcontrol_new vortex_levels_kcontrol = {
858 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 858 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
859 .name = "EQ Peaks", 859 .name = "EQ Peaks",
860 .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, 860 .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE,
@@ -863,7 +863,7 @@ static struct snd_kcontrol_new vortex_levels_kcontrol __devinitdata = {
863}; 863};
864 864
865/* EQ band gain labels. */ 865/* EQ band gain labels. */
866static char *EqBandLabels[10] __devinitdata = { 866static char *EqBandLabels[10] = {
867 "EQ0 31Hz\0", 867 "EQ0 31Hz\0",
868 "EQ1 63Hz\0", 868 "EQ1 63Hz\0",
869 "EQ2 125Hz\0", 869 "EQ2 125Hz\0",
@@ -877,7 +877,7 @@ static char *EqBandLabels[10] __devinitdata = {
877}; 877};
878 878
879/* ALSA driver entry points. Init and exit. */ 879/* ALSA driver entry points. Init and exit. */
880static int __devinit vortex_eq_init(vortex_t * vortex) 880static int vortex_eq_init(vortex_t *vortex)
881{ 881{
882 struct snd_kcontrol *kcontrol; 882 struct snd_kcontrol *kcontrol;
883 int err, i; 883 int err, i;
diff --git a/sound/pci/au88x0/au88x0_game.c b/sound/pci/au88x0/au88x0_game.c
index 30a456700d89..280f86de2230 100644
--- a/sound/pci/au88x0/au88x0_game.c
+++ b/sound/pci/au88x0/au88x0_game.c
@@ -92,7 +92,7 @@ static int vortex_game_open(struct gameport *gameport, int mode)
92 return 0; 92 return 0;
93} 93}
94 94
95static int __devinit vortex_gameport_register(vortex_t * vortex) 95static int vortex_gameport_register(vortex_t *vortex)
96{ 96{
97 struct gameport *gp; 97 struct gameport *gp;
98 98
diff --git a/sound/pci/au88x0/au88x0_mixer.c b/sound/pci/au88x0/au88x0_mixer.c
index fa13efbebdaf..a58298cfe7e0 100644
--- a/sound/pci/au88x0/au88x0_mixer.c
+++ b/sound/pci/au88x0/au88x0_mixer.c
@@ -19,7 +19,7 @@ static int remove_ctl(struct snd_card *card, const char *name)
19 return snd_ctl_remove_id(card, &id); 19 return snd_ctl_remove_id(card, &id);
20} 20}
21 21
22static int __devinit snd_vortex_mixer(vortex_t * vortex) 22static int snd_vortex_mixer(vortex_t *vortex)
23{ 23{
24 struct snd_ac97_bus *pbus; 24 struct snd_ac97_bus *pbus;
25 struct snd_ac97_template ac97; 25 struct snd_ac97_template ac97;
diff --git a/sound/pci/au88x0/au88x0_mpu401.c b/sound/pci/au88x0/au88x0_mpu401.c
index e6c6a0febb75..29e5945eef60 100644
--- a/sound/pci/au88x0/au88x0_mpu401.c
+++ b/sound/pci/au88x0/au88x0_mpu401.c
@@ -41,7 +41,7 @@
41#define MPU401_ENTER_UART 0x3f 41#define MPU401_ENTER_UART 0x3f
42#define MPU401_ACK 0xfe 42#define MPU401_ACK 0xfe
43 43
44static int __devinit snd_vortex_midi(vortex_t * vortex) 44static int snd_vortex_midi(vortex_t *vortex)
45{ 45{
46 struct snd_rawmidi *rmidi; 46 struct snd_rawmidi *rmidi;
47 int temp, mode; 47 int temp, mode;
diff --git a/sound/pci/au88x0/au88x0_pcm.c b/sound/pci/au88x0/au88x0_pcm.c
index b2405020284c..a4184bb27761 100644
--- a/sound/pci/au88x0/au88x0_pcm.c
+++ b/sound/pci/au88x0/au88x0_pcm.c
@@ -516,7 +516,7 @@ static int snd_vortex_spdif_put(struct snd_kcontrol *kcontrol, struct snd_ctl_el
516} 516}
517 517
518/* spdif controls */ 518/* spdif controls */
519static struct snd_kcontrol_new snd_vortex_mixer_spdif[] __devinitdata = { 519static struct snd_kcontrol_new snd_vortex_mixer_spdif[] = {
520 { 520 {
521 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 521 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
522 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT), 522 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT),
@@ -598,7 +598,7 @@ static int snd_vortex_pcm_vol_put(struct snd_kcontrol *kcontrol,
598 598
599static const DECLARE_TLV_DB_MINMAX(vortex_pcm_vol_db_scale, -9600, 2400); 599static const DECLARE_TLV_DB_MINMAX(vortex_pcm_vol_db_scale, -9600, 2400);
600 600
601static struct snd_kcontrol_new snd_vortex_pcm_vol __devinitdata = { 601static struct snd_kcontrol_new snd_vortex_pcm_vol = {
602 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 602 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
603 .name = "PCM Playback Volume", 603 .name = "PCM Playback Volume",
604 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | 604 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE |
@@ -611,7 +611,7 @@ static struct snd_kcontrol_new snd_vortex_pcm_vol __devinitdata = {
611}; 611};
612 612
613/* create a pcm device */ 613/* create a pcm device */
614static int __devinit snd_vortex_new_pcm(vortex_t *chip, int idx, int nr) 614static int snd_vortex_new_pcm(vortex_t *chip, int idx, int nr)
615{ 615{
616 struct snd_pcm *pcm; 616 struct snd_pcm *pcm;
617 struct snd_kcontrol *kctl; 617 struct snd_kcontrol *kctl;
diff --git a/sound/pci/au88x0/au88x0_synth.c b/sound/pci/au88x0/au88x0_synth.c
index 2805e34bd41d..8bef47311e45 100644
--- a/sound/pci/au88x0/au88x0_synth.c
+++ b/sound/pci/au88x0/au88x0_synth.c
@@ -58,7 +58,7 @@ static void vortex_wt_setdsout(vortex_t * vortex, u32 wt, int en)
58 if (en) 58 if (en)
59 temp |= (1 << (wt & 0x1f)); 59 temp |= (1 << (wt & 0x1f));
60 else 60 else
61 temp &= (1 << ~(wt & 0x1f)); 61 temp &= ~(1 << (wt & 0x1f));
62 hwwrite(vortex->mmio, WT_DSREG((wt >= 0x20) ? 1 : 0), temp); 62 hwwrite(vortex->mmio, WT_DSREG((wt >= 0x20) ? 1 : 0), temp);
63} 63}
64 64
diff --git a/sound/pci/aw2/aw2-alsa.c b/sound/pci/aw2/aw2-alsa.c
index 0f804741825f..08e9a4702cbc 100644
--- a/sound/pci/aw2/aw2-alsa.c
+++ b/sound/pci/aw2/aw2-alsa.c
@@ -113,11 +113,11 @@ struct aw2 {
113 * FUNCTION DECLARATIONS 113 * FUNCTION DECLARATIONS
114 ********************************/ 114 ********************************/
115static int snd_aw2_dev_free(struct snd_device *device); 115static int snd_aw2_dev_free(struct snd_device *device);
116static int __devinit snd_aw2_create(struct snd_card *card, 116static int snd_aw2_create(struct snd_card *card,
117 struct pci_dev *pci, struct aw2 **rchip); 117 struct pci_dev *pci, struct aw2 **rchip);
118static int __devinit snd_aw2_probe(struct pci_dev *pci, 118static int snd_aw2_probe(struct pci_dev *pci,
119 const struct pci_device_id *pci_id); 119 const struct pci_device_id *pci_id);
120static void __devexit snd_aw2_remove(struct pci_dev *pci); 120static void snd_aw2_remove(struct pci_dev *pci);
121static int snd_aw2_pcm_playback_open(struct snd_pcm_substream *substream); 121static int snd_aw2_pcm_playback_open(struct snd_pcm_substream *substream);
122static int snd_aw2_pcm_playback_close(struct snd_pcm_substream *substream); 122static int snd_aw2_pcm_playback_close(struct snd_pcm_substream *substream);
123static int snd_aw2_pcm_capture_open(struct snd_pcm_substream *substream); 123static int snd_aw2_pcm_capture_open(struct snd_pcm_substream *substream);
@@ -135,7 +135,7 @@ static snd_pcm_uframes_t snd_aw2_pcm_pointer_playback(struct snd_pcm_substream
135 *substream); 135 *substream);
136static snd_pcm_uframes_t snd_aw2_pcm_pointer_capture(struct snd_pcm_substream 136static snd_pcm_uframes_t snd_aw2_pcm_pointer_capture(struct snd_pcm_substream
137 *substream); 137 *substream);
138static int __devinit snd_aw2_new_pcm(struct aw2 *chip); 138static int snd_aw2_new_pcm(struct aw2 *chip);
139 139
140static int snd_aw2_control_switch_capture_info(struct snd_kcontrol *kcontrol, 140static int snd_aw2_control_switch_capture_info(struct snd_kcontrol *kcontrol,
141 struct snd_ctl_elem_info *uinfo); 141 struct snd_ctl_elem_info *uinfo);
@@ -173,7 +173,7 @@ static struct pci_driver aw2_driver = {
173 .name = KBUILD_MODNAME, 173 .name = KBUILD_MODNAME,
174 .id_table = snd_aw2_ids, 174 .id_table = snd_aw2_ids,
175 .probe = snd_aw2_probe, 175 .probe = snd_aw2_probe,
176 .remove = __devexit_p(snd_aw2_remove), 176 .remove = snd_aw2_remove,
177}; 177};
178 178
179module_pci_driver(aw2_driver); 179module_pci_driver(aw2_driver);
@@ -202,7 +202,7 @@ static struct snd_pcm_ops snd_aw2_capture_ops = {
202 .pointer = snd_aw2_pcm_pointer_capture, 202 .pointer = snd_aw2_pcm_pointer_capture,
203}; 203};
204 204
205static struct snd_kcontrol_new aw2_control __devinitdata = { 205static struct snd_kcontrol_new aw2_control = {
206 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 206 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
207 .name = "PCM Capture Route", 207 .name = "PCM Capture Route",
208 .index = 0, 208 .index = 0,
@@ -242,8 +242,8 @@ static int snd_aw2_dev_free(struct snd_device *device)
242} 242}
243 243
244/* chip-specific constructor */ 244/* chip-specific constructor */
245static int __devinit snd_aw2_create(struct snd_card *card, 245static int snd_aw2_create(struct snd_card *card,
246 struct pci_dev *pci, struct aw2 **rchip) 246 struct pci_dev *pci, struct aw2 **rchip)
247{ 247{
248 struct aw2 *chip; 248 struct aw2 *chip;
249 int err; 249 int err;
@@ -332,8 +332,8 @@ static int __devinit snd_aw2_create(struct snd_card *card,
332} 332}
333 333
334/* constructor */ 334/* constructor */
335static int __devinit snd_aw2_probe(struct pci_dev *pci, 335static int snd_aw2_probe(struct pci_dev *pci,
336 const struct pci_device_id *pci_id) 336 const struct pci_device_id *pci_id)
337{ 337{
338 static int dev; 338 static int dev;
339 struct snd_card *card; 339 struct snd_card *card;
@@ -389,7 +389,7 @@ static int __devinit snd_aw2_probe(struct pci_dev *pci,
389} 389}
390 390
391/* destructor */ 391/* destructor */
392static void __devexit snd_aw2_remove(struct pci_dev *pci) 392static void snd_aw2_remove(struct pci_dev *pci)
393{ 393{
394 snd_card_free(pci_get_drvdata(pci)); 394 snd_card_free(pci_get_drvdata(pci));
395 pci_set_drvdata(pci, NULL); 395 pci_set_drvdata(pci, NULL);
@@ -591,7 +591,7 @@ static snd_pcm_uframes_t snd_aw2_pcm_pointer_capture(struct snd_pcm_substream
591} 591}
592 592
593/* create a pcm device */ 593/* create a pcm device */
594static int __devinit snd_aw2_new_pcm(struct aw2 *chip) 594static int snd_aw2_new_pcm(struct aw2 *chip)
595{ 595{
596 struct snd_pcm *pcm_playback_ana; 596 struct snd_pcm *pcm_playback_ana;
597 struct snd_pcm *pcm_playback_num; 597 struct snd_pcm *pcm_playback_num;
diff --git a/sound/pci/azt3328.c b/sound/pci/azt3328.c
index c03b66b784a3..1204a0fa3368 100644
--- a/sound/pci/azt3328.c
+++ b/sound/pci/azt3328.c
@@ -817,7 +817,7 @@ snd_azf3328_mixer_ac97_write(struct snd_ac97 *ac97,
817 snd_azf3328_mixer_ac97_map_unsupported(reg_ac97, "write"); 817 snd_azf3328_mixer_ac97_map_unsupported(reg_ac97, "write");
818} 818}
819 819
820static int __devinit 820static int
821snd_azf3328_mixer_new(struct snd_azf3328 *chip) 821snd_azf3328_mixer_new(struct snd_azf3328 *chip)
822{ 822{
823 struct snd_ac97_bus *bus; 823 struct snd_ac97_bus *bus;
@@ -1171,7 +1171,7 @@ snd_azf3328_put_mixer_enum(struct snd_kcontrol *kcontrol,
1171 return (nreg != oreg); 1171 return (nreg != oreg);
1172} 1172}
1173 1173
1174static struct snd_kcontrol_new snd_azf3328_mixer_controls[] __devinitdata = { 1174static struct snd_kcontrol_new snd_azf3328_mixer_controls[] = {
1175 AZF3328_MIXER_SWITCH("Master Playback Switch", IDX_MIXER_PLAY_MASTER, 15, 1), 1175 AZF3328_MIXER_SWITCH("Master Playback Switch", IDX_MIXER_PLAY_MASTER, 15, 1),
1176 AZF3328_MIXER_VOL_STEREO("Master Playback Volume", IDX_MIXER_PLAY_MASTER, 0x1f, 1), 1176 AZF3328_MIXER_VOL_STEREO("Master Playback Volume", IDX_MIXER_PLAY_MASTER, 0x1f, 1),
1177 AZF3328_MIXER_SWITCH("PCM Playback Switch", IDX_MIXER_WAVEOUT, 15, 1), 1177 AZF3328_MIXER_SWITCH("PCM Playback Switch", IDX_MIXER_WAVEOUT, 15, 1),
@@ -1229,7 +1229,7 @@ static struct snd_kcontrol_new snd_azf3328_mixer_controls[] __devinitdata = {
1229#endif 1229#endif
1230}; 1230};
1231 1231
1232static u16 __devinitdata snd_azf3328_init_values[][2] = { 1232static u16 snd_azf3328_init_values[][2] = {
1233 { IDX_MIXER_PLAY_MASTER, MIXER_MUTE_MASK|0x1f1f }, 1233 { IDX_MIXER_PLAY_MASTER, MIXER_MUTE_MASK|0x1f1f },
1234 { IDX_MIXER_MODEMOUT, MIXER_MUTE_MASK|0x1f1f }, 1234 { IDX_MIXER_MODEMOUT, MIXER_MUTE_MASK|0x1f1f },
1235 { IDX_MIXER_BASSTREBLE, 0x0000 }, 1235 { IDX_MIXER_BASSTREBLE, 0x0000 },
@@ -1245,7 +1245,7 @@ static u16 __devinitdata snd_azf3328_init_values[][2] = {
1245 { IDX_MIXER_REC_VOLUME, MIXER_MUTE_MASK|0x0707 }, 1245 { IDX_MIXER_REC_VOLUME, MIXER_MUTE_MASK|0x0707 },
1246}; 1246};
1247 1247
1248static int __devinit 1248static int
1249snd_azf3328_mixer_new(struct snd_azf3328 *chip) 1249snd_azf3328_mixer_new(struct snd_azf3328 *chip)
1250{ 1250{
1251 struct snd_card *card; 1251 struct snd_card *card;
@@ -1899,7 +1899,7 @@ snd_azf3328_gameport_cooked_read(struct gameport *gameport,
1899 return 0; 1899 return 0;
1900} 1900}
1901 1901
1902static int __devinit 1902static int
1903snd_azf3328_gameport(struct snd_azf3328 *chip, int dev) 1903snd_azf3328_gameport(struct snd_azf3328 *chip, int dev)
1904{ 1904{
1905 struct gameport *gp; 1905 struct gameport *gp;
@@ -2212,7 +2212,7 @@ static struct snd_pcm_ops snd_azf3328_i2s_out_ops = {
2212 .pointer = snd_azf3328_pcm_pointer 2212 .pointer = snd_azf3328_pcm_pointer
2213}; 2213};
2214 2214
2215static int __devinit 2215static int
2216snd_azf3328_pcm(struct snd_azf3328 *chip) 2216snd_azf3328_pcm(struct snd_azf3328 *chip)
2217{ 2217{
2218enum { AZF_PCMDEV_STD, AZF_PCMDEV_I2S_OUT, NUM_AZF_PCMDEVS }; /* pcm devices */ 2218enum { AZF_PCMDEV_STD, AZF_PCMDEV_I2S_OUT, NUM_AZF_PCMDEVS }; /* pcm devices */
@@ -2344,7 +2344,7 @@ static struct snd_timer_hardware snd_azf3328_timer_hw = {
2344 .precise_resolution = snd_azf3328_timer_precise_resolution, 2344 .precise_resolution = snd_azf3328_timer_precise_resolution,
2345}; 2345};
2346 2346
2347static int __devinit 2347static int
2348snd_azf3328_timer(struct snd_azf3328 *chip, int device) 2348snd_azf3328_timer(struct snd_azf3328 *chip, int device)
2349{ 2349{
2350 struct snd_timer *timer = NULL; 2350 struct snd_timer *timer = NULL;
@@ -2489,7 +2489,7 @@ snd_azf3328_debug_show_ports(const struct snd_azf3328 *chip)
2489#endif /* DEBUG_MISC */ 2489#endif /* DEBUG_MISC */
2490} 2490}
2491 2491
2492static int __devinit 2492static int
2493snd_azf3328_create(struct snd_card *card, 2493snd_azf3328_create(struct snd_card *card,
2494 struct pci_dev *pci, 2494 struct pci_dev *pci,
2495 unsigned long device_type, 2495 unsigned long device_type,
@@ -2615,7 +2615,7 @@ out:
2615 return err; 2615 return err;
2616} 2616}
2617 2617
2618static int __devinit 2618static int
2619snd_azf3328_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) 2619snd_azf3328_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
2620{ 2620{
2621 static int dev; 2621 static int dev;
@@ -2720,7 +2720,7 @@ out:
2720 return err; 2720 return err;
2721} 2721}
2722 2722
2723static void __devexit 2723static void
2724snd_azf3328_remove(struct pci_dev *pci) 2724snd_azf3328_remove(struct pci_dev *pci)
2725{ 2725{
2726 snd_azf3328_dbgcallenter(); 2726 snd_azf3328_dbgcallenter();
@@ -2872,7 +2872,7 @@ static struct pci_driver azf3328_driver = {
2872 .name = KBUILD_MODNAME, 2872 .name = KBUILD_MODNAME,
2873 .id_table = snd_azf3328_ids, 2873 .id_table = snd_azf3328_ids,
2874 .probe = snd_azf3328_probe, 2874 .probe = snd_azf3328_probe,
2875 .remove = __devexit_p(snd_azf3328_remove), 2875 .remove = snd_azf3328_remove,
2876 .driver = { 2876 .driver = {
2877 .pm = SND_AZF3328_PM_OPS, 2877 .pm = SND_AZF3328_PM_OPS,
2878 }, 2878 },
diff --git a/sound/pci/bt87x.c b/sound/pci/bt87x.c
index b6a95eeca095..cdd100dae855 100644
--- a/sound/pci/bt87x.c
+++ b/sound/pci/bt87x.c
@@ -164,7 +164,7 @@ struct snd_bt87x_board {
164 unsigned no_digital:1; /* No digital input */ 164 unsigned no_digital:1; /* No digital input */
165}; 165};
166 166
167static __devinitdata struct snd_bt87x_board snd_bt87x_boards[] = { 167static struct snd_bt87x_board snd_bt87x_boards[] = {
168 [SND_BT87X_BOARD_UNKNOWN] = { 168 [SND_BT87X_BOARD_UNKNOWN] = {
169 .dig_rate = 32000, /* just a guess */ 169 .dig_rate = 32000, /* just a guess */
170 }, 170 },
@@ -696,7 +696,7 @@ static int snd_bt87x_dev_free(struct snd_device *device)
696 return snd_bt87x_free(chip); 696 return snd_bt87x_free(chip);
697} 697}
698 698
699static int __devinit snd_bt87x_pcm(struct snd_bt87x *chip, int device, char *name) 699static int snd_bt87x_pcm(struct snd_bt87x *chip, int device, char *name)
700{ 700{
701 int err; 701 int err;
702 struct snd_pcm *pcm; 702 struct snd_pcm *pcm;
@@ -714,9 +714,9 @@ static int __devinit snd_bt87x_pcm(struct snd_bt87x *chip, int device, char *nam
714 ALIGN(255 * 4092, 1024)); 714 ALIGN(255 * 4092, 1024));
715} 715}
716 716
717static int __devinit snd_bt87x_create(struct snd_card *card, 717static int snd_bt87x_create(struct snd_card *card,
718 struct pci_dev *pci, 718 struct pci_dev *pci,
719 struct snd_bt87x **rchip) 719 struct snd_bt87x **rchip)
720{ 720{
721 struct snd_bt87x *chip; 721 struct snd_bt87x *chip;
722 int err; 722 int err;
@@ -822,7 +822,7 @@ MODULE_DEVICE_TABLE(pci, snd_bt87x_ids);
822 * (DVB cards use the audio function to transfer MPEG data) */ 822 * (DVB cards use the audio function to transfer MPEG data) */
823static struct { 823static struct {
824 unsigned short subvendor, subdevice; 824 unsigned short subvendor, subdevice;
825} blacklist[] __devinitdata = { 825} blacklist[] = {
826 {0x0071, 0x0101}, /* Nebula Electronics DigiTV */ 826 {0x0071, 0x0101}, /* Nebula Electronics DigiTV */
827 {0x11bd, 0x001c}, /* Pinnacle PCTV Sat */ 827 {0x11bd, 0x001c}, /* Pinnacle PCTV Sat */
828 {0x11bd, 0x0026}, /* Pinnacle PCTV SAT CI */ 828 {0x11bd, 0x0026}, /* Pinnacle PCTV SAT CI */
@@ -837,7 +837,7 @@ static struct {
837}; 837};
838 838
839/* return the id of the card, or a negative value if it's blacklisted */ 839/* return the id of the card, or a negative value if it's blacklisted */
840static int __devinit snd_bt87x_detect_card(struct pci_dev *pci) 840static int snd_bt87x_detect_card(struct pci_dev *pci)
841{ 841{
842 int i; 842 int i;
843 const struct pci_device_id *supported; 843 const struct pci_device_id *supported;
@@ -862,8 +862,8 @@ static int __devinit snd_bt87x_detect_card(struct pci_dev *pci)
862 return SND_BT87X_BOARD_UNKNOWN; 862 return SND_BT87X_BOARD_UNKNOWN;
863} 863}
864 864
865static int __devinit snd_bt87x_probe(struct pci_dev *pci, 865static int snd_bt87x_probe(struct pci_dev *pci,
866 const struct pci_device_id *pci_id) 866 const struct pci_device_id *pci_id)
867{ 867{
868 static int dev; 868 static int dev;
869 struct snd_card *card; 869 struct snd_card *card;
@@ -948,7 +948,7 @@ _error:
948 return err; 948 return err;
949} 949}
950 950
951static void __devexit snd_bt87x_remove(struct pci_dev *pci) 951static void snd_bt87x_remove(struct pci_dev *pci)
952{ 952{
953 snd_card_free(pci_get_drvdata(pci)); 953 snd_card_free(pci_get_drvdata(pci));
954 pci_set_drvdata(pci, NULL); 954 pci_set_drvdata(pci, NULL);
@@ -966,7 +966,7 @@ static struct pci_driver bt87x_driver = {
966 .name = KBUILD_MODNAME, 966 .name = KBUILD_MODNAME,
967 .id_table = snd_bt87x_ids, 967 .id_table = snd_bt87x_ids,
968 .probe = snd_bt87x_probe, 968 .probe = snd_bt87x_probe,
969 .remove = __devexit_p(snd_bt87x_remove), 969 .remove = snd_bt87x_remove,
970}; 970};
971 971
972module_pci_driver(bt87x_driver); 972module_pci_driver(bt87x_driver);
diff --git a/sound/pci/ca0106/ca0106_main.c b/sound/pci/ca0106/ca0106_main.c
index 65c55910566b..1610a5705970 100644
--- a/sound/pci/ca0106/ca0106_main.c
+++ b/sound/pci/ca0106/ca0106_main.c
@@ -1352,7 +1352,7 @@ static const struct snd_pcm_chmap_elem side_map[] = {
1352 { } 1352 { }
1353}; 1353};
1354 1354
1355static int __devinit snd_ca0106_pcm(struct snd_ca0106 *emu, int device) 1355static int snd_ca0106_pcm(struct snd_ca0106 *emu, int device)
1356{ 1356{
1357 struct snd_pcm *pcm; 1357 struct snd_pcm *pcm;
1358 struct snd_pcm_substream *substream; 1358 struct snd_pcm_substream *substream;
@@ -1650,7 +1650,7 @@ static void ca0106_stop_chip(struct snd_ca0106 *chip)
1650 */ 1650 */
1651} 1651}
1652 1652
1653static int __devinit snd_ca0106_create(int dev, struct snd_card *card, 1653static int snd_ca0106_create(int dev, struct snd_card *card,
1654 struct pci_dev *pci, 1654 struct pci_dev *pci,
1655 struct snd_ca0106 **rchip) 1655 struct snd_ca0106 **rchip)
1656{ 1656{
@@ -1777,7 +1777,7 @@ static int ca0106_dev_id_port(void *dev_id)
1777 return ((struct snd_ca0106 *)dev_id)->port; 1777 return ((struct snd_ca0106 *)dev_id)->port;
1778} 1778}
1779 1779
1780static int __devinit snd_ca0106_midi(struct snd_ca0106 *chip, unsigned int channel) 1780static int snd_ca0106_midi(struct snd_ca0106 *chip, unsigned int channel)
1781{ 1781{
1782 struct snd_ca_midi *midi; 1782 struct snd_ca_midi *midi;
1783 char *name; 1783 char *name;
@@ -1828,7 +1828,7 @@ static int __devinit snd_ca0106_midi(struct snd_ca0106 *chip, unsigned int chann
1828} 1828}
1829 1829
1830 1830
1831static int __devinit snd_ca0106_probe(struct pci_dev *pci, 1831static int snd_ca0106_probe(struct pci_dev *pci,
1832 const struct pci_device_id *pci_id) 1832 const struct pci_device_id *pci_id)
1833{ 1833{
1834 static int dev; 1834 static int dev;
@@ -1893,7 +1893,7 @@ static int __devinit snd_ca0106_probe(struct pci_dev *pci,
1893 return err; 1893 return err;
1894} 1894}
1895 1895
1896static void __devexit snd_ca0106_remove(struct pci_dev *pci) 1896static void snd_ca0106_remove(struct pci_dev *pci)
1897{ 1897{
1898 snd_card_free(pci_get_drvdata(pci)); 1898 snd_card_free(pci_get_drvdata(pci));
1899 pci_set_drvdata(pci, NULL); 1899 pci_set_drvdata(pci, NULL);
@@ -1971,7 +1971,7 @@ static struct pci_driver ca0106_driver = {
1971 .name = KBUILD_MODNAME, 1971 .name = KBUILD_MODNAME,
1972 .id_table = snd_ca0106_ids, 1972 .id_table = snd_ca0106_ids,
1973 .probe = snd_ca0106_probe, 1973 .probe = snd_ca0106_probe,
1974 .remove = __devexit_p(snd_ca0106_remove), 1974 .remove = snd_ca0106_remove,
1975 .driver = { 1975 .driver = {
1976 .pm = SND_CA0106_PM_OPS, 1976 .pm = SND_CA0106_PM_OPS,
1977 }, 1977 },
diff --git a/sound/pci/ca0106/ca0106_mixer.c b/sound/pci/ca0106/ca0106_mixer.c
index 68eacf7002d6..27de0de90018 100644
--- a/sound/pci/ca0106/ca0106_mixer.c
+++ b/sound/pci/ca0106/ca0106_mixer.c
@@ -325,7 +325,7 @@ static int snd_ca0106_capture_mic_line_in_put(struct snd_kcontrol *kcontrol,
325 return change; 325 return change;
326} 326}
327 327
328static struct snd_kcontrol_new snd_ca0106_capture_mic_line_in __devinitdata = 328static struct snd_kcontrol_new snd_ca0106_capture_mic_line_in =
329{ 329{
330 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 330 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
331 .name = "Shared Mic/Line in Capture Switch", 331 .name = "Shared Mic/Line in Capture Switch",
@@ -334,7 +334,7 @@ static struct snd_kcontrol_new snd_ca0106_capture_mic_line_in __devinitdata =
334 .put = snd_ca0106_capture_mic_line_in_put 334 .put = snd_ca0106_capture_mic_line_in_put
335}; 335};
336 336
337static struct snd_kcontrol_new snd_ca0106_capture_line_in_side_out __devinitdata = 337static struct snd_kcontrol_new snd_ca0106_capture_line_in_side_out =
338{ 338{
339 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 339 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
340 .name = "Shared Line in/Side out Capture Switch", 340 .name = "Shared Line in/Side out Capture Switch",
@@ -588,7 +588,7 @@ static int spi_mute_put(struct snd_kcontrol *kcontrol,
588 .private_value = ((chid) << 8) | (reg) \ 588 .private_value = ((chid) << 8) | (reg) \
589} 589}
590 590
591static struct snd_kcontrol_new snd_ca0106_volume_ctls[] __devinitdata = { 591static struct snd_kcontrol_new snd_ca0106_volume_ctls[] = {
592 CA_VOLUME("Analog Front Playback Volume", 592 CA_VOLUME("Analog Front Playback Volume",
593 CONTROL_FRONT_CHANNEL, PLAYBACK_VOLUME2), 593 CONTROL_FRONT_CHANNEL, PLAYBACK_VOLUME2),
594 CA_VOLUME("Analog Rear Playback Volume", 594 CA_VOLUME("Analog Rear Playback Volume",
@@ -669,7 +669,7 @@ static struct snd_kcontrol_new snd_ca0106_volume_ctls[] __devinitdata = {
669 .private_value = chid \ 669 .private_value = chid \
670} 670}
671 671
672static struct snd_kcontrol_new snd_ca0106_volume_i2c_adc_ctls[] __devinitdata = { 672static struct snd_kcontrol_new snd_ca0106_volume_i2c_adc_ctls[] = {
673 I2C_VOLUME("Phone Capture Volume", 0), 673 I2C_VOLUME("Phone Capture Volume", 0),
674 I2C_VOLUME("Mic Capture Volume", 1), 674 I2C_VOLUME("Mic Capture Volume", 1),
675 I2C_VOLUME("Line in Capture Volume", 2), 675 I2C_VOLUME("Line in Capture Volume", 2),
@@ -691,7 +691,7 @@ static const int spi_dmute_bit[] = {
691 SPI_DMUTE4_BIT, 691 SPI_DMUTE4_BIT,
692}; 692};
693 693
694static struct snd_kcontrol_new __devinit 694static struct snd_kcontrol_new
695snd_ca0106_volume_spi_dac_ctl(struct snd_ca0106_details *details, 695snd_ca0106_volume_spi_dac_ctl(struct snd_ca0106_details *details,
696 int channel_id) 696 int channel_id)
697{ 697{
@@ -735,7 +735,7 @@ snd_ca0106_volume_spi_dac_ctl(struct snd_ca0106_details *details,
735 return spi_switch; 735 return spi_switch;
736} 736}
737 737
738static int __devinit remove_ctl(struct snd_card *card, const char *name) 738static int remove_ctl(struct snd_card *card, const char *name)
739{ 739{
740 struct snd_ctl_elem_id id; 740 struct snd_ctl_elem_id id;
741 memset(&id, 0, sizeof(id)); 741 memset(&id, 0, sizeof(id));
@@ -744,7 +744,7 @@ static int __devinit remove_ctl(struct snd_card *card, const char *name)
744 return snd_ctl_remove_id(card, &id); 744 return snd_ctl_remove_id(card, &id);
745} 745}
746 746
747static struct snd_kcontrol __devinit *ctl_find(struct snd_card *card, const char *name) 747static struct snd_kcontrol *ctl_find(struct snd_card *card, const char *name)
748{ 748{
749 struct snd_ctl_elem_id sid; 749 struct snd_ctl_elem_id sid;
750 memset(&sid, 0, sizeof(sid)); 750 memset(&sid, 0, sizeof(sid));
@@ -754,7 +754,7 @@ static struct snd_kcontrol __devinit *ctl_find(struct snd_card *card, const char
754 return snd_ctl_find_id(card, &sid); 754 return snd_ctl_find_id(card, &sid);
755} 755}
756 756
757static int __devinit rename_ctl(struct snd_card *card, const char *src, const char *dst) 757static int rename_ctl(struct snd_card *card, const char *src, const char *dst)
758{ 758{
759 struct snd_kcontrol *kctl = ctl_find(card, src); 759 struct snd_kcontrol *kctl = ctl_find(card, src);
760 if (kctl) { 760 if (kctl) {
@@ -774,10 +774,10 @@ static int __devinit rename_ctl(struct snd_card *card, const char *src, const ch
774 } \ 774 } \
775 } while (0) 775 } while (0)
776 776
777static __devinitdata 777static
778DECLARE_TLV_DB_SCALE(snd_ca0106_master_db_scale, -6375, 25, 1); 778DECLARE_TLV_DB_SCALE(snd_ca0106_master_db_scale, -6375, 25, 1);
779 779
780static char *slave_vols[] __devinitdata = { 780static char *slave_vols[] = {
781 "Analog Front Playback Volume", 781 "Analog Front Playback Volume",
782 "Analog Rear Playback Volume", 782 "Analog Rear Playback Volume",
783 "Analog Center/LFE Playback Volume", 783 "Analog Center/LFE Playback Volume",
@@ -790,7 +790,7 @@ static char *slave_vols[] __devinitdata = {
790 NULL 790 NULL
791}; 791};
792 792
793static char *slave_sws[] __devinitdata = { 793static char *slave_sws[] = {
794 "Analog Front Playback Switch", 794 "Analog Front Playback Switch",
795 "Analog Rear Playback Switch", 795 "Analog Rear Playback Switch",
796 "Analog Center/LFE Playback Switch", 796 "Analog Center/LFE Playback Switch",
@@ -799,7 +799,7 @@ static char *slave_sws[] __devinitdata = {
799 NULL 799 NULL
800}; 800};
801 801
802static void __devinit add_slaves(struct snd_card *card, 802static void add_slaves(struct snd_card *card,
803 struct snd_kcontrol *master, char **list) 803 struct snd_kcontrol *master, char **list)
804{ 804{
805 for (; *list; list++) { 805 for (; *list; list++) {
@@ -809,7 +809,7 @@ static void __devinit add_slaves(struct snd_card *card,
809 } 809 }
810} 810}
811 811
812int __devinit snd_ca0106_mixer(struct snd_ca0106 *emu) 812int snd_ca0106_mixer(struct snd_ca0106 *emu)
813{ 813{
814 int err; 814 int err;
815 struct snd_card *card = emu->card; 815 struct snd_card *card = emu->card;
diff --git a/sound/pci/ca0106/ca0106_proc.c b/sound/pci/ca0106/ca0106_proc.c
index c694464b1168..4f9c2821bb31 100644
--- a/sound/pci/ca0106/ca0106_proc.c
+++ b/sound/pci/ca0106/ca0106_proc.c
@@ -424,7 +424,7 @@ static void snd_ca0106_proc_i2c_write(struct snd_info_entry *entry,
424 } 424 }
425} 425}
426 426
427int __devinit snd_ca0106_proc_init(struct snd_ca0106 * emu) 427int snd_ca0106_proc_init(struct snd_ca0106 *emu)
428{ 428{
429 struct snd_info_entry *entry; 429 struct snd_info_entry *entry;
430 430
diff --git a/sound/pci/ca0106/ca_midi.c b/sound/pci/ca0106/ca_midi.c
index c7885117da33..8bbdf265d11d 100644
--- a/sound/pci/ca0106/ca_midi.c
+++ b/sound/pci/ca0106/ca_midi.c
@@ -286,7 +286,7 @@ static void ca_rmidi_free(struct snd_rawmidi *rmidi)
286 ca_midi_free(rmidi->private_data); 286 ca_midi_free(rmidi->private_data);
287} 287}
288 288
289int __devinit ca_midi_init(void *dev_id, struct snd_ca_midi *midi, int device, char *name) 289int ca_midi_init(void *dev_id, struct snd_ca_midi *midi, int device, char *name)
290{ 290{
291 struct snd_rawmidi *rmidi; 291 struct snd_rawmidi *rmidi;
292 int err; 292 int err;
diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c
index 22122ff26e34..c617435db6e6 100644
--- a/sound/pci/cmipci.c
+++ b/sound/pci/cmipci.c
@@ -1045,7 +1045,7 @@ static int snd_cmipci_spdif_default_put(struct snd_kcontrol *kcontrol,
1045 return change; 1045 return change;
1046} 1046}
1047 1047
1048static struct snd_kcontrol_new snd_cmipci_spdif_default __devinitdata = 1048static struct snd_kcontrol_new snd_cmipci_spdif_default =
1049{ 1049{
1050 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 1050 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
1051 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT), 1051 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT),
@@ -1072,7 +1072,7 @@ static int snd_cmipci_spdif_mask_get(struct snd_kcontrol *kcontrol,
1072 return 0; 1072 return 0;
1073} 1073}
1074 1074
1075static struct snd_kcontrol_new snd_cmipci_spdif_mask __devinitdata = 1075static struct snd_kcontrol_new snd_cmipci_spdif_mask =
1076{ 1076{
1077 .access = SNDRV_CTL_ELEM_ACCESS_READ, 1077 .access = SNDRV_CTL_ELEM_ACCESS_READ,
1078 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 1078 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
@@ -1119,7 +1119,7 @@ static int snd_cmipci_spdif_stream_put(struct snd_kcontrol *kcontrol,
1119 return change; 1119 return change;
1120} 1120}
1121 1121
1122static struct snd_kcontrol_new snd_cmipci_spdif_stream __devinitdata = 1122static struct snd_kcontrol_new snd_cmipci_spdif_stream =
1123{ 1123{
1124 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_INACTIVE, 1124 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_INACTIVE,
1125 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 1125 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
@@ -1897,7 +1897,7 @@ static struct snd_pcm_ops snd_cmipci_capture_spdif_ops = {
1897/* 1897/*
1898 */ 1898 */
1899 1899
1900static int __devinit snd_cmipci_pcm_new(struct cmipci *cm, int device) 1900static int snd_cmipci_pcm_new(struct cmipci *cm, int device)
1901{ 1901{
1902 struct snd_pcm *pcm; 1902 struct snd_pcm *pcm;
1903 int err; 1903 int err;
@@ -1920,7 +1920,7 @@ static int __devinit snd_cmipci_pcm_new(struct cmipci *cm, int device)
1920 return 0; 1920 return 0;
1921} 1921}
1922 1922
1923static int __devinit snd_cmipci_pcm2_new(struct cmipci *cm, int device) 1923static int snd_cmipci_pcm2_new(struct cmipci *cm, int device)
1924{ 1924{
1925 struct snd_pcm *pcm; 1925 struct snd_pcm *pcm;
1926 int err; 1926 int err;
@@ -1942,7 +1942,7 @@ static int __devinit snd_cmipci_pcm2_new(struct cmipci *cm, int device)
1942 return 0; 1942 return 0;
1943} 1943}
1944 1944
1945static int __devinit snd_cmipci_pcm_spdif_new(struct cmipci *cm, int device) 1945static int snd_cmipci_pcm_spdif_new(struct cmipci *cm, int device)
1946{ 1946{
1947 struct snd_pcm *pcm; 1947 struct snd_pcm *pcm;
1948 int err; 1948 int err;
@@ -2290,7 +2290,7 @@ static int snd_cmipci_put_native_mixer_sensitive(struct snd_kcontrol *kcontrol,
2290} 2290}
2291 2291
2292 2292
2293static struct snd_kcontrol_new snd_cmipci_mixers[] __devinitdata = { 2293static struct snd_kcontrol_new snd_cmipci_mixers[] = {
2294 CMIPCI_SB_VOL_STEREO("Master Playback Volume", SB_DSP4_MASTER_DEV, 3, 31), 2294 CMIPCI_SB_VOL_STEREO("Master Playback Volume", SB_DSP4_MASTER_DEV, 3, 31),
2295 CMIPCI_MIXER_SW_MONO("3D Control - Switch", CM_REG_MIXER1, CM_X3DEN_SHIFT, 0), 2295 CMIPCI_MIXER_SW_MONO("3D Control - Switch", CM_REG_MIXER1, CM_X3DEN_SHIFT, 0),
2296 CMIPCI_SB_VOL_STEREO("PCM Playback Volume", SB_DSP4_PCM_DEV, 3, 31), 2296 CMIPCI_SB_VOL_STEREO("PCM Playback Volume", SB_DSP4_PCM_DEV, 3, 31),
@@ -2601,7 +2601,7 @@ static int snd_cmipci_mic_in_mode_put(struct snd_kcontrol *kcontrol,
2601} 2601}
2602 2602
2603/* both for CM8338/8738 */ 2603/* both for CM8338/8738 */
2604static struct snd_kcontrol_new snd_cmipci_mixer_switches[] __devinitdata = { 2604static struct snd_kcontrol_new snd_cmipci_mixer_switches[] = {
2605 DEFINE_MIXER_SWITCH("Four Channel Mode", fourch), 2605 DEFINE_MIXER_SWITCH("Four Channel Mode", fourch),
2606 { 2606 {
2607 .name = "Line-In Mode", 2607 .name = "Line-In Mode",
@@ -2613,11 +2613,11 @@ static struct snd_kcontrol_new snd_cmipci_mixer_switches[] __devinitdata = {
2613}; 2613};
2614 2614
2615/* for non-multichannel chips */ 2615/* for non-multichannel chips */
2616static struct snd_kcontrol_new snd_cmipci_nomulti_switch __devinitdata = 2616static struct snd_kcontrol_new snd_cmipci_nomulti_switch =
2617DEFINE_MIXER_SWITCH("Exchange DAC", exchange_dac); 2617DEFINE_MIXER_SWITCH("Exchange DAC", exchange_dac);
2618 2618
2619/* only for CM8738 */ 2619/* only for CM8738 */
2620static struct snd_kcontrol_new snd_cmipci_8738_mixer_switches[] __devinitdata = { 2620static struct snd_kcontrol_new snd_cmipci_8738_mixer_switches[] = {
2621#if 0 /* controlled in pcm device */ 2621#if 0 /* controlled in pcm device */
2622 DEFINE_MIXER_SWITCH("IEC958 In Record", spdif_in), 2622 DEFINE_MIXER_SWITCH("IEC958 In Record", spdif_in),
2623 DEFINE_MIXER_SWITCH("IEC958 Out", spdif_out), 2623 DEFINE_MIXER_SWITCH("IEC958 Out", spdif_out),
@@ -2639,14 +2639,14 @@ static struct snd_kcontrol_new snd_cmipci_8738_mixer_switches[] __devinitdata =
2639}; 2639};
2640 2640
2641/* only for model 033/037 */ 2641/* only for model 033/037 */
2642static struct snd_kcontrol_new snd_cmipci_old_mixer_switches[] __devinitdata = { 2642static struct snd_kcontrol_new snd_cmipci_old_mixer_switches[] = {
2643 DEFINE_MIXER_SWITCH("IEC958 Mix Analog", spdif_dac_out), 2643 DEFINE_MIXER_SWITCH("IEC958 Mix Analog", spdif_dac_out),
2644 DEFINE_MIXER_SWITCH("IEC958 In Phase Inverse", spdi_phase), 2644 DEFINE_MIXER_SWITCH("IEC958 In Phase Inverse", spdi_phase),
2645 DEFINE_MIXER_SWITCH("IEC958 In Select", spdif_in_sel1), 2645 DEFINE_MIXER_SWITCH("IEC958 In Select", spdif_in_sel1),
2646}; 2646};
2647 2647
2648/* only for model 039 or later */ 2648/* only for model 039 or later */
2649static struct snd_kcontrol_new snd_cmipci_extra_mixer_switches[] __devinitdata = { 2649static struct snd_kcontrol_new snd_cmipci_extra_mixer_switches[] = {
2650 DEFINE_MIXER_SWITCH("IEC958 In Select", spdif_in_sel2), 2650 DEFINE_MIXER_SWITCH("IEC958 In Select", spdif_in_sel2),
2651 DEFINE_MIXER_SWITCH("IEC958 In Phase Inverse", spdi_phase2), 2651 DEFINE_MIXER_SWITCH("IEC958 In Phase Inverse", spdi_phase2),
2652 { 2652 {
@@ -2659,11 +2659,11 @@ static struct snd_kcontrol_new snd_cmipci_extra_mixer_switches[] __devinitdata =
2659}; 2659};
2660 2660
2661/* card control switches */ 2661/* card control switches */
2662static struct snd_kcontrol_new snd_cmipci_modem_switch __devinitdata = 2662static struct snd_kcontrol_new snd_cmipci_modem_switch =
2663DEFINE_CARD_SWITCH("Modem", modem); 2663DEFINE_CARD_SWITCH("Modem", modem);
2664 2664
2665 2665
2666static int __devinit snd_cmipci_mixer_new(struct cmipci *cm, int pcm_spdif_device) 2666static int snd_cmipci_mixer_new(struct cmipci *cm, int pcm_spdif_device)
2667{ 2667{
2668 struct snd_card *card; 2668 struct snd_card *card;
2669 struct snd_kcontrol_new *sw; 2669 struct snd_kcontrol_new *sw;
@@ -2791,7 +2791,7 @@ static void snd_cmipci_proc_read(struct snd_info_entry *entry,
2791 snd_iprintf(buffer, "\n"); 2791 snd_iprintf(buffer, "\n");
2792} 2792}
2793 2793
2794static void __devinit snd_cmipci_proc_init(struct cmipci *cm) 2794static void snd_cmipci_proc_init(struct cmipci *cm)
2795{ 2795{
2796 struct snd_info_entry *entry; 2796 struct snd_info_entry *entry;
2797 2797
@@ -2817,7 +2817,7 @@ static DEFINE_PCI_DEVICE_TABLE(snd_cmipci_ids) = {
2817 * check chip version and capabilities 2817 * check chip version and capabilities
2818 * driver name is modified according to the chip model 2818 * driver name is modified according to the chip model
2819 */ 2819 */
2820static void __devinit query_chip(struct cmipci *cm) 2820static void query_chip(struct cmipci *cm)
2821{ 2821{
2822 unsigned int detect; 2822 unsigned int detect;
2823 2823
@@ -2866,7 +2866,7 @@ static void __devinit query_chip(struct cmipci *cm)
2866} 2866}
2867 2867
2868#ifdef SUPPORT_JOYSTICK 2868#ifdef SUPPORT_JOYSTICK
2869static int __devinit snd_cmipci_create_gameport(struct cmipci *cm, int dev) 2869static int snd_cmipci_create_gameport(struct cmipci *cm, int dev)
2870{ 2870{
2871 static int ports[] = { 0x201, 0x200, 0 }; /* FIXME: majority is 0x201? */ 2871 static int ports[] = { 0x201, 0x200, 0 }; /* FIXME: majority is 0x201? */
2872 struct gameport *gp; 2872 struct gameport *gp;
@@ -2959,7 +2959,7 @@ static int snd_cmipci_dev_free(struct snd_device *device)
2959 return snd_cmipci_free(cm); 2959 return snd_cmipci_free(cm);
2960} 2960}
2961 2961
2962static int __devinit snd_cmipci_create_fm(struct cmipci *cm, long fm_port) 2962static int snd_cmipci_create_fm(struct cmipci *cm, long fm_port)
2963{ 2963{
2964 long iosynth; 2964 long iosynth;
2965 unsigned int val; 2965 unsigned int val;
@@ -3012,8 +3012,8 @@ static int __devinit snd_cmipci_create_fm(struct cmipci *cm, long fm_port)
3012 return 0; 3012 return 0;
3013} 3013}
3014 3014
3015static int __devinit snd_cmipci_create(struct snd_card *card, struct pci_dev *pci, 3015static int snd_cmipci_create(struct snd_card *card, struct pci_dev *pci,
3016 int dev, struct cmipci **rcmipci) 3016 int dev, struct cmipci **rcmipci)
3017{ 3017{
3018 struct cmipci *cm; 3018 struct cmipci *cm;
3019 int err; 3019 int err;
@@ -3265,8 +3265,8 @@ static int __devinit snd_cmipci_create(struct snd_card *card, struct pci_dev *pc
3265 3265
3266MODULE_DEVICE_TABLE(pci, snd_cmipci_ids); 3266MODULE_DEVICE_TABLE(pci, snd_cmipci_ids);
3267 3267
3268static int __devinit snd_cmipci_probe(struct pci_dev *pci, 3268static int snd_cmipci_probe(struct pci_dev *pci,
3269 const struct pci_device_id *pci_id) 3269 const struct pci_device_id *pci_id)
3270{ 3270{
3271 static int dev; 3271 static int dev;
3272 struct snd_card *card; 3272 struct snd_card *card;
@@ -3314,7 +3314,7 @@ static int __devinit snd_cmipci_probe(struct pci_dev *pci,
3314 3314
3315} 3315}
3316 3316
3317static void __devexit snd_cmipci_remove(struct pci_dev *pci) 3317static void snd_cmipci_remove(struct pci_dev *pci)
3318{ 3318{
3319 snd_card_free(pci_get_drvdata(pci)); 3319 snd_card_free(pci_get_drvdata(pci));
3320 pci_set_drvdata(pci, NULL); 3320 pci_set_drvdata(pci, NULL);
@@ -3415,7 +3415,7 @@ static struct pci_driver cmipci_driver = {
3415 .name = KBUILD_MODNAME, 3415 .name = KBUILD_MODNAME,
3416 .id_table = snd_cmipci_ids, 3416 .id_table = snd_cmipci_ids,
3417 .probe = snd_cmipci_probe, 3417 .probe = snd_cmipci_probe,
3418 .remove = __devexit_p(snd_cmipci_remove), 3418 .remove = snd_cmipci_remove,
3419 .driver = { 3419 .driver = {
3420 .pm = SND_CMIPCI_PM_OPS, 3420 .pm = SND_CMIPCI_PM_OPS,
3421 }, 3421 },
diff --git a/sound/pci/cs4281.c b/sound/pci/cs4281.c
index 8e86ec0031fc..6a8695069941 100644
--- a/sound/pci/cs4281.c
+++ b/sound/pci/cs4281.c
@@ -969,8 +969,8 @@ static struct snd_pcm_ops snd_cs4281_capture_ops = {
969 .pointer = snd_cs4281_pointer, 969 .pointer = snd_cs4281_pointer,
970}; 970};
971 971
972static int __devinit snd_cs4281_pcm(struct cs4281 * chip, int device, 972static int snd_cs4281_pcm(struct cs4281 *chip, int device,
973 struct snd_pcm ** rpcm) 973 struct snd_pcm **rpcm)
974{ 974{
975 struct snd_pcm *pcm; 975 struct snd_pcm *pcm;
976 int err; 976 int err;
@@ -1093,7 +1093,7 @@ static void snd_cs4281_mixer_free_ac97(struct snd_ac97 *ac97)
1093 chip->ac97 = NULL; 1093 chip->ac97 = NULL;
1094} 1094}
1095 1095
1096static int __devinit snd_cs4281_mixer(struct cs4281 * chip) 1096static int snd_cs4281_mixer(struct cs4281 *chip)
1097{ 1097{
1098 struct snd_card *card = chip->card; 1098 struct snd_card *card = chip->card;
1099 struct snd_ac97_template ac97; 1099 struct snd_ac97_template ac97;
@@ -1171,7 +1171,7 @@ static struct snd_info_entry_ops snd_cs4281_proc_ops_BA1 = {
1171 .read = snd_cs4281_BA1_read, 1171 .read = snd_cs4281_BA1_read,
1172}; 1172};
1173 1173
1174static void __devinit snd_cs4281_proc_init(struct cs4281 * chip) 1174static void snd_cs4281_proc_init(struct cs4281 *chip)
1175{ 1175{
1176 struct snd_info_entry *entry; 1176 struct snd_info_entry *entry;
1177 1177
@@ -1259,7 +1259,7 @@ static int snd_cs4281_gameport_open(struct gameport *gameport, int mode)
1259 return 0; 1259 return 0;
1260} 1260}
1261 1261
1262static int __devinit snd_cs4281_create_gameport(struct cs4281 *chip) 1262static int snd_cs4281_create_gameport(struct cs4281 *chip)
1263{ 1263{
1264 struct gameport *gp; 1264 struct gameport *gp;
1265 1265
@@ -1335,10 +1335,10 @@ static int snd_cs4281_dev_free(struct snd_device *device)
1335 1335
1336static int snd_cs4281_chip_init(struct cs4281 *chip); /* defined below */ 1336static int snd_cs4281_chip_init(struct cs4281 *chip); /* defined below */
1337 1337
1338static int __devinit snd_cs4281_create(struct snd_card *card, 1338static int snd_cs4281_create(struct snd_card *card,
1339 struct pci_dev *pci, 1339 struct pci_dev *pci,
1340 struct cs4281 ** rchip, 1340 struct cs4281 **rchip,
1341 int dual_codec) 1341 int dual_codec)
1342{ 1342{
1343 struct cs4281 *chip; 1343 struct cs4281 *chip;
1344 unsigned int tmp; 1344 unsigned int tmp;
@@ -1779,8 +1779,8 @@ static struct snd_rawmidi_ops snd_cs4281_midi_input =
1779 .trigger = snd_cs4281_midi_input_trigger, 1779 .trigger = snd_cs4281_midi_input_trigger,
1780}; 1780};
1781 1781
1782static int __devinit snd_cs4281_midi(struct cs4281 * chip, int device, 1782static int snd_cs4281_midi(struct cs4281 *chip, int device,
1783 struct snd_rawmidi **rrawmidi) 1783 struct snd_rawmidi **rrawmidi)
1784{ 1784{
1785 struct snd_rawmidi *rmidi; 1785 struct snd_rawmidi *rmidi;
1786 int err; 1786 int err;
@@ -1901,8 +1901,8 @@ static void snd_cs4281_opl3_command(struct snd_opl3 *opl3, unsigned short cmd,
1901 spin_unlock_irqrestore(&opl3->reg_lock, flags); 1901 spin_unlock_irqrestore(&opl3->reg_lock, flags);
1902} 1902}
1903 1903
1904static int __devinit snd_cs4281_probe(struct pci_dev *pci, 1904static int snd_cs4281_probe(struct pci_dev *pci,
1905 const struct pci_device_id *pci_id) 1905 const struct pci_device_id *pci_id)
1906{ 1906{
1907 static int dev; 1907 static int dev;
1908 struct snd_card *card; 1908 struct snd_card *card;
@@ -1968,7 +1968,7 @@ static int __devinit snd_cs4281_probe(struct pci_dev *pci,
1968 return 0; 1968 return 0;
1969} 1969}
1970 1970
1971static void __devexit snd_cs4281_remove(struct pci_dev *pci) 1971static void snd_cs4281_remove(struct pci_dev *pci)
1972{ 1972{
1973 snd_card_free(pci_get_drvdata(pci)); 1973 snd_card_free(pci_get_drvdata(pci));
1974 pci_set_drvdata(pci, NULL); 1974 pci_set_drvdata(pci, NULL);
@@ -2095,7 +2095,7 @@ static struct pci_driver cs4281_driver = {
2095 .name = KBUILD_MODNAME, 2095 .name = KBUILD_MODNAME,
2096 .id_table = snd_cs4281_ids, 2096 .id_table = snd_cs4281_ids,
2097 .probe = snd_cs4281_probe, 2097 .probe = snd_cs4281_probe,
2098 .remove = __devexit_p(snd_cs4281_remove), 2098 .remove = snd_cs4281_remove,
2099 .driver = { 2099 .driver = {
2100 .pm = CS4281_PM_OPS, 2100 .pm = CS4281_PM_OPS,
2101 }, 2101 },
diff --git a/sound/pci/cs46xx/cs46xx.c b/sound/pci/cs46xx/cs46xx.c
index 575bed0836ff..6b0d8b50a305 100644
--- a/sound/pci/cs46xx/cs46xx.c
+++ b/sound/pci/cs46xx/cs46xx.c
@@ -73,8 +73,8 @@ static DEFINE_PCI_DEVICE_TABLE(snd_cs46xx_ids) = {
73 73
74MODULE_DEVICE_TABLE(pci, snd_cs46xx_ids); 74MODULE_DEVICE_TABLE(pci, snd_cs46xx_ids);
75 75
76static int __devinit snd_card_cs46xx_probe(struct pci_dev *pci, 76static int snd_card_cs46xx_probe(struct pci_dev *pci,
77 const struct pci_device_id *pci_id) 77 const struct pci_device_id *pci_id)
78{ 78{
79 static int dev; 79 static int dev;
80 struct snd_card *card; 80 struct snd_card *card;
@@ -155,7 +155,7 @@ static int __devinit snd_card_cs46xx_probe(struct pci_dev *pci,
155 return 0; 155 return 0;
156} 156}
157 157
158static void __devexit snd_card_cs46xx_remove(struct pci_dev *pci) 158static void snd_card_cs46xx_remove(struct pci_dev *pci)
159{ 159{
160 snd_card_free(pci_get_drvdata(pci)); 160 snd_card_free(pci_get_drvdata(pci));
161 pci_set_drvdata(pci, NULL); 161 pci_set_drvdata(pci, NULL);
@@ -165,7 +165,7 @@ static struct pci_driver cs46xx_driver = {
165 .name = KBUILD_MODNAME, 165 .name = KBUILD_MODNAME,
166 .id_table = snd_cs46xx_ids, 166 .id_table = snd_cs46xx_ids,
167 .probe = snd_card_cs46xx_probe, 167 .probe = snd_card_cs46xx_probe,
168 .remove = __devexit_p(snd_card_cs46xx_remove), 168 .remove = snd_card_cs46xx_remove,
169#ifdef CONFIG_PM_SLEEP 169#ifdef CONFIG_PM_SLEEP
170 .driver = { 170 .driver = {
171 .pm = &snd_cs46xx_pm, 171 .pm = &snd_cs46xx_pm,
diff --git a/sound/pci/cs46xx/cs46xx_lib.c b/sound/pci/cs46xx/cs46xx_lib.c
index a2bb8c91ebe6..1b66efd9b728 100644
--- a/sound/pci/cs46xx/cs46xx_lib.c
+++ b/sound/pci/cs46xx/cs46xx_lib.c
@@ -1590,7 +1590,7 @@ static struct snd_pcm_ops snd_cs46xx_capture_indirect_ops = {
1590#define MAX_PLAYBACK_CHANNELS 1 1590#define MAX_PLAYBACK_CHANNELS 1
1591#endif 1591#endif
1592 1592
1593int __devinit snd_cs46xx_pcm(struct snd_cs46xx *chip, int device, struct snd_pcm ** rpcm) 1593int snd_cs46xx_pcm(struct snd_cs46xx *chip, int device, struct snd_pcm **rpcm)
1594{ 1594{
1595 struct snd_pcm *pcm; 1595 struct snd_pcm *pcm;
1596 int err; 1596 int err;
@@ -1621,7 +1621,8 @@ int __devinit snd_cs46xx_pcm(struct snd_cs46xx *chip, int device, struct snd_pcm
1621 1621
1622 1622
1623#ifdef CONFIG_SND_CS46XX_NEW_DSP 1623#ifdef CONFIG_SND_CS46XX_NEW_DSP
1624int __devinit snd_cs46xx_pcm_rear(struct snd_cs46xx *chip, int device, struct snd_pcm ** rpcm) 1624int snd_cs46xx_pcm_rear(struct snd_cs46xx *chip, int device,
1625 struct snd_pcm **rpcm)
1625{ 1626{
1626 struct snd_pcm *pcm; 1627 struct snd_pcm *pcm;
1627 int err; 1628 int err;
@@ -1650,7 +1651,8 @@ int __devinit snd_cs46xx_pcm_rear(struct snd_cs46xx *chip, int device, struct sn
1650 return 0; 1651 return 0;
1651} 1652}
1652 1653
1653int __devinit snd_cs46xx_pcm_center_lfe(struct snd_cs46xx *chip, int device, struct snd_pcm ** rpcm) 1654int snd_cs46xx_pcm_center_lfe(struct snd_cs46xx *chip, int device,
1655 struct snd_pcm **rpcm)
1654{ 1656{
1655 struct snd_pcm *pcm; 1657 struct snd_pcm *pcm;
1656 int err; 1658 int err;
@@ -1679,7 +1681,8 @@ int __devinit snd_cs46xx_pcm_center_lfe(struct snd_cs46xx *chip, int device, str
1679 return 0; 1681 return 0;
1680} 1682}
1681 1683
1682int __devinit snd_cs46xx_pcm_iec958(struct snd_cs46xx *chip, int device, struct snd_pcm ** rpcm) 1684int snd_cs46xx_pcm_iec958(struct snd_cs46xx *chip, int device,
1685 struct snd_pcm **rpcm)
1683{ 1686{
1684 struct snd_pcm *pcm; 1687 struct snd_pcm *pcm;
1685 int err; 1688 int err;
@@ -2092,7 +2095,7 @@ static int snd_cs46xx_spdif_stream_put(struct snd_kcontrol *kcontrol,
2092#endif /* CONFIG_SND_CS46XX_NEW_DSP */ 2095#endif /* CONFIG_SND_CS46XX_NEW_DSP */
2093 2096
2094 2097
2095static struct snd_kcontrol_new snd_cs46xx_controls[] __devinitdata = { 2098static struct snd_kcontrol_new snd_cs46xx_controls[] = {
2096{ 2099{
2097 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2100 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2098 .name = "DAC Volume", 2101 .name = "DAC Volume",
@@ -2278,7 +2281,7 @@ static void snd_cs46xx_codec_reset (struct snd_ac97 * ac97)
2278} 2281}
2279#endif 2282#endif
2280 2283
2281static int __devinit cs46xx_detect_codec(struct snd_cs46xx *chip, int codec) 2284static int cs46xx_detect_codec(struct snd_cs46xx *chip, int codec)
2282{ 2285{
2283 int idx, err; 2286 int idx, err;
2284 struct snd_ac97_template ac97; 2287 struct snd_ac97_template ac97;
@@ -2311,7 +2314,7 @@ static int __devinit cs46xx_detect_codec(struct snd_cs46xx *chip, int codec)
2311 return -ENXIO; 2314 return -ENXIO;
2312} 2315}
2313 2316
2314int __devinit snd_cs46xx_mixer(struct snd_cs46xx *chip, int spdif_device) 2317int snd_cs46xx_mixer(struct snd_cs46xx *chip, int spdif_device)
2315{ 2318{
2316 struct snd_card *card = chip->card; 2319 struct snd_card *card = chip->card;
2317 struct snd_ctl_elem_id id; 2320 struct snd_ctl_elem_id id;
@@ -2531,7 +2534,7 @@ static struct snd_rawmidi_ops snd_cs46xx_midi_input =
2531 .trigger = snd_cs46xx_midi_input_trigger, 2534 .trigger = snd_cs46xx_midi_input_trigger,
2532}; 2535};
2533 2536
2534int __devinit snd_cs46xx_midi(struct snd_cs46xx *chip, int device, struct snd_rawmidi **rrawmidi) 2537int snd_cs46xx_midi(struct snd_cs46xx *chip, int device, struct snd_rawmidi **rrawmidi)
2535{ 2538{
2536 struct snd_rawmidi *rmidi; 2539 struct snd_rawmidi *rmidi;
2537 int err; 2540 int err;
@@ -2613,7 +2616,7 @@ static int snd_cs46xx_gameport_open(struct gameport *gameport, int mode)
2613 return 0; 2616 return 0;
2614} 2617}
2615 2618
2616int __devinit snd_cs46xx_gameport(struct snd_cs46xx *chip) 2619int snd_cs46xx_gameport(struct snd_cs46xx *chip)
2617{ 2620{
2618 struct gameport *gp; 2621 struct gameport *gp;
2619 2622
@@ -2649,7 +2652,7 @@ static inline void snd_cs46xx_remove_gameport(struct snd_cs46xx *chip)
2649 } 2652 }
2650} 2653}
2651#else 2654#else
2652int __devinit snd_cs46xx_gameport(struct snd_cs46xx *chip) { return -ENOSYS; } 2655int snd_cs46xx_gameport(struct snd_cs46xx *chip) { return -ENOSYS; }
2653static inline void snd_cs46xx_remove_gameport(struct snd_cs46xx *chip) { } 2656static inline void snd_cs46xx_remove_gameport(struct snd_cs46xx *chip) { }
2654#endif /* CONFIG_GAMEPORT */ 2657#endif /* CONFIG_GAMEPORT */
2655 2658
@@ -2674,7 +2677,7 @@ static struct snd_info_entry_ops snd_cs46xx_proc_io_ops = {
2674 .read = snd_cs46xx_io_read, 2677 .read = snd_cs46xx_io_read,
2675}; 2678};
2676 2679
2677static int __devinit snd_cs46xx_proc_init(struct snd_card *card, struct snd_cs46xx *chip) 2680static int snd_cs46xx_proc_init(struct snd_card *card, struct snd_cs46xx *chip)
2678{ 2681{
2679 struct snd_info_entry *entry; 2682 struct snd_info_entry *entry;
2680 int idx; 2683 int idx;
@@ -3061,7 +3064,7 @@ static void cs46xx_enable_stream_irqs(struct snd_cs46xx *chip)
3061 snd_cs46xx_poke(chip, BA1_CIE, tmp); /* capture interrupt enable */ 3064 snd_cs46xx_poke(chip, BA1_CIE, tmp); /* capture interrupt enable */
3062} 3065}
3063 3066
3064int __devinit snd_cs46xx_start_dsp(struct snd_cs46xx *chip) 3067int snd_cs46xx_start_dsp(struct snd_cs46xx *chip)
3065{ 3068{
3066 unsigned int tmp; 3069 unsigned int tmp;
3067 /* 3070 /*
@@ -3477,7 +3480,7 @@ struct cs_card_type
3477 void (*mixer_init)(struct snd_cs46xx *); 3480 void (*mixer_init)(struct snd_cs46xx *);
3478}; 3481};
3479 3482
3480static struct cs_card_type __devinitdata cards[] = { 3483static struct cs_card_type cards[] = {
3481 { 3484 {
3482 .vendor = 0x1489, 3485 .vendor = 0x1489,
3483 .id = 0x7001, 3486 .id = 0x7001,
@@ -3717,10 +3720,10 @@ SIMPLE_DEV_PM_OPS(snd_cs46xx_pm, snd_cs46xx_suspend, snd_cs46xx_resume);
3717/* 3720/*
3718 */ 3721 */
3719 3722
3720int __devinit snd_cs46xx_create(struct snd_card *card, 3723int snd_cs46xx_create(struct snd_card *card,
3721 struct pci_dev * pci, 3724 struct pci_dev *pci,
3722 int external_amp, int thinkpad, 3725 int external_amp, int thinkpad,
3723 struct snd_cs46xx ** rchip) 3726 struct snd_cs46xx **rchip)
3724{ 3727{
3725 struct snd_cs46xx *chip; 3728 struct snd_cs46xx *chip;
3726 int err, idx; 3729 int err, idx;
diff --git a/sound/pci/cs5530.c b/sound/pci/cs5530.c
index d1cca2831575..dace827b45d1 100644
--- a/sound/pci/cs5530.c
+++ b/sound/pci/cs5530.c
@@ -88,13 +88,13 @@ static int snd_cs5530_dev_free(struct snd_device *device)
88 return snd_cs5530_free(chip); 88 return snd_cs5530_free(chip);
89} 89}
90 90
91static void __devexit snd_cs5530_remove(struct pci_dev *pci) 91static void snd_cs5530_remove(struct pci_dev *pci)
92{ 92{
93 snd_card_free(pci_get_drvdata(pci)); 93 snd_card_free(pci_get_drvdata(pci));
94 pci_set_drvdata(pci, NULL); 94 pci_set_drvdata(pci, NULL);
95} 95}
96 96
97static u8 __devinit snd_cs5530_mixer_read(unsigned long io, u8 reg) 97static u8 snd_cs5530_mixer_read(unsigned long io, u8 reg)
98{ 98{
99 outb(reg, io + 4); 99 outb(reg, io + 4);
100 udelay(20); 100 udelay(20);
@@ -103,9 +103,9 @@ static u8 __devinit snd_cs5530_mixer_read(unsigned long io, u8 reg)
103 return reg; 103 return reg;
104} 104}
105 105
106static int __devinit snd_cs5530_create(struct snd_card *card, 106static int snd_cs5530_create(struct snd_card *card,
107 struct pci_dev *pci, 107 struct pci_dev *pci,
108 struct snd_cs5530 **rchip) 108 struct snd_cs5530 **rchip)
109{ 109{
110 struct snd_cs5530 *chip; 110 struct snd_cs5530 *chip;
111 unsigned long sb_base; 111 unsigned long sb_base;
@@ -250,8 +250,8 @@ static int __devinit snd_cs5530_create(struct snd_card *card,
250 return 0; 250 return 0;
251} 251}
252 252
253static int __devinit snd_cs5530_probe(struct pci_dev *pci, 253static int snd_cs5530_probe(struct pci_dev *pci,
254 const struct pci_device_id *pci_id) 254 const struct pci_device_id *pci_id)
255{ 255{
256 static int dev; 256 static int dev;
257 struct snd_card *card; 257 struct snd_card *card;
@@ -294,7 +294,7 @@ static struct pci_driver cs5530_driver = {
294 .name = KBUILD_MODNAME, 294 .name = KBUILD_MODNAME,
295 .id_table = snd_cs5530_ids, 295 .id_table = snd_cs5530_ids,
296 .probe = snd_cs5530_probe, 296 .probe = snd_cs5530_probe,
297 .remove = __devexit_p(snd_cs5530_remove), 297 .remove = snd_cs5530_remove,
298}; 298};
299 299
300module_pci_driver(cs5530_driver); 300module_pci_driver(cs5530_driver);
diff --git a/sound/pci/cs5535audio/cs5535audio.c b/sound/pci/cs5535audio/cs5535audio.c
index 4915efa551fc..7e4b13e2d12a 100644
--- a/sound/pci/cs5535audio/cs5535audio.c
+++ b/sound/pci/cs5535audio/cs5535audio.c
@@ -43,7 +43,7 @@ static char *ac97_quirk;
43module_param(ac97_quirk, charp, 0444); 43module_param(ac97_quirk, charp, 0444);
44MODULE_PARM_DESC(ac97_quirk, "AC'97 board specific workarounds."); 44MODULE_PARM_DESC(ac97_quirk, "AC'97 board specific workarounds.");
45 45
46static struct ac97_quirk ac97_quirks[] __devinitdata = { 46static struct ac97_quirk ac97_quirks[] = {
47#if 0 /* Not yet confirmed if all 5536 boards are HP only */ 47#if 0 /* Not yet confirmed if all 5536 boards are HP only */
48 { 48 {
49 .subvendor = PCI_VENDOR_ID_AMD, 49 .subvendor = PCI_VENDOR_ID_AMD,
@@ -144,7 +144,7 @@ static unsigned short snd_cs5535audio_ac97_codec_read(struct snd_ac97 *ac97,
144 return snd_cs5535audio_codec_read(cs5535au, reg); 144 return snd_cs5535audio_codec_read(cs5535au, reg);
145} 145}
146 146
147static int __devinit snd_cs5535audio_mixer(struct cs5535audio *cs5535au) 147static int snd_cs5535audio_mixer(struct cs5535audio *cs5535au)
148{ 148{
149 struct snd_card *card = cs5535au->card; 149 struct snd_card *card = cs5535au->card;
150 struct snd_ac97_bus *pbus; 150 struct snd_ac97_bus *pbus;
@@ -270,9 +270,9 @@ static int snd_cs5535audio_dev_free(struct snd_device *device)
270 return snd_cs5535audio_free(cs5535au); 270 return snd_cs5535audio_free(cs5535au);
271} 271}
272 272
273static int __devinit snd_cs5535audio_create(struct snd_card *card, 273static int snd_cs5535audio_create(struct snd_card *card,
274 struct pci_dev *pci, 274 struct pci_dev *pci,
275 struct cs5535audio **rcs5535au) 275 struct cs5535audio **rcs5535au)
276{ 276{
277 struct cs5535audio *cs5535au; 277 struct cs5535audio *cs5535au;
278 278
@@ -338,8 +338,8 @@ pcifail:
338 return err; 338 return err;
339} 339}
340 340
341static int __devinit snd_cs5535audio_probe(struct pci_dev *pci, 341static int snd_cs5535audio_probe(struct pci_dev *pci,
342 const struct pci_device_id *pci_id) 342 const struct pci_device_id *pci_id)
343{ 343{
344 static int dev; 344 static int dev;
345 struct snd_card *card; 345 struct snd_card *card;
@@ -387,7 +387,7 @@ probefail_out:
387 return err; 387 return err;
388} 388}
389 389
390static void __devexit snd_cs5535audio_remove(struct pci_dev *pci) 390static void snd_cs5535audio_remove(struct pci_dev *pci)
391{ 391{
392 olpc_quirks_cleanup(); 392 olpc_quirks_cleanup();
393 snd_card_free(pci_get_drvdata(pci)); 393 snd_card_free(pci_get_drvdata(pci));
@@ -398,7 +398,7 @@ static struct pci_driver cs5535audio_driver = {
398 .name = KBUILD_MODNAME, 398 .name = KBUILD_MODNAME,
399 .id_table = snd_cs5535audio_ids, 399 .id_table = snd_cs5535audio_ids,
400 .probe = snd_cs5535audio_probe, 400 .probe = snd_cs5535audio_probe,
401 .remove = __devexit_p(snd_cs5535audio_remove), 401 .remove = snd_cs5535audio_remove,
402#ifdef CONFIG_PM_SLEEP 402#ifdef CONFIG_PM_SLEEP
403 .driver = { 403 .driver = {
404 .pm = &snd_cs5535audio_pm, 404 .pm = &snd_cs5535audio_pm,
diff --git a/sound/pci/cs5535audio/cs5535audio.h b/sound/pci/cs5535audio/cs5535audio.h
index bb3cc641130c..0579daa62215 100644
--- a/sound/pci/cs5535audio/cs5535audio.h
+++ b/sound/pci/cs5535audio/cs5535audio.h
@@ -97,10 +97,10 @@ struct cs5535audio {
97extern const struct dev_pm_ops snd_cs5535audio_pm; 97extern const struct dev_pm_ops snd_cs5535audio_pm;
98 98
99#ifdef CONFIG_OLPC 99#ifdef CONFIG_OLPC
100void __devinit olpc_prequirks(struct snd_card *card, 100void olpc_prequirks(struct snd_card *card,
101 struct snd_ac97_template *ac97); 101 struct snd_ac97_template *ac97);
102int __devinit olpc_quirks(struct snd_card *card, struct snd_ac97 *ac97); 102int olpc_quirks(struct snd_card *card, struct snd_ac97 *ac97);
103void __devexit olpc_quirks_cleanup(void); 103void olpc_quirks_cleanup(void);
104void olpc_analog_input(struct snd_ac97 *ac97, int on); 104void olpc_analog_input(struct snd_ac97 *ac97, int on);
105void olpc_mic_bias(struct snd_ac97 *ac97, int on); 105void olpc_mic_bias(struct snd_ac97 *ac97, int on);
106 106
@@ -133,7 +133,7 @@ static inline void olpc_capture_open(struct snd_ac97 *ac97) { }
133static inline void olpc_capture_close(struct snd_ac97 *ac97) { } 133static inline void olpc_capture_close(struct snd_ac97 *ac97) { }
134#endif 134#endif
135 135
136int __devinit snd_cs5535audio_pcm(struct cs5535audio *cs5535audio); 136int snd_cs5535audio_pcm(struct cs5535audio *cs5535audio);
137 137
138#endif /* __SOUND_CS5535AUDIO_H */ 138#endif /* __SOUND_CS5535AUDIO_H */
139 139
diff --git a/sound/pci/cs5535audio/cs5535audio_olpc.c b/sound/pci/cs5535audio/cs5535audio_olpc.c
index 50da49be9ae5..da1cb9c4c76c 100644
--- a/sound/pci/cs5535audio/cs5535audio_olpc.c
+++ b/sound/pci/cs5535audio/cs5535audio_olpc.c
@@ -114,7 +114,7 @@ static int olpc_mic_put(struct snd_kcontrol *kctl, struct snd_ctl_elem_value *v)
114 return 1; 114 return 1;
115} 115}
116 116
117static struct snd_kcontrol_new olpc_cs5535audio_ctls[] __devinitdata = { 117static struct snd_kcontrol_new olpc_cs5535audio_ctls[] = {
118{ 118{
119 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 119 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
120 .name = "DC Mode Enable", 120 .name = "DC Mode Enable",
@@ -133,8 +133,8 @@ static struct snd_kcontrol_new olpc_cs5535audio_ctls[] __devinitdata = {
133}, 133},
134}; 134};
135 135
136void __devinit olpc_prequirks(struct snd_card *card, 136void olpc_prequirks(struct snd_card *card,
137 struct snd_ac97_template *ac97) 137 struct snd_ac97_template *ac97)
138{ 138{
139 if (!machine_is_olpc()) 139 if (!machine_is_olpc())
140 return; 140 return;
@@ -144,7 +144,7 @@ void __devinit olpc_prequirks(struct snd_card *card,
144 ac97->scaps |= AC97_SCAP_INV_EAPD; 144 ac97->scaps |= AC97_SCAP_INV_EAPD;
145} 145}
146 146
147int __devinit olpc_quirks(struct snd_card *card, struct snd_ac97 *ac97) 147int olpc_quirks(struct snd_card *card, struct snd_ac97 *ac97)
148{ 148{
149 struct snd_ctl_elem_id elem; 149 struct snd_ctl_elem_id elem;
150 int i, err; 150 int i, err;
@@ -185,7 +185,7 @@ int __devinit olpc_quirks(struct snd_card *card, struct snd_ac97 *ac97)
185 return 0; 185 return 0;
186} 186}
187 187
188void __devexit olpc_quirks_cleanup(void) 188void olpc_quirks_cleanup(void)
189{ 189{
190 gpio_free(OLPC_GPIO_MIC_AC); 190 gpio_free(OLPC_GPIO_MIC_AC);
191} 191}
diff --git a/sound/pci/cs5535audio/cs5535audio_pcm.c b/sound/pci/cs5535audio/cs5535audio_pcm.c
index dbf94b189e75..9ab01a7047cf 100644
--- a/sound/pci/cs5535audio/cs5535audio_pcm.c
+++ b/sound/pci/cs5535audio/cs5535audio_pcm.c
@@ -422,7 +422,7 @@ static struct cs5535audio_dma_ops snd_cs5535audio_capture_dma_ops = {
422 .read_dma_pntr = cs5535audio_capture_read_dma_pntr, 422 .read_dma_pntr = cs5535audio_capture_read_dma_pntr,
423}; 423};
424 424
425int __devinit snd_cs5535audio_pcm(struct cs5535audio *cs5535au) 425int snd_cs5535audio_pcm(struct cs5535audio *cs5535au)
426{ 426{
427 struct snd_pcm *pcm; 427 struct snd_pcm *pcm;
428 int err; 428 int err;
diff --git a/sound/pci/ctxfi/ctatc.c b/sound/pci/ctxfi/ctatc.c
index a2f997a9977a..b5fa583a239a 100644
--- a/sound/pci/ctxfi/ctatc.c
+++ b/sound/pci/ctxfi/ctatc.c
@@ -38,7 +38,7 @@
38 | (0x10 << 16) \ 38 | (0x10 << 16) \
39 | ((IEC958_AES3_CON_FS_48000) << 24)) 39 | ((IEC958_AES3_CON_FS_48000) << 24))
40 40
41static struct snd_pci_quirk __devinitdata subsys_20k1_list[] = { 41static struct snd_pci_quirk subsys_20k1_list[] = {
42 SND_PCI_QUIRK(PCI_VENDOR_ID_CREATIVE, 0x0022, "SB055x", CTSB055X), 42 SND_PCI_QUIRK(PCI_VENDOR_ID_CREATIVE, 0x0022, "SB055x", CTSB055X),
43 SND_PCI_QUIRK(PCI_VENDOR_ID_CREATIVE, 0x002f, "SB055x", CTSB055X), 43 SND_PCI_QUIRK(PCI_VENDOR_ID_CREATIVE, 0x002f, "SB055x", CTSB055X),
44 SND_PCI_QUIRK(PCI_VENDOR_ID_CREATIVE, 0x0029, "SB073x", CTSB073X), 44 SND_PCI_QUIRK(PCI_VENDOR_ID_CREATIVE, 0x0029, "SB073x", CTSB073X),
@@ -48,7 +48,7 @@ static struct snd_pci_quirk __devinitdata subsys_20k1_list[] = {
48 { } /* terminator */ 48 { } /* terminator */
49}; 49};
50 50
51static struct snd_pci_quirk __devinitdata subsys_20k2_list[] = { 51static struct snd_pci_quirk subsys_20k2_list[] = {
52 SND_PCI_QUIRK(PCI_VENDOR_ID_CREATIVE, PCI_SUBDEVICE_ID_CREATIVE_SB0760, 52 SND_PCI_QUIRK(PCI_VENDOR_ID_CREATIVE, PCI_SUBDEVICE_ID_CREATIVE_SB0760,
53 "SB0760", CTSB0760), 53 "SB0760", CTSB0760),
54 SND_PCI_QUIRK(PCI_VENDOR_ID_CREATIVE, PCI_SUBDEVICE_ID_CREATIVE_SB1270, 54 SND_PCI_QUIRK(PCI_VENDOR_ID_CREATIVE, PCI_SUBDEVICE_ID_CREATIVE_SB1270,
@@ -1249,7 +1249,7 @@ static int atc_dev_free(struct snd_device *dev)
1249 return ct_atc_destroy(atc); 1249 return ct_atc_destroy(atc);
1250} 1250}
1251 1251
1252static int __devinit atc_identify_card(struct ct_atc *atc, unsigned int ssid) 1252static int atc_identify_card(struct ct_atc *atc, unsigned int ssid)
1253{ 1253{
1254 const struct snd_pci_quirk *p; 1254 const struct snd_pci_quirk *p;
1255 const struct snd_pci_quirk *list; 1255 const struct snd_pci_quirk *list;
@@ -1296,7 +1296,7 @@ static int __devinit atc_identify_card(struct ct_atc *atc, unsigned int ssid)
1296 return 0; 1296 return 0;
1297} 1297}
1298 1298
1299int __devinit ct_atc_create_alsa_devs(struct ct_atc *atc) 1299int ct_atc_create_alsa_devs(struct ct_atc *atc)
1300{ 1300{
1301 enum CTALSADEVS i; 1301 enum CTALSADEVS i;
1302 int err; 1302 int err;
@@ -1319,7 +1319,7 @@ int __devinit ct_atc_create_alsa_devs(struct ct_atc *atc)
1319 return 0; 1319 return 0;
1320} 1320}
1321 1321
1322static int __devinit atc_create_hw_devs(struct ct_atc *atc) 1322static int atc_create_hw_devs(struct ct_atc *atc)
1323{ 1323{
1324 struct hw *hw; 1324 struct hw *hw;
1325 struct card_conf info = {0}; 1325 struct card_conf info = {0};
@@ -1614,7 +1614,7 @@ static int atc_resume(struct ct_atc *atc)
1614} 1614}
1615#endif 1615#endif
1616 1616
1617static struct ct_atc atc_preset __devinitdata = { 1617static struct ct_atc atc_preset = {
1618 .map_audio_buffer = ct_map_audio_buffer, 1618 .map_audio_buffer = ct_map_audio_buffer,
1619 .unmap_audio_buffer = ct_unmap_audio_buffer, 1619 .unmap_audio_buffer = ct_unmap_audio_buffer,
1620 .pcm_playback_prepare = atc_pcm_playback_prepare, 1620 .pcm_playback_prepare = atc_pcm_playback_prepare,
@@ -1665,10 +1665,10 @@ static struct ct_atc atc_preset __devinitdata = {
1665 * Returns 0 if succeeds, or negative error code if fails. 1665 * Returns 0 if succeeds, or negative error code if fails.
1666 */ 1666 */
1667 1667
1668int __devinit ct_atc_create(struct snd_card *card, struct pci_dev *pci, 1668int ct_atc_create(struct snd_card *card, struct pci_dev *pci,
1669 unsigned int rsr, unsigned int msr, 1669 unsigned int rsr, unsigned int msr,
1670 int chip_type, unsigned int ssid, 1670 int chip_type, unsigned int ssid,
1671 struct ct_atc **ratc) 1671 struct ct_atc **ratc)
1672{ 1672{
1673 struct ct_atc *atc; 1673 struct ct_atc *atc;
1674 static struct snd_device_ops ops = { 1674 static struct snd_device_ops ops = {
diff --git a/sound/pci/ctxfi/ctatc.h b/sound/pci/ctxfi/ctatc.h
index 69b51f9d345e..5f11ca22fcde 100644
--- a/sound/pci/ctxfi/ctatc.h
+++ b/sound/pci/ctxfi/ctatc.h
@@ -152,9 +152,9 @@ struct ct_atc {
152}; 152};
153 153
154 154
155int __devinit ct_atc_create(struct snd_card *card, struct pci_dev *pci, 155int ct_atc_create(struct snd_card *card, struct pci_dev *pci,
156 unsigned int rsr, unsigned int msr, int chip_type, 156 unsigned int rsr, unsigned int msr, int chip_type,
157 unsigned int subsysid, struct ct_atc **ratc); 157 unsigned int subsysid, struct ct_atc **ratc);
158int __devinit ct_atc_create_alsa_devs(struct ct_atc *atc); 158int ct_atc_create_alsa_devs(struct ct_atc *atc);
159 159
160#endif /* CTATC_H */ 160#endif /* CTATC_H */
diff --git a/sound/pci/ctxfi/cthardware.c b/sound/pci/ctxfi/cthardware.c
index 8e64f4862e85..110b8ace6d8a 100644
--- a/sound/pci/ctxfi/cthardware.c
+++ b/sound/pci/ctxfi/cthardware.c
@@ -20,8 +20,8 @@
20#include "cthw20k2.h" 20#include "cthw20k2.h"
21#include <linux/bug.h> 21#include <linux/bug.h>
22 22
23int __devinit create_hw_obj(struct pci_dev *pci, enum CHIPTYP chip_type, 23int create_hw_obj(struct pci_dev *pci, enum CHIPTYP chip_type,
24 enum CTCARDS model, struct hw **rhw) 24 enum CTCARDS model, struct hw **rhw)
25{ 25{
26 int err; 26 int err;
27 27
diff --git a/sound/pci/ctxfi/cthw20k1.c b/sound/pci/ctxfi/cthw20k1.c
index 4507f7088b24..6ac40beb49da 100644
--- a/sound/pci/ctxfi/cthw20k1.c
+++ b/sound/pci/ctxfi/cthw20k1.c
@@ -2171,7 +2171,7 @@ static void hw_write_pci(struct hw *hw, u32 reg, u32 data)
2171 &container_of(hw, struct hw20k1, hw)->reg_pci_lock, flags); 2171 &container_of(hw, struct hw20k1, hw)->reg_pci_lock, flags);
2172} 2172}
2173 2173
2174static struct hw ct20k1_preset __devinitdata = { 2174static struct hw ct20k1_preset = {
2175 .irq = -1, 2175 .irq = -1,
2176 2176
2177 .card_init = hw_card_init, 2177 .card_init = hw_card_init,
@@ -2275,7 +2275,7 @@ static struct hw ct20k1_preset __devinitdata = {
2275 .get_wc = get_wc, 2275 .get_wc = get_wc,
2276}; 2276};
2277 2277
2278int __devinit create_20k1_hw_obj(struct hw **rhw) 2278int create_20k1_hw_obj(struct hw **rhw)
2279{ 2279{
2280 struct hw20k1 *hw20k1; 2280 struct hw20k1 *hw20k1;
2281 2281
diff --git a/sound/pci/ctxfi/cthw20k2.c b/sound/pci/ctxfi/cthw20k2.c
index b9c9349058bc..b1438861d38a 100644
--- a/sound/pci/ctxfi/cthw20k2.c
+++ b/sound/pci/ctxfi/cthw20k2.c
@@ -2237,7 +2237,7 @@ static void hw_write_20kx(struct hw *hw, u32 reg, u32 data)
2237 writel(data, (void *)(hw->mem_base + reg)); 2237 writel(data, (void *)(hw->mem_base + reg));
2238} 2238}
2239 2239
2240static struct hw ct20k2_preset __devinitdata = { 2240static struct hw ct20k2_preset = {
2241 .irq = -1, 2241 .irq = -1,
2242 2242
2243 .card_init = hw_card_init, 2243 .card_init = hw_card_init,
@@ -2345,7 +2345,7 @@ static struct hw ct20k2_preset __devinitdata = {
2345 .get_wc = get_wc, 2345 .get_wc = get_wc,
2346}; 2346};
2347 2347
2348int __devinit create_20k2_hw_obj(struct hw **rhw) 2348int create_20k2_hw_obj(struct hw **rhw)
2349{ 2349{
2350 struct hw20k2 *hw20k2; 2350 struct hw20k2 *hw20k2;
2351 2351
diff --git a/sound/pci/ctxfi/xfi.c b/sound/pci/ctxfi/xfi.c
index 07c07d752fd8..d01ffcb2b2f5 100644
--- a/sound/pci/ctxfi/xfi.c
+++ b/sound/pci/ctxfi/xfi.c
@@ -56,7 +56,7 @@ static DEFINE_PCI_DEVICE_TABLE(ct_pci_dev_ids) = {
56}; 56};
57MODULE_DEVICE_TABLE(pci, ct_pci_dev_ids); 57MODULE_DEVICE_TABLE(pci, ct_pci_dev_ids);
58 58
59static int __devinit 59static int
60ct_card_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) 60ct_card_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
61{ 61{
62 static int dev; 62 static int dev;
@@ -119,7 +119,7 @@ error:
119 return err; 119 return err;
120} 120}
121 121
122static void __devexit ct_card_remove(struct pci_dev *pci) 122static void ct_card_remove(struct pci_dev *pci)
123{ 123{
124 snd_card_free(pci_get_drvdata(pci)); 124 snd_card_free(pci_get_drvdata(pci));
125 pci_set_drvdata(pci, NULL); 125 pci_set_drvdata(pci, NULL);
@@ -152,7 +152,7 @@ static struct pci_driver ct_driver = {
152 .name = KBUILD_MODNAME, 152 .name = KBUILD_MODNAME,
153 .id_table = ct_pci_dev_ids, 153 .id_table = ct_pci_dev_ids,
154 .probe = ct_card_probe, 154 .probe = ct_card_probe,
155 .remove = __devexit_p(ct_card_remove), 155 .remove = ct_card_remove,
156 .driver = { 156 .driver = {
157 .pm = CT_CARD_PM_OPS, 157 .pm = CT_CARD_PM_OPS,
158 }, 158 },
diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c
index abb0b86c41c9..760cbff53210 100644
--- a/sound/pci/echoaudio/echoaudio.c
+++ b/sound/pci/echoaudio/echoaudio.c
@@ -907,7 +907,7 @@ static int snd_echo_preallocate_pages(struct snd_pcm *pcm, struct device *dev)
907 907
908 908
909/*<--snd_echo_probe() */ 909/*<--snd_echo_probe() */
910static int __devinit snd_echo_new_pcm(struct echoaudio *chip) 910static int snd_echo_new_pcm(struct echoaudio *chip)
911{ 911{
912 struct snd_pcm *pcm; 912 struct snd_pcm *pcm;
913 int err; 913 int err;
@@ -1050,7 +1050,7 @@ static int snd_echo_output_gain_put(struct snd_kcontrol *kcontrol,
1050 1050
1051#ifdef ECHOCARD_HAS_LINE_OUT_GAIN 1051#ifdef ECHOCARD_HAS_LINE_OUT_GAIN
1052/* On the Mia this one controls the line-out volume */ 1052/* On the Mia this one controls the line-out volume */
1053static struct snd_kcontrol_new snd_echo_line_output_gain __devinitdata = { 1053static struct snd_kcontrol_new snd_echo_line_output_gain = {
1054 .name = "Line Playback Volume", 1054 .name = "Line Playback Volume",
1055 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1055 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1056 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | 1056 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE |
@@ -1061,7 +1061,7 @@ static struct snd_kcontrol_new snd_echo_line_output_gain __devinitdata = {
1061 .tlv = {.p = db_scale_output_gain}, 1061 .tlv = {.p = db_scale_output_gain},
1062}; 1062};
1063#else 1063#else
1064static struct snd_kcontrol_new snd_echo_pcm_output_gain __devinitdata = { 1064static struct snd_kcontrol_new snd_echo_pcm_output_gain = {
1065 .name = "PCM Playback Volume", 1065 .name = "PCM Playback Volume",
1066 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1066 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1067 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ, 1067 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ,
@@ -1131,7 +1131,7 @@ static int snd_echo_input_gain_put(struct snd_kcontrol *kcontrol,
1131 1131
1132static const DECLARE_TLV_DB_SCALE(db_scale_input_gain, -2500, 50, 0); 1132static const DECLARE_TLV_DB_SCALE(db_scale_input_gain, -2500, 50, 0);
1133 1133
1134static struct snd_kcontrol_new snd_echo_line_input_gain __devinitdata = { 1134static struct snd_kcontrol_new snd_echo_line_input_gain = {
1135 .name = "Line Capture Volume", 1135 .name = "Line Capture Volume",
1136 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1136 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1137 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ, 1137 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ,
@@ -1195,7 +1195,7 @@ static int snd_echo_output_nominal_put(struct snd_kcontrol *kcontrol,
1195 return changed; 1195 return changed;
1196} 1196}
1197 1197
1198static struct snd_kcontrol_new snd_echo_output_nominal_level __devinitdata = { 1198static struct snd_kcontrol_new snd_echo_output_nominal_level = {
1199 .name = "Line Playback Switch (-10dBV)", 1199 .name = "Line Playback Switch (-10dBV)",
1200 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1200 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1201 .info = snd_echo_output_nominal_info, 1201 .info = snd_echo_output_nominal_info,
@@ -1261,7 +1261,7 @@ static int snd_echo_input_nominal_put(struct snd_kcontrol *kcontrol,
1261 return changed; 1261 return changed;
1262} 1262}
1263 1263
1264static struct snd_kcontrol_new snd_echo_intput_nominal_level __devinitdata = { 1264static struct snd_kcontrol_new snd_echo_intput_nominal_level = {
1265 .name = "Line Capture Switch (-10dBV)", 1265 .name = "Line Capture Switch (-10dBV)",
1266 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1266 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1267 .info = snd_echo_input_nominal_info, 1267 .info = snd_echo_input_nominal_info,
@@ -1327,7 +1327,7 @@ static int snd_echo_mixer_put(struct snd_kcontrol *kcontrol,
1327 return changed; 1327 return changed;
1328} 1328}
1329 1329
1330static struct snd_kcontrol_new snd_echo_monitor_mixer __devinitdata = { 1330static struct snd_kcontrol_new snd_echo_monitor_mixer = {
1331 .name = "Monitor Mixer Volume", 1331 .name = "Monitor Mixer Volume",
1332 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1332 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1333 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ, 1333 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ,
@@ -1395,7 +1395,7 @@ static int snd_echo_vmixer_put(struct snd_kcontrol *kcontrol,
1395 return changed; 1395 return changed;
1396} 1396}
1397 1397
1398static struct snd_kcontrol_new snd_echo_vmixer __devinitdata = { 1398static struct snd_kcontrol_new snd_echo_vmixer = {
1399 .name = "VMixer Volume", 1399 .name = "VMixer Volume",
1400 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1400 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1401 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ, 1401 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_TLV_READ,
@@ -1490,7 +1490,7 @@ static int snd_echo_digital_mode_put(struct snd_kcontrol *kcontrol,
1490 return changed; 1490 return changed;
1491} 1491}
1492 1492
1493static struct snd_kcontrol_new snd_echo_digital_mode_switch __devinitdata = { 1493static struct snd_kcontrol_new snd_echo_digital_mode_switch = {
1494 .name = "Digital mode Switch", 1494 .name = "Digital mode Switch",
1495 .iface = SNDRV_CTL_ELEM_IFACE_CARD, 1495 .iface = SNDRV_CTL_ELEM_IFACE_CARD,
1496 .info = snd_echo_digital_mode_info, 1496 .info = snd_echo_digital_mode_info,
@@ -1547,7 +1547,7 @@ static int snd_echo_spdif_mode_put(struct snd_kcontrol *kcontrol,
1547 return 0; 1547 return 0;
1548} 1548}
1549 1549
1550static struct snd_kcontrol_new snd_echo_spdif_mode_switch __devinitdata = { 1550static struct snd_kcontrol_new snd_echo_spdif_mode_switch = {
1551 .name = "S/PDIF mode Switch", 1551 .name = "S/PDIF mode Switch",
1552 .iface = SNDRV_CTL_ELEM_IFACE_CARD, 1552 .iface = SNDRV_CTL_ELEM_IFACE_CARD,
1553 .info = snd_echo_spdif_mode_info, 1553 .info = snd_echo_spdif_mode_info,
@@ -1626,7 +1626,7 @@ static int snd_echo_clock_source_put(struct snd_kcontrol *kcontrol,
1626 return changed; 1626 return changed;
1627} 1627}
1628 1628
1629static struct snd_kcontrol_new snd_echo_clock_source_switch __devinitdata = { 1629static struct snd_kcontrol_new snd_echo_clock_source_switch = {
1630 .name = "Sample Clock Source", 1630 .name = "Sample Clock Source",
1631 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 1631 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
1632 .info = snd_echo_clock_source_info, 1632 .info = snd_echo_clock_source_info,
@@ -1669,7 +1669,7 @@ static int snd_echo_phantom_power_put(struct snd_kcontrol *kcontrol,
1669 return changed; 1669 return changed;
1670} 1670}
1671 1671
1672static struct snd_kcontrol_new snd_echo_phantom_power_switch __devinitdata = { 1672static struct snd_kcontrol_new snd_echo_phantom_power_switch = {
1673 .name = "Phantom power Switch", 1673 .name = "Phantom power Switch",
1674 .iface = SNDRV_CTL_ELEM_IFACE_CARD, 1674 .iface = SNDRV_CTL_ELEM_IFACE_CARD,
1675 .info = snd_echo_phantom_power_info, 1675 .info = snd_echo_phantom_power_info,
@@ -1712,7 +1712,7 @@ static int snd_echo_automute_put(struct snd_kcontrol *kcontrol,
1712 return changed; 1712 return changed;
1713} 1713}
1714 1714
1715static struct snd_kcontrol_new snd_echo_automute_switch __devinitdata = { 1715static struct snd_kcontrol_new snd_echo_automute_switch = {
1716 .name = "Digital Capture Switch (automute)", 1716 .name = "Digital Capture Switch (automute)",
1717 .iface = SNDRV_CTL_ELEM_IFACE_CARD, 1717 .iface = SNDRV_CTL_ELEM_IFACE_CARD,
1718 .info = snd_echo_automute_info, 1718 .info = snd_echo_automute_info,
@@ -1739,7 +1739,7 @@ static int snd_echo_vumeters_switch_put(struct snd_kcontrol *kcontrol,
1739 return 1; 1739 return 1;
1740} 1740}
1741 1741
1742static struct snd_kcontrol_new snd_echo_vumeters_switch __devinitdata = { 1742static struct snd_kcontrol_new snd_echo_vumeters_switch = {
1743 .name = "VU-meters Switch", 1743 .name = "VU-meters Switch",
1744 .iface = SNDRV_CTL_ELEM_IFACE_CARD, 1744 .iface = SNDRV_CTL_ELEM_IFACE_CARD,
1745 .access = SNDRV_CTL_ELEM_ACCESS_WRITE, 1745 .access = SNDRV_CTL_ELEM_ACCESS_WRITE,
@@ -1780,7 +1780,7 @@ static int snd_echo_vumeters_get(struct snd_kcontrol *kcontrol,
1780 return 0; 1780 return 0;
1781} 1781}
1782 1782
1783static struct snd_kcontrol_new snd_echo_vumeters __devinitdata = { 1783static struct snd_kcontrol_new snd_echo_vumeters = {
1784 .name = "VU-meters", 1784 .name = "VU-meters",
1785 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1785 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1786 .access = SNDRV_CTL_ELEM_ACCESS_READ | 1786 .access = SNDRV_CTL_ELEM_ACCESS_READ |
@@ -1836,7 +1836,7 @@ static int snd_echo_channels_info_get(struct snd_kcontrol *kcontrol,
1836 return 0; 1836 return 0;
1837} 1837}
1838 1838
1839static struct snd_kcontrol_new snd_echo_channels_info __devinitdata = { 1839static struct snd_kcontrol_new snd_echo_channels_info = {
1840 .name = "Channels info", 1840 .name = "Channels info",
1841 .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, 1841 .iface = SNDRV_CTL_ELEM_IFACE_HWDEP,
1842 .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, 1842 .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE,
@@ -1940,9 +1940,9 @@ static int snd_echo_dev_free(struct snd_device *device)
1940 1940
1941 1941
1942/* <--snd_echo_probe() */ 1942/* <--snd_echo_probe() */
1943static __devinit int snd_echo_create(struct snd_card *card, 1943static int snd_echo_create(struct snd_card *card,
1944 struct pci_dev *pci, 1944 struct pci_dev *pci,
1945 struct echoaudio **rchip) 1945 struct echoaudio **rchip)
1946{ 1946{
1947 struct echoaudio *chip; 1947 struct echoaudio *chip;
1948 int err; 1948 int err;
@@ -2040,8 +2040,8 @@ static __devinit int snd_echo_create(struct snd_card *card,
2040 2040
2041 2041
2042/* constructor */ 2042/* constructor */
2043static int __devinit snd_echo_probe(struct pci_dev *pci, 2043static int snd_echo_probe(struct pci_dev *pci,
2044 const struct pci_device_id *pci_id) 2044 const struct pci_device_id *pci_id)
2045{ 2045{
2046 static int dev; 2046 static int dev;
2047 struct snd_card *card; 2047 struct snd_card *card;
@@ -2316,7 +2316,7 @@ static SIMPLE_DEV_PM_OPS(snd_echo_pm, snd_echo_suspend, snd_echo_resume);
2316#endif /* CONFIG_PM_SLEEP */ 2316#endif /* CONFIG_PM_SLEEP */
2317 2317
2318 2318
2319static void __devexit snd_echo_remove(struct pci_dev *pci) 2319static void snd_echo_remove(struct pci_dev *pci)
2320{ 2320{
2321 struct echoaudio *chip; 2321 struct echoaudio *chip;
2322 2322
@@ -2337,7 +2337,7 @@ static struct pci_driver echo_driver = {
2337 .name = KBUILD_MODNAME, 2337 .name = KBUILD_MODNAME,
2338 .id_table = snd_echo_ids, 2338 .id_table = snd_echo_ids,
2339 .probe = snd_echo_probe, 2339 .probe = snd_echo_probe,
2340 .remove = __devexit_p(snd_echo_remove), 2340 .remove = snd_echo_remove,
2341 .driver = { 2341 .driver = {
2342 .pm = SND_ECHO_PM_OPS, 2342 .pm = SND_ECHO_PM_OPS,
2343 }, 2343 },
diff --git a/sound/pci/echoaudio/echoaudio.h b/sound/pci/echoaudio/echoaudio.h
index e158369f5faa..b86b88da81cd 100644
--- a/sound/pci/echoaudio/echoaudio.h
+++ b/sound/pci/echoaudio/echoaudio.h
@@ -475,8 +475,8 @@ static int enable_midi_input(struct echoaudio *chip, char enable);
475static void snd_echo_midi_output_trigger( 475static void snd_echo_midi_output_trigger(
476 struct snd_rawmidi_substream *substream, int up); 476 struct snd_rawmidi_substream *substream, int up);
477static int midi_service_irq(struct echoaudio *chip); 477static int midi_service_irq(struct echoaudio *chip);
478static int __devinit snd_echo_midi_create(struct snd_card *card, 478static int snd_echo_midi_create(struct snd_card *card,
479 struct echoaudio *chip); 479 struct echoaudio *chip);
480#endif 480#endif
481 481
482 482
diff --git a/sound/pci/echoaudio/midi.c b/sound/pci/echoaudio/midi.c
index a953d142cb4b..abfd51c2530e 100644
--- a/sound/pci/echoaudio/midi.c
+++ b/sound/pci/echoaudio/midi.c
@@ -307,8 +307,8 @@ static struct snd_rawmidi_ops snd_echo_midi_output = {
307 307
308 308
309/* <--snd_echo_probe() */ 309/* <--snd_echo_probe() */
310static int __devinit snd_echo_midi_create(struct snd_card *card, 310static int snd_echo_midi_create(struct snd_card *card,
311 struct echoaudio *chip) 311 struct echoaudio *chip)
312{ 312{
313 int err; 313 int err;
314 314
diff --git a/sound/pci/emu10k1/emu10k1.c b/sound/pci/emu10k1/emu10k1.c
index b7c1875ba90e..8c5010f7889c 100644
--- a/sound/pci/emu10k1/emu10k1.c
+++ b/sound/pci/emu10k1/emu10k1.c
@@ -99,8 +99,8 @@ static DEFINE_PCI_DEVICE_TABLE(snd_emu10k1_ids) = {
99 99
100MODULE_DEVICE_TABLE(pci, snd_emu10k1_ids); 100MODULE_DEVICE_TABLE(pci, snd_emu10k1_ids);
101 101
102static int __devinit snd_card_emu10k1_probe(struct pci_dev *pci, 102static int snd_card_emu10k1_probe(struct pci_dev *pci,
103 const struct pci_device_id *pci_id) 103 const struct pci_device_id *pci_id)
104{ 104{
105 static int dev; 105 static int dev;
106 struct snd_card *card; 106 struct snd_card *card;
@@ -199,7 +199,7 @@ static int __devinit snd_card_emu10k1_probe(struct pci_dev *pci,
199 return err; 199 return err;
200} 200}
201 201
202static void __devexit snd_card_emu10k1_remove(struct pci_dev *pci) 202static void snd_card_emu10k1_remove(struct pci_dev *pci)
203{ 203{
204 snd_card_free(pci_get_drvdata(pci)); 204 snd_card_free(pci_get_drvdata(pci));
205 pci_set_drvdata(pci, NULL); 205 pci_set_drvdata(pci, NULL);
@@ -215,6 +215,8 @@ static int snd_emu10k1_suspend(struct device *dev)
215 215
216 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); 216 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
217 217
218 emu->suspend = 1;
219
218 snd_pcm_suspend_all(emu->pcm); 220 snd_pcm_suspend_all(emu->pcm);
219 snd_pcm_suspend_all(emu->pcm_mic); 221 snd_pcm_suspend_all(emu->pcm_mic);
220 snd_pcm_suspend_all(emu->pcm_efx); 222 snd_pcm_suspend_all(emu->pcm_efx);
@@ -260,6 +262,8 @@ static int snd_emu10k1_resume(struct device *dev)
260 if (emu->card_capabilities->ca0151_chip) 262 if (emu->card_capabilities->ca0151_chip)
261 snd_p16v_resume(emu); 263 snd_p16v_resume(emu);
262 264
265 emu->suspend = 0;
266
263 snd_power_change_state(card, SNDRV_CTL_POWER_D0); 267 snd_power_change_state(card, SNDRV_CTL_POWER_D0);
264 return 0; 268 return 0;
265} 269}
@@ -274,7 +278,7 @@ static struct pci_driver emu10k1_driver = {
274 .name = KBUILD_MODNAME, 278 .name = KBUILD_MODNAME,
275 .id_table = snd_emu10k1_ids, 279 .id_table = snd_emu10k1_ids,
276 .probe = snd_card_emu10k1_probe, 280 .probe = snd_card_emu10k1_probe,
277 .remove = __devexit_p(snd_card_emu10k1_remove), 281 .remove = snd_card_emu10k1_remove,
278 .driver = { 282 .driver = {
279 .pm = SND_EMU10K1_PM_OPS, 283 .pm = SND_EMU10K1_PM_OPS,
280 }, 284 },
diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c
index c21adb6ef1d5..a7c296a36a17 100644
--- a/sound/pci/emu10k1/emu10k1_main.c
+++ b/sound/pci/emu10k1/emu10k1_main.c
@@ -657,22 +657,17 @@ static int snd_emu10k1_cardbus_init(struct snd_emu10k1 *emu)
657 return 0; 657 return 0;
658} 658}
659 659
660static int snd_emu1010_load_firmware(struct snd_emu10k1 *emu, const char *filename) 660static int snd_emu1010_load_firmware(struct snd_emu10k1 *emu)
661{ 661{
662 int err;
663 int n, i; 662 int n, i;
664 int reg; 663 int reg;
665 int value; 664 int value;
666 unsigned int write_post; 665 unsigned int write_post;
667 unsigned long flags; 666 unsigned long flags;
668 const struct firmware *fw_entry; 667 const struct firmware *fw_entry = emu->firmware;
669 668
670 err = request_firmware(&fw_entry, filename, &emu->pci->dev); 669 if (!fw_entry)
671 if (err != 0) { 670 return -EIO;
672 snd_printk(KERN_ERR "firmware: %s not found. Err = %d\n", filename, err);
673 return err;
674 }
675 snd_printk(KERN_INFO "firmware size = 0x%zx\n", fw_entry->size);
676 671
677 /* The FPGA is a Xilinx Spartan IIE XC2S50E */ 672 /* The FPGA is a Xilinx Spartan IIE XC2S50E */
678 /* GPIO7 -> FPGA PGMN 673 /* GPIO7 -> FPGA PGMN
@@ -705,7 +700,6 @@ static int snd_emu1010_load_firmware(struct snd_emu10k1 *emu, const char *filena
705 write_post = inl(emu->port + A_IOCFG); 700 write_post = inl(emu->port + A_IOCFG);
706 spin_unlock_irqrestore(&emu->emu_lock, flags); 701 spin_unlock_irqrestore(&emu->emu_lock, flags);
707 702
708 release_firmware(fw_entry);
709 return 0; 703 return 0;
710} 704}
711 705
@@ -720,6 +714,10 @@ static int emu1010_firmware_thread(void *data)
720 msleep_interruptible(1000); 714 msleep_interruptible(1000);
721 if (kthread_should_stop()) 715 if (kthread_should_stop())
722 break; 716 break;
717#ifdef CONFIG_PM_SLEEP
718 if (emu->suspend)
719 continue;
720#endif
723 snd_emu1010_fpga_read(emu, EMU_HANA_IRQ_STATUS, &tmp); /* IRQ Status */ 721 snd_emu1010_fpga_read(emu, EMU_HANA_IRQ_STATUS, &tmp); /* IRQ Status */
724 snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, &reg); /* OPTIONS: Which cards are attached to the EMU */ 722 snd_emu1010_fpga_read(emu, EMU_HANA_OPTION_CARDS, &reg); /* OPTIONS: Which cards are attached to the EMU */
725 if (reg & EMU_HANA_OPTION_DOCK_OFFLINE) { 723 if (reg & EMU_HANA_OPTION_DOCK_OFFLINE) {
@@ -727,22 +725,9 @@ static int emu1010_firmware_thread(void *data)
727 /* Return to Audio Dock programming mode */ 725 /* Return to Audio Dock programming mode */
728 snd_printk(KERN_INFO "emu1010: Loading Audio Dock Firmware\n"); 726 snd_printk(KERN_INFO "emu1010: Loading Audio Dock Firmware\n");
729 snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG, EMU_HANA_FPGA_CONFIG_AUDIODOCK); 727 snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG, EMU_HANA_FPGA_CONFIG_AUDIODOCK);
730 if (emu->card_capabilities->emu_model == 728 err = snd_emu1010_load_firmware(emu);
731 EMU_MODEL_EMU1010) { 729 if (err != 0)
732 err = snd_emu1010_load_firmware(emu, DOCK_FILENAME); 730 continue;
733 if (err != 0)
734 continue;
735 } else if (emu->card_capabilities->emu_model ==
736 EMU_MODEL_EMU1010B) {
737 err = snd_emu1010_load_firmware(emu, MICRO_DOCK_FILENAME);
738 if (err != 0)
739 continue;
740 } else if (emu->card_capabilities->emu_model ==
741 EMU_MODEL_EMU1616) {
742 err = snd_emu1010_load_firmware(emu, MICRO_DOCK_FILENAME);
743 if (err != 0)
744 continue;
745 }
746 731
747 snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG, 0); 732 snd_emu1010_fpga_write(emu, EMU_HANA_FPGA_CONFIG, 0);
748 snd_emu1010_fpga_read(emu, EMU_HANA_IRQ_STATUS, &reg); 733 snd_emu1010_fpga_read(emu, EMU_HANA_IRQ_STATUS, &reg);
@@ -807,7 +792,6 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 *emu)
807 unsigned int i; 792 unsigned int i;
808 u32 tmp, tmp2, reg; 793 u32 tmp, tmp2, reg;
809 int err; 794 int err;
810 const char *filename = NULL;
811 795
812 snd_printk(KERN_INFO "emu1010: Special config.\n"); 796 snd_printk(KERN_INFO "emu1010: Special config.\n");
813 /* AC97 2.1, Any 16Meg of 4Gig address, Auto-Mute, EMU32 Slave, 797 /* AC97 2.1, Any 16Meg of 4Gig address, Auto-Mute, EMU32 Slave,
@@ -849,31 +833,33 @@ static int snd_emu10k1_emu1010_init(struct snd_emu10k1 *emu)
849 return -ENODEV; 833 return -ENODEV;
850 } 834 }
851 snd_printk(KERN_INFO "emu1010: EMU_HANA_ID = 0x%x\n", reg); 835 snd_printk(KERN_INFO "emu1010: EMU_HANA_ID = 0x%x\n", reg);
852 switch (emu->card_capabilities->emu_model) { 836
853 case EMU_MODEL_EMU1010: 837 if (!emu->firmware) {
854 filename = HANA_FILENAME; 838 const char *filename;
855 break; 839 switch (emu->card_capabilities->emu_model) {
856 case EMU_MODEL_EMU1010B: 840 case EMU_MODEL_EMU1010:
857 filename = EMU1010B_FILENAME; 841 filename = HANA_FILENAME;
858 break; 842 break;
859 case EMU_MODEL_EMU1616: 843 case EMU_MODEL_EMU1010B:
860 filename = EMU1010_NOTEBOOK_FILENAME; 844 filename = EMU1010B_FILENAME;
861 break; 845 break;
862 case EMU_MODEL_EMU0404: 846 case EMU_MODEL_EMU1616:
863 filename = EMU0404_FILENAME; 847 filename = EMU1010_NOTEBOOK_FILENAME;
864 break; 848 break;
865 default: 849 case EMU_MODEL_EMU0404:
866 filename = NULL; 850 filename = EMU0404_FILENAME;
867 return -ENODEV; 851 break;
868 break; 852 default:
869 } 853 return -ENODEV;
870 snd_printk(KERN_INFO "emu1010: filename %s testing\n", filename); 854 }
871 err = snd_emu1010_load_firmware(emu, filename); 855
872 if (err != 0) { 856 err = request_firmware(&emu->firmware, filename, &emu->pci->dev);
873 snd_printk( 857 if (err != 0) {
874 KERN_INFO "emu1010: Loading Firmware file %s failed\n", 858 snd_printk(KERN_ERR "emu1010: firmware: %s not found. Err = %d\n", filename, err);
875 filename); 859 return err;
876 return err; 860 }
861 snd_printk(KERN_INFO "emu1010: firmware file = %s, size = 0x%zx\n",
862 filename, emu->firmware->size);
877 } 863 }
878 864
879 /* ID, should read & 0x7f = 0x55 when FPGA programmed. */ 865 /* ID, should read & 0x7f = 0x55 when FPGA programmed. */
@@ -1259,6 +1245,8 @@ static int snd_emu10k1_free(struct snd_emu10k1 *emu)
1259 } 1245 }
1260 if (emu->emu1010.firmware_thread) 1246 if (emu->emu1010.firmware_thread)
1261 kthread_stop(emu->emu1010.firmware_thread); 1247 kthread_stop(emu->emu1010.firmware_thread);
1248 if (emu->firmware)
1249 release_firmware(emu->firmware);
1262 if (emu->irq >= 0) 1250 if (emu->irq >= 0)
1263 free_irq(emu->irq, emu); 1251 free_irq(emu->irq, emu);
1264 /* remove reserved page */ 1252 /* remove reserved page */
@@ -1738,7 +1726,7 @@ static struct snd_emu_chip_details emu_chip_details[] = {
1738 { } /* terminator */ 1726 { } /* terminator */
1739}; 1727};
1740 1728
1741int __devinit snd_emu10k1_create(struct snd_card *card, 1729int snd_emu10k1_create(struct snd_card *card,
1742 struct pci_dev *pci, 1730 struct pci_dev *pci,
1743 unsigned short extin_mask, 1731 unsigned short extin_mask,
1744 unsigned short extout_mask, 1732 unsigned short extout_mask,
@@ -2025,7 +2013,7 @@ static unsigned char saved_regs_audigy[] = {
2025 0xff /* end */ 2013 0xff /* end */
2026}; 2014};
2027 2015
2028static int __devinit alloc_pm_buffer(struct snd_emu10k1 *emu) 2016static int alloc_pm_buffer(struct snd_emu10k1 *emu)
2029{ 2017{
2030 int size; 2018 int size;
2031 2019
diff --git a/sound/pci/emu10k1/emu10k1_patch.c b/sound/pci/emu10k1/emu10k1_patch.c
index e10f027bde03..662a45876a8b 100644
--- a/sound/pci/emu10k1/emu10k1_patch.c
+++ b/sound/pci/emu10k1/emu10k1_patch.c
@@ -123,7 +123,7 @@ snd_emu10k1_sample_new(struct snd_emux *rec, struct snd_sf_sample *sp,
123 offset += size; 123 offset += size;
124 data += size; 124 data += size;
125 125
126#if 0 /* not suppported yet */ 126#if 0 /* not supported yet */
127 /* handle reverse (or bidirectional) loop */ 127 /* handle reverse (or bidirectional) loop */
128 if (sp->v.mode_flags & (SNDRV_SFNT_SAMPLE_BIDIR_LOOP|SNDRV_SFNT_SAMPLE_REVERSE_LOOP)) { 128 if (sp->v.mode_flags & (SNDRV_SFNT_SAMPLE_BIDIR_LOOP|SNDRV_SFNT_SAMPLE_REVERSE_LOOP)) {
129 /* copy loop in reverse */ 129 /* copy loop in reverse */
diff --git a/sound/pci/emu10k1/emu10k1x.c b/sound/pci/emu10k1/emu10k1x.c
index 556fd6f456e3..cdff11d48ebd 100644
--- a/sound/pci/emu10k1/emu10k1x.c
+++ b/sound/pci/emu10k1/emu10k1x.c
@@ -842,7 +842,7 @@ static const struct snd_pcm_chmap_elem clfe_map[] = {
842 { } 842 { }
843}; 843};
844 844
845static int __devinit snd_emu10k1x_pcm(struct emu10k1x *emu, int device, struct snd_pcm **rpcm) 845static int snd_emu10k1x_pcm(struct emu10k1x *emu, int device, struct snd_pcm **rpcm)
846{ 846{
847 struct snd_pcm *pcm; 847 struct snd_pcm *pcm;
848 const struct snd_pcm_chmap_elem *map = NULL; 848 const struct snd_pcm_chmap_elem *map = NULL;
@@ -902,9 +902,9 @@ static int __devinit snd_emu10k1x_pcm(struct emu10k1x *emu, int device, struct s
902 return 0; 902 return 0;
903} 903}
904 904
905static int __devinit snd_emu10k1x_create(struct snd_card *card, 905static int snd_emu10k1x_create(struct snd_card *card,
906 struct pci_dev *pci, 906 struct pci_dev *pci,
907 struct emu10k1x **rchip) 907 struct emu10k1x **rchip)
908{ 908{
909 struct emu10k1x *chip; 909 struct emu10k1x *chip;
910 int err; 910 int err;
@@ -1066,7 +1066,7 @@ static void snd_emu10k1x_proc_reg_write(struct snd_info_entry *entry,
1066 } 1066 }
1067} 1067}
1068 1068
1069static int __devinit snd_emu10k1x_proc_init(struct emu10k1x * emu) 1069static int snd_emu10k1x_proc_init(struct emu10k1x *emu)
1070{ 1070{
1071 struct snd_info_entry *entry; 1071 struct snd_info_entry *entry;
1072 1072
@@ -1115,7 +1115,7 @@ static int snd_emu10k1x_shared_spdif_put(struct snd_kcontrol *kcontrol,
1115 return change; 1115 return change;
1116} 1116}
1117 1117
1118static struct snd_kcontrol_new snd_emu10k1x_shared_spdif __devinitdata = 1118static struct snd_kcontrol_new snd_emu10k1x_shared_spdif =
1119{ 1119{
1120 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1120 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1121 .name = "Analog/Digital Output Jack", 1121 .name = "Analog/Digital Output Jack",
@@ -1194,7 +1194,7 @@ static struct snd_kcontrol_new snd_emu10k1x_spdif_control =
1194 .put = snd_emu10k1x_spdif_put 1194 .put = snd_emu10k1x_spdif_put
1195}; 1195};
1196 1196
1197static int __devinit snd_emu10k1x_mixer(struct emu10k1x *emu) 1197static int snd_emu10k1x_mixer(struct emu10k1x *emu)
1198{ 1198{
1199 int err; 1199 int err;
1200 struct snd_kcontrol *kctl; 1200 struct snd_kcontrol *kctl;
@@ -1507,8 +1507,9 @@ static void snd_emu10k1x_midi_free(struct snd_rawmidi *rmidi)
1507 midi->rmidi = NULL; 1507 midi->rmidi = NULL;
1508} 1508}
1509 1509
1510static int __devinit emu10k1x_midi_init(struct emu10k1x *emu, 1510static int emu10k1x_midi_init(struct emu10k1x *emu,
1511 struct emu10k1x_midi *midi, int device, char *name) 1511 struct emu10k1x_midi *midi, int device,
1512 char *name)
1512{ 1513{
1513 struct snd_rawmidi *rmidi; 1514 struct snd_rawmidi *rmidi;
1514 int err; 1515 int err;
@@ -1531,7 +1532,7 @@ static int __devinit emu10k1x_midi_init(struct emu10k1x *emu,
1531 return 0; 1532 return 0;
1532} 1533}
1533 1534
1534static int __devinit snd_emu10k1x_midi(struct emu10k1x *emu) 1535static int snd_emu10k1x_midi(struct emu10k1x *emu)
1535{ 1536{
1536 struct emu10k1x_midi *midi = &emu->midi; 1537 struct emu10k1x_midi *midi = &emu->midi;
1537 int err; 1538 int err;
@@ -1548,8 +1549,8 @@ static int __devinit snd_emu10k1x_midi(struct emu10k1x *emu)
1548 return 0; 1549 return 0;
1549} 1550}
1550 1551
1551static int __devinit snd_emu10k1x_probe(struct pci_dev *pci, 1552static int snd_emu10k1x_probe(struct pci_dev *pci,
1552 const struct pci_device_id *pci_id) 1553 const struct pci_device_id *pci_id)
1553{ 1554{
1554 static int dev; 1555 static int dev;
1555 struct snd_card *card; 1556 struct snd_card *card;
@@ -1619,7 +1620,7 @@ static int __devinit snd_emu10k1x_probe(struct pci_dev *pci,
1619 return 0; 1620 return 0;
1620} 1621}
1621 1622
1622static void __devexit snd_emu10k1x_remove(struct pci_dev *pci) 1623static void snd_emu10k1x_remove(struct pci_dev *pci)
1623{ 1624{
1624 snd_card_free(pci_get_drvdata(pci)); 1625 snd_card_free(pci_get_drvdata(pci));
1625 pci_set_drvdata(pci, NULL); 1626 pci_set_drvdata(pci, NULL);
@@ -1637,7 +1638,7 @@ static struct pci_driver emu10k1x_driver = {
1637 .name = KBUILD_MODNAME, 1638 .name = KBUILD_MODNAME,
1638 .id_table = snd_emu10k1x_ids, 1639 .id_table = snd_emu10k1x_ids,
1639 .probe = snd_emu10k1x_probe, 1640 .probe = snd_emu10k1x_probe,
1640 .remove = __devexit_p(snd_emu10k1x_remove), 1641 .remove = snd_emu10k1x_remove,
1641}; 1642};
1642 1643
1643module_pci_driver(emu10k1x_driver); 1644module_pci_driver(emu10k1x_driver);
diff --git a/sound/pci/emu10k1/emufx.c b/sound/pci/emu10k1/emufx.c
index 52419959178c..0275209ca82e 100644
--- a/sound/pci/emu10k1/emufx.c
+++ b/sound/pci/emu10k1/emufx.c
@@ -1073,7 +1073,7 @@ static int snd_emu10k1_ipcm_peek(struct snd_emu10k1 *emu,
1073#define SND_EMU10K1_PLAYBACK_CHANNELS 8 1073#define SND_EMU10K1_PLAYBACK_CHANNELS 8
1074#define SND_EMU10K1_CAPTURE_CHANNELS 4 1074#define SND_EMU10K1_CAPTURE_CHANNELS 4
1075 1075
1076static void __devinit 1076static void
1077snd_emu10k1_init_mono_control(struct snd_emu10k1_fx8010_control_gpr *ctl, 1077snd_emu10k1_init_mono_control(struct snd_emu10k1_fx8010_control_gpr *ctl,
1078 const char *name, int gpr, int defval) 1078 const char *name, int gpr, int defval)
1079{ 1079{
@@ -1094,7 +1094,7 @@ snd_emu10k1_init_mono_control(struct snd_emu10k1_fx8010_control_gpr *ctl,
1094 } 1094 }
1095} 1095}
1096 1096
1097static void __devinit 1097static void
1098snd_emu10k1_init_stereo_control(struct snd_emu10k1_fx8010_control_gpr *ctl, 1098snd_emu10k1_init_stereo_control(struct snd_emu10k1_fx8010_control_gpr *ctl,
1099 const char *name, int gpr, int defval) 1099 const char *name, int gpr, int defval)
1100{ 1100{
@@ -1116,7 +1116,7 @@ snd_emu10k1_init_stereo_control(struct snd_emu10k1_fx8010_control_gpr *ctl,
1116 } 1116 }
1117} 1117}
1118 1118
1119static void __devinit 1119static void
1120snd_emu10k1_init_mono_onoff_control(struct snd_emu10k1_fx8010_control_gpr *ctl, 1120snd_emu10k1_init_mono_onoff_control(struct snd_emu10k1_fx8010_control_gpr *ctl,
1121 const char *name, int gpr, int defval) 1121 const char *name, int gpr, int defval)
1122{ 1122{
@@ -1129,7 +1129,7 @@ snd_emu10k1_init_mono_onoff_control(struct snd_emu10k1_fx8010_control_gpr *ctl,
1129 ctl->translation = EMU10K1_GPR_TRANSLATION_ONOFF; 1129 ctl->translation = EMU10K1_GPR_TRANSLATION_ONOFF;
1130} 1130}
1131 1131
1132static void __devinit 1132static void
1133snd_emu10k1_init_stereo_onoff_control(struct snd_emu10k1_fx8010_control_gpr *ctl, 1133snd_emu10k1_init_stereo_onoff_control(struct snd_emu10k1_fx8010_control_gpr *ctl,
1134 const char *name, int gpr, int defval) 1134 const char *name, int gpr, int defval)
1135{ 1135{
@@ -1168,7 +1168,7 @@ static int snd_emu10k1_audigy_dsp_convert_32_to_2x16(
1168 * initial DSP configuration for Audigy 1168 * initial DSP configuration for Audigy
1169 */ 1169 */
1170 1170
1171static int __devinit _snd_emu10k1_audigy_init_efx(struct snd_emu10k1 *emu) 1171static int _snd_emu10k1_audigy_init_efx(struct snd_emu10k1 *emu)
1172{ 1172{
1173 int err, i, z, gpr, nctl; 1173 int err, i, z, gpr, nctl;
1174 int bit_shifter16; 1174 int bit_shifter16;
@@ -1757,14 +1757,14 @@ A_OP(icode, &ptr, iMAC0, A_GPR(var), A_GPR(var), A_GPR(vol), A_EXTIN(input))
1757 1757
1758/* when volume = max, then copy only to avoid volume modification */ 1758/* when volume = max, then copy only to avoid volume modification */
1759/* with iMAC0 (negative values) */ 1759/* with iMAC0 (negative values) */
1760static void __devinit _volume(struct snd_emu10k1_fx8010_code *icode, u32 *ptr, u32 dst, u32 src, u32 vol) 1760static void _volume(struct snd_emu10k1_fx8010_code *icode, u32 *ptr, u32 dst, u32 src, u32 vol)
1761{ 1761{
1762 OP(icode, ptr, iMAC0, dst, C_00000000, src, vol); 1762 OP(icode, ptr, iMAC0, dst, C_00000000, src, vol);
1763 OP(icode, ptr, iANDXOR, C_00000000, vol, C_ffffffff, C_7fffffff); 1763 OP(icode, ptr, iANDXOR, C_00000000, vol, C_ffffffff, C_7fffffff);
1764 OP(icode, ptr, iSKIP, GPR_COND, GPR_COND, CC_REG_NONZERO, C_00000001); 1764 OP(icode, ptr, iSKIP, GPR_COND, GPR_COND, CC_REG_NONZERO, C_00000001);
1765 OP(icode, ptr, iACC3, dst, src, C_00000000, C_00000000); 1765 OP(icode, ptr, iACC3, dst, src, C_00000000, C_00000000);
1766} 1766}
1767static void __devinit _volume_add(struct snd_emu10k1_fx8010_code *icode, u32 *ptr, u32 dst, u32 src, u32 vol) 1767static void _volume_add(struct snd_emu10k1_fx8010_code *icode, u32 *ptr, u32 dst, u32 src, u32 vol)
1768{ 1768{
1769 OP(icode, ptr, iANDXOR, C_00000000, vol, C_ffffffff, C_7fffffff); 1769 OP(icode, ptr, iANDXOR, C_00000000, vol, C_ffffffff, C_7fffffff);
1770 OP(icode, ptr, iSKIP, GPR_COND, GPR_COND, CC_REG_NONZERO, C_00000002); 1770 OP(icode, ptr, iSKIP, GPR_COND, GPR_COND, CC_REG_NONZERO, C_00000002);
@@ -1772,7 +1772,7 @@ static void __devinit _volume_add(struct snd_emu10k1_fx8010_code *icode, u32 *pt
1772 OP(icode, ptr, iSKIP, C_00000000, C_7fffffff, C_7fffffff, C_00000001); 1772 OP(icode, ptr, iSKIP, C_00000000, C_7fffffff, C_7fffffff, C_00000001);
1773 OP(icode, ptr, iMAC0, dst, dst, src, vol); 1773 OP(icode, ptr, iMAC0, dst, dst, src, vol);
1774} 1774}
1775static void __devinit _volume_out(struct snd_emu10k1_fx8010_code *icode, u32 *ptr, u32 dst, u32 src, u32 vol) 1775static void _volume_out(struct snd_emu10k1_fx8010_code *icode, u32 *ptr, u32 dst, u32 src, u32 vol)
1776{ 1776{
1777 OP(icode, ptr, iANDXOR, C_00000000, vol, C_ffffffff, C_7fffffff); 1777 OP(icode, ptr, iANDXOR, C_00000000, vol, C_ffffffff, C_7fffffff);
1778 OP(icode, ptr, iSKIP, GPR_COND, GPR_COND, CC_REG_NONZERO, C_00000002); 1778 OP(icode, ptr, iSKIP, GPR_COND, GPR_COND, CC_REG_NONZERO, C_00000002);
@@ -1803,7 +1803,7 @@ static void __devinit _volume_out(struct snd_emu10k1_fx8010_code *icode, u32 *pt
1803 _SWITCH_NEG(icode, ptr, GPR(dst), GPR(src)) 1803 _SWITCH_NEG(icode, ptr, GPR(dst), GPR(src))
1804 1804
1805 1805
1806static int __devinit _snd_emu10k1_init_efx(struct snd_emu10k1 *emu) 1806static int _snd_emu10k1_init_efx(struct snd_emu10k1 *emu)
1807{ 1807{
1808 int err, i, z, gpr, tmp, playback, capture; 1808 int err, i, z, gpr, tmp, playback, capture;
1809 u32 ptr; 1809 u32 ptr;
@@ -2373,7 +2373,7 @@ static int __devinit _snd_emu10k1_init_efx(struct snd_emu10k1 *emu)
2373 return err; 2373 return err;
2374} 2374}
2375 2375
2376int __devinit snd_emu10k1_init_efx(struct snd_emu10k1 *emu) 2376int snd_emu10k1_init_efx(struct snd_emu10k1 *emu)
2377{ 2377{
2378 spin_lock_init(&emu->fx8010.irq_lock); 2378 spin_lock_init(&emu->fx8010.irq_lock);
2379 INIT_LIST_HEAD(&emu->fx8010.gpr_ctl); 2379 INIT_LIST_HEAD(&emu->fx8010.gpr_ctl);
@@ -2626,7 +2626,8 @@ static int snd_emu10k1_fx8010_release(struct snd_hwdep * hw, struct file *file)
2626 return 0; 2626 return 0;
2627} 2627}
2628 2628
2629int __devinit snd_emu10k1_fx8010_new(struct snd_emu10k1 *emu, int device, struct snd_hwdep ** rhwdep) 2629int snd_emu10k1_fx8010_new(struct snd_emu10k1 *emu, int device,
2630 struct snd_hwdep **rhwdep)
2630{ 2631{
2631 struct snd_hwdep *hw; 2632 struct snd_hwdep *hw;
2632 int err; 2633 int err;
@@ -2647,7 +2648,7 @@ int __devinit snd_emu10k1_fx8010_new(struct snd_emu10k1 *emu, int device, struct
2647} 2648}
2648 2649
2649#ifdef CONFIG_PM_SLEEP 2650#ifdef CONFIG_PM_SLEEP
2650int __devinit snd_emu10k1_efx_alloc_pm_buffer(struct snd_emu10k1 *emu) 2651int snd_emu10k1_efx_alloc_pm_buffer(struct snd_emu10k1 *emu)
2651{ 2652{
2652 int len; 2653 int len;
2653 2654
diff --git a/sound/pci/emu10k1/emumixer.c b/sound/pci/emu10k1/emumixer.c
index 9d890a5aec5a..f6c3da0d377d 100644
--- a/sound/pci/emu10k1/emumixer.c
+++ b/sound/pci/emu10k1/emumixer.c
@@ -510,7 +510,7 @@ static int snd_emu1010_input_source_put(struct snd_kcontrol *kcontrol,
510 .private_value = chid \ 510 .private_value = chid \
511} 511}
512 512
513static struct snd_kcontrol_new snd_emu1010_output_enum_ctls[] __devinitdata = { 513static struct snd_kcontrol_new snd_emu1010_output_enum_ctls[] = {
514 EMU1010_SOURCE_OUTPUT("Dock DAC1 Left Playback Enum", 0), 514 EMU1010_SOURCE_OUTPUT("Dock DAC1 Left Playback Enum", 0),
515 EMU1010_SOURCE_OUTPUT("Dock DAC1 Right Playback Enum", 1), 515 EMU1010_SOURCE_OUTPUT("Dock DAC1 Right Playback Enum", 1),
516 EMU1010_SOURCE_OUTPUT("Dock DAC2 Left Playback Enum", 2), 516 EMU1010_SOURCE_OUTPUT("Dock DAC2 Left Playback Enum", 2),
@@ -539,7 +539,7 @@ static struct snd_kcontrol_new snd_emu1010_output_enum_ctls[] __devinitdata = {
539 539
540 540
541/* 1616(m) cardbus */ 541/* 1616(m) cardbus */
542static struct snd_kcontrol_new snd_emu1616_output_enum_ctls[] __devinitdata = { 542static struct snd_kcontrol_new snd_emu1616_output_enum_ctls[] = {
543 EMU1010_SOURCE_OUTPUT("Dock DAC1 Left Playback Enum", 0), 543 EMU1010_SOURCE_OUTPUT("Dock DAC1 Left Playback Enum", 0),
544 EMU1010_SOURCE_OUTPUT("Dock DAC1 Right Playback Enum", 1), 544 EMU1010_SOURCE_OUTPUT("Dock DAC1 Right Playback Enum", 1),
545 EMU1010_SOURCE_OUTPUT("Dock DAC2 Left Playback Enum", 2), 545 EMU1010_SOURCE_OUTPUT("Dock DAC2 Left Playback Enum", 2),
@@ -571,7 +571,7 @@ static struct snd_kcontrol_new snd_emu1616_output_enum_ctls[] __devinitdata = {
571 .private_value = chid \ 571 .private_value = chid \
572} 572}
573 573
574static struct snd_kcontrol_new snd_emu1010_input_enum_ctls[] __devinitdata = { 574static struct snd_kcontrol_new snd_emu1010_input_enum_ctls[] = {
575 EMU1010_SOURCE_INPUT("DSP 0 Capture Enum", 0), 575 EMU1010_SOURCE_INPUT("DSP 0 Capture Enum", 0),
576 EMU1010_SOURCE_INPUT("DSP 1 Capture Enum", 1), 576 EMU1010_SOURCE_INPUT("DSP 1 Capture Enum", 1),
577 EMU1010_SOURCE_INPUT("DSP 2 Capture Enum", 2), 577 EMU1010_SOURCE_INPUT("DSP 2 Capture Enum", 2),
@@ -639,7 +639,7 @@ static int snd_emu1010_adc_pads_put(struct snd_kcontrol *kcontrol, struct snd_ct
639 .private_value = chid \ 639 .private_value = chid \
640} 640}
641 641
642static struct snd_kcontrol_new snd_emu1010_adc_pads[] __devinitdata = { 642static struct snd_kcontrol_new snd_emu1010_adc_pads[] = {
643 EMU1010_ADC_PADS("ADC1 14dB PAD Audio Dock Capture Switch", EMU_HANA_DOCK_ADC_PAD1), 643 EMU1010_ADC_PADS("ADC1 14dB PAD Audio Dock Capture Switch", EMU_HANA_DOCK_ADC_PAD1),
644 EMU1010_ADC_PADS("ADC2 14dB PAD Audio Dock Capture Switch", EMU_HANA_DOCK_ADC_PAD2), 644 EMU1010_ADC_PADS("ADC2 14dB PAD Audio Dock Capture Switch", EMU_HANA_DOCK_ADC_PAD2),
645 EMU1010_ADC_PADS("ADC3 14dB PAD Audio Dock Capture Switch", EMU_HANA_DOCK_ADC_PAD3), 645 EMU1010_ADC_PADS("ADC3 14dB PAD Audio Dock Capture Switch", EMU_HANA_DOCK_ADC_PAD3),
@@ -687,7 +687,7 @@ static int snd_emu1010_dac_pads_put(struct snd_kcontrol *kcontrol, struct snd_ct
687 .private_value = chid \ 687 .private_value = chid \
688} 688}
689 689
690static struct snd_kcontrol_new snd_emu1010_dac_pads[] __devinitdata = { 690static struct snd_kcontrol_new snd_emu1010_dac_pads[] = {
691 EMU1010_DAC_PADS("DAC1 Audio Dock 14dB PAD Playback Switch", EMU_HANA_DOCK_DAC_PAD1), 691 EMU1010_DAC_PADS("DAC1 Audio Dock 14dB PAD Playback Switch", EMU_HANA_DOCK_DAC_PAD1),
692 EMU1010_DAC_PADS("DAC2 Audio Dock 14dB PAD Playback Switch", EMU_HANA_DOCK_DAC_PAD2), 692 EMU1010_DAC_PADS("DAC2 Audio Dock 14dB PAD Playback Switch", EMU_HANA_DOCK_DAC_PAD2),
693 EMU1010_DAC_PADS("DAC3 Audio Dock 14dB PAD Playback Switch", EMU_HANA_DOCK_DAC_PAD3), 693 EMU1010_DAC_PADS("DAC3 Audio Dock 14dB PAD Playback Switch", EMU_HANA_DOCK_DAC_PAD3),
@@ -989,7 +989,7 @@ static int snd_audigy_i2c_volume_put(struct snd_kcontrol *kcontrol,
989} 989}
990 990
991 991
992static struct snd_kcontrol_new snd_audigy_i2c_volume_ctls[] __devinitdata = { 992static struct snd_kcontrol_new snd_audigy_i2c_volume_ctls[] = {
993 I2C_VOLUME("Mic Capture Volume", 0), 993 I2C_VOLUME("Mic Capture Volume", 0),
994 I2C_VOLUME("Line Capture Volume", 0) 994 I2C_VOLUME("Line Capture Volume", 0)
995}; 995};
@@ -1621,7 +1621,7 @@ static int snd_emu10k1_shared_spdif_put(struct snd_kcontrol *kcontrol,
1621 return change; 1621 return change;
1622} 1622}
1623 1623
1624static struct snd_kcontrol_new snd_emu10k1_shared_spdif __devinitdata = 1624static struct snd_kcontrol_new snd_emu10k1_shared_spdif =
1625{ 1625{
1626 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1626 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1627 .name = "SB Live Analog/Digital Output Jack", 1627 .name = "SB Live Analog/Digital Output Jack",
@@ -1630,7 +1630,7 @@ static struct snd_kcontrol_new snd_emu10k1_shared_spdif __devinitdata =
1630 .put = snd_emu10k1_shared_spdif_put 1630 .put = snd_emu10k1_shared_spdif_put
1631}; 1631};
1632 1632
1633static struct snd_kcontrol_new snd_audigy_shared_spdif __devinitdata = 1633static struct snd_kcontrol_new snd_audigy_shared_spdif =
1634{ 1634{
1635 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1635 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1636 .name = "Audigy Analog/Digital Output Jack", 1636 .name = "Audigy Analog/Digital Output Jack",
@@ -1668,7 +1668,7 @@ static int snd_audigy_capture_boost_put(struct snd_kcontrol *kcontrol,
1668 return snd_ac97_update(emu->ac97, AC97_REC_GAIN, val); 1668 return snd_ac97_update(emu->ac97, AC97_REC_GAIN, val);
1669} 1669}
1670 1670
1671static struct snd_kcontrol_new snd_audigy_capture_boost __devinitdata = 1671static struct snd_kcontrol_new snd_audigy_capture_boost =
1672{ 1672{
1673 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1673 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1674 .name = "Analog Capture Boost", 1674 .name = "Analog Capture Boost",
@@ -1716,8 +1716,8 @@ static int rename_ctl(struct snd_card *card, const char *src, const char *dst)
1716 return -ENOENT; 1716 return -ENOENT;
1717} 1717}
1718 1718
1719int __devinit snd_emu10k1_mixer(struct snd_emu10k1 *emu, 1719int snd_emu10k1_mixer(struct snd_emu10k1 *emu,
1720 int pcm_device, int multi_device) 1720 int pcm_device, int multi_device)
1721{ 1721{
1722 int err, pcm; 1722 int err, pcm;
1723 struct snd_kcontrol *kctl; 1723 struct snd_kcontrol *kctl;
diff --git a/sound/pci/emu10k1/emumpu401.c b/sound/pci/emu10k1/emumpu401.c
index bab564824efe..1ec91246dfee 100644
--- a/sound/pci/emu10k1/emumpu401.c
+++ b/sound/pci/emu10k1/emumpu401.c
@@ -326,7 +326,7 @@ static void snd_emu10k1_midi_free(struct snd_rawmidi *rmidi)
326 midi->rmidi = NULL; 326 midi->rmidi = NULL;
327} 327}
328 328
329static int __devinit emu10k1_midi_init(struct snd_emu10k1 *emu, struct snd_emu10k1_midi *midi, int device, char *name) 329static int emu10k1_midi_init(struct snd_emu10k1 *emu, struct snd_emu10k1_midi *midi, int device, char *name)
330{ 330{
331 struct snd_rawmidi *rmidi; 331 struct snd_rawmidi *rmidi;
332 int err; 332 int err;
@@ -349,7 +349,7 @@ static int __devinit emu10k1_midi_init(struct snd_emu10k1 *emu, struct snd_emu10
349 return 0; 349 return 0;
350} 350}
351 351
352int __devinit snd_emu10k1_midi(struct snd_emu10k1 *emu) 352int snd_emu10k1_midi(struct snd_emu10k1 *emu)
353{ 353{
354 struct snd_emu10k1_midi *midi = &emu->midi; 354 struct snd_emu10k1_midi *midi = &emu->midi;
355 int err; 355 int err;
@@ -366,7 +366,7 @@ int __devinit snd_emu10k1_midi(struct snd_emu10k1 *emu)
366 return 0; 366 return 0;
367} 367}
368 368
369int __devinit snd_emu10k1_audigy_midi(struct snd_emu10k1 *emu) 369int snd_emu10k1_audigy_midi(struct snd_emu10k1 *emu)
370{ 370{
371 struct snd_emu10k1_midi *midi; 371 struct snd_emu10k1_midi *midi;
372 int err; 372 int err;
diff --git a/sound/pci/emu10k1/emupcm.c b/sound/pci/emu10k1/emupcm.c
index 0e6664fa6cd9..748a286277eb 100644
--- a/sound/pci/emu10k1/emupcm.c
+++ b/sound/pci/emu10k1/emupcm.c
@@ -1391,7 +1391,7 @@ static struct snd_pcm_ops snd_emu10k1_efx_playback_ops = {
1391 .page = snd_pcm_sgbuf_ops_page, 1391 .page = snd_pcm_sgbuf_ops_page,
1392}; 1392};
1393 1393
1394int __devinit snd_emu10k1_pcm(struct snd_emu10k1 * emu, int device, struct snd_pcm ** rpcm) 1394int snd_emu10k1_pcm(struct snd_emu10k1 *emu, int device, struct snd_pcm **rpcm)
1395{ 1395{
1396 struct snd_pcm *pcm; 1396 struct snd_pcm *pcm;
1397 struct snd_pcm_substream *substream; 1397 struct snd_pcm_substream *substream;
@@ -1426,7 +1426,8 @@ int __devinit snd_emu10k1_pcm(struct snd_emu10k1 * emu, int device, struct snd_p
1426 return 0; 1426 return 0;
1427} 1427}
1428 1428
1429int __devinit snd_emu10k1_pcm_multi(struct snd_emu10k1 * emu, int device, struct snd_pcm ** rpcm) 1429int snd_emu10k1_pcm_multi(struct snd_emu10k1 *emu, int device,
1430 struct snd_pcm **rpcm)
1430{ 1431{
1431 struct snd_pcm *pcm; 1432 struct snd_pcm *pcm;
1432 struct snd_pcm_substream *substream; 1433 struct snd_pcm_substream *substream;
@@ -1469,7 +1470,8 @@ static struct snd_pcm_ops snd_emu10k1_capture_mic_ops = {
1469 .pointer = snd_emu10k1_capture_pointer, 1470 .pointer = snd_emu10k1_capture_pointer,
1470}; 1471};
1471 1472
1472int __devinit snd_emu10k1_pcm_mic(struct snd_emu10k1 * emu, int device, struct snd_pcm ** rpcm) 1473int snd_emu10k1_pcm_mic(struct snd_emu10k1 *emu, int device,
1474 struct snd_pcm **rpcm)
1473{ 1475{
1474 struct snd_pcm *pcm; 1476 struct snd_pcm *pcm;
1475 int err; 1477 int err;
@@ -1810,7 +1812,8 @@ static struct snd_pcm_ops snd_emu10k1_fx8010_playback_ops = {
1810 .ack = snd_emu10k1_fx8010_playback_transfer, 1812 .ack = snd_emu10k1_fx8010_playback_transfer,
1811}; 1813};
1812 1814
1813int __devinit snd_emu10k1_pcm_efx(struct snd_emu10k1 * emu, int device, struct snd_pcm ** rpcm) 1815int snd_emu10k1_pcm_efx(struct snd_emu10k1 *emu, int device,
1816 struct snd_pcm **rpcm)
1814{ 1817{
1815 struct snd_pcm *pcm; 1818 struct snd_pcm *pcm;
1816 struct snd_kcontrol *kctl; 1819 struct snd_kcontrol *kctl;
diff --git a/sound/pci/emu10k1/emuproc.c b/sound/pci/emu10k1/emuproc.c
index bc38dd4d071f..2ca9f2e93139 100644
--- a/sound/pci/emu10k1/emuproc.c
+++ b/sound/pci/emu10k1/emuproc.c
@@ -577,7 +577,7 @@ static struct snd_info_entry_ops snd_emu10k1_proc_ops_fx8010 = {
577 .read = snd_emu10k1_fx8010_read, 577 .read = snd_emu10k1_fx8010_read,
578}; 578};
579 579
580int __devinit snd_emu10k1_proc_init(struct snd_emu10k1 * emu) 580int snd_emu10k1_proc_init(struct snd_emu10k1 *emu)
581{ 581{
582 struct snd_info_entry *entry; 582 struct snd_info_entry *entry;
583#ifdef CONFIG_SND_DEBUG 583#ifdef CONFIG_SND_DEBUG
diff --git a/sound/pci/emu10k1/p16v.c b/sound/pci/emu10k1/p16v.c
index 88cec6b7dd41..7e2025cd6d9c 100644
--- a/sound/pci/emu10k1/p16v.c
+++ b/sound/pci/emu10k1/p16v.c
@@ -637,7 +637,7 @@ int snd_p16v_free(struct snd_emu10k1 *chip)
637 return 0; 637 return 0;
638} 638}
639 639
640int __devinit snd_p16v_pcm(struct snd_emu10k1 *emu, int device, struct snd_pcm **rpcm) 640int snd_p16v_pcm(struct snd_emu10k1 *emu, int device, struct snd_pcm **rpcm)
641{ 641{
642 struct snd_pcm *pcm; 642 struct snd_pcm *pcm;
643 struct snd_pcm_substream *substream; 643 struct snd_pcm_substream *substream;
@@ -854,7 +854,7 @@ static const DECLARE_TLV_DB_SCALE(snd_p16v_db_scale1, -5175, 25, 1);
854 .private_value = ((xreg) | ((xhl) << 8)) \ 854 .private_value = ((xreg) | ((xhl) << 8)) \
855} 855}
856 856
857static struct snd_kcontrol_new p16v_mixer_controls[] __devinitdata = { 857static struct snd_kcontrol_new p16v_mixer_controls[] = {
858 P16V_VOL("HD Analog Front Playback Volume", PLAYBACK_VOLUME_MIXER9, 0), 858 P16V_VOL("HD Analog Front Playback Volume", PLAYBACK_VOLUME_MIXER9, 0),
859 P16V_VOL("HD Analog Rear Playback Volume", PLAYBACK_VOLUME_MIXER10, 1), 859 P16V_VOL("HD Analog Rear Playback Volume", PLAYBACK_VOLUME_MIXER10, 1),
860 P16V_VOL("HD Analog Center/LFE Playback Volume", PLAYBACK_VOLUME_MIXER9, 1), 860 P16V_VOL("HD Analog Center/LFE Playback Volume", PLAYBACK_VOLUME_MIXER9, 1),
@@ -880,7 +880,7 @@ static struct snd_kcontrol_new p16v_mixer_controls[] __devinitdata = {
880}; 880};
881 881
882 882
883int __devinit snd_p16v_mixer(struct snd_emu10k1 *emu) 883int snd_p16v_mixer(struct snd_emu10k1 *emu)
884{ 884{
885 int i, err; 885 int i, err;
886 struct snd_card *card = emu->card; 886 struct snd_card *card = emu->card;
@@ -897,7 +897,7 @@ int __devinit snd_p16v_mixer(struct snd_emu10k1 *emu)
897 897
898#define NUM_CHS 1 /* up to 4, but only first channel is used */ 898#define NUM_CHS 1 /* up to 4, but only first channel is used */
899 899
900int __devinit snd_p16v_alloc_pm_buffer(struct snd_emu10k1 *emu) 900int snd_p16v_alloc_pm_buffer(struct snd_emu10k1 *emu)
901{ 901{
902 emu->p16v_saved = vmalloc(NUM_CHS * 4 * 0x80); 902 emu->p16v_saved = vmalloc(NUM_CHS * 4 * 0x80);
903 if (! emu->p16v_saved) 903 if (! emu->p16v_saved)
diff --git a/sound/pci/emu10k1/timer.c b/sound/pci/emu10k1/timer.c
index 72321e946ccc..b69a7f8a216c 100644
--- a/sound/pci/emu10k1/timer.c
+++ b/sound/pci/emu10k1/timer.c
@@ -75,7 +75,7 @@ static struct snd_timer_hardware snd_emu10k1_timer_hw = {
75 .precise_resolution = snd_emu10k1_timer_precise_resolution, 75 .precise_resolution = snd_emu10k1_timer_precise_resolution,
76}; 76};
77 77
78int __devinit snd_emu10k1_timer(struct snd_emu10k1 *emu, int device) 78int snd_emu10k1_timer(struct snd_emu10k1 *emu, int device)
79{ 79{
80 struct snd_timer *timer = NULL; 80 struct snd_timer *timer = NULL;
81 struct snd_timer_id tid; 81 struct snd_timer_id tid;
diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c
index 5674cc316530..db2dc835171d 100644
--- a/sound/pci/ens1370.c
+++ b/sound/pci/ens1370.c
@@ -1268,8 +1268,8 @@ static const struct snd_pcm_chmap_elem surround_map[] = {
1268 { } 1268 { }
1269}; 1269};
1270 1270
1271static int __devinit snd_ensoniq_pcm(struct ensoniq * ensoniq, int device, 1271static int snd_ensoniq_pcm(struct ensoniq *ensoniq, int device,
1272 struct snd_pcm ** rpcm) 1272 struct snd_pcm **rpcm)
1273{ 1273{
1274 struct snd_pcm *pcm; 1274 struct snd_pcm *pcm;
1275 int err; 1275 int err;
@@ -1310,8 +1310,8 @@ static int __devinit snd_ensoniq_pcm(struct ensoniq * ensoniq, int device,
1310 return 0; 1310 return 0;
1311} 1311}
1312 1312
1313static int __devinit snd_ensoniq_pcm2(struct ensoniq * ensoniq, int device, 1313static int snd_ensoniq_pcm2(struct ensoniq *ensoniq, int device,
1314 struct snd_pcm ** rpcm) 1314 struct snd_pcm **rpcm)
1315{ 1315{
1316 struct snd_pcm *pcm; 1316 struct snd_pcm *pcm;
1317 int err; 1317 int err;
@@ -1484,7 +1484,7 @@ static int snd_es1371_spdif_put(struct snd_kcontrol *kcontrol,
1484 1484
1485 1485
1486/* spdif controls */ 1486/* spdif controls */
1487static struct snd_kcontrol_new snd_es1371_mixer_spdif[] __devinitdata = { 1487static struct snd_kcontrol_new snd_es1371_mixer_spdif[] = {
1488 ES1371_SPDIF(SNDRV_CTL_NAME_IEC958("",PLAYBACK,SWITCH)), 1488 ES1371_SPDIF(SNDRV_CTL_NAME_IEC958("",PLAYBACK,SWITCH)),
1489 { 1489 {
1490 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 1490 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
@@ -1546,7 +1546,7 @@ static int snd_es1373_rear_put(struct snd_kcontrol *kcontrol,
1546 return change; 1546 return change;
1547} 1547}
1548 1548
1549static struct snd_kcontrol_new snd_ens1373_rear __devinitdata = 1549static struct snd_kcontrol_new snd_ens1373_rear =
1550{ 1550{
1551 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1551 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1552 .name = "AC97 2ch->4ch Copy Switch", 1552 .name = "AC97 2ch->4ch Copy Switch",
@@ -1591,7 +1591,7 @@ static int snd_es1373_line_put(struct snd_kcontrol *kcontrol,
1591 return changed; 1591 return changed;
1592} 1592}
1593 1593
1594static struct snd_kcontrol_new snd_ens1373_line __devinitdata = 1594static struct snd_kcontrol_new snd_ens1373_line =
1595{ 1595{
1596 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1596 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1597 .name = "Line In->Rear Out Switch", 1597 .name = "Line In->Rear Out Switch",
@@ -1625,7 +1625,7 @@ static int es1371_quirk_lookup(struct ensoniq *ensoniq,
1625 return 0; 1625 return 0;
1626} 1626}
1627 1627
1628static struct es1371_quirk es1371_spdif_present[] __devinitdata = { 1628static struct es1371_quirk es1371_spdif_present[] = {
1629 { .vid = PCI_VENDOR_ID_ENSONIQ, .did = PCI_DEVICE_ID_ENSONIQ_CT5880, .rev = CT5880REV_CT5880_C }, 1629 { .vid = PCI_VENDOR_ID_ENSONIQ, .did = PCI_DEVICE_ID_ENSONIQ_CT5880, .rev = CT5880REV_CT5880_C },
1630 { .vid = PCI_VENDOR_ID_ENSONIQ, .did = PCI_DEVICE_ID_ENSONIQ_CT5880, .rev = CT5880REV_CT5880_D }, 1630 { .vid = PCI_VENDOR_ID_ENSONIQ, .did = PCI_DEVICE_ID_ENSONIQ_CT5880, .rev = CT5880REV_CT5880_D },
1631 { .vid = PCI_VENDOR_ID_ENSONIQ, .did = PCI_DEVICE_ID_ENSONIQ_CT5880, .rev = CT5880REV_CT5880_E }, 1631 { .vid = PCI_VENDOR_ID_ENSONIQ, .did = PCI_DEVICE_ID_ENSONIQ_CT5880, .rev = CT5880REV_CT5880_E },
@@ -1634,14 +1634,14 @@ static struct es1371_quirk es1371_spdif_present[] __devinitdata = {
1634 { .vid = PCI_ANY_ID, .did = PCI_ANY_ID } 1634 { .vid = PCI_ANY_ID, .did = PCI_ANY_ID }
1635}; 1635};
1636 1636
1637static struct snd_pci_quirk ens1373_line_quirk[] __devinitdata = { 1637static struct snd_pci_quirk ens1373_line_quirk[] = {
1638 SND_PCI_QUIRK_ID(0x1274, 0x2000), /* GA-7DXR */ 1638 SND_PCI_QUIRK_ID(0x1274, 0x2000), /* GA-7DXR */
1639 SND_PCI_QUIRK_ID(0x1458, 0xa000), /* GA-8IEXP */ 1639 SND_PCI_QUIRK_ID(0x1458, 0xa000), /* GA-8IEXP */
1640 { } /* end */ 1640 { } /* end */
1641}; 1641};
1642 1642
1643static int __devinit snd_ensoniq_1371_mixer(struct ensoniq *ensoniq, 1643static int snd_ensoniq_1371_mixer(struct ensoniq *ensoniq,
1644 int has_spdif, int has_line) 1644 int has_spdif, int has_line)
1645{ 1645{
1646 struct snd_card *card = ensoniq->card; 1646 struct snd_card *card = ensoniq->card;
1647 struct snd_ac97_bus *pbus; 1647 struct snd_ac97_bus *pbus;
@@ -1749,7 +1749,7 @@ static int snd_ensoniq_control_put(struct snd_kcontrol *kcontrol,
1749 * ENS1370 mixer 1749 * ENS1370 mixer
1750 */ 1750 */
1751 1751
1752static struct snd_kcontrol_new snd_es1370_controls[2] __devinitdata = { 1752static struct snd_kcontrol_new snd_es1370_controls[2] = {
1753ENSONIQ_CONTROL("PCM 0 Output also on Line-In Jack", ES_1370_XCTL0), 1753ENSONIQ_CONTROL("PCM 0 Output also on Line-In Jack", ES_1370_XCTL0),
1754ENSONIQ_CONTROL("Mic +5V bias", ES_1370_XCTL1) 1754ENSONIQ_CONTROL("Mic +5V bias", ES_1370_XCTL1)
1755}; 1755};
@@ -1762,7 +1762,7 @@ static void snd_ensoniq_mixer_free_ak4531(struct snd_ak4531 *ak4531)
1762 ensoniq->u.es1370.ak4531 = NULL; 1762 ensoniq->u.es1370.ak4531 = NULL;
1763} 1763}
1764 1764
1765static int __devinit snd_ensoniq_1370_mixer(struct ensoniq * ensoniq) 1765static int snd_ensoniq_1370_mixer(struct ensoniq *ensoniq)
1766{ 1766{
1767 struct snd_card *card = ensoniq->card; 1767 struct snd_card *card = ensoniq->card;
1768 struct snd_ak4531 ak4531; 1768 struct snd_ak4531 ak4531;
@@ -1796,7 +1796,7 @@ static int __devinit snd_ensoniq_1370_mixer(struct ensoniq * ensoniq)
1796#ifdef SUPPORT_JOYSTICK 1796#ifdef SUPPORT_JOYSTICK
1797 1797
1798#ifdef CHIP1371 1798#ifdef CHIP1371
1799static int __devinit snd_ensoniq_get_joystick_port(int dev) 1799static int snd_ensoniq_get_joystick_port(int dev)
1800{ 1800{
1801 switch (joystick_port[dev]) { 1801 switch (joystick_port[dev]) {
1802 case 0: /* disabled */ 1802 case 0: /* disabled */
@@ -1819,7 +1819,7 @@ static inline int snd_ensoniq_get_joystick_port(int dev)
1819} 1819}
1820#endif 1820#endif
1821 1821
1822static int __devinit snd_ensoniq_create_gameport(struct ensoniq *ensoniq, int dev) 1822static int snd_ensoniq_create_gameport(struct ensoniq *ensoniq, int dev)
1823{ 1823{
1824 struct gameport *gp; 1824 struct gameport *gp;
1825 int io_port; 1825 int io_port;
@@ -1913,7 +1913,7 @@ static void snd_ensoniq_proc_read(struct snd_info_entry *entry,
1913#endif 1913#endif
1914} 1914}
1915 1915
1916static void __devinit snd_ensoniq_proc_init(struct ensoniq * ensoniq) 1916static void snd_ensoniq_proc_init(struct ensoniq *ensoniq)
1917{ 1917{
1918 struct snd_info_entry *entry; 1918 struct snd_info_entry *entry;
1919 1919
@@ -1960,7 +1960,7 @@ static int snd_ensoniq_dev_free(struct snd_device *device)
1960} 1960}
1961 1961
1962#ifdef CHIP1371 1962#ifdef CHIP1371
1963static struct snd_pci_quirk es1371_amplifier_hack[] __devinitdata = { 1963static struct snd_pci_quirk es1371_amplifier_hack[] = {
1964 SND_PCI_QUIRK_ID(0x107b, 0x2150), /* Gateway Solo 2150 */ 1964 SND_PCI_QUIRK_ID(0x107b, 0x2150), /* Gateway Solo 2150 */
1965 SND_PCI_QUIRK_ID(0x13bd, 0x100c), /* EV1938 on Mebius PC-MJ100V */ 1965 SND_PCI_QUIRK_ID(0x13bd, 0x100c), /* EV1938 on Mebius PC-MJ100V */
1966 SND_PCI_QUIRK_ID(0x1102, 0x5938), /* Targa Xtender300 */ 1966 SND_PCI_QUIRK_ID(0x1102, 0x5938), /* Targa Xtender300 */
@@ -2106,9 +2106,9 @@ static SIMPLE_DEV_PM_OPS(snd_ensoniq_pm, snd_ensoniq_suspend, snd_ensoniq_resume
2106#define SND_ENSONIQ_PM_OPS NULL 2106#define SND_ENSONIQ_PM_OPS NULL
2107#endif /* CONFIG_PM_SLEEP */ 2107#endif /* CONFIG_PM_SLEEP */
2108 2108
2109static int __devinit snd_ensoniq_create(struct snd_card *card, 2109static int snd_ensoniq_create(struct snd_card *card,
2110 struct pci_dev *pci, 2110 struct pci_dev *pci,
2111 struct ensoniq ** rensoniq) 2111 struct ensoniq **rensoniq)
2112{ 2112{
2113 struct ensoniq *ensoniq; 2113 struct ensoniq *ensoniq;
2114 int err; 2114 int err;
@@ -2361,8 +2361,8 @@ static struct snd_rawmidi_ops snd_ensoniq_midi_input =
2361 .trigger = snd_ensoniq_midi_input_trigger, 2361 .trigger = snd_ensoniq_midi_input_trigger,
2362}; 2362};
2363 2363
2364static int __devinit snd_ensoniq_midi(struct ensoniq * ensoniq, int device, 2364static int snd_ensoniq_midi(struct ensoniq *ensoniq, int device,
2365 struct snd_rawmidi **rrawmidi) 2365 struct snd_rawmidi **rrawmidi)
2366{ 2366{
2367 struct snd_rawmidi *rmidi; 2367 struct snd_rawmidi *rmidi;
2368 int err; 2368 int err;
@@ -2422,8 +2422,8 @@ static irqreturn_t snd_audiopci_interrupt(int irq, void *dev_id)
2422 return IRQ_HANDLED; 2422 return IRQ_HANDLED;
2423} 2423}
2424 2424
2425static int __devinit snd_audiopci_probe(struct pci_dev *pci, 2425static int snd_audiopci_probe(struct pci_dev *pci,
2426 const struct pci_device_id *pci_id) 2426 const struct pci_device_id *pci_id)
2427{ 2427{
2428 static int dev; 2428 static int dev;
2429 struct snd_card *card; 2429 struct snd_card *card;
@@ -2494,7 +2494,7 @@ static int __devinit snd_audiopci_probe(struct pci_dev *pci,
2494 return 0; 2494 return 0;
2495} 2495}
2496 2496
2497static void __devexit snd_audiopci_remove(struct pci_dev *pci) 2497static void snd_audiopci_remove(struct pci_dev *pci)
2498{ 2498{
2499 snd_card_free(pci_get_drvdata(pci)); 2499 snd_card_free(pci_get_drvdata(pci));
2500 pci_set_drvdata(pci, NULL); 2500 pci_set_drvdata(pci, NULL);
@@ -2504,7 +2504,7 @@ static struct pci_driver ens137x_driver = {
2504 .name = KBUILD_MODNAME, 2504 .name = KBUILD_MODNAME,
2505 .id_table = snd_audiopci_ids, 2505 .id_table = snd_audiopci_ids,
2506 .probe = snd_audiopci_probe, 2506 .probe = snd_audiopci_probe,
2507 .remove = __devexit_p(snd_audiopci_remove), 2507 .remove = snd_audiopci_remove,
2508 .driver = { 2508 .driver = {
2509 .pm = SND_ENSONIQ_PM_OPS, 2509 .pm = SND_ENSONIQ_PM_OPS,
2510 }, 2510 },
diff --git a/sound/pci/es1938.c b/sound/pci/es1938.c
index 394c5d413530..8423403954ab 100644
--- a/sound/pci/es1938.c
+++ b/sound/pci/es1938.c
@@ -1027,7 +1027,7 @@ static struct snd_pcm_ops snd_es1938_capture_ops = {
1027 .copy = snd_es1938_capture_copy, 1027 .copy = snd_es1938_capture_copy,
1028}; 1028};
1029 1029
1030static int __devinit snd_es1938_new_pcm(struct es1938 *chip, int device) 1030static int snd_es1938_new_pcm(struct es1938 *chip, int device)
1031{ 1031{
1032 struct snd_pcm *pcm; 1032 struct snd_pcm *pcm;
1033 int err; 1033 int err;
@@ -1539,7 +1539,7 @@ static SIMPLE_DEV_PM_OPS(es1938_pm, es1938_suspend, es1938_resume);
1539#endif /* CONFIG_PM_SLEEP */ 1539#endif /* CONFIG_PM_SLEEP */
1540 1540
1541#ifdef SUPPORT_JOYSTICK 1541#ifdef SUPPORT_JOYSTICK
1542static int __devinit snd_es1938_create_gameport(struct es1938 *chip) 1542static int snd_es1938_create_gameport(struct es1938 *chip)
1543{ 1543{
1544 struct gameport *gp; 1544 struct gameport *gp;
1545 1545
@@ -1594,9 +1594,9 @@ static int snd_es1938_dev_free(struct snd_device *device)
1594 return snd_es1938_free(chip); 1594 return snd_es1938_free(chip);
1595} 1595}
1596 1596
1597static int __devinit snd_es1938_create(struct snd_card *card, 1597static int snd_es1938_create(struct snd_card *card,
1598 struct pci_dev * pci, 1598 struct pci_dev *pci,
1599 struct es1938 ** rchip) 1599 struct es1938 **rchip)
1600{ 1600{
1601 struct es1938 *chip; 1601 struct es1938 *chip;
1602 int err; 1602 int err;
@@ -1754,7 +1754,7 @@ static irqreturn_t snd_es1938_interrupt(int irq, void *dev_id)
1754 1754
1755#define ES1938_DMA_SIZE 64 1755#define ES1938_DMA_SIZE 64
1756 1756
1757static int __devinit snd_es1938_mixer(struct es1938 *chip) 1757static int snd_es1938_mixer(struct es1938 *chip)
1758{ 1758{
1759 struct snd_card *card; 1759 struct snd_card *card;
1760 unsigned int idx; 1760 unsigned int idx;
@@ -1792,8 +1792,8 @@ static int __devinit snd_es1938_mixer(struct es1938 *chip)
1792} 1792}
1793 1793
1794 1794
1795static int __devinit snd_es1938_probe(struct pci_dev *pci, 1795static int snd_es1938_probe(struct pci_dev *pci,
1796 const struct pci_device_id *pci_id) 1796 const struct pci_device_id *pci_id)
1797{ 1797{
1798 static int dev; 1798 static int dev;
1799 struct snd_card *card; 1799 struct snd_card *card;
@@ -1878,7 +1878,7 @@ static int __devinit snd_es1938_probe(struct pci_dev *pci,
1878 return 0; 1878 return 0;
1879} 1879}
1880 1880
1881static void __devexit snd_es1938_remove(struct pci_dev *pci) 1881static void snd_es1938_remove(struct pci_dev *pci)
1882{ 1882{
1883 snd_card_free(pci_get_drvdata(pci)); 1883 snd_card_free(pci_get_drvdata(pci));
1884 pci_set_drvdata(pci, NULL); 1884 pci_set_drvdata(pci, NULL);
@@ -1888,7 +1888,7 @@ static struct pci_driver es1938_driver = {
1888 .name = KBUILD_MODNAME, 1888 .name = KBUILD_MODNAME,
1889 .id_table = snd_es1938_ids, 1889 .id_table = snd_es1938_ids,
1890 .probe = snd_es1938_probe, 1890 .probe = snd_es1938_probe,
1891 .remove = __devexit_p(snd_es1938_remove), 1891 .remove = snd_es1938_remove,
1892 .driver = { 1892 .driver = {
1893 .pm = ES1938_PM_OPS, 1893 .pm = ES1938_PM_OPS,
1894 }, 1894 },
diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c
index 7266020c16cb..a1f32b5ae0d1 100644
--- a/sound/pci/es1968.c
+++ b/sound/pci/es1968.c
@@ -1429,7 +1429,7 @@ static void snd_es1968_free_dmabuf(struct es1968 *chip)
1429 } 1429 }
1430} 1430}
1431 1431
1432static int __devinit 1432static int
1433snd_es1968_init_dmabuf(struct es1968 *chip) 1433snd_es1968_init_dmabuf(struct es1968 *chip)
1434{ 1434{
1435 int err; 1435 int err;
@@ -1704,7 +1704,7 @@ static struct snd_pcm_ops snd_es1968_capture_ops = {
1704 */ 1704 */
1705#define CLOCK_MEASURE_BUFSIZE 16768 /* enough large for a single shot */ 1705#define CLOCK_MEASURE_BUFSIZE 16768 /* enough large for a single shot */
1706 1706
1707static void __devinit es1968_measure_clock(struct es1968 *chip) 1707static void es1968_measure_clock(struct es1968 *chip)
1708{ 1708{
1709 int i, apu; 1709 int i, apu;
1710 unsigned int pa, offset, t; 1710 unsigned int pa, offset, t;
@@ -1806,7 +1806,7 @@ static void snd_es1968_pcm_free(struct snd_pcm *pcm)
1806 esm->pcm = NULL; 1806 esm->pcm = NULL;
1807} 1807}
1808 1808
1809static int __devinit 1809static int
1810snd_es1968_pcm(struct es1968 *chip, int device) 1810snd_es1968_pcm(struct es1968 *chip, int device)
1811{ 1811{
1812 struct snd_pcm *pcm; 1812 struct snd_pcm *pcm;
@@ -2016,7 +2016,7 @@ static irqreturn_t snd_es1968_interrupt(int irq, void *dev_id)
2016 * Mixer stuff 2016 * Mixer stuff
2017 */ 2017 */
2018 2018
2019static int __devinit 2019static int
2020snd_es1968_mixer(struct es1968 *chip) 2020snd_es1968_mixer(struct es1968 *chip)
2021{ 2021{
2022 struct snd_ac97_bus *pbus; 2022 struct snd_ac97_bus *pbus;
@@ -2291,7 +2291,7 @@ static void snd_es1968_chip_init(struct es1968 *chip)
2291 outb(0x88, iobase+0x1f); 2291 outb(0x88, iobase+0x1f);
2292 2292
2293 /* it appears some maestros (dell 7500) only work if these are set, 2293 /* it appears some maestros (dell 7500) only work if these are set,
2294 regardless of wether we use the assp or not. */ 2294 regardless of whether we use the assp or not. */
2295 2295
2296 outb(0, iobase + ASSP_CONTROL_B); 2296 outb(0, iobase + ASSP_CONTROL_B);
2297 outb(3, iobase + ASSP_CONTROL_A); /* M: Reserved bits... */ 2297 outb(3, iobase + ASSP_CONTROL_A); /* M: Reserved bits... */
@@ -2465,7 +2465,7 @@ static SIMPLE_DEV_PM_OPS(es1968_pm, es1968_suspend, es1968_resume);
2465 2465
2466#ifdef SUPPORT_JOYSTICK 2466#ifdef SUPPORT_JOYSTICK
2467#define JOYSTICK_ADDR 0x200 2467#define JOYSTICK_ADDR 0x200
2468static int __devinit snd_es1968_create_gameport(struct es1968 *chip, int dev) 2468static int snd_es1968_create_gameport(struct es1968 *chip, int dev)
2469{ 2469{
2470 struct gameport *gp; 2470 struct gameport *gp;
2471 struct resource *r; 2471 struct resource *r;
@@ -2516,7 +2516,7 @@ static inline void snd_es1968_free_gameport(struct es1968 *chip) { }
2516#endif 2516#endif
2517 2517
2518#ifdef CONFIG_SND_ES1968_INPUT 2518#ifdef CONFIG_SND_ES1968_INPUT
2519static int __devinit snd_es1968_input_register(struct es1968 *chip) 2519static int snd_es1968_input_register(struct es1968 *chip)
2520{ 2520{
2521 struct input_dev *input_dev; 2521 struct input_dev *input_dev;
2522 int err; 2522 int err;
@@ -2653,7 +2653,7 @@ struct ess_device_list {
2653 unsigned short vendor; /* subsystem vendor id */ 2653 unsigned short vendor; /* subsystem vendor id */
2654}; 2654};
2655 2655
2656static struct ess_device_list pm_whitelist[] __devinitdata = { 2656static struct ess_device_list pm_whitelist[] = {
2657 { TYPE_MAESTRO2E, 0x0e11 }, /* Compaq Armada */ 2657 { TYPE_MAESTRO2E, 0x0e11 }, /* Compaq Armada */
2658 { TYPE_MAESTRO2E, 0x1028 }, 2658 { TYPE_MAESTRO2E, 0x1028 },
2659 { TYPE_MAESTRO2E, 0x103c }, 2659 { TYPE_MAESTRO2E, 0x103c },
@@ -2664,19 +2664,19 @@ static struct ess_device_list pm_whitelist[] __devinitdata = {
2664 { TYPE_MAESTRO2, 0x125d }, /* a PCI card, e.g. SF64-PCE2 */ 2664 { TYPE_MAESTRO2, 0x125d }, /* a PCI card, e.g. SF64-PCE2 */
2665}; 2665};
2666 2666
2667static struct ess_device_list mpu_blacklist[] __devinitdata = { 2667static struct ess_device_list mpu_blacklist[] = {
2668 { TYPE_MAESTRO2, 0x125d }, 2668 { TYPE_MAESTRO2, 0x125d },
2669}; 2669};
2670 2670
2671static int __devinit snd_es1968_create(struct snd_card *card, 2671static int snd_es1968_create(struct snd_card *card,
2672 struct pci_dev *pci, 2672 struct pci_dev *pci,
2673 int total_bufsize, 2673 int total_bufsize,
2674 int play_streams, 2674 int play_streams,
2675 int capt_streams, 2675 int capt_streams,
2676 int chip_type, 2676 int chip_type,
2677 int do_pm, 2677 int do_pm,
2678 int radio_nr, 2678 int radio_nr,
2679 struct es1968 **chip_ret) 2679 struct es1968 **chip_ret)
2680{ 2680{
2681 static struct snd_device_ops ops = { 2681 static struct snd_device_ops ops = {
2682 .dev_free = snd_es1968_dev_free, 2682 .dev_free = snd_es1968_dev_free,
@@ -2795,8 +2795,8 @@ static int __devinit snd_es1968_create(struct snd_card *card,
2795 2795
2796/* 2796/*
2797 */ 2797 */
2798static int __devinit snd_es1968_probe(struct pci_dev *pci, 2798static int snd_es1968_probe(struct pci_dev *pci,
2799 const struct pci_device_id *pci_id) 2799 const struct pci_device_id *pci_id)
2800{ 2800{
2801 static int dev; 2801 static int dev;
2802 struct snd_card *card; 2802 struct snd_card *card;
@@ -2906,7 +2906,7 @@ static int __devinit snd_es1968_probe(struct pci_dev *pci,
2906 return 0; 2906 return 0;
2907} 2907}
2908 2908
2909static void __devexit snd_es1968_remove(struct pci_dev *pci) 2909static void snd_es1968_remove(struct pci_dev *pci)
2910{ 2910{
2911 snd_card_free(pci_get_drvdata(pci)); 2911 snd_card_free(pci_get_drvdata(pci));
2912 pci_set_drvdata(pci, NULL); 2912 pci_set_drvdata(pci, NULL);
@@ -2916,7 +2916,7 @@ static struct pci_driver es1968_driver = {
2916 .name = KBUILD_MODNAME, 2916 .name = KBUILD_MODNAME,
2917 .id_table = snd_es1968_ids, 2917 .id_table = snd_es1968_ids,
2918 .probe = snd_es1968_probe, 2918 .probe = snd_es1968_probe,
2919 .remove = __devexit_p(snd_es1968_remove), 2919 .remove = snd_es1968_remove,
2920 .driver = { 2920 .driver = {
2921 .pm = ES1968_PM_OPS, 2921 .pm = ES1968_PM_OPS,
2922 }, 2922 },
diff --git a/sound/pci/fm801.c b/sound/pci/fm801.c
index c5806f89be1e..4f07fda5adf2 100644
--- a/sound/pci/fm801.c
+++ b/sound/pci/fm801.c
@@ -689,7 +689,7 @@ static struct snd_pcm_ops snd_fm801_capture_ops = {
689 .pointer = snd_fm801_capture_pointer, 689 .pointer = snd_fm801_capture_pointer,
690}; 690};
691 691
692static int __devinit snd_fm801_pcm(struct fm801 *chip, int device, struct snd_pcm ** rpcm) 692static int snd_fm801_pcm(struct fm801 *chip, int device, struct snd_pcm **rpcm)
693{ 693{
694 struct snd_pcm *pcm; 694 struct snd_pcm *pcm;
695 int err; 695 int err;
@@ -984,7 +984,7 @@ static const DECLARE_TLV_DB_SCALE(db_scale_dsp, -3450, 150, 0);
984 984
985#define FM801_CONTROLS ARRAY_SIZE(snd_fm801_controls) 985#define FM801_CONTROLS ARRAY_SIZE(snd_fm801_controls)
986 986
987static struct snd_kcontrol_new snd_fm801_controls[] __devinitdata = { 987static struct snd_kcontrol_new snd_fm801_controls[] = {
988FM801_DOUBLE_TLV("Wave Playback Volume", FM801_PCM_VOL, 0, 8, 31, 1, 988FM801_DOUBLE_TLV("Wave Playback Volume", FM801_PCM_VOL, 0, 8, 31, 1,
989 db_scale_dsp), 989 db_scale_dsp),
990FM801_SINGLE("Wave Playback Switch", FM801_PCM_VOL, 15, 1, 1), 990FM801_SINGLE("Wave Playback Switch", FM801_PCM_VOL, 15, 1, 1),
@@ -1005,7 +1005,7 @@ FM801_SINGLE("FM Playback Switch", FM801_FM_VOL, 15, 1, 1),
1005 1005
1006#define FM801_CONTROLS_MULTI ARRAY_SIZE(snd_fm801_controls_multi) 1006#define FM801_CONTROLS_MULTI ARRAY_SIZE(snd_fm801_controls_multi)
1007 1007
1008static struct snd_kcontrol_new snd_fm801_controls_multi[] __devinitdata = { 1008static struct snd_kcontrol_new snd_fm801_controls_multi[] = {
1009FM801_SINGLE("AC97 2ch->4ch Copy Switch", FM801_CODEC_CTRL, 7, 1, 0), 1009FM801_SINGLE("AC97 2ch->4ch Copy Switch", FM801_CODEC_CTRL, 7, 1, 0),
1010FM801_SINGLE("AC97 18-bit Switch", FM801_CODEC_CTRL, 10, 1, 0), 1010FM801_SINGLE("AC97 18-bit Switch", FM801_CODEC_CTRL, 10, 1, 0),
1011FM801_SINGLE(SNDRV_CTL_NAME_IEC958("",CAPTURE,SWITCH), FM801_I2S_MODE, 8, 1, 0), 1011FM801_SINGLE(SNDRV_CTL_NAME_IEC958("",CAPTURE,SWITCH), FM801_I2S_MODE, 8, 1, 0),
@@ -1030,7 +1030,7 @@ static void snd_fm801_mixer_free_ac97(struct snd_ac97 *ac97)
1030 } 1030 }
1031} 1031}
1032 1032
1033static int __devinit snd_fm801_mixer(struct fm801 *chip) 1033static int snd_fm801_mixer(struct fm801 *chip)
1034{ 1034{
1035 struct snd_ac97_template ac97; 1035 struct snd_ac97_template ac97;
1036 unsigned int i; 1036 unsigned int i;
@@ -1191,11 +1191,11 @@ static int snd_fm801_dev_free(struct snd_device *device)
1191 return snd_fm801_free(chip); 1191 return snd_fm801_free(chip);
1192} 1192}
1193 1193
1194static int __devinit snd_fm801_create(struct snd_card *card, 1194static int snd_fm801_create(struct snd_card *card,
1195 struct pci_dev * pci, 1195 struct pci_dev *pci,
1196 int tea575x_tuner, 1196 int tea575x_tuner,
1197 int radio_nr, 1197 int radio_nr,
1198 struct fm801 ** rchip) 1198 struct fm801 **rchip)
1199{ 1199{
1200 struct fm801 *chip; 1200 struct fm801 *chip;
1201 int err; 1201 int err;
@@ -1296,8 +1296,8 @@ static int __devinit snd_fm801_create(struct snd_card *card,
1296 return 0; 1296 return 0;
1297} 1297}
1298 1298
1299static int __devinit snd_card_fm801_probe(struct pci_dev *pci, 1299static int snd_card_fm801_probe(struct pci_dev *pci,
1300 const struct pci_device_id *pci_id) 1300 const struct pci_device_id *pci_id)
1301{ 1301{
1302 static int dev; 1302 static int dev;
1303 struct snd_card *card; 1303 struct snd_card *card;
@@ -1367,7 +1367,7 @@ static int __devinit snd_card_fm801_probe(struct pci_dev *pci,
1367 return 0; 1367 return 0;
1368} 1368}
1369 1369
1370static void __devexit snd_card_fm801_remove(struct pci_dev *pci) 1370static void snd_card_fm801_remove(struct pci_dev *pci)
1371{ 1371{
1372 snd_card_free(pci_get_drvdata(pci)); 1372 snd_card_free(pci_get_drvdata(pci));
1373 pci_set_drvdata(pci, NULL); 1373 pci_set_drvdata(pci, NULL);
@@ -1439,7 +1439,7 @@ static struct pci_driver fm801_driver = {
1439 .name = KBUILD_MODNAME, 1439 .name = KBUILD_MODNAME,
1440 .id_table = snd_fm801_ids, 1440 .id_table = snd_fm801_ids,
1441 .probe = snd_card_fm801_probe, 1441 .probe = snd_card_fm801_probe,
1442 .remove = __devexit_p(snd_card_fm801_remove), 1442 .remove = snd_card_fm801_remove,
1443 .driver = { 1443 .driver = {
1444 .pm = SND_FM801_PM_OPS, 1444 .pm = SND_FM801_PM_OPS,
1445 }, 1445 },
diff --git a/sound/pci/hda/Kconfig b/sound/pci/hda/Kconfig
index 7105c3de1bca..6eeb8897624b 100644
--- a/sound/pci/hda/Kconfig
+++ b/sound/pci/hda/Kconfig
@@ -37,8 +37,8 @@ config SND_HDA_HWDEP
37 with codecs for debugging purposes. 37 with codecs for debugging purposes.
38 38
39config SND_HDA_RECONFIG 39config SND_HDA_RECONFIG
40 bool "Allow dynamic codec reconfiguration (EXPERIMENTAL)" 40 bool "Allow dynamic codec reconfiguration"
41 depends on SND_HDA_HWDEP && EXPERIMENTAL 41 depends on SND_HDA_HWDEP
42 help 42 help
43 Say Y here to enable the HD-audio codec re-configuration feature. 43 Say Y here to enable the HD-audio codec re-configuration feature.
44 This adds the sysfs interfaces to allow user to clear the whole 44 This adds the sysfs interfaces to allow user to clear the whole
@@ -72,7 +72,6 @@ config SND_HDA_INPUT_JACK
72 72
73config SND_HDA_PATCH_LOADER 73config SND_HDA_PATCH_LOADER
74 bool "Support initialization patch loading for HD-audio" 74 bool "Support initialization patch loading for HD-audio"
75 depends on EXPERIMENTAL
76 select FW_LOADER 75 select FW_LOADER
77 select SND_HDA_HWDEP 76 select SND_HDA_HWDEP
78 select SND_HDA_RECONFIG 77 select SND_HDA_RECONFIG
diff --git a/sound/pci/hda/Makefile b/sound/pci/hda/Makefile
index bd4149f1aaf4..24a251497a1f 100644
--- a/sound/pci/hda/Makefile
+++ b/sound/pci/hda/Makefile
@@ -8,6 +8,7 @@ snd-hda-codec-$(CONFIG_SND_HDA_INPUT_BEEP) += hda_beep.o
8 8
9# for trace-points 9# for trace-points
10CFLAGS_hda_codec.o := -I$(src) 10CFLAGS_hda_codec.o := -I$(src)
11CFLAGS_hda_intel.o := -I$(src)
11 12
12snd-hda-codec-realtek-objs := patch_realtek.o 13snd-hda-codec-realtek-objs := patch_realtek.o
13snd-hda-codec-cmedia-objs := patch_cmedia.o 14snd-hda-codec-cmedia-objs := patch_cmedia.o
diff --git a/sound/pci/hda/hda_auto_parser.c b/sound/pci/hda/hda_auto_parser.c
index 4ec6dc88b7f8..7da883a464e3 100644
--- a/sound/pci/hda/hda_auto_parser.c
+++ b/sound/pci/hda/hda_auto_parser.c
@@ -11,6 +11,7 @@
11 11
12#include <linux/slab.h> 12#include <linux/slab.h>
13#include <linux/export.h> 13#include <linux/export.h>
14#include <linux/sort.h>
14#include <sound/core.h> 15#include <sound/core.h>
15#include "hda_codec.h" 16#include "hda_codec.h"
16#include "hda_local.h" 17#include "hda_local.h"
@@ -30,29 +31,30 @@ static int is_in_nid_list(hda_nid_t nid, const hda_nid_t *list)
30 return 0; 31 return 0;
31} 32}
32 33
34/* a pair of input pin and its sequence */
35struct auto_out_pin {
36 hda_nid_t pin;
37 short seq;
38};
39
40static int compare_seq(const void *ap, const void *bp)
41{
42 const struct auto_out_pin *a = ap;
43 const struct auto_out_pin *b = bp;
44 return (int)(a->seq - b->seq);
45}
33 46
34/* 47/*
35 * Sort an associated group of pins according to their sequence numbers. 48 * Sort an associated group of pins according to their sequence numbers.
49 * then store it to a pin array.
36 */ 50 */
37static void sort_pins_by_sequence(hda_nid_t *pins, short *sequences, 51static void sort_pins_by_sequence(hda_nid_t *pins, struct auto_out_pin *list,
38 int num_pins) 52 int num_pins)
39{ 53{
40 int i, j; 54 int i;
41 short seq; 55 sort(list, num_pins, sizeof(list[0]), compare_seq, NULL);
42 hda_nid_t nid; 56 for (i = 0; i < num_pins; i++)
43 57 pins[i] = list[i].pin;
44 for (i = 0; i < num_pins; i++) {
45 for (j = i + 1; j < num_pins; j++) {
46 if (sequences[i] > sequences[j]) {
47 seq = sequences[i];
48 sequences[i] = sequences[j];
49 sequences[j] = seq;
50 nid = pins[i];
51 pins[i] = pins[j];
52 pins[j] = nid;
53 }
54 }
55 }
56} 58}
57 59
58 60
@@ -67,21 +69,11 @@ static void add_auto_cfg_input_pin(struct auto_pin_cfg *cfg, hda_nid_t nid,
67 } 69 }
68} 70}
69 71
70/* sort inputs in the order of AUTO_PIN_* type */ 72static int compare_input_type(const void *ap, const void *bp)
71static void sort_autocfg_input_pins(struct auto_pin_cfg *cfg)
72{ 73{
73 int i, j; 74 const struct auto_pin_cfg_item *a = ap;
74 75 const struct auto_pin_cfg_item *b = bp;
75 for (i = 0; i < cfg->num_inputs; i++) { 76 return (int)(a->type - b->type);
76 for (j = i + 1; j < cfg->num_inputs; j++) {
77 if (cfg->inputs[i].type > cfg->inputs[j].type) {
78 struct auto_pin_cfg_item tmp;
79 tmp = cfg->inputs[i];
80 cfg->inputs[i] = cfg->inputs[j];
81 cfg->inputs[j] = tmp;
82 }
83 }
84 }
85} 77}
86 78
87/* Reorder the surround channels 79/* Reorder the surround channels
@@ -129,16 +121,16 @@ int snd_hda_parse_pin_defcfg(struct hda_codec *codec,
129{ 121{
130 hda_nid_t nid, end_nid; 122 hda_nid_t nid, end_nid;
131 short seq, assoc_line_out; 123 short seq, assoc_line_out;
132 short sequences_line_out[ARRAY_SIZE(cfg->line_out_pins)]; 124 struct auto_out_pin line_out[ARRAY_SIZE(cfg->line_out_pins)];
133 short sequences_speaker[ARRAY_SIZE(cfg->speaker_pins)]; 125 struct auto_out_pin speaker_out[ARRAY_SIZE(cfg->speaker_pins)];
134 short sequences_hp[ARRAY_SIZE(cfg->hp_pins)]; 126 struct auto_out_pin hp_out[ARRAY_SIZE(cfg->hp_pins)];
135 int i; 127 int i;
136 128
137 memset(cfg, 0, sizeof(*cfg)); 129 memset(cfg, 0, sizeof(*cfg));
138 130
139 memset(sequences_line_out, 0, sizeof(sequences_line_out)); 131 memset(line_out, 0, sizeof(line_out));
140 memset(sequences_speaker, 0, sizeof(sequences_speaker)); 132 memset(speaker_out, 0, sizeof(speaker_out));
141 memset(sequences_hp, 0, sizeof(sequences_hp)); 133 memset(hp_out, 0, sizeof(hp_out));
142 assoc_line_out = 0; 134 assoc_line_out = 0;
143 135
144 end_nid = codec->start_nid + codec->num_nodes; 136 end_nid = codec->start_nid + codec->num_nodes;
@@ -184,8 +176,8 @@ int snd_hda_parse_pin_defcfg(struct hda_codec *codec,
184 continue; 176 continue;
185 if (cfg->line_outs >= ARRAY_SIZE(cfg->line_out_pins)) 177 if (cfg->line_outs >= ARRAY_SIZE(cfg->line_out_pins))
186 continue; 178 continue;
187 cfg->line_out_pins[cfg->line_outs] = nid; 179 line_out[cfg->line_outs].pin = nid;
188 sequences_line_out[cfg->line_outs] = seq; 180 line_out[cfg->line_outs].seq = seq;
189 cfg->line_outs++; 181 cfg->line_outs++;
190 break; 182 break;
191 case AC_JACK_SPEAKER: 183 case AC_JACK_SPEAKER:
@@ -193,8 +185,8 @@ int snd_hda_parse_pin_defcfg(struct hda_codec *codec,
193 assoc = get_defcfg_association(def_conf); 185 assoc = get_defcfg_association(def_conf);
194 if (cfg->speaker_outs >= ARRAY_SIZE(cfg->speaker_pins)) 186 if (cfg->speaker_outs >= ARRAY_SIZE(cfg->speaker_pins))
195 continue; 187 continue;
196 cfg->speaker_pins[cfg->speaker_outs] = nid; 188 speaker_out[cfg->speaker_outs].pin = nid;
197 sequences_speaker[cfg->speaker_outs] = (assoc << 4) | seq; 189 speaker_out[cfg->speaker_outs].seq = (assoc << 4) | seq;
198 cfg->speaker_outs++; 190 cfg->speaker_outs++;
199 break; 191 break;
200 case AC_JACK_HP_OUT: 192 case AC_JACK_HP_OUT:
@@ -202,8 +194,8 @@ int snd_hda_parse_pin_defcfg(struct hda_codec *codec,
202 assoc = get_defcfg_association(def_conf); 194 assoc = get_defcfg_association(def_conf);
203 if (cfg->hp_outs >= ARRAY_SIZE(cfg->hp_pins)) 195 if (cfg->hp_outs >= ARRAY_SIZE(cfg->hp_pins))
204 continue; 196 continue;
205 cfg->hp_pins[cfg->hp_outs] = nid; 197 hp_out[cfg->hp_outs].pin = nid;
206 sequences_hp[cfg->hp_outs] = (assoc << 4) | seq; 198 hp_out[cfg->hp_outs].seq = (assoc << 4) | seq;
207 cfg->hp_outs++; 199 cfg->hp_outs++;
208 break; 200 break;
209 case AC_JACK_MIC_IN: 201 case AC_JACK_MIC_IN:
@@ -248,34 +240,28 @@ int snd_hda_parse_pin_defcfg(struct hda_codec *codec,
248 int i = 0; 240 int i = 0;
249 while (i < cfg->hp_outs) { 241 while (i < cfg->hp_outs) {
250 /* The real HPs should have the sequence 0x0f */ 242 /* The real HPs should have the sequence 0x0f */
251 if ((sequences_hp[i] & 0x0f) == 0x0f) { 243 if ((hp_out[i].seq & 0x0f) == 0x0f) {
252 i++; 244 i++;
253 continue; 245 continue;
254 } 246 }
255 /* Move it to the line-out table */ 247 /* Move it to the line-out table */
256 cfg->line_out_pins[cfg->line_outs] = cfg->hp_pins[i]; 248 line_out[cfg->line_outs++] = hp_out[i];
257 sequences_line_out[cfg->line_outs] = sequences_hp[i];
258 cfg->line_outs++;
259 cfg->hp_outs--; 249 cfg->hp_outs--;
260 memmove(cfg->hp_pins + i, cfg->hp_pins + i + 1, 250 memmove(hp_out + i, hp_out + i + 1,
261 sizeof(cfg->hp_pins[0]) * (cfg->hp_outs - i)); 251 sizeof(hp_out[0]) * (cfg->hp_outs - i));
262 memmove(sequences_hp + i, sequences_hp + i + 1,
263 sizeof(sequences_hp[0]) * (cfg->hp_outs - i));
264 } 252 }
265 memset(cfg->hp_pins + cfg->hp_outs, 0, 253 memset(hp_out + cfg->hp_outs, 0,
266 sizeof(hda_nid_t) * (AUTO_CFG_MAX_OUTS - cfg->hp_outs)); 254 sizeof(hp_out[0]) * (AUTO_CFG_MAX_OUTS - cfg->hp_outs));
267 if (!cfg->hp_outs) 255 if (!cfg->hp_outs)
268 cfg->line_out_type = AUTO_PIN_HP_OUT; 256 cfg->line_out_type = AUTO_PIN_HP_OUT;
269 257
270 } 258 }
271 259
272 /* sort by sequence */ 260 /* sort by sequence */
273 sort_pins_by_sequence(cfg->line_out_pins, sequences_line_out, 261 sort_pins_by_sequence(cfg->line_out_pins, line_out, cfg->line_outs);
274 cfg->line_outs); 262 sort_pins_by_sequence(cfg->speaker_pins, speaker_out,
275 sort_pins_by_sequence(cfg->speaker_pins, sequences_speaker,
276 cfg->speaker_outs); 263 cfg->speaker_outs);
277 sort_pins_by_sequence(cfg->hp_pins, sequences_hp, 264 sort_pins_by_sequence(cfg->hp_pins, hp_out, cfg->hp_outs);
278 cfg->hp_outs);
279 265
280 /* 266 /*
281 * FIX-UP: if no line-outs are detected, try to use speaker or HP pin 267 * FIX-UP: if no line-outs are detected, try to use speaker or HP pin
@@ -304,7 +290,9 @@ int snd_hda_parse_pin_defcfg(struct hda_codec *codec,
304 reorder_outputs(cfg->hp_outs, cfg->hp_pins); 290 reorder_outputs(cfg->hp_outs, cfg->hp_pins);
305 reorder_outputs(cfg->speaker_outs, cfg->speaker_pins); 291 reorder_outputs(cfg->speaker_outs, cfg->speaker_pins);
306 292
307 sort_autocfg_input_pins(cfg); 293 /* sort inputs in the order of AUTO_PIN_* type */
294 sort(cfg->inputs, cfg->num_inputs, sizeof(cfg->inputs[0]),
295 compare_input_type, NULL);
308 296
309 /* 297 /*
310 * debug prints of the parsed results 298 * debug prints of the parsed results
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index d010de12335e..b8fb0a5adb9b 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -738,7 +738,7 @@ static int snd_hda_bus_dev_register(struct snd_device *device)
738 * 738 *
739 * Returns 0 if successful, or a negative error code. 739 * Returns 0 if successful, or a negative error code.
740 */ 740 */
741int /*__devinit*/ snd_hda_bus_new(struct snd_card *card, 741int snd_hda_bus_new(struct snd_card *card,
742 const struct hda_bus_template *temp, 742 const struct hda_bus_template *temp,
743 struct hda_bus **busp) 743 struct hda_bus **busp)
744{ 744{
@@ -908,7 +908,7 @@ static int get_codec_name(struct hda_codec *codec)
908/* 908/*
909 * look for an AFG and MFG nodes 909 * look for an AFG and MFG nodes
910 */ 910 */
911static void /*__devinit*/ setup_fg_nodes(struct hda_codec *codec) 911static void setup_fg_nodes(struct hda_codec *codec)
912{ 912{
913 int i, total_nodes, function_id; 913 int i, total_nodes, function_id;
914 hda_nid_t nid; 914 hda_nid_t nid;
@@ -993,19 +993,6 @@ static struct hda_pincfg *look_up_pincfg(struct hda_codec *codec,
993 return NULL; 993 return NULL;
994} 994}
995 995
996/* write a config value for the given NID */
997static void set_pincfg(struct hda_codec *codec, hda_nid_t nid,
998 unsigned int cfg)
999{
1000 int i;
1001 for (i = 0; i < 4; i++) {
1002 snd_hda_codec_write(codec, nid, 0,
1003 AC_VERB_SET_CONFIG_DEFAULT_BYTES_0 + i,
1004 cfg & 0xff);
1005 cfg >>= 8;
1006 }
1007}
1008
1009/* set the current pin config value for the given NID. 996/* set the current pin config value for the given NID.
1010 * the value is cached, and read via snd_hda_codec_get_pincfg() 997 * the value is cached, and read via snd_hda_codec_get_pincfg()
1011 */ 998 */
@@ -1013,12 +1000,10 @@ int snd_hda_add_pincfg(struct hda_codec *codec, struct snd_array *list,
1013 hda_nid_t nid, unsigned int cfg) 1000 hda_nid_t nid, unsigned int cfg)
1014{ 1001{
1015 struct hda_pincfg *pin; 1002 struct hda_pincfg *pin;
1016 unsigned int oldcfg;
1017 1003
1018 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) 1004 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
1019 return -EINVAL; 1005 return -EINVAL;
1020 1006
1021 oldcfg = snd_hda_codec_get_pincfg(codec, nid);
1022 pin = look_up_pincfg(codec, list, nid); 1007 pin = look_up_pincfg(codec, list, nid);
1023 if (!pin) { 1008 if (!pin) {
1024 pin = snd_array_new(list); 1009 pin = snd_array_new(list);
@@ -1027,13 +1012,6 @@ int snd_hda_add_pincfg(struct hda_codec *codec, struct snd_array *list,
1027 pin->nid = nid; 1012 pin->nid = nid;
1028 } 1013 }
1029 pin->cfg = cfg; 1014 pin->cfg = cfg;
1030
1031 /* change only when needed; e.g. if the pincfg is already present
1032 * in user_pins[], don't write it
1033 */
1034 cfg = snd_hda_codec_get_pincfg(codec, nid);
1035 if (oldcfg != cfg)
1036 set_pincfg(codec, nid, cfg);
1037 return 0; 1015 return 0;
1038} 1016}
1039 1017
@@ -1082,17 +1060,6 @@ unsigned int snd_hda_codec_get_pincfg(struct hda_codec *codec, hda_nid_t nid)
1082} 1060}
1083EXPORT_SYMBOL_HDA(snd_hda_codec_get_pincfg); 1061EXPORT_SYMBOL_HDA(snd_hda_codec_get_pincfg);
1084 1062
1085/* restore all current pin configs */
1086static void restore_pincfgs(struct hda_codec *codec)
1087{
1088 int i;
1089 for (i = 0; i < codec->init_pins.used; i++) {
1090 struct hda_pincfg *pin = snd_array_elem(&codec->init_pins, i);
1091 set_pincfg(codec, pin->nid,
1092 snd_hda_codec_get_pincfg(codec, pin->nid));
1093 }
1094}
1095
1096/** 1063/**
1097 * snd_hda_shutup_pins - Shut up all pins 1064 * snd_hda_shutup_pins - Shut up all pins
1098 * @codec: the HDA codec 1065 * @codec: the HDA codec
@@ -1137,21 +1104,30 @@ static void restore_shutup_pins(struct hda_codec *codec)
1137} 1104}
1138#endif 1105#endif
1139 1106
1107static void hda_jackpoll_work(struct work_struct *work)
1108{
1109 struct hda_codec *codec =
1110 container_of(work, struct hda_codec, jackpoll_work.work);
1111 if (!codec->jackpoll_interval)
1112 return;
1113
1114 snd_hda_jack_set_dirty_all(codec);
1115 snd_hda_jack_poll_all(codec);
1116 queue_delayed_work(codec->bus->workq, &codec->jackpoll_work,
1117 codec->jackpoll_interval);
1118}
1119
1140static void init_hda_cache(struct hda_cache_rec *cache, 1120static void init_hda_cache(struct hda_cache_rec *cache,
1141 unsigned int record_size); 1121 unsigned int record_size);
1142static void free_hda_cache(struct hda_cache_rec *cache); 1122static void free_hda_cache(struct hda_cache_rec *cache);
1143 1123
1144/* restore the initial pin cfgs and release all pincfg lists */ 1124/* release all pincfg lists */
1145static void restore_init_pincfgs(struct hda_codec *codec) 1125static void free_init_pincfgs(struct hda_codec *codec)
1146{ 1126{
1147 /* first free driver_pins and user_pins, then call restore_pincfg
1148 * so that only the values in init_pins are restored
1149 */
1150 snd_array_free(&codec->driver_pins); 1127 snd_array_free(&codec->driver_pins);
1151#ifdef CONFIG_SND_HDA_HWDEP 1128#ifdef CONFIG_SND_HDA_HWDEP
1152 snd_array_free(&codec->user_pins); 1129 snd_array_free(&codec->user_pins);
1153#endif 1130#endif
1154 restore_pincfgs(codec);
1155 snd_array_free(&codec->init_pins); 1131 snd_array_free(&codec->init_pins);
1156} 1132}
1157 1133
@@ -1192,8 +1168,9 @@ static void snd_hda_codec_free(struct hda_codec *codec)
1192{ 1168{
1193 if (!codec) 1169 if (!codec)
1194 return; 1170 return;
1171 cancel_delayed_work_sync(&codec->jackpoll_work);
1195 snd_hda_jack_tbl_clear(codec); 1172 snd_hda_jack_tbl_clear(codec);
1196 restore_init_pincfgs(codec); 1173 free_init_pincfgs(codec);
1197#ifdef CONFIG_PM 1174#ifdef CONFIG_PM
1198 cancel_delayed_work(&codec->power_work); 1175 cancel_delayed_work(&codec->power_work);
1199 flush_workqueue(codec->bus->workq); 1176 flush_workqueue(codec->bus->workq);
@@ -1235,7 +1212,7 @@ static unsigned int hda_set_power_state(struct hda_codec *codec,
1235 * 1212 *
1236 * Returns 0 if successful, or a negative error code. 1213 * Returns 0 if successful, or a negative error code.
1237 */ 1214 */
1238int /*__devinit*/ snd_hda_codec_new(struct hda_bus *bus, 1215int snd_hda_codec_new(struct hda_bus *bus,
1239 unsigned int codec_addr, 1216 unsigned int codec_addr,
1240 struct hda_codec **codecp) 1217 struct hda_codec **codecp)
1241{ 1218{
@@ -1275,6 +1252,8 @@ int /*__devinit*/ snd_hda_codec_new(struct hda_bus *bus,
1275 snd_array_init(&codec->cvt_setups, sizeof(struct hda_cvt_setup), 8); 1252 snd_array_init(&codec->cvt_setups, sizeof(struct hda_cvt_setup), 8);
1276 snd_array_init(&codec->conn_lists, sizeof(hda_nid_t), 64); 1253 snd_array_init(&codec->conn_lists, sizeof(hda_nid_t), 64);
1277 snd_array_init(&codec->spdif_out, sizeof(struct hda_spdif_out), 16); 1254 snd_array_init(&codec->spdif_out, sizeof(struct hda_spdif_out), 16);
1255 snd_array_init(&codec->jacktbl, sizeof(struct hda_jack_tbl), 16);
1256 INIT_DELAYED_WORK(&codec->jackpoll_work, hda_jackpoll_work);
1278 1257
1279#ifdef CONFIG_PM 1258#ifdef CONFIG_PM
1280 spin_lock_init(&codec->power_lock); 1259 spin_lock_init(&codec->power_lock);
@@ -1588,7 +1567,7 @@ static void hda_cleanup_all_streams(struct hda_codec *codec)
1588#define INFO_AMP_VOL(ch) (1 << (1 + (ch))) 1567#define INFO_AMP_VOL(ch) (1 << (1 + (ch)))
1589 1568
1590/* initialize the hash table */ 1569/* initialize the hash table */
1591static void /*__devinit*/ init_hda_cache(struct hda_cache_rec *cache, 1570static void init_hda_cache(struct hda_cache_rec *cache,
1592 unsigned int record_size) 1571 unsigned int record_size)
1593{ 1572{
1594 memset(cache, 0, sizeof(*cache)); 1573 memset(cache, 0, sizeof(*cache));
@@ -2153,12 +2132,12 @@ EXPORT_SYMBOL_HDA(snd_hda_set_vmaster_tlv);
2153 2132
2154/* find a mixer control element with the given name */ 2133/* find a mixer control element with the given name */
2155static struct snd_kcontrol * 2134static struct snd_kcontrol *
2156_snd_hda_find_mixer_ctl(struct hda_codec *codec, 2135find_mixer_ctl(struct hda_codec *codec, const char *name, int dev, int idx)
2157 const char *name, int idx)
2158{ 2136{
2159 struct snd_ctl_elem_id id; 2137 struct snd_ctl_elem_id id;
2160 memset(&id, 0, sizeof(id)); 2138 memset(&id, 0, sizeof(id));
2161 id.iface = SNDRV_CTL_ELEM_IFACE_MIXER; 2139 id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
2140 id.device = dev;
2162 id.index = idx; 2141 id.index = idx;
2163 if (snd_BUG_ON(strlen(name) >= sizeof(id.name))) 2142 if (snd_BUG_ON(strlen(name) >= sizeof(id.name)))
2164 return NULL; 2143 return NULL;
@@ -2176,15 +2155,16 @@ _snd_hda_find_mixer_ctl(struct hda_codec *codec,
2176struct snd_kcontrol *snd_hda_find_mixer_ctl(struct hda_codec *codec, 2155struct snd_kcontrol *snd_hda_find_mixer_ctl(struct hda_codec *codec,
2177 const char *name) 2156 const char *name)
2178{ 2157{
2179 return _snd_hda_find_mixer_ctl(codec, name, 0); 2158 return find_mixer_ctl(codec, name, 0, 0);
2180} 2159}
2181EXPORT_SYMBOL_HDA(snd_hda_find_mixer_ctl); 2160EXPORT_SYMBOL_HDA(snd_hda_find_mixer_ctl);
2182 2161
2183static int find_empty_mixer_ctl_idx(struct hda_codec *codec, const char *name) 2162static int find_empty_mixer_ctl_idx(struct hda_codec *codec, const char *name,
2163 int dev)
2184{ 2164{
2185 int idx; 2165 int idx;
2186 for (idx = 0; idx < 16; idx++) { /* 16 ctlrs should be large enough */ 2166 for (idx = 0; idx < 16; idx++) { /* 16 ctlrs should be large enough */
2187 if (!_snd_hda_find_mixer_ctl(codec, name, idx)) 2167 if (!find_mixer_ctl(codec, name, dev, idx))
2188 return idx; 2168 return idx;
2189 } 2169 }
2190 return -EBUSY; 2170 return -EBUSY;
@@ -2351,7 +2331,7 @@ int snd_hda_codec_reset(struct hda_codec *codec)
2351 return -EBUSY; 2331 return -EBUSY;
2352 2332
2353 /* OK, let it free */ 2333 /* OK, let it free */
2354 2334 cancel_delayed_work_sync(&codec->jackpoll_work);
2355#ifdef CONFIG_PM 2335#ifdef CONFIG_PM
2356 cancel_delayed_work_sync(&codec->power_work); 2336 cancel_delayed_work_sync(&codec->power_work);
2357 codec->power_on = 0; 2337 codec->power_on = 0;
@@ -2380,7 +2360,6 @@ int snd_hda_codec_reset(struct hda_codec *codec)
2380 init_hda_cache(&codec->cmd_cache, sizeof(struct hda_cache_head)); 2360 init_hda_cache(&codec->cmd_cache, sizeof(struct hda_cache_head));
2381 /* free only driver_pins so that init_pins + user_pins are restored */ 2361 /* free only driver_pins so that init_pins + user_pins are restored */
2382 snd_array_free(&codec->driver_pins); 2362 snd_array_free(&codec->driver_pins);
2383 restore_pincfgs(codec);
2384 snd_array_free(&codec->cvt_setups); 2363 snd_array_free(&codec->cvt_setups);
2385 snd_array_free(&codec->spdif_out); 2364 snd_array_free(&codec->spdif_out);
2386 codec->num_pcms = 0; 2365 codec->num_pcms = 0;
@@ -2552,7 +2531,7 @@ static int vmaster_mute_mode_info(struct snd_kcontrol *kcontrol,
2552 struct snd_ctl_elem_info *uinfo) 2531 struct snd_ctl_elem_info *uinfo)
2553{ 2532{
2554 static const char * const texts[] = { 2533 static const char * const texts[] = {
2555 "Off", "On", "Follow Master" 2534 "On", "Off", "Follow Master"
2556 }; 2535 };
2557 unsigned int index; 2536 unsigned int index;
2558 2537
@@ -3135,26 +3114,48 @@ static struct snd_kcontrol_new dig_mixes[] = {
3135}; 3114};
3136 3115
3137/** 3116/**
3138 * snd_hda_create_spdif_out_ctls - create Output SPDIF-related controls 3117 * snd_hda_create_dig_out_ctls - create Output SPDIF-related controls
3139 * @codec: the HDA codec 3118 * @codec: the HDA codec
3140 * @nid: audio out widget NID 3119 * @associated_nid: NID that new ctls associated with
3141 * 3120 * @cvt_nid: converter NID
3142 * Creates controls related with the SPDIF output. 3121 * @type: HDA_PCM_TYPE_*
3143 * Called from each patch supporting the SPDIF out. 3122 * Creates controls related with the digital output.
3123 * Called from each patch supporting the digital out.
3144 * 3124 *
3145 * Returns 0 if successful, or a negative error code. 3125 * Returns 0 if successful, or a negative error code.
3146 */ 3126 */
3147int snd_hda_create_spdif_out_ctls(struct hda_codec *codec, 3127int snd_hda_create_dig_out_ctls(struct hda_codec *codec,
3148 hda_nid_t associated_nid, 3128 hda_nid_t associated_nid,
3149 hda_nid_t cvt_nid) 3129 hda_nid_t cvt_nid,
3130 int type)
3150{ 3131{
3151 int err; 3132 int err;
3152 struct snd_kcontrol *kctl; 3133 struct snd_kcontrol *kctl;
3153 struct snd_kcontrol_new *dig_mix; 3134 struct snd_kcontrol_new *dig_mix;
3154 int idx; 3135 int idx, dev = 0;
3136 const int spdif_pcm_dev = 1;
3155 struct hda_spdif_out *spdif; 3137 struct hda_spdif_out *spdif;
3156 3138
3157 idx = find_empty_mixer_ctl_idx(codec, "IEC958 Playback Switch"); 3139 if (codec->primary_dig_out_type == HDA_PCM_TYPE_HDMI &&
3140 type == HDA_PCM_TYPE_SPDIF) {
3141 dev = spdif_pcm_dev;
3142 } else if (codec->primary_dig_out_type == HDA_PCM_TYPE_SPDIF &&
3143 type == HDA_PCM_TYPE_HDMI) {
3144 for (idx = 0; idx < codec->spdif_out.used; idx++) {
3145 spdif = snd_array_elem(&codec->spdif_out, idx);
3146 for (dig_mix = dig_mixes; dig_mix->name; dig_mix++) {
3147 kctl = find_mixer_ctl(codec, dig_mix->name, 0, idx);
3148 if (!kctl)
3149 break;
3150 kctl->id.device = spdif_pcm_dev;
3151 }
3152 }
3153 codec->primary_dig_out_type = HDA_PCM_TYPE_HDMI;
3154 }
3155 if (!codec->primary_dig_out_type)
3156 codec->primary_dig_out_type = type;
3157
3158 idx = find_empty_mixer_ctl_idx(codec, "IEC958 Playback Switch", dev);
3158 if (idx < 0) { 3159 if (idx < 0) {
3159 printk(KERN_ERR "hda_codec: too many IEC958 outputs\n"); 3160 printk(KERN_ERR "hda_codec: too many IEC958 outputs\n");
3160 return -EBUSY; 3161 return -EBUSY;
@@ -3164,6 +3165,7 @@ int snd_hda_create_spdif_out_ctls(struct hda_codec *codec,
3164 kctl = snd_ctl_new1(dig_mix, codec); 3165 kctl = snd_ctl_new1(dig_mix, codec);
3165 if (!kctl) 3166 if (!kctl)
3166 return -ENOMEM; 3167 return -ENOMEM;
3168 kctl->id.device = dev;
3167 kctl->id.index = idx; 3169 kctl->id.index = idx;
3168 kctl->private_value = codec->spdif_out.used - 1; 3170 kctl->private_value = codec->spdif_out.used - 1;
3169 err = snd_hda_ctl_add(codec, associated_nid, kctl); 3171 err = snd_hda_ctl_add(codec, associated_nid, kctl);
@@ -3176,7 +3178,7 @@ int snd_hda_create_spdif_out_ctls(struct hda_codec *codec,
3176 spdif->status = convert_to_spdif_status(spdif->ctls); 3178 spdif->status = convert_to_spdif_status(spdif->ctls);
3177 return 0; 3179 return 0;
3178} 3180}
3179EXPORT_SYMBOL_HDA(snd_hda_create_spdif_out_ctls); 3181EXPORT_SYMBOL_HDA(snd_hda_create_dig_out_ctls);
3180 3182
3181/* get the hda_spdif_out entry from the given NID 3183/* get the hda_spdif_out entry from the given NID
3182 * call within spdif_mutex lock 3184 * call within spdif_mutex lock
@@ -3351,7 +3353,7 @@ int snd_hda_create_spdif_in_ctls(struct hda_codec *codec, hda_nid_t nid)
3351 struct snd_kcontrol_new *dig_mix; 3353 struct snd_kcontrol_new *dig_mix;
3352 int idx; 3354 int idx;
3353 3355
3354 idx = find_empty_mixer_ctl_idx(codec, "IEC958 Capture Switch"); 3356 idx = find_empty_mixer_ctl_idx(codec, "IEC958 Capture Switch", 0);
3355 if (idx < 0) { 3357 if (idx < 0) {
3356 printk(KERN_ERR "hda_codec: too many IEC958 inputs\n"); 3358 printk(KERN_ERR "hda_codec: too many IEC958 inputs\n");
3357 return -EBUSY; 3359 return -EBUSY;
@@ -3650,10 +3652,8 @@ static void hda_call_codec_resume(struct hda_codec *codec)
3650 */ 3652 */
3651 hda_keep_power_on(codec); 3653 hda_keep_power_on(codec);
3652 hda_set_power_state(codec, AC_PWRST_D0); 3654 hda_set_power_state(codec, AC_PWRST_D0);
3653 restore_pincfgs(codec); /* restore all current pin configs */
3654 restore_shutup_pins(codec); 3655 restore_shutup_pins(codec);
3655 hda_exec_init_verbs(codec); 3656 hda_exec_init_verbs(codec);
3656 snd_hda_jack_set_dirty_all(codec);
3657 if (codec->patch_ops.resume) 3657 if (codec->patch_ops.resume)
3658 codec->patch_ops.resume(codec); 3658 codec->patch_ops.resume(codec);
3659 else { 3659 else {
@@ -3662,7 +3662,13 @@ static void hda_call_codec_resume(struct hda_codec *codec)
3662 snd_hda_codec_resume_amp(codec); 3662 snd_hda_codec_resume_amp(codec);
3663 snd_hda_codec_resume_cache(codec); 3663 snd_hda_codec_resume_cache(codec);
3664 } 3664 }
3665 snd_hda_jack_report_sync(codec); 3665
3666 if (codec->jackpoll_interval)
3667 hda_jackpoll_work(&codec->jackpoll_work.work);
3668 else {
3669 snd_hda_jack_set_dirty_all(codec);
3670 snd_hda_jack_report_sync(codec);
3671 }
3666 3672
3667 codec->in_pm = 0; 3673 codec->in_pm = 0;
3668 snd_hda_power_down(codec); /* flag down before returning */ 3674 snd_hda_power_down(codec); /* flag down before returning */
@@ -3678,7 +3684,7 @@ static void hda_call_codec_resume(struct hda_codec *codec)
3678 * 3684 *
3679 * Returns 0 if successful, otherwise a negative error code. 3685 * Returns 0 if successful, otherwise a negative error code.
3680 */ 3686 */
3681int /*__devinit*/ snd_hda_build_controls(struct hda_bus *bus) 3687int snd_hda_build_controls(struct hda_bus *bus)
3682{ 3688{
3683 struct hda_codec *codec; 3689 struct hda_codec *codec;
3684 3690
@@ -3712,13 +3718,14 @@ static int add_std_chmaps(struct hda_codec *codec)
3712 struct hda_pcm_stream *hinfo = 3718 struct hda_pcm_stream *hinfo =
3713 &codec->pcm_info[i].stream[str]; 3719 &codec->pcm_info[i].stream[str];
3714 struct snd_pcm_chmap *chmap; 3720 struct snd_pcm_chmap *chmap;
3721 const struct snd_pcm_chmap_elem *elem;
3715 3722
3716 if (codec->pcm_info[i].own_chmap) 3723 if (codec->pcm_info[i].own_chmap)
3717 continue; 3724 continue;
3718 if (!pcm || !hinfo->substreams) 3725 if (!pcm || !hinfo->substreams)
3719 continue; 3726 continue;
3720 err = snd_pcm_add_chmap_ctls(pcm, str, 3727 elem = hinfo->chmap ? hinfo->chmap : snd_pcm_std_chmaps;
3721 snd_pcm_std_chmaps, 3728 err = snd_pcm_add_chmap_ctls(pcm, str, elem,
3722 hinfo->channels_max, 3729 hinfo->channels_max,
3723 0, &chmap); 3730 0, &chmap);
3724 if (err < 0) 3731 if (err < 0)
@@ -3729,6 +3736,19 @@ static int add_std_chmaps(struct hda_codec *codec)
3729 return 0; 3736 return 0;
3730} 3737}
3731 3738
3739/* default channel maps for 2.1 speakers;
3740 * since HD-audio supports only stereo, odd number channels are omitted
3741 */
3742const struct snd_pcm_chmap_elem snd_pcm_2_1_chmaps[] = {
3743 { .channels = 2,
3744 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR } },
3745 { .channels = 4,
3746 .map = { SNDRV_CHMAP_FL, SNDRV_CHMAP_FR,
3747 SNDRV_CHMAP_LFE, SNDRV_CHMAP_LFE } },
3748 { }
3749};
3750EXPORT_SYMBOL_GPL(snd_pcm_2_1_chmaps);
3751
3732int snd_hda_codec_build_controls(struct hda_codec *codec) 3752int snd_hda_codec_build_controls(struct hda_codec *codec)
3733{ 3753{
3734 int err = 0; 3754 int err = 0;
@@ -3746,7 +3766,10 @@ int snd_hda_codec_build_controls(struct hda_codec *codec)
3746 if (err < 0) 3766 if (err < 0)
3747 return err; 3767 return err;
3748 3768
3749 snd_hda_jack_report_sync(codec); /* call at the last init point */ 3769 if (codec->jackpoll_interval)
3770 hda_jackpoll_work(&codec->jackpoll_work.work);
3771 else
3772 snd_hda_jack_report_sync(codec); /* call at the last init point */
3750 return 0; 3773 return 0;
3751} 3774}
3752 3775
@@ -4458,7 +4481,7 @@ int snd_hda_add_new_ctls(struct hda_codec *codec,
4458 addr = codec->addr; 4481 addr = codec->addr;
4459 else if (!idx && !knew->index) { 4482 else if (!idx && !knew->index) {
4460 idx = find_empty_mixer_ctl_idx(codec, 4483 idx = find_empty_mixer_ctl_idx(codec,
4461 knew->name); 4484 knew->name, 0);
4462 if (idx <= 0) 4485 if (idx <= 0)
4463 return err; 4486 return err;
4464 } else 4487 } else
@@ -4771,6 +4794,34 @@ EXPORT_SYMBOL_HDA(snd_hda_input_mux_put);
4771 4794
4772 4795
4773/* 4796/*
4797 * process kcontrol info callback of a simple string enum array
4798 * when @num_items is 0 or @texts is NULL, assume a boolean enum array
4799 */
4800int snd_hda_enum_helper_info(struct snd_kcontrol *kcontrol,
4801 struct snd_ctl_elem_info *uinfo,
4802 int num_items, const char * const *texts)
4803{
4804 static const char * const texts_default[] = {
4805 "Disabled", "Enabled"
4806 };
4807
4808 if (!texts || !num_items) {
4809 num_items = 2;
4810 texts = texts_default;
4811 }
4812
4813 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
4814 uinfo->count = 1;
4815 uinfo->value.enumerated.items = num_items;
4816 if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items)
4817 uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1;
4818 strcpy(uinfo->value.enumerated.name,
4819 texts[uinfo->value.enumerated.item]);
4820 return 0;
4821}
4822EXPORT_SYMBOL_HDA(snd_hda_enum_helper_info);
4823
4824/*
4774 * Multi-channel / digital-out PCM helper functions 4825 * Multi-channel / digital-out PCM helper functions
4775 */ 4826 */
4776 4827
@@ -4778,10 +4829,20 @@ EXPORT_SYMBOL_HDA(snd_hda_input_mux_put);
4778static void setup_dig_out_stream(struct hda_codec *codec, hda_nid_t nid, 4829static void setup_dig_out_stream(struct hda_codec *codec, hda_nid_t nid,
4779 unsigned int stream_tag, unsigned int format) 4830 unsigned int stream_tag, unsigned int format)
4780{ 4831{
4781 struct hda_spdif_out *spdif = snd_hda_spdif_out_of_nid(codec, nid); 4832 struct hda_spdif_out *spdif;
4782 4833 unsigned int curr_fmt;
4783 /* turn off SPDIF once; otherwise the IEC958 bits won't be updated */ 4834 bool reset;
4784 if (codec->spdif_status_reset && (spdif->ctls & AC_DIG1_ENABLE)) 4835
4836 spdif = snd_hda_spdif_out_of_nid(codec, nid);
4837 curr_fmt = snd_hda_codec_read(codec, nid, 0,
4838 AC_VERB_GET_STREAM_FORMAT, 0);
4839 reset = codec->spdif_status_reset &&
4840 (spdif->ctls & AC_DIG1_ENABLE) &&
4841 curr_fmt != format;
4842
4843 /* turn off SPDIF if needed; otherwise the IEC958 bits won't be
4844 updated */
4845 if (reset)
4785 set_dig_out_convert(codec, nid, 4846 set_dig_out_convert(codec, nid,
4786 spdif->ctls & ~AC_DIG1_ENABLE & 0xff, 4847 spdif->ctls & ~AC_DIG1_ENABLE & 0xff,
4787 -1); 4848 -1);
@@ -4793,7 +4854,7 @@ static void setup_dig_out_stream(struct hda_codec *codec, hda_nid_t nid,
4793 format); 4854 format);
4794 } 4855 }
4795 /* turn on again (if needed) */ 4856 /* turn on again (if needed) */
4796 if (codec->spdif_status_reset && (spdif->ctls & AC_DIG1_ENABLE)) 4857 if (reset)
4797 set_dig_out_convert(codec, nid, 4858 set_dig_out_convert(codec, nid,
4798 spdif->ctls & 0xff, -1); 4859 spdif->ctls & 0xff, -1);
4799} 4860}
@@ -5137,6 +5198,7 @@ int snd_hda_suspend(struct hda_bus *bus)
5137 struct hda_codec *codec; 5198 struct hda_codec *codec;
5138 5199
5139 list_for_each_entry(codec, &bus->codec_list, list) { 5200 list_for_each_entry(codec, &bus->codec_list, list) {
5201 cancel_delayed_work_sync(&codec->jackpoll_work);
5140 if (hda_codec_is_power_on(codec)) 5202 if (hda_codec_is_power_on(codec))
5141 hda_call_codec_suspend(codec, false); 5203 hda_call_codec_suspend(codec, false);
5142 } 5204 }
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h
index 4f4e545c0f4b..8665540e55aa 100644
--- a/sound/pci/hda/hda_codec.h
+++ b/sound/pci/hda/hda_codec.h
@@ -757,6 +757,7 @@ struct hda_pcm_stream {
757 u32 rates; /* supported rates */ 757 u32 rates; /* supported rates */
758 u64 formats; /* supported formats (SNDRV_PCM_FMTBIT_) */ 758 u64 formats; /* supported formats (SNDRV_PCM_FMTBIT_) */
759 unsigned int maxbps; /* supported max. bit per sample */ 759 unsigned int maxbps; /* supported max. bit per sample */
760 const struct snd_pcm_chmap_elem *chmap; /* chmap to override */
760 struct hda_pcm_ops ops; 761 struct hda_pcm_ops ops;
761}; 762};
762 763
@@ -836,6 +837,7 @@ struct hda_codec {
836 struct mutex hash_mutex; 837 struct mutex hash_mutex;
837 struct snd_array spdif_out; 838 struct snd_array spdif_out;
838 unsigned int spdif_in_enable; /* SPDIF input enable? */ 839 unsigned int spdif_in_enable; /* SPDIF input enable? */
840 int primary_dig_out_type; /* primary digital out PCM type */
839 const hda_nid_t *slave_dig_outs; /* optional digital out slave widgets */ 841 const hda_nid_t *slave_dig_outs; /* optional digital out slave widgets */
840 struct snd_array init_pins; /* initial (BIOS) pin configurations */ 842 struct snd_array init_pins; /* initial (BIOS) pin configurations */
841 struct snd_array driver_pins; /* pin configs set by codec parser */ 843 struct snd_array driver_pins; /* pin configs set by codec parser */
@@ -885,6 +887,8 @@ struct hda_codec {
885 887
886 /* jack detection */ 888 /* jack detection */
887 struct snd_array jacktbl; 889 struct snd_array jacktbl;
890 unsigned long jackpoll_interval; /* In jiffies. Zero means no poll, rely on unsol events */
891 struct delayed_work jackpoll_work;
888 892
889#ifdef CONFIG_SND_HDA_INPUT_JACK 893#ifdef CONFIG_SND_HDA_INPUT_JACK
890 /* jack detection */ 894 /* jack detection */
@@ -1024,6 +1028,8 @@ unsigned int snd_hda_calc_stream_format(unsigned int rate,
1024int snd_hda_is_supported_format(struct hda_codec *codec, hda_nid_t nid, 1028int snd_hda_is_supported_format(struct hda_codec *codec, hda_nid_t nid,
1025 unsigned int format); 1029 unsigned int format);
1026 1030
1031extern const struct snd_pcm_chmap_elem snd_pcm_2_1_chmaps[];
1032
1027/* 1033/*
1028 * Misc 1034 * Misc
1029 */ 1035 */
diff --git a/sound/pci/hda/hda_hwdep.c b/sound/pci/hda/hda_hwdep.c
index 1af86d40eb23..a5c9411bb367 100644
--- a/sound/pci/hda/hda_hwdep.c
+++ b/sound/pci/hda/hda_hwdep.c
@@ -125,7 +125,7 @@ static void hwdep_free(struct snd_hwdep *hwdep)
125 clear_hwdep_elements(hwdep->private_data); 125 clear_hwdep_elements(hwdep->private_data);
126} 126}
127 127
128int /*__devinit*/ snd_hda_create_hwdep(struct hda_codec *codec) 128int snd_hda_create_hwdep(struct hda_codec *codec)
129{ 129{
130 char hwname[16]; 130 char hwname[16];
131 struct snd_hwdep *hwdep; 131 struct snd_hwdep *hwdep;
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index f9d870e554d9..cca87277baf0 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -47,6 +47,10 @@
47#include <linux/reboot.h> 47#include <linux/reboot.h>
48#include <linux/io.h> 48#include <linux/io.h>
49#include <linux/pm_runtime.h> 49#include <linux/pm_runtime.h>
50#include <linux/clocksource.h>
51#include <linux/time.h>
52#include <linux/completion.h>
53
50#ifdef CONFIG_X86 54#ifdef CONFIG_X86
51/* for snoop control */ 55/* for snoop control */
52#include <asm/pgtable.h> 56#include <asm/pgtable.h>
@@ -68,6 +72,7 @@ static int position_fix[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = -1};
68static int bdl_pos_adj[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = -1}; 72static int bdl_pos_adj[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = -1};
69static int probe_mask[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = -1}; 73static int probe_mask[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = -1};
70static int probe_only[SNDRV_CARDS]; 74static int probe_only[SNDRV_CARDS];
75static int jackpoll_ms[SNDRV_CARDS];
71static bool single_cmd; 76static bool single_cmd;
72static int enable_msi = -1; 77static int enable_msi = -1;
73#ifdef CONFIG_SND_HDA_PATCH_LOADER 78#ifdef CONFIG_SND_HDA_PATCH_LOADER
@@ -95,6 +100,8 @@ module_param_array(probe_mask, int, NULL, 0444);
95MODULE_PARM_DESC(probe_mask, "Bitmask to probe codecs (default = -1)."); 100MODULE_PARM_DESC(probe_mask, "Bitmask to probe codecs (default = -1).");
96module_param_array(probe_only, int, NULL, 0444); 101module_param_array(probe_only, int, NULL, 0444);
97MODULE_PARM_DESC(probe_only, "Only probing and no codec initialization."); 102MODULE_PARM_DESC(probe_only, "Only probing and no codec initialization.");
103module_param_array(jackpoll_ms, int, NULL, 0444);
104MODULE_PARM_DESC(jackpoll_ms, "Ms between polling for jack events (default = 0, using unsol events only)");
98module_param(single_cmd, bool, 0444); 105module_param(single_cmd, bool, 0444);
99MODULE_PARM_DESC(single_cmd, "Use single command to communicate with codecs " 106MODULE_PARM_DESC(single_cmd, "Use single command to communicate with codecs "
100 "(for debugging only)."); 107 "(for debugging only).");
@@ -185,7 +192,7 @@ MODULE_DESCRIPTION("Intel HDA driver");
185#ifdef CONFIG_SND_VERBOSE_PRINTK 192#ifdef CONFIG_SND_VERBOSE_PRINTK
186#define SFX /* nop */ 193#define SFX /* nop */
187#else 194#else
188#define SFX "hda-intel: " 195#define SFX "hda-intel "
189#endif 196#endif
190 197
191#if defined(CONFIG_PM) && defined(CONFIG_VGA_SWITCHEROO) 198#if defined(CONFIG_PM) && defined(CONFIG_VGA_SWITCHEROO)
@@ -416,6 +423,9 @@ struct azx_dev {
416 unsigned int insufficient :1; 423 unsigned int insufficient :1;
417 unsigned int wc_marked:1; 424 unsigned int wc_marked:1;
418 unsigned int no_period_wakeup:1; 425 unsigned int no_period_wakeup:1;
426
427 struct timecounter azx_tc;
428 struct cyclecounter azx_cc;
419}; 429};
420 430
421/* CORB/RIRB */ 431/* CORB/RIRB */
@@ -460,6 +470,7 @@ struct azx {
460 /* locks */ 470 /* locks */
461 spinlock_t reg_lock; 471 spinlock_t reg_lock;
462 struct mutex open_mutex; 472 struct mutex open_mutex;
473 struct completion probe_wait;
463 474
464 /* streams (x num_streams) */ 475 /* streams (x num_streams) */
465 struct azx_dev *azx_dev; 476 struct azx_dev *azx_dev;
@@ -518,6 +529,9 @@ struct azx {
518 struct list_head list; 529 struct list_head list;
519}; 530};
520 531
532#define CREATE_TRACE_POINTS
533#include "hda_intel_trace.h"
534
521/* driver types */ 535/* driver types */
522enum { 536enum {
523 AZX_DRIVER_ICH, 537 AZX_DRIVER_ICH,
@@ -589,15 +603,7 @@ enum {
589#define use_vga_switcheroo(chip) 0 603#define use_vga_switcheroo(chip) 0
590#endif 604#endif
591 605
592#if defined(SUPPORT_VGA_SWITCHEROO) || defined(CONFIG_SND_HDA_PATCH_LOADER) 606static char *driver_short_names[] = {
593#define DELAYED_INIT_MARK
594#define DELAYED_INITDATA_MARK
595#else
596#define DELAYED_INIT_MARK __devinit
597#define DELAYED_INITDATA_MARK __devinitdata
598#endif
599
600static char *driver_short_names[] DELAYED_INITDATA_MARK = {
601 [AZX_DRIVER_ICH] = "HDA Intel", 607 [AZX_DRIVER_ICH] = "HDA Intel",
602 [AZX_DRIVER_PCH] = "HDA Intel PCH", 608 [AZX_DRIVER_PCH] = "HDA Intel PCH",
603 [AZX_DRIVER_SCH] = "HDA Intel MID", 609 [AZX_DRIVER_SCH] = "HDA Intel MID",
@@ -703,7 +709,7 @@ static int azx_alloc_cmd_io(struct azx *chip)
703 snd_dma_pci_data(chip->pci), 709 snd_dma_pci_data(chip->pci),
704 PAGE_SIZE, &chip->rb); 710 PAGE_SIZE, &chip->rb);
705 if (err < 0) { 711 if (err < 0) {
706 snd_printk(KERN_ERR SFX "cannot allocate CORB/RIRB\n"); 712 snd_printk(KERN_ERR SFX "%s: cannot allocate CORB/RIRB\n", pci_name(chip->pci));
707 return err; 713 return err;
708 } 714 }
709 mark_pages_wc(chip, &chip->rb, true); 715 mark_pages_wc(chip, &chip->rb, true);
@@ -793,7 +799,12 @@ static int azx_corb_send_cmd(struct hda_bus *bus, u32 val)
793 spin_lock_irq(&chip->reg_lock); 799 spin_lock_irq(&chip->reg_lock);
794 800
795 /* add command to corb */ 801 /* add command to corb */
796 wp = azx_readb(chip, CORBWP); 802 wp = azx_readw(chip, CORBWP);
803 if (wp == 0xffff) {
804 /* something wrong, controller likely turned to D3 */
805 spin_unlock_irq(&chip->reg_lock);
806 return -1;
807 }
797 wp++; 808 wp++;
798 wp %= ICH6_MAX_CORB_ENTRIES; 809 wp %= ICH6_MAX_CORB_ENTRIES;
799 810
@@ -815,7 +826,12 @@ static void azx_update_rirb(struct azx *chip)
815 unsigned int addr; 826 unsigned int addr;
816 u32 res, res_ex; 827 u32 res, res_ex;
817 828
818 wp = azx_readb(chip, RIRBWP); 829 wp = azx_readw(chip, RIRBWP);
830 if (wp == 0xffff) {
831 /* something wrong, controller likely turned to D3 */
832 return;
833 }
834
819 if (wp == chip->rirb.wp) 835 if (wp == chip->rirb.wp)
820 return; 836 return;
821 chip->rirb.wp = wp; 837 chip->rirb.wp = wp;
@@ -835,8 +851,9 @@ static void azx_update_rirb(struct azx *chip)
835 smp_wmb(); 851 smp_wmb();
836 chip->rirb.cmds[addr]--; 852 chip->rirb.cmds[addr]--;
837 } else 853 } else
838 snd_printk(KERN_ERR SFX "spurious response %#x:%#x, " 854 snd_printk(KERN_ERR SFX "%s: spurious response %#x:%#x, "
839 "last cmd=%#08x\n", 855 "last cmd=%#08x\n",
856 pci_name(chip->pci),
840 res, res_ex, 857 res, res_ex,
841 chip->last_cmd[addr]); 858 chip->last_cmd[addr]);
842 } 859 }
@@ -879,9 +896,9 @@ static unsigned int azx_rirb_get_response(struct hda_bus *bus,
879 } 896 }
880 897
881 if (!chip->polling_mode && chip->poll_count < 2) { 898 if (!chip->polling_mode && chip->poll_count < 2) {
882 snd_printdd(SFX "azx_get_response timeout, " 899 snd_printdd(SFX "%s: azx_get_response timeout, "
883 "polling the codec once: last cmd=0x%08x\n", 900 "polling the codec once: last cmd=0x%08x\n",
884 chip->last_cmd[addr]); 901 pci_name(chip->pci), chip->last_cmd[addr]);
885 do_poll = 1; 902 do_poll = 1;
886 chip->poll_count++; 903 chip->poll_count++;
887 goto again; 904 goto again;
@@ -889,17 +906,17 @@ static unsigned int azx_rirb_get_response(struct hda_bus *bus,
889 906
890 907
891 if (!chip->polling_mode) { 908 if (!chip->polling_mode) {
892 snd_printk(KERN_WARNING SFX "azx_get_response timeout, " 909 snd_printk(KERN_WARNING SFX "%s: azx_get_response timeout, "
893 "switching to polling mode: last cmd=0x%08x\n", 910 "switching to polling mode: last cmd=0x%08x\n",
894 chip->last_cmd[addr]); 911 pci_name(chip->pci), chip->last_cmd[addr]);
895 chip->polling_mode = 1; 912 chip->polling_mode = 1;
896 goto again; 913 goto again;
897 } 914 }
898 915
899 if (chip->msi) { 916 if (chip->msi) {
900 snd_printk(KERN_WARNING SFX "No response from codec, " 917 snd_printk(KERN_WARNING SFX "%s: No response from codec, "
901 "disabling MSI: last cmd=0x%08x\n", 918 "disabling MSI: last cmd=0x%08x\n",
902 chip->last_cmd[addr]); 919 pci_name(chip->pci), chip->last_cmd[addr]);
903 free_irq(chip->irq, chip); 920 free_irq(chip->irq, chip);
904 chip->irq = -1; 921 chip->irq = -1;
905 pci_disable_msi(chip->pci); 922 pci_disable_msi(chip->pci);
@@ -965,8 +982,8 @@ static int azx_single_wait_for_response(struct azx *chip, unsigned int addr)
965 udelay(1); 982 udelay(1);
966 } 983 }
967 if (printk_ratelimit()) 984 if (printk_ratelimit())
968 snd_printd(SFX "get_response timeout: IRS=0x%x\n", 985 snd_printd(SFX "%s: get_response timeout: IRS=0x%x\n",
969 azx_readw(chip, IRS)); 986 pci_name(chip->pci), azx_readw(chip, IRS));
970 chip->rirb.res[addr] = -1; 987 chip->rirb.res[addr] = -1;
971 return -EIO; 988 return -EIO;
972} 989}
@@ -993,8 +1010,8 @@ static int azx_single_send_cmd(struct hda_bus *bus, u32 val)
993 udelay(1); 1010 udelay(1);
994 } 1011 }
995 if (printk_ratelimit()) 1012 if (printk_ratelimit())
996 snd_printd(SFX "send_cmd timeout: IRS=0x%x, val=0x%x\n", 1013 snd_printd(SFX "%s: send_cmd timeout: IRS=0x%x, val=0x%x\n",
997 azx_readw(chip, IRS), val); 1014 pci_name(chip->pci), azx_readw(chip, IRS), val);
998 return -EIO; 1015 return -EIO;
999} 1016}
1000 1017
@@ -1047,7 +1064,7 @@ static void azx_power_notify(struct hda_bus *bus, bool power_up);
1047/* reset codec link */ 1064/* reset codec link */
1048static int azx_reset(struct azx *chip, int full_reset) 1065static int azx_reset(struct azx *chip, int full_reset)
1049{ 1066{
1050 int count; 1067 unsigned long timeout;
1051 1068
1052 if (!full_reset) 1069 if (!full_reset)
1053 goto __skip; 1070 goto __skip;
@@ -1058,29 +1075,31 @@ static int azx_reset(struct azx *chip, int full_reset)
1058 /* reset controller */ 1075 /* reset controller */
1059 azx_writel(chip, GCTL, azx_readl(chip, GCTL) & ~ICH6_GCTL_RESET); 1076 azx_writel(chip, GCTL, azx_readl(chip, GCTL) & ~ICH6_GCTL_RESET);
1060 1077
1061 count = 50; 1078 timeout = jiffies + msecs_to_jiffies(100);
1062 while (azx_readb(chip, GCTL) && --count) 1079 while (azx_readb(chip, GCTL) &&
1063 msleep(1); 1080 time_before(jiffies, timeout))
1081 usleep_range(500, 1000);
1064 1082
1065 /* delay for >= 100us for codec PLL to settle per spec 1083 /* delay for >= 100us for codec PLL to settle per spec
1066 * Rev 0.9 section 5.5.1 1084 * Rev 0.9 section 5.5.1
1067 */ 1085 */
1068 msleep(1); 1086 usleep_range(500, 1000);
1069 1087
1070 /* Bring controller out of reset */ 1088 /* Bring controller out of reset */
1071 azx_writeb(chip, GCTL, azx_readb(chip, GCTL) | ICH6_GCTL_RESET); 1089 azx_writeb(chip, GCTL, azx_readb(chip, GCTL) | ICH6_GCTL_RESET);
1072 1090
1073 count = 50; 1091 timeout = jiffies + msecs_to_jiffies(100);
1074 while (!azx_readb(chip, GCTL) && --count) 1092 while (!azx_readb(chip, GCTL) &&
1075 msleep(1); 1093 time_before(jiffies, timeout))
1094 usleep_range(500, 1000);
1076 1095
1077 /* Brent Chartrand said to wait >= 540us for codecs to initialize */ 1096 /* Brent Chartrand said to wait >= 540us for codecs to initialize */
1078 msleep(1); 1097 usleep_range(1000, 1200);
1079 1098
1080 __skip: 1099 __skip:
1081 /* check to see if controller is ready */ 1100 /* check to see if controller is ready */
1082 if (!azx_readb(chip, GCTL)) { 1101 if (!azx_readb(chip, GCTL)) {
1083 snd_printd(SFX "azx_reset: controller not ready!\n"); 1102 snd_printd(SFX "%s: azx_reset: controller not ready!\n", pci_name(chip->pci));
1084 return -EBUSY; 1103 return -EBUSY;
1085 } 1104 }
1086 1105
@@ -1092,7 +1111,7 @@ static int azx_reset(struct azx *chip, int full_reset)
1092 /* detect codecs */ 1111 /* detect codecs */
1093 if (!chip->codec_mask) { 1112 if (!chip->codec_mask) {
1094 chip->codec_mask = azx_readw(chip, STATESTS); 1113 chip->codec_mask = azx_readw(chip, STATESTS);
1095 snd_printdd(SFX "codec_mask = 0x%x\n", chip->codec_mask); 1114 snd_printdd(SFX "%s: codec_mask = 0x%x\n", pci_name(chip->pci), chip->codec_mask);
1096 } 1115 }
1097 1116
1098 return 0; 1117 return 0;
@@ -1236,7 +1255,7 @@ static void azx_init_pci(struct azx *chip)
1236 * The PCI register TCSEL is defined in the Intel manuals. 1255 * The PCI register TCSEL is defined in the Intel manuals.
1237 */ 1256 */
1238 if (!(chip->driver_caps & AZX_DCAPS_NO_TCSEL)) { 1257 if (!(chip->driver_caps & AZX_DCAPS_NO_TCSEL)) {
1239 snd_printdd(SFX "Clearing TCSEL\n"); 1258 snd_printdd(SFX "%s: Clearing TCSEL\n", pci_name(chip->pci));
1240 update_pci_byte(chip->pci, ICH6_PCIREG_TCSEL, 0x07, 0); 1259 update_pci_byte(chip->pci, ICH6_PCIREG_TCSEL, 0x07, 0);
1241 } 1260 }
1242 1261
@@ -1244,7 +1263,7 @@ static void azx_init_pci(struct azx *chip)
1244 * we need to enable snoop. 1263 * we need to enable snoop.
1245 */ 1264 */
1246 if (chip->driver_caps & AZX_DCAPS_ATI_SNOOP) { 1265 if (chip->driver_caps & AZX_DCAPS_ATI_SNOOP) {
1247 snd_printdd(SFX "Setting ATI snoop: %d\n", azx_snoop(chip)); 1266 snd_printdd(SFX "%s: Setting ATI snoop: %d\n", pci_name(chip->pci), azx_snoop(chip));
1248 update_pci_byte(chip->pci, 1267 update_pci_byte(chip->pci,
1249 ATI_SB450_HDAUDIO_MISC_CNTR2_ADDR, 0x07, 1268 ATI_SB450_HDAUDIO_MISC_CNTR2_ADDR, 0x07,
1250 azx_snoop(chip) ? ATI_SB450_HDAUDIO_ENABLE_SNOOP : 0); 1269 azx_snoop(chip) ? ATI_SB450_HDAUDIO_ENABLE_SNOOP : 0);
@@ -1252,7 +1271,7 @@ static void azx_init_pci(struct azx *chip)
1252 1271
1253 /* For NVIDIA HDA, enable snoop */ 1272 /* For NVIDIA HDA, enable snoop */
1254 if (chip->driver_caps & AZX_DCAPS_NVIDIA_SNOOP) { 1273 if (chip->driver_caps & AZX_DCAPS_NVIDIA_SNOOP) {
1255 snd_printdd(SFX "Setting Nvidia snoop: %d\n", azx_snoop(chip)); 1274 snd_printdd(SFX "%s: Setting Nvidia snoop: %d\n", pci_name(chip->pci), azx_snoop(chip));
1256 update_pci_byte(chip->pci, 1275 update_pci_byte(chip->pci,
1257 NVIDIA_HDA_TRANSREG_ADDR, 1276 NVIDIA_HDA_TRANSREG_ADDR,
1258 0x0f, NVIDIA_HDA_ENABLE_COHBITS); 1277 0x0f, NVIDIA_HDA_ENABLE_COHBITS);
@@ -1277,8 +1296,8 @@ static void azx_init_pci(struct azx *chip)
1277 pci_read_config_word(chip->pci, 1296 pci_read_config_word(chip->pci,
1278 INTEL_SCH_HDA_DEVC, &snoop); 1297 INTEL_SCH_HDA_DEVC, &snoop);
1279 } 1298 }
1280 snd_printdd(SFX "SCH snoop: %s\n", 1299 snd_printdd(SFX "%s: SCH snoop: %s\n",
1281 (snoop & INTEL_SCH_HDA_DEVC_NOSNOOP) 1300 pci_name(chip->pci), (snoop & INTEL_SCH_HDA_DEVC_NOSNOOP)
1282 ? "Disabled" : "Enabled"); 1301 ? "Disabled" : "Enabled");
1283 } 1302 }
1284} 1303}
@@ -1438,8 +1457,8 @@ static int azx_setup_periods(struct azx *chip,
1438 pos_align; 1457 pos_align;
1439 pos_adj = frames_to_bytes(runtime, pos_adj); 1458 pos_adj = frames_to_bytes(runtime, pos_adj);
1440 if (pos_adj >= period_bytes) { 1459 if (pos_adj >= period_bytes) {
1441 snd_printk(KERN_WARNING SFX "Too big adjustment %d\n", 1460 snd_printk(KERN_WARNING SFX "%s: Too big adjustment %d\n",
1442 bdl_pos_adj[chip->dev_index]); 1461 pci_name(chip->pci), bdl_pos_adj[chip->dev_index]);
1443 pos_adj = 0; 1462 pos_adj = 0;
1444 } else { 1463 } else {
1445 ofs = setup_bdle(chip, substream, azx_dev, 1464 ofs = setup_bdle(chip, substream, azx_dev,
@@ -1463,8 +1482,8 @@ static int azx_setup_periods(struct azx *chip,
1463 return 0; 1482 return 0;
1464 1483
1465 error: 1484 error:
1466 snd_printk(KERN_ERR SFX "Too many BDL entries: buffer=%d, period=%d\n", 1485 snd_printk(KERN_ERR SFX "%s: Too many BDL entries: buffer=%d, period=%d\n",
1467 azx_dev->bufsize, period_bytes); 1486 pci_name(chip->pci), azx_dev->bufsize, period_bytes);
1468 return -EINVAL; 1487 return -EINVAL;
1469} 1488}
1470 1489
@@ -1561,7 +1580,7 @@ static int probe_codec(struct azx *chip, int addr)
1561 mutex_unlock(&chip->bus->cmd_mutex); 1580 mutex_unlock(&chip->bus->cmd_mutex);
1562 if (res == -1) 1581 if (res == -1)
1563 return -EIO; 1582 return -EIO;
1564 snd_printdd(SFX "codec #%d probed OK\n", addr); 1583 snd_printdd(SFX "%s: codec #%d probed OK\n", pci_name(chip->pci), addr);
1565 return 0; 1584 return 0;
1566} 1585}
1567 1586
@@ -1588,17 +1607,33 @@ static void azx_bus_reset(struct hda_bus *bus)
1588 bus->in_reset = 0; 1607 bus->in_reset = 0;
1589} 1608}
1590 1609
1610static int get_jackpoll_interval(struct azx *chip)
1611{
1612 int i = jackpoll_ms[chip->dev_index];
1613 unsigned int j;
1614 if (i == 0)
1615 return 0;
1616 if (i < 50 || i > 60000)
1617 j = 0;
1618 else
1619 j = msecs_to_jiffies(i);
1620 if (j == 0)
1621 snd_printk(KERN_WARNING SFX
1622 "jackpoll_ms value out of range: %d\n", i);
1623 return j;
1624}
1625
1591/* 1626/*
1592 * Codec initialization 1627 * Codec initialization
1593 */ 1628 */
1594 1629
1595/* number of codec slots for each chipset: 0 = default slots (i.e. 4) */ 1630/* number of codec slots for each chipset: 0 = default slots (i.e. 4) */
1596static unsigned int azx_max_codecs[AZX_NUM_DRIVERS] DELAYED_INITDATA_MARK = { 1631static unsigned int azx_max_codecs[AZX_NUM_DRIVERS] = {
1597 [AZX_DRIVER_NVIDIA] = 8, 1632 [AZX_DRIVER_NVIDIA] = 8,
1598 [AZX_DRIVER_TERA] = 1, 1633 [AZX_DRIVER_TERA] = 1,
1599}; 1634};
1600 1635
1601static int DELAYED_INIT_MARK azx_codec_create(struct azx *chip, const char *model) 1636static int azx_codec_create(struct azx *chip, const char *model)
1602{ 1637{
1603 struct hda_bus_template bus_temp; 1638 struct hda_bus_template bus_temp;
1604 int c, codecs, err; 1639 int c, codecs, err;
@@ -1622,7 +1657,7 @@ static int DELAYED_INIT_MARK azx_codec_create(struct azx *chip, const char *mode
1622 return err; 1657 return err;
1623 1658
1624 if (chip->driver_caps & AZX_DCAPS_RIRB_DELAY) { 1659 if (chip->driver_caps & AZX_DCAPS_RIRB_DELAY) {
1625 snd_printd(SFX "Enable delay in RIRB handling\n"); 1660 snd_printd(SFX "%s: Enable delay in RIRB handling\n", pci_name(chip->pci));
1626 chip->bus->needs_damn_long_delay = 1; 1661 chip->bus->needs_damn_long_delay = 1;
1627 } 1662 }
1628 1663
@@ -1639,8 +1674,8 @@ static int DELAYED_INIT_MARK azx_codec_create(struct azx *chip, const char *mode
1639 * that don't exist 1674 * that don't exist
1640 */ 1675 */
1641 snd_printk(KERN_WARNING SFX 1676 snd_printk(KERN_WARNING SFX
1642 "Codec #%d probe error; " 1677 "%s: Codec #%d probe error; "
1643 "disabling it...\n", c); 1678 "disabling it...\n", pci_name(chip->pci), c);
1644 chip->codec_mask &= ~(1 << c); 1679 chip->codec_mask &= ~(1 << c);
1645 /* More badly, accessing to a non-existing 1680 /* More badly, accessing to a non-existing
1646 * codec often screws up the controller chip, 1681 * codec often screws up the controller chip,
@@ -1660,7 +1695,8 @@ static int DELAYED_INIT_MARK azx_codec_create(struct azx *chip, const char *mode
1660 * access works around the stall. Grrr... 1695 * access works around the stall. Grrr...
1661 */ 1696 */
1662 if (chip->driver_caps & AZX_DCAPS_SYNC_WRITE) { 1697 if (chip->driver_caps & AZX_DCAPS_SYNC_WRITE) {
1663 snd_printd(SFX "Enable sync_write for stable communication\n"); 1698 snd_printd(SFX "%s: Enable sync_write for stable communication\n",
1699 pci_name(chip->pci));
1664 chip->bus->sync_write = 1; 1700 chip->bus->sync_write = 1;
1665 chip->bus->allow_bus_reset = 1; 1701 chip->bus->allow_bus_reset = 1;
1666 } 1702 }
@@ -1672,19 +1708,20 @@ static int DELAYED_INIT_MARK azx_codec_create(struct azx *chip, const char *mode
1672 err = snd_hda_codec_new(chip->bus, c, &codec); 1708 err = snd_hda_codec_new(chip->bus, c, &codec);
1673 if (err < 0) 1709 if (err < 0)
1674 continue; 1710 continue;
1711 codec->jackpoll_interval = get_jackpoll_interval(chip);
1675 codec->beep_mode = chip->beep_mode; 1712 codec->beep_mode = chip->beep_mode;
1676 codecs++; 1713 codecs++;
1677 } 1714 }
1678 } 1715 }
1679 if (!codecs) { 1716 if (!codecs) {
1680 snd_printk(KERN_ERR SFX "no codecs initialized\n"); 1717 snd_printk(KERN_ERR SFX "%s: no codecs initialized\n", pci_name(chip->pci));
1681 return -ENXIO; 1718 return -ENXIO;
1682 } 1719 }
1683 return 0; 1720 return 0;
1684} 1721}
1685 1722
1686/* configure each codec instance */ 1723/* configure each codec instance */
1687static int __devinit azx_codec_configure(struct azx *chip) 1724static int azx_codec_configure(struct azx *chip)
1688{ 1725{
1689 struct hda_codec *codec; 1726 struct hda_codec *codec;
1690 list_for_each_entry(codec, &chip->bus->codec_list, list) { 1727 list_for_each_entry(codec, &chip->bus->codec_list, list) {
@@ -1734,6 +1771,64 @@ static inline void azx_release_device(struct azx_dev *azx_dev)
1734 azx_dev->opened = 0; 1771 azx_dev->opened = 0;
1735} 1772}
1736 1773
1774static cycle_t azx_cc_read(const struct cyclecounter *cc)
1775{
1776 struct azx_dev *azx_dev = container_of(cc, struct azx_dev, azx_cc);
1777 struct snd_pcm_substream *substream = azx_dev->substream;
1778 struct azx_pcm *apcm = snd_pcm_substream_chip(substream);
1779 struct azx *chip = apcm->chip;
1780
1781 return azx_readl(chip, WALLCLK);
1782}
1783
1784static void azx_timecounter_init(struct snd_pcm_substream *substream,
1785 bool force, cycle_t last)
1786{
1787 struct azx_dev *azx_dev = get_azx_dev(substream);
1788 struct timecounter *tc = &azx_dev->azx_tc;
1789 struct cyclecounter *cc = &azx_dev->azx_cc;
1790 u64 nsec;
1791
1792 cc->read = azx_cc_read;
1793 cc->mask = CLOCKSOURCE_MASK(32);
1794
1795 /*
1796 * Converting from 24 MHz to ns means applying a 125/3 factor.
1797 * To avoid any saturation issues in intermediate operations,
1798 * the 125 factor is applied first. The division is applied
1799 * last after reading the timecounter value.
1800 * Applying the 1/3 factor as part of the multiplication
1801 * requires at least 20 bits for a decent precision, however
1802 * overflows occur after about 4 hours or less, not a option.
1803 */
1804
1805 cc->mult = 125; /* saturation after 195 years */
1806 cc->shift = 0;
1807
1808 nsec = 0; /* audio time is elapsed time since trigger */
1809 timecounter_init(tc, cc, nsec);
1810 if (force)
1811 /*
1812 * force timecounter to use predefined value,
1813 * used for synchronized starts
1814 */
1815 tc->cycle_last = last;
1816}
1817
1818static int azx_get_wallclock_tstamp(struct snd_pcm_substream *substream,
1819 struct timespec *ts)
1820{
1821 struct azx_dev *azx_dev = get_azx_dev(substream);
1822 u64 nsec;
1823
1824 nsec = timecounter_read(&azx_dev->azx_tc);
1825 nsec = div_u64(nsec, 3); /* can be optimized */
1826
1827 *ts = ns_to_timespec(nsec);
1828
1829 return 0;
1830}
1831
1737static struct snd_pcm_hardware azx_pcm_hw = { 1832static struct snd_pcm_hardware azx_pcm_hw = {
1738 .info = (SNDRV_PCM_INFO_MMAP | 1833 .info = (SNDRV_PCM_INFO_MMAP |
1739 SNDRV_PCM_INFO_INTERLEAVED | 1834 SNDRV_PCM_INFO_INTERLEAVED |
@@ -1743,6 +1838,7 @@ static struct snd_pcm_hardware azx_pcm_hw = {
1743 /* SNDRV_PCM_INFO_RESUME |*/ 1838 /* SNDRV_PCM_INFO_RESUME |*/
1744 SNDRV_PCM_INFO_PAUSE | 1839 SNDRV_PCM_INFO_PAUSE |
1745 SNDRV_PCM_INFO_SYNC_START | 1840 SNDRV_PCM_INFO_SYNC_START |
1841 SNDRV_PCM_INFO_HAS_WALL_CLOCK |
1746 SNDRV_PCM_INFO_NO_PERIOD_WAKEUP), 1842 SNDRV_PCM_INFO_NO_PERIOD_WAKEUP),
1747 .formats = SNDRV_PCM_FMTBIT_S16_LE, 1843 .formats = SNDRV_PCM_FMTBIT_S16_LE,
1748 .rates = SNDRV_PCM_RATE_48000, 1844 .rates = SNDRV_PCM_RATE_48000,
@@ -1782,6 +1878,12 @@ static int azx_pcm_open(struct snd_pcm_substream *substream)
1782 runtime->hw.rates = hinfo->rates; 1878 runtime->hw.rates = hinfo->rates;
1783 snd_pcm_limit_hw_rates(runtime); 1879 snd_pcm_limit_hw_rates(runtime);
1784 snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS); 1880 snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS);
1881
1882 /* avoid wrap-around with wall-clock */
1883 snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_BUFFER_TIME,
1884 20,
1885 178000000);
1886
1785 if (chip->align_buffer_size) 1887 if (chip->align_buffer_size)
1786 /* constrain buffer sizes to be multiple of 128 1888 /* constrain buffer sizes to be multiple of 128
1787 bytes. This is more efficient in terms of memory 1889 bytes. This is more efficient in terms of memory
@@ -1821,6 +1923,12 @@ static int azx_pcm_open(struct snd_pcm_substream *substream)
1821 mutex_unlock(&chip->open_mutex); 1923 mutex_unlock(&chip->open_mutex);
1822 return -EINVAL; 1924 return -EINVAL;
1823 } 1925 }
1926
1927 /* disable WALLCLOCK timestamps for capture streams
1928 until we figure out how to handle digital inputs */
1929 if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
1930 runtime->hw.info &= ~SNDRV_PCM_INFO_HAS_WALL_CLOCK;
1931
1824 spin_lock_irqsave(&chip->reg_lock, flags); 1932 spin_lock_irqsave(&chip->reg_lock, flags);
1825 azx_dev->substream = substream; 1933 azx_dev->substream = substream;
1826 azx_dev->running = 0; 1934 azx_dev->running = 0;
@@ -1916,16 +2024,16 @@ static int azx_pcm_prepare(struct snd_pcm_substream *substream)
1916 ctls); 2024 ctls);
1917 if (!format_val) { 2025 if (!format_val) {
1918 snd_printk(KERN_ERR SFX 2026 snd_printk(KERN_ERR SFX
1919 "invalid format_val, rate=%d, ch=%d, format=%d\n", 2027 "%s: invalid format_val, rate=%d, ch=%d, format=%d\n",
1920 runtime->rate, runtime->channels, runtime->format); 2028 pci_name(chip->pci), runtime->rate, runtime->channels, runtime->format);
1921 return -EINVAL; 2029 return -EINVAL;
1922 } 2030 }
1923 2031
1924 bufsize = snd_pcm_lib_buffer_bytes(substream); 2032 bufsize = snd_pcm_lib_buffer_bytes(substream);
1925 period_bytes = snd_pcm_lib_period_bytes(substream); 2033 period_bytes = snd_pcm_lib_period_bytes(substream);
1926 2034
1927 snd_printdd(SFX "azx_pcm_prepare: bufsize=0x%x, format=0x%x\n", 2035 snd_printdd(SFX "%s: azx_pcm_prepare: bufsize=0x%x, format=0x%x\n",
1928 bufsize, format_val); 2036 pci_name(chip->pci), bufsize, format_val);
1929 2037
1930 if (bufsize != azx_dev->bufsize || 2038 if (bufsize != azx_dev->bufsize ||
1931 period_bytes != azx_dev->period_bytes || 2039 period_bytes != azx_dev->period_bytes ||
@@ -1967,6 +2075,9 @@ static int azx_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
1967 int rstart = 0, start, nsync = 0, sbits = 0; 2075 int rstart = 0, start, nsync = 0, sbits = 0;
1968 int nwait, timeout; 2076 int nwait, timeout;
1969 2077
2078 azx_dev = get_azx_dev(substream);
2079 trace_azx_pcm_trigger(chip, azx_dev, cmd);
2080
1970 switch (cmd) { 2081 switch (cmd) {
1971 case SNDRV_PCM_TRIGGER_START: 2082 case SNDRV_PCM_TRIGGER_START:
1972 rstart = 1; 2083 rstart = 1;
@@ -2057,6 +2168,22 @@ static int azx_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
2057 azx_readl(chip, OLD_SSYNC) & ~sbits); 2168 azx_readl(chip, OLD_SSYNC) & ~sbits);
2058 else 2169 else
2059 azx_writel(chip, SSYNC, azx_readl(chip, SSYNC) & ~sbits); 2170 azx_writel(chip, SSYNC, azx_readl(chip, SSYNC) & ~sbits);
2171 if (start) {
2172 azx_timecounter_init(substream, 0, 0);
2173 if (nsync > 1) {
2174 cycle_t cycle_last;
2175
2176 /* same start cycle for master and group */
2177 azx_dev = get_azx_dev(substream);
2178 cycle_last = azx_dev->azx_tc.cycle_last;
2179
2180 snd_pcm_group_for_each_entry(s, substream) {
2181 if (s->pcm->card != substream->pcm->card)
2182 continue;
2183 azx_timecounter_init(s, 1, cycle_last);
2184 }
2185 }
2186 }
2060 spin_unlock(&chip->reg_lock); 2187 spin_unlock(&chip->reg_lock);
2061 return 0; 2188 return 0;
2062} 2189}
@@ -2123,6 +2250,7 @@ static unsigned int azx_get_position(struct azx *chip,
2123{ 2250{
2124 unsigned int pos; 2251 unsigned int pos;
2125 int stream = azx_dev->substream->stream; 2252 int stream = azx_dev->substream->stream;
2253 int delay = 0;
2126 2254
2127 switch (chip->position_fix[stream]) { 2255 switch (chip->position_fix[stream]) {
2128 case POS_FIX_LPIB: 2256 case POS_FIX_LPIB:
@@ -2156,7 +2284,6 @@ static unsigned int azx_get_position(struct azx *chip,
2156 chip->position_fix[stream] == POS_FIX_POSBUF && 2284 chip->position_fix[stream] == POS_FIX_POSBUF &&
2157 (chip->driver_caps & AZX_DCAPS_COUNT_LPIB_DELAY)) { 2285 (chip->driver_caps & AZX_DCAPS_COUNT_LPIB_DELAY)) {
2158 unsigned int lpib_pos = azx_sd_readl(azx_dev, SD_LPIB); 2286 unsigned int lpib_pos = azx_sd_readl(azx_dev, SD_LPIB);
2159 int delay;
2160 if (stream == SNDRV_PCM_STREAM_PLAYBACK) 2287 if (stream == SNDRV_PCM_STREAM_PLAYBACK)
2161 delay = pos - lpib_pos; 2288 delay = pos - lpib_pos;
2162 else 2289 else
@@ -2165,15 +2292,16 @@ static unsigned int azx_get_position(struct azx *chip,
2165 delay += azx_dev->bufsize; 2292 delay += azx_dev->bufsize;
2166 if (delay >= azx_dev->period_bytes) { 2293 if (delay >= azx_dev->period_bytes) {
2167 snd_printk(KERN_WARNING SFX 2294 snd_printk(KERN_WARNING SFX
2168 "Unstable LPIB (%d >= %d); " 2295 "%s: Unstable LPIB (%d >= %d); "
2169 "disabling LPIB delay counting\n", 2296 "disabling LPIB delay counting\n",
2170 delay, azx_dev->period_bytes); 2297 pci_name(chip->pci), delay, azx_dev->period_bytes);
2171 delay = 0; 2298 delay = 0;
2172 chip->driver_caps &= ~AZX_DCAPS_COUNT_LPIB_DELAY; 2299 chip->driver_caps &= ~AZX_DCAPS_COUNT_LPIB_DELAY;
2173 } 2300 }
2174 azx_dev->substream->runtime->delay = 2301 azx_dev->substream->runtime->delay =
2175 bytes_to_frames(azx_dev->substream->runtime, delay); 2302 bytes_to_frames(azx_dev->substream->runtime, delay);
2176 } 2303 }
2304 trace_azx_get_position(chip, azx_dev, pos, delay);
2177 return pos; 2305 return pos;
2178} 2306}
2179 2307
@@ -2199,13 +2327,11 @@ static int azx_position_ok(struct azx *chip, struct azx_dev *azx_dev)
2199{ 2327{
2200 u32 wallclk; 2328 u32 wallclk;
2201 unsigned int pos; 2329 unsigned int pos;
2202 int stream;
2203 2330
2204 wallclk = azx_readl(chip, WALLCLK) - azx_dev->start_wallclk; 2331 wallclk = azx_readl(chip, WALLCLK) - azx_dev->start_wallclk;
2205 if (wallclk < (azx_dev->period_wallclk * 2) / 3) 2332 if (wallclk < (azx_dev->period_wallclk * 2) / 3)
2206 return -1; /* bogus (too early) interrupt */ 2333 return -1; /* bogus (too early) interrupt */
2207 2334
2208 stream = azx_dev->substream->stream;
2209 pos = azx_get_position(chip, azx_dev, true); 2335 pos = azx_get_position(chip, azx_dev, true);
2210 2336
2211 if (WARN_ONCE(!azx_dev->period_bytes, 2337 if (WARN_ONCE(!azx_dev->period_bytes,
@@ -2296,6 +2422,7 @@ static struct snd_pcm_ops azx_pcm_ops = {
2296 .prepare = azx_pcm_prepare, 2422 .prepare = azx_pcm_prepare,
2297 .trigger = azx_pcm_trigger, 2423 .trigger = azx_pcm_trigger,
2298 .pointer = azx_pcm_pointer, 2424 .pointer = azx_pcm_pointer,
2425 .wall_clock = azx_get_wallclock_tstamp,
2299 .mmap = azx_pcm_mmap, 2426 .mmap = azx_pcm_mmap,
2300 .page = snd_pcm_sgbuf_ops_page, 2427 .page = snd_pcm_sgbuf_ops_page,
2301}; 2428};
@@ -2324,7 +2451,8 @@ azx_attach_pcm_stream(struct hda_bus *bus, struct hda_codec *codec,
2324 2451
2325 list_for_each_entry(apcm, &chip->pcm_list, list) { 2452 list_for_each_entry(apcm, &chip->pcm_list, list) {
2326 if (apcm->pcm->device == pcm_dev) { 2453 if (apcm->pcm->device == pcm_dev) {
2327 snd_printk(KERN_ERR SFX "PCM %d already exists\n", pcm_dev); 2454 snd_printk(KERN_ERR SFX "%s: PCM %d already exists\n",
2455 pci_name(chip->pci), pcm_dev);
2328 return -EBUSY; 2456 return -EBUSY;
2329 } 2457 }
2330 } 2458 }
@@ -2365,7 +2493,7 @@ azx_attach_pcm_stream(struct hda_bus *bus, struct hda_codec *codec,
2365/* 2493/*
2366 * mixer creation - all stuff is implemented in hda module 2494 * mixer creation - all stuff is implemented in hda module
2367 */ 2495 */
2368static int __devinit azx_mixer_create(struct azx *chip) 2496static int azx_mixer_create(struct azx *chip)
2369{ 2497{
2370 return snd_hda_build_controls(chip->bus); 2498 return snd_hda_build_controls(chip->bus);
2371} 2499}
@@ -2374,7 +2502,7 @@ static int __devinit azx_mixer_create(struct azx *chip)
2374/* 2502/*
2375 * initialize SD streams 2503 * initialize SD streams
2376 */ 2504 */
2377static int __devinit azx_init_stream(struct azx *chip) 2505static int azx_init_stream(struct azx *chip)
2378{ 2506{
2379 int i; 2507 int i;
2380 2508
@@ -2502,6 +2630,9 @@ static int azx_suspend(struct device *dev)
2502 struct azx *chip = card->private_data; 2630 struct azx *chip = card->private_data;
2503 struct azx_pcm *p; 2631 struct azx_pcm *p;
2504 2632
2633 if (chip->disabled)
2634 return 0;
2635
2505 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); 2636 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
2506 azx_clear_irq_pending(chip); 2637 azx_clear_irq_pending(chip);
2507 list_for_each_entry(p, &chip->pcm_list, list) 2638 list_for_each_entry(p, &chip->pcm_list, list)
@@ -2527,6 +2658,9 @@ static int azx_resume(struct device *dev)
2527 struct snd_card *card = dev_get_drvdata(dev); 2658 struct snd_card *card = dev_get_drvdata(dev);
2528 struct azx *chip = card->private_data; 2659 struct azx *chip = card->private_data;
2529 2660
2661 if (chip->disabled)
2662 return 0;
2663
2530 pci_set_power_state(pci, PCI_D0); 2664 pci_set_power_state(pci, PCI_D0);
2531 pci_restore_state(pci); 2665 pci_restore_state(pci);
2532 if (pci_enable_device(pci) < 0) { 2666 if (pci_enable_device(pci) < 0) {
@@ -2557,10 +2691,6 @@ static int azx_runtime_suspend(struct device *dev)
2557 struct snd_card *card = dev_get_drvdata(dev); 2691 struct snd_card *card = dev_get_drvdata(dev);
2558 struct azx *chip = card->private_data; 2692 struct azx *chip = card->private_data;
2559 2693
2560 if (!power_save_controller ||
2561 !(chip->driver_caps & AZX_DCAPS_PM_RUNTIME))
2562 return -EAGAIN;
2563
2564 azx_stop_chip(chip); 2694 azx_stop_chip(chip);
2565 azx_clear_irq_pending(chip); 2695 azx_clear_irq_pending(chip);
2566 return 0; 2696 return 0;
@@ -2575,12 +2705,25 @@ static int azx_runtime_resume(struct device *dev)
2575 azx_init_chip(chip, 1); 2705 azx_init_chip(chip, 1);
2576 return 0; 2706 return 0;
2577} 2707}
2708
2709static int azx_runtime_idle(struct device *dev)
2710{
2711 struct snd_card *card = dev_get_drvdata(dev);
2712 struct azx *chip = card->private_data;
2713
2714 if (!power_save_controller ||
2715 !(chip->driver_caps & AZX_DCAPS_PM_RUNTIME))
2716 return -EBUSY;
2717
2718 return 0;
2719}
2720
2578#endif /* CONFIG_PM_RUNTIME */ 2721#endif /* CONFIG_PM_RUNTIME */
2579 2722
2580#ifdef CONFIG_PM 2723#ifdef CONFIG_PM
2581static const struct dev_pm_ops azx_pm = { 2724static const struct dev_pm_ops azx_pm = {
2582 SET_SYSTEM_SLEEP_PM_OPS(azx_suspend, azx_resume) 2725 SET_SYSTEM_SLEEP_PM_OPS(azx_suspend, azx_resume)
2583 SET_RUNTIME_PM_OPS(azx_runtime_suspend, azx_runtime_resume, NULL) 2726 SET_RUNTIME_PM_OPS(azx_runtime_suspend, azx_runtime_resume, azx_runtime_idle)
2584}; 2727};
2585 2728
2586#define AZX_PM_OPS &azx_pm 2729#define AZX_PM_OPS &azx_pm
@@ -2612,11 +2755,11 @@ static void azx_notifier_unregister(struct azx *chip)
2612 unregister_reboot_notifier(&chip->reboot_notifier); 2755 unregister_reboot_notifier(&chip->reboot_notifier);
2613} 2756}
2614 2757
2615static int DELAYED_INIT_MARK azx_first_init(struct azx *chip); 2758static int azx_first_init(struct azx *chip);
2616static int DELAYED_INIT_MARK azx_probe_continue(struct azx *chip); 2759static int azx_probe_continue(struct azx *chip);
2617 2760
2618#ifdef SUPPORT_VGA_SWITCHEROO 2761#ifdef SUPPORT_VGA_SWITCHEROO
2619static struct pci_dev __devinit *get_bound_vga(struct pci_dev *pci); 2762static struct pci_dev *get_bound_vga(struct pci_dev *pci);
2620 2763
2621static void azx_vs_set_state(struct pci_dev *pci, 2764static void azx_vs_set_state(struct pci_dev *pci,
2622 enum vga_switcheroo_state state) 2765 enum vga_switcheroo_state state)
@@ -2625,6 +2768,7 @@ static void azx_vs_set_state(struct pci_dev *pci,
2625 struct azx *chip = card->private_data; 2768 struct azx *chip = card->private_data;
2626 bool disabled; 2769 bool disabled;
2627 2770
2771 wait_for_completion(&chip->probe_wait);
2628 if (chip->init_failed) 2772 if (chip->init_failed)
2629 return; 2773 return;
2630 2774
@@ -2648,15 +2792,14 @@ static void azx_vs_set_state(struct pci_dev *pci,
2648 } 2792 }
2649 } else { 2793 } else {
2650 snd_printk(KERN_INFO SFX 2794 snd_printk(KERN_INFO SFX
2651 "%s %s via VGA-switcheroo\n", 2795 "%s: %s via VGA-switcheroo\n", pci_name(chip->pci),
2652 disabled ? "Disabling" : "Enabling", 2796 disabled ? "Disabling" : "Enabling");
2653 pci_name(chip->pci));
2654 if (disabled) { 2797 if (disabled) {
2655 azx_suspend(&pci->dev); 2798 azx_suspend(&pci->dev);
2656 chip->disabled = true; 2799 chip->disabled = true;
2657 if (snd_hda_lock_devices(chip->bus)) 2800 if (snd_hda_lock_devices(chip->bus))
2658 snd_printk(KERN_WARNING SFX 2801 snd_printk(KERN_WARNING SFX "%s: Cannot lock devices!\n",
2659 "Cannot lock devices!\n"); 2802 pci_name(chip->pci));
2660 } else { 2803 } else {
2661 snd_hda_unlock_devices(chip->bus); 2804 snd_hda_unlock_devices(chip->bus);
2662 chip->disabled = false; 2805 chip->disabled = false;
@@ -2670,6 +2813,7 @@ static bool azx_vs_can_switch(struct pci_dev *pci)
2670 struct snd_card *card = pci_get_drvdata(pci); 2813 struct snd_card *card = pci_get_drvdata(pci);
2671 struct azx *chip = card->private_data; 2814 struct azx *chip = card->private_data;
2672 2815
2816 wait_for_completion(&chip->probe_wait);
2673 if (chip->init_failed) 2817 if (chip->init_failed)
2674 return false; 2818 return false;
2675 if (chip->disabled || !chip->bus) 2819 if (chip->disabled || !chip->bus)
@@ -2680,7 +2824,7 @@ static bool azx_vs_can_switch(struct pci_dev *pci)
2680 return true; 2824 return true;
2681} 2825}
2682 2826
2683static void __devinit init_vga_switcheroo(struct azx *chip) 2827static void init_vga_switcheroo(struct azx *chip)
2684{ 2828{
2685 struct pci_dev *p = get_bound_vga(chip->pci); 2829 struct pci_dev *p = get_bound_vga(chip->pci);
2686 if (p) { 2830 if (p) {
@@ -2697,7 +2841,7 @@ static const struct vga_switcheroo_client_ops azx_vs_ops = {
2697 .can_switch = azx_vs_can_switch, 2841 .can_switch = azx_vs_can_switch,
2698}; 2842};
2699 2843
2700static int __devinit register_vga_switcheroo(struct azx *chip) 2844static int register_vga_switcheroo(struct azx *chip)
2701{ 2845{
2702 int err; 2846 int err;
2703 2847
@@ -2731,6 +2875,9 @@ static int azx_free(struct azx *chip)
2731 2875
2732 azx_notifier_unregister(chip); 2876 azx_notifier_unregister(chip);
2733 2877
2878 chip->init_failed = 1; /* to be sure */
2879 complete_all(&chip->probe_wait);
2880
2734 if (use_vga_switcheroo(chip)) { 2881 if (use_vga_switcheroo(chip)) {
2735 if (chip->disabled && chip->bus) 2882 if (chip->disabled && chip->bus)
2736 snd_hda_unlock_devices(chip->bus); 2883 snd_hda_unlock_devices(chip->bus);
@@ -2789,7 +2936,7 @@ static int azx_dev_free(struct snd_device *device)
2789/* 2936/*
2790 * Check of disabled HDMI controller by vga-switcheroo 2937 * Check of disabled HDMI controller by vga-switcheroo
2791 */ 2938 */
2792static struct pci_dev __devinit *get_bound_vga(struct pci_dev *pci) 2939static struct pci_dev *get_bound_vga(struct pci_dev *pci)
2793{ 2940{
2794 struct pci_dev *p; 2941 struct pci_dev *p;
2795 2942
@@ -2812,7 +2959,7 @@ static struct pci_dev __devinit *get_bound_vga(struct pci_dev *pci)
2812 return NULL; 2959 return NULL;
2813} 2960}
2814 2961
2815static bool __devinit check_hdmi_disabled(struct pci_dev *pci) 2962static bool check_hdmi_disabled(struct pci_dev *pci)
2816{ 2963{
2817 bool vga_inactive = false; 2964 bool vga_inactive = false;
2818 struct pci_dev *p = get_bound_vga(pci); 2965 struct pci_dev *p = get_bound_vga(pci);
@@ -2829,7 +2976,7 @@ static bool __devinit check_hdmi_disabled(struct pci_dev *pci)
2829/* 2976/*
2830 * white/black-listing for position_fix 2977 * white/black-listing for position_fix
2831 */ 2978 */
2832static struct snd_pci_quirk position_fix_list[] __devinitdata = { 2979static struct snd_pci_quirk position_fix_list[] = {
2833 SND_PCI_QUIRK(0x1028, 0x01cc, "Dell D820", POS_FIX_LPIB), 2980 SND_PCI_QUIRK(0x1028, 0x01cc, "Dell D820", POS_FIX_LPIB),
2834 SND_PCI_QUIRK(0x1028, 0x01de, "Dell Precision 390", POS_FIX_LPIB), 2981 SND_PCI_QUIRK(0x1028, 0x01de, "Dell Precision 390", POS_FIX_LPIB),
2835 SND_PCI_QUIRK(0x103c, 0x306d, "HP dv3", POS_FIX_LPIB), 2982 SND_PCI_QUIRK(0x103c, 0x306d, "HP dv3", POS_FIX_LPIB),
@@ -2847,7 +2994,7 @@ static struct snd_pci_quirk position_fix_list[] __devinitdata = {
2847 {} 2994 {}
2848}; 2995};
2849 2996
2850static int __devinit check_position_fix(struct azx *chip, int fix) 2997static int check_position_fix(struct azx *chip, int fix)
2851{ 2998{
2852 const struct snd_pci_quirk *q; 2999 const struct snd_pci_quirk *q;
2853 3000
@@ -2871,11 +3018,11 @@ static int __devinit check_position_fix(struct azx *chip, int fix)
2871 3018
2872 /* Check VIA/ATI HD Audio Controller exist */ 3019 /* Check VIA/ATI HD Audio Controller exist */
2873 if (chip->driver_caps & AZX_DCAPS_POSFIX_VIA) { 3020 if (chip->driver_caps & AZX_DCAPS_POSFIX_VIA) {
2874 snd_printd(SFX "Using VIACOMBO position fix\n"); 3021 snd_printd(SFX "%s: Using VIACOMBO position fix\n", pci_name(chip->pci));
2875 return POS_FIX_VIACOMBO; 3022 return POS_FIX_VIACOMBO;
2876 } 3023 }
2877 if (chip->driver_caps & AZX_DCAPS_POSFIX_LPIB) { 3024 if (chip->driver_caps & AZX_DCAPS_POSFIX_LPIB) {
2878 snd_printd(SFX "Using LPIB position fix\n"); 3025 snd_printd(SFX "%s: Using LPIB position fix\n", pci_name(chip->pci));
2879 return POS_FIX_LPIB; 3026 return POS_FIX_LPIB;
2880 } 3027 }
2881 return POS_FIX_AUTO; 3028 return POS_FIX_AUTO;
@@ -2884,7 +3031,7 @@ static int __devinit check_position_fix(struct azx *chip, int fix)
2884/* 3031/*
2885 * black-lists for probe_mask 3032 * black-lists for probe_mask
2886 */ 3033 */
2887static struct snd_pci_quirk probe_mask_list[] __devinitdata = { 3034static struct snd_pci_quirk probe_mask_list[] = {
2888 /* Thinkpad often breaks the controller communication when accessing 3035 /* Thinkpad often breaks the controller communication when accessing
2889 * to the non-working (or non-existing) modem codec slot. 3036 * to the non-working (or non-existing) modem codec slot.
2890 */ 3037 */
@@ -2905,7 +3052,7 @@ static struct snd_pci_quirk probe_mask_list[] __devinitdata = {
2905 3052
2906#define AZX_FORCE_CODEC_MASK 0x100 3053#define AZX_FORCE_CODEC_MASK 0x100
2907 3054
2908static void __devinit check_probe_mask(struct azx *chip, int dev) 3055static void check_probe_mask(struct azx *chip, int dev)
2909{ 3056{
2910 const struct snd_pci_quirk *q; 3057 const struct snd_pci_quirk *q;
2911 3058
@@ -2933,7 +3080,7 @@ static void __devinit check_probe_mask(struct azx *chip, int dev)
2933/* 3080/*
2934 * white/black-list for enable_msi 3081 * white/black-list for enable_msi
2935 */ 3082 */
2936static struct snd_pci_quirk msi_black_list[] __devinitdata = { 3083static struct snd_pci_quirk msi_black_list[] = {
2937 SND_PCI_QUIRK(0x1043, 0x81f2, "ASUS", 0), /* Athlon64 X2 + nvidia */ 3084 SND_PCI_QUIRK(0x1043, 0x81f2, "ASUS", 0), /* Athlon64 X2 + nvidia */
2938 SND_PCI_QUIRK(0x1043, 0x81f6, "ASUS", 0), /* nvidia */ 3085 SND_PCI_QUIRK(0x1043, 0x81f6, "ASUS", 0), /* nvidia */
2939 SND_PCI_QUIRK(0x1043, 0x822d, "ASUS", 0), /* Athlon64 X2 + nvidia MCP55 */ 3086 SND_PCI_QUIRK(0x1043, 0x822d, "ASUS", 0), /* Athlon64 X2 + nvidia MCP55 */
@@ -2942,7 +3089,7 @@ static struct snd_pci_quirk msi_black_list[] __devinitdata = {
2942 {} 3089 {}
2943}; 3090};
2944 3091
2945static void __devinit check_msi(struct azx *chip) 3092static void check_msi(struct azx *chip)
2946{ 3093{
2947 const struct snd_pci_quirk *q; 3094 const struct snd_pci_quirk *q;
2948 3095
@@ -2968,7 +3115,7 @@ static void __devinit check_msi(struct azx *chip)
2968} 3115}
2969 3116
2970/* check the snoop mode availability */ 3117/* check the snoop mode availability */
2971static void __devinit azx_check_snoop_available(struct azx *chip) 3118static void azx_check_snoop_available(struct azx *chip)
2972{ 3119{
2973 bool snoop = chip->snoop; 3120 bool snoop = chip->snoop;
2974 3121
@@ -2991,8 +3138,8 @@ static void __devinit azx_check_snoop_available(struct azx *chip)
2991 } 3138 }
2992 3139
2993 if (snoop != chip->snoop) { 3140 if (snoop != chip->snoop) {
2994 snd_printk(KERN_INFO SFX "Force to %s mode\n", 3141 snd_printk(KERN_INFO SFX "%s: Force to %s mode\n",
2995 snoop ? "snoop" : "non-snoop"); 3142 pci_name(chip->pci), snoop ? "snoop" : "non-snoop");
2996 chip->snoop = snoop; 3143 chip->snoop = snoop;
2997 } 3144 }
2998} 3145}
@@ -3000,9 +3147,9 @@ static void __devinit azx_check_snoop_available(struct azx *chip)
3000/* 3147/*
3001 * constructor 3148 * constructor
3002 */ 3149 */
3003static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci, 3150static int azx_create(struct snd_card *card, struct pci_dev *pci,
3004 int dev, unsigned int driver_caps, 3151 int dev, unsigned int driver_caps,
3005 struct azx **rchip) 3152 struct azx **rchip)
3006{ 3153{
3007 static struct snd_device_ops ops = { 3154 static struct snd_device_ops ops = {
3008 .dev_free = azx_dev_free, 3155 .dev_free = azx_dev_free,
@@ -3018,7 +3165,7 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci,
3018 3165
3019 chip = kzalloc(sizeof(*chip), GFP_KERNEL); 3166 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
3020 if (!chip) { 3167 if (!chip) {
3021 snd_printk(KERN_ERR SFX "cannot allocate chip\n"); 3168 snd_printk(KERN_ERR SFX "%s: Cannot allocate chip\n", pci_name(pci));
3022 pci_disable_device(pci); 3169 pci_disable_device(pci);
3023 return -ENOMEM; 3170 return -ENOMEM;
3024 } 3171 }
@@ -3036,6 +3183,7 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci,
3036 INIT_LIST_HEAD(&chip->pcm_list); 3183 INIT_LIST_HEAD(&chip->pcm_list);
3037 INIT_LIST_HEAD(&chip->list); 3184 INIT_LIST_HEAD(&chip->list);
3038 init_vga_switcheroo(chip); 3185 init_vga_switcheroo(chip);
3186 init_completion(&chip->probe_wait);
3039 3187
3040 chip->position_fix[0] = chip->position_fix[1] = 3188 chip->position_fix[0] = chip->position_fix[1] =
3041 check_position_fix(chip, position_fix[dev]); 3189 check_position_fix(chip, position_fix[dev]);
@@ -3063,29 +3211,10 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci,
3063 } 3211 }
3064 } 3212 }
3065 3213
3066 if (check_hdmi_disabled(pci)) {
3067 snd_printk(KERN_INFO SFX "VGA controller for %s is disabled\n",
3068 pci_name(pci));
3069 if (use_vga_switcheroo(chip)) {
3070 snd_printk(KERN_INFO SFX "Delaying initialization\n");
3071 chip->disabled = true;
3072 goto ok;
3073 }
3074 kfree(chip);
3075 pci_disable_device(pci);
3076 return -ENXIO;
3077 }
3078
3079 err = azx_first_init(chip);
3080 if (err < 0) {
3081 azx_free(chip);
3082 return err;
3083 }
3084
3085 ok:
3086 err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops); 3214 err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
3087 if (err < 0) { 3215 if (err < 0) {
3088 snd_printk(KERN_ERR SFX "Error creating device [card]!\n"); 3216 snd_printk(KERN_ERR SFX "%s: Error creating device [card]!\n",
3217 pci_name(chip->pci));
3089 azx_free(chip); 3218 azx_free(chip);
3090 return err; 3219 return err;
3091 } 3220 }
@@ -3094,7 +3223,7 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci,
3094 return 0; 3223 return 0;
3095} 3224}
3096 3225
3097static int DELAYED_INIT_MARK azx_first_init(struct azx *chip) 3226static int azx_first_init(struct azx *chip)
3098{ 3227{
3099 int dev = chip->dev_index; 3228 int dev = chip->dev_index;
3100 struct pci_dev *pci = chip->pci; 3229 struct pci_dev *pci = chip->pci;
@@ -3120,7 +3249,7 @@ static int DELAYED_INIT_MARK azx_first_init(struct azx *chip)
3120 chip->addr = pci_resource_start(pci, 0); 3249 chip->addr = pci_resource_start(pci, 0);
3121 chip->remap_addr = pci_ioremap_bar(pci, 0); 3250 chip->remap_addr = pci_ioremap_bar(pci, 0);
3122 if (chip->remap_addr == NULL) { 3251 if (chip->remap_addr == NULL) {
3123 snd_printk(KERN_ERR SFX "ioremap error\n"); 3252 snd_printk(KERN_ERR SFX "%s: ioremap error\n", pci_name(chip->pci));
3124 return -ENXIO; 3253 return -ENXIO;
3125 } 3254 }
3126 3255
@@ -3135,7 +3264,7 @@ static int DELAYED_INIT_MARK azx_first_init(struct azx *chip)
3135 synchronize_irq(chip->irq); 3264 synchronize_irq(chip->irq);
3136 3265
3137 gcap = azx_readw(chip, GCAP); 3266 gcap = azx_readw(chip, GCAP);
3138 snd_printdd(SFX "chipset global capabilities = 0x%x\n", gcap); 3267 snd_printdd(SFX "%s: chipset global capabilities = 0x%x\n", pci_name(chip->pci), gcap);
3139 3268
3140 /* disable SB600 64bit support for safety */ 3269 /* disable SB600 64bit support for safety */
3141 if (chip->pci->vendor == PCI_VENDOR_ID_ATI) { 3270 if (chip->pci->vendor == PCI_VENDOR_ID_ATI) {
@@ -3152,7 +3281,7 @@ static int DELAYED_INIT_MARK azx_first_init(struct azx *chip)
3152 3281
3153 /* disable 64bit DMA address on some devices */ 3282 /* disable 64bit DMA address on some devices */
3154 if (chip->driver_caps & AZX_DCAPS_NO_64BIT) { 3283 if (chip->driver_caps & AZX_DCAPS_NO_64BIT) {
3155 snd_printd(SFX "Disabling 64bit DMA\n"); 3284 snd_printd(SFX "%s: Disabling 64bit DMA\n", pci_name(chip->pci));
3156 gcap &= ~ICH6_GCAP_64OK; 3285 gcap &= ~ICH6_GCAP_64OK;
3157 } 3286 }
3158 3287
@@ -3207,7 +3336,7 @@ static int DELAYED_INIT_MARK azx_first_init(struct azx *chip)
3207 chip->azx_dev = kcalloc(chip->num_streams, sizeof(*chip->azx_dev), 3336 chip->azx_dev = kcalloc(chip->num_streams, sizeof(*chip->azx_dev),
3208 GFP_KERNEL); 3337 GFP_KERNEL);
3209 if (!chip->azx_dev) { 3338 if (!chip->azx_dev) {
3210 snd_printk(KERN_ERR SFX "cannot malloc azx_dev\n"); 3339 snd_printk(KERN_ERR SFX "%s: cannot malloc azx_dev\n", pci_name(chip->pci));
3211 return -ENOMEM; 3340 return -ENOMEM;
3212 } 3341 }
3213 3342
@@ -3217,7 +3346,7 @@ static int DELAYED_INIT_MARK azx_first_init(struct azx *chip)
3217 snd_dma_pci_data(chip->pci), 3346 snd_dma_pci_data(chip->pci),
3218 BDL_SIZE, &chip->azx_dev[i].bdl); 3347 BDL_SIZE, &chip->azx_dev[i].bdl);
3219 if (err < 0) { 3348 if (err < 0) {
3220 snd_printk(KERN_ERR SFX "cannot allocate BDL\n"); 3349 snd_printk(KERN_ERR SFX "%s: cannot allocate BDL\n", pci_name(chip->pci));
3221 return -ENOMEM; 3350 return -ENOMEM;
3222 } 3351 }
3223 mark_pages_wc(chip, &chip->azx_dev[i].bdl, true); 3352 mark_pages_wc(chip, &chip->azx_dev[i].bdl, true);
@@ -3227,7 +3356,7 @@ static int DELAYED_INIT_MARK azx_first_init(struct azx *chip)
3227 snd_dma_pci_data(chip->pci), 3356 snd_dma_pci_data(chip->pci),
3228 chip->num_streams * 8, &chip->posbuf); 3357 chip->num_streams * 8, &chip->posbuf);
3229 if (err < 0) { 3358 if (err < 0) {
3230 snd_printk(KERN_ERR SFX "cannot allocate posbuf\n"); 3359 snd_printk(KERN_ERR SFX "%s: cannot allocate posbuf\n", pci_name(chip->pci));
3231 return -ENOMEM; 3360 return -ENOMEM;
3232 } 3361 }
3233 mark_pages_wc(chip, &chip->posbuf, true); 3362 mark_pages_wc(chip, &chip->posbuf, true);
@@ -3245,7 +3374,7 @@ static int DELAYED_INIT_MARK azx_first_init(struct azx *chip)
3245 3374
3246 /* codec detection */ 3375 /* codec detection */
3247 if (!chip->codec_mask) { 3376 if (!chip->codec_mask) {
3248 snd_printk(KERN_ERR SFX "no codecs found!\n"); 3377 snd_printk(KERN_ERR SFX "%s: no codecs found!\n", pci_name(chip->pci));
3249 return -ENODEV; 3378 return -ENODEV;
3250 } 3379 }
3251 3380
@@ -3281,7 +3410,8 @@ static void azx_firmware_cb(const struct firmware *fw, void *context)
3281 struct pci_dev *pci = chip->pci; 3410 struct pci_dev *pci = chip->pci;
3282 3411
3283 if (!fw) { 3412 if (!fw) {
3284 snd_printk(KERN_ERR SFX "Cannot load firmware, aborting\n"); 3413 snd_printk(KERN_ERR SFX "%s: Cannot load firmware, aborting\n",
3414 pci_name(chip->pci));
3285 goto error; 3415 goto error;
3286 } 3416 }
3287 3417
@@ -3299,8 +3429,8 @@ static void azx_firmware_cb(const struct firmware *fw, void *context)
3299} 3429}
3300#endif 3430#endif
3301 3431
3302static int __devinit azx_probe(struct pci_dev *pci, 3432static int azx_probe(struct pci_dev *pci,
3303 const struct pci_device_id *pci_id) 3433 const struct pci_device_id *pci_id)
3304{ 3434{
3305 static int dev; 3435 static int dev;
3306 struct snd_card *card; 3436 struct snd_card *card;
@@ -3317,7 +3447,7 @@ static int __devinit azx_probe(struct pci_dev *pci,
3317 3447
3318 err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card); 3448 err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
3319 if (err < 0) { 3449 if (err < 0) {
3320 snd_printk(KERN_ERR SFX "Error creating card!\n"); 3450 snd_printk(KERN_ERR "hda-intel: Error creating card!\n");
3321 return err; 3451 return err;
3322 } 3452 }
3323 3453
@@ -3327,12 +3457,34 @@ static int __devinit azx_probe(struct pci_dev *pci,
3327 if (err < 0) 3457 if (err < 0)
3328 goto out_free; 3458 goto out_free;
3329 card->private_data = chip; 3459 card->private_data = chip;
3460
3461 pci_set_drvdata(pci, card);
3462
3463 err = register_vga_switcheroo(chip);
3464 if (err < 0) {
3465 snd_printk(KERN_ERR SFX
3466 "%s: Error registering VGA-switcheroo client\n", pci_name(pci));
3467 goto out_free;
3468 }
3469
3470 if (check_hdmi_disabled(pci)) {
3471 snd_printk(KERN_INFO SFX "%s: VGA controller is disabled\n",
3472 pci_name(pci));
3473 snd_printk(KERN_INFO SFX "%s: Delaying initialization\n", pci_name(pci));
3474 chip->disabled = true;
3475 }
3476
3330 probe_now = !chip->disabled; 3477 probe_now = !chip->disabled;
3478 if (probe_now) {
3479 err = azx_first_init(chip);
3480 if (err < 0)
3481 goto out_free;
3482 }
3331 3483
3332#ifdef CONFIG_SND_HDA_PATCH_LOADER 3484#ifdef CONFIG_SND_HDA_PATCH_LOADER
3333 if (patch[dev] && *patch[dev]) { 3485 if (patch[dev] && *patch[dev]) {
3334 snd_printk(KERN_ERR SFX "Applying patch firmware '%s'\n", 3486 snd_printk(KERN_ERR SFX "%s: Applying patch firmware '%s'\n",
3335 patch[dev]); 3487 pci_name(pci), patch[dev]);
3336 err = request_firmware_nowait(THIS_MODULE, true, patch[dev], 3488 err = request_firmware_nowait(THIS_MODULE, true, patch[dev],
3337 &pci->dev, GFP_KERNEL, card, 3489 &pci->dev, GFP_KERNEL, card,
3338 azx_firmware_cb); 3490 azx_firmware_cb);
@@ -3348,27 +3500,20 @@ static int __devinit azx_probe(struct pci_dev *pci,
3348 goto out_free; 3500 goto out_free;
3349 } 3501 }
3350 3502
3351 pci_set_drvdata(pci, card);
3352
3353 if (pci_dev_run_wake(pci)) 3503 if (pci_dev_run_wake(pci))
3354 pm_runtime_put_noidle(&pci->dev); 3504 pm_runtime_put_noidle(&pci->dev);
3355 3505
3356 err = register_vga_switcheroo(chip);
3357 if (err < 0) {
3358 snd_printk(KERN_ERR SFX
3359 "Error registering VGA-switcheroo client\n");
3360 goto out_free;
3361 }
3362
3363 dev++; 3506 dev++;
3507 complete_all(&chip->probe_wait);
3364 return 0; 3508 return 0;
3365 3509
3366out_free: 3510out_free:
3367 snd_card_free(card); 3511 snd_card_free(card);
3512 pci_set_drvdata(pci, NULL);
3368 return err; 3513 return err;
3369} 3514}
3370 3515
3371static int DELAYED_INIT_MARK azx_probe_continue(struct azx *chip) 3516static int azx_probe_continue(struct azx *chip)
3372{ 3517{
3373 int dev = chip->dev_index; 3518 int dev = chip->dev_index;
3374 int err; 3519 int err;
@@ -3387,8 +3532,10 @@ static int DELAYED_INIT_MARK azx_probe_continue(struct azx *chip)
3387 chip->fw->data); 3532 chip->fw->data);
3388 if (err < 0) 3533 if (err < 0)
3389 goto out_free; 3534 goto out_free;
3535#ifndef CONFIG_PM
3390 release_firmware(chip->fw); /* no longer needed */ 3536 release_firmware(chip->fw); /* no longer needed */
3391 chip->fw = NULL; 3537 chip->fw = NULL;
3538#endif
3392 } 3539 }
3393#endif 3540#endif
3394 if ((probe_only[dev] & 1) == 0) { 3541 if ((probe_only[dev] & 1) == 0) {
@@ -3423,7 +3570,7 @@ out_free:
3423 return err; 3570 return err;
3424} 3571}
3425 3572
3426static void __devexit azx_remove(struct pci_dev *pci) 3573static void azx_remove(struct pci_dev *pci)
3427{ 3574{
3428 struct snd_card *card = pci_get_drvdata(pci); 3575 struct snd_card *card = pci_get_drvdata(pci);
3429 3576
@@ -3610,7 +3757,7 @@ static struct pci_driver azx_driver = {
3610 .name = KBUILD_MODNAME, 3757 .name = KBUILD_MODNAME,
3611 .id_table = azx_ids, 3758 .id_table = azx_ids,
3612 .probe = azx_probe, 3759 .probe = azx_probe,
3613 .remove = __devexit_p(azx_remove), 3760 .remove = azx_remove,
3614 .driver = { 3761 .driver = {
3615 .pm = AZX_PM_OPS, 3762 .pm = AZX_PM_OPS,
3616 }, 3763 },
diff --git a/sound/pci/hda/hda_intel_trace.h b/sound/pci/hda/hda_intel_trace.h
new file mode 100644
index 000000000000..7b5e4c2cf9d5
--- /dev/null
+++ b/sound/pci/hda/hda_intel_trace.h
@@ -0,0 +1,62 @@
1#undef TRACE_SYSTEM
2#define TRACE_SYSTEM hda_intel
3#define TRACE_INCLUDE_FILE hda_intel_trace
4
5#if !defined(_TRACE_HDA_INTEL_H) || defined(TRACE_HEADER_MULTI_READ)
6#define _TRACE_HDA_INTEL_H
7
8#include <linux/tracepoint.h>
9
10struct azx;
11struct azx_dev;
12
13TRACE_EVENT(azx_pcm_trigger,
14
15 TP_PROTO(struct azx *chip, struct azx_dev *dev, int cmd),
16
17 TP_ARGS(chip, dev, cmd),
18
19 TP_STRUCT__entry(
20 __field( int, card )
21 __field( int, idx )
22 __field( int, cmd )
23 ),
24
25 TP_fast_assign(
26 __entry->card = (chip)->card->number;
27 __entry->idx = (dev)->index;
28 __entry->cmd = cmd;
29 ),
30
31 TP_printk("[%d:%d] cmd=%d", __entry->card, __entry->idx, __entry->cmd)
32);
33
34TRACE_EVENT(azx_get_position,
35
36 TP_PROTO(struct azx *chip, struct azx_dev *dev, unsigned int pos, unsigned int delay),
37
38 TP_ARGS(chip, dev, pos, delay),
39
40 TP_STRUCT__entry(
41 __field( int, card )
42 __field( int, idx )
43 __field( unsigned int, pos )
44 __field( unsigned int, delay )
45 ),
46
47 TP_fast_assign(
48 __entry->card = (chip)->card->number;
49 __entry->idx = (dev)->index;
50 __entry->pos = pos;
51 __entry->delay = delay;
52 ),
53
54 TP_printk("[%d:%d] pos=%u, delay=%u", __entry->card, __entry->idx, __entry->pos, __entry->delay)
55);
56
57#endif /* _TRACE_HDA_INTEL_H */
58
59/* This part must be outside protection */
60#undef TRACE_INCLUDE_PATH
61#define TRACE_INCLUDE_PATH .
62#include <trace/define_trace.h>
diff --git a/sound/pci/hda/hda_jack.c b/sound/pci/hda/hda_jack.c
index 5c690cb873d4..6e9f57bbe667 100644
--- a/sound/pci/hda/hda_jack.c
+++ b/sound/pci/hda/hda_jack.c
@@ -95,7 +95,6 @@ snd_hda_jack_tbl_new(struct hda_codec *codec, hda_nid_t nid)
95 struct hda_jack_tbl *jack = snd_hda_jack_tbl_get(codec, nid); 95 struct hda_jack_tbl *jack = snd_hda_jack_tbl_get(codec, nid);
96 if (jack) 96 if (jack)
97 return jack; 97 return jack;
98 snd_array_init(&codec->jacktbl, sizeof(*jack), 16);
99 jack = snd_array_new(&codec->jacktbl); 98 jack = snd_array_new(&codec->jacktbl);
100 if (!jack) 99 if (!jack)
101 return NULL; 100 return NULL;
@@ -122,6 +121,8 @@ void snd_hda_jack_tbl_clear(struct hda_codec *codec)
122 snd_array_free(&codec->jacktbl); 121 snd_array_free(&codec->jacktbl);
123} 122}
124 123
124#define get_jack_plug_state(sense) !!(sense & AC_PINSENSE_PRESENCE)
125
125/* update the cached value and notification flag if needed */ 126/* update the cached value and notification flag if needed */
126static void jack_detect_update(struct hda_codec *codec, 127static void jack_detect_update(struct hda_codec *codec,
127 struct hda_jack_tbl *jack) 128 struct hda_jack_tbl *jack)
@@ -134,7 +135,21 @@ static void jack_detect_update(struct hda_codec *codec,
134 else 135 else
135 jack->pin_sense = read_pin_sense(codec, jack->nid); 136 jack->pin_sense = read_pin_sense(codec, jack->nid);
136 137
138 /* A gating jack indicates the jack is invalid if gating is unplugged */
139 if (jack->gating_jack && !snd_hda_jack_detect(codec, jack->gating_jack))
140 jack->pin_sense &= ~AC_PINSENSE_PRESENCE;
141
137 jack->jack_dirty = 0; 142 jack->jack_dirty = 0;
143
144 /* If a jack is gated by this one update it. */
145 if (jack->gated_jack) {
146 struct hda_jack_tbl *gated =
147 snd_hda_jack_tbl_get(codec, jack->gated_jack);
148 if (gated) {
149 gated->jack_dirty = 1;
150 jack_detect_update(codec, gated);
151 }
152 }
138} 153}
139 154
140/** 155/**
@@ -173,8 +188,6 @@ u32 snd_hda_pin_sense(struct hda_codec *codec, hda_nid_t nid)
173} 188}
174EXPORT_SYMBOL_HDA(snd_hda_pin_sense); 189EXPORT_SYMBOL_HDA(snd_hda_pin_sense);
175 190
176#define get_jack_plug_state(sense) !!(sense & AC_PINSENSE_PRESENCE)
177
178/** 191/**
179 * snd_hda_jack_detect - query pin Presence Detect status 192 * snd_hda_jack_detect - query pin Presence Detect status
180 * @codec: the CODEC to sense 193 * @codec: the CODEC to sense
@@ -206,6 +219,8 @@ int snd_hda_jack_detect_enable_callback(struct hda_codec *codec, hda_nid_t nid,
206 jack->action = action; 219 jack->action = action;
207 if (cb) 220 if (cb)
208 jack->callback = cb; 221 jack->callback = cb;
222 if (codec->jackpoll_interval > 0)
223 return 0; /* No unsol if we're polling instead */
209 return snd_hda_codec_write_cache(codec, nid, 0, 224 return snd_hda_codec_write_cache(codec, nid, 0,
210 AC_VERB_SET_UNSOLICITED_ENABLE, 225 AC_VERB_SET_UNSOLICITED_ENABLE,
211 AC_USRSP_EN | jack->tag); 226 AC_USRSP_EN | jack->tag);
@@ -220,16 +235,46 @@ int snd_hda_jack_detect_enable(struct hda_codec *codec, hda_nid_t nid,
220EXPORT_SYMBOL_HDA(snd_hda_jack_detect_enable); 235EXPORT_SYMBOL_HDA(snd_hda_jack_detect_enable);
221 236
222/** 237/**
238 * snd_hda_jack_set_gating_jack - Set gating jack.
239 *
240 * Indicates the gated jack is only valid when the gating jack is plugged.
241 */
242int snd_hda_jack_set_gating_jack(struct hda_codec *codec, hda_nid_t gated_nid,
243 hda_nid_t gating_nid)
244{
245 struct hda_jack_tbl *gated = snd_hda_jack_tbl_get(codec, gated_nid);
246 struct hda_jack_tbl *gating = snd_hda_jack_tbl_get(codec, gating_nid);
247
248 if (!gated || !gating)
249 return -EINVAL;
250
251 gated->gating_jack = gating_nid;
252 gating->gated_jack = gated_nid;
253
254 return 0;
255}
256EXPORT_SYMBOL_HDA(snd_hda_jack_set_gating_jack);
257
258/**
223 * snd_hda_jack_report_sync - sync the states of all jacks and report if changed 259 * snd_hda_jack_report_sync - sync the states of all jacks and report if changed
224 */ 260 */
225void snd_hda_jack_report_sync(struct hda_codec *codec) 261void snd_hda_jack_report_sync(struct hda_codec *codec)
226{ 262{
227 struct hda_jack_tbl *jack = codec->jacktbl.list; 263 struct hda_jack_tbl *jack;
228 int i, state; 264 int i, state;
229 265
266 /* update all jacks at first */
267 jack = codec->jacktbl.list;
230 for (i = 0; i < codec->jacktbl.used; i++, jack++) 268 for (i = 0; i < codec->jacktbl.used; i++, jack++)
231 if (jack->nid) { 269 if (jack->nid)
232 jack_detect_update(codec, jack); 270 jack_detect_update(codec, jack);
271
272 /* report the updated jacks; it's done after updating all jacks
273 * to make sure that all gating jacks properly have been set
274 */
275 jack = codec->jacktbl.list;
276 for (i = 0; i < codec->jacktbl.used; i++, jack++)
277 if (jack->nid) {
233 if (!jack->kctl) 278 if (!jack->kctl)
234 continue; 279 continue;
235 state = get_jack_plug_state(jack->pin_sense); 280 state = get_jack_plug_state(jack->pin_sense);
@@ -422,6 +467,19 @@ int snd_hda_jack_add_kctls(struct hda_codec *codec,
422} 467}
423EXPORT_SYMBOL_HDA(snd_hda_jack_add_kctls); 468EXPORT_SYMBOL_HDA(snd_hda_jack_add_kctls);
424 469
470static void call_jack_callback(struct hda_codec *codec,
471 struct hda_jack_tbl *jack)
472{
473 if (jack->callback)
474 jack->callback(codec, jack);
475 if (jack->gated_jack) {
476 struct hda_jack_tbl *gated =
477 snd_hda_jack_tbl_get(codec, jack->gated_jack);
478 if (gated && gated->callback)
479 gated->callback(codec, gated);
480 }
481}
482
425void snd_hda_jack_unsol_event(struct hda_codec *codec, unsigned int res) 483void snd_hda_jack_unsol_event(struct hda_codec *codec, unsigned int res)
426{ 484{
427 struct hda_jack_tbl *event; 485 struct hda_jack_tbl *event;
@@ -432,10 +490,29 @@ void snd_hda_jack_unsol_event(struct hda_codec *codec, unsigned int res)
432 return; 490 return;
433 event->jack_dirty = 1; 491 event->jack_dirty = 1;
434 492
435 if (event->callback) 493 call_jack_callback(codec, event);
436 event->callback(codec, event);
437
438 snd_hda_jack_report_sync(codec); 494 snd_hda_jack_report_sync(codec);
439} 495}
440EXPORT_SYMBOL_HDA(snd_hda_jack_unsol_event); 496EXPORT_SYMBOL_HDA(snd_hda_jack_unsol_event);
441 497
498void snd_hda_jack_poll_all(struct hda_codec *codec)
499{
500 struct hda_jack_tbl *jack = codec->jacktbl.list;
501 int i, changes = 0;
502
503 for (i = 0; i < codec->jacktbl.used; i++, jack++) {
504 unsigned int old_sense;
505 if (!jack->nid || !jack->jack_dirty || jack->phantom_jack)
506 continue;
507 old_sense = get_jack_plug_state(jack->pin_sense);
508 jack_detect_update(codec, jack);
509 if (old_sense == get_jack_plug_state(jack->pin_sense))
510 continue;
511 changes = 1;
512 call_jack_callback(codec, jack);
513 }
514 if (changes)
515 snd_hda_jack_report_sync(codec);
516}
517EXPORT_SYMBOL_HDA(snd_hda_jack_poll_all);
518
diff --git a/sound/pci/hda/hda_jack.h b/sound/pci/hda/hda_jack.h
index af8dd4724da5..ec12abd45263 100644
--- a/sound/pci/hda/hda_jack.h
+++ b/sound/pci/hda/hda_jack.h
@@ -28,6 +28,8 @@ struct hda_jack_tbl {
28 unsigned int jack_detect:1; /* capable of jack-detection? */ 28 unsigned int jack_detect:1; /* capable of jack-detection? */
29 unsigned int jack_dirty:1; /* needs to update? */ 29 unsigned int jack_dirty:1; /* needs to update? */
30 unsigned int phantom_jack:1; /* a fixed, always present port? */ 30 unsigned int phantom_jack:1; /* a fixed, always present port? */
31 hda_nid_t gating_jack; /* valid when gating jack plugged */
32 hda_nid_t gated_jack; /* gated is dependent on this jack */
31 struct snd_kcontrol *kctl; /* assigned kctl for jack-detection */ 33 struct snd_kcontrol *kctl; /* assigned kctl for jack-detection */
32#ifdef CONFIG_SND_HDA_INPUT_JACK 34#ifdef CONFIG_SND_HDA_INPUT_JACK
33 int type; 35 int type;
@@ -69,6 +71,8 @@ int snd_hda_jack_detect_enable_callback(struct hda_codec *codec, hda_nid_t nid,
69 unsigned char action, 71 unsigned char action,
70 hda_jack_callback cb); 72 hda_jack_callback cb);
71 73
74int snd_hda_jack_set_gating_jack(struct hda_codec *codec, hda_nid_t gated_nid,
75 hda_nid_t gating_nid);
72 76
73u32 snd_hda_pin_sense(struct hda_codec *codec, hda_nid_t nid); 77u32 snd_hda_pin_sense(struct hda_codec *codec, hda_nid_t nid);
74int snd_hda_jack_detect(struct hda_codec *codec, hda_nid_t nid); 78int snd_hda_jack_detect(struct hda_codec *codec, hda_nid_t nid);
@@ -84,4 +88,6 @@ void snd_hda_jack_report_sync(struct hda_codec *codec);
84 88
85void snd_hda_jack_unsol_event(struct hda_codec *codec, unsigned int res); 89void snd_hda_jack_unsol_event(struct hda_codec *codec, unsigned int res);
86 90
91void snd_hda_jack_poll_all(struct hda_codec *codec);
92
87#endif /* __SOUND_HDA_JACK_H */ 93#endif /* __SOUND_HDA_JACK_H */
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h
index 09dbdc37f781..4b40a5e7a8f5 100644
--- a/sound/pci/hda/hda_local.h
+++ b/sound/pci/hda/hda_local.h
@@ -240,9 +240,11 @@ int snd_hda_mixer_bind_tlv(struct snd_kcontrol *kcontrol, int op_flag,
240/* 240/*
241 * SPDIF I/O 241 * SPDIF I/O
242 */ 242 */
243int snd_hda_create_spdif_out_ctls(struct hda_codec *codec, 243int snd_hda_create_dig_out_ctls(struct hda_codec *codec,
244 hda_nid_t associated_nid, 244 hda_nid_t associated_nid,
245 hda_nid_t cvt_nid); 245 hda_nid_t cvt_nid, int type);
246#define snd_hda_create_spdif_out_ctls(codec, anid, cnid) \
247 snd_hda_create_dig_out_ctls(codec, anid, cnid, HDA_PCM_TYPE_SPDIF)
246int snd_hda_create_spdif_in_ctls(struct hda_codec *codec, hda_nid_t nid); 248int snd_hda_create_spdif_in_ctls(struct hda_codec *codec, hda_nid_t nid);
247 249
248/* 250/*
@@ -599,6 +601,15 @@ int snd_hda_check_amp_list_power(struct hda_codec *codec,
599#define get_amp_min_mute(kc) (((kc)->private_value >> 29) & 0x1) 601#define get_amp_min_mute(kc) (((kc)->private_value >> 29) & 0x1)
600 602
601/* 603/*
604 * enum control helper
605 */
606int snd_hda_enum_helper_info(struct snd_kcontrol *kcontrol,
607 struct snd_ctl_elem_info *uinfo,
608 int num_entries, const char * const *texts);
609#define snd_hda_enum_bool_helper_info(kcontrol, uinfo) \
610 snd_hda_enum_helper_info(kcontrol, uinfo, 0, NULL)
611
612/*
602 * CEA Short Audio Descriptor data 613 * CEA Short Audio Descriptor data
603 */ 614 */
604struct cea_sad { 615struct cea_sad {
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
index 1eeba7386666..89fc5030ec79 100644
--- a/sound/pci/hda/patch_analog.c
+++ b/sound/pci/hda/patch_analog.c
@@ -636,7 +636,6 @@ static void ad198x_free(struct hda_codec *codec)
636 if (!spec) 636 if (!spec)
637 return; 637 return;
638 638
639 ad198x_shutup(codec);
640 ad198x_free_kctls(codec); 639 ad198x_free_kctls(codec);
641 kfree(spec); 640 kfree(spec);
642 snd_hda_detach_beep_device(codec); 641 snd_hda_detach_beep_device(codec);
@@ -1247,16 +1246,27 @@ static int is_jack_available(struct hda_codec *codec, hda_nid_t nid)
1247 return get_defcfg_connect(conf) != AC_JACK_PORT_NONE; 1246 return get_defcfg_connect(conf) != AC_JACK_PORT_NONE;
1248} 1247}
1249 1248
1250static int patch_ad1986a(struct hda_codec *codec) 1249static int alloc_ad_spec(struct hda_codec *codec)
1251{ 1250{
1252 struct ad198x_spec *spec; 1251 struct ad198x_spec *spec;
1253 int err, board_config;
1254 1252
1255 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 1253 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1256 if (spec == NULL) 1254 if (!spec)
1257 return -ENOMEM; 1255 return -ENOMEM;
1258
1259 codec->spec = spec; 1256 codec->spec = spec;
1257 snd_array_init(&spec->kctls, sizeof(struct snd_kcontrol_new), 32);
1258 return 0;
1259}
1260
1261static int patch_ad1986a(struct hda_codec *codec)
1262{
1263 struct ad198x_spec *spec;
1264 int err, board_config;
1265
1266 err = alloc_ad_spec(codec);
1267 if (err < 0)
1268 return err;
1269 spec = codec->spec;
1260 1270
1261 err = snd_hda_attach_beep_device(codec, 0x19); 1271 err = snd_hda_attach_beep_device(codec, 0x19);
1262 if (err < 0) { 1272 if (err < 0) {
@@ -1549,11 +1559,10 @@ static int patch_ad1983(struct hda_codec *codec)
1549 struct ad198x_spec *spec; 1559 struct ad198x_spec *spec;
1550 int err; 1560 int err;
1551 1561
1552 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 1562 err = alloc_ad_spec(codec);
1553 if (spec == NULL) 1563 if (err < 0)
1554 return -ENOMEM; 1564 return err;
1555 1565 spec = codec->spec;
1556 codec->spec = spec;
1557 1566
1558 err = snd_hda_attach_beep_device(codec, 0x10); 1567 err = snd_hda_attach_beep_device(codec, 0x10);
1559 if (err < 0) { 1568 if (err < 0) {
@@ -1955,11 +1964,10 @@ static int patch_ad1981(struct hda_codec *codec)
1955 struct ad198x_spec *spec; 1964 struct ad198x_spec *spec;
1956 int err, board_config; 1965 int err, board_config;
1957 1966
1958 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 1967 err = alloc_ad_spec(codec);
1959 if (spec == NULL) 1968 if (err < 0)
1960 return -ENOMEM; 1969 return -ENOMEM;
1961 1970 spec = codec->spec;
1962 codec->spec = spec;
1963 1971
1964 err = snd_hda_attach_beep_device(codec, 0x10); 1972 err = snd_hda_attach_beep_device(codec, 0x10);
1965 if (err < 0) { 1973 if (err < 0) {
@@ -2837,7 +2845,6 @@ static int add_control(struct ad198x_spec *spec, int type, const char *name,
2837{ 2845{
2838 struct snd_kcontrol_new *knew; 2846 struct snd_kcontrol_new *knew;
2839 2847
2840 snd_array_init(&spec->kctls, sizeof(*knew), 32);
2841 knew = snd_array_new(&spec->kctls); 2848 knew = snd_array_new(&spec->kctls);
2842 if (!knew) 2849 if (!knew)
2843 return -ENOMEM; 2850 return -ENOMEM;
@@ -3255,11 +3262,10 @@ static int patch_ad1988(struct hda_codec *codec)
3255 struct ad198x_spec *spec; 3262 struct ad198x_spec *spec;
3256 int err, board_config; 3263 int err, board_config;
3257 3264
3258 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 3265 err = alloc_ad_spec(codec);
3259 if (spec == NULL) 3266 if (err < 0)
3260 return -ENOMEM; 3267 return err;
3261 3268 spec = codec->spec;
3262 codec->spec = spec;
3263 3269
3264 if (is_rev2(codec)) 3270 if (is_rev2(codec))
3265 snd_printk(KERN_INFO "patch_analog: AD1988A rev.2 is detected, enable workarounds\n"); 3271 snd_printk(KERN_INFO "patch_analog: AD1988A rev.2 is detected, enable workarounds\n");
@@ -3575,11 +3581,10 @@ static int patch_ad1884(struct hda_codec *codec)
3575 struct ad198x_spec *spec; 3581 struct ad198x_spec *spec;
3576 int err; 3582 int err;
3577 3583
3578 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 3584 err = alloc_ad_spec(codec);
3579 if (spec == NULL) 3585 if (err < 0)
3580 return -ENOMEM; 3586 return err;
3581 3587 spec = codec->spec;
3582 codec->spec = spec;
3583 3588
3584 err = snd_hda_attach_beep_device(codec, 0x10); 3589 err = snd_hda_attach_beep_device(codec, 0x10);
3585 if (err < 0) { 3590 if (err < 0) {
@@ -4575,11 +4580,10 @@ static int patch_ad1884a(struct hda_codec *codec)
4575 struct ad198x_spec *spec; 4580 struct ad198x_spec *spec;
4576 int err, board_config; 4581 int err, board_config;
4577 4582
4578 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 4583 err = alloc_ad_spec(codec);
4579 if (spec == NULL) 4584 if (err < 0)
4580 return -ENOMEM; 4585 return err;
4581 4586 spec = codec->spec;
4582 codec->spec = spec;
4583 4587
4584 err = snd_hda_attach_beep_device(codec, 0x10); 4588 err = snd_hda_attach_beep_device(codec, 0x10);
4585 if (err < 0) { 4589 if (err < 0) {
@@ -4988,11 +4992,10 @@ static int patch_ad1882(struct hda_codec *codec)
4988 struct ad198x_spec *spec; 4992 struct ad198x_spec *spec;
4989 int err, board_config; 4993 int err, board_config;
4990 4994
4991 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 4995 err = alloc_ad_spec(codec);
4992 if (spec == NULL) 4996 if (err < 0)
4993 return -ENOMEM; 4997 return err;
4994 4998 spec = codec->spec;
4995 codec->spec = spec;
4996 4999
4997 err = snd_hda_attach_beep_device(codec, 0x10); 5000 err = snd_hda_attach_beep_device(codec, 0x10);
4998 if (err < 0) { 5001 if (err < 0) {
diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c
index 3bcb67172358..a2537b2f8724 100644
--- a/sound/pci/hda/patch_cirrus.c
+++ b/sound/pci/hda/patch_cirrus.c
@@ -68,6 +68,7 @@ struct cs_spec {
68 68
69 unsigned int hp_detect:1; 69 unsigned int hp_detect:1;
70 unsigned int mic_detect:1; 70 unsigned int mic_detect:1;
71 unsigned int speaker_2_1:1;
71 /* CS421x */ 72 /* CS421x */
72 unsigned int spdif_detect:1; 73 unsigned int spdif_detect:1;
73 unsigned int sense_b:1; 74 unsigned int sense_b:1;
@@ -84,7 +85,7 @@ enum {
84 CS420X_GPIO_13, 85 CS420X_GPIO_13,
85 CS420X_GPIO_23, 86 CS420X_GPIO_23,
86 CS420X_MBP101, 87 CS420X_MBP101,
87 CS420X_MBP101_COEF, 88 CS420X_MBP81,
88 CS420X_AUTO, 89 CS420X_AUTO,
89 /* aliases */ 90 /* aliases */
90 CS420X_IMAC27_122 = CS420X_GPIO_23, 91 CS420X_IMAC27_122 = CS420X_GPIO_23,
@@ -343,6 +344,9 @@ static int cs_build_pcms(struct hda_codec *codec)
343 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->dac_nid[0]; 344 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->dac_nid[0];
344 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 345 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max =
345 spec->multiout.max_channels; 346 spec->multiout.max_channels;
347 if (spec->speaker_2_1)
348 info->stream[SNDRV_PCM_STREAM_PLAYBACK].chmap =
349 snd_pcm_2_1_chmaps;
346 info->stream[SNDRV_PCM_STREAM_CAPTURE] = cs_pcm_analog_capture; 350 info->stream[SNDRV_PCM_STREAM_CAPTURE] = cs_pcm_analog_capture;
347 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = 351 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid =
348 spec->adc_nid[spec->cur_input]; 352 spec->adc_nid[spec->cur_input];
@@ -443,6 +447,9 @@ static int parse_output(struct hda_codec *codec)
443 spec->multiout.dac_nids = spec->dac_nid; 447 spec->multiout.dac_nids = spec->dac_nid;
444 spec->multiout.max_channels = i * 2; 448 spec->multiout.max_channels = i * 2;
445 449
450 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT && i == 2)
451 spec->speaker_2_1 = 1; /* assume 2.1 speakers */
452
446 /* add HP and speakers */ 453 /* add HP and speakers */
447 extra_nids = 0; 454 extra_nids = 0;
448 for (i = 0; i < cfg->hp_outs; i++) { 455 for (i = 0; i < cfg->hp_outs; i++) {
@@ -633,7 +640,9 @@ static int add_output(struct hda_codec *codec, hda_nid_t dac, int idx,
633 index = idx; 640 index = idx;
634 break; 641 break;
635 case AUTO_PIN_SPEAKER_OUT: 642 case AUTO_PIN_SPEAKER_OUT:
636 if (num_ctls > 1) 643 if (spec->speaker_2_1)
644 name = idx ? "Bass Speaker" : "Speaker";
645 else if (num_ctls > 1)
637 name = speakers[idx]; 646 name = speakers[idx];
638 else 647 else
639 name = "Speaker"; 648 name = "Speaker";
@@ -874,8 +883,9 @@ static int build_digital_output(struct hda_codec *codec)
874 if (!spec->multiout.dig_out_nid) 883 if (!spec->multiout.dig_out_nid)
875 return 0; 884 return 0;
876 885
877 err = snd_hda_create_spdif_out_ctls(codec, spec->multiout.dig_out_nid, 886 err = snd_hda_create_dig_out_ctls(codec, spec->multiout.dig_out_nid,
878 spec->multiout.dig_out_nid); 887 spec->multiout.dig_out_nid,
888 spec->pcm_rec[1].pcm_type);
879 if (err < 0) 889 if (err < 0)
880 return err; 890 return err;
881 err = snd_hda_create_spdif_share_sw(codec, &spec->multiout); 891 err = snd_hda_create_spdif_share_sw(codec, &spec->multiout);
@@ -1079,9 +1089,6 @@ static void init_input(struct hda_codec *codec)
1079 if (spec->mic_detect) 1089 if (spec->mic_detect)
1080 cs_automic(codec, NULL); 1090 cs_automic(codec, NULL);
1081 1091
1082 coef = 0x000a; /* ADC1/2 - Digital and Analog Soft Ramp */
1083 cs_vendor_coef_set(codec, IDX_ADC_CFG, coef);
1084
1085 coef = cs_vendor_coef_get(codec, IDX_BEEP_CFG); 1092 coef = cs_vendor_coef_get(codec, IDX_BEEP_CFG);
1086 if (is_active_pin(codec, CS_DMIC2_PIN_NID)) 1093 if (is_active_pin(codec, CS_DMIC2_PIN_NID))
1087 coef |= 1 << 4; /* DMIC2 2 chan on, GPIO1 off */ 1094 coef |= 1 << 4; /* DMIC2 2 chan on, GPIO1 off */
@@ -1111,6 +1118,9 @@ static const struct hda_verb cs_coef_init_verbs[] = {
1111 | 0x1000 /* Enable DACs High Pass Filter */ 1118 | 0x1000 /* Enable DACs High Pass Filter */
1112 | 0x0400 /* Disable Coefficient Auto increment */ 1119 | 0x0400 /* Disable Coefficient Auto increment */
1113 )}, 1120 )},
1121 /* ADC1/2 - Digital and Analog Soft Ramp */
1122 {0x11, AC_VERB_SET_COEF_INDEX, IDX_ADC_CFG},
1123 {0x11, AC_VERB_SET_PROC_COEF, 0x000a},
1114 /* Beep */ 1124 /* Beep */
1115 {0x11, AC_VERB_SET_COEF_INDEX, IDX_BEEP_CFG}, 1125 {0x11, AC_VERB_SET_COEF_INDEX, IDX_BEEP_CFG},
1116 {0x11, AC_VERB_SET_PROC_COEF, 0x0007}, /* Enable Beep thru DAC1/2/3 */ 1126 {0x11, AC_VERB_SET_PROC_COEF, 0x0007}, /* Enable Beep thru DAC1/2/3 */
@@ -1167,14 +1177,6 @@ static const struct hda_verb cs_errata_init_verbs[] = {
1167 {} /* terminator */ 1177 {} /* terminator */
1168}; 1178};
1169 1179
1170static const struct hda_verb mbp101_init_verbs[] = {
1171 {0x11, AC_VERB_SET_COEF_INDEX, 0x0002},
1172 {0x11, AC_VERB_SET_PROC_COEF, 0x100a},
1173 {0x11, AC_VERB_SET_COEF_INDEX, 0x0004},
1174 {0x11, AC_VERB_SET_PROC_COEF, 0x000f},
1175 {}
1176};
1177
1178/* SPDIF setup */ 1180/* SPDIF setup */
1179static void init_digital(struct hda_codec *codec) 1181static void init_digital(struct hda_codec *codec)
1180{ 1182{
@@ -1199,6 +1201,8 @@ static int cs_init(struct hda_codec *codec)
1199 1201
1200 snd_hda_sequence_write(codec, cs_coef_init_verbs); 1202 snd_hda_sequence_write(codec, cs_coef_init_verbs);
1201 1203
1204 snd_hda_gen_apply_verbs(codec);
1205
1202 if (spec->gpio_mask) { 1206 if (spec->gpio_mask) {
1203 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_MASK, 1207 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_MASK,
1204 spec->gpio_mask); 1208 spec->gpio_mask);
@@ -1291,6 +1295,7 @@ static const struct hda_model_fixup cs420x_models[] = {
1291 { .id = CS420X_IMAC27_122, .name = "imac27_122" }, 1295 { .id = CS420X_IMAC27_122, .name = "imac27_122" },
1292 { .id = CS420X_APPLE, .name = "apple" }, 1296 { .id = CS420X_APPLE, .name = "apple" },
1293 { .id = CS420X_MBP101, .name = "mbp101" }, 1297 { .id = CS420X_MBP101, .name = "mbp101" },
1298 { .id = CS420X_MBP81, .name = "mbp81" },
1294 {} 1299 {}
1295}; 1300};
1296 1301
@@ -1303,6 +1308,7 @@ static const struct snd_pci_quirk cs420x_fixup_tbl[] = {
1303 /*SND_PCI_QUIRK(0x8086, 0x7270, "IMac 27 Inch", CS420X_IMAC27),*/ 1308 /*SND_PCI_QUIRK(0x8086, 0x7270, "IMac 27 Inch", CS420X_IMAC27),*/
1304 1309
1305 /* codec SSID */ 1310 /* codec SSID */
1311 SND_PCI_QUIRK(0x106b, 0x1c00, "MacBookPro 8,1", CS420X_MBP81),
1306 SND_PCI_QUIRK(0x106b, 0x2000, "iMac 12,2", CS420X_IMAC27_122), 1312 SND_PCI_QUIRK(0x106b, 0x2000, "iMac 12,2", CS420X_IMAC27_122),
1307 SND_PCI_QUIRK(0x106b, 0x2800, "MacBookPro 10,1", CS420X_MBP101), 1313 SND_PCI_QUIRK(0x106b, 0x2800, "MacBookPro 10,1", CS420X_MBP101),
1308 SND_PCI_QUIRK_VENDOR(0x106b, "Apple", CS420X_APPLE), 1314 SND_PCI_QUIRK_VENDOR(0x106b, "Apple", CS420X_APPLE),
@@ -1413,11 +1419,16 @@ static const struct hda_fixup cs420x_fixups[] = {
1413 .type = HDA_FIXUP_PINS, 1419 .type = HDA_FIXUP_PINS,
1414 .v.pins = mbp101_pincfgs, 1420 .v.pins = mbp101_pincfgs,
1415 .chained = true, 1421 .chained = true,
1416 .chain_id = CS420X_MBP101_COEF, 1422 .chain_id = CS420X_GPIO_13,
1417 }, 1423 },
1418 [CS420X_MBP101_COEF] = { 1424 [CS420X_MBP81] = {
1419 .type = HDA_FIXUP_VERBS, 1425 .type = HDA_FIXUP_VERBS,
1420 .v.verbs = mbp101_init_verbs, 1426 .v.verbs = (const struct hda_verb[]) {
1427 /* internal mic ADC2: right only, single ended */
1428 {0x11, AC_VERB_SET_COEF_INDEX, IDX_ADC_CFG},
1429 {0x11, AC_VERB_SET_PROC_COEF, 0x102a},
1430 {}
1431 },
1421 .chained = true, 1432 .chained = true,
1422 .chain_id = CS420X_GPIO_13, 1433 .chain_id = CS420X_GPIO_13,
1423 }, 1434 },
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index 03b1dc317ff0..60890bfecc19 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -337,6 +337,8 @@ static const struct hda_pcm_stream cx5051_pcm_analog_capture = {
337 }, 337 },
338}; 338};
339 339
340static bool is_2_1_speaker(struct conexant_spec *spec);
341
340static int conexant_build_pcms(struct hda_codec *codec) 342static int conexant_build_pcms(struct hda_codec *codec)
341{ 343{
342 struct conexant_spec *spec = codec->spec; 344 struct conexant_spec *spec = codec->spec;
@@ -351,6 +353,9 @@ static int conexant_build_pcms(struct hda_codec *codec)
351 spec->multiout.max_channels; 353 spec->multiout.max_channels;
352 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 354 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
353 spec->multiout.dac_nids[0]; 355 spec->multiout.dac_nids[0];
356 if (is_2_1_speaker(spec))
357 info->stream[SNDRV_PCM_STREAM_PLAYBACK].chmap =
358 snd_pcm_2_1_chmaps;
354 if (spec->capture_stream) 359 if (spec->capture_stream)
355 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *spec->capture_stream; 360 info->stream[SNDRV_PCM_STREAM_CAPTURE] = *spec->capture_stream;
356 else { 361 else {
@@ -472,7 +477,7 @@ static const struct snd_kcontrol_new cxt_beep_mixer[] = {
472#endif 477#endif
473 478
474static const char * const slave_pfxs[] = { 479static const char * const slave_pfxs[] = {
475 "Headphone", "Speaker", "Front", "Surround", "CLFE", 480 "Headphone", "Speaker", "Bass Speaker", "Front", "Surround", "CLFE",
476 NULL 481 NULL
477}; 482};
478 483
@@ -3430,28 +3435,13 @@ static int cx_automute_mode_info(struct snd_kcontrol *kcontrol,
3430{ 3435{
3431 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 3436 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
3432 struct conexant_spec *spec = codec->spec; 3437 struct conexant_spec *spec = codec->spec;
3433 static const char * const texts2[] = {
3434 "Disabled", "Enabled"
3435 };
3436 static const char * const texts3[] = { 3438 static const char * const texts3[] = {
3437 "Disabled", "Speaker Only", "Line Out+Speaker" 3439 "Disabled", "Speaker Only", "Line Out+Speaker"
3438 }; 3440 };
3439 const char * const *texts;
3440 3441
3441 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 3442 if (spec->automute_hp_lo)
3442 uinfo->count = 1; 3443 return snd_hda_enum_helper_info(kcontrol, uinfo, 3, texts3);
3443 if (spec->automute_hp_lo) { 3444 return snd_hda_enum_bool_helper_info(kcontrol, uinfo);
3444 uinfo->value.enumerated.items = 3;
3445 texts = texts3;
3446 } else {
3447 uinfo->value.enumerated.items = 2;
3448 texts = texts2;
3449 }
3450 if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items)
3451 uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1;
3452 strcpy(uinfo->value.enumerated.name,
3453 texts[uinfo->value.enumerated.item]);
3454 return 0;
3455} 3445}
3456 3446
3457static int cx_automute_mode_get(struct snd_kcontrol *kcontrol, 3447static int cx_automute_mode_get(struct snd_kcontrol *kcontrol,
@@ -4116,11 +4106,26 @@ static int try_add_pb_volume(struct hda_codec *codec, hda_nid_t dac,
4116 return 0; 4106 return 0;
4117} 4107}
4118 4108
4109static bool is_2_1_speaker(struct conexant_spec *spec)
4110{
4111 int i, type, num_spk = 0;
4112
4113 for (i = 0; i < spec->dac_info_filled; i++) {
4114 type = spec->dac_info[i].type;
4115 if (type == AUTO_PIN_LINE_OUT)
4116 type = spec->autocfg.line_out_type;
4117 if (type == AUTO_PIN_SPEAKER_OUT)
4118 num_spk++;
4119 }
4120 return (num_spk == 2 && spec->autocfg.line_out_type != AUTO_PIN_LINE_OUT);
4121}
4122
4119static int cx_auto_build_output_controls(struct hda_codec *codec) 4123static int cx_auto_build_output_controls(struct hda_codec *codec)
4120{ 4124{
4121 struct conexant_spec *spec = codec->spec; 4125 struct conexant_spec *spec = codec->spec;
4122 int i, err; 4126 int i, err;
4123 int num_line = 0, num_hp = 0, num_spk = 0; 4127 int num_line = 0, num_hp = 0, num_spk = 0;
4128 bool speaker_2_1;
4124 static const char * const texts[3] = { "Front", "Surround", "CLFE" }; 4129 static const char * const texts[3] = { "Front", "Surround", "CLFE" };
4125 4130
4126 if (spec->dac_info_filled == 1) 4131 if (spec->dac_info_filled == 1)
@@ -4128,6 +4133,8 @@ static int cx_auto_build_output_controls(struct hda_codec *codec)
4128 spec->dac_info[0].pin, 4133 spec->dac_info[0].pin,
4129 "Master", 0); 4134 "Master", 0);
4130 4135
4136 speaker_2_1 = is_2_1_speaker(spec);
4137
4131 for (i = 0; i < spec->dac_info_filled; i++) { 4138 for (i = 0; i < spec->dac_info_filled; i++) {
4132 const char *label; 4139 const char *label;
4133 int idx, type; 4140 int idx, type;
@@ -4146,8 +4153,13 @@ static int cx_auto_build_output_controls(struct hda_codec *codec)
4146 idx = num_hp++; 4153 idx = num_hp++;
4147 break; 4154 break;
4148 case AUTO_PIN_SPEAKER_OUT: 4155 case AUTO_PIN_SPEAKER_OUT:
4149 label = "Speaker"; 4156 if (speaker_2_1) {
4150 idx = num_spk++; 4157 label = num_spk++ ? "Bass Speaker" : "Speaker";
4158 idx = 0;
4159 } else {
4160 label = "Speaker";
4161 idx = num_spk++;
4162 }
4151 break; 4163 break;
4152 } 4164 }
4153 err = try_add_pb_volume(codec, dac, 4165 err = try_add_pb_volume(codec, dac,
@@ -4405,7 +4417,10 @@ static const struct hda_codec_ops cx_auto_patch_ops = {
4405enum { 4417enum {
4406 CXT_PINCFG_LENOVO_X200, 4418 CXT_PINCFG_LENOVO_X200,
4407 CXT_PINCFG_LENOVO_TP410, 4419 CXT_PINCFG_LENOVO_TP410,
4420 CXT_PINCFG_LEMOTE_A1004,
4421 CXT_PINCFG_LEMOTE_A1205,
4408 CXT_FIXUP_STEREO_DMIC, 4422 CXT_FIXUP_STEREO_DMIC,
4423 CXT_FIXUP_INC_MIC_BOOST,
4409}; 4424};
4410 4425
4411static void cxt_fixup_stereo_dmic(struct hda_codec *codec, 4426static void cxt_fixup_stereo_dmic(struct hda_codec *codec,
@@ -4415,6 +4430,19 @@ static void cxt_fixup_stereo_dmic(struct hda_codec *codec,
4415 spec->fixup_stereo_dmic = 1; 4430 spec->fixup_stereo_dmic = 1;
4416} 4431}
4417 4432
4433static void cxt5066_increase_mic_boost(struct hda_codec *codec,
4434 const struct hda_fixup *fix, int action)
4435{
4436 if (action != HDA_FIXUP_ACT_PRE_PROBE)
4437 return;
4438
4439 snd_hda_override_amp_caps(codec, 0x17, HDA_OUTPUT,
4440 (0x3 << AC_AMPCAP_OFFSET_SHIFT) |
4441 (0x4 << AC_AMPCAP_NUM_STEPS_SHIFT) |
4442 (0x27 << AC_AMPCAP_STEP_SIZE_SHIFT) |
4443 (0 << AC_AMPCAP_MUTE_SHIFT));
4444}
4445
4418/* ThinkPad X200 & co with cxt5051 */ 4446/* ThinkPad X200 & co with cxt5051 */
4419static const struct hda_pintbl cxt_pincfg_lenovo_x200[] = { 4447static const struct hda_pintbl cxt_pincfg_lenovo_x200[] = {
4420 { 0x16, 0x042140ff }, /* HP (seq# overridden) */ 4448 { 0x16, 0x042140ff }, /* HP (seq# overridden) */
@@ -4432,6 +4460,18 @@ static const struct hda_pintbl cxt_pincfg_lenovo_tp410[] = {
4432 {} 4460 {}
4433}; 4461};
4434 4462
4463/* Lemote A1004/A1205 with cxt5066 */
4464static const struct hda_pintbl cxt_pincfg_lemote[] = {
4465 { 0x1a, 0x90a10020 }, /* Internal mic */
4466 { 0x1b, 0x03a11020 }, /* External mic */
4467 { 0x1d, 0x400101f0 }, /* Not used */
4468 { 0x1e, 0x40a701f0 }, /* Not used */
4469 { 0x20, 0x404501f0 }, /* Not used */
4470 { 0x22, 0x404401f0 }, /* Not used */
4471 { 0x23, 0x40a701f0 }, /* Not used */
4472 {}
4473};
4474
4435static const struct hda_fixup cxt_fixups[] = { 4475static const struct hda_fixup cxt_fixups[] = {
4436 [CXT_PINCFG_LENOVO_X200] = { 4476 [CXT_PINCFG_LENOVO_X200] = {
4437 .type = HDA_FIXUP_PINS, 4477 .type = HDA_FIXUP_PINS,
@@ -4441,10 +4481,24 @@ static const struct hda_fixup cxt_fixups[] = {
4441 .type = HDA_FIXUP_PINS, 4481 .type = HDA_FIXUP_PINS,
4442 .v.pins = cxt_pincfg_lenovo_tp410, 4482 .v.pins = cxt_pincfg_lenovo_tp410,
4443 }, 4483 },
4484 [CXT_PINCFG_LEMOTE_A1004] = {
4485 .type = HDA_FIXUP_PINS,
4486 .chained = true,
4487 .chain_id = CXT_FIXUP_INC_MIC_BOOST,
4488 .v.pins = cxt_pincfg_lemote,
4489 },
4490 [CXT_PINCFG_LEMOTE_A1205] = {
4491 .type = HDA_FIXUP_PINS,
4492 .v.pins = cxt_pincfg_lemote,
4493 },
4444 [CXT_FIXUP_STEREO_DMIC] = { 4494 [CXT_FIXUP_STEREO_DMIC] = {
4445 .type = HDA_FIXUP_FUNC, 4495 .type = HDA_FIXUP_FUNC,
4446 .v.func = cxt_fixup_stereo_dmic, 4496 .v.func = cxt_fixup_stereo_dmic,
4447 }, 4497 },
4498 [CXT_FIXUP_INC_MIC_BOOST] = {
4499 .type = HDA_FIXUP_FUNC,
4500 .v.func = cxt5066_increase_mic_boost,
4501 },
4448}; 4502};
4449 4503
4450static const struct snd_pci_quirk cxt5051_fixups[] = { 4504static const struct snd_pci_quirk cxt5051_fixups[] = {
@@ -4453,6 +4507,7 @@ static const struct snd_pci_quirk cxt5051_fixups[] = {
4453}; 4507};
4454 4508
4455static const struct snd_pci_quirk cxt5066_fixups[] = { 4509static const struct snd_pci_quirk cxt5066_fixups[] = {
4510 SND_PCI_QUIRK(0x1025, 0x0543, "Acer Aspire One 522", CXT_FIXUP_STEREO_DMIC),
4456 SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo T400", CXT_PINCFG_LENOVO_TP410), 4511 SND_PCI_QUIRK(0x17aa, 0x20f2, "Lenovo T400", CXT_PINCFG_LENOVO_TP410),
4457 SND_PCI_QUIRK(0x17aa, 0x215e, "Lenovo T410", CXT_PINCFG_LENOVO_TP410), 4512 SND_PCI_QUIRK(0x17aa, 0x215e, "Lenovo T410", CXT_PINCFG_LENOVO_TP410),
4458 SND_PCI_QUIRK(0x17aa, 0x215f, "Lenovo T510", CXT_PINCFG_LENOVO_TP410), 4513 SND_PCI_QUIRK(0x17aa, 0x215f, "Lenovo T510", CXT_PINCFG_LENOVO_TP410),
@@ -4461,6 +4516,8 @@ static const struct snd_pci_quirk cxt5066_fixups[] = {
4461 SND_PCI_QUIRK(0x17aa, 0x3975, "Lenovo U300s", CXT_FIXUP_STEREO_DMIC), 4516 SND_PCI_QUIRK(0x17aa, 0x3975, "Lenovo U300s", CXT_FIXUP_STEREO_DMIC),
4462 SND_PCI_QUIRK(0x17aa, 0x3977, "Lenovo IdeaPad U310", CXT_FIXUP_STEREO_DMIC), 4517 SND_PCI_QUIRK(0x17aa, 0x3977, "Lenovo IdeaPad U310", CXT_FIXUP_STEREO_DMIC),
4463 SND_PCI_QUIRK(0x17aa, 0x397b, "Lenovo S205", CXT_FIXUP_STEREO_DMIC), 4518 SND_PCI_QUIRK(0x17aa, 0x397b, "Lenovo S205", CXT_FIXUP_STEREO_DMIC),
4519 SND_PCI_QUIRK(0x1c06, 0x2011, "Lemote A1004", CXT_PINCFG_LEMOTE_A1004),
4520 SND_PCI_QUIRK(0x1c06, 0x2012, "Lemote A1205", CXT_PINCFG_LEMOTE_A1205),
4464 {} 4521 {}
4465}; 4522};
4466 4523
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index 71555cc54db1..b6c21ea187ca 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -431,9 +431,11 @@ static void hdmi_init_pin(struct hda_codec *codec, hda_nid_t pin_nid)
431 if (get_wcaps(codec, pin_nid) & AC_WCAP_OUT_AMP) 431 if (get_wcaps(codec, pin_nid) & AC_WCAP_OUT_AMP)
432 snd_hda_codec_write(codec, pin_nid, 0, 432 snd_hda_codec_write(codec, pin_nid, 0,
433 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE); 433 AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE);
434 /* Disable pin out until stream is active*/ 434 /* Enable pin out: some machines with GM965 gets broken output when
435 * the pin is disabled or changed while using with HDMI
436 */
435 snd_hda_codec_write(codec, pin_nid, 0, 437 snd_hda_codec_write(codec, pin_nid, 0,
436 AC_VERB_SET_PIN_WIDGET_CONTROL, 0); 438 AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT);
437} 439}
438 440
439static int hdmi_get_channel_count(struct hda_codec *codec, hda_nid_t cvt_nid) 441static int hdmi_get_channel_count(struct hda_codec *codec, hda_nid_t cvt_nid)
@@ -1193,12 +1195,11 @@ static int hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid)
1193 struct hdmi_spec_per_pin *per_pin; 1195 struct hdmi_spec_per_pin *per_pin;
1194 int err; 1196 int err;
1195 1197
1196 caps = snd_hda_param_read(codec, pin_nid, AC_PAR_PIN_CAP); 1198 caps = snd_hda_query_pin_caps(codec, pin_nid);
1197 if (!(caps & (AC_PINCAP_HDMI | AC_PINCAP_DP))) 1199 if (!(caps & (AC_PINCAP_HDMI | AC_PINCAP_DP)))
1198 return 0; 1200 return 0;
1199 1201
1200 config = snd_hda_codec_read(codec, pin_nid, 0, 1202 config = snd_hda_codec_get_pincfg(codec, pin_nid);
1201 AC_VERB_GET_CONFIG_DEFAULT, 0);
1202 if (get_defcfg_connect(config) == AC_JACK_PORT_NONE) 1203 if (get_defcfg_connect(config) == AC_JACK_PORT_NONE)
1203 return 0; 1204 return 0;
1204 1205
@@ -1272,7 +1273,7 @@ static int hdmi_parse_codec(struct hda_codec *codec)
1272 unsigned int caps; 1273 unsigned int caps;
1273 unsigned int type; 1274 unsigned int type;
1274 1275
1275 caps = snd_hda_param_read(codec, nid, AC_PAR_AUDIO_WIDGET_CAP); 1276 caps = get_wcaps(codec, nid);
1276 type = get_wcaps_type(caps); 1277 type = get_wcaps_type(caps);
1277 1278
1278 if (!(caps & AC_WCAP_DIGITAL)) 1279 if (!(caps & AC_WCAP_DIGITAL))
@@ -1288,13 +1289,17 @@ static int hdmi_parse_codec(struct hda_codec *codec)
1288 } 1289 }
1289 } 1290 }
1290 1291
1292#ifdef CONFIG_PM
1293 /* We're seeing some problems with unsolicited hot plug events on
1294 * PantherPoint after S3, if this is not enabled */
1295 if (codec->vendor_id == 0x80862806)
1296 codec->bus->power_keep_link_on = 1;
1291 /* 1297 /*
1292 * G45/IbexPeak don't support EPSS: the unsolicited pin hot plug event 1298 * G45/IbexPeak don't support EPSS: the unsolicited pin hot plug event
1293 * can be lost and presence sense verb will become inaccurate if the 1299 * can be lost and presence sense verb will become inaccurate if the
1294 * HDA link is powered off at hot plug or hw initialization time. 1300 * HDA link is powered off at hot plug or hw initialization time.
1295 */ 1301 */
1296#ifdef CONFIG_PM 1302 else if (!(snd_hda_param_read(codec, codec->afg, AC_PAR_POWER_STATE) &
1297 if (!(snd_hda_param_read(codec, codec->afg, AC_PAR_POWER_STATE) &
1298 AC_PWRST_EPSS)) 1303 AC_PWRST_EPSS))
1299 codec->bus->power_keep_link_on = 1; 1304 codec->bus->power_keep_link_on = 1;
1300#endif 1305#endif
@@ -1338,7 +1343,6 @@ static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
1338 struct hdmi_spec *spec = codec->spec; 1343 struct hdmi_spec *spec = codec->spec;
1339 int pin_idx = hinfo_to_pin_index(spec, hinfo); 1344 int pin_idx = hinfo_to_pin_index(spec, hinfo);
1340 hda_nid_t pin_nid = spec->pins[pin_idx].pin_nid; 1345 hda_nid_t pin_nid = spec->pins[pin_idx].pin_nid;
1341 int pinctl;
1342 bool non_pcm; 1346 bool non_pcm;
1343 1347
1344 non_pcm = check_non_pcm_per_cvt(codec, cvt_nid); 1348 non_pcm = check_non_pcm_per_cvt(codec, cvt_nid);
@@ -1347,11 +1351,6 @@ static int generic_hdmi_playback_pcm_prepare(struct hda_pcm_stream *hinfo,
1347 1351
1348 hdmi_setup_audio_infoframe(codec, pin_idx, non_pcm, substream); 1352 hdmi_setup_audio_infoframe(codec, pin_idx, non_pcm, substream);
1349 1353
1350 pinctl = snd_hda_codec_read(codec, pin_nid, 0,
1351 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
1352 snd_hda_codec_write(codec, pin_nid, 0,
1353 AC_VERB_SET_PIN_WIDGET_CONTROL, pinctl | PIN_OUT);
1354
1355 return hdmi_setup_stream(codec, cvt_nid, pin_nid, stream_tag, format); 1354 return hdmi_setup_stream(codec, cvt_nid, pin_nid, stream_tag, format);
1356} 1355}
1357 1356
@@ -1371,7 +1370,6 @@ static int hdmi_pcm_close(struct hda_pcm_stream *hinfo,
1371 int cvt_idx, pin_idx; 1370 int cvt_idx, pin_idx;
1372 struct hdmi_spec_per_cvt *per_cvt; 1371 struct hdmi_spec_per_cvt *per_cvt;
1373 struct hdmi_spec_per_pin *per_pin; 1372 struct hdmi_spec_per_pin *per_pin;
1374 int pinctl;
1375 1373
1376 if (hinfo->nid) { 1374 if (hinfo->nid) {
1377 cvt_idx = cvt_nid_to_cvt_index(spec, hinfo->nid); 1375 cvt_idx = cvt_nid_to_cvt_index(spec, hinfo->nid);
@@ -1388,11 +1386,6 @@ static int hdmi_pcm_close(struct hda_pcm_stream *hinfo,
1388 return -EINVAL; 1386 return -EINVAL;
1389 per_pin = &spec->pins[pin_idx]; 1387 per_pin = &spec->pins[pin_idx];
1390 1388
1391 pinctl = snd_hda_codec_read(codec, per_pin->pin_nid, 0,
1392 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
1393 snd_hda_codec_write(codec, per_pin->pin_nid, 0,
1394 AC_VERB_SET_PIN_WIDGET_CONTROL,
1395 pinctl & ~PIN_OUT);
1396 snd_hda_spdif_ctls_unassign(codec, pin_idx); 1389 snd_hda_spdif_ctls_unassign(codec, pin_idx);
1397 per_pin->chmap_set = false; 1390 per_pin->chmap_set = false;
1398 memset(per_pin->chmap, 0, sizeof(per_pin->chmap)); 1391 memset(per_pin->chmap, 0, sizeof(per_pin->chmap));
@@ -1589,9 +1582,10 @@ static int generic_hdmi_build_controls(struct hda_codec *codec)
1589 if (err < 0) 1582 if (err < 0)
1590 return err; 1583 return err;
1591 1584
1592 err = snd_hda_create_spdif_out_ctls(codec, 1585 err = snd_hda_create_dig_out_ctls(codec,
1593 per_pin->pin_nid, 1586 per_pin->pin_nid,
1594 per_pin->mux_nids[0]); 1587 per_pin->mux_nids[0],
1588 HDA_PCM_TYPE_HDMI);
1595 if (err < 0) 1589 if (err < 0)
1596 return err; 1590 return err;
1597 snd_hda_spdif_ctls_unassign(codec, pin_idx); 1591 snd_hda_spdif_ctls_unassign(codec, pin_idx);
@@ -1687,6 +1681,30 @@ static const struct hda_codec_ops generic_hdmi_patch_ops = {
1687 .unsol_event = hdmi_unsol_event, 1681 .unsol_event = hdmi_unsol_event,
1688}; 1682};
1689 1683
1684static void intel_haswell_fixup_connect_list(struct hda_codec *codec)
1685{
1686 unsigned int vendor_param;
1687 hda_nid_t list[3] = {0x2, 0x3, 0x4};
1688
1689 vendor_param = snd_hda_codec_read(codec, 0x08, 0, 0xf81, 0);
1690 if (vendor_param == -1 || vendor_param & 0x02)
1691 return;
1692
1693 /* enable DP1.2 mode */
1694 vendor_param |= 0x02;
1695 snd_hda_codec_read(codec, 0x08, 0, 0x781, vendor_param);
1696
1697 vendor_param = snd_hda_codec_read(codec, 0x08, 0, 0xf81, 0);
1698 if (vendor_param == -1 || !(vendor_param & 0x02))
1699 return;
1700
1701 /* override 3 pins connection list */
1702 snd_hda_override_conn_list(codec, 0x05, 3, list);
1703 snd_hda_override_conn_list(codec, 0x06, 3, list);
1704 snd_hda_override_conn_list(codec, 0x07, 3, list);
1705}
1706
1707
1690static int patch_generic_hdmi(struct hda_codec *codec) 1708static int patch_generic_hdmi(struct hda_codec *codec)
1691{ 1709{
1692 struct hdmi_spec *spec; 1710 struct hdmi_spec *spec;
@@ -1696,6 +1714,10 @@ static int patch_generic_hdmi(struct hda_codec *codec)
1696 return -ENOMEM; 1714 return -ENOMEM;
1697 1715
1698 codec->spec = spec; 1716 codec->spec = spec;
1717
1718 if (codec->vendor_id == 0x80862807)
1719 intel_haswell_fixup_connect_list(codec);
1720
1699 if (hdmi_parse_codec(codec) < 0) { 1721 if (hdmi_parse_codec(codec) < 0) {
1700 codec->spec = NULL; 1722 codec->spec = NULL;
1701 kfree(spec); 1723 kfree(spec);
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index ad68d223f8af..71ae23dd7103 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -153,8 +153,8 @@ struct alc_spec {
153 const struct hda_channel_mode *channel_mode; 153 const struct hda_channel_mode *channel_mode;
154 int num_channel_mode; 154 int num_channel_mode;
155 int need_dac_fix; 155 int need_dac_fix;
156 int const_channel_count; 156 int const_channel_count; /* min. channel count (for speakers) */
157 int ext_channel_count; 157 int ext_channel_count; /* current channel count for multi-io */
158 158
159 /* PCM information */ 159 /* PCM information */
160 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */ 160 struct hda_pcm pcm_rec[3]; /* used in alc_build_pcms() */
@@ -815,28 +815,13 @@ static int alc_automute_mode_info(struct snd_kcontrol *kcontrol,
815{ 815{
816 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 816 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
817 struct alc_spec *spec = codec->spec; 817 struct alc_spec *spec = codec->spec;
818 static const char * const texts2[] = {
819 "Disabled", "Enabled"
820 };
821 static const char * const texts3[] = { 818 static const char * const texts3[] = {
822 "Disabled", "Speaker Only", "Line Out+Speaker" 819 "Disabled", "Speaker Only", "Line Out+Speaker"
823 }; 820 };
824 const char * const *texts;
825 821
826 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 822 if (spec->automute_speaker_possible && spec->automute_lo_possible)
827 uinfo->count = 1; 823 return snd_hda_enum_helper_info(kcontrol, uinfo, 3, texts3);
828 if (spec->automute_speaker_possible && spec->automute_lo_possible) { 824 return snd_hda_enum_bool_helper_info(kcontrol, uinfo);
829 uinfo->value.enumerated.items = 3;
830 texts = texts3;
831 } else {
832 uinfo->value.enumerated.items = 2;
833 texts = texts2;
834 }
835 if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items)
836 uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1;
837 strcpy(uinfo->value.enumerated.name,
838 texts[uinfo->value.enumerated.item]);
839 return 0;
840} 825}
841 826
842static int alc_automute_mode_get(struct snd_kcontrol *kcontrol, 827static int alc_automute_mode_get(struct snd_kcontrol *kcontrol,
@@ -903,23 +888,25 @@ static const struct snd_kcontrol_new alc_automute_mode_enum = {
903 .put = alc_automute_mode_put, 888 .put = alc_automute_mode_put,
904}; 889};
905 890
906static struct snd_kcontrol_new *alc_kcontrol_new(struct alc_spec *spec) 891static struct snd_kcontrol_new *
892alc_kcontrol_new(struct alc_spec *spec, const char *name,
893 const struct snd_kcontrol_new *temp)
907{ 894{
908 snd_array_init(&spec->kctls, sizeof(struct snd_kcontrol_new), 32); 895 struct snd_kcontrol_new *knew = snd_array_new(&spec->kctls);
909 return snd_array_new(&spec->kctls); 896 if (!knew)
897 return NULL;
898 *knew = *temp;
899 knew->name = kstrdup(name, GFP_KERNEL);
900 if (!knew->name)
901 return NULL;
902 return knew;
910} 903}
911 904
912static int alc_add_automute_mode_enum(struct hda_codec *codec) 905static int alc_add_automute_mode_enum(struct hda_codec *codec)
913{ 906{
914 struct alc_spec *spec = codec->spec; 907 struct alc_spec *spec = codec->spec;
915 struct snd_kcontrol_new *knew;
916 908
917 knew = alc_kcontrol_new(spec); 909 if (!alc_kcontrol_new(spec, "Auto-Mute Mode", &alc_automute_mode_enum))
918 if (!knew)
919 return -ENOMEM;
920 *knew = alc_automute_mode_enum;
921 knew->name = kstrdup("Auto-Mute Mode", GFP_KERNEL);
922 if (!knew->name)
923 return -ENOMEM; 910 return -ENOMEM;
924 return 0; 911 return 0;
925} 912}
@@ -928,12 +915,12 @@ static int alc_add_automute_mode_enum(struct hda_codec *codec)
928 * Check the availability of HP/line-out auto-mute; 915 * Check the availability of HP/line-out auto-mute;
929 * Set up appropriately if really supported 916 * Set up appropriately if really supported
930 */ 917 */
931static void alc_init_automute(struct hda_codec *codec) 918static int alc_init_automute(struct hda_codec *codec)
932{ 919{
933 struct alc_spec *spec = codec->spec; 920 struct alc_spec *spec = codec->spec;
934 struct auto_pin_cfg *cfg = &spec->autocfg; 921 struct auto_pin_cfg *cfg = &spec->autocfg;
935 int present = 0; 922 int present = 0;
936 int i; 923 int i, err;
937 924
938 if (cfg->hp_pins[0]) 925 if (cfg->hp_pins[0])
939 present++; 926 present++;
@@ -942,7 +929,7 @@ static void alc_init_automute(struct hda_codec *codec)
942 if (cfg->speaker_pins[0]) 929 if (cfg->speaker_pins[0])
943 present++; 930 present++;
944 if (present < 2) /* need two different output types */ 931 if (present < 2) /* need two different output types */
945 return; 932 return 0;
946 933
947 if (!cfg->speaker_pins[0] && 934 if (!cfg->speaker_pins[0] &&
948 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) { 935 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) {
@@ -992,9 +979,13 @@ static void alc_init_automute(struct hda_codec *codec)
992 spec->automute_lo = spec->automute_lo_possible; 979 spec->automute_lo = spec->automute_lo_possible;
993 spec->automute_speaker = spec->automute_speaker_possible; 980 spec->automute_speaker = spec->automute_speaker_possible;
994 981
995 if (spec->automute_speaker_possible || spec->automute_lo_possible) 982 if (spec->automute_speaker_possible || spec->automute_lo_possible) {
996 /* create a control for automute mode */ 983 /* create a control for automute mode */
997 alc_add_automute_mode_enum(codec); 984 err = alc_add_automute_mode_enum(codec);
985 if (err < 0)
986 return err;
987 }
988 return 0;
998} 989}
999 990
1000/* return the position of NID in the list, or -1 if not found */ 991/* return the position of NID in the list, or -1 if not found */
@@ -1094,7 +1085,7 @@ static bool alc_auto_mic_check_imux(struct hda_codec *codec)
1094 * Check the availability of auto-mic switch; 1085 * Check the availability of auto-mic switch;
1095 * Set up if really supported 1086 * Set up if really supported
1096 */ 1087 */
1097static void alc_init_auto_mic(struct hda_codec *codec) 1088static int alc_init_auto_mic(struct hda_codec *codec)
1098{ 1089{
1099 struct alc_spec *spec = codec->spec; 1090 struct alc_spec *spec = codec->spec;
1100 struct auto_pin_cfg *cfg = &spec->autocfg; 1091 struct auto_pin_cfg *cfg = &spec->autocfg;
@@ -1102,7 +1093,7 @@ static void alc_init_auto_mic(struct hda_codec *codec)
1102 int i; 1093 int i;
1103 1094
1104 if (spec->shared_mic_hp) 1095 if (spec->shared_mic_hp)
1105 return; /* no auto-mic for the shared I/O */ 1096 return 0; /* no auto-mic for the shared I/O */
1106 1097
1107 spec->ext_mic_idx = spec->int_mic_idx = spec->dock_mic_idx = -1; 1098 spec->ext_mic_idx = spec->int_mic_idx = spec->dock_mic_idx = -1;
1108 1099
@@ -1114,25 +1105,25 @@ static void alc_init_auto_mic(struct hda_codec *codec)
1114 switch (snd_hda_get_input_pin_attr(defcfg)) { 1105 switch (snd_hda_get_input_pin_attr(defcfg)) {
1115 case INPUT_PIN_ATTR_INT: 1106 case INPUT_PIN_ATTR_INT:
1116 if (fixed) 1107 if (fixed)
1117 return; /* already occupied */ 1108 return 0; /* already occupied */
1118 if (cfg->inputs[i].type != AUTO_PIN_MIC) 1109 if (cfg->inputs[i].type != AUTO_PIN_MIC)
1119 return; /* invalid type */ 1110 return 0; /* invalid type */
1120 fixed = nid; 1111 fixed = nid;
1121 break; 1112 break;
1122 case INPUT_PIN_ATTR_UNUSED: 1113 case INPUT_PIN_ATTR_UNUSED:
1123 return; /* invalid entry */ 1114 return 0; /* invalid entry */
1124 case INPUT_PIN_ATTR_DOCK: 1115 case INPUT_PIN_ATTR_DOCK:
1125 if (dock) 1116 if (dock)
1126 return; /* already occupied */ 1117 return 0; /* already occupied */
1127 if (cfg->inputs[i].type > AUTO_PIN_LINE_IN) 1118 if (cfg->inputs[i].type > AUTO_PIN_LINE_IN)
1128 return; /* invalid type */ 1119 return 0; /* invalid type */
1129 dock = nid; 1120 dock = nid;
1130 break; 1121 break;
1131 default: 1122 default:
1132 if (ext) 1123 if (ext)
1133 return; /* already occupied */ 1124 return 0; /* already occupied */
1134 if (cfg->inputs[i].type != AUTO_PIN_MIC) 1125 if (cfg->inputs[i].type != AUTO_PIN_MIC)
1135 return; /* invalid type */ 1126 return 0; /* invalid type */
1136 ext = nid; 1127 ext = nid;
1137 break; 1128 break;
1138 } 1129 }
@@ -1142,11 +1133,11 @@ static void alc_init_auto_mic(struct hda_codec *codec)
1142 dock = 0; 1133 dock = 0;
1143 } 1134 }
1144 if (!ext || !fixed) 1135 if (!ext || !fixed)
1145 return; 1136 return 0;
1146 if (!is_jack_detectable(codec, ext)) 1137 if (!is_jack_detectable(codec, ext))
1147 return; /* no unsol support */ 1138 return 0; /* no unsol support */
1148 if (dock && !is_jack_detectable(codec, dock)) 1139 if (dock && !is_jack_detectable(codec, dock))
1149 return; /* no unsol support */ 1140 return 0; /* no unsol support */
1150 1141
1151 /* check imux indices */ 1142 /* check imux indices */
1152 spec->ext_mic_pin = ext; 1143 spec->ext_mic_pin = ext;
@@ -1155,17 +1146,26 @@ static void alc_init_auto_mic(struct hda_codec *codec)
1155 1146
1156 spec->auto_mic = 1; 1147 spec->auto_mic = 1;
1157 if (!alc_auto_mic_check_imux(codec)) 1148 if (!alc_auto_mic_check_imux(codec))
1158 return; 1149 return 0;
1159 1150
1160 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x/0x%x\n", 1151 snd_printdd("realtek: Enable auto-mic switch on NID 0x%x/0x%x/0x%x\n",
1161 ext, fixed, dock); 1152 ext, fixed, dock);
1153
1154 return 0;
1162} 1155}
1163 1156
1164/* check the availabilities of auto-mute and auto-mic switches */ 1157/* check the availabilities of auto-mute and auto-mic switches */
1165static void alc_auto_check_switches(struct hda_codec *codec) 1158static int alc_auto_check_switches(struct hda_codec *codec)
1166{ 1159{
1167 alc_init_automute(codec); 1160 int err;
1168 alc_init_auto_mic(codec); 1161
1162 err = alc_init_automute(codec);
1163 if (err < 0)
1164 return err;
1165 err = alc_init_auto_mic(codec);
1166 if (err < 0)
1167 return err;
1168 return 0;
1169} 1169}
1170 1170
1171/* 1171/*
@@ -1757,12 +1757,9 @@ static const struct snd_kcontrol_new alc_inv_dmic_sw = {
1757static int alc_add_inv_dmic_mixer(struct hda_codec *codec, hda_nid_t nid) 1757static int alc_add_inv_dmic_mixer(struct hda_codec *codec, hda_nid_t nid)
1758{ 1758{
1759 struct alc_spec *spec = codec->spec; 1759 struct alc_spec *spec = codec->spec;
1760 struct snd_kcontrol_new *knew = alc_kcontrol_new(spec); 1760
1761 if (!knew) 1761 if (!alc_kcontrol_new(spec, "Inverted Internal Mic Capture Switch",
1762 return -ENOMEM; 1762 &alc_inv_dmic_sw))
1763 *knew = alc_inv_dmic_sw;
1764 knew->name = kstrdup("Inverted Internal Mic Capture Switch", GFP_KERNEL);
1765 if (!knew->name)
1766 return -ENOMEM; 1763 return -ENOMEM;
1767 spec->inv_dmic_fixup = 1; 1764 spec->inv_dmic_fixup = 1;
1768 spec->inv_dmic_muted = 0; 1765 spec->inv_dmic_muted = 0;
@@ -1836,9 +1833,10 @@ static int __alc_build_controls(struct hda_codec *codec)
1836 return err; 1833 return err;
1837 } 1834 }
1838 if (spec->multiout.dig_out_nid) { 1835 if (spec->multiout.dig_out_nid) {
1839 err = snd_hda_create_spdif_out_ctls(codec, 1836 err = snd_hda_create_dig_out_ctls(codec,
1840 spec->multiout.dig_out_nid, 1837 spec->multiout.dig_out_nid,
1841 spec->multiout.dig_out_nid); 1838 spec->multiout.dig_out_nid,
1839 spec->pcm_rec[1].pcm_type);
1842 if (err < 0) 1840 if (err < 0)
1843 return err; 1841 return err;
1844 if (!spec->no_analog) { 1842 if (!spec->no_analog) {
@@ -2259,6 +2257,10 @@ static int alc_build_pcms(struct hda_codec *codec)
2259 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0]; 2257 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = spec->multiout.dac_nids[0];
2260 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 2258 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max =
2261 spec->multiout.max_channels; 2259 spec->multiout.max_channels;
2260 if (spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT &&
2261 spec->autocfg.line_outs == 2)
2262 info->stream[SNDRV_PCM_STREAM_PLAYBACK].chmap =
2263 snd_pcm_2_1_chmaps;
2262 } 2264 }
2263 if (spec->adc_nids) { 2265 if (spec->adc_nids) {
2264 p = spec->stream_analog_capture; 2266 p = spec->stream_analog_capture;
@@ -2399,7 +2401,6 @@ static void alc_free(struct hda_codec *codec)
2399 if (!spec) 2401 if (!spec)
2400 return; 2402 return;
2401 2403
2402 alc_shutup(codec);
2403 alc_free_kctls(codec); 2404 alc_free_kctls(codec);
2404 alc_free_bind_ctls(codec); 2405 alc_free_bind_ctls(codec);
2405 snd_hda_gen_free(&spec->gen); 2406 snd_hda_gen_free(&spec->gen);
@@ -2534,13 +2535,9 @@ static int add_control(struct alc_spec *spec, int type, const char *name,
2534{ 2535{
2535 struct snd_kcontrol_new *knew; 2536 struct snd_kcontrol_new *knew;
2536 2537
2537 knew = alc_kcontrol_new(spec); 2538 knew = alc_kcontrol_new(spec, name, &alc_control_templates[type]);
2538 if (!knew) 2539 if (!knew)
2539 return -ENOMEM; 2540 return -ENOMEM;
2540 *knew = alc_control_templates[type];
2541 knew->name = kstrdup(name, GFP_KERNEL);
2542 if (!knew->name)
2543 return -ENOMEM;
2544 knew->index = cidx; 2541 knew->index = cidx;
2545 if (get_amp_nid_(val)) 2542 if (get_amp_nid_(val))
2546 knew->subdevice = HDA_SUBDEV_AMP_FLAG; 2543 knew->subdevice = HDA_SUBDEV_AMP_FLAG;
@@ -3601,7 +3598,6 @@ static struct hda_bind_ctls *new_bind_ctl(struct hda_codec *codec,
3601{ 3598{
3602 struct alc_spec *spec = codec->spec; 3599 struct alc_spec *spec = codec->spec;
3603 struct hda_bind_ctls **ctlp, *ctl; 3600 struct hda_bind_ctls **ctlp, *ctl;
3604 snd_array_init(&spec->bind_ctls, sizeof(ctl), 8);
3605 ctlp = snd_array_new(&spec->bind_ctls); 3601 ctlp = snd_array_new(&spec->bind_ctls);
3606 if (!ctlp) 3602 if (!ctlp)
3607 return NULL; 3603 return NULL;
@@ -3965,8 +3961,9 @@ static int alc_auto_ch_mode_put(struct snd_kcontrol *kcontrol,
3965 spec->ext_channel_count = (ch + 1) * 2; 3961 spec->ext_channel_count = (ch + 1) * 2;
3966 for (i = 0; i < spec->multi_ios; i++) 3962 for (i = 0; i < spec->multi_ios; i++)
3967 alc_set_multi_io(codec, i, i < ch); 3963 alc_set_multi_io(codec, i, i < ch);
3968 spec->multiout.max_channels = spec->ext_channel_count; 3964 spec->multiout.max_channels = max(spec->ext_channel_count,
3969 if (spec->need_dac_fix && !spec->const_channel_count) 3965 spec->const_channel_count);
3966 if (spec->need_dac_fix)
3970 spec->multiout.num_dacs = spec->multiout.max_channels / 2; 3967 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
3971 return 1; 3968 return 1;
3972} 3969}
@@ -3984,14 +3981,8 @@ static int alc_auto_add_multi_channel_mode(struct hda_codec *codec)
3984 struct alc_spec *spec = codec->spec; 3981 struct alc_spec *spec = codec->spec;
3985 3982
3986 if (spec->multi_ios > 0) { 3983 if (spec->multi_ios > 0) {
3987 struct snd_kcontrol_new *knew; 3984 if (!alc_kcontrol_new(spec, "Channel Mode",
3988 3985 &alc_auto_channel_mode_enum))
3989 knew = alc_kcontrol_new(spec);
3990 if (!knew)
3991 return -ENOMEM;
3992 *knew = alc_auto_channel_mode_enum;
3993 knew->name = kstrdup("Channel Mode", GFP_KERNEL);
3994 if (!knew->name)
3995 return -ENOMEM; 3986 return -ENOMEM;
3996 } 3987 }
3997 return 0; 3988 return 0;
@@ -4334,7 +4325,17 @@ static int alc_parse_auto_config(struct hda_codec *codec,
4334 if (err < 0) 4325 if (err < 0)
4335 return err; 4326 return err;
4336 4327
4337 spec->multiout.max_channels = spec->multiout.num_dacs * 2; 4328 /* check the multiple speaker pins */
4329 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
4330 spec->const_channel_count = cfg->line_outs * 2;
4331 else
4332 spec->const_channel_count = cfg->speaker_outs * 2;
4333
4334 if (spec->multi_ios > 0)
4335 spec->multiout.max_channels = max(spec->ext_channel_count,
4336 spec->const_channel_count);
4337 else
4338 spec->multiout.max_channels = spec->multiout.num_dacs * 2;
4338 4339
4339 dig_only: 4340 dig_only:
4340 alc_auto_parse_digital(codec); 4341 alc_auto_parse_digital(codec);
@@ -4346,7 +4347,9 @@ static int alc_parse_auto_config(struct hda_codec *codec,
4346 alc_ssid_check(codec, ssid_nids); 4347 alc_ssid_check(codec, ssid_nids);
4347 4348
4348 if (!spec->no_analog) { 4349 if (!spec->no_analog) {
4349 alc_auto_check_switches(codec); 4350 err = alc_auto_check_switches(codec);
4351 if (err < 0)
4352 return err;
4350 err = alc_auto_add_mic_boost(codec); 4353 err = alc_auto_add_mic_boost(codec);
4351 if (err < 0) 4354 if (err < 0)
4352 return err; 4355 return err;
@@ -4370,8 +4373,11 @@ static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
4370 if (!spec) 4373 if (!spec)
4371 return -ENOMEM; 4374 return -ENOMEM;
4372 codec->spec = spec; 4375 codec->spec = spec;
4376 codec->single_adc_amp = 1;
4373 spec->mixer_nid = mixer_nid; 4377 spec->mixer_nid = mixer_nid;
4374 snd_hda_gen_init(&spec->gen); 4378 snd_hda_gen_init(&spec->gen);
4379 snd_array_init(&spec->kctls, sizeof(struct snd_kcontrol_new), 32);
4380 snd_array_init(&spec->bind_ctls, sizeof(struct hda_bind_ctls *), 8);
4375 4381
4376 err = alc_codec_rename_from_preset(codec); 4382 err = alc_codec_rename_from_preset(codec);
4377 if (err < 0) { 4383 if (err < 0) {
@@ -5986,6 +5992,30 @@ static void alc269_fixup_quanta_mute(struct hda_codec *codec,
5986 spec->automute_hook = alc269_quanta_automute; 5992 spec->automute_hook = alc269_quanta_automute;
5987} 5993}
5988 5994
5995/* update mute-LED according to the speaker mute state via mic1 VREF pin */
5996static void alc269_fixup_mic1_mute_hook(void *private_data, int enabled)
5997{
5998 struct hda_codec *codec = private_data;
5999 unsigned int pinval = AC_PINCTL_IN_EN + (enabled ?
6000 AC_PINCTL_VREF_HIZ : AC_PINCTL_VREF_80);
6001 snd_hda_set_pin_ctl_cache(codec, 0x18, pinval);
6002}
6003
6004static void alc269_fixup_mic1_mute(struct hda_codec *codec,
6005 const struct alc_fixup *fix, int action)
6006{
6007 struct alc_spec *spec = codec->spec;
6008 switch (action) {
6009 case ALC_FIXUP_ACT_BUILD:
6010 spec->vmaster_mute.hook = alc269_fixup_mic1_mute_hook;
6011 snd_hda_add_vmaster_hook(codec, &spec->vmaster_mute, true);
6012 /* fallthru */
6013 case ALC_FIXUP_ACT_INIT:
6014 snd_hda_sync_vmaster_hook(&spec->vmaster_mute);
6015 break;
6016 }
6017}
6018
5989/* update mute-LED according to the speaker mute state via mic2 VREF pin */ 6019/* update mute-LED according to the speaker mute state via mic2 VREF pin */
5990static void alc269_fixup_mic2_mute_hook(void *private_data, int enabled) 6020static void alc269_fixup_mic2_mute_hook(void *private_data, int enabled)
5991{ 6021{
@@ -6009,6 +6039,16 @@ static void alc269_fixup_mic2_mute(struct hda_codec *codec,
6009 } 6039 }
6010} 6040}
6011 6041
6042static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
6043 const struct alc_fixup *fix,
6044 int action)
6045{
6046 struct alc_spec *spec = codec->spec;
6047
6048 if (action == ALC_FIXUP_ACT_PROBE)
6049 snd_hda_jack_set_gating_jack(codec, spec->ext_mic_pin,
6050 spec->autocfg.hp_pins[0]);
6051}
6012 6052
6013enum { 6053enum {
6014 ALC269_FIXUP_SONY_VAIO, 6054 ALC269_FIXUP_SONY_VAIO,
@@ -6027,10 +6067,13 @@ enum {
6027 ALC269_FIXUP_DMIC, 6067 ALC269_FIXUP_DMIC,
6028 ALC269VB_FIXUP_AMIC, 6068 ALC269VB_FIXUP_AMIC,
6029 ALC269VB_FIXUP_DMIC, 6069 ALC269VB_FIXUP_DMIC,
6070 ALC269_FIXUP_MIC1_MUTE_LED,
6030 ALC269_FIXUP_MIC2_MUTE_LED, 6071 ALC269_FIXUP_MIC2_MUTE_LED,
6031 ALC269_FIXUP_INV_DMIC, 6072 ALC269_FIXUP_INV_DMIC,
6032 ALC269_FIXUP_LENOVO_DOCK, 6073 ALC269_FIXUP_LENOVO_DOCK,
6033 ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT, 6074 ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
6075 ALC271_FIXUP_AMIC_MIC2,
6076 ALC271_FIXUP_HP_GATE_MIC_JACK,
6034}; 6077};
6035 6078
6036static const struct alc_fixup alc269_fixups[] = { 6079static const struct alc_fixup alc269_fixups[] = {
@@ -6153,6 +6196,10 @@ static const struct alc_fixup alc269_fixups[] = {
6153 { } 6196 { }
6154 }, 6197 },
6155 }, 6198 },
6199 [ALC269_FIXUP_MIC1_MUTE_LED] = {
6200 .type = ALC_FIXUP_FUNC,
6201 .v.func = alc269_fixup_mic1_mute,
6202 },
6156 [ALC269_FIXUP_MIC2_MUTE_LED] = { 6203 [ALC269_FIXUP_MIC2_MUTE_LED] = {
6157 .type = ALC_FIXUP_FUNC, 6204 .type = ALC_FIXUP_FUNC,
6158 .v.func = alc269_fixup_mic2_mute, 6205 .v.func = alc269_fixup_mic2_mute,
@@ -6175,12 +6222,29 @@ static const struct alc_fixup alc269_fixups[] = {
6175 .type = ALC_FIXUP_FUNC, 6222 .type = ALC_FIXUP_FUNC,
6176 .v.func = alc269_fixup_pincfg_no_hp_to_lineout, 6223 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
6177 }, 6224 },
6225 [ALC271_FIXUP_AMIC_MIC2] = {
6226 .type = ALC_FIXUP_PINS,
6227 .v.pins = (const struct alc_pincfg[]) {
6228 { 0x14, 0x99130110 }, /* speaker */
6229 { 0x19, 0x01a19c20 }, /* mic */
6230 { 0x1b, 0x99a7012f }, /* int-mic */
6231 { 0x21, 0x0121401f }, /* HP out */
6232 { }
6233 },
6234 },
6235 [ALC271_FIXUP_HP_GATE_MIC_JACK] = {
6236 .type = ALC_FIXUP_FUNC,
6237 .v.func = alc271_hp_gate_mic_jack,
6238 .chained = true,
6239 .chain_id = ALC271_FIXUP_AMIC_MIC2,
6240 },
6178}; 6241};
6179 6242
6180static const struct snd_pci_quirk alc269_fixup_tbl[] = { 6243static const struct snd_pci_quirk alc269_fixup_tbl[] = {
6181 SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC), 6244 SND_PCI_QUIRK(0x1025, 0x029b, "Acer 1810TZ", ALC269_FIXUP_INV_DMIC),
6182 SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC), 6245 SND_PCI_QUIRK(0x1025, 0x0349, "Acer AOD260", ALC269_FIXUP_INV_DMIC),
6183 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_MIC2_MUTE_LED), 6246 SND_PCI_QUIRK(0x103c, 0x1586, "HP", ALC269_FIXUP_MIC2_MUTE_LED),
6247 SND_PCI_QUIRK(0x103c, 0x1972, "HP Pavilion 17", ALC269_FIXUP_MIC1_MUTE_LED),
6184 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_DMIC), 6248 SND_PCI_QUIRK(0x1043, 0x1427, "Asus Zenbook UX31E", ALC269VB_FIXUP_DMIC),
6185 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_DMIC), 6249 SND_PCI_QUIRK(0x1043, 0x1517, "Asus Zenbook UX31A", ALC269VB_FIXUP_DMIC),
6186 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW), 6250 SND_PCI_QUIRK(0x1043, 0x1a13, "Asus G73Jw", ALC269_FIXUP_ASUS_G73JW),
@@ -6195,6 +6259,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
6195 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), 6259 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
6196 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), 6260 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
6197 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), 6261 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
6262 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
6198 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC), 6263 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
6199 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK), 6264 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
6200 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE), 6265 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
@@ -6535,8 +6600,8 @@ static void alc861vd_fixup_dallas(struct hda_codec *codec,
6535 const struct alc_fixup *fix, int action) 6600 const struct alc_fixup *fix, int action)
6536{ 6601{
6537 if (action == ALC_FIXUP_ACT_PRE_PROBE) { 6602 if (action == ALC_FIXUP_ACT_PRE_PROBE) {
6538 snd_hda_override_pin_caps(codec, 0x18, 0x00001714); 6603 snd_hda_override_pin_caps(codec, 0x18, 0x00000734);
6539 snd_hda_override_pin_caps(codec, 0x19, 0x0000171c); 6604 snd_hda_override_pin_caps(codec, 0x19, 0x0000073c);
6540 } 6605 }
6541} 6606}
6542 6607
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 9ba8af056170..a86547ca17c8 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -1081,7 +1081,7 @@ static struct snd_kcontrol_new stac_smux_mixer = {
1081 1081
1082static const char * const slave_pfxs[] = { 1082static const char * const slave_pfxs[] = {
1083 "Front", "Surround", "Center", "LFE", "Side", 1083 "Front", "Surround", "Center", "LFE", "Side",
1084 "Headphone", "Speaker", "IEC958", "PCM", 1084 "Headphone", "Speaker", "Bass Speaker", "IEC958", "PCM",
1085 NULL 1085 NULL
1086}; 1086};
1087 1087
@@ -1136,9 +1136,10 @@ static int stac92xx_build_controls(struct hda_codec *codec)
1136 } 1136 }
1137 1137
1138 if (spec->multiout.dig_out_nid) { 1138 if (spec->multiout.dig_out_nid) {
1139 err = snd_hda_create_spdif_out_ctls(codec, 1139 err = snd_hda_create_dig_out_ctls(codec,
1140 spec->multiout.dig_out_nid, 1140 spec->multiout.dig_out_nid,
1141 spec->multiout.dig_out_nid); 1141 spec->multiout.dig_out_nid,
1142 spec->autocfg.dig_out_type[0]);
1142 if (err < 0) 1143 if (err < 0)
1143 return err; 1144 return err;
1144 err = snd_hda_create_spdif_share_sw(codec, 1145 err = snd_hda_create_spdif_share_sw(codec,
@@ -1724,7 +1725,7 @@ static const struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = {
1724 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1658, 1725 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1658,
1725 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), 1726 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1726 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1659, 1727 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1659,
1727 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), 1728 "HP Pavilion dv7", STAC_HP_DV7_4000),
1728 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x165A, 1729 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x165A,
1729 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), 1730 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1730 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x165B, 1731 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x165B,
@@ -2515,6 +2516,11 @@ static int stac92xx_build_pcms(struct hda_codec *codec)
2515 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_playback; 2516 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = stac92xx_pcm_analog_playback;
2516 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid = 2517 info->stream[SNDRV_PCM_STREAM_PLAYBACK].nid =
2517 spec->multiout.dac_nids[0]; 2518 spec->multiout.dac_nids[0];
2519 if (spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT &&
2520 spec->autocfg.line_outs == 2)
2521 info->stream[SNDRV_PCM_STREAM_PLAYBACK].chmap =
2522 snd_pcm_2_1_chmaps;
2523
2518 info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_analog_capture; 2524 info->stream[SNDRV_PCM_STREAM_CAPTURE] = stac92xx_pcm_analog_capture;
2519 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0]; 2525 info->stream[SNDRV_PCM_STREAM_CAPTURE].nid = spec->adc_nids[0];
2520 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = spec->num_adcs; 2526 info->stream[SNDRV_PCM_STREAM_CAPTURE].substreams = spec->num_adcs;
@@ -2805,7 +2811,6 @@ stac_control_new(struct sigmatel_spec *spec,
2805{ 2811{
2806 struct snd_kcontrol_new *knew; 2812 struct snd_kcontrol_new *knew;
2807 2813
2808 snd_array_init(&spec->kctls, sizeof(*knew), 32);
2809 knew = snd_array_new(&spec->kctls); 2814 knew = snd_array_new(&spec->kctls);
2810 if (!knew) 2815 if (!knew)
2811 return NULL; 2816 return NULL;
@@ -3268,9 +3273,9 @@ static int create_multi_out_ctls(struct hda_codec *codec, int num_outs,
3268 idx = i; 3273 idx = i;
3269 break; 3274 break;
3270 case AUTO_PIN_SPEAKER_OUT: 3275 case AUTO_PIN_SPEAKER_OUT:
3271 if (num_outs <= 1) { 3276 if (num_outs <= 2) {
3272 name = "Speaker"; 3277 name = i ? "Bass Speaker" : "Speaker";
3273 idx = i; 3278 idx = 0;
3274 break; 3279 break;
3275 } 3280 }
3276 /* Fall through in case of multi speaker outs */ 3281 /* Fall through in case of multi speaker outs */
@@ -4569,8 +4574,6 @@ static void stac92xx_free(struct hda_codec *codec)
4569 if (! spec) 4574 if (! spec)
4570 return; 4575 return;
4571 4576
4572 stac92xx_shutup(codec);
4573
4574 kfree(spec); 4577 kfree(spec);
4575 snd_hda_detach_beep_device(codec); 4578 snd_hda_detach_beep_device(codec);
4576} 4579}
@@ -5155,20 +5158,34 @@ static const struct hda_codec_ops stac92xx_patch_ops = {
5155 .reboot_notify = stac92xx_shutup, 5158 .reboot_notify = stac92xx_shutup,
5156}; 5159};
5157 5160
5161static int alloc_stac_spec(struct hda_codec *codec, int num_pins,
5162 const hda_nid_t *pin_nids)
5163{
5164 struct sigmatel_spec *spec;
5165
5166 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
5167 if (!spec)
5168 return -ENOMEM;
5169 codec->spec = spec;
5170 codec->no_trigger_sense = 1; /* seems common with STAC/IDT codecs */
5171 spec->num_pins = num_pins;
5172 spec->pin_nids = pin_nids;
5173 snd_array_init(&spec->kctls, sizeof(struct snd_kcontrol_new), 32);
5174 return 0;
5175}
5176
5158static int patch_stac9200(struct hda_codec *codec) 5177static int patch_stac9200(struct hda_codec *codec)
5159{ 5178{
5160 struct sigmatel_spec *spec; 5179 struct sigmatel_spec *spec;
5161 int err; 5180 int err;
5162 5181
5163 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 5182 err = alloc_stac_spec(codec, ARRAY_SIZE(stac9200_pin_nids),
5164 if (spec == NULL) 5183 stac9200_pin_nids);
5165 return -ENOMEM; 5184 if (err < 0)
5185 return err;
5166 5186
5167 codec->no_trigger_sense = 1; 5187 spec = codec->spec;
5168 codec->spec = spec;
5169 spec->linear_tone_beep = 1; 5188 spec->linear_tone_beep = 1;
5170 spec->num_pins = ARRAY_SIZE(stac9200_pin_nids);
5171 spec->pin_nids = stac9200_pin_nids;
5172 spec->board_config = snd_hda_check_board_config(codec, STAC_9200_MODELS, 5189 spec->board_config = snd_hda_check_board_config(codec, STAC_9200_MODELS,
5173 stac9200_models, 5190 stac9200_models,
5174 stac9200_cfg_tbl); 5191 stac9200_cfg_tbl);
@@ -5224,15 +5241,13 @@ static int patch_stac925x(struct hda_codec *codec)
5224 struct sigmatel_spec *spec; 5241 struct sigmatel_spec *spec;
5225 int err; 5242 int err;
5226 5243
5227 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 5244 err = alloc_stac_spec(codec, ARRAY_SIZE(stac925x_pin_nids),
5228 if (spec == NULL) 5245 stac925x_pin_nids);
5229 return -ENOMEM; 5246 if (err < 0)
5247 return err;
5230 5248
5231 codec->no_trigger_sense = 1; 5249 spec = codec->spec;
5232 codec->spec = spec;
5233 spec->linear_tone_beep = 1; 5250 spec->linear_tone_beep = 1;
5234 spec->num_pins = ARRAY_SIZE(stac925x_pin_nids);
5235 spec->pin_nids = stac925x_pin_nids;
5236 5251
5237 /* Check first for codec ID */ 5252 /* Check first for codec ID */
5238 spec->board_config = snd_hda_check_board_codec_sid_config(codec, 5253 spec->board_config = snd_hda_check_board_codec_sid_config(codec,
@@ -5307,19 +5322,17 @@ static int patch_stac92hd73xx(struct hda_codec *codec)
5307{ 5322{
5308 struct sigmatel_spec *spec; 5323 struct sigmatel_spec *spec;
5309 hda_nid_t conn[STAC92HD73_DAC_COUNT + 2]; 5324 hda_nid_t conn[STAC92HD73_DAC_COUNT + 2];
5310 int err = 0; 5325 int err;
5311 int num_dacs; 5326 int num_dacs;
5312 5327
5313 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 5328 err = alloc_stac_spec(codec, ARRAY_SIZE(stac92hd73xx_pin_nids),
5314 if (spec == NULL) 5329 stac92hd73xx_pin_nids);
5315 return -ENOMEM; 5330 if (err < 0)
5331 return err;
5316 5332
5317 codec->no_trigger_sense = 1; 5333 spec = codec->spec;
5318 codec->spec = spec;
5319 spec->linear_tone_beep = 0; 5334 spec->linear_tone_beep = 0;
5320 codec->slave_dig_outs = stac92hd73xx_slave_dig_outs; 5335 codec->slave_dig_outs = stac92hd73xx_slave_dig_outs;
5321 spec->num_pins = ARRAY_SIZE(stac92hd73xx_pin_nids);
5322 spec->pin_nids = stac92hd73xx_pin_nids;
5323 spec->board_config = snd_hda_check_board_config(codec, 5336 spec->board_config = snd_hda_check_board_config(codec,
5324 STAC_92HD73XX_MODELS, 5337 STAC_92HD73XX_MODELS,
5325 stac92hd73xx_models, 5338 stac92hd73xx_models,
@@ -5596,9 +5609,9 @@ static int patch_stac92hd83xxx(struct hda_codec *codec)
5596 int default_polarity = -1; /* no default cfg */ 5609 int default_polarity = -1; /* no default cfg */
5597 int err; 5610 int err;
5598 5611
5599 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 5612 err = alloc_stac_spec(codec, 0, NULL); /* pins filled later */
5600 if (spec == NULL) 5613 if (err < 0)
5601 return -ENOMEM; 5614 return err;
5602 5615
5603 if (hp_bnb2011_with_dock(codec)) { 5616 if (hp_bnb2011_with_dock(codec)) {
5604 snd_hda_codec_set_pincfg(codec, 0xa, 0x2101201f); 5617 snd_hda_codec_set_pincfg(codec, 0xa, 0x2101201f);
@@ -5606,11 +5619,9 @@ static int patch_stac92hd83xxx(struct hda_codec *codec)
5606 } 5619 }
5607 5620
5608 codec->epss = 0; /* longer delay needed for D3 */ 5621 codec->epss = 0; /* longer delay needed for D3 */
5609 codec->no_trigger_sense = 1;
5610 codec->spec = spec;
5611
5612 stac92hd8x_fill_auto_spec(codec); 5622 stac92hd8x_fill_auto_spec(codec);
5613 5623
5624 spec = codec->spec;
5614 spec->linear_tone_beep = 0; 5625 spec->linear_tone_beep = 0;
5615 codec->slave_dig_outs = stac92hd83xxx_slave_dig_outs; 5626 codec->slave_dig_outs = stac92hd83xxx_slave_dig_outs;
5616 spec->digbeep_nid = 0x21; 5627 spec->digbeep_nid = 0x21;
@@ -5779,21 +5790,19 @@ static int patch_stac92hd71bxx(struct hda_codec *codec)
5779 struct sigmatel_spec *spec; 5790 struct sigmatel_spec *spec;
5780 const struct hda_verb *unmute_init = stac92hd71bxx_unmute_core_init; 5791 const struct hda_verb *unmute_init = stac92hd71bxx_unmute_core_init;
5781 unsigned int pin_cfg; 5792 unsigned int pin_cfg;
5782 int err = 0; 5793 int err;
5783 5794
5784 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 5795 err = alloc_stac_spec(codec, STAC92HD71BXX_NUM_PINS,
5785 if (spec == NULL) 5796 stac92hd71bxx_pin_nids_4port);
5786 return -ENOMEM; 5797 if (err < 0)
5798 return err;
5787 5799
5788 codec->no_trigger_sense = 1; 5800 spec = codec->spec;
5789 codec->spec = spec;
5790 spec->linear_tone_beep = 0; 5801 spec->linear_tone_beep = 0;
5791 codec->patch_ops = stac92xx_patch_ops; 5802 codec->patch_ops = stac92xx_patch_ops;
5792 spec->num_pins = STAC92HD71BXX_NUM_PINS;
5793 switch (codec->vendor_id) { 5803 switch (codec->vendor_id) {
5794 case 0x111d76b6: 5804 case 0x111d76b6:
5795 case 0x111d76b7: 5805 case 0x111d76b7:
5796 spec->pin_nids = stac92hd71bxx_pin_nids_4port;
5797 break; 5806 break;
5798 case 0x111d7603: 5807 case 0x111d7603:
5799 case 0x111d7608: 5808 case 0x111d7608:
@@ -6024,15 +6033,13 @@ static int patch_stac922x(struct hda_codec *codec)
6024 struct sigmatel_spec *spec; 6033 struct sigmatel_spec *spec;
6025 int err; 6034 int err;
6026 6035
6027 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 6036 err = alloc_stac_spec(codec, ARRAY_SIZE(stac922x_pin_nids),
6028 if (spec == NULL) 6037 stac922x_pin_nids);
6029 return -ENOMEM; 6038 if (err < 0)
6039 return err;
6030 6040
6031 codec->no_trigger_sense = 1; 6041 spec = codec->spec;
6032 codec->spec = spec;
6033 spec->linear_tone_beep = 1; 6042 spec->linear_tone_beep = 1;
6034 spec->num_pins = ARRAY_SIZE(stac922x_pin_nids);
6035 spec->pin_nids = stac922x_pin_nids;
6036 spec->board_config = snd_hda_check_board_config(codec, STAC_922X_MODELS, 6043 spec->board_config = snd_hda_check_board_config(codec, STAC_922X_MODELS,
6037 stac922x_models, 6044 stac922x_models,
6038 stac922x_cfg_tbl); 6045 stac922x_cfg_tbl);
@@ -6129,16 +6136,14 @@ static int patch_stac927x(struct hda_codec *codec)
6129 struct sigmatel_spec *spec; 6136 struct sigmatel_spec *spec;
6130 int err; 6137 int err;
6131 6138
6132 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 6139 err = alloc_stac_spec(codec, ARRAY_SIZE(stac927x_pin_nids),
6133 if (spec == NULL) 6140 stac927x_pin_nids);
6134 return -ENOMEM; 6141 if (err < 0)
6142 return err;
6135 6143
6136 codec->no_trigger_sense = 1; 6144 spec = codec->spec;
6137 codec->spec = spec;
6138 spec->linear_tone_beep = 1; 6145 spec->linear_tone_beep = 1;
6139 codec->slave_dig_outs = stac927x_slave_dig_outs; 6146 codec->slave_dig_outs = stac927x_slave_dig_outs;
6140 spec->num_pins = ARRAY_SIZE(stac927x_pin_nids);
6141 spec->pin_nids = stac927x_pin_nids;
6142 spec->board_config = snd_hda_check_board_config(codec, STAC_927X_MODELS, 6147 spec->board_config = snd_hda_check_board_config(codec, STAC_927X_MODELS,
6143 stac927x_models, 6148 stac927x_models,
6144 stac927x_cfg_tbl); 6149 stac927x_cfg_tbl);
@@ -6265,15 +6270,13 @@ static int patch_stac9205(struct hda_codec *codec)
6265 struct sigmatel_spec *spec; 6270 struct sigmatel_spec *spec;
6266 int err; 6271 int err;
6267 6272
6268 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 6273 err = alloc_stac_spec(codec, ARRAY_SIZE(stac9205_pin_nids),
6269 if (spec == NULL) 6274 stac9205_pin_nids);
6270 return -ENOMEM; 6275 if (err < 0)
6276 return err;
6271 6277
6272 codec->no_trigger_sense = 1; 6278 spec = codec->spec;
6273 codec->spec = spec;
6274 spec->linear_tone_beep = 1; 6279 spec->linear_tone_beep = 1;
6275 spec->num_pins = ARRAY_SIZE(stac9205_pin_nids);
6276 spec->pin_nids = stac9205_pin_nids;
6277 spec->board_config = snd_hda_check_board_config(codec, STAC_9205_MODELS, 6280 spec->board_config = snd_hda_check_board_config(codec, STAC_9205_MODELS,
6278 stac9205_models, 6281 stac9205_models,
6279 stac9205_cfg_tbl); 6282 stac9205_cfg_tbl);
@@ -6421,14 +6424,13 @@ static int patch_stac9872(struct hda_codec *codec)
6421 struct sigmatel_spec *spec; 6424 struct sigmatel_spec *spec;
6422 int err; 6425 int err;
6423 6426
6424 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 6427 err = alloc_stac_spec(codec, ARRAY_SIZE(stac9872_pin_nids),
6425 if (spec == NULL) 6428 stac9872_pin_nids);
6426 return -ENOMEM; 6429 if (err < 0)
6427 codec->no_trigger_sense = 1; 6430 return err;
6428 codec->spec = spec; 6431
6432 spec = codec->spec;
6429 spec->linear_tone_beep = 1; 6433 spec->linear_tone_beep = 1;
6430 spec->num_pins = ARRAY_SIZE(stac9872_pin_nids);
6431 spec->pin_nids = stac9872_pin_nids;
6432 6434
6433 spec->board_config = snd_hda_check_board_config(codec, STAC_9872_MODELS, 6435 spec->board_config = snd_hda_check_board_config(codec, STAC_9872_MODELS,
6434 stac9872_models, 6436 stac9872_models,
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c
index 019e1a00414a..09bb64996d72 100644
--- a/sound/pci/hda/patch_via.c
+++ b/sound/pci/hda/patch_via.c
@@ -76,6 +76,8 @@ enum VIA_HDA_CODEC {
76 VT2002P, 76 VT2002P,
77 VT1812, 77 VT1812,
78 VT1802, 78 VT1802,
79 VT1705CF,
80 VT1808,
79 CODEC_TYPES, 81 CODEC_TYPES,
80}; 82};
81 83
@@ -220,6 +222,7 @@ struct via_spec {
220 int vt1708_hp_present; 222 int vt1708_hp_present;
221 223
222 void (*set_widgets_power_state)(struct hda_codec *codec); 224 void (*set_widgets_power_state)(struct hda_codec *codec);
225 unsigned int dac_stream_tag[4];
223 226
224 struct hda_loopback_check loopback; 227 struct hda_loopback_check loopback;
225 int num_loopbacks; 228 int num_loopbacks;
@@ -241,6 +244,7 @@ static struct via_spec * via_new_spec(struct hda_codec *codec)
241 if (spec == NULL) 244 if (spec == NULL)
242 return NULL; 245 return NULL;
243 246
247 snd_array_init(&spec->kctls, sizeof(struct snd_kcontrol_new), 32);
244 mutex_init(&spec->config_mutex); 248 mutex_init(&spec->config_mutex);
245 codec->spec = spec; 249 codec->spec = spec;
246 spec->codec = codec; 250 spec->codec = codec;
@@ -295,6 +299,10 @@ static enum VIA_HDA_CODEC get_codec_type(struct hda_codec *codec)
295 codec_type = VT1708S; 299 codec_type = VT1708S;
296 else if ((dev_id & 0xfff) == 0x446) 300 else if ((dev_id & 0xfff) == 0x446)
297 codec_type = VT1802; 301 codec_type = VT1802;
302 else if (dev_id == 0x4760)
303 codec_type = VT1705CF;
304 else if (dev_id == 0x4761 || dev_id == 0x4762)
305 codec_type = VT1808;
298 else 306 else
299 codec_type = UNKNOWN; 307 codec_type = UNKNOWN;
300 return codec_type; 308 return codec_type;
@@ -387,7 +395,6 @@ static struct snd_kcontrol_new *__via_clone_ctl(struct via_spec *spec,
387{ 395{
388 struct snd_kcontrol_new *knew; 396 struct snd_kcontrol_new *knew;
389 397
390 snd_array_init(&spec->kctls, sizeof(*knew), 32);
391 knew = snd_array_new(&spec->kctls); 398 knew = snd_array_new(&spec->kctls);
392 if (!knew) 399 if (!knew)
393 return NULL; 400 return NULL;
@@ -711,6 +718,28 @@ static void update_power_state(struct hda_codec *codec, hda_nid_t nid,
711 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_POWER_STATE, parm); 718 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_POWER_STATE, parm);
712} 719}
713 720
721static void update_conv_power_state(struct hda_codec *codec, hda_nid_t nid,
722 unsigned int parm, unsigned int index)
723{
724 struct via_spec *spec = codec->spec;
725 unsigned int format;
726 if (snd_hda_codec_read(codec, nid, 0,
727 AC_VERB_GET_POWER_STATE, 0) == parm)
728 return;
729 format = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONV, 0);
730 if (format && (spec->dac_stream_tag[index] != format))
731 spec->dac_stream_tag[index] = format;
732
733 snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_POWER_STATE, parm);
734 if (parm == AC_PWRST_D0) {
735 format = snd_hda_codec_read(codec, nid, 0, AC_VERB_GET_CONV, 0);
736 if (!format && (spec->dac_stream_tag[index] != format))
737 snd_hda_codec_write(codec, nid, 0,
738 AC_VERB_SET_CHANNEL_STREAMID,
739 spec->dac_stream_tag[index]);
740 }
741}
742
714static void set_pin_power_state(struct hda_codec *codec, hda_nid_t nid, 743static void set_pin_power_state(struct hda_codec *codec, hda_nid_t nid,
715 unsigned int *affected_parm) 744 unsigned int *affected_parm)
716{ 745{
@@ -739,18 +768,7 @@ static void set_pin_power_state(struct hda_codec *codec, hda_nid_t nid,
739static int via_pin_power_ctl_info(struct snd_kcontrol *kcontrol, 768static int via_pin_power_ctl_info(struct snd_kcontrol *kcontrol,
740 struct snd_ctl_elem_info *uinfo) 769 struct snd_ctl_elem_info *uinfo)
741{ 770{
742 static const char * const texts[] = { 771 return snd_hda_enum_bool_helper_info(kcontrol, uinfo);
743 "Disabled", "Enabled"
744 };
745
746 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
747 uinfo->count = 1;
748 uinfo->value.enumerated.items = 2;
749 if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items)
750 uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1;
751 strcpy(uinfo->value.enumerated.name,
752 texts[uinfo->value.enumerated.item]);
753 return 0;
754} 772}
755 773
756static int via_pin_power_ctl_get(struct snd_kcontrol *kcontrol, 774static int via_pin_power_ctl_get(struct snd_kcontrol *kcontrol,
@@ -1096,6 +1114,11 @@ static void __analog_low_current_mode(struct hda_codec *codec, bool force)
1096 verb = 0xf93; 1114 verb = 0xf93;
1097 parm = enable ? 0x00 : 0xe0; /* 0x00: 4/40x, 0xe0: 1x */ 1115 parm = enable ? 0x00 : 0xe0; /* 0x00: 4/40x, 0xe0: 1x */
1098 break; 1116 break;
1117 case VT1705CF:
1118 case VT1808:
1119 verb = 0xf82;
1120 parm = enable ? 0x00 : 0xe0; /* 0x00: 4/40x, 0xe0: 1x */
1121 break;
1099 default: 1122 default:
1100 return; /* other codecs are not supported */ 1123 return; /* other codecs are not supported */
1101 } 1124 }
@@ -1454,7 +1477,7 @@ static const struct hda_pcm_stream via_pcm_digital_capture = {
1454 */ 1477 */
1455static const char * const via_slave_pfxs[] = { 1478static const char * const via_slave_pfxs[] = {
1456 "Front", "Surround", "Center", "LFE", "Side", 1479 "Front", "Surround", "Center", "LFE", "Side",
1457 "Headphone", "Speaker", 1480 "Headphone", "Speaker", "Bass Speaker",
1458 NULL, 1481 NULL,
1459}; 1482};
1460 1483
@@ -1555,6 +1578,10 @@ static int via_build_pcms(struct hda_codec *codec)
1555 spec->multiout.dac_nids[0]; 1578 spec->multiout.dac_nids[0];
1556 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max = 1579 info->stream[SNDRV_PCM_STREAM_PLAYBACK].channels_max =
1557 spec->multiout.max_channels; 1580 spec->multiout.max_channels;
1581 if (spec->autocfg.line_out_type == AUTO_PIN_SPEAKER_OUT
1582 && spec->autocfg.line_outs == 2)
1583 info->stream[SNDRV_PCM_STREAM_PLAYBACK].chmap =
1584 snd_pcm_2_1_chmaps;
1558 } 1585 }
1559 1586
1560 if (!spec->stream_analog_capture) { 1587 if (!spec->stream_analog_capture) {
@@ -1934,7 +1961,7 @@ static int via_auto_create_multi_out_ctls(struct hda_codec *codec)
1934 struct auto_pin_cfg *cfg = &spec->autocfg; 1961 struct auto_pin_cfg *cfg = &spec->autocfg;
1935 struct nid_path *path; 1962 struct nid_path *path;
1936 static const char * const chname[4] = { 1963 static const char * const chname[4] = {
1937 "Front", "Surround", "C/LFE", "Side" 1964 "Front", "Surround", NULL /* "CLFE" */, "Side"
1938 }; 1965 };
1939 int i, idx, err; 1966 int i, idx, err;
1940 int old_line_outs; 1967 int old_line_outs;
@@ -1969,8 +1996,8 @@ static int via_auto_create_multi_out_ctls(struct hda_codec *codec)
1969 } else { 1996 } else {
1970 const char *pfx = chname[i]; 1997 const char *pfx = chname[i];
1971 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT && 1998 if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT &&
1972 cfg->line_outs == 1) 1999 cfg->line_outs <= 2)
1973 pfx = "Speaker"; 2000 pfx = i ? "Bass Speaker" : "Speaker";
1974 err = create_ch_ctls(codec, pfx, 3, true, path); 2001 err = create_ch_ctls(codec, pfx, 3, true, path);
1975 if (err < 0) 2002 if (err < 0)
1976 return err; 2003 return err;
@@ -3824,6 +3851,125 @@ static int patch_vt1812(struct hda_codec *codec)
3824 return 0; 3851 return 0;
3825} 3852}
3826 3853
3854/* patch for vt3476 */
3855
3856static const struct hda_verb vt3476_init_verbs[] = {
3857 /* Enable DMic 8/16/32K */
3858 {0x1, 0xF7B, 0x30},
3859 /* Enable Boost Volume backdoor */
3860 {0x1, 0xFB9, 0x20},
3861 /* Enable AOW-MW9 path */
3862 {0x1, 0xFB8, 0x10},
3863 { }
3864};
3865
3866static void set_widgets_power_state_vt3476(struct hda_codec *codec)
3867{
3868 struct via_spec *spec = codec->spec;
3869 int imux_is_smixer;
3870 unsigned int parm, parm2;
3871 /* MUX10 (1eh) = stereo mixer */
3872 imux_is_smixer =
3873 snd_hda_codec_read(codec, 0x1e, 0, AC_VERB_GET_CONNECT_SEL, 0x00) == 4;
3874 /* inputs */
3875 /* PW 5/6/7 (29h/2ah/2bh) */
3876 parm = AC_PWRST_D3;
3877 set_pin_power_state(codec, 0x29, &parm);
3878 set_pin_power_state(codec, 0x2a, &parm);
3879 set_pin_power_state(codec, 0x2b, &parm);
3880 if (imux_is_smixer)
3881 parm = AC_PWRST_D0;
3882 /* MUX10/11 (1eh/1fh), AIW 0/1 (10h/11h) */
3883 update_power_state(codec, 0x1e, parm);
3884 update_power_state(codec, 0x1f, parm);
3885 update_power_state(codec, 0x10, parm);
3886 update_power_state(codec, 0x11, parm);
3887
3888 /* outputs */
3889 /* PW3 (27h), MW3(37h), AOW3 (bh) */
3890 if (spec->codec_type == VT1705CF) {
3891 parm = AC_PWRST_D3;
3892 update_power_state(codec, 0x27, parm);
3893 update_power_state(codec, 0x37, parm);
3894 } else {
3895 parm = AC_PWRST_D3;
3896 set_pin_power_state(codec, 0x27, &parm);
3897 update_power_state(codec, 0x37, parm);
3898 }
3899
3900 /* PW2 (26h), MW2(36h), AOW2 (ah) */
3901 parm = AC_PWRST_D3;
3902 set_pin_power_state(codec, 0x26, &parm);
3903 update_power_state(codec, 0x36, parm);
3904 if (spec->smart51_enabled) {
3905 /* PW7(2bh), MW7(3bh), MUX7(1Bh) */
3906 set_pin_power_state(codec, 0x2b, &parm);
3907 update_power_state(codec, 0x3b, parm);
3908 update_power_state(codec, 0x1b, parm);
3909 }
3910 update_conv_power_state(codec, 0xa, parm, 2);
3911
3912 /* PW1 (25h), MW1(35h), AOW1 (9h) */
3913 parm = AC_PWRST_D3;
3914 set_pin_power_state(codec, 0x25, &parm);
3915 update_power_state(codec, 0x35, parm);
3916 if (spec->smart51_enabled) {
3917 /* PW6(2ah), MW6(3ah), MUX6(1ah) */
3918 set_pin_power_state(codec, 0x2a, &parm);
3919 update_power_state(codec, 0x3a, parm);
3920 update_power_state(codec, 0x1a, parm);
3921 }
3922 update_conv_power_state(codec, 0x9, parm, 1);
3923
3924 /* PW4 (28h), MW4 (38h), MUX4(18h), AOW3(bh)/AOW0(8h) */
3925 parm = AC_PWRST_D3;
3926 set_pin_power_state(codec, 0x28, &parm);
3927 update_power_state(codec, 0x38, parm);
3928 update_power_state(codec, 0x18, parm);
3929 if (spec->hp_independent_mode)
3930 update_conv_power_state(codec, 0xb, parm, 3);
3931 parm2 = parm; /* for pin 0x0b */
3932
3933 /* PW0 (24h), MW0(34h), MW9(3fh), AOW0 (8h) */
3934 parm = AC_PWRST_D3;
3935 set_pin_power_state(codec, 0x24, &parm);
3936 update_power_state(codec, 0x34, parm);
3937 if (!spec->hp_independent_mode && parm2 != AC_PWRST_D3)
3938 parm = parm2;
3939 update_conv_power_state(codec, 0x8, parm, 0);
3940 /* MW9 (21h), Mw2 (1ah), AOW0 (8h) */
3941 update_power_state(codec, 0x3f, imux_is_smixer ? AC_PWRST_D0 : parm);
3942}
3943
3944static int patch_vt3476(struct hda_codec *codec)
3945{
3946 struct via_spec *spec;
3947 int err;
3948
3949 /* create a codec specific record */
3950 spec = via_new_spec(codec);
3951 if (spec == NULL)
3952 return -ENOMEM;
3953
3954 spec->aa_mix_nid = 0x3f;
3955 add_secret_dac_path(codec);
3956
3957 /* automatic parse from the BIOS config */
3958 err = via_parse_auto_config(codec);
3959 if (err < 0) {
3960 via_free(codec);
3961 return err;
3962 }
3963
3964 spec->init_verbs[spec->num_iverbs++] = vt3476_init_verbs;
3965
3966 codec->patch_ops = via_patch_ops;
3967
3968 spec->set_widgets_power_state = set_widgets_power_state_vt3476;
3969
3970 return 0;
3971}
3972
3827/* 3973/*
3828 * patch entries 3974 * patch entries
3829 */ 3975 */
@@ -3917,6 +4063,12 @@ static const struct hda_codec_preset snd_hda_preset_via[] = {
3917 .patch = patch_vt2002P}, 4063 .patch = patch_vt2002P},
3918 { .id = 0x11068446, .name = "VT1802", 4064 { .id = 0x11068446, .name = "VT1802",
3919 .patch = patch_vt2002P}, 4065 .patch = patch_vt2002P},
4066 { .id = 0x11064760, .name = "VT1705CF",
4067 .patch = patch_vt3476},
4068 { .id = 0x11064761, .name = "VT1708SCE",
4069 .patch = patch_vt3476},
4070 { .id = 0x11064762, .name = "VT1808",
4071 .patch = patch_vt3476},
3920 {} /* terminator */ 4072 {} /* terminator */
3921}; 4073};
3922 4074
diff --git a/sound/pci/ice1712/Makefile b/sound/pci/ice1712/Makefile
index f7ce33f00ea5..7e50c1324556 100644
--- a/sound/pci/ice1712/Makefile
+++ b/sound/pci/ice1712/Makefile
@@ -5,7 +5,7 @@
5 5
6snd-ice17xx-ak4xxx-objs := ak4xxx.o 6snd-ice17xx-ak4xxx-objs := ak4xxx.o
7snd-ice1712-objs := ice1712.o delta.o hoontech.o ews.o 7snd-ice1712-objs := ice1712.o delta.o hoontech.o ews.o
8snd-ice1724-objs := ice1724.o amp.o revo.o aureon.o vt1720_mobo.o pontis.o prodigy192.o prodigy_hifi.o juli.o phase.o wtm.o se.o maya44.o quartet.o 8snd-ice1724-objs := ice1724.o amp.o revo.o aureon.o vt1720_mobo.o pontis.o prodigy192.o prodigy_hifi.o juli.o phase.o wtm.o se.o maya44.o quartet.o psc724.o wm8766.o wm8776.o
9 9
10# Toplevel Module Dependency 10# Toplevel Module Dependency
11obj-$(CONFIG_SND_ICE1712) += snd-ice1712.o snd-ice17xx-ak4xxx.o 11obj-$(CONFIG_SND_ICE1712) += snd-ice1712.o snd-ice17xx-ak4xxx.o
diff --git a/sound/pci/ice1712/amp.c b/sound/pci/ice1712/amp.c
index e525da2673be..2f9b93467867 100644
--- a/sound/pci/ice1712/amp.c
+++ b/sound/pci/ice1712/amp.c
@@ -21,7 +21,6 @@
21 * 21 *
22 */ 22 */
23 23
24#include <asm/io.h>
25#include <linux/delay.h> 24#include <linux/delay.h>
26#include <linux/interrupt.h> 25#include <linux/interrupt.h>
27#include <linux/init.h> 26#include <linux/init.h>
@@ -38,7 +37,7 @@ static void wm_put(struct snd_ice1712 *ice, int reg, unsigned short val)
38 snd_vt1724_write_i2c(ice, WM_DEV, cval >> 8, cval & 0xff); 37 snd_vt1724_write_i2c(ice, WM_DEV, cval >> 8, cval & 0xff);
39} 38}
40 39
41static int __devinit snd_vt1724_amp_init(struct snd_ice1712 *ice) 40static int snd_vt1724_amp_init(struct snd_ice1712 *ice)
42{ 41{
43 static const unsigned short wm_inits[] = { 42 static const unsigned short wm_inits[] = {
44 WM_ATTEN_L, 0x0000, /* 0 db */ 43 WM_ATTEN_L, 0x0000, /* 0 db */
@@ -66,7 +65,7 @@ static int __devinit snd_vt1724_amp_init(struct snd_ice1712 *ice)
66 return 0; 65 return 0;
67} 66}
68 67
69static int __devinit snd_vt1724_amp_add_controls(struct snd_ice1712 *ice) 68static int snd_vt1724_amp_add_controls(struct snd_ice1712 *ice)
70{ 69{
71 if (ice->ac97) 70 if (ice->ac97)
72 /* we use pins 39 and 41 of the VT1616 for left and right 71 /* we use pins 39 and 41 of the VT1616 for left and right
@@ -78,7 +77,7 @@ static int __devinit snd_vt1724_amp_add_controls(struct snd_ice1712 *ice)
78 77
79 78
80/* entry point */ 79/* entry point */
81struct snd_ice1712_card_info snd_vt1724_amp_cards[] __devinitdata = { 80struct snd_ice1712_card_info snd_vt1724_amp_cards[] = {
82 { 81 {
83 .subvendor = VT1724_SUBDEVICE_AV710, 82 .subvendor = VT1724_SUBDEVICE_AV710,
84 .name = "Chaintech AV-710", 83 .name = "Chaintech AV-710",
diff --git a/sound/pci/ice1712/aureon.c b/sound/pci/ice1712/aureon.c
index 20bcddea2eab..55902ec40344 100644
--- a/sound/pci/ice1712/aureon.c
+++ b/sound/pci/ice1712/aureon.c
@@ -46,7 +46,6 @@
46 * on mixer switch and other coll stuff. 46 * on mixer switch and other coll stuff.
47 */ 47 */
48 48
49#include <linux/io.h>
50#include <linux/delay.h> 49#include <linux/delay.h>
51#include <linux/interrupt.h> 50#include <linux/interrupt.h>
52#include <linux/init.h> 51#include <linux/init.h>
@@ -203,7 +202,8 @@ static void aureon_pca9554_write(struct snd_ice1712 *ice, unsigned char reg,
203static int aureon_universe_inmux_info(struct snd_kcontrol *kcontrol, 202static int aureon_universe_inmux_info(struct snd_kcontrol *kcontrol,
204 struct snd_ctl_elem_info *uinfo) 203 struct snd_ctl_elem_info *uinfo)
205{ 204{
206 char *texts[3] = {"Internal Aux", "Wavetable", "Rear Line-In"}; 205 static const char * const texts[3] =
206 {"Internal Aux", "Wavetable", "Rear Line-In"};
207 207
208 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 208 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
209 uinfo->count = 1; 209 uinfo->count = 1;
@@ -1433,7 +1433,7 @@ static int aureon_oversampling_put(struct snd_kcontrol *kcontrol, struct snd_ctl
1433 * mixers 1433 * mixers
1434 */ 1434 */
1435 1435
1436static struct snd_kcontrol_new aureon_dac_controls[] __devinitdata = { 1436static struct snd_kcontrol_new aureon_dac_controls[] = {
1437 { 1437 {
1438 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1438 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1439 .name = "Master Playback Switch", 1439 .name = "Master Playback Switch",
@@ -1548,7 +1548,7 @@ static struct snd_kcontrol_new aureon_dac_controls[] __devinitdata = {
1548 } 1548 }
1549}; 1549};
1550 1550
1551static struct snd_kcontrol_new wm_controls[] __devinitdata = { 1551static struct snd_kcontrol_new wm_controls[] = {
1552 { 1552 {
1553 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1553 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1554 .name = "PCM Playback Switch", 1554 .name = "PCM Playback Switch",
@@ -1614,7 +1614,7 @@ static struct snd_kcontrol_new wm_controls[] __devinitdata = {
1614 } 1614 }
1615}; 1615};
1616 1616
1617static struct snd_kcontrol_new ac97_controls[] __devinitdata = { 1617static struct snd_kcontrol_new ac97_controls[] = {
1618 { 1618 {
1619 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1619 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1620 .name = "AC97 Playback Switch", 1620 .name = "AC97 Playback Switch",
@@ -1719,7 +1719,7 @@ static struct snd_kcontrol_new ac97_controls[] __devinitdata = {
1719 } 1719 }
1720}; 1720};
1721 1721
1722static struct snd_kcontrol_new universe_ac97_controls[] __devinitdata = { 1722static struct snd_kcontrol_new universe_ac97_controls[] = {
1723 { 1723 {
1724 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1724 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1725 .name = "AC97 Playback Switch", 1725 .name = "AC97 Playback Switch",
@@ -1851,7 +1851,7 @@ static struct snd_kcontrol_new universe_ac97_controls[] __devinitdata = {
1851 1851
1852}; 1852};
1853 1853
1854static struct snd_kcontrol_new cs8415_controls[] __devinitdata = { 1854static struct snd_kcontrol_new cs8415_controls[] = {
1855 { 1855 {
1856 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1856 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1857 .name = SNDRV_CTL_NAME_IEC958("", CAPTURE, SWITCH), 1857 .name = SNDRV_CTL_NAME_IEC958("", CAPTURE, SWITCH),
@@ -1896,7 +1896,7 @@ static struct snd_kcontrol_new cs8415_controls[] __devinitdata = {
1896 } 1896 }
1897}; 1897};
1898 1898
1899static int __devinit aureon_add_controls(struct snd_ice1712 *ice) 1899static int aureon_add_controls(struct snd_ice1712 *ice)
1900{ 1900{
1901 unsigned int i, counts; 1901 unsigned int i, counts;
1902 int err; 1902 int err;
@@ -2124,7 +2124,7 @@ static int aureon_resume(struct snd_ice1712 *ice)
2124/* 2124/*
2125 * initialize the chip 2125 * initialize the chip
2126 */ 2126 */
2127static int __devinit aureon_init(struct snd_ice1712 *ice) 2127static int aureon_init(struct snd_ice1712 *ice)
2128{ 2128{
2129 struct aureon_spec *spec; 2129 struct aureon_spec *spec;
2130 int i, err; 2130 int i, err;
@@ -2174,7 +2174,7 @@ static int __devinit aureon_init(struct snd_ice1712 *ice)
2174 * hence the driver needs to sets up it properly. 2174 * hence the driver needs to sets up it properly.
2175 */ 2175 */
2176 2176
2177static unsigned char aureon51_eeprom[] __devinitdata = { 2177static unsigned char aureon51_eeprom[] = {
2178 [ICE_EEP2_SYSCONF] = 0x0a, /* clock 512, spdif-in/ADC, 3DACs */ 2178 [ICE_EEP2_SYSCONF] = 0x0a, /* clock 512, spdif-in/ADC, 3DACs */
2179 [ICE_EEP2_ACLINK] = 0x80, /* I2S */ 2179 [ICE_EEP2_ACLINK] = 0x80, /* I2S */
2180 [ICE_EEP2_I2S] = 0xfc, /* vol, 96k, 24bit, 192k */ 2180 [ICE_EEP2_I2S] = 0xfc, /* vol, 96k, 24bit, 192k */
@@ -2190,7 +2190,7 @@ static unsigned char aureon51_eeprom[] __devinitdata = {
2190 [ICE_EEP2_GPIO_STATE2] = 0x00, 2190 [ICE_EEP2_GPIO_STATE2] = 0x00,
2191}; 2191};
2192 2192
2193static unsigned char aureon71_eeprom[] __devinitdata = { 2193static unsigned char aureon71_eeprom[] = {
2194 [ICE_EEP2_SYSCONF] = 0x0b, /* clock 512, spdif-in/ADC, 4DACs */ 2194 [ICE_EEP2_SYSCONF] = 0x0b, /* clock 512, spdif-in/ADC, 4DACs */
2195 [ICE_EEP2_ACLINK] = 0x80, /* I2S */ 2195 [ICE_EEP2_ACLINK] = 0x80, /* I2S */
2196 [ICE_EEP2_I2S] = 0xfc, /* vol, 96k, 24bit, 192k */ 2196 [ICE_EEP2_I2S] = 0xfc, /* vol, 96k, 24bit, 192k */
@@ -2207,7 +2207,7 @@ static unsigned char aureon71_eeprom[] __devinitdata = {
2207}; 2207};
2208#define prodigy71_eeprom aureon71_eeprom 2208#define prodigy71_eeprom aureon71_eeprom
2209 2209
2210static unsigned char aureon71_universe_eeprom[] __devinitdata = { 2210static unsigned char aureon71_universe_eeprom[] = {
2211 [ICE_EEP2_SYSCONF] = 0x2b, /* clock 512, mpu401, spdif-in/ADC, 2211 [ICE_EEP2_SYSCONF] = 0x2b, /* clock 512, mpu401, spdif-in/ADC,
2212 * 4DACs 2212 * 4DACs
2213 */ 2213 */
@@ -2225,7 +2225,7 @@ static unsigned char aureon71_universe_eeprom[] __devinitdata = {
2225 [ICE_EEP2_GPIO_STATE2] = 0x00, 2225 [ICE_EEP2_GPIO_STATE2] = 0x00,
2226}; 2226};
2227 2227
2228static unsigned char prodigy71lt_eeprom[] __devinitdata = { 2228static unsigned char prodigy71lt_eeprom[] = {
2229 [ICE_EEP2_SYSCONF] = 0x4b, /* clock 384, spdif-in/ADC, 4DACs */ 2229 [ICE_EEP2_SYSCONF] = 0x4b, /* clock 384, spdif-in/ADC, 4DACs */
2230 [ICE_EEP2_ACLINK] = 0x80, /* I2S */ 2230 [ICE_EEP2_ACLINK] = 0x80, /* I2S */
2231 [ICE_EEP2_I2S] = 0xfc, /* vol, 96k, 24bit, 192k */ 2231 [ICE_EEP2_I2S] = 0xfc, /* vol, 96k, 24bit, 192k */
@@ -2243,7 +2243,7 @@ static unsigned char prodigy71lt_eeprom[] __devinitdata = {
2243#define prodigy71xt_eeprom prodigy71lt_eeprom 2243#define prodigy71xt_eeprom prodigy71lt_eeprom
2244 2244
2245/* entry point */ 2245/* entry point */
2246struct snd_ice1712_card_info snd_vt1724_aureon_cards[] __devinitdata = { 2246struct snd_ice1712_card_info snd_vt1724_aureon_cards[] = {
2247 { 2247 {
2248 .subvendor = VT1724_SUBDEVICE_AUREON51_SKY, 2248 .subvendor = VT1724_SUBDEVICE_AUREON51_SKY,
2249 .name = "Terratec Aureon 5.1-Sky", 2249 .name = "Terratec Aureon 5.1-Sky",
diff --git a/sound/pci/ice1712/delta.c b/sound/pci/ice1712/delta.c
index 20c6b079d0df..9e28cc12969b 100644
--- a/sound/pci/ice1712/delta.c
+++ b/sound/pci/ice1712/delta.c
@@ -22,7 +22,6 @@
22 * 22 *
23 */ 23 */
24 24
25#include <asm/io.h>
26#include <linux/delay.h> 25#include <linux/delay.h>
27#include <linux/interrupt.h> 26#include <linux/interrupt.h>
28#include <linux/init.h> 27#include <linux/init.h>
@@ -432,7 +431,7 @@ static int snd_ice1712_delta1010lt_wordclock_status_get(struct snd_kcontrol *kco
432 return 0; 431 return 0;
433} 432}
434 433
435static struct snd_kcontrol_new snd_ice1712_delta1010lt_wordclock_status __devinitdata = 434static struct snd_kcontrol_new snd_ice1712_delta1010lt_wordclock_status =
436{ 435{
437 .access = (SNDRV_CTL_ELEM_ACCESS_READ), 436 .access = (SNDRV_CTL_ELEM_ACCESS_READ),
438 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 437 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
@@ -445,7 +444,7 @@ static struct snd_kcontrol_new snd_ice1712_delta1010lt_wordclock_status __devini
445 * initialize the chips on M-Audio cards 444 * initialize the chips on M-Audio cards
446 */ 445 */
447 446
448static struct snd_akm4xxx akm_audiophile __devinitdata = { 447static struct snd_akm4xxx akm_audiophile = {
449 .type = SND_AK4528, 448 .type = SND_AK4528,
450 .num_adcs = 2, 449 .num_adcs = 2,
451 .num_dacs = 2, 450 .num_dacs = 2,
@@ -454,7 +453,7 @@ static struct snd_akm4xxx akm_audiophile __devinitdata = {
454 } 453 }
455}; 454};
456 455
457static struct snd_ak4xxx_private akm_audiophile_priv __devinitdata = { 456static struct snd_ak4xxx_private akm_audiophile_priv = {
458 .caddr = 2, 457 .caddr = 2,
459 .cif = 0, 458 .cif = 0,
460 .data_mask = ICE1712_DELTA_AP_DOUT, 459 .data_mask = ICE1712_DELTA_AP_DOUT,
@@ -466,7 +465,7 @@ static struct snd_ak4xxx_private akm_audiophile_priv __devinitdata = {
466 .mask_flags = 0, 465 .mask_flags = 0,
467}; 466};
468 467
469static struct snd_akm4xxx akm_delta410 __devinitdata = { 468static struct snd_akm4xxx akm_delta410 = {
470 .type = SND_AK4529, 469 .type = SND_AK4529,
471 .num_adcs = 2, 470 .num_adcs = 2,
472 .num_dacs = 8, 471 .num_dacs = 8,
@@ -475,7 +474,7 @@ static struct snd_akm4xxx akm_delta410 __devinitdata = {
475 } 474 }
476}; 475};
477 476
478static struct snd_ak4xxx_private akm_delta410_priv __devinitdata = { 477static struct snd_ak4xxx_private akm_delta410_priv = {
479 .caddr = 0, 478 .caddr = 0,
480 .cif = 0, 479 .cif = 0,
481 .data_mask = ICE1712_DELTA_AP_DOUT, 480 .data_mask = ICE1712_DELTA_AP_DOUT,
@@ -487,7 +486,7 @@ static struct snd_ak4xxx_private akm_delta410_priv __devinitdata = {
487 .mask_flags = 0, 486 .mask_flags = 0,
488}; 487};
489 488
490static struct snd_akm4xxx akm_delta1010lt __devinitdata = { 489static struct snd_akm4xxx akm_delta1010lt = {
491 .type = SND_AK4524, 490 .type = SND_AK4524,
492 .num_adcs = 8, 491 .num_adcs = 8,
493 .num_dacs = 8, 492 .num_dacs = 8,
@@ -497,7 +496,7 @@ static struct snd_akm4xxx akm_delta1010lt __devinitdata = {
497 } 496 }
498}; 497};
499 498
500static struct snd_ak4xxx_private akm_delta1010lt_priv __devinitdata = { 499static struct snd_ak4xxx_private akm_delta1010lt_priv = {
501 .caddr = 2, 500 .caddr = 2,
502 .cif = 0, /* the default level of the CIF pin from AK4524 */ 501 .cif = 0, /* the default level of the CIF pin from AK4524 */
503 .data_mask = ICE1712_DELTA_1010LT_DOUT, 502 .data_mask = ICE1712_DELTA_1010LT_DOUT,
@@ -509,7 +508,7 @@ static struct snd_ak4xxx_private akm_delta1010lt_priv __devinitdata = {
509 .mask_flags = 0, 508 .mask_flags = 0,
510}; 509};
511 510
512static struct snd_akm4xxx akm_delta66e __devinitdata = { 511static struct snd_akm4xxx akm_delta66e = {
513 .type = SND_AK4524, 512 .type = SND_AK4524,
514 .num_adcs = 4, 513 .num_adcs = 4,
515 .num_dacs = 4, 514 .num_dacs = 4,
@@ -519,7 +518,7 @@ static struct snd_akm4xxx akm_delta66e __devinitdata = {
519 } 518 }
520}; 519};
521 520
522static struct snd_ak4xxx_private akm_delta66e_priv __devinitdata = { 521static struct snd_ak4xxx_private akm_delta66e_priv = {
523 .caddr = 2, 522 .caddr = 2,
524 .cif = 0, /* the default level of the CIF pin from AK4524 */ 523 .cif = 0, /* the default level of the CIF pin from AK4524 */
525 .data_mask = ICE1712_DELTA_66E_DOUT, 524 .data_mask = ICE1712_DELTA_66E_DOUT,
@@ -532,7 +531,7 @@ static struct snd_ak4xxx_private akm_delta66e_priv __devinitdata = {
532}; 531};
533 532
534 533
535static struct snd_akm4xxx akm_delta44 __devinitdata = { 534static struct snd_akm4xxx akm_delta44 = {
536 .type = SND_AK4524, 535 .type = SND_AK4524,
537 .num_adcs = 4, 536 .num_adcs = 4,
538 .num_dacs = 4, 537 .num_dacs = 4,
@@ -542,7 +541,7 @@ static struct snd_akm4xxx akm_delta44 __devinitdata = {
542 } 541 }
543}; 542};
544 543
545static struct snd_ak4xxx_private akm_delta44_priv __devinitdata = { 544static struct snd_ak4xxx_private akm_delta44_priv = {
546 .caddr = 2, 545 .caddr = 2,
547 .cif = 0, /* the default level of the CIF pin from AK4524 */ 546 .cif = 0, /* the default level of the CIF pin from AK4524 */
548 .data_mask = ICE1712_DELTA_CODEC_SERIAL_DATA, 547 .data_mask = ICE1712_DELTA_CODEC_SERIAL_DATA,
@@ -554,7 +553,7 @@ static struct snd_ak4xxx_private akm_delta44_priv __devinitdata = {
554 .mask_flags = 0, 553 .mask_flags = 0,
555}; 554};
556 555
557static struct snd_akm4xxx akm_vx442 __devinitdata = { 556static struct snd_akm4xxx akm_vx442 = {
558 .type = SND_AK4524, 557 .type = SND_AK4524,
559 .num_adcs = 4, 558 .num_adcs = 4,
560 .num_dacs = 4, 559 .num_dacs = 4,
@@ -564,7 +563,7 @@ static struct snd_akm4xxx akm_vx442 __devinitdata = {
564 } 563 }
565}; 564};
566 565
567static struct snd_ak4xxx_private akm_vx442_priv __devinitdata = { 566static struct snd_ak4xxx_private akm_vx442_priv = {
568 .caddr = 2, 567 .caddr = 2,
569 .cif = 0, 568 .cif = 0,
570 .data_mask = ICE1712_VX442_DOUT, 569 .data_mask = ICE1712_VX442_DOUT,
@@ -576,7 +575,7 @@ static struct snd_ak4xxx_private akm_vx442_priv __devinitdata = {
576 .mask_flags = 0, 575 .mask_flags = 0,
577}; 576};
578 577
579static int __devinit snd_ice1712_delta_init(struct snd_ice1712 *ice) 578static int snd_ice1712_delta_init(struct snd_ice1712 *ice)
580{ 579{
581 int err; 580 int err;
582 struct snd_akm4xxx *ak; 581 struct snd_akm4xxx *ak;
@@ -617,7 +616,7 @@ static int __devinit snd_ice1712_delta_init(struct snd_ice1712 *ice)
617 ice->num_total_dacs = 4; /* two AK4324 codecs */ 616 ice->num_total_dacs = 4; /* two AK4324 codecs */
618 break; 617 break;
619 case ICE1712_SUBDEVICE_VX442: 618 case ICE1712_SUBDEVICE_VX442:
620 case ICE1712_SUBDEVICE_DELTA66E: /* omni not suported yet */ 619 case ICE1712_SUBDEVICE_DELTA66E: /* omni not supported yet */
621 ice->num_total_dacs = 4; 620 ice->num_total_dacs = 4;
622 ice->num_total_adcs = 4; 621 ice->num_total_adcs = 4;
623 break; 622 break;
@@ -714,19 +713,19 @@ static int __devinit snd_ice1712_delta_init(struct snd_ice1712 *ice)
714 * additional controls for M-Audio cards 713 * additional controls for M-Audio cards
715 */ 714 */
716 715
717static struct snd_kcontrol_new snd_ice1712_delta1010_wordclock_select __devinitdata = 716static struct snd_kcontrol_new snd_ice1712_delta1010_wordclock_select =
718ICE1712_GPIO(SNDRV_CTL_ELEM_IFACE_MIXER, "Word Clock Sync", 0, ICE1712_DELTA_WORD_CLOCK_SELECT, 1, 0); 717ICE1712_GPIO(SNDRV_CTL_ELEM_IFACE_MIXER, "Word Clock Sync", 0, ICE1712_DELTA_WORD_CLOCK_SELECT, 1, 0);
719static struct snd_kcontrol_new snd_ice1712_delta1010lt_wordclock_select __devinitdata = 718static struct snd_kcontrol_new snd_ice1712_delta1010lt_wordclock_select =
720ICE1712_GPIO(SNDRV_CTL_ELEM_IFACE_MIXER, "Word Clock Sync", 0, ICE1712_DELTA_1010LT_WORDCLOCK, 0, 0); 719ICE1712_GPIO(SNDRV_CTL_ELEM_IFACE_MIXER, "Word Clock Sync", 0, ICE1712_DELTA_1010LT_WORDCLOCK, 0, 0);
721static struct snd_kcontrol_new snd_ice1712_delta1010_wordclock_status __devinitdata = 720static struct snd_kcontrol_new snd_ice1712_delta1010_wordclock_status =
722ICE1712_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); 721ICE1712_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);
723static struct snd_kcontrol_new snd_ice1712_deltadio2496_spdif_in_select __devinitdata = 722static struct snd_kcontrol_new snd_ice1712_deltadio2496_spdif_in_select =
724ICE1712_GPIO(SNDRV_CTL_ELEM_IFACE_MIXER, "IEC958 Input Optical", 0, ICE1712_DELTA_SPDIF_INPUT_SELECT, 0, 0); 723ICE1712_GPIO(SNDRV_CTL_ELEM_IFACE_MIXER, "IEC958 Input Optical", 0, ICE1712_DELTA_SPDIF_INPUT_SELECT, 0, 0);
725static struct snd_kcontrol_new snd_ice1712_delta_spdif_in_status __devinitdata = 724static struct snd_kcontrol_new snd_ice1712_delta_spdif_in_status =
726ICE1712_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); 725ICE1712_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);
727 726
728 727
729static int __devinit snd_ice1712_delta_add_controls(struct snd_ice1712 *ice) 728static int snd_ice1712_delta_add_controls(struct snd_ice1712 *ice)
730{ 729{
731 int err; 730 int err;
732 731
@@ -802,7 +801,7 @@ static int __devinit snd_ice1712_delta_add_controls(struct snd_ice1712 *ice)
802 801
803 802
804/* entry point */ 803/* entry point */
805struct snd_ice1712_card_info snd_ice1712_delta_cards[] __devinitdata = { 804struct snd_ice1712_card_info snd_ice1712_delta_cards[] = {
806 { 805 {
807 .subvendor = ICE1712_SUBDEVICE_DELTA1010, 806 .subvendor = ICE1712_SUBDEVICE_DELTA1010,
808 .name = "M Audio Delta 1010", 807 .name = "M Audio Delta 1010",
diff --git a/sound/pci/ice1712/ews.c b/sound/pci/ice1712/ews.c
index 6fe35b812040..bc2e7011c55d 100644
--- a/sound/pci/ice1712/ews.c
+++ b/sound/pci/ice1712/ews.c
@@ -22,7 +22,6 @@
22 * 22 *
23 */ 23 */
24 24
25#include <asm/io.h>
26#include <linux/delay.h> 25#include <linux/delay.h>
27#include <linux/interrupt.h> 26#include <linux/interrupt.h>
28#include <linux/init.h> 27#include <linux/init.h>
@@ -344,7 +343,7 @@ static void ews88_setup_spdif(struct snd_ice1712 *ice, int rate)
344 343
345/* 344/*
346 */ 345 */
347static struct snd_akm4xxx akm_ews88mt __devinitdata = { 346static struct snd_akm4xxx akm_ews88mt = {
348 .num_adcs = 8, 347 .num_adcs = 8,
349 .num_dacs = 8, 348 .num_dacs = 8,
350 .type = SND_AK4524, 349 .type = SND_AK4524,
@@ -354,7 +353,7 @@ static struct snd_akm4xxx akm_ews88mt __devinitdata = {
354 } 353 }
355}; 354};
356 355
357static struct snd_ak4xxx_private akm_ews88mt_priv __devinitdata = { 356static struct snd_ak4xxx_private akm_ews88mt_priv = {
358 .caddr = 2, 357 .caddr = 2,
359 .cif = 1, /* CIF high */ 358 .cif = 1, /* CIF high */
360 .data_mask = ICE1712_EWS88_SERIAL_DATA, 359 .data_mask = ICE1712_EWS88_SERIAL_DATA,
@@ -366,7 +365,7 @@ static struct snd_ak4xxx_private akm_ews88mt_priv __devinitdata = {
366 .mask_flags = 0, 365 .mask_flags = 0,
367}; 366};
368 367
369static struct snd_akm4xxx akm_ewx2496 __devinitdata = { 368static struct snd_akm4xxx akm_ewx2496 = {
370 .num_adcs = 2, 369 .num_adcs = 2,
371 .num_dacs = 2, 370 .num_dacs = 2,
372 .type = SND_AK4524, 371 .type = SND_AK4524,
@@ -375,7 +374,7 @@ static struct snd_akm4xxx akm_ewx2496 __devinitdata = {
375 } 374 }
376}; 375};
377 376
378static struct snd_ak4xxx_private akm_ewx2496_priv __devinitdata = { 377static struct snd_ak4xxx_private akm_ewx2496_priv = {
379 .caddr = 2, 378 .caddr = 2,
380 .cif = 1, /* CIF high */ 379 .cif = 1, /* CIF high */
381 .data_mask = ICE1712_EWS88_SERIAL_DATA, 380 .data_mask = ICE1712_EWS88_SERIAL_DATA,
@@ -387,7 +386,7 @@ static struct snd_ak4xxx_private akm_ewx2496_priv __devinitdata = {
387 .mask_flags = 0, 386 .mask_flags = 0,
388}; 387};
389 388
390static struct snd_akm4xxx akm_6fire __devinitdata = { 389static struct snd_akm4xxx akm_6fire = {
391 .num_adcs = 6, 390 .num_adcs = 6,
392 .num_dacs = 6, 391 .num_dacs = 6,
393 .type = SND_AK4524, 392 .type = SND_AK4524,
@@ -396,7 +395,7 @@ static struct snd_akm4xxx akm_6fire __devinitdata = {
396 } 395 }
397}; 396};
398 397
399static struct snd_ak4xxx_private akm_6fire_priv __devinitdata = { 398static struct snd_ak4xxx_private akm_6fire_priv = {
400 .caddr = 2, 399 .caddr = 2,
401 .cif = 1, /* CIF high */ 400 .cif = 1, /* CIF high */
402 .data_mask = ICE1712_6FIRE_SERIAL_DATA, 401 .data_mask = ICE1712_6FIRE_SERIAL_DATA,
@@ -420,7 +419,7 @@ static struct snd_ak4xxx_private akm_6fire_priv __devinitdata = {
420 419
421static int snd_ice1712_6fire_write_pca(struct snd_ice1712 *ice, unsigned char reg, unsigned char data); 420static int snd_ice1712_6fire_write_pca(struct snd_ice1712 *ice, unsigned char reg, unsigned char data);
422 421
423static int __devinit snd_ice1712_ews_init(struct snd_ice1712 *ice) 422static int snd_ice1712_ews_init(struct snd_ice1712 *ice)
424{ 423{
425 int err; 424 int err;
426 struct snd_akm4xxx *ak; 425 struct snd_akm4xxx *ak;
@@ -576,7 +575,7 @@ static int __devinit snd_ice1712_ews_init(struct snd_ice1712 *ice)
576/* i/o sensitivity - this callback is shared among other devices, too */ 575/* i/o sensitivity - this callback is shared among other devices, too */
577static int snd_ice1712_ewx_io_sense_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo){ 576static int snd_ice1712_ewx_io_sense_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo){
578 577
579 static char *texts[2] = { 578 static const char * const texts[2] = {
580 "+4dBu", "-10dBV", 579 "+4dBu", "-10dBV",
581 }; 580 };
582 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 581 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
@@ -616,7 +615,7 @@ static int snd_ice1712_ewx_io_sense_put(struct snd_kcontrol *kcontrol, struct sn
616 return val != nval; 615 return val != nval;
617} 616}
618 617
619static struct snd_kcontrol_new snd_ice1712_ewx2496_controls[] __devinitdata = { 618static struct snd_kcontrol_new snd_ice1712_ewx2496_controls[] = {
620 { 619 {
621 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 620 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
622 .name = "Input Sensitivity Switch", 621 .name = "Input Sensitivity Switch",
@@ -724,7 +723,7 @@ static int snd_ice1712_ews88mt_input_sense_put(struct snd_kcontrol *kcontrol, st
724 return ndata != data; 723 return ndata != data;
725} 724}
726 725
727static struct snd_kcontrol_new snd_ice1712_ews88mt_input_sense __devinitdata = { 726static struct snd_kcontrol_new snd_ice1712_ews88mt_input_sense = {
728 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 727 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
729 .name = "Input Sensitivity Switch", 728 .name = "Input Sensitivity Switch",
730 .info = snd_ice1712_ewx_io_sense_info, 729 .info = snd_ice1712_ewx_io_sense_info,
@@ -733,7 +732,7 @@ static struct snd_kcontrol_new snd_ice1712_ews88mt_input_sense __devinitdata = {
733 .count = 8, 732 .count = 8,
734}; 733};
735 734
736static struct snd_kcontrol_new snd_ice1712_ews88mt_output_sense __devinitdata = { 735static struct snd_kcontrol_new snd_ice1712_ews88mt_output_sense = {
737 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 736 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
738 .name = "Output Sensitivity Switch", 737 .name = "Output Sensitivity Switch",
739 .info = snd_ice1712_ewx_io_sense_info, 738 .info = snd_ice1712_ewx_io_sense_info,
@@ -811,7 +810,7 @@ static int snd_ice1712_ews88d_control_put(struct snd_kcontrol *kcontrol, struct
811 .private_value = xshift | (xinvert << 8),\ 810 .private_value = xshift | (xinvert << 8),\
812} 811}
813 812
814static struct snd_kcontrol_new snd_ice1712_ews88d_controls[] __devinitdata = { 813static struct snd_kcontrol_new snd_ice1712_ews88d_controls[] = {
815 EWS88D_CONTROL(SNDRV_CTL_ELEM_IFACE_MIXER, "IEC958 Input Optical", 0, 1, 0), /* inverted */ 814 EWS88D_CONTROL(SNDRV_CTL_ELEM_IFACE_MIXER, "IEC958 Input Optical", 0, 1, 0), /* inverted */
816 EWS88D_CONTROL(SNDRV_CTL_ELEM_IFACE_MIXER, "ADAT Output Optical", 1, 0, 0), 815 EWS88D_CONTROL(SNDRV_CTL_ELEM_IFACE_MIXER, "ADAT Output Optical", 1, 0, 0),
817 EWS88D_CONTROL(SNDRV_CTL_ELEM_IFACE_MIXER, "ADAT External Master Clock", 2, 0, 0), 816 EWS88D_CONTROL(SNDRV_CTL_ELEM_IFACE_MIXER, "ADAT External Master Clock", 2, 0, 0),
@@ -899,7 +898,7 @@ static int snd_ice1712_6fire_control_put(struct snd_kcontrol *kcontrol, struct s
899 898
900static int snd_ice1712_6fire_select_input_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) 899static int snd_ice1712_6fire_select_input_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
901{ 900{
902 static char *texts[4] = { 901 static const char * const texts[4] = {
903 "Internal", "Front Input", "Rear Input", "Wave Table" 902 "Internal", "Front Input", "Rear Input", "Wave Table"
904 }; 903 };
905 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 904 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
@@ -948,7 +947,7 @@ static int snd_ice1712_6fire_select_input_put(struct snd_kcontrol *kcontrol, str
948 .private_value = xshift | (xinvert << 8),\ 947 .private_value = xshift | (xinvert << 8),\
949} 948}
950 949
951static struct snd_kcontrol_new snd_ice1712_6fire_controls[] __devinitdata = { 950static struct snd_kcontrol_new snd_ice1712_6fire_controls[] = {
952 { 951 {
953 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 952 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
954 .name = "Analog Input Select", 953 .name = "Analog Input Select",
@@ -964,7 +963,7 @@ static struct snd_kcontrol_new snd_ice1712_6fire_controls[] __devinitdata = {
964}; 963};
965 964
966 965
967static int __devinit snd_ice1712_ews_add_controls(struct snd_ice1712 *ice) 966static int snd_ice1712_ews_add_controls(struct snd_ice1712 *ice)
968{ 967{
969 unsigned int idx; 968 unsigned int idx;
970 int err; 969 int err;
@@ -1030,7 +1029,7 @@ static int __devinit snd_ice1712_ews_add_controls(struct snd_ice1712 *ice)
1030 1029
1031 1030
1032/* entry point */ 1031/* entry point */
1033struct snd_ice1712_card_info snd_ice1712_ews_cards[] __devinitdata = { 1032struct snd_ice1712_card_info snd_ice1712_ews_cards[] = {
1034 { 1033 {
1035 .subvendor = ICE1712_SUBDEVICE_EWX2496, 1034 .subvendor = ICE1712_SUBDEVICE_EWX2496,
1036 .name = "TerraTec EWX24/96", 1035 .name = "TerraTec EWX24/96",
diff --git a/sound/pci/ice1712/hoontech.c b/sound/pci/ice1712/hoontech.c
index 6914189073a4..59e37c581691 100644
--- a/sound/pci/ice1712/hoontech.c
+++ b/sound/pci/ice1712/hoontech.c
@@ -21,7 +21,6 @@
21 * 21 *
22 */ 22 */
23 23
24#include <asm/io.h>
25#include <linux/delay.h> 24#include <linux/delay.h>
26#include <linux/interrupt.h> 25#include <linux/interrupt.h>
27#include <linux/init.h> 26#include <linux/init.h>
@@ -40,7 +39,7 @@ struct hoontech_spec {
40 unsigned short boxconfig[4]; 39 unsigned short boxconfig[4];
41}; 40};
42 41
43static void __devinit snd_ice1712_stdsp24_gpio_write(struct snd_ice1712 *ice, unsigned char byte) 42static void snd_ice1712_stdsp24_gpio_write(struct snd_ice1712 *ice, unsigned char byte)
44{ 43{
45 byte |= ICE1712_STDSP24_CLOCK_BIT; 44 byte |= ICE1712_STDSP24_CLOCK_BIT;
46 udelay(100); 45 udelay(100);
@@ -53,7 +52,7 @@ static void __devinit snd_ice1712_stdsp24_gpio_write(struct snd_ice1712 *ice, un
53 snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, byte); 52 snd_ice1712_write(ice, ICE1712_IREG_GPIO_DATA, byte);
54} 53}
55 54
56static void __devinit snd_ice1712_stdsp24_darear(struct snd_ice1712 *ice, int activate) 55static void snd_ice1712_stdsp24_darear(struct snd_ice1712 *ice, int activate)
57{ 56{
58 struct hoontech_spec *spec = ice->spec; 57 struct hoontech_spec *spec = ice->spec;
59 mutex_lock(&ice->gpio_mutex); 58 mutex_lock(&ice->gpio_mutex);
@@ -62,7 +61,7 @@ static void __devinit snd_ice1712_stdsp24_darear(struct snd_ice1712 *ice, int ac
62 mutex_unlock(&ice->gpio_mutex); 61 mutex_unlock(&ice->gpio_mutex);
63} 62}
64 63
65static void __devinit snd_ice1712_stdsp24_mute(struct snd_ice1712 *ice, int activate) 64static void snd_ice1712_stdsp24_mute(struct snd_ice1712 *ice, int activate)
66{ 65{
67 struct hoontech_spec *spec = ice->spec; 66 struct hoontech_spec *spec = ice->spec;
68 mutex_lock(&ice->gpio_mutex); 67 mutex_lock(&ice->gpio_mutex);
@@ -71,7 +70,7 @@ static void __devinit snd_ice1712_stdsp24_mute(struct snd_ice1712 *ice, int acti
71 mutex_unlock(&ice->gpio_mutex); 70 mutex_unlock(&ice->gpio_mutex);
72} 71}
73 72
74static void __devinit snd_ice1712_stdsp24_insel(struct snd_ice1712 *ice, int activate) 73static void snd_ice1712_stdsp24_insel(struct snd_ice1712 *ice, int activate)
75{ 74{
76 struct hoontech_spec *spec = ice->spec; 75 struct hoontech_spec *spec = ice->spec;
77 mutex_lock(&ice->gpio_mutex); 76 mutex_lock(&ice->gpio_mutex);
@@ -80,7 +79,7 @@ static void __devinit snd_ice1712_stdsp24_insel(struct snd_ice1712 *ice, int act
80 mutex_unlock(&ice->gpio_mutex); 79 mutex_unlock(&ice->gpio_mutex);
81} 80}
82 81
83static void __devinit snd_ice1712_stdsp24_box_channel(struct snd_ice1712 *ice, int box, int chn, int activate) 82static void snd_ice1712_stdsp24_box_channel(struct snd_ice1712 *ice, int box, int chn, int activate)
84{ 83{
85 struct hoontech_spec *spec = ice->spec; 84 struct hoontech_spec *spec = ice->spec;
86 85
@@ -130,7 +129,7 @@ static void __devinit snd_ice1712_stdsp24_box_channel(struct snd_ice1712 *ice, i
130 mutex_unlock(&ice->gpio_mutex); 129 mutex_unlock(&ice->gpio_mutex);
131} 130}
132 131
133static void __devinit snd_ice1712_stdsp24_box_midi(struct snd_ice1712 *ice, int box, int master) 132static void snd_ice1712_stdsp24_box_midi(struct snd_ice1712 *ice, int box, int master)
134{ 133{
135 struct hoontech_spec *spec = ice->spec; 134 struct hoontech_spec *spec = ice->spec;
136 135
@@ -158,7 +157,7 @@ static void __devinit snd_ice1712_stdsp24_box_midi(struct snd_ice1712 *ice, int
158 mutex_unlock(&ice->gpio_mutex); 157 mutex_unlock(&ice->gpio_mutex);
159} 158}
160 159
161static void __devinit snd_ice1712_stdsp24_midi2(struct snd_ice1712 *ice, int activate) 160static void snd_ice1712_stdsp24_midi2(struct snd_ice1712 *ice, int activate)
162{ 161{
163 struct hoontech_spec *spec = ice->spec; 162 struct hoontech_spec *spec = ice->spec;
164 mutex_lock(&ice->gpio_mutex); 163 mutex_lock(&ice->gpio_mutex);
@@ -167,7 +166,7 @@ static void __devinit snd_ice1712_stdsp24_midi2(struct snd_ice1712 *ice, int act
167 mutex_unlock(&ice->gpio_mutex); 166 mutex_unlock(&ice->gpio_mutex);
168} 167}
169 168
170static int __devinit snd_ice1712_hoontech_init(struct snd_ice1712 *ice) 169static int snd_ice1712_hoontech_init(struct snd_ice1712 *ice)
171{ 170{
172 struct hoontech_spec *spec; 171 struct hoontech_spec *spec;
173 int box, chn; 172 int box, chn;
@@ -267,10 +266,10 @@ static void stdsp24_ak4524_lock(struct snd_akm4xxx *ak, int chip)
267 snd_ice1712_write(ice, ICE1712_IREG_GPIO_WRITE_MASK, ~tmp); 266 snd_ice1712_write(ice, ICE1712_IREG_GPIO_WRITE_MASK, ~tmp);
268} 267}
269 268
270static int __devinit snd_ice1712_value_init(struct snd_ice1712 *ice) 269static int snd_ice1712_value_init(struct snd_ice1712 *ice)
271{ 270{
272 /* Hoontech STDSP24 with modified hardware */ 271 /* Hoontech STDSP24 with modified hardware */
273 static struct snd_akm4xxx akm_stdsp24_mv __devinitdata = { 272 static struct snd_akm4xxx akm_stdsp24_mv = {
274 .num_adcs = 2, 273 .num_adcs = 2,
275 .num_dacs = 2, 274 .num_dacs = 2,
276 .type = SND_AK4524, 275 .type = SND_AK4524,
@@ -279,7 +278,7 @@ static int __devinit snd_ice1712_value_init(struct snd_ice1712 *ice)
279 } 278 }
280 }; 279 };
281 280
282 static struct snd_ak4xxx_private akm_stdsp24_mv_priv __devinitdata = { 281 static struct snd_ak4xxx_private akm_stdsp24_mv_priv = {
283 .caddr = 2, 282 .caddr = 2,
284 .cif = 1, /* CIF high */ 283 .cif = 1, /* CIF high */
285 .data_mask = ICE1712_STDSP24_SERIAL_DATA, 284 .data_mask = ICE1712_STDSP24_SERIAL_DATA,
@@ -317,7 +316,7 @@ static int __devinit snd_ice1712_value_init(struct snd_ice1712 *ice)
317 return 0; 316 return 0;
318} 317}
319 318
320static int __devinit snd_ice1712_ez8_init(struct snd_ice1712 *ice) 319static int snd_ice1712_ez8_init(struct snd_ice1712 *ice)
321{ 320{
322 ice->gpio.write_mask = ice->eeprom.gpiomask; 321 ice->gpio.write_mask = ice->eeprom.gpiomask;
323 ice->gpio.direction = ice->eeprom.gpiodir; 322 ice->gpio.direction = ice->eeprom.gpiodir;
@@ -329,7 +328,7 @@ static int __devinit snd_ice1712_ez8_init(struct snd_ice1712 *ice)
329 328
330 329
331/* entry point */ 330/* entry point */
332struct snd_ice1712_card_info snd_ice1712_hoontech_cards[] __devinitdata = { 331struct snd_ice1712_card_info snd_ice1712_hoontech_cards[] = {
333 { 332 {
334 .subvendor = ICE1712_SUBDEVICE_STDSP24, 333 .subvendor = ICE1712_SUBDEVICE_STDSP24,
335 .name = "Hoontech SoundTrack Audio DSP24", 334 .name = "Hoontech SoundTrack Audio DSP24",
diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c
index 5be2e120a14e..2ffdc35d5ffd 100644
--- a/sound/pci/ice1712/ice1712.c
+++ b/sound/pci/ice1712/ice1712.c
@@ -47,7 +47,6 @@
47 */ 47 */
48 48
49 49
50#include <linux/io.h>
51#include <linux/delay.h> 50#include <linux/delay.h>
52#include <linux/interrupt.h> 51#include <linux/interrupt.h>
53#include <linux/init.h> 52#include <linux/init.h>
@@ -280,7 +279,7 @@ static int snd_ice1712_digmix_route_ac97_put(struct snd_kcontrol *kcontrol, stru
280 return val != nval; 279 return val != nval;
281} 280}
282 281
283static struct snd_kcontrol_new snd_ice1712_mixer_digmix_route_ac97 __devinitdata = { 282static struct snd_kcontrol_new snd_ice1712_mixer_digmix_route_ac97 = {
284 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 283 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
285 .name = "Digital Mixer To AC97", 284 .name = "Digital Mixer To AC97",
286 .info = snd_ice1712_digmix_route_ac97_info, 285 .info = snd_ice1712_digmix_route_ac97_info,
@@ -388,7 +387,7 @@ static void setup_cs8427(struct snd_ice1712 *ice, int rate)
388/* 387/*
389 * create and initialize callbacks for cs8427 interface 388 * create and initialize callbacks for cs8427 interface
390 */ 389 */
391int __devinit snd_ice1712_init_cs8427(struct snd_ice1712 *ice, int addr) 390int snd_ice1712_init_cs8427(struct snd_ice1712 *ice, int addr)
392{ 391{
393 int err; 392 int err;
394 393
@@ -879,7 +878,7 @@ static struct snd_pcm_ops snd_ice1712_capture_ops = {
879 .pointer = snd_ice1712_capture_pointer, 878 .pointer = snd_ice1712_capture_pointer,
880}; 879};
881 880
882static int __devinit snd_ice1712_pcm(struct snd_ice1712 *ice, int device, struct snd_pcm **rpcm) 881static int snd_ice1712_pcm(struct snd_ice1712 *ice, int device, struct snd_pcm **rpcm)
883{ 882{
884 struct snd_pcm *pcm; 883 struct snd_pcm *pcm;
885 int err; 884 int err;
@@ -909,7 +908,7 @@ static int __devinit snd_ice1712_pcm(struct snd_ice1712 *ice, int device, struct
909 return 0; 908 return 0;
910} 909}
911 910
912static int __devinit snd_ice1712_pcm_ds(struct snd_ice1712 *ice, int device, struct snd_pcm **rpcm) 911static int snd_ice1712_pcm_ds(struct snd_ice1712 *ice, int device, struct snd_pcm **rpcm)
913{ 912{
914 struct snd_pcm *pcm; 913 struct snd_pcm *pcm;
915 int err; 914 int err;
@@ -1254,7 +1253,7 @@ static struct snd_pcm_ops snd_ice1712_capture_pro_ops = {
1254 .pointer = snd_ice1712_capture_pro_pointer, 1253 .pointer = snd_ice1712_capture_pro_pointer,
1255}; 1254};
1256 1255
1257static int __devinit snd_ice1712_pcm_profi(struct snd_ice1712 *ice, int device, struct snd_pcm **rpcm) 1256static int snd_ice1712_pcm_profi(struct snd_ice1712 *ice, int device, struct snd_pcm **rpcm)
1258{ 1257{
1259 struct snd_pcm *pcm; 1258 struct snd_pcm *pcm;
1260 int err; 1259 int err;
@@ -1388,7 +1387,7 @@ static int snd_ice1712_pro_mixer_volume_put(struct snd_kcontrol *kcontrol, struc
1388 1387
1389static const DECLARE_TLV_DB_SCALE(db_scale_playback, -14400, 150, 0); 1388static const DECLARE_TLV_DB_SCALE(db_scale_playback, -14400, 150, 0);
1390 1389
1391static struct snd_kcontrol_new snd_ice1712_multi_playback_ctrls[] __devinitdata = { 1390static struct snd_kcontrol_new snd_ice1712_multi_playback_ctrls[] = {
1392 { 1391 {
1393 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1392 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1394 .name = "Multi Playback Switch", 1393 .name = "Multi Playback Switch",
@@ -1412,7 +1411,7 @@ static struct snd_kcontrol_new snd_ice1712_multi_playback_ctrls[] __devinitdata
1412 }, 1411 },
1413}; 1412};
1414 1413
1415static struct snd_kcontrol_new snd_ice1712_multi_capture_analog_switch __devinitdata = { 1414static struct snd_kcontrol_new snd_ice1712_multi_capture_analog_switch = {
1416 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1415 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1417 .name = "H/W Multi Capture Switch", 1416 .name = "H/W Multi Capture Switch",
1418 .info = snd_ice1712_pro_mixer_switch_info, 1417 .info = snd_ice1712_pro_mixer_switch_info,
@@ -1421,7 +1420,7 @@ static struct snd_kcontrol_new snd_ice1712_multi_capture_analog_switch __devinit
1421 .private_value = 10, 1420 .private_value = 10,
1422}; 1421};
1423 1422
1424static struct snd_kcontrol_new snd_ice1712_multi_capture_spdif_switch __devinitdata = { 1423static struct snd_kcontrol_new snd_ice1712_multi_capture_spdif_switch = {
1425 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1424 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1426 .name = SNDRV_CTL_NAME_IEC958("Multi ", CAPTURE, SWITCH), 1425 .name = SNDRV_CTL_NAME_IEC958("Multi ", CAPTURE, SWITCH),
1427 .info = snd_ice1712_pro_mixer_switch_info, 1426 .info = snd_ice1712_pro_mixer_switch_info,
@@ -1431,7 +1430,7 @@ static struct snd_kcontrol_new snd_ice1712_multi_capture_spdif_switch __devinitd
1431 .count = 2, 1430 .count = 2,
1432}; 1431};
1433 1432
1434static struct snd_kcontrol_new snd_ice1712_multi_capture_analog_volume __devinitdata = { 1433static struct snd_kcontrol_new snd_ice1712_multi_capture_analog_volume = {
1435 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1434 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1436 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | 1435 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
1437 SNDRV_CTL_ELEM_ACCESS_TLV_READ), 1436 SNDRV_CTL_ELEM_ACCESS_TLV_READ),
@@ -1443,7 +1442,7 @@ static struct snd_kcontrol_new snd_ice1712_multi_capture_analog_volume __devinit
1443 .tlv = { .p = db_scale_playback } 1442 .tlv = { .p = db_scale_playback }
1444}; 1443};
1445 1444
1446static struct snd_kcontrol_new snd_ice1712_multi_capture_spdif_volume __devinitdata = { 1445static struct snd_kcontrol_new snd_ice1712_multi_capture_spdif_volume = {
1447 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1446 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1448 .name = SNDRV_CTL_NAME_IEC958("Multi ", CAPTURE, VOLUME), 1447 .name = SNDRV_CTL_NAME_IEC958("Multi ", CAPTURE, VOLUME),
1449 .info = snd_ice1712_pro_mixer_volume_info, 1448 .info = snd_ice1712_pro_mixer_volume_info,
@@ -1453,7 +1452,7 @@ static struct snd_kcontrol_new snd_ice1712_multi_capture_spdif_volume __devinitd
1453 .count = 2, 1452 .count = 2,
1454}; 1453};
1455 1454
1456static int __devinit snd_ice1712_build_pro_mixer(struct snd_ice1712 *ice) 1455static int snd_ice1712_build_pro_mixer(struct snd_ice1712 *ice)
1457{ 1456{
1458 struct snd_card *card = ice->card; 1457 struct snd_card *card = ice->card;
1459 unsigned int idx; 1458 unsigned int idx;
@@ -1512,7 +1511,7 @@ static void snd_ice1712_mixer_free_ac97(struct snd_ac97 *ac97)
1512 ice->ac97 = NULL; 1511 ice->ac97 = NULL;
1513} 1512}
1514 1513
1515static int __devinit snd_ice1712_ac97_mixer(struct snd_ice1712 *ice) 1514static int snd_ice1712_ac97_mixer(struct snd_ice1712 *ice)
1516{ 1515{
1517 int err, bus_num = 0; 1516 int err, bus_num = 0;
1518 struct snd_ac97_template ac97; 1517 struct snd_ac97_template ac97;
@@ -1611,7 +1610,7 @@ static void snd_ice1712_proc_read(struct snd_info_entry *entry,
1611 snd_iprintf(buffer, " GPIO_DIRECTION : 0x%02x\n", (unsigned)snd_ice1712_read(ice, ICE1712_IREG_GPIO_DIRECTION)); 1610 snd_iprintf(buffer, " GPIO_DIRECTION : 0x%02x\n", (unsigned)snd_ice1712_read(ice, ICE1712_IREG_GPIO_DIRECTION));
1612} 1611}
1613 1612
1614static void __devinit snd_ice1712_proc_init(struct snd_ice1712 *ice) 1613static void snd_ice1712_proc_init(struct snd_ice1712 *ice)
1615{ 1614{
1616 struct snd_info_entry *entry; 1615 struct snd_info_entry *entry;
1617 1616
@@ -1640,7 +1639,7 @@ static int snd_ice1712_eeprom_get(struct snd_kcontrol *kcontrol,
1640 return 0; 1639 return 0;
1641} 1640}
1642 1641
1643static struct snd_kcontrol_new snd_ice1712_eeprom __devinitdata = { 1642static struct snd_kcontrol_new snd_ice1712_eeprom = {
1644 .iface = SNDRV_CTL_ELEM_IFACE_CARD, 1643 .iface = SNDRV_CTL_ELEM_IFACE_CARD,
1645 .name = "ICE1712 EEPROM", 1644 .name = "ICE1712 EEPROM",
1646 .access = SNDRV_CTL_ELEM_ACCESS_READ, 1645 .access = SNDRV_CTL_ELEM_ACCESS_READ,
@@ -1676,7 +1675,7 @@ static int snd_ice1712_spdif_default_put(struct snd_kcontrol *kcontrol,
1676 return 0; 1675 return 0;
1677} 1676}
1678 1677
1679static struct snd_kcontrol_new snd_ice1712_spdif_default __devinitdata = 1678static struct snd_kcontrol_new snd_ice1712_spdif_default =
1680{ 1679{
1681 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 1680 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
1682 .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, DEFAULT), 1681 .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, DEFAULT),
@@ -1727,7 +1726,7 @@ static int snd_ice1712_spdif_maskp_get(struct snd_kcontrol *kcontrol,
1727 return 0; 1726 return 0;
1728} 1727}
1729 1728
1730static struct snd_kcontrol_new snd_ice1712_spdif_maskc __devinitdata = 1729static struct snd_kcontrol_new snd_ice1712_spdif_maskc =
1731{ 1730{
1732 .access = SNDRV_CTL_ELEM_ACCESS_READ, 1731 .access = SNDRV_CTL_ELEM_ACCESS_READ,
1733 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 1732 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
@@ -1736,7 +1735,7 @@ static struct snd_kcontrol_new snd_ice1712_spdif_maskc __devinitdata =
1736 .get = snd_ice1712_spdif_maskc_get, 1735 .get = snd_ice1712_spdif_maskc_get,
1737}; 1736};
1738 1737
1739static struct snd_kcontrol_new snd_ice1712_spdif_maskp __devinitdata = 1738static struct snd_kcontrol_new snd_ice1712_spdif_maskp =
1740{ 1739{
1741 .access = SNDRV_CTL_ELEM_ACCESS_READ, 1740 .access = SNDRV_CTL_ELEM_ACCESS_READ,
1742 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 1741 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
@@ -1763,7 +1762,7 @@ static int snd_ice1712_spdif_stream_put(struct snd_kcontrol *kcontrol,
1763 return 0; 1762 return 0;
1764} 1763}
1765 1764
1766static struct snd_kcontrol_new snd_ice1712_spdif_stream __devinitdata = 1765static struct snd_kcontrol_new snd_ice1712_spdif_stream =
1767{ 1766{
1768 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | 1767 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
1769 SNDRV_CTL_ELEM_ACCESS_INACTIVE), 1768 SNDRV_CTL_ELEM_ACCESS_INACTIVE),
@@ -1894,7 +1893,7 @@ static int snd_ice1712_pro_internal_clock_put(struct snd_kcontrol *kcontrol,
1894 return change; 1893 return change;
1895} 1894}
1896 1895
1897static struct snd_kcontrol_new snd_ice1712_pro_internal_clock __devinitdata = { 1896static struct snd_kcontrol_new snd_ice1712_pro_internal_clock = {
1898 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1897 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1899 .name = "Multi Track Internal Clock", 1898 .name = "Multi Track Internal Clock",
1900 .info = snd_ice1712_pro_internal_clock_info, 1899 .info = snd_ice1712_pro_internal_clock_info,
@@ -1965,7 +1964,7 @@ static int snd_ice1712_pro_internal_clock_default_put(struct snd_kcontrol *kcont
1965 return change; 1964 return change;
1966} 1965}
1967 1966
1968static struct snd_kcontrol_new snd_ice1712_pro_internal_clock_default __devinitdata = { 1967static struct snd_kcontrol_new snd_ice1712_pro_internal_clock_default = {
1969 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1968 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1970 .name = "Multi Track Internal Clock Default", 1969 .name = "Multi Track Internal Clock Default",
1971 .info = snd_ice1712_pro_internal_clock_default_info, 1970 .info = snd_ice1712_pro_internal_clock_default_info,
@@ -1996,7 +1995,7 @@ static int snd_ice1712_pro_rate_locking_put(struct snd_kcontrol *kcontrol,
1996 return change; 1995 return change;
1997} 1996}
1998 1997
1999static struct snd_kcontrol_new snd_ice1712_pro_rate_locking __devinitdata = { 1998static struct snd_kcontrol_new snd_ice1712_pro_rate_locking = {
2000 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1999 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2001 .name = "Multi Track Rate Locking", 2000 .name = "Multi Track Rate Locking",
2002 .info = snd_ice1712_pro_rate_locking_info, 2001 .info = snd_ice1712_pro_rate_locking_info,
@@ -2027,7 +2026,7 @@ static int snd_ice1712_pro_rate_reset_put(struct snd_kcontrol *kcontrol,
2027 return change; 2026 return change;
2028} 2027}
2029 2028
2030static struct snd_kcontrol_new snd_ice1712_pro_rate_reset __devinitdata = { 2029static struct snd_kcontrol_new snd_ice1712_pro_rate_reset = {
2031 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2030 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2032 .name = "Multi Track Rate Reset", 2031 .name = "Multi Track Rate Reset",
2033 .info = snd_ice1712_pro_rate_reset_info, 2032 .info = snd_ice1712_pro_rate_reset_info,
@@ -2194,7 +2193,7 @@ static int snd_ice1712_pro_route_spdif_put(struct snd_kcontrol *kcontrol,
2194 return change; 2193 return change;
2195} 2194}
2196 2195
2197static struct snd_kcontrol_new snd_ice1712_mixer_pro_analog_route __devinitdata = { 2196static struct snd_kcontrol_new snd_ice1712_mixer_pro_analog_route = {
2198 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2197 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2199 .name = "H/W Playback Route", 2198 .name = "H/W Playback Route",
2200 .info = snd_ice1712_pro_route_info, 2199 .info = snd_ice1712_pro_route_info,
@@ -2202,7 +2201,7 @@ static struct snd_kcontrol_new snd_ice1712_mixer_pro_analog_route __devinitdata
2202 .put = snd_ice1712_pro_route_analog_put, 2201 .put = snd_ice1712_pro_route_analog_put,
2203}; 2202};
2204 2203
2205static struct snd_kcontrol_new snd_ice1712_mixer_pro_spdif_route __devinitdata = { 2204static struct snd_kcontrol_new snd_ice1712_mixer_pro_spdif_route = {
2206 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2205 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2207 .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, NONE) "Route", 2206 .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, NONE) "Route",
2208 .info = snd_ice1712_pro_route_info, 2207 .info = snd_ice1712_pro_route_info,
@@ -2244,7 +2243,7 @@ static int snd_ice1712_pro_volume_rate_put(struct snd_kcontrol *kcontrol,
2244 return change; 2243 return change;
2245} 2244}
2246 2245
2247static struct snd_kcontrol_new snd_ice1712_mixer_pro_volume_rate __devinitdata = { 2246static struct snd_kcontrol_new snd_ice1712_mixer_pro_volume_rate = {
2248 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2247 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2249 .name = "Multi Track Volume Rate", 2248 .name = "Multi Track Volume Rate",
2250 .info = snd_ice1712_pro_volume_rate_info, 2249 .info = snd_ice1712_pro_volume_rate_info,
@@ -2277,7 +2276,7 @@ static int snd_ice1712_pro_peak_get(struct snd_kcontrol *kcontrol,
2277 return 0; 2276 return 0;
2278} 2277}
2279 2278
2280static struct snd_kcontrol_new snd_ice1712_mixer_pro_peak __devinitdata = { 2279static struct snd_kcontrol_new snd_ice1712_mixer_pro_peak = {
2281 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 2280 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
2282 .name = "Multi Track Peak", 2281 .name = "Multi Track Peak",
2283 .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, 2282 .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE,
@@ -2292,16 +2291,16 @@ static struct snd_kcontrol_new snd_ice1712_mixer_pro_peak __devinitdata = {
2292/* 2291/*
2293 * list of available boards 2292 * list of available boards
2294 */ 2293 */
2295static struct snd_ice1712_card_info *card_tables[] __devinitdata = { 2294static struct snd_ice1712_card_info *card_tables[] = {
2296 snd_ice1712_hoontech_cards, 2295 snd_ice1712_hoontech_cards,
2297 snd_ice1712_delta_cards, 2296 snd_ice1712_delta_cards,
2298 snd_ice1712_ews_cards, 2297 snd_ice1712_ews_cards,
2299 NULL, 2298 NULL,
2300}; 2299};
2301 2300
2302static unsigned char __devinit snd_ice1712_read_i2c(struct snd_ice1712 *ice, 2301static unsigned char snd_ice1712_read_i2c(struct snd_ice1712 *ice,
2303 unsigned char dev, 2302 unsigned char dev,
2304 unsigned char addr) 2303 unsigned char addr)
2305{ 2304{
2306 long t = 0x10000; 2305 long t = 0x10000;
2307 2306
@@ -2311,8 +2310,8 @@ static unsigned char __devinit snd_ice1712_read_i2c(struct snd_ice1712 *ice,
2311 return inb(ICEREG(ice, I2C_DATA)); 2310 return inb(ICEREG(ice, I2C_DATA));
2312} 2311}
2313 2312
2314static int __devinit snd_ice1712_read_eeprom(struct snd_ice1712 *ice, 2313static int snd_ice1712_read_eeprom(struct snd_ice1712 *ice,
2315 const char *modelname) 2314 const char *modelname)
2316{ 2315{
2317 int dev = 0xa0; /* EEPROM device address */ 2316 int dev = 0xa0; /* EEPROM device address */
2318 unsigned int i, size; 2317 unsigned int i, size;
@@ -2386,7 +2385,7 @@ static int __devinit snd_ice1712_read_eeprom(struct snd_ice1712 *ice,
2386 2385
2387 2386
2388 2387
2389static int __devinit snd_ice1712_chip_init(struct snd_ice1712 *ice) 2388static int snd_ice1712_chip_init(struct snd_ice1712 *ice)
2390{ 2389{
2391 outb(ICE1712_RESET | ICE1712_NATIVE, ICEREG(ice, CONTROL)); 2390 outb(ICE1712_RESET | ICE1712_NATIVE, ICEREG(ice, CONTROL));
2392 udelay(200); 2391 udelay(200);
@@ -2433,7 +2432,7 @@ static int __devinit snd_ice1712_chip_init(struct snd_ice1712 *ice)
2433 return 0; 2432 return 0;
2434} 2433}
2435 2434
2436int __devinit snd_ice1712_spdif_build_controls(struct snd_ice1712 *ice) 2435int snd_ice1712_spdif_build_controls(struct snd_ice1712 *ice)
2437{ 2436{
2438 int err; 2437 int err;
2439 struct snd_kcontrol *kctl; 2438 struct snd_kcontrol *kctl;
@@ -2461,7 +2460,7 @@ int __devinit snd_ice1712_spdif_build_controls(struct snd_ice1712 *ice)
2461} 2460}
2462 2461
2463 2462
2464static int __devinit snd_ice1712_build_controls(struct snd_ice1712 *ice) 2463static int snd_ice1712_build_controls(struct snd_ice1712 *ice)
2465{ 2464{
2466 int err; 2465 int err;
2467 2466
@@ -2531,13 +2530,13 @@ static int snd_ice1712_dev_free(struct snd_device *device)
2531 return snd_ice1712_free(ice); 2530 return snd_ice1712_free(ice);
2532} 2531}
2533 2532
2534static int __devinit snd_ice1712_create(struct snd_card *card, 2533static int snd_ice1712_create(struct snd_card *card,
2535 struct pci_dev *pci, 2534 struct pci_dev *pci,
2536 const char *modelname, 2535 const char *modelname,
2537 int omni, 2536 int omni,
2538 int cs8427_timeout, 2537 int cs8427_timeout,
2539 int dxr_enable, 2538 int dxr_enable,
2540 struct snd_ice1712 **r_ice1712) 2539 struct snd_ice1712 **r_ice1712)
2541{ 2540{
2542 struct snd_ice1712 *ice; 2541 struct snd_ice1712 *ice;
2543 int err; 2542 int err;
@@ -2651,10 +2650,10 @@ static int __devinit snd_ice1712_create(struct snd_card *card,
2651 * 2650 *
2652 */ 2651 */
2653 2652
2654static struct snd_ice1712_card_info no_matched __devinitdata; 2653static struct snd_ice1712_card_info no_matched;
2655 2654
2656static int __devinit snd_ice1712_probe(struct pci_dev *pci, 2655static int snd_ice1712_probe(struct pci_dev *pci,
2657 const struct pci_device_id *pci_id) 2656 const struct pci_device_id *pci_id)
2658{ 2657{
2659 static int dev; 2658 static int dev;
2660 struct snd_card *card; 2659 struct snd_card *card;
@@ -2686,6 +2685,7 @@ static int __devinit snd_ice1712_probe(struct pci_dev *pci,
2686 for (tbl = card_tables; *tbl; tbl++) { 2685 for (tbl = card_tables; *tbl; tbl++) {
2687 for (c = *tbl; c->subvendor; c++) { 2686 for (c = *tbl; c->subvendor; c++) {
2688 if (c->subvendor == ice->eeprom.subvendor) { 2687 if (c->subvendor == ice->eeprom.subvendor) {
2688 ice->card_info = c;
2689 strcpy(card->shortname, c->name); 2689 strcpy(card->shortname, c->name);
2690 if (c->driver) /* specific driver? */ 2690 if (c->driver) /* specific driver? */
2691 strcpy(card->driver, c->driver); 2691 strcpy(card->driver, c->driver);
@@ -2797,9 +2797,14 @@ static int __devinit snd_ice1712_probe(struct pci_dev *pci,
2797 return 0; 2797 return 0;
2798} 2798}
2799 2799
2800static void __devexit snd_ice1712_remove(struct pci_dev *pci) 2800static void snd_ice1712_remove(struct pci_dev *pci)
2801{ 2801{
2802 snd_card_free(pci_get_drvdata(pci)); 2802 struct snd_card *card = pci_get_drvdata(pci);
2803 struct snd_ice1712 *ice = card->private_data;
2804
2805 if (ice->card_info && ice->card_info->chip_exit)
2806 ice->card_info->chip_exit(ice);
2807 snd_card_free(card);
2803 pci_set_drvdata(pci, NULL); 2808 pci_set_drvdata(pci, NULL);
2804} 2809}
2805 2810
@@ -2807,7 +2812,7 @@ static struct pci_driver ice1712_driver = {
2807 .name = KBUILD_MODNAME, 2812 .name = KBUILD_MODNAME,
2808 .id_table = snd_ice1712_ids, 2813 .id_table = snd_ice1712_ids,
2809 .probe = snd_ice1712_probe, 2814 .probe = snd_ice1712_probe,
2810 .remove = __devexit_p(snd_ice1712_remove), 2815 .remove = snd_ice1712_remove,
2811}; 2816};
2812 2817
2813module_pci_driver(ice1712_driver); 2818module_pci_driver(ice1712_driver);
diff --git a/sound/pci/ice1712/ice1712.h b/sound/pci/ice1712/ice1712.h
index d0e7d87f09f0..b209fc30b334 100644
--- a/sound/pci/ice1712/ice1712.h
+++ b/sound/pci/ice1712/ice1712.h
@@ -22,6 +22,7 @@
22 * 22 *
23 */ 23 */
24 24
25#include <linux/io.h>
25#include <sound/control.h> 26#include <sound/control.h>
26#include <sound/ac97_codec.h> 27#include <sound/ac97_codec.h>
27#include <sound/rawmidi.h> 28#include <sound/rawmidi.h>
@@ -288,6 +289,7 @@ struct snd_ice1712_spdif {
288 } ops; 289 } ops;
289}; 290};
290 291
292struct snd_ice1712_card_info;
291 293
292struct snd_ice1712 { 294struct snd_ice1712 {
293 unsigned long conp_dma_size; 295 unsigned long conp_dma_size;
@@ -324,6 +326,7 @@ struct snd_ice1712 {
324 struct snd_info_entry *proc_entry; 326 struct snd_info_entry *proc_entry;
325 327
326 struct snd_ice1712_eeprom eeprom; 328 struct snd_ice1712_eeprom eeprom;
329 struct snd_ice1712_card_info *card_info;
327 330
328 unsigned int pro_volumes[20]; 331 unsigned int pro_volumes[20];
329 unsigned int omni:1; /* Delta Omni I/O */ 332 unsigned int omni:1; /* Delta Omni I/O */
@@ -381,7 +384,7 @@ struct snd_ice1712 {
381 unsigned char (*set_mclk)(struct snd_ice1712 *ice, unsigned int rate); 384 unsigned char (*set_mclk)(struct snd_ice1712 *ice, unsigned int rate);
382 int (*set_spdif_clock)(struct snd_ice1712 *ice, int type); 385 int (*set_spdif_clock)(struct snd_ice1712 *ice, int type);
383 int (*get_spdif_master_type)(struct snd_ice1712 *ice); 386 int (*get_spdif_master_type)(struct snd_ice1712 *ice);
384 char **ext_clock_names; 387 const char * const *ext_clock_names;
385 int ext_clock_count; 388 int ext_clock_count;
386 void (*pro_open)(struct snd_ice1712 *, struct snd_pcm_substream *); 389 void (*pro_open)(struct snd_ice1712 *, struct snd_pcm_substream *);
387#ifdef CONFIG_PM_SLEEP 390#ifdef CONFIG_PM_SLEEP
@@ -513,10 +516,11 @@ static inline u8 snd_ice1712_read(struct snd_ice1712 *ice, u8 addr)
513 516
514struct snd_ice1712_card_info { 517struct snd_ice1712_card_info {
515 unsigned int subvendor; 518 unsigned int subvendor;
516 char *name; 519 const char *name;
517 char *model; 520 const char *model;
518 char *driver; 521 const char *driver;
519 int (*chip_init)(struct snd_ice1712 *); 522 int (*chip_init)(struct snd_ice1712 *);
523 void (*chip_exit)(struct snd_ice1712 *);
520 int (*build_controls)(struct snd_ice1712 *); 524 int (*build_controls)(struct snd_ice1712 *);
521 unsigned int no_mpu401:1; 525 unsigned int no_mpu401:1;
522 unsigned int mpu401_1_info_flags; 526 unsigned int mpu401_1_info_flags;
diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c
index 245d874891ba..ce70e7f113e0 100644
--- a/sound/pci/ice1712/ice1724.c
+++ b/sound/pci/ice1712/ice1724.c
@@ -22,7 +22,6 @@
22 * 22 *
23 */ 23 */
24 24
25#include <linux/io.h>
26#include <linux/delay.h> 25#include <linux/delay.h>
27#include <linux/interrupt.h> 26#include <linux/interrupt.h>
28#include <linux/init.h> 27#include <linux/init.h>
@@ -54,6 +53,7 @@
54#include "wtm.h" 53#include "wtm.h"
55#include "se.h" 54#include "se.h"
56#include "quartet.h" 55#include "quartet.h"
56#include "psc724.h"
57 57
58MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); 58MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>");
59MODULE_DESCRIPTION("VIA ICEnsemble ICE1724/1720 (Envy24HT/PT)"); 59MODULE_DESCRIPTION("VIA ICEnsemble ICE1724/1720 (Envy24HT/PT)");
@@ -106,7 +106,7 @@ static int PRO_RATE_LOCKED;
106static int PRO_RATE_RESET = 1; 106static int PRO_RATE_RESET = 1;
107static unsigned int PRO_RATE_DEFAULT = 44100; 107static unsigned int PRO_RATE_DEFAULT = 44100;
108 108
109static char *ext_clock_names[1] = { "IEC958 In" }; 109static const char * const ext_clock_names[1] = { "IEC958 In" };
110 110
111/* 111/*
112 * Basic I/O 112 * Basic I/O
@@ -1135,7 +1135,7 @@ static struct snd_pcm_ops snd_vt1724_capture_pro_ops = {
1135 .pointer = snd_vt1724_pcm_pointer, 1135 .pointer = snd_vt1724_pcm_pointer,
1136}; 1136};
1137 1137
1138static int __devinit snd_vt1724_pcm_profi(struct snd_ice1712 *ice, int device) 1138static int snd_vt1724_pcm_profi(struct snd_ice1712 *ice, int device)
1139{ 1139{
1140 struct snd_pcm *pcm; 1140 struct snd_pcm *pcm;
1141 int capt, err; 1141 int capt, err;
@@ -1315,7 +1315,7 @@ static struct snd_pcm_ops snd_vt1724_capture_spdif_ops = {
1315}; 1315};
1316 1316
1317 1317
1318static int __devinit snd_vt1724_pcm_spdif(struct snd_ice1712 *ice, int device) 1318static int snd_vt1724_pcm_spdif(struct snd_ice1712 *ice, int device)
1319{ 1319{
1320 char *name; 1320 char *name;
1321 struct snd_pcm *pcm; 1321 struct snd_pcm *pcm;
@@ -1449,7 +1449,7 @@ static struct snd_pcm_ops snd_vt1724_playback_indep_ops = {
1449}; 1449};
1450 1450
1451 1451
1452static int __devinit snd_vt1724_pcm_indep(struct snd_ice1712 *ice, int device) 1452static int snd_vt1724_pcm_indep(struct snd_ice1712 *ice, int device)
1453{ 1453{
1454 struct snd_pcm *pcm; 1454 struct snd_pcm *pcm;
1455 int play; 1455 int play;
@@ -1484,7 +1484,7 @@ static int __devinit snd_vt1724_pcm_indep(struct snd_ice1712 *ice, int device)
1484 * Mixer section 1484 * Mixer section
1485 */ 1485 */
1486 1486
1487static int __devinit snd_vt1724_ac97_mixer(struct snd_ice1712 *ice) 1487static int snd_vt1724_ac97_mixer(struct snd_ice1712 *ice)
1488{ 1488{
1489 int err; 1489 int err;
1490 1490
@@ -1570,7 +1570,7 @@ static void snd_vt1724_proc_read(struct snd_info_entry *entry,
1570 idx, inb(ice->profi_port+idx)); 1570 idx, inb(ice->profi_port+idx));
1571} 1571}
1572 1572
1573static void __devinit snd_vt1724_proc_init(struct snd_ice1712 *ice) 1573static void snd_vt1724_proc_init(struct snd_ice1712 *ice)
1574{ 1574{
1575 struct snd_info_entry *entry; 1575 struct snd_info_entry *entry;
1576 1576
@@ -1599,7 +1599,7 @@ static int snd_vt1724_eeprom_get(struct snd_kcontrol *kcontrol,
1599 return 0; 1599 return 0;
1600} 1600}
1601 1601
1602static struct snd_kcontrol_new snd_vt1724_eeprom __devinitdata = { 1602static struct snd_kcontrol_new snd_vt1724_eeprom = {
1603 .iface = SNDRV_CTL_ELEM_IFACE_CARD, 1603 .iface = SNDRV_CTL_ELEM_IFACE_CARD,
1604 .name = "ICE1724 EEPROM", 1604 .name = "ICE1724 EEPROM",
1605 .access = SNDRV_CTL_ELEM_ACCESS_READ, 1605 .access = SNDRV_CTL_ELEM_ACCESS_READ,
@@ -1712,7 +1712,7 @@ static int snd_vt1724_spdif_default_put(struct snd_kcontrol *kcontrol,
1712 return val != old; 1712 return val != old;
1713} 1713}
1714 1714
1715static struct snd_kcontrol_new snd_vt1724_spdif_default __devinitdata = 1715static struct snd_kcontrol_new snd_vt1724_spdif_default =
1716{ 1716{
1717 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 1717 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
1718 .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, DEFAULT), 1718 .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, DEFAULT),
@@ -1744,7 +1744,7 @@ static int snd_vt1724_spdif_maskp_get(struct snd_kcontrol *kcontrol,
1744 return 0; 1744 return 0;
1745} 1745}
1746 1746
1747static struct snd_kcontrol_new snd_vt1724_spdif_maskc __devinitdata = 1747static struct snd_kcontrol_new snd_vt1724_spdif_maskc =
1748{ 1748{
1749 .access = SNDRV_CTL_ELEM_ACCESS_READ, 1749 .access = SNDRV_CTL_ELEM_ACCESS_READ,
1750 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 1750 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
@@ -1753,7 +1753,7 @@ static struct snd_kcontrol_new snd_vt1724_spdif_maskc __devinitdata =
1753 .get = snd_vt1724_spdif_maskc_get, 1753 .get = snd_vt1724_spdif_maskc_get,
1754}; 1754};
1755 1755
1756static struct snd_kcontrol_new snd_vt1724_spdif_maskp __devinitdata = 1756static struct snd_kcontrol_new snd_vt1724_spdif_maskp =
1757{ 1757{
1758 .access = SNDRV_CTL_ELEM_ACCESS_READ, 1758 .access = SNDRV_CTL_ELEM_ACCESS_READ,
1759 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 1759 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
@@ -1790,7 +1790,7 @@ static int snd_vt1724_spdif_sw_put(struct snd_kcontrol *kcontrol,
1790 return old != val; 1790 return old != val;
1791} 1791}
1792 1792
1793static struct snd_kcontrol_new snd_vt1724_spdif_switch __devinitdata = 1793static struct snd_kcontrol_new snd_vt1724_spdif_switch =
1794{ 1794{
1795 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1795 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1796 /* FIXME: the following conflict with IEC958 Playback Route */ 1796 /* FIXME: the following conflict with IEC958 Playback Route */
@@ -1965,7 +1965,7 @@ static int snd_vt1724_pro_internal_clock_put(struct snd_kcontrol *kcontrol,
1965 return old_rate != new_rate; 1965 return old_rate != new_rate;
1966} 1966}
1967 1967
1968static struct snd_kcontrol_new snd_vt1724_pro_internal_clock __devinitdata = { 1968static struct snd_kcontrol_new snd_vt1724_pro_internal_clock = {
1969 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1969 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1970 .name = "Multi Track Internal Clock", 1970 .name = "Multi Track Internal Clock",
1971 .info = snd_vt1724_pro_internal_clock_info, 1971 .info = snd_vt1724_pro_internal_clock_info,
@@ -1996,7 +1996,7 @@ static int snd_vt1724_pro_rate_locking_put(struct snd_kcontrol *kcontrol,
1996 return change; 1996 return change;
1997} 1997}
1998 1998
1999static struct snd_kcontrol_new snd_vt1724_pro_rate_locking __devinitdata = { 1999static struct snd_kcontrol_new snd_vt1724_pro_rate_locking = {
2000 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2000 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2001 .name = "Multi Track Rate Locking", 2001 .name = "Multi Track Rate Locking",
2002 .info = snd_vt1724_pro_rate_locking_info, 2002 .info = snd_vt1724_pro_rate_locking_info,
@@ -2027,7 +2027,7 @@ static int snd_vt1724_pro_rate_reset_put(struct snd_kcontrol *kcontrol,
2027 return change; 2027 return change;
2028} 2028}
2029 2029
2030static struct snd_kcontrol_new snd_vt1724_pro_rate_reset __devinitdata = { 2030static struct snd_kcontrol_new snd_vt1724_pro_rate_reset = {
2031 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2031 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2032 .name = "Multi Track Rate Reset", 2032 .name = "Multi Track Rate Reset",
2033 .info = snd_vt1724_pro_rate_reset_info, 2033 .info = snd_vt1724_pro_rate_reset_info,
@@ -2042,7 +2042,7 @@ static struct snd_kcontrol_new snd_vt1724_pro_rate_reset __devinitdata = {
2042static int snd_vt1724_pro_route_info(struct snd_kcontrol *kcontrol, 2042static int snd_vt1724_pro_route_info(struct snd_kcontrol *kcontrol,
2043 struct snd_ctl_elem_info *uinfo) 2043 struct snd_ctl_elem_info *uinfo)
2044{ 2044{
2045 static char *texts[] = { 2045 static const char * const texts[] = {
2046 "PCM Out", /* 0 */ 2046 "PCM Out", /* 0 */
2047 "H/W In 0", "H/W In 1", /* 1-2 */ 2047 "H/W In 0", "H/W In 1", /* 1-2 */
2048 "IEC958 In L", "IEC958 In R", /* 3-4 */ 2048 "IEC958 In L", "IEC958 In R", /* 3-4 */
@@ -2149,7 +2149,7 @@ static int snd_vt1724_pro_route_spdif_put(struct snd_kcontrol *kcontrol,
2149 digital_route_shift(idx)); 2149 digital_route_shift(idx));
2150} 2150}
2151 2151
2152static struct snd_kcontrol_new snd_vt1724_mixer_pro_analog_route __devinitdata = 2152static struct snd_kcontrol_new snd_vt1724_mixer_pro_analog_route =
2153{ 2153{
2154 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2154 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2155 .name = "H/W Playback Route", 2155 .name = "H/W Playback Route",
@@ -2158,7 +2158,7 @@ static struct snd_kcontrol_new snd_vt1724_mixer_pro_analog_route __devinitdata =
2158 .put = snd_vt1724_pro_route_analog_put, 2158 .put = snd_vt1724_pro_route_analog_put,
2159}; 2159};
2160 2160
2161static struct snd_kcontrol_new snd_vt1724_mixer_pro_spdif_route __devinitdata = { 2161static struct snd_kcontrol_new snd_vt1724_mixer_pro_spdif_route = {
2162 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2162 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2163 .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, NONE) "Route", 2163 .name = SNDRV_CTL_NAME_IEC958("", PLAYBACK, NONE) "Route",
2164 .info = snd_vt1724_pro_route_info, 2164 .info = snd_vt1724_pro_route_info,
@@ -2194,7 +2194,7 @@ static int snd_vt1724_pro_peak_get(struct snd_kcontrol *kcontrol,
2194 return 0; 2194 return 0;
2195} 2195}
2196 2196
2197static struct snd_kcontrol_new snd_vt1724_mixer_pro_peak __devinitdata = { 2197static struct snd_kcontrol_new snd_vt1724_mixer_pro_peak = {
2198 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 2198 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
2199 .name = "Multi Track Peak", 2199 .name = "Multi Track Peak",
2200 .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE, 2200 .access = SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE,
@@ -2206,13 +2206,13 @@ static struct snd_kcontrol_new snd_vt1724_mixer_pro_peak __devinitdata = {
2206 * 2206 *
2207 */ 2207 */
2208 2208
2209static struct snd_ice1712_card_info no_matched __devinitdata; 2209static struct snd_ice1712_card_info no_matched;
2210 2210
2211 2211
2212/* 2212/*
2213 ooAoo cards with no controls 2213 ooAoo cards with no controls
2214*/ 2214*/
2215static unsigned char ooaoo_sq210_eeprom[] __devinitdata = { 2215static unsigned char ooaoo_sq210_eeprom[] = {
2216 [ICE_EEP2_SYSCONF] = 0x4c, /* 49MHz crystal, no mpu401, no ADC, 2216 [ICE_EEP2_SYSCONF] = 0x4c, /* 49MHz crystal, no mpu401, no ADC,
2217 1xDACs */ 2217 1xDACs */
2218 [ICE_EEP2_ACLINK] = 0x80, /* I2S */ 2218 [ICE_EEP2_ACLINK] = 0x80, /* I2S */
@@ -2232,7 +2232,7 @@ static unsigned char ooaoo_sq210_eeprom[] __devinitdata = {
2232}; 2232};
2233 2233
2234 2234
2235struct snd_ice1712_card_info snd_vt1724_ooaoo_cards[] __devinitdata = { 2235static struct snd_ice1712_card_info snd_vt1724_ooaoo_cards[] = {
2236 { 2236 {
2237 .name = "ooAoo SQ210a", 2237 .name = "ooAoo SQ210a",
2238 .model = "sq210a", 2238 .model = "sq210a",
@@ -2242,7 +2242,7 @@ struct snd_ice1712_card_info snd_vt1724_ooaoo_cards[] __devinitdata = {
2242 { } /* terminator */ 2242 { } /* terminator */
2243}; 2243};
2244 2244
2245static struct snd_ice1712_card_info *card_tables[] __devinitdata = { 2245static struct snd_ice1712_card_info *card_tables[] = {
2246 snd_vt1724_revo_cards, 2246 snd_vt1724_revo_cards,
2247 snd_vt1724_amp_cards, 2247 snd_vt1724_amp_cards,
2248 snd_vt1724_aureon_cards, 2248 snd_vt1724_aureon_cards,
@@ -2257,6 +2257,7 @@ static struct snd_ice1712_card_info *card_tables[] __devinitdata = {
2257 snd_vt1724_se_cards, 2257 snd_vt1724_se_cards,
2258 snd_vt1724_qtet_cards, 2258 snd_vt1724_qtet_cards,
2259 snd_vt1724_ooaoo_cards, 2259 snd_vt1724_ooaoo_cards,
2260 snd_vt1724_psc724_cards,
2260 NULL, 2261 NULL,
2261}; 2262};
2262 2263
@@ -2306,8 +2307,8 @@ void snd_vt1724_write_i2c(struct snd_ice1712 *ice,
2306 mutex_unlock(&ice->i2c_mutex); 2307 mutex_unlock(&ice->i2c_mutex);
2307} 2308}
2308 2309
2309static int __devinit snd_vt1724_read_eeprom(struct snd_ice1712 *ice, 2310static int snd_vt1724_read_eeprom(struct snd_ice1712 *ice,
2310 const char *modelname) 2311 const char *modelname)
2311{ 2312{
2312 const int dev = 0xa0; /* EEPROM device address */ 2313 const int dev = 0xa0; /* EEPROM device address */
2313 unsigned int i, size; 2314 unsigned int i, size;
@@ -2348,6 +2349,7 @@ static int __devinit snd_vt1724_read_eeprom(struct snd_ice1712 *ice,
2348 ice->eeprom.subvendor = c->subvendor; 2349 ice->eeprom.subvendor = c->subvendor;
2349 } else if (c->subvendor != ice->eeprom.subvendor) 2350 } else if (c->subvendor != ice->eeprom.subvendor)
2350 continue; 2351 continue;
2352 ice->card_info = c;
2351 if (!c->eeprom_size || !c->eeprom_data) 2353 if (!c->eeprom_size || !c->eeprom_data)
2352 goto found; 2354 goto found;
2353 /* if the EEPROM is given by the driver, use it */ 2355 /* if the EEPROM is given by the driver, use it */
@@ -2360,6 +2362,10 @@ static int __devinit snd_vt1724_read_eeprom(struct snd_ice1712 *ice,
2360 } 2362 }
2361 printk(KERN_WARNING "ice1724: No matching model found for ID 0x%x\n", 2363 printk(KERN_WARNING "ice1724: No matching model found for ID 0x%x\n",
2362 ice->eeprom.subvendor); 2364 ice->eeprom.subvendor);
2365#ifdef CONFIG_PM_SLEEP
2366 /* assume AC97-only card which can suspend without additional code */
2367 ice->pm_suspend_enabled = 1;
2368#endif
2363 2369
2364 found: 2370 found:
2365 ice->eeprom.size = snd_vt1724_read_i2c(ice, dev, 0x04); 2371 ice->eeprom.size = snd_vt1724_read_i2c(ice, dev, 0x04);
@@ -2371,7 +2377,7 @@ static int __devinit snd_vt1724_read_eeprom(struct snd_ice1712 *ice,
2371 return -EIO; 2377 return -EIO;
2372 } 2378 }
2373 ice->eeprom.version = snd_vt1724_read_i2c(ice, dev, 0x05); 2379 ice->eeprom.version = snd_vt1724_read_i2c(ice, dev, 0x05);
2374 if (ice->eeprom.version != 2) 2380 if (ice->eeprom.version != 1 && ice->eeprom.version != 2)
2375 printk(KERN_WARNING "ice1724: Invalid EEPROM version %i\n", 2381 printk(KERN_WARNING "ice1724: Invalid EEPROM version %i\n",
2376 ice->eeprom.version); 2382 ice->eeprom.version);
2377 size = ice->eeprom.size - 6; 2383 size = ice->eeprom.size - 6;
@@ -2424,7 +2430,7 @@ static int snd_vt1724_chip_init(struct snd_ice1712 *ice)
2424 return 0; 2430 return 0;
2425} 2431}
2426 2432
2427static int __devinit snd_vt1724_spdif_build_controls(struct snd_ice1712 *ice) 2433static int snd_vt1724_spdif_build_controls(struct snd_ice1712 *ice)
2428{ 2434{
2429 int err; 2435 int err;
2430 struct snd_kcontrol *kctl; 2436 struct snd_kcontrol *kctl;
@@ -2466,7 +2472,7 @@ static int __devinit snd_vt1724_spdif_build_controls(struct snd_ice1712 *ice)
2466} 2472}
2467 2473
2468 2474
2469static int __devinit snd_vt1724_build_controls(struct snd_ice1712 *ice) 2475static int snd_vt1724_build_controls(struct snd_ice1712 *ice)
2470{ 2476{
2471 int err; 2477 int err;
2472 2478
@@ -2526,10 +2532,10 @@ static int snd_vt1724_dev_free(struct snd_device *device)
2526 return snd_vt1724_free(ice); 2532 return snd_vt1724_free(ice);
2527} 2533}
2528 2534
2529static int __devinit snd_vt1724_create(struct snd_card *card, 2535static int snd_vt1724_create(struct snd_card *card,
2530 struct pci_dev *pci, 2536 struct pci_dev *pci,
2531 const char *modelname, 2537 const char *modelname,
2532 struct snd_ice1712 **r_ice1712) 2538 struct snd_ice1712 **r_ice1712)
2533{ 2539{
2534 struct snd_ice1712 *ice; 2540 struct snd_ice1712 *ice;
2535 int err; 2541 int err;
@@ -2616,8 +2622,8 @@ static int __devinit snd_vt1724_create(struct snd_card *card,
2616 * 2622 *
2617 */ 2623 */
2618 2624
2619static int __devinit snd_vt1724_probe(struct pci_dev *pci, 2625static int snd_vt1724_probe(struct pci_dev *pci,
2620 const struct pci_device_id *pci_id) 2626 const struct pci_device_id *pci_id)
2621{ 2627{
2622 static int dev; 2628 static int dev;
2623 struct snd_card *card; 2629 struct snd_card *card;
@@ -2786,9 +2792,14 @@ __found:
2786 return 0; 2792 return 0;
2787} 2793}
2788 2794
2789static void __devexit snd_vt1724_remove(struct pci_dev *pci) 2795static void snd_vt1724_remove(struct pci_dev *pci)
2790{ 2796{
2791 snd_card_free(pci_get_drvdata(pci)); 2797 struct snd_card *card = pci_get_drvdata(pci);
2798 struct snd_ice1712 *ice = card->private_data;
2799
2800 if (ice->card_info && ice->card_info->chip_exit)
2801 ice->card_info->chip_exit(ice);
2802 snd_card_free(card);
2792 pci_set_drvdata(pci, NULL); 2803 pci_set_drvdata(pci, NULL);
2793} 2804}
2794 2805
@@ -2889,7 +2900,7 @@ static struct pci_driver vt1724_driver = {
2889 .name = KBUILD_MODNAME, 2900 .name = KBUILD_MODNAME,
2890 .id_table = snd_vt1724_ids, 2901 .id_table = snd_vt1724_ids,
2891 .probe = snd_vt1724_probe, 2902 .probe = snd_vt1724_probe,
2892 .remove = __devexit_p(snd_vt1724_remove), 2903 .remove = snd_vt1724_remove,
2893 .driver = { 2904 .driver = {
2894 .pm = SND_VT1724_PM_OPS, 2905 .pm = SND_VT1724_PM_OPS,
2895 }, 2906 },
diff --git a/sound/pci/ice1712/juli.c b/sound/pci/ice1712/juli.c
index 14fd536b6452..8855933e710d 100644
--- a/sound/pci/ice1712/juli.c
+++ b/sound/pci/ice1712/juli.c
@@ -23,7 +23,6 @@
23 * 23 *
24 */ 24 */
25 25
26#include <asm/io.h>
27#include <linux/delay.h> 26#include <linux/delay.h>
28#include <linux/interrupt.h> 27#include <linux/interrupt.h>
29#include <linux/init.h> 28#include <linux/init.h>
@@ -283,7 +282,7 @@ static const struct snd_akm4xxx_dac_channel juli_dac[] = {
283}; 282};
284 283
285 284
286static struct snd_akm4xxx akm_juli_dac __devinitdata = { 285static struct snd_akm4xxx akm_juli_dac = {
287 .type = SND_AK4358, 286 .type = SND_AK4358,
288 .num_dacs = 8, /* DAC1 - analog out 287 .num_dacs = 8, /* DAC1 - analog out
289 DAC2 - analog in monitor 288 DAC2 - analog in monitor
@@ -358,7 +357,7 @@ static int juli_mute_put(struct snd_kcontrol *kcontrol,
358 return 0; 357 return 0;
359} 358}
360 359
361static struct snd_kcontrol_new juli_mute_controls[] __devinitdata = { 360static struct snd_kcontrol_new juli_mute_controls[] = {
362 { 361 {
363 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 362 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
364 .name = "Master Playback Switch", 363 .name = "Master Playback Switch",
@@ -412,7 +411,7 @@ static struct snd_kcontrol_new juli_mute_controls[] __devinitdata = {
412 }, 411 },
413}; 412};
414 413
415static char *slave_vols[] __devinitdata = { 414static char *slave_vols[] = {
416 PCM_VOLUME, 415 PCM_VOLUME,
417 MONITOR_AN_IN_VOLUME, 416 MONITOR_AN_IN_VOLUME,
418 MONITOR_DIG_IN_VOLUME, 417 MONITOR_DIG_IN_VOLUME,
@@ -420,11 +419,11 @@ static char *slave_vols[] __devinitdata = {
420 NULL 419 NULL
421}; 420};
422 421
423static __devinitdata 422static
424DECLARE_TLV_DB_SCALE(juli_master_db_scale, -6350, 50, 1); 423DECLARE_TLV_DB_SCALE(juli_master_db_scale, -6350, 50, 1);
425 424
426static struct snd_kcontrol __devinit *ctl_find(struct snd_card *card, 425static struct snd_kcontrol *ctl_find(struct snd_card *card,
427 const char *name) 426 const char *name)
428{ 427{
429 struct snd_ctl_elem_id sid; 428 struct snd_ctl_elem_id sid;
430 memset(&sid, 0, sizeof(sid)); 429 memset(&sid, 0, sizeof(sid));
@@ -434,8 +433,9 @@ static struct snd_kcontrol __devinit *ctl_find(struct snd_card *card,
434 return snd_ctl_find_id(card, &sid); 433 return snd_ctl_find_id(card, &sid);
435} 434}
436 435
437static void __devinit add_slaves(struct snd_card *card, 436static void add_slaves(struct snd_card *card,
438 struct snd_kcontrol *master, char **list) 437 struct snd_kcontrol *master,
438 char * const *list)
439{ 439{
440 for (; *list; list++) { 440 for (; *list; list++) {
441 struct snd_kcontrol *slave = ctl_find(card, *list); 441 struct snd_kcontrol *slave = ctl_find(card, *list);
@@ -447,7 +447,7 @@ static void __devinit add_slaves(struct snd_card *card,
447 } 447 }
448} 448}
449 449
450static int __devinit juli_add_controls(struct snd_ice1712 *ice) 450static int juli_add_controls(struct snd_ice1712 *ice)
451{ 451{
452 struct juli_spec *spec = ice->spec; 452 struct juli_spec *spec = ice->spec;
453 int err; 453 int err;
@@ -579,7 +579,7 @@ static void juli_ak4114_change(struct ak4114 *ak4114, unsigned char c0,
579 } 579 }
580} 580}
581 581
582static int __devinit juli_init(struct snd_ice1712 *ice) 582static int juli_init(struct snd_ice1712 *ice)
583{ 583{
584 static const unsigned char ak4114_init_vals[] = { 584 static const unsigned char ak4114_init_vals[] = {
585 /* AK4117_REG_PWRDN */ AK4114_RST | AK4114_PWN | 585 /* AK4117_REG_PWRDN */ AK4114_RST | AK4114_PWN |
@@ -667,7 +667,7 @@ static int __devinit juli_init(struct snd_ice1712 *ice)
667 * hence the driver needs to sets up it properly. 667 * hence the driver needs to sets up it properly.
668 */ 668 */
669 669
670static unsigned char juli_eeprom[] __devinitdata = { 670static unsigned char juli_eeprom[] = {
671 [ICE_EEP2_SYSCONF] = 0x2b, /* clock 512, mpu401, 1xADC, 1xDACs, 671 [ICE_EEP2_SYSCONF] = 0x2b, /* clock 512, mpu401, 1xADC, 1xDACs,
672 SPDIF in */ 672 SPDIF in */
673 [ICE_EEP2_ACLINK] = 0x80, /* I2S */ 673 [ICE_EEP2_ACLINK] = 0x80, /* I2S */
@@ -686,7 +686,7 @@ static unsigned char juli_eeprom[] __devinitdata = {
686}; 686};
687 687
688/* entry point */ 688/* entry point */
689struct snd_ice1712_card_info snd_vt1724_juli_cards[] __devinitdata = { 689struct snd_ice1712_card_info snd_vt1724_juli_cards[] = {
690 { 690 {
691 .subvendor = VT1724_SUBDEVICE_JULI, 691 .subvendor = VT1724_SUBDEVICE_JULI,
692 .name = "ESI Juli@", 692 .name = "ESI Juli@",
diff --git a/sound/pci/ice1712/maya44.c b/sound/pci/ice1712/maya44.c
index 726fd4b92e19..63aa39f06f02 100644
--- a/sound/pci/ice1712/maya44.c
+++ b/sound/pci/ice1712/maya44.c
@@ -24,7 +24,6 @@
24 24
25#include <linux/init.h> 25#include <linux/init.h>
26#include <linux/slab.h> 26#include <linux/slab.h>
27#include <linux/io.h>
28#include <sound/core.h> 27#include <sound/core.h>
29#include <sound/control.h> 28#include <sound/control.h>
30#include <sound/pcm.h> 29#include <sound/pcm.h>
@@ -358,7 +357,7 @@ static void wm8776_select_input(struct snd_maya44 *chip, int idx, int line)
358static int maya_rec_src_info(struct snd_kcontrol *kcontrol, 357static int maya_rec_src_info(struct snd_kcontrol *kcontrol,
359 struct snd_ctl_elem_info *uinfo) 358 struct snd_ctl_elem_info *uinfo)
360{ 359{
361 static char *texts[] = { "Line", "Mic" }; 360 static const char * const texts[] = { "Line", "Mic" };
362 361
363 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 362 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
364 uinfo->count = 1; 363 uinfo->count = 1;
@@ -407,7 +406,7 @@ static int maya_rec_src_put(struct snd_kcontrol *kcontrol,
407static int maya_pb_route_info(struct snd_kcontrol *kcontrol, 406static int maya_pb_route_info(struct snd_kcontrol *kcontrol,
408 struct snd_ctl_elem_info *uinfo) 407 struct snd_ctl_elem_info *uinfo)
409{ 408{
410 static char *texts[] = { 409 static const char * const texts[] = {
411 "PCM Out", /* 0 */ 410 "PCM Out", /* 0 */
412 "Input 1", "Input 2", "Input 3", "Input 4" 411 "Input 1", "Input 2", "Input 3", "Input 4"
413 }; 412 };
@@ -455,7 +454,7 @@ static int maya_pb_route_put(struct snd_kcontrol *kcontrol,
455 * controls to be added 454 * controls to be added
456 */ 455 */
457 456
458static struct snd_kcontrol_new maya_controls[] __devinitdata = { 457static struct snd_kcontrol_new maya_controls[] = {
459 { 458 {
460 .name = "Crossmix Playback Volume", 459 .name = "Crossmix Playback Volume",
461 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 460 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
@@ -545,7 +544,7 @@ static struct snd_kcontrol_new maya_controls[] __devinitdata = {
545 }, 544 },
546}; 545};
547 546
548static int __devinit maya44_add_controls(struct snd_ice1712 *ice) 547static int maya44_add_controls(struct snd_ice1712 *ice)
549{ 548{
550 int err, i; 549 int err, i;
551 550
@@ -562,8 +561,8 @@ static int __devinit maya44_add_controls(struct snd_ice1712 *ice)
562/* 561/*
563 * initialize a wm8776 chip 562 * initialize a wm8776 chip
564 */ 563 */
565static void __devinit wm8776_init(struct snd_ice1712 *ice, 564static void wm8776_init(struct snd_ice1712 *ice,
566 struct snd_wm8776 *wm, unsigned int addr) 565 struct snd_wm8776 *wm, unsigned int addr)
567{ 566{
568 static const unsigned short inits_wm8776[] = { 567 static const unsigned short inits_wm8776[] = {
569 0x02, 0x100, /* R2: headphone L+R muted + update */ 568 0x02, 0x100, /* R2: headphone L+R muted + update */
@@ -693,14 +692,14 @@ static struct snd_pcm_hw_constraint_list dac_rates = {
693/* 692/*
694 * chip addresses on I2C bus 693 * chip addresses on I2C bus
695 */ 694 */
696static unsigned char wm8776_addr[2] __devinitdata = { 695static unsigned char wm8776_addr[2] = {
697 0x34, 0x36, /* codec 0 & 1 */ 696 0x34, 0x36, /* codec 0 & 1 */
698}; 697};
699 698
700/* 699/*
701 * initialize the chip 700 * initialize the chip
702 */ 701 */
703static int __devinit maya44_init(struct snd_ice1712 *ice) 702static int maya44_init(struct snd_ice1712 *ice)
704{ 703{
705 int i; 704 int i;
706 struct snd_maya44 *chip; 705 struct snd_maya44 *chip;
@@ -743,7 +742,7 @@ static int __devinit maya44_init(struct snd_ice1712 *ice)
743 * hence the driver needs to sets up it properly. 742 * hence the driver needs to sets up it properly.
744 */ 743 */
745 744
746static unsigned char maya44_eeprom[] __devinitdata = { 745static unsigned char maya44_eeprom[] = {
747 [ICE_EEP2_SYSCONF] = 0x45, 746 [ICE_EEP2_SYSCONF] = 0x45,
748 /* clock xin1=49.152MHz, mpu401, 2 stereo ADCs+DACs */ 747 /* clock xin1=49.152MHz, mpu401, 2 stereo ADCs+DACs */
749 [ICE_EEP2_ACLINK] = 0x80, 748 [ICE_EEP2_ACLINK] = 0x80,
@@ -765,7 +764,7 @@ static unsigned char maya44_eeprom[] __devinitdata = {
765}; 764};
766 765
767/* entry point */ 766/* entry point */
768struct snd_ice1712_card_info snd_vt1724_maya44_cards[] __devinitdata = { 767struct snd_ice1712_card_info snd_vt1724_maya44_cards[] = {
769 { 768 {
770 .subvendor = VT1724_SUBDEVICE_MAYA44, 769 .subvendor = VT1724_SUBDEVICE_MAYA44,
771 .name = "ESI Maya44", 770 .name = "ESI Maya44",
diff --git a/sound/pci/ice1712/phase.c b/sound/pci/ice1712/phase.c
index de29be8c9657..0011e04f36a2 100644
--- a/sound/pci/ice1712/phase.c
+++ b/sound/pci/ice1712/phase.c
@@ -42,7 +42,6 @@
42 * Digital receiver: CS8414-CS (supported in this release) 42 * Digital receiver: CS8414-CS (supported in this release)
43 */ 43 */
44 44
45#include <asm/io.h>
46#include <linux/delay.h> 45#include <linux/delay.h>
47#include <linux/interrupt.h> 46#include <linux/interrupt.h>
48#include <linux/init.h> 47#include <linux/init.h>
@@ -103,13 +102,13 @@ static const unsigned char wm_vol[256] = {
103#define WM_VOL_MAX (sizeof(wm_vol) - 1) 102#define WM_VOL_MAX (sizeof(wm_vol) - 1)
104#define WM_VOL_MUTE 0x8000 103#define WM_VOL_MUTE 0x8000
105 104
106static struct snd_akm4xxx akm_phase22 __devinitdata = { 105static struct snd_akm4xxx akm_phase22 = {
107 .type = SND_AK4524, 106 .type = SND_AK4524,
108 .num_dacs = 2, 107 .num_dacs = 2,
109 .num_adcs = 2, 108 .num_adcs = 2,
110}; 109};
111 110
112static struct snd_ak4xxx_private akm_phase22_priv __devinitdata = { 111static struct snd_ak4xxx_private akm_phase22_priv = {
113 .caddr = 2, 112 .caddr = 2,
114 .cif = 1, 113 .cif = 1,
115 .data_mask = 1 << 4, 114 .data_mask = 1 << 4,
@@ -121,7 +120,7 @@ static struct snd_ak4xxx_private akm_phase22_priv __devinitdata = {
121 .mask_flags = 0, 120 .mask_flags = 0,
122}; 121};
123 122
124static int __devinit phase22_init(struct snd_ice1712 *ice) 123static int phase22_init(struct snd_ice1712 *ice)
125{ 124{
126 struct snd_akm4xxx *ak; 125 struct snd_akm4xxx *ak;
127 int err; 126 int err;
@@ -158,7 +157,7 @@ static int __devinit phase22_init(struct snd_ice1712 *ice)
158 return 0; 157 return 0;
159} 158}
160 159
161static int __devinit phase22_add_controls(struct snd_ice1712 *ice) 160static int phase22_add_controls(struct snd_ice1712 *ice)
162{ 161{
163 int err = 0; 162 int err = 0;
164 163
@@ -172,7 +171,7 @@ static int __devinit phase22_add_controls(struct snd_ice1712 *ice)
172 return 0; 171 return 0;
173} 172}
174 173
175static unsigned char phase22_eeprom[] __devinitdata = { 174static unsigned char phase22_eeprom[] = {
176 [ICE_EEP2_SYSCONF] = 0x28, /* clock 512, mpu 401, 175 [ICE_EEP2_SYSCONF] = 0x28, /* clock 512, mpu 401,
177 spdif-in/1xADC, 1xDACs */ 176 spdif-in/1xADC, 1xDACs */
178 [ICE_EEP2_ACLINK] = 0x80, /* I2S */ 177 [ICE_EEP2_ACLINK] = 0x80, /* I2S */
@@ -189,7 +188,7 @@ static unsigned char phase22_eeprom[] __devinitdata = {
189 [ICE_EEP2_GPIO_STATE2] = 0x00, 188 [ICE_EEP2_GPIO_STATE2] = 0x00,
190}; 189};
191 190
192static unsigned char phase28_eeprom[] __devinitdata = { 191static unsigned char phase28_eeprom[] = {
193 [ICE_EEP2_SYSCONF] = 0x2b, /* clock 512, mpu401, 192 [ICE_EEP2_SYSCONF] = 0x2b, /* clock 512, mpu401,
194 spdif-in/1xADC, 4xDACs */ 193 spdif-in/1xADC, 4xDACs */
195 [ICE_EEP2_ACLINK] = 0x80, /* I2S */ 194 [ICE_EEP2_ACLINK] = 0x80, /* I2S */
@@ -379,7 +378,7 @@ static int wm_master_vol_put(struct snd_kcontrol *kcontrol,
379 return change; 378 return change;
380} 379}
381 380
382static int __devinit phase28_init(struct snd_ice1712 *ice) 381static int phase28_init(struct snd_ice1712 *ice)
383{ 382{
384 static const unsigned short wm_inits_phase28[] = { 383 static const unsigned short wm_inits_phase28[] = {
385 /* These come first to reduce init pop noise */ 384 /* These come first to reduce init pop noise */
@@ -722,7 +721,7 @@ static int phase28_deemp_put(struct snd_kcontrol *kcontrol,
722static int phase28_oversampling_info(struct snd_kcontrol *k, 721static int phase28_oversampling_info(struct snd_kcontrol *k,
723 struct snd_ctl_elem_info *uinfo) 722 struct snd_ctl_elem_info *uinfo)
724{ 723{
725 static char *texts[2] = { "128x", "64x" }; 724 static const char * const texts[2] = { "128x", "64x" };
726 725
727 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 726 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
728 uinfo->count = 1; 727 uinfo->count = 1;
@@ -770,7 +769,7 @@ static int phase28_oversampling_put(struct snd_kcontrol *kcontrol,
770static const DECLARE_TLV_DB_SCALE(db_scale_wm_dac, -12700, 100, 1); 769static const DECLARE_TLV_DB_SCALE(db_scale_wm_dac, -12700, 100, 1);
771static const DECLARE_TLV_DB_SCALE(db_scale_wm_pcm, -6400, 50, 1); 770static const DECLARE_TLV_DB_SCALE(db_scale_wm_pcm, -6400, 50, 1);
772 771
773static struct snd_kcontrol_new phase28_dac_controls[] __devinitdata = { 772static struct snd_kcontrol_new phase28_dac_controls[] = {
774 { 773 {
775 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 774 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
776 .name = "Master Playback Switch", 775 .name = "Master Playback Switch",
@@ -885,7 +884,7 @@ static struct snd_kcontrol_new phase28_dac_controls[] __devinitdata = {
885 } 884 }
886}; 885};
887 886
888static struct snd_kcontrol_new wm_controls[] __devinitdata = { 887static struct snd_kcontrol_new wm_controls[] = {
889 { 888 {
890 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 889 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
891 .name = "PCM Playback Switch", 890 .name = "PCM Playback Switch",
@@ -919,7 +918,7 @@ static struct snd_kcontrol_new wm_controls[] __devinitdata = {
919 } 918 }
920}; 919};
921 920
922static int __devinit phase28_add_controls(struct snd_ice1712 *ice) 921static int phase28_add_controls(struct snd_ice1712 *ice)
923{ 922{
924 unsigned int i, counts; 923 unsigned int i, counts;
925 int err; 924 int err;
@@ -943,7 +942,7 @@ static int __devinit phase28_add_controls(struct snd_ice1712 *ice)
943 return 0; 942 return 0;
944} 943}
945 944
946struct snd_ice1712_card_info snd_vt1724_phase_cards[] __devinitdata = { 945struct snd_ice1712_card_info snd_vt1724_phase_cards[] = {
947 { 946 {
948 .subvendor = VT1724_SUBDEVICE_PHASE22, 947 .subvendor = VT1724_SUBDEVICE_PHASE22,
949 .name = "Terratec PHASE 22", 948 .name = "Terratec PHASE 22",
diff --git a/sound/pci/ice1712/pontis.c b/sound/pci/ice1712/pontis.c
index 92c1160d7ab5..5555eb4b2400 100644
--- a/sound/pci/ice1712/pontis.c
+++ b/sound/pci/ice1712/pontis.c
@@ -21,7 +21,6 @@
21 * 21 *
22 */ 22 */
23 23
24#include <asm/io.h>
25#include <linux/delay.h> 24#include <linux/delay.h>
26#include <linux/interrupt.h> 25#include <linux/interrupt.h>
27#include <linux/init.h> 26#include <linux/init.h>
@@ -550,7 +549,7 @@ static const DECLARE_TLV_DB_SCALE(db_scale_volume, -6400, 50, 1);
550 * mixers 549 * mixers
551 */ 550 */
552 551
553static struct snd_kcontrol_new pontis_controls[] __devinitdata = { 552static struct snd_kcontrol_new pontis_controls[] = {
554 { 553 {
555 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 554 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
556 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | 555 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
@@ -697,7 +696,7 @@ static void cs_proc_init(struct snd_ice1712 *ice)
697} 696}
698 697
699 698
700static int __devinit pontis_add_controls(struct snd_ice1712 *ice) 699static int pontis_add_controls(struct snd_ice1712 *ice)
701{ 700{
702 unsigned int i; 701 unsigned int i;
703 int err; 702 int err;
@@ -718,7 +717,7 @@ static int __devinit pontis_add_controls(struct snd_ice1712 *ice)
718/* 717/*
719 * initialize the chip 718 * initialize the chip
720 */ 719 */
721static int __devinit pontis_init(struct snd_ice1712 *ice) 720static int pontis_init(struct snd_ice1712 *ice)
722{ 721{
723 static const unsigned short wm_inits[] = { 722 static const unsigned short wm_inits[] = {
724 /* These come first to reduce init pop noise */ 723 /* These come first to reduce init pop noise */
@@ -805,7 +804,7 @@ static int __devinit pontis_init(struct snd_ice1712 *ice)
805 * hence the driver needs to sets up it properly. 804 * hence the driver needs to sets up it properly.
806 */ 805 */
807 806
808static unsigned char pontis_eeprom[] __devinitdata = { 807static unsigned char pontis_eeprom[] = {
809 [ICE_EEP2_SYSCONF] = 0x08, /* clock 256, mpu401, spdif-in/ADC, 1DAC */ 808 [ICE_EEP2_SYSCONF] = 0x08, /* clock 256, mpu401, spdif-in/ADC, 1DAC */
810 [ICE_EEP2_ACLINK] = 0x80, /* I2S */ 809 [ICE_EEP2_ACLINK] = 0x80, /* I2S */
811 [ICE_EEP2_I2S] = 0xf8, /* vol, 96k, 24bit, 192k */ 810 [ICE_EEP2_I2S] = 0xf8, /* vol, 96k, 24bit, 192k */
@@ -822,7 +821,7 @@ static unsigned char pontis_eeprom[] __devinitdata = {
822}; 821};
823 822
824/* entry point */ 823/* entry point */
825struct snd_ice1712_card_info snd_vt1720_pontis_cards[] __devinitdata = { 824struct snd_ice1712_card_info snd_vt1720_pontis_cards[] = {
826 { 825 {
827 .subvendor = VT1720_SUBDEVICE_PONTIS_MS300, 826 .subvendor = VT1720_SUBDEVICE_PONTIS_MS300,
828 .name = "Pontis MS300", 827 .name = "Pontis MS300",
diff --git a/sound/pci/ice1712/prodigy192.c b/sound/pci/ice1712/prodigy192.c
index e36ddb94c382..e610339f7601 100644
--- a/sound/pci/ice1712/prodigy192.c
+++ b/sound/pci/ice1712/prodigy192.c
@@ -54,7 +54,6 @@
54 * 54 *
55 */ 55 */
56 56
57#include <asm/io.h>
58#include <linux/delay.h> 57#include <linux/delay.h>
59#include <linux/interrupt.h> 58#include <linux/interrupt.h>
60#include <linux/init.h> 59#include <linux/init.h>
@@ -283,7 +282,7 @@ static int stac9460_adc_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_el
283static int stac9460_mic_sw_info(struct snd_kcontrol *kcontrol, 282static int stac9460_mic_sw_info(struct snd_kcontrol *kcontrol,
284 struct snd_ctl_elem_info *uinfo) 283 struct snd_ctl_elem_info *uinfo)
285{ 284{
286 static char *texts[2] = { "Line In", "Mic" }; 285 static const char * const texts[2] = { "Line In", "Mic" };
287 286
288 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 287 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
289 uinfo->count = 1; 288 uinfo->count = 1;
@@ -369,7 +368,7 @@ static const DECLARE_TLV_DB_SCALE(db_scale_adc, 0, 150, 0);
369 * mixers 368 * mixers
370 */ 369 */
371 370
372static struct snd_kcontrol_new stac_controls[] __devinitdata = { 371static struct snd_kcontrol_new stac_controls[] = {
373 { 372 {
374 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 373 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
375 .name = "Master Playback Switch", 374 .name = "Master Playback Switch",
@@ -562,7 +561,7 @@ static unsigned char prodigy192_ak4114_read(void *private_data,
562static int ak4114_input_sw_info(struct snd_kcontrol *kcontrol, 561static int ak4114_input_sw_info(struct snd_kcontrol *kcontrol,
563 struct snd_ctl_elem_info *uinfo) 562 struct snd_ctl_elem_info *uinfo)
564{ 563{
565 static char *texts[2] = { "Toslink", "Coax" }; 564 static const char * const texts[2] = { "Toslink", "Coax" };
566 565
567 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 566 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
568 uinfo->count = 1; 567 uinfo->count = 1;
@@ -607,7 +606,7 @@ static int ak4114_input_sw_put(struct snd_kcontrol *kcontrol,
607} 606}
608 607
609 608
610static struct snd_kcontrol_new ak4114_controls[] __devinitdata = { 609static struct snd_kcontrol_new ak4114_controls[] = {
611 { 610 {
612 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 611 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
613 .name = "MIODIO IEC958 Capture Input", 612 .name = "MIODIO IEC958 Capture Input",
@@ -672,7 +671,7 @@ static void stac9460_proc_init(struct snd_ice1712 *ice)
672} 671}
673 672
674 673
675static int __devinit prodigy192_add_controls(struct snd_ice1712 *ice) 674static int prodigy192_add_controls(struct snd_ice1712 *ice)
676{ 675{
677 struct prodigy192_spec *spec = ice->spec; 676 struct prodigy192_spec *spec = ice->spec;
678 unsigned int i; 677 unsigned int i;
@@ -728,7 +727,7 @@ static int prodigy192_miodio_exists(struct snd_ice1712 *ice)
728/* 727/*
729 * initialize the chip 728 * initialize the chip
730 */ 729 */
731static int __devinit prodigy192_init(struct snd_ice1712 *ice) 730static int prodigy192_init(struct snd_ice1712 *ice)
732{ 731{
733 static const unsigned short stac_inits_prodigy[] = { 732 static const unsigned short stac_inits_prodigy[] = {
734 STAC946X_RESET, 0, 733 STAC946X_RESET, 0,
@@ -784,7 +783,7 @@ static int __devinit prodigy192_init(struct snd_ice1712 *ice)
784 * hence the driver needs to sets up it properly. 783 * hence the driver needs to sets up it properly.
785 */ 784 */
786 785
787static unsigned char prodigy71_eeprom[] __devinitdata = { 786static unsigned char prodigy71_eeprom[] = {
788 [ICE_EEP2_SYSCONF] = 0x6a, /* 49MHz crystal, mpu401, 787 [ICE_EEP2_SYSCONF] = 0x6a, /* 49MHz crystal, mpu401,
789 * spdif-in+ 1 stereo ADC, 788 * spdif-in+ 1 stereo ADC,
790 * 3 stereo DACs 789 * 3 stereo DACs
@@ -808,7 +807,7 @@ static unsigned char prodigy71_eeprom[] __devinitdata = {
808 807
809 808
810/* entry point */ 809/* entry point */
811struct snd_ice1712_card_info snd_vt1724_prodigy192_cards[] __devinitdata = { 810struct snd_ice1712_card_info snd_vt1724_prodigy192_cards[] = {
812 { 811 {
813 .subvendor = VT1724_SUBDEVICE_PRODIGY192VE, 812 .subvendor = VT1724_SUBDEVICE_PRODIGY192VE,
814 .name = "Audiotrak Prodigy 192", 813 .name = "Audiotrak Prodigy 192",
diff --git a/sound/pci/ice1712/prodigy_hifi.c b/sound/pci/ice1712/prodigy_hifi.c
index 7bf093c51ce5..2261d1e49150 100644
--- a/sound/pci/ice1712/prodigy_hifi.c
+++ b/sound/pci/ice1712/prodigy_hifi.c
@@ -25,7 +25,6 @@
25 */ 25 */
26 26
27 27
28#include <asm/io.h>
29#include <linux/delay.h> 28#include <linux/delay.h>
30#include <linux/interrupt.h> 29#include <linux/interrupt.h>
31#include <linux/init.h> 30#include <linux/init.h>
@@ -299,7 +298,7 @@ static int ak4396_dac_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem
299static const DECLARE_TLV_DB_SCALE(db_scale_wm_dac, -12700, 100, 1); 298static const DECLARE_TLV_DB_SCALE(db_scale_wm_dac, -12700, 100, 1);
300static const DECLARE_TLV_DB_LINEAR(ak4396_db_scale, TLV_DB_GAIN_MUTE, 0); 299static const DECLARE_TLV_DB_LINEAR(ak4396_db_scale, TLV_DB_GAIN_MUTE, 0);
301 300
302static struct snd_kcontrol_new prodigy_hd2_controls[] __devinitdata = { 301static struct snd_kcontrol_new prodigy_hd2_controls[] = {
303 { 302 {
304 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 303 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
305 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | 304 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
@@ -782,7 +781,7 @@ static int wm_chswap_put(struct snd_kcontrol *kcontrol,
782 * mixers 781 * mixers
783 */ 782 */
784 783
785static struct snd_kcontrol_new prodigy_hifi_controls[] __devinitdata = { 784static struct snd_kcontrol_new prodigy_hifi_controls[] = {
786 { 785 {
787 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 786 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
788 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | 787 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
@@ -939,7 +938,7 @@ static void wm_proc_init(struct snd_ice1712 *ice)
939 } 938 }
940} 939}
941 940
942static int __devinit prodigy_hifi_add_controls(struct snd_ice1712 *ice) 941static int prodigy_hifi_add_controls(struct snd_ice1712 *ice)
943{ 942{
944 unsigned int i; 943 unsigned int i;
945 int err; 944 int err;
@@ -956,7 +955,7 @@ static int __devinit prodigy_hifi_add_controls(struct snd_ice1712 *ice)
956 return 0; 955 return 0;
957} 956}
958 957
959static int __devinit prodigy_hd2_add_controls(struct snd_ice1712 *ice) 958static int prodigy_hd2_add_controls(struct snd_ice1712 *ice)
960{ 959{
961 unsigned int i; 960 unsigned int i;
962 int err; 961 int err;
@@ -977,7 +976,7 @@ static int __devinit prodigy_hd2_add_controls(struct snd_ice1712 *ice)
977/* 976/*
978 * initialize the chip 977 * initialize the chip
979 */ 978 */
980static int __devinit prodigy_hifi_init(struct snd_ice1712 *ice) 979static int prodigy_hifi_init(struct snd_ice1712 *ice)
981{ 980{
982 static unsigned short wm_inits[] = { 981 static unsigned short wm_inits[] = {
983 /* These come first to reduce init pop noise */ 982 /* These come first to reduce init pop noise */
@@ -1115,7 +1114,7 @@ static int prodigy_hd2_resume(struct snd_ice1712 *ice)
1115} 1114}
1116#endif 1115#endif
1117 1116
1118static int __devinit prodigy_hd2_init(struct snd_ice1712 *ice) 1117static int prodigy_hd2_init(struct snd_ice1712 *ice)
1119{ 1118{
1120 struct prodigy_hifi_spec *spec; 1119 struct prodigy_hifi_spec *spec;
1121 1120
@@ -1152,7 +1151,7 @@ static int __devinit prodigy_hd2_init(struct snd_ice1712 *ice)
1152} 1151}
1153 1152
1154 1153
1155static unsigned char prodigy71hifi_eeprom[] __devinitdata = { 1154static unsigned char prodigy71hifi_eeprom[] = {
1156 0x4b, /* SYSCONF: clock 512, spdif-in/ADC, 4DACs */ 1155 0x4b, /* SYSCONF: clock 512, spdif-in/ADC, 4DACs */
1157 0x80, /* ACLINK: I2S */ 1156 0x80, /* ACLINK: I2S */
1158 0xfc, /* I2S: vol, 96k, 24bit, 192k */ 1157 0xfc, /* I2S: vol, 96k, 24bit, 192k */
@@ -1168,7 +1167,7 @@ static unsigned char prodigy71hifi_eeprom[] __devinitdata = {
1168 0x00, /* GPIO_STATE2 */ 1167 0x00, /* GPIO_STATE2 */
1169}; 1168};
1170 1169
1171static unsigned char prodigyhd2_eeprom[] __devinitdata = { 1170static unsigned char prodigyhd2_eeprom[] = {
1172 0x4b, /* SYSCONF: clock 512, spdif-in/ADC, 4DACs */ 1171 0x4b, /* SYSCONF: clock 512, spdif-in/ADC, 4DACs */
1173 0x80, /* ACLINK: I2S */ 1172 0x80, /* ACLINK: I2S */
1174 0xfc, /* I2S: vol, 96k, 24bit, 192k */ 1173 0xfc, /* I2S: vol, 96k, 24bit, 192k */
@@ -1184,7 +1183,7 @@ static unsigned char prodigyhd2_eeprom[] __devinitdata = {
1184 0x00, /* GPIO_STATE2 */ 1183 0x00, /* GPIO_STATE2 */
1185}; 1184};
1186 1185
1187static unsigned char fortissimo4_eeprom[] __devinitdata = { 1186static unsigned char fortissimo4_eeprom[] = {
1188 0x43, /* SYSCONF: clock 512, ADC, 4DACs */ 1187 0x43, /* SYSCONF: clock 512, ADC, 4DACs */
1189 0x80, /* ACLINK: I2S */ 1188 0x80, /* ACLINK: I2S */
1190 0xfc, /* I2S: vol, 96k, 24bit, 192k */ 1189 0xfc, /* I2S: vol, 96k, 24bit, 192k */
@@ -1201,7 +1200,7 @@ static unsigned char fortissimo4_eeprom[] __devinitdata = {
1201}; 1200};
1202 1201
1203/* entry point */ 1202/* entry point */
1204struct snd_ice1712_card_info snd_vt1724_prodigy_hifi_cards[] __devinitdata = { 1203struct snd_ice1712_card_info snd_vt1724_prodigy_hifi_cards[] = {
1205 { 1204 {
1206 .subvendor = VT1724_SUBDEVICE_PRODIGY_HIFI, 1205 .subvendor = VT1724_SUBDEVICE_PRODIGY_HIFI,
1207 .name = "Audiotrak Prodigy 7.1 HiFi", 1206 .name = "Audiotrak Prodigy 7.1 HiFi",
diff --git a/sound/pci/ice1712/psc724.c b/sound/pci/ice1712/psc724.c
new file mode 100644
index 000000000000..302ac6ddd545
--- /dev/null
+++ b/sound/pci/ice1712/psc724.c
@@ -0,0 +1,464 @@
1/*
2 * ALSA driver for ICEnsemble VT1724 (Envy24HT)
3 *
4 * Lowlevel functions for Philips PSC724 Ultimate Edge
5 *
6 * Copyright (c) 2012 Ondrej Zary <linux@rainbow-software.org>
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 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 *
22 */
23
24#include <linux/delay.h>
25#include <linux/init.h>
26#include <linux/slab.h>
27#include <sound/core.h>
28
29#include "ice1712.h"
30#include "envy24ht.h"
31#include "psc724.h"
32#include "wm8766.h"
33#include "wm8776.h"
34
35struct psc724_spec {
36 struct snd_wm8766 wm8766;
37 struct snd_wm8776 wm8776;
38 bool mute_all, jack_detect;
39 struct snd_ice1712 *ice;
40 struct delayed_work hp_work;
41 bool hp_connected;
42};
43
44/****************************************************************************/
45/* PHILIPS PSC724 ULTIMATE EDGE */
46/****************************************************************************/
47/*
48 * VT1722 (Envy24GT) - 6 outputs, 4 inputs (only 2 used), 24-bit/96kHz
49 *
50 * system configuration ICE_EEP2_SYSCONF=0x42
51 * XIN1 49.152MHz
52 * no MPU401
53 * one stereo ADC, no S/PDIF receiver
54 * three stereo DACs (FRONT, REAR, CENTER+LFE)
55 *
56 * AC-Link configuration ICE_EEP2_ACLINK=0x80
57 * use I2S, not AC97
58 *
59 * I2S converters feature ICE_EEP2_I2S=0x30
60 * I2S codec has no volume/mute control feature (bug!)
61 * I2S codec does not support 96KHz or 192KHz (bug!)
62 * I2S codec 24bits
63 *
64 * S/PDIF configuration ICE_EEP2_SPDIF=0xc1
65 * Enable integrated S/PDIF transmitter
66 * internal S/PDIF out implemented
67 * No S/PDIF input
68 * External S/PDIF out implemented
69 *
70 *
71 * ** connected chips **
72 *
73 * WM8776
74 * 2-channel DAC used for main output and stereo ADC (with 10-channel MUX)
75 * AIN1: LINE IN, AIN2: CD/VIDEO, AIN3: AUX, AIN4: Front MIC, AIN5: Rear MIC
76 * Controlled by I2C using VT1722 I2C interface:
77 * MODE (pin16) -- GND
78 * CE (pin17) -- GND I2C mode (address=0x34)
79 * DI (pin18) -- SDA (VT1722 pin70)
80 * CL (pin19) -- SCLK (VT1722 pin71)
81 *
82 * WM8766
83 * 6-channel DAC used for rear & center/LFE outputs (only 4 channels used)
84 * Controlled by SPI using VT1722 GPIO pins:
85 * MODE (pin 1) -- GPIO19 (VT1722 pin99)
86 * ML/I2S (pin11) -- GPIO18 (VT1722 pin98)
87 * MC/IWL (pin12) -- GPIO17 (VT1722 pin97)
88 * MD/DM (pin13) -- GPIO16 (VT1722 pin96)
89 * MUTE (pin14) -- GPIO20 (VT1722 pin101)
90 *
91 * GPIO14 is used as input for headphone jack detection (1 = connected)
92 * GPIO22 is used as MUTE ALL output, grounding all 6 channels
93 *
94 * ** output pins and device names **
95 *
96 * 5.1ch name -- output connector color -- device (-D option)
97 *
98 * FRONT 2ch -- green -- plughw:0,0
99 * CENTER(Lch) SUBWOOFER(Rch) -- orange -- plughw:0,2,0
100 * REAR 2ch -- black -- plughw:0,2,1
101 */
102
103/* codec access low-level functions */
104
105#define GPIO_HP_JACK (1 << 14)
106#define GPIO_MUTE_SUR (1 << 20)
107#define GPIO_MUTE_ALL (1 << 22)
108
109#define JACK_INTERVAL 1000
110
111#define PSC724_SPI_DELAY 1
112
113#define PSC724_SPI_DATA (1 << 16)
114#define PSC724_SPI_CLK (1 << 17)
115#define PSC724_SPI_LOAD (1 << 18)
116#define PSC724_SPI_MASK (PSC724_SPI_DATA | PSC724_SPI_CLK | PSC724_SPI_LOAD)
117
118static void psc724_wm8766_write(struct snd_wm8766 *wm, u16 addr, u16 data)
119{
120 struct psc724_spec *spec = container_of(wm, struct psc724_spec, wm8766);
121 struct snd_ice1712 *ice = spec->ice;
122 u32 st, bits;
123 int i;
124
125 snd_ice1712_save_gpio_status(ice);
126
127 st = ((addr & 0x7f) << 9) | (data & 0x1ff);
128 snd_ice1712_gpio_set_dir(ice, ice->gpio.direction | PSC724_SPI_MASK);
129 snd_ice1712_gpio_set_mask(ice, ice->gpio.write_mask & ~PSC724_SPI_MASK);
130 bits = snd_ice1712_gpio_read(ice) & ~PSC724_SPI_MASK;
131 snd_ice1712_gpio_write(ice, bits);
132
133 for (i = 0; i < 16; i++) {
134 udelay(PSC724_SPI_DELAY);
135 bits &= ~PSC724_SPI_CLK;
136 /* MSB first */
137 st <<= 1;
138 if (st & 0x10000)
139 bits |= PSC724_SPI_DATA;
140 else
141 bits &= ~PSC724_SPI_DATA;
142 snd_ice1712_gpio_write(ice, bits);
143 /* CLOCK high */
144 udelay(PSC724_SPI_DELAY);
145 bits |= PSC724_SPI_CLK;
146 snd_ice1712_gpio_write(ice, bits);
147 }
148 /* LOAD high */
149 udelay(PSC724_SPI_DELAY);
150 bits |= PSC724_SPI_LOAD;
151 snd_ice1712_gpio_write(ice, bits);
152 /* LOAD low, DATA and CLOCK high */
153 udelay(PSC724_SPI_DELAY);
154 bits |= (PSC724_SPI_DATA | PSC724_SPI_CLK);
155 snd_ice1712_gpio_write(ice, bits);
156
157 snd_ice1712_restore_gpio_status(ice);
158}
159
160static void psc724_wm8776_write(struct snd_wm8776 *wm, u8 addr, u8 data)
161{
162 struct psc724_spec *spec = container_of(wm, struct psc724_spec, wm8776);
163
164 snd_vt1724_write_i2c(spec->ice, 0x34, addr, data);
165}
166
167/* mute all */
168
169static void psc724_set_master_switch(struct snd_ice1712 *ice, bool on)
170{
171 unsigned int bits = snd_ice1712_gpio_read(ice);
172 struct psc724_spec *spec = ice->spec;
173
174 spec->mute_all = !on;
175 if (on)
176 bits &= ~(GPIO_MUTE_ALL | GPIO_MUTE_SUR);
177 else
178 bits |= GPIO_MUTE_ALL | GPIO_MUTE_SUR;
179 snd_ice1712_gpio_write(ice, bits);
180}
181
182static bool psc724_get_master_switch(struct snd_ice1712 *ice)
183{
184 struct psc724_spec *spec = ice->spec;
185
186 return !spec->mute_all;
187}
188
189/* jack detection */
190
191static void psc724_set_jack_state(struct snd_ice1712 *ice, bool hp_connected)
192{
193 struct psc724_spec *spec = ice->spec;
194 struct snd_ctl_elem_id elem_id;
195 struct snd_kcontrol *kctl;
196 u16 power = spec->wm8776.regs[WM8776_REG_PWRDOWN] & ~WM8776_PWR_HPPD;
197
198 psc724_set_master_switch(ice, !hp_connected);
199 if (!hp_connected)
200 power |= WM8776_PWR_HPPD;
201 snd_wm8776_set_power(&spec->wm8776, power);
202 spec->hp_connected = hp_connected;
203 /* notify about master speaker mute change */
204 memset(&elem_id, 0, sizeof(elem_id));
205 elem_id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
206 strncpy(elem_id.name, "Master Speakers Playback Switch",
207 sizeof(elem_id.name));
208 kctl = snd_ctl_find_id(ice->card, &elem_id);
209 snd_ctl_notify(ice->card, SNDRV_CTL_EVENT_MASK_VALUE, &kctl->id);
210 /* and headphone mute change */
211 strncpy(elem_id.name, spec->wm8776.ctl[WM8776_CTL_HP_SW].name,
212 sizeof(elem_id.name));
213 kctl = snd_ctl_find_id(ice->card, &elem_id);
214 snd_ctl_notify(ice->card, SNDRV_CTL_EVENT_MASK_VALUE, &kctl->id);
215}
216
217static void psc724_update_hp_jack_state(struct work_struct *work)
218{
219 struct psc724_spec *spec = container_of(work, struct psc724_spec,
220 hp_work.work);
221 struct snd_ice1712 *ice = spec->ice;
222 bool hp_connected = snd_ice1712_gpio_read(ice) & GPIO_HP_JACK;
223
224 schedule_delayed_work(&spec->hp_work, msecs_to_jiffies(JACK_INTERVAL));
225 if (hp_connected == spec->hp_connected)
226 return;
227 psc724_set_jack_state(ice, hp_connected);
228}
229
230static void psc724_set_jack_detection(struct snd_ice1712 *ice, bool on)
231{
232 struct psc724_spec *spec = ice->spec;
233
234 if (spec->jack_detect == on)
235 return;
236
237 spec->jack_detect = on;
238 if (on) {
239 bool hp_connected = snd_ice1712_gpio_read(ice) & GPIO_HP_JACK;
240 psc724_set_jack_state(ice, hp_connected);
241 schedule_delayed_work(&spec->hp_work,
242 msecs_to_jiffies(JACK_INTERVAL));
243 } else
244 cancel_delayed_work_sync(&spec->hp_work);
245}
246
247static bool psc724_get_jack_detection(struct snd_ice1712 *ice)
248{
249 struct psc724_spec *spec = ice->spec;
250
251 return spec->jack_detect;
252}
253
254/* mixer controls */
255
256struct psc724_control {
257 const char *name;
258 void (*set)(struct snd_ice1712 *ice, bool on);
259 bool (*get)(struct snd_ice1712 *ice);
260};
261
262static const struct psc724_control psc724_cont[] = {
263 {
264 .name = "Master Speakers Playback Switch",
265 .set = psc724_set_master_switch,
266 .get = psc724_get_master_switch,
267 },
268 {
269 .name = "Headphone Jack Detection Playback Switch",
270 .set = psc724_set_jack_detection,
271 .get = psc724_get_jack_detection,
272 },
273};
274
275static int psc724_ctl_get(struct snd_kcontrol *kcontrol,
276 struct snd_ctl_elem_value *ucontrol)
277{
278 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
279 int n = kcontrol->private_value;
280
281 ucontrol->value.integer.value[0] = psc724_cont[n].get(ice);
282
283 return 0;
284}
285
286static int psc724_ctl_put(struct snd_kcontrol *kcontrol,
287 struct snd_ctl_elem_value *ucontrol)
288{
289 struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
290 int n = kcontrol->private_value;
291
292 psc724_cont[n].set(ice, ucontrol->value.integer.value[0]);
293
294 return 0;
295}
296
297static const char *front_volume = "Front Playback Volume";
298static const char *front_switch = "Front Playback Switch";
299static const char *front_zc = "Front Zero Cross Detect Playback Switch";
300static const char *front_izd = "Front Infinite Zero Detect Playback Switch";
301static const char *front_phase = "Front Phase Invert Playback Switch";
302static const char *front_deemph = "Front Deemphasis Playback Switch";
303static const char *ain1_switch = "Line Capture Switch";
304static const char *ain2_switch = "CD Capture Switch";
305static const char *ain3_switch = "AUX Capture Switch";
306static const char *ain4_switch = "Front Mic Capture Switch";
307static const char *ain5_switch = "Rear Mic Capture Switch";
308static const char *rear_volume = "Surround Playback Volume";
309static const char *clfe_volume = "CLFE Playback Volume";
310static const char *rear_switch = "Surround Playback Switch";
311static const char *clfe_switch = "CLFE Playback Switch";
312static const char *rear_phase = "Surround Phase Invert Playback Switch";
313static const char *clfe_phase = "CLFE Phase Invert Playback Switch";
314static const char *rear_deemph = "Surround Deemphasis Playback Switch";
315static const char *clfe_deemph = "CLFE Deemphasis Playback Switch";
316static const char *rear_clfe_izd = "Rear Infinite Zero Detect Playback Switch";
317static const char *rear_clfe_zc = "Rear Zero Cross Detect Playback Switch";
318
319static int psc724_add_controls(struct snd_ice1712 *ice)
320{
321 struct snd_kcontrol_new cont;
322 struct snd_kcontrol *ctl;
323 int err, i;
324 struct psc724_spec *spec = ice->spec;
325
326 spec->wm8776.ctl[WM8776_CTL_DAC_VOL].name = front_volume;
327 spec->wm8776.ctl[WM8776_CTL_DAC_SW].name = front_switch;
328 spec->wm8776.ctl[WM8776_CTL_DAC_ZC_SW].name = front_zc;
329 spec->wm8776.ctl[WM8776_CTL_AUX_SW].name = NULL;
330 spec->wm8776.ctl[WM8776_CTL_DAC_IZD_SW].name = front_izd;
331 spec->wm8776.ctl[WM8776_CTL_PHASE_SW].name = front_phase;
332 spec->wm8776.ctl[WM8776_CTL_DEEMPH_SW].name = front_deemph;
333 spec->wm8776.ctl[WM8776_CTL_INPUT1_SW].name = ain1_switch;
334 spec->wm8776.ctl[WM8776_CTL_INPUT2_SW].name = ain2_switch;
335 spec->wm8776.ctl[WM8776_CTL_INPUT3_SW].name = ain3_switch;
336 spec->wm8776.ctl[WM8776_CTL_INPUT4_SW].name = ain4_switch;
337 spec->wm8776.ctl[WM8776_CTL_INPUT5_SW].name = ain5_switch;
338 snd_wm8776_build_controls(&spec->wm8776);
339 spec->wm8766.ctl[WM8766_CTL_CH1_VOL].name = rear_volume;
340 spec->wm8766.ctl[WM8766_CTL_CH2_VOL].name = clfe_volume;
341 spec->wm8766.ctl[WM8766_CTL_CH3_VOL].name = NULL;
342 spec->wm8766.ctl[WM8766_CTL_CH1_SW].name = rear_switch;
343 spec->wm8766.ctl[WM8766_CTL_CH2_SW].name = clfe_switch;
344 spec->wm8766.ctl[WM8766_CTL_CH3_SW].name = NULL;
345 spec->wm8766.ctl[WM8766_CTL_PHASE1_SW].name = rear_phase;
346 spec->wm8766.ctl[WM8766_CTL_PHASE2_SW].name = clfe_phase;
347 spec->wm8766.ctl[WM8766_CTL_PHASE3_SW].name = NULL;
348 spec->wm8766.ctl[WM8766_CTL_DEEMPH1_SW].name = rear_deemph;
349 spec->wm8766.ctl[WM8766_CTL_DEEMPH2_SW].name = clfe_deemph;
350 spec->wm8766.ctl[WM8766_CTL_DEEMPH3_SW].name = NULL;
351 spec->wm8766.ctl[WM8766_CTL_IZD_SW].name = rear_clfe_izd;
352 spec->wm8766.ctl[WM8766_CTL_ZC_SW].name = rear_clfe_zc;
353 snd_wm8766_build_controls(&spec->wm8766);
354
355 memset(&cont, 0, sizeof(cont));
356 cont.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
357 for (i = 0; i < ARRAY_SIZE(psc724_cont); i++) {
358 cont.private_value = i;
359 cont.name = psc724_cont[i].name;
360 cont.access = SNDRV_CTL_ELEM_ACCESS_READWRITE;
361 cont.info = snd_ctl_boolean_mono_info;
362 cont.get = psc724_ctl_get;
363 cont.put = psc724_ctl_put;
364 ctl = snd_ctl_new1(&cont, ice);
365 if (!ctl)
366 return -ENOMEM;
367 err = snd_ctl_add(ice->card, ctl);
368 if (err < 0)
369 return err;
370 }
371
372 return 0;
373}
374
375static void psc724_set_pro_rate(struct snd_ice1712 *ice, unsigned int rate)
376{
377 struct psc724_spec *spec = ice->spec;
378 /* restore codec volume settings after rate change (PMCLK stop) */
379 snd_wm8776_volume_restore(&spec->wm8776);
380 snd_wm8766_volume_restore(&spec->wm8766);
381}
382
383/* power management */
384
385#ifdef CONFIG_PM_SLEEP
386static int psc724_resume(struct snd_ice1712 *ice)
387{
388 struct psc724_spec *spec = ice->spec;
389
390 snd_wm8776_resume(&spec->wm8776);
391 snd_wm8766_resume(&spec->wm8766);
392
393 return 0;
394}
395#endif
396
397/* init */
398
399static int psc724_init(struct snd_ice1712 *ice)
400{
401 struct psc724_spec *spec;
402
403 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
404 if (!spec)
405 return -ENOMEM;
406 ice->spec = spec;
407 spec->ice = ice;
408
409 ice->num_total_dacs = 6;
410 ice->num_total_adcs = 2;
411 spec->wm8776.ops.write = psc724_wm8776_write;
412 spec->wm8776.card = ice->card;
413 snd_wm8776_init(&spec->wm8776);
414 spec->wm8766.ops.write = psc724_wm8766_write;
415 spec->wm8766.card = ice->card;
416#ifdef CONFIG_PM_SLEEP
417 ice->pm_resume = psc724_resume;
418 ice->pm_suspend_enabled = 1;
419#endif
420 snd_wm8766_init(&spec->wm8766);
421 snd_wm8766_set_if(&spec->wm8766,
422 WM8766_IF_FMT_I2S | WM8766_IF_IWL_24BIT);
423 ice->gpio.set_pro_rate = psc724_set_pro_rate;
424 INIT_DELAYED_WORK(&spec->hp_work, psc724_update_hp_jack_state);
425 psc724_set_jack_detection(ice, true);
426 return 0;
427}
428
429static void psc724_exit(struct snd_ice1712 *ice)
430{
431 struct psc724_spec *spec = ice->spec;
432
433 cancel_delayed_work_sync(&spec->hp_work);
434}
435
436/* PSC724 has buggy EEPROM (no 96&192kHz, all FFh GPIOs), so override it here */
437static unsigned char psc724_eeprom[] = {
438 [ICE_EEP2_SYSCONF] = 0x42, /* 49.152MHz, 1 ADC, 3 DACs */
439 [ICE_EEP2_ACLINK] = 0x80, /* I2S */
440 [ICE_EEP2_I2S] = 0xf0, /* I2S volume, 96kHz, 24bit */
441 [ICE_EEP2_SPDIF] = 0xc1, /* spdif out-en, out-int, no input */
442 /* GPIO outputs */
443 [ICE_EEP2_GPIO_DIR2] = 0x5f, /* MUTE_ALL,WM8766 MUTE/MODE/ML/MC/MD */
444 /* GPIO write enable */
445 [ICE_EEP2_GPIO_MASK] = 0xff, /* read-only */
446 [ICE_EEP2_GPIO_MASK1] = 0xff, /* read-only */
447 [ICE_EEP2_GPIO_MASK2] = 0xa0, /* MUTE_ALL,WM8766 MUTE/MODE/ML/MC/MD */
448 /* GPIO initial state */
449 [ICE_EEP2_GPIO_STATE2] = 0x20, /* unmuted, all WM8766 pins low */
450};
451
452struct snd_ice1712_card_info snd_vt1724_psc724_cards[] = {
453 {
454 .subvendor = VT1724_SUBDEVICE_PSC724,
455 .name = "Philips PSC724 Ultimate Edge",
456 .model = "psc724",
457 .chip_init = psc724_init,
458 .chip_exit = psc724_exit,
459 .build_controls = psc724_add_controls,
460 .eeprom_size = sizeof(psc724_eeprom),
461 .eeprom_data = psc724_eeprom,
462 },
463 {} /*terminator*/
464};
diff --git a/sound/pci/ice1712/psc724.h b/sound/pci/ice1712/psc724.h
new file mode 100644
index 000000000000..858e5fd0eebb
--- /dev/null
+++ b/sound/pci/ice1712/psc724.h
@@ -0,0 +1,13 @@
1#ifndef __SOUND_PSC724_H
2#define __SOUND_PSC724_H
3
4/* ID */
5#define PSC724_DEVICE_DESC \
6 "{Philips,PSC724 Ultimate Edge},"
7
8#define VT1724_SUBDEVICE_PSC724 0xab170619
9
10/* entry struct */
11extern struct snd_ice1712_card_info snd_vt1724_psc724_cards[];
12
13#endif /* __SOUND_PSC724_H */
diff --git a/sound/pci/ice1712/quartet.c b/sound/pci/ice1712/quartet.c
index 1948632787e6..975e0357bd5a 100644
--- a/sound/pci/ice1712/quartet.c
+++ b/sound/pci/ice1712/quartet.c
@@ -22,7 +22,6 @@
22 * 22 *
23 */ 23 */
24 24
25#include <asm/io.h>
26#include <linux/delay.h> 25#include <linux/delay.h>
27#include <linux/interrupt.h> 26#include <linux/interrupt.h>
28#include <linux/init.h> 27#include <linux/init.h>
@@ -47,7 +46,7 @@ struct qtet_kcontrol_private {
47 unsigned int bit; 46 unsigned int bit;
48 void (*set_register)(struct snd_ice1712 *ice, unsigned int val); 47 void (*set_register)(struct snd_ice1712 *ice, unsigned int val);
49 unsigned int (*get_register)(struct snd_ice1712 *ice); 48 unsigned int (*get_register)(struct snd_ice1712 *ice);
50 unsigned char *texts[2]; 49 unsigned char * const texts[2];
51}; 50};
52 51
53enum { 52enum {
@@ -63,7 +62,7 @@ enum {
63 OUT34_MON12, 62 OUT34_MON12,
64}; 63};
65 64
66static char *ext_clock_names[3] = {"IEC958 In", "Word Clock 1xFS", 65static const char * const ext_clock_names[3] = {"IEC958 In", "Word Clock 1xFS",
67 "Word Clock 256xFS"}; 66 "Word Clock 256xFS"};
68 67
69/* chip address on I2C bus */ 68/* chip address on I2C bus */
@@ -387,7 +386,7 @@ static const struct snd_akm4xxx_adc_channel qtet_adc[] = {
387 AK_CONTROL(PCM_34_CAPTURE_VOLUME, 2), 386 AK_CONTROL(PCM_34_CAPTURE_VOLUME, 2),
388}; 387};
389 388
390static struct snd_akm4xxx akm_qtet_dac __devinitdata = { 389static struct snd_akm4xxx akm_qtet_dac = {
391 .type = SND_AK4620, 390 .type = SND_AK4620,
392 .num_dacs = 4, /* DAC1 - Output 12 391 .num_dacs = 4, /* DAC1 - Output 12
393 */ 392 */
@@ -551,7 +550,8 @@ static int qtet_mute_put(struct snd_kcontrol *kcontrol,
551static int qtet_ain12_enum_info(struct snd_kcontrol *kcontrol, 550static int qtet_ain12_enum_info(struct snd_kcontrol *kcontrol,
552 struct snd_ctl_elem_info *uinfo) 551 struct snd_ctl_elem_info *uinfo)
553{ 552{
554 static char *texts[3] = {"Line In 1/2", "Mic", "Mic + Low-cut"}; 553 static const char * const texts[3] =
554 {"Line In 1/2", "Mic", "Mic + Low-cut"};
555 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 555 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
556 uinfo->count = 1; 556 uinfo->count = 1;
557 uinfo->value.enumerated.items = ARRAY_SIZE(texts); 557 uinfo->value.enumerated.items = ARRAY_SIZE(texts);
@@ -758,7 +758,7 @@ static int qtet_sw_put(struct snd_kcontrol *kcontrol,
758 .put = qtet_sw_put,\ 758 .put = qtet_sw_put,\
759 .private_value = xpriv } 759 .private_value = xpriv }
760 760
761static struct snd_kcontrol_new qtet_controls[] __devinitdata = { 761static struct snd_kcontrol_new qtet_controls[] = {
762 { 762 {
763 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 763 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
764 .name = "Master Playback Switch", 764 .name = "Master Playback Switch",
@@ -795,17 +795,17 @@ static struct snd_kcontrol_new qtet_controls[] __devinitdata = {
795 QTET_CONTROL("Output 3/4 to Monitor 1/2", sw, OUT34_MON12), 795 QTET_CONTROL("Output 3/4 to Monitor 1/2", sw, OUT34_MON12),
796}; 796};
797 797
798static char *slave_vols[] __devinitdata = { 798static char *slave_vols[] = {
799 PCM_12_PLAYBACK_VOLUME, 799 PCM_12_PLAYBACK_VOLUME,
800 PCM_34_PLAYBACK_VOLUME, 800 PCM_34_PLAYBACK_VOLUME,
801 NULL 801 NULL
802}; 802};
803 803
804static __devinitdata 804static
805DECLARE_TLV_DB_SCALE(qtet_master_db_scale, -6350, 50, 1); 805DECLARE_TLV_DB_SCALE(qtet_master_db_scale, -6350, 50, 1);
806 806
807static struct snd_kcontrol __devinit *ctl_find(struct snd_card *card, 807static struct snd_kcontrol *ctl_find(struct snd_card *card,
808 const char *name) 808 const char *name)
809{ 809{
810 struct snd_ctl_elem_id sid; 810 struct snd_ctl_elem_id sid;
811 memset(&sid, 0, sizeof(sid)); 811 memset(&sid, 0, sizeof(sid));
@@ -815,8 +815,8 @@ static struct snd_kcontrol __devinit *ctl_find(struct snd_card *card,
815 return snd_ctl_find_id(card, &sid); 815 return snd_ctl_find_id(card, &sid);
816} 816}
817 817
818static void __devinit add_slaves(struct snd_card *card, 818static void add_slaves(struct snd_card *card,
819 struct snd_kcontrol *master, char **list) 819 struct snd_kcontrol *master, char * const *list)
820{ 820{
821 for (; *list; list++) { 821 for (; *list; list++) {
822 struct snd_kcontrol *slave = ctl_find(card, *list); 822 struct snd_kcontrol *slave = ctl_find(card, *list);
@@ -825,7 +825,7 @@ static void __devinit add_slaves(struct snd_card *card,
825 } 825 }
826} 826}
827 827
828static int __devinit qtet_add_controls(struct snd_ice1712 *ice) 828static int qtet_add_controls(struct snd_ice1712 *ice)
829{ 829{
830 struct qtet_spec *spec = ice->spec; 830 struct qtet_spec *spec = ice->spec;
831 int err, i; 831 int err, i;
@@ -1007,7 +1007,7 @@ static void qtet_spdif_in_open(struct snd_ice1712 *ice,
1007/* 1007/*
1008 * initialize the chip 1008 * initialize the chip
1009 */ 1009 */
1010static int __devinit qtet_init(struct snd_ice1712 *ice) 1010static int qtet_init(struct snd_ice1712 *ice)
1011{ 1011{
1012 static const unsigned char ak4113_init_vals[] = { 1012 static const unsigned char ak4113_init_vals[] = {
1013 /* AK4113_REG_PWRDN */ AK4113_RST | AK4113_PWN | 1013 /* AK4113_REG_PWRDN */ AK4113_RST | AK4113_PWN |
@@ -1095,7 +1095,7 @@ static int __devinit qtet_init(struct snd_ice1712 *ice)
1095 return 0; 1095 return 0;
1096} 1096}
1097 1097
1098static unsigned char qtet_eeprom[] __devinitdata = { 1098static unsigned char qtet_eeprom[] = {
1099 [ICE_EEP2_SYSCONF] = 0x28, /* clock 256(24MHz), mpu401, 1xADC, 1099 [ICE_EEP2_SYSCONF] = 0x28, /* clock 256(24MHz), mpu401, 1xADC,
1100 1xDACs, SPDIF in */ 1100 1xDACs, SPDIF in */
1101 [ICE_EEP2_ACLINK] = 0x80, /* I2S */ 1101 [ICE_EEP2_ACLINK] = 0x80, /* I2S */
@@ -1116,7 +1116,7 @@ static unsigned char qtet_eeprom[] __devinitdata = {
1116}; 1116};
1117 1117
1118/* entry point */ 1118/* entry point */
1119struct snd_ice1712_card_info snd_vt1724_qtet_cards[] __devinitdata = { 1119struct snd_ice1712_card_info snd_vt1724_qtet_cards[] = {
1120 { 1120 {
1121 .subvendor = VT1724_SUBDEVICE_QTET, 1121 .subvendor = VT1724_SUBDEVICE_QTET,
1122 .name = "Infrasonic Quartet", 1122 .name = "Infrasonic Quartet",
diff --git a/sound/pci/ice1712/revo.c b/sound/pci/ice1712/revo.c
index b508bb360b97..7641080a9b5d 100644
--- a/sound/pci/ice1712/revo.c
+++ b/sound/pci/ice1712/revo.c
@@ -21,7 +21,6 @@
21 * 21 *
22 */ 22 */
23 23
24#include <asm/io.h>
25#include <linux/delay.h> 24#include <linux/delay.h>
26#include <linux/interrupt.h> 25#include <linux/interrupt.h>
27#include <linux/init.h> 26#include <linux/init.h>
@@ -235,7 +234,7 @@ static const struct snd_akm4xxx_adc_channel revo51_adc[] = {
235 }, 234 },
236}; 235};
237 236
238static struct snd_akm4xxx akm_revo_front __devinitdata = { 237static struct snd_akm4xxx akm_revo_front = {
239 .type = SND_AK4381, 238 .type = SND_AK4381,
240 .num_dacs = 2, 239 .num_dacs = 2,
241 .ops = { 240 .ops = {
@@ -244,7 +243,7 @@ static struct snd_akm4xxx akm_revo_front __devinitdata = {
244 .dac_info = revo71_front, 243 .dac_info = revo71_front,
245}; 244};
246 245
247static struct snd_ak4xxx_private akm_revo_front_priv __devinitdata = { 246static struct snd_ak4xxx_private akm_revo_front_priv = {
248 .caddr = 1, 247 .caddr = 1,
249 .cif = 0, 248 .cif = 0,
250 .data_mask = VT1724_REVO_CDOUT, 249 .data_mask = VT1724_REVO_CDOUT,
@@ -256,7 +255,7 @@ static struct snd_ak4xxx_private akm_revo_front_priv __devinitdata = {
256 .mask_flags = 0, 255 .mask_flags = 0,
257}; 256};
258 257
259static struct snd_akm4xxx akm_revo_surround __devinitdata = { 258static struct snd_akm4xxx akm_revo_surround = {
260 .type = SND_AK4355, 259 .type = SND_AK4355,
261 .idx_offset = 1, 260 .idx_offset = 1,
262 .num_dacs = 6, 261 .num_dacs = 6,
@@ -266,7 +265,7 @@ static struct snd_akm4xxx akm_revo_surround __devinitdata = {
266 .dac_info = revo71_surround, 265 .dac_info = revo71_surround,
267}; 266};
268 267
269static struct snd_ak4xxx_private akm_revo_surround_priv __devinitdata = { 268static struct snd_ak4xxx_private akm_revo_surround_priv = {
270 .caddr = 3, 269 .caddr = 3,
271 .cif = 0, 270 .cif = 0,
272 .data_mask = VT1724_REVO_CDOUT, 271 .data_mask = VT1724_REVO_CDOUT,
@@ -278,7 +277,7 @@ static struct snd_ak4xxx_private akm_revo_surround_priv __devinitdata = {
278 .mask_flags = 0, 277 .mask_flags = 0,
279}; 278};
280 279
281static struct snd_akm4xxx akm_revo51 __devinitdata = { 280static struct snd_akm4xxx akm_revo51 = {
282 .type = SND_AK4358, 281 .type = SND_AK4358,
283 .num_dacs = 8, 282 .num_dacs = 8,
284 .ops = { 283 .ops = {
@@ -287,7 +286,7 @@ static struct snd_akm4xxx akm_revo51 __devinitdata = {
287 .dac_info = revo51_dac, 286 .dac_info = revo51_dac,
288}; 287};
289 288
290static struct snd_ak4xxx_private akm_revo51_priv __devinitdata = { 289static struct snd_ak4xxx_private akm_revo51_priv = {
291 .caddr = 2, 290 .caddr = 2,
292 .cif = 0, 291 .cif = 0,
293 .data_mask = VT1724_REVO_CDOUT, 292 .data_mask = VT1724_REVO_CDOUT,
@@ -299,13 +298,13 @@ static struct snd_ak4xxx_private akm_revo51_priv __devinitdata = {
299 .mask_flags = 0, 298 .mask_flags = 0,
300}; 299};
301 300
302static struct snd_akm4xxx akm_revo51_adc __devinitdata = { 301static struct snd_akm4xxx akm_revo51_adc = {
303 .type = SND_AK5365, 302 .type = SND_AK5365,
304 .num_adcs = 2, 303 .num_adcs = 2,
305 .adc_info = revo51_adc, 304 .adc_info = revo51_adc,
306}; 305};
307 306
308static struct snd_ak4xxx_private akm_revo51_adc_priv __devinitdata = { 307static struct snd_ak4xxx_private akm_revo51_adc_priv = {
309 .caddr = 2, 308 .caddr = 2,
310 .cif = 0, 309 .cif = 0,
311 .data_mask = VT1724_REVO_CDOUT, 310 .data_mask = VT1724_REVO_CDOUT,
@@ -346,7 +345,7 @@ static const struct snd_akm4xxx_dac_channel ap192_dac[] = {
346 AK_DAC("PCM Playback Volume", 2) 345 AK_DAC("PCM Playback Volume", 2)
347}; 346};
348 347
349static struct snd_akm4xxx akm_ap192 __devinitdata = { 348static struct snd_akm4xxx akm_ap192 = {
350 .type = SND_AK4358, 349 .type = SND_AK4358,
351 .num_dacs = 2, 350 .num_dacs = 2,
352 .ops = { 351 .ops = {
@@ -355,7 +354,7 @@ static struct snd_akm4xxx akm_ap192 __devinitdata = {
355 .dac_info = ap192_dac, 354 .dac_info = ap192_dac,
356}; 355};
357 356
358static struct snd_ak4xxx_private akm_ap192_priv __devinitdata = { 357static struct snd_ak4xxx_private akm_ap192_priv = {
359 .caddr = 2, 358 .caddr = 2,
360 .cif = 0, 359 .cif = 0,
361 .data_mask = VT1724_REVO_CDOUT, 360 .data_mask = VT1724_REVO_CDOUT,
@@ -468,7 +467,7 @@ static unsigned char ap192_ak4114_read(void *private_data, unsigned char addr)
468 return data; 467 return data;
469} 468}
470 469
471static int __devinit ap192_ak4114_init(struct snd_ice1712 *ice) 470static int ap192_ak4114_init(struct snd_ice1712 *ice)
472{ 471{
473 static const unsigned char ak4114_init_vals[] = { 472 static const unsigned char ak4114_init_vals[] = {
474 AK4114_RST | AK4114_PWN | AK4114_OCKS0 | AK4114_OCKS1, 473 AK4114_RST | AK4114_PWN | AK4114_OCKS0 | AK4114_OCKS1,
@@ -496,7 +495,7 @@ static int __devinit ap192_ak4114_init(struct snd_ice1712 *ice)
496 return 0; /* error ignored; it's no fatal error */ 495 return 0; /* error ignored; it's no fatal error */
497} 496}
498 497
499static int __devinit revo_init(struct snd_ice1712 *ice) 498static int revo_init(struct snd_ice1712 *ice)
500{ 499{
501 struct snd_akm4xxx *ak; 500 struct snd_akm4xxx *ak;
502 int err; 501 int err;
@@ -574,7 +573,7 @@ static int __devinit revo_init(struct snd_ice1712 *ice)
574} 573}
575 574
576 575
577static int __devinit revo_add_controls(struct snd_ice1712 *ice) 576static int revo_add_controls(struct snd_ice1712 *ice)
578{ 577{
579 struct revo51_spec *spec; 578 struct revo51_spec *spec;
580 int err; 579 int err;
@@ -607,7 +606,7 @@ static int __devinit revo_add_controls(struct snd_ice1712 *ice)
607} 606}
608 607
609/* entry point */ 608/* entry point */
610struct snd_ice1712_card_info snd_vt1724_revo_cards[] __devinitdata = { 609struct snd_ice1712_card_info snd_vt1724_revo_cards[] = {
611 { 610 {
612 .subvendor = VT1724_SUBDEVICE_REVOLUTION71, 611 .subvendor = VT1724_SUBDEVICE_REVOLUTION71,
613 .name = "M Audio Revolution-7.1", 612 .name = "M Audio Revolution-7.1",
diff --git a/sound/pci/ice1712/se.c b/sound/pci/ice1712/se.c
index 69673b95869d..ffd894bb4507 100644
--- a/sound/pci/ice1712/se.c
+++ b/sound/pci/ice1712/se.c
@@ -22,7 +22,6 @@
22 * 22 *
23 */ 23 */
24 24
25#include <asm/io.h>
26#include <linux/delay.h> 25#include <linux/delay.h>
27#include <linux/interrupt.h> 26#include <linux/interrupt.h>
28#include <linux/init.h> 27#include <linux/init.h>
@@ -114,7 +113,7 @@ struct se_spec {
114/* WM8740 interface */ 113/* WM8740 interface */
115/****************************************************************************/ 114/****************************************************************************/
116 115
117static void __devinit se200pci_WM8740_init(struct snd_ice1712 *ice) 116static void se200pci_WM8740_init(struct snd_ice1712 *ice)
118{ 117{
119 /* nothing to do */ 118 /* nothing to do */
120} 119}
@@ -196,7 +195,7 @@ static void se200pci_WM8766_set_volume(struct snd_ice1712 *ice, int ch,
196 } 195 }
197} 196}
198 197
199static void __devinit se200pci_WM8766_init(struct snd_ice1712 *ice) 198static void se200pci_WM8766_init(struct snd_ice1712 *ice)
200{ 199{
201 se200pci_WM8766_write(ice, 0x1f, 0x000); /* RESET ALL */ 200 se200pci_WM8766_write(ice, 0x1f, 0x000); /* RESET ALL */
202 udelay(10); 201 udelay(10);
@@ -253,7 +252,7 @@ static void se200pci_WM8776_set_input_volume(struct snd_ice1712 *ice,
253 se200pci_WM8776_write(ice, 0x0f, vol2 | 0x100); 252 se200pci_WM8776_write(ice, 0x0f, vol2 | 0x100);
254} 253}
255 254
256static const char *se200pci_sel[] = { 255static const char * const se200pci_sel[] = {
257 "LINE-IN", "CD-IN", "MIC-IN", "ALL-MIX", NULL 256 "LINE-IN", "CD-IN", "MIC-IN", "ALL-MIX", NULL
258}; 257};
259 258
@@ -278,7 +277,7 @@ static void se200pci_WM8776_set_afl(struct snd_ice1712 *ice, unsigned int afl)
278 se200pci_WM8776_write(ice, 0x16, 0x001); 277 se200pci_WM8776_write(ice, 0x16, 0x001);
279} 278}
280 279
281static const char *se200pci_agc[] = { 280static const char * const se200pci_agc[] = {
282 "Off", "LimiterMode", "ALCMode", NULL 281 "Off", "LimiterMode", "ALCMode", NULL
283}; 282};
284 283
@@ -300,10 +299,10 @@ static void se200pci_WM8776_set_agc(struct snd_ice1712 *ice, unsigned int agc)
300 } 299 }
301} 300}
302 301
303static void __devinit se200pci_WM8776_init(struct snd_ice1712 *ice) 302static void se200pci_WM8776_init(struct snd_ice1712 *ice)
304{ 303{
305 int i; 304 int i;
306 static unsigned short __devinitdata default_values[] = { 305 static unsigned short default_values[] = {
307 0x100, 0x100, 0x100, 306 0x100, 0x100, 0x100,
308 0x100, 0x100, 0x100, 307 0x100, 0x100, 0x100,
309 0x000, 0x090, 0x000, 0x000, 308 0x000, 0x090, 0x000, 0x000,
@@ -352,7 +351,7 @@ static void se200pci_set_pro_rate(struct snd_ice1712 *ice, unsigned int rate)
352} 351}
353 352
354struct se200pci_control { 353struct se200pci_control {
355 char *name; 354 const char *name;
356 enum { 355 enum {
357 WM8766, 356 WM8766,
358 WM8776in, 357 WM8776in,
@@ -363,7 +362,7 @@ struct se200pci_control {
363 } target; 362 } target;
364 enum { VOLUME1, VOLUME2, BOOLEAN, ENUM } type; 363 enum { VOLUME1, VOLUME2, BOOLEAN, ENUM } type;
365 int ch; 364 int ch;
366 const char **member; 365 const char * const *member;
367 const char *comment; 366 const char *comment;
368}; 367};
369 368
@@ -421,7 +420,7 @@ static const struct se200pci_control se200pci_cont[] = {
421 420
422static int se200pci_get_enum_count(int n) 421static int se200pci_get_enum_count(int n)
423{ 422{
424 const char **member; 423 const char * const *member;
425 int c; 424 int c;
426 425
427 member = se200pci_cont[n].member; 426 member = se200pci_cont[n].member;
@@ -600,7 +599,7 @@ static int se200pci_cont_enum_put(struct snd_kcontrol *kc,
600static const DECLARE_TLV_DB_SCALE(db_scale_gain1, -12750, 50, 1); 599static const DECLARE_TLV_DB_SCALE(db_scale_gain1, -12750, 50, 1);
601static const DECLARE_TLV_DB_SCALE(db_scale_gain2, -10350, 50, 1); 600static const DECLARE_TLV_DB_SCALE(db_scale_gain2, -10350, 50, 1);
602 601
603static int __devinit se200pci_add_controls(struct snd_ice1712 *ice) 602static int se200pci_add_controls(struct snd_ice1712 *ice)
604{ 603{
605 int i; 604 int i;
606 struct snd_kcontrol_new cont; 605 struct snd_kcontrol_new cont;
@@ -678,7 +677,7 @@ static int __devinit se200pci_add_controls(struct snd_ice1712 *ice)
678/* probe/initialize/setup */ 677/* probe/initialize/setup */
679/****************************************************************************/ 678/****************************************************************************/
680 679
681static int __devinit se_init(struct snd_ice1712 *ice) 680static int se_init(struct snd_ice1712 *ice)
682{ 681{
683 struct se_spec *spec; 682 struct se_spec *spec;
684 683
@@ -706,7 +705,7 @@ static int __devinit se_init(struct snd_ice1712 *ice)
706 return -ENOENT; 705 return -ENOENT;
707} 706}
708 707
709static int __devinit se_add_controls(struct snd_ice1712 *ice) 708static int se_add_controls(struct snd_ice1712 *ice)
710{ 709{
711 int err; 710 int err;
712 711
@@ -723,7 +722,7 @@ static int __devinit se_add_controls(struct snd_ice1712 *ice)
723/* entry point */ 722/* entry point */
724/****************************************************************************/ 723/****************************************************************************/
725 724
726static unsigned char se200pci_eeprom[] __devinitdata = { 725static unsigned char se200pci_eeprom[] = {
727 [ICE_EEP2_SYSCONF] = 0x4b, /* 49.152Hz, spdif-in/ADC, 4DACs */ 726 [ICE_EEP2_SYSCONF] = 0x4b, /* 49.152Hz, spdif-in/ADC, 4DACs */
728 [ICE_EEP2_ACLINK] = 0x80, /* I2S */ 727 [ICE_EEP2_ACLINK] = 0x80, /* I2S */
729 [ICE_EEP2_I2S] = 0x78, /* 96k-ok, 24bit, 192k-ok */ 728 [ICE_EEP2_I2S] = 0x78, /* 96k-ok, 24bit, 192k-ok */
@@ -742,7 +741,7 @@ static unsigned char se200pci_eeprom[] __devinitdata = {
742 [ICE_EEP2_GPIO_STATE2] = 0x07, /* WM8766 ML/MC/MD */ 741 [ICE_EEP2_GPIO_STATE2] = 0x07, /* WM8766 ML/MC/MD */
743}; 742};
744 743
745static unsigned char se90pci_eeprom[] __devinitdata = { 744static unsigned char se90pci_eeprom[] = {
746 [ICE_EEP2_SYSCONF] = 0x4b, /* 49.152Hz, spdif-in/ADC, 4DACs */ 745 [ICE_EEP2_SYSCONF] = 0x4b, /* 49.152Hz, spdif-in/ADC, 4DACs */
747 [ICE_EEP2_ACLINK] = 0x80, /* I2S */ 746 [ICE_EEP2_ACLINK] = 0x80, /* I2S */
748 [ICE_EEP2_I2S] = 0x78, /* 96k-ok, 24bit, 192k-ok */ 747 [ICE_EEP2_I2S] = 0x78, /* 96k-ok, 24bit, 192k-ok */
@@ -751,7 +750,7 @@ static unsigned char se90pci_eeprom[] __devinitdata = {
751 /* ALL GPIO bits are in input mode */ 750 /* ALL GPIO bits are in input mode */
752}; 751};
753 752
754struct snd_ice1712_card_info snd_vt1724_se_cards[] __devinitdata = { 753struct snd_ice1712_card_info snd_vt1724_se_cards[] = {
755 { 754 {
756 .subvendor = VT1724_SUBDEVICE_SE200PCI, 755 .subvendor = VT1724_SUBDEVICE_SE200PCI,
757 .name = "ONKYO SE200PCI", 756 .name = "ONKYO SE200PCI",
diff --git a/sound/pci/ice1712/vt1720_mobo.c b/sound/pci/ice1712/vt1720_mobo.c
index 4c551e147c08..5dbb867e642c 100644
--- a/sound/pci/ice1712/vt1720_mobo.c
+++ b/sound/pci/ice1712/vt1720_mobo.c
@@ -21,7 +21,6 @@
21 * 21 *
22 */ 22 */
23 23
24#include <asm/io.h>
25#include <linux/delay.h> 24#include <linux/delay.h>
26#include <linux/interrupt.h> 25#include <linux/interrupt.h>
27#include <linux/init.h> 26#include <linux/init.h>
@@ -32,7 +31,7 @@
32#include "vt1720_mobo.h" 31#include "vt1720_mobo.h"
33 32
34 33
35static int __devinit k8x800_init(struct snd_ice1712 *ice) 34static int k8x800_init(struct snd_ice1712 *ice)
36{ 35{
37 ice->vt1720 = 1; 36 ice->vt1720 = 1;
38 37
@@ -46,7 +45,7 @@ static int __devinit k8x800_init(struct snd_ice1712 *ice)
46 return 0; 45 return 0;
47} 46}
48 47
49static int __devinit k8x800_add_controls(struct snd_ice1712 *ice) 48static int k8x800_add_controls(struct snd_ice1712 *ice)
50{ 49{
51 /* FIXME: needs some quirks for VT1616? */ 50 /* FIXME: needs some quirks for VT1616? */
52 return 0; 51 return 0;
@@ -54,7 +53,7 @@ static int __devinit k8x800_add_controls(struct snd_ice1712 *ice)
54 53
55/* EEPROM image */ 54/* EEPROM image */
56 55
57static unsigned char k8x800_eeprom[] __devinitdata = { 56static unsigned char k8x800_eeprom[] = {
58 [ICE_EEP2_SYSCONF] = 0x01, /* clock 256, 1ADC, 2DACs */ 57 [ICE_EEP2_SYSCONF] = 0x01, /* clock 256, 1ADC, 2DACs */
59 [ICE_EEP2_ACLINK] = 0x02, /* ACLINK, packed */ 58 [ICE_EEP2_ACLINK] = 0x02, /* ACLINK, packed */
60 [ICE_EEP2_I2S] = 0x00, /* - */ 59 [ICE_EEP2_I2S] = 0x00, /* - */
@@ -70,7 +69,7 @@ static unsigned char k8x800_eeprom[] __devinitdata = {
70 [ICE_EEP2_GPIO_STATE2] = 0x00, /* - */ 69 [ICE_EEP2_GPIO_STATE2] = 0x00, /* - */
71}; 70};
72 71
73static unsigned char sn25p_eeprom[] __devinitdata = { 72static unsigned char sn25p_eeprom[] = {
74 [ICE_EEP2_SYSCONF] = 0x01, /* clock 256, 1ADC, 2DACs */ 73 [ICE_EEP2_SYSCONF] = 0x01, /* clock 256, 1ADC, 2DACs */
75 [ICE_EEP2_ACLINK] = 0x02, /* ACLINK, packed */ 74 [ICE_EEP2_ACLINK] = 0x02, /* ACLINK, packed */
76 [ICE_EEP2_I2S] = 0x00, /* - */ 75 [ICE_EEP2_I2S] = 0x00, /* - */
@@ -88,7 +87,7 @@ static unsigned char sn25p_eeprom[] __devinitdata = {
88 87
89 88
90/* entry point */ 89/* entry point */
91struct snd_ice1712_card_info snd_vt1720_mobo_cards[] __devinitdata = { 90struct snd_ice1712_card_info snd_vt1720_mobo_cards[] = {
92 { 91 {
93 .subvendor = VT1720_SUBDEVICE_K8X800, 92 .subvendor = VT1720_SUBDEVICE_K8X800,
94 .name = "Albatron K8X800 Pro II", 93 .name = "Albatron K8X800 Pro II",
diff --git a/sound/pci/ice1712/wm8766.c b/sound/pci/ice1712/wm8766.c
new file mode 100644
index 000000000000..8072adeecf68
--- /dev/null
+++ b/sound/pci/ice1712/wm8766.c
@@ -0,0 +1,361 @@
1/*
2 * ALSA driver for ICEnsemble VT17xx
3 *
4 * Lowlevel functions for WM8766 codec
5 *
6 * Copyright (c) 2012 Ondrej Zary <linux@rainbow-software.org>
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 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 *
22 */
23
24#include <linux/delay.h>
25#include <sound/core.h>
26#include <sound/control.h>
27#include <sound/tlv.h>
28#include "wm8766.h"
29
30/* low-level access */
31
32static void snd_wm8766_write(struct snd_wm8766 *wm, u16 addr, u16 data)
33{
34 if (addr < WM8766_REG_RESET)
35 wm->regs[addr] = data;
36 wm->ops.write(wm, addr, data);
37}
38
39/* mixer controls */
40
41static const DECLARE_TLV_DB_SCALE(wm8766_tlv, -12750, 50, 1);
42
43static struct snd_wm8766_ctl snd_wm8766_default_ctl[WM8766_CTL_COUNT] = {
44 [WM8766_CTL_CH1_VOL] = {
45 .name = "Channel 1 Playback Volume",
46 .type = SNDRV_CTL_ELEM_TYPE_INTEGER,
47 .tlv = wm8766_tlv,
48 .reg1 = WM8766_REG_DACL1,
49 .reg2 = WM8766_REG_DACR1,
50 .mask1 = WM8766_VOL_MASK,
51 .mask2 = WM8766_VOL_MASK,
52 .max = 0xff,
53 .flags = WM8766_FLAG_STEREO | WM8766_FLAG_VOL_UPDATE,
54 },
55 [WM8766_CTL_CH2_VOL] = {
56 .name = "Channel 2 Playback Volume",
57 .type = SNDRV_CTL_ELEM_TYPE_INTEGER,
58 .tlv = wm8766_tlv,
59 .reg1 = WM8766_REG_DACL2,
60 .reg2 = WM8766_REG_DACR2,
61 .mask1 = WM8766_VOL_MASK,
62 .mask2 = WM8766_VOL_MASK,
63 .max = 0xff,
64 .flags = WM8766_FLAG_STEREO | WM8766_FLAG_VOL_UPDATE,
65 },
66 [WM8766_CTL_CH3_VOL] = {
67 .name = "Channel 3 Playback Volume",
68 .type = SNDRV_CTL_ELEM_TYPE_INTEGER,
69 .tlv = wm8766_tlv,
70 .reg1 = WM8766_REG_DACL3,
71 .reg2 = WM8766_REG_DACR3,
72 .mask1 = WM8766_VOL_MASK,
73 .mask2 = WM8766_VOL_MASK,
74 .max = 0xff,
75 .flags = WM8766_FLAG_STEREO | WM8766_FLAG_VOL_UPDATE,
76 },
77 [WM8766_CTL_CH1_SW] = {
78 .name = "Channel 1 Playback Switch",
79 .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN,
80 .reg1 = WM8766_REG_DACCTRL2,
81 .mask1 = WM8766_DAC2_MUTE1,
82 .flags = WM8766_FLAG_INVERT,
83 },
84 [WM8766_CTL_CH2_SW] = {
85 .name = "Channel 2 Playback Switch",
86 .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN,
87 .reg1 = WM8766_REG_DACCTRL2,
88 .mask1 = WM8766_DAC2_MUTE2,
89 .flags = WM8766_FLAG_INVERT,
90 },
91 [WM8766_CTL_CH3_SW] = {
92 .name = "Channel 3 Playback Switch",
93 .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN,
94 .reg1 = WM8766_REG_DACCTRL2,
95 .mask1 = WM8766_DAC2_MUTE3,
96 .flags = WM8766_FLAG_INVERT,
97 },
98 [WM8766_CTL_PHASE1_SW] = {
99 .name = "Channel 1 Phase Invert Playback Switch",
100 .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN,
101 .reg1 = WM8766_REG_IFCTRL,
102 .mask1 = WM8766_PHASE_INVERT1,
103 },
104 [WM8766_CTL_PHASE2_SW] = {
105 .name = "Channel 2 Phase Invert Playback Switch",
106 .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN,
107 .reg1 = WM8766_REG_IFCTRL,
108 .mask1 = WM8766_PHASE_INVERT2,
109 },
110 [WM8766_CTL_PHASE3_SW] = {
111 .name = "Channel 3 Phase Invert Playback Switch",
112 .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN,
113 .reg1 = WM8766_REG_IFCTRL,
114 .mask1 = WM8766_PHASE_INVERT3,
115 },
116 [WM8766_CTL_DEEMPH1_SW] = {
117 .name = "Channel 1 Deemphasis Playback Switch",
118 .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN,
119 .reg1 = WM8766_REG_DACCTRL2,
120 .mask1 = WM8766_DAC2_DEEMP1,
121 },
122 [WM8766_CTL_DEEMPH2_SW] = {
123 .name = "Channel 2 Deemphasis Playback Switch",
124 .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN,
125 .reg1 = WM8766_REG_DACCTRL2,
126 .mask1 = WM8766_DAC2_DEEMP2,
127 },
128 [WM8766_CTL_DEEMPH3_SW] = {
129 .name = "Channel 3 Deemphasis Playback Switch",
130 .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN,
131 .reg1 = WM8766_REG_DACCTRL2,
132 .mask1 = WM8766_DAC2_DEEMP3,
133 },
134 [WM8766_CTL_IZD_SW] = {
135 .name = "Infinite Zero Detect Playback Switch",
136 .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN,
137 .reg1 = WM8766_REG_DACCTRL1,
138 .mask1 = WM8766_DAC_IZD,
139 },
140 [WM8766_CTL_ZC_SW] = {
141 .name = "Zero Cross Detect Playback Switch",
142 .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN,
143 .reg1 = WM8766_REG_DACCTRL2,
144 .mask1 = WM8766_DAC2_ZCD,
145 .flags = WM8766_FLAG_INVERT,
146 },
147};
148
149/* exported functions */
150
151void snd_wm8766_init(struct snd_wm8766 *wm)
152{
153 int i;
154 static const u16 default_values[] = {
155 0x000, 0x100,
156 0x120, 0x000,
157 0x000, 0x100, 0x000, 0x100, 0x000,
158 0x000, 0x080,
159 };
160
161 memcpy(wm->ctl, snd_wm8766_default_ctl, sizeof(wm->ctl));
162
163 snd_wm8766_write(wm, WM8766_REG_RESET, 0x00); /* reset */
164 udelay(10);
165 /* load defaults */
166 for (i = 0; i < ARRAY_SIZE(default_values); i++)
167 snd_wm8766_write(wm, i, default_values[i]);
168}
169
170void snd_wm8766_resume(struct snd_wm8766 *wm)
171{
172 int i;
173
174 for (i = 0; i < WM8766_REG_COUNT; i++)
175 snd_wm8766_write(wm, i, wm->regs[i]);
176}
177
178void snd_wm8766_set_if(struct snd_wm8766 *wm, u16 dac)
179{
180 u16 val = wm->regs[WM8766_REG_IFCTRL] & ~WM8766_IF_MASK;
181
182 dac &= WM8766_IF_MASK;
183 snd_wm8766_write(wm, WM8766_REG_IFCTRL, val | dac);
184}
185
186void snd_wm8766_set_master_mode(struct snd_wm8766 *wm, u16 mode)
187{
188 u16 val = wm->regs[WM8766_REG_DACCTRL3] & ~WM8766_DAC3_MSTR_MASK;
189
190 mode &= WM8766_DAC3_MSTR_MASK;
191 snd_wm8766_write(wm, WM8766_REG_DACCTRL3, val | mode);
192}
193
194void snd_wm8766_set_power(struct snd_wm8766 *wm, u16 power)
195{
196 u16 val = wm->regs[WM8766_REG_DACCTRL3] & ~WM8766_DAC3_POWER_MASK;
197
198 power &= WM8766_DAC3_POWER_MASK;
199 snd_wm8766_write(wm, WM8766_REG_DACCTRL3, val | power);
200}
201
202void snd_wm8766_volume_restore(struct snd_wm8766 *wm)
203{
204 u16 val = wm->regs[WM8766_REG_DACR1];
205 /* restore volume after MCLK stopped */
206 snd_wm8766_write(wm, WM8766_REG_DACR1, val | WM8766_VOL_UPDATE);
207}
208
209/* mixer callbacks */
210
211static int snd_wm8766_volume_info(struct snd_kcontrol *kcontrol,
212 struct snd_ctl_elem_info *uinfo)
213{
214 struct snd_wm8766 *wm = snd_kcontrol_chip(kcontrol);
215 int n = kcontrol->private_value;
216
217 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
218 uinfo->count = (wm->ctl[n].flags & WM8766_FLAG_STEREO) ? 2 : 1;
219 uinfo->value.integer.min = wm->ctl[n].min;
220 uinfo->value.integer.max = wm->ctl[n].max;
221
222 return 0;
223}
224
225static int snd_wm8766_enum_info(struct snd_kcontrol *kcontrol,
226 struct snd_ctl_elem_info *uinfo)
227{
228 struct snd_wm8766 *wm = snd_kcontrol_chip(kcontrol);
229 int n = kcontrol->private_value;
230
231 return snd_ctl_enum_info(uinfo, 1, wm->ctl[n].max,
232 wm->ctl[n].enum_names);
233}
234
235static int snd_wm8766_ctl_get(struct snd_kcontrol *kcontrol,
236 struct snd_ctl_elem_value *ucontrol)
237{
238 struct snd_wm8766 *wm = snd_kcontrol_chip(kcontrol);
239 int n = kcontrol->private_value;
240 u16 val1, val2;
241
242 if (wm->ctl[n].get)
243 wm->ctl[n].get(wm, &val1, &val2);
244 else {
245 val1 = wm->regs[wm->ctl[n].reg1] & wm->ctl[n].mask1;
246 val1 >>= __ffs(wm->ctl[n].mask1);
247 if (wm->ctl[n].flags & WM8766_FLAG_STEREO) {
248 val2 = wm->regs[wm->ctl[n].reg2] & wm->ctl[n].mask2;
249 val2 >>= __ffs(wm->ctl[n].mask2);
250 if (wm->ctl[n].flags & WM8766_FLAG_VOL_UPDATE)
251 val2 &= ~WM8766_VOL_UPDATE;
252 }
253 }
254 if (wm->ctl[n].flags & WM8766_FLAG_INVERT) {
255 val1 = wm->ctl[n].max - (val1 - wm->ctl[n].min);
256 val2 = wm->ctl[n].max - (val2 - wm->ctl[n].min);
257 }
258 ucontrol->value.integer.value[0] = val1;
259 if (wm->ctl[n].flags & WM8766_FLAG_STEREO)
260 ucontrol->value.integer.value[1] = val2;
261
262 return 0;
263}
264
265static int snd_wm8766_ctl_put(struct snd_kcontrol *kcontrol,
266 struct snd_ctl_elem_value *ucontrol)
267{
268 struct snd_wm8766 *wm = snd_kcontrol_chip(kcontrol);
269 int n = kcontrol->private_value;
270 u16 val, regval1, regval2;
271
272 /* this also works for enum because value is an union */
273 regval1 = ucontrol->value.integer.value[0];
274 regval2 = ucontrol->value.integer.value[1];
275 if (wm->ctl[n].flags & WM8766_FLAG_INVERT) {
276 regval1 = wm->ctl[n].max - (regval1 - wm->ctl[n].min);
277 regval2 = wm->ctl[n].max - (regval2 - wm->ctl[n].min);
278 }
279 if (wm->ctl[n].set)
280 wm->ctl[n].set(wm, regval1, regval2);
281 else {
282 val = wm->regs[wm->ctl[n].reg1] & ~wm->ctl[n].mask1;
283 val |= regval1 << __ffs(wm->ctl[n].mask1);
284 /* both stereo controls in one register */
285 if (wm->ctl[n].flags & WM8766_FLAG_STEREO &&
286 wm->ctl[n].reg1 == wm->ctl[n].reg2) {
287 val &= ~wm->ctl[n].mask2;
288 val |= regval2 << __ffs(wm->ctl[n].mask2);
289 }
290 snd_wm8766_write(wm, wm->ctl[n].reg1, val);
291 /* stereo controls in different registers */
292 if (wm->ctl[n].flags & WM8766_FLAG_STEREO &&
293 wm->ctl[n].reg1 != wm->ctl[n].reg2) {
294 val = wm->regs[wm->ctl[n].reg2] & ~wm->ctl[n].mask2;
295 val |= regval2 << __ffs(wm->ctl[n].mask2);
296 if (wm->ctl[n].flags & WM8766_FLAG_VOL_UPDATE)
297 val |= WM8766_VOL_UPDATE;
298 snd_wm8766_write(wm, wm->ctl[n].reg2, val);
299 }
300 }
301
302 return 0;
303}
304
305static int snd_wm8766_add_control(struct snd_wm8766 *wm, int num)
306{
307 struct snd_kcontrol_new cont;
308 struct snd_kcontrol *ctl;
309
310 memset(&cont, 0, sizeof(cont));
311 cont.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
312 cont.private_value = num;
313 cont.name = wm->ctl[num].name;
314 cont.access = SNDRV_CTL_ELEM_ACCESS_READWRITE;
315 if (wm->ctl[num].flags & WM8766_FLAG_LIM ||
316 wm->ctl[num].flags & WM8766_FLAG_ALC)
317 cont.access |= SNDRV_CTL_ELEM_ACCESS_INACTIVE;
318 cont.tlv.p = NULL;
319 cont.get = snd_wm8766_ctl_get;
320 cont.put = snd_wm8766_ctl_put;
321
322 switch (wm->ctl[num].type) {
323 case SNDRV_CTL_ELEM_TYPE_INTEGER:
324 cont.info = snd_wm8766_volume_info;
325 cont.access |= SNDRV_CTL_ELEM_ACCESS_TLV_READ;
326 cont.tlv.p = wm->ctl[num].tlv;
327 break;
328 case SNDRV_CTL_ELEM_TYPE_BOOLEAN:
329 wm->ctl[num].max = 1;
330 if (wm->ctl[num].flags & WM8766_FLAG_STEREO)
331 cont.info = snd_ctl_boolean_stereo_info;
332 else
333 cont.info = snd_ctl_boolean_mono_info;
334 break;
335 case SNDRV_CTL_ELEM_TYPE_ENUMERATED:
336 cont.info = snd_wm8766_enum_info;
337 break;
338 default:
339 return -EINVAL;
340 }
341 ctl = snd_ctl_new1(&cont, wm);
342 if (!ctl)
343 return -ENOMEM;
344 wm->ctl[num].kctl = ctl;
345
346 return snd_ctl_add(wm->card, ctl);
347}
348
349int snd_wm8766_build_controls(struct snd_wm8766 *wm)
350{
351 int err, i;
352
353 for (i = 0; i < WM8766_CTL_COUNT; i++)
354 if (wm->ctl[i].name) {
355 err = snd_wm8766_add_control(wm, i);
356 if (err < 0)
357 return err;
358 }
359
360 return 0;
361}
diff --git a/sound/pci/ice1712/wm8766.h b/sound/pci/ice1712/wm8766.h
new file mode 100644
index 000000000000..c119f84bd2c2
--- /dev/null
+++ b/sound/pci/ice1712/wm8766.h
@@ -0,0 +1,163 @@
1#ifndef __SOUND_WM8766_H
2#define __SOUND_WM8766_H
3
4/*
5 * ALSA driver for ICEnsemble VT17xx
6 *
7 * Lowlevel functions for WM8766 codec
8 *
9 * Copyright (c) 2012 Ondrej Zary <linux@rainbow-software.org>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 *
25 */
26
27#define WM8766_REG_DACL1 0x00
28#define WM8766_REG_DACR1 0x01
29#define WM8766_VOL_MASK 0x1ff /* incl. update bit */
30#define WM8766_VOL_UPDATE (1 << 8) /* update volume */
31#define WM8766_REG_DACCTRL1 0x02
32#define WM8766_DAC_MUTEALL (1 << 0)
33#define WM8766_DAC_DEEMPALL (1 << 1)
34#define WM8766_DAC_PDWN (1 << 2)
35#define WM8766_DAC_ATC (1 << 3)
36#define WM8766_DAC_IZD (1 << 4)
37#define WM8766_DAC_PL_MASK 0x1e0
38#define WM8766_DAC_PL_LL (1 << 5) /* L chan: L signal */
39#define WM8766_DAC_PL_LR (2 << 5) /* L chan: R signal */
40#define WM8766_DAC_PL_LB (3 << 5) /* L chan: both */
41#define WM8766_DAC_PL_RL (1 << 7) /* R chan: L signal */
42#define WM8766_DAC_PL_RR (2 << 7) /* R chan: R signal */
43#define WM8766_DAC_PL_RB (3 << 7) /* R chan: both */
44#define WM8766_REG_IFCTRL 0x03
45#define WM8766_IF_FMT_RIGHTJ (0 << 0)
46#define WM8766_IF_FMT_LEFTJ (1 << 0)
47#define WM8766_IF_FMT_I2S (2 << 0)
48#define WM8766_IF_FMT_DSP (3 << 0)
49#define WM8766_IF_DSP_LATE (1 << 2) /* in DSP mode */
50#define WM8766_IF_LRC_INVERTED (1 << 2) /* in other modes */
51#define WM8766_IF_BCLK_INVERTED (1 << 3)
52#define WM8766_IF_IWL_16BIT (0 << 4)
53#define WM8766_IF_IWL_20BIT (1 << 4)
54#define WM8766_IF_IWL_24BIT (2 << 4)
55#define WM8766_IF_IWL_32BIT (3 << 4)
56#define WM8766_IF_MASK 0x3f
57#define WM8766_PHASE_INVERT1 (1 << 6)
58#define WM8766_PHASE_INVERT2 (1 << 7)
59#define WM8766_PHASE_INVERT3 (1 << 8)
60#define WM8766_REG_DACL2 0x04
61#define WM8766_REG_DACR2 0x05
62#define WM8766_REG_DACL3 0x06
63#define WM8766_REG_DACR3 0x07
64#define WM8766_REG_MASTDA 0x08
65#define WM8766_REG_DACCTRL2 0x09
66#define WM8766_DAC2_ZCD (1 << 0)
67#define WM8766_DAC2_ZFLAG_ALL (0 << 1)
68#define WM8766_DAC2_ZFLAG_1 (1 << 1)
69#define WM8766_DAC2_ZFLAG_2 (2 << 1)
70#define WM8766_DAC2_ZFLAG_3 (3 << 1)
71#define WM8766_DAC2_MUTE1 (1 << 3)
72#define WM8766_DAC2_MUTE2 (1 << 4)
73#define WM8766_DAC2_MUTE3 (1 << 5)
74#define WM8766_DAC2_DEEMP1 (1 << 6)
75#define WM8766_DAC2_DEEMP2 (1 << 7)
76#define WM8766_DAC2_DEEMP3 (1 << 8)
77#define WM8766_REG_DACCTRL3 0x0a
78#define WM8766_DAC3_DACPD1 (1 << 1)
79#define WM8766_DAC3_DACPD2 (1 << 2)
80#define WM8766_DAC3_DACPD3 (1 << 3)
81#define WM8766_DAC3_PWRDNALL (1 << 4)
82#define WM8766_DAC3_POWER_MASK 0x1e
83#define WM8766_DAC3_MASTER (1 << 5)
84#define WM8766_DAC3_DAC128FS (0 << 6)
85#define WM8766_DAC3_DAC192FS (1 << 6)
86#define WM8766_DAC3_DAC256FS (2 << 6)
87#define WM8766_DAC3_DAC384FS (3 << 6)
88#define WM8766_DAC3_DAC512FS (4 << 6)
89#define WM8766_DAC3_DAC768FS (5 << 6)
90#define WM8766_DAC3_MSTR_MASK 0x1e0
91#define WM8766_REG_MUTE1 0x0c
92#define WM8766_MUTE1_MPD (1 << 6)
93#define WM8766_REG_MUTE2 0x0f
94#define WM8766_MUTE2_MPD (1 << 5)
95#define WM8766_REG_RESET 0x1f
96
97#define WM8766_REG_COUNT 0x10 /* don't cache the RESET register */
98
99struct snd_wm8766;
100
101struct snd_wm8766_ops {
102 void (*write)(struct snd_wm8766 *wm, u16 addr, u16 data);
103};
104
105enum snd_wm8766_ctl_id {
106 WM8766_CTL_CH1_VOL,
107 WM8766_CTL_CH2_VOL,
108 WM8766_CTL_CH3_VOL,
109 WM8766_CTL_CH1_SW,
110 WM8766_CTL_CH2_SW,
111 WM8766_CTL_CH3_SW,
112 WM8766_CTL_PHASE1_SW,
113 WM8766_CTL_PHASE2_SW,
114 WM8766_CTL_PHASE3_SW,
115 WM8766_CTL_DEEMPH1_SW,
116 WM8766_CTL_DEEMPH2_SW,
117 WM8766_CTL_DEEMPH3_SW,
118 WM8766_CTL_IZD_SW,
119 WM8766_CTL_ZC_SW,
120
121 WM8766_CTL_COUNT,
122};
123
124#define WM8766_ENUM_MAX 16
125
126#define WM8766_FLAG_STEREO (1 << 0)
127#define WM8766_FLAG_VOL_UPDATE (1 << 1)
128#define WM8766_FLAG_INVERT (1 << 2)
129#define WM8766_FLAG_LIM (1 << 3)
130#define WM8766_FLAG_ALC (1 << 4)
131
132struct snd_wm8766_ctl {
133 struct snd_kcontrol *kctl;
134 const char *name;
135 snd_ctl_elem_type_t type;
136 const char *const enum_names[WM8766_ENUM_MAX];
137 const unsigned int *tlv;
138 u16 reg1, reg2, mask1, mask2, min, max, flags;
139 void (*set)(struct snd_wm8766 *wm, u16 ch1, u16 ch2);
140 void (*get)(struct snd_wm8766 *wm, u16 *ch1, u16 *ch2);
141};
142
143enum snd_wm8766_agc_mode { WM8766_AGC_OFF, WM8766_AGC_LIM, WM8766_AGC_ALC };
144
145struct snd_wm8766 {
146 struct snd_card *card;
147 struct snd_wm8766_ctl ctl[WM8766_CTL_COUNT];
148 enum snd_wm8766_agc_mode agc_mode;
149 struct snd_wm8766_ops ops;
150 u16 regs[WM8766_REG_COUNT]; /* 9-bit registers */
151};
152
153
154
155void snd_wm8766_init(struct snd_wm8766 *wm);
156void snd_wm8766_resume(struct snd_wm8766 *wm);
157void snd_wm8766_set_if(struct snd_wm8766 *wm, u16 dac);
158void snd_wm8766_set_master_mode(struct snd_wm8766 *wm, u16 mode);
159void snd_wm8766_set_power(struct snd_wm8766 *wm, u16 power);
160void snd_wm8766_volume_restore(struct snd_wm8766 *wm);
161int snd_wm8766_build_controls(struct snd_wm8766 *wm);
162
163#endif /* __SOUND_WM8766_H */
diff --git a/sound/pci/ice1712/wm8776.c b/sound/pci/ice1712/wm8776.c
new file mode 100644
index 000000000000..a3c05fe5daf9
--- /dev/null
+++ b/sound/pci/ice1712/wm8776.c
@@ -0,0 +1,633 @@
1/*
2 * ALSA driver for ICEnsemble VT17xx
3 *
4 * Lowlevel functions for WM8776 codec
5 *
6 * Copyright (c) 2012 Ondrej Zary <linux@rainbow-software.org>
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 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 *
22 */
23
24#include <linux/delay.h>
25#include <sound/core.h>
26#include <sound/control.h>
27#include <sound/tlv.h>
28#include "wm8776.h"
29
30/* low-level access */
31
32static void snd_wm8776_write(struct snd_wm8776 *wm, u16 addr, u16 data)
33{
34 u8 bus_addr = addr << 1 | data >> 8; /* addr + 9th data bit */
35 u8 bus_data = data & 0xff; /* remaining 8 data bits */
36
37 if (addr < WM8776_REG_RESET)
38 wm->regs[addr] = data;
39 wm->ops.write(wm, bus_addr, bus_data);
40}
41
42/* register-level functions */
43
44static void snd_wm8776_activate_ctl(struct snd_wm8776 *wm,
45 const char *ctl_name,
46 bool active)
47{
48 struct snd_card *card = wm->card;
49 struct snd_kcontrol *kctl;
50 struct snd_kcontrol_volatile *vd;
51 struct snd_ctl_elem_id elem_id;
52 unsigned int index_offset;
53
54 memset(&elem_id, 0, sizeof(elem_id));
55 strncpy(elem_id.name, ctl_name, sizeof(elem_id.name));
56 elem_id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
57 kctl = snd_ctl_find_id(card, &elem_id);
58 if (!kctl)
59 return;
60 index_offset = snd_ctl_get_ioff(kctl, &kctl->id);
61 vd = &kctl->vd[index_offset];
62 if (active)
63 vd->access &= ~SNDRV_CTL_ELEM_ACCESS_INACTIVE;
64 else
65 vd->access |= SNDRV_CTL_ELEM_ACCESS_INACTIVE;
66 snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_INFO, &kctl->id);
67}
68
69static void snd_wm8776_update_agc_ctl(struct snd_wm8776 *wm)
70{
71 int i, flags_on = 0, flags_off = 0;
72
73 switch (wm->agc_mode) {
74 case WM8776_AGC_OFF:
75 flags_off = WM8776_FLAG_LIM | WM8776_FLAG_ALC;
76 break;
77 case WM8776_AGC_LIM:
78 flags_off = WM8776_FLAG_ALC;
79 flags_on = WM8776_FLAG_LIM;
80 break;
81 case WM8776_AGC_ALC_R:
82 case WM8776_AGC_ALC_L:
83 case WM8776_AGC_ALC_STEREO:
84 flags_off = WM8776_FLAG_LIM;
85 flags_on = WM8776_FLAG_ALC;
86 break;
87 }
88
89 for (i = 0; i < WM8776_CTL_COUNT; i++)
90 if (wm->ctl[i].flags & flags_off)
91 snd_wm8776_activate_ctl(wm, wm->ctl[i].name, false);
92 else if (wm->ctl[i].flags & flags_on)
93 snd_wm8776_activate_ctl(wm, wm->ctl[i].name, true);
94}
95
96static void snd_wm8776_set_agc(struct snd_wm8776 *wm, u16 agc, u16 nothing)
97{
98 u16 alc1 = wm->regs[WM8776_REG_ALCCTRL1] & ~WM8776_ALC1_LCT_MASK;
99 u16 alc2 = wm->regs[WM8776_REG_ALCCTRL2] & ~WM8776_ALC2_LCEN;
100
101 switch (agc) {
102 case 0: /* Off */
103 wm->agc_mode = WM8776_AGC_OFF;
104 break;
105 case 1: /* Limiter */
106 alc2 |= WM8776_ALC2_LCEN;
107 wm->agc_mode = WM8776_AGC_LIM;
108 break;
109 case 2: /* ALC Right */
110 alc1 |= WM8776_ALC1_LCSEL_ALCR;
111 alc2 |= WM8776_ALC2_LCEN;
112 wm->agc_mode = WM8776_AGC_ALC_R;
113 break;
114 case 3: /* ALC Left */
115 alc1 |= WM8776_ALC1_LCSEL_ALCL;
116 alc2 |= WM8776_ALC2_LCEN;
117 wm->agc_mode = WM8776_AGC_ALC_L;
118 break;
119 case 4: /* ALC Stereo */
120 alc1 |= WM8776_ALC1_LCSEL_ALCSTEREO;
121 alc2 |= WM8776_ALC2_LCEN;
122 wm->agc_mode = WM8776_AGC_ALC_STEREO;
123 break;
124 }
125 snd_wm8776_write(wm, WM8776_REG_ALCCTRL1, alc1);
126 snd_wm8776_write(wm, WM8776_REG_ALCCTRL2, alc2);
127 snd_wm8776_update_agc_ctl(wm);
128}
129
130static void snd_wm8776_get_agc(struct snd_wm8776 *wm, u16 *mode, u16 *nothing)
131{
132 *mode = wm->agc_mode;
133}
134
135/* mixer controls */
136
137static const DECLARE_TLV_DB_SCALE(wm8776_hp_tlv, -7400, 100, 1);
138static const DECLARE_TLV_DB_SCALE(wm8776_dac_tlv, -12750, 50, 1);
139static const DECLARE_TLV_DB_SCALE(wm8776_adc_tlv, -10350, 50, 1);
140static const DECLARE_TLV_DB_SCALE(wm8776_lct_tlv, -1600, 100, 0);
141static const DECLARE_TLV_DB_SCALE(wm8776_maxgain_tlv, 0, 400, 0);
142static const DECLARE_TLV_DB_SCALE(wm8776_ngth_tlv, -7800, 600, 0);
143static const DECLARE_TLV_DB_SCALE(wm8776_maxatten_lim_tlv, -1200, 100, 0);
144static const DECLARE_TLV_DB_SCALE(wm8776_maxatten_alc_tlv, -2100, 400, 0);
145
146static struct snd_wm8776_ctl snd_wm8776_default_ctl[WM8776_CTL_COUNT] = {
147 [WM8776_CTL_DAC_VOL] = {
148 .name = "Master Playback Volume",
149 .type = SNDRV_CTL_ELEM_TYPE_INTEGER,
150 .tlv = wm8776_dac_tlv,
151 .reg1 = WM8776_REG_DACLVOL,
152 .reg2 = WM8776_REG_DACRVOL,
153 .mask1 = WM8776_DACVOL_MASK,
154 .mask2 = WM8776_DACVOL_MASK,
155 .max = 0xff,
156 .flags = WM8776_FLAG_STEREO | WM8776_FLAG_VOL_UPDATE,
157 },
158 [WM8776_CTL_DAC_SW] = {
159 .name = "Master Playback Switch",
160 .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN,
161 .reg1 = WM8776_REG_DACCTRL1,
162 .reg2 = WM8776_REG_DACCTRL1,
163 .mask1 = WM8776_DAC_PL_LL,
164 .mask2 = WM8776_DAC_PL_RR,
165 .flags = WM8776_FLAG_STEREO,
166 },
167 [WM8776_CTL_DAC_ZC_SW] = {
168 .name = "Master Zero Cross Detect Playback Switch",
169 .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN,
170 .reg1 = WM8776_REG_DACCTRL1,
171 .mask1 = WM8776_DAC_DZCEN,
172 },
173 [WM8776_CTL_HP_VOL] = {
174 .name = "Headphone Playback Volume",
175 .type = SNDRV_CTL_ELEM_TYPE_INTEGER,
176 .tlv = wm8776_hp_tlv,
177 .reg1 = WM8776_REG_HPLVOL,
178 .reg2 = WM8776_REG_HPRVOL,
179 .mask1 = WM8776_HPVOL_MASK,
180 .mask2 = WM8776_HPVOL_MASK,
181 .min = 0x2f,
182 .max = 0x7f,
183 .flags = WM8776_FLAG_STEREO | WM8776_FLAG_VOL_UPDATE,
184 },
185 [WM8776_CTL_HP_SW] = {
186 .name = "Headphone Playback Switch",
187 .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN,
188 .reg1 = WM8776_REG_PWRDOWN,
189 .mask1 = WM8776_PWR_HPPD,
190 .flags = WM8776_FLAG_INVERT,
191 },
192 [WM8776_CTL_HP_ZC_SW] = {
193 .name = "Headphone Zero Cross Detect Playback Switch",
194 .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN,
195 .reg1 = WM8776_REG_HPLVOL,
196 .reg2 = WM8776_REG_HPRVOL,
197 .mask1 = WM8776_VOL_HPZCEN,
198 .mask2 = WM8776_VOL_HPZCEN,
199 .flags = WM8776_FLAG_STEREO,
200 },
201 [WM8776_CTL_AUX_SW] = {
202 .name = "AUX Playback Switch",
203 .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN,
204 .reg1 = WM8776_REG_OUTMUX,
205 .mask1 = WM8776_OUTMUX_AUX,
206 },
207 [WM8776_CTL_BYPASS_SW] = {
208 .name = "Bypass Playback Switch",
209 .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN,
210 .reg1 = WM8776_REG_OUTMUX,
211 .mask1 = WM8776_OUTMUX_BYPASS,
212 },
213 [WM8776_CTL_DAC_IZD_SW] = {
214 .name = "Infinite Zero Detect Playback Switch",
215 .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN,
216 .reg1 = WM8776_REG_DACCTRL1,
217 .mask1 = WM8776_DAC_IZD,
218 },
219 [WM8776_CTL_PHASE_SW] = {
220 .name = "Phase Invert Playback Switch",
221 .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN,
222 .reg1 = WM8776_REG_PHASESWAP,
223 .reg2 = WM8776_REG_PHASESWAP,
224 .mask1 = WM8776_PHASE_INVERTL,
225 .mask2 = WM8776_PHASE_INVERTR,
226 .flags = WM8776_FLAG_STEREO,
227 },
228 [WM8776_CTL_DEEMPH_SW] = {
229 .name = "Deemphasis Playback Switch",
230 .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN,
231 .reg1 = WM8776_REG_DACCTRL2,
232 .mask1 = WM8776_DAC2_DEEMPH,
233 },
234 [WM8776_CTL_ADC_VOL] = {
235 .name = "Input Capture Volume",
236 .type = SNDRV_CTL_ELEM_TYPE_INTEGER,
237 .tlv = wm8776_adc_tlv,
238 .reg1 = WM8776_REG_ADCLVOL,
239 .reg2 = WM8776_REG_ADCRVOL,
240 .mask1 = WM8776_ADC_GAIN_MASK,
241 .mask2 = WM8776_ADC_GAIN_MASK,
242 .max = 0xff,
243 .flags = WM8776_FLAG_STEREO | WM8776_FLAG_VOL_UPDATE,
244 },
245 [WM8776_CTL_ADC_SW] = {
246 .name = "Input Capture Switch",
247 .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN,
248 .reg1 = WM8776_REG_ADCMUX,
249 .reg2 = WM8776_REG_ADCMUX,
250 .mask1 = WM8776_ADC_MUTEL,
251 .mask2 = WM8776_ADC_MUTER,
252 .flags = WM8776_FLAG_STEREO | WM8776_FLAG_INVERT,
253 },
254 [WM8776_CTL_INPUT1_SW] = {
255 .name = "AIN1 Capture Switch",
256 .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN,
257 .reg1 = WM8776_REG_ADCMUX,
258 .mask1 = WM8776_ADC_MUX_AIN1,
259 },
260 [WM8776_CTL_INPUT2_SW] = {
261 .name = "AIN2 Capture Switch",
262 .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN,
263 .reg1 = WM8776_REG_ADCMUX,
264 .mask1 = WM8776_ADC_MUX_AIN2,
265 },
266 [WM8776_CTL_INPUT3_SW] = {
267 .name = "AIN3 Capture Switch",
268 .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN,
269 .reg1 = WM8776_REG_ADCMUX,
270 .mask1 = WM8776_ADC_MUX_AIN3,
271 },
272 [WM8776_CTL_INPUT4_SW] = {
273 .name = "AIN4 Capture Switch",
274 .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN,
275 .reg1 = WM8776_REG_ADCMUX,
276 .mask1 = WM8776_ADC_MUX_AIN4,
277 },
278 [WM8776_CTL_INPUT5_SW] = {
279 .name = "AIN5 Capture Switch",
280 .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN,
281 .reg1 = WM8776_REG_ADCMUX,
282 .mask1 = WM8776_ADC_MUX_AIN5,
283 },
284 [WM8776_CTL_AGC_SEL] = {
285 .name = "AGC Select Capture Enum",
286 .type = SNDRV_CTL_ELEM_TYPE_ENUMERATED,
287 .enum_names = { "Off", "Limiter", "ALC Right", "ALC Left",
288 "ALC Stereo" },
289 .max = 5, /* .enum_names item count */
290 .set = snd_wm8776_set_agc,
291 .get = snd_wm8776_get_agc,
292 },
293 [WM8776_CTL_LIM_THR] = {
294 .name = "Limiter Threshold Capture Volume",
295 .type = SNDRV_CTL_ELEM_TYPE_INTEGER,
296 .tlv = wm8776_lct_tlv,
297 .reg1 = WM8776_REG_ALCCTRL1,
298 .mask1 = WM8776_ALC1_LCT_MASK,
299 .max = 15,
300 .flags = WM8776_FLAG_LIM,
301 },
302 [WM8776_CTL_LIM_ATK] = {
303 .name = "Limiter Attack Time Capture Enum",
304 .type = SNDRV_CTL_ELEM_TYPE_ENUMERATED,
305 .enum_names = { "0.25 ms", "0.5 ms", "1 ms", "2 ms", "4 ms",
306 "8 ms", "16 ms", "32 ms", "64 ms", "128 ms", "256 ms" },
307 .max = 11, /* .enum_names item count */
308 .reg1 = WM8776_REG_ALCCTRL3,
309 .mask1 = WM8776_ALC3_ATK_MASK,
310 .flags = WM8776_FLAG_LIM,
311 },
312 [WM8776_CTL_LIM_DCY] = {
313 .name = "Limiter Decay Time Capture Enum",
314 .type = SNDRV_CTL_ELEM_TYPE_ENUMERATED,
315 .enum_names = { "1.2 ms", "2.4 ms", "4.8 ms", "9.6 ms",
316 "19.2 ms", "38.4 ms", "76.8 ms", "154 ms", "307 ms",
317 "614 ms", "1.23 s" },
318 .max = 11, /* .enum_names item count */
319 .reg1 = WM8776_REG_ALCCTRL3,
320 .mask1 = WM8776_ALC3_DCY_MASK,
321 .flags = WM8776_FLAG_LIM,
322 },
323 [WM8776_CTL_LIM_TRANWIN] = {
324 .name = "Limiter Transient Window Capture Enum",
325 .type = SNDRV_CTL_ELEM_TYPE_ENUMERATED,
326 .enum_names = { "0 us", "62.5 us", "125 us", "250 us", "500 us",
327 "1 ms", "2 ms", "4 ms" },
328 .max = 8, /* .enum_names item count */
329 .reg1 = WM8776_REG_LIMITER,
330 .mask1 = WM8776_LIM_TRANWIN_MASK,
331 .flags = WM8776_FLAG_LIM,
332 },
333 [WM8776_CTL_LIM_MAXATTN] = {
334 .name = "Limiter Maximum Attenuation Capture Volume",
335 .type = SNDRV_CTL_ELEM_TYPE_INTEGER,
336 .tlv = wm8776_maxatten_lim_tlv,
337 .reg1 = WM8776_REG_LIMITER,
338 .mask1 = WM8776_LIM_MAXATTEN_MASK,
339 .min = 3,
340 .max = 12,
341 .flags = WM8776_FLAG_LIM | WM8776_FLAG_INVERT,
342 },
343 [WM8776_CTL_ALC_TGT] = {
344 .name = "ALC Target Level Capture Volume",
345 .type = SNDRV_CTL_ELEM_TYPE_INTEGER,
346 .tlv = wm8776_lct_tlv,
347 .reg1 = WM8776_REG_ALCCTRL1,
348 .mask1 = WM8776_ALC1_LCT_MASK,
349 .max = 15,
350 .flags = WM8776_FLAG_ALC,
351 },
352 [WM8776_CTL_ALC_ATK] = {
353 .name = "ALC Attack Time Capture Enum",
354 .type = SNDRV_CTL_ELEM_TYPE_ENUMERATED,
355 .enum_names = { "8.40 ms", "16.8 ms", "33.6 ms", "67.2 ms",
356 "134 ms", "269 ms", "538 ms", "1.08 s", "2.15 s",
357 "4.3 s", "8.6 s" },
358 .max = 11, /* .enum_names item count */
359 .reg1 = WM8776_REG_ALCCTRL3,
360 .mask1 = WM8776_ALC3_ATK_MASK,
361 .flags = WM8776_FLAG_ALC,
362 },
363 [WM8776_CTL_ALC_DCY] = {
364 .name = "ALC Decay Time Capture Enum",
365 .type = SNDRV_CTL_ELEM_TYPE_ENUMERATED,
366 .enum_names = { "33.5 ms", "67.0 ms", "134 ms", "268 ms",
367 "536 ms", "1.07 s", "2.14 s", "4.29 s", "8.58 s",
368 "17.2 s", "34.3 s" },
369 .max = 11, /* .enum_names item count */
370 .reg1 = WM8776_REG_ALCCTRL3,
371 .mask1 = WM8776_ALC3_DCY_MASK,
372 .flags = WM8776_FLAG_ALC,
373 },
374 [WM8776_CTL_ALC_MAXGAIN] = {
375 .name = "ALC Maximum Gain Capture Volume",
376 .type = SNDRV_CTL_ELEM_TYPE_INTEGER,
377 .tlv = wm8776_maxgain_tlv,
378 .reg1 = WM8776_REG_ALCCTRL1,
379 .mask1 = WM8776_ALC1_MAXGAIN_MASK,
380 .min = 1,
381 .max = 7,
382 .flags = WM8776_FLAG_ALC,
383 },
384 [WM8776_CTL_ALC_MAXATTN] = {
385 .name = "ALC Maximum Attenuation Capture Volume",
386 .type = SNDRV_CTL_ELEM_TYPE_INTEGER,
387 .tlv = wm8776_maxatten_alc_tlv,
388 .reg1 = WM8776_REG_LIMITER,
389 .mask1 = WM8776_LIM_MAXATTEN_MASK,
390 .min = 10,
391 .max = 15,
392 .flags = WM8776_FLAG_ALC | WM8776_FLAG_INVERT,
393 },
394 [WM8776_CTL_ALC_HLD] = {
395 .name = "ALC Hold Time Capture Enum",
396 .type = SNDRV_CTL_ELEM_TYPE_ENUMERATED,
397 .enum_names = { "0 ms", "2.67 ms", "5.33 ms", "10.6 ms",
398 "21.3 ms", "42.7 ms", "85.3 ms", "171 ms", "341 ms",
399 "683 ms", "1.37 s", "2.73 s", "5.46 s", "10.9 s",
400 "21.8 s", "43.7 s" },
401 .max = 16, /* .enum_names item count */
402 .reg1 = WM8776_REG_ALCCTRL2,
403 .mask1 = WM8776_ALC2_HOLD_MASK,
404 .flags = WM8776_FLAG_ALC,
405 },
406 [WM8776_CTL_NGT_SW] = {
407 .name = "Noise Gate Capture Switch",
408 .type = SNDRV_CTL_ELEM_TYPE_BOOLEAN,
409 .reg1 = WM8776_REG_NOISEGATE,
410 .mask1 = WM8776_NGAT_ENABLE,
411 .flags = WM8776_FLAG_ALC,
412 },
413 [WM8776_CTL_NGT_THR] = {
414 .name = "Noise Gate Threshold Capture Volume",
415 .type = SNDRV_CTL_ELEM_TYPE_INTEGER,
416 .tlv = wm8776_ngth_tlv,
417 .reg1 = WM8776_REG_NOISEGATE,
418 .mask1 = WM8776_NGAT_THR_MASK,
419 .max = 7,
420 .flags = WM8776_FLAG_ALC,
421 },
422};
423
424/* exported functions */
425
426void snd_wm8776_init(struct snd_wm8776 *wm)
427{
428 int i;
429 static const u16 default_values[] = {
430 0x000, 0x100, 0x000,
431 0x000, 0x100, 0x000,
432 0x000, 0x090, 0x000, 0x000,
433 0x022, 0x022, 0x022,
434 0x008, 0x0cf, 0x0cf, 0x07b, 0x000,
435 0x032, 0x000, 0x0a6, 0x001, 0x001
436 };
437
438 memcpy(wm->ctl, snd_wm8776_default_ctl, sizeof(wm->ctl));
439
440 snd_wm8776_write(wm, WM8776_REG_RESET, 0x00); /* reset */
441 udelay(10);
442 /* load defaults */
443 for (i = 0; i < ARRAY_SIZE(default_values); i++)
444 snd_wm8776_write(wm, i, default_values[i]);
445}
446
447void snd_wm8776_resume(struct snd_wm8776 *wm)
448{
449 int i;
450
451 for (i = 0; i < WM8776_REG_COUNT; i++)
452 snd_wm8776_write(wm, i, wm->regs[i]);
453}
454
455void snd_wm8776_set_dac_if(struct snd_wm8776 *wm, u16 dac)
456{
457 snd_wm8776_write(wm, WM8776_REG_DACIFCTRL, dac);
458}
459
460void snd_wm8776_set_adc_if(struct snd_wm8776 *wm, u16 adc)
461{
462 snd_wm8776_write(wm, WM8776_REG_ADCIFCTRL, adc);
463}
464
465void snd_wm8776_set_master_mode(struct snd_wm8776 *wm, u16 mode)
466{
467 snd_wm8776_write(wm, WM8776_REG_MSTRCTRL, mode);
468}
469
470void snd_wm8776_set_power(struct snd_wm8776 *wm, u16 power)
471{
472 snd_wm8776_write(wm, WM8776_REG_PWRDOWN, power);
473}
474
475void snd_wm8776_volume_restore(struct snd_wm8776 *wm)
476{
477 u16 val = wm->regs[WM8776_REG_DACRVOL];
478 /* restore volume after MCLK stopped */
479 snd_wm8776_write(wm, WM8776_REG_DACRVOL, val | WM8776_VOL_UPDATE);
480}
481
482/* mixer callbacks */
483
484static int snd_wm8776_volume_info(struct snd_kcontrol *kcontrol,
485 struct snd_ctl_elem_info *uinfo)
486{
487 struct snd_wm8776 *wm = snd_kcontrol_chip(kcontrol);
488 int n = kcontrol->private_value;
489
490 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
491 uinfo->count = (wm->ctl[n].flags & WM8776_FLAG_STEREO) ? 2 : 1;
492 uinfo->value.integer.min = wm->ctl[n].min;
493 uinfo->value.integer.max = wm->ctl[n].max;
494
495 return 0;
496}
497
498static int snd_wm8776_enum_info(struct snd_kcontrol *kcontrol,
499 struct snd_ctl_elem_info *uinfo)
500{
501 struct snd_wm8776 *wm = snd_kcontrol_chip(kcontrol);
502 int n = kcontrol->private_value;
503
504 return snd_ctl_enum_info(uinfo, 1, wm->ctl[n].max,
505 wm->ctl[n].enum_names);
506}
507
508static int snd_wm8776_ctl_get(struct snd_kcontrol *kcontrol,
509 struct snd_ctl_elem_value *ucontrol)
510{
511 struct snd_wm8776 *wm = snd_kcontrol_chip(kcontrol);
512 int n = kcontrol->private_value;
513 u16 val1, val2;
514
515 if (wm->ctl[n].get)
516 wm->ctl[n].get(wm, &val1, &val2);
517 else {
518 val1 = wm->regs[wm->ctl[n].reg1] & wm->ctl[n].mask1;
519 val1 >>= __ffs(wm->ctl[n].mask1);
520 if (wm->ctl[n].flags & WM8776_FLAG_STEREO) {
521 val2 = wm->regs[wm->ctl[n].reg2] & wm->ctl[n].mask2;
522 val2 >>= __ffs(wm->ctl[n].mask2);
523 if (wm->ctl[n].flags & WM8776_FLAG_VOL_UPDATE)
524 val2 &= ~WM8776_VOL_UPDATE;
525 }
526 }
527 if (wm->ctl[n].flags & WM8776_FLAG_INVERT) {
528 val1 = wm->ctl[n].max - (val1 - wm->ctl[n].min);
529 val2 = wm->ctl[n].max - (val2 - wm->ctl[n].min);
530 }
531 ucontrol->value.integer.value[0] = val1;
532 if (wm->ctl[n].flags & WM8776_FLAG_STEREO)
533 ucontrol->value.integer.value[1] = val2;
534
535 return 0;
536}
537
538static int snd_wm8776_ctl_put(struct snd_kcontrol *kcontrol,
539 struct snd_ctl_elem_value *ucontrol)
540{
541 struct snd_wm8776 *wm = snd_kcontrol_chip(kcontrol);
542 int n = kcontrol->private_value;
543 u16 val, regval1, regval2;
544
545 /* this also works for enum because value is an union */
546 regval1 = ucontrol->value.integer.value[0];
547 regval2 = ucontrol->value.integer.value[1];
548 if (wm->ctl[n].flags & WM8776_FLAG_INVERT) {
549 regval1 = wm->ctl[n].max - (regval1 - wm->ctl[n].min);
550 regval2 = wm->ctl[n].max - (regval2 - wm->ctl[n].min);
551 }
552 if (wm->ctl[n].set)
553 wm->ctl[n].set(wm, regval1, regval2);
554 else {
555 val = wm->regs[wm->ctl[n].reg1] & ~wm->ctl[n].mask1;
556 val |= regval1 << __ffs(wm->ctl[n].mask1);
557 /* both stereo controls in one register */
558 if (wm->ctl[n].flags & WM8776_FLAG_STEREO &&
559 wm->ctl[n].reg1 == wm->ctl[n].reg2) {
560 val &= ~wm->ctl[n].mask2;
561 val |= regval2 << __ffs(wm->ctl[n].mask2);
562 }
563 snd_wm8776_write(wm, wm->ctl[n].reg1, val);
564 /* stereo controls in different registers */
565 if (wm->ctl[n].flags & WM8776_FLAG_STEREO &&
566 wm->ctl[n].reg1 != wm->ctl[n].reg2) {
567 val = wm->regs[wm->ctl[n].reg2] & ~wm->ctl[n].mask2;
568 val |= regval2 << __ffs(wm->ctl[n].mask2);
569 if (wm->ctl[n].flags & WM8776_FLAG_VOL_UPDATE)
570 val |= WM8776_VOL_UPDATE;
571 snd_wm8776_write(wm, wm->ctl[n].reg2, val);
572 }
573 }
574
575 return 0;
576}
577
578static int snd_wm8776_add_control(struct snd_wm8776 *wm, int num)
579{
580 struct snd_kcontrol_new cont;
581 struct snd_kcontrol *ctl;
582
583 memset(&cont, 0, sizeof(cont));
584 cont.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
585 cont.private_value = num;
586 cont.name = wm->ctl[num].name;
587 cont.access = SNDRV_CTL_ELEM_ACCESS_READWRITE;
588 if (wm->ctl[num].flags & WM8776_FLAG_LIM ||
589 wm->ctl[num].flags & WM8776_FLAG_ALC)
590 cont.access |= SNDRV_CTL_ELEM_ACCESS_INACTIVE;
591 cont.tlv.p = NULL;
592 cont.get = snd_wm8776_ctl_get;
593 cont.put = snd_wm8776_ctl_put;
594
595 switch (wm->ctl[num].type) {
596 case SNDRV_CTL_ELEM_TYPE_INTEGER:
597 cont.info = snd_wm8776_volume_info;
598 cont.access |= SNDRV_CTL_ELEM_ACCESS_TLV_READ;
599 cont.tlv.p = wm->ctl[num].tlv;
600 break;
601 case SNDRV_CTL_ELEM_TYPE_BOOLEAN:
602 wm->ctl[num].max = 1;
603 if (wm->ctl[num].flags & WM8776_FLAG_STEREO)
604 cont.info = snd_ctl_boolean_stereo_info;
605 else
606 cont.info = snd_ctl_boolean_mono_info;
607 break;
608 case SNDRV_CTL_ELEM_TYPE_ENUMERATED:
609 cont.info = snd_wm8776_enum_info;
610 break;
611 default:
612 return -EINVAL;
613 }
614 ctl = snd_ctl_new1(&cont, wm);
615 if (!ctl)
616 return -ENOMEM;
617
618 return snd_ctl_add(wm->card, ctl);
619}
620
621int snd_wm8776_build_controls(struct snd_wm8776 *wm)
622{
623 int err, i;
624
625 for (i = 0; i < WM8776_CTL_COUNT; i++)
626 if (wm->ctl[i].name) {
627 err = snd_wm8776_add_control(wm, i);
628 if (err < 0)
629 return err;
630 }
631
632 return 0;
633}
diff --git a/sound/pci/ice1712/wm8776.h b/sound/pci/ice1712/wm8776.h
new file mode 100644
index 000000000000..93a2d6971154
--- /dev/null
+++ b/sound/pci/ice1712/wm8776.h
@@ -0,0 +1,226 @@
1#ifndef __SOUND_WM8776_H
2#define __SOUND_WM8776_H
3
4/*
5 * ALSA driver for ICEnsemble VT17xx
6 *
7 * Lowlevel functions for WM8776 codec
8 *
9 * Copyright (c) 2012 Ondrej Zary <linux@rainbow-software.org>
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, write to the Free Software
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 *
25 */
26
27#define WM8776_REG_HPLVOL 0x00
28#define WM8776_REG_HPRVOL 0x01
29#define WM8776_REG_HPMASTER 0x02
30#define WM8776_HPVOL_MASK 0x17f /* incl. update bit */
31#define WM8776_VOL_HPZCEN (1 << 7) /* zero cross detect */
32#define WM8776_VOL_UPDATE (1 << 8) /* update volume */
33#define WM8776_REG_DACLVOL 0x03
34#define WM8776_REG_DACRVOL 0x04
35#define WM8776_REG_DACMASTER 0x05
36#define WM8776_DACVOL_MASK 0x1ff /* incl. update bit */
37#define WM8776_REG_PHASESWAP 0x06
38#define WM8776_PHASE_INVERTL (1 << 0)
39#define WM8776_PHASE_INVERTR (1 << 1)
40#define WM8776_REG_DACCTRL1 0x07
41#define WM8776_DAC_DZCEN (1 << 0)
42#define WM8776_DAC_ATC (1 << 1)
43#define WM8776_DAC_IZD (1 << 2)
44#define WM8776_DAC_TOD (1 << 3)
45#define WM8776_DAC_PL_MASK 0xf0
46#define WM8776_DAC_PL_LL (1 << 4) /* L chan: L signal */
47#define WM8776_DAC_PL_LR (2 << 4) /* L chan: R signal */
48#define WM8776_DAC_PL_LB (3 << 4) /* L chan: both */
49#define WM8776_DAC_PL_RL (1 << 6) /* R chan: L signal */
50#define WM8776_DAC_PL_RR (2 << 6) /* R chan: R signal */
51#define WM8776_DAC_PL_RB (3 << 6) /* R chan: both */
52#define WM8776_REG_DACMUTE 0x08
53#define WM8776_DACMUTE (1 << 0)
54#define WM8776_REG_DACCTRL2 0x09
55#define WM8776_DAC2_DEEMPH (1 << 0)
56#define WM8776_DAC2_ZFLAG_DISABLE (0 << 1)
57#define WM8776_DAC2_ZFLAG_OWN (1 << 1)
58#define WM8776_DAC2_ZFLAG_BOTH (2 << 1)
59#define WM8776_DAC2_ZFLAG_EITHER (3 << 1)
60#define WM8776_REG_DACIFCTRL 0x0a
61#define WM8776_FMT_RIGHTJ (0 << 0)
62#define WM8776_FMT_LEFTJ (1 << 0)
63#define WM8776_FMT_I2S (2 << 0)
64#define WM8776_FMT_DSP (3 << 0)
65#define WM8776_FMT_DSP_LATE (1 << 2) /* in DSP mode */
66#define WM8776_FMT_LRC_INVERTED (1 << 2) /* in other modes */
67#define WM8776_FMT_BCLK_INVERTED (1 << 3)
68#define WM8776_FMT_16BIT (0 << 4)
69#define WM8776_FMT_20BIT (1 << 4)
70#define WM8776_FMT_24BIT (2 << 4)
71#define WM8776_FMT_32BIT (3 << 4)
72#define WM8776_REG_ADCIFCTRL 0x0b
73#define WM8776_FMT_ADCMCLK_INVERTED (1 << 6)
74#define WM8776_FMT_ADCHPD (1 << 8)
75#define WM8776_REG_MSTRCTRL 0x0c
76#define WM8776_IF_ADC256FS (2 << 0)
77#define WM8776_IF_ADC384FS (3 << 0)
78#define WM8776_IF_ADC512FS (4 << 0)
79#define WM8776_IF_ADC768FS (5 << 0)
80#define WM8776_IF_OVERSAMP64 (1 << 3)
81#define WM8776_IF_DAC128FS (0 << 4)
82#define WM8776_IF_DAC192FS (1 << 4)
83#define WM8776_IF_DAC256FS (2 << 4)
84#define WM8776_IF_DAC384FS (3 << 4)
85#define WM8776_IF_DAC512FS (4 << 4)
86#define WM8776_IF_DAC768FS (5 << 4)
87#define WM8776_IF_DAC_MASTER (1 << 7)
88#define WM8776_IF_ADC_MASTER (1 << 8)
89#define WM8776_REG_PWRDOWN 0x0d
90#define WM8776_PWR_PDWN (1 << 0)
91#define WM8776_PWR_ADCPD (1 << 1)
92#define WM8776_PWR_DACPD (1 << 2)
93#define WM8776_PWR_HPPD (1 << 3)
94#define WM8776_PWR_AINPD (1 << 6)
95#define WM8776_REG_ADCLVOL 0x0e
96#define WM8776_REG_ADCRVOL 0x0f
97#define WM8776_ADC_GAIN_MASK 0xff
98#define WM8776_ADC_ZCEN (1 << 8)
99#define WM8776_REG_ALCCTRL1 0x10
100#define WM8776_ALC1_LCT_MASK 0x0f /* 0=-16dB, 1=-15dB..15=-1dB */
101#define WM8776_ALC1_MAXGAIN_MASK 0x70 /* 0,1=0dB, 2=+4dB...7=+24dB */
102#define WM8776_ALC1_LCSEL_MASK 0x180
103#define WM8776_ALC1_LCSEL_LIMITER (0 << 7)
104#define WM8776_ALC1_LCSEL_ALCR (1 << 7)
105#define WM8776_ALC1_LCSEL_ALCL (2 << 7)
106#define WM8776_ALC1_LCSEL_ALCSTEREO (3 << 7)
107#define WM8776_REG_ALCCTRL2 0x11
108#define WM8776_ALC2_HOLD_MASK 0x0f /*0=0ms, 1=2.67ms, 2=5.33ms.. */
109#define WM8776_ALC2_ZCEN (1 << 7)
110#define WM8776_ALC2_LCEN (1 << 8)
111#define WM8776_REG_ALCCTRL3 0x12
112#define WM8776_ALC3_ATK_MASK 0x0f
113#define WM8776_ALC3_DCY_MASK 0xf0
114#define WM8776_ALC3_FDECAY (1 << 8)
115#define WM8776_REG_NOISEGATE 0x13
116#define WM8776_NGAT_ENABLE (1 << 0)
117#define WM8776_NGAT_THR_MASK 0x1c /*0=-78dB, 1=-72dB...7=-36dB */
118#define WM8776_REG_LIMITER 0x14
119#define WM8776_LIM_MAXATTEN_MASK 0x0f
120#define WM8776_LIM_TRANWIN_MASK 0x70 /*0=0us, 1=62.5us, 2=125us.. */
121#define WM8776_REG_ADCMUX 0x15
122#define WM8776_ADC_MUX_AIN1 (1 << 0)
123#define WM8776_ADC_MUX_AIN2 (1 << 1)
124#define WM8776_ADC_MUX_AIN3 (1 << 2)
125#define WM8776_ADC_MUX_AIN4 (1 << 3)
126#define WM8776_ADC_MUX_AIN5 (1 << 4)
127#define WM8776_ADC_MUTER (1 << 6)
128#define WM8776_ADC_MUTEL (1 << 7)
129#define WM8776_ADC_LRBOTH (1 << 8)
130#define WM8776_REG_OUTMUX 0x16
131#define WM8776_OUTMUX_DAC (1 << 0)
132#define WM8776_OUTMUX_AUX (1 << 1)
133#define WM8776_OUTMUX_BYPASS (1 << 2)
134#define WM8776_REG_RESET 0x17
135
136#define WM8776_REG_COUNT 0x17 /* don't cache the RESET register */
137
138struct snd_wm8776;
139
140struct snd_wm8776_ops {
141 void (*write)(struct snd_wm8776 *wm, u8 addr, u8 data);
142};
143
144enum snd_wm8776_ctl_id {
145 WM8776_CTL_DAC_VOL,
146 WM8776_CTL_DAC_SW,
147 WM8776_CTL_DAC_ZC_SW,
148 WM8776_CTL_HP_VOL,
149 WM8776_CTL_HP_SW,
150 WM8776_CTL_HP_ZC_SW,
151 WM8776_CTL_AUX_SW,
152 WM8776_CTL_BYPASS_SW,
153 WM8776_CTL_DAC_IZD_SW,
154 WM8776_CTL_PHASE_SW,
155 WM8776_CTL_DEEMPH_SW,
156 WM8776_CTL_ADC_VOL,
157 WM8776_CTL_ADC_SW,
158 WM8776_CTL_INPUT1_SW,
159 WM8776_CTL_INPUT2_SW,
160 WM8776_CTL_INPUT3_SW,
161 WM8776_CTL_INPUT4_SW,
162 WM8776_CTL_INPUT5_SW,
163 WM8776_CTL_AGC_SEL,
164 WM8776_CTL_LIM_THR,
165 WM8776_CTL_LIM_ATK,
166 WM8776_CTL_LIM_DCY,
167 WM8776_CTL_LIM_TRANWIN,
168 WM8776_CTL_LIM_MAXATTN,
169 WM8776_CTL_ALC_TGT,
170 WM8776_CTL_ALC_ATK,
171 WM8776_CTL_ALC_DCY,
172 WM8776_CTL_ALC_MAXGAIN,
173 WM8776_CTL_ALC_MAXATTN,
174 WM8776_CTL_ALC_HLD,
175 WM8776_CTL_NGT_SW,
176 WM8776_CTL_NGT_THR,
177
178 WM8776_CTL_COUNT,
179};
180
181#define WM8776_ENUM_MAX 16
182
183#define WM8776_FLAG_STEREO (1 << 0)
184#define WM8776_FLAG_VOL_UPDATE (1 << 1)
185#define WM8776_FLAG_INVERT (1 << 2)
186#define WM8776_FLAG_LIM (1 << 3)
187#define WM8776_FLAG_ALC (1 << 4)
188
189struct snd_wm8776_ctl {
190 const char *name;
191 snd_ctl_elem_type_t type;
192 const char *const enum_names[WM8776_ENUM_MAX];
193 const unsigned int *tlv;
194 u16 reg1, reg2, mask1, mask2, min, max, flags;
195 void (*set)(struct snd_wm8776 *wm, u16 ch1, u16 ch2);
196 void (*get)(struct snd_wm8776 *wm, u16 *ch1, u16 *ch2);
197};
198
199enum snd_wm8776_agc_mode {
200 WM8776_AGC_OFF,
201 WM8776_AGC_LIM,
202 WM8776_AGC_ALC_R,
203 WM8776_AGC_ALC_L,
204 WM8776_AGC_ALC_STEREO
205};
206
207struct snd_wm8776 {
208 struct snd_card *card;
209 struct snd_wm8776_ctl ctl[WM8776_CTL_COUNT];
210 enum snd_wm8776_agc_mode agc_mode;
211 struct snd_wm8776_ops ops;
212 u16 regs[WM8776_REG_COUNT]; /* 9-bit registers */
213};
214
215
216
217void snd_wm8776_init(struct snd_wm8776 *wm);
218void snd_wm8776_resume(struct snd_wm8776 *wm);
219void snd_wm8776_set_dac_if(struct snd_wm8776 *wm, u16 dac);
220void snd_wm8776_set_adc_if(struct snd_wm8776 *wm, u16 adc);
221void snd_wm8776_set_master_mode(struct snd_wm8776 *wm, u16 mode);
222void snd_wm8776_set_power(struct snd_wm8776 *wm, u16 power);
223void snd_wm8776_volume_restore(struct snd_wm8776 *wm);
224int snd_wm8776_build_controls(struct snd_wm8776 *wm);
225
226#endif /* __SOUND_WM8776_H */
diff --git a/sound/pci/ice1712/wtm.c b/sound/pci/ice1712/wtm.c
index e618f789026e..bcf30a387b87 100644
--- a/sound/pci/ice1712/wtm.c
+++ b/sound/pci/ice1712/wtm.c
@@ -25,7 +25,6 @@
25 25
26 26
27 27
28#include <linux/io.h>
29#include <linux/delay.h> 28#include <linux/delay.h>
30#include <linux/interrupt.h> 29#include <linux/interrupt.h>
31#include <linux/init.h> 30#include <linux/init.h>
@@ -384,7 +383,7 @@ static int stac9460_mic_sw_put(struct snd_kcontrol *kcontrol,
384/* 383/*
385 * Control tabs 384 * Control tabs
386 */ 385 */
387static struct snd_kcontrol_new stac9640_controls[] __devinitdata = { 386static struct snd_kcontrol_new stac9640_controls[] = {
388 { 387 {
389 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 388 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
390 .name = "Master Playback Switch", 389 .name = "Master Playback Switch",
@@ -448,7 +447,7 @@ static struct snd_kcontrol_new stac9640_controls[] __devinitdata = {
448 447
449 448
450/*INIT*/ 449/*INIT*/
451static int __devinit wtm_add_controls(struct snd_ice1712 *ice) 450static int wtm_add_controls(struct snd_ice1712 *ice)
452{ 451{
453 unsigned int i; 452 unsigned int i;
454 int err; 453 int err;
@@ -462,7 +461,7 @@ static int __devinit wtm_add_controls(struct snd_ice1712 *ice)
462 return 0; 461 return 0;
463} 462}
464 463
465static int __devinit wtm_init(struct snd_ice1712 *ice) 464static int wtm_init(struct snd_ice1712 *ice)
466{ 465{
467 static unsigned short stac_inits_prodigy[] = { 466 static unsigned short stac_inits_prodigy[] = {
468 STAC946X_RESET, 0, 467 STAC946X_RESET, 0,
@@ -485,7 +484,7 @@ static int __devinit wtm_init(struct snd_ice1712 *ice)
485} 484}
486 485
487 486
488static unsigned char wtm_eeprom[] __devinitdata = { 487static unsigned char wtm_eeprom[] = {
489 0x47, /*SYSCONF: clock 192KHz, 4ADC, 8DAC */ 488 0x47, /*SYSCONF: clock 192KHz, 4ADC, 8DAC */
490 0x80, /* ACLINK : I2S */ 489 0x80, /* ACLINK : I2S */
491 0xf8, /* I2S: vol; 96k, 24bit, 192k */ 490 0xf8, /* I2S: vol; 96k, 24bit, 192k */
@@ -503,7 +502,7 @@ static unsigned char wtm_eeprom[] __devinitdata = {
503 502
504 503
505/*entry point*/ 504/*entry point*/
506struct snd_ice1712_card_info snd_vt1724_wtm_cards[] __devinitdata = { 505struct snd_ice1712_card_info snd_vt1724_wtm_cards[] = {
507 { 506 {
508 .subvendor = VT1724_SUBDEVICE_WTM, 507 .subvendor = VT1724_SUBDEVICE_WTM,
509 .name = "ESI Waveterminal 192M", 508 .name = "ESI Waveterminal 192M",
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c
index ea4b706c8d63..3b9be752f3e2 100644
--- a/sound/pci/intel8x0.c
+++ b/sound/pci/intel8x0.c
@@ -592,8 +592,8 @@ static unsigned short snd_intel8x0_codec_read(struct snd_ac97 *ac97,
592 return res; 592 return res;
593} 593}
594 594
595static void __devinit snd_intel8x0_codec_read_test(struct intel8x0 *chip, 595static void snd_intel8x0_codec_read_test(struct intel8x0 *chip,
596 unsigned int codec) 596 unsigned int codec)
597{ 597{
598 unsigned int tmp; 598 unsigned int tmp;
599 599
@@ -1507,8 +1507,8 @@ struct ich_pcm_table {
1507 int ac97_idx; 1507 int ac97_idx;
1508}; 1508};
1509 1509
1510static int __devinit snd_intel8x0_pcm1(struct intel8x0 *chip, int device, 1510static int snd_intel8x0_pcm1(struct intel8x0 *chip, int device,
1511 struct ich_pcm_table *rec) 1511 struct ich_pcm_table *rec)
1512{ 1512{
1513 struct snd_pcm *pcm; 1513 struct snd_pcm *pcm;
1514 int err; 1514 int err;
@@ -1564,7 +1564,7 @@ static int __devinit snd_intel8x0_pcm1(struct intel8x0 *chip, int device,
1564 return 0; 1564 return 0;
1565} 1565}
1566 1566
1567static struct ich_pcm_table intel_pcms[] __devinitdata = { 1567static struct ich_pcm_table intel_pcms[] = {
1568 { 1568 {
1569 .playback_ops = &snd_intel8x0_playback_ops, 1569 .playback_ops = &snd_intel8x0_playback_ops,
1570 .capture_ops = &snd_intel8x0_capture_ops, 1570 .capture_ops = &snd_intel8x0_capture_ops,
@@ -1601,7 +1601,7 @@ static struct ich_pcm_table intel_pcms[] __devinitdata = {
1601 }, 1601 },
1602}; 1602};
1603 1603
1604static struct ich_pcm_table nforce_pcms[] __devinitdata = { 1604static struct ich_pcm_table nforce_pcms[] = {
1605 { 1605 {
1606 .playback_ops = &snd_intel8x0_playback_ops, 1606 .playback_ops = &snd_intel8x0_playback_ops,
1607 .capture_ops = &snd_intel8x0_capture_ops, 1607 .capture_ops = &snd_intel8x0_capture_ops,
@@ -1624,7 +1624,7 @@ static struct ich_pcm_table nforce_pcms[] __devinitdata = {
1624 }, 1624 },
1625}; 1625};
1626 1626
1627static struct ich_pcm_table ali_pcms[] __devinitdata = { 1627static struct ich_pcm_table ali_pcms[] = {
1628 { 1628 {
1629 .playback_ops = &snd_intel8x0_ali_playback_ops, 1629 .playback_ops = &snd_intel8x0_ali_playback_ops,
1630 .capture_ops = &snd_intel8x0_ali_capture_ops, 1630 .capture_ops = &snd_intel8x0_ali_capture_ops,
@@ -1656,7 +1656,7 @@ static struct ich_pcm_table ali_pcms[] __devinitdata = {
1656#endif 1656#endif
1657}; 1657};
1658 1658
1659static int __devinit snd_intel8x0_pcm(struct intel8x0 *chip) 1659static int snd_intel8x0_pcm(struct intel8x0 *chip)
1660{ 1660{
1661 int i, tblsize, device, err; 1661 int i, tblsize, device, err;
1662 struct ich_pcm_table *tbl, *rec; 1662 struct ich_pcm_table *tbl, *rec;
@@ -1719,7 +1719,7 @@ static void snd_intel8x0_mixer_free_ac97(struct snd_ac97 *ac97)
1719 chip->ac97[ac97->num] = NULL; 1719 chip->ac97[ac97->num] = NULL;
1720} 1720}
1721 1721
1722static struct ac97_pcm ac97_pcm_defs[] __devinitdata = { 1722static struct ac97_pcm ac97_pcm_defs[] = {
1723 /* front PCM */ 1723 /* front PCM */
1724 { 1724 {
1725 .exclusive = 1, 1725 .exclusive = 1,
@@ -1789,7 +1789,7 @@ static struct ac97_pcm ac97_pcm_defs[] __devinitdata = {
1789 }, 1789 },
1790}; 1790};
1791 1791
1792static struct ac97_quirk ac97_quirks[] __devinitdata = { 1792static struct ac97_quirk ac97_quirks[] = {
1793 { 1793 {
1794 .subvendor = 0x0e11, 1794 .subvendor = 0x0e11,
1795 .subdevice = 0x000e, 1795 .subdevice = 0x000e,
@@ -2196,8 +2196,8 @@ static struct ac97_quirk ac97_quirks[] __devinitdata = {
2196 { } /* terminator */ 2196 { } /* terminator */
2197}; 2197};
2198 2198
2199static int __devinit snd_intel8x0_mixer(struct intel8x0 *chip, int ac97_clock, 2199static int snd_intel8x0_mixer(struct intel8x0 *chip, int ac97_clock,
2200 const char *quirk_override) 2200 const char *quirk_override)
2201{ 2201{
2202 struct snd_ac97_bus *pbus; 2202 struct snd_ac97_bus *pbus;
2203 struct snd_ac97_template ac97; 2203 struct snd_ac97_template ac97;
@@ -2765,7 +2765,7 @@ static SIMPLE_DEV_PM_OPS(intel8x0_pm, intel8x0_suspend, intel8x0_resume);
2765 2765
2766#define INTEL8X0_TESTBUF_SIZE 32768 /* enough large for one shot */ 2766#define INTEL8X0_TESTBUF_SIZE 32768 /* enough large for one shot */
2767 2767
2768static void __devinit intel8x0_measure_ac97_clock(struct intel8x0 *chip) 2768static void intel8x0_measure_ac97_clock(struct intel8x0 *chip)
2769{ 2769{
2770 struct snd_pcm_substream *subs; 2770 struct snd_pcm_substream *subs;
2771 struct ichdev *ichdev; 2771 struct ichdev *ichdev;
@@ -2883,7 +2883,7 @@ static void __devinit intel8x0_measure_ac97_clock(struct intel8x0 *chip)
2883 snd_ac97_update_power(chip->ac97[0], AC97_PCM_FRONT_DAC_RATE, 0); 2883 snd_ac97_update_power(chip->ac97[0], AC97_PCM_FRONT_DAC_RATE, 0);
2884} 2884}
2885 2885
2886static struct snd_pci_quirk intel8x0_clock_list[] __devinitdata = { 2886static struct snd_pci_quirk intel8x0_clock_list[] = {
2887 SND_PCI_QUIRK(0x0e11, 0x008a, "AD1885", 41000), 2887 SND_PCI_QUIRK(0x0e11, 0x008a, "AD1885", 41000),
2888 SND_PCI_QUIRK(0x1028, 0x00be, "AD1885", 44100), 2888 SND_PCI_QUIRK(0x1028, 0x00be, "AD1885", 44100),
2889 SND_PCI_QUIRK(0x1028, 0x0177, "AD1980", 48000), 2889 SND_PCI_QUIRK(0x1028, 0x0177, "AD1980", 48000),
@@ -2892,7 +2892,7 @@ static struct snd_pci_quirk intel8x0_clock_list[] __devinitdata = {
2892 { } /* terminator */ 2892 { } /* terminator */
2893}; 2893};
2894 2894
2895static int __devinit intel8x0_in_clock_list(struct intel8x0 *chip) 2895static int intel8x0_in_clock_list(struct intel8x0 *chip)
2896{ 2896{
2897 struct pci_dev *pci = chip->pci; 2897 struct pci_dev *pci = chip->pci;
2898 const struct snd_pci_quirk *wl; 2898 const struct snd_pci_quirk *wl;
@@ -2941,7 +2941,7 @@ static void snd_intel8x0_proc_read(struct snd_info_entry * entry,
2941 chip->ac97_sdin[2]); 2941 chip->ac97_sdin[2]);
2942} 2942}
2943 2943
2944static void __devinit snd_intel8x0_proc_init(struct intel8x0 * chip) 2944static void snd_intel8x0_proc_init(struct intel8x0 *chip)
2945{ 2945{
2946 struct snd_info_entry *entry; 2946 struct snd_info_entry *entry;
2947 2947
@@ -2970,7 +2970,7 @@ static unsigned int sis_codec_bits[3] = {
2970 ICH_PCR, ICH_SCR, ICH_SIS_TCR 2970 ICH_PCR, ICH_SCR, ICH_SIS_TCR
2971}; 2971};
2972 2972
2973static int __devinit snd_intel8x0_inside_vm(struct pci_dev *pci) 2973static int snd_intel8x0_inside_vm(struct pci_dev *pci)
2974{ 2974{
2975 int result = inside_vm; 2975 int result = inside_vm;
2976 char *msg = NULL; 2976 char *msg = NULL;
@@ -3009,10 +3009,10 @@ fini:
3009 return result; 3009 return result;
3010} 3010}
3011 3011
3012static int __devinit snd_intel8x0_create(struct snd_card *card, 3012static int snd_intel8x0_create(struct snd_card *card,
3013 struct pci_dev *pci, 3013 struct pci_dev *pci,
3014 unsigned long device_type, 3014 unsigned long device_type,
3015 struct intel8x0 ** r_intel8x0) 3015 struct intel8x0 **r_intel8x0)
3016{ 3016{
3017 struct intel8x0 *chip; 3017 struct intel8x0 *chip;
3018 int err; 3018 int err;
@@ -3227,7 +3227,7 @@ static int __devinit snd_intel8x0_create(struct snd_card *card,
3227static struct shortname_table { 3227static struct shortname_table {
3228 unsigned int id; 3228 unsigned int id;
3229 const char *s; 3229 const char *s;
3230} shortnames[] __devinitdata = { 3230} shortnames[] = {
3231 { PCI_DEVICE_ID_INTEL_82801AA_5, "Intel 82801AA-ICH" }, 3231 { PCI_DEVICE_ID_INTEL_82801AA_5, "Intel 82801AA-ICH" },
3232 { PCI_DEVICE_ID_INTEL_82801AB_5, "Intel 82901AB-ICH0" }, 3232 { PCI_DEVICE_ID_INTEL_82801AB_5, "Intel 82901AB-ICH0" },
3233 { PCI_DEVICE_ID_INTEL_82801BA_4, "Intel 82801BA-ICH2" }, 3233 { PCI_DEVICE_ID_INTEL_82801BA_4, "Intel 82801BA-ICH2" },
@@ -3253,13 +3253,13 @@ static struct shortname_table {
3253 { 0, NULL }, 3253 { 0, NULL },
3254}; 3254};
3255 3255
3256static struct snd_pci_quirk spdif_aclink_defaults[] __devinitdata = { 3256static struct snd_pci_quirk spdif_aclink_defaults[] = {
3257 SND_PCI_QUIRK(0x147b, 0x1c1a, "ASUS KN8", 1), 3257 SND_PCI_QUIRK(0x147b, 0x1c1a, "ASUS KN8", 1),
3258 { } /* end */ 3258 { } /* end */
3259}; 3259};
3260 3260
3261/* look up white/black list for SPDIF over ac-link */ 3261/* look up white/black list for SPDIF over ac-link */
3262static int __devinit check_default_spdif_aclink(struct pci_dev *pci) 3262static int check_default_spdif_aclink(struct pci_dev *pci)
3263{ 3263{
3264 const struct snd_pci_quirk *w; 3264 const struct snd_pci_quirk *w;
3265 3265
@@ -3276,8 +3276,8 @@ static int __devinit check_default_spdif_aclink(struct pci_dev *pci)
3276 return 0; 3276 return 0;
3277} 3277}
3278 3278
3279static int __devinit snd_intel8x0_probe(struct pci_dev *pci, 3279static int snd_intel8x0_probe(struct pci_dev *pci,
3280 const struct pci_device_id *pci_id) 3280 const struct pci_device_id *pci_id)
3281{ 3281{
3282 struct snd_card *card; 3282 struct snd_card *card;
3283 struct intel8x0 *chip; 3283 struct intel8x0 *chip;
@@ -3359,7 +3359,7 @@ static int __devinit snd_intel8x0_probe(struct pci_dev *pci,
3359 return 0; 3359 return 0;
3360} 3360}
3361 3361
3362static void __devexit snd_intel8x0_remove(struct pci_dev *pci) 3362static void snd_intel8x0_remove(struct pci_dev *pci)
3363{ 3363{
3364 snd_card_free(pci_get_drvdata(pci)); 3364 snd_card_free(pci_get_drvdata(pci));
3365 pci_set_drvdata(pci, NULL); 3365 pci_set_drvdata(pci, NULL);
@@ -3369,7 +3369,7 @@ static struct pci_driver intel8x0_driver = {
3369 .name = KBUILD_MODNAME, 3369 .name = KBUILD_MODNAME,
3370 .id_table = snd_intel8x0_ids, 3370 .id_table = snd_intel8x0_ids,
3371 .probe = snd_intel8x0_probe, 3371 .probe = snd_intel8x0_probe,
3372 .remove = __devexit_p(snd_intel8x0_remove), 3372 .remove = snd_intel8x0_remove,
3373 .driver = { 3373 .driver = {
3374 .pm = INTEL8X0_PM_OPS, 3374 .pm = INTEL8X0_PM_OPS,
3375 }, 3375 },
diff --git a/sound/pci/intel8x0m.c b/sound/pci/intel8x0m.c
index 4d551736531e..fea09e8ea608 100644
--- a/sound/pci/intel8x0m.c
+++ b/sound/pci/intel8x0m.c
@@ -710,8 +710,8 @@ struct ich_pcm_table {
710 int ac97_idx; 710 int ac97_idx;
711}; 711};
712 712
713static int __devinit snd_intel8x0m_pcm1(struct intel8x0m *chip, int device, 713static int snd_intel8x0m_pcm1(struct intel8x0m *chip, int device,
714 struct ich_pcm_table *rec) 714 struct ich_pcm_table *rec)
715{ 715{
716 struct snd_pcm *pcm; 716 struct snd_pcm *pcm;
717 int err; 717 int err;
@@ -749,7 +749,7 @@ static int __devinit snd_intel8x0m_pcm1(struct intel8x0m *chip, int device,
749 return 0; 749 return 0;
750} 750}
751 751
752static struct ich_pcm_table intel_pcms[] __devinitdata = { 752static struct ich_pcm_table intel_pcms[] = {
753 { 753 {
754 .suffix = "Modem", 754 .suffix = "Modem",
755 .playback_ops = &snd_intel8x0m_playback_ops, 755 .playback_ops = &snd_intel8x0m_playback_ops,
@@ -759,7 +759,7 @@ static struct ich_pcm_table intel_pcms[] __devinitdata = {
759 }, 759 },
760}; 760};
761 761
762static int __devinit snd_intel8x0m_pcm(struct intel8x0m *chip) 762static int snd_intel8x0m_pcm(struct intel8x0m *chip)
763{ 763{
764 int i, tblsize, device, err; 764 int i, tblsize, device, err;
765 struct ich_pcm_table *tbl, *rec; 765 struct ich_pcm_table *tbl, *rec;
@@ -819,7 +819,7 @@ static void snd_intel8x0m_mixer_free_ac97(struct snd_ac97 *ac97)
819} 819}
820 820
821 821
822static int __devinit snd_intel8x0m_mixer(struct intel8x0m *chip, int ac97_clock) 822static int snd_intel8x0m_mixer(struct intel8x0m *chip, int ac97_clock)
823{ 823{
824 struct snd_ac97_bus *pbus; 824 struct snd_ac97_bus *pbus;
825 struct snd_ac97_template ac97; 825 struct snd_ac97_template ac97;
@@ -1090,7 +1090,7 @@ static void snd_intel8x0m_proc_read(struct snd_info_entry * entry,
1090 (tmp & (ICH_PCR | ICH_SCR | ICH_TCR)) == 0 ? " none" : ""); 1090 (tmp & (ICH_PCR | ICH_SCR | ICH_TCR)) == 0 ? " none" : "");
1091} 1091}
1092 1092
1093static void __devinit snd_intel8x0m_proc_init(struct intel8x0m * chip) 1093static void snd_intel8x0m_proc_init(struct intel8x0m *chip)
1094{ 1094{
1095 struct snd_info_entry *entry; 1095 struct snd_info_entry *entry;
1096 1096
@@ -1113,10 +1113,10 @@ struct ich_reg_info {
1113 unsigned int offset; 1113 unsigned int offset;
1114}; 1114};
1115 1115
1116static int __devinit snd_intel8x0m_create(struct snd_card *card, 1116static int snd_intel8x0m_create(struct snd_card *card,
1117 struct pci_dev *pci, 1117 struct pci_dev *pci,
1118 unsigned long device_type, 1118 unsigned long device_type,
1119 struct intel8x0m **r_intel8x0m) 1119 struct intel8x0m **r_intel8x0m)
1120{ 1120{
1121 struct intel8x0m *chip; 1121 struct intel8x0m *chip;
1122 int err; 1122 int err;
@@ -1252,7 +1252,7 @@ static int __devinit snd_intel8x0m_create(struct snd_card *card,
1252static struct shortname_table { 1252static struct shortname_table {
1253 unsigned int id; 1253 unsigned int id;
1254 const char *s; 1254 const char *s;
1255} shortnames[] __devinitdata = { 1255} shortnames[] = {
1256 { PCI_DEVICE_ID_INTEL_82801AA_6, "Intel 82801AA-ICH" }, 1256 { PCI_DEVICE_ID_INTEL_82801AA_6, "Intel 82801AA-ICH" },
1257 { PCI_DEVICE_ID_INTEL_82801AB_6, "Intel 82901AB-ICH0" }, 1257 { PCI_DEVICE_ID_INTEL_82801AB_6, "Intel 82901AB-ICH0" },
1258 { PCI_DEVICE_ID_INTEL_82801BA_6, "Intel 82801BA-ICH2" }, 1258 { PCI_DEVICE_ID_INTEL_82801BA_6, "Intel 82801BA-ICH2" },
@@ -1275,8 +1275,8 @@ static struct shortname_table {
1275 { 0 }, 1275 { 0 },
1276}; 1276};
1277 1277
1278static int __devinit snd_intel8x0m_probe(struct pci_dev *pci, 1278static int snd_intel8x0m_probe(struct pci_dev *pci,
1279 const struct pci_device_id *pci_id) 1279 const struct pci_device_id *pci_id)
1280{ 1280{
1281 struct snd_card *card; 1281 struct snd_card *card;
1282 struct intel8x0m *chip; 1282 struct intel8x0m *chip;
@@ -1325,7 +1325,7 @@ static int __devinit snd_intel8x0m_probe(struct pci_dev *pci,
1325 return 0; 1325 return 0;
1326} 1326}
1327 1327
1328static void __devexit snd_intel8x0m_remove(struct pci_dev *pci) 1328static void snd_intel8x0m_remove(struct pci_dev *pci)
1329{ 1329{
1330 snd_card_free(pci_get_drvdata(pci)); 1330 snd_card_free(pci_get_drvdata(pci));
1331 pci_set_drvdata(pci, NULL); 1331 pci_set_drvdata(pci, NULL);
@@ -1335,7 +1335,7 @@ static struct pci_driver intel8x0m_driver = {
1335 .name = KBUILD_MODNAME, 1335 .name = KBUILD_MODNAME,
1336 .id_table = snd_intel8x0m_ids, 1336 .id_table = snd_intel8x0m_ids,
1337 .probe = snd_intel8x0m_probe, 1337 .probe = snd_intel8x0m_probe,
1338 .remove = __devexit_p(snd_intel8x0m_remove), 1338 .remove = snd_intel8x0m_remove,
1339 .driver = { 1339 .driver = {
1340 .pm = INTEL8X0M_PM_OPS, 1340 .pm = INTEL8X0M_PM_OPS,
1341 }, 1341 },
diff --git a/sound/pci/korg1212/korg1212.c b/sound/pci/korg1212/korg1212.c
index 8a67ce95f246..43b4228d9afe 100644
--- a/sound/pci/korg1212/korg1212.c
+++ b/sound/pci/korg1212/korg1212.c
@@ -2083,7 +2083,7 @@ static void snd_korg1212_proc_read(struct snd_info_entry *entry,
2083 snd_iprintf(buffer, " Error count: %ld\n", korg1212->totalerrorcnt); 2083 snd_iprintf(buffer, " Error count: %ld\n", korg1212->totalerrorcnt);
2084} 2084}
2085 2085
2086static void __devinit snd_korg1212_proc_init(struct snd_korg1212 *korg1212) 2086static void snd_korg1212_proc_init(struct snd_korg1212 *korg1212)
2087{ 2087{
2088 struct snd_info_entry *entry; 2088 struct snd_info_entry *entry;
2089 2089
@@ -2154,8 +2154,8 @@ static int snd_korg1212_dev_free(struct snd_device *device)
2154 return snd_korg1212_free(korg1212); 2154 return snd_korg1212_free(korg1212);
2155} 2155}
2156 2156
2157static int __devinit snd_korg1212_create(struct snd_card *card, struct pci_dev *pci, 2157static int snd_korg1212_create(struct snd_card *card, struct pci_dev *pci,
2158 struct snd_korg1212 ** rchip) 2158 struct snd_korg1212 **rchip)
2159 2159
2160{ 2160{
2161 int err, rc; 2161 int err, rc;
@@ -2429,7 +2429,7 @@ static int __devinit snd_korg1212_create(struct snd_card *card, struct pci_dev *
2429 * Card initialisation 2429 * Card initialisation
2430 */ 2430 */
2431 2431
2432static int __devinit 2432static int
2433snd_korg1212_probe(struct pci_dev *pci, 2433snd_korg1212_probe(struct pci_dev *pci,
2434 const struct pci_device_id *pci_id) 2434 const struct pci_device_id *pci_id)
2435{ 2435{
@@ -2470,7 +2470,7 @@ snd_korg1212_probe(struct pci_dev *pci,
2470 return 0; 2470 return 0;
2471} 2471}
2472 2472
2473static void __devexit snd_korg1212_remove(struct pci_dev *pci) 2473static void snd_korg1212_remove(struct pci_dev *pci)
2474{ 2474{
2475 snd_card_free(pci_get_drvdata(pci)); 2475 snd_card_free(pci_get_drvdata(pci));
2476 pci_set_drvdata(pci, NULL); 2476 pci_set_drvdata(pci, NULL);
@@ -2480,7 +2480,7 @@ static struct pci_driver korg1212_driver = {
2480 .name = KBUILD_MODNAME, 2480 .name = KBUILD_MODNAME,
2481 .id_table = snd_korg1212_ids, 2481 .id_table = snd_korg1212_ids,
2482 .probe = snd_korg1212_probe, 2482 .probe = snd_korg1212_probe,
2483 .remove = __devexit_p(snd_korg1212_remove), 2483 .remove = snd_korg1212_remove,
2484}; 2484};
2485 2485
2486module_pci_driver(korg1212_driver); 2486module_pci_driver(korg1212_driver);
diff --git a/sound/pci/lola/lola.c b/sound/pci/lola/lola.c
index ac15166bee68..322b638e8ec4 100644
--- a/sound/pci/lola/lola.c
+++ b/sound/pci/lola/lola.c
@@ -445,7 +445,7 @@ static void lola_reset_setups(struct lola *chip)
445 lola_setup_all_analog_gains(chip, PLAY, false); /* output, update */ 445 lola_setup_all_analog_gains(chip, PLAY, false); /* output, update */
446} 446}
447 447
448static int __devinit lola_parse_tree(struct lola *chip) 448static int lola_parse_tree(struct lola *chip)
449{ 449{
450 unsigned int val; 450 unsigned int val;
451 int nid, err; 451 int nid, err;
@@ -568,8 +568,8 @@ static int lola_dev_free(struct snd_device *device)
568 return 0; 568 return 0;
569} 569}
570 570
571static int __devinit lola_create(struct snd_card *card, struct pci_dev *pci, 571static int lola_create(struct snd_card *card, struct pci_dev *pci,
572 int dev, struct lola **rchip) 572 int dev, struct lola **rchip)
573{ 573{
574 struct lola *chip; 574 struct lola *chip;
575 int err; 575 int err;
@@ -702,8 +702,8 @@ static int __devinit lola_create(struct snd_card *card, struct pci_dev *pci,
702 return err; 702 return err;
703} 703}
704 704
705static int __devinit lola_probe(struct pci_dev *pci, 705static int lola_probe(struct pci_dev *pci,
706 const struct pci_device_id *pci_id) 706 const struct pci_device_id *pci_id)
707{ 707{
708 static int dev; 708 static int dev;
709 struct snd_card *card; 709 struct snd_card *card;
@@ -756,7 +756,7 @@ out_free:
756 return err; 756 return err;
757} 757}
758 758
759static void __devexit lola_remove(struct pci_dev *pci) 759static void lola_remove(struct pci_dev *pci)
760{ 760{
761 snd_card_free(pci_get_drvdata(pci)); 761 snd_card_free(pci_get_drvdata(pci));
762 pci_set_drvdata(pci, NULL); 762 pci_set_drvdata(pci, NULL);
@@ -774,7 +774,7 @@ static struct pci_driver lola_driver = {
774 .name = KBUILD_MODNAME, 774 .name = KBUILD_MODNAME,
775 .id_table = lola_ids, 775 .id_table = lola_ids,
776 .probe = lola_probe, 776 .probe = lola_probe,
777 .remove = __devexit_p(lola_remove), 777 .remove = lola_remove,
778}; 778};
779 779
780module_pci_driver(lola_driver); 780module_pci_driver(lola_driver);
diff --git a/sound/pci/lola/lola_clock.c b/sound/pci/lola/lola_clock.c
index 72f8ef0ac865..eb1d6b97df16 100644
--- a/sound/pci/lola/lola_clock.c
+++ b/sound/pci/lola/lola_clock.c
@@ -120,7 +120,7 @@ int lola_set_granularity(struct lola *chip, unsigned int val, bool force)
120 * Clock widget handling 120 * Clock widget handling
121 */ 121 */
122 122
123int __devinit lola_init_clock_widget(struct lola *chip, int nid) 123int lola_init_clock_widget(struct lola *chip, int nid)
124{ 124{
125 unsigned int val; 125 unsigned int val;
126 int i, j, nitems, nb_verbs, idx, idx_list; 126 int i, j, nitems, nb_verbs, idx, idx_list;
diff --git a/sound/pci/lola/lola_mixer.c b/sound/pci/lola/lola_mixer.c
index 6b8d64812951..52c8d6b0f39b 100644
--- a/sound/pci/lola/lola_mixer.c
+++ b/sound/pci/lola/lola_mixer.c
@@ -28,8 +28,8 @@
28#include <sound/tlv.h> 28#include <sound/tlv.h>
29#include "lola.h" 29#include "lola.h"
30 30
31static int __devinit lola_init_pin(struct lola *chip, struct lola_pin *pin, 31static int lola_init_pin(struct lola *chip, struct lola_pin *pin,
32 int dir, int nid) 32 int dir, int nid)
33{ 33{
34 unsigned int val; 34 unsigned int val;
35 int err; 35 int err;
@@ -91,7 +91,7 @@ static int __devinit lola_init_pin(struct lola *chip, struct lola_pin *pin,
91 return 0; 91 return 0;
92} 92}
93 93
94int __devinit lola_init_pins(struct lola *chip, int dir, int *nidp) 94int lola_init_pins(struct lola *chip, int dir, int *nidp)
95{ 95{
96 int i, err, nid; 96 int i, err, nid;
97 nid = *nidp; 97 nid = *nidp;
@@ -112,7 +112,7 @@ void lola_free_mixer(struct lola *chip)
112 vfree(chip->mixer.array_saved); 112 vfree(chip->mixer.array_saved);
113} 113}
114 114
115int __devinit lola_init_mixer_widget(struct lola *chip, int nid) 115int lola_init_mixer_widget(struct lola *chip, int nid)
116{ 116{
117 unsigned int val; 117 unsigned int val;
118 int err; 118 int err;
@@ -579,7 +579,7 @@ static int lola_analog_vol_tlv(struct snd_kcontrol *kcontrol, int op_flag,
579 return 0; 579 return 0;
580} 580}
581 581
582static struct snd_kcontrol_new lola_analog_mixer __devinitdata = { 582static struct snd_kcontrol_new lola_analog_mixer = {
583 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 583 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
584 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | 584 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
585 SNDRV_CTL_ELEM_ACCESS_TLV_READ | 585 SNDRV_CTL_ELEM_ACCESS_TLV_READ |
@@ -590,7 +590,7 @@ static struct snd_kcontrol_new lola_analog_mixer __devinitdata = {
590 .tlv.c = lola_analog_vol_tlv, 590 .tlv.c = lola_analog_vol_tlv,
591}; 591};
592 592
593static int __devinit create_analog_mixer(struct lola *chip, int dir, char *name) 593static int create_analog_mixer(struct lola *chip, int dir, char *name)
594{ 594{
595 if (!chip->pin[dir].num_pins) 595 if (!chip->pin[dir].num_pins)
596 return 0; 596 return 0;
@@ -644,7 +644,7 @@ static int lola_input_src_put(struct snd_kcontrol *kcontrol,
644 return lola_set_src_config(chip, mask, true); 644 return lola_set_src_config(chip, mask, true);
645} 645}
646 646
647static struct snd_kcontrol_new lola_input_src_mixer __devinitdata = { 647static struct snd_kcontrol_new lola_input_src_mixer = {
648 .name = "Digital SRC Capture Switch", 648 .name = "Digital SRC Capture Switch",
649 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 649 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
650 .info = lola_input_src_info, 650 .info = lola_input_src_info,
@@ -656,7 +656,7 @@ static struct snd_kcontrol_new lola_input_src_mixer __devinitdata = {
656 * Lola16161 or Lola881 can have Hardware sample rate converters 656 * Lola16161 or Lola881 can have Hardware sample rate converters
657 * on its digital input pins 657 * on its digital input pins
658 */ 658 */
659static int __devinit create_input_src_mixer(struct lola *chip) 659static int create_input_src_mixer(struct lola *chip)
660{ 660{
661 if (!chip->input_src_caps_mask) 661 if (!chip->input_src_caps_mask)
662 return 0; 662 return 0;
@@ -726,7 +726,7 @@ static int lola_src_gain_put(struct snd_kcontrol *kcontrol,
726/* raw value: 0 = -84dB, 336 = 0dB, 408=18dB, incremented 1 for mute */ 726/* raw value: 0 = -84dB, 336 = 0dB, 408=18dB, incremented 1 for mute */
727static const DECLARE_TLV_DB_SCALE(lola_src_gain_tlv, -8425, 25, 1); 727static const DECLARE_TLV_DB_SCALE(lola_src_gain_tlv, -8425, 25, 1);
728 728
729static struct snd_kcontrol_new lola_src_gain_mixer __devinitdata = { 729static struct snd_kcontrol_new lola_src_gain_mixer = {
730 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 730 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
731 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | 731 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
732 SNDRV_CTL_ELEM_ACCESS_TLV_READ), 732 SNDRV_CTL_ELEM_ACCESS_TLV_READ),
@@ -736,8 +736,8 @@ static struct snd_kcontrol_new lola_src_gain_mixer __devinitdata = {
736 .tlv.p = lola_src_gain_tlv, 736 .tlv.p = lola_src_gain_tlv,
737}; 737};
738 738
739static int __devinit create_src_gain_mixer(struct lola *chip, 739static int create_src_gain_mixer(struct lola *chip,
740 int num, int ofs, char *name) 740 int num, int ofs, char *name)
741{ 741{
742 lola_src_gain_mixer.name = name; 742 lola_src_gain_mixer.name = name;
743 lola_src_gain_mixer.private_value = ofs + (num << 8); 743 lola_src_gain_mixer.private_value = ofs + (num << 8);
@@ -813,7 +813,7 @@ static int lola_dest_gain_put(struct snd_kcontrol *kcontrol,
813 813
814static const DECLARE_TLV_DB_SCALE(lola_dest_gain_tlv, -8425, 25, 1); 814static const DECLARE_TLV_DB_SCALE(lola_dest_gain_tlv, -8425, 25, 1);
815 815
816static struct snd_kcontrol_new lola_dest_gain_mixer __devinitdata = { 816static struct snd_kcontrol_new lola_dest_gain_mixer = {
817 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 817 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
818 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | 818 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
819 SNDRV_CTL_ELEM_ACCESS_TLV_READ), 819 SNDRV_CTL_ELEM_ACCESS_TLV_READ),
@@ -823,9 +823,9 @@ static struct snd_kcontrol_new lola_dest_gain_mixer __devinitdata = {
823 .tlv.p = lola_dest_gain_tlv, 823 .tlv.p = lola_dest_gain_tlv,
824}; 824};
825 825
826static int __devinit create_dest_gain_mixer(struct lola *chip, 826static int create_dest_gain_mixer(struct lola *chip,
827 int src_num, int src_ofs, 827 int src_num, int src_ofs,
828 int num, int ofs, char *name) 828 int num, int ofs, char *name)
829{ 829{
830 lola_dest_gain_mixer.count = num; 830 lola_dest_gain_mixer.count = num;
831 lola_dest_gain_mixer.name = name; 831 lola_dest_gain_mixer.name = name;
@@ -838,7 +838,7 @@ static int __devinit create_dest_gain_mixer(struct lola *chip,
838 838
839/* 839/*
840 */ 840 */
841int __devinit lola_create_mixer(struct lola *chip) 841int lola_create_mixer(struct lola *chip)
842{ 842{
843 int err; 843 int err;
844 844
diff --git a/sound/pci/lola/lola_pcm.c b/sound/pci/lola/lola_pcm.c
index c44db68eecb5..5ea85e8b83ab 100644
--- a/sound/pci/lola/lola_pcm.c
+++ b/sound/pci/lola/lola_pcm.c
@@ -597,7 +597,7 @@ static struct snd_pcm_ops lola_pcm_ops = {
597 .page = snd_pcm_sgbuf_ops_page, 597 .page = snd_pcm_sgbuf_ops_page,
598}; 598};
599 599
600int __devinit lola_create_pcm(struct lola *chip) 600int lola_create_pcm(struct lola *chip)
601{ 601{
602 struct snd_pcm *pcm; 602 struct snd_pcm *pcm;
603 int i, err; 603 int i, err;
@@ -690,7 +690,7 @@ static int lola_init_stream(struct lola *chip, struct lola_stream *str,
690 return 0; 690 return 0;
691} 691}
692 692
693int __devinit lola_init_pcm(struct lola *chip, int dir, int *nidp) 693int lola_init_pcm(struct lola *chip, int dir, int *nidp)
694{ 694{
695 struct lola_pcm *pcm = &chip->pcm[dir]; 695 struct lola_pcm *pcm = &chip->pcm[dir];
696 int i, nid, err; 696 int i, nid, err;
diff --git a/sound/pci/lola/lola_proc.c b/sound/pci/lola/lola_proc.c
index 9d7daf897c9d..04df83defc09 100644
--- a/sound/pci/lola/lola_proc.c
+++ b/sound/pci/lola/lola_proc.c
@@ -206,7 +206,7 @@ static void lola_proc_regs_read(struct snd_info_entry *entry,
206 } 206 }
207} 207}
208 208
209void __devinit lola_proc_debug_new(struct lola *chip) 209void lola_proc_debug_new(struct lola *chip)
210{ 210{
211 struct snd_info_entry *entry; 211 struct snd_info_entry *entry;
212 212
diff --git a/sound/pci/lx6464es/lx6464es.c b/sound/pci/lx6464es/lx6464es.c
index 5579b08bb35b..298bc9b72991 100644
--- a/sound/pci/lx6464es/lx6464es.c
+++ b/sound/pci/lx6464es/lx6464es.c
@@ -578,7 +578,7 @@ static int snd_lx6464es_dev_free(struct snd_device *device)
578} 578}
579 579
580/* reset the dsp during initialization */ 580/* reset the dsp during initialization */
581static int __devinit lx_init_xilinx_reset(struct lx6464es *chip) 581static int lx_init_xilinx_reset(struct lx6464es *chip)
582{ 582{
583 int i; 583 int i;
584 u32 plx_reg = lx_plx_reg_read(chip, ePLX_CHIPSC); 584 u32 plx_reg = lx_plx_reg_read(chip, ePLX_CHIPSC);
@@ -620,7 +620,7 @@ static int __devinit lx_init_xilinx_reset(struct lx6464es *chip)
620 return 0; 620 return 0;
621} 621}
622 622
623static int __devinit lx_init_xilinx_test(struct lx6464es *chip) 623static int lx_init_xilinx_test(struct lx6464es *chip)
624{ 624{
625 u32 reg; 625 u32 reg;
626 626
@@ -650,7 +650,7 @@ static int __devinit lx_init_xilinx_test(struct lx6464es *chip)
650} 650}
651 651
652/* initialize ethersound */ 652/* initialize ethersound */
653static int __devinit lx_init_ethersound_config(struct lx6464es *chip) 653static int lx_init_ethersound_config(struct lx6464es *chip)
654{ 654{
655 int i; 655 int i;
656 u32 orig_conf_es = lx_dsp_reg_read(chip, eReg_CONFES); 656 u32 orig_conf_es = lx_dsp_reg_read(chip, eReg_CONFES);
@@ -690,7 +690,7 @@ static int __devinit lx_init_ethersound_config(struct lx6464es *chip)
690 return 0; 690 return 0;
691} 691}
692 692
693static int __devinit lx_init_get_version_features(struct lx6464es *chip) 693static int lx_init_get_version_features(struct lx6464es *chip)
694{ 694{
695 u32 dsp_version; 695 u32 dsp_version;
696 696
@@ -759,7 +759,7 @@ static int lx_set_granularity(struct lx6464es *chip, u32 gran)
759} 759}
760 760
761/* initialize and test the xilinx dsp chip */ 761/* initialize and test the xilinx dsp chip */
762static int __devinit lx_init_dsp(struct lx6464es *chip) 762static int lx_init_dsp(struct lx6464es *chip)
763{ 763{
764 int err; 764 int err;
765 int i; 765 int i;
@@ -835,7 +835,7 @@ static struct snd_pcm_ops lx_ops_capture = {
835 .pointer = lx_pcm_stream_pointer, 835 .pointer = lx_pcm_stream_pointer,
836}; 836};
837 837
838static int __devinit lx_pcm_create(struct lx6464es *chip) 838static int lx_pcm_create(struct lx6464es *chip)
839{ 839{
840 int err; 840 int err;
841 struct snd_pcm *pcm; 841 struct snd_pcm *pcm;
@@ -907,7 +907,7 @@ static int lx_control_playback_put(struct snd_kcontrol *kcontrol,
907 return changed; 907 return changed;
908} 908}
909 909
910static struct snd_kcontrol_new lx_control_playback_switch __devinitdata = { 910static struct snd_kcontrol_new lx_control_playback_switch = {
911 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 911 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
912 .name = "PCM Playback Switch", 912 .name = "PCM Playback Switch",
913 .index = 0, 913 .index = 0,
@@ -954,7 +954,7 @@ static void lx_proc_levels_read(struct snd_info_entry *entry,
954 snd_iprintf(buffer, "\n"); 954 snd_iprintf(buffer, "\n");
955} 955}
956 956
957static int __devinit lx_proc_create(struct snd_card *card, struct lx6464es *chip) 957static int lx_proc_create(struct snd_card *card, struct lx6464es *chip)
958{ 958{
959 struct snd_info_entry *entry; 959 struct snd_info_entry *entry;
960 int err = snd_card_proc_new(card, "levels", &entry); 960 int err = snd_card_proc_new(card, "levels", &entry);
@@ -966,9 +966,9 @@ static int __devinit lx_proc_create(struct snd_card *card, struct lx6464es *chip
966} 966}
967 967
968 968
969static int __devinit snd_lx6464es_create(struct snd_card *card, 969static int snd_lx6464es_create(struct snd_card *card,
970 struct pci_dev *pci, 970 struct pci_dev *pci,
971 struct lx6464es **rchip) 971 struct lx6464es **rchip)
972{ 972{
973 struct lx6464es *chip; 973 struct lx6464es *chip;
974 int err; 974 int err;
@@ -1082,8 +1082,8 @@ alloc_failed:
1082 return err; 1082 return err;
1083} 1083}
1084 1084
1085static int __devinit snd_lx6464es_probe(struct pci_dev *pci, 1085static int snd_lx6464es_probe(struct pci_dev *pci,
1086 const struct pci_device_id *pci_id) 1086 const struct pci_device_id *pci_id)
1087{ 1087{
1088 static int dev; 1088 static int dev;
1089 struct snd_card *card; 1089 struct snd_card *card;
@@ -1136,7 +1136,7 @@ out_free:
1136 1136
1137} 1137}
1138 1138
1139static void __devexit snd_lx6464es_remove(struct pci_dev *pci) 1139static void snd_lx6464es_remove(struct pci_dev *pci)
1140{ 1140{
1141 snd_card_free(pci_get_drvdata(pci)); 1141 snd_card_free(pci_get_drvdata(pci));
1142 pci_set_drvdata(pci, NULL); 1142 pci_set_drvdata(pci, NULL);
@@ -1147,7 +1147,7 @@ static struct pci_driver lx6464es_driver = {
1147 .name = KBUILD_MODNAME, 1147 .name = KBUILD_MODNAME,
1148 .id_table = snd_lx6464es_ids, 1148 .id_table = snd_lx6464es_ids,
1149 .probe = snd_lx6464es_probe, 1149 .probe = snd_lx6464es_probe,
1150 .remove = __devexit_p(snd_lx6464es_remove), 1150 .remove = snd_lx6464es_remove,
1151}; 1151};
1152 1152
1153module_pci_driver(lx6464es_driver); 1153module_pci_driver(lx6464es_driver);
diff --git a/sound/pci/lx6464es/lx_core.c b/sound/pci/lx6464es/lx_core.c
index 8c3e7fcefd99..633c8607d053 100644
--- a/sound/pci/lx6464es/lx_core.c
+++ b/sound/pci/lx6464es/lx_core.c
@@ -385,7 +385,7 @@ polling_successful:
385 385
386 386
387/* low-level dsp access */ 387/* low-level dsp access */
388int __devinit lx_dsp_get_version(struct lx6464es *chip, u32 *rdsp_version) 388int lx_dsp_get_version(struct lx6464es *chip, u32 *rdsp_version)
389{ 389{
390 u16 ret; 390 u16 ret;
391 unsigned long flags; 391 unsigned long flags;
diff --git a/sound/pci/lx6464es/lx_core.h b/sound/pci/lx6464es/lx_core.h
index 4d7ff797a646..5ec5e04da1a5 100644
--- a/sound/pci/lx6464es/lx_core.h
+++ b/sound/pci/lx6464es/lx_core.h
@@ -109,7 +109,7 @@ struct lx_rmh {
109 109
110 110
111/* low-level dsp access */ 111/* low-level dsp access */
112int __devinit lx_dsp_get_version(struct lx6464es *chip, u32 *rdsp_version); 112int lx_dsp_get_version(struct lx6464es *chip, u32 *rdsp_version);
113int lx_dsp_get_clock_frequency(struct lx6464es *chip, u32 *rfreq); 113int lx_dsp_get_clock_frequency(struct lx6464es *chip, u32 *rfreq);
114int lx_dsp_set_granularity(struct lx6464es *chip, u32 gran); 114int lx_dsp_set_granularity(struct lx6464es *chip, u32 gran);
115int lx_dsp_read_async_events(struct lx6464es *chip, u32 *data); 115int lx_dsp_read_async_events(struct lx6464es *chip, u32 *data);
diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c
index eb3cd3a4315e..9387533f70dc 100644
--- a/sound/pci/maestro3.c
+++ b/sound/pci/maestro3.c
@@ -822,7 +822,7 @@ static DEFINE_PCI_DEVICE_TABLE(snd_m3_ids) = {
822 822
823MODULE_DEVICE_TABLE(pci, snd_m3_ids); 823MODULE_DEVICE_TABLE(pci, snd_m3_ids);
824 824
825static struct snd_pci_quirk m3_amp_quirk_list[] __devinitdata = { 825static struct snd_pci_quirk m3_amp_quirk_list[] = {
826 SND_PCI_QUIRK(0x0E11, 0x0094, "Compaq Evo N600c", 0x0c), 826 SND_PCI_QUIRK(0x0E11, 0x0094, "Compaq Evo N600c", 0x0c),
827 SND_PCI_QUIRK(0x10f7, 0x833e, "Panasonic CF-28", 0x0d), 827 SND_PCI_QUIRK(0x10f7, 0x833e, "Panasonic CF-28", 0x0d),
828 SND_PCI_QUIRK(0x10f7, 0x833d, "Panasonic CF-72", 0x0d), 828 SND_PCI_QUIRK(0x10f7, 0x833d, "Panasonic CF-72", 0x0d),
@@ -831,7 +831,7 @@ static struct snd_pci_quirk m3_amp_quirk_list[] __devinitdata = {
831 { } /* END */ 831 { } /* END */
832}; 832};
833 833
834static struct snd_pci_quirk m3_irda_quirk_list[] __devinitdata = { 834static struct snd_pci_quirk m3_irda_quirk_list[] = {
835 SND_PCI_QUIRK(0x1028, 0x00b0, "Dell Inspiron 4000", 1), 835 SND_PCI_QUIRK(0x1028, 0x00b0, "Dell Inspiron 4000", 1),
836 SND_PCI_QUIRK(0x1028, 0x00a4, "Dell Inspiron 8000", 1), 836 SND_PCI_QUIRK(0x1028, 0x00a4, "Dell Inspiron 8000", 1),
837 SND_PCI_QUIRK(0x1028, 0x00e6, "Dell Inspiron 8100", 1), 837 SND_PCI_QUIRK(0x1028, 0x00e6, "Dell Inspiron 8100", 1),
@@ -839,7 +839,7 @@ static struct snd_pci_quirk m3_irda_quirk_list[] __devinitdata = {
839}; 839};
840 840
841/* hardware volume quirks */ 841/* hardware volume quirks */
842static struct snd_pci_quirk m3_hv_quirk_list[] __devinitdata = { 842static struct snd_pci_quirk m3_hv_quirk_list[] = {
843 /* Allegro chips */ 843 /* Allegro chips */
844 SND_PCI_QUIRK(0x0E11, 0x002E, NULL, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD), 844 SND_PCI_QUIRK(0x0E11, 0x002E, NULL, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD),
845 SND_PCI_QUIRK(0x0E11, 0x0094, NULL, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD), 845 SND_PCI_QUIRK(0x0E11, 0x0094, NULL, HV_CTRL_ENABLE | HV_BUTTON_FROM_GD),
@@ -917,7 +917,7 @@ static struct snd_pci_quirk m3_hv_quirk_list[] __devinitdata = {
917}; 917};
918 918
919/* HP Omnibook quirks */ 919/* HP Omnibook quirks */
920static struct snd_pci_quirk m3_omnibook_quirk_list[] __devinitdata = { 920static struct snd_pci_quirk m3_omnibook_quirk_list[] = {
921 SND_PCI_QUIRK_ID(0x103c, 0x0010), /* HP OmniBook 6000 */ 921 SND_PCI_QUIRK_ID(0x103c, 0x0010), /* HP OmniBook 6000 */
922 SND_PCI_QUIRK_ID(0x103c, 0x0011), /* HP OmniBook 500 */ 922 SND_PCI_QUIRK_ID(0x103c, 0x0011), /* HP OmniBook 500 */
923 { } /* END */ 923 { } /* END */
@@ -1856,7 +1856,7 @@ static struct snd_pcm_ops snd_m3_capture_ops = {
1856 .pointer = snd_m3_pcm_pointer, 1856 .pointer = snd_m3_pcm_pointer,
1857}; 1857};
1858 1858
1859static int __devinit 1859static int
1860snd_m3_pcm(struct snd_m3 * chip, int device) 1860snd_m3_pcm(struct snd_m3 * chip, int device)
1861{ 1861{
1862 struct snd_pcm *pcm; 1862 struct snd_pcm *pcm;
@@ -2031,7 +2031,7 @@ static void snd_m3_ac97_reset(struct snd_m3 *chip)
2031#endif 2031#endif
2032} 2032}
2033 2033
2034static int __devinit snd_m3_mixer(struct snd_m3 *chip) 2034static int snd_m3_mixer(struct snd_m3 *chip)
2035{ 2035{
2036 struct snd_ac97_bus *pbus; 2036 struct snd_ac97_bus *pbus;
2037 struct snd_ac97_template ac97; 2037 struct snd_ac97_template ac97;
@@ -2173,7 +2173,7 @@ static void snd_m3_assp_init(struct snd_m3 *chip)
2173} 2173}
2174 2174
2175 2175
2176static int __devinit snd_m3_assp_client_init(struct snd_m3 *chip, struct m3_dma *s, int index) 2176static int snd_m3_assp_client_init(struct snd_m3 *chip, struct m3_dma *s, int index)
2177{ 2177{
2178 int data_bytes = 2 * ( MINISRC_TMP_BUFFER_SIZE / 2 + 2178 int data_bytes = 2 * ( MINISRC_TMP_BUFFER_SIZE / 2 +
2179 MINISRC_IN_BUFFER_SIZE / 2 + 2179 MINISRC_IN_BUFFER_SIZE / 2 +
@@ -2488,7 +2488,7 @@ static SIMPLE_DEV_PM_OPS(m3_pm, m3_suspend, m3_resume);
2488#endif /* CONFIG_PM_SLEEP */ 2488#endif /* CONFIG_PM_SLEEP */
2489 2489
2490#ifdef CONFIG_SND_MAESTRO3_INPUT 2490#ifdef CONFIG_SND_MAESTRO3_INPUT
2491static int __devinit snd_m3_input_register(struct snd_m3 *chip) 2491static int snd_m3_input_register(struct snd_m3 *chip)
2492{ 2492{
2493 struct input_dev *input_dev; 2493 struct input_dev *input_dev;
2494 int err; 2494 int err;
@@ -2532,7 +2532,7 @@ static int snd_m3_dev_free(struct snd_device *device)
2532 return snd_m3_free(chip); 2532 return snd_m3_free(chip);
2533} 2533}
2534 2534
2535static int __devinit 2535static int
2536snd_m3_create(struct snd_card *card, struct pci_dev *pci, 2536snd_m3_create(struct snd_card *card, struct pci_dev *pci,
2537 int enable_amp, 2537 int enable_amp,
2538 int amp_gpio, 2538 int amp_gpio,
@@ -2700,7 +2700,7 @@ snd_m3_create(struct snd_card *card, struct pci_dev *pci,
2700 2700
2701/* 2701/*
2702 */ 2702 */
2703static int __devinit 2703static int
2704snd_m3_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) 2704snd_m3_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
2705{ 2705{
2706 static int dev; 2706 static int dev;
@@ -2770,7 +2770,7 @@ snd_m3_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
2770 return 0; 2770 return 0;
2771} 2771}
2772 2772
2773static void __devexit snd_m3_remove(struct pci_dev *pci) 2773static void snd_m3_remove(struct pci_dev *pci)
2774{ 2774{
2775 snd_card_free(pci_get_drvdata(pci)); 2775 snd_card_free(pci_get_drvdata(pci));
2776 pci_set_drvdata(pci, NULL); 2776 pci_set_drvdata(pci, NULL);
@@ -2780,7 +2780,7 @@ static struct pci_driver m3_driver = {
2780 .name = KBUILD_MODNAME, 2780 .name = KBUILD_MODNAME,
2781 .id_table = snd_m3_ids, 2781 .id_table = snd_m3_ids,
2782 .probe = snd_m3_probe, 2782 .probe = snd_m3_probe,
2783 .remove = __devexit_p(snd_m3_remove), 2783 .remove = snd_m3_remove,
2784 .driver = { 2784 .driver = {
2785 .pm = M3_PM_OPS, 2785 .pm = M3_PM_OPS,
2786 }, 2786 },
diff --git a/sound/pci/mixart/mixart.c b/sound/pci/mixart/mixart.c
index 0762610c99c0..01f7f37a8410 100644
--- a/sound/pci/mixart/mixart.c
+++ b/sound/pci/mixart/mixart.c
@@ -1004,7 +1004,7 @@ static int snd_mixart_chip_dev_free(struct snd_device *device)
1004 1004
1005/* 1005/*
1006 */ 1006 */
1007static int __devinit snd_mixart_create(struct mixart_mgr *mgr, struct snd_card *card, int idx) 1007static int snd_mixart_create(struct mixart_mgr *mgr, struct snd_card *card, int idx)
1008{ 1008{
1009 int err; 1009 int err;
1010 struct snd_mixart *chip; 1010 struct snd_mixart *chip;
@@ -1180,7 +1180,7 @@ static void snd_mixart_proc_read(struct snd_info_entry *entry,
1180 } /* endif elf loaded */ 1180 } /* endif elf loaded */
1181} 1181}
1182 1182
1183static void __devinit snd_mixart_proc_init(struct snd_mixart *chip) 1183static void snd_mixart_proc_init(struct snd_mixart *chip)
1184{ 1184{
1185 struct snd_info_entry *entry; 1185 struct snd_info_entry *entry;
1186 1186
@@ -1209,8 +1209,8 @@ static void __devinit snd_mixart_proc_init(struct snd_mixart *chip)
1209/* 1209/*
1210 * probe function - creates the card manager 1210 * probe function - creates the card manager
1211 */ 1211 */
1212static int __devinit snd_mixart_probe(struct pci_dev *pci, 1212static int snd_mixart_probe(struct pci_dev *pci,
1213 const struct pci_device_id *pci_id) 1213 const struct pci_device_id *pci_id)
1214{ 1214{
1215 static int dev; 1215 static int dev;
1216 struct mixart_mgr *mgr; 1216 struct mixart_mgr *mgr;
@@ -1374,7 +1374,7 @@ static int __devinit snd_mixart_probe(struct pci_dev *pci,
1374 return 0; 1374 return 0;
1375} 1375}
1376 1376
1377static void __devexit snd_mixart_remove(struct pci_dev *pci) 1377static void snd_mixart_remove(struct pci_dev *pci)
1378{ 1378{
1379 snd_mixart_free(pci_get_drvdata(pci)); 1379 snd_mixart_free(pci_get_drvdata(pci));
1380 pci_set_drvdata(pci, NULL); 1380 pci_set_drvdata(pci, NULL);
@@ -1384,7 +1384,7 @@ static struct pci_driver mixart_driver = {
1384 .name = KBUILD_MODNAME, 1384 .name = KBUILD_MODNAME,
1385 .id_table = snd_mixart_ids, 1385 .id_table = snd_mixart_ids,
1386 .probe = snd_mixart_probe, 1386 .probe = snd_mixart_probe,
1387 .remove = __devexit_p(snd_mixart_remove), 1387 .remove = snd_mixart_remove,
1388}; 1388};
1389 1389
1390module_pci_driver(mixart_driver); 1390module_pci_driver(mixart_driver);
diff --git a/sound/pci/mixart/mixart_hwdep.c b/sound/pci/mixart/mixart_hwdep.c
index e0f4d87555a0..ece1f831c16a 100644
--- a/sound/pci/mixart/mixart_hwdep.c
+++ b/sound/pci/mixart/mixart_hwdep.c
@@ -546,14 +546,6 @@ static int mixart_dsp_load(struct mixart_mgr* mgr, int index, const struct firmw
546} 546}
547 547
548 548
549#if defined(CONFIG_FW_LOADER) || defined(CONFIG_FW_LOADER_MODULE)
550#if !defined(CONFIG_USE_MIXARTLOADER) && !defined(CONFIG_SND_MIXART) /* built-in kernel */
551#define SND_MIXART_FW_LOADER /* use the standard firmware loader */
552#endif
553#endif
554
555#ifdef SND_MIXART_FW_LOADER
556
557int snd_mixart_setup_firmware(struct mixart_mgr *mgr) 549int snd_mixart_setup_firmware(struct mixart_mgr *mgr)
558{ 550{
559 static char *fw_files[3] = { 551 static char *fw_files[3] = {
@@ -583,71 +575,3 @@ int snd_mixart_setup_firmware(struct mixart_mgr *mgr)
583MODULE_FIRMWARE("mixart/miXart8.xlx"); 575MODULE_FIRMWARE("mixart/miXart8.xlx");
584MODULE_FIRMWARE("mixart/miXart8.elf"); 576MODULE_FIRMWARE("mixart/miXart8.elf");
585MODULE_FIRMWARE("mixart/miXart8AES.xlx"); 577MODULE_FIRMWARE("mixart/miXart8AES.xlx");
586
587#else /* old style firmware loading */
588
589/* miXart hwdep interface id string */
590#define SND_MIXART_HWDEP_ID "miXart Loader"
591
592static int mixart_hwdep_dsp_status(struct snd_hwdep *hw,
593 struct snd_hwdep_dsp_status *info)
594{
595 struct mixart_mgr *mgr = hw->private_data;
596
597 strcpy(info->id, "miXart");
598 info->num_dsps = MIXART_HARDW_FILES_MAX_INDEX;
599
600 if (mgr->dsp_loaded & (1 << MIXART_MOTHERBOARD_ELF_INDEX))
601 info->chip_ready = 1;
602
603 info->version = MIXART_DRIVER_VERSION;
604 return 0;
605}
606
607static int mixart_hwdep_dsp_load(struct snd_hwdep *hw,
608 struct snd_hwdep_dsp_image *dsp)
609{
610 struct mixart_mgr* mgr = hw->private_data;
611 struct firmware fw;
612 int err;
613
614 fw.size = dsp->length;
615 fw.data = vmalloc(dsp->length);
616 if (! fw.data) {
617 snd_printk(KERN_ERR "miXart: cannot allocate image size %d\n",
618 (int)dsp->length);
619 return -ENOMEM;
620 }
621 if (copy_from_user((void *) fw.data, dsp->image, dsp->length)) {
622 vfree(fw.data);
623 return -EFAULT;
624 }
625 err = mixart_dsp_load(mgr, dsp->index, &fw);
626 vfree(fw.data);
627 if (err < 0)
628 return err;
629 mgr->dsp_loaded |= 1 << dsp->index;
630 return err;
631}
632
633int snd_mixart_setup_firmware(struct mixart_mgr *mgr)
634{
635 int err;
636 struct snd_hwdep *hw;
637
638 /* only create hwdep interface for first cardX (see "index" module parameter)*/
639 if ((err = snd_hwdep_new(mgr->chip[0]->card, SND_MIXART_HWDEP_ID, 0, &hw)) < 0)
640 return err;
641
642 hw->iface = SNDRV_HWDEP_IFACE_MIXART;
643 hw->private_data = mgr;
644 hw->ops.dsp_status = mixart_hwdep_dsp_status;
645 hw->ops.dsp_load = mixart_hwdep_dsp_load;
646 hw->exclusive = 1;
647 sprintf(hw->name, SND_MIXART_HWDEP_ID);
648 mgr->dsp_loaded = 0;
649
650 return snd_card_register(mgr->chip[0]->card);
651}
652
653#endif /* SND_MIXART_FW_LOADER */
diff --git a/sound/pci/nm256/nm256.c b/sound/pci/nm256/nm256.c
index e80e9a1e84aa..563a193e36a3 100644
--- a/sound/pci/nm256/nm256.c
+++ b/sound/pci/nm256/nm256.c
@@ -928,7 +928,7 @@ static struct snd_pcm_ops snd_nm256_capture_ops = {
928 .mmap = snd_pcm_lib_mmap_iomem, 928 .mmap = snd_pcm_lib_mmap_iomem,
929}; 929};
930 930
931static int __devinit 931static int
932snd_nm256_pcm(struct nm256 *chip, int device) 932snd_nm256_pcm(struct nm256 *chip, int device)
933{ 933{
934 struct snd_pcm *pcm; 934 struct snd_pcm *pcm;
@@ -1295,7 +1295,7 @@ snd_nm256_ac97_reset(struct snd_ac97 *ac97)
1295} 1295}
1296 1296
1297/* create an ac97 mixer interface */ 1297/* create an ac97 mixer interface */
1298static int __devinit 1298static int
1299snd_nm256_mixer(struct nm256 *chip) 1299snd_nm256_mixer(struct nm256 *chip)
1300{ 1300{
1301 struct snd_ac97_bus *pbus; 1301 struct snd_ac97_bus *pbus;
@@ -1336,7 +1336,7 @@ snd_nm256_mixer(struct nm256 *chip)
1336 * RAM. 1336 * RAM.
1337 */ 1337 */
1338 1338
1339static int __devinit 1339static int
1340snd_nm256_peek_for_sig(struct nm256 *chip) 1340snd_nm256_peek_for_sig(struct nm256 *chip)
1341{ 1341{
1342 /* The signature is located 1K below the end of video RAM. */ 1342 /* The signature is located 1K below the end of video RAM. */
@@ -1472,7 +1472,7 @@ static int snd_nm256_dev_free(struct snd_device *device)
1472 return snd_nm256_free(chip); 1472 return snd_nm256_free(chip);
1473} 1473}
1474 1474
1475static int __devinit 1475static int
1476snd_nm256_create(struct snd_card *card, struct pci_dev *pci, 1476snd_nm256_create(struct snd_card *card, struct pci_dev *pci,
1477 struct nm256 **chip_ret) 1477 struct nm256 **chip_ret)
1478{ 1478{
@@ -1639,7 +1639,7 @@ __error:
1639 1639
1640enum { NM_BLACKLISTED, NM_RESET_WORKAROUND, NM_RESET_WORKAROUND_2 }; 1640enum { NM_BLACKLISTED, NM_RESET_WORKAROUND, NM_RESET_WORKAROUND_2 };
1641 1641
1642static struct snd_pci_quirk nm256_quirks[] __devinitdata = { 1642static struct snd_pci_quirk nm256_quirks[] = {
1643 /* HP omnibook 4150 has cs4232 codec internally */ 1643 /* HP omnibook 4150 has cs4232 codec internally */
1644 SND_PCI_QUIRK(0x103c, 0x0007, "HP omnibook 4150", NM_BLACKLISTED), 1644 SND_PCI_QUIRK(0x103c, 0x0007, "HP omnibook 4150", NM_BLACKLISTED),
1645 /* Reset workarounds to avoid lock-ups */ 1645 /* Reset workarounds to avoid lock-ups */
@@ -1650,8 +1650,8 @@ static struct snd_pci_quirk nm256_quirks[] __devinitdata = {
1650}; 1650};
1651 1651
1652 1652
1653static int __devinit snd_nm256_probe(struct pci_dev *pci, 1653static int snd_nm256_probe(struct pci_dev *pci,
1654 const struct pci_device_id *pci_id) 1654 const struct pci_device_id *pci_id)
1655{ 1655{
1656 struct snd_card *card; 1656 struct snd_card *card;
1657 struct nm256 *chip; 1657 struct nm256 *chip;
@@ -1742,7 +1742,7 @@ static int __devinit snd_nm256_probe(struct pci_dev *pci,
1742 return 0; 1742 return 0;
1743} 1743}
1744 1744
1745static void __devexit snd_nm256_remove(struct pci_dev *pci) 1745static void snd_nm256_remove(struct pci_dev *pci)
1746{ 1746{
1747 snd_card_free(pci_get_drvdata(pci)); 1747 snd_card_free(pci_get_drvdata(pci));
1748 pci_set_drvdata(pci, NULL); 1748 pci_set_drvdata(pci, NULL);
@@ -1753,7 +1753,7 @@ static struct pci_driver nm256_driver = {
1753 .name = KBUILD_MODNAME, 1753 .name = KBUILD_MODNAME,
1754 .id_table = snd_nm256_ids, 1754 .id_table = snd_nm256_ids,
1755 .probe = snd_nm256_probe, 1755 .probe = snd_nm256_probe,
1756 .remove = __devexit_p(snd_nm256_remove), 1756 .remove = snd_nm256_remove,
1757 .driver = { 1757 .driver = {
1758 .pm = NM256_PM_OPS, 1758 .pm = NM256_PM_OPS,
1759 }, 1759 },
diff --git a/sound/pci/oxygen/oxygen.c b/sound/pci/oxygen/oxygen.c
index 2becae155a48..ada6c256378e 100644
--- a/sound/pci/oxygen/oxygen.c
+++ b/sound/pci/oxygen/oxygen.c
@@ -756,8 +756,8 @@ static const struct oxygen_model model_generic = {
756 .adc_i2s_format = OXYGEN_I2S_FORMAT_LJUST, 756 .adc_i2s_format = OXYGEN_I2S_FORMAT_LJUST,
757}; 757};
758 758
759static int __devinit get_oxygen_model(struct oxygen *chip, 759static int get_oxygen_model(struct oxygen *chip,
760 const struct pci_device_id *id) 760 const struct pci_device_id *id)
761{ 761{
762 static const char *const names[] = { 762 static const char *const names[] = {
763 [MODEL_MERIDIAN] = "AuzenTech X-Meridian", 763 [MODEL_MERIDIAN] = "AuzenTech X-Meridian",
@@ -848,8 +848,8 @@ static int __devinit get_oxygen_model(struct oxygen *chip,
848 return 0; 848 return 0;
849} 849}
850 850
851static int __devinit generic_oxygen_probe(struct pci_dev *pci, 851static int generic_oxygen_probe(struct pci_dev *pci,
852 const struct pci_device_id *pci_id) 852 const struct pci_device_id *pci_id)
853{ 853{
854 static int dev; 854 static int dev;
855 int err; 855 int err;
@@ -871,7 +871,7 @@ static struct pci_driver oxygen_driver = {
871 .name = KBUILD_MODNAME, 871 .name = KBUILD_MODNAME,
872 .id_table = oxygen_ids, 872 .id_table = oxygen_ids,
873 .probe = generic_oxygen_probe, 873 .probe = generic_oxygen_probe,
874 .remove = __devexit_p(oxygen_pci_remove), 874 .remove = oxygen_pci_remove,
875#ifdef CONFIG_PM_SLEEP 875#ifdef CONFIG_PM_SLEEP
876 .driver = { 876 .driver = {
877 .pm = &oxygen_pci_pm, 877 .pm = &oxygen_pci_pm,
diff --git a/sound/pci/oxygen/virtuoso.c b/sound/pci/oxygen/virtuoso.c
index 3d71423b23bc..64b9fda5f04a 100644
--- a/sound/pci/oxygen/virtuoso.c
+++ b/sound/pci/oxygen/virtuoso.c
@@ -52,13 +52,14 @@ static DEFINE_PCI_DEVICE_TABLE(xonar_ids) = {
52 { OXYGEN_PCI_SUBID(0x1043, 0x835d) }, 52 { OXYGEN_PCI_SUBID(0x1043, 0x835d) },
53 { OXYGEN_PCI_SUBID(0x1043, 0x835e) }, 53 { OXYGEN_PCI_SUBID(0x1043, 0x835e) },
54 { OXYGEN_PCI_SUBID(0x1043, 0x838e) }, 54 { OXYGEN_PCI_SUBID(0x1043, 0x838e) },
55 { OXYGEN_PCI_SUBID(0x1043, 0x8522) },
55 { OXYGEN_PCI_SUBID_BROKEN_EEPROM }, 56 { OXYGEN_PCI_SUBID_BROKEN_EEPROM },
56 { } 57 { }
57}; 58};
58MODULE_DEVICE_TABLE(pci, xonar_ids); 59MODULE_DEVICE_TABLE(pci, xonar_ids);
59 60
60static int __devinit get_xonar_model(struct oxygen *chip, 61static int get_xonar_model(struct oxygen *chip,
61 const struct pci_device_id *id) 62 const struct pci_device_id *id)
62{ 63{
63 if (get_xonar_pcm179x_model(chip, id) >= 0) 64 if (get_xonar_pcm179x_model(chip, id) >= 0)
64 return 0; 65 return 0;
@@ -69,8 +70,8 @@ static int __devinit get_xonar_model(struct oxygen *chip,
69 return -EINVAL; 70 return -EINVAL;
70} 71}
71 72
72static int __devinit xonar_probe(struct pci_dev *pci, 73static int xonar_probe(struct pci_dev *pci,
73 const struct pci_device_id *pci_id) 74 const struct pci_device_id *pci_id)
74{ 75{
75 static int dev; 76 static int dev;
76 int err; 77 int err;
@@ -92,7 +93,7 @@ static struct pci_driver xonar_driver = {
92 .name = KBUILD_MODNAME, 93 .name = KBUILD_MODNAME,
93 .id_table = xonar_ids, 94 .id_table = xonar_ids,
94 .probe = xonar_probe, 95 .probe = xonar_probe,
95 .remove = __devexit_p(oxygen_pci_remove), 96 .remove = oxygen_pci_remove,
96#ifdef CONFIG_PM_SLEEP 97#ifdef CONFIG_PM_SLEEP
97 .driver = { 98 .driver = {
98 .pm = &oxygen_pci_pm, 99 .pm = &oxygen_pci_pm,
diff --git a/sound/pci/oxygen/xonar_cs43xx.c b/sound/pci/oxygen/xonar_cs43xx.c
index c8febf4b9bd6..d231b93d6ab5 100644
--- a/sound/pci/oxygen/xonar_cs43xx.c
+++ b/sound/pci/oxygen/xonar_cs43xx.c
@@ -431,8 +431,8 @@ static const struct oxygen_model model_xonar_d1 = {
431 .adc_i2s_format = OXYGEN_I2S_FORMAT_LJUST, 431 .adc_i2s_format = OXYGEN_I2S_FORMAT_LJUST,
432}; 432};
433 433
434int __devinit get_xonar_cs43xx_model(struct oxygen *chip, 434int get_xonar_cs43xx_model(struct oxygen *chip,
435 const struct pci_device_id *id) 435 const struct pci_device_id *id)
436{ 436{
437 switch (id->subdevice) { 437 switch (id->subdevice) {
438 case 0x834f: 438 case 0x834f:
diff --git a/sound/pci/oxygen/xonar_pcm179x.c b/sound/pci/oxygen/xonar_pcm179x.c
index 8433aa7c3d75..c8c7f2c9b355 100644
--- a/sound/pci/oxygen/xonar_pcm179x.c
+++ b/sound/pci/oxygen/xonar_pcm179x.c
@@ -1087,8 +1087,8 @@ static const struct oxygen_model model_xonar_st = {
1087 .adc_i2s_format = OXYGEN_I2S_FORMAT_LJUST, 1087 .adc_i2s_format = OXYGEN_I2S_FORMAT_LJUST,
1088}; 1088};
1089 1089
1090int __devinit get_xonar_pcm179x_model(struct oxygen *chip, 1090int get_xonar_pcm179x_model(struct oxygen *chip,
1091 const struct pci_device_id *id) 1091 const struct pci_device_id *id)
1092{ 1092{
1093 switch (id->subdevice) { 1093 switch (id->subdevice) {
1094 case 0x8269: 1094 case 0x8269:
diff --git a/sound/pci/oxygen/xonar_wm87x6.c b/sound/pci/oxygen/xonar_wm87x6.c
index 63cff90706bf..6ce68604c25e 100644
--- a/sound/pci/oxygen/xonar_wm87x6.c
+++ b/sound/pci/oxygen/xonar_wm87x6.c
@@ -1255,7 +1255,6 @@ static void dump_wm87x6_registers(struct oxygen *chip,
1255} 1255}
1256 1256
1257static const struct oxygen_model model_xonar_ds = { 1257static const struct oxygen_model model_xonar_ds = {
1258 .shortname = "Xonar DS",
1259 .longname = "Asus Virtuoso 66", 1258 .longname = "Asus Virtuoso 66",
1260 .chip = "AV200", 1259 .chip = "AV200",
1261 .init = xonar_ds_init, 1260 .init = xonar_ds_init,
@@ -1321,12 +1320,17 @@ static const struct oxygen_model model_xonar_hdav_slim = {
1321 .adc_i2s_format = OXYGEN_I2S_FORMAT_LJUST, 1320 .adc_i2s_format = OXYGEN_I2S_FORMAT_LJUST,
1322}; 1321};
1323 1322
1324int __devinit get_xonar_wm87x6_model(struct oxygen *chip, 1323int get_xonar_wm87x6_model(struct oxygen *chip,
1325 const struct pci_device_id *id) 1324 const struct pci_device_id *id)
1326{ 1325{
1327 switch (id->subdevice) { 1326 switch (id->subdevice) {
1328 case 0x838e: 1327 case 0x838e:
1329 chip->model = model_xonar_ds; 1328 chip->model = model_xonar_ds;
1329 chip->model.shortname = "Xonar DS";
1330 break;
1331 case 0x8522:
1332 chip->model = model_xonar_ds;
1333 chip->model.shortname = "Xonar DSX";
1330 break; 1334 break;
1331 case 0x835e: 1335 case 0x835e:
1332 chip->model = model_xonar_hdav_slim; 1336 chip->model = model_xonar_hdav_slim;
diff --git a/sound/pci/pcxhr/pcxhr.c b/sound/pci/pcxhr/pcxhr.c
index be4f1456009a..b97384ad946d 100644
--- a/sound/pci/pcxhr/pcxhr.c
+++ b/sound/pci/pcxhr/pcxhr.c
@@ -1203,8 +1203,8 @@ static int pcxhr_chip_dev_free(struct snd_device *device)
1203 1203
1204/* 1204/*
1205 */ 1205 */
1206static int __devinit pcxhr_create(struct pcxhr_mgr *mgr, 1206static int pcxhr_create(struct pcxhr_mgr *mgr,
1207 struct snd_card *card, int idx) 1207 struct snd_card *card, int idx)
1208{ 1208{
1209 int err; 1209 int err;
1210 struct snd_pcxhr *chip; 1210 struct snd_pcxhr *chip;
@@ -1453,7 +1453,7 @@ static void pcxhr_proc_ltc(struct snd_info_entry *entry,
1453 } 1453 }
1454} 1454}
1455 1455
1456static void __devinit pcxhr_proc_init(struct snd_pcxhr *chip) 1456static void pcxhr_proc_init(struct snd_pcxhr *chip)
1457{ 1457{
1458 struct snd_info_entry *entry; 1458 struct snd_info_entry *entry;
1459 1459
@@ -1513,8 +1513,8 @@ static int pcxhr_free(struct pcxhr_mgr *mgr)
1513/* 1513/*
1514 * probe function - creates the card manager 1514 * probe function - creates the card manager
1515 */ 1515 */
1516static int __devinit pcxhr_probe(struct pci_dev *pci, 1516static int pcxhr_probe(struct pci_dev *pci,
1517 const struct pci_device_id *pci_id) 1517 const struct pci_device_id *pci_id)
1518{ 1518{
1519 static int dev; 1519 static int dev;
1520 struct pcxhr_mgr *mgr; 1520 struct pcxhr_mgr *mgr;
@@ -1688,7 +1688,7 @@ static int __devinit pcxhr_probe(struct pci_dev *pci,
1688 return 0; 1688 return 0;
1689} 1689}
1690 1690
1691static void __devexit pcxhr_remove(struct pci_dev *pci) 1691static void pcxhr_remove(struct pci_dev *pci)
1692{ 1692{
1693 pcxhr_free(pci_get_drvdata(pci)); 1693 pcxhr_free(pci_get_drvdata(pci));
1694 pci_set_drvdata(pci, NULL); 1694 pci_set_drvdata(pci, NULL);
@@ -1698,7 +1698,7 @@ static struct pci_driver pcxhr_driver = {
1698 .name = KBUILD_MODNAME, 1698 .name = KBUILD_MODNAME,
1699 .id_table = pcxhr_ids, 1699 .id_table = pcxhr_ids,
1700 .probe = pcxhr_probe, 1700 .probe = pcxhr_probe,
1701 .remove = __devexit_p(pcxhr_remove), 1701 .remove = pcxhr_remove,
1702}; 1702};
1703 1703
1704module_pci_driver(pcxhr_driver); 1704module_pci_driver(pcxhr_driver);
diff --git a/sound/pci/pcxhr/pcxhr_hwdep.c b/sound/pci/pcxhr/pcxhr_hwdep.c
index bf207e317f71..d995175c1c48 100644
--- a/sound/pci/pcxhr/pcxhr_hwdep.c
+++ b/sound/pci/pcxhr/pcxhr_hwdep.c
@@ -35,13 +35,6 @@
35#include "pcxhr_mix22.h" 35#include "pcxhr_mix22.h"
36 36
37 37
38#if defined(CONFIG_FW_LOADER) || defined(CONFIG_FW_LOADER_MODULE)
39#if !defined(CONFIG_USE_PCXHRLOADER) && !defined(CONFIG_SND_PCXHR) /* built-in kernel */
40#define SND_PCXHR_FW_LOADER /* use the standard firmware loader */
41#endif
42#endif
43
44
45static int pcxhr_sub_init(struct pcxhr_mgr *mgr); 38static int pcxhr_sub_init(struct pcxhr_mgr *mgr);
46/* 39/*
47 * get basic information and init pcxhr card 40 * get basic information and init pcxhr card
@@ -362,8 +355,6 @@ static int pcxhr_dsp_load(struct pcxhr_mgr *mgr, int index,
362/* 355/*
363 * fw loader entry 356 * fw loader entry
364 */ 357 */
365#ifdef SND_PCXHR_FW_LOADER
366
367int pcxhr_setup_firmware(struct pcxhr_mgr *mgr) 358int pcxhr_setup_firmware(struct pcxhr_mgr *mgr)
368{ 359{
369 static char *fw_files[][5] = { 360 static char *fw_files[][5] = {
@@ -424,80 +415,3 @@ MODULE_FIRMWARE("pcxhr/xlxc924.dat");
424MODULE_FIRMWARE("pcxhr/dspe924.e56"); 415MODULE_FIRMWARE("pcxhr/dspe924.e56");
425MODULE_FIRMWARE("pcxhr/dspb924.b56"); 416MODULE_FIRMWARE("pcxhr/dspb924.b56");
426MODULE_FIRMWARE("pcxhr/dspd222.d56"); 417MODULE_FIRMWARE("pcxhr/dspd222.d56");
427
428
429#else /* old style firmware loading */
430
431/* pcxhr hwdep interface id string */
432#define PCXHR_HWDEP_ID "pcxhr loader"
433
434
435static int pcxhr_hwdep_dsp_status(struct snd_hwdep *hw,
436 struct snd_hwdep_dsp_status *info)
437{
438 struct pcxhr_mgr *mgr = hw->private_data;
439 sprintf(info->id, "pcxhr%d", mgr->fw_file_set);
440 info->num_dsps = PCXHR_FIRMWARE_FILES_MAX_INDEX;
441
442 if (hw->dsp_loaded & (1 << PCXHR_FIRMWARE_DSP_MAIN_INDEX))
443 info->chip_ready = 1;
444
445 info->version = PCXHR_DRIVER_VERSION;
446 return 0;
447}
448
449static int pcxhr_hwdep_dsp_load(struct snd_hwdep *hw,
450 struct snd_hwdep_dsp_image *dsp)
451{
452 struct pcxhr_mgr *mgr = hw->private_data;
453 int err;
454 struct firmware fw;
455
456 fw.size = dsp->length;
457 fw.data = vmalloc(fw.size);
458 if (! fw.data) {
459 snd_printk(KERN_ERR "pcxhr: cannot allocate dsp image "
460 "(%lu bytes)\n", (unsigned long)fw.size);
461 return -ENOMEM;
462 }
463 if (copy_from_user((void *)fw.data, dsp->image, dsp->length)) {
464 vfree(fw.data);
465 return -EFAULT;
466 }
467 err = pcxhr_dsp_load(mgr, dsp->index, &fw);
468 vfree(fw.data);
469 if (err < 0)
470 return err;
471 mgr->dsp_loaded |= 1 << dsp->index;
472 return 0;
473}
474
475int pcxhr_setup_firmware(struct pcxhr_mgr *mgr)
476{
477 int err;
478 struct snd_hwdep *hw;
479
480 /* only create hwdep interface for first cardX
481 * (see "index" module parameter)
482 */
483 err = snd_hwdep_new(mgr->chip[0]->card, PCXHR_HWDEP_ID, 0, &hw);
484 if (err < 0)
485 return err;
486
487 hw->iface = SNDRV_HWDEP_IFACE_PCXHR;
488 hw->private_data = mgr;
489 hw->ops.dsp_status = pcxhr_hwdep_dsp_status;
490 hw->ops.dsp_load = pcxhr_hwdep_dsp_load;
491 hw->exclusive = 1;
492 /* stereo cards don't need fw_file_0 -> dsp_loaded = 1 */
493 hw->dsp_loaded = mgr->is_hr_stereo ? 1 : 0;
494 mgr->dsp_loaded = 0;
495 sprintf(hw->name, PCXHR_HWDEP_ID);
496
497 err = snd_card_register(mgr->chip[0]->card);
498 if (err < 0)
499 return err;
500 return 0;
501}
502
503#endif /* SND_PCXHR_FW_LOADER */
diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c
index 7d291542c5ba..63c1c8041554 100644
--- a/sound/pci/riptide/riptide.c
+++ b/sound/pci/riptide/riptide.c
@@ -1706,7 +1706,7 @@ static struct snd_pcm_ops snd_riptide_capture_ops = {
1706 .pointer = snd_riptide_pointer, 1706 .pointer = snd_riptide_pointer,
1707}; 1707};
1708 1708
1709static int __devinit 1709static int
1710snd_riptide_pcm(struct snd_riptide *chip, int device, struct snd_pcm **rpcm) 1710snd_riptide_pcm(struct snd_riptide *chip, int device, struct snd_pcm **rpcm)
1711{ 1711{
1712 struct snd_pcm *pcm; 1712 struct snd_pcm *pcm;
@@ -1857,7 +1857,7 @@ static int snd_riptide_dev_free(struct snd_device *device)
1857 return snd_riptide_free(chip); 1857 return snd_riptide_free(chip);
1858} 1858}
1859 1859
1860static int __devinit 1860static int
1861snd_riptide_create(struct snd_card *card, struct pci_dev *pci, 1861snd_riptide_create(struct snd_card *card, struct pci_dev *pci,
1862 struct snd_riptide **rchip) 1862 struct snd_riptide **rchip)
1863{ 1863{
@@ -1993,7 +1993,7 @@ snd_riptide_proc_read(struct snd_info_entry *entry,
1993 snd_iprintf(buffer, "\n"); 1993 snd_iprintf(buffer, "\n");
1994} 1994}
1995 1995
1996static void __devinit snd_riptide_proc_init(struct snd_riptide *chip) 1996static void snd_riptide_proc_init(struct snd_riptide *chip)
1997{ 1997{
1998 struct snd_info_entry *entry; 1998 struct snd_info_entry *entry;
1999 1999
@@ -2001,7 +2001,7 @@ static void __devinit snd_riptide_proc_init(struct snd_riptide *chip)
2001 snd_info_set_text_ops(entry, chip, snd_riptide_proc_read); 2001 snd_info_set_text_ops(entry, chip, snd_riptide_proc_read);
2002} 2002}
2003 2003
2004static int __devinit snd_riptide_mixer(struct snd_riptide *chip) 2004static int snd_riptide_mixer(struct snd_riptide *chip)
2005{ 2005{
2006 struct snd_ac97_bus *pbus; 2006 struct snd_ac97_bus *pbus;
2007 struct snd_ac97_template ac97; 2007 struct snd_ac97_template ac97;
@@ -2027,7 +2027,7 @@ static int __devinit snd_riptide_mixer(struct snd_riptide *chip)
2027 2027
2028#ifdef SUPPORT_JOYSTICK 2028#ifdef SUPPORT_JOYSTICK
2029 2029
2030static int __devinit 2030static int
2031snd_riptide_joystick_probe(struct pci_dev *pci, const struct pci_device_id *id) 2031snd_riptide_joystick_probe(struct pci_dev *pci, const struct pci_device_id *id)
2032{ 2032{
2033 static int dev; 2033 static int dev;
@@ -2060,7 +2060,7 @@ snd_riptide_joystick_probe(struct pci_dev *pci, const struct pci_device_id *id)
2060 return 0; 2060 return 0;
2061} 2061}
2062 2062
2063static void __devexit snd_riptide_joystick_remove(struct pci_dev *pci) 2063static void snd_riptide_joystick_remove(struct pci_dev *pci)
2064{ 2064{
2065 struct gameport *gameport = pci_get_drvdata(pci); 2065 struct gameport *gameport = pci_get_drvdata(pci);
2066 if (gameport) { 2066 if (gameport) {
@@ -2071,7 +2071,7 @@ static void __devexit snd_riptide_joystick_remove(struct pci_dev *pci)
2071} 2071}
2072#endif 2072#endif
2073 2073
2074static int __devinit 2074static int
2075snd_card_riptide_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) 2075snd_card_riptide_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
2076{ 2076{
2077 static int dev; 2077 static int dev;
@@ -2176,7 +2176,7 @@ snd_card_riptide_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
2176 return err; 2176 return err;
2177} 2177}
2178 2178
2179static void __devexit snd_card_riptide_remove(struct pci_dev *pci) 2179static void snd_card_riptide_remove(struct pci_dev *pci)
2180{ 2180{
2181 snd_card_free(pci_get_drvdata(pci)); 2181 snd_card_free(pci_get_drvdata(pci));
2182 pci_set_drvdata(pci, NULL); 2182 pci_set_drvdata(pci, NULL);
@@ -2186,7 +2186,7 @@ static struct pci_driver driver = {
2186 .name = KBUILD_MODNAME, 2186 .name = KBUILD_MODNAME,
2187 .id_table = snd_riptide_ids, 2187 .id_table = snd_riptide_ids,
2188 .probe = snd_card_riptide_probe, 2188 .probe = snd_card_riptide_probe,
2189 .remove = __devexit_p(snd_card_riptide_remove), 2189 .remove = snd_card_riptide_remove,
2190 .driver = { 2190 .driver = {
2191 .pm = RIPTIDE_PM_OPS, 2191 .pm = RIPTIDE_PM_OPS,
2192 }, 2192 },
@@ -2197,7 +2197,7 @@ static struct pci_driver joystick_driver = {
2197 .name = KBUILD_MODNAME "-joystick", 2197 .name = KBUILD_MODNAME "-joystick",
2198 .id_table = snd_riptide_joystick_ids, 2198 .id_table = snd_riptide_joystick_ids,
2199 .probe = snd_riptide_joystick_probe, 2199 .probe = snd_riptide_joystick_probe,
2200 .remove = __devexit_p(snd_riptide_joystick_remove), 2200 .remove = snd_riptide_joystick_remove,
2201}; 2201};
2202#endif 2202#endif
2203 2203
diff --git a/sound/pci/rme32.c b/sound/pci/rme32.c
index 46b3629dda22..2450663e1a18 100644
--- a/sound/pci/rme32.c
+++ b/sound/pci/rme32.c
@@ -1332,7 +1332,7 @@ snd_rme32_free_adat_pcm(struct snd_pcm *pcm)
1332 rme32->adat_pcm = NULL; 1332 rme32->adat_pcm = NULL;
1333} 1333}
1334 1334
1335static int __devinit snd_rme32_create(struct rme32 * rme32) 1335static int snd_rme32_create(struct rme32 *rme32)
1336{ 1336{
1337 struct pci_dev *pci = rme32->pci; 1337 struct pci_dev *pci = rme32->pci;
1338 int err; 1338 int err;
@@ -1554,7 +1554,7 @@ snd_rme32_proc_read(struct snd_info_entry * entry, struct snd_info_buffer *buffe
1554 } 1554 }
1555} 1555}
1556 1556
1557static void __devinit snd_rme32_proc_init(struct rme32 * rme32) 1557static void snd_rme32_proc_init(struct rme32 *rme32)
1558{ 1558{
1559 struct snd_info_entry *entry; 1559 struct snd_info_entry *entry;
1560 1560
@@ -1922,7 +1922,7 @@ static void snd_rme32_card_free(struct snd_card *card)
1922 snd_rme32_free(card->private_data); 1922 snd_rme32_free(card->private_data);
1923} 1923}
1924 1924
1925static int __devinit 1925static int
1926snd_rme32_probe(struct pci_dev *pci, const struct pci_device_id *pci_id) 1926snd_rme32_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
1927{ 1927{
1928 static int dev; 1928 static int dev;
@@ -1978,7 +1978,7 @@ snd_rme32_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
1978 return 0; 1978 return 0;
1979} 1979}
1980 1980
1981static void __devexit snd_rme32_remove(struct pci_dev *pci) 1981static void snd_rme32_remove(struct pci_dev *pci)
1982{ 1982{
1983 snd_card_free(pci_get_drvdata(pci)); 1983 snd_card_free(pci_get_drvdata(pci));
1984 pci_set_drvdata(pci, NULL); 1984 pci_set_drvdata(pci, NULL);
@@ -1988,7 +1988,7 @@ static struct pci_driver rme32_driver = {
1988 .name = KBUILD_MODNAME, 1988 .name = KBUILD_MODNAME,
1989 .id_table = snd_rme32_ids, 1989 .id_table = snd_rme32_ids,
1990 .probe = snd_rme32_probe, 1990 .probe = snd_rme32_probe,
1991 .remove = __devexit_p(snd_rme32_remove), 1991 .remove = snd_rme32_remove,
1992}; 1992};
1993 1993
1994module_pci_driver(rme32_driver); 1994module_pci_driver(rme32_driver);
diff --git a/sound/pci/rme96.c b/sound/pci/rme96.c
index 9b98dc406988..5fb88ac82aa9 100644
--- a/sound/pci/rme96.c
+++ b/sound/pci/rme96.c
@@ -270,8 +270,7 @@ snd_rme96_playback_pointer(struct snd_pcm_substream *substream);
270static snd_pcm_uframes_t 270static snd_pcm_uframes_t
271snd_rme96_capture_pointer(struct snd_pcm_substream *substream); 271snd_rme96_capture_pointer(struct snd_pcm_substream *substream);
272 272
273static void __devinit 273static void snd_rme96_proc_init(struct rme96 *rme96);
274snd_rme96_proc_init(struct rme96 *rme96);
275 274
276static int 275static int
277snd_rme96_create_switches(struct snd_card *card, 276snd_rme96_create_switches(struct snd_card *card,
@@ -1538,7 +1537,7 @@ snd_rme96_free_adat_pcm(struct snd_pcm *pcm)
1538 rme96->adat_pcm = NULL; 1537 rme96->adat_pcm = NULL;
1539} 1538}
1540 1539
1541static int __devinit 1540static int
1542snd_rme96_create(struct rme96 *rme96) 1541snd_rme96_create(struct rme96 *rme96)
1543{ 1542{
1544 struct pci_dev *pci = rme96->pci; 1543 struct pci_dev *pci = rme96->pci;
@@ -1786,8 +1785,7 @@ snd_rme96_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer
1786 } 1785 }
1787} 1786}
1788 1787
1789static void __devinit 1788static void snd_rme96_proc_init(struct rme96 *rme96)
1790snd_rme96_proc_init(struct rme96 *rme96)
1791{ 1789{
1792 struct snd_info_entry *entry; 1790 struct snd_info_entry *entry;
1793 1791
@@ -2326,7 +2324,7 @@ static void snd_rme96_card_free(struct snd_card *card)
2326 snd_rme96_free(card->private_data); 2324 snd_rme96_free(card->private_data);
2327} 2325}
2328 2326
2329static int __devinit 2327static int
2330snd_rme96_probe(struct pci_dev *pci, 2328snd_rme96_probe(struct pci_dev *pci,
2331 const struct pci_device_id *pci_id) 2329 const struct pci_device_id *pci_id)
2332{ 2330{
@@ -2389,7 +2387,7 @@ snd_rme96_probe(struct pci_dev *pci,
2389 return 0; 2387 return 0;
2390} 2388}
2391 2389
2392static void __devexit snd_rme96_remove(struct pci_dev *pci) 2390static void snd_rme96_remove(struct pci_dev *pci)
2393{ 2391{
2394 snd_card_free(pci_get_drvdata(pci)); 2392 snd_card_free(pci_get_drvdata(pci));
2395 pci_set_drvdata(pci, NULL); 2393 pci_set_drvdata(pci, NULL);
@@ -2399,7 +2397,7 @@ static struct pci_driver rme96_driver = {
2399 .name = KBUILD_MODNAME, 2397 .name = KBUILD_MODNAME,
2400 .id_table = snd_rme96_ids, 2398 .id_table = snd_rme96_ids,
2401 .probe = snd_rme96_probe, 2399 .probe = snd_rme96_probe,
2402 .remove = __devexit_p(snd_rme96_remove), 2400 .remove = snd_rme96_remove,
2403}; 2401};
2404 2402
2405module_pci_driver(rme96_driver); 2403module_pci_driver(rme96_driver);
diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c
index 0d6930c4f4b7..4fae81f21efb 100644
--- a/sound/pci/rme9652/hdsp.c
+++ b/sound/pci/rme9652/hdsp.c
@@ -28,6 +28,7 @@
28#include <linux/firmware.h> 28#include <linux/firmware.h>
29#include <linux/module.h> 29#include <linux/module.h>
30#include <linux/math64.h> 30#include <linux/math64.h>
31#include <linux/vmalloc.h>
31 32
32#include <sound/core.h> 33#include <sound/core.h>
33#include <sound/control.h> 34#include <sound/control.h>
@@ -59,13 +60,11 @@ MODULE_LICENSE("GPL");
59MODULE_SUPPORTED_DEVICE("{{RME Hammerfall-DSP}," 60MODULE_SUPPORTED_DEVICE("{{RME Hammerfall-DSP},"
60 "{RME HDSP-9652}," 61 "{RME HDSP-9652},"
61 "{RME HDSP-9632}}"); 62 "{RME HDSP-9632}}");
62#ifdef HDSP_FW_LOADER
63MODULE_FIRMWARE("rpm_firmware.bin"); 63MODULE_FIRMWARE("rpm_firmware.bin");
64MODULE_FIRMWARE("multiface_firmware.bin"); 64MODULE_FIRMWARE("multiface_firmware.bin");
65MODULE_FIRMWARE("multiface_firmware_rev11.bin"); 65MODULE_FIRMWARE("multiface_firmware_rev11.bin");
66MODULE_FIRMWARE("digiface_firmware.bin"); 66MODULE_FIRMWARE("digiface_firmware.bin");
67MODULE_FIRMWARE("digiface_firmware_rev11.bin"); 67MODULE_FIRMWARE("digiface_firmware_rev11.bin");
68#endif
69 68
70#define HDSP_MAX_CHANNELS 26 69#define HDSP_MAX_CHANNELS 26
71#define HDSP_MAX_DS_CHANNELS 14 70#define HDSP_MAX_DS_CHANNELS 14
@@ -423,12 +422,7 @@ MODULE_FIRMWARE("digiface_firmware_rev11.bin");
423#define HDSP_DMA_AREA_BYTES ((HDSP_MAX_CHANNELS+1) * HDSP_CHANNEL_BUFFER_BYTES) 422#define HDSP_DMA_AREA_BYTES ((HDSP_MAX_CHANNELS+1) * HDSP_CHANNEL_BUFFER_BYTES)
424#define HDSP_DMA_AREA_KILOBYTES (HDSP_DMA_AREA_BYTES/1024) 423#define HDSP_DMA_AREA_KILOBYTES (HDSP_DMA_AREA_BYTES/1024)
425 424
426/* use hotplug firmware loader? */ 425#define HDSP_FIRMWARE_SIZE (24413 * 4)
427#if defined(CONFIG_FW_LOADER) || defined(CONFIG_FW_LOADER_MODULE)
428#if !defined(HDSP_USE_HWDEP_LOADER)
429#define HDSP_FW_LOADER
430#endif
431#endif
432 426
433struct hdsp_9632_meters { 427struct hdsp_9632_meters {
434 u32 input_peak[16]; 428 u32 input_peak[16];
@@ -475,7 +469,8 @@ struct hdsp {
475 enum HDSP_IO_Type io_type; /* ditto, but for code use */ 469 enum HDSP_IO_Type io_type; /* ditto, but for code use */
476 unsigned short firmware_rev; 470 unsigned short firmware_rev;
477 unsigned short state; /* stores state bits */ 471 unsigned short state; /* stores state bits */
478 u32 firmware_cache[24413]; /* this helps recover from accidental iobox power failure */ 472 const struct firmware *firmware;
473 u32 *fw_uploaded;
479 size_t period_bytes; /* guess what this is */ 474 size_t period_bytes; /* guess what this is */
480 unsigned char max_channels; 475 unsigned char max_channels;
481 unsigned char qs_in_channels; /* quad speed mode for H9632 */ 476 unsigned char qs_in_channels; /* quad speed mode for H9632 */
@@ -712,6 +707,17 @@ static int snd_hdsp_load_firmware_from_cache(struct hdsp *hdsp) {
712 707
713 int i; 708 int i;
714 unsigned long flags; 709 unsigned long flags;
710 const u32 *cache;
711
712 if (hdsp->fw_uploaded)
713 cache = hdsp->fw_uploaded;
714 else {
715 if (!hdsp->firmware)
716 return -ENODEV;
717 cache = (u32 *)hdsp->firmware->data;
718 if (!cache)
719 return -ENODEV;
720 }
715 721
716 if ((hdsp_read (hdsp, HDSP_statusRegister) & HDSP_DllError) != 0) { 722 if ((hdsp_read (hdsp, HDSP_statusRegister) & HDSP_DllError) != 0) {
717 723
@@ -727,8 +733,8 @@ static int snd_hdsp_load_firmware_from_cache(struct hdsp *hdsp) {
727 733
728 hdsp_write (hdsp, HDSP_control2Reg, HDSP_S_LOAD); 734 hdsp_write (hdsp, HDSP_control2Reg, HDSP_S_LOAD);
729 735
730 for (i = 0; i < 24413; ++i) { 736 for (i = 0; i < HDSP_FIRMWARE_SIZE / 4; ++i) {
731 hdsp_write(hdsp, HDSP_fifoData, hdsp->firmware_cache[i]); 737 hdsp_write(hdsp, HDSP_fifoData, cache[i]);
732 if (hdsp_fifo_wait (hdsp, 127, HDSP_LONG_WAIT)) { 738 if (hdsp_fifo_wait (hdsp, 127, HDSP_LONG_WAIT)) {
733 snd_printk ("Hammerfall-DSP: timeout during firmware loading\n"); 739 snd_printk ("Hammerfall-DSP: timeout during firmware loading\n");
734 return -EIO; 740 return -EIO;
@@ -798,9 +804,7 @@ static int hdsp_get_iobox_version (struct hdsp *hdsp)
798} 804}
799 805
800 806
801#ifdef HDSP_FW_LOADER
802static int hdsp_request_fw_loader(struct hdsp *hdsp); 807static int hdsp_request_fw_loader(struct hdsp *hdsp);
803#endif
804 808
805static int hdsp_check_for_firmware (struct hdsp *hdsp, int load_on_demand) 809static int hdsp_check_for_firmware (struct hdsp *hdsp, int load_on_demand)
806{ 810{
@@ -813,10 +817,8 @@ static int hdsp_check_for_firmware (struct hdsp *hdsp, int load_on_demand)
813 snd_printk(KERN_ERR "Hammerfall-DSP: firmware not present.\n"); 817 snd_printk(KERN_ERR "Hammerfall-DSP: firmware not present.\n");
814 /* try to load firmware */ 818 /* try to load firmware */
815 if (! (hdsp->state & HDSP_FirmwareCached)) { 819 if (! (hdsp->state & HDSP_FirmwareCached)) {
816#ifdef HDSP_FW_LOADER
817 if (! hdsp_request_fw_loader(hdsp)) 820 if (! hdsp_request_fw_loader(hdsp))
818 return 0; 821 return 0;
819#endif
820 snd_printk(KERN_ERR 822 snd_printk(KERN_ERR
821 "Hammerfall-DSP: No firmware loaded nor " 823 "Hammerfall-DSP: No firmware loaded nor "
822 "cached, please upload firmware.\n"); 824 "cached, please upload firmware.\n");
@@ -3673,9 +3675,7 @@ snd_hdsp_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buffer)
3673 } 3675 }
3674 } else { 3676 } else {
3675 int err = -EINVAL; 3677 int err = -EINVAL;
3676#ifdef HDSP_FW_LOADER
3677 err = hdsp_request_fw_loader(hdsp); 3678 err = hdsp_request_fw_loader(hdsp);
3678#endif
3679 if (err < 0) { 3679 if (err < 0) {
3680 snd_iprintf(buffer, 3680 snd_iprintf(buffer,
3681 "No firmware loaded nor cached, " 3681 "No firmware loaded nor cached, "
@@ -4020,7 +4020,7 @@ static void snd_hdsp_free_buffers(struct hdsp *hdsp)
4020 snd_hammerfall_free_buffer(&hdsp->playback_dma_buf, hdsp->pci); 4020 snd_hammerfall_free_buffer(&hdsp->playback_dma_buf, hdsp->pci);
4021} 4021}
4022 4022
4023static int __devinit snd_hdsp_initialize_memory(struct hdsp *hdsp) 4023static int snd_hdsp_initialize_memory(struct hdsp *hdsp)
4024{ 4024{
4025 unsigned long pb_bus, cb_bus; 4025 unsigned long pb_bus, cb_bus;
4026 4026
@@ -5100,8 +5100,18 @@ static int snd_hdsp_hwdep_ioctl(struct snd_hwdep *hw, struct file *file, unsigne
5100 if (hdsp_check_for_iobox (hdsp)) 5100 if (hdsp_check_for_iobox (hdsp))
5101 return -EIO; 5101 return -EIO;
5102 5102
5103 if (copy_from_user(hdsp->firmware_cache, firmware_data, sizeof(hdsp->firmware_cache)) != 0) 5103 if (!hdsp->fw_uploaded) {
5104 hdsp->fw_uploaded = vmalloc(HDSP_FIRMWARE_SIZE);
5105 if (!hdsp->fw_uploaded)
5106 return -ENOMEM;
5107 }
5108
5109 if (copy_from_user(hdsp->fw_uploaded, firmware_data,
5110 HDSP_FIRMWARE_SIZE)) {
5111 vfree(hdsp->fw_uploaded);
5112 hdsp->fw_uploaded = NULL;
5104 return -EFAULT; 5113 return -EFAULT;
5114 }
5105 5115
5106 hdsp->state |= HDSP_FirmwareCached; 5116 hdsp->state |= HDSP_FirmwareCached;
5107 5117
@@ -5330,7 +5340,6 @@ static int snd_hdsp_create_alsa_devices(struct snd_card *card, struct hdsp *hdsp
5330 return 0; 5340 return 0;
5331} 5341}
5332 5342
5333#ifdef HDSP_FW_LOADER
5334/* load firmware via hotplug fw loader */ 5343/* load firmware via hotplug fw loader */
5335static int hdsp_request_fw_loader(struct hdsp *hdsp) 5344static int hdsp_request_fw_loader(struct hdsp *hdsp)
5336{ 5345{
@@ -5373,16 +5382,13 @@ static int hdsp_request_fw_loader(struct hdsp *hdsp)
5373 snd_printk(KERN_ERR "Hammerfall-DSP: cannot load firmware %s\n", fwfile); 5382 snd_printk(KERN_ERR "Hammerfall-DSP: cannot load firmware %s\n", fwfile);
5374 return -ENOENT; 5383 return -ENOENT;
5375 } 5384 }
5376 if (fw->size < sizeof(hdsp->firmware_cache)) { 5385 if (fw->size < HDSP_FIRMWARE_SIZE) {
5377 snd_printk(KERN_ERR "Hammerfall-DSP: too short firmware size %d (expected %d)\n", 5386 snd_printk(KERN_ERR "Hammerfall-DSP: too short firmware size %d (expected %d)\n",
5378 (int)fw->size, (int)sizeof(hdsp->firmware_cache)); 5387 (int)fw->size, HDSP_FIRMWARE_SIZE);
5379 release_firmware(fw);
5380 return -EINVAL; 5388 return -EINVAL;
5381 } 5389 }
5382 5390
5383 memcpy(hdsp->firmware_cache, fw->data, sizeof(hdsp->firmware_cache)); 5391 hdsp->firmware = fw;
5384
5385 release_firmware(fw);
5386 5392
5387 hdsp->state |= HDSP_FirmwareCached; 5393 hdsp->state |= HDSP_FirmwareCached;
5388 5394
@@ -5406,10 +5412,9 @@ static int hdsp_request_fw_loader(struct hdsp *hdsp)
5406 } 5412 }
5407 return 0; 5413 return 0;
5408} 5414}
5409#endif
5410 5415
5411static int __devinit snd_hdsp_create(struct snd_card *card, 5416static int snd_hdsp_create(struct snd_card *card,
5412 struct hdsp *hdsp) 5417 struct hdsp *hdsp)
5413{ 5418{
5414 struct pci_dev *pci = hdsp->pci; 5419 struct pci_dev *pci = hdsp->pci;
5415 int err; 5420 int err;
@@ -5504,7 +5509,6 @@ static int __devinit snd_hdsp_create(struct snd_card *card,
5504 return err; 5509 return err;
5505 5510
5506 if ((hdsp_read (hdsp, HDSP_statusRegister) & HDSP_DllError) != 0) { 5511 if ((hdsp_read (hdsp, HDSP_statusRegister) & HDSP_DllError) != 0) {
5507#ifdef HDSP_FW_LOADER
5508 if ((err = hdsp_request_fw_loader(hdsp)) < 0) 5512 if ((err = hdsp_request_fw_loader(hdsp)) < 0)
5509 /* we don't fail as this can happen 5513 /* we don't fail as this can happen
5510 if userspace is not ready for 5514 if userspace is not ready for
@@ -5514,7 +5518,6 @@ static int __devinit snd_hdsp_create(struct snd_card *card,
5514 else 5518 else
5515 /* init is complete, we return */ 5519 /* init is complete, we return */
5516 return 0; 5520 return 0;
5517#endif
5518 /* we defer initialization */ 5521 /* we defer initialization */
5519 snd_printk(KERN_INFO "Hammerfall-DSP: card initialization pending : waiting for firmware\n"); 5522 snd_printk(KERN_INFO "Hammerfall-DSP: card initialization pending : waiting for firmware\n");
5520 if ((err = snd_hdsp_create_hwdep(card, hdsp)) < 0) 5523 if ((err = snd_hdsp_create_hwdep(card, hdsp)) < 0)
@@ -5568,6 +5571,10 @@ static int snd_hdsp_free(struct hdsp *hdsp)
5568 5571
5569 snd_hdsp_free_buffers(hdsp); 5572 snd_hdsp_free_buffers(hdsp);
5570 5573
5574 if (hdsp->firmware)
5575 release_firmware(hdsp->firmware);
5576 vfree(hdsp->fw_uploaded);
5577
5571 if (hdsp->iobase) 5578 if (hdsp->iobase)
5572 iounmap(hdsp->iobase); 5579 iounmap(hdsp->iobase);
5573 5580
@@ -5586,8 +5593,8 @@ static void snd_hdsp_card_free(struct snd_card *card)
5586 snd_hdsp_free(hdsp); 5593 snd_hdsp_free(hdsp);
5587} 5594}
5588 5595
5589static int __devinit snd_hdsp_probe(struct pci_dev *pci, 5596static int snd_hdsp_probe(struct pci_dev *pci,
5590 const struct pci_device_id *pci_id) 5597 const struct pci_device_id *pci_id)
5591{ 5598{
5592 static int dev; 5599 static int dev;
5593 struct hdsp *hdsp; 5600 struct hdsp *hdsp;
@@ -5630,7 +5637,7 @@ static int __devinit snd_hdsp_probe(struct pci_dev *pci,
5630 return 0; 5637 return 0;
5631} 5638}
5632 5639
5633static void __devexit snd_hdsp_remove(struct pci_dev *pci) 5640static void snd_hdsp_remove(struct pci_dev *pci)
5634{ 5641{
5635 snd_card_free(pci_get_drvdata(pci)); 5642 snd_card_free(pci_get_drvdata(pci));
5636 pci_set_drvdata(pci, NULL); 5643 pci_set_drvdata(pci, NULL);
@@ -5640,7 +5647,7 @@ static struct pci_driver hdsp_driver = {
5640 .name = KBUILD_MODNAME, 5647 .name = KBUILD_MODNAME,
5641 .id_table = snd_hdsp_ids, 5648 .id_table = snd_hdsp_ids,
5642 .probe = snd_hdsp_probe, 5649 .probe = snd_hdsp_probe,
5643 .remove = __devexit_p(snd_hdsp_remove), 5650 .remove = snd_hdsp_remove,
5644}; 5651};
5645 5652
5646module_pci_driver(hdsp_driver); 5653module_pci_driver(hdsp_driver);
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c
index 748e36c66603..6e02e064d7b4 100644
--- a/sound/pci/rme9652/hdspm.c
+++ b/sound/pci/rme9652/hdspm.c
@@ -962,10 +962,10 @@ static DEFINE_PCI_DEVICE_TABLE(snd_hdspm_ids) = {
962MODULE_DEVICE_TABLE(pci, snd_hdspm_ids); 962MODULE_DEVICE_TABLE(pci, snd_hdspm_ids);
963 963
964/* prototypes */ 964/* prototypes */
965static int __devinit snd_hdspm_create_alsa_devices(struct snd_card *card, 965static int snd_hdspm_create_alsa_devices(struct snd_card *card,
966 struct hdspm * hdspm); 966 struct hdspm *hdspm);
967static int __devinit snd_hdspm_create_pcm(struct snd_card *card, 967static int snd_hdspm_create_pcm(struct snd_card *card,
968 struct hdspm * hdspm); 968 struct hdspm *hdspm);
969 969
970static inline void snd_hdspm_initialize_midi_flush(struct hdspm *hdspm); 970static inline void snd_hdspm_initialize_midi_flush(struct hdspm *hdspm);
971static int hdspm_update_simple_mixer_controls(struct hdspm *hdspm); 971static int hdspm_update_simple_mixer_controls(struct hdspm *hdspm);
@@ -1845,8 +1845,8 @@ static struct snd_rawmidi_ops snd_hdspm_midi_input =
1845 .trigger = snd_hdspm_midi_input_trigger, 1845 .trigger = snd_hdspm_midi_input_trigger,
1846}; 1846};
1847 1847
1848static int __devinit snd_hdspm_create_midi (struct snd_card *card, 1848static int snd_hdspm_create_midi(struct snd_card *card,
1849 struct hdspm *hdspm, int id) 1849 struct hdspm *hdspm, int id)
1850{ 1850{
1851 int err; 1851 int err;
1852 char buf[32]; 1852 char buf[32];
@@ -2887,330 +2887,50 @@ static int snd_hdspm_get_autosync_ref(struct snd_kcontrol *kcontrol,
2887 return 0; 2887 return 0;
2888} 2888}
2889 2889
2890 2890#define HDSPM_TOGGLE_SETTING(xname, xindex) \
2891#define HDSPM_LINE_OUT(xname, xindex) \
2892{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2893 .name = xname, \
2894 .index = xindex, \
2895 .info = snd_hdspm_info_line_out, \
2896 .get = snd_hdspm_get_line_out, \
2897 .put = snd_hdspm_put_line_out \
2898}
2899
2900static int hdspm_line_out(struct hdspm * hdspm)
2901{
2902 return (hdspm->control_register & HDSPM_LineOut) ? 1 : 0;
2903}
2904
2905
2906static int hdspm_set_line_output(struct hdspm * hdspm, int out)
2907{
2908 if (out)
2909 hdspm->control_register |= HDSPM_LineOut;
2910 else
2911 hdspm->control_register &= ~HDSPM_LineOut;
2912 hdspm_write(hdspm, HDSPM_controlRegister, hdspm->control_register);
2913
2914 return 0;
2915}
2916
2917#define snd_hdspm_info_line_out snd_ctl_boolean_mono_info
2918
2919static int snd_hdspm_get_line_out(struct snd_kcontrol *kcontrol,
2920 struct snd_ctl_elem_value *ucontrol)
2921{
2922 struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);
2923
2924 spin_lock_irq(&hdspm->lock);
2925 ucontrol->value.integer.value[0] = hdspm_line_out(hdspm);
2926 spin_unlock_irq(&hdspm->lock);
2927 return 0;
2928}
2929
2930static int snd_hdspm_put_line_out(struct snd_kcontrol *kcontrol,
2931 struct snd_ctl_elem_value *ucontrol)
2932{
2933 struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);
2934 int change;
2935 unsigned int val;
2936
2937 if (!snd_hdspm_use_is_exclusive(hdspm))
2938 return -EBUSY;
2939 val = ucontrol->value.integer.value[0] & 1;
2940 spin_lock_irq(&hdspm->lock);
2941 change = (int) val != hdspm_line_out(hdspm);
2942 hdspm_set_line_output(hdspm, val);
2943 spin_unlock_irq(&hdspm->lock);
2944 return change;
2945}
2946
2947
2948#define HDSPM_TX_64(xname, xindex) \
2949{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
2950 .name = xname, \
2951 .index = xindex, \
2952 .info = snd_hdspm_info_tx_64, \
2953 .get = snd_hdspm_get_tx_64, \
2954 .put = snd_hdspm_put_tx_64 \
2955}
2956
2957static int hdspm_tx_64(struct hdspm * hdspm)
2958{
2959 return (hdspm->control_register & HDSPM_TX_64ch) ? 1 : 0;
2960}
2961
2962static int hdspm_set_tx_64(struct hdspm * hdspm, int out)
2963{
2964 if (out)
2965 hdspm->control_register |= HDSPM_TX_64ch;
2966 else
2967 hdspm->control_register &= ~HDSPM_TX_64ch;
2968 hdspm_write(hdspm, HDSPM_controlRegister, hdspm->control_register);
2969
2970 return 0;
2971}
2972
2973#define snd_hdspm_info_tx_64 snd_ctl_boolean_mono_info
2974
2975static int snd_hdspm_get_tx_64(struct snd_kcontrol *kcontrol,
2976 struct snd_ctl_elem_value *ucontrol)
2977{
2978 struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);
2979
2980 spin_lock_irq(&hdspm->lock);
2981 ucontrol->value.integer.value[0] = hdspm_tx_64(hdspm);
2982 spin_unlock_irq(&hdspm->lock);
2983 return 0;
2984}
2985
2986static int snd_hdspm_put_tx_64(struct snd_kcontrol *kcontrol,
2987 struct snd_ctl_elem_value *ucontrol)
2988{
2989 struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);
2990 int change;
2991 unsigned int val;
2992
2993 if (!snd_hdspm_use_is_exclusive(hdspm))
2994 return -EBUSY;
2995 val = ucontrol->value.integer.value[0] & 1;
2996 spin_lock_irq(&hdspm->lock);
2997 change = (int) val != hdspm_tx_64(hdspm);
2998 hdspm_set_tx_64(hdspm, val);
2999 spin_unlock_irq(&hdspm->lock);
3000 return change;
3001}
3002
3003
3004#define HDSPM_C_TMS(xname, xindex) \
3005{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3006 .name = xname, \
3007 .index = xindex, \
3008 .info = snd_hdspm_info_c_tms, \
3009 .get = snd_hdspm_get_c_tms, \
3010 .put = snd_hdspm_put_c_tms \
3011}
3012
3013static int hdspm_c_tms(struct hdspm * hdspm)
3014{
3015 return (hdspm->control_register & HDSPM_clr_tms) ? 1 : 0;
3016}
3017
3018static int hdspm_set_c_tms(struct hdspm * hdspm, int out)
3019{
3020 if (out)
3021 hdspm->control_register |= HDSPM_clr_tms;
3022 else
3023 hdspm->control_register &= ~HDSPM_clr_tms;
3024 hdspm_write(hdspm, HDSPM_controlRegister, hdspm->control_register);
3025
3026 return 0;
3027}
3028
3029#define snd_hdspm_info_c_tms snd_ctl_boolean_mono_info
3030
3031static int snd_hdspm_get_c_tms(struct snd_kcontrol *kcontrol,
3032 struct snd_ctl_elem_value *ucontrol)
3033{
3034 struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);
3035
3036 spin_lock_irq(&hdspm->lock);
3037 ucontrol->value.integer.value[0] = hdspm_c_tms(hdspm);
3038 spin_unlock_irq(&hdspm->lock);
3039 return 0;
3040}
3041
3042static int snd_hdspm_put_c_tms(struct snd_kcontrol *kcontrol,
3043 struct snd_ctl_elem_value *ucontrol)
3044{
3045 struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);
3046 int change;
3047 unsigned int val;
3048
3049 if (!snd_hdspm_use_is_exclusive(hdspm))
3050 return -EBUSY;
3051 val = ucontrol->value.integer.value[0] & 1;
3052 spin_lock_irq(&hdspm->lock);
3053 change = (int) val != hdspm_c_tms(hdspm);
3054 hdspm_set_c_tms(hdspm, val);
3055 spin_unlock_irq(&hdspm->lock);
3056 return change;
3057}
3058
3059
3060#define HDSPM_SAFE_MODE(xname, xindex) \
3061{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \ 2891{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3062 .name = xname, \ 2892 .name = xname, \
3063 .index = xindex, \ 2893 .private_value = xindex, \
3064 .info = snd_hdspm_info_safe_mode, \ 2894 .info = snd_hdspm_info_toggle_setting, \
3065 .get = snd_hdspm_get_safe_mode, \ 2895 .get = snd_hdspm_get_toggle_setting, \
3066 .put = snd_hdspm_put_safe_mode \ 2896 .put = snd_hdspm_put_toggle_setting \
3067} 2897}
3068 2898
3069static int hdspm_safe_mode(struct hdspm * hdspm) 2899static int hdspm_toggle_setting(struct hdspm *hdspm, u32 regmask)
3070{ 2900{
3071 return (hdspm->control_register & HDSPM_AutoInp) ? 1 : 0; 2901 return (hdspm->control_register & regmask) ? 1 : 0;
3072} 2902}
3073 2903
3074static int hdspm_set_safe_mode(struct hdspm * hdspm, int out) 2904static int hdspm_set_toggle_setting(struct hdspm *hdspm, u32 regmask, int out)
3075{ 2905{
3076 if (out) 2906 if (out)
3077 hdspm->control_register |= HDSPM_AutoInp; 2907 hdspm->control_register |= regmask;
3078 else
3079 hdspm->control_register &= ~HDSPM_AutoInp;
3080 hdspm_write(hdspm, HDSPM_controlRegister, hdspm->control_register);
3081
3082 return 0;
3083}
3084
3085#define snd_hdspm_info_safe_mode snd_ctl_boolean_mono_info
3086
3087static int snd_hdspm_get_safe_mode(struct snd_kcontrol *kcontrol,
3088 struct snd_ctl_elem_value *ucontrol)
3089{
3090 struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);
3091
3092 spin_lock_irq(&hdspm->lock);
3093 ucontrol->value.integer.value[0] = hdspm_safe_mode(hdspm);
3094 spin_unlock_irq(&hdspm->lock);
3095 return 0;
3096}
3097
3098static int snd_hdspm_put_safe_mode(struct snd_kcontrol *kcontrol,
3099 struct snd_ctl_elem_value *ucontrol)
3100{
3101 struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);
3102 int change;
3103 unsigned int val;
3104
3105 if (!snd_hdspm_use_is_exclusive(hdspm))
3106 return -EBUSY;
3107 val = ucontrol->value.integer.value[0] & 1;
3108 spin_lock_irq(&hdspm->lock);
3109 change = (int) val != hdspm_safe_mode(hdspm);
3110 hdspm_set_safe_mode(hdspm, val);
3111 spin_unlock_irq(&hdspm->lock);
3112 return change;
3113}
3114
3115
3116#define HDSPM_EMPHASIS(xname, xindex) \
3117{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3118 .name = xname, \
3119 .index = xindex, \
3120 .info = snd_hdspm_info_emphasis, \
3121 .get = snd_hdspm_get_emphasis, \
3122 .put = snd_hdspm_put_emphasis \
3123}
3124
3125static int hdspm_emphasis(struct hdspm * hdspm)
3126{
3127 return (hdspm->control_register & HDSPM_Emphasis) ? 1 : 0;
3128}
3129
3130static int hdspm_set_emphasis(struct hdspm * hdspm, int emp)
3131{
3132 if (emp)
3133 hdspm->control_register |= HDSPM_Emphasis;
3134 else 2908 else
3135 hdspm->control_register &= ~HDSPM_Emphasis; 2909 hdspm->control_register &= ~regmask;
3136 hdspm_write(hdspm, HDSPM_controlRegister, hdspm->control_register); 2910 hdspm_write(hdspm, HDSPM_controlRegister, hdspm->control_register);
3137 2911
3138 return 0; 2912 return 0;
3139} 2913}
3140 2914
3141#define snd_hdspm_info_emphasis snd_ctl_boolean_mono_info 2915#define snd_hdspm_info_toggle_setting snd_ctl_boolean_mono_info
3142
3143static int snd_hdspm_get_emphasis(struct snd_kcontrol *kcontrol,
3144 struct snd_ctl_elem_value *ucontrol)
3145{
3146 struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);
3147 2916
3148 spin_lock_irq(&hdspm->lock); 2917static int snd_hdspm_get_toggle_setting(struct snd_kcontrol *kcontrol,
3149 ucontrol->value.enumerated.item[0] = hdspm_emphasis(hdspm);
3150 spin_unlock_irq(&hdspm->lock);
3151 return 0;
3152}
3153
3154static int snd_hdspm_put_emphasis(struct snd_kcontrol *kcontrol,
3155 struct snd_ctl_elem_value *ucontrol)
3156{
3157 struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);
3158 int change;
3159 unsigned int val;
3160
3161 if (!snd_hdspm_use_is_exclusive(hdspm))
3162 return -EBUSY;
3163 val = ucontrol->value.integer.value[0] & 1;
3164 spin_lock_irq(&hdspm->lock);
3165 change = (int) val != hdspm_emphasis(hdspm);
3166 hdspm_set_emphasis(hdspm, val);
3167 spin_unlock_irq(&hdspm->lock);
3168 return change;
3169}
3170
3171
3172#define HDSPM_DOLBY(xname, xindex) \
3173{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3174 .name = xname, \
3175 .index = xindex, \
3176 .info = snd_hdspm_info_dolby, \
3177 .get = snd_hdspm_get_dolby, \
3178 .put = snd_hdspm_put_dolby \
3179}
3180
3181static int hdspm_dolby(struct hdspm * hdspm)
3182{
3183 return (hdspm->control_register & HDSPM_Dolby) ? 1 : 0;
3184}
3185
3186static int hdspm_set_dolby(struct hdspm * hdspm, int dol)
3187{
3188 if (dol)
3189 hdspm->control_register |= HDSPM_Dolby;
3190 else
3191 hdspm->control_register &= ~HDSPM_Dolby;
3192 hdspm_write(hdspm, HDSPM_controlRegister, hdspm->control_register);
3193
3194 return 0;
3195}
3196
3197#define snd_hdspm_info_dolby snd_ctl_boolean_mono_info
3198
3199static int snd_hdspm_get_dolby(struct snd_kcontrol *kcontrol,
3200 struct snd_ctl_elem_value *ucontrol) 2918 struct snd_ctl_elem_value *ucontrol)
3201{ 2919{
3202 struct hdspm *hdspm = snd_kcontrol_chip(kcontrol); 2920 struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);
2921 u32 regmask = kcontrol->private_value;
3203 2922
3204 spin_lock_irq(&hdspm->lock); 2923 spin_lock_irq(&hdspm->lock);
3205 ucontrol->value.enumerated.item[0] = hdspm_dolby(hdspm); 2924 ucontrol->value.integer.value[0] = hdspm_toggle_setting(hdspm, regmask);
3206 spin_unlock_irq(&hdspm->lock); 2925 spin_unlock_irq(&hdspm->lock);
3207 return 0; 2926 return 0;
3208} 2927}
3209 2928
3210static int snd_hdspm_put_dolby(struct snd_kcontrol *kcontrol, 2929static int snd_hdspm_put_toggle_setting(struct snd_kcontrol *kcontrol,
3211 struct snd_ctl_elem_value *ucontrol) 2930 struct snd_ctl_elem_value *ucontrol)
3212{ 2931{
3213 struct hdspm *hdspm = snd_kcontrol_chip(kcontrol); 2932 struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);
2933 u32 regmask = kcontrol->private_value;
3214 int change; 2934 int change;
3215 unsigned int val; 2935 unsigned int val;
3216 2936
@@ -3218,64 +2938,8 @@ static int snd_hdspm_put_dolby(struct snd_kcontrol *kcontrol,
3218 return -EBUSY; 2938 return -EBUSY;
3219 val = ucontrol->value.integer.value[0] & 1; 2939 val = ucontrol->value.integer.value[0] & 1;
3220 spin_lock_irq(&hdspm->lock); 2940 spin_lock_irq(&hdspm->lock);
3221 change = (int) val != hdspm_dolby(hdspm); 2941 change = (int) val != hdspm_toggle_setting(hdspm, regmask);
3222 hdspm_set_dolby(hdspm, val); 2942 hdspm_set_toggle_setting(hdspm, regmask, val);
3223 spin_unlock_irq(&hdspm->lock);
3224 return change;
3225}
3226
3227
3228#define HDSPM_PROFESSIONAL(xname, xindex) \
3229{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
3230 .name = xname, \
3231 .index = xindex, \
3232 .info = snd_hdspm_info_professional, \
3233 .get = snd_hdspm_get_professional, \
3234 .put = snd_hdspm_put_professional \
3235}
3236
3237static int hdspm_professional(struct hdspm * hdspm)
3238{
3239 return (hdspm->control_register & HDSPM_Professional) ? 1 : 0;
3240}
3241
3242static int hdspm_set_professional(struct hdspm * hdspm, int dol)
3243{
3244 if (dol)
3245 hdspm->control_register |= HDSPM_Professional;
3246 else
3247 hdspm->control_register &= ~HDSPM_Professional;
3248 hdspm_write(hdspm, HDSPM_controlRegister, hdspm->control_register);
3249
3250 return 0;
3251}
3252
3253#define snd_hdspm_info_professional snd_ctl_boolean_mono_info
3254
3255static int snd_hdspm_get_professional(struct snd_kcontrol *kcontrol,
3256 struct snd_ctl_elem_value *ucontrol)
3257{
3258 struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);
3259
3260 spin_lock_irq(&hdspm->lock);
3261 ucontrol->value.enumerated.item[0] = hdspm_professional(hdspm);
3262 spin_unlock_irq(&hdspm->lock);
3263 return 0;
3264}
3265
3266static int snd_hdspm_put_professional(struct snd_kcontrol *kcontrol,
3267 struct snd_ctl_elem_value *ucontrol)
3268{
3269 struct hdspm *hdspm = snd_kcontrol_chip(kcontrol);
3270 int change;
3271 unsigned int val;
3272
3273 if (!snd_hdspm_use_is_exclusive(hdspm))
3274 return -EBUSY;
3275 val = ucontrol->value.integer.value[0] & 1;
3276 spin_lock_irq(&hdspm->lock);
3277 change = (int) val != hdspm_professional(hdspm);
3278 hdspm_set_professional(hdspm, val);
3279 spin_unlock_irq(&hdspm->lock); 2943 spin_unlock_irq(&hdspm->lock);
3280 return change; 2944 return change;
3281} 2945}
@@ -4476,10 +4140,10 @@ static struct snd_kcontrol_new snd_hdspm_controls_madi[] = {
4476 HDSPM_SYNC_CHECK("MADI SyncCheck", 1), 4140 HDSPM_SYNC_CHECK("MADI SyncCheck", 1),
4477 HDSPM_SYNC_CHECK("TCO SyncCheck", 2), 4141 HDSPM_SYNC_CHECK("TCO SyncCheck", 2),
4478 HDSPM_SYNC_CHECK("SYNC IN SyncCheck", 3), 4142 HDSPM_SYNC_CHECK("SYNC IN SyncCheck", 3),
4479 HDSPM_LINE_OUT("Line Out", 0), 4143 HDSPM_TOGGLE_SETTING("Line Out", HDSPM_LineOut),
4480 HDSPM_TX_64("TX 64 channels mode", 0), 4144 HDSPM_TOGGLE_SETTING("TX 64 channels mode", HDSPM_TX_64ch),
4481 HDSPM_C_TMS("Clear Track Marker", 0), 4145 HDSPM_TOGGLE_SETTING("Clear Track Marker", HDSPM_clr_tms),
4482 HDSPM_SAFE_MODE("Safe Mode", 0), 4146 HDSPM_TOGGLE_SETTING("Safe Mode", HDSPM_AutoInp),
4483 HDSPM_INPUT_SELECT("Input Select", 0), 4147 HDSPM_INPUT_SELECT("Input Select", 0),
4484 HDSPM_MADI_SPEEDMODE("MADI Speed Mode", 0) 4148 HDSPM_MADI_SPEEDMODE("MADI Speed Mode", 0)
4485}; 4149};
@@ -4492,9 +4156,9 @@ static struct snd_kcontrol_new snd_hdspm_controls_madiface[] = {
4492 HDSPM_SYSTEM_SAMPLE_RATE("System Sample Rate", 0), 4156 HDSPM_SYSTEM_SAMPLE_RATE("System Sample Rate", 0),
4493 HDSPM_AUTOSYNC_SAMPLE_RATE("External Rate", 0), 4157 HDSPM_AUTOSYNC_SAMPLE_RATE("External Rate", 0),
4494 HDSPM_SYNC_CHECK("MADI SyncCheck", 0), 4158 HDSPM_SYNC_CHECK("MADI SyncCheck", 0),
4495 HDSPM_TX_64("TX 64 channels mode", 0), 4159 HDSPM_TOGGLE_SETTING("TX 64 channels mode", HDSPM_TX_64ch),
4496 HDSPM_C_TMS("Clear Track Marker", 0), 4160 HDSPM_TOGGLE_SETTING("Clear Track Marker", HDSPM_clr_tms),
4497 HDSPM_SAFE_MODE("Safe Mode", 0), 4161 HDSPM_TOGGLE_SETTING("Safe Mode", HDSPM_AutoInp),
4498 HDSPM_MADI_SPEEDMODE("MADI Speed Mode", 0) 4162 HDSPM_MADI_SPEEDMODE("MADI Speed Mode", 0)
4499}; 4163};
4500 4164
@@ -4587,11 +4251,11 @@ static struct snd_kcontrol_new snd_hdspm_controls_aes32[] = {
4587 HDSPM_AUTOSYNC_SAMPLE_RATE("AES8 Frequency", 8), 4251 HDSPM_AUTOSYNC_SAMPLE_RATE("AES8 Frequency", 8),
4588 HDSPM_AUTOSYNC_SAMPLE_RATE("TCO Frequency", 9), 4252 HDSPM_AUTOSYNC_SAMPLE_RATE("TCO Frequency", 9),
4589 HDSPM_AUTOSYNC_SAMPLE_RATE("SYNC IN Frequency", 10), 4253 HDSPM_AUTOSYNC_SAMPLE_RATE("SYNC IN Frequency", 10),
4590 HDSPM_LINE_OUT("Line Out", 0), 4254 HDSPM_TOGGLE_SETTING("Line Out", HDSPM_LineOut),
4591 HDSPM_EMPHASIS("Emphasis", 0), 4255 HDSPM_TOGGLE_SETTING("Emphasis", HDSPM_Emphasis),
4592 HDSPM_DOLBY("Non Audio", 0), 4256 HDSPM_TOGGLE_SETTING("Non Audio", HDSPM_Dolby),
4593 HDSPM_PROFESSIONAL("Professional", 0), 4257 HDSPM_TOGGLE_SETTING("Professional", HDSPM_Professional),
4594 HDSPM_C_TMS("Clear Track Marker", 0), 4258 HDSPM_TOGGLE_SETTING("Clear Track Marker", HDSPM_clr_tms),
4595 HDSPM_DS_WIRE("Double Speed Wire Mode", 0), 4259 HDSPM_DS_WIRE("Double Speed Wire Mode", 0),
4596 HDSPM_QS_WIRE("Quad Speed Wire Mode", 0), 4260 HDSPM_QS_WIRE("Quad Speed Wire Mode", 0),
4597}; 4261};
@@ -5233,7 +4897,7 @@ static void snd_hdspm_proc_ports_out(struct snd_info_entry *entry,
5233} 4897}
5234 4898
5235 4899
5236static void __devinit snd_hdspm_proc_init(struct hdspm *hdspm) 4900static void snd_hdspm_proc_init(struct hdspm *hdspm)
5237{ 4901{
5238 struct snd_info_entry *entry; 4902 struct snd_info_entry *entry;
5239 4903
@@ -6266,7 +5930,7 @@ static int snd_hdspm_hwdep_ioctl(struct snd_hwdep *hw, struct file *file,
6266 info.system_clock_mode = hdspm_system_clock_mode(hdspm); 5930 info.system_clock_mode = hdspm_system_clock_mode(hdspm);
6267 info.clock_source = hdspm_clock_source(hdspm); 5931 info.clock_source = hdspm_clock_source(hdspm);
6268 info.autosync_ref = hdspm_autosync_ref(hdspm); 5932 info.autosync_ref = hdspm_autosync_ref(hdspm);
6269 info.line_out = hdspm_line_out(hdspm); 5933 info.line_out = hdspm_toggle_setting(hdspm, HDSPM_LineOut);
6270 info.passthru = 0; 5934 info.passthru = 0;
6271 spin_unlock_irq(&hdspm->lock); 5935 spin_unlock_irq(&hdspm->lock);
6272 if (copy_to_user(argp, &info, sizeof(info))) 5936 if (copy_to_user(argp, &info, sizeof(info)))
@@ -6369,8 +6033,8 @@ static struct snd_pcm_ops snd_hdspm_capture_ops = {
6369 .page = snd_pcm_sgbuf_ops_page, 6033 .page = snd_pcm_sgbuf_ops_page,
6370}; 6034};
6371 6035
6372static int __devinit snd_hdspm_create_hwdep(struct snd_card *card, 6036static int snd_hdspm_create_hwdep(struct snd_card *card,
6373 struct hdspm * hdspm) 6037 struct hdspm *hdspm)
6374{ 6038{
6375 struct snd_hwdep *hw; 6039 struct snd_hwdep *hw;
6376 int err; 6040 int err;
@@ -6395,7 +6059,7 @@ static int __devinit snd_hdspm_create_hwdep(struct snd_card *card,
6395/*------------------------------------------------------------ 6059/*------------------------------------------------------------
6396 memory interface 6060 memory interface
6397 ------------------------------------------------------------*/ 6061 ------------------------------------------------------------*/
6398static int __devinit snd_hdspm_preallocate_memory(struct hdspm *hdspm) 6062static int snd_hdspm_preallocate_memory(struct hdspm *hdspm)
6399{ 6063{
6400 int err; 6064 int err;
6401 struct snd_pcm *pcm; 6065 struct snd_pcm *pcm;
@@ -6436,8 +6100,8 @@ static void hdspm_set_sgbuf(struct hdspm *hdspm,
6436 6100
6437 6101
6438/* ------------- ALSA Devices ---------------------------- */ 6102/* ------------- ALSA Devices ---------------------------- */
6439static int __devinit snd_hdspm_create_pcm(struct snd_card *card, 6103static int snd_hdspm_create_pcm(struct snd_card *card,
6440 struct hdspm *hdspm) 6104 struct hdspm *hdspm)
6441{ 6105{
6442 struct snd_pcm *pcm; 6106 struct snd_pcm *pcm;
6443 int err; 6107 int err;
@@ -6472,8 +6136,8 @@ static inline void snd_hdspm_initialize_midi_flush(struct hdspm * hdspm)
6472 snd_hdspm_flush_midi_input(hdspm, i); 6136 snd_hdspm_flush_midi_input(hdspm, i);
6473} 6137}
6474 6138
6475static int __devinit snd_hdspm_create_alsa_devices(struct snd_card *card, 6139static int snd_hdspm_create_alsa_devices(struct snd_card *card,
6476 struct hdspm * hdspm) 6140 struct hdspm *hdspm)
6477{ 6141{
6478 int err, i; 6142 int err, i;
6479 6143
@@ -6531,8 +6195,9 @@ static int __devinit snd_hdspm_create_alsa_devices(struct snd_card *card,
6531 return 0; 6195 return 0;
6532} 6196}
6533 6197
6534static int __devinit snd_hdspm_create(struct snd_card *card, 6198static int snd_hdspm_create(struct snd_card *card,
6535 struct hdspm *hdspm) { 6199 struct hdspm *hdspm)
6200{
6536 6201
6537 struct pci_dev *pci = hdspm->pci; 6202 struct pci_dev *pci = hdspm->pci;
6538 int err; 6203 int err;
@@ -6905,8 +6570,8 @@ static void snd_hdspm_card_free(struct snd_card *card)
6905} 6570}
6906 6571
6907 6572
6908static int __devinit snd_hdspm_probe(struct pci_dev *pci, 6573static int snd_hdspm_probe(struct pci_dev *pci,
6909 const struct pci_device_id *pci_id) 6574 const struct pci_device_id *pci_id)
6910{ 6575{
6911 static int dev; 6576 static int dev;
6912 struct hdspm *hdspm; 6577 struct hdspm *hdspm;
@@ -6964,7 +6629,7 @@ static int __devinit snd_hdspm_probe(struct pci_dev *pci,
6964 return 0; 6629 return 0;
6965} 6630}
6966 6631
6967static void __devexit snd_hdspm_remove(struct pci_dev *pci) 6632static void snd_hdspm_remove(struct pci_dev *pci)
6968{ 6633{
6969 snd_card_free(pci_get_drvdata(pci)); 6634 snd_card_free(pci_get_drvdata(pci));
6970 pci_set_drvdata(pci, NULL); 6635 pci_set_drvdata(pci, NULL);
@@ -6974,7 +6639,7 @@ static struct pci_driver hdspm_driver = {
6974 .name = KBUILD_MODNAME, 6639 .name = KBUILD_MODNAME,
6975 .id_table = snd_hdspm_ids, 6640 .id_table = snd_hdspm_ids,
6976 .probe = snd_hdspm_probe, 6641 .probe = snd_hdspm_probe,
6977 .remove = __devexit_p(snd_hdspm_remove), 6642 .remove = snd_hdspm_remove,
6978}; 6643};
6979 6644
6980module_pci_driver(hdspm_driver); 6645module_pci_driver(hdspm_driver);
diff --git a/sound/pci/rme9652/rme9652.c b/sound/pci/rme9652/rme9652.c
index a15fc100ab0c..773a67fff4cd 100644
--- a/sound/pci/rme9652/rme9652.c
+++ b/sound/pci/rme9652/rme9652.c
@@ -1757,7 +1757,7 @@ snd_rme9652_proc_read(struct snd_info_entry *entry, struct snd_info_buffer *buff
1757 snd_iprintf(buffer, "\n"); 1757 snd_iprintf(buffer, "\n");
1758} 1758}
1759 1759
1760static void __devinit snd_rme9652_proc_init(struct snd_rme9652 *rme9652) 1760static void snd_rme9652_proc_init(struct snd_rme9652 *rme9652)
1761{ 1761{
1762 struct snd_info_entry *entry; 1762 struct snd_info_entry *entry;
1763 1763
@@ -1788,7 +1788,7 @@ static int snd_rme9652_free(struct snd_rme9652 *rme9652)
1788 return 0; 1788 return 0;
1789} 1789}
1790 1790
1791static int __devinit snd_rme9652_initialize_memory(struct snd_rme9652 *rme9652) 1791static int snd_rme9652_initialize_memory(struct snd_rme9652 *rme9652)
1792{ 1792{
1793 unsigned long pb_bus, cb_bus; 1793 unsigned long pb_bus, cb_bus;
1794 1794
@@ -2414,8 +2414,8 @@ static struct snd_pcm_ops snd_rme9652_capture_ops = {
2414 .copy = snd_rme9652_capture_copy, 2414 .copy = snd_rme9652_capture_copy,
2415}; 2415};
2416 2416
2417static int __devinit snd_rme9652_create_pcm(struct snd_card *card, 2417static int snd_rme9652_create_pcm(struct snd_card *card,
2418 struct snd_rme9652 *rme9652) 2418 struct snd_rme9652 *rme9652)
2419{ 2419{
2420 struct snd_pcm *pcm; 2420 struct snd_pcm *pcm;
2421 int err; 2421 int err;
@@ -2438,9 +2438,9 @@ static int __devinit snd_rme9652_create_pcm(struct snd_card *card,
2438 return 0; 2438 return 0;
2439} 2439}
2440 2440
2441static int __devinit snd_rme9652_create(struct snd_card *card, 2441static int snd_rme9652_create(struct snd_card *card,
2442 struct snd_rme9652 *rme9652, 2442 struct snd_rme9652 *rme9652,
2443 int precise_ptr) 2443 int precise_ptr)
2444{ 2444{
2445 struct pci_dev *pci = rme9652->pci; 2445 struct pci_dev *pci = rme9652->pci;
2446 int err; 2446 int err;
@@ -2578,8 +2578,8 @@ static void snd_rme9652_card_free(struct snd_card *card)
2578 snd_rme9652_free(rme9652); 2578 snd_rme9652_free(rme9652);
2579} 2579}
2580 2580
2581static int __devinit snd_rme9652_probe(struct pci_dev *pci, 2581static int snd_rme9652_probe(struct pci_dev *pci,
2582 const struct pci_device_id *pci_id) 2582 const struct pci_device_id *pci_id)
2583{ 2583{
2584 static int dev; 2584 static int dev;
2585 struct snd_rme9652 *rme9652; 2585 struct snd_rme9652 *rme9652;
@@ -2625,7 +2625,7 @@ static int __devinit snd_rme9652_probe(struct pci_dev *pci,
2625 return 0; 2625 return 0;
2626} 2626}
2627 2627
2628static void __devexit snd_rme9652_remove(struct pci_dev *pci) 2628static void snd_rme9652_remove(struct pci_dev *pci)
2629{ 2629{
2630 snd_card_free(pci_get_drvdata(pci)); 2630 snd_card_free(pci_get_drvdata(pci));
2631 pci_set_drvdata(pci, NULL); 2631 pci_set_drvdata(pci, NULL);
@@ -2635,7 +2635,7 @@ static struct pci_driver rme9652_driver = {
2635 .name = KBUILD_MODNAME, 2635 .name = KBUILD_MODNAME,
2636 .id_table = snd_rme9652_ids, 2636 .id_table = snd_rme9652_ids,
2637 .probe = snd_rme9652_probe, 2637 .probe = snd_rme9652_probe,
2638 .remove = __devexit_p(snd_rme9652_remove), 2638 .remove = snd_rme9652_remove,
2639}; 2639};
2640 2640
2641module_pci_driver(rme9652_driver); 2641module_pci_driver(rme9652_driver);
diff --git a/sound/pci/sis7019.c b/sound/pci/sis7019.c
index 51e43407ebc5..d59abe1682c5 100644
--- a/sound/pci/sis7019.c
+++ b/sound/pci/sis7019.c
@@ -894,7 +894,7 @@ static struct snd_pcm_ops sis_capture_ops = {
894 .pointer = sis_pcm_pointer, 894 .pointer = sis_pcm_pointer,
895}; 895};
896 896
897static int __devinit sis_pcm_create(struct sis7019 *sis) 897static int sis_pcm_create(struct sis7019 *sis)
898{ 898{
899 struct snd_pcm *pcm; 899 struct snd_pcm *pcm;
900 int rc; 900 int rc;
@@ -1013,7 +1013,7 @@ static unsigned short sis_ac97_read(struct snd_ac97 *ac97, unsigned short reg)
1013 (reg << 8) | cmd[ac97->num]); 1013 (reg << 8) | cmd[ac97->num]);
1014} 1014}
1015 1015
1016static int __devinit sis_mixer_create(struct sis7019 *sis) 1016static int sis_mixer_create(struct sis7019 *sis)
1017{ 1017{
1018 struct snd_ac97_bus *bus; 1018 struct snd_ac97_bus *bus;
1019 struct snd_ac97_template ac97; 1019 struct snd_ac97_template ac97;
@@ -1171,7 +1171,7 @@ static int sis_chip_init(struct sis7019 *sis)
1171 outl(SIS_DMA_CSR_PCI_SETTINGS, io + SIS_DMA_CSR); 1171 outl(SIS_DMA_CSR_PCI_SETTINGS, io + SIS_DMA_CSR);
1172 1172
1173 /* Reset the synchronization groups for all of the channels 1173 /* Reset the synchronization groups for all of the channels
1174 * to be asyncronous. If we start doing SPDIF or 5.1 sound, etc. 1174 * to be asynchronous. If we start doing SPDIF or 5.1 sound, etc.
1175 * we'll need to change how we handle these. Until then, we just 1175 * we'll need to change how we handle these. Until then, we just
1176 * assign sub-mixer 0 to all playback channels, and avoid any 1176 * assign sub-mixer 0 to all playback channels, and avoid any
1177 * attenuation on the audio. 1177 * attenuation on the audio.
@@ -1326,8 +1326,8 @@ static int sis_alloc_suspend(struct sis7019 *sis)
1326 return 0; 1326 return 0;
1327} 1327}
1328 1328
1329static int __devinit sis_chip_create(struct snd_card *card, 1329static int sis_chip_create(struct snd_card *card,
1330 struct pci_dev *pci) 1330 struct pci_dev *pci)
1331{ 1331{
1332 struct sis7019 *sis = card->private_data; 1332 struct sis7019 *sis = card->private_data;
1333 struct voice *voice; 1333 struct voice *voice;
@@ -1417,8 +1417,8 @@ error_out:
1417 return rc; 1417 return rc;
1418} 1418}
1419 1419
1420static int __devinit snd_sis7019_probe(struct pci_dev *pci, 1420static int snd_sis7019_probe(struct pci_dev *pci,
1421 const struct pci_device_id *pci_id) 1421 const struct pci_device_id *pci_id)
1422{ 1422{
1423 struct snd_card *card; 1423 struct snd_card *card;
1424 struct sis7019 *sis; 1424 struct sis7019 *sis;
@@ -1478,7 +1478,7 @@ error_out:
1478 return rc; 1478 return rc;
1479} 1479}
1480 1480
1481static void __devexit snd_sis7019_remove(struct pci_dev *pci) 1481static void snd_sis7019_remove(struct pci_dev *pci)
1482{ 1482{
1483 snd_card_free(pci_get_drvdata(pci)); 1483 snd_card_free(pci_get_drvdata(pci));
1484 pci_set_drvdata(pci, NULL); 1484 pci_set_drvdata(pci, NULL);
@@ -1488,7 +1488,7 @@ static struct pci_driver sis7019_driver = {
1488 .name = KBUILD_MODNAME, 1488 .name = KBUILD_MODNAME,
1489 .id_table = snd_sis7019_ids, 1489 .id_table = snd_sis7019_ids,
1490 .probe = snd_sis7019_probe, 1490 .probe = snd_sis7019_probe,
1491 .remove = __devexit_p(snd_sis7019_remove), 1491 .remove = snd_sis7019_remove,
1492 .driver = { 1492 .driver = {
1493 .pm = SIS_PM_OPS, 1493 .pm = SIS_PM_OPS,
1494 }, 1494 },
diff --git a/sound/pci/sonicvibes.c b/sound/pci/sonicvibes.c
index baa9946bedf0..a2e7686e7ae3 100644
--- a/sound/pci/sonicvibes.c
+++ b/sound/pci/sonicvibes.c
@@ -877,7 +877,8 @@ static struct snd_pcm_ops snd_sonicvibes_capture_ops = {
877 .pointer = snd_sonicvibes_capture_pointer, 877 .pointer = snd_sonicvibes_capture_pointer,
878}; 878};
879 879
880static int __devinit snd_sonicvibes_pcm(struct sonicvibes * sonic, int device, struct snd_pcm ** rpcm) 880static int snd_sonicvibes_pcm(struct sonicvibes *sonic, int device,
881 struct snd_pcm **rpcm)
881{ 882{
882 struct snd_pcm *pcm; 883 struct snd_pcm *pcm;
883 int err; 884 int err;
@@ -1087,7 +1088,7 @@ static int snd_sonicvibes_put_double(struct snd_kcontrol *kcontrol, struct snd_c
1087 return change; 1088 return change;
1088} 1089}
1089 1090
1090static struct snd_kcontrol_new snd_sonicvibes_controls[] __devinitdata = { 1091static struct snd_kcontrol_new snd_sonicvibes_controls[] = {
1091SONICVIBES_DOUBLE("Capture Volume", 0, SV_IREG_LEFT_ADC, SV_IREG_RIGHT_ADC, 0, 0, 15, 0), 1092SONICVIBES_DOUBLE("Capture Volume", 0, SV_IREG_LEFT_ADC, SV_IREG_RIGHT_ADC, 0, 0, 15, 0),
1092SONICVIBES_DOUBLE("Aux Playback Switch", 0, SV_IREG_LEFT_AUX1, SV_IREG_RIGHT_AUX1, 7, 7, 1, 1), 1093SONICVIBES_DOUBLE("Aux Playback Switch", 0, SV_IREG_LEFT_AUX1, SV_IREG_RIGHT_AUX1, 7, 7, 1, 1),
1093SONICVIBES_DOUBLE("Aux Playback Volume", 0, SV_IREG_LEFT_AUX1, SV_IREG_RIGHT_AUX1, 0, 0, 31, 1), 1094SONICVIBES_DOUBLE("Aux Playback Volume", 0, SV_IREG_LEFT_AUX1, SV_IREG_RIGHT_AUX1, 0, 0, 31, 1),
@@ -1118,7 +1119,7 @@ static void snd_sonicvibes_master_free(struct snd_kcontrol *kcontrol)
1118 sonic->master_volume = NULL; 1119 sonic->master_volume = NULL;
1119} 1120}
1120 1121
1121static int __devinit snd_sonicvibes_mixer(struct sonicvibes * sonic) 1122static int snd_sonicvibes_mixer(struct sonicvibes *sonic)
1122{ 1123{
1123 struct snd_card *card; 1124 struct snd_card *card;
1124 struct snd_kcontrol *kctl; 1125 struct snd_kcontrol *kctl;
@@ -1175,7 +1176,7 @@ static void snd_sonicvibes_proc_read(struct snd_info_entry *entry,
1175 snd_iprintf(buffer, "MIDI to ext. Tx : %s\n", tmp & 0x04 ? "on" : "off"); 1176 snd_iprintf(buffer, "MIDI to ext. Tx : %s\n", tmp & 0x04 ? "on" : "off");
1176} 1177}
1177 1178
1178static void __devinit snd_sonicvibes_proc_init(struct sonicvibes * sonic) 1179static void snd_sonicvibes_proc_init(struct sonicvibes *sonic)
1179{ 1180{
1180 struct snd_info_entry *entry; 1181 struct snd_info_entry *entry;
1181 1182
@@ -1188,10 +1189,10 @@ static void __devinit snd_sonicvibes_proc_init(struct sonicvibes * sonic)
1188 */ 1189 */
1189 1190
1190#ifdef SUPPORT_JOYSTICK 1191#ifdef SUPPORT_JOYSTICK
1191static struct snd_kcontrol_new snd_sonicvibes_game_control __devinitdata = 1192static struct snd_kcontrol_new snd_sonicvibes_game_control =
1192SONICVIBES_SINGLE("Joystick Speed", 0, SV_IREG_GAME_PORT, 1, 15, 0); 1193SONICVIBES_SINGLE("Joystick Speed", 0, SV_IREG_GAME_PORT, 1, 15, 0);
1193 1194
1194static int __devinit snd_sonicvibes_create_gameport(struct sonicvibes *sonic) 1195static int snd_sonicvibes_create_gameport(struct sonicvibes *sonic)
1195{ 1196{
1196 struct gameport *gp; 1197 struct gameport *gp;
1197 1198
@@ -1246,11 +1247,11 @@ static int snd_sonicvibes_dev_free(struct snd_device *device)
1246 return snd_sonicvibes_free(sonic); 1247 return snd_sonicvibes_free(sonic);
1247} 1248}
1248 1249
1249static int __devinit snd_sonicvibes_create(struct snd_card *card, 1250static int snd_sonicvibes_create(struct snd_card *card,
1250 struct pci_dev *pci, 1251 struct pci_dev *pci,
1251 int reverb, 1252 int reverb,
1252 int mge, 1253 int mge,
1253 struct sonicvibes ** rsonic) 1254 struct sonicvibes **rsonic)
1254{ 1255{
1255 struct sonicvibes *sonic; 1256 struct sonicvibes *sonic;
1256 unsigned int dmaa, dmac; 1257 unsigned int dmaa, dmac;
@@ -1401,7 +1402,7 @@ static int __devinit snd_sonicvibes_create(struct snd_card *card,
1401 * MIDI section 1402 * MIDI section
1402 */ 1403 */
1403 1404
1404static struct snd_kcontrol_new snd_sonicvibes_midi_controls[] __devinitdata = { 1405static struct snd_kcontrol_new snd_sonicvibes_midi_controls[] = {
1405SONICVIBES_SINGLE("SonicVibes Wave Source RAM", 0, SV_IREG_WAVE_SOURCE, 0, 1, 0), 1406SONICVIBES_SINGLE("SonicVibes Wave Source RAM", 0, SV_IREG_WAVE_SOURCE, 0, 1, 0),
1406SONICVIBES_SINGLE("SonicVibes Wave Source RAM+ROM", 0, SV_IREG_WAVE_SOURCE, 1, 1, 0), 1407SONICVIBES_SINGLE("SonicVibes Wave Source RAM+ROM", 0, SV_IREG_WAVE_SOURCE, 1, 1, 0),
1407SONICVIBES_SINGLE("SonicVibes Onboard Synth", 0, SV_IREG_MPU401, 0, 1, 0), 1408SONICVIBES_SINGLE("SonicVibes Onboard Synth", 0, SV_IREG_MPU401, 0, 1, 0),
@@ -1422,8 +1423,8 @@ static void snd_sonicvibes_midi_input_close(struct snd_mpu401 * mpu)
1422 outb(sonic->irqmask |= SV_MIDI_MASK, SV_REG(sonic, IRQMASK)); 1423 outb(sonic->irqmask |= SV_MIDI_MASK, SV_REG(sonic, IRQMASK));
1423} 1424}
1424 1425
1425static int __devinit snd_sonicvibes_midi(struct sonicvibes * sonic, 1426static int snd_sonicvibes_midi(struct sonicvibes *sonic,
1426 struct snd_rawmidi *rmidi) 1427 struct snd_rawmidi *rmidi)
1427{ 1428{
1428 struct snd_mpu401 * mpu = rmidi->private_data; 1429 struct snd_mpu401 * mpu = rmidi->private_data;
1429 struct snd_card *card = sonic->card; 1430 struct snd_card *card = sonic->card;
@@ -1441,8 +1442,8 @@ static int __devinit snd_sonicvibes_midi(struct sonicvibes * sonic,
1441 return 0; 1442 return 0;
1442} 1443}
1443 1444
1444static int __devinit snd_sonic_probe(struct pci_dev *pci, 1445static int snd_sonic_probe(struct pci_dev *pci,
1445 const struct pci_device_id *pci_id) 1446 const struct pci_device_id *pci_id)
1446{ 1447{
1447 static int dev; 1448 static int dev;
1448 struct snd_card *card; 1449 struct snd_card *card;
@@ -1524,7 +1525,7 @@ static int __devinit snd_sonic_probe(struct pci_dev *pci,
1524 return 0; 1525 return 0;
1525} 1526}
1526 1527
1527static void __devexit snd_sonic_remove(struct pci_dev *pci) 1528static void snd_sonic_remove(struct pci_dev *pci)
1528{ 1529{
1529 snd_card_free(pci_get_drvdata(pci)); 1530 snd_card_free(pci_get_drvdata(pci));
1530 pci_set_drvdata(pci, NULL); 1531 pci_set_drvdata(pci, NULL);
@@ -1534,7 +1535,7 @@ static struct pci_driver sonicvibes_driver = {
1534 .name = KBUILD_MODNAME, 1535 .name = KBUILD_MODNAME,
1535 .id_table = snd_sonic_ids, 1536 .id_table = snd_sonic_ids,
1536 .probe = snd_sonic_probe, 1537 .probe = snd_sonic_probe,
1537 .remove = __devexit_p(snd_sonic_remove), 1538 .remove = snd_sonic_remove,
1538}; 1539};
1539 1540
1540module_pci_driver(sonicvibes_driver); 1541module_pci_driver(sonicvibes_driver);
diff --git a/sound/pci/trident/trident.c b/sound/pci/trident/trident.c
index 8a6f1f76e870..1aefd6204a63 100644
--- a/sound/pci/trident/trident.c
+++ b/sound/pci/trident/trident.c
@@ -73,8 +73,8 @@ static DEFINE_PCI_DEVICE_TABLE(snd_trident_ids) = {
73 73
74MODULE_DEVICE_TABLE(pci, snd_trident_ids); 74MODULE_DEVICE_TABLE(pci, snd_trident_ids);
75 75
76static int __devinit snd_trident_probe(struct pci_dev *pci, 76static int snd_trident_probe(struct pci_dev *pci,
77 const struct pci_device_id *pci_id) 77 const struct pci_device_id *pci_id)
78{ 78{
79 static int dev; 79 static int dev;
80 struct snd_card *card; 80 struct snd_card *card;
@@ -166,7 +166,7 @@ static int __devinit snd_trident_probe(struct pci_dev *pci,
166 return 0; 166 return 0;
167} 167}
168 168
169static void __devexit snd_trident_remove(struct pci_dev *pci) 169static void snd_trident_remove(struct pci_dev *pci)
170{ 170{
171 snd_card_free(pci_get_drvdata(pci)); 171 snd_card_free(pci_get_drvdata(pci));
172 pci_set_drvdata(pci, NULL); 172 pci_set_drvdata(pci, NULL);
@@ -176,7 +176,7 @@ static struct pci_driver trident_driver = {
176 .name = KBUILD_MODNAME, 176 .name = KBUILD_MODNAME,
177 .id_table = snd_trident_ids, 177 .id_table = snd_trident_ids,
178 .probe = snd_trident_probe, 178 .probe = snd_trident_probe,
179 .remove = __devexit_p(snd_trident_remove), 179 .remove = snd_trident_remove,
180#ifdef CONFIG_PM_SLEEP 180#ifdef CONFIG_PM_SLEEP
181 .driver = { 181 .driver = {
182 .pm = &snd_trident_pm, 182 .pm = &snd_trident_pm,
diff --git a/sound/pci/trident/trident_main.c b/sound/pci/trident/trident_main.c
index 06b10d1a76e5..fb0e1586a6f8 100644
--- a/sound/pci/trident/trident_main.c
+++ b/sound/pci/trident/trident_main.c
@@ -2171,8 +2171,8 @@ static struct snd_pcm_ops snd_trident_spdif_7018_ops = {
2171 2171
2172 ---------------------------------------------------------------------------*/ 2172 ---------------------------------------------------------------------------*/
2173 2173
2174int __devinit snd_trident_pcm(struct snd_trident * trident, 2174int snd_trident_pcm(struct snd_trident *trident,
2175 int device, struct snd_pcm ** rpcm) 2175 int device, struct snd_pcm **rpcm)
2176{ 2176{
2177 struct snd_pcm *pcm; 2177 struct snd_pcm *pcm;
2178 int err; 2178 int err;
@@ -2229,8 +2229,8 @@ int __devinit snd_trident_pcm(struct snd_trident * trident,
2229 2229
2230 ---------------------------------------------------------------------------*/ 2230 ---------------------------------------------------------------------------*/
2231 2231
2232int __devinit snd_trident_foldback_pcm(struct snd_trident * trident, 2232int snd_trident_foldback_pcm(struct snd_trident *trident,
2233 int device, struct snd_pcm ** rpcm) 2233 int device, struct snd_pcm **rpcm)
2234{ 2234{
2235 struct snd_pcm *foldback; 2235 struct snd_pcm *foldback;
2236 int err; 2236 int err;
@@ -2286,8 +2286,8 @@ int __devinit snd_trident_foldback_pcm(struct snd_trident * trident,
2286 2286
2287 ---------------------------------------------------------------------------*/ 2287 ---------------------------------------------------------------------------*/
2288 2288
2289int __devinit snd_trident_spdif_pcm(struct snd_trident * trident, 2289int snd_trident_spdif_pcm(struct snd_trident *trident,
2290 int device, struct snd_pcm ** rpcm) 2290 int device, struct snd_pcm **rpcm)
2291{ 2291{
2292 struct snd_pcm *spdif; 2292 struct snd_pcm *spdif;
2293 int err; 2293 int err;
@@ -2371,7 +2371,7 @@ static int snd_trident_spdif_control_put(struct snd_kcontrol *kcontrol,
2371 return change; 2371 return change;
2372} 2372}
2373 2373
2374static struct snd_kcontrol_new snd_trident_spdif_control __devinitdata = 2374static struct snd_kcontrol_new snd_trident_spdif_control =
2375{ 2375{
2376 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2376 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2377 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,SWITCH), 2377 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,SWITCH),
@@ -2434,7 +2434,7 @@ static int snd_trident_spdif_default_put(struct snd_kcontrol *kcontrol,
2434 return change; 2434 return change;
2435} 2435}
2436 2436
2437static struct snd_kcontrol_new snd_trident_spdif_default __devinitdata = 2437static struct snd_kcontrol_new snd_trident_spdif_default =
2438{ 2438{
2439 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 2439 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
2440 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT), 2440 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT),
@@ -2467,7 +2467,7 @@ static int snd_trident_spdif_mask_get(struct snd_kcontrol *kcontrol,
2467 return 0; 2467 return 0;
2468} 2468}
2469 2469
2470static struct snd_kcontrol_new snd_trident_spdif_mask __devinitdata = 2470static struct snd_kcontrol_new snd_trident_spdif_mask =
2471{ 2471{
2472 .access = SNDRV_CTL_ELEM_ACCESS_READ, 2472 .access = SNDRV_CTL_ELEM_ACCESS_READ,
2473 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 2473 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
@@ -2529,7 +2529,7 @@ static int snd_trident_spdif_stream_put(struct snd_kcontrol *kcontrol,
2529 return change; 2529 return change;
2530} 2530}
2531 2531
2532static struct snd_kcontrol_new snd_trident_spdif_stream __devinitdata = 2532static struct snd_kcontrol_new snd_trident_spdif_stream =
2533{ 2533{
2534 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_INACTIVE, 2534 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_INACTIVE,
2535 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 2535 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
@@ -2579,7 +2579,7 @@ static int snd_trident_ac97_control_put(struct snd_kcontrol *kcontrol,
2579 return change; 2579 return change;
2580} 2580}
2581 2581
2582static struct snd_kcontrol_new snd_trident_ac97_rear_control __devinitdata = 2582static struct snd_kcontrol_new snd_trident_ac97_rear_control =
2583{ 2583{
2584 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2584 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2585 .name = "Rear Path", 2585 .name = "Rear Path",
@@ -2637,7 +2637,7 @@ static int snd_trident_vol_control_put(struct snd_kcontrol *kcontrol,
2637 return change; 2637 return change;
2638} 2638}
2639 2639
2640static struct snd_kcontrol_new snd_trident_vol_music_control __devinitdata = 2640static struct snd_kcontrol_new snd_trident_vol_music_control =
2641{ 2641{
2642 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2642 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2643 .name = "Music Playback Volume", 2643 .name = "Music Playback Volume",
@@ -2648,7 +2648,7 @@ static struct snd_kcontrol_new snd_trident_vol_music_control __devinitdata =
2648 .tlv = { .p = db_scale_gvol }, 2648 .tlv = { .p = db_scale_gvol },
2649}; 2649};
2650 2650
2651static struct snd_kcontrol_new snd_trident_vol_wave_control __devinitdata = 2651static struct snd_kcontrol_new snd_trident_vol_wave_control =
2652{ 2652{
2653 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2653 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2654 .name = "Wave Playback Volume", 2654 .name = "Wave Playback Volume",
@@ -2715,7 +2715,7 @@ static int snd_trident_pcm_vol_control_put(struct snd_kcontrol *kcontrol,
2715 return change; 2715 return change;
2716} 2716}
2717 2717
2718static struct snd_kcontrol_new snd_trident_pcm_vol_control __devinitdata = 2718static struct snd_kcontrol_new snd_trident_pcm_vol_control =
2719{ 2719{
2720 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2720 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2721 .name = "PCM Front Playback Volume", 2721 .name = "PCM Front Playback Volume",
@@ -2779,7 +2779,7 @@ static int snd_trident_pcm_pan_control_put(struct snd_kcontrol *kcontrol,
2779 return change; 2779 return change;
2780} 2780}
2781 2781
2782static struct snd_kcontrol_new snd_trident_pcm_pan_control __devinitdata = 2782static struct snd_kcontrol_new snd_trident_pcm_pan_control =
2783{ 2783{
2784 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2784 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2785 .name = "PCM Pan Playback Control", 2785 .name = "PCM Pan Playback Control",
@@ -2836,7 +2836,7 @@ static int snd_trident_pcm_rvol_control_put(struct snd_kcontrol *kcontrol,
2836 2836
2837static const DECLARE_TLV_DB_SCALE(db_scale_crvol, -3175, 25, 1); 2837static const DECLARE_TLV_DB_SCALE(db_scale_crvol, -3175, 25, 1);
2838 2838
2839static struct snd_kcontrol_new snd_trident_pcm_rvol_control __devinitdata = 2839static struct snd_kcontrol_new snd_trident_pcm_rvol_control =
2840{ 2840{
2841 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2841 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2842 .name = "PCM Reverb Playback Volume", 2842 .name = "PCM Reverb Playback Volume",
@@ -2892,7 +2892,7 @@ static int snd_trident_pcm_cvol_control_put(struct snd_kcontrol *kcontrol,
2892 return change; 2892 return change;
2893} 2893}
2894 2894
2895static struct snd_kcontrol_new snd_trident_pcm_cvol_control __devinitdata = 2895static struct snd_kcontrol_new snd_trident_pcm_cvol_control =
2896{ 2896{
2897 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2897 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2898 .name = "PCM Chorus Playback Volume", 2898 .name = "PCM Chorus Playback Volume",
@@ -2972,7 +2972,7 @@ static int snd_trident_pcm_mixer_free(struct snd_trident *trident, struct snd_tr
2972 2972
2973 ---------------------------------------------------------------------------*/ 2973 ---------------------------------------------------------------------------*/
2974 2974
2975static int __devinit snd_trident_mixer(struct snd_trident * trident, int pcm_spdif_device) 2975static int snd_trident_mixer(struct snd_trident *trident, int pcm_spdif_device)
2976{ 2976{
2977 struct snd_ac97_template _ac97; 2977 struct snd_ac97_template _ac97;
2978 struct snd_card *card = trident->card; 2978 struct snd_card *card = trident->card;
@@ -3191,7 +3191,7 @@ static int snd_trident_gameport_open(struct gameport *gameport, int mode)
3191 } 3191 }
3192} 3192}
3193 3193
3194int __devinit snd_trident_create_gameport(struct snd_trident *chip) 3194int snd_trident_create_gameport(struct snd_trident *chip)
3195{ 3195{
3196 struct gameport *gp; 3196 struct gameport *gp;
3197 3197
@@ -3225,7 +3225,7 @@ static inline void snd_trident_free_gameport(struct snd_trident *chip)
3225 } 3225 }
3226} 3226}
3227#else 3227#else
3228int __devinit snd_trident_create_gameport(struct snd_trident *chip) { return -ENOSYS; } 3228int snd_trident_create_gameport(struct snd_trident *chip) { return -ENOSYS; }
3229static inline void snd_trident_free_gameport(struct snd_trident *chip) { } 3229static inline void snd_trident_free_gameport(struct snd_trident *chip) { }
3230#endif /* CONFIG_GAMEPORT */ 3230#endif /* CONFIG_GAMEPORT */
3231 3231
@@ -3329,7 +3329,7 @@ static void snd_trident_proc_read(struct snd_info_entry *entry,
3329 } 3329 }
3330} 3330}
3331 3331
3332static void __devinit snd_trident_proc_init(struct snd_trident * trident) 3332static void snd_trident_proc_init(struct snd_trident *trident)
3333{ 3333{
3334 struct snd_info_entry *entry; 3334 struct snd_info_entry *entry;
3335 const char *s = "trident"; 3335 const char *s = "trident";
@@ -3358,7 +3358,7 @@ static int snd_trident_dev_free(struct snd_device *device)
3358 3358
3359 ---------------------------------------------------------------------------*/ 3359 ---------------------------------------------------------------------------*/
3360 3360
3361static int __devinit snd_trident_tlb_alloc(struct snd_trident *trident) 3361static int snd_trident_tlb_alloc(struct snd_trident *trident)
3362{ 3362{
3363 int i; 3363 int i;
3364 3364
@@ -3539,7 +3539,7 @@ static int snd_trident_sis_init(struct snd_trident *trident)
3539 3539
3540 ---------------------------------------------------------------------------*/ 3540 ---------------------------------------------------------------------------*/
3541 3541
3542int __devinit snd_trident_create(struct snd_card *card, 3542int snd_trident_create(struct snd_card *card,
3543 struct pci_dev *pci, 3543 struct pci_dev *pci,
3544 int pcm_streams, 3544 int pcm_streams,
3545 int pcm_spdif_device, 3545 int pcm_spdif_device,
diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c
index f0b4efdb483c..6442f611a07b 100644
--- a/sound/pci/via82xx.c
+++ b/sound/pci/via82xx.c
@@ -1437,7 +1437,7 @@ static void init_viadev(struct via82xx *chip, int idx, unsigned int reg_offset,
1437/* 1437/*
1438 * create pcm instances for VIA8233, 8233C and 8235 (not 8233A) 1438 * create pcm instances for VIA8233, 8233C and 8235 (not 8233A)
1439 */ 1439 */
1440static int __devinit snd_via8233_pcm_new(struct via82xx *chip) 1440static int snd_via8233_pcm_new(struct via82xx *chip)
1441{ 1441{
1442 struct snd_pcm *pcm; 1442 struct snd_pcm *pcm;
1443 struct snd_pcm_chmap *chmap; 1443 struct snd_pcm_chmap *chmap;
@@ -1505,7 +1505,7 @@ static int __devinit snd_via8233_pcm_new(struct via82xx *chip)
1505/* 1505/*
1506 * create pcm instances for VIA8233A 1506 * create pcm instances for VIA8233A
1507 */ 1507 */
1508static int __devinit snd_via8233a_pcm_new(struct via82xx *chip) 1508static int snd_via8233a_pcm_new(struct via82xx *chip)
1509{ 1509{
1510 struct snd_pcm *pcm; 1510 struct snd_pcm *pcm;
1511 struct snd_pcm_chmap *chmap; 1511 struct snd_pcm_chmap *chmap;
@@ -1566,7 +1566,7 @@ static int __devinit snd_via8233a_pcm_new(struct via82xx *chip)
1566/* 1566/*
1567 * create a pcm instance for via686a/b 1567 * create a pcm instance for via686a/b
1568 */ 1568 */
1569static int __devinit snd_via686_pcm_new(struct via82xx *chip) 1569static int snd_via686_pcm_new(struct via82xx *chip)
1570{ 1570{
1571 struct snd_pcm *pcm; 1571 struct snd_pcm *pcm;
1572 int err; 1572 int err;
@@ -1643,7 +1643,7 @@ static int snd_via8233_capture_source_put(struct snd_kcontrol *kcontrol,
1643 return val != oval; 1643 return val != oval;
1644} 1644}
1645 1645
1646static struct snd_kcontrol_new snd_via8233_capture_source __devinitdata = { 1646static struct snd_kcontrol_new snd_via8233_capture_source = {
1647 .name = "Input Source Select", 1647 .name = "Input Source Select",
1648 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1648 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1649 .info = snd_via8233_capture_source_info, 1649 .info = snd_via8233_capture_source_info,
@@ -1683,7 +1683,7 @@ static int snd_via8233_dxs3_spdif_put(struct snd_kcontrol *kcontrol,
1683 return 0; 1683 return 0;
1684} 1684}
1685 1685
1686static struct snd_kcontrol_new snd_via8233_dxs3_spdif_control __devinitdata = { 1686static struct snd_kcontrol_new snd_via8233_dxs3_spdif_control = {
1687 .name = SNDRV_CTL_NAME_IEC958("Output ",NONE,SWITCH), 1687 .name = SNDRV_CTL_NAME_IEC958("Output ",NONE,SWITCH),
1688 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1688 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1689 .info = snd_via8233_dxs3_spdif_info, 1689 .info = snd_via8233_dxs3_spdif_info,
@@ -1772,7 +1772,7 @@ static int snd_via8233_pcmdxs_volume_put(struct snd_kcontrol *kcontrol,
1772 1772
1773static const DECLARE_TLV_DB_SCALE(db_scale_dxs, -4650, 150, 1); 1773static const DECLARE_TLV_DB_SCALE(db_scale_dxs, -4650, 150, 1);
1774 1774
1775static struct snd_kcontrol_new snd_via8233_pcmdxs_volume_control __devinitdata = { 1775static struct snd_kcontrol_new snd_via8233_pcmdxs_volume_control = {
1776 .name = "PCM Playback Volume", 1776 .name = "PCM Playback Volume",
1777 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1777 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1778 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE | 1778 .access = (SNDRV_CTL_ELEM_ACCESS_READWRITE |
@@ -1783,7 +1783,7 @@ static struct snd_kcontrol_new snd_via8233_pcmdxs_volume_control __devinitdata =
1783 .tlv = { .p = db_scale_dxs } 1783 .tlv = { .p = db_scale_dxs }
1784}; 1784};
1785 1785
1786static struct snd_kcontrol_new snd_via8233_dxs_volume_control __devinitdata = { 1786static struct snd_kcontrol_new snd_via8233_dxs_volume_control = {
1787 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 1787 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
1788 .device = 0, 1788 .device = 0,
1789 /* .subdevice set later */ 1789 /* .subdevice set later */
@@ -1895,7 +1895,7 @@ static struct ac97_quirk ac97_quirks[] = {
1895 { } /* terminator */ 1895 { } /* terminator */
1896}; 1896};
1897 1897
1898static int __devinit snd_via82xx_mixer_new(struct via82xx *chip, const char *quirk_override) 1898static int snd_via82xx_mixer_new(struct via82xx *chip, const char *quirk_override)
1899{ 1899{
1900 struct snd_ac97_template ac97; 1900 struct snd_ac97_template ac97;
1901 int err; 1901 int err;
@@ -1930,7 +1930,7 @@ static int __devinit snd_via82xx_mixer_new(struct via82xx *chip, const char *qui
1930 1930
1931#ifdef SUPPORT_JOYSTICK 1931#ifdef SUPPORT_JOYSTICK
1932#define JOYSTICK_ADDR 0x200 1932#define JOYSTICK_ADDR 0x200
1933static int __devinit snd_via686_create_gameport(struct via82xx *chip, unsigned char *legacy) 1933static int snd_via686_create_gameport(struct via82xx *chip, unsigned char *legacy)
1934{ 1934{
1935 struct gameport *gp; 1935 struct gameport *gp;
1936 struct resource *r; 1936 struct resource *r;
@@ -1990,7 +1990,7 @@ static inline void snd_via686_free_gameport(struct via82xx *chip) { }
1990 * 1990 *
1991 */ 1991 */
1992 1992
1993static int __devinit snd_via8233_init_misc(struct via82xx *chip) 1993static int snd_via8233_init_misc(struct via82xx *chip)
1994{ 1994{
1995 int i, err, caps; 1995 int i, err, caps;
1996 unsigned char val; 1996 unsigned char val;
@@ -2047,7 +2047,7 @@ static int __devinit snd_via8233_init_misc(struct via82xx *chip)
2047 return 0; 2047 return 0;
2048} 2048}
2049 2049
2050static int __devinit snd_via686_init_misc(struct via82xx *chip) 2050static int snd_via686_init_misc(struct via82xx *chip)
2051{ 2051{
2052 unsigned char legacy, legacy_cfg; 2052 unsigned char legacy, legacy_cfg;
2053 int rev_h = 0; 2053 int rev_h = 0;
@@ -2137,7 +2137,7 @@ static void snd_via82xx_proc_read(struct snd_info_entry *entry,
2137 } 2137 }
2138} 2138}
2139 2139
2140static void __devinit snd_via82xx_proc_init(struct via82xx *chip) 2140static void snd_via82xx_proc_init(struct via82xx *chip)
2141{ 2141{
2142 struct snd_info_entry *entry; 2142 struct snd_info_entry *entry;
2143 2143
@@ -2370,12 +2370,12 @@ static int snd_via82xx_dev_free(struct snd_device *device)
2370 return snd_via82xx_free(chip); 2370 return snd_via82xx_free(chip);
2371} 2371}
2372 2372
2373static int __devinit snd_via82xx_create(struct snd_card *card, 2373static int snd_via82xx_create(struct snd_card *card,
2374 struct pci_dev *pci, 2374 struct pci_dev *pci,
2375 int chip_type, 2375 int chip_type,
2376 int revision, 2376 int revision,
2377 unsigned int ac97_clock, 2377 unsigned int ac97_clock,
2378 struct via82xx ** r_via) 2378 struct via82xx **r_via)
2379{ 2379{
2380 struct via82xx *chip; 2380 struct via82xx *chip;
2381 int err; 2381 int err;
@@ -2452,7 +2452,7 @@ struct via823x_info {
2452 char *name; 2452 char *name;
2453 int type; 2453 int type;
2454}; 2454};
2455static struct via823x_info via823x_cards[] __devinitdata = { 2455static struct via823x_info via823x_cards[] = {
2456 { VIA_REV_PRE_8233, "VIA 8233-Pre", TYPE_VIA8233 }, 2456 { VIA_REV_PRE_8233, "VIA 8233-Pre", TYPE_VIA8233 },
2457 { VIA_REV_8233C, "VIA 8233C", TYPE_VIA8233 }, 2457 { VIA_REV_8233C, "VIA 8233C", TYPE_VIA8233 },
2458 { VIA_REV_8233, "VIA 8233", TYPE_VIA8233 }, 2458 { VIA_REV_8233, "VIA 8233", TYPE_VIA8233 },
@@ -2466,7 +2466,7 @@ static struct via823x_info via823x_cards[] __devinitdata = {
2466 * auto detection of DXS channel supports. 2466 * auto detection of DXS channel supports.
2467 */ 2467 */
2468 2468
2469static struct snd_pci_quirk dxs_whitelist[] __devinitdata = { 2469static struct snd_pci_quirk dxs_whitelist[] = {
2470 SND_PCI_QUIRK(0x1005, 0x4710, "Avance Logic Mobo", VIA_DXS_ENABLE), 2470 SND_PCI_QUIRK(0x1005, 0x4710, "Avance Logic Mobo", VIA_DXS_ENABLE),
2471 SND_PCI_QUIRK(0x1019, 0x0996, "ESC Mobo", VIA_DXS_48K), 2471 SND_PCI_QUIRK(0x1019, 0x0996, "ESC Mobo", VIA_DXS_48K),
2472 SND_PCI_QUIRK(0x1019, 0x0a81, "ECS K7VTA3 v8.0", VIA_DXS_NO_VRA), 2472 SND_PCI_QUIRK(0x1019, 0x0a81, "ECS K7VTA3 v8.0", VIA_DXS_NO_VRA),
@@ -2510,7 +2510,7 @@ static struct snd_pci_quirk dxs_whitelist[] __devinitdata = {
2510 { } /* terminator */ 2510 { } /* terminator */
2511}; 2511};
2512 2512
2513static int __devinit check_dxs_list(struct pci_dev *pci, int revision) 2513static int check_dxs_list(struct pci_dev *pci, int revision)
2514{ 2514{
2515 const struct snd_pci_quirk *w; 2515 const struct snd_pci_quirk *w;
2516 2516
@@ -2535,8 +2535,8 @@ static int __devinit check_dxs_list(struct pci_dev *pci, int revision)
2535 return VIA_DXS_48K; 2535 return VIA_DXS_48K;
2536}; 2536};
2537 2537
2538static int __devinit snd_via82xx_probe(struct pci_dev *pci, 2538static int snd_via82xx_probe(struct pci_dev *pci,
2539 const struct pci_device_id *pci_id) 2539 const struct pci_device_id *pci_id)
2540{ 2540{
2541 struct snd_card *card; 2541 struct snd_card *card;
2542 struct via82xx *chip; 2542 struct via82xx *chip;
@@ -2643,7 +2643,7 @@ static int __devinit snd_via82xx_probe(struct pci_dev *pci,
2643 return err; 2643 return err;
2644} 2644}
2645 2645
2646static void __devexit snd_via82xx_remove(struct pci_dev *pci) 2646static void snd_via82xx_remove(struct pci_dev *pci)
2647{ 2647{
2648 snd_card_free(pci_get_drvdata(pci)); 2648 snd_card_free(pci_get_drvdata(pci));
2649 pci_set_drvdata(pci, NULL); 2649 pci_set_drvdata(pci, NULL);
@@ -2653,7 +2653,7 @@ static struct pci_driver via82xx_driver = {
2653 .name = KBUILD_MODNAME, 2653 .name = KBUILD_MODNAME,
2654 .id_table = snd_via82xx_ids, 2654 .id_table = snd_via82xx_ids,
2655 .probe = snd_via82xx_probe, 2655 .probe = snd_via82xx_probe,
2656 .remove = __devexit_p(snd_via82xx_remove), 2656 .remove = snd_via82xx_remove,
2657 .driver = { 2657 .driver = {
2658 .pm = SND_VIA82XX_PM_OPS, 2658 .pm = SND_VIA82XX_PM_OPS,
2659 }, 2659 },
diff --git a/sound/pci/via82xx_modem.c b/sound/pci/via82xx_modem.c
index 8e0efc416f22..4f5fd80b7e56 100644
--- a/sound/pci/via82xx_modem.c
+++ b/sound/pci/via82xx_modem.c
@@ -836,7 +836,7 @@ static void init_viadev(struct via82xx_modem *chip, int idx, unsigned int reg_of
836/* 836/*
837 * create a pcm instance for via686a/b 837 * create a pcm instance for via686a/b
838 */ 838 */
839static int __devinit snd_via686_pcm_new(struct via82xx_modem *chip) 839static int snd_via686_pcm_new(struct via82xx_modem *chip)
840{ 840{
841 struct snd_pcm *pcm; 841 struct snd_pcm *pcm;
842 int err; 842 int err;
@@ -885,7 +885,7 @@ static void snd_via82xx_mixer_free_ac97(struct snd_ac97 *ac97)
885} 885}
886 886
887 887
888static int __devinit snd_via82xx_mixer_new(struct via82xx_modem *chip) 888static int snd_via82xx_mixer_new(struct via82xx_modem *chip)
889{ 889{
890 struct snd_ac97_template ac97; 890 struct snd_ac97_template ac97;
891 int err; 891 int err;
@@ -928,7 +928,7 @@ static void snd_via82xx_proc_read(struct snd_info_entry *entry, struct snd_info_
928 } 928 }
929} 929}
930 930
931static void __devinit snd_via82xx_proc_init(struct via82xx_modem *chip) 931static void snd_via82xx_proc_init(struct via82xx_modem *chip)
932{ 932{
933 struct snd_info_entry *entry; 933 struct snd_info_entry *entry;
934 934
@@ -1103,12 +1103,12 @@ static int snd_via82xx_dev_free(struct snd_device *device)
1103 return snd_via82xx_free(chip); 1103 return snd_via82xx_free(chip);
1104} 1104}
1105 1105
1106static int __devinit snd_via82xx_create(struct snd_card *card, 1106static int snd_via82xx_create(struct snd_card *card,
1107 struct pci_dev *pci, 1107 struct pci_dev *pci,
1108 int chip_type, 1108 int chip_type,
1109 int revision, 1109 int revision,
1110 unsigned int ac97_clock, 1110 unsigned int ac97_clock,
1111 struct via82xx_modem ** r_via) 1111 struct via82xx_modem **r_via)
1112{ 1112{
1113 struct via82xx_modem *chip; 1113 struct via82xx_modem *chip;
1114 int err; 1114 int err;
@@ -1168,8 +1168,8 @@ static int __devinit snd_via82xx_create(struct snd_card *card,
1168} 1168}
1169 1169
1170 1170
1171static int __devinit snd_via82xx_probe(struct pci_dev *pci, 1171static int snd_via82xx_probe(struct pci_dev *pci,
1172 const struct pci_device_id *pci_id) 1172 const struct pci_device_id *pci_id)
1173{ 1173{
1174 struct snd_card *card; 1174 struct snd_card *card;
1175 struct via82xx_modem *chip; 1175 struct via82xx_modem *chip;
@@ -1224,7 +1224,7 @@ static int __devinit snd_via82xx_probe(struct pci_dev *pci,
1224 return err; 1224 return err;
1225} 1225}
1226 1226
1227static void __devexit snd_via82xx_remove(struct pci_dev *pci) 1227static void snd_via82xx_remove(struct pci_dev *pci)
1228{ 1228{
1229 snd_card_free(pci_get_drvdata(pci)); 1229 snd_card_free(pci_get_drvdata(pci));
1230 pci_set_drvdata(pci, NULL); 1230 pci_set_drvdata(pci, NULL);
@@ -1234,7 +1234,7 @@ static struct pci_driver via82xx_modem_driver = {
1234 .name = KBUILD_MODNAME, 1234 .name = KBUILD_MODNAME,
1235 .id_table = snd_via82xx_modem_ids, 1235 .id_table = snd_via82xx_modem_ids,
1236 .probe = snd_via82xx_probe, 1236 .probe = snd_via82xx_probe,
1237 .remove = __devexit_p(snd_via82xx_remove), 1237 .remove = snd_via82xx_remove,
1238 .driver = { 1238 .driver = {
1239 .pm = SND_VIA82XX_PM_OPS, 1239 .pm = SND_VIA82XX_PM_OPS,
1240 }, 1240 },
diff --git a/sound/pci/vx222/vx222.c b/sound/pci/vx222/vx222.c
index fdfbaf857233..e2f1ab37e154 100644
--- a/sound/pci/vx222/vx222.c
+++ b/sound/pci/vx222/vx222.c
@@ -134,9 +134,9 @@ static int snd_vx222_dev_free(struct snd_device *device)
134} 134}
135 135
136 136
137static int __devinit snd_vx222_create(struct snd_card *card, struct pci_dev *pci, 137static int snd_vx222_create(struct snd_card *card, struct pci_dev *pci,
138 struct snd_vx_hardware *hw, 138 struct snd_vx_hardware *hw,
139 struct snd_vx222 **rchip) 139 struct snd_vx222 **rchip)
140{ 140{
141 struct vx_core *chip; 141 struct vx_core *chip;
142 struct snd_vx222 *vx; 142 struct snd_vx222 *vx;
@@ -188,8 +188,8 @@ static int __devinit snd_vx222_create(struct snd_card *card, struct pci_dev *pci
188} 188}
189 189
190 190
191static int __devinit snd_vx222_probe(struct pci_dev *pci, 191static int snd_vx222_probe(struct pci_dev *pci,
192 const struct pci_device_id *pci_id) 192 const struct pci_device_id *pci_id)
193{ 193{
194 static int dev; 194 static int dev;
195 struct snd_card *card; 195 struct snd_card *card;
@@ -251,7 +251,7 @@ static int __devinit snd_vx222_probe(struct pci_dev *pci,
251 return 0; 251 return 0;
252} 252}
253 253
254static void __devexit snd_vx222_remove(struct pci_dev *pci) 254static void snd_vx222_remove(struct pci_dev *pci)
255{ 255{
256 snd_card_free(pci_get_drvdata(pci)); 256 snd_card_free(pci_get_drvdata(pci));
257 pci_set_drvdata(pci, NULL); 257 pci_set_drvdata(pci, NULL);
@@ -300,7 +300,7 @@ static struct pci_driver vx222_driver = {
300 .name = KBUILD_MODNAME, 300 .name = KBUILD_MODNAME,
301 .id_table = snd_vx222_ids, 301 .id_table = snd_vx222_ids,
302 .probe = snd_vx222_probe, 302 .probe = snd_vx222_probe,
303 .remove = __devexit_p(snd_vx222_remove), 303 .remove = snd_vx222_remove,
304 .driver = { 304 .driver = {
305 .pm = SND_VX222_PM_OPS, 305 .pm = SND_VX222_PM_OPS,
306 }, 306 },
diff --git a/sound/pci/ymfpci/ymfpci.c b/sound/pci/ymfpci/ymfpci.c
index e01fe34db9ec..01c49655a3c1 100644
--- a/sound/pci/ymfpci/ymfpci.c
+++ b/sound/pci/ymfpci/ymfpci.c
@@ -79,8 +79,8 @@ static DEFINE_PCI_DEVICE_TABLE(snd_ymfpci_ids) = {
79MODULE_DEVICE_TABLE(pci, snd_ymfpci_ids); 79MODULE_DEVICE_TABLE(pci, snd_ymfpci_ids);
80 80
81#ifdef SUPPORT_JOYSTICK 81#ifdef SUPPORT_JOYSTICK
82static int __devinit snd_ymfpci_create_gameport(struct snd_ymfpci *chip, int dev, 82static int snd_ymfpci_create_gameport(struct snd_ymfpci *chip, int dev,
83 int legacy_ctrl, int legacy_ctrl2) 83 int legacy_ctrl, int legacy_ctrl2)
84{ 84{
85 struct gameport *gp; 85 struct gameport *gp;
86 struct resource *r = NULL; 86 struct resource *r = NULL;
@@ -167,8 +167,8 @@ static inline int snd_ymfpci_create_gameport(struct snd_ymfpci *chip, int dev, i
167void snd_ymfpci_free_gameport(struct snd_ymfpci *chip) { } 167void snd_ymfpci_free_gameport(struct snd_ymfpci *chip) { }
168#endif /* SUPPORT_JOYSTICK */ 168#endif /* SUPPORT_JOYSTICK */
169 169
170static int __devinit snd_card_ymfpci_probe(struct pci_dev *pci, 170static int snd_card_ymfpci_probe(struct pci_dev *pci,
171 const struct pci_device_id *pci_id) 171 const struct pci_device_id *pci_id)
172{ 172{
173 static int dev; 173 static int dev;
174 struct snd_card *card; 174 struct snd_card *card;
@@ -344,7 +344,7 @@ static int __devinit snd_card_ymfpci_probe(struct pci_dev *pci,
344 return 0; 344 return 0;
345} 345}
346 346
347static void __devexit snd_card_ymfpci_remove(struct pci_dev *pci) 347static void snd_card_ymfpci_remove(struct pci_dev *pci)
348{ 348{
349 snd_card_free(pci_get_drvdata(pci)); 349 snd_card_free(pci_get_drvdata(pci));
350 pci_set_drvdata(pci, NULL); 350 pci_set_drvdata(pci, NULL);
@@ -354,7 +354,7 @@ static struct pci_driver ymfpci_driver = {
354 .name = KBUILD_MODNAME, 354 .name = KBUILD_MODNAME,
355 .id_table = snd_ymfpci_ids, 355 .id_table = snd_ymfpci_ids,
356 .probe = snd_card_ymfpci_probe, 356 .probe = snd_card_ymfpci_probe,
357 .remove = __devexit_p(snd_card_ymfpci_remove), 357 .remove = snd_card_ymfpci_remove,
358#ifdef CONFIG_PM_SLEEP 358#ifdef CONFIG_PM_SLEEP
359 .driver = { 359 .driver = {
360 .pm = &snd_ymfpci_pm, 360 .pm = &snd_ymfpci_pm,
diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c
index 3a6f03f9b02f..22056c50fe39 100644
--- a/sound/pci/ymfpci/ymfpci_main.c
+++ b/sound/pci/ymfpci/ymfpci_main.c
@@ -25,7 +25,6 @@
25#include <linux/pci.h> 25#include <linux/pci.h>
26#include <linux/sched.h> 26#include <linux/sched.h>
27#include <linux/slab.h> 27#include <linux/slab.h>
28#include <linux/vmalloc.h>
29#include <linux/mutex.h> 28#include <linux/mutex.h>
30#include <linux/module.h> 29#include <linux/module.h>
31 30
@@ -598,7 +597,7 @@ static void snd_ymfpci_pcm_init_voice(struct snd_ymfpci_pcm *ypcm, unsigned int
598 } 597 }
599} 598}
600 599
601static int __devinit snd_ymfpci_ac3_init(struct snd_ymfpci *chip) 600static int snd_ymfpci_ac3_init(struct snd_ymfpci *chip)
602{ 601{
603 if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(chip->pci), 602 if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(chip->pci),
604 4096, &chip->ac3_tmp_base) < 0) 603 4096, &chip->ac3_tmp_base) < 0)
@@ -1144,7 +1143,7 @@ static struct snd_pcm_ops snd_ymfpci_capture_rec_ops = {
1144 .pointer = snd_ymfpci_capture_pointer, 1143 .pointer = snd_ymfpci_capture_pointer,
1145}; 1144};
1146 1145
1147int __devinit snd_ymfpci_pcm(struct snd_ymfpci *chip, int device, struct snd_pcm ** rpcm) 1146int snd_ymfpci_pcm(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm)
1148{ 1147{
1149 struct snd_pcm *pcm; 1148 struct snd_pcm *pcm;
1150 int err; 1149 int err;
@@ -1187,7 +1186,7 @@ static struct snd_pcm_ops snd_ymfpci_capture_ac97_ops = {
1187 .pointer = snd_ymfpci_capture_pointer, 1186 .pointer = snd_ymfpci_capture_pointer,
1188}; 1187};
1189 1188
1190int __devinit snd_ymfpci_pcm2(struct snd_ymfpci *chip, int device, struct snd_pcm ** rpcm) 1189int snd_ymfpci_pcm2(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm)
1191{ 1190{
1192 struct snd_pcm *pcm; 1191 struct snd_pcm *pcm;
1193 int err; 1192 int err;
@@ -1225,7 +1224,8 @@ static struct snd_pcm_ops snd_ymfpci_playback_spdif_ops = {
1225 .pointer = snd_ymfpci_playback_pointer, 1224 .pointer = snd_ymfpci_playback_pointer,
1226}; 1225};
1227 1226
1228int __devinit snd_ymfpci_pcm_spdif(struct snd_ymfpci *chip, int device, struct snd_pcm ** rpcm) 1227int snd_ymfpci_pcm_spdif(struct snd_ymfpci *chip, int device,
1228 struct snd_pcm **rpcm)
1229{ 1229{
1230 struct snd_pcm *pcm; 1230 struct snd_pcm *pcm;
1231 int err; 1231 int err;
@@ -1270,7 +1270,8 @@ static const struct snd_pcm_chmap_elem surround_map[] = {
1270 { } 1270 { }
1271}; 1271};
1272 1272
1273int __devinit snd_ymfpci_pcm_4ch(struct snd_ymfpci *chip, int device, struct snd_pcm ** rpcm) 1273int snd_ymfpci_pcm_4ch(struct snd_ymfpci *chip, int device,
1274 struct snd_pcm **rpcm)
1274{ 1275{
1275 struct snd_pcm *pcm; 1276 struct snd_pcm *pcm;
1276 int err; 1277 int err;
@@ -1339,7 +1340,7 @@ static int snd_ymfpci_spdif_default_put(struct snd_kcontrol *kcontrol,
1339 return change; 1340 return change;
1340} 1341}
1341 1342
1342static struct snd_kcontrol_new snd_ymfpci_spdif_default __devinitdata = 1343static struct snd_kcontrol_new snd_ymfpci_spdif_default =
1343{ 1344{
1344 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 1345 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
1345 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT), 1346 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT),
@@ -1367,7 +1368,7 @@ static int snd_ymfpci_spdif_mask_get(struct snd_kcontrol *kcontrol,
1367 return 0; 1368 return 0;
1368} 1369}
1369 1370
1370static struct snd_kcontrol_new snd_ymfpci_spdif_mask __devinitdata = 1371static struct snd_kcontrol_new snd_ymfpci_spdif_mask =
1371{ 1372{
1372 .access = SNDRV_CTL_ELEM_ACCESS_READ, 1373 .access = SNDRV_CTL_ELEM_ACCESS_READ,
1373 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 1374 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
@@ -1414,7 +1415,7 @@ static int snd_ymfpci_spdif_stream_put(struct snd_kcontrol *kcontrol,
1414 return change; 1415 return change;
1415} 1416}
1416 1417
1417static struct snd_kcontrol_new snd_ymfpci_spdif_stream __devinitdata = 1418static struct snd_kcontrol_new snd_ymfpci_spdif_stream =
1418{ 1419{
1419 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_INACTIVE, 1420 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_INACTIVE,
1420 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 1421 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
@@ -1462,7 +1463,7 @@ static int snd_ymfpci_drec_source_put(struct snd_kcontrol *kcontrol, struct snd_
1462 return reg != old_reg; 1463 return reg != old_reg;
1463} 1464}
1464 1465
1465static struct snd_kcontrol_new snd_ymfpci_drec_source __devinitdata = { 1466static struct snd_kcontrol_new snd_ymfpci_drec_source = {
1466 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, 1467 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
1467 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1468 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1468 .name = "Direct Recording Source", 1469 .name = "Direct Recording Source",
@@ -1632,7 +1633,7 @@ static int snd_ymfpci_put_dup4ch(struct snd_kcontrol *kcontrol, struct snd_ctl_e
1632 return change; 1633 return change;
1633} 1634}
1634 1635
1635static struct snd_kcontrol_new snd_ymfpci_dup4ch __devinitdata = { 1636static struct snd_kcontrol_new snd_ymfpci_dup4ch = {
1636 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1637 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1637 .name = "4ch Duplication", 1638 .name = "4ch Duplication",
1638 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, 1639 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
@@ -1641,7 +1642,7 @@ static struct snd_kcontrol_new snd_ymfpci_dup4ch __devinitdata = {
1641 .put = snd_ymfpci_put_dup4ch, 1642 .put = snd_ymfpci_put_dup4ch,
1642}; 1643};
1643 1644
1644static struct snd_kcontrol_new snd_ymfpci_controls[] __devinitdata = { 1645static struct snd_kcontrol_new snd_ymfpci_controls[] = {
1645{ 1646{
1646 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1647 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1647 .name = "Wave Playback Volume", 1648 .name = "Wave Playback Volume",
@@ -1735,7 +1736,7 @@ static int snd_ymfpci_gpio_sw_put(struct snd_kcontrol *kcontrol, struct snd_ctl_
1735 return 0; 1736 return 0;
1736} 1737}
1737 1738
1738static struct snd_kcontrol_new snd_ymfpci_rear_shared __devinitdata = { 1739static struct snd_kcontrol_new snd_ymfpci_rear_shared = {
1739 .name = "Shared Rear/Line-In Switch", 1740 .name = "Shared Rear/Line-In Switch",
1740 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1741 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1741 .info = snd_ymfpci_gpio_sw_info, 1742 .info = snd_ymfpci_gpio_sw_info,
@@ -1799,7 +1800,7 @@ static int snd_ymfpci_pcm_vol_put(struct snd_kcontrol *kcontrol,
1799 return 0; 1800 return 0;
1800} 1801}
1801 1802
1802static struct snd_kcontrol_new snd_ymfpci_pcm_volume __devinitdata = { 1803static struct snd_kcontrol_new snd_ymfpci_pcm_volume = {
1803 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 1804 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
1804 .name = "PCM Playback Volume", 1805 .name = "PCM Playback Volume",
1805 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | 1806 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE |
@@ -1826,7 +1827,7 @@ static void snd_ymfpci_mixer_free_ac97(struct snd_ac97 *ac97)
1826 chip->ac97 = NULL; 1827 chip->ac97 = NULL;
1827} 1828}
1828 1829
1829int __devinit snd_ymfpci_mixer(struct snd_ymfpci *chip, int rear_switch) 1830int snd_ymfpci_mixer(struct snd_ymfpci *chip, int rear_switch)
1830{ 1831{
1831 struct snd_ac97_template ac97; 1832 struct snd_ac97_template ac97;
1832 struct snd_kcontrol *kctl; 1833 struct snd_kcontrol *kctl;
@@ -1970,7 +1971,7 @@ static struct snd_timer_hardware snd_ymfpci_timer_hw = {
1970 .precise_resolution = snd_ymfpci_timer_precise_resolution, 1971 .precise_resolution = snd_ymfpci_timer_precise_resolution,
1971}; 1972};
1972 1973
1973int __devinit snd_ymfpci_timer(struct snd_ymfpci *chip, int device) 1974int snd_ymfpci_timer(struct snd_ymfpci *chip, int device)
1974{ 1975{
1975 struct snd_timer *timer = NULL; 1976 struct snd_timer *timer = NULL;
1976 struct snd_timer_id tid; 1977 struct snd_timer_id tid;
@@ -2006,7 +2007,7 @@ static void snd_ymfpci_proc_read(struct snd_info_entry *entry,
2006 snd_iprintf(buffer, "%04x: %04x\n", i, snd_ymfpci_readl(chip, i)); 2007 snd_iprintf(buffer, "%04x: %04x\n", i, snd_ymfpci_readl(chip, i));
2007} 2008}
2008 2009
2009static int __devinit snd_ymfpci_proc_init(struct snd_card *card, struct snd_ymfpci *chip) 2010static int snd_ymfpci_proc_init(struct snd_card *card, struct snd_ymfpci *chip)
2010{ 2011{
2011 struct snd_info_entry *entry; 2012 struct snd_info_entry *entry;
2012 2013
@@ -2128,7 +2129,7 @@ static void snd_ymfpci_download_image(struct snd_ymfpci *chip)
2128 snd_ymfpci_enable_dsp(chip); 2129 snd_ymfpci_enable_dsp(chip);
2129} 2130}
2130 2131
2131static int __devinit snd_ymfpci_memalloc(struct snd_ymfpci *chip) 2132static int snd_ymfpci_memalloc(struct snd_ymfpci *chip)
2132{ 2133{
2133 long size, playback_ctrl_size; 2134 long size, playback_ctrl_size;
2134 int voice, bank, reg; 2135 int voice, bank, reg;
@@ -2261,7 +2262,7 @@ static int snd_ymfpci_free(struct snd_ymfpci *chip)
2261#endif 2262#endif
2262 2263
2263#ifdef CONFIG_PM_SLEEP 2264#ifdef CONFIG_PM_SLEEP
2264 vfree(chip->saved_regs); 2265 kfree(chip->saved_regs);
2265#endif 2266#endif
2266 if (chip->irq >= 0) 2267 if (chip->irq >= 0)
2267 free_irq(chip->irq, chip); 2268 free_irq(chip->irq, chip);
@@ -2394,10 +2395,10 @@ static int snd_ymfpci_resume(struct device *dev)
2394SIMPLE_DEV_PM_OPS(snd_ymfpci_pm, snd_ymfpci_suspend, snd_ymfpci_resume); 2395SIMPLE_DEV_PM_OPS(snd_ymfpci_pm, snd_ymfpci_suspend, snd_ymfpci_resume);
2395#endif /* CONFIG_PM_SLEEP */ 2396#endif /* CONFIG_PM_SLEEP */
2396 2397
2397int __devinit snd_ymfpci_create(struct snd_card *card, 2398int snd_ymfpci_create(struct snd_card *card,
2398 struct pci_dev * pci, 2399 struct pci_dev *pci,
2399 unsigned short old_legacy_ctrl, 2400 unsigned short old_legacy_ctrl,
2400 struct snd_ymfpci ** rchip) 2401 struct snd_ymfpci **rchip)
2401{ 2402{
2402 struct snd_ymfpci *chip; 2403 struct snd_ymfpci *chip;
2403 int err; 2404 int err;
@@ -2471,7 +2472,8 @@ int __devinit snd_ymfpci_create(struct snd_card *card,
2471 } 2472 }
2472 2473
2473#ifdef CONFIG_PM_SLEEP 2474#ifdef CONFIG_PM_SLEEP
2474 chip->saved_regs = vmalloc(YDSXGR_NUM_SAVED_REGS * sizeof(u32)); 2475 chip->saved_regs = kmalloc(YDSXGR_NUM_SAVED_REGS * sizeof(u32),
2476 GFP_KERNEL);
2475 if (chip->saved_regs == NULL) { 2477 if (chip->saved_regs == NULL) {
2476 snd_ymfpci_free(chip); 2478 snd_ymfpci_free(chip);
2477 return -ENOMEM; 2479 return -ENOMEM;
diff --git a/sound/ppc/awacs.c b/sound/ppc/awacs.c
index b36679384b27..5fbf5db2543d 100644
--- a/sound/ppc/awacs.c
+++ b/sound/ppc/awacs.c
@@ -477,7 +477,7 @@ static int snd_pmac_awacs_put_master_amp(struct snd_kcontrol *kcontrol,
477#define AMP_CH_SPK 0 477#define AMP_CH_SPK 0
478#define AMP_CH_HD 1 478#define AMP_CH_HD 1
479 479
480static struct snd_kcontrol_new snd_pmac_awacs_amp_vol[] __devinitdata = { 480static struct snd_kcontrol_new snd_pmac_awacs_amp_vol[] = {
481 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 481 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
482 .name = "Speaker Playback Volume", 482 .name = "Speaker Playback Volume",
483 .info = snd_pmac_awacs_info_volume_amp, 483 .info = snd_pmac_awacs_info_volume_amp,
@@ -514,7 +514,7 @@ static struct snd_kcontrol_new snd_pmac_awacs_amp_vol[] __devinitdata = {
514 }, 514 },
515}; 515};
516 516
517static struct snd_kcontrol_new snd_pmac_awacs_amp_hp_sw __devinitdata = { 517static struct snd_kcontrol_new snd_pmac_awacs_amp_hp_sw = {
518 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 518 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
519 .name = "Headphone Playback Switch", 519 .name = "Headphone Playback Switch",
520 .info = snd_pmac_boolean_stereo_info, 520 .info = snd_pmac_boolean_stereo_info,
@@ -523,7 +523,7 @@ static struct snd_kcontrol_new snd_pmac_awacs_amp_hp_sw __devinitdata = {
523 .private_value = AMP_CH_HD, 523 .private_value = AMP_CH_HD,
524}; 524};
525 525
526static struct snd_kcontrol_new snd_pmac_awacs_amp_spk_sw __devinitdata = { 526static struct snd_kcontrol_new snd_pmac_awacs_amp_spk_sw = {
527 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 527 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
528 .name = "Speaker Playback Switch", 528 .name = "Speaker Playback Switch",
529 .info = snd_pmac_boolean_stereo_info, 529 .info = snd_pmac_boolean_stereo_info,
@@ -595,46 +595,46 @@ static int snd_pmac_screamer_mic_boost_put(struct snd_kcontrol *kcontrol,
595/* 595/*
596 * lists of mixer elements 596 * lists of mixer elements
597 */ 597 */
598static struct snd_kcontrol_new snd_pmac_awacs_mixers[] __devinitdata = { 598static struct snd_kcontrol_new snd_pmac_awacs_mixers[] = {
599 AWACS_SWITCH("Master Capture Switch", 1, SHIFT_LOOPTHRU, 0), 599 AWACS_SWITCH("Master Capture Switch", 1, SHIFT_LOOPTHRU, 0),
600 AWACS_VOLUME("Master Capture Volume", 0, 4, 0), 600 AWACS_VOLUME("Master Capture Volume", 0, 4, 0),
601/* AWACS_SWITCH("Unknown Playback Switch", 6, SHIFT_PAROUT0, 0), */ 601/* AWACS_SWITCH("Unknown Playback Switch", 6, SHIFT_PAROUT0, 0), */
602}; 602};
603 603
604static struct snd_kcontrol_new snd_pmac_screamer_mixers_beige[] __devinitdata = { 604static struct snd_kcontrol_new snd_pmac_screamer_mixers_beige[] = {
605 AWACS_VOLUME("Master Playback Volume", 2, 6, 1), 605 AWACS_VOLUME("Master Playback Volume", 2, 6, 1),
606 AWACS_VOLUME("Play-through Playback Volume", 5, 6, 1), 606 AWACS_VOLUME("Play-through Playback Volume", 5, 6, 1),
607 AWACS_SWITCH("Line Capture Switch", 0, SHIFT_MUX_MIC, 0), 607 AWACS_SWITCH("Line Capture Switch", 0, SHIFT_MUX_MIC, 0),
608 AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_LINE, 0), 608 AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_LINE, 0),
609}; 609};
610 610
611static struct snd_kcontrol_new snd_pmac_screamer_mixers_lo[] __devinitdata = { 611static struct snd_kcontrol_new snd_pmac_screamer_mixers_lo[] = {
612 AWACS_VOLUME("Line out Playback Volume", 2, 6, 1), 612 AWACS_VOLUME("Line out Playback Volume", 2, 6, 1),
613}; 613};
614 614
615static struct snd_kcontrol_new snd_pmac_screamer_mixers_imac[] __devinitdata = { 615static struct snd_kcontrol_new snd_pmac_screamer_mixers_imac[] = {
616 AWACS_VOLUME("Play-through Playback Volume", 5, 6, 1), 616 AWACS_VOLUME("Play-through Playback Volume", 5, 6, 1),
617 AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_CD, 0), 617 AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_CD, 0),
618}; 618};
619 619
620static struct snd_kcontrol_new snd_pmac_screamer_mixers_g4agp[] __devinitdata = { 620static struct snd_kcontrol_new snd_pmac_screamer_mixers_g4agp[] = {
621 AWACS_VOLUME("Line out Playback Volume", 2, 6, 1), 621 AWACS_VOLUME("Line out Playback Volume", 2, 6, 1),
622 AWACS_VOLUME("Master Playback Volume", 5, 6, 1), 622 AWACS_VOLUME("Master Playback Volume", 5, 6, 1),
623 AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_CD, 0), 623 AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_CD, 0),
624 AWACS_SWITCH("Line Capture Switch", 0, SHIFT_MUX_MIC, 0), 624 AWACS_SWITCH("Line Capture Switch", 0, SHIFT_MUX_MIC, 0),
625}; 625};
626 626
627static struct snd_kcontrol_new snd_pmac_awacs_mixers_pmac7500[] __devinitdata = { 627static struct snd_kcontrol_new snd_pmac_awacs_mixers_pmac7500[] = {
628 AWACS_VOLUME("Line out Playback Volume", 2, 6, 1), 628 AWACS_VOLUME("Line out Playback Volume", 2, 6, 1),
629 AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_CD, 0), 629 AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_CD, 0),
630 AWACS_SWITCH("Line Capture Switch", 0, SHIFT_MUX_MIC, 0), 630 AWACS_SWITCH("Line Capture Switch", 0, SHIFT_MUX_MIC, 0),
631}; 631};
632 632
633static struct snd_kcontrol_new snd_pmac_awacs_mixers_pmac5500[] __devinitdata = { 633static struct snd_kcontrol_new snd_pmac_awacs_mixers_pmac5500[] = {
634 AWACS_VOLUME("Headphone Playback Volume", 2, 6, 1), 634 AWACS_VOLUME("Headphone Playback Volume", 2, 6, 1),
635}; 635};
636 636
637static struct snd_kcontrol_new snd_pmac_awacs_mixers_pmac[] __devinitdata = { 637static struct snd_kcontrol_new snd_pmac_awacs_mixers_pmac[] = {
638 AWACS_VOLUME("Master Playback Volume", 2, 6, 1), 638 AWACS_VOLUME("Master Playback Volume", 2, 6, 1),
639 AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_CD, 0), 639 AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_CD, 0),
640}; 640};
@@ -642,34 +642,34 @@ static struct snd_kcontrol_new snd_pmac_awacs_mixers_pmac[] __devinitdata = {
642/* FIXME: is this correct order? 642/* FIXME: is this correct order?
643 * screamer (powerbook G3 pismo) seems to have different bits... 643 * screamer (powerbook G3 pismo) seems to have different bits...
644 */ 644 */
645static struct snd_kcontrol_new snd_pmac_awacs_mixers2[] __devinitdata = { 645static struct snd_kcontrol_new snd_pmac_awacs_mixers2[] = {
646 AWACS_SWITCH("Line Capture Switch", 0, SHIFT_MUX_LINE, 0), 646 AWACS_SWITCH("Line Capture Switch", 0, SHIFT_MUX_LINE, 0),
647 AWACS_SWITCH("Mic Capture Switch", 0, SHIFT_MUX_MIC, 0), 647 AWACS_SWITCH("Mic Capture Switch", 0, SHIFT_MUX_MIC, 0),
648}; 648};
649 649
650static struct snd_kcontrol_new snd_pmac_screamer_mixers2[] __devinitdata = { 650static struct snd_kcontrol_new snd_pmac_screamer_mixers2[] = {
651 AWACS_SWITCH("Line Capture Switch", 0, SHIFT_MUX_MIC, 0), 651 AWACS_SWITCH("Line Capture Switch", 0, SHIFT_MUX_MIC, 0),
652 AWACS_SWITCH("Mic Capture Switch", 0, SHIFT_MUX_LINE, 0), 652 AWACS_SWITCH("Mic Capture Switch", 0, SHIFT_MUX_LINE, 0),
653}; 653};
654 654
655static struct snd_kcontrol_new snd_pmac_awacs_mixers2_pmac5500[] __devinitdata = { 655static struct snd_kcontrol_new snd_pmac_awacs_mixers2_pmac5500[] = {
656 AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_CD, 0), 656 AWACS_SWITCH("CD Capture Switch", 0, SHIFT_MUX_CD, 0),
657}; 657};
658 658
659static struct snd_kcontrol_new snd_pmac_awacs_master_sw __devinitdata = 659static struct snd_kcontrol_new snd_pmac_awacs_master_sw =
660AWACS_SWITCH("Master Playback Switch", 1, SHIFT_HDMUTE, 1); 660AWACS_SWITCH("Master Playback Switch", 1, SHIFT_HDMUTE, 1);
661 661
662static struct snd_kcontrol_new snd_pmac_awacs_master_sw_imac __devinitdata = 662static struct snd_kcontrol_new snd_pmac_awacs_master_sw_imac =
663AWACS_SWITCH("Line out Playback Switch", 1, SHIFT_HDMUTE, 1); 663AWACS_SWITCH("Line out Playback Switch", 1, SHIFT_HDMUTE, 1);
664 664
665static struct snd_kcontrol_new snd_pmac_awacs_master_sw_pmac5500 __devinitdata = 665static struct snd_kcontrol_new snd_pmac_awacs_master_sw_pmac5500 =
666AWACS_SWITCH("Headphone Playback Switch", 1, SHIFT_HDMUTE, 1); 666AWACS_SWITCH("Headphone Playback Switch", 1, SHIFT_HDMUTE, 1);
667 667
668static struct snd_kcontrol_new snd_pmac_awacs_mic_boost[] __devinitdata = { 668static struct snd_kcontrol_new snd_pmac_awacs_mic_boost[] = {
669 AWACS_SWITCH("Mic Boost Capture Switch", 0, SHIFT_GAINLINE, 0), 669 AWACS_SWITCH("Mic Boost Capture Switch", 0, SHIFT_GAINLINE, 0),
670}; 670};
671 671
672static struct snd_kcontrol_new snd_pmac_screamer_mic_boost[] __devinitdata = { 672static struct snd_kcontrol_new snd_pmac_screamer_mic_boost[] = {
673 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 673 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
674 .name = "Mic Boost Capture Volume", 674 .name = "Mic Boost Capture Volume",
675 .info = snd_pmac_screamer_mic_boost_info, 675 .info = snd_pmac_screamer_mic_boost_info,
@@ -678,34 +678,34 @@ static struct snd_kcontrol_new snd_pmac_screamer_mic_boost[] __devinitdata = {
678 }, 678 },
679}; 679};
680 680
681static struct snd_kcontrol_new snd_pmac_awacs_mic_boost_pmac7500[] __devinitdata = 681static struct snd_kcontrol_new snd_pmac_awacs_mic_boost_pmac7500[] =
682{ 682{
683 AWACS_SWITCH("Line Boost Capture Switch", 0, SHIFT_GAINLINE, 0), 683 AWACS_SWITCH("Line Boost Capture Switch", 0, SHIFT_GAINLINE, 0),
684}; 684};
685 685
686static struct snd_kcontrol_new snd_pmac_screamer_mic_boost_beige[] __devinitdata = 686static struct snd_kcontrol_new snd_pmac_screamer_mic_boost_beige[] =
687{ 687{
688 AWACS_SWITCH("Line Boost Capture Switch", 0, SHIFT_GAINLINE, 0), 688 AWACS_SWITCH("Line Boost Capture Switch", 0, SHIFT_GAINLINE, 0),
689 AWACS_SWITCH("CD Boost Capture Switch", 6, SHIFT_MIC_BOOST, 0), 689 AWACS_SWITCH("CD Boost Capture Switch", 6, SHIFT_MIC_BOOST, 0),
690}; 690};
691 691
692static struct snd_kcontrol_new snd_pmac_screamer_mic_boost_imac[] __devinitdata = 692static struct snd_kcontrol_new snd_pmac_screamer_mic_boost_imac[] =
693{ 693{
694 AWACS_SWITCH("Line Boost Capture Switch", 0, SHIFT_GAINLINE, 0), 694 AWACS_SWITCH("Line Boost Capture Switch", 0, SHIFT_GAINLINE, 0),
695 AWACS_SWITCH("Mic Boost Capture Switch", 6, SHIFT_MIC_BOOST, 0), 695 AWACS_SWITCH("Mic Boost Capture Switch", 6, SHIFT_MIC_BOOST, 0),
696}; 696};
697 697
698static struct snd_kcontrol_new snd_pmac_awacs_speaker_vol[] __devinitdata = { 698static struct snd_kcontrol_new snd_pmac_awacs_speaker_vol[] = {
699 AWACS_VOLUME("Speaker Playback Volume", 4, 6, 1), 699 AWACS_VOLUME("Speaker Playback Volume", 4, 6, 1),
700}; 700};
701 701
702static struct snd_kcontrol_new snd_pmac_awacs_speaker_sw __devinitdata = 702static struct snd_kcontrol_new snd_pmac_awacs_speaker_sw =
703AWACS_SWITCH("Speaker Playback Switch", 1, SHIFT_SPKMUTE, 1); 703AWACS_SWITCH("Speaker Playback Switch", 1, SHIFT_SPKMUTE, 1);
704 704
705static struct snd_kcontrol_new snd_pmac_awacs_speaker_sw_imac1 __devinitdata = 705static struct snd_kcontrol_new snd_pmac_awacs_speaker_sw_imac1 =
706AWACS_SWITCH("Speaker Playback Switch", 1, SHIFT_PAROUT1, 1); 706AWACS_SWITCH("Speaker Playback Switch", 1, SHIFT_PAROUT1, 1);
707 707
708static struct snd_kcontrol_new snd_pmac_awacs_speaker_sw_imac2 __devinitdata = 708static struct snd_kcontrol_new snd_pmac_awacs_speaker_sw_imac2 =
709AWACS_SWITCH("Speaker Playback Switch", 1, SHIFT_PAROUT1, 0); 709AWACS_SWITCH("Speaker Playback Switch", 1, SHIFT_PAROUT1, 0);
710 710
711 711
@@ -872,7 +872,7 @@ static void snd_pmac_awacs_update_automute(struct snd_pmac *chip, int do_notify)
872/* 872/*
873 * initialize chip 873 * initialize chip
874 */ 874 */
875int __devinit 875int
876snd_pmac_awacs_init(struct snd_pmac *chip) 876snd_pmac_awacs_init(struct snd_pmac *chip)
877{ 877{
878 int pm7500 = IS_PM7500; 878 int pm7500 = IS_PM7500;
diff --git a/sound/ppc/beep.c b/sound/ppc/beep.c
index a9d350789f55..0040f048221f 100644
--- a/sound/ppc/beep.c
+++ b/sound/ppc/beep.c
@@ -215,7 +215,7 @@ static struct snd_kcontrol_new snd_pmac_beep_mixer = {
215}; 215};
216 216
217/* Initialize beep stuff */ 217/* Initialize beep stuff */
218int __devinit snd_pmac_attach_beep(struct snd_pmac *chip) 218int snd_pmac_attach_beep(struct snd_pmac *chip)
219{ 219{
220 struct pmac_beep *beep; 220 struct pmac_beep *beep;
221 struct input_dev *input_dev; 221 struct input_dev *input_dev;
diff --git a/sound/ppc/burgundy.c b/sound/ppc/burgundy.c
index 00e2d5166d0a..cb4f0a5e984e 100644
--- a/sound/ppc/burgundy.c
+++ b/sound/ppc/burgundy.c
@@ -467,7 +467,7 @@ static int snd_pmac_burgundy_put_switch_b(struct snd_kcontrol *kcontrol,
467/* 467/*
468 * Burgundy mixers 468 * Burgundy mixers
469 */ 469 */
470static struct snd_kcontrol_new snd_pmac_burgundy_mixers[] __devinitdata = { 470static struct snd_kcontrol_new snd_pmac_burgundy_mixers[] = {
471 BURGUNDY_VOLUME_W("Master Playback Volume", 0, 471 BURGUNDY_VOLUME_W("Master Playback Volume", 0,
472 MASK_ADDR_BURGUNDY_MASTER_VOLUME, 8), 472 MASK_ADDR_BURGUNDY_MASTER_VOLUME, 8),
473 BURGUNDY_VOLUME_W("CD Capture Volume", 0, 473 BURGUNDY_VOLUME_W("CD Capture Volume", 0,
@@ -495,7 +495,7 @@ static struct snd_kcontrol_new snd_pmac_burgundy_mixers[] __devinitdata = {
495 */ BURGUNDY_SWITCH_B("PCM Capture Switch", 0, 495 */ BURGUNDY_SWITCH_B("PCM Capture Switch", 0,
496 MASK_ADDR_BURGUNDY_HOSTIFEH, 0x01, 0, 0) 496 MASK_ADDR_BURGUNDY_HOSTIFEH, 0x01, 0, 0)
497}; 497};
498static struct snd_kcontrol_new snd_pmac_burgundy_mixers_imac[] __devinitdata = { 498static struct snd_kcontrol_new snd_pmac_burgundy_mixers_imac[] = {
499 BURGUNDY_VOLUME_W("Line in Capture Volume", 0, 499 BURGUNDY_VOLUME_W("Line in Capture Volume", 0,
500 MASK_ADDR_BURGUNDY_VOLLINE, 16), 500 MASK_ADDR_BURGUNDY_VOLLINE, 16),
501 BURGUNDY_VOLUME_W("Mic Capture Volume", 0, 501 BURGUNDY_VOLUME_W("Mic Capture Volume", 0,
@@ -521,7 +521,7 @@ static struct snd_kcontrol_new snd_pmac_burgundy_mixers_imac[] __devinitdata = {
521 BURGUNDY_SWITCH_B("Mic Boost Capture Switch", 0, 521 BURGUNDY_SWITCH_B("Mic Boost Capture Switch", 0,
522 MASK_ADDR_BURGUNDY_INPBOOST, 0x40, 0x80, 1) 522 MASK_ADDR_BURGUNDY_INPBOOST, 0x40, 0x80, 1)
523}; 523};
524static struct snd_kcontrol_new snd_pmac_burgundy_mixers_pmac[] __devinitdata = { 524static struct snd_kcontrol_new snd_pmac_burgundy_mixers_pmac[] = {
525 BURGUNDY_VOLUME_W("Line in Capture Volume", 0, 525 BURGUNDY_VOLUME_W("Line in Capture Volume", 0,
526 MASK_ADDR_BURGUNDY_VOLMIC, 16), 526 MASK_ADDR_BURGUNDY_VOLMIC, 16),
527 BURGUNDY_VOLUME_B("Line in Gain Capture Volume", 0, 527 BURGUNDY_VOLUME_B("Line in Gain Capture Volume", 0,
@@ -537,33 +537,33 @@ static struct snd_kcontrol_new snd_pmac_burgundy_mixers_pmac[] __devinitdata = {
537/* BURGUNDY_SWITCH_B("Line in Boost Capture Switch", 0, 537/* BURGUNDY_SWITCH_B("Line in Boost Capture Switch", 0,
538 * MASK_ADDR_BURGUNDY_INPBOOST, 0x40, 0x80, 1) */ 538 * MASK_ADDR_BURGUNDY_INPBOOST, 0x40, 0x80, 1) */
539}; 539};
540static struct snd_kcontrol_new snd_pmac_burgundy_master_sw_imac __devinitdata = 540static struct snd_kcontrol_new snd_pmac_burgundy_master_sw_imac =
541BURGUNDY_SWITCH_B("Master Playback Switch", 0, 541BURGUNDY_SWITCH_B("Master Playback Switch", 0,
542 MASK_ADDR_BURGUNDY_MORE_OUTPUTENABLES, 542 MASK_ADDR_BURGUNDY_MORE_OUTPUTENABLES,
543 BURGUNDY_OUTPUT_LEFT | BURGUNDY_LINEOUT_LEFT | BURGUNDY_HP_LEFT, 543 BURGUNDY_OUTPUT_LEFT | BURGUNDY_LINEOUT_LEFT | BURGUNDY_HP_LEFT,
544 BURGUNDY_OUTPUT_RIGHT | BURGUNDY_LINEOUT_RIGHT | BURGUNDY_HP_RIGHT, 1); 544 BURGUNDY_OUTPUT_RIGHT | BURGUNDY_LINEOUT_RIGHT | BURGUNDY_HP_RIGHT, 1);
545static struct snd_kcontrol_new snd_pmac_burgundy_master_sw_pmac __devinitdata = 545static struct snd_kcontrol_new snd_pmac_burgundy_master_sw_pmac =
546BURGUNDY_SWITCH_B("Master Playback Switch", 0, 546BURGUNDY_SWITCH_B("Master Playback Switch", 0,
547 MASK_ADDR_BURGUNDY_MORE_OUTPUTENABLES, 547 MASK_ADDR_BURGUNDY_MORE_OUTPUTENABLES,
548 BURGUNDY_OUTPUT_INTERN 548 BURGUNDY_OUTPUT_INTERN
549 | BURGUNDY_OUTPUT_LEFT, BURGUNDY_OUTPUT_RIGHT, 1); 549 | BURGUNDY_OUTPUT_LEFT, BURGUNDY_OUTPUT_RIGHT, 1);
550static struct snd_kcontrol_new snd_pmac_burgundy_speaker_sw_imac __devinitdata = 550static struct snd_kcontrol_new snd_pmac_burgundy_speaker_sw_imac =
551BURGUNDY_SWITCH_B("Speaker Playback Switch", 0, 551BURGUNDY_SWITCH_B("Speaker Playback Switch", 0,
552 MASK_ADDR_BURGUNDY_MORE_OUTPUTENABLES, 552 MASK_ADDR_BURGUNDY_MORE_OUTPUTENABLES,
553 BURGUNDY_OUTPUT_LEFT, BURGUNDY_OUTPUT_RIGHT, 1); 553 BURGUNDY_OUTPUT_LEFT, BURGUNDY_OUTPUT_RIGHT, 1);
554static struct snd_kcontrol_new snd_pmac_burgundy_speaker_sw_pmac __devinitdata = 554static struct snd_kcontrol_new snd_pmac_burgundy_speaker_sw_pmac =
555BURGUNDY_SWITCH_B("Speaker Playback Switch", 0, 555BURGUNDY_SWITCH_B("Speaker Playback Switch", 0,
556 MASK_ADDR_BURGUNDY_MORE_OUTPUTENABLES, 556 MASK_ADDR_BURGUNDY_MORE_OUTPUTENABLES,
557 BURGUNDY_OUTPUT_INTERN, 0, 0); 557 BURGUNDY_OUTPUT_INTERN, 0, 0);
558static struct snd_kcontrol_new snd_pmac_burgundy_line_sw_imac __devinitdata = 558static struct snd_kcontrol_new snd_pmac_burgundy_line_sw_imac =
559BURGUNDY_SWITCH_B("Line out Playback Switch", 0, 559BURGUNDY_SWITCH_B("Line out Playback Switch", 0,
560 MASK_ADDR_BURGUNDY_MORE_OUTPUTENABLES, 560 MASK_ADDR_BURGUNDY_MORE_OUTPUTENABLES,
561 BURGUNDY_LINEOUT_LEFT, BURGUNDY_LINEOUT_RIGHT, 1); 561 BURGUNDY_LINEOUT_LEFT, BURGUNDY_LINEOUT_RIGHT, 1);
562static struct snd_kcontrol_new snd_pmac_burgundy_line_sw_pmac __devinitdata = 562static struct snd_kcontrol_new snd_pmac_burgundy_line_sw_pmac =
563BURGUNDY_SWITCH_B("Line out Playback Switch", 0, 563BURGUNDY_SWITCH_B("Line out Playback Switch", 0,
564 MASK_ADDR_BURGUNDY_MORE_OUTPUTENABLES, 564 MASK_ADDR_BURGUNDY_MORE_OUTPUTENABLES,
565 BURGUNDY_OUTPUT_LEFT, BURGUNDY_OUTPUT_RIGHT, 1); 565 BURGUNDY_OUTPUT_LEFT, BURGUNDY_OUTPUT_RIGHT, 1);
566static struct snd_kcontrol_new snd_pmac_burgundy_hp_sw_imac __devinitdata = 566static struct snd_kcontrol_new snd_pmac_burgundy_hp_sw_imac =
567BURGUNDY_SWITCH_B("Headphone Playback Switch", 0, 567BURGUNDY_SWITCH_B("Headphone Playback Switch", 0,
568 MASK_ADDR_BURGUNDY_MORE_OUTPUTENABLES, 568 MASK_ADDR_BURGUNDY_MORE_OUTPUTENABLES,
569 BURGUNDY_HP_LEFT, BURGUNDY_HP_RIGHT, 1); 569 BURGUNDY_HP_LEFT, BURGUNDY_HP_RIGHT, 1);
@@ -617,7 +617,7 @@ static void snd_pmac_burgundy_update_automute(struct snd_pmac *chip, int do_noti
617/* 617/*
618 * initialize burgundy 618 * initialize burgundy
619 */ 619 */
620int __devinit snd_pmac_burgundy_init(struct snd_pmac *chip) 620int snd_pmac_burgundy_init(struct snd_pmac *chip)
621{ 621{
622 int imac = of_machine_is_compatible("iMac"); 622 int imac = of_machine_is_compatible("iMac");
623 int i, err; 623 int i, err;
diff --git a/sound/ppc/daca.c b/sound/ppc/daca.c
index 24200b7bdace..b86526223e4e 100644
--- a/sound/ppc/daca.c
+++ b/sound/ppc/daca.c
@@ -244,7 +244,7 @@ static void daca_cleanup(struct snd_pmac *chip)
244} 244}
245 245
246/* exported */ 246/* exported */
247int __devinit snd_pmac_daca_init(struct snd_pmac *chip) 247int snd_pmac_daca_init(struct snd_pmac *chip)
248{ 248{
249 int i, err; 249 int i, err;
250 struct pmac_daca *mix; 250 struct pmac_daca *mix;
diff --git a/sound/ppc/keywest.c b/sound/ppc/keywest.c
index 4080becf4cef..01aecc2b5073 100644
--- a/sound/ppc/keywest.c
+++ b/sound/ppc/keywest.c
@@ -115,7 +115,7 @@ void snd_pmac_keywest_cleanup(struct pmac_keywest *i2c)
115 } 115 }
116} 116}
117 117
118int __devinit snd_pmac_tumbler_post_init(void) 118int snd_pmac_tumbler_post_init(void)
119{ 119{
120 int err; 120 int err;
121 121
@@ -130,7 +130,7 @@ int __devinit snd_pmac_tumbler_post_init(void)
130} 130}
131 131
132/* exported */ 132/* exported */
133int __devinit snd_pmac_keywest_init(struct pmac_keywest *i2c) 133int snd_pmac_keywest_init(struct pmac_keywest *i2c)
134{ 134{
135 int err; 135 int err;
136 136
diff --git a/sound/ppc/pmac.c b/sound/ppc/pmac.c
index ab96cde7417b..c93fbbb201fe 100644
--- a/sound/ppc/pmac.c
+++ b/sound/ppc/pmac.c
@@ -702,7 +702,7 @@ static struct snd_pcm_ops snd_pmac_capture_ops = {
702 .pointer = snd_pmac_capture_pointer, 702 .pointer = snd_pmac_capture_pointer,
703}; 703};
704 704
705int __devinit snd_pmac_pcm_new(struct snd_pmac *chip) 705int snd_pmac_pcm_new(struct snd_pmac *chip)
706{ 706{
707 struct snd_pcm *pcm; 707 struct snd_pcm *pcm;
708 int err; 708 int err;
@@ -907,7 +907,7 @@ static int snd_pmac_dev_free(struct snd_device *device)
907 * check the machine support byteswap (little-endian) 907 * check the machine support byteswap (little-endian)
908 */ 908 */
909 909
910static void __devinit detect_byte_swap(struct snd_pmac *chip) 910static void detect_byte_swap(struct snd_pmac *chip)
911{ 911{
912 struct device_node *mio; 912 struct device_node *mio;
913 913
@@ -933,7 +933,7 @@ static void __devinit detect_byte_swap(struct snd_pmac *chip)
933/* 933/*
934 * detect a sound chip 934 * detect a sound chip
935 */ 935 */
936static int __devinit snd_pmac_detect(struct snd_pmac *chip) 936static int snd_pmac_detect(struct snd_pmac *chip)
937{ 937{
938 struct device_node *sound; 938 struct device_node *sound;
939 struct device_node *dn; 939 struct device_node *dn;
@@ -1146,7 +1146,7 @@ static int pmac_hp_detect_get(struct snd_kcontrol *kcontrol,
1146 return 0; 1146 return 0;
1147} 1147}
1148 1148
1149static struct snd_kcontrol_new auto_mute_controls[] __devinitdata = { 1149static struct snd_kcontrol_new auto_mute_controls[] = {
1150 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1150 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1151 .name = "Auto Mute Switch", 1151 .name = "Auto Mute Switch",
1152 .info = snd_pmac_boolean_mono_info, 1152 .info = snd_pmac_boolean_mono_info,
@@ -1161,7 +1161,7 @@ static struct snd_kcontrol_new auto_mute_controls[] __devinitdata = {
1161 }, 1161 },
1162}; 1162};
1163 1163
1164int __devinit snd_pmac_add_automute(struct snd_pmac *chip) 1164int snd_pmac_add_automute(struct snd_pmac *chip)
1165{ 1165{
1166 int err; 1166 int err;
1167 chip->auto_mute = 1; 1167 chip->auto_mute = 1;
@@ -1178,7 +1178,7 @@ int __devinit snd_pmac_add_automute(struct snd_pmac *chip)
1178/* 1178/*
1179 * create and detect a pmac chip record 1179 * create and detect a pmac chip record
1180 */ 1180 */
1181int __devinit snd_pmac_new(struct snd_card *card, struct snd_pmac **chip_return) 1181int snd_pmac_new(struct snd_card *card, struct snd_pmac **chip_return)
1182{ 1182{
1183 struct snd_pmac *chip; 1183 struct snd_pmac *chip;
1184 struct device_node *np; 1184 struct device_node *np;
diff --git a/sound/ppc/powermac.c b/sound/ppc/powermac.c
index 210cafe04890..09fc848d32ec 100644
--- a/sound/ppc/powermac.c
+++ b/sound/ppc/powermac.c
@@ -51,7 +51,7 @@ static struct platform_device *device;
51/* 51/*
52 */ 52 */
53 53
54static int __devinit snd_pmac_probe(struct platform_device *devptr) 54static int snd_pmac_probe(struct platform_device *devptr)
55{ 55{
56 struct snd_card *card; 56 struct snd_card *card;
57 struct snd_pmac *chip; 57 struct snd_pmac *chip;
@@ -136,7 +136,7 @@ __error:
136} 136}
137 137
138 138
139static int __devexit snd_pmac_remove(struct platform_device *devptr) 139static int snd_pmac_remove(struct platform_device *devptr)
140{ 140{
141 snd_card_free(platform_get_drvdata(devptr)); 141 snd_card_free(platform_get_drvdata(devptr));
142 platform_set_drvdata(devptr, NULL); 142 platform_set_drvdata(devptr, NULL);
@@ -168,7 +168,7 @@ static SIMPLE_DEV_PM_OPS(snd_pmac_pm, snd_pmac_driver_suspend, snd_pmac_driver_r
168 168
169static struct platform_driver snd_pmac_driver = { 169static struct platform_driver snd_pmac_driver = {
170 .probe = snd_pmac_probe, 170 .probe = snd_pmac_probe,
171 .remove = __devexit_p(snd_pmac_remove), 171 .remove = snd_pmac_remove,
172 .driver = { 172 .driver = {
173 .name = SND_PMAC_DRIVER, 173 .name = SND_PMAC_DRIVER,
174 .owner = THIS_MODULE, 174 .owner = THIS_MODULE,
diff --git a/sound/ppc/snd_ps3.c b/sound/ppc/snd_ps3.c
index 9b18b5243a56..8c7dcbe0118d 100644
--- a/sound/ppc/snd_ps3.c
+++ b/sound/ppc/snd_ps3.c
@@ -786,7 +786,7 @@ static struct snd_pcm_ops snd_ps3_pcm_spdif_ops = {
786}; 786};
787 787
788 788
789static int __devinit snd_ps3_map_mmio(void) 789static int snd_ps3_map_mmio(void)
790{ 790{
791 the_card.mapped_mmio_vaddr = 791 the_card.mapped_mmio_vaddr =
792 ioremap(the_card.ps3_dev->m_region->bus_addr, 792 ioremap(the_card.ps3_dev->m_region->bus_addr,
@@ -808,7 +808,7 @@ static void snd_ps3_unmap_mmio(void)
808 the_card.mapped_mmio_vaddr = NULL; 808 the_card.mapped_mmio_vaddr = NULL;
809} 809}
810 810
811static int __devinit snd_ps3_allocate_irq(void) 811static int snd_ps3_allocate_irq(void)
812{ 812{
813 int ret; 813 int ret;
814 u64 lpar_addr, lpar_size; 814 u64 lpar_addr, lpar_size;
@@ -866,7 +866,7 @@ static void snd_ps3_free_irq(void)
866 ps3_irq_plug_destroy(the_card.irq_no); 866 ps3_irq_plug_destroy(the_card.irq_no);
867} 867}
868 868
869static void __devinit snd_ps3_audio_set_base_addr(uint64_t ioaddr_start) 869static void snd_ps3_audio_set_base_addr(uint64_t ioaddr_start)
870{ 870{
871 uint64_t val; 871 uint64_t val;
872 int ret; 872 int ret;
@@ -882,7 +882,7 @@ static void __devinit snd_ps3_audio_set_base_addr(uint64_t ioaddr_start)
882 ret); 882 ret);
883} 883}
884 884
885static void __devinit snd_ps3_audio_fixup(struct snd_ps3_card_info *card) 885static void snd_ps3_audio_fixup(struct snd_ps3_card_info *card)
886{ 886{
887 /* 887 /*
888 * avsetting driver seems to never change the followings 888 * avsetting driver seems to never change the followings
@@ -906,7 +906,7 @@ static void __devinit snd_ps3_audio_fixup(struct snd_ps3_card_info *card)
906 PS3_AUDIO_AO_3WMCTRL_ASOPLRCK_DEFAULT); 906 PS3_AUDIO_AO_3WMCTRL_ASOPLRCK_DEFAULT);
907} 907}
908 908
909static int __devinit snd_ps3_init_avsetting(struct snd_ps3_card_info *card) 909static int snd_ps3_init_avsetting(struct snd_ps3_card_info *card)
910{ 910{
911 int ret; 911 int ret;
912 pr_debug("%s: start\n", __func__); 912 pr_debug("%s: start\n", __func__);
@@ -928,7 +928,7 @@ static int __devinit snd_ps3_init_avsetting(struct snd_ps3_card_info *card)
928 return ret; 928 return ret;
929} 929}
930 930
931static int __devinit snd_ps3_driver_probe(struct ps3_system_bus_device *dev) 931static int snd_ps3_driver_probe(struct ps3_system_bus_device *dev)
932{ 932{
933 int i, ret; 933 int i, ret;
934 u64 lpar_addr, lpar_size; 934 u64 lpar_addr, lpar_size;
diff --git a/sound/ppc/tumbler.c b/sound/ppc/tumbler.c
index 9cea84c3e0c6..b23354a4ceca 100644
--- a/sound/ppc/tumbler.c
+++ b/sound/ppc/tumbler.c
@@ -844,7 +844,7 @@ static int snapper_put_capture_source(struct snd_kcontrol *kcontrol,
844 844
845/* 845/*
846 */ 846 */
847static struct snd_kcontrol_new tumbler_mixers[] __devinitdata = { 847static struct snd_kcontrol_new tumbler_mixers[] = {
848 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 848 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
849 .name = "Master Playback Volume", 849 .name = "Master Playback Volume",
850 .info = tumbler_info_master_volume, 850 .info = tumbler_info_master_volume,
@@ -868,7 +868,7 @@ static struct snd_kcontrol_new tumbler_mixers[] __devinitdata = {
868 }, 868 },
869}; 869};
870 870
871static struct snd_kcontrol_new snapper_mixers[] __devinitdata = { 871static struct snd_kcontrol_new snapper_mixers[] = {
872 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 872 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
873 .name = "Master Playback Volume", 873 .name = "Master Playback Volume",
874 .info = tumbler_info_master_volume, 874 .info = tumbler_info_master_volume,
@@ -901,7 +901,7 @@ static struct snd_kcontrol_new snapper_mixers[] __devinitdata = {
901 }, 901 },
902}; 902};
903 903
904static struct snd_kcontrol_new tumbler_hp_sw __devinitdata = { 904static struct snd_kcontrol_new tumbler_hp_sw = {
905 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 905 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
906 .name = "Headphone Playback Switch", 906 .name = "Headphone Playback Switch",
907 .info = snd_pmac_boolean_mono_info, 907 .info = snd_pmac_boolean_mono_info,
@@ -909,7 +909,7 @@ static struct snd_kcontrol_new tumbler_hp_sw __devinitdata = {
909 .put = tumbler_put_mute_switch, 909 .put = tumbler_put_mute_switch,
910 .private_value = TUMBLER_MUTE_HP, 910 .private_value = TUMBLER_MUTE_HP,
911}; 911};
912static struct snd_kcontrol_new tumbler_speaker_sw __devinitdata = { 912static struct snd_kcontrol_new tumbler_speaker_sw = {
913 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 913 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
914 .name = "Speaker Playback Switch", 914 .name = "Speaker Playback Switch",
915 .info = snd_pmac_boolean_mono_info, 915 .info = snd_pmac_boolean_mono_info,
@@ -917,7 +917,7 @@ static struct snd_kcontrol_new tumbler_speaker_sw __devinitdata = {
917 .put = tumbler_put_mute_switch, 917 .put = tumbler_put_mute_switch,
918 .private_value = TUMBLER_MUTE_AMP, 918 .private_value = TUMBLER_MUTE_AMP,
919}; 919};
920static struct snd_kcontrol_new tumbler_lineout_sw __devinitdata = { 920static struct snd_kcontrol_new tumbler_lineout_sw = {
921 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 921 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
922 .name = "Line Out Playback Switch", 922 .name = "Line Out Playback Switch",
923 .info = snd_pmac_boolean_mono_info, 923 .info = snd_pmac_boolean_mono_info,
@@ -925,7 +925,7 @@ static struct snd_kcontrol_new tumbler_lineout_sw __devinitdata = {
925 .put = tumbler_put_mute_switch, 925 .put = tumbler_put_mute_switch,
926 .private_value = TUMBLER_MUTE_LINE, 926 .private_value = TUMBLER_MUTE_LINE,
927}; 927};
928static struct snd_kcontrol_new tumbler_drc_sw __devinitdata = { 928static struct snd_kcontrol_new tumbler_drc_sw = {
929 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 929 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
930 .name = "DRC Switch", 930 .name = "DRC Switch",
931 .info = snd_pmac_boolean_mono_info, 931 .info = snd_pmac_boolean_mono_info,
@@ -1276,7 +1276,7 @@ static void tumbler_resume(struct snd_pmac *chip)
1276#endif 1276#endif
1277 1277
1278/* initialize tumbler */ 1278/* initialize tumbler */
1279static int __devinit tumbler_init(struct snd_pmac *chip) 1279static int tumbler_init(struct snd_pmac *chip)
1280{ 1280{
1281 int irq; 1281 int irq;
1282 struct pmac_tumbler *mix = chip->mixer_data; 1282 struct pmac_tumbler *mix = chip->mixer_data;
@@ -1349,7 +1349,7 @@ static void tumbler_cleanup(struct snd_pmac *chip)
1349} 1349}
1350 1350
1351/* exported */ 1351/* exported */
1352int __devinit snd_pmac_tumbler_init(struct snd_pmac *chip) 1352int snd_pmac_tumbler_init(struct snd_pmac *chip)
1353{ 1353{
1354 int i, err; 1354 int i, err;
1355 struct pmac_tumbler *mix; 1355 struct pmac_tumbler *mix;
diff --git a/sound/sh/aica.c b/sound/sh/aica.c
index d48b523207eb..e59a73a9bc42 100644
--- a/sound/sh/aica.c
+++ b/sound/sh/aica.c
@@ -540,7 +540,7 @@ static int aica_pcmvolume_put(struct snd_kcontrol *kcontrol,
540 return 1; 540 return 1;
541} 541}
542 542
543static struct snd_kcontrol_new snd_aica_pcmswitch_control __devinitdata = { 543static struct snd_kcontrol_new snd_aica_pcmswitch_control = {
544 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 544 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
545 .name = "PCM Playback Switch", 545 .name = "PCM Playback Switch",
546 .index = 0, 546 .index = 0,
@@ -549,7 +549,7 @@ static struct snd_kcontrol_new snd_aica_pcmswitch_control __devinitdata = {
549 .put = aica_pcmswitch_put 549 .put = aica_pcmswitch_put
550}; 550};
551 551
552static struct snd_kcontrol_new snd_aica_pcmvolume_control __devinitdata = { 552static struct snd_kcontrol_new snd_aica_pcmvolume_control = {
553 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 553 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
554 .name = "PCM Playback Volume", 554 .name = "PCM Playback Volume",
555 .index = 0, 555 .index = 0,
@@ -574,8 +574,7 @@ static int load_aica_firmware(void)
574 return err; 574 return err;
575} 575}
576 576
577static int __devinit add_aicamixer_controls(struct snd_card_aica 577static int add_aicamixer_controls(struct snd_card_aica *dreamcastcard)
578 *dreamcastcard)
579{ 578{
580 int err; 579 int err;
581 err = snd_ctl_add 580 err = snd_ctl_add
@@ -591,7 +590,7 @@ static int __devinit add_aicamixer_controls(struct snd_card_aica
591 return 0; 590 return 0;
592} 591}
593 592
594static int __devexit snd_aica_remove(struct platform_device *devptr) 593static int snd_aica_remove(struct platform_device *devptr)
595{ 594{
596 struct snd_card_aica *dreamcastcard; 595 struct snd_card_aica *dreamcastcard;
597 dreamcastcard = platform_get_drvdata(devptr); 596 dreamcastcard = platform_get_drvdata(devptr);
@@ -603,7 +602,7 @@ static int __devexit snd_aica_remove(struct platform_device *devptr)
603 return 0; 602 return 0;
604} 603}
605 604
606static int __devinit snd_aica_probe(struct platform_device *devptr) 605static int snd_aica_probe(struct platform_device *devptr)
607{ 606{
608 int err; 607 int err;
609 struct snd_card_aica *dreamcastcard; 608 struct snd_card_aica *dreamcastcard;
@@ -652,7 +651,7 @@ static int __devinit snd_aica_probe(struct platform_device *devptr)
652 651
653static struct platform_driver snd_aica_driver = { 652static struct platform_driver snd_aica_driver = {
654 .probe = snd_aica_probe, 653 .probe = snd_aica_probe,
655 .remove = __devexit_p(snd_aica_remove), 654 .remove = snd_aica_remove,
656 .driver = { 655 .driver = {
657 .name = SND_AICA_DRIVER, 656 .name = SND_AICA_DRIVER,
658 .owner = THIS_MODULE, 657 .owner = THIS_MODULE,
diff --git a/sound/sh/sh_dac_audio.c b/sound/sh/sh_dac_audio.c
index 0a3394751ed2..e68c4fc91a03 100644
--- a/sound/sh/sh_dac_audio.c
+++ b/sound/sh/sh_dac_audio.c
@@ -261,7 +261,7 @@ static struct snd_pcm_ops snd_sh_dac_pcm_ops = {
261 .mmap = snd_pcm_lib_mmap_iomem, 261 .mmap = snd_pcm_lib_mmap_iomem,
262}; 262};
263 263
264static int __devinit snd_sh_dac_pcm(struct snd_sh_dac *chip, int device) 264static int snd_sh_dac_pcm(struct snd_sh_dac *chip, int device)
265{ 265{
266 int err; 266 int err;
267 struct snd_pcm *pcm; 267 struct snd_pcm *pcm;
@@ -346,9 +346,9 @@ static enum hrtimer_restart sh_dac_audio_timer(struct hrtimer *handle)
346} 346}
347 347
348/* create -- chip-specific constructor for the cards components */ 348/* create -- chip-specific constructor for the cards components */
349static int __devinit snd_sh_dac_create(struct snd_card *card, 349static int snd_sh_dac_create(struct snd_card *card,
350 struct platform_device *devptr, 350 struct platform_device *devptr,
351 struct snd_sh_dac **rchip) 351 struct snd_sh_dac **rchip)
352{ 352{
353 struct snd_sh_dac *chip; 353 struct snd_sh_dac *chip;
354 int err; 354 int err;
@@ -392,7 +392,7 @@ static int __devinit snd_sh_dac_create(struct snd_card *card,
392} 392}
393 393
394/* driver .probe -- constructor */ 394/* driver .probe -- constructor */
395static int __devinit snd_sh_dac_probe(struct platform_device *devptr) 395static int snd_sh_dac_probe(struct platform_device *devptr)
396{ 396{
397 struct snd_sh_dac *chip; 397 struct snd_sh_dac *chip;
398 struct snd_card *card; 398 struct snd_card *card;
diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c
index adf397b9d0e6..1d8bb5917594 100644
--- a/sound/soc/codecs/arizona.c
+++ b/sound/soc/codecs/arizona.c
@@ -446,15 +446,9 @@ static int arizona_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
446 case SND_SOC_DAIFMT_DSP_A: 446 case SND_SOC_DAIFMT_DSP_A:
447 mode = 0; 447 mode = 0;
448 break; 448 break;
449 case SND_SOC_DAIFMT_DSP_B:
450 mode = 1;
451 break;
452 case SND_SOC_DAIFMT_I2S: 449 case SND_SOC_DAIFMT_I2S:
453 mode = 2; 450 mode = 2;
454 break; 451 break;
455 case SND_SOC_DAIFMT_LEFT_J:
456 mode = 3;
457 break;
458 default: 452 default:
459 arizona_aif_err(dai, "Unsupported DAI format %d\n", 453 arizona_aif_err(dai, "Unsupported DAI format %d\n",
460 fmt & SND_SOC_DAIFMT_FORMAT_MASK); 454 fmt & SND_SOC_DAIFMT_FORMAT_MASK);
@@ -714,7 +708,8 @@ static int arizona_hw_params(struct snd_pcm_substream *substream,
714 snd_soc_update_bits(codec, ARIZONA_ASYNC_SAMPLE_RATE_1, 708 snd_soc_update_bits(codec, ARIZONA_ASYNC_SAMPLE_RATE_1,
715 ARIZONA_ASYNC_SAMPLE_RATE_MASK, sr_val); 709 ARIZONA_ASYNC_SAMPLE_RATE_MASK, sr_val);
716 snd_soc_update_bits(codec, base + ARIZONA_AIF_RATE_CTRL, 710 snd_soc_update_bits(codec, base + ARIZONA_AIF_RATE_CTRL,
717 ARIZONA_AIF1_RATE_MASK, 8); 711 ARIZONA_AIF1_RATE_MASK,
712 8 << ARIZONA_AIF1_RATE_SHIFT);
718 break; 713 break;
719 default: 714 default:
720 arizona_aif_err(dai, "Invalid clock %d\n", dai_priv->clk); 715 arizona_aif_err(dai, "Invalid clock %d\n", dai_priv->clk);
diff --git a/sound/soc/codecs/arizona.h b/sound/soc/codecs/arizona.h
index 41dae1ed3b71..4deebeb07177 100644
--- a/sound/soc/codecs/arizona.h
+++ b/sound/soc/codecs/arizona.h
@@ -34,15 +34,15 @@
34 34
35#define ARIZONA_FLL_SRC_MCLK1 0 35#define ARIZONA_FLL_SRC_MCLK1 0
36#define ARIZONA_FLL_SRC_MCLK2 1 36#define ARIZONA_FLL_SRC_MCLK2 1
37#define ARIZONA_FLL_SRC_SLIMCLK 2 37#define ARIZONA_FLL_SRC_SLIMCLK 3
38#define ARIZONA_FLL_SRC_FLL1 3 38#define ARIZONA_FLL_SRC_FLL1 4
39#define ARIZONA_FLL_SRC_FLL2 4 39#define ARIZONA_FLL_SRC_FLL2 5
40#define ARIZONA_FLL_SRC_AIF1BCLK 5 40#define ARIZONA_FLL_SRC_AIF1BCLK 8
41#define ARIZONA_FLL_SRC_AIF2BCLK 6 41#define ARIZONA_FLL_SRC_AIF2BCLK 9
42#define ARIZONA_FLL_SRC_AIF3BCLK 7 42#define ARIZONA_FLL_SRC_AIF3BCLK 10
43#define ARIZONA_FLL_SRC_AIF1LRCLK 8 43#define ARIZONA_FLL_SRC_AIF1LRCLK 12
44#define ARIZONA_FLL_SRC_AIF2LRCLK 9 44#define ARIZONA_FLL_SRC_AIF2LRCLK 13
45#define ARIZONA_FLL_SRC_AIF3LRCLK 10 45#define ARIZONA_FLL_SRC_AIF3LRCLK 14
46 46
47#define ARIZONA_MIXER_VOL_MASK 0x00FE 47#define ARIZONA_MIXER_VOL_MASK 0x00FE
48#define ARIZONA_MIXER_VOL_SHIFT 1 48#define ARIZONA_MIXER_VOL_SHIFT 1
diff --git a/sound/soc/codecs/cs4271.c b/sound/soc/codecs/cs4271.c
index 4f1127935fdf..ac8742a1f25a 100644
--- a/sound/soc/codecs/cs4271.c
+++ b/sound/soc/codecs/cs4271.c
@@ -474,16 +474,16 @@ static int cs4271_probe(struct snd_soc_codec *codec)
474 struct cs4271_platform_data *cs4271plat = codec->dev->platform_data; 474 struct cs4271_platform_data *cs4271plat = codec->dev->platform_data;
475 int ret; 475 int ret;
476 int gpio_nreset = -EINVAL; 476 int gpio_nreset = -EINVAL;
477 int amutec_eq_bmutec = 0; 477 bool amutec_eq_bmutec = false;
478 478
479#ifdef CONFIG_OF 479#ifdef CONFIG_OF
480 if (of_match_device(cs4271_dt_ids, codec->dev)) { 480 if (of_match_device(cs4271_dt_ids, codec->dev)) {
481 gpio_nreset = of_get_named_gpio(codec->dev->of_node, 481 gpio_nreset = of_get_named_gpio(codec->dev->of_node,
482 "reset-gpio", 0); 482 "reset-gpio", 0);
483 483
484 if (!of_get_property(codec->dev->of_node, 484 if (of_get_property(codec->dev->of_node,
485 "cirrus,amutec-eq-bmutec", NULL)) 485 "cirrus,amutec-eq-bmutec", NULL))
486 amutec_eq_bmutec = 1; 486 amutec_eq_bmutec = true;
487 } 487 }
488#endif 488#endif
489 489
diff --git a/sound/soc/codecs/cs42l52.c b/sound/soc/codecs/cs42l52.c
index 99bb1c69499e..9811a5478c87 100644
--- a/sound/soc/codecs/cs42l52.c
+++ b/sound/soc/codecs/cs42l52.c
@@ -737,7 +737,7 @@ static const struct cs42l52_clk_para clk_map_table[] = {
737 737
738static int cs42l52_get_clk(int mclk, int rate) 738static int cs42l52_get_clk(int mclk, int rate)
739{ 739{
740 int i, ret = 0; 740 int i, ret = -EINVAL;
741 u_int mclk1, mclk2 = 0; 741 u_int mclk1, mclk2 = 0;
742 742
743 for (i = 0; i < ARRAY_SIZE(clk_map_table); i++) { 743 for (i = 0; i < ARRAY_SIZE(clk_map_table); i++) {
@@ -749,8 +749,6 @@ static int cs42l52_get_clk(int mclk, int rate)
749 } 749 }
750 } 750 }
751 } 751 }
752 if (ret > ARRAY_SIZE(clk_map_table))
753 return -EINVAL;
754 return ret; 752 return ret;
755} 753}
756 754
diff --git a/sound/soc/codecs/lm49453.c b/sound/soc/codecs/lm49453.c
index d75257d40a49..e19490cfb3a8 100644
--- a/sound/soc/codecs/lm49453.c
+++ b/sound/soc/codecs/lm49453.c
@@ -111,9 +111,9 @@ static struct reg_default lm49453_reg_defs[] = {
111 { 101, 0x00 }, 111 { 101, 0x00 },
112 { 102, 0x00 }, 112 { 102, 0x00 },
113 { 103, 0x01 }, 113 { 103, 0x01 },
114 { 105, 0x01 }, 114 { 104, 0x01 },
115 { 106, 0x00 }, 115 { 105, 0x00 },
116 { 107, 0x01 }, 116 { 106, 0x01 },
117 { 107, 0x00 }, 117 { 107, 0x00 },
118 { 108, 0x00 }, 118 { 108, 0x00 },
119 { 109, 0x00 }, 119 { 109, 0x00 },
@@ -163,56 +163,25 @@ static struct reg_default lm49453_reg_defs[] = {
163 { 184, 0x00 }, 163 { 184, 0x00 },
164 { 185, 0x00 }, 164 { 185, 0x00 },
165 { 186, 0x00 }, 165 { 186, 0x00 },
166 { 189, 0x00 }, 166 { 187, 0x00 },
167 { 188, 0x00 }, 167 { 188, 0x00 },
168 { 194, 0x00 }, 168 { 189, 0x00 },
169 { 195, 0x00 }, 169 { 208, 0x06 },
170 { 196, 0x00 },
171 { 197, 0x00 },
172 { 200, 0x00 },
173 { 201, 0x00 },
174 { 202, 0x00 },
175 { 203, 0x00 },
176 { 204, 0x00 },
177 { 205, 0x00 },
178 { 208, 0x00 },
179 { 209, 0x00 }, 170 { 209, 0x00 },
180 { 210, 0x00 }, 171 { 210, 0x08 },
181 { 211, 0x00 }, 172 { 211, 0x54 },
182 { 213, 0x00 }, 173 { 212, 0x14 },
183 { 214, 0x00 }, 174 { 213, 0x0d },
184 { 215, 0x00 }, 175 { 214, 0x0d },
185 { 216, 0x00 }, 176 { 215, 0x14 },
186 { 217, 0x00 }, 177 { 216, 0x60 },
187 { 218, 0x00 },
188 { 219, 0x00 },
189 { 221, 0x00 }, 178 { 221, 0x00 },
190 { 222, 0x00 }, 179 { 222, 0x00 },
180 { 223, 0x00 },
191 { 224, 0x00 }, 181 { 224, 0x00 },
192 { 225, 0x00 },
193 { 226, 0x00 },
194 { 227, 0x00 },
195 { 228, 0x00 },
196 { 229, 0x00 },
197 { 230, 0x13 },
198 { 231, 0x00 },
199 { 232, 0x80 },
200 { 233, 0x0C },
201 { 234, 0xDD },
202 { 235, 0x00 },
203 { 236, 0x04 },
204 { 237, 0x00 },
205 { 238, 0x00 },
206 { 239, 0x00 },
207 { 240, 0x00 },
208 { 241, 0x00 },
209 { 242, 0x00 },
210 { 243, 0x00 },
211 { 244, 0x00 },
212 { 245, 0x00 },
213 { 248, 0x00 }, 182 { 248, 0x00 },
214 { 249, 0x00 }, 183 { 249, 0x00 },
215 { 254, 0x00 }, 184 { 250, 0x00 },
216 { 255, 0x00 }, 185 { 255, 0x00 },
217}; 186};
218 187
@@ -525,36 +494,41 @@ SOC_DAPM_SINGLE("Port2_2 Switch", LM49453_P0_PORT2_TX2_REG, 7, 1, 0),
525}; 494};
526 495
527/* TLV Declarations */ 496/* TLV Declarations */
528static const DECLARE_TLV_DB_SCALE(digital_tlv, -7650, 150, 1); 497static const DECLARE_TLV_DB_SCALE(adc_dac_tlv, -7650, 150, 1);
529static const DECLARE_TLV_DB_SCALE(port_tlv, 0, 600, 0); 498static const DECLARE_TLV_DB_SCALE(mic_tlv, 0, 200, 1);
499static const DECLARE_TLV_DB_SCALE(port_tlv, -1800, 600, 0);
500static const DECLARE_TLV_DB_SCALE(stn_tlv, -7200, 150, 0);
530 501
531static const struct snd_kcontrol_new lm49453_sidetone_mixer_controls[] = { 502static const struct snd_kcontrol_new lm49453_sidetone_mixer_controls[] = {
532/* Sidetone supports mono only */ 503/* Sidetone supports mono only */
533SOC_DAPM_SINGLE_TLV("Sidetone ADCL Volume", LM49453_P0_STN_VOL_ADCL_REG, 504SOC_DAPM_SINGLE_TLV("Sidetone ADCL Volume", LM49453_P0_STN_VOL_ADCL_REG,
534 0, 0x3F, 0, digital_tlv), 505 0, 0x3F, 0, stn_tlv),
535SOC_DAPM_SINGLE_TLV("Sidetone ADCR Volume", LM49453_P0_STN_VOL_ADCR_REG, 506SOC_DAPM_SINGLE_TLV("Sidetone ADCR Volume", LM49453_P0_STN_VOL_ADCR_REG,
536 0, 0x3F, 0, digital_tlv), 507 0, 0x3F, 0, stn_tlv),
537SOC_DAPM_SINGLE_TLV("Sidetone DMIC1L Volume", LM49453_P0_STN_VOL_DMIC1L_REG, 508SOC_DAPM_SINGLE_TLV("Sidetone DMIC1L Volume", LM49453_P0_STN_VOL_DMIC1L_REG,
538 0, 0x3F, 0, digital_tlv), 509 0, 0x3F, 0, stn_tlv),
539SOC_DAPM_SINGLE_TLV("Sidetone DMIC1R Volume", LM49453_P0_STN_VOL_DMIC1R_REG, 510SOC_DAPM_SINGLE_TLV("Sidetone DMIC1R Volume", LM49453_P0_STN_VOL_DMIC1R_REG,
540 0, 0x3F, 0, digital_tlv), 511 0, 0x3F, 0, stn_tlv),
541SOC_DAPM_SINGLE_TLV("Sidetone DMIC2L Volume", LM49453_P0_STN_VOL_DMIC2L_REG, 512SOC_DAPM_SINGLE_TLV("Sidetone DMIC2L Volume", LM49453_P0_STN_VOL_DMIC2L_REG,
542 0, 0x3F, 0, digital_tlv), 513 0, 0x3F, 0, stn_tlv),
543SOC_DAPM_SINGLE_TLV("Sidetone DMIC2R Volume", LM49453_P0_STN_VOL_DMIC2R_REG, 514SOC_DAPM_SINGLE_TLV("Sidetone DMIC2R Volume", LM49453_P0_STN_VOL_DMIC2R_REG,
544 0, 0x3F, 0, digital_tlv), 515 0, 0x3F, 0, stn_tlv),
545}; 516};
546 517
547static const struct snd_kcontrol_new lm49453_snd_controls[] = { 518static const struct snd_kcontrol_new lm49453_snd_controls[] = {
548 /* mic1 and mic2 supports mono only */ 519 /* mic1 and mic2 supports mono only */
549 SOC_SINGLE_TLV("Mic1 Volume", LM49453_P0_ADC_LEVELL_REG, 0, 6, 520 SOC_SINGLE_TLV("Mic1 Volume", LM49453_P0_MICL_REG, 0, 15, 0, mic_tlv),
550 0, digital_tlv), 521 SOC_SINGLE_TLV("Mic2 Volume", LM49453_P0_MICR_REG, 0, 15, 0, mic_tlv),
551 SOC_SINGLE_TLV("Mic2 Volume", LM49453_P0_ADC_LEVELR_REG, 0, 6, 522
552 0, digital_tlv), 523 SOC_SINGLE_TLV("ADCL Volume", LM49453_P0_ADC_LEVELL_REG, 0, 63,
524 0, adc_dac_tlv),
525 SOC_SINGLE_TLV("ADCR Volume", LM49453_P0_ADC_LEVELR_REG, 0, 63,
526 0, adc_dac_tlv),
553 527
554 SOC_DOUBLE_R_TLV("DMIC1 Volume", LM49453_P0_DMIC1_LEVELL_REG, 528 SOC_DOUBLE_R_TLV("DMIC1 Volume", LM49453_P0_DMIC1_LEVELL_REG,
555 LM49453_P0_DMIC1_LEVELR_REG, 0, 6, 0, digital_tlv), 529 LM49453_P0_DMIC1_LEVELR_REG, 0, 63, 0, adc_dac_tlv),
556 SOC_DOUBLE_R_TLV("DMIC2 Volume", LM49453_P0_DMIC2_LEVELL_REG, 530 SOC_DOUBLE_R_TLV("DMIC2 Volume", LM49453_P0_DMIC2_LEVELL_REG,
557 LM49453_P0_DMIC2_LEVELR_REG, 0, 6, 0, digital_tlv), 531 LM49453_P0_DMIC2_LEVELR_REG, 0, 63, 0, adc_dac_tlv),
558 532
559 SOC_DAPM_ENUM("Mic2Mode", lm49453_mic2mode_enum), 533 SOC_DAPM_ENUM("Mic2Mode", lm49453_mic2mode_enum),
560 SOC_DAPM_ENUM("DMIC12 SRC", lm49453_dmic12_cfg_enum), 534 SOC_DAPM_ENUM("DMIC12 SRC", lm49453_dmic12_cfg_enum),
@@ -569,16 +543,16 @@ static const struct snd_kcontrol_new lm49453_snd_controls[] = {
569 2, 1, 0), 543 2, 1, 0),
570 544
571 SOC_DOUBLE_R_TLV("DAC HP Volume", LM49453_P0_DAC_HP_LEVELL_REG, 545 SOC_DOUBLE_R_TLV("DAC HP Volume", LM49453_P0_DAC_HP_LEVELL_REG,
572 LM49453_P0_DAC_HP_LEVELR_REG, 0, 6, 0, digital_tlv), 546 LM49453_P0_DAC_HP_LEVELR_REG, 0, 63, 0, adc_dac_tlv),
573 SOC_DOUBLE_R_TLV("DAC LO Volume", LM49453_P0_DAC_LO_LEVELL_REG, 547 SOC_DOUBLE_R_TLV("DAC LO Volume", LM49453_P0_DAC_LO_LEVELL_REG,
574 LM49453_P0_DAC_LO_LEVELR_REG, 0, 6, 0, digital_tlv), 548 LM49453_P0_DAC_LO_LEVELR_REG, 0, 63, 0, adc_dac_tlv),
575 SOC_DOUBLE_R_TLV("DAC LS Volume", LM49453_P0_DAC_LS_LEVELL_REG, 549 SOC_DOUBLE_R_TLV("DAC LS Volume", LM49453_P0_DAC_LS_LEVELL_REG,
576 LM49453_P0_DAC_LS_LEVELR_REG, 0, 6, 0, digital_tlv), 550 LM49453_P0_DAC_LS_LEVELR_REG, 0, 63, 0, adc_dac_tlv),
577 SOC_DOUBLE_R_TLV("DAC HA Volume", LM49453_P0_DAC_HA_LEVELL_REG, 551 SOC_DOUBLE_R_TLV("DAC HA Volume", LM49453_P0_DAC_HA_LEVELL_REG,
578 LM49453_P0_DAC_HA_LEVELR_REG, 0, 6, 0, digital_tlv), 552 LM49453_P0_DAC_HA_LEVELR_REG, 0, 63, 0, adc_dac_tlv),
579 553
580 SOC_SINGLE_TLV("EP Volume", LM49453_P0_DAC_LS_LEVELL_REG, 554 SOC_SINGLE_TLV("EP Volume", LM49453_P0_DAC_LS_LEVELL_REG,
581 0, 6, 0, digital_tlv), 555 0, 63, 0, adc_dac_tlv),
582 556
583 SOC_SINGLE_TLV("PORT1_1_RX_LVL Volume", LM49453_P0_PORT1_RX_LVL1_REG, 557 SOC_SINGLE_TLV("PORT1_1_RX_LVL Volume", LM49453_P0_PORT1_RX_LVL1_REG,
584 0, 3, 0, port_tlv), 558 0, 3, 0, port_tlv),
@@ -1218,7 +1192,7 @@ static int lm49453_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
1218 } 1192 }
1219 1193
1220 snd_soc_update_bits(codec, LM49453_P0_AUDIO_PORT1_BASIC_REG, 1194 snd_soc_update_bits(codec, LM49453_P0_AUDIO_PORT1_BASIC_REG,
1221 LM49453_AUDIO_PORT1_BASIC_FMT_MASK|BIT(1)|BIT(5), 1195 LM49453_AUDIO_PORT1_BASIC_FMT_MASK|BIT(0)|BIT(5),
1222 (aif_val | mode | clk_phase)); 1196 (aif_val | mode | clk_phase));
1223 1197
1224 snd_soc_write(codec, LM49453_P0_AUDIO_PORT1_RX_MSB_REG, clk_shift); 1198 snd_soc_write(codec, LM49453_P0_AUDIO_PORT1_RX_MSB_REG, clk_shift);
diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c
index cb1675cd8e1c..92bbfec9b107 100644
--- a/sound/soc/codecs/sgtl5000.c
+++ b/sound/soc/codecs/sgtl5000.c
@@ -401,7 +401,7 @@ static const struct snd_kcontrol_new sgtl5000_snd_controls[] = {
401 5, 1, 0), 401 5, 1, 0),
402 402
403 SOC_SINGLE_TLV("Mic Volume", SGTL5000_CHIP_MIC_CTRL, 403 SOC_SINGLE_TLV("Mic Volume", SGTL5000_CHIP_MIC_CTRL,
404 0, 4, 0, mic_gain_tlv), 404 0, 3, 0, mic_gain_tlv),
405}; 405};
406 406
407/* mute the codec used by alsa core */ 407/* mute the codec used by alsa core */
@@ -1344,7 +1344,7 @@ static int sgtl5000_probe(struct snd_soc_codec *codec)
1344 SGTL5000_HP_ZCD_EN | 1344 SGTL5000_HP_ZCD_EN |
1345 SGTL5000_ADC_ZCD_EN); 1345 SGTL5000_ADC_ZCD_EN);
1346 1346
1347 snd_soc_write(codec, SGTL5000_CHIP_MIC_CTRL, 0); 1347 snd_soc_write(codec, SGTL5000_CHIP_MIC_CTRL, 2);
1348 1348
1349 /* 1349 /*
1350 * disable DAP 1350 * disable DAP
diff --git a/sound/soc/codecs/wm5102.c b/sound/soc/codecs/wm5102.c
index 688ade080589..7a9048dad1cd 100644
--- a/sound/soc/codecs/wm5102.c
+++ b/sound/soc/codecs/wm5102.c
@@ -36,6 +36,9 @@
36struct wm5102_priv { 36struct wm5102_priv {
37 struct arizona_priv core; 37 struct arizona_priv core;
38 struct arizona_fll fll[2]; 38 struct arizona_fll fll[2];
39
40 unsigned int spk_ena:2;
41 unsigned int spk_ena_pending:1;
39}; 42};
40 43
41static DECLARE_TLV_DB_SCALE(ana_tlv, 0, 100, 0); 44static DECLARE_TLV_DB_SCALE(ana_tlv, 0, 100, 0);
@@ -787,6 +790,47 @@ ARIZONA_MIXER_CONTROLS("AIF3TX1", ARIZONA_AIF3TX1MIX_INPUT_1_SOURCE),
787ARIZONA_MIXER_CONTROLS("AIF3TX2", ARIZONA_AIF3TX2MIX_INPUT_1_SOURCE), 790ARIZONA_MIXER_CONTROLS("AIF3TX2", ARIZONA_AIF3TX2MIX_INPUT_1_SOURCE),
788}; 791};
789 792
793static int wm5102_spk_ev(struct snd_soc_dapm_widget *w,
794 struct snd_kcontrol *kcontrol,
795 int event)
796{
797 struct snd_soc_codec *codec = w->codec;
798 struct arizona *arizona = dev_get_drvdata(codec->dev->parent);
799 struct wm5102_priv *wm5102 = snd_soc_codec_get_drvdata(codec);
800
801 if (arizona->rev < 1)
802 return 0;
803
804 switch (event) {
805 case SND_SOC_DAPM_PRE_PMU:
806 if (!wm5102->spk_ena) {
807 snd_soc_write(codec, 0x4f5, 0x25a);
808 wm5102->spk_ena_pending = true;
809 }
810 break;
811 case SND_SOC_DAPM_POST_PMU:
812 if (wm5102->spk_ena_pending) {
813 msleep(75);
814 snd_soc_write(codec, 0x4f5, 0xda);
815 wm5102->spk_ena_pending = false;
816 wm5102->spk_ena++;
817 }
818 break;
819 case SND_SOC_DAPM_PRE_PMD:
820 wm5102->spk_ena--;
821 if (!wm5102->spk_ena)
822 snd_soc_write(codec, 0x4f5, 0x25a);
823 break;
824 case SND_SOC_DAPM_POST_PMD:
825 if (!wm5102->spk_ena)
826 snd_soc_write(codec, 0x4f5, 0x0da);
827 break;
828 }
829
830 return 0;
831}
832
833
790ARIZONA_MIXER_ENUMS(EQ1, ARIZONA_EQ1MIX_INPUT_1_SOURCE); 834ARIZONA_MIXER_ENUMS(EQ1, ARIZONA_EQ1MIX_INPUT_1_SOURCE);
791ARIZONA_MIXER_ENUMS(EQ2, ARIZONA_EQ2MIX_INPUT_1_SOURCE); 835ARIZONA_MIXER_ENUMS(EQ2, ARIZONA_EQ2MIX_INPUT_1_SOURCE);
792ARIZONA_MIXER_ENUMS(EQ3, ARIZONA_EQ3MIX_INPUT_1_SOURCE); 836ARIZONA_MIXER_ENUMS(EQ3, ARIZONA_EQ3MIX_INPUT_1_SOURCE);
@@ -1034,10 +1078,10 @@ SND_SOC_DAPM_PGA_E("OUT3L", ARIZONA_OUTPUT_ENABLES_1,
1034 ARIZONA_OUT3L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev, 1078 ARIZONA_OUT3L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
1035 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU), 1079 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
1036SND_SOC_DAPM_PGA_E("OUT4L", ARIZONA_OUTPUT_ENABLES_1, 1080SND_SOC_DAPM_PGA_E("OUT4L", ARIZONA_OUTPUT_ENABLES_1,
1037 ARIZONA_OUT4L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev, 1081 ARIZONA_OUT4L_ENA_SHIFT, 0, NULL, 0, wm5102_spk_ev,
1038 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU), 1082 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
1039SND_SOC_DAPM_PGA_E("OUT4R", ARIZONA_OUTPUT_ENABLES_1, 1083SND_SOC_DAPM_PGA_E("OUT4R", ARIZONA_OUTPUT_ENABLES_1,
1040 ARIZONA_OUT4R_ENA_SHIFT, 0, NULL, 0, arizona_out_ev, 1084 ARIZONA_OUT4R_ENA_SHIFT, 0, NULL, 0, wm5102_spk_ev,
1041 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU), 1085 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMU),
1042SND_SOC_DAPM_PGA_E("OUT5L", ARIZONA_OUTPUT_ENABLES_1, 1086SND_SOC_DAPM_PGA_E("OUT5L", ARIZONA_OUTPUT_ENABLES_1,
1043 ARIZONA_OUT5L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev, 1087 ARIZONA_OUT5L_ENA_SHIFT, 0, NULL, 0, arizona_out_ev,
diff --git a/sound/soc/fsl/imx-pcm-fiq.c b/sound/soc/fsl/imx-pcm-fiq.c
index 713bd79428a9..5ec362ae4d01 100644
--- a/sound/soc/fsl/imx-pcm-fiq.c
+++ b/sound/soc/fsl/imx-pcm-fiq.c
@@ -29,7 +29,6 @@
29 29
30#include <asm/fiq.h> 30#include <asm/fiq.h>
31 31
32#include <mach/irqs.h>
33#include <linux/platform_data/asoc-imx-ssi.h> 32#include <linux/platform_data/asoc-imx-ssi.h>
34 33
35#include "imx-ssi.h" 34#include "imx-ssi.h"
diff --git a/sound/soc/fsl/imx-ssi.c b/sound/soc/fsl/imx-ssi.c
index 2c8d89eecdcf..3b480423747f 100644
--- a/sound/soc/fsl/imx-ssi.c
+++ b/sound/soc/fsl/imx-ssi.c
@@ -48,7 +48,6 @@
48#include <sound/soc.h> 48#include <sound/soc.h>
49 49
50#include <linux/platform_data/asoc-imx-ssi.h> 50#include <linux/platform_data/asoc-imx-ssi.h>
51#include <mach/hardware.h>
52 51
53#include "imx-ssi.h" 52#include "imx-ssi.h"
54 53
diff --git a/sound/soc/omap/am3517evm.c b/sound/soc/omap/am3517evm.c
index fad350682ca2..c1900b2a6f28 100644
--- a/sound/soc/omap/am3517evm.c
+++ b/sound/soc/omap/am3517evm.c
@@ -25,8 +25,6 @@
25#include <sound/soc.h> 25#include <sound/soc.h>
26 26
27#include <asm/mach-types.h> 27#include <asm/mach-types.h>
28#include <mach/hardware.h>
29#include <mach/gpio.h>
30#include <linux/platform_data/asoc-ti-mcbsp.h> 28#include <linux/platform_data/asoc-ti-mcbsp.h>
31 29
32#include "omap-mcbsp.h" 30#include "omap-mcbsp.h"
diff --git a/sound/soc/omap/n810.c b/sound/soc/omap/n810.c
index 521bfc3d2b2b..230b8c144848 100644
--- a/sound/soc/omap/n810.c
+++ b/sound/soc/omap/n810.c
@@ -29,7 +29,6 @@
29#include <sound/soc.h> 29#include <sound/soc.h>
30 30
31#include <asm/mach-types.h> 31#include <asm/mach-types.h>
32#include <mach/hardware.h>
33#include <linux/gpio.h> 32#include <linux/gpio.h>
34#include <linux/module.h> 33#include <linux/module.h>
35#include <linux/platform_data/asoc-ti-mcbsp.h> 34#include <linux/platform_data/asoc-ti-mcbsp.h>
diff --git a/sound/soc/omap/omap-pcm.c b/sound/soc/omap/omap-pcm.c
index 5f7e5b9c87a8..47bdbd415ad8 100644
--- a/sound/soc/omap/omap-pcm.c
+++ b/sound/soc/omap/omap-pcm.c
@@ -32,9 +32,14 @@
32#include <sound/dmaengine_pcm.h> 32#include <sound/dmaengine_pcm.h>
33#include <sound/soc.h> 33#include <sound/soc.h>
34 34
35#include <plat/cpu.h>
36#include "omap-pcm.h" 35#include "omap-pcm.h"
37 36
37#ifdef CONFIG_ARCH_OMAP1
38#define pcm_omap1510() cpu_is_omap1510()
39#else
40#define pcm_omap1510() 0
41#endif
42
38static const struct snd_pcm_hardware omap_pcm_hardware = { 43static const struct snd_pcm_hardware omap_pcm_hardware = {
39 .info = SNDRV_PCM_INFO_MMAP | 44 .info = SNDRV_PCM_INFO_MMAP |
40 SNDRV_PCM_INFO_MMAP_VALID | 45 SNDRV_PCM_INFO_MMAP_VALID |
@@ -159,7 +164,7 @@ static snd_pcm_uframes_t omap_pcm_pointer(struct snd_pcm_substream *substream)
159{ 164{
160 snd_pcm_uframes_t offset; 165 snd_pcm_uframes_t offset;
161 166
162 if (cpu_is_omap1510()) 167 if (pcm_omap1510())
163 offset = snd_dmaengine_pcm_pointer_no_residue(substream); 168 offset = snd_dmaengine_pcm_pointer_no_residue(substream);
164 else 169 else
165 offset = snd_dmaengine_pcm_pointer(substream); 170 offset = snd_dmaengine_pcm_pointer(substream);
diff --git a/sound/soc/omap/osk5912.c b/sound/soc/omap/osk5912.c
index 3960e8df9c76..06ef8d67ed1c 100644
--- a/sound/soc/omap/osk5912.c
+++ b/sound/soc/omap/osk5912.c
@@ -28,7 +28,6 @@
28#include <sound/soc.h> 28#include <sound/soc.h>
29 29
30#include <asm/mach-types.h> 30#include <asm/mach-types.h>
31#include <mach/hardware.h>
32#include <linux/gpio.h> 31#include <linux/gpio.h>
33#include <linux/module.h> 32#include <linux/module.h>
34#include <linux/platform_data/asoc-ti-mcbsp.h> 33#include <linux/platform_data/asoc-ti-mcbsp.h>
diff --git a/sound/soc/omap/sdp3430.c b/sound/soc/omap/sdp3430.c
index 597cae769cea..b462a2c9385f 100644
--- a/sound/soc/omap/sdp3430.c
+++ b/sound/soc/omap/sdp3430.c
@@ -31,8 +31,6 @@
31#include <sound/jack.h> 31#include <sound/jack.h>
32 32
33#include <asm/mach-types.h> 33#include <asm/mach-types.h>
34#include <mach/hardware.h>
35#include <mach/gpio.h>
36#include <linux/platform_data/gpio-omap.h> 34#include <linux/platform_data/gpio-omap.h>
37#include <linux/platform_data/asoc-ti-mcbsp.h> 35#include <linux/platform_data/asoc-ti-mcbsp.h>
38 36
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 91d592ff67b7..2370063b5824 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1255,6 +1255,8 @@ static int soc_post_component_init(struct snd_soc_card *card,
1255 INIT_LIST_HEAD(&rtd->dpcm[SNDRV_PCM_STREAM_CAPTURE].fe_clients); 1255 INIT_LIST_HEAD(&rtd->dpcm[SNDRV_PCM_STREAM_CAPTURE].fe_clients);
1256 ret = device_add(rtd->dev); 1256 ret = device_add(rtd->dev);
1257 if (ret < 0) { 1257 if (ret < 0) {
1258 /* calling put_device() here to free the rtd->dev */
1259 put_device(rtd->dev);
1258 dev_err(card->dev, 1260 dev_err(card->dev,
1259 "ASoC: failed to register runtime device: %d\n", ret); 1261 "ASoC: failed to register runtime device: %d\n", ret);
1260 return ret; 1262 return ret;
@@ -1554,7 +1556,7 @@ static void soc_remove_aux_dev(struct snd_soc_card *card, int num)
1554 /* unregister the rtd device */ 1556 /* unregister the rtd device */
1555 if (rtd->dev_registered) { 1557 if (rtd->dev_registered) {
1556 device_remove_file(rtd->dev, &dev_attr_codec_reg); 1558 device_remove_file(rtd->dev, &dev_attr_codec_reg);
1557 device_del(rtd->dev); 1559 device_unregister(rtd->dev);
1558 rtd->dev_registered = 0; 1560 rtd->dev_registered = 0;
1559 } 1561 }
1560 1562
@@ -2917,7 +2919,7 @@ int snd_soc_info_volsw_range(struct snd_kcontrol *kcontrol,
2917 platform_max = mc->platform_max; 2919 platform_max = mc->platform_max;
2918 2920
2919 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; 2921 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
2920 uinfo->count = 1; 2922 uinfo->count = snd_soc_volsw_is_stereo(mc) ? 2 : 1;
2921 uinfo->value.integer.min = 0; 2923 uinfo->value.integer.min = 0;
2922 uinfo->value.integer.max = platform_max - min; 2924 uinfo->value.integer.max = platform_max - min;
2923 2925
@@ -2941,12 +2943,14 @@ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol,
2941 (struct soc_mixer_control *)kcontrol->private_value; 2943 (struct soc_mixer_control *)kcontrol->private_value;
2942 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 2944 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
2943 unsigned int reg = mc->reg; 2945 unsigned int reg = mc->reg;
2946 unsigned int rreg = mc->rreg;
2944 unsigned int shift = mc->shift; 2947 unsigned int shift = mc->shift;
2945 int min = mc->min; 2948 int min = mc->min;
2946 int max = mc->max; 2949 int max = mc->max;
2947 unsigned int mask = (1 << fls(max)) - 1; 2950 unsigned int mask = (1 << fls(max)) - 1;
2948 unsigned int invert = mc->invert; 2951 unsigned int invert = mc->invert;
2949 unsigned int val, val_mask; 2952 unsigned int val, val_mask;
2953 int ret;
2950 2954
2951 val = ((ucontrol->value.integer.value[0] + min) & mask); 2955 val = ((ucontrol->value.integer.value[0] + min) & mask);
2952 if (invert) 2956 if (invert)
@@ -2954,7 +2958,21 @@ int snd_soc_put_volsw_range(struct snd_kcontrol *kcontrol,
2954 val_mask = mask << shift; 2958 val_mask = mask << shift;
2955 val = val << shift; 2959 val = val << shift;
2956 2960
2957 return snd_soc_update_bits_locked(codec, reg, val_mask, val); 2961 ret = snd_soc_update_bits_locked(codec, reg, val_mask, val);
2962 if (ret != 0)
2963 return ret;
2964
2965 if (snd_soc_volsw_is_stereo(mc)) {
2966 val = ((ucontrol->value.integer.value[1] + min) & mask);
2967 if (invert)
2968 val = max - val;
2969 val_mask = mask << shift;
2970 val = val << shift;
2971
2972 ret = snd_soc_update_bits_locked(codec, rreg, val_mask, val);
2973 }
2974
2975 return ret;
2958} 2976}
2959EXPORT_SYMBOL_GPL(snd_soc_put_volsw_range); 2977EXPORT_SYMBOL_GPL(snd_soc_put_volsw_range);
2960 2978
@@ -2974,6 +2992,7 @@ int snd_soc_get_volsw_range(struct snd_kcontrol *kcontrol,
2974 (struct soc_mixer_control *)kcontrol->private_value; 2992 (struct soc_mixer_control *)kcontrol->private_value;
2975 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 2993 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
2976 unsigned int reg = mc->reg; 2994 unsigned int reg = mc->reg;
2995 unsigned int rreg = mc->rreg;
2977 unsigned int shift = mc->shift; 2996 unsigned int shift = mc->shift;
2978 int min = mc->min; 2997 int min = mc->min;
2979 int max = mc->max; 2998 int max = mc->max;
@@ -2988,6 +3007,16 @@ int snd_soc_get_volsw_range(struct snd_kcontrol *kcontrol,
2988 ucontrol->value.integer.value[0] = 3007 ucontrol->value.integer.value[0] =
2989 ucontrol->value.integer.value[0] - min; 3008 ucontrol->value.integer.value[0] - min;
2990 3009
3010 if (snd_soc_volsw_is_stereo(mc)) {
3011 ucontrol->value.integer.value[1] =
3012 (snd_soc_read(codec, rreg) >> shift) & mask;
3013 if (invert)
3014 ucontrol->value.integer.value[1] =
3015 max - ucontrol->value.integer.value[1];
3016 ucontrol->value.integer.value[1] =
3017 ucontrol->value.integer.value[1] - min;
3018 }
3019
2991 return 0; 3020 return 0;
2992} 3021}
2993EXPORT_SYMBOL_GPL(snd_soc_get_volsw_range); 3022EXPORT_SYMBOL_GPL(snd_soc_get_volsw_range);
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index d7711fce119b..cf191e6aebbe 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -1243,6 +1243,7 @@ static int dpcm_be_dai_hw_free(struct snd_soc_pcm_runtime *fe, int stream)
1243 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) && 1243 if ((be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_PARAMS) &&
1244 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PREPARE) && 1244 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PREPARE) &&
1245 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) && 1245 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE) &&
1246 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_PAUSED) &&
1246 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP)) 1247 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP))
1247 continue; 1248 continue;
1248 1249
diff --git a/sound/soc/tegra/tegra30_ahub.c b/sound/soc/tegra/tegra30_ahub.c
index fd596d2a19b4..f354dc390a0b 100644
--- a/sound/soc/tegra/tegra30_ahub.c
+++ b/sound/soc/tegra/tegra30_ahub.c
@@ -26,7 +26,6 @@
26#include <linux/regmap.h> 26#include <linux/regmap.h>
27#include <linux/slab.h> 27#include <linux/slab.h>
28#include <mach/clk.h> 28#include <mach/clk.h>
29#include <mach/dma.h>
30#include <sound/soc.h> 29#include <sound/soc.h>
31#include "tegra30_ahub.h" 30#include "tegra30_ahub.h"
32 31
diff --git a/sound/soc/tegra/tegra_pcm.h b/sound/soc/tegra/tegra_pcm.h
index b40279b9f413..bc8b46af928e 100644
--- a/sound/soc/tegra/tegra_pcm.h
+++ b/sound/soc/tegra/tegra_pcm.h
@@ -31,8 +31,6 @@
31#ifndef __TEGRA_PCM_H__ 31#ifndef __TEGRA_PCM_H__
32#define __TEGRA_PCM_H__ 32#define __TEGRA_PCM_H__
33 33
34#include <mach/dma.h>
35
36struct tegra_pcm_dma_params { 34struct tegra_pcm_dma_params {
37 unsigned long addr; 35 unsigned long addr;
38 unsigned long wrap; 36 unsigned long wrap;
diff --git a/sound/soc/ux500/ux500_pcm.c b/sound/soc/ux500/ux500_pcm.c
index c6821a5ab0fb..846fa82a58d0 100644
--- a/sound/soc/ux500/ux500_pcm.c
+++ b/sound/soc/ux500/ux500_pcm.c
@@ -18,8 +18,7 @@
18#include <linux/dma-mapping.h> 18#include <linux/dma-mapping.h>
19#include <linux/dmaengine.h> 19#include <linux/dmaengine.h>
20#include <linux/slab.h> 20#include <linux/slab.h>
21 21#include <linux/platform_data/dma-ste-dma40.h>
22#include <plat/ste_dma40.h>
23 22
24#include <sound/pcm.h> 23#include <sound/pcm.h>
25#include <sound/pcm_params.h> 24#include <sound/pcm_params.h>
diff --git a/sound/sound_core.c b/sound/sound_core.c
index fb9255cca214..bb23009edc8d 100644
--- a/sound/sound_core.c
+++ b/sound/sound_core.c
@@ -146,8 +146,7 @@ extern int msnd_pinnacle_init(void);
146 * devices only the standard chrdev aliases are requested. 146 * devices only the standard chrdev aliases are requested.
147 * 147 *
148 * All these clutters are scheduled to be removed along with 148 * All these clutters are scheduled to be removed along with
149 * sound-slot/service-* module aliases. Please take a look at 149 * sound-slot/service-* module aliases.
150 * feature-removal-schedule.txt for details.
151 */ 150 */
152#ifdef CONFIG_SOUND_OSS_CORE_PRECLAIM 151#ifdef CONFIG_SOUND_OSS_CORE_PRECLAIM
153static int preclaim_oss = 1; 152static int preclaim_oss = 1;
diff --git a/sound/sparc/amd7930.c b/sound/sparc/amd7930.c
index 5701787c0e6b..174d21fb56e2 100644
--- a/sound/sparc/amd7930.c
+++ b/sound/sparc/amd7930.c
@@ -755,7 +755,7 @@ static struct snd_pcm_ops snd_amd7930_capture_ops = {
755 .pointer = snd_amd7930_capture_pointer, 755 .pointer = snd_amd7930_capture_pointer,
756}; 756};
757 757
758static int __devinit snd_amd7930_pcm(struct snd_amd7930 *amd) 758static int snd_amd7930_pcm(struct snd_amd7930 *amd)
759{ 759{
760 struct snd_pcm *pcm; 760 struct snd_pcm *pcm;
761 int err; 761 int err;
@@ -854,7 +854,7 @@ static int snd_amd7930_put_volume(struct snd_kcontrol *kctl, struct snd_ctl_elem
854 return change; 854 return change;
855} 855}
856 856
857static struct snd_kcontrol_new amd7930_controls[] __devinitdata = { 857static struct snd_kcontrol_new amd7930_controls[] = {
858 { 858 {
859 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 859 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
860 .name = "Monitor Volume", 860 .name = "Monitor Volume",
@@ -884,7 +884,7 @@ static struct snd_kcontrol_new amd7930_controls[] __devinitdata = {
884 }, 884 },
885}; 885};
886 886
887static int __devinit snd_amd7930_mixer(struct snd_amd7930 *amd) 887static int snd_amd7930_mixer(struct snd_amd7930 *amd)
888{ 888{
889 struct snd_card *card; 889 struct snd_card *card;
890 int idx, err; 890 int idx, err;
@@ -933,10 +933,10 @@ static struct snd_device_ops snd_amd7930_dev_ops = {
933 .dev_free = snd_amd7930_dev_free, 933 .dev_free = snd_amd7930_dev_free,
934}; 934};
935 935
936static int __devinit snd_amd7930_create(struct snd_card *card, 936static int snd_amd7930_create(struct snd_card *card,
937 struct platform_device *op, 937 struct platform_device *op,
938 int irq, int dev, 938 int irq, int dev,
939 struct snd_amd7930 **ramd) 939 struct snd_amd7930 **ramd)
940{ 940{
941 struct snd_amd7930 *amd; 941 struct snd_amd7930 *amd;
942 unsigned long flags; 942 unsigned long flags;
@@ -1002,7 +1002,7 @@ static int __devinit snd_amd7930_create(struct snd_card *card,
1002 return 0; 1002 return 0;
1003} 1003}
1004 1004
1005static int __devinit amd7930_sbus_probe(struct platform_device *op) 1005static int amd7930_sbus_probe(struct platform_device *op)
1006{ 1006{
1007 struct resource *rp = &op->resource[0]; 1007 struct resource *rp = &op->resource[0];
1008 static int dev_num; 1008 static int dev_num;
diff --git a/sound/sparc/cs4231.c b/sound/sparc/cs4231.c
index f2eabd3f22fd..54aaad2a10f5 100644
--- a/sound/sparc/cs4231.c
+++ b/sound/sparc/cs4231.c
@@ -702,7 +702,7 @@ static int snd_cs4231_timer_stop(struct snd_timer *timer)
702 return 0; 702 return 0;
703} 703}
704 704
705static void __devinit snd_cs4231_init(struct snd_cs4231 *chip) 705static void snd_cs4231_init(struct snd_cs4231 *chip)
706{ 706{
707 unsigned long flags; 707 unsigned long flags;
708 708
@@ -1019,7 +1019,7 @@ static snd_pcm_uframes_t snd_cs4231_capture_pointer(
1019 return bytes_to_frames(substream->runtime, ptr); 1019 return bytes_to_frames(substream->runtime, ptr);
1020} 1020}
1021 1021
1022static int __devinit snd_cs4231_probe(struct snd_cs4231 *chip) 1022static int snd_cs4231_probe(struct snd_cs4231 *chip)
1023{ 1023{
1024 unsigned long flags; 1024 unsigned long flags;
1025 int i; 1025 int i;
@@ -1218,7 +1218,7 @@ static struct snd_pcm_ops snd_cs4231_capture_ops = {
1218 .pointer = snd_cs4231_capture_pointer, 1218 .pointer = snd_cs4231_capture_pointer,
1219}; 1219};
1220 1220
1221static int __devinit snd_cs4231_pcm(struct snd_card *card) 1221static int snd_cs4231_pcm(struct snd_card *card)
1222{ 1222{
1223 struct snd_cs4231 *chip = card->private_data; 1223 struct snd_cs4231 *chip = card->private_data;
1224 struct snd_pcm *pcm; 1224 struct snd_pcm *pcm;
@@ -1247,7 +1247,7 @@ static int __devinit snd_cs4231_pcm(struct snd_card *card)
1247 return 0; 1247 return 0;
1248} 1248}
1249 1249
1250static int __devinit snd_cs4231_timer(struct snd_card *card) 1250static int snd_cs4231_timer(struct snd_card *card)
1251{ 1251{
1252 struct snd_cs4231 *chip = card->private_data; 1252 struct snd_cs4231 *chip = card->private_data;
1253 struct snd_timer *timer; 1253 struct snd_timer *timer;
@@ -1498,7 +1498,7 @@ static int snd_cs4231_put_double(struct snd_kcontrol *kcontrol,
1498 .private_value = (left_reg) | ((right_reg) << 8) | ((shift_left) << 16) | \ 1498 .private_value = (left_reg) | ((right_reg) << 8) | ((shift_left) << 16) | \
1499 ((shift_right) << 19) | ((mask) << 24) | ((invert) << 22) } 1499 ((shift_right) << 19) | ((mask) << 24) | ((invert) << 22) }
1500 1500
1501static struct snd_kcontrol_new snd_cs4231_controls[] __devinitdata = { 1501static struct snd_kcontrol_new snd_cs4231_controls[] = {
1502CS4231_DOUBLE("PCM Playback Switch", 0, CS4231_LEFT_OUTPUT, 1502CS4231_DOUBLE("PCM Playback Switch", 0, CS4231_LEFT_OUTPUT,
1503 CS4231_RIGHT_OUTPUT, 7, 7, 1, 1), 1503 CS4231_RIGHT_OUTPUT, 7, 7, 1, 1),
1504CS4231_DOUBLE("PCM Playback Volume", 0, CS4231_LEFT_OUTPUT, 1504CS4231_DOUBLE("PCM Playback Volume", 0, CS4231_LEFT_OUTPUT,
@@ -1537,7 +1537,7 @@ CS4231_SINGLE("Line Out Switch", 0, CS4231_PIN_CTRL, 6, 1, 1),
1537CS4231_SINGLE("Headphone Out Switch", 0, CS4231_PIN_CTRL, 7, 1, 1) 1537CS4231_SINGLE("Headphone Out Switch", 0, CS4231_PIN_CTRL, 7, 1, 1)
1538}; 1538};
1539 1539
1540static int __devinit snd_cs4231_mixer(struct snd_card *card) 1540static int snd_cs4231_mixer(struct snd_card *card)
1541{ 1541{
1542 struct snd_cs4231 *chip = card->private_data; 1542 struct snd_cs4231 *chip = card->private_data;
1543 int err, idx; 1543 int err, idx;
@@ -1558,7 +1558,7 @@ static int __devinit snd_cs4231_mixer(struct snd_card *card)
1558 1558
1559static int dev; 1559static int dev;
1560 1560
1561static int __devinit cs4231_attach_begin(struct snd_card **rcard) 1561static int cs4231_attach_begin(struct snd_card **rcard)
1562{ 1562{
1563 struct snd_card *card; 1563 struct snd_card *card;
1564 struct snd_cs4231 *chip; 1564 struct snd_cs4231 *chip;
@@ -1589,7 +1589,7 @@ static int __devinit cs4231_attach_begin(struct snd_card **rcard)
1589 return 0; 1589 return 0;
1590} 1590}
1591 1591
1592static int __devinit cs4231_attach_finish(struct snd_card *card) 1592static int cs4231_attach_finish(struct snd_card *card)
1593{ 1593{
1594 struct snd_cs4231 *chip = card->private_data; 1594 struct snd_cs4231 *chip = card->private_data;
1595 int err; 1595 int err;
@@ -1793,9 +1793,9 @@ static struct snd_device_ops snd_cs4231_sbus_dev_ops = {
1793 .dev_free = snd_cs4231_sbus_dev_free, 1793 .dev_free = snd_cs4231_sbus_dev_free,
1794}; 1794};
1795 1795
1796static int __devinit snd_cs4231_sbus_create(struct snd_card *card, 1796static int snd_cs4231_sbus_create(struct snd_card *card,
1797 struct platform_device *op, 1797 struct platform_device *op,
1798 int dev) 1798 int dev)
1799{ 1799{
1800 struct snd_cs4231 *chip = card->private_data; 1800 struct snd_cs4231 *chip = card->private_data;
1801 int err; 1801 int err;
@@ -1856,7 +1856,7 @@ static int __devinit snd_cs4231_sbus_create(struct snd_card *card,
1856 return 0; 1856 return 0;
1857} 1857}
1858 1858
1859static int __devinit cs4231_sbus_probe(struct platform_device *op) 1859static int cs4231_sbus_probe(struct platform_device *op)
1860{ 1860{
1861 struct resource *rp = &op->resource[0]; 1861 struct resource *rp = &op->resource[0];
1862 struct snd_card *card; 1862 struct snd_card *card;
@@ -1959,9 +1959,9 @@ static struct snd_device_ops snd_cs4231_ebus_dev_ops = {
1959 .dev_free = snd_cs4231_ebus_dev_free, 1959 .dev_free = snd_cs4231_ebus_dev_free,
1960}; 1960};
1961 1961
1962static int __devinit snd_cs4231_ebus_create(struct snd_card *card, 1962static int snd_cs4231_ebus_create(struct snd_card *card,
1963 struct platform_device *op, 1963 struct platform_device *op,
1964 int dev) 1964 int dev)
1965{ 1965{
1966 struct snd_cs4231 *chip = card->private_data; 1966 struct snd_cs4231 *chip = card->private_data;
1967 int err; 1967 int err;
@@ -2048,7 +2048,7 @@ static int __devinit snd_cs4231_ebus_create(struct snd_card *card,
2048 return 0; 2048 return 0;
2049} 2049}
2050 2050
2051static int __devinit cs4231_ebus_probe(struct platform_device *op) 2051static int cs4231_ebus_probe(struct platform_device *op)
2052{ 2052{
2053 struct snd_card *card; 2053 struct snd_card *card;
2054 int err; 2054 int err;
@@ -2072,7 +2072,7 @@ static int __devinit cs4231_ebus_probe(struct platform_device *op)
2072} 2072}
2073#endif 2073#endif
2074 2074
2075static int __devinit cs4231_probe(struct platform_device *op) 2075static int cs4231_probe(struct platform_device *op)
2076{ 2076{
2077#ifdef EBUS_SUPPORT 2077#ifdef EBUS_SUPPORT
2078 if (!strcmp(op->dev.of_node->parent->name, "ebus")) 2078 if (!strcmp(op->dev.of_node->parent->name, "ebus"))
@@ -2086,7 +2086,7 @@ static int __devinit cs4231_probe(struct platform_device *op)
2086 return -ENODEV; 2086 return -ENODEV;
2087} 2087}
2088 2088
2089static int __devexit cs4231_remove(struct platform_device *op) 2089static int cs4231_remove(struct platform_device *op)
2090{ 2090{
2091 struct snd_cs4231 *chip = dev_get_drvdata(&op->dev); 2091 struct snd_cs4231 *chip = dev_get_drvdata(&op->dev);
2092 2092
@@ -2115,7 +2115,7 @@ static struct platform_driver cs4231_driver = {
2115 .of_match_table = cs4231_match, 2115 .of_match_table = cs4231_match,
2116 }, 2116 },
2117 .probe = cs4231_probe, 2117 .probe = cs4231_probe,
2118 .remove = __devexit_p(cs4231_remove), 2118 .remove = cs4231_remove,
2119}; 2119};
2120 2120
2121module_platform_driver(cs4231_driver); 2121module_platform_driver(cs4231_driver);
diff --git a/sound/sparc/dbri.c b/sound/sparc/dbri.c
index ae35f5342e10..75e6016d3efe 100644
--- a/sound/sparc/dbri.c
+++ b/sound/sparc/dbri.c
@@ -745,7 +745,7 @@ static void dbri_reset(struct snd_dbri *dbri)
745} 745}
746 746
747/* Lock must not be held before calling this */ 747/* Lock must not be held before calling this */
748static void __devinit dbri_initialize(struct snd_dbri *dbri) 748static void dbri_initialize(struct snd_dbri *dbri)
749{ 749{
750 s32 *cmd; 750 s32 *cmd;
751 u32 dma_addr; 751 u32 dma_addr;
@@ -1305,7 +1305,7 @@ to the DBRI via the CHI interface and few of the DBRI's PIO pins.
1305 * Lock must not be held before calling it. 1305 * Lock must not be held before calling it.
1306 1306
1307*/ 1307*/
1308static __devinit void cs4215_setup_pipes(struct snd_dbri *dbri) 1308static void cs4215_setup_pipes(struct snd_dbri *dbri)
1309{ 1309{
1310 unsigned long flags; 1310 unsigned long flags;
1311 1311
@@ -1338,7 +1338,7 @@ static __devinit void cs4215_setup_pipes(struct snd_dbri *dbri)
1338 dbri_cmdwait(dbri); 1338 dbri_cmdwait(dbri);
1339} 1339}
1340 1340
1341static __devinit int cs4215_init_data(struct cs4215 *mm) 1341static int cs4215_init_data(struct cs4215 *mm)
1342{ 1342{
1343 /* 1343 /*
1344 * No action, memory resetting only. 1344 * No action, memory resetting only.
@@ -1630,7 +1630,7 @@ static int cs4215_prepare(struct snd_dbri *dbri, unsigned int rate,
1630/* 1630/*
1631 * 1631 *
1632 */ 1632 */
1633static __devinit int cs4215_init(struct snd_dbri *dbri) 1633static int cs4215_init(struct snd_dbri *dbri)
1634{ 1634{
1635 u32 reg2 = sbus_readl(dbri->regs + REG2); 1635 u32 reg2 = sbus_readl(dbri->regs + REG2);
1636 dprintk(D_MM, "cs4215_init: reg2=0x%x\n", reg2); 1636 dprintk(D_MM, "cs4215_init: reg2=0x%x\n", reg2);
@@ -2217,7 +2217,7 @@ static struct snd_pcm_ops snd_dbri_ops = {
2217 .pointer = snd_dbri_pointer, 2217 .pointer = snd_dbri_pointer,
2218}; 2218};
2219 2219
2220static int __devinit snd_dbri_pcm(struct snd_card *card) 2220static int snd_dbri_pcm(struct snd_card *card)
2221{ 2221{
2222 struct snd_pcm *pcm; 2222 struct snd_pcm *pcm;
2223 int err; 2223 int err;
@@ -2409,7 +2409,7 @@ static int snd_cs4215_put_single(struct snd_kcontrol *kcontrol,
2409 .private_value = (entry) | ((shift) << 8) | ((mask) << 16) | \ 2409 .private_value = (entry) | ((shift) << 8) | ((mask) << 16) | \
2410 ((invert) << 24) }, 2410 ((invert) << 24) },
2411 2411
2412static struct snd_kcontrol_new dbri_controls[] __devinitdata = { 2412static struct snd_kcontrol_new dbri_controls[] = {
2413 { 2413 {
2414 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2414 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2415 .name = "Playback Volume", 2415 .name = "Playback Volume",
@@ -2436,7 +2436,7 @@ static struct snd_kcontrol_new dbri_controls[] __devinitdata = {
2436 CS4215_SINGLE("Mic boost", 4, 4, 1, 1) 2436 CS4215_SINGLE("Mic boost", 4, 4, 1, 1)
2437}; 2437};
2438 2438
2439static int __devinit snd_dbri_mixer(struct snd_card *card) 2439static int snd_dbri_mixer(struct snd_card *card)
2440{ 2440{
2441 int idx, err; 2441 int idx, err;
2442 struct snd_dbri *dbri; 2442 struct snd_dbri *dbri;
@@ -2500,7 +2500,7 @@ static void dbri_debug_read(struct snd_info_entry *entry,
2500} 2500}
2501#endif 2501#endif
2502 2502
2503static void __devinit snd_dbri_proc(struct snd_card *card) 2503static void snd_dbri_proc(struct snd_card *card)
2504{ 2504{
2505 struct snd_dbri *dbri = card->private_data; 2505 struct snd_dbri *dbri = card->private_data;
2506 struct snd_info_entry *entry; 2506 struct snd_info_entry *entry;
@@ -2523,9 +2523,9 @@ static void __devinit snd_dbri_proc(struct snd_card *card)
2523*/ 2523*/
2524static void snd_dbri_free(struct snd_dbri *dbri); 2524static void snd_dbri_free(struct snd_dbri *dbri);
2525 2525
2526static int __devinit snd_dbri_create(struct snd_card *card, 2526static int snd_dbri_create(struct snd_card *card,
2527 struct platform_device *op, 2527 struct platform_device *op,
2528 int irq, int dev) 2528 int irq, int dev)
2529{ 2529{
2530 struct snd_dbri *dbri = card->private_data; 2530 struct snd_dbri *dbri = card->private_data;
2531 int err; 2531 int err;
@@ -2593,7 +2593,7 @@ static void snd_dbri_free(struct snd_dbri *dbri)
2593 (void *)dbri->dma, dbri->dma_dvma); 2593 (void *)dbri->dma, dbri->dma_dvma);
2594} 2594}
2595 2595
2596static int __devinit dbri_probe(struct platform_device *op) 2596static int dbri_probe(struct platform_device *op)
2597{ 2597{
2598 struct snd_dbri *dbri; 2598 struct snd_dbri *dbri;
2599 struct resource *rp; 2599 struct resource *rp;
@@ -2663,7 +2663,7 @@ _err:
2663 return err; 2663 return err;
2664} 2664}
2665 2665
2666static int __devexit dbri_remove(struct platform_device *op) 2666static int dbri_remove(struct platform_device *op)
2667{ 2667{
2668 struct snd_card *card = dev_get_drvdata(&op->dev); 2668 struct snd_card *card = dev_get_drvdata(&op->dev);
2669 2669
@@ -2694,7 +2694,7 @@ static struct platform_driver dbri_sbus_driver = {
2694 .of_match_table = dbri_match, 2694 .of_match_table = dbri_match,
2695 }, 2695 },
2696 .probe = dbri_probe, 2696 .probe = dbri_probe,
2697 .remove = __devexit_p(dbri_remove), 2697 .remove = dbri_remove,
2698}; 2698};
2699 2699
2700module_platform_driver(dbri_sbus_driver); 2700module_platform_driver(dbri_sbus_driver);
diff --git a/sound/spi/at73c213.c b/sound/spi/at73c213.c
index c6500d00053b..4dd60d8a4889 100644
--- a/sound/spi/at73c213.c
+++ b/sound/spi/at73c213.c
@@ -330,7 +330,7 @@ static struct snd_pcm_ops at73c213_playback_ops = {
330 .pointer = snd_at73c213_pcm_pointer, 330 .pointer = snd_at73c213_pcm_pointer,
331}; 331};
332 332
333static int __devinit snd_at73c213_pcm_new(struct snd_at73c213 *chip, int device) 333static int snd_at73c213_pcm_new(struct snd_at73c213 *chip, int device)
334{ 334{
335 struct snd_pcm *pcm; 335 struct snd_pcm *pcm;
336 int retval; 336 int retval;
@@ -665,7 +665,7 @@ static int snd_at73c213_aux_capture_volume_info(
665 | (mask << 24) | (invert << 22)) \ 665 | (mask << 24) | (invert << 22)) \
666} 666}
667 667
668static struct snd_kcontrol_new snd_at73c213_controls[] __devinitdata = { 668static struct snd_kcontrol_new snd_at73c213_controls[] = {
669AT73C213_STEREO("Master Playback Volume", 0, DAC_LMPG, DAC_RMPG, 0, 0, 0x1f, 1), 669AT73C213_STEREO("Master Playback Volume", 0, DAC_LMPG, DAC_RMPG, 0, 0, 0x1f, 1),
670AT73C213_STEREO("Master Playback Switch", 0, DAC_LMPG, DAC_RMPG, 5, 5, 1, 1), 670AT73C213_STEREO("Master Playback Switch", 0, DAC_LMPG, DAC_RMPG, 5, 5, 1, 1),
671AT73C213_STEREO("PCM Playback Volume", 0, DAC_LLOG, DAC_RLOG, 0, 0, 0x1f, 1), 671AT73C213_STEREO("PCM Playback Volume", 0, DAC_LLOG, DAC_RLOG, 0, 0, 0x1f, 1),
@@ -709,7 +709,7 @@ AT73C213_MONO_SWITCH("Aux Capture Switch", 0, DAC_CTRL, DAC_CTRL_ONAUXIN,
709AT73C213_MONO_SWITCH("Line Capture Switch", 0, DAC_CTRL, 0, 0x03, 0), 709AT73C213_MONO_SWITCH("Line Capture Switch", 0, DAC_CTRL, 0, 0x03, 0),
710}; 710};
711 711
712static int __devinit snd_at73c213_mixer(struct snd_at73c213 *chip) 712static int snd_at73c213_mixer(struct snd_at73c213 *chip)
713{ 713{
714 struct snd_card *card; 714 struct snd_card *card;
715 int errval, idx; 715 int errval, idx;
@@ -744,7 +744,7 @@ cleanup:
744/* 744/*
745 * Device functions 745 * Device functions
746 */ 746 */
747static int __devinit snd_at73c213_ssc_init(struct snd_at73c213 *chip) 747static int snd_at73c213_ssc_init(struct snd_at73c213 *chip)
748{ 748{
749 /* 749 /*
750 * Continuous clock output. 750 * Continuous clock output.
@@ -774,7 +774,7 @@ static int __devinit snd_at73c213_ssc_init(struct snd_at73c213 *chip)
774 return 0; 774 return 0;
775} 775}
776 776
777static int __devinit snd_at73c213_chip_init(struct snd_at73c213 *chip) 777static int snd_at73c213_chip_init(struct snd_at73c213 *chip)
778{ 778{
779 int retval; 779 int retval;
780 unsigned char dac_ctrl = 0; 780 unsigned char dac_ctrl = 0;
@@ -879,8 +879,8 @@ static int snd_at73c213_dev_free(struct snd_device *device)
879 return 0; 879 return 0;
880} 880}
881 881
882static int __devinit snd_at73c213_dev_init(struct snd_card *card, 882static int snd_at73c213_dev_init(struct snd_card *card,
883 struct spi_device *spi) 883 struct spi_device *spi)
884{ 884{
885 static struct snd_device_ops ops = { 885 static struct snd_device_ops ops = {
886 .dev_free = snd_at73c213_dev_free, 886 .dev_free = snd_at73c213_dev_free,
@@ -940,7 +940,7 @@ out:
940 return retval; 940 return retval;
941} 941}
942 942
943static int __devinit snd_at73c213_probe(struct spi_device *spi) 943static int snd_at73c213_probe(struct spi_device *spi)
944{ 944{
945 struct snd_card *card; 945 struct snd_card *card;
946 struct snd_at73c213 *chip; 946 struct snd_at73c213 *chip;
@@ -1007,7 +1007,7 @@ out:
1007 return retval; 1007 return retval;
1008} 1008}
1009 1009
1010static int __devexit snd_at73c213_remove(struct spi_device *spi) 1010static int snd_at73c213_remove(struct spi_device *spi)
1011{ 1011{
1012 struct snd_card *card = dev_get_drvdata(&spi->dev); 1012 struct snd_card *card = dev_get_drvdata(&spi->dev);
1013 struct snd_at73c213 *chip = card->private_data; 1013 struct snd_at73c213 *chip = card->private_data;
@@ -1109,7 +1109,7 @@ static struct spi_driver at73c213_driver = {
1109 .probe = snd_at73c213_probe, 1109 .probe = snd_at73c213_probe,
1110 .suspend = snd_at73c213_suspend, 1110 .suspend = snd_at73c213_suspend,
1111 .resume = snd_at73c213_resume, 1111 .resume = snd_at73c213_resume,
1112 .remove = __devexit_p(snd_at73c213_remove), 1112 .remove = snd_at73c213_remove,
1113}; 1113};
1114 1114
1115module_spi_driver(at73c213_driver); 1115module_spi_driver(at73c213_driver);
diff --git a/sound/usb/6fire/chip.c b/sound/usb/6fire/chip.c
index fc8cc823e438..4394ae796356 100644
--- a/sound/usb/6fire/chip.c
+++ b/sound/usb/6fire/chip.c
@@ -82,8 +82,8 @@ static void usb6fire_chip_destroy(struct sfire_chip *chip)
82 } 82 }
83} 83}
84 84
85static int __devinit usb6fire_chip_probe(struct usb_interface *intf, 85static int usb6fire_chip_probe(struct usb_interface *intf,
86 const struct usb_device_id *usb_id) 86 const struct usb_device_id *usb_id)
87{ 87{
88 int ret; 88 int ret;
89 int i; 89 int i;
diff --git a/sound/usb/6fire/comm.c b/sound/usb/6fire/comm.c
index 6c3d531a250e..9e6e3ffd86bb 100644
--- a/sound/usb/6fire/comm.c
+++ b/sound/usb/6fire/comm.c
@@ -125,16 +125,17 @@ static int usb6fire_comm_write16(struct comm_runtime *rt, u8 request,
125 return usb6fire_comm_send_buffer(buffer, rt->chip->dev); 125 return usb6fire_comm_send_buffer(buffer, rt->chip->dev);
126} 126}
127 127
128int __devinit usb6fire_comm_init(struct sfire_chip *chip) 128int usb6fire_comm_init(struct sfire_chip *chip)
129{ 129{
130 struct comm_runtime *rt = kzalloc(sizeof(struct comm_runtime), 130 struct comm_runtime *rt = kzalloc(sizeof(struct comm_runtime),
131 GFP_KERNEL); 131 GFP_KERNEL);
132 struct urb *urb = &rt->receiver; 132 struct urb *urb;
133 int ret; 133 int ret;
134 134
135 if (!rt) 135 if (!rt)
136 return -ENOMEM; 136 return -ENOMEM;
137 137
138 urb = &rt->receiver;
138 rt->serial = 1; 139 rt->serial = 1;
139 rt->chip = chip; 140 rt->chip = chip;
140 usb_init_urb(urb); 141 usb_init_urb(urb);
diff --git a/sound/usb/6fire/comm.h b/sound/usb/6fire/comm.h
index d2af0a5ddcf3..6a0840b0dcff 100644
--- a/sound/usb/6fire/comm.h
+++ b/sound/usb/6fire/comm.h
@@ -36,7 +36,7 @@ struct comm_runtime {
36 u8 vh, u8 vl); 36 u8 vh, u8 vl);
37}; 37};
38 38
39int __devinit usb6fire_comm_init(struct sfire_chip *chip); 39int usb6fire_comm_init(struct sfire_chip *chip);
40void usb6fire_comm_abort(struct sfire_chip *chip); 40void usb6fire_comm_abort(struct sfire_chip *chip);
41void usb6fire_comm_destroy(struct sfire_chip *chip); 41void usb6fire_comm_destroy(struct sfire_chip *chip);
42#endif /* USB6FIRE_COMM_H */ 42#endif /* USB6FIRE_COMM_H */
diff --git a/sound/usb/6fire/control.c b/sound/usb/6fire/control.c
index 07ed914d5e71..f6434c245720 100644
--- a/sound/usb/6fire/control.c
+++ b/sound/usb/6fire/control.c
@@ -411,7 +411,7 @@ static int usb6fire_control_digital_thru_get(struct snd_kcontrol *kcontrol,
411 return 0; 411 return 0;
412} 412}
413 413
414static struct __devinitdata snd_kcontrol_new vol_elements[] = { 414static struct snd_kcontrol_new vol_elements[] = {
415 { 415 {
416 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 416 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
417 .name = "Analog Playback Volume", 417 .name = "Analog Playback Volume",
@@ -451,7 +451,7 @@ static struct __devinitdata snd_kcontrol_new vol_elements[] = {
451 {} 451 {}
452}; 452};
453 453
454static struct __devinitdata snd_kcontrol_new mute_elements[] = { 454static struct snd_kcontrol_new mute_elements[] = {
455 { 455 {
456 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 456 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
457 .name = "Analog Playback Switch", 457 .name = "Analog Playback Switch",
@@ -485,7 +485,7 @@ static struct __devinitdata snd_kcontrol_new mute_elements[] = {
485 {} 485 {}
486}; 486};
487 487
488static struct __devinitdata snd_kcontrol_new elements[] = { 488static struct snd_kcontrol_new elements[] = {
489 { 489 {
490 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 490 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
491 .name = "Line/Phono Capture Route", 491 .name = "Line/Phono Capture Route",
@@ -561,7 +561,7 @@ static int usb6fire_control_add_virtual(
561 return 0; 561 return 0;
562} 562}
563 563
564int __devinit usb6fire_control_init(struct sfire_chip *chip) 564int usb6fire_control_init(struct sfire_chip *chip)
565{ 565{
566 int i; 566 int i;
567 int ret; 567 int ret;
diff --git a/sound/usb/6fire/control.h b/sound/usb/6fire/control.h
index 9a596d95474a..5a40ba143489 100644
--- a/sound/usb/6fire/control.h
+++ b/sound/usb/6fire/control.h
@@ -50,7 +50,7 @@ struct control_runtime {
50 u8 ivol_updated; 50 u8 ivol_updated;
51}; 51};
52 52
53int __devinit usb6fire_control_init(struct sfire_chip *chip); 53int usb6fire_control_init(struct sfire_chip *chip);
54void usb6fire_control_abort(struct sfire_chip *chip); 54void usb6fire_control_abort(struct sfire_chip *chip);
55void usb6fire_control_destroy(struct sfire_chip *chip); 55void usb6fire_control_destroy(struct sfire_chip *chip);
56#endif /* USB6FIRE_CONTROL_H */ 56#endif /* USB6FIRE_CONTROL_H */
diff --git a/sound/usb/6fire/firmware.h b/sound/usb/6fire/firmware.h
index 008569895381..c109c4f75aba 100644
--- a/sound/usb/6fire/firmware.h
+++ b/sound/usb/6fire/firmware.h
@@ -22,6 +22,6 @@ enum /* firmware state of device */
22 FW_NOT_READY = 1 22 FW_NOT_READY = 1
23}; 23};
24 24
25int __devinit usb6fire_fw_init(struct usb_interface *intf); 25int usb6fire_fw_init(struct usb_interface *intf);
26#endif /* USB6FIRE_FIRMWARE_H */ 26#endif /* USB6FIRE_FIRMWARE_H */
27 27
diff --git a/sound/usb/6fire/midi.c b/sound/usb/6fire/midi.c
index f0e5179b242b..26722423330d 100644
--- a/sound/usb/6fire/midi.c
+++ b/sound/usb/6fire/midi.c
@@ -146,7 +146,7 @@ static struct snd_rawmidi_ops in_ops = {
146 .trigger = usb6fire_midi_in_trigger 146 .trigger = usb6fire_midi_in_trigger
147}; 147};
148 148
149int __devinit usb6fire_midi_init(struct sfire_chip *chip) 149int usb6fire_midi_init(struct sfire_chip *chip)
150{ 150{
151 int ret; 151 int ret;
152 struct midi_runtime *rt = kzalloc(sizeof(struct midi_runtime), 152 struct midi_runtime *rt = kzalloc(sizeof(struct midi_runtime),
diff --git a/sound/usb/6fire/midi.h b/sound/usb/6fire/midi.h
index 5114eccc1d8e..c321006e5430 100644
--- a/sound/usb/6fire/midi.h
+++ b/sound/usb/6fire/midi.h
@@ -38,7 +38,7 @@ struct midi_runtime {
38 void (*in_received)(struct midi_runtime *rt, u8 *data, int length); 38 void (*in_received)(struct midi_runtime *rt, u8 *data, int length);
39}; 39};
40 40
41int __devinit usb6fire_midi_init(struct sfire_chip *chip); 41int usb6fire_midi_init(struct sfire_chip *chip);
42void usb6fire_midi_abort(struct sfire_chip *chip); 42void usb6fire_midi_abort(struct sfire_chip *chip);
43void usb6fire_midi_destroy(struct sfire_chip *chip); 43void usb6fire_midi_destroy(struct sfire_chip *chip);
44#endif /* USB6FIRE_MIDI_H */ 44#endif /* USB6FIRE_MIDI_H */
diff --git a/sound/usb/6fire/pcm.c b/sound/usb/6fire/pcm.c
index c97d05f0e966..e2ca12fe92e9 100644
--- a/sound/usb/6fire/pcm.c
+++ b/sound/usb/6fire/pcm.c
@@ -135,6 +135,9 @@ static void usb6fire_pcm_stream_stop(struct pcm_runtime *rt)
135 struct control_runtime *ctrl_rt = rt->chip->control; 135 struct control_runtime *ctrl_rt = rt->chip->control;
136 136
137 if (rt->stream_state != STREAM_DISABLED) { 137 if (rt->stream_state != STREAM_DISABLED) {
138
139 rt->stream_state = STREAM_STOPPING;
140
138 for (i = 0; i < PCM_N_URBS; i++) { 141 for (i = 0; i < PCM_N_URBS; i++) {
139 usb_kill_urb(&rt->in_urbs[i].instance); 142 usb_kill_urb(&rt->in_urbs[i].instance);
140 usb_kill_urb(&rt->out_urbs[i].instance); 143 usb_kill_urb(&rt->out_urbs[i].instance);
@@ -559,9 +562,9 @@ static struct snd_pcm_ops pcm_ops = {
559 .pointer = usb6fire_pcm_pointer, 562 .pointer = usb6fire_pcm_pointer,
560}; 563};
561 564
562static void __devinit usb6fire_pcm_init_urb(struct pcm_urb *urb, 565static void usb6fire_pcm_init_urb(struct pcm_urb *urb,
563 struct sfire_chip *chip, bool in, int ep, 566 struct sfire_chip *chip, bool in, int ep,
564 void (*handler)(struct urb *)) 567 void (*handler)(struct urb *))
565{ 568{
566 urb->chip = chip; 569 urb->chip = chip;
567 usb_init_urb(&urb->instance); 570 usb_init_urb(&urb->instance);
@@ -578,7 +581,7 @@ static void __devinit usb6fire_pcm_init_urb(struct pcm_urb *urb,
578 urb->instance.number_of_packets = PCM_N_PACKETS_PER_URB; 581 urb->instance.number_of_packets = PCM_N_PACKETS_PER_URB;
579} 582}
580 583
581int __devinit usb6fire_pcm_init(struct sfire_chip *chip) 584int usb6fire_pcm_init(struct sfire_chip *chip)
582{ 585{
583 int i; 586 int i;
584 int ret; 587 int ret;
diff --git a/sound/usb/6fire/pcm.h b/sound/usb/6fire/pcm.h
index 3104301b257d..9b01133ee3fe 100644
--- a/sound/usb/6fire/pcm.h
+++ b/sound/usb/6fire/pcm.h
@@ -69,7 +69,7 @@ struct pcm_runtime {
69 bool stream_wait_cond; 69 bool stream_wait_cond;
70}; 70};
71 71
72int __devinit usb6fire_pcm_init(struct sfire_chip *chip); 72int usb6fire_pcm_init(struct sfire_chip *chip);
73void usb6fire_pcm_abort(struct sfire_chip *chip); 73void usb6fire_pcm_abort(struct sfire_chip *chip);
74void usb6fire_pcm_destroy(struct sfire_chip *chip); 74void usb6fire_pcm_destroy(struct sfire_chip *chip);
75#endif /* USB6FIRE_PCM_H */ 75#endif /* USB6FIRE_PCM_H */
diff --git a/sound/usb/Kconfig b/sound/usb/Kconfig
index ff77b28f3da1..225dfd737265 100644
--- a/sound/usb/Kconfig
+++ b/sound/usb/Kconfig
@@ -90,7 +90,7 @@ config SND_USB_CAIAQ_INPUT
90 90
91config SND_USB_US122L 91config SND_USB_US122L
92 tristate "Tascam US-122L USB driver" 92 tristate "Tascam US-122L USB driver"
93 depends on X86 && EXPERIMENTAL 93 depends on X86
94 select SND_HWDEP 94 select SND_HWDEP
95 select SND_RAWMIDI 95 select SND_RAWMIDI
96 help 96 help
diff --git a/sound/usb/caiaq/control.c b/sound/usb/caiaq/control.c
index 00e5d0a469e1..adb8d03267a0 100644
--- a/sound/usb/caiaq/control.c
+++ b/sound/usb/caiaq/control.c
@@ -137,7 +137,7 @@ static int control_put(struct snd_kcontrol *kcontrol,
137 return 1; 137 return 1;
138} 138}
139 139
140static struct snd_kcontrol_new kcontrol_template __devinitdata = { 140static struct snd_kcontrol_new kcontrol_template = {
141 .iface = SNDRV_CTL_ELEM_IFACE_HWDEP, 141 .iface = SNDRV_CTL_ELEM_IFACE_HWDEP,
142 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE, 142 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE,
143 .index = 0, 143 .index = 0,
@@ -489,8 +489,8 @@ static struct caiaq_controller kontrols4_controller[] = {
489 { "LED: FX2: Mode", 133 | CNT_INTVAL }, 489 { "LED: FX2: Mode", 133 | CNT_INTVAL },
490}; 490};
491 491
492static int __devinit add_controls(struct caiaq_controller *c, int num, 492static int add_controls(struct caiaq_controller *c, int num,
493 struct snd_usb_caiaqdev *dev) 493 struct snd_usb_caiaqdev *dev)
494{ 494{
495 int i, ret; 495 int i, ret;
496 struct snd_kcontrol *kc; 496 struct snd_kcontrol *kc;
@@ -507,7 +507,7 @@ static int __devinit add_controls(struct caiaq_controller *c, int num,
507 return 0; 507 return 0;
508} 508}
509 509
510int __devinit snd_usb_caiaq_control_init(struct snd_usb_caiaqdev *dev) 510int snd_usb_caiaq_control_init(struct snd_usb_caiaqdev *dev)
511{ 511{
512 int ret = 0; 512 int ret = 0;
513 513
diff --git a/sound/usb/caiaq/device.c b/sound/usb/caiaq/device.c
index 7da0d0aa72cb..c828f8189c25 100644
--- a/sound/usb/caiaq/device.c
+++ b/sound/usb/caiaq/device.c
@@ -289,7 +289,7 @@ int snd_usb_caiaq_set_auto_msg(struct snd_usb_caiaqdev *dev,
289 tmp, sizeof(tmp)); 289 tmp, sizeof(tmp));
290} 290}
291 291
292static void __devinit setup_card(struct snd_usb_caiaqdev *dev) 292static void setup_card(struct snd_usb_caiaqdev *dev)
293{ 293{
294 int ret; 294 int ret;
295 char val[4]; 295 char val[4];
@@ -407,7 +407,7 @@ static int create_card(struct usb_device *usb_dev,
407 return 0; 407 return 0;
408} 408}
409 409
410static int __devinit init_card(struct snd_usb_caiaqdev *dev) 410static int init_card(struct snd_usb_caiaqdev *dev)
411{ 411{
412 char *c, usbpath[32]; 412 char *c, usbpath[32];
413 struct usb_device *usb_dev = dev->chip.dev; 413 struct usb_device *usb_dev = dev->chip.dev;
@@ -481,7 +481,7 @@ static int __devinit init_card(struct snd_usb_caiaqdev *dev)
481 return 0; 481 return 0;
482} 482}
483 483
484static int __devinit snd_probe(struct usb_interface *intf, 484static int snd_probe(struct usb_interface *intf,
485 const struct usb_device_id *id) 485 const struct usb_device_id *id)
486{ 486{
487 int ret; 487 int ret;
diff --git a/sound/usb/card.c b/sound/usb/card.c
index dbf7999d18b4..ccf95cfe186f 100644
--- a/sound/usb/card.c
+++ b/sound/usb/card.c
@@ -25,9 +25,6 @@
25 * 25 *
26 * NOTES: 26 * NOTES:
27 * 27 *
28 * - async unlink should be used for avoiding the sleep inside lock.
29 * 2.4.22 usb-uhci seems buggy for async unlinking and results in
30 * oops. in such a cse, pass async_unlink=0 option.
31 * - the linked URBs would be preferred but not used so far because of 28 * - the linked URBs would be preferred but not used so far because of
32 * the instability of unlinking. 29 * the instability of unlinking.
33 * - type II is not supported properly. there is no device which supports 30 * - type II is not supported properly. there is no device which supports
@@ -83,7 +80,6 @@ static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;/* Enable this card *
83static int vid[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = -1 }; 80static int vid[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = -1 };
84static int pid[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = -1 }; 81static int pid[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = -1 };
85static int nrpacks = 8; /* max. number of packets per urb */ 82static int nrpacks = 8; /* max. number of packets per urb */
86static bool async_unlink = 1;
87static int device_setup[SNDRV_CARDS]; /* device parameter for this card */ 83static int device_setup[SNDRV_CARDS]; /* device parameter for this card */
88static bool ignore_ctl_error; 84static bool ignore_ctl_error;
89 85
@@ -99,8 +95,6 @@ module_param_array(pid, int, NULL, 0444);
99MODULE_PARM_DESC(pid, "Product ID for the USB audio device."); 95MODULE_PARM_DESC(pid, "Product ID for the USB audio device.");
100module_param(nrpacks, int, 0644); 96module_param(nrpacks, int, 0644);
101MODULE_PARM_DESC(nrpacks, "Max. number of packets per URB."); 97MODULE_PARM_DESC(nrpacks, "Max. number of packets per URB.");
102module_param(async_unlink, bool, 0444);
103MODULE_PARM_DESC(async_unlink, "Use async unlink mode.");
104module_param_array(device_setup, int, NULL, 0444); 98module_param_array(device_setup, int, NULL, 0444);
105MODULE_PARM_DESC(device_setup, "Specific device setup (if needed)."); 99MODULE_PARM_DESC(device_setup, "Specific device setup (if needed).");
106module_param(ignore_ctl_error, bool, 0444); 100module_param(ignore_ctl_error, bool, 0444);
@@ -345,7 +339,6 @@ static int snd_usb_audio_create(struct usb_device *dev, int idx,
345 chip->card = card; 339 chip->card = card;
346 chip->setup = device_setup[idx]; 340 chip->setup = device_setup[idx];
347 chip->nrpacks = nrpacks; 341 chip->nrpacks = nrpacks;
348 chip->async_unlink = async_unlink;
349 chip->probing = 1; 342 chip->probing = 1;
350 343
351 chip->usb_id = USB_ID(le16_to_cpu(dev->descriptor.idVendor), 344 chip->usb_id = USB_ID(le16_to_cpu(dev->descriptor.idVendor),
diff --git a/sound/usb/card.h b/sound/usb/card.h
index 814cb357ff88..8a751b4887ea 100644
--- a/sound/usb/card.h
+++ b/sound/usb/card.h
@@ -27,6 +27,7 @@ struct audioformat {
27 unsigned int nr_rates; /* number of rate table entries */ 27 unsigned int nr_rates; /* number of rate table entries */
28 unsigned int *rate_table; /* rate table */ 28 unsigned int *rate_table; /* rate table */
29 unsigned char clock; /* associated clock */ 29 unsigned char clock; /* associated clock */
30 struct snd_pcm_chmap_elem *chmap; /* (optional) channel map */
30}; 31};
31 32
32struct snd_usb_substream; 33struct snd_usb_substream;
@@ -109,6 +110,7 @@ struct snd_usb_substream {
109 struct audioformat *cur_audiofmt; /* current audioformat pointer (for hw_params callback) */ 110 struct audioformat *cur_audiofmt; /* current audioformat pointer (for hw_params callback) */
110 snd_pcm_format_t pcm_format; /* current audio format (for hw_params callback) */ 111 snd_pcm_format_t pcm_format; /* current audio format (for hw_params callback) */
111 unsigned int channels; /* current number of channels (for hw_params callback) */ 112 unsigned int channels; /* current number of channels (for hw_params callback) */
113 unsigned int channels_max; /* max channels in the all audiofmts */
112 unsigned int cur_rate; /* current rate (for hw_params callback) */ 114 unsigned int cur_rate; /* current rate (for hw_params callback) */
113 unsigned int period_bytes; /* current period bytes (for hw_params callback) */ 115 unsigned int period_bytes; /* current period bytes (for hw_params callback) */
114 unsigned int altset_idx; /* USB data format: index of alternate setting */ 116 unsigned int altset_idx; /* USB data format: index of alternate setting */
diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c
index 34de6f2faf61..21049b882ee6 100644
--- a/sound/usb/endpoint.c
+++ b/sound/usb/endpoint.c
@@ -485,15 +485,10 @@ __exit_unlock:
485static int wait_clear_urbs(struct snd_usb_endpoint *ep) 485static int wait_clear_urbs(struct snd_usb_endpoint *ep)
486{ 486{
487 unsigned long end_time = jiffies + msecs_to_jiffies(1000); 487 unsigned long end_time = jiffies + msecs_to_jiffies(1000);
488 unsigned int i;
489 int alive; 488 int alive;
490 489
491 do { 490 do {
492 alive = 0; 491 alive = bitmap_weight(&ep->active_mask, ep->nurbs);
493 for (i = 0; i < ep->nurbs; i++)
494 if (test_bit(i, &ep->active_mask))
495 alive++;
496
497 if (!alive) 492 if (!alive)
498 break; 493 break;
499 494
@@ -520,33 +515,24 @@ void snd_usb_endpoint_sync_pending_stop(struct snd_usb_endpoint *ep)
520/* 515/*
521 * unlink active urbs. 516 * unlink active urbs.
522 */ 517 */
523static int deactivate_urbs(struct snd_usb_endpoint *ep, int force, int can_sleep) 518static int deactivate_urbs(struct snd_usb_endpoint *ep, bool force)
524{ 519{
525 unsigned int i; 520 unsigned int i;
526 int async;
527 521
528 if (!force && ep->chip->shutdown) /* to be sure... */ 522 if (!force && ep->chip->shutdown) /* to be sure... */
529 return -EBADFD; 523 return -EBADFD;
530 524
531 async = !can_sleep && ep->chip->async_unlink;
532
533 clear_bit(EP_FLAG_RUNNING, &ep->flags); 525 clear_bit(EP_FLAG_RUNNING, &ep->flags);
534 526
535 INIT_LIST_HEAD(&ep->ready_playback_urbs); 527 INIT_LIST_HEAD(&ep->ready_playback_urbs);
536 ep->next_packet_read_pos = 0; 528 ep->next_packet_read_pos = 0;
537 ep->next_packet_write_pos = 0; 529 ep->next_packet_write_pos = 0;
538 530
539 if (!async && in_interrupt())
540 return 0;
541
542 for (i = 0; i < ep->nurbs; i++) { 531 for (i = 0; i < ep->nurbs; i++) {
543 if (test_bit(i, &ep->active_mask)) { 532 if (test_bit(i, &ep->active_mask)) {
544 if (!test_and_set_bit(i, &ep->unlink_mask)) { 533 if (!test_and_set_bit(i, &ep->unlink_mask)) {
545 struct urb *u = ep->urb[i].urb; 534 struct urb *u = ep->urb[i].urb;
546 if (async) 535 usb_unlink_urb(u);
547 usb_unlink_urb(u);
548 else
549 usb_kill_urb(u);
550 } 536 }
551 } 537 }
552 } 538 }
@@ -566,7 +552,7 @@ static void release_urbs(struct snd_usb_endpoint *ep, int force)
566 ep->prepare_data_urb = NULL; 552 ep->prepare_data_urb = NULL;
567 553
568 /* stop urbs */ 554 /* stop urbs */
569 deactivate_urbs(ep, force, 1); 555 deactivate_urbs(ep, force);
570 wait_clear_urbs(ep); 556 wait_clear_urbs(ep);
571 557
572 for (i = 0; i < ep->nurbs; i++) 558 for (i = 0; i < ep->nurbs; i++)
@@ -829,7 +815,7 @@ int snd_usb_endpoint_set_params(struct snd_usb_endpoint *ep,
829 * 815 *
830 * Returns an error if the URB submission failed, 0 in all other cases. 816 * Returns an error if the URB submission failed, 0 in all other cases.
831 */ 817 */
832int snd_usb_endpoint_start(struct snd_usb_endpoint *ep, int can_sleep) 818int snd_usb_endpoint_start(struct snd_usb_endpoint *ep, bool can_sleep)
833{ 819{
834 int err; 820 int err;
835 unsigned int i; 821 unsigned int i;
@@ -842,7 +828,7 @@ int snd_usb_endpoint_start(struct snd_usb_endpoint *ep, int can_sleep)
842 return 0; 828 return 0;
843 829
844 /* just to be sure */ 830 /* just to be sure */
845 deactivate_urbs(ep, 0, can_sleep); 831 deactivate_urbs(ep, false);
846 if (can_sleep) 832 if (can_sleep)
847 wait_clear_urbs(ep); 833 wait_clear_urbs(ep);
848 834
@@ -896,7 +882,7 @@ int snd_usb_endpoint_start(struct snd_usb_endpoint *ep, int can_sleep)
896__error: 882__error:
897 clear_bit(EP_FLAG_RUNNING, &ep->flags); 883 clear_bit(EP_FLAG_RUNNING, &ep->flags);
898 ep->use_count--; 884 ep->use_count--;
899 deactivate_urbs(ep, 0, 0); 885 deactivate_urbs(ep, false);
900 return -EPIPE; 886 return -EPIPE;
901} 887}
902 888
@@ -910,9 +896,11 @@ __error:
910 * actually be deactivated. 896 * actually be deactivated.
911 * 897 *
912 * Must be balanced to calls of snd_usb_endpoint_start(). 898 * Must be balanced to calls of snd_usb_endpoint_start().
899 *
900 * The caller needs to synchronize the pending stop operation via
901 * snd_usb_endpoint_sync_pending_stop().
913 */ 902 */
914void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep, 903void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep)
915 int force, int can_sleep, int wait)
916{ 904{
917 if (!ep) 905 if (!ep)
918 return; 906 return;
@@ -921,16 +909,12 @@ void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep,
921 return; 909 return;
922 910
923 if (--ep->use_count == 0) { 911 if (--ep->use_count == 0) {
924 deactivate_urbs(ep, force, can_sleep); 912 deactivate_urbs(ep, false);
925 ep->data_subs = NULL; 913 ep->data_subs = NULL;
926 ep->sync_slave = NULL; 914 ep->sync_slave = NULL;
927 ep->retire_data_urb = NULL; 915 ep->retire_data_urb = NULL;
928 ep->prepare_data_urb = NULL; 916 ep->prepare_data_urb = NULL;
929 917 set_bit(EP_FLAG_STOPPING, &ep->flags);
930 if (wait)
931 wait_clear_urbs(ep);
932 else
933 set_bit(EP_FLAG_STOPPING, &ep->flags);
934 } 918 }
935} 919}
936 920
@@ -952,7 +936,7 @@ int snd_usb_endpoint_deactivate(struct snd_usb_endpoint *ep)
952 if (!ep) 936 if (!ep)
953 return -EINVAL; 937 return -EINVAL;
954 938
955 deactivate_urbs(ep, 1, 1); 939 deactivate_urbs(ep, true);
956 wait_clear_urbs(ep); 940 wait_clear_urbs(ep);
957 941
958 if (ep->use_count != 0) 942 if (ep->use_count != 0)
@@ -1034,15 +1018,18 @@ void snd_usb_handle_sync_urb(struct snd_usb_endpoint *ep,
1034 /* 1018 /*
1035 * Iterate through the inbound packet and prepare the lengths 1019 * Iterate through the inbound packet and prepare the lengths
1036 * for the output packet. The OUT packet we are about to send 1020 * for the output packet. The OUT packet we are about to send
1037 * will have the same amount of payload bytes than the IN 1021 * will have the same amount of payload bytes per stride as the
1038 * packet we just received. 1022 * IN packet we just received. Since the actual size is scaled
1023 * by the stride, use the sender stride to calculate the length
1024 * in case the number of channels differ between the implicitly
1025 * fed-back endpoint and the synchronizing endpoint.
1039 */ 1026 */
1040 1027
1041 out_packet->packets = in_ctx->packets; 1028 out_packet->packets = in_ctx->packets;
1042 for (i = 0; i < in_ctx->packets; i++) { 1029 for (i = 0; i < in_ctx->packets; i++) {
1043 if (urb->iso_frame_desc[i].status == 0) 1030 if (urb->iso_frame_desc[i].status == 0)
1044 out_packet->packet_size[i] = 1031 out_packet->packet_size[i] =
1045 urb->iso_frame_desc[i].actual_length / ep->stride; 1032 urb->iso_frame_desc[i].actual_length / sender->stride;
1046 else 1033 else
1047 out_packet->packet_size[i] = 0; 1034 out_packet->packet_size[i] = 0;
1048 } 1035 }
diff --git a/sound/usb/endpoint.h b/sound/usb/endpoint.h
index 3d4c9705041f..447902dd8a4a 100644
--- a/sound/usb/endpoint.h
+++ b/sound/usb/endpoint.h
@@ -16,9 +16,8 @@ int snd_usb_endpoint_set_params(struct snd_usb_endpoint *ep,
16 struct audioformat *fmt, 16 struct audioformat *fmt,
17 struct snd_usb_endpoint *sync_ep); 17 struct snd_usb_endpoint *sync_ep);
18 18
19int snd_usb_endpoint_start(struct snd_usb_endpoint *ep, int can_sleep); 19int snd_usb_endpoint_start(struct snd_usb_endpoint *ep, bool can_sleep);
20void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep, 20void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep);
21 int force, int can_sleep, int wait);
22void snd_usb_endpoint_sync_pending_stop(struct snd_usb_endpoint *ep); 21void snd_usb_endpoint_sync_pending_stop(struct snd_usb_endpoint *ep);
23int snd_usb_endpoint_activate(struct snd_usb_endpoint *ep); 22int snd_usb_endpoint_activate(struct snd_usb_endpoint *ep);
24int snd_usb_endpoint_deactivate(struct snd_usb_endpoint *ep); 23int snd_usb_endpoint_deactivate(struct snd_usb_endpoint *ep);
diff --git a/sound/usb/format.c b/sound/usb/format.c
index ddfef57c4c9f..e831ee4238bb 100644
--- a/sound/usb/format.c
+++ b/sound/usb/format.c
@@ -155,7 +155,7 @@ static int parse_audio_format_rates_v1(struct snd_usb_audio *chip, struct audiof
155 if (fmt[0] < offset + 1 + 3 * (nr_rates ? nr_rates : 2)) { 155 if (fmt[0] < offset + 1 + 3 * (nr_rates ? nr_rates : 2)) {
156 snd_printk(KERN_ERR "%d:%u:%d : invalid UAC_FORMAT_TYPE desc\n", 156 snd_printk(KERN_ERR "%d:%u:%d : invalid UAC_FORMAT_TYPE desc\n",
157 chip->dev->devnum, fp->iface, fp->altsetting); 157 chip->dev->devnum, fp->iface, fp->altsetting);
158 return -1; 158 return -EINVAL;
159 } 159 }
160 160
161 if (nr_rates) { 161 if (nr_rates) {
@@ -167,7 +167,7 @@ static int parse_audio_format_rates_v1(struct snd_usb_audio *chip, struct audiof
167 fp->rate_table = kmalloc(sizeof(int) * nr_rates, GFP_KERNEL); 167 fp->rate_table = kmalloc(sizeof(int) * nr_rates, GFP_KERNEL);
168 if (fp->rate_table == NULL) { 168 if (fp->rate_table == NULL) {
169 snd_printk(KERN_ERR "cannot malloc\n"); 169 snd_printk(KERN_ERR "cannot malloc\n");
170 return -1; 170 return -ENOMEM;
171 } 171 }
172 172
173 fp->nr_rates = 0; 173 fp->nr_rates = 0;
@@ -198,7 +198,7 @@ static int parse_audio_format_rates_v1(struct snd_usb_audio *chip, struct audiof
198 } 198 }
199 if (!fp->nr_rates) { 199 if (!fp->nr_rates) {
200 hwc_debug("All rates were zero. Skipping format!\n"); 200 hwc_debug("All rates were zero. Skipping format!\n");
201 return -1; 201 return -EINVAL;
202 } 202 }
203 } else { 203 } else {
204 /* continuous rates */ 204 /* continuous rates */
@@ -383,7 +383,7 @@ static int parse_audio_format_i(struct snd_usb_audio *chip,
383 fp->formats = parse_audio_format_i_type(chip, fp, format, 383 fp->formats = parse_audio_format_i_type(chip, fp, format,
384 fmt, protocol); 384 fmt, protocol);
385 if (!fp->formats) 385 if (!fp->formats)
386 return -1; 386 return -EINVAL;
387 } 387 }
388 388
389 /* gather possible sample rates */ 389 /* gather possible sample rates */
@@ -409,7 +409,7 @@ static int parse_audio_format_i(struct snd_usb_audio *chip,
409 if (fp->channels < 1) { 409 if (fp->channels < 1) {
410 snd_printk(KERN_ERR "%d:%u:%d : invalid channels %d\n", 410 snd_printk(KERN_ERR "%d:%u:%d : invalid channels %d\n",
411 chip->dev->devnum, fp->iface, fp->altsetting, fp->channels); 411 chip->dev->devnum, fp->iface, fp->altsetting, fp->channels);
412 return -1; 412 return -EINVAL;
413 } 413 }
414 414
415 return ret; 415 return ret;
diff --git a/sound/usb/midi.c b/sound/usb/midi.c
index eeefbce3873c..34b9bb7fe87c 100644
--- a/sound/usb/midi.c
+++ b/sound/usb/midi.c
@@ -116,6 +116,7 @@ struct snd_usb_midi {
116 struct list_head list; 116 struct list_head list;
117 struct timer_list error_timer; 117 struct timer_list error_timer;
118 spinlock_t disc_lock; 118 spinlock_t disc_lock;
119 struct rw_semaphore disc_rwsem;
119 struct mutex mutex; 120 struct mutex mutex;
120 u32 usb_id; 121 u32 usb_id;
121 int next_midi_device; 122 int next_midi_device;
@@ -125,8 +126,10 @@ struct snd_usb_midi {
125 struct snd_usb_midi_in_endpoint *in; 126 struct snd_usb_midi_in_endpoint *in;
126 } endpoints[MIDI_MAX_ENDPOINTS]; 127 } endpoints[MIDI_MAX_ENDPOINTS];
127 unsigned long input_triggered; 128 unsigned long input_triggered;
128 unsigned int opened; 129 bool autopm_reference;
130 unsigned int opened[2];
129 unsigned char disconnected; 131 unsigned char disconnected;
132 unsigned char input_running;
130 133
131 struct snd_kcontrol *roland_load_ctl; 134 struct snd_kcontrol *roland_load_ctl;
132}; 135};
@@ -148,7 +151,6 @@ struct snd_usb_midi_out_endpoint {
148 struct snd_usb_midi_out_endpoint* ep; 151 struct snd_usb_midi_out_endpoint* ep;
149 struct snd_rawmidi_substream *substream; 152 struct snd_rawmidi_substream *substream;
150 int active; 153 int active;
151 bool autopm_reference;
152 uint8_t cable; /* cable number << 4 */ 154 uint8_t cable; /* cable number << 4 */
153 uint8_t state; 155 uint8_t state;
154#define STATE_UNKNOWN 0 156#define STATE_UNKNOWN 0
@@ -1033,29 +1035,58 @@ static void update_roland_altsetting(struct snd_usb_midi* umidi)
1033 snd_usbmidi_input_start(&umidi->list); 1035 snd_usbmidi_input_start(&umidi->list);
1034} 1036}
1035 1037
1036static void substream_open(struct snd_rawmidi_substream *substream, int open) 1038static int substream_open(struct snd_rawmidi_substream *substream, int dir,
1039 int open)
1037{ 1040{
1038 struct snd_usb_midi* umidi = substream->rmidi->private_data; 1041 struct snd_usb_midi* umidi = substream->rmidi->private_data;
1039 struct snd_kcontrol *ctl; 1042 struct snd_kcontrol *ctl;
1043 int err;
1044
1045 down_read(&umidi->disc_rwsem);
1046 if (umidi->disconnected) {
1047 up_read(&umidi->disc_rwsem);
1048 return open ? -ENODEV : 0;
1049 }
1040 1050
1041 mutex_lock(&umidi->mutex); 1051 mutex_lock(&umidi->mutex);
1042 if (open) { 1052 if (open) {
1043 if (umidi->opened++ == 0 && umidi->roland_load_ctl) { 1053 if (!umidi->opened[0] && !umidi->opened[1]) {
1044 ctl = umidi->roland_load_ctl; 1054 err = usb_autopm_get_interface(umidi->iface);
1045 ctl->vd[0].access |= SNDRV_CTL_ELEM_ACCESS_INACTIVE; 1055 umidi->autopm_reference = err >= 0;
1046 snd_ctl_notify(umidi->card, 1056 if (err < 0 && err != -EACCES) {
1057 mutex_unlock(&umidi->mutex);
1058 up_read(&umidi->disc_rwsem);
1059 return -EIO;
1060 }
1061 if (umidi->roland_load_ctl) {
1062 ctl = umidi->roland_load_ctl;
1063 ctl->vd[0].access |= SNDRV_CTL_ELEM_ACCESS_INACTIVE;
1064 snd_ctl_notify(umidi->card,
1047 SNDRV_CTL_EVENT_MASK_INFO, &ctl->id); 1065 SNDRV_CTL_EVENT_MASK_INFO, &ctl->id);
1048 update_roland_altsetting(umidi); 1066 update_roland_altsetting(umidi);
1067 }
1049 } 1068 }
1069 umidi->opened[dir]++;
1070 if (umidi->opened[1])
1071 snd_usbmidi_input_start(&umidi->list);
1050 } else { 1072 } else {
1051 if (--umidi->opened == 0 && umidi->roland_load_ctl) { 1073 umidi->opened[dir]--;
1052 ctl = umidi->roland_load_ctl; 1074 if (!umidi->opened[1])
1053 ctl->vd[0].access &= ~SNDRV_CTL_ELEM_ACCESS_INACTIVE; 1075 snd_usbmidi_input_stop(&umidi->list);
1054 snd_ctl_notify(umidi->card, 1076 if (!umidi->opened[0] && !umidi->opened[1]) {
1077 if (umidi->roland_load_ctl) {
1078 ctl = umidi->roland_load_ctl;
1079 ctl->vd[0].access &= ~SNDRV_CTL_ELEM_ACCESS_INACTIVE;
1080 snd_ctl_notify(umidi->card,
1055 SNDRV_CTL_EVENT_MASK_INFO, &ctl->id); 1081 SNDRV_CTL_EVENT_MASK_INFO, &ctl->id);
1082 }
1083 if (umidi->autopm_reference)
1084 usb_autopm_put_interface(umidi->iface);
1056 } 1085 }
1057 } 1086 }
1058 mutex_unlock(&umidi->mutex); 1087 mutex_unlock(&umidi->mutex);
1088 up_read(&umidi->disc_rwsem);
1089 return 0;
1059} 1090}
1060 1091
1061static int snd_usbmidi_output_open(struct snd_rawmidi_substream *substream) 1092static int snd_usbmidi_output_open(struct snd_rawmidi_substream *substream)
@@ -1063,7 +1094,6 @@ static int snd_usbmidi_output_open(struct snd_rawmidi_substream *substream)
1063 struct snd_usb_midi* umidi = substream->rmidi->private_data; 1094 struct snd_usb_midi* umidi = substream->rmidi->private_data;
1064 struct usbmidi_out_port* port = NULL; 1095 struct usbmidi_out_port* port = NULL;
1065 int i, j; 1096 int i, j;
1066 int err;
1067 1097
1068 for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) 1098 for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i)
1069 if (umidi->endpoints[i].out) 1099 if (umidi->endpoints[i].out)
@@ -1076,25 +1106,15 @@ static int snd_usbmidi_output_open(struct snd_rawmidi_substream *substream)
1076 snd_BUG(); 1106 snd_BUG();
1077 return -ENXIO; 1107 return -ENXIO;
1078 } 1108 }
1079 err = usb_autopm_get_interface(umidi->iface); 1109
1080 port->autopm_reference = err >= 0;
1081 if (err < 0 && err != -EACCES)
1082 return -EIO;
1083 substream->runtime->private_data = port; 1110 substream->runtime->private_data = port;
1084 port->state = STATE_UNKNOWN; 1111 port->state = STATE_UNKNOWN;
1085 substream_open(substream, 1); 1112 return substream_open(substream, 0, 1);
1086 return 0;
1087} 1113}
1088 1114
1089static int snd_usbmidi_output_close(struct snd_rawmidi_substream *substream) 1115static int snd_usbmidi_output_close(struct snd_rawmidi_substream *substream)
1090{ 1116{
1091 struct snd_usb_midi* umidi = substream->rmidi->private_data; 1117 return substream_open(substream, 0, 0);
1092 struct usbmidi_out_port *port = substream->runtime->private_data;
1093
1094 substream_open(substream, 0);
1095 if (port->autopm_reference)
1096 usb_autopm_put_interface(umidi->iface);
1097 return 0;
1098} 1118}
1099 1119
1100static void snd_usbmidi_output_trigger(struct snd_rawmidi_substream *substream, int up) 1120static void snd_usbmidi_output_trigger(struct snd_rawmidi_substream *substream, int up)
@@ -1147,14 +1167,12 @@ static void snd_usbmidi_output_drain(struct snd_rawmidi_substream *substream)
1147 1167
1148static int snd_usbmidi_input_open(struct snd_rawmidi_substream *substream) 1168static int snd_usbmidi_input_open(struct snd_rawmidi_substream *substream)
1149{ 1169{
1150 substream_open(substream, 1); 1170 return substream_open(substream, 1, 1);
1151 return 0;
1152} 1171}
1153 1172
1154static int snd_usbmidi_input_close(struct snd_rawmidi_substream *substream) 1173static int snd_usbmidi_input_close(struct snd_rawmidi_substream *substream)
1155{ 1174{
1156 substream_open(substream, 0); 1175 return substream_open(substream, 1, 0);
1157 return 0;
1158} 1176}
1159 1177
1160static void snd_usbmidi_input_trigger(struct snd_rawmidi_substream *substream, int up) 1178static void snd_usbmidi_input_trigger(struct snd_rawmidi_substream *substream, int up)
@@ -1403,9 +1421,12 @@ void snd_usbmidi_disconnect(struct list_head* p)
1403 * a timer may submit an URB. To reliably break the cycle 1421 * a timer may submit an URB. To reliably break the cycle
1404 * a flag under lock must be used 1422 * a flag under lock must be used
1405 */ 1423 */
1424 down_write(&umidi->disc_rwsem);
1406 spin_lock_irq(&umidi->disc_lock); 1425 spin_lock_irq(&umidi->disc_lock);
1407 umidi->disconnected = 1; 1426 umidi->disconnected = 1;
1408 spin_unlock_irq(&umidi->disc_lock); 1427 spin_unlock_irq(&umidi->disc_lock);
1428 up_write(&umidi->disc_rwsem);
1429
1409 for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) { 1430 for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) {
1410 struct snd_usb_midi_endpoint* ep = &umidi->endpoints[i]; 1431 struct snd_usb_midi_endpoint* ep = &umidi->endpoints[i];
1411 if (ep->out) 1432 if (ep->out)
@@ -2060,12 +2081,15 @@ void snd_usbmidi_input_stop(struct list_head* p)
2060 unsigned int i, j; 2081 unsigned int i, j;
2061 2082
2062 umidi = list_entry(p, struct snd_usb_midi, list); 2083 umidi = list_entry(p, struct snd_usb_midi, list);
2084 if (!umidi->input_running)
2085 return;
2063 for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) { 2086 for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) {
2064 struct snd_usb_midi_endpoint* ep = &umidi->endpoints[i]; 2087 struct snd_usb_midi_endpoint* ep = &umidi->endpoints[i];
2065 if (ep->in) 2088 if (ep->in)
2066 for (j = 0; j < INPUT_URBS; ++j) 2089 for (j = 0; j < INPUT_URBS; ++j)
2067 usb_kill_urb(ep->in->urbs[j]); 2090 usb_kill_urb(ep->in->urbs[j]);
2068 } 2091 }
2092 umidi->input_running = 0;
2069} 2093}
2070 2094
2071static void snd_usbmidi_input_start_ep(struct snd_usb_midi_in_endpoint* ep) 2095static void snd_usbmidi_input_start_ep(struct snd_usb_midi_in_endpoint* ep)
@@ -2090,8 +2114,11 @@ void snd_usbmidi_input_start(struct list_head* p)
2090 int i; 2114 int i;
2091 2115
2092 umidi = list_entry(p, struct snd_usb_midi, list); 2116 umidi = list_entry(p, struct snd_usb_midi, list);
2117 if (umidi->input_running || !umidi->opened[1])
2118 return;
2093 for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i) 2119 for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i)
2094 snd_usbmidi_input_start_ep(umidi->endpoints[i].in); 2120 snd_usbmidi_input_start_ep(umidi->endpoints[i].in);
2121 umidi->input_running = 1;
2095} 2122}
2096 2123
2097/* 2124/*
@@ -2117,6 +2144,7 @@ int snd_usbmidi_create(struct snd_card *card,
2117 umidi->usb_protocol_ops = &snd_usbmidi_standard_ops; 2144 umidi->usb_protocol_ops = &snd_usbmidi_standard_ops;
2118 init_timer(&umidi->error_timer); 2145 init_timer(&umidi->error_timer);
2119 spin_lock_init(&umidi->disc_lock); 2146 spin_lock_init(&umidi->disc_lock);
2147 init_rwsem(&umidi->disc_rwsem);
2120 mutex_init(&umidi->mutex); 2148 mutex_init(&umidi->mutex);
2121 umidi->usb_id = USB_ID(le16_to_cpu(umidi->dev->descriptor.idVendor), 2149 umidi->usb_id = USB_ID(le16_to_cpu(umidi->dev->descriptor.idVendor),
2122 le16_to_cpu(umidi->dev->descriptor.idProduct)); 2150 le16_to_cpu(umidi->dev->descriptor.idProduct));
@@ -2229,9 +2257,6 @@ int snd_usbmidi_create(struct snd_card *card,
2229 } 2257 }
2230 2258
2231 list_add_tail(&umidi->list, midi_list); 2259 list_add_tail(&umidi->list, midi_list);
2232
2233 for (i = 0; i < MIDI_MAX_ENDPOINTS; ++i)
2234 snd_usbmidi_input_start_ep(umidi->endpoints[i].in);
2235 return 0; 2260 return 0;
2236} 2261}
2237 2262
diff --git a/sound/usb/mixer.c b/sound/usb/mixer.c
index 298070e8f2d4..ed4d89c8b52a 100644
--- a/sound/usb/mixer.c
+++ b/sound/usb/mixer.c
@@ -382,6 +382,8 @@ error:
382 382
383static int get_ctl_value(struct usb_mixer_elem_info *cval, int request, int validx, int *value_ret) 383static int get_ctl_value(struct usb_mixer_elem_info *cval, int request, int validx, int *value_ret)
384{ 384{
385 validx += cval->idx_off;
386
385 return (cval->mixer->protocol == UAC_VERSION_1) ? 387 return (cval->mixer->protocol == UAC_VERSION_1) ?
386 get_ctl_value_v1(cval, request, validx, value_ret) : 388 get_ctl_value_v1(cval, request, validx, value_ret) :
387 get_ctl_value_v2(cval, request, validx, value_ret); 389 get_ctl_value_v2(cval, request, validx, value_ret);
@@ -432,6 +434,8 @@ int snd_usb_mixer_set_ctl_value(struct usb_mixer_elem_info *cval,
432 unsigned char buf[2]; 434 unsigned char buf[2];
433 int idx = 0, val_len, err, timeout = 10; 435 int idx = 0, val_len, err, timeout = 10;
434 436
437 validx += cval->idx_off;
438
435 if (cval->mixer->protocol == UAC_VERSION_1) { 439 if (cval->mixer->protocol == UAC_VERSION_1) {
436 val_len = cval->val_type >= USB_MIXER_S16 ? 2 : 1; 440 val_len = cval->val_type >= USB_MIXER_S16 ? 2 : 1;
437 } else { /* UAC_VERSION_2 */ 441 } else { /* UAC_VERSION_2 */
@@ -719,8 +723,19 @@ static int check_input_term(struct mixer_build *state, int id, struct usb_audio_
719 return 0; 723 return 0;
720 } 724 }
721 case UAC1_PROCESSING_UNIT: 725 case UAC1_PROCESSING_UNIT:
722 case UAC1_EXTENSION_UNIT: { 726 case UAC1_EXTENSION_UNIT:
727 /* UAC2_PROCESSING_UNIT_V2 */
728 /* UAC2_EFFECT_UNIT */ {
723 struct uac_processing_unit_descriptor *d = p1; 729 struct uac_processing_unit_descriptor *d = p1;
730
731 if (state->mixer->protocol == UAC_VERSION_2 &&
732 hdr[2] == UAC2_EFFECT_UNIT) {
733 /* UAC2/UAC1 unit IDs overlap here in an
734 * uncompatible way. Ignore this unit for now.
735 */
736 return 0;
737 }
738
724 if (d->bNrInPins) { 739 if (d->bNrInPins) {
725 id = d->baSourceID[0]; 740 id = d->baSourceID[0];
726 break; /* continue to parse */ 741 break; /* continue to parse */
@@ -791,6 +806,33 @@ static void volume_control_quirks(struct usb_mixer_elem_info *cval,
791 struct snd_kcontrol *kctl) 806 struct snd_kcontrol *kctl)
792{ 807{
793 switch (cval->mixer->chip->usb_id) { 808 switch (cval->mixer->chip->usb_id) {
809 case USB_ID(0x0763, 0x2030): /* M-Audio Fast Track C400 */
810 if (strcmp(kctl->id.name, "Effect Duration") == 0) {
811 cval->min = 0x0000;
812 cval->max = 0xffff;
813 cval->res = 0x00e6;
814 break;
815 }
816 if (strcmp(kctl->id.name, "Effect Volume") == 0 ||
817 strcmp(kctl->id.name, "Effect Feedback Volume") == 0) {
818 cval->min = 0x00;
819 cval->max = 0xff;
820 break;
821 }
822 if (strstr(kctl->id.name, "Effect Return") != NULL) {
823 cval->min = 0xb706;
824 cval->max = 0xff7b;
825 cval->res = 0x0073;
826 break;
827 }
828 if ((strstr(kctl->id.name, "Playback Volume") != NULL) ||
829 (strstr(kctl->id.name, "Effect Send") != NULL)) {
830 cval->min = 0xb5fb; /* -73 dB = 0xb6ff */
831 cval->max = 0xfcfe;
832 cval->res = 0x0073;
833 }
834 break;
835
794 case USB_ID(0x0763, 0x2081): /* M-Audio Fast Track Ultra 8R */ 836 case USB_ID(0x0763, 0x2081): /* M-Audio Fast Track Ultra 8R */
795 case USB_ID(0x0763, 0x2080): /* M-Audio Fast Track Ultra */ 837 case USB_ID(0x0763, 0x2080): /* M-Audio Fast Track Ultra */
796 if (strcmp(kctl->id.name, "Effect Duration") == 0) { 838 if (strcmp(kctl->id.name, "Effect Duration") == 0) {
@@ -1094,6 +1136,32 @@ static size_t append_ctl_name(struct snd_kcontrol *kctl, const char *str)
1094 return strlcat(kctl->id.name, str, sizeof(kctl->id.name)); 1136 return strlcat(kctl->id.name, str, sizeof(kctl->id.name));
1095} 1137}
1096 1138
1139/* A lot of headsets/headphones have a "Speaker" mixer. Make sure we
1140 rename it to "Headphone". We determine if something is a headphone
1141 similar to how udev determines form factor. */
1142static void check_no_speaker_on_headset(struct snd_kcontrol *kctl,
1143 struct snd_card *card)
1144{
1145 const char *names_to_check[] = {
1146 "Headset", "headset", "Headphone", "headphone", NULL};
1147 const char **s;
1148 bool found = 0;
1149
1150 if (strcmp("Speaker", kctl->id.name))
1151 return;
1152
1153 for (s = names_to_check; *s; s++)
1154 if (strstr(card->shortname, *s)) {
1155 found = 1;
1156 break;
1157 }
1158
1159 if (!found)
1160 return;
1161
1162 strlcpy(kctl->id.name, "Headphone", sizeof(kctl->id.name));
1163}
1164
1097static void build_feature_ctl(struct mixer_build *state, void *raw_desc, 1165static void build_feature_ctl(struct mixer_build *state, void *raw_desc,
1098 unsigned int ctl_mask, int control, 1166 unsigned int ctl_mask, int control,
1099 struct usb_audio_term *iterm, int unitid, 1167 struct usb_audio_term *iterm, int unitid,
@@ -1180,6 +1248,10 @@ static void build_feature_ctl(struct mixer_build *state, void *raw_desc,
1180 len = snprintf(kctl->id.name, sizeof(kctl->id.name), 1248 len = snprintf(kctl->id.name, sizeof(kctl->id.name),
1181 "Feature %d", unitid); 1249 "Feature %d", unitid);
1182 } 1250 }
1251
1252 if (!mapped_name)
1253 check_no_speaker_on_headset(kctl, state->mixer->chip->card);
1254
1183 /* determine the stream direction: 1255 /* determine the stream direction:
1184 * if the connected output is USB stream, then it's likely a 1256 * if the connected output is USB stream, then it's likely a
1185 * capture stream. otherwise it should be playback (hopefully :) 1257 * capture stream. otherwise it should be playback (hopefully :)
diff --git a/sound/usb/mixer.h b/sound/usb/mixer.h
index a7f3d45a8acf..aab80df201bd 100644
--- a/sound/usb/mixer.h
+++ b/sound/usb/mixer.h
@@ -43,6 +43,7 @@ struct usb_mixer_elem_info {
43 unsigned int id; 43 unsigned int id;
44 unsigned int control; /* CS or ICN (high byte) */ 44 unsigned int control; /* CS or ICN (high byte) */
45 unsigned int cmask; /* channel mask bitmap: 0 = master */ 45 unsigned int cmask; /* channel mask bitmap: 0 = master */
46 unsigned int idx_off; /* Control index offset */
46 unsigned int ch_readonly; 47 unsigned int ch_readonly;
47 unsigned int master_readonly; 48 unsigned int master_readonly;
48 int channels; 49 int channels;
diff --git a/sound/usb/mixer_quirks.c b/sound/usb/mixer_quirks.c
index ae2b71435220..0422b1360af3 100644
--- a/sound/usb/mixer_quirks.c
+++ b/sound/usb/mixer_quirks.c
@@ -63,11 +63,12 @@ static void usb_mixer_elem_free(struct snd_kcontrol *kctl)
63 * Since there doesn't seem to be a devices that needs a multichannel 63 * Since there doesn't seem to be a devices that needs a multichannel
64 * version, we keep it mono for simplicity. 64 * version, we keep it mono for simplicity.
65 */ 65 */
66static int snd_create_std_mono_ctl(struct usb_mixer_interface *mixer, 66static int snd_create_std_mono_ctl_offset(struct usb_mixer_interface *mixer,
67 unsigned int unitid, 67 unsigned int unitid,
68 unsigned int control, 68 unsigned int control,
69 unsigned int cmask, 69 unsigned int cmask,
70 int val_type, 70 int val_type,
71 unsigned int idx_off,
71 const char *name, 72 const char *name,
72 snd_kcontrol_tlv_rw_t *tlv_callback) 73 snd_kcontrol_tlv_rw_t *tlv_callback)
73{ 74{
@@ -85,6 +86,7 @@ static int snd_create_std_mono_ctl(struct usb_mixer_interface *mixer,
85 cval->channels = 1; 86 cval->channels = 1;
86 cval->control = control; 87 cval->control = control;
87 cval->cmask = cmask; 88 cval->cmask = cmask;
89 cval->idx_off = idx_off;
88 90
89 /* get_min_max() is called only for integer volumes later, 91 /* get_min_max() is called only for integer volumes later,
90 * so provide a short-cut for booleans */ 92 * so provide a short-cut for booleans */
@@ -120,6 +122,18 @@ static int snd_create_std_mono_ctl(struct usb_mixer_interface *mixer,
120 return 0; 122 return 0;
121} 123}
122 124
125static int snd_create_std_mono_ctl(struct usb_mixer_interface *mixer,
126 unsigned int unitid,
127 unsigned int control,
128 unsigned int cmask,
129 int val_type,
130 const char *name,
131 snd_kcontrol_tlv_rw_t *tlv_callback)
132{
133 return snd_create_std_mono_ctl_offset(mixer, unitid, control, cmask,
134 val_type, 0 /* Offset */, name, tlv_callback);
135}
136
123/* 137/*
124 * Create a set of standard UAC controls from a table 138 * Create a set of standard UAC controls from a table
125 */ 139 */
@@ -416,6 +430,8 @@ static void snd_audigy2nx_proc_read(struct snd_info_entry *entry,
416 } 430 }
417} 431}
418 432
433/* ASUS Xonar U1 / U3 controls */
434
419static int snd_xonar_u1_switch_get(struct snd_kcontrol *kcontrol, 435static int snd_xonar_u1_switch_get(struct snd_kcontrol *kcontrol,
420 struct snd_ctl_elem_value *ucontrol) 436 struct snd_ctl_elem_value *ucontrol)
421{ 437{
@@ -621,11 +637,13 @@ static int snd_nativeinstruments_create_mixer(struct usb_mixer_interface *mixer,
621} 637}
622 638
623/* M-Audio FastTrack Ultra quirks */ 639/* M-Audio FastTrack Ultra quirks */
624/* FTU Effect switch */ 640/* FTU Effect switch (also used by C400) */
625struct snd_ftu_eff_switch_priv_val { 641struct snd_ftu_eff_switch_priv_val {
626 struct usb_mixer_interface *mixer; 642 struct usb_mixer_interface *mixer;
627 int cached_value; 643 int cached_value;
628 int is_cached; 644 int is_cached;
645 int bUnitID;
646 int validx;
629}; 647};
630 648
631static int snd_ftu_eff_switch_info(struct snd_kcontrol *kcontrol, 649static int snd_ftu_eff_switch_info(struct snd_kcontrol *kcontrol,
@@ -660,9 +678,8 @@ static int snd_ftu_eff_switch_get(struct snd_kcontrol *kctl,
660 struct snd_ftu_eff_switch_priv_val *pval; 678 struct snd_ftu_eff_switch_priv_val *pval;
661 int err; 679 int err;
662 unsigned char value[2]; 680 unsigned char value[2];
681 int id, validx;
663 682
664 const int id = 6;
665 const int validx = 1;
666 const int val_len = 2; 683 const int val_len = 2;
667 684
668 value[0] = 0x00; 685 value[0] = 0x00;
@@ -684,6 +701,8 @@ static int snd_ftu_eff_switch_get(struct snd_kcontrol *kctl,
684 if (snd_BUG_ON(!chip)) 701 if (snd_BUG_ON(!chip))
685 return -EINVAL; 702 return -EINVAL;
686 703
704 id = pval->bUnitID;
705 validx = pval->validx;
687 706
688 down_read(&mixer->chip->shutdown_rwsem); 707 down_read(&mixer->chip->shutdown_rwsem);
689 if (mixer->chip->shutdown) 708 if (mixer->chip->shutdown)
@@ -714,10 +733,8 @@ static int snd_ftu_eff_switch_put(struct snd_kcontrol *kctl,
714 struct usb_mixer_interface *mixer; 733 struct usb_mixer_interface *mixer;
715 int changed, cur_val, err, new_val; 734 int changed, cur_val, err, new_val;
716 unsigned char value[2]; 735 unsigned char value[2];
736 int id, validx;
717 737
718
719 const int id = 6;
720 const int validx = 1;
721 const int val_len = 2; 738 const int val_len = 2;
722 739
723 changed = 0; 740 changed = 0;
@@ -735,6 +752,9 @@ static int snd_ftu_eff_switch_put(struct snd_kcontrol *kctl,
735 if (snd_BUG_ON(!chip)) 752 if (snd_BUG_ON(!chip))
736 return -EINVAL; 753 return -EINVAL;
737 754
755 id = pval->bUnitID;
756 validx = pval->validx;
757
738 if (!pval->is_cached) { 758 if (!pval->is_cached) {
739 /* Read current value */ 759 /* Read current value */
740 down_read(&mixer->chip->shutdown_rwsem); 760 down_read(&mixer->chip->shutdown_rwsem);
@@ -779,7 +799,8 @@ static int snd_ftu_eff_switch_put(struct snd_kcontrol *kctl,
779 return changed; 799 return changed;
780} 800}
781 801
782static int snd_ftu_create_effect_switch(struct usb_mixer_interface *mixer) 802static int snd_ftu_create_effect_switch(struct usb_mixer_interface *mixer,
803 int validx, int bUnitID)
783{ 804{
784 static struct snd_kcontrol_new template = { 805 static struct snd_kcontrol_new template = {
785 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 806 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
@@ -802,6 +823,8 @@ static int snd_ftu_create_effect_switch(struct usb_mixer_interface *mixer)
802 pval->cached_value = 0; 823 pval->cached_value = 0;
803 pval->is_cached = 0; 824 pval->is_cached = 0;
804 pval->mixer = mixer; 825 pval->mixer = mixer;
826 pval->bUnitID = bUnitID;
827 pval->validx = validx;
805 828
806 template.private_value = (unsigned long) pval; 829 template.private_value = (unsigned long) pval;
807 kctl = snd_ctl_new1(&template, mixer->chip); 830 kctl = snd_ctl_new1(&template, mixer->chip);
@@ -960,9 +983,10 @@ static int snd_ftu_create_mixer(struct usb_mixer_interface *mixer)
960 if (err < 0) 983 if (err < 0)
961 return err; 984 return err;
962 985
963 err = snd_ftu_create_effect_switch(mixer); 986 err = snd_ftu_create_effect_switch(mixer, 1, 6);
964 if (err < 0) 987 if (err < 0)
965 return err; 988 return err;
989
966 err = snd_ftu_create_effect_volume_ctl(mixer); 990 err = snd_ftu_create_effect_volume_ctl(mixer);
967 if (err < 0) 991 if (err < 0)
968 return err; 992 return err;
@@ -1005,6 +1029,178 @@ void snd_emuusb_set_samplerate(struct snd_usb_audio *chip,
1005 } 1029 }
1006} 1030}
1007 1031
1032/* M-Audio Fast Track C400 */
1033/* C400 volume controls, this control needs a volume quirk, see mixer.c */
1034static int snd_c400_create_vol_ctls(struct usb_mixer_interface *mixer)
1035{
1036 char name[64];
1037 unsigned int cmask, offset;
1038 int out, chan, err;
1039
1040 const unsigned int id = 0x40;
1041 const int val_type = USB_MIXER_S16;
1042 const int control = 1;
1043
1044 for (chan = 0; chan < 10; chan++) {
1045 for (out = 0; out < 6; out++) {
1046 if (chan < 6) {
1047 snprintf(name, sizeof(name),
1048 "PCM%d-Out%d Playback Volume",
1049 chan + 1, out + 1);
1050 } else {
1051 snprintf(name, sizeof(name),
1052 "In%d-Out%d Playback Volume",
1053 chan - 5, out + 1);
1054 }
1055
1056 cmask = (out == 0) ? 0 : 1 << (out - 1);
1057 offset = chan * 6;
1058 err = snd_create_std_mono_ctl_offset(mixer, id, control,
1059 cmask, val_type, offset, name,
1060 &snd_usb_mixer_vol_tlv);
1061 if (err < 0)
1062 return err;
1063 }
1064 }
1065
1066 return 0;
1067}
1068
1069/* This control needs a volume quirk, see mixer.c */
1070static int snd_c400_create_effect_volume_ctl(struct usb_mixer_interface *mixer)
1071{
1072 static const char name[] = "Effect Volume";
1073 const unsigned int id = 0x43;
1074 const int val_type = USB_MIXER_U8;
1075 const unsigned int control = 3;
1076 const unsigned int cmask = 0;
1077
1078 return snd_create_std_mono_ctl(mixer, id, control, cmask, val_type,
1079 name, snd_usb_mixer_vol_tlv);
1080}
1081
1082/* This control needs a volume quirk, see mixer.c */
1083static int snd_c400_create_effect_duration_ctl(struct usb_mixer_interface *mixer)
1084{
1085 static const char name[] = "Effect Duration";
1086 const unsigned int id = 0x43;
1087 const int val_type = USB_MIXER_S16;
1088 const unsigned int control = 4;
1089 const unsigned int cmask = 0;
1090
1091 return snd_create_std_mono_ctl(mixer, id, control, cmask, val_type,
1092 name, snd_usb_mixer_vol_tlv);
1093}
1094
1095/* This control needs a volume quirk, see mixer.c */
1096static int snd_c400_create_effect_feedback_ctl(struct usb_mixer_interface *mixer)
1097{
1098 static const char name[] = "Effect Feedback Volume";
1099 const unsigned int id = 0x43;
1100 const int val_type = USB_MIXER_U8;
1101 const unsigned int control = 5;
1102 const unsigned int cmask = 0;
1103
1104 return snd_create_std_mono_ctl(mixer, id, control, cmask, val_type,
1105 name, NULL);
1106}
1107
1108static int snd_c400_create_effect_vol_ctls(struct usb_mixer_interface *mixer)
1109{
1110 char name[64];
1111 unsigned int cmask;
1112 int chan, err;
1113
1114 const unsigned int id = 0x42;
1115 const int val_type = USB_MIXER_S16;
1116 const int control = 1;
1117
1118 for (chan = 0; chan < 10; chan++) {
1119 if (chan < 6) {
1120 snprintf(name, sizeof(name),
1121 "Effect Send DOut%d",
1122 chan + 1);
1123 } else {
1124 snprintf(name, sizeof(name),
1125 "Effect Send AIn%d",
1126 chan - 5);
1127 }
1128
1129 cmask = (chan == 0) ? 0 : 1 << (chan - 1);
1130 err = snd_create_std_mono_ctl(mixer, id, control,
1131 cmask, val_type, name,
1132 &snd_usb_mixer_vol_tlv);
1133 if (err < 0)
1134 return err;
1135 }
1136
1137 return 0;
1138}
1139
1140static int snd_c400_create_effect_ret_vol_ctls(struct usb_mixer_interface *mixer)
1141{
1142 char name[64];
1143 unsigned int cmask;
1144 int chan, err;
1145
1146 const unsigned int id = 0x40;
1147 const int val_type = USB_MIXER_S16;
1148 const int control = 1;
1149 const int chan_id[6] = { 0, 7, 2, 9, 4, 0xb };
1150 const unsigned int offset = 0x3c;
1151 /* { 0x3c, 0x43, 0x3e, 0x45, 0x40, 0x47 } */
1152
1153 for (chan = 0; chan < 6; chan++) {
1154 snprintf(name, sizeof(name),
1155 "Effect Return %d",
1156 chan + 1);
1157
1158 cmask = (chan_id[chan] == 0) ? 0 : 1 << (chan_id[chan] - 1);
1159 err = snd_create_std_mono_ctl_offset(mixer, id, control,
1160 cmask, val_type, offset, name,
1161 &snd_usb_mixer_vol_tlv);
1162 if (err < 0)
1163 return err;
1164 }
1165
1166 return 0;
1167}
1168
1169static int snd_c400_create_mixer(struct usb_mixer_interface *mixer)
1170{
1171 int err;
1172
1173 err = snd_c400_create_vol_ctls(mixer);
1174 if (err < 0)
1175 return err;
1176
1177 err = snd_c400_create_effect_vol_ctls(mixer);
1178 if (err < 0)
1179 return err;
1180
1181 err = snd_c400_create_effect_ret_vol_ctls(mixer);
1182 if (err < 0)
1183 return err;
1184
1185 err = snd_ftu_create_effect_switch(mixer, 2, 0x43);
1186 if (err < 0)
1187 return err;
1188
1189 err = snd_c400_create_effect_volume_ctl(mixer);
1190 if (err < 0)
1191 return err;
1192
1193 err = snd_c400_create_effect_duration_ctl(mixer);
1194 if (err < 0)
1195 return err;
1196
1197 err = snd_c400_create_effect_feedback_ctl(mixer);
1198 if (err < 0)
1199 return err;
1200
1201 return 0;
1202}
1203
1008/* 1204/*
1009 * The mixer units for Ebox-44 are corrupt, and even where they 1205 * The mixer units for Ebox-44 are corrupt, and even where they
1010 * are valid they presents mono controls as L and R channels of 1206 * are valid they presents mono controls as L and R channels of
@@ -1102,13 +1298,18 @@ int snd_usb_mixer_apply_create_quirk(struct usb_mixer_interface *mixer)
1102 snd_audigy2nx_proc_read); 1298 snd_audigy2nx_proc_read);
1103 break; 1299 break;
1104 1300
1301 case USB_ID(0x0763, 0x2030): /* M-Audio Fast Track C400 */
1302 err = snd_c400_create_mixer(mixer);
1303 break;
1304
1105 case USB_ID(0x0763, 0x2080): /* M-Audio Fast Track Ultra */ 1305 case USB_ID(0x0763, 0x2080): /* M-Audio Fast Track Ultra */
1106 case USB_ID(0x0763, 0x2081): /* M-Audio Fast Track Ultra 8R */ 1306 case USB_ID(0x0763, 0x2081): /* M-Audio Fast Track Ultra 8R */
1107 err = snd_ftu_create_mixer(mixer); 1307 err = snd_ftu_create_mixer(mixer);
1108 break; 1308 break;
1109 1309
1110 case USB_ID(0x0b05, 0x1739): 1310 case USB_ID(0x0b05, 0x1739): /* ASUS Xonar U1 */
1111 case USB_ID(0x0b05, 0x1743): 1311 case USB_ID(0x0b05, 0x1743): /* ASUS Xonar U1 (2) */
1312 case USB_ID(0x0b05, 0x17a0): /* ASUS Xonar U3 */
1112 err = snd_xonar_u1_controls_create(mixer); 1313 err = snd_xonar_u1_controls_create(mixer);
1113 break; 1314 break;
1114 1315
diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c
index ef6fa24fc473..c6593101c049 100644
--- a/sound/usb/pcm.c
+++ b/sound/usb/pcm.c
@@ -46,6 +46,9 @@ snd_pcm_uframes_t snd_usb_pcm_delay(struct snd_usb_substream *subs,
46 int frame_diff; 46 int frame_diff;
47 int est_delay; 47 int est_delay;
48 48
49 if (!subs->last_delay)
50 return 0; /* short path */
51
49 current_frame_number = usb_get_current_frame_number(subs->dev); 52 current_frame_number = usb_get_current_frame_number(subs->dev);
50 /* 53 /*
51 * HCD implementations use different widths, use lower 8 bits. 54 * HCD implementations use different widths, use lower 8 bits.
@@ -75,7 +78,8 @@ static snd_pcm_uframes_t snd_usb_pcm_pointer(struct snd_pcm_substream *substream
75 return SNDRV_PCM_POS_XRUN; 78 return SNDRV_PCM_POS_XRUN;
76 spin_lock(&subs->lock); 79 spin_lock(&subs->lock);
77 hwptr_done = subs->hwptr_done; 80 hwptr_done = subs->hwptr_done;
78 substream->runtime->delay = snd_usb_pcm_delay(subs, 81 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
82 substream->runtime->delay = snd_usb_pcm_delay(subs,
79 substream->runtime->rate); 83 substream->runtime->rate);
80 spin_unlock(&subs->lock); 84 spin_unlock(&subs->lock);
81 return hwptr_done / (substream->runtime->frame_bits >> 3); 85 return hwptr_done / (substream->runtime->frame_bits >> 3);
@@ -173,11 +177,8 @@ static int init_pitch_v2(struct snd_usb_audio *chip, int iface,
173{ 177{
174 struct usb_device *dev = chip->dev; 178 struct usb_device *dev = chip->dev;
175 unsigned char data[1]; 179 unsigned char data[1];
176 unsigned int ep;
177 int err; 180 int err;
178 181
179 ep = get_endpoint(alts, 0)->bEndpointAddress;
180
181 data[0] = 1; 182 data[0] = 1;
182 if ((err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), UAC2_CS_CUR, 183 if ((err = snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0), UAC2_CS_CUR,
183 USB_TYPE_CLASS | USB_RECIP_ENDPOINT | USB_DIR_OUT, 184 USB_TYPE_CLASS | USB_RECIP_ENDPOINT | USB_DIR_OUT,
@@ -214,7 +215,7 @@ int snd_usb_init_pitch(struct snd_usb_audio *chip, int iface,
214 } 215 }
215} 216}
216 217
217static int start_endpoints(struct snd_usb_substream *subs, int can_sleep) 218static int start_endpoints(struct snd_usb_substream *subs, bool can_sleep)
218{ 219{
219 int err; 220 int err;
220 221
@@ -266,16 +267,18 @@ static int start_endpoints(struct snd_usb_substream *subs, int can_sleep)
266 return 0; 267 return 0;
267} 268}
268 269
269static void stop_endpoints(struct snd_usb_substream *subs, 270static void stop_endpoints(struct snd_usb_substream *subs, bool wait)
270 int force, int can_sleep, int wait)
271{ 271{
272 if (test_and_clear_bit(SUBSTREAM_FLAG_SYNC_EP_STARTED, &subs->flags)) 272 if (test_and_clear_bit(SUBSTREAM_FLAG_SYNC_EP_STARTED, &subs->flags))
273 snd_usb_endpoint_stop(subs->sync_endpoint, 273 snd_usb_endpoint_stop(subs->sync_endpoint);
274 force, can_sleep, wait);
275 274
276 if (test_and_clear_bit(SUBSTREAM_FLAG_DATA_EP_STARTED, &subs->flags)) 275 if (test_and_clear_bit(SUBSTREAM_FLAG_DATA_EP_STARTED, &subs->flags))
277 snd_usb_endpoint_stop(subs->data_endpoint, 276 snd_usb_endpoint_stop(subs->data_endpoint);
278 force, can_sleep, wait); 277
278 if (wait) {
279 snd_usb_endpoint_sync_pending_stop(subs->sync_endpoint);
280 snd_usb_endpoint_sync_pending_stop(subs->data_endpoint);
281 }
279} 282}
280 283
281static int deactivate_endpoints(struct snd_usb_substream *subs) 284static int deactivate_endpoints(struct snd_usb_substream *subs)
@@ -359,6 +362,19 @@ static int set_format(struct snd_usb_substream *subs, struct audioformat *fmt)
359 attr = fmt->ep_attr & USB_ENDPOINT_SYNCTYPE; 362 attr = fmt->ep_attr & USB_ENDPOINT_SYNCTYPE;
360 363
361 switch (subs->stream->chip->usb_id) { 364 switch (subs->stream->chip->usb_id) {
365 case USB_ID(0x0763, 0x2030): /* M-Audio Fast Track C400 */
366 if (is_playback) {
367 implicit_fb = 1;
368 ep = 0x81;
369 iface = usb_ifnum_to_if(dev, 3);
370
371 if (!iface || iface->num_altsetting == 0)
372 return -EINVAL;
373
374 alts = &iface->altsetting[1];
375 goto add_sync_ep;
376 }
377 break;
362 case USB_ID(0x0763, 0x2080): /* M-Audio FastTrack Ultra */ 378 case USB_ID(0x0763, 0x2080): /* M-Audio FastTrack Ultra */
363 case USB_ID(0x0763, 0x2081): 379 case USB_ID(0x0763, 0x2081):
364 if (is_playback) { 380 if (is_playback) {
@@ -381,7 +397,7 @@ static int set_format(struct snd_usb_substream *subs, struct audioformat *fmt)
381 /* ... and check descriptor size before accessing bSynchAddress 397 /* ... and check descriptor size before accessing bSynchAddress
382 because there is a version of the SB Audigy 2 NX firmware lacking 398 because there is a version of the SB Audigy 2 NX firmware lacking
383 the audio fields in the endpoint descriptors */ 399 the audio fields in the endpoint descriptors */
384 if ((get_endpoint(alts, 1)->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != 0x01 || 400 if ((get_endpoint(alts, 1)->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != USB_ENDPOINT_XFER_ISOC ||
385 (get_endpoint(alts, 1)->bLength >= USB_DT_ENDPOINT_AUDIO_SIZE && 401 (get_endpoint(alts, 1)->bLength >= USB_DT_ENDPOINT_AUDIO_SIZE &&
386 get_endpoint(alts, 1)->bSynchAddress != 0 && 402 get_endpoint(alts, 1)->bSynchAddress != 0 &&
387 !implicit_fb)) { 403 !implicit_fb)) {
@@ -438,6 +454,103 @@ add_sync_ep:
438} 454}
439 455
440/* 456/*
457 * Return the score of matching two audioformats.
458 * Veto the audioformat if:
459 * - It has no channels for some reason.
460 * - Requested PCM format is not supported.
461 * - Requested sample rate is not supported.
462 */
463static int match_endpoint_audioformats(struct audioformat *fp,
464 struct audioformat *match, int rate,
465 snd_pcm_format_t pcm_format)
466{
467 int i;
468 int score = 0;
469
470 if (fp->channels < 1) {
471 snd_printdd("%s: (fmt @%p) no channels\n", __func__, fp);
472 return 0;
473 }
474
475 if (!(fp->formats & (1ULL << pcm_format))) {
476 snd_printdd("%s: (fmt @%p) no match for format %d\n", __func__,
477 fp, pcm_format);
478 return 0;
479 }
480
481 for (i = 0; i < fp->nr_rates; i++) {
482 if (fp->rate_table[i] == rate) {
483 score++;
484 break;
485 }
486 }
487 if (!score) {
488 snd_printdd("%s: (fmt @%p) no match for rate %d\n", __func__,
489 fp, rate);
490 return 0;
491 }
492
493 if (fp->channels == match->channels)
494 score++;
495
496 snd_printdd("%s: (fmt @%p) score %d\n", __func__, fp, score);
497
498 return score;
499}
500
501/*
502 * Configure the sync ep using the rate and pcm format of the data ep.
503 */
504static int configure_sync_endpoint(struct snd_usb_substream *subs)
505{
506 int ret;
507 struct audioformat *fp;
508 struct audioformat *sync_fp = NULL;
509 int cur_score = 0;
510 int sync_period_bytes = subs->period_bytes;
511 struct snd_usb_substream *sync_subs =
512 &subs->stream->substream[subs->direction ^ 1];
513
514 /* Try to find the best matching audioformat. */
515 list_for_each_entry(fp, &sync_subs->fmt_list, list) {
516 int score = match_endpoint_audioformats(fp, subs->cur_audiofmt,
517 subs->cur_rate, subs->pcm_format);
518
519 if (score > cur_score) {
520 sync_fp = fp;
521 cur_score = score;
522 }
523 }
524
525 if (unlikely(sync_fp == NULL)) {
526 snd_printk(KERN_ERR "%s: no valid audioformat for sync ep %x found\n",
527 __func__, sync_subs->ep_num);
528 return -EINVAL;
529 }
530
531 /*
532 * Recalculate the period bytes if channel number differ between
533 * data and sync ep audioformat.
534 */
535 if (sync_fp->channels != subs->channels) {
536 sync_period_bytes = (subs->period_bytes / subs->channels) *
537 sync_fp->channels;
538 snd_printdd("%s: adjusted sync ep period bytes (%d -> %d)\n",
539 __func__, subs->period_bytes, sync_period_bytes);
540 }
541
542 ret = snd_usb_endpoint_set_params(subs->sync_endpoint,
543 subs->pcm_format,
544 sync_fp->channels,
545 sync_period_bytes,
546 subs->cur_rate,
547 sync_fp,
548 NULL);
549
550 return ret;
551}
552
553/*
441 * configure endpoint params 554 * configure endpoint params
442 * 555 *
443 * called during initial setup and upon resume 556 * called during initial setup and upon resume
@@ -447,7 +560,7 @@ static int configure_endpoint(struct snd_usb_substream *subs)
447 int ret; 560 int ret;
448 561
449 /* format changed */ 562 /* format changed */
450 stop_endpoints(subs, 0, 0, 0); 563 stop_endpoints(subs, true);
451 ret = snd_usb_endpoint_set_params(subs->data_endpoint, 564 ret = snd_usb_endpoint_set_params(subs->data_endpoint,
452 subs->pcm_format, 565 subs->pcm_format,
453 subs->channels, 566 subs->channels,
@@ -459,13 +572,8 @@ static int configure_endpoint(struct snd_usb_substream *subs)
459 return ret; 572 return ret;
460 573
461 if (subs->sync_endpoint) 574 if (subs->sync_endpoint)
462 ret = snd_usb_endpoint_set_params(subs->sync_endpoint, 575 ret = configure_sync_endpoint(subs);
463 subs->pcm_format, 576
464 subs->channels,
465 subs->period_bytes,
466 subs->cur_rate,
467 subs->cur_audiofmt,
468 NULL);
469 return ret; 577 return ret;
470} 578}
471 579
@@ -533,7 +641,7 @@ static int snd_usb_hw_free(struct snd_pcm_substream *substream)
533 subs->period_bytes = 0; 641 subs->period_bytes = 0;
534 down_read(&subs->stream->chip->shutdown_rwsem); 642 down_read(&subs->stream->chip->shutdown_rwsem);
535 if (!subs->stream->chip->shutdown) { 643 if (!subs->stream->chip->shutdown) {
536 stop_endpoints(subs, 0, 1, 1); 644 stop_endpoints(subs, true);
537 deactivate_endpoints(subs); 645 deactivate_endpoints(subs);
538 } 646 }
539 up_read(&subs->stream->chip->shutdown_rwsem); 647 up_read(&subs->stream->chip->shutdown_rwsem);
@@ -608,7 +716,7 @@ static int snd_usb_pcm_prepare(struct snd_pcm_substream *substream)
608 /* for playback, submit the URBs now; otherwise, the first hwptr_done 716 /* for playback, submit the URBs now; otherwise, the first hwptr_done
609 * updates for all URBs would happen at the same time when starting */ 717 * updates for all URBs would happen at the same time when starting */
610 if (subs->direction == SNDRV_PCM_STREAM_PLAYBACK) 718 if (subs->direction == SNDRV_PCM_STREAM_PLAYBACK)
611 ret = start_endpoints(subs, 1); 719 ret = start_endpoints(subs, true);
612 720
613 unlock: 721 unlock:
614 up_read(&subs->stream->chip->shutdown_rwsem); 722 up_read(&subs->stream->chip->shutdown_rwsem);
@@ -1013,7 +1121,7 @@ static int snd_usb_pcm_close(struct snd_pcm_substream *substream, int direction)
1013 struct snd_usb_stream *as = snd_pcm_substream_chip(substream); 1121 struct snd_usb_stream *as = snd_pcm_substream_chip(substream);
1014 struct snd_usb_substream *subs = &as->substream[direction]; 1122 struct snd_usb_substream *subs = &as->substream[direction];
1015 1123
1016 stop_endpoints(subs, 0, 0, 0); 1124 stop_endpoints(subs, true);
1017 1125
1018 if (!as->chip->shutdown && subs->interface >= 0) { 1126 if (!as->chip->shutdown && subs->interface >= 0) {
1019 usb_set_interface(subs->dev, subs->interface, 0); 1127 usb_set_interface(subs->dev, subs->interface, 0);
@@ -1195,6 +1303,9 @@ static void retire_playback_urb(struct snd_usb_substream *subs,
1195 return; 1303 return;
1196 1304
1197 spin_lock_irqsave(&subs->lock, flags); 1305 spin_lock_irqsave(&subs->lock, flags);
1306 if (!subs->last_delay)
1307 goto out; /* short path */
1308
1198 est_delay = snd_usb_pcm_delay(subs, runtime->rate); 1309 est_delay = snd_usb_pcm_delay(subs, runtime->rate);
1199 /* update delay with exact number of samples played */ 1310 /* update delay with exact number of samples played */
1200 if (processed > subs->last_delay) 1311 if (processed > subs->last_delay)
@@ -1212,6 +1323,15 @@ static void retire_playback_urb(struct snd_usb_substream *subs,
1212 snd_printk(KERN_DEBUG "delay: estimated %d, actual %d\n", 1323 snd_printk(KERN_DEBUG "delay: estimated %d, actual %d\n",
1213 est_delay, subs->last_delay); 1324 est_delay, subs->last_delay);
1214 1325
1326 if (!subs->running) {
1327 /* update last_frame_number for delay counting here since
1328 * prepare_playback_urb won't be called during pause
1329 */
1330 subs->last_frame_number =
1331 usb_get_current_frame_number(subs->dev) & 0xff;
1332 }
1333
1334 out:
1215 spin_unlock_irqrestore(&subs->lock, flags); 1335 spin_unlock_irqrestore(&subs->lock, flags);
1216} 1336}
1217 1337
@@ -1248,12 +1368,13 @@ static int snd_usb_substream_playback_trigger(struct snd_pcm_substream *substrea
1248 subs->running = 1; 1368 subs->running = 1;
1249 return 0; 1369 return 0;
1250 case SNDRV_PCM_TRIGGER_STOP: 1370 case SNDRV_PCM_TRIGGER_STOP:
1251 stop_endpoints(subs, 0, 0, 0); 1371 stop_endpoints(subs, false);
1252 subs->running = 0; 1372 subs->running = 0;
1253 return 0; 1373 return 0;
1254 case SNDRV_PCM_TRIGGER_PAUSE_PUSH: 1374 case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
1255 subs->data_endpoint->prepare_data_urb = NULL; 1375 subs->data_endpoint->prepare_data_urb = NULL;
1256 subs->data_endpoint->retire_data_urb = NULL; 1376 /* keep retire_data_urb for delay calculation */
1377 subs->data_endpoint->retire_data_urb = retire_playback_urb;
1257 subs->running = 0; 1378 subs->running = 0;
1258 return 0; 1379 return 0;
1259 } 1380 }
@@ -1269,7 +1390,7 @@ static int snd_usb_substream_capture_trigger(struct snd_pcm_substream *substream
1269 1390
1270 switch (cmd) { 1391 switch (cmd) {
1271 case SNDRV_PCM_TRIGGER_START: 1392 case SNDRV_PCM_TRIGGER_START:
1272 err = start_endpoints(subs, 0); 1393 err = start_endpoints(subs, false);
1273 if (err < 0) 1394 if (err < 0)
1274 return err; 1395 return err;
1275 1396
@@ -1277,7 +1398,7 @@ static int snd_usb_substream_capture_trigger(struct snd_pcm_substream *substream
1277 subs->running = 1; 1398 subs->running = 1;
1278 return 0; 1399 return 0;
1279 case SNDRV_PCM_TRIGGER_STOP: 1400 case SNDRV_PCM_TRIGGER_STOP:
1280 stop_endpoints(subs, 0, 0, 0); 1401 stop_endpoints(subs, false);
1281 subs->running = 0; 1402 subs->running = 0;
1282 return 0; 1403 return 0;
1283 case SNDRV_PCM_TRIGGER_PAUSE_PUSH: 1404 case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h
index 88d8cebbb244..78e845ec65da 100644
--- a/sound/usb/quirks-table.h
+++ b/sound/usb/quirks-table.h
@@ -50,6 +50,28 @@
50 } 50 }
51}, 51},
52 52
53{
54 /* Creative BT-D1 */
55 USB_DEVICE(0x041e, 0x0005),
56 .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) {
57 .ifnum = 1,
58 .type = QUIRK_AUDIO_FIXED_ENDPOINT,
59 .data = &(const struct audioformat) {
60 .formats = SNDRV_PCM_FMTBIT_S16_LE,
61 .channels = 2,
62 .iface = 1,
63 .altsetting = 1,
64 .altset_idx = 1,
65 .endpoint = 0x03,
66 .ep_attr = USB_ENDPOINT_XFER_ISOC,
67 .attributes = 0,
68 .rates = SNDRV_PCM_RATE_CONTINUOUS,
69 .rate_min = 48000,
70 .rate_max = 48000,
71 }
72 }
73},
74
53/* Creative/Toshiba Multimedia Center SB-0500 */ 75/* Creative/Toshiba Multimedia Center SB-0500 */
54{ 76{
55 USB_DEVICE(0x041e, 0x3048), 77 USB_DEVICE(0x041e, 0x3048),
@@ -99,6 +121,42 @@
99}, 121},
100 122
101/* 123/*
124 * HP Wireless Audio
125 * When not ignored, causes instability issues for some users, forcing them to
126 * blacklist the entire module.
127 */
128{
129 USB_DEVICE(0x0424, 0xb832),
130 .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) {
131 .vendor_name = "Standard Microsystems Corp.",
132 .product_name = "HP Wireless Audio",
133 .ifnum = QUIRK_ANY_INTERFACE,
134 .type = QUIRK_COMPOSITE,
135 .data = (const struct snd_usb_audio_quirk[]) {
136 /* Mixer */
137 {
138 .ifnum = 0,
139 .type = QUIRK_IGNORE_INTERFACE,
140 },
141 /* Playback */
142 {
143 .ifnum = 1,
144 .type = QUIRK_IGNORE_INTERFACE,
145 },
146 /* Capture */
147 {
148 .ifnum = 2,
149 .type = QUIRK_IGNORE_INTERFACE,
150 },
151 /* HID Device, .ifnum = 3 */
152 {
153 .ifnum = -1,
154 }
155 }
156 }
157},
158
159/*
102 * Logitech QuickCam: bDeviceClass is vendor-specific, so generic interface 160 * Logitech QuickCam: bDeviceClass is vendor-specific, so generic interface
103 * class matches do not take effect without an explicit ID match. 161 * class matches do not take effect without an explicit ID match.
104 */ 162 */
@@ -1457,6 +1515,40 @@ YAMAHA_DEVICE(0x7010, "UB99"),
1457 } 1515 }
1458}, 1516},
1459{ 1517{
1518 /* Advanced mode of the Roland VG-99, with MIDI and 24-bit PCM at 44.1
1519 * kHz. In standard mode, the device has ID 0582:00b3, and offers
1520 * 16-bit PCM at 44.1 kHz with no MIDI.
1521 */
1522 USB_DEVICE(0x0582, 0x00b2),
1523 .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
1524 .vendor_name = "Roland",
1525 .product_name = "VG-99",
1526 .ifnum = QUIRK_ANY_INTERFACE,
1527 .type = QUIRK_COMPOSITE,
1528 .data = (const struct snd_usb_audio_quirk[]) {
1529 {
1530 .ifnum = 0,
1531 .type = QUIRK_AUDIO_STANDARD_INTERFACE
1532 },
1533 {
1534 .ifnum = 1,
1535 .type = QUIRK_AUDIO_STANDARD_INTERFACE
1536 },
1537 {
1538 .ifnum = 2,
1539 .type = QUIRK_MIDI_FIXED_ENDPOINT,
1540 .data = & (const struct snd_usb_midi_endpoint_info) {
1541 .out_cables = 0x0003,
1542 .in_cables = 0x0003
1543 }
1544 },
1545 {
1546 .ifnum = -1
1547 }
1548 }
1549 }
1550},
1551{
1460 /* Roland SonicCell */ 1552 /* Roland SonicCell */
1461 USB_DEVICE(0x0582, 0x00c2), 1553 USB_DEVICE(0x0582, 0x00c2),
1462 .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { 1554 .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
@@ -2163,6 +2255,77 @@ YAMAHA_DEVICE(0x7010, "UB99"),
2163 } 2255 }
2164}, 2256},
2165{ 2257{
2258 USB_DEVICE_VENDOR_SPEC(0x0763, 0x2030),
2259 .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) {
2260 /* .vendor_name = "M-Audio", */
2261 /* .product_name = "Fast Track C400", */
2262 .ifnum = QUIRK_ANY_INTERFACE,
2263 .type = QUIRK_COMPOSITE,
2264 .data = &(const struct snd_usb_audio_quirk[]) {
2265 {
2266 .ifnum = 1,
2267 .type = QUIRK_AUDIO_STANDARD_MIXER,
2268 },
2269 /* Playback */
2270 {
2271 .ifnum = 2,
2272 .type = QUIRK_AUDIO_FIXED_ENDPOINT,
2273 .data = &(const struct audioformat) {
2274 .formats = SNDRV_PCM_FMTBIT_S24_3LE,
2275 .channels = 6,
2276 .iface = 2,
2277 .altsetting = 1,
2278 .altset_idx = 1,
2279 .attributes = UAC_EP_CS_ATTR_SAMPLE_RATE,
2280 .endpoint = 0x01,
2281 .ep_attr = 0x09,
2282 .rates = SNDRV_PCM_RATE_44100 |
2283 SNDRV_PCM_RATE_48000 |
2284 SNDRV_PCM_RATE_88200 |
2285 SNDRV_PCM_RATE_96000,
2286 .rate_min = 44100,
2287 .rate_max = 96000,
2288 .nr_rates = 4,
2289 .rate_table = (unsigned int[]) {
2290 44100, 48000, 88200, 96000
2291 },
2292 .clock = 0x81,
2293 }
2294 },
2295 /* Capture */
2296 {
2297 .ifnum = 3,
2298 .type = QUIRK_AUDIO_FIXED_ENDPOINT,
2299 .data = &(const struct audioformat) {
2300 .formats = SNDRV_PCM_FMTBIT_S24_3LE,
2301 .channels = 4,
2302 .iface = 3,
2303 .altsetting = 1,
2304 .altset_idx = 1,
2305 .attributes = UAC_EP_CS_ATTR_SAMPLE_RATE,
2306 .endpoint = 0x81,
2307 .ep_attr = 0x05,
2308 .rates = SNDRV_PCM_RATE_44100 |
2309 SNDRV_PCM_RATE_48000 |
2310 SNDRV_PCM_RATE_88200 |
2311 SNDRV_PCM_RATE_96000,
2312 .rate_min = 44100,
2313 .rate_max = 96000,
2314 .nr_rates = 4,
2315 .rate_table = (unsigned int[]) {
2316 44100, 48000, 88200, 96000
2317 },
2318 .clock = 0x81,
2319 }
2320 },
2321 /* MIDI */
2322 {
2323 .ifnum = -1 /* Interface = 4 */
2324 }
2325 }
2326 }
2327},
2328{
2166 USB_DEVICE_VENDOR_SPEC(0x0763, 0x2080), 2329 USB_DEVICE_VENDOR_SPEC(0x0763, 0x2080),
2167 .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { 2330 .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
2168 /* .vendor_name = "M-Audio", */ 2331 /* .vendor_name = "M-Audio", */
@@ -2780,6 +2943,93 @@ YAMAHA_DEVICE(0x7010, "UB99"),
2780 2943
2781 } 2944 }
2782}, 2945},
2946
2947/* DIGIDESIGN MBOX 2 */
2948{
2949 USB_DEVICE(0x0dba, 0x3000),
2950 .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) {
2951 .vendor_name = "Digidesign",
2952 .product_name = "Mbox 2",
2953 .ifnum = QUIRK_ANY_INTERFACE,
2954 .type = QUIRK_COMPOSITE,
2955 .data = (const struct snd_usb_audio_quirk[]) {
2956 {
2957 .ifnum = 0,
2958 .type = QUIRK_IGNORE_INTERFACE
2959 },
2960 {
2961 .ifnum = 1,
2962 .type = QUIRK_IGNORE_INTERFACE
2963 },
2964 {
2965 .ifnum = 2,
2966 .type = QUIRK_AUDIO_FIXED_ENDPOINT,
2967 .data = &(const struct audioformat) {
2968 .formats = SNDRV_PCM_FMTBIT_S24_3BE,
2969 .channels = 2,
2970 .iface = 2,
2971 .altsetting = 2,
2972 .altset_idx = 1,
2973 .attributes = 0x00,
2974 .endpoint = 0x03,
2975 .ep_attr = USB_ENDPOINT_SYNC_ASYNC,
2976 .maxpacksize = 0x128,
2977 .rates = SNDRV_PCM_RATE_48000,
2978 .rate_min = 48000,
2979 .rate_max = 48000,
2980 .nr_rates = 1,
2981 .rate_table = (unsigned int[]) {
2982 48000
2983 }
2984 }
2985 },
2986 {
2987 .ifnum = 3,
2988 .type = QUIRK_IGNORE_INTERFACE
2989 },
2990 {
2991 .ifnum = 4,
2992 .type = QUIRK_AUDIO_FIXED_ENDPOINT,
2993 .data = &(const struct audioformat) {
2994 .formats = SNDRV_PCM_FMTBIT_S24_3BE,
2995 .channels = 2,
2996 .iface = 4,
2997 .altsetting = 2,
2998 .altset_idx = 1,
2999 .attributes = UAC_EP_CS_ATTR_SAMPLE_RATE,
3000 .endpoint = 0x85,
3001 .ep_attr = USB_ENDPOINT_SYNC_SYNC,
3002 .maxpacksize = 0x128,
3003 .rates = SNDRV_PCM_RATE_48000,
3004 .rate_min = 48000,
3005 .rate_max = 48000,
3006 .nr_rates = 1,
3007 .rate_table = (unsigned int[]) {
3008 48000
3009 }
3010 }
3011 },
3012 {
3013 .ifnum = 5,
3014 .type = QUIRK_IGNORE_INTERFACE
3015 },
3016 {
3017 .ifnum = 6,
3018 .type = QUIRK_MIDI_MIDIMAN,
3019 .data = &(const struct snd_usb_midi_endpoint_info) {
3020 .out_ep = 0x02,
3021 .out_cables = 0x0001,
3022 .in_ep = 0x81,
3023 .in_interval = 0x01,
3024 .in_cables = 0x0001
3025 }
3026 },
3027 {
3028 .ifnum = -1
3029 }
3030 }
3031 }
3032},
2783{ 3033{
2784 /* Tascam US122 MKII - playback-only support */ 3034 /* Tascam US122 MKII - playback-only support */
2785 .match_flags = USB_DEVICE_ID_MATCH_DEVICE, 3035 .match_flags = USB_DEVICE_ID_MATCH_DEVICE,
@@ -2880,6 +3130,99 @@ YAMAHA_DEVICE(0x7010, "UB99"),
2880 } 3130 }
2881}, 3131},
2882 3132
3133/* Reloop Play */
3134{
3135 USB_DEVICE(0x200c, 0x100b),
3136 .bInterfaceClass = USB_CLASS_PER_INTERFACE,
3137 .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) {
3138 .ifnum = QUIRK_ANY_INTERFACE,
3139 .type = QUIRK_COMPOSITE,
3140 .data = &(const struct snd_usb_audio_quirk[]) {
3141 {
3142 .ifnum = 0,
3143 .type = QUIRK_AUDIO_STANDARD_MIXER,
3144 },
3145 {
3146 .ifnum = 1,
3147 .type = QUIRK_AUDIO_FIXED_ENDPOINT,
3148 .data = &(const struct audioformat) {
3149 .formats = SNDRV_PCM_FMTBIT_S24_3LE,
3150 .channels = 4,
3151 .iface = 1,
3152 .altsetting = 1,
3153 .altset_idx = 1,
3154 .attributes = UAC_EP_CS_ATTR_SAMPLE_RATE,
3155 .endpoint = 0x01,
3156 .ep_attr = USB_ENDPOINT_SYNC_ADAPTIVE,
3157 .rates = SNDRV_PCM_RATE_44100 |
3158 SNDRV_PCM_RATE_48000,
3159 .rate_min = 44100,
3160 .rate_max = 48000,
3161 .nr_rates = 2,
3162 .rate_table = (unsigned int[]) {
3163 44100, 48000
3164 }
3165 }
3166 },
3167 {
3168 .ifnum = -1
3169 }
3170 }
3171 }
3172},
3173
3174{
3175 /*
3176 * Focusrite Scarlett 18i6
3177 *
3178 * Avoid mixer creation, which otherwise fails because some of
3179 * the interface descriptor subtypes for interface 0 are
3180 * unknown. That should be fixed or worked-around but this at
3181 * least allows the device to be used successfully with a DAW
3182 * and an external mixer. See comments below about other
3183 * ignored interfaces.
3184 */
3185 USB_DEVICE(0x1235, 0x8004),
3186 .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
3187 .vendor_name = "Focusrite",
3188 .product_name = "Scarlett 18i6",
3189 .ifnum = QUIRK_ANY_INTERFACE,
3190 .type = QUIRK_COMPOSITE,
3191 .data = & (const struct snd_usb_audio_quirk[]) {
3192 {
3193 /* InterfaceSubClass 1 (Control Device) */
3194 .ifnum = 0,
3195 .type = QUIRK_IGNORE_INTERFACE
3196 },
3197 {
3198 .ifnum = 1,
3199 .type = QUIRK_AUDIO_STANDARD_INTERFACE
3200 },
3201 {
3202 .ifnum = 2,
3203 .type = QUIRK_AUDIO_STANDARD_INTERFACE
3204 },
3205 {
3206 /* InterfaceSubClass 1 (Control Device) */
3207 .ifnum = 3,
3208 .type = QUIRK_IGNORE_INTERFACE
3209 },
3210 {
3211 .ifnum = 4,
3212 .type = QUIRK_MIDI_STANDARD_INTERFACE
3213 },
3214 {
3215 /* InterfaceSubClass 1 (Device Firmware Update) */
3216 .ifnum = 5,
3217 .type = QUIRK_IGNORE_INTERFACE
3218 },
3219 {
3220 .ifnum = -1
3221 }
3222 }
3223 }
3224},
3225
2883{ 3226{
2884 /* 3227 /*
2885 * Some USB MIDI devices don't have an audio control interface, 3228 * Some USB MIDI devices don't have an audio control interface,
diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c
index 0f58b4b6d702..acc12f004c23 100644
--- a/sound/usb/quirks.c
+++ b/sound/usb/quirks.c
@@ -497,6 +497,92 @@ static int snd_usb_nativeinstruments_boot_quirk(struct usb_device *dev)
497 return -EAGAIN; 497 return -EAGAIN;
498} 498}
499 499
500static void mbox2_setup_48_24_magic(struct usb_device *dev)
501{
502 u8 srate[3];
503 u8 temp[12];
504
505 /* Choose 48000Hz permanently */
506 srate[0] = 0x80;
507 srate[1] = 0xbb;
508 srate[2] = 0x00;
509
510 /* Send the magic! */
511 snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0),
512 0x01, 0x22, 0x0100, 0x0085, &temp, 0x0003);
513 snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0),
514 0x81, 0xa2, 0x0100, 0x0085, &srate, 0x0003);
515 snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0),
516 0x81, 0xa2, 0x0100, 0x0086, &srate, 0x0003);
517 snd_usb_ctl_msg(dev, usb_sndctrlpipe(dev, 0),
518 0x81, 0xa2, 0x0100, 0x0003, &srate, 0x0003);
519 return;
520}
521
522/* Digidesign Mbox 2 needs to load firmware onboard
523 * and driver must wait a few seconds for initialisation.
524 */
525
526#define MBOX2_FIRMWARE_SIZE 646
527#define MBOX2_BOOT_LOADING 0x01 /* Hard coded into the device */
528#define MBOX2_BOOT_READY 0x02 /* Hard coded into the device */
529
530static int snd_usb_mbox2_boot_quirk(struct usb_device *dev)
531{
532 struct usb_host_config *config = dev->actconfig;
533 int err;
534 u8 bootresponse[12];
535 int fwsize;
536 int count;
537
538 fwsize = le16_to_cpu(get_cfg_desc(config)->wTotalLength);
539
540 if (fwsize != MBOX2_FIRMWARE_SIZE) {
541 snd_printk(KERN_ERR "usb-audio: Invalid firmware size=%d.\n", fwsize);
542 return -ENODEV;
543 }
544
545 snd_printd("usb-audio: Sending Digidesign Mbox 2 boot sequence...\n");
546
547 count = 0;
548 bootresponse[0] = MBOX2_BOOT_LOADING;
549 while ((bootresponse[0] == MBOX2_BOOT_LOADING) && (count < 10)) {
550 msleep(500); /* 0.5 second delay */
551 snd_usb_ctl_msg(dev, usb_rcvctrlpipe(dev, 0),
552 /* Control magic - load onboard firmware */
553 0x85, 0xc0, 0x0001, 0x0000, &bootresponse, 0x0012);
554 if (bootresponse[0] == MBOX2_BOOT_READY)
555 break;
556 snd_printd("usb-audio: device not ready, resending boot sequence...\n");
557 count++;
558 }
559
560 if (bootresponse[0] != MBOX2_BOOT_READY) {
561 snd_printk(KERN_ERR "usb-audio: Unknown bootresponse=%d, or timed out, ignoring device.\n", bootresponse[0]);
562 return -ENODEV;
563 }
564
565 snd_printdd("usb-audio: device initialised!\n");
566
567 err = usb_get_descriptor(dev, USB_DT_DEVICE, 0,
568 &dev->descriptor, sizeof(dev->descriptor));
569 config = dev->actconfig;
570 if (err < 0)
571 snd_printd("error usb_get_descriptor: %d\n", err);
572
573 err = usb_reset_configuration(dev);
574 if (err < 0)
575 snd_printd("error usb_reset_configuration: %d\n", err);
576 snd_printdd("mbox2_boot: new boot length = %d\n",
577 le16_to_cpu(get_cfg_desc(config)->wTotalLength));
578
579 mbox2_setup_48_24_magic(dev);
580
581 snd_printk(KERN_INFO "usb-audio: Digidesign Mbox 2: 24bit 48kHz");
582
583 return 0; /* Successful boot */
584}
585
500/* 586/*
501 * Setup quirks 587 * Setup quirks
502 */ 588 */
@@ -573,7 +659,6 @@ static int audiophile_skip_setting_quirk(struct snd_usb_audio *chip,
573 return 0; /* keep this altsetting */ 659 return 0; /* keep this altsetting */
574} 660}
575 661
576
577static int fasttrackpro_skip_setting_quirk(struct snd_usb_audio *chip, 662static int fasttrackpro_skip_setting_quirk(struct snd_usb_audio *chip,
578 int iface, int altno) 663 int iface, int altno)
579{ 664{
@@ -655,6 +740,10 @@ int snd_usb_apply_boot_quirk(struct usb_device *dev,
655 case USB_ID(0x0ccd, 0x00b1): /* Terratec Aureon 7.1 USB */ 740 case USB_ID(0x0ccd, 0x00b1): /* Terratec Aureon 7.1 USB */
656 return snd_usb_cm6206_boot_quirk(dev); 741 return snd_usb_cm6206_boot_quirk(dev);
657 742
743 case USB_ID(0x0dba, 0x3000):
744 /* Digidesign Mbox 2 */
745 return snd_usb_mbox2_boot_quirk(dev);
746
658 case USB_ID(0x133e, 0x0815): 747 case USB_ID(0x133e, 0x0815):
659 /* Access Music VirusTI Desktop */ 748 /* Access Music VirusTI Desktop */
660 return snd_usb_accessmusic_boot_quirk(dev); 749 return snd_usb_accessmusic_boot_quirk(dev);
@@ -675,7 +764,7 @@ int snd_usb_apply_boot_quirk(struct usb_device *dev,
675 */ 764 */
676int snd_usb_is_big_endian_format(struct snd_usb_audio *chip, struct audioformat *fp) 765int snd_usb_is_big_endian_format(struct snd_usb_audio *chip, struct audioformat *fp)
677{ 766{
678 /* it depends on altsetting wether the device is big-endian or not */ 767 /* it depends on altsetting whether the device is big-endian or not */
679 switch (chip->usb_id) { 768 switch (chip->usb_id) {
680 case USB_ID(0x0763, 0x2001): /* M-Audio Quattro: captured data only */ 769 case USB_ID(0x0763, 0x2001): /* M-Audio Quattro: captured data only */
681 if (fp->altsetting == 2 || fp->altsetting == 3 || 770 if (fp->altsetting == 2 || fp->altsetting == 3 ||
diff --git a/sound/usb/stream.c b/sound/usb/stream.c
index 1de0c8c002a8..ad181d538bd9 100644
--- a/sound/usb/stream.c
+++ b/sound/usb/stream.c
@@ -23,6 +23,8 @@
23 23
24#include <sound/core.h> 24#include <sound/core.h>
25#include <sound/pcm.h> 25#include <sound/pcm.h>
26#include <sound/control.h>
27#include <sound/tlv.h>
26 28
27#include "usbaudio.h" 29#include "usbaudio.h"
28#include "card.h" 30#include "card.h"
@@ -47,6 +49,7 @@ static void free_substream(struct snd_usb_substream *subs)
47 list_for_each_safe(p, n, &subs->fmt_list) { 49 list_for_each_safe(p, n, &subs->fmt_list) {
48 struct audioformat *fp = list_entry(p, struct audioformat, list); 50 struct audioformat *fp = list_entry(p, struct audioformat, list);
49 kfree(fp->rate_table); 51 kfree(fp->rate_table);
52 kfree(fp->chmap);
50 kfree(fp); 53 kfree(fp);
51 } 54 }
52 kfree(subs->rate_list.list); 55 kfree(subs->rate_list.list);
@@ -99,6 +102,206 @@ static void snd_usb_init_substream(struct snd_usb_stream *as,
99 subs->num_formats++; 102 subs->num_formats++;
100 subs->fmt_type = fp->fmt_type; 103 subs->fmt_type = fp->fmt_type;
101 subs->ep_num = fp->endpoint; 104 subs->ep_num = fp->endpoint;
105 if (fp->channels > subs->channels_max)
106 subs->channels_max = fp->channels;
107}
108
109/* kctl callbacks for usb-audio channel maps */
110static int usb_chmap_ctl_info(struct snd_kcontrol *kcontrol,
111 struct snd_ctl_elem_info *uinfo)
112{
113 struct snd_pcm_chmap *info = snd_kcontrol_chip(kcontrol);
114 struct snd_usb_substream *subs = info->private_data;
115
116 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
117 uinfo->count = subs->channels_max;
118 uinfo->value.integer.min = 0;
119 uinfo->value.integer.max = SNDRV_CHMAP_LAST;
120 return 0;
121}
122
123/* check whether a duplicated entry exists in the audiofmt list */
124static bool have_dup_chmap(struct snd_usb_substream *subs,
125 struct audioformat *fp)
126{
127 struct list_head *p;
128
129 for (p = fp->list.prev; p != &subs->fmt_list; p = p->prev) {
130 struct audioformat *prev;
131 prev = list_entry(p, struct audioformat, list);
132 if (prev->chmap &&
133 !memcmp(prev->chmap, fp->chmap, sizeof(*fp->chmap)))
134 return true;
135 }
136 return false;
137}
138
139static int usb_chmap_ctl_tlv(struct snd_kcontrol *kcontrol, int op_flag,
140 unsigned int size, unsigned int __user *tlv)
141{
142 struct snd_pcm_chmap *info = snd_kcontrol_chip(kcontrol);
143 struct snd_usb_substream *subs = info->private_data;
144 struct audioformat *fp;
145 unsigned int __user *dst;
146 int count = 0;
147
148 if (size < 8)
149 return -ENOMEM;
150 if (put_user(SNDRV_CTL_TLVT_CONTAINER, tlv))
151 return -EFAULT;
152 size -= 8;
153 dst = tlv + 2;
154 list_for_each_entry(fp, &subs->fmt_list, list) {
155 int i, ch_bytes;
156
157 if (!fp->chmap)
158 continue;
159 if (have_dup_chmap(subs, fp))
160 continue;
161 /* copy the entry */
162 ch_bytes = fp->chmap->channels * 4;
163 if (size < 8 + ch_bytes)
164 return -ENOMEM;
165 if (put_user(SNDRV_CTL_TLVT_CHMAP_FIXED, dst) ||
166 put_user(ch_bytes, dst + 1))
167 return -EFAULT;
168 dst += 2;
169 for (i = 0; i < fp->chmap->channels; i++, dst++) {
170 if (put_user(fp->chmap->map[i], dst))
171 return -EFAULT;
172 }
173
174 count += 8 + ch_bytes;
175 size -= 8 + ch_bytes;
176 }
177 if (put_user(count, tlv + 1))
178 return -EFAULT;
179 return 0;
180}
181
182static int usb_chmap_ctl_get(struct snd_kcontrol *kcontrol,
183 struct snd_ctl_elem_value *ucontrol)
184{
185 struct snd_pcm_chmap *info = snd_kcontrol_chip(kcontrol);
186 struct snd_usb_substream *subs = info->private_data;
187 struct snd_pcm_chmap_elem *chmap = NULL;
188 int i;
189
190 memset(ucontrol->value.integer.value, 0,
191 sizeof(ucontrol->value.integer.value));
192 if (subs->cur_audiofmt)
193 chmap = subs->cur_audiofmt->chmap;
194 if (chmap) {
195 for (i = 0; i < chmap->channels; i++)
196 ucontrol->value.integer.value[i] = chmap->map[i];
197 }
198 return 0;
199}
200
201/* create a chmap kctl assigned to the given USB substream */
202static int add_chmap(struct snd_pcm *pcm, int stream,
203 struct snd_usb_substream *subs)
204{
205 struct audioformat *fp;
206 struct snd_pcm_chmap *chmap;
207 struct snd_kcontrol *kctl;
208 int err;
209
210 list_for_each_entry(fp, &subs->fmt_list, list)
211 if (fp->chmap)
212 goto ok;
213 /* no chmap is found */
214 return 0;
215
216 ok:
217 err = snd_pcm_add_chmap_ctls(pcm, stream, NULL, 0, 0, &chmap);
218 if (err < 0)
219 return err;
220
221 /* override handlers */
222 chmap->private_data = subs;
223 kctl = chmap->kctl;
224 kctl->info = usb_chmap_ctl_info;
225 kctl->get = usb_chmap_ctl_get;
226 kctl->tlv.c = usb_chmap_ctl_tlv;
227
228 return 0;
229}
230
231/* convert from USB ChannelConfig bits to ALSA chmap element */
232static struct snd_pcm_chmap_elem *convert_chmap(int channels, unsigned int bits,
233 int protocol)
234{
235 static unsigned int uac1_maps[] = {
236 SNDRV_CHMAP_FL, /* left front */
237 SNDRV_CHMAP_FR, /* right front */
238 SNDRV_CHMAP_FC, /* center front */
239 SNDRV_CHMAP_LFE, /* LFE */
240 SNDRV_CHMAP_SL, /* left surround */
241 SNDRV_CHMAP_SR, /* right surround */
242 SNDRV_CHMAP_FLC, /* left of center */
243 SNDRV_CHMAP_FRC, /* right of center */
244 SNDRV_CHMAP_RC, /* surround */
245 SNDRV_CHMAP_SL, /* side left */
246 SNDRV_CHMAP_SR, /* side right */
247 SNDRV_CHMAP_TC, /* top */
248 0 /* terminator */
249 };
250 static unsigned int uac2_maps[] = {
251 SNDRV_CHMAP_FL, /* front left */
252 SNDRV_CHMAP_FR, /* front right */
253 SNDRV_CHMAP_FC, /* front center */
254 SNDRV_CHMAP_LFE, /* LFE */
255 SNDRV_CHMAP_RL, /* back left */
256 SNDRV_CHMAP_RR, /* back right */
257 SNDRV_CHMAP_FLC, /* front left of center */
258 SNDRV_CHMAP_FRC, /* front right of center */
259 SNDRV_CHMAP_RC, /* back center */
260 SNDRV_CHMAP_SL, /* side left */
261 SNDRV_CHMAP_SR, /* side right */
262 SNDRV_CHMAP_TC, /* top center */
263 SNDRV_CHMAP_TFL, /* top front left */
264 SNDRV_CHMAP_TFC, /* top front center */
265 SNDRV_CHMAP_TFR, /* top front right */
266 SNDRV_CHMAP_TRL, /* top back left */
267 SNDRV_CHMAP_TRC, /* top back center */
268 SNDRV_CHMAP_TRR, /* top back right */
269 SNDRV_CHMAP_TFLC, /* top front left of center */
270 SNDRV_CHMAP_TFRC, /* top front right of center */
271 SNDRV_CHMAP_LLFE, /* left LFE */
272 SNDRV_CHMAP_RLFE, /* right LFE */
273 SNDRV_CHMAP_TSL, /* top side left */
274 SNDRV_CHMAP_TSR, /* top side right */
275 SNDRV_CHMAP_BC, /* bottom center */
276 SNDRV_CHMAP_BLC, /* bottom left center */
277 SNDRV_CHMAP_BRC, /* bottom right center */
278 0 /* terminator */
279 };
280 struct snd_pcm_chmap_elem *chmap;
281 const unsigned int *maps;
282 int c;
283
284 if (!bits)
285 return NULL;
286 if (channels > ARRAY_SIZE(chmap->map))
287 return NULL;
288
289 chmap = kzalloc(sizeof(*chmap), GFP_KERNEL);
290 if (!chmap)
291 return NULL;
292
293 maps = protocol == UAC_VERSION_2 ? uac2_maps : uac1_maps;
294 chmap->channels = channels;
295 c = 0;
296 for (; bits && *maps; maps++, bits >>= 1) {
297 if (bits & 1)
298 chmap->map[c++] = *maps;
299 }
300
301 for (; c < channels; c++)
302 chmap->map[c] = SNDRV_CHMAP_UNKNOWN;
303
304 return chmap;
102} 305}
103 306
104/* 307/*
@@ -140,7 +343,7 @@ int snd_usb_add_audio_stream(struct snd_usb_audio *chip,
140 if (err < 0) 343 if (err < 0)
141 return err; 344 return err;
142 snd_usb_init_substream(as, stream, fp); 345 snd_usb_init_substream(as, stream, fp);
143 return 0; 346 return add_chmap(as->pcm, stream, subs);
144 } 347 }
145 348
146 /* create a new pcm */ 349 /* create a new pcm */
@@ -174,7 +377,7 @@ int snd_usb_add_audio_stream(struct snd_usb_audio *chip,
174 377
175 snd_usb_proc_pcm_format_add(as); 378 snd_usb_proc_pcm_format_add(as);
176 379
177 return 0; 380 return add_chmap(pcm, stream, &as->substream[stream]);
178} 381}
179 382
180static int parse_uac_endpoint_attributes(struct snd_usb_audio *chip, 383static int parse_uac_endpoint_attributes(struct snd_usb_audio *chip,
@@ -218,8 +421,11 @@ static int parse_uac_endpoint_attributes(struct snd_usb_audio *chip,
218 return attributes; 421 return attributes;
219} 422}
220 423
221static struct uac2_input_terminal_descriptor * 424/* find an input terminal descriptor (either UAC1 or UAC2) with the given
222 snd_usb_find_input_terminal_descriptor(struct usb_host_interface *ctrl_iface, 425 * terminal id
426 */
427static void *
428snd_usb_find_input_terminal_descriptor(struct usb_host_interface *ctrl_iface,
223 int terminal_id) 429 int terminal_id)
224{ 430{
225 struct uac2_input_terminal_descriptor *term = NULL; 431 struct uac2_input_terminal_descriptor *term = NULL;
@@ -261,6 +467,7 @@ int snd_usb_parse_audio_interface(struct snd_usb_audio *chip, int iface_no)
261 struct audioformat *fp = NULL; 467 struct audioformat *fp = NULL;
262 int num, protocol, clock = 0; 468 int num, protocol, clock = 0;
263 struct uac_format_type_i_continuous_descriptor *fmt; 469 struct uac_format_type_i_continuous_descriptor *fmt;
470 unsigned int chconfig;
264 471
265 dev = chip->dev; 472 dev = chip->dev;
266 473
@@ -300,6 +507,7 @@ int snd_usb_parse_audio_interface(struct snd_usb_audio *chip, int iface_no)
300 if (snd_usb_apply_interface_quirk(chip, iface_no, altno)) 507 if (snd_usb_apply_interface_quirk(chip, iface_no, altno))
301 continue; 508 continue;
302 509
510 chconfig = 0;
303 /* get audio formats */ 511 /* get audio formats */
304 switch (protocol) { 512 switch (protocol) {
305 default: 513 default:
@@ -311,6 +519,7 @@ int snd_usb_parse_audio_interface(struct snd_usb_audio *chip, int iface_no)
311 case UAC_VERSION_1: { 519 case UAC_VERSION_1: {
312 struct uac1_as_header_descriptor *as = 520 struct uac1_as_header_descriptor *as =
313 snd_usb_find_csint_desc(alts->extra, alts->extralen, NULL, UAC_AS_GENERAL); 521 snd_usb_find_csint_desc(alts->extra, alts->extralen, NULL, UAC_AS_GENERAL);
522 struct uac_input_terminal_descriptor *iterm;
314 523
315 if (!as) { 524 if (!as) {
316 snd_printk(KERN_ERR "%d:%u:%d : UAC_AS_GENERAL descriptor not found\n", 525 snd_printk(KERN_ERR "%d:%u:%d : UAC_AS_GENERAL descriptor not found\n",
@@ -325,6 +534,14 @@ int snd_usb_parse_audio_interface(struct snd_usb_audio *chip, int iface_no)
325 } 534 }
326 535
327 format = le16_to_cpu(as->wFormatTag); /* remember the format value */ 536 format = le16_to_cpu(as->wFormatTag); /* remember the format value */
537
538 iterm = snd_usb_find_input_terminal_descriptor(chip->ctrl_intf,
539 as->bTerminalLink);
540 if (iterm) {
541 num_channels = iterm->bNrChannels;
542 chconfig = le16_to_cpu(iterm->wChannelConfig);
543 }
544
328 break; 545 break;
329 } 546 }
330 547
@@ -355,6 +572,7 @@ int snd_usb_parse_audio_interface(struct snd_usb_audio *chip, int iface_no)
355 as->bTerminalLink); 572 as->bTerminalLink);
356 if (input_term) { 573 if (input_term) {
357 clock = input_term->bCSourceID; 574 clock = input_term->bCSourceID;
575 chconfig = le32_to_cpu(input_term->bmChannelConfig);
358 break; 576 break;
359 } 577 }
360 578
@@ -413,13 +631,13 @@ int snd_usb_parse_audio_interface(struct snd_usb_audio *chip, int iface_no)
413 fp->ep_attr = get_endpoint(alts, 0)->bmAttributes; 631 fp->ep_attr = get_endpoint(alts, 0)->bmAttributes;
414 fp->datainterval = snd_usb_parse_datainterval(chip, alts); 632 fp->datainterval = snd_usb_parse_datainterval(chip, alts);
415 fp->maxpacksize = le16_to_cpu(get_endpoint(alts, 0)->wMaxPacketSize); 633 fp->maxpacksize = le16_to_cpu(get_endpoint(alts, 0)->wMaxPacketSize);
416 /* num_channels is only set for v2 interfaces */
417 fp->channels = num_channels; 634 fp->channels = num_channels;
418 if (snd_usb_get_speed(dev) == USB_SPEED_HIGH) 635 if (snd_usb_get_speed(dev) == USB_SPEED_HIGH)
419 fp->maxpacksize = (((fp->maxpacksize >> 11) & 3) + 1) 636 fp->maxpacksize = (((fp->maxpacksize >> 11) & 3) + 1)
420 * (fp->maxpacksize & 0x7ff); 637 * (fp->maxpacksize & 0x7ff);
421 fp->attributes = parse_uac_endpoint_attributes(chip, alts, protocol, iface_no); 638 fp->attributes = parse_uac_endpoint_attributes(chip, alts, protocol, iface_no);
422 fp->clock = clock; 639 fp->clock = clock;
640 fp->chmap = convert_chmap(num_channels, chconfig, protocol);
423 641
424 /* some quirks for attributes here */ 642 /* some quirks for attributes here */
425 643
@@ -455,6 +673,7 @@ int snd_usb_parse_audio_interface(struct snd_usb_audio *chip, int iface_no)
455 /* ok, let's parse further... */ 673 /* ok, let's parse further... */
456 if (snd_usb_parse_audio_format(chip, fp, format, fmt, stream, alts) < 0) { 674 if (snd_usb_parse_audio_format(chip, fp, format, fmt, stream, alts) < 0) {
457 kfree(fp->rate_table); 675 kfree(fp->rate_table);
676 kfree(fp->chmap);
458 kfree(fp); 677 kfree(fp);
459 fp = NULL; 678 fp = NULL;
460 continue; 679 continue;
@@ -464,6 +683,7 @@ int snd_usb_parse_audio_interface(struct snd_usb_audio *chip, int iface_no)
464 err = snd_usb_add_audio_stream(chip, stream, fp); 683 err = snd_usb_add_audio_stream(chip, stream, fp);
465 if (err < 0) { 684 if (err < 0) {
466 kfree(fp->rate_table); 685 kfree(fp->rate_table);
686 kfree(fp->chmap);
467 kfree(fp); 687 kfree(fp);
468 return err; 688 return err;
469 } 689 }
diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h
index ef42797f56fb..1ac3fd9cc5a6 100644
--- a/sound/usb/usbaudio.h
+++ b/sound/usb/usbaudio.h
@@ -56,7 +56,6 @@ struct snd_usb_audio {
56 56
57 int setup; /* from the 'device_setup' module param */ 57 int setup; /* from the 'device_setup' module param */
58 int nrpacks; /* from the 'nrpacks' module param */ 58 int nrpacks; /* from the 'nrpacks' module param */
59 int async_unlink; /* from the 'async_unlink' module param */
60 59
61 struct usb_host_interface *ctrl_intf; /* the audio control interface */ 60 struct usb_host_interface *ctrl_intf; /* the audio control interface */
62}; 61};