aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-12-13 14:51:23 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2012-12-13 14:51:23 -0500
commit046e7d685bc370fd4c879ab6635ad3f69e6673d1 (patch)
tree36b981f8d1f2bfd348c1479acbe3a9426d35c377 /sound
parentfe504c5c745aeb767d978fbedeb94775fd4cb69c (diff)
parent6eb827d23577a4efec2b10a9c4cc9ded268a1d1c (diff)
Merge tag 'sound-3.8' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
Pull sound updates from Takashi Iwai: "This update contains a fairly wide range of changes all over in sound subdirectory, mainly because of UAPI header moves by David and __dev* annotation removals by Bill. Other highlights are: - Introduced the support for wallclock timestamps in ALSA PCM core - Add the poll loop implementation for HD-audio jack detection - Yet more VGA-switcheroo fixes for HD-audio - New VIA HD-audio codec support - More fixes on resource management in USB audio and MIDI drivers - More quirks for USB-audio ASUS Xonar U3, Reloop Play, Focusrite, Roland VG-99, etc - Add support for FastTrack C400 usb-audio - Clean ups in many drivers regarding firmware loading - Add PSC724 Ultiimate Edge support to ice1712 - A few hdspm driver updates - New Stanton SCS.1d/1m FireWire driver - Standardisation of the logging in ASoC codes - DT and dmaengine support for ASoC Atmel - Support for Wolfson ADSP cores - New drivers for Freescale/iVeia P1022 and Maxim MAX98090 - Lots of other ASoC driver fixes and developments" Fix up trivial conflicts. And go out on a limb and assume the dts file 'status' field of one of the conflicting things was supposed to be "disabled", not "disable" like in pretty much all other cases. * tag 'sound-3.8' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (341 commits) ALSA: hda - Move runtime PM check to runtime_idle callback ALSA: hda - Add stereo-dmic fixup for Acer Aspire One 522 ALSA: hda - Avoid doubly suspend after vga switcheroo ALSA: usb-audio: Enable S/PDIF on the ASUS Xonar U3 ALSA: hda - Check validity of CORB/RIRB WP reads ALSA: hda - use usleep_range in link reset and change timeout check ALSA: HDA: VIA: Add support for codec VT1808. ALSA: HDA: VIA Add support for codec VT1705CF. ASoC: codecs: remove __dev* attributes ASoC: utils: remove __dev* attributes ASoC: ux500: remove __dev* attributes ASoC: txx9: remove __dev* attributes ASoC: tegra: remove __dev* attributes ASoC: spear: remove __dev* attributes ASoC: sh: remove __dev* attributes ASoC: s6000: remove __dev* attributes ASoC: OMAP: remove __dev* attributes ASoC: nuc900: remove __dev* attributes ASoC: mxs: remove __dev* attributes ASoC: kirkwood: remove __dev* attributes ...
Diffstat (limited to 'sound')
-rw-r--r--sound/arm/aaci.c18
-rw-r--r--sound/arm/pxa2xx-ac97-lib.c2
-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/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/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/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/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.c42
-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.c214
-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.c22
-rw-r--r--sound/pci/hda/patch_realtek.c192
-rw-r--r--sound/pci/hda/patch_sigmatel.c150
-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.c43
-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.c16
-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/atmel/Kconfig13
-rw-r--r--sound/soc/atmel/Makefile4
-rw-r--r--sound/soc/atmel/atmel-pcm-dma.c240
-rw-r--r--sound/soc/atmel/atmel-pcm-pdc.c401
-rw-r--r--sound/soc/atmel/atmel-pcm.c401
-rw-r--r--sound/soc/atmel/atmel-pcm.h34
-rw-r--r--sound/soc/atmel/atmel_ssc_dai.c168
-rw-r--r--sound/soc/atmel/atmel_ssc_dai.h3
-rw-r--r--sound/soc/atmel/sam9g20_wm8731.c116
-rw-r--r--sound/soc/au1x/ac97c.c6
-rw-r--r--sound/soc/au1x/db1000.c6
-rw-r--r--sound/soc/au1x/db1200.c8
-rw-r--r--sound/soc/au1x/dbdma2.c6
-rw-r--r--sound/soc/au1x/dma.c6
-rw-r--r--sound/soc/au1x/i2sc.c6
-rw-r--r--sound/soc/au1x/psc-ac97.c6
-rw-r--r--sound/soc/au1x/psc-i2s.c6
-rw-r--r--sound/soc/blackfin/bf5xx-ac97-pcm.c6
-rw-r--r--sound/soc/blackfin/bf5xx-ac97.c6
-rw-r--r--sound/soc/blackfin/bf5xx-ad1836.c6
-rw-r--r--sound/soc/blackfin/bf5xx-i2s-pcm.c6
-rw-r--r--sound/soc/blackfin/bf5xx-i2s.c6
-rw-r--r--sound/soc/blackfin/bf5xx-tdm-pcm.c6
-rw-r--r--sound/soc/blackfin/bf5xx-tdm.c6
-rw-r--r--sound/soc/blackfin/bf6xx-i2s.c6
-rw-r--r--sound/soc/blackfin/bfin-eval-adau1373.c4
-rw-r--r--sound/soc/blackfin/bfin-eval-adau1701.c4
-rw-r--r--sound/soc/blackfin/bfin-eval-adav80x.c4
-rw-r--r--sound/soc/cirrus/edb93xx.c6
-rw-r--r--sound/soc/cirrus/ep93xx-ac97.c6
-rw-r--r--sound/soc/cirrus/ep93xx-i2s.c4
-rw-r--r--sound/soc/cirrus/ep93xx-pcm.c6
-rw-r--r--sound/soc/cirrus/simone.c6
-rw-r--r--sound/soc/cirrus/snappercl15.c6
-rw-r--r--sound/soc/codecs/88pm860x-codec.c6
-rw-r--r--sound/soc/codecs/Kconfig16
-rw-r--r--sound/soc/codecs/Makefile6
-rw-r--r--sound/soc/codecs/ab8500-codec.c8
-rw-r--r--sound/soc/codecs/ac97.c6
-rw-r--r--sound/soc/codecs/ad1836.c6
-rw-r--r--sound/soc/codecs/ad193x.c14
-rw-r--r--sound/soc/codecs/ad1980.c6
-rw-r--r--sound/soc/codecs/ad73311.c4
-rw-r--r--sound/soc/codecs/adau1373.c8
-rw-r--r--sound/soc/codecs/adau1701.c8
-rw-r--r--sound/soc/codecs/adav80x.c20
-rw-r--r--sound/soc/codecs/ads117x.c6
-rw-r--r--sound/soc/codecs/ak4104.c69
-rw-r--r--sound/soc/codecs/ak4535.c15
-rw-r--r--sound/soc/codecs/ak4641.c8
-rw-r--r--sound/soc/codecs/ak4642.c31
-rw-r--r--sound/soc/codecs/ak4671.c8
-rw-r--r--sound/soc/codecs/alc5623.c8
-rw-r--r--sound/soc/codecs/alc5632.c8
-rw-r--r--sound/soc/codecs/arizona.c53
-rw-r--r--sound/soc/codecs/arizona.h71
-rw-r--r--sound/soc/codecs/cq93vc.c2
-rw-r--r--sound/soc/codecs/cs4271.c35
-rw-r--r--sound/soc/codecs/cs42l52.c2
-rw-r--r--sound/soc/codecs/cs42l73.c8
-rw-r--r--sound/soc/codecs/da7210.c38
-rw-r--r--sound/soc/codecs/da732x.c8
-rw-r--r--sound/soc/codecs/da9055.c51
-rw-r--r--sound/soc/codecs/dfbmcs320.c6
-rw-r--r--sound/soc/codecs/dmic.c6
-rw-r--r--sound/soc/codecs/isabelle.c8
-rw-r--r--sound/soc/codecs/jz4740.c148
-rw-r--r--sound/soc/codecs/lm4857.c8
-rw-r--r--sound/soc/codecs/lm49453.c18
-rw-r--r--sound/soc/codecs/max9768.c15
-rw-r--r--sound/soc/codecs/max98088.c16
-rw-r--r--sound/soc/codecs/max98090.c577
-rw-r--r--sound/soc/codecs/max98095.c4
-rw-r--r--sound/soc/codecs/max9850.c8
-rw-r--r--sound/soc/codecs/max9877.c8
-rw-r--r--sound/soc/codecs/mc13783.c2
-rw-r--r--sound/soc/codecs/ml26124.c8
-rw-r--r--sound/soc/codecs/omap-hdmi.c6
-rw-r--r--sound/soc/codecs/pcm3008.c6
-rw-r--r--sound/soc/codecs/rt5631.c6
-rw-r--r--sound/soc/codecs/sgtl5000.c8
-rw-r--r--sound/soc/codecs/si476x.c255
-rw-r--r--sound/soc/codecs/sn95031.c6
-rw-r--r--sound/soc/codecs/ssm2602.c12
-rw-r--r--sound/soc/codecs/sta32x.c8
-rw-r--r--sound/soc/codecs/sta529.c8
-rw-r--r--sound/soc/codecs/stac9766.c6
-rw-r--r--sound/soc/codecs/tlv320aic32x4.c32
-rw-r--r--sound/soc/codecs/tlv320aic32x4.h3
-rw-r--r--sound/soc/codecs/tlv320dac33.c8
-rw-r--r--sound/soc/codecs/tpa6130a2.c8
-rw-r--r--sound/soc/codecs/twl4030.c6
-rw-r--r--sound/soc/codecs/twl6040.c6
-rw-r--r--sound/soc/codecs/uda134x.c6
-rw-r--r--sound/soc/codecs/uda1380.c8
-rw-r--r--sound/soc/codecs/wl1273.c6
-rw-r--r--sound/soc/codecs/wm0010.c425
-rw-r--r--sound/soc/codecs/wm1250-ev1.c10
-rw-r--r--sound/soc/codecs/wm2000.c10
-rw-r--r--sound/soc/codecs/wm2200.c277
-rw-r--r--sound/soc/codecs/wm5100.c10
-rw-r--r--sound/soc/codecs/wm5102.c144
-rw-r--r--sound/soc/codecs/wm5110.c75
-rw-r--r--sound/soc/codecs/wm8350.c10
-rw-r--r--sound/soc/codecs/wm8400.c20
-rw-r--r--sound/soc/codecs/wm8510.c17
-rw-r--r--sound/soc/codecs/wm8523.c8
-rw-r--r--sound/soc/codecs/wm8711.c14
-rw-r--r--sound/soc/codecs/wm8727.c6
-rw-r--r--sound/soc/codecs/wm8728.c14
-rw-r--r--sound/soc/codecs/wm8731.c14
-rw-r--r--sound/soc/codecs/wm8737.c14
-rw-r--r--sound/soc/codecs/wm8741.c10
-rw-r--r--sound/soc/codecs/wm8750.c100
-rw-r--r--sound/soc/codecs/wm8753.c47
-rw-r--r--sound/soc/codecs/wm8770.c223
-rw-r--r--sound/soc/codecs/wm8776.c14
-rw-r--r--sound/soc/codecs/wm8782.c6
-rw-r--r--sound/soc/codecs/wm8804.c31
-rw-r--r--sound/soc/codecs/wm8900.c14
-rw-r--r--sound/soc/codecs/wm8903.c8
-rw-r--r--sound/soc/codecs/wm8904.c8
-rw-r--r--sound/soc/codecs/wm8940.c8
-rw-r--r--sound/soc/codecs/wm8955.c19
-rw-r--r--sound/soc/codecs/wm8958-dsp2.c79
-rw-r--r--sound/soc/codecs/wm8960.c10
-rw-r--r--sound/soc/codecs/wm8961.c8
-rw-r--r--sound/soc/codecs/wm8962.c32
-rw-r--r--sound/soc/codecs/wm8971.c88
-rw-r--r--sound/soc/codecs/wm8974.c8
-rw-r--r--sound/soc/codecs/wm8978.c24
-rw-r--r--sound/soc/codecs/wm8983.c14
-rw-r--r--sound/soc/codecs/wm8985.c44
-rw-r--r--sound/soc/codecs/wm8988.c28
-rw-r--r--sound/soc/codecs/wm8990.c8
-rw-r--r--sound/soc/codecs/wm8991.c8
-rw-r--r--sound/soc/codecs/wm8993.c22
-rw-r--r--sound/soc/codecs/wm8994.c349
-rw-r--r--sound/soc/codecs/wm8994.h13
-rw-r--r--sound/soc/codecs/wm8995.c54
-rw-r--r--sound/soc/codecs/wm8996.c8
-rw-r--r--sound/soc/codecs/wm9081.c30
-rw-r--r--sound/soc/codecs/wm9090.c24
-rw-r--r--sound/soc/codecs/wm9705.c6
-rw-r--r--sound/soc/codecs/wm9712.c6
-rw-r--r--sound/soc/codecs/wm9713.c6
-rw-r--r--sound/soc/codecs/wm_adsp.c699
-rw-r--r--sound/soc/codecs/wm_adsp.h59
-rw-r--r--sound/soc/codecs/wmfw.h128
-rw-r--r--sound/soc/davinci/davinci-evm.c5
-rw-r--r--sound/soc/davinci/davinci-mcasp.c152
-rw-r--r--sound/soc/davinci/davinci-mcasp.h15
-rw-r--r--sound/soc/davinci/davinci-pcm.c53
-rw-r--r--sound/soc/davinci/davinci-pcm.h2
-rw-r--r--sound/soc/fsl/Kconfig20
-rw-r--r--sound/soc/fsl/Makefile14
-rw-r--r--sound/soc/fsl/eukrea-tlv320.c6
-rw-r--r--sound/soc/fsl/fsl_dma.c6
-rw-r--r--sound/soc/fsl/fsl_ssi.c2
-rw-r--r--sound/soc/fsl/imx-audmux.c8
-rw-r--r--sound/soc/fsl/imx-mc13783.c6
-rw-r--r--sound/soc/fsl/imx-pcm-dma.c6
-rw-r--r--sound/soc/fsl/imx-pcm-fiq.c6
-rw-r--r--sound/soc/fsl/imx-pcm.c4
-rw-r--r--sound/soc/fsl/imx-sgtl5000.c7
-rw-r--r--sound/soc/fsl/imx-ssi.c4
-rw-r--r--sound/soc/fsl/mpc5200_psc_ac97.c8
-rw-r--r--sound/soc/fsl/mpc5200_psc_i2s.c8
-rw-r--r--sound/soc/fsl/mpc8610_hpcd.c4
-rw-r--r--sound/soc/fsl/mx27vis-aic32x4.c6
-rw-r--r--sound/soc/fsl/p1022_ds.c4
-rw-r--r--sound/soc/fsl/p1022_rdk.c392
-rw-r--r--sound/soc/fsl/pcm030-audio-fabric.c8
-rw-r--r--sound/soc/jz4740/jz4740-i2s.c6
-rw-r--r--sound/soc/jz4740/jz4740-pcm.c6
-rw-r--r--sound/soc/jz4740/qi_lb60.c6
-rw-r--r--sound/soc/kirkwood/kirkwood-dma.c22
-rw-r--r--sound/soc/kirkwood/kirkwood-i2s.c241
-rw-r--r--sound/soc/kirkwood/kirkwood-openrd.c6
-rw-r--r--sound/soc/kirkwood/kirkwood-t5325.c6
-rw-r--r--sound/soc/kirkwood/kirkwood.h11
-rw-r--r--sound/soc/mid-x86/mfld_machine.c6
-rw-r--r--sound/soc/mxs/mxs-pcm.c4
-rw-r--r--sound/soc/mxs/mxs-saif.c8
-rw-r--r--sound/soc/mxs/mxs-sgtl5000.c8
-rw-r--r--sound/soc/nuc900/nuc900-ac97.c6
-rw-r--r--sound/soc/nuc900/nuc900-pcm.c6
-rw-r--r--sound/soc/omap/ams-delta.c6
-rw-r--r--sound/soc/omap/mcbsp.c7
-rw-r--r--sound/soc/omap/mcbsp.h4
-rw-r--r--sound/soc/omap/omap-abe-twl6040.c10
-rw-r--r--sound/soc/omap/omap-dmic.c6
-rw-r--r--sound/soc/omap/omap-hdmi-card.c6
-rw-r--r--sound/soc/omap/omap-hdmi.c6
-rw-r--r--sound/soc/omap/omap-mcbsp.c6
-rw-r--r--sound/soc/omap/omap-mcpdm.c6
-rw-r--r--sound/soc/omap/omap-pcm.c6
-rw-r--r--sound/soc/omap/omap-twl4030.c6
-rw-r--r--sound/soc/omap/zoom2.c7
-rw-r--r--sound/soc/pxa/brownstone.c6
-rw-r--r--sound/soc/pxa/corgi.c6
-rw-r--r--sound/soc/pxa/e740_wm9705.c6
-rw-r--r--sound/soc/pxa/e750_wm9705.c6
-rw-r--r--sound/soc/pxa/e800_wm9712.c6
-rw-r--r--sound/soc/pxa/hx4700.c6
-rw-r--r--sound/soc/pxa/imote2.c6
-rw-r--r--sound/soc/pxa/mioa701_wm9713.c6
-rw-r--r--sound/soc/pxa/mmp-pcm.c6
-rw-r--r--sound/soc/pxa/mmp-sspa.c6
-rw-r--r--sound/soc/pxa/palm27x.c4
-rw-r--r--sound/soc/pxa/poodle.c6
-rw-r--r--sound/soc/pxa/pxa-ssp.c6
-rw-r--r--sound/soc/pxa/pxa2xx-ac97.c8
-rw-r--r--sound/soc/pxa/pxa2xx-i2s.c4
-rw-r--r--sound/soc/pxa/pxa2xx-pcm.c6
-rw-r--r--sound/soc/pxa/tosa.c6
-rw-r--r--sound/soc/pxa/ttc-dkb.c6
-rw-r--r--sound/soc/s6000/s6000-i2s.c6
-rw-r--r--sound/soc/s6000/s6000-pcm.c6
-rw-r--r--sound/soc/samsung/ac97.c22
-rw-r--r--sound/soc/samsung/bells.c228
-rw-r--r--sound/soc/samsung/dma.c24
-rw-r--r--sound/soc/samsung/dma.h3
-rw-r--r--sound/soc/samsung/goni_wm8994.c2
-rw-r--r--sound/soc/samsung/h1940_uda1380.c2
-rw-r--r--sound/soc/samsung/i2s.c33
-rw-r--r--sound/soc/samsung/idma.c6
-rw-r--r--sound/soc/samsung/jive_wm8750.c2
-rw-r--r--sound/soc/samsung/littlemill.c10
-rw-r--r--sound/soc/samsung/ln2440sbc_alc650.c2
-rw-r--r--sound/soc/samsung/lowland.c8
-rw-r--r--sound/soc/samsung/neo1973_wm8753.c2
-rw-r--r--sound/soc/samsung/pcm.c27
-rw-r--r--sound/soc/samsung/rx1950_uda1380.c2
-rw-r--r--sound/soc/samsung/s3c2412-i2s.c26
-rw-r--r--sound/soc/samsung/s3c24xx-i2s.c26
-rw-r--r--sound/soc/samsung/s3c24xx_simtec.c6
-rw-r--r--sound/soc/samsung/s3c24xx_simtec_hermes.c6
-rw-r--r--sound/soc/samsung/s3c24xx_simtec_tlv320aic23.c6
-rw-r--r--sound/soc/samsung/s3c24xx_uda134x.c2
-rw-r--r--sound/soc/samsung/smartq_wm8987.c2
-rw-r--r--sound/soc/samsung/smdk2443_wm9710.c2
-rw-r--r--sound/soc/samsung/smdk_spdif.c2
-rw-r--r--sound/soc/samsung/smdk_wm8580.c6
-rw-r--r--sound/soc/samsung/smdk_wm8580pcm.c8
-rw-r--r--sound/soc/samsung/smdk_wm8994.c10
-rw-r--r--sound/soc/samsung/smdk_wm8994pcm.c8
-rw-r--r--sound/soc/samsung/smdk_wm9713.c2
-rw-r--r--sound/soc/samsung/spdif.c28
-rw-r--r--sound/soc/samsung/speyside.c8
-rw-r--r--sound/soc/samsung/tobermory.c8
-rw-r--r--sound/soc/sh/dma-sh7760.c6
-rw-r--r--sound/soc/sh/fsi.c125
-rw-r--r--sound/soc/sh/hac.c6
-rw-r--r--sound/soc/sh/siu_dai.c6
-rw-r--r--sound/soc/sh/ssi.c6
-rw-r--r--sound/soc/soc-cache.c10
-rw-r--r--sound/soc/soc-core.c243
-rw-r--r--sound/soc/soc-dapm.c134
-rw-r--r--sound/soc/soc-dmaengine-pcm.c2
-rw-r--r--sound/soc/soc-jack.c16
-rw-r--r--sound/soc/soc-pcm.c195
-rw-r--r--sound/soc/soc-utils.c6
-rw-r--r--sound/soc/spear/spear_pcm.c6
-rw-r--r--sound/soc/tegra/tegra20_das.c8
-rw-r--r--sound/soc/tegra/tegra20_i2s.c10
-rw-r--r--sound/soc/tegra/tegra20_spdif.c8
-rw-r--r--sound/soc/tegra/tegra30_ahub.c14
-rw-r--r--sound/soc/tegra/tegra30_i2s.c10
-rw-r--r--sound/soc/tegra/tegra_alc5632.c8
-rw-r--r--sound/soc/tegra/tegra_pcm.c4
-rw-r--r--sound/soc/tegra/tegra_wm8753.c8
-rw-r--r--sound/soc/tegra/tegra_wm8903.c8
-rw-r--r--sound/soc/tegra/trimslice.c8
-rw-r--r--sound/soc/txx9/txx9aclc-ac97.c6
-rw-r--r--sound/soc/txx9/txx9aclc.c6
-rw-r--r--sound/soc/ux500/mop500.c14
-rw-r--r--sound/soc/ux500/ux500_msp_dai.c59
-rw-r--r--sound/soc/ux500/ux500_msp_dai.h1
-rw-r--r--sound/soc/ux500/ux500_pcm.c19
-rw-r--r--sound/soc/ux500/ux500_pcm.h3
-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.h198
-rw-r--r--sound/usb/stream.c230
-rw-r--r--sound/usb/usbaudio.h1
533 files changed, 13005 insertions, 6311 deletions
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..6fc0ae90e5b1 100644
--- a/sound/arm/pxa2xx-ac97-lib.c
+++ b/sound/arm/pxa2xx-ac97-lib.c
@@ -314,7 +314,7 @@ int pxa2xx_ac97_hw_resume(void)
314EXPORT_SYMBOL_GPL(pxa2xx_ac97_hw_resume); 314EXPORT_SYMBOL_GPL(pxa2xx_ac97_hw_resume);
315#endif 315#endif
316 316
317int __devinit pxa2xx_ac97_hw_probe(struct platform_device *dev) 317int pxa2xx_ac97_hw_probe(struct platform_device *dev)
318{ 318{
319 int ret; 319 int ret;
320 pxa2xx_audio_ops_t *pdata = dev->dev.platform_data; 320 pxa2xx_audio_ops_t *pdata = dev->dev.platform_data;
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/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/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/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/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..879db2d7796a 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;
@@ -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..8353c77536ac 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;
@@ -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..0f3d3db0df71 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(&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(&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..0fcfa6f406b8 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -1193,12 +1193,11 @@ static int hdmi_add_pin(struct hda_codec *codec, hda_nid_t pin_nid)
1193 struct hdmi_spec_per_pin *per_pin; 1193 struct hdmi_spec_per_pin *per_pin;
1194 int err; 1194 int err;
1195 1195
1196 caps = snd_hda_param_read(codec, pin_nid, AC_PAR_PIN_CAP); 1196 caps = snd_hda_query_pin_caps(codec, pin_nid);
1197 if (!(caps & (AC_PINCAP_HDMI | AC_PINCAP_DP))) 1197 if (!(caps & (AC_PINCAP_HDMI | AC_PINCAP_DP)))
1198 return 0; 1198 return 0;
1199 1199
1200 config = snd_hda_codec_read(codec, pin_nid, 0, 1200 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) 1201 if (get_defcfg_connect(config) == AC_JACK_PORT_NONE)
1203 return 0; 1202 return 0;
1204 1203
@@ -1272,7 +1271,7 @@ static int hdmi_parse_codec(struct hda_codec *codec)
1272 unsigned int caps; 1271 unsigned int caps;
1273 unsigned int type; 1272 unsigned int type;
1274 1273
1275 caps = snd_hda_param_read(codec, nid, AC_PAR_AUDIO_WIDGET_CAP); 1274 caps = get_wcaps(codec, nid);
1276 type = get_wcaps_type(caps); 1275 type = get_wcaps_type(caps);
1277 1276
1278 if (!(caps & AC_WCAP_DIGITAL)) 1277 if (!(caps & AC_WCAP_DIGITAL))
@@ -1288,13 +1287,17 @@ static int hdmi_parse_codec(struct hda_codec *codec)
1288 } 1287 }
1289 } 1288 }
1290 1289
1290#ifdef CONFIG_PM
1291 /* We're seeing some problems with unsolicited hot plug events on
1292 * PantherPoint after S3, if this is not enabled */
1293 if (codec->vendor_id == 0x80862806)
1294 codec->bus->power_keep_link_on = 1;
1291 /* 1295 /*
1292 * G45/IbexPeak don't support EPSS: the unsolicited pin hot plug event 1296 * 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 1297 * 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. 1298 * HDA link is powered off at hot plug or hw initialization time.
1295 */ 1299 */
1296#ifdef CONFIG_PM 1300 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)) 1301 AC_PWRST_EPSS))
1299 codec->bus->power_keep_link_on = 1; 1302 codec->bus->power_keep_link_on = 1;
1300#endif 1303#endif
@@ -1589,9 +1592,10 @@ static int generic_hdmi_build_controls(struct hda_codec *codec)
1589 if (err < 0) 1592 if (err < 0)
1590 return err; 1593 return err;
1591 1594
1592 err = snd_hda_create_spdif_out_ctls(codec, 1595 err = snd_hda_create_dig_out_ctls(codec,
1593 per_pin->pin_nid, 1596 per_pin->pin_nid,
1594 per_pin->mux_nids[0]); 1597 per_pin->mux_nids[0],
1598 HDA_PCM_TYPE_HDMI);
1595 if (err < 0) 1599 if (err < 0)
1596 return err; 1600 return err;
1597 snd_hda_spdif_ctls_unassign(codec, pin_idx); 1601 snd_hda_spdif_ctls_unassign(codec, pin_idx);
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index ad68d223f8af..7743775f6abb 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;
@@ -4372,6 +4375,8 @@ static int alc_alloc_spec(struct hda_codec *codec, hda_nid_t mixer_nid)
4372 codec->spec = spec; 4375 codec->spec = spec;
4373 spec->mixer_nid = mixer_nid; 4376 spec->mixer_nid = mixer_nid;
4374 snd_hda_gen_init(&spec->gen); 4377 snd_hda_gen_init(&spec->gen);
4378 snd_array_init(&spec->kctls, sizeof(struct snd_kcontrol_new), 32);
4379 snd_array_init(&spec->bind_ctls, sizeof(struct hda_bind_ctls *), 8);
4375 4380
4376 err = alc_codec_rename_from_preset(codec); 4381 err = alc_codec_rename_from_preset(codec);
4377 if (err < 0) { 4382 if (err < 0) {
@@ -6009,6 +6014,16 @@ static void alc269_fixup_mic2_mute(struct hda_codec *codec,
6009 } 6014 }
6010} 6015}
6011 6016
6017static void alc271_hp_gate_mic_jack(struct hda_codec *codec,
6018 const struct alc_fixup *fix,
6019 int action)
6020{
6021 struct alc_spec *spec = codec->spec;
6022
6023 if (action == ALC_FIXUP_ACT_PROBE)
6024 snd_hda_jack_set_gating_jack(codec, spec->ext_mic_pin,
6025 spec->autocfg.hp_pins[0]);
6026}
6012 6027
6013enum { 6028enum {
6014 ALC269_FIXUP_SONY_VAIO, 6029 ALC269_FIXUP_SONY_VAIO,
@@ -6031,6 +6046,8 @@ enum {
6031 ALC269_FIXUP_INV_DMIC, 6046 ALC269_FIXUP_INV_DMIC,
6032 ALC269_FIXUP_LENOVO_DOCK, 6047 ALC269_FIXUP_LENOVO_DOCK,
6033 ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT, 6048 ALC269_FIXUP_PINCFG_NO_HP_TO_LINEOUT,
6049 ALC271_FIXUP_AMIC_MIC2,
6050 ALC271_FIXUP_HP_GATE_MIC_JACK,
6034}; 6051};
6035 6052
6036static const struct alc_fixup alc269_fixups[] = { 6053static const struct alc_fixup alc269_fixups[] = {
@@ -6175,6 +6192,22 @@ static const struct alc_fixup alc269_fixups[] = {
6175 .type = ALC_FIXUP_FUNC, 6192 .type = ALC_FIXUP_FUNC,
6176 .v.func = alc269_fixup_pincfg_no_hp_to_lineout, 6193 .v.func = alc269_fixup_pincfg_no_hp_to_lineout,
6177 }, 6194 },
6195 [ALC271_FIXUP_AMIC_MIC2] = {
6196 .type = ALC_FIXUP_PINS,
6197 .v.pins = (const struct alc_pincfg[]) {
6198 { 0x14, 0x99130110 }, /* speaker */
6199 { 0x19, 0x01a19c20 }, /* mic */
6200 { 0x1b, 0x99a7012f }, /* int-mic */
6201 { 0x21, 0x0121401f }, /* HP out */
6202 { }
6203 },
6204 },
6205 [ALC271_FIXUP_HP_GATE_MIC_JACK] = {
6206 .type = ALC_FIXUP_FUNC,
6207 .v.func = alc271_hp_gate_mic_jack,
6208 .chained = true,
6209 .chain_id = ALC271_FIXUP_AMIC_MIC2,
6210 },
6178}; 6211};
6179 6212
6180static const struct snd_pci_quirk alc269_fixup_tbl[] = { 6213static const struct snd_pci_quirk alc269_fixup_tbl[] = {
@@ -6195,6 +6228,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
6195 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ), 6228 SND_PCI_QUIRK(0x104d, 0x9084, "Sony VAIO", ALC275_FIXUP_SONY_HWEQ),
6196 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO), 6229 SND_PCI_QUIRK_VENDOR(0x104d, "Sony VAIO", ALC269_FIXUP_SONY_VAIO),
6197 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z), 6230 SND_PCI_QUIRK(0x1028, 0x0470, "Dell M101z", ALC269_FIXUP_DELL_M101Z),
6231 SND_PCI_QUIRK(0x1025, 0x0742, "Acer AO756", ALC271_FIXUP_HP_GATE_MIC_JACK),
6198 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC), 6232 SND_PCI_QUIRK_VENDOR(0x1025, "Acer Aspire", ALC271_FIXUP_DMIC),
6199 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK), 6233 SND_PCI_QUIRK(0x10cf, 0x1475, "Lifebook", ALC269_FIXUP_LIFEBOOK),
6200 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE), 6234 SND_PCI_QUIRK(0x17aa, 0x20f2, "Thinkpad SL410/510", ALC269_FIXUP_SKU_IGNORE),
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 9ba8af056170..df13c0f84899 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,
@@ -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..ab2bca164d6f 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;
@@ -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..550b9cfb8e3e 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;
@@ -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/atmel/Kconfig b/sound/soc/atmel/Kconfig
index 72b09cfd3dc3..d1b691bf8e2d 100644
--- a/sound/soc/atmel/Kconfig
+++ b/sound/soc/atmel/Kconfig
@@ -6,6 +6,14 @@ config SND_ATMEL_SOC
6 the ATMEL SSC interface. You will also need 6 the ATMEL SSC interface. You will also need
7 to select the audio interfaces to support below. 7 to select the audio interfaces to support below.
8 8
9config SND_ATMEL_SOC_PDC
10 tristate
11 depends on SND_ATMEL_SOC
12
13config SND_ATMEL_SOC_DMA
14 tristate
15 depends on SND_ATMEL_SOC
16
9config SND_ATMEL_SOC_SSC 17config SND_ATMEL_SOC_SSC
10 tristate 18 tristate
11 depends on SND_ATMEL_SOC 19 depends on SND_ATMEL_SOC
@@ -16,8 +24,8 @@ config SND_ATMEL_SOC_SSC
16 24
17config SND_AT91_SOC_SAM9G20_WM8731 25config SND_AT91_SOC_SAM9G20_WM8731
18 tristate "SoC Audio support for WM8731-based At91sam9g20 evaluation board" 26 tristate "SoC Audio support for WM8731-based At91sam9g20 evaluation board"
19 depends on ATMEL_SSC && ARCH_AT91SAM9G20 && SND_ATMEL_SOC && \ 27 depends on ATMEL_SSC && SND_ATMEL_SOC && AT91_PROGRAMMABLE_CLOCKS
20 AT91_PROGRAMMABLE_CLOCKS 28 select SND_ATMEL_SOC_PDC
21 select SND_ATMEL_SOC_SSC 29 select SND_ATMEL_SOC_SSC
22 select SND_SOC_WM8731 30 select SND_SOC_WM8731
23 help 31 help
@@ -27,6 +35,7 @@ config SND_AT91_SOC_SAM9G20_WM8731
27config SND_AT91_SOC_AFEB9260 35config SND_AT91_SOC_AFEB9260
28 tristate "SoC Audio support for AFEB9260 board" 36 tristate "SoC Audio support for AFEB9260 board"
29 depends on ATMEL_SSC && ARCH_AT91 && MACH_AFEB9260 && SND_ATMEL_SOC 37 depends on ATMEL_SSC && ARCH_AT91 && MACH_AFEB9260 && SND_ATMEL_SOC
38 select SND_ATMEL_SOC_PDC
30 select SND_ATMEL_SOC_SSC 39 select SND_ATMEL_SOC_SSC
31 select SND_SOC_TLV320AIC23 40 select SND_SOC_TLV320AIC23
32 help 41 help
diff --git a/sound/soc/atmel/Makefile b/sound/soc/atmel/Makefile
index a5c0bf19da78..41967ccb6f41 100644
--- a/sound/soc/atmel/Makefile
+++ b/sound/soc/atmel/Makefile
@@ -1,8 +1,12 @@
1# AT91 Platform Support 1# AT91 Platform Support
2snd-soc-atmel-pcm-objs := atmel-pcm.o 2snd-soc-atmel-pcm-objs := atmel-pcm.o
3snd-soc-atmel-pcm-pdc-objs := atmel-pcm-pdc.o
4snd-soc-atmel-pcm-dma-objs := atmel-pcm-dma.o
3snd-soc-atmel_ssc_dai-objs := atmel_ssc_dai.o 5snd-soc-atmel_ssc_dai-objs := atmel_ssc_dai.o
4 6
5obj-$(CONFIG_SND_ATMEL_SOC) += snd-soc-atmel-pcm.o 7obj-$(CONFIG_SND_ATMEL_SOC) += snd-soc-atmel-pcm.o
8obj-$(CONFIG_SND_ATMEL_SOC_PDC) += snd-soc-atmel-pcm-pdc.o
9obj-$(CONFIG_SND_ATMEL_SOC_DMA) += snd-soc-atmel-pcm-dma.o
6obj-$(CONFIG_SND_ATMEL_SOC_SSC) += snd-soc-atmel_ssc_dai.o 10obj-$(CONFIG_SND_ATMEL_SOC_SSC) += snd-soc-atmel_ssc_dai.o
7 11
8# AT91 Machine Support 12# AT91 Machine Support
diff --git a/sound/soc/atmel/atmel-pcm-dma.c b/sound/soc/atmel/atmel-pcm-dma.c
new file mode 100644
index 000000000000..30184a4a147a
--- /dev/null
+++ b/sound/soc/atmel/atmel-pcm-dma.c
@@ -0,0 +1,240 @@
1/*
2 * atmel-pcm-dma.c -- ALSA PCM DMA support for the Atmel SoC.
3 *
4 * Copyright (C) 2012 Atmel
5 *
6 * Author: Bo Shen <voice.shen@atmel.com>
7 *
8 * Based on atmel-pcm by:
9 * Sedji Gaouaou <sedji.gaouaou@atmel.com>
10 * Copyright 2008 Atmel
11 *
12 * This program is free software; you can redistribute it and/or modify
13 * it under the terms of the GNU General Public License as published by
14 * the Free Software Foundation; either version 2 of the License, or
15 * (at your option) any later version.
16 *
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
21 *
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 */
26
27#include <linux/module.h>
28#include <linux/init.h>
29#include <linux/platform_device.h>
30#include <linux/slab.h>
31#include <linux/dma-mapping.h>
32#include <linux/dmaengine.h>
33#include <linux/atmel-ssc.h>
34#include <linux/platform_data/dma-atmel.h>
35
36#include <sound/core.h>
37#include <sound/pcm.h>
38#include <sound/pcm_params.h>
39#include <sound/soc.h>
40#include <sound/dmaengine_pcm.h>
41
42#include "atmel-pcm.h"
43
44/*--------------------------------------------------------------------------*\
45 * Hardware definition
46\*--------------------------------------------------------------------------*/
47static const struct snd_pcm_hardware atmel_pcm_dma_hardware = {
48 .info = SNDRV_PCM_INFO_MMAP |
49 SNDRV_PCM_INFO_MMAP_VALID |
50 SNDRV_PCM_INFO_INTERLEAVED |
51 SNDRV_PCM_INFO_RESUME |
52 SNDRV_PCM_INFO_PAUSE,
53 .formats = SNDRV_PCM_FMTBIT_S16_LE,
54 .period_bytes_min = 256, /* lighting DMA overhead */
55 .period_bytes_max = 2 * 0xffff, /* if 2 bytes format */
56 .periods_min = 8,
57 .periods_max = 1024, /* no limit */
58 .buffer_bytes_max = ATMEL_SSC_DMABUF_SIZE,
59};
60
61/**
62 * atmel_pcm_dma_irq: SSC interrupt handler for DMAENGINE enabled SSC
63 *
64 * We use DMAENGINE to send/receive data to/from SSC so this ISR is only to
65 * check if any overrun occured.
66 */
67static void atmel_pcm_dma_irq(u32 ssc_sr,
68 struct snd_pcm_substream *substream)
69{
70 struct atmel_pcm_dma_params *prtd;
71
72 prtd = snd_dmaengine_pcm_get_data(substream);
73
74 if (ssc_sr & prtd->mask->ssc_error) {
75 if (snd_pcm_running(substream))
76 pr_warn("atmel-pcm: buffer %s on %s (SSC_SR=%#x)\n",
77 substream->stream == SNDRV_PCM_STREAM_PLAYBACK
78 ? "underrun" : "overrun", prtd->name,
79 ssc_sr);
80
81 /* stop RX and capture: will be enabled again at restart */
82 ssc_writex(prtd->ssc->regs, SSC_CR, prtd->mask->ssc_disable);
83 snd_pcm_stop(substream, SNDRV_PCM_STATE_XRUN);
84
85 /* now drain RHR and read status to remove xrun condition */
86 ssc_readx(prtd->ssc->regs, SSC_RHR);
87 ssc_readx(prtd->ssc->regs, SSC_SR);
88 }
89}
90
91/*--------------------------------------------------------------------------*\
92 * DMAENGINE operations
93\*--------------------------------------------------------------------------*/
94static bool filter(struct dma_chan *chan, void *slave)
95{
96 struct at_dma_slave *sl = slave;
97
98 if (sl->dma_dev == chan->device->dev) {
99 chan->private = sl;
100 return true;
101 } else {
102 return false;
103 }
104}
105
106static int atmel_pcm_configure_dma(struct snd_pcm_substream *substream,
107 struct snd_pcm_hw_params *params)
108{
109 struct atmel_pcm_dma_params *prtd;
110 struct ssc_device *ssc;
111 struct dma_chan *dma_chan;
112 struct dma_slave_config slave_config;
113 int ret;
114
115 prtd = snd_dmaengine_pcm_get_data(substream);
116 ssc = prtd->ssc;
117
118 ret = snd_hwparams_to_dma_slave_config(substream, params,
119 &slave_config);
120 if (ret) {
121 pr_err("atmel-pcm: hwparams to dma slave configure failed\n");
122 return ret;
123 }
124
125 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
126 slave_config.dst_addr = (dma_addr_t)ssc->phybase + SSC_THR;
127 slave_config.dst_maxburst = 1;
128 } else {
129 slave_config.src_addr = (dma_addr_t)ssc->phybase + SSC_RHR;
130 slave_config.src_maxburst = 1;
131 }
132
133 slave_config.device_fc = false;
134
135 dma_chan = snd_dmaengine_pcm_get_chan(substream);
136 if (dmaengine_slave_config(dma_chan, &slave_config)) {
137 pr_err("atmel-pcm: failed to configure dma channel\n");
138 ret = -EBUSY;
139 return ret;
140 }
141
142 return 0;
143}
144
145static int atmel_pcm_hw_params(struct snd_pcm_substream *substream,
146 struct snd_pcm_hw_params *params)
147{
148 struct snd_soc_pcm_runtime *rtd = substream->private_data;
149 struct atmel_pcm_dma_params *prtd;
150 struct ssc_device *ssc;
151 struct at_dma_slave *sdata = NULL;
152 int ret;
153
154 snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer);
155
156 prtd = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
157 ssc = prtd->ssc;
158 if (ssc->pdev)
159 sdata = ssc->pdev->dev.platform_data;
160
161 ret = snd_dmaengine_pcm_open(substream, filter, sdata);
162 if (ret) {
163 pr_err("atmel-pcm: dmaengine pcm open failed\n");
164 return -EINVAL;
165 }
166
167 snd_dmaengine_pcm_set_data(substream, prtd);
168
169 ret = atmel_pcm_configure_dma(substream, params);
170 if (ret) {
171 pr_err("atmel-pcm: failed to configure dmai\n");
172 goto err;
173 }
174
175 prtd->dma_intr_handler = atmel_pcm_dma_irq;
176
177 return 0;
178err:
179 snd_dmaengine_pcm_close(substream);
180 return ret;
181}
182
183static int atmel_pcm_dma_prepare(struct snd_pcm_substream *substream)
184{
185 struct atmel_pcm_dma_params *prtd;
186
187 prtd = snd_dmaengine_pcm_get_data(substream);
188
189 ssc_writex(prtd->ssc->regs, SSC_IER, prtd->mask->ssc_error);
190 ssc_writex(prtd->ssc->regs, SSC_CR, prtd->mask->ssc_enable);
191
192 return 0;
193}
194
195static int atmel_pcm_open(struct snd_pcm_substream *substream)
196{
197 snd_soc_set_runtime_hwparams(substream, &atmel_pcm_dma_hardware);
198
199 return 0;
200}
201
202static int atmel_pcm_close(struct snd_pcm_substream *substream)
203{
204 snd_dmaengine_pcm_close(substream);
205
206 return 0;
207}
208
209static struct snd_pcm_ops atmel_pcm_ops = {
210 .open = atmel_pcm_open,
211 .close = atmel_pcm_close,
212 .ioctl = snd_pcm_lib_ioctl,
213 .hw_params = atmel_pcm_hw_params,
214 .prepare = atmel_pcm_dma_prepare,
215 .trigger = snd_dmaengine_pcm_trigger,
216 .pointer = snd_dmaengine_pcm_pointer_no_residue,
217 .mmap = atmel_pcm_mmap,
218};
219
220static struct snd_soc_platform_driver atmel_soc_platform = {
221 .ops = &atmel_pcm_ops,
222 .pcm_new = atmel_pcm_new,
223 .pcm_free = atmel_pcm_free,
224};
225
226int atmel_pcm_dma_platform_register(struct device *dev)
227{
228 return snd_soc_register_platform(dev, &atmel_soc_platform);
229}
230EXPORT_SYMBOL(atmel_pcm_dma_platform_register);
231
232void atmel_pcm_dma_platform_unregister(struct device *dev)
233{
234 snd_soc_unregister_platform(dev);
235}
236EXPORT_SYMBOL(atmel_pcm_dma_platform_unregister);
237
238MODULE_AUTHOR("Bo Shen <voice.shen@atmel.com>");
239MODULE_DESCRIPTION("Atmel DMA based PCM module");
240MODULE_LICENSE("GPL");
diff --git a/sound/soc/atmel/atmel-pcm-pdc.c b/sound/soc/atmel/atmel-pcm-pdc.c
new file mode 100644
index 000000000000..6a293c713a38
--- /dev/null
+++ b/sound/soc/atmel/atmel-pcm-pdc.c
@@ -0,0 +1,401 @@
1/*
2 * atmel-pcm.c -- ALSA PCM interface for the Atmel atmel SoC.
3 *
4 * Copyright (C) 2005 SAN People
5 * Copyright (C) 2008 Atmel
6 *
7 * Authors: Sedji Gaouaou <sedji.gaouaou@atmel.com>
8 *
9 * Based on at91-pcm. by:
10 * Frank Mandarino <fmandarino@endrelia.com>
11 * Copyright 2006 Endrelia Technologies Inc.
12 *
13 * Based on pxa2xx-pcm.c by:
14 *
15 * Author: Nicolas Pitre
16 * Created: Nov 30, 2004
17 * Copyright: (C) 2004 MontaVista Software, Inc.
18 *
19 * This program is free software; you can redistribute it and/or modify
20 * it under the terms of the GNU General Public License as published by
21 * the Free Software Foundation; either version 2 of the License, or
22 * (at your option) any later version.
23 *
24 * This program is distributed in the hope that it will be useful,
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 * GNU General Public License for more details.
28 *
29 * You should have received a copy of the GNU General Public License
30 * along with this program; if not, write to the Free Software
31 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
32 */
33
34#include <linux/module.h>
35#include <linux/init.h>
36#include <linux/platform_device.h>
37#include <linux/slab.h>
38#include <linux/dma-mapping.h>
39#include <linux/atmel_pdc.h>
40#include <linux/atmel-ssc.h>
41
42#include <sound/core.h>
43#include <sound/pcm.h>
44#include <sound/pcm_params.h>
45#include <sound/soc.h>
46
47#include "atmel-pcm.h"
48
49
50/*--------------------------------------------------------------------------*\
51 * Hardware definition
52\*--------------------------------------------------------------------------*/
53/* TODO: These values were taken from the AT91 platform driver, check
54 * them against real values for AT32
55 */
56static const struct snd_pcm_hardware atmel_pcm_hardware = {
57 .info = SNDRV_PCM_INFO_MMAP |
58 SNDRV_PCM_INFO_MMAP_VALID |
59 SNDRV_PCM_INFO_INTERLEAVED |
60 SNDRV_PCM_INFO_PAUSE,
61 .formats = SNDRV_PCM_FMTBIT_S16_LE,
62 .period_bytes_min = 32,
63 .period_bytes_max = 8192,
64 .periods_min = 2,
65 .periods_max = 1024,
66 .buffer_bytes_max = ATMEL_SSC_DMABUF_SIZE,
67};
68
69
70/*--------------------------------------------------------------------------*\
71 * Data types
72\*--------------------------------------------------------------------------*/
73struct atmel_runtime_data {
74 struct atmel_pcm_dma_params *params;
75 dma_addr_t dma_buffer; /* physical address of dma buffer */
76 dma_addr_t dma_buffer_end; /* first address beyond DMA buffer */
77 size_t period_size;
78
79 dma_addr_t period_ptr; /* physical address of next period */
80
81 /* PDC register save */
82 u32 pdc_xpr_save;
83 u32 pdc_xcr_save;
84 u32 pdc_xnpr_save;
85 u32 pdc_xncr_save;
86};
87
88/*--------------------------------------------------------------------------*\
89 * ISR
90\*--------------------------------------------------------------------------*/
91static void atmel_pcm_dma_irq(u32 ssc_sr,
92 struct snd_pcm_substream *substream)
93{
94 struct atmel_runtime_data *prtd = substream->runtime->private_data;
95 struct atmel_pcm_dma_params *params = prtd->params;
96 static int count;
97
98 count++;
99
100 if (ssc_sr & params->mask->ssc_endbuf) {
101 pr_warn("atmel-pcm: buffer %s on %s (SSC_SR=%#x, count=%d)\n",
102 substream->stream == SNDRV_PCM_STREAM_PLAYBACK
103 ? "underrun" : "overrun",
104 params->name, ssc_sr, count);
105
106 /* re-start the PDC */
107 ssc_writex(params->ssc->regs, ATMEL_PDC_PTCR,
108 params->mask->pdc_disable);
109 prtd->period_ptr += prtd->period_size;
110 if (prtd->period_ptr >= prtd->dma_buffer_end)
111 prtd->period_ptr = prtd->dma_buffer;
112
113 ssc_writex(params->ssc->regs, params->pdc->xpr,
114 prtd->period_ptr);
115 ssc_writex(params->ssc->regs, params->pdc->xcr,
116 prtd->period_size / params->pdc_xfer_size);
117 ssc_writex(params->ssc->regs, ATMEL_PDC_PTCR,
118 params->mask->pdc_enable);
119 }
120
121 if (ssc_sr & params->mask->ssc_endx) {
122 /* Load the PDC next pointer and counter registers */
123 prtd->period_ptr += prtd->period_size;
124 if (prtd->period_ptr >= prtd->dma_buffer_end)
125 prtd->period_ptr = prtd->dma_buffer;
126
127 ssc_writex(params->ssc->regs, params->pdc->xnpr,
128 prtd->period_ptr);
129 ssc_writex(params->ssc->regs, params->pdc->xncr,
130 prtd->period_size / params->pdc_xfer_size);
131 }
132
133 snd_pcm_period_elapsed(substream);
134}
135
136
137/*--------------------------------------------------------------------------*\
138 * PCM operations
139\*--------------------------------------------------------------------------*/
140static int atmel_pcm_hw_params(struct snd_pcm_substream *substream,
141 struct snd_pcm_hw_params *params)
142{
143 struct snd_pcm_runtime *runtime = substream->runtime;
144 struct atmel_runtime_data *prtd = runtime->private_data;
145 struct snd_soc_pcm_runtime *rtd = substream->private_data;
146
147 /* this may get called several times by oss emulation
148 * with different params */
149
150 snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer);
151 runtime->dma_bytes = params_buffer_bytes(params);
152
153 prtd->params = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
154 prtd->params->dma_intr_handler = atmel_pcm_dma_irq;
155
156 prtd->dma_buffer = runtime->dma_addr;
157 prtd->dma_buffer_end = runtime->dma_addr + runtime->dma_bytes;
158 prtd->period_size = params_period_bytes(params);
159
160 pr_debug("atmel-pcm: "
161 "hw_params: DMA for %s initialized "
162 "(dma_bytes=%u, period_size=%u)\n",
163 prtd->params->name,
164 runtime->dma_bytes,
165 prtd->period_size);
166 return 0;
167}
168
169static int atmel_pcm_hw_free(struct snd_pcm_substream *substream)
170{
171 struct atmel_runtime_data *prtd = substream->runtime->private_data;
172 struct atmel_pcm_dma_params *params = prtd->params;
173
174 if (params != NULL) {
175 ssc_writex(params->ssc->regs, SSC_PDC_PTCR,
176 params->mask->pdc_disable);
177 prtd->params->dma_intr_handler = NULL;
178 }
179
180 return 0;
181}
182
183static int atmel_pcm_prepare(struct snd_pcm_substream *substream)
184{
185 struct atmel_runtime_data *prtd = substream->runtime->private_data;
186 struct atmel_pcm_dma_params *params = prtd->params;
187
188 ssc_writex(params->ssc->regs, SSC_IDR,
189 params->mask->ssc_endx | params->mask->ssc_endbuf);
190 ssc_writex(params->ssc->regs, ATMEL_PDC_PTCR,
191 params->mask->pdc_disable);
192 return 0;
193}
194
195static int atmel_pcm_trigger(struct snd_pcm_substream *substream,
196 int cmd)
197{
198 struct snd_pcm_runtime *rtd = substream->runtime;
199 struct atmel_runtime_data *prtd = rtd->private_data;
200 struct atmel_pcm_dma_params *params = prtd->params;
201 int ret = 0;
202
203 pr_debug("atmel-pcm:buffer_size = %ld,"
204 "dma_area = %p, dma_bytes = %u\n",
205 rtd->buffer_size, rtd->dma_area, rtd->dma_bytes);
206
207 switch (cmd) {
208 case SNDRV_PCM_TRIGGER_START:
209 prtd->period_ptr = prtd->dma_buffer;
210
211 ssc_writex(params->ssc->regs, params->pdc->xpr,
212 prtd->period_ptr);
213 ssc_writex(params->ssc->regs, params->pdc->xcr,
214 prtd->period_size / params->pdc_xfer_size);
215
216 prtd->period_ptr += prtd->period_size;
217 ssc_writex(params->ssc->regs, params->pdc->xnpr,
218 prtd->period_ptr);
219 ssc_writex(params->ssc->regs, params->pdc->xncr,
220 prtd->period_size / params->pdc_xfer_size);
221
222 pr_debug("atmel-pcm: trigger: "
223 "period_ptr=%lx, xpr=%u, "
224 "xcr=%u, xnpr=%u, xncr=%u\n",
225 (unsigned long)prtd->period_ptr,
226 ssc_readx(params->ssc->regs, params->pdc->xpr),
227 ssc_readx(params->ssc->regs, params->pdc->xcr),
228 ssc_readx(params->ssc->regs, params->pdc->xnpr),
229 ssc_readx(params->ssc->regs, params->pdc->xncr));
230
231 ssc_writex(params->ssc->regs, SSC_IER,
232 params->mask->ssc_endx | params->mask->ssc_endbuf);
233 ssc_writex(params->ssc->regs, SSC_PDC_PTCR,
234 params->mask->pdc_enable);
235
236 pr_debug("sr=%u imr=%u\n",
237 ssc_readx(params->ssc->regs, SSC_SR),
238 ssc_readx(params->ssc->regs, SSC_IER));
239 break; /* SNDRV_PCM_TRIGGER_START */
240
241 case SNDRV_PCM_TRIGGER_STOP:
242 case SNDRV_PCM_TRIGGER_SUSPEND:
243 case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
244 ssc_writex(params->ssc->regs, ATMEL_PDC_PTCR,
245 params->mask->pdc_disable);
246 break;
247
248 case SNDRV_PCM_TRIGGER_RESUME:
249 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
250 ssc_writex(params->ssc->regs, ATMEL_PDC_PTCR,
251 params->mask->pdc_enable);
252 break;
253
254 default:
255 ret = -EINVAL;
256 }
257
258 return ret;
259}
260
261static snd_pcm_uframes_t atmel_pcm_pointer(
262 struct snd_pcm_substream *substream)
263{
264 struct snd_pcm_runtime *runtime = substream->runtime;
265 struct atmel_runtime_data *prtd = runtime->private_data;
266 struct atmel_pcm_dma_params *params = prtd->params;
267 dma_addr_t ptr;
268 snd_pcm_uframes_t x;
269
270 ptr = (dma_addr_t) ssc_readx(params->ssc->regs, params->pdc->xpr);
271 x = bytes_to_frames(runtime, ptr - prtd->dma_buffer);
272
273 if (x == runtime->buffer_size)
274 x = 0;
275
276 return x;
277}
278
279static int atmel_pcm_open(struct snd_pcm_substream *substream)
280{
281 struct snd_pcm_runtime *runtime = substream->runtime;
282 struct atmel_runtime_data *prtd;
283 int ret = 0;
284
285 snd_soc_set_runtime_hwparams(substream, &atmel_pcm_hardware);
286
287 /* ensure that buffer size is a multiple of period size */
288 ret = snd_pcm_hw_constraint_integer(runtime,
289 SNDRV_PCM_HW_PARAM_PERIODS);
290 if (ret < 0)
291 goto out;
292
293 prtd = kzalloc(sizeof(struct atmel_runtime_data), GFP_KERNEL);
294 if (prtd == NULL) {
295 ret = -ENOMEM;
296 goto out;
297 }
298 runtime->private_data = prtd;
299
300 out:
301 return ret;
302}
303
304static int atmel_pcm_close(struct snd_pcm_substream *substream)
305{
306 struct atmel_runtime_data *prtd = substream->runtime->private_data;
307
308 kfree(prtd);
309 return 0;
310}
311
312static struct snd_pcm_ops atmel_pcm_ops = {
313 .open = atmel_pcm_open,
314 .close = atmel_pcm_close,
315 .ioctl = snd_pcm_lib_ioctl,
316 .hw_params = atmel_pcm_hw_params,
317 .hw_free = atmel_pcm_hw_free,
318 .prepare = atmel_pcm_prepare,
319 .trigger = atmel_pcm_trigger,
320 .pointer = atmel_pcm_pointer,
321 .mmap = atmel_pcm_mmap,
322};
323
324
325/*--------------------------------------------------------------------------*\
326 * ASoC platform driver
327\*--------------------------------------------------------------------------*/
328#ifdef CONFIG_PM
329static int atmel_pcm_suspend(struct snd_soc_dai *dai)
330{
331 struct snd_pcm_runtime *runtime = dai->runtime;
332 struct atmel_runtime_data *prtd;
333 struct atmel_pcm_dma_params *params;
334
335 if (!runtime)
336 return 0;
337
338 prtd = runtime->private_data;
339 params = prtd->params;
340
341 /* disable the PDC and save the PDC registers */
342
343 ssc_writel(params->ssc->regs, PDC_PTCR, params->mask->pdc_disable);
344
345 prtd->pdc_xpr_save = ssc_readx(params->ssc->regs, params->pdc->xpr);
346 prtd->pdc_xcr_save = ssc_readx(params->ssc->regs, params->pdc->xcr);
347 prtd->pdc_xnpr_save = ssc_readx(params->ssc->regs, params->pdc->xnpr);
348 prtd->pdc_xncr_save = ssc_readx(params->ssc->regs, params->pdc->xncr);
349
350 return 0;
351}
352
353static int atmel_pcm_resume(struct snd_soc_dai *dai)
354{
355 struct snd_pcm_runtime *runtime = dai->runtime;
356 struct atmel_runtime_data *prtd;
357 struct atmel_pcm_dma_params *params;
358
359 if (!runtime)
360 return 0;
361
362 prtd = runtime->private_data;
363 params = prtd->params;
364
365 /* restore the PDC registers and enable the PDC */
366 ssc_writex(params->ssc->regs, params->pdc->xpr, prtd->pdc_xpr_save);
367 ssc_writex(params->ssc->regs, params->pdc->xcr, prtd->pdc_xcr_save);
368 ssc_writex(params->ssc->regs, params->pdc->xnpr, prtd->pdc_xnpr_save);
369 ssc_writex(params->ssc->regs, params->pdc->xncr, prtd->pdc_xncr_save);
370
371 ssc_writel(params->ssc->regs, PDC_PTCR, params->mask->pdc_enable);
372 return 0;
373}
374#else
375#define atmel_pcm_suspend NULL
376#define atmel_pcm_resume NULL
377#endif
378
379static struct snd_soc_platform_driver atmel_soc_platform = {
380 .ops = &atmel_pcm_ops,
381 .pcm_new = atmel_pcm_new,
382 .pcm_free = atmel_pcm_free,
383 .suspend = atmel_pcm_suspend,
384 .resume = atmel_pcm_resume,
385};
386
387int atmel_pcm_pdc_platform_register(struct device *dev)
388{
389 return snd_soc_register_platform(dev, &atmel_soc_platform);
390}
391EXPORT_SYMBOL(atmel_pcm_pdc_platform_register);
392
393void atmel_pcm_pdc_platform_unregister(struct device *dev)
394{
395 snd_soc_unregister_platform(dev);
396}
397EXPORT_SYMBOL(atmel_pcm_pdc_platform_unregister);
398
399MODULE_AUTHOR("Sedji Gaouaou <sedji.gaouaou@atmel.com>");
400MODULE_DESCRIPTION("Atmel PCM module");
401MODULE_LICENSE("GPL");
diff --git a/sound/soc/atmel/atmel-pcm.c b/sound/soc/atmel/atmel-pcm.c
index 9b84f985770e..e99f1811300a 100644
--- a/sound/soc/atmel/atmel-pcm.c
+++ b/sound/soc/atmel/atmel-pcm.c
@@ -32,80 +32,25 @@
32 */ 32 */
33 33
34#include <linux/module.h> 34#include <linux/module.h>
35#include <linux/init.h>
36#include <linux/platform_device.h>
37#include <linux/slab.h>
38#include <linux/dma-mapping.h> 35#include <linux/dma-mapping.h>
39#include <linux/atmel_pdc.h>
40#include <linux/atmel-ssc.h>
41
42#include <sound/core.h>
43#include <sound/pcm.h> 36#include <sound/pcm.h>
44#include <sound/pcm_params.h>
45#include <sound/soc.h> 37#include <sound/soc.h>
46
47#include "atmel-pcm.h" 38#include "atmel-pcm.h"
48 39
49
50/*--------------------------------------------------------------------------*\
51 * Hardware definition
52\*--------------------------------------------------------------------------*/
53/* TODO: These values were taken from the AT91 platform driver, check
54 * them against real values for AT32
55 */
56static const struct snd_pcm_hardware atmel_pcm_hardware = {
57 .info = SNDRV_PCM_INFO_MMAP |
58 SNDRV_PCM_INFO_MMAP_VALID |
59 SNDRV_PCM_INFO_INTERLEAVED |
60 SNDRV_PCM_INFO_PAUSE,
61 .formats = SNDRV_PCM_FMTBIT_S16_LE,
62 .period_bytes_min = 32,
63 .period_bytes_max = 8192,
64 .periods_min = 2,
65 .periods_max = 1024,
66 .buffer_bytes_max = 32 * 1024,
67};
68
69
70/*--------------------------------------------------------------------------*\
71 * Data types
72\*--------------------------------------------------------------------------*/
73struct atmel_runtime_data {
74 struct atmel_pcm_dma_params *params;
75 dma_addr_t dma_buffer; /* physical address of dma buffer */
76 dma_addr_t dma_buffer_end; /* first address beyond DMA buffer */
77 size_t period_size;
78
79 dma_addr_t period_ptr; /* physical address of next period */
80
81 /* PDC register save */
82 u32 pdc_xpr_save;
83 u32 pdc_xcr_save;
84 u32 pdc_xnpr_save;
85 u32 pdc_xncr_save;
86};
87
88
89/*--------------------------------------------------------------------------*\
90 * Helper functions
91\*--------------------------------------------------------------------------*/
92static int atmel_pcm_preallocate_dma_buffer(struct snd_pcm *pcm, 40static int atmel_pcm_preallocate_dma_buffer(struct snd_pcm *pcm,
93 int stream) 41 int stream)
94{ 42{
95 struct snd_pcm_substream *substream = pcm->streams[stream].substream; 43 struct snd_pcm_substream *substream = pcm->streams[stream].substream;
96 struct snd_dma_buffer *buf = &substream->dma_buffer; 44 struct snd_dma_buffer *buf = &substream->dma_buffer;
97 size_t size = atmel_pcm_hardware.buffer_bytes_max; 45 size_t size = ATMEL_SSC_DMABUF_SIZE;
98 46
99 buf->dev.type = SNDRV_DMA_TYPE_DEV; 47 buf->dev.type = SNDRV_DMA_TYPE_DEV;
100 buf->dev.dev = pcm->card->dev; 48 buf->dev.dev = pcm->card->dev;
101 buf->private_data = NULL; 49 buf->private_data = NULL;
102 buf->area = dma_alloc_coherent(pcm->card->dev, size, 50 buf->area = dma_alloc_coherent(pcm->card->dev, size,
103 &buf->addr, GFP_KERNEL); 51 &buf->addr, GFP_KERNEL);
104 pr_debug("atmel-pcm:" 52 pr_debug("atmel-pcm: alloc dma buffer: area=%p, addr=%p, size=%d\n",
105 "preallocate_dma_buffer: area=%p, addr=%p, size=%d\n", 53 (void *)buf->area, (void *)buf->addr, size);
106 (void *) buf->area,
107 (void *) buf->addr,
108 size);
109 54
110 if (!buf->area) 55 if (!buf->area)
111 return -ENOMEM; 56 return -ENOMEM;
@@ -113,258 +58,19 @@ static int atmel_pcm_preallocate_dma_buffer(struct snd_pcm *pcm,
113 buf->bytes = size; 58 buf->bytes = size;
114 return 0; 59 return 0;
115} 60}
116/*--------------------------------------------------------------------------*\
117 * ISR
118\*--------------------------------------------------------------------------*/
119static void atmel_pcm_dma_irq(u32 ssc_sr,
120 struct snd_pcm_substream *substream)
121{
122 struct atmel_runtime_data *prtd = substream->runtime->private_data;
123 struct atmel_pcm_dma_params *params = prtd->params;
124 static int count;
125
126 count++;
127
128 if (ssc_sr & params->mask->ssc_endbuf) {
129 pr_warning("atmel-pcm: buffer %s on %s"
130 " (SSC_SR=%#x, count=%d)\n",
131 substream->stream == SNDRV_PCM_STREAM_PLAYBACK
132 ? "underrun" : "overrun",
133 params->name, ssc_sr, count);
134
135 /* re-start the PDC */
136 ssc_writex(params->ssc->regs, ATMEL_PDC_PTCR,
137 params->mask->pdc_disable);
138 prtd->period_ptr += prtd->period_size;
139 if (prtd->period_ptr >= prtd->dma_buffer_end)
140 prtd->period_ptr = prtd->dma_buffer;
141
142 ssc_writex(params->ssc->regs, params->pdc->xpr,
143 prtd->period_ptr);
144 ssc_writex(params->ssc->regs, params->pdc->xcr,
145 prtd->period_size / params->pdc_xfer_size);
146 ssc_writex(params->ssc->regs, ATMEL_PDC_PTCR,
147 params->mask->pdc_enable);
148 }
149
150 if (ssc_sr & params->mask->ssc_endx) {
151 /* Load the PDC next pointer and counter registers */
152 prtd->period_ptr += prtd->period_size;
153 if (prtd->period_ptr >= prtd->dma_buffer_end)
154 prtd->period_ptr = prtd->dma_buffer;
155
156 ssc_writex(params->ssc->regs, params->pdc->xnpr,
157 prtd->period_ptr);
158 ssc_writex(params->ssc->regs, params->pdc->xncr,
159 prtd->period_size / params->pdc_xfer_size);
160 }
161
162 snd_pcm_period_elapsed(substream);
163}
164
165
166/*--------------------------------------------------------------------------*\
167 * PCM operations
168\*--------------------------------------------------------------------------*/
169static int atmel_pcm_hw_params(struct snd_pcm_substream *substream,
170 struct snd_pcm_hw_params *params)
171{
172 struct snd_pcm_runtime *runtime = substream->runtime;
173 struct atmel_runtime_data *prtd = runtime->private_data;
174 struct snd_soc_pcm_runtime *rtd = substream->private_data;
175
176 /* this may get called several times by oss emulation
177 * with different params */
178
179 snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer);
180 runtime->dma_bytes = params_buffer_bytes(params);
181
182 prtd->params = snd_soc_dai_get_dma_data(rtd->cpu_dai, substream);
183 prtd->params->dma_intr_handler = atmel_pcm_dma_irq;
184
185 prtd->dma_buffer = runtime->dma_addr;
186 prtd->dma_buffer_end = runtime->dma_addr + runtime->dma_bytes;
187 prtd->period_size = params_period_bytes(params);
188
189 pr_debug("atmel-pcm: "
190 "hw_params: DMA for %s initialized "
191 "(dma_bytes=%u, period_size=%u)\n",
192 prtd->params->name,
193 runtime->dma_bytes,
194 prtd->period_size);
195 return 0;
196}
197
198static int atmel_pcm_hw_free(struct snd_pcm_substream *substream)
199{
200 struct atmel_runtime_data *prtd = substream->runtime->private_data;
201 struct atmel_pcm_dma_params *params = prtd->params;
202
203 if (params != NULL) {
204 ssc_writex(params->ssc->regs, SSC_PDC_PTCR,
205 params->mask->pdc_disable);
206 prtd->params->dma_intr_handler = NULL;
207 }
208
209 return 0;
210}
211
212static int atmel_pcm_prepare(struct snd_pcm_substream *substream)
213{
214 struct atmel_runtime_data *prtd = substream->runtime->private_data;
215 struct atmel_pcm_dma_params *params = prtd->params;
216
217 ssc_writex(params->ssc->regs, SSC_IDR,
218 params->mask->ssc_endx | params->mask->ssc_endbuf);
219 ssc_writex(params->ssc->regs, ATMEL_PDC_PTCR,
220 params->mask->pdc_disable);
221 return 0;
222}
223
224static int atmel_pcm_trigger(struct snd_pcm_substream *substream,
225 int cmd)
226{
227 struct snd_pcm_runtime *rtd = substream->runtime;
228 struct atmel_runtime_data *prtd = rtd->private_data;
229 struct atmel_pcm_dma_params *params = prtd->params;
230 int ret = 0;
231
232 pr_debug("atmel-pcm:buffer_size = %ld,"
233 "dma_area = %p, dma_bytes = %u\n",
234 rtd->buffer_size, rtd->dma_area, rtd->dma_bytes);
235
236 switch (cmd) {
237 case SNDRV_PCM_TRIGGER_START:
238 prtd->period_ptr = prtd->dma_buffer;
239
240 ssc_writex(params->ssc->regs, params->pdc->xpr,
241 prtd->period_ptr);
242 ssc_writex(params->ssc->regs, params->pdc->xcr,
243 prtd->period_size / params->pdc_xfer_size);
244
245 prtd->period_ptr += prtd->period_size;
246 ssc_writex(params->ssc->regs, params->pdc->xnpr,
247 prtd->period_ptr);
248 ssc_writex(params->ssc->regs, params->pdc->xncr,
249 prtd->period_size / params->pdc_xfer_size);
250
251 pr_debug("atmel-pcm: trigger: "
252 "period_ptr=%lx, xpr=%u, "
253 "xcr=%u, xnpr=%u, xncr=%u\n",
254 (unsigned long)prtd->period_ptr,
255 ssc_readx(params->ssc->regs, params->pdc->xpr),
256 ssc_readx(params->ssc->regs, params->pdc->xcr),
257 ssc_readx(params->ssc->regs, params->pdc->xnpr),
258 ssc_readx(params->ssc->regs, params->pdc->xncr));
259
260 ssc_writex(params->ssc->regs, SSC_IER,
261 params->mask->ssc_endx | params->mask->ssc_endbuf);
262 ssc_writex(params->ssc->regs, SSC_PDC_PTCR,
263 params->mask->pdc_enable);
264
265 pr_debug("sr=%u imr=%u\n",
266 ssc_readx(params->ssc->regs, SSC_SR),
267 ssc_readx(params->ssc->regs, SSC_IER));
268 break; /* SNDRV_PCM_TRIGGER_START */
269
270 case SNDRV_PCM_TRIGGER_STOP:
271 case SNDRV_PCM_TRIGGER_SUSPEND:
272 case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
273 ssc_writex(params->ssc->regs, ATMEL_PDC_PTCR,
274 params->mask->pdc_disable);
275 break;
276
277 case SNDRV_PCM_TRIGGER_RESUME:
278 case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
279 ssc_writex(params->ssc->regs, ATMEL_PDC_PTCR,
280 params->mask->pdc_enable);
281 break;
282
283 default:
284 ret = -EINVAL;
285 }
286 61
287 return ret; 62int atmel_pcm_mmap(struct snd_pcm_substream *substream,
288}
289
290static snd_pcm_uframes_t atmel_pcm_pointer(
291 struct snd_pcm_substream *substream)
292{
293 struct snd_pcm_runtime *runtime = substream->runtime;
294 struct atmel_runtime_data *prtd = runtime->private_data;
295 struct atmel_pcm_dma_params *params = prtd->params;
296 dma_addr_t ptr;
297 snd_pcm_uframes_t x;
298
299 ptr = (dma_addr_t) ssc_readx(params->ssc->regs, params->pdc->xpr);
300 x = bytes_to_frames(runtime, ptr - prtd->dma_buffer);
301
302 if (x == runtime->buffer_size)
303 x = 0;
304
305 return x;
306}
307
308static int atmel_pcm_open(struct snd_pcm_substream *substream)
309{
310 struct snd_pcm_runtime *runtime = substream->runtime;
311 struct atmel_runtime_data *prtd;
312 int ret = 0;
313
314 snd_soc_set_runtime_hwparams(substream, &atmel_pcm_hardware);
315
316 /* ensure that buffer size is a multiple of period size */
317 ret = snd_pcm_hw_constraint_integer(runtime,
318 SNDRV_PCM_HW_PARAM_PERIODS);
319 if (ret < 0)
320 goto out;
321
322 prtd = kzalloc(sizeof(struct atmel_runtime_data), GFP_KERNEL);
323 if (prtd == NULL) {
324 ret = -ENOMEM;
325 goto out;
326 }
327 runtime->private_data = prtd;
328
329 out:
330 return ret;
331}
332
333static int atmel_pcm_close(struct snd_pcm_substream *substream)
334{
335 struct atmel_runtime_data *prtd = substream->runtime->private_data;
336
337 kfree(prtd);
338 return 0;
339}
340
341static int atmel_pcm_mmap(struct snd_pcm_substream *substream,
342 struct vm_area_struct *vma) 63 struct vm_area_struct *vma)
343{ 64{
344 return remap_pfn_range(vma, vma->vm_start, 65 return remap_pfn_range(vma, vma->vm_start,
345 substream->dma_buffer.addr >> PAGE_SHIFT, 66 substream->dma_buffer.addr >> PAGE_SHIFT,
346 vma->vm_end - vma->vm_start, vma->vm_page_prot); 67 vma->vm_end - vma->vm_start, vma->vm_page_prot);
347} 68}
69EXPORT_SYMBOL_GPL(atmel_pcm_mmap);
348 70
349static struct snd_pcm_ops atmel_pcm_ops = {
350 .open = atmel_pcm_open,
351 .close = atmel_pcm_close,
352 .ioctl = snd_pcm_lib_ioctl,
353 .hw_params = atmel_pcm_hw_params,
354 .hw_free = atmel_pcm_hw_free,
355 .prepare = atmel_pcm_prepare,
356 .trigger = atmel_pcm_trigger,
357 .pointer = atmel_pcm_pointer,
358 .mmap = atmel_pcm_mmap,
359};
360
361
362/*--------------------------------------------------------------------------*\
363 * ASoC platform driver
364\*--------------------------------------------------------------------------*/
365static u64 atmel_pcm_dmamask = DMA_BIT_MASK(32); 71static u64 atmel_pcm_dmamask = DMA_BIT_MASK(32);
366 72
367static int atmel_pcm_new(struct snd_soc_pcm_runtime *rtd) 73int atmel_pcm_new(struct snd_soc_pcm_runtime *rtd)
368{ 74{
369 struct snd_card *card = rtd->card->snd_card; 75 struct snd_card *card = rtd->card->snd_card;
370 struct snd_pcm *pcm = rtd->pcm; 76 struct snd_pcm *pcm = rtd->pcm;
@@ -376,6 +82,7 @@ static int atmel_pcm_new(struct snd_soc_pcm_runtime *rtd)
376 card->dev->coherent_dma_mask = DMA_BIT_MASK(32); 82 card->dev->coherent_dma_mask = DMA_BIT_MASK(32);
377 83
378 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) { 84 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
85 pr_debug("atmel-pcm: allocating PCM playback DMA buffer\n");
379 ret = atmel_pcm_preallocate_dma_buffer(pcm, 86 ret = atmel_pcm_preallocate_dma_buffer(pcm,
380 SNDRV_PCM_STREAM_PLAYBACK); 87 SNDRV_PCM_STREAM_PLAYBACK);
381 if (ret) 88 if (ret)
@@ -383,8 +90,7 @@ static int atmel_pcm_new(struct snd_soc_pcm_runtime *rtd)
383 } 90 }
384 91
385 if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) { 92 if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) {
386 pr_debug("atmel-pcm:" 93 pr_debug("atmel-pcm: allocating PCM capture DMA buffer\n");
387 "Allocating PCM capture DMA buffer\n");
388 ret = atmel_pcm_preallocate_dma_buffer(pcm, 94 ret = atmel_pcm_preallocate_dma_buffer(pcm,
389 SNDRV_PCM_STREAM_CAPTURE); 95 SNDRV_PCM_STREAM_CAPTURE);
390 if (ret) 96 if (ret)
@@ -393,8 +99,9 @@ static int atmel_pcm_new(struct snd_soc_pcm_runtime *rtd)
393 out: 99 out:
394 return ret; 100 return ret;
395} 101}
102EXPORT_SYMBOL_GPL(atmel_pcm_new);
396 103
397static void atmel_pcm_free_dma_buffers(struct snd_pcm *pcm) 104void atmel_pcm_free(struct snd_pcm *pcm)
398{ 105{
399 struct snd_pcm_substream *substream; 106 struct snd_pcm_substream *substream;
400 struct snd_dma_buffer *buf; 107 struct snd_dma_buffer *buf;
@@ -413,89 +120,5 @@ static void atmel_pcm_free_dma_buffers(struct snd_pcm *pcm)
413 buf->area = NULL; 120 buf->area = NULL;
414 } 121 }
415} 122}
123EXPORT_SYMBOL_GPL(atmel_pcm_free);
416 124
417#ifdef CONFIG_PM
418static int atmel_pcm_suspend(struct snd_soc_dai *dai)
419{
420 struct snd_pcm_runtime *runtime = dai->runtime;
421 struct atmel_runtime_data *prtd;
422 struct atmel_pcm_dma_params *params;
423
424 if (!runtime)
425 return 0;
426
427 prtd = runtime->private_data;
428 params = prtd->params;
429
430 /* disable the PDC and save the PDC registers */
431
432 ssc_writel(params->ssc->regs, PDC_PTCR, params->mask->pdc_disable);
433
434 prtd->pdc_xpr_save = ssc_readx(params->ssc->regs, params->pdc->xpr);
435 prtd->pdc_xcr_save = ssc_readx(params->ssc->regs, params->pdc->xcr);
436 prtd->pdc_xnpr_save = ssc_readx(params->ssc->regs, params->pdc->xnpr);
437 prtd->pdc_xncr_save = ssc_readx(params->ssc->regs, params->pdc->xncr);
438
439 return 0;
440}
441
442static int atmel_pcm_resume(struct snd_soc_dai *dai)
443{
444 struct snd_pcm_runtime *runtime = dai->runtime;
445 struct atmel_runtime_data *prtd;
446 struct atmel_pcm_dma_params *params;
447
448 if (!runtime)
449 return 0;
450
451 prtd = runtime->private_data;
452 params = prtd->params;
453
454 /* restore the PDC registers and enable the PDC */
455 ssc_writex(params->ssc->regs, params->pdc->xpr, prtd->pdc_xpr_save);
456 ssc_writex(params->ssc->regs, params->pdc->xcr, prtd->pdc_xcr_save);
457 ssc_writex(params->ssc->regs, params->pdc->xnpr, prtd->pdc_xnpr_save);
458 ssc_writex(params->ssc->regs, params->pdc->xncr, prtd->pdc_xncr_save);
459
460 ssc_writel(params->ssc->regs, PDC_PTCR, params->mask->pdc_enable);
461 return 0;
462}
463#else
464#define atmel_pcm_suspend NULL
465#define atmel_pcm_resume NULL
466#endif
467
468static struct snd_soc_platform_driver atmel_soc_platform = {
469 .ops = &atmel_pcm_ops,
470 .pcm_new = atmel_pcm_new,
471 .pcm_free = atmel_pcm_free_dma_buffers,
472 .suspend = atmel_pcm_suspend,
473 .resume = atmel_pcm_resume,
474};
475
476static int __devinit atmel_soc_platform_probe(struct platform_device *pdev)
477{
478 return snd_soc_register_platform(&pdev->dev, &atmel_soc_platform);
479}
480
481static int __devexit atmel_soc_platform_remove(struct platform_device *pdev)
482{
483 snd_soc_unregister_platform(&pdev->dev);
484 return 0;
485}
486
487static struct platform_driver atmel_pcm_driver = {
488 .driver = {
489 .name = "atmel-pcm-audio",
490 .owner = THIS_MODULE,
491 },
492
493 .probe = atmel_soc_platform_probe,
494 .remove = __devexit_p(atmel_soc_platform_remove),
495};
496
497module_platform_driver(atmel_pcm_driver);
498
499MODULE_AUTHOR("Sedji Gaouaou <sedji.gaouaou@atmel.com>");
500MODULE_DESCRIPTION("Atmel PCM module");
501MODULE_LICENSE("GPL");
diff --git a/sound/soc/atmel/atmel-pcm.h b/sound/soc/atmel/atmel-pcm.h
index 5e0a95e64329..bb45d20e7250 100644
--- a/sound/soc/atmel/atmel-pcm.h
+++ b/sound/soc/atmel/atmel-pcm.h
@@ -36,6 +36,8 @@
36 36
37#include <linux/atmel-ssc.h> 37#include <linux/atmel-ssc.h>
38 38
39#define ATMEL_SSC_DMABUF_SIZE (64 * 1024)
40
39/* 41/*
40 * Registers and status bits that are required by the PCM driver. 42 * Registers and status bits that are required by the PCM driver.
41 */ 43 */
@@ -50,6 +52,7 @@ struct atmel_pdc_regs {
50struct atmel_ssc_mask { 52struct atmel_ssc_mask {
51 u32 ssc_enable; /* SSC recv/trans enable */ 53 u32 ssc_enable; /* SSC recv/trans enable */
52 u32 ssc_disable; /* SSC recv/trans disable */ 54 u32 ssc_disable; /* SSC recv/trans disable */
55 u32 ssc_error; /* SSC error conditions */
53 u32 ssc_endx; /* SSC ENDTX or ENDRX */ 56 u32 ssc_endx; /* SSC ENDTX or ENDRX */
54 u32 ssc_endbuf; /* SSC TXBUFE or RXBUFF */ 57 u32 ssc_endbuf; /* SSC TXBUFE or RXBUFF */
55 u32 pdc_enable; /* PDC recv/trans enable */ 58 u32 pdc_enable; /* PDC recv/trans enable */
@@ -80,4 +83,35 @@ struct atmel_pcm_dma_params {
80#define ssc_readx(base, reg) (__raw_readl((base) + (reg))) 83#define ssc_readx(base, reg) (__raw_readl((base) + (reg)))
81#define ssc_writex(base, reg, value) __raw_writel((value), (base) + (reg)) 84#define ssc_writex(base, reg, value) __raw_writel((value), (base) + (reg))
82 85
86int atmel_pcm_new(struct snd_soc_pcm_runtime *rtd);
87void atmel_pcm_free(struct snd_pcm *pcm);
88int atmel_pcm_mmap(struct snd_pcm_substream *substream,
89 struct vm_area_struct *vma);
90
91#ifdef CONFIG_SND_ATMEL_SOC_PDC
92int atmel_pcm_pdc_platform_register(struct device *dev);
93void atmel_pcm_pdc_platform_unregister(struct device *dev);
94#else
95static inline int atmel_pcm_pdc_platform_register(struct device *dev)
96{
97 return 0;
98}
99static inline void atmel_pcm_pdc_platform_unregister(struct device *dev)
100{
101}
102#endif
103
104#ifdef CONFIG_SND_ATMEL_SOC_DMA
105int atmel_pcm_dma_platform_register(struct device *dev);
106void atmel_pcm_dma_platform_unregister(struct device *dev);
107#else
108static inline int atmel_pcm_dma_platform_register(struct device *dev)
109{
110 return 0;
111}
112static inline void atmel_pcm_dma_platform_unregister(struct device *dev)
113{
114}
115#endif
116
83#endif /* _ATMEL_PCM_H */ 117#endif /* _ATMEL_PCM_H */
diff --git a/sound/soc/atmel/atmel_ssc_dai.c b/sound/soc/atmel/atmel_ssc_dai.c
index 354341ec0f42..1c7663422054 100644
--- a/sound/soc/atmel/atmel_ssc_dai.c
+++ b/sound/soc/atmel/atmel_ssc_dai.c
@@ -48,11 +48,7 @@
48#include "atmel_ssc_dai.h" 48#include "atmel_ssc_dai.h"
49 49
50 50
51#if defined(CONFIG_ARCH_AT91SAM9260) || defined(CONFIG_ARCH_AT91SAM9G20)
52#define NUM_SSC_DEVICES 1
53#else
54#define NUM_SSC_DEVICES 3 51#define NUM_SSC_DEVICES 3
55#endif
56 52
57/* 53/*
58 * SSC PDC registers required by the PCM DMA engine. 54 * SSC PDC registers required by the PCM DMA engine.
@@ -107,7 +103,6 @@ static struct atmel_pcm_dma_params ssc_dma_params[NUM_SSC_DEVICES][2] = {
107 .pdc = &pdc_rx_reg, 103 .pdc = &pdc_rx_reg,
108 .mask = &ssc_rx_mask, 104 .mask = &ssc_rx_mask,
109 } }, 105 } },
110#if NUM_SSC_DEVICES == 3
111 {{ 106 {{
112 .name = "SSC1 PCM out", 107 .name = "SSC1 PCM out",
113 .pdc = &pdc_tx_reg, 108 .pdc = &pdc_tx_reg,
@@ -128,7 +123,6 @@ static struct atmel_pcm_dma_params ssc_dma_params[NUM_SSC_DEVICES][2] = {
128 .pdc = &pdc_rx_reg, 123 .pdc = &pdc_rx_reg,
129 .mask = &ssc_rx_mask, 124 .mask = &ssc_rx_mask,
130 } }, 125 } },
131#endif
132}; 126};
133 127
134 128
@@ -139,7 +133,6 @@ static struct atmel_ssc_info ssc_info[NUM_SSC_DEVICES] = {
139 .dir_mask = SSC_DIR_MASK_UNUSED, 133 .dir_mask = SSC_DIR_MASK_UNUSED,
140 .initialized = 0, 134 .initialized = 0,
141 }, 135 },
142#if NUM_SSC_DEVICES == 3
143 { 136 {
144 .name = "ssc1", 137 .name = "ssc1",
145 .lock = __SPIN_LOCK_UNLOCKED(ssc_info[1].lock), 138 .lock = __SPIN_LOCK_UNLOCKED(ssc_info[1].lock),
@@ -152,7 +145,6 @@ static struct atmel_ssc_info ssc_info[NUM_SSC_DEVICES] = {
152 .dir_mask = SSC_DIR_MASK_UNUSED, 145 .dir_mask = SSC_DIR_MASK_UNUSED,
153 .initialized = 0, 146 .initialized = 0,
154 }, 147 },
155#endif
156}; 148};
157 149
158 150
@@ -690,27 +682,9 @@ static int atmel_ssc_resume(struct snd_soc_dai *cpu_dai)
690static int atmel_ssc_probe(struct snd_soc_dai *dai) 682static int atmel_ssc_probe(struct snd_soc_dai *dai)
691{ 683{
692 struct atmel_ssc_info *ssc_p = &ssc_info[dai->id]; 684 struct atmel_ssc_info *ssc_p = &ssc_info[dai->id];
693 int ret = 0;
694 685
695 snd_soc_dai_set_drvdata(dai, ssc_p); 686 snd_soc_dai_set_drvdata(dai, ssc_p);
696 687
697 /*
698 * Request SSC device
699 */
700 ssc_p->ssc = ssc_request(dai->id);
701 if (IS_ERR(ssc_p->ssc)) {
702 printk(KERN_ERR "ASoC: Failed to request SSC %d\n", dai->id);
703 ret = PTR_ERR(ssc_p->ssc);
704 }
705
706 return ret;
707}
708
709static int atmel_ssc_remove(struct snd_soc_dai *dai)
710{
711 struct atmel_ssc_info *ssc_p = snd_soc_dai_get_drvdata(dai);
712
713 ssc_free(ssc_p->ssc);
714 return 0; 688 return 0;
715} 689}
716 690
@@ -728,30 +702,8 @@ static const struct snd_soc_dai_ops atmel_ssc_dai_ops = {
728 .set_clkdiv = atmel_ssc_set_dai_clkdiv, 702 .set_clkdiv = atmel_ssc_set_dai_clkdiv,
729}; 703};
730 704
731static struct snd_soc_dai_driver atmel_ssc_dai[NUM_SSC_DEVICES] = { 705static struct snd_soc_dai_driver atmel_ssc_dai = {
732 {
733 .name = "atmel-ssc-dai.0",
734 .probe = atmel_ssc_probe,
735 .remove = atmel_ssc_remove,
736 .suspend = atmel_ssc_suspend,
737 .resume = atmel_ssc_resume,
738 .playback = {
739 .channels_min = 1,
740 .channels_max = 2,
741 .rates = ATMEL_SSC_RATES,
742 .formats = ATMEL_SSC_FORMATS,},
743 .capture = {
744 .channels_min = 1,
745 .channels_max = 2,
746 .rates = ATMEL_SSC_RATES,
747 .formats = ATMEL_SSC_FORMATS,},
748 .ops = &atmel_ssc_dai_ops,
749 },
750#if NUM_SSC_DEVICES == 3
751 {
752 .name = "atmel-ssc-dai.1",
753 .probe = atmel_ssc_probe, 706 .probe = atmel_ssc_probe,
754 .remove = atmel_ssc_remove,
755 .suspend = atmel_ssc_suspend, 707 .suspend = atmel_ssc_suspend,
756 .resume = atmel_ssc_resume, 708 .resume = atmel_ssc_resume,
757 .playback = { 709 .playback = {
@@ -765,50 +717,50 @@ static struct snd_soc_dai_driver atmel_ssc_dai[NUM_SSC_DEVICES] = {
765 .rates = ATMEL_SSC_RATES, 717 .rates = ATMEL_SSC_RATES,
766 .formats = ATMEL_SSC_FORMATS,}, 718 .formats = ATMEL_SSC_FORMATS,},
767 .ops = &atmel_ssc_dai_ops, 719 .ops = &atmel_ssc_dai_ops,
768 },
769 {
770 .name = "atmel-ssc-dai.2",
771 .probe = atmel_ssc_probe,
772 .remove = atmel_ssc_remove,
773 .suspend = atmel_ssc_suspend,
774 .resume = atmel_ssc_resume,
775 .playback = {
776 .channels_min = 1,
777 .channels_max = 2,
778 .rates = ATMEL_SSC_RATES,
779 .formats = ATMEL_SSC_FORMATS,},
780 .capture = {
781 .channels_min = 1,
782 .channels_max = 2,
783 .rates = ATMEL_SSC_RATES,
784 .formats = ATMEL_SSC_FORMATS,},
785 .ops = &atmel_ssc_dai_ops,
786 },
787#endif
788}; 720};
789 721
790static __devinit int asoc_ssc_probe(struct platform_device *pdev) 722static int asoc_ssc_init(struct device *dev)
791{ 723{
792 BUG_ON(pdev->id < 0); 724 struct platform_device *pdev = to_platform_device(dev);
793 BUG_ON(pdev->id >= ARRAY_SIZE(atmel_ssc_dai)); 725 struct ssc_device *ssc = platform_get_drvdata(pdev);
794 return snd_soc_register_dai(&pdev->dev, &atmel_ssc_dai[pdev->id]); 726 int ret;
795} 727
728 ret = snd_soc_register_dai(dev, &atmel_ssc_dai);
729 if (ret) {
730 dev_err(dev, "Could not register DAI: %d\n", ret);
731 goto err;
732 }
733
734 if (ssc->pdata->use_dma)
735 ret = atmel_pcm_dma_platform_register(dev);
736 else
737 ret = atmel_pcm_pdc_platform_register(dev);
738
739 if (ret) {
740 dev_err(dev, "Could not register PCM: %d\n", ret);
741 goto err_unregister_dai;
742 };
796 743
797static int __devexit asoc_ssc_remove(struct platform_device *pdev)
798{
799 snd_soc_unregister_dai(&pdev->dev);
800 return 0; 744 return 0;
745
746err_unregister_dai:
747 snd_soc_unregister_dai(dev);
748err:
749 return ret;
801} 750}
802 751
803static struct platform_driver asoc_ssc_driver = { 752static void asoc_ssc_exit(struct device *dev)
804 .driver = { 753{
805 .name = "atmel-ssc-dai", 754 struct platform_device *pdev = to_platform_device(dev);
806 .owner = THIS_MODULE, 755 struct ssc_device *ssc = platform_get_drvdata(pdev);
807 },
808 756
809 .probe = asoc_ssc_probe, 757 if (ssc->pdata->use_dma)
810 .remove = __devexit_p(asoc_ssc_remove), 758 atmel_pcm_dma_platform_unregister(dev);
811}; 759 else
760 atmel_pcm_pdc_platform_unregister(dev);
761
762 snd_soc_unregister_dai(dev);
763}
812 764
813/** 765/**
814 * atmel_ssc_set_audio - Allocate the specified SSC for audio use. 766 * atmel_ssc_set_audio - Allocate the specified SSC for audio use.
@@ -816,50 +768,32 @@ static struct platform_driver asoc_ssc_driver = {
816int atmel_ssc_set_audio(int ssc_id) 768int atmel_ssc_set_audio(int ssc_id)
817{ 769{
818 struct ssc_device *ssc; 770 struct ssc_device *ssc;
819 static struct platform_device *dma_pdev;
820 struct platform_device *ssc_pdev;
821 int ret; 771 int ret;
822 772
823 if (ssc_id < 0 || ssc_id >= ARRAY_SIZE(atmel_ssc_dai))
824 return -EINVAL;
825
826 /* Allocate a dummy device for DMA if we don't have one already */
827 if (!dma_pdev) {
828 dma_pdev = platform_device_alloc("atmel-pcm-audio", -1);
829 if (!dma_pdev)
830 return -ENOMEM;
831
832 ret = platform_device_add(dma_pdev);
833 if (ret < 0) {
834 platform_device_put(dma_pdev);
835 dma_pdev = NULL;
836 return ret;
837 }
838 }
839
840 ssc_pdev = platform_device_alloc("atmel-ssc-dai", ssc_id);
841 if (!ssc_pdev)
842 return -ENOMEM;
843
844 /* If we can grab the SSC briefly to parent the DAI device off it */ 773 /* If we can grab the SSC briefly to parent the DAI device off it */
845 ssc = ssc_request(ssc_id); 774 ssc = ssc_request(ssc_id);
846 if (IS_ERR(ssc)) 775 if (IS_ERR(ssc)) {
847 pr_warn("Unable to parent ASoC SSC DAI on SSC: %ld\n", 776 pr_err("Unable to parent ASoC SSC DAI on SSC: %ld\n",
848 PTR_ERR(ssc)); 777 PTR_ERR(ssc));
849 else { 778 return PTR_ERR(ssc);
850 ssc_pdev->dev.parent = &(ssc->pdev->dev); 779 } else {
851 ssc_free(ssc); 780 ssc_info[ssc_id].ssc = ssc;
852 } 781 }
853 782
854 ret = platform_device_add(ssc_pdev); 783 ret = asoc_ssc_init(&ssc->pdev->dev);
855 if (ret < 0)
856 platform_device_put(ssc_pdev);
857 784
858 return ret; 785 return ret;
859} 786}
860EXPORT_SYMBOL_GPL(atmel_ssc_set_audio); 787EXPORT_SYMBOL_GPL(atmel_ssc_set_audio);
861 788
862module_platform_driver(asoc_ssc_driver); 789void atmel_ssc_put_audio(int ssc_id)
790{
791 struct ssc_device *ssc = ssc_info[ssc_id].ssc;
792
793 ssc_free(ssc);
794 asoc_ssc_exit(&ssc->pdev->dev);
795}
796EXPORT_SYMBOL_GPL(atmel_ssc_put_audio);
863 797
864/* Module information */ 798/* Module information */
865MODULE_AUTHOR("Sedji Gaouaou, sedji.gaouaou@atmel.com, www.atmel.com"); 799MODULE_AUTHOR("Sedji Gaouaou, sedji.gaouaou@atmel.com, www.atmel.com");
diff --git a/sound/soc/atmel/atmel_ssc_dai.h b/sound/soc/atmel/atmel_ssc_dai.h
index 5d4f0f9b4d9a..b1f08d511495 100644
--- a/sound/soc/atmel/atmel_ssc_dai.h
+++ b/sound/soc/atmel/atmel_ssc_dai.h
@@ -117,6 +117,7 @@ struct atmel_ssc_info {
117 struct atmel_ssc_state ssc_state; 117 struct atmel_ssc_state ssc_state;
118}; 118};
119 119
120int atmel_ssc_set_audio(int ssc); 120int atmel_ssc_set_audio(int ssc_id);
121void atmel_ssc_put_audio(int ssc_id);
121 122
122#endif /* _AT91_SSC_DAI_H */ 123#endif /* _AT91_SSC_DAI_H */
diff --git a/sound/soc/atmel/sam9g20_wm8731.c b/sound/soc/atmel/sam9g20_wm8731.c
index c88351488f45..da976291da9e 100644
--- a/sound/soc/atmel/sam9g20_wm8731.c
+++ b/sound/soc/atmel/sam9g20_wm8731.c
@@ -38,6 +38,8 @@
38#include <linux/platform_device.h> 38#include <linux/platform_device.h>
39#include <linux/i2c.h> 39#include <linux/i2c.h>
40 40
41#include <linux/pinctrl/consumer.h>
42
41#include <linux/atmel-ssc.h> 43#include <linux/atmel-ssc.h>
42 44
43#include <sound/core.h> 45#include <sound/core.h>
@@ -179,10 +181,10 @@ static int at91sam9g20ek_wm8731_init(struct snd_soc_pcm_runtime *rtd)
179static struct snd_soc_dai_link at91sam9g20ek_dai = { 181static struct snd_soc_dai_link at91sam9g20ek_dai = {
180 .name = "WM8731", 182 .name = "WM8731",
181 .stream_name = "WM8731 PCM", 183 .stream_name = "WM8731 PCM",
182 .cpu_dai_name = "atmel-ssc-dai.0", 184 .cpu_dai_name = "at91rm9200_ssc.0",
183 .codec_dai_name = "wm8731-hifi", 185 .codec_dai_name = "wm8731-hifi",
184 .init = at91sam9g20ek_wm8731_init, 186 .init = at91sam9g20ek_wm8731_init,
185 .platform_name = "atmel-pcm-audio", 187 .platform_name = "at91rm9200_ssc.0",
186 .codec_name = "wm8731.0-001b", 188 .codec_name = "wm8731.0-001b",
187 .ops = &at91sam9g20ek_ops, 189 .ops = &at91sam9g20ek_ops,
188}; 190};
@@ -195,20 +197,31 @@ static struct snd_soc_card snd_soc_at91sam9g20ek = {
195 .set_bias_level = at91sam9g20ek_set_bias_level, 197 .set_bias_level = at91sam9g20ek_set_bias_level,
196}; 198};
197 199
198static struct platform_device *at91sam9g20ek_snd_device; 200static int at91sam9g20ek_audio_probe(struct platform_device *pdev)
199
200static int __init at91sam9g20ek_init(void)
201{ 201{
202 struct device_node *np = pdev->dev.of_node;
203 struct device_node *codec_np, *cpu_np;
202 struct clk *pllb; 204 struct clk *pllb;
205 struct snd_soc_card *card = &snd_soc_at91sam9g20ek;
206 struct pinctrl *pinctrl;
203 int ret; 207 int ret;
204 208
205 if (!(machine_is_at91sam9g20ek() || machine_is_at91sam9g20ek_2mmc())) 209 pinctrl = devm_pinctrl_get_select_default(&pdev->dev);
206 return -ENODEV; 210 if (IS_ERR(pinctrl)) {
211 dev_err(&pdev->dev, "Failed to request pinctrl for mck\n");
212 return PTR_ERR(pinctrl);
213 }
214
215 if (!np) {
216 if (!(machine_is_at91sam9g20ek() ||
217 machine_is_at91sam9g20ek_2mmc()))
218 return -ENODEV;
219 }
207 220
208 ret = atmel_ssc_set_audio(0); 221 ret = atmel_ssc_set_audio(0);
209 if (ret != 0) { 222 if (ret) {
210 pr_err("Failed to set SSC 0 for audio: %d\n", ret); 223 dev_err(&pdev->dev, "ssc channel is not valid\n");
211 return ret; 224 return -EINVAL;
212 } 225 }
213 226
214 /* 227 /*
@@ -236,45 +249,92 @@ static int __init at91sam9g20ek_init(void)
236 249
237 clk_set_rate(mclk, MCLK_RATE); 250 clk_set_rate(mclk, MCLK_RATE);
238 251
239 at91sam9g20ek_snd_device = platform_device_alloc("soc-audio", -1); 252 card->dev = &pdev->dev;
240 if (!at91sam9g20ek_snd_device) { 253
241 printk(KERN_ERR "ASoC: Platform device allocation failed\n"); 254 /* Parse device node info */
242 ret = -ENOMEM; 255 if (np) {
243 goto err_mclk; 256 ret = snd_soc_of_parse_card_name(card, "atmel,model");
257 if (ret)
258 goto err;
259
260 ret = snd_soc_of_parse_audio_routing(card,
261 "atmel,audio-routing");
262 if (ret)
263 goto err;
264
265 /* Parse codec info */
266 at91sam9g20ek_dai.codec_name = NULL;
267 codec_np = of_parse_phandle(np, "atmel,audio-codec", 0);
268 if (!codec_np) {
269 dev_err(&pdev->dev, "codec info missing\n");
270 return -EINVAL;
271 }
272 at91sam9g20ek_dai.codec_of_node = codec_np;
273
274 /* Parse dai and platform info */
275 at91sam9g20ek_dai.cpu_dai_name = NULL;
276 at91sam9g20ek_dai.platform_name = NULL;
277 cpu_np = of_parse_phandle(np, "atmel,ssc-controller", 0);
278 if (!cpu_np) {
279 dev_err(&pdev->dev, "dai and pcm info missing\n");
280 return -EINVAL;
281 }
282 at91sam9g20ek_dai.cpu_of_node = cpu_np;
283 at91sam9g20ek_dai.platform_of_node = cpu_np;
284
285 of_node_put(codec_np);
286 of_node_put(cpu_np);
244 } 287 }
245 288
246 platform_set_drvdata(at91sam9g20ek_snd_device, 289 ret = snd_soc_register_card(card);
247 &snd_soc_at91sam9g20ek);
248
249 ret = platform_device_add(at91sam9g20ek_snd_device);
250 if (ret) { 290 if (ret) {
251 printk(KERN_ERR "ASoC: Platform device allocation failed\n"); 291 printk(KERN_ERR "ASoC: snd_soc_register_card() failed\n");
252 goto err_device_add;
253 } 292 }
254 293
255 return ret; 294 return ret;
256 295
257err_device_add:
258 platform_device_put(at91sam9g20ek_snd_device);
259err_mclk: 296err_mclk:
260 clk_put(mclk); 297 clk_put(mclk);
261 mclk = NULL; 298 mclk = NULL;
262err: 299err:
300 atmel_ssc_put_audio(0);
263 return ret; 301 return ret;
264} 302}
265 303
266static void __exit at91sam9g20ek_exit(void) 304static int at91sam9g20ek_audio_remove(struct platform_device *pdev)
267{ 305{
268 platform_device_unregister(at91sam9g20ek_snd_device); 306 struct snd_soc_card *card = platform_get_drvdata(pdev);
269 at91sam9g20ek_snd_device = NULL; 307
308 atmel_ssc_put_audio(0);
309 snd_soc_unregister_card(card);
270 clk_put(mclk); 310 clk_put(mclk);
271 mclk = NULL; 311 mclk = NULL;
312
313 return 0;
272} 314}
273 315
274module_init(at91sam9g20ek_init); 316#ifdef CONFIG_OF
275module_exit(at91sam9g20ek_exit); 317static const struct of_device_id at91sam9g20ek_wm8731_dt_ids[] = {
318 { .compatible = "atmel,at91sam9g20ek-wm8731-audio", },
319 { }
320};
321MODULE_DEVICE_TABLE(of, at91sam9g20ek_wm8731_dt_ids);
322#endif
323
324static struct platform_driver at91sam9g20ek_audio_driver = {
325 .driver = {
326 .name = "at91sam9g20ek-audio",
327 .owner = THIS_MODULE,
328 .of_match_table = of_match_ptr(at91sam9g20ek_wm8731_dt_ids),
329 },
330 .probe = at91sam9g20ek_audio_probe,
331 .remove = at91sam9g20ek_audio_remove,
332};
333
334module_platform_driver(at91sam9g20ek_audio_driver);
276 335
277/* Module information */ 336/* Module information */
278MODULE_AUTHOR("Sedji Gaouaou <sedji.gaouaou@atmel.com>"); 337MODULE_AUTHOR("Sedji Gaouaou <sedji.gaouaou@atmel.com>");
279MODULE_DESCRIPTION("ALSA SoC AT91SAM9G20EK_WM8731"); 338MODULE_DESCRIPTION("ALSA SoC AT91SAM9G20EK_WM8731");
339MODULE_ALIAS("platform:at91sam9g20ek-audio");
280MODULE_LICENSE("GPL"); 340MODULE_LICENSE("GPL");
diff --git a/sound/soc/au1x/ac97c.c b/sound/soc/au1x/ac97c.c
index c5ac2449563a..ea7d9d157022 100644
--- a/sound/soc/au1x/ac97c.c
+++ b/sound/soc/au1x/ac97c.c
@@ -223,7 +223,7 @@ static struct snd_soc_dai_driver au1xac97c_dai_driver = {
223 .ops = &alchemy_ac97c_ops, 223 .ops = &alchemy_ac97c_ops,
224}; 224};
225 225
226static int __devinit au1xac97c_drvprobe(struct platform_device *pdev) 226static int au1xac97c_drvprobe(struct platform_device *pdev)
227{ 227{
228 int ret; 228 int ret;
229 struct resource *iores, *dmares; 229 struct resource *iores, *dmares;
@@ -276,7 +276,7 @@ static int __devinit au1xac97c_drvprobe(struct platform_device *pdev)
276 return 0; 276 return 0;
277} 277}
278 278
279static int __devexit au1xac97c_drvremove(struct platform_device *pdev) 279static int au1xac97c_drvremove(struct platform_device *pdev)
280{ 280{
281 struct au1xpsc_audio_data *ctx = platform_get_drvdata(pdev); 281 struct au1xpsc_audio_data *ctx = platform_get_drvdata(pdev);
282 282
@@ -330,7 +330,7 @@ static struct platform_driver au1xac97c_driver = {
330 .pm = AU1XPSCAC97_PMOPS, 330 .pm = AU1XPSCAC97_PMOPS,
331 }, 331 },
332 .probe = au1xac97c_drvprobe, 332 .probe = au1xac97c_drvprobe,
333 .remove = __devexit_p(au1xac97c_drvremove), 333 .remove = au1xac97c_drvremove,
334}; 334};
335 335
336static int __init au1xac97c_load(void) 336static int __init au1xac97c_load(void)
diff --git a/sound/soc/au1x/db1000.c b/sound/soc/au1x/db1000.c
index 511d83c11a9a..376d976bcc2d 100644
--- a/sound/soc/au1x/db1000.c
+++ b/sound/soc/au1x/db1000.c
@@ -34,14 +34,14 @@ static struct snd_soc_card db1000_ac97 = {
34 .num_links = 1, 34 .num_links = 1,
35}; 35};
36 36
37static int __devinit db1000_audio_probe(struct platform_device *pdev) 37static int db1000_audio_probe(struct platform_device *pdev)
38{ 38{
39 struct snd_soc_card *card = &db1000_ac97; 39 struct snd_soc_card *card = &db1000_ac97;
40 card->dev = &pdev->dev; 40 card->dev = &pdev->dev;
41 return snd_soc_register_card(card); 41 return snd_soc_register_card(card);
42} 42}
43 43
44static int __devexit db1000_audio_remove(struct platform_device *pdev) 44static int db1000_audio_remove(struct platform_device *pdev)
45{ 45{
46 struct snd_soc_card *card = platform_get_drvdata(pdev); 46 struct snd_soc_card *card = platform_get_drvdata(pdev);
47 snd_soc_unregister_card(card); 47 snd_soc_unregister_card(card);
@@ -55,7 +55,7 @@ static struct platform_driver db1000_audio_driver = {
55 .pm = &snd_soc_pm_ops, 55 .pm = &snd_soc_pm_ops,
56 }, 56 },
57 .probe = db1000_audio_probe, 57 .probe = db1000_audio_probe,
58 .remove = __devexit_p(db1000_audio_remove), 58 .remove = db1000_audio_remove,
59}; 59};
60 60
61module_platform_driver(db1000_audio_driver); 61module_platform_driver(db1000_audio_driver);
diff --git a/sound/soc/au1x/db1200.c b/sound/soc/au1x/db1200.c
index 30ea513d81d7..a497a0cfeba1 100644
--- a/sound/soc/au1x/db1200.c
+++ b/sound/soc/au1x/db1200.c
@@ -167,7 +167,7 @@ static struct snd_soc_card db1550_i2s_machine = {
167 167
168/*------------------------- COMMON PART ---------------------------*/ 168/*------------------------- COMMON PART ---------------------------*/
169 169
170static struct snd_soc_card *db1200_cards[] __devinitdata = { 170static struct snd_soc_card *db1200_cards[] = {
171 &db1200_ac97_machine, 171 &db1200_ac97_machine,
172 &db1200_i2s_machine, 172 &db1200_i2s_machine,
173 &db1300_ac97_machine, 173 &db1300_ac97_machine,
@@ -176,7 +176,7 @@ static struct snd_soc_card *db1200_cards[] __devinitdata = {
176 &db1550_i2s_machine, 176 &db1550_i2s_machine,
177}; 177};
178 178
179static int __devinit db1200_audio_probe(struct platform_device *pdev) 179static int db1200_audio_probe(struct platform_device *pdev)
180{ 180{
181 const struct platform_device_id *pid = platform_get_device_id(pdev); 181 const struct platform_device_id *pid = platform_get_device_id(pdev);
182 struct snd_soc_card *card; 182 struct snd_soc_card *card;
@@ -186,7 +186,7 @@ static int __devinit db1200_audio_probe(struct platform_device *pdev)
186 return snd_soc_register_card(card); 186 return snd_soc_register_card(card);
187} 187}
188 188
189static int __devexit db1200_audio_remove(struct platform_device *pdev) 189static int db1200_audio_remove(struct platform_device *pdev)
190{ 190{
191 struct snd_soc_card *card = platform_get_drvdata(pdev); 191 struct snd_soc_card *card = platform_get_drvdata(pdev);
192 snd_soc_unregister_card(card); 192 snd_soc_unregister_card(card);
@@ -201,7 +201,7 @@ static struct platform_driver db1200_audio_driver = {
201 }, 201 },
202 .id_table = db1200_pids, 202 .id_table = db1200_pids,
203 .probe = db1200_audio_probe, 203 .probe = db1200_audio_probe,
204 .remove = __devexit_p(db1200_audio_remove), 204 .remove = db1200_audio_remove,
205}; 205};
206 206
207module_platform_driver(db1200_audio_driver); 207module_platform_driver(db1200_audio_driver);
diff --git a/sound/soc/au1x/dbdma2.c b/sound/soc/au1x/dbdma2.c
index 8372cd35f0d6..3b4eafaf30d3 100644
--- a/sound/soc/au1x/dbdma2.c
+++ b/sound/soc/au1x/dbdma2.c
@@ -347,7 +347,7 @@ static struct snd_soc_platform_driver au1xpsc_soc_platform = {
347 .pcm_free = au1xpsc_pcm_free_dma_buffers, 347 .pcm_free = au1xpsc_pcm_free_dma_buffers,
348}; 348};
349 349
350static int __devinit au1xpsc_pcm_drvprobe(struct platform_device *pdev) 350static int au1xpsc_pcm_drvprobe(struct platform_device *pdev)
351{ 351{
352 struct au1xpsc_audio_dmadata *dmadata; 352 struct au1xpsc_audio_dmadata *dmadata;
353 353
@@ -362,7 +362,7 @@ static int __devinit au1xpsc_pcm_drvprobe(struct platform_device *pdev)
362 return snd_soc_register_platform(&pdev->dev, &au1xpsc_soc_platform); 362 return snd_soc_register_platform(&pdev->dev, &au1xpsc_soc_platform);
363} 363}
364 364
365static int __devexit au1xpsc_pcm_drvremove(struct platform_device *pdev) 365static int au1xpsc_pcm_drvremove(struct platform_device *pdev)
366{ 366{
367 snd_soc_unregister_platform(&pdev->dev); 367 snd_soc_unregister_platform(&pdev->dev);
368 368
@@ -375,7 +375,7 @@ static struct platform_driver au1xpsc_pcm_driver = {
375 .owner = THIS_MODULE, 375 .owner = THIS_MODULE,
376 }, 376 },
377 .probe = au1xpsc_pcm_drvprobe, 377 .probe = au1xpsc_pcm_drvprobe,
378 .remove = __devexit_p(au1xpsc_pcm_drvremove), 378 .remove = au1xpsc_pcm_drvremove,
379}; 379};
380 380
381module_platform_driver(au1xpsc_pcm_driver); 381module_platform_driver(au1xpsc_pcm_driver);
diff --git a/sound/soc/au1x/dma.c b/sound/soc/au1x/dma.c
index 0a91b186a86f..befd1074f9bd 100644
--- a/sound/soc/au1x/dma.c
+++ b/sound/soc/au1x/dma.c
@@ -322,7 +322,7 @@ static struct snd_soc_platform_driver alchemy_pcm_soc_platform = {
322 .pcm_free = alchemy_pcm_free_dma_buffers, 322 .pcm_free = alchemy_pcm_free_dma_buffers,
323}; 323};
324 324
325static int __devinit alchemy_pcm_drvprobe(struct platform_device *pdev) 325static int alchemy_pcm_drvprobe(struct platform_device *pdev)
326{ 326{
327 struct alchemy_pcm_ctx *ctx; 327 struct alchemy_pcm_ctx *ctx;
328 328
@@ -335,7 +335,7 @@ static int __devinit alchemy_pcm_drvprobe(struct platform_device *pdev)
335 return snd_soc_register_platform(&pdev->dev, &alchemy_pcm_soc_platform); 335 return snd_soc_register_platform(&pdev->dev, &alchemy_pcm_soc_platform);
336} 336}
337 337
338static int __devexit alchemy_pcm_drvremove(struct platform_device *pdev) 338static int alchemy_pcm_drvremove(struct platform_device *pdev)
339{ 339{
340 snd_soc_unregister_platform(&pdev->dev); 340 snd_soc_unregister_platform(&pdev->dev);
341 341
@@ -348,7 +348,7 @@ static struct platform_driver alchemy_pcmdma_driver = {
348 .owner = THIS_MODULE, 348 .owner = THIS_MODULE,
349 }, 349 },
350 .probe = alchemy_pcm_drvprobe, 350 .probe = alchemy_pcm_drvprobe,
351 .remove = __devexit_p(alchemy_pcm_drvremove), 351 .remove = alchemy_pcm_drvremove,
352}; 352};
353 353
354module_platform_driver(alchemy_pcmdma_driver); 354module_platform_driver(alchemy_pcmdma_driver);
diff --git a/sound/soc/au1x/i2sc.c b/sound/soc/au1x/i2sc.c
index d4b9e364a47a..072448afc219 100644
--- a/sound/soc/au1x/i2sc.c
+++ b/sound/soc/au1x/i2sc.c
@@ -225,7 +225,7 @@ static struct snd_soc_dai_driver au1xi2s_dai_driver = {
225 .ops = &au1xi2s_dai_ops, 225 .ops = &au1xi2s_dai_ops,
226}; 226};
227 227
228static int __devinit au1xi2s_drvprobe(struct platform_device *pdev) 228static int au1xi2s_drvprobe(struct platform_device *pdev)
229{ 229{
230 struct resource *iores, *dmares; 230 struct resource *iores, *dmares;
231 struct au1xpsc_audio_data *ctx; 231 struct au1xpsc_audio_data *ctx;
@@ -263,7 +263,7 @@ static int __devinit au1xi2s_drvprobe(struct platform_device *pdev)
263 return snd_soc_register_dai(&pdev->dev, &au1xi2s_dai_driver); 263 return snd_soc_register_dai(&pdev->dev, &au1xi2s_dai_driver);
264} 264}
265 265
266static int __devexit au1xi2s_drvremove(struct platform_device *pdev) 266static int au1xi2s_drvremove(struct platform_device *pdev)
267{ 267{
268 struct au1xpsc_audio_data *ctx = platform_get_drvdata(pdev); 268 struct au1xpsc_audio_data *ctx = platform_get_drvdata(pdev);
269 269
@@ -309,7 +309,7 @@ static struct platform_driver au1xi2s_driver = {
309 .pm = AU1XI2SC_PMOPS, 309 .pm = AU1XI2SC_PMOPS,
310 }, 310 },
311 .probe = au1xi2s_drvprobe, 311 .probe = au1xi2s_drvprobe,
312 .remove = __devexit_p(au1xi2s_drvremove), 312 .remove = au1xi2s_drvremove,
313}; 313};
314 314
315module_platform_driver(au1xi2s_driver); 315module_platform_driver(au1xi2s_driver);
diff --git a/sound/soc/au1x/psc-ac97.c b/sound/soc/au1x/psc-ac97.c
index 476b79a1c11a..6ba07e365967 100644
--- a/sound/soc/au1x/psc-ac97.c
+++ b/sound/soc/au1x/psc-ac97.c
@@ -361,7 +361,7 @@ static const struct snd_soc_dai_driver au1xpsc_ac97_dai_template = {
361 .ops = &au1xpsc_ac97_dai_ops, 361 .ops = &au1xpsc_ac97_dai_ops,
362}; 362};
363 363
364static int __devinit au1xpsc_ac97_drvprobe(struct platform_device *pdev) 364static int au1xpsc_ac97_drvprobe(struct platform_device *pdev)
365{ 365{
366 int ret; 366 int ret;
367 struct resource *iores, *dmares; 367 struct resource *iores, *dmares;
@@ -427,7 +427,7 @@ static int __devinit au1xpsc_ac97_drvprobe(struct platform_device *pdev)
427 return 0; 427 return 0;
428} 428}
429 429
430static int __devexit au1xpsc_ac97_drvremove(struct platform_device *pdev) 430static int au1xpsc_ac97_drvremove(struct platform_device *pdev)
431{ 431{
432 struct au1xpsc_audio_data *wd = platform_get_drvdata(pdev); 432 struct au1xpsc_audio_data *wd = platform_get_drvdata(pdev);
433 433
@@ -495,7 +495,7 @@ static struct platform_driver au1xpsc_ac97_driver = {
495 .pm = AU1XPSCAC97_PMOPS, 495 .pm = AU1XPSCAC97_PMOPS,
496 }, 496 },
497 .probe = au1xpsc_ac97_drvprobe, 497 .probe = au1xpsc_ac97_drvprobe,
498 .remove = __devexit_p(au1xpsc_ac97_drvremove), 498 .remove = au1xpsc_ac97_drvremove,
499}; 499};
500 500
501static int __init au1xpsc_ac97_load(void) 501static int __init au1xpsc_ac97_load(void)
diff --git a/sound/soc/au1x/psc-i2s.c b/sound/soc/au1x/psc-i2s.c
index 0607ba3d9258..360b4e50d7c8 100644
--- a/sound/soc/au1x/psc-i2s.c
+++ b/sound/soc/au1x/psc-i2s.c
@@ -288,7 +288,7 @@ static const struct snd_soc_dai_driver au1xpsc_i2s_dai_template = {
288 .ops = &au1xpsc_i2s_dai_ops, 288 .ops = &au1xpsc_i2s_dai_ops,
289}; 289};
290 290
291static int __devinit au1xpsc_i2s_drvprobe(struct platform_device *pdev) 291static int au1xpsc_i2s_drvprobe(struct platform_device *pdev)
292{ 292{
293 struct resource *iores, *dmares; 293 struct resource *iores, *dmares;
294 unsigned long sel; 294 unsigned long sel;
@@ -353,7 +353,7 @@ static int __devinit au1xpsc_i2s_drvprobe(struct platform_device *pdev)
353 return snd_soc_register_dai(&pdev->dev, &wd->dai_drv); 353 return snd_soc_register_dai(&pdev->dev, &wd->dai_drv);
354} 354}
355 355
356static int __devexit au1xpsc_i2s_drvremove(struct platform_device *pdev) 356static int au1xpsc_i2s_drvremove(struct platform_device *pdev)
357{ 357{
358 struct au1xpsc_audio_data *wd = platform_get_drvdata(pdev); 358 struct au1xpsc_audio_data *wd = platform_get_drvdata(pdev);
359 359
@@ -418,7 +418,7 @@ static struct platform_driver au1xpsc_i2s_driver = {
418 .pm = AU1XPSCI2S_PMOPS, 418 .pm = AU1XPSCI2S_PMOPS,
419 }, 419 },
420 .probe = au1xpsc_i2s_drvprobe, 420 .probe = au1xpsc_i2s_drvprobe,
421 .remove = __devexit_p(au1xpsc_i2s_drvremove), 421 .remove = au1xpsc_i2s_drvremove,
422}; 422};
423 423
424module_platform_driver(au1xpsc_i2s_driver); 424module_platform_driver(au1xpsc_i2s_driver);
diff --git a/sound/soc/blackfin/bf5xx-ac97-pcm.c b/sound/soc/blackfin/bf5xx-ac97-pcm.c
index d7dc9bde0976..7e2f36004a5a 100644
--- a/sound/soc/blackfin/bf5xx-ac97-pcm.c
+++ b/sound/soc/blackfin/bf5xx-ac97-pcm.c
@@ -453,12 +453,12 @@ static struct snd_soc_platform_driver bf5xx_ac97_soc_platform = {
453 .pcm_free = bf5xx_pcm_free_dma_buffers, 453 .pcm_free = bf5xx_pcm_free_dma_buffers,
454}; 454};
455 455
456static int __devinit bf5xx_soc_platform_probe(struct platform_device *pdev) 456static int bf5xx_soc_platform_probe(struct platform_device *pdev)
457{ 457{
458 return snd_soc_register_platform(&pdev->dev, &bf5xx_ac97_soc_platform); 458 return snd_soc_register_platform(&pdev->dev, &bf5xx_ac97_soc_platform);
459} 459}
460 460
461static int __devexit bf5xx_soc_platform_remove(struct platform_device *pdev) 461static int bf5xx_soc_platform_remove(struct platform_device *pdev)
462{ 462{
463 snd_soc_unregister_platform(&pdev->dev); 463 snd_soc_unregister_platform(&pdev->dev);
464 return 0; 464 return 0;
@@ -471,7 +471,7 @@ static struct platform_driver bf5xx_pcm_driver = {
471 }, 471 },
472 472
473 .probe = bf5xx_soc_platform_probe, 473 .probe = bf5xx_soc_platform_probe,
474 .remove = __devexit_p(bf5xx_soc_platform_remove), 474 .remove = bf5xx_soc_platform_remove,
475}; 475};
476 476
477module_platform_driver(bf5xx_pcm_driver); 477module_platform_driver(bf5xx_pcm_driver);
diff --git a/sound/soc/blackfin/bf5xx-ac97.c b/sound/soc/blackfin/bf5xx-ac97.c
index f4e9dc4e262e..8e41bcb020eb 100644
--- a/sound/soc/blackfin/bf5xx-ac97.c
+++ b/sound/soc/blackfin/bf5xx-ac97.c
@@ -282,7 +282,7 @@ static struct snd_soc_dai_driver bfin_ac97_dai = {
282 .formats = SNDRV_PCM_FMTBIT_S16_LE, }, 282 .formats = SNDRV_PCM_FMTBIT_S16_LE, },
283}; 283};
284 284
285static int __devinit asoc_bfin_ac97_probe(struct platform_device *pdev) 285static int asoc_bfin_ac97_probe(struct platform_device *pdev)
286{ 286{
287 struct sport_device *sport_handle; 287 struct sport_device *sport_handle;
288 int ret; 288 int ret;
@@ -352,7 +352,7 @@ gpio_err:
352 return ret; 352 return ret;
353} 353}
354 354
355static int __devexit asoc_bfin_ac97_remove(struct platform_device *pdev) 355static int asoc_bfin_ac97_remove(struct platform_device *pdev)
356{ 356{
357 struct sport_device *sport_handle = platform_get_drvdata(pdev); 357 struct sport_device *sport_handle = platform_get_drvdata(pdev);
358 358
@@ -372,7 +372,7 @@ static struct platform_driver asoc_bfin_ac97_driver = {
372 }, 372 },
373 373
374 .probe = asoc_bfin_ac97_probe, 374 .probe = asoc_bfin_ac97_probe,
375 .remove = __devexit_p(asoc_bfin_ac97_remove), 375 .remove = asoc_bfin_ac97_remove,
376}; 376};
377 377
378module_platform_driver(asoc_bfin_ac97_driver); 378module_platform_driver(asoc_bfin_ac97_driver);
diff --git a/sound/soc/blackfin/bf5xx-ad1836.c b/sound/soc/blackfin/bf5xx-ad1836.c
index 16b9c9efd19a..d23f4b0ea54f 100644
--- a/sound/soc/blackfin/bf5xx-ad1836.c
+++ b/sound/soc/blackfin/bf5xx-ad1836.c
@@ -75,7 +75,7 @@ static struct snd_soc_card bf5xx_ad1836 = {
75 .num_links = 1, 75 .num_links = 1,
76}; 76};
77 77
78static __devinit int bf5xx_ad1836_driver_probe(struct platform_device *pdev) 78static int bf5xx_ad1836_driver_probe(struct platform_device *pdev)
79{ 79{
80 struct snd_soc_card *card = &bf5xx_ad1836; 80 struct snd_soc_card *card = &bf5xx_ad1836;
81 const char **link_name; 81 const char **link_name;
@@ -98,7 +98,7 @@ static __devinit int bf5xx_ad1836_driver_probe(struct platform_device *pdev)
98 return ret; 98 return ret;
99} 99}
100 100
101static int __devexit bf5xx_ad1836_driver_remove(struct platform_device *pdev) 101static int bf5xx_ad1836_driver_remove(struct platform_device *pdev)
102{ 102{
103 struct snd_soc_card *card = platform_get_drvdata(pdev); 103 struct snd_soc_card *card = platform_get_drvdata(pdev);
104 104
@@ -113,7 +113,7 @@ static struct platform_driver bf5xx_ad1836_driver = {
113 .pm = &snd_soc_pm_ops, 113 .pm = &snd_soc_pm_ops,
114 }, 114 },
115 .probe = bf5xx_ad1836_driver_probe, 115 .probe = bf5xx_ad1836_driver_probe,
116 .remove = __devexit_p(bf5xx_ad1836_driver_remove), 116 .remove = bf5xx_ad1836_driver_remove,
117}; 117};
118module_platform_driver(bf5xx_ad1836_driver); 118module_platform_driver(bf5xx_ad1836_driver);
119 119
diff --git a/sound/soc/blackfin/bf5xx-i2s-pcm.c b/sound/soc/blackfin/bf5xx-i2s-pcm.c
index 63205d723eab..262c1de364d8 100644
--- a/sound/soc/blackfin/bf5xx-i2s-pcm.c
+++ b/sound/soc/blackfin/bf5xx-i2s-pcm.c
@@ -292,12 +292,12 @@ static struct snd_soc_platform_driver bf5xx_i2s_soc_platform = {
292 .pcm_free = bf5xx_pcm_free_dma_buffers, 292 .pcm_free = bf5xx_pcm_free_dma_buffers,
293}; 293};
294 294
295static int __devinit bfin_i2s_soc_platform_probe(struct platform_device *pdev) 295static int bfin_i2s_soc_platform_probe(struct platform_device *pdev)
296{ 296{
297 return snd_soc_register_platform(&pdev->dev, &bf5xx_i2s_soc_platform); 297 return snd_soc_register_platform(&pdev->dev, &bf5xx_i2s_soc_platform);
298} 298}
299 299
300static int __devexit bfin_i2s_soc_platform_remove(struct platform_device *pdev) 300static int bfin_i2s_soc_platform_remove(struct platform_device *pdev)
301{ 301{
302 snd_soc_unregister_platform(&pdev->dev); 302 snd_soc_unregister_platform(&pdev->dev);
303 return 0; 303 return 0;
@@ -310,7 +310,7 @@ static struct platform_driver bfin_i2s_pcm_driver = {
310 }, 310 },
311 311
312 .probe = bfin_i2s_soc_platform_probe, 312 .probe = bfin_i2s_soc_platform_probe,
313 .remove = __devexit_p(bfin_i2s_soc_platform_remove), 313 .remove = bfin_i2s_soc_platform_remove,
314}; 314};
315 315
316module_platform_driver(bfin_i2s_pcm_driver); 316module_platform_driver(bfin_i2s_pcm_driver);
diff --git a/sound/soc/blackfin/bf5xx-i2s.c b/sound/soc/blackfin/bf5xx-i2s.c
index 4dccf0374fe7..168d88bccb41 100644
--- a/sound/soc/blackfin/bf5xx-i2s.c
+++ b/sound/soc/blackfin/bf5xx-i2s.c
@@ -245,7 +245,7 @@ static struct snd_soc_dai_driver bf5xx_i2s_dai = {
245 .ops = &bf5xx_i2s_dai_ops, 245 .ops = &bf5xx_i2s_dai_ops,
246}; 246};
247 247
248static int __devinit bf5xx_i2s_probe(struct platform_device *pdev) 248static int bf5xx_i2s_probe(struct platform_device *pdev)
249{ 249{
250 struct sport_device *sport_handle; 250 struct sport_device *sport_handle;
251 int ret; 251 int ret;
@@ -267,7 +267,7 @@ static int __devinit bf5xx_i2s_probe(struct platform_device *pdev)
267 return 0; 267 return 0;
268} 268}
269 269
270static int __devexit bf5xx_i2s_remove(struct platform_device *pdev) 270static int bf5xx_i2s_remove(struct platform_device *pdev)
271{ 271{
272 struct sport_device *sport_handle = platform_get_drvdata(pdev); 272 struct sport_device *sport_handle = platform_get_drvdata(pdev);
273 273
@@ -281,7 +281,7 @@ static int __devexit bf5xx_i2s_remove(struct platform_device *pdev)
281 281
282static struct platform_driver bfin_i2s_driver = { 282static struct platform_driver bfin_i2s_driver = {
283 .probe = bf5xx_i2s_probe, 283 .probe = bf5xx_i2s_probe,
284 .remove = __devexit_p(bf5xx_i2s_remove), 284 .remove = bf5xx_i2s_remove,
285 .driver = { 285 .driver = {
286 .name = "bfin-i2s", 286 .name = "bfin-i2s",
287 .owner = THIS_MODULE, 287 .owner = THIS_MODULE,
diff --git a/sound/soc/blackfin/bf5xx-tdm-pcm.c b/sound/soc/blackfin/bf5xx-tdm-pcm.c
index 254490cf1876..0e6b888bb4cc 100644
--- a/sound/soc/blackfin/bf5xx-tdm-pcm.c
+++ b/sound/soc/blackfin/bf5xx-tdm-pcm.c
@@ -317,12 +317,12 @@ static struct snd_soc_platform_driver bf5xx_tdm_soc_platform = {
317 .pcm_free = bf5xx_pcm_free_dma_buffers, 317 .pcm_free = bf5xx_pcm_free_dma_buffers,
318}; 318};
319 319
320static int __devinit bf5xx_soc_platform_probe(struct platform_device *pdev) 320static int bf5xx_soc_platform_probe(struct platform_device *pdev)
321{ 321{
322 return snd_soc_register_platform(&pdev->dev, &bf5xx_tdm_soc_platform); 322 return snd_soc_register_platform(&pdev->dev, &bf5xx_tdm_soc_platform);
323} 323}
324 324
325static int __devexit bf5xx_soc_platform_remove(struct platform_device *pdev) 325static int bf5xx_soc_platform_remove(struct platform_device *pdev)
326{ 326{
327 snd_soc_unregister_platform(&pdev->dev); 327 snd_soc_unregister_platform(&pdev->dev);
328 return 0; 328 return 0;
@@ -335,7 +335,7 @@ static struct platform_driver bfin_tdm_driver = {
335 }, 335 },
336 336
337 .probe = bf5xx_soc_platform_probe, 337 .probe = bf5xx_soc_platform_probe,
338 .remove = __devexit_p(bf5xx_soc_platform_remove), 338 .remove = bf5xx_soc_platform_remove,
339}; 339};
340 340
341module_platform_driver(bfin_tdm_driver); 341module_platform_driver(bfin_tdm_driver);
diff --git a/sound/soc/blackfin/bf5xx-tdm.c b/sound/soc/blackfin/bf5xx-tdm.c
index 594f88217c74..c1e516ec53ad 100644
--- a/sound/soc/blackfin/bf5xx-tdm.c
+++ b/sound/soc/blackfin/bf5xx-tdm.c
@@ -249,7 +249,7 @@ static struct snd_soc_dai_driver bf5xx_tdm_dai = {
249 .ops = &bf5xx_tdm_dai_ops, 249 .ops = &bf5xx_tdm_dai_ops,
250}; 250};
251 251
252static int __devinit bfin_tdm_probe(struct platform_device *pdev) 252static int bfin_tdm_probe(struct platform_device *pdev)
253{ 253{
254 struct sport_device *sport_handle; 254 struct sport_device *sport_handle;
255 int ret; 255 int ret;
@@ -295,7 +295,7 @@ sport_config_err:
295 return ret; 295 return ret;
296} 296}
297 297
298static int __devexit bfin_tdm_remove(struct platform_device *pdev) 298static int bfin_tdm_remove(struct platform_device *pdev)
299{ 299{
300 struct sport_device *sport_handle = platform_get_drvdata(pdev); 300 struct sport_device *sport_handle = platform_get_drvdata(pdev);
301 301
@@ -307,7 +307,7 @@ static int __devexit bfin_tdm_remove(struct platform_device *pdev)
307 307
308static struct platform_driver bfin_tdm_driver = { 308static struct platform_driver bfin_tdm_driver = {
309 .probe = bfin_tdm_probe, 309 .probe = bfin_tdm_probe,
310 .remove = __devexit_p(bfin_tdm_remove), 310 .remove = bfin_tdm_remove,
311 .driver = { 311 .driver = {
312 .name = "bfin-tdm", 312 .name = "bfin-tdm",
313 .owner = THIS_MODULE, 313 .owner = THIS_MODULE,
diff --git a/sound/soc/blackfin/bf6xx-i2s.c b/sound/soc/blackfin/bf6xx-i2s.c
index c3c2466d3a42..8f337972f438 100644
--- a/sound/soc/blackfin/bf6xx-i2s.c
+++ b/sound/soc/blackfin/bf6xx-i2s.c
@@ -186,7 +186,7 @@ static struct snd_soc_dai_driver bfin_i2s_dai = {
186 .ops = &bfin_i2s_dai_ops, 186 .ops = &bfin_i2s_dai_ops,
187}; 187};
188 188
189static int __devinit bfin_i2s_probe(struct platform_device *pdev) 189static int bfin_i2s_probe(struct platform_device *pdev)
190{ 190{
191 struct sport_device *sport; 191 struct sport_device *sport;
192 struct device *dev = &pdev->dev; 192 struct device *dev = &pdev->dev;
@@ -208,7 +208,7 @@ static int __devinit bfin_i2s_probe(struct platform_device *pdev)
208 return 0; 208 return 0;
209} 209}
210 210
211static int __devexit bfin_i2s_remove(struct platform_device *pdev) 211static int bfin_i2s_remove(struct platform_device *pdev)
212{ 212{
213 struct sport_device *sport = platform_get_drvdata(pdev); 213 struct sport_device *sport = platform_get_drvdata(pdev);
214 214
@@ -220,7 +220,7 @@ static int __devexit bfin_i2s_remove(struct platform_device *pdev)
220 220
221static struct platform_driver bfin_i2s_driver = { 221static struct platform_driver bfin_i2s_driver = {
222 .probe = bfin_i2s_probe, 222 .probe = bfin_i2s_probe,
223 .remove = __devexit_p(bfin_i2s_remove), 223 .remove = bfin_i2s_remove,
224 .driver = { 224 .driver = {
225 .name = "bfin-i2s", 225 .name = "bfin-i2s",
226 .owner = THIS_MODULE, 226 .owner = THIS_MODULE,
diff --git a/sound/soc/blackfin/bfin-eval-adau1373.c b/sound/soc/blackfin/bfin-eval-adau1373.c
index f3adbdbdd5e1..4ef9683bcad8 100644
--- a/sound/soc/blackfin/bfin-eval-adau1373.c
+++ b/sound/soc/blackfin/bfin-eval-adau1373.c
@@ -157,7 +157,7 @@ static int bfin_eval_adau1373_probe(struct platform_device *pdev)
157 return snd_soc_register_card(&bfin_eval_adau1373); 157 return snd_soc_register_card(&bfin_eval_adau1373);
158} 158}
159 159
160static int __devexit bfin_eval_adau1373_remove(struct platform_device *pdev) 160static int bfin_eval_adau1373_remove(struct platform_device *pdev)
161{ 161{
162 struct snd_soc_card *card = platform_get_drvdata(pdev); 162 struct snd_soc_card *card = platform_get_drvdata(pdev);
163 163
@@ -173,7 +173,7 @@ static struct platform_driver bfin_eval_adau1373_driver = {
173 .pm = &snd_soc_pm_ops, 173 .pm = &snd_soc_pm_ops,
174 }, 174 },
175 .probe = bfin_eval_adau1373_probe, 175 .probe = bfin_eval_adau1373_probe,
176 .remove = __devexit_p(bfin_eval_adau1373_remove), 176 .remove = bfin_eval_adau1373_remove,
177}; 177};
178 178
179module_platform_driver(bfin_eval_adau1373_driver); 179module_platform_driver(bfin_eval_adau1373_driver);
diff --git a/sound/soc/blackfin/bfin-eval-adau1701.c b/sound/soc/blackfin/bfin-eval-adau1701.c
index b0531fc9d814..3b55081a96c0 100644
--- a/sound/soc/blackfin/bfin-eval-adau1701.c
+++ b/sound/soc/blackfin/bfin-eval-adau1701.c
@@ -97,7 +97,7 @@ static int bfin_eval_adau1701_probe(struct platform_device *pdev)
97 return snd_soc_register_card(&bfin_eval_adau1701); 97 return snd_soc_register_card(&bfin_eval_adau1701);
98} 98}
99 99
100static int __devexit bfin_eval_adau1701_remove(struct platform_device *pdev) 100static int bfin_eval_adau1701_remove(struct platform_device *pdev)
101{ 101{
102 struct snd_soc_card *card = platform_get_drvdata(pdev); 102 struct snd_soc_card *card = platform_get_drvdata(pdev);
103 103
@@ -113,7 +113,7 @@ static struct platform_driver bfin_eval_adau1701_driver = {
113 .pm = &snd_soc_pm_ops, 113 .pm = &snd_soc_pm_ops,
114 }, 114 },
115 .probe = bfin_eval_adau1701_probe, 115 .probe = bfin_eval_adau1701_probe,
116 .remove = __devexit_p(bfin_eval_adau1701_remove), 116 .remove = bfin_eval_adau1701_remove,
117}; 117};
118 118
119module_platform_driver(bfin_eval_adau1701_driver); 119module_platform_driver(bfin_eval_adau1701_driver);
diff --git a/sound/soc/blackfin/bfin-eval-adav80x.c b/sound/soc/blackfin/bfin-eval-adav80x.c
index 84b09987b7f3..3b1b61a44815 100644
--- a/sound/soc/blackfin/bfin-eval-adav80x.c
+++ b/sound/soc/blackfin/bfin-eval-adav80x.c
@@ -122,7 +122,7 @@ static int bfin_eval_adav80x_probe(struct platform_device *pdev)
122 return snd_soc_register_card(&bfin_eval_adav80x); 122 return snd_soc_register_card(&bfin_eval_adav80x);
123} 123}
124 124
125static int __devexit bfin_eval_adav80x_remove(struct platform_device *pdev) 125static int bfin_eval_adav80x_remove(struct platform_device *pdev)
126{ 126{
127 struct snd_soc_card *card = platform_get_drvdata(pdev); 127 struct snd_soc_card *card = platform_get_drvdata(pdev);
128 128
@@ -145,7 +145,7 @@ static struct platform_driver bfin_eval_adav80x_driver = {
145 .pm = &snd_soc_pm_ops, 145 .pm = &snd_soc_pm_ops,
146 }, 146 },
147 .probe = bfin_eval_adav80x_probe, 147 .probe = bfin_eval_adav80x_probe,
148 .remove = __devexit_p(bfin_eval_adav80x_remove), 148 .remove = bfin_eval_adav80x_remove,
149 .id_table = bfin_eval_adav80x_ids, 149 .id_table = bfin_eval_adav80x_ids,
150}; 150};
151 151
diff --git a/sound/soc/cirrus/edb93xx.c b/sound/soc/cirrus/edb93xx.c
index e01cb02abd3a..5db68cf7b281 100644
--- a/sound/soc/cirrus/edb93xx.c
+++ b/sound/soc/cirrus/edb93xx.c
@@ -80,7 +80,7 @@ static struct snd_soc_card snd_soc_edb93xx = {
80 .num_links = 1, 80 .num_links = 1,
81}; 81};
82 82
83static int __devinit edb93xx_probe(struct platform_device *pdev) 83static int edb93xx_probe(struct platform_device *pdev)
84{ 84{
85 struct snd_soc_card *card = &snd_soc_edb93xx; 85 struct snd_soc_card *card = &snd_soc_edb93xx;
86 int ret; 86 int ret;
@@ -101,7 +101,7 @@ static int __devinit edb93xx_probe(struct platform_device *pdev)
101 return ret; 101 return ret;
102} 102}
103 103
104static int __devexit edb93xx_remove(struct platform_device *pdev) 104static int edb93xx_remove(struct platform_device *pdev)
105{ 105{
106 struct snd_soc_card *card = platform_get_drvdata(pdev); 106 struct snd_soc_card *card = platform_get_drvdata(pdev);
107 107
@@ -117,7 +117,7 @@ static struct platform_driver edb93xx_driver = {
117 .owner = THIS_MODULE, 117 .owner = THIS_MODULE,
118 }, 118 },
119 .probe = edb93xx_probe, 119 .probe = edb93xx_probe,
120 .remove = __devexit_p(edb93xx_remove), 120 .remove = edb93xx_remove,
121}; 121};
122 122
123module_platform_driver(edb93xx_driver); 123module_platform_driver(edb93xx_driver);
diff --git a/sound/soc/cirrus/ep93xx-ac97.c b/sound/soc/cirrus/ep93xx-ac97.c
index c3521653cfd3..f3f50e6fd6eb 100644
--- a/sound/soc/cirrus/ep93xx-ac97.c
+++ b/sound/soc/cirrus/ep93xx-ac97.c
@@ -352,7 +352,7 @@ static struct snd_soc_dai_driver ep93xx_ac97_dai = {
352 .ops = &ep93xx_ac97_dai_ops, 352 .ops = &ep93xx_ac97_dai_ops,
353}; 353};
354 354
355static int __devinit ep93xx_ac97_probe(struct platform_device *pdev) 355static int ep93xx_ac97_probe(struct platform_device *pdev)
356{ 356{
357 struct ep93xx_ac97_info *info; 357 struct ep93xx_ac97_info *info;
358 struct resource *res; 358 struct resource *res;
@@ -402,7 +402,7 @@ fail:
402 return ret; 402 return ret;
403} 403}
404 404
405static int __devexit ep93xx_ac97_remove(struct platform_device *pdev) 405static int ep93xx_ac97_remove(struct platform_device *pdev)
406{ 406{
407 struct ep93xx_ac97_info *info = platform_get_drvdata(pdev); 407 struct ep93xx_ac97_info *info = platform_get_drvdata(pdev);
408 408
@@ -420,7 +420,7 @@ static int __devexit ep93xx_ac97_remove(struct platform_device *pdev)
420 420
421static struct platform_driver ep93xx_ac97_driver = { 421static struct platform_driver ep93xx_ac97_driver = {
422 .probe = ep93xx_ac97_probe, 422 .probe = ep93xx_ac97_probe,
423 .remove = __devexit_p(ep93xx_ac97_remove), 423 .remove = ep93xx_ac97_remove,
424 .driver = { 424 .driver = {
425 .name = "ep93xx-ac97", 425 .name = "ep93xx-ac97",
426 .owner = THIS_MODULE, 426 .owner = THIS_MODULE,
diff --git a/sound/soc/cirrus/ep93xx-i2s.c b/sound/soc/cirrus/ep93xx-i2s.c
index ac4a7515e7be..3365d4e843b7 100644
--- a/sound/soc/cirrus/ep93xx-i2s.c
+++ b/sound/soc/cirrus/ep93xx-i2s.c
@@ -422,7 +422,7 @@ fail:
422 return err; 422 return err;
423} 423}
424 424
425static int __devexit ep93xx_i2s_remove(struct platform_device *pdev) 425static int ep93xx_i2s_remove(struct platform_device *pdev)
426{ 426{
427 struct ep93xx_i2s_info *info = dev_get_drvdata(&pdev->dev); 427 struct ep93xx_i2s_info *info = dev_get_drvdata(&pdev->dev);
428 428
@@ -436,7 +436,7 @@ static int __devexit ep93xx_i2s_remove(struct platform_device *pdev)
436 436
437static struct platform_driver ep93xx_i2s_driver = { 437static struct platform_driver ep93xx_i2s_driver = {
438 .probe = ep93xx_i2s_probe, 438 .probe = ep93xx_i2s_probe,
439 .remove = __devexit_p(ep93xx_i2s_remove), 439 .remove = ep93xx_i2s_remove,
440 .driver = { 440 .driver = {
441 .name = "ep93xx-i2s", 441 .name = "ep93xx-i2s",
442 .owner = THIS_MODULE, 442 .owner = THIS_MODULE,
diff --git a/sound/soc/cirrus/ep93xx-pcm.c b/sound/soc/cirrus/ep93xx-pcm.c
index 665d9c94cc17..72eb7a49e16a 100644
--- a/sound/soc/cirrus/ep93xx-pcm.c
+++ b/sound/soc/cirrus/ep93xx-pcm.c
@@ -213,12 +213,12 @@ static struct snd_soc_platform_driver ep93xx_soc_platform = {
213 .pcm_free = &ep93xx_pcm_free_dma_buffers, 213 .pcm_free = &ep93xx_pcm_free_dma_buffers,
214}; 214};
215 215
216static int __devinit ep93xx_soc_platform_probe(struct platform_device *pdev) 216static int ep93xx_soc_platform_probe(struct platform_device *pdev)
217{ 217{
218 return snd_soc_register_platform(&pdev->dev, &ep93xx_soc_platform); 218 return snd_soc_register_platform(&pdev->dev, &ep93xx_soc_platform);
219} 219}
220 220
221static int __devexit ep93xx_soc_platform_remove(struct platform_device *pdev) 221static int ep93xx_soc_platform_remove(struct platform_device *pdev)
222{ 222{
223 snd_soc_unregister_platform(&pdev->dev); 223 snd_soc_unregister_platform(&pdev->dev);
224 return 0; 224 return 0;
@@ -231,7 +231,7 @@ static struct platform_driver ep93xx_pcm_driver = {
231 }, 231 },
232 232
233 .probe = ep93xx_soc_platform_probe, 233 .probe = ep93xx_soc_platform_probe,
234 .remove = __devexit_p(ep93xx_soc_platform_remove), 234 .remove = ep93xx_soc_platform_remove,
235}; 235};
236 236
237module_platform_driver(ep93xx_pcm_driver); 237module_platform_driver(ep93xx_pcm_driver);
diff --git a/sound/soc/cirrus/simone.c b/sound/soc/cirrus/simone.c
index dd997094eb30..a397bb0d8179 100644
--- a/sound/soc/cirrus/simone.c
+++ b/sound/soc/cirrus/simone.c
@@ -41,7 +41,7 @@ static struct snd_soc_card snd_soc_simone = {
41 41
42static struct platform_device *simone_snd_ac97_device; 42static struct platform_device *simone_snd_ac97_device;
43 43
44static int __devinit simone_probe(struct platform_device *pdev) 44static int simone_probe(struct platform_device *pdev)
45{ 45{
46 struct snd_soc_card *card = &snd_soc_simone; 46 struct snd_soc_card *card = &snd_soc_simone;
47 int ret; 47 int ret;
@@ -63,7 +63,7 @@ static int __devinit simone_probe(struct platform_device *pdev)
63 return ret; 63 return ret;
64} 64}
65 65
66static int __devexit simone_remove(struct platform_device *pdev) 66static int simone_remove(struct platform_device *pdev)
67{ 67{
68 struct snd_soc_card *card = platform_get_drvdata(pdev); 68 struct snd_soc_card *card = platform_get_drvdata(pdev);
69 69
@@ -79,7 +79,7 @@ static struct platform_driver simone_driver = {
79 .owner = THIS_MODULE, 79 .owner = THIS_MODULE,
80 }, 80 },
81 .probe = simone_probe, 81 .probe = simone_probe,
82 .remove = __devexit_p(simone_remove), 82 .remove = simone_remove,
83}; 83};
84 84
85module_platform_driver(simone_driver); 85module_platform_driver(simone_driver);
diff --git a/sound/soc/cirrus/snappercl15.c b/sound/soc/cirrus/snappercl15.c
index a193cea3cf3c..9d77fe28dfcc 100644
--- a/sound/soc/cirrus/snappercl15.c
+++ b/sound/soc/cirrus/snappercl15.c
@@ -98,7 +98,7 @@ static struct snd_soc_card snd_soc_snappercl15 = {
98 .num_links = 1, 98 .num_links = 1,
99}; 99};
100 100
101static int __devinit snappercl15_probe(struct platform_device *pdev) 101static int snappercl15_probe(struct platform_device *pdev)
102{ 102{
103 struct snd_soc_card *card = &snd_soc_snappercl15; 103 struct snd_soc_card *card = &snd_soc_snappercl15;
104 int ret; 104 int ret;
@@ -119,7 +119,7 @@ static int __devinit snappercl15_probe(struct platform_device *pdev)
119 return ret; 119 return ret;
120} 120}
121 121
122static int __devexit snappercl15_remove(struct platform_device *pdev) 122static int snappercl15_remove(struct platform_device *pdev)
123{ 123{
124 struct snd_soc_card *card = platform_get_drvdata(pdev); 124 struct snd_soc_card *card = platform_get_drvdata(pdev);
125 125
@@ -135,7 +135,7 @@ static struct platform_driver snappercl15_driver = {
135 .owner = THIS_MODULE, 135 .owner = THIS_MODULE,
136 }, 136 },
137 .probe = snappercl15_probe, 137 .probe = snappercl15_probe,
138 .remove = __devexit_p(snappercl15_remove), 138 .remove = snappercl15_remove,
139}; 139};
140 140
141module_platform_driver(snappercl15_driver); 141module_platform_driver(snappercl15_driver);
diff --git a/sound/soc/codecs/88pm860x-codec.c b/sound/soc/codecs/88pm860x-codec.c
index 9fd3b6827bba..60159c07448d 100644
--- a/sound/soc/codecs/88pm860x-codec.c
+++ b/sound/soc/codecs/88pm860x-codec.c
@@ -1423,7 +1423,7 @@ static struct snd_soc_codec_driver soc_codec_dev_pm860x = {
1423 .num_dapm_routes = ARRAY_SIZE(pm860x_dapm_routes), 1423 .num_dapm_routes = ARRAY_SIZE(pm860x_dapm_routes),
1424}; 1424};
1425 1425
1426static int __devinit pm860x_codec_probe(struct platform_device *pdev) 1426static int pm860x_codec_probe(struct platform_device *pdev)
1427{ 1427{
1428 struct pm860x_chip *chip = dev_get_drvdata(pdev->dev.parent); 1428 struct pm860x_chip *chip = dev_get_drvdata(pdev->dev.parent);
1429 struct pm860x_priv *pm860x; 1429 struct pm860x_priv *pm860x;
@@ -1463,7 +1463,7 @@ out:
1463 return -EINVAL; 1463 return -EINVAL;
1464} 1464}
1465 1465
1466static int __devexit pm860x_codec_remove(struct platform_device *pdev) 1466static int pm860x_codec_remove(struct platform_device *pdev)
1467{ 1467{
1468 snd_soc_unregister_codec(&pdev->dev); 1468 snd_soc_unregister_codec(&pdev->dev);
1469 platform_set_drvdata(pdev, NULL); 1469 platform_set_drvdata(pdev, NULL);
@@ -1476,7 +1476,7 @@ static struct platform_driver pm860x_codec_driver = {
1476 .owner = THIS_MODULE, 1476 .owner = THIS_MODULE,
1477 }, 1477 },
1478 .probe = pm860x_codec_probe, 1478 .probe = pm860x_codec_probe,
1479 .remove = __devexit_p(pm860x_codec_remove), 1479 .remove = pm860x_codec_remove,
1480}; 1480};
1481 1481
1482module_platform_driver(pm860x_codec_driver); 1482module_platform_driver(pm860x_codec_driver);
diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
index b92759a39361..3a847828932a 100644
--- a/sound/soc/codecs/Kconfig
+++ b/sound/soc/codecs/Kconfig
@@ -44,6 +44,7 @@ config SND_SOC_ALL_CODECS
44 select SND_SOC_LM4857 if I2C 44 select SND_SOC_LM4857 if I2C
45 select SND_SOC_LM49453 if I2C 45 select SND_SOC_LM49453 if I2C
46 select SND_SOC_MAX98088 if I2C 46 select SND_SOC_MAX98088 if I2C
47 select SND_SOC_MAX98090 if I2C
47 select SND_SOC_MAX98095 if I2C 48 select SND_SOC_MAX98095 if I2C
48 select SND_SOC_MAX9850 if I2C 49 select SND_SOC_MAX9850 if I2C
49 select SND_SOC_MAX9768 if I2C 50 select SND_SOC_MAX9768 if I2C
@@ -54,6 +55,7 @@ config SND_SOC_ALL_CODECS
54 select SND_SOC_PCM3008 55 select SND_SOC_PCM3008
55 select SND_SOC_RT5631 if I2C 56 select SND_SOC_RT5631 if I2C
56 select SND_SOC_SGTL5000 if I2C 57 select SND_SOC_SGTL5000 if I2C
58 select SND_SOC_SI476X if MFD_SI476X_CORE
57 select SND_SOC_SN95031 if INTEL_SCU_IPC 59 select SND_SOC_SN95031 if INTEL_SCU_IPC
58 select SND_SOC_SPDIF 60 select SND_SOC_SPDIF
59 select SND_SOC_SSM2602 if SND_SOC_I2C_AND_SPI 61 select SND_SOC_SSM2602 if SND_SOC_I2C_AND_SPI
@@ -146,6 +148,13 @@ config SND_SOC_WM_HUBS
146 default y if SND_SOC_WM8993=y || SND_SOC_WM8994=y 148 default y if SND_SOC_WM8993=y || SND_SOC_WM8994=y
147 default m if SND_SOC_WM8993=m || SND_SOC_WM8994=m 149 default m if SND_SOC_WM8993=m || SND_SOC_WM8994=m
148 150
151config SND_SOC_WM_ADSP
152 tristate
153 default y if SND_SOC_WM5102=y
154 default y if SND_SOC_WM2200=y
155 default m if SND_SOC_WM5102=m
156 default m if SND_SOC_WM2200=m
157
149config SND_SOC_AB8500_CODEC 158config SND_SOC_AB8500_CODEC
150 tristate 159 tristate
151 160
@@ -229,6 +238,7 @@ config SND_SOC_CX20442
229 tristate 238 tristate
230 239
231config SND_SOC_JZ4740_CODEC 240config SND_SOC_JZ4740_CODEC
241 select REGMAP_MMIO
232 tristate 242 tristate
233 243
234config SND_SOC_L3 244config SND_SOC_L3
@@ -258,6 +268,9 @@ config SND_SOC_LM49453
258config SND_SOC_MAX98088 268config SND_SOC_MAX98088
259 tristate 269 tristate
260 270
271config SND_SOC_MAX98090
272 tristate
273
261config SND_SOC_MAX98095 274config SND_SOC_MAX98095
262 tristate 275 tristate
263 276
@@ -277,6 +290,9 @@ config SND_SOC_RT5631
277config SND_SOC_SGTL5000 290config SND_SOC_SGTL5000
278 tristate 291 tristate
279 292
293config SND_SOC_SI476X
294 tristate
295
280config SND_SOC_SIGMADSP 296config SND_SOC_SIGMADSP
281 tristate 297 tristate
282 select CRC32 298 select CRC32
diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile
index 9bd4d95aab4f..f6e8e36cceb7 100644
--- a/sound/soc/codecs/Makefile
+++ b/sound/soc/codecs/Makefile
@@ -34,6 +34,7 @@ snd-soc-lm4857-objs := lm4857.o
34snd-soc-lm49453-objs := lm49453.o 34snd-soc-lm49453-objs := lm49453.o
35snd-soc-max9768-objs := max9768.o 35snd-soc-max9768-objs := max9768.o
36snd-soc-max98088-objs := max98088.o 36snd-soc-max98088-objs := max98088.o
37snd-soc-max98090-objs := max98090.o
37snd-soc-max98095-objs := max98095.o 38snd-soc-max98095-objs := max98095.o
38snd-soc-max9850-objs := max9850.o 39snd-soc-max9850-objs := max9850.o
39snd-soc-mc13783-objs := mc13783.o 40snd-soc-mc13783-objs := mc13783.o
@@ -45,6 +46,7 @@ snd-soc-sgtl5000-objs := sgtl5000.o
45snd-soc-alc5623-objs := alc5623.o 46snd-soc-alc5623-objs := alc5623.o
46snd-soc-alc5632-objs := alc5632.o 47snd-soc-alc5632-objs := alc5632.o
47snd-soc-sigmadsp-objs := sigmadsp.o 48snd-soc-sigmadsp-objs := sigmadsp.o
49snd-soc-si476x-objs := si476x.o
48snd-soc-sn95031-objs := sn95031.o 50snd-soc-sn95031-objs := sn95031.o
49snd-soc-spdif-tx-objs := spdif_transciever.o 51snd-soc-spdif-tx-objs := spdif_transciever.o
50snd-soc-spdif-rx-objs := spdif_receiver.o 52snd-soc-spdif-rx-objs := spdif_receiver.o
@@ -62,6 +64,7 @@ snd-soc-twl6040-objs := twl6040.o
62snd-soc-uda134x-objs := uda134x.o 64snd-soc-uda134x-objs := uda134x.o
63snd-soc-uda1380-objs := uda1380.o 65snd-soc-uda1380-objs := uda1380.o
64snd-soc-wl1273-objs := wl1273.o 66snd-soc-wl1273-objs := wl1273.o
67snd-soc-wm-adsp-objs := wm_adsp.o
65snd-soc-wm0010-objs := wm0010.o 68snd-soc-wm0010-objs := wm0010.o
66snd-soc-wm1250-ev1-objs := wm1250-ev1.o 69snd-soc-wm1250-ev1-objs := wm1250-ev1.o
67snd-soc-wm2000-objs := wm2000.o 70snd-soc-wm2000-objs := wm2000.o
@@ -155,6 +158,7 @@ obj-$(CONFIG_SND_SOC_LM4857) += snd-soc-lm4857.o
155obj-$(CONFIG_SND_SOC_LM49453) += snd-soc-lm49453.o 158obj-$(CONFIG_SND_SOC_LM49453) += snd-soc-lm49453.o
156obj-$(CONFIG_SND_SOC_MAX9768) += snd-soc-max9768.o 159obj-$(CONFIG_SND_SOC_MAX9768) += snd-soc-max9768.o
157obj-$(CONFIG_SND_SOC_MAX98088) += snd-soc-max98088.o 160obj-$(CONFIG_SND_SOC_MAX98088) += snd-soc-max98088.o
161obj-$(CONFIG_SND_SOC_MAX98090) += snd-soc-max98090.o
158obj-$(CONFIG_SND_SOC_MAX98095) += snd-soc-max98095.o 162obj-$(CONFIG_SND_SOC_MAX98095) += snd-soc-max98095.o
159obj-$(CONFIG_SND_SOC_MAX9850) += snd-soc-max9850.o 163obj-$(CONFIG_SND_SOC_MAX9850) += snd-soc-max9850.o
160obj-$(CONFIG_SND_SOC_MC13783) += snd-soc-mc13783.o 164obj-$(CONFIG_SND_SOC_MC13783) += snd-soc-mc13783.o
@@ -164,6 +168,7 @@ obj-$(CONFIG_SND_SOC_PCM3008) += snd-soc-pcm3008.o
164obj-$(CONFIG_SND_SOC_RT5631) += snd-soc-rt5631.o 168obj-$(CONFIG_SND_SOC_RT5631) += snd-soc-rt5631.o
165obj-$(CONFIG_SND_SOC_SGTL5000) += snd-soc-sgtl5000.o 169obj-$(CONFIG_SND_SOC_SGTL5000) += snd-soc-sgtl5000.o
166obj-$(CONFIG_SND_SOC_SIGMADSP) += snd-soc-sigmadsp.o 170obj-$(CONFIG_SND_SOC_SIGMADSP) += snd-soc-sigmadsp.o
171obj-$(CONFIG_SND_SOC_SI476X) += snd-soc-si476x.o
167obj-$(CONFIG_SND_SOC_SN95031) +=snd-soc-sn95031.o 172obj-$(CONFIG_SND_SOC_SN95031) +=snd-soc-sn95031.o
168obj-$(CONFIG_SND_SOC_SPDIF) += snd-soc-spdif-rx.o snd-soc-spdif-tx.o 173obj-$(CONFIG_SND_SOC_SPDIF) += snd-soc-spdif-rx.o snd-soc-spdif-tx.o
169obj-$(CONFIG_SND_SOC_SSM2602) += snd-soc-ssm2602.o 174obj-$(CONFIG_SND_SOC_SSM2602) += snd-soc-ssm2602.o
@@ -229,6 +234,7 @@ obj-$(CONFIG_SND_SOC_WM9090) += snd-soc-wm9090.o
229obj-$(CONFIG_SND_SOC_WM9705) += snd-soc-wm9705.o 234obj-$(CONFIG_SND_SOC_WM9705) += snd-soc-wm9705.o
230obj-$(CONFIG_SND_SOC_WM9712) += snd-soc-wm9712.o 235obj-$(CONFIG_SND_SOC_WM9712) += snd-soc-wm9712.o
231obj-$(CONFIG_SND_SOC_WM9713) += snd-soc-wm9713.o 236obj-$(CONFIG_SND_SOC_WM9713) += snd-soc-wm9713.o
237obj-$(CONFIG_SND_SOC_WM_ADSP) += snd-soc-wm-adsp.o
232obj-$(CONFIG_SND_SOC_WM_HUBS) += snd-soc-wm-hubs.o 238obj-$(CONFIG_SND_SOC_WM_HUBS) += snd-soc-wm-hubs.o
233 239
234# Amp 240# Amp
diff --git a/sound/soc/codecs/ab8500-codec.c b/sound/soc/codecs/ab8500-codec.c
index af547490b4f7..6c12ac206ee9 100644
--- a/sound/soc/codecs/ab8500-codec.c
+++ b/sound/soc/codecs/ab8500-codec.c
@@ -2356,7 +2356,7 @@ static int ab8500_codec_set_dai_tdm_slot(struct snd_soc_dai *dai,
2356 return 0; 2356 return 0;
2357} 2357}
2358 2358
2359struct snd_soc_dai_driver ab8500_codec_dai[] = { 2359static struct snd_soc_dai_driver ab8500_codec_dai[] = {
2360 { 2360 {
2361 .name = "ab8500-codec-dai.0", 2361 .name = "ab8500-codec-dai.0",
2362 .id = 0, 2362 .id = 0,
@@ -2554,7 +2554,7 @@ static struct snd_soc_codec_driver ab8500_codec_driver = {
2554 .num_dapm_routes = ARRAY_SIZE(ab8500_dapm_routes), 2554 .num_dapm_routes = ARRAY_SIZE(ab8500_dapm_routes),
2555}; 2555};
2556 2556
2557static int __devinit ab8500_codec_driver_probe(struct platform_device *pdev) 2557static int ab8500_codec_driver_probe(struct platform_device *pdev)
2558{ 2558{
2559 int status; 2559 int status;
2560 struct ab8500_codec_drvdata *drvdata; 2560 struct ab8500_codec_drvdata *drvdata;
@@ -2580,7 +2580,7 @@ static int __devinit ab8500_codec_driver_probe(struct platform_device *pdev)
2580 return status; 2580 return status;
2581} 2581}
2582 2582
2583static int __devexit ab8500_codec_driver_remove(struct platform_device *pdev) 2583static int ab8500_codec_driver_remove(struct platform_device *pdev)
2584{ 2584{
2585 dev_info(&pdev->dev, "%s Enter.\n", __func__); 2585 dev_info(&pdev->dev, "%s Enter.\n", __func__);
2586 2586
@@ -2595,7 +2595,7 @@ static struct platform_driver ab8500_codec_platform_driver = {
2595 .owner = THIS_MODULE, 2595 .owner = THIS_MODULE,
2596 }, 2596 },
2597 .probe = ab8500_codec_driver_probe, 2597 .probe = ab8500_codec_driver_probe,
2598 .remove = __devexit_p(ab8500_codec_driver_remove), 2598 .remove = ab8500_codec_driver_remove,
2599 .suspend = NULL, 2599 .suspend = NULL,
2600 .resume = NULL, 2600 .resume = NULL,
2601}; 2601};
diff --git a/sound/soc/codecs/ac97.c b/sound/soc/codecs/ac97.c
index ea06b834a7de..ef2ae32ffc66 100644
--- a/sound/soc/codecs/ac97.c
+++ b/sound/soc/codecs/ac97.c
@@ -118,13 +118,13 @@ static struct snd_soc_codec_driver soc_codec_dev_ac97 = {
118 .resume = ac97_soc_resume, 118 .resume = ac97_soc_resume,
119}; 119};
120 120
121static __devinit int ac97_probe(struct platform_device *pdev) 121static int ac97_probe(struct platform_device *pdev)
122{ 122{
123 return snd_soc_register_codec(&pdev->dev, 123 return snd_soc_register_codec(&pdev->dev,
124 &soc_codec_dev_ac97, &ac97_dai, 1); 124 &soc_codec_dev_ac97, &ac97_dai, 1);
125} 125}
126 126
127static int __devexit ac97_remove(struct platform_device *pdev) 127static int ac97_remove(struct platform_device *pdev)
128{ 128{
129 snd_soc_unregister_codec(&pdev->dev); 129 snd_soc_unregister_codec(&pdev->dev);
130 return 0; 130 return 0;
@@ -137,7 +137,7 @@ static struct platform_driver ac97_codec_driver = {
137 }, 137 },
138 138
139 .probe = ac97_probe, 139 .probe = ac97_probe,
140 .remove = __devexit_p(ac97_remove), 140 .remove = ac97_remove,
141}; 141};
142 142
143module_platform_driver(ac97_codec_driver); 143module_platform_driver(ac97_codec_driver);
diff --git a/sound/soc/codecs/ad1836.c b/sound/soc/codecs/ad1836.c
index dce6ebeef452..9a92b7962f41 100644
--- a/sound/soc/codecs/ad1836.c
+++ b/sound/soc/codecs/ad1836.c
@@ -360,7 +360,7 @@ static const struct regmap_config ad1836_regmap_config = {
360 .cache_type = REGCACHE_RBTREE, 360 .cache_type = REGCACHE_RBTREE,
361}; 361};
362 362
363static int __devinit ad1836_spi_probe(struct spi_device *spi) 363static int ad1836_spi_probe(struct spi_device *spi)
364{ 364{
365 struct ad1836_priv *ad1836; 365 struct ad1836_priv *ad1836;
366 int ret; 366 int ret;
@@ -383,7 +383,7 @@ static int __devinit ad1836_spi_probe(struct spi_device *spi)
383 return ret; 383 return ret;
384} 384}
385 385
386static int __devexit ad1836_spi_remove(struct spi_device *spi) 386static int ad1836_spi_remove(struct spi_device *spi)
387{ 387{
388 snd_soc_unregister_codec(&spi->dev); 388 snd_soc_unregister_codec(&spi->dev);
389 return 0; 389 return 0;
@@ -405,7 +405,7 @@ static struct spi_driver ad1836_spi_driver = {
405 .owner = THIS_MODULE, 405 .owner = THIS_MODULE,
406 }, 406 },
407 .probe = ad1836_spi_probe, 407 .probe = ad1836_spi_probe,
408 .remove = __devexit_p(ad1836_spi_remove), 408 .remove = ad1836_spi_remove,
409 .id_table = ad1836_ids, 409 .id_table = ad1836_ids,
410}; 410};
411 411
diff --git a/sound/soc/codecs/ad193x.c b/sound/soc/codecs/ad193x.c
index 2f752660f678..aea7e52cf714 100644
--- a/sound/soc/codecs/ad193x.c
+++ b/sound/soc/codecs/ad193x.c
@@ -378,7 +378,7 @@ static const struct regmap_config ad193x_spi_regmap_config = {
378 .volatile_reg = adau193x_reg_volatile, 378 .volatile_reg = adau193x_reg_volatile,
379}; 379};
380 380
381static int __devinit ad193x_spi_probe(struct spi_device *spi) 381static int ad193x_spi_probe(struct spi_device *spi)
382{ 382{
383 struct ad193x_priv *ad193x; 383 struct ad193x_priv *ad193x;
384 384
@@ -397,7 +397,7 @@ static int __devinit ad193x_spi_probe(struct spi_device *spi)
397 &ad193x_dai, 1); 397 &ad193x_dai, 1);
398} 398}
399 399
400static int __devexit ad193x_spi_remove(struct spi_device *spi) 400static int ad193x_spi_remove(struct spi_device *spi)
401{ 401{
402 snd_soc_unregister_codec(&spi->dev); 402 snd_soc_unregister_codec(&spi->dev);
403 return 0; 403 return 0;
@@ -409,7 +409,7 @@ static struct spi_driver ad193x_spi_driver = {
409 .owner = THIS_MODULE, 409 .owner = THIS_MODULE,
410 }, 410 },
411 .probe = ad193x_spi_probe, 411 .probe = ad193x_spi_probe,
412 .remove = __devexit_p(ad193x_spi_remove), 412 .remove = ad193x_spi_remove,
413}; 413};
414#endif 414#endif
415 415
@@ -430,8 +430,8 @@ static const struct i2c_device_id ad193x_id[] = {
430}; 430};
431MODULE_DEVICE_TABLE(i2c, ad193x_id); 431MODULE_DEVICE_TABLE(i2c, ad193x_id);
432 432
433static int __devinit ad193x_i2c_probe(struct i2c_client *client, 433static int ad193x_i2c_probe(struct i2c_client *client,
434 const struct i2c_device_id *id) 434 const struct i2c_device_id *id)
435{ 435{
436 struct ad193x_priv *ad193x; 436 struct ad193x_priv *ad193x;
437 437
@@ -450,7 +450,7 @@ static int __devinit ad193x_i2c_probe(struct i2c_client *client,
450 &ad193x_dai, 1); 450 &ad193x_dai, 1);
451} 451}
452 452
453static int __devexit ad193x_i2c_remove(struct i2c_client *client) 453static int ad193x_i2c_remove(struct i2c_client *client)
454{ 454{
455 snd_soc_unregister_codec(&client->dev); 455 snd_soc_unregister_codec(&client->dev);
456 return 0; 456 return 0;
@@ -461,7 +461,7 @@ static struct i2c_driver ad193x_i2c_driver = {
461 .name = "ad193x", 461 .name = "ad193x",
462 }, 462 },
463 .probe = ad193x_i2c_probe, 463 .probe = ad193x_i2c_probe,
464 .remove = __devexit_p(ad193x_i2c_remove), 464 .remove = ad193x_i2c_remove,
465 .id_table = ad193x_id, 465 .id_table = ad193x_id,
466}; 466};
467#endif 467#endif
diff --git a/sound/soc/codecs/ad1980.c b/sound/soc/codecs/ad1980.c
index 8c39dddd7d00..f385342947d3 100644
--- a/sound/soc/codecs/ad1980.c
+++ b/sound/soc/codecs/ad1980.c
@@ -255,13 +255,13 @@ static struct snd_soc_codec_driver soc_codec_dev_ad1980 = {
255 .read = ac97_read, 255 .read = ac97_read,
256}; 256};
257 257
258static __devinit int ad1980_probe(struct platform_device *pdev) 258static int ad1980_probe(struct platform_device *pdev)
259{ 259{
260 return snd_soc_register_codec(&pdev->dev, 260 return snd_soc_register_codec(&pdev->dev,
261 &soc_codec_dev_ad1980, &ad1980_dai, 1); 261 &soc_codec_dev_ad1980, &ad1980_dai, 1);
262} 262}
263 263
264static int __devexit ad1980_remove(struct platform_device *pdev) 264static int ad1980_remove(struct platform_device *pdev)
265{ 265{
266 snd_soc_unregister_codec(&pdev->dev); 266 snd_soc_unregister_codec(&pdev->dev);
267 return 0; 267 return 0;
@@ -274,7 +274,7 @@ static struct platform_driver ad1980_codec_driver = {
274 }, 274 },
275 275
276 .probe = ad1980_probe, 276 .probe = ad1980_probe,
277 .remove = __devexit_p(ad1980_remove), 277 .remove = ad1980_remove,
278}; 278};
279 279
280module_platform_driver(ad1980_codec_driver); 280module_platform_driver(ad1980_codec_driver);
diff --git a/sound/soc/codecs/ad73311.c b/sound/soc/codecs/ad73311.c
index ee7a68dcefd2..b1f2baf42b48 100644
--- a/sound/soc/codecs/ad73311.c
+++ b/sound/soc/codecs/ad73311.c
@@ -47,7 +47,7 @@ static int ad73311_probe(struct platform_device *pdev)
47 &soc_codec_dev_ad73311, &ad73311_dai, 1); 47 &soc_codec_dev_ad73311, &ad73311_dai, 1);
48} 48}
49 49
50static int __devexit ad73311_remove(struct platform_device *pdev) 50static int ad73311_remove(struct platform_device *pdev)
51{ 51{
52 snd_soc_unregister_codec(&pdev->dev); 52 snd_soc_unregister_codec(&pdev->dev);
53 return 0; 53 return 0;
@@ -60,7 +60,7 @@ static struct platform_driver ad73311_codec_driver = {
60 }, 60 },
61 61
62 .probe = ad73311_probe, 62 .probe = ad73311_probe,
63 .remove = __devexit_p(ad73311_remove), 63 .remove = ad73311_remove,
64}; 64};
65 65
66module_platform_driver(ad73311_codec_driver); 66module_platform_driver(ad73311_codec_driver);
diff --git a/sound/soc/codecs/adau1373.c b/sound/soc/codecs/adau1373.c
index 704544bfc90d..068b3ae56a17 100644
--- a/sound/soc/codecs/adau1373.c
+++ b/sound/soc/codecs/adau1373.c
@@ -1353,8 +1353,8 @@ static struct snd_soc_codec_driver adau1373_codec_driver = {
1353 .num_dapm_routes = ARRAY_SIZE(adau1373_dapm_routes), 1353 .num_dapm_routes = ARRAY_SIZE(adau1373_dapm_routes),
1354}; 1354};
1355 1355
1356static int __devinit adau1373_i2c_probe(struct i2c_client *client, 1356static int adau1373_i2c_probe(struct i2c_client *client,
1357 const struct i2c_device_id *id) 1357 const struct i2c_device_id *id)
1358{ 1358{
1359 struct adau1373 *adau1373; 1359 struct adau1373 *adau1373;
1360 int ret; 1360 int ret;
@@ -1370,7 +1370,7 @@ static int __devinit adau1373_i2c_probe(struct i2c_client *client,
1370 return ret; 1370 return ret;
1371} 1371}
1372 1372
1373static int __devexit adau1373_i2c_remove(struct i2c_client *client) 1373static int adau1373_i2c_remove(struct i2c_client *client)
1374{ 1374{
1375 snd_soc_unregister_codec(&client->dev); 1375 snd_soc_unregister_codec(&client->dev);
1376 return 0; 1376 return 0;
@@ -1388,7 +1388,7 @@ static struct i2c_driver adau1373_i2c_driver = {
1388 .owner = THIS_MODULE, 1388 .owner = THIS_MODULE,
1389 }, 1389 },
1390 .probe = adau1373_i2c_probe, 1390 .probe = adau1373_i2c_probe,
1391 .remove = __devexit_p(adau1373_i2c_remove), 1391 .remove = adau1373_i2c_remove,
1392 .id_table = adau1373_i2c_id, 1392 .id_table = adau1373_i2c_id,
1393}; 1393};
1394 1394
diff --git a/sound/soc/codecs/adau1701.c b/sound/soc/codecs/adau1701.c
index 51f2f3cd8136..dafdbe87edeb 100644
--- a/sound/soc/codecs/adau1701.c
+++ b/sound/soc/codecs/adau1701.c
@@ -489,8 +489,8 @@ static struct snd_soc_codec_driver adau1701_codec_drv = {
489 .set_sysclk = adau1701_set_sysclk, 489 .set_sysclk = adau1701_set_sysclk,
490}; 490};
491 491
492static __devinit int adau1701_i2c_probe(struct i2c_client *client, 492static int adau1701_i2c_probe(struct i2c_client *client,
493 const struct i2c_device_id *id) 493 const struct i2c_device_id *id)
494{ 494{
495 struct adau1701 *adau1701; 495 struct adau1701 *adau1701;
496 int ret; 496 int ret;
@@ -505,7 +505,7 @@ static __devinit int adau1701_i2c_probe(struct i2c_client *client,
505 return ret; 505 return ret;
506} 506}
507 507
508static __devexit int adau1701_i2c_remove(struct i2c_client *client) 508static int adau1701_i2c_remove(struct i2c_client *client)
509{ 509{
510 snd_soc_unregister_codec(&client->dev); 510 snd_soc_unregister_codec(&client->dev);
511 return 0; 511 return 0;
@@ -523,7 +523,7 @@ static struct i2c_driver adau1701_i2c_driver = {
523 .owner = THIS_MODULE, 523 .owner = THIS_MODULE,
524 }, 524 },
525 .probe = adau1701_i2c_probe, 525 .probe = adau1701_i2c_probe,
526 .remove = __devexit_p(adau1701_i2c_remove), 526 .remove = adau1701_i2c_remove,
527 .id_table = adau1701_i2c_id, 527 .id_table = adau1701_i2c_id,
528}; 528};
529 529
diff --git a/sound/soc/codecs/adav80x.c b/sound/soc/codecs/adav80x.c
index ebd7b37b902b..3c839cc4e00e 100644
--- a/sound/soc/codecs/adav80x.c
+++ b/sound/soc/codecs/adav80x.c
@@ -839,8 +839,8 @@ static struct snd_soc_codec_driver adav80x_codec_driver = {
839 .num_dapm_routes = ARRAY_SIZE(adav80x_dapm_routes), 839 .num_dapm_routes = ARRAY_SIZE(adav80x_dapm_routes),
840}; 840};
841 841
842static int __devinit adav80x_bus_probe(struct device *dev, 842static int adav80x_bus_probe(struct device *dev,
843 enum snd_soc_control_type control_type) 843 enum snd_soc_control_type control_type)
844{ 844{
845 struct adav80x *adav80x; 845 struct adav80x *adav80x;
846 int ret; 846 int ret;
@@ -860,7 +860,7 @@ static int __devinit adav80x_bus_probe(struct device *dev,
860 return ret; 860 return ret;
861} 861}
862 862
863static int __devexit adav80x_bus_remove(struct device *dev) 863static int adav80x_bus_remove(struct device *dev)
864{ 864{
865 snd_soc_unregister_codec(dev); 865 snd_soc_unregister_codec(dev);
866 kfree(dev_get_drvdata(dev)); 866 kfree(dev_get_drvdata(dev));
@@ -868,12 +868,12 @@ static int __devexit adav80x_bus_remove(struct device *dev)
868} 868}
869 869
870#if defined(CONFIG_SPI_MASTER) 870#if defined(CONFIG_SPI_MASTER)
871static int __devinit adav80x_spi_probe(struct spi_device *spi) 871static int adav80x_spi_probe(struct spi_device *spi)
872{ 872{
873 return adav80x_bus_probe(&spi->dev, SND_SOC_SPI); 873 return adav80x_bus_probe(&spi->dev, SND_SOC_SPI);
874} 874}
875 875
876static int __devexit adav80x_spi_remove(struct spi_device *spi) 876static int adav80x_spi_remove(struct spi_device *spi)
877{ 877{
878 return adav80x_bus_remove(&spi->dev); 878 return adav80x_bus_remove(&spi->dev);
879} 879}
@@ -884,7 +884,7 @@ static struct spi_driver adav80x_spi_driver = {
884 .owner = THIS_MODULE, 884 .owner = THIS_MODULE,
885 }, 885 },
886 .probe = adav80x_spi_probe, 886 .probe = adav80x_spi_probe,
887 .remove = __devexit_p(adav80x_spi_remove), 887 .remove = adav80x_spi_remove,
888}; 888};
889#endif 889#endif
890 890
@@ -895,13 +895,13 @@ static const struct i2c_device_id adav80x_id[] = {
895}; 895};
896MODULE_DEVICE_TABLE(i2c, adav80x_id); 896MODULE_DEVICE_TABLE(i2c, adav80x_id);
897 897
898static int __devinit adav80x_i2c_probe(struct i2c_client *client, 898static int adav80x_i2c_probe(struct i2c_client *client,
899 const struct i2c_device_id *id) 899 const struct i2c_device_id *id)
900{ 900{
901 return adav80x_bus_probe(&client->dev, SND_SOC_I2C); 901 return adav80x_bus_probe(&client->dev, SND_SOC_I2C);
902} 902}
903 903
904static int __devexit adav80x_i2c_remove(struct i2c_client *client) 904static int adav80x_i2c_remove(struct i2c_client *client)
905{ 905{
906 return adav80x_bus_remove(&client->dev); 906 return adav80x_bus_remove(&client->dev);
907} 907}
@@ -912,7 +912,7 @@ static struct i2c_driver adav80x_i2c_driver = {
912 .owner = THIS_MODULE, 912 .owner = THIS_MODULE,
913 }, 913 },
914 .probe = adav80x_i2c_probe, 914 .probe = adav80x_i2c_probe,
915 .remove = __devexit_p(adav80x_i2c_remove), 915 .remove = adav80x_i2c_remove,
916 .id_table = adav80x_id, 916 .id_table = adav80x_id,
917}; 917};
918#endif 918#endif
diff --git a/sound/soc/codecs/ads117x.c b/sound/soc/codecs/ads117x.c
index 8103b938b8c0..506d474c4d22 100644
--- a/sound/soc/codecs/ads117x.c
+++ b/sound/soc/codecs/ads117x.c
@@ -36,13 +36,13 @@ static struct snd_soc_dai_driver ads117x_dai = {
36 36
37static struct snd_soc_codec_driver soc_codec_dev_ads117x; 37static struct snd_soc_codec_driver soc_codec_dev_ads117x;
38 38
39static __devinit int ads117x_probe(struct platform_device *pdev) 39static int ads117x_probe(struct platform_device *pdev)
40{ 40{
41 return snd_soc_register_codec(&pdev->dev, 41 return snd_soc_register_codec(&pdev->dev,
42 &soc_codec_dev_ads117x, &ads117x_dai, 1); 42 &soc_codec_dev_ads117x, &ads117x_dai, 1);
43} 43}
44 44
45static int __devexit ads117x_remove(struct platform_device *pdev) 45static int ads117x_remove(struct platform_device *pdev)
46{ 46{
47 snd_soc_unregister_codec(&pdev->dev); 47 snd_soc_unregister_codec(&pdev->dev);
48 return 0; 48 return 0;
@@ -55,7 +55,7 @@ static struct platform_driver ads117x_codec_driver = {
55 }, 55 },
56 56
57 .probe = ads117x_probe, 57 .probe = ads117x_probe,
58 .remove = __devexit_p(ads117x_remove), 58 .remove = ads117x_remove,
59}; 59};
60 60
61module_platform_driver(ads117x_codec_driver); 61module_platform_driver(ads117x_codec_driver);
diff --git a/sound/soc/codecs/ak4104.c b/sound/soc/codecs/ak4104.c
index 31d4483245d0..6f6c335a5baa 100644
--- a/sound/soc/codecs/ak4104.c
+++ b/sound/soc/codecs/ak4104.c
@@ -15,6 +15,8 @@
15#include <sound/soc.h> 15#include <sound/soc.h>
16#include <sound/initval.h> 16#include <sound/initval.h>
17#include <linux/spi/spi.h> 17#include <linux/spi/spi.h>
18#include <linux/of_device.h>
19#include <linux/of_gpio.h>
18#include <sound/asoundef.h> 20#include <sound/asoundef.h>
19 21
20/* AK4104 registers addresses */ 22/* AK4104 registers addresses */
@@ -98,14 +100,32 @@ static int ak4104_hw_params(struct snd_pcm_substream *substream,
98 val = 0; 100 val = 0;
99 101
100 switch (params_rate(params)) { 102 switch (params_rate(params)) {
103 case 22050:
104 val |= IEC958_AES3_CON_FS_22050;
105 break;
106 case 24000:
107 val |= IEC958_AES3_CON_FS_24000;
108 break;
109 case 32000:
110 val |= IEC958_AES3_CON_FS_32000;
111 break;
101 case 44100: 112 case 44100:
102 val |= IEC958_AES3_CON_FS_44100; 113 val |= IEC958_AES3_CON_FS_44100;
103 break; 114 break;
104 case 48000: 115 case 48000:
105 val |= IEC958_AES3_CON_FS_48000; 116 val |= IEC958_AES3_CON_FS_48000;
106 break; 117 break;
107 case 32000: 118 case 88200:
108 val |= IEC958_AES3_CON_FS_32000; 119 val |= IEC958_AES3_CON_FS_88200;
120 break;
121 case 96000:
122 val |= IEC958_AES3_CON_FS_96000;
123 break;
124 case 176400:
125 val |= IEC958_AES3_CON_FS_176400;
126 break;
127 case 192000:
128 val |= IEC958_AES3_CON_FS_192000;
109 break; 129 break;
110 default: 130 default:
111 dev_err(codec->dev, "unsupported sampling rate\n"); 131 dev_err(codec->dev, "unsupported sampling rate\n");
@@ -186,6 +206,7 @@ static const struct regmap_config ak4104_regmap = {
186 206
187static int ak4104_spi_probe(struct spi_device *spi) 207static int ak4104_spi_probe(struct spi_device *spi)
188{ 208{
209 struct device_node *np = spi->dev.of_node;
189 struct ak4104_private *ak4104; 210 struct ak4104_private *ak4104;
190 unsigned int val; 211 unsigned int val;
191 int ret; 212 int ret;
@@ -201,52 +222,62 @@ static int ak4104_spi_probe(struct spi_device *spi)
201 if (ak4104 == NULL) 222 if (ak4104 == NULL)
202 return -ENOMEM; 223 return -ENOMEM;
203 224
204 ak4104->regmap = regmap_init_spi(spi, &ak4104_regmap); 225 ak4104->regmap = devm_regmap_init_spi(spi, &ak4104_regmap);
205 if (IS_ERR(ak4104->regmap)) { 226 if (IS_ERR(ak4104->regmap)) {
206 ret = PTR_ERR(ak4104->regmap); 227 ret = PTR_ERR(ak4104->regmap);
207 return ret; 228 return ret;
208 } 229 }
209 230
231 if (np) {
232 enum of_gpio_flags flags;
233 int gpio = of_get_named_gpio_flags(np, "reset-gpio", 0, &flags);
234
235 if (gpio_is_valid(gpio)) {
236 ret = devm_gpio_request_one(&spi->dev, gpio,
237 flags & OF_GPIO_ACTIVE_LOW ?
238 GPIOF_OUT_INIT_LOW : GPIOF_OUT_INIT_HIGH,
239 "ak4104 reset");
240 if (ret < 0)
241 return ret;
242 }
243 }
244
210 /* read the 'reserved' register - according to the datasheet, it 245 /* read the 'reserved' register - according to the datasheet, it
211 * should contain 0x5b. Not a good way to verify the presence of 246 * should contain 0x5b. Not a good way to verify the presence of
212 * the device, but there is no hardware ID register. */ 247 * the device, but there is no hardware ID register. */
213 ret = regmap_read(ak4104->regmap, AK4104_REG_RESERVED, &val); 248 ret = regmap_read(ak4104->regmap, AK4104_REG_RESERVED, &val);
214 if (ret != 0) 249 if (ret != 0)
215 goto err; 250 return ret;
216 if (val != AK4104_RESERVED_VAL) { 251 if (val != AK4104_RESERVED_VAL)
217 ret = -ENODEV; 252 return -ENODEV;
218 goto err;
219 }
220 253
221 spi_set_drvdata(spi, ak4104); 254 spi_set_drvdata(spi, ak4104);
222 255
223 ret = snd_soc_register_codec(&spi->dev, 256 ret = snd_soc_register_codec(&spi->dev,
224 &soc_codec_device_ak4104, &ak4104_dai, 1); 257 &soc_codec_device_ak4104, &ak4104_dai, 1);
225 if (ret != 0)
226 goto err;
227
228 return 0;
229
230err:
231 regmap_exit(ak4104->regmap);
232 return ret; 258 return ret;
233} 259}
234 260
235static int __devexit ak4104_spi_remove(struct spi_device *spi) 261static int ak4104_spi_remove(struct spi_device *spi)
236{ 262{
237 struct ak4104_private *ak4101 = spi_get_drvdata(spi);
238 regmap_exit(ak4101->regmap);
239 snd_soc_unregister_codec(&spi->dev); 263 snd_soc_unregister_codec(&spi->dev);
240 return 0; 264 return 0;
241} 265}
242 266
267static const struct of_device_id ak4104_of_match[] = {
268 { .compatible = "asahi-kasei,ak4104", },
269 { }
270};
271MODULE_DEVICE_TABLE(of, ak4104_of_match);
272
243static struct spi_driver ak4104_spi_driver = { 273static struct spi_driver ak4104_spi_driver = {
244 .driver = { 274 .driver = {
245 .name = DRV_NAME, 275 .name = DRV_NAME,
246 .owner = THIS_MODULE, 276 .owner = THIS_MODULE,
277 .of_match_table = ak4104_of_match,
247 }, 278 },
248 .probe = ak4104_spi_probe, 279 .probe = ak4104_spi_probe,
249 .remove = __devexit_p(ak4104_spi_remove), 280 .remove = ak4104_spi_remove,
250}; 281};
251 282
252module_spi_driver(ak4104_spi_driver); 283module_spi_driver(ak4104_spi_driver);
diff --git a/sound/soc/codecs/ak4535.c b/sound/soc/codecs/ak4535.c
index 618fdc30f73e..684fe910669f 100644
--- a/sound/soc/codecs/ak4535.c
+++ b/sound/soc/codecs/ak4535.c
@@ -436,8 +436,8 @@ static struct snd_soc_codec_driver soc_codec_dev_ak4535 = {
436 .num_dapm_routes = ARRAY_SIZE(ak4535_audio_map), 436 .num_dapm_routes = ARRAY_SIZE(ak4535_audio_map),
437}; 437};
438 438
439static __devinit int ak4535_i2c_probe(struct i2c_client *i2c, 439static int ak4535_i2c_probe(struct i2c_client *i2c,
440 const struct i2c_device_id *id) 440 const struct i2c_device_id *id)
441{ 441{
442 struct ak4535_priv *ak4535; 442 struct ak4535_priv *ak4535;
443 int ret; 443 int ret;
@@ -447,7 +447,7 @@ static __devinit int ak4535_i2c_probe(struct i2c_client *i2c,
447 if (ak4535 == NULL) 447 if (ak4535 == NULL)
448 return -ENOMEM; 448 return -ENOMEM;
449 449
450 ak4535->regmap = regmap_init_i2c(i2c, &ak4535_regmap); 450 ak4535->regmap = devm_regmap_init_i2c(i2c, &ak4535_regmap);
451 if (IS_ERR(ak4535->regmap)) { 451 if (IS_ERR(ak4535->regmap)) {
452 ret = PTR_ERR(ak4535->regmap); 452 ret = PTR_ERR(ak4535->regmap);
453 dev_err(&i2c->dev, "Failed to init regmap: %d\n", ret); 453 dev_err(&i2c->dev, "Failed to init regmap: %d\n", ret);
@@ -458,18 +458,13 @@ static __devinit int ak4535_i2c_probe(struct i2c_client *i2c,
458 458
459 ret = snd_soc_register_codec(&i2c->dev, 459 ret = snd_soc_register_codec(&i2c->dev,
460 &soc_codec_dev_ak4535, &ak4535_dai, 1); 460 &soc_codec_dev_ak4535, &ak4535_dai, 1);
461 if (ret != 0)
462 regmap_exit(ak4535->regmap);
463 461
464 return ret; 462 return ret;
465} 463}
466 464
467static __devexit int ak4535_i2c_remove(struct i2c_client *client) 465static int ak4535_i2c_remove(struct i2c_client *client)
468{ 466{
469 struct ak4535_priv *ak4535 = i2c_get_clientdata(client);
470
471 snd_soc_unregister_codec(&client->dev); 467 snd_soc_unregister_codec(&client->dev);
472 regmap_exit(ak4535->regmap);
473 return 0; 468 return 0;
474} 469}
475 470
@@ -485,7 +480,7 @@ static struct i2c_driver ak4535_i2c_driver = {
485 .owner = THIS_MODULE, 480 .owner = THIS_MODULE,
486 }, 481 },
487 .probe = ak4535_i2c_probe, 482 .probe = ak4535_i2c_probe,
488 .remove = __devexit_p(ak4535_i2c_remove), 483 .remove = ak4535_i2c_remove,
489 .id_table = ak4535_i2c_id, 484 .id_table = ak4535_i2c_id,
490}; 485};
491 486
diff --git a/sound/soc/codecs/ak4641.c b/sound/soc/codecs/ak4641.c
index 543a12f471be..5f9af1fb76e8 100644
--- a/sound/soc/codecs/ak4641.c
+++ b/sound/soc/codecs/ak4641.c
@@ -557,8 +557,8 @@ static struct snd_soc_codec_driver soc_codec_dev_ak4641 = {
557}; 557};
558 558
559 559
560static int __devinit ak4641_i2c_probe(struct i2c_client *i2c, 560static int ak4641_i2c_probe(struct i2c_client *i2c,
561 const struct i2c_device_id *id) 561 const struct i2c_device_id *id)
562{ 562{
563 struct ak4641_platform_data *pdata = i2c->dev.platform_data; 563 struct ak4641_platform_data *pdata = i2c->dev.platform_data;
564 struct ak4641_priv *ak4641; 564 struct ak4641_priv *ak4641;
@@ -610,7 +610,7 @@ err_out:
610 return ret; 610 return ret;
611} 611}
612 612
613static int __devexit ak4641_i2c_remove(struct i2c_client *i2c) 613static int ak4641_i2c_remove(struct i2c_client *i2c)
614{ 614{
615 struct ak4641_platform_data *pdata = i2c->dev.platform_data; 615 struct ak4641_platform_data *pdata = i2c->dev.platform_data;
616 616
@@ -640,7 +640,7 @@ static struct i2c_driver ak4641_i2c_driver = {
640 .owner = THIS_MODULE, 640 .owner = THIS_MODULE,
641 }, 641 },
642 .probe = ak4641_i2c_probe, 642 .probe = ak4641_i2c_probe,
643 .remove = __devexit_p(ak4641_i2c_remove), 643 .remove = ak4641_i2c_remove,
644 .id_table = ak4641_i2c_id, 644 .id_table = ak4641_i2c_id,
645}; 645};
646 646
diff --git a/sound/soc/codecs/ak4642.c b/sound/soc/codecs/ak4642.c
index b3e24f289421..1f0cdab03294 100644
--- a/sound/soc/codecs/ak4642.c
+++ b/sound/soc/codecs/ak4642.c
@@ -194,12 +194,6 @@ static const struct snd_soc_dapm_route ak4642_intercon[] = {
194 {"LINEOUT Mixer", "DACL", "DAC"}, 194 {"LINEOUT Mixer", "DACL", "DAC"},
195}; 195};
196 196
197/* codec private data */
198struct ak4642_priv {
199 unsigned int sysclk;
200 enum snd_soc_control_type control_type;
201};
202
203/* 197/*
204 * ak4642 register cache 198 * ak4642 register cache
205 */ 199 */
@@ -468,10 +462,9 @@ static int ak4642_resume(struct snd_soc_codec *codec)
468 462
469static int ak4642_probe(struct snd_soc_codec *codec) 463static int ak4642_probe(struct snd_soc_codec *codec)
470{ 464{
471 struct ak4642_priv *ak4642 = snd_soc_codec_get_drvdata(codec);
472 int ret; 465 int ret;
473 466
474 ret = snd_soc_codec_set_cache_io(codec, 8, 8, ak4642->control_type); 467 ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_I2C);
475 if (ret < 0) { 468 if (ret < 0) {
476 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret); 469 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
477 return ret; 470 return ret;
@@ -520,27 +513,15 @@ static struct snd_soc_codec_driver soc_codec_dev_ak4648 = {
520}; 513};
521 514
522#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) 515#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
523static __devinit int ak4642_i2c_probe(struct i2c_client *i2c, 516static int ak4642_i2c_probe(struct i2c_client *i2c,
524 const struct i2c_device_id *id) 517 const struct i2c_device_id *id)
525{ 518{
526 struct ak4642_priv *ak4642; 519 return snd_soc_register_codec(&i2c->dev,
527 int ret;
528
529 ak4642 = devm_kzalloc(&i2c->dev, sizeof(struct ak4642_priv),
530 GFP_KERNEL);
531 if (!ak4642)
532 return -ENOMEM;
533
534 i2c_set_clientdata(i2c, ak4642);
535 ak4642->control_type = SND_SOC_I2C;
536
537 ret = snd_soc_register_codec(&i2c->dev,
538 (struct snd_soc_codec_driver *)id->driver_data, 520 (struct snd_soc_codec_driver *)id->driver_data,
539 &ak4642_dai, 1); 521 &ak4642_dai, 1);
540 return ret;
541} 522}
542 523
543static __devexit int ak4642_i2c_remove(struct i2c_client *client) 524static int ak4642_i2c_remove(struct i2c_client *client)
544{ 525{
545 snd_soc_unregister_codec(&client->dev); 526 snd_soc_unregister_codec(&client->dev);
546 return 0; 527 return 0;
@@ -560,7 +541,7 @@ static struct i2c_driver ak4642_i2c_driver = {
560 .owner = THIS_MODULE, 541 .owner = THIS_MODULE,
561 }, 542 },
562 .probe = ak4642_i2c_probe, 543 .probe = ak4642_i2c_probe,
563 .remove = __devexit_p(ak4642_i2c_remove), 544 .remove = ak4642_i2c_remove,
564 .id_table = ak4642_i2c_id, 545 .id_table = ak4642_i2c_id,
565}; 546};
566#endif 547#endif
diff --git a/sound/soc/codecs/ak4671.c b/sound/soc/codecs/ak4671.c
index 2b457976a7bf..25bdf6ad4a54 100644
--- a/sound/soc/codecs/ak4671.c
+++ b/sound/soc/codecs/ak4671.c
@@ -655,8 +655,8 @@ static struct snd_soc_codec_driver soc_codec_dev_ak4671 = {
655 .num_dapm_routes = ARRAY_SIZE(ak4671_intercon), 655 .num_dapm_routes = ARRAY_SIZE(ak4671_intercon),
656}; 656};
657 657
658static int __devinit ak4671_i2c_probe(struct i2c_client *client, 658static int ak4671_i2c_probe(struct i2c_client *client,
659 const struct i2c_device_id *id) 659 const struct i2c_device_id *id)
660{ 660{
661 struct ak4671_priv *ak4671; 661 struct ak4671_priv *ak4671;
662 int ret; 662 int ret;
@@ -674,7 +674,7 @@ static int __devinit ak4671_i2c_probe(struct i2c_client *client,
674 return ret; 674 return ret;
675} 675}
676 676
677static __devexit int ak4671_i2c_remove(struct i2c_client *client) 677static int ak4671_i2c_remove(struct i2c_client *client)
678{ 678{
679 snd_soc_unregister_codec(&client->dev); 679 snd_soc_unregister_codec(&client->dev);
680 return 0; 680 return 0;
@@ -692,7 +692,7 @@ static struct i2c_driver ak4671_i2c_driver = {
692 .owner = THIS_MODULE, 692 .owner = THIS_MODULE,
693 }, 693 },
694 .probe = ak4671_i2c_probe, 694 .probe = ak4671_i2c_probe,
695 .remove = __devexit_p(ak4671_i2c_remove), 695 .remove = ak4671_i2c_remove,
696 .id_table = ak4671_i2c_id, 696 .id_table = ak4671_i2c_id,
697}; 697};
698 698
diff --git a/sound/soc/codecs/alc5623.c b/sound/soc/codecs/alc5623.c
index 1960478ce6bb..256c364193a5 100644
--- a/sound/soc/codecs/alc5623.c
+++ b/sound/soc/codecs/alc5623.c
@@ -991,8 +991,8 @@ static struct snd_soc_codec_driver soc_codec_device_alc5623 = {
991 * low = 0x1a 991 * low = 0x1a
992 * high = 0x1b 992 * high = 0x1b
993 */ 993 */
994static __devinit int alc5623_i2c_probe(struct i2c_client *client, 994static int alc5623_i2c_probe(struct i2c_client *client,
995 const struct i2c_device_id *id) 995 const struct i2c_device_id *id)
996{ 996{
997 struct alc5623_platform_data *pdata; 997 struct alc5623_platform_data *pdata;
998 struct alc5623_priv *alc5623; 998 struct alc5623_priv *alc5623;
@@ -1058,7 +1058,7 @@ static __devinit int alc5623_i2c_probe(struct i2c_client *client,
1058 return ret; 1058 return ret;
1059} 1059}
1060 1060
1061static __devexit int alc5623_i2c_remove(struct i2c_client *client) 1061static int alc5623_i2c_remove(struct i2c_client *client)
1062{ 1062{
1063 snd_soc_unregister_codec(&client->dev); 1063 snd_soc_unregister_codec(&client->dev);
1064 return 0; 1064 return 0;
@@ -1079,7 +1079,7 @@ static struct i2c_driver alc5623_i2c_driver = {
1079 .owner = THIS_MODULE, 1079 .owner = THIS_MODULE,
1080 }, 1080 },
1081 .probe = alc5623_i2c_probe, 1081 .probe = alc5623_i2c_probe,
1082 .remove = __devexit_p(alc5623_i2c_remove), 1082 .remove = alc5623_i2c_remove,
1083 .id_table = alc5623_i2c_table, 1083 .id_table = alc5623_i2c_table,
1084}; 1084};
1085 1085
diff --git a/sound/soc/codecs/alc5632.c b/sound/soc/codecs/alc5632.c
index 7dd02420b36d..f2e62e45f912 100644
--- a/sound/soc/codecs/alc5632.c
+++ b/sound/soc/codecs/alc5632.c
@@ -1116,8 +1116,8 @@ static struct regmap_config alc5632_regmap = {
1116 * low = 0x1a 1116 * low = 0x1a
1117 * high = 0x1b 1117 * high = 0x1b
1118 */ 1118 */
1119static __devinit int alc5632_i2c_probe(struct i2c_client *client, 1119static int alc5632_i2c_probe(struct i2c_client *client,
1120 const struct i2c_device_id *id) 1120 const struct i2c_device_id *id)
1121{ 1121{
1122 struct alc5632_priv *alc5632; 1122 struct alc5632_priv *alc5632;
1123 int ret, ret1, ret2; 1123 int ret, ret1, ret2;
@@ -1179,7 +1179,7 @@ static __devinit int alc5632_i2c_probe(struct i2c_client *client,
1179 return ret; 1179 return ret;
1180} 1180}
1181 1181
1182static __devexit int alc5632_i2c_remove(struct i2c_client *client) 1182static int alc5632_i2c_remove(struct i2c_client *client)
1183{ 1183{
1184 snd_soc_unregister_codec(&client->dev); 1184 snd_soc_unregister_codec(&client->dev);
1185 return 0; 1185 return 0;
@@ -1198,7 +1198,7 @@ static struct i2c_driver alc5632_i2c_driver = {
1198 .owner = THIS_MODULE, 1198 .owner = THIS_MODULE,
1199 }, 1199 },
1200 .probe = alc5632_i2c_probe, 1200 .probe = alc5632_i2c_probe,
1201 .remove = __devexit_p(alc5632_i2c_remove), 1201 .remove = alc5632_i2c_remove,
1202 .id_table = alc5632_i2c_table, 1202 .id_table = alc5632_i2c_table,
1203}; 1203};
1204 1204
diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c
index 054967d8bac2..adf397b9d0e6 100644
--- a/sound/soc/codecs/arizona.c
+++ b/sound/soc/codecs/arizona.c
@@ -226,6 +226,31 @@ EXPORT_SYMBOL_GPL(arizona_mixer_values);
226const DECLARE_TLV_DB_SCALE(arizona_mixer_tlv, -3200, 100, 0); 226const DECLARE_TLV_DB_SCALE(arizona_mixer_tlv, -3200, 100, 0);
227EXPORT_SYMBOL_GPL(arizona_mixer_tlv); 227EXPORT_SYMBOL_GPL(arizona_mixer_tlv);
228 228
229static const char *arizona_vol_ramp_text[] = {
230 "0ms/6dB", "0.5ms/6dB", "1ms/6dB", "2ms/6dB", "4ms/6dB", "8ms/6dB",
231 "15ms/6dB", "30ms/6dB",
232};
233
234const struct soc_enum arizona_in_vd_ramp =
235 SOC_ENUM_SINGLE(ARIZONA_INPUT_VOLUME_RAMP,
236 ARIZONA_IN_VD_RAMP_SHIFT, 7, arizona_vol_ramp_text);
237EXPORT_SYMBOL_GPL(arizona_in_vd_ramp);
238
239const struct soc_enum arizona_in_vi_ramp =
240 SOC_ENUM_SINGLE(ARIZONA_INPUT_VOLUME_RAMP,
241 ARIZONA_IN_VI_RAMP_SHIFT, 7, arizona_vol_ramp_text);
242EXPORT_SYMBOL_GPL(arizona_in_vi_ramp);
243
244const struct soc_enum arizona_out_vd_ramp =
245 SOC_ENUM_SINGLE(ARIZONA_OUTPUT_VOLUME_RAMP,
246 ARIZONA_OUT_VD_RAMP_SHIFT, 7, arizona_vol_ramp_text);
247EXPORT_SYMBOL_GPL(arizona_out_vd_ramp);
248
249const struct soc_enum arizona_out_vi_ramp =
250 SOC_ENUM_SINGLE(ARIZONA_OUTPUT_VOLUME_RAMP,
251 ARIZONA_OUT_VI_RAMP_SHIFT, 7, arizona_vol_ramp_text);
252EXPORT_SYMBOL_GPL(arizona_out_vi_ramp);
253
229static const char *arizona_lhpf_mode_text[] = { 254static const char *arizona_lhpf_mode_text[] = {
230 "Low-pass", "High-pass" 255 "Low-pass", "High-pass"
231}; 256};
@@ -380,6 +405,18 @@ int arizona_set_sysclk(struct snd_soc_codec *codec, int clk_id,
380 case 49152000: 405 case 49152000:
381 val |= 3 << ARIZONA_SYSCLK_FREQ_SHIFT; 406 val |= 3 << ARIZONA_SYSCLK_FREQ_SHIFT;
382 break; 407 break;
408 case 67737600:
409 case 73728000:
410 val |= 4 << ARIZONA_SYSCLK_FREQ_SHIFT;
411 break;
412 case 90316800:
413 case 98304000:
414 val |= 5 << ARIZONA_SYSCLK_FREQ_SHIFT;
415 break;
416 case 135475200:
417 case 147456000:
418 val |= 6 << ARIZONA_SYSCLK_FREQ_SHIFT;
419 break;
383 default: 420 default:
384 return -EINVAL; 421 return -EINVAL;
385 } 422 }
@@ -737,6 +774,9 @@ static int arizona_dai_set_sysclk(struct snd_soc_dai *dai,
737 return -EBUSY; 774 return -EBUSY;
738 } 775 }
739 776
777 dev_dbg(codec->dev, "Setting AIF%d to %s\n", dai->id + 1,
778 arizona_dai_clk_str(clk_id));
779
740 memset(&routes, 0, sizeof(routes)); 780 memset(&routes, 0, sizeof(routes));
741 routes[0].sink = dai->driver->capture.stream_name; 781 routes[0].sink = dai->driver->capture.stream_name;
742 routes[1].sink = dai->driver->playback.stream_name; 782 routes[1].sink = dai->driver->playback.stream_name;
@@ -749,6 +789,8 @@ static int arizona_dai_set_sysclk(struct snd_soc_dai *dai,
749 routes[1].source = arizona_dai_clk_str(clk_id); 789 routes[1].source = arizona_dai_clk_str(clk_id);
750 snd_soc_dapm_add_routes(&codec->dapm, routes, ARRAY_SIZE(routes)); 790 snd_soc_dapm_add_routes(&codec->dapm, routes, ARRAY_SIZE(routes));
751 791
792 dai_priv->clk = clk_id;
793
752 return snd_soc_dapm_sync(&codec->dapm); 794 return snd_soc_dapm_sync(&codec->dapm);
753} 795}
754 796
@@ -925,6 +967,9 @@ int arizona_set_fll(struct arizona_fll *fll, int source,
925 bool ena; 967 bool ena;
926 int ret; 968 int ret;
927 969
970 if (fll->fref == Fref && fll->fout == Fout)
971 return 0;
972
928 ret = regmap_read(arizona->regmap, fll->base + 1, &reg); 973 ret = regmap_read(arizona->regmap, fll->base + 1, &reg);
929 if (ret != 0) { 974 if (ret != 0) {
930 arizona_fll_err(fll, "Failed to read current state: %d\n", 975 arizona_fll_err(fll, "Failed to read current state: %d\n",
@@ -970,6 +1015,9 @@ int arizona_set_fll(struct arizona_fll *fll, int source,
970 if (ena) 1015 if (ena)
971 pm_runtime_put_autosuspend(arizona->dev); 1016 pm_runtime_put_autosuspend(arizona->dev);
972 1017
1018 fll->fref = Fref;
1019 fll->fout = Fout;
1020
973 return 0; 1021 return 0;
974 } 1022 }
975 1023
@@ -998,10 +1046,13 @@ int arizona_set_fll(struct arizona_fll *fll, int source,
998 ARIZONA_FLL1_SYNC_ENA); 1046 ARIZONA_FLL1_SYNC_ENA);
999 1047
1000 ret = wait_for_completion_timeout(&fll->ok, 1048 ret = wait_for_completion_timeout(&fll->ok,
1001 msecs_to_jiffies(25)); 1049 msecs_to_jiffies(250));
1002 if (ret == 0) 1050 if (ret == 0)
1003 arizona_fll_warn(fll, "Timed out waiting for lock\n"); 1051 arizona_fll_warn(fll, "Timed out waiting for lock\n");
1004 1052
1053 fll->fref = Fref;
1054 fll->fout = Fout;
1055
1005 return 0; 1056 return 0;
1006} 1057}
1007EXPORT_SYMBOL_GPL(arizona_set_fll); 1058EXPORT_SYMBOL_GPL(arizona_set_fll);
diff --git a/sound/soc/codecs/arizona.h b/sound/soc/codecs/arizona.h
index 36ec64946120..41dae1ed3b71 100644
--- a/sound/soc/codecs/arizona.h
+++ b/sound/soc/codecs/arizona.h
@@ -17,6 +17,8 @@
17 17
18#include <sound/soc.h> 18#include <sound/soc.h>
19 19
20#include "wm_adsp.h"
21
20#define ARIZONA_CLK_SYSCLK 1 22#define ARIZONA_CLK_SYSCLK 1
21#define ARIZONA_CLK_ASYNCCLK 2 23#define ARIZONA_CLK_ASYNCCLK 2
22#define ARIZONA_CLK_OPCLK 3 24#define ARIZONA_CLK_OPCLK 3
@@ -46,15 +48,18 @@
46#define ARIZONA_MIXER_VOL_SHIFT 1 48#define ARIZONA_MIXER_VOL_SHIFT 1
47#define ARIZONA_MIXER_VOL_WIDTH 7 49#define ARIZONA_MIXER_VOL_WIDTH 7
48 50
49#define ARIZONA_MAX_DAI 3 51#define ARIZONA_MAX_DAI 4
52#define ARIZONA_MAX_ADSP 4
50 53
51struct arizona; 54struct arizona;
55struct wm_adsp;
52 56
53struct arizona_dai_priv { 57struct arizona_dai_priv {
54 int clk; 58 int clk;
55}; 59};
56 60
57struct arizona_priv { 61struct arizona_priv {
62 struct wm_adsp adsp[ARIZONA_MAX_ADSP];
58 struct arizona *arizona; 63 struct arizona *arizona;
59 int sysclk; 64 int sysclk;
60 int asyncclk; 65 int asyncclk;
@@ -89,19 +94,30 @@ extern int arizona_mixer_values[ARIZONA_NUM_MIXER_INPUTS];
89 const struct snd_kcontrol_new name##_mux = \ 94 const struct snd_kcontrol_new name##_mux = \
90 SOC_DAPM_VALUE_ENUM("Route", name##_enum) 95 SOC_DAPM_VALUE_ENUM("Route", name##_enum)
91 96
97#define ARIZONA_MUX_ENUMS(name, base_reg) \
98 static ARIZONA_MUX_ENUM_DECL(name##_enum, base_reg); \
99 static ARIZONA_MUX_CTL_DECL(name)
100
92#define ARIZONA_MIXER_ENUMS(name, base_reg) \ 101#define ARIZONA_MIXER_ENUMS(name, base_reg) \
93 static ARIZONA_MUX_ENUM_DECL(name##_in1_enum, base_reg); \ 102 ARIZONA_MUX_ENUMS(name##_in1, base_reg); \
94 static ARIZONA_MUX_ENUM_DECL(name##_in2_enum, base_reg + 2); \ 103 ARIZONA_MUX_ENUMS(name##_in2, base_reg + 2); \
95 static ARIZONA_MUX_ENUM_DECL(name##_in3_enum, base_reg + 4); \ 104 ARIZONA_MUX_ENUMS(name##_in3, base_reg + 4); \
96 static ARIZONA_MUX_ENUM_DECL(name##_in4_enum, base_reg + 6); \ 105 ARIZONA_MUX_ENUMS(name##_in4, base_reg + 6)
97 static ARIZONA_MUX_CTL_DECL(name##_in1); \ 106
98 static ARIZONA_MUX_CTL_DECL(name##_in2); \ 107#define ARIZONA_DSP_AUX_ENUMS(name, base_reg) \
99 static ARIZONA_MUX_CTL_DECL(name##_in3); \ 108 ARIZONA_MUX_ENUMS(name##_aux1, base_reg); \
100 static ARIZONA_MUX_CTL_DECL(name##_in4) 109 ARIZONA_MUX_ENUMS(name##_aux2, base_reg + 8); \
110 ARIZONA_MUX_ENUMS(name##_aux3, base_reg + 16); \
111 ARIZONA_MUX_ENUMS(name##_aux4, base_reg + 24); \
112 ARIZONA_MUX_ENUMS(name##_aux5, base_reg + 32); \
113 ARIZONA_MUX_ENUMS(name##_aux6, base_reg + 40)
101 114
102#define ARIZONA_MUX(name, ctrl) \ 115#define ARIZONA_MUX(name, ctrl) \
103 SND_SOC_DAPM_VALUE_MUX(name, SND_SOC_NOPM, 0, 0, ctrl) 116 SND_SOC_DAPM_VALUE_MUX(name, SND_SOC_NOPM, 0, 0, ctrl)
104 117
118#define ARIZONA_MUX_WIDGETS(name, name_str) \
119 ARIZONA_MUX(name_str " Input", &name##_mux)
120
105#define ARIZONA_MIXER_WIDGETS(name, name_str) \ 121#define ARIZONA_MIXER_WIDGETS(name, name_str) \
106 ARIZONA_MUX(name_str " Input 1", &name##_in1_mux), \ 122 ARIZONA_MUX(name_str " Input 1", &name##_in1_mux), \
107 ARIZONA_MUX(name_str " Input 2", &name##_in2_mux), \ 123 ARIZONA_MUX(name_str " Input 2", &name##_in2_mux), \
@@ -109,6 +125,19 @@ extern int arizona_mixer_values[ARIZONA_NUM_MIXER_INPUTS];
109 ARIZONA_MUX(name_str " Input 4", &name##_in4_mux), \ 125 ARIZONA_MUX(name_str " Input 4", &name##_in4_mux), \
110 SND_SOC_DAPM_MIXER(name_str " Mixer", SND_SOC_NOPM, 0, 0, NULL, 0) 126 SND_SOC_DAPM_MIXER(name_str " Mixer", SND_SOC_NOPM, 0, 0, NULL, 0)
111 127
128#define ARIZONA_DSP_WIDGETS(name, name_str) \
129 ARIZONA_MIXER_WIDGETS(name##L, name_str "L"), \
130 ARIZONA_MIXER_WIDGETS(name##R, name_str "R"), \
131 ARIZONA_MUX(name_str " Aux 1", &name##_aux1_mux), \
132 ARIZONA_MUX(name_str " Aux 2", &name##_aux2_mux), \
133 ARIZONA_MUX(name_str " Aux 3", &name##_aux3_mux), \
134 ARIZONA_MUX(name_str " Aux 4", &name##_aux4_mux), \
135 ARIZONA_MUX(name_str " Aux 5", &name##_aux5_mux), \
136 ARIZONA_MUX(name_str " Aux 6", &name##_aux6_mux)
137
138#define ARIZONA_MUX_ROUTES(name) \
139 ARIZONA_MIXER_INPUT_ROUTES(name " Input")
140
112#define ARIZONA_MIXER_ROUTES(widget, name) \ 141#define ARIZONA_MIXER_ROUTES(widget, name) \
113 { widget, NULL, name " Mixer" }, \ 142 { widget, NULL, name " Mixer" }, \
114 { name " Mixer", NULL, name " Input 1" }, \ 143 { name " Mixer", NULL, name " Input 1" }, \
@@ -120,6 +149,28 @@ extern int arizona_mixer_values[ARIZONA_NUM_MIXER_INPUTS];
120 ARIZONA_MIXER_INPUT_ROUTES(name " Input 3"), \ 149 ARIZONA_MIXER_INPUT_ROUTES(name " Input 3"), \
121 ARIZONA_MIXER_INPUT_ROUTES(name " Input 4") 150 ARIZONA_MIXER_INPUT_ROUTES(name " Input 4")
122 151
152#define ARIZONA_DSP_ROUTES(name) \
153 { name, NULL, name " Aux 1" }, \
154 { name, NULL, name " Aux 2" }, \
155 { name, NULL, name " Aux 3" }, \
156 { name, NULL, name " Aux 4" }, \
157 { name, NULL, name " Aux 5" }, \
158 { name, NULL, name " Aux 6" }, \
159 ARIZONA_MIXER_INPUT_ROUTES(name " Aux 1"), \
160 ARIZONA_MIXER_INPUT_ROUTES(name " Aux 2"), \
161 ARIZONA_MIXER_INPUT_ROUTES(name " Aux 3"), \
162 ARIZONA_MIXER_INPUT_ROUTES(name " Aux 4"), \
163 ARIZONA_MIXER_INPUT_ROUTES(name " Aux 5"), \
164 ARIZONA_MIXER_INPUT_ROUTES(name " Aux 6"), \
165 ARIZONA_MIXER_ROUTES(name, name "L"), \
166 ARIZONA_MIXER_ROUTES(name, name "R")
167
168extern const struct soc_enum arizona_in_vi_ramp;
169extern const struct soc_enum arizona_in_vd_ramp;
170
171extern const struct soc_enum arizona_out_vi_ramp;
172extern const struct soc_enum arizona_out_vd_ramp;
173
123extern const struct soc_enum arizona_lhpf1_mode; 174extern const struct soc_enum arizona_lhpf1_mode;
124extern const struct soc_enum arizona_lhpf2_mode; 175extern const struct soc_enum arizona_lhpf2_mode;
125extern const struct soc_enum arizona_lhpf3_mode; 176extern const struct soc_enum arizona_lhpf3_mode;
@@ -146,6 +197,8 @@ struct arizona_fll {
146 unsigned int vco_mult; 197 unsigned int vco_mult;
147 struct completion lock; 198 struct completion lock;
148 struct completion ok; 199 struct completion ok;
200 unsigned int fref;
201 unsigned int fout;
149 202
150 char lock_name[ARIZONA_FLL_NAME_LEN]; 203 char lock_name[ARIZONA_FLL_NAME_LEN];
151 char clock_ok_name[ARIZONA_FLL_NAME_LEN]; 204 char clock_ok_name[ARIZONA_FLL_NAME_LEN];
diff --git a/sound/soc/codecs/cq93vc.c b/sound/soc/codecs/cq93vc.c
index 064cd6a93516..23316c887b19 100644
--- a/sound/soc/codecs/cq93vc.c
+++ b/sound/soc/codecs/cq93vc.c
@@ -201,7 +201,7 @@ static struct platform_driver cq93vc_codec_driver = {
201 }, 201 },
202 202
203 .probe = cq93vc_platform_probe, 203 .probe = cq93vc_platform_probe,
204 .remove = __devexit_p(cq93vc_platform_remove), 204 .remove = cq93vc_platform_remove,
205}; 205};
206 206
207module_platform_driver(cq93vc_codec_driver); 207module_platform_driver(cq93vc_codec_driver);
diff --git a/sound/soc/codecs/cs4271.c b/sound/soc/codecs/cs4271.c
index e3f0a7f3131e..4f1127935fdf 100644
--- a/sound/soc/codecs/cs4271.c
+++ b/sound/soc/codecs/cs4271.c
@@ -474,15 +474,25 @@ 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 478
478#ifdef CONFIG_OF 479#ifdef CONFIG_OF
479 if (of_match_device(cs4271_dt_ids, codec->dev)) 480 if (of_match_device(cs4271_dt_ids, codec->dev)) {
480 gpio_nreset = of_get_named_gpio(codec->dev->of_node, 481 gpio_nreset = of_get_named_gpio(codec->dev->of_node,
481 "reset-gpio", 0); 482 "reset-gpio", 0);
483
484 if (!of_get_property(codec->dev->of_node,
485 "cirrus,amutec-eq-bmutec", NULL))
486 amutec_eq_bmutec = 1;
487 }
482#endif 488#endif
483 489
484 if (cs4271plat && gpio_is_valid(cs4271plat->gpio_nreset)) 490 if (cs4271plat) {
485 gpio_nreset = cs4271plat->gpio_nreset; 491 if (gpio_is_valid(cs4271plat->gpio_nreset))
492 gpio_nreset = cs4271plat->gpio_nreset;
493
494 amutec_eq_bmutec = cs4271plat->amutec_eq_bmutec;
495 }
486 496
487 if (gpio_nreset >= 0) 497 if (gpio_nreset >= 0)
488 if (devm_gpio_request(codec->dev, gpio_nreset, "CS4271 Reset")) 498 if (devm_gpio_request(codec->dev, gpio_nreset, "CS4271 Reset"))
@@ -528,6 +538,11 @@ static int cs4271_probe(struct snd_soc_codec *codec)
528 /* Power-up sequence requires 85 uS */ 538 /* Power-up sequence requires 85 uS */
529 udelay(85); 539 udelay(85);
530 540
541 if (amutec_eq_bmutec)
542 snd_soc_update_bits(codec, CS4271_MODE2,
543 CS4271_MODE2_MUTECAEQUB,
544 CS4271_MODE2_MUTECAEQUB);
545
531 return snd_soc_add_codec_controls(codec, cs4271_snd_controls, 546 return snd_soc_add_codec_controls(codec, cs4271_snd_controls,
532 ARRAY_SIZE(cs4271_snd_controls)); 547 ARRAY_SIZE(cs4271_snd_controls));
533} 548}
@@ -555,7 +570,7 @@ static struct snd_soc_codec_driver soc_codec_dev_cs4271 = {
555}; 570};
556 571
557#if defined(CONFIG_SPI_MASTER) 572#if defined(CONFIG_SPI_MASTER)
558static int __devinit cs4271_spi_probe(struct spi_device *spi) 573static int cs4271_spi_probe(struct spi_device *spi)
559{ 574{
560 struct cs4271_private *cs4271; 575 struct cs4271_private *cs4271;
561 576
@@ -570,7 +585,7 @@ static int __devinit cs4271_spi_probe(struct spi_device *spi)
570 &cs4271_dai, 1); 585 &cs4271_dai, 1);
571} 586}
572 587
573static int __devexit cs4271_spi_remove(struct spi_device *spi) 588static int cs4271_spi_remove(struct spi_device *spi)
574{ 589{
575 snd_soc_unregister_codec(&spi->dev); 590 snd_soc_unregister_codec(&spi->dev);
576 return 0; 591 return 0;
@@ -583,7 +598,7 @@ static struct spi_driver cs4271_spi_driver = {
583 .of_match_table = of_match_ptr(cs4271_dt_ids), 598 .of_match_table = of_match_ptr(cs4271_dt_ids),
584 }, 599 },
585 .probe = cs4271_spi_probe, 600 .probe = cs4271_spi_probe,
586 .remove = __devexit_p(cs4271_spi_remove), 601 .remove = cs4271_spi_remove,
587}; 602};
588#endif /* defined(CONFIG_SPI_MASTER) */ 603#endif /* defined(CONFIG_SPI_MASTER) */
589 604
@@ -594,8 +609,8 @@ static const struct i2c_device_id cs4271_i2c_id[] = {
594}; 609};
595MODULE_DEVICE_TABLE(i2c, cs4271_i2c_id); 610MODULE_DEVICE_TABLE(i2c, cs4271_i2c_id);
596 611
597static int __devinit cs4271_i2c_probe(struct i2c_client *client, 612static int cs4271_i2c_probe(struct i2c_client *client,
598 const struct i2c_device_id *id) 613 const struct i2c_device_id *id)
599{ 614{
600 struct cs4271_private *cs4271; 615 struct cs4271_private *cs4271;
601 616
@@ -610,7 +625,7 @@ static int __devinit cs4271_i2c_probe(struct i2c_client *client,
610 &cs4271_dai, 1); 625 &cs4271_dai, 1);
611} 626}
612 627
613static int __devexit cs4271_i2c_remove(struct i2c_client *client) 628static int cs4271_i2c_remove(struct i2c_client *client)
614{ 629{
615 snd_soc_unregister_codec(&client->dev); 630 snd_soc_unregister_codec(&client->dev);
616 return 0; 631 return 0;
@@ -624,7 +639,7 @@ static struct i2c_driver cs4271_i2c_driver = {
624 }, 639 },
625 .id_table = cs4271_i2c_id, 640 .id_table = cs4271_i2c_id,
626 .probe = cs4271_i2c_probe, 641 .probe = cs4271_i2c_probe,
627 .remove = __devexit_p(cs4271_i2c_remove), 642 .remove = cs4271_i2c_remove,
628}; 643};
629#endif /* defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) */ 644#endif /* defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) */
630 645
diff --git a/sound/soc/codecs/cs42l52.c b/sound/soc/codecs/cs42l52.c
index 97a81051e88d..99bb1c69499e 100644
--- a/sound/soc/codecs/cs42l52.c
+++ b/sound/soc/codecs/cs42l52.c
@@ -1271,7 +1271,7 @@ static struct i2c_driver cs42l52_i2c_driver = {
1271 }, 1271 },
1272 .id_table = cs42l52_id, 1272 .id_table = cs42l52_id,
1273 .probe = cs42l52_i2c_probe, 1273 .probe = cs42l52_i2c_probe,
1274 .remove = __devexit_p(cs42l52_i2c_remove), 1274 .remove = cs42l52_i2c_remove,
1275}; 1275};
1276 1276
1277module_i2c_driver(cs42l52_i2c_driver); 1277module_i2c_driver(cs42l52_i2c_driver);
diff --git a/sound/soc/codecs/cs42l73.c b/sound/soc/codecs/cs42l73.c
index 2c08c4cb465a..a0791ecf6d95 100644
--- a/sound/soc/codecs/cs42l73.c
+++ b/sound/soc/codecs/cs42l73.c
@@ -1345,8 +1345,8 @@ static struct regmap_config cs42l73_regmap = {
1345 .cache_type = REGCACHE_RBTREE, 1345 .cache_type = REGCACHE_RBTREE,
1346}; 1346};
1347 1347
1348static __devinit int cs42l73_i2c_probe(struct i2c_client *i2c_client, 1348static int cs42l73_i2c_probe(struct i2c_client *i2c_client,
1349 const struct i2c_device_id *id) 1349 const struct i2c_device_id *id)
1350{ 1350{
1351 struct cs42l73_private *cs42l73; 1351 struct cs42l73_private *cs42l73;
1352 int ret; 1352 int ret;
@@ -1406,7 +1406,7 @@ static __devinit int cs42l73_i2c_probe(struct i2c_client *i2c_client,
1406 return 0; 1406 return 0;
1407} 1407}
1408 1408
1409static __devexit int cs42l73_i2c_remove(struct i2c_client *client) 1409static int cs42l73_i2c_remove(struct i2c_client *client)
1410{ 1410{
1411 snd_soc_unregister_codec(&client->dev); 1411 snd_soc_unregister_codec(&client->dev);
1412 return 0; 1412 return 0;
@@ -1426,7 +1426,7 @@ static struct i2c_driver cs42l73_i2c_driver = {
1426 }, 1426 },
1427 .id_table = cs42l73_id, 1427 .id_table = cs42l73_id,
1428 .probe = cs42l73_i2c_probe, 1428 .probe = cs42l73_i2c_probe,
1429 .remove = __devexit_p(cs42l73_i2c_remove), 1429 .remove = cs42l73_i2c_remove,
1430 1430
1431}; 1431};
1432 1432
diff --git a/sound/soc/codecs/da7210.c b/sound/soc/codecs/da7210.c
index af5db7080519..9c1231456502 100644
--- a/sound/soc/codecs/da7210.c
+++ b/sound/soc/codecs/da7210.c
@@ -1218,8 +1218,8 @@ static const struct regmap_config da7210_regmap_config_i2c = {
1218 .cache_type = REGCACHE_RBTREE, 1218 .cache_type = REGCACHE_RBTREE,
1219}; 1219};
1220 1220
1221static int __devinit da7210_i2c_probe(struct i2c_client *i2c, 1221static int da7210_i2c_probe(struct i2c_client *i2c,
1222 const struct i2c_device_id *id) 1222 const struct i2c_device_id *id)
1223{ 1223{
1224 struct da7210_priv *da7210; 1224 struct da7210_priv *da7210;
1225 int ret; 1225 int ret;
@@ -1231,7 +1231,7 @@ static int __devinit da7210_i2c_probe(struct i2c_client *i2c,
1231 1231
1232 i2c_set_clientdata(i2c, da7210); 1232 i2c_set_clientdata(i2c, da7210);
1233 1233
1234 da7210->regmap = regmap_init_i2c(i2c, &da7210_regmap_config_i2c); 1234 da7210->regmap = devm_regmap_init_i2c(i2c, &da7210_regmap_config_i2c);
1235 if (IS_ERR(da7210->regmap)) { 1235 if (IS_ERR(da7210->regmap)) {
1236 ret = PTR_ERR(da7210->regmap); 1236 ret = PTR_ERR(da7210->regmap);
1237 dev_err(&i2c->dev, "regmap_init() failed: %d\n", ret); 1237 dev_err(&i2c->dev, "regmap_init() failed: %d\n", ret);
@@ -1245,24 +1245,15 @@ static int __devinit da7210_i2c_probe(struct i2c_client *i2c,
1245 1245
1246 ret = snd_soc_register_codec(&i2c->dev, 1246 ret = snd_soc_register_codec(&i2c->dev,
1247 &soc_codec_dev_da7210, &da7210_dai, 1); 1247 &soc_codec_dev_da7210, &da7210_dai, 1);
1248 if (ret < 0) { 1248 if (ret < 0)
1249 dev_err(&i2c->dev, "Failed to register codec: %d\n", ret); 1249 dev_err(&i2c->dev, "Failed to register codec: %d\n", ret);
1250 goto err_regmap;
1251 }
1252 return ret;
1253
1254err_regmap:
1255 regmap_exit(da7210->regmap);
1256 1250
1257 return ret; 1251 return ret;
1258} 1252}
1259 1253
1260static int __devexit da7210_i2c_remove(struct i2c_client *client) 1254static int da7210_i2c_remove(struct i2c_client *client)
1261{ 1255{
1262 struct da7210_priv *da7210 = i2c_get_clientdata(client);
1263
1264 snd_soc_unregister_codec(&client->dev); 1256 snd_soc_unregister_codec(&client->dev);
1265 regmap_exit(da7210->regmap);
1266 return 0; 1257 return 0;
1267} 1258}
1268 1259
@@ -1279,7 +1270,7 @@ static struct i2c_driver da7210_i2c_driver = {
1279 .owner = THIS_MODULE, 1270 .owner = THIS_MODULE,
1280 }, 1271 },
1281 .probe = da7210_i2c_probe, 1272 .probe = da7210_i2c_probe,
1282 .remove = __devexit_p(da7210_i2c_remove), 1273 .remove = da7210_i2c_remove,
1283 .id_table = da7210_i2c_id, 1274 .id_table = da7210_i2c_id,
1284}; 1275};
1285#endif 1276#endif
@@ -1323,7 +1314,7 @@ static const struct regmap_config da7210_regmap_config_spi = {
1323 .cache_type = REGCACHE_RBTREE, 1314 .cache_type = REGCACHE_RBTREE,
1324}; 1315};
1325 1316
1326static int __devinit da7210_spi_probe(struct spi_device *spi) 1317static int da7210_spi_probe(struct spi_device *spi)
1327{ 1318{
1328 struct da7210_priv *da7210; 1319 struct da7210_priv *da7210;
1329 int ret; 1320 int ret;
@@ -1346,24 +1337,15 @@ static int __devinit da7210_spi_probe(struct spi_device *spi)
1346 if (ret != 0) 1337 if (ret != 0)
1347 dev_warn(&spi->dev, "Failed to apply regmap patch: %d\n", ret); 1338 dev_warn(&spi->dev, "Failed to apply regmap patch: %d\n", ret);
1348 1339
1349 ret = snd_soc_register_codec(&spi->dev, 1340 ret = snd_soc_register_codec(&spi->dev,
1350 &soc_codec_dev_da7210, &da7210_dai, 1); 1341 &soc_codec_dev_da7210, &da7210_dai, 1);
1351 if (ret < 0)
1352 goto err_regmap;
1353
1354 return ret;
1355
1356err_regmap:
1357 regmap_exit(da7210->regmap);
1358 1342
1359 return ret; 1343 return ret;
1360} 1344}
1361 1345
1362static int __devexit da7210_spi_remove(struct spi_device *spi) 1346static int da7210_spi_remove(struct spi_device *spi)
1363{ 1347{
1364 struct da7210_priv *da7210 = spi_get_drvdata(spi);
1365 snd_soc_unregister_codec(&spi->dev); 1348 snd_soc_unregister_codec(&spi->dev);
1366 regmap_exit(da7210->regmap);
1367 return 0; 1349 return 0;
1368} 1350}
1369 1351
@@ -1373,7 +1355,7 @@ static struct spi_driver da7210_spi_driver = {
1373 .owner = THIS_MODULE, 1355 .owner = THIS_MODULE,
1374 }, 1356 },
1375 .probe = da7210_spi_probe, 1357 .probe = da7210_spi_probe,
1376 .remove = __devexit_p(da7210_spi_remove) 1358 .remove = da7210_spi_remove
1377}; 1359};
1378#endif 1360#endif
1379 1361
diff --git a/sound/soc/codecs/da732x.c b/sound/soc/codecs/da732x.c
index 01be2a320e21..dc0284dc9e6f 100644
--- a/sound/soc/codecs/da732x.c
+++ b/sound/soc/codecs/da732x.c
@@ -1557,8 +1557,8 @@ static struct snd_soc_codec_driver soc_codec_dev_da732x = {
1557 .reg_cache_size = ARRAY_SIZE(da732x_reg_cache), 1557 .reg_cache_size = ARRAY_SIZE(da732x_reg_cache),
1558}; 1558};
1559 1559
1560static __devinit int da732x_i2c_probe(struct i2c_client *i2c, 1560static int da732x_i2c_probe(struct i2c_client *i2c,
1561 const struct i2c_device_id *id) 1561 const struct i2c_device_id *id)
1562{ 1562{
1563 struct da732x_priv *da732x; 1563 struct da732x_priv *da732x;
1564 unsigned int reg; 1564 unsigned int reg;
@@ -1596,7 +1596,7 @@ err:
1596 return ret; 1596 return ret;
1597} 1597}
1598 1598
1599static __devexit int da732x_i2c_remove(struct i2c_client *client) 1599static int da732x_i2c_remove(struct i2c_client *client)
1600{ 1600{
1601 snd_soc_unregister_codec(&client->dev); 1601 snd_soc_unregister_codec(&client->dev);
1602 1602
@@ -1615,7 +1615,7 @@ static struct i2c_driver da732x_i2c_driver = {
1615 .owner = THIS_MODULE, 1615 .owner = THIS_MODULE,
1616 }, 1616 },
1617 .probe = da732x_i2c_probe, 1617 .probe = da732x_i2c_probe,
1618 .remove = __devexit_p(da732x_i2c_remove), 1618 .remove = da732x_i2c_remove,
1619 .id_table = da732x_i2c_id, 1619 .id_table = da732x_i2c_id,
1620}; 1620};
1621 1621
diff --git a/sound/soc/codecs/da9055.c b/sound/soc/codecs/da9055.c
index f379b085c392..fc9802d1281d 100644
--- a/sound/soc/codecs/da9055.c
+++ b/sound/soc/codecs/da9055.c
@@ -173,6 +173,7 @@
173#define DA9055_AIF_FORMAT_I2S_MODE (0 << 0) 173#define DA9055_AIF_FORMAT_I2S_MODE (0 << 0)
174#define DA9055_AIF_FORMAT_LEFT_J (1 << 0) 174#define DA9055_AIF_FORMAT_LEFT_J (1 << 0)
175#define DA9055_AIF_FORMAT_RIGHT_J (2 << 0) 175#define DA9055_AIF_FORMAT_RIGHT_J (2 << 0)
176#define DA9055_AIF_FORMAT_DSP (3 << 0)
176#define DA9055_AIF_WORD_S16_LE (0 << 2) 177#define DA9055_AIF_WORD_S16_LE (0 << 2)
177#define DA9055_AIF_WORD_S20_3LE (1 << 2) 178#define DA9055_AIF_WORD_S20_3LE (1 << 2)
178#define DA9055_AIF_WORD_S24_LE (2 << 2) 179#define DA9055_AIF_WORD_S24_LE (2 << 2)
@@ -752,6 +753,17 @@ static const struct snd_kcontrol_new da9055_dapm_mixoutr_controls[] = {
752 6, 1, 0), 753 6, 1, 0),
753}; 754};
754 755
756/* Headphone Output Enable */
757static const struct snd_kcontrol_new da9055_dapm_hp_l_control =
758SOC_DAPM_SINGLE("Switch", DA9055_HP_L_CTRL, 3, 1, 0);
759
760static const struct snd_kcontrol_new da9055_dapm_hp_r_control =
761SOC_DAPM_SINGLE("Switch", DA9055_HP_R_CTRL, 3, 1, 0);
762
763/* Lineout Output Enable */
764static const struct snd_kcontrol_new da9055_dapm_lineout_control =
765SOC_DAPM_SINGLE("Switch", DA9055_LINE_CTRL, 3, 1, 0);
766
755/* DAPM widgets */ 767/* DAPM widgets */
756static const struct snd_soc_dapm_widget da9055_dapm_widgets[] = { 768static const struct snd_soc_dapm_widget da9055_dapm_widgets[] = {
757 /* Input Side */ 769 /* Input Side */
@@ -816,6 +828,14 @@ static const struct snd_soc_dapm_widget da9055_dapm_widgets[] = {
816 &da9055_dapm_mixoutr_controls[0], 828 &da9055_dapm_mixoutr_controls[0],
817 ARRAY_SIZE(da9055_dapm_mixoutr_controls)), 829 ARRAY_SIZE(da9055_dapm_mixoutr_controls)),
818 830
831 /* Output Enable Switches */
832 SND_SOC_DAPM_SWITCH("Headphone Left Enable", SND_SOC_NOPM, 0, 0,
833 &da9055_dapm_hp_l_control),
834 SND_SOC_DAPM_SWITCH("Headphone Right Enable", SND_SOC_NOPM, 0, 0,
835 &da9055_dapm_hp_r_control),
836 SND_SOC_DAPM_SWITCH("Lineout Enable", SND_SOC_NOPM, 0, 0,
837 &da9055_dapm_lineout_control),
838
819 /* Output PGAs */ 839 /* Output PGAs */
820 SND_SOC_DAPM_PGA("MIXOUT Left", DA9055_MIXOUT_L_CTRL, 7, 0, NULL, 0), 840 SND_SOC_DAPM_PGA("MIXOUT Left", DA9055_MIXOUT_L_CTRL, 7, 0, NULL, 0),
821 SND_SOC_DAPM_PGA("MIXOUT Right", DA9055_MIXOUT_R_CTRL, 7, 0, NULL, 0), 841 SND_SOC_DAPM_PGA("MIXOUT Right", DA9055_MIXOUT_R_CTRL, 7, 0, NULL, 0),
@@ -901,17 +921,20 @@ static const struct snd_soc_dapm_route da9055_audio_map[] = {
901 {"Out Mixer Right", "DAC Right Switch", "DAC Right"}, 921 {"Out Mixer Right", "DAC Right Switch", "DAC Right"},
902 922
903 {"MIXOUT Left", NULL, "Out Mixer Left"}, 923 {"MIXOUT Left", NULL, "Out Mixer Left"},
904 {"Headphone Left", NULL, "MIXOUT Left"}, 924 {"Headphone Left Enable", "Switch", "MIXOUT Left"},
925 {"Headphone Left", NULL, "Headphone Left Enable"},
905 {"Headphone Left", NULL, "Charge Pump"}, 926 {"Headphone Left", NULL, "Charge Pump"},
906 {"HPL", NULL, "Headphone Left"}, 927 {"HPL", NULL, "Headphone Left"},
907 928
908 {"MIXOUT Right", NULL, "Out Mixer Right"}, 929 {"MIXOUT Right", NULL, "Out Mixer Right"},
909 {"Headphone Right", NULL, "MIXOUT Right"}, 930 {"Headphone Right Enable", "Switch", "MIXOUT Right"},
931 {"Headphone Right", NULL, "Headphone Right Enable"},
910 {"Headphone Right", NULL, "Charge Pump"}, 932 {"Headphone Right", NULL, "Charge Pump"},
911 {"HPR", NULL, "Headphone Right"}, 933 {"HPR", NULL, "Headphone Right"},
912 934
913 {"MIXOUT Right", NULL, "Out Mixer Right"}, 935 {"MIXOUT Right", NULL, "Out Mixer Right"},
914 {"Lineout", NULL, "MIXOUT Right"}, 936 {"Lineout Enable", "Switch", "MIXOUT Right"},
937 {"Lineout", NULL, "Lineout Enable"},
915 {"LINE", NULL, "Lineout"}, 938 {"LINE", NULL, "Lineout"},
916}; 939};
917 940
@@ -1175,6 +1198,9 @@ static int da9055_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
1175 case SND_SOC_DAIFMT_RIGHT_J: 1198 case SND_SOC_DAIFMT_RIGHT_J:
1176 aif_ctrl = DA9055_AIF_FORMAT_RIGHT_J; 1199 aif_ctrl = DA9055_AIF_FORMAT_RIGHT_J;
1177 break; 1200 break;
1201 case SND_SOC_DAIFMT_DSP_A:
1202 aif_ctrl = DA9055_AIF_FORMAT_DSP;
1203 break;
1178 default: 1204 default:
1179 return -EINVAL; 1205 return -EINVAL;
1180 } 1206 }
@@ -1390,8 +1416,7 @@ static int da9055_probe(struct snd_soc_codec *codec)
1390 DA9055_GAIN_RAMPING_EN, DA9055_GAIN_RAMPING_EN); 1416 DA9055_GAIN_RAMPING_EN, DA9055_GAIN_RAMPING_EN);
1391 1417
1392 /* 1418 /*
1393 * There are two separate control bits for input and output mixers as 1419 * There are two separate control bits for input and output mixers.
1394 * well as headphone and line outs.
1395 * One to enable corresponding amplifier and other to enable its 1420 * One to enable corresponding amplifier and other to enable its
1396 * output. As amplifier bits are related to power control, they are 1421 * output. As amplifier bits are related to power control, they are
1397 * being managed by DAPM while other (non power related) bits are 1422 * being managed by DAPM while other (non power related) bits are
@@ -1407,14 +1432,6 @@ static int da9055_probe(struct snd_soc_codec *codec)
1407 snd_soc_update_bits(codec, DA9055_MIXOUT_R_CTRL, 1432 snd_soc_update_bits(codec, DA9055_MIXOUT_R_CTRL,
1408 DA9055_MIXOUT_R_MIX_EN, DA9055_MIXOUT_R_MIX_EN); 1433 DA9055_MIXOUT_R_MIX_EN, DA9055_MIXOUT_R_MIX_EN);
1409 1434
1410 snd_soc_update_bits(codec, DA9055_HP_L_CTRL,
1411 DA9055_HP_L_AMP_OE, DA9055_HP_L_AMP_OE);
1412 snd_soc_update_bits(codec, DA9055_HP_R_CTRL,
1413 DA9055_HP_R_AMP_OE, DA9055_HP_R_AMP_OE);
1414
1415 snd_soc_update_bits(codec, DA9055_LINE_CTRL,
1416 DA9055_LINE_AMP_OE, DA9055_LINE_AMP_OE);
1417
1418 /* Set this as per your system configuration */ 1435 /* Set this as per your system configuration */
1419 snd_soc_write(codec, DA9055_PLL_CTRL, DA9055_PLL_INDIV_10_20_MHZ); 1436 snd_soc_write(codec, DA9055_PLL_CTRL, DA9055_PLL_INDIV_10_20_MHZ);
1420 1437
@@ -1467,8 +1484,8 @@ static const struct regmap_config da9055_regmap_config = {
1467 .cache_type = REGCACHE_RBTREE, 1484 .cache_type = REGCACHE_RBTREE,
1468}; 1485};
1469 1486
1470static int __devinit da9055_i2c_probe(struct i2c_client *i2c, 1487static int da9055_i2c_probe(struct i2c_client *i2c,
1471 const struct i2c_device_id *id) 1488 const struct i2c_device_id *id)
1472{ 1489{
1473 struct da9055_priv *da9055; 1490 struct da9055_priv *da9055;
1474 struct da9055_platform_data *pdata = dev_get_platdata(&i2c->dev); 1491 struct da9055_platform_data *pdata = dev_get_platdata(&i2c->dev);
@@ -1500,7 +1517,7 @@ static int __devinit da9055_i2c_probe(struct i2c_client *i2c,
1500 return ret; 1517 return ret;
1501} 1518}
1502 1519
1503static int __devexit da9055_remove(struct i2c_client *client) 1520static int da9055_remove(struct i2c_client *client)
1504{ 1521{
1505 snd_soc_unregister_codec(&client->dev); 1522 snd_soc_unregister_codec(&client->dev);
1506 return 0; 1523 return 0;
@@ -1519,7 +1536,7 @@ static struct i2c_driver da9055_i2c_driver = {
1519 .owner = THIS_MODULE, 1536 .owner = THIS_MODULE,
1520 }, 1537 },
1521 .probe = da9055_i2c_probe, 1538 .probe = da9055_i2c_probe,
1522 .remove = __devexit_p(da9055_remove), 1539 .remove = da9055_remove,
1523 .id_table = da9055_i2c_id, 1540 .id_table = da9055_i2c_id,
1524}; 1541};
1525 1542
diff --git a/sound/soc/codecs/dfbmcs320.c b/sound/soc/codecs/dfbmcs320.c
index bfe46aa90362..4f4f7f41a7d1 100644
--- a/sound/soc/codecs/dfbmcs320.c
+++ b/sound/soc/codecs/dfbmcs320.c
@@ -33,13 +33,13 @@ static struct snd_soc_dai_driver dfbmcs320_dai = {
33 33
34static struct snd_soc_codec_driver soc_codec_dev_dfbmcs320; 34static struct snd_soc_codec_driver soc_codec_dev_dfbmcs320;
35 35
36static int __devinit dfbmcs320_probe(struct platform_device *pdev) 36static int dfbmcs320_probe(struct platform_device *pdev)
37{ 37{
38 return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_dfbmcs320, 38 return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_dfbmcs320,
39 &dfbmcs320_dai, 1); 39 &dfbmcs320_dai, 1);
40} 40}
41 41
42static int __devexit dfbmcs320_remove(struct platform_device *pdev) 42static int dfbmcs320_remove(struct platform_device *pdev)
43{ 43{
44 snd_soc_unregister_codec(&pdev->dev); 44 snd_soc_unregister_codec(&pdev->dev);
45 45
@@ -52,7 +52,7 @@ static struct platform_driver dfmcs320_driver = {
52 .owner = THIS_MODULE, 52 .owner = THIS_MODULE,
53 }, 53 },
54 .probe = dfbmcs320_probe, 54 .probe = dfbmcs320_probe,
55 .remove = __devexit_p(dfbmcs320_remove), 55 .remove = dfbmcs320_remove,
56}; 56};
57 57
58module_platform_driver(dfmcs320_driver); 58module_platform_driver(dfmcs320_driver);
diff --git a/sound/soc/codecs/dmic.c b/sound/soc/codecs/dmic.c
index 3e929f079a1f..66967ba6f757 100644
--- a/sound/soc/codecs/dmic.c
+++ b/sound/soc/codecs/dmic.c
@@ -66,13 +66,13 @@ static struct snd_soc_codec_driver soc_dmic = {
66 .probe = dmic_probe, 66 .probe = dmic_probe,
67}; 67};
68 68
69static int __devinit dmic_dev_probe(struct platform_device *pdev) 69static int dmic_dev_probe(struct platform_device *pdev)
70{ 70{
71 return snd_soc_register_codec(&pdev->dev, 71 return snd_soc_register_codec(&pdev->dev,
72 &soc_dmic, &dmic_dai, 1); 72 &soc_dmic, &dmic_dai, 1);
73} 73}
74 74
75static int __devexit dmic_dev_remove(struct platform_device *pdev) 75static int dmic_dev_remove(struct platform_device *pdev)
76{ 76{
77 snd_soc_unregister_codec(&pdev->dev); 77 snd_soc_unregister_codec(&pdev->dev);
78 return 0; 78 return 0;
@@ -86,7 +86,7 @@ static struct platform_driver dmic_driver = {
86 .owner = THIS_MODULE, 86 .owner = THIS_MODULE,
87 }, 87 },
88 .probe = dmic_dev_probe, 88 .probe = dmic_dev_probe,
89 .remove = __devexit_p(dmic_dev_remove), 89 .remove = dmic_dev_remove,
90}; 90};
91 91
92module_platform_driver(dmic_driver); 92module_platform_driver(dmic_driver);
diff --git a/sound/soc/codecs/isabelle.c b/sound/soc/codecs/isabelle.c
index 1bf55602c9eb..53b455b8c07a 100644
--- a/sound/soc/codecs/isabelle.c
+++ b/sound/soc/codecs/isabelle.c
@@ -1119,8 +1119,8 @@ static const struct regmap_config isabelle_regmap_config = {
1119 .cache_type = REGCACHE_RBTREE, 1119 .cache_type = REGCACHE_RBTREE,
1120}; 1120};
1121 1121
1122static int __devinit isabelle_i2c_probe(struct i2c_client *i2c, 1122static int isabelle_i2c_probe(struct i2c_client *i2c,
1123 const struct i2c_device_id *id) 1123 const struct i2c_device_id *id)
1124{ 1124{
1125 struct regmap *isabelle_regmap; 1125 struct regmap *isabelle_regmap;
1126 int ret = 0; 1126 int ret = 0;
@@ -1145,7 +1145,7 @@ static int __devinit isabelle_i2c_probe(struct i2c_client *i2c,
1145 return ret; 1145 return ret;
1146} 1146}
1147 1147
1148static int __devexit isabelle_i2c_remove(struct i2c_client *client) 1148static int isabelle_i2c_remove(struct i2c_client *client)
1149{ 1149{
1150 snd_soc_unregister_codec(&client->dev); 1150 snd_soc_unregister_codec(&client->dev);
1151 return 0; 1151 return 0;
@@ -1163,7 +1163,7 @@ static struct i2c_driver isabelle_i2c_driver = {
1163 .owner = THIS_MODULE, 1163 .owner = THIS_MODULE,
1164 }, 1164 },
1165 .probe = isabelle_i2c_probe, 1165 .probe = isabelle_i2c_probe,
1166 .remove = __devexit_p(isabelle_i2c_remove), 1166 .remove = isabelle_i2c_remove,
1167 .id_table = isabelle_i2c_id, 1167 .id_table = isabelle_i2c_id,
1168}; 1168};
1169 1169
diff --git a/sound/soc/codecs/jz4740.c b/sound/soc/codecs/jz4740.c
index 85d9cabe6d55..d991529e1aff 100644
--- a/sound/soc/codecs/jz4740.c
+++ b/sound/soc/codecs/jz4740.c
@@ -16,6 +16,7 @@
16#include <linux/platform_device.h> 16#include <linux/platform_device.h>
17#include <linux/slab.h> 17#include <linux/slab.h>
18#include <linux/io.h> 18#include <linux/io.h>
19#include <linux/regmap.h>
19 20
20#include <linux/delay.h> 21#include <linux/delay.h>
21 22
@@ -24,9 +25,10 @@
24#include <sound/pcm_params.h> 25#include <sound/pcm_params.h>
25#include <sound/initval.h> 26#include <sound/initval.h>
26#include <sound/soc.h> 27#include <sound/soc.h>
28#include <sound/tlv.h>
27 29
28#define JZ4740_REG_CODEC_1 0x0 30#define JZ4740_REG_CODEC_1 0x0
29#define JZ4740_REG_CODEC_2 0x1 31#define JZ4740_REG_CODEC_2 0x4
30 32
31#define JZ4740_CODEC_1_LINE_ENABLE BIT(29) 33#define JZ4740_CODEC_1_LINE_ENABLE BIT(29)
32#define JZ4740_CODEC_1_MIC_ENABLE BIT(28) 34#define JZ4740_CODEC_1_MIC_ENABLE BIT(28)
@@ -67,43 +69,36 @@
67#define JZ4740_CODEC_2_MIC_BOOST_GAIN_OFFSET 4 69#define JZ4740_CODEC_2_MIC_BOOST_GAIN_OFFSET 4
68#define JZ4740_CODEC_2_HEADPHONE_VOLUME_OFFSET 0 70#define JZ4740_CODEC_2_HEADPHONE_VOLUME_OFFSET 0
69 71
70static const uint32_t jz4740_codec_regs[] = { 72static const struct reg_default jz4740_codec_reg_defaults[] = {
71 0x021b2302, 0x00170803, 73 { JZ4740_REG_CODEC_1, 0x021b2302 },
74 { JZ4740_REG_CODEC_2, 0x00170803 },
72}; 75};
73 76
74struct jz4740_codec { 77struct jz4740_codec {
75 void __iomem *base; 78 struct regmap *regmap;
76 struct resource *mem;
77}; 79};
78 80
79static unsigned int jz4740_codec_read(struct snd_soc_codec *codec, 81static const unsigned int jz4740_mic_tlv[] = {
80 unsigned int reg) 82 TLV_DB_RANGE_HEAD(2),
81{ 83 0, 2, TLV_DB_SCALE_ITEM(0, 600, 0),
82 struct jz4740_codec *jz4740_codec = snd_soc_codec_get_drvdata(codec); 84 3, 3, TLV_DB_SCALE_ITEM(2000, 0, 0),
83 return readl(jz4740_codec->base + (reg << 2)); 85};
84}
85
86static int jz4740_codec_write(struct snd_soc_codec *codec, unsigned int reg,
87 unsigned int val)
88{
89 struct jz4740_codec *jz4740_codec = snd_soc_codec_get_drvdata(codec);
90 u32 *cache = codec->reg_cache;
91
92 cache[reg] = val;
93 writel(val, jz4740_codec->base + (reg << 2));
94 86
95 return 0; 87static const DECLARE_TLV_DB_SCALE(jz4740_out_tlv, 0, 200, 0);
96} 88static const DECLARE_TLV_DB_SCALE(jz4740_in_tlv, -3450, 150, 0);
97 89
98static const struct snd_kcontrol_new jz4740_codec_controls[] = { 90static const struct snd_kcontrol_new jz4740_codec_controls[] = {
99 SOC_SINGLE("Master Playback Volume", JZ4740_REG_CODEC_2, 91 SOC_SINGLE_TLV("Master Playback Volume", JZ4740_REG_CODEC_2,
100 JZ4740_CODEC_2_HEADPHONE_VOLUME_OFFSET, 3, 0), 92 JZ4740_CODEC_2_HEADPHONE_VOLUME_OFFSET, 3, 0,
101 SOC_SINGLE("Master Capture Volume", JZ4740_REG_CODEC_2, 93 jz4740_out_tlv),
102 JZ4740_CODEC_2_INPUT_VOLUME_OFFSET, 31, 0), 94 SOC_SINGLE_TLV("Master Capture Volume", JZ4740_REG_CODEC_2,
95 JZ4740_CODEC_2_INPUT_VOLUME_OFFSET, 31, 0,
96 jz4740_in_tlv),
103 SOC_SINGLE("Master Playback Switch", JZ4740_REG_CODEC_1, 97 SOC_SINGLE("Master Playback Switch", JZ4740_REG_CODEC_1,
104 JZ4740_CODEC_1_HEADPHONE_DISABLE_OFFSET, 1, 1), 98 JZ4740_CODEC_1_HEADPHONE_DISABLE_OFFSET, 1, 1),
105 SOC_SINGLE("Mic Capture Volume", JZ4740_REG_CODEC_2, 99 SOC_SINGLE_TLV("Mic Capture Volume", JZ4740_REG_CODEC_2,
106 JZ4740_CODEC_2_MIC_BOOST_GAIN_OFFSET, 3, 0), 100 JZ4740_CODEC_2_MIC_BOOST_GAIN_OFFSET, 3, 0,
101 jz4740_mic_tlv),
107}; 102};
108 103
109static const struct snd_kcontrol_new jz4740_codec_output_controls[] = { 104static const struct snd_kcontrol_new jz4740_codec_output_controls[] = {
@@ -163,8 +158,8 @@ static const struct snd_soc_dapm_route jz4740_codec_dapm_routes[] = {
163static int jz4740_codec_hw_params(struct snd_pcm_substream *substream, 158static int jz4740_codec_hw_params(struct snd_pcm_substream *substream,
164 struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) 159 struct snd_pcm_hw_params *params, struct snd_soc_dai *dai)
165{ 160{
161 struct jz4740_codec *jz4740_codec = snd_soc_codec_get_drvdata(dai->codec);
166 uint32_t val; 162 uint32_t val;
167 struct snd_soc_codec *codec = dai->codec;
168 163
169 switch (params_rate(params)) { 164 switch (params_rate(params)) {
170 case 8000: 165 case 8000:
@@ -200,7 +195,7 @@ static int jz4740_codec_hw_params(struct snd_pcm_substream *substream,
200 195
201 val <<= JZ4740_CODEC_2_SAMPLE_RATE_OFFSET; 196 val <<= JZ4740_CODEC_2_SAMPLE_RATE_OFFSET;
202 197
203 snd_soc_update_bits(codec, JZ4740_REG_CODEC_2, 198 regmap_update_bits(jz4740_codec->regmap, JZ4740_REG_CODEC_2,
204 JZ4740_CODEC_2_SAMPLE_RATE_MASK, val); 199 JZ4740_CODEC_2_SAMPLE_RATE_MASK, val);
205 200
206 return 0; 201 return 0;
@@ -230,25 +225,23 @@ static struct snd_soc_dai_driver jz4740_codec_dai = {
230 .symmetric_rates = 1, 225 .symmetric_rates = 1,
231}; 226};
232 227
233static void jz4740_codec_wakeup(struct snd_soc_codec *codec) 228static void jz4740_codec_wakeup(struct regmap *regmap)
234{ 229{
235 int i; 230 regmap_update_bits(regmap, JZ4740_REG_CODEC_1,
236 uint32_t *cache = codec->reg_cache;
237
238 snd_soc_update_bits(codec, JZ4740_REG_CODEC_1,
239 JZ4740_CODEC_1_RESET, JZ4740_CODEC_1_RESET); 231 JZ4740_CODEC_1_RESET, JZ4740_CODEC_1_RESET);
240 udelay(2); 232 udelay(2);
241 233
242 snd_soc_update_bits(codec, JZ4740_REG_CODEC_1, 234 regmap_update_bits(regmap, JZ4740_REG_CODEC_1,
243 JZ4740_CODEC_1_SUSPEND | JZ4740_CODEC_1_RESET, 0); 235 JZ4740_CODEC_1_SUSPEND | JZ4740_CODEC_1_RESET, 0);
244 236
245 for (i = 0; i < ARRAY_SIZE(jz4740_codec_regs); ++i) 237 regcache_sync(regmap);
246 jz4740_codec_write(codec, i, cache[i]);
247} 238}
248 239
249static int jz4740_codec_set_bias_level(struct snd_soc_codec *codec, 240static int jz4740_codec_set_bias_level(struct snd_soc_codec *codec,
250 enum snd_soc_bias_level level) 241 enum snd_soc_bias_level level)
251{ 242{
243 struct jz4740_codec *jz4740_codec = snd_soc_codec_get_drvdata(codec);
244 struct regmap *regmap = jz4740_codec->regmap;
252 unsigned int mask; 245 unsigned int mask;
253 unsigned int value; 246 unsigned int value;
254 247
@@ -261,12 +254,12 @@ static int jz4740_codec_set_bias_level(struct snd_soc_codec *codec,
261 JZ4740_CODEC_1_HEADPHONE_POWERDOWN_M; 254 JZ4740_CODEC_1_HEADPHONE_POWERDOWN_M;
262 value = 0; 255 value = 0;
263 256
264 snd_soc_update_bits(codec, JZ4740_REG_CODEC_1, mask, value); 257 regmap_update_bits(regmap, JZ4740_REG_CODEC_1, mask, value);
265 break; 258 break;
266 case SND_SOC_BIAS_STANDBY: 259 case SND_SOC_BIAS_STANDBY:
267 /* The only way to clear the suspend flag is to reset the codec */ 260 /* The only way to clear the suspend flag is to reset the codec */
268 if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) 261 if (codec->dapm.bias_level == SND_SOC_BIAS_OFF)
269 jz4740_codec_wakeup(codec); 262 jz4740_codec_wakeup(regmap);
270 263
271 mask = JZ4740_CODEC_1_VREF_DISABLE | 264 mask = JZ4740_CODEC_1_VREF_DISABLE |
272 JZ4740_CODEC_1_VREF_AMP_DISABLE | 265 JZ4740_CODEC_1_VREF_AMP_DISABLE |
@@ -275,13 +268,14 @@ static int jz4740_codec_set_bias_level(struct snd_soc_codec *codec,
275 JZ4740_CODEC_1_VREF_AMP_DISABLE | 268 JZ4740_CODEC_1_VREF_AMP_DISABLE |
276 JZ4740_CODEC_1_HEADPHONE_POWERDOWN_M; 269 JZ4740_CODEC_1_HEADPHONE_POWERDOWN_M;
277 270
278 snd_soc_update_bits(codec, JZ4740_REG_CODEC_1, mask, value); 271 regmap_update_bits(regmap, JZ4740_REG_CODEC_1, mask, value);
279 break; 272 break;
280 case SND_SOC_BIAS_OFF: 273 case SND_SOC_BIAS_OFF:
281 mask = JZ4740_CODEC_1_SUSPEND; 274 mask = JZ4740_CODEC_1_SUSPEND;
282 value = JZ4740_CODEC_1_SUSPEND; 275 value = JZ4740_CODEC_1_SUSPEND;
283 276
284 snd_soc_update_bits(codec, JZ4740_REG_CODEC_1, mask, value); 277 regmap_update_bits(regmap, JZ4740_REG_CODEC_1, mask, value);
278 regcache_mark_dirty(regmap);
285 break; 279 break;
286 default: 280 default:
287 break; 281 break;
@@ -294,7 +288,9 @@ static int jz4740_codec_set_bias_level(struct snd_soc_codec *codec,
294 288
295static int jz4740_codec_dev_probe(struct snd_soc_codec *codec) 289static int jz4740_codec_dev_probe(struct snd_soc_codec *codec)
296{ 290{
297 snd_soc_update_bits(codec, JZ4740_REG_CODEC_1, 291 struct jz4740_codec *jz4740_codec = snd_soc_codec_get_drvdata(codec);
292
293 regmap_update_bits(jz4740_codec->regmap, JZ4740_REG_CODEC_1,
298 JZ4740_CODEC_1_SW2_ENABLE, JZ4740_CODEC_1_SW2_ENABLE); 294 JZ4740_CODEC_1_SW2_ENABLE, JZ4740_CODEC_1_SW2_ENABLE);
299 295
300 jz4740_codec_set_bias_level(codec, SND_SOC_BIAS_STANDBY); 296 jz4740_codec_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
@@ -331,12 +327,7 @@ static struct snd_soc_codec_driver soc_codec_dev_jz4740_codec = {
331 .remove = jz4740_codec_dev_remove, 327 .remove = jz4740_codec_dev_remove,
332 .suspend = jz4740_codec_suspend, 328 .suspend = jz4740_codec_suspend,
333 .resume = jz4740_codec_resume, 329 .resume = jz4740_codec_resume,
334 .read = jz4740_codec_read,
335 .write = jz4740_codec_write,
336 .set_bias_level = jz4740_codec_set_bias_level, 330 .set_bias_level = jz4740_codec_set_bias_level,
337 .reg_cache_default = jz4740_codec_regs,
338 .reg_word_size = sizeof(u32),
339 .reg_cache_size = 2,
340 331
341 .controls = jz4740_codec_controls, 332 .controls = jz4740_codec_controls,
342 .num_controls = ARRAY_SIZE(jz4740_codec_controls), 333 .num_controls = ARRAY_SIZE(jz4740_codec_controls),
@@ -346,11 +337,23 @@ static struct snd_soc_codec_driver soc_codec_dev_jz4740_codec = {
346 .num_dapm_routes = ARRAY_SIZE(jz4740_codec_dapm_routes), 337 .num_dapm_routes = ARRAY_SIZE(jz4740_codec_dapm_routes),
347}; 338};
348 339
349static int __devinit jz4740_codec_probe(struct platform_device *pdev) 340static const struct regmap_config jz4740_codec_regmap_config = {
341 .reg_bits = 32,
342 .reg_stride = 4,
343 .val_bits = 32,
344 .max_register = JZ4740_REG_CODEC_2,
345
346 .reg_defaults = jz4740_codec_reg_defaults,
347 .num_reg_defaults = ARRAY_SIZE(jz4740_codec_reg_defaults),
348 .cache_type = REGCACHE_RBTREE,
349};
350
351static int jz4740_codec_probe(struct platform_device *pdev)
350{ 352{
351 int ret; 353 int ret;
352 struct jz4740_codec *jz4740_codec; 354 struct jz4740_codec *jz4740_codec;
353 struct resource *mem; 355 struct resource *mem;
356 void __iomem *base;
354 357
355 jz4740_codec = devm_kzalloc(&pdev->dev, sizeof(*jz4740_codec), 358 jz4740_codec = devm_kzalloc(&pdev->dev, sizeof(*jz4740_codec),
356 GFP_KERNEL); 359 GFP_KERNEL);
@@ -358,56 +361,29 @@ static int __devinit jz4740_codec_probe(struct platform_device *pdev)
358 return -ENOMEM; 361 return -ENOMEM;
359 362
360 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); 363 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
361 if (!mem) { 364 base = devm_request_and_ioremap(&pdev->dev, mem);
362 dev_err(&pdev->dev, "Failed to get mmio memory resource\n"); 365 if (!base)
363 ret = -ENOENT; 366 return -EBUSY;
364 goto err_out;
365 }
366
367 mem = request_mem_region(mem->start, resource_size(mem), pdev->name);
368 if (!mem) {
369 dev_err(&pdev->dev, "Failed to request mmio memory region\n");
370 ret = -EBUSY;
371 goto err_out;
372 }
373 367
374 jz4740_codec->base = ioremap(mem->start, resource_size(mem)); 368 jz4740_codec->regmap = devm_regmap_init_mmio(&pdev->dev, base,
375 if (!jz4740_codec->base) { 369 &jz4740_codec_regmap_config);
376 dev_err(&pdev->dev, "Failed to ioremap mmio memory\n"); 370 if (IS_ERR(jz4740_codec->regmap))
377 ret = -EBUSY; 371 return PTR_ERR(jz4740_codec->regmap);
378 goto err_release_mem_region;
379 }
380 jz4740_codec->mem = mem;
381 372
382 platform_set_drvdata(pdev, jz4740_codec); 373 platform_set_drvdata(pdev, jz4740_codec);
383 374
384 ret = snd_soc_register_codec(&pdev->dev, 375 ret = snd_soc_register_codec(&pdev->dev,
385 &soc_codec_dev_jz4740_codec, &jz4740_codec_dai, 1); 376 &soc_codec_dev_jz4740_codec, &jz4740_codec_dai, 1);
386 if (ret) { 377 if (ret)
387 dev_err(&pdev->dev, "Failed to register codec\n"); 378 dev_err(&pdev->dev, "Failed to register codec\n");
388 goto err_iounmap;
389 }
390 379
391 return 0;
392
393err_iounmap:
394 iounmap(jz4740_codec->base);
395err_release_mem_region:
396 release_mem_region(mem->start, resource_size(mem));
397err_out:
398 return ret; 380 return ret;
399} 381}
400 382
401static int __devexit jz4740_codec_remove(struct platform_device *pdev) 383static int jz4740_codec_remove(struct platform_device *pdev)
402{ 384{
403 struct jz4740_codec *jz4740_codec = platform_get_drvdata(pdev);
404 struct resource *mem = jz4740_codec->mem;
405
406 snd_soc_unregister_codec(&pdev->dev); 385 snd_soc_unregister_codec(&pdev->dev);
407 386
408 iounmap(jz4740_codec->base);
409 release_mem_region(mem->start, resource_size(mem));
410
411 platform_set_drvdata(pdev, NULL); 387 platform_set_drvdata(pdev, NULL);
412 388
413 return 0; 389 return 0;
@@ -415,7 +391,7 @@ static int __devexit jz4740_codec_remove(struct platform_device *pdev)
415 391
416static struct platform_driver jz4740_codec_driver = { 392static struct platform_driver jz4740_codec_driver = {
417 .probe = jz4740_codec_probe, 393 .probe = jz4740_codec_probe,
418 .remove = __devexit_p(jz4740_codec_remove), 394 .remove = jz4740_codec_remove,
419 .driver = { 395 .driver = {
420 .name = "jz4740-codec", 396 .name = "jz4740-codec",
421 .owner = THIS_MODULE, 397 .owner = THIS_MODULE,
diff --git a/sound/soc/codecs/lm4857.c b/sound/soc/codecs/lm4857.c
index 81a328c78838..9f9f59573f72 100644
--- a/sound/soc/codecs/lm4857.c
+++ b/sound/soc/codecs/lm4857.c
@@ -209,8 +209,8 @@ static struct snd_soc_codec_driver soc_codec_dev_lm4857 = {
209 .set_bias_level = lm4857_set_bias_level, 209 .set_bias_level = lm4857_set_bias_level,
210}; 210};
211 211
212static int __devinit lm4857_i2c_probe(struct i2c_client *i2c, 212static int lm4857_i2c_probe(struct i2c_client *i2c,
213 const struct i2c_device_id *id) 213 const struct i2c_device_id *id)
214{ 214{
215 struct lm4857 *lm4857; 215 struct lm4857 *lm4857;
216 int ret; 216 int ret;
@@ -228,7 +228,7 @@ static int __devinit lm4857_i2c_probe(struct i2c_client *i2c,
228 return ret; 228 return ret;
229} 229}
230 230
231static int __devexit lm4857_i2c_remove(struct i2c_client *i2c) 231static int lm4857_i2c_remove(struct i2c_client *i2c)
232{ 232{
233 snd_soc_unregister_codec(&i2c->dev); 233 snd_soc_unregister_codec(&i2c->dev);
234 return 0; 234 return 0;
@@ -246,7 +246,7 @@ static struct i2c_driver lm4857_i2c_driver = {
246 .owner = THIS_MODULE, 246 .owner = THIS_MODULE,
247 }, 247 },
248 .probe = lm4857_i2c_probe, 248 .probe = lm4857_i2c_probe,
249 .remove = __devexit_p(lm4857_i2c_remove), 249 .remove = lm4857_i2c_remove,
250 .id_table = lm4857_i2c_id, 250 .id_table = lm4857_i2c_id,
251}; 251};
252 252
diff --git a/sound/soc/codecs/lm49453.c b/sound/soc/codecs/lm49453.c
index 99b0a9dcff34..d75257d40a49 100644
--- a/sound/soc/codecs/lm49453.c
+++ b/sound/soc/codecs/lm49453.c
@@ -1483,8 +1483,8 @@ static const struct regmap_config lm49453_regmap_config = {
1483 .cache_type = REGCACHE_RBTREE, 1483 .cache_type = REGCACHE_RBTREE,
1484}; 1484};
1485 1485
1486static __devinit int lm49453_i2c_probe(struct i2c_client *i2c, 1486static int lm49453_i2c_probe(struct i2c_client *i2c,
1487 const struct i2c_device_id *id) 1487 const struct i2c_device_id *id)
1488{ 1488{
1489 struct lm49453_priv *lm49453; 1489 struct lm49453_priv *lm49453;
1490 int ret = 0; 1490 int ret = 0;
@@ -1497,7 +1497,7 @@ static __devinit int lm49453_i2c_probe(struct i2c_client *i2c,
1497 1497
1498 i2c_set_clientdata(i2c, lm49453); 1498 i2c_set_clientdata(i2c, lm49453);
1499 1499
1500 lm49453->regmap = regmap_init_i2c(i2c, &lm49453_regmap_config); 1500 lm49453->regmap = devm_regmap_init_i2c(i2c, &lm49453_regmap_config);
1501 if (IS_ERR(lm49453->regmap)) { 1501 if (IS_ERR(lm49453->regmap)) {
1502 ret = PTR_ERR(lm49453->regmap); 1502 ret = PTR_ERR(lm49453->regmap);
1503 dev_err(&i2c->dev, "Failed to allocate register map: %d\n", 1503 dev_err(&i2c->dev, "Failed to allocate register map: %d\n",
@@ -1508,21 +1508,15 @@ static __devinit int lm49453_i2c_probe(struct i2c_client *i2c,
1508 ret = snd_soc_register_codec(&i2c->dev, 1508 ret = snd_soc_register_codec(&i2c->dev,
1509 &soc_codec_dev_lm49453, 1509 &soc_codec_dev_lm49453,
1510 lm49453_dai, ARRAY_SIZE(lm49453_dai)); 1510 lm49453_dai, ARRAY_SIZE(lm49453_dai));
1511 if (ret < 0) { 1511 if (ret < 0)
1512 dev_err(&i2c->dev, "Failed to register codec: %d\n", ret); 1512 dev_err(&i2c->dev, "Failed to register codec: %d\n", ret);
1513 regmap_exit(lm49453->regmap);
1514 return ret;
1515 }
1516 1513
1517 return ret; 1514 return ret;
1518} 1515}
1519 1516
1520static int __devexit lm49453_i2c_remove(struct i2c_client *client) 1517static int lm49453_i2c_remove(struct i2c_client *client)
1521{ 1518{
1522 struct lm49453_priv *lm49453 = i2c_get_clientdata(client);
1523
1524 snd_soc_unregister_codec(&client->dev); 1519 snd_soc_unregister_codec(&client->dev);
1525 regmap_exit(lm49453->regmap);
1526 return 0; 1520 return 0;
1527} 1521}
1528 1522
@@ -1538,7 +1532,7 @@ static struct i2c_driver lm49453_i2c_driver = {
1538 .owner = THIS_MODULE, 1532 .owner = THIS_MODULE,
1539 }, 1533 },
1540 .probe = lm49453_i2c_probe, 1534 .probe = lm49453_i2c_probe,
1541 .remove = __devexit_p(lm49453_i2c_remove), 1535 .remove = lm49453_i2c_remove,
1542 .id_table = lm49453_i2c_id, 1536 .id_table = lm49453_i2c_id,
1543}; 1537};
1544 1538
diff --git a/sound/soc/codecs/max9768.c b/sound/soc/codecs/max9768.c
index 17b3ec2d05cb..a6ac2313047d 100644
--- a/sound/soc/codecs/max9768.c
+++ b/sound/soc/codecs/max9768.c
@@ -159,8 +159,8 @@ static const struct regmap_config max9768_i2c_regmap_config = {
159 .cache_type = REGCACHE_RBTREE, 159 .cache_type = REGCACHE_RBTREE,
160}; 160};
161 161
162static int __devinit max9768_i2c_probe(struct i2c_client *client, 162static int max9768_i2c_probe(struct i2c_client *client,
163 const struct i2c_device_id *id) 163 const struct i2c_device_id *id)
164{ 164{
165 struct max9768 *max9768; 165 struct max9768 *max9768;
166 struct max9768_pdata *pdata = client->dev.platform_data; 166 struct max9768_pdata *pdata = client->dev.platform_data;
@@ -187,7 +187,7 @@ static int __devinit max9768_i2c_probe(struct i2c_client *client,
187 187
188 i2c_set_clientdata(client, max9768); 188 i2c_set_clientdata(client, max9768);
189 189
190 max9768->regmap = regmap_init_i2c(client, &max9768_i2c_regmap_config); 190 max9768->regmap = devm_regmap_init_i2c(client, &max9768_i2c_regmap_config);
191 if (IS_ERR(max9768->regmap)) { 191 if (IS_ERR(max9768->regmap)) {
192 err = PTR_ERR(max9768->regmap); 192 err = PTR_ERR(max9768->regmap);
193 goto err_gpio_free; 193 goto err_gpio_free;
@@ -195,12 +195,10 @@ static int __devinit max9768_i2c_probe(struct i2c_client *client,
195 195
196 err = snd_soc_register_codec(&client->dev, &max9768_codec_driver, NULL, 0); 196 err = snd_soc_register_codec(&client->dev, &max9768_codec_driver, NULL, 0);
197 if (err) 197 if (err)
198 goto err_regmap_free; 198 goto err_gpio_free;
199 199
200 return 0; 200 return 0;
201 201
202 err_regmap_free:
203 regmap_exit(max9768->regmap);
204 err_gpio_free: 202 err_gpio_free:
205 if (gpio_is_valid(max9768->shdn_gpio)) 203 if (gpio_is_valid(max9768->shdn_gpio))
206 gpio_free(max9768->shdn_gpio); 204 gpio_free(max9768->shdn_gpio);
@@ -210,12 +208,11 @@ static int __devinit max9768_i2c_probe(struct i2c_client *client,
210 return err; 208 return err;
211} 209}
212 210
213static int __devexit max9768_i2c_remove(struct i2c_client *client) 211static int max9768_i2c_remove(struct i2c_client *client)
214{ 212{
215 struct max9768 *max9768 = i2c_get_clientdata(client); 213 struct max9768 *max9768 = i2c_get_clientdata(client);
216 214
217 snd_soc_unregister_codec(&client->dev); 215 snd_soc_unregister_codec(&client->dev);
218 regmap_exit(max9768->regmap);
219 216
220 if (gpio_is_valid(max9768->shdn_gpio)) 217 if (gpio_is_valid(max9768->shdn_gpio))
221 gpio_free(max9768->shdn_gpio); 218 gpio_free(max9768->shdn_gpio);
@@ -237,7 +234,7 @@ static struct i2c_driver max9768_i2c_driver = {
237 .owner = THIS_MODULE, 234 .owner = THIS_MODULE,
238 }, 235 },
239 .probe = max9768_i2c_probe, 236 .probe = max9768_i2c_probe,
240 .remove = __devexit_p(max9768_i2c_remove), 237 .remove = max9768_i2c_remove,
241 .id_table = max9768_i2c_id, 238 .id_table = max9768_i2c_id,
242}; 239};
243module_i2c_driver(max9768_i2c_driver); 240module_i2c_driver(max9768_i2c_driver);
diff --git a/sound/soc/codecs/max98088.c b/sound/soc/codecs/max98088.c
index 3264a5169306..a4c16fd70f77 100644
--- a/sound/soc/codecs/max98088.c
+++ b/sound/soc/codecs/max98088.c
@@ -2084,7 +2084,7 @@ static int max98088_i2c_probe(struct i2c_client *i2c,
2084 return ret; 2084 return ret;
2085} 2085}
2086 2086
2087static int __devexit max98088_i2c_remove(struct i2c_client *client) 2087static int max98088_i2c_remove(struct i2c_client *client)
2088{ 2088{
2089 snd_soc_unregister_codec(&client->dev); 2089 snd_soc_unregister_codec(&client->dev);
2090 return 0; 2090 return 0;
@@ -2098,13 +2098,13 @@ static const struct i2c_device_id max98088_i2c_id[] = {
2098MODULE_DEVICE_TABLE(i2c, max98088_i2c_id); 2098MODULE_DEVICE_TABLE(i2c, max98088_i2c_id);
2099 2099
2100static struct i2c_driver max98088_i2c_driver = { 2100static struct i2c_driver max98088_i2c_driver = {
2101 .driver = { 2101 .driver = {
2102 .name = "max98088", 2102 .name = "max98088",
2103 .owner = THIS_MODULE, 2103 .owner = THIS_MODULE,
2104 }, 2104 },
2105 .probe = max98088_i2c_probe, 2105 .probe = max98088_i2c_probe,
2106 .remove = __devexit_p(max98088_i2c_remove), 2106 .remove = max98088_i2c_remove,
2107 .id_table = max98088_i2c_id, 2107 .id_table = max98088_i2c_id,
2108}; 2108};
2109 2109
2110module_i2c_driver(max98088_i2c_driver); 2110module_i2c_driver(max98088_i2c_driver);
diff --git a/sound/soc/codecs/max98090.c b/sound/soc/codecs/max98090.c
new file mode 100644
index 000000000000..c9772ca3da4f
--- /dev/null
+++ b/sound/soc/codecs/max98090.c
@@ -0,0 +1,577 @@
1/*
2 * max98090.c -- MAX98090 ALSA SoC Audio driver
3 * based on Rev0p8 datasheet
4 *
5 * Copyright (C) 2012 Renesas Solutions Corp.
6 * Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
7 *
8 * Based on
9 *
10 * max98095.c
11 * Copyright 2011 Maxim Integrated Products
12 *
13 * https://github.com/hardkernel/linux/commit/\
14 * 3417d7166b17113b3b33b0a337c74d1c7cc313df#sound/soc/codecs/max98090.c
15 * Copyright 2011 Maxim Integrated Products
16 *
17 * This program is free software; you can redistribute it and/or modify
18 * it under the terms of the GNU General Public License version 2 as
19 * published by the Free Software Foundation.
20 */
21
22#include <linux/i2c.h>
23#include <linux/module.h>
24#include <linux/regmap.h>
25#include <sound/soc.h>
26#include <sound/tlv.h>
27
28/*
29 *
30 * MAX98090 Registers Definition
31 *
32 */
33
34/* RESET / STATUS / INTERRUPT REGISTERS */
35#define MAX98090_0x00_SW_RESET 0x00
36#define MAX98090_0x01_INT_STS 0x01
37#define MAX98090_0x02_JACK_STS 0x02
38#define MAX98090_0x03_INT_MASK 0x03
39
40/* QUICK SETUP REGISTERS */
41#define MAX98090_0x04_SYS_CLK 0x04
42#define MAX98090_0x05_SAMPLE_RATE 0x05
43#define MAX98090_0x06_DAI_IF 0x06
44#define MAX98090_0x07_DAC_PATH 0x07
45#define MAX98090_0x08_MIC_TO_ADC 0x08
46#define MAX98090_0x09_LINE_TO_ADC 0x09
47#define MAX98090_0x0A_ANALOG_MIC_LOOP 0x0A
48#define MAX98090_0x0B_ANALOG_LINE_LOOP 0x0B
49
50/* ANALOG INPUT CONFIGURATION REGISTERS */
51#define MAX98090_0x0D_INPUT_CONFIG 0x0D
52#define MAX98090_0x0E_LINE_IN_LVL 0x0E
53#define MAX98090_0x0F_LINI_IN_CFG 0x0F
54#define MAX98090_0x10_MIC1_IN_LVL 0x10
55#define MAX98090_0x11_MIC2_IN_LVL 0x11
56
57/* MICROPHONE CONFIGURATION REGISTERS */
58#define MAX98090_0x12_MIC_BIAS_VOL 0x12
59#define MAX98090_0x13_DIGITAL_MIC_CFG 0x13
60#define MAX98090_0x14_DIGITAL_MIC_MODE 0x14
61
62/* ADC PATH AND CONFIGURATION REGISTERS */
63#define MAX98090_0x15_L_ADC_MIX 0x15
64#define MAX98090_0x16_R_ADC_MIX 0x16
65#define MAX98090_0x17_L_ADC_LVL 0x17
66#define MAX98090_0x18_R_ADC_LVL 0x18
67#define MAX98090_0x19_ADC_BIQUAD_LVL 0x19
68#define MAX98090_0x1A_ADC_SIDETONE 0x1A
69
70/* CLOCK CONFIGURATION REGISTERS */
71#define MAX98090_0x1B_SYS_CLK 0x1B
72#define MAX98090_0x1C_CLK_MODE 0x1C
73#define MAX98090_0x1D_ANY_CLK1 0x1D
74#define MAX98090_0x1E_ANY_CLK2 0x1E
75#define MAX98090_0x1F_ANY_CLK3 0x1F
76#define MAX98090_0x20_ANY_CLK4 0x20
77#define MAX98090_0x21_MASTER_MODE 0x21
78
79/* INTERFACE CONTROL REGISTERS */
80#define MAX98090_0x22_DAI_IF_FMT 0x22
81#define MAX98090_0x23_DAI_TDM_FMT1 0x23
82#define MAX98090_0x24_DAI_TDM_FMT2 0x24
83#define MAX98090_0x25_DAI_IO_CFG 0x25
84#define MAX98090_0x26_FILTER_CFG 0x26
85#define MAX98090_0x27_DAI_PLAYBACK_LVL 0x27
86#define MAX98090_0x28_EQ_PLAYBACK_LVL 0x28
87
88/* HEADPHONE CONTROL REGISTERS */
89#define MAX98090_0x29_L_HP_MIX 0x29
90#define MAX98090_0x2A_R_HP_MIX 0x2A
91#define MAX98090_0x2B_HP_CTR 0x2B
92#define MAX98090_0x2C_L_HP_VOL 0x2C
93#define MAX98090_0x2D_R_HP_VOL 0x2D
94
95/* SPEAKER CONFIGURATION REGISTERS */
96#define MAX98090_0x2E_L_SPK_MIX 0x2E
97#define MAX98090_0x2F_R_SPK_MIX 0x2F
98#define MAX98090_0x30_SPK_CTR 0x30
99#define MAX98090_0x31_L_SPK_VOL 0x31
100#define MAX98090_0x32_R_SPK_VOL 0x32
101
102/* ALC CONFIGURATION REGISTERS */
103#define MAX98090_0x33_ALC_TIMING 0x33
104#define MAX98090_0x34_ALC_COMPRESSOR 0x34
105#define MAX98090_0x35_ALC_EXPANDER 0x35
106#define MAX98090_0x36_ALC_GAIN 0x36
107
108/* RECEIVER AND LINE_OUTPUT REGISTERS */
109#define MAX98090_0x37_RCV_LOUT_L_MIX 0x37
110#define MAX98090_0x38_RCV_LOUT_L_CNTL 0x38
111#define MAX98090_0x39_RCV_LOUT_L_VOL 0x39
112#define MAX98090_0x3A_LOUT_R_MIX 0x3A
113#define MAX98090_0x3B_LOUT_R_CNTL 0x3B
114#define MAX98090_0x3C_LOUT_R_VOL 0x3C
115
116/* JACK DETECT AND ENABLE REGISTERS */
117#define MAX98090_0x3D_JACK_DETECT 0x3D
118#define MAX98090_0x3E_IN_ENABLE 0x3E
119#define MAX98090_0x3F_OUT_ENABLE 0x3F
120#define MAX98090_0x40_LVL_CTR 0x40
121#define MAX98090_0x41_DSP_FILTER_ENABLE 0x41
122
123/* BIAS AND POWER MODE CONFIGURATION REGISTERS */
124#define MAX98090_0x42_BIAS_CTR 0x42
125#define MAX98090_0x43_DAC_CTR 0x43
126#define MAX98090_0x44_ADC_CTR 0x44
127#define MAX98090_0x45_DEV_SHUTDOWN 0x45
128
129/* REVISION ID REGISTER */
130#define MAX98090_0xFF_REV_ID 0xFF
131
132#define MAX98090_REG_MAX_CACHED 0x45
133#define MAX98090_REG_END 0xFF
134
135/*
136 *
137 * MAX98090 Registers Bit Fields
138 *
139 */
140
141/* MAX98090_0x06_DAI_IF */
142#define MAX98090_DAI_IF_MASK 0x3F
143#define MAX98090_RJ_M (1 << 5)
144#define MAX98090_RJ_S (1 << 4)
145#define MAX98090_LJ_M (1 << 3)
146#define MAX98090_LJ_S (1 << 2)
147#define MAX98090_I2S_M (1 << 1)
148#define MAX98090_I2S_S (1 << 0)
149
150/* MAX98090_0x45_DEV_SHUTDOWN */
151#define MAX98090_SHDNRUN (1 << 7)
152
153/* codec private data */
154struct max98090_priv {
155 struct regmap *regmap;
156};
157
158static const struct reg_default max98090_reg_defaults[] = {
159 /* RESET / STATUS / INTERRUPT REGISTERS */
160 {MAX98090_0x00_SW_RESET, 0x00},
161 {MAX98090_0x01_INT_STS, 0x00},
162 {MAX98090_0x02_JACK_STS, 0x00},
163 {MAX98090_0x03_INT_MASK, 0x04},
164
165 /* QUICK SETUP REGISTERS */
166 {MAX98090_0x04_SYS_CLK, 0x00},
167 {MAX98090_0x05_SAMPLE_RATE, 0x00},
168 {MAX98090_0x06_DAI_IF, 0x00},
169 {MAX98090_0x07_DAC_PATH, 0x00},
170 {MAX98090_0x08_MIC_TO_ADC, 0x00},
171 {MAX98090_0x09_LINE_TO_ADC, 0x00},
172 {MAX98090_0x0A_ANALOG_MIC_LOOP, 0x00},
173 {MAX98090_0x0B_ANALOG_LINE_LOOP, 0x00},
174
175 /* ANALOG INPUT CONFIGURATION REGISTERS */
176 {MAX98090_0x0D_INPUT_CONFIG, 0x00},
177 {MAX98090_0x0E_LINE_IN_LVL, 0x1B},
178 {MAX98090_0x0F_LINI_IN_CFG, 0x00},
179 {MAX98090_0x10_MIC1_IN_LVL, 0x11},
180 {MAX98090_0x11_MIC2_IN_LVL, 0x11},
181
182 /* MICROPHONE CONFIGURATION REGISTERS */
183 {MAX98090_0x12_MIC_BIAS_VOL, 0x00},
184 {MAX98090_0x13_DIGITAL_MIC_CFG, 0x00},
185 {MAX98090_0x14_DIGITAL_MIC_MODE, 0x00},
186
187 /* ADC PATH AND CONFIGURATION REGISTERS */
188 {MAX98090_0x15_L_ADC_MIX, 0x00},
189 {MAX98090_0x16_R_ADC_MIX, 0x00},
190 {MAX98090_0x17_L_ADC_LVL, 0x03},
191 {MAX98090_0x18_R_ADC_LVL, 0x03},
192 {MAX98090_0x19_ADC_BIQUAD_LVL, 0x00},
193 {MAX98090_0x1A_ADC_SIDETONE, 0x00},
194
195 /* CLOCK CONFIGURATION REGISTERS */
196 {MAX98090_0x1B_SYS_CLK, 0x00},
197 {MAX98090_0x1C_CLK_MODE, 0x00},
198 {MAX98090_0x1D_ANY_CLK1, 0x00},
199 {MAX98090_0x1E_ANY_CLK2, 0x00},
200 {MAX98090_0x1F_ANY_CLK3, 0x00},
201 {MAX98090_0x20_ANY_CLK4, 0x00},
202 {MAX98090_0x21_MASTER_MODE, 0x00},
203
204 /* INTERFACE CONTROL REGISTERS */
205 {MAX98090_0x22_DAI_IF_FMT, 0x00},
206 {MAX98090_0x23_DAI_TDM_FMT1, 0x00},
207 {MAX98090_0x24_DAI_TDM_FMT2, 0x00},
208 {MAX98090_0x25_DAI_IO_CFG, 0x00},
209 {MAX98090_0x26_FILTER_CFG, 0x80},
210 {MAX98090_0x27_DAI_PLAYBACK_LVL, 0x00},
211 {MAX98090_0x28_EQ_PLAYBACK_LVL, 0x00},
212
213 /* HEADPHONE CONTROL REGISTERS */
214 {MAX98090_0x29_L_HP_MIX, 0x00},
215 {MAX98090_0x2A_R_HP_MIX, 0x00},
216 {MAX98090_0x2B_HP_CTR, 0x00},
217 {MAX98090_0x2C_L_HP_VOL, 0x1A},
218 {MAX98090_0x2D_R_HP_VOL, 0x1A},
219
220 /* SPEAKER CONFIGURATION REGISTERS */
221 {MAX98090_0x2E_L_SPK_MIX, 0x00},
222 {MAX98090_0x2F_R_SPK_MIX, 0x00},
223 {MAX98090_0x30_SPK_CTR, 0x00},
224 {MAX98090_0x31_L_SPK_VOL, 0x2C},
225 {MAX98090_0x32_R_SPK_VOL, 0x2C},
226
227 /* ALC CONFIGURATION REGISTERS */
228 {MAX98090_0x33_ALC_TIMING, 0x00},
229 {MAX98090_0x34_ALC_COMPRESSOR, 0x00},
230 {MAX98090_0x35_ALC_EXPANDER, 0x00},
231 {MAX98090_0x36_ALC_GAIN, 0x00},
232
233 /* RECEIVER AND LINE_OUTPUT REGISTERS */
234 {MAX98090_0x37_RCV_LOUT_L_MIX, 0x00},
235 {MAX98090_0x38_RCV_LOUT_L_CNTL, 0x00},
236 {MAX98090_0x39_RCV_LOUT_L_VOL, 0x15},
237 {MAX98090_0x3A_LOUT_R_MIX, 0x00},
238 {MAX98090_0x3B_LOUT_R_CNTL, 0x00},
239 {MAX98090_0x3C_LOUT_R_VOL, 0x15},
240
241 /* JACK DETECT AND ENABLE REGISTERS */
242 {MAX98090_0x3D_JACK_DETECT, 0x00},
243 {MAX98090_0x3E_IN_ENABLE, 0x00},
244 {MAX98090_0x3F_OUT_ENABLE, 0x00},
245 {MAX98090_0x40_LVL_CTR, 0x00},
246 {MAX98090_0x41_DSP_FILTER_ENABLE, 0x00},
247
248 /* BIAS AND POWER MODE CONFIGURATION REGISTERS */
249 {MAX98090_0x42_BIAS_CTR, 0x00},
250 {MAX98090_0x43_DAC_CTR, 0x00},
251 {MAX98090_0x44_ADC_CTR, 0x06},
252 {MAX98090_0x45_DEV_SHUTDOWN, 0x00},
253};
254
255static const unsigned int max98090_hp_tlv[] = {
256 TLV_DB_RANGE_HEAD(5),
257 0x0, 0x6, TLV_DB_SCALE_ITEM(-6700, 400, 0),
258 0x7, 0xE, TLV_DB_SCALE_ITEM(-4000, 300, 0),
259 0xF, 0x15, TLV_DB_SCALE_ITEM(-1700, 200, 0),
260 0x16, 0x1B, TLV_DB_SCALE_ITEM(-400, 100, 0),
261 0x1C, 0x1F, TLV_DB_SCALE_ITEM(150, 50, 0),
262};
263
264static struct snd_kcontrol_new max98090_snd_controls[] = {
265 SOC_DOUBLE_R_TLV("Headphone Volume", MAX98090_0x2C_L_HP_VOL,
266 MAX98090_0x2D_R_HP_VOL, 0, 31, 0, max98090_hp_tlv),
267};
268
269/* Left HeadPhone Mixer Switch */
270static struct snd_kcontrol_new max98090_left_hp_mixer_controls[] = {
271 SOC_DAPM_SINGLE("DACR Switch", MAX98090_0x29_L_HP_MIX, 1, 1, 0),
272 SOC_DAPM_SINGLE("DACL Switch", MAX98090_0x29_L_HP_MIX, 0, 1, 0),
273};
274
275/* Right HeadPhone Mixer Switch */
276static struct snd_kcontrol_new max98090_right_hp_mixer_controls[] = {
277 SOC_DAPM_SINGLE("DACR Switch", MAX98090_0x2A_R_HP_MIX, 1, 1, 0),
278 SOC_DAPM_SINGLE("DACL Switch", MAX98090_0x2A_R_HP_MIX, 0, 1, 0),
279};
280
281static struct snd_soc_dapm_widget max98090_dapm_widgets[] = {
282 /* Output */
283 SND_SOC_DAPM_OUTPUT("HPL"),
284 SND_SOC_DAPM_OUTPUT("HPR"),
285
286 /* PGA */
287 SND_SOC_DAPM_PGA("HPL Out", MAX98090_0x3F_OUT_ENABLE, 7, 0, NULL, 0),
288 SND_SOC_DAPM_PGA("HPR Out", MAX98090_0x3F_OUT_ENABLE, 6, 0, NULL, 0),
289
290 /* Mixer */
291 SND_SOC_DAPM_MIXER("HPL Mixer", SND_SOC_NOPM, 0, 0,
292 max98090_left_hp_mixer_controls,
293 ARRAY_SIZE(max98090_left_hp_mixer_controls)),
294
295 SND_SOC_DAPM_MIXER("HPR Mixer", SND_SOC_NOPM, 0, 0,
296 max98090_right_hp_mixer_controls,
297 ARRAY_SIZE(max98090_right_hp_mixer_controls)),
298
299 /* DAC */
300 SND_SOC_DAPM_DAC("DACL", "Hifi Playback", MAX98090_0x3F_OUT_ENABLE, 0, 0),
301 SND_SOC_DAPM_DAC("DACR", "Hifi Playback", MAX98090_0x3F_OUT_ENABLE, 1, 0),
302};
303
304static struct snd_soc_dapm_route max98090_audio_map[] = {
305 /* Output */
306 {"HPL", NULL, "HPL Out"},
307 {"HPR", NULL, "HPR Out"},
308
309 /* PGA */
310 {"HPL Out", NULL, "HPL Mixer"},
311 {"HPR Out", NULL, "HPR Mixer"},
312
313 /* Mixer*/
314 {"HPL Mixer", "DACR Switch", "DACR"},
315 {"HPL Mixer", "DACL Switch", "DACL"},
316
317 {"HPR Mixer", "DACR Switch", "DACR"},
318 {"HPR Mixer", "DACL Switch", "DACL"},
319};
320
321static bool max98090_volatile(struct device *dev, unsigned int reg)
322{
323 if ((reg == MAX98090_0x01_INT_STS) ||
324 (reg == MAX98090_0x02_JACK_STS) ||
325 (reg > MAX98090_REG_MAX_CACHED))
326 return true;
327
328 return false;
329}
330
331static int max98090_dai_hw_params(struct snd_pcm_substream *substream,
332 struct snd_pcm_hw_params *params,
333 struct snd_soc_dai *dai)
334{
335 struct snd_soc_codec *codec = dai->codec;
336 unsigned int val;
337
338 switch (params_rate(params)) {
339 case 96000:
340 val = 1 << 5;
341 break;
342 case 32000:
343 val = 1 << 4;
344 break;
345 case 48000:
346 val = 1 << 3;
347 break;
348 case 44100:
349 val = 1 << 2;
350 break;
351 case 16000:
352 val = 1 << 1;
353 break;
354 case 8000:
355 val = 1 << 0;
356 break;
357 default:
358 dev_err(codec->dev, "unsupported rate\n");
359 return -EINVAL;
360 }
361 snd_soc_update_bits(codec, MAX98090_0x05_SAMPLE_RATE, 0x03F, val);
362
363 return 0;
364}
365
366static int max98090_dai_set_sysclk(struct snd_soc_dai *dai,
367 int clk_id, unsigned int freq, int dir)
368{
369 struct snd_soc_codec *codec = dai->codec;
370 unsigned int val;
371
372 snd_soc_update_bits(codec, MAX98090_0x45_DEV_SHUTDOWN,
373 MAX98090_SHDNRUN, 0);
374
375 switch (freq) {
376 case 26000000:
377 val = 1 << 7;
378 break;
379 case 19200000:
380 val = 1 << 6;
381 break;
382 case 13000000:
383 val = 1 << 5;
384 break;
385 case 12288000:
386 val = 1 << 4;
387 break;
388 case 12000000:
389 val = 1 << 3;
390 break;
391 case 11289600:
392 val = 1 << 2;
393 break;
394 default:
395 dev_err(codec->dev, "Invalid master clock frequency\n");
396 return -EINVAL;
397 }
398 snd_soc_update_bits(codec, MAX98090_0x04_SYS_CLK, 0xFD, val);
399
400 snd_soc_update_bits(codec, MAX98090_0x45_DEV_SHUTDOWN,
401 MAX98090_SHDNRUN, MAX98090_SHDNRUN);
402
403 dev_dbg(dai->dev, "sysclk is %uHz\n", freq);
404
405 return 0;
406}
407
408static int max98090_dai_set_fmt(struct snd_soc_dai *dai,
409 unsigned int fmt)
410{
411 struct snd_soc_codec *codec = dai->codec;
412 int is_master;
413 u8 val;
414
415 /* master/slave mode */
416 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
417 case SND_SOC_DAIFMT_CBM_CFM:
418 is_master = 1;
419 break;
420 case SND_SOC_DAIFMT_CBS_CFS:
421 is_master = 0;
422 break;
423 default:
424 dev_err(codec->dev, "unsupported clock\n");
425 return -EINVAL;
426 }
427
428 /* format */
429 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
430 case SND_SOC_DAIFMT_I2S:
431 val = (is_master) ? MAX98090_I2S_M : MAX98090_I2S_S;
432 break;
433 case SND_SOC_DAIFMT_RIGHT_J:
434 val = (is_master) ? MAX98090_RJ_M : MAX98090_RJ_S;
435 break;
436 case SND_SOC_DAIFMT_LEFT_J:
437 val = (is_master) ? MAX98090_LJ_M : MAX98090_LJ_S;
438 break;
439 default:
440 dev_err(codec->dev, "unsupported format\n");
441 return -EINVAL;
442 }
443 snd_soc_update_bits(codec, MAX98090_0x06_DAI_IF,
444 MAX98090_DAI_IF_MASK, val);
445
446 return 0;
447}
448
449#define MAX98090_RATES SNDRV_PCM_RATE_8000_96000
450#define MAX98090_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE)
451
452static struct snd_soc_dai_ops max98090_dai_ops = {
453 .set_sysclk = max98090_dai_set_sysclk,
454 .set_fmt = max98090_dai_set_fmt,
455 .hw_params = max98090_dai_hw_params,
456};
457
458static struct snd_soc_dai_driver max98090_dai = {
459 .name = "max98090-Hifi",
460 .playback = {
461 .stream_name = "Playback",
462 .channels_min = 1,
463 .channels_max = 2,
464 .rates = MAX98090_RATES,
465 .formats = MAX98090_FORMATS,
466 },
467 .ops = &max98090_dai_ops,
468};
469
470static int max98090_probe(struct snd_soc_codec *codec)
471{
472 struct max98090_priv *priv = snd_soc_codec_get_drvdata(codec);
473 struct device *dev = codec->dev;
474 int ret;
475
476 codec->control_data = priv->regmap;
477 ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_REGMAP);
478 if (ret < 0) {
479 dev_err(dev, "Failed to set cache I/O: %d\n", ret);
480 return ret;
481 }
482
483 /* Device active */
484 snd_soc_update_bits(codec, MAX98090_0x45_DEV_SHUTDOWN,
485 MAX98090_SHDNRUN, MAX98090_SHDNRUN);
486
487 return 0;
488}
489
490static int max98090_remove(struct snd_soc_codec *codec)
491{
492 return 0;
493}
494
495static struct snd_soc_codec_driver soc_codec_dev_max98090 = {
496 .probe = max98090_probe,
497 .remove = max98090_remove,
498 .controls = max98090_snd_controls,
499 .num_controls = ARRAY_SIZE(max98090_snd_controls),
500 .dapm_widgets = max98090_dapm_widgets,
501 .num_dapm_widgets = ARRAY_SIZE(max98090_dapm_widgets),
502 .dapm_routes = max98090_audio_map,
503 .num_dapm_routes = ARRAY_SIZE(max98090_audio_map),
504};
505
506static const struct regmap_config max98090_regmap = {
507 .reg_bits = 8,
508 .val_bits = 8,
509 .max_register = MAX98090_REG_END,
510 .volatile_reg = max98090_volatile,
511 .cache_type = REGCACHE_RBTREE,
512 .reg_defaults = max98090_reg_defaults,
513 .num_reg_defaults = ARRAY_SIZE(max98090_reg_defaults),
514};
515
516static int max98090_i2c_probe(struct i2c_client *i2c,
517 const struct i2c_device_id *id)
518{
519 struct max98090_priv *priv;
520 struct device *dev = &i2c->dev;
521 unsigned int val;
522 int ret;
523
524 priv = devm_kzalloc(dev, sizeof(struct max98090_priv),
525 GFP_KERNEL);
526 if (!priv)
527 return -ENOMEM;
528
529 priv->regmap = devm_regmap_init_i2c(i2c, &max98090_regmap);
530 if (IS_ERR(priv->regmap)) {
531 ret = PTR_ERR(priv->regmap);
532 dev_err(dev, "Failed to init regmap: %d\n", ret);
533 return ret;
534 }
535
536 i2c_set_clientdata(i2c, priv);
537
538 ret = regmap_read(priv->regmap, MAX98090_0xFF_REV_ID, &val);
539 if (ret < 0) {
540 dev_err(dev, "Failed to read device revision: %d\n", ret);
541 return ret;
542 }
543 dev_info(dev, "revision 0x%02x\n", val);
544
545 ret = snd_soc_register_codec(dev,
546 &soc_codec_dev_max98090,
547 &max98090_dai, 1);
548
549 return ret;
550}
551
552static int max98090_i2c_remove(struct i2c_client *client)
553{
554 snd_soc_unregister_codec(&client->dev);
555 return 0;
556}
557
558static const struct i2c_device_id max98090_i2c_id[] = {
559 { "max98090", 0 },
560 { }
561};
562MODULE_DEVICE_TABLE(i2c, max98090_i2c_id);
563
564static struct i2c_driver max98090_i2c_driver = {
565 .driver = {
566 .name = "max98090",
567 .owner = THIS_MODULE,
568 },
569 .probe = max98090_i2c_probe,
570 .remove = max98090_i2c_remove,
571 .id_table = max98090_i2c_id,
572};
573module_i2c_driver(max98090_i2c_driver);
574
575MODULE_DESCRIPTION("ALSA SoC MAX98090 driver");
576MODULE_AUTHOR("Peter Hsiang, Kuninori Morimoto");
577MODULE_LICENSE("GPL");
diff --git a/sound/soc/codecs/max98095.c b/sound/soc/codecs/max98095.c
index 38d43c59d3f4..41cdd1642970 100644
--- a/sound/soc/codecs/max98095.c
+++ b/sound/soc/codecs/max98095.c
@@ -2511,7 +2511,7 @@ static int max98095_i2c_probe(struct i2c_client *i2c,
2511 return ret; 2511 return ret;
2512} 2512}
2513 2513
2514static int __devexit max98095_i2c_remove(struct i2c_client *client) 2514static int max98095_i2c_remove(struct i2c_client *client)
2515{ 2515{
2516 snd_soc_unregister_codec(&client->dev); 2516 snd_soc_unregister_codec(&client->dev);
2517 return 0; 2517 return 0;
@@ -2529,7 +2529,7 @@ static struct i2c_driver max98095_i2c_driver = {
2529 .owner = THIS_MODULE, 2529 .owner = THIS_MODULE,
2530 }, 2530 },
2531 .probe = max98095_i2c_probe, 2531 .probe = max98095_i2c_probe,
2532 .remove = __devexit_p(max98095_i2c_remove), 2532 .remove = max98095_i2c_remove,
2533 .id_table = max98095_i2c_id, 2533 .id_table = max98095_i2c_id,
2534}; 2534};
2535 2535
diff --git a/sound/soc/codecs/max9850.c b/sound/soc/codecs/max9850.c
index efe535c37b39..58c38a5b481c 100644
--- a/sound/soc/codecs/max9850.c
+++ b/sound/soc/codecs/max9850.c
@@ -329,8 +329,8 @@ static struct snd_soc_codec_driver soc_codec_dev_max9850 = {
329 .num_dapm_routes = ARRAY_SIZE(max9850_dapm_routes), 329 .num_dapm_routes = ARRAY_SIZE(max9850_dapm_routes),
330}; 330};
331 331
332static int __devinit max9850_i2c_probe(struct i2c_client *i2c, 332static int max9850_i2c_probe(struct i2c_client *i2c,
333 const struct i2c_device_id *id) 333 const struct i2c_device_id *id)
334{ 334{
335 struct max9850_priv *max9850; 335 struct max9850_priv *max9850;
336 int ret; 336 int ret;
@@ -347,7 +347,7 @@ static int __devinit max9850_i2c_probe(struct i2c_client *i2c,
347 return ret; 347 return ret;
348} 348}
349 349
350static __devexit int max9850_i2c_remove(struct i2c_client *client) 350static int max9850_i2c_remove(struct i2c_client *client)
351{ 351{
352 snd_soc_unregister_codec(&client->dev); 352 snd_soc_unregister_codec(&client->dev);
353 return 0; 353 return 0;
@@ -365,7 +365,7 @@ static struct i2c_driver max9850_i2c_driver = {
365 .owner = THIS_MODULE, 365 .owner = THIS_MODULE,
366 }, 366 },
367 .probe = max9850_i2c_probe, 367 .probe = max9850_i2c_probe,
368 .remove = __devexit_p(max9850_i2c_remove), 368 .remove = max9850_i2c_remove,
369 .id_table = max9850_i2c_id, 369 .id_table = max9850_i2c_id,
370}; 370};
371 371
diff --git a/sound/soc/codecs/max9877.c b/sound/soc/codecs/max9877.c
index d15e5943c85e..6b6c74cd83e2 100644
--- a/sound/soc/codecs/max9877.c
+++ b/sound/soc/codecs/max9877.c
@@ -258,8 +258,8 @@ int max9877_add_controls(struct snd_soc_codec *codec)
258} 258}
259EXPORT_SYMBOL_GPL(max9877_add_controls); 259EXPORT_SYMBOL_GPL(max9877_add_controls);
260 260
261static int __devinit max9877_i2c_probe(struct i2c_client *client, 261static int max9877_i2c_probe(struct i2c_client *client,
262 const struct i2c_device_id *id) 262 const struct i2c_device_id *id)
263{ 263{
264 i2c = client; 264 i2c = client;
265 265
@@ -268,7 +268,7 @@ static int __devinit max9877_i2c_probe(struct i2c_client *client,
268 return 0; 268 return 0;
269} 269}
270 270
271static __devexit int max9877_i2c_remove(struct i2c_client *client) 271static int max9877_i2c_remove(struct i2c_client *client)
272{ 272{
273 i2c = NULL; 273 i2c = NULL;
274 274
@@ -287,7 +287,7 @@ static struct i2c_driver max9877_i2c_driver = {
287 .owner = THIS_MODULE, 287 .owner = THIS_MODULE,
288 }, 288 },
289 .probe = max9877_i2c_probe, 289 .probe = max9877_i2c_probe,
290 .remove = __devexit_p(max9877_i2c_remove), 290 .remove = max9877_i2c_remove,
291 .id_table = max9877_i2c_id, 291 .id_table = max9877_i2c_id,
292}; 292};
293 293
diff --git a/sound/soc/codecs/mc13783.c b/sound/soc/codecs/mc13783.c
index bc955999c8aa..5402dfbbb716 100644
--- a/sound/soc/codecs/mc13783.c
+++ b/sound/soc/codecs/mc13783.c
@@ -779,7 +779,7 @@ static struct platform_driver mc13783_codec_driver = {
779 .owner = THIS_MODULE, 779 .owner = THIS_MODULE,
780 }, 780 },
781 .probe = mc13783_codec_probe, 781 .probe = mc13783_codec_probe,
782 .remove = __devexit_p(mc13783_codec_remove), 782 .remove = mc13783_codec_remove,
783}; 783};
784 784
785module_platform_driver(mc13783_codec_driver); 785module_platform_driver(mc13783_codec_driver);
diff --git a/sound/soc/codecs/ml26124.c b/sound/soc/codecs/ml26124.c
index 96aa5fa05160..26118828782b 100644
--- a/sound/soc/codecs/ml26124.c
+++ b/sound/soc/codecs/ml26124.c
@@ -626,8 +626,8 @@ static const struct regmap_config ml26124_i2c_regmap = {
626 .write_flag_mask = 0x01, 626 .write_flag_mask = 0x01,
627}; 627};
628 628
629static __devinit int ml26124_i2c_probe(struct i2c_client *i2c, 629static int ml26124_i2c_probe(struct i2c_client *i2c,
630 const struct i2c_device_id *id) 630 const struct i2c_device_id *id)
631{ 631{
632 struct ml26124_priv *priv; 632 struct ml26124_priv *priv;
633 int ret; 633 int ret;
@@ -649,7 +649,7 @@ static __devinit int ml26124_i2c_probe(struct i2c_client *i2c,
649 &soc_codec_dev_ml26124, &ml26124_dai, 1); 649 &soc_codec_dev_ml26124, &ml26124_dai, 1);
650} 650}
651 651
652static __devexit int ml26124_i2c_remove(struct i2c_client *client) 652static int ml26124_i2c_remove(struct i2c_client *client)
653{ 653{
654 snd_soc_unregister_codec(&client->dev); 654 snd_soc_unregister_codec(&client->dev);
655 return 0; 655 return 0;
@@ -667,7 +667,7 @@ static struct i2c_driver ml26124_i2c_driver = {
667 .owner = THIS_MODULE, 667 .owner = THIS_MODULE,
668 }, 668 },
669 .probe = ml26124_i2c_probe, 669 .probe = ml26124_i2c_probe,
670 .remove = __devexit_p(ml26124_i2c_remove), 670 .remove = ml26124_i2c_remove,
671 .id_table = ml26124_i2c_id, 671 .id_table = ml26124_i2c_id,
672}; 672};
673 673
diff --git a/sound/soc/codecs/omap-hdmi.c b/sound/soc/codecs/omap-hdmi.c
index 1bf5c74f5f96..529d06444c54 100644
--- a/sound/soc/codecs/omap-hdmi.c
+++ b/sound/soc/codecs/omap-hdmi.c
@@ -39,13 +39,13 @@ static struct snd_soc_dai_driver omap_hdmi_codec_dai = {
39 }, 39 },
40}; 40};
41 41
42static __devinit int omap_hdmi_codec_probe(struct platform_device *pdev) 42static int omap_hdmi_codec_probe(struct platform_device *pdev)
43{ 43{
44 return snd_soc_register_codec(&pdev->dev, &omap_hdmi_codec, 44 return snd_soc_register_codec(&pdev->dev, &omap_hdmi_codec,
45 &omap_hdmi_codec_dai, 1); 45 &omap_hdmi_codec_dai, 1);
46} 46}
47 47
48static __devexit int omap_hdmi_codec_remove(struct platform_device *pdev) 48static int omap_hdmi_codec_remove(struct platform_device *pdev)
49{ 49{
50 snd_soc_unregister_codec(&pdev->dev); 50 snd_soc_unregister_codec(&pdev->dev);
51 return 0; 51 return 0;
@@ -58,7 +58,7 @@ static struct platform_driver omap_hdmi_codec_driver = {
58 }, 58 },
59 59
60 .probe = omap_hdmi_codec_probe, 60 .probe = omap_hdmi_codec_probe,
61 .remove = __devexit_p(omap_hdmi_codec_remove), 61 .remove = omap_hdmi_codec_remove,
62}; 62};
63 63
64module_platform_driver(omap_hdmi_codec_driver); 64module_platform_driver(omap_hdmi_codec_driver);
diff --git a/sound/soc/codecs/pcm3008.c b/sound/soc/codecs/pcm3008.c
index edcaa7ea5487..f2a6282b41f4 100644
--- a/sound/soc/codecs/pcm3008.c
+++ b/sound/soc/codecs/pcm3008.c
@@ -149,13 +149,13 @@ static struct snd_soc_codec_driver soc_codec_dev_pcm3008 = {
149 .resume = pcm3008_soc_resume, 149 .resume = pcm3008_soc_resume,
150}; 150};
151 151
152static int __devinit pcm3008_codec_probe(struct platform_device *pdev) 152static int pcm3008_codec_probe(struct platform_device *pdev)
153{ 153{
154 return snd_soc_register_codec(&pdev->dev, 154 return snd_soc_register_codec(&pdev->dev,
155 &soc_codec_dev_pcm3008, &pcm3008_dai, 1); 155 &soc_codec_dev_pcm3008, &pcm3008_dai, 1);
156} 156}
157 157
158static int __devexit pcm3008_codec_remove(struct platform_device *pdev) 158static int pcm3008_codec_remove(struct platform_device *pdev)
159{ 159{
160 snd_soc_unregister_codec(&pdev->dev); 160 snd_soc_unregister_codec(&pdev->dev);
161 return 0; 161 return 0;
@@ -165,7 +165,7 @@ MODULE_ALIAS("platform:pcm3008-codec");
165 165
166static struct platform_driver pcm3008_codec_driver = { 166static struct platform_driver pcm3008_codec_driver = {
167 .probe = pcm3008_codec_probe, 167 .probe = pcm3008_codec_probe,
168 .remove = __devexit_p(pcm3008_codec_remove), 168 .remove = pcm3008_codec_remove,
169 .driver = { 169 .driver = {
170 .name = "pcm3008-codec", 170 .name = "pcm3008-codec",
171 .owner = THIS_MODULE, 171 .owner = THIS_MODULE,
diff --git a/sound/soc/codecs/rt5631.c b/sound/soc/codecs/rt5631.c
index 960d0e93cce9..912c9cbc2724 100644
--- a/sound/soc/codecs/rt5631.c
+++ b/sound/soc/codecs/rt5631.c
@@ -1382,7 +1382,7 @@ static int rt5631_hifi_pcm_params(struct snd_pcm_substream *substream,
1382 timesofbclk); 1382 timesofbclk);
1383 if (coeff < 0) { 1383 if (coeff < 0) {
1384 dev_err(codec->dev, "Fail to get coeff\n"); 1384 dev_err(codec->dev, "Fail to get coeff\n");
1385 return -EINVAL; 1385 return coeff;
1386 } 1386 }
1387 1387
1388 switch (params_format(params)) { 1388 switch (params_format(params)) {
@@ -1748,7 +1748,7 @@ static int rt5631_i2c_probe(struct i2c_client *i2c,
1748 return ret; 1748 return ret;
1749} 1749}
1750 1750
1751static __devexit int rt5631_i2c_remove(struct i2c_client *client) 1751static int rt5631_i2c_remove(struct i2c_client *client)
1752{ 1752{
1753 snd_soc_unregister_codec(&client->dev); 1753 snd_soc_unregister_codec(&client->dev);
1754 return 0; 1754 return 0;
@@ -1760,7 +1760,7 @@ static struct i2c_driver rt5631_i2c_driver = {
1760 .owner = THIS_MODULE, 1760 .owner = THIS_MODULE,
1761 }, 1761 },
1762 .probe = rt5631_i2c_probe, 1762 .probe = rt5631_i2c_probe,
1763 .remove = __devexit_p(rt5631_i2c_remove), 1763 .remove = rt5631_i2c_remove,
1764 .id_table = rt5631_i2c_id, 1764 .id_table = rt5631_i2c_id,
1765}; 1765};
1766 1766
diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c
index df2f99d1d428..cb1675cd8e1c 100644
--- a/sound/soc/codecs/sgtl5000.c
+++ b/sound/soc/codecs/sgtl5000.c
@@ -1404,8 +1404,8 @@ static struct snd_soc_codec_driver sgtl5000_driver = {
1404 .num_dapm_routes = ARRAY_SIZE(sgtl5000_dapm_routes), 1404 .num_dapm_routes = ARRAY_SIZE(sgtl5000_dapm_routes),
1405}; 1405};
1406 1406
1407static __devinit int sgtl5000_i2c_probe(struct i2c_client *client, 1407static int sgtl5000_i2c_probe(struct i2c_client *client,
1408 const struct i2c_device_id *id) 1408 const struct i2c_device_id *id)
1409{ 1409{
1410 struct sgtl5000_priv *sgtl5000; 1410 struct sgtl5000_priv *sgtl5000;
1411 int ret; 1411 int ret;
@@ -1422,7 +1422,7 @@ static __devinit int sgtl5000_i2c_probe(struct i2c_client *client,
1422 return ret; 1422 return ret;
1423} 1423}
1424 1424
1425static __devexit int sgtl5000_i2c_remove(struct i2c_client *client) 1425static int sgtl5000_i2c_remove(struct i2c_client *client)
1426{ 1426{
1427 snd_soc_unregister_codec(&client->dev); 1427 snd_soc_unregister_codec(&client->dev);
1428 1428
@@ -1449,7 +1449,7 @@ static struct i2c_driver sgtl5000_i2c_driver = {
1449 .of_match_table = sgtl5000_dt_ids, 1449 .of_match_table = sgtl5000_dt_ids,
1450 }, 1450 },
1451 .probe = sgtl5000_i2c_probe, 1451 .probe = sgtl5000_i2c_probe,
1452 .remove = __devexit_p(sgtl5000_i2c_remove), 1452 .remove = sgtl5000_i2c_remove,
1453 .id_table = sgtl5000_id, 1453 .id_table = sgtl5000_id,
1454}; 1454};
1455 1455
diff --git a/sound/soc/codecs/si476x.c b/sound/soc/codecs/si476x.c
new file mode 100644
index 000000000000..f2d61a187830
--- /dev/null
+++ b/sound/soc/codecs/si476x.c
@@ -0,0 +1,255 @@
1#include <linux/module.h>
2#include <linux/slab.h>
3#include <sound/pcm.h>
4#include <sound/pcm_params.h>
5#include <sound/soc.h>
6#include <sound/initval.h>
7
8#include <linux/i2c.h>
9
10#include <linux/mfd/si476x-core.h>
11
12enum si476x_audio_registers {
13 SI476X_DIGITAL_IO_OUTPUT_FORMAT = 0x0203,
14 SI476X_DIGITAL_IO_OUTPUT_SAMPLE_RATE = 0x0202,
15};
16
17enum si476x_digital_io_output_format {
18 SI476X_DIGITAL_IO_SLOT_SIZE_SHIFT = 11,
19 SI476X_DIGITAL_IO_SAMPLE_SIZE_SHIFT = 8,
20};
21
22#define SI476X_DIGITAL_IO_OUTPUT_WIDTH_MASK ((0b111 << SI476X_DIGITAL_IO_SLOT_SIZE_SHIFT) | \
23 (0b111 << SI476X_DIGITAL_IO_SAMPLE_SIZE_SHIFT))
24#define SI476X_DIGITAL_IO_OUTPUT_FORMAT_MASK (0b1111110)
25
26enum si476x_daudio_formats {
27 SI476X_DAUDIO_MODE_I2S = (0x0 << 1),
28 SI476X_DAUDIO_MODE_DSP_A = (0x6 << 1),
29 SI476X_DAUDIO_MODE_DSP_B = (0x7 << 1),
30 SI476X_DAUDIO_MODE_LEFT_J = (0x8 << 1),
31 SI476X_DAUDIO_MODE_RIGHT_J = (0x9 << 1),
32
33 SI476X_DAUDIO_MODE_IB = (1 << 5),
34 SI476X_DAUDIO_MODE_IF = (1 << 6),
35};
36
37enum si476x_pcm_format {
38 SI476X_PCM_FORMAT_S8 = 2,
39 SI476X_PCM_FORMAT_S16_LE = 4,
40 SI476X_PCM_FORMAT_S20_3LE = 5,
41 SI476X_PCM_FORMAT_S24_LE = 6,
42};
43
44static unsigned int si476x_codec_read(struct snd_soc_codec *codec,
45 unsigned int reg)
46{
47 int err;
48 struct si476x_core *core = codec->control_data;
49
50 si476x_core_lock(core);
51 err = si476x_core_cmd_get_property(core, reg);
52 si476x_core_unlock(core);
53
54 return err;
55}
56
57static int si476x_codec_write(struct snd_soc_codec *codec,
58 unsigned int reg, unsigned int val)
59{
60 int err;
61 struct si476x_core *core = codec->control_data;
62
63 si476x_core_lock(core);
64 err = si476x_core_cmd_set_property(core, reg, val);
65 si476x_core_unlock(core);
66
67 return err;
68}
69
70static int si476x_codec_set_dai_fmt(struct snd_soc_dai *codec_dai,
71 unsigned int fmt)
72{
73 int err;
74 u16 format = 0;
75
76 if ((fmt & SND_SOC_DAIFMT_MASTER_MASK) != SND_SOC_DAIFMT_CBS_CFS)
77 return -EINVAL;
78
79 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
80 case SND_SOC_DAIFMT_DSP_A:
81 format |= SI476X_DAUDIO_MODE_DSP_A;
82 break;
83 case SND_SOC_DAIFMT_DSP_B:
84 format |= SI476X_DAUDIO_MODE_DSP_B;
85 break;
86 case SND_SOC_DAIFMT_I2S:
87 format |= SI476X_DAUDIO_MODE_I2S;
88 break;
89 case SND_SOC_DAIFMT_RIGHT_J:
90 format |= SI476X_DAUDIO_MODE_RIGHT_J;
91 break;
92 case SND_SOC_DAIFMT_LEFT_J:
93 format |= SI476X_DAUDIO_MODE_LEFT_J;
94 break;
95 default:
96 return -EINVAL;
97 }
98
99 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
100 case SND_SOC_DAIFMT_DSP_A:
101 case SND_SOC_DAIFMT_DSP_B:
102 switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
103 case SND_SOC_DAIFMT_NB_NF:
104 break;
105 case SND_SOC_DAIFMT_IB_NF:
106 format |= SI476X_DAUDIO_MODE_IB;
107 break;
108 default:
109 return -EINVAL;
110 }
111 break;
112 case SND_SOC_DAIFMT_I2S:
113 case SND_SOC_DAIFMT_RIGHT_J:
114 case SND_SOC_DAIFMT_LEFT_J:
115 switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
116 case SND_SOC_DAIFMT_NB_NF:
117 break;
118 case SND_SOC_DAIFMT_IB_IF:
119 format |= SI476X_DAUDIO_MODE_IB |
120 SI476X_DAUDIO_MODE_IF;
121 break;
122 case SND_SOC_DAIFMT_IB_NF:
123 format |= SI476X_DAUDIO_MODE_IB;
124 break;
125 case SND_SOC_DAIFMT_NB_IF:
126 format |= SI476X_DAUDIO_MODE_IF;
127 break;
128 default:
129 return -EINVAL;
130 }
131 break;
132 default:
133 return -EINVAL;
134 }
135
136 err = snd_soc_update_bits(codec_dai->codec, SI476X_DIGITAL_IO_OUTPUT_FORMAT,
137 SI476X_DIGITAL_IO_OUTPUT_FORMAT_MASK,
138 format);
139 if (err < 0) {
140 dev_err(codec_dai->codec->dev, "Failed to set output format\n");
141 return err;
142 }
143
144 return 0;
145}
146
147static int si476x_codec_hw_params(struct snd_pcm_substream *substream,
148 struct snd_pcm_hw_params *params,
149 struct snd_soc_dai *dai)
150{
151 int rate, width, err;
152
153 rate = params_rate(params);
154 if (rate < 32000 || rate > 48000) {
155 dev_err(dai->codec->dev, "Rate: %d is not supported\n", rate);
156 return -EINVAL;
157 }
158
159 switch (params_format(params)) {
160 case SNDRV_PCM_FORMAT_S8:
161 width = SI476X_PCM_FORMAT_S8;
162 case SNDRV_PCM_FORMAT_S16_LE:
163 width = SI476X_PCM_FORMAT_S16_LE;
164 break;
165 case SNDRV_PCM_FORMAT_S20_3LE:
166 width = SI476X_PCM_FORMAT_S20_3LE;
167 break;
168 case SNDRV_PCM_FORMAT_S24_LE:
169 width = SI476X_PCM_FORMAT_S24_LE;
170 break;
171 default:
172 return -EINVAL;
173 }
174
175 err = snd_soc_write(dai->codec, SI476X_DIGITAL_IO_OUTPUT_SAMPLE_RATE,
176 rate);
177 if (err < 0) {
178 dev_err(dai->codec->dev, "Failed to set sample rate\n");
179 return err;
180 }
181
182 err = snd_soc_update_bits(dai->codec, SI476X_DIGITAL_IO_OUTPUT_FORMAT,
183 SI476X_DIGITAL_IO_OUTPUT_WIDTH_MASK,
184 (width << SI476X_DIGITAL_IO_SLOT_SIZE_SHIFT) |
185 (width << SI476X_DIGITAL_IO_SAMPLE_SIZE_SHIFT));
186 if (err < 0) {
187 dev_err(dai->codec->dev, "Failed to set output width\n");
188 return err;
189 }
190
191 return 0;
192}
193
194static int si476x_codec_probe(struct snd_soc_codec *codec)
195{
196 codec->control_data = i2c_mfd_cell_to_core(codec->dev);
197 return 0;
198}
199
200static struct snd_soc_dai_ops si476x_dai_ops = {
201 .hw_params = si476x_codec_hw_params,
202 .set_fmt = si476x_codec_set_dai_fmt,
203};
204
205static struct snd_soc_dai_driver si476x_dai = {
206 .name = "si476x-codec",
207 .capture = {
208 .stream_name = "Capture",
209 .channels_min = 2,
210 .channels_max = 2,
211
212 .rates = SNDRV_PCM_RATE_32000 |
213 SNDRV_PCM_RATE_44100 |
214 SNDRV_PCM_RATE_48000,
215 .formats = SNDRV_PCM_FMTBIT_S8 |
216 SNDRV_PCM_FMTBIT_S16_LE |
217 SNDRV_PCM_FMTBIT_S20_3LE |
218 SNDRV_PCM_FMTBIT_S24_LE
219 },
220 .ops = &si476x_dai_ops,
221};
222
223static struct snd_soc_codec_driver soc_codec_dev_si476x = {
224 .probe = si476x_codec_probe,
225 .read = si476x_codec_read,
226 .write = si476x_codec_write,
227};
228
229static int si476x_platform_probe(struct platform_device *pdev)
230{
231 return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_si476x,
232 &si476x_dai, 1);
233}
234
235static int si476x_platform_remove(struct platform_device *pdev)
236{
237 snd_soc_unregister_codec(&pdev->dev);
238 return 0;
239}
240
241MODULE_ALIAS("platform:si476x-codec");
242
243static struct platform_driver si476x_platform_driver = {
244 .driver = {
245 .name = "si476x-codec",
246 .owner = THIS_MODULE,
247 },
248 .probe = si476x_platform_probe,
249 .remove = si476x_platform_remove,
250};
251module_platform_driver(si476x_platform_driver);
252
253MODULE_AUTHOR("Andrey Smirnov <andrey.smirnov@convergeddevices.net>");
254MODULE_DESCRIPTION("ASoC Si4761/64 codec driver");
255MODULE_LICENSE("GPL");
diff --git a/sound/soc/codecs/sn95031.c b/sound/soc/codecs/sn95031.c
index 50dbdb9357ea..d1ae869d3181 100644
--- a/sound/soc/codecs/sn95031.c
+++ b/sound/soc/codecs/sn95031.c
@@ -896,14 +896,14 @@ struct snd_soc_codec_driver sn95031_codec = {
896 .num_dapm_routes = ARRAY_SIZE(sn95031_audio_map), 896 .num_dapm_routes = ARRAY_SIZE(sn95031_audio_map),
897}; 897};
898 898
899static int __devinit sn95031_device_probe(struct platform_device *pdev) 899static int sn95031_device_probe(struct platform_device *pdev)
900{ 900{
901 pr_debug("codec device probe called for %s\n", dev_name(&pdev->dev)); 901 pr_debug("codec device probe called for %s\n", dev_name(&pdev->dev));
902 return snd_soc_register_codec(&pdev->dev, &sn95031_codec, 902 return snd_soc_register_codec(&pdev->dev, &sn95031_codec,
903 sn95031_dais, ARRAY_SIZE(sn95031_dais)); 903 sn95031_dais, ARRAY_SIZE(sn95031_dais));
904} 904}
905 905
906static int __devexit sn95031_device_remove(struct platform_device *pdev) 906static int sn95031_device_remove(struct platform_device *pdev)
907{ 907{
908 pr_debug("codec device remove called\n"); 908 pr_debug("codec device remove called\n");
909 snd_soc_unregister_codec(&pdev->dev); 909 snd_soc_unregister_codec(&pdev->dev);
@@ -916,7 +916,7 @@ static struct platform_driver sn95031_codec_driver = {
916 .owner = THIS_MODULE, 916 .owner = THIS_MODULE,
917 }, 917 },
918 .probe = sn95031_device_probe, 918 .probe = sn95031_device_probe,
919 .remove = __devexit_p(sn95031_device_remove), 919 .remove = sn95031_device_remove,
920}; 920};
921 921
922module_platform_driver(sn95031_codec_driver); 922module_platform_driver(sn95031_codec_driver);
diff --git a/sound/soc/codecs/ssm2602.c b/sound/soc/codecs/ssm2602.c
index 079066fef425..f8d30e5f6371 100644
--- a/sound/soc/codecs/ssm2602.c
+++ b/sound/soc/codecs/ssm2602.c
@@ -691,7 +691,7 @@ static const struct regmap_config ssm2602_regmap_config = {
691}; 691};
692 692
693#if defined(CONFIG_SPI_MASTER) 693#if defined(CONFIG_SPI_MASTER)
694static int __devinit ssm2602_spi_probe(struct spi_device *spi) 694static int ssm2602_spi_probe(struct spi_device *spi)
695{ 695{
696 struct ssm2602_priv *ssm2602; 696 struct ssm2602_priv *ssm2602;
697 int ret; 697 int ret;
@@ -713,7 +713,7 @@ static int __devinit ssm2602_spi_probe(struct spi_device *spi)
713 return ret; 713 return ret;
714} 714}
715 715
716static int __devexit ssm2602_spi_remove(struct spi_device *spi) 716static int ssm2602_spi_remove(struct spi_device *spi)
717{ 717{
718 snd_soc_unregister_codec(&spi->dev); 718 snd_soc_unregister_codec(&spi->dev);
719 return 0; 719 return 0;
@@ -725,7 +725,7 @@ static struct spi_driver ssm2602_spi_driver = {
725 .owner = THIS_MODULE, 725 .owner = THIS_MODULE,
726 }, 726 },
727 .probe = ssm2602_spi_probe, 727 .probe = ssm2602_spi_probe,
728 .remove = __devexit_p(ssm2602_spi_remove), 728 .remove = ssm2602_spi_remove,
729}; 729};
730#endif 730#endif
731 731
@@ -736,7 +736,7 @@ static struct spi_driver ssm2602_spi_driver = {
736 * low = 0x1a 736 * low = 0x1a
737 * high = 0x1b 737 * high = 0x1b
738 */ 738 */
739static int __devinit ssm2602_i2c_probe(struct i2c_client *i2c, 739static int ssm2602_i2c_probe(struct i2c_client *i2c,
740 const struct i2c_device_id *id) 740 const struct i2c_device_id *id)
741{ 741{
742 struct ssm2602_priv *ssm2602; 742 struct ssm2602_priv *ssm2602;
@@ -759,7 +759,7 @@ static int __devinit ssm2602_i2c_probe(struct i2c_client *i2c,
759 return ret; 759 return ret;
760} 760}
761 761
762static int __devexit ssm2602_i2c_remove(struct i2c_client *client) 762static int ssm2602_i2c_remove(struct i2c_client *client)
763{ 763{
764 snd_soc_unregister_codec(&client->dev); 764 snd_soc_unregister_codec(&client->dev);
765 return 0; 765 return 0;
@@ -780,7 +780,7 @@ static struct i2c_driver ssm2602_i2c_driver = {
780 .owner = THIS_MODULE, 780 .owner = THIS_MODULE,
781 }, 781 },
782 .probe = ssm2602_i2c_probe, 782 .probe = ssm2602_i2c_probe,
783 .remove = __devexit_p(ssm2602_i2c_remove), 783 .remove = ssm2602_i2c_remove,
784 .id_table = ssm2602_i2c_id, 784 .id_table = ssm2602_i2c_id,
785}; 785};
786#endif 786#endif
diff --git a/sound/soc/codecs/sta32x.c b/sound/soc/codecs/sta32x.c
index 0935bfe62471..cfb55fe35e98 100644
--- a/sound/soc/codecs/sta32x.c
+++ b/sound/soc/codecs/sta32x.c
@@ -995,8 +995,8 @@ static const struct regmap_config sta32x_regmap = {
995 .volatile_reg = sta32x_reg_is_volatile, 995 .volatile_reg = sta32x_reg_is_volatile,
996}; 996};
997 997
998static __devinit int sta32x_i2c_probe(struct i2c_client *i2c, 998static int sta32x_i2c_probe(struct i2c_client *i2c,
999 const struct i2c_device_id *id) 999 const struct i2c_device_id *id)
1000{ 1000{
1001 struct sta32x_priv *sta32x; 1001 struct sta32x_priv *sta32x;
1002 int ret, i; 1002 int ret, i;
@@ -1033,7 +1033,7 @@ static __devinit int sta32x_i2c_probe(struct i2c_client *i2c,
1033 return ret; 1033 return ret;
1034} 1034}
1035 1035
1036static __devexit int sta32x_i2c_remove(struct i2c_client *client) 1036static int sta32x_i2c_remove(struct i2c_client *client)
1037{ 1037{
1038 snd_soc_unregister_codec(&client->dev); 1038 snd_soc_unregister_codec(&client->dev);
1039 return 0; 1039 return 0;
@@ -1053,7 +1053,7 @@ static struct i2c_driver sta32x_i2c_driver = {
1053 .owner = THIS_MODULE, 1053 .owner = THIS_MODULE,
1054 }, 1054 },
1055 .probe = sta32x_i2c_probe, 1055 .probe = sta32x_i2c_probe,
1056 .remove = __devexit_p(sta32x_i2c_remove), 1056 .remove = sta32x_i2c_remove,
1057 .id_table = sta32x_i2c_id, 1057 .id_table = sta32x_i2c_id,
1058}; 1058};
1059 1059
diff --git a/sound/soc/codecs/sta529.c b/sound/soc/codecs/sta529.c
index 9e3144862386..ab355c4f0b2d 100644
--- a/sound/soc/codecs/sta529.c
+++ b/sound/soc/codecs/sta529.c
@@ -380,8 +380,8 @@ static const struct regmap_config sta529_regmap = {
380 .num_reg_defaults = ARRAY_SIZE(sta529_reg_defaults), 380 .num_reg_defaults = ARRAY_SIZE(sta529_reg_defaults),
381}; 381};
382 382
383static __devinit int sta529_i2c_probe(struct i2c_client *i2c, 383static int sta529_i2c_probe(struct i2c_client *i2c,
384 const struct i2c_device_id *id) 384 const struct i2c_device_id *id)
385{ 385{
386 struct sta529 *sta529; 386 struct sta529 *sta529;
387 int ret; 387 int ret;
@@ -412,7 +412,7 @@ static __devinit int sta529_i2c_probe(struct i2c_client *i2c,
412 return ret; 412 return ret;
413} 413}
414 414
415static int __devexit sta529_i2c_remove(struct i2c_client *client) 415static int sta529_i2c_remove(struct i2c_client *client)
416{ 416{
417 snd_soc_unregister_codec(&client->dev); 417 snd_soc_unregister_codec(&client->dev);
418 418
@@ -431,7 +431,7 @@ static struct i2c_driver sta529_i2c_driver = {
431 .owner = THIS_MODULE, 431 .owner = THIS_MODULE,
432 }, 432 },
433 .probe = sta529_i2c_probe, 433 .probe = sta529_i2c_probe,
434 .remove = __devexit_p(sta529_i2c_remove), 434 .remove = sta529_i2c_remove,
435 .id_table = sta529_i2c_id, 435 .id_table = sta529_i2c_id,
436}; 436};
437 437
diff --git a/sound/soc/codecs/stac9766.c b/sound/soc/codecs/stac9766.c
index 982e437799a8..2eda85ba79ac 100644
--- a/sound/soc/codecs/stac9766.c
+++ b/sound/soc/codecs/stac9766.c
@@ -385,13 +385,13 @@ static struct snd_soc_codec_driver soc_codec_dev_stac9766 = {
385 .reg_cache_default = stac9766_reg, 385 .reg_cache_default = stac9766_reg,
386}; 386};
387 387
388static __devinit int stac9766_probe(struct platform_device *pdev) 388static int stac9766_probe(struct platform_device *pdev)
389{ 389{
390 return snd_soc_register_codec(&pdev->dev, 390 return snd_soc_register_codec(&pdev->dev,
391 &soc_codec_dev_stac9766, stac9766_dai, ARRAY_SIZE(stac9766_dai)); 391 &soc_codec_dev_stac9766, stac9766_dai, ARRAY_SIZE(stac9766_dai));
392} 392}
393 393
394static int __devexit stac9766_remove(struct platform_device *pdev) 394static int stac9766_remove(struct platform_device *pdev)
395{ 395{
396 snd_soc_unregister_codec(&pdev->dev); 396 snd_soc_unregister_codec(&pdev->dev);
397 return 0; 397 return 0;
@@ -404,7 +404,7 @@ static struct platform_driver stac9766_codec_driver = {
404 }, 404 },
405 405
406 .probe = stac9766_probe, 406 .probe = stac9766_probe,
407 .remove = __devexit_p(stac9766_remove), 407 .remove = stac9766_remove,
408}; 408};
409 409
410module_platform_driver(stac9766_codec_driver); 410module_platform_driver(stac9766_codec_driver);
diff --git a/sound/soc/codecs/tlv320aic32x4.c b/sound/soc/codecs/tlv320aic32x4.c
index f230292ba96b..17df4e32feac 100644
--- a/sound/soc/codecs/tlv320aic32x4.c
+++ b/sound/soc/codecs/tlv320aic32x4.c
@@ -28,6 +28,7 @@
28#include <linux/init.h> 28#include <linux/init.h>
29#include <linux/delay.h> 29#include <linux/delay.h>
30#include <linux/pm.h> 30#include <linux/pm.h>
31#include <linux/gpio.h>
31#include <linux/i2c.h> 32#include <linux/i2c.h>
32#include <linux/cdev.h> 33#include <linux/cdev.h>
33#include <linux/slab.h> 34#include <linux/slab.h>
@@ -65,6 +66,7 @@ struct aic32x4_priv {
65 u32 power_cfg; 66 u32 power_cfg;
66 u32 micpga_routing; 67 u32 micpga_routing;
67 bool swapdacs; 68 bool swapdacs;
69 int rstn_gpio;
68}; 70};
69 71
70/* 0dB min, 1dB steps */ 72/* 0dB min, 1dB steps */
@@ -627,10 +629,20 @@ static int aic32x4_probe(struct snd_soc_codec *codec)
627{ 629{
628 struct aic32x4_priv *aic32x4 = snd_soc_codec_get_drvdata(codec); 630 struct aic32x4_priv *aic32x4 = snd_soc_codec_get_drvdata(codec);
629 u32 tmp_reg; 631 u32 tmp_reg;
632 int ret;
630 633
631 codec->hw_write = (hw_write_t) i2c_master_send; 634 codec->hw_write = (hw_write_t) i2c_master_send;
632 codec->control_data = aic32x4->control_data; 635 codec->control_data = aic32x4->control_data;
633 636
637 if (aic32x4->rstn_gpio >= 0) {
638 ret = devm_gpio_request_one(codec->dev, aic32x4->rstn_gpio,
639 GPIOF_OUT_INIT_LOW, "tlv320aic32x4 rstn");
640 if (ret != 0)
641 return ret;
642 ndelay(10);
643 gpio_set_value(aic32x4->rstn_gpio, 1);
644 }
645
634 snd_soc_write(codec, AIC32X4_RESET, 0x01); 646 snd_soc_write(codec, AIC32X4_RESET, 0x01);
635 647
636 /* Power platform configuration */ 648 /* Power platform configuration */
@@ -675,6 +687,16 @@ static int aic32x4_probe(struct snd_soc_codec *codec)
675 ARRAY_SIZE(aic32x4_snd_controls)); 687 ARRAY_SIZE(aic32x4_snd_controls));
676 aic32x4_add_widgets(codec); 688 aic32x4_add_widgets(codec);
677 689
690 /*
691 * Workaround: for an unknown reason, the ADC needs to be powered up
692 * and down for the first capture to work properly. It seems related to
693 * a HW BUG or some kind of behavior not documented in the datasheet.
694 */
695 tmp_reg = snd_soc_read(codec, AIC32X4_ADCSETUP);
696 snd_soc_write(codec, AIC32X4_ADCSETUP, tmp_reg |
697 AIC32X4_LADC_EN | AIC32X4_RADC_EN);
698 snd_soc_write(codec, AIC32X4_ADCSETUP, tmp_reg);
699
678 return 0; 700 return 0;
679} 701}
680 702
@@ -694,8 +716,8 @@ static struct snd_soc_codec_driver soc_codec_dev_aic32x4 = {
694 .set_bias_level = aic32x4_set_bias_level, 716 .set_bias_level = aic32x4_set_bias_level,
695}; 717};
696 718
697static __devinit int aic32x4_i2c_probe(struct i2c_client *i2c, 719static int aic32x4_i2c_probe(struct i2c_client *i2c,
698 const struct i2c_device_id *id) 720 const struct i2c_device_id *id)
699{ 721{
700 struct aic32x4_pdata *pdata = i2c->dev.platform_data; 722 struct aic32x4_pdata *pdata = i2c->dev.platform_data;
701 struct aic32x4_priv *aic32x4; 723 struct aic32x4_priv *aic32x4;
@@ -713,10 +735,12 @@ static __devinit int aic32x4_i2c_probe(struct i2c_client *i2c,
713 aic32x4->power_cfg = pdata->power_cfg; 735 aic32x4->power_cfg = pdata->power_cfg;
714 aic32x4->swapdacs = pdata->swapdacs; 736 aic32x4->swapdacs = pdata->swapdacs;
715 aic32x4->micpga_routing = pdata->micpga_routing; 737 aic32x4->micpga_routing = pdata->micpga_routing;
738 aic32x4->rstn_gpio = pdata->rstn_gpio;
716 } else { 739 } else {
717 aic32x4->power_cfg = 0; 740 aic32x4->power_cfg = 0;
718 aic32x4->swapdacs = false; 741 aic32x4->swapdacs = false;
719 aic32x4->micpga_routing = 0; 742 aic32x4->micpga_routing = 0;
743 aic32x4->rstn_gpio = -1;
720 } 744 }
721 745
722 ret = snd_soc_register_codec(&i2c->dev, 746 ret = snd_soc_register_codec(&i2c->dev,
@@ -724,7 +748,7 @@ static __devinit int aic32x4_i2c_probe(struct i2c_client *i2c,
724 return ret; 748 return ret;
725} 749}
726 750
727static __devexit int aic32x4_i2c_remove(struct i2c_client *client) 751static int aic32x4_i2c_remove(struct i2c_client *client)
728{ 752{
729 snd_soc_unregister_codec(&client->dev); 753 snd_soc_unregister_codec(&client->dev);
730 return 0; 754 return 0;
@@ -742,7 +766,7 @@ static struct i2c_driver aic32x4_i2c_driver = {
742 .owner = THIS_MODULE, 766 .owner = THIS_MODULE,
743 }, 767 },
744 .probe = aic32x4_i2c_probe, 768 .probe = aic32x4_i2c_probe,
745 .remove = __devexit_p(aic32x4_i2c_remove), 769 .remove = aic32x4_i2c_remove,
746 .id_table = aic32x4_i2c_id, 770 .id_table = aic32x4_i2c_id,
747}; 771};
748 772
diff --git a/sound/soc/codecs/tlv320aic32x4.h b/sound/soc/codecs/tlv320aic32x4.h
index aae2b2440398..35774223fd91 100644
--- a/sound/soc/codecs/tlv320aic32x4.h
+++ b/sound/soc/codecs/tlv320aic32x4.h
@@ -94,6 +94,9 @@
94#define AIC32X4_WORD_LEN_24BITS 0x02 94#define AIC32X4_WORD_LEN_24BITS 0x02
95#define AIC32X4_WORD_LEN_32BITS 0x03 95#define AIC32X4_WORD_LEN_32BITS 0x03
96 96
97#define AIC32X4_LADC_EN (1 << 7)
98#define AIC32X4_RADC_EN (1 << 6)
99
97#define AIC32X4_I2S_MODE 0x00 100#define AIC32X4_I2S_MODE 0x00
98#define AIC32X4_DSP_MODE 0x01 101#define AIC32X4_DSP_MODE 0x01
99#define AIC32X4_RIGHT_JUSTIFIED_MODE 0x02 102#define AIC32X4_RIGHT_JUSTIFIED_MODE 0x02
diff --git a/sound/soc/codecs/tlv320dac33.c b/sound/soc/codecs/tlv320dac33.c
index d2e16c5d7d1f..782b0cded2e6 100644
--- a/sound/soc/codecs/tlv320dac33.c
+++ b/sound/soc/codecs/tlv320dac33.c
@@ -1514,8 +1514,8 @@ static struct snd_soc_dai_driver dac33_dai = {
1514 .ops = &dac33_dai_ops, 1514 .ops = &dac33_dai_ops,
1515}; 1515};
1516 1516
1517static int __devinit dac33_i2c_probe(struct i2c_client *client, 1517static int dac33_i2c_probe(struct i2c_client *client,
1518 const struct i2c_device_id *id) 1518 const struct i2c_device_id *id)
1519{ 1519{
1520 struct tlv320dac33_platform_data *pdata; 1520 struct tlv320dac33_platform_data *pdata;
1521 struct tlv320dac33_priv *dac33; 1521 struct tlv320dac33_priv *dac33;
@@ -1586,7 +1586,7 @@ err_gpio:
1586 return ret; 1586 return ret;
1587} 1587}
1588 1588
1589static int __devexit dac33_i2c_remove(struct i2c_client *client) 1589static int dac33_i2c_remove(struct i2c_client *client)
1590{ 1590{
1591 struct tlv320dac33_priv *dac33 = i2c_get_clientdata(client); 1591 struct tlv320dac33_priv *dac33 = i2c_get_clientdata(client);
1592 1592
@@ -1617,7 +1617,7 @@ static struct i2c_driver tlv320dac33_i2c_driver = {
1617 .owner = THIS_MODULE, 1617 .owner = THIS_MODULE,
1618 }, 1618 },
1619 .probe = dac33_i2c_probe, 1619 .probe = dac33_i2c_probe,
1620 .remove = __devexit_p(dac33_i2c_remove), 1620 .remove = dac33_i2c_remove,
1621 .id_table = tlv320dac33_i2c_id, 1621 .id_table = tlv320dac33_i2c_id,
1622}; 1622};
1623 1623
diff --git a/sound/soc/codecs/tpa6130a2.c b/sound/soc/codecs/tpa6130a2.c
index 565ff39ad3a3..8d75aa152c8c 100644
--- a/sound/soc/codecs/tpa6130a2.c
+++ b/sound/soc/codecs/tpa6130a2.c
@@ -359,8 +359,8 @@ int tpa6130a2_add_controls(struct snd_soc_codec *codec)
359} 359}
360EXPORT_SYMBOL_GPL(tpa6130a2_add_controls); 360EXPORT_SYMBOL_GPL(tpa6130a2_add_controls);
361 361
362static int __devinit tpa6130a2_probe(struct i2c_client *client, 362static int tpa6130a2_probe(struct i2c_client *client,
363 const struct i2c_device_id *id) 363 const struct i2c_device_id *id)
364{ 364{
365 struct device *dev; 365 struct device *dev;
366 struct tpa6130a2_data *data; 366 struct tpa6130a2_data *data;
@@ -455,7 +455,7 @@ err_gpio:
455 return ret; 455 return ret;
456} 456}
457 457
458static int __devexit tpa6130a2_remove(struct i2c_client *client) 458static int tpa6130a2_remove(struct i2c_client *client)
459{ 459{
460 struct tpa6130a2_data *data = i2c_get_clientdata(client); 460 struct tpa6130a2_data *data = i2c_get_clientdata(client);
461 461
@@ -483,7 +483,7 @@ static struct i2c_driver tpa6130a2_i2c_driver = {
483 .owner = THIS_MODULE, 483 .owner = THIS_MODULE,
484 }, 484 },
485 .probe = tpa6130a2_probe, 485 .probe = tpa6130a2_probe,
486 .remove = __devexit_p(tpa6130a2_remove), 486 .remove = tpa6130a2_remove,
487 .id_table = tpa6130a2_id, 487 .id_table = tpa6130a2_id,
488}; 488};
489 489
diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c
index e7f608996c41..63b280b06035 100644
--- a/sound/soc/codecs/twl4030.c
+++ b/sound/soc/codecs/twl4030.c
@@ -2334,13 +2334,13 @@ static struct snd_soc_codec_driver soc_codec_dev_twl4030 = {
2334 .num_dapm_routes = ARRAY_SIZE(intercon), 2334 .num_dapm_routes = ARRAY_SIZE(intercon),
2335}; 2335};
2336 2336
2337static int __devinit twl4030_codec_probe(struct platform_device *pdev) 2337static int twl4030_codec_probe(struct platform_device *pdev)
2338{ 2338{
2339 return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_twl4030, 2339 return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_twl4030,
2340 twl4030_dai, ARRAY_SIZE(twl4030_dai)); 2340 twl4030_dai, ARRAY_SIZE(twl4030_dai));
2341} 2341}
2342 2342
2343static int __devexit twl4030_codec_remove(struct platform_device *pdev) 2343static int twl4030_codec_remove(struct platform_device *pdev)
2344{ 2344{
2345 snd_soc_unregister_codec(&pdev->dev); 2345 snd_soc_unregister_codec(&pdev->dev);
2346 return 0; 2346 return 0;
@@ -2350,7 +2350,7 @@ MODULE_ALIAS("platform:twl4030-codec");
2350 2350
2351static struct platform_driver twl4030_codec_driver = { 2351static struct platform_driver twl4030_codec_driver = {
2352 .probe = twl4030_codec_probe, 2352 .probe = twl4030_codec_probe,
2353 .remove = __devexit_p(twl4030_codec_remove), 2353 .remove = twl4030_codec_remove,
2354 .driver = { 2354 .driver = {
2355 .name = "twl4030-codec", 2355 .name = "twl4030-codec",
2356 .owner = THIS_MODULE, 2356 .owner = THIS_MODULE,
diff --git a/sound/soc/codecs/twl6040.c b/sound/soc/codecs/twl6040.c
index 00b85cc1b9a3..3fc3fc64dd8b 100644
--- a/sound/soc/codecs/twl6040.c
+++ b/sound/soc/codecs/twl6040.c
@@ -1229,13 +1229,13 @@ static struct snd_soc_codec_driver soc_codec_dev_twl6040 = {
1229 .num_dapm_routes = ARRAY_SIZE(intercon), 1229 .num_dapm_routes = ARRAY_SIZE(intercon),
1230}; 1230};
1231 1231
1232static int __devinit twl6040_codec_probe(struct platform_device *pdev) 1232static int twl6040_codec_probe(struct platform_device *pdev)
1233{ 1233{
1234 return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_twl6040, 1234 return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_twl6040,
1235 twl6040_dai, ARRAY_SIZE(twl6040_dai)); 1235 twl6040_dai, ARRAY_SIZE(twl6040_dai));
1236} 1236}
1237 1237
1238static int __devexit twl6040_codec_remove(struct platform_device *pdev) 1238static int twl6040_codec_remove(struct platform_device *pdev)
1239{ 1239{
1240 snd_soc_unregister_codec(&pdev->dev); 1240 snd_soc_unregister_codec(&pdev->dev);
1241 return 0; 1241 return 0;
@@ -1247,7 +1247,7 @@ static struct platform_driver twl6040_codec_driver = {
1247 .owner = THIS_MODULE, 1247 .owner = THIS_MODULE,
1248 }, 1248 },
1249 .probe = twl6040_codec_probe, 1249 .probe = twl6040_codec_probe,
1250 .remove = __devexit_p(twl6040_codec_remove), 1250 .remove = twl6040_codec_remove,
1251}; 1251};
1252 1252
1253module_platform_driver(twl6040_codec_driver); 1253module_platform_driver(twl6040_codec_driver);
diff --git a/sound/soc/codecs/uda134x.c b/sound/soc/codecs/uda134x.c
index 6c3d43b8ee85..6d0aa44c3757 100644
--- a/sound/soc/codecs/uda134x.c
+++ b/sound/soc/codecs/uda134x.c
@@ -601,13 +601,13 @@ static struct snd_soc_codec_driver soc_codec_dev_uda134x = {
601 .set_bias_level = uda134x_set_bias_level, 601 .set_bias_level = uda134x_set_bias_level,
602}; 602};
603 603
604static int __devinit uda134x_codec_probe(struct platform_device *pdev) 604static int uda134x_codec_probe(struct platform_device *pdev)
605{ 605{
606 return snd_soc_register_codec(&pdev->dev, 606 return snd_soc_register_codec(&pdev->dev,
607 &soc_codec_dev_uda134x, &uda134x_dai, 1); 607 &soc_codec_dev_uda134x, &uda134x_dai, 1);
608} 608}
609 609
610static int __devexit uda134x_codec_remove(struct platform_device *pdev) 610static int uda134x_codec_remove(struct platform_device *pdev)
611{ 611{
612 snd_soc_unregister_codec(&pdev->dev); 612 snd_soc_unregister_codec(&pdev->dev);
613 return 0; 613 return 0;
@@ -619,7 +619,7 @@ static struct platform_driver uda134x_codec_driver = {
619 .owner = THIS_MODULE, 619 .owner = THIS_MODULE,
620 }, 620 },
621 .probe = uda134x_codec_probe, 621 .probe = uda134x_codec_probe,
622 .remove = __devexit_p(uda134x_codec_remove), 622 .remove = uda134x_codec_remove,
623}; 623};
624 624
625module_platform_driver(uda134x_codec_driver); 625module_platform_driver(uda134x_codec_driver);
diff --git a/sound/soc/codecs/uda1380.c b/sound/soc/codecs/uda1380.c
index 2502214b84ab..fd0a314bc209 100644
--- a/sound/soc/codecs/uda1380.c
+++ b/sound/soc/codecs/uda1380.c
@@ -795,8 +795,8 @@ static struct snd_soc_codec_driver soc_codec_dev_uda1380 = {
795}; 795};
796 796
797#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) 797#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
798static __devinit int uda1380_i2c_probe(struct i2c_client *i2c, 798static int uda1380_i2c_probe(struct i2c_client *i2c,
799 const struct i2c_device_id *id) 799 const struct i2c_device_id *id)
800{ 800{
801 struct uda1380_priv *uda1380; 801 struct uda1380_priv *uda1380;
802 int ret; 802 int ret;
@@ -814,7 +814,7 @@ static __devinit int uda1380_i2c_probe(struct i2c_client *i2c,
814 return ret; 814 return ret;
815} 815}
816 816
817static int __devexit uda1380_i2c_remove(struct i2c_client *i2c) 817static int uda1380_i2c_remove(struct i2c_client *i2c)
818{ 818{
819 snd_soc_unregister_codec(&i2c->dev); 819 snd_soc_unregister_codec(&i2c->dev);
820 return 0; 820 return 0;
@@ -832,7 +832,7 @@ static struct i2c_driver uda1380_i2c_driver = {
832 .owner = THIS_MODULE, 832 .owner = THIS_MODULE,
833 }, 833 },
834 .probe = uda1380_i2c_probe, 834 .probe = uda1380_i2c_probe,
835 .remove = __devexit_p(uda1380_i2c_remove), 835 .remove = uda1380_i2c_remove,
836 .id_table = uda1380_i2c_id, 836 .id_table = uda1380_i2c_id,
837}; 837};
838#endif 838#endif
diff --git a/sound/soc/codecs/wl1273.c b/sound/soc/codecs/wl1273.c
index 7b24d6d192e1..54cd3da09abd 100644
--- a/sound/soc/codecs/wl1273.c
+++ b/sound/soc/codecs/wl1273.c
@@ -485,13 +485,13 @@ static struct snd_soc_codec_driver soc_codec_dev_wl1273 = {
485 .remove = wl1273_remove, 485 .remove = wl1273_remove,
486}; 486};
487 487
488static int __devinit wl1273_platform_probe(struct platform_device *pdev) 488static int wl1273_platform_probe(struct platform_device *pdev)
489{ 489{
490 return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_wl1273, 490 return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_wl1273,
491 &wl1273_dai, 1); 491 &wl1273_dai, 1);
492} 492}
493 493
494static int __devexit wl1273_platform_remove(struct platform_device *pdev) 494static int wl1273_platform_remove(struct platform_device *pdev)
495{ 495{
496 snd_soc_unregister_codec(&pdev->dev); 496 snd_soc_unregister_codec(&pdev->dev);
497 return 0; 497 return 0;
@@ -505,7 +505,7 @@ static struct platform_driver wl1273_platform_driver = {
505 .owner = THIS_MODULE, 505 .owner = THIS_MODULE,
506 }, 506 },
507 .probe = wl1273_platform_probe, 507 .probe = wl1273_platform_probe,
508 .remove = __devexit_p(wl1273_platform_remove), 508 .remove = wl1273_platform_remove,
509}; 509};
510 510
511module_platform_driver(wl1273_platform_driver); 511module_platform_driver(wl1273_platform_driver);
diff --git a/sound/soc/codecs/wm0010.c b/sound/soc/codecs/wm0010.c
index 99afc003a084..ad2fee4bb4cd 100644
--- a/sound/soc/codecs/wm0010.c
+++ b/sound/soc/codecs/wm0010.c
@@ -31,6 +31,9 @@
31 31
32#define DEVICE_ID_WM0010 10 32#define DEVICE_ID_WM0010 10
33 33
34/* We only support v1 of the .dfw INFO record */
35#define INFO_VERSION 1
36
34enum dfw_cmd { 37enum dfw_cmd {
35 DFW_CMD_FUSE = 0x01, 38 DFW_CMD_FUSE = 0x01,
36 DFW_CMD_CODE_HDR, 39 DFW_CMD_CODE_HDR,
@@ -46,6 +49,13 @@ struct dfw_binrec {
46 uint8_t data[0]; 49 uint8_t data[0];
47} __packed; 50} __packed;
48 51
52struct dfw_inforec {
53 u8 info_version;
54 u8 tool_major_version;
55 u8 tool_minor_version;
56 u8 dsp_target;
57};
58
49struct dfw_pllrec { 59struct dfw_pllrec {
50 u8 command; 60 u8 command;
51 u32 length:24; 61 u32 length:24;
@@ -97,7 +107,6 @@ struct wm0010_priv {
97 107
98 enum wm0010_state state; 108 enum wm0010_state state;
99 bool boot_failed; 109 bool boot_failed;
100 int boot_done;
101 bool ready; 110 bool ready;
102 bool pll_running; 111 bool pll_running;
103 int max_spi_freq; 112 int max_spi_freq;
@@ -234,7 +243,7 @@ static void wm0010_boot_xfer_complete(void *data)
234 break; 243 break;
235 244
236 case 0x55555555: 245 case 0x55555555:
237 if (wm0010->boot_done == 0) 246 if (wm0010->state < WM0010_STAGE2)
238 break; 247 break;
239 dev_err(codec->dev, 248 dev_err(codec->dev,
240 "%d: ROM bootloader running in stage 2\n", i); 249 "%d: ROM bootloader running in stage 2\n", i);
@@ -321,7 +330,6 @@ static void wm0010_boot_xfer_complete(void *data)
321 break; 330 break;
322 } 331 }
323 332
324 wm0010->boot_done++;
325 if (xfer->done) 333 if (xfer->done)
326 complete(xfer->done); 334 complete(xfer->done);
327} 335}
@@ -334,94 +342,198 @@ static void byte_swap_64(u64 *data_in, u64 *data_out, u32 len)
334 data_out[i] = cpu_to_be64(le64_to_cpu(data_in[i])); 342 data_out[i] = cpu_to_be64(le64_to_cpu(data_in[i]));
335} 343}
336 344
337static int wm0010_boot(struct snd_soc_codec *codec) 345static int wm0010_firmware_load(char *name, struct snd_soc_codec *codec)
338{ 346{
339 struct spi_device *spi = to_spi_device(codec->dev); 347 struct spi_device *spi = to_spi_device(codec->dev);
340 struct wm0010_priv *wm0010 = snd_soc_codec_get_drvdata(codec); 348 struct wm0010_priv *wm0010 = snd_soc_codec_get_drvdata(codec);
341 unsigned long flags;
342 struct list_head xfer_list; 349 struct list_head xfer_list;
343 struct wm0010_boot_xfer *xfer; 350 struct wm0010_boot_xfer *xfer;
344 int ret; 351 int ret;
345 struct completion done; 352 struct completion done;
346 const struct firmware *fw; 353 const struct firmware *fw;
347 const struct dfw_binrec *rec; 354 const struct dfw_binrec *rec;
348 struct spi_message m; 355 const struct dfw_inforec *inforec;
349 struct spi_transfer t; 356 u64 *img;
350 struct dfw_pllrec pll_rec; 357 u8 *out, dsp;
351 u32 *img, *p;
352 u64 *img_swap;
353 u8 *out;
354 u32 len, offset; 358 u32 len, offset;
355 int i;
356 359
357 spin_lock_irqsave(&wm0010->irq_lock, flags); 360 INIT_LIST_HEAD(&xfer_list);
358 if (wm0010->state != WM0010_POWER_OFF)
359 dev_warn(wm0010->dev, "DSP already powered up!\n");
360 spin_unlock_irqrestore(&wm0010->irq_lock, flags);
361 361
362 if (wm0010->sysclk > 26000000) { 362 ret = request_firmware(&fw, name, codec->dev);
363 dev_err(codec->dev, "Max DSP clock frequency is 26MHz\n"); 363 if (ret != 0) {
364 ret = -ECANCELED; 364 dev_err(codec->dev, "Failed to request application: %d\n",
365 goto err; 365 ret);
366 return ret;
366 } 367 }
367 368
368 INIT_LIST_HEAD(&xfer_list); 369 rec = (const struct dfw_binrec *)fw->data;
370 inforec = (const struct dfw_inforec *)rec->data;
371 offset = 0;
372 dsp = inforec->dsp_target;
373 wm0010->boot_failed = false;
374 BUG_ON(!list_empty(&xfer_list));
375 init_completion(&done);
369 376
370 mutex_lock(&wm0010->lock); 377 /* First record should be INFO */
371 wm0010->pll_running = false; 378 if (rec->command != DFW_CMD_INFO) {
379 dev_err(codec->dev, "First record not INFO\r\n");
380 ret = -EINVAL;
381 goto abort;
382 }
372 383
373 dev_dbg(codec->dev, "max_spi_freq: %d\n", wm0010->max_spi_freq); 384 if (inforec->info_version != INFO_VERSION) {
385 dev_err(codec->dev,
386 "Unsupported version (%02d) of INFO record\r\n",
387 inforec->info_version);
388 ret = -EINVAL;
389 goto abort;
390 }
374 391
375 ret = regulator_bulk_enable(ARRAY_SIZE(wm0010->core_supplies), 392 dev_dbg(codec->dev, "Version v%02d INFO record found\r\n",
376 wm0010->core_supplies); 393 inforec->info_version);
377 if (ret != 0) { 394
378 dev_err(&spi->dev, "Failed to enable core supplies: %d\n", 395 /* Check it's a DSP file */
379 ret); 396 if (dsp != DEVICE_ID_WM0010) {
380 mutex_unlock(&wm0010->lock); 397 dev_err(codec->dev, "Not a WM0010 firmware file.\r\n");
381 goto err; 398 ret = -EINVAL;
399 goto abort;
382 } 400 }
383 401
384 ret = regulator_enable(wm0010->dbvdd); 402 /* Skip the info record as we don't need to send it */
385 if (ret != 0) { 403 offset += ((rec->length) + 8);
386 dev_err(&spi->dev, "Failed to enable DBVDD: %d\n", ret); 404 rec = (void *)&rec->data[rec->length];
387 goto err_core; 405
406 while (offset < fw->size) {
407 dev_dbg(codec->dev,
408 "Packet: command %d, data length = 0x%x\r\n",
409 rec->command, rec->length);
410 len = rec->length + 8;
411
412 out = kzalloc(len, GFP_KERNEL);
413 if (!out) {
414 dev_err(codec->dev,
415 "Failed to allocate RX buffer\n");
416 ret = -ENOMEM;
417 goto abort1;
418 }
419
420 img = kzalloc(len, GFP_KERNEL);
421 if (!img) {
422 dev_err(codec->dev,
423 "Failed to allocate image buffer\n");
424 ret = -ENOMEM;
425 goto abort1;
426 }
427
428 byte_swap_64((u64 *)&rec->command, img, len);
429
430 xfer = kzalloc(sizeof(*xfer), GFP_KERNEL);
431 if (!xfer) {
432 dev_err(codec->dev, "Failed to allocate xfer\n");
433 ret = -ENOMEM;
434 goto abort1;
435 }
436
437 xfer->codec = codec;
438 list_add_tail(&xfer->list, &xfer_list);
439
440 spi_message_init(&xfer->m);
441 xfer->m.complete = wm0010_boot_xfer_complete;
442 xfer->m.context = xfer;
443 xfer->t.tx_buf = img;
444 xfer->t.rx_buf = out;
445 xfer->t.len = len;
446 xfer->t.bits_per_word = 8;
447
448 if (!wm0010->pll_running) {
449 xfer->t.speed_hz = wm0010->sysclk / 6;
450 } else {
451 xfer->t.speed_hz = wm0010->max_spi_freq;
452
453 if (wm0010->board_max_spi_speed &&
454 (wm0010->board_max_spi_speed < wm0010->max_spi_freq))
455 xfer->t.speed_hz = wm0010->board_max_spi_speed;
456 }
457
458 /* Store max usable spi frequency for later use */
459 wm0010->max_spi_freq = xfer->t.speed_hz;
460
461 spi_message_add_tail(&xfer->t, &xfer->m);
462
463 offset += ((rec->length) + 8);
464 rec = (void *)&rec->data[rec->length];
465
466 if (offset >= fw->size) {
467 dev_dbg(codec->dev, "All transfers scheduled\n");
468 xfer->done = &done;
469 }
470
471 ret = spi_async(spi, &xfer->m);
472 if (ret != 0) {
473 dev_err(codec->dev, "Write failed: %d\n", ret);
474 goto abort1;
475 }
476
477 if (wm0010->boot_failed) {
478 dev_dbg(codec->dev, "Boot fail!\n");
479 ret = -EINVAL;
480 goto abort1;
481 }
388 } 482 }
389 483
390 /* Release reset */ 484 wait_for_completion(&done);
391 gpio_set_value_cansleep(wm0010->gpio_reset, !wm0010->gpio_reset_value); 485
392 spin_lock_irqsave(&wm0010->irq_lock, flags); 486 ret = 0;
393 wm0010->state = WM0010_OUT_OF_RESET; 487
394 spin_unlock_irqrestore(&wm0010->irq_lock, flags); 488abort1:
489 while (!list_empty(&xfer_list)) {
490 xfer = list_first_entry(&xfer_list, struct wm0010_boot_xfer,
491 list);
492 kfree(xfer->t.rx_buf);
493 kfree(xfer->t.tx_buf);
494 list_del(&xfer->list);
495 kfree(xfer);
496 }
497
498abort:
499 release_firmware(fw);
500 return ret;
501}
502
503static int wm0010_stage2_load(struct snd_soc_codec *codec)
504{
505 struct spi_device *spi = to_spi_device(codec->dev);
506 struct wm0010_priv *wm0010 = snd_soc_codec_get_drvdata(codec);
507 const struct firmware *fw;
508 struct spi_message m;
509 struct spi_transfer t;
510 u32 *img;
511 u8 *out;
512 int i;
513 int ret = 0;
395 514
396 /* First the bootloader */
397 ret = request_firmware(&fw, "wm0010_stage2.bin", codec->dev); 515 ret = request_firmware(&fw, "wm0010_stage2.bin", codec->dev);
398 if (ret != 0) { 516 if (ret != 0) {
399 dev_err(codec->dev, "Failed to request stage2 loader: %d\n", 517 dev_err(codec->dev, "Failed to request stage2 loader: %d\n",
400 ret); 518 ret);
401 goto abort; 519 return ret;
402 } 520 }
403 521
404 if (!wait_for_completion_timeout(&wm0010->boot_completion,
405 msecs_to_jiffies(10)))
406 dev_err(codec->dev, "Failed to get interrupt from DSP\n");
407
408 spin_lock_irqsave(&wm0010->irq_lock, flags);
409 wm0010->state = WM0010_BOOTROM;
410 spin_unlock_irqrestore(&wm0010->irq_lock, flags);
411
412 dev_dbg(codec->dev, "Downloading %zu byte stage 2 loader\n", fw->size); 522 dev_dbg(codec->dev, "Downloading %zu byte stage 2 loader\n", fw->size);
413 523
414 /* Copy to local buffer first as vmalloc causes problems for dma */ 524 /* Copy to local buffer first as vmalloc causes problems for dma */
415 img = kzalloc(fw->size, GFP_KERNEL); 525 img = kzalloc(fw->size, GFP_KERNEL);
416 if (!img) { 526 if (!img) {
417 dev_err(codec->dev, "Failed to allocate image buffer\n"); 527 dev_err(codec->dev, "Failed to allocate image buffer\n");
418 goto abort; 528 ret = -ENOMEM;
529 goto abort2;
419 } 530 }
420 531
421 out = kzalloc(fw->size, GFP_KERNEL); 532 out = kzalloc(fw->size, GFP_KERNEL);
422 if (!out) { 533 if (!out) {
423 dev_err(codec->dev, "Failed to allocate output buffer\n"); 534 dev_err(codec->dev, "Failed to allocate output buffer\n");
424 goto abort; 535 ret = -ENOMEM;
536 goto abort1;
425 } 537 }
426 538
427 memcpy(img, &fw->data[0], fw->size); 539 memcpy(img, &fw->data[0], fw->size);
@@ -447,20 +559,97 @@ static int wm0010_boot(struct snd_soc_codec *codec)
447 /* Look for errors from the boot ROM */ 559 /* Look for errors from the boot ROM */
448 for (i = 0; i < fw->size; i++) { 560 for (i = 0; i < fw->size; i++) {
449 if (out[i] != 0x55) { 561 if (out[i] != 0x55) {
450 ret = -EBUSY;
451 dev_err(codec->dev, "Boot ROM error: %x in %d\n", 562 dev_err(codec->dev, "Boot ROM error: %x in %d\n",
452 out[i], i); 563 out[i], i);
453 wm0010_mark_boot_failure(wm0010); 564 wm0010_mark_boot_failure(wm0010);
565 ret = -EBUSY;
454 goto abort; 566 goto abort;
455 } 567 }
456 } 568 }
457 569abort:
458 release_firmware(fw);
459 kfree(img);
460 kfree(out); 570 kfree(out);
571abort1:
572 kfree(img);
573abort2:
574 release_firmware(fw);
575
576 return ret;
577}
578
579static int wm0010_boot(struct snd_soc_codec *codec)
580{
581 struct spi_device *spi = to_spi_device(codec->dev);
582 struct wm0010_priv *wm0010 = snd_soc_codec_get_drvdata(codec);
583 unsigned long flags;
584 int ret;
585 const struct firmware *fw;
586 struct spi_message m;
587 struct spi_transfer t;
588 struct dfw_pllrec pll_rec;
589 u32 *p, len;
590 u64 *img_swap;
591 u8 *out;
592 int i;
593
594 spin_lock_irqsave(&wm0010->irq_lock, flags);
595 if (wm0010->state != WM0010_POWER_OFF)
596 dev_warn(wm0010->dev, "DSP already powered up!\n");
597 spin_unlock_irqrestore(&wm0010->irq_lock, flags);
598
599 if (wm0010->sysclk > 26000000) {
600 dev_err(codec->dev, "Max DSP clock frequency is 26MHz\n");
601 ret = -ECANCELED;
602 goto err;
603 }
604
605 mutex_lock(&wm0010->lock);
606 wm0010->pll_running = false;
607
608 dev_dbg(codec->dev, "max_spi_freq: %d\n", wm0010->max_spi_freq);
609
610 ret = regulator_bulk_enable(ARRAY_SIZE(wm0010->core_supplies),
611 wm0010->core_supplies);
612 if (ret != 0) {
613 dev_err(&spi->dev, "Failed to enable core supplies: %d\n",
614 ret);
615 mutex_unlock(&wm0010->lock);
616 goto err;
617 }
618
619 ret = regulator_enable(wm0010->dbvdd);
620 if (ret != 0) {
621 dev_err(&spi->dev, "Failed to enable DBVDD: %d\n", ret);
622 goto err_core;
623 }
624
625 /* Release reset */
626 gpio_set_value_cansleep(wm0010->gpio_reset, !wm0010->gpio_reset_value);
627 spin_lock_irqsave(&wm0010->irq_lock, flags);
628 wm0010->state = WM0010_OUT_OF_RESET;
629 spin_unlock_irqrestore(&wm0010->irq_lock, flags);
630
631 /* First the bootloader */
632 ret = request_firmware(&fw, "wm0010_stage2.bin", codec->dev);
633 if (ret != 0) {
634 dev_err(codec->dev, "Failed to request stage2 loader: %d\n",
635 ret);
636 goto abort;
637 }
638
639 if (!wait_for_completion_timeout(&wm0010->boot_completion,
640 msecs_to_jiffies(20)))
641 dev_err(codec->dev, "Failed to get interrupt from DSP\n");
642
643 spin_lock_irqsave(&wm0010->irq_lock, flags);
644 wm0010->state = WM0010_BOOTROM;
645 spin_unlock_irqrestore(&wm0010->irq_lock, flags);
646
647 ret = wm0010_stage2_load(codec);
648 if (ret)
649 goto abort;
461 650
462 if (!wait_for_completion_timeout(&wm0010->boot_completion, 651 if (!wait_for_completion_timeout(&wm0010->boot_completion,
463 msecs_to_jiffies(10))) 652 msecs_to_jiffies(20)))
464 dev_err(codec->dev, "Failed to get interrupt from DSP loader.\n"); 653 dev_err(codec->dev, "Failed to get interrupt from DSP loader.\n");
465 654
466 spin_lock_irqsave(&wm0010->irq_lock, flags); 655 spin_lock_irqsave(&wm0010->irq_lock, flags);
@@ -535,110 +724,10 @@ static int wm0010_boot(struct snd_soc_codec *codec)
535 } else 724 } else
536 dev_dbg(codec->dev, "Not enabling DSP PLL."); 725 dev_dbg(codec->dev, "Not enabling DSP PLL.");
537 726
538 ret = request_firmware(&fw, "wm0010.dfw", codec->dev); 727 ret = wm0010_firmware_load("wm0010.dfw", codec);
539 if (ret != 0) {
540 dev_err(codec->dev, "Failed to request application: %d\n",
541 ret);
542 goto abort;
543 }
544
545 rec = (const struct dfw_binrec *)fw->data;
546 offset = 0;
547 wm0010->boot_done = 0;
548 wm0010->boot_failed = false;
549 BUG_ON(!list_empty(&xfer_list));
550 init_completion(&done);
551 728
552 /* First record should be INFO */ 729 if (ret != 0)
553 if (rec->command != DFW_CMD_INFO) {
554 dev_err(codec->dev, "First record not INFO\r\n");
555 goto abort;
556 }
557
558 /* Check it's a 0010 file */
559 if (rec->data[0] != DEVICE_ID_WM0010) {
560 dev_err(codec->dev, "Not a WM0010 firmware file.\r\n");
561 goto abort; 730 goto abort;
562 }
563
564 /* Skip the info record as we don't need to send it */
565 offset += ((rec->length) + 8);
566 rec = (void *)&rec->data[rec->length];
567
568 while (offset < fw->size) {
569 dev_dbg(codec->dev,
570 "Packet: command %d, data length = 0x%x\r\n",
571 rec->command, rec->length);
572 len = rec->length + 8;
573
574 out = kzalloc(len, GFP_KERNEL);
575 if (!out) {
576 dev_err(codec->dev,
577 "Failed to allocate RX buffer\n");
578 goto abort;
579 }
580
581 img_swap = kzalloc(len, GFP_KERNEL);
582 if (!img_swap) {
583 dev_err(codec->dev,
584 "Failed to allocate image buffer\n");
585 goto abort;
586 }
587
588 /* We need to re-order for 0010 */
589 byte_swap_64((u64 *)&rec->command, img_swap, len);
590
591 xfer = kzalloc(sizeof(*xfer), GFP_KERNEL);
592 if (!xfer) {
593 dev_err(codec->dev, "Failed to allocate xfer\n");
594 goto abort;
595 }
596
597 xfer->codec = codec;
598 list_add_tail(&xfer->list, &xfer_list);
599
600 spi_message_init(&xfer->m);
601 xfer->m.complete = wm0010_boot_xfer_complete;
602 xfer->m.context = xfer;
603 xfer->t.tx_buf = img_swap;
604 xfer->t.rx_buf = out;
605 xfer->t.len = len;
606 xfer->t.bits_per_word = 8;
607
608 if (!wm0010->pll_running) {
609 xfer->t.speed_hz = wm0010->sysclk / 6;
610 } else {
611 xfer->t.speed_hz = wm0010->max_spi_freq;
612
613 if (wm0010->board_max_spi_speed &&
614 (wm0010->board_max_spi_speed < wm0010->max_spi_freq))
615 xfer->t.speed_hz = wm0010->board_max_spi_speed;
616 }
617
618 /* Store max usable spi frequency for later use */
619 wm0010->max_spi_freq = xfer->t.speed_hz;
620
621 spi_message_add_tail(&xfer->t, &xfer->m);
622
623 offset += ((rec->length) + 8);
624 rec = (void *)&rec->data[rec->length];
625
626 if (offset >= fw->size) {
627 dev_dbg(codec->dev, "All transfers scheduled\n");
628 xfer->done = &done;
629 }
630
631 ret = spi_async(spi, &xfer->m);
632 if (ret != 0) {
633 dev_err(codec->dev, "Write failed: %d\n", ret);
634 goto abort;
635 }
636
637 if (wm0010->boot_failed)
638 goto abort;
639 }
640
641 wait_for_completion(&done);
642 731
643 spin_lock_irqsave(&wm0010->irq_lock, flags); 732 spin_lock_irqsave(&wm0010->irq_lock, flags);
644 wm0010->state = WM0010_FIRMWARE; 733 wm0010->state = WM0010_FIRMWARE;
@@ -646,17 +735,6 @@ static int wm0010_boot(struct snd_soc_codec *codec)
646 735
647 mutex_unlock(&wm0010->lock); 736 mutex_unlock(&wm0010->lock);
648 737
649 release_firmware(fw);
650
651 while (!list_empty(&xfer_list)) {
652 xfer = list_first_entry(&xfer_list, struct wm0010_boot_xfer,
653 list);
654 kfree(xfer->t.rx_buf);
655 kfree(xfer->t.tx_buf);
656 list_del(&xfer->list);
657 kfree(xfer);
658 }
659
660 return 0; 738 return 0;
661 739
662abort: 740abort:
@@ -784,7 +862,6 @@ static irqreturn_t wm0010_irq(int irq, void *data)
784 struct wm0010_priv *wm0010 = data; 862 struct wm0010_priv *wm0010 = data;
785 863
786 switch (wm0010->state) { 864 switch (wm0010->state) {
787 case WM0010_POWER_OFF:
788 case WM0010_OUT_OF_RESET: 865 case WM0010_OUT_OF_RESET:
789 case WM0010_BOOTROM: 866 case WM0010_BOOTROM:
790 case WM0010_STAGE2: 867 case WM0010_STAGE2:
@@ -808,7 +885,7 @@ static int wm0010_probe(struct snd_soc_codec *codec)
808 return 0; 885 return 0;
809} 886}
810 887
811static int __devinit wm0010_spi_probe(struct spi_device *spi) 888static int wm0010_spi_probe(struct spi_device *spi)
812{ 889{
813 unsigned long gpio_flags; 890 unsigned long gpio_flags;
814 int ret; 891 int ret;
@@ -908,7 +985,7 @@ static int __devinit wm0010_spi_probe(struct spi_device *spi)
908 return 0; 985 return 0;
909} 986}
910 987
911static int __devexit wm0010_spi_remove(struct spi_device *spi) 988static int wm0010_spi_remove(struct spi_device *spi)
912{ 989{
913 struct wm0010_priv *wm0010 = spi_get_drvdata(spi); 990 struct wm0010_priv *wm0010 = spi_get_drvdata(spi);
914 991
@@ -930,7 +1007,7 @@ static struct spi_driver wm0010_spi_driver = {
930 .owner = THIS_MODULE, 1007 .owner = THIS_MODULE,
931 }, 1008 },
932 .probe = wm0010_spi_probe, 1009 .probe = wm0010_spi_probe,
933 .remove = __devexit_p(wm0010_spi_remove), 1010 .remove = wm0010_spi_remove,
934}; 1011};
935 1012
936module_spi_driver(wm0010_spi_driver); 1013module_spi_driver(wm0010_spi_driver);
diff --git a/sound/soc/codecs/wm1250-ev1.c b/sound/soc/codecs/wm1250-ev1.c
index 951d7b49476a..6e6b93d4696e 100644
--- a/sound/soc/codecs/wm1250-ev1.c
+++ b/sound/soc/codecs/wm1250-ev1.c
@@ -153,7 +153,7 @@ static struct snd_soc_codec_driver soc_codec_dev_wm1250_ev1 = {
153 .idle_bias_off = true, 153 .idle_bias_off = true,
154}; 154};
155 155
156static int __devinit wm1250_ev1_pdata(struct i2c_client *i2c) 156static int wm1250_ev1_pdata(struct i2c_client *i2c)
157{ 157{
158 struct wm1250_ev1_pdata *pdata = dev_get_platdata(&i2c->dev); 158 struct wm1250_ev1_pdata *pdata = dev_get_platdata(&i2c->dev);
159 struct wm1250_priv *wm1250; 159 struct wm1250_priv *wm1250;
@@ -199,8 +199,8 @@ static void wm1250_ev1_free(struct i2c_client *i2c)
199 gpio_free_array(wm1250->gpios, ARRAY_SIZE(wm1250->gpios)); 199 gpio_free_array(wm1250->gpios, ARRAY_SIZE(wm1250->gpios));
200} 200}
201 201
202static int __devinit wm1250_ev1_probe(struct i2c_client *i2c, 202static int wm1250_ev1_probe(struct i2c_client *i2c,
203 const struct i2c_device_id *i2c_id) 203 const struct i2c_device_id *i2c_id)
204{ 204{
205 int id, board, rev, ret; 205 int id, board, rev, ret;
206 206
@@ -237,7 +237,7 @@ static int __devinit wm1250_ev1_probe(struct i2c_client *i2c,
237 return 0; 237 return 0;
238} 238}
239 239
240static int __devexit wm1250_ev1_remove(struct i2c_client *i2c) 240static int wm1250_ev1_remove(struct i2c_client *i2c)
241{ 241{
242 snd_soc_unregister_codec(&i2c->dev); 242 snd_soc_unregister_codec(&i2c->dev);
243 wm1250_ev1_free(i2c); 243 wm1250_ev1_free(i2c);
@@ -257,7 +257,7 @@ static struct i2c_driver wm1250_ev1_i2c_driver = {
257 .owner = THIS_MODULE, 257 .owner = THIS_MODULE,
258 }, 258 },
259 .probe = wm1250_ev1_probe, 259 .probe = wm1250_ev1_probe,
260 .remove = __devexit_p(wm1250_ev1_remove), 260 .remove = wm1250_ev1_remove,
261 .id_table = wm1250_ev1_i2c_id, 261 .id_table = wm1250_ev1_i2c_id,
262}; 262};
263 263
diff --git a/sound/soc/codecs/wm2000.c b/sound/soc/codecs/wm2000.c
index 683dc43b1d87..1cbe88f01d63 100644
--- a/sound/soc/codecs/wm2000.c
+++ b/sound/soc/codecs/wm2000.c
@@ -646,7 +646,7 @@ static const struct snd_kcontrol_new wm2000_controls[] = {
646static int wm2000_anc_power_event(struct snd_soc_dapm_widget *w, 646static int wm2000_anc_power_event(struct snd_soc_dapm_widget *w,
647 struct snd_kcontrol *kcontrol, int event) 647 struct snd_kcontrol *kcontrol, int event)
648{ 648{
649 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 649 struct snd_soc_codec *codec = w->codec;
650 struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev); 650 struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev);
651 651
652 if (SND_SOC_DAPM_EVENT_ON(event)) 652 if (SND_SOC_DAPM_EVENT_ON(event))
@@ -764,8 +764,8 @@ static struct snd_soc_codec_driver soc_codec_dev_wm2000 = {
764 .num_controls = ARRAY_SIZE(wm2000_controls), 764 .num_controls = ARRAY_SIZE(wm2000_controls),
765}; 765};
766 766
767static int __devinit wm2000_i2c_probe(struct i2c_client *i2c, 767static int wm2000_i2c_probe(struct i2c_client *i2c,
768 const struct i2c_device_id *i2c_id) 768 const struct i2c_device_id *i2c_id)
769{ 769{
770 struct wm2000_priv *wm2000; 770 struct wm2000_priv *wm2000;
771 struct wm2000_platform_data *pdata; 771 struct wm2000_platform_data *pdata;
@@ -871,7 +871,7 @@ out:
871 return ret; 871 return ret;
872} 872}
873 873
874static __devexit int wm2000_i2c_remove(struct i2c_client *i2c) 874static int wm2000_i2c_remove(struct i2c_client *i2c)
875{ 875{
876 snd_soc_unregister_codec(&i2c->dev); 876 snd_soc_unregister_codec(&i2c->dev);
877 877
@@ -890,7 +890,7 @@ static struct i2c_driver wm2000_i2c_driver = {
890 .owner = THIS_MODULE, 890 .owner = THIS_MODULE,
891 }, 891 },
892 .probe = wm2000_i2c_probe, 892 .probe = wm2000_i2c_probe,
893 .remove = __devexit_p(wm2000_i2c_remove), 893 .remove = wm2000_i2c_remove,
894 .id_table = wm2000_i2c_id, 894 .id_table = wm2000_i2c_id,
895}; 895};
896 896
diff --git a/sound/soc/codecs/wm2200.c b/sound/soc/codecs/wm2200.c
index eab64a193989..afcf31df77e0 100644
--- a/sound/soc/codecs/wm2200.c
+++ b/sound/soc/codecs/wm2200.c
@@ -15,6 +15,7 @@
15#include <linux/init.h> 15#include <linux/init.h>
16#include <linux/delay.h> 16#include <linux/delay.h>
17#include <linux/pm.h> 17#include <linux/pm.h>
18#include <linux/firmware.h>
18#include <linux/gcd.h> 19#include <linux/gcd.h>
19#include <linux/gpio.h> 20#include <linux/gpio.h>
20#include <linux/i2c.h> 21#include <linux/i2c.h>
@@ -32,6 +33,40 @@
32#include <sound/wm2200.h> 33#include <sound/wm2200.h>
33 34
34#include "wm2200.h" 35#include "wm2200.h"
36#include "wmfw.h"
37#include "wm_adsp.h"
38
39#define WM2200_DSP_CONTROL_1 0x00
40#define WM2200_DSP_CONTROL_2 0x02
41#define WM2200_DSP_CONTROL_3 0x03
42#define WM2200_DSP_CONTROL_4 0x04
43#define WM2200_DSP_CONTROL_5 0x06
44#define WM2200_DSP_CONTROL_6 0x07
45#define WM2200_DSP_CONTROL_7 0x08
46#define WM2200_DSP_CONTROL_8 0x09
47#define WM2200_DSP_CONTROL_9 0x0A
48#define WM2200_DSP_CONTROL_10 0x0B
49#define WM2200_DSP_CONTROL_11 0x0C
50#define WM2200_DSP_CONTROL_12 0x0D
51#define WM2200_DSP_CONTROL_13 0x0F
52#define WM2200_DSP_CONTROL_14 0x10
53#define WM2200_DSP_CONTROL_15 0x11
54#define WM2200_DSP_CONTROL_16 0x12
55#define WM2200_DSP_CONTROL_17 0x13
56#define WM2200_DSP_CONTROL_18 0x14
57#define WM2200_DSP_CONTROL_19 0x16
58#define WM2200_DSP_CONTROL_20 0x17
59#define WM2200_DSP_CONTROL_21 0x18
60#define WM2200_DSP_CONTROL_22 0x1A
61#define WM2200_DSP_CONTROL_23 0x1B
62#define WM2200_DSP_CONTROL_24 0x1C
63#define WM2200_DSP_CONTROL_25 0x1E
64#define WM2200_DSP_CONTROL_26 0x20
65#define WM2200_DSP_CONTROL_27 0x21
66#define WM2200_DSP_CONTROL_28 0x22
67#define WM2200_DSP_CONTROL_29 0x23
68#define WM2200_DSP_CONTROL_30 0x24
69#define WM2200_DSP_CONTROL_31 0x26
35 70
36/* The code assumes DCVDD is generated internally */ 71/* The code assumes DCVDD is generated internally */
37#define WM2200_NUM_CORE_SUPPLIES 2 72#define WM2200_NUM_CORE_SUPPLIES 2
@@ -49,6 +84,7 @@ struct wm2200_fll {
49 84
50/* codec private data */ 85/* codec private data */
51struct wm2200_priv { 86struct wm2200_priv {
87 struct wm_adsp dsp[2];
52 struct regmap *regmap; 88 struct regmap *regmap;
53 struct device *dev; 89 struct device *dev;
54 struct snd_soc_codec *codec; 90 struct snd_soc_codec *codec;
@@ -64,6 +100,72 @@ struct wm2200_priv {
64 int sysclk; 100 int sysclk;
65}; 101};
66 102
103#define WM2200_DSP_RANGE_BASE (WM2200_MAX_REGISTER + 1)
104#define WM2200_DSP_SPACING 12288
105
106#define WM2200_DSP1_DM_BASE (WM2200_DSP_RANGE_BASE + (0 * WM2200_DSP_SPACING))
107#define WM2200_DSP1_PM_BASE (WM2200_DSP_RANGE_BASE + (1 * WM2200_DSP_SPACING))
108#define WM2200_DSP1_ZM_BASE (WM2200_DSP_RANGE_BASE + (2 * WM2200_DSP_SPACING))
109#define WM2200_DSP2_DM_BASE (WM2200_DSP_RANGE_BASE + (3 * WM2200_DSP_SPACING))
110#define WM2200_DSP2_PM_BASE (WM2200_DSP_RANGE_BASE + (4 * WM2200_DSP_SPACING))
111#define WM2200_DSP2_ZM_BASE (WM2200_DSP_RANGE_BASE + (5 * WM2200_DSP_SPACING))
112
113static const struct regmap_range_cfg wm2200_ranges[] = {
114 { .name = "DSP1DM", .range_min = WM2200_DSP1_DM_BASE,
115 .range_max = WM2200_DSP1_DM_BASE + 12287,
116 .selector_reg = WM2200_DSP1_CONTROL_3,
117 .selector_mask = WM2200_DSP1_PAGE_BASE_DM_0_MASK,
118 .selector_shift = WM2200_DSP1_PAGE_BASE_DM_0_SHIFT,
119 .window_start = WM2200_DSP1_DM_0, .window_len = 2048, },
120
121 { .name = "DSP1PM", .range_min = WM2200_DSP1_PM_BASE,
122 .range_max = WM2200_DSP1_PM_BASE + 12287,
123 .selector_reg = WM2200_DSP1_CONTROL_2,
124 .selector_mask = WM2200_DSP1_PAGE_BASE_PM_0_MASK,
125 .selector_shift = WM2200_DSP1_PAGE_BASE_PM_0_SHIFT,
126 .window_start = WM2200_DSP1_PM_0, .window_len = 768, },
127
128 { .name = "DSP1ZM", .range_min = WM2200_DSP1_ZM_BASE,
129 .range_max = WM2200_DSP1_ZM_BASE + 2047,
130 .selector_reg = WM2200_DSP1_CONTROL_4,
131 .selector_mask = WM2200_DSP1_PAGE_BASE_ZM_0_MASK,
132 .selector_shift = WM2200_DSP1_PAGE_BASE_ZM_0_SHIFT,
133 .window_start = WM2200_DSP1_ZM_0, .window_len = 1024, },
134
135 { .name = "DSP2DM", .range_min = WM2200_DSP2_DM_BASE,
136 .range_max = WM2200_DSP2_DM_BASE + 4095,
137 .selector_reg = WM2200_DSP2_CONTROL_3,
138 .selector_mask = WM2200_DSP2_PAGE_BASE_DM_0_MASK,
139 .selector_shift = WM2200_DSP2_PAGE_BASE_DM_0_SHIFT,
140 .window_start = WM2200_DSP2_DM_0, .window_len = 2048, },
141
142 { .name = "DSP2PM", .range_min = WM2200_DSP2_PM_BASE,
143 .range_max = WM2200_DSP2_PM_BASE + 11287,
144 .selector_reg = WM2200_DSP2_CONTROL_2,
145 .selector_mask = WM2200_DSP2_PAGE_BASE_PM_0_MASK,
146 .selector_shift = WM2200_DSP2_PAGE_BASE_PM_0_SHIFT,
147 .window_start = WM2200_DSP2_PM_0, .window_len = 768, },
148
149 { .name = "DSP2ZM", .range_min = WM2200_DSP2_ZM_BASE,
150 .range_max = WM2200_DSP2_ZM_BASE + 2047,
151 .selector_reg = WM2200_DSP2_CONTROL_4,
152 .selector_mask = WM2200_DSP2_PAGE_BASE_ZM_0_MASK,
153 .selector_shift = WM2200_DSP2_PAGE_BASE_ZM_0_SHIFT,
154 .window_start = WM2200_DSP2_ZM_0, .window_len = 1024, },
155};
156
157static const struct wm_adsp_region wm2200_dsp1_regions[] = {
158 { .type = WMFW_ADSP1_PM, .base = WM2200_DSP1_PM_BASE },
159 { .type = WMFW_ADSP1_DM, .base = WM2200_DSP1_DM_BASE },
160 { .type = WMFW_ADSP1_ZM, .base = WM2200_DSP1_ZM_BASE },
161};
162
163static const struct wm_adsp_region wm2200_dsp2_regions[] = {
164 { .type = WMFW_ADSP1_PM, .base = WM2200_DSP2_PM_BASE },
165 { .type = WMFW_ADSP1_DM, .base = WM2200_DSP2_DM_BASE },
166 { .type = WMFW_ADSP1_ZM, .base = WM2200_DSP2_ZM_BASE },
167};
168
67static struct reg_default wm2200_reg_defaults[] = { 169static struct reg_default wm2200_reg_defaults[] = {
68 { 0x000B, 0x0000 }, /* R11 - Tone Generator 1 */ 170 { 0x000B, 0x0000 }, /* R11 - Tone Generator 1 */
69 { 0x0102, 0x0000 }, /* R258 - Clocking 3 */ 171 { 0x0102, 0x0000 }, /* R258 - Clocking 3 */
@@ -407,6 +509,16 @@ static struct reg_default wm2200_reg_defaults[] = {
407 509
408static bool wm2200_volatile_register(struct device *dev, unsigned int reg) 510static bool wm2200_volatile_register(struct device *dev, unsigned int reg)
409{ 511{
512 int i;
513
514 for (i = 0; i < ARRAY_SIZE(wm2200_ranges); i++)
515 if ((reg >= wm2200_ranges[i].window_start &&
516 reg <= wm2200_ranges[i].window_start +
517 wm2200_ranges[i].window_len) ||
518 (reg >= wm2200_ranges[i].range_min &&
519 reg <= wm2200_ranges[i].range_max))
520 return true;
521
410 switch (reg) { 522 switch (reg) {
411 case WM2200_SOFTWARE_RESET: 523 case WM2200_SOFTWARE_RESET:
412 case WM2200_DEVICE_REVISION: 524 case WM2200_DEVICE_REVISION:
@@ -423,6 +535,16 @@ static bool wm2200_volatile_register(struct device *dev, unsigned int reg)
423 535
424static bool wm2200_readable_register(struct device *dev, unsigned int reg) 536static bool wm2200_readable_register(struct device *dev, unsigned int reg)
425{ 537{
538 int i;
539
540 for (i = 0; i < ARRAY_SIZE(wm2200_ranges); i++)
541 if ((reg >= wm2200_ranges[i].window_start &&
542 reg <= wm2200_ranges[i].window_start +
543 wm2200_ranges[i].window_len) ||
544 (reg >= wm2200_ranges[i].range_min &&
545 reg <= wm2200_ranges[i].range_max))
546 return true;
547
426 switch (reg) { 548 switch (reg) {
427 case WM2200_SOFTWARE_RESET: 549 case WM2200_SOFTWARE_RESET:
428 case WM2200_DEVICE_REVISION: 550 case WM2200_DEVICE_REVISION:
@@ -880,7 +1002,7 @@ static DECLARE_TLV_DB_SCALE(out_tlv, -6400, 100, 0);
880static const char *wm2200_mixer_texts[] = { 1002static const char *wm2200_mixer_texts[] = {
881 "None", 1003 "None",
882 "Tone Generator", 1004 "Tone Generator",
883 "AEC loopback", 1005 "AEC Loopback",
884 "IN1L", 1006 "IN1L",
885 "IN1R", 1007 "IN1R",
886 "IN2L", 1008 "IN2L",
@@ -976,6 +1098,20 @@ static int wm2200_mixer_values[] = {
976 static WM2200_MUX_CTL_DECL(name##_in3); \ 1098 static WM2200_MUX_CTL_DECL(name##_in3); \
977 static WM2200_MUX_CTL_DECL(name##_in4) 1099 static WM2200_MUX_CTL_DECL(name##_in4)
978 1100
1101#define WM2200_DSP_ENUMS(name, base_reg) \
1102 static WM2200_MUX_ENUM_DECL(name##_aux1_enum, base_reg); \
1103 static WM2200_MUX_ENUM_DECL(name##_aux2_enum, base_reg + 1); \
1104 static WM2200_MUX_ENUM_DECL(name##_aux3_enum, base_reg + 2); \
1105 static WM2200_MUX_ENUM_DECL(name##_aux4_enum, base_reg + 3); \
1106 static WM2200_MUX_ENUM_DECL(name##_aux5_enum, base_reg + 4); \
1107 static WM2200_MUX_ENUM_DECL(name##_aux6_enum, base_reg + 5); \
1108 static WM2200_MUX_CTL_DECL(name##_aux1); \
1109 static WM2200_MUX_CTL_DECL(name##_aux2); \
1110 static WM2200_MUX_CTL_DECL(name##_aux3); \
1111 static WM2200_MUX_CTL_DECL(name##_aux4); \
1112 static WM2200_MUX_CTL_DECL(name##_aux5); \
1113 static WM2200_MUX_CTL_DECL(name##_aux6);
1114
979static const struct snd_kcontrol_new wm2200_snd_controls[] = { 1115static const struct snd_kcontrol_new wm2200_snd_controls[] = {
980SOC_SINGLE("IN1 High Performance Switch", WM2200_IN1L_CONTROL, 1116SOC_SINGLE("IN1 High Performance Switch", WM2200_IN1L_CONTROL,
981 WM2200_IN1_OSR_SHIFT, 1, 0), 1117 WM2200_IN1_OSR_SHIFT, 1, 0),
@@ -1051,6 +1187,9 @@ WM2200_MIXER_ENUMS(DSP1R, WM2200_DSP1RMIX_INPUT_1_SOURCE);
1051WM2200_MIXER_ENUMS(DSP2L, WM2200_DSP2LMIX_INPUT_1_SOURCE); 1187WM2200_MIXER_ENUMS(DSP2L, WM2200_DSP2LMIX_INPUT_1_SOURCE);
1052WM2200_MIXER_ENUMS(DSP2R, WM2200_DSP2RMIX_INPUT_1_SOURCE); 1188WM2200_MIXER_ENUMS(DSP2R, WM2200_DSP2RMIX_INPUT_1_SOURCE);
1053 1189
1190WM2200_DSP_ENUMS(DSP1, WM2200_DSP1AUX1MIX_INPUT_1_SOURCE);
1191WM2200_DSP_ENUMS(DSP2, WM2200_DSP2AUX1MIX_INPUT_1_SOURCE);
1192
1054WM2200_MIXER_ENUMS(LHPF1, WM2200_LHPF1MIX_INPUT_1_SOURCE); 1193WM2200_MIXER_ENUMS(LHPF1, WM2200_LHPF1MIX_INPUT_1_SOURCE);
1055WM2200_MIXER_ENUMS(LHPF2, WM2200_LHPF2MIX_INPUT_1_SOURCE); 1194WM2200_MIXER_ENUMS(LHPF2, WM2200_LHPF2MIX_INPUT_1_SOURCE);
1056 1195
@@ -1064,8 +1203,19 @@ WM2200_MIXER_ENUMS(LHPF2, WM2200_LHPF2MIX_INPUT_1_SOURCE);
1064 WM2200_MUX(name_str " Input 4", &name##_in4_mux), \ 1203 WM2200_MUX(name_str " Input 4", &name##_in4_mux), \
1065 SND_SOC_DAPM_MIXER(name_str " Mixer", SND_SOC_NOPM, 0, 0, NULL, 0) 1204 SND_SOC_DAPM_MIXER(name_str " Mixer", SND_SOC_NOPM, 0, 0, NULL, 0)
1066 1205
1206#define WM2200_DSP_WIDGETS(name, name_str) \
1207 WM2200_MIXER_WIDGETS(name##L, name_str "L"), \
1208 WM2200_MIXER_WIDGETS(name##R, name_str "R"), \
1209 WM2200_MUX(name_str " Aux 1", &name##_aux1_mux), \
1210 WM2200_MUX(name_str " Aux 2", &name##_aux2_mux), \
1211 WM2200_MUX(name_str " Aux 3", &name##_aux3_mux), \
1212 WM2200_MUX(name_str " Aux 4", &name##_aux4_mux), \
1213 WM2200_MUX(name_str " Aux 5", &name##_aux5_mux), \
1214 WM2200_MUX(name_str " Aux 6", &name##_aux6_mux)
1215
1067#define WM2200_MIXER_INPUT_ROUTES(name) \ 1216#define WM2200_MIXER_INPUT_ROUTES(name) \
1068 { name, "Tone Generator", "Tone Generator" }, \ 1217 { name, "Tone Generator", "Tone Generator" }, \
1218 { name, "AEC Loopback", "AEC Loopback" }, \
1069 { name, "IN1L", "IN1L PGA" }, \ 1219 { name, "IN1L", "IN1L PGA" }, \
1070 { name, "IN1R", "IN1R PGA" }, \ 1220 { name, "IN1R", "IN1R PGA" }, \
1071 { name, "IN2L", "IN2L PGA" }, \ 1221 { name, "IN2L", "IN2L PGA" }, \
@@ -1106,6 +1256,33 @@ WM2200_MIXER_ENUMS(LHPF2, WM2200_LHPF2MIX_INPUT_1_SOURCE);
1106 WM2200_MIXER_INPUT_ROUTES(name " Input 3"), \ 1256 WM2200_MIXER_INPUT_ROUTES(name " Input 3"), \
1107 WM2200_MIXER_INPUT_ROUTES(name " Input 4") 1257 WM2200_MIXER_INPUT_ROUTES(name " Input 4")
1108 1258
1259#define WM2200_DSP_AUX_ROUTES(name) \
1260 { name, NULL, name " Aux 1" }, \
1261 { name, NULL, name " Aux 2" }, \
1262 { name, NULL, name " Aux 3" }, \
1263 { name, NULL, name " Aux 4" }, \
1264 { name, NULL, name " Aux 5" }, \
1265 { name, NULL, name " Aux 6" }, \
1266 WM2200_MIXER_INPUT_ROUTES(name " Aux 1"), \
1267 WM2200_MIXER_INPUT_ROUTES(name " Aux 2"), \
1268 WM2200_MIXER_INPUT_ROUTES(name " Aux 3"), \
1269 WM2200_MIXER_INPUT_ROUTES(name " Aux 4"), \
1270 WM2200_MIXER_INPUT_ROUTES(name " Aux 5"), \
1271 WM2200_MIXER_INPUT_ROUTES(name " Aux 6")
1272
1273static const char *wm2200_aec_loopback_texts[] = {
1274 "OUT1L", "OUT1R", "OUT2L", "OUT2R",
1275};
1276
1277static const struct soc_enum wm2200_aec_loopback =
1278 SOC_ENUM_SINGLE(WM2200_DAC_AEC_CONTROL_1,
1279 WM2200_AEC_LOOPBACK_SRC_SHIFT,
1280 ARRAY_SIZE(wm2200_aec_loopback_texts),
1281 wm2200_aec_loopback_texts);
1282
1283static const struct snd_kcontrol_new wm2200_aec_loopback_mux =
1284 SOC_DAPM_ENUM("AEC Loopback", wm2200_aec_loopback);
1285
1109static const struct snd_soc_dapm_widget wm2200_dapm_widgets[] = { 1286static const struct snd_soc_dapm_widget wm2200_dapm_widgets[] = {
1110SND_SOC_DAPM_SUPPLY("SYSCLK", WM2200_CLOCKING_3, WM2200_SYSCLK_ENA_SHIFT, 0, 1287SND_SOC_DAPM_SUPPLY("SYSCLK", WM2200_CLOCKING_3, WM2200_SYSCLK_ENA_SHIFT, 0,
1111 NULL, 0), 1288 NULL, 0),
@@ -1165,8 +1342,8 @@ SND_SOC_DAPM_PGA("LHPF1", WM2200_HPLPF1_1, WM2200_LHPF1_ENA_SHIFT, 0,
1165SND_SOC_DAPM_PGA("LHPF2", WM2200_HPLPF2_1, WM2200_LHPF2_ENA_SHIFT, 0, 1342SND_SOC_DAPM_PGA("LHPF2", WM2200_HPLPF2_1, WM2200_LHPF2_ENA_SHIFT, 0,
1166 NULL, 0), 1343 NULL, 0),
1167 1344
1168SND_SOC_DAPM_PGA_E("DSP1", SND_SOC_NOPM, 0, 0, NULL, 0, NULL, 0), 1345WM_ADSP1("DSP1", 0),
1169SND_SOC_DAPM_PGA_E("DSP2", SND_SOC_NOPM, 1, 0, NULL, 0, NULL, 0), 1346WM_ADSP1("DSP2", 1),
1170 1347
1171SND_SOC_DAPM_AIF_OUT("AIF1TX1", "Capture", 0, 1348SND_SOC_DAPM_AIF_OUT("AIF1TX1", "Capture", 0,
1172 WM2200_AUDIO_IF_1_22, WM2200_AIF1TX1_ENA_SHIFT, 0), 1349 WM2200_AUDIO_IF_1_22, WM2200_AIF1TX1_ENA_SHIFT, 0),
@@ -1181,6 +1358,9 @@ SND_SOC_DAPM_AIF_OUT("AIF1TX5", "Capture", 4,
1181SND_SOC_DAPM_AIF_OUT("AIF1TX6", "Capture", 5, 1358SND_SOC_DAPM_AIF_OUT("AIF1TX6", "Capture", 5,
1182 WM2200_AUDIO_IF_1_22, WM2200_AIF1TX6_ENA_SHIFT, 0), 1359 WM2200_AUDIO_IF_1_22, WM2200_AIF1TX6_ENA_SHIFT, 0),
1183 1360
1361SND_SOC_DAPM_MUX("AEC Loopback", WM2200_DAC_AEC_CONTROL_1,
1362 WM2200_AEC_LOOPBACK_ENA_SHIFT, 0, &wm2200_aec_loopback_mux),
1363
1184SND_SOC_DAPM_PGA_S("OUT1L", 0, WM2200_OUTPUT_ENABLES, 1364SND_SOC_DAPM_PGA_S("OUT1L", 0, WM2200_OUTPUT_ENABLES,
1185 WM2200_OUT1L_ENA_SHIFT, 0, NULL, 0), 1365 WM2200_OUT1L_ENA_SHIFT, 0, NULL, 0),
1186SND_SOC_DAPM_PGA_S("OUT1R", 0, WM2200_OUTPUT_ENABLES, 1366SND_SOC_DAPM_PGA_S("OUT1R", 0, WM2200_OUTPUT_ENABLES,
@@ -1231,10 +1411,8 @@ WM2200_MIXER_WIDGETS(EQR, "EQR"),
1231WM2200_MIXER_WIDGETS(LHPF1, "LHPF1"), 1411WM2200_MIXER_WIDGETS(LHPF1, "LHPF1"),
1232WM2200_MIXER_WIDGETS(LHPF2, "LHPF2"), 1412WM2200_MIXER_WIDGETS(LHPF2, "LHPF2"),
1233 1413
1234WM2200_MIXER_WIDGETS(DSP1L, "DSP1L"), 1414WM2200_DSP_WIDGETS(DSP1, "DSP1"),
1235WM2200_MIXER_WIDGETS(DSP1R, "DSP1R"), 1415WM2200_DSP_WIDGETS(DSP2, "DSP2"),
1236WM2200_MIXER_WIDGETS(DSP2L, "DSP2L"),
1237WM2200_MIXER_WIDGETS(DSP2R, "DSP2R"),
1238 1416
1239WM2200_MIXER_WIDGETS(AIF1TX1, "AIF1TX1"), 1417WM2200_MIXER_WIDGETS(AIF1TX1, "AIF1TX1"),
1240WM2200_MIXER_WIDGETS(AIF1TX2, "AIF1TX2"), 1418WM2200_MIXER_WIDGETS(AIF1TX2, "AIF1TX2"),
@@ -1326,11 +1504,19 @@ static const struct snd_soc_dapm_route wm2200_dapm_routes[] = {
1326 { "SPK", NULL, "OUT2L" }, 1504 { "SPK", NULL, "OUT2L" },
1327 { "SPK", NULL, "OUT2R" }, 1505 { "SPK", NULL, "OUT2R" },
1328 1506
1507 { "AEC Loopback", "OUT1L", "OUT1L" },
1508 { "AEC Loopback", "OUT1R", "OUT1R" },
1509 { "AEC Loopback", "OUT2L", "OUT2L" },
1510 { "AEC Loopback", "OUT2R", "OUT2R" },
1511
1329 WM2200_MIXER_ROUTES("DSP1", "DSP1L"), 1512 WM2200_MIXER_ROUTES("DSP1", "DSP1L"),
1330 WM2200_MIXER_ROUTES("DSP1", "DSP1R"), 1513 WM2200_MIXER_ROUTES("DSP1", "DSP1R"),
1331 WM2200_MIXER_ROUTES("DSP2", "DSP2L"), 1514 WM2200_MIXER_ROUTES("DSP2", "DSP2L"),
1332 WM2200_MIXER_ROUTES("DSP2", "DSP2R"), 1515 WM2200_MIXER_ROUTES("DSP2", "DSP2R"),
1333 1516
1517 WM2200_DSP_AUX_ROUTES("DSP1"),
1518 WM2200_DSP_AUX_ROUTES("DSP2"),
1519
1334 WM2200_MIXER_ROUTES("OUT1L", "OUT1L"), 1520 WM2200_MIXER_ROUTES("OUT1L", "OUT1L"),
1335 WM2200_MIXER_ROUTES("OUT1R", "OUT1R"), 1521 WM2200_MIXER_ROUTES("OUT1R", "OUT1R"),
1336 WM2200_MIXER_ROUTES("OUT2L", "OUT2L"), 1522 WM2200_MIXER_ROUTES("OUT2L", "OUT2L"),
@@ -1968,12 +2154,15 @@ static const struct regmap_config wm2200_regmap = {
1968 .reg_bits = 16, 2154 .reg_bits = 16,
1969 .val_bits = 16, 2155 .val_bits = 16,
1970 2156
1971 .max_register = WM2200_MAX_REGISTER, 2157 .max_register = WM2200_MAX_REGISTER + (ARRAY_SIZE(wm2200_ranges) *
2158 WM2200_DSP_SPACING),
1972 .reg_defaults = wm2200_reg_defaults, 2159 .reg_defaults = wm2200_reg_defaults,
1973 .num_reg_defaults = ARRAY_SIZE(wm2200_reg_defaults), 2160 .num_reg_defaults = ARRAY_SIZE(wm2200_reg_defaults),
1974 .volatile_reg = wm2200_volatile_register, 2161 .volatile_reg = wm2200_volatile_register,
1975 .readable_reg = wm2200_readable_register, 2162 .readable_reg = wm2200_readable_register,
1976 .cache_type = REGCACHE_RBTREE, 2163 .cache_type = REGCACHE_RBTREE,
2164 .ranges = wm2200_ranges,
2165 .num_ranges = ARRAY_SIZE(wm2200_ranges),
1977}; 2166};
1978 2167
1979static const unsigned int wm2200_dig_vu[] = { 2168static const unsigned int wm2200_dig_vu[] = {
@@ -1995,8 +2184,8 @@ static const unsigned int wm2200_mic_ctrl_reg[] = {
1995 WM2200_IN3L_CONTROL, 2184 WM2200_IN3L_CONTROL,
1996}; 2185};
1997 2186
1998static __devinit int wm2200_i2c_probe(struct i2c_client *i2c, 2187static int wm2200_i2c_probe(struct i2c_client *i2c,
1999 const struct i2c_device_id *id) 2188 const struct i2c_device_id *id)
2000{ 2189{
2001 struct wm2200_pdata *pdata = dev_get_platdata(&i2c->dev); 2190 struct wm2200_pdata *pdata = dev_get_platdata(&i2c->dev);
2002 struct wm2200_priv *wm2200; 2191 struct wm2200_priv *wm2200;
@@ -2011,14 +2200,30 @@ static __devinit int wm2200_i2c_probe(struct i2c_client *i2c,
2011 wm2200->dev = &i2c->dev; 2200 wm2200->dev = &i2c->dev;
2012 init_completion(&wm2200->fll_lock); 2201 init_completion(&wm2200->fll_lock);
2013 2202
2014 wm2200->regmap = regmap_init_i2c(i2c, &wm2200_regmap); 2203 wm2200->regmap = devm_regmap_init_i2c(i2c, &wm2200_regmap);
2015 if (IS_ERR(wm2200->regmap)) { 2204 if (IS_ERR(wm2200->regmap)) {
2016 ret = PTR_ERR(wm2200->regmap); 2205 ret = PTR_ERR(wm2200->regmap);
2017 dev_err(&i2c->dev, "Failed to allocate register map: %d\n", 2206 dev_err(&i2c->dev, "Failed to allocate register map: %d\n",
2018 ret); 2207 ret);
2019 goto err; 2208 return ret;
2209 }
2210
2211 for (i = 0; i < 2; i++) {
2212 wm2200->dsp[i].type = WMFW_ADSP1;
2213 wm2200->dsp[i].part = "wm2200";
2214 wm2200->dsp[i].num = i + 1;
2215 wm2200->dsp[i].dev = &i2c->dev;
2216 wm2200->dsp[i].regmap = wm2200->regmap;
2020 } 2217 }
2021 2218
2219 wm2200->dsp[0].base = WM2200_DSP1_CONTROL_1;
2220 wm2200->dsp[0].mem = wm2200_dsp1_regions;
2221 wm2200->dsp[0].num_mems = ARRAY_SIZE(wm2200_dsp1_regions);
2222
2223 wm2200->dsp[1].base = WM2200_DSP2_CONTROL_1;
2224 wm2200->dsp[1].mem = wm2200_dsp2_regions;
2225 wm2200->dsp[1].num_mems = ARRAY_SIZE(wm2200_dsp2_regions);
2226
2022 if (pdata) 2227 if (pdata)
2023 wm2200->pdata = *pdata; 2228 wm2200->pdata = *pdata;
2024 2229
@@ -2027,12 +2232,13 @@ static __devinit int wm2200_i2c_probe(struct i2c_client *i2c,
2027 for (i = 0; i < ARRAY_SIZE(wm2200->core_supplies); i++) 2232 for (i = 0; i < ARRAY_SIZE(wm2200->core_supplies); i++)
2028 wm2200->core_supplies[i].supply = wm2200_core_supply_names[i]; 2233 wm2200->core_supplies[i].supply = wm2200_core_supply_names[i];
2029 2234
2030 ret = regulator_bulk_get(&i2c->dev, ARRAY_SIZE(wm2200->core_supplies), 2235 ret = devm_regulator_bulk_get(&i2c->dev,
2031 wm2200->core_supplies); 2236 ARRAY_SIZE(wm2200->core_supplies),
2237 wm2200->core_supplies);
2032 if (ret != 0) { 2238 if (ret != 0) {
2033 dev_err(&i2c->dev, "Failed to request core supplies: %d\n", 2239 dev_err(&i2c->dev, "Failed to request core supplies: %d\n",
2034 ret); 2240 ret);
2035 goto err_regmap; 2241 return ret;
2036 } 2242 }
2037 2243
2038 ret = regulator_bulk_enable(ARRAY_SIZE(wm2200->core_supplies), 2244 ret = regulator_bulk_enable(ARRAY_SIZE(wm2200->core_supplies),
@@ -2040,12 +2246,13 @@ static __devinit int wm2200_i2c_probe(struct i2c_client *i2c,
2040 if (ret != 0) { 2246 if (ret != 0) {
2041 dev_err(&i2c->dev, "Failed to enable core supplies: %d\n", 2247 dev_err(&i2c->dev, "Failed to enable core supplies: %d\n",
2042 ret); 2248 ret);
2043 goto err_core; 2249 return ret;
2044 } 2250 }
2045 2251
2046 if (wm2200->pdata.ldo_ena) { 2252 if (wm2200->pdata.ldo_ena) {
2047 ret = gpio_request_one(wm2200->pdata.ldo_ena, 2253 ret = devm_gpio_request_one(&i2c->dev, wm2200->pdata.ldo_ena,
2048 GPIOF_OUT_INIT_HIGH, "WM2200 LDOENA"); 2254 GPIOF_OUT_INIT_HIGH,
2255 "WM2200 LDOENA");
2049 if (ret < 0) { 2256 if (ret < 0) {
2050 dev_err(&i2c->dev, "Failed to request LDOENA %d: %d\n", 2257 dev_err(&i2c->dev, "Failed to request LDOENA %d: %d\n",
2051 wm2200->pdata.ldo_ena, ret); 2258 wm2200->pdata.ldo_ena, ret);
@@ -2055,8 +2262,9 @@ static __devinit int wm2200_i2c_probe(struct i2c_client *i2c,
2055 } 2262 }
2056 2263
2057 if (wm2200->pdata.reset) { 2264 if (wm2200->pdata.reset) {
2058 ret = gpio_request_one(wm2200->pdata.reset, 2265 ret = devm_gpio_request_one(&i2c->dev, wm2200->pdata.reset,
2059 GPIOF_OUT_INIT_HIGH, "WM2200 /RESET"); 2266 GPIOF_OUT_INIT_HIGH,
2267 "WM2200 /RESET");
2060 if (ret < 0) { 2268 if (ret < 0) {
2061 dev_err(&i2c->dev, "Failed to request /RESET %d: %d\n", 2269 dev_err(&i2c->dev, "Failed to request /RESET %d: %d\n",
2062 wm2200->pdata.reset, ret); 2270 wm2200->pdata.reset, ret);
@@ -2166,45 +2374,28 @@ static __devinit int wm2200_i2c_probe(struct i2c_client *i2c,
2166err_pm_runtime: 2374err_pm_runtime:
2167 pm_runtime_disable(&i2c->dev); 2375 pm_runtime_disable(&i2c->dev);
2168err_reset: 2376err_reset:
2169 if (wm2200->pdata.reset) { 2377 if (wm2200->pdata.reset)
2170 gpio_set_value_cansleep(wm2200->pdata.reset, 0); 2378 gpio_set_value_cansleep(wm2200->pdata.reset, 0);
2171 gpio_free(wm2200->pdata.reset);
2172 }
2173err_ldo: 2379err_ldo:
2174 if (wm2200->pdata.ldo_ena) { 2380 if (wm2200->pdata.ldo_ena)
2175 gpio_set_value_cansleep(wm2200->pdata.ldo_ena, 0); 2381 gpio_set_value_cansleep(wm2200->pdata.ldo_ena, 0);
2176 gpio_free(wm2200->pdata.ldo_ena);
2177 }
2178err_enable: 2382err_enable:
2179 regulator_bulk_disable(ARRAY_SIZE(wm2200->core_supplies), 2383 regulator_bulk_disable(ARRAY_SIZE(wm2200->core_supplies),
2180 wm2200->core_supplies); 2384 wm2200->core_supplies);
2181err_core:
2182 regulator_bulk_free(ARRAY_SIZE(wm2200->core_supplies),
2183 wm2200->core_supplies);
2184err_regmap:
2185 regmap_exit(wm2200->regmap);
2186err:
2187 return ret; 2385 return ret;
2188} 2386}
2189 2387
2190static __devexit int wm2200_i2c_remove(struct i2c_client *i2c) 2388static int wm2200_i2c_remove(struct i2c_client *i2c)
2191{ 2389{
2192 struct wm2200_priv *wm2200 = i2c_get_clientdata(i2c); 2390 struct wm2200_priv *wm2200 = i2c_get_clientdata(i2c);
2193 2391
2194 snd_soc_unregister_codec(&i2c->dev); 2392 snd_soc_unregister_codec(&i2c->dev);
2195 if (i2c->irq) 2393 if (i2c->irq)
2196 free_irq(i2c->irq, wm2200); 2394 free_irq(i2c->irq, wm2200);
2197 if (wm2200->pdata.reset) { 2395 if (wm2200->pdata.reset)
2198 gpio_set_value_cansleep(wm2200->pdata.reset, 0); 2396 gpio_set_value_cansleep(wm2200->pdata.reset, 0);
2199 gpio_free(wm2200->pdata.reset); 2397 if (wm2200->pdata.ldo_ena)
2200 }
2201 if (wm2200->pdata.ldo_ena) {
2202 gpio_set_value_cansleep(wm2200->pdata.ldo_ena, 0); 2398 gpio_set_value_cansleep(wm2200->pdata.ldo_ena, 0);
2203 gpio_free(wm2200->pdata.ldo_ena);
2204 }
2205 regulator_bulk_free(ARRAY_SIZE(wm2200->core_supplies),
2206 wm2200->core_supplies);
2207 regmap_exit(wm2200->regmap);
2208 2399
2209 return 0; 2400 return 0;
2210} 2401}
@@ -2267,7 +2458,7 @@ static struct i2c_driver wm2200_i2c_driver = {
2267 .pm = &wm2200_pm, 2458 .pm = &wm2200_pm,
2268 }, 2459 },
2269 .probe = wm2200_i2c_probe, 2460 .probe = wm2200_i2c_probe,
2270 .remove = __devexit_p(wm2200_i2c_remove), 2461 .remove = wm2200_i2c_remove,
2271 .id_table = wm2200_i2c_id, 2462 .id_table = wm2200_i2c_id,
2272}; 2463};
2273 2464
diff --git a/sound/soc/codecs/wm5100.c b/sound/soc/codecs/wm5100.c
index 7f567585832e..5a5f36936235 100644
--- a/sound/soc/codecs/wm5100.c
+++ b/sound/soc/codecs/wm5100.c
@@ -1233,7 +1233,7 @@ static const struct snd_soc_dapm_route wm5100_dapm_routes[] = {
1233 { "PWM2", NULL, "PWM2 Driver" }, 1233 { "PWM2", NULL, "PWM2 Driver" },
1234}; 1234};
1235 1235
1236static const __devinitconst struct reg_default wm5100_reva_patches[] = { 1236static const struct reg_default wm5100_reva_patches[] = {
1237 { WM5100_AUDIO_IF_1_10, 0 }, 1237 { WM5100_AUDIO_IF_1_10, 0 },
1238 { WM5100_AUDIO_IF_1_11, 1 }, 1238 { WM5100_AUDIO_IF_1_11, 1 },
1239 { WM5100_AUDIO_IF_1_12, 2 }, 1239 { WM5100_AUDIO_IF_1_12, 2 },
@@ -2414,8 +2414,8 @@ static const unsigned int wm5100_mic_ctrl_reg[] = {
2414 WM5100_IN4L_CONTROL, 2414 WM5100_IN4L_CONTROL,
2415}; 2415};
2416 2416
2417static __devinit int wm5100_i2c_probe(struct i2c_client *i2c, 2417static int wm5100_i2c_probe(struct i2c_client *i2c,
2418 const struct i2c_device_id *id) 2418 const struct i2c_device_id *id)
2419{ 2419{
2420 struct wm5100_pdata *pdata = dev_get_platdata(&i2c->dev); 2420 struct wm5100_pdata *pdata = dev_get_platdata(&i2c->dev);
2421 struct wm5100_priv *wm5100; 2421 struct wm5100_priv *wm5100;
@@ -2639,7 +2639,7 @@ err:
2639 return ret; 2639 return ret;
2640} 2640}
2641 2641
2642static __devexit int wm5100_i2c_remove(struct i2c_client *i2c) 2642static int wm5100_i2c_remove(struct i2c_client *i2c)
2643{ 2643{
2644 struct wm5100_priv *wm5100 = i2c_get_clientdata(i2c); 2644 struct wm5100_priv *wm5100 = i2c_get_clientdata(i2c);
2645 2645
@@ -2717,7 +2717,7 @@ static struct i2c_driver wm5100_i2c_driver = {
2717 .pm = &wm5100_pm, 2717 .pm = &wm5100_pm,
2718 }, 2718 },
2719 .probe = wm5100_i2c_probe, 2719 .probe = wm5100_i2c_probe,
2720 .remove = __devexit_p(wm5100_i2c_remove), 2720 .remove = wm5100_i2c_remove,
2721 .id_table = wm5100_i2c_id, 2721 .id_table = wm5100_i2c_id,
2722}; 2722};
2723 2723
diff --git a/sound/soc/codecs/wm5102.c b/sound/soc/codecs/wm5102.c
index 7394e73fa43c..688ade080589 100644
--- a/sound/soc/codecs/wm5102.c
+++ b/sound/soc/codecs/wm5102.c
@@ -31,6 +31,7 @@
31 31
32#include "arizona.h" 32#include "arizona.h"
33#include "wm5102.h" 33#include "wm5102.h"
34#include "wm_adsp.h"
34 35
35struct wm5102_priv { 36struct wm5102_priv {
36 struct arizona_priv core; 37 struct arizona_priv core;
@@ -42,6 +43,13 @@ static DECLARE_TLV_DB_SCALE(eq_tlv, -1200, 100, 0);
42static DECLARE_TLV_DB_SCALE(digital_tlv, -6400, 50, 0); 43static DECLARE_TLV_DB_SCALE(digital_tlv, -6400, 50, 0);
43static DECLARE_TLV_DB_SCALE(noise_tlv, 0, 600, 0); 44static DECLARE_TLV_DB_SCALE(noise_tlv, 0, 600, 0);
44 45
46static const struct wm_adsp_region wm5102_dsp1_regions[] = {
47 { .type = WMFW_ADSP2_PM, .base = 0x100000 },
48 { .type = WMFW_ADSP2_ZM, .base = 0x180000 },
49 { .type = WMFW_ADSP2_XM, .base = 0x190000 },
50 { .type = WMFW_ADSP2_YM, .base = 0x1a8000 },
51};
52
45static const struct reg_default wm5102_sysclk_reva_patch[] = { 53static const struct reg_default wm5102_sysclk_reva_patch[] = {
46 { 0x3000, 0x2225 }, 54 { 0x3000, 0x2225 },
47 { 0x3001, 0x3a03 }, 55 { 0x3001, 0x3a03 },
@@ -627,11 +635,23 @@ SOC_DOUBLE_R_TLV("IN3 Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_3L,
627 ARIZONA_ADC_DIGITAL_VOLUME_3R, ARIZONA_IN3L_DIG_VOL_SHIFT, 635 ARIZONA_ADC_DIGITAL_VOLUME_3R, ARIZONA_IN3L_DIG_VOL_SHIFT,
628 0xbf, 0, digital_tlv), 636 0xbf, 0, digital_tlv),
629 637
638SOC_ENUM("Input Ramp Up", arizona_in_vi_ramp),
639SOC_ENUM("Input Ramp Down", arizona_in_vd_ramp),
640
630ARIZONA_MIXER_CONTROLS("EQ1", ARIZONA_EQ1MIX_INPUT_1_SOURCE), 641ARIZONA_MIXER_CONTROLS("EQ1", ARIZONA_EQ1MIX_INPUT_1_SOURCE),
631ARIZONA_MIXER_CONTROLS("EQ2", ARIZONA_EQ2MIX_INPUT_1_SOURCE), 642ARIZONA_MIXER_CONTROLS("EQ2", ARIZONA_EQ2MIX_INPUT_1_SOURCE),
632ARIZONA_MIXER_CONTROLS("EQ3", ARIZONA_EQ3MIX_INPUT_1_SOURCE), 643ARIZONA_MIXER_CONTROLS("EQ3", ARIZONA_EQ3MIX_INPUT_1_SOURCE),
633ARIZONA_MIXER_CONTROLS("EQ4", ARIZONA_EQ4MIX_INPUT_1_SOURCE), 644ARIZONA_MIXER_CONTROLS("EQ4", ARIZONA_EQ4MIX_INPUT_1_SOURCE),
634 645
646SND_SOC_BYTES_MASK("EQ1 Coefficeints", ARIZONA_EQ1_1, 21,
647 ARIZONA_EQ1_ENA_MASK),
648SND_SOC_BYTES_MASK("EQ2 Coefficeints", ARIZONA_EQ2_1, 21,
649 ARIZONA_EQ2_ENA_MASK),
650SND_SOC_BYTES_MASK("EQ3 Coefficeints", ARIZONA_EQ3_1, 21,
651 ARIZONA_EQ3_ENA_MASK),
652SND_SOC_BYTES_MASK("EQ4 Coefficeints", ARIZONA_EQ4_1, 21,
653 ARIZONA_EQ4_ENA_MASK),
654
635SOC_SINGLE_TLV("EQ1 B1 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B1_GAIN_SHIFT, 655SOC_SINGLE_TLV("EQ1 B1 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B1_GAIN_SHIFT,
636 24, 0, eq_tlv), 656 24, 0, eq_tlv),
637SOC_SINGLE_TLV("EQ1 B2 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B2_GAIN_SHIFT, 657SOC_SINGLE_TLV("EQ1 B2 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B2_GAIN_SHIFT,
@@ -687,6 +707,14 @@ ARIZONA_MIXER_CONTROLS("LHPF2", ARIZONA_HPLP2MIX_INPUT_1_SOURCE),
687ARIZONA_MIXER_CONTROLS("LHPF3", ARIZONA_HPLP3MIX_INPUT_1_SOURCE), 707ARIZONA_MIXER_CONTROLS("LHPF3", ARIZONA_HPLP3MIX_INPUT_1_SOURCE),
688ARIZONA_MIXER_CONTROLS("LHPF4", ARIZONA_HPLP4MIX_INPUT_1_SOURCE), 708ARIZONA_MIXER_CONTROLS("LHPF4", ARIZONA_HPLP4MIX_INPUT_1_SOURCE),
689 709
710SND_SOC_BYTES("LHPF1 Coefficients", ARIZONA_HPLPF1_2, 1),
711SND_SOC_BYTES("LHPF2 Coefficients", ARIZONA_HPLPF2_2, 1),
712SND_SOC_BYTES("LHPF3 Coefficients", ARIZONA_HPLPF3_2, 1),
713SND_SOC_BYTES("LHPF4 Coefficients", ARIZONA_HPLPF4_2, 1),
714
715ARIZONA_MIXER_CONTROLS("DSP1L", ARIZONA_DSP1LMIX_INPUT_1_SOURCE),
716ARIZONA_MIXER_CONTROLS("DSP1R", ARIZONA_DSP1RMIX_INPUT_1_SOURCE),
717
690SOC_ENUM("LHPF1 Mode", arizona_lhpf1_mode), 718SOC_ENUM("LHPF1 Mode", arizona_lhpf1_mode),
691SOC_ENUM("LHPF2 Mode", arizona_lhpf2_mode), 719SOC_ENUM("LHPF2 Mode", arizona_lhpf2_mode),
692SOC_ENUM("LHPF3 Mode", arizona_lhpf3_mode), 720SOC_ENUM("LHPF3 Mode", arizona_lhpf3_mode),
@@ -708,14 +736,6 @@ ARIZONA_MIXER_CONTROLS("SPKOUTR", ARIZONA_OUT4RMIX_INPUT_1_SOURCE),
708ARIZONA_MIXER_CONTROLS("SPKDAT1L", ARIZONA_OUT5LMIX_INPUT_1_SOURCE), 736ARIZONA_MIXER_CONTROLS("SPKDAT1L", ARIZONA_OUT5LMIX_INPUT_1_SOURCE),
709ARIZONA_MIXER_CONTROLS("SPKDAT1R", ARIZONA_OUT5RMIX_INPUT_1_SOURCE), 737ARIZONA_MIXER_CONTROLS("SPKDAT1R", ARIZONA_OUT5RMIX_INPUT_1_SOURCE),
710 738
711SOC_SINGLE("HPOUT1 High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_1L,
712 ARIZONA_OUT1_OSR_SHIFT, 1, 0),
713SOC_SINGLE("OUT2 High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_2L,
714 ARIZONA_OUT2_OSR_SHIFT, 1, 0),
715SOC_SINGLE("EPOUT High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_3L,
716 ARIZONA_OUT3_OSR_SHIFT, 1, 0),
717SOC_SINGLE("Speaker High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_4L,
718 ARIZONA_OUT4_OSR_SHIFT, 1, 0),
719SOC_SINGLE("SPKDAT1 High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_5L, 739SOC_SINGLE("SPKDAT1 High Performance Switch", ARIZONA_OUTPUT_PATH_CONFIG_5L,
720 ARIZONA_OUT5_OSR_SHIFT, 1, 0), 740 ARIZONA_OUT5_OSR_SHIFT, 1, 0),
721 741
@@ -745,16 +765,8 @@ SOC_DOUBLE_R_TLV("SPKDAT1 Digital Volume", ARIZONA_DAC_DIGITAL_VOLUME_5L,
745 ARIZONA_DAC_DIGITAL_VOLUME_5R, ARIZONA_OUT5L_VOL_SHIFT, 765 ARIZONA_DAC_DIGITAL_VOLUME_5R, ARIZONA_OUT5L_VOL_SHIFT,
746 0xbf, 0, digital_tlv), 766 0xbf, 0, digital_tlv),
747 767
748SOC_DOUBLE_R_RANGE_TLV("HPOUT1 Volume", ARIZONA_OUTPUT_PATH_CONFIG_1L, 768SOC_ENUM("Output Ramp Up", arizona_out_vi_ramp),
749 ARIZONA_OUTPUT_PATH_CONFIG_1R, 769SOC_ENUM("Output Ramp Down", arizona_out_vd_ramp),
750 ARIZONA_OUT1L_PGA_VOL_SHIFT,
751 0x34, 0x40, 0, ana_tlv),
752SOC_DOUBLE_R_RANGE_TLV("OUT2 Volume", ARIZONA_OUTPUT_PATH_CONFIG_2L,
753 ARIZONA_OUTPUT_PATH_CONFIG_2R,
754 ARIZONA_OUT2L_PGA_VOL_SHIFT,
755 0x34, 0x40, 0, ana_tlv),
756SOC_SINGLE_RANGE_TLV("EPOUT Volume", ARIZONA_OUTPUT_PATH_CONFIG_3L,
757 ARIZONA_OUT3L_PGA_VOL_SHIFT, 0x34, 0x40, 0, ana_tlv),
758 770
759SOC_DOUBLE("SPKDAT1 Switch", ARIZONA_PDM_SPK1_CTRL_1, ARIZONA_SPK1L_MUTE_SHIFT, 771SOC_DOUBLE("SPKDAT1 Switch", ARIZONA_PDM_SPK1_CTRL_1, ARIZONA_SPK1L_MUTE_SHIFT,
760 ARIZONA_SPK1R_MUTE_SHIFT, 1, 1), 772 ARIZONA_SPK1R_MUTE_SHIFT, 1, 1),
@@ -819,11 +831,15 @@ ARIZONA_MIXER_ENUMS(AIF2TX2, ARIZONA_AIF2TX2MIX_INPUT_1_SOURCE);
819ARIZONA_MIXER_ENUMS(AIF3TX1, ARIZONA_AIF3TX1MIX_INPUT_1_SOURCE); 831ARIZONA_MIXER_ENUMS(AIF3TX1, ARIZONA_AIF3TX1MIX_INPUT_1_SOURCE);
820ARIZONA_MIXER_ENUMS(AIF3TX2, ARIZONA_AIF3TX2MIX_INPUT_1_SOURCE); 832ARIZONA_MIXER_ENUMS(AIF3TX2, ARIZONA_AIF3TX2MIX_INPUT_1_SOURCE);
821 833
822ARIZONA_MIXER_ENUMS(ASRC1L, ARIZONA_ASRC1LMIX_INPUT_1_SOURCE); 834ARIZONA_MUX_ENUMS(ASRC1L, ARIZONA_ASRC1LMIX_INPUT_1_SOURCE);
823ARIZONA_MIXER_ENUMS(ASRC1R, ARIZONA_ASRC1RMIX_INPUT_1_SOURCE); 835ARIZONA_MUX_ENUMS(ASRC1R, ARIZONA_ASRC1RMIX_INPUT_1_SOURCE);
824ARIZONA_MIXER_ENUMS(ASRC2L, ARIZONA_ASRC2LMIX_INPUT_1_SOURCE); 836ARIZONA_MUX_ENUMS(ASRC2L, ARIZONA_ASRC2LMIX_INPUT_1_SOURCE);
825ARIZONA_MIXER_ENUMS(ASRC2R, ARIZONA_ASRC2RMIX_INPUT_1_SOURCE); 837ARIZONA_MUX_ENUMS(ASRC2R, ARIZONA_ASRC2RMIX_INPUT_1_SOURCE);
838
839ARIZONA_MIXER_ENUMS(DSP1L, ARIZONA_DSP1LMIX_INPUT_1_SOURCE);
840ARIZONA_MIXER_ENUMS(DSP1R, ARIZONA_DSP1RMIX_INPUT_1_SOURCE);
826 841
842ARIZONA_DSP_AUX_ENUMS(DSP1, ARIZONA_DSP1AUX1MIX_INPUT_1_SOURCE);
827 843
828static const char *wm5102_aec_loopback_texts[] = { 844static const char *wm5102_aec_loopback_texts[] = {
829 "HPOUT1L", "HPOUT1R", "HPOUT2L", "HPOUT2R", "EPOUT", 845 "HPOUT1L", "HPOUT1R", "HPOUT2L", "HPOUT2R", "EPOUT",
@@ -864,6 +880,7 @@ SND_SOC_DAPM_REGULATOR_SUPPLY("SPKVDDR", 0, 0),
864 880
865SND_SOC_DAPM_SIGGEN("TONE"), 881SND_SOC_DAPM_SIGGEN("TONE"),
866SND_SOC_DAPM_SIGGEN("NOISE"), 882SND_SOC_DAPM_SIGGEN("NOISE"),
883SND_SOC_DAPM_SIGGEN("HAPTICS"),
867 884
868SND_SOC_DAPM_INPUT("IN1L"), 885SND_SOC_DAPM_INPUT("IN1L"),
869SND_SOC_DAPM_INPUT("IN1R"), 886SND_SOC_DAPM_INPUT("IN1R"),
@@ -894,9 +911,9 @@ SND_SOC_DAPM_PGA_E("IN3R PGA", ARIZONA_INPUT_ENABLES, ARIZONA_IN3R_ENA_SHIFT,
894SND_SOC_DAPM_SUPPLY("MICBIAS1", ARIZONA_MIC_BIAS_CTRL_1, 911SND_SOC_DAPM_SUPPLY("MICBIAS1", ARIZONA_MIC_BIAS_CTRL_1,
895 ARIZONA_MICB1_ENA_SHIFT, 0, NULL, 0), 912 ARIZONA_MICB1_ENA_SHIFT, 0, NULL, 0),
896SND_SOC_DAPM_SUPPLY("MICBIAS2", ARIZONA_MIC_BIAS_CTRL_2, 913SND_SOC_DAPM_SUPPLY("MICBIAS2", ARIZONA_MIC_BIAS_CTRL_2,
897 ARIZONA_MICB1_ENA_SHIFT, 0, NULL, 0), 914 ARIZONA_MICB2_ENA_SHIFT, 0, NULL, 0),
898SND_SOC_DAPM_SUPPLY("MICBIAS3", ARIZONA_MIC_BIAS_CTRL_3, 915SND_SOC_DAPM_SUPPLY("MICBIAS3", ARIZONA_MIC_BIAS_CTRL_3,
899 ARIZONA_MICB1_ENA_SHIFT, 0, NULL, 0), 916 ARIZONA_MICB3_ENA_SHIFT, 0, NULL, 0),
900 917
901SND_SOC_DAPM_PGA("Noise Generator", ARIZONA_COMFORT_NOISE_GENERATOR, 918SND_SOC_DAPM_PGA("Noise Generator", ARIZONA_COMFORT_NOISE_GENERATOR,
902 ARIZONA_NOISE_GEN_ENA_SHIFT, 0, NULL, 0), 919 ARIZONA_NOISE_GEN_ENA_SHIFT, 0, NULL, 0),
@@ -996,6 +1013,8 @@ SND_SOC_DAPM_AIF_IN("AIF3RX1", NULL, 0,
996SND_SOC_DAPM_AIF_IN("AIF3RX2", NULL, 0, 1013SND_SOC_DAPM_AIF_IN("AIF3RX2", NULL, 0,
997 ARIZONA_AIF3_RX_ENABLES, ARIZONA_AIF3RX2_ENA_SHIFT, 0), 1014 ARIZONA_AIF3_RX_ENABLES, ARIZONA_AIF3RX2_ENA_SHIFT, 0),
998 1015
1016ARIZONA_DSP_WIDGETS(DSP1, "DSP1"),
1017
999SND_SOC_DAPM_VALUE_MUX("AEC Loopback", ARIZONA_DAC_AEC_CONTROL_1, 1018SND_SOC_DAPM_VALUE_MUX("AEC Loopback", ARIZONA_DAC_AEC_CONTROL_1,
1000 ARIZONA_AEC_LOOPBACK_ENA, 0, &wm5102_aec_loopback_mux), 1019 ARIZONA_AEC_LOOPBACK_ENA, 0, &wm5102_aec_loopback_mux),
1001 1020
@@ -1071,10 +1090,12 @@ ARIZONA_MIXER_WIDGETS(AIF2TX2, "AIF2TX2"),
1071ARIZONA_MIXER_WIDGETS(AIF3TX1, "AIF3TX1"), 1090ARIZONA_MIXER_WIDGETS(AIF3TX1, "AIF3TX1"),
1072ARIZONA_MIXER_WIDGETS(AIF3TX2, "AIF3TX2"), 1091ARIZONA_MIXER_WIDGETS(AIF3TX2, "AIF3TX2"),
1073 1092
1074ARIZONA_MIXER_WIDGETS(ASRC1L, "ASRC1L"), 1093ARIZONA_MUX_WIDGETS(ASRC1L, "ASRC1L"),
1075ARIZONA_MIXER_WIDGETS(ASRC1R, "ASRC1R"), 1094ARIZONA_MUX_WIDGETS(ASRC1R, "ASRC1R"),
1076ARIZONA_MIXER_WIDGETS(ASRC2L, "ASRC2L"), 1095ARIZONA_MUX_WIDGETS(ASRC2L, "ASRC2L"),
1077ARIZONA_MIXER_WIDGETS(ASRC2R, "ASRC2R"), 1096ARIZONA_MUX_WIDGETS(ASRC2R, "ASRC2R"),
1097
1098WM_ADSP2("DSP1", 0),
1078 1099
1079SND_SOC_DAPM_OUTPUT("HPOUT1L"), 1100SND_SOC_DAPM_OUTPUT("HPOUT1L"),
1080SND_SOC_DAPM_OUTPUT("HPOUT1R"), 1101SND_SOC_DAPM_OUTPUT("HPOUT1R"),
@@ -1094,6 +1115,7 @@ SND_SOC_DAPM_OUTPUT("SPKDAT1R"),
1094 { name, "Noise Generator", "Noise Generator" }, \ 1115 { name, "Noise Generator", "Noise Generator" }, \
1095 { name, "Tone Generator 1", "Tone Generator 1" }, \ 1116 { name, "Tone Generator 1", "Tone Generator 1" }, \
1096 { name, "Tone Generator 2", "Tone Generator 2" }, \ 1117 { name, "Tone Generator 2", "Tone Generator 2" }, \
1118 { name, "Haptics", "HAPTICS" }, \
1097 { name, "AEC", "AEC Loopback" }, \ 1119 { name, "AEC", "AEC Loopback" }, \
1098 { name, "IN1L", "IN1L PGA" }, \ 1120 { name, "IN1L", "IN1L PGA" }, \
1099 { name, "IN1R", "IN1R PGA" }, \ 1121 { name, "IN1R", "IN1R PGA" }, \
@@ -1127,7 +1149,13 @@ SND_SOC_DAPM_OUTPUT("SPKDAT1R"),
1127 { name, "ASRC1L", "ASRC1L" }, \ 1149 { name, "ASRC1L", "ASRC1L" }, \
1128 { name, "ASRC1R", "ASRC1R" }, \ 1150 { name, "ASRC1R", "ASRC1R" }, \
1129 { name, "ASRC2L", "ASRC2L" }, \ 1151 { name, "ASRC2L", "ASRC2L" }, \
1130 { name, "ASRC2R", "ASRC2R" } 1152 { name, "ASRC2R", "ASRC2R" }, \
1153 { name, "DSP1.1", "DSP1" }, \
1154 { name, "DSP1.2", "DSP1" }, \
1155 { name, "DSP1.3", "DSP1" }, \
1156 { name, "DSP1.4", "DSP1" }, \
1157 { name, "DSP1.5", "DSP1" }, \
1158 { name, "DSP1.6", "DSP1" }
1131 1159
1132static const struct snd_soc_dapm_route wm5102_dapm_routes[] = { 1160static const struct snd_soc_dapm_route wm5102_dapm_routes[] = {
1133 { "AIF2 Capture", NULL, "DBVDD2" }, 1161 { "AIF2 Capture", NULL, "DBVDD2" },
@@ -1213,6 +1241,11 @@ static const struct snd_soc_dapm_route wm5102_dapm_routes[] = {
1213 { "IN3L PGA", NULL, "IN3L" }, 1241 { "IN3L PGA", NULL, "IN3L" },
1214 { "IN3R PGA", NULL, "IN3R" }, 1242 { "IN3R PGA", NULL, "IN3R" },
1215 1243
1244 { "ASRC1L", NULL, "ASRC1L Input" },
1245 { "ASRC1R", NULL, "ASRC1R Input" },
1246 { "ASRC2L", NULL, "ASRC2L Input" },
1247 { "ASRC2R", NULL, "ASRC2R Input" },
1248
1216 ARIZONA_MIXER_ROUTES("OUT1L", "HPOUT1L"), 1249 ARIZONA_MIXER_ROUTES("OUT1L", "HPOUT1L"),
1217 ARIZONA_MIXER_ROUTES("OUT1R", "HPOUT1R"), 1250 ARIZONA_MIXER_ROUTES("OUT1R", "HPOUT1R"),
1218 ARIZONA_MIXER_ROUTES("OUT2L", "HPOUT2L"), 1251 ARIZONA_MIXER_ROUTES("OUT2L", "HPOUT2L"),
@@ -1255,10 +1288,12 @@ static const struct snd_soc_dapm_route wm5102_dapm_routes[] = {
1255 ARIZONA_MIXER_ROUTES("LHPF3", "LHPF3"), 1288 ARIZONA_MIXER_ROUTES("LHPF3", "LHPF3"),
1256 ARIZONA_MIXER_ROUTES("LHPF4", "LHPF4"), 1289 ARIZONA_MIXER_ROUTES("LHPF4", "LHPF4"),
1257 1290
1258 ARIZONA_MIXER_ROUTES("ASRC1L", "ASRC1L"), 1291 ARIZONA_MUX_ROUTES("ASRC1L"),
1259 ARIZONA_MIXER_ROUTES("ASRC1R", "ASRC1R"), 1292 ARIZONA_MUX_ROUTES("ASRC1R"),
1260 ARIZONA_MIXER_ROUTES("ASRC2L", "ASRC2L"), 1293 ARIZONA_MUX_ROUTES("ASRC2L"),
1261 ARIZONA_MIXER_ROUTES("ASRC2R", "ASRC2R"), 1294 ARIZONA_MUX_ROUTES("ASRC2R"),
1295
1296 ARIZONA_DSP_ROUTES("DSP1"),
1262 1297
1263 { "AEC Loopback", "HPOUT1L", "OUT1L" }, 1298 { "AEC Loopback", "HPOUT1L", "OUT1L" },
1264 { "AEC Loopback", "HPOUT1R", "OUT1R" }, 1299 { "AEC Loopback", "HPOUT1R", "OUT1R" },
@@ -1377,9 +1412,28 @@ static struct snd_soc_dai_driver wm5102_dai[] = {
1377static int wm5102_codec_probe(struct snd_soc_codec *codec) 1412static int wm5102_codec_probe(struct snd_soc_codec *codec)
1378{ 1413{
1379 struct wm5102_priv *priv = snd_soc_codec_get_drvdata(codec); 1414 struct wm5102_priv *priv = snd_soc_codec_get_drvdata(codec);
1415 int ret;
1380 1416
1381 codec->control_data = priv->core.arizona->regmap; 1417 codec->control_data = priv->core.arizona->regmap;
1382 return snd_soc_codec_set_cache_io(codec, 32, 16, SND_SOC_REGMAP); 1418
1419 ret = snd_soc_codec_set_cache_io(codec, 32, 16, SND_SOC_REGMAP);
1420 if (ret != 0)
1421 return ret;
1422
1423 snd_soc_dapm_disable_pin(&codec->dapm, "HAPTICS");
1424
1425 priv->core.arizona->dapm = &codec->dapm;
1426
1427 return 0;
1428}
1429
1430static int wm5102_codec_remove(struct snd_soc_codec *codec)
1431{
1432 struct wm5102_priv *priv = snd_soc_codec_get_drvdata(codec);
1433
1434 priv->core.arizona->dapm = NULL;
1435
1436 return 0;
1383} 1437}
1384 1438
1385#define WM5102_DIG_VU 0x0200 1439#define WM5102_DIG_VU 0x0200
@@ -1406,6 +1460,7 @@ static unsigned int wm5102_digital_vu[] = {
1406 1460
1407static struct snd_soc_codec_driver soc_codec_dev_wm5102 = { 1461static struct snd_soc_codec_driver soc_codec_dev_wm5102 = {
1408 .probe = wm5102_codec_probe, 1462 .probe = wm5102_codec_probe,
1463 .remove = wm5102_codec_remove,
1409 1464
1410 .idle_bias_off = true, 1465 .idle_bias_off = true,
1411 1466
@@ -1420,11 +1475,11 @@ static struct snd_soc_codec_driver soc_codec_dev_wm5102 = {
1420 .num_dapm_routes = ARRAY_SIZE(wm5102_dapm_routes), 1475 .num_dapm_routes = ARRAY_SIZE(wm5102_dapm_routes),
1421}; 1476};
1422 1477
1423static int __devinit wm5102_probe(struct platform_device *pdev) 1478static int wm5102_probe(struct platform_device *pdev)
1424{ 1479{
1425 struct arizona *arizona = dev_get_drvdata(pdev->dev.parent); 1480 struct arizona *arizona = dev_get_drvdata(pdev->dev.parent);
1426 struct wm5102_priv *wm5102; 1481 struct wm5102_priv *wm5102;
1427 int i; 1482 int i, ret;
1428 1483
1429 wm5102 = devm_kzalloc(&pdev->dev, sizeof(struct wm5102_priv), 1484 wm5102 = devm_kzalloc(&pdev->dev, sizeof(struct wm5102_priv),
1430 GFP_KERNEL); 1485 GFP_KERNEL);
@@ -1434,6 +1489,19 @@ static int __devinit wm5102_probe(struct platform_device *pdev)
1434 1489
1435 wm5102->core.arizona = arizona; 1490 wm5102->core.arizona = arizona;
1436 1491
1492 wm5102->core.adsp[0].part = "wm5102";
1493 wm5102->core.adsp[0].num = 1;
1494 wm5102->core.adsp[0].type = WMFW_ADSP2;
1495 wm5102->core.adsp[0].base = ARIZONA_DSP1_CONTROL_1;
1496 wm5102->core.adsp[0].dev = arizona->dev;
1497 wm5102->core.adsp[0].regmap = arizona->regmap;
1498 wm5102->core.adsp[0].mem = wm5102_dsp1_regions;
1499 wm5102->core.adsp[0].num_mems = ARRAY_SIZE(wm5102_dsp1_regions);
1500
1501 ret = wm_adsp2_init(&wm5102->core.adsp[0], true);
1502 if (ret != 0)
1503 return ret;
1504
1437 for (i = 0; i < ARRAY_SIZE(wm5102->fll); i++) 1505 for (i = 0; i < ARRAY_SIZE(wm5102->fll); i++)
1438 wm5102->fll[i].vco_mult = 1; 1506 wm5102->fll[i].vco_mult = 1;
1439 1507
@@ -1459,7 +1527,7 @@ static int __devinit wm5102_probe(struct platform_device *pdev)
1459 wm5102_dai, ARRAY_SIZE(wm5102_dai)); 1527 wm5102_dai, ARRAY_SIZE(wm5102_dai));
1460} 1528}
1461 1529
1462static int __devexit wm5102_remove(struct platform_device *pdev) 1530static int wm5102_remove(struct platform_device *pdev)
1463{ 1531{
1464 snd_soc_unregister_codec(&pdev->dev); 1532 snd_soc_unregister_codec(&pdev->dev);
1465 pm_runtime_disable(&pdev->dev); 1533 pm_runtime_disable(&pdev->dev);
@@ -1473,7 +1541,7 @@ static struct platform_driver wm5102_codec_driver = {
1473 .owner = THIS_MODULE, 1541 .owner = THIS_MODULE,
1474 }, 1542 },
1475 .probe = wm5102_probe, 1543 .probe = wm5102_probe,
1476 .remove = __devexit_p(wm5102_remove), 1544 .remove = wm5102_remove,
1477}; 1545};
1478 1546
1479module_platform_driver(wm5102_codec_driver); 1547module_platform_driver(wm5102_codec_driver);
diff --git a/sound/soc/codecs/wm5110.c b/sound/soc/codecs/wm5110.c
index 9211e4192f71..ae80c8c28536 100644
--- a/sound/soc/codecs/wm5110.c
+++ b/sound/soc/codecs/wm5110.c
@@ -84,11 +84,23 @@ SOC_DOUBLE_R_TLV("IN4 Digital Volume", ARIZONA_ADC_DIGITAL_VOLUME_4L,
84 ARIZONA_ADC_DIGITAL_VOLUME_4R, ARIZONA_IN4L_DIG_VOL_SHIFT, 84 ARIZONA_ADC_DIGITAL_VOLUME_4R, ARIZONA_IN4L_DIG_VOL_SHIFT,
85 0xbf, 0, digital_tlv), 85 0xbf, 0, digital_tlv),
86 86
87SOC_ENUM("Input Ramp Up", arizona_in_vi_ramp),
88SOC_ENUM("Input Ramp Down", arizona_in_vd_ramp),
89
87ARIZONA_MIXER_CONTROLS("EQ1", ARIZONA_EQ1MIX_INPUT_1_SOURCE), 90ARIZONA_MIXER_CONTROLS("EQ1", ARIZONA_EQ1MIX_INPUT_1_SOURCE),
88ARIZONA_MIXER_CONTROLS("EQ2", ARIZONA_EQ2MIX_INPUT_1_SOURCE), 91ARIZONA_MIXER_CONTROLS("EQ2", ARIZONA_EQ2MIX_INPUT_1_SOURCE),
89ARIZONA_MIXER_CONTROLS("EQ3", ARIZONA_EQ3MIX_INPUT_1_SOURCE), 92ARIZONA_MIXER_CONTROLS("EQ3", ARIZONA_EQ3MIX_INPUT_1_SOURCE),
90ARIZONA_MIXER_CONTROLS("EQ4", ARIZONA_EQ4MIX_INPUT_1_SOURCE), 93ARIZONA_MIXER_CONTROLS("EQ4", ARIZONA_EQ4MIX_INPUT_1_SOURCE),
91 94
95SND_SOC_BYTES_MASK("EQ1 Coefficeints", ARIZONA_EQ1_1, 21,
96 ARIZONA_EQ1_ENA_MASK),
97SND_SOC_BYTES_MASK("EQ2 Coefficeints", ARIZONA_EQ2_1, 21,
98 ARIZONA_EQ2_ENA_MASK),
99SND_SOC_BYTES_MASK("EQ3 Coefficeints", ARIZONA_EQ3_1, 21,
100 ARIZONA_EQ3_ENA_MASK),
101SND_SOC_BYTES_MASK("EQ4 Coefficeints", ARIZONA_EQ4_1, 21,
102 ARIZONA_EQ4_ENA_MASK),
103
92SOC_SINGLE_TLV("EQ1 B1 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B1_GAIN_SHIFT, 104SOC_SINGLE_TLV("EQ1 B1 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B1_GAIN_SHIFT,
93 24, 0, eq_tlv), 105 24, 0, eq_tlv),
94SOC_SINGLE_TLV("EQ1 B2 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B2_GAIN_SHIFT, 106SOC_SINGLE_TLV("EQ1 B2 Volume", ARIZONA_EQ1_1, ARIZONA_EQ1_B2_GAIN_SHIFT,
@@ -148,6 +160,11 @@ ARIZONA_MIXER_CONTROLS("LHPF2", ARIZONA_HPLP2MIX_INPUT_1_SOURCE),
148ARIZONA_MIXER_CONTROLS("LHPF3", ARIZONA_HPLP3MIX_INPUT_1_SOURCE), 160ARIZONA_MIXER_CONTROLS("LHPF3", ARIZONA_HPLP3MIX_INPUT_1_SOURCE),
149ARIZONA_MIXER_CONTROLS("LHPF4", ARIZONA_HPLP4MIX_INPUT_1_SOURCE), 161ARIZONA_MIXER_CONTROLS("LHPF4", ARIZONA_HPLP4MIX_INPUT_1_SOURCE),
150 162
163SND_SOC_BYTES("LHPF1 Coefficients", ARIZONA_HPLPF1_2, 1),
164SND_SOC_BYTES("LHPF2 Coefficients", ARIZONA_HPLPF2_2, 1),
165SND_SOC_BYTES("LHPF3 Coefficients", ARIZONA_HPLPF3_2, 1),
166SND_SOC_BYTES("LHPF4 Coefficients", ARIZONA_HPLPF4_2, 1),
167
151SOC_ENUM("LHPF1 Mode", arizona_lhpf1_mode), 168SOC_ENUM("LHPF1 Mode", arizona_lhpf1_mode),
152SOC_ENUM("LHPF2 Mode", arizona_lhpf2_mode), 169SOC_ENUM("LHPF2 Mode", arizona_lhpf2_mode),
153SOC_ENUM("LHPF3 Mode", arizona_lhpf3_mode), 170SOC_ENUM("LHPF3 Mode", arizona_lhpf3_mode),
@@ -243,6 +260,9 @@ SOC_DOUBLE("SPKDAT1 Switch", ARIZONA_PDM_SPK1_CTRL_1, ARIZONA_SPK1L_MUTE_SHIFT,
243SOC_DOUBLE("SPKDAT2 Switch", ARIZONA_PDM_SPK2_CTRL_1, ARIZONA_SPK2L_MUTE_SHIFT, 260SOC_DOUBLE("SPKDAT2 Switch", ARIZONA_PDM_SPK2_CTRL_1, ARIZONA_SPK2L_MUTE_SHIFT,
244 ARIZONA_SPK2R_MUTE_SHIFT, 1, 1), 261 ARIZONA_SPK2R_MUTE_SHIFT, 1, 1),
245 262
263SOC_ENUM("Output Ramp Up", arizona_out_vi_ramp),
264SOC_ENUM("Output Ramp Down", arizona_out_vd_ramp),
265
246ARIZONA_MIXER_CONTROLS("AIF1TX1", ARIZONA_AIF1TX1MIX_INPUT_1_SOURCE), 266ARIZONA_MIXER_CONTROLS("AIF1TX1", ARIZONA_AIF1TX1MIX_INPUT_1_SOURCE),
247ARIZONA_MIXER_CONTROLS("AIF1TX2", ARIZONA_AIF1TX2MIX_INPUT_1_SOURCE), 267ARIZONA_MIXER_CONTROLS("AIF1TX2", ARIZONA_AIF1TX2MIX_INPUT_1_SOURCE),
248ARIZONA_MIXER_CONTROLS("AIF1TX3", ARIZONA_AIF1TX3MIX_INPUT_1_SOURCE), 268ARIZONA_MIXER_CONTROLS("AIF1TX3", ARIZONA_AIF1TX3MIX_INPUT_1_SOURCE),
@@ -308,10 +328,10 @@ ARIZONA_MIXER_ENUMS(AIF2TX2, ARIZONA_AIF2TX2MIX_INPUT_1_SOURCE);
308ARIZONA_MIXER_ENUMS(AIF3TX1, ARIZONA_AIF3TX1MIX_INPUT_1_SOURCE); 328ARIZONA_MIXER_ENUMS(AIF3TX1, ARIZONA_AIF3TX1MIX_INPUT_1_SOURCE);
309ARIZONA_MIXER_ENUMS(AIF3TX2, ARIZONA_AIF3TX2MIX_INPUT_1_SOURCE); 329ARIZONA_MIXER_ENUMS(AIF3TX2, ARIZONA_AIF3TX2MIX_INPUT_1_SOURCE);
310 330
311ARIZONA_MIXER_ENUMS(ASRC1L, ARIZONA_ASRC1LMIX_INPUT_1_SOURCE); 331ARIZONA_MUX_ENUMS(ASRC1L, ARIZONA_ASRC1LMIX_INPUT_1_SOURCE);
312ARIZONA_MIXER_ENUMS(ASRC1R, ARIZONA_ASRC1RMIX_INPUT_1_SOURCE); 332ARIZONA_MUX_ENUMS(ASRC1R, ARIZONA_ASRC1RMIX_INPUT_1_SOURCE);
313ARIZONA_MIXER_ENUMS(ASRC2L, ARIZONA_ASRC2LMIX_INPUT_1_SOURCE); 333ARIZONA_MUX_ENUMS(ASRC2L, ARIZONA_ASRC2LMIX_INPUT_1_SOURCE);
314ARIZONA_MIXER_ENUMS(ASRC2R, ARIZONA_ASRC2RMIX_INPUT_1_SOURCE); 334ARIZONA_MUX_ENUMS(ASRC2R, ARIZONA_ASRC2RMIX_INPUT_1_SOURCE);
315 335
316static const char *wm5110_aec_loopback_texts[] = { 336static const char *wm5110_aec_loopback_texts[] = {
317 "HPOUT1L", "HPOUT1R", "HPOUT2L", "HPOUT2R", "HPOUT3L", "HPOUT3R", 337 "HPOUT1L", "HPOUT1R", "HPOUT2L", "HPOUT2R", "HPOUT3L", "HPOUT3R",
@@ -352,6 +372,7 @@ SND_SOC_DAPM_REGULATOR_SUPPLY("SPKVDDR", 0, 0),
352 372
353SND_SOC_DAPM_SIGGEN("TONE"), 373SND_SOC_DAPM_SIGGEN("TONE"),
354SND_SOC_DAPM_SIGGEN("NOISE"), 374SND_SOC_DAPM_SIGGEN("NOISE"),
375SND_SOC_DAPM_SIGGEN("HAPTICS"),
355 376
356SND_SOC_DAPM_INPUT("IN1L"), 377SND_SOC_DAPM_INPUT("IN1L"),
357SND_SOC_DAPM_INPUT("IN1R"), 378SND_SOC_DAPM_INPUT("IN1R"),
@@ -585,10 +606,10 @@ ARIZONA_MIXER_WIDGETS(AIF2TX2, "AIF2TX2"),
585ARIZONA_MIXER_WIDGETS(AIF3TX1, "AIF3TX1"), 606ARIZONA_MIXER_WIDGETS(AIF3TX1, "AIF3TX1"),
586ARIZONA_MIXER_WIDGETS(AIF3TX2, "AIF3TX2"), 607ARIZONA_MIXER_WIDGETS(AIF3TX2, "AIF3TX2"),
587 608
588ARIZONA_MIXER_WIDGETS(ASRC1L, "ASRC1L"), 609ARIZONA_MUX_WIDGETS(ASRC1L, "ASRC1L"),
589ARIZONA_MIXER_WIDGETS(ASRC1R, "ASRC1R"), 610ARIZONA_MUX_WIDGETS(ASRC1R, "ASRC1R"),
590ARIZONA_MIXER_WIDGETS(ASRC2L, "ASRC2L"), 611ARIZONA_MUX_WIDGETS(ASRC2L, "ASRC2L"),
591ARIZONA_MIXER_WIDGETS(ASRC2R, "ASRC2R"), 612ARIZONA_MUX_WIDGETS(ASRC2R, "ASRC2R"),
592 613
593SND_SOC_DAPM_OUTPUT("HPOUT1L"), 614SND_SOC_DAPM_OUTPUT("HPOUT1L"),
594SND_SOC_DAPM_OUTPUT("HPOUT1R"), 615SND_SOC_DAPM_OUTPUT("HPOUT1R"),
@@ -610,6 +631,7 @@ SND_SOC_DAPM_OUTPUT("SPKDAT2R"),
610 { name, "Noise Generator", "Noise Generator" }, \ 631 { name, "Noise Generator", "Noise Generator" }, \
611 { name, "Tone Generator 1", "Tone Generator 1" }, \ 632 { name, "Tone Generator 1", "Tone Generator 1" }, \
612 { name, "Tone Generator 2", "Tone Generator 2" }, \ 633 { name, "Tone Generator 2", "Tone Generator 2" }, \
634 { name, "Haptics", "HAPTICS" }, \
613 { name, "AEC", "AEC Loopback" }, \ 635 { name, "AEC", "AEC Loopback" }, \
614 { name, "IN1L", "IN1L PGA" }, \ 636 { name, "IN1L", "IN1L PGA" }, \
615 { name, "IN1R", "IN1R PGA" }, \ 637 { name, "IN1R", "IN1R PGA" }, \
@@ -786,10 +808,10 @@ static const struct snd_soc_dapm_route wm5110_dapm_routes[] = {
786 ARIZONA_MIXER_ROUTES("LHPF3", "LHPF3"), 808 ARIZONA_MIXER_ROUTES("LHPF3", "LHPF3"),
787 ARIZONA_MIXER_ROUTES("LHPF4", "LHPF4"), 809 ARIZONA_MIXER_ROUTES("LHPF4", "LHPF4"),
788 810
789 ARIZONA_MIXER_ROUTES("ASRC1L", "ASRC1L"), 811 ARIZONA_MUX_ROUTES("ASRC1L"),
790 ARIZONA_MIXER_ROUTES("ASRC1R", "ASRC1R"), 812 ARIZONA_MUX_ROUTES("ASRC1R"),
791 ARIZONA_MIXER_ROUTES("ASRC2L", "ASRC2L"), 813 ARIZONA_MUX_ROUTES("ASRC2L"),
792 ARIZONA_MIXER_ROUTES("ASRC2R", "ASRC2R"), 814 ARIZONA_MUX_ROUTES("ASRC2R"),
793 815
794 { "HPOUT1L", NULL, "OUT1L" }, 816 { "HPOUT1L", NULL, "OUT1L" },
795 { "HPOUT1R", NULL, "OUT1R" }, 817 { "HPOUT1R", NULL, "OUT1R" },
@@ -902,9 +924,29 @@ static struct snd_soc_dai_driver wm5110_dai[] = {
902static int wm5110_codec_probe(struct snd_soc_codec *codec) 924static int wm5110_codec_probe(struct snd_soc_codec *codec)
903{ 925{
904 struct wm5110_priv *priv = snd_soc_codec_get_drvdata(codec); 926 struct wm5110_priv *priv = snd_soc_codec_get_drvdata(codec);
927 int ret;
905 928
906 codec->control_data = priv->core.arizona->regmap; 929 codec->control_data = priv->core.arizona->regmap;
907 return snd_soc_codec_set_cache_io(codec, 32, 16, SND_SOC_REGMAP); 930 priv->core.arizona->dapm = &codec->dapm;
931
932 ret = snd_soc_codec_set_cache_io(codec, 32, 16, SND_SOC_REGMAP);
933 if (ret != 0)
934 return ret;
935
936 snd_soc_dapm_disable_pin(&codec->dapm, "HAPTICS");
937
938 priv->core.arizona->dapm = &codec->dapm;
939
940 return 0;
941}
942
943static int wm5110_codec_remove(struct snd_soc_codec *codec)
944{
945 struct wm5110_priv *priv = snd_soc_codec_get_drvdata(codec);
946
947 priv->core.arizona->dapm = NULL;
948
949 return 0;
908} 950}
909 951
910#define WM5110_DIG_VU 0x0200 952#define WM5110_DIG_VU 0x0200
@@ -935,6 +977,7 @@ static unsigned int wm5110_digital_vu[] = {
935 977
936static struct snd_soc_codec_driver soc_codec_dev_wm5110 = { 978static struct snd_soc_codec_driver soc_codec_dev_wm5110 = {
937 .probe = wm5110_codec_probe, 979 .probe = wm5110_codec_probe,
980 .remove = wm5110_codec_remove,
938 981
939 .idle_bias_off = true, 982 .idle_bias_off = true,
940 983
@@ -949,7 +992,7 @@ static struct snd_soc_codec_driver soc_codec_dev_wm5110 = {
949 .num_dapm_routes = ARRAY_SIZE(wm5110_dapm_routes), 992 .num_dapm_routes = ARRAY_SIZE(wm5110_dapm_routes),
950}; 993};
951 994
952static int __devinit wm5110_probe(struct platform_device *pdev) 995static int wm5110_probe(struct platform_device *pdev)
953{ 996{
954 struct arizona *arizona = dev_get_drvdata(pdev->dev.parent); 997 struct arizona *arizona = dev_get_drvdata(pdev->dev.parent);
955 struct wm5110_priv *wm5110; 998 struct wm5110_priv *wm5110;
@@ -988,7 +1031,7 @@ static int __devinit wm5110_probe(struct platform_device *pdev)
988 wm5110_dai, ARRAY_SIZE(wm5110_dai)); 1031 wm5110_dai, ARRAY_SIZE(wm5110_dai));
989} 1032}
990 1033
991static int __devexit wm5110_remove(struct platform_device *pdev) 1034static int wm5110_remove(struct platform_device *pdev)
992{ 1035{
993 snd_soc_unregister_codec(&pdev->dev); 1036 snd_soc_unregister_codec(&pdev->dev);
994 pm_runtime_disable(&pdev->dev); 1037 pm_runtime_disable(&pdev->dev);
@@ -1002,7 +1045,7 @@ static struct platform_driver wm5110_codec_driver = {
1002 .owner = THIS_MODULE, 1045 .owner = THIS_MODULE,
1003 }, 1046 },
1004 .probe = wm5110_probe, 1047 .probe = wm5110_probe,
1005 .remove = __devexit_p(wm5110_remove), 1048 .remove = wm5110_remove,
1006}; 1049};
1007 1050
1008module_platform_driver(wm5110_codec_driver); 1051module_platform_driver(wm5110_codec_driver);
diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c
index a4cae060bf26..fb92fb47d636 100644
--- a/sound/soc/codecs/wm8350.c
+++ b/sound/soc/codecs/wm8350.c
@@ -1500,7 +1500,7 @@ static int wm8350_codec_probe(struct snd_soc_codec *codec)
1500 for (i = 0; i < ARRAY_SIZE(supply_names); i++) 1500 for (i = 0; i < ARRAY_SIZE(supply_names); i++)
1501 priv->supplies[i].supply = supply_names[i]; 1501 priv->supplies[i].supply = supply_names[i];
1502 1502
1503 ret = regulator_bulk_get(wm8350->dev, ARRAY_SIZE(priv->supplies), 1503 ret = devm_regulator_bulk_get(wm8350->dev, ARRAY_SIZE(priv->supplies),
1504 priv->supplies); 1504 priv->supplies);
1505 if (ret != 0) 1505 if (ret != 0)
1506 return ret; 1506 return ret;
@@ -1607,8 +1607,6 @@ static int wm8350_codec_remove(struct snd_soc_codec *codec)
1607 1607
1608 wm8350_clear_bits(wm8350, WM8350_POWER_MGMT_5, WM8350_CODEC_ENA); 1608 wm8350_clear_bits(wm8350, WM8350_POWER_MGMT_5, WM8350_CODEC_ENA);
1609 1609
1610 regulator_bulk_free(ARRAY_SIZE(priv->supplies), priv->supplies);
1611
1612 return 0; 1610 return 0;
1613} 1611}
1614 1612
@@ -1627,13 +1625,13 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8350 = {
1627 .num_dapm_routes = ARRAY_SIZE(wm8350_dapm_routes), 1625 .num_dapm_routes = ARRAY_SIZE(wm8350_dapm_routes),
1628}; 1626};
1629 1627
1630static int __devinit wm8350_probe(struct platform_device *pdev) 1628static int wm8350_probe(struct platform_device *pdev)
1631{ 1629{
1632 return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_wm8350, 1630 return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_wm8350,
1633 &wm8350_dai, 1); 1631 &wm8350_dai, 1);
1634} 1632}
1635 1633
1636static int __devexit wm8350_remove(struct platform_device *pdev) 1634static int wm8350_remove(struct platform_device *pdev)
1637{ 1635{
1638 snd_soc_unregister_codec(&pdev->dev); 1636 snd_soc_unregister_codec(&pdev->dev);
1639 return 0; 1637 return 0;
@@ -1645,7 +1643,7 @@ static struct platform_driver wm8350_codec_driver = {
1645 .owner = THIS_MODULE, 1643 .owner = THIS_MODULE,
1646 }, 1644 },
1647 .probe = wm8350_probe, 1645 .probe = wm8350_probe,
1648 .remove = __devexit_p(wm8350_remove), 1646 .remove = wm8350_remove,
1649}; 1647};
1650 1648
1651module_platform_driver(wm8350_codec_driver); 1649module_platform_driver(wm8350_codec_driver);
diff --git a/sound/soc/codecs/wm8400.c b/sound/soc/codecs/wm8400.c
index 5d277a915f81..af6d227e67be 100644
--- a/sound/soc/codecs/wm8400.c
+++ b/sound/soc/codecs/wm8400.c
@@ -1373,7 +1373,7 @@ static int wm8400_codec_probe(struct snd_soc_codec *codec)
1373 codec->control_data = priv->wm8400 = wm8400; 1373 codec->control_data = priv->wm8400 = wm8400;
1374 priv->codec = codec; 1374 priv->codec = codec;
1375 1375
1376 ret = regulator_bulk_get(wm8400->dev, 1376 ret = devm_regulator_bulk_get(wm8400->dev,
1377 ARRAY_SIZE(power), &power[0]); 1377 ARRAY_SIZE(power), &power[0]);
1378 if (ret != 0) { 1378 if (ret != 0) {
1379 dev_err(codec->dev, "Failed to get regulators: %d\n", ret); 1379 dev_err(codec->dev, "Failed to get regulators: %d\n", ret);
@@ -1398,15 +1398,9 @@ static int wm8400_codec_probe(struct snd_soc_codec *codec)
1398 snd_soc_write(codec, WM8400_LEFT_OUTPUT_VOLUME, 0x50 | (1<<8)); 1398 snd_soc_write(codec, WM8400_LEFT_OUTPUT_VOLUME, 0x50 | (1<<8));
1399 snd_soc_write(codec, WM8400_RIGHT_OUTPUT_VOLUME, 0x50 | (1<<8)); 1399 snd_soc_write(codec, WM8400_RIGHT_OUTPUT_VOLUME, 0x50 | (1<<8));
1400 1400
1401 if (!schedule_work(&priv->work)) { 1401 if (!schedule_work(&priv->work))
1402 ret = -EINVAL; 1402 return -EINVAL;
1403 goto err_regulator;
1404 }
1405 return 0; 1403 return 0;
1406
1407err_regulator:
1408 regulator_bulk_free(ARRAY_SIZE(power), power);
1409 return ret;
1410} 1404}
1411 1405
1412static int wm8400_codec_remove(struct snd_soc_codec *codec) 1406static int wm8400_codec_remove(struct snd_soc_codec *codec)
@@ -1417,8 +1411,6 @@ static int wm8400_codec_remove(struct snd_soc_codec *codec)
1417 snd_soc_write(codec, WM8400_POWER_MANAGEMENT_1, 1411 snd_soc_write(codec, WM8400_POWER_MANAGEMENT_1,
1418 reg & (~WM8400_CODEC_ENA)); 1412 reg & (~WM8400_CODEC_ENA));
1419 1413
1420 regulator_bulk_free(ARRAY_SIZE(power), power);
1421
1422 return 0; 1414 return 0;
1423} 1415}
1424 1416
@@ -1439,13 +1431,13 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8400 = {
1439 .num_dapm_routes = ARRAY_SIZE(wm8400_dapm_routes), 1431 .num_dapm_routes = ARRAY_SIZE(wm8400_dapm_routes),
1440}; 1432};
1441 1433
1442static int __devinit wm8400_probe(struct platform_device *pdev) 1434static int wm8400_probe(struct platform_device *pdev)
1443{ 1435{
1444 return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_wm8400, 1436 return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_wm8400,
1445 &wm8400_dai, 1); 1437 &wm8400_dai, 1);
1446} 1438}
1447 1439
1448static int __devexit wm8400_remove(struct platform_device *pdev) 1440static int wm8400_remove(struct platform_device *pdev)
1449{ 1441{
1450 snd_soc_unregister_codec(&pdev->dev); 1442 snd_soc_unregister_codec(&pdev->dev);
1451 return 0; 1443 return 0;
@@ -1457,7 +1449,7 @@ static struct platform_driver wm8400_codec_driver = {
1457 .owner = THIS_MODULE, 1449 .owner = THIS_MODULE,
1458 }, 1450 },
1459 .probe = wm8400_probe, 1451 .probe = wm8400_probe,
1460 .remove = __devexit_p(wm8400_remove), 1452 .remove = wm8400_remove,
1461}; 1453};
1462 1454
1463module_platform_driver(wm8400_codec_driver); 1455module_platform_driver(wm8400_codec_driver);
diff --git a/sound/soc/codecs/wm8510.c b/sound/soc/codecs/wm8510.c
index c12a54e72e89..6ed5433943ea 100644
--- a/sound/soc/codecs/wm8510.c
+++ b/sound/soc/codecs/wm8510.c
@@ -608,10 +608,7 @@ static int wm8510_probe(struct snd_soc_codec *codec)
608/* power down chip */ 608/* power down chip */
609static int wm8510_remove(struct snd_soc_codec *codec) 609static int wm8510_remove(struct snd_soc_codec *codec)
610{ 610{
611 struct wm8510_priv *wm8510 = snd_soc_codec_get_drvdata(codec);
612
613 wm8510_set_bias_level(codec, SND_SOC_BIAS_OFF); 611 wm8510_set_bias_level(codec, SND_SOC_BIAS_OFF);
614 kfree(wm8510);
615 return 0; 612 return 0;
616} 613}
617 614
@@ -648,7 +645,7 @@ static const struct regmap_config wm8510_regmap = {
648}; 645};
649 646
650#if defined(CONFIG_SPI_MASTER) 647#if defined(CONFIG_SPI_MASTER)
651static int __devinit wm8510_spi_probe(struct spi_device *spi) 648static int wm8510_spi_probe(struct spi_device *spi)
652{ 649{
653 struct wm8510_priv *wm8510; 650 struct wm8510_priv *wm8510;
654 int ret; 651 int ret;
@@ -670,7 +667,7 @@ static int __devinit wm8510_spi_probe(struct spi_device *spi)
670 return ret; 667 return ret;
671} 668}
672 669
673static int __devexit wm8510_spi_remove(struct spi_device *spi) 670static int wm8510_spi_remove(struct spi_device *spi)
674{ 671{
675 snd_soc_unregister_codec(&spi->dev); 672 snd_soc_unregister_codec(&spi->dev);
676 return 0; 673 return 0;
@@ -683,13 +680,13 @@ static struct spi_driver wm8510_spi_driver = {
683 .of_match_table = wm8510_of_match, 680 .of_match_table = wm8510_of_match,
684 }, 681 },
685 .probe = wm8510_spi_probe, 682 .probe = wm8510_spi_probe,
686 .remove = __devexit_p(wm8510_spi_remove), 683 .remove = wm8510_spi_remove,
687}; 684};
688#endif /* CONFIG_SPI_MASTER */ 685#endif /* CONFIG_SPI_MASTER */
689 686
690#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) 687#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
691static __devinit int wm8510_i2c_probe(struct i2c_client *i2c, 688static int wm8510_i2c_probe(struct i2c_client *i2c,
692 const struct i2c_device_id *id) 689 const struct i2c_device_id *id)
693{ 690{
694 struct wm8510_priv *wm8510; 691 struct wm8510_priv *wm8510;
695 int ret; 692 int ret;
@@ -711,7 +708,7 @@ static __devinit int wm8510_i2c_probe(struct i2c_client *i2c,
711 return ret; 708 return ret;
712} 709}
713 710
714static __devexit int wm8510_i2c_remove(struct i2c_client *client) 711static int wm8510_i2c_remove(struct i2c_client *client)
715{ 712{
716 snd_soc_unregister_codec(&client->dev); 713 snd_soc_unregister_codec(&client->dev);
717 return 0; 714 return 0;
@@ -730,7 +727,7 @@ static struct i2c_driver wm8510_i2c_driver = {
730 .of_match_table = wm8510_of_match, 727 .of_match_table = wm8510_of_match,
731 }, 728 },
732 .probe = wm8510_i2c_probe, 729 .probe = wm8510_i2c_probe,
733 .remove = __devexit_p(wm8510_i2c_remove), 730 .remove = wm8510_i2c_remove,
734 .id_table = wm8510_i2c_id, 731 .id_table = wm8510_i2c_id,
735}; 732};
736#endif 733#endif
diff --git a/sound/soc/codecs/wm8523.c b/sound/soc/codecs/wm8523.c
index 8d5c27673501..139bf9ac9407 100644
--- a/sound/soc/codecs/wm8523.c
+++ b/sound/soc/codecs/wm8523.c
@@ -453,8 +453,8 @@ static const struct regmap_config wm8523_regmap = {
453}; 453};
454 454
455#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) 455#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
456static __devinit int wm8523_i2c_probe(struct i2c_client *i2c, 456static int wm8523_i2c_probe(struct i2c_client *i2c,
457 const struct i2c_device_id *id) 457 const struct i2c_device_id *id)
458{ 458{
459 struct wm8523_priv *wm8523; 459 struct wm8523_priv *wm8523;
460 unsigned int val; 460 unsigned int val;
@@ -528,7 +528,7 @@ err_enable:
528 return ret; 528 return ret;
529} 529}
530 530
531static __devexit int wm8523_i2c_remove(struct i2c_client *client) 531static int wm8523_i2c_remove(struct i2c_client *client)
532{ 532{
533 snd_soc_unregister_codec(&client->dev); 533 snd_soc_unregister_codec(&client->dev);
534 return 0; 534 return 0;
@@ -547,7 +547,7 @@ static struct i2c_driver wm8523_i2c_driver = {
547 .of_match_table = wm8523_of_match, 547 .of_match_table = wm8523_of_match,
548 }, 548 },
549 .probe = wm8523_i2c_probe, 549 .probe = wm8523_i2c_probe,
550 .remove = __devexit_p(wm8523_i2c_remove), 550 .remove = wm8523_i2c_remove,
551 .id_table = wm8523_i2c_id, 551 .id_table = wm8523_i2c_id,
552}; 552};
553#endif 553#endif
diff --git a/sound/soc/codecs/wm8711.c b/sound/soc/codecs/wm8711.c
index 8b8bb70f1eb9..5b428b060d41 100644
--- a/sound/soc/codecs/wm8711.c
+++ b/sound/soc/codecs/wm8711.c
@@ -429,7 +429,7 @@ static const struct regmap_config wm8711_regmap = {
429}; 429};
430 430
431#if defined(CONFIG_SPI_MASTER) 431#if defined(CONFIG_SPI_MASTER)
432static int __devinit wm8711_spi_probe(struct spi_device *spi) 432static int wm8711_spi_probe(struct spi_device *spi)
433{ 433{
434 struct wm8711_priv *wm8711; 434 struct wm8711_priv *wm8711;
435 int ret; 435 int ret;
@@ -451,7 +451,7 @@ static int __devinit wm8711_spi_probe(struct spi_device *spi)
451 return ret; 451 return ret;
452} 452}
453 453
454static int __devexit wm8711_spi_remove(struct spi_device *spi) 454static int wm8711_spi_remove(struct spi_device *spi)
455{ 455{
456 snd_soc_unregister_codec(&spi->dev); 456 snd_soc_unregister_codec(&spi->dev);
457 457
@@ -465,13 +465,13 @@ static struct spi_driver wm8711_spi_driver = {
465 .of_match_table = wm8711_of_match, 465 .of_match_table = wm8711_of_match,
466 }, 466 },
467 .probe = wm8711_spi_probe, 467 .probe = wm8711_spi_probe,
468 .remove = __devexit_p(wm8711_spi_remove), 468 .remove = wm8711_spi_remove,
469}; 469};
470#endif /* CONFIG_SPI_MASTER */ 470#endif /* CONFIG_SPI_MASTER */
471 471
472#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) 472#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
473static __devinit int wm8711_i2c_probe(struct i2c_client *client, 473static int wm8711_i2c_probe(struct i2c_client *client,
474 const struct i2c_device_id *id) 474 const struct i2c_device_id *id)
475{ 475{
476 struct wm8711_priv *wm8711; 476 struct wm8711_priv *wm8711;
477 int ret; 477 int ret;
@@ -493,7 +493,7 @@ static __devinit int wm8711_i2c_probe(struct i2c_client *client,
493 return ret; 493 return ret;
494} 494}
495 495
496static __devexit int wm8711_i2c_remove(struct i2c_client *client) 496static int wm8711_i2c_remove(struct i2c_client *client)
497{ 497{
498 snd_soc_unregister_codec(&client->dev); 498 snd_soc_unregister_codec(&client->dev);
499 return 0; 499 return 0;
@@ -512,7 +512,7 @@ static struct i2c_driver wm8711_i2c_driver = {
512 .of_match_table = wm8711_of_match, 512 .of_match_table = wm8711_of_match,
513 }, 513 },
514 .probe = wm8711_i2c_probe, 514 .probe = wm8711_i2c_probe,
515 .remove = __devexit_p(wm8711_i2c_remove), 515 .remove = wm8711_i2c_remove,
516 .id_table = wm8711_i2c_id, 516 .id_table = wm8711_i2c_id,
517}; 517};
518#endif 518#endif
diff --git a/sound/soc/codecs/wm8727.c b/sound/soc/codecs/wm8727.c
index e81705620718..462f5e4d5c05 100644
--- a/sound/soc/codecs/wm8727.c
+++ b/sound/soc/codecs/wm8727.c
@@ -45,13 +45,13 @@ static struct snd_soc_dai_driver wm8727_dai = {
45 45
46static struct snd_soc_codec_driver soc_codec_dev_wm8727; 46static struct snd_soc_codec_driver soc_codec_dev_wm8727;
47 47
48static __devinit int wm8727_probe(struct platform_device *pdev) 48static int wm8727_probe(struct platform_device *pdev)
49{ 49{
50 return snd_soc_register_codec(&pdev->dev, 50 return snd_soc_register_codec(&pdev->dev,
51 &soc_codec_dev_wm8727, &wm8727_dai, 1); 51 &soc_codec_dev_wm8727, &wm8727_dai, 1);
52} 52}
53 53
54static int __devexit wm8727_remove(struct platform_device *pdev) 54static int wm8727_remove(struct platform_device *pdev)
55{ 55{
56 snd_soc_unregister_codec(&pdev->dev); 56 snd_soc_unregister_codec(&pdev->dev);
57 return 0; 57 return 0;
@@ -64,7 +64,7 @@ static struct platform_driver wm8727_codec_driver = {
64 }, 64 },
65 65
66 .probe = wm8727_probe, 66 .probe = wm8727_probe,
67 .remove = __devexit_p(wm8727_remove), 67 .remove = wm8727_remove,
68}; 68};
69 69
70module_platform_driver(wm8727_codec_driver); 70module_platform_driver(wm8727_codec_driver);
diff --git a/sound/soc/codecs/wm8728.c b/sound/soc/codecs/wm8728.c
index 00a12a0c3919..c6a292dcded0 100644
--- a/sound/soc/codecs/wm8728.c
+++ b/sound/soc/codecs/wm8728.c
@@ -280,7 +280,7 @@ static const struct regmap_config wm8728_regmap = {
280}; 280};
281 281
282#if defined(CONFIG_SPI_MASTER) 282#if defined(CONFIG_SPI_MASTER)
283static int __devinit wm8728_spi_probe(struct spi_device *spi) 283static int wm8728_spi_probe(struct spi_device *spi)
284{ 284{
285 struct wm8728_priv *wm8728; 285 struct wm8728_priv *wm8728;
286 int ret; 286 int ret;
@@ -302,7 +302,7 @@ static int __devinit wm8728_spi_probe(struct spi_device *spi)
302 return ret; 302 return ret;
303} 303}
304 304
305static int __devexit wm8728_spi_remove(struct spi_device *spi) 305static int wm8728_spi_remove(struct spi_device *spi)
306{ 306{
307 snd_soc_unregister_codec(&spi->dev); 307 snd_soc_unregister_codec(&spi->dev);
308 308
@@ -316,13 +316,13 @@ static struct spi_driver wm8728_spi_driver = {
316 .of_match_table = wm8728_of_match, 316 .of_match_table = wm8728_of_match,
317 }, 317 },
318 .probe = wm8728_spi_probe, 318 .probe = wm8728_spi_probe,
319 .remove = __devexit_p(wm8728_spi_remove), 319 .remove = wm8728_spi_remove,
320}; 320};
321#endif /* CONFIG_SPI_MASTER */ 321#endif /* CONFIG_SPI_MASTER */
322 322
323#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) 323#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
324static __devinit int wm8728_i2c_probe(struct i2c_client *i2c, 324static int wm8728_i2c_probe(struct i2c_client *i2c,
325 const struct i2c_device_id *id) 325 const struct i2c_device_id *id)
326{ 326{
327 struct wm8728_priv *wm8728; 327 struct wm8728_priv *wm8728;
328 int ret; 328 int ret;
@@ -344,7 +344,7 @@ static __devinit int wm8728_i2c_probe(struct i2c_client *i2c,
344 return ret; 344 return ret;
345} 345}
346 346
347static __devexit int wm8728_i2c_remove(struct i2c_client *client) 347static int wm8728_i2c_remove(struct i2c_client *client)
348{ 348{
349 snd_soc_unregister_codec(&client->dev); 349 snd_soc_unregister_codec(&client->dev);
350 return 0; 350 return 0;
@@ -363,7 +363,7 @@ static struct i2c_driver wm8728_i2c_driver = {
363 .of_match_table = wm8728_of_match, 363 .of_match_table = wm8728_of_match,
364 }, 364 },
365 .probe = wm8728_i2c_probe, 365 .probe = wm8728_i2c_probe,
366 .remove = __devexit_p(wm8728_i2c_remove), 366 .remove = wm8728_i2c_remove,
367 .id_table = wm8728_i2c_id, 367 .id_table = wm8728_i2c_id,
368}; 368};
369#endif 369#endif
diff --git a/sound/soc/codecs/wm8731.c b/sound/soc/codecs/wm8731.c
index bb1d26919b10..5276062d6c79 100644
--- a/sound/soc/codecs/wm8731.c
+++ b/sound/soc/codecs/wm8731.c
@@ -631,7 +631,7 @@ static const struct regmap_config wm8731_regmap = {
631}; 631};
632 632
633#if defined(CONFIG_SPI_MASTER) 633#if defined(CONFIG_SPI_MASTER)
634static int __devinit wm8731_spi_probe(struct spi_device *spi) 634static int wm8731_spi_probe(struct spi_device *spi)
635{ 635{
636 struct wm8731_priv *wm8731; 636 struct wm8731_priv *wm8731;
637 int ret; 637 int ret;
@@ -661,7 +661,7 @@ static int __devinit wm8731_spi_probe(struct spi_device *spi)
661 return 0; 661 return 0;
662} 662}
663 663
664static int __devexit wm8731_spi_remove(struct spi_device *spi) 664static int wm8731_spi_remove(struct spi_device *spi)
665{ 665{
666 snd_soc_unregister_codec(&spi->dev); 666 snd_soc_unregister_codec(&spi->dev);
667 return 0; 667 return 0;
@@ -674,13 +674,13 @@ static struct spi_driver wm8731_spi_driver = {
674 .of_match_table = wm8731_of_match, 674 .of_match_table = wm8731_of_match,
675 }, 675 },
676 .probe = wm8731_spi_probe, 676 .probe = wm8731_spi_probe,
677 .remove = __devexit_p(wm8731_spi_remove), 677 .remove = wm8731_spi_remove,
678}; 678};
679#endif /* CONFIG_SPI_MASTER */ 679#endif /* CONFIG_SPI_MASTER */
680 680
681#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) 681#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
682static __devinit int wm8731_i2c_probe(struct i2c_client *i2c, 682static int wm8731_i2c_probe(struct i2c_client *i2c,
683 const struct i2c_device_id *id) 683 const struct i2c_device_id *id)
684{ 684{
685 struct wm8731_priv *wm8731; 685 struct wm8731_priv *wm8731;
686 int ret; 686 int ret;
@@ -710,7 +710,7 @@ static __devinit int wm8731_i2c_probe(struct i2c_client *i2c,
710 return 0; 710 return 0;
711} 711}
712 712
713static __devexit int wm8731_i2c_remove(struct i2c_client *client) 713static int wm8731_i2c_remove(struct i2c_client *client)
714{ 714{
715 snd_soc_unregister_codec(&client->dev); 715 snd_soc_unregister_codec(&client->dev);
716 return 0; 716 return 0;
@@ -729,7 +729,7 @@ static struct i2c_driver wm8731_i2c_driver = {
729 .of_match_table = wm8731_of_match, 729 .of_match_table = wm8731_of_match,
730 }, 730 },
731 .probe = wm8731_i2c_probe, 731 .probe = wm8731_i2c_probe,
732 .remove = __devexit_p(wm8731_i2c_remove), 732 .remove = wm8731_i2c_remove,
733 .id_table = wm8731_i2c_id, 733 .id_table = wm8731_i2c_id,
734}; 734};
735#endif 735#endif
diff --git a/sound/soc/codecs/wm8737.c b/sound/soc/codecs/wm8737.c
index 5c9634f4c1f0..2f167a8ca01b 100644
--- a/sound/soc/codecs/wm8737.c
+++ b/sound/soc/codecs/wm8737.c
@@ -645,8 +645,8 @@ static const struct regmap_config wm8737_regmap = {
645}; 645};
646 646
647#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) 647#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
648static __devinit int wm8737_i2c_probe(struct i2c_client *i2c, 648static int wm8737_i2c_probe(struct i2c_client *i2c,
649 const struct i2c_device_id *id) 649 const struct i2c_device_id *id)
650{ 650{
651 struct wm8737_priv *wm8737; 651 struct wm8737_priv *wm8737;
652 int ret, i; 652 int ret, i;
@@ -679,7 +679,7 @@ static __devinit int wm8737_i2c_probe(struct i2c_client *i2c,
679 679
680} 680}
681 681
682static __devexit int wm8737_i2c_remove(struct i2c_client *client) 682static int wm8737_i2c_remove(struct i2c_client *client)
683{ 683{
684 snd_soc_unregister_codec(&client->dev); 684 snd_soc_unregister_codec(&client->dev);
685 685
@@ -699,13 +699,13 @@ static struct i2c_driver wm8737_i2c_driver = {
699 .of_match_table = wm8737_of_match, 699 .of_match_table = wm8737_of_match,
700 }, 700 },
701 .probe = wm8737_i2c_probe, 701 .probe = wm8737_i2c_probe,
702 .remove = __devexit_p(wm8737_i2c_remove), 702 .remove = wm8737_i2c_remove,
703 .id_table = wm8737_i2c_id, 703 .id_table = wm8737_i2c_id,
704}; 704};
705#endif 705#endif
706 706
707#if defined(CONFIG_SPI_MASTER) 707#if defined(CONFIG_SPI_MASTER)
708static int __devinit wm8737_spi_probe(struct spi_device *spi) 708static int wm8737_spi_probe(struct spi_device *spi)
709{ 709{
710 struct wm8737_priv *wm8737; 710 struct wm8737_priv *wm8737;
711 int ret, i; 711 int ret, i;
@@ -737,7 +737,7 @@ static int __devinit wm8737_spi_probe(struct spi_device *spi)
737 return ret; 737 return ret;
738} 738}
739 739
740static int __devexit wm8737_spi_remove(struct spi_device *spi) 740static int wm8737_spi_remove(struct spi_device *spi)
741{ 741{
742 snd_soc_unregister_codec(&spi->dev); 742 snd_soc_unregister_codec(&spi->dev);
743 743
@@ -751,7 +751,7 @@ static struct spi_driver wm8737_spi_driver = {
751 .of_match_table = wm8737_of_match, 751 .of_match_table = wm8737_of_match,
752 }, 752 },
753 .probe = wm8737_spi_probe, 753 .probe = wm8737_spi_probe,
754 .remove = __devexit_p(wm8737_spi_remove), 754 .remove = wm8737_spi_remove,
755}; 755};
756#endif /* CONFIG_SPI_MASTER */ 756#endif /* CONFIG_SPI_MASTER */
757 757
diff --git a/sound/soc/codecs/wm8741.c b/sound/soc/codecs/wm8741.c
index 4281a0802138..b18813cc7ba9 100644
--- a/sound/soc/codecs/wm8741.c
+++ b/sound/soc/codecs/wm8741.c
@@ -522,7 +522,7 @@ static int wm8741_i2c_probe(struct i2c_client *i2c,
522 return ret; 522 return ret;
523 } 523 }
524 524
525 wm8741->regmap = regmap_init_i2c(i2c, &wm8741_regmap); 525 wm8741->regmap = devm_regmap_init_i2c(i2c, &wm8741_regmap);
526 if (IS_ERR(wm8741->regmap)) { 526 if (IS_ERR(wm8741->regmap)) {
527 ret = PTR_ERR(wm8741->regmap); 527 ret = PTR_ERR(wm8741->regmap);
528 dev_err(&i2c->dev, "Failed to init regmap: %d\n", ret); 528 dev_err(&i2c->dev, "Failed to init regmap: %d\n", ret);
@@ -562,7 +562,7 @@ static struct i2c_driver wm8741_i2c_driver = {
562#endif 562#endif
563 563
564#if defined(CONFIG_SPI_MASTER) 564#if defined(CONFIG_SPI_MASTER)
565static int __devinit wm8741_spi_probe(struct spi_device *spi) 565static int wm8741_spi_probe(struct spi_device *spi)
566{ 566{
567 struct wm8741_priv *wm8741; 567 struct wm8741_priv *wm8741;
568 int ret, i; 568 int ret, i;
@@ -582,7 +582,7 @@ static int __devinit wm8741_spi_probe(struct spi_device *spi)
582 return ret; 582 return ret;
583 } 583 }
584 584
585 wm8741->regmap = regmap_init_spi(spi, &wm8741_regmap); 585 wm8741->regmap = devm_regmap_init_spi(spi, &wm8741_regmap);
586 if (IS_ERR(wm8741->regmap)) { 586 if (IS_ERR(wm8741->regmap)) {
587 ret = PTR_ERR(wm8741->regmap); 587 ret = PTR_ERR(wm8741->regmap);
588 dev_err(&spi->dev, "Failed to init regmap: %d\n", ret); 588 dev_err(&spi->dev, "Failed to init regmap: %d\n", ret);
@@ -596,7 +596,7 @@ static int __devinit wm8741_spi_probe(struct spi_device *spi)
596 return ret; 596 return ret;
597} 597}
598 598
599static int __devexit wm8741_spi_remove(struct spi_device *spi) 599static int wm8741_spi_remove(struct spi_device *spi)
600{ 600{
601 snd_soc_unregister_codec(&spi->dev); 601 snd_soc_unregister_codec(&spi->dev);
602 return 0; 602 return 0;
@@ -609,7 +609,7 @@ static struct spi_driver wm8741_spi_driver = {
609 .of_match_table = wm8741_of_match, 609 .of_match_table = wm8741_of_match,
610 }, 610 },
611 .probe = wm8741_spi_probe, 611 .probe = wm8741_spi_probe,
612 .remove = __devexit_p(wm8741_spi_remove), 612 .remove = wm8741_spi_remove,
613}; 613};
614#endif /* CONFIG_SPI_MASTER */ 614#endif /* CONFIG_SPI_MASTER */
615 615
diff --git a/sound/soc/codecs/wm8750.c b/sound/soc/codecs/wm8750.c
index 89151ca5e776..50d5ff616232 100644
--- a/sound/soc/codecs/wm8750.c
+++ b/sound/soc/codecs/wm8750.c
@@ -18,6 +18,7 @@
18#include <linux/delay.h> 18#include <linux/delay.h>
19#include <linux/pm.h> 19#include <linux/pm.h>
20#include <linux/i2c.h> 20#include <linux/i2c.h>
21#include <linux/regmap.h>
21#include <linux/spi/spi.h> 22#include <linux/spi/spi.h>
22#include <linux/slab.h> 23#include <linux/slab.h>
23#include <linux/of_device.h> 24#include <linux/of_device.h>
@@ -34,24 +35,55 @@
34 * We can't read the WM8750 register space when we 35 * We can't read the WM8750 register space when we
35 * are using 2 wire for device control, so we cache them instead. 36 * are using 2 wire for device control, so we cache them instead.
36 */ 37 */
37static const u16 wm8750_reg[] = { 38static const struct reg_default wm8750_reg_defaults[] = {
38 0x0097, 0x0097, 0x0079, 0x0079, /* 0 */ 39 { 0, 0x0097 },
39 0x0000, 0x0008, 0x0000, 0x000a, /* 4 */ 40 { 1, 0x0097 },
40 0x0000, 0x0000, 0x00ff, 0x00ff, /* 8 */ 41 { 2, 0x0079 },
41 0x000f, 0x000f, 0x0000, 0x0000, /* 12 */ 42 { 3, 0x0079 },
42 0x0000, 0x007b, 0x0000, 0x0032, /* 16 */ 43 { 4, 0x0000 },
43 0x0000, 0x00c3, 0x00c3, 0x00c0, /* 20 */ 44 { 5, 0x0008 },
44 0x0000, 0x0000, 0x0000, 0x0000, /* 24 */ 45 { 6, 0x0000 },
45 0x0000, 0x0000, 0x0000, 0x0000, /* 28 */ 46 { 7, 0x000a },
46 0x0000, 0x0000, 0x0050, 0x0050, /* 32 */ 47 { 8, 0x0000 },
47 0x0050, 0x0050, 0x0050, 0x0050, /* 36 */ 48 { 9, 0x0000 },
48 0x0079, 0x0079, 0x0079, /* 40 */ 49 { 10, 0x00ff },
50 { 11, 0x00ff },
51 { 12, 0x000f },
52 { 13, 0x000f },
53 { 14, 0x0000 },
54 { 15, 0x0000 },
55 { 16, 0x0000 },
56 { 17, 0x007b },
57 { 18, 0x0000 },
58 { 19, 0x0032 },
59 { 20, 0x0000 },
60 { 21, 0x00c3 },
61 { 22, 0x00c3 },
62 { 23, 0x00c0 },
63 { 24, 0x0000 },
64 { 25, 0x0000 },
65 { 26, 0x0000 },
66 { 27, 0x0000 },
67 { 28, 0x0000 },
68 { 29, 0x0000 },
69 { 30, 0x0000 },
70 { 31, 0x0000 },
71 { 32, 0x0000 },
72 { 33, 0x0000 },
73 { 34, 0x0050 },
74 { 35, 0x0050 },
75 { 36, 0x0050 },
76 { 37, 0x0050 },
77 { 38, 0x0050 },
78 { 39, 0x0050 },
79 { 40, 0x0079 },
80 { 41, 0x0079 },
81 { 42, 0x0079 },
49}; 82};
50 83
51/* codec private data */ 84/* codec private data */
52struct wm8750_priv { 85struct wm8750_priv {
53 unsigned int sysclk; 86 unsigned int sysclk;
54 enum snd_soc_control_type control_type;
55}; 87};
56 88
57#define wm8750_reset(c) snd_soc_write(c, WM8750_RESET, 0) 89#define wm8750_reset(c) snd_soc_write(c, WM8750_RESET, 0)
@@ -668,10 +700,9 @@ static int wm8750_resume(struct snd_soc_codec *codec)
668 700
669static int wm8750_probe(struct snd_soc_codec *codec) 701static int wm8750_probe(struct snd_soc_codec *codec)
670{ 702{
671 struct wm8750_priv *wm8750 = snd_soc_codec_get_drvdata(codec);
672 int ret; 703 int ret;
673 704
674 ret = snd_soc_codec_set_cache_io(codec, 7, 9, wm8750->control_type); 705 ret = snd_soc_codec_set_cache_io(codec, 7, 9, SND_SOC_REGMAP);
675 if (ret < 0) { 706 if (ret < 0) {
676 printk(KERN_ERR "wm8750: failed to set cache I/O: %d\n", ret); 707 printk(KERN_ERR "wm8750: failed to set cache I/O: %d\n", ret);
677 return ret; 708 return ret;
@@ -711,9 +742,6 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8750 = {
711 .suspend = wm8750_suspend, 742 .suspend = wm8750_suspend,
712 .resume = wm8750_resume, 743 .resume = wm8750_resume,
713 .set_bias_level = wm8750_set_bias_level, 744 .set_bias_level = wm8750_set_bias_level,
714 .reg_cache_size = ARRAY_SIZE(wm8750_reg),
715 .reg_word_size = sizeof(u16),
716 .reg_cache_default = wm8750_reg,
717 745
718 .controls = wm8750_snd_controls, 746 .controls = wm8750_snd_controls,
719 .num_controls = ARRAY_SIZE(wm8750_snd_controls), 747 .num_controls = ARRAY_SIZE(wm8750_snd_controls),
@@ -730,10 +758,21 @@ static const struct of_device_id wm8750_of_match[] = {
730}; 758};
731MODULE_DEVICE_TABLE(of, wm8750_of_match); 759MODULE_DEVICE_TABLE(of, wm8750_of_match);
732 760
761static const struct regmap_config wm8750_regmap = {
762 .reg_bits = 7,
763 .val_bits = 9,
764 .max_register = WM8750_MOUTV,
765
766 .reg_defaults = wm8750_reg_defaults,
767 .num_reg_defaults = ARRAY_SIZE(wm8750_reg_defaults),
768 .cache_type = REGCACHE_RBTREE,
769};
770
733#if defined(CONFIG_SPI_MASTER) 771#if defined(CONFIG_SPI_MASTER)
734static int __devinit wm8750_spi_probe(struct spi_device *spi) 772static int wm8750_spi_probe(struct spi_device *spi)
735{ 773{
736 struct wm8750_priv *wm8750; 774 struct wm8750_priv *wm8750;
775 struct regmap *regmap;
737 int ret; 776 int ret;
738 777
739 wm8750 = devm_kzalloc(&spi->dev, sizeof(struct wm8750_priv), 778 wm8750 = devm_kzalloc(&spi->dev, sizeof(struct wm8750_priv),
@@ -741,7 +780,10 @@ static int __devinit wm8750_spi_probe(struct spi_device *spi)
741 if (wm8750 == NULL) 780 if (wm8750 == NULL)
742 return -ENOMEM; 781 return -ENOMEM;
743 782
744 wm8750->control_type = SND_SOC_SPI; 783 regmap = devm_regmap_init_spi(spi, &wm8750_regmap);
784 if (IS_ERR(regmap))
785 return PTR_ERR(regmap);
786
745 spi_set_drvdata(spi, wm8750); 787 spi_set_drvdata(spi, wm8750);
746 788
747 ret = snd_soc_register_codec(&spi->dev, 789 ret = snd_soc_register_codec(&spi->dev,
@@ -749,7 +791,7 @@ static int __devinit wm8750_spi_probe(struct spi_device *spi)
749 return ret; 791 return ret;
750} 792}
751 793
752static int __devexit wm8750_spi_remove(struct spi_device *spi) 794static int wm8750_spi_remove(struct spi_device *spi)
753{ 795{
754 snd_soc_unregister_codec(&spi->dev); 796 snd_soc_unregister_codec(&spi->dev);
755 return 0; 797 return 0;
@@ -770,15 +812,16 @@ static struct spi_driver wm8750_spi_driver = {
770 }, 812 },
771 .id_table = wm8750_spi_ids, 813 .id_table = wm8750_spi_ids,
772 .probe = wm8750_spi_probe, 814 .probe = wm8750_spi_probe,
773 .remove = __devexit_p(wm8750_spi_remove), 815 .remove = wm8750_spi_remove,
774}; 816};
775#endif /* CONFIG_SPI_MASTER */ 817#endif /* CONFIG_SPI_MASTER */
776 818
777#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) 819#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
778static __devinit int wm8750_i2c_probe(struct i2c_client *i2c, 820static int wm8750_i2c_probe(struct i2c_client *i2c,
779 const struct i2c_device_id *id) 821 const struct i2c_device_id *id)
780{ 822{
781 struct wm8750_priv *wm8750; 823 struct wm8750_priv *wm8750;
824 struct regmap *regmap;
782 int ret; 825 int ret;
783 826
784 wm8750 = devm_kzalloc(&i2c->dev, sizeof(struct wm8750_priv), 827 wm8750 = devm_kzalloc(&i2c->dev, sizeof(struct wm8750_priv),
@@ -787,14 +830,17 @@ static __devinit int wm8750_i2c_probe(struct i2c_client *i2c,
787 return -ENOMEM; 830 return -ENOMEM;
788 831
789 i2c_set_clientdata(i2c, wm8750); 832 i2c_set_clientdata(i2c, wm8750);
790 wm8750->control_type = SND_SOC_I2C; 833
834 regmap = devm_regmap_init_i2c(i2c, &wm8750_regmap);
835 if (IS_ERR(regmap))
836 return PTR_ERR(regmap);
791 837
792 ret = snd_soc_register_codec(&i2c->dev, 838 ret = snd_soc_register_codec(&i2c->dev,
793 &soc_codec_dev_wm8750, &wm8750_dai, 1); 839 &soc_codec_dev_wm8750, &wm8750_dai, 1);
794 return ret; 840 return ret;
795} 841}
796 842
797static __devexit int wm8750_i2c_remove(struct i2c_client *client) 843static int wm8750_i2c_remove(struct i2c_client *client)
798{ 844{
799 snd_soc_unregister_codec(&client->dev); 845 snd_soc_unregister_codec(&client->dev);
800 return 0; 846 return 0;
@@ -814,7 +860,7 @@ static struct i2c_driver wm8750_i2c_driver = {
814 .of_match_table = wm8750_of_match, 860 .of_match_table = wm8750_of_match,
815 }, 861 },
816 .probe = wm8750_i2c_probe, 862 .probe = wm8750_i2c_probe,
817 .remove = __devexit_p(wm8750_i2c_remove), 863 .remove = wm8750_i2c_remove,
818 .id_table = wm8750_i2c_id, 864 .id_table = wm8750_i2c_id,
819}; 865};
820#endif 866#endif
diff --git a/sound/soc/codecs/wm8753.c b/sound/soc/codecs/wm8753.c
index 2e4a775ae560..0a4ab4c423d1 100644
--- a/sound/soc/codecs/wm8753.c
+++ b/sound/soc/codecs/wm8753.c
@@ -1550,7 +1550,7 @@ static const struct regmap_config wm8753_regmap = {
1550}; 1550};
1551 1551
1552#if defined(CONFIG_SPI_MASTER) 1552#if defined(CONFIG_SPI_MASTER)
1553static int __devinit wm8753_spi_probe(struct spi_device *spi) 1553static int wm8753_spi_probe(struct spi_device *spi)
1554{ 1554{
1555 struct wm8753_priv *wm8753; 1555 struct wm8753_priv *wm8753;
1556 int ret; 1556 int ret;
@@ -1562,36 +1562,25 @@ static int __devinit wm8753_spi_probe(struct spi_device *spi)
1562 1562
1563 spi_set_drvdata(spi, wm8753); 1563 spi_set_drvdata(spi, wm8753);
1564 1564
1565 wm8753->regmap = regmap_init_spi(spi, &wm8753_regmap); 1565 wm8753->regmap = devm_regmap_init_spi(spi, &wm8753_regmap);
1566 if (IS_ERR(wm8753->regmap)) { 1566 if (IS_ERR(wm8753->regmap)) {
1567 ret = PTR_ERR(wm8753->regmap); 1567 ret = PTR_ERR(wm8753->regmap);
1568 dev_err(&spi->dev, "Failed to allocate register map: %d\n", 1568 dev_err(&spi->dev, "Failed to allocate register map: %d\n",
1569 ret); 1569 ret);
1570 goto err; 1570 return ret;
1571 } 1571 }
1572 1572
1573 ret = snd_soc_register_codec(&spi->dev, &soc_codec_dev_wm8753, 1573 ret = snd_soc_register_codec(&spi->dev, &soc_codec_dev_wm8753,
1574 wm8753_dai, ARRAY_SIZE(wm8753_dai)); 1574 wm8753_dai, ARRAY_SIZE(wm8753_dai));
1575 if (ret != 0) { 1575 if (ret != 0)
1576 dev_err(&spi->dev, "Failed to register CODEC: %d\n", ret); 1576 dev_err(&spi->dev, "Failed to register CODEC: %d\n", ret);
1577 goto err_regmap;
1578 }
1579 1577
1580 return 0;
1581
1582err_regmap:
1583 regmap_exit(wm8753->regmap);
1584err:
1585 return ret; 1578 return ret;
1586} 1579}
1587 1580
1588static int __devexit wm8753_spi_remove(struct spi_device *spi) 1581static int wm8753_spi_remove(struct spi_device *spi)
1589{ 1582{
1590 struct wm8753_priv *wm8753 = spi_get_drvdata(spi);
1591
1592 snd_soc_unregister_codec(&spi->dev); 1583 snd_soc_unregister_codec(&spi->dev);
1593 regmap_exit(wm8753->regmap);
1594 kfree(wm8753);
1595 return 0; 1584 return 0;
1596} 1585}
1597 1586
@@ -1602,13 +1591,13 @@ static struct spi_driver wm8753_spi_driver = {
1602 .of_match_table = wm8753_of_match, 1591 .of_match_table = wm8753_of_match,
1603 }, 1592 },
1604 .probe = wm8753_spi_probe, 1593 .probe = wm8753_spi_probe,
1605 .remove = __devexit_p(wm8753_spi_remove), 1594 .remove = wm8753_spi_remove,
1606}; 1595};
1607#endif /* CONFIG_SPI_MASTER */ 1596#endif /* CONFIG_SPI_MASTER */
1608 1597
1609#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) 1598#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
1610static __devinit int wm8753_i2c_probe(struct i2c_client *i2c, 1599static int wm8753_i2c_probe(struct i2c_client *i2c,
1611 const struct i2c_device_id *id) 1600 const struct i2c_device_id *id)
1612{ 1601{
1613 struct wm8753_priv *wm8753; 1602 struct wm8753_priv *wm8753;
1614 int ret; 1603 int ret;
@@ -1620,35 +1609,25 @@ static __devinit int wm8753_i2c_probe(struct i2c_client *i2c,
1620 1609
1621 i2c_set_clientdata(i2c, wm8753); 1610 i2c_set_clientdata(i2c, wm8753);
1622 1611
1623 wm8753->regmap = regmap_init_i2c(i2c, &wm8753_regmap); 1612 wm8753->regmap = devm_regmap_init_i2c(i2c, &wm8753_regmap);
1624 if (IS_ERR(wm8753->regmap)) { 1613 if (IS_ERR(wm8753->regmap)) {
1625 ret = PTR_ERR(wm8753->regmap); 1614 ret = PTR_ERR(wm8753->regmap);
1626 dev_err(&i2c->dev, "Failed to allocate register map: %d\n", 1615 dev_err(&i2c->dev, "Failed to allocate register map: %d\n",
1627 ret); 1616 ret);
1628 goto err; 1617 return ret;
1629 } 1618 }
1630 1619
1631 ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_wm8753, 1620 ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_wm8753,
1632 wm8753_dai, ARRAY_SIZE(wm8753_dai)); 1621 wm8753_dai, ARRAY_SIZE(wm8753_dai));
1633 if (ret != 0) { 1622 if (ret != 0)
1634 dev_err(&i2c->dev, "Failed to register CODEC: %d\n", ret); 1623 dev_err(&i2c->dev, "Failed to register CODEC: %d\n", ret);
1635 goto err_regmap;
1636 }
1637 1624
1638 return 0;
1639
1640err_regmap:
1641 regmap_exit(wm8753->regmap);
1642err:
1643 return ret; 1625 return ret;
1644} 1626}
1645 1627
1646static __devexit int wm8753_i2c_remove(struct i2c_client *client) 1628static int wm8753_i2c_remove(struct i2c_client *client)
1647{ 1629{
1648 struct wm8753_priv *wm8753 = i2c_get_clientdata(client);
1649
1650 snd_soc_unregister_codec(&client->dev); 1630 snd_soc_unregister_codec(&client->dev);
1651 regmap_exit(wm8753->regmap);
1652 return 0; 1631 return 0;
1653} 1632}
1654 1633
@@ -1665,7 +1644,7 @@ static struct i2c_driver wm8753_i2c_driver = {
1665 .of_match_table = wm8753_of_match, 1644 .of_match_table = wm8753_of_match,
1666 }, 1645 },
1667 .probe = wm8753_i2c_probe, 1646 .probe = wm8753_i2c_probe,
1668 .remove = __devexit_p(wm8753_i2c_remove), 1647 .remove = wm8753_i2c_remove,
1669 .id_table = wm8753_i2c_id, 1648 .id_table = wm8753_i2c_id,
1670}; 1649};
1671#endif 1650#endif
diff --git a/sound/soc/codecs/wm8770.c b/sound/soc/codecs/wm8770.c
index c7c0034d3966..89a18d82f303 100644
--- a/sound/soc/codecs/wm8770.c
+++ b/sound/soc/codecs/wm8770.c
@@ -17,6 +17,7 @@
17#include <linux/of_device.h> 17#include <linux/of_device.h>
18#include <linux/pm.h> 18#include <linux/pm.h>
19#include <linux/spi/spi.h> 19#include <linux/spi/spi.h>
20#include <linux/regmap.h>
20#include <linux/regulator/consumer.h> 21#include <linux/regulator/consumer.h>
21#include <linux/slab.h> 22#include <linux/slab.h>
22#include <sound/core.h> 23#include <sound/core.h>
@@ -35,19 +36,52 @@ static const char *wm8770_supply_names[WM8770_NUM_SUPPLIES] = {
35 "DVDD" 36 "DVDD"
36}; 37};
37 38
38static const u16 wm8770_reg_defs[WM8770_CACHEREGNUM] = { 39static const struct reg_default wm8770_reg_defaults[] = {
39 0x7f, 0x7f, 0x7f, 0x7f, 40 { 0, 0x7f },
40 0x7f, 0x7f, 0x7f, 0x7f, 41 { 1, 0x7f },
41 0x7f, 0xff, 0xff, 0xff, 42 { 2, 0x7f },
42 0xff, 0xff, 0xff, 0xff, 43 { 3, 0x7f },
43 0xff, 0xff, 0, 0x90, 0, 44 { 4, 0x7f },
44 0, 0x22, 0x22, 0x3e, 45 { 5, 0x7f },
45 0xc, 0xc, 0x100, 0x189, 46 { 6, 0x7f },
46 0x189, 0x8770 47 { 7, 0x7f },
48 { 8, 0x7f },
49 { 9, 0xff },
50 { 10, 0xff },
51 { 11, 0xff },
52 { 12, 0xff },
53 { 13, 0xff },
54 { 14, 0xff },
55 { 15, 0xff },
56 { 16, 0xff },
57 { 17, 0xff },
58 { 18, 0 },
59 { 19, 0x90 },
60 { 20, 0 },
61 { 21, 0 },
62 { 22, 0x22 },
63 { 23, 0x22 },
64 { 24, 0x3e },
65 { 25, 0xc },
66 { 26, 0xc },
67 { 27, 0x100 },
68 { 28, 0x189 },
69 { 29, 0x189 },
70 { 30, 0x8770 },
47}; 71};
48 72
73static bool wm8770_volatile_reg(struct device *dev, unsigned int reg)
74{
75 switch (reg) {
76 case WM8770_RESET:
77 return true;
78 default:
79 return false;
80 }
81}
82
49struct wm8770_priv { 83struct wm8770_priv {
50 enum snd_soc_control_type control_type; 84 struct regmap *regmap;
51 struct regulator_bulk_data supplies[WM8770_NUM_SUPPLIES]; 85 struct regulator_bulk_data supplies[WM8770_NUM_SUPPLIES];
52 struct notifier_block disable_nb[WM8770_NUM_SUPPLIES]; 86 struct notifier_block disable_nb[WM8770_NUM_SUPPLIES];
53 struct snd_soc_codec *codec; 87 struct snd_soc_codec *codec;
@@ -71,7 +105,7 @@ static int wm8770_regulator_event_##n(struct notifier_block *nb, \
71 struct wm8770_priv *wm8770 = container_of(nb, struct wm8770_priv, \ 105 struct wm8770_priv *wm8770 = container_of(nb, struct wm8770_priv, \
72 disable_nb[n]); \ 106 disable_nb[n]); \
73 if (event & REGULATOR_EVENT_DISABLE) { \ 107 if (event & REGULATOR_EVENT_DISABLE) { \
74 wm8770->codec->cache_sync = 1; \ 108 regcache_mark_dirty(wm8770->regmap); \
75 } \ 109 } \
76 return 0; \ 110 return 0; \
77} 111}
@@ -466,24 +500,6 @@ static int wm8770_set_sysclk(struct snd_soc_dai *dai,
466 return 0; 500 return 0;
467} 501}
468 502
469static void wm8770_sync_cache(struct snd_soc_codec *codec)
470{
471 int i;
472 u16 *cache;
473
474 if (!codec->cache_sync)
475 return;
476
477 codec->cache_only = 0;
478 cache = codec->reg_cache;
479 for (i = 0; i < codec->driver->reg_cache_size; i++) {
480 if (i == WM8770_RESET || cache[i] == wm8770_reg_defs[i])
481 continue;
482 snd_soc_write(codec, i, cache[i]);
483 }
484 codec->cache_sync = 0;
485}
486
487static int wm8770_set_bias_level(struct snd_soc_codec *codec, 503static int wm8770_set_bias_level(struct snd_soc_codec *codec,
488 enum snd_soc_bias_level level) 504 enum snd_soc_bias_level level)
489{ 505{
@@ -507,7 +523,9 @@ static int wm8770_set_bias_level(struct snd_soc_codec *codec,
507 ret); 523 ret);
508 return ret; 524 return ret;
509 } 525 }
510 wm8770_sync_cache(codec); 526
527 regcache_sync(wm8770->regmap);
528
511 /* global powerup */ 529 /* global powerup */
512 snd_soc_write(codec, WM8770_PWDNCTRL, 0); 530 snd_soc_write(codec, WM8770_PWDNCTRL, 0);
513 } 531 }
@@ -554,68 +572,25 @@ static struct snd_soc_dai_driver wm8770_dai = {
554 .symmetric_rates = 1 572 .symmetric_rates = 1
555}; 573};
556 574
557#ifdef CONFIG_PM
558static int wm8770_suspend(struct snd_soc_codec *codec)
559{
560 wm8770_set_bias_level(codec, SND_SOC_BIAS_OFF);
561 return 0;
562}
563
564static int wm8770_resume(struct snd_soc_codec *codec)
565{
566 wm8770_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
567 return 0;
568}
569#else
570#define wm8770_suspend NULL
571#define wm8770_resume NULL
572#endif
573
574static int wm8770_probe(struct snd_soc_codec *codec) 575static int wm8770_probe(struct snd_soc_codec *codec)
575{ 576{
576 struct wm8770_priv *wm8770; 577 struct wm8770_priv *wm8770;
577 int ret; 578 int ret;
578 int i;
579 579
580 wm8770 = snd_soc_codec_get_drvdata(codec); 580 wm8770 = snd_soc_codec_get_drvdata(codec);
581 wm8770->codec = codec; 581 wm8770->codec = codec;
582 582
583 ret = snd_soc_codec_set_cache_io(codec, 7, 9, wm8770->control_type); 583 ret = snd_soc_codec_set_cache_io(codec, 7, 9, SND_SOC_REGMAP);
584 if (ret < 0) { 584 if (ret < 0) {
585 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret); 585 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
586 return ret; 586 return ret;
587 } 587 }
588 588
589 for (i = 0; i < ARRAY_SIZE(wm8770->supplies); i++)
590 wm8770->supplies[i].supply = wm8770_supply_names[i];
591
592 ret = regulator_bulk_get(codec->dev, ARRAY_SIZE(wm8770->supplies),
593 wm8770->supplies);
594 if (ret) {
595 dev_err(codec->dev, "Failed to request supplies: %d\n", ret);
596 return ret;
597 }
598
599 wm8770->disable_nb[0].notifier_call = wm8770_regulator_event_0;
600 wm8770->disable_nb[1].notifier_call = wm8770_regulator_event_1;
601 wm8770->disable_nb[2].notifier_call = wm8770_regulator_event_2;
602
603 /* This should really be moved into the regulator core */
604 for (i = 0; i < ARRAY_SIZE(wm8770->supplies); i++) {
605 ret = regulator_register_notifier(wm8770->supplies[i].consumer,
606 &wm8770->disable_nb[i]);
607 if (ret) {
608 dev_err(codec->dev,
609 "Failed to register regulator notifier: %d\n",
610 ret);
611 }
612 }
613
614 ret = regulator_bulk_enable(ARRAY_SIZE(wm8770->supplies), 589 ret = regulator_bulk_enable(ARRAY_SIZE(wm8770->supplies),
615 wm8770->supplies); 590 wm8770->supplies);
616 if (ret) { 591 if (ret) {
617 dev_err(codec->dev, "Failed to enable supplies: %d\n", ret); 592 dev_err(codec->dev, "Failed to enable supplies: %d\n", ret);
618 goto err_reg_get; 593 return ret;
619 } 594 }
620 595
621 ret = wm8770_reset(codec); 596 ret = wm8770_reset(codec);
@@ -624,8 +599,6 @@ static int wm8770_probe(struct snd_soc_codec *codec)
624 goto err_reg_enable; 599 goto err_reg_enable;
625 } 600 }
626 601
627 wm8770_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
628
629 /* latch the volume update bits */ 602 /* latch the volume update bits */
630 snd_soc_update_bits(codec, WM8770_MSDIGVOL, 0x100, 0x100); 603 snd_soc_update_bits(codec, WM8770_MSDIGVOL, 0x100, 0x100);
631 snd_soc_update_bits(codec, WM8770_MSALGVOL, 0x100, 0x100); 604 snd_soc_update_bits(codec, WM8770_MSALGVOL, 0x100, 0x100);
@@ -641,46 +614,22 @@ static int wm8770_probe(struct snd_soc_codec *codec)
641 /* mute all DACs */ 614 /* mute all DACs */
642 snd_soc_update_bits(codec, WM8770_DACMUTE, 0x10, 0x10); 615 snd_soc_update_bits(codec, WM8770_DACMUTE, 0x10, 0x10);
643 616
644 snd_soc_add_codec_controls(codec, wm8770_snd_controls,
645 ARRAY_SIZE(wm8770_snd_controls));
646 snd_soc_dapm_new_controls(&codec->dapm, wm8770_dapm_widgets,
647 ARRAY_SIZE(wm8770_dapm_widgets));
648 snd_soc_dapm_add_routes(&codec->dapm, wm8770_intercon,
649 ARRAY_SIZE(wm8770_intercon));
650 return 0;
651
652err_reg_enable: 617err_reg_enable:
653 regulator_bulk_disable(ARRAY_SIZE(wm8770->supplies), wm8770->supplies); 618 regulator_bulk_disable(ARRAY_SIZE(wm8770->supplies), wm8770->supplies);
654err_reg_get:
655 regulator_bulk_free(ARRAY_SIZE(wm8770->supplies), wm8770->supplies);
656 return ret; 619 return ret;
657} 620}
658 621
659static int wm8770_remove(struct snd_soc_codec *codec)
660{
661 struct wm8770_priv *wm8770;
662 int i;
663
664 wm8770 = snd_soc_codec_get_drvdata(codec);
665 wm8770_set_bias_level(codec, SND_SOC_BIAS_OFF);
666
667 for (i = 0; i < ARRAY_SIZE(wm8770->supplies); ++i)
668 regulator_unregister_notifier(wm8770->supplies[i].consumer,
669 &wm8770->disable_nb[i]);
670 regulator_bulk_free(ARRAY_SIZE(wm8770->supplies), wm8770->supplies);
671 return 0;
672}
673
674static struct snd_soc_codec_driver soc_codec_dev_wm8770 = { 622static struct snd_soc_codec_driver soc_codec_dev_wm8770 = {
675 .probe = wm8770_probe, 623 .probe = wm8770_probe,
676 .remove = wm8770_remove,
677 .suspend = wm8770_suspend,
678 .resume = wm8770_resume,
679 .set_bias_level = wm8770_set_bias_level, 624 .set_bias_level = wm8770_set_bias_level,
680 .idle_bias_off = true, 625 .idle_bias_off = true,
681 .reg_cache_size = ARRAY_SIZE(wm8770_reg_defs), 626
682 .reg_word_size = sizeof (u16), 627 .controls = wm8770_snd_controls,
683 .reg_cache_default = wm8770_reg_defs 628 .num_controls = ARRAY_SIZE(wm8770_snd_controls),
629 .dapm_widgets = wm8770_dapm_widgets,
630 .num_dapm_widgets = ARRAY_SIZE(wm8770_dapm_widgets),
631 .dapm_routes = wm8770_intercon,
632 .num_dapm_routes = ARRAY_SIZE(wm8770_intercon),
684}; 633};
685 634
686static const struct of_device_id wm8770_of_match[] = { 635static const struct of_device_id wm8770_of_match[] = {
@@ -689,17 +638,57 @@ static const struct of_device_id wm8770_of_match[] = {
689}; 638};
690MODULE_DEVICE_TABLE(of, wm8770_of_match); 639MODULE_DEVICE_TABLE(of, wm8770_of_match);
691 640
692static int __devinit wm8770_spi_probe(struct spi_device *spi) 641static const struct regmap_config wm8770_regmap = {
642 .reg_bits = 7,
643 .val_bits = 9,
644 .max_register = WM8770_RESET,
645
646 .reg_defaults = wm8770_reg_defaults,
647 .num_reg_defaults = ARRAY_SIZE(wm8770_reg_defaults),
648 .cache_type = REGCACHE_RBTREE,
649
650 .volatile_reg = wm8770_volatile_reg,
651};
652
653static int wm8770_spi_probe(struct spi_device *spi)
693{ 654{
694 struct wm8770_priv *wm8770; 655 struct wm8770_priv *wm8770;
695 int ret; 656 int ret, i;
696 657
697 wm8770 = devm_kzalloc(&spi->dev, sizeof(struct wm8770_priv), 658 wm8770 = devm_kzalloc(&spi->dev, sizeof(struct wm8770_priv),
698 GFP_KERNEL); 659 GFP_KERNEL);
699 if (!wm8770) 660 if (!wm8770)
700 return -ENOMEM; 661 return -ENOMEM;
701 662
702 wm8770->control_type = SND_SOC_SPI; 663 for (i = 0; i < ARRAY_SIZE(wm8770->supplies); i++)
664 wm8770->supplies[i].supply = wm8770_supply_names[i];
665
666 ret = devm_regulator_bulk_get(&spi->dev, ARRAY_SIZE(wm8770->supplies),
667 wm8770->supplies);
668 if (ret) {
669 dev_err(&spi->dev, "Failed to request supplies: %d\n", ret);
670 return ret;
671 }
672
673 wm8770->disable_nb[0].notifier_call = wm8770_regulator_event_0;
674 wm8770->disable_nb[1].notifier_call = wm8770_regulator_event_1;
675 wm8770->disable_nb[2].notifier_call = wm8770_regulator_event_2;
676
677 /* This should really be moved into the regulator core */
678 for (i = 0; i < ARRAY_SIZE(wm8770->supplies); i++) {
679 ret = regulator_register_notifier(wm8770->supplies[i].consumer,
680 &wm8770->disable_nb[i]);
681 if (ret) {
682 dev_err(&spi->dev,
683 "Failed to register regulator notifier: %d\n",
684 ret);
685 }
686 }
687
688 wm8770->regmap = devm_regmap_init_spi(spi, &wm8770_regmap);
689 if (IS_ERR(wm8770->regmap))
690 return PTR_ERR(wm8770->regmap);
691
703 spi_set_drvdata(spi, wm8770); 692 spi_set_drvdata(spi, wm8770);
704 693
705 ret = snd_soc_register_codec(&spi->dev, 694 ret = snd_soc_register_codec(&spi->dev,
@@ -708,9 +697,17 @@ static int __devinit wm8770_spi_probe(struct spi_device *spi)
708 return ret; 697 return ret;
709} 698}
710 699
711static int __devexit wm8770_spi_remove(struct spi_device *spi) 700static int wm8770_spi_remove(struct spi_device *spi)
712{ 701{
702 struct wm8770_priv *wm8770 = spi_get_drvdata(spi);
703 int i;
704
705 for (i = 0; i < ARRAY_SIZE(wm8770->supplies); ++i)
706 regulator_unregister_notifier(wm8770->supplies[i].consumer,
707 &wm8770->disable_nb[i]);
708
713 snd_soc_unregister_codec(&spi->dev); 709 snd_soc_unregister_codec(&spi->dev);
710
714 return 0; 711 return 0;
715} 712}
716 713
@@ -721,7 +718,7 @@ static struct spi_driver wm8770_spi_driver = {
721 .of_match_table = wm8770_of_match, 718 .of_match_table = wm8770_of_match,
722 }, 719 },
723 .probe = wm8770_spi_probe, 720 .probe = wm8770_spi_probe,
724 .remove = __devexit_p(wm8770_spi_remove) 721 .remove = wm8770_spi_remove
725}; 722};
726 723
727module_spi_driver(wm8770_spi_driver); 724module_spi_driver(wm8770_spi_driver);
diff --git a/sound/soc/codecs/wm8776.c b/sound/soc/codecs/wm8776.c
index c32249ddb2e0..f31017ed1381 100644
--- a/sound/soc/codecs/wm8776.c
+++ b/sound/soc/codecs/wm8776.c
@@ -492,7 +492,7 @@ static const struct regmap_config wm8776_regmap = {
492}; 492};
493 493
494#if defined(CONFIG_SPI_MASTER) 494#if defined(CONFIG_SPI_MASTER)
495static int __devinit wm8776_spi_probe(struct spi_device *spi) 495static int wm8776_spi_probe(struct spi_device *spi)
496{ 496{
497 struct wm8776_priv *wm8776; 497 struct wm8776_priv *wm8776;
498 int ret; 498 int ret;
@@ -514,7 +514,7 @@ static int __devinit wm8776_spi_probe(struct spi_device *spi)
514 return ret; 514 return ret;
515} 515}
516 516
517static int __devexit wm8776_spi_remove(struct spi_device *spi) 517static int wm8776_spi_remove(struct spi_device *spi)
518{ 518{
519 snd_soc_unregister_codec(&spi->dev); 519 snd_soc_unregister_codec(&spi->dev);
520 return 0; 520 return 0;
@@ -527,13 +527,13 @@ static struct spi_driver wm8776_spi_driver = {
527 .of_match_table = wm8776_of_match, 527 .of_match_table = wm8776_of_match,
528 }, 528 },
529 .probe = wm8776_spi_probe, 529 .probe = wm8776_spi_probe,
530 .remove = __devexit_p(wm8776_spi_remove), 530 .remove = wm8776_spi_remove,
531}; 531};
532#endif /* CONFIG_SPI_MASTER */ 532#endif /* CONFIG_SPI_MASTER */
533 533
534#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) 534#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
535static __devinit int wm8776_i2c_probe(struct i2c_client *i2c, 535static int wm8776_i2c_probe(struct i2c_client *i2c,
536 const struct i2c_device_id *id) 536 const struct i2c_device_id *id)
537{ 537{
538 struct wm8776_priv *wm8776; 538 struct wm8776_priv *wm8776;
539 int ret; 539 int ret;
@@ -555,7 +555,7 @@ static __devinit int wm8776_i2c_probe(struct i2c_client *i2c,
555 return ret; 555 return ret;
556} 556}
557 557
558static __devexit int wm8776_i2c_remove(struct i2c_client *client) 558static int wm8776_i2c_remove(struct i2c_client *client)
559{ 559{
560 snd_soc_unregister_codec(&client->dev); 560 snd_soc_unregister_codec(&client->dev);
561 return 0; 561 return 0;
@@ -575,7 +575,7 @@ static struct i2c_driver wm8776_i2c_driver = {
575 .of_match_table = wm8776_of_match, 575 .of_match_table = wm8776_of_match,
576 }, 576 },
577 .probe = wm8776_i2c_probe, 577 .probe = wm8776_i2c_probe,
578 .remove = __devexit_p(wm8776_i2c_remove), 578 .remove = wm8776_i2c_remove,
579 .id_table = wm8776_i2c_id, 579 .id_table = wm8776_i2c_id,
580}; 580};
581#endif 581#endif
diff --git a/sound/soc/codecs/wm8782.c b/sound/soc/codecs/wm8782.c
index 3fdea98f732e..f1fdbf63abb4 100644
--- a/sound/soc/codecs/wm8782.c
+++ b/sound/soc/codecs/wm8782.c
@@ -42,13 +42,13 @@ static struct snd_soc_dai_driver wm8782_dai = {
42 42
43static struct snd_soc_codec_driver soc_codec_dev_wm8782; 43static struct snd_soc_codec_driver soc_codec_dev_wm8782;
44 44
45static __devinit int wm8782_probe(struct platform_device *pdev) 45static int wm8782_probe(struct platform_device *pdev)
46{ 46{
47 return snd_soc_register_codec(&pdev->dev, 47 return snd_soc_register_codec(&pdev->dev,
48 &soc_codec_dev_wm8782, &wm8782_dai, 1); 48 &soc_codec_dev_wm8782, &wm8782_dai, 1);
49} 49}
50 50
51static int __devexit wm8782_remove(struct platform_device *pdev) 51static int wm8782_remove(struct platform_device *pdev)
52{ 52{
53 snd_soc_unregister_codec(&pdev->dev); 53 snd_soc_unregister_codec(&pdev->dev);
54 return 0; 54 return 0;
@@ -60,7 +60,7 @@ static struct platform_driver wm8782_codec_driver = {
60 .owner = THIS_MODULE, 60 .owner = THIS_MODULE,
61 }, 61 },
62 .probe = wm8782_probe, 62 .probe = wm8782_probe,
63 .remove = __devexit_p(wm8782_remove), 63 .remove = wm8782_remove,
64}; 64};
65 65
66module_platform_driver(wm8782_codec_driver); 66module_platform_driver(wm8782_codec_driver);
diff --git a/sound/soc/codecs/wm8804.c b/sound/soc/codecs/wm8804.c
index c088020172ab..d321a875b029 100644
--- a/sound/soc/codecs/wm8804.c
+++ b/sound/soc/codecs/wm8804.c
@@ -702,7 +702,7 @@ static struct regmap_config wm8804_regmap_config = {
702}; 702};
703 703
704#if defined(CONFIG_SPI_MASTER) 704#if defined(CONFIG_SPI_MASTER)
705static int __devinit wm8804_spi_probe(struct spi_device *spi) 705static int wm8804_spi_probe(struct spi_device *spi)
706{ 706{
707 struct wm8804_priv *wm8804; 707 struct wm8804_priv *wm8804;
708 int ret; 708 int ret;
@@ -711,7 +711,7 @@ static int __devinit wm8804_spi_probe(struct spi_device *spi)
711 if (!wm8804) 711 if (!wm8804)
712 return -ENOMEM; 712 return -ENOMEM;
713 713
714 wm8804->regmap = regmap_init_spi(spi, &wm8804_regmap_config); 714 wm8804->regmap = devm_regmap_init_spi(spi, &wm8804_regmap_config);
715 if (IS_ERR(wm8804->regmap)) { 715 if (IS_ERR(wm8804->regmap)) {
716 ret = PTR_ERR(wm8804->regmap); 716 ret = PTR_ERR(wm8804->regmap);
717 return ret; 717 return ret;
@@ -725,11 +725,9 @@ static int __devinit wm8804_spi_probe(struct spi_device *spi)
725 return ret; 725 return ret;
726} 726}
727 727
728static int __devexit wm8804_spi_remove(struct spi_device *spi) 728static int wm8804_spi_remove(struct spi_device *spi)
729{ 729{
730 struct wm8804_priv *wm8804 = spi_get_drvdata(spi);
731 snd_soc_unregister_codec(&spi->dev); 730 snd_soc_unregister_codec(&spi->dev);
732 regmap_exit(wm8804->regmap);
733 return 0; 731 return 0;
734} 732}
735 733
@@ -740,13 +738,13 @@ static struct spi_driver wm8804_spi_driver = {
740 .of_match_table = wm8804_of_match, 738 .of_match_table = wm8804_of_match,
741 }, 739 },
742 .probe = wm8804_spi_probe, 740 .probe = wm8804_spi_probe,
743 .remove = __devexit_p(wm8804_spi_remove) 741 .remove = wm8804_spi_remove
744}; 742};
745#endif 743#endif
746 744
747#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) 745#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
748static __devinit int wm8804_i2c_probe(struct i2c_client *i2c, 746static int wm8804_i2c_probe(struct i2c_client *i2c,
749 const struct i2c_device_id *id) 747 const struct i2c_device_id *id)
750{ 748{
751 struct wm8804_priv *wm8804; 749 struct wm8804_priv *wm8804;
752 int ret; 750 int ret;
@@ -755,7 +753,7 @@ static __devinit int wm8804_i2c_probe(struct i2c_client *i2c,
755 if (!wm8804) 753 if (!wm8804)
756 return -ENOMEM; 754 return -ENOMEM;
757 755
758 wm8804->regmap = regmap_init_i2c(i2c, &wm8804_regmap_config); 756 wm8804->regmap = devm_regmap_init_i2c(i2c, &wm8804_regmap_config);
759 if (IS_ERR(wm8804->regmap)) { 757 if (IS_ERR(wm8804->regmap)) {
760 ret = PTR_ERR(wm8804->regmap); 758 ret = PTR_ERR(wm8804->regmap);
761 return ret; 759 return ret;
@@ -765,23 +763,12 @@ static __devinit int wm8804_i2c_probe(struct i2c_client *i2c,
765 763
766 ret = snd_soc_register_codec(&i2c->dev, 764 ret = snd_soc_register_codec(&i2c->dev,
767 &soc_codec_dev_wm8804, &wm8804_dai, 1); 765 &soc_codec_dev_wm8804, &wm8804_dai, 1);
768 if (ret != 0)
769 goto err;
770
771 return 0;
772
773err:
774 regmap_exit(wm8804->regmap);
775 return ret; 766 return ret;
776} 767}
777 768
778static __devexit int wm8804_i2c_remove(struct i2c_client *i2c) 769static int wm8804_i2c_remove(struct i2c_client *i2c)
779{ 770{
780 struct wm8804_priv *wm8804 = i2c_get_clientdata(i2c);
781
782 snd_soc_unregister_codec(&i2c->dev); 771 snd_soc_unregister_codec(&i2c->dev);
783 regmap_exit(wm8804->regmap);
784
785 return 0; 772 return 0;
786} 773}
787 774
@@ -798,7 +785,7 @@ static struct i2c_driver wm8804_i2c_driver = {
798 .of_match_table = wm8804_of_match, 785 .of_match_table = wm8804_of_match,
799 }, 786 },
800 .probe = wm8804_i2c_probe, 787 .probe = wm8804_i2c_probe,
801 .remove = __devexit_p(wm8804_i2c_remove), 788 .remove = wm8804_i2c_remove,
802 .id_table = wm8804_i2c_id 789 .id_table = wm8804_i2c_id
803}; 790};
804#endif 791#endif
diff --git a/sound/soc/codecs/wm8900.c b/sound/soc/codecs/wm8900.c
index e781f865e5d7..7c8257c5a17b 100644
--- a/sound/soc/codecs/wm8900.c
+++ b/sound/soc/codecs/wm8900.c
@@ -1247,7 +1247,7 @@ static const struct regmap_config wm8900_regmap = {
1247}; 1247};
1248 1248
1249#if defined(CONFIG_SPI_MASTER) 1249#if defined(CONFIG_SPI_MASTER)
1250static int __devinit wm8900_spi_probe(struct spi_device *spi) 1250static int wm8900_spi_probe(struct spi_device *spi)
1251{ 1251{
1252 struct wm8900_priv *wm8900; 1252 struct wm8900_priv *wm8900;
1253 int ret; 1253 int ret;
@@ -1269,7 +1269,7 @@ static int __devinit wm8900_spi_probe(struct spi_device *spi)
1269 return ret; 1269 return ret;
1270} 1270}
1271 1271
1272static int __devexit wm8900_spi_remove(struct spi_device *spi) 1272static int wm8900_spi_remove(struct spi_device *spi)
1273{ 1273{
1274 snd_soc_unregister_codec(&spi->dev); 1274 snd_soc_unregister_codec(&spi->dev);
1275 return 0; 1275 return 0;
@@ -1281,13 +1281,13 @@ static struct spi_driver wm8900_spi_driver = {
1281 .owner = THIS_MODULE, 1281 .owner = THIS_MODULE,
1282 }, 1282 },
1283 .probe = wm8900_spi_probe, 1283 .probe = wm8900_spi_probe,
1284 .remove = __devexit_p(wm8900_spi_remove), 1284 .remove = wm8900_spi_remove,
1285}; 1285};
1286#endif /* CONFIG_SPI_MASTER */ 1286#endif /* CONFIG_SPI_MASTER */
1287 1287
1288#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) 1288#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
1289static __devinit int wm8900_i2c_probe(struct i2c_client *i2c, 1289static int wm8900_i2c_probe(struct i2c_client *i2c,
1290 const struct i2c_device_id *id) 1290 const struct i2c_device_id *id)
1291{ 1291{
1292 struct wm8900_priv *wm8900; 1292 struct wm8900_priv *wm8900;
1293 int ret; 1293 int ret;
@@ -1309,7 +1309,7 @@ static __devinit int wm8900_i2c_probe(struct i2c_client *i2c,
1309 return ret; 1309 return ret;
1310} 1310}
1311 1311
1312static __devexit int wm8900_i2c_remove(struct i2c_client *client) 1312static int wm8900_i2c_remove(struct i2c_client *client)
1313{ 1313{
1314 snd_soc_unregister_codec(&client->dev); 1314 snd_soc_unregister_codec(&client->dev);
1315 return 0; 1315 return 0;
@@ -1327,7 +1327,7 @@ static struct i2c_driver wm8900_i2c_driver = {
1327 .owner = THIS_MODULE, 1327 .owner = THIS_MODULE,
1328 }, 1328 },
1329 .probe = wm8900_i2c_probe, 1329 .probe = wm8900_i2c_probe,
1330 .remove = __devexit_p(wm8900_i2c_remove), 1330 .remove = wm8900_i2c_remove,
1331 .id_table = wm8900_i2c_id, 1331 .id_table = wm8900_i2c_id,
1332}; 1332};
1333#endif 1333#endif
diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c
index 839414f9e2ed..134e41c870b9 100644
--- a/sound/soc/codecs/wm8903.c
+++ b/sound/soc/codecs/wm8903.c
@@ -2020,8 +2020,8 @@ static int wm8903_set_pdata_from_of(struct i2c_client *i2c,
2020 return 0; 2020 return 0;
2021} 2021}
2022 2022
2023static __devinit int wm8903_i2c_probe(struct i2c_client *i2c, 2023static int wm8903_i2c_probe(struct i2c_client *i2c,
2024 const struct i2c_device_id *id) 2024 const struct i2c_device_id *id)
2025{ 2025{
2026 struct wm8903_platform_data *pdata = dev_get_platdata(&i2c->dev); 2026 struct wm8903_platform_data *pdata = dev_get_platdata(&i2c->dev);
2027 struct wm8903_priv *wm8903; 2027 struct wm8903_priv *wm8903;
@@ -2206,7 +2206,7 @@ err:
2206 return ret; 2206 return ret;
2207} 2207}
2208 2208
2209static __devexit int wm8903_i2c_remove(struct i2c_client *client) 2209static int wm8903_i2c_remove(struct i2c_client *client)
2210{ 2210{
2211 struct wm8903_priv *wm8903 = i2c_get_clientdata(client); 2211 struct wm8903_priv *wm8903 = i2c_get_clientdata(client);
2212 2212
@@ -2237,7 +2237,7 @@ static struct i2c_driver wm8903_i2c_driver = {
2237 .of_match_table = wm8903_of_match, 2237 .of_match_table = wm8903_of_match,
2238 }, 2238 },
2239 .probe = wm8903_i2c_probe, 2239 .probe = wm8903_i2c_probe,
2240 .remove = __devexit_p(wm8903_i2c_remove), 2240 .remove = wm8903_i2c_remove,
2241 .id_table = wm8903_i2c_id, 2241 .id_table = wm8903_i2c_id,
2242}; 2242};
2243 2243
diff --git a/sound/soc/codecs/wm8904.c b/sound/soc/codecs/wm8904.c
index 7c8df52a8d9d..3ff195c541db 100644
--- a/sound/soc/codecs/wm8904.c
+++ b/sound/soc/codecs/wm8904.c
@@ -2111,8 +2111,8 @@ static const struct regmap_config wm8904_regmap = {
2111 .num_reg_defaults = ARRAY_SIZE(wm8904_reg_defaults), 2111 .num_reg_defaults = ARRAY_SIZE(wm8904_reg_defaults),
2112}; 2112};
2113 2113
2114static __devinit int wm8904_i2c_probe(struct i2c_client *i2c, 2114static int wm8904_i2c_probe(struct i2c_client *i2c,
2115 const struct i2c_device_id *id) 2115 const struct i2c_device_id *id)
2116{ 2116{
2117 struct wm8904_priv *wm8904; 2117 struct wm8904_priv *wm8904;
2118 unsigned int val; 2118 unsigned int val;
@@ -2247,7 +2247,7 @@ err_enable:
2247 return ret; 2247 return ret;
2248} 2248}
2249 2249
2250static __devexit int wm8904_i2c_remove(struct i2c_client *client) 2250static int wm8904_i2c_remove(struct i2c_client *client)
2251{ 2251{
2252 snd_soc_unregister_codec(&client->dev); 2252 snd_soc_unregister_codec(&client->dev);
2253 return 0; 2253 return 0;
@@ -2267,7 +2267,7 @@ static struct i2c_driver wm8904_i2c_driver = {
2267 .owner = THIS_MODULE, 2267 .owner = THIS_MODULE,
2268 }, 2268 },
2269 .probe = wm8904_i2c_probe, 2269 .probe = wm8904_i2c_probe,
2270 .remove = __devexit_p(wm8904_i2c_remove), 2270 .remove = wm8904_i2c_remove,
2271 .id_table = wm8904_i2c_id, 2271 .id_table = wm8904_i2c_id,
2272}; 2272};
2273 2273
diff --git a/sound/soc/codecs/wm8940.c b/sound/soc/codecs/wm8940.c
index b20aa4e7c3f9..b1591c61c254 100644
--- a/sound/soc/codecs/wm8940.c
+++ b/sound/soc/codecs/wm8940.c
@@ -742,8 +742,8 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8940 = {
742 .volatile_register = wm8940_volatile_register, 742 .volatile_register = wm8940_volatile_register,
743}; 743};
744 744
745static __devinit int wm8940_i2c_probe(struct i2c_client *i2c, 745static int wm8940_i2c_probe(struct i2c_client *i2c,
746 const struct i2c_device_id *id) 746 const struct i2c_device_id *id)
747{ 747{
748 struct wm8940_priv *wm8940; 748 struct wm8940_priv *wm8940;
749 int ret; 749 int ret;
@@ -762,7 +762,7 @@ static __devinit int wm8940_i2c_probe(struct i2c_client *i2c,
762 return ret; 762 return ret;
763} 763}
764 764
765static __devexit int wm8940_i2c_remove(struct i2c_client *client) 765static int wm8940_i2c_remove(struct i2c_client *client)
766{ 766{
767 snd_soc_unregister_codec(&client->dev); 767 snd_soc_unregister_codec(&client->dev);
768 768
@@ -781,7 +781,7 @@ static struct i2c_driver wm8940_i2c_driver = {
781 .owner = THIS_MODULE, 781 .owner = THIS_MODULE,
782 }, 782 },
783 .probe = wm8940_i2c_probe, 783 .probe = wm8940_i2c_probe,
784 .remove = __devexit_p(wm8940_i2c_remove), 784 .remove = wm8940_i2c_remove,
785 .id_table = wm8940_i2c_id, 785 .id_table = wm8940_i2c_id,
786}; 786};
787 787
diff --git a/sound/soc/codecs/wm8955.c b/sound/soc/codecs/wm8955.c
index 2f1c075755b1..82c8ba975720 100644
--- a/sound/soc/codecs/wm8955.c
+++ b/sound/soc/codecs/wm8955.c
@@ -1012,8 +1012,8 @@ static const struct regmap_config wm8955_regmap = {
1012 .num_reg_defaults = ARRAY_SIZE(wm8955_reg_defaults), 1012 .num_reg_defaults = ARRAY_SIZE(wm8955_reg_defaults),
1013}; 1013};
1014 1014
1015static __devinit int wm8955_i2c_probe(struct i2c_client *i2c, 1015static int wm8955_i2c_probe(struct i2c_client *i2c,
1016 const struct i2c_device_id *id) 1016 const struct i2c_device_id *id)
1017{ 1017{
1018 struct wm8955_priv *wm8955; 1018 struct wm8955_priv *wm8955;
1019 int ret; 1019 int ret;
@@ -1023,7 +1023,7 @@ static __devinit int wm8955_i2c_probe(struct i2c_client *i2c,
1023 if (wm8955 == NULL) 1023 if (wm8955 == NULL)
1024 return -ENOMEM; 1024 return -ENOMEM;
1025 1025
1026 wm8955->regmap = regmap_init_i2c(i2c, &wm8955_regmap); 1026 wm8955->regmap = devm_regmap_init_i2c(i2c, &wm8955_regmap);
1027 if (IS_ERR(wm8955->regmap)) { 1027 if (IS_ERR(wm8955->regmap)) {
1028 ret = PTR_ERR(wm8955->regmap); 1028 ret = PTR_ERR(wm8955->regmap);
1029 dev_err(&i2c->dev, "Failed to allocate register map: %d\n", 1029 dev_err(&i2c->dev, "Failed to allocate register map: %d\n",
@@ -1035,22 +1035,13 @@ static __devinit int wm8955_i2c_probe(struct i2c_client *i2c,
1035 1035
1036 ret = snd_soc_register_codec(&i2c->dev, 1036 ret = snd_soc_register_codec(&i2c->dev,
1037 &soc_codec_dev_wm8955, &wm8955_dai, 1); 1037 &soc_codec_dev_wm8955, &wm8955_dai, 1);
1038 if (ret != 0)
1039 goto err;
1040 1038
1041 return ret; 1039 return ret;
1042
1043err:
1044 regmap_exit(wm8955->regmap);
1045 return ret;
1046} 1040}
1047 1041
1048static __devexit int wm8955_i2c_remove(struct i2c_client *client) 1042static int wm8955_i2c_remove(struct i2c_client *client)
1049{ 1043{
1050 struct wm8955_priv *wm8955 = i2c_get_clientdata(client);
1051
1052 snd_soc_unregister_codec(&client->dev); 1044 snd_soc_unregister_codec(&client->dev);
1053 regmap_exit(wm8955->regmap);
1054 1045
1055 return 0; 1046 return 0;
1056} 1047}
@@ -1067,7 +1058,7 @@ static struct i2c_driver wm8955_i2c_driver = {
1067 .owner = THIS_MODULE, 1058 .owner = THIS_MODULE,
1068 }, 1059 },
1069 .probe = wm8955_i2c_probe, 1060 .probe = wm8955_i2c_probe,
1070 .remove = __devexit_p(wm8955_i2c_remove), 1061 .remove = wm8955_i2c_remove,
1071 .id_table = wm8955_i2c_id, 1062 .id_table = wm8955_i2c_id,
1072}; 1063};
1073 1064
diff --git a/sound/soc/codecs/wm8958-dsp2.c b/sound/soc/codecs/wm8958-dsp2.c
index 00121ba36597..b0710d817a65 100644
--- a/sound/soc/codecs/wm8958-dsp2.c
+++ b/sound/soc/codecs/wm8958-dsp2.c
@@ -195,7 +195,7 @@ ok:
195static void wm8958_dsp_start_mbc(struct snd_soc_codec *codec, int path) 195static void wm8958_dsp_start_mbc(struct snd_soc_codec *codec, int path)
196{ 196{
197 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); 197 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
198 struct wm8994_pdata *pdata = wm8994->pdata; 198 struct wm8994 *control = wm8994->wm8994;
199 int i; 199 int i;
200 200
201 /* If the DSP is already running then noop */ 201 /* If the DSP is already running then noop */
@@ -210,9 +210,9 @@ static void wm8958_dsp_start_mbc(struct snd_soc_codec *codec, int path)
210 WM8958_DSP2_ENA, WM8958_DSP2_ENA); 210 WM8958_DSP2_ENA, WM8958_DSP2_ENA);
211 211
212 /* If we've got user supplied MBC settings use them */ 212 /* If we've got user supplied MBC settings use them */
213 if (pdata && pdata->num_mbc_cfgs) { 213 if (control->pdata.num_mbc_cfgs) {
214 struct wm8958_mbc_cfg *cfg 214 struct wm8958_mbc_cfg *cfg
215 = &pdata->mbc_cfgs[wm8994->mbc_cfg]; 215 = &control->pdata.mbc_cfgs[wm8994->mbc_cfg];
216 216
217 for (i = 0; i < ARRAY_SIZE(cfg->coeff_regs); i++) 217 for (i = 0; i < ARRAY_SIZE(cfg->coeff_regs); i++)
218 snd_soc_write(codec, i + WM8958_MBC_BAND_1_K_1, 218 snd_soc_write(codec, i + WM8958_MBC_BAND_1_K_1,
@@ -239,7 +239,7 @@ static void wm8958_dsp_start_mbc(struct snd_soc_codec *codec, int path)
239static void wm8958_dsp_start_vss(struct snd_soc_codec *codec, int path) 239static void wm8958_dsp_start_vss(struct snd_soc_codec *codec, int path)
240{ 240{
241 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); 241 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
242 struct wm8994_pdata *pdata = wm8994->pdata; 242 struct wm8994 *control = wm8994->wm8994;
243 int i, ena; 243 int i, ena;
244 244
245 if (wm8994->mbc_vss) 245 if (wm8994->mbc_vss)
@@ -249,26 +249,26 @@ static void wm8958_dsp_start_vss(struct snd_soc_codec *codec, int path)
249 WM8958_DSP2_ENA, WM8958_DSP2_ENA); 249 WM8958_DSP2_ENA, WM8958_DSP2_ENA);
250 250
251 /* If we've got user supplied settings use them */ 251 /* If we've got user supplied settings use them */
252 if (pdata && pdata->num_mbc_cfgs) { 252 if (control->pdata.num_mbc_cfgs) {
253 struct wm8958_mbc_cfg *cfg 253 struct wm8958_mbc_cfg *cfg
254 = &pdata->mbc_cfgs[wm8994->mbc_cfg]; 254 = &control->pdata.mbc_cfgs[wm8994->mbc_cfg];
255 255
256 for (i = 0; i < ARRAY_SIZE(cfg->combined_regs); i++) 256 for (i = 0; i < ARRAY_SIZE(cfg->combined_regs); i++)
257 snd_soc_write(codec, i + 0x2800, 257 snd_soc_write(codec, i + 0x2800,
258 cfg->combined_regs[i]); 258 cfg->combined_regs[i]);
259 } 259 }
260 260
261 if (pdata && pdata->num_vss_cfgs) { 261 if (control->pdata.num_vss_cfgs) {
262 struct wm8958_vss_cfg *cfg 262 struct wm8958_vss_cfg *cfg
263 = &pdata->vss_cfgs[wm8994->vss_cfg]; 263 = &control->pdata.vss_cfgs[wm8994->vss_cfg];
264 264
265 for (i = 0; i < ARRAY_SIZE(cfg->regs); i++) 265 for (i = 0; i < ARRAY_SIZE(cfg->regs); i++)
266 snd_soc_write(codec, i + 0x2600, cfg->regs[i]); 266 snd_soc_write(codec, i + 0x2600, cfg->regs[i]);
267 } 267 }
268 268
269 if (pdata && pdata->num_vss_hpf_cfgs) { 269 if (control->pdata.num_vss_hpf_cfgs) {
270 struct wm8958_vss_hpf_cfg *cfg 270 struct wm8958_vss_hpf_cfg *cfg
271 = &pdata->vss_hpf_cfgs[wm8994->vss_hpf_cfg]; 271 = &control->pdata.vss_hpf_cfgs[wm8994->vss_hpf_cfg];
272 272
273 for (i = 0; i < ARRAY_SIZE(cfg->regs); i++) 273 for (i = 0; i < ARRAY_SIZE(cfg->regs); i++)
274 snd_soc_write(codec, i + 0x2400, cfg->regs[i]); 274 snd_soc_write(codec, i + 0x2400, cfg->regs[i]);
@@ -300,7 +300,7 @@ static void wm8958_dsp_start_vss(struct snd_soc_codec *codec, int path)
300static void wm8958_dsp_start_enh_eq(struct snd_soc_codec *codec, int path) 300static void wm8958_dsp_start_enh_eq(struct snd_soc_codec *codec, int path)
301{ 301{
302 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); 302 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
303 struct wm8994_pdata *pdata = wm8994->pdata; 303 struct wm8994 *control = wm8994->wm8994;
304 int i; 304 int i;
305 305
306 wm8958_dsp2_fw(codec, "ENH_EQ", wm8994->enh_eq, false); 306 wm8958_dsp2_fw(codec, "ENH_EQ", wm8994->enh_eq, false);
@@ -309,9 +309,9 @@ static void wm8958_dsp_start_enh_eq(struct snd_soc_codec *codec, int path)
309 WM8958_DSP2_ENA, WM8958_DSP2_ENA); 309 WM8958_DSP2_ENA, WM8958_DSP2_ENA);
310 310
311 /* If we've got user supplied settings use them */ 311 /* If we've got user supplied settings use them */
312 if (pdata && pdata->num_enh_eq_cfgs) { 312 if (control->pdata.num_enh_eq_cfgs) {
313 struct wm8958_enh_eq_cfg *cfg 313 struct wm8958_enh_eq_cfg *cfg
314 = &pdata->enh_eq_cfgs[wm8994->enh_eq_cfg]; 314 = &control->pdata.enh_eq_cfgs[wm8994->enh_eq_cfg];
315 315
316 for (i = 0; i < ARRAY_SIZE(cfg->regs); i++) 316 for (i = 0; i < ARRAY_SIZE(cfg->regs); i++)
317 snd_soc_write(codec, i + 0x2200, 317 snd_soc_write(codec, i + 0x2200,
@@ -458,7 +458,7 @@ static int wm8958_put_mbc_enum(struct snd_kcontrol *kcontrol,
458{ 458{
459 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 459 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
460 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); 460 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
461 struct wm8994_pdata *pdata = wm8994->pdata; 461 struct wm8994 *control = wm8994->wm8994;
462 int value = ucontrol->value.integer.value[0]; 462 int value = ucontrol->value.integer.value[0];
463 int reg; 463 int reg;
464 464
@@ -467,7 +467,7 @@ static int wm8958_put_mbc_enum(struct snd_kcontrol *kcontrol,
467 if (reg < 0 || reg & WM8958_DSP2CLK_ENA) 467 if (reg < 0 || reg & WM8958_DSP2CLK_ENA)
468 return -EBUSY; 468 return -EBUSY;
469 469
470 if (value >= pdata->num_mbc_cfgs) 470 if (value >= control->pdata.num_mbc_cfgs)
471 return -EINVAL; 471 return -EINVAL;
472 472
473 wm8994->mbc_cfg = value; 473 wm8994->mbc_cfg = value;
@@ -548,7 +548,7 @@ static int wm8958_put_vss_enum(struct snd_kcontrol *kcontrol,
548{ 548{
549 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 549 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
550 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); 550 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
551 struct wm8994_pdata *pdata = wm8994->pdata; 551 struct wm8994 *control = wm8994->wm8994;
552 int value = ucontrol->value.integer.value[0]; 552 int value = ucontrol->value.integer.value[0];
553 int reg; 553 int reg;
554 554
@@ -557,7 +557,7 @@ static int wm8958_put_vss_enum(struct snd_kcontrol *kcontrol,
557 if (reg < 0 || reg & WM8958_DSP2CLK_ENA) 557 if (reg < 0 || reg & WM8958_DSP2CLK_ENA)
558 return -EBUSY; 558 return -EBUSY;
559 559
560 if (value >= pdata->num_vss_cfgs) 560 if (value >= control->pdata.num_vss_cfgs)
561 return -EINVAL; 561 return -EINVAL;
562 562
563 wm8994->vss_cfg = value; 563 wm8994->vss_cfg = value;
@@ -581,7 +581,7 @@ static int wm8958_put_vss_hpf_enum(struct snd_kcontrol *kcontrol,
581{ 581{
582 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 582 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
583 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); 583 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
584 struct wm8994_pdata *pdata = wm8994->pdata; 584 struct wm8994 *control = wm8994->wm8994;
585 int value = ucontrol->value.integer.value[0]; 585 int value = ucontrol->value.integer.value[0];
586 int reg; 586 int reg;
587 587
@@ -590,7 +590,7 @@ static int wm8958_put_vss_hpf_enum(struct snd_kcontrol *kcontrol,
590 if (reg < 0 || reg & WM8958_DSP2CLK_ENA) 590 if (reg < 0 || reg & WM8958_DSP2CLK_ENA)
591 return -EBUSY; 591 return -EBUSY;
592 592
593 if (value >= pdata->num_vss_hpf_cfgs) 593 if (value >= control->pdata.num_vss_hpf_cfgs)
594 return -EINVAL; 594 return -EINVAL;
595 595
596 wm8994->vss_hpf_cfg = value; 596 wm8994->vss_hpf_cfg = value;
@@ -748,7 +748,7 @@ static int wm8958_put_enh_eq_enum(struct snd_kcontrol *kcontrol,
748{ 748{
749 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 749 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
750 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); 750 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
751 struct wm8994_pdata *pdata = wm8994->pdata; 751 struct wm8994 *control = wm8994->wm8994;
752 int value = ucontrol->value.integer.value[0]; 752 int value = ucontrol->value.integer.value[0];
753 int reg; 753 int reg;
754 754
@@ -757,7 +757,7 @@ static int wm8958_put_enh_eq_enum(struct snd_kcontrol *kcontrol,
757 if (reg < 0 || reg & WM8958_DSP2CLK_ENA) 757 if (reg < 0 || reg & WM8958_DSP2CLK_ENA)
758 return -EBUSY; 758 return -EBUSY;
759 759
760 if (value >= pdata->num_enh_eq_cfgs) 760 if (value >= control->pdata.num_enh_eq_cfgs)
761 return -EINVAL; 761 return -EINVAL;
762 762
763 wm8994->enh_eq_cfg = value; 763 wm8994->enh_eq_cfg = value;
@@ -883,13 +883,6 @@ static void wm8958_mbc_vss_loaded(const struct firmware *fw, void *context)
883 wm8994->mbc_vss = fw; 883 wm8994->mbc_vss = fw;
884 mutex_unlock(&codec->mutex); 884 mutex_unlock(&codec->mutex);
885 } 885 }
886
887 /* We can't have more than one request outstanding at once so
888 * we daisy chain.
889 */
890 request_firmware_nowait(THIS_MODULE, FW_ACTION_HOTPLUG,
891 "wm8958_enh_eq.wfw", codec->dev, GFP_KERNEL,
892 codec, wm8958_enh_eq_loaded);
893} 886}
894 887
895static void wm8958_mbc_loaded(const struct firmware *fw, void *context) 888static void wm8958_mbc_loaded(const struct firmware *fw, void *context)
@@ -897,25 +890,18 @@ static void wm8958_mbc_loaded(const struct firmware *fw, void *context)
897 struct snd_soc_codec *codec = context; 890 struct snd_soc_codec *codec = context;
898 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); 891 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
899 892
900 if (wm8958_dsp2_fw(codec, "MBC", fw, true) != 0) 893 if (fw && (wm8958_dsp2_fw(codec, "MBC", fw, true) == 0)) {
901 return; 894 mutex_lock(&codec->mutex);
902 895 wm8994->mbc = fw;
903 mutex_lock(&codec->mutex); 896 mutex_unlock(&codec->mutex);
904 wm8994->mbc = fw; 897 }
905 mutex_unlock(&codec->mutex);
906
907 /* We can't have more than one request outstanding at once so
908 * we daisy chain.
909 */
910 request_firmware_nowait(THIS_MODULE, FW_ACTION_HOTPLUG,
911 "wm8958_mbc_vss.wfw", codec->dev, GFP_KERNEL,
912 codec, wm8958_mbc_vss_loaded);
913} 898}
914 899
915void wm8958_dsp2_init(struct snd_soc_codec *codec) 900void wm8958_dsp2_init(struct snd_soc_codec *codec)
916{ 901{
917 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); 902 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
918 struct wm8994_pdata *pdata = wm8994->pdata; 903 struct wm8994 *control = wm8994->wm8994;
904 struct wm8994_pdata *pdata = &control->pdata;
919 int ret, i; 905 int ret, i;
920 906
921 wm8994->dsp_active = -1; 907 wm8994->dsp_active = -1;
@@ -932,9 +918,12 @@ void wm8958_dsp2_init(struct snd_soc_codec *codec)
932 request_firmware_nowait(THIS_MODULE, FW_ACTION_HOTPLUG, 918 request_firmware_nowait(THIS_MODULE, FW_ACTION_HOTPLUG,
933 "wm8958_mbc.wfw", codec->dev, GFP_KERNEL, 919 "wm8958_mbc.wfw", codec->dev, GFP_KERNEL,
934 codec, wm8958_mbc_loaded); 920 codec, wm8958_mbc_loaded);
935 921 request_firmware_nowait(THIS_MODULE, FW_ACTION_HOTPLUG,
936 if (!pdata) 922 "wm8958_mbc_vss.wfw", codec->dev, GFP_KERNEL,
937 return; 923 codec, wm8958_mbc_vss_loaded);
924 request_firmware_nowait(THIS_MODULE, FW_ACTION_HOTPLUG,
925 "wm8958_enh_eq.wfw", codec->dev, GFP_KERNEL,
926 codec, wm8958_enh_eq_loaded);
938 927
939 if (pdata->num_mbc_cfgs) { 928 if (pdata->num_mbc_cfgs) {
940 struct snd_kcontrol_new control[] = { 929 struct snd_kcontrol_new control[] = {
diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c
index f0f6f6601785..9bb927325993 100644
--- a/sound/soc/codecs/wm8960.c
+++ b/sound/soc/codecs/wm8960.c
@@ -1028,8 +1028,8 @@ static const struct regmap_config wm8960_regmap = {
1028 .volatile_reg = wm8960_volatile, 1028 .volatile_reg = wm8960_volatile,
1029}; 1029};
1030 1030
1031static __devinit int wm8960_i2c_probe(struct i2c_client *i2c, 1031static int wm8960_i2c_probe(struct i2c_client *i2c,
1032 const struct i2c_device_id *id) 1032 const struct i2c_device_id *id)
1033{ 1033{
1034 struct wm8960_data *pdata = dev_get_platdata(&i2c->dev); 1034 struct wm8960_data *pdata = dev_get_platdata(&i2c->dev);
1035 struct wm8960_priv *wm8960; 1035 struct wm8960_priv *wm8960;
@@ -1040,7 +1040,7 @@ static __devinit int wm8960_i2c_probe(struct i2c_client *i2c,
1040 if (wm8960 == NULL) 1040 if (wm8960 == NULL)
1041 return -ENOMEM; 1041 return -ENOMEM;
1042 1042
1043 wm8960->regmap = regmap_init_i2c(i2c, &wm8960_regmap); 1043 wm8960->regmap = devm_regmap_init_i2c(i2c, &wm8960_regmap);
1044 if (IS_ERR(wm8960->regmap)) 1044 if (IS_ERR(wm8960->regmap))
1045 return PTR_ERR(wm8960->regmap); 1045 return PTR_ERR(wm8960->regmap);
1046 1046
@@ -1062,7 +1062,7 @@ static __devinit int wm8960_i2c_probe(struct i2c_client *i2c,
1062 return ret; 1062 return ret;
1063} 1063}
1064 1064
1065static __devexit int wm8960_i2c_remove(struct i2c_client *client) 1065static int wm8960_i2c_remove(struct i2c_client *client)
1066{ 1066{
1067 snd_soc_unregister_codec(&client->dev); 1067 snd_soc_unregister_codec(&client->dev);
1068 return 0; 1068 return 0;
@@ -1080,7 +1080,7 @@ static struct i2c_driver wm8960_i2c_driver = {
1080 .owner = THIS_MODULE, 1080 .owner = THIS_MODULE,
1081 }, 1081 },
1082 .probe = wm8960_i2c_probe, 1082 .probe = wm8960_i2c_probe,
1083 .remove = __devexit_p(wm8960_i2c_remove), 1083 .remove = wm8960_i2c_remove,
1084 .id_table = wm8960_i2c_id, 1084 .id_table = wm8960_i2c_id,
1085}; 1085};
1086 1086
diff --git a/sound/soc/codecs/wm8961.c b/sound/soc/codecs/wm8961.c
index f387670d0d75..900328e28a15 100644
--- a/sound/soc/codecs/wm8961.c
+++ b/sound/soc/codecs/wm8961.c
@@ -937,8 +937,8 @@ static const struct regmap_config wm8961_regmap = {
937 .readable_reg = wm8961_readable, 937 .readable_reg = wm8961_readable,
938}; 938};
939 939
940static __devinit int wm8961_i2c_probe(struct i2c_client *i2c, 940static int wm8961_i2c_probe(struct i2c_client *i2c,
941 const struct i2c_device_id *id) 941 const struct i2c_device_id *id)
942{ 942{
943 struct wm8961_priv *wm8961; 943 struct wm8961_priv *wm8961;
944 unsigned int val; 944 unsigned int val;
@@ -993,7 +993,7 @@ static __devinit int wm8961_i2c_probe(struct i2c_client *i2c,
993 return ret; 993 return ret;
994} 994}
995 995
996static __devexit int wm8961_i2c_remove(struct i2c_client *client) 996static int wm8961_i2c_remove(struct i2c_client *client)
997{ 997{
998 snd_soc_unregister_codec(&client->dev); 998 snd_soc_unregister_codec(&client->dev);
999 999
@@ -1012,7 +1012,7 @@ static struct i2c_driver wm8961_i2c_driver = {
1012 .owner = THIS_MODULE, 1012 .owner = THIS_MODULE,
1013 }, 1013 },
1014 .probe = wm8961_i2c_probe, 1014 .probe = wm8961_i2c_probe,
1015 .remove = __devexit_p(wm8961_i2c_remove), 1015 .remove = wm8961_i2c_remove,
1016 .id_table = wm8961_i2c_id, 1016 .id_table = wm8961_i2c_id,
1017}; 1017};
1018 1018
diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c
index ce6720073798..bd4b0db4cdaa 100644
--- a/sound/soc/codecs/wm8962.c
+++ b/sound/soc/codecs/wm8962.c
@@ -3588,8 +3588,8 @@ static const struct regmap_config wm8962_regmap = {
3588 .cache_type = REGCACHE_RBTREE, 3588 .cache_type = REGCACHE_RBTREE,
3589}; 3589};
3590 3590
3591static __devinit int wm8962_i2c_probe(struct i2c_client *i2c, 3591static int wm8962_i2c_probe(struct i2c_client *i2c,
3592 const struct i2c_device_id *id) 3592 const struct i2c_device_id *id)
3593{ 3593{
3594 struct wm8962_pdata *pdata = dev_get_platdata(&i2c->dev); 3594 struct wm8962_pdata *pdata = dev_get_platdata(&i2c->dev);
3595 struct wm8962_priv *wm8962; 3595 struct wm8962_priv *wm8962;
@@ -3610,7 +3610,7 @@ static __devinit int wm8962_i2c_probe(struct i2c_client *i2c,
3610 for (i = 0; i < ARRAY_SIZE(wm8962->supplies); i++) 3610 for (i = 0; i < ARRAY_SIZE(wm8962->supplies); i++)
3611 wm8962->supplies[i].supply = wm8962_supply_names[i]; 3611 wm8962->supplies[i].supply = wm8962_supply_names[i];
3612 3612
3613 ret = regulator_bulk_get(&i2c->dev, ARRAY_SIZE(wm8962->supplies), 3613 ret = devm_regulator_bulk_get(&i2c->dev, ARRAY_SIZE(wm8962->supplies),
3614 wm8962->supplies); 3614 wm8962->supplies);
3615 if (ret != 0) { 3615 if (ret != 0) {
3616 dev_err(&i2c->dev, "Failed to request supplies: %d\n", ret); 3616 dev_err(&i2c->dev, "Failed to request supplies: %d\n", ret);
@@ -3621,10 +3621,10 @@ static __devinit int wm8962_i2c_probe(struct i2c_client *i2c,
3621 wm8962->supplies); 3621 wm8962->supplies);
3622 if (ret != 0) { 3622 if (ret != 0) {
3623 dev_err(&i2c->dev, "Failed to enable supplies: %d\n", ret); 3623 dev_err(&i2c->dev, "Failed to enable supplies: %d\n", ret);
3624 goto err_get; 3624 return ret;
3625 } 3625 }
3626 3626
3627 wm8962->regmap = regmap_init_i2c(i2c, &wm8962_regmap); 3627 wm8962->regmap = devm_regmap_init_i2c(i2c, &wm8962_regmap);
3628 if (IS_ERR(wm8962->regmap)) { 3628 if (IS_ERR(wm8962->regmap)) {
3629 ret = PTR_ERR(wm8962->regmap); 3629 ret = PTR_ERR(wm8962->regmap);
3630 dev_err(&i2c->dev, "Failed to allocate regmap: %d\n", ret); 3630 dev_err(&i2c->dev, "Failed to allocate regmap: %d\n", ret);
@@ -3641,20 +3641,20 @@ static __devinit int wm8962_i2c_probe(struct i2c_client *i2c,
3641 ret = regmap_read(wm8962->regmap, WM8962_SOFTWARE_RESET, &reg); 3641 ret = regmap_read(wm8962->regmap, WM8962_SOFTWARE_RESET, &reg);
3642 if (ret < 0) { 3642 if (ret < 0) {
3643 dev_err(&i2c->dev, "Failed to read ID register\n"); 3643 dev_err(&i2c->dev, "Failed to read ID register\n");
3644 goto err_regmap; 3644 goto err_enable;
3645 } 3645 }
3646 if (reg != 0x6243) { 3646 if (reg != 0x6243) {
3647 dev_err(&i2c->dev, 3647 dev_err(&i2c->dev,
3648 "Device is not a WM8962, ID %x != 0x6243\n", reg); 3648 "Device is not a WM8962, ID %x != 0x6243\n", reg);
3649 ret = -EINVAL; 3649 ret = -EINVAL;
3650 goto err_regmap; 3650 goto err_enable;
3651 } 3651 }
3652 3652
3653 ret = regmap_read(wm8962->regmap, WM8962_RIGHT_INPUT_VOLUME, &reg); 3653 ret = regmap_read(wm8962->regmap, WM8962_RIGHT_INPUT_VOLUME, &reg);
3654 if (ret < 0) { 3654 if (ret < 0) {
3655 dev_err(&i2c->dev, "Failed to read device revision: %d\n", 3655 dev_err(&i2c->dev, "Failed to read device revision: %d\n",
3656 ret); 3656 ret);
3657 goto err_regmap; 3657 goto err_enable;
3658 } 3658 }
3659 3659
3660 dev_info(&i2c->dev, "customer id %x revision %c\n", 3660 dev_info(&i2c->dev, "customer id %x revision %c\n",
@@ -3667,7 +3667,7 @@ static __devinit int wm8962_i2c_probe(struct i2c_client *i2c,
3667 ret = wm8962_reset(wm8962); 3667 ret = wm8962_reset(wm8962);
3668 if (ret < 0) { 3668 if (ret < 0) {
3669 dev_err(&i2c->dev, "Failed to issue reset\n"); 3669 dev_err(&i2c->dev, "Failed to issue reset\n");
3670 goto err_regmap; 3670 goto err_enable;
3671 } 3671 }
3672 3672
3673 if (pdata && pdata->in4_dc_measure) { 3673 if (pdata && pdata->in4_dc_measure) {
@@ -3686,30 +3686,22 @@ static __devinit int wm8962_i2c_probe(struct i2c_client *i2c,
3686 ret = snd_soc_register_codec(&i2c->dev, 3686 ret = snd_soc_register_codec(&i2c->dev,
3687 &soc_codec_dev_wm8962, &wm8962_dai, 1); 3687 &soc_codec_dev_wm8962, &wm8962_dai, 1);
3688 if (ret < 0) 3688 if (ret < 0)
3689 goto err_regmap; 3689 goto err_enable;
3690 3690
3691 /* The drivers should power up as needed */ 3691 /* The drivers should power up as needed */
3692 regulator_bulk_disable(ARRAY_SIZE(wm8962->supplies), wm8962->supplies); 3692 regulator_bulk_disable(ARRAY_SIZE(wm8962->supplies), wm8962->supplies);
3693 3693
3694 return 0; 3694 return 0;
3695 3695
3696err_regmap:
3697 regmap_exit(wm8962->regmap);
3698err_enable: 3696err_enable:
3699 regulator_bulk_disable(ARRAY_SIZE(wm8962->supplies), wm8962->supplies); 3697 regulator_bulk_disable(ARRAY_SIZE(wm8962->supplies), wm8962->supplies);
3700err_get:
3701 regulator_bulk_free(ARRAY_SIZE(wm8962->supplies), wm8962->supplies);
3702err: 3698err:
3703 return ret; 3699 return ret;
3704} 3700}
3705 3701
3706static __devexit int wm8962_i2c_remove(struct i2c_client *client) 3702static int wm8962_i2c_remove(struct i2c_client *client)
3707{ 3703{
3708 struct wm8962_priv *wm8962 = dev_get_drvdata(&client->dev);
3709
3710 snd_soc_unregister_codec(&client->dev); 3704 snd_soc_unregister_codec(&client->dev);
3711 regmap_exit(wm8962->regmap);
3712 regulator_bulk_free(ARRAY_SIZE(wm8962->supplies), wm8962->supplies);
3713 return 0; 3705 return 0;
3714} 3706}
3715 3707
@@ -3773,7 +3765,7 @@ static struct i2c_driver wm8962_i2c_driver = {
3773 .pm = &wm8962_pm, 3765 .pm = &wm8962_pm,
3774 }, 3766 },
3775 .probe = wm8962_i2c_probe, 3767 .probe = wm8962_i2c_probe,
3776 .remove = __devexit_p(wm8962_i2c_remove), 3768 .remove = wm8962_i2c_remove,
3777 .id_table = wm8962_i2c_id, 3769 .id_table = wm8962_i2c_id,
3778}; 3770};
3779 3771
diff --git a/sound/soc/codecs/wm8971.c b/sound/soc/codecs/wm8971.c
index 5ce647758443..67aba78a7ca5 100644
--- a/sound/soc/codecs/wm8971.c
+++ b/sound/soc/codecs/wm8971.c
@@ -19,6 +19,7 @@
19#include <linux/delay.h> 19#include <linux/delay.h>
20#include <linux/pm.h> 20#include <linux/pm.h>
21#include <linux/i2c.h> 21#include <linux/i2c.h>
22#include <linux/regmap.h>
22#include <linux/slab.h> 23#include <linux/slab.h>
23#include <sound/core.h> 24#include <sound/core.h>
24#include <sound/pcm.h> 25#include <sound/pcm.h>
@@ -34,7 +35,6 @@ static struct workqueue_struct *wm8971_workq = NULL;
34 35
35/* codec private data */ 36/* codec private data */
36struct wm8971_priv { 37struct wm8971_priv {
37 enum snd_soc_control_type control_type;
38 unsigned int sysclk; 38 unsigned int sysclk;
39}; 39};
40 40
@@ -43,18 +43,50 @@ struct wm8971_priv {
43 * We can't read the WM8971 register space when we 43 * We can't read the WM8971 register space when we
44 * are using 2 wire for device control, so we cache them instead. 44 * are using 2 wire for device control, so we cache them instead.
45 */ 45 */
46static const u16 wm8971_reg[] = { 46static const struct reg_default wm8971_reg_defaults[] = {
47 0x0097, 0x0097, 0x0079, 0x0079, /* 0 */ 47 { 0, 0x0097 },
48 0x0000, 0x0008, 0x0000, 0x000a, /* 4 */ 48 { 1, 0x0097 },
49 0x0000, 0x0000, 0x00ff, 0x00ff, /* 8 */ 49 { 2, 0x0079 },
50 0x000f, 0x000f, 0x0000, 0x0000, /* 12 */ 50 { 3, 0x0079 },
51 0x0000, 0x007b, 0x0000, 0x0032, /* 16 */ 51 { 4, 0x0000 },
52 0x0000, 0x00c3, 0x00c3, 0x00c0, /* 20 */ 52 { 5, 0x0008 },
53 0x0000, 0x0000, 0x0000, 0x0000, /* 24 */ 53 { 6, 0x0000 },
54 0x0000, 0x0000, 0x0000, 0x0000, /* 28 */ 54 { 7, 0x000a },
55 0x0000, 0x0000, 0x0050, 0x0050, /* 32 */ 55 { 8, 0x0000 },
56 0x0050, 0x0050, 0x0050, 0x0050, /* 36 */ 56 { 9, 0x0000 },
57 0x0079, 0x0079, 0x0079, /* 40 */ 57 { 10, 0x00ff },
58 { 11, 0x00ff },
59 { 12, 0x000f },
60 { 13, 0x000f },
61 { 14, 0x0000 },
62 { 15, 0x0000 },
63 { 16, 0x0000 },
64 { 17, 0x007b },
65 { 18, 0x0000 },
66 { 19, 0x0032 },
67 { 20, 0x0000 },
68 { 21, 0x00c3 },
69 { 22, 0x00c3 },
70 { 23, 0x00c0 },
71 { 24, 0x0000 },
72 { 25, 0x0000 },
73 { 26, 0x0000 },
74 { 27, 0x0000 },
75 { 28, 0x0000 },
76 { 29, 0x0000 },
77 { 30, 0x0000 },
78 { 31, 0x0000 },
79 { 32, 0x0000 },
80 { 33, 0x0000 },
81 { 34, 0x0050 },
82 { 35, 0x0050 },
83 { 36, 0x0050 },
84 { 37, 0x0050 },
85 { 38, 0x0050 },
86 { 39, 0x0050 },
87 { 40, 0x0079 },
88 { 41, 0x0079 },
89 { 42, 0x0079 },
58}; 90};
59 91
60#define wm8971_reset(c) snd_soc_write(c, WM8971_RESET, 0) 92#define wm8971_reset(c) snd_soc_write(c, WM8971_RESET, 0)
@@ -613,11 +645,10 @@ static int wm8971_resume(struct snd_soc_codec *codec)
613 645
614static int wm8971_probe(struct snd_soc_codec *codec) 646static int wm8971_probe(struct snd_soc_codec *codec)
615{ 647{
616 struct wm8971_priv *wm8971 = snd_soc_codec_get_drvdata(codec);
617 int ret = 0; 648 int ret = 0;
618 u16 reg; 649 u16 reg;
619 650
620 ret = snd_soc_codec_set_cache_io(codec, 7, 9, wm8971->control_type); 651 ret = snd_soc_codec_set_cache_io(codec, 7, 9, SND_SOC_REGMAP);
621 if (ret < 0) { 652 if (ret < 0) {
622 printk(KERN_ERR "wm8971: failed to set cache I/O: %d\n", ret); 653 printk(KERN_ERR "wm8971: failed to set cache I/O: %d\n", ret);
623 return ret; 654 return ret;
@@ -667,9 +698,6 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8971 = {
667 .suspend = wm8971_suspend, 698 .suspend = wm8971_suspend,
668 .resume = wm8971_resume, 699 .resume = wm8971_resume,
669 .set_bias_level = wm8971_set_bias_level, 700 .set_bias_level = wm8971_set_bias_level,
670 .reg_cache_size = ARRAY_SIZE(wm8971_reg),
671 .reg_word_size = sizeof(u16),
672 .reg_cache_default = wm8971_reg,
673 701
674 .controls = wm8971_snd_controls, 702 .controls = wm8971_snd_controls,
675 .num_controls = ARRAY_SIZE(wm8971_snd_controls), 703 .num_controls = ARRAY_SIZE(wm8971_snd_controls),
@@ -679,10 +707,21 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8971 = {
679 .num_dapm_routes = ARRAY_SIZE(wm8971_dapm_routes), 707 .num_dapm_routes = ARRAY_SIZE(wm8971_dapm_routes),
680}; 708};
681 709
682static __devinit int wm8971_i2c_probe(struct i2c_client *i2c, 710static const struct regmap_config wm8971_regmap = {
683 const struct i2c_device_id *id) 711 .reg_bits = 7,
712 .val_bits = 9,
713 .max_register = WM8971_MOUTV,
714
715 .reg_defaults = wm8971_reg_defaults,
716 .num_reg_defaults = ARRAY_SIZE(wm8971_reg_defaults),
717 .cache_type = REGCACHE_RBTREE,
718};
719
720static int wm8971_i2c_probe(struct i2c_client *i2c,
721 const struct i2c_device_id *id)
684{ 722{
685 struct wm8971_priv *wm8971; 723 struct wm8971_priv *wm8971;
724 struct regmap *regmap;
686 int ret; 725 int ret;
687 726
688 wm8971 = devm_kzalloc(&i2c->dev, sizeof(struct wm8971_priv), 727 wm8971 = devm_kzalloc(&i2c->dev, sizeof(struct wm8971_priv),
@@ -690,7 +729,10 @@ static __devinit int wm8971_i2c_probe(struct i2c_client *i2c,
690 if (wm8971 == NULL) 729 if (wm8971 == NULL)
691 return -ENOMEM; 730 return -ENOMEM;
692 731
693 wm8971->control_type = SND_SOC_I2C; 732 regmap = devm_regmap_init_i2c(i2c, &wm8971_regmap);
733 if (IS_ERR(regmap))
734 return PTR_ERR(regmap);
735
694 i2c_set_clientdata(i2c, wm8971); 736 i2c_set_clientdata(i2c, wm8971);
695 737
696 ret = snd_soc_register_codec(&i2c->dev, 738 ret = snd_soc_register_codec(&i2c->dev,
@@ -699,7 +741,7 @@ static __devinit int wm8971_i2c_probe(struct i2c_client *i2c,
699 return ret; 741 return ret;
700} 742}
701 743
702static __devexit int wm8971_i2c_remove(struct i2c_client *client) 744static int wm8971_i2c_remove(struct i2c_client *client)
703{ 745{
704 snd_soc_unregister_codec(&client->dev); 746 snd_soc_unregister_codec(&client->dev);
705 return 0; 747 return 0;
@@ -717,7 +759,7 @@ static struct i2c_driver wm8971_i2c_driver = {
717 .owner = THIS_MODULE, 759 .owner = THIS_MODULE,
718 }, 760 },
719 .probe = wm8971_i2c_probe, 761 .probe = wm8971_i2c_probe,
720 .remove = __devexit_p(wm8971_i2c_remove), 762 .remove = wm8971_i2c_remove,
721 .id_table = wm8971_i2c_id, 763 .id_table = wm8971_i2c_id,
722}; 764};
723 765
diff --git a/sound/soc/codecs/wm8974.c b/sound/soc/codecs/wm8974.c
index 9a39511af52a..ea58b73e86b2 100644
--- a/sound/soc/codecs/wm8974.c
+++ b/sound/soc/codecs/wm8974.c
@@ -625,8 +625,8 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8974 = {
625 .num_dapm_routes = ARRAY_SIZE(wm8974_dapm_routes), 625 .num_dapm_routes = ARRAY_SIZE(wm8974_dapm_routes),
626}; 626};
627 627
628static __devinit int wm8974_i2c_probe(struct i2c_client *i2c, 628static int wm8974_i2c_probe(struct i2c_client *i2c,
629 const struct i2c_device_id *id) 629 const struct i2c_device_id *id)
630{ 630{
631 int ret; 631 int ret;
632 632
@@ -636,7 +636,7 @@ static __devinit int wm8974_i2c_probe(struct i2c_client *i2c,
636 return ret; 636 return ret;
637} 637}
638 638
639static __devexit int wm8974_i2c_remove(struct i2c_client *client) 639static int wm8974_i2c_remove(struct i2c_client *client)
640{ 640{
641 snd_soc_unregister_codec(&client->dev); 641 snd_soc_unregister_codec(&client->dev);
642 642
@@ -655,7 +655,7 @@ static struct i2c_driver wm8974_i2c_driver = {
655 .owner = THIS_MODULE, 655 .owner = THIS_MODULE,
656 }, 656 },
657 .probe = wm8974_i2c_probe, 657 .probe = wm8974_i2c_probe,
658 .remove = __devexit_p(wm8974_i2c_remove), 658 .remove = wm8974_i2c_remove,
659 .id_table = wm8974_i2c_id, 659 .id_table = wm8974_i2c_id,
660}; 660};
661 661
diff --git a/sound/soc/codecs/wm8978.c b/sound/soc/codecs/wm8978.c
index 4c0a8e496131..f347af3a67c2 100644
--- a/sound/soc/codecs/wm8978.c
+++ b/sound/soc/codecs/wm8978.c
@@ -527,9 +527,6 @@ static int wm8978_configure_pll(struct snd_soc_codec *codec)
527 return idx; 527 return idx;
528 528
529 wm8978->mclk_idx = idx; 529 wm8978->mclk_idx = idx;
530
531 /* GPIO1 into default mode as input - before configuring PLL */
532 snd_soc_update_bits(codec, WM8978_GPIO_CONTROL, 7, 0);
533 } else { 530 } else {
534 return -EINVAL; 531 return -EINVAL;
535 } 532 }
@@ -1038,8 +1035,8 @@ static const struct regmap_config wm8978_regmap_config = {
1038 .num_reg_defaults = ARRAY_SIZE(wm8978_reg_defaults), 1035 .num_reg_defaults = ARRAY_SIZE(wm8978_reg_defaults),
1039}; 1036};
1040 1037
1041static __devinit int wm8978_i2c_probe(struct i2c_client *i2c, 1038static int wm8978_i2c_probe(struct i2c_client *i2c,
1042 const struct i2c_device_id *id) 1039 const struct i2c_device_id *id)
1043{ 1040{
1044 struct wm8978_priv *wm8978; 1041 struct wm8978_priv *wm8978;
1045 int ret; 1042 int ret;
@@ -1049,7 +1046,7 @@ static __devinit int wm8978_i2c_probe(struct i2c_client *i2c,
1049 if (wm8978 == NULL) 1046 if (wm8978 == NULL)
1050 return -ENOMEM; 1047 return -ENOMEM;
1051 1048
1052 wm8978->regmap = regmap_init_i2c(i2c, &wm8978_regmap_config); 1049 wm8978->regmap = devm_regmap_init_i2c(i2c, &wm8978_regmap_config);
1053 if (IS_ERR(wm8978->regmap)) { 1050 if (IS_ERR(wm8978->regmap)) {
1054 ret = PTR_ERR(wm8978->regmap); 1051 ret = PTR_ERR(wm8978->regmap);
1055 dev_err(&i2c->dev, "Failed to allocate regmap: %d\n", ret); 1052 dev_err(&i2c->dev, "Failed to allocate regmap: %d\n", ret);
@@ -1062,29 +1059,22 @@ static __devinit int wm8978_i2c_probe(struct i2c_client *i2c,
1062 ret = regmap_write(wm8978->regmap, WM8978_RESET, 0); 1059 ret = regmap_write(wm8978->regmap, WM8978_RESET, 0);
1063 if (ret != 0) { 1060 if (ret != 0) {
1064 dev_err(&i2c->dev, "Failed to issue reset: %d\n", ret); 1061 dev_err(&i2c->dev, "Failed to issue reset: %d\n", ret);
1065 goto err; 1062 return ret;
1066 } 1063 }
1067 1064
1068 ret = snd_soc_register_codec(&i2c->dev, 1065 ret = snd_soc_register_codec(&i2c->dev,
1069 &soc_codec_dev_wm8978, &wm8978_dai, 1); 1066 &soc_codec_dev_wm8978, &wm8978_dai, 1);
1070 if (ret != 0) { 1067 if (ret != 0) {
1071 dev_err(&i2c->dev, "Failed to register CODEC: %d\n", ret); 1068 dev_err(&i2c->dev, "Failed to register CODEC: %d\n", ret);
1072 goto err; 1069 return ret;
1073 } 1070 }
1074 1071
1075 return 0; 1072 return 0;
1076
1077err:
1078 regmap_exit(wm8978->regmap);
1079 return ret;
1080} 1073}
1081 1074
1082static __devexit int wm8978_i2c_remove(struct i2c_client *client) 1075static int wm8978_i2c_remove(struct i2c_client *client)
1083{ 1076{
1084 struct wm8978_priv *wm8978 = i2c_get_clientdata(client);
1085
1086 snd_soc_unregister_codec(&client->dev); 1077 snd_soc_unregister_codec(&client->dev);
1087 regmap_exit(wm8978->regmap);
1088 1078
1089 return 0; 1079 return 0;
1090} 1080}
@@ -1101,7 +1091,7 @@ static struct i2c_driver wm8978_i2c_driver = {
1101 .owner = THIS_MODULE, 1091 .owner = THIS_MODULE,
1102 }, 1092 },
1103 .probe = wm8978_i2c_probe, 1093 .probe = wm8978_i2c_probe,
1104 .remove = __devexit_p(wm8978_i2c_remove), 1094 .remove = wm8978_i2c_remove,
1105 .id_table = wm8978_i2c_id, 1095 .id_table = wm8978_i2c_id,
1106}; 1096};
1107 1097
diff --git a/sound/soc/codecs/wm8983.c b/sound/soc/codecs/wm8983.c
index d8879f262d27..9fe1e041da49 100644
--- a/sound/soc/codecs/wm8983.c
+++ b/sound/soc/codecs/wm8983.c
@@ -1087,7 +1087,7 @@ static const struct regmap_config wm8983_regmap = {
1087}; 1087};
1088 1088
1089#if defined(CONFIG_SPI_MASTER) 1089#if defined(CONFIG_SPI_MASTER)
1090static int __devinit wm8983_spi_probe(struct spi_device *spi) 1090static int wm8983_spi_probe(struct spi_device *spi)
1091{ 1091{
1092 struct wm8983_priv *wm8983; 1092 struct wm8983_priv *wm8983;
1093 int ret; 1093 int ret;
@@ -1110,7 +1110,7 @@ static int __devinit wm8983_spi_probe(struct spi_device *spi)
1110 return ret; 1110 return ret;
1111} 1111}
1112 1112
1113static int __devexit wm8983_spi_remove(struct spi_device *spi) 1113static int wm8983_spi_remove(struct spi_device *spi)
1114{ 1114{
1115 snd_soc_unregister_codec(&spi->dev); 1115 snd_soc_unregister_codec(&spi->dev);
1116 return 0; 1116 return 0;
@@ -1122,13 +1122,13 @@ static struct spi_driver wm8983_spi_driver = {
1122 .owner = THIS_MODULE, 1122 .owner = THIS_MODULE,
1123 }, 1123 },
1124 .probe = wm8983_spi_probe, 1124 .probe = wm8983_spi_probe,
1125 .remove = __devexit_p(wm8983_spi_remove) 1125 .remove = wm8983_spi_remove
1126}; 1126};
1127#endif 1127#endif
1128 1128
1129#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) 1129#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
1130static __devinit int wm8983_i2c_probe(struct i2c_client *i2c, 1130static int wm8983_i2c_probe(struct i2c_client *i2c,
1131 const struct i2c_device_id *id) 1131 const struct i2c_device_id *id)
1132{ 1132{
1133 struct wm8983_priv *wm8983; 1133 struct wm8983_priv *wm8983;
1134 int ret; 1134 int ret;
@@ -1152,7 +1152,7 @@ static __devinit int wm8983_i2c_probe(struct i2c_client *i2c,
1152 return ret; 1152 return ret;
1153} 1153}
1154 1154
1155static __devexit int wm8983_i2c_remove(struct i2c_client *client) 1155static int wm8983_i2c_remove(struct i2c_client *client)
1156{ 1156{
1157 snd_soc_unregister_codec(&client->dev); 1157 snd_soc_unregister_codec(&client->dev);
1158 return 0; 1158 return 0;
@@ -1170,7 +1170,7 @@ static struct i2c_driver wm8983_i2c_driver = {
1170 .owner = THIS_MODULE, 1170 .owner = THIS_MODULE,
1171 }, 1171 },
1172 .probe = wm8983_i2c_probe, 1172 .probe = wm8983_i2c_probe,
1173 .remove = __devexit_p(wm8983_i2c_remove), 1173 .remove = wm8983_i2c_remove,
1174 .id_table = wm8983_i2c_id 1174 .id_table = wm8983_i2c_id
1175}; 1175};
1176#endif 1176#endif
diff --git a/sound/soc/codecs/wm8985.c b/sound/soc/codecs/wm8985.c
index 14f666398d0c..ab3782657ac8 100644
--- a/sound/soc/codecs/wm8985.c
+++ b/sound/soc/codecs/wm8985.c
@@ -1111,7 +1111,7 @@ static const struct regmap_config wm8985_regmap = {
1111}; 1111};
1112 1112
1113#if defined(CONFIG_SPI_MASTER) 1113#if defined(CONFIG_SPI_MASTER)
1114static int __devinit wm8985_spi_probe(struct spi_device *spi) 1114static int wm8985_spi_probe(struct spi_device *spi)
1115{ 1115{
1116 struct wm8985_priv *wm8985; 1116 struct wm8985_priv *wm8985;
1117 int ret; 1117 int ret;
@@ -1122,33 +1122,22 @@ static int __devinit wm8985_spi_probe(struct spi_device *spi)
1122 1122
1123 spi_set_drvdata(spi, wm8985); 1123 spi_set_drvdata(spi, wm8985);
1124 1124
1125 wm8985->regmap = regmap_init_spi(spi, &wm8985_regmap); 1125 wm8985->regmap = devm_regmap_init_spi(spi, &wm8985_regmap);
1126 if (IS_ERR(wm8985->regmap)) { 1126 if (IS_ERR(wm8985->regmap)) {
1127 ret = PTR_ERR(wm8985->regmap); 1127 ret = PTR_ERR(wm8985->regmap);
1128 dev_err(&spi->dev, "Failed to allocate register map: %d\n", 1128 dev_err(&spi->dev, "Failed to allocate register map: %d\n",
1129 ret); 1129 ret);
1130 goto err; 1130 return ret;
1131 } 1131 }
1132 1132
1133 ret = snd_soc_register_codec(&spi->dev, 1133 ret = snd_soc_register_codec(&spi->dev,
1134 &soc_codec_dev_wm8985, &wm8985_dai, 1); 1134 &soc_codec_dev_wm8985, &wm8985_dai, 1);
1135 if (ret != 0)
1136 goto err;
1137
1138 return 0;
1139
1140err:
1141 regmap_exit(wm8985->regmap);
1142 return ret; 1135 return ret;
1143} 1136}
1144 1137
1145static int __devexit wm8985_spi_remove(struct spi_device *spi) 1138static int wm8985_spi_remove(struct spi_device *spi)
1146{ 1139{
1147 struct wm8985_priv *wm8985 = spi_get_drvdata(spi);
1148
1149 snd_soc_unregister_codec(&spi->dev); 1140 snd_soc_unregister_codec(&spi->dev);
1150 regmap_exit(wm8985->regmap);
1151
1152 return 0; 1141 return 0;
1153} 1142}
1154 1143
@@ -1158,13 +1147,13 @@ static struct spi_driver wm8985_spi_driver = {
1158 .owner = THIS_MODULE, 1147 .owner = THIS_MODULE,
1159 }, 1148 },
1160 .probe = wm8985_spi_probe, 1149 .probe = wm8985_spi_probe,
1161 .remove = __devexit_p(wm8985_spi_remove) 1150 .remove = wm8985_spi_remove
1162}; 1151};
1163#endif 1152#endif
1164 1153
1165#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) 1154#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
1166static __devinit int wm8985_i2c_probe(struct i2c_client *i2c, 1155static int wm8985_i2c_probe(struct i2c_client *i2c,
1167 const struct i2c_device_id *id) 1156 const struct i2c_device_id *id)
1168{ 1157{
1169 struct wm8985_priv *wm8985; 1158 struct wm8985_priv *wm8985;
1170 int ret; 1159 int ret;
@@ -1175,33 +1164,22 @@ static __devinit int wm8985_i2c_probe(struct i2c_client *i2c,
1175 1164
1176 i2c_set_clientdata(i2c, wm8985); 1165 i2c_set_clientdata(i2c, wm8985);
1177 1166
1178 wm8985->regmap = regmap_init_i2c(i2c, &wm8985_regmap); 1167 wm8985->regmap = devm_regmap_init_i2c(i2c, &wm8985_regmap);
1179 if (IS_ERR(wm8985->regmap)) { 1168 if (IS_ERR(wm8985->regmap)) {
1180 ret = PTR_ERR(wm8985->regmap); 1169 ret = PTR_ERR(wm8985->regmap);
1181 dev_err(&i2c->dev, "Failed to allocate register map: %d\n", 1170 dev_err(&i2c->dev, "Failed to allocate register map: %d\n",
1182 ret); 1171 ret);
1183 goto err; 1172 return ret;
1184 } 1173 }
1185 1174
1186 ret = snd_soc_register_codec(&i2c->dev, 1175 ret = snd_soc_register_codec(&i2c->dev,
1187 &soc_codec_dev_wm8985, &wm8985_dai, 1); 1176 &soc_codec_dev_wm8985, &wm8985_dai, 1);
1188 if (ret != 0)
1189 goto err;
1190
1191 return 0;
1192
1193err:
1194 regmap_exit(wm8985->regmap);
1195 return ret; 1177 return ret;
1196} 1178}
1197 1179
1198static __devexit int wm8985_i2c_remove(struct i2c_client *i2c) 1180static int wm8985_i2c_remove(struct i2c_client *i2c)
1199{ 1181{
1200 struct wm8985_priv *wm8985 = i2c_get_clientdata(i2c);
1201
1202 snd_soc_unregister_codec(&i2c->dev); 1182 snd_soc_unregister_codec(&i2c->dev);
1203 regmap_exit(wm8985->regmap);
1204
1205 return 0; 1183 return 0;
1206} 1184}
1207 1185
@@ -1217,7 +1195,7 @@ static struct i2c_driver wm8985_i2c_driver = {
1217 .owner = THIS_MODULE, 1195 .owner = THIS_MODULE,
1218 }, 1196 },
1219 .probe = wm8985_i2c_probe, 1197 .probe = wm8985_i2c_probe,
1220 .remove = __devexit_p(wm8985_i2c_remove), 1198 .remove = wm8985_i2c_remove,
1221 .id_table = wm8985_i2c_id 1199 .id_table = wm8985_i2c_id
1222}; 1200};
1223#endif 1201#endif
diff --git a/sound/soc/codecs/wm8988.c b/sound/soc/codecs/wm8988.c
index 1d4c5cf47b06..39b9acceb595 100644
--- a/sound/soc/codecs/wm8988.c
+++ b/sound/soc/codecs/wm8988.c
@@ -872,7 +872,7 @@ static struct regmap_config wm8988_regmap = {
872}; 872};
873 873
874#if defined(CONFIG_SPI_MASTER) 874#if defined(CONFIG_SPI_MASTER)
875static int __devinit wm8988_spi_probe(struct spi_device *spi) 875static int wm8988_spi_probe(struct spi_device *spi)
876{ 876{
877 struct wm8988_priv *wm8988; 877 struct wm8988_priv *wm8988;
878 int ret; 878 int ret;
@@ -882,7 +882,7 @@ static int __devinit wm8988_spi_probe(struct spi_device *spi)
882 if (wm8988 == NULL) 882 if (wm8988 == NULL)
883 return -ENOMEM; 883 return -ENOMEM;
884 884
885 wm8988->regmap = regmap_init_spi(spi, &wm8988_regmap); 885 wm8988->regmap = devm_regmap_init_spi(spi, &wm8988_regmap);
886 if (IS_ERR(wm8988->regmap)) { 886 if (IS_ERR(wm8988->regmap)) {
887 ret = PTR_ERR(wm8988->regmap); 887 ret = PTR_ERR(wm8988->regmap);
888 dev_err(&spi->dev, "Failed to init regmap: %d\n", ret); 888 dev_err(&spi->dev, "Failed to init regmap: %d\n", ret);
@@ -893,17 +893,12 @@ static int __devinit wm8988_spi_probe(struct spi_device *spi)
893 893
894 ret = snd_soc_register_codec(&spi->dev, 894 ret = snd_soc_register_codec(&spi->dev,
895 &soc_codec_dev_wm8988, &wm8988_dai, 1); 895 &soc_codec_dev_wm8988, &wm8988_dai, 1);
896 if (ret != 0)
897 regmap_exit(wm8988->regmap);
898
899 return ret; 896 return ret;
900} 897}
901 898
902static int __devexit wm8988_spi_remove(struct spi_device *spi) 899static int wm8988_spi_remove(struct spi_device *spi)
903{ 900{
904 struct wm8988_priv *wm8988 = spi_get_drvdata(spi);
905 snd_soc_unregister_codec(&spi->dev); 901 snd_soc_unregister_codec(&spi->dev);
906 regmap_exit(wm8988->regmap);
907 return 0; 902 return 0;
908} 903}
909 904
@@ -913,13 +908,13 @@ static struct spi_driver wm8988_spi_driver = {
913 .owner = THIS_MODULE, 908 .owner = THIS_MODULE,
914 }, 909 },
915 .probe = wm8988_spi_probe, 910 .probe = wm8988_spi_probe,
916 .remove = __devexit_p(wm8988_spi_remove), 911 .remove = wm8988_spi_remove,
917}; 912};
918#endif /* CONFIG_SPI_MASTER */ 913#endif /* CONFIG_SPI_MASTER */
919 914
920#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) 915#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
921static __devinit int wm8988_i2c_probe(struct i2c_client *i2c, 916static int wm8988_i2c_probe(struct i2c_client *i2c,
922 const struct i2c_device_id *id) 917 const struct i2c_device_id *id)
923{ 918{
924 struct wm8988_priv *wm8988; 919 struct wm8988_priv *wm8988;
925 int ret; 920 int ret;
@@ -931,7 +926,7 @@ static __devinit int wm8988_i2c_probe(struct i2c_client *i2c,
931 926
932 i2c_set_clientdata(i2c, wm8988); 927 i2c_set_clientdata(i2c, wm8988);
933 928
934 wm8988->regmap = regmap_init_i2c(i2c, &wm8988_regmap); 929 wm8988->regmap = devm_regmap_init_i2c(i2c, &wm8988_regmap);
935 if (IS_ERR(wm8988->regmap)) { 930 if (IS_ERR(wm8988->regmap)) {
936 ret = PTR_ERR(wm8988->regmap); 931 ret = PTR_ERR(wm8988->regmap);
937 dev_err(&i2c->dev, "Failed to init regmap: %d\n", ret); 932 dev_err(&i2c->dev, "Failed to init regmap: %d\n", ret);
@@ -940,17 +935,12 @@ static __devinit int wm8988_i2c_probe(struct i2c_client *i2c,
940 935
941 ret = snd_soc_register_codec(&i2c->dev, 936 ret = snd_soc_register_codec(&i2c->dev,
942 &soc_codec_dev_wm8988, &wm8988_dai, 1); 937 &soc_codec_dev_wm8988, &wm8988_dai, 1);
943 if (ret != 0)
944 regmap_exit(wm8988->regmap);
945
946 return ret; 938 return ret;
947} 939}
948 940
949static __devexit int wm8988_i2c_remove(struct i2c_client *client) 941static int wm8988_i2c_remove(struct i2c_client *client)
950{ 942{
951 struct wm8988_priv *wm8988 = i2c_get_clientdata(client);
952 snd_soc_unregister_codec(&client->dev); 943 snd_soc_unregister_codec(&client->dev);
953 regmap_exit(wm8988->regmap);
954 return 0; 944 return 0;
955} 945}
956 946
@@ -966,7 +956,7 @@ static struct i2c_driver wm8988_i2c_driver = {
966 .owner = THIS_MODULE, 956 .owner = THIS_MODULE,
967 }, 957 },
968 .probe = wm8988_i2c_probe, 958 .probe = wm8988_i2c_probe,
969 .remove = __devexit_p(wm8988_i2c_remove), 959 .remove = wm8988_i2c_remove,
970 .id_table = wm8988_i2c_id, 960 .id_table = wm8988_i2c_id,
971}; 961};
972#endif 962#endif
diff --git a/sound/soc/codecs/wm8990.c b/sound/soc/codecs/wm8990.c
index c28c83e5395d..837978e16e9d 100644
--- a/sound/soc/codecs/wm8990.c
+++ b/sound/soc/codecs/wm8990.c
@@ -1382,8 +1382,8 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8990 = {
1382}; 1382};
1383 1383
1384#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) 1384#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
1385static __devinit int wm8990_i2c_probe(struct i2c_client *i2c, 1385static int wm8990_i2c_probe(struct i2c_client *i2c,
1386 const struct i2c_device_id *id) 1386 const struct i2c_device_id *id)
1387{ 1387{
1388 struct wm8990_priv *wm8990; 1388 struct wm8990_priv *wm8990;
1389 int ret; 1389 int ret;
@@ -1401,7 +1401,7 @@ static __devinit int wm8990_i2c_probe(struct i2c_client *i2c,
1401 return ret; 1401 return ret;
1402} 1402}
1403 1403
1404static __devexit int wm8990_i2c_remove(struct i2c_client *client) 1404static int wm8990_i2c_remove(struct i2c_client *client)
1405{ 1405{
1406 snd_soc_unregister_codec(&client->dev); 1406 snd_soc_unregister_codec(&client->dev);
1407 1407
@@ -1420,7 +1420,7 @@ static struct i2c_driver wm8990_i2c_driver = {
1420 .owner = THIS_MODULE, 1420 .owner = THIS_MODULE,
1421 }, 1421 },
1422 .probe = wm8990_i2c_probe, 1422 .probe = wm8990_i2c_probe,
1423 .remove = __devexit_p(wm8990_i2c_remove), 1423 .remove = wm8990_i2c_remove,
1424 .id_table = wm8990_i2c_id, 1424 .id_table = wm8990_i2c_id,
1425}; 1425};
1426#endif 1426#endif
diff --git a/sound/soc/codecs/wm8991.c b/sound/soc/codecs/wm8991.c
index fe439f027e10..3a39df7a3829 100644
--- a/sound/soc/codecs/wm8991.c
+++ b/sound/soc/codecs/wm8991.c
@@ -1357,8 +1357,8 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8991 = {
1357 .reg_cache_default = wm8991_reg_defs 1357 .reg_cache_default = wm8991_reg_defs
1358}; 1358};
1359 1359
1360static __devinit int wm8991_i2c_probe(struct i2c_client *i2c, 1360static int wm8991_i2c_probe(struct i2c_client *i2c,
1361 const struct i2c_device_id *id) 1361 const struct i2c_device_id *id)
1362{ 1362{
1363 struct wm8991_priv *wm8991; 1363 struct wm8991_priv *wm8991;
1364 int ret; 1364 int ret;
@@ -1376,7 +1376,7 @@ static __devinit int wm8991_i2c_probe(struct i2c_client *i2c,
1376 return ret; 1376 return ret;
1377} 1377}
1378 1378
1379static __devexit int wm8991_i2c_remove(struct i2c_client *client) 1379static int wm8991_i2c_remove(struct i2c_client *client)
1380{ 1380{
1381 snd_soc_unregister_codec(&client->dev); 1381 snd_soc_unregister_codec(&client->dev);
1382 1382
@@ -1395,7 +1395,7 @@ static struct i2c_driver wm8991_i2c_driver = {
1395 .owner = THIS_MODULE, 1395 .owner = THIS_MODULE,
1396 }, 1396 },
1397 .probe = wm8991_i2c_probe, 1397 .probe = wm8991_i2c_probe,
1398 .remove = __devexit_p(wm8991_i2c_remove), 1398 .remove = wm8991_i2c_remove,
1399 .id_table = wm8991_i2c_id, 1399 .id_table = wm8991_i2c_id,
1400}; 1400};
1401 1401
diff --git a/sound/soc/codecs/wm8993.c b/sound/soc/codecs/wm8993.c
index 94737a30716b..433d59a0f3ef 100644
--- a/sound/soc/codecs/wm8993.c
+++ b/sound/soc/codecs/wm8993.c
@@ -1645,8 +1645,8 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8993 = {
1645 .set_bias_level = wm8993_set_bias_level, 1645 .set_bias_level = wm8993_set_bias_level,
1646}; 1646};
1647 1647
1648static __devinit int wm8993_i2c_probe(struct i2c_client *i2c, 1648static int wm8993_i2c_probe(struct i2c_client *i2c,
1649 const struct i2c_device_id *id) 1649 const struct i2c_device_id *id)
1650{ 1650{
1651 struct wm8993_priv *wm8993; 1651 struct wm8993_priv *wm8993;
1652 unsigned int reg; 1652 unsigned int reg;
@@ -1660,7 +1660,7 @@ static __devinit int wm8993_i2c_probe(struct i2c_client *i2c,
1660 wm8993->dev = &i2c->dev; 1660 wm8993->dev = &i2c->dev;
1661 init_completion(&wm8993->fll_lock); 1661 init_completion(&wm8993->fll_lock);
1662 1662
1663 wm8993->regmap = regmap_init_i2c(i2c, &wm8993_regmap); 1663 wm8993->regmap = devm_regmap_init_i2c(i2c, &wm8993_regmap);
1664 if (IS_ERR(wm8993->regmap)) { 1664 if (IS_ERR(wm8993->regmap)) {
1665 ret = PTR_ERR(wm8993->regmap); 1665 ret = PTR_ERR(wm8993->regmap);
1666 dev_err(&i2c->dev, "Failed to allocate regmap: %d\n", ret); 1666 dev_err(&i2c->dev, "Failed to allocate regmap: %d\n", ret);
@@ -1672,18 +1672,18 @@ static __devinit int wm8993_i2c_probe(struct i2c_client *i2c,
1672 for (i = 0; i < ARRAY_SIZE(wm8993->supplies); i++) 1672 for (i = 0; i < ARRAY_SIZE(wm8993->supplies); i++)
1673 wm8993->supplies[i].supply = wm8993_supply_names[i]; 1673 wm8993->supplies[i].supply = wm8993_supply_names[i];
1674 1674
1675 ret = regulator_bulk_get(&i2c->dev, ARRAY_SIZE(wm8993->supplies), 1675 ret = devm_regulator_bulk_get(&i2c->dev, ARRAY_SIZE(wm8993->supplies),
1676 wm8993->supplies); 1676 wm8993->supplies);
1677 if (ret != 0) { 1677 if (ret != 0) {
1678 dev_err(&i2c->dev, "Failed to request supplies: %d\n", ret); 1678 dev_err(&i2c->dev, "Failed to request supplies: %d\n", ret);
1679 goto err; 1679 return ret;
1680 } 1680 }
1681 1681
1682 ret = regulator_bulk_enable(ARRAY_SIZE(wm8993->supplies), 1682 ret = regulator_bulk_enable(ARRAY_SIZE(wm8993->supplies),
1683 wm8993->supplies); 1683 wm8993->supplies);
1684 if (ret != 0) { 1684 if (ret != 0) {
1685 dev_err(&i2c->dev, "Failed to enable supplies: %d\n", ret); 1685 dev_err(&i2c->dev, "Failed to enable supplies: %d\n", ret);
1686 goto err_get; 1686 return ret;
1687 } 1687 }
1688 1688
1689 ret = regmap_read(wm8993->regmap, WM8993_SOFTWARE_RESET, &reg); 1689 ret = regmap_read(wm8993->regmap, WM8993_SOFTWARE_RESET, &reg);
@@ -1742,23 +1742,17 @@ err_irq:
1742 free_irq(i2c->irq, wm8993); 1742 free_irq(i2c->irq, wm8993);
1743err_enable: 1743err_enable:
1744 regulator_bulk_disable(ARRAY_SIZE(wm8993->supplies), wm8993->supplies); 1744 regulator_bulk_disable(ARRAY_SIZE(wm8993->supplies), wm8993->supplies);
1745err_get:
1746 regulator_bulk_free(ARRAY_SIZE(wm8993->supplies), wm8993->supplies);
1747err:
1748 regmap_exit(wm8993->regmap);
1749 return ret; 1745 return ret;
1750} 1746}
1751 1747
1752static __devexit int wm8993_i2c_remove(struct i2c_client *i2c) 1748static int wm8993_i2c_remove(struct i2c_client *i2c)
1753{ 1749{
1754 struct wm8993_priv *wm8993 = i2c_get_clientdata(i2c); 1750 struct wm8993_priv *wm8993 = i2c_get_clientdata(i2c);
1755 1751
1756 snd_soc_unregister_codec(&i2c->dev); 1752 snd_soc_unregister_codec(&i2c->dev);
1757 if (i2c->irq) 1753 if (i2c->irq)
1758 free_irq(i2c->irq, wm8993); 1754 free_irq(i2c->irq, wm8993);
1759 regmap_exit(wm8993->regmap);
1760 regulator_bulk_disable(ARRAY_SIZE(wm8993->supplies), wm8993->supplies); 1755 regulator_bulk_disable(ARRAY_SIZE(wm8993->supplies), wm8993->supplies);
1761 regulator_bulk_free(ARRAY_SIZE(wm8993->supplies), wm8993->supplies);
1762 1756
1763 return 0; 1757 return 0;
1764} 1758}
@@ -1775,7 +1769,7 @@ static struct i2c_driver wm8993_i2c_driver = {
1775 .owner = THIS_MODULE, 1769 .owner = THIS_MODULE,
1776 }, 1770 },
1777 .probe = wm8993_i2c_probe, 1771 .probe = wm8993_i2c_probe,
1778 .remove = __devexit_p(wm8993_i2c_remove), 1772 .remove = wm8993_i2c_remove,
1779 .id_table = wm8993_i2c_id, 1773 .id_table = wm8993_i2c_id,
1780}; 1774};
1781 1775
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
index b2b2b37131bd..3b269fa226bd 100644
--- a/sound/soc/codecs/wm8994.c
+++ b/sound/soc/codecs/wm8994.c
@@ -91,8 +91,6 @@ static int wm8994_retune_mobile_base[] = {
91 WM8994_AIF2_EQ_GAINS_1, 91 WM8994_AIF2_EQ_GAINS_1,
92}; 92};
93 93
94static void wm8958_default_micdet(u16 status, void *data);
95
96static const struct wm8958_micd_rate micdet_rates[] = { 94static const struct wm8958_micd_rate micdet_rates[] = {
97 { 32768, true, 1, 4 }, 95 { 32768, true, 1, 4 },
98 { 32768, false, 1, 1 }, 96 { 32768, false, 1, 1 },
@@ -110,15 +108,12 @@ static const struct wm8958_micd_rate jackdet_rates[] = {
110static void wm8958_micd_set_rate(struct snd_soc_codec *codec) 108static void wm8958_micd_set_rate(struct snd_soc_codec *codec)
111{ 109{
112 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); 110 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
111 struct wm8994 *control = wm8994->wm8994;
113 int best, i, sysclk, val; 112 int best, i, sysclk, val;
114 bool idle; 113 bool idle;
115 const struct wm8958_micd_rate *rates; 114 const struct wm8958_micd_rate *rates;
116 int num_rates; 115 int num_rates;
117 116
118 if (!(wm8994->pdata && wm8994->pdata->micd_rates) &&
119 wm8994->jack_cb != wm8958_default_micdet)
120 return;
121
122 idle = !wm8994->jack_mic; 117 idle = !wm8994->jack_mic;
123 118
124 sysclk = snd_soc_read(codec, WM8994_CLOCKING_1); 119 sysclk = snd_soc_read(codec, WM8994_CLOCKING_1);
@@ -127,9 +122,9 @@ static void wm8958_micd_set_rate(struct snd_soc_codec *codec)
127 else 122 else
128 sysclk = wm8994->aifclk[0]; 123 sysclk = wm8994->aifclk[0];
129 124
130 if (wm8994->pdata && wm8994->pdata->micd_rates) { 125 if (control->pdata.micd_rates) {
131 rates = wm8994->pdata->micd_rates; 126 rates = control->pdata.micd_rates;
132 num_rates = wm8994->pdata->num_micd_rates; 127 num_rates = control->pdata.num_micd_rates;
133 } else if (wm8994->jackdet) { 128 } else if (wm8994->jackdet) {
134 rates = jackdet_rates; 129 rates = jackdet_rates;
135 num_rates = ARRAY_SIZE(jackdet_rates); 130 num_rates = ARRAY_SIZE(jackdet_rates);
@@ -326,7 +321,8 @@ static int wm8994_put_drc_sw(struct snd_kcontrol *kcontrol,
326static void wm8994_set_drc(struct snd_soc_codec *codec, int drc) 321static void wm8994_set_drc(struct snd_soc_codec *codec, int drc)
327{ 322{
328 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); 323 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
329 struct wm8994_pdata *pdata = wm8994->pdata; 324 struct wm8994 *control = wm8994->wm8994;
325 struct wm8994_pdata *pdata = &control->pdata;
330 int base = wm8994_drc_base[drc]; 326 int base = wm8994_drc_base[drc];
331 int cfg = wm8994->drc_cfg[drc]; 327 int cfg = wm8994->drc_cfg[drc];
332 int save, i; 328 int save, i;
@@ -362,7 +358,8 @@ static int wm8994_put_drc_enum(struct snd_kcontrol *kcontrol,
362{ 358{
363 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 359 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
364 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); 360 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
365 struct wm8994_pdata *pdata = wm8994->pdata; 361 struct wm8994 *control = wm8994->wm8994;
362 struct wm8994_pdata *pdata = &control->pdata;
366 int drc = wm8994_get_drc(kcontrol->id.name); 363 int drc = wm8994_get_drc(kcontrol->id.name);
367 int value = ucontrol->value.integer.value[0]; 364 int value = ucontrol->value.integer.value[0];
368 365
@@ -394,7 +391,8 @@ static int wm8994_get_drc_enum(struct snd_kcontrol *kcontrol,
394static void wm8994_set_retune_mobile(struct snd_soc_codec *codec, int block) 391static void wm8994_set_retune_mobile(struct snd_soc_codec *codec, int block)
395{ 392{
396 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); 393 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
397 struct wm8994_pdata *pdata = wm8994->pdata; 394 struct wm8994 *control = wm8994->wm8994;
395 struct wm8994_pdata *pdata = &control->pdata;
398 int base = wm8994_retune_mobile_base[block]; 396 int base = wm8994_retune_mobile_base[block];
399 int iface, best, best_val, save, i, cfg; 397 int iface, best, best_val, save, i, cfg;
400 398
@@ -465,7 +463,8 @@ static int wm8994_put_retune_mobile_enum(struct snd_kcontrol *kcontrol,
465{ 463{
466 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol); 464 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
467 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); 465 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
468 struct wm8994_pdata *pdata = wm8994->pdata; 466 struct wm8994 *control = wm8994->wm8994;
467 struct wm8994_pdata *pdata = &control->pdata;
469 int block = wm8994_get_retune_mobile_block(kcontrol->id.name); 468 int block = wm8994_get_retune_mobile_block(kcontrol->id.name);
470 int value = ucontrol->value.integer.value[0]; 469 int value = ucontrol->value.integer.value[0];
471 470
@@ -736,7 +735,7 @@ static void wm1811_jackdet_set_mode(struct snd_soc_codec *codec, u16 mode)
736{ 735{
737 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); 736 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
738 737
739 if (!wm8994->jackdet || !wm8994->jack_cb) 738 if (!wm8994->jackdet || !wm8994->micdet[0].jack)
740 return; 739 return;
741 740
742 if (wm8994->active_refcount) 741 if (wm8994->active_refcount)
@@ -862,7 +861,7 @@ static void vmid_reference(struct snd_soc_codec *codec)
862 WM8994_BIAS_SRC | 861 WM8994_BIAS_SRC |
863 WM8994_STARTUP_BIAS_ENA | 862 WM8994_STARTUP_BIAS_ENA |
864 WM8994_VMID_BUF_ENA | 863 WM8994_VMID_BUF_ENA |
865 (0x3 << WM8994_VMID_RAMP_SHIFT)); 864 (0x2 << WM8994_VMID_RAMP_SHIFT));
866 865
867 /* Main bias enable, VMID=2x40k */ 866 /* Main bias enable, VMID=2x40k */
868 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_1, 867 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_1,
@@ -870,7 +869,7 @@ static void vmid_reference(struct snd_soc_codec *codec)
870 WM8994_VMID_SEL_MASK, 869 WM8994_VMID_SEL_MASK,
871 WM8994_BIAS_ENA | 0x2); 870 WM8994_BIAS_ENA | 0x2);
872 871
873 msleep(50); 872 msleep(300);
874 873
875 snd_soc_update_bits(codec, WM8994_ANTIPOP_2, 874 snd_soc_update_bits(codec, WM8994_ANTIPOP_2,
876 WM8994_VMID_RAMP_MASK | 875 WM8994_VMID_RAMP_MASK |
@@ -939,16 +938,10 @@ static void vmid_dereference(struct snd_soc_codec *codec)
939 WM8994_BIAS_SRC | 938 WM8994_BIAS_SRC |
940 WM8994_VMID_DISCH); 939 WM8994_VMID_DISCH);
941 940
942 switch (wm8994->vmid_mode) { 941 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_1,
943 case WM8994_VMID_FORCE: 942 WM8994_VMID_SEL_MASK, 0);
944 msleep(350);
945 break;
946 default:
947 break;
948 }
949 943
950 snd_soc_update_bits(codec, WM8994_ADDITIONAL_CONTROL, 944 msleep(400);
951 WM8994_VROI, WM8994_VROI);
952 945
953 /* Active discharge */ 946 /* Active discharge */
954 snd_soc_update_bits(codec, WM8994_ANTIPOP_1, 947 snd_soc_update_bits(codec, WM8994_ANTIPOP_1,
@@ -957,17 +950,12 @@ static void vmid_dereference(struct snd_soc_codec *codec)
957 WM8994_LINEOUT1_DISCH | 950 WM8994_LINEOUT1_DISCH |
958 WM8994_LINEOUT2_DISCH); 951 WM8994_LINEOUT2_DISCH);
959 952
960 msleep(150);
961
962 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_3, 953 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_3,
963 WM8994_LINEOUT1N_ENA | 954 WM8994_LINEOUT1N_ENA |
964 WM8994_LINEOUT1P_ENA | 955 WM8994_LINEOUT1P_ENA |
965 WM8994_LINEOUT2N_ENA | 956 WM8994_LINEOUT2N_ENA |
966 WM8994_LINEOUT2P_ENA, 0); 957 WM8994_LINEOUT2P_ENA, 0);
967 958
968 snd_soc_update_bits(codec, WM8994_ADDITIONAL_CONTROL,
969 WM8994_VROI, 0);
970
971 /* Switch off startup biases */ 959 /* Switch off startup biases */
972 snd_soc_update_bits(codec, WM8994_ANTIPOP_2, 960 snd_soc_update_bits(codec, WM8994_ANTIPOP_2,
973 WM8994_BIAS_SRC | 961 WM8994_BIAS_SRC |
@@ -976,10 +964,7 @@ static void vmid_dereference(struct snd_soc_codec *codec)
976 WM8994_VMID_RAMP_MASK, 0); 964 WM8994_VMID_RAMP_MASK, 0);
977 965
978 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_1, 966 snd_soc_update_bits(codec, WM8994_POWER_MANAGEMENT_1,
979 WM8994_BIAS_ENA | WM8994_VMID_SEL_MASK, 0); 967 WM8994_VMID_SEL_MASK, 0);
980
981 snd_soc_update_bits(codec, WM8994_ANTIPOP_2,
982 WM8994_VMID_RAMP_MASK, 0);
983 } 968 }
984 969
985 pm_runtime_put(codec->dev); 970 pm_runtime_put(codec->dev);
@@ -2277,6 +2262,18 @@ out:
2277 2262
2278 configure_clock(codec); 2263 configure_clock(codec);
2279 2264
2265 /*
2266 * If SYSCLK will be less than 50kHz adjust AIFnCLK dividers
2267 * for detection.
2268 */
2269 if (max(wm8994->aifclk[0], wm8994->aifclk[1]) < 50000) {
2270 dev_dbg(codec->dev, "Configuring AIFs for 128fs\n");
2271 snd_soc_update_bits(codec, WM8994_AIF1_RATE,
2272 WM8994_AIF1CLK_RATE_MASK, 0x1);
2273 snd_soc_update_bits(codec, WM8994_AIF2_RATE,
2274 WM8994_AIF2CLK_RATE_MASK, 0x1);
2275 }
2276
2280 return 0; 2277 return 0;
2281} 2278}
2282 2279
@@ -2365,6 +2362,18 @@ static int wm8994_set_dai_sysclk(struct snd_soc_dai *dai,
2365 2362
2366 configure_clock(codec); 2363 configure_clock(codec);
2367 2364
2365 /*
2366 * If SYSCLK will be less than 50kHz adjust AIFnCLK dividers
2367 * for detection.
2368 */
2369 if (max(wm8994->aifclk[0], wm8994->aifclk[1]) < 50000) {
2370 dev_dbg(codec->dev, "Configuring AIFs for 128fs\n");
2371 snd_soc_update_bits(codec, WM8994_AIF1_RATE,
2372 WM8994_AIF1CLK_RATE_MASK, 0x1);
2373 snd_soc_update_bits(codec, WM8994_AIF2_RATE,
2374 WM8994_AIF2CLK_RATE_MASK, 0x1);
2375 }
2376
2368 return 0; 2377 return 0;
2369} 2378}
2370 2379
@@ -3082,7 +3091,8 @@ static int wm8994_codec_resume(struct snd_soc_codec *codec)
3082static void wm8994_handle_retune_mobile_pdata(struct wm8994_priv *wm8994) 3091static void wm8994_handle_retune_mobile_pdata(struct wm8994_priv *wm8994)
3083{ 3092{
3084 struct snd_soc_codec *codec = wm8994->hubs.codec; 3093 struct snd_soc_codec *codec = wm8994->hubs.codec;
3085 struct wm8994_pdata *pdata = wm8994->pdata; 3094 struct wm8994 *control = wm8994->wm8994;
3095 struct wm8994_pdata *pdata = &control->pdata;
3086 struct snd_kcontrol_new controls[] = { 3096 struct snd_kcontrol_new controls[] = {
3087 SOC_ENUM_EXT("AIF1.1 EQ Mode", 3097 SOC_ENUM_EXT("AIF1.1 EQ Mode",
3088 wm8994->retune_mobile_enum, 3098 wm8994->retune_mobile_enum,
@@ -3149,7 +3159,8 @@ static void wm8994_handle_retune_mobile_pdata(struct wm8994_priv *wm8994)
3149static void wm8994_handle_pdata(struct wm8994_priv *wm8994) 3159static void wm8994_handle_pdata(struct wm8994_priv *wm8994)
3150{ 3160{
3151 struct snd_soc_codec *codec = wm8994->hubs.codec; 3161 struct snd_soc_codec *codec = wm8994->hubs.codec;
3152 struct wm8994_pdata *pdata = wm8994->pdata; 3162 struct wm8994 *control = wm8994->wm8994;
3163 struct wm8994_pdata *pdata = &control->pdata;
3153 int ret, i; 3164 int ret, i;
3154 3165
3155 if (!pdata) 3166 if (!pdata)
@@ -3389,38 +3400,80 @@ static irqreturn_t wm8994_mic_irq(int irq, void *data)
3389 return IRQ_HANDLED; 3400 return IRQ_HANDLED;
3390} 3401}
3391 3402
3392/* Default microphone detection handler for WM8958 - the user can 3403static void wm1811_micd_stop(struct snd_soc_codec *codec)
3393 * override this if they wish. 3404{
3394 */ 3405 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
3395static void wm8958_default_micdet(u16 status, void *data) 3406
3407 if (!wm8994->jackdet)
3408 return;
3409
3410 mutex_lock(&wm8994->accdet_lock);
3411
3412 snd_soc_update_bits(codec, WM8958_MIC_DETECT_1, WM8958_MICD_ENA, 0);
3413
3414 wm1811_jackdet_set_mode(codec, WM1811_JACKDET_MODE_JACK);
3415
3416 mutex_unlock(&wm8994->accdet_lock);
3417
3418 if (wm8994->wm8994->pdata.jd_ext_cap)
3419 snd_soc_dapm_disable_pin(&codec->dapm,
3420 "MICBIAS2");
3421}
3422
3423static void wm8958_button_det(struct snd_soc_codec *codec, u16 status)
3396{ 3424{
3397 struct snd_soc_codec *codec = data;
3398 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); 3425 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
3399 int report; 3426 int report;
3400 3427
3401 dev_dbg(codec->dev, "MICDET %x\n", status); 3428 report = 0;
3429 if (status & 0x4)
3430 report |= SND_JACK_BTN_0;
3431
3432 if (status & 0x8)
3433 report |= SND_JACK_BTN_1;
3434
3435 if (status & 0x10)
3436 report |= SND_JACK_BTN_2;
3437
3438 if (status & 0x20)
3439 report |= SND_JACK_BTN_3;
3440
3441 if (status & 0x40)
3442 report |= SND_JACK_BTN_4;
3443
3444 if (status & 0x80)
3445 report |= SND_JACK_BTN_5;
3446
3447 snd_soc_jack_report(wm8994->micdet[0].jack, report,
3448 wm8994->btn_mask);
3449}
3450
3451static void wm8958_mic_id(void *data, u16 status)
3452{
3453 struct snd_soc_codec *codec = data;
3454 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
3402 3455
3403 /* Either nothing present or just starting detection */ 3456 /* Either nothing present or just starting detection */
3404 if (!(status & WM8958_MICD_STS)) { 3457 if (!(status & WM8958_MICD_STS)) {
3405 if (!wm8994->jackdet) { 3458 /* If nothing present then clear our statuses */
3406 /* If nothing present then clear our statuses */ 3459 dev_dbg(codec->dev, "Detected open circuit\n");
3407 dev_dbg(codec->dev, "Detected open circuit\n"); 3460 wm8994->jack_mic = false;
3408 wm8994->jack_mic = false; 3461 wm8994->mic_detecting = true;
3409 wm8994->mic_detecting = true;
3410 3462
3411 wm8958_micd_set_rate(codec); 3463 wm1811_micd_stop(codec);
3412 3464
3413 snd_soc_jack_report(wm8994->micdet[0].jack, 0, 3465 wm8958_micd_set_rate(codec);
3414 wm8994->btn_mask | 3466
3415 SND_JACK_HEADSET); 3467 snd_soc_jack_report(wm8994->micdet[0].jack, 0,
3416 } 3468 wm8994->btn_mask |
3469 SND_JACK_HEADSET);
3417 return; 3470 return;
3418 } 3471 }
3419 3472
3420 /* If the measurement is showing a high impedence we've got a 3473 /* If the measurement is showing a high impedence we've got a
3421 * microphone. 3474 * microphone.
3422 */ 3475 */
3423 if (wm8994->mic_detecting && (status & 0x600)) { 3476 if (status & 0x600) {
3424 dev_dbg(codec->dev, "Detected microphone\n"); 3477 dev_dbg(codec->dev, "Detected microphone\n");
3425 3478
3426 wm8994->mic_detecting = false; 3479 wm8994->mic_detecting = false;
@@ -3433,64 +3486,67 @@ static void wm8958_default_micdet(u16 status, void *data)
3433 } 3486 }
3434 3487
3435 3488
3436 if (wm8994->mic_detecting && status & 0xfc) { 3489 if (status & 0xfc) {
3437 dev_dbg(codec->dev, "Detected headphone\n"); 3490 dev_dbg(codec->dev, "Detected headphone\n");
3438 wm8994->mic_detecting = false; 3491 wm8994->mic_detecting = false;
3439 3492
3440 wm8958_micd_set_rate(codec); 3493 wm8958_micd_set_rate(codec);
3441 3494
3442 /* If we have jackdet that will detect removal */ 3495 /* If we have jackdet that will detect removal */
3443 if (wm8994->jackdet) { 3496 wm1811_micd_stop(codec);
3444 mutex_lock(&wm8994->accdet_lock);
3445
3446 snd_soc_update_bits(codec, WM8958_MIC_DETECT_1,
3447 WM8958_MICD_ENA, 0);
3448
3449 wm1811_jackdet_set_mode(codec,
3450 WM1811_JACKDET_MODE_JACK);
3451
3452 mutex_unlock(&wm8994->accdet_lock);
3453
3454 if (wm8994->pdata->jd_ext_cap)
3455 snd_soc_dapm_disable_pin(&codec->dapm,
3456 "MICBIAS2");
3457 }
3458 3497
3459 snd_soc_jack_report(wm8994->micdet[0].jack, SND_JACK_HEADPHONE, 3498 snd_soc_jack_report(wm8994->micdet[0].jack, SND_JACK_HEADPHONE,
3460 SND_JACK_HEADSET); 3499 SND_JACK_HEADSET);
3461 } 3500 }
3501}
3462 3502
3463 /* Report short circuit as a button */ 3503/* Deferred mic detection to allow for extra settling time */
3464 if (wm8994->jack_mic) { 3504static void wm1811_mic_work(struct work_struct *work)
3465 report = 0; 3505{
3466 if (status & 0x4) 3506 struct wm8994_priv *wm8994 = container_of(work, struct wm8994_priv,
3467 report |= SND_JACK_BTN_0; 3507 mic_work.work);
3508 struct wm8994 *control = wm8994->wm8994;
3509 struct snd_soc_codec *codec = wm8994->hubs.codec;
3468 3510
3469 if (status & 0x8) 3511 pm_runtime_get_sync(codec->dev);
3470 report |= SND_JACK_BTN_1;
3471 3512
3472 if (status & 0x10) 3513 /* If required for an external cap force MICBIAS on */
3473 report |= SND_JACK_BTN_2; 3514 if (control->pdata.jd_ext_cap) {
3515 snd_soc_dapm_force_enable_pin(&codec->dapm,
3516 "MICBIAS2");
3517 snd_soc_dapm_sync(&codec->dapm);
3518 }
3474 3519
3475 if (status & 0x20) 3520 mutex_lock(&wm8994->accdet_lock);
3476 report |= SND_JACK_BTN_3;
3477 3521
3478 if (status & 0x40) 3522 dev_dbg(codec->dev, "Starting mic detection\n");
3479 report |= SND_JACK_BTN_4;
3480 3523
3481 if (status & 0x80) 3524 /* Use a user-supplied callback if we have one */
3482 report |= SND_JACK_BTN_5; 3525 if (wm8994->micd_cb) {
3526 wm8994->micd_cb(wm8994->micd_cb_data);
3527 } else {
3528 /*
3529 * Start off measument of microphone impedence to find out
3530 * what's actually there.
3531 */
3532 wm8994->mic_detecting = true;
3533 wm1811_jackdet_set_mode(codec, WM1811_JACKDET_MODE_MIC);
3483 3534
3484 snd_soc_jack_report(wm8994->micdet[0].jack, report, 3535 snd_soc_update_bits(codec, WM8958_MIC_DETECT_1,
3485 wm8994->btn_mask); 3536 WM8958_MICD_ENA, WM8958_MICD_ENA);
3486 } 3537 }
3538
3539 mutex_unlock(&wm8994->accdet_lock);
3540
3541 pm_runtime_put(codec->dev);
3487} 3542}
3488 3543
3489static irqreturn_t wm1811_jackdet_irq(int irq, void *data) 3544static irqreturn_t wm1811_jackdet_irq(int irq, void *data)
3490{ 3545{
3491 struct wm8994_priv *wm8994 = data; 3546 struct wm8994_priv *wm8994 = data;
3547 struct wm8994 *control = wm8994->wm8994;
3492 struct snd_soc_codec *codec = wm8994->hubs.codec; 3548 struct snd_soc_codec *codec = wm8994->hubs.codec;
3493 int reg; 3549 int reg, delay;
3494 bool present; 3550 bool present;
3495 3551
3496 pm_runtime_get_sync(codec->dev); 3552 pm_runtime_get_sync(codec->dev);
@@ -3521,18 +3577,14 @@ static irqreturn_t wm1811_jackdet_irq(int irq, void *data)
3521 snd_soc_update_bits(codec, WM1811_JACKDET_CTRL, 3577 snd_soc_update_bits(codec, WM1811_JACKDET_CTRL,
3522 WM1811_JACKDET_DB, 0); 3578 WM1811_JACKDET_DB, 0);
3523 3579
3524 /* 3580 delay = control->pdata.micdet_delay;
3525 * Start off measument of microphone impedence to find 3581 schedule_delayed_work(&wm8994->mic_work,
3526 * out what's actually there. 3582 msecs_to_jiffies(delay));
3527 */
3528 wm8994->mic_detecting = true;
3529 wm1811_jackdet_set_mode(codec, WM1811_JACKDET_MODE_MIC);
3530
3531 snd_soc_update_bits(codec, WM8958_MIC_DETECT_1,
3532 WM8958_MICD_ENA, WM8958_MICD_ENA);
3533 } else { 3583 } else {
3534 dev_dbg(codec->dev, "Jack not detected\n"); 3584 dev_dbg(codec->dev, "Jack not detected\n");
3535 3585
3586 cancel_delayed_work_sync(&wm8994->mic_work);
3587
3536 snd_soc_update_bits(codec, WM8958_MICBIAS2, 3588 snd_soc_update_bits(codec, WM8958_MICBIAS2,
3537 WM8958_MICB2_DISCH, WM8958_MICB2_DISCH); 3589 WM8958_MICB2_DISCH, WM8958_MICB2_DISCH);
3538 3590
@@ -3549,14 +3601,9 @@ static irqreturn_t wm1811_jackdet_irq(int irq, void *data)
3549 3601
3550 mutex_unlock(&wm8994->accdet_lock); 3602 mutex_unlock(&wm8994->accdet_lock);
3551 3603
3552 /* If required for an external cap force MICBIAS on */ 3604 /* Turn off MICBIAS if it was on for an external cap */
3553 if (wm8994->pdata->jd_ext_cap) { 3605 if (control->pdata.jd_ext_cap && !present)
3554 if (present) 3606 snd_soc_dapm_disable_pin(&codec->dapm, "MICBIAS2");
3555 snd_soc_dapm_force_enable_pin(&codec->dapm,
3556 "MICBIAS2");
3557 else
3558 snd_soc_dapm_disable_pin(&codec->dapm, "MICBIAS2");
3559 }
3560 3607
3561 if (present) 3608 if (present)
3562 snd_soc_jack_report(wm8994->micdet[0].jack, 3609 snd_soc_jack_report(wm8994->micdet[0].jack,
@@ -3599,7 +3646,8 @@ static void wm1811_jackdet_bootstrap(struct work_struct *work)
3599 * detection algorithm. 3646 * detection algorithm.
3600 */ 3647 */
3601int wm8958_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, 3648int wm8958_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack,
3602 wm8958_micdet_cb cb, void *cb_data) 3649 wm1811_micdet_cb det_cb, void *det_cb_data,
3650 wm1811_mic_id_cb id_cb, void *id_cb_data)
3603{ 3651{
3604 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); 3652 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
3605 struct wm8994 *control = wm8994->wm8994; 3653 struct wm8994 *control = wm8994->wm8994;
@@ -3614,27 +3662,32 @@ int wm8958_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack,
3614 } 3662 }
3615 3663
3616 if (jack) { 3664 if (jack) {
3617 if (!cb) {
3618 dev_dbg(codec->dev, "Using default micdet callback\n");
3619 cb = wm8958_default_micdet;
3620 cb_data = codec;
3621 }
3622
3623 snd_soc_dapm_force_enable_pin(&codec->dapm, "CLK_SYS"); 3665 snd_soc_dapm_force_enable_pin(&codec->dapm, "CLK_SYS");
3624 snd_soc_dapm_sync(&codec->dapm); 3666 snd_soc_dapm_sync(&codec->dapm);
3625 3667
3626 wm8994->micdet[0].jack = jack; 3668 wm8994->micdet[0].jack = jack;
3627 wm8994->jack_cb = cb;
3628 wm8994->jack_cb_data = cb_data;
3629 3669
3630 wm8994->mic_detecting = true; 3670 if (det_cb) {
3631 wm8994->jack_mic = false; 3671 wm8994->micd_cb = det_cb;
3672 wm8994->micd_cb_data = det_cb_data;
3673 } else {
3674 wm8994->mic_detecting = true;
3675 wm8994->jack_mic = false;
3676 }
3677
3678 if (id_cb) {
3679 wm8994->mic_id_cb = id_cb;
3680 wm8994->mic_id_cb_data = id_cb_data;
3681 } else {
3682 wm8994->mic_id_cb = wm8958_mic_id;
3683 wm8994->mic_id_cb_data = codec;
3684 }
3632 3685
3633 wm8958_micd_set_rate(codec); 3686 wm8958_micd_set_rate(codec);
3634 3687
3635 /* Detect microphones and short circuits by default */ 3688 /* Detect microphones and short circuits by default */
3636 if (wm8994->pdata->micd_lvl_sel) 3689 if (control->pdata.micd_lvl_sel)
3637 micd_lvl_sel = wm8994->pdata->micd_lvl_sel; 3690 micd_lvl_sel = control->pdata.micd_lvl_sel;
3638 else 3691 else
3639 micd_lvl_sel = 0x41; 3692 micd_lvl_sel = 0x41;
3640 3693
@@ -3728,10 +3781,22 @@ static irqreturn_t wm8958_mic_irq(int irq, void *data)
3728 trace_snd_soc_jack_irq(dev_name(codec->dev)); 3781 trace_snd_soc_jack_irq(dev_name(codec->dev));
3729#endif 3782#endif
3730 3783
3731 if (wm8994->jack_cb) 3784 /* Avoid a transient report when the accessory is being removed */
3732 wm8994->jack_cb(reg, wm8994->jack_cb_data); 3785 if (wm8994->jackdet) {
3786 reg = snd_soc_read(codec, WM1811_JACKDET_CTRL);
3787 if (reg < 0) {
3788 dev_err(codec->dev, "Failed to read jack status: %d\n",
3789 reg);
3790 } else if (!(reg & WM1811_JACKDET_LVL)) {
3791 dev_dbg(codec->dev, "Ignoring removed jack\n");
3792 return IRQ_HANDLED;
3793 }
3794 }
3795
3796 if (wm8994->mic_detecting)
3797 wm8994->mic_id_cb(wm8994->mic_id_cb_data, reg);
3733 else 3798 else
3734 dev_warn(codec->dev, "Accessory detection with no callback\n"); 3799 wm8958_button_det(codec, reg);
3735 3800
3736out: 3801out:
3737 pm_runtime_put(codec->dev); 3802 pm_runtime_put(codec->dev);
@@ -3779,15 +3844,24 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec)
3779 snd_soc_codec_set_cache_io(codec, 16, 16, SND_SOC_REGMAP); 3844 snd_soc_codec_set_cache_io(codec, 16, 16, SND_SOC_REGMAP);
3780 3845
3781 mutex_init(&wm8994->accdet_lock); 3846 mutex_init(&wm8994->accdet_lock);
3782 INIT_DELAYED_WORK(&wm8994->mic_work, wm8994_mic_work);
3783 INIT_DELAYED_WORK(&wm8994->jackdet_bootstrap, 3847 INIT_DELAYED_WORK(&wm8994->jackdet_bootstrap,
3784 wm1811_jackdet_bootstrap); 3848 wm1811_jackdet_bootstrap);
3785 3849
3850 switch (control->type) {
3851 case WM8994:
3852 INIT_DELAYED_WORK(&wm8994->mic_work, wm8994_mic_work);
3853 break;
3854 case WM1811:
3855 INIT_DELAYED_WORK(&wm8994->mic_work, wm1811_mic_work);
3856 break;
3857 default:
3858 break;
3859 }
3860
3786 for (i = 0; i < ARRAY_SIZE(wm8994->fll_locked); i++) 3861 for (i = 0; i < ARRAY_SIZE(wm8994->fll_locked); i++)
3787 init_completion(&wm8994->fll_locked[i]); 3862 init_completion(&wm8994->fll_locked[i]);
3788 3863
3789 if (wm8994->pdata && wm8994->pdata->micdet_irq) 3864 wm8994->micdet_irq = control->pdata.micdet_irq;
3790 wm8994->micdet_irq = wm8994->pdata->micdet_irq;
3791 3865
3792 pm_runtime_enable(codec->dev); 3866 pm_runtime_enable(codec->dev);
3793 pm_runtime_idle(codec->dev); 3867 pm_runtime_idle(codec->dev);
@@ -3800,8 +3874,8 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec)
3800 switch (control->type) { 3874 switch (control->type) {
3801 case WM8994: 3875 case WM8994:
3802 /* Single ended line outputs should have VMID on. */ 3876 /* Single ended line outputs should have VMID on. */
3803 if (!wm8994->pdata->lineout1_diff || 3877 if (!control->pdata.lineout1_diff ||
3804 !wm8994->pdata->lineout2_diff) 3878 !control->pdata.lineout2_diff)
3805 codec->dapm.idle_bias_off = 0; 3879 codec->dapm.idle_bias_off = 0;
3806 3880
3807 switch (wm8994->revision) { 3881 switch (wm8994->revision) {
@@ -3839,20 +3913,8 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec)
3839 wm8994->hubs.no_cache_dac_hp_direct = true; 3913 wm8994->hubs.no_cache_dac_hp_direct = true;
3840 wm8994->fll_byp = true; 3914 wm8994->fll_byp = true;
3841 3915
3842 switch (control->cust_id) { 3916 wm8994->hubs.dcs_codes_l = -9;
3843 case 0: 3917 wm8994->hubs.dcs_codes_r = -7;
3844 case 2:
3845 wm8994->hubs.dcs_codes_l = -9;
3846 wm8994->hubs.dcs_codes_r = -7;
3847 break;
3848 case 1:
3849 case 3:
3850 wm8994->hubs.dcs_codes_l = -8;
3851 wm8994->hubs.dcs_codes_r = -7;
3852 break;
3853 default:
3854 break;
3855 }
3856 3918
3857 snd_soc_update_bits(codec, WM8994_ANALOGUE_HP_1, 3919 snd_soc_update_bits(codec, WM8994_ANALOGUE_HP_1,
3858 WM1811_HPOUT1_ATTN, WM1811_HPOUT1_ATTN); 3920 WM1811_HPOUT1_ATTN, WM1811_HPOUT1_ATTN);
@@ -4225,7 +4287,7 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8994 = {
4225 .set_bias_level = wm8994_set_bias_level, 4287 .set_bias_level = wm8994_set_bias_level,
4226}; 4288};
4227 4289
4228static int __devinit wm8994_probe(struct platform_device *pdev) 4290static int wm8994_probe(struct platform_device *pdev)
4229{ 4291{
4230 struct wm8994_priv *wm8994; 4292 struct wm8994_priv *wm8994;
4231 4293
@@ -4236,13 +4298,12 @@ static int __devinit wm8994_probe(struct platform_device *pdev)
4236 platform_set_drvdata(pdev, wm8994); 4298 platform_set_drvdata(pdev, wm8994);
4237 4299
4238 wm8994->wm8994 = dev_get_drvdata(pdev->dev.parent); 4300 wm8994->wm8994 = dev_get_drvdata(pdev->dev.parent);
4239 wm8994->pdata = dev_get_platdata(pdev->dev.parent);
4240 4301
4241 return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_wm8994, 4302 return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_wm8994,
4242 wm8994_dai, ARRAY_SIZE(wm8994_dai)); 4303 wm8994_dai, ARRAY_SIZE(wm8994_dai));
4243} 4304}
4244 4305
4245static int __devexit wm8994_remove(struct platform_device *pdev) 4306static int wm8994_remove(struct platform_device *pdev)
4246{ 4307{
4247 snd_soc_unregister_codec(&pdev->dev); 4308 snd_soc_unregister_codec(&pdev->dev);
4248 return 0; 4309 return 0;
@@ -4266,7 +4327,7 @@ static int wm8994_resume(struct device *dev)
4266{ 4327{
4267 struct wm8994_priv *wm8994 = dev_get_drvdata(dev); 4328 struct wm8994_priv *wm8994 = dev_get_drvdata(dev);
4268 4329
4269 if (wm8994->jackdet && wm8994->jack_cb) 4330 if (wm8994->jackdet && wm8994->jackdet_mode)
4270 regmap_update_bits(wm8994->wm8994->regmap, WM8994_ANTIPOP_2, 4331 regmap_update_bits(wm8994->wm8994->regmap, WM8994_ANTIPOP_2,
4271 WM1811_JACKDET_MODE_MASK, 4332 WM1811_JACKDET_MODE_MASK,
4272 WM1811_JACKDET_MODE_AUDIO); 4333 WM1811_JACKDET_MODE_AUDIO);
@@ -4286,7 +4347,7 @@ static struct platform_driver wm8994_codec_driver = {
4286 .pm = &wm8994_pm_ops, 4347 .pm = &wm8994_pm_ops,
4287 }, 4348 },
4288 .probe = wm8994_probe, 4349 .probe = wm8994_probe,
4289 .remove = __devexit_p(wm8994_remove), 4350 .remove = wm8994_remove,
4290}; 4351};
4291 4352
4292module_platform_driver(wm8994_codec_driver); 4353module_platform_driver(wm8994_codec_driver);
diff --git a/sound/soc/codecs/wm8994.h b/sound/soc/codecs/wm8994.h
index ccbce5791e95..45f192702024 100644
--- a/sound/soc/codecs/wm8994.h
+++ b/sound/soc/codecs/wm8994.h
@@ -39,12 +39,14 @@ enum wm8994_vmid_mode {
39 WM8994_VMID_FORCE, 39 WM8994_VMID_FORCE,
40}; 40};
41 41
42typedef void (*wm8958_micdet_cb)(u16 status, void *data); 42typedef void (*wm1811_micdet_cb)(void *data);
43typedef void (*wm1811_mic_id_cb)(void *data, u16 status);
43 44
44int wm8994_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, 45int wm8994_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack,
45 int micbias); 46 int micbias);
46int wm8958_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, 47int wm8958_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack,
47 wm8958_micdet_cb cb, void *cb_data); 48 wm1811_micdet_cb cb, void *det_cb_data,
49 wm1811_mic_id_cb id_cb, void *id_cb_data);
48 50
49int wm8994_vmid_mode(struct snd_soc_codec *codec, enum wm8994_vmid_mode mode); 51int wm8994_vmid_mode(struct snd_soc_codec *codec, enum wm8994_vmid_mode mode);
50 52
@@ -138,12 +140,13 @@ struct wm8994_priv {
138 int jackdet_mode; 140 int jackdet_mode;
139 struct delayed_work jackdet_bootstrap; 141 struct delayed_work jackdet_bootstrap;
140 142
141 wm8958_micdet_cb jack_cb;
142 void *jack_cb_data;
143 int micdet_irq; 143 int micdet_irq;
144 wm1811_micdet_cb micd_cb;
145 void *micd_cb_data;
146 wm1811_mic_id_cb mic_id_cb;
147 void *mic_id_cb_data;
144 148
145 int revision; 149 int revision;
146 struct wm8994_pdata *pdata;
147 150
148 unsigned int aif1clk_enable:1; 151 unsigned int aif1clk_enable:1;
149 unsigned int aif2clk_enable:1; 152 unsigned int aif2clk_enable:1;
diff --git a/sound/soc/codecs/wm8995.c b/sound/soc/codecs/wm8995.c
index 28c89b094c6e..90a65c427541 100644
--- a/sound/soc/codecs/wm8995.c
+++ b/sound/soc/codecs/wm8995.c
@@ -2256,46 +2256,33 @@ static struct regmap_config wm8995_regmap = {
2256}; 2256};
2257 2257
2258#if defined(CONFIG_SPI_MASTER) 2258#if defined(CONFIG_SPI_MASTER)
2259static int __devinit wm8995_spi_probe(struct spi_device *spi) 2259static int wm8995_spi_probe(struct spi_device *spi)
2260{ 2260{
2261 struct wm8995_priv *wm8995; 2261 struct wm8995_priv *wm8995;
2262 int ret; 2262 int ret;
2263 2263
2264 wm8995 = kzalloc(sizeof *wm8995, GFP_KERNEL); 2264 wm8995 = devm_kzalloc(&spi->dev, sizeof(*wm8995), GFP_KERNEL);
2265 if (!wm8995) 2265 if (!wm8995)
2266 return -ENOMEM; 2266 return -ENOMEM;
2267 2267
2268 spi_set_drvdata(spi, wm8995); 2268 spi_set_drvdata(spi, wm8995);
2269 2269
2270 wm8995->regmap = regmap_init_spi(spi, &wm8995_regmap); 2270 wm8995->regmap = devm_regmap_init_spi(spi, &wm8995_regmap);
2271 if (IS_ERR(wm8995->regmap)) { 2271 if (IS_ERR(wm8995->regmap)) {
2272 ret = PTR_ERR(wm8995->regmap); 2272 ret = PTR_ERR(wm8995->regmap);
2273 dev_err(&spi->dev, "Failed to register regmap: %d\n", ret); 2273 dev_err(&spi->dev, "Failed to register regmap: %d\n", ret);
2274 goto err_alloc; 2274 return ret;
2275 } 2275 }
2276 2276
2277 ret = snd_soc_register_codec(&spi->dev, 2277 ret = snd_soc_register_codec(&spi->dev,
2278 &soc_codec_dev_wm8995, wm8995_dai, 2278 &soc_codec_dev_wm8995, wm8995_dai,
2279 ARRAY_SIZE(wm8995_dai)); 2279 ARRAY_SIZE(wm8995_dai));
2280 if (ret < 0)
2281 goto err_regmap;
2282
2283 return ret;
2284
2285err_regmap:
2286 regmap_exit(wm8995->regmap);
2287err_alloc:
2288 kfree(wm8995);
2289
2290 return ret; 2280 return ret;
2291} 2281}
2292 2282
2293static int __devexit wm8995_spi_remove(struct spi_device *spi) 2283static int wm8995_spi_remove(struct spi_device *spi)
2294{ 2284{
2295 struct wm8995_priv *wm8995 = spi_get_drvdata(spi);
2296 snd_soc_unregister_codec(&spi->dev); 2285 snd_soc_unregister_codec(&spi->dev);
2297 regmap_exit(wm8995->regmap);
2298 kfree(wm8995);
2299 return 0; 2286 return 0;
2300} 2287}
2301 2288
@@ -2305,55 +2292,42 @@ static struct spi_driver wm8995_spi_driver = {
2305 .owner = THIS_MODULE, 2292 .owner = THIS_MODULE,
2306 }, 2293 },
2307 .probe = wm8995_spi_probe, 2294 .probe = wm8995_spi_probe,
2308 .remove = __devexit_p(wm8995_spi_remove) 2295 .remove = wm8995_spi_remove
2309}; 2296};
2310#endif 2297#endif
2311 2298
2312#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) 2299#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
2313static __devinit int wm8995_i2c_probe(struct i2c_client *i2c, 2300static int wm8995_i2c_probe(struct i2c_client *i2c,
2314 const struct i2c_device_id *id) 2301 const struct i2c_device_id *id)
2315{ 2302{
2316 struct wm8995_priv *wm8995; 2303 struct wm8995_priv *wm8995;
2317 int ret; 2304 int ret;
2318 2305
2319 wm8995 = kzalloc(sizeof *wm8995, GFP_KERNEL); 2306 wm8995 = devm_kzalloc(&i2c->dev, sizeof(*wm8995), GFP_KERNEL);
2320 if (!wm8995) 2307 if (!wm8995)
2321 return -ENOMEM; 2308 return -ENOMEM;
2322 2309
2323 i2c_set_clientdata(i2c, wm8995); 2310 i2c_set_clientdata(i2c, wm8995);
2324 2311
2325 wm8995->regmap = regmap_init_i2c(i2c, &wm8995_regmap); 2312 wm8995->regmap = devm_regmap_init_i2c(i2c, &wm8995_regmap);
2326 if (IS_ERR(wm8995->regmap)) { 2313 if (IS_ERR(wm8995->regmap)) {
2327 ret = PTR_ERR(wm8995->regmap); 2314 ret = PTR_ERR(wm8995->regmap);
2328 dev_err(&i2c->dev, "Failed to register regmap: %d\n", ret); 2315 dev_err(&i2c->dev, "Failed to register regmap: %d\n", ret);
2329 goto err_alloc; 2316 return ret;
2330 } 2317 }
2331 2318
2332 ret = snd_soc_register_codec(&i2c->dev, 2319 ret = snd_soc_register_codec(&i2c->dev,
2333 &soc_codec_dev_wm8995, wm8995_dai, 2320 &soc_codec_dev_wm8995, wm8995_dai,
2334 ARRAY_SIZE(wm8995_dai)); 2321 ARRAY_SIZE(wm8995_dai));
2335 if (ret < 0) { 2322 if (ret < 0)
2336 dev_err(&i2c->dev, "Failed to register CODEC: %d\n", ret); 2323 dev_err(&i2c->dev, "Failed to register CODEC: %d\n", ret);
2337 goto err_regmap;
2338 }
2339
2340 return ret;
2341
2342err_regmap:
2343 regmap_exit(wm8995->regmap);
2344err_alloc:
2345 kfree(wm8995);
2346 2324
2347 return ret; 2325 return ret;
2348} 2326}
2349 2327
2350static __devexit int wm8995_i2c_remove(struct i2c_client *client) 2328static int wm8995_i2c_remove(struct i2c_client *client)
2351{ 2329{
2352 struct wm8995_priv *wm8995 = i2c_get_clientdata(client);
2353
2354 snd_soc_unregister_codec(&client->dev); 2330 snd_soc_unregister_codec(&client->dev);
2355 regmap_exit(wm8995->regmap);
2356 kfree(wm8995);
2357 return 0; 2331 return 0;
2358} 2332}
2359 2333
@@ -2370,7 +2344,7 @@ static struct i2c_driver wm8995_i2c_driver = {
2370 .owner = THIS_MODULE, 2344 .owner = THIS_MODULE,
2371 }, 2345 },
2372 .probe = wm8995_i2c_probe, 2346 .probe = wm8995_i2c_probe,
2373 .remove = __devexit_p(wm8995_i2c_remove), 2347 .remove = wm8995_i2c_remove,
2374 .id_table = wm8995_i2c_id 2348 .id_table = wm8995_i2c_id
2375}; 2349};
2376#endif 2350#endif
diff --git a/sound/soc/codecs/wm8996.c b/sound/soc/codecs/wm8996.c
index 6dcb02c3666f..46fe83d2b224 100644
--- a/sound/soc/codecs/wm8996.c
+++ b/sound/soc/codecs/wm8996.c
@@ -2765,8 +2765,8 @@ static struct snd_soc_dai_driver wm8996_dai[] = {
2765 }, 2765 },
2766}; 2766};
2767 2767
2768static __devinit int wm8996_i2c_probe(struct i2c_client *i2c, 2768static int wm8996_i2c_probe(struct i2c_client *i2c,
2769 const struct i2c_device_id *id) 2769 const struct i2c_device_id *id)
2770{ 2770{
2771 struct wm8996_priv *wm8996; 2771 struct wm8996_priv *wm8996;
2772 int ret, i; 2772 int ret, i;
@@ -3077,7 +3077,7 @@ err:
3077 return ret; 3077 return ret;
3078} 3078}
3079 3079
3080static __devexit int wm8996_i2c_remove(struct i2c_client *client) 3080static int wm8996_i2c_remove(struct i2c_client *client)
3081{ 3081{
3082 struct wm8996_priv *wm8996 = i2c_get_clientdata(client); 3082 struct wm8996_priv *wm8996 = i2c_get_clientdata(client);
3083 int i; 3083 int i;
@@ -3107,7 +3107,7 @@ static struct i2c_driver wm8996_i2c_driver = {
3107 .owner = THIS_MODULE, 3107 .owner = THIS_MODULE,
3108 }, 3108 },
3109 .probe = wm8996_i2c_probe, 3109 .probe = wm8996_i2c_probe,
3110 .remove = __devexit_p(wm8996_i2c_remove), 3110 .remove = wm8996_i2c_remove,
3111 .id_table = wm8996_i2c_id, 3111 .id_table = wm8996_i2c_id,
3112}; 3112};
3113 3113
diff --git a/sound/soc/codecs/wm9081.c b/sound/soc/codecs/wm9081.c
index 2de74e1ea225..630b3d776ec2 100644
--- a/sound/soc/codecs/wm9081.c
+++ b/sound/soc/codecs/wm9081.c
@@ -1327,8 +1327,8 @@ static const struct regmap_config wm9081_regmap = {
1327}; 1327};
1328 1328
1329#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) 1329#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
1330static __devinit int wm9081_i2c_probe(struct i2c_client *i2c, 1330static int wm9081_i2c_probe(struct i2c_client *i2c,
1331 const struct i2c_device_id *id) 1331 const struct i2c_device_id *id)
1332{ 1332{
1333 struct wm9081_priv *wm9081; 1333 struct wm9081_priv *wm9081;
1334 unsigned int reg; 1334 unsigned int reg;
@@ -1341,28 +1341,27 @@ static __devinit int wm9081_i2c_probe(struct i2c_client *i2c,
1341 1341
1342 i2c_set_clientdata(i2c, wm9081); 1342 i2c_set_clientdata(i2c, wm9081);
1343 1343
1344 wm9081->regmap = regmap_init_i2c(i2c, &wm9081_regmap); 1344 wm9081->regmap = devm_regmap_init_i2c(i2c, &wm9081_regmap);
1345 if (IS_ERR(wm9081->regmap)) { 1345 if (IS_ERR(wm9081->regmap)) {
1346 ret = PTR_ERR(wm9081->regmap); 1346 ret = PTR_ERR(wm9081->regmap);
1347 dev_err(&i2c->dev, "regmap_init() failed: %d\n", ret); 1347 dev_err(&i2c->dev, "regmap_init() failed: %d\n", ret);
1348 goto err; 1348 return ret;
1349 } 1349 }
1350 1350
1351 ret = regmap_read(wm9081->regmap, WM9081_SOFTWARE_RESET, &reg); 1351 ret = regmap_read(wm9081->regmap, WM9081_SOFTWARE_RESET, &reg);
1352 if (ret != 0) { 1352 if (ret != 0) {
1353 dev_err(&i2c->dev, "Failed to read chip ID: %d\n", ret); 1353 dev_err(&i2c->dev, "Failed to read chip ID: %d\n", ret);
1354 goto err_regmap; 1354 return ret;
1355 } 1355 }
1356 if (reg != 0x9081) { 1356 if (reg != 0x9081) {
1357 dev_err(&i2c->dev, "Device is not a WM9081: ID=0x%x\n", reg); 1357 dev_err(&i2c->dev, "Device is not a WM9081: ID=0x%x\n", reg);
1358 ret = -EINVAL; 1358 return -EINVAL;
1359 goto err_regmap;
1360 } 1359 }
1361 1360
1362 ret = wm9081_reset(wm9081->regmap); 1361 ret = wm9081_reset(wm9081->regmap);
1363 if (ret < 0) { 1362 if (ret < 0) {
1364 dev_err(&i2c->dev, "Failed to issue reset\n"); 1363 dev_err(&i2c->dev, "Failed to issue reset\n");
1365 goto err_regmap; 1364 return ret;
1366 } 1365 }
1367 1366
1368 if (dev_get_platdata(&i2c->dev)) 1367 if (dev_get_platdata(&i2c->dev))
@@ -1382,23 +1381,14 @@ static __devinit int wm9081_i2c_probe(struct i2c_client *i2c,
1382 ret = snd_soc_register_codec(&i2c->dev, 1381 ret = snd_soc_register_codec(&i2c->dev,
1383 &soc_codec_dev_wm9081, &wm9081_dai, 1); 1382 &soc_codec_dev_wm9081, &wm9081_dai, 1);
1384 if (ret < 0) 1383 if (ret < 0)
1385 goto err_regmap; 1384 return ret;
1386 1385
1387 return 0; 1386 return 0;
1388
1389err_regmap:
1390 regmap_exit(wm9081->regmap);
1391err:
1392
1393 return ret;
1394} 1387}
1395 1388
1396static __devexit int wm9081_i2c_remove(struct i2c_client *client) 1389static int wm9081_i2c_remove(struct i2c_client *client)
1397{ 1390{
1398 struct wm9081_priv *wm9081 = i2c_get_clientdata(client);
1399
1400 snd_soc_unregister_codec(&client->dev); 1391 snd_soc_unregister_codec(&client->dev);
1401 regmap_exit(wm9081->regmap);
1402 return 0; 1392 return 0;
1403} 1393}
1404 1394
@@ -1414,7 +1404,7 @@ static struct i2c_driver wm9081_i2c_driver = {
1414 .owner = THIS_MODULE, 1404 .owner = THIS_MODULE,
1415 }, 1405 },
1416 .probe = wm9081_i2c_probe, 1406 .probe = wm9081_i2c_probe,
1417 .remove = __devexit_p(wm9081_i2c_remove), 1407 .remove = wm9081_i2c_remove,
1418 .id_table = wm9081_i2c_id, 1408 .id_table = wm9081_i2c_id,
1419}; 1409};
1420#endif 1410#endif
diff --git a/sound/soc/codecs/wm9090.c b/sound/soc/codecs/wm9090.c
index c7ddc56175d1..a07fe1618eec 100644
--- a/sound/soc/codecs/wm9090.c
+++ b/sound/soc/codecs/wm9090.c
@@ -628,7 +628,7 @@ static int wm9090_i2c_probe(struct i2c_client *i2c,
628 return -ENOMEM; 628 return -ENOMEM;
629 } 629 }
630 630
631 wm9090->regmap = regmap_init_i2c(i2c, &wm9090_regmap); 631 wm9090->regmap = devm_regmap_init_i2c(i2c, &wm9090_regmap);
632 if (IS_ERR(wm9090->regmap)) { 632 if (IS_ERR(wm9090->regmap)) {
633 ret = PTR_ERR(wm9090->regmap); 633 ret = PTR_ERR(wm9090->regmap);
634 dev_err(&i2c->dev, "Failed to allocate regmap: %d\n", ret); 634 dev_err(&i2c->dev, "Failed to allocate regmap: %d\n", ret);
@@ -637,16 +637,16 @@ static int wm9090_i2c_probe(struct i2c_client *i2c,
637 637
638 ret = regmap_read(wm9090->regmap, WM9090_SOFTWARE_RESET, &reg); 638 ret = regmap_read(wm9090->regmap, WM9090_SOFTWARE_RESET, &reg);
639 if (ret < 0) 639 if (ret < 0)
640 goto err; 640 return ret;
641
641 if (reg != 0x9093) { 642 if (reg != 0x9093) {
642 dev_err(&i2c->dev, "Device is not a WM9090, ID=%x\n", reg); 643 dev_err(&i2c->dev, "Device is not a WM9090, ID=%x\n", reg);
643 ret = -ENODEV; 644 return -ENODEV;
644 goto err;
645 } 645 }
646 646
647 ret = regmap_write(wm9090->regmap, WM9090_SOFTWARE_RESET, 0); 647 ret = regmap_write(wm9090->regmap, WM9090_SOFTWARE_RESET, 0);
648 if (ret < 0) 648 if (ret < 0)
649 goto err; 649 return ret;
650 650
651 if (i2c->dev.platform_data) 651 if (i2c->dev.platform_data)
652 memcpy(&wm9090->pdata, i2c->dev.platform_data, 652 memcpy(&wm9090->pdata, i2c->dev.platform_data,
@@ -658,23 +658,15 @@ static int wm9090_i2c_probe(struct i2c_client *i2c,
658 &soc_codec_dev_wm9090, NULL, 0); 658 &soc_codec_dev_wm9090, NULL, 0);
659 if (ret != 0) { 659 if (ret != 0) {
660 dev_err(&i2c->dev, "Failed to register CODEC: %d\n", ret); 660 dev_err(&i2c->dev, "Failed to register CODEC: %d\n", ret);
661 goto err; 661 return ret;
662 } 662 }
663 663
664 return 0; 664 return 0;
665
666err:
667 regmap_exit(wm9090->regmap);
668 return ret;
669} 665}
670 666
671static int __devexit wm9090_i2c_remove(struct i2c_client *i2c) 667static int wm9090_i2c_remove(struct i2c_client *i2c)
672{ 668{
673 struct wm9090_priv *wm9090 = i2c_get_clientdata(i2c);
674
675 snd_soc_unregister_codec(&i2c->dev); 669 snd_soc_unregister_codec(&i2c->dev);
676 regmap_exit(wm9090->regmap);
677
678 return 0; 670 return 0;
679} 671}
680 672
@@ -691,7 +683,7 @@ static struct i2c_driver wm9090_i2c_driver = {
691 .owner = THIS_MODULE, 683 .owner = THIS_MODULE,
692 }, 684 },
693 .probe = wm9090_i2c_probe, 685 .probe = wm9090_i2c_probe,
694 .remove = __devexit_p(wm9090_i2c_remove), 686 .remove = wm9090_i2c_remove,
695 .id_table = wm9090_id, 687 .id_table = wm9090_id,
696}; 688};
697 689
diff --git a/sound/soc/codecs/wm9705.c b/sound/soc/codecs/wm9705.c
index e8e782a0c78d..05b1f346695b 100644
--- a/sound/soc/codecs/wm9705.c
+++ b/sound/soc/codecs/wm9705.c
@@ -382,13 +382,13 @@ static struct snd_soc_codec_driver soc_codec_dev_wm9705 = {
382 .num_dapm_routes = ARRAY_SIZE(wm9705_audio_map), 382 .num_dapm_routes = ARRAY_SIZE(wm9705_audio_map),
383}; 383};
384 384
385static __devinit int wm9705_probe(struct platform_device *pdev) 385static int wm9705_probe(struct platform_device *pdev)
386{ 386{
387 return snd_soc_register_codec(&pdev->dev, 387 return snd_soc_register_codec(&pdev->dev,
388 &soc_codec_dev_wm9705, wm9705_dai, ARRAY_SIZE(wm9705_dai)); 388 &soc_codec_dev_wm9705, wm9705_dai, ARRAY_SIZE(wm9705_dai));
389} 389}
390 390
391static int __devexit wm9705_remove(struct platform_device *pdev) 391static int wm9705_remove(struct platform_device *pdev)
392{ 392{
393 snd_soc_unregister_codec(&pdev->dev); 393 snd_soc_unregister_codec(&pdev->dev);
394 return 0; 394 return 0;
@@ -401,7 +401,7 @@ static struct platform_driver wm9705_codec_driver = {
401 }, 401 },
402 402
403 .probe = wm9705_probe, 403 .probe = wm9705_probe,
404 .remove = __devexit_p(wm9705_remove), 404 .remove = wm9705_remove,
405}; 405};
406 406
407module_platform_driver(wm9705_codec_driver); 407module_platform_driver(wm9705_codec_driver);
diff --git a/sound/soc/codecs/wm9712.c b/sound/soc/codecs/wm9712.c
index 4dd73ea08d0b..8e9a6a3eeb1a 100644
--- a/sound/soc/codecs/wm9712.c
+++ b/sound/soc/codecs/wm9712.c
@@ -685,13 +685,13 @@ static struct snd_soc_codec_driver soc_codec_dev_wm9712 = {
685 .num_dapm_routes = ARRAY_SIZE(wm9712_audio_map), 685 .num_dapm_routes = ARRAY_SIZE(wm9712_audio_map),
686}; 686};
687 687
688static __devinit int wm9712_probe(struct platform_device *pdev) 688static int wm9712_probe(struct platform_device *pdev)
689{ 689{
690 return snd_soc_register_codec(&pdev->dev, 690 return snd_soc_register_codec(&pdev->dev,
691 &soc_codec_dev_wm9712, wm9712_dai, ARRAY_SIZE(wm9712_dai)); 691 &soc_codec_dev_wm9712, wm9712_dai, ARRAY_SIZE(wm9712_dai));
692} 692}
693 693
694static int __devexit wm9712_remove(struct platform_device *pdev) 694static int wm9712_remove(struct platform_device *pdev)
695{ 695{
696 snd_soc_unregister_codec(&pdev->dev); 696 snd_soc_unregister_codec(&pdev->dev);
697 return 0; 697 return 0;
@@ -704,7 +704,7 @@ static struct platform_driver wm9712_codec_driver = {
704 }, 704 },
705 705
706 .probe = wm9712_probe, 706 .probe = wm9712_probe,
707 .remove = __devexit_p(wm9712_remove), 707 .remove = wm9712_remove,
708}; 708};
709 709
710module_platform_driver(wm9712_codec_driver); 710module_platform_driver(wm9712_codec_driver);
diff --git a/sound/soc/codecs/wm9713.c b/sound/soc/codecs/wm9713.c
index 3eb19fb71d17..f7afa68d8c7f 100644
--- a/sound/soc/codecs/wm9713.c
+++ b/sound/soc/codecs/wm9713.c
@@ -1254,13 +1254,13 @@ static struct snd_soc_codec_driver soc_codec_dev_wm9713 = {
1254 .num_dapm_routes = ARRAY_SIZE(wm9713_audio_map), 1254 .num_dapm_routes = ARRAY_SIZE(wm9713_audio_map),
1255}; 1255};
1256 1256
1257static __devinit int wm9713_probe(struct platform_device *pdev) 1257static int wm9713_probe(struct platform_device *pdev)
1258{ 1258{
1259 return snd_soc_register_codec(&pdev->dev, 1259 return snd_soc_register_codec(&pdev->dev,
1260 &soc_codec_dev_wm9713, wm9713_dai, ARRAY_SIZE(wm9713_dai)); 1260 &soc_codec_dev_wm9713, wm9713_dai, ARRAY_SIZE(wm9713_dai));
1261} 1261}
1262 1262
1263static int __devexit wm9713_remove(struct platform_device *pdev) 1263static int wm9713_remove(struct platform_device *pdev)
1264{ 1264{
1265 snd_soc_unregister_codec(&pdev->dev); 1265 snd_soc_unregister_codec(&pdev->dev);
1266 return 0; 1266 return 0;
@@ -1273,7 +1273,7 @@ static struct platform_driver wm9713_codec_driver = {
1273 }, 1273 },
1274 1274
1275 .probe = wm9713_probe, 1275 .probe = wm9713_probe,
1276 .remove = __devexit_p(wm9713_remove), 1276 .remove = wm9713_remove,
1277}; 1277};
1278 1278
1279module_platform_driver(wm9713_codec_driver); 1279module_platform_driver(wm9713_codec_driver);
diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c
new file mode 100644
index 000000000000..ffc89fab96fb
--- /dev/null
+++ b/sound/soc/codecs/wm_adsp.c
@@ -0,0 +1,699 @@
1/*
2 * wm_adsp.c -- Wolfson ADSP support
3 *
4 * Copyright 2012 Wolfson Microelectronics plc
5 *
6 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
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 version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#include <linux/module.h>
14#include <linux/moduleparam.h>
15#include <linux/init.h>
16#include <linux/delay.h>
17#include <linux/firmware.h>
18#include <linux/pm.h>
19#include <linux/pm_runtime.h>
20#include <linux/regmap.h>
21#include <linux/regulator/consumer.h>
22#include <linux/slab.h>
23#include <sound/core.h>
24#include <sound/pcm.h>
25#include <sound/pcm_params.h>
26#include <sound/soc.h>
27#include <sound/jack.h>
28#include <sound/initval.h>
29#include <sound/tlv.h>
30
31#include <linux/mfd/arizona/registers.h>
32
33#include "wm_adsp.h"
34
35#define adsp_crit(_dsp, fmt, ...) \
36 dev_crit(_dsp->dev, "DSP%d: " fmt, _dsp->num, ##__VA_ARGS__)
37#define adsp_err(_dsp, fmt, ...) \
38 dev_err(_dsp->dev, "DSP%d: " fmt, _dsp->num, ##__VA_ARGS__)
39#define adsp_warn(_dsp, fmt, ...) \
40 dev_warn(_dsp->dev, "DSP%d: " fmt, _dsp->num, ##__VA_ARGS__)
41#define adsp_info(_dsp, fmt, ...) \
42 dev_info(_dsp->dev, "DSP%d: " fmt, _dsp->num, ##__VA_ARGS__)
43#define adsp_dbg(_dsp, fmt, ...) \
44 dev_dbg(_dsp->dev, "DSP%d: " fmt, _dsp->num, ##__VA_ARGS__)
45
46#define ADSP1_CONTROL_1 0x00
47#define ADSP1_CONTROL_2 0x02
48#define ADSP1_CONTROL_3 0x03
49#define ADSP1_CONTROL_4 0x04
50#define ADSP1_CONTROL_5 0x06
51#define ADSP1_CONTROL_6 0x07
52#define ADSP1_CONTROL_7 0x08
53#define ADSP1_CONTROL_8 0x09
54#define ADSP1_CONTROL_9 0x0A
55#define ADSP1_CONTROL_10 0x0B
56#define ADSP1_CONTROL_11 0x0C
57#define ADSP1_CONTROL_12 0x0D
58#define ADSP1_CONTROL_13 0x0F
59#define ADSP1_CONTROL_14 0x10
60#define ADSP1_CONTROL_15 0x11
61#define ADSP1_CONTROL_16 0x12
62#define ADSP1_CONTROL_17 0x13
63#define ADSP1_CONTROL_18 0x14
64#define ADSP1_CONTROL_19 0x16
65#define ADSP1_CONTROL_20 0x17
66#define ADSP1_CONTROL_21 0x18
67#define ADSP1_CONTROL_22 0x1A
68#define ADSP1_CONTROL_23 0x1B
69#define ADSP1_CONTROL_24 0x1C
70#define ADSP1_CONTROL_25 0x1E
71#define ADSP1_CONTROL_26 0x20
72#define ADSP1_CONTROL_27 0x21
73#define ADSP1_CONTROL_28 0x22
74#define ADSP1_CONTROL_29 0x23
75#define ADSP1_CONTROL_30 0x24
76#define ADSP1_CONTROL_31 0x26
77
78/*
79 * ADSP1 Control 19
80 */
81#define ADSP1_WDMA_BUFFER_LENGTH_MASK 0x00FF /* DSP1_WDMA_BUFFER_LENGTH - [7:0] */
82#define ADSP1_WDMA_BUFFER_LENGTH_SHIFT 0 /* DSP1_WDMA_BUFFER_LENGTH - [7:0] */
83#define ADSP1_WDMA_BUFFER_LENGTH_WIDTH 8 /* DSP1_WDMA_BUFFER_LENGTH - [7:0] */
84
85
86/*
87 * ADSP1 Control 30
88 */
89#define ADSP1_DBG_CLK_ENA 0x0008 /* DSP1_DBG_CLK_ENA */
90#define ADSP1_DBG_CLK_ENA_MASK 0x0008 /* DSP1_DBG_CLK_ENA */
91#define ADSP1_DBG_CLK_ENA_SHIFT 3 /* DSP1_DBG_CLK_ENA */
92#define ADSP1_DBG_CLK_ENA_WIDTH 1 /* DSP1_DBG_CLK_ENA */
93#define ADSP1_SYS_ENA 0x0004 /* DSP1_SYS_ENA */
94#define ADSP1_SYS_ENA_MASK 0x0004 /* DSP1_SYS_ENA */
95#define ADSP1_SYS_ENA_SHIFT 2 /* DSP1_SYS_ENA */
96#define ADSP1_SYS_ENA_WIDTH 1 /* DSP1_SYS_ENA */
97#define ADSP1_CORE_ENA 0x0002 /* DSP1_CORE_ENA */
98#define ADSP1_CORE_ENA_MASK 0x0002 /* DSP1_CORE_ENA */
99#define ADSP1_CORE_ENA_SHIFT 1 /* DSP1_CORE_ENA */
100#define ADSP1_CORE_ENA_WIDTH 1 /* DSP1_CORE_ENA */
101#define ADSP1_START 0x0001 /* DSP1_START */
102#define ADSP1_START_MASK 0x0001 /* DSP1_START */
103#define ADSP1_START_SHIFT 0 /* DSP1_START */
104#define ADSP1_START_WIDTH 1 /* DSP1_START */
105
106#define ADSP2_CONTROL 0
107#define ADSP2_CLOCKING 1
108#define ADSP2_STATUS1 4
109
110/*
111 * ADSP2 Control
112 */
113
114#define ADSP2_MEM_ENA 0x0010 /* DSP1_MEM_ENA */
115#define ADSP2_MEM_ENA_MASK 0x0010 /* DSP1_MEM_ENA */
116#define ADSP2_MEM_ENA_SHIFT 4 /* DSP1_MEM_ENA */
117#define ADSP2_MEM_ENA_WIDTH 1 /* DSP1_MEM_ENA */
118#define ADSP2_SYS_ENA 0x0004 /* DSP1_SYS_ENA */
119#define ADSP2_SYS_ENA_MASK 0x0004 /* DSP1_SYS_ENA */
120#define ADSP2_SYS_ENA_SHIFT 2 /* DSP1_SYS_ENA */
121#define ADSP2_SYS_ENA_WIDTH 1 /* DSP1_SYS_ENA */
122#define ADSP2_CORE_ENA 0x0002 /* DSP1_CORE_ENA */
123#define ADSP2_CORE_ENA_MASK 0x0002 /* DSP1_CORE_ENA */
124#define ADSP2_CORE_ENA_SHIFT 1 /* DSP1_CORE_ENA */
125#define ADSP2_CORE_ENA_WIDTH 1 /* DSP1_CORE_ENA */
126#define ADSP2_START 0x0001 /* DSP1_START */
127#define ADSP2_START_MASK 0x0001 /* DSP1_START */
128#define ADSP2_START_SHIFT 0 /* DSP1_START */
129#define ADSP2_START_WIDTH 1 /* DSP1_START */
130
131/*
132 * ADSP2 clocking
133 */
134#define ADSP2_CLK_SEL_MASK 0x0007 /* CLK_SEL_ENA */
135#define ADSP2_CLK_SEL_SHIFT 0 /* CLK_SEL_ENA */
136#define ADSP2_CLK_SEL_WIDTH 3 /* CLK_SEL_ENA */
137
138/*
139 * ADSP2 Status 1
140 */
141#define ADSP2_RAM_RDY 0x0001
142#define ADSP2_RAM_RDY_MASK 0x0001
143#define ADSP2_RAM_RDY_SHIFT 0
144#define ADSP2_RAM_RDY_WIDTH 1
145
146
147static struct wm_adsp_region const *wm_adsp_find_region(struct wm_adsp *dsp,
148 int type)
149{
150 int i;
151
152 for (i = 0; i < dsp->num_mems; i++)
153 if (dsp->mem[i].type == type)
154 return &dsp->mem[i];
155
156 return NULL;
157}
158
159static int wm_adsp_load(struct wm_adsp *dsp)
160{
161 const struct firmware *firmware;
162 struct regmap *regmap = dsp->regmap;
163 unsigned int pos = 0;
164 const struct wmfw_header *header;
165 const struct wmfw_adsp1_sizes *adsp1_sizes;
166 const struct wmfw_adsp2_sizes *adsp2_sizes;
167 const struct wmfw_footer *footer;
168 const struct wmfw_region *region;
169 const struct wm_adsp_region *mem;
170 const char *region_name;
171 char *file, *text;
172 unsigned int reg;
173 int regions = 0;
174 int ret, offset, type, sizes;
175
176 file = kzalloc(PAGE_SIZE, GFP_KERNEL);
177 if (file == NULL)
178 return -ENOMEM;
179
180 snprintf(file, PAGE_SIZE, "%s-dsp%d.wmfw", dsp->part, dsp->num);
181 file[PAGE_SIZE - 1] = '\0';
182
183 ret = request_firmware(&firmware, file, dsp->dev);
184 if (ret != 0) {
185 adsp_err(dsp, "Failed to request '%s'\n", file);
186 goto out;
187 }
188 ret = -EINVAL;
189
190 pos = sizeof(*header) + sizeof(*adsp1_sizes) + sizeof(*footer);
191 if (pos >= firmware->size) {
192 adsp_err(dsp, "%s: file too short, %zu bytes\n",
193 file, firmware->size);
194 goto out_fw;
195 }
196
197 header = (void*)&firmware->data[0];
198
199 if (memcmp(&header->magic[0], "WMFW", 4) != 0) {
200 adsp_err(dsp, "%s: invalid magic\n", file);
201 goto out_fw;
202 }
203
204 if (header->ver != 0) {
205 adsp_err(dsp, "%s: unknown file format %d\n",
206 file, header->ver);
207 goto out_fw;
208 }
209
210 if (header->core != dsp->type) {
211 adsp_err(dsp, "%s: invalid core %d != %d\n",
212 file, header->core, dsp->type);
213 goto out_fw;
214 }
215
216 switch (dsp->type) {
217 case WMFW_ADSP1:
218 pos = sizeof(*header) + sizeof(*adsp1_sizes) + sizeof(*footer);
219 adsp1_sizes = (void *)&(header[1]);
220 footer = (void *)&(adsp1_sizes[1]);
221 sizes = sizeof(*adsp1_sizes);
222
223 adsp_dbg(dsp, "%s: %d DM, %d PM, %d ZM\n",
224 file, le32_to_cpu(adsp1_sizes->dm),
225 le32_to_cpu(adsp1_sizes->pm),
226 le32_to_cpu(adsp1_sizes->zm));
227 break;
228
229 case WMFW_ADSP2:
230 pos = sizeof(*header) + sizeof(*adsp2_sizes) + sizeof(*footer);
231 adsp2_sizes = (void *)&(header[1]);
232 footer = (void *)&(adsp2_sizes[1]);
233 sizes = sizeof(*adsp2_sizes);
234
235 adsp_dbg(dsp, "%s: %d XM, %d YM %d PM, %d ZM\n",
236 file, le32_to_cpu(adsp2_sizes->xm),
237 le32_to_cpu(adsp2_sizes->ym),
238 le32_to_cpu(adsp2_sizes->pm),
239 le32_to_cpu(adsp2_sizes->zm));
240 break;
241
242 default:
243 BUG_ON(NULL == "Unknown DSP type");
244 goto out_fw;
245 }
246
247 if (le32_to_cpu(header->len) != sizeof(*header) +
248 sizes + sizeof(*footer)) {
249 adsp_err(dsp, "%s: unexpected header length %d\n",
250 file, le32_to_cpu(header->len));
251 goto out_fw;
252 }
253
254 adsp_dbg(dsp, "%s: timestamp %llu\n", file,
255 le64_to_cpu(footer->timestamp));
256
257 while (pos < firmware->size &&
258 pos - firmware->size > sizeof(*region)) {
259 region = (void *)&(firmware->data[pos]);
260 region_name = "Unknown";
261 reg = 0;
262 text = NULL;
263 offset = le32_to_cpu(region->offset) & 0xffffff;
264 type = be32_to_cpu(region->type) & 0xff;
265 mem = wm_adsp_find_region(dsp, type);
266
267 switch (type) {
268 case WMFW_NAME_TEXT:
269 region_name = "Firmware name";
270 text = kzalloc(le32_to_cpu(region->len) + 1,
271 GFP_KERNEL);
272 break;
273 case WMFW_INFO_TEXT:
274 region_name = "Information";
275 text = kzalloc(le32_to_cpu(region->len) + 1,
276 GFP_KERNEL);
277 break;
278 case WMFW_ABSOLUTE:
279 region_name = "Absolute";
280 reg = offset;
281 break;
282 case WMFW_ADSP1_PM:
283 BUG_ON(!mem);
284 region_name = "PM";
285 reg = mem->base + (offset * 3);
286 break;
287 case WMFW_ADSP1_DM:
288 BUG_ON(!mem);
289 region_name = "DM";
290 reg = mem->base + (offset * 2);
291 break;
292 case WMFW_ADSP2_XM:
293 BUG_ON(!mem);
294 region_name = "XM";
295 reg = mem->base + (offset * 2);
296 break;
297 case WMFW_ADSP2_YM:
298 BUG_ON(!mem);
299 region_name = "YM";
300 reg = mem->base + (offset * 2);
301 break;
302 case WMFW_ADSP1_ZM:
303 BUG_ON(!mem);
304 region_name = "ZM";
305 reg = mem->base + (offset * 2);
306 break;
307 default:
308 adsp_warn(dsp,
309 "%s.%d: Unknown region type %x at %d(%x)\n",
310 file, regions, type, pos, pos);
311 break;
312 }
313
314 adsp_dbg(dsp, "%s.%d: %d bytes at %d in %s\n", file,
315 regions, le32_to_cpu(region->len), offset,
316 region_name);
317
318 if (text) {
319 memcpy(text, region->data, le32_to_cpu(region->len));
320 adsp_info(dsp, "%s: %s\n", file, text);
321 kfree(text);
322 }
323
324 if (reg) {
325 ret = regmap_raw_write(regmap, reg, region->data,
326 le32_to_cpu(region->len));
327 if (ret != 0) {
328 adsp_err(dsp,
329 "%s.%d: Failed to write %d bytes at %d in %s: %d\n",
330 file, regions,
331 le32_to_cpu(region->len), offset,
332 region_name, ret);
333 goto out_fw;
334 }
335 }
336
337 pos += le32_to_cpu(region->len) + sizeof(*region);
338 regions++;
339 }
340
341 if (pos > firmware->size)
342 adsp_warn(dsp, "%s.%d: %zu bytes at end of file\n",
343 file, regions, pos - firmware->size);
344
345out_fw:
346 release_firmware(firmware);
347out:
348 kfree(file);
349
350 return ret;
351}
352
353static int wm_adsp_load_coeff(struct wm_adsp *dsp)
354{
355 struct regmap *regmap = dsp->regmap;
356 struct wmfw_coeff_hdr *hdr;
357 struct wmfw_coeff_item *blk;
358 const struct firmware *firmware;
359 const char *region_name;
360 int ret, pos, blocks, type, offset, reg;
361 char *file;
362
363 file = kzalloc(PAGE_SIZE, GFP_KERNEL);
364 if (file == NULL)
365 return -ENOMEM;
366
367 snprintf(file, PAGE_SIZE, "%s-dsp%d.bin", dsp->part, dsp->num);
368 file[PAGE_SIZE - 1] = '\0';
369
370 ret = request_firmware(&firmware, file, dsp->dev);
371 if (ret != 0) {
372 adsp_warn(dsp, "Failed to request '%s'\n", file);
373 ret = 0;
374 goto out;
375 }
376 ret = -EINVAL;
377
378 if (sizeof(*hdr) >= firmware->size) {
379 adsp_err(dsp, "%s: file too short, %zu bytes\n",
380 file, firmware->size);
381 goto out_fw;
382 }
383
384 hdr = (void*)&firmware->data[0];
385 if (memcmp(hdr->magic, "WMDR", 4) != 0) {
386 adsp_err(dsp, "%s: invalid magic\n", file);
387 return -EINVAL;
388 }
389
390 adsp_dbg(dsp, "%s: v%d.%d.%d\n", file,
391 (le32_to_cpu(hdr->ver) >> 16) & 0xff,
392 (le32_to_cpu(hdr->ver) >> 8) & 0xff,
393 le32_to_cpu(hdr->ver) & 0xff);
394
395 pos = le32_to_cpu(hdr->len);
396
397 blocks = 0;
398 while (pos < firmware->size &&
399 pos - firmware->size > sizeof(*blk)) {
400 blk = (void*)(&firmware->data[pos]);
401
402 type = be32_to_cpu(blk->type) & 0xff;
403 offset = le32_to_cpu(blk->offset) & 0xffffff;
404
405 adsp_dbg(dsp, "%s.%d: %x v%d.%d.%d\n",
406 file, blocks, le32_to_cpu(blk->id),
407 (le32_to_cpu(blk->ver) >> 16) & 0xff,
408 (le32_to_cpu(blk->ver) >> 8) & 0xff,
409 le32_to_cpu(blk->ver) & 0xff);
410 adsp_dbg(dsp, "%s.%d: %d bytes at 0x%x in %x\n",
411 file, blocks, le32_to_cpu(blk->len), offset, type);
412
413 reg = 0;
414 region_name = "Unknown";
415 switch (type) {
416 case WMFW_NAME_TEXT:
417 case WMFW_INFO_TEXT:
418 break;
419 case WMFW_ABSOLUTE:
420 region_name = "register";
421 reg = offset;
422 break;
423 default:
424 adsp_err(dsp, "Unknown region type %x\n", type);
425 break;
426 }
427
428 if (reg) {
429 ret = regmap_raw_write(regmap, reg, blk->data,
430 le32_to_cpu(blk->len));
431 if (ret != 0) {
432 adsp_err(dsp,
433 "%s.%d: Failed to write to %x in %s\n",
434 file, blocks, reg, region_name);
435 }
436 }
437
438 pos += le32_to_cpu(blk->len) + sizeof(*blk);
439 blocks++;
440 }
441
442 if (pos > firmware->size)
443 adsp_warn(dsp, "%s.%d: %zu bytes at end of file\n",
444 file, blocks, pos - firmware->size);
445
446out_fw:
447 release_firmware(firmware);
448out:
449 kfree(file);
450 return 0;
451}
452
453int wm_adsp1_event(struct snd_soc_dapm_widget *w,
454 struct snd_kcontrol *kcontrol,
455 int event)
456{
457 struct snd_soc_codec *codec = w->codec;
458 struct wm_adsp *dsps = snd_soc_codec_get_drvdata(codec);
459 struct wm_adsp *dsp = &dsps[w->shift];
460 int ret;
461
462 switch (event) {
463 case SND_SOC_DAPM_POST_PMU:
464 regmap_update_bits(dsp->regmap, dsp->base + ADSP1_CONTROL_30,
465 ADSP1_SYS_ENA, ADSP1_SYS_ENA);
466
467 ret = wm_adsp_load(dsp);
468 if (ret != 0)
469 goto err;
470
471 ret = wm_adsp_load_coeff(dsp);
472 if (ret != 0)
473 goto err;
474
475 /* Start the core running */
476 regmap_update_bits(dsp->regmap, dsp->base + ADSP1_CONTROL_30,
477 ADSP1_CORE_ENA | ADSP1_START,
478 ADSP1_CORE_ENA | ADSP1_START);
479 break;
480
481 case SND_SOC_DAPM_PRE_PMD:
482 /* Halt the core */
483 regmap_update_bits(dsp->regmap, dsp->base + ADSP1_CONTROL_30,
484 ADSP1_CORE_ENA | ADSP1_START, 0);
485
486 regmap_update_bits(dsp->regmap, dsp->base + ADSP1_CONTROL_19,
487 ADSP1_WDMA_BUFFER_LENGTH_MASK, 0);
488
489 regmap_update_bits(dsp->regmap, dsp->base + ADSP1_CONTROL_30,
490 ADSP1_SYS_ENA, 0);
491 break;
492
493 default:
494 break;
495 }
496
497 return 0;
498
499err:
500 regmap_update_bits(dsp->regmap, dsp->base + ADSP1_CONTROL_30,
501 ADSP1_SYS_ENA, 0);
502 return ret;
503}
504EXPORT_SYMBOL_GPL(wm_adsp1_event);
505
506static int wm_adsp2_ena(struct wm_adsp *dsp)
507{
508 unsigned int val;
509 int ret, count;
510
511 ret = regmap_update_bits(dsp->regmap, dsp->base + ADSP2_CONTROL,
512 ADSP2_SYS_ENA, ADSP2_SYS_ENA);
513 if (ret != 0)
514 return ret;
515
516 /* Wait for the RAM to start, should be near instantaneous */
517 count = 0;
518 do {
519 ret = regmap_read(dsp->regmap, dsp->base + ADSP2_STATUS1,
520 &val);
521 if (ret != 0)
522 return ret;
523 } while (!(val & ADSP2_RAM_RDY) && ++count < 10);
524
525 if (!(val & ADSP2_RAM_RDY)) {
526 adsp_err(dsp, "Failed to start DSP RAM\n");
527 return -EBUSY;
528 }
529
530 adsp_dbg(dsp, "RAM ready after %d polls\n", count);
531 adsp_info(dsp, "RAM ready after %d polls\n", count);
532
533 return 0;
534}
535
536int wm_adsp2_event(struct snd_soc_dapm_widget *w,
537 struct snd_kcontrol *kcontrol, int event)
538{
539 struct snd_soc_codec *codec = w->codec;
540 struct wm_adsp *dsps = snd_soc_codec_get_drvdata(codec);
541 struct wm_adsp *dsp = &dsps[w->shift];
542 unsigned int val;
543 int ret;
544
545 switch (event) {
546 case SND_SOC_DAPM_POST_PMU:
547 /*
548 * For simplicity set the DSP clock rate to be the
549 * SYSCLK rate rather than making it configurable.
550 */
551 ret = regmap_read(dsp->regmap, ARIZONA_SYSTEM_CLOCK_1, &val);
552 if (ret != 0) {
553 adsp_err(dsp, "Failed to read SYSCLK state: %d\n",
554 ret);
555 return ret;
556 }
557 val = (val & ARIZONA_SYSCLK_FREQ_MASK)
558 >> ARIZONA_SYSCLK_FREQ_SHIFT;
559
560 ret = regmap_update_bits(dsp->regmap,
561 dsp->base + ADSP2_CLOCKING,
562 ADSP2_CLK_SEL_MASK, val);
563 if (ret != 0) {
564 adsp_err(dsp, "Failed to set clock rate: %d\n",
565 ret);
566 return ret;
567 }
568
569 if (dsp->dvfs) {
570 ret = regmap_read(dsp->regmap,
571 dsp->base + ADSP2_CLOCKING, &val);
572 if (ret != 0) {
573 dev_err(dsp->dev,
574 "Failed to read clocking: %d\n", ret);
575 return ret;
576 }
577
578 if ((val & ADSP2_CLK_SEL_MASK) >= 3) {
579 ret = regulator_enable(dsp->dvfs);
580 if (ret != 0) {
581 dev_err(dsp->dev,
582 "Failed to enable supply: %d\n",
583 ret);
584 return ret;
585 }
586
587 ret = regulator_set_voltage(dsp->dvfs,
588 1800000,
589 1800000);
590 if (ret != 0) {
591 dev_err(dsp->dev,
592 "Failed to raise supply: %d\n",
593 ret);
594 return ret;
595 }
596 }
597 }
598
599 ret = wm_adsp2_ena(dsp);
600 if (ret != 0)
601 return ret;
602
603 ret = wm_adsp_load(dsp);
604 if (ret != 0)
605 goto err;
606
607 ret = wm_adsp_load_coeff(dsp);
608 if (ret != 0)
609 goto err;
610
611 ret = regmap_update_bits(dsp->regmap,
612 dsp->base + ADSP2_CONTROL,
613 ADSP2_CORE_ENA | ADSP2_START,
614 ADSP2_CORE_ENA | ADSP2_START);
615 if (ret != 0)
616 goto err;
617 break;
618
619 case SND_SOC_DAPM_PRE_PMD:
620 regmap_update_bits(dsp->regmap, dsp->base + ADSP2_CONTROL,
621 ADSP2_SYS_ENA | ADSP2_CORE_ENA |
622 ADSP2_START, 0);
623
624 if (dsp->dvfs) {
625 ret = regulator_set_voltage(dsp->dvfs, 1200000,
626 1800000);
627 if (ret != 0)
628 dev_warn(dsp->dev,
629 "Failed to lower supply: %d\n",
630 ret);
631
632 ret = regulator_disable(dsp->dvfs);
633 if (ret != 0)
634 dev_err(dsp->dev,
635 "Failed to enable supply: %d\n",
636 ret);
637 }
638 break;
639
640 default:
641 break;
642 }
643
644 return 0;
645err:
646 regmap_update_bits(dsp->regmap, dsp->base + ADSP2_CONTROL,
647 ADSP2_SYS_ENA | ADSP2_CORE_ENA | ADSP2_START, 0);
648 return ret;
649}
650EXPORT_SYMBOL_GPL(wm_adsp2_event);
651
652int wm_adsp2_init(struct wm_adsp *adsp, bool dvfs)
653{
654 int ret;
655
656 /*
657 * Disable the DSP memory by default when in reset for a small
658 * power saving.
659 */
660 ret = regmap_update_bits(adsp->regmap, adsp->base + ADSP2_CONTROL,
661 ADSP2_MEM_ENA, 0);
662 if (ret != 0) {
663 adsp_err(adsp, "Failed to clear memory retention: %d\n", ret);
664 return ret;
665 }
666
667 if (dvfs) {
668 adsp->dvfs = devm_regulator_get(adsp->dev, "DCVDD");
669 if (IS_ERR(adsp->dvfs)) {
670 ret = PTR_ERR(adsp->dvfs);
671 dev_err(adsp->dev, "Failed to get DCVDD: %d\n", ret);
672 return ret;
673 }
674
675 ret = regulator_enable(adsp->dvfs);
676 if (ret != 0) {
677 dev_err(adsp->dev, "Failed to enable DCVDD: %d\n",
678 ret);
679 return ret;
680 }
681
682 ret = regulator_set_voltage(adsp->dvfs, 1200000, 1800000);
683 if (ret != 0) {
684 dev_err(adsp->dev, "Failed to initialise DVFS: %d\n",
685 ret);
686 return ret;
687 }
688
689 ret = regulator_disable(adsp->dvfs);
690 if (ret != 0) {
691 dev_err(adsp->dev, "Failed to disable DCVDD: %d\n",
692 ret);
693 return ret;
694 }
695 }
696
697 return 0;
698}
699EXPORT_SYMBOL_GPL(wm_adsp2_init);
diff --git a/sound/soc/codecs/wm_adsp.h b/sound/soc/codecs/wm_adsp.h
new file mode 100644
index 000000000000..ffd29a4609e2
--- /dev/null
+++ b/sound/soc/codecs/wm_adsp.h
@@ -0,0 +1,59 @@
1/*
2 * wm_adsp.h -- Wolfson ADSP support
3 *
4 * Copyright 2012 Wolfson Microelectronics plc
5 *
6 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
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 version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#ifndef __WM_ADSP_H
14#define __WM_ADSP_H
15
16#include <sound/soc.h>
17#include <sound/soc-dapm.h>
18
19#include "wmfw.h"
20
21struct regulator;
22
23struct wm_adsp_region {
24 int type;
25 unsigned int base;
26};
27
28struct wm_adsp {
29 const char *part;
30 int num;
31 int type;
32 struct device *dev;
33 struct regmap *regmap;
34
35 int base;
36
37 const struct wm_adsp_region *mem;
38 int num_mems;
39
40 struct regulator *dvfs;
41};
42
43#define WM_ADSP1(wname, num) \
44 { .id = snd_soc_dapm_pga, .name = wname, .reg = SND_SOC_NOPM, \
45 .shift = num, .event = wm_adsp1_event, \
46 .event_flags = SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD }
47
48#define WM_ADSP2(wname, num) \
49{ .id = snd_soc_dapm_pga, .name = wname, .reg = SND_SOC_NOPM, \
50 .shift = num, .event = wm_adsp2_event, \
51 .event_flags = SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD }
52
53int wm_adsp2_init(struct wm_adsp *adsp, bool dvfs);
54int wm_adsp1_event(struct snd_soc_dapm_widget *w,
55 struct snd_kcontrol *kcontrol, int event);
56int wm_adsp2_event(struct snd_soc_dapm_widget *w,
57 struct snd_kcontrol *kcontrol, int event);
58
59#endif
diff --git a/sound/soc/codecs/wmfw.h b/sound/soc/codecs/wmfw.h
new file mode 100644
index 000000000000..5632ded67fdd
--- /dev/null
+++ b/sound/soc/codecs/wmfw.h
@@ -0,0 +1,128 @@
1/*
2 * wmfw.h - Wolfson firmware format information
3 *
4 * Copyright 2012 Wolfson Microelectronics plc
5 *
6 * Author: Mark Brown <broonie@opensource.wolfsonmicro.com>
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 version 2 as
10 * published by the Free Software Foundation.
11 */
12
13#ifndef __WMFW_H
14#define __WMFW_H
15
16#include <linux/types.h>
17
18struct wmfw_header {
19 char magic[4];
20 __le32 len;
21 __le16 rev;
22 u8 core;
23 u8 ver;
24} __packed;
25
26struct wmfw_footer {
27 __le64 timestamp;
28 __le32 checksum;
29} __packed;
30
31struct wmfw_adsp1_sizes {
32 __le32 dm;
33 __le32 pm;
34 __le32 zm;
35} __packed;
36
37struct wmfw_adsp2_sizes {
38 __le32 xm;
39 __le32 ym;
40 __le32 pm;
41 __le32 zm;
42} __packed;
43
44struct wmfw_region {
45 union {
46 __be32 type;
47 __le32 offset;
48 };
49 __le32 len;
50 u8 data[];
51} __packed;
52
53struct wmfw_id_hdr {
54 __be32 core_id;
55 __be32 core_rev;
56 __be32 id;
57 __be32 ver;
58} __packed;
59
60struct wmfw_adsp1_id_hdr {
61 struct wmfw_id_hdr fw;
62 __be32 zm;
63 __be32 dm;
64 __be32 algs;
65} __packed;
66
67struct wmfw_adsp2_id_hdr {
68 struct wmfw_id_hdr fw;
69 __be32 zm;
70 __be32 xm;
71 __be32 ym;
72 __be32 algs;
73} __packed;
74
75struct wmfw_alg_hdr {
76 __be32 id;
77 __be32 ver;
78} __packed;
79
80struct wmfw_adsp1_alg_hdr {
81 struct wmfw_alg_hdr alg;
82 __be32 zm;
83 __be32 dm;
84} __packed;
85
86struct wmfw_adsp2_alg_hdr {
87 struct wmfw_alg_hdr alg;
88 __be32 zm;
89 __be32 xm;
90 __be32 ym;
91} __packed;
92
93struct wmfw_coeff_hdr {
94 u8 magic[4];
95 __le32 len;
96 __le32 ver;
97 u8 data[];
98} __packed;
99
100struct wmfw_coeff_item {
101 union {
102 __be32 type;
103 __le32 offset;
104 };
105 __le32 id;
106 __le32 ver;
107 __le32 sr;
108 __le32 len;
109 u8 data[];
110} __packed;
111
112#define WMFW_ADSP1 1
113#define WMFW_ADSP2 2
114
115#define WMFW_ABSOLUTE 0xf0
116#define WMFW_NAME_TEXT 0xfe
117#define WMFW_INFO_TEXT 0xff
118
119#define WMFW_ADSP1_PM 2
120#define WMFW_ADSP1_DM 3
121#define WMFW_ADSP1_ZM 4
122
123#define WMFW_ADSP2_PM 2
124#define WMFW_ADSP2_ZM 4
125#define WMFW_ADSP2_XM 5
126#define WMFW_ADSP2_YM 6
127
128#endif
diff --git a/sound/soc/davinci/davinci-evm.c b/sound/soc/davinci/davinci-evm.c
index 6fac5af13298..d55e6477bff0 100644
--- a/sound/soc/davinci/davinci-evm.c
+++ b/sound/soc/davinci/davinci-evm.c
@@ -71,6 +71,11 @@ static int evm_hw_params(struct snd_pcm_substream *substream,
71 if (ret < 0) 71 if (ret < 0)
72 return ret; 72 return ret;
73 73
74 /* set the CPU system clock */
75 ret = snd_soc_dai_set_sysclk(cpu_dai, 0, sysclk, SND_SOC_CLOCK_OUT);
76 if (ret < 0)
77 return ret;
78
74 return 0; 79 return 0;
75} 80}
76 81
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c
index 714e51e5be5b..55e2bf652bef 100644
--- a/sound/soc/davinci/davinci-mcasp.c
+++ b/sound/soc/davinci/davinci-mcasp.c
@@ -199,6 +199,7 @@
199#define ACLKXE BIT(5) 199#define ACLKXE BIT(5)
200#define TX_ASYNC BIT(6) 200#define TX_ASYNC BIT(6)
201#define ACLKXPOL BIT(7) 201#define ACLKXPOL BIT(7)
202#define ACLKXDIV_MASK 0x1f
202 203
203/* 204/*
204 * DAVINCI_MCASP_ACLKRCTL_REG Receive Clock Control Register Bits 205 * DAVINCI_MCASP_ACLKRCTL_REG Receive Clock Control Register Bits
@@ -207,6 +208,7 @@
207#define ACLKRE BIT(5) 208#define ACLKRE BIT(5)
208#define RX_ASYNC BIT(6) 209#define RX_ASYNC BIT(6)
209#define ACLKRPOL BIT(7) 210#define ACLKRPOL BIT(7)
211#define ACLKRDIV_MASK 0x1f
210 212
211/* 213/*
212 * DAVINCI_MCASP_AHCLKXCTL_REG - High Frequency Transmit Clock Control 214 * DAVINCI_MCASP_AHCLKXCTL_REG - High Frequency Transmit Clock Control
@@ -215,6 +217,7 @@
215#define AHCLKXDIV(val) (val) 217#define AHCLKXDIV(val) (val)
216#define AHCLKXPOL BIT(14) 218#define AHCLKXPOL BIT(14)
217#define AHCLKXE BIT(15) 219#define AHCLKXE BIT(15)
220#define AHCLKXDIV_MASK 0xfff
218 221
219/* 222/*
220 * DAVINCI_MCASP_AHCLKRCTL_REG - High Frequency Receive Clock Control 223 * DAVINCI_MCASP_AHCLKRCTL_REG - High Frequency Receive Clock Control
@@ -223,6 +226,7 @@
223#define AHCLKRDIV(val) (val) 226#define AHCLKRDIV(val) (val)
224#define AHCLKRPOL BIT(14) 227#define AHCLKRPOL BIT(14)
225#define AHCLKRE BIT(15) 228#define AHCLKRE BIT(15)
229#define AHCLKRDIV_MASK 0xfff
226 230
227/* 231/*
228 * DAVINCI_MCASP_XRSRCTL_BASE_REG - Serializer Control Register Bits 232 * DAVINCI_MCASP_XRSRCTL_BASE_REG - Serializer Control Register Bits
@@ -473,6 +477,23 @@ static int davinci_mcasp_set_dai_fmt(struct snd_soc_dai *cpu_dai,
473 struct davinci_audio_dev *dev = snd_soc_dai_get_drvdata(cpu_dai); 477 struct davinci_audio_dev *dev = snd_soc_dai_get_drvdata(cpu_dai);
474 void __iomem *base = dev->base; 478 void __iomem *base = dev->base;
475 479
480 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
481 case SND_SOC_DAIFMT_DSP_B:
482 case SND_SOC_DAIFMT_AC97:
483 mcasp_clr_bits(dev->base + DAVINCI_MCASP_TXFMCTL_REG, FSXDUR);
484 mcasp_clr_bits(dev->base + DAVINCI_MCASP_RXFMCTL_REG, FSRDUR);
485 break;
486 default:
487 /* configure a full-word SYNC pulse (LRCLK) */
488 mcasp_set_bits(dev->base + DAVINCI_MCASP_TXFMCTL_REG, FSXDUR);
489 mcasp_set_bits(dev->base + DAVINCI_MCASP_RXFMCTL_REG, FSRDUR);
490
491 /* make 1st data bit occur one ACLK cycle after the frame sync */
492 mcasp_set_bits(dev->base + DAVINCI_MCASP_TXFMT_REG, FSXDLY(1));
493 mcasp_set_bits(dev->base + DAVINCI_MCASP_RXFMT_REG, FSRDLY(1));
494 break;
495 }
496
476 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { 497 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
477 case SND_SOC_DAIFMT_CBS_CFS: 498 case SND_SOC_DAIFMT_CBS_CFS:
478 /* codec is clock and frame slave */ 499 /* codec is clock and frame slave */
@@ -482,8 +503,7 @@ static int davinci_mcasp_set_dai_fmt(struct snd_soc_dai *cpu_dai,
482 mcasp_set_bits(base + DAVINCI_MCASP_ACLKRCTL_REG, ACLKRE); 503 mcasp_set_bits(base + DAVINCI_MCASP_ACLKRCTL_REG, ACLKRE);
483 mcasp_set_bits(base + DAVINCI_MCASP_RXFMCTL_REG, AFSRE); 504 mcasp_set_bits(base + DAVINCI_MCASP_RXFMCTL_REG, AFSRE);
484 505
485 mcasp_set_bits(base + DAVINCI_MCASP_PDIR_REG, 506 mcasp_set_bits(base + DAVINCI_MCASP_PDIR_REG, ACLKX | AFSX);
486 ACLKX | AHCLKX | AFSX);
487 break; 507 break;
488 case SND_SOC_DAIFMT_CBM_CFS: 508 case SND_SOC_DAIFMT_CBM_CFS:
489 /* codec is clock master and frame slave */ 509 /* codec is clock master and frame slave */
@@ -554,59 +574,75 @@ static int davinci_mcasp_set_dai_fmt(struct snd_soc_dai *cpu_dai,
554 return 0; 574 return 0;
555} 575}
556 576
557static int davinci_config_channel_size(struct davinci_audio_dev *dev, 577static int davinci_mcasp_set_clkdiv(struct snd_soc_dai *dai, int div_id, int div)
558 int channel_size)
559{ 578{
560 u32 fmt = 0; 579 struct davinci_audio_dev *dev = snd_soc_dai_get_drvdata(dai);
561 u32 mask, rotate;
562
563 switch (channel_size) {
564 case DAVINCI_AUDIO_WORD_8:
565 fmt = 0x03;
566 rotate = 6;
567 mask = 0x000000ff;
568 break;
569 580
570 case DAVINCI_AUDIO_WORD_12: 581 switch (div_id) {
571 fmt = 0x05; 582 case 0: /* MCLK divider */
572 rotate = 5; 583 mcasp_mod_bits(dev->base + DAVINCI_MCASP_AHCLKXCTL_REG,
573 mask = 0x00000fff; 584 AHCLKXDIV(div - 1), AHCLKXDIV_MASK);
585 mcasp_mod_bits(dev->base + DAVINCI_MCASP_AHCLKRCTL_REG,
586 AHCLKRDIV(div - 1), AHCLKRDIV_MASK);
574 break; 587 break;
575 588
576 case DAVINCI_AUDIO_WORD_16: 589 case 1: /* BCLK divider */
577 fmt = 0x07; 590 mcasp_mod_bits(dev->base + DAVINCI_MCASP_ACLKXCTL_REG,
578 rotate = 4; 591 ACLKXDIV(div - 1), ACLKXDIV_MASK);
579 mask = 0x0000ffff; 592 mcasp_mod_bits(dev->base + DAVINCI_MCASP_ACLKRCTL_REG,
593 ACLKRDIV(div - 1), ACLKRDIV_MASK);
580 break; 594 break;
581 595
582 case DAVINCI_AUDIO_WORD_20: 596 case 2: /* BCLK/LRCLK ratio */
583 fmt = 0x09; 597 dev->bclk_lrclk_ratio = div;
584 rotate = 3;
585 mask = 0x000fffff;
586 break; 598 break;
587 599
588 case DAVINCI_AUDIO_WORD_24: 600 default:
589 fmt = 0x0B; 601 return -EINVAL;
590 rotate = 2; 602 }
591 mask = 0x00ffffff;
592 break;
593 603
594 case DAVINCI_AUDIO_WORD_28: 604 return 0;
595 fmt = 0x0D; 605}
596 rotate = 1;
597 mask = 0x0fffffff;
598 break;
599 606
600 case DAVINCI_AUDIO_WORD_32: 607static int davinci_mcasp_set_sysclk(struct snd_soc_dai *dai, int clk_id,
601 fmt = 0x0F; 608 unsigned int freq, int dir)
602 rotate = 0; 609{
603 mask = 0xffffffff; 610 struct davinci_audio_dev *dev = snd_soc_dai_get_drvdata(dai);
604 break;
605 611
606 default: 612 if (dir == SND_SOC_CLOCK_OUT) {
607 return -EINVAL; 613 mcasp_set_bits(dev->base + DAVINCI_MCASP_AHCLKXCTL_REG, AHCLKXE);
614 mcasp_set_bits(dev->base + DAVINCI_MCASP_AHCLKRCTL_REG, AHCLKRE);
615 mcasp_set_bits(dev->base + DAVINCI_MCASP_PDIR_REG, AHCLKX);
616 } else {
617 mcasp_clr_bits(dev->base + DAVINCI_MCASP_AHCLKXCTL_REG, AHCLKXE);
618 mcasp_clr_bits(dev->base + DAVINCI_MCASP_AHCLKRCTL_REG, AHCLKRE);
619 mcasp_clr_bits(dev->base + DAVINCI_MCASP_PDIR_REG, AHCLKX);
608 } 620 }
609 621
622 return 0;
623}
624
625static int davinci_config_channel_size(struct davinci_audio_dev *dev,
626 int word_length)
627{
628 u32 fmt;
629 u32 rotate = (32 - word_length) / 4;
630 u32 mask = (1ULL << word_length) - 1;
631
632 /*
633 * if s BCLK-to-LRCLK ratio has been configured via the set_clkdiv()
634 * callback, take it into account here. That allows us to for example
635 * send 32 bits per channel to the codec, while only 16 of them carry
636 * audio payload.
637 * The clock ratio is given for a full period of data (both left and
638 * right channels), so it has to be divided by 2.
639 */
640 if (dev->bclk_lrclk_ratio)
641 word_length = dev->bclk_lrclk_ratio / 2;
642
643 /* mapping of the XSSZ bit-field as described in the datasheet */
644 fmt = (word_length >> 1) - 1;
645
610 mcasp_mod_bits(dev->base + DAVINCI_MCASP_RXFMT_REG, 646 mcasp_mod_bits(dev->base + DAVINCI_MCASP_RXFMT_REG,
611 RXSSZ(fmt), RXSSZ(0x0F)); 647 RXSSZ(fmt), RXSSZ(0x0F));
612 mcasp_mod_bits(dev->base + DAVINCI_MCASP_TXFMT_REG, 648 mcasp_mod_bits(dev->base + DAVINCI_MCASP_TXFMT_REG,
@@ -709,8 +745,6 @@ static void davinci_hw_param(struct davinci_audio_dev *dev, int stream)
709 if (stream == SNDRV_PCM_STREAM_PLAYBACK) { 745 if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
710 /* bit stream is MSB first with no delay */ 746 /* bit stream is MSB first with no delay */
711 /* DSP_B mode */ 747 /* DSP_B mode */
712 mcasp_set_bits(dev->base + DAVINCI_MCASP_AHCLKXCTL_REG,
713 AHCLKXE);
714 mcasp_set_reg(dev->base + DAVINCI_MCASP_TXTDM_REG, mask); 748 mcasp_set_reg(dev->base + DAVINCI_MCASP_TXTDM_REG, mask);
715 mcasp_set_bits(dev->base + DAVINCI_MCASP_TXFMT_REG, TXORD); 749 mcasp_set_bits(dev->base + DAVINCI_MCASP_TXFMT_REG, TXORD);
716 750
@@ -720,14 +754,10 @@ static void davinci_hw_param(struct davinci_audio_dev *dev, int stream)
720 else 754 else
721 printk(KERN_ERR "playback tdm slot %d not supported\n", 755 printk(KERN_ERR "playback tdm slot %d not supported\n",
722 dev->tdm_slots); 756 dev->tdm_slots);
723
724 mcasp_clr_bits(dev->base + DAVINCI_MCASP_TXFMCTL_REG, FSXDUR);
725 } else { 757 } else {
726 /* bit stream is MSB first with no delay */ 758 /* bit stream is MSB first with no delay */
727 /* DSP_B mode */ 759 /* DSP_B mode */
728 mcasp_set_bits(dev->base + DAVINCI_MCASP_RXFMT_REG, RXORD); 760 mcasp_set_bits(dev->base + DAVINCI_MCASP_RXFMT_REG, RXORD);
729 mcasp_set_bits(dev->base + DAVINCI_MCASP_AHCLKRCTL_REG,
730 AHCLKRE);
731 mcasp_set_reg(dev->base + DAVINCI_MCASP_RXTDM_REG, mask); 761 mcasp_set_reg(dev->base + DAVINCI_MCASP_RXTDM_REG, mask);
732 762
733 if ((dev->tdm_slots >= 2) && (dev->tdm_slots <= 32)) 763 if ((dev->tdm_slots >= 2) && (dev->tdm_slots <= 32))
@@ -736,8 +766,6 @@ static void davinci_hw_param(struct davinci_audio_dev *dev, int stream)
736 else 766 else
737 printk(KERN_ERR "capture tdm slot %d not supported\n", 767 printk(KERN_ERR "capture tdm slot %d not supported\n",
738 dev->tdm_slots); 768 dev->tdm_slots);
739
740 mcasp_clr_bits(dev->base + DAVINCI_MCASP_RXFMCTL_REG, FSRDUR);
741 } 769 }
742} 770}
743 771
@@ -800,19 +828,27 @@ static int davinci_mcasp_hw_params(struct snd_pcm_substream *substream,
800 case SNDRV_PCM_FORMAT_U8: 828 case SNDRV_PCM_FORMAT_U8:
801 case SNDRV_PCM_FORMAT_S8: 829 case SNDRV_PCM_FORMAT_S8:
802 dma_params->data_type = 1; 830 dma_params->data_type = 1;
803 word_length = DAVINCI_AUDIO_WORD_8; 831 word_length = 8;
804 break; 832 break;
805 833
806 case SNDRV_PCM_FORMAT_U16_LE: 834 case SNDRV_PCM_FORMAT_U16_LE:
807 case SNDRV_PCM_FORMAT_S16_LE: 835 case SNDRV_PCM_FORMAT_S16_LE:
808 dma_params->data_type = 2; 836 dma_params->data_type = 2;
809 word_length = DAVINCI_AUDIO_WORD_16; 837 word_length = 16;
838 break;
839
840 case SNDRV_PCM_FORMAT_U24_3LE:
841 case SNDRV_PCM_FORMAT_S24_3LE:
842 dma_params->data_type = 3;
843 word_length = 24;
810 break; 844 break;
811 845
846 case SNDRV_PCM_FORMAT_U24_LE:
847 case SNDRV_PCM_FORMAT_S24_LE:
812 case SNDRV_PCM_FORMAT_U32_LE: 848 case SNDRV_PCM_FORMAT_U32_LE:
813 case SNDRV_PCM_FORMAT_S32_LE: 849 case SNDRV_PCM_FORMAT_S32_LE:
814 dma_params->data_type = 4; 850 dma_params->data_type = 4;
815 word_length = DAVINCI_AUDIO_WORD_32; 851 word_length = 32;
816 break; 852 break;
817 853
818 default: 854 default:
@@ -880,13 +916,18 @@ static const struct snd_soc_dai_ops davinci_mcasp_dai_ops = {
880 .trigger = davinci_mcasp_trigger, 916 .trigger = davinci_mcasp_trigger,
881 .hw_params = davinci_mcasp_hw_params, 917 .hw_params = davinci_mcasp_hw_params,
882 .set_fmt = davinci_mcasp_set_dai_fmt, 918 .set_fmt = davinci_mcasp_set_dai_fmt,
883 919 .set_clkdiv = davinci_mcasp_set_clkdiv,
920 .set_sysclk = davinci_mcasp_set_sysclk,
884}; 921};
885 922
886#define DAVINCI_MCASP_PCM_FMTS (SNDRV_PCM_FMTBIT_S8 | \ 923#define DAVINCI_MCASP_PCM_FMTS (SNDRV_PCM_FMTBIT_S8 | \
887 SNDRV_PCM_FMTBIT_U8 | \ 924 SNDRV_PCM_FMTBIT_U8 | \
888 SNDRV_PCM_FMTBIT_S16_LE | \ 925 SNDRV_PCM_FMTBIT_S16_LE | \
889 SNDRV_PCM_FMTBIT_U16_LE | \ 926 SNDRV_PCM_FMTBIT_U16_LE | \
927 SNDRV_PCM_FMTBIT_S24_LE | \
928 SNDRV_PCM_FMTBIT_U24_LE | \
929 SNDRV_PCM_FMTBIT_S24_3LE | \
930 SNDRV_PCM_FMTBIT_U24_3LE | \
890 SNDRV_PCM_FMTBIT_S32_LE | \ 931 SNDRV_PCM_FMTBIT_S32_LE | \
891 SNDRV_PCM_FMTBIT_U32_LE) 932 SNDRV_PCM_FMTBIT_U32_LE)
892 933
@@ -1089,7 +1130,6 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
1089 dev->tdm_slots = pdata->tdm_slots; 1130 dev->tdm_slots = pdata->tdm_slots;
1090 dev->num_serializer = pdata->num_serializer; 1131 dev->num_serializer = pdata->num_serializer;
1091 dev->serial_dir = pdata->serial_dir; 1132 dev->serial_dir = pdata->serial_dir;
1092 dev->codec_fmt = pdata->codec_fmt;
1093 dev->version = pdata->version; 1133 dev->version = pdata->version;
1094 dev->txnumevt = pdata->txnumevt; 1134 dev->txnumevt = pdata->txnumevt;
1095 dev->rxnumevt = pdata->rxnumevt; 1135 dev->rxnumevt = pdata->rxnumevt;
@@ -1098,6 +1138,7 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
1098 dma_data = &dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK]; 1138 dma_data = &dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK];
1099 dma_data->asp_chan_q = pdata->asp_chan_q; 1139 dma_data->asp_chan_q = pdata->asp_chan_q;
1100 dma_data->ram_chan_q = pdata->ram_chan_q; 1140 dma_data->ram_chan_q = pdata->ram_chan_q;
1141 dma_data->sram_pool = pdata->sram_pool;
1101 dma_data->sram_size = pdata->sram_size_playback; 1142 dma_data->sram_size = pdata->sram_size_playback;
1102 dma_data->dma_addr = (dma_addr_t) (pdata->tx_dma_offset + 1143 dma_data->dma_addr = (dma_addr_t) (pdata->tx_dma_offset +
1103 mem->start); 1144 mem->start);
@@ -1115,6 +1156,7 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
1115 dma_data = &dev->dma_params[SNDRV_PCM_STREAM_CAPTURE]; 1156 dma_data = &dev->dma_params[SNDRV_PCM_STREAM_CAPTURE];
1116 dma_data->asp_chan_q = pdata->asp_chan_q; 1157 dma_data->asp_chan_q = pdata->asp_chan_q;
1117 dma_data->ram_chan_q = pdata->ram_chan_q; 1158 dma_data->ram_chan_q = pdata->ram_chan_q;
1159 dma_data->sram_pool = pdata->sram_pool;
1118 dma_data->sram_size = pdata->sram_size_capture; 1160 dma_data->sram_size = pdata->sram_size_capture;
1119 dma_data->dma_addr = (dma_addr_t)(pdata->rx_dma_offset + 1161 dma_data->dma_addr = (dma_addr_t)(pdata->rx_dma_offset +
1120 mem->start); 1162 mem->start);
diff --git a/sound/soc/davinci/davinci-mcasp.h b/sound/soc/davinci/davinci-mcasp.h
index 0de9ed6ce038..0edd3b5a37fd 100644
--- a/sound/soc/davinci/davinci-mcasp.h
+++ b/sound/soc/davinci/davinci-mcasp.h
@@ -23,26 +23,14 @@
23 23
24#include "davinci-pcm.h" 24#include "davinci-pcm.h"
25 25
26#define DAVINCI_MCASP_RATES SNDRV_PCM_RATE_8000_96000 26#define DAVINCI_MCASP_RATES SNDRV_PCM_RATE_8000_192000
27#define DAVINCI_MCASP_I2S_DAI 0 27#define DAVINCI_MCASP_I2S_DAI 0
28#define DAVINCI_MCASP_DIT_DAI 1 28#define DAVINCI_MCASP_DIT_DAI 1
29 29
30enum {
31 DAVINCI_AUDIO_WORD_8 = 0,
32 DAVINCI_AUDIO_WORD_12,
33 DAVINCI_AUDIO_WORD_16,
34 DAVINCI_AUDIO_WORD_20,
35 DAVINCI_AUDIO_WORD_24,
36 DAVINCI_AUDIO_WORD_32,
37 DAVINCI_AUDIO_WORD_28, /* This is only valid for McASP */
38};
39
40struct davinci_audio_dev { 30struct davinci_audio_dev {
41 struct davinci_pcm_dma_params dma_params[2]; 31 struct davinci_pcm_dma_params dma_params[2];
42 void __iomem *base; 32 void __iomem *base;
43 int sample_rate;
44 struct device *dev; 33 struct device *dev;
45 unsigned int codec_fmt;
46 34
47 /* McASP specific data */ 35 /* McASP specific data */
48 int tdm_slots; 36 int tdm_slots;
@@ -50,6 +38,7 @@ struct davinci_audio_dev {
50 u8 num_serializer; 38 u8 num_serializer;
51 u8 *serial_dir; 39 u8 *serial_dir;
52 u8 version; 40 u8 version;
41 u8 bclk_lrclk_ratio;
53 42
54 /* McASP FIFO related */ 43 /* McASP FIFO related */
55 u8 txnumevt; 44 u8 txnumevt;
diff --git a/sound/soc/davinci/davinci-pcm.c b/sound/soc/davinci/davinci-pcm.c
index 93ea3bf567e1..afab81f844ae 100644
--- a/sound/soc/davinci/davinci-pcm.c
+++ b/sound/soc/davinci/davinci-pcm.c
@@ -16,6 +16,7 @@
16#include <linux/slab.h> 16#include <linux/slab.h>
17#include <linux/dma-mapping.h> 17#include <linux/dma-mapping.h>
18#include <linux/kernel.h> 18#include <linux/kernel.h>
19#include <linux/genalloc.h>
19 20
20#include <sound/core.h> 21#include <sound/core.h>
21#include <sound/pcm.h> 22#include <sound/pcm.h>
@@ -23,7 +24,6 @@
23#include <sound/soc.h> 24#include <sound/soc.h>
24 25
25#include <asm/dma.h> 26#include <asm/dma.h>
26#include <mach/sram.h>
27 27
28#include "davinci-pcm.h" 28#include "davinci-pcm.h"
29 29
@@ -67,13 +67,9 @@ static struct snd_pcm_hardware pcm_hardware_playback = {
67 SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME| 67 SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME|
68 SNDRV_PCM_INFO_BATCH), 68 SNDRV_PCM_INFO_BATCH),
69 .formats = DAVINCI_PCM_FMTBITS, 69 .formats = DAVINCI_PCM_FMTBITS,
70 .rates = (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 | 70 .rates = SNDRV_PCM_RATE_8000_192000 | SNDRV_PCM_RATE_KNOT,
71 SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_32000 |
72 SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 |
73 SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000 |
74 SNDRV_PCM_RATE_KNOT),
75 .rate_min = 8000, 71 .rate_min = 8000,
76 .rate_max = 96000, 72 .rate_max = 192000,
77 .channels_min = 2, 73 .channels_min = 2,
78 .channels_max = 384, 74 .channels_max = 384,
79 .buffer_bytes_max = 128 * 1024, 75 .buffer_bytes_max = 128 * 1024,
@@ -90,13 +86,9 @@ static struct snd_pcm_hardware pcm_hardware_capture = {
90 SNDRV_PCM_INFO_PAUSE | 86 SNDRV_PCM_INFO_PAUSE |
91 SNDRV_PCM_INFO_BATCH), 87 SNDRV_PCM_INFO_BATCH),
92 .formats = DAVINCI_PCM_FMTBITS, 88 .formats = DAVINCI_PCM_FMTBITS,
93 .rates = (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 | 89 .rates = SNDRV_PCM_RATE_8000_192000 | SNDRV_PCM_RATE_KNOT,
94 SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_32000 |
95 SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 |
96 SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000 |
97 SNDRV_PCM_RATE_KNOT),
98 .rate_min = 8000, 90 .rate_min = 8000,
99 .rate_max = 96000, 91 .rate_max = 192000,
100 .channels_min = 2, 92 .channels_min = 2,
101 .channels_max = 384, 93 .channels_max = 384,
102 .buffer_bytes_max = 128 * 1024, 94 .buffer_bytes_max = 128 * 1024,
@@ -259,7 +251,9 @@ static void davinci_pcm_dma_irq(unsigned link, u16 ch_status, void *data)
259 } 251 }
260} 252}
261 253
262static int allocate_sram(struct snd_pcm_substream *substream, unsigned size, 254#ifdef CONFIG_GENERIC_ALLOCATOR
255static int allocate_sram(struct snd_pcm_substream *substream,
256 struct gen_pool *sram_pool, unsigned size,
263 struct snd_pcm_hardware *ppcm) 257 struct snd_pcm_hardware *ppcm)
264{ 258{
265 struct snd_dma_buffer *buf = &substream->dma_buffer; 259 struct snd_dma_buffer *buf = &substream->dma_buffer;
@@ -271,9 +265,10 @@ static int allocate_sram(struct snd_pcm_substream *substream, unsigned size,
271 return 0; 265 return 0;
272 266
273 ppcm->period_bytes_max = size; 267 ppcm->period_bytes_max = size;
274 iram_virt = sram_alloc(size, &iram_phys); 268 iram_virt = (void *)gen_pool_alloc(sram_pool, size);
275 if (!iram_virt) 269 if (!iram_virt)
276 goto exit1; 270 goto exit1;
271 iram_phys = gen_pool_virt_to_phys(sram_pool, (unsigned)iram_virt);
277 iram_dma = kzalloc(sizeof(*iram_dma), GFP_KERNEL); 272 iram_dma = kzalloc(sizeof(*iram_dma), GFP_KERNEL);
278 if (!iram_dma) 273 if (!iram_dma)
279 goto exit2; 274 goto exit2;
@@ -285,11 +280,33 @@ static int allocate_sram(struct snd_pcm_substream *substream, unsigned size,
285 return 0; 280 return 0;
286exit2: 281exit2:
287 if (iram_virt) 282 if (iram_virt)
288 sram_free(iram_virt, size); 283 gen_pool_free(sram_pool, (unsigned)iram_virt, size);
289exit1: 284exit1:
290 return -ENOMEM; 285 return -ENOMEM;
291} 286}
292 287
288static void davinci_free_sram(struct snd_pcm_substream *substream,
289 struct snd_dma_buffer *iram_dma)
290{
291 struct davinci_runtime_data *prtd = substream->runtime->private_data;
292 struct gen_pool *sram_pool = prtd->params->sram_pool;
293
294 gen_pool_free(sram_pool, (unsigned) iram_dma->area, iram_dma->bytes);
295}
296#else
297static int allocate_sram(struct snd_pcm_substream *substream,
298 struct gen_pool *sram_pool, unsigned size,
299 struct snd_pcm_hardware *ppcm)
300{
301 return 0;
302}
303
304static void davinci_free_sram(struct snd_pcm_substream *substream,
305 struct snd_dma_buffer *iram_dma)
306{
307}
308#endif
309
293/* 310/*
294 * Only used with ping/pong. 311 * Only used with ping/pong.
295 * This is called after runtime->dma_addr, period_bytes and data_type are valid 312 * This is called after runtime->dma_addr, period_bytes and data_type are valid
@@ -676,7 +693,7 @@ static int davinci_pcm_open(struct snd_pcm_substream *substream)
676 693
677 ppcm = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ? 694 ppcm = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) ?
678 &pcm_hardware_playback : &pcm_hardware_capture; 695 &pcm_hardware_playback : &pcm_hardware_capture;
679 allocate_sram(substream, params->sram_size, ppcm); 696 allocate_sram(substream, params->sram_pool, params->sram_size, ppcm);
680 snd_soc_set_runtime_hwparams(substream, ppcm); 697 snd_soc_set_runtime_hwparams(substream, ppcm);
681 /* ensure that buffer size is a multiple of period size */ 698 /* ensure that buffer size is a multiple of period size */
682 ret = snd_pcm_hw_constraint_integer(runtime, 699 ret = snd_pcm_hw_constraint_integer(runtime,
@@ -819,7 +836,7 @@ static void davinci_pcm_free(struct snd_pcm *pcm)
819 buf->area = NULL; 836 buf->area = NULL;
820 iram_dma = buf->private_data; 837 iram_dma = buf->private_data;
821 if (iram_dma) { 838 if (iram_dma) {
822 sram_free(iram_dma->area, iram_dma->bytes); 839 davinci_free_sram(substream, iram_dma);
823 kfree(iram_dma); 840 kfree(iram_dma);
824 } 841 }
825 } 842 }
diff --git a/sound/soc/davinci/davinci-pcm.h b/sound/soc/davinci/davinci-pcm.h
index fc4d01cdd8c9..b6ef7039dd09 100644
--- a/sound/soc/davinci/davinci-pcm.h
+++ b/sound/soc/davinci/davinci-pcm.h
@@ -12,6 +12,7 @@
12#ifndef _DAVINCI_PCM_H 12#ifndef _DAVINCI_PCM_H
13#define _DAVINCI_PCM_H 13#define _DAVINCI_PCM_H
14 14
15#include <linux/genalloc.h>
15#include <linux/platform_data/davinci_asp.h> 16#include <linux/platform_data/davinci_asp.h>
16#include <mach/edma.h> 17#include <mach/edma.h>
17 18
@@ -20,6 +21,7 @@ struct davinci_pcm_dma_params {
20 unsigned short acnt; 21 unsigned short acnt;
21 dma_addr_t dma_addr; /* device physical address for DMA */ 22 dma_addr_t dma_addr; /* device physical address for DMA */
22 unsigned sram_size; 23 unsigned sram_size;
24 struct gen_pool *sram_pool; /* SRAM gen_pool for ping pong */
23 enum dma_event_q asp_chan_q; /* event queue number for ASP channel */ 25 enum dma_event_q asp_chan_q; /* event queue number for ASP channel */
24 enum dma_event_q ram_chan_q; /* event queue number for RAM channel */ 26 enum dma_event_q ram_chan_q; /* event queue number for RAM channel */
25 unsigned char data_type; /* xfer data type */ 27 unsigned char data_type; /* xfer data type */
diff --git a/sound/soc/fsl/Kconfig b/sound/soc/fsl/Kconfig
index 4563b28bd625..3b98159d9645 100644
--- a/sound/soc/fsl/Kconfig
+++ b/sound/soc/fsl/Kconfig
@@ -46,6 +46,20 @@ config SND_SOC_P1022_DS
46 This will also include the Wolfson Microelectronics WM8776 codec 46 This will also include the Wolfson Microelectronics WM8776 codec
47 driver. 47 driver.
48 48
49config SND_SOC_P1022_RDK
50 tristate "ALSA SoC support for the Freescale / iVeia P1022 RDK board"
51 # I2C is necessary for the WM8960 driver
52 depends on P1022_RDK && I2C
53 select SND_SOC_FSL_SSI
54 select SND_SOC_FSL_UTILS
55 select SND_SOC_POWERPC_DMA
56 select SND_SOC_WM8960
57 default y if P1022_RDK
58 help
59 Say Y if you want to enable audio on the Freescale / iVeia
60 P1022 RDK board. This will also include the Wolfson
61 Microelectronics WM8960 codec driver.
62
49config SND_SOC_MPC5200_I2S 63config SND_SOC_MPC5200_I2S
50 tristate "Freescale MPC5200 PSC in I2S mode driver" 64 tristate "Freescale MPC5200 PSC in I2S mode driver"
51 depends on PPC_MPC52xx && PPC_BESTCOMM 65 depends on PPC_MPC52xx && PPC_BESTCOMM
@@ -98,12 +112,12 @@ config SND_SOC_IMX_PCM
98 tristate 112 tristate
99 113
100config SND_SOC_IMX_PCM_FIQ 114config SND_SOC_IMX_PCM_FIQ
101 tristate 115 bool
102 select FIQ 116 select FIQ
103 select SND_SOC_IMX_PCM 117 select SND_SOC_IMX_PCM
104 118
105config SND_SOC_IMX_PCM_DMA 119config SND_SOC_IMX_PCM_DMA
106 tristate 120 bool
107 select SND_SOC_DMAENGINE_PCM 121 select SND_SOC_DMAENGINE_PCM
108 select SND_SOC_IMX_PCM 122 select SND_SOC_IMX_PCM
109 123
@@ -112,7 +126,7 @@ config SND_SOC_IMX_AUDMUX
112 126
113config SND_MXC_SOC_WM1133_EV1 127config SND_MXC_SOC_WM1133_EV1
114 tristate "Audio on the i.MX31ADS with WM1133-EV1 fitted" 128 tristate "Audio on the i.MX31ADS with WM1133-EV1 fitted"
115 depends on MACH_MX31ADS_WM1133_EV1 && EXPERIMENTAL 129 depends on MACH_MX31ADS_WM1133_EV1
116 select SND_SOC_WM8350 130 select SND_SOC_WM8350
117 select SND_SOC_IMX_PCM_FIQ 131 select SND_SOC_IMX_PCM_FIQ
118 select SND_SOC_IMX_AUDMUX 132 select SND_SOC_IMX_AUDMUX
diff --git a/sound/soc/fsl/Makefile b/sound/soc/fsl/Makefile
index 5f3cf3f52ea0..afd34794db53 100644
--- a/sound/soc/fsl/Makefile
+++ b/sound/soc/fsl/Makefile
@@ -6,6 +6,10 @@ obj-$(CONFIG_SND_SOC_MPC8610_HPCD) += snd-soc-mpc8610-hpcd.o
6snd-soc-p1022-ds-objs := p1022_ds.o 6snd-soc-p1022-ds-objs := p1022_ds.o
7obj-$(CONFIG_SND_SOC_P1022_DS) += snd-soc-p1022-ds.o 7obj-$(CONFIG_SND_SOC_P1022_DS) += snd-soc-p1022-ds.o
8 8
9# P1022 RDK Machine Support
10snd-soc-p1022-rdk-objs := p1022_rdk.o
11obj-$(CONFIG_SND_SOC_P1022_RDK) += snd-soc-p1022-rdk.o
12
9# Freescale PowerPC SSI/DMA Platform Support 13# Freescale PowerPC SSI/DMA Platform Support
10snd-soc-fsl-ssi-objs := fsl_ssi.o 14snd-soc-fsl-ssi-objs := fsl_ssi.o
11snd-soc-fsl-utils-objs := fsl_utils.o 15snd-soc-fsl-utils-objs := fsl_utils.o
@@ -26,14 +30,18 @@ obj-$(CONFIG_SND_MPC52xx_SOC_EFIKA) += efika-audio-fabric.o
26# i.MX Platform Support 30# i.MX Platform Support
27snd-soc-imx-ssi-objs := imx-ssi.o 31snd-soc-imx-ssi-objs := imx-ssi.o
28snd-soc-imx-audmux-objs := imx-audmux.o 32snd-soc-imx-audmux-objs := imx-audmux.o
33snd-soc-imx-pcm-objs := imx-pcm.o
34ifneq ($(CONFIG_SND_SOC_IMX_PCM_FIQ),)
35 snd-soc-imx-pcm-objs += imx-pcm-fiq.o
36endif
37ifneq ($(CONFIG_SND_SOC_IMX_PCM_DMA),)
38 snd-soc-imx-pcm-objs += imx-pcm-dma.o
39endif
29 40
30obj-$(CONFIG_SND_SOC_IMX_SSI) += snd-soc-imx-ssi.o 41obj-$(CONFIG_SND_SOC_IMX_SSI) += snd-soc-imx-ssi.o
31obj-$(CONFIG_SND_SOC_IMX_AUDMUX) += snd-soc-imx-audmux.o 42obj-$(CONFIG_SND_SOC_IMX_AUDMUX) += snd-soc-imx-audmux.o
32 43
33obj-$(CONFIG_SND_SOC_IMX_PCM) += snd-soc-imx-pcm.o 44obj-$(CONFIG_SND_SOC_IMX_PCM) += snd-soc-imx-pcm.o
34snd-soc-imx-pcm-y := imx-pcm.o
35snd-soc-imx-pcm-$(CONFIG_SND_SOC_IMX_PCM_FIQ) += imx-pcm-fiq.o
36snd-soc-imx-pcm-$(CONFIG_SND_SOC_IMX_PCM_DMA) += imx-pcm-dma.o
37 45
38# i.MX Machine Support 46# i.MX Machine Support
39snd-soc-eukrea-tlv320-objs := eukrea-tlv320.o 47snd-soc-eukrea-tlv320-objs := eukrea-tlv320.o
diff --git a/sound/soc/fsl/eukrea-tlv320.c b/sound/soc/fsl/eukrea-tlv320.c
index 267d5b4b63ce..75ffdf0e2aad 100644
--- a/sound/soc/fsl/eukrea-tlv320.c
+++ b/sound/soc/fsl/eukrea-tlv320.c
@@ -93,7 +93,7 @@ static struct snd_soc_card eukrea_tlv320 = {
93 .num_links = 1, 93 .num_links = 1,
94}; 94};
95 95
96static int __devinit eukrea_tlv320_probe(struct platform_device *pdev) 96static int eukrea_tlv320_probe(struct platform_device *pdev)
97{ 97{
98 int ret; 98 int ret;
99 int int_port = 0, ext_port; 99 int int_port = 0, ext_port;
@@ -142,7 +142,7 @@ static int __devinit eukrea_tlv320_probe(struct platform_device *pdev)
142 return ret; 142 return ret;
143} 143}
144 144
145static int __devexit eukrea_tlv320_remove(struct platform_device *pdev) 145static int eukrea_tlv320_remove(struct platform_device *pdev)
146{ 146{
147 snd_soc_unregister_card(&eukrea_tlv320); 147 snd_soc_unregister_card(&eukrea_tlv320);
148 148
@@ -155,7 +155,7 @@ static struct platform_driver eukrea_tlv320_driver = {
155 .owner = THIS_MODULE, 155 .owner = THIS_MODULE,
156 }, 156 },
157 .probe = eukrea_tlv320_probe, 157 .probe = eukrea_tlv320_probe,
158 .remove = __devexit_p(eukrea_tlv320_remove),}; 158 .remove = eukrea_tlv320_remove,};
159 159
160module_platform_driver(eukrea_tlv320_driver); 160module_platform_driver(eukrea_tlv320_driver);
161 161
diff --git a/sound/soc/fsl/fsl_dma.c b/sound/soc/fsl/fsl_dma.c
index 6feb26500580..9cc5c1f82f09 100644
--- a/sound/soc/fsl/fsl_dma.c
+++ b/sound/soc/fsl/fsl_dma.c
@@ -894,7 +894,7 @@ static struct snd_pcm_ops fsl_dma_ops = {
894 .pointer = fsl_dma_pointer, 894 .pointer = fsl_dma_pointer,
895}; 895};
896 896
897static int __devinit fsl_soc_dma_probe(struct platform_device *pdev) 897static int fsl_soc_dma_probe(struct platform_device *pdev)
898 { 898 {
899 struct dma_object *dma; 899 struct dma_object *dma;
900 struct device_node *np = pdev->dev.of_node; 900 struct device_node *np = pdev->dev.of_node;
@@ -958,7 +958,7 @@ static int __devinit fsl_soc_dma_probe(struct platform_device *pdev)
958 return 0; 958 return 0;
959} 959}
960 960
961static int __devexit fsl_soc_dma_remove(struct platform_device *pdev) 961static int fsl_soc_dma_remove(struct platform_device *pdev)
962{ 962{
963 struct dma_object *dma = dev_get_drvdata(&pdev->dev); 963 struct dma_object *dma = dev_get_drvdata(&pdev->dev);
964 964
@@ -983,7 +983,7 @@ static struct platform_driver fsl_soc_dma_driver = {
983 .of_match_table = fsl_soc_dma_ids, 983 .of_match_table = fsl_soc_dma_ids,
984 }, 984 },
985 .probe = fsl_soc_dma_probe, 985 .probe = fsl_soc_dma_probe,
986 .remove = __devexit_p(fsl_soc_dma_remove), 986 .remove = fsl_soc_dma_remove,
987}; 987};
988 988
989module_platform_driver(fsl_soc_dma_driver); 989module_platform_driver(fsl_soc_dma_driver);
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index 4ed2afd47782..7decbd9b2340 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -639,7 +639,7 @@ static void make_lowercase(char *s)
639 } 639 }
640} 640}
641 641
642static int __devinit fsl_ssi_probe(struct platform_device *pdev) 642static int fsl_ssi_probe(struct platform_device *pdev)
643{ 643{
644 struct fsl_ssi_private *ssi_private; 644 struct fsl_ssi_private *ssi_private;
645 int ret = 0; 645 int ret = 0;
diff --git a/sound/soc/fsl/imx-audmux.c b/sound/soc/fsl/imx-audmux.c
index 524ce6210cee..251f4d981e0c 100644
--- a/sound/soc/fsl/imx-audmux.c
+++ b/sound/soc/fsl/imx-audmux.c
@@ -162,7 +162,7 @@ static void __init audmux_debugfs_init(void)
162 } 162 }
163} 163}
164 164
165static void __devexit audmux_debugfs_remove(void) 165static void audmux_debugfs_remove(void)
166{ 166{
167 debugfs_remove_recursive(audmux_debugfs_root); 167 debugfs_remove_recursive(audmux_debugfs_root);
168} 168}
@@ -244,7 +244,7 @@ int imx_audmux_v2_configure_port(unsigned int port, unsigned int ptcr,
244} 244}
245EXPORT_SYMBOL_GPL(imx_audmux_v2_configure_port); 245EXPORT_SYMBOL_GPL(imx_audmux_v2_configure_port);
246 246
247static int __devinit imx_audmux_probe(struct platform_device *pdev) 247static int imx_audmux_probe(struct platform_device *pdev)
248{ 248{
249 struct resource *res; 249 struct resource *res;
250 struct pinctrl *pinctrl; 250 struct pinctrl *pinctrl;
@@ -278,7 +278,7 @@ static int __devinit imx_audmux_probe(struct platform_device *pdev)
278 return 0; 278 return 0;
279} 279}
280 280
281static int __devexit imx_audmux_remove(struct platform_device *pdev) 281static int imx_audmux_remove(struct platform_device *pdev)
282{ 282{
283 if (audmux_type == IMX31_AUDMUX) 283 if (audmux_type == IMX31_AUDMUX)
284 audmux_debugfs_remove(); 284 audmux_debugfs_remove();
@@ -289,7 +289,7 @@ static int __devexit imx_audmux_remove(struct platform_device *pdev)
289 289
290static struct platform_driver imx_audmux_driver = { 290static struct platform_driver imx_audmux_driver = {
291 .probe = imx_audmux_probe, 291 .probe = imx_audmux_probe,
292 .remove = __devexit_p(imx_audmux_remove), 292 .remove = imx_audmux_remove,
293 .id_table = imx_audmux_ids, 293 .id_table = imx_audmux_ids,
294 .driver = { 294 .driver = {
295 .name = DRIVER_NAME, 295 .name = DRIVER_NAME,
diff --git a/sound/soc/fsl/imx-mc13783.c b/sound/soc/fsl/imx-mc13783.c
index 549b31fdc9dd..4ae30f21fdb5 100644
--- a/sound/soc/fsl/imx-mc13783.c
+++ b/sound/soc/fsl/imx-mc13783.c
@@ -98,7 +98,7 @@ static struct snd_soc_card imx_mc13783 = {
98 .num_dapm_routes = ARRAY_SIZE(imx_mc13783_routes), 98 .num_dapm_routes = ARRAY_SIZE(imx_mc13783_routes),
99}; 99};
100 100
101static int __devinit imx_mc13783_probe(struct platform_device *pdev) 101static int imx_mc13783_probe(struct platform_device *pdev)
102{ 102{
103 int ret; 103 int ret;
104 104
@@ -148,7 +148,7 @@ static int __devinit imx_mc13783_probe(struct platform_device *pdev)
148 return ret; 148 return ret;
149} 149}
150 150
151static int __devexit imx_mc13783_remove(struct platform_device *pdev) 151static int imx_mc13783_remove(struct platform_device *pdev)
152{ 152{
153 snd_soc_unregister_card(&imx_mc13783); 153 snd_soc_unregister_card(&imx_mc13783);
154 154
@@ -161,7 +161,7 @@ static struct platform_driver imx_mc13783_audio_driver = {
161 .owner = THIS_MODULE, 161 .owner = THIS_MODULE,
162 }, 162 },
163 .probe = imx_mc13783_probe, 163 .probe = imx_mc13783_probe,
164 .remove = __devexit_p(imx_mc13783_remove) 164 .remove = imx_mc13783_remove
165}; 165};
166 166
167module_platform_driver(imx_mc13783_audio_driver); 167module_platform_driver(imx_mc13783_audio_driver);
diff --git a/sound/soc/fsl/imx-pcm-dma.c b/sound/soc/fsl/imx-pcm-dma.c
index d85929b79c35..bf363d8d044a 100644
--- a/sound/soc/fsl/imx-pcm-dma.c
+++ b/sound/soc/fsl/imx-pcm-dma.c
@@ -154,12 +154,12 @@ static struct snd_soc_platform_driver imx_soc_platform_mx2 = {
154 .pcm_free = imx_pcm_free, 154 .pcm_free = imx_pcm_free,
155}; 155};
156 156
157static int __devinit imx_soc_platform_probe(struct platform_device *pdev) 157static int imx_soc_platform_probe(struct platform_device *pdev)
158{ 158{
159 return snd_soc_register_platform(&pdev->dev, &imx_soc_platform_mx2); 159 return snd_soc_register_platform(&pdev->dev, &imx_soc_platform_mx2);
160} 160}
161 161
162static int __devexit imx_soc_platform_remove(struct platform_device *pdev) 162static int imx_soc_platform_remove(struct platform_device *pdev)
163{ 163{
164 snd_soc_unregister_platform(&pdev->dev); 164 snd_soc_unregister_platform(&pdev->dev);
165 return 0; 165 return 0;
@@ -171,7 +171,7 @@ static struct platform_driver imx_pcm_driver = {
171 .owner = THIS_MODULE, 171 .owner = THIS_MODULE,
172 }, 172 },
173 .probe = imx_soc_platform_probe, 173 .probe = imx_soc_platform_probe,
174 .remove = __devexit_p(imx_soc_platform_remove), 174 .remove = imx_soc_platform_remove,
175}; 175};
176 176
177module_platform_driver(imx_pcm_driver); 177module_platform_driver(imx_pcm_driver);
diff --git a/sound/soc/fsl/imx-pcm-fiq.c b/sound/soc/fsl/imx-pcm-fiq.c
index 9ffc9e66308f..5ec362ae4d01 100644
--- a/sound/soc/fsl/imx-pcm-fiq.c
+++ b/sound/soc/fsl/imx-pcm-fiq.c
@@ -281,7 +281,7 @@ static struct snd_soc_platform_driver imx_soc_platform_fiq = {
281 .pcm_free = imx_pcm_fiq_free, 281 .pcm_free = imx_pcm_fiq_free,
282}; 282};
283 283
284static int __devinit imx_soc_platform_probe(struct platform_device *pdev) 284static int imx_soc_platform_probe(struct platform_device *pdev)
285{ 285{
286 struct imx_ssi *ssi = platform_get_drvdata(pdev); 286 struct imx_ssi *ssi = platform_get_drvdata(pdev);
287 int ret; 287 int ret;
@@ -315,7 +315,7 @@ failed_register:
315 return ret; 315 return ret;
316} 316}
317 317
318static int __devexit imx_soc_platform_remove(struct platform_device *pdev) 318static int imx_soc_platform_remove(struct platform_device *pdev)
319{ 319{
320 snd_soc_unregister_platform(&pdev->dev); 320 snd_soc_unregister_platform(&pdev->dev);
321 return 0; 321 return 0;
@@ -328,7 +328,7 @@ static struct platform_driver imx_pcm_driver = {
328 }, 328 },
329 329
330 .probe = imx_soc_platform_probe, 330 .probe = imx_soc_platform_probe,
331 .remove = __devexit_p(imx_soc_platform_remove), 331 .remove = imx_soc_platform_remove,
332}; 332};
333 333
334module_platform_driver(imx_pcm_driver); 334module_platform_driver(imx_pcm_driver);
diff --git a/sound/soc/fsl/imx-pcm.c b/sound/soc/fsl/imx-pcm.c
index 93dc360b1777..d5cd9eff3b48 100644
--- a/sound/soc/fsl/imx-pcm.c
+++ b/sound/soc/fsl/imx-pcm.c
@@ -103,3 +103,7 @@ void imx_pcm_free(struct snd_pcm *pcm)
103 } 103 }
104} 104}
105EXPORT_SYMBOL_GPL(imx_pcm_free); 105EXPORT_SYMBOL_GPL(imx_pcm_free);
106
107MODULE_DESCRIPTION("Freescale i.MX PCM driver");
108MODULE_AUTHOR("Sascha Hauer <s.hauer@pengutronix.de>");
109MODULE_LICENSE("GPL");
diff --git a/sound/soc/fsl/imx-sgtl5000.c b/sound/soc/fsl/imx-sgtl5000.c
index 199408ec4261..424347e9b2d7 100644
--- a/sound/soc/fsl/imx-sgtl5000.c
+++ b/sound/soc/fsl/imx-sgtl5000.c
@@ -56,7 +56,7 @@ static const struct snd_soc_dapm_widget imx_sgtl5000_dapm_widgets[] = {
56 SND_SOC_DAPM_SPK("Ext Spk", NULL), 56 SND_SOC_DAPM_SPK("Ext Spk", NULL),
57}; 57};
58 58
59static int __devinit imx_sgtl5000_probe(struct platform_device *pdev) 59static int imx_sgtl5000_probe(struct platform_device *pdev)
60{ 60{
61 struct device_node *np = pdev->dev.of_node; 61 struct device_node *np = pdev->dev.of_node;
62 struct device_node *ssi_np, *codec_np; 62 struct device_node *ssi_np, *codec_np;
@@ -162,6 +162,7 @@ static int __devinit imx_sgtl5000_probe(struct platform_device *pdev)
162 if (ret) 162 if (ret)
163 goto clk_fail; 163 goto clk_fail;
164 data->card.num_links = 1; 164 data->card.num_links = 1;
165 data->card.owner = THIS_MODULE;
165 data->card.dai_link = &data->dai; 166 data->card.dai_link = &data->dai;
166 data->card.dapm_widgets = imx_sgtl5000_dapm_widgets; 167 data->card.dapm_widgets = imx_sgtl5000_dapm_widgets;
167 data->card.num_dapm_widgets = ARRAY_SIZE(imx_sgtl5000_dapm_widgets); 168 data->card.num_dapm_widgets = ARRAY_SIZE(imx_sgtl5000_dapm_widgets);
@@ -184,7 +185,7 @@ fail:
184 return ret; 185 return ret;
185} 186}
186 187
187static int __devexit imx_sgtl5000_remove(struct platform_device *pdev) 188static int imx_sgtl5000_remove(struct platform_device *pdev)
188{ 189{
189 struct imx_sgtl5000_data *data = platform_get_drvdata(pdev); 190 struct imx_sgtl5000_data *data = platform_get_drvdata(pdev);
190 191
@@ -210,7 +211,7 @@ static struct platform_driver imx_sgtl5000_driver = {
210 .of_match_table = imx_sgtl5000_dt_ids, 211 .of_match_table = imx_sgtl5000_dt_ids,
211 }, 212 },
212 .probe = imx_sgtl5000_probe, 213 .probe = imx_sgtl5000_probe,
213 .remove = __devexit_p(imx_sgtl5000_remove), 214 .remove = imx_sgtl5000_remove,
214}; 215};
215module_platform_driver(imx_sgtl5000_driver); 216module_platform_driver(imx_sgtl5000_driver);
216 217
diff --git a/sound/soc/fsl/imx-ssi.c b/sound/soc/fsl/imx-ssi.c
index dd566444e3c3..3b480423747f 100644
--- a/sound/soc/fsl/imx-ssi.c
+++ b/sound/soc/fsl/imx-ssi.c
@@ -638,7 +638,7 @@ failed_clk:
638 return ret; 638 return ret;
639} 639}
640 640
641static int __devexit imx_ssi_remove(struct platform_device *pdev) 641static int imx_ssi_remove(struct platform_device *pdev)
642{ 642{
643 struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 643 struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
644 struct imx_ssi *ssi = platform_get_drvdata(pdev); 644 struct imx_ssi *ssi = platform_get_drvdata(pdev);
@@ -659,7 +659,7 @@ static int __devexit imx_ssi_remove(struct platform_device *pdev)
659 659
660static struct platform_driver imx_ssi_driver = { 660static struct platform_driver imx_ssi_driver = {
661 .probe = imx_ssi_probe, 661 .probe = imx_ssi_probe,
662 .remove = __devexit_p(imx_ssi_remove), 662 .remove = imx_ssi_remove,
663 663
664 .driver = { 664 .driver = {
665 .name = "imx-ssi", 665 .name = "imx-ssi",
diff --git a/sound/soc/fsl/mpc5200_psc_ac97.c b/sound/soc/fsl/mpc5200_psc_ac97.c
index a313c0ae36db..a4aec0488dd3 100644
--- a/sound/soc/fsl/mpc5200_psc_ac97.c
+++ b/sound/soc/fsl/mpc5200_psc_ac97.c
@@ -277,7 +277,7 @@ static struct snd_soc_dai_driver psc_ac97_dai[] = {
277 * - Probe/remove operations 277 * - Probe/remove operations
278 * - OF device match table 278 * - OF device match table
279 */ 279 */
280static int __devinit psc_ac97_of_probe(struct platform_device *op) 280static int psc_ac97_of_probe(struct platform_device *op)
281{ 281{
282 int rc; 282 int rc;
283 struct snd_ac97 ac97; 283 struct snd_ac97 ac97;
@@ -310,7 +310,7 @@ static int __devinit psc_ac97_of_probe(struct platform_device *op)
310 return 0; 310 return 0;
311} 311}
312 312
313static int __devexit psc_ac97_of_remove(struct platform_device *op) 313static int psc_ac97_of_remove(struct platform_device *op)
314{ 314{
315 mpc5200_audio_dma_destroy(op); 315 mpc5200_audio_dma_destroy(op);
316 snd_soc_unregister_dais(&op->dev, ARRAY_SIZE(psc_ac97_dai)); 316 snd_soc_unregister_dais(&op->dev, ARRAY_SIZE(psc_ac97_dai));
@@ -318,7 +318,7 @@ static int __devexit psc_ac97_of_remove(struct platform_device *op)
318} 318}
319 319
320/* Match table for of_platform binding */ 320/* Match table for of_platform binding */
321static struct of_device_id psc_ac97_match[] __devinitdata = { 321static struct of_device_id psc_ac97_match[] = {
322 { .compatible = "fsl,mpc5200-psc-ac97", }, 322 { .compatible = "fsl,mpc5200-psc-ac97", },
323 { .compatible = "fsl,mpc5200b-psc-ac97", }, 323 { .compatible = "fsl,mpc5200b-psc-ac97", },
324 {} 324 {}
@@ -327,7 +327,7 @@ MODULE_DEVICE_TABLE(of, psc_ac97_match);
327 327
328static struct platform_driver psc_ac97_driver = { 328static struct platform_driver psc_ac97_driver = {
329 .probe = psc_ac97_of_probe, 329 .probe = psc_ac97_of_probe,
330 .remove = __devexit_p(psc_ac97_of_remove), 330 .remove = psc_ac97_of_remove,
331 .driver = { 331 .driver = {
332 .name = "mpc5200-psc-ac97", 332 .name = "mpc5200-psc-ac97",
333 .owner = THIS_MODULE, 333 .owner = THIS_MODULE,
diff --git a/sound/soc/fsl/mpc5200_psc_i2s.c b/sound/soc/fsl/mpc5200_psc_i2s.c
index ba1f0a66358f..b95b966f25a0 100644
--- a/sound/soc/fsl/mpc5200_psc_i2s.c
+++ b/sound/soc/fsl/mpc5200_psc_i2s.c
@@ -153,7 +153,7 @@ static struct snd_soc_dai_driver psc_i2s_dai[] = {{
153 * - Probe/remove operations 153 * - Probe/remove operations
154 * - OF device match table 154 * - OF device match table
155 */ 155 */
156static int __devinit psc_i2s_of_probe(struct platform_device *op) 156static int psc_i2s_of_probe(struct platform_device *op)
157{ 157{
158 int rc; 158 int rc;
159 struct psc_dma *psc_dma; 159 struct psc_dma *psc_dma;
@@ -205,7 +205,7 @@ static int __devinit psc_i2s_of_probe(struct platform_device *op)
205 205
206} 206}
207 207
208static int __devexit psc_i2s_of_remove(struct platform_device *op) 208static int psc_i2s_of_remove(struct platform_device *op)
209{ 209{
210 mpc5200_audio_dma_destroy(op); 210 mpc5200_audio_dma_destroy(op);
211 snd_soc_unregister_dais(&op->dev, ARRAY_SIZE(psc_i2s_dai)); 211 snd_soc_unregister_dais(&op->dev, ARRAY_SIZE(psc_i2s_dai));
@@ -213,7 +213,7 @@ static int __devexit psc_i2s_of_remove(struct platform_device *op)
213} 213}
214 214
215/* Match table for of_platform binding */ 215/* Match table for of_platform binding */
216static struct of_device_id psc_i2s_match[] __devinitdata = { 216static struct of_device_id psc_i2s_match[] = {
217 { .compatible = "fsl,mpc5200-psc-i2s", }, 217 { .compatible = "fsl,mpc5200-psc-i2s", },
218 { .compatible = "fsl,mpc5200b-psc-i2s", }, 218 { .compatible = "fsl,mpc5200b-psc-i2s", },
219 {} 219 {}
@@ -222,7 +222,7 @@ MODULE_DEVICE_TABLE(of, psc_i2s_match);
222 222
223static struct platform_driver psc_i2s_driver = { 223static struct platform_driver psc_i2s_driver = {
224 .probe = psc_i2s_of_probe, 224 .probe = psc_i2s_of_probe,
225 .remove = __devexit_p(psc_i2s_of_remove), 225 .remove = psc_i2s_of_remove,
226 .driver = { 226 .driver = {
227 .name = "mpc5200-psc-i2s", 227 .name = "mpc5200-psc-i2s",
228 .owner = THIS_MODULE, 228 .owner = THIS_MODULE,
diff --git a/sound/soc/fsl/mpc8610_hpcd.c b/sound/soc/fsl/mpc8610_hpcd.c
index 9ff9318c52b9..228c52e71440 100644
--- a/sound/soc/fsl/mpc8610_hpcd.c
+++ b/sound/soc/fsl/mpc8610_hpcd.c
@@ -368,7 +368,7 @@ error_alloc:
368 * 368 *
369 * This function is called when the platform device is removed. 369 * This function is called when the platform device is removed.
370 */ 370 */
371static int __devexit mpc8610_hpcd_remove(struct platform_device *pdev) 371static int mpc8610_hpcd_remove(struct platform_device *pdev)
372{ 372{
373 struct snd_soc_card *card = platform_get_drvdata(pdev); 373 struct snd_soc_card *card = platform_get_drvdata(pdev);
374 struct mpc8610_hpcd_data *machine_data = 374 struct mpc8610_hpcd_data *machine_data =
@@ -382,7 +382,7 @@ static int __devexit mpc8610_hpcd_remove(struct platform_device *pdev)
382 382
383static struct platform_driver mpc8610_hpcd_driver = { 383static struct platform_driver mpc8610_hpcd_driver = {
384 .probe = mpc8610_hpcd_probe, 384 .probe = mpc8610_hpcd_probe,
385 .remove = __devexit_p(mpc8610_hpcd_remove), 385 .remove = mpc8610_hpcd_remove,
386 .driver = { 386 .driver = {
387 /* The name must match 'compatible' property in the device tree, 387 /* The name must match 'compatible' property in the device tree,
388 * in lowercase letters. 388 * in lowercase letters.
diff --git a/sound/soc/fsl/mx27vis-aic32x4.c b/sound/soc/fsl/mx27vis-aic32x4.c
index 2b76877b1789..3d1074179057 100644
--- a/sound/soc/fsl/mx27vis-aic32x4.c
+++ b/sound/soc/fsl/mx27vis-aic32x4.c
@@ -180,7 +180,7 @@ static struct snd_soc_card mx27vis_aic32x4 = {
180 .num_dapm_routes = ARRAY_SIZE(aic32x4_dapm_routes), 180 .num_dapm_routes = ARRAY_SIZE(aic32x4_dapm_routes),
181}; 181};
182 182
183static int __devinit mx27vis_aic32x4_probe(struct platform_device *pdev) 183static int mx27vis_aic32x4_probe(struct platform_device *pdev)
184{ 184{
185 struct snd_mx27vis_platform_data *pdata = pdev->dev.platform_data; 185 struct snd_mx27vis_platform_data *pdata = pdev->dev.platform_data;
186 int ret; 186 int ret;
@@ -219,7 +219,7 @@ static int __devinit mx27vis_aic32x4_probe(struct platform_device *pdev)
219 return ret; 219 return ret;
220} 220}
221 221
222static int __devexit mx27vis_aic32x4_remove(struct platform_device *pdev) 222static int mx27vis_aic32x4_remove(struct platform_device *pdev)
223{ 223{
224 snd_soc_unregister_card(&mx27vis_aic32x4); 224 snd_soc_unregister_card(&mx27vis_aic32x4);
225 225
@@ -232,7 +232,7 @@ static struct platform_driver mx27vis_aic32x4_audio_driver = {
232 .owner = THIS_MODULE, 232 .owner = THIS_MODULE,
233 }, 233 },
234 .probe = mx27vis_aic32x4_probe, 234 .probe = mx27vis_aic32x4_probe,
235 .remove = __devexit_p(mx27vis_aic32x4_remove), 235 .remove = mx27vis_aic32x4_remove,
236}; 236};
237 237
238module_platform_driver(mx27vis_aic32x4_audio_driver); 238module_platform_driver(mx27vis_aic32x4_audio_driver);
diff --git a/sound/soc/fsl/p1022_ds.c b/sound/soc/fsl/p1022_ds.c
index 144d49603637..ba59c23a137b 100644
--- a/sound/soc/fsl/p1022_ds.c
+++ b/sound/soc/fsl/p1022_ds.c
@@ -376,7 +376,7 @@ error_put:
376 * 376 *
377 * This function is called when the platform device is removed. 377 * This function is called when the platform device is removed.
378 */ 378 */
379static int __devexit p1022_ds_remove(struct platform_device *pdev) 379static int p1022_ds_remove(struct platform_device *pdev)
380{ 380{
381 struct snd_soc_card *card = platform_get_drvdata(pdev); 381 struct snd_soc_card *card = platform_get_drvdata(pdev);
382 struct machine_data *mdata = 382 struct machine_data *mdata =
@@ -390,7 +390,7 @@ static int __devexit p1022_ds_remove(struct platform_device *pdev)
390 390
391static struct platform_driver p1022_ds_driver = { 391static struct platform_driver p1022_ds_driver = {
392 .probe = p1022_ds_probe, 392 .probe = p1022_ds_probe,
393 .remove = __devexit_p(p1022_ds_remove), 393 .remove = p1022_ds_remove,
394 .driver = { 394 .driver = {
395 /* 395 /*
396 * The name must match 'compatible' property in the device tree, 396 * The name must match 'compatible' property in the device tree,
diff --git a/sound/soc/fsl/p1022_rdk.c b/sound/soc/fsl/p1022_rdk.c
new file mode 100644
index 000000000000..f21551911533
--- /dev/null
+++ b/sound/soc/fsl/p1022_rdk.c
@@ -0,0 +1,392 @@
1/**
2 * Freescale P1022RDK ALSA SoC Machine driver
3 *
4 * Author: Timur Tabi <timur@freescale.com>
5 *
6 * Copyright 2012 Freescale Semiconductor, Inc.
7 *
8 * This file is licensed under the terms of the GNU General Public License
9 * version 2. This program is licensed "as is" without any warranty of any
10 * kind, whether express or implied.
11 *
12 * Note: in order for audio to work correctly, the output controls need
13 * to be enabled, because they control the clock. So for playback, for
14 * example:
15 *
16 * amixer sset 'Left Output Mixer PCM' on
17 * amixer sset 'Right Output Mixer PCM' on
18 */
19
20#include <linux/module.h>
21#include <linux/interrupt.h>
22#include <linux/of_device.h>
23#include <linux/slab.h>
24#include <sound/soc.h>
25#include <asm/fsl_guts.h>
26
27#include "fsl_dma.h"
28#include "fsl_ssi.h"
29#include "fsl_utils.h"
30
31/* P1022-specific PMUXCR and DMUXCR bit definitions */
32
33#define CCSR_GUTS_PMUXCR_UART0_I2C1_MASK 0x0001c000
34#define CCSR_GUTS_PMUXCR_UART0_I2C1_UART0_SSI 0x00010000
35#define CCSR_GUTS_PMUXCR_UART0_I2C1_SSI 0x00018000
36
37#define CCSR_GUTS_PMUXCR_SSI_DMA_TDM_MASK 0x00000c00
38#define CCSR_GUTS_PMUXCR_SSI_DMA_TDM_SSI 0x00000000
39
40#define CCSR_GUTS_DMUXCR_PAD 1 /* DMA controller/channel set to pad */
41#define CCSR_GUTS_DMUXCR_SSI 2 /* DMA controller/channel set to SSI */
42
43/*
44 * Set the DMACR register in the GUTS
45 *
46 * The DMACR register determines the source of initiated transfers for each
47 * channel on each DMA controller. Rather than have a bunch of repetitive
48 * macros for the bit patterns, we just have a function that calculates
49 * them.
50 *
51 * guts: Pointer to GUTS structure
52 * co: The DMA controller (0 or 1)
53 * ch: The channel on the DMA controller (0, 1, 2, or 3)
54 * device: The device to set as the target (CCSR_GUTS_DMUXCR_xxx)
55 */
56static inline void guts_set_dmuxcr(struct ccsr_guts __iomem *guts,
57 unsigned int co, unsigned int ch, unsigned int device)
58{
59 unsigned int shift = 16 + (8 * (1 - co) + 2 * (3 - ch));
60
61 clrsetbits_be32(&guts->dmuxcr, 3 << shift, device << shift);
62}
63
64/* There's only one global utilities register */
65static phys_addr_t guts_phys;
66
67/**
68 * machine_data: machine-specific ASoC device data
69 *
70 * This structure contains data for a single sound platform device on an
71 * P1022 RDK. Some of the data is taken from the device tree.
72 */
73struct machine_data {
74 struct snd_soc_dai_link dai[2];
75 struct snd_soc_card card;
76 unsigned int dai_format;
77 unsigned int codec_clk_direction;
78 unsigned int cpu_clk_direction;
79 unsigned int clk_frequency;
80 unsigned int dma_id[2]; /* 0 = DMA1, 1 = DMA2, etc */
81 unsigned int dma_channel_id[2]; /* 0 = ch 0, 1 = ch 1, etc*/
82 char platform_name[2][DAI_NAME_SIZE]; /* One for each DMA channel */
83};
84
85/**
86 * p1022_rdk_machine_probe: initialize the board
87 *
88 * This function is used to initialize the board-specific hardware.
89 *
90 * Here we program the DMACR and PMUXCR registers.
91 */
92static int p1022_rdk_machine_probe(struct snd_soc_card *card)
93{
94 struct machine_data *mdata =
95 container_of(card, struct machine_data, card);
96 struct ccsr_guts __iomem *guts;
97
98 guts = ioremap(guts_phys, sizeof(struct ccsr_guts));
99 if (!guts) {
100 dev_err(card->dev, "could not map global utilities\n");
101 return -ENOMEM;
102 }
103
104 /* Enable SSI Tx signal */
105 clrsetbits_be32(&guts->pmuxcr, CCSR_GUTS_PMUXCR_UART0_I2C1_MASK,
106 CCSR_GUTS_PMUXCR_UART0_I2C1_UART0_SSI);
107
108 /* Enable SSI Rx signal */
109 clrsetbits_be32(&guts->pmuxcr, CCSR_GUTS_PMUXCR_SSI_DMA_TDM_MASK,
110 CCSR_GUTS_PMUXCR_SSI_DMA_TDM_SSI);
111
112 /* Enable DMA Channel for SSI */
113 guts_set_dmuxcr(guts, mdata->dma_id[0], mdata->dma_channel_id[0],
114 CCSR_GUTS_DMUXCR_SSI);
115
116 guts_set_dmuxcr(guts, mdata->dma_id[1], mdata->dma_channel_id[1],
117 CCSR_GUTS_DMUXCR_SSI);
118
119 iounmap(guts);
120
121 return 0;
122}
123
124/**
125 * p1022_rdk_startup: program the board with various hardware parameters
126 *
127 * This function takes board-specific information, like clock frequencies
128 * and serial data formats, and passes that information to the codec and
129 * transport drivers.
130 */
131static int p1022_rdk_startup(struct snd_pcm_substream *substream)
132{
133 struct snd_soc_pcm_runtime *rtd = substream->private_data;
134 struct machine_data *mdata =
135 container_of(rtd->card, struct machine_data, card);
136 struct device *dev = rtd->card->dev;
137 int ret = 0;
138
139 /* Tell the codec driver what the serial protocol is. */
140 ret = snd_soc_dai_set_fmt(rtd->codec_dai, mdata->dai_format);
141 if (ret < 0) {
142 dev_err(dev, "could not set codec driver audio format (ret=%i)\n",
143 ret);
144 return ret;
145 }
146
147 ret = snd_soc_dai_set_pll(rtd->codec_dai, 0, 0, mdata->clk_frequency,
148 mdata->clk_frequency);
149 if (ret < 0) {
150 dev_err(dev, "could not set codec PLL frequency (ret=%i)\n",
151 ret);
152 return ret;
153 }
154
155 return 0;
156}
157
158/**
159 * p1022_rdk_machine_remove: Remove the sound device
160 *
161 * This function is called to remove the sound device for one SSI. We
162 * de-program the DMACR and PMUXCR register.
163 */
164static int p1022_rdk_machine_remove(struct snd_soc_card *card)
165{
166 struct machine_data *mdata =
167 container_of(card, struct machine_data, card);
168 struct ccsr_guts __iomem *guts;
169
170 guts = ioremap(guts_phys, sizeof(struct ccsr_guts));
171 if (!guts) {
172 dev_err(card->dev, "could not map global utilities\n");
173 return -ENOMEM;
174 }
175
176 /* Restore the signal routing */
177 clrbits32(&guts->pmuxcr, CCSR_GUTS_PMUXCR_UART0_I2C1_MASK);
178 clrbits32(&guts->pmuxcr, CCSR_GUTS_PMUXCR_SSI_DMA_TDM_MASK);
179 guts_set_dmuxcr(guts, mdata->dma_id[0], mdata->dma_channel_id[0], 0);
180 guts_set_dmuxcr(guts, mdata->dma_id[1], mdata->dma_channel_id[1], 0);
181
182 iounmap(guts);
183
184 return 0;
185}
186
187/**
188 * p1022_rdk_ops: ASoC machine driver operations
189 */
190static struct snd_soc_ops p1022_rdk_ops = {
191 .startup = p1022_rdk_startup,
192};
193
194/**
195 * p1022_rdk_probe: platform probe function for the machine driver
196 *
197 * Although this is a machine driver, the SSI node is the "master" node with
198 * respect to audio hardware connections. Therefore, we create a new ASoC
199 * device for each new SSI node that has a codec attached.
200 */
201static int p1022_rdk_probe(struct platform_device *pdev)
202{
203 struct device *dev = pdev->dev.parent;
204 /* ssi_pdev is the platform device for the SSI node that probed us */
205 struct platform_device *ssi_pdev =
206 container_of(dev, struct platform_device, dev);
207 struct device_node *np = ssi_pdev->dev.of_node;
208 struct device_node *codec_np = NULL;
209 struct machine_data *mdata;
210 const u32 *iprop;
211 int ret;
212
213 /* Find the codec node for this SSI. */
214 codec_np = of_parse_phandle(np, "codec-handle", 0);
215 if (!codec_np) {
216 dev_err(dev, "could not find codec node\n");
217 return -EINVAL;
218 }
219
220 mdata = kzalloc(sizeof(struct machine_data), GFP_KERNEL);
221 if (!mdata) {
222 ret = -ENOMEM;
223 goto error_put;
224 }
225
226 mdata->dai[0].cpu_dai_name = dev_name(&ssi_pdev->dev);
227 mdata->dai[0].ops = &p1022_rdk_ops;
228
229 /* ASoC core can match codec with device node */
230 mdata->dai[0].codec_of_node = codec_np;
231
232 /*
233 * We register two DAIs per SSI, one for playback and the other for
234 * capture. We support codecs that have separate DAIs for both playback
235 * and capture.
236 */
237 memcpy(&mdata->dai[1], &mdata->dai[0], sizeof(struct snd_soc_dai_link));
238
239 /* The DAI names from the codec (snd_soc_dai_driver.name) */
240 mdata->dai[0].codec_dai_name = "wm8960-hifi";
241 mdata->dai[1].codec_dai_name = mdata->dai[0].codec_dai_name;
242
243 /*
244 * Configure the SSI for I2S slave mode. Older device trees have
245 * an fsl,mode property, but we ignore that since there's really
246 * only one way to configure the SSI.
247 */
248 mdata->dai_format = SND_SOC_DAIFMT_NB_NF |
249 SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBM_CFM;
250 mdata->codec_clk_direction = SND_SOC_CLOCK_OUT;
251 mdata->cpu_clk_direction = SND_SOC_CLOCK_IN;
252
253 /*
254 * In i2s-slave mode, the codec has its own clock source, so we
255 * need to get the frequency from the device tree and pass it to
256 * the codec driver.
257 */
258 iprop = of_get_property(codec_np, "clock-frequency", NULL);
259 if (!iprop || !*iprop) {
260 dev_err(&pdev->dev, "codec bus-frequency property is missing or invalid\n");
261 ret = -EINVAL;
262 goto error;
263 }
264 mdata->clk_frequency = be32_to_cpup(iprop);
265
266 if (!mdata->clk_frequency) {
267 dev_err(&pdev->dev, "unknown clock frequency\n");
268 ret = -EINVAL;
269 goto error;
270 }
271
272 /* Find the playback DMA channel to use. */
273 mdata->dai[0].platform_name = mdata->platform_name[0];
274 ret = fsl_asoc_get_dma_channel(np, "fsl,playback-dma", &mdata->dai[0],
275 &mdata->dma_channel_id[0],
276 &mdata->dma_id[0]);
277 if (ret) {
278 dev_err(&pdev->dev, "missing/invalid playback DMA phandle (ret=%i)\n",
279 ret);
280 goto error;
281 }
282
283 /* Find the capture DMA channel to use. */
284 mdata->dai[1].platform_name = mdata->platform_name[1];
285 ret = fsl_asoc_get_dma_channel(np, "fsl,capture-dma", &mdata->dai[1],
286 &mdata->dma_channel_id[1],
287 &mdata->dma_id[1]);
288 if (ret) {
289 dev_err(&pdev->dev, "missing/invalid capture DMA phandle (ret=%i)\n",
290 ret);
291 goto error;
292 }
293
294 /* Initialize our DAI data structure. */
295 mdata->dai[0].stream_name = "playback";
296 mdata->dai[1].stream_name = "capture";
297 mdata->dai[0].name = mdata->dai[0].stream_name;
298 mdata->dai[1].name = mdata->dai[1].stream_name;
299
300 mdata->card.probe = p1022_rdk_machine_probe;
301 mdata->card.remove = p1022_rdk_machine_remove;
302 mdata->card.name = pdev->name; /* The platform driver name */
303 mdata->card.owner = THIS_MODULE;
304 mdata->card.dev = &pdev->dev;
305 mdata->card.num_links = 2;
306 mdata->card.dai_link = mdata->dai;
307
308 /* Register with ASoC */
309 ret = snd_soc_register_card(&mdata->card);
310 if (ret) {
311 dev_err(&pdev->dev, "could not register card (ret=%i)\n", ret);
312 goto error;
313 }
314
315 return 0;
316
317error:
318 kfree(mdata);
319error_put:
320 of_node_put(codec_np);
321 return ret;
322}
323
324/**
325 * p1022_rdk_remove: remove the platform device
326 *
327 * This function is called when the platform device is removed.
328 */
329static int p1022_rdk_remove(struct platform_device *pdev)
330{
331 struct snd_soc_card *card = platform_get_drvdata(pdev);
332 struct machine_data *mdata =
333 container_of(card, struct machine_data, card);
334
335 snd_soc_unregister_card(card);
336 kfree(mdata);
337
338 return 0;
339}
340
341static struct platform_driver p1022_rdk_driver = {
342 .probe = p1022_rdk_probe,
343 .remove = p1022_rdk_remove,
344 .driver = {
345 /*
346 * The name must match 'compatible' property in the device tree,
347 * in lowercase letters.
348 */
349 .name = "snd-soc-p1022rdk",
350 .owner = THIS_MODULE,
351 },
352};
353
354/**
355 * p1022_rdk_init: machine driver initialization.
356 *
357 * This function is called when this module is loaded.
358 */
359static int __init p1022_rdk_init(void)
360{
361 struct device_node *guts_np;
362 struct resource res;
363
364 /* Get the physical address of the global utilities registers */
365 guts_np = of_find_compatible_node(NULL, NULL, "fsl,p1022-guts");
366 if (of_address_to_resource(guts_np, 0, &res)) {
367 pr_err("snd-soc-p1022rdk: missing/invalid global utils node\n");
368 of_node_put(guts_np);
369 return -EINVAL;
370 }
371 guts_phys = res.start;
372 of_node_put(guts_np);
373
374 return platform_driver_register(&p1022_rdk_driver);
375}
376
377/**
378 * p1022_rdk_exit: machine driver exit
379 *
380 * This function is called when this driver is unloaded.
381 */
382static void __exit p1022_rdk_exit(void)
383{
384 platform_driver_unregister(&p1022_rdk_driver);
385}
386
387late_initcall(p1022_rdk_init);
388module_exit(p1022_rdk_exit);
389
390MODULE_AUTHOR("Timur Tabi <timur@freescale.com>");
391MODULE_DESCRIPTION("Freescale / iVeia P1022 RDK ALSA SoC machine driver");
392MODULE_LICENSE("GPL v2");
diff --git a/sound/soc/fsl/pcm030-audio-fabric.c b/sound/soc/fsl/pcm030-audio-fabric.c
index 4b63ec8eb372..8e52c1485df3 100644
--- a/sound/soc/fsl/pcm030-audio-fabric.c
+++ b/sound/soc/fsl/pcm030-audio-fabric.c
@@ -29,14 +29,14 @@ struct pcm030_audio_data {
29 29
30static struct snd_soc_dai_link pcm030_fabric_dai[] = { 30static struct snd_soc_dai_link pcm030_fabric_dai[] = {
31{ 31{
32 .name = "AC97", 32 .name = "AC97.0",
33 .stream_name = "AC97 Analog", 33 .stream_name = "AC97 Analog",
34 .codec_dai_name = "wm9712-hifi", 34 .codec_dai_name = "wm9712-hifi",
35 .cpu_dai_name = "mpc5200-psc-ac97.0", 35 .cpu_dai_name = "mpc5200-psc-ac97.0",
36 .codec_name = "wm9712-codec", 36 .codec_name = "wm9712-codec",
37}, 37},
38{ 38{
39 .name = "AC97", 39 .name = "AC97.1",
40 .stream_name = "AC97 IEC958", 40 .stream_name = "AC97 IEC958",
41 .codec_dai_name = "wm9712-aux", 41 .codec_dai_name = "wm9712-aux",
42 .cpu_dai_name = "mpc5200-psc-ac97.1", 42 .cpu_dai_name = "mpc5200-psc-ac97.1",
@@ -101,7 +101,7 @@ static int __init pcm030_fabric_probe(struct platform_device *op)
101 return ret; 101 return ret;
102} 102}
103 103
104static int __devexit pcm030_fabric_remove(struct platform_device *op) 104static int pcm030_fabric_remove(struct platform_device *op)
105{ 105{
106 struct pcm030_audio_data *pdata = platform_get_drvdata(op); 106 struct pcm030_audio_data *pdata = platform_get_drvdata(op);
107 int ret; 107 int ret;
@@ -120,7 +120,7 @@ MODULE_DEVICE_TABLE(of, pcm030_audio_match);
120 120
121static struct platform_driver pcm030_fabric_driver = { 121static struct platform_driver pcm030_fabric_driver = {
122 .probe = pcm030_fabric_probe, 122 .probe = pcm030_fabric_probe,
123 .remove = __devexit_p(pcm030_fabric_remove), 123 .remove = pcm030_fabric_remove,
124 .driver = { 124 .driver = {
125 .name = DRV_NAME, 125 .name = DRV_NAME,
126 .owner = THIS_MODULE, 126 .owner = THIS_MODULE,
diff --git a/sound/soc/jz4740/jz4740-i2s.c b/sound/soc/jz4740/jz4740-i2s.c
index 41349670adab..6cef491f4823 100644
--- a/sound/soc/jz4740/jz4740-i2s.c
+++ b/sound/soc/jz4740/jz4740-i2s.c
@@ -425,7 +425,7 @@ static struct snd_soc_dai_driver jz4740_i2s_dai = {
425 .resume = jz4740_i2s_resume, 425 .resume = jz4740_i2s_resume,
426}; 426};
427 427
428static int __devinit jz4740_i2s_dev_probe(struct platform_device *pdev) 428static int jz4740_i2s_dev_probe(struct platform_device *pdev)
429{ 429{
430 struct jz4740_i2s *i2s; 430 struct jz4740_i2s *i2s;
431 int ret; 431 int ret;
@@ -492,7 +492,7 @@ err_free:
492 return ret; 492 return ret;
493} 493}
494 494
495static int __devexit jz4740_i2s_dev_remove(struct platform_device *pdev) 495static int jz4740_i2s_dev_remove(struct platform_device *pdev)
496{ 496{
497 struct jz4740_i2s *i2s = platform_get_drvdata(pdev); 497 struct jz4740_i2s *i2s = platform_get_drvdata(pdev);
498 498
@@ -512,7 +512,7 @@ static int __devexit jz4740_i2s_dev_remove(struct platform_device *pdev)
512 512
513static struct platform_driver jz4740_i2s_driver = { 513static struct platform_driver jz4740_i2s_driver = {
514 .probe = jz4740_i2s_dev_probe, 514 .probe = jz4740_i2s_dev_probe,
515 .remove = __devexit_p(jz4740_i2s_dev_remove), 515 .remove = jz4740_i2s_dev_remove,
516 .driver = { 516 .driver = {
517 .name = "jz4740-i2s", 517 .name = "jz4740-i2s",
518 .owner = THIS_MODULE, 518 .owner = THIS_MODULE,
diff --git a/sound/soc/jz4740/jz4740-pcm.c b/sound/soc/jz4740/jz4740-pcm.c
index 9b8cf256847d..710059292318 100644
--- a/sound/soc/jz4740/jz4740-pcm.c
+++ b/sound/soc/jz4740/jz4740-pcm.c
@@ -335,12 +335,12 @@ static struct snd_soc_platform_driver jz4740_soc_platform = {
335 .pcm_free = jz4740_pcm_free, 335 .pcm_free = jz4740_pcm_free,
336}; 336};
337 337
338static int __devinit jz4740_pcm_probe(struct platform_device *pdev) 338static int jz4740_pcm_probe(struct platform_device *pdev)
339{ 339{
340 return snd_soc_register_platform(&pdev->dev, &jz4740_soc_platform); 340 return snd_soc_register_platform(&pdev->dev, &jz4740_soc_platform);
341} 341}
342 342
343static int __devexit jz4740_pcm_remove(struct platform_device *pdev) 343static int jz4740_pcm_remove(struct platform_device *pdev)
344{ 344{
345 snd_soc_unregister_platform(&pdev->dev); 345 snd_soc_unregister_platform(&pdev->dev);
346 return 0; 346 return 0;
@@ -348,7 +348,7 @@ static int __devexit jz4740_pcm_remove(struct platform_device *pdev)
348 348
349static struct platform_driver jz4740_pcm_driver = { 349static struct platform_driver jz4740_pcm_driver = {
350 .probe = jz4740_pcm_probe, 350 .probe = jz4740_pcm_probe,
351 .remove = __devexit_p(jz4740_pcm_remove), 351 .remove = jz4740_pcm_remove,
352 .driver = { 352 .driver = {
353 .name = "jz4740-pcm-audio", 353 .name = "jz4740-pcm-audio",
354 .owner = THIS_MODULE, 354 .owner = THIS_MODULE,
diff --git a/sound/soc/jz4740/qi_lb60.c b/sound/soc/jz4740/qi_lb60.c
index e8aaff18d7cc..55fd6b5df55f 100644
--- a/sound/soc/jz4740/qi_lb60.c
+++ b/sound/soc/jz4740/qi_lb60.c
@@ -96,7 +96,7 @@ static const struct gpio qi_lb60_gpios[] = {
96 { QI_LB60_AMP_GPIO, GPIOF_OUT_INIT_LOW, "AMP" }, 96 { QI_LB60_AMP_GPIO, GPIOF_OUT_INIT_LOW, "AMP" },
97}; 97};
98 98
99static int __devinit qi_lb60_probe(struct platform_device *pdev) 99static int qi_lb60_probe(struct platform_device *pdev)
100{ 100{
101 struct snd_soc_card *card = &qi_lb60; 101 struct snd_soc_card *card = &qi_lb60;
102 int ret; 102 int ret;
@@ -116,7 +116,7 @@ static int __devinit qi_lb60_probe(struct platform_device *pdev)
116 return ret; 116 return ret;
117} 117}
118 118
119static int __devexit qi_lb60_remove(struct platform_device *pdev) 119static int qi_lb60_remove(struct platform_device *pdev)
120{ 120{
121 struct snd_soc_card *card = platform_get_drvdata(pdev); 121 struct snd_soc_card *card = platform_get_drvdata(pdev);
122 122
@@ -131,7 +131,7 @@ static struct platform_driver qi_lb60_driver = {
131 .owner = THIS_MODULE, 131 .owner = THIS_MODULE,
132 }, 132 },
133 .probe = qi_lb60_probe, 133 .probe = qi_lb60_probe,
134 .remove = __devexit_p(qi_lb60_remove), 134 .remove = qi_lb60_remove,
135}; 135};
136 136
137module_platform_driver(qi_lb60_driver); 137module_platform_driver(qi_lb60_driver);
diff --git a/sound/soc/kirkwood/kirkwood-dma.c b/sound/soc/kirkwood/kirkwood-dma.c
index 2ba08148655f..d3d4bdca1cc6 100644
--- a/sound/soc/kirkwood/kirkwood-dma.c
+++ b/sound/soc/kirkwood/kirkwood-dma.c
@@ -22,12 +22,16 @@
22#include "kirkwood.h" 22#include "kirkwood.h"
23 23
24#define KIRKWOOD_RATES \ 24#define KIRKWOOD_RATES \
25 (SNDRV_PCM_RATE_44100 | \ 25 (SNDRV_PCM_RATE_8000_192000 | \
26 SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_96000) 26 SNDRV_PCM_RATE_CONTINUOUS | \
27 SNDRV_PCM_RATE_KNOT)
28
27#define KIRKWOOD_FORMATS \ 29#define KIRKWOOD_FORMATS \
28 (SNDRV_PCM_FMTBIT_S16_LE | \ 30 (SNDRV_PCM_FMTBIT_S16_LE | \
29 SNDRV_PCM_FMTBIT_S24_LE | \ 31 SNDRV_PCM_FMTBIT_S24_LE | \
30 SNDRV_PCM_FMTBIT_S32_LE) 32 SNDRV_PCM_FMTBIT_S32_LE | \
33 SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_LE | \
34 SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_BE)
31 35
32struct kirkwood_dma_priv { 36struct kirkwood_dma_priv {
33 struct snd_pcm_substream *play_stream; 37 struct snd_pcm_substream *play_stream;
@@ -43,10 +47,10 @@ static struct snd_pcm_hardware kirkwood_dma_snd_hw = {
43 SNDRV_PCM_INFO_PAUSE), 47 SNDRV_PCM_INFO_PAUSE),
44 .formats = KIRKWOOD_FORMATS, 48 .formats = KIRKWOOD_FORMATS,
45 .rates = KIRKWOOD_RATES, 49 .rates = KIRKWOOD_RATES,
46 .rate_min = 44100, 50 .rate_min = 8000,
47 .rate_max = 96000, 51 .rate_max = 384000,
48 .channels_min = 1, 52 .channels_min = 1,
49 .channels_max = 2, 53 .channels_max = 8,
50 .buffer_bytes_max = KIRKWOOD_SND_MAX_PERIOD_BYTES * KIRKWOOD_SND_MAX_PERIODS, 54 .buffer_bytes_max = KIRKWOOD_SND_MAX_PERIOD_BYTES * KIRKWOOD_SND_MAX_PERIODS,
51 .period_bytes_min = KIRKWOOD_SND_MIN_PERIOD_BYTES, 55 .period_bytes_min = KIRKWOOD_SND_MIN_PERIOD_BYTES,
52 .period_bytes_max = KIRKWOOD_SND_MAX_PERIOD_BYTES, 56 .period_bytes_max = KIRKWOOD_SND_MAX_PERIOD_BYTES,
@@ -368,12 +372,12 @@ static struct snd_soc_platform_driver kirkwood_soc_platform = {
368 .pcm_free = kirkwood_dma_free_dma_buffers, 372 .pcm_free = kirkwood_dma_free_dma_buffers,
369}; 373};
370 374
371static int __devinit kirkwood_soc_platform_probe(struct platform_device *pdev) 375static int kirkwood_soc_platform_probe(struct platform_device *pdev)
372{ 376{
373 return snd_soc_register_platform(&pdev->dev, &kirkwood_soc_platform); 377 return snd_soc_register_platform(&pdev->dev, &kirkwood_soc_platform);
374} 378}
375 379
376static int __devexit kirkwood_soc_platform_remove(struct platform_device *pdev) 380static int kirkwood_soc_platform_remove(struct platform_device *pdev)
377{ 381{
378 snd_soc_unregister_platform(&pdev->dev); 382 snd_soc_unregister_platform(&pdev->dev);
379 return 0; 383 return 0;
@@ -386,7 +390,7 @@ static struct platform_driver kirkwood_pcm_driver = {
386 }, 390 },
387 391
388 .probe = kirkwood_soc_platform_probe, 392 .probe = kirkwood_soc_platform_probe,
389 .remove = __devexit_p(kirkwood_soc_platform_remove), 393 .remove = kirkwood_soc_platform_remove,
390}; 394};
391 395
392module_platform_driver(kirkwood_pcm_driver); 396module_platform_driver(kirkwood_pcm_driver);
diff --git a/sound/soc/kirkwood/kirkwood-i2s.c b/sound/soc/kirkwood/kirkwood-i2s.c
index 1d5db484d2df..282d8b1163ba 100644
--- a/sound/soc/kirkwood/kirkwood-i2s.c
+++ b/sound/soc/kirkwood/kirkwood-i2s.c
@@ -99,6 +99,29 @@ static inline void kirkwood_set_dco(void __iomem *io, unsigned long rate)
99 } while (value == 0); 99 } while (value == 0);
100} 100}
101 101
102static void kirkwood_set_rate(struct snd_soc_dai *dai,
103 struct kirkwood_dma_data *priv, unsigned long rate)
104{
105 uint32_t clks_ctrl;
106
107 if (rate == 44100 || rate == 48000 || rate == 96000) {
108 /* use internal dco for supported rates */
109 dev_dbg(dai->dev, "%s: dco set rate = %lu\n",
110 __func__, rate);
111 kirkwood_set_dco(priv->io, rate);
112
113 clks_ctrl = KIRKWOOD_MCLK_SOURCE_DCO;
114 } else if (!IS_ERR(priv->extclk)) {
115 /* use optional external clk for other rates */
116 dev_dbg(dai->dev, "%s: extclk set rate = %lu -> %lu\n",
117 __func__, rate, 256 * rate);
118 clk_set_rate(priv->extclk, 256 * rate);
119
120 clks_ctrl = KIRKWOOD_MCLK_SOURCE_EXTCLK;
121 }
122 writel(clks_ctrl, priv->io + KIRKWOOD_CLOCKS_CTRL);
123}
124
102static int kirkwood_i2s_startup(struct snd_pcm_substream *substream, 125static int kirkwood_i2s_startup(struct snd_pcm_substream *substream,
103 struct snd_soc_dai *dai) 126 struct snd_soc_dai *dai)
104{ 127{
@@ -113,26 +136,21 @@ static int kirkwood_i2s_hw_params(struct snd_pcm_substream *substream,
113 struct snd_soc_dai *dai) 136 struct snd_soc_dai *dai)
114{ 137{
115 struct kirkwood_dma_data *priv = snd_soc_dai_get_drvdata(dai); 138 struct kirkwood_dma_data *priv = snd_soc_dai_get_drvdata(dai);
116 unsigned int i2s_reg, reg; 139 uint32_t ctl_play, ctl_rec;
117 unsigned long i2s_value, value; 140 unsigned int i2s_reg;
141 unsigned long i2s_value;
118 142
119 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { 143 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
120 i2s_reg = KIRKWOOD_I2S_PLAYCTL; 144 i2s_reg = KIRKWOOD_I2S_PLAYCTL;
121 reg = KIRKWOOD_PLAYCTL;
122 } else { 145 } else {
123 i2s_reg = KIRKWOOD_I2S_RECCTL; 146 i2s_reg = KIRKWOOD_I2S_RECCTL;
124 reg = KIRKWOOD_RECCTL;
125 } 147 }
126 148
127 /* set dco conf */ 149 kirkwood_set_rate(dai, priv, params_rate(params));
128 kirkwood_set_dco(priv->io, params_rate(params));
129 150
130 i2s_value = readl(priv->io+i2s_reg); 151 i2s_value = readl(priv->io+i2s_reg);
131 i2s_value &= ~KIRKWOOD_I2S_CTL_SIZE_MASK; 152 i2s_value &= ~KIRKWOOD_I2S_CTL_SIZE_MASK;
132 153
133 value = readl(priv->io+reg);
134 value &= ~KIRKWOOD_PLAYCTL_SIZE_MASK;
135
136 /* 154 /*
137 * Size settings in play/rec i2s control regs and play/rec control 155 * Size settings in play/rec i2s control regs and play/rec control
138 * regs must be the same. 156 * regs must be the same.
@@ -140,38 +158,57 @@ static int kirkwood_i2s_hw_params(struct snd_pcm_substream *substream,
140 switch (params_format(params)) { 158 switch (params_format(params)) {
141 case SNDRV_PCM_FORMAT_S16_LE: 159 case SNDRV_PCM_FORMAT_S16_LE:
142 i2s_value |= KIRKWOOD_I2S_CTL_SIZE_16; 160 i2s_value |= KIRKWOOD_I2S_CTL_SIZE_16;
143 value |= KIRKWOOD_PLAYCTL_SIZE_16_C; 161 ctl_play = KIRKWOOD_PLAYCTL_SIZE_16_C |
162 KIRKWOOD_PLAYCTL_I2S_EN;
163 ctl_rec = KIRKWOOD_RECCTL_SIZE_16_C |
164 KIRKWOOD_RECCTL_I2S_EN;
144 break; 165 break;
145 /* 166 /*
146 * doesn't work... S20_3LE != kirkwood 20bit format ? 167 * doesn't work... S20_3LE != kirkwood 20bit format ?
147 * 168 *
148 case SNDRV_PCM_FORMAT_S20_3LE: 169 case SNDRV_PCM_FORMAT_S20_3LE:
149 i2s_value |= KIRKWOOD_I2S_CTL_SIZE_20; 170 i2s_value |= KIRKWOOD_I2S_CTL_SIZE_20;
150 value |= KIRKWOOD_PLAYCTL_SIZE_20; 171 ctl_play = KIRKWOOD_PLAYCTL_SIZE_20 |
172 KIRKWOOD_PLAYCTL_I2S_EN;
173 ctl_rec = KIRKWOOD_RECCTL_SIZE_20 |
174 KIRKWOOD_RECCTL_I2S_EN;
151 break; 175 break;
152 */ 176 */
153 case SNDRV_PCM_FORMAT_S24_LE: 177 case SNDRV_PCM_FORMAT_S24_LE:
154 i2s_value |= KIRKWOOD_I2S_CTL_SIZE_24; 178 i2s_value |= KIRKWOOD_I2S_CTL_SIZE_24;
155 value |= KIRKWOOD_PLAYCTL_SIZE_24; 179 ctl_play = KIRKWOOD_PLAYCTL_SIZE_24 |
180 KIRKWOOD_PLAYCTL_I2S_EN;
181 ctl_rec = KIRKWOOD_RECCTL_SIZE_24 |
182 KIRKWOOD_RECCTL_I2S_EN;
156 break; 183 break;
157 case SNDRV_PCM_FORMAT_S32_LE: 184 case SNDRV_PCM_FORMAT_S32_LE:
158 i2s_value |= KIRKWOOD_I2S_CTL_SIZE_32; 185 i2s_value |= KIRKWOOD_I2S_CTL_SIZE_32;
159 value |= KIRKWOOD_PLAYCTL_SIZE_32; 186 ctl_play = KIRKWOOD_PLAYCTL_SIZE_32 |
187 KIRKWOOD_PLAYCTL_I2S_EN;
188 ctl_rec = KIRKWOOD_RECCTL_SIZE_32 |
189 KIRKWOOD_RECCTL_I2S_EN;
160 break; 190 break;
161 default: 191 default:
162 return -EINVAL; 192 return -EINVAL;
163 } 193 }
164 194
165 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { 195 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
166 value &= ~KIRKWOOD_PLAYCTL_MONO_MASK;
167 if (params_channels(params) == 1) 196 if (params_channels(params) == 1)
168 value |= KIRKWOOD_PLAYCTL_MONO_BOTH; 197 ctl_play |= KIRKWOOD_PLAYCTL_MONO_BOTH;
169 else 198 else
170 value |= KIRKWOOD_PLAYCTL_MONO_OFF; 199 ctl_play |= KIRKWOOD_PLAYCTL_MONO_OFF;
200
201 priv->ctl_play &= ~(KIRKWOOD_PLAYCTL_MONO_MASK |
202 KIRKWOOD_PLAYCTL_I2S_EN |
203 KIRKWOOD_PLAYCTL_SPDIF_EN |
204 KIRKWOOD_PLAYCTL_SIZE_MASK);
205 priv->ctl_play |= ctl_play;
206 } else {
207 priv->ctl_rec &= ~KIRKWOOD_RECCTL_SIZE_MASK;
208 priv->ctl_rec |= ctl_rec;
171 } 209 }
172 210
173 writel(i2s_value, priv->io+i2s_reg); 211 writel(i2s_value, priv->io+i2s_reg);
174 writel(value, priv->io+reg);
175 212
176 return 0; 213 return 0;
177} 214}
@@ -205,20 +242,18 @@ static int kirkwood_i2s_play_trigger(struct snd_pcm_substream *substream,
205 242
206 switch (cmd) { 243 switch (cmd) {
207 case SNDRV_PCM_TRIGGER_START: 244 case SNDRV_PCM_TRIGGER_START:
245 /* configure */
246 ctl = priv->ctl_play;
247 value = ctl & ~(KIRKWOOD_PLAYCTL_I2S_EN |
248 KIRKWOOD_PLAYCTL_SPDIF_EN);
249 writel(value, priv->io + KIRKWOOD_PLAYCTL);
250
251 /* enable interrupts */
208 value = readl(priv->io + KIRKWOOD_INT_MASK); 252 value = readl(priv->io + KIRKWOOD_INT_MASK);
209 value |= KIRKWOOD_INT_CAUSE_PLAY_BYTES; 253 value |= KIRKWOOD_INT_CAUSE_PLAY_BYTES;
210 writel(value, priv->io + KIRKWOOD_INT_MASK); 254 writel(value, priv->io + KIRKWOOD_INT_MASK);
211 255
212 /* configure audio & enable i2s playback */ 256 /* enable playback */
213 ctl &= ~KIRKWOOD_PLAYCTL_BURST_MASK;
214 ctl &= ~(KIRKWOOD_PLAYCTL_PAUSE | KIRKWOOD_PLAYCTL_I2S_MUTE
215 | KIRKWOOD_PLAYCTL_SPDIF_EN);
216
217 if (priv->burst == 32)
218 ctl |= KIRKWOOD_PLAYCTL_BURST_32;
219 else
220 ctl |= KIRKWOOD_PLAYCTL_BURST_128;
221 ctl |= KIRKWOOD_PLAYCTL_I2S_EN;
222 writel(ctl, priv->io + KIRKWOOD_PLAYCTL); 257 writel(ctl, priv->io + KIRKWOOD_PLAYCTL);
223 break; 258 break;
224 259
@@ -259,30 +294,24 @@ static int kirkwood_i2s_rec_trigger(struct snd_pcm_substream *substream,
259 int cmd, struct snd_soc_dai *dai) 294 int cmd, struct snd_soc_dai *dai)
260{ 295{
261 struct kirkwood_dma_data *priv = snd_soc_dai_get_drvdata(dai); 296 struct kirkwood_dma_data *priv = snd_soc_dai_get_drvdata(dai);
262 unsigned long value; 297 uint32_t ctl, value;
263 298
264 value = readl(priv->io + KIRKWOOD_RECCTL); 299 value = readl(priv->io + KIRKWOOD_RECCTL);
265 300
266 switch (cmd) { 301 switch (cmd) {
267 case SNDRV_PCM_TRIGGER_START: 302 case SNDRV_PCM_TRIGGER_START:
303 /* configure */
304 ctl = priv->ctl_rec;
305 value = ctl & ~KIRKWOOD_RECCTL_I2S_EN;
306 writel(value, priv->io + KIRKWOOD_RECCTL);
307
308 /* enable interrupts */
268 value = readl(priv->io + KIRKWOOD_INT_MASK); 309 value = readl(priv->io + KIRKWOOD_INT_MASK);
269 value |= KIRKWOOD_INT_CAUSE_REC_BYTES; 310 value |= KIRKWOOD_INT_CAUSE_REC_BYTES;
270 writel(value, priv->io + KIRKWOOD_INT_MASK); 311 writel(value, priv->io + KIRKWOOD_INT_MASK);
271 312
272 /* configure audio & enable i2s record */ 313 /* enable record */
273 value = readl(priv->io + KIRKWOOD_RECCTL); 314 writel(ctl, priv->io + KIRKWOOD_RECCTL);
274 value &= ~KIRKWOOD_RECCTL_BURST_MASK;
275 value &= ~KIRKWOOD_RECCTL_MONO;
276 value &= ~(KIRKWOOD_RECCTL_PAUSE | KIRKWOOD_RECCTL_MUTE
277 | KIRKWOOD_RECCTL_SPDIF_EN);
278
279 if (priv->burst == 32)
280 value |= KIRKWOOD_RECCTL_BURST_32;
281 else
282 value |= KIRKWOOD_RECCTL_BURST_128;
283 value |= KIRKWOOD_RECCTL_I2S_EN;
284
285 writel(value, priv->io + KIRKWOOD_RECCTL);
286 break; 315 break;
287 316
288 case SNDRV_PCM_TRIGGER_STOP: 317 case SNDRV_PCM_TRIGGER_STOP:
@@ -389,112 +418,146 @@ static struct snd_soc_dai_driver kirkwood_i2s_dai = {
389 .channels_min = 1, 418 .channels_min = 1,
390 .channels_max = 2, 419 .channels_max = 2,
391 .rates = KIRKWOOD_I2S_RATES, 420 .rates = KIRKWOOD_I2S_RATES,
392 .formats = KIRKWOOD_I2S_FORMATS,}, 421 .formats = KIRKWOOD_I2S_FORMATS,
422 },
393 .capture = { 423 .capture = {
394 .channels_min = 1, 424 .channels_min = 1,
395 .channels_max = 2, 425 .channels_max = 2,
396 .rates = KIRKWOOD_I2S_RATES, 426 .rates = KIRKWOOD_I2S_RATES,
397 .formats = KIRKWOOD_I2S_FORMATS,}, 427 .formats = KIRKWOOD_I2S_FORMATS,
428 },
398 .ops = &kirkwood_i2s_dai_ops, 429 .ops = &kirkwood_i2s_dai_ops,
399}; 430};
400 431
401static __devinit int kirkwood_i2s_dev_probe(struct platform_device *pdev) 432static struct snd_soc_dai_driver kirkwood_i2s_dai_extclk = {
433 .probe = kirkwood_i2s_probe,
434 .remove = kirkwood_i2s_remove,
435 .playback = {
436 .channels_min = 1,
437 .channels_max = 2,
438 .rates = SNDRV_PCM_RATE_8000_192000 |
439 SNDRV_PCM_RATE_CONTINUOUS |
440 SNDRV_PCM_RATE_KNOT,
441 .formats = KIRKWOOD_I2S_FORMATS,
442 },
443 .capture = {
444 .channels_min = 1,
445 .channels_max = 2,
446 .rates = SNDRV_PCM_RATE_8000_192000 |
447 SNDRV_PCM_RATE_CONTINUOUS |
448 SNDRV_PCM_RATE_KNOT,
449 .formats = KIRKWOOD_I2S_FORMATS,
450 },
451 .ops = &kirkwood_i2s_dai_ops,
452};
453
454static int kirkwood_i2s_dev_probe(struct platform_device *pdev)
402{ 455{
403 struct resource *mem; 456 struct kirkwood_asoc_platform_data *data = pdev->dev.platform_data;
404 struct kirkwood_asoc_platform_data *data = 457 struct snd_soc_dai_driver *soc_dai = &kirkwood_i2s_dai;
405 pdev->dev.platform_data;
406 struct kirkwood_dma_data *priv; 458 struct kirkwood_dma_data *priv;
459 struct resource *mem;
407 int err; 460 int err;
408 461
409 priv = kzalloc(sizeof(struct kirkwood_dma_data), GFP_KERNEL); 462 priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL);
410 if (!priv) { 463 if (!priv) {
411 dev_err(&pdev->dev, "allocation failed\n"); 464 dev_err(&pdev->dev, "allocation failed\n");
412 err = -ENOMEM; 465 return -ENOMEM;
413 goto error;
414 } 466 }
415 dev_set_drvdata(&pdev->dev, priv); 467 dev_set_drvdata(&pdev->dev, priv);
416 468
417 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); 469 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
418 if (!mem) { 470 if (!mem) {
419 dev_err(&pdev->dev, "platform_get_resource failed\n"); 471 dev_err(&pdev->dev, "platform_get_resource failed\n");
420 err = -ENXIO; 472 return -ENXIO;
421 goto err_alloc;
422 }
423
424 priv->mem = request_mem_region(mem->start, SZ_16K, DRV_NAME);
425 if (!priv->mem) {
426 dev_err(&pdev->dev, "request_mem_region failed\n");
427 err = -EBUSY;
428 goto err_alloc;
429 } 473 }
430 474
431 priv->io = ioremap(priv->mem->start, SZ_16K); 475 priv->io = devm_request_and_ioremap(&pdev->dev, mem);
432 if (!priv->io) { 476 if (!priv->io) {
433 dev_err(&pdev->dev, "ioremap failed\n"); 477 dev_err(&pdev->dev, "devm_request_and_ioremap failed\n");
434 err = -ENOMEM; 478 return -ENOMEM;
435 goto err_iomem;
436 } 479 }
437 480
438 priv->irq = platform_get_irq(pdev, 0); 481 priv->irq = platform_get_irq(pdev, 0);
439 if (priv->irq <= 0) { 482 if (priv->irq <= 0) {
440 dev_err(&pdev->dev, "platform_get_irq failed\n"); 483 dev_err(&pdev->dev, "platform_get_irq failed\n");
441 err = -ENXIO; 484 return -ENXIO;
442 goto err_ioremap;
443 } 485 }
444 486
445 if (!data) { 487 if (!data) {
446 dev_err(&pdev->dev, "no platform data ?!\n"); 488 dev_err(&pdev->dev, "no platform data ?!\n");
447 err = -EINVAL; 489 return -EINVAL;
448 goto err_ioremap;
449 } 490 }
450 491
451 priv->burst = data->burst; 492 priv->burst = data->burst;
452 493
453 priv->clk = clk_get(&pdev->dev, NULL); 494 priv->clk = devm_clk_get(&pdev->dev, NULL);
454 if (IS_ERR(priv->clk)) { 495 if (IS_ERR(priv->clk)) {
455 dev_err(&pdev->dev, "no clock\n"); 496 dev_err(&pdev->dev, "no clock\n");
456 err = PTR_ERR(priv->clk); 497 return PTR_ERR(priv->clk);
457 goto err_ioremap; 498 }
499
500 err = clk_prepare_enable(priv->clk);
501 if (err < 0)
502 return err;
503
504 priv->extclk = clk_get(&pdev->dev, "extclk");
505 if (!IS_ERR(priv->extclk)) {
506 if (priv->extclk == priv->clk) {
507 clk_put(priv->extclk);
508 priv->extclk = ERR_PTR(-EINVAL);
509 } else {
510 dev_info(&pdev->dev, "found external clock\n");
511 clk_prepare_enable(priv->extclk);
512 soc_dai = &kirkwood_i2s_dai_extclk;
513 }
514 }
515
516 /* Some sensible defaults - this reflects the powerup values */
517 priv->ctl_play = KIRKWOOD_PLAYCTL_SIZE_24;
518 priv->ctl_rec = KIRKWOOD_RECCTL_SIZE_24;
519
520 /* Select the burst size */
521 if (data->burst == 32) {
522 priv->ctl_play |= KIRKWOOD_PLAYCTL_BURST_32;
523 priv->ctl_rec |= KIRKWOOD_RECCTL_BURST_32;
524 } else {
525 priv->ctl_play |= KIRKWOOD_PLAYCTL_BURST_128;
526 priv->ctl_rec |= KIRKWOOD_RECCTL_BURST_128;
458 } 527 }
459 clk_prepare_enable(priv->clk);
460 528
461 err = snd_soc_register_dai(&pdev->dev, &kirkwood_i2s_dai); 529 err = snd_soc_register_dai(&pdev->dev, soc_dai);
462 if (!err) 530 if (!err)
463 return 0; 531 return 0;
464 dev_err(&pdev->dev, "snd_soc_register_dai failed\n"); 532 dev_err(&pdev->dev, "snd_soc_register_dai failed\n");
465 533
534 if (!IS_ERR(priv->extclk)) {
535 clk_disable_unprepare(priv->extclk);
536 clk_put(priv->extclk);
537 }
466 clk_disable_unprepare(priv->clk); 538 clk_disable_unprepare(priv->clk);
467 clk_put(priv->clk); 539
468
469err_ioremap:
470 iounmap(priv->io);
471err_iomem:
472 release_mem_region(priv->mem->start, SZ_16K);
473err_alloc:
474 kfree(priv);
475error:
476 return err; 540 return err;
477} 541}
478 542
479static __devexit int kirkwood_i2s_dev_remove(struct platform_device *pdev) 543static int kirkwood_i2s_dev_remove(struct platform_device *pdev)
480{ 544{
481 struct kirkwood_dma_data *priv = dev_get_drvdata(&pdev->dev); 545 struct kirkwood_dma_data *priv = dev_get_drvdata(&pdev->dev);
482 546
483 snd_soc_unregister_dai(&pdev->dev); 547 snd_soc_unregister_dai(&pdev->dev);
484 548
549 if (!IS_ERR(priv->extclk)) {
550 clk_disable_unprepare(priv->extclk);
551 clk_put(priv->extclk);
552 }
485 clk_disable_unprepare(priv->clk); 553 clk_disable_unprepare(priv->clk);
486 clk_put(priv->clk);
487
488 iounmap(priv->io);
489 release_mem_region(priv->mem->start, SZ_16K);
490 kfree(priv);
491 554
492 return 0; 555 return 0;
493} 556}
494 557
495static struct platform_driver kirkwood_i2s_driver = { 558static struct platform_driver kirkwood_i2s_driver = {
496 .probe = kirkwood_i2s_dev_probe, 559 .probe = kirkwood_i2s_dev_probe,
497 .remove = __devexit_p(kirkwood_i2s_dev_remove), 560 .remove = kirkwood_i2s_dev_remove,
498 .driver = { 561 .driver = {
499 .name = DRV_NAME, 562 .name = DRV_NAME,
500 .owner = THIS_MODULE, 563 .owner = THIS_MODULE,
diff --git a/sound/soc/kirkwood/kirkwood-openrd.c b/sound/soc/kirkwood/kirkwood-openrd.c
index c28540aeea25..b979c7154715 100644
--- a/sound/soc/kirkwood/kirkwood-openrd.c
+++ b/sound/soc/kirkwood/kirkwood-openrd.c
@@ -71,7 +71,7 @@ static struct snd_soc_card openrd_client = {
71 .num_links = ARRAY_SIZE(openrd_client_dai), 71 .num_links = ARRAY_SIZE(openrd_client_dai),
72}; 72};
73 73
74static int __devinit openrd_probe(struct platform_device *pdev) 74static int openrd_probe(struct platform_device *pdev)
75{ 75{
76 struct snd_soc_card *card = &openrd_client; 76 struct snd_soc_card *card = &openrd_client;
77 int ret; 77 int ret;
@@ -85,7 +85,7 @@ static int __devinit openrd_probe(struct platform_device *pdev)
85 return ret; 85 return ret;
86} 86}
87 87
88static int __devexit openrd_remove(struct platform_device *pdev) 88static int openrd_remove(struct platform_device *pdev)
89{ 89{
90 struct snd_soc_card *card = platform_get_drvdata(pdev); 90 struct snd_soc_card *card = platform_get_drvdata(pdev);
91 91
@@ -99,7 +99,7 @@ static struct platform_driver openrd_driver = {
99 .owner = THIS_MODULE, 99 .owner = THIS_MODULE,
100 }, 100 },
101 .probe = openrd_probe, 101 .probe = openrd_probe,
102 .remove = __devexit_p(openrd_remove), 102 .remove = openrd_remove,
103}; 103};
104 104
105module_platform_driver(openrd_driver); 105module_platform_driver(openrd_driver);
diff --git a/sound/soc/kirkwood/kirkwood-t5325.c b/sound/soc/kirkwood/kirkwood-t5325.c
index c67bbc574987..1d0ed6f8add7 100644
--- a/sound/soc/kirkwood/kirkwood-t5325.c
+++ b/sound/soc/kirkwood/kirkwood-t5325.c
@@ -92,7 +92,7 @@ static struct snd_soc_card t5325 = {
92 .num_dapm_routes = ARRAY_SIZE(t5325_route), 92 .num_dapm_routes = ARRAY_SIZE(t5325_route),
93}; 93};
94 94
95static int __devinit t5325_probe(struct platform_device *pdev) 95static int t5325_probe(struct platform_device *pdev)
96{ 96{
97 struct snd_soc_card *card = &t5325; 97 struct snd_soc_card *card = &t5325;
98 int ret; 98 int ret;
@@ -106,7 +106,7 @@ static int __devinit t5325_probe(struct platform_device *pdev)
106 return ret; 106 return ret;
107} 107}
108 108
109static int __devexit t5325_remove(struct platform_device *pdev) 109static int t5325_remove(struct platform_device *pdev)
110{ 110{
111 struct snd_soc_card *card = platform_get_drvdata(pdev); 111 struct snd_soc_card *card = platform_get_drvdata(pdev);
112 112
@@ -120,7 +120,7 @@ static struct platform_driver t5325_driver = {
120 .owner = THIS_MODULE, 120 .owner = THIS_MODULE,
121 }, 121 },
122 .probe = t5325_probe, 122 .probe = t5325_probe,
123 .remove = __devexit_p(t5325_remove), 123 .remove = t5325_remove,
124}; 124};
125 125
126module_platform_driver(t5325_driver); 126module_platform_driver(t5325_driver);
diff --git a/sound/soc/kirkwood/kirkwood.h b/sound/soc/kirkwood/kirkwood.h
index f9084d83e6bd..4d92637ddb3f 100644
--- a/sound/soc/kirkwood/kirkwood.h
+++ b/sound/soc/kirkwood/kirkwood.h
@@ -77,6 +77,11 @@
77#define KIRKWOOD_DCO_SPCR_STATUS 0x120c 77#define KIRKWOOD_DCO_SPCR_STATUS 0x120c
78#define KIRKWOOD_DCO_SPCR_STATUS_DCO_LOCK (1<<16) 78#define KIRKWOOD_DCO_SPCR_STATUS_DCO_LOCK (1<<16)
79 79
80#define KIRKWOOD_CLOCKS_CTRL 0x1230
81#define KIRKWOOD_MCLK_SOURCE_MASK (3<<0)
82#define KIRKWOOD_MCLK_SOURCE_DCO (0<<0)
83#define KIRKWOOD_MCLK_SOURCE_EXTCLK (3<<0)
84
80#define KIRKWOOD_ERR_CAUSE 0x1300 85#define KIRKWOOD_ERR_CAUSE 0x1300
81#define KIRKWOOD_ERR_MASK 0x1304 86#define KIRKWOOD_ERR_MASK 0x1304
82 87
@@ -119,11 +124,13 @@
119#define KIRKWOOD_SND_MAX_PERIOD_BYTES 0x4000 124#define KIRKWOOD_SND_MAX_PERIOD_BYTES 0x4000
120 125
121struct kirkwood_dma_data { 126struct kirkwood_dma_data {
122 struct resource *mem;
123 void __iomem *io; 127 void __iomem *io;
128 struct clk *clk;
129 struct clk *extclk;
130 uint32_t ctl_play;
131 uint32_t ctl_rec;
124 int irq; 132 int irq;
125 int burst; 133 int burst;
126 struct clk *clk;
127}; 134};
128 135
129#endif 136#endif
diff --git a/sound/soc/mid-x86/mfld_machine.c b/sound/soc/mid-x86/mfld_machine.c
index 2cc7782714b5..4139116c33b5 100644
--- a/sound/soc/mid-x86/mfld_machine.c
+++ b/sound/soc/mid-x86/mfld_machine.c
@@ -358,7 +358,7 @@ static irqreturn_t snd_mfld_jack_detection(int irq, void *data)
358 return IRQ_HANDLED; 358 return IRQ_HANDLED;
359} 359}
360 360
361static int __devinit snd_mfld_mc_probe(struct platform_device *pdev) 361static int snd_mfld_mc_probe(struct platform_device *pdev)
362{ 362{
363 int ret_val = 0, irq; 363 int ret_val = 0, irq;
364 struct mfld_mc_private *mc_drv_ctx; 364 struct mfld_mc_private *mc_drv_ctx;
@@ -417,7 +417,7 @@ unalloc:
417 return ret_val; 417 return ret_val;
418} 418}
419 419
420static int __devexit snd_mfld_mc_remove(struct platform_device *pdev) 420static int snd_mfld_mc_remove(struct platform_device *pdev)
421{ 421{
422 struct mfld_mc_private *mc_drv_ctx = platform_get_drvdata(pdev); 422 struct mfld_mc_private *mc_drv_ctx = platform_get_drvdata(pdev);
423 423
@@ -435,7 +435,7 @@ static struct platform_driver snd_mfld_mc_driver = {
435 .name = "msic_audio", 435 .name = "msic_audio",
436 }, 436 },
437 .probe = snd_mfld_mc_probe, 437 .probe = snd_mfld_mc_probe,
438 .remove = __devexit_p(snd_mfld_mc_remove), 438 .remove = snd_mfld_mc_remove,
439}; 439};
440 440
441module_platform_driver(snd_mfld_mc_driver); 441module_platform_driver(snd_mfld_mc_driver);
diff --git a/sound/soc/mxs/mxs-pcm.c b/sound/soc/mxs/mxs-pcm.c
index f82d766cbf9e..564b5b60319d 100644
--- a/sound/soc/mxs/mxs-pcm.c
+++ b/sound/soc/mxs/mxs-pcm.c
@@ -220,13 +220,13 @@ static struct snd_soc_platform_driver mxs_soc_platform = {
220 .pcm_free = mxs_pcm_free, 220 .pcm_free = mxs_pcm_free,
221}; 221};
222 222
223int __devinit mxs_pcm_platform_register(struct device *dev) 223int mxs_pcm_platform_register(struct device *dev)
224{ 224{
225 return snd_soc_register_platform(dev, &mxs_soc_platform); 225 return snd_soc_register_platform(dev, &mxs_soc_platform);
226} 226}
227EXPORT_SYMBOL_GPL(mxs_pcm_platform_register); 227EXPORT_SYMBOL_GPL(mxs_pcm_platform_register);
228 228
229void __devexit mxs_pcm_platform_unregister(struct device *dev) 229void mxs_pcm_platform_unregister(struct device *dev)
230{ 230{
231 snd_soc_unregister_platform(dev); 231 snd_soc_unregister_platform(dev);
232} 232}
diff --git a/sound/soc/mxs/mxs-saif.c b/sound/soc/mxs/mxs-saif.c
index c294fbb523fc..365d9d27a321 100644
--- a/sound/soc/mxs/mxs-saif.c
+++ b/sound/soc/mxs/mxs-saif.c
@@ -229,6 +229,7 @@ int mxs_saif_put_mclk(unsigned int saif_id)
229 saif->mclk_in_use = 0; 229 saif->mclk_in_use = 0;
230 return 0; 230 return 0;
231} 231}
232EXPORT_SYMBOL_GPL(mxs_saif_put_mclk);
232 233
233/* 234/*
234 * Get MCLK and set clock rate, then enable it 235 * Get MCLK and set clock rate, then enable it
@@ -282,6 +283,7 @@ int mxs_saif_get_mclk(unsigned int saif_id, unsigned int mclk,
282 283
283 return 0; 284 return 0;
284} 285}
286EXPORT_SYMBOL_GPL(mxs_saif_get_mclk);
285 287
286/* 288/*
287 * SAIF DAI format configuration. 289 * SAIF DAI format configuration.
@@ -655,7 +657,7 @@ static irqreturn_t mxs_saif_irq(int irq, void *dev_id)
655 return IRQ_HANDLED; 657 return IRQ_HANDLED;
656} 658}
657 659
658static int __devinit mxs_saif_probe(struct platform_device *pdev) 660static int mxs_saif_probe(struct platform_device *pdev)
659{ 661{
660 struct device_node *np = pdev->dev.of_node; 662 struct device_node *np = pdev->dev.of_node;
661 struct resource *iores, *dmares; 663 struct resource *iores, *dmares;
@@ -790,7 +792,7 @@ failed_pdev_alloc:
790 return ret; 792 return ret;
791} 793}
792 794
793static int __devexit mxs_saif_remove(struct platform_device *pdev) 795static int mxs_saif_remove(struct platform_device *pdev)
794{ 796{
795 mxs_pcm_platform_unregister(&pdev->dev); 797 mxs_pcm_platform_unregister(&pdev->dev);
796 snd_soc_unregister_dai(&pdev->dev); 798 snd_soc_unregister_dai(&pdev->dev);
@@ -806,7 +808,7 @@ MODULE_DEVICE_TABLE(of, mxs_saif_dt_ids);
806 808
807static struct platform_driver mxs_saif_driver = { 809static struct platform_driver mxs_saif_driver = {
808 .probe = mxs_saif_probe, 810 .probe = mxs_saif_probe,
809 .remove = __devexit_p(mxs_saif_remove), 811 .remove = mxs_saif_remove,
810 812
811 .driver = { 813 .driver = {
812 .name = "mxs-saif", 814 .name = "mxs-saif",
diff --git a/sound/soc/mxs/mxs-sgtl5000.c b/sound/soc/mxs/mxs-sgtl5000.c
index 215113b05f7d..b1d9b5ebeeeb 100644
--- a/sound/soc/mxs/mxs-sgtl5000.c
+++ b/sound/soc/mxs/mxs-sgtl5000.c
@@ -112,7 +112,7 @@ static struct snd_soc_card mxs_sgtl5000 = {
112 .num_links = ARRAY_SIZE(mxs_sgtl5000_dai), 112 .num_links = ARRAY_SIZE(mxs_sgtl5000_dai),
113}; 113};
114 114
115static int __devinit mxs_sgtl5000_probe_dt(struct platform_device *pdev) 115static int mxs_sgtl5000_probe_dt(struct platform_device *pdev)
116{ 116{
117 struct device_node *np = pdev->dev.of_node; 117 struct device_node *np = pdev->dev.of_node;
118 struct device_node *saif_np[2], *codec_np; 118 struct device_node *saif_np[2], *codec_np;
@@ -145,7 +145,7 @@ static int __devinit mxs_sgtl5000_probe_dt(struct platform_device *pdev)
145 return ret; 145 return ret;
146} 146}
147 147
148static int __devinit mxs_sgtl5000_probe(struct platform_device *pdev) 148static int mxs_sgtl5000_probe(struct platform_device *pdev)
149{ 149{
150 struct snd_soc_card *card = &mxs_sgtl5000; 150 struct snd_soc_card *card = &mxs_sgtl5000;
151 int ret; 151 int ret;
@@ -176,7 +176,7 @@ static int __devinit mxs_sgtl5000_probe(struct platform_device *pdev)
176 return 0; 176 return 0;
177} 177}
178 178
179static int __devexit mxs_sgtl5000_remove(struct platform_device *pdev) 179static int mxs_sgtl5000_remove(struct platform_device *pdev)
180{ 180{
181 struct snd_soc_card *card = platform_get_drvdata(pdev); 181 struct snd_soc_card *card = platform_get_drvdata(pdev);
182 182
@@ -200,7 +200,7 @@ static struct platform_driver mxs_sgtl5000_audio_driver = {
200 .of_match_table = mxs_sgtl5000_dt_ids, 200 .of_match_table = mxs_sgtl5000_dt_ids,
201 }, 201 },
202 .probe = mxs_sgtl5000_probe, 202 .probe = mxs_sgtl5000_probe,
203 .remove = __devexit_p(mxs_sgtl5000_remove), 203 .remove = mxs_sgtl5000_remove,
204}; 204};
205 205
206module_platform_driver(mxs_sgtl5000_audio_driver); 206module_platform_driver(mxs_sgtl5000_audio_driver);
diff --git a/sound/soc/nuc900/nuc900-ac97.c b/sound/soc/nuc900/nuc900-ac97.c
index 946020a647db..0418467a4848 100644
--- a/sound/soc/nuc900/nuc900-ac97.c
+++ b/sound/soc/nuc900/nuc900-ac97.c
@@ -314,7 +314,7 @@ static struct snd_soc_dai_driver nuc900_ac97_dai = {
314 .ops = &nuc900_ac97_dai_ops, 314 .ops = &nuc900_ac97_dai_ops,
315}; 315};
316 316
317static int __devinit nuc900_ac97_drvprobe(struct platform_device *pdev) 317static int nuc900_ac97_drvprobe(struct platform_device *pdev)
318{ 318{
319 struct nuc900_audio *nuc900_audio; 319 struct nuc900_audio *nuc900_audio;
320 int ret; 320 int ret;
@@ -382,7 +382,7 @@ out0:
382 return ret; 382 return ret;
383} 383}
384 384
385static int __devexit nuc900_ac97_drvremove(struct platform_device *pdev) 385static int nuc900_ac97_drvremove(struct platform_device *pdev)
386{ 386{
387 snd_soc_unregister_dai(&pdev->dev); 387 snd_soc_unregister_dai(&pdev->dev);
388 388
@@ -403,7 +403,7 @@ static struct platform_driver nuc900_ac97_driver = {
403 .owner = THIS_MODULE, 403 .owner = THIS_MODULE,
404 }, 404 },
405 .probe = nuc900_ac97_drvprobe, 405 .probe = nuc900_ac97_drvprobe,
406 .remove = __devexit_p(nuc900_ac97_drvremove), 406 .remove = nuc900_ac97_drvremove,
407}; 407};
408 408
409module_platform_driver(nuc900_ac97_driver); 409module_platform_driver(nuc900_ac97_driver);
diff --git a/sound/soc/nuc900/nuc900-pcm.c b/sound/soc/nuc900/nuc900-pcm.c
index 37585b47f4e3..c894ff0f2580 100644
--- a/sound/soc/nuc900/nuc900-pcm.c
+++ b/sound/soc/nuc900/nuc900-pcm.c
@@ -337,12 +337,12 @@ static struct snd_soc_platform_driver nuc900_soc_platform = {
337 .pcm_free = nuc900_dma_free_dma_buffers, 337 .pcm_free = nuc900_dma_free_dma_buffers,
338}; 338};
339 339
340static int __devinit nuc900_soc_platform_probe(struct platform_device *pdev) 340static int nuc900_soc_platform_probe(struct platform_device *pdev)
341{ 341{
342 return snd_soc_register_platform(&pdev->dev, &nuc900_soc_platform); 342 return snd_soc_register_platform(&pdev->dev, &nuc900_soc_platform);
343} 343}
344 344
345static int __devexit nuc900_soc_platform_remove(struct platform_device *pdev) 345static int nuc900_soc_platform_remove(struct platform_device *pdev)
346{ 346{
347 snd_soc_unregister_platform(&pdev->dev); 347 snd_soc_unregister_platform(&pdev->dev);
348 return 0; 348 return 0;
@@ -355,7 +355,7 @@ static struct platform_driver nuc900_pcm_driver = {
355 }, 355 },
356 356
357 .probe = nuc900_soc_platform_probe, 357 .probe = nuc900_soc_platform_probe,
358 .remove = __devexit_p(nuc900_soc_platform_remove), 358 .remove = nuc900_soc_platform_remove,
359}; 359};
360 360
361module_platform_driver(nuc900_pcm_driver); 361module_platform_driver(nuc900_pcm_driver);
diff --git a/sound/soc/omap/ams-delta.c b/sound/soc/omap/ams-delta.c
index d8e96b2cd03e..2600447fa74f 100644
--- a/sound/soc/omap/ams-delta.c
+++ b/sound/soc/omap/ams-delta.c
@@ -575,7 +575,7 @@ static struct snd_soc_card ams_delta_audio_card = {
575}; 575};
576 576
577/* Module init/exit */ 577/* Module init/exit */
578static __devinit int ams_delta_probe(struct platform_device *pdev) 578static int ams_delta_probe(struct platform_device *pdev)
579{ 579{
580 struct snd_soc_card *card = &ams_delta_audio_card; 580 struct snd_soc_card *card = &ams_delta_audio_card;
581 int ret; 581 int ret;
@@ -591,7 +591,7 @@ static __devinit int ams_delta_probe(struct platform_device *pdev)
591 return 0; 591 return 0;
592} 592}
593 593
594static int __devexit ams_delta_remove(struct platform_device *pdev) 594static int ams_delta_remove(struct platform_device *pdev)
595{ 595{
596 struct snd_soc_card *card = platform_get_drvdata(pdev); 596 struct snd_soc_card *card = platform_get_drvdata(pdev);
597 597
@@ -616,7 +616,7 @@ static struct platform_driver ams_delta_driver = {
616 .owner = THIS_MODULE, 616 .owner = THIS_MODULE,
617 }, 617 },
618 .probe = ams_delta_probe, 618 .probe = ams_delta_probe,
619 .remove = __devexit_p(ams_delta_remove), 619 .remove = ams_delta_remove,
620}; 620};
621 621
622module_platform_driver(ams_delta_driver); 622module_platform_driver(ams_delta_driver);
diff --git a/sound/soc/omap/mcbsp.c b/sound/soc/omap/mcbsp.c
index a9a243860428..285c8368cb47 100644
--- a/sound/soc/omap/mcbsp.c
+++ b/sound/soc/omap/mcbsp.c
@@ -930,8 +930,7 @@ static const struct attribute_group sidetone_attr_group = {
930 .attrs = (struct attribute **)sidetone_attrs, 930 .attrs = (struct attribute **)sidetone_attrs,
931}; 931};
932 932
933static int __devinit omap_st_add(struct omap_mcbsp *mcbsp, 933static int omap_st_add(struct omap_mcbsp *mcbsp, struct resource *res)
934 struct resource *res)
935{ 934{
936 struct omap_mcbsp_st_data *st_data; 935 struct omap_mcbsp_st_data *st_data;
937 int err; 936 int err;
@@ -957,7 +956,7 @@ static int __devinit omap_st_add(struct omap_mcbsp *mcbsp,
957 * McBSP1 and McBSP3 are directly mapped on 1610 and 1510. 956 * McBSP1 and McBSP3 are directly mapped on 1610 and 1510.
958 * 730 has only 2 McBSP, and both of them are MPU peripherals. 957 * 730 has only 2 McBSP, and both of them are MPU peripherals.
959 */ 958 */
960int __devinit omap_mcbsp_init(struct platform_device *pdev) 959int omap_mcbsp_init(struct platform_device *pdev)
961{ 960{
962 struct omap_mcbsp *mcbsp = platform_get_drvdata(pdev); 961 struct omap_mcbsp *mcbsp = platform_get_drvdata(pdev);
963 struct resource *res; 962 struct resource *res;
@@ -1085,7 +1084,7 @@ err_thres:
1085 return ret; 1084 return ret;
1086} 1085}
1087 1086
1088void __devexit omap_mcbsp_sysfs_remove(struct omap_mcbsp *mcbsp) 1087void omap_mcbsp_sysfs_remove(struct omap_mcbsp *mcbsp)
1089{ 1088{
1090 if (mcbsp->pdata->buffer_size) 1089 if (mcbsp->pdata->buffer_size)
1091 sysfs_remove_group(&mcbsp->dev->kobj, &additional_attr_group); 1090 sysfs_remove_group(&mcbsp->dev->kobj, &additional_attr_group);
diff --git a/sound/soc/omap/mcbsp.h b/sound/soc/omap/mcbsp.h
index a89791c239a5..f93e0b0af303 100644
--- a/sound/soc/omap/mcbsp.h
+++ b/sound/soc/omap/mcbsp.h
@@ -347,7 +347,7 @@ int omap_st_enable(struct omap_mcbsp *mcbsp);
347int omap_st_disable(struct omap_mcbsp *mcbsp); 347int omap_st_disable(struct omap_mcbsp *mcbsp);
348int omap_st_is_enabled(struct omap_mcbsp *mcbsp); 348int omap_st_is_enabled(struct omap_mcbsp *mcbsp);
349 349
350int __devinit omap_mcbsp_init(struct platform_device *pdev); 350int omap_mcbsp_init(struct platform_device *pdev);
351void __devexit omap_mcbsp_sysfs_remove(struct omap_mcbsp *mcbsp); 351void omap_mcbsp_sysfs_remove(struct omap_mcbsp *mcbsp);
352 352
353#endif /* __ASOC_MCBSP_H */ 353#endif /* __ASOC_MCBSP_H */
diff --git a/sound/soc/omap/omap-abe-twl6040.c b/sound/soc/omap/omap-abe-twl6040.c
index a57a4e68dcc6..e7d93fa412a9 100644
--- a/sound/soc/omap/omap-abe-twl6040.c
+++ b/sound/soc/omap/omap-abe-twl6040.c
@@ -273,7 +273,7 @@ static struct snd_soc_card omap_abe_card = {
273 .num_dapm_routes = ARRAY_SIZE(audio_map), 273 .num_dapm_routes = ARRAY_SIZE(audio_map),
274}; 274};
275 275
276static __devinit int omap_abe_probe(struct platform_device *pdev) 276static int omap_abe_probe(struct platform_device *pdev)
277{ 277{
278 struct omap_abe_twl6040_data *pdata = dev_get_platdata(&pdev->dev); 278 struct omap_abe_twl6040_data *pdata = dev_get_platdata(&pdev->dev);
279 struct device_node *node = pdev->dev.of_node; 279 struct device_node *node = pdev->dev.of_node;
@@ -331,8 +331,8 @@ static __devinit int omap_abe_probe(struct platform_device *pdev)
331 num_links = 1; 331 num_links = 1;
332 } 332 }
333 333
334 of_property_read_u32(node, "ti,jack-detection", 334 priv->jack_detection = of_property_read_bool(node,
335 &priv->jack_detection); 335 "ti,jack-detection");
336 of_property_read_u32(node, "ti,mclk-freq", 336 of_property_read_u32(node, "ti,mclk-freq",
337 &priv->mclk_freq); 337 &priv->mclk_freq);
338 if (!priv->mclk_freq) { 338 if (!priv->mclk_freq) {
@@ -390,7 +390,7 @@ err_unregister:
390 return ret; 390 return ret;
391} 391}
392 392
393static int __devexit omap_abe_remove(struct platform_device *pdev) 393static int omap_abe_remove(struct platform_device *pdev)
394{ 394{
395 struct snd_soc_card *card = platform_get_drvdata(pdev); 395 struct snd_soc_card *card = platform_get_drvdata(pdev);
396 struct abe_twl6040 *priv = snd_soc_card_get_drvdata(card); 396 struct abe_twl6040 *priv = snd_soc_card_get_drvdata(card);
@@ -417,7 +417,7 @@ static struct platform_driver omap_abe_driver = {
417 .of_match_table = omap_abe_of_match, 417 .of_match_table = omap_abe_of_match,
418 }, 418 },
419 .probe = omap_abe_probe, 419 .probe = omap_abe_probe,
420 .remove = __devexit_p(omap_abe_remove), 420 .remove = omap_abe_remove,
421}; 421};
422 422
423module_platform_driver(omap_abe_driver); 423module_platform_driver(omap_abe_driver);
diff --git a/sound/soc/omap/omap-dmic.c b/sound/soc/omap/omap-dmic.c
index 5a6aeaf552a8..ba49ccd9eed9 100644
--- a/sound/soc/omap/omap-dmic.c
+++ b/sound/soc/omap/omap-dmic.c
@@ -448,7 +448,7 @@ static struct snd_soc_dai_driver omap_dmic_dai = {
448 .ops = &omap_dmic_dai_ops, 448 .ops = &omap_dmic_dai_ops,
449}; 449};
450 450
451static __devinit int asoc_dmic_probe(struct platform_device *pdev) 451static int asoc_dmic_probe(struct platform_device *pdev)
452{ 452{
453 struct omap_dmic *dmic; 453 struct omap_dmic *dmic;
454 struct resource *res; 454 struct resource *res;
@@ -518,7 +518,7 @@ err_put_clk:
518 return ret; 518 return ret;
519} 519}
520 520
521static int __devexit asoc_dmic_remove(struct platform_device *pdev) 521static int asoc_dmic_remove(struct platform_device *pdev)
522{ 522{
523 struct omap_dmic *dmic = platform_get_drvdata(pdev); 523 struct omap_dmic *dmic = platform_get_drvdata(pdev);
524 524
@@ -541,7 +541,7 @@ static struct platform_driver asoc_dmic_driver = {
541 .of_match_table = omap_dmic_of_match, 541 .of_match_table = omap_dmic_of_match,
542 }, 542 },
543 .probe = asoc_dmic_probe, 543 .probe = asoc_dmic_probe,
544 .remove = __devexit_p(asoc_dmic_remove), 544 .remove = asoc_dmic_remove,
545}; 545};
546 546
547module_platform_driver(asoc_dmic_driver); 547module_platform_driver(asoc_dmic_driver);
diff --git a/sound/soc/omap/omap-hdmi-card.c b/sound/soc/omap/omap-hdmi-card.c
index eaa2ea0e3f81..d4eaa92e518e 100644
--- a/sound/soc/omap/omap-hdmi-card.c
+++ b/sound/soc/omap/omap-hdmi-card.c
@@ -45,7 +45,7 @@ static struct snd_soc_card snd_soc_omap_hdmi = {
45 .num_links = 1, 45 .num_links = 1,
46}; 46};
47 47
48static __devinit int omap_hdmi_probe(struct platform_device *pdev) 48static int omap_hdmi_probe(struct platform_device *pdev)
49{ 49{
50 struct snd_soc_card *card = &snd_soc_omap_hdmi; 50 struct snd_soc_card *card = &snd_soc_omap_hdmi;
51 int ret; 51 int ret;
@@ -61,7 +61,7 @@ static __devinit int omap_hdmi_probe(struct platform_device *pdev)
61 return 0; 61 return 0;
62} 62}
63 63
64static int __devexit omap_hdmi_remove(struct platform_device *pdev) 64static int omap_hdmi_remove(struct platform_device *pdev)
65{ 65{
66 struct snd_soc_card *card = platform_get_drvdata(pdev); 66 struct snd_soc_card *card = platform_get_drvdata(pdev);
67 67
@@ -76,7 +76,7 @@ static struct platform_driver omap_hdmi_driver = {
76 .owner = THIS_MODULE, 76 .owner = THIS_MODULE,
77 }, 77 },
78 .probe = omap_hdmi_probe, 78 .probe = omap_hdmi_probe,
79 .remove = __devexit_p(omap_hdmi_remove), 79 .remove = omap_hdmi_remove,
80}; 80};
81 81
82module_platform_driver(omap_hdmi_driver); 82module_platform_driver(omap_hdmi_driver);
diff --git a/sound/soc/omap/omap-hdmi.c b/sound/soc/omap/omap-hdmi.c
index f59c69fb400e..7ea24819d570 100644
--- a/sound/soc/omap/omap-hdmi.c
+++ b/sound/soc/omap/omap-hdmi.c
@@ -262,7 +262,7 @@ static struct snd_soc_dai_driver omap_hdmi_dai = {
262 .ops = &omap_hdmi_dai_ops, 262 .ops = &omap_hdmi_dai_ops,
263}; 263};
264 264
265static __devinit int omap_hdmi_probe(struct platform_device *pdev) 265static int omap_hdmi_probe(struct platform_device *pdev)
266{ 266{
267 int ret; 267 int ret;
268 struct resource *hdmi_rsrc; 268 struct resource *hdmi_rsrc;
@@ -324,7 +324,7 @@ static __devinit int omap_hdmi_probe(struct platform_device *pdev)
324 return ret; 324 return ret;
325} 325}
326 326
327static int __devexit omap_hdmi_remove(struct platform_device *pdev) 327static int omap_hdmi_remove(struct platform_device *pdev)
328{ 328{
329 struct hdmi_priv *hdmi_data = dev_get_drvdata(&pdev->dev); 329 struct hdmi_priv *hdmi_data = dev_get_drvdata(&pdev->dev);
330 330
@@ -345,7 +345,7 @@ static struct platform_driver hdmi_dai_driver = {
345 .owner = THIS_MODULE, 345 .owner = THIS_MODULE,
346 }, 346 },
347 .probe = omap_hdmi_probe, 347 .probe = omap_hdmi_probe,
348 .remove = __devexit_p(omap_hdmi_remove), 348 .remove = omap_hdmi_remove,
349}; 349};
350 350
351module_platform_driver(hdmi_dai_driver); 351module_platform_driver(hdmi_dai_driver);
diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c
index 09167609c93e..8d2defd6fdbe 100644
--- a/sound/soc/omap/omap-mcbsp.c
+++ b/sound/soc/omap/omap-mcbsp.c
@@ -757,7 +757,7 @@ static const struct of_device_id omap_mcbsp_of_match[] = {
757}; 757};
758MODULE_DEVICE_TABLE(of, omap_mcbsp_of_match); 758MODULE_DEVICE_TABLE(of, omap_mcbsp_of_match);
759 759
760static __devinit int asoc_mcbsp_probe(struct platform_device *pdev) 760static int asoc_mcbsp_probe(struct platform_device *pdev)
761{ 761{
762 struct omap_mcbsp_platform_data *pdata = dev_get_platdata(&pdev->dev); 762 struct omap_mcbsp_platform_data *pdata = dev_get_platdata(&pdev->dev);
763 struct omap_mcbsp *mcbsp; 763 struct omap_mcbsp *mcbsp;
@@ -798,7 +798,7 @@ static __devinit int asoc_mcbsp_probe(struct platform_device *pdev)
798 return ret; 798 return ret;
799} 799}
800 800
801static int __devexit asoc_mcbsp_remove(struct platform_device *pdev) 801static int asoc_mcbsp_remove(struct platform_device *pdev)
802{ 802{
803 struct omap_mcbsp *mcbsp = platform_get_drvdata(pdev); 803 struct omap_mcbsp *mcbsp = platform_get_drvdata(pdev);
804 804
@@ -824,7 +824,7 @@ static struct platform_driver asoc_mcbsp_driver = {
824 }, 824 },
825 825
826 .probe = asoc_mcbsp_probe, 826 .probe = asoc_mcbsp_probe,
827 .remove = __devexit_p(asoc_mcbsp_remove), 827 .remove = asoc_mcbsp_remove,
828}; 828};
829 829
830module_platform_driver(asoc_mcbsp_driver); 830module_platform_driver(asoc_mcbsp_driver);
diff --git a/sound/soc/omap/omap-mcpdm.c b/sound/soc/omap/omap-mcpdm.c
index 56965bb3275c..2fe8be209452 100644
--- a/sound/soc/omap/omap-mcpdm.c
+++ b/sound/soc/omap/omap-mcpdm.c
@@ -429,7 +429,7 @@ void omap_mcpdm_configure_dn_offsets(struct snd_soc_pcm_runtime *rtd,
429} 429}
430EXPORT_SYMBOL_GPL(omap_mcpdm_configure_dn_offsets); 430EXPORT_SYMBOL_GPL(omap_mcpdm_configure_dn_offsets);
431 431
432static __devinit int asoc_mcpdm_probe(struct platform_device *pdev) 432static int asoc_mcpdm_probe(struct platform_device *pdev)
433{ 433{
434 struct omap_mcpdm *mcpdm; 434 struct omap_mcpdm *mcpdm;
435 struct resource *res; 435 struct resource *res;
@@ -487,7 +487,7 @@ static __devinit int asoc_mcpdm_probe(struct platform_device *pdev)
487 return snd_soc_register_dai(&pdev->dev, &omap_mcpdm_dai); 487 return snd_soc_register_dai(&pdev->dev, &omap_mcpdm_dai);
488} 488}
489 489
490static int __devexit asoc_mcpdm_remove(struct platform_device *pdev) 490static int asoc_mcpdm_remove(struct platform_device *pdev)
491{ 491{
492 snd_soc_unregister_dai(&pdev->dev); 492 snd_soc_unregister_dai(&pdev->dev);
493 return 0; 493 return 0;
@@ -507,7 +507,7 @@ static struct platform_driver asoc_mcpdm_driver = {
507 }, 507 },
508 508
509 .probe = asoc_mcpdm_probe, 509 .probe = asoc_mcpdm_probe,
510 .remove = __devexit_p(asoc_mcpdm_remove), 510 .remove = asoc_mcpdm_remove,
511}; 511};
512 512
513module_platform_driver(asoc_mcpdm_driver); 513module_platform_driver(asoc_mcpdm_driver);
diff --git a/sound/soc/omap/omap-pcm.c b/sound/soc/omap/omap-pcm.c
index 52977aa30355..47bdbd415ad8 100644
--- a/sound/soc/omap/omap-pcm.c
+++ b/sound/soc/omap/omap-pcm.c
@@ -302,13 +302,13 @@ static struct snd_soc_platform_driver omap_soc_platform = {
302 .pcm_free = omap_pcm_free_dma_buffers, 302 .pcm_free = omap_pcm_free_dma_buffers,
303}; 303};
304 304
305static __devinit int omap_pcm_probe(struct platform_device *pdev) 305static int omap_pcm_probe(struct platform_device *pdev)
306{ 306{
307 return snd_soc_register_platform(&pdev->dev, 307 return snd_soc_register_platform(&pdev->dev,
308 &omap_soc_platform); 308 &omap_soc_platform);
309} 309}
310 310
311static int __devexit omap_pcm_remove(struct platform_device *pdev) 311static int omap_pcm_remove(struct platform_device *pdev)
312{ 312{
313 snd_soc_unregister_platform(&pdev->dev); 313 snd_soc_unregister_platform(&pdev->dev);
314 return 0; 314 return 0;
@@ -321,7 +321,7 @@ static struct platform_driver omap_pcm_driver = {
321 }, 321 },
322 322
323 .probe = omap_pcm_probe, 323 .probe = omap_pcm_probe,
324 .remove = __devexit_p(omap_pcm_remove), 324 .remove = omap_pcm_remove,
325}; 325};
326 326
327module_platform_driver(omap_pcm_driver); 327module_platform_driver(omap_pcm_driver);
diff --git a/sound/soc/omap/omap-twl4030.c b/sound/soc/omap/omap-twl4030.c
index 3b97b87971f5..4541d28b5314 100644
--- a/sound/soc/omap/omap-twl4030.c
+++ b/sound/soc/omap/omap-twl4030.c
@@ -107,7 +107,7 @@ static struct snd_soc_card omap_twl4030_card = {
107 .num_links = ARRAY_SIZE(omap_twl4030_dai_links), 107 .num_links = ARRAY_SIZE(omap_twl4030_dai_links),
108}; 108};
109 109
110static __devinit int omap_twl4030_probe(struct platform_device *pdev) 110static int omap_twl4030_probe(struct platform_device *pdev)
111{ 111{
112 struct omap_tw4030_pdata *pdata = dev_get_platdata(&pdev->dev); 112 struct omap_tw4030_pdata *pdata = dev_get_platdata(&pdev->dev);
113 struct device_node *node = pdev->dev.of_node; 113 struct device_node *node = pdev->dev.of_node;
@@ -154,7 +154,7 @@ static __devinit int omap_twl4030_probe(struct platform_device *pdev)
154 return 0; 154 return 0;
155} 155}
156 156
157static int __devexit omap_twl4030_remove(struct platform_device *pdev) 157static int omap_twl4030_remove(struct platform_device *pdev)
158{ 158{
159 struct snd_soc_card *card = platform_get_drvdata(pdev); 159 struct snd_soc_card *card = platform_get_drvdata(pdev);
160 160
@@ -177,7 +177,7 @@ static struct platform_driver omap_twl4030_driver = {
177 .of_match_table = omap_twl4030_of_match, 177 .of_match_table = omap_twl4030_of_match,
178 }, 178 },
179 .probe = omap_twl4030_probe, 179 .probe = omap_twl4030_probe,
180 .remove = __devexit_p(omap_twl4030_remove), 180 .remove = omap_twl4030_remove,
181}; 181};
182 182
183module_platform_driver(omap_twl4030_driver); 183module_platform_driver(omap_twl4030_driver);
diff --git a/sound/soc/omap/zoom2.c b/sound/soc/omap/zoom2.c
index 1ff6bb9ade5c..771bff27ac3e 100644
--- a/sound/soc/omap/zoom2.c
+++ b/sound/soc/omap/zoom2.c
@@ -37,8 +37,6 @@
37#include "omap-mcbsp.h" 37#include "omap-mcbsp.h"
38#include "omap-pcm.h" 38#include "omap-pcm.h"
39 39
40#define ZOOM2_HEADSET_MUX_GPIO (OMAP_MAX_GPIO_LINES + 15)
41
42static int zoom2_hw_params(struct snd_pcm_substream *substream, 40static int zoom2_hw_params(struct snd_pcm_substream *substream,
43 struct snd_pcm_hw_params *params) 41 struct snd_pcm_hw_params *params)
44{ 42{
@@ -187,9 +185,6 @@ static int __init zoom2_soc_init(void)
187 if (ret) 185 if (ret)
188 goto err1; 186 goto err1;
189 187
190 BUG_ON(gpio_request(ZOOM2_HEADSET_MUX_GPIO, "hs_mux") < 0);
191 gpio_direction_output(ZOOM2_HEADSET_MUX_GPIO, 0);
192
193 return 0; 188 return 0;
194 189
195err1: 190err1:
@@ -202,8 +197,6 @@ module_init(zoom2_soc_init);
202 197
203static void __exit zoom2_soc_exit(void) 198static void __exit zoom2_soc_exit(void)
204{ 199{
205 gpio_free(ZOOM2_HEADSET_MUX_GPIO);
206
207 platform_device_unregister(zoom2_snd_device); 200 platform_device_unregister(zoom2_snd_device);
208} 201}
209module_exit(zoom2_soc_exit); 202module_exit(zoom2_soc_exit);
diff --git a/sound/soc/pxa/brownstone.c b/sound/soc/pxa/brownstone.c
index 5e666e03d333..4ad76099dd43 100644
--- a/sound/soc/pxa/brownstone.c
+++ b/sound/soc/pxa/brownstone.c
@@ -140,7 +140,7 @@ static struct snd_soc_card brownstone = {
140 .num_dapm_routes = ARRAY_SIZE(brownstone_audio_map), 140 .num_dapm_routes = ARRAY_SIZE(brownstone_audio_map),
141}; 141};
142 142
143static int __devinit brownstone_probe(struct platform_device *pdev) 143static int brownstone_probe(struct platform_device *pdev)
144{ 144{
145 int ret; 145 int ret;
146 146
@@ -152,7 +152,7 @@ static int __devinit brownstone_probe(struct platform_device *pdev)
152 return ret; 152 return ret;
153} 153}
154 154
155static int __devexit brownstone_remove(struct platform_device *pdev) 155static int brownstone_remove(struct platform_device *pdev)
156{ 156{
157 snd_soc_unregister_card(&brownstone); 157 snd_soc_unregister_card(&brownstone);
158 return 0; 158 return 0;
@@ -164,7 +164,7 @@ static struct platform_driver mmp_driver = {
164 .owner = THIS_MODULE, 164 .owner = THIS_MODULE,
165 }, 165 },
166 .probe = brownstone_probe, 166 .probe = brownstone_probe,
167 .remove = __devexit_p(brownstone_remove), 167 .remove = brownstone_remove,
168}; 168};
169 169
170module_platform_driver(mmp_driver); 170module_platform_driver(mmp_driver);
diff --git a/sound/soc/pxa/corgi.c b/sound/soc/pxa/corgi.c
index 863367ad89ce..f4cce1e80112 100644
--- a/sound/soc/pxa/corgi.c
+++ b/sound/soc/pxa/corgi.c
@@ -303,7 +303,7 @@ static struct snd_soc_card corgi = {
303 .num_dapm_routes = ARRAY_SIZE(corgi_audio_map), 303 .num_dapm_routes = ARRAY_SIZE(corgi_audio_map),
304}; 304};
305 305
306static int __devinit corgi_probe(struct platform_device *pdev) 306static int corgi_probe(struct platform_device *pdev)
307{ 307{
308 struct snd_soc_card *card = &corgi; 308 struct snd_soc_card *card = &corgi;
309 int ret; 309 int ret;
@@ -317,7 +317,7 @@ static int __devinit corgi_probe(struct platform_device *pdev)
317 return ret; 317 return ret;
318} 318}
319 319
320static int __devexit corgi_remove(struct platform_device *pdev) 320static int corgi_remove(struct platform_device *pdev)
321{ 321{
322 struct snd_soc_card *card = platform_get_drvdata(pdev); 322 struct snd_soc_card *card = platform_get_drvdata(pdev);
323 323
@@ -331,7 +331,7 @@ static struct platform_driver corgi_driver = {
331 .owner = THIS_MODULE, 331 .owner = THIS_MODULE,
332 }, 332 },
333 .probe = corgi_probe, 333 .probe = corgi_probe,
334 .remove = __devexit_p(corgi_remove), 334 .remove = corgi_remove,
335}; 335};
336 336
337module_platform_driver(corgi_driver); 337module_platform_driver(corgi_driver);
diff --git a/sound/soc/pxa/e740_wm9705.c b/sound/soc/pxa/e740_wm9705.c
index 7b1bc2390039..70d799b13f0d 100644
--- a/sound/soc/pxa/e740_wm9705.c
+++ b/sound/soc/pxa/e740_wm9705.c
@@ -144,7 +144,7 @@ static struct gpio e740_audio_gpios[] = {
144 { GPIO_E740_WM9705_nAVDD2, GPIOF_OUT_INIT_HIGH, "Audio power" }, 144 { GPIO_E740_WM9705_nAVDD2, GPIOF_OUT_INIT_HIGH, "Audio power" },
145}; 145};
146 146
147static int __devinit e740_probe(struct platform_device *pdev) 147static int e740_probe(struct platform_device *pdev)
148{ 148{
149 struct snd_soc_card *card = &e740; 149 struct snd_soc_card *card = &e740;
150 int ret; 150 int ret;
@@ -165,7 +165,7 @@ static int __devinit e740_probe(struct platform_device *pdev)
165 return ret; 165 return ret;
166} 166}
167 167
168static int __devexit e740_remove(struct platform_device *pdev) 168static int e740_remove(struct platform_device *pdev)
169{ 169{
170 struct snd_soc_card *card = platform_get_drvdata(pdev); 170 struct snd_soc_card *card = platform_get_drvdata(pdev);
171 171
@@ -180,7 +180,7 @@ static struct platform_driver e740_driver = {
180 .owner = THIS_MODULE, 180 .owner = THIS_MODULE,
181 }, 181 },
182 .probe = e740_probe, 182 .probe = e740_probe,
183 .remove = __devexit_p(e740_remove), 183 .remove = e740_remove,
184}; 184};
185 185
186module_platform_driver(e740_driver); 186module_platform_driver(e740_driver);
diff --git a/sound/soc/pxa/e750_wm9705.c b/sound/soc/pxa/e750_wm9705.c
index 47b89d71e287..f94d2ab51351 100644
--- a/sound/soc/pxa/e750_wm9705.c
+++ b/sound/soc/pxa/e750_wm9705.c
@@ -126,7 +126,7 @@ static struct gpio e750_audio_gpios[] = {
126 { GPIO_E750_SPK_AMP_OFF, GPIOF_OUT_INIT_HIGH, "Speaker amp" }, 126 { GPIO_E750_SPK_AMP_OFF, GPIOF_OUT_INIT_HIGH, "Speaker amp" },
127}; 127};
128 128
129static int __devinit e750_probe(struct platform_device *pdev) 129static int e750_probe(struct platform_device *pdev)
130{ 130{
131 struct snd_soc_card *card = &e750; 131 struct snd_soc_card *card = &e750;
132 int ret; 132 int ret;
@@ -147,7 +147,7 @@ static int __devinit e750_probe(struct platform_device *pdev)
147 return ret; 147 return ret;
148} 148}
149 149
150static int __devexit e750_remove(struct platform_device *pdev) 150static int e750_remove(struct platform_device *pdev)
151{ 151{
152 struct snd_soc_card *card = platform_get_drvdata(pdev); 152 struct snd_soc_card *card = platform_get_drvdata(pdev);
153 153
@@ -162,7 +162,7 @@ static struct platform_driver e750_driver = {
162 .owner = THIS_MODULE, 162 .owner = THIS_MODULE,
163 }, 163 },
164 .probe = e750_probe, 164 .probe = e750_probe,
165 .remove = __devexit_p(e750_remove), 165 .remove = e750_remove,
166}; 166};
167 167
168module_platform_driver(e750_driver); 168module_platform_driver(e750_driver);
diff --git a/sound/soc/pxa/e800_wm9712.c b/sound/soc/pxa/e800_wm9712.c
index ea9707ec6f28..8768a640dd71 100644
--- a/sound/soc/pxa/e800_wm9712.c
+++ b/sound/soc/pxa/e800_wm9712.c
@@ -116,7 +116,7 @@ static struct gpio e800_audio_gpios[] = {
116 { GPIO_E800_HP_AMP_OFF, GPIOF_OUT_INIT_HIGH, "Speaker amp" }, 116 { GPIO_E800_HP_AMP_OFF, GPIOF_OUT_INIT_HIGH, "Speaker amp" },
117}; 117};
118 118
119static int __devinit e800_probe(struct platform_device *pdev) 119static int e800_probe(struct platform_device *pdev)
120{ 120{
121 struct snd_soc_card *card = &e800; 121 struct snd_soc_card *card = &e800;
122 int ret; 122 int ret;
@@ -137,7 +137,7 @@ static int __devinit e800_probe(struct platform_device *pdev)
137 return ret; 137 return ret;
138} 138}
139 139
140static int __devexit e800_remove(struct platform_device *pdev) 140static int e800_remove(struct platform_device *pdev)
141{ 141{
142 struct snd_soc_card *card = platform_get_drvdata(pdev); 142 struct snd_soc_card *card = platform_get_drvdata(pdev);
143 143
@@ -152,7 +152,7 @@ static struct platform_driver e800_driver = {
152 .owner = THIS_MODULE, 152 .owner = THIS_MODULE,
153 }, 153 },
154 .probe = e800_probe, 154 .probe = e800_probe,
155 .remove = __devexit_p(e800_remove), 155 .remove = e800_remove,
156}; 156};
157 157
158module_platform_driver(e800_driver); 158module_platform_driver(e800_driver);
diff --git a/sound/soc/pxa/hx4700.c b/sound/soc/pxa/hx4700.c
index 2a342c92d829..dcc9b04bd92c 100644
--- a/sound/soc/pxa/hx4700.c
+++ b/sound/soc/pxa/hx4700.c
@@ -183,7 +183,7 @@ static struct gpio hx4700_audio_gpios[] = {
183 { GPIO92_HX4700_HP_DRIVER, GPIOF_OUT_INIT_LOW, "EP_POWER" }, 183 { GPIO92_HX4700_HP_DRIVER, GPIOF_OUT_INIT_LOW, "EP_POWER" },
184}; 184};
185 185
186static int __devinit hx4700_audio_probe(struct platform_device *pdev) 186static int hx4700_audio_probe(struct platform_device *pdev)
187{ 187{
188 int ret; 188 int ret;
189 189
@@ -204,7 +204,7 @@ static int __devinit hx4700_audio_probe(struct platform_device *pdev)
204 return ret; 204 return ret;
205} 205}
206 206
207static int __devexit hx4700_audio_remove(struct platform_device *pdev) 207static int hx4700_audio_remove(struct platform_device *pdev)
208{ 208{
209 snd_soc_jack_free_gpios(&hs_jack, 1, &hs_jack_gpio); 209 snd_soc_jack_free_gpios(&hs_jack, 1, &hs_jack_gpio);
210 snd_soc_unregister_card(&snd_soc_card_hx4700); 210 snd_soc_unregister_card(&snd_soc_card_hx4700);
@@ -223,7 +223,7 @@ static struct platform_driver hx4700_audio_driver = {
223 .pm = &snd_soc_pm_ops, 223 .pm = &snd_soc_pm_ops,
224 }, 224 },
225 .probe = hx4700_audio_probe, 225 .probe = hx4700_audio_probe,
226 .remove = __devexit_p(hx4700_audio_remove), 226 .remove = hx4700_audio_remove,
227}; 227};
228 228
229module_platform_driver(hx4700_audio_driver); 229module_platform_driver(hx4700_audio_driver);
diff --git a/sound/soc/pxa/imote2.c b/sound/soc/pxa/imote2.c
index b93dafd32b80..eef1f7b7b38e 100644
--- a/sound/soc/pxa/imote2.c
+++ b/sound/soc/pxa/imote2.c
@@ -65,7 +65,7 @@ static struct snd_soc_card imote2 = {
65 .num_links = 1, 65 .num_links = 1,
66}; 66};
67 67
68static int __devinit imote2_probe(struct platform_device *pdev) 68static int imote2_probe(struct platform_device *pdev)
69{ 69{
70 struct snd_soc_card *card = &imote2; 70 struct snd_soc_card *card = &imote2;
71 int ret; 71 int ret;
@@ -79,7 +79,7 @@ static int __devinit imote2_probe(struct platform_device *pdev)
79 return ret; 79 return ret;
80} 80}
81 81
82static int __devexit imote2_remove(struct platform_device *pdev) 82static int imote2_remove(struct platform_device *pdev)
83{ 83{
84 struct snd_soc_card *card = platform_get_drvdata(pdev); 84 struct snd_soc_card *card = platform_get_drvdata(pdev);
85 85
@@ -93,7 +93,7 @@ static struct platform_driver imote2_driver = {
93 .owner = THIS_MODULE, 93 .owner = THIS_MODULE,
94 }, 94 },
95 .probe = imote2_probe, 95 .probe = imote2_probe,
96 .remove = __devexit_p(imote2_remove), 96 .remove = imote2_remove,
97}; 97};
98 98
99module_platform_driver(imote2_driver); 99module_platform_driver(imote2_driver);
diff --git a/sound/soc/pxa/mioa701_wm9713.c b/sound/soc/pxa/mioa701_wm9713.c
index 8687c1c65d29..97b711e12821 100644
--- a/sound/soc/pxa/mioa701_wm9713.c
+++ b/sound/soc/pxa/mioa701_wm9713.c
@@ -186,7 +186,7 @@ static struct snd_soc_card mioa701 = {
186 .num_links = ARRAY_SIZE(mioa701_dai), 186 .num_links = ARRAY_SIZE(mioa701_dai),
187}; 187};
188 188
189static int __devinit mioa701_wm9713_probe(struct platform_device *pdev) 189static int mioa701_wm9713_probe(struct platform_device *pdev)
190{ 190{
191 int rc; 191 int rc;
192 192
@@ -202,7 +202,7 @@ static int __devinit mioa701_wm9713_probe(struct platform_device *pdev)
202 return rc; 202 return rc;
203} 203}
204 204
205static int __devexit mioa701_wm9713_remove(struct platform_device *pdev) 205static int mioa701_wm9713_remove(struct platform_device *pdev)
206{ 206{
207 struct snd_soc_card *card = platform_get_drvdata(pdev); 207 struct snd_soc_card *card = platform_get_drvdata(pdev);
208 208
@@ -212,7 +212,7 @@ static int __devexit mioa701_wm9713_remove(struct platform_device *pdev)
212 212
213static struct platform_driver mioa701_wm9713_driver = { 213static struct platform_driver mioa701_wm9713_driver = {
214 .probe = mioa701_wm9713_probe, 214 .probe = mioa701_wm9713_probe,
215 .remove = __devexit_p(mioa701_wm9713_remove), 215 .remove = mioa701_wm9713_remove,
216 .driver = { 216 .driver = {
217 .name = "mioa701-wm9713", 217 .name = "mioa701-wm9713",
218 .owner = THIS_MODULE, 218 .owner = THIS_MODULE,
diff --git a/sound/soc/pxa/mmp-pcm.c b/sound/soc/pxa/mmp-pcm.c
index e834faf859fd..190eb0bccf5f 100644
--- a/sound/soc/pxa/mmp-pcm.c
+++ b/sound/soc/pxa/mmp-pcm.c
@@ -257,7 +257,7 @@ struct snd_soc_platform_driver mmp_soc_platform = {
257 .pcm_free = mmp_pcm_free_dma_buffers, 257 .pcm_free = mmp_pcm_free_dma_buffers,
258}; 258};
259 259
260static __devinit int mmp_pcm_probe(struct platform_device *pdev) 260static int mmp_pcm_probe(struct platform_device *pdev)
261{ 261{
262 struct mmp_audio_platdata *pdata = pdev->dev.platform_data; 262 struct mmp_audio_platdata *pdata = pdev->dev.platform_data;
263 263
@@ -274,7 +274,7 @@ static __devinit int mmp_pcm_probe(struct platform_device *pdev)
274 return snd_soc_register_platform(&pdev->dev, &mmp_soc_platform); 274 return snd_soc_register_platform(&pdev->dev, &mmp_soc_platform);
275} 275}
276 276
277static int __devexit mmp_pcm_remove(struct platform_device *pdev) 277static int mmp_pcm_remove(struct platform_device *pdev)
278{ 278{
279 snd_soc_unregister_platform(&pdev->dev); 279 snd_soc_unregister_platform(&pdev->dev);
280 return 0; 280 return 0;
@@ -287,7 +287,7 @@ static struct platform_driver mmp_pcm_driver = {
287 }, 287 },
288 288
289 .probe = mmp_pcm_probe, 289 .probe = mmp_pcm_probe,
290 .remove = __devexit_p(mmp_pcm_remove), 290 .remove = mmp_pcm_remove,
291}; 291};
292 292
293module_platform_driver(mmp_pcm_driver); 293module_platform_driver(mmp_pcm_driver);
diff --git a/sound/soc/pxa/mmp-sspa.c b/sound/soc/pxa/mmp-sspa.c
index 4d6cb8a30fc8..41c3a09b53ea 100644
--- a/sound/soc/pxa/mmp-sspa.c
+++ b/sound/soc/pxa/mmp-sspa.c
@@ -405,7 +405,7 @@ struct snd_soc_dai_driver mmp_sspa_dai = {
405 .ops = &mmp_sspa_dai_ops, 405 .ops = &mmp_sspa_dai_ops,
406}; 406};
407 407
408static __devinit int asoc_mmp_sspa_probe(struct platform_device *pdev) 408static int asoc_mmp_sspa_probe(struct platform_device *pdev)
409{ 409{
410 struct sspa_priv *priv; 410 struct sspa_priv *priv;
411 struct resource *res; 411 struct resource *res;
@@ -453,7 +453,7 @@ static __devinit int asoc_mmp_sspa_probe(struct platform_device *pdev)
453 return snd_soc_register_dai(&pdev->dev, &mmp_sspa_dai); 453 return snd_soc_register_dai(&pdev->dev, &mmp_sspa_dai);
454} 454}
455 455
456static int __devexit asoc_mmp_sspa_remove(struct platform_device *pdev) 456static int asoc_mmp_sspa_remove(struct platform_device *pdev)
457{ 457{
458 struct sspa_priv *priv = platform_get_drvdata(pdev); 458 struct sspa_priv *priv = platform_get_drvdata(pdev);
459 459
@@ -470,7 +470,7 @@ static struct platform_driver asoc_mmp_sspa_driver = {
470 .owner = THIS_MODULE, 470 .owner = THIS_MODULE,
471 }, 471 },
472 .probe = asoc_mmp_sspa_probe, 472 .probe = asoc_mmp_sspa_probe,
473 .remove = __devexit_p(asoc_mmp_sspa_remove), 473 .remove = asoc_mmp_sspa_remove,
474}; 474};
475 475
476module_platform_driver(asoc_mmp_sspa_driver); 476module_platform_driver(asoc_mmp_sspa_driver);
diff --git a/sound/soc/pxa/palm27x.c b/sound/soc/pxa/palm27x.c
index aa3da91907c6..2074e2daf9c6 100644
--- a/sound/soc/pxa/palm27x.c
+++ b/sound/soc/pxa/palm27x.c
@@ -187,7 +187,7 @@ put_device:
187 return ret; 187 return ret;
188} 188}
189 189
190static int __devexit palm27x_asoc_remove(struct platform_device *pdev) 190static int palm27x_asoc_remove(struct platform_device *pdev)
191{ 191{
192 platform_device_unregister(palm27x_snd_device); 192 platform_device_unregister(palm27x_snd_device);
193 return 0; 193 return 0;
@@ -195,7 +195,7 @@ static int __devexit palm27x_asoc_remove(struct platform_device *pdev)
195 195
196static struct platform_driver palm27x_wm9712_driver = { 196static struct platform_driver palm27x_wm9712_driver = {
197 .probe = palm27x_asoc_probe, 197 .probe = palm27x_asoc_probe,
198 .remove = __devexit_p(palm27x_asoc_remove), 198 .remove = palm27x_asoc_remove,
199 .driver = { 199 .driver = {
200 .name = "palm27x-asoc", 200 .name = "palm27x-asoc",
201 .owner = THIS_MODULE, 201 .owner = THIS_MODULE,
diff --git a/sound/soc/pxa/poodle.c b/sound/soc/pxa/poodle.c
index d2cc81735036..fafe46355c31 100644
--- a/sound/soc/pxa/poodle.c
+++ b/sound/soc/pxa/poodle.c
@@ -269,7 +269,7 @@ static struct snd_soc_card poodle = {
269 .num_dapm_routes = ARRAY_SIZE(poodle_audio_map), 269 .num_dapm_routes = ARRAY_SIZE(poodle_audio_map),
270}; 270};
271 271
272static int __devinit poodle_probe(struct platform_device *pdev) 272static int poodle_probe(struct platform_device *pdev)
273{ 273{
274 struct snd_soc_card *card = &poodle; 274 struct snd_soc_card *card = &poodle;
275 int ret; 275 int ret;
@@ -291,7 +291,7 @@ static int __devinit poodle_probe(struct platform_device *pdev)
291 return ret; 291 return ret;
292} 292}
293 293
294static int __devexit poodle_remove(struct platform_device *pdev) 294static int poodle_remove(struct platform_device *pdev)
295{ 295{
296 struct snd_soc_card *card = platform_get_drvdata(pdev); 296 struct snd_soc_card *card = platform_get_drvdata(pdev);
297 297
@@ -305,7 +305,7 @@ static struct platform_driver poodle_driver = {
305 .owner = THIS_MODULE, 305 .owner = THIS_MODULE,
306 }, 306 },
307 .probe = poodle_probe, 307 .probe = poodle_probe,
308 .remove = __devexit_p(poodle_remove), 308 .remove = poodle_remove,
309}; 309};
310 310
311module_platform_driver(poodle_driver); 311module_platform_driver(poodle_driver);
diff --git a/sound/soc/pxa/pxa-ssp.c b/sound/soc/pxa/pxa-ssp.c
index 4da5fc55c7ee..d3eb0c2eec77 100644
--- a/sound/soc/pxa/pxa-ssp.c
+++ b/sound/soc/pxa/pxa-ssp.c
@@ -794,12 +794,12 @@ static struct snd_soc_dai_driver pxa_ssp_dai = {
794 .ops = &pxa_ssp_dai_ops, 794 .ops = &pxa_ssp_dai_ops,
795}; 795};
796 796
797static __devinit int asoc_ssp_probe(struct platform_device *pdev) 797static int asoc_ssp_probe(struct platform_device *pdev)
798{ 798{
799 return snd_soc_register_dai(&pdev->dev, &pxa_ssp_dai); 799 return snd_soc_register_dai(&pdev->dev, &pxa_ssp_dai);
800} 800}
801 801
802static int __devexit asoc_ssp_remove(struct platform_device *pdev) 802static int asoc_ssp_remove(struct platform_device *pdev)
803{ 803{
804 snd_soc_unregister_dai(&pdev->dev); 804 snd_soc_unregister_dai(&pdev->dev);
805 return 0; 805 return 0;
@@ -812,7 +812,7 @@ static struct platform_driver asoc_ssp_driver = {
812 }, 812 },
813 813
814 .probe = asoc_ssp_probe, 814 .probe = asoc_ssp_probe,
815 .remove = __devexit_p(asoc_ssp_remove), 815 .remove = asoc_ssp_remove,
816}; 816};
817 817
818module_platform_driver(asoc_ssp_driver); 818module_platform_driver(asoc_ssp_driver);
diff --git a/sound/soc/pxa/pxa2xx-ac97.c b/sound/soc/pxa/pxa2xx-ac97.c
index 06ea2744cc88..4b0a009bd683 100644
--- a/sound/soc/pxa/pxa2xx-ac97.c
+++ b/sound/soc/pxa/pxa2xx-ac97.c
@@ -104,7 +104,7 @@ static int pxa2xx_ac97_resume(struct snd_soc_dai *dai)
104#define pxa2xx_ac97_resume NULL 104#define pxa2xx_ac97_resume NULL
105#endif 105#endif
106 106
107static int __devinit pxa2xx_ac97_probe(struct snd_soc_dai *dai) 107static int pxa2xx_ac97_probe(struct snd_soc_dai *dai)
108{ 108{
109 return pxa2xx_ac97_hw_probe(to_platform_device(dai->dev)); 109 return pxa2xx_ac97_hw_probe(to_platform_device(dai->dev));
110} 110}
@@ -234,7 +234,7 @@ static struct snd_soc_dai_driver pxa_ac97_dai_driver[] = {
234 234
235EXPORT_SYMBOL_GPL(soc_ac97_ops); 235EXPORT_SYMBOL_GPL(soc_ac97_ops);
236 236
237static __devinit int pxa2xx_ac97_dev_probe(struct platform_device *pdev) 237static int pxa2xx_ac97_dev_probe(struct platform_device *pdev)
238{ 238{
239 if (pdev->id != -1) { 239 if (pdev->id != -1) {
240 dev_err(&pdev->dev, "PXA2xx has only one AC97 port.\n"); 240 dev_err(&pdev->dev, "PXA2xx has only one AC97 port.\n");
@@ -249,7 +249,7 @@ static __devinit int pxa2xx_ac97_dev_probe(struct platform_device *pdev)
249 ARRAY_SIZE(pxa_ac97_dai_driver)); 249 ARRAY_SIZE(pxa_ac97_dai_driver));
250} 250}
251 251
252static int __devexit pxa2xx_ac97_dev_remove(struct platform_device *pdev) 252static int pxa2xx_ac97_dev_remove(struct platform_device *pdev)
253{ 253{
254 snd_soc_unregister_dais(&pdev->dev, ARRAY_SIZE(pxa_ac97_dai_driver)); 254 snd_soc_unregister_dais(&pdev->dev, ARRAY_SIZE(pxa_ac97_dai_driver));
255 return 0; 255 return 0;
@@ -257,7 +257,7 @@ static int __devexit pxa2xx_ac97_dev_remove(struct platform_device *pdev)
257 257
258static struct platform_driver pxa2xx_ac97_driver = { 258static struct platform_driver pxa2xx_ac97_driver = {
259 .probe = pxa2xx_ac97_dev_probe, 259 .probe = pxa2xx_ac97_dev_probe,
260 .remove = __devexit_p(pxa2xx_ac97_dev_remove), 260 .remove = pxa2xx_ac97_dev_remove,
261 .driver = { 261 .driver = {
262 .name = "pxa2xx-ac97", 262 .name = "pxa2xx-ac97",
263 .owner = THIS_MODULE, 263 .owner = THIS_MODULE,
diff --git a/sound/soc/pxa/pxa2xx-i2s.c b/sound/soc/pxa/pxa2xx-i2s.c
index 3075a426124c..6b1a06f67564 100644
--- a/sound/soc/pxa/pxa2xx-i2s.c
+++ b/sound/soc/pxa/pxa2xx-i2s.c
@@ -365,7 +365,7 @@ static int pxa2xx_i2s_drv_probe(struct platform_device *pdev)
365 return snd_soc_register_dai(&pdev->dev, &pxa_i2s_dai); 365 return snd_soc_register_dai(&pdev->dev, &pxa_i2s_dai);
366} 366}
367 367
368static int __devexit pxa2xx_i2s_drv_remove(struct platform_device *pdev) 368static int pxa2xx_i2s_drv_remove(struct platform_device *pdev)
369{ 369{
370 snd_soc_unregister_dai(&pdev->dev); 370 snd_soc_unregister_dai(&pdev->dev);
371 return 0; 371 return 0;
@@ -373,7 +373,7 @@ static int __devexit pxa2xx_i2s_drv_remove(struct platform_device *pdev)
373 373
374static struct platform_driver pxa2xx_i2s_driver = { 374static struct platform_driver pxa2xx_i2s_driver = {
375 .probe = pxa2xx_i2s_drv_probe, 375 .probe = pxa2xx_i2s_drv_probe,
376 .remove = __devexit_p(pxa2xx_i2s_drv_remove), 376 .remove = pxa2xx_i2s_drv_remove,
377 377
378 .driver = { 378 .driver = {
379 .name = "pxa2xx-i2s", 379 .name = "pxa2xx-i2s",
diff --git a/sound/soc/pxa/pxa2xx-pcm.c b/sound/soc/pxa/pxa2xx-pcm.c
index fdd6bedef9bd..ecff116cb7b0 100644
--- a/sound/soc/pxa/pxa2xx-pcm.c
+++ b/sound/soc/pxa/pxa2xx-pcm.c
@@ -120,12 +120,12 @@ static struct snd_soc_platform_driver pxa2xx_soc_platform = {
120 .pcm_free = pxa2xx_pcm_free_dma_buffers, 120 .pcm_free = pxa2xx_pcm_free_dma_buffers,
121}; 121};
122 122
123static int __devinit pxa2xx_soc_platform_probe(struct platform_device *pdev) 123static int pxa2xx_soc_platform_probe(struct platform_device *pdev)
124{ 124{
125 return snd_soc_register_platform(&pdev->dev, &pxa2xx_soc_platform); 125 return snd_soc_register_platform(&pdev->dev, &pxa2xx_soc_platform);
126} 126}
127 127
128static int __devexit pxa2xx_soc_platform_remove(struct platform_device *pdev) 128static int pxa2xx_soc_platform_remove(struct platform_device *pdev)
129{ 129{
130 snd_soc_unregister_platform(&pdev->dev); 130 snd_soc_unregister_platform(&pdev->dev);
131 return 0; 131 return 0;
@@ -138,7 +138,7 @@ static struct platform_driver pxa_pcm_driver = {
138 }, 138 },
139 139
140 .probe = pxa2xx_soc_platform_probe, 140 .probe = pxa2xx_soc_platform_probe,
141 .remove = __devexit_p(pxa2xx_soc_platform_remove), 141 .remove = pxa2xx_soc_platform_remove,
142}; 142};
143 143
144module_platform_driver(pxa_pcm_driver); 144module_platform_driver(pxa_pcm_driver);
diff --git a/sound/soc/pxa/tosa.c b/sound/soc/pxa/tosa.c
index 2aec63f3706a..a3fe19123f07 100644
--- a/sound/soc/pxa/tosa.c
+++ b/sound/soc/pxa/tosa.c
@@ -241,7 +241,7 @@ static struct snd_soc_card tosa = {
241 .num_links = ARRAY_SIZE(tosa_dai), 241 .num_links = ARRAY_SIZE(tosa_dai),
242}; 242};
243 243
244static int __devinit tosa_probe(struct platform_device *pdev) 244static int tosa_probe(struct platform_device *pdev)
245{ 245{
246 struct snd_soc_card *card = &tosa; 246 struct snd_soc_card *card = &tosa;
247 int ret; 247 int ret;
@@ -262,7 +262,7 @@ static int __devinit tosa_probe(struct platform_device *pdev)
262 return ret; 262 return ret;
263} 263}
264 264
265static int __devexit tosa_remove(struct platform_device *pdev) 265static int tosa_remove(struct platform_device *pdev)
266{ 266{
267 struct snd_soc_card *card = platform_get_drvdata(pdev); 267 struct snd_soc_card *card = platform_get_drvdata(pdev);
268 268
@@ -277,7 +277,7 @@ static struct platform_driver tosa_driver = {
277 .owner = THIS_MODULE, 277 .owner = THIS_MODULE,
278 }, 278 },
279 .probe = tosa_probe, 279 .probe = tosa_probe,
280 .remove = __devexit_p(tosa_remove), 280 .remove = tosa_remove,
281}; 281};
282 282
283module_platform_driver(tosa_driver); 283module_platform_driver(tosa_driver);
diff --git a/sound/soc/pxa/ttc-dkb.c b/sound/soc/pxa/ttc-dkb.c
index 935491a8a770..f4ea4f6663a2 100644
--- a/sound/soc/pxa/ttc-dkb.c
+++ b/sound/soc/pxa/ttc-dkb.c
@@ -131,7 +131,7 @@ static struct snd_soc_card ttc_dkb_card = {
131 .num_dapm_routes = ARRAY_SIZE(ttc_audio_map), 131 .num_dapm_routes = ARRAY_SIZE(ttc_audio_map),
132}; 132};
133 133
134static int __devinit ttc_dkb_probe(struct platform_device *pdev) 134static int ttc_dkb_probe(struct platform_device *pdev)
135{ 135{
136 struct snd_soc_card *card = &ttc_dkb_card; 136 struct snd_soc_card *card = &ttc_dkb_card;
137 int ret; 137 int ret;
@@ -146,7 +146,7 @@ static int __devinit ttc_dkb_probe(struct platform_device *pdev)
146 return ret; 146 return ret;
147} 147}
148 148
149static int __devexit ttc_dkb_remove(struct platform_device *pdev) 149static int ttc_dkb_remove(struct platform_device *pdev)
150{ 150{
151 struct snd_soc_card *card = platform_get_drvdata(pdev); 151 struct snd_soc_card *card = platform_get_drvdata(pdev);
152 152
@@ -161,7 +161,7 @@ static struct platform_driver ttc_dkb_driver = {
161 .owner = THIS_MODULE, 161 .owner = THIS_MODULE,
162 }, 162 },
163 .probe = ttc_dkb_probe, 163 .probe = ttc_dkb_probe,
164 .remove = __devexit_p(ttc_dkb_remove), 164 .remove = ttc_dkb_remove,
165}; 165};
166 166
167module_platform_driver(ttc_dkb_driver); 167module_platform_driver(ttc_dkb_driver);
diff --git a/sound/soc/s6000/s6000-i2s.c b/sound/soc/s6000/s6000-i2s.c
index aaabdbaec19c..fee4d477a49c 100644
--- a/sound/soc/s6000/s6000-i2s.c
+++ b/sound/soc/s6000/s6000-i2s.c
@@ -436,7 +436,7 @@ static struct snd_soc_dai_driver s6000_i2s_dai = {
436 .ops = &s6000_i2s_dai_ops, 436 .ops = &s6000_i2s_dai_ops,
437}; 437};
438 438
439static int __devinit s6000_i2s_probe(struct platform_device *pdev) 439static int s6000_i2s_probe(struct platform_device *pdev)
440{ 440{
441 struct s6000_i2s_dev *dev; 441 struct s6000_i2s_dev *dev;
442 struct resource *scbmem, *sifmem, *region, *dma1, *dma2; 442 struct resource *scbmem, *sifmem, *region, *dma1, *dma2;
@@ -566,7 +566,7 @@ err_release_none:
566 return ret; 566 return ret;
567} 567}
568 568
569static void __devexit s6000_i2s_remove(struct platform_device *pdev) 569static void s6000_i2s_remove(struct platform_device *pdev)
570{ 570{
571 struct s6000_i2s_dev *dev = dev_get_drvdata(&pdev->dev); 571 struct s6000_i2s_dev *dev = dev_get_drvdata(&pdev->dev);
572 struct resource *region; 572 struct resource *region;
@@ -597,7 +597,7 @@ static void __devexit s6000_i2s_remove(struct platform_device *pdev)
597 597
598static struct platform_driver s6000_i2s_driver = { 598static struct platform_driver s6000_i2s_driver = {
599 .probe = s6000_i2s_probe, 599 .probe = s6000_i2s_probe,
600 .remove = __devexit_p(s6000_i2s_remove), 600 .remove = s6000_i2s_remove,
601 .driver = { 601 .driver = {
602 .name = "s6000-i2s", 602 .name = "s6000-i2s",
603 .owner = THIS_MODULE, 603 .owner = THIS_MODULE,
diff --git a/sound/soc/s6000/s6000-pcm.c b/sound/soc/s6000/s6000-pcm.c
index 716da861c629..1358c7de2521 100644
--- a/sound/soc/s6000/s6000-pcm.c
+++ b/sound/soc/s6000/s6000-pcm.c
@@ -500,12 +500,12 @@ static struct snd_soc_platform_driver s6000_soc_platform = {
500 .pcm_free = s6000_pcm_free, 500 .pcm_free = s6000_pcm_free,
501}; 501};
502 502
503static int __devinit s6000_soc_platform_probe(struct platform_device *pdev) 503static int s6000_soc_platform_probe(struct platform_device *pdev)
504{ 504{
505 return snd_soc_register_platform(&pdev->dev, &s6000_soc_platform); 505 return snd_soc_register_platform(&pdev->dev, &s6000_soc_platform);
506} 506}
507 507
508static int __devexit s6000_soc_platform_remove(struct platform_device *pdev) 508static int s6000_soc_platform_remove(struct platform_device *pdev)
509{ 509{
510 snd_soc_unregister_platform(&pdev->dev); 510 snd_soc_unregister_platform(&pdev->dev);
511 return 0; 511 return 0;
@@ -518,7 +518,7 @@ static struct platform_driver s6000_pcm_driver = {
518 }, 518 },
519 519
520 .probe = s6000_soc_platform_probe, 520 .probe = s6000_soc_platform_probe,
521 .remove = __devexit_p(s6000_soc_platform_remove), 521 .remove = s6000_soc_platform_remove,
522}; 522};
523 523
524module_platform_driver(s6000_pcm_driver); 524module_platform_driver(s6000_pcm_driver);
diff --git a/sound/soc/samsung/ac97.c b/sound/soc/samsung/ac97.c
index 14fbcd30cae5..0df3c5644cfa 100644
--- a/sound/soc/samsung/ac97.c
+++ b/sound/soc/samsung/ac97.c
@@ -370,7 +370,7 @@ static struct snd_soc_dai_driver s3c_ac97_dai[] = {
370 }, 370 },
371}; 371};
372 372
373static __devinit int s3c_ac97_probe(struct platform_device *pdev) 373static int s3c_ac97_probe(struct platform_device *pdev)
374{ 374{
375 struct resource *mem_res, *dmatx_res, *dmarx_res, *dmamic_res, *irq_res; 375 struct resource *mem_res, *dmatx_res, *dmarx_res, *dmamic_res, *irq_res;
376 struct s3c_audio_pdata *ac97_pdata; 376 struct s3c_audio_pdata *ac97_pdata;
@@ -442,7 +442,7 @@ static __devinit int s3c_ac97_probe(struct platform_device *pdev)
442 ret = -ENODEV; 442 ret = -ENODEV;
443 goto err2; 443 goto err2;
444 } 444 }
445 clk_enable(s3c_ac97.ac97_clk); 445 clk_prepare_enable(s3c_ac97.ac97_clk);
446 446
447 if (ac97_pdata->cfg_gpio(pdev)) { 447 if (ac97_pdata->cfg_gpio(pdev)) {
448 dev_err(&pdev->dev, "Unable to configure gpio\n"); 448 dev_err(&pdev->dev, "Unable to configure gpio\n");
@@ -462,13 +462,20 @@ static __devinit int s3c_ac97_probe(struct platform_device *pdev)
462 if (ret) 462 if (ret)
463 goto err5; 463 goto err5;
464 464
465 return 0; 465 ret = asoc_dma_platform_register(&pdev->dev);
466 if (ret) {
467 dev_err(&pdev->dev, "failed to get register DMA: %d\n", ret);
468 goto err6;
469 }
466 470
471 return 0;
472err6:
473 snd_soc_unregister_dais(&pdev->dev, ARRAY_SIZE(s3c_ac97_dai));
467err5: 474err5:
468 free_irq(irq_res->start, NULL); 475 free_irq(irq_res->start, NULL);
469err4: 476err4:
470err3: 477err3:
471 clk_disable(s3c_ac97.ac97_clk); 478 clk_disable_unprepare(s3c_ac97.ac97_clk);
472 clk_put(s3c_ac97.ac97_clk); 479 clk_put(s3c_ac97.ac97_clk);
473err2: 480err2:
474 iounmap(s3c_ac97.regs); 481 iounmap(s3c_ac97.regs);
@@ -478,17 +485,18 @@ err1:
478 return ret; 485 return ret;
479} 486}
480 487
481static __devexit int s3c_ac97_remove(struct platform_device *pdev) 488static int s3c_ac97_remove(struct platform_device *pdev)
482{ 489{
483 struct resource *mem_res, *irq_res; 490 struct resource *mem_res, *irq_res;
484 491
492 asoc_dma_platform_unregister(&pdev->dev);
485 snd_soc_unregister_dais(&pdev->dev, ARRAY_SIZE(s3c_ac97_dai)); 493 snd_soc_unregister_dais(&pdev->dev, ARRAY_SIZE(s3c_ac97_dai));
486 494
487 irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0); 495 irq_res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
488 if (irq_res) 496 if (irq_res)
489 free_irq(irq_res->start, NULL); 497 free_irq(irq_res->start, NULL);
490 498
491 clk_disable(s3c_ac97.ac97_clk); 499 clk_disable_unprepare(s3c_ac97.ac97_clk);
492 clk_put(s3c_ac97.ac97_clk); 500 clk_put(s3c_ac97.ac97_clk);
493 501
494 iounmap(s3c_ac97.regs); 502 iounmap(s3c_ac97.regs);
@@ -502,7 +510,7 @@ static __devexit int s3c_ac97_remove(struct platform_device *pdev)
502 510
503static struct platform_driver s3c_ac97_driver = { 511static struct platform_driver s3c_ac97_driver = {
504 .probe = s3c_ac97_probe, 512 .probe = s3c_ac97_probe,
505 .remove = __devexit_p(s3c_ac97_remove), 513 .remove = s3c_ac97_remove,
506 .driver = { 514 .driver = {
507 .name = "samsung-ac97", 515 .name = "samsung-ac97",
508 .owner = THIS_MODULE, 516 .owner = THIS_MODULE,
diff --git a/sound/soc/samsung/bells.c b/sound/soc/samsung/bells.c
index a2ca1567b9e4..ceed466af9ff 100644
--- a/sound/soc/samsung/bells.c
+++ b/sound/soc/samsung/bells.c
@@ -18,15 +18,6 @@
18#include "../codecs/wm5102.h" 18#include "../codecs/wm5102.h"
19#include "../codecs/wm9081.h" 19#include "../codecs/wm9081.h"
20 20
21/*
22 * 44.1kHz based clocks for the SYSCLK domain, use a very high clock
23 * to allow all the DSP functionality to be enabled if desired.
24 */
25#define SYSCLK_RATE (44100 * 1024)
26
27/* 48kHz based clocks for the ASYNC domain */
28#define ASYNCCLK_RATE (48000 * 512)
29
30/* BCLK2 is fixed at this currently */ 21/* BCLK2 is fixed at this currently */
31#define BCLK2_RATE (64 * 8000) 22#define BCLK2_RATE (64 * 8000)
32 23
@@ -36,15 +27,40 @@
36 */ 27 */
37#define MCLK_RATE 24576000 28#define MCLK_RATE 24576000
38 29
39#define WM9081_AUDIO_RATE 44100 30#define SYS_AUDIO_RATE 44100
40#define WM9081_MCLK_RATE (WM9081_AUDIO_RATE * 256) 31#define SYS_MCLK_RATE (SYS_AUDIO_RATE * 512)
32
33#define DAI_AP_DSP 0
34#define DAI_DSP_CODEC 1
35#define DAI_CODEC_CP 2
36#define DAI_CODEC_SUB 3
37
38struct bells_drvdata {
39 int sysclk_rate;
40 int asyncclk_rate;
41};
42
43static struct bells_drvdata wm2200_drvdata = {
44 .sysclk_rate = 22579200,
45};
46
47static struct bells_drvdata wm5102_drvdata = {
48 .sysclk_rate = 45158400,
49 .asyncclk_rate = 49152000,
50};
51
52static struct bells_drvdata wm5110_drvdata = {
53 .sysclk_rate = 135475200,
54 .asyncclk_rate = 147456000,
55};
41 56
42static int bells_set_bias_level(struct snd_soc_card *card, 57static int bells_set_bias_level(struct snd_soc_card *card,
43 struct snd_soc_dapm_context *dapm, 58 struct snd_soc_dapm_context *dapm,
44 enum snd_soc_bias_level level) 59 enum snd_soc_bias_level level)
45{ 60{
46 struct snd_soc_dai *codec_dai = card->rtd[0].codec_dai; 61 struct snd_soc_dai *codec_dai = card->rtd[DAI_DSP_CODEC].codec_dai;
47 struct snd_soc_codec *codec = codec_dai->codec; 62 struct snd_soc_codec *codec = codec_dai->codec;
63 struct bells_drvdata *bells = card->drvdata;
48 int ret; 64 int ret;
49 65
50 if (dapm->dev != codec_dai->dev) 66 if (dapm->dev != codec_dai->dev)
@@ -52,18 +68,21 @@ static int bells_set_bias_level(struct snd_soc_card *card,
52 68
53 switch (level) { 69 switch (level) {
54 case SND_SOC_BIAS_PREPARE: 70 case SND_SOC_BIAS_PREPARE:
55 if (dapm->bias_level == SND_SOC_BIAS_STANDBY) { 71 if (dapm->bias_level != SND_SOC_BIAS_STANDBY)
56 ret = snd_soc_codec_set_pll(codec, WM5102_FLL1, 72 break;
57 ARIZONA_FLL_SRC_MCLK1,
58 MCLK_RATE,
59 SYSCLK_RATE);
60 if (ret < 0)
61 pr_err("Failed to start FLL: %d\n", ret);
62 73
74 ret = snd_soc_codec_set_pll(codec, WM5102_FLL1,
75 ARIZONA_FLL_SRC_MCLK1,
76 MCLK_RATE,
77 bells->sysclk_rate);
78 if (ret < 0)
79 pr_err("Failed to start FLL: %d\n", ret);
80
81 if (bells->asyncclk_rate) {
63 ret = snd_soc_codec_set_pll(codec, WM5102_FLL2, 82 ret = snd_soc_codec_set_pll(codec, WM5102_FLL2,
64 ARIZONA_FLL_SRC_AIF2BCLK, 83 ARIZONA_FLL_SRC_AIF2BCLK,
65 BCLK2_RATE, 84 BCLK2_RATE,
66 ASYNCCLK_RATE); 85 bells->asyncclk_rate);
67 if (ret < 0) 86 if (ret < 0)
68 pr_err("Failed to start FLL: %d\n", ret); 87 pr_err("Failed to start FLL: %d\n", ret);
69 } 88 }
@@ -80,8 +99,9 @@ static int bells_set_bias_level_post(struct snd_soc_card *card,
80 struct snd_soc_dapm_context *dapm, 99 struct snd_soc_dapm_context *dapm,
81 enum snd_soc_bias_level level) 100 enum snd_soc_bias_level level)
82{ 101{
83 struct snd_soc_dai *codec_dai = card->rtd[0].codec_dai; 102 struct snd_soc_dai *codec_dai = card->rtd[DAI_DSP_CODEC].codec_dai;
84 struct snd_soc_codec *codec = codec_dai->codec; 103 struct snd_soc_codec *codec = codec_dai->codec;
104 struct bells_drvdata *bells = card->drvdata;
85 int ret; 105 int ret;
86 106
87 if (dapm->dev != codec_dai->dev) 107 if (dapm->dev != codec_dai->dev)
@@ -95,10 +115,13 @@ static int bells_set_bias_level_post(struct snd_soc_card *card,
95 return ret; 115 return ret;
96 } 116 }
97 117
98 ret = snd_soc_codec_set_pll(codec, WM5102_FLL2, 0, 0, 0); 118 if (bells->asyncclk_rate) {
99 if (ret < 0) { 119 ret = snd_soc_codec_set_pll(codec, WM5102_FLL2,
100 pr_err("Failed to stop FLL: %d\n", ret); 120 0, 0, 0);
101 return ret; 121 if (ret < 0) {
122 pr_err("Failed to stop FLL: %d\n", ret);
123 return ret;
124 }
102 } 125 }
103 break; 126 break;
104 127
@@ -113,56 +136,73 @@ static int bells_set_bias_level_post(struct snd_soc_card *card,
113 136
114static int bells_late_probe(struct snd_soc_card *card) 137static int bells_late_probe(struct snd_soc_card *card)
115{ 138{
116 struct snd_soc_codec *codec = card->rtd[0].codec; 139 struct bells_drvdata *bells = card->drvdata;
117 struct snd_soc_dai *aif1_dai = card->rtd[0].codec_dai; 140 struct snd_soc_codec *wm0010 = card->rtd[DAI_AP_DSP].codec;
118 struct snd_soc_dai *aif2_dai = card->rtd[1].cpu_dai; 141 struct snd_soc_codec *codec = card->rtd[DAI_DSP_CODEC].codec;
119 struct snd_soc_dai *aif3_dai = card->rtd[2].cpu_dai; 142 struct snd_soc_dai *aif1_dai = card->rtd[DAI_DSP_CODEC].codec_dai;
120 struct snd_soc_dai *wm9081_dai = card->rtd[2].codec_dai; 143 struct snd_soc_dai *aif2_dai;
144 struct snd_soc_dai *aif3_dai;
145 struct snd_soc_dai *wm9081_dai;
121 int ret; 146 int ret;
122 147
123 ret = snd_soc_dai_set_sysclk(aif1_dai, ARIZONA_CLK_SYSCLK, 0, 0); 148 ret = snd_soc_codec_set_sysclk(codec, ARIZONA_CLK_SYSCLK,
149 ARIZONA_CLK_SRC_FLL1,
150 bells->sysclk_rate,
151 SND_SOC_CLOCK_IN);
124 if (ret != 0) { 152 if (ret != 0) {
125 dev_err(aif1_dai->dev, "Failed to set AIF1 clock: %d\n", ret); 153 dev_err(codec->dev, "Failed to set SYSCLK: %d\n", ret);
126 return ret; 154 return ret;
127 } 155 }
128 156
129 ret = snd_soc_dai_set_sysclk(aif2_dai, ARIZONA_CLK_ASYNCCLK, 0, 0); 157 ret = snd_soc_codec_set_sysclk(wm0010, 0, 0, SYS_MCLK_RATE, 0);
130 if (ret != 0) { 158 if (ret != 0) {
131 dev_err(aif2_dai->dev, "Failed to set AIF2 clock: %d\n", ret); 159 dev_err(wm0010->dev, "Failed to set WM0010 clock: %d\n", ret);
132 return ret; 160 return ret;
133 } 161 }
134 162
135 ret = snd_soc_dai_set_sysclk(aif3_dai, ARIZONA_CLK_SYSCLK, 0, 0); 163 ret = snd_soc_dai_set_sysclk(aif1_dai, ARIZONA_CLK_SYSCLK, 0, 0);
136 if (ret != 0) { 164 if (ret != 0)
137 dev_err(aif1_dai->dev, "Failed to set AIF1 clock: %d\n", ret); 165 dev_err(aif1_dai->dev, "Failed to set AIF1 clock: %d\n", ret);
138 return ret;
139 }
140 166
141 ret = snd_soc_codec_set_sysclk(codec, ARIZONA_CLK_SYSCLK, 167 ret = snd_soc_codec_set_sysclk(codec, ARIZONA_CLK_OPCLK, 0,
142 ARIZONA_CLK_SRC_FLL1, SYSCLK_RATE, 168 SYS_MCLK_RATE, SND_SOC_CLOCK_OUT);
169 if (ret != 0)
170 dev_err(codec->dev, "Failed to set OPCLK: %d\n", ret);
171
172 if (card->num_rtd == DAI_CODEC_CP)
173 return 0;
174
175 ret = snd_soc_codec_set_sysclk(codec, ARIZONA_CLK_ASYNCCLK,
176 ARIZONA_CLK_SRC_FLL2,
177 bells->asyncclk_rate,
143 SND_SOC_CLOCK_IN); 178 SND_SOC_CLOCK_IN);
144 if (ret != 0) { 179 if (ret != 0) {
145 dev_err(codec->dev, "Failed to set SYSCLK: %d\n", ret); 180 dev_err(codec->dev, "Failed to set ASYNCCLK: %d\n", ret);
146 return ret; 181 return ret;
147 } 182 }
148 183
149 ret = snd_soc_codec_set_sysclk(codec, ARIZONA_CLK_OPCLK, 0, 184 aif2_dai = card->rtd[DAI_CODEC_CP].cpu_dai;
150 WM9081_MCLK_RATE, SND_SOC_CLOCK_OUT); 185
186 ret = snd_soc_dai_set_sysclk(aif2_dai, ARIZONA_CLK_ASYNCCLK, 0, 0);
151 if (ret != 0) { 187 if (ret != 0) {
152 dev_err(codec->dev, "Failed to set OPCLK: %d\n", ret); 188 dev_err(aif2_dai->dev, "Failed to set AIF2 clock: %d\n", ret);
153 return ret; 189 return ret;
154 } 190 }
155 191
156 ret = snd_soc_codec_set_sysclk(codec, ARIZONA_CLK_ASYNCCLK, 192 if (card->num_rtd == DAI_CODEC_SUB)
157 ARIZONA_CLK_SRC_FLL2, ASYNCCLK_RATE, 193 return 0;
158 SND_SOC_CLOCK_IN); 194
195 aif3_dai = card->rtd[DAI_CODEC_SUB].cpu_dai;
196 wm9081_dai = card->rtd[DAI_CODEC_SUB].codec_dai;
197
198 ret = snd_soc_dai_set_sysclk(aif3_dai, ARIZONA_CLK_SYSCLK, 0, 0);
159 if (ret != 0) { 199 if (ret != 0) {
160 dev_err(codec->dev, "Failed to set SYSCLK: %d\n", ret); 200 dev_err(aif1_dai->dev, "Failed to set AIF1 clock: %d\n", ret);
161 return ret; 201 return ret;
162 } 202 }
163 203
164 ret = snd_soc_codec_set_sysclk(wm9081_dai->codec, WM9081_SYSCLK_MCLK, 204 ret = snd_soc_codec_set_sysclk(wm9081_dai->codec, WM9081_SYSCLK_MCLK,
165 0, WM9081_MCLK_RATE, 0); 205 0, SYS_MCLK_RATE, 0);
166 if (ret != 0) { 206 if (ret != 0) {
167 dev_err(wm9081_dai->dev, "Failed to set MCLK: %d\n", ret); 207 dev_err(wm9081_dai->dev, "Failed to set MCLK: %d\n", ret);
168 return ret; 208 return ret;
@@ -181,22 +221,57 @@ static const struct snd_soc_pcm_stream baseband_params = {
181 221
182static const struct snd_soc_pcm_stream sub_params = { 222static const struct snd_soc_pcm_stream sub_params = {
183 .formats = SNDRV_PCM_FMTBIT_S32_LE, 223 .formats = SNDRV_PCM_FMTBIT_S32_LE,
184 .rate_min = WM9081_AUDIO_RATE, 224 .rate_min = SYS_AUDIO_RATE,
185 .rate_max = WM9081_AUDIO_RATE, 225 .rate_max = SYS_AUDIO_RATE,
186 .channels_min = 2, 226 .channels_min = 2,
187 .channels_max = 2, 227 .channels_max = 2,
188}; 228};
189 229
230static struct snd_soc_dai_link bells_dai_wm2200[] = {
231 {
232 .name = "CPU-DSP",
233 .stream_name = "CPU-DSP",
234 .cpu_dai_name = "samsung-i2s.0",
235 .codec_dai_name = "wm0010-sdi1",
236 .platform_name = "samsung-i2s.0",
237 .codec_name = "spi0.0",
238 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
239 | SND_SOC_DAIFMT_CBM_CFM,
240 },
241 {
242 .name = "DSP-CODEC",
243 .stream_name = "DSP-CODEC",
244 .cpu_dai_name = "wm0010-sdi2",
245 .codec_dai_name = "wm2200",
246 .codec_name = "wm2200.1-003a",
247 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
248 | SND_SOC_DAIFMT_CBM_CFM,
249 .params = &sub_params,
250 .ignore_suspend = 1,
251 },
252};
253
190static struct snd_soc_dai_link bells_dai_wm5102[] = { 254static struct snd_soc_dai_link bells_dai_wm5102[] = {
191 { 255 {
192 .name = "CPU", 256 .name = "CPU-DSP",
193 .stream_name = "CPU", 257 .stream_name = "CPU-DSP",
194 .cpu_dai_name = "samsung-i2s.0", 258 .cpu_dai_name = "samsung-i2s.0",
259 .codec_dai_name = "wm0010-sdi1",
260 .platform_name = "samsung-i2s.0",
261 .codec_name = "spi0.0",
262 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
263 | SND_SOC_DAIFMT_CBM_CFM,
264 },
265 {
266 .name = "DSP-CODEC",
267 .stream_name = "DSP-CODEC",
268 .cpu_dai_name = "wm0010-sdi2",
195 .codec_dai_name = "wm5102-aif1", 269 .codec_dai_name = "wm5102-aif1",
196 .platform_name = "samsung-audio",
197 .codec_name = "wm5102-codec", 270 .codec_name = "wm5102-codec",
198 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF 271 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
199 | SND_SOC_DAIFMT_CBM_CFM, 272 | SND_SOC_DAIFMT_CBM_CFM,
273 .params = &sub_params,
274 .ignore_suspend = 1,
200 }, 275 },
201 { 276 {
202 .name = "Baseband", 277 .name = "Baseband",
@@ -224,14 +299,25 @@ static struct snd_soc_dai_link bells_dai_wm5102[] = {
224 299
225static struct snd_soc_dai_link bells_dai_wm5110[] = { 300static struct snd_soc_dai_link bells_dai_wm5110[] = {
226 { 301 {
227 .name = "CPU", 302 .name = "CPU-DSP",
228 .stream_name = "CPU", 303 .stream_name = "CPU-DSP",
229 .cpu_dai_name = "samsung-i2s.0", 304 .cpu_dai_name = "samsung-i2s.0",
305 .codec_dai_name = "wm0010-sdi1",
306 .platform_name = "samsung-i2s.0",
307 .codec_name = "spi0.0",
308 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
309 | SND_SOC_DAIFMT_CBM_CFM,
310 },
311 {
312 .name = "DSP-CODEC",
313 .stream_name = "DSP-CODEC",
314 .cpu_dai_name = "wm0010-sdi2",
230 .codec_dai_name = "wm5110-aif1", 315 .codec_dai_name = "wm5110-aif1",
231 .platform_name = "samsung-audio",
232 .codec_name = "wm5110-codec", 316 .codec_name = "wm5110-codec",
233 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF 317 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
234 | SND_SOC_DAIFMT_CBM_CFM, 318 | SND_SOC_DAIFMT_CBM_CFM,
319 .params = &sub_params,
320 .ignore_suspend = 1,
235 }, 321 },
236 { 322 {
237 .name = "Baseband", 323 .name = "Baseband",
@@ -270,6 +356,24 @@ static struct snd_soc_dapm_route bells_routes[] = {
270 356
271static struct snd_soc_card bells_cards[] = { 357static struct snd_soc_card bells_cards[] = {
272 { 358 {
359 .name = "Bells WM2200",
360 .owner = THIS_MODULE,
361 .dai_link = bells_dai_wm2200,
362 .num_links = ARRAY_SIZE(bells_dai_wm2200),
363 .codec_conf = bells_codec_conf,
364 .num_configs = ARRAY_SIZE(bells_codec_conf),
365
366 .late_probe = bells_late_probe,
367
368 .dapm_routes = bells_routes,
369 .num_dapm_routes = ARRAY_SIZE(bells_routes),
370
371 .set_bias_level = bells_set_bias_level,
372 .set_bias_level_post = bells_set_bias_level_post,
373
374 .drvdata = &wm2200_drvdata,
375 },
376 {
273 .name = "Bells WM5102", 377 .name = "Bells WM5102",
274 .owner = THIS_MODULE, 378 .owner = THIS_MODULE,
275 .dai_link = bells_dai_wm5102, 379 .dai_link = bells_dai_wm5102,
@@ -284,6 +388,8 @@ static struct snd_soc_card bells_cards[] = {
284 388
285 .set_bias_level = bells_set_bias_level, 389 .set_bias_level = bells_set_bias_level,
286 .set_bias_level_post = bells_set_bias_level_post, 390 .set_bias_level_post = bells_set_bias_level_post,
391
392 .drvdata = &wm5102_drvdata,
287 }, 393 },
288 { 394 {
289 .name = "Bells WM5110", 395 .name = "Bells WM5110",
@@ -300,11 +406,13 @@ static struct snd_soc_card bells_cards[] = {
300 406
301 .set_bias_level = bells_set_bias_level, 407 .set_bias_level = bells_set_bias_level,
302 .set_bias_level_post = bells_set_bias_level_post, 408 .set_bias_level_post = bells_set_bias_level_post,
409
410 .drvdata = &wm5110_drvdata,
303 }, 411 },
304}; 412};
305 413
306 414
307static __devinit int bells_probe(struct platform_device *pdev) 415static int bells_probe(struct platform_device *pdev)
308{ 416{
309 int ret; 417 int ret;
310 418
@@ -321,7 +429,7 @@ static __devinit int bells_probe(struct platform_device *pdev)
321 return 0; 429 return 0;
322} 430}
323 431
324static int __devexit bells_remove(struct platform_device *pdev) 432static int bells_remove(struct platform_device *pdev)
325{ 433{
326 snd_soc_unregister_card(&bells_cards[pdev->id]); 434 snd_soc_unregister_card(&bells_cards[pdev->id]);
327 435
@@ -335,7 +443,7 @@ static struct platform_driver bells_driver = {
335 .pm = &snd_soc_pm_ops, 443 .pm = &snd_soc_pm_ops,
336 }, 444 },
337 .probe = bells_probe, 445 .probe = bells_probe,
338 .remove = __devexit_p(bells_remove), 446 .remove = bells_remove,
339}; 447};
340 448
341module_platform_driver(bells_driver); 449module_platform_driver(bells_driver);
diff --git a/sound/soc/samsung/dma.c b/sound/soc/samsung/dma.c
index b70964ea448c..db87628d7630 100644
--- a/sound/soc/samsung/dma.c
+++ b/sound/soc/samsung/dma.c
@@ -432,30 +432,18 @@ static struct snd_soc_platform_driver samsung_asoc_platform = {
432 .pcm_free = dma_free_dma_buffers, 432 .pcm_free = dma_free_dma_buffers,
433}; 433};
434 434
435static int __devinit samsung_asoc_platform_probe(struct platform_device *pdev) 435int asoc_dma_platform_register(struct device *dev)
436{ 436{
437 return snd_soc_register_platform(&pdev->dev, &samsung_asoc_platform); 437 return snd_soc_register_platform(dev, &samsung_asoc_platform);
438} 438}
439EXPORT_SYMBOL_GPL(asoc_dma_platform_register);
439 440
440static int __devexit samsung_asoc_platform_remove(struct platform_device *pdev) 441void asoc_dma_platform_unregister(struct device *dev)
441{ 442{
442 snd_soc_unregister_platform(&pdev->dev); 443 snd_soc_unregister_platform(dev);
443 return 0;
444} 444}
445 445EXPORT_SYMBOL_GPL(asoc_dma_platform_unregister);
446static struct platform_driver asoc_dma_driver = {
447 .driver = {
448 .name = "samsung-audio",
449 .owner = THIS_MODULE,
450 },
451
452 .probe = samsung_asoc_platform_probe,
453 .remove = __devexit_p(samsung_asoc_platform_remove),
454};
455
456module_platform_driver(asoc_dma_driver);
457 446
458MODULE_AUTHOR("Ben Dooks, <ben@simtec.co.uk>"); 447MODULE_AUTHOR("Ben Dooks, <ben@simtec.co.uk>");
459MODULE_DESCRIPTION("Samsung ASoC DMA Driver"); 448MODULE_DESCRIPTION("Samsung ASoC DMA Driver");
460MODULE_LICENSE("GPL"); 449MODULE_LICENSE("GPL");
461MODULE_ALIAS("platform:samsung-audio");
diff --git a/sound/soc/samsung/dma.h b/sound/soc/samsung/dma.h
index 7d1ead77ef21..73d8c7c8a1e8 100644
--- a/sound/soc/samsung/dma.h
+++ b/sound/soc/samsung/dma.h
@@ -21,4 +21,7 @@ struct s3c_dma_params {
21 struct samsung_dma_ops *ops; 21 struct samsung_dma_ops *ops;
22}; 22};
23 23
24int asoc_dma_platform_register(struct device *dev);
25void asoc_dma_platform_unregister(struct device *dev);
26
24#endif 27#endif
diff --git a/sound/soc/samsung/goni_wm8994.c b/sound/soc/samsung/goni_wm8994.c
index c23c2ae91f58..d37ede58e0a8 100644
--- a/sound/soc/samsung/goni_wm8994.c
+++ b/sound/soc/samsung/goni_wm8994.c
@@ -228,7 +228,7 @@ static struct snd_soc_dai_link goni_dai[] = {
228 .stream_name = "WM8994 HiFi", 228 .stream_name = "WM8994 HiFi",
229 .cpu_dai_name = "samsung-i2s.0", 229 .cpu_dai_name = "samsung-i2s.0",
230 .codec_dai_name = "wm8994-aif1", 230 .codec_dai_name = "wm8994-aif1",
231 .platform_name = "samsung-audio", 231 .platform_name = "samsung-i2s.0",
232 .codec_name = "wm8994-codec.0-001a", 232 .codec_name = "wm8994-codec.0-001a",
233 .init = goni_wm8994_init, 233 .init = goni_wm8994_init,
234 .ops = &goni_hifi_ops, 234 .ops = &goni_hifi_ops,
diff --git a/sound/soc/samsung/h1940_uda1380.c b/sound/soc/samsung/h1940_uda1380.c
index 6e3257717c54..3870e9678b5d 100644
--- a/sound/soc/samsung/h1940_uda1380.c
+++ b/sound/soc/samsung/h1940_uda1380.c
@@ -207,7 +207,7 @@ static struct snd_soc_dai_link h1940_uda1380_dai[] = {
207 .cpu_dai_name = "s3c24xx-iis", 207 .cpu_dai_name = "s3c24xx-iis",
208 .codec_dai_name = "uda1380-hifi", 208 .codec_dai_name = "uda1380-hifi",
209 .init = h1940_uda1380_init, 209 .init = h1940_uda1380_init,
210 .platform_name = "samsung-audio", 210 .platform_name = "s3c24xx-iis",
211 .codec_name = "uda1380-codec.0-001a", 211 .codec_name = "uda1380-codec.0-001a",
212 .ops = &h1940_ops, 212 .ops = &h1940_ops,
213 }, 213 },
diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c
index 40b00a13dcd1..d2d124f1dd1b 100644
--- a/sound/soc/samsung/i2s.c
+++ b/sound/soc/samsung/i2s.c
@@ -49,8 +49,6 @@ struct i2s_dai {
49 struct clk *clk; 49 struct clk *clk;
50 /* Clock for generating I2S signals */ 50 /* Clock for generating I2S signals */
51 struct clk *op_clk; 51 struct clk *op_clk;
52 /* Array of clock names for op_clk */
53 const char **src_clk;
54 /* Pointer to the Primary_Fifo if this is Sec_Fifo, NULL otherwise */ 52 /* Pointer to the Primary_Fifo if this is Sec_Fifo, NULL otherwise */
55 struct i2s_dai *pri_dai; 53 struct i2s_dai *pri_dai;
56 /* Pointer to the Secondary_Fifo if it has one, NULL otherwise */ 54 /* Pointer to the Secondary_Fifo if it has one, NULL otherwise */
@@ -423,7 +421,7 @@ static int i2s_set_sysclk(struct snd_soc_dai *dai,
423 if (i2s->op_clk) { 421 if (i2s->op_clk) {
424 if ((clk_id && !(mod & MOD_IMS_SYSMUX)) || 422 if ((clk_id && !(mod & MOD_IMS_SYSMUX)) ||
425 (!clk_id && (mod & MOD_IMS_SYSMUX))) { 423 (!clk_id && (mod & MOD_IMS_SYSMUX))) {
426 clk_disable(i2s->op_clk); 424 clk_disable_unprepare(i2s->op_clk);
427 clk_put(i2s->op_clk); 425 clk_put(i2s->op_clk);
428 } else { 426 } else {
429 i2s->rclk_srcrate = 427 i2s->rclk_srcrate =
@@ -432,9 +430,13 @@ static int i2s_set_sysclk(struct snd_soc_dai *dai,
432 } 430 }
433 } 431 }
434 432
435 i2s->op_clk = clk_get(&i2s->pdev->dev, 433 if (clk_id)
436 i2s->src_clk[clk_id]); 434 i2s->op_clk = clk_get(&i2s->pdev->dev,
437 clk_enable(i2s->op_clk); 435 "i2s_opclk1");
436 else
437 i2s->op_clk = clk_get(&i2s->pdev->dev,
438 "i2s_opclk0");
439 clk_prepare_enable(i2s->op_clk);
438 i2s->rclk_srcrate = clk_get_rate(i2s->op_clk); 440 i2s->rclk_srcrate = clk_get_rate(i2s->op_clk);
439 441
440 /* Over-ride the other's */ 442 /* Over-ride the other's */
@@ -880,7 +882,7 @@ static int samsung_i2s_dai_probe(struct snd_soc_dai *dai)
880 iounmap(i2s->addr); 882 iounmap(i2s->addr);
881 return -ENOENT; 883 return -ENOENT;
882 } 884 }
883 clk_enable(i2s->clk); 885 clk_prepare_enable(i2s->clk);
884 886
885 if (other) { 887 if (other) {
886 other->addr = i2s->addr; 888 other->addr = i2s->addr;
@@ -922,7 +924,7 @@ static int samsung_i2s_dai_remove(struct snd_soc_dai *dai)
922 if (i2s->quirks & QUIRK_NEED_RSTCLR) 924 if (i2s->quirks & QUIRK_NEED_RSTCLR)
923 writel(0, i2s->addr + I2SCON); 925 writel(0, i2s->addr + I2SCON);
924 926
925 clk_disable(i2s->clk); 927 clk_disable_unprepare(i2s->clk);
926 clk_put(i2s->clk); 928 clk_put(i2s->clk);
927 929
928 iounmap(i2s->addr); 930 iounmap(i2s->addr);
@@ -950,8 +952,7 @@ static const struct snd_soc_dai_ops samsung_i2s_dai_ops = {
950 SNDRV_PCM_FMTBIT_S16_LE | \ 952 SNDRV_PCM_FMTBIT_S16_LE | \
951 SNDRV_PCM_FMTBIT_S24_LE) 953 SNDRV_PCM_FMTBIT_S24_LE)
952 954
953static __devinit 955static struct i2s_dai *i2s_alloc_dai(struct platform_device *pdev, bool sec)
954struct i2s_dai *i2s_alloc_dai(struct platform_device *pdev, bool sec)
955{ 956{
956 struct i2s_dai *i2s; 957 struct i2s_dai *i2s;
957 958
@@ -992,7 +993,7 @@ struct i2s_dai *i2s_alloc_dai(struct platform_device *pdev, bool sec)
992 return i2s; 993 return i2s;
993} 994}
994 995
995static __devinit int samsung_i2s_probe(struct platform_device *pdev) 996static int samsung_i2s_probe(struct platform_device *pdev)
996{ 997{
997 u32 dma_pl_chan, dma_cp_chan, dma_pl_sec_chan; 998 u32 dma_pl_chan, dma_cp_chan, dma_pl_sec_chan;
998 struct i2s_dai *pri_dai, *sec_dai = NULL; 999 struct i2s_dai *pri_dai, *sec_dai = NULL;
@@ -1007,6 +1008,7 @@ static __devinit int samsung_i2s_probe(struct platform_device *pdev)
1007 sec_dai = dev_get_drvdata(&pdev->dev); 1008 sec_dai = dev_get_drvdata(&pdev->dev);
1008 snd_soc_register_dai(&sec_dai->pdev->dev, 1009 snd_soc_register_dai(&sec_dai->pdev->dev,
1009 &sec_dai->i2s_dai_drv); 1010 &sec_dai->i2s_dai_drv);
1011 asoc_dma_platform_register(&pdev->dev);
1010 return 0; 1012 return 0;
1011 } 1013 }
1012 1014
@@ -1067,7 +1069,6 @@ static __devinit int samsung_i2s_probe(struct platform_device *pdev)
1067 (struct s3c2410_dma_client *)&pri_dai->dma_capture; 1069 (struct s3c2410_dma_client *)&pri_dai->dma_capture;
1068 pri_dai->dma_playback.channel = dma_pl_chan; 1070 pri_dai->dma_playback.channel = dma_pl_chan;
1069 pri_dai->dma_capture.channel = dma_cp_chan; 1071 pri_dai->dma_capture.channel = dma_cp_chan;
1070 pri_dai->src_clk = i2s_cfg->src_clk;
1071 pri_dai->dma_playback.dma_size = 4; 1072 pri_dai->dma_playback.dma_size = 4;
1072 pri_dai->dma_capture.dma_size = 4; 1073 pri_dai->dma_capture.dma_size = 4;
1073 pri_dai->base = regs_base; 1074 pri_dai->base = regs_base;
@@ -1088,7 +1089,6 @@ static __devinit int samsung_i2s_probe(struct platform_device *pdev)
1088 (struct s3c2410_dma_client *)&sec_dai->dma_playback; 1089 (struct s3c2410_dma_client *)&sec_dai->dma_playback;
1089 /* Use iDMA always if SysDMA not provided */ 1090 /* Use iDMA always if SysDMA not provided */
1090 sec_dai->dma_playback.channel = dma_pl_sec_chan ? : -1; 1091 sec_dai->dma_playback.channel = dma_pl_sec_chan ? : -1;
1091 sec_dai->src_clk = i2s_cfg->src_clk;
1092 sec_dai->dma_playback.dma_size = 4; 1092 sec_dai->dma_playback.dma_size = 4;
1093 sec_dai->base = regs_base; 1093 sec_dai->base = regs_base;
1094 sec_dai->quirks = quirks; 1094 sec_dai->quirks = quirks;
@@ -1107,6 +1107,8 @@ static __devinit int samsung_i2s_probe(struct platform_device *pdev)
1107 1107
1108 pm_runtime_enable(&pdev->dev); 1108 pm_runtime_enable(&pdev->dev);
1109 1109
1110 asoc_dma_platform_register(&pdev->dev);
1111
1110 return 0; 1112 return 0;
1111err: 1113err:
1112 release_mem_region(regs_base, resource_size(res)); 1114 release_mem_region(regs_base, resource_size(res));
@@ -1114,7 +1116,7 @@ err:
1114 return ret; 1116 return ret;
1115} 1117}
1116 1118
1117static __devexit int samsung_i2s_remove(struct platform_device *pdev) 1119static int samsung_i2s_remove(struct platform_device *pdev)
1118{ 1120{
1119 struct i2s_dai *i2s, *other; 1121 struct i2s_dai *i2s, *other;
1120 struct resource *res; 1122 struct resource *res;
@@ -1135,6 +1137,7 @@ static __devexit int samsung_i2s_remove(struct platform_device *pdev)
1135 i2s->pri_dai = NULL; 1137 i2s->pri_dai = NULL;
1136 i2s->sec_dai = NULL; 1138 i2s->sec_dai = NULL;
1137 1139
1140 asoc_dma_platform_unregister(&pdev->dev);
1138 snd_soc_unregister_dai(&pdev->dev); 1141 snd_soc_unregister_dai(&pdev->dev);
1139 1142
1140 return 0; 1143 return 0;
@@ -1142,7 +1145,7 @@ static __devexit int samsung_i2s_remove(struct platform_device *pdev)
1142 1145
1143static struct platform_driver samsung_i2s_driver = { 1146static struct platform_driver samsung_i2s_driver = {
1144 .probe = samsung_i2s_probe, 1147 .probe = samsung_i2s_probe,
1145 .remove = __devexit_p(samsung_i2s_remove), 1148 .remove = samsung_i2s_remove,
1146 .driver = { 1149 .driver = {
1147 .name = "samsung-i2s", 1150 .name = "samsung-i2s",
1148 .owner = THIS_MODULE, 1151 .owner = THIS_MODULE,
diff --git a/sound/soc/samsung/idma.c b/sound/soc/samsung/idma.c
index c227c3163cae..a07950b0c8ce 100644
--- a/sound/soc/samsung/idma.c
+++ b/sound/soc/samsung/idma.c
@@ -416,12 +416,12 @@ static struct snd_soc_platform_driver asoc_idma_platform = {
416 .pcm_free = idma_free, 416 .pcm_free = idma_free,
417}; 417};
418 418
419static int __devinit asoc_idma_platform_probe(struct platform_device *pdev) 419static int asoc_idma_platform_probe(struct platform_device *pdev)
420{ 420{
421 return snd_soc_register_platform(&pdev->dev, &asoc_idma_platform); 421 return snd_soc_register_platform(&pdev->dev, &asoc_idma_platform);
422} 422}
423 423
424static int __devexit asoc_idma_platform_remove(struct platform_device *pdev) 424static int asoc_idma_platform_remove(struct platform_device *pdev)
425{ 425{
426 snd_soc_unregister_platform(&pdev->dev); 426 snd_soc_unregister_platform(&pdev->dev);
427 return 0; 427 return 0;
@@ -434,7 +434,7 @@ static struct platform_driver asoc_idma_driver = {
434 }, 434 },
435 435
436 .probe = asoc_idma_platform_probe, 436 .probe = asoc_idma_platform_probe,
437 .remove = __devexit_p(asoc_idma_platform_remove), 437 .remove = asoc_idma_platform_remove,
438}; 438};
439 439
440module_platform_driver(asoc_idma_driver); 440module_platform_driver(asoc_idma_driver);
diff --git a/sound/soc/samsung/jive_wm8750.c b/sound/soc/samsung/jive_wm8750.c
index 1578663a1faa..b5f6abd9d221 100644
--- a/sound/soc/samsung/jive_wm8750.c
+++ b/sound/soc/samsung/jive_wm8750.c
@@ -118,7 +118,7 @@ static struct snd_soc_dai_link jive_dai = {
118 .stream_name = "WM8750", 118 .stream_name = "WM8750",
119 .cpu_dai_name = "s3c2412-i2s", 119 .cpu_dai_name = "s3c2412-i2s",
120 .codec_dai_name = "wm8750-hifi", 120 .codec_dai_name = "wm8750-hifi",
121 .platform_name = "samsung-audio", 121 .platform_name = "s3c2412-i2s",
122 .codec_name = "wm8750.0-001a", 122 .codec_name = "wm8750.0-001a",
123 .init = jive_wm8750_init, 123 .init = jive_wm8750_init,
124 .ops = &jive_ops, 124 .ops = &jive_ops,
diff --git a/sound/soc/samsung/littlemill.c b/sound/soc/samsung/littlemill.c
index ee52c8a00779..bfb91f34a22a 100644
--- a/sound/soc/samsung/littlemill.c
+++ b/sound/soc/samsung/littlemill.c
@@ -145,7 +145,7 @@ static struct snd_soc_dai_link littlemill_dai[] = {
145 .stream_name = "CPU", 145 .stream_name = "CPU",
146 .cpu_dai_name = "samsung-i2s.0", 146 .cpu_dai_name = "samsung-i2s.0",
147 .codec_dai_name = "wm8994-aif1", 147 .codec_dai_name = "wm8994-aif1",
148 .platform_name = "samsung-audio", 148 .platform_name = "samsung-i2s.0",
149 .codec_name = "wm8994-codec", 149 .codec_name = "wm8994-codec",
150 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF 150 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
151 | SND_SOC_DAIFMT_CBM_CFM, 151 | SND_SOC_DAIFMT_CBM_CFM,
@@ -270,7 +270,7 @@ static int littlemill_late_probe(struct snd_soc_card *card)
270 return ret; 270 return ret;
271 271
272 /* This will check device compatibility itself */ 272 /* This will check device compatibility itself */
273 wm8958_mic_detect(codec, &littlemill_headset, NULL, NULL); 273 wm8958_mic_detect(codec, &littlemill_headset, NULL, NULL, NULL, NULL);
274 274
275 /* As will this */ 275 /* As will this */
276 wm8994_mic_detect(codec, &littlemill_headset, 1); 276 wm8994_mic_detect(codec, &littlemill_headset, 1);
@@ -297,7 +297,7 @@ static struct snd_soc_card littlemill = {
297 .late_probe = littlemill_late_probe, 297 .late_probe = littlemill_late_probe,
298}; 298};
299 299
300static __devinit int littlemill_probe(struct platform_device *pdev) 300static int littlemill_probe(struct platform_device *pdev)
301{ 301{
302 struct snd_soc_card *card = &littlemill; 302 struct snd_soc_card *card = &littlemill;
303 int ret; 303 int ret;
@@ -314,7 +314,7 @@ static __devinit int littlemill_probe(struct platform_device *pdev)
314 return 0; 314 return 0;
315} 315}
316 316
317static int __devexit littlemill_remove(struct platform_device *pdev) 317static int littlemill_remove(struct platform_device *pdev)
318{ 318{
319 struct snd_soc_card *card = platform_get_drvdata(pdev); 319 struct snd_soc_card *card = platform_get_drvdata(pdev);
320 320
@@ -330,7 +330,7 @@ static struct platform_driver littlemill_driver = {
330 .pm = &snd_soc_pm_ops, 330 .pm = &snd_soc_pm_ops,
331 }, 331 },
332 .probe = littlemill_probe, 332 .probe = littlemill_probe,
333 .remove = __devexit_p(littlemill_remove), 333 .remove = littlemill_remove,
334}; 334};
335 335
336module_platform_driver(littlemill_driver); 336module_platform_driver(littlemill_driver);
diff --git a/sound/soc/samsung/ln2440sbc_alc650.c b/sound/soc/samsung/ln2440sbc_alc650.c
index 69c4a5934a4d..9342fc270c2b 100644
--- a/sound/soc/samsung/ln2440sbc_alc650.c
+++ b/sound/soc/samsung/ln2440sbc_alc650.c
@@ -28,7 +28,7 @@ static struct snd_soc_dai_link ln2440sbc_dai[] = {
28 .cpu_dai_name = "samsung-ac97", 28 .cpu_dai_name = "samsung-ac97",
29 .codec_dai_name = "ac97-hifi", 29 .codec_dai_name = "ac97-hifi",
30 .codec_name = "ac97-codec", 30 .codec_name = "ac97-codec",
31 .platform_name = "samsung-audio", 31 .platform_name = "samsung-ac97",
32}, 32},
33}; 33};
34 34
diff --git a/sound/soc/samsung/lowland.c b/sound/soc/samsung/lowland.c
index 6abf341c4a2a..570cf5229508 100644
--- a/sound/soc/samsung/lowland.c
+++ b/sound/soc/samsung/lowland.c
@@ -99,7 +99,7 @@ static struct snd_soc_dai_link lowland_dai[] = {
99 .stream_name = "CPU", 99 .stream_name = "CPU",
100 .cpu_dai_name = "samsung-i2s.0", 100 .cpu_dai_name = "samsung-i2s.0",
101 .codec_dai_name = "wm5100-aif1", 101 .codec_dai_name = "wm5100-aif1",
102 .platform_name = "samsung-audio", 102 .platform_name = "samsung-i2s.0",
103 .codec_name = "wm5100.1-001a", 103 .codec_name = "wm5100.1-001a",
104 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | 104 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
105 SND_SOC_DAIFMT_CBM_CFM, 105 SND_SOC_DAIFMT_CBM_CFM,
@@ -180,7 +180,7 @@ static struct snd_soc_card lowland = {
180 .num_dapm_routes = ARRAY_SIZE(audio_paths), 180 .num_dapm_routes = ARRAY_SIZE(audio_paths),
181}; 181};
182 182
183static __devinit int lowland_probe(struct platform_device *pdev) 183static int lowland_probe(struct platform_device *pdev)
184{ 184{
185 struct snd_soc_card *card = &lowland; 185 struct snd_soc_card *card = &lowland;
186 int ret; 186 int ret;
@@ -197,7 +197,7 @@ static __devinit int lowland_probe(struct platform_device *pdev)
197 return 0; 197 return 0;
198} 198}
199 199
200static int __devexit lowland_remove(struct platform_device *pdev) 200static int lowland_remove(struct platform_device *pdev)
201{ 201{
202 struct snd_soc_card *card = platform_get_drvdata(pdev); 202 struct snd_soc_card *card = platform_get_drvdata(pdev);
203 203
@@ -213,7 +213,7 @@ static struct platform_driver lowland_driver = {
213 .pm = &snd_soc_pm_ops, 213 .pm = &snd_soc_pm_ops,
214 }, 214 },
215 .probe = lowland_probe, 215 .probe = lowland_probe,
216 .remove = __devexit_p(lowland_remove), 216 .remove = lowland_remove,
217}; 217};
218 218
219module_platform_driver(lowland_driver); 219module_platform_driver(lowland_driver);
diff --git a/sound/soc/samsung/neo1973_wm8753.c b/sound/soc/samsung/neo1973_wm8753.c
index 321d51134e47..c7e965f80d2e 100644
--- a/sound/soc/samsung/neo1973_wm8753.c
+++ b/sound/soc/samsung/neo1973_wm8753.c
@@ -364,7 +364,7 @@ static struct snd_soc_dai_link neo1973_dai[] = {
364{ /* Hifi Playback - for similatious use with voice below */ 364{ /* Hifi Playback - for similatious use with voice below */
365 .name = "WM8753", 365 .name = "WM8753",
366 .stream_name = "WM8753 HiFi", 366 .stream_name = "WM8753 HiFi",
367 .platform_name = "samsung-audio", 367 .platform_name = "s3c24xx-iis",
368 .cpu_dai_name = "s3c24xx-iis", 368 .cpu_dai_name = "s3c24xx-iis",
369 .codec_dai_name = "wm8753-hifi", 369 .codec_dai_name = "wm8753-hifi",
370 .codec_name = "wm8753.0-001a", 370 .codec_name = "wm8753.0-001a",
diff --git a/sound/soc/samsung/pcm.c b/sound/soc/samsung/pcm.c
index c86081992dfd..13bab79ad93d 100644
--- a/sound/soc/samsung/pcm.c
+++ b/sound/soc/samsung/pcm.c
@@ -490,7 +490,7 @@ static struct snd_soc_dai_driver s3c_pcm_dai[] = {
490 }, 490 },
491}; 491};
492 492
493static __devinit int s3c_pcm_dev_probe(struct platform_device *pdev) 493static int s3c_pcm_dev_probe(struct platform_device *pdev)
494{ 494{
495 struct s3c_pcm_info *pcm; 495 struct s3c_pcm_info *pcm;
496 struct resource *mem_res, *dmatx_res, *dmarx_res; 496 struct resource *mem_res, *dmatx_res, *dmarx_res;
@@ -543,7 +543,7 @@ static __devinit int s3c_pcm_dev_probe(struct platform_device *pdev)
543 ret = PTR_ERR(pcm->cclk); 543 ret = PTR_ERR(pcm->cclk);
544 goto err1; 544 goto err1;
545 } 545 }
546 clk_enable(pcm->cclk); 546 clk_prepare_enable(pcm->cclk);
547 547
548 /* record our pcm structure for later use in the callbacks */ 548 /* record our pcm structure for later use in the callbacks */
549 dev_set_drvdata(&pdev->dev, pcm); 549 dev_set_drvdata(&pdev->dev, pcm);
@@ -568,7 +568,7 @@ static __devinit int s3c_pcm_dev_probe(struct platform_device *pdev)
568 ret = -ENOENT; 568 ret = -ENOENT;
569 goto err4; 569 goto err4;
570 } 570 }
571 clk_enable(pcm->pclk); 571 clk_prepare_enable(pcm->pclk);
572 572
573 s3c_pcm_stereo_in[pdev->id].dma_addr = mem_res->start 573 s3c_pcm_stereo_in[pdev->id].dma_addr = mem_res->start
574 + S3C_PCM_RXFIFO; 574 + S3C_PCM_RXFIFO;
@@ -589,27 +589,36 @@ static __devinit int s3c_pcm_dev_probe(struct platform_device *pdev)
589 goto err5; 589 goto err5;
590 } 590 }
591 591
592 ret = asoc_dma_platform_register(&pdev->dev);
593 if (ret) {
594 dev_err(&pdev->dev, "failed to get register DMA: %d\n", ret);
595 goto err6;
596 }
597
592 return 0; 598 return 0;
593 599
600err6:
601 snd_soc_unregister_dai(&pdev->dev);
594err5: 602err5:
595 clk_disable(pcm->pclk); 603 clk_disable_unprepare(pcm->pclk);
596 clk_put(pcm->pclk); 604 clk_put(pcm->pclk);
597err4: 605err4:
598 iounmap(pcm->regs); 606 iounmap(pcm->regs);
599err3: 607err3:
600 release_mem_region(mem_res->start, resource_size(mem_res)); 608 release_mem_region(mem_res->start, resource_size(mem_res));
601err2: 609err2:
602 clk_disable(pcm->cclk); 610 clk_disable_unprepare(pcm->cclk);
603 clk_put(pcm->cclk); 611 clk_put(pcm->cclk);
604err1: 612err1:
605 return ret; 613 return ret;
606} 614}
607 615
608static __devexit int s3c_pcm_dev_remove(struct platform_device *pdev) 616static int s3c_pcm_dev_remove(struct platform_device *pdev)
609{ 617{
610 struct s3c_pcm_info *pcm = &s3c_pcm[pdev->id]; 618 struct s3c_pcm_info *pcm = &s3c_pcm[pdev->id];
611 struct resource *mem_res; 619 struct resource *mem_res;
612 620
621 asoc_dma_platform_unregister(&pdev->dev);
613 snd_soc_unregister_dai(&pdev->dev); 622 snd_soc_unregister_dai(&pdev->dev);
614 623
615 pm_runtime_disable(&pdev->dev); 624 pm_runtime_disable(&pdev->dev);
@@ -619,8 +628,8 @@ static __devexit int s3c_pcm_dev_remove(struct platform_device *pdev)
619 mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 628 mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
620 release_mem_region(mem_res->start, resource_size(mem_res)); 629 release_mem_region(mem_res->start, resource_size(mem_res));
621 630
622 clk_disable(pcm->cclk); 631 clk_disable_unprepare(pcm->cclk);
623 clk_disable(pcm->pclk); 632 clk_disable_unprepare(pcm->pclk);
624 clk_put(pcm->pclk); 633 clk_put(pcm->pclk);
625 clk_put(pcm->cclk); 634 clk_put(pcm->cclk);
626 635
@@ -629,7 +638,7 @@ static __devexit int s3c_pcm_dev_remove(struct platform_device *pdev)
629 638
630static struct platform_driver s3c_pcm_driver = { 639static struct platform_driver s3c_pcm_driver = {
631 .probe = s3c_pcm_dev_probe, 640 .probe = s3c_pcm_dev_probe,
632 .remove = __devexit_p(s3c_pcm_dev_remove), 641 .remove = s3c_pcm_dev_remove,
633 .driver = { 642 .driver = {
634 .name = "samsung-pcm", 643 .name = "samsung-pcm",
635 .owner = THIS_MODULE, 644 .owner = THIS_MODULE,
diff --git a/sound/soc/samsung/rx1950_uda1380.c b/sound/soc/samsung/rx1950_uda1380.c
index 21e12361a9cd..a5826ea9cad6 100644
--- a/sound/soc/samsung/rx1950_uda1380.c
+++ b/sound/soc/samsung/rx1950_uda1380.c
@@ -85,7 +85,7 @@ static struct snd_soc_dai_link rx1950_uda1380_dai[] = {
85 .cpu_dai_name = "s3c24xx-iis", 85 .cpu_dai_name = "s3c24xx-iis",
86 .codec_dai_name = "uda1380-hifi", 86 .codec_dai_name = "uda1380-hifi",
87 .init = rx1950_uda1380_init, 87 .init = rx1950_uda1380_init,
88 .platform_name = "samsung-audio", 88 .platform_name = "s3c24xx-iis",
89 .codec_name = "uda1380-codec.0-001a", 89 .codec_name = "uda1380-codec.0-001a",
90 .ops = &rx1950_ops, 90 .ops = &rx1950_ops,
91 }, 91 },
diff --git a/sound/soc/samsung/s3c2412-i2s.c b/sound/soc/samsung/s3c2412-i2s.c
index ac7701b3c5dc..221337716393 100644
--- a/sound/soc/samsung/s3c2412-i2s.c
+++ b/sound/soc/samsung/s3c2412-i2s.c
@@ -160,20 +160,38 @@ static struct snd_soc_dai_driver s3c2412_i2s_dai = {
160 .ops = &s3c2412_i2s_dai_ops, 160 .ops = &s3c2412_i2s_dai_ops,
161}; 161};
162 162
163static __devinit int s3c2412_iis_dev_probe(struct platform_device *pdev) 163static int s3c2412_iis_dev_probe(struct platform_device *pdev)
164{ 164{
165 return s3c_i2sv2_register_dai(&pdev->dev, -1, &s3c2412_i2s_dai); 165 int ret = 0;
166
167 ret = s3c_i2sv2_register_dai(&pdev->dev, -1, &s3c2412_i2s_dai);
168 if (ret) {
169 pr_err("failed to register the dai\n");
170 return ret;
171 }
172
173 ret = asoc_dma_platform_register(&pdev->dev);
174 if (ret) {
175 pr_err("failed to register the DMA: %d\n", ret);
176 goto err;
177 }
178
179 return 0;
180err:
181 snd_soc_unregister_dai(&pdev->dev);
182 return ret;
166} 183}
167 184
168static __devexit int s3c2412_iis_dev_remove(struct platform_device *pdev) 185static int s3c2412_iis_dev_remove(struct platform_device *pdev)
169{ 186{
187 asoc_dma_platform_unregister(&pdev->dev);
170 snd_soc_unregister_dai(&pdev->dev); 188 snd_soc_unregister_dai(&pdev->dev);
171 return 0; 189 return 0;
172} 190}
173 191
174static struct platform_driver s3c2412_iis_driver = { 192static struct platform_driver s3c2412_iis_driver = {
175 .probe = s3c2412_iis_dev_probe, 193 .probe = s3c2412_iis_dev_probe,
176 .remove = __devexit_p(s3c2412_iis_dev_remove), 194 .remove = s3c2412_iis_dev_remove,
177 .driver = { 195 .driver = {
178 .name = "s3c2412-iis", 196 .name = "s3c2412-iis",
179 .owner = THIS_MODULE, 197 .owner = THIS_MODULE,
diff --git a/sound/soc/samsung/s3c24xx-i2s.c b/sound/soc/samsung/s3c24xx-i2s.c
index 0aae3a3883dc..ee10e8704e97 100644
--- a/sound/soc/samsung/s3c24xx-i2s.c
+++ b/sound/soc/samsung/s3c24xx-i2s.c
@@ -465,20 +465,38 @@ static struct snd_soc_dai_driver s3c24xx_i2s_dai = {
465 .ops = &s3c24xx_i2s_dai_ops, 465 .ops = &s3c24xx_i2s_dai_ops,
466}; 466};
467 467
468static __devinit int s3c24xx_iis_dev_probe(struct platform_device *pdev) 468static int s3c24xx_iis_dev_probe(struct platform_device *pdev)
469{ 469{
470 return snd_soc_register_dai(&pdev->dev, &s3c24xx_i2s_dai); 470 int ret = 0;
471
472 ret = s3c_i2sv2_register_dai(&pdev->dev, -1, &s3c2412_i2s_dai);
473 if (ret) {
474 pr_err("failed to register the dai\n");
475 return ret;
476 }
477
478 ret = asoc_dma_platform_register(&pdev->dev);
479 if (ret) {
480 pr_err("failed to register the dma: %d\n", ret);
481 goto err;
482 }
483
484 return 0;
485err:
486 snd_soc_unregister_dai(&pdev->dev);
487 return ret;
471} 488}
472 489
473static __devexit int s3c24xx_iis_dev_remove(struct platform_device *pdev) 490static int s3c24xx_iis_dev_remove(struct platform_device *pdev)
474{ 491{
492 asoc_dma_platform_unregister(&pdev->dev);
475 snd_soc_unregister_dai(&pdev->dev); 493 snd_soc_unregister_dai(&pdev->dev);
476 return 0; 494 return 0;
477} 495}
478 496
479static struct platform_driver s3c24xx_iis_driver = { 497static struct platform_driver s3c24xx_iis_driver = {
480 .probe = s3c24xx_iis_dev_probe, 498 .probe = s3c24xx_iis_dev_probe,
481 .remove = __devexit_p(s3c24xx_iis_dev_remove), 499 .remove = s3c24xx_iis_dev_remove,
482 .driver = { 500 .driver = {
483 .name = "s3c24xx-iis", 501 .name = "s3c24xx-iis",
484 .owner = THIS_MODULE, 502 .owner = THIS_MODULE,
diff --git a/sound/soc/samsung/s3c24xx_simtec.c b/sound/soc/samsung/s3c24xx_simtec.c
index 335a7d8a4a8d..2c015f62ead6 100644
--- a/sound/soc/samsung/s3c24xx_simtec.c
+++ b/sound/soc/samsung/s3c24xx_simtec.c
@@ -313,8 +313,8 @@ const struct dev_pm_ops simtec_audio_pmops = {
313EXPORT_SYMBOL_GPL(simtec_audio_pmops); 313EXPORT_SYMBOL_GPL(simtec_audio_pmops);
314#endif 314#endif
315 315
316int __devinit simtec_audio_core_probe(struct platform_device *pdev, 316int simtec_audio_core_probe(struct platform_device *pdev,
317 struct snd_soc_card *card) 317 struct snd_soc_card *card)
318{ 318{
319 struct platform_device *snd_dev; 319 struct platform_device *snd_dev;
320 int ret; 320 int ret;
@@ -371,7 +371,7 @@ err_clk:
371} 371}
372EXPORT_SYMBOL_GPL(simtec_audio_core_probe); 372EXPORT_SYMBOL_GPL(simtec_audio_core_probe);
373 373
374int __devexit simtec_audio_remove(struct platform_device *pdev) 374int simtec_audio_remove(struct platform_device *pdev)
375{ 375{
376 struct platform_device *snd_dev = platform_get_drvdata(pdev); 376 struct platform_device *snd_dev = platform_get_drvdata(pdev);
377 377
diff --git a/sound/soc/samsung/s3c24xx_simtec_hermes.c b/sound/soc/samsung/s3c24xx_simtec_hermes.c
index 7ace6a87f41b..d8a0543cae5e 100644
--- a/sound/soc/samsung/s3c24xx_simtec_hermes.c
+++ b/sound/soc/samsung/s3c24xx_simtec_hermes.c
@@ -82,7 +82,7 @@ static struct snd_soc_dai_link simtec_dai_aic33 = {
82 .codec_name = "tlv320aic3x-codec.0-001a", 82 .codec_name = "tlv320aic3x-codec.0-001a",
83 .cpu_dai_name = "s3c24xx-iis", 83 .cpu_dai_name = "s3c24xx-iis",
84 .codec_dai_name = "tlv320aic3x-hifi", 84 .codec_dai_name = "tlv320aic3x-hifi",
85 .platform_name = "samsung-audio", 85 .platform_name = "s3c24xx-iis",
86 .init = simtec_hermes_init, 86 .init = simtec_hermes_init,
87}; 87};
88 88
@@ -99,7 +99,7 @@ static struct snd_soc_card snd_soc_machine_simtec_aic33 = {
99 .num_dapm_routes = ARRAY_SIZE(base_map), 99 .num_dapm_routes = ARRAY_SIZE(base_map),
100}; 100};
101 101
102static int __devinit simtec_audio_hermes_probe(struct platform_device *pd) 102static int simtec_audio_hermes_probe(struct platform_device *pd)
103{ 103{
104 dev_info(&pd->dev, "probing....\n"); 104 dev_info(&pd->dev, "probing....\n");
105 return simtec_audio_core_probe(pd, &snd_soc_machine_simtec_aic33); 105 return simtec_audio_core_probe(pd, &snd_soc_machine_simtec_aic33);
@@ -112,7 +112,7 @@ static struct platform_driver simtec_audio_hermes_platdrv = {
112 .pm = simtec_audio_pm, 112 .pm = simtec_audio_pm,
113 }, 113 },
114 .probe = simtec_audio_hermes_probe, 114 .probe = simtec_audio_hermes_probe,
115 .remove = __devexit_p(simtec_audio_remove), 115 .remove = simtec_audio_remove,
116}; 116};
117 117
118module_platform_driver(simtec_audio_hermes_platdrv); 118module_platform_driver(simtec_audio_hermes_platdrv);
diff --git a/sound/soc/samsung/s3c24xx_simtec_tlv320aic23.c b/sound/soc/samsung/s3c24xx_simtec_tlv320aic23.c
index c42d5f00b0e1..1ac0d7a63a3a 100644
--- a/sound/soc/samsung/s3c24xx_simtec_tlv320aic23.c
+++ b/sound/soc/samsung/s3c24xx_simtec_tlv320aic23.c
@@ -71,7 +71,7 @@ static struct snd_soc_dai_link simtec_dai_aic23 = {
71 .codec_name = "tlv320aic3x-codec.0-001a", 71 .codec_name = "tlv320aic3x-codec.0-001a",
72 .cpu_dai_name = "s3c24xx-iis", 72 .cpu_dai_name = "s3c24xx-iis",
73 .codec_dai_name = "tlv320aic3x-hifi", 73 .codec_dai_name = "tlv320aic3x-hifi",
74 .platform_name = "samsung-audio", 74 .platform_name = "s3c24xx-iis",
75 .init = simtec_tlv320aic23_init, 75 .init = simtec_tlv320aic23_init,
76}; 76};
77 77
@@ -88,7 +88,7 @@ static struct snd_soc_card snd_soc_machine_simtec_aic23 = {
88 .num_dapm_routes = ARRAY_SIZE(base_map), 88 .num_dapm_routes = ARRAY_SIZE(base_map),
89}; 89};
90 90
91static int __devinit simtec_audio_tlv320aic23_probe(struct platform_device *pd) 91static int simtec_audio_tlv320aic23_probe(struct platform_device *pd)
92{ 92{
93 return simtec_audio_core_probe(pd, &snd_soc_machine_simtec_aic23); 93 return simtec_audio_core_probe(pd, &snd_soc_machine_simtec_aic23);
94} 94}
@@ -100,7 +100,7 @@ static struct platform_driver simtec_audio_tlv320aic23_driver = {
100 .pm = simtec_audio_pm, 100 .pm = simtec_audio_pm,
101 }, 101 },
102 .probe = simtec_audio_tlv320aic23_probe, 102 .probe = simtec_audio_tlv320aic23_probe,
103 .remove = __devexit_p(simtec_audio_remove), 103 .remove = simtec_audio_remove,
104}; 104};
105 105
106module_platform_driver(simtec_audio_tlv320aic23_driver); 106module_platform_driver(simtec_audio_tlv320aic23_driver);
diff --git a/sound/soc/samsung/s3c24xx_uda134x.c b/sound/soc/samsung/s3c24xx_uda134x.c
index d731042e51b0..333e1b7f06c7 100644
--- a/sound/soc/samsung/s3c24xx_uda134x.c
+++ b/sound/soc/samsung/s3c24xx_uda134x.c
@@ -224,7 +224,7 @@ static struct snd_soc_dai_link s3c24xx_uda134x_dai_link = {
224 .codec_dai_name = "uda134x-hifi", 224 .codec_dai_name = "uda134x-hifi",
225 .cpu_dai_name = "s3c24xx-iis", 225 .cpu_dai_name = "s3c24xx-iis",
226 .ops = &s3c24xx_uda134x_ops, 226 .ops = &s3c24xx_uda134x_ops,
227 .platform_name = "samsung-audio", 227 .platform_name = "s3c24xx-iis",
228}; 228};
229 229
230static struct snd_soc_card snd_soc_s3c24xx_uda134x = { 230static struct snd_soc_card snd_soc_s3c24xx_uda134x = {
diff --git a/sound/soc/samsung/smartq_wm8987.c b/sound/soc/samsung/smartq_wm8987.c
index f2dcb424ea25..58ae3237ef69 100644
--- a/sound/soc/samsung/smartq_wm8987.c
+++ b/sound/soc/samsung/smartq_wm8987.c
@@ -189,7 +189,7 @@ static struct snd_soc_dai_link smartq_dai[] = {
189 .stream_name = "SmartQ Hi-Fi", 189 .stream_name = "SmartQ Hi-Fi",
190 .cpu_dai_name = "samsung-i2s.0", 190 .cpu_dai_name = "samsung-i2s.0",
191 .codec_dai_name = "wm8750-hifi", 191 .codec_dai_name = "wm8750-hifi",
192 .platform_name = "samsung-audio", 192 .platform_name = "samsung-i2s.0",
193 .codec_name = "wm8750.0-0x1a", 193 .codec_name = "wm8750.0-0x1a",
194 .init = smartq_wm8987_init, 194 .init = smartq_wm8987_init,
195 .ops = &smartq_hifi_ops, 195 .ops = &smartq_hifi_ops,
diff --git a/sound/soc/samsung/smdk2443_wm9710.c b/sound/soc/samsung/smdk2443_wm9710.c
index 720ba29bb7e4..c390aad68cfb 100644
--- a/sound/soc/samsung/smdk2443_wm9710.c
+++ b/sound/soc/samsung/smdk2443_wm9710.c
@@ -24,7 +24,7 @@ static struct snd_soc_dai_link smdk2443_dai[] = {
24 .cpu_dai_name = "samsung-ac97", 24 .cpu_dai_name = "samsung-ac97",
25 .codec_dai_name = "ac97-hifi", 25 .codec_dai_name = "ac97-hifi",
26 .codec_name = "ac97-codec", 26 .codec_name = "ac97-codec",
27 .platform_name = "samsung-audio", 27 .platform_name = "samsung-ac97",
28}, 28},
29}; 29};
30 30
diff --git a/sound/soc/samsung/smdk_spdif.c b/sound/soc/samsung/smdk_spdif.c
index beaa9c15d697..a2f2363fe1c2 100644
--- a/sound/soc/samsung/smdk_spdif.c
+++ b/sound/soc/samsung/smdk_spdif.c
@@ -151,7 +151,7 @@ static struct snd_soc_ops smdk_spdif_ops = {
151static struct snd_soc_dai_link smdk_dai = { 151static struct snd_soc_dai_link smdk_dai = {
152 .name = "S/PDIF", 152 .name = "S/PDIF",
153 .stream_name = "S/PDIF PCM Playback", 153 .stream_name = "S/PDIF PCM Playback",
154 .platform_name = "samsung-audio", 154 .platform_name = "samsung-spdif",
155 .cpu_dai_name = "samsung-spdif", 155 .cpu_dai_name = "samsung-spdif",
156 .codec_dai_name = "dit-hifi", 156 .codec_dai_name = "dit-hifi",
157 .codec_name = "spdif-dit", 157 .codec_name = "spdif-dit",
diff --git a/sound/soc/samsung/smdk_wm8580.c b/sound/soc/samsung/smdk_wm8580.c
index ade2809cf393..7e2b710763be 100644
--- a/sound/soc/samsung/smdk_wm8580.c
+++ b/sound/soc/samsung/smdk_wm8580.c
@@ -176,7 +176,7 @@ static struct snd_soc_dai_link smdk_dai[] = {
176 .stream_name = "Playback", 176 .stream_name = "Playback",
177 .cpu_dai_name = "samsung-i2s.0", 177 .cpu_dai_name = "samsung-i2s.0",
178 .codec_dai_name = "wm8580-hifi-playback", 178 .codec_dai_name = "wm8580-hifi-playback",
179 .platform_name = "samsung-audio", 179 .platform_name = "samsung-i2s.0",
180 .codec_name = "wm8580.0-001b", 180 .codec_name = "wm8580.0-001b",
181 .ops = &smdk_ops, 181 .ops = &smdk_ops,
182 }, 182 },
@@ -185,7 +185,7 @@ static struct snd_soc_dai_link smdk_dai[] = {
185 .stream_name = "Capture", 185 .stream_name = "Capture",
186 .cpu_dai_name = "samsung-i2s.0", 186 .cpu_dai_name = "samsung-i2s.0",
187 .codec_dai_name = "wm8580-hifi-capture", 187 .codec_dai_name = "wm8580-hifi-capture",
188 .platform_name = "samsung-audio", 188 .platform_name = "samsung-i2s.0",
189 .codec_name = "wm8580.0-001b", 189 .codec_name = "wm8580.0-001b",
190 .init = smdk_wm8580_init_paiftx, 190 .init = smdk_wm8580_init_paiftx,
191 .ops = &smdk_ops, 191 .ops = &smdk_ops,
@@ -195,7 +195,7 @@ static struct snd_soc_dai_link smdk_dai[] = {
195 .stream_name = "Playback", 195 .stream_name = "Playback",
196 .cpu_dai_name = "samsung-i2s.x", 196 .cpu_dai_name = "samsung-i2s.x",
197 .codec_dai_name = "wm8580-hifi-playback", 197 .codec_dai_name = "wm8580-hifi-playback",
198 .platform_name = "samsung-audio", 198 .platform_name = "samsung-i2s.x",
199 .codec_name = "wm8580.0-001b", 199 .codec_name = "wm8580.0-001b",
200 .ops = &smdk_ops, 200 .ops = &smdk_ops,
201 }, 201 },
diff --git a/sound/soc/samsung/smdk_wm8580pcm.c b/sound/soc/samsung/smdk_wm8580pcm.c
index fab5322e9f05..e43bd4294f99 100644
--- a/sound/soc/samsung/smdk_wm8580pcm.c
+++ b/sound/soc/samsung/smdk_wm8580pcm.c
@@ -135,7 +135,7 @@ static struct snd_soc_dai_link smdk_dai[] = {
135 .stream_name = "Capture", 135 .stream_name = "Capture",
136 .cpu_dai_name = "samsung-pcm.0", 136 .cpu_dai_name = "samsung-pcm.0",
137 .codec_dai_name = "wm8580-hifi-capture", 137 .codec_dai_name = "wm8580-hifi-capture",
138 .platform_name = "samsung-audio", 138 .platform_name = "samsung-pcm.0",
139 .codec_name = "wm8580.0-001b", 139 .codec_name = "wm8580.0-001b",
140 .ops = &smdk_wm8580_pcm_ops, 140 .ops = &smdk_wm8580_pcm_ops,
141 }, 141 },
@@ -153,7 +153,7 @@ static struct snd_soc_card smdk_pcm = {
153 * is absent (or not connected), so we connect EXT_VOICE_CLK(OSC4), 153 * is absent (or not connected), so we connect EXT_VOICE_CLK(OSC4),
154 * 2.0484Mhz, directly with MCLK both Codec and SoC. 154 * 2.0484Mhz, directly with MCLK both Codec and SoC.
155 */ 155 */
156static int __devinit snd_smdk_probe(struct platform_device *pdev) 156static int snd_smdk_probe(struct platform_device *pdev)
157{ 157{
158 int ret = 0; 158 int ret = 0;
159 159
@@ -173,7 +173,7 @@ static int __devinit snd_smdk_probe(struct platform_device *pdev)
173 return 0; 173 return 0;
174} 174}
175 175
176static int __devexit snd_smdk_remove(struct platform_device *pdev) 176static int snd_smdk_remove(struct platform_device *pdev)
177{ 177{
178 snd_soc_unregister_card(&smdk_pcm); 178 snd_soc_unregister_card(&smdk_pcm);
179 platform_set_drvdata(pdev, NULL); 179 platform_set_drvdata(pdev, NULL);
@@ -186,7 +186,7 @@ static struct platform_driver snd_smdk_driver = {
186 .name = "samsung-smdk-pcm", 186 .name = "samsung-smdk-pcm",
187 }, 187 },
188 .probe = snd_smdk_probe, 188 .probe = snd_smdk_probe,
189 .remove = __devexit_p(snd_smdk_remove), 189 .remove = snd_smdk_remove,
190}; 190};
191 191
192module_platform_driver(snd_smdk_driver); 192module_platform_driver(snd_smdk_driver);
diff --git a/sound/soc/samsung/smdk_wm8994.c b/sound/soc/samsung/smdk_wm8994.c
index 48dd4dd9ee08..b0d0ab8bff5a 100644
--- a/sound/soc/samsung/smdk_wm8994.c
+++ b/sound/soc/samsung/smdk_wm8994.c
@@ -127,7 +127,7 @@ static struct snd_soc_dai_link smdk_dai[] = {
127 .stream_name = "Pri_Dai", 127 .stream_name = "Pri_Dai",
128 .cpu_dai_name = "samsung-i2s.0", 128 .cpu_dai_name = "samsung-i2s.0",
129 .codec_dai_name = "wm8994-aif1", 129 .codec_dai_name = "wm8994-aif1",
130 .platform_name = "samsung-audio", 130 .platform_name = "samsung-i2s.0",
131 .codec_name = "wm8994-codec", 131 .codec_name = "wm8994-codec",
132 .init = smdk_wm8994_init_paiftx, 132 .init = smdk_wm8994_init_paiftx,
133 .ops = &smdk_ops, 133 .ops = &smdk_ops,
@@ -136,7 +136,7 @@ static struct snd_soc_dai_link smdk_dai[] = {
136 .stream_name = "Sec_Dai", 136 .stream_name = "Sec_Dai",
137 .cpu_dai_name = "samsung-i2s.4", 137 .cpu_dai_name = "samsung-i2s.4",
138 .codec_dai_name = "wm8994-aif1", 138 .codec_dai_name = "wm8994-aif1",
139 .platform_name = "samsung-audio", 139 .platform_name = "samsung-i2s.4",
140 .codec_name = "wm8994-codec", 140 .codec_name = "wm8994-codec",
141 .ops = &smdk_ops, 141 .ops = &smdk_ops,
142 }, 142 },
@@ -150,7 +150,7 @@ static struct snd_soc_card smdk = {
150}; 150};
151 151
152 152
153static int __devinit smdk_audio_probe(struct platform_device *pdev) 153static int smdk_audio_probe(struct platform_device *pdev)
154{ 154{
155 int ret; 155 int ret;
156 struct snd_soc_card *card = &smdk; 156 struct snd_soc_card *card = &smdk;
@@ -164,7 +164,7 @@ static int __devinit smdk_audio_probe(struct platform_device *pdev)
164 return ret; 164 return ret;
165} 165}
166 166
167static int __devexit smdk_audio_remove(struct platform_device *pdev) 167static int smdk_audio_remove(struct platform_device *pdev)
168{ 168{
169 struct snd_soc_card *card = platform_get_drvdata(pdev); 169 struct snd_soc_card *card = platform_get_drvdata(pdev);
170 170
@@ -179,7 +179,7 @@ static struct platform_driver smdk_audio_driver = {
179 .owner = THIS_MODULE, 179 .owner = THIS_MODULE,
180 }, 180 },
181 .probe = smdk_audio_probe, 181 .probe = smdk_audio_probe,
182 .remove = __devexit_p(smdk_audio_remove), 182 .remove = smdk_audio_remove,
183}; 183};
184 184
185module_platform_driver(smdk_audio_driver); 185module_platform_driver(smdk_audio_driver);
diff --git a/sound/soc/samsung/smdk_wm8994pcm.c b/sound/soc/samsung/smdk_wm8994pcm.c
index 77ecba935119..3688a32000a2 100644
--- a/sound/soc/samsung/smdk_wm8994pcm.c
+++ b/sound/soc/samsung/smdk_wm8994pcm.c
@@ -116,7 +116,7 @@ static struct snd_soc_dai_link smdk_dai[] = {
116 .stream_name = "Primary PCM", 116 .stream_name = "Primary PCM",
117 .cpu_dai_name = "samsung-pcm.0", 117 .cpu_dai_name = "samsung-pcm.0",
118 .codec_dai_name = "wm8994-aif1", 118 .codec_dai_name = "wm8994-aif1",
119 .platform_name = "samsung-audio", 119 .platform_name = "samsung-pcm.0",
120 .codec_name = "wm8994-codec", 120 .codec_name = "wm8994-codec",
121 .ops = &smdk_wm8994_pcm_ops, 121 .ops = &smdk_wm8994_pcm_ops,
122 }, 122 },
@@ -129,7 +129,7 @@ static struct snd_soc_card smdk_pcm = {
129 .num_links = 1, 129 .num_links = 1,
130}; 130};
131 131
132static int __devinit snd_smdk_probe(struct platform_device *pdev) 132static int snd_smdk_probe(struct platform_device *pdev)
133{ 133{
134 int ret = 0; 134 int ret = 0;
135 135
@@ -143,7 +143,7 @@ static int __devinit snd_smdk_probe(struct platform_device *pdev)
143 return 0; 143 return 0;
144} 144}
145 145
146static int __devexit snd_smdk_remove(struct platform_device *pdev) 146static int snd_smdk_remove(struct platform_device *pdev)
147{ 147{
148 snd_soc_unregister_card(&smdk_pcm); 148 snd_soc_unregister_card(&smdk_pcm);
149 platform_set_drvdata(pdev, NULL); 149 platform_set_drvdata(pdev, NULL);
@@ -156,7 +156,7 @@ static struct platform_driver snd_smdk_driver = {
156 .name = "samsung-smdk-pcm", 156 .name = "samsung-smdk-pcm",
157 }, 157 },
158 .probe = snd_smdk_probe, 158 .probe = snd_smdk_probe,
159 .remove = __devexit_p(snd_smdk_remove), 159 .remove = snd_smdk_remove,
160}; 160};
161 161
162module_platform_driver(snd_smdk_driver); 162module_platform_driver(snd_smdk_driver);
diff --git a/sound/soc/samsung/smdk_wm9713.c b/sound/soc/samsung/smdk_wm9713.c
index 55b2ca7f3290..0d20e4ed27aa 100644
--- a/sound/soc/samsung/smdk_wm9713.c
+++ b/sound/soc/samsung/smdk_wm9713.c
@@ -42,7 +42,7 @@ static struct snd_soc_card smdk;
42static struct snd_soc_dai_link smdk_dai = { 42static struct snd_soc_dai_link smdk_dai = {
43 .name = "AC97", 43 .name = "AC97",
44 .stream_name = "AC97 PCM", 44 .stream_name = "AC97 PCM",
45 .platform_name = "samsung-audio", 45 .platform_name = "samsung-ac97",
46 .cpu_dai_name = "samsung-ac97", 46 .cpu_dai_name = "samsung-ac97",
47 .codec_dai_name = "wm9713-hifi", 47 .codec_dai_name = "wm9713-hifi",
48 .codec_name = "wm9713-codec", 48 .codec_name = "wm9713-codec",
diff --git a/sound/soc/samsung/spdif.c b/sound/soc/samsung/spdif.c
index bc24c7af02b2..5008e5bd6ed8 100644
--- a/sound/soc/samsung/spdif.c
+++ b/sound/soc/samsung/spdif.c
@@ -357,7 +357,7 @@ static struct snd_soc_dai_driver samsung_spdif_dai = {
357 .resume = spdif_resume, 357 .resume = spdif_resume,
358}; 358};
359 359
360static __devinit int spdif_probe(struct platform_device *pdev) 360static int spdif_probe(struct platform_device *pdev)
361{ 361{
362 struct s3c_audio_pdata *spdif_pdata; 362 struct s3c_audio_pdata *spdif_pdata;
363 struct resource *mem_res, *dma_res; 363 struct resource *mem_res, *dma_res;
@@ -397,7 +397,7 @@ static __devinit int spdif_probe(struct platform_device *pdev)
397 ret = -ENOENT; 397 ret = -ENOENT;
398 goto err0; 398 goto err0;
399 } 399 }
400 clk_enable(spdif->pclk); 400 clk_prepare_enable(spdif->pclk);
401 401
402 spdif->sclk = clk_get(&pdev->dev, "sclk_spdif"); 402 spdif->sclk = clk_get(&pdev->dev, "sclk_spdif");
403 if (IS_ERR(spdif->sclk)) { 403 if (IS_ERR(spdif->sclk)) {
@@ -405,7 +405,7 @@ static __devinit int spdif_probe(struct platform_device *pdev)
405 ret = -ENOENT; 405 ret = -ENOENT;
406 goto err1; 406 goto err1;
407 } 407 }
408 clk_enable(spdif->sclk); 408 clk_prepare_enable(spdif->sclk);
409 409
410 /* Request S/PDIF Register's memory region */ 410 /* Request S/PDIF Register's memory region */
411 if (!request_mem_region(mem_res->start, 411 if (!request_mem_region(mem_res->start,
@@ -437,27 +437,35 @@ static __devinit int spdif_probe(struct platform_device *pdev)
437 437
438 spdif->dma_playback = &spdif_stereo_out; 438 spdif->dma_playback = &spdif_stereo_out;
439 439
440 return 0; 440 ret = asoc_dma_platform_register(&pdev->dev);
441 if (ret) {
442 dev_err(&pdev->dev, "failed to register DMA: %d\n", ret);
443 goto err5;
444 }
441 445
446 return 0;
447err5:
448 snd_soc_unregister_dai(&pdev->dev);
442err4: 449err4:
443 iounmap(spdif->regs); 450 iounmap(spdif->regs);
444err3: 451err3:
445 release_mem_region(mem_res->start, resource_size(mem_res)); 452 release_mem_region(mem_res->start, resource_size(mem_res));
446err2: 453err2:
447 clk_disable(spdif->sclk); 454 clk_disable_unprepare(spdif->sclk);
448 clk_put(spdif->sclk); 455 clk_put(spdif->sclk);
449err1: 456err1:
450 clk_disable(spdif->pclk); 457 clk_disable_unprepare(spdif->pclk);
451 clk_put(spdif->pclk); 458 clk_put(spdif->pclk);
452err0: 459err0:
453 return ret; 460 return ret;
454} 461}
455 462
456static __devexit int spdif_remove(struct platform_device *pdev) 463static int spdif_remove(struct platform_device *pdev)
457{ 464{
458 struct samsung_spdif_info *spdif = &spdif_info; 465 struct samsung_spdif_info *spdif = &spdif_info;
459 struct resource *mem_res; 466 struct resource *mem_res;
460 467
468 asoc_dma_platform_unregister(&pdev->dev);
461 snd_soc_unregister_dai(&pdev->dev); 469 snd_soc_unregister_dai(&pdev->dev);
462 470
463 iounmap(spdif->regs); 471 iounmap(spdif->regs);
@@ -466,9 +474,9 @@ static __devexit int spdif_remove(struct platform_device *pdev)
466 if (mem_res) 474 if (mem_res)
467 release_mem_region(mem_res->start, resource_size(mem_res)); 475 release_mem_region(mem_res->start, resource_size(mem_res));
468 476
469 clk_disable(spdif->sclk); 477 clk_disable_unprepare(spdif->sclk);
470 clk_put(spdif->sclk); 478 clk_put(spdif->sclk);
471 clk_disable(spdif->pclk); 479 clk_disable_unprepare(spdif->pclk);
472 clk_put(spdif->pclk); 480 clk_put(spdif->pclk);
473 481
474 return 0; 482 return 0;
@@ -476,7 +484,7 @@ static __devexit int spdif_remove(struct platform_device *pdev)
476 484
477static struct platform_driver samsung_spdif_driver = { 485static struct platform_driver samsung_spdif_driver = {
478 .probe = spdif_probe, 486 .probe = spdif_probe,
479 .remove = __devexit_p(spdif_remove), 487 .remove = spdif_remove,
480 .driver = { 488 .driver = {
481 .name = "samsung-spdif", 489 .name = "samsung-spdif",
482 .owner = THIS_MODULE, 490 .owner = THIS_MODULE,
diff --git a/sound/soc/samsung/speyside.c b/sound/soc/samsung/speyside.c
index c7e1c28528a4..57df90d6b7c1 100644
--- a/sound/soc/samsung/speyside.c
+++ b/sound/soc/samsung/speyside.c
@@ -198,7 +198,7 @@ static struct snd_soc_dai_link speyside_dai[] = {
198 .stream_name = "CPU-DSP", 198 .stream_name = "CPU-DSP",
199 .cpu_dai_name = "samsung-i2s.0", 199 .cpu_dai_name = "samsung-i2s.0",
200 .codec_dai_name = "wm0010-sdi1", 200 .codec_dai_name = "wm0010-sdi1",
201 .platform_name = "samsung-audio", 201 .platform_name = "samsung-i2s.0",
202 .codec_name = "spi0.0", 202 .codec_name = "spi0.0",
203 .init = speyside_wm0010_init, 203 .init = speyside_wm0010_init,
204 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF 204 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
@@ -320,7 +320,7 @@ static struct snd_soc_card speyside = {
320 .late_probe = speyside_late_probe, 320 .late_probe = speyside_late_probe,
321}; 321};
322 322
323static __devinit int speyside_probe(struct platform_device *pdev) 323static int speyside_probe(struct platform_device *pdev)
324{ 324{
325 struct snd_soc_card *card = &speyside; 325 struct snd_soc_card *card = &speyside;
326 int ret; 326 int ret;
@@ -337,7 +337,7 @@ static __devinit int speyside_probe(struct platform_device *pdev)
337 return 0; 337 return 0;
338} 338}
339 339
340static int __devexit speyside_remove(struct platform_device *pdev) 340static int speyside_remove(struct platform_device *pdev)
341{ 341{
342 struct snd_soc_card *card = platform_get_drvdata(pdev); 342 struct snd_soc_card *card = platform_get_drvdata(pdev);
343 343
@@ -353,7 +353,7 @@ static struct platform_driver speyside_driver = {
353 .pm = &snd_soc_pm_ops, 353 .pm = &snd_soc_pm_ops,
354 }, 354 },
355 .probe = speyside_probe, 355 .probe = speyside_probe,
356 .remove = __devexit_p(speyside_remove), 356 .remove = speyside_remove,
357}; 357};
358 358
359module_platform_driver(speyside_driver); 359module_platform_driver(speyside_driver);
diff --git a/sound/soc/samsung/tobermory.c b/sound/soc/samsung/tobermory.c
index 9199649bf786..f21ff608a819 100644
--- a/sound/soc/samsung/tobermory.c
+++ b/sound/soc/samsung/tobermory.c
@@ -110,7 +110,7 @@ static struct snd_soc_dai_link tobermory_dai[] = {
110 .stream_name = "CPU", 110 .stream_name = "CPU",
111 .cpu_dai_name = "samsung-i2s.0", 111 .cpu_dai_name = "samsung-i2s.0",
112 .codec_dai_name = "wm8962", 112 .codec_dai_name = "wm8962",
113 .platform_name = "samsung-audio", 113 .platform_name = "samsung-i2s.0",
114 .codec_name = "wm8962.1-001a", 114 .codec_name = "wm8962.1-001a",
115 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF 115 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
116 | SND_SOC_DAIFMT_CBM_CFM, 116 | SND_SOC_DAIFMT_CBM_CFM,
@@ -214,7 +214,7 @@ static struct snd_soc_card tobermory = {
214 .late_probe = tobermory_late_probe, 214 .late_probe = tobermory_late_probe,
215}; 215};
216 216
217static __devinit int tobermory_probe(struct platform_device *pdev) 217static int tobermory_probe(struct platform_device *pdev)
218{ 218{
219 struct snd_soc_card *card = &tobermory; 219 struct snd_soc_card *card = &tobermory;
220 int ret; 220 int ret;
@@ -231,7 +231,7 @@ static __devinit int tobermory_probe(struct platform_device *pdev)
231 return 0; 231 return 0;
232} 232}
233 233
234static int __devexit tobermory_remove(struct platform_device *pdev) 234static int tobermory_remove(struct platform_device *pdev)
235{ 235{
236 struct snd_soc_card *card = platform_get_drvdata(pdev); 236 struct snd_soc_card *card = platform_get_drvdata(pdev);
237 237
@@ -247,7 +247,7 @@ static struct platform_driver tobermory_driver = {
247 .pm = &snd_soc_pm_ops, 247 .pm = &snd_soc_pm_ops,
248 }, 248 },
249 .probe = tobermory_probe, 249 .probe = tobermory_probe,
250 .remove = __devexit_p(tobermory_remove), 250 .remove = tobermory_remove,
251}; 251};
252 252
253module_platform_driver(tobermory_driver); 253module_platform_driver(tobermory_driver);
diff --git a/sound/soc/sh/dma-sh7760.c b/sound/soc/sh/dma-sh7760.c
index 7da20186b19e..19eff8fc4fdd 100644
--- a/sound/soc/sh/dma-sh7760.c
+++ b/sound/soc/sh/dma-sh7760.c
@@ -348,12 +348,12 @@ static struct snd_soc_platform sh7760_soc_platform = {
348 .pcm_free = camelot_pcm_free, 348 .pcm_free = camelot_pcm_free,
349}; 349};
350 350
351static int __devinit sh7760_soc_platform_probe(struct platform_device *pdev) 351static int sh7760_soc_platform_probe(struct platform_device *pdev)
352{ 352{
353 return snd_soc_register_platform(&pdev->dev, &sh7760_soc_platform); 353 return snd_soc_register_platform(&pdev->dev, &sh7760_soc_platform);
354} 354}
355 355
356static int __devexit sh7760_soc_platform_remove(struct platform_device *pdev) 356static int sh7760_soc_platform_remove(struct platform_device *pdev)
357{ 357{
358 snd_soc_unregister_platform(&pdev->dev); 358 snd_soc_unregister_platform(&pdev->dev);
359 return 0; 359 return 0;
@@ -366,7 +366,7 @@ static struct platform_driver sh7760_pcm_driver = {
366 }, 366 },
367 367
368 .probe = sh7760_soc_platform_probe, 368 .probe = sh7760_soc_platform_probe,
369 .remove = __devexit_p(sh7760_soc_platform_remove), 369 .remove = sh7760_soc_platform_remove,
370}; 370};
371 371
372module_platform_driver(sh7760_pcm_driver); 372module_platform_driver(sh7760_pcm_driver);
diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c
index 4a10e4d1bd43..a606d0f93d1c 100644
--- a/sound/soc/sh/fsi.c
+++ b/sound/soc/sh/fsi.c
@@ -265,7 +265,11 @@ struct fsi_priv {
265 265
266 int chan_num:16; 266 int chan_num:16;
267 int clk_master:1; 267 int clk_master:1;
268 int clk_cpg:1;
268 int spdif:1; 269 int spdif:1;
270 int enable_stream:1;
271 int bit_clk_inv:1;
272 int lr_clk_inv:1;
269 273
270 long rate; 274 long rate;
271}; 275};
@@ -395,6 +399,11 @@ static int fsi_is_spdif(struct fsi_priv *fsi)
395 return fsi->spdif; 399 return fsi->spdif;
396} 400}
397 401
402static int fsi_is_enable_stream(struct fsi_priv *fsi)
403{
404 return fsi->enable_stream;
405}
406
398static int fsi_is_play(struct snd_pcm_substream *substream) 407static int fsi_is_play(struct snd_pcm_substream *substream)
399{ 408{
400 return substream->stream == SNDRV_PCM_STREAM_PLAYBACK; 409 return substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
@@ -1138,10 +1147,9 @@ static int fsi_set_master_clk(struct device *dev, struct fsi_priv *fsi,
1138 */ 1147 */
1139static void fsi_pio_push16(struct fsi_priv *fsi, u8 *_buf, int samples) 1148static void fsi_pio_push16(struct fsi_priv *fsi, u8 *_buf, int samples)
1140{ 1149{
1141 u32 enable_stream = fsi_get_info_flags(fsi) & SH_FSI_ENABLE_STREAM_MODE;
1142 int i; 1150 int i;
1143 1151
1144 if (enable_stream) { 1152 if (fsi_is_enable_stream(fsi)) {
1145 /* 1153 /*
1146 * stream mode 1154 * stream mode
1147 * see 1155 * see
@@ -1299,8 +1307,6 @@ static void fsi_pio_start_stop(struct fsi_priv *fsi, struct fsi_stream *io,
1299 1307
1300static int fsi_pio_push_init(struct fsi_priv *fsi, struct fsi_stream *io) 1308static int fsi_pio_push_init(struct fsi_priv *fsi, struct fsi_stream *io)
1301{ 1309{
1302 u32 enable_stream = fsi_get_info_flags(fsi) & SH_FSI_ENABLE_STREAM_MODE;
1303
1304 /* 1310 /*
1305 * we can use 16bit stream mode 1311 * we can use 16bit stream mode
1306 * when "playback" and "16bit data" 1312 * when "playback" and "16bit data"
@@ -1308,7 +1314,7 @@ static int fsi_pio_push_init(struct fsi_priv *fsi, struct fsi_stream *io)
1308 * see 1314 * see
1309 * fsi_pio_push16() 1315 * fsi_pio_push16()
1310 */ 1316 */
1311 if (enable_stream) 1317 if (fsi_is_enable_stream(fsi))
1312 io->bus_option = BUSOP_SET(24, PACKAGE_24BITBUS_BACK) | 1318 io->bus_option = BUSOP_SET(24, PACKAGE_24BITBUS_BACK) |
1313 BUSOP_SET(16, PACKAGE_16BITBUS_STREAM); 1319 BUSOP_SET(16, PACKAGE_16BITBUS_STREAM);
1314 else 1320 else
@@ -1642,6 +1648,16 @@ static int fsi_hw_startup(struct fsi_priv *fsi,
1642 1648
1643 /* clock inversion (CKG2) */ 1649 /* clock inversion (CKG2) */
1644 data = 0; 1650 data = 0;
1651 if (fsi->bit_clk_inv)
1652 data |= (1 << 0);
1653 if (fsi->lr_clk_inv)
1654 data |= (1 << 4);
1655 if (fsi_is_clk_master(fsi))
1656 data <<= 8;
1657 /* FIXME
1658 *
1659 * SH_FSI_xxx_INV style will be removed
1660 */
1645 if (SH_FSI_LRM_INV & flags) 1661 if (SH_FSI_LRM_INV & flags)
1646 data |= 1 << 12; 1662 data |= 1 << 12;
1647 if (SH_FSI_BRM_INV & flags) 1663 if (SH_FSI_BRM_INV & flags)
@@ -1772,7 +1788,6 @@ static int fsi_set_fmt_spdif(struct fsi_priv *fsi)
1772 1788
1773 fsi->fmt = CR_DTMD_SPDIF_PCM | CR_PCM; 1789 fsi->fmt = CR_DTMD_SPDIF_PCM | CR_PCM;
1774 fsi->chan_num = 2; 1790 fsi->chan_num = 2;
1775 fsi->spdif = 1;
1776 1791
1777 return 0; 1792 return 0;
1778} 1793}
@@ -1781,7 +1796,6 @@ static int fsi_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
1781{ 1796{
1782 struct fsi_priv *fsi = fsi_get_priv_frm_dai(dai); 1797 struct fsi_priv *fsi = fsi_get_priv_frm_dai(dai);
1783 set_rate_func set_rate = fsi_get_info_set_rate(fsi); 1798 set_rate_func set_rate = fsi_get_info_set_rate(fsi);
1784 u32 flags = fsi_get_info_flags(fsi);
1785 int ret; 1799 int ret;
1786 1800
1787 /* set master/slave audio interface */ 1801 /* set master/slave audio interface */
@@ -1795,6 +1809,27 @@ static int fsi_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
1795 return -EINVAL; 1809 return -EINVAL;
1796 } 1810 }
1797 1811
1812 /* set clock inversion */
1813 switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
1814 case SND_SOC_DAIFMT_NB_IF:
1815 fsi->bit_clk_inv = 0;
1816 fsi->lr_clk_inv = 1;
1817 break;
1818 case SND_SOC_DAIFMT_IB_NF:
1819 fsi->bit_clk_inv = 1;
1820 fsi->lr_clk_inv = 0;
1821 break;
1822 case SND_SOC_DAIFMT_IB_IF:
1823 fsi->bit_clk_inv = 1;
1824 fsi->lr_clk_inv = 1;
1825 break;
1826 case SND_SOC_DAIFMT_NB_NF:
1827 default:
1828 fsi->bit_clk_inv = 0;
1829 fsi->lr_clk_inv = 0;
1830 break;
1831 }
1832
1798 if (fsi_is_clk_master(fsi)) { 1833 if (fsi_is_clk_master(fsi)) {
1799 /* 1834 /*
1800 * CAUTION 1835 * CAUTION
@@ -1804,29 +1839,19 @@ static int fsi_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
1804 if (set_rate) 1839 if (set_rate)
1805 dev_warn(dai->dev, "set_rate will be removed soon\n"); 1840 dev_warn(dai->dev, "set_rate will be removed soon\n");
1806 1841
1807 switch (flags & SH_FSI_CLK_MASK) { 1842 if (fsi->clk_cpg)
1808 case SH_FSI_CLK_EXTERNAL:
1809 fsi_clk_init(dai->dev, fsi, 1, 1, 0,
1810 fsi_clk_set_rate_external);
1811 break;
1812 case SH_FSI_CLK_CPG:
1813 fsi_clk_init(dai->dev, fsi, 0, 1, 1, 1843 fsi_clk_init(dai->dev, fsi, 0, 1, 1,
1814 fsi_clk_set_rate_cpg); 1844 fsi_clk_set_rate_cpg);
1815 break; 1845 else
1816 } 1846 fsi_clk_init(dai->dev, fsi, 1, 1, 0,
1847 fsi_clk_set_rate_external);
1817 } 1848 }
1818 1849
1819 /* set format */ 1850 /* set format */
1820 switch (flags & SH_FSI_FMT_MASK) { 1851 if (fsi_is_spdif(fsi))
1821 case SH_FSI_FMT_DAI:
1822 ret = fsi_set_fmt_dai(fsi, fmt & SND_SOC_DAIFMT_FORMAT_MASK);
1823 break;
1824 case SH_FSI_FMT_SPDIF:
1825 ret = fsi_set_fmt_spdif(fsi); 1852 ret = fsi_set_fmt_spdif(fsi);
1826 break; 1853 else
1827 default: 1854 ret = fsi_set_fmt_dai(fsi, fmt & SND_SOC_DAIFMT_FORMAT_MASK);
1828 ret = -EINVAL;
1829 }
1830 1855
1831 return ret; 1856 return ret;
1832} 1857}
@@ -1992,15 +2017,29 @@ static struct snd_soc_platform_driver fsi_soc_platform = {
1992/* 2017/*
1993 * platform function 2018 * platform function
1994 */ 2019 */
1995static void fsi_handler_init(struct fsi_priv *fsi) 2020static void fsi_port_info_init(struct fsi_priv *fsi,
2021 struct sh_fsi_port_info *info)
2022{
2023 if (info->flags & SH_FSI_FMT_SPDIF)
2024 fsi->spdif = 1;
2025
2026 if (info->flags & SH_FSI_CLK_CPG)
2027 fsi->clk_cpg = 1;
2028
2029 if (info->flags & SH_FSI_ENABLE_STREAM_MODE)
2030 fsi->enable_stream = 1;
2031}
2032
2033static void fsi_handler_init(struct fsi_priv *fsi,
2034 struct sh_fsi_port_info *info)
1996{ 2035{
1997 fsi->playback.handler = &fsi_pio_push_handler; /* default PIO */ 2036 fsi->playback.handler = &fsi_pio_push_handler; /* default PIO */
1998 fsi->playback.priv = fsi; 2037 fsi->playback.priv = fsi;
1999 fsi->capture.handler = &fsi_pio_pop_handler; /* default PIO */ 2038 fsi->capture.handler = &fsi_pio_pop_handler; /* default PIO */
2000 fsi->capture.priv = fsi; 2039 fsi->capture.priv = fsi;
2001 2040
2002 if (fsi->info->tx_id) { 2041 if (info->tx_id) {
2003 fsi->playback.slave.shdma_slave.slave_id = fsi->info->tx_id; 2042 fsi->playback.slave.shdma_slave.slave_id = info->tx_id;
2004 fsi->playback.handler = &fsi_dma_push_handler; 2043 fsi->playback.handler = &fsi_dma_push_handler;
2005 } 2044 }
2006} 2045}
@@ -2010,10 +2049,16 @@ static int fsi_probe(struct platform_device *pdev)
2010 struct fsi_master *master; 2049 struct fsi_master *master;
2011 const struct platform_device_id *id_entry; 2050 const struct platform_device_id *id_entry;
2012 struct sh_fsi_platform_info *info = pdev->dev.platform_data; 2051 struct sh_fsi_platform_info *info = pdev->dev.platform_data;
2052 struct sh_fsi_port_info nul_info, *pinfo;
2053 struct fsi_priv *fsi;
2013 struct resource *res; 2054 struct resource *res;
2014 unsigned int irq; 2055 unsigned int irq;
2015 int ret; 2056 int ret;
2016 2057
2058 nul_info.flags = 0;
2059 nul_info.tx_id = 0;
2060 nul_info.rx_id = 0;
2061
2017 id_entry = pdev->id_entry; 2062 id_entry = pdev->id_entry;
2018 if (!id_entry) { 2063 if (!id_entry) {
2019 dev_err(&pdev->dev, "unknown fsi device\n"); 2064 dev_err(&pdev->dev, "unknown fsi device\n");
@@ -2046,22 +2091,28 @@ static int fsi_probe(struct platform_device *pdev)
2046 spin_lock_init(&master->lock); 2091 spin_lock_init(&master->lock);
2047 2092
2048 /* FSI A setting */ 2093 /* FSI A setting */
2049 master->fsia.base = master->base; 2094 pinfo = (info) ? &info->port_a : &nul_info;
2050 master->fsia.master = master; 2095 fsi = &master->fsia;
2051 master->fsia.info = &info->port_a; 2096 fsi->base = master->base;
2052 fsi_handler_init(&master->fsia); 2097 fsi->master = master;
2053 ret = fsi_stream_probe(&master->fsia, &pdev->dev); 2098 fsi->info = pinfo;
2099 fsi_port_info_init(fsi, pinfo);
2100 fsi_handler_init(fsi, pinfo);
2101 ret = fsi_stream_probe(fsi, &pdev->dev);
2054 if (ret < 0) { 2102 if (ret < 0) {
2055 dev_err(&pdev->dev, "FSIA stream probe failed\n"); 2103 dev_err(&pdev->dev, "FSIA stream probe failed\n");
2056 return ret; 2104 return ret;
2057 } 2105 }
2058 2106
2059 /* FSI B setting */ 2107 /* FSI B setting */
2060 master->fsib.base = master->base + 0x40; 2108 pinfo = (info) ? &info->port_b : &nul_info;
2061 master->fsib.master = master; 2109 fsi = &master->fsib;
2062 master->fsib.info = &info->port_b; 2110 fsi->base = master->base + 0x40;
2063 fsi_handler_init(&master->fsib); 2111 fsi->master = master;
2064 ret = fsi_stream_probe(&master->fsib, &pdev->dev); 2112 fsi->info = pinfo;
2113 fsi_port_info_init(fsi, pinfo);
2114 fsi_handler_init(fsi, pinfo);
2115 ret = fsi_stream_probe(fsi, &pdev->dev);
2065 if (ret < 0) { 2116 if (ret < 0) {
2066 dev_err(&pdev->dev, "FSIB stream probe failed\n"); 2117 dev_err(&pdev->dev, "FSIB stream probe failed\n");
2067 goto exit_fsia; 2118 goto exit_fsia;
diff --git a/sound/soc/sh/hac.c b/sound/soc/sh/hac.c
index 3474d7befe5a..4cc2d64ef476 100644
--- a/sound/soc/sh/hac.c
+++ b/sound/soc/sh/hac.c
@@ -310,13 +310,13 @@ static struct snd_soc_dai_driver sh4_hac_dai[] = {
310#endif 310#endif
311}; 311};
312 312
313static int __devinit hac_soc_platform_probe(struct platform_device *pdev) 313static int hac_soc_platform_probe(struct platform_device *pdev)
314{ 314{
315 return snd_soc_register_dais(&pdev->dev, sh4_hac_dai, 315 return snd_soc_register_dais(&pdev->dev, sh4_hac_dai,
316 ARRAY_SIZE(sh4_hac_dai)); 316 ARRAY_SIZE(sh4_hac_dai));
317} 317}
318 318
319static int __devexit hac_soc_platform_remove(struct platform_device *pdev) 319static int hac_soc_platform_remove(struct platform_device *pdev)
320{ 320{
321 snd_soc_unregister_dais(&pdev->dev, ARRAY_SIZE(sh4_hac_dai)); 321 snd_soc_unregister_dais(&pdev->dev, ARRAY_SIZE(sh4_hac_dai));
322 return 0; 322 return 0;
@@ -329,7 +329,7 @@ static struct platform_driver hac_pcm_driver = {
329 }, 329 },
330 330
331 .probe = hac_soc_platform_probe, 331 .probe = hac_soc_platform_probe,
332 .remove = __devexit_p(hac_soc_platform_remove), 332 .remove = hac_soc_platform_remove,
333}; 333};
334 334
335module_platform_driver(hac_pcm_driver); 335module_platform_driver(hac_pcm_driver);
diff --git a/sound/soc/sh/siu_dai.c b/sound/soc/sh/siu_dai.c
index 52d4c17b1232..34facdc9e4ac 100644
--- a/sound/soc/sh/siu_dai.c
+++ b/sound/soc/sh/siu_dai.c
@@ -726,7 +726,7 @@ static struct snd_soc_dai_driver siu_i2s_dai = {
726 .ops = &siu_dai_ops, 726 .ops = &siu_dai_ops,
727}; 727};
728 728
729static int __devinit siu_probe(struct platform_device *pdev) 729static int siu_probe(struct platform_device *pdev)
730{ 730{
731 const struct firmware *fw_entry; 731 const struct firmware *fw_entry;
732 struct resource *res, *region; 732 struct resource *res, *region;
@@ -815,7 +815,7 @@ ereqfw:
815 return ret; 815 return ret;
816} 816}
817 817
818static int __devexit siu_remove(struct platform_device *pdev) 818static int siu_remove(struct platform_device *pdev)
819{ 819{
820 struct siu_info *info = dev_get_drvdata(&pdev->dev); 820 struct siu_info *info = dev_get_drvdata(&pdev->dev);
821 struct resource *res; 821 struct resource *res;
@@ -843,7 +843,7 @@ static struct platform_driver siu_driver = {
843 .name = "siu-pcm-audio", 843 .name = "siu-pcm-audio",
844 }, 844 },
845 .probe = siu_probe, 845 .probe = siu_probe,
846 .remove = __devexit_p(siu_remove), 846 .remove = siu_remove,
847}; 847};
848 848
849module_platform_driver(siu_driver); 849module_platform_driver(siu_driver);
diff --git a/sound/soc/sh/ssi.c b/sound/soc/sh/ssi.c
index ff82b56a8860..c8e73a703934 100644
--- a/sound/soc/sh/ssi.c
+++ b/sound/soc/sh/ssi.c
@@ -379,13 +379,13 @@ static struct snd_soc_dai_driver sh4_ssi_dai[] = {
379#endif 379#endif
380}; 380};
381 381
382static int __devinit sh4_soc_dai_probe(struct platform_device *pdev) 382static int sh4_soc_dai_probe(struct platform_device *pdev)
383{ 383{
384 return snd_soc_register_dais(&pdev->dev, sh4_ssi_dai, 384 return snd_soc_register_dais(&pdev->dev, sh4_ssi_dai,
385 ARRAY_SIZE(sh4_ssi_dai)); 385 ARRAY_SIZE(sh4_ssi_dai));
386} 386}
387 387
388static int __devexit sh4_soc_dai_remove(struct platform_device *pdev) 388static int sh4_soc_dai_remove(struct platform_device *pdev)
389{ 389{
390 snd_soc_unregister_dais(&pdev->dev, ARRAY_SIZE(sh4_ssi_dai)); 390 snd_soc_unregister_dais(&pdev->dev, ARRAY_SIZE(sh4_ssi_dai));
391 return 0; 391 return 0;
@@ -398,7 +398,7 @@ static struct platform_driver sh4_ssi_driver = {
398 }, 398 },
399 399
400 .probe = sh4_soc_dai_probe, 400 .probe = sh4_soc_dai_probe,
401 .remove = __devexit_p(sh4_soc_dai_remove), 401 .remove = sh4_soc_dai_remove,
402}; 402};
403 403
404module_platform_driver(sh4_ssi_driver); 404module_platform_driver(sh4_ssi_driver);
diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c
index 9d56f0218f41..e72f55428f0b 100644
--- a/sound/soc/soc-cache.c
+++ b/sound/soc/soc-cache.c
@@ -88,7 +88,7 @@ static int snd_soc_flat_cache_sync(struct snd_soc_codec *codec)
88 ret = snd_soc_write(codec, i, val); 88 ret = snd_soc_write(codec, i, val);
89 if (ret) 89 if (ret)
90 return ret; 90 return ret;
91 dev_dbg(codec->dev, "Synced register %#x, value = %#x\n", 91 dev_dbg(codec->dev, "ASoC: Synced register %#x, value = %#x\n",
92 i, val); 92 i, val);
93 } 93 }
94 return 0; 94 return 0;
@@ -156,7 +156,7 @@ int snd_soc_cache_init(struct snd_soc_codec *codec)
156 156
157 /* Fall back to flat compression */ 157 /* Fall back to flat compression */
158 if (i == ARRAY_SIZE(cache_types)) { 158 if (i == ARRAY_SIZE(cache_types)) {
159 dev_warn(codec->dev, "Could not match compress type: %d\n", 159 dev_warn(codec->dev, "ASoC: Could not match compress type: %d\n",
160 codec->compress_type); 160 codec->compress_type);
161 i = 0; 161 i = 0;
162 } 162 }
@@ -166,7 +166,7 @@ int snd_soc_cache_init(struct snd_soc_codec *codec)
166 166
167 if (codec->cache_ops->init) { 167 if (codec->cache_ops->init) {
168 if (codec->cache_ops->name) 168 if (codec->cache_ops->name)
169 dev_dbg(codec->dev, "Initializing %s cache for %s codec\n", 169 dev_dbg(codec->dev, "ASoC: Initializing %s cache for %s codec\n",
170 codec->cache_ops->name, codec->name); 170 codec->cache_ops->name, codec->name);
171 return codec->cache_ops->init(codec); 171 return codec->cache_ops->init(codec);
172 } 172 }
@@ -181,7 +181,7 @@ int snd_soc_cache_exit(struct snd_soc_codec *codec)
181{ 181{
182 if (codec->cache_ops && codec->cache_ops->exit) { 182 if (codec->cache_ops && codec->cache_ops->exit) {
183 if (codec->cache_ops->name) 183 if (codec->cache_ops->name)
184 dev_dbg(codec->dev, "Destroying %s cache for %s codec\n", 184 dev_dbg(codec->dev, "ASoC: Destroying %s cache for %s codec\n",
185 codec->cache_ops->name, codec->name); 185 codec->cache_ops->name, codec->name);
186 return codec->cache_ops->exit(codec); 186 return codec->cache_ops->exit(codec);
187 } 187 }
@@ -265,7 +265,7 @@ int snd_soc_cache_sync(struct snd_soc_codec *codec)
265 name = "unknown"; 265 name = "unknown";
266 266
267 if (codec->cache_ops->name) 267 if (codec->cache_ops->name)
268 dev_dbg(codec->dev, "Syncing %s cache for %s codec\n", 268 dev_dbg(codec->dev, "ASoC: Syncing %s cache for %s codec\n",
269 codec->cache_ops->name, codec->name); 269 codec->cache_ops->name, codec->name);
270 trace_snd_soc_cache_sync(codec, name, "start"); 270 trace_snd_soc_cache_sync(codec, name, "start");
271 ret = codec->cache_ops->sync(codec); 271 ret = codec->cache_ops->sync(codec);
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 10d21be383f6..9c768bcb98a6 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -271,7 +271,8 @@ static void soc_init_codec_debugfs(struct snd_soc_codec *codec)
271 codec->debugfs_codec_root = debugfs_create_dir(codec->name, 271 codec->debugfs_codec_root = debugfs_create_dir(codec->name,
272 debugfs_card_root); 272 debugfs_card_root);
273 if (!codec->debugfs_codec_root) { 273 if (!codec->debugfs_codec_root) {
274 dev_warn(codec->dev, "Failed to create codec debugfs directory\n"); 274 dev_warn(codec->dev, "ASoC: Failed to create codec debugfs"
275 " directory\n");
275 return; 276 return;
276 } 277 }
277 278
@@ -284,7 +285,8 @@ static void soc_init_codec_debugfs(struct snd_soc_codec *codec)
284 codec->debugfs_codec_root, 285 codec->debugfs_codec_root,
285 codec, &codec_reg_fops); 286 codec, &codec_reg_fops);
286 if (!codec->debugfs_reg) 287 if (!codec->debugfs_reg)
287 dev_warn(codec->dev, "Failed to create codec register debugfs file\n"); 288 dev_warn(codec->dev, "ASoC: Failed to create codec register"
289 " debugfs file\n");
288 290
289 snd_soc_dapm_debugfs_init(&codec->dapm, codec->debugfs_codec_root); 291 snd_soc_dapm_debugfs_init(&codec->dapm, codec->debugfs_codec_root);
290} 292}
@@ -302,7 +304,7 @@ static void soc_init_platform_debugfs(struct snd_soc_platform *platform)
302 debugfs_card_root); 304 debugfs_card_root);
303 if (!platform->debugfs_platform_root) { 305 if (!platform->debugfs_platform_root) {
304 dev_warn(platform->dev, 306 dev_warn(platform->dev,
305 "Failed to create platform debugfs directory\n"); 307 "ASoC: Failed to create platform debugfs directory\n");
306 return; 308 return;
307 } 309 }
308 310
@@ -430,7 +432,7 @@ static void soc_init_card_debugfs(struct snd_soc_card *card)
430 &card->pop_time); 432 &card->pop_time);
431 if (!card->debugfs_pop_time) 433 if (!card->debugfs_pop_time)
432 dev_warn(card->dev, 434 dev_warn(card->dev,
433 "Failed to create pop time debugfs file\n"); 435 "ASoC: Failed to create pop time debugfs file\n");
434} 436}
435 437
436static void soc_cleanup_card_debugfs(struct snd_soc_card *card) 438static void soc_cleanup_card_debugfs(struct snd_soc_card *card)
@@ -475,7 +477,7 @@ struct snd_pcm_substream *snd_soc_get_dai_substream(struct snd_soc_card *card,
475 !strcmp(card->rtd[i].dai_link->name, dai_link)) 477 !strcmp(card->rtd[i].dai_link->name, dai_link))
476 return card->rtd[i].pcm->streams[stream].substream; 478 return card->rtd[i].pcm->streams[stream].substream;
477 } 479 }
478 dev_dbg(card->dev, "failed to find dai link %s\n", dai_link); 480 dev_dbg(card->dev, "ASoC: failed to find dai link %s\n", dai_link);
479 return NULL; 481 return NULL;
480} 482}
481EXPORT_SYMBOL_GPL(snd_soc_get_dai_substream); 483EXPORT_SYMBOL_GPL(snd_soc_get_dai_substream);
@@ -489,7 +491,7 @@ struct snd_soc_pcm_runtime *snd_soc_get_pcm_runtime(struct snd_soc_card *card,
489 if (!strcmp(card->rtd[i].dai_link->name, dai_link)) 491 if (!strcmp(card->rtd[i].dai_link->name, dai_link))
490 return &card->rtd[i]; 492 return &card->rtd[i];
491 } 493 }
492 dev_dbg(card->dev, "failed to find rtd %s\n", dai_link); 494 dev_dbg(card->dev, "ASoC: failed to find rtd %s\n", dai_link);
493 return NULL; 495 return NULL;
494} 496}
495EXPORT_SYMBOL_GPL(snd_soc_get_pcm_runtime); 497EXPORT_SYMBOL_GPL(snd_soc_get_pcm_runtime);
@@ -519,7 +521,7 @@ static int soc_ac97_dev_register(struct snd_soc_codec *codec)
519 codec->card->snd_card->number, 0, codec->name); 521 codec->card->snd_card->number, 0, codec->name);
520 err = device_register(&codec->ac97->dev); 522 err = device_register(&codec->ac97->dev);
521 if (err < 0) { 523 if (err < 0) {
522 snd_printk(KERN_ERR "Can't register ac97 bus\n"); 524 dev_err(codec->dev, "ASoC: Can't register ac97 bus\n");
523 codec->ac97->dev.bus = NULL; 525 codec->ac97->dev.bus = NULL;
524 return err; 526 return err;
525 } 527 }
@@ -628,7 +630,8 @@ int snd_soc_suspend(struct device *dev)
628 */ 630 */
629 if (codec->dapm.idle_bias_off) { 631 if (codec->dapm.idle_bias_off) {
630 dev_dbg(codec->dev, 632 dev_dbg(codec->dev,
631 "idle_bias_off CODEC on over suspend\n"); 633 "ASoC: idle_bias_off CODEC on"
634 " over suspend\n");
632 break; 635 break;
633 } 636 }
634 case SND_SOC_BIAS_OFF: 637 case SND_SOC_BIAS_OFF:
@@ -639,7 +642,8 @@ int snd_soc_suspend(struct device *dev)
639 regcache_mark_dirty(codec->control_data); 642 regcache_mark_dirty(codec->control_data);
640 break; 643 break;
641 default: 644 default:
642 dev_dbg(codec->dev, "CODEC is on over suspend\n"); 645 dev_dbg(codec->dev, "ASoC: CODEC is on"
646 " over suspend\n");
643 break; 647 break;
644 } 648 }
645 } 649 }
@@ -676,7 +680,7 @@ static void soc_resume_deferred(struct work_struct *work)
676 * so userspace apps are blocked from touching us 680 * so userspace apps are blocked from touching us
677 */ 681 */
678 682
679 dev_dbg(card->dev, "starting resume work\n"); 683 dev_dbg(card->dev, "ASoC: starting resume work\n");
680 684
681 /* Bring us up into D2 so that DAPM starts enabling things */ 685 /* Bring us up into D2 so that DAPM starts enabling things */
682 snd_power_change_state(card->snd_card, SNDRV_CTL_POWER_D2); 686 snd_power_change_state(card->snd_card, SNDRV_CTL_POWER_D2);
@@ -708,7 +712,8 @@ static void soc_resume_deferred(struct work_struct *work)
708 codec->suspended = 0; 712 codec->suspended = 0;
709 break; 713 break;
710 default: 714 default:
711 dev_dbg(codec->dev, "CODEC was on over suspend\n"); 715 dev_dbg(codec->dev, "ASoC: CODEC was on over"
716 " suspend\n");
712 break; 717 break;
713 } 718 }
714 } 719 }
@@ -758,7 +763,7 @@ static void soc_resume_deferred(struct work_struct *work)
758 if (card->resume_post) 763 if (card->resume_post)
759 card->resume_post(card); 764 card->resume_post(card);
760 765
761 dev_dbg(card->dev, "resume work completed\n"); 766 dev_dbg(card->dev, "ASoC: resume work completed\n");
762 767
763 /* userspace can access us now we are back as we were before */ 768 /* userspace can access us now we are back as we were before */
764 snd_power_change_state(card->snd_card, SNDRV_CTL_POWER_D0); 769 snd_power_change_state(card->snd_card, SNDRV_CTL_POWER_D0);
@@ -790,12 +795,12 @@ int snd_soc_resume(struct device *dev)
790 ac97_control |= cpu_dai->driver->ac97_control; 795 ac97_control |= cpu_dai->driver->ac97_control;
791 } 796 }
792 if (ac97_control) { 797 if (ac97_control) {
793 dev_dbg(dev, "Resuming AC97 immediately\n"); 798 dev_dbg(dev, "ASoC: Resuming AC97 immediately\n");
794 soc_resume_deferred(&card->deferred_resume_work); 799 soc_resume_deferred(&card->deferred_resume_work);
795 } else { 800 } else {
796 dev_dbg(dev, "Scheduling resume work\n"); 801 dev_dbg(dev, "ASoC: Scheduling resume work\n");
797 if (!schedule_work(&card->deferred_resume_work)) 802 if (!schedule_work(&card->deferred_resume_work))
798 dev_err(dev, "resume work item may be lost\n"); 803 dev_err(dev, "ASoC: resume work item may be lost\n");
799 } 804 }
800 805
801 return 0; 806 return 0;
@@ -818,7 +823,7 @@ static int soc_bind_dai_link(struct snd_soc_card *card, int num)
818 struct snd_soc_dai *codec_dai, *cpu_dai; 823 struct snd_soc_dai *codec_dai, *cpu_dai;
819 const char *platform_name; 824 const char *platform_name;
820 825
821 dev_dbg(card->dev, "binding %s at idx %d\n", dai_link->name, num); 826 dev_dbg(card->dev, "ASoC: binding %s at idx %d\n", dai_link->name, num);
822 827
823 /* Find CPU DAI from registered DAIs*/ 828 /* Find CPU DAI from registered DAIs*/
824 list_for_each_entry(cpu_dai, &dai_list, list) { 829 list_for_each_entry(cpu_dai, &dai_list, list) {
@@ -836,7 +841,7 @@ static int soc_bind_dai_link(struct snd_soc_card *card, int num)
836 } 841 }
837 842
838 if (!rtd->cpu_dai) { 843 if (!rtd->cpu_dai) {
839 dev_err(card->dev, "CPU DAI %s not registered\n", 844 dev_err(card->dev, "ASoC: CPU DAI %s not registered\n",
840 dai_link->cpu_dai_name); 845 dai_link->cpu_dai_name);
841 return -EPROBE_DEFER; 846 return -EPROBE_DEFER;
842 } 847 }
@@ -867,14 +872,14 @@ static int soc_bind_dai_link(struct snd_soc_card *card, int num)
867 } 872 }
868 873
869 if (!rtd->codec_dai) { 874 if (!rtd->codec_dai) {
870 dev_err(card->dev, "CODEC DAI %s not registered\n", 875 dev_err(card->dev, "ASoC: CODEC DAI %s not registered\n",
871 dai_link->codec_dai_name); 876 dai_link->codec_dai_name);
872 return -EPROBE_DEFER; 877 return -EPROBE_DEFER;
873 } 878 }
874 } 879 }
875 880
876 if (!rtd->codec) { 881 if (!rtd->codec) {
877 dev_err(card->dev, "CODEC %s not registered\n", 882 dev_err(card->dev, "ASoC: CODEC %s not registered\n",
878 dai_link->codec_name); 883 dai_link->codec_name);
879 return -EPROBE_DEFER; 884 return -EPROBE_DEFER;
880 } 885 }
@@ -898,7 +903,7 @@ static int soc_bind_dai_link(struct snd_soc_card *card, int num)
898 rtd->platform = platform; 903 rtd->platform = platform;
899 } 904 }
900 if (!rtd->platform) { 905 if (!rtd->platform) {
901 dev_err(card->dev, "platform %s not registered\n", 906 dev_err(card->dev, "ASoC: platform %s not registered\n",
902 dai_link->platform_name); 907 dai_link->platform_name);
903 return -EPROBE_DEFER; 908 return -EPROBE_DEFER;
904 } 909 }
@@ -915,8 +920,8 @@ static int soc_remove_platform(struct snd_soc_platform *platform)
915 if (platform->driver->remove) { 920 if (platform->driver->remove) {
916 ret = platform->driver->remove(platform); 921 ret = platform->driver->remove(platform);
917 if (ret < 0) 922 if (ret < 0)
918 pr_err("asoc: failed to remove %s: %d\n", 923 dev_err(platform->dev, "ASoC: failed to remove %d\n",
919 platform->name, ret); 924 ret);
920 } 925 }
921 926
922 /* Make sure all DAPM widgets are freed */ 927 /* Make sure all DAPM widgets are freed */
@@ -937,9 +942,7 @@ static void soc_remove_codec(struct snd_soc_codec *codec)
937 if (codec->driver->remove) { 942 if (codec->driver->remove) {
938 err = codec->driver->remove(codec); 943 err = codec->driver->remove(codec);
939 if (err < 0) 944 if (err < 0)
940 dev_err(codec->dev, 945 dev_err(codec->dev, "ASoC: failed to remove %d\n", err);
941 "asoc: failed to remove %s: %d\n",
942 codec->name, err);
943 } 946 }
944 947
945 /* Make sure all DAPM widgets are freed */ 948 /* Make sure all DAPM widgets are freed */
@@ -971,8 +974,9 @@ static void soc_remove_link_dais(struct snd_soc_card *card, int num, int order)
971 if (codec_dai->driver->remove) { 974 if (codec_dai->driver->remove) {
972 err = codec_dai->driver->remove(codec_dai); 975 err = codec_dai->driver->remove(codec_dai);
973 if (err < 0) 976 if (err < 0)
974 pr_err("asoc: failed to remove %s: %d\n", 977 dev_err(codec_dai->dev,
975 codec_dai->name, err); 978 "ASoC: failed to remove %s: %d\n",
979 codec_dai->name, err);
976 } 980 }
977 codec_dai->probed = 0; 981 codec_dai->probed = 0;
978 list_del(&codec_dai->card_list); 982 list_del(&codec_dai->card_list);
@@ -984,8 +988,9 @@ static void soc_remove_link_dais(struct snd_soc_card *card, int num, int order)
984 if (cpu_dai->driver->remove) { 988 if (cpu_dai->driver->remove) {
985 err = cpu_dai->driver->remove(cpu_dai); 989 err = cpu_dai->driver->remove(cpu_dai);
986 if (err < 0) 990 if (err < 0)
987 pr_err("asoc: failed to remove %s: %d\n", 991 dev_err(cpu_dai->dev,
988 cpu_dai->name, err); 992 "ASoC: failed to remove %s: %d\n",
993 cpu_dai->name, err);
989 } 994 }
990 cpu_dai->probed = 0; 995 cpu_dai->probed = 0;
991 list_del(&cpu_dai->card_list); 996 list_del(&cpu_dai->card_list);
@@ -1099,8 +1104,7 @@ static int soc_probe_codec(struct snd_soc_card *card,
1099 ret = driver->probe(codec); 1104 ret = driver->probe(codec);
1100 if (ret < 0) { 1105 if (ret < 0) {
1101 dev_err(codec->dev, 1106 dev_err(codec->dev,
1102 "asoc: failed to probe CODEC %s: %d\n", 1107 "ASoC: failed to probe CODEC %d\n", ret);
1103 codec->name, ret);
1104 goto err_probe; 1108 goto err_probe;
1105 } 1109 }
1106 } 1110 }
@@ -1163,8 +1167,7 @@ static int soc_probe_platform(struct snd_soc_card *card,
1163 ret = driver->probe(platform); 1167 ret = driver->probe(platform);
1164 if (ret < 0) { 1168 if (ret < 0) {
1165 dev_err(platform->dev, 1169 dev_err(platform->dev,
1166 "asoc: failed to probe platform %s: %d\n", 1170 "ASoC: failed to probe platform %d\n", ret);
1167 platform->name, ret);
1168 goto err_probe; 1171 goto err_probe;
1169 } 1172 }
1170 } 1173 }
@@ -1229,7 +1232,7 @@ static int soc_post_component_init(struct snd_soc_card *card,
1229 else if (dailess && aux_dev->init) 1232 else if (dailess && aux_dev->init)
1230 ret = aux_dev->init(&codec->dapm); 1233 ret = aux_dev->init(&codec->dapm);
1231 if (ret < 0) { 1234 if (ret < 0) {
1232 dev_err(card->dev, "asoc: failed to init %s: %d\n", name, ret); 1235 dev_err(card->dev, "ASoC: failed to init %s: %d\n", name, ret);
1233 return ret; 1236 return ret;
1234 } 1237 }
1235 codec->name_prefix = temp; 1238 codec->name_prefix = temp;
@@ -1253,7 +1256,7 @@ static int soc_post_component_init(struct snd_soc_card *card,
1253 ret = device_add(rtd->dev); 1256 ret = device_add(rtd->dev);
1254 if (ret < 0) { 1257 if (ret < 0) {
1255 dev_err(card->dev, 1258 dev_err(card->dev,
1256 "asoc: failed to register runtime device: %d\n", ret); 1259 "ASoC: failed to register runtime device: %d\n", ret);
1257 return ret; 1260 return ret;
1258 } 1261 }
1259 rtd->dev_registered = 1; 1262 rtd->dev_registered = 1;
@@ -1262,14 +1265,13 @@ static int soc_post_component_init(struct snd_soc_card *card,
1262 ret = snd_soc_dapm_sys_add(rtd->dev); 1265 ret = snd_soc_dapm_sys_add(rtd->dev);
1263 if (ret < 0) 1266 if (ret < 0)
1264 dev_err(codec->dev, 1267 dev_err(codec->dev,
1265 "asoc: failed to add codec dapm sysfs entries: %d\n", 1268 "ASoC: failed to add codec dapm sysfs entries: %d\n", ret);
1266 ret);
1267 1269
1268 /* add codec sysfs entries */ 1270 /* add codec sysfs entries */
1269 ret = device_create_file(rtd->dev, &dev_attr_codec_reg); 1271 ret = device_create_file(rtd->dev, &dev_attr_codec_reg);
1270 if (ret < 0) 1272 if (ret < 0)
1271 dev_err(codec->dev, 1273 dev_err(codec->dev,
1272 "asoc: failed to add codec sysfs files: %d\n", ret); 1274 "ASoC: failed to add codec sysfs files: %d\n", ret);
1273 1275
1274#ifdef CONFIG_DEBUG_FS 1276#ifdef CONFIG_DEBUG_FS
1275 /* add DPCM sysfs entries */ 1277 /* add DPCM sysfs entries */
@@ -1278,7 +1280,7 @@ static int soc_post_component_init(struct snd_soc_card *card,
1278 1280
1279 ret = soc_dpcm_debugfs_add(rtd); 1281 ret = soc_dpcm_debugfs_add(rtd);
1280 if (ret < 0) 1282 if (ret < 0)
1281 dev_err(rtd->dev, "asoc: failed to add dpcm sysfs entries: %d\n", ret); 1283 dev_err(rtd->dev, "ASoC: failed to add dpcm sysfs entries: %d\n", ret);
1282 1284
1283out: 1285out:
1284#endif 1286#endif
@@ -1333,7 +1335,7 @@ static int soc_probe_link_dais(struct snd_soc_card *card, int num, int order)
1333 struct snd_soc_dapm_widget *play_w, *capture_w; 1335 struct snd_soc_dapm_widget *play_w, *capture_w;
1334 int ret; 1336 int ret;
1335 1337
1336 dev_dbg(card->dev, "probe %s dai link %d late %d\n", 1338 dev_dbg(card->dev, "ASoC: probe %s dai link %d late %d\n",
1337 card->name, num, order); 1339 card->name, num, order);
1338 1340
1339 /* config components */ 1341 /* config components */
@@ -1359,8 +1361,9 @@ static int soc_probe_link_dais(struct snd_soc_card *card, int num, int order)
1359 if (cpu_dai->driver->probe) { 1361 if (cpu_dai->driver->probe) {
1360 ret = cpu_dai->driver->probe(cpu_dai); 1362 ret = cpu_dai->driver->probe(cpu_dai);
1361 if (ret < 0) { 1363 if (ret < 0) {
1362 pr_err("asoc: failed to probe CPU DAI %s: %d\n", 1364 dev_err(cpu_dai->dev,
1363 cpu_dai->name, ret); 1365 "ASoC: failed to probe CPU DAI %s: %d\n",
1366 cpu_dai->name, ret);
1364 module_put(cpu_dai->dev->driver->owner); 1367 module_put(cpu_dai->dev->driver->owner);
1365 return ret; 1368 return ret;
1366 } 1369 }
@@ -1375,8 +1378,9 @@ static int soc_probe_link_dais(struct snd_soc_card *card, int num, int order)
1375 if (codec_dai->driver->probe) { 1378 if (codec_dai->driver->probe) {
1376 ret = codec_dai->driver->probe(codec_dai); 1379 ret = codec_dai->driver->probe(codec_dai);
1377 if (ret < 0) { 1380 if (ret < 0) {
1378 pr_err("asoc: failed to probe CODEC DAI %s: %d\n", 1381 dev_err(codec_dai->dev,
1379 codec_dai->name, ret); 1382 "ASoC: failed to probe CODEC DAI %s: %d\n",
1383 codec_dai->name, ret);
1380 return ret; 1384 return ret;
1381 } 1385 }
1382 } 1386 }
@@ -1396,13 +1400,14 @@ static int soc_probe_link_dais(struct snd_soc_card *card, int num, int order)
1396 1400
1397 ret = device_create_file(rtd->dev, &dev_attr_pmdown_time); 1401 ret = device_create_file(rtd->dev, &dev_attr_pmdown_time);
1398 if (ret < 0) 1402 if (ret < 0)
1399 pr_warn("asoc: failed to add pmdown_time sysfs:%d\n", ret); 1403 dev_warn(rtd->dev, "ASoC: failed to add pmdown_time sysfs: %d\n",
1404 ret);
1400 1405
1401 if (cpu_dai->driver->compress_dai) { 1406 if (cpu_dai->driver->compress_dai) {
1402 /*create compress_device"*/ 1407 /*create compress_device"*/
1403 ret = soc_new_compress(rtd, num); 1408 ret = soc_new_compress(rtd, num);
1404 if (ret < 0) { 1409 if (ret < 0) {
1405 pr_err("asoc: can't create compress %s\n", 1410 dev_err(card->dev, "ASoC: can't create compress %s\n",
1406 dai_link->stream_name); 1411 dai_link->stream_name);
1407 return ret; 1412 return ret;
1408 } 1413 }
@@ -1412,7 +1417,7 @@ static int soc_probe_link_dais(struct snd_soc_card *card, int num, int order)
1412 /* create the pcm */ 1417 /* create the pcm */
1413 ret = soc_new_pcm(rtd, num); 1418 ret = soc_new_pcm(rtd, num);
1414 if (ret < 0) { 1419 if (ret < 0) {
1415 pr_err("asoc: can't create pcm %s :%d\n", 1420 dev_err(card->dev, "ASoC: can't create pcm %s :%d\n",
1416 dai_link->stream_name, ret); 1421 dai_link->stream_name, ret);
1417 return ret; 1422 return ret;
1418 } 1423 }
@@ -1424,7 +1429,7 @@ static int soc_probe_link_dais(struct snd_soc_card *card, int num, int order)
1424 ret = snd_soc_dapm_new_pcm(card, dai_link->params, 1429 ret = snd_soc_dapm_new_pcm(card, dai_link->params,
1425 capture_w, play_w); 1430 capture_w, play_w);
1426 if (ret != 0) { 1431 if (ret != 0) {
1427 dev_err(card->dev, "Can't link %s to %s: %d\n", 1432 dev_err(card->dev, "ASoC: Can't link %s to %s: %d\n",
1428 play_w->name, capture_w->name, ret); 1433 play_w->name, capture_w->name, ret);
1429 return ret; 1434 return ret;
1430 } 1435 }
@@ -1436,7 +1441,7 @@ static int soc_probe_link_dais(struct snd_soc_card *card, int num, int order)
1436 ret = snd_soc_dapm_new_pcm(card, dai_link->params, 1441 ret = snd_soc_dapm_new_pcm(card, dai_link->params,
1437 capture_w, play_w); 1442 capture_w, play_w);
1438 if (ret != 0) { 1443 if (ret != 0) {
1439 dev_err(card->dev, "Can't link %s to %s: %d\n", 1444 dev_err(card->dev, "ASoC: Can't link %s to %s: %d\n",
1440 play_w->name, capture_w->name, ret); 1445 play_w->name, capture_w->name, ret);
1441 return ret; 1446 return ret;
1442 } 1447 }
@@ -1473,7 +1478,8 @@ static int soc_register_ac97_dai_link(struct snd_soc_pcm_runtime *rtd)
1473 1478
1474 ret = soc_ac97_dev_register(rtd->codec); 1479 ret = soc_ac97_dev_register(rtd->codec);
1475 if (ret < 0) { 1480 if (ret < 0) {
1476 pr_err("asoc: AC97 device register failed:%d\n", ret); 1481 dev_err(rtd->codec->dev,
1482 "ASoC: AC97 device register failed: %d\n", ret);
1477 return ret; 1483 return ret;
1478 } 1484 }
1479 1485
@@ -1502,7 +1508,7 @@ static int soc_check_aux_dev(struct snd_soc_card *card, int num)
1502 return 0; 1508 return 0;
1503 } 1509 }
1504 1510
1505 dev_err(card->dev, "%s not registered\n", aux_dev->codec_name); 1511 dev_err(card->dev, "ASoC: %s not registered\n", aux_dev->codec_name);
1506 1512
1507 return -EPROBE_DEFER; 1513 return -EPROBE_DEFER;
1508} 1514}
@@ -1518,7 +1524,7 @@ static int soc_probe_aux_dev(struct snd_soc_card *card, int num)
1518 if (!strcmp(codec->name, aux_dev->codec_name)) { 1524 if (!strcmp(codec->name, aux_dev->codec_name)) {
1519 if (codec->probed) { 1525 if (codec->probed) {
1520 dev_err(codec->dev, 1526 dev_err(codec->dev,
1521 "asoc: codec already probed"); 1527 "ASoC: codec already probed");
1522 ret = -EBUSY; 1528 ret = -EBUSY;
1523 goto out; 1529 goto out;
1524 } 1530 }
@@ -1526,7 +1532,7 @@ static int soc_probe_aux_dev(struct snd_soc_card *card, int num)
1526 } 1532 }
1527 } 1533 }
1528 /* codec not found */ 1534 /* codec not found */
1529 dev_err(card->dev, "asoc: codec %s not found", aux_dev->codec_name); 1535 dev_err(card->dev, "ASoC: codec %s not found", aux_dev->codec_name);
1530 return -EPROBE_DEFER; 1536 return -EPROBE_DEFER;
1531 1537
1532found: 1538found:
@@ -1569,8 +1575,8 @@ static int snd_soc_init_codec_cache(struct snd_soc_codec *codec,
1569 codec->compress_type = compress_type; 1575 codec->compress_type = compress_type;
1570 ret = snd_soc_cache_init(codec); 1576 ret = snd_soc_cache_init(codec);
1571 if (ret < 0) { 1577 if (ret < 0) {
1572 dev_err(codec->dev, "Failed to set cache compression type: %d\n", 1578 dev_err(codec->dev, "ASoC: Failed to set cache compression"
1573 ret); 1579 " type: %d\n", ret);
1574 return ret; 1580 return ret;
1575 } 1581 }
1576 codec->cache_init = 1; 1582 codec->cache_init = 1;
@@ -1626,8 +1632,8 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
1626 ret = snd_card_create(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1, 1632 ret = snd_card_create(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
1627 card->owner, 0, &card->snd_card); 1633 card->owner, 0, &card->snd_card);
1628 if (ret < 0) { 1634 if (ret < 0) {
1629 pr_err("asoc: can't create sound card for card %s: %d\n", 1635 dev_err(card->dev, "ASoC: can't create sound card for"
1630 card->name, ret); 1636 " card %s: %d\n", card->name, ret);
1631 goto base_error; 1637 goto base_error;
1632 } 1638 }
1633 card->snd_card->dev = card->dev; 1639 card->snd_card->dev = card->dev;
@@ -1663,8 +1669,9 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
1663 for (i = 0; i < card->num_links; i++) { 1669 for (i = 0; i < card->num_links; i++) {
1664 ret = soc_probe_link_components(card, i, order); 1670 ret = soc_probe_link_components(card, i, order);
1665 if (ret < 0) { 1671 if (ret < 0) {
1666 pr_err("asoc: failed to instantiate card %s: %d\n", 1672 dev_err(card->dev,
1667 card->name, ret); 1673 "ASoC: failed to instantiate card %d\n",
1674 ret);
1668 goto probe_dai_err; 1675 goto probe_dai_err;
1669 } 1676 }
1670 } 1677 }
@@ -1676,8 +1683,9 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
1676 for (i = 0; i < card->num_links; i++) { 1683 for (i = 0; i < card->num_links; i++) {
1677 ret = soc_probe_link_dais(card, i, order); 1684 ret = soc_probe_link_dais(card, i, order);
1678 if (ret < 0) { 1685 if (ret < 0) {
1679 pr_err("asoc: failed to instantiate card %s: %d\n", 1686 dev_err(card->dev,
1680 card->name, ret); 1687 "ASoC: failed to instantiate card %d\n",
1688 ret);
1681 goto probe_dai_err; 1689 goto probe_dai_err;
1682 } 1690 }
1683 } 1691 }
@@ -1686,8 +1694,9 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
1686 for (i = 0; i < card->num_aux_devs; i++) { 1694 for (i = 0; i < card->num_aux_devs; i++) {
1687 ret = soc_probe_aux_dev(card, i); 1695 ret = soc_probe_aux_dev(card, i);
1688 if (ret < 0) { 1696 if (ret < 0) {
1689 pr_err("asoc: failed to add auxiliary devices %s: %d\n", 1697 dev_err(card->dev,
1690 card->name, ret); 1698 "ASoC: failed to add auxiliary devices %d\n",
1699 ret);
1691 goto probe_aux_dev_err; 1700 goto probe_aux_dev_err;
1692 } 1701 }
1693 } 1702 }
@@ -1712,7 +1721,7 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
1712 dai_fmt); 1721 dai_fmt);
1713 if (ret != 0 && ret != -ENOTSUPP) 1722 if (ret != 0 && ret != -ENOTSUPP)
1714 dev_warn(card->rtd[i].codec_dai->dev, 1723 dev_warn(card->rtd[i].codec_dai->dev,
1715 "Failed to set DAI format: %d\n", 1724 "ASoC: Failed to set DAI format: %d\n",
1716 ret); 1725 ret);
1717 } 1726 }
1718 1727
@@ -1723,7 +1732,7 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
1723 dai_fmt); 1732 dai_fmt);
1724 if (ret != 0 && ret != -ENOTSUPP) 1733 if (ret != 0 && ret != -ENOTSUPP)
1725 dev_warn(card->rtd[i].cpu_dai->dev, 1734 dev_warn(card->rtd[i].cpu_dai->dev,
1726 "Failed to set DAI format: %d\n", 1735 "ASoC: Failed to set DAI format: %d\n",
1727 ret); 1736 ret);
1728 } else if (dai_fmt) { 1737 } else if (dai_fmt) {
1729 /* Flip the polarity for the "CPU" end */ 1738 /* Flip the polarity for the "CPU" end */
@@ -1748,7 +1757,7 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
1748 dai_fmt); 1757 dai_fmt);
1749 if (ret != 0 && ret != -ENOTSUPP) 1758 if (ret != 0 && ret != -ENOTSUPP)
1750 dev_warn(card->rtd[i].cpu_dai->dev, 1759 dev_warn(card->rtd[i].cpu_dai->dev,
1751 "Failed to set DAI format: %d\n", 1760 "ASoC: Failed to set DAI format: %d\n",
1752 ret); 1761 ret);
1753 } 1762 }
1754 } 1763 }
@@ -1775,7 +1784,7 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
1775 if (card->late_probe) { 1784 if (card->late_probe) {
1776 ret = card->late_probe(card); 1785 ret = card->late_probe(card);
1777 if (ret < 0) { 1786 if (ret < 0) {
1778 dev_err(card->dev, "%s late_probe() failed: %d\n", 1787 dev_err(card->dev, "ASoC: %s late_probe() failed: %d\n",
1779 card->name, ret); 1788 card->name, ret);
1780 goto probe_aux_dev_err; 1789 goto probe_aux_dev_err;
1781 } 1790 }
@@ -1789,8 +1798,8 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
1789 1798
1790 ret = snd_card_register(card->snd_card); 1799 ret = snd_card_register(card->snd_card);
1791 if (ret < 0) { 1800 if (ret < 0) {
1792 pr_err("asoc: failed to register soundcard for %s: %d\n", 1801 dev_err(card->dev, "ASoC: failed to register soundcard %d\n",
1793 card->name, ret); 1802 ret);
1794 goto probe_aux_dev_err; 1803 goto probe_aux_dev_err;
1795 } 1804 }
1796 1805
@@ -1799,8 +1808,8 @@ static int snd_soc_instantiate_card(struct snd_soc_card *card)
1799 for (i = 0; i < card->num_rtd; i++) { 1808 for (i = 0; i < card->num_rtd; i++) {
1800 ret = soc_register_ac97_dai_link(&card->rtd[i]); 1809 ret = soc_register_ac97_dai_link(&card->rtd[i]);
1801 if (ret < 0) { 1810 if (ret < 0) {
1802 pr_err("asoc: failed to register AC97 %s: %d\n", 1811 dev_err(card->dev, "ASoC: failed to register AC97:"
1803 card->name, ret); 1812 " %d\n", ret);
1804 while (--i >= 0) 1813 while (--i >= 0)
1805 soc_unregister_ac97_dai_link(card->rtd[i].codec); 1814 soc_unregister_ac97_dai_link(card->rtd[i].codec);
1806 goto probe_aux_dev_err; 1815 goto probe_aux_dev_err;
@@ -1846,7 +1855,7 @@ static int soc_probe(struct platform_device *pdev)
1846 return -EINVAL; 1855 return -EINVAL;
1847 1856
1848 dev_warn(&pdev->dev, 1857 dev_warn(&pdev->dev,
1849 "ASoC machine %s should use snd_soc_register_card()\n", 1858 "ASoC: machine %s should use snd_soc_register_card()\n",
1850 card->name); 1859 card->name);
1851 1860
1852 /* Bodge while we unpick instantiation */ 1861 /* Bodge while we unpick instantiation */
@@ -1996,7 +2005,7 @@ int snd_soc_platform_read(struct snd_soc_platform *platform,
1996 unsigned int ret; 2005 unsigned int ret;
1997 2006
1998 if (!platform->driver->read) { 2007 if (!platform->driver->read) {
1999 dev_err(platform->dev, "platform has no read back\n"); 2008 dev_err(platform->dev, "ASoC: platform has no read back\n");
2000 return -1; 2009 return -1;
2001 } 2010 }
2002 2011
@@ -2012,7 +2021,7 @@ int snd_soc_platform_write(struct snd_soc_platform *platform,
2012 unsigned int reg, unsigned int val) 2021 unsigned int reg, unsigned int val)
2013{ 2022{
2014 if (!platform->driver->write) { 2023 if (!platform->driver->write) {
2015 dev_err(platform->dev, "platform has no write back\n"); 2024 dev_err(platform->dev, "ASoC: platform has no write back\n");
2016 return -1; 2025 return -1;
2017 } 2026 }
2018 2027
@@ -2283,7 +2292,8 @@ static int snd_soc_add_controls(struct snd_card *card, struct device *dev,
2283 err = snd_ctl_add(card, snd_soc_cnew(control, data, 2292 err = snd_ctl_add(card, snd_soc_cnew(control, data,
2284 control->name, prefix)); 2293 control->name, prefix));
2285 if (err < 0) { 2294 if (err < 0) {
2286 dev_err(dev, "Failed to add %s: %d\n", control->name, err); 2295 dev_err(dev, "ASoC: Failed to add %s: %d\n",
2296 control->name, err);
2287 return err; 2297 return err;
2288 } 2298 }
2289 } 2299 }
@@ -3534,15 +3544,14 @@ int snd_soc_register_card(struct snd_soc_card *card)
3534 * not both or neither. 3544 * not both or neither.
3535 */ 3545 */
3536 if (!!link->codec_name == !!link->codec_of_node) { 3546 if (!!link->codec_name == !!link->codec_of_node) {
3537 dev_err(card->dev, 3547 dev_err(card->dev, "ASoC: Neither/both codec"
3538 "Neither/both codec name/of_node are set for %s\n", 3548 " name/of_node are set for %s\n", link->name);
3539 link->name);
3540 return -EINVAL; 3549 return -EINVAL;
3541 } 3550 }
3542 /* Codec DAI name must be specified */ 3551 /* Codec DAI name must be specified */
3543 if (!link->codec_dai_name) { 3552 if (!link->codec_dai_name) {
3544 dev_err(card->dev, "codec_dai_name not set for %s\n", 3553 dev_err(card->dev, "ASoC: codec_dai_name not"
3545 link->name); 3554 " set for %s\n", link->name);
3546 return -EINVAL; 3555 return -EINVAL;
3547 } 3556 }
3548 3557
@@ -3551,8 +3560,8 @@ int snd_soc_register_card(struct snd_soc_card *card)
3551 * can be left unspecified, and a dummy platform will be used. 3560 * can be left unspecified, and a dummy platform will be used.
3552 */ 3561 */
3553 if (link->platform_name && link->platform_of_node) { 3562 if (link->platform_name && link->platform_of_node) {
3554 dev_err(card->dev, 3563 dev_err(card->dev, "ASoC: Both platform name/of_node"
3555 "Both platform name/of_node are set for %s\n", link->name); 3564 " are set for %s\n", link->name);
3556 return -EINVAL; 3565 return -EINVAL;
3557 } 3566 }
3558 3567
@@ -3562,9 +3571,8 @@ int snd_soc_register_card(struct snd_soc_card *card)
3562 * name alone.. 3571 * name alone..
3563 */ 3572 */
3564 if (link->cpu_name && link->cpu_of_node) { 3573 if (link->cpu_name && link->cpu_of_node) {
3565 dev_err(card->dev, 3574 dev_err(card->dev, "ASoC: Neither/both "
3566 "Neither/both cpu name/of_node are set for %s\n", 3575 "cpu name/of_node are set for %s\n",link->name);
3567 link->name);
3568 return -EINVAL; 3576 return -EINVAL;
3569 } 3577 }
3570 /* 3578 /*
@@ -3573,9 +3581,8 @@ int snd_soc_register_card(struct snd_soc_card *card)
3573 */ 3581 */
3574 if (!link->cpu_dai_name && 3582 if (!link->cpu_dai_name &&
3575 !(link->cpu_name || link->cpu_of_node)) { 3583 !(link->cpu_name || link->cpu_of_node)) {
3576 dev_err(card->dev, 3584 dev_err(card->dev, "ASoC: Neither cpu_dai_name nor "
3577 "Neither cpu_dai_name nor cpu_name/of_node are set for %s\n", 3585 "cpu_name/of_node are set for %s\n", link->name);
3578 link->name);
3579 return -EINVAL; 3586 return -EINVAL;
3580 } 3587 }
3581 } 3588 }
@@ -3622,7 +3629,7 @@ int snd_soc_unregister_card(struct snd_soc_card *card)
3622{ 3629{
3623 if (card->instantiated) 3630 if (card->instantiated)
3624 soc_cleanup_card_resources(card); 3631 soc_cleanup_card_resources(card);
3625 dev_dbg(card->dev, "Unregistered card '%s'\n", card->name); 3632 dev_dbg(card->dev, "ASoC: Unregistered card '%s'\n", card->name);
3626 3633
3627 return 0; 3634 return 0;
3628} 3635}
@@ -3679,8 +3686,8 @@ static inline char *fmt_multiple_name(struct device *dev,
3679 struct snd_soc_dai_driver *dai_drv) 3686 struct snd_soc_dai_driver *dai_drv)
3680{ 3687{
3681 if (dai_drv->name == NULL) { 3688 if (dai_drv->name == NULL) {
3682 pr_err("asoc: error - multiple DAI %s registered with no name\n", 3689 dev_err(dev, "ASoC: error - multiple DAI %s registered with"
3683 dev_name(dev)); 3690 " no name\n", dev_name(dev));
3684 return NULL; 3691 return NULL;
3685 } 3692 }
3686 3693
@@ -3698,7 +3705,7 @@ int snd_soc_register_dai(struct device *dev,
3698 struct snd_soc_codec *codec; 3705 struct snd_soc_codec *codec;
3699 struct snd_soc_dai *dai; 3706 struct snd_soc_dai *dai;
3700 3707
3701 dev_dbg(dev, "dai register %s\n", dev_name(dev)); 3708 dev_dbg(dev, "ASoC: dai register %s\n", dev_name(dev));
3702 3709
3703 dai = kzalloc(sizeof(struct snd_soc_dai), GFP_KERNEL); 3710 dai = kzalloc(sizeof(struct snd_soc_dai), GFP_KERNEL);
3704 if (dai == NULL) 3711 if (dai == NULL)
@@ -3721,7 +3728,7 @@ int snd_soc_register_dai(struct device *dev,
3721 3728
3722 list_for_each_entry(codec, &codec_list, list) { 3729 list_for_each_entry(codec, &codec_list, list) {
3723 if (codec->dev == dev) { 3730 if (codec->dev == dev) {
3724 dev_dbg(dev, "Mapped DAI %s to CODEC %s\n", 3731 dev_dbg(dev, "ASoC: Mapped DAI %s to CODEC %s\n",
3725 dai->name, codec->name); 3732 dai->name, codec->name);
3726 dai->codec = codec; 3733 dai->codec = codec;
3727 break; 3734 break;
@@ -3735,7 +3742,7 @@ int snd_soc_register_dai(struct device *dev,
3735 3742
3736 mutex_unlock(&client_mutex); 3743 mutex_unlock(&client_mutex);
3737 3744
3738 pr_debug("Registered DAI '%s'\n", dai->name); 3745 dev_dbg(dev, "ASoC: Registered DAI '%s'\n", dai->name);
3739 3746
3740 return 0; 3747 return 0;
3741} 3748}
@@ -3761,7 +3768,7 @@ found:
3761 list_del(&dai->list); 3768 list_del(&dai->list);
3762 mutex_unlock(&client_mutex); 3769 mutex_unlock(&client_mutex);
3763 3770
3764 pr_debug("Unregistered DAI '%s'\n", dai->name); 3771 dev_dbg(dev, "ASoC: Unregistered DAI '%s'\n", dai->name);
3765 kfree(dai->name); 3772 kfree(dai->name);
3766 kfree(dai); 3773 kfree(dai);
3767} 3774}
@@ -3780,7 +3787,7 @@ int snd_soc_register_dais(struct device *dev,
3780 struct snd_soc_dai *dai; 3787 struct snd_soc_dai *dai;
3781 int i, ret = 0; 3788 int i, ret = 0;
3782 3789
3783 dev_dbg(dev, "dai register %s #%Zu\n", dev_name(dev), count); 3790 dev_dbg(dev, "ASoC: dai register %s #%Zu\n", dev_name(dev), count);
3784 3791
3785 for (i = 0; i < count; i++) { 3792 for (i = 0; i < count; i++) {
3786 3793
@@ -3812,8 +3819,8 @@ int snd_soc_register_dais(struct device *dev,
3812 3819
3813 list_for_each_entry(codec, &codec_list, list) { 3820 list_for_each_entry(codec, &codec_list, list) {
3814 if (codec->dev == dev) { 3821 if (codec->dev == dev) {
3815 dev_dbg(dev, "Mapped DAI %s to CODEC %s\n", 3822 dev_dbg(dev, "ASoC: Mapped DAI %s to "
3816 dai->name, codec->name); 3823 "CODEC %s\n", dai->name, codec->name);
3817 dai->codec = codec; 3824 dai->codec = codec;
3818 break; 3825 break;
3819 } 3826 }
@@ -3826,7 +3833,7 @@ int snd_soc_register_dais(struct device *dev,
3826 3833
3827 mutex_unlock(&client_mutex); 3834 mutex_unlock(&client_mutex);
3828 3835
3829 pr_debug("Registered DAI '%s'\n", dai->name); 3836 dev_dbg(dai->dev, "ASoC: Registered DAI '%s'\n", dai->name);
3830 } 3837 }
3831 3838
3832 return 0; 3839 return 0;
@@ -3864,7 +3871,7 @@ int snd_soc_register_platform(struct device *dev,
3864{ 3871{
3865 struct snd_soc_platform *platform; 3872 struct snd_soc_platform *platform;
3866 3873
3867 dev_dbg(dev, "platform register %s\n", dev_name(dev)); 3874 dev_dbg(dev, "ASoC: platform register %s\n", dev_name(dev));
3868 3875
3869 platform = kzalloc(sizeof(struct snd_soc_platform), GFP_KERNEL); 3876 platform = kzalloc(sizeof(struct snd_soc_platform), GFP_KERNEL);
3870 if (platform == NULL) 3877 if (platform == NULL)
@@ -3888,7 +3895,7 @@ int snd_soc_register_platform(struct device *dev,
3888 list_add(&platform->list, &platform_list); 3895 list_add(&platform->list, &platform_list);
3889 mutex_unlock(&client_mutex); 3896 mutex_unlock(&client_mutex);
3890 3897
3891 pr_debug("Registered platform '%s'\n", platform->name); 3898 dev_dbg(dev, "ASoC: Registered platform '%s'\n", platform->name);
3892 3899
3893 return 0; 3900 return 0;
3894} 3901}
@@ -3914,7 +3921,7 @@ found:
3914 list_del(&platform->list); 3921 list_del(&platform->list);
3915 mutex_unlock(&client_mutex); 3922 mutex_unlock(&client_mutex);
3916 3923
3917 pr_debug("Unregistered platform '%s'\n", platform->name); 3924 dev_dbg(dev, "ASoC: Unregistered platform '%s'\n", platform->name);
3918 kfree(platform->name); 3925 kfree(platform->name);
3919 kfree(platform); 3926 kfree(platform);
3920} 3927}
@@ -4007,7 +4014,7 @@ int snd_soc_register_codec(struct device *dev,
4007 codec->reg_size = reg_size; 4014 codec->reg_size = reg_size;
4008 /* it is necessary to make a copy of the default register cache 4015 /* it is necessary to make a copy of the default register cache
4009 * because in the case of using a compression type that requires 4016 * because in the case of using a compression type that requires
4010 * the default register cache to be marked as __devinitconst the 4017 * the default register cache to be marked as the
4011 * kernel might have freed the array by the time we initialize 4018 * kernel might have freed the array by the time we initialize
4012 * the cache. 4019 * the cache.
4013 */ 4020 */
@@ -4043,11 +4050,11 @@ int snd_soc_register_codec(struct device *dev,
4043 if (num_dai) { 4050 if (num_dai) {
4044 ret = snd_soc_register_dais(dev, dai_drv, num_dai); 4051 ret = snd_soc_register_dais(dev, dai_drv, num_dai);
4045 if (ret < 0) 4052 if (ret < 0)
4046 dev_err(codec->dev, "Failed to regster DAIs: %d\n", 4053 dev_err(codec->dev, "ASoC: Failed to regster"
4047 ret); 4054 " DAIs: %d\n", ret);
4048 } 4055 }
4049 4056
4050 pr_debug("Registered codec '%s'\n", codec->name); 4057 dev_dbg(codec->dev, "ASoC: Registered codec '%s'\n", codec->name);
4051 return 0; 4058 return 0;
4052 4059
4053fail: 4060fail:
@@ -4082,7 +4089,7 @@ found:
4082 list_del(&codec->list); 4089 list_del(&codec->list);
4083 mutex_unlock(&client_mutex); 4090 mutex_unlock(&client_mutex);
4084 4091
4085 pr_debug("Unregistered codec '%s'\n", codec->name); 4092 dev_dbg(codec->dev, "ASoC: Unregistered codec '%s'\n", codec->name);
4086 4093
4087 snd_soc_cache_exit(codec); 4094 snd_soc_cache_exit(codec);
4088 kfree(codec->reg_def_copy); 4095 kfree(codec->reg_def_copy);
@@ -4106,7 +4113,7 @@ int snd_soc_of_parse_card_name(struct snd_soc_card *card,
4106 */ 4113 */
4107 if (ret < 0 && ret != -EINVAL) { 4114 if (ret < 0 && ret != -EINVAL) {
4108 dev_err(card->dev, 4115 dev_err(card->dev,
4109 "Property '%s' could not be read: %d\n", 4116 "ASoC: Property '%s' could not be read: %d\n",
4110 propname, ret); 4117 propname, ret);
4111 return ret; 4118 return ret;
4112 } 4119 }
@@ -4125,15 +4132,13 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
4125 4132
4126 num_routes = of_property_count_strings(np, propname); 4133 num_routes = of_property_count_strings(np, propname);
4127 if (num_routes < 0 || num_routes & 1) { 4134 if (num_routes < 0 || num_routes & 1) {
4128 dev_err(card->dev, 4135 dev_err(card->dev, "ASoC: Property '%s' does not exist or its"
4129 "Property '%s' does not exist or its length is not even\n", 4136 " length is not even\n", propname);
4130 propname);
4131 return -EINVAL; 4137 return -EINVAL;
4132 } 4138 }
4133 num_routes /= 2; 4139 num_routes /= 2;
4134 if (!num_routes) { 4140 if (!num_routes) {
4135 dev_err(card->dev, 4141 dev_err(card->dev, "ASoC: Property '%s's length is zero\n",
4136 "Property '%s's length is zero\n",
4137 propname); 4142 propname);
4138 return -EINVAL; 4143 return -EINVAL;
4139 } 4144 }
@@ -4142,7 +4147,7 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
4142 GFP_KERNEL); 4147 GFP_KERNEL);
4143 if (!routes) { 4148 if (!routes) {
4144 dev_err(card->dev, 4149 dev_err(card->dev,
4145 "Could not allocate DAPM route table\n"); 4150 "ASoC: Could not allocate DAPM route table\n");
4146 return -EINVAL; 4151 return -EINVAL;
4147 } 4152 }
4148 4153
@@ -4150,9 +4155,9 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
4150 ret = of_property_read_string_index(np, propname, 4155 ret = of_property_read_string_index(np, propname,
4151 2 * i, &routes[i].sink); 4156 2 * i, &routes[i].sink);
4152 if (ret) { 4157 if (ret) {
4153 dev_err(card->dev, 4158 dev_err(card->dev, "ASoC: Property '%s' index %d"
4154 "Property '%s' index %d could not be read: %d\n", 4159 " could not be read: %d\n", propname, 2 * i,
4155 propname, 2 * i, ret); 4160 ret);
4156 kfree(routes); 4161 kfree(routes);
4157 return -EINVAL; 4162 return -EINVAL;
4158 } 4163 }
@@ -4160,8 +4165,8 @@ int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
4160 (2 * i) + 1, &routes[i].source); 4165 (2 * i) + 1, &routes[i].source);
4161 if (ret) { 4166 if (ret) {
4162 dev_err(card->dev, 4167 dev_err(card->dev,
4163 "Property '%s' index %d could not be read: %d\n", 4168 "ASoC: Property '%s' index %d could not be"
4164 propname, (2 * i) + 1, ret); 4169 " read: %d\n", propname, (2 * i) + 1, ret);
4165 kfree(routes); 4170 kfree(routes);
4166 return -EINVAL; 4171 return -EINVAL;
4167 } 4172 }
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index 6e35bcae02df..1e36bc81e5af 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -220,7 +220,7 @@ static int soc_widget_read(struct snd_soc_dapm_widget *w, int reg)
220 else if (w->platform) 220 else if (w->platform)
221 return snd_soc_platform_read(w->platform, reg); 221 return snd_soc_platform_read(w->platform, reg);
222 222
223 dev_err(w->dapm->dev, "no valid widget read method\n"); 223 dev_err(w->dapm->dev, "ASoC: no valid widget read method\n");
224 return -1; 224 return -1;
225} 225}
226 226
@@ -231,7 +231,7 @@ static int soc_widget_write(struct snd_soc_dapm_widget *w, int reg, int val)
231 else if (w->platform) 231 else if (w->platform)
232 return snd_soc_platform_write(w->platform, reg, val); 232 return snd_soc_platform_write(w->platform, reg, val);
233 233
234 dev_err(w->dapm->dev, "no valid widget write method\n"); 234 dev_err(w->dapm->dev, "ASoC: no valid widget write method\n");
235 return -1; 235 return -1;
236} 236}
237 237
@@ -546,7 +546,7 @@ static int dapm_new_mixer(struct snd_soc_dapm_widget *w)
546 wlist = kzalloc(wlistsize, GFP_KERNEL); 546 wlist = kzalloc(wlistsize, GFP_KERNEL);
547 if (wlist == NULL) { 547 if (wlist == NULL) {
548 dev_err(dapm->dev, 548 dev_err(dapm->dev,
549 "asoc: can't allocate widget list for %s\n", 549 "ASoC: can't allocate widget list for %s\n",
550 w->name); 550 w->name);
551 return -ENOMEM; 551 return -ENOMEM;
552 } 552 }
@@ -595,9 +595,9 @@ static int dapm_new_mixer(struct snd_soc_dapm_widget *w)
595 prefix); 595 prefix);
596 ret = snd_ctl_add(card, path->kcontrol); 596 ret = snd_ctl_add(card, path->kcontrol);
597 if (ret < 0) { 597 if (ret < 0) {
598 dev_err(dapm->dev, 598 dev_err(dapm->dev, "ASoC: failed to add widget"
599 "asoc: failed to add dapm kcontrol %s: %d\n", 599 " %s dapm kcontrol %s: %d\n",
600 path->long_name, ret); 600 w->name, path->long_name, ret);
601 kfree(wlist); 601 kfree(wlist);
602 kfree(path->long_name); 602 kfree(path->long_name);
603 path->long_name = NULL; 603 path->long_name = NULL;
@@ -626,7 +626,7 @@ static int dapm_new_mux(struct snd_soc_dapm_widget *w)
626 626
627 if (w->num_kcontrols != 1) { 627 if (w->num_kcontrols != 1) {
628 dev_err(dapm->dev, 628 dev_err(dapm->dev,
629 "asoc: mux %s has incorrect number of controls\n", 629 "ASoC: mux %s has incorrect number of controls\n",
630 w->name); 630 w->name);
631 return -EINVAL; 631 return -EINVAL;
632 } 632 }
@@ -645,7 +645,7 @@ static int dapm_new_mux(struct snd_soc_dapm_widget *w)
645 wlist = krealloc(wlist, wlistsize, GFP_KERNEL); 645 wlist = krealloc(wlist, wlistsize, GFP_KERNEL);
646 if (wlist == NULL) { 646 if (wlist == NULL) {
647 dev_err(dapm->dev, 647 dev_err(dapm->dev,
648 "asoc: can't allocate widget list for %s\n", w->name); 648 "ASoC: can't allocate widget list for %s\n", w->name);
649 return -ENOMEM; 649 return -ENOMEM;
650 } 650 }
651 wlist->num_widgets = wlistentries; 651 wlist->num_widgets = wlistentries;
@@ -677,7 +677,7 @@ static int dapm_new_mux(struct snd_soc_dapm_widget *w)
677 name + prefix_len, prefix); 677 name + prefix_len, prefix);
678 ret = snd_ctl_add(card, kcontrol); 678 ret = snd_ctl_add(card, kcontrol);
679 if (ret < 0) { 679 if (ret < 0) {
680 dev_err(dapm->dev, "failed to add kcontrol %s: %d\n", 680 dev_err(dapm->dev, "ASoC: failed to add kcontrol %s: %d\n",
681 w->name, ret); 681 w->name, ret);
682 kfree(wlist); 682 kfree(wlist);
683 return ret; 683 return ret;
@@ -699,7 +699,7 @@ static int dapm_new_pga(struct snd_soc_dapm_widget *w)
699{ 699{
700 if (w->num_kcontrols) 700 if (w->num_kcontrols)
701 dev_err(w->dapm->dev, 701 dev_err(w->dapm->dev,
702 "asoc: PGA controls not supported: '%s'\n", w->name); 702 "ASoC: PGA controls not supported: '%s'\n", w->name);
703 703
704 return 0; 704 return 0;
705} 705}
@@ -725,7 +725,7 @@ static int snd_soc_dapm_suspend_check(struct snd_soc_dapm_widget *widget)
725 case SNDRV_CTL_POWER_D3hot: 725 case SNDRV_CTL_POWER_D3hot:
726 case SNDRV_CTL_POWER_D3cold: 726 case SNDRV_CTL_POWER_D3cold:
727 if (widget->ignore_suspend) 727 if (widget->ignore_suspend)
728 dev_dbg(widget->dapm->dev, "%s ignoring suspend\n", 728 dev_dbg(widget->dapm->dev, "ASoC: %s ignoring suspend\n",
729 widget->name); 729 widget->name);
730 return widget->ignore_suspend; 730 return widget->ignore_suspend;
731 default: 731 default:
@@ -757,14 +757,14 @@ static int dapm_list_add_widget(struct snd_soc_dapm_widget_list **list,
757 wlistentries * sizeof(struct snd_soc_dapm_widget *); 757 wlistentries * sizeof(struct snd_soc_dapm_widget *);
758 *list = krealloc(wlist, wlistsize, GFP_KERNEL); 758 *list = krealloc(wlist, wlistsize, GFP_KERNEL);
759 if (*list == NULL) { 759 if (*list == NULL) {
760 dev_err(w->dapm->dev, "can't allocate widget list for %s\n", 760 dev_err(w->dapm->dev, "ASoC: can't allocate widget list for %s\n",
761 w->name); 761 w->name);
762 return -ENOMEM; 762 return -ENOMEM;
763 } 763 }
764 wlist = *list; 764 wlist = *list;
765 765
766 /* insert the widget */ 766 /* insert the widget */
767 dev_dbg(w->dapm->dev, "added %s in widget list pos %d\n", 767 dev_dbg(w->dapm->dev, "ASoC: added %s in widget list pos %d\n",
768 w->name, wlist->num_widgets); 768 w->name, wlist->num_widgets);
769 769
770 wlist->widgets[wlist->num_widgets] = w; 770 wlist->widgets[wlist->num_widgets] = w;
@@ -844,7 +844,8 @@ static int is_connected_output_ep(struct snd_soc_dapm_widget *widget,
844 int err; 844 int err;
845 err = dapm_list_add_widget(list, path->sink); 845 err = dapm_list_add_widget(list, path->sink);
846 if (err < 0) { 846 if (err < 0) {
847 dev_err(widget->dapm->dev, "could not add widget %s\n", 847 dev_err(widget->dapm->dev,
848 "ASoC: could not add widget %s\n",
848 widget->name); 849 widget->name);
849 return con; 850 return con;
850 } 851 }
@@ -943,7 +944,8 @@ static int is_connected_input_ep(struct snd_soc_dapm_widget *widget,
943 int err; 944 int err;
944 err = dapm_list_add_widget(list, path->source); 945 err = dapm_list_add_widget(list, path->source);
945 if (err < 0) { 946 if (err < 0) {
946 dev_err(widget->dapm->dev, "could not add widget %s\n", 947 dev_err(widget->dapm->dev,
948 "ASoC: could not add widget %s\n",
947 widget->name); 949 widget->name);
948 return con; 950 return con;
949 } 951 }
@@ -1024,7 +1026,7 @@ int dapm_regulator_event(struct snd_soc_dapm_widget *w,
1024 ret = regulator_allow_bypass(w->regulator, true); 1026 ret = regulator_allow_bypass(w->regulator, true);
1025 if (ret != 0) 1027 if (ret != 0)
1026 dev_warn(w->dapm->dev, 1028 dev_warn(w->dapm->dev,
1027 "Failed to bypass %s: %d\n", 1029 "ASoC: Failed to bypass %s: %d\n",
1028 w->name, ret); 1030 w->name, ret);
1029 } 1031 }
1030 1032
@@ -1034,7 +1036,7 @@ int dapm_regulator_event(struct snd_soc_dapm_widget *w,
1034 ret = regulator_allow_bypass(w->regulator, false); 1036 ret = regulator_allow_bypass(w->regulator, false);
1035 if (ret != 0) 1037 if (ret != 0)
1036 dev_warn(w->dapm->dev, 1038 dev_warn(w->dapm->dev,
1037 "Failed to unbypass %s: %d\n", 1039 "ASoC: Failed to unbypass %s: %d\n",
1038 w->name, ret); 1040 w->name, ret);
1039 } 1041 }
1040 1042
@@ -1253,7 +1255,7 @@ static void dapm_seq_check_event(struct snd_soc_dapm_context *dapm,
1253 ret = w->event(w, NULL, event); 1255 ret = w->event(w, NULL, event);
1254 trace_snd_soc_dapm_widget_event_done(w, event); 1256 trace_snd_soc_dapm_widget_event_done(w, event);
1255 if (ret < 0) 1257 if (ret < 0)
1256 pr_err("%s: %s event failed: %d\n", 1258 dev_err(dapm->dev, "ASoC: %s: %s event failed: %d\n",
1257 ev_name, w->name, ret); 1259 ev_name, w->name, ret);
1258 } 1260 }
1259} 1261}
@@ -1402,7 +1404,7 @@ static void dapm_seq_run(struct snd_soc_dapm_context *dapm,
1402 1404
1403 if (ret < 0) 1405 if (ret < 0)
1404 dev_err(w->dapm->dev, 1406 dev_err(w->dapm->dev,
1405 "Failed to apply widget power: %d\n", ret); 1407 "ASoC: Failed to apply widget power: %d\n", ret);
1406 } 1408 }
1407 1409
1408 if (!list_empty(&pending)) 1410 if (!list_empty(&pending))
@@ -1431,20 +1433,21 @@ static void dapm_widget_update(struct snd_soc_dapm_context *dapm)
1431 (w->event_flags & SND_SOC_DAPM_PRE_REG)) { 1433 (w->event_flags & SND_SOC_DAPM_PRE_REG)) {
1432 ret = w->event(w, update->kcontrol, SND_SOC_DAPM_PRE_REG); 1434 ret = w->event(w, update->kcontrol, SND_SOC_DAPM_PRE_REG);
1433 if (ret != 0) 1435 if (ret != 0)
1434 pr_err("%s DAPM pre-event failed: %d\n", 1436 dev_err(dapm->dev, "ASoC: %s DAPM pre-event failed: %d\n",
1435 w->name, ret); 1437 w->name, ret);
1436 } 1438 }
1437 1439
1438 ret = soc_widget_update_bits_locked(w, update->reg, update->mask, 1440 ret = soc_widget_update_bits_locked(w, update->reg, update->mask,
1439 update->val); 1441 update->val);
1440 if (ret < 0) 1442 if (ret < 0)
1441 pr_err("%s DAPM update failed: %d\n", w->name, ret); 1443 dev_err(dapm->dev, "ASoC: %s DAPM update failed: %d\n",
1444 w->name, ret);
1442 1445
1443 if (w->event && 1446 if (w->event &&
1444 (w->event_flags & SND_SOC_DAPM_POST_REG)) { 1447 (w->event_flags & SND_SOC_DAPM_POST_REG)) {
1445 ret = w->event(w, update->kcontrol, SND_SOC_DAPM_POST_REG); 1448 ret = w->event(w, update->kcontrol, SND_SOC_DAPM_POST_REG);
1446 if (ret != 0) 1449 if (ret != 0)
1447 pr_err("%s DAPM post-event failed: %d\n", 1450 dev_err(dapm->dev, "ASoC: %s DAPM post-event failed: %d\n",
1448 w->name, ret); 1451 w->name, ret);
1449 } 1452 }
1450} 1453}
@@ -1466,7 +1469,7 @@ static void dapm_pre_sequence_async(void *data, async_cookie_t cookie)
1466 ret = snd_soc_dapm_set_bias_level(d, SND_SOC_BIAS_STANDBY); 1469 ret = snd_soc_dapm_set_bias_level(d, SND_SOC_BIAS_STANDBY);
1467 if (ret != 0) 1470 if (ret != 0)
1468 dev_err(d->dev, 1471 dev_err(d->dev,
1469 "Failed to turn on bias: %d\n", ret); 1472 "ASoC: Failed to turn on bias: %d\n", ret);
1470 } 1473 }
1471 1474
1472 /* Prepare for a STADDBY->ON or ON->STANDBY transition */ 1475 /* Prepare for a STADDBY->ON or ON->STANDBY transition */
@@ -1474,7 +1477,7 @@ static void dapm_pre_sequence_async(void *data, async_cookie_t cookie)
1474 ret = snd_soc_dapm_set_bias_level(d, SND_SOC_BIAS_PREPARE); 1477 ret = snd_soc_dapm_set_bias_level(d, SND_SOC_BIAS_PREPARE);
1475 if (ret != 0) 1478 if (ret != 0)
1476 dev_err(d->dev, 1479 dev_err(d->dev,
1477 "Failed to prepare bias: %d\n", ret); 1480 "ASoC: Failed to prepare bias: %d\n", ret);
1478 } 1481 }
1479} 1482}
1480 1483
@@ -1492,7 +1495,7 @@ static void dapm_post_sequence_async(void *data, async_cookie_t cookie)
1492 d->target_bias_level == SND_SOC_BIAS_OFF)) { 1495 d->target_bias_level == SND_SOC_BIAS_OFF)) {
1493 ret = snd_soc_dapm_set_bias_level(d, SND_SOC_BIAS_STANDBY); 1496 ret = snd_soc_dapm_set_bias_level(d, SND_SOC_BIAS_STANDBY);
1494 if (ret != 0) 1497 if (ret != 0)
1495 dev_err(d->dev, "Failed to apply standby bias: %d\n", 1498 dev_err(d->dev, "ASoC: Failed to apply standby bias: %d\n",
1496 ret); 1499 ret);
1497 } 1500 }
1498 1501
@@ -1501,7 +1504,8 @@ static void dapm_post_sequence_async(void *data, async_cookie_t cookie)
1501 d->target_bias_level == SND_SOC_BIAS_OFF) { 1504 d->target_bias_level == SND_SOC_BIAS_OFF) {
1502 ret = snd_soc_dapm_set_bias_level(d, SND_SOC_BIAS_OFF); 1505 ret = snd_soc_dapm_set_bias_level(d, SND_SOC_BIAS_OFF);
1503 if (ret != 0) 1506 if (ret != 0)
1504 dev_err(d->dev, "Failed to turn off bias: %d\n", ret); 1507 dev_err(d->dev, "ASoC: Failed to turn off bias: %d\n",
1508 ret);
1505 1509
1506 if (d->dev) 1510 if (d->dev)
1507 pm_runtime_put(d->dev); 1511 pm_runtime_put(d->dev);
@@ -1512,7 +1516,7 @@ static void dapm_post_sequence_async(void *data, async_cookie_t cookie)
1512 d->target_bias_level == SND_SOC_BIAS_ON) { 1516 d->target_bias_level == SND_SOC_BIAS_ON) {
1513 ret = snd_soc_dapm_set_bias_level(d, SND_SOC_BIAS_ON); 1517 ret = snd_soc_dapm_set_bias_level(d, SND_SOC_BIAS_ON);
1514 if (ret != 0) 1518 if (ret != 0)
1515 dev_err(d->dev, "Failed to apply active bias: %d\n", 1519 dev_err(d->dev, "ASoC: Failed to apply active bias: %d\n",
1516 ret); 1520 ret);
1517 } 1521 }
1518} 1522}
@@ -1838,7 +1842,7 @@ void snd_soc_dapm_debugfs_init(struct snd_soc_dapm_context *dapm,
1838 1842
1839 if (!dapm->debugfs_dapm) { 1843 if (!dapm->debugfs_dapm) {
1840 dev_warn(dapm->dev, 1844 dev_warn(dapm->dev,
1841 "Failed to create DAPM debugfs directory\n"); 1845 "ASoC: Failed to create DAPM debugfs directory\n");
1842 return; 1846 return;
1843 } 1847 }
1844 1848
@@ -2123,7 +2127,7 @@ static int snd_soc_dapm_set_pin(struct snd_soc_dapm_context *dapm,
2123 struct snd_soc_dapm_widget *w = dapm_find_widget(dapm, pin, true); 2127 struct snd_soc_dapm_widget *w = dapm_find_widget(dapm, pin, true);
2124 2128
2125 if (!w) { 2129 if (!w) {
2126 dev_err(dapm->dev, "dapm: unknown pin %s\n", pin); 2130 dev_err(dapm->dev, "ASoC: DAPM unknown pin %s\n", pin);
2127 return -EINVAL; 2131 return -EINVAL;
2128 } 2132 }
2129 2133
@@ -2212,8 +2216,16 @@ static int snd_soc_dapm_add_route(struct snd_soc_dapm_context *dapm,
2212 if (!wsource) 2216 if (!wsource)
2213 wsource = wtsource; 2217 wsource = wtsource;
2214 2218
2215 if (wsource == NULL || wsink == NULL) 2219 if (wsource == NULL) {
2220 dev_err(dapm->dev, "ASoC: no source widget found for %s\n",
2221 route->source);
2216 return -ENODEV; 2222 return -ENODEV;
2223 }
2224 if (wsink == NULL) {
2225 dev_err(dapm->dev, "ASoC: no sink widget found for %s\n",
2226 route->sink);
2227 return -ENODEV;
2228 }
2217 2229
2218 path = kzalloc(sizeof(struct snd_soc_dapm_path), GFP_KERNEL); 2230 path = kzalloc(sizeof(struct snd_soc_dapm_path), GFP_KERNEL);
2219 if (!path) 2231 if (!path)
@@ -2308,7 +2320,7 @@ static int snd_soc_dapm_add_route(struct snd_soc_dapm_context *dapm,
2308 return 0; 2320 return 0;
2309 2321
2310err: 2322err:
2311 dev_warn(dapm->dev, "asoc: no dapm match for %s --> %s --> %s\n", 2323 dev_warn(dapm->dev, "ASoC: no dapm match for %s --> %s --> %s\n",
2312 source, control, sink); 2324 source, control, sink);
2313 kfree(path); 2325 kfree(path);
2314 return ret; 2326 return ret;
@@ -2325,7 +2337,7 @@ static int snd_soc_dapm_del_route(struct snd_soc_dapm_context *dapm,
2325 2337
2326 if (route->control) { 2338 if (route->control) {
2327 dev_err(dapm->dev, 2339 dev_err(dapm->dev,
2328 "Removal of routes with controls not supported\n"); 2340 "ASoC: Removal of routes with controls not supported\n");
2329 return -EINVAL; 2341 return -EINVAL;
2330 } 2342 }
2331 2343
@@ -2360,7 +2372,7 @@ static int snd_soc_dapm_del_route(struct snd_soc_dapm_context *dapm,
2360 list_del(&path->list_source); 2372 list_del(&path->list_source);
2361 kfree(path); 2373 kfree(path);
2362 } else { 2374 } else {
2363 dev_warn(dapm->dev, "Route %s->%s does not exist\n", 2375 dev_warn(dapm->dev, "ASoC: Route %s->%s does not exist\n",
2364 source, sink); 2376 source, sink);
2365 } 2377 }
2366 2378
@@ -2389,8 +2401,10 @@ int snd_soc_dapm_add_routes(struct snd_soc_dapm_context *dapm,
2389 for (i = 0; i < num; i++) { 2401 for (i = 0; i < num; i++) {
2390 r = snd_soc_dapm_add_route(dapm, route); 2402 r = snd_soc_dapm_add_route(dapm, route);
2391 if (r < 0) { 2403 if (r < 0) {
2392 dev_err(dapm->dev, "Failed to add route %s->%s\n", 2404 dev_err(dapm->dev, "ASoC: Failed to add route %s -> %s -> %s\n",
2393 route->source, route->sink); 2405 route->source,
2406 route->control ? route->control : "direct",
2407 route->sink);
2394 ret = r; 2408 ret = r;
2395 } 2409 }
2396 route++; 2410 route++;
@@ -2438,19 +2452,19 @@ static int snd_soc_dapm_weak_route(struct snd_soc_dapm_context *dapm,
2438 int count = 0; 2452 int count = 0;
2439 2453
2440 if (!source) { 2454 if (!source) {
2441 dev_err(dapm->dev, "Unable to find source %s for weak route\n", 2455 dev_err(dapm->dev, "ASoC: Unable to find source %s for weak route\n",
2442 route->source); 2456 route->source);
2443 return -ENODEV; 2457 return -ENODEV;
2444 } 2458 }
2445 2459
2446 if (!sink) { 2460 if (!sink) {
2447 dev_err(dapm->dev, "Unable to find sink %s for weak route\n", 2461 dev_err(dapm->dev, "ASoC: Unable to find sink %s for weak route\n",
2448 route->sink); 2462 route->sink);
2449 return -ENODEV; 2463 return -ENODEV;
2450 } 2464 }
2451 2465
2452 if (route->control || route->connected) 2466 if (route->control || route->connected)
2453 dev_warn(dapm->dev, "Ignoring control for weak route %s->%s\n", 2467 dev_warn(dapm->dev, "ASoC: Ignoring control for weak route %s->%s\n",
2454 route->source, route->sink); 2468 route->source, route->sink);
2455 2469
2456 list_for_each_entry(path, &source->sinks, list_source) { 2470 list_for_each_entry(path, &source->sinks, list_source) {
@@ -2461,10 +2475,10 @@ static int snd_soc_dapm_weak_route(struct snd_soc_dapm_context *dapm,
2461 } 2475 }
2462 2476
2463 if (count == 0) 2477 if (count == 0)
2464 dev_err(dapm->dev, "No path found for weak route %s->%s\n", 2478 dev_err(dapm->dev, "ASoC: No path found for weak route %s->%s\n",
2465 route->source, route->sink); 2479 route->source, route->sink);
2466 if (count > 1) 2480 if (count > 1)
2467 dev_warn(dapm->dev, "%d paths found for weak route %s->%s\n", 2481 dev_warn(dapm->dev, "ASoC: %d paths found for weak route %s->%s\n",
2468 count, route->source, route->sink); 2482 count, route->source, route->sink);
2469 2483
2470 return 0; 2484 return 0;
@@ -2601,7 +2615,7 @@ int snd_soc_dapm_get_volsw(struct snd_kcontrol *kcontrol,
2601 2615
2602 if (snd_soc_volsw_is_stereo(mc)) 2616 if (snd_soc_volsw_is_stereo(mc))
2603 dev_warn(widget->dapm->dev, 2617 dev_warn(widget->dapm->dev,
2604 "Control '%s' is stereo, which is not supported\n", 2618 "ASoC: Control '%s' is stereo, which is not supported\n",
2605 kcontrol->id.name); 2619 kcontrol->id.name);
2606 2620
2607 ucontrol->value.integer.value[0] = 2621 ucontrol->value.integer.value[0] =
@@ -2644,7 +2658,7 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol,
2644 2658
2645 if (snd_soc_volsw_is_stereo(mc)) 2659 if (snd_soc_volsw_is_stereo(mc))
2646 dev_warn(widget->dapm->dev, 2660 dev_warn(widget->dapm->dev,
2647 "Control '%s' is stereo, which is not supported\n", 2661 "ASoC: Control '%s' is stereo, which is not supported\n",
2648 kcontrol->id.name); 2662 kcontrol->id.name);
2649 2663
2650 val = (ucontrol->value.integer.value[0] & mask); 2664 val = (ucontrol->value.integer.value[0] & mask);
@@ -3021,7 +3035,7 @@ snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm,
3021 w->regulator = devm_regulator_get(dapm->dev, w->name); 3035 w->regulator = devm_regulator_get(dapm->dev, w->name);
3022 if (IS_ERR(w->regulator)) { 3036 if (IS_ERR(w->regulator)) {
3023 ret = PTR_ERR(w->regulator); 3037 ret = PTR_ERR(w->regulator);
3024 dev_err(dapm->dev, "Failed to request %s: %d\n", 3038 dev_err(dapm->dev, "ASoC: Failed to request %s: %d\n",
3025 w->name, ret); 3039 w->name, ret);
3026 return NULL; 3040 return NULL;
3027 } 3041 }
@@ -3031,7 +3045,7 @@ snd_soc_dapm_new_control(struct snd_soc_dapm_context *dapm,
3031 w->clk = devm_clk_get(dapm->dev, w->name); 3045 w->clk = devm_clk_get(dapm->dev, w->name);
3032 if (IS_ERR(w->clk)) { 3046 if (IS_ERR(w->clk)) {
3033 ret = PTR_ERR(w->clk); 3047 ret = PTR_ERR(w->clk);
3034 dev_err(dapm->dev, "Failed to request %s: %d\n", 3048 dev_err(dapm->dev, "ASoC: Failed to request %s: %d\n",
3035 w->name, ret); 3049 w->name, ret);
3036 return NULL; 3050 return NULL;
3037 } 3051 }
@@ -3182,7 +3196,7 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w,
3182 if (config->formats) { 3196 if (config->formats) {
3183 fmt = ffs(config->formats) - 1; 3197 fmt = ffs(config->formats) - 1;
3184 } else { 3198 } else {
3185 dev_warn(w->dapm->dev, "Invalid format %llx specified\n", 3199 dev_warn(w->dapm->dev, "ASoC: Invalid format %llx specified\n",
3186 config->formats); 3200 config->formats);
3187 fmt = 0; 3201 fmt = 0;
3188 } 3202 }
@@ -3215,7 +3229,7 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w,
3215 params, source); 3229 params, source);
3216 if (ret != 0) { 3230 if (ret != 0) {
3217 dev_err(source->dev, 3231 dev_err(source->dev,
3218 "hw_params() failed: %d\n", ret); 3232 "ASoC: hw_params() failed: %d\n", ret);
3219 goto out; 3233 goto out;
3220 } 3234 }
3221 } 3235 }
@@ -3226,7 +3240,7 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w,
3226 sink); 3240 sink);
3227 if (ret != 0) { 3241 if (ret != 0) {
3228 dev_err(sink->dev, 3242 dev_err(sink->dev,
3229 "hw_params() failed: %d\n", ret); 3243 "ASoC: hw_params() failed: %d\n", ret);
3230 goto out; 3244 goto out;
3231 } 3245 }
3232 } 3246 }
@@ -3235,14 +3249,14 @@ static int snd_soc_dai_link_event(struct snd_soc_dapm_widget *w,
3235 case SND_SOC_DAPM_POST_PMU: 3249 case SND_SOC_DAPM_POST_PMU:
3236 ret = snd_soc_dai_digital_mute(sink, 0); 3250 ret = snd_soc_dai_digital_mute(sink, 0);
3237 if (ret != 0 && ret != -ENOTSUPP) 3251 if (ret != 0 && ret != -ENOTSUPP)
3238 dev_warn(sink->dev, "Failed to unmute: %d\n", ret); 3252 dev_warn(sink->dev, "ASoC: Failed to unmute: %d\n", ret);
3239 ret = 0; 3253 ret = 0;
3240 break; 3254 break;
3241 3255
3242 case SND_SOC_DAPM_PRE_PMD: 3256 case SND_SOC_DAPM_PRE_PMD:
3243 ret = snd_soc_dai_digital_mute(sink, 1); 3257 ret = snd_soc_dai_digital_mute(sink, 1);
3244 if (ret != 0 && ret != -ENOTSUPP) 3258 if (ret != 0 && ret != -ENOTSUPP)
3245 dev_warn(sink->dev, "Failed to mute: %d\n", ret); 3259 dev_warn(sink->dev, "ASoC: Failed to mute: %d\n", ret);
3246 ret = 0; 3260 ret = 0;
3247 break; 3261 break;
3248 3262
@@ -3281,11 +3295,11 @@ int snd_soc_dapm_new_pcm(struct snd_soc_card *card,
3281 template.event_flags = SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU | 3295 template.event_flags = SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
3282 SND_SOC_DAPM_PRE_PMD; 3296 SND_SOC_DAPM_PRE_PMD;
3283 3297
3284 dev_dbg(card->dev, "adding %s widget\n", link_name); 3298 dev_dbg(card->dev, "ASoC: adding %s widget\n", link_name);
3285 3299
3286 w = snd_soc_dapm_new_control(&card->dapm, &template); 3300 w = snd_soc_dapm_new_control(&card->dapm, &template);
3287 if (!w) { 3301 if (!w) {
3288 dev_err(card->dev, "Failed to create %s widget\n", 3302 dev_err(card->dev, "ASoC: Failed to create %s widget\n",
3289 link_name); 3303 link_name);
3290 return -ENOMEM; 3304 return -ENOMEM;
3291 } 3305 }
@@ -3319,12 +3333,12 @@ int snd_soc_dapm_new_dai_widgets(struct snd_soc_dapm_context *dapm,
3319 template.name = dai->driver->playback.stream_name; 3333 template.name = dai->driver->playback.stream_name;
3320 template.sname = dai->driver->playback.stream_name; 3334 template.sname = dai->driver->playback.stream_name;
3321 3335
3322 dev_dbg(dai->dev, "adding %s widget\n", 3336 dev_dbg(dai->dev, "ASoC: adding %s widget\n",
3323 template.name); 3337 template.name);
3324 3338
3325 w = snd_soc_dapm_new_control(dapm, &template); 3339 w = snd_soc_dapm_new_control(dapm, &template);
3326 if (!w) { 3340 if (!w) {
3327 dev_err(dapm->dev, "Failed to create %s widget\n", 3341 dev_err(dapm->dev, "ASoC: Failed to create %s widget\n",
3328 dai->driver->playback.stream_name); 3342 dai->driver->playback.stream_name);
3329 } 3343 }
3330 3344
@@ -3337,12 +3351,12 @@ int snd_soc_dapm_new_dai_widgets(struct snd_soc_dapm_context *dapm,
3337 template.name = dai->driver->capture.stream_name; 3351 template.name = dai->driver->capture.stream_name;
3338 template.sname = dai->driver->capture.stream_name; 3352 template.sname = dai->driver->capture.stream_name;
3339 3353
3340 dev_dbg(dai->dev, "adding %s widget\n", 3354 dev_dbg(dai->dev, "ASoC: adding %s widget\n",
3341 template.name); 3355 template.name);
3342 3356
3343 w = snd_soc_dapm_new_control(dapm, &template); 3357 w = snd_soc_dapm_new_control(dapm, &template);
3344 if (!w) { 3358 if (!w) {
3345 dev_err(dapm->dev, "Failed to create %s widget\n", 3359 dev_err(dapm->dev, "ASoC: Failed to create %s widget\n",
3346 dai->driver->capture.stream_name); 3360 dai->driver->capture.stream_name);
3347 } 3361 }
3348 3362
@@ -3518,11 +3532,11 @@ int snd_soc_dapm_force_enable_pin(struct snd_soc_dapm_context *dapm,
3518 struct snd_soc_dapm_widget *w = dapm_find_widget(dapm, pin, true); 3532 struct snd_soc_dapm_widget *w = dapm_find_widget(dapm, pin, true);
3519 3533
3520 if (!w) { 3534 if (!w) {
3521 dev_err(dapm->dev, "dapm: unknown pin %s\n", pin); 3535 dev_err(dapm->dev, "ASoC: unknown pin %s\n", pin);
3522 return -EINVAL; 3536 return -EINVAL;
3523 } 3537 }
3524 3538
3525 dev_dbg(w->dapm->dev, "dapm: force enable pin %s\n", pin); 3539 dev_dbg(w->dapm->dev, "ASoC: force enable pin %s\n", pin);
3526 w->connected = 1; 3540 w->connected = 1;
3527 w->force = 1; 3541 w->force = 1;
3528 dapm_mark_dirty(w, "force enable"); 3542 dapm_mark_dirty(w, "force enable");
@@ -3605,7 +3619,7 @@ int snd_soc_dapm_ignore_suspend(struct snd_soc_dapm_context *dapm,
3605 struct snd_soc_dapm_widget *w = dapm_find_widget(dapm, pin, false); 3619 struct snd_soc_dapm_widget *w = dapm_find_widget(dapm, pin, false);
3606 3620
3607 if (!w) { 3621 if (!w) {
3608 dev_err(dapm->dev, "dapm: unknown pin %s\n", pin); 3622 dev_err(dapm->dev, "ASoC: unknown pin %s\n", pin);
3609 return -EINVAL; 3623 return -EINVAL;
3610 } 3624 }
3611 3625
@@ -3664,7 +3678,7 @@ void snd_soc_dapm_auto_nc_codec_pins(struct snd_soc_codec *codec)
3664 struct snd_soc_dapm_context *dapm = &codec->dapm; 3678 struct snd_soc_dapm_context *dapm = &codec->dapm;
3665 struct snd_soc_dapm_widget *w; 3679 struct snd_soc_dapm_widget *w;
3666 3680
3667 dev_dbg(codec->dev, "Auto NC: DAPMs: card:%p codec:%p\n", 3681 dev_dbg(codec->dev, "ASoC: Auto NC: DAPMs: card:%p codec:%p\n",
3668 &card->dapm, &codec->dapm); 3682 &card->dapm, &codec->dapm);
3669 3683
3670 list_for_each_entry(w, &card->widgets, list) { 3684 list_for_each_entry(w, &card->widgets, list) {
@@ -3674,7 +3688,7 @@ void snd_soc_dapm_auto_nc_codec_pins(struct snd_soc_codec *codec)
3674 case snd_soc_dapm_input: 3688 case snd_soc_dapm_input:
3675 case snd_soc_dapm_output: 3689 case snd_soc_dapm_output:
3676 case snd_soc_dapm_micbias: 3690 case snd_soc_dapm_micbias:
3677 dev_dbg(codec->dev, "Auto NC: Checking widget %s\n", 3691 dev_dbg(codec->dev, "ASoC: Auto NC: Checking widget %s\n",
3678 w->name); 3692 w->name);
3679 if (!snd_soc_dapm_widget_in_card_paths(card, w)) { 3693 if (!snd_soc_dapm_widget_in_card_paths(card, w)) {
3680 dev_dbg(codec->dev, 3694 dev_dbg(codec->dev,
diff --git a/sound/soc/soc-dmaengine-pcm.c b/sound/soc/soc-dmaengine-pcm.c
index bbc125748a38..111b7d921e89 100644
--- a/sound/soc/soc-dmaengine-pcm.c
+++ b/sound/soc/soc-dmaengine-pcm.c
@@ -317,3 +317,5 @@ int snd_dmaengine_pcm_close(struct snd_pcm_substream *substream)
317 return 0; 317 return 0;
318} 318}
319EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_close); 319EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_close);
320
321MODULE_LICENSE("GPL");
diff --git a/sound/soc/soc-jack.c b/sound/soc/soc-jack.c
index 1ab5fe04bfcc..0bb5cccd7766 100644
--- a/sound/soc/soc-jack.c
+++ b/sound/soc/soc-jack.c
@@ -66,7 +66,6 @@ void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask)
66 struct snd_soc_dapm_context *dapm; 66 struct snd_soc_dapm_context *dapm;
67 struct snd_soc_jack_pin *pin; 67 struct snd_soc_jack_pin *pin;
68 int enable; 68 int enable;
69 int oldstatus;
70 69
71 trace_snd_soc_jack_report(jack, mask, status); 70 trace_snd_soc_jack_report(jack, mask, status);
72 71
@@ -78,8 +77,6 @@ void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask)
78 77
79 mutex_lock(&jack->mutex); 78 mutex_lock(&jack->mutex);
80 79
81 oldstatus = jack->status;
82
83 jack->status &= ~mask; 80 jack->status &= ~mask;
84 jack->status |= status & mask; 81 jack->status |= status & mask;
85 82
@@ -172,12 +169,13 @@ int snd_soc_jack_add_pins(struct snd_soc_jack *jack, int count,
172 169
173 for (i = 0; i < count; i++) { 170 for (i = 0; i < count; i++) {
174 if (!pins[i].pin) { 171 if (!pins[i].pin) {
175 printk(KERN_ERR "No name for pin %d\n", i); 172 dev_err(jack->codec->dev, "ASoC: No name for pin %d\n",
173 i);
176 return -EINVAL; 174 return -EINVAL;
177 } 175 }
178 if (!pins[i].mask) { 176 if (!pins[i].mask) {
179 printk(KERN_ERR "No mask for pin %d (%s)\n", i, 177 dev_err(jack->codec->dev, "ASoC: No mask for pin %d"
180 pins[i].pin); 178 " (%s)\n", i, pins[i].pin);
181 return -EINVAL; 179 return -EINVAL;
182 } 180 }
183 181
@@ -297,13 +295,13 @@ int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count,
297 295
298 for (i = 0; i < count; i++) { 296 for (i = 0; i < count; i++) {
299 if (!gpio_is_valid(gpios[i].gpio)) { 297 if (!gpio_is_valid(gpios[i].gpio)) {
300 printk(KERN_ERR "Invalid gpio %d\n", 298 dev_err(jack->codec->dev, "ASoC: Invalid gpio %d\n",
301 gpios[i].gpio); 299 gpios[i].gpio);
302 ret = -EINVAL; 300 ret = -EINVAL;
303 goto undo; 301 goto undo;
304 } 302 }
305 if (!gpios[i].name) { 303 if (!gpios[i].name) {
306 printk(KERN_ERR "No name for gpio %d\n", 304 dev_err(jack->codec->dev, "ASoC: No name for gpio %d\n",
307 gpios[i].gpio); 305 gpios[i].gpio);
308 ret = -EINVAL; 306 ret = -EINVAL;
309 goto undo; 307 goto undo;
@@ -332,7 +330,7 @@ int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count,
332 if (gpios[i].wake) { 330 if (gpios[i].wake) {
333 ret = irq_set_irq_wake(gpio_to_irq(gpios[i].gpio), 1); 331 ret = irq_set_irq_wake(gpio_to_irq(gpios[i].gpio), 1);
334 if (ret != 0) 332 if (ret != 0)
335 printk(KERN_ERR 333 dev_err(jack->codec->dev, "ASoC: "
336 "Failed to mark GPIO %d as wake source: %d\n", 334 "Failed to mark GPIO %d as wake source: %d\n",
337 gpios[i].gpio, ret); 335 gpios[i].gpio, ret);
338 } 336 }
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index ef22d0bd9e9e..5c3ca2a34661 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -43,7 +43,7 @@ static int dpcm_dapm_stream_event(struct snd_soc_pcm_runtime *fe, int dir,
43 43
44 struct snd_soc_pcm_runtime *be = dpcm->be; 44 struct snd_soc_pcm_runtime *be = dpcm->be;
45 45
46 dev_dbg(be->dev, "pm: BE %s event %d dir %d\n", 46 dev_dbg(be->dev, "ASoC: BE %s event %d dir %d\n",
47 be->dai_link->name, event, dir); 47 be->dai_link->name, event, dir);
48 48
49 snd_soc_dapm_stream_event(be, dir, event); 49 snd_soc_dapm_stream_event(be, dir, event);
@@ -70,18 +70,19 @@ static int soc_pcm_apply_symmetry(struct snd_pcm_substream *substream,
70 */ 70 */
71 if (!soc_dai->rate) { 71 if (!soc_dai->rate) {
72 dev_warn(soc_dai->dev, 72 dev_warn(soc_dai->dev,
73 "Not enforcing symmetric_rates due to race\n"); 73 "ASoC: Not enforcing symmetric_rates due to race\n");
74 return 0; 74 return 0;
75 } 75 }
76 76
77 dev_dbg(soc_dai->dev, "Symmetry forces %dHz rate\n", soc_dai->rate); 77 dev_dbg(soc_dai->dev, "ASoC: Symmetry forces %dHz rate\n", soc_dai->rate);
78 78
79 ret = snd_pcm_hw_constraint_minmax(substream->runtime, 79 ret = snd_pcm_hw_constraint_minmax(substream->runtime,
80 SNDRV_PCM_HW_PARAM_RATE, 80 SNDRV_PCM_HW_PARAM_RATE,
81 soc_dai->rate, soc_dai->rate); 81 soc_dai->rate, soc_dai->rate);
82 if (ret < 0) { 82 if (ret < 0) {
83 dev_err(soc_dai->dev, 83 dev_err(soc_dai->dev,
84 "Unable to apply rate symmetry constraint: %d\n", ret); 84 "ASoC: Unable to apply rate symmetry constraint: %d\n",
85 ret);
85 return ret; 86 return ret;
86 } 87 }
87 88
@@ -118,7 +119,7 @@ static void soc_pcm_apply_msb(struct snd_pcm_substream *substream,
118 sample_sizes[i], bits); 119 sample_sizes[i], bits);
119 if (ret != 0) 120 if (ret != 0)
120 dev_warn(dai->dev, 121 dev_warn(dai->dev,
121 "Failed to set MSB %d/%d: %d\n", 122 "ASoC: Failed to set MSB %d/%d: %d\n",
122 bits, sample_sizes[i], ret); 123 bits, sample_sizes[i], ret);
123 } 124 }
124} 125}
@@ -149,8 +150,8 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
149 if (cpu_dai->driver->ops->startup) { 150 if (cpu_dai->driver->ops->startup) {
150 ret = cpu_dai->driver->ops->startup(substream, cpu_dai); 151 ret = cpu_dai->driver->ops->startup(substream, cpu_dai);
151 if (ret < 0) { 152 if (ret < 0) {
152 dev_err(cpu_dai->dev, "can't open interface %s: %d\n", 153 dev_err(cpu_dai->dev, "ASoC: can't open interface"
153 cpu_dai->name, ret); 154 " %s: %d\n", cpu_dai->name, ret);
154 goto out; 155 goto out;
155 } 156 }
156 } 157 }
@@ -158,8 +159,8 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
158 if (platform->driver->ops && platform->driver->ops->open) { 159 if (platform->driver->ops && platform->driver->ops->open) {
159 ret = platform->driver->ops->open(substream); 160 ret = platform->driver->ops->open(substream);
160 if (ret < 0) { 161 if (ret < 0) {
161 dev_err(platform->dev, "can't open platform %s: %d\n", 162 dev_err(platform->dev, "ASoC: can't open platform"
162 platform->name, ret); 163 " %s: %d\n", platform->name, ret);
163 goto platform_err; 164 goto platform_err;
164 } 165 }
165 } 166 }
@@ -167,8 +168,8 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
167 if (codec_dai->driver->ops->startup) { 168 if (codec_dai->driver->ops->startup) {
168 ret = codec_dai->driver->ops->startup(substream, codec_dai); 169 ret = codec_dai->driver->ops->startup(substream, codec_dai);
169 if (ret < 0) { 170 if (ret < 0) {
170 dev_err(codec_dai->dev, "can't open codec %s: %d\n", 171 dev_err(codec_dai->dev, "ASoC: can't open codec"
171 codec_dai->name, ret); 172 " %s: %d\n", codec_dai->name, ret);
172 goto codec_dai_err; 173 goto codec_dai_err;
173 } 174 }
174 } 175 }
@@ -176,7 +177,7 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
176 if (rtd->dai_link->ops && rtd->dai_link->ops->startup) { 177 if (rtd->dai_link->ops && rtd->dai_link->ops->startup) {
177 ret = rtd->dai_link->ops->startup(substream); 178 ret = rtd->dai_link->ops->startup(substream);
178 if (ret < 0) { 179 if (ret < 0) {
179 pr_err("asoc: %s startup failed: %d\n", 180 pr_err("ASoC: %s startup failed: %d\n",
180 rtd->dai_link->name, ret); 181 rtd->dai_link->name, ret);
181 goto machine_err; 182 goto machine_err;
182 } 183 }
@@ -238,18 +239,18 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
238 ret = -EINVAL; 239 ret = -EINVAL;
239 snd_pcm_limit_hw_rates(runtime); 240 snd_pcm_limit_hw_rates(runtime);
240 if (!runtime->hw.rates) { 241 if (!runtime->hw.rates) {
241 printk(KERN_ERR "asoc: %s <-> %s No matching rates\n", 242 printk(KERN_ERR "ASoC: %s <-> %s No matching rates\n",
242 codec_dai->name, cpu_dai->name); 243 codec_dai->name, cpu_dai->name);
243 goto config_err; 244 goto config_err;
244 } 245 }
245 if (!runtime->hw.formats) { 246 if (!runtime->hw.formats) {
246 printk(KERN_ERR "asoc: %s <-> %s No matching formats\n", 247 printk(KERN_ERR "ASoC: %s <-> %s No matching formats\n",
247 codec_dai->name, cpu_dai->name); 248 codec_dai->name, cpu_dai->name);
248 goto config_err; 249 goto config_err;
249 } 250 }
250 if (!runtime->hw.channels_min || !runtime->hw.channels_max || 251 if (!runtime->hw.channels_min || !runtime->hw.channels_max ||
251 runtime->hw.channels_min > runtime->hw.channels_max) { 252 runtime->hw.channels_min > runtime->hw.channels_max) {
252 printk(KERN_ERR "asoc: %s <-> %s No matching channels\n", 253 printk(KERN_ERR "ASoC: %s <-> %s No matching channels\n",
253 codec_dai->name, cpu_dai->name); 254 codec_dai->name, cpu_dai->name);
254 goto config_err; 255 goto config_err;
255 } 256 }
@@ -270,12 +271,12 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
270 goto config_err; 271 goto config_err;
271 } 272 }
272 273
273 pr_debug("asoc: %s <-> %s info:\n", 274 pr_debug("ASoC: %s <-> %s info:\n",
274 codec_dai->name, cpu_dai->name); 275 codec_dai->name, cpu_dai->name);
275 pr_debug("asoc: rate mask 0x%x\n", runtime->hw.rates); 276 pr_debug("ASoC: rate mask 0x%x\n", runtime->hw.rates);
276 pr_debug("asoc: min ch %d max ch %d\n", runtime->hw.channels_min, 277 pr_debug("ASoC: min ch %d max ch %d\n", runtime->hw.channels_min,
277 runtime->hw.channels_max); 278 runtime->hw.channels_max);
278 pr_debug("asoc: min rate %d max rate %d\n", runtime->hw.rate_min, 279 pr_debug("ASoC: min rate %d max rate %d\n", runtime->hw.rate_min,
279 runtime->hw.rate_max); 280 runtime->hw.rate_max);
280 281
281dynamic: 282dynamic:
@@ -330,7 +331,7 @@ static void close_delayed_work(struct work_struct *work)
330 331
331 mutex_lock_nested(&rtd->pcm_mutex, rtd->pcm_subclass); 332 mutex_lock_nested(&rtd->pcm_mutex, rtd->pcm_subclass);
332 333
333 pr_debug("pop wq checking: %s status: %s waiting: %s\n", 334 dev_dbg(rtd->dev, "ASoC: pop wq checking: %s status: %s waiting: %s\n",
334 codec_dai->driver->playback.stream_name, 335 codec_dai->driver->playback.stream_name,
335 codec_dai->playback_active ? "active" : "inactive", 336 codec_dai->playback_active ? "active" : "inactive",
336 codec_dai->pop_wait ? "yes" : "no"); 337 codec_dai->pop_wait ? "yes" : "no");
@@ -444,7 +445,8 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream)
444 if (rtd->dai_link->ops && rtd->dai_link->ops->prepare) { 445 if (rtd->dai_link->ops && rtd->dai_link->ops->prepare) {
445 ret = rtd->dai_link->ops->prepare(substream); 446 ret = rtd->dai_link->ops->prepare(substream);
446 if (ret < 0) { 447 if (ret < 0) {
447 pr_err("asoc: machine prepare error: %d\n", ret); 448 dev_err(rtd->card->dev, "ASoC: machine prepare error:"
449 " %d\n", ret);
448 goto out; 450 goto out;
449 } 451 }
450 } 452 }
@@ -452,8 +454,8 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream)
452 if (platform->driver->ops && platform->driver->ops->prepare) { 454 if (platform->driver->ops && platform->driver->ops->prepare) {
453 ret = platform->driver->ops->prepare(substream); 455 ret = platform->driver->ops->prepare(substream);
454 if (ret < 0) { 456 if (ret < 0) {
455 dev_err(platform->dev, "platform prepare error: %d\n", 457 dev_err(platform->dev, "ASoC: platform prepare error:"
456 ret); 458 " %d\n", ret);
457 goto out; 459 goto out;
458 } 460 }
459 } 461 }
@@ -461,7 +463,7 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream)
461 if (codec_dai->driver->ops->prepare) { 463 if (codec_dai->driver->ops->prepare) {
462 ret = codec_dai->driver->ops->prepare(substream, codec_dai); 464 ret = codec_dai->driver->ops->prepare(substream, codec_dai);
463 if (ret < 0) { 465 if (ret < 0) {
464 dev_err(codec_dai->dev, "DAI prepare error: %d\n", 466 dev_err(codec_dai->dev, "ASoC: DAI prepare error: %d\n",
465 ret); 467 ret);
466 goto out; 468 goto out;
467 } 469 }
@@ -470,7 +472,7 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream)
470 if (cpu_dai->driver->ops->prepare) { 472 if (cpu_dai->driver->ops->prepare) {
471 ret = cpu_dai->driver->ops->prepare(substream, cpu_dai); 473 ret = cpu_dai->driver->ops->prepare(substream, cpu_dai);
472 if (ret < 0) { 474 if (ret < 0) {
473 dev_err(cpu_dai->dev, "DAI prepare error: %d\n", 475 dev_err(cpu_dai->dev, "ASoC: DAI prepare error: %d\n",
474 ret); 476 ret);
475 goto out; 477 goto out;
476 } 478 }
@@ -512,7 +514,8 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream,
512 if (rtd->dai_link->ops && rtd->dai_link->ops->hw_params) { 514 if (rtd->dai_link->ops && rtd->dai_link->ops->hw_params) {
513 ret = rtd->dai_link->ops->hw_params(substream, params); 515 ret = rtd->dai_link->ops->hw_params(substream, params);
514 if (ret < 0) { 516 if (ret < 0) {
515 pr_err("asoc: machine hw_params failed: %d\n", ret); 517 dev_err(rtd->card->dev, "ASoC: machine hw_params"
518 " failed: %d\n", ret);
516 goto out; 519 goto out;
517 } 520 }
518 } 521 }
@@ -520,8 +523,8 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream,
520 if (codec_dai->driver->ops->hw_params) { 523 if (codec_dai->driver->ops->hw_params) {
521 ret = codec_dai->driver->ops->hw_params(substream, params, codec_dai); 524 ret = codec_dai->driver->ops->hw_params(substream, params, codec_dai);
522 if (ret < 0) { 525 if (ret < 0) {
523 dev_err(codec_dai->dev, "can't set %s hw params: %d\n", 526 dev_err(codec_dai->dev, "ASoC: can't set %s hw params:"
524 codec_dai->name, ret); 527 " %d\n", codec_dai->name, ret);
525 goto codec_err; 528 goto codec_err;
526 } 529 }
527 } 530 }
@@ -529,7 +532,7 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream,
529 if (cpu_dai->driver->ops->hw_params) { 532 if (cpu_dai->driver->ops->hw_params) {
530 ret = cpu_dai->driver->ops->hw_params(substream, params, cpu_dai); 533 ret = cpu_dai->driver->ops->hw_params(substream, params, cpu_dai);
531 if (ret < 0) { 534 if (ret < 0) {
532 dev_err(cpu_dai->dev, "%s hw params failed: %d\n", 535 dev_err(cpu_dai->dev, "ASoC: %s hw params failed: %d\n",
533 cpu_dai->name, ret); 536 cpu_dai->name, ret);
534 goto interface_err; 537 goto interface_err;
535 } 538 }
@@ -538,7 +541,7 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream,
538 if (platform->driver->ops && platform->driver->ops->hw_params) { 541 if (platform->driver->ops && platform->driver->ops->hw_params) {
539 ret = platform->driver->ops->hw_params(substream, params); 542 ret = platform->driver->ops->hw_params(substream, params);
540 if (ret < 0) { 543 if (ret < 0) {
541 dev_err(platform->dev, "%s hw params failed: %d\n", 544 dev_err(platform->dev, "ASoC: %s hw params failed: %d\n",
542 platform->name, ret); 545 platform->name, ret);
543 goto platform_err; 546 goto platform_err;
544 } 547 }
@@ -760,7 +763,7 @@ static void dpcm_be_disconnect(struct snd_soc_pcm_runtime *fe, int stream)
760 struct snd_soc_dpcm *dpcm, *d; 763 struct snd_soc_dpcm *dpcm, *d;
761 764
762 list_for_each_entry_safe(dpcm, d, &fe->dpcm[stream].be_clients, list_be) { 765 list_for_each_entry_safe(dpcm, d, &fe->dpcm[stream].be_clients, list_be) {
763 dev_dbg(fe->dev, "BE %s disconnect check for %s\n", 766 dev_dbg(fe->dev, "ASoC: BE %s disconnect check for %s\n",
764 stream ? "capture" : "playback", 767 stream ? "capture" : "playback",
765 dpcm->be->dai_link->name); 768 dpcm->be->dai_link->name);
766 769
@@ -815,7 +818,7 @@ static struct snd_soc_pcm_runtime *dpcm_get_be(struct snd_soc_card *card,
815 } 818 }
816 } 819 }
817 820
818 dev_err(card->dev, "can't get %s BE for %s\n", 821 dev_err(card->dev, "ASoC: can't get %s BE for %s\n",
819 stream ? "capture" : "playback", widget->name); 822 stream ? "capture" : "playback", widget->name);
820 return NULL; 823 return NULL;
821} 824}
@@ -866,7 +869,7 @@ static int dpcm_path_get(struct snd_soc_pcm_runtime *fe,
866 /* get number of valid DAI paths and their widgets */ 869 /* get number of valid DAI paths and their widgets */
867 paths = snd_soc_dapm_dai_get_connected_widgets(cpu_dai, stream, &list); 870 paths = snd_soc_dapm_dai_get_connected_widgets(cpu_dai, stream, &list);
868 871
869 dev_dbg(fe->dev, "found %d audio %s paths\n", paths, 872 dev_dbg(fe->dev, "ASoC: found %d audio %s paths\n", paths,
870 stream ? "capture" : "playback"); 873 stream ? "capture" : "playback");
871 874
872 *list_ = list; 875 *list_ = list;
@@ -903,7 +906,7 @@ static int dpcm_prune_paths(struct snd_soc_pcm_runtime *fe, int stream,
903 if (widget && widget_in_list(list, widget)) 906 if (widget && widget_in_list(list, widget))
904 continue; 907 continue;
905 908
906 dev_dbg(fe->dev, "pruning %s BE %s for %s\n", 909 dev_dbg(fe->dev, "ASoC: pruning %s BE %s for %s\n",
907 stream ? "capture" : "playback", 910 stream ? "capture" : "playback",
908 dpcm->be->dai_link->name, fe->dai_link->name); 911 dpcm->be->dai_link->name, fe->dai_link->name);
909 dpcm->state = SND_SOC_DPCM_LINK_STATE_FREE; 912 dpcm->state = SND_SOC_DPCM_LINK_STATE_FREE;
@@ -911,7 +914,7 @@ static int dpcm_prune_paths(struct snd_soc_pcm_runtime *fe, int stream,
911 prune++; 914 prune++;
912 } 915 }
913 916
914 dev_dbg(fe->dev, "found %d old BE paths for pruning\n", prune); 917 dev_dbg(fe->dev, "ASoC: found %d old BE paths for pruning\n", prune);
915 return prune; 918 return prune;
916} 919}
917 920
@@ -932,7 +935,7 @@ static int dpcm_add_paths(struct snd_soc_pcm_runtime *fe, int stream,
932 /* is there a valid BE rtd for this widget */ 935 /* is there a valid BE rtd for this widget */
933 be = dpcm_get_be(card, list->widgets[i], stream); 936 be = dpcm_get_be(card, list->widgets[i], stream);
934 if (!be) { 937 if (!be) {
935 dev_err(fe->dev, "no BE found for %s\n", 938 dev_err(fe->dev, "ASoC: no BE found for %s\n",
936 list->widgets[i]->name); 939 list->widgets[i]->name);
937 continue; 940 continue;
938 } 941 }
@@ -948,7 +951,7 @@ static int dpcm_add_paths(struct snd_soc_pcm_runtime *fe, int stream,
948 /* newly connected FE and BE */ 951 /* newly connected FE and BE */
949 err = dpcm_be_connect(fe, be, stream); 952 err = dpcm_be_connect(fe, be, stream);
950 if (err < 0) { 953 if (err < 0) {
951 dev_err(fe->dev, "can't connect %s\n", 954 dev_err(fe->dev, "ASoC: can't connect %s\n",
952 list->widgets[i]->name); 955 list->widgets[i]->name);
953 break; 956 break;
954 } else if (err == 0) /* already connected */ 957 } else if (err == 0) /* already connected */
@@ -959,7 +962,7 @@ static int dpcm_add_paths(struct snd_soc_pcm_runtime *fe, int stream,
959 new++; 962 new++;
960 } 963 }
961 964
962 dev_dbg(fe->dev, "found %d new BE paths\n", new); 965 dev_dbg(fe->dev, "ASoC: found %d new BE paths\n", new);
963 return new; 966 return new;
964} 967}
965 968
@@ -998,7 +1001,7 @@ static void dpcm_be_dai_startup_unwind(struct snd_soc_pcm_runtime *fe,
998 snd_soc_dpcm_get_substream(be, stream); 1001 snd_soc_dpcm_get_substream(be, stream);
999 1002
1000 if (be->dpcm[stream].users == 0) 1003 if (be->dpcm[stream].users == 0)
1001 dev_err(be->dev, "no users %s at close - state %d\n", 1004 dev_err(be->dev, "ASoC: no users %s at close - state %d\n",
1002 stream ? "capture" : "playback", 1005 stream ? "capture" : "playback",
1003 be->dpcm[stream].state); 1006 be->dpcm[stream].state);
1004 1007
@@ -1032,7 +1035,7 @@ static int dpcm_be_dai_startup(struct snd_soc_pcm_runtime *fe, int stream)
1032 1035
1033 /* first time the dpcm is open ? */ 1036 /* first time the dpcm is open ? */
1034 if (be->dpcm[stream].users == DPCM_MAX_BE_USERS) 1037 if (be->dpcm[stream].users == DPCM_MAX_BE_USERS)
1035 dev_err(be->dev, "too many users %s at open %d\n", 1038 dev_err(be->dev, "ASoC: too many users %s at open %d\n",
1036 stream ? "capture" : "playback", 1039 stream ? "capture" : "playback",
1037 be->dpcm[stream].state); 1040 be->dpcm[stream].state);
1038 1041
@@ -1043,15 +1046,15 @@ static int dpcm_be_dai_startup(struct snd_soc_pcm_runtime *fe, int stream)
1043 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_CLOSE)) 1046 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_CLOSE))
1044 continue; 1047 continue;
1045 1048
1046 dev_dbg(be->dev, "dpcm: open BE %s\n", be->dai_link->name); 1049 dev_dbg(be->dev, "ASoC: open BE %s\n", be->dai_link->name);
1047 1050
1048 be_substream->runtime = be->dpcm[stream].runtime; 1051 be_substream->runtime = be->dpcm[stream].runtime;
1049 err = soc_pcm_open(be_substream); 1052 err = soc_pcm_open(be_substream);
1050 if (err < 0) { 1053 if (err < 0) {
1051 dev_err(be->dev, "BE open failed %d\n", err); 1054 dev_err(be->dev, "ASoC: BE open failed %d\n", err);
1052 be->dpcm[stream].users--; 1055 be->dpcm[stream].users--;
1053 if (be->dpcm[stream].users < 0) 1056 if (be->dpcm[stream].users < 0)
1054 dev_err(be->dev, "no users %s at unwind %d\n", 1057 dev_err(be->dev, "ASoC: no users %s at unwind %d\n",
1055 stream ? "capture" : "playback", 1058 stream ? "capture" : "playback",
1056 be->dpcm[stream].state); 1059 be->dpcm[stream].state);
1057 1060
@@ -1076,7 +1079,7 @@ unwind:
1076 continue; 1079 continue;
1077 1080
1078 if (be->dpcm[stream].users == 0) 1081 if (be->dpcm[stream].users == 0)
1079 dev_err(be->dev, "no users %s at close %d\n", 1082 dev_err(be->dev, "ASoC: no users %s at close %d\n",
1080 stream ? "capture" : "playback", 1083 stream ? "capture" : "playback",
1081 be->dpcm[stream].state); 1084 be->dpcm[stream].state);
1082 1085
@@ -1128,16 +1131,16 @@ static int dpcm_fe_dai_startup(struct snd_pcm_substream *fe_substream)
1128 1131
1129 ret = dpcm_be_dai_startup(fe, fe_substream->stream); 1132 ret = dpcm_be_dai_startup(fe, fe_substream->stream);
1130 if (ret < 0) { 1133 if (ret < 0) {
1131 dev_err(fe->dev,"dpcm: failed to start some BEs %d\n", ret); 1134 dev_err(fe->dev,"ASoC: failed to start some BEs %d\n", ret);
1132 goto be_err; 1135 goto be_err;
1133 } 1136 }
1134 1137
1135 dev_dbg(fe->dev, "dpcm: open FE %s\n", fe->dai_link->name); 1138 dev_dbg(fe->dev, "ASoC: open FE %s\n", fe->dai_link->name);
1136 1139
1137 /* start the DAI frontend */ 1140 /* start the DAI frontend */
1138 ret = soc_pcm_open(fe_substream); 1141 ret = soc_pcm_open(fe_substream);
1139 if (ret < 0) { 1142 if (ret < 0) {
1140 dev_err(fe->dev,"dpcm: failed to start FE %d\n", ret); 1143 dev_err(fe->dev,"ASoC: failed to start FE %d\n", ret);
1141 goto unwind; 1144 goto unwind;
1142 } 1145 }
1143 1146
@@ -1172,7 +1175,7 @@ static int dpcm_be_dai_shutdown(struct snd_soc_pcm_runtime *fe, int stream)
1172 continue; 1175 continue;
1173 1176
1174 if (be->dpcm[stream].users == 0) 1177 if (be->dpcm[stream].users == 0)
1175 dev_err(be->dev, "no users %s at close - state %d\n", 1178 dev_err(be->dev, "ASoC: no users %s at close - state %d\n",
1176 stream ? "capture" : "playback", 1179 stream ? "capture" : "playback",
1177 be->dpcm[stream].state); 1180 be->dpcm[stream].state);
1178 1181
@@ -1183,7 +1186,7 @@ static int dpcm_be_dai_shutdown(struct snd_soc_pcm_runtime *fe, int stream)
1183 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN)) 1186 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_OPEN))
1184 continue; 1187 continue;
1185 1188
1186 dev_dbg(be->dev, "dpcm: close BE %s\n", 1189 dev_dbg(be->dev, "ASoC: close BE %s\n",
1187 dpcm->fe->dai_link->name); 1190 dpcm->fe->dai_link->name);
1188 1191
1189 soc_pcm_close(be_substream); 1192 soc_pcm_close(be_substream);
@@ -1204,7 +1207,7 @@ static int dpcm_fe_dai_shutdown(struct snd_pcm_substream *substream)
1204 /* shutdown the BEs */ 1207 /* shutdown the BEs */
1205 dpcm_be_dai_shutdown(fe, substream->stream); 1208 dpcm_be_dai_shutdown(fe, substream->stream);
1206 1209
1207 dev_dbg(fe->dev, "dpcm: close FE %s\n", fe->dai_link->name); 1210 dev_dbg(fe->dev, "ASoC: close FE %s\n", fe->dai_link->name);
1208 1211
1209 /* now shutdown the frontend */ 1212 /* now shutdown the frontend */
1210 soc_pcm_close(substream); 1213 soc_pcm_close(substream);
@@ -1243,7 +1246,7 @@ static int dpcm_be_dai_hw_free(struct snd_soc_pcm_runtime *fe, int stream)
1243 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP)) 1246 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP))
1244 continue; 1247 continue;
1245 1248
1246 dev_dbg(be->dev, "dpcm: hw_free BE %s\n", 1249 dev_dbg(be->dev, "ASoC: hw_free BE %s\n",
1247 dpcm->fe->dai_link->name); 1250 dpcm->fe->dai_link->name);
1248 1251
1249 soc_pcm_hw_free(be_substream); 1252 soc_pcm_hw_free(be_substream);
@@ -1262,12 +1265,12 @@ static int dpcm_fe_dai_hw_free(struct snd_pcm_substream *substream)
1262 mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME); 1265 mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME);
1263 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE; 1266 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE;
1264 1267
1265 dev_dbg(fe->dev, "dpcm: hw_free FE %s\n", fe->dai_link->name); 1268 dev_dbg(fe->dev, "ASoC: hw_free FE %s\n", fe->dai_link->name);
1266 1269
1267 /* call hw_free on the frontend */ 1270 /* call hw_free on the frontend */
1268 err = soc_pcm_hw_free(substream); 1271 err = soc_pcm_hw_free(substream);
1269 if (err < 0) 1272 if (err < 0)
1270 dev_err(fe->dev,"dpcm: hw_free FE %s failed\n", 1273 dev_err(fe->dev,"ASoC: hw_free FE %s failed\n",
1271 fe->dai_link->name); 1274 fe->dai_link->name);
1272 1275
1273 /* only hw_params backends that are either sinks or sources 1276 /* only hw_params backends that are either sinks or sources
@@ -1305,7 +1308,7 @@ static int dpcm_be_dai_hw_params(struct snd_soc_pcm_runtime *fe, int stream)
1305 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE)) 1308 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_HW_FREE))
1306 continue; 1309 continue;
1307 1310
1308 dev_dbg(be->dev, "dpcm: hw_params BE %s\n", 1311 dev_dbg(be->dev, "ASoC: hw_params BE %s\n",
1309 dpcm->fe->dai_link->name); 1312 dpcm->fe->dai_link->name);
1310 1313
1311 /* copy params for each dpcm */ 1314 /* copy params for each dpcm */
@@ -1318,7 +1321,7 @@ static int dpcm_be_dai_hw_params(struct snd_soc_pcm_runtime *fe, int stream)
1318 &dpcm->hw_params); 1321 &dpcm->hw_params);
1319 if (ret < 0) { 1322 if (ret < 0) {
1320 dev_err(be->dev, 1323 dev_err(be->dev,
1321 "dpcm: hw_params BE fixup failed %d\n", 1324 "ASoC: hw_params BE fixup failed %d\n",
1322 ret); 1325 ret);
1323 goto unwind; 1326 goto unwind;
1324 } 1327 }
@@ -1327,7 +1330,7 @@ static int dpcm_be_dai_hw_params(struct snd_soc_pcm_runtime *fe, int stream)
1327 ret = soc_pcm_hw_params(be_substream, &dpcm->hw_params); 1330 ret = soc_pcm_hw_params(be_substream, &dpcm->hw_params);
1328 if (ret < 0) { 1331 if (ret < 0) {
1329 dev_err(dpcm->be->dev, 1332 dev_err(dpcm->be->dev,
1330 "dpcm: hw_params BE failed %d\n", ret); 1333 "ASoC: hw_params BE failed %d\n", ret);
1331 goto unwind; 1334 goto unwind;
1332 } 1335 }
1333 1336
@@ -1374,18 +1377,18 @@ static int dpcm_fe_dai_hw_params(struct snd_pcm_substream *substream,
1374 sizeof(struct snd_pcm_hw_params)); 1377 sizeof(struct snd_pcm_hw_params));
1375 ret = dpcm_be_dai_hw_params(fe, substream->stream); 1378 ret = dpcm_be_dai_hw_params(fe, substream->stream);
1376 if (ret < 0) { 1379 if (ret < 0) {
1377 dev_err(fe->dev,"dpcm: hw_params BE failed %d\n", ret); 1380 dev_err(fe->dev,"ASoC: hw_params BE failed %d\n", ret);
1378 goto out; 1381 goto out;
1379 } 1382 }
1380 1383
1381 dev_dbg(fe->dev, "dpcm: hw_params FE %s rate %d chan %x fmt %d\n", 1384 dev_dbg(fe->dev, "ASoC: hw_params FE %s rate %d chan %x fmt %d\n",
1382 fe->dai_link->name, params_rate(params), 1385 fe->dai_link->name, params_rate(params),
1383 params_channels(params), params_format(params)); 1386 params_channels(params), params_format(params));
1384 1387
1385 /* call hw_params on the frontend */ 1388 /* call hw_params on the frontend */
1386 ret = soc_pcm_hw_params(substream, params); 1389 ret = soc_pcm_hw_params(substream, params);
1387 if (ret < 0) { 1390 if (ret < 0) {
1388 dev_err(fe->dev,"dpcm: hw_params FE failed %d\n", ret); 1391 dev_err(fe->dev,"ASoC: hw_params FE failed %d\n", ret);
1389 dpcm_be_dai_hw_free(fe, stream); 1392 dpcm_be_dai_hw_free(fe, stream);
1390 } else 1393 } else
1391 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_PARAMS; 1394 fe->dpcm[stream].state = SND_SOC_DPCM_STATE_HW_PARAMS;
@@ -1401,12 +1404,12 @@ static int dpcm_do_trigger(struct snd_soc_dpcm *dpcm,
1401{ 1404{
1402 int ret; 1405 int ret;
1403 1406
1404 dev_dbg(dpcm->be->dev, "dpcm: trigger BE %s cmd %d\n", 1407 dev_dbg(dpcm->be->dev, "ASoC: trigger BE %s cmd %d\n",
1405 dpcm->fe->dai_link->name, cmd); 1408 dpcm->fe->dai_link->name, cmd);
1406 1409
1407 ret = soc_pcm_trigger(substream, cmd); 1410 ret = soc_pcm_trigger(substream, cmd);
1408 if (ret < 0) 1411 if (ret < 0)
1409 dev_err(dpcm->be->dev,"dpcm: trigger BE failed %d\n", ret); 1412 dev_err(dpcm->be->dev,"ASoC: trigger BE failed %d\n", ret);
1410 1413
1411 return ret; 1414 return ret;
1412} 1415}
@@ -1517,12 +1520,12 @@ static int dpcm_fe_dai_trigger(struct snd_pcm_substream *substream, int cmd)
1517 case SND_SOC_DPCM_TRIGGER_PRE: 1520 case SND_SOC_DPCM_TRIGGER_PRE:
1518 /* call trigger on the frontend before the backend. */ 1521 /* call trigger on the frontend before the backend. */
1519 1522
1520 dev_dbg(fe->dev, "dpcm: pre trigger FE %s cmd %d\n", 1523 dev_dbg(fe->dev, "ASoC: pre trigger FE %s cmd %d\n",
1521 fe->dai_link->name, cmd); 1524 fe->dai_link->name, cmd);
1522 1525
1523 ret = soc_pcm_trigger(substream, cmd); 1526 ret = soc_pcm_trigger(substream, cmd);
1524 if (ret < 0) { 1527 if (ret < 0) {
1525 dev_err(fe->dev,"dpcm: trigger FE failed %d\n", ret); 1528 dev_err(fe->dev,"ASoC: trigger FE failed %d\n", ret);
1526 goto out; 1529 goto out;
1527 } 1530 }
1528 1531
@@ -1533,11 +1536,11 @@ static int dpcm_fe_dai_trigger(struct snd_pcm_substream *substream, int cmd)
1533 1536
1534 ret = dpcm_be_dai_trigger(fe, substream->stream, cmd); 1537 ret = dpcm_be_dai_trigger(fe, substream->stream, cmd);
1535 if (ret < 0) { 1538 if (ret < 0) {
1536 dev_err(fe->dev,"dpcm: trigger FE failed %d\n", ret); 1539 dev_err(fe->dev,"ASoC: trigger FE failed %d\n", ret);
1537 goto out; 1540 goto out;
1538 } 1541 }
1539 1542
1540 dev_dbg(fe->dev, "dpcm: post trigger FE %s cmd %d\n", 1543 dev_dbg(fe->dev, "ASoC: post trigger FE %s cmd %d\n",
1541 fe->dai_link->name, cmd); 1544 fe->dai_link->name, cmd);
1542 1545
1543 ret = soc_pcm_trigger(substream, cmd); 1546 ret = soc_pcm_trigger(substream, cmd);
@@ -1545,17 +1548,17 @@ static int dpcm_fe_dai_trigger(struct snd_pcm_substream *substream, int cmd)
1545 case SND_SOC_DPCM_TRIGGER_BESPOKE: 1548 case SND_SOC_DPCM_TRIGGER_BESPOKE:
1546 /* bespoke trigger() - handles both FE and BEs */ 1549 /* bespoke trigger() - handles both FE and BEs */
1547 1550
1548 dev_dbg(fe->dev, "dpcm: bespoke trigger FE %s cmd %d\n", 1551 dev_dbg(fe->dev, "ASoC: bespoke trigger FE %s cmd %d\n",
1549 fe->dai_link->name, cmd); 1552 fe->dai_link->name, cmd);
1550 1553
1551 ret = soc_pcm_bespoke_trigger(substream, cmd); 1554 ret = soc_pcm_bespoke_trigger(substream, cmd);
1552 if (ret < 0) { 1555 if (ret < 0) {
1553 dev_err(fe->dev,"dpcm: trigger FE failed %d\n", ret); 1556 dev_err(fe->dev,"ASoC: trigger FE failed %d\n", ret);
1554 goto out; 1557 goto out;
1555 } 1558 }
1556 break; 1559 break;
1557 default: 1560 default:
1558 dev_err(fe->dev, "dpcm: invalid trigger cmd %d for %s\n", cmd, 1561 dev_err(fe->dev, "ASoC: invalid trigger cmd %d for %s\n", cmd,
1559 fe->dai_link->name); 1562 fe->dai_link->name);
1560 ret = -EINVAL; 1563 ret = -EINVAL;
1561 goto out; 1564 goto out;
@@ -1598,12 +1601,12 @@ static int dpcm_be_dai_prepare(struct snd_soc_pcm_runtime *fe, int stream)
1598 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP)) 1601 (be->dpcm[stream].state != SND_SOC_DPCM_STATE_STOP))
1599 continue; 1602 continue;
1600 1603
1601 dev_dbg(be->dev, "dpcm: prepare BE %s\n", 1604 dev_dbg(be->dev, "ASoC: prepare BE %s\n",
1602 dpcm->fe->dai_link->name); 1605 dpcm->fe->dai_link->name);
1603 1606
1604 ret = soc_pcm_prepare(be_substream); 1607 ret = soc_pcm_prepare(be_substream);
1605 if (ret < 0) { 1608 if (ret < 0) {
1606 dev_err(be->dev, "dpcm: backend prepare failed %d\n", 1609 dev_err(be->dev, "ASoC: backend prepare failed %d\n",
1607 ret); 1610 ret);
1608 break; 1611 break;
1609 } 1612 }
@@ -1620,13 +1623,13 @@ static int dpcm_fe_dai_prepare(struct snd_pcm_substream *substream)
1620 1623
1621 mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME); 1624 mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME);
1622 1625
1623 dev_dbg(fe->dev, "dpcm: prepare FE %s\n", fe->dai_link->name); 1626 dev_dbg(fe->dev, "ASoC: prepare FE %s\n", fe->dai_link->name);
1624 1627
1625 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE; 1628 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_FE;
1626 1629
1627 /* there is no point preparing this FE if there are no BEs */ 1630 /* there is no point preparing this FE if there are no BEs */
1628 if (list_empty(&fe->dpcm[stream].be_clients)) { 1631 if (list_empty(&fe->dpcm[stream].be_clients)) {
1629 dev_err(fe->dev, "dpcm: no backend DAIs enabled for %s\n", 1632 dev_err(fe->dev, "ASoC: no backend DAIs enabled for %s\n",
1630 fe->dai_link->name); 1633 fe->dai_link->name);
1631 ret = -EINVAL; 1634 ret = -EINVAL;
1632 goto out; 1635 goto out;
@@ -1639,7 +1642,7 @@ static int dpcm_fe_dai_prepare(struct snd_pcm_substream *substream)
1639 /* call prepare on the frontend */ 1642 /* call prepare on the frontend */
1640 ret = soc_pcm_prepare(substream); 1643 ret = soc_pcm_prepare(substream);
1641 if (ret < 0) { 1644 if (ret < 0) {
1642 dev_err(fe->dev,"dpcm: prepare FE %s failed\n", 1645 dev_err(fe->dev,"ASoC: prepare FE %s failed\n",
1643 fe->dai_link->name); 1646 fe->dai_link->name);
1644 goto out; 1647 goto out;
1645 } 1648 }
@@ -1673,33 +1676,33 @@ static int dpcm_run_update_shutdown(struct snd_soc_pcm_runtime *fe, int stream)
1673 enum snd_soc_dpcm_trigger trigger = fe->dai_link->trigger[stream]; 1676 enum snd_soc_dpcm_trigger trigger = fe->dai_link->trigger[stream];
1674 int err; 1677 int err;
1675 1678
1676 dev_dbg(fe->dev, "runtime %s close on FE %s\n", 1679 dev_dbg(fe->dev, "ASoC: runtime %s close on FE %s\n",
1677 stream ? "capture" : "playback", fe->dai_link->name); 1680 stream ? "capture" : "playback", fe->dai_link->name);
1678 1681
1679 if (trigger == SND_SOC_DPCM_TRIGGER_BESPOKE) { 1682 if (trigger == SND_SOC_DPCM_TRIGGER_BESPOKE) {
1680 /* call bespoke trigger - FE takes care of all BE triggers */ 1683 /* call bespoke trigger - FE takes care of all BE triggers */
1681 dev_dbg(fe->dev, "dpcm: bespoke trigger FE %s cmd stop\n", 1684 dev_dbg(fe->dev, "ASoC: bespoke trigger FE %s cmd stop\n",
1682 fe->dai_link->name); 1685 fe->dai_link->name);
1683 1686
1684 err = soc_pcm_bespoke_trigger(substream, SNDRV_PCM_TRIGGER_STOP); 1687 err = soc_pcm_bespoke_trigger(substream, SNDRV_PCM_TRIGGER_STOP);
1685 if (err < 0) 1688 if (err < 0)
1686 dev_err(fe->dev,"dpcm: trigger FE failed %d\n", err); 1689 dev_err(fe->dev,"ASoC: trigger FE failed %d\n", err);
1687 } else { 1690 } else {
1688 dev_dbg(fe->dev, "dpcm: trigger FE %s cmd stop\n", 1691 dev_dbg(fe->dev, "ASoC: trigger FE %s cmd stop\n",
1689 fe->dai_link->name); 1692 fe->dai_link->name);
1690 1693
1691 err = dpcm_be_dai_trigger(fe, stream, SNDRV_PCM_TRIGGER_STOP); 1694 err = dpcm_be_dai_trigger(fe, stream, SNDRV_PCM_TRIGGER_STOP);
1692 if (err < 0) 1695 if (err < 0)
1693 dev_err(fe->dev,"dpcm: trigger FE failed %d\n", err); 1696 dev_err(fe->dev,"ASoC: trigger FE failed %d\n", err);
1694 } 1697 }
1695 1698
1696 err = dpcm_be_dai_hw_free(fe, stream); 1699 err = dpcm_be_dai_hw_free(fe, stream);
1697 if (err < 0) 1700 if (err < 0)
1698 dev_err(fe->dev,"dpcm: hw_free FE failed %d\n", err); 1701 dev_err(fe->dev,"ASoC: hw_free FE failed %d\n", err);
1699 1702
1700 err = dpcm_be_dai_shutdown(fe, stream); 1703 err = dpcm_be_dai_shutdown(fe, stream);
1701 if (err < 0) 1704 if (err < 0)
1702 dev_err(fe->dev,"dpcm: shutdown FE failed %d\n", err); 1705 dev_err(fe->dev,"ASoC: shutdown FE failed %d\n", err);
1703 1706
1704 /* run the stream event for each BE */ 1707 /* run the stream event for each BE */
1705 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_NOP); 1708 dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_NOP);
@@ -1715,7 +1718,7 @@ static int dpcm_run_update_startup(struct snd_soc_pcm_runtime *fe, int stream)
1715 enum snd_soc_dpcm_trigger trigger = fe->dai_link->trigger[stream]; 1718 enum snd_soc_dpcm_trigger trigger = fe->dai_link->trigger[stream];
1716 int ret; 1719 int ret;
1717 1720
1718 dev_dbg(fe->dev, "runtime %s open on FE %s\n", 1721 dev_dbg(fe->dev, "ASoC: runtime %s open on FE %s\n",
1719 stream ? "capture" : "playback", fe->dai_link->name); 1722 stream ? "capture" : "playback", fe->dai_link->name);
1720 1723
1721 /* Only start the BE if the FE is ready */ 1724 /* Only start the BE if the FE is ready */
@@ -1761,22 +1764,22 @@ static int dpcm_run_update_startup(struct snd_soc_pcm_runtime *fe, int stream)
1761 1764
1762 if (trigger == SND_SOC_DPCM_TRIGGER_BESPOKE) { 1765 if (trigger == SND_SOC_DPCM_TRIGGER_BESPOKE) {
1763 /* call trigger on the frontend - FE takes care of all BE triggers */ 1766 /* call trigger on the frontend - FE takes care of all BE triggers */
1764 dev_dbg(fe->dev, "dpcm: bespoke trigger FE %s cmd start\n", 1767 dev_dbg(fe->dev, "ASoC: bespoke trigger FE %s cmd start\n",
1765 fe->dai_link->name); 1768 fe->dai_link->name);
1766 1769
1767 ret = soc_pcm_bespoke_trigger(substream, SNDRV_PCM_TRIGGER_START); 1770 ret = soc_pcm_bespoke_trigger(substream, SNDRV_PCM_TRIGGER_START);
1768 if (ret < 0) { 1771 if (ret < 0) {
1769 dev_err(fe->dev,"dpcm: bespoke trigger FE failed %d\n", ret); 1772 dev_err(fe->dev,"ASoC: bespoke trigger FE failed %d\n", ret);
1770 goto hw_free; 1773 goto hw_free;
1771 } 1774 }
1772 } else { 1775 } else {
1773 dev_dbg(fe->dev, "dpcm: trigger FE %s cmd start\n", 1776 dev_dbg(fe->dev, "ASoC: trigger FE %s cmd start\n",
1774 fe->dai_link->name); 1777 fe->dai_link->name);
1775 1778
1776 ret = dpcm_be_dai_trigger(fe, stream, 1779 ret = dpcm_be_dai_trigger(fe, stream,
1777 SNDRV_PCM_TRIGGER_START); 1780 SNDRV_PCM_TRIGGER_START);
1778 if (ret < 0) { 1781 if (ret < 0) {
1779 dev_err(fe->dev,"dpcm: trigger FE failed %d\n", ret); 1782 dev_err(fe->dev,"ASoC: trigger FE failed %d\n", ret);
1780 goto hw_free; 1783 goto hw_free;
1781 } 1784 }
1782 } 1785 }
@@ -1805,7 +1808,7 @@ static int dpcm_run_new_update(struct snd_soc_pcm_runtime *fe, int stream)
1805 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_BE; 1808 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_BE;
1806 ret = dpcm_run_update_startup(fe, stream); 1809 ret = dpcm_run_update_startup(fe, stream);
1807 if (ret < 0) 1810 if (ret < 0)
1808 dev_err(fe->dev, "failed to startup some BEs\n"); 1811 dev_err(fe->dev, "ASoC: failed to startup some BEs\n");
1809 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; 1812 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO;
1810 1813
1811 return ret; 1814 return ret;
@@ -1818,7 +1821,7 @@ static int dpcm_run_old_update(struct snd_soc_pcm_runtime *fe, int stream)
1818 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_BE; 1821 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_BE;
1819 ret = dpcm_run_update_shutdown(fe, stream); 1822 ret = dpcm_run_update_shutdown(fe, stream);
1820 if (ret < 0) 1823 if (ret < 0)
1821 dev_err(fe->dev, "failed to shutdown some BEs\n"); 1824 dev_err(fe->dev, "ASoC: failed to shutdown some BEs\n");
1822 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO; 1825 fe->dpcm[stream].runtime_update = SND_SOC_DPCM_UPDATE_NO;
1823 1826
1824 return ret; 1827 return ret;
@@ -1853,7 +1856,7 @@ int soc_dpcm_runtime_update(struct snd_soc_dapm_widget *widget)
1853 continue; 1856 continue;
1854 1857
1855 /* DAPM sync will call this to update DSP paths */ 1858 /* DAPM sync will call this to update DSP paths */
1856 dev_dbg(fe->dev, "DPCM runtime update for FE %s\n", 1859 dev_dbg(fe->dev, "ASoC: DPCM runtime update for FE %s\n",
1857 fe->dai_link->name); 1860 fe->dai_link->name);
1858 1861
1859 /* skip if FE doesn't have playback capability */ 1862 /* skip if FE doesn't have playback capability */
@@ -1862,7 +1865,7 @@ int soc_dpcm_runtime_update(struct snd_soc_dapm_widget *widget)
1862 1865
1863 paths = dpcm_path_get(fe, SNDRV_PCM_STREAM_PLAYBACK, &list); 1866 paths = dpcm_path_get(fe, SNDRV_PCM_STREAM_PLAYBACK, &list);
1864 if (paths < 0) { 1867 if (paths < 0) {
1865 dev_warn(fe->dev, "%s no valid %s path\n", 1868 dev_warn(fe->dev, "ASoC: %s no valid %s path\n",
1866 fe->dai_link->name, "playback"); 1869 fe->dai_link->name, "playback");
1867 mutex_unlock(&card->mutex); 1870 mutex_unlock(&card->mutex);
1868 return paths; 1871 return paths;
@@ -1891,7 +1894,7 @@ capture:
1891 1894
1892 paths = dpcm_path_get(fe, SNDRV_PCM_STREAM_CAPTURE, &list); 1895 paths = dpcm_path_get(fe, SNDRV_PCM_STREAM_CAPTURE, &list);
1893 if (paths < 0) { 1896 if (paths < 0) {
1894 dev_warn(fe->dev, "%s no valid %s path\n", 1897 dev_warn(fe->dev, "ASoC: %s no valid %s path\n",
1895 fe->dai_link->name, "capture"); 1898 fe->dai_link->name, "capture");
1896 mutex_unlock(&card->mutex); 1899 mutex_unlock(&card->mutex);
1897 return paths; 1900 return paths;
@@ -1934,7 +1937,7 @@ int soc_dpcm_be_digital_mute(struct snd_soc_pcm_runtime *fe, int mute)
1934 if (be->dai_link->ignore_suspend) 1937 if (be->dai_link->ignore_suspend)
1935 continue; 1938 continue;
1936 1939
1937 dev_dbg(be->dev, "BE digital mute %s\n", be->dai_link->name); 1940 dev_dbg(be->dev, "ASoC: BE digital mute %s\n", be->dai_link->name);
1938 1941
1939 if (drv->ops->digital_mute && dai->playback_active) 1942 if (drv->ops->digital_mute && dai->playback_active)
1940 drv->ops->digital_mute(dai, mute); 1943 drv->ops->digital_mute(dai, mute);
@@ -1955,7 +1958,7 @@ static int dpcm_fe_dai_open(struct snd_pcm_substream *fe_substream)
1955 fe->dpcm[stream].runtime = fe_substream->runtime; 1958 fe->dpcm[stream].runtime = fe_substream->runtime;
1956 1959
1957 if (dpcm_path_get(fe, stream, &list) <= 0) { 1960 if (dpcm_path_get(fe, stream, &list) <= 0) {
1958 dev_dbg(fe->dev, "asoc: %s no valid %s route\n", 1961 dev_dbg(fe->dev, "ASoC: %s no valid %s route\n",
1959 fe->dai_link->name, stream ? "capture" : "playback"); 1962 fe->dai_link->name, stream ? "capture" : "playback");
1960 } 1963 }
1961 1964
@@ -2039,11 +2042,11 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num)
2039 capture, &pcm); 2042 capture, &pcm);
2040 } 2043 }
2041 if (ret < 0) { 2044 if (ret < 0) {
2042 dev_err(rtd->card->dev, "can't create pcm for %s\n", 2045 dev_err(rtd->card->dev, "ASoC: can't create pcm for %s\n",
2043 rtd->dai_link->name); 2046 rtd->dai_link->name);
2044 return ret; 2047 return ret;
2045 } 2048 }
2046 dev_dbg(rtd->card->dev, "registered pcm #%d %s\n",num, new_name); 2049 dev_dbg(rtd->card->dev, "ASoC: registered pcm #%d %s\n",num, new_name);
2047 2050
2048 /* DAPM dai link stream work */ 2051 /* DAPM dai link stream work */
2049 INIT_DELAYED_WORK(&rtd->delayed_work, close_delayed_work); 2052 INIT_DELAYED_WORK(&rtd->delayed_work, close_delayed_work);
@@ -2097,7 +2100,9 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num)
2097 if (platform->driver->pcm_new) { 2100 if (platform->driver->pcm_new) {
2098 ret = platform->driver->pcm_new(rtd); 2101 ret = platform->driver->pcm_new(rtd);
2099 if (ret < 0) { 2102 if (ret < 0) {
2100 dev_err(platform->dev, "pcm constructor failed\n"); 2103 dev_err(platform->dev,
2104 "ASoC: pcm constructor failed: %d\n",
2105 ret);
2101 return ret; 2106 return ret;
2102 } 2107 }
2103 } 2108 }
diff --git a/sound/soc/soc-utils.c b/sound/soc/soc-utils.c
index 60053709e417..fe4541df498c 100644
--- a/sound/soc/soc-utils.c
+++ b/sound/soc/soc-utils.c
@@ -94,7 +94,7 @@ static struct snd_soc_dai_driver dummy_dai = {
94 .name = "snd-soc-dummy-dai", 94 .name = "snd-soc-dummy-dai",
95}; 95};
96 96
97static __devinit int snd_soc_dummy_probe(struct platform_device *pdev) 97static int snd_soc_dummy_probe(struct platform_device *pdev)
98{ 98{
99 int ret; 99 int ret;
100 100
@@ -111,7 +111,7 @@ static __devinit int snd_soc_dummy_probe(struct platform_device *pdev)
111 return ret; 111 return ret;
112} 112}
113 113
114static __devexit int snd_soc_dummy_remove(struct platform_device *pdev) 114static int snd_soc_dummy_remove(struct platform_device *pdev)
115{ 115{
116 snd_soc_unregister_platform(&pdev->dev); 116 snd_soc_unregister_platform(&pdev->dev);
117 snd_soc_unregister_codec(&pdev->dev); 117 snd_soc_unregister_codec(&pdev->dev);
@@ -125,7 +125,7 @@ static struct platform_driver soc_dummy_driver = {
125 .owner = THIS_MODULE, 125 .owner = THIS_MODULE,
126 }, 126 },
127 .probe = snd_soc_dummy_probe, 127 .probe = snd_soc_dummy_probe,
128 .remove = __devexit_p(snd_soc_dummy_remove), 128 .remove = snd_soc_dummy_remove,
129}; 129};
130 130
131static struct platform_device *soc_dummy_dev; 131static struct platform_device *soc_dummy_dev;
diff --git a/sound/soc/spear/spear_pcm.c b/sound/soc/spear/spear_pcm.c
index 8c7f23729446..9b76cc5a1148 100644
--- a/sound/soc/spear/spear_pcm.c
+++ b/sound/soc/spear/spear_pcm.c
@@ -184,12 +184,12 @@ struct snd_soc_platform_driver spear_soc_platform = {
184 .pcm_free = spear_pcm_free, 184 .pcm_free = spear_pcm_free,
185}; 185};
186 186
187static int __devinit spear_soc_platform_probe(struct platform_device *pdev) 187static int spear_soc_platform_probe(struct platform_device *pdev)
188{ 188{
189 return snd_soc_register_platform(&pdev->dev, &spear_soc_platform); 189 return snd_soc_register_platform(&pdev->dev, &spear_soc_platform);
190} 190}
191 191
192static int __devexit spear_soc_platform_remove(struct platform_device *pdev) 192static int spear_soc_platform_remove(struct platform_device *pdev)
193{ 193{
194 snd_soc_unregister_platform(&pdev->dev); 194 snd_soc_unregister_platform(&pdev->dev);
195 195
@@ -203,7 +203,7 @@ static struct platform_driver spear_pcm_driver = {
203 }, 203 },
204 204
205 .probe = spear_soc_platform_probe, 205 .probe = spear_soc_platform_probe,
206 .remove = __devexit_p(spear_soc_platform_remove), 206 .remove = spear_soc_platform_remove,
207}; 207};
208 208
209module_platform_driver(spear_pcm_driver); 209module_platform_driver(spear_pcm_driver);
diff --git a/sound/soc/tegra/tegra20_das.c b/sound/soc/tegra/tegra20_das.c
index bf99296bce95..654318483877 100644
--- a/sound/soc/tegra/tegra20_das.c
+++ b/sound/soc/tegra/tegra20_das.c
@@ -131,7 +131,7 @@ static const struct regmap_config tegra20_das_regmap_config = {
131 .cache_type = REGCACHE_RBTREE, 131 .cache_type = REGCACHE_RBTREE,
132}; 132};
133 133
134static int __devinit tegra20_das_probe(struct platform_device *pdev) 134static int tegra20_das_probe(struct platform_device *pdev)
135{ 135{
136 struct resource *res, *region; 136 struct resource *res, *region;
137 void __iomem *regs; 137 void __iomem *regs;
@@ -200,7 +200,7 @@ err:
200 return ret; 200 return ret;
201} 201}
202 202
203static int __devexit tegra20_das_remove(struct platform_device *pdev) 203static int tegra20_das_remove(struct platform_device *pdev)
204{ 204{
205 if (!das) 205 if (!das)
206 return -ENODEV; 206 return -ENODEV;
@@ -210,14 +210,14 @@ static int __devexit tegra20_das_remove(struct platform_device *pdev)
210 return 0; 210 return 0;
211} 211}
212 212
213static const struct of_device_id tegra20_das_of_match[] __devinitconst = { 213static const struct of_device_id tegra20_das_of_match[] = {
214 { .compatible = "nvidia,tegra20-das", }, 214 { .compatible = "nvidia,tegra20-das", },
215 {}, 215 {},
216}; 216};
217 217
218static struct platform_driver tegra20_das_driver = { 218static struct platform_driver tegra20_das_driver = {
219 .probe = tegra20_das_probe, 219 .probe = tegra20_das_probe,
220 .remove = __devexit_p(tegra20_das_remove), 220 .remove = tegra20_das_remove,
221 .driver = { 221 .driver = {
222 .name = DRV_NAME, 222 .name = DRV_NAME,
223 .owner = THIS_MODULE, 223 .owner = THIS_MODULE,
diff --git a/sound/soc/tegra/tegra20_i2s.c b/sound/soc/tegra/tegra20_i2s.c
index 0832e8afd73c..caa772de5a18 100644
--- a/sound/soc/tegra/tegra20_i2s.c
+++ b/sound/soc/tegra/tegra20_i2s.c
@@ -331,7 +331,7 @@ static const struct regmap_config tegra20_i2s_regmap_config = {
331 .cache_type = REGCACHE_RBTREE, 331 .cache_type = REGCACHE_RBTREE,
332}; 332};
333 333
334static __devinit int tegra20_i2s_platform_probe(struct platform_device *pdev) 334static int tegra20_i2s_platform_probe(struct platform_device *pdev)
335{ 335{
336 struct tegra20_i2s *i2s; 336 struct tegra20_i2s *i2s;
337 struct resource *mem, *memregion, *dmareq; 337 struct resource *mem, *memregion, *dmareq;
@@ -447,7 +447,7 @@ err:
447 return ret; 447 return ret;
448} 448}
449 449
450static int __devexit tegra20_i2s_platform_remove(struct platform_device *pdev) 450static int tegra20_i2s_platform_remove(struct platform_device *pdev)
451{ 451{
452 struct tegra20_i2s *i2s = dev_get_drvdata(&pdev->dev); 452 struct tegra20_i2s *i2s = dev_get_drvdata(&pdev->dev);
453 453
@@ -463,12 +463,12 @@ static int __devexit tegra20_i2s_platform_remove(struct platform_device *pdev)
463 return 0; 463 return 0;
464} 464}
465 465
466static const struct of_device_id tegra20_i2s_of_match[] __devinitconst = { 466static const struct of_device_id tegra20_i2s_of_match[] = {
467 { .compatible = "nvidia,tegra20-i2s", }, 467 { .compatible = "nvidia,tegra20-i2s", },
468 {}, 468 {},
469}; 469};
470 470
471static const struct dev_pm_ops tegra20_i2s_pm_ops __devinitconst = { 471static const struct dev_pm_ops tegra20_i2s_pm_ops = {
472 SET_RUNTIME_PM_OPS(tegra20_i2s_runtime_suspend, 472 SET_RUNTIME_PM_OPS(tegra20_i2s_runtime_suspend,
473 tegra20_i2s_runtime_resume, NULL) 473 tegra20_i2s_runtime_resume, NULL)
474}; 474};
@@ -481,7 +481,7 @@ static struct platform_driver tegra20_i2s_driver = {
481 .pm = &tegra20_i2s_pm_ops, 481 .pm = &tegra20_i2s_pm_ops,
482 }, 482 },
483 .probe = tegra20_i2s_platform_probe, 483 .probe = tegra20_i2s_platform_probe,
484 .remove = __devexit_p(tegra20_i2s_platform_remove), 484 .remove = tegra20_i2s_platform_remove,
485}; 485};
486module_platform_driver(tegra20_i2s_driver); 486module_platform_driver(tegra20_i2s_driver);
487 487
diff --git a/sound/soc/tegra/tegra20_spdif.c b/sound/soc/tegra/tegra20_spdif.c
index 3ebc8670ba00..04771d14d343 100644
--- a/sound/soc/tegra/tegra20_spdif.c
+++ b/sound/soc/tegra/tegra20_spdif.c
@@ -257,7 +257,7 @@ static const struct regmap_config tegra20_spdif_regmap_config = {
257 .cache_type = REGCACHE_RBTREE, 257 .cache_type = REGCACHE_RBTREE,
258}; 258};
259 259
260static __devinit int tegra20_spdif_platform_probe(struct platform_device *pdev) 260static int tegra20_spdif_platform_probe(struct platform_device *pdev)
261{ 261{
262 struct tegra20_spdif *spdif; 262 struct tegra20_spdif *spdif;
263 struct resource *mem, *memregion, *dmareq; 263 struct resource *mem, *memregion, *dmareq;
@@ -357,7 +357,7 @@ err:
357 return ret; 357 return ret;
358} 358}
359 359
360static int __devexit tegra20_spdif_platform_remove(struct platform_device *pdev) 360static int tegra20_spdif_platform_remove(struct platform_device *pdev)
361{ 361{
362 struct tegra20_spdif *spdif = dev_get_drvdata(&pdev->dev); 362 struct tegra20_spdif *spdif = dev_get_drvdata(&pdev->dev);
363 363
@@ -373,7 +373,7 @@ static int __devexit tegra20_spdif_platform_remove(struct platform_device *pdev)
373 return 0; 373 return 0;
374} 374}
375 375
376static const struct dev_pm_ops tegra20_spdif_pm_ops __devinitconst = { 376static const struct dev_pm_ops tegra20_spdif_pm_ops = {
377 SET_RUNTIME_PM_OPS(tegra20_spdif_runtime_suspend, 377 SET_RUNTIME_PM_OPS(tegra20_spdif_runtime_suspend,
378 tegra20_spdif_runtime_resume, NULL) 378 tegra20_spdif_runtime_resume, NULL)
379}; 379};
@@ -385,7 +385,7 @@ static struct platform_driver tegra20_spdif_driver = {
385 .pm = &tegra20_spdif_pm_ops, 385 .pm = &tegra20_spdif_pm_ops,
386 }, 386 },
387 .probe = tegra20_spdif_platform_probe, 387 .probe = tegra20_spdif_platform_probe,
388 .remove = __devexit_p(tegra20_spdif_platform_remove), 388 .remove = tegra20_spdif_platform_remove,
389}; 389};
390 390
391module_platform_driver(tegra20_spdif_driver); 391module_platform_driver(tegra20_spdif_driver);
diff --git a/sound/soc/tegra/tegra30_ahub.c b/sound/soc/tegra/tegra30_ahub.c
index 64b67a309196..f354dc390a0b 100644
--- a/sound/soc/tegra/tegra30_ahub.c
+++ b/sound/soc/tegra/tegra30_ahub.c
@@ -287,7 +287,7 @@ int tegra30_ahub_unset_rx_cif_source(enum tegra30_ahub_rxcif rxcif)
287} 287}
288EXPORT_SYMBOL_GPL(tegra30_ahub_unset_rx_cif_source); 288EXPORT_SYMBOL_GPL(tegra30_ahub_unset_rx_cif_source);
289 289
290static const char * const configlink_clocks[] __devinitconst = { 290static const char * const configlink_clocks[] = {
291 "i2s0", 291 "i2s0",
292 "i2s1", 292 "i2s1",
293 "i2s2", 293 "i2s2",
@@ -299,7 +299,7 @@ static const char * const configlink_clocks[] __devinitconst = {
299 "spdif_in", 299 "spdif_in",
300}; 300};
301 301
302struct of_dev_auxdata ahub_auxdata[] __devinitdata = { 302struct of_dev_auxdata ahub_auxdata[] = {
303 OF_DEV_AUXDATA("nvidia,tegra30-i2s", 0x70080300, "tegra30-i2s.0", NULL), 303 OF_DEV_AUXDATA("nvidia,tegra30-i2s", 0x70080300, "tegra30-i2s.0", NULL),
304 OF_DEV_AUXDATA("nvidia,tegra30-i2s", 0x70080400, "tegra30-i2s.1", NULL), 304 OF_DEV_AUXDATA("nvidia,tegra30-i2s", 0x70080400, "tegra30-i2s.1", NULL),
305 OF_DEV_AUXDATA("nvidia,tegra30-i2s", 0x70080500, "tegra30-i2s.2", NULL), 305 OF_DEV_AUXDATA("nvidia,tegra30-i2s", 0x70080500, "tegra30-i2s.2", NULL),
@@ -433,7 +433,7 @@ static const struct regmap_config tegra30_ahub_ahub_regmap_config = {
433 .cache_type = REGCACHE_RBTREE, 433 .cache_type = REGCACHE_RBTREE,
434}; 434};
435 435
436static int __devinit tegra30_ahub_probe(struct platform_device *pdev) 436static int tegra30_ahub_probe(struct platform_device *pdev)
437{ 437{
438 struct clk *clk; 438 struct clk *clk;
439 int i; 439 int i;
@@ -585,7 +585,7 @@ err:
585 return ret; 585 return ret;
586} 586}
587 587
588static int __devexit tegra30_ahub_remove(struct platform_device *pdev) 588static int tegra30_ahub_remove(struct platform_device *pdev)
589{ 589{
590 if (!ahub) 590 if (!ahub)
591 return -ENODEV; 591 return -ENODEV;
@@ -602,19 +602,19 @@ static int __devexit tegra30_ahub_remove(struct platform_device *pdev)
602 return 0; 602 return 0;
603} 603}
604 604
605static const struct of_device_id tegra30_ahub_of_match[] __devinitconst = { 605static const struct of_device_id tegra30_ahub_of_match[] = {
606 { .compatible = "nvidia,tegra30-ahub", }, 606 { .compatible = "nvidia,tegra30-ahub", },
607 {}, 607 {},
608}; 608};
609 609
610static const struct dev_pm_ops tegra30_ahub_pm_ops __devinitconst = { 610static const struct dev_pm_ops tegra30_ahub_pm_ops = {
611 SET_RUNTIME_PM_OPS(tegra30_ahub_runtime_suspend, 611 SET_RUNTIME_PM_OPS(tegra30_ahub_runtime_suspend,
612 tegra30_ahub_runtime_resume, NULL) 612 tegra30_ahub_runtime_resume, NULL)
613}; 613};
614 614
615static struct platform_driver tegra30_ahub_driver = { 615static struct platform_driver tegra30_ahub_driver = {
616 .probe = tegra30_ahub_probe, 616 .probe = tegra30_ahub_probe,
617 .remove = __devexit_p(tegra30_ahub_remove), 617 .remove = tegra30_ahub_remove,
618 .driver = { 618 .driver = {
619 .name = DRV_NAME, 619 .name = DRV_NAME,
620 .owner = THIS_MODULE, 620 .owner = THIS_MODULE,
diff --git a/sound/soc/tegra/tegra30_i2s.c b/sound/soc/tegra/tegra30_i2s.c
index 44184228d1f0..27e91dd0b91c 100644
--- a/sound/soc/tegra/tegra30_i2s.c
+++ b/sound/soc/tegra/tegra30_i2s.c
@@ -391,7 +391,7 @@ static const struct regmap_config tegra30_i2s_regmap_config = {
391 .cache_type = REGCACHE_RBTREE, 391 .cache_type = REGCACHE_RBTREE,
392}; 392};
393 393
394static __devinit int tegra30_i2s_platform_probe(struct platform_device *pdev) 394static int tegra30_i2s_platform_probe(struct platform_device *pdev)
395{ 395{
396 struct tegra30_i2s *i2s; 396 struct tegra30_i2s *i2s;
397 u32 cif_ids[2]; 397 u32 cif_ids[2];
@@ -492,7 +492,7 @@ err:
492 return ret; 492 return ret;
493} 493}
494 494
495static int __devexit tegra30_i2s_platform_remove(struct platform_device *pdev) 495static int tegra30_i2s_platform_remove(struct platform_device *pdev)
496{ 496{
497 struct tegra30_i2s *i2s = dev_get_drvdata(&pdev->dev); 497 struct tegra30_i2s *i2s = dev_get_drvdata(&pdev->dev);
498 498
@@ -508,12 +508,12 @@ static int __devexit tegra30_i2s_platform_remove(struct platform_device *pdev)
508 return 0; 508 return 0;
509} 509}
510 510
511static const struct of_device_id tegra30_i2s_of_match[] __devinitconst = { 511static const struct of_device_id tegra30_i2s_of_match[] = {
512 { .compatible = "nvidia,tegra30-i2s", }, 512 { .compatible = "nvidia,tegra30-i2s", },
513 {}, 513 {},
514}; 514};
515 515
516static const struct dev_pm_ops tegra30_i2s_pm_ops __devinitconst = { 516static const struct dev_pm_ops tegra30_i2s_pm_ops = {
517 SET_RUNTIME_PM_OPS(tegra30_i2s_runtime_suspend, 517 SET_RUNTIME_PM_OPS(tegra30_i2s_runtime_suspend,
518 tegra30_i2s_runtime_resume, NULL) 518 tegra30_i2s_runtime_resume, NULL)
519}; 519};
@@ -526,7 +526,7 @@ static struct platform_driver tegra30_i2s_driver = {
526 .pm = &tegra30_i2s_pm_ops, 526 .pm = &tegra30_i2s_pm_ops,
527 }, 527 },
528 .probe = tegra30_i2s_platform_probe, 528 .probe = tegra30_i2s_platform_probe,
529 .remove = __devexit_p(tegra30_i2s_platform_remove), 529 .remove = tegra30_i2s_platform_remove,
530}; 530};
531module_platform_driver(tegra30_i2s_driver); 531module_platform_driver(tegra30_i2s_driver);
532 532
diff --git a/sound/soc/tegra/tegra_alc5632.c b/sound/soc/tegra/tegra_alc5632.c
index 76cb1b363b71..c80adb9da472 100644
--- a/sound/soc/tegra/tegra_alc5632.c
+++ b/sound/soc/tegra/tegra_alc5632.c
@@ -150,7 +150,7 @@ static struct snd_soc_card snd_soc_tegra_alc5632 = {
150 .fully_routed = true, 150 .fully_routed = true,
151}; 151};
152 152
153static __devinit int tegra_alc5632_probe(struct platform_device *pdev) 153static int tegra_alc5632_probe(struct platform_device *pdev)
154{ 154{
155 struct device_node *np = pdev->dev.of_node; 155 struct device_node *np = pdev->dev.of_node;
156 struct snd_soc_card *card = &snd_soc_tegra_alc5632; 156 struct snd_soc_card *card = &snd_soc_tegra_alc5632;
@@ -227,7 +227,7 @@ err:
227 return ret; 227 return ret;
228} 228}
229 229
230static int __devexit tegra_alc5632_remove(struct platform_device *pdev) 230static int tegra_alc5632_remove(struct platform_device *pdev)
231{ 231{
232 struct snd_soc_card *card = platform_get_drvdata(pdev); 232 struct snd_soc_card *card = platform_get_drvdata(pdev);
233 struct tegra_alc5632 *machine = snd_soc_card_get_drvdata(card); 233 struct tegra_alc5632 *machine = snd_soc_card_get_drvdata(card);
@@ -242,7 +242,7 @@ static int __devexit tegra_alc5632_remove(struct platform_device *pdev)
242 return 0; 242 return 0;
243} 243}
244 244
245static const struct of_device_id tegra_alc5632_of_match[] __devinitconst = { 245static const struct of_device_id tegra_alc5632_of_match[] = {
246 { .compatible = "nvidia,tegra-audio-alc5632", }, 246 { .compatible = "nvidia,tegra-audio-alc5632", },
247 {}, 247 {},
248}; 248};
@@ -255,7 +255,7 @@ static struct platform_driver tegra_alc5632_driver = {
255 .of_match_table = tegra_alc5632_of_match, 255 .of_match_table = tegra_alc5632_of_match,
256 }, 256 },
257 .probe = tegra_alc5632_probe, 257 .probe = tegra_alc5632_probe,
258 .remove = __devexit_p(tegra_alc5632_remove), 258 .remove = tegra_alc5632_remove,
259}; 259};
260module_platform_driver(tegra_alc5632_driver); 260module_platform_driver(tegra_alc5632_driver);
261 261
diff --git a/sound/soc/tegra/tegra_pcm.c b/sound/soc/tegra/tegra_pcm.c
index e18733963cb4..c925ab0adeb6 100644
--- a/sound/soc/tegra/tegra_pcm.c
+++ b/sound/soc/tegra/tegra_pcm.c
@@ -253,13 +253,13 @@ static struct snd_soc_platform_driver tegra_pcm_platform = {
253 .pcm_free = tegra_pcm_free, 253 .pcm_free = tegra_pcm_free,
254}; 254};
255 255
256int __devinit tegra_pcm_platform_register(struct device *dev) 256int tegra_pcm_platform_register(struct device *dev)
257{ 257{
258 return snd_soc_register_platform(dev, &tegra_pcm_platform); 258 return snd_soc_register_platform(dev, &tegra_pcm_platform);
259} 259}
260EXPORT_SYMBOL_GPL(tegra_pcm_platform_register); 260EXPORT_SYMBOL_GPL(tegra_pcm_platform_register);
261 261
262void __devexit tegra_pcm_platform_unregister(struct device *dev) 262void tegra_pcm_platform_unregister(struct device *dev)
263{ 263{
264 snd_soc_unregister_platform(dev); 264 snd_soc_unregister_platform(dev);
265} 265}
diff --git a/sound/soc/tegra/tegra_wm8753.c b/sound/soc/tegra/tegra_wm8753.c
index ea9166d5c4eb..c8ef88a67c59 100644
--- a/sound/soc/tegra/tegra_wm8753.c
+++ b/sound/soc/tegra/tegra_wm8753.c
@@ -122,7 +122,7 @@ static struct snd_soc_card snd_soc_tegra_wm8753 = {
122 .fully_routed = true, 122 .fully_routed = true,
123}; 123};
124 124
125static __devinit int tegra_wm8753_driver_probe(struct platform_device *pdev) 125static int tegra_wm8753_driver_probe(struct platform_device *pdev)
126{ 126{
127 struct snd_soc_card *card = &snd_soc_tegra_wm8753; 127 struct snd_soc_card *card = &snd_soc_tegra_wm8753;
128 struct tegra_wm8753 *machine; 128 struct tegra_wm8753 *machine;
@@ -188,7 +188,7 @@ err:
188 return ret; 188 return ret;
189} 189}
190 190
191static int __devexit tegra_wm8753_driver_remove(struct platform_device *pdev) 191static int tegra_wm8753_driver_remove(struct platform_device *pdev)
192{ 192{
193 struct snd_soc_card *card = platform_get_drvdata(pdev); 193 struct snd_soc_card *card = platform_get_drvdata(pdev);
194 struct tegra_wm8753 *machine = snd_soc_card_get_drvdata(card); 194 struct tegra_wm8753 *machine = snd_soc_card_get_drvdata(card);
@@ -200,7 +200,7 @@ static int __devexit tegra_wm8753_driver_remove(struct platform_device *pdev)
200 return 0; 200 return 0;
201} 201}
202 202
203static const struct of_device_id tegra_wm8753_of_match[] __devinitconst = { 203static const struct of_device_id tegra_wm8753_of_match[] = {
204 { .compatible = "nvidia,tegra-audio-wm8753", }, 204 { .compatible = "nvidia,tegra-audio-wm8753", },
205 {}, 205 {},
206}; 206};
@@ -213,7 +213,7 @@ static struct platform_driver tegra_wm8753_driver = {
213 .of_match_table = tegra_wm8753_of_match, 213 .of_match_table = tegra_wm8753_of_match,
214 }, 214 },
215 .probe = tegra_wm8753_driver_probe, 215 .probe = tegra_wm8753_driver_probe,
216 .remove = __devexit_p(tegra_wm8753_driver_remove), 216 .remove = tegra_wm8753_driver_remove,
217}; 217};
218module_platform_driver(tegra_wm8753_driver); 218module_platform_driver(tegra_wm8753_driver);
219 219
diff --git a/sound/soc/tegra/tegra_wm8903.c b/sound/soc/tegra/tegra_wm8903.c
index cee13b7bfb94..bbd79bf56303 100644
--- a/sound/soc/tegra/tegra_wm8903.c
+++ b/sound/soc/tegra/tegra_wm8903.c
@@ -252,7 +252,7 @@ static struct snd_soc_card snd_soc_tegra_wm8903 = {
252 .fully_routed = true, 252 .fully_routed = true,
253}; 253};
254 254
255static __devinit int tegra_wm8903_driver_probe(struct platform_device *pdev) 255static int tegra_wm8903_driver_probe(struct platform_device *pdev)
256{ 256{
257 struct device_node *np = pdev->dev.of_node; 257 struct device_node *np = pdev->dev.of_node;
258 struct snd_soc_card *card = &snd_soc_tegra_wm8903; 258 struct snd_soc_card *card = &snd_soc_tegra_wm8903;
@@ -402,7 +402,7 @@ err:
402 return ret; 402 return ret;
403} 403}
404 404
405static int __devexit tegra_wm8903_driver_remove(struct platform_device *pdev) 405static int tegra_wm8903_driver_remove(struct platform_device *pdev)
406{ 406{
407 struct snd_soc_card *card = platform_get_drvdata(pdev); 407 struct snd_soc_card *card = platform_get_drvdata(pdev);
408 struct tegra_wm8903 *machine = snd_soc_card_get_drvdata(card); 408 struct tegra_wm8903 *machine = snd_soc_card_get_drvdata(card);
@@ -417,7 +417,7 @@ static int __devexit tegra_wm8903_driver_remove(struct platform_device *pdev)
417 return 0; 417 return 0;
418} 418}
419 419
420static const struct of_device_id tegra_wm8903_of_match[] __devinitconst = { 420static const struct of_device_id tegra_wm8903_of_match[] = {
421 { .compatible = "nvidia,tegra-audio-wm8903", }, 421 { .compatible = "nvidia,tegra-audio-wm8903", },
422 {}, 422 {},
423}; 423};
@@ -430,7 +430,7 @@ static struct platform_driver tegra_wm8903_driver = {
430 .of_match_table = tegra_wm8903_of_match, 430 .of_match_table = tegra_wm8903_of_match,
431 }, 431 },
432 .probe = tegra_wm8903_driver_probe, 432 .probe = tegra_wm8903_driver_probe,
433 .remove = __devexit_p(tegra_wm8903_driver_remove), 433 .remove = tegra_wm8903_driver_remove,
434}; 434};
435module_platform_driver(tegra_wm8903_driver); 435module_platform_driver(tegra_wm8903_driver);
436 436
diff --git a/sound/soc/tegra/trimslice.c b/sound/soc/tegra/trimslice.c
index e69a4f7000d6..7fcf6c2297db 100644
--- a/sound/soc/tegra/trimslice.c
+++ b/sound/soc/tegra/trimslice.c
@@ -120,7 +120,7 @@ static struct snd_soc_card snd_soc_trimslice = {
120 .fully_routed = true, 120 .fully_routed = true,
121}; 121};
122 122
123static __devinit int tegra_snd_trimslice_probe(struct platform_device *pdev) 123static int tegra_snd_trimslice_probe(struct platform_device *pdev)
124{ 124{
125 struct snd_soc_card *card = &snd_soc_trimslice; 125 struct snd_soc_card *card = &snd_soc_trimslice;
126 struct tegra_trimslice *trimslice; 126 struct tegra_trimslice *trimslice;
@@ -183,7 +183,7 @@ err:
183 return ret; 183 return ret;
184} 184}
185 185
186static int __devexit tegra_snd_trimslice_remove(struct platform_device *pdev) 186static int tegra_snd_trimslice_remove(struct platform_device *pdev)
187{ 187{
188 struct snd_soc_card *card = platform_get_drvdata(pdev); 188 struct snd_soc_card *card = platform_get_drvdata(pdev);
189 struct tegra_trimslice *trimslice = snd_soc_card_get_drvdata(card); 189 struct tegra_trimslice *trimslice = snd_soc_card_get_drvdata(card);
@@ -195,7 +195,7 @@ static int __devexit tegra_snd_trimslice_remove(struct platform_device *pdev)
195 return 0; 195 return 0;
196} 196}
197 197
198static const struct of_device_id trimslice_of_match[] __devinitconst = { 198static const struct of_device_id trimslice_of_match[] = {
199 { .compatible = "nvidia,tegra-audio-trimslice", }, 199 { .compatible = "nvidia,tegra-audio-trimslice", },
200 {}, 200 {},
201}; 201};
@@ -208,7 +208,7 @@ static struct platform_driver tegra_snd_trimslice_driver = {
208 .of_match_table = trimslice_of_match, 208 .of_match_table = trimslice_of_match,
209 }, 209 },
210 .probe = tegra_snd_trimslice_probe, 210 .probe = tegra_snd_trimslice_probe,
211 .remove = __devexit_p(tegra_snd_trimslice_remove), 211 .remove = tegra_snd_trimslice_remove,
212}; 212};
213module_platform_driver(tegra_snd_trimslice_driver); 213module_platform_driver(tegra_snd_trimslice_driver);
214 214
diff --git a/sound/soc/txx9/txx9aclc-ac97.c b/sound/soc/txx9/txx9aclc-ac97.c
index 28db4ca997ca..16ab69635e2e 100644
--- a/sound/soc/txx9/txx9aclc-ac97.c
+++ b/sound/soc/txx9/txx9aclc-ac97.c
@@ -170,7 +170,7 @@ static struct snd_soc_dai_driver txx9aclc_ac97_dai = {
170 }, 170 },
171}; 171};
172 172
173static int __devinit txx9aclc_ac97_dev_probe(struct platform_device *pdev) 173static int txx9aclc_ac97_dev_probe(struct platform_device *pdev)
174{ 174{
175 struct txx9aclc_plat_drvdata *drvdata; 175 struct txx9aclc_plat_drvdata *drvdata;
176 struct resource *r; 176 struct resource *r;
@@ -208,7 +208,7 @@ static int __devinit txx9aclc_ac97_dev_probe(struct platform_device *pdev)
208 return snd_soc_register_dai(&pdev->dev, &txx9aclc_ac97_dai); 208 return snd_soc_register_dai(&pdev->dev, &txx9aclc_ac97_dai);
209} 209}
210 210
211static int __devexit txx9aclc_ac97_dev_remove(struct platform_device *pdev) 211static int txx9aclc_ac97_dev_remove(struct platform_device *pdev)
212{ 212{
213 snd_soc_unregister_dai(&pdev->dev); 213 snd_soc_unregister_dai(&pdev->dev);
214 return 0; 214 return 0;
@@ -216,7 +216,7 @@ static int __devexit txx9aclc_ac97_dev_remove(struct platform_device *pdev)
216 216
217static struct platform_driver txx9aclc_ac97_driver = { 217static struct platform_driver txx9aclc_ac97_driver = {
218 .probe = txx9aclc_ac97_dev_probe, 218 .probe = txx9aclc_ac97_dev_probe,
219 .remove = __devexit_p(txx9aclc_ac97_dev_remove), 219 .remove = txx9aclc_ac97_dev_remove,
220 .driver = { 220 .driver = {
221 .name = "txx9aclc-ac97", 221 .name = "txx9aclc-ac97",
222 .owner = THIS_MODULE, 222 .owner = THIS_MODULE,
diff --git a/sound/soc/txx9/txx9aclc.c b/sound/soc/txx9/txx9aclc.c
index b609d2c64c55..45a6428cba8d 100644
--- a/sound/soc/txx9/txx9aclc.c
+++ b/sound/soc/txx9/txx9aclc.c
@@ -417,12 +417,12 @@ static struct snd_soc_platform_driver txx9aclc_soc_platform = {
417 .pcm_free = txx9aclc_pcm_free_dma_buffers, 417 .pcm_free = txx9aclc_pcm_free_dma_buffers,
418}; 418};
419 419
420static int __devinit txx9aclc_soc_platform_probe(struct platform_device *pdev) 420static int txx9aclc_soc_platform_probe(struct platform_device *pdev)
421{ 421{
422 return snd_soc_register_platform(&pdev->dev, &txx9aclc_soc_platform); 422 return snd_soc_register_platform(&pdev->dev, &txx9aclc_soc_platform);
423} 423}
424 424
425static int __devexit txx9aclc_soc_platform_remove(struct platform_device *pdev) 425static int txx9aclc_soc_platform_remove(struct platform_device *pdev)
426{ 426{
427 snd_soc_unregister_platform(&pdev->dev); 427 snd_soc_unregister_platform(&pdev->dev);
428 return 0; 428 return 0;
@@ -435,7 +435,7 @@ static struct platform_driver txx9aclc_pcm_driver = {
435 }, 435 },
436 436
437 .probe = txx9aclc_soc_platform_probe, 437 .probe = txx9aclc_soc_platform_probe,
438 .remove = __devexit_p(txx9aclc_soc_platform_remove), 438 .remove = txx9aclc_soc_platform_remove,
439}; 439};
440 440
441module_platform_driver(txx9aclc_pcm_driver); 441module_platform_driver(txx9aclc_pcm_driver);
diff --git a/sound/soc/ux500/mop500.c b/sound/soc/ux500/mop500.c
index 54f7e25b6f7d..ae6990738783 100644
--- a/sound/soc/ux500/mop500.c
+++ b/sound/soc/ux500/mop500.c
@@ -33,7 +33,7 @@ struct snd_soc_dai_link mop500_dai_links[] = {
33 .stream_name = "ab8500_0", 33 .stream_name = "ab8500_0",
34 .cpu_dai_name = "ux500-msp-i2s.1", 34 .cpu_dai_name = "ux500-msp-i2s.1",
35 .codec_dai_name = "ab8500-codec-dai.0", 35 .codec_dai_name = "ab8500-codec-dai.0",
36 .platform_name = "ux500-pcm.0", 36 .platform_name = "ux500-msp-i2s.1",
37 .codec_name = "ab8500-codec.0", 37 .codec_name = "ab8500-codec.0",
38 .init = mop500_ab8500_machine_init, 38 .init = mop500_ab8500_machine_init,
39 .ops = mop500_ab8500_ops, 39 .ops = mop500_ab8500_ops,
@@ -43,7 +43,7 @@ struct snd_soc_dai_link mop500_dai_links[] = {
43 .stream_name = "ab8500_1", 43 .stream_name = "ab8500_1",
44 .cpu_dai_name = "ux500-msp-i2s.3", 44 .cpu_dai_name = "ux500-msp-i2s.3",
45 .codec_dai_name = "ab8500-codec-dai.1", 45 .codec_dai_name = "ab8500-codec-dai.1",
46 .platform_name = "ux500-pcm.0", 46 .platform_name = "ux500-msp-i2s.3",
47 .codec_name = "ab8500-codec.0", 47 .codec_name = "ab8500-codec.0",
48 .init = NULL, 48 .init = NULL,
49 .ops = mop500_ab8500_ops, 49 .ops = mop500_ab8500_ops,
@@ -71,8 +71,8 @@ static void mop500_of_node_put(void)
71 } 71 }
72} 72}
73 73
74static int __devinit mop500_of_probe(struct platform_device *pdev, 74static int mop500_of_probe(struct platform_device *pdev,
75 struct device_node *np) 75 struct device_node *np)
76{ 76{
77 struct device_node *codec_np, *msp_np[2]; 77 struct device_node *codec_np, *msp_np[2];
78 int i; 78 int i;
@@ -99,7 +99,7 @@ static int __devinit mop500_of_probe(struct platform_device *pdev,
99 return 0; 99 return 0;
100} 100}
101 101
102static int __devinit mop500_probe(struct platform_device *pdev) 102static int mop500_probe(struct platform_device *pdev)
103{ 103{
104 struct device_node *np = pdev->dev.of_node; 104 struct device_node *np = pdev->dev.of_node;
105 int ret; 105 int ret;
@@ -136,7 +136,7 @@ static int __devinit mop500_probe(struct platform_device *pdev)
136 return ret; 136 return ret;
137} 137}
138 138
139static int __devexit mop500_remove(struct platform_device *pdev) 139static int mop500_remove(struct platform_device *pdev)
140{ 140{
141 struct snd_soc_card *mop500_card = platform_get_drvdata(pdev); 141 struct snd_soc_card *mop500_card = platform_get_drvdata(pdev);
142 142
@@ -161,7 +161,7 @@ static struct platform_driver snd_soc_mop500_driver = {
161 .of_match_table = snd_soc_mop500_match, 161 .of_match_table = snd_soc_mop500_match,
162 }, 162 },
163 .probe = mop500_probe, 163 .probe = mop500_probe,
164 .remove = __devexit_p(mop500_remove), 164 .remove = mop500_remove,
165}; 165};
166 166
167module_platform_driver(snd_soc_mop500_driver); 167module_platform_driver(snd_soc_mop500_driver);
diff --git a/sound/soc/ux500/ux500_msp_dai.c b/sound/soc/ux500/ux500_msp_dai.c
index be94bf9bf94f..94a3e5705aaa 100644
--- a/sound/soc/ux500/ux500_msp_dai.c
+++ b/sound/soc/ux500/ux500_msp_dai.c
@@ -28,6 +28,7 @@
28 28
29#include "ux500_msp_i2s.h" 29#include "ux500_msp_i2s.h"
30#include "ux500_msp_dai.h" 30#include "ux500_msp_dai.h"
31#include "ux500_pcm.h"
31 32
32static int setup_pcm_multichan(struct snd_soc_dai *dai, 33static int setup_pcm_multichan(struct snd_soc_dai *dai,
33 struct ux500_msp_config *msp_config) 34 struct ux500_msp_config *msp_config)
@@ -398,11 +399,28 @@ static int ux500_msp_dai_startup(struct snd_pcm_substream *substream,
398 return ret; 399 return ret;
399 } 400 }
400 401
401 /* Enable clock */ 402 /* Prepare and enable clocks */
402 dev_dbg(dai->dev, "%s: Enabling MSP-clock.\n", __func__); 403 dev_dbg(dai->dev, "%s: Enabling MSP-clocks.\n", __func__);
403 clk_enable(drvdata->clk); 404 ret = clk_prepare_enable(drvdata->pclk);
405 if (ret) {
406 dev_err(drvdata->msp->dev,
407 "%s: Failed to prepare/enable pclk!\n", __func__);
408 goto err_pclk;
409 }
404 410
405 return 0; 411 ret = clk_prepare_enable(drvdata->clk);
412 if (ret) {
413 dev_err(drvdata->msp->dev,
414 "%s: Failed to prepare/enable clk!\n", __func__);
415 goto err_clk;
416 }
417
418 return ret;
419err_clk:
420 clk_disable_unprepare(drvdata->pclk);
421err_pclk:
422 regulator_disable(drvdata->reg_vape);
423 return ret;
406} 424}
407 425
408static void ux500_msp_dai_shutdown(struct snd_pcm_substream *substream, 426static void ux500_msp_dai_shutdown(struct snd_pcm_substream *substream,
@@ -428,8 +446,9 @@ static void ux500_msp_dai_shutdown(struct snd_pcm_substream *substream,
428 __func__, dai->id, snd_pcm_stream_str(substream)); 446 __func__, dai->id, snd_pcm_stream_str(substream));
429 } 447 }
430 448
431 /* Disable clock */ 449 /* Disable and unprepare clocks */
432 clk_disable(drvdata->clk); 450 clk_disable_unprepare(drvdata->clk);
451 clk_disable_unprepare(drvdata->pclk);
433 452
434 /* Disable regulator */ 453 /* Disable regulator */
435 ret = regulator_disable(drvdata->reg_vape); 454 ret = regulator_disable(drvdata->reg_vape);
@@ -749,7 +768,7 @@ static struct snd_soc_dai_driver ux500_msp_dai_drv[UX500_NBR_OF_DAI] = {
749 }, 768 },
750}; 769};
751 770
752static int __devinit ux500_msp_drv_probe(struct platform_device *pdev) 771static int ux500_msp_drv_probe(struct platform_device *pdev)
753{ 772{
754 struct ux500_msp_i2s_drvdata *drvdata; 773 struct ux500_msp_i2s_drvdata *drvdata;
755 int ret = 0; 774 int ret = 0;
@@ -780,6 +799,14 @@ static int __devinit ux500_msp_drv_probe(struct platform_device *pdev)
780 } 799 }
781 prcmu_qos_add_requirement(PRCMU_QOS_APE_OPP, (char *)pdev->name, 50); 800 prcmu_qos_add_requirement(PRCMU_QOS_APE_OPP, (char *)pdev->name, 50);
782 801
802 drvdata->pclk = clk_get(&pdev->dev, "apb_pclk");
803 if (IS_ERR(drvdata->pclk)) {
804 ret = (int)PTR_ERR(drvdata->pclk);
805 dev_err(&pdev->dev, "%s: ERROR: clk_get of pclk failed (%d)!\n",
806 __func__, ret);
807 goto err_pclk;
808 }
809
783 drvdata->clk = clk_get(&pdev->dev, NULL); 810 drvdata->clk = clk_get(&pdev->dev, NULL);
784 if (IS_ERR(drvdata->clk)) { 811 if (IS_ERR(drvdata->clk)) {
785 ret = (int)PTR_ERR(drvdata->clk); 812 ret = (int)PTR_ERR(drvdata->clk);
@@ -806,27 +833,41 @@ static int __devinit ux500_msp_drv_probe(struct platform_device *pdev)
806 goto err_init_msp; 833 goto err_init_msp;
807 } 834 }
808 835
836 ret = ux500_pcm_register_platform(pdev);
837 if (ret < 0) {
838 dev_err(&pdev->dev,
839 "Error: %s: Failed to register PCM platform device!\n",
840 __func__);
841 goto err_reg_plat;
842 }
843
809 return 0; 844 return 0;
810 845
846err_reg_plat:
847 snd_soc_unregister_dais(&pdev->dev, ARRAY_SIZE(ux500_msp_dai_drv));
811err_init_msp: 848err_init_msp:
812 clk_put(drvdata->clk); 849 clk_put(drvdata->clk);
813
814err_clk: 850err_clk:
851 clk_put(drvdata->pclk);
852err_pclk:
815 devm_regulator_put(drvdata->reg_vape); 853 devm_regulator_put(drvdata->reg_vape);
816 854
817 return ret; 855 return ret;
818} 856}
819 857
820static int __devexit ux500_msp_drv_remove(struct platform_device *pdev) 858static int ux500_msp_drv_remove(struct platform_device *pdev)
821{ 859{
822 struct ux500_msp_i2s_drvdata *drvdata = dev_get_drvdata(&pdev->dev); 860 struct ux500_msp_i2s_drvdata *drvdata = dev_get_drvdata(&pdev->dev);
823 861
862 ux500_pcm_unregister_platform(pdev);
863
824 snd_soc_unregister_dais(&pdev->dev, ARRAY_SIZE(ux500_msp_dai_drv)); 864 snd_soc_unregister_dais(&pdev->dev, ARRAY_SIZE(ux500_msp_dai_drv));
825 865
826 devm_regulator_put(drvdata->reg_vape); 866 devm_regulator_put(drvdata->reg_vape);
827 prcmu_qos_remove_requirement(PRCMU_QOS_APE_OPP, "ux500_msp_i2s"); 867 prcmu_qos_remove_requirement(PRCMU_QOS_APE_OPP, "ux500_msp_i2s");
828 868
829 clk_put(drvdata->clk); 869 clk_put(drvdata->clk);
870 clk_put(drvdata->pclk);
830 871
831 ux500_msp_i2s_cleanup_msp(pdev, drvdata->msp); 872 ux500_msp_i2s_cleanup_msp(pdev, drvdata->msp);
832 873
diff --git a/sound/soc/ux500/ux500_msp_dai.h b/sound/soc/ux500/ux500_msp_dai.h
index 98202a34a5dd..9c778d9c3838 100644
--- a/sound/soc/ux500/ux500_msp_dai.h
+++ b/sound/soc/ux500/ux500_msp_dai.h
@@ -69,6 +69,7 @@ struct ux500_msp_i2s_drvdata {
69 /* Clocks */ 69 /* Clocks */
70 unsigned int master_clk; 70 unsigned int master_clk;
71 struct clk *clk; 71 struct clk *clk;
72 struct clk *pclk;
72 73
73 /* Regulators */ 74 /* Regulators */
74 int vape_opp_constraint; 75 int vape_opp_constraint;
diff --git a/sound/soc/ux500/ux500_pcm.c b/sound/soc/ux500/ux500_pcm.c
index b55b79f7536c..846fa82a58d0 100644
--- a/sound/soc/ux500/ux500_pcm.c
+++ b/sound/soc/ux500/ux500_pcm.c
@@ -281,7 +281,7 @@ static struct snd_soc_platform_driver ux500_pcm_soc_drv = {
281 .pcm_new = ux500_pcm_new, 281 .pcm_new = ux500_pcm_new,
282}; 282};
283 283
284static int __devexit ux500_pcm_drv_probe(struct platform_device *pdev) 284int ux500_pcm_register_platform(struct platform_device *pdev)
285{ 285{
286 int ret; 286 int ret;
287 287
@@ -295,23 +295,12 @@ static int __devexit ux500_pcm_drv_probe(struct platform_device *pdev)
295 295
296 return 0; 296 return 0;
297} 297}
298EXPORT_SYMBOL_GPL(ux500_pcm_register_platform);
298 299
299static int __devinit ux500_pcm_drv_remove(struct platform_device *pdev) 300int ux500_pcm_unregister_platform(struct platform_device *pdev)
300{ 301{
301 snd_soc_unregister_platform(&pdev->dev); 302 snd_soc_unregister_platform(&pdev->dev);
302 303
303 return 0; 304 return 0;
304} 305}
305 306EXPORT_SYMBOL_GPL(ux500_pcm_unregister_platform);
306static struct platform_driver ux500_pcm_driver = {
307 .driver = {
308 .name = "ux500-pcm",
309 .owner = THIS_MODULE,
310 },
311
312 .probe = ux500_pcm_drv_probe,
313 .remove = __devexit_p(ux500_pcm_drv_remove),
314};
315module_platform_driver(ux500_pcm_driver);
316
317MODULE_LICENSE("GPL v2");
diff --git a/sound/soc/ux500/ux500_pcm.h b/sound/soc/ux500/ux500_pcm.h
index 77ed44d371e9..76d344476afc 100644
--- a/sound/soc/ux500/ux500_pcm.h
+++ b/sound/soc/ux500/ux500_pcm.h
@@ -32,4 +32,7 @@
32#define UX500_PLATFORM_PERIODS_MAX 48 32#define UX500_PLATFORM_PERIODS_MAX 48
33#define UX500_PLATFORM_BUFFER_BYTES_MAX (2048 * PAGE_SIZE) 33#define UX500_PLATFORM_BUFFER_BYTES_MAX (2048 * PAGE_SIZE)
34 34
35int ux500_pcm_register_platform(struct platform_device *pdev);
36int ux500_pcm_unregister_platform(struct platform_device *pdev);
37
35#endif 38#endif
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..49f9af995d7a 100644
--- a/sound/usb/quirks-table.h
+++ b/sound/usb/quirks-table.h
@@ -1457,6 +1457,40 @@ YAMAHA_DEVICE(0x7010, "UB99"),
1457 } 1457 }
1458}, 1458},
1459{ 1459{
1460 /* Advanced mode of the Roland VG-99, with MIDI and 24-bit PCM at 44.1
1461 * kHz. In standard mode, the device has ID 0582:00b3, and offers
1462 * 16-bit PCM at 44.1 kHz with no MIDI.
1463 */
1464 USB_DEVICE(0x0582, 0x00b2),
1465 .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
1466 .vendor_name = "Roland",
1467 .product_name = "VG-99",
1468 .ifnum = QUIRK_ANY_INTERFACE,
1469 .type = QUIRK_COMPOSITE,
1470 .data = (const struct snd_usb_audio_quirk[]) {
1471 {
1472 .ifnum = 0,
1473 .type = QUIRK_AUDIO_STANDARD_INTERFACE
1474 },
1475 {
1476 .ifnum = 1,
1477 .type = QUIRK_AUDIO_STANDARD_INTERFACE
1478 },
1479 {
1480 .ifnum = 2,
1481 .type = QUIRK_MIDI_FIXED_ENDPOINT,
1482 .data = & (const struct snd_usb_midi_endpoint_info) {
1483 .out_cables = 0x0003,
1484 .in_cables = 0x0003
1485 }
1486 },
1487 {
1488 .ifnum = -1
1489 }
1490 }
1491 }
1492},
1493{
1460 /* Roland SonicCell */ 1494 /* Roland SonicCell */
1461 USB_DEVICE(0x0582, 0x00c2), 1495 USB_DEVICE(0x0582, 0x00c2),
1462 .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { 1496 .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
@@ -2163,6 +2197,77 @@ YAMAHA_DEVICE(0x7010, "UB99"),
2163 } 2197 }
2164}, 2198},
2165{ 2199{
2200 USB_DEVICE_VENDOR_SPEC(0x0763, 0x2030),
2201 .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) {
2202 /* .vendor_name = "M-Audio", */
2203 /* .product_name = "Fast Track C400", */
2204 .ifnum = QUIRK_ANY_INTERFACE,
2205 .type = QUIRK_COMPOSITE,
2206 .data = &(const struct snd_usb_audio_quirk[]) {
2207 {
2208 .ifnum = 1,
2209 .type = QUIRK_AUDIO_STANDARD_MIXER,
2210 },
2211 /* Playback */
2212 {
2213 .ifnum = 2,
2214 .type = QUIRK_AUDIO_FIXED_ENDPOINT,
2215 .data = &(const struct audioformat) {
2216 .formats = SNDRV_PCM_FMTBIT_S24_3LE,
2217 .channels = 6,
2218 .iface = 2,
2219 .altsetting = 1,
2220 .altset_idx = 1,
2221 .attributes = UAC_EP_CS_ATTR_SAMPLE_RATE,
2222 .endpoint = 0x01,
2223 .ep_attr = 0x09,
2224 .rates = SNDRV_PCM_RATE_44100 |
2225 SNDRV_PCM_RATE_48000 |
2226 SNDRV_PCM_RATE_88200 |
2227 SNDRV_PCM_RATE_96000,
2228 .rate_min = 44100,
2229 .rate_max = 96000,
2230 .nr_rates = 4,
2231 .rate_table = (unsigned int[]) {
2232 44100, 48000, 88200, 96000
2233 },
2234 .clock = 0x81,
2235 }
2236 },
2237 /* Capture */
2238 {
2239 .ifnum = 3,
2240 .type = QUIRK_AUDIO_FIXED_ENDPOINT,
2241 .data = &(const struct audioformat) {
2242 .formats = SNDRV_PCM_FMTBIT_S24_3LE,
2243 .channels = 4,
2244 .iface = 3,
2245 .altsetting = 1,
2246 .altset_idx = 1,
2247 .attributes = UAC_EP_CS_ATTR_SAMPLE_RATE,
2248 .endpoint = 0x81,
2249 .ep_attr = 0x05,
2250 .rates = SNDRV_PCM_RATE_44100 |
2251 SNDRV_PCM_RATE_48000 |
2252 SNDRV_PCM_RATE_88200 |
2253 SNDRV_PCM_RATE_96000,
2254 .rate_min = 44100,
2255 .rate_max = 96000,
2256 .nr_rates = 4,
2257 .rate_table = (unsigned int[]) {
2258 44100, 48000, 88200, 96000
2259 },
2260 .clock = 0x81,
2261 }
2262 },
2263 /* MIDI */
2264 {
2265 .ifnum = -1 /* Interface = 4 */
2266 }
2267 }
2268 }
2269},
2270{
2166 USB_DEVICE_VENDOR_SPEC(0x0763, 0x2080), 2271 USB_DEVICE_VENDOR_SPEC(0x0763, 0x2080),
2167 .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { 2272 .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
2168 /* .vendor_name = "M-Audio", */ 2273 /* .vendor_name = "M-Audio", */
@@ -2880,6 +2985,99 @@ YAMAHA_DEVICE(0x7010, "UB99"),
2880 } 2985 }
2881}, 2986},
2882 2987
2988/* Reloop Play */
2989{
2990 USB_DEVICE(0x200c, 0x100b),
2991 .bInterfaceClass = USB_CLASS_PER_INTERFACE,
2992 .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) {
2993 .ifnum = QUIRK_ANY_INTERFACE,
2994 .type = QUIRK_COMPOSITE,
2995 .data = &(const struct snd_usb_audio_quirk[]) {
2996 {
2997 .ifnum = 0,
2998 .type = QUIRK_AUDIO_STANDARD_MIXER,
2999 },
3000 {
3001 .ifnum = 1,
3002 .type = QUIRK_AUDIO_FIXED_ENDPOINT,
3003 .data = &(const struct audioformat) {
3004 .formats = SNDRV_PCM_FMTBIT_S24_3LE,
3005 .channels = 4,
3006 .iface = 1,
3007 .altsetting = 1,
3008 .altset_idx = 1,
3009 .attributes = UAC_EP_CS_ATTR_SAMPLE_RATE,
3010 .endpoint = 0x01,
3011 .ep_attr = USB_ENDPOINT_SYNC_ADAPTIVE,
3012 .rates = SNDRV_PCM_RATE_44100 |
3013 SNDRV_PCM_RATE_48000,
3014 .rate_min = 44100,
3015 .rate_max = 48000,
3016 .nr_rates = 2,
3017 .rate_table = (unsigned int[]) {
3018 44100, 48000
3019 }
3020 }
3021 },
3022 {
3023 .ifnum = -1
3024 }
3025 }
3026 }
3027},
3028
3029{
3030 /*
3031 * Focusrite Scarlett 18i6
3032 *
3033 * Avoid mixer creation, which otherwise fails because some of
3034 * the interface descriptor subtypes for interface 0 are
3035 * unknown. That should be fixed or worked-around but this at
3036 * least allows the device to be used successfully with a DAW
3037 * and an external mixer. See comments below about other
3038 * ignored interfaces.
3039 */
3040 USB_DEVICE(0x1235, 0x8004),
3041 .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
3042 .vendor_name = "Focusrite",
3043 .product_name = "Scarlett 18i6",
3044 .ifnum = QUIRK_ANY_INTERFACE,
3045 .type = QUIRK_COMPOSITE,
3046 .data = & (const struct snd_usb_audio_quirk[]) {
3047 {
3048 /* InterfaceSubClass 1 (Control Device) */
3049 .ifnum = 0,
3050 .type = QUIRK_IGNORE_INTERFACE
3051 },
3052 {
3053 .ifnum = 1,
3054 .type = QUIRK_AUDIO_STANDARD_INTERFACE
3055 },
3056 {
3057 .ifnum = 2,
3058 .type = QUIRK_AUDIO_STANDARD_INTERFACE
3059 },
3060 {
3061 /* InterfaceSubClass 1 (Control Device) */
3062 .ifnum = 3,
3063 .type = QUIRK_IGNORE_INTERFACE
3064 },
3065 {
3066 .ifnum = 4,
3067 .type = QUIRK_MIDI_STANDARD_INTERFACE
3068 },
3069 {
3070 /* InterfaceSubClass 1 (Device Firmware Update) */
3071 .ifnum = 5,
3072 .type = QUIRK_IGNORE_INTERFACE
3073 },
3074 {
3075 .ifnum = -1
3076 }
3077 }
3078 }
3079},
3080
2883{ 3081{
2884 /* 3082 /*
2885 * Some USB MIDI devices don't have an audio control interface, 3083 * Some USB MIDI devices don't have an audio control interface,
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};