aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc')
-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.c11
-rw-r--r--sound/soc/omap/mcbsp.h10
-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.c11
-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.c550
-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
281 files changed, 6755 insertions, 3051 deletions
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 22c6130957ba..713bd79428a9 100644
--- a/sound/soc/fsl/imx-pcm-fiq.c
+++ b/sound/soc/fsl/imx-pcm-fiq.c
@@ -282,7 +282,7 @@ static struct snd_soc_platform_driver imx_soc_platform_fiq = {
282 .pcm_free = imx_pcm_fiq_free, 282 .pcm_free = imx_pcm_fiq_free,
283}; 283};
284 284
285static int __devinit imx_soc_platform_probe(struct platform_device *pdev) 285static int imx_soc_platform_probe(struct platform_device *pdev)
286{ 286{
287 struct imx_ssi *ssi = platform_get_drvdata(pdev); 287 struct imx_ssi *ssi = platform_get_drvdata(pdev);
288 int ret; 288 int ret;
@@ -316,7 +316,7 @@ failed_register:
316 return ret; 316 return ret;
317} 317}
318 318
319static int __devexit imx_soc_platform_remove(struct platform_device *pdev) 319static int imx_soc_platform_remove(struct platform_device *pdev)
320{ 320{
321 snd_soc_unregister_platform(&pdev->dev); 321 snd_soc_unregister_platform(&pdev->dev);
322 return 0; 322 return 0;
@@ -329,7 +329,7 @@ static struct platform_driver imx_pcm_driver = {
329 }, 329 },
330 330
331 .probe = imx_soc_platform_probe, 331 .probe = imx_soc_platform_probe,
332 .remove = __devexit_p(imx_soc_platform_remove), 332 .remove = imx_soc_platform_remove,
333}; 333};
334 334
335module_platform_driver(imx_pcm_driver); 335module_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 006f7d465ed2..2c8d89eecdcf 100644
--- a/sound/soc/fsl/imx-ssi.c
+++ b/sound/soc/fsl/imx-ssi.c
@@ -639,7 +639,7 @@ failed_clk:
639 return ret; 639 return ret;
640} 640}
641 641
642static int __devexit imx_ssi_remove(struct platform_device *pdev) 642static int imx_ssi_remove(struct platform_device *pdev)
643{ 643{
644 struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 644 struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
645 struct imx_ssi *ssi = platform_get_drvdata(pdev); 645 struct imx_ssi *ssi = platform_get_drvdata(pdev);
@@ -660,7 +660,7 @@ static int __devexit imx_ssi_remove(struct platform_device *pdev)
660 660
661static struct platform_driver imx_ssi_driver = { 661static struct platform_driver imx_ssi_driver = {
662 .probe = imx_ssi_probe, 662 .probe = imx_ssi_probe,
663 .remove = __devexit_p(imx_ssi_remove), 663 .remove = imx_ssi_remove,
664 664
665 .driver = { 665 .driver = {
666 .name = "imx-ssi", 666 .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 afb8d4f1bedf..285c8368cb47 100644
--- a/sound/soc/omap/mcbsp.c
+++ b/sound/soc/omap/mcbsp.c
@@ -28,8 +28,6 @@
28 28
29#include <linux/platform_data/asoc-ti-mcbsp.h> 29#include <linux/platform_data/asoc-ti-mcbsp.h>
30 30
31#include <plat/cpu.h>
32
33#include "mcbsp.h" 31#include "mcbsp.h"
34 32
35static void omap_mcbsp_write(struct omap_mcbsp *mcbsp, u16 reg, u32 val) 33static void omap_mcbsp_write(struct omap_mcbsp *mcbsp, u16 reg, u32 val)
@@ -612,7 +610,7 @@ void omap_mcbsp_free(struct omap_mcbsp *mcbsp)
612 * system will refuse to enter idle if the CLKS pin source is not reset 610 * system will refuse to enter idle if the CLKS pin source is not reset
613 * back to internal source. 611 * back to internal source.
614 */ 612 */
615 if (!cpu_class_is_omap1()) 613 if (!mcbsp_omap1())
616 omap2_mcbsp_set_clks_src(mcbsp, MCBSP_CLKS_PRCM_SRC); 614 omap2_mcbsp_set_clks_src(mcbsp, MCBSP_CLKS_PRCM_SRC);
617 615
618 spin_lock(&mcbsp->lock); 616 spin_lock(&mcbsp->lock);
@@ -932,8 +930,7 @@ static const struct attribute_group sidetone_attr_group = {
932 .attrs = (struct attribute **)sidetone_attrs, 930 .attrs = (struct attribute **)sidetone_attrs,
933}; 931};
934 932
935static int __devinit omap_st_add(struct omap_mcbsp *mcbsp, 933static int omap_st_add(struct omap_mcbsp *mcbsp, struct resource *res)
936 struct resource *res)
937{ 934{
938 struct omap_mcbsp_st_data *st_data; 935 struct omap_mcbsp_st_data *st_data;
939 int err; 936 int err;
@@ -959,7 +956,7 @@ static int __devinit omap_st_add(struct omap_mcbsp *mcbsp,
959 * McBSP1 and McBSP3 are directly mapped on 1610 and 1510. 956 * McBSP1 and McBSP3 are directly mapped on 1610 and 1510.
960 * 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.
961 */ 958 */
962int __devinit omap_mcbsp_init(struct platform_device *pdev) 959int omap_mcbsp_init(struct platform_device *pdev)
963{ 960{
964 struct omap_mcbsp *mcbsp = platform_get_drvdata(pdev); 961 struct omap_mcbsp *mcbsp = platform_get_drvdata(pdev);
965 struct resource *res; 962 struct resource *res;
@@ -1087,7 +1084,7 @@ err_thres:
1087 return ret; 1084 return ret;
1088} 1085}
1089 1086
1090void __devexit omap_mcbsp_sysfs_remove(struct omap_mcbsp *mcbsp) 1087void omap_mcbsp_sysfs_remove(struct omap_mcbsp *mcbsp)
1091{ 1088{
1092 if (mcbsp->pdata->buffer_size) 1089 if (mcbsp->pdata->buffer_size)
1093 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 49a67259ce5a..f93e0b0af303 100644
--- a/sound/soc/omap/mcbsp.h
+++ b/sound/soc/omap/mcbsp.h
@@ -26,6 +26,12 @@
26 26
27#include "omap-pcm.h" 27#include "omap-pcm.h"
28 28
29#ifdef CONFIG_ARCH_OMAP1
30#define mcbsp_omap1() 1
31#else
32#define mcbsp_omap1() 0
33#endif
34
29/* McBSP register numbers. Register address offset = num * reg_step */ 35/* McBSP register numbers. Register address offset = num * reg_step */
30enum { 36enum {
31 /* Common registers */ 37 /* Common registers */
@@ -341,7 +347,7 @@ int omap_st_enable(struct omap_mcbsp *mcbsp);
341int omap_st_disable(struct omap_mcbsp *mcbsp); 347int omap_st_disable(struct omap_mcbsp *mcbsp);
342int omap_st_is_enabled(struct omap_mcbsp *mcbsp); 348int omap_st_is_enabled(struct omap_mcbsp *mcbsp);
343 349
344int __devinit omap_mcbsp_init(struct platform_device *pdev); 350int omap_mcbsp_init(struct platform_device *pdev);
345void __devexit omap_mcbsp_sysfs_remove(struct omap_mcbsp *mcbsp); 351void omap_mcbsp_sysfs_remove(struct omap_mcbsp *mcbsp);
346 352
347#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 a6ee15747859..8d2defd6fdbe 100644
--- a/sound/soc/omap/omap-mcbsp.c
+++ b/sound/soc/omap/omap-mcbsp.c
@@ -34,7 +34,6 @@
34#include <sound/initval.h> 34#include <sound/initval.h>
35#include <sound/soc.h> 35#include <sound/soc.h>
36 36
37#include <plat/cpu.h>
38#include <linux/platform_data/asoc-ti-mcbsp.h> 37#include <linux/platform_data/asoc-ti-mcbsp.h>
39#include "mcbsp.h" 38#include "mcbsp.h"
40#include "omap-mcbsp.h" 39#include "omap-mcbsp.h"
@@ -512,7 +511,7 @@ static int omap_mcbsp_dai_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
512 regs->srgr2 |= CLKSM; 511 regs->srgr2 |= CLKSM;
513 break; 512 break;
514 case OMAP_MCBSP_SYSCLK_CLKS_FCLK: 513 case OMAP_MCBSP_SYSCLK_CLKS_FCLK:
515 if (cpu_class_is_omap1()) { 514 if (mcbsp_omap1()) {
516 err = -EINVAL; 515 err = -EINVAL;
517 break; 516 break;
518 } 517 }
@@ -520,7 +519,7 @@ static int omap_mcbsp_dai_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
520 MCBSP_CLKS_PRCM_SRC); 519 MCBSP_CLKS_PRCM_SRC);
521 break; 520 break;
522 case OMAP_MCBSP_SYSCLK_CLKS_EXT: 521 case OMAP_MCBSP_SYSCLK_CLKS_EXT:
523 if (cpu_class_is_omap1()) { 522 if (mcbsp_omap1()) {
524 err = 0; 523 err = 0;
525 break; 524 break;
526 } 525 }
@@ -758,7 +757,7 @@ static const struct of_device_id omap_mcbsp_of_match[] = {
758}; 757};
759MODULE_DEVICE_TABLE(of, omap_mcbsp_of_match); 758MODULE_DEVICE_TABLE(of, omap_mcbsp_of_match);
760 759
761static __devinit int asoc_mcbsp_probe(struct platform_device *pdev) 760static int asoc_mcbsp_probe(struct platform_device *pdev)
762{ 761{
763 struct omap_mcbsp_platform_data *pdata = dev_get_platdata(&pdev->dev); 762 struct omap_mcbsp_platform_data *pdata = dev_get_platdata(&pdev->dev);
764 struct omap_mcbsp *mcbsp; 763 struct omap_mcbsp *mcbsp;
@@ -799,7 +798,7 @@ static __devinit int asoc_mcbsp_probe(struct platform_device *pdev)
799 return ret; 798 return ret;
800} 799}
801 800
802static int __devexit asoc_mcbsp_remove(struct platform_device *pdev) 801static int asoc_mcbsp_remove(struct platform_device *pdev)
803{ 802{
804 struct omap_mcbsp *mcbsp = platform_get_drvdata(pdev); 803 struct omap_mcbsp *mcbsp = platform_get_drvdata(pdev);
805 804
@@ -825,7 +824,7 @@ static struct platform_driver asoc_mcbsp_driver = {
825 }, 824 },
826 825
827 .probe = asoc_mcbsp_probe, 826 .probe = asoc_mcbsp_probe,
828 .remove = __devexit_p(asoc_mcbsp_remove), 827 .remove = asoc_mcbsp_remove,
829}; 828};
830 829
831module_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 340874ebf9ae..5f7e5b9c87a8 100644
--- a/sound/soc/omap/omap-pcm.c
+++ b/sound/soc/omap/omap-pcm.c
@@ -297,13 +297,13 @@ static struct snd_soc_platform_driver omap_soc_platform = {
297 .pcm_free = omap_pcm_free_dma_buffers, 297 .pcm_free = omap_pcm_free_dma_buffers,
298}; 298};
299 299
300static __devinit int omap_pcm_probe(struct platform_device *pdev) 300static int omap_pcm_probe(struct platform_device *pdev)
301{ 301{
302 return snd_soc_register_platform(&pdev->dev, 302 return snd_soc_register_platform(&pdev->dev,
303 &omap_soc_platform); 303 &omap_soc_platform);
304} 304}
305 305
306static int __devexit omap_pcm_remove(struct platform_device *pdev) 306static int omap_pcm_remove(struct platform_device *pdev)
307{ 307{
308 snd_soc_unregister_platform(&pdev->dev); 308 snd_soc_unregister_platform(&pdev->dev);
309 return 0; 309 return 0;
@@ -316,7 +316,7 @@ static struct platform_driver omap_pcm_driver = {
316 }, 316 },
317 317
318 .probe = omap_pcm_probe, 318 .probe = omap_pcm_probe,
319 .remove = __devexit_p(omap_pcm_remove), 319 .remove = omap_pcm_remove,
320}; 320};
321 321
322module_platform_driver(omap_pcm_driver); 322module_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 9d7f30774a44..a606d0f93d1c 100644
--- a/sound/soc/sh/fsi.c
+++ b/sound/soc/sh/fsi.c
@@ -22,6 +22,7 @@
22#include <linux/module.h> 22#include <linux/module.h>
23#include <linux/workqueue.h> 23#include <linux/workqueue.h>
24#include <sound/soc.h> 24#include <sound/soc.h>
25#include <sound/pcm_params.h>
25#include <sound/sh_fsi.h> 26#include <sound/sh_fsi.h>
26 27
27/* PortA/PortB register */ 28/* PortA/PortB register */
@@ -189,6 +190,14 @@ typedef int (*set_rate_func)(struct device *dev, int rate, int enable);
189 */ 190 */
190 191
191/* 192/*
193 * FSI clock
194 *
195 * FSIxCLK [CPG] (ick) -------> |
196 * |-> FSI_DIV (div)-> FSI2
197 * FSIxCK [external] (xck) ---> |
198 */
199
200/*
192 * struct 201 * struct
193 */ 202 */
194 203
@@ -228,6 +237,20 @@ struct fsi_stream {
228 dma_addr_t dma; 237 dma_addr_t dma;
229}; 238};
230 239
240struct fsi_clk {
241 /* see [FSI clock] */
242 struct clk *own;
243 struct clk *xck;
244 struct clk *ick;
245 struct clk *div;
246 int (*set_rate)(struct device *dev,
247 struct fsi_priv *fsi,
248 unsigned long rate);
249
250 unsigned long rate;
251 unsigned int count;
252};
253
231struct fsi_priv { 254struct fsi_priv {
232 void __iomem *base; 255 void __iomem *base;
233 struct fsi_master *master; 256 struct fsi_master *master;
@@ -236,11 +259,17 @@ struct fsi_priv {
236 struct fsi_stream playback; 259 struct fsi_stream playback;
237 struct fsi_stream capture; 260 struct fsi_stream capture;
238 261
262 struct fsi_clk clock;
263
239 u32 fmt; 264 u32 fmt;
240 265
241 int chan_num:16; 266 int chan_num:16;
242 int clk_master:1; 267 int clk_master:1;
268 int clk_cpg:1;
243 int spdif:1; 269 int spdif:1;
270 int enable_stream:1;
271 int bit_clk_inv:1;
272 int lr_clk_inv:1;
244 273
245 long rate; 274 long rate;
246}; 275};
@@ -370,6 +399,11 @@ static int fsi_is_spdif(struct fsi_priv *fsi)
370 return fsi->spdif; 399 return fsi->spdif;
371} 400}
372 401
402static int fsi_is_enable_stream(struct fsi_priv *fsi)
403{
404 return fsi->enable_stream;
405}
406
373static int fsi_is_play(struct snd_pcm_substream *substream) 407static int fsi_is_play(struct snd_pcm_substream *substream)
374{ 408{
375 return substream->stream == SNDRV_PCM_STREAM_PLAYBACK; 409 return substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
@@ -717,14 +751,335 @@ static void fsi_spdif_clk_ctrl(struct fsi_priv *fsi, int enable)
717/* 751/*
718 * clock function 752 * clock function
719 */ 753 */
754static int fsi_clk_init(struct device *dev,
755 struct fsi_priv *fsi,
756 int xck,
757 int ick,
758 int div,
759 int (*set_rate)(struct device *dev,
760 struct fsi_priv *fsi,
761 unsigned long rate))
762{
763 struct fsi_clk *clock = &fsi->clock;
764 int is_porta = fsi_is_port_a(fsi);
765
766 clock->xck = NULL;
767 clock->ick = NULL;
768 clock->div = NULL;
769 clock->rate = 0;
770 clock->count = 0;
771 clock->set_rate = set_rate;
772
773 clock->own = devm_clk_get(dev, NULL);
774 if (IS_ERR(clock->own))
775 return -EINVAL;
776
777 /* external clock */
778 if (xck) {
779 clock->xck = devm_clk_get(dev, is_porta ? "xcka" : "xckb");
780 if (IS_ERR(clock->xck)) {
781 dev_err(dev, "can't get xck clock\n");
782 return -EINVAL;
783 }
784 if (clock->xck == clock->own) {
785 dev_err(dev, "cpu doesn't support xck clock\n");
786 return -EINVAL;
787 }
788 }
789
790 /* FSIACLK/FSIBCLK */
791 if (ick) {
792 clock->ick = devm_clk_get(dev, is_porta ? "icka" : "ickb");
793 if (IS_ERR(clock->ick)) {
794 dev_err(dev, "can't get ick clock\n");
795 return -EINVAL;
796 }
797 if (clock->ick == clock->own) {
798 dev_err(dev, "cpu doesn't support ick clock\n");
799 return -EINVAL;
800 }
801 }
802
803 /* FSI-DIV */
804 if (div) {
805 clock->div = devm_clk_get(dev, is_porta ? "diva" : "divb");
806 if (IS_ERR(clock->div)) {
807 dev_err(dev, "can't get div clock\n");
808 return -EINVAL;
809 }
810 if (clock->div == clock->own) {
811 dev_err(dev, "cpu doens't support div clock\n");
812 return -EINVAL;
813 }
814 }
815
816 return 0;
817}
818
819#define fsi_clk_invalid(fsi) fsi_clk_valid(fsi, 0)
820static void fsi_clk_valid(struct fsi_priv *fsi, unsigned long rate)
821{
822 fsi->clock.rate = rate;
823}
824
825static int fsi_clk_is_valid(struct fsi_priv *fsi)
826{
827 return fsi->clock.set_rate &&
828 fsi->clock.rate;
829}
830
831static int fsi_clk_enable(struct device *dev,
832 struct fsi_priv *fsi,
833 unsigned long rate)
834{
835 struct fsi_clk *clock = &fsi->clock;
836 int ret = -EINVAL;
837
838 if (!fsi_clk_is_valid(fsi))
839 return ret;
840
841 if (0 == clock->count) {
842 ret = clock->set_rate(dev, fsi, rate);
843 if (ret < 0) {
844 fsi_clk_invalid(fsi);
845 return ret;
846 }
847
848 if (clock->xck)
849 clk_enable(clock->xck);
850 if (clock->ick)
851 clk_enable(clock->ick);
852 if (clock->div)
853 clk_enable(clock->div);
854
855 clock->count++;
856 }
857
858 return ret;
859}
860
861static int fsi_clk_disable(struct device *dev,
862 struct fsi_priv *fsi)
863{
864 struct fsi_clk *clock = &fsi->clock;
865
866 if (!fsi_clk_is_valid(fsi))
867 return -EINVAL;
868
869 if (1 == clock->count--) {
870 if (clock->xck)
871 clk_disable(clock->xck);
872 if (clock->ick)
873 clk_disable(clock->ick);
874 if (clock->div)
875 clk_disable(clock->div);
876 }
877
878 return 0;
879}
880
881static int fsi_clk_set_ackbpf(struct device *dev,
882 struct fsi_priv *fsi,
883 int ackmd, int bpfmd)
884{
885 u32 data = 0;
886
887 /* check ackmd/bpfmd relationship */
888 if (bpfmd > ackmd) {
889 dev_err(dev, "unsupported rate (%d/%d)\n", ackmd, bpfmd);
890 return -EINVAL;
891 }
892
893 /* ACKMD */
894 switch (ackmd) {
895 case 512:
896 data |= (0x0 << 12);
897 break;
898 case 256:
899 data |= (0x1 << 12);
900 break;
901 case 128:
902 data |= (0x2 << 12);
903 break;
904 case 64:
905 data |= (0x3 << 12);
906 break;
907 case 32:
908 data |= (0x4 << 12);
909 break;
910 default:
911 dev_err(dev, "unsupported ackmd (%d)\n", ackmd);
912 return -EINVAL;
913 }
914
915 /* BPFMD */
916 switch (bpfmd) {
917 case 32:
918 data |= (0x0 << 8);
919 break;
920 case 64:
921 data |= (0x1 << 8);
922 break;
923 case 128:
924 data |= (0x2 << 8);
925 break;
926 case 256:
927 data |= (0x3 << 8);
928 break;
929 case 512:
930 data |= (0x4 << 8);
931 break;
932 case 16:
933 data |= (0x7 << 8);
934 break;
935 default:
936 dev_err(dev, "unsupported bpfmd (%d)\n", bpfmd);
937 return -EINVAL;
938 }
939
940 dev_dbg(dev, "ACKMD/BPFMD = %d/%d\n", ackmd, bpfmd);
941
942 fsi_reg_mask_set(fsi, CKG1, (ACKMD_MASK | BPFMD_MASK) , data);
943 udelay(10);
944
945 return 0;
946}
947
948static int fsi_clk_set_rate_external(struct device *dev,
949 struct fsi_priv *fsi,
950 unsigned long rate)
951{
952 struct clk *xck = fsi->clock.xck;
953 struct clk *ick = fsi->clock.ick;
954 unsigned long xrate;
955 int ackmd, bpfmd;
956 int ret = 0;
957
958 /* check clock rate */
959 xrate = clk_get_rate(xck);
960 if (xrate % rate) {
961 dev_err(dev, "unsupported clock rate\n");
962 return -EINVAL;
963 }
964
965 clk_set_parent(ick, xck);
966 clk_set_rate(ick, xrate);
967
968 bpfmd = fsi->chan_num * 32;
969 ackmd = xrate / rate;
970
971 dev_dbg(dev, "external/rate = %ld/%ld\n", xrate, rate);
972
973 ret = fsi_clk_set_ackbpf(dev, fsi, ackmd, bpfmd);
974 if (ret < 0)
975 dev_err(dev, "%s failed", __func__);
976
977 return ret;
978}
979
980static int fsi_clk_set_rate_cpg(struct device *dev,
981 struct fsi_priv *fsi,
982 unsigned long rate)
983{
984 struct clk *ick = fsi->clock.ick;
985 struct clk *div = fsi->clock.div;
986 unsigned long target = 0; /* 12288000 or 11289600 */
987 unsigned long actual, cout;
988 unsigned long diff, min;
989 unsigned long best_cout, best_act;
990 int adj;
991 int ackmd, bpfmd;
992 int ret = -EINVAL;
993
994 if (!(12288000 % rate))
995 target = 12288000;
996 if (!(11289600 % rate))
997 target = 11289600;
998 if (!target) {
999 dev_err(dev, "unsupported rate\n");
1000 return ret;
1001 }
1002
1003 bpfmd = fsi->chan_num * 32;
1004 ackmd = target / rate;
1005 ret = fsi_clk_set_ackbpf(dev, fsi, ackmd, bpfmd);
1006 if (ret < 0) {
1007 dev_err(dev, "%s failed", __func__);
1008 return ret;
1009 }
1010
1011 /*
1012 * The clock flow is
1013 *
1014 * [CPG] = cout => [FSI_DIV] = audio => [FSI] => [codec]
1015 *
1016 * But, it needs to find best match of CPG and FSI_DIV
1017 * combination, since it is difficult to generate correct
1018 * frequency of audio clock from ick clock only.
1019 * Because ick is created from its parent clock.
1020 *
1021 * target = rate x [512/256/128/64]fs
1022 * cout = round(target x adjustment)
1023 * actual = cout / adjustment (by FSI-DIV) ~= target
1024 * audio = actual
1025 */
1026 min = ~0;
1027 best_cout = 0;
1028 best_act = 0;
1029 for (adj = 1; adj < 0xffff; adj++) {
1030
1031 cout = target * adj;
1032 if (cout > 100000000) /* max clock = 100MHz */
1033 break;
1034
1035 /* cout/actual audio clock */
1036 cout = clk_round_rate(ick, cout);
1037 actual = cout / adj;
1038
1039 /* find best frequency */
1040 diff = abs(actual - target);
1041 if (diff < min) {
1042 min = diff;
1043 best_cout = cout;
1044 best_act = actual;
1045 }
1046 }
1047
1048 ret = clk_set_rate(ick, best_cout);
1049 if (ret < 0) {
1050 dev_err(dev, "ick clock failed\n");
1051 return -EIO;
1052 }
1053
1054 ret = clk_set_rate(div, clk_round_rate(div, best_act));
1055 if (ret < 0) {
1056 dev_err(dev, "div clock failed\n");
1057 return -EIO;
1058 }
1059
1060 dev_dbg(dev, "ick/div = %ld/%ld\n",
1061 clk_get_rate(ick), clk_get_rate(div));
1062
1063 return ret;
1064}
1065
720static int fsi_set_master_clk(struct device *dev, struct fsi_priv *fsi, 1066static int fsi_set_master_clk(struct device *dev, struct fsi_priv *fsi,
721 long rate, int enable) 1067 long rate, int enable)
722{ 1068{
723 set_rate_func set_rate = fsi_get_info_set_rate(fsi); 1069 set_rate_func set_rate = fsi_get_info_set_rate(fsi);
724 int ret; 1070 int ret;
725 1071
726 if (!set_rate) 1072 /*
727 return 0; 1073 * CAUTION
1074 *
1075 * set_rate will be deleted
1076 */
1077 if (!set_rate) {
1078 if (enable)
1079 return fsi_clk_enable(dev, fsi, rate);
1080 else
1081 return fsi_clk_disable(dev, fsi);
1082 }
728 1083
729 ret = set_rate(dev, rate, enable); 1084 ret = set_rate(dev, rate, enable);
730 if (ret < 0) /* error */ 1085 if (ret < 0) /* error */
@@ -792,10 +1147,9 @@ static int fsi_set_master_clk(struct device *dev, struct fsi_priv *fsi,
792 */ 1147 */
793static 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)
794{ 1149{
795 u32 enable_stream = fsi_get_info_flags(fsi) & SH_FSI_ENABLE_STREAM_MODE;
796 int i; 1150 int i;
797 1151
798 if (enable_stream) { 1152 if (fsi_is_enable_stream(fsi)) {
799 /* 1153 /*
800 * stream mode 1154 * stream mode
801 * see 1155 * see
@@ -953,8 +1307,6 @@ static void fsi_pio_start_stop(struct fsi_priv *fsi, struct fsi_stream *io,
953 1307
954static 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)
955{ 1309{
956 u32 enable_stream = fsi_get_info_flags(fsi) & SH_FSI_ENABLE_STREAM_MODE;
957
958 /* 1310 /*
959 * we can use 16bit stream mode 1311 * we can use 16bit stream mode
960 * when "playback" and "16bit data" 1312 * when "playback" and "16bit data"
@@ -962,7 +1314,7 @@ static int fsi_pio_push_init(struct fsi_priv *fsi, struct fsi_stream *io)
962 * see 1314 * see
963 * fsi_pio_push16() 1315 * fsi_pio_push16()
964 */ 1316 */
965 if (enable_stream) 1317 if (fsi_is_enable_stream(fsi))
966 io->bus_option = BUSOP_SET(24, PACKAGE_24BITBUS_BACK) | 1318 io->bus_option = BUSOP_SET(24, PACKAGE_24BITBUS_BACK) |
967 BUSOP_SET(16, PACKAGE_16BITBUS_STREAM); 1319 BUSOP_SET(16, PACKAGE_16BITBUS_STREAM);
968 else 1320 else
@@ -1296,6 +1648,16 @@ static int fsi_hw_startup(struct fsi_priv *fsi,
1296 1648
1297 /* clock inversion (CKG2) */ 1649 /* clock inversion (CKG2) */
1298 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 */
1299 if (SH_FSI_LRM_INV & flags) 1661 if (SH_FSI_LRM_INV & flags)
1300 data |= 1 << 12; 1662 data |= 1 << 12;
1301 if (SH_FSI_BRM_INV & flags) 1663 if (SH_FSI_BRM_INV & flags)
@@ -1334,14 +1696,21 @@ static int fsi_hw_startup(struct fsi_priv *fsi,
1334 /* fifo init */ 1696 /* fifo init */
1335 fsi_fifo_init(fsi, io, dev); 1697 fsi_fifo_init(fsi, io, dev);
1336 1698
1699 /* start master clock */
1700 if (fsi_is_clk_master(fsi))
1701 return fsi_set_master_clk(dev, fsi, fsi->rate, 1);
1702
1337 return 0; 1703 return 0;
1338} 1704}
1339 1705
1340static void fsi_hw_shutdown(struct fsi_priv *fsi, 1706static int fsi_hw_shutdown(struct fsi_priv *fsi,
1341 struct device *dev) 1707 struct device *dev)
1342{ 1708{
1709 /* stop master clock */
1343 if (fsi_is_clk_master(fsi)) 1710 if (fsi_is_clk_master(fsi))
1344 fsi_set_master_clk(dev, fsi, fsi->rate, 0); 1711 return fsi_set_master_clk(dev, fsi, fsi->rate, 0);
1712
1713 return 0;
1345} 1714}
1346 1715
1347static int fsi_dai_startup(struct snd_pcm_substream *substream, 1716static int fsi_dai_startup(struct snd_pcm_substream *substream,
@@ -1349,6 +1718,7 @@ static int fsi_dai_startup(struct snd_pcm_substream *substream,
1349{ 1718{
1350 struct fsi_priv *fsi = fsi_get_priv(substream); 1719 struct fsi_priv *fsi = fsi_get_priv(substream);
1351 1720
1721 fsi_clk_invalid(fsi);
1352 fsi->rate = 0; 1722 fsi->rate = 0;
1353 1723
1354 return 0; 1724 return 0;
@@ -1359,6 +1729,7 @@ static void fsi_dai_shutdown(struct snd_pcm_substream *substream,
1359{ 1729{
1360 struct fsi_priv *fsi = fsi_get_priv(substream); 1730 struct fsi_priv *fsi = fsi_get_priv(substream);
1361 1731
1732 fsi_clk_invalid(fsi);
1362 fsi->rate = 0; 1733 fsi->rate = 0;
1363} 1734}
1364 1735
@@ -1372,13 +1743,16 @@ static int fsi_dai_trigger(struct snd_pcm_substream *substream, int cmd,
1372 switch (cmd) { 1743 switch (cmd) {
1373 case SNDRV_PCM_TRIGGER_START: 1744 case SNDRV_PCM_TRIGGER_START:
1374 fsi_stream_init(fsi, io, substream); 1745 fsi_stream_init(fsi, io, substream);
1375 fsi_hw_startup(fsi, io, dai->dev); 1746 if (!ret)
1376 ret = fsi_stream_transfer(io); 1747 ret = fsi_hw_startup(fsi, io, dai->dev);
1377 if (0 == ret) 1748 if (!ret)
1749 ret = fsi_stream_transfer(io);
1750 if (!ret)
1378 fsi_stream_start(fsi, io); 1751 fsi_stream_start(fsi, io);
1379 break; 1752 break;
1380 case SNDRV_PCM_TRIGGER_STOP: 1753 case SNDRV_PCM_TRIGGER_STOP:
1381 fsi_hw_shutdown(fsi, dai->dev); 1754 if (!ret)
1755 ret = fsi_hw_shutdown(fsi, dai->dev);
1382 fsi_stream_stop(fsi, io); 1756 fsi_stream_stop(fsi, io);
1383 fsi_stream_quit(fsi, io); 1757 fsi_stream_quit(fsi, io);
1384 break; 1758 break;
@@ -1414,7 +1788,6 @@ static int fsi_set_fmt_spdif(struct fsi_priv *fsi)
1414 1788
1415 fsi->fmt = CR_DTMD_SPDIF_PCM | CR_PCM; 1789 fsi->fmt = CR_DTMD_SPDIF_PCM | CR_PCM;
1416 fsi->chan_num = 2; 1790 fsi->chan_num = 2;
1417 fsi->spdif = 1;
1418 1791
1419 return 0; 1792 return 0;
1420} 1793}
@@ -1423,7 +1796,6 @@ static int fsi_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
1423{ 1796{
1424 struct fsi_priv *fsi = fsi_get_priv_frm_dai(dai); 1797 struct fsi_priv *fsi = fsi_get_priv_frm_dai(dai);
1425 set_rate_func set_rate = fsi_get_info_set_rate(fsi); 1798 set_rate_func set_rate = fsi_get_info_set_rate(fsi);
1426 u32 flags = fsi_get_info_flags(fsi);
1427 int ret; 1799 int ret;
1428 1800
1429 /* set master/slave audio interface */ 1801 /* set master/slave audio interface */
@@ -1437,23 +1809,50 @@ static int fsi_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
1437 return -EINVAL; 1809 return -EINVAL;
1438 } 1810 }
1439 1811
1440 if (fsi_is_clk_master(fsi) && !set_rate) { 1812 /* set clock inversion */
1441 dev_err(dai->dev, "platform doesn't have set_rate\n"); 1813 switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
1442 return -EINVAL; 1814 case SND_SOC_DAIFMT_NB_IF:
1443 } 1815 fsi->bit_clk_inv = 0;
1444 1816 fsi->lr_clk_inv = 1;
1445 /* set format */
1446 switch (flags & SH_FSI_FMT_MASK) {
1447 case SH_FSI_FMT_DAI:
1448 ret = fsi_set_fmt_dai(fsi, fmt & SND_SOC_DAIFMT_FORMAT_MASK);
1449 break; 1817 break;
1450 case SH_FSI_FMT_SPDIF: 1818 case SND_SOC_DAIFMT_IB_NF:
1451 ret = fsi_set_fmt_spdif(fsi); 1819 fsi->bit_clk_inv = 1;
1820 fsi->lr_clk_inv = 0;
1452 break; 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:
1453 default: 1827 default:
1454 ret = -EINVAL; 1828 fsi->bit_clk_inv = 0;
1829 fsi->lr_clk_inv = 0;
1830 break;
1831 }
1832
1833 if (fsi_is_clk_master(fsi)) {
1834 /*
1835 * CAUTION
1836 *
1837 * set_rate will be deleted
1838 */
1839 if (set_rate)
1840 dev_warn(dai->dev, "set_rate will be removed soon\n");
1841
1842 if (fsi->clk_cpg)
1843 fsi_clk_init(dai->dev, fsi, 0, 1, 1,
1844 fsi_clk_set_rate_cpg);
1845 else
1846 fsi_clk_init(dai->dev, fsi, 1, 1, 0,
1847 fsi_clk_set_rate_external);
1455 } 1848 }
1456 1849
1850 /* set format */
1851 if (fsi_is_spdif(fsi))
1852 ret = fsi_set_fmt_spdif(fsi);
1853 else
1854 ret = fsi_set_fmt_dai(fsi, fmt & SND_SOC_DAIFMT_FORMAT_MASK);
1855
1457 return ret; 1856 return ret;
1458} 1857}
1459 1858
@@ -1462,19 +1861,13 @@ static int fsi_dai_hw_params(struct snd_pcm_substream *substream,
1462 struct snd_soc_dai *dai) 1861 struct snd_soc_dai *dai)
1463{ 1862{
1464 struct fsi_priv *fsi = fsi_get_priv(substream); 1863 struct fsi_priv *fsi = fsi_get_priv(substream);
1465 long rate = params_rate(params);
1466 int ret;
1467 1864
1468 if (!fsi_is_clk_master(fsi)) 1865 if (fsi_is_clk_master(fsi)) {
1469 return 0; 1866 fsi->rate = params_rate(params);
1470 1867 fsi_clk_valid(fsi, fsi->rate);
1471 ret = fsi_set_master_clk(dai->dev, fsi, rate, 1); 1868 }
1472 if (ret < 0)
1473 return ret;
1474
1475 fsi->rate = rate;
1476 1869
1477 return ret; 1870 return 0;
1478} 1871}
1479 1872
1480static const struct snd_soc_dai_ops fsi_dai_ops = { 1873static const struct snd_soc_dai_ops fsi_dai_ops = {
@@ -1498,7 +1891,7 @@ static struct snd_pcm_hardware fsi_pcm_hardware = {
1498 .rates = FSI_RATES, 1891 .rates = FSI_RATES,
1499 .rate_min = 8000, 1892 .rate_min = 8000,
1500 .rate_max = 192000, 1893 .rate_max = 192000,
1501 .channels_min = 1, 1894 .channels_min = 2,
1502 .channels_max = 2, 1895 .channels_max = 2,
1503 .buffer_bytes_max = 64 * 1024, 1896 .buffer_bytes_max = 64 * 1024,
1504 .period_bytes_min = 32, 1897 .period_bytes_min = 32,
@@ -1586,14 +1979,14 @@ static struct snd_soc_dai_driver fsi_soc_dai[] = {
1586 .playback = { 1979 .playback = {
1587 .rates = FSI_RATES, 1980 .rates = FSI_RATES,
1588 .formats = FSI_FMTS, 1981 .formats = FSI_FMTS,
1589 .channels_min = 1, 1982 .channels_min = 2,
1590 .channels_max = 8, 1983 .channels_max = 2,
1591 }, 1984 },
1592 .capture = { 1985 .capture = {
1593 .rates = FSI_RATES, 1986 .rates = FSI_RATES,
1594 .formats = FSI_FMTS, 1987 .formats = FSI_FMTS,
1595 .channels_min = 1, 1988 .channels_min = 2,
1596 .channels_max = 8, 1989 .channels_max = 2,
1597 }, 1990 },
1598 .ops = &fsi_dai_ops, 1991 .ops = &fsi_dai_ops,
1599 }, 1992 },
@@ -1602,14 +1995,14 @@ static struct snd_soc_dai_driver fsi_soc_dai[] = {
1602 .playback = { 1995 .playback = {
1603 .rates = FSI_RATES, 1996 .rates = FSI_RATES,
1604 .formats = FSI_FMTS, 1997 .formats = FSI_FMTS,
1605 .channels_min = 1, 1998 .channels_min = 2,
1606 .channels_max = 8, 1999 .channels_max = 2,
1607 }, 2000 },
1608 .capture = { 2001 .capture = {
1609 .rates = FSI_RATES, 2002 .rates = FSI_RATES,
1610 .formats = FSI_FMTS, 2003 .formats = FSI_FMTS,
1611 .channels_min = 1, 2004 .channels_min = 2,
1612 .channels_max = 8, 2005 .channels_max = 2,
1613 }, 2006 },
1614 .ops = &fsi_dai_ops, 2007 .ops = &fsi_dai_ops,
1615 }, 2008 },
@@ -1624,15 +2017,29 @@ static struct snd_soc_platform_driver fsi_soc_platform = {
1624/* 2017/*
1625 * platform function 2018 * platform function
1626 */ 2019 */
1627static 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)
1628{ 2035{
1629 fsi->playback.handler = &fsi_pio_push_handler; /* default PIO */ 2036 fsi->playback.handler = &fsi_pio_push_handler; /* default PIO */
1630 fsi->playback.priv = fsi; 2037 fsi->playback.priv = fsi;
1631 fsi->capture.handler = &fsi_pio_pop_handler; /* default PIO */ 2038 fsi->capture.handler = &fsi_pio_pop_handler; /* default PIO */
1632 fsi->capture.priv = fsi; 2039 fsi->capture.priv = fsi;
1633 2040
1634 if (fsi->info->tx_id) { 2041 if (info->tx_id) {
1635 fsi->playback.slave.shdma_slave.slave_id = fsi->info->tx_id; 2042 fsi->playback.slave.shdma_slave.slave_id = info->tx_id;
1636 fsi->playback.handler = &fsi_dma_push_handler; 2043 fsi->playback.handler = &fsi_dma_push_handler;
1637 } 2044 }
1638} 2045}
@@ -1642,10 +2049,16 @@ static int fsi_probe(struct platform_device *pdev)
1642 struct fsi_master *master; 2049 struct fsi_master *master;
1643 const struct platform_device_id *id_entry; 2050 const struct platform_device_id *id_entry;
1644 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;
1645 struct resource *res; 2054 struct resource *res;
1646 unsigned int irq; 2055 unsigned int irq;
1647 int ret; 2056 int ret;
1648 2057
2058 nul_info.flags = 0;
2059 nul_info.tx_id = 0;
2060 nul_info.rx_id = 0;
2061
1649 id_entry = pdev->id_entry; 2062 id_entry = pdev->id_entry;
1650 if (!id_entry) { 2063 if (!id_entry) {
1651 dev_err(&pdev->dev, "unknown fsi device\n"); 2064 dev_err(&pdev->dev, "unknown fsi device\n");
@@ -1678,22 +2091,28 @@ static int fsi_probe(struct platform_device *pdev)
1678 spin_lock_init(&master->lock); 2091 spin_lock_init(&master->lock);
1679 2092
1680 /* FSI A setting */ 2093 /* FSI A setting */
1681 master->fsia.base = master->base; 2094 pinfo = (info) ? &info->port_a : &nul_info;
1682 master->fsia.master = master; 2095 fsi = &master->fsia;
1683 master->fsia.info = &info->port_a; 2096 fsi->base = master->base;
1684 fsi_handler_init(&master->fsia); 2097 fsi->master = master;
1685 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);
1686 if (ret < 0) { 2102 if (ret < 0) {
1687 dev_err(&pdev->dev, "FSIA stream probe failed\n"); 2103 dev_err(&pdev->dev, "FSIA stream probe failed\n");
1688 return ret; 2104 return ret;
1689 } 2105 }
1690 2106
1691 /* FSI B setting */ 2107 /* FSI B setting */
1692 master->fsib.base = master->base + 0x40; 2108 pinfo = (info) ? &info->port_b : &nul_info;
1693 master->fsib.master = master; 2109 fsi = &master->fsib;
1694 master->fsib.info = &info->port_b; 2110 fsi->base = master->base + 0x40;
1695 fsi_handler_init(&master->fsib); 2111 fsi->master = master;
1696 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);
1697 if (ret < 0) { 2116 if (ret < 0) {
1698 dev_err(&pdev->dev, "FSIB stream probe failed\n"); 2117 dev_err(&pdev->dev, "FSIB stream probe failed\n");
1699 goto exit_fsia; 2118 goto exit_fsia;
@@ -1702,7 +2121,7 @@ static int fsi_probe(struct platform_device *pdev)
1702 pm_runtime_enable(&pdev->dev); 2121 pm_runtime_enable(&pdev->dev);
1703 dev_set_drvdata(&pdev->dev, master); 2122 dev_set_drvdata(&pdev->dev, master);
1704 2123
1705 ret = request_irq(irq, &fsi_interrupt, 0, 2124 ret = devm_request_irq(&pdev->dev, irq, &fsi_interrupt, 0,
1706 id_entry->name, master); 2125 id_entry->name, master);
1707 if (ret) { 2126 if (ret) {
1708 dev_err(&pdev->dev, "irq request err\n"); 2127 dev_err(&pdev->dev, "irq request err\n");
@@ -1712,7 +2131,7 @@ static int fsi_probe(struct platform_device *pdev)
1712 ret = snd_soc_register_platform(&pdev->dev, &fsi_soc_platform); 2131 ret = snd_soc_register_platform(&pdev->dev, &fsi_soc_platform);
1713 if (ret < 0) { 2132 if (ret < 0) {
1714 dev_err(&pdev->dev, "cannot snd soc register\n"); 2133 dev_err(&pdev->dev, "cannot snd soc register\n");
1715 goto exit_free_irq; 2134 goto exit_fsib;
1716 } 2135 }
1717 2136
1718 ret = snd_soc_register_dais(&pdev->dev, fsi_soc_dai, 2137 ret = snd_soc_register_dais(&pdev->dev, fsi_soc_dai,
@@ -1726,8 +2145,6 @@ static int fsi_probe(struct platform_device *pdev)
1726 2145
1727exit_snd_soc: 2146exit_snd_soc:
1728 snd_soc_unregister_platform(&pdev->dev); 2147 snd_soc_unregister_platform(&pdev->dev);
1729exit_free_irq:
1730 free_irq(irq, master);
1731exit_fsib: 2148exit_fsib:
1732 pm_runtime_disable(&pdev->dev); 2149 pm_runtime_disable(&pdev->dev);
1733 fsi_stream_remove(&master->fsib); 2150 fsi_stream_remove(&master->fsib);
@@ -1743,7 +2160,6 @@ static int fsi_remove(struct platform_device *pdev)
1743 2160
1744 master = dev_get_drvdata(&pdev->dev); 2161 master = dev_get_drvdata(&pdev->dev);
1745 2162
1746 free_irq(master->irq, master);
1747 pm_runtime_disable(&pdev->dev); 2163 pm_runtime_disable(&pdev->dev);
1748 2164
1749 snd_soc_unregister_dais(&pdev->dev, ARRAY_SIZE(fsi_soc_dai)); 2165 snd_soc_unregister_dais(&pdev->dev, ARRAY_SIZE(fsi_soc_dai));
@@ -1774,10 +2190,6 @@ static void __fsi_resume(struct fsi_priv *fsi,
1774 return; 2190 return;
1775 2191
1776 fsi_hw_startup(fsi, io, dev); 2192 fsi_hw_startup(fsi, io, dev);
1777
1778 if (fsi_is_clk_master(fsi) && fsi->rate)
1779 fsi_set_master_clk(dev, fsi, fsi->rate, 1);
1780
1781 fsi_stream_start(fsi, io); 2193 fsi_stream_start(fsi, io);
1782} 2194}
1783 2195
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 bf5610122c76..fd596d2a19b4 100644
--- a/sound/soc/tegra/tegra30_ahub.c
+++ b/sound/soc/tegra/tegra30_ahub.c
@@ -288,7 +288,7 @@ int tegra30_ahub_unset_rx_cif_source(enum tegra30_ahub_rxcif rxcif)
288} 288}
289EXPORT_SYMBOL_GPL(tegra30_ahub_unset_rx_cif_source); 289EXPORT_SYMBOL_GPL(tegra30_ahub_unset_rx_cif_source);
290 290
291static const char * const configlink_clocks[] __devinitconst = { 291static const char * const configlink_clocks[] = {
292 "i2s0", 292 "i2s0",
293 "i2s1", 293 "i2s1",
294 "i2s2", 294 "i2s2",
@@ -300,7 +300,7 @@ static const char * const configlink_clocks[] __devinitconst = {
300 "spdif_in", 300 "spdif_in",
301}; 301};
302 302
303struct of_dev_auxdata ahub_auxdata[] __devinitdata = { 303struct of_dev_auxdata ahub_auxdata[] = {
304 OF_DEV_AUXDATA("nvidia,tegra30-i2s", 0x70080300, "tegra30-i2s.0", NULL), 304 OF_DEV_AUXDATA("nvidia,tegra30-i2s", 0x70080300, "tegra30-i2s.0", NULL),
305 OF_DEV_AUXDATA("nvidia,tegra30-i2s", 0x70080400, "tegra30-i2s.1", NULL), 305 OF_DEV_AUXDATA("nvidia,tegra30-i2s", 0x70080400, "tegra30-i2s.1", NULL),
306 OF_DEV_AUXDATA("nvidia,tegra30-i2s", 0x70080500, "tegra30-i2s.2", NULL), 306 OF_DEV_AUXDATA("nvidia,tegra30-i2s", 0x70080500, "tegra30-i2s.2", NULL),
@@ -434,7 +434,7 @@ static const struct regmap_config tegra30_ahub_ahub_regmap_config = {
434 .cache_type = REGCACHE_RBTREE, 434 .cache_type = REGCACHE_RBTREE,
435}; 435};
436 436
437static int __devinit tegra30_ahub_probe(struct platform_device *pdev) 437static int tegra30_ahub_probe(struct platform_device *pdev)
438{ 438{
439 struct clk *clk; 439 struct clk *clk;
440 int i; 440 int i;
@@ -586,7 +586,7 @@ err:
586 return ret; 586 return ret;
587} 587}
588 588
589static int __devexit tegra30_ahub_remove(struct platform_device *pdev) 589static int tegra30_ahub_remove(struct platform_device *pdev)
590{ 590{
591 if (!ahub) 591 if (!ahub)
592 return -ENODEV; 592 return -ENODEV;
@@ -603,19 +603,19 @@ static int __devexit tegra30_ahub_remove(struct platform_device *pdev)
603 return 0; 603 return 0;
604} 604}
605 605
606static const struct of_device_id tegra30_ahub_of_match[] __devinitconst = { 606static const struct of_device_id tegra30_ahub_of_match[] = {
607 { .compatible = "nvidia,tegra30-ahub", }, 607 { .compatible = "nvidia,tegra30-ahub", },
608 {}, 608 {},
609}; 609};
610 610
611static const struct dev_pm_ops tegra30_ahub_pm_ops __devinitconst = { 611static const struct dev_pm_ops tegra30_ahub_pm_ops = {
612 SET_RUNTIME_PM_OPS(tegra30_ahub_runtime_suspend, 612 SET_RUNTIME_PM_OPS(tegra30_ahub_runtime_suspend,
613 tegra30_ahub_runtime_resume, NULL) 613 tegra30_ahub_runtime_resume, NULL)
614}; 614};
615 615
616static struct platform_driver tegra30_ahub_driver = { 616static struct platform_driver tegra30_ahub_driver = {
617 .probe = tegra30_ahub_probe, 617 .probe = tegra30_ahub_probe,
618 .remove = __devexit_p(tegra30_ahub_remove), 618 .remove = tegra30_ahub_remove,
619 .driver = { 619 .driver = {
620 .name = DRV_NAME, 620 .name = DRV_NAME,
621 .owner = THIS_MODULE, 621 .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 1a04e248453c..c6821a5ab0fb 100644
--- a/sound/soc/ux500/ux500_pcm.c
+++ b/sound/soc/ux500/ux500_pcm.c
@@ -282,7 +282,7 @@ static struct snd_soc_platform_driver ux500_pcm_soc_drv = {
282 .pcm_new = ux500_pcm_new, 282 .pcm_new = ux500_pcm_new,
283}; 283};
284 284
285static int __devexit ux500_pcm_drv_probe(struct platform_device *pdev) 285int ux500_pcm_register_platform(struct platform_device *pdev)
286{ 286{
287 int ret; 287 int ret;
288 288
@@ -296,23 +296,12 @@ static int __devexit ux500_pcm_drv_probe(struct platform_device *pdev)
296 296
297 return 0; 297 return 0;
298} 298}
299EXPORT_SYMBOL_GPL(ux500_pcm_register_platform);
299 300
300static int __devinit ux500_pcm_drv_remove(struct platform_device *pdev) 301int ux500_pcm_unregister_platform(struct platform_device *pdev)
301{ 302{
302 snd_soc_unregister_platform(&pdev->dev); 303 snd_soc_unregister_platform(&pdev->dev);
303 304
304 return 0; 305 return 0;
305} 306}
306 307EXPORT_SYMBOL_GPL(ux500_pcm_unregister_platform);
307static struct platform_driver ux500_pcm_driver = {
308 .driver = {
309 .name = "ux500-pcm",
310 .owner = THIS_MODULE,
311 },
312
313 .probe = ux500_pcm_drv_probe,
314 .remove = __devexit_p(ux500_pcm_drv_remove),
315};
316module_platform_driver(ux500_pcm_driver);
317
318MODULE_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