aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
Diffstat (limited to 'sound')
-rw-r--r--sound/ppc/snd_ps3.c2
-rw-r--r--sound/soc/Kconfig15
-rw-r--r--sound/soc/atmel/Kconfig2
-rw-r--r--sound/soc/atmel/atmel-pcm.c17
-rw-r--r--sound/soc/atmel/atmel_ssc_dai.c14
-rw-r--r--sound/soc/atmel/sam9g20_wm8731.c1
-rw-r--r--sound/soc/atmel/snd-soc-afeb9260.c1
-rw-r--r--sound/soc/au1x/ac97c.c42
-rw-r--r--sound/soc/au1x/db1000.c14
-rw-r--r--sound/soc/au1x/db1200.c15
-rw-r--r--sound/soc/au1x/dbdma2.c29
-rw-r--r--sound/soc/au1x/dma.c27
-rw-r--r--sound/soc/au1x/i2sc.c58
-rw-r--r--sound/soc/au1x/psc-ac97.c43
-rw-r--r--sound/soc/au1x/psc-i2s.c57
-rw-r--r--sound/soc/blackfin/bf5xx-ac97-pcm.c17
-rw-r--r--sound/soc/blackfin/bf5xx-ac97.c13
-rw-r--r--sound/soc/blackfin/bf5xx-ad1836.c1
-rw-r--r--sound/soc/blackfin/bf5xx-ad193x.c1
-rw-r--r--sound/soc/blackfin/bf5xx-ad1980.c1
-rw-r--r--sound/soc/blackfin/bf5xx-ad73311.c1
-rw-r--r--sound/soc/blackfin/bf5xx-i2s-pcm.c17
-rw-r--r--sound/soc/blackfin/bf5xx-i2s.c15
-rw-r--r--sound/soc/blackfin/bf5xx-ssm2602.c1
-rw-r--r--sound/soc/blackfin/bf5xx-tdm-pcm.c17
-rw-r--r--sound/soc/blackfin/bf5xx-tdm.c14
-rw-r--r--sound/soc/blackfin/bfin-eval-adau1373.c13
-rw-r--r--sound/soc/blackfin/bfin-eval-adau1701.c13
-rw-r--r--sound/soc/blackfin/bfin-eval-adav80x.c13
-rw-r--r--sound/soc/codecs/88pm860x-codec.c38
-rw-r--r--sound/soc/codecs/Kconfig27
-rw-r--r--sound/soc/codecs/Makefile22
-rw-r--r--sound/soc/codecs/ac97.c16
-rw-r--r--sound/soc/codecs/ad1836.c11
-rw-r--r--sound/soc/codecs/ad193x.c209
-rw-r--r--sound/soc/codecs/ad193x.h17
-rw-r--r--sound/soc/codecs/ad1980.c12
-rw-r--r--sound/soc/codecs/ad73311.c12
-rw-r--r--sound/soc/codecs/adau1373.c8
-rw-r--r--sound/soc/codecs/adau1701.c8
-rw-r--r--sound/soc/codecs/adav80x.c2
-rw-r--r--sound/soc/codecs/ads117x.c12
-rw-r--r--sound/soc/codecs/ak4104.c8
-rw-r--r--sound/soc/codecs/ak4535.c11
-rw-r--r--sound/soc/codecs/ak4641.c21
-rw-r--r--sound/soc/codecs/ak4642.c148
-rw-r--r--sound/soc/codecs/ak4671.c8
-rw-r--r--sound/soc/codecs/alc5623.c28
-rw-r--r--sound/soc/codecs/alc5632.c1159
-rw-r--r--sound/soc/codecs/alc5632.h251
-rw-r--r--sound/soc/codecs/cq93vc.c14
-rw-r--r--sound/soc/codecs/cs4270.c11
-rw-r--r--sound/soc/codecs/cs4271.c4
-rw-r--r--sound/soc/codecs/cs42l51.c41
-rw-r--r--sound/soc/codecs/cs42l73.c1453
-rw-r--r--sound/soc/codecs/cs42l73.h227
-rw-r--r--sound/soc/codecs/cx20442.c60
-rw-r--r--sound/soc/codecs/da7210.c91
-rw-r--r--sound/soc/codecs/dfbmcs320.c12
-rw-r--r--sound/soc/codecs/dmic.c12
-rw-r--r--sound/soc/codecs/jz4740.c29
-rw-r--r--sound/soc/codecs/lm4857.c13
-rw-r--r--sound/soc/codecs/max98088.c13
-rw-r--r--sound/soc/codecs/max98095.c16
-rw-r--r--sound/soc/codecs/max9850.c27
-rw-r--r--sound/soc/codecs/pcm3008.c14
-rw-r--r--sound/soc/codecs/rt5631.c12
-rw-r--r--sound/soc/codecs/sgtl5000.c21
-rw-r--r--sound/soc/codecs/sigmadsp.c246
-rw-r--r--sound/soc/codecs/sigmadsp.h21
-rw-r--r--sound/soc/codecs/sn95031.c22
-rw-r--r--sound/soc/codecs/spdif_transciever.c13
-rw-r--r--sound/soc/codecs/ssm2602.c17
-rw-r--r--sound/soc/codecs/sta32x.c103
-rw-r--r--sound/soc/codecs/stac9766.c21
-rw-r--r--sound/soc/codecs/tlv320aic23.c11
-rw-r--r--sound/soc/codecs/tlv320aic26.c10
-rw-r--r--sound/soc/codecs/tlv320aic32x4.c11
-rw-r--r--sound/soc/codecs/tlv320aic3x.c57
-rw-r--r--sound/soc/codecs/tlv320dac33.c11
-rw-r--r--sound/soc/codecs/tpa6130a2.c5
-rw-r--r--sound/soc/codecs/twl4030.c18
-rw-r--r--sound/soc/codecs/twl6040.c39
-rw-r--r--sound/soc/codecs/twl6040.h1
-rw-r--r--sound/soc/codecs/uda134x.c17
-rw-r--r--sound/soc/codecs/uda1380.c70
-rw-r--r--sound/soc/codecs/wl1273.c14
-rw-r--r--sound/soc/codecs/wm1250-ev1.c10
-rw-r--r--sound/soc/codecs/wm2000.c227
-rw-r--r--sound/soc/codecs/wm2000.h7
-rw-r--r--sound/soc/codecs/wm5100-tables.c1489
-rw-r--r--sound/soc/codecs/wm5100.c415
-rw-r--r--sound/soc/codecs/wm5100.h7
-rw-r--r--sound/soc/codecs/wm8350.c63
-rw-r--r--sound/soc/codecs/wm8400.c60
-rw-r--r--sound/soc/codecs/wm8510.c30
-rw-r--r--sound/soc/codecs/wm8523.c5
-rw-r--r--sound/soc/codecs/wm8580.c37
-rw-r--r--sound/soc/codecs/wm8711.c10
-rw-r--r--sound/soc/codecs/wm8727.c14
-rw-r--r--sound/soc/codecs/wm8728.c9
-rw-r--r--sound/soc/codecs/wm8731.c10
-rw-r--r--sound/soc/codecs/wm8737.c5
-rw-r--r--sound/soc/codecs/wm8741.c43
-rw-r--r--sound/soc/codecs/wm8750.c40
-rw-r--r--sound/soc/codecs/wm8753.c31
-rw-r--r--sound/soc/codecs/wm8770.c18
-rw-r--r--sound/soc/codecs/wm8776.c36
-rw-r--r--sound/soc/codecs/wm8782.c12
-rw-r--r--sound/soc/codecs/wm8804.c11
-rw-r--r--sound/soc/codecs/wm8900.c35
-rw-r--r--sound/soc/codecs/wm8903.c664
-rw-r--r--sound/soc/codecs/wm8904.c9
-rw-r--r--sound/soc/codecs/wm8940.c11
-rw-r--r--sound/soc/codecs/wm8955.c7
-rw-r--r--sound/soc/codecs/wm8958-dsp2.c5
-rw-r--r--sound/soc/codecs/wm8960.c91
-rw-r--r--sound/soc/codecs/wm8961.c40
-rw-r--r--sound/soc/codecs/wm8962.c1646
-rw-r--r--sound/soc/codecs/wm8971.c9
-rw-r--r--sound/soc/codecs/wm8974.c9
-rw-r--r--sound/soc/codecs/wm8978.c5
-rw-r--r--sound/soc/codecs/wm8983.c7
-rw-r--r--sound/soc/codecs/wm8985.c7
-rw-r--r--sound/soc/codecs/wm8988.c9
-rw-r--r--sound/soc/codecs/wm8990.c11
-rw-r--r--sound/soc/codecs/wm8991.c9
-rw-r--r--sound/soc/codecs/wm8993.c35
-rw-r--r--sound/soc/codecs/wm8994-tables.c3147
-rw-r--r--sound/soc/codecs/wm8994.c671
-rw-r--r--sound/soc/codecs/wm8994.h21
-rw-r--r--sound/soc/codecs/wm8995.c732
-rw-r--r--sound/soc/codecs/wm8996.c946
-rw-r--r--sound/soc/codecs/wm9081.c368
-rw-r--r--sound/soc/codecs/wm9090.c22
-rw-r--r--sound/soc/codecs/wm9705.c16
-rw-r--r--sound/soc/codecs/wm9712.c19
-rw-r--r--sound/soc/codecs/wm9713.c21
-rw-r--r--sound/soc/codecs/wm_hubs.c8
-rw-r--r--sound/soc/davinci/davinci-evm.c6
-rw-r--r--sound/soc/davinci/davinci-i2s.c53
-rw-r--r--sound/soc/davinci/davinci-mcasp.c54
-rw-r--r--sound/soc/davinci/davinci-pcm.c17
-rw-r--r--sound/soc/davinci/davinci-sffsdr.c1
-rw-r--r--sound/soc/davinci/davinci-vcif.c28
-rw-r--r--sound/soc/ep93xx/edb93xx.c27
-rw-r--r--sound/soc/ep93xx/ep93xx-ac97.c14
-rw-r--r--sound/soc/ep93xx/ep93xx-i2s.c15
-rw-r--r--sound/soc/ep93xx/ep93xx-pcm.c18
-rw-r--r--sound/soc/ep93xx/simone.c13
-rw-r--r--sound/soc/ep93xx/snappercl15.c26
-rw-r--r--sound/soc/fsl/efika-audio-fabric.c14
-rw-r--r--sound/soc/fsl/fsl_dma.c15
-rw-r--r--sound/soc/fsl/fsl_ssi.c17
-rw-r--r--sound/soc/fsl/mpc5200_dma.c12
-rw-r--r--sound/soc/fsl/mpc5200_psc_ac97.c20
-rw-r--r--sound/soc/fsl/mpc5200_psc_i2s.c18
-rw-r--r--sound/soc/fsl/mpc8610_hpcd.c13
-rw-r--r--sound/soc/fsl/p1022_ds.c49
-rw-r--r--sound/soc/fsl/pcm030-audio-fabric.c14
-rw-r--r--sound/soc/imx/Kconfig2
-rw-r--r--sound/soc/imx/eukrea-tlv320.c1
-rw-r--r--sound/soc/imx/imx-pcm-dma-mx2.c12
-rw-r--r--sound/soc/imx/imx-pcm-fiq.c12
-rw-r--r--sound/soc/imx/imx-ssi.c15
-rw-r--r--sound/soc/imx/mx27vis-aic32x4.c1
-rw-r--r--sound/soc/imx/phycore-ac97.c1
-rw-r--r--sound/soc/imx/wm1133-ev1.c1
-rw-r--r--sound/soc/jz4740/jz4740-i2s.c14
-rw-r--r--sound/soc/jz4740/jz4740-pcm.c17
-rw-r--r--sound/soc/jz4740/qi_lb60.c1
-rw-r--r--sound/soc/kirkwood/Kconfig3
-rw-r--r--sound/soc/kirkwood/kirkwood-dma.c17
-rw-r--r--sound/soc/kirkwood/kirkwood-i2s.c17
-rw-r--r--sound/soc/kirkwood/kirkwood-openrd.c15
-rw-r--r--sound/soc/kirkwood/kirkwood-t5325.c25
-rw-r--r--sound/soc/kirkwood/kirkwood.h1
-rw-r--r--sound/soc/mid-x86/Kconfig1
-rw-r--r--sound/soc/mid-x86/mfld_machine.c17
-rw-r--r--sound/soc/mid-x86/sst_platform.c154
-rw-r--r--sound/soc/mid-x86/sst_platform.h82
-rw-r--r--sound/soc/mxs/mxs-pcm.c13
-rw-r--r--sound/soc/mxs/mxs-saif.c14
-rw-r--r--sound/soc/mxs/mxs-sgtl5000.c14
-rw-r--r--sound/soc/nuc900/nuc900-ac97.c15
-rw-r--r--sound/soc/nuc900/nuc900-audio.c1
-rw-r--r--sound/soc/nuc900/nuc900-pcm.c12
-rw-r--r--sound/soc/omap/Kconfig5
-rw-r--r--sound/soc/omap/Makefile2
-rw-r--r--sound/soc/omap/am3517evm.c1
-rw-r--r--sound/soc/omap/ams-delta.c11
-rw-r--r--sound/soc/omap/igep0020.c1
-rw-r--r--sound/soc/omap/n810.c1
-rw-r--r--sound/soc/omap/omap-dmic.c546
-rw-r--r--sound/soc/omap/omap-dmic.h69
-rw-r--r--sound/soc/omap/omap-hdmi.c14
-rw-r--r--sound/soc/omap/omap-mcbsp.c16
-rw-r--r--sound/soc/omap/omap-mcpdm.c19
-rw-r--r--sound/soc/omap/omap-pcm.c17
-rw-r--r--sound/soc/omap/omap3evm.c1
-rw-r--r--sound/soc/omap/omap3pandora.c1
-rw-r--r--sound/soc/omap/omap4-hdmi-card.c13
-rw-r--r--sound/soc/omap/osk5912.c1
-rw-r--r--sound/soc/omap/overo.c1
-rw-r--r--sound/soc/omap/rx51.c3
-rw-r--r--sound/soc/omap/sdp3430.c1
-rw-r--r--sound/soc/omap/sdp4430.c86
-rw-r--r--sound/soc/omap/zoom2.c1
-rw-r--r--sound/soc/pxa/Kconfig3
-rw-r--r--sound/soc/pxa/corgi.c81
-rw-r--r--sound/soc/pxa/e740_wm9705.c84
-rw-r--r--sound/soc/pxa/e750_wm9705.c73
-rw-r--r--sound/soc/pxa/e800_wm9712.c73
-rw-r--r--sound/soc/pxa/em-x270.c1
-rw-r--r--sound/soc/pxa/hx4700.c35
-rw-r--r--sound/soc/pxa/imote2.c58
-rw-r--r--sound/soc/pxa/magician.c1
-rw-r--r--sound/soc/pxa/mioa701_wm9713.c14
-rw-r--r--sound/soc/pxa/palm27x.c14
-rw-r--r--sound/soc/pxa/poodle.c79
-rw-r--r--sound/soc/pxa/pxa-ssp.c14
-rw-r--r--sound/soc/pxa/pxa2xx-ac97.c18
-rw-r--r--sound/soc/pxa/pxa2xx-i2s.c2
-rw-r--r--sound/soc/pxa/pxa2xx-pcm.c12
-rw-r--r--sound/soc/pxa/raumfeld.c2
-rw-r--r--sound/soc/pxa/saarb.c24
-rw-r--r--sound/soc/pxa/spitz.c38
-rw-r--r--sound/soc/pxa/tavorevb3.c25
-rw-r--r--sound/soc/pxa/tosa.c78
-rw-r--r--sound/soc/pxa/z2.c29
-rw-r--r--sound/soc/pxa/zylonite.c1
-rw-r--r--sound/soc/s6000/s6000-i2s.c14
-rw-r--r--sound/soc/s6000/s6000-pcm.c12
-rw-r--r--sound/soc/s6000/s6105-ipcam.c1
-rw-r--r--sound/soc/samsung/Kconfig18
-rw-r--r--sound/soc/samsung/Makefile8
-rw-r--r--sound/soc/samsung/ac97.c16
-rw-r--r--sound/soc/samsung/dma.c17
-rw-r--r--sound/soc/samsung/goni_wm8994.c1
-rw-r--r--sound/soc/samsung/h1940_uda1380.c1
-rw-r--r--sound/soc/samsung/i2s.c42
-rw-r--r--sound/soc/samsung/idma.c20
-rw-r--r--sound/soc/samsung/idma.h2
-rw-r--r--sound/soc/samsung/jive_wm8750.c4
-rw-r--r--sound/soc/samsung/littlemill.c253
-rw-r--r--sound/soc/samsung/ln2440sbc_alc650.c1
-rw-r--r--sound/soc/samsung/lowland.c237
-rw-r--r--sound/soc/samsung/neo1973_wm8753.c1
-rw-r--r--sound/soc/samsung/pcm.c34
-rw-r--r--sound/soc/samsung/rx1950_uda1380.c1
-rw-r--r--sound/soc/samsung/s3c2412-i2s.c14
-rw-r--r--sound/soc/samsung/s3c24xx-i2s.c14
-rw-r--r--sound/soc/samsung/s3c24xx_simtec_hermes.c17
-rw-r--r--sound/soc/samsung/s3c24xx_simtec_tlv320aic23.c19
-rw-r--r--sound/soc/samsung/s3c24xx_uda134x.c15
-rw-r--r--sound/soc/samsung/smartq_wm8987.c1
-rw-r--r--sound/soc/samsung/smdk2443_wm9710.c2
-rw-r--r--sound/soc/samsung/smdk_spdif.c1
-rw-r--r--sound/soc/samsung/smdk_wm8580.c1
-rw-r--r--sound/soc/samsung/smdk_wm8580pcm.c15
-rw-r--r--sound/soc/samsung/smdk_wm8994.c1
-rw-r--r--sound/soc/samsung/smdk_wm8994pcm.c15
-rw-r--r--sound/soc/samsung/smdk_wm9713.c1
-rw-r--r--sound/soc/samsung/spdif.c14
-rw-r--r--sound/soc/samsung/speyside.c23
-rw-r--r--sound/soc/samsung/tobermory.c (renamed from sound/soc/samsung/speyside_wm8962.c)78
-rw-r--r--sound/soc/sh/dma-sh7760.c12
-rw-r--r--sound/soc/sh/fsi-ak4642.c128
-rw-r--r--sound/soc/sh/fsi-da7210.c1
-rw-r--r--sound/soc/sh/fsi-hdmi.c14
-rw-r--r--sound/soc/sh/fsi.c40
-rw-r--r--sound/soc/sh/hac.c14
-rw-r--r--sound/soc/sh/migor.c1
-rw-r--r--sound/soc/sh/sh7760-ac97.c5
-rw-r--r--sound/soc/sh/siu_dai.c21
-rw-r--r--sound/soc/sh/ssi.c14
-rw-r--r--sound/soc/soc-cache.c765
-rw-r--r--sound/soc/soc-core.c238
-rw-r--r--sound/soc/soc-dapm.c90
-rw-r--r--sound/soc/soc-jack.c4
-rw-r--r--sound/soc/soc-pcm.c56
-rw-r--r--sound/soc/soc-utils.c31
-rw-r--r--sound/soc/tegra/Kconfig9
-rw-r--r--sound/soc/tegra/Makefile2
-rw-r--r--sound/soc/tegra/tegra_alc5632.c214
-rw-r--r--sound/soc/tegra/tegra_das.c66
-rw-r--r--sound/soc/tegra/tegra_i2s.c164
-rw-r--r--sound/soc/tegra/tegra_i2s.h1
-rw-r--r--sound/soc/tegra/tegra_pcm.c18
-rw-r--r--sound/soc/tegra/tegra_spdif.c14
-rw-r--r--sound/soc/tegra/tegra_wm8903.c193
-rw-r--r--sound/soc/tegra/trimslice.c41
-rw-r--r--sound/soc/txx9/txx9aclc-ac97.c13
-rw-r--r--sound/soc/txx9/txx9aclc-generic.c1
-rw-r--r--sound/soc/txx9/txx9aclc.c12
295 files changed, 11327 insertions, 10708 deletions
diff --git a/sound/ppc/snd_ps3.c b/sound/ppc/snd_ps3.c
index a3ce1b22620..1aa52eff526 100644
--- a/sound/ppc/snd_ps3.c
+++ b/sound/ppc/snd_ps3.c
@@ -876,7 +876,7 @@ static void __devinit snd_ps3_audio_set_base_addr(uint64_t ioaddr_start)
876 (0x0fUL << 12) | 876 (0x0fUL << 12) |
877 (PS3_AUDIO_IOID); 877 (PS3_AUDIO_IOID);
878 878
879 ret = lv1_gpu_attribute(0x100, 0x007, val, 0, 0); 879 ret = lv1_gpu_attribute(0x100, 0x007, val);
880 if (ret) 880 if (ret)
881 pr_info("%s: gpu_attribute failed %d\n", __func__, 881 pr_info("%s: gpu_attribute failed %d\n", __func__,
882 ret); 882 ret);
diff --git a/sound/soc/Kconfig b/sound/soc/Kconfig
index 1381db853ef..35e662d270e 100644
--- a/sound/soc/Kconfig
+++ b/sound/soc/Kconfig
@@ -22,21 +22,6 @@ menuconfig SND_SOC
22 22
23if SND_SOC 23if SND_SOC
24 24
25config SND_SOC_CACHE_LZO
26 bool "Support LZO compression for register caches"
27 select LZO_COMPRESS
28 select LZO_DECOMPRESS
29 ---help---
30 Select this to enable LZO compression for register caches.
31 This will allow machine or CODEC drivers to compress register
32 caches in memory, reducing the memory consumption at the
33 expense of performance. If this is not present and is used
34 the system will fall back to uncompressed caches.
35
36 Usually it is safe to disable this option, where cache
37 compression in used the rbtree option will typically perform
38 better.
39
40config SND_SOC_AC97_BUS 25config SND_SOC_AC97_BUS
41 bool 26 bool
42 27
diff --git a/sound/soc/atmel/Kconfig b/sound/soc/atmel/Kconfig
index d1fcc816ce9..72b09cfd3dc 100644
--- a/sound/soc/atmel/Kconfig
+++ b/sound/soc/atmel/Kconfig
@@ -26,7 +26,7 @@ config SND_AT91_SOC_SAM9G20_WM8731
26 26
27config SND_AT91_SOC_AFEB9260 27config SND_AT91_SOC_AFEB9260
28 tristate "SoC Audio support for AFEB9260 board" 28 tristate "SoC Audio support for AFEB9260 board"
29 depends on ARCH_AT91 && MACH_AFEB9260 && SND_ATMEL_SOC 29 depends on ATMEL_SSC && ARCH_AT91 && MACH_AFEB9260 && SND_ATMEL_SOC
30 select SND_ATMEL_SOC_SSC 30 select SND_ATMEL_SOC_SSC
31 select SND_SOC_TLV320AIC23 31 select SND_SOC_TLV320AIC23
32 help 32 help
diff --git a/sound/soc/atmel/atmel-pcm.c b/sound/soc/atmel/atmel-pcm.c
index f81d4c3f895..a21ff459e5d 100644
--- a/sound/soc/atmel/atmel-pcm.c
+++ b/sound/soc/atmel/atmel-pcm.c
@@ -367,7 +367,6 @@ static u64 atmel_pcm_dmamask = 0xffffffff;
367static int atmel_pcm_new(struct snd_soc_pcm_runtime *rtd) 367static int atmel_pcm_new(struct snd_soc_pcm_runtime *rtd)
368{ 368{
369 struct snd_card *card = rtd->card->snd_card; 369 struct snd_card *card = rtd->card->snd_card;
370 struct snd_soc_dai *dai = rtd->cpu_dai;
371 struct snd_pcm *pcm = rtd->pcm; 370 struct snd_pcm *pcm = rtd->pcm;
372 int ret = 0; 371 int ret = 0;
373 372
@@ -376,14 +375,14 @@ static int atmel_pcm_new(struct snd_soc_pcm_runtime *rtd)
376 if (!card->dev->coherent_dma_mask) 375 if (!card->dev->coherent_dma_mask)
377 card->dev->coherent_dma_mask = 0xffffffff; 376 card->dev->coherent_dma_mask = 0xffffffff;
378 377
379 if (dai->driver->playback.channels_min) { 378 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
380 ret = atmel_pcm_preallocate_dma_buffer(pcm, 379 ret = atmel_pcm_preallocate_dma_buffer(pcm,
381 SNDRV_PCM_STREAM_PLAYBACK); 380 SNDRV_PCM_STREAM_PLAYBACK);
382 if (ret) 381 if (ret)
383 goto out; 382 goto out;
384 } 383 }
385 384
386 if (dai->driver->capture.channels_min) { 385 if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) {
387 pr_debug("atmel-pcm:" 386 pr_debug("atmel-pcm:"
388 "Allocating PCM capture DMA buffer\n"); 387 "Allocating PCM capture DMA buffer\n");
389 ret = atmel_pcm_preallocate_dma_buffer(pcm, 388 ret = atmel_pcm_preallocate_dma_buffer(pcm,
@@ -495,17 +494,7 @@ static struct platform_driver atmel_pcm_driver = {
495 .remove = __devexit_p(atmel_soc_platform_remove), 494 .remove = __devexit_p(atmel_soc_platform_remove),
496}; 495};
497 496
498static int __init snd_atmel_pcm_init(void) 497module_platform_driver(atmel_pcm_driver);
499{
500 return platform_driver_register(&atmel_pcm_driver);
501}
502module_init(snd_atmel_pcm_init);
503
504static void __exit snd_atmel_pcm_exit(void)
505{
506 platform_driver_unregister(&atmel_pcm_driver);
507}
508module_exit(snd_atmel_pcm_exit);
509 498
510MODULE_AUTHOR("Sedji Gaouaou <sedji.gaouaou@atmel.com>"); 499MODULE_AUTHOR("Sedji Gaouaou <sedji.gaouaou@atmel.com>");
511MODULE_DESCRIPTION("Atmel PCM module"); 500MODULE_DESCRIPTION("Atmel PCM module");
diff --git a/sound/soc/atmel/atmel_ssc_dai.c b/sound/soc/atmel/atmel_ssc_dai.c
index 71225090c49..354341ec0f4 100644
--- a/sound/soc/atmel/atmel_ssc_dai.c
+++ b/sound/soc/atmel/atmel_ssc_dai.c
@@ -719,7 +719,7 @@ static int atmel_ssc_remove(struct snd_soc_dai *dai)
719#define ATMEL_SSC_FORMATS (SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_S16_LE |\ 719#define ATMEL_SSC_FORMATS (SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_S16_LE |\
720 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE) 720 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE)
721 721
722static struct snd_soc_dai_ops atmel_ssc_dai_ops = { 722static const struct snd_soc_dai_ops atmel_ssc_dai_ops = {
723 .startup = atmel_ssc_startup, 723 .startup = atmel_ssc_startup,
724 .shutdown = atmel_ssc_shutdown, 724 .shutdown = atmel_ssc_shutdown,
725 .prepare = atmel_ssc_prepare, 725 .prepare = atmel_ssc_prepare,
@@ -859,17 +859,7 @@ int atmel_ssc_set_audio(int ssc_id)
859} 859}
860EXPORT_SYMBOL_GPL(atmel_ssc_set_audio); 860EXPORT_SYMBOL_GPL(atmel_ssc_set_audio);
861 861
862static int __init snd_atmel_ssc_init(void) 862module_platform_driver(asoc_ssc_driver);
863{
864 return platform_driver_register(&asoc_ssc_driver);
865}
866module_init(snd_atmel_ssc_init);
867
868static void __exit snd_atmel_ssc_exit(void)
869{
870 platform_driver_unregister(&asoc_ssc_driver);
871}
872module_exit(snd_atmel_ssc_exit);
873 863
874/* Module information */ 864/* Module information */
875MODULE_AUTHOR("Sedji Gaouaou, sedji.gaouaou@atmel.com, www.atmel.com"); 865MODULE_AUTHOR("Sedji Gaouaou, sedji.gaouaou@atmel.com, www.atmel.com");
diff --git a/sound/soc/atmel/sam9g20_wm8731.c b/sound/soc/atmel/sam9g20_wm8731.c
index 0377c5451ae..c88351488f4 100644
--- a/sound/soc/atmel/sam9g20_wm8731.c
+++ b/sound/soc/atmel/sam9g20_wm8731.c
@@ -189,6 +189,7 @@ static struct snd_soc_dai_link at91sam9g20ek_dai = {
189 189
190static struct snd_soc_card snd_soc_at91sam9g20ek = { 190static struct snd_soc_card snd_soc_at91sam9g20ek = {
191 .name = "AT91SAMG20-EK", 191 .name = "AT91SAMG20-EK",
192 .owner = THIS_MODULE,
192 .dai_link = &at91sam9g20ek_dai, 193 .dai_link = &at91sam9g20ek_dai,
193 .num_links = 1, 194 .num_links = 1,
194 .set_bias_level = at91sam9g20ek_set_bias_level, 195 .set_bias_level = at91sam9g20ek_set_bias_level,
diff --git a/sound/soc/atmel/snd-soc-afeb9260.c b/sound/soc/atmel/snd-soc-afeb9260.c
index d427e9217ce..4ca667d477f 100644
--- a/sound/soc/atmel/snd-soc-afeb9260.c
+++ b/sound/soc/atmel/snd-soc-afeb9260.c
@@ -135,6 +135,7 @@ static struct snd_soc_dai_link afeb9260_dai = {
135/* Audio machine driver */ 135/* Audio machine driver */
136static struct snd_soc_card snd_soc_machine_afeb9260 = { 136static struct snd_soc_card snd_soc_machine_afeb9260 = {
137 .name = "AFEB9260", 137 .name = "AFEB9260",
138 .owner = THIS_MODULE,
138 .dai_link = &afeb9260_dai, 139 .dai_link = &afeb9260_dai,
139 .num_links = 1, 140 .num_links = 1,
140}; 141};
diff --git a/sound/soc/au1x/ac97c.c b/sound/soc/au1x/ac97c.c
index 726bd651a10..c5ac2449563 100644
--- a/sound/soc/au1x/ac97c.c
+++ b/sound/soc/au1x/ac97c.c
@@ -195,7 +195,7 @@ static int alchemy_ac97c_startup(struct snd_pcm_substream *substream,
195 return 0; 195 return 0;
196} 196}
197 197
198static struct snd_soc_dai_ops alchemy_ac97c_ops = { 198static const struct snd_soc_dai_ops alchemy_ac97c_ops = {
199 .startup = alchemy_ac97c_startup, 199 .startup = alchemy_ac97c_startup,
200}; 200};
201 201
@@ -229,35 +229,34 @@ static int __devinit au1xac97c_drvprobe(struct platform_device *pdev)
229 struct resource *iores, *dmares; 229 struct resource *iores, *dmares;
230 struct au1xpsc_audio_data *ctx; 230 struct au1xpsc_audio_data *ctx;
231 231
232 ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); 232 ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL);
233 if (!ctx) 233 if (!ctx)
234 return -ENOMEM; 234 return -ENOMEM;
235 235
236 mutex_init(&ctx->lock); 236 mutex_init(&ctx->lock);
237 237
238 iores = platform_get_resource(pdev, IORESOURCE_MEM, 0); 238 iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
239 if (!iores) { 239 if (!iores)
240 ret = -ENODEV; 240 return -ENODEV;
241 goto out0;
242 }
243 241
244 ret = -EBUSY; 242 if (!devm_request_mem_region(&pdev->dev, iores->start,
245 if (!request_mem_region(iores->start, resource_size(iores), 243 resource_size(iores),
246 pdev->name)) 244 pdev->name))
247 goto out0; 245 return -EBUSY;
248 246
249 ctx->mmio = ioremap_nocache(iores->start, resource_size(iores)); 247 ctx->mmio = devm_ioremap_nocache(&pdev->dev, iores->start,
248 resource_size(iores));
250 if (!ctx->mmio) 249 if (!ctx->mmio)
251 goto out1; 250 return -EBUSY;
252 251
253 dmares = platform_get_resource(pdev, IORESOURCE_DMA, 0); 252 dmares = platform_get_resource(pdev, IORESOURCE_DMA, 0);
254 if (!dmares) 253 if (!dmares)
255 goto out2; 254 return -EBUSY;
256 ctx->dmaids[SNDRV_PCM_STREAM_PLAYBACK] = dmares->start; 255 ctx->dmaids[SNDRV_PCM_STREAM_PLAYBACK] = dmares->start;
257 256
258 dmares = platform_get_resource(pdev, IORESOURCE_DMA, 1); 257 dmares = platform_get_resource(pdev, IORESOURCE_DMA, 1);
259 if (!dmares) 258 if (!dmares)
260 goto out2; 259 return -EBUSY;
261 ctx->dmaids[SNDRV_PCM_STREAM_CAPTURE] = dmares->start; 260 ctx->dmaids[SNDRV_PCM_STREAM_CAPTURE] = dmares->start;
262 261
263 /* switch it on */ 262 /* switch it on */
@@ -271,33 +270,20 @@ static int __devinit au1xac97c_drvprobe(struct platform_device *pdev)
271 270
272 ret = snd_soc_register_dai(&pdev->dev, &au1xac97c_dai_driver); 271 ret = snd_soc_register_dai(&pdev->dev, &au1xac97c_dai_driver);
273 if (ret) 272 if (ret)
274 goto out2; 273 return ret;
275 274
276 ac97c_workdata = ctx; 275 ac97c_workdata = ctx;
277 return 0; 276 return 0;
278
279out2:
280 iounmap(ctx->mmio);
281out1:
282 release_mem_region(iores->start, resource_size(iores));
283out0:
284 kfree(ctx);
285 return ret;
286} 277}
287 278
288static int __devexit au1xac97c_drvremove(struct platform_device *pdev) 279static int __devexit au1xac97c_drvremove(struct platform_device *pdev)
289{ 280{
290 struct au1xpsc_audio_data *ctx = platform_get_drvdata(pdev); 281 struct au1xpsc_audio_data *ctx = platform_get_drvdata(pdev);
291 struct resource *r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
292 282
293 snd_soc_unregister_dai(&pdev->dev); 283 snd_soc_unregister_dai(&pdev->dev);
294 284
295 WR(ctx, AC97_ENABLE, EN_D); /* clock off, disable */ 285 WR(ctx, AC97_ENABLE, EN_D); /* clock off, disable */
296 286
297 iounmap(ctx->mmio);
298 release_mem_region(r->start, resource_size(r));
299 kfree(ctx);
300
301 ac97c_workdata = NULL; /* MDEV */ 287 ac97c_workdata = NULL; /* MDEV */
302 288
303 return 0; 289 return 0;
diff --git a/sound/soc/au1x/db1000.c b/sound/soc/au1x/db1000.c
index 127477a5e0c..511d83c11a9 100644
--- a/sound/soc/au1x/db1000.c
+++ b/sound/soc/au1x/db1000.c
@@ -29,6 +29,7 @@ static struct snd_soc_dai_link db1000_ac97_dai = {
29 29
30static struct snd_soc_card db1000_ac97 = { 30static struct snd_soc_card db1000_ac97 = {
31 .name = "DB1000_AC97", 31 .name = "DB1000_AC97",
32 .owner = THIS_MODULE,
32 .dai_link = &db1000_ac97_dai, 33 .dai_link = &db1000_ac97_dai,
33 .num_links = 1, 34 .num_links = 1,
34}; 35};
@@ -57,18 +58,7 @@ static struct platform_driver db1000_audio_driver = {
57 .remove = __devexit_p(db1000_audio_remove), 58 .remove = __devexit_p(db1000_audio_remove),
58}; 59};
59 60
60static int __init db1000_audio_load(void) 61module_platform_driver(db1000_audio_driver);
61{
62 return platform_driver_register(&db1000_audio_driver);
63}
64
65static void __exit db1000_audio_unload(void)
66{
67 platform_driver_unregister(&db1000_audio_driver);
68}
69
70module_init(db1000_audio_load);
71module_exit(db1000_audio_unload);
72 62
73MODULE_LICENSE("GPL"); 63MODULE_LICENSE("GPL");
74MODULE_DESCRIPTION("DB1000/DB1500/DB1100 ASoC audio"); 64MODULE_DESCRIPTION("DB1000/DB1500/DB1100 ASoC audio");
diff --git a/sound/soc/au1x/db1200.c b/sound/soc/au1x/db1200.c
index 289312c14b9..1c629393df7 100644
--- a/sound/soc/au1x/db1200.c
+++ b/sound/soc/au1x/db1200.c
@@ -45,6 +45,7 @@ static struct snd_soc_dai_link db1200_ac97_dai = {
45 45
46static struct snd_soc_card db1200_ac97_machine = { 46static struct snd_soc_card db1200_ac97_machine = {
47 .name = "DB1200_AC97", 47 .name = "DB1200_AC97",
48 .owner = THIS_MODULE,
48 .dai_link = &db1200_ac97_dai, 49 .dai_link = &db1200_ac97_dai,
49 .num_links = 1, 50 .num_links = 1,
50}; 51};
@@ -94,6 +95,7 @@ static struct snd_soc_dai_link db1200_i2s_dai = {
94 95
95static struct snd_soc_card db1200_i2s_machine = { 96static struct snd_soc_card db1200_i2s_machine = {
96 .name = "DB1200_I2S", 97 .name = "DB1200_I2S",
98 .owner = THIS_MODULE,
97 .dai_link = &db1200_i2s_dai, 99 .dai_link = &db1200_i2s_dai,
98 .num_links = 1, 100 .num_links = 1,
99}; 101};
@@ -133,18 +135,7 @@ static struct platform_driver db1200_audio_driver = {
133 .remove = __devexit_p(db1200_audio_remove), 135 .remove = __devexit_p(db1200_audio_remove),
134}; 136};
135 137
136static int __init db1200_audio_load(void) 138module_platform_driver(db1200_audio_driver);
137{
138 return platform_driver_register(&db1200_audio_driver);
139}
140
141static void __exit db1200_audio_unload(void)
142{
143 platform_driver_unregister(&db1200_audio_driver);
144}
145
146module_init(db1200_audio_load);
147module_exit(db1200_audio_unload);
148 139
149MODULE_LICENSE("GPL"); 140MODULE_LICENSE("GPL");
150MODULE_DESCRIPTION("DB1200 ASoC audio support"); 141MODULE_DESCRIPTION("DB1200 ASoC audio support");
diff --git a/sound/soc/au1x/dbdma2.c b/sound/soc/au1x/dbdma2.c
index d7d04e26eee..8372cd35f0d 100644
--- a/sound/soc/au1x/dbdma2.c
+++ b/sound/soc/au1x/dbdma2.c
@@ -341,7 +341,7 @@ static int au1xpsc_pcm_new(struct snd_soc_pcm_runtime *rtd)
341} 341}
342 342
343/* au1xpsc audio platform */ 343/* au1xpsc audio platform */
344struct snd_soc_platform_driver au1xpsc_soc_platform = { 344static struct snd_soc_platform_driver au1xpsc_soc_platform = {
345 .ops = &au1xpsc_pcm_ops, 345 .ops = &au1xpsc_pcm_ops,
346 .pcm_new = au1xpsc_pcm_new, 346 .pcm_new = au1xpsc_pcm_new,
347 .pcm_free = au1xpsc_pcm_free_dma_buffers, 347 .pcm_free = au1xpsc_pcm_free_dma_buffers,
@@ -350,27 +350,21 @@ struct snd_soc_platform_driver au1xpsc_soc_platform = {
350static int __devinit au1xpsc_pcm_drvprobe(struct platform_device *pdev) 350static int __devinit au1xpsc_pcm_drvprobe(struct platform_device *pdev)
351{ 351{
352 struct au1xpsc_audio_dmadata *dmadata; 352 struct au1xpsc_audio_dmadata *dmadata;
353 int ret;
354 353
355 dmadata = kzalloc(2 * sizeof(struct au1xpsc_audio_dmadata), GFP_KERNEL); 354 dmadata = devm_kzalloc(&pdev->dev,
355 2 * sizeof(struct au1xpsc_audio_dmadata),
356 GFP_KERNEL);
356 if (!dmadata) 357 if (!dmadata)
357 return -ENOMEM; 358 return -ENOMEM;
358 359
359 platform_set_drvdata(pdev, dmadata); 360 platform_set_drvdata(pdev, dmadata);
360 361
361 ret = snd_soc_register_platform(&pdev->dev, &au1xpsc_soc_platform); 362 return snd_soc_register_platform(&pdev->dev, &au1xpsc_soc_platform);
362 if (ret)
363 kfree(dmadata);
364
365 return ret;
366} 363}
367 364
368static int __devexit au1xpsc_pcm_drvremove(struct platform_device *pdev) 365static int __devexit au1xpsc_pcm_drvremove(struct platform_device *pdev)
369{ 366{
370 struct au1xpsc_audio_dmadata *dmadata = platform_get_drvdata(pdev);
371
372 snd_soc_unregister_platform(&pdev->dev); 367 snd_soc_unregister_platform(&pdev->dev);
373 kfree(dmadata);
374 368
375 return 0; 369 return 0;
376} 370}
@@ -384,18 +378,7 @@ static struct platform_driver au1xpsc_pcm_driver = {
384 .remove = __devexit_p(au1xpsc_pcm_drvremove), 378 .remove = __devexit_p(au1xpsc_pcm_drvremove),
385}; 379};
386 380
387static int __init au1xpsc_audio_dbdma_load(void) 381module_platform_driver(au1xpsc_pcm_driver);
388{
389 return platform_driver_register(&au1xpsc_pcm_driver);
390}
391
392static void __exit au1xpsc_audio_dbdma_unload(void)
393{
394 platform_driver_unregister(&au1xpsc_pcm_driver);
395}
396
397module_init(au1xpsc_audio_dbdma_load);
398module_exit(au1xpsc_audio_dbdma_unload);
399 382
400MODULE_LICENSE("GPL"); 383MODULE_LICENSE("GPL");
401MODULE_DESCRIPTION("Au12x0/Au1550 PSC Audio DMA driver"); 384MODULE_DESCRIPTION("Au12x0/Au1550 PSC Audio DMA driver");
diff --git a/sound/soc/au1x/dma.c b/sound/soc/au1x/dma.c
index 177f7137a9c..0a91b186a86 100644
--- a/sound/soc/au1x/dma.c
+++ b/sound/soc/au1x/dma.c
@@ -316,7 +316,7 @@ static int alchemy_pcm_new(struct snd_soc_pcm_runtime *rtd)
316 return 0; 316 return 0;
317} 317}
318 318
319struct snd_soc_platform_driver alchemy_pcm_soc_platform = { 319static struct snd_soc_platform_driver alchemy_pcm_soc_platform = {
320 .ops = &alchemy_pcm_ops, 320 .ops = &alchemy_pcm_ops,
321 .pcm_new = alchemy_pcm_new, 321 .pcm_new = alchemy_pcm_new,
322 .pcm_free = alchemy_pcm_free_dma_buffers, 322 .pcm_free = alchemy_pcm_free_dma_buffers,
@@ -325,27 +325,19 @@ struct snd_soc_platform_driver alchemy_pcm_soc_platform = {
325static int __devinit alchemy_pcm_drvprobe(struct platform_device *pdev) 325static int __devinit alchemy_pcm_drvprobe(struct platform_device *pdev)
326{ 326{
327 struct alchemy_pcm_ctx *ctx; 327 struct alchemy_pcm_ctx *ctx;
328 int ret;
329 328
330 ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); 329 ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL);
331 if (!ctx) 330 if (!ctx)
332 return -ENOMEM; 331 return -ENOMEM;
333 332
334 platform_set_drvdata(pdev, ctx); 333 platform_set_drvdata(pdev, ctx);
335 334
336 ret = snd_soc_register_platform(&pdev->dev, &alchemy_pcm_soc_platform); 335 return snd_soc_register_platform(&pdev->dev, &alchemy_pcm_soc_platform);
337 if (ret)
338 kfree(ctx);
339
340 return ret;
341} 336}
342 337
343static int __devexit alchemy_pcm_drvremove(struct platform_device *pdev) 338static int __devexit alchemy_pcm_drvremove(struct platform_device *pdev)
344{ 339{
345 struct alchemy_pcm_ctx *ctx = platform_get_drvdata(pdev);
346
347 snd_soc_unregister_platform(&pdev->dev); 340 snd_soc_unregister_platform(&pdev->dev);
348 kfree(ctx);
349 341
350 return 0; 342 return 0;
351} 343}
@@ -359,18 +351,7 @@ static struct platform_driver alchemy_pcmdma_driver = {
359 .remove = __devexit_p(alchemy_pcm_drvremove), 351 .remove = __devexit_p(alchemy_pcm_drvremove),
360}; 352};
361 353
362static int __init alchemy_pcmdma_load(void) 354module_platform_driver(alchemy_pcmdma_driver);
363{
364 return platform_driver_register(&alchemy_pcmdma_driver);
365}
366
367static void __exit alchemy_pcmdma_unload(void)
368{
369 platform_driver_unregister(&alchemy_pcmdma_driver);
370}
371
372module_init(alchemy_pcmdma_load);
373module_exit(alchemy_pcmdma_unload);
374 355
375MODULE_LICENSE("GPL"); 356MODULE_LICENSE("GPL");
376MODULE_DESCRIPTION("Au1000/Au1500/Au1100 Audio DMA driver"); 357MODULE_DESCRIPTION("Au1000/Au1500/Au1100 Audio DMA driver");
diff --git a/sound/soc/au1x/i2sc.c b/sound/soc/au1x/i2sc.c
index 6bcf48f5884..d4b9e364a47 100644
--- a/sound/soc/au1x/i2sc.c
+++ b/sound/soc/au1x/i2sc.c
@@ -227,69 +227,50 @@ static struct snd_soc_dai_driver au1xi2s_dai_driver = {
227 227
228static int __devinit au1xi2s_drvprobe(struct platform_device *pdev) 228static int __devinit au1xi2s_drvprobe(struct platform_device *pdev)
229{ 229{
230 int ret;
231 struct resource *iores, *dmares; 230 struct resource *iores, *dmares;
232 struct au1xpsc_audio_data *ctx; 231 struct au1xpsc_audio_data *ctx;
233 232
234 ctx = kzalloc(sizeof(*ctx), GFP_KERNEL); 233 ctx = devm_kzalloc(&pdev->dev, sizeof(*ctx), GFP_KERNEL);
235 if (!ctx) 234 if (!ctx)
236 return -ENOMEM; 235 return -ENOMEM;
237 236
238 iores = platform_get_resource(pdev, IORESOURCE_MEM, 0); 237 iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
239 if (!iores) { 238 if (!iores)
240 ret = -ENODEV; 239 return -ENODEV;
241 goto out0;
242 }
243 240
244 ret = -EBUSY; 241 if (!devm_request_mem_region(&pdev->dev, iores->start,
245 if (!request_mem_region(iores->start, resource_size(iores), 242 resource_size(iores),
246 pdev->name)) 243 pdev->name))
247 goto out0; 244 return -EBUSY;
248 245
249 ctx->mmio = ioremap_nocache(iores->start, resource_size(iores)); 246 ctx->mmio = devm_ioremap_nocache(&pdev->dev, iores->start,
247 resource_size(iores));
250 if (!ctx->mmio) 248 if (!ctx->mmio)
251 goto out1; 249 return -EBUSY;
252 250
253 dmares = platform_get_resource(pdev, IORESOURCE_DMA, 0); 251 dmares = platform_get_resource(pdev, IORESOURCE_DMA, 0);
254 if (!dmares) 252 if (!dmares)
255 goto out2; 253 return -EBUSY;
256 ctx->dmaids[SNDRV_PCM_STREAM_PLAYBACK] = dmares->start; 254 ctx->dmaids[SNDRV_PCM_STREAM_PLAYBACK] = dmares->start;
257 255
258 dmares = platform_get_resource(pdev, IORESOURCE_DMA, 1); 256 dmares = platform_get_resource(pdev, IORESOURCE_DMA, 1);
259 if (!dmares) 257 if (!dmares)
260 goto out2; 258 return -EBUSY;
261 ctx->dmaids[SNDRV_PCM_STREAM_CAPTURE] = dmares->start; 259 ctx->dmaids[SNDRV_PCM_STREAM_CAPTURE] = dmares->start;
262 260
263 platform_set_drvdata(pdev, ctx); 261 platform_set_drvdata(pdev, ctx);
264 262
265 ret = snd_soc_register_dai(&pdev->dev, &au1xi2s_dai_driver); 263 return snd_soc_register_dai(&pdev->dev, &au1xi2s_dai_driver);
266 if (ret)
267 goto out2;
268
269 return 0;
270
271out2:
272 iounmap(ctx->mmio);
273out1:
274 release_mem_region(iores->start, resource_size(iores));
275out0:
276 kfree(ctx);
277 return ret;
278} 264}
279 265
280static int __devexit au1xi2s_drvremove(struct platform_device *pdev) 266static int __devexit au1xi2s_drvremove(struct platform_device *pdev)
281{ 267{
282 struct au1xpsc_audio_data *ctx = platform_get_drvdata(pdev); 268 struct au1xpsc_audio_data *ctx = platform_get_drvdata(pdev);
283 struct resource *r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
284 269
285 snd_soc_unregister_dai(&pdev->dev); 270 snd_soc_unregister_dai(&pdev->dev);
286 271
287 WR(ctx, I2S_ENABLE, EN_D); /* clock off, disable */ 272 WR(ctx, I2S_ENABLE, EN_D); /* clock off, disable */
288 273
289 iounmap(ctx->mmio);
290 release_mem_region(r->start, resource_size(r));
291 kfree(ctx);
292
293 return 0; 274 return 0;
294} 275}
295 276
@@ -331,18 +312,7 @@ static struct platform_driver au1xi2s_driver = {
331 .remove = __devexit_p(au1xi2s_drvremove), 312 .remove = __devexit_p(au1xi2s_drvremove),
332}; 313};
333 314
334static int __init au1xi2s_load(void) 315module_platform_driver(au1xi2s_driver);
335{
336 return platform_driver_register(&au1xi2s_driver);
337}
338
339static void __exit au1xi2s_unload(void)
340{
341 platform_driver_unregister(&au1xi2s_driver);
342}
343
344module_init(au1xi2s_load);
345module_exit(au1xi2s_unload);
346 316
347MODULE_LICENSE("GPL"); 317MODULE_LICENSE("GPL");
348MODULE_DESCRIPTION("Au1000/1500/1100 I2S ASoC driver"); 318MODULE_DESCRIPTION("Au1000/1500/1100 I2S ASoC driver");
diff --git a/sound/soc/au1x/psc-ac97.c b/sound/soc/au1x/psc-ac97.c
index 0c6acd54714..476b79a1c11 100644
--- a/sound/soc/au1x/psc-ac97.c
+++ b/sound/soc/au1x/psc-ac97.c
@@ -337,7 +337,7 @@ static int au1xpsc_ac97_probe(struct snd_soc_dai *dai)
337 return au1xpsc_ac97_workdata ? 0 : -ENODEV; 337 return au1xpsc_ac97_workdata ? 0 : -ENODEV;
338} 338}
339 339
340static struct snd_soc_dai_ops au1xpsc_ac97_dai_ops = { 340static const struct snd_soc_dai_ops au1xpsc_ac97_dai_ops = {
341 .startup = au1xpsc_ac97_startup, 341 .startup = au1xpsc_ac97_startup,
342 .trigger = au1xpsc_ac97_trigger, 342 .trigger = au1xpsc_ac97_trigger,
343 .hw_params = au1xpsc_ac97_hw_params, 343 .hw_params = au1xpsc_ac97_hw_params,
@@ -368,35 +368,35 @@ static int __devinit au1xpsc_ac97_drvprobe(struct platform_device *pdev)
368 unsigned long sel; 368 unsigned long sel;
369 struct au1xpsc_audio_data *wd; 369 struct au1xpsc_audio_data *wd;
370 370
371 wd = kzalloc(sizeof(struct au1xpsc_audio_data), GFP_KERNEL); 371 wd = devm_kzalloc(&pdev->dev, sizeof(struct au1xpsc_audio_data),
372 GFP_KERNEL);
372 if (!wd) 373 if (!wd)
373 return -ENOMEM; 374 return -ENOMEM;
374 375
375 mutex_init(&wd->lock); 376 mutex_init(&wd->lock);
376 377
377 iores = platform_get_resource(pdev, IORESOURCE_MEM, 0); 378 iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
378 if (!iores) { 379 if (!iores)
379 ret = -ENODEV; 380 return -ENODEV;
380 goto out0;
381 }
382 381
383 ret = -EBUSY; 382 if (!devm_request_mem_region(&pdev->dev, iores->start,
384 if (!request_mem_region(iores->start, resource_size(iores), 383 resource_size(iores),
385 pdev->name)) 384 pdev->name))
386 goto out0; 385 return -EBUSY;
387 386
388 wd->mmio = ioremap(iores->start, resource_size(iores)); 387 wd->mmio = devm_ioremap(&pdev->dev, iores->start,
388 resource_size(iores));
389 if (!wd->mmio) 389 if (!wd->mmio)
390 goto out1; 390 return -EBUSY;
391 391
392 dmares = platform_get_resource(pdev, IORESOURCE_DMA, 0); 392 dmares = platform_get_resource(pdev, IORESOURCE_DMA, 0);
393 if (!dmares) 393 if (!dmares)
394 goto out2; 394 return -EBUSY;
395 wd->dmaids[SNDRV_PCM_STREAM_PLAYBACK] = dmares->start; 395 wd->dmaids[SNDRV_PCM_STREAM_PLAYBACK] = dmares->start;
396 396
397 dmares = platform_get_resource(pdev, IORESOURCE_DMA, 1); 397 dmares = platform_get_resource(pdev, IORESOURCE_DMA, 1);
398 if (!dmares) 398 if (!dmares)
399 goto out2; 399 return -EBUSY;
400 wd->dmaids[SNDRV_PCM_STREAM_CAPTURE] = dmares->start; 400 wd->dmaids[SNDRV_PCM_STREAM_CAPTURE] = dmares->start;
401 401
402 /* configuration: max dma trigger threshold, enable ac97 */ 402 /* configuration: max dma trigger threshold, enable ac97 */
@@ -421,24 +421,15 @@ static int __devinit au1xpsc_ac97_drvprobe(struct platform_device *pdev)
421 421
422 ret = snd_soc_register_dai(&pdev->dev, &wd->dai_drv); 422 ret = snd_soc_register_dai(&pdev->dev, &wd->dai_drv);
423 if (ret) 423 if (ret)
424 goto out2; 424 return ret;
425 425
426 au1xpsc_ac97_workdata = wd; 426 au1xpsc_ac97_workdata = wd;
427 return 0; 427 return 0;
428
429out2:
430 iounmap(wd->mmio);
431out1:
432 release_mem_region(iores->start, resource_size(iores));
433out0:
434 kfree(wd);
435 return ret;
436} 428}
437 429
438static int __devexit au1xpsc_ac97_drvremove(struct platform_device *pdev) 430static int __devexit au1xpsc_ac97_drvremove(struct platform_device *pdev)
439{ 431{
440 struct au1xpsc_audio_data *wd = platform_get_drvdata(pdev); 432 struct au1xpsc_audio_data *wd = platform_get_drvdata(pdev);
441 struct resource *r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
442 433
443 snd_soc_unregister_dai(&pdev->dev); 434 snd_soc_unregister_dai(&pdev->dev);
444 435
@@ -448,10 +439,6 @@ static int __devexit au1xpsc_ac97_drvremove(struct platform_device *pdev)
448 au_writel(PSC_CTRL_DISABLE, PSC_CTRL(wd)); 439 au_writel(PSC_CTRL_DISABLE, PSC_CTRL(wd));
449 au_sync(); 440 au_sync();
450 441
451 iounmap(wd->mmio);
452 release_mem_region(r->start, resource_size(r));
453 kfree(wd);
454
455 au1xpsc_ac97_workdata = NULL; /* MDEV */ 442 au1xpsc_ac97_workdata = NULL; /* MDEV */
456 443
457 return 0; 444 return 0;
diff --git a/sound/soc/au1x/psc-i2s.c b/sound/soc/au1x/psc-i2s.c
index e03c5ce01b3..0607ba3d925 100644
--- a/sound/soc/au1x/psc-i2s.c
+++ b/sound/soc/au1x/psc-i2s.c
@@ -265,7 +265,7 @@ static int au1xpsc_i2s_startup(struct snd_pcm_substream *substream,
265 return 0; 265 return 0;
266} 266}
267 267
268static struct snd_soc_dai_ops au1xpsc_i2s_dai_ops = { 268static const struct snd_soc_dai_ops au1xpsc_i2s_dai_ops = {
269 .startup = au1xpsc_i2s_startup, 269 .startup = au1xpsc_i2s_startup,
270 .trigger = au1xpsc_i2s_trigger, 270 .trigger = au1xpsc_i2s_trigger,
271 .hw_params = au1xpsc_i2s_hw_params, 271 .hw_params = au1xpsc_i2s_hw_params,
@@ -295,33 +295,34 @@ static int __devinit au1xpsc_i2s_drvprobe(struct platform_device *pdev)
295 int ret; 295 int ret;
296 struct au1xpsc_audio_data *wd; 296 struct au1xpsc_audio_data *wd;
297 297
298 wd = kzalloc(sizeof(struct au1xpsc_audio_data), GFP_KERNEL); 298 wd = devm_kzalloc(&pdev->dev, sizeof(struct au1xpsc_audio_data),
299 GFP_KERNEL);
299 if (!wd) 300 if (!wd)
300 return -ENOMEM; 301 return -ENOMEM;
301 302
302 iores = platform_get_resource(pdev, IORESOURCE_MEM, 0); 303 iores = platform_get_resource(pdev, IORESOURCE_MEM, 0);
303 if (!iores) { 304 if (!iores)
304 ret = -ENODEV; 305 return -ENODEV;
305 goto out0;
306 }
307 306
308 ret = -EBUSY; 307 ret = -EBUSY;
309 if (!request_mem_region(iores->start, resource_size(iores), 308 if (!devm_request_mem_region(&pdev->dev, iores->start,
310 pdev->name)) 309 resource_size(iores),
311 goto out0; 310 pdev->name))
311 return -EBUSY;
312 312
313 wd->mmio = ioremap(iores->start, resource_size(iores)); 313 wd->mmio = devm_ioremap(&pdev->dev, iores->start,
314 resource_size(iores));
314 if (!wd->mmio) 315 if (!wd->mmio)
315 goto out1; 316 return -EBUSY;
316 317
317 dmares = platform_get_resource(pdev, IORESOURCE_DMA, 0); 318 dmares = platform_get_resource(pdev, IORESOURCE_DMA, 0);
318 if (!dmares) 319 if (!dmares)
319 goto out2; 320 return -EBUSY;
320 wd->dmaids[SNDRV_PCM_STREAM_PLAYBACK] = dmares->start; 321 wd->dmaids[SNDRV_PCM_STREAM_PLAYBACK] = dmares->start;
321 322
322 dmares = platform_get_resource(pdev, IORESOURCE_DMA, 1); 323 dmares = platform_get_resource(pdev, IORESOURCE_DMA, 1);
323 if (!dmares) 324 if (!dmares)
324 goto out2; 325 return -EBUSY;
325 wd->dmaids[SNDRV_PCM_STREAM_CAPTURE] = dmares->start; 326 wd->dmaids[SNDRV_PCM_STREAM_CAPTURE] = dmares->start;
326 327
327 /* preserve PSC clock source set up by platform (dev.platform_data 328 /* preserve PSC clock source set up by platform (dev.platform_data
@@ -349,23 +350,12 @@ static int __devinit au1xpsc_i2s_drvprobe(struct platform_device *pdev)
349 350
350 platform_set_drvdata(pdev, wd); 351 platform_set_drvdata(pdev, wd);
351 352
352 ret = snd_soc_register_dai(&pdev->dev, &wd->dai_drv); 353 return snd_soc_register_dai(&pdev->dev, &wd->dai_drv);
353 if (!ret)
354 return 0;
355
356out2:
357 iounmap(wd->mmio);
358out1:
359 release_mem_region(iores->start, resource_size(iores));
360out0:
361 kfree(wd);
362 return ret;
363} 354}
364 355
365static int __devexit au1xpsc_i2s_drvremove(struct platform_device *pdev) 356static int __devexit au1xpsc_i2s_drvremove(struct platform_device *pdev)
366{ 357{
367 struct au1xpsc_audio_data *wd = platform_get_drvdata(pdev); 358 struct au1xpsc_audio_data *wd = platform_get_drvdata(pdev);
368 struct resource *r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
369 359
370 snd_soc_unregister_dai(&pdev->dev); 360 snd_soc_unregister_dai(&pdev->dev);
371 361
@@ -374,10 +364,6 @@ static int __devexit au1xpsc_i2s_drvremove(struct platform_device *pdev)
374 au_writel(PSC_CTRL_DISABLE, PSC_CTRL(wd)); 364 au_writel(PSC_CTRL_DISABLE, PSC_CTRL(wd));
375 au_sync(); 365 au_sync();
376 366
377 iounmap(wd->mmio);
378 release_mem_region(r->start, resource_size(r));
379 kfree(wd);
380
381 return 0; 367 return 0;
382} 368}
383 369
@@ -435,18 +421,7 @@ static struct platform_driver au1xpsc_i2s_driver = {
435 .remove = __devexit_p(au1xpsc_i2s_drvremove), 421 .remove = __devexit_p(au1xpsc_i2s_drvremove),
436}; 422};
437 423
438static int __init au1xpsc_i2s_load(void) 424module_platform_driver(au1xpsc_i2s_driver);
439{
440 return platform_driver_register(&au1xpsc_i2s_driver);
441}
442
443static void __exit au1xpsc_i2s_unload(void)
444{
445 platform_driver_unregister(&au1xpsc_i2s_driver);
446}
447
448module_init(au1xpsc_i2s_load);
449module_exit(au1xpsc_i2s_unload);
450 425
451MODULE_LICENSE("GPL"); 426MODULE_LICENSE("GPL");
452MODULE_DESCRIPTION("Au12x0/Au1550 PSC I2S ALSA ASoC audio driver"); 427MODULE_DESCRIPTION("Au12x0/Au1550 PSC I2S ALSA ASoC audio driver");
diff --git a/sound/soc/blackfin/bf5xx-ac97-pcm.c b/sound/soc/blackfin/bf5xx-ac97-pcm.c
index 56815c1d47b..d7dc9bde097 100644
--- a/sound/soc/blackfin/bf5xx-ac97-pcm.c
+++ b/sound/soc/blackfin/bf5xx-ac97-pcm.c
@@ -421,7 +421,6 @@ static u64 bf5xx_pcm_dmamask = DMA_BIT_MASK(32);
421static int bf5xx_pcm_ac97_new(struct snd_soc_pcm_runtime *rtd) 421static int bf5xx_pcm_ac97_new(struct snd_soc_pcm_runtime *rtd)
422{ 422{
423 struct snd_card *card = rtd->card->snd_card; 423 struct snd_card *card = rtd->card->snd_card;
424 struct snd_soc_dai *dai = rtd->cpu_dai;
425 struct snd_pcm *pcm = rtd->pcm; 424 struct snd_pcm *pcm = rtd->pcm;
426 int ret = 0; 425 int ret = 0;
427 426
@@ -431,14 +430,14 @@ static int bf5xx_pcm_ac97_new(struct snd_soc_pcm_runtime *rtd)
431 if (!card->dev->coherent_dma_mask) 430 if (!card->dev->coherent_dma_mask)
432 card->dev->coherent_dma_mask = DMA_BIT_MASK(32); 431 card->dev->coherent_dma_mask = DMA_BIT_MASK(32);
433 432
434 if (dai->driver->playback.channels_min) { 433 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
435 ret = bf5xx_pcm_preallocate_dma_buffer(pcm, 434 ret = bf5xx_pcm_preallocate_dma_buffer(pcm,
436 SNDRV_PCM_STREAM_PLAYBACK); 435 SNDRV_PCM_STREAM_PLAYBACK);
437 if (ret) 436 if (ret)
438 goto out; 437 goto out;
439 } 438 }
440 439
441 if (dai->driver->capture.channels_min) { 440 if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) {
442 ret = bf5xx_pcm_preallocate_dma_buffer(pcm, 441 ret = bf5xx_pcm_preallocate_dma_buffer(pcm,
443 SNDRV_PCM_STREAM_CAPTURE); 442 SNDRV_PCM_STREAM_CAPTURE);
444 if (ret) 443 if (ret)
@@ -475,17 +474,7 @@ static struct platform_driver bf5xx_pcm_driver = {
475 .remove = __devexit_p(bf5xx_soc_platform_remove), 474 .remove = __devexit_p(bf5xx_soc_platform_remove),
476}; 475};
477 476
478static int __init snd_bf5xx_pcm_init(void) 477module_platform_driver(bf5xx_pcm_driver);
479{
480 return platform_driver_register(&bf5xx_pcm_driver);
481}
482module_init(snd_bf5xx_pcm_init);
483
484static void __exit snd_bf5xx_pcm_exit(void)
485{
486 platform_driver_unregister(&bf5xx_pcm_driver);
487}
488module_exit(snd_bf5xx_pcm_exit);
489 478
490MODULE_AUTHOR("Cliff Cai"); 479MODULE_AUTHOR("Cliff Cai");
491MODULE_DESCRIPTION("ADI Blackfin AC97 PCM DMA module"); 480MODULE_DESCRIPTION("ADI Blackfin AC97 PCM DMA module");
diff --git a/sound/soc/blackfin/bf5xx-ac97.c b/sound/soc/blackfin/bf5xx-ac97.c
index 6d216259088..f4e9dc4e262 100644
--- a/sound/soc/blackfin/bf5xx-ac97.c
+++ b/sound/soc/blackfin/bf5xx-ac97.c
@@ -375,18 +375,7 @@ static struct platform_driver asoc_bfin_ac97_driver = {
375 .remove = __devexit_p(asoc_bfin_ac97_remove), 375 .remove = __devexit_p(asoc_bfin_ac97_remove),
376}; 376};
377 377
378static int __init bfin_ac97_init(void) 378module_platform_driver(asoc_bfin_ac97_driver);
379{
380 return platform_driver_register(&asoc_bfin_ac97_driver);
381}
382module_init(bfin_ac97_init);
383
384static void __exit bfin_ac97_exit(void)
385{
386 platform_driver_unregister(&asoc_bfin_ac97_driver);
387}
388module_exit(bfin_ac97_exit);
389
390 379
391MODULE_AUTHOR("Roy Huang"); 380MODULE_AUTHOR("Roy Huang");
392MODULE_DESCRIPTION("AC97 driver for ADI Blackfin"); 381MODULE_DESCRIPTION("AC97 driver for ADI Blackfin");
diff --git a/sound/soc/blackfin/bf5xx-ad1836.c b/sound/soc/blackfin/bf5xx-ad1836.c
index f79d1655e03..60962ce6cd4 100644
--- a/sound/soc/blackfin/bf5xx-ad1836.c
+++ b/sound/soc/blackfin/bf5xx-ad1836.c
@@ -91,6 +91,7 @@ static struct snd_soc_dai_link bf5xx_ad1836_dai[] = {
91 91
92static struct snd_soc_card bf5xx_ad1836 = { 92static struct snd_soc_card bf5xx_ad1836 = {
93 .name = "bfin-ad1836", 93 .name = "bfin-ad1836",
94 .owner = THIS_MODULE,
94 .dai_link = &bf5xx_ad1836_dai[CONFIG_SND_BF5XX_SPORT_NUM], 95 .dai_link = &bf5xx_ad1836_dai[CONFIG_SND_BF5XX_SPORT_NUM],
95 .num_links = 1, 96 .num_links = 1,
96}; 97};
diff --git a/sound/soc/blackfin/bf5xx-ad193x.c b/sound/soc/blackfin/bf5xx-ad193x.c
index 5956584ea3a..2d8d82dbc15 100644
--- a/sound/soc/blackfin/bf5xx-ad193x.c
+++ b/sound/soc/blackfin/bf5xx-ad193x.c
@@ -119,6 +119,7 @@ static struct snd_soc_dai_link bf5xx_ad193x_dai[] = {
119 119
120static struct snd_soc_card bf5xx_ad193x = { 120static struct snd_soc_card bf5xx_ad193x = {
121 .name = "bfin-ad193x", 121 .name = "bfin-ad193x",
122 .owner = THIS_MODULE,
122 .dai_link = &bf5xx_ad193x_dai[CONFIG_SND_BF5XX_SPORT_NUM], 123 .dai_link = &bf5xx_ad193x_dai[CONFIG_SND_BF5XX_SPORT_NUM],
123 .num_links = 1, 124 .num_links = 1,
124}; 125};
diff --git a/sound/soc/blackfin/bf5xx-ad1980.c b/sound/soc/blackfin/bf5xx-ad1980.c
index 06a84b211b5..b30f88bbd70 100644
--- a/sound/soc/blackfin/bf5xx-ad1980.c
+++ b/sound/soc/blackfin/bf5xx-ad1980.c
@@ -74,6 +74,7 @@ static struct snd_soc_dai_link bf5xx_board_dai[] = {
74 74
75static struct snd_soc_card bf5xx_board = { 75static struct snd_soc_card bf5xx_board = {
76 .name = "bfin-ad1980", 76 .name = "bfin-ad1980",
77 .owner = THIS_MODULE,
77 .dai_link = &bf5xx_board_dai[CONFIG_SND_BF5XX_SPORT_NUM], 78 .dai_link = &bf5xx_board_dai[CONFIG_SND_BF5XX_SPORT_NUM],
78 .num_links = 1, 79 .num_links = 1,
79}; 80};
diff --git a/sound/soc/blackfin/bf5xx-ad73311.c b/sound/soc/blackfin/bf5xx-ad73311.c
index b94eb7ef7d1..8e49508596d 100644
--- a/sound/soc/blackfin/bf5xx-ad73311.c
+++ b/sound/soc/blackfin/bf5xx-ad73311.c
@@ -192,6 +192,7 @@ static struct snd_soc_dai_link bf5xx_ad73311_dai[] = {
192 192
193static struct snd_soc_card bf5xx_ad73311 = { 193static struct snd_soc_card bf5xx_ad73311 = {
194 .name = "bfin-ad73311", 194 .name = "bfin-ad73311",
195 .owner = THIS_MODULE,
195 .probe = bf5xx_probe, 196 .probe = bf5xx_probe,
196 .dai_link = &bf5xx_ad73311_dai[CONFIG_SND_BF5XX_SPORT_NUM], 197 .dai_link = &bf5xx_ad73311_dai[CONFIG_SND_BF5XX_SPORT_NUM],
197 .num_links = 1, 198 .num_links = 1,
diff --git a/sound/soc/blackfin/bf5xx-i2s-pcm.c b/sound/soc/blackfin/bf5xx-i2s-pcm.c
index 7565e1576ff..63205d723ea 100644
--- a/sound/soc/blackfin/bf5xx-i2s-pcm.c
+++ b/sound/soc/blackfin/bf5xx-i2s-pcm.c
@@ -260,7 +260,6 @@ static u64 bf5xx_pcm_dmamask = DMA_BIT_MASK(32);
260static int bf5xx_pcm_i2s_new(struct snd_soc_pcm_runtime *rtd) 260static int bf5xx_pcm_i2s_new(struct snd_soc_pcm_runtime *rtd)
261{ 261{
262 struct snd_card *card = rtd->card->snd_card; 262 struct snd_card *card = rtd->card->snd_card;
263 struct snd_soc_dai *dai = rtd->cpu_dai;
264 struct snd_pcm *pcm = rtd->pcm; 263 struct snd_pcm *pcm = rtd->pcm;
265 int ret = 0; 264 int ret = 0;
266 265
@@ -270,14 +269,14 @@ static int bf5xx_pcm_i2s_new(struct snd_soc_pcm_runtime *rtd)
270 if (!card->dev->coherent_dma_mask) 269 if (!card->dev->coherent_dma_mask)
271 card->dev->coherent_dma_mask = DMA_BIT_MASK(32); 270 card->dev->coherent_dma_mask = DMA_BIT_MASK(32);
272 271
273 if (dai->driver->playback.channels_min) { 272 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
274 ret = bf5xx_pcm_preallocate_dma_buffer(pcm, 273 ret = bf5xx_pcm_preallocate_dma_buffer(pcm,
275 SNDRV_PCM_STREAM_PLAYBACK); 274 SNDRV_PCM_STREAM_PLAYBACK);
276 if (ret) 275 if (ret)
277 goto out; 276 goto out;
278 } 277 }
279 278
280 if (dai->driver->capture.channels_min) { 279 if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) {
281 ret = bf5xx_pcm_preallocate_dma_buffer(pcm, 280 ret = bf5xx_pcm_preallocate_dma_buffer(pcm,
282 SNDRV_PCM_STREAM_CAPTURE); 281 SNDRV_PCM_STREAM_CAPTURE);
283 if (ret) 282 if (ret)
@@ -314,17 +313,7 @@ static struct platform_driver bfin_i2s_pcm_driver = {
314 .remove = __devexit_p(bfin_i2s_soc_platform_remove), 313 .remove = __devexit_p(bfin_i2s_soc_platform_remove),
315}; 314};
316 315
317static int __init snd_bfin_i2s_pcm_init(void) 316module_platform_driver(bfin_i2s_pcm_driver);
318{
319 return platform_driver_register(&bfin_i2s_pcm_driver);
320}
321module_init(snd_bfin_i2s_pcm_init);
322
323static void __exit snd_bfin_i2s_pcm_exit(void)
324{
325 platform_driver_unregister(&bfin_i2s_pcm_driver);
326}
327module_exit(snd_bfin_i2s_pcm_exit);
328 317
329MODULE_AUTHOR("Cliff Cai"); 318MODULE_AUTHOR("Cliff Cai");
330MODULE_DESCRIPTION("ADI Blackfin I2S PCM DMA module"); 319MODULE_DESCRIPTION("ADI Blackfin I2S PCM DMA module");
diff --git a/sound/soc/blackfin/bf5xx-i2s.c b/sound/soc/blackfin/bf5xx-i2s.c
index 00cc3e00b2f..4dccf0374fe 100644
--- a/sound/soc/blackfin/bf5xx-i2s.c
+++ b/sound/soc/blackfin/bf5xx-i2s.c
@@ -223,7 +223,7 @@ static int bf5xx_i2s_resume(struct snd_soc_dai *dai)
223 SNDRV_PCM_FMTBIT_S24_LE | \ 223 SNDRV_PCM_FMTBIT_S24_LE | \
224 SNDRV_PCM_FMTBIT_S32_LE) 224 SNDRV_PCM_FMTBIT_S32_LE)
225 225
226static struct snd_soc_dai_ops bf5xx_i2s_dai_ops = { 226static const struct snd_soc_dai_ops bf5xx_i2s_dai_ops = {
227 .shutdown = bf5xx_i2s_shutdown, 227 .shutdown = bf5xx_i2s_shutdown,
228 .hw_params = bf5xx_i2s_hw_params, 228 .hw_params = bf5xx_i2s_hw_params,
229 .set_fmt = bf5xx_i2s_set_dai_fmt, 229 .set_fmt = bf5xx_i2s_set_dai_fmt,
@@ -288,18 +288,7 @@ static struct platform_driver bfin_i2s_driver = {
288 }, 288 },
289}; 289};
290 290
291static int __init bfin_i2s_init(void) 291module_platform_driver(bfin_i2s_driver);
292{
293 return platform_driver_register(&bfin_i2s_driver);
294}
295
296static void __exit bfin_i2s_exit(void)
297{
298 platform_driver_unregister(&bfin_i2s_driver);
299}
300
301module_init(bfin_i2s_init);
302module_exit(bfin_i2s_exit);
303 292
304/* Module information */ 293/* Module information */
305MODULE_AUTHOR("Cliff Cai"); 294MODULE_AUTHOR("Cliff Cai");
diff --git a/sound/soc/blackfin/bf5xx-ssm2602.c b/sound/soc/blackfin/bf5xx-ssm2602.c
index 767e772a815..03030323804 100644
--- a/sound/soc/blackfin/bf5xx-ssm2602.c
+++ b/sound/soc/blackfin/bf5xx-ssm2602.c
@@ -125,6 +125,7 @@ static struct snd_soc_dai_link bf5xx_ssm2602_dai[] = {
125 125
126static struct snd_soc_card bf5xx_ssm2602 = { 126static struct snd_soc_card bf5xx_ssm2602 = {
127 .name = "bfin-ssm2602", 127 .name = "bfin-ssm2602",
128 .owner = THIS_MODULE,
128 .dai_link = &bf5xx_ssm2602_dai[CONFIG_SND_BF5XX_SPORT_NUM], 129 .dai_link = &bf5xx_ssm2602_dai[CONFIG_SND_BF5XX_SPORT_NUM],
129 .num_links = 1, 130 .num_links = 1,
130}; 131};
diff --git a/sound/soc/blackfin/bf5xx-tdm-pcm.c b/sound/soc/blackfin/bf5xx-tdm-pcm.c
index c95cc03d583..254490cf187 100644
--- a/sound/soc/blackfin/bf5xx-tdm-pcm.c
+++ b/sound/soc/blackfin/bf5xx-tdm-pcm.c
@@ -286,7 +286,6 @@ static u64 bf5xx_pcm_dmamask = DMA_BIT_MASK(32);
286static int bf5xx_pcm_tdm_new(struct snd_soc_pcm_runtime *rtd) 286static int bf5xx_pcm_tdm_new(struct snd_soc_pcm_runtime *rtd)
287{ 287{
288 struct snd_card *card = rtd->card->snd_card; 288 struct snd_card *card = rtd->card->snd_card;
289 struct snd_soc_dai *dai = rtd->cpu_dai;
290 struct snd_pcm *pcm = rtd->pcm; 289 struct snd_pcm *pcm = rtd->pcm;
291 int ret = 0; 290 int ret = 0;
292 291
@@ -295,14 +294,14 @@ static int bf5xx_pcm_tdm_new(struct snd_soc_pcm_runtime *rtd)
295 if (!card->dev->coherent_dma_mask) 294 if (!card->dev->coherent_dma_mask)
296 card->dev->coherent_dma_mask = DMA_BIT_MASK(32); 295 card->dev->coherent_dma_mask = DMA_BIT_MASK(32);
297 296
298 if (dai->driver->playback.channels_min) { 297 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
299 ret = bf5xx_pcm_preallocate_dma_buffer(pcm, 298 ret = bf5xx_pcm_preallocate_dma_buffer(pcm,
300 SNDRV_PCM_STREAM_PLAYBACK); 299 SNDRV_PCM_STREAM_PLAYBACK);
301 if (ret) 300 if (ret)
302 goto out; 301 goto out;
303 } 302 }
304 303
305 if (dai->driver->capture.channels_min) { 304 if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) {
306 ret = bf5xx_pcm_preallocate_dma_buffer(pcm, 305 ret = bf5xx_pcm_preallocate_dma_buffer(pcm,
307 SNDRV_PCM_STREAM_CAPTURE); 306 SNDRV_PCM_STREAM_CAPTURE);
308 if (ret) 307 if (ret)
@@ -339,17 +338,7 @@ static struct platform_driver bfin_tdm_driver = {
339 .remove = __devexit_p(bf5xx_soc_platform_remove), 338 .remove = __devexit_p(bf5xx_soc_platform_remove),
340}; 339};
341 340
342static int __init snd_bfin_tdm_init(void) 341module_platform_driver(bfin_tdm_driver);
343{
344 return platform_driver_register(&bfin_tdm_driver);
345}
346module_init(snd_bfin_tdm_init);
347
348static void __exit snd_bfin_tdm_exit(void)
349{
350 platform_driver_unregister(&bfin_tdm_driver);
351}
352module_exit(snd_bfin_tdm_exit);
353 342
354MODULE_AUTHOR("Barry Song"); 343MODULE_AUTHOR("Barry Song");
355MODULE_DESCRIPTION("ADI Blackfin TDM PCM DMA module"); 344MODULE_DESCRIPTION("ADI Blackfin TDM PCM DMA module");
diff --git a/sound/soc/blackfin/bf5xx-tdm.c b/sound/soc/blackfin/bf5xx-tdm.c
index a822d1ee138..594f88217c7 100644
--- a/sound/soc/blackfin/bf5xx-tdm.c
+++ b/sound/soc/blackfin/bf5xx-tdm.c
@@ -226,7 +226,7 @@ static int bf5xx_tdm_resume(struct snd_soc_dai *dai)
226#define bf5xx_tdm_resume NULL 226#define bf5xx_tdm_resume NULL
227#endif 227#endif
228 228
229static struct snd_soc_dai_ops bf5xx_tdm_dai_ops = { 229static const struct snd_soc_dai_ops bf5xx_tdm_dai_ops = {
230 .hw_params = bf5xx_tdm_hw_params, 230 .hw_params = bf5xx_tdm_hw_params,
231 .set_fmt = bf5xx_tdm_set_dai_fmt, 231 .set_fmt = bf5xx_tdm_set_dai_fmt,
232 .shutdown = bf5xx_tdm_shutdown, 232 .shutdown = bf5xx_tdm_shutdown,
@@ -314,17 +314,7 @@ static struct platform_driver bfin_tdm_driver = {
314 }, 314 },
315}; 315};
316 316
317static int __init bfin_tdm_init(void) 317module_platform_driver(bfin_tdm_driver);
318{
319 return platform_driver_register(&bfin_tdm_driver);
320}
321module_init(bfin_tdm_init);
322
323static void __exit bfin_tdm_exit(void)
324{
325 platform_driver_unregister(&bfin_tdm_driver);
326}
327module_exit(bfin_tdm_exit);
328 318
329/* Module information */ 319/* Module information */
330MODULE_AUTHOR("Barry Song"); 320MODULE_AUTHOR("Barry Song");
diff --git a/sound/soc/blackfin/bfin-eval-adau1373.c b/sound/soc/blackfin/bfin-eval-adau1373.c
index 8df2a3b0cb3..26b271c62ef 100644
--- a/sound/soc/blackfin/bfin-eval-adau1373.c
+++ b/sound/soc/blackfin/bfin-eval-adau1373.c
@@ -147,6 +147,7 @@ static struct snd_soc_dai_link bfin_eval_adau1373_dai = {
147 147
148static struct snd_soc_card bfin_eval_adau1373 = { 148static struct snd_soc_card bfin_eval_adau1373 = {
149 .name = "bfin-eval-adau1373", 149 .name = "bfin-eval-adau1373",
150 .owner = THIS_MODULE,
150 .dai_link = &bfin_eval_adau1373_dai, 151 .dai_link = &bfin_eval_adau1373_dai,
151 .num_links = 1, 152 .num_links = 1,
152 153
@@ -184,17 +185,7 @@ static struct platform_driver bfin_eval_adau1373_driver = {
184 .remove = __devexit_p(bfin_eval_adau1373_remove), 185 .remove = __devexit_p(bfin_eval_adau1373_remove),
185}; 186};
186 187
187static int __init bfin_eval_adau1373_init(void) 188module_platform_driver(bfin_eval_adau1373_driver);
188{
189 return platform_driver_register(&bfin_eval_adau1373_driver);
190}
191module_init(bfin_eval_adau1373_init);
192
193static void __exit bfin_eval_adau1373_exit(void)
194{
195 platform_driver_unregister(&bfin_eval_adau1373_driver);
196}
197module_exit(bfin_eval_adau1373_exit);
198 189
199MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>"); 190MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>");
200MODULE_DESCRIPTION("ALSA SoC bfin adau1373 driver"); 191MODULE_DESCRIPTION("ALSA SoC bfin adau1373 driver");
diff --git a/sound/soc/blackfin/bfin-eval-adau1701.c b/sound/soc/blackfin/bfin-eval-adau1701.c
index e5550acba2c..c0064fa1dca 100644
--- a/sound/soc/blackfin/bfin-eval-adau1701.c
+++ b/sound/soc/blackfin/bfin-eval-adau1701.c
@@ -84,6 +84,7 @@ static struct snd_soc_dai_link bfin_eval_adau1701_dai[] = {
84 84
85static struct snd_soc_card bfin_eval_adau1701 = { 85static struct snd_soc_card bfin_eval_adau1701 = {
86 .name = "bfin-eval-adau1701", 86 .name = "bfin-eval-adau1701",
87 .owner = THIS_MODULE,
87 .dai_link = &bfin_eval_adau1701_dai[CONFIG_SND_BF5XX_SPORT_NUM], 88 .dai_link = &bfin_eval_adau1701_dai[CONFIG_SND_BF5XX_SPORT_NUM],
88 .num_links = 1, 89 .num_links = 1,
89 90
@@ -121,17 +122,7 @@ static struct platform_driver bfin_eval_adau1701_driver = {
121 .remove = __devexit_p(bfin_eval_adau1701_remove), 122 .remove = __devexit_p(bfin_eval_adau1701_remove),
122}; 123};
123 124
124static int __init bfin_eval_adau1701_init(void) 125module_platform_driver(bfin_eval_adau1701_driver);
125{
126 return platform_driver_register(&bfin_eval_adau1701_driver);
127}
128module_init(bfin_eval_adau1701_init);
129
130static void __exit bfin_eval_adau1701_exit(void)
131{
132 platform_driver_unregister(&bfin_eval_adau1701_driver);
133}
134module_exit(bfin_eval_adau1701_exit);
135 126
136MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>"); 127MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>");
137MODULE_DESCRIPTION("ALSA SoC bfin ADAU1701 driver"); 128MODULE_DESCRIPTION("ALSA SoC bfin ADAU1701 driver");
diff --git a/sound/soc/blackfin/bfin-eval-adav80x.c b/sound/soc/blackfin/bfin-eval-adav80x.c
index 897cfa68a2a..4ef079f95e2 100644
--- a/sound/soc/blackfin/bfin-eval-adav80x.c
+++ b/sound/soc/blackfin/bfin-eval-adav80x.c
@@ -93,6 +93,7 @@ static struct snd_soc_dai_link bfin_eval_adav80x_dais[] = {
93 93
94static struct snd_soc_card bfin_eval_adav80x = { 94static struct snd_soc_card bfin_eval_adav80x = {
95 .name = "bfin-eval-adav80x", 95 .name = "bfin-eval-adav80x",
96 .owner = THIS_MODULE,
96 .dai_link = bfin_eval_adav80x_dais, 97 .dai_link = bfin_eval_adav80x_dais,
97 .num_links = ARRAY_SIZE(bfin_eval_adav80x_dais), 98 .num_links = ARRAY_SIZE(bfin_eval_adav80x_dais),
98 99
@@ -157,17 +158,7 @@ static struct platform_driver bfin_eval_adav80x_driver = {
157 .id_table = bfin_eval_adav80x_ids, 158 .id_table = bfin_eval_adav80x_ids,
158}; 159};
159 160
160static int __init bfin_eval_adav80x_init(void) 161module_platform_driver(bfin_eval_adav80x_driver);
161{
162 return platform_driver_register(&bfin_eval_adav80x_driver);
163}
164module_init(bfin_eval_adav80x_init);
165
166static void __exit bfin_eval_adav80x_exit(void)
167{
168 platform_driver_unregister(&bfin_eval_adav80x_driver);
169}
170module_exit(bfin_eval_adav80x_exit);
171 162
172MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>"); 163MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>");
173MODULE_DESCRIPTION("ALSA SoC bfin adav80x driver"); 164MODULE_DESCRIPTION("ALSA SoC bfin adav80x driver");
diff --git a/sound/soc/codecs/88pm860x-codec.c b/sound/soc/codecs/88pm860x-codec.c
index 5ca122e5118..9fd3b6827bb 100644
--- a/sound/soc/codecs/88pm860x-codec.c
+++ b/sound/soc/codecs/88pm860x-codec.c
@@ -861,7 +861,7 @@ static const struct snd_soc_dapm_widget pm860x_dapm_widgets[] = {
861 PM860X_DAPM_OUTPUT("RSYNC", pm860x_rsync_event), 861 PM860X_DAPM_OUTPUT("RSYNC", pm860x_rsync_event),
862}; 862};
863 863
864static const struct snd_soc_dapm_route audio_map[] = { 864static const struct snd_soc_dapm_route pm860x_dapm_routes[] = {
865 /* supply */ 865 /* supply */
866 {"Left DAC", NULL, "VCODEC"}, 866 {"Left DAC", NULL, "VCODEC"},
867 {"Right DAC", NULL, "VCODEC"}, 867 {"Right DAC", NULL, "VCODEC"},
@@ -1198,14 +1198,14 @@ static int pm860x_set_bias_level(struct snd_soc_codec *codec,
1198 return 0; 1198 return 0;
1199} 1199}
1200 1200
1201static struct snd_soc_dai_ops pm860x_pcm_dai_ops = { 1201static const struct snd_soc_dai_ops pm860x_pcm_dai_ops = {
1202 .digital_mute = pm860x_digital_mute, 1202 .digital_mute = pm860x_digital_mute,
1203 .hw_params = pm860x_pcm_hw_params, 1203 .hw_params = pm860x_pcm_hw_params,
1204 .set_fmt = pm860x_pcm_set_dai_fmt, 1204 .set_fmt = pm860x_pcm_set_dai_fmt,
1205 .set_sysclk = pm860x_set_dai_sysclk, 1205 .set_sysclk = pm860x_set_dai_sysclk,
1206}; 1206};
1207 1207
1208static struct snd_soc_dai_ops pm860x_i2s_dai_ops = { 1208static const struct snd_soc_dai_ops pm860x_i2s_dai_ops = {
1209 .digital_mute = pm860x_digital_mute, 1209 .digital_mute = pm860x_digital_mute,
1210 .hw_params = pm860x_i2s_hw_params, 1210 .hw_params = pm860x_i2s_hw_params,
1211 .set_fmt = pm860x_i2s_set_dai_fmt, 1211 .set_fmt = pm860x_i2s_set_dai_fmt,
@@ -1361,7 +1361,6 @@ EXPORT_SYMBOL_GPL(pm860x_mic_jack_detect);
1361static int pm860x_probe(struct snd_soc_codec *codec) 1361static int pm860x_probe(struct snd_soc_codec *codec)
1362{ 1362{
1363 struct pm860x_priv *pm860x = snd_soc_codec_get_drvdata(codec); 1363 struct pm860x_priv *pm860x = snd_soc_codec_get_drvdata(codec);
1364 struct snd_soc_dapm_context *dapm = &codec->dapm;
1365 int i, ret; 1364 int i, ret;
1366 1365
1367 pm860x->codec = codec; 1366 pm860x->codec = codec;
@@ -1388,11 +1387,6 @@ static int pm860x_probe(struct snd_soc_codec *codec)
1388 goto out; 1387 goto out;
1389 } 1388 }
1390 1389
1391 snd_soc_add_controls(codec, pm860x_snd_controls,
1392 ARRAY_SIZE(pm860x_snd_controls));
1393 snd_soc_dapm_new_controls(dapm, pm860x_dapm_widgets,
1394 ARRAY_SIZE(pm860x_dapm_widgets));
1395 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
1396 return 0; 1390 return 0;
1397 1391
1398out: 1392out:
@@ -1420,6 +1414,13 @@ static struct snd_soc_codec_driver soc_codec_dev_pm860x = {
1420 .reg_cache_size = REG_CACHE_SIZE, 1414 .reg_cache_size = REG_CACHE_SIZE,
1421 .reg_word_size = sizeof(u8), 1415 .reg_word_size = sizeof(u8),
1422 .set_bias_level = pm860x_set_bias_level, 1416 .set_bias_level = pm860x_set_bias_level,
1417
1418 .controls = pm860x_snd_controls,
1419 .num_controls = ARRAY_SIZE(pm860x_snd_controls),
1420 .dapm_widgets = pm860x_dapm_widgets,
1421 .num_dapm_widgets = ARRAY_SIZE(pm860x_dapm_widgets),
1422 .dapm_routes = pm860x_dapm_routes,
1423 .num_dapm_routes = ARRAY_SIZE(pm860x_dapm_routes),
1423}; 1424};
1424 1425
1425static int __devinit pm860x_codec_probe(struct platform_device *pdev) 1426static int __devinit pm860x_codec_probe(struct platform_device *pdev)
@@ -1429,7 +1430,8 @@ static int __devinit pm860x_codec_probe(struct platform_device *pdev)
1429 struct resource *res; 1430 struct resource *res;
1430 int i, ret; 1431 int i, ret;
1431 1432
1432 pm860x = kzalloc(sizeof(struct pm860x_priv), GFP_KERNEL); 1433 pm860x = devm_kzalloc(&pdev->dev, sizeof(struct pm860x_priv),
1434 GFP_KERNEL);
1433 if (pm860x == NULL) 1435 if (pm860x == NULL)
1434 return -ENOMEM; 1436 return -ENOMEM;
1435 1437
@@ -1458,17 +1460,13 @@ static int __devinit pm860x_codec_probe(struct platform_device *pdev)
1458 1460
1459out: 1461out:
1460 platform_set_drvdata(pdev, NULL); 1462 platform_set_drvdata(pdev, NULL);
1461 kfree(pm860x);
1462 return -EINVAL; 1463 return -EINVAL;
1463} 1464}
1464 1465
1465static int __devexit pm860x_codec_remove(struct platform_device *pdev) 1466static int __devexit pm860x_codec_remove(struct platform_device *pdev)
1466{ 1467{
1467 struct pm860x_priv *pm860x = platform_get_drvdata(pdev);
1468
1469 snd_soc_unregister_codec(&pdev->dev); 1468 snd_soc_unregister_codec(&pdev->dev);
1470 platform_set_drvdata(pdev, NULL); 1469 platform_set_drvdata(pdev, NULL);
1471 kfree(pm860x);
1472 return 0; 1470 return 0;
1473} 1471}
1474 1472
@@ -1481,17 +1479,7 @@ static struct platform_driver pm860x_codec_driver = {
1481 .remove = __devexit_p(pm860x_codec_remove), 1479 .remove = __devexit_p(pm860x_codec_remove),
1482}; 1480};
1483 1481
1484static __init int pm860x_init(void) 1482module_platform_driver(pm860x_codec_driver);
1485{
1486 return platform_driver_register(&pm860x_codec_driver);
1487}
1488module_init(pm860x_init);
1489
1490static __exit void pm860x_exit(void)
1491{
1492 platform_driver_unregister(&pm860x_codec_driver);
1493}
1494module_exit(pm860x_exit);
1495 1483
1496MODULE_DESCRIPTION("ASoC 88PM860x driver"); 1484MODULE_DESCRIPTION("ASoC 88PM860x driver");
1497MODULE_AUTHOR("Haojian Zhuang <haojian.zhuang@marvell.com>"); 1485MODULE_AUTHOR("Haojian Zhuang <haojian.zhuang@marvell.com>");
diff --git a/sound/soc/codecs/Kconfig b/sound/soc/codecs/Kconfig
index 4584514d93d..7c205e77d83 100644
--- a/sound/soc/codecs/Kconfig
+++ b/sound/soc/codecs/Kconfig
@@ -26,14 +26,16 @@ config SND_SOC_ALL_CODECS
26 select SND_SOC_AK4642 if I2C 26 select SND_SOC_AK4642 if I2C
27 select SND_SOC_AK4671 if I2C 27 select SND_SOC_AK4671 if I2C
28 select SND_SOC_ALC5623 if I2C 28 select SND_SOC_ALC5623 if I2C
29 select SND_SOC_ALC5632 if I2C
29 select SND_SOC_CQ0093VC if MFD_DAVINCI_VOICECODEC 30 select SND_SOC_CQ0093VC if MFD_DAVINCI_VOICECODEC
30 select SND_SOC_CS42L51 if I2C 31 select SND_SOC_CS42L51 if I2C
32 select SND_SOC_CS42L73 if I2C
31 select SND_SOC_CS4270 if I2C 33 select SND_SOC_CS4270 if I2C
32 select SND_SOC_CS4271 if SND_SOC_I2C_AND_SPI 34 select SND_SOC_CS4271 if SND_SOC_I2C_AND_SPI
33 select SND_SOC_CX20442 35 select SND_SOC_CX20442
34 select SND_SOC_DA7210 if I2C 36 select SND_SOC_DA7210 if I2C
35 select SND_SOC_DFBMCS320 37 select SND_SOC_DFBMCS320
36 select SND_SOC_JZ4740_CODEC if SOC_JZ4740 38 select SND_SOC_JZ4740_CODEC
37 select SND_SOC_LM4857 if I2C 39 select SND_SOC_LM4857 if I2C
38 select SND_SOC_MAX98088 if I2C 40 select SND_SOC_MAX98088 if I2C
39 select SND_SOC_MAX98095 if I2C 41 select SND_SOC_MAX98095 if I2C
@@ -139,7 +141,7 @@ config SND_SOC_AD73311
139 tristate 141 tristate
140 142
141config SND_SOC_ADAU1701 143config SND_SOC_ADAU1701
142 select SIGMA 144 select SND_SOC_SIGMADSP
143 tristate 145 tristate
144 146
145config SND_SOC_ADAU1373 147config SND_SOC_ADAU1373
@@ -168,6 +170,8 @@ config SND_SOC_AK4671
168 170
169config SND_SOC_ALC5623 171config SND_SOC_ALC5623
170 tristate 172 tristate
173config SND_SOC_ALC5632
174 tristate
171 175
172config SND_SOC_CQ0093VC 176config SND_SOC_CQ0093VC
173 tristate 177 tristate
@@ -175,6 +179,9 @@ config SND_SOC_CQ0093VC
175config SND_SOC_CS42L51 179config SND_SOC_CS42L51
176 tristate 180 tristate
177 181
182config SND_SOC_CS42L73
183 tristate
184
178# Cirrus Logic CS4270 Codec 185# Cirrus Logic CS4270 Codec
179config SND_SOC_CS4270 186config SND_SOC_CS4270
180 tristate 187 tristate
@@ -227,6 +234,10 @@ config SND_SOC_RT5631
227config SND_SOC_SGTL5000 234config SND_SOC_SGTL5000
228 tristate 235 tristate
229 236
237config SND_SOC_SIGMADSP
238 tristate
239 select CRC32
240
230config SND_SOC_SN95031 241config SND_SOC_SN95031
231 tristate 242 tristate
232 243
@@ -278,6 +289,9 @@ config SND_SOC_WL1273
278config SND_SOC_WM1250_EV1 289config SND_SOC_WM1250_EV1
279 tristate 290 tristate
280 291
292config SND_SOC_WM2000
293 tristate
294
281config SND_SOC_WM5100 295config SND_SOC_WM5100
282 tristate 296 tristate
283 297
@@ -395,6 +409,9 @@ config SND_SOC_WM8996
395config SND_SOC_WM9081 409config SND_SOC_WM9081
396 tristate 410 tristate
397 411
412config SND_SOC_WM9090
413 tristate
414
398config SND_SOC_WM9705 415config SND_SOC_WM9705
399 tristate 416 tristate
400 417
@@ -413,9 +430,3 @@ config SND_SOC_MAX9877
413 430
414config SND_SOC_TPA6130A2 431config SND_SOC_TPA6130A2
415 tristate 432 tristate
416
417config SND_SOC_WM2000
418 tristate
419
420config SND_SOC_WM9090
421 tristate
diff --git a/sound/soc/codecs/Makefile b/sound/soc/codecs/Makefile
index a2c7842e357..de8078178f8 100644
--- a/sound/soc/codecs/Makefile
+++ b/sound/soc/codecs/Makefile
@@ -15,13 +15,16 @@ snd-soc-ak4642-objs := ak4642.o
15snd-soc-ak4671-objs := ak4671.o 15snd-soc-ak4671-objs := ak4671.o
16snd-soc-cq93vc-objs := cq93vc.o 16snd-soc-cq93vc-objs := cq93vc.o
17snd-soc-cs42l51-objs := cs42l51.o 17snd-soc-cs42l51-objs := cs42l51.o
18snd-soc-cs42l73-objs := cs42l73.o
18snd-soc-cs4270-objs := cs4270.o 19snd-soc-cs4270-objs := cs4270.o
19snd-soc-cs4271-objs := cs4271.o 20snd-soc-cs4271-objs := cs4271.o
20snd-soc-cx20442-objs := cx20442.o 21snd-soc-cx20442-objs := cx20442.o
21snd-soc-da7210-objs := da7210.o 22snd-soc-da7210-objs := da7210.o
22snd-soc-dfbmcs320-objs := dfbmcs320.o 23snd-soc-dfbmcs320-objs := dfbmcs320.o
23snd-soc-dmic-objs := dmic.o 24snd-soc-dmic-objs := dmic.o
25snd-soc-jz4740-codec-objs := jz4740.o
24snd-soc-l3-objs := l3.o 26snd-soc-l3-objs := l3.o
27snd-soc-lm4857-objs := lm4857.o
25snd-soc-max98088-objs := max98088.o 28snd-soc-max98088-objs := max98088.o
26snd-soc-max98095-objs := max98095.o 29snd-soc-max98095-objs := max98095.o
27snd-soc-max9850-objs := max9850.o 30snd-soc-max9850-objs := max9850.o
@@ -29,6 +32,8 @@ snd-soc-pcm3008-objs := pcm3008.o
29snd-soc-rt5631-objs := rt5631.o 32snd-soc-rt5631-objs := rt5631.o
30snd-soc-sgtl5000-objs := sgtl5000.o 33snd-soc-sgtl5000-objs := sgtl5000.o
31snd-soc-alc5623-objs := alc5623.o 34snd-soc-alc5623-objs := alc5623.o
35snd-soc-alc5632-objs := alc5632.o
36snd-soc-sigmadsp-objs := sigmadsp.o
32snd-soc-sn95031-objs := sn95031.o 37snd-soc-sn95031-objs := sn95031.o
33snd-soc-spdif-objs := spdif_transciever.o 38snd-soc-spdif-objs := spdif_transciever.o
34snd-soc-ssm2602-objs := ssm2602.o 39snd-soc-ssm2602-objs := ssm2602.o
@@ -45,6 +50,7 @@ snd-soc-uda134x-objs := uda134x.o
45snd-soc-uda1380-objs := uda1380.o 50snd-soc-uda1380-objs := uda1380.o
46snd-soc-wl1273-objs := wl1273.o 51snd-soc-wl1273-objs := wl1273.o
47snd-soc-wm1250-ev1-objs := wm1250-ev1.o 52snd-soc-wm1250-ev1-objs := wm1250-ev1.o
53snd-soc-wm2000-objs := wm2000.o
48snd-soc-wm5100-objs := wm5100.o wm5100-tables.o 54snd-soc-wm5100-objs := wm5100.o wm5100-tables.o
49snd-soc-wm8350-objs := wm8350.o 55snd-soc-wm8350-objs := wm8350.o
50snd-soc-wm8400-objs := wm8400.o 56snd-soc-wm8400-objs := wm8400.o
@@ -81,21 +87,18 @@ snd-soc-wm8988-objs := wm8988.o
81snd-soc-wm8990-objs := wm8990.o 87snd-soc-wm8990-objs := wm8990.o
82snd-soc-wm8991-objs := wm8991.o 88snd-soc-wm8991-objs := wm8991.o
83snd-soc-wm8993-objs := wm8993.o 89snd-soc-wm8993-objs := wm8993.o
84snd-soc-wm8994-objs := wm8994.o wm8994-tables.o wm8958-dsp2.o 90snd-soc-wm8994-objs := wm8994.o wm8958-dsp2.o
85snd-soc-wm8995-objs := wm8995.o 91snd-soc-wm8995-objs := wm8995.o
86snd-soc-wm9081-objs := wm9081.o 92snd-soc-wm9081-objs := wm9081.o
93snd-soc-wm9090-objs := wm9090.o
87snd-soc-wm9705-objs := wm9705.o 94snd-soc-wm9705-objs := wm9705.o
88snd-soc-wm9712-objs := wm9712.o 95snd-soc-wm9712-objs := wm9712.o
89snd-soc-wm9713-objs := wm9713.o 96snd-soc-wm9713-objs := wm9713.o
90snd-soc-wm-hubs-objs := wm_hubs.o 97snd-soc-wm-hubs-objs := wm_hubs.o
91snd-soc-jz4740-codec-objs := jz4740.o
92 98
93# Amp 99# Amp
94snd-soc-lm4857-objs := lm4857.o
95snd-soc-max9877-objs := max9877.o 100snd-soc-max9877-objs := max9877.o
96snd-soc-tpa6130a2-objs := tpa6130a2.o 101snd-soc-tpa6130a2-objs := tpa6130a2.o
97snd-soc-wm2000-objs := wm2000.o
98snd-soc-wm9090-objs := wm9090.o
99 102
100obj-$(CONFIG_SND_SOC_88PM860X) += snd-soc-88pm860x.o 103obj-$(CONFIG_SND_SOC_88PM860X) += snd-soc-88pm860x.o
101obj-$(CONFIG_SND_SOC_AC97_CODEC) += snd-soc-ac97.o 104obj-$(CONFIG_SND_SOC_AC97_CODEC) += snd-soc-ac97.o
@@ -113,8 +116,10 @@ obj-$(CONFIG_SND_SOC_AK4641) += snd-soc-ak4641.o
113obj-$(CONFIG_SND_SOC_AK4642) += snd-soc-ak4642.o 116obj-$(CONFIG_SND_SOC_AK4642) += snd-soc-ak4642.o
114obj-$(CONFIG_SND_SOC_AK4671) += snd-soc-ak4671.o 117obj-$(CONFIG_SND_SOC_AK4671) += snd-soc-ak4671.o
115obj-$(CONFIG_SND_SOC_ALC5623) += snd-soc-alc5623.o 118obj-$(CONFIG_SND_SOC_ALC5623) += snd-soc-alc5623.o
119obj-$(CONFIG_SND_SOC_ALC5632) += snd-soc-alc5632.o
116obj-$(CONFIG_SND_SOC_CQ0093VC) += snd-soc-cq93vc.o 120obj-$(CONFIG_SND_SOC_CQ0093VC) += snd-soc-cq93vc.o
117obj-$(CONFIG_SND_SOC_CS42L51) += snd-soc-cs42l51.o 121obj-$(CONFIG_SND_SOC_CS42L51) += snd-soc-cs42l51.o
122obj-$(CONFIG_SND_SOC_CS42L73) += snd-soc-cs42l73.o
118obj-$(CONFIG_SND_SOC_CS4270) += snd-soc-cs4270.o 123obj-$(CONFIG_SND_SOC_CS4270) += snd-soc-cs4270.o
119obj-$(CONFIG_SND_SOC_CS4271) += snd-soc-cs4271.o 124obj-$(CONFIG_SND_SOC_CS4271) += snd-soc-cs4271.o
120obj-$(CONFIG_SND_SOC_CX20442) += snd-soc-cx20442.o 125obj-$(CONFIG_SND_SOC_CX20442) += snd-soc-cx20442.o
@@ -122,6 +127,7 @@ obj-$(CONFIG_SND_SOC_DA7210) += snd-soc-da7210.o
122obj-$(CONFIG_SND_SOC_DFBMCS320) += snd-soc-dfbmcs320.o 127obj-$(CONFIG_SND_SOC_DFBMCS320) += snd-soc-dfbmcs320.o
123obj-$(CONFIG_SND_SOC_DMIC) += snd-soc-dmic.o 128obj-$(CONFIG_SND_SOC_DMIC) += snd-soc-dmic.o
124obj-$(CONFIG_SND_SOC_L3) += snd-soc-l3.o 129obj-$(CONFIG_SND_SOC_L3) += snd-soc-l3.o
130obj-$(CONFIG_SND_SOC_LM4857) += snd-soc-lm4857.o
125obj-$(CONFIG_SND_SOC_JZ4740_CODEC) += snd-soc-jz4740-codec.o 131obj-$(CONFIG_SND_SOC_JZ4740_CODEC) += snd-soc-jz4740-codec.o
126obj-$(CONFIG_SND_SOC_MAX98088) += snd-soc-max98088.o 132obj-$(CONFIG_SND_SOC_MAX98088) += snd-soc-max98088.o
127obj-$(CONFIG_SND_SOC_MAX98095) += snd-soc-max98095.o 133obj-$(CONFIG_SND_SOC_MAX98095) += snd-soc-max98095.o
@@ -129,6 +135,7 @@ obj-$(CONFIG_SND_SOC_MAX9850) += snd-soc-max9850.o
129obj-$(CONFIG_SND_SOC_PCM3008) += snd-soc-pcm3008.o 135obj-$(CONFIG_SND_SOC_PCM3008) += snd-soc-pcm3008.o
130obj-$(CONFIG_SND_SOC_RT5631) += snd-soc-rt5631.o 136obj-$(CONFIG_SND_SOC_RT5631) += snd-soc-rt5631.o
131obj-$(CONFIG_SND_SOC_SGTL5000) += snd-soc-sgtl5000.o 137obj-$(CONFIG_SND_SOC_SGTL5000) += snd-soc-sgtl5000.o
138obj-$(CONFIG_SND_SOC_SIGMADSP) += snd-soc-sigmadsp.o
132obj-$(CONFIG_SND_SOC_SN95031) +=snd-soc-sn95031.o 139obj-$(CONFIG_SND_SOC_SN95031) +=snd-soc-sn95031.o
133obj-$(CONFIG_SND_SOC_SPDIF) += snd-soc-spdif.o 140obj-$(CONFIG_SND_SOC_SPDIF) += snd-soc-spdif.o
134obj-$(CONFIG_SND_SOC_SSM2602) += snd-soc-ssm2602.o 141obj-$(CONFIG_SND_SOC_SSM2602) += snd-soc-ssm2602.o
@@ -145,6 +152,7 @@ obj-$(CONFIG_SND_SOC_UDA134X) += snd-soc-uda134x.o
145obj-$(CONFIG_SND_SOC_UDA1380) += snd-soc-uda1380.o 152obj-$(CONFIG_SND_SOC_UDA1380) += snd-soc-uda1380.o
146obj-$(CONFIG_SND_SOC_WL1273) += snd-soc-wl1273.o 153obj-$(CONFIG_SND_SOC_WL1273) += snd-soc-wl1273.o
147obj-$(CONFIG_SND_SOC_WM1250_EV1) += snd-soc-wm1250-ev1.o 154obj-$(CONFIG_SND_SOC_WM1250_EV1) += snd-soc-wm1250-ev1.o
155obj-$(CONFIG_SND_SOC_WM2000) += snd-soc-wm2000.o
148obj-$(CONFIG_SND_SOC_WM5100) += snd-soc-wm5100.o 156obj-$(CONFIG_SND_SOC_WM5100) += snd-soc-wm5100.o
149obj-$(CONFIG_SND_SOC_WM8350) += snd-soc-wm8350.o 157obj-$(CONFIG_SND_SOC_WM8350) += snd-soc-wm8350.o
150obj-$(CONFIG_SND_SOC_WM8400) += snd-soc-wm8400.o 158obj-$(CONFIG_SND_SOC_WM8400) += snd-soc-wm8400.o
@@ -184,14 +192,12 @@ obj-$(CONFIG_SND_SOC_WM8993) += snd-soc-wm8993.o
184obj-$(CONFIG_SND_SOC_WM8994) += snd-soc-wm8994.o 192obj-$(CONFIG_SND_SOC_WM8994) += snd-soc-wm8994.o
185obj-$(CONFIG_SND_SOC_WM8995) += snd-soc-wm8995.o 193obj-$(CONFIG_SND_SOC_WM8995) += snd-soc-wm8995.o
186obj-$(CONFIG_SND_SOC_WM9081) += snd-soc-wm9081.o 194obj-$(CONFIG_SND_SOC_WM9081) += snd-soc-wm9081.o
195obj-$(CONFIG_SND_SOC_WM9090) += snd-soc-wm9090.o
187obj-$(CONFIG_SND_SOC_WM9705) += snd-soc-wm9705.o 196obj-$(CONFIG_SND_SOC_WM9705) += snd-soc-wm9705.o
188obj-$(CONFIG_SND_SOC_WM9712) += snd-soc-wm9712.o 197obj-$(CONFIG_SND_SOC_WM9712) += snd-soc-wm9712.o
189obj-$(CONFIG_SND_SOC_WM9713) += snd-soc-wm9713.o 198obj-$(CONFIG_SND_SOC_WM9713) += snd-soc-wm9713.o
190obj-$(CONFIG_SND_SOC_WM_HUBS) += snd-soc-wm-hubs.o 199obj-$(CONFIG_SND_SOC_WM_HUBS) += snd-soc-wm-hubs.o
191 200
192# Amp 201# Amp
193obj-$(CONFIG_SND_SOC_LM4857) += snd-soc-lm4857.o
194obj-$(CONFIG_SND_SOC_MAX9877) += snd-soc-max9877.o 202obj-$(CONFIG_SND_SOC_MAX9877) += snd-soc-max9877.o
195obj-$(CONFIG_SND_SOC_TPA6130A2) += snd-soc-tpa6130a2.o 203obj-$(CONFIG_SND_SOC_TPA6130A2) += snd-soc-tpa6130a2.o
196obj-$(CONFIG_SND_SOC_WM2000) += snd-soc-wm2000.o
197obj-$(CONFIG_SND_SOC_WM9090) += snd-soc-wm9090.o
diff --git a/sound/soc/codecs/ac97.c b/sound/soc/codecs/ac97.c
index e715186b430..1bbad4c16d2 100644
--- a/sound/soc/codecs/ac97.c
+++ b/sound/soc/codecs/ac97.c
@@ -39,7 +39,7 @@ static int ac97_prepare(struct snd_pcm_substream *substream,
39 SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_44100 |\ 39 SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_44100 |\
40 SNDRV_PCM_RATE_48000) 40 SNDRV_PCM_RATE_48000)
41 41
42static struct snd_soc_dai_ops ac97_dai_ops = { 42static const struct snd_soc_dai_ops ac97_dai_ops = {
43 .prepare = ac97_prepare, 43 .prepare = ac97_prepare,
44}; 44};
45 45
@@ -99,7 +99,7 @@ static int ac97_soc_remove(struct snd_soc_codec *codec)
99} 99}
100 100
101#ifdef CONFIG_PM 101#ifdef CONFIG_PM
102static int ac97_soc_suspend(struct snd_soc_codec *codec, pm_message_t msg) 102static int ac97_soc_suspend(struct snd_soc_codec *codec)
103{ 103{
104 snd_ac97_suspend(codec->ac97); 104 snd_ac97_suspend(codec->ac97);
105 105
@@ -148,17 +148,7 @@ static struct platform_driver ac97_codec_driver = {
148 .remove = __devexit_p(ac97_remove), 148 .remove = __devexit_p(ac97_remove),
149}; 149};
150 150
151static int __init ac97_init(void) 151module_platform_driver(ac97_codec_driver);
152{
153 return platform_driver_register(&ac97_codec_driver);
154}
155module_init(ac97_init);
156
157static void __exit ac97_exit(void)
158{
159 platform_driver_unregister(&ac97_codec_driver);
160}
161module_exit(ac97_exit);
162 152
163MODULE_DESCRIPTION("Soc Generic AC97 driver"); 153MODULE_DESCRIPTION("Soc Generic AC97 driver");
164MODULE_AUTHOR("Liam Girdwood"); 154MODULE_AUTHOR("Liam Girdwood");
diff --git a/sound/soc/codecs/ad1836.c b/sound/soc/codecs/ad1836.c
index 4e5c5726366..982d201c2e8 100644
--- a/sound/soc/codecs/ad1836.c
+++ b/sound/soc/codecs/ad1836.c
@@ -189,7 +189,7 @@ static int ad1836_hw_params(struct snd_pcm_substream *substream,
189 return 0; 189 return 0;
190} 190}
191 191
192static struct snd_soc_dai_ops ad1836_dai_ops = { 192static const struct snd_soc_dai_ops ad1836_dai_ops = {
193 .hw_params = ad1836_hw_params, 193 .hw_params = ad1836_hw_params,
194 .set_fmt = ad1836_set_dai_fmt, 194 .set_fmt = ad1836_set_dai_fmt,
195}; 195};
@@ -223,7 +223,7 @@ static struct snd_soc_dai_driver ad183x_dais[] = {
223}; 223};
224 224
225#ifdef CONFIG_PM 225#ifdef CONFIG_PM
226static int ad1836_suspend(struct snd_soc_codec *codec, pm_message_t state) 226static int ad1836_suspend(struct snd_soc_codec *codec)
227{ 227{
228 /* reset clock control mode */ 228 /* reset clock control mode */
229 return snd_soc_update_bits(codec, AD1836_ADC_CTRL2, 229 return snd_soc_update_bits(codec, AD1836_ADC_CTRL2,
@@ -341,7 +341,8 @@ static int __devinit ad1836_spi_probe(struct spi_device *spi)
341 struct ad1836_priv *ad1836; 341 struct ad1836_priv *ad1836;
342 int ret; 342 int ret;
343 343
344 ad1836 = kzalloc(sizeof(struct ad1836_priv), GFP_KERNEL); 344 ad1836 = devm_kzalloc(&spi->dev, sizeof(struct ad1836_priv),
345 GFP_KERNEL);
345 if (ad1836 == NULL) 346 if (ad1836 == NULL)
346 return -ENOMEM; 347 return -ENOMEM;
347 348
@@ -351,17 +352,15 @@ static int __devinit ad1836_spi_probe(struct spi_device *spi)
351 352
352 ret = snd_soc_register_codec(&spi->dev, 353 ret = snd_soc_register_codec(&spi->dev,
353 &soc_codec_dev_ad1836, &ad183x_dais[ad1836->type], 1); 354 &soc_codec_dev_ad1836, &ad183x_dais[ad1836->type], 1);
354 if (ret < 0)
355 kfree(ad1836);
356 return ret; 355 return ret;
357} 356}
358 357
359static int __devexit ad1836_spi_remove(struct spi_device *spi) 358static int __devexit ad1836_spi_remove(struct spi_device *spi)
360{ 359{
361 snd_soc_unregister_codec(&spi->dev); 360 snd_soc_unregister_codec(&spi->dev);
362 kfree(spi_get_drvdata(spi));
363 return 0; 361 return 0;
364} 362}
363
365static const struct spi_device_id ad1836_ids[] = { 364static const struct spi_device_id ad1836_ids[] = {
366 { "ad1835", AD1835 }, 365 { "ad1835", AD1835 },
367 { "ad1836", AD1836 }, 366 { "ad1836", AD1836 },
diff --git a/sound/soc/codecs/ad193x.c b/sound/soc/codecs/ad193x.c
index 120602130b5..a4a6bef2c0b 100644
--- a/sound/soc/codecs/ad193x.c
+++ b/sound/soc/codecs/ad193x.c
@@ -30,21 +30,23 @@ struct ad193x_priv {
30/* 30/*
31 * AD193X volume/mute/de-emphasis etc. controls 31 * AD193X volume/mute/de-emphasis etc. controls
32 */ 32 */
33static const char *ad193x_deemp[] = {"None", "48kHz", "44.1kHz", "32kHz"}; 33static const char * const ad193x_deemp[] = {"None", "48kHz", "44.1kHz", "32kHz"};
34 34
35static const struct soc_enum ad193x_deemp_enum = 35static const struct soc_enum ad193x_deemp_enum =
36 SOC_ENUM_SINGLE(AD193X_DAC_CTRL2, 1, 4, ad193x_deemp); 36 SOC_ENUM_SINGLE(AD193X_DAC_CTRL2, 1, 4, ad193x_deemp);
37 37
38static const DECLARE_TLV_DB_MINMAX(adau193x_tlv, -9563, 0);
39
38static const struct snd_kcontrol_new ad193x_snd_controls[] = { 40static const struct snd_kcontrol_new ad193x_snd_controls[] = {
39 /* DAC volume control */ 41 /* DAC volume control */
40 SOC_DOUBLE_R("DAC1 Volume", AD193X_DAC_L1_VOL, 42 SOC_DOUBLE_R_TLV("DAC1 Volume", AD193X_DAC_L1_VOL,
41 AD193X_DAC_R1_VOL, 0, 0xFF, 1), 43 AD193X_DAC_R1_VOL, 0, 0xFF, 1, adau193x_tlv),
42 SOC_DOUBLE_R("DAC2 Volume", AD193X_DAC_L2_VOL, 44 SOC_DOUBLE_R_TLV("DAC2 Volume", AD193X_DAC_L2_VOL,
43 AD193X_DAC_R2_VOL, 0, 0xFF, 1), 45 AD193X_DAC_R2_VOL, 0, 0xFF, 1, adau193x_tlv),
44 SOC_DOUBLE_R("DAC3 Volume", AD193X_DAC_L3_VOL, 46 SOC_DOUBLE_R_TLV("DAC3 Volume", AD193X_DAC_L3_VOL,
45 AD193X_DAC_R3_VOL, 0, 0xFF, 1), 47 AD193X_DAC_R3_VOL, 0, 0xFF, 1, adau193x_tlv),
46 SOC_DOUBLE_R("DAC4 Volume", AD193X_DAC_L4_VOL, 48 SOC_DOUBLE_R_TLV("DAC4 Volume", AD193X_DAC_L4_VOL,
47 AD193X_DAC_R4_VOL, 0, 0xFF, 1), 49 AD193X_DAC_R4_VOL, 0, 0xFF, 1, adau193x_tlv),
48 50
49 /* ADC switch control */ 51 /* ADC switch control */
50 SOC_DOUBLE("ADC1 Switch", AD193X_ADC_CTRL0, AD193X_ADCL1_MUTE, 52 SOC_DOUBLE("ADC1 Switch", AD193X_ADC_CTRL0, AD193X_ADCL1_MUTE,
@@ -75,6 +77,7 @@ static const struct snd_soc_dapm_widget ad193x_dapm_widgets[] = {
75 SND_SOC_DAPM_ADC("ADC", "Capture", SND_SOC_NOPM, 0, 0), 77 SND_SOC_DAPM_ADC("ADC", "Capture", SND_SOC_NOPM, 0, 0),
76 SND_SOC_DAPM_SUPPLY("PLL_PWR", AD193X_PLL_CLK_CTRL0, 0, 1, NULL, 0), 78 SND_SOC_DAPM_SUPPLY("PLL_PWR", AD193X_PLL_CLK_CTRL0, 0, 1, NULL, 0),
77 SND_SOC_DAPM_SUPPLY("ADC_PWR", AD193X_ADC_CTRL0, 0, 1, NULL, 0), 79 SND_SOC_DAPM_SUPPLY("ADC_PWR", AD193X_ADC_CTRL0, 0, 1, NULL, 0),
80 SND_SOC_DAPM_SUPPLY("SYSCLK", AD193X_PLL_CLK_CTRL0, 7, 0, NULL, 0),
78 SND_SOC_DAPM_OUTPUT("DAC1OUT"), 81 SND_SOC_DAPM_OUTPUT("DAC1OUT"),
79 SND_SOC_DAPM_OUTPUT("DAC2OUT"), 82 SND_SOC_DAPM_OUTPUT("DAC2OUT"),
80 SND_SOC_DAPM_OUTPUT("DAC3OUT"), 83 SND_SOC_DAPM_OUTPUT("DAC3OUT"),
@@ -84,16 +87,17 @@ static const struct snd_soc_dapm_widget ad193x_dapm_widgets[] = {
84}; 87};
85 88
86static const struct snd_soc_dapm_route audio_paths[] = { 89static const struct snd_soc_dapm_route audio_paths[] = {
87 { "DAC", NULL, "PLL_PWR" }, 90 { "DAC", NULL, "SYSCLK" },
88 { "ADC", NULL, "PLL_PWR" }, 91 { "ADC", NULL, "SYSCLK" },
89 { "DAC", NULL, "ADC_PWR" }, 92 { "DAC", NULL, "ADC_PWR" },
90 { "ADC", NULL, "ADC_PWR" }, 93 { "ADC", NULL, "ADC_PWR" },
91 { "DAC1OUT", "DAC1 Switch", "DAC" }, 94 { "DAC1OUT", NULL, "DAC" },
92 { "DAC2OUT", "DAC2 Switch", "DAC" }, 95 { "DAC2OUT", NULL, "DAC" },
93 { "DAC3OUT", "DAC3 Switch", "DAC" }, 96 { "DAC3OUT", NULL, "DAC" },
94 { "DAC4OUT", "DAC4 Switch", "DAC" }, 97 { "DAC4OUT", NULL, "DAC" },
95 { "ADC", "ADC1 Switch", "ADC1IN" }, 98 { "ADC", NULL, "ADC1IN" },
96 { "ADC", "ADC2 Switch", "ADC2IN" }, 99 { "ADC", NULL, "ADC2IN" },
100 { "SYSCLK", NULL, "PLL_PWR" },
97}; 101};
98 102
99/* 103/*
@@ -102,14 +106,14 @@ static const struct snd_soc_dapm_route audio_paths[] = {
102 106
103static int ad193x_mute(struct snd_soc_dai *dai, int mute) 107static int ad193x_mute(struct snd_soc_dai *dai, int mute)
104{ 108{
105 struct snd_soc_codec *codec = dai->codec; 109 struct ad193x_priv *ad193x = snd_soc_codec_get_drvdata(dai->codec);
106 110
107 if (mute) 111 if (mute)
108 snd_soc_update_bits(codec, AD193X_DAC_CTRL2, 112 regmap_update_bits(ad193x->regmap, AD193X_DAC_CTRL2,
109 AD193X_DAC_MASTER_MUTE, 113 AD193X_DAC_MASTER_MUTE,
110 AD193X_DAC_MASTER_MUTE); 114 AD193X_DAC_MASTER_MUTE);
111 else 115 else
112 snd_soc_update_bits(codec, AD193X_DAC_CTRL2, 116 regmap_update_bits(ad193x->regmap, AD193X_DAC_CTRL2,
113 AD193X_DAC_MASTER_MUTE, 0); 117 AD193X_DAC_MASTER_MUTE, 0);
114 118
115 return 0; 119 return 0;
@@ -118,36 +122,30 @@ static int ad193x_mute(struct snd_soc_dai *dai, int mute)
118static int ad193x_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask, 122static int ad193x_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
119 unsigned int rx_mask, int slots, int width) 123 unsigned int rx_mask, int slots, int width)
120{ 124{
121 struct snd_soc_codec *codec = dai->codec; 125 struct ad193x_priv *ad193x = snd_soc_codec_get_drvdata(dai->codec);
122 int dac_reg = snd_soc_read(codec, AD193X_DAC_CTRL1); 126 unsigned int channels;
123 int adc_reg = snd_soc_read(codec, AD193X_ADC_CTRL2);
124
125 dac_reg &= ~AD193X_DAC_CHAN_MASK;
126 adc_reg &= ~AD193X_ADC_CHAN_MASK;
127 127
128 switch (slots) { 128 switch (slots) {
129 case 2: 129 case 2:
130 dac_reg |= AD193X_DAC_2_CHANNELS << AD193X_DAC_CHAN_SHFT; 130 channels = AD193X_2_CHANNELS;
131 adc_reg |= AD193X_ADC_2_CHANNELS << AD193X_ADC_CHAN_SHFT;
132 break; 131 break;
133 case 4: 132 case 4:
134 dac_reg |= AD193X_DAC_4_CHANNELS << AD193X_DAC_CHAN_SHFT; 133 channels = AD193X_4_CHANNELS;
135 adc_reg |= AD193X_ADC_4_CHANNELS << AD193X_ADC_CHAN_SHFT;
136 break; 134 break;
137 case 8: 135 case 8:
138 dac_reg |= AD193X_DAC_8_CHANNELS << AD193X_DAC_CHAN_SHFT; 136 channels = AD193X_8_CHANNELS;
139 adc_reg |= AD193X_ADC_8_CHANNELS << AD193X_ADC_CHAN_SHFT;
140 break; 137 break;
141 case 16: 138 case 16:
142 dac_reg |= AD193X_DAC_16_CHANNELS << AD193X_DAC_CHAN_SHFT; 139 channels = AD193X_16_CHANNELS;
143 adc_reg |= AD193X_ADC_16_CHANNELS << AD193X_ADC_CHAN_SHFT;
144 break; 140 break;
145 default: 141 default:
146 return -EINVAL; 142 return -EINVAL;
147 } 143 }
148 144
149 snd_soc_write(codec, AD193X_DAC_CTRL1, dac_reg); 145 regmap_update_bits(ad193x->regmap, AD193X_DAC_CTRL1,
150 snd_soc_write(codec, AD193X_ADC_CTRL2, adc_reg); 146 AD193X_DAC_CHAN_MASK, channels << AD193X_DAC_CHAN_SHFT);
147 regmap_update_bits(ad193x->regmap, AD193X_ADC_CTRL2,
148 AD193X_ADC_CHAN_MASK, channels << AD193X_ADC_CHAN_SHFT);
151 149
152 return 0; 150 return 0;
153} 151}
@@ -155,24 +153,20 @@ static int ad193x_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
155static int ad193x_set_dai_fmt(struct snd_soc_dai *codec_dai, 153static int ad193x_set_dai_fmt(struct snd_soc_dai *codec_dai,
156 unsigned int fmt) 154 unsigned int fmt)
157{ 155{
158 struct snd_soc_codec *codec = codec_dai->codec; 156 struct ad193x_priv *ad193x = snd_soc_codec_get_drvdata(codec_dai->codec);
159 int adc_reg1, adc_reg2, dac_reg; 157 unsigned int adc_serfmt = 0;
160 158 unsigned int adc_fmt = 0;
161 adc_reg1 = snd_soc_read(codec, AD193X_ADC_CTRL1); 159 unsigned int dac_fmt = 0;
162 adc_reg2 = snd_soc_read(codec, AD193X_ADC_CTRL2);
163 dac_reg = snd_soc_read(codec, AD193X_DAC_CTRL1);
164 160
165 /* At present, the driver only support AUX ADC mode(SND_SOC_DAIFMT_I2S 161 /* At present, the driver only support AUX ADC mode(SND_SOC_DAIFMT_I2S
166 * with TDM) and ADC&DAC TDM mode(SND_SOC_DAIFMT_DSP_A) 162 * with TDM) and ADC&DAC TDM mode(SND_SOC_DAIFMT_DSP_A)
167 */ 163 */
168 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { 164 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
169 case SND_SOC_DAIFMT_I2S: 165 case SND_SOC_DAIFMT_I2S:
170 adc_reg1 &= ~AD193X_ADC_SERFMT_MASK; 166 adc_serfmt |= AD193X_ADC_SERFMT_TDM;
171 adc_reg1 |= AD193X_ADC_SERFMT_TDM;
172 break; 167 break;
173 case SND_SOC_DAIFMT_DSP_A: 168 case SND_SOC_DAIFMT_DSP_A:
174 adc_reg1 &= ~AD193X_ADC_SERFMT_MASK; 169 adc_serfmt |= AD193X_ADC_SERFMT_AUX;
175 adc_reg1 |= AD193X_ADC_SERFMT_AUX;
176 break; 170 break;
177 default: 171 default:
178 return -EINVAL; 172 return -EINVAL;
@@ -180,29 +174,20 @@ static int ad193x_set_dai_fmt(struct snd_soc_dai *codec_dai,
180 174
181 switch (fmt & SND_SOC_DAIFMT_INV_MASK) { 175 switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
182 case SND_SOC_DAIFMT_NB_NF: /* normal bit clock + frame */ 176 case SND_SOC_DAIFMT_NB_NF: /* normal bit clock + frame */
183 adc_reg2 &= ~AD193X_ADC_LEFT_HIGH;
184 adc_reg2 &= ~AD193X_ADC_BCLK_INV;
185 dac_reg &= ~AD193X_DAC_LEFT_HIGH;
186 dac_reg &= ~AD193X_DAC_BCLK_INV;
187 break; 177 break;
188 case SND_SOC_DAIFMT_NB_IF: /* normal bclk + invert frm */ 178 case SND_SOC_DAIFMT_NB_IF: /* normal bclk + invert frm */
189 adc_reg2 |= AD193X_ADC_LEFT_HIGH; 179 adc_fmt |= AD193X_ADC_LEFT_HIGH;
190 adc_reg2 &= ~AD193X_ADC_BCLK_INV; 180 dac_fmt |= AD193X_DAC_LEFT_HIGH;
191 dac_reg |= AD193X_DAC_LEFT_HIGH;
192 dac_reg &= ~AD193X_DAC_BCLK_INV;
193 break; 181 break;
194 case SND_SOC_DAIFMT_IB_NF: /* invert bclk + normal frm */ 182 case SND_SOC_DAIFMT_IB_NF: /* invert bclk + normal frm */
195 adc_reg2 &= ~AD193X_ADC_LEFT_HIGH; 183 adc_fmt |= AD193X_ADC_BCLK_INV;
196 adc_reg2 |= AD193X_ADC_BCLK_INV; 184 dac_fmt |= AD193X_DAC_BCLK_INV;
197 dac_reg &= ~AD193X_DAC_LEFT_HIGH;
198 dac_reg |= AD193X_DAC_BCLK_INV;
199 break; 185 break;
200
201 case SND_SOC_DAIFMT_IB_IF: /* invert bclk + frm */ 186 case SND_SOC_DAIFMT_IB_IF: /* invert bclk + frm */
202 adc_reg2 |= AD193X_ADC_LEFT_HIGH; 187 adc_fmt |= AD193X_ADC_LEFT_HIGH;
203 adc_reg2 |= AD193X_ADC_BCLK_INV; 188 adc_fmt |= AD193X_ADC_BCLK_INV;
204 dac_reg |= AD193X_DAC_LEFT_HIGH; 189 dac_fmt |= AD193X_DAC_LEFT_HIGH;
205 dac_reg |= AD193X_DAC_BCLK_INV; 190 dac_fmt |= AD193X_DAC_BCLK_INV;
206 break; 191 break;
207 default: 192 default:
208 return -EINVAL; 193 return -EINVAL;
@@ -210,36 +195,31 @@ static int ad193x_set_dai_fmt(struct snd_soc_dai *codec_dai,
210 195
211 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { 196 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
212 case SND_SOC_DAIFMT_CBM_CFM: /* codec clk & frm master */ 197 case SND_SOC_DAIFMT_CBM_CFM: /* codec clk & frm master */
213 adc_reg2 |= AD193X_ADC_LCR_MASTER; 198 adc_fmt |= AD193X_ADC_LCR_MASTER;
214 adc_reg2 |= AD193X_ADC_BCLK_MASTER; 199 adc_fmt |= AD193X_ADC_BCLK_MASTER;
215 dac_reg |= AD193X_DAC_LCR_MASTER; 200 dac_fmt |= AD193X_DAC_LCR_MASTER;
216 dac_reg |= AD193X_DAC_BCLK_MASTER; 201 dac_fmt |= AD193X_DAC_BCLK_MASTER;
217 break; 202 break;
218 case SND_SOC_DAIFMT_CBS_CFM: /* codec clk slave & frm master */ 203 case SND_SOC_DAIFMT_CBS_CFM: /* codec clk slave & frm master */
219 adc_reg2 |= AD193X_ADC_LCR_MASTER; 204 adc_fmt |= AD193X_ADC_LCR_MASTER;
220 adc_reg2 &= ~AD193X_ADC_BCLK_MASTER; 205 dac_fmt |= AD193X_DAC_LCR_MASTER;
221 dac_reg |= AD193X_DAC_LCR_MASTER;
222 dac_reg &= ~AD193X_DAC_BCLK_MASTER;
223 break; 206 break;
224 case SND_SOC_DAIFMT_CBM_CFS: /* codec clk master & frame slave */ 207 case SND_SOC_DAIFMT_CBM_CFS: /* codec clk master & frame slave */
225 adc_reg2 &= ~AD193X_ADC_LCR_MASTER; 208 adc_fmt |= AD193X_ADC_BCLK_MASTER;
226 adc_reg2 |= AD193X_ADC_BCLK_MASTER; 209 dac_fmt |= AD193X_DAC_BCLK_MASTER;
227 dac_reg &= ~AD193X_DAC_LCR_MASTER;
228 dac_reg |= AD193X_DAC_BCLK_MASTER;
229 break; 210 break;
230 case SND_SOC_DAIFMT_CBS_CFS: /* codec clk & frm slave */ 211 case SND_SOC_DAIFMT_CBS_CFS: /* codec clk & frm slave */
231 adc_reg2 &= ~AD193X_ADC_LCR_MASTER;
232 adc_reg2 &= ~AD193X_ADC_BCLK_MASTER;
233 dac_reg &= ~AD193X_DAC_LCR_MASTER;
234 dac_reg &= ~AD193X_DAC_BCLK_MASTER;
235 break; 212 break;
236 default: 213 default:
237 return -EINVAL; 214 return -EINVAL;
238 } 215 }
239 216
240 snd_soc_write(codec, AD193X_ADC_CTRL1, adc_reg1); 217 regmap_update_bits(ad193x->regmap, AD193X_ADC_CTRL1,
241 snd_soc_write(codec, AD193X_ADC_CTRL2, adc_reg2); 218 AD193X_ADC_SERFMT_MASK, adc_serfmt);
242 snd_soc_write(codec, AD193X_DAC_CTRL1, dac_reg); 219 regmap_update_bits(ad193x->regmap, AD193X_ADC_CTRL2,
220 AD193X_ADC_FMT_MASK, adc_fmt);
221 regmap_update_bits(ad193x->regmap, AD193X_DAC_CTRL1,
222 AD193X_DAC_FMT_MASK, dac_fmt);
243 223
244 return 0; 224 return 0;
245} 225}
@@ -299,20 +279,20 @@ static int ad193x_hw_params(struct snd_pcm_substream *substream,
299 break; 279 break;
300 } 280 }
301 281
302 snd_soc_update_bits(codec, AD193X_PLL_CLK_CTRL0, 282 regmap_update_bits(ad193x->regmap, AD193X_PLL_CLK_CTRL0,
303 AD193X_PLL_INPUT_MASK, master_rate); 283 AD193X_PLL_INPUT_MASK, master_rate);
304 284
305 snd_soc_update_bits(codec, AD193X_DAC_CTRL2, 285 regmap_update_bits(ad193x->regmap, AD193X_DAC_CTRL2,
306 AD193X_DAC_WORD_LEN_MASK, 286 AD193X_DAC_WORD_LEN_MASK,
307 word_len << AD193X_DAC_WORD_LEN_SHFT); 287 word_len << AD193X_DAC_WORD_LEN_SHFT);
308 288
309 snd_soc_update_bits(codec, AD193X_ADC_CTRL1, 289 regmap_update_bits(ad193x->regmap, AD193X_ADC_CTRL1,
310 AD193X_ADC_WORD_LEN_MASK, word_len); 290 AD193X_ADC_WORD_LEN_MASK, word_len);
311 291
312 return 0; 292 return 0;
313} 293}
314 294
315static struct snd_soc_dai_ops ad193x_dai_ops = { 295static const struct snd_soc_dai_ops ad193x_dai_ops = {
316 .hw_params = ad193x_hw_params, 296 .hw_params = ad193x_hw_params,
317 .digital_mute = ad193x_mute, 297 .digital_mute = ad193x_mute,
318 .set_tdm_slot = ad193x_set_tdm_slot, 298 .set_tdm_slot = ad193x_set_tdm_slot,
@@ -345,7 +325,6 @@ static struct snd_soc_dai_driver ad193x_dai = {
345static int ad193x_probe(struct snd_soc_codec *codec) 325static int ad193x_probe(struct snd_soc_codec *codec)
346{ 326{
347 struct ad193x_priv *ad193x = snd_soc_codec_get_drvdata(codec); 327 struct ad193x_priv *ad193x = snd_soc_codec_get_drvdata(codec);
348 struct snd_soc_dapm_context *dapm = &codec->dapm;
349 int ret; 328 int ret;
350 329
351 codec->control_data = ad193x->regmap; 330 codec->control_data = ad193x->regmap;
@@ -358,32 +337,37 @@ static int ad193x_probe(struct snd_soc_codec *codec)
358 /* default setting for ad193x */ 337 /* default setting for ad193x */
359 338
360 /* unmute dac channels */ 339 /* unmute dac channels */
361 snd_soc_write(codec, AD193X_DAC_CHNL_MUTE, 0x0); 340 regmap_write(ad193x->regmap, AD193X_DAC_CHNL_MUTE, 0x0);
362 /* de-emphasis: 48kHz, powedown dac */ 341 /* de-emphasis: 48kHz, powedown dac */
363 snd_soc_write(codec, AD193X_DAC_CTRL2, 0x1A); 342 regmap_write(ad193x->regmap, AD193X_DAC_CTRL2, 0x1A);
364 /* powerdown dac, dac in tdm mode */ 343 /* powerdown dac, dac in tdm mode */
365 snd_soc_write(codec, AD193X_DAC_CTRL0, 0x41); 344 regmap_write(ad193x->regmap, AD193X_DAC_CTRL0, 0x41);
366 /* high-pass filter enable */ 345 /* high-pass filter enable */
367 snd_soc_write(codec, AD193X_ADC_CTRL0, 0x3); 346 regmap_write(ad193x->regmap, AD193X_ADC_CTRL0, 0x3);
368 /* sata delay=1, adc aux mode */ 347 /* sata delay=1, adc aux mode */
369 snd_soc_write(codec, AD193X_ADC_CTRL1, 0x43); 348 regmap_write(ad193x->regmap, AD193X_ADC_CTRL1, 0x43);
370 /* pll input: mclki/xi */ 349 /* pll input: mclki/xi */
371 snd_soc_write(codec, AD193X_PLL_CLK_CTRL0, 0x99); /* mclk=24.576Mhz: 0x9D; mclk=12.288Mhz: 0x99 */ 350 regmap_write(ad193x->regmap, AD193X_PLL_CLK_CTRL0, 0x99); /* mclk=24.576Mhz: 0x9D; mclk=12.288Mhz: 0x99 */
372 snd_soc_write(codec, AD193X_PLL_CLK_CTRL1, 0x04); 351 regmap_write(ad193x->regmap, AD193X_PLL_CLK_CTRL1, 0x04);
373
374 snd_soc_add_controls(codec, ad193x_snd_controls,
375 ARRAY_SIZE(ad193x_snd_controls));
376 snd_soc_dapm_new_controls(dapm, ad193x_dapm_widgets,
377 ARRAY_SIZE(ad193x_dapm_widgets));
378 snd_soc_dapm_add_routes(dapm, audio_paths, ARRAY_SIZE(audio_paths));
379 352
380 return ret; 353 return ret;
381} 354}
382 355
383static struct snd_soc_codec_driver soc_codec_dev_ad193x = { 356static struct snd_soc_codec_driver soc_codec_dev_ad193x = {
384 .probe = ad193x_probe, 357 .probe = ad193x_probe,
358 .controls = ad193x_snd_controls,
359 .num_controls = ARRAY_SIZE(ad193x_snd_controls),
360 .dapm_widgets = ad193x_dapm_widgets,
361 .num_dapm_widgets = ARRAY_SIZE(ad193x_dapm_widgets),
362 .dapm_routes = audio_paths,
363 .num_dapm_routes = ARRAY_SIZE(audio_paths),
385}; 364};
386 365
366static bool adau193x_reg_volatile(struct device *dev, unsigned int reg)
367{
368 return false;
369}
370
387#if defined(CONFIG_SPI_MASTER) 371#if defined(CONFIG_SPI_MASTER)
388 372
389static const struct regmap_config ad193x_spi_regmap_config = { 373static const struct regmap_config ad193x_spi_regmap_config = {
@@ -391,6 +375,9 @@ static const struct regmap_config ad193x_spi_regmap_config = {
391 .reg_bits = 16, 375 .reg_bits = 16,
392 .read_flag_mask = 0x09, 376 .read_flag_mask = 0x09,
393 .write_flag_mask = 0x08, 377 .write_flag_mask = 0x08,
378
379 .max_register = AD193X_NUM_REGS - 1,
380 .volatile_reg = adau193x_reg_volatile,
394}; 381};
395 382
396static int __devinit ad193x_spi_probe(struct spi_device *spi) 383static int __devinit ad193x_spi_probe(struct spi_device *spi)
@@ -398,14 +385,15 @@ static int __devinit ad193x_spi_probe(struct spi_device *spi)
398 struct ad193x_priv *ad193x; 385 struct ad193x_priv *ad193x;
399 int ret; 386 int ret;
400 387
401 ad193x = kzalloc(sizeof(struct ad193x_priv), GFP_KERNEL); 388 ad193x = devm_kzalloc(&spi->dev, sizeof(struct ad193x_priv),
389 GFP_KERNEL);
402 if (ad193x == NULL) 390 if (ad193x == NULL)
403 return -ENOMEM; 391 return -ENOMEM;
404 392
405 ad193x->regmap = regmap_init_spi(spi, &ad193x_spi_regmap_config); 393 ad193x->regmap = regmap_init_spi(spi, &ad193x_spi_regmap_config);
406 if (IS_ERR(ad193x->regmap)) { 394 if (IS_ERR(ad193x->regmap)) {
407 ret = PTR_ERR(ad193x->regmap); 395 ret = PTR_ERR(ad193x->regmap);
408 goto err_free; 396 goto err_out;
409 } 397 }
410 398
411 spi_set_drvdata(spi, ad193x); 399 spi_set_drvdata(spi, ad193x);
@@ -419,9 +407,7 @@ static int __devinit ad193x_spi_probe(struct spi_device *spi)
419 407
420err_regmap_exit: 408err_regmap_exit:
421 regmap_exit(ad193x->regmap); 409 regmap_exit(ad193x->regmap);
422err_free: 410err_out:
423 kfree(ad193x);
424
425 return ret; 411 return ret;
426} 412}
427 413
@@ -431,7 +417,6 @@ static int __devexit ad193x_spi_remove(struct spi_device *spi)
431 417
432 snd_soc_unregister_codec(&spi->dev); 418 snd_soc_unregister_codec(&spi->dev);
433 regmap_exit(ad193x->regmap); 419 regmap_exit(ad193x->regmap);
434 kfree(ad193x);
435 return 0; 420 return 0;
436} 421}
437 422
@@ -450,6 +435,9 @@ static struct spi_driver ad193x_spi_driver = {
450static const struct regmap_config ad193x_i2c_regmap_config = { 435static const struct regmap_config ad193x_i2c_regmap_config = {
451 .val_bits = 8, 436 .val_bits = 8,
452 .reg_bits = 8, 437 .reg_bits = 8,
438
439 .max_register = AD193X_NUM_REGS - 1,
440 .volatile_reg = adau193x_reg_volatile,
453}; 441};
454 442
455static const struct i2c_device_id ad193x_id[] = { 443static const struct i2c_device_id ad193x_id[] = {
@@ -465,14 +453,15 @@ static int __devinit ad193x_i2c_probe(struct i2c_client *client,
465 struct ad193x_priv *ad193x; 453 struct ad193x_priv *ad193x;
466 int ret; 454 int ret;
467 455
468 ad193x = kzalloc(sizeof(struct ad193x_priv), GFP_KERNEL); 456 ad193x = devm_kzalloc(&client->dev, sizeof(struct ad193x_priv),
457 GFP_KERNEL);
469 if (ad193x == NULL) 458 if (ad193x == NULL)
470 return -ENOMEM; 459 return -ENOMEM;
471 460
472 ad193x->regmap = regmap_init_i2c(client, &ad193x_i2c_regmap_config); 461 ad193x->regmap = regmap_init_i2c(client, &ad193x_i2c_regmap_config);
473 if (IS_ERR(ad193x->regmap)) { 462 if (IS_ERR(ad193x->regmap)) {
474 ret = PTR_ERR(ad193x->regmap); 463 ret = PTR_ERR(ad193x->regmap);
475 goto err_free; 464 goto err_out;
476 } 465 }
477 466
478 i2c_set_clientdata(client, ad193x); 467 i2c_set_clientdata(client, ad193x);
@@ -486,8 +475,7 @@ static int __devinit ad193x_i2c_probe(struct i2c_client *client,
486 475
487err_regmap_exit: 476err_regmap_exit:
488 regmap_exit(ad193x->regmap); 477 regmap_exit(ad193x->regmap);
489err_free: 478err_out:
490 kfree(ad193x);
491 return ret; 479 return ret;
492} 480}
493 481
@@ -497,7 +485,6 @@ static int __devexit ad193x_i2c_remove(struct i2c_client *client)
497 485
498 snd_soc_unregister_codec(&client->dev); 486 snd_soc_unregister_codec(&client->dev);
499 regmap_exit(ad193x->regmap); 487 regmap_exit(ad193x->regmap);
500 kfree(ad193x);
501 return 0; 488 return 0;
502} 489}
503 490
diff --git a/sound/soc/codecs/ad193x.h b/sound/soc/codecs/ad193x.h
index 1507eaa425a..47338804999 100644
--- a/sound/soc/codecs/ad193x.h
+++ b/sound/soc/codecs/ad193x.h
@@ -23,16 +23,14 @@
23#define AD193X_DAC_SERFMT_STEREO (0 << 6) 23#define AD193X_DAC_SERFMT_STEREO (0 << 6)
24#define AD193X_DAC_SERFMT_TDM (1 << 6) 24#define AD193X_DAC_SERFMT_TDM (1 << 6)
25#define AD193X_DAC_CTRL1 0x03 25#define AD193X_DAC_CTRL1 0x03
26#define AD193X_DAC_2_CHANNELS 0
27#define AD193X_DAC_4_CHANNELS 1
28#define AD193X_DAC_8_CHANNELS 2
29#define AD193X_DAC_16_CHANNELS 3
30#define AD193X_DAC_CHAN_SHFT 1 26#define AD193X_DAC_CHAN_SHFT 1
31#define AD193X_DAC_CHAN_MASK (3 << AD193X_DAC_CHAN_SHFT) 27#define AD193X_DAC_CHAN_MASK (3 << AD193X_DAC_CHAN_SHFT)
32#define AD193X_DAC_LCR_MASTER (1 << 4) 28#define AD193X_DAC_LCR_MASTER (1 << 4)
33#define AD193X_DAC_BCLK_MASTER (1 << 5) 29#define AD193X_DAC_BCLK_MASTER (1 << 5)
34#define AD193X_DAC_LEFT_HIGH (1 << 3) 30#define AD193X_DAC_LEFT_HIGH (1 << 3)
35#define AD193X_DAC_BCLK_INV (1 << 7) 31#define AD193X_DAC_BCLK_INV (1 << 7)
32#define AD193X_DAC_FMT_MASK (AD193X_DAC_LCR_MASTER | \
33 AD193X_DAC_BCLK_MASTER | AD193X_DAC_LEFT_HIGH | AD193X_DAC_BCLK_INV)
36#define AD193X_DAC_CTRL2 0x04 34#define AD193X_DAC_CTRL2 0x04
37#define AD193X_DAC_WORD_LEN_SHFT 3 35#define AD193X_DAC_WORD_LEN_SHFT 3
38#define AD193X_DAC_WORD_LEN_MASK 0x18 36#define AD193X_DAC_WORD_LEN_MASK 0x18
@@ -68,16 +66,19 @@
68#define AD193X_ADC_SERFMT_AUX (2 << 5) 66#define AD193X_ADC_SERFMT_AUX (2 << 5)
69#define AD193X_ADC_WORD_LEN_MASK 0x3 67#define AD193X_ADC_WORD_LEN_MASK 0x3
70#define AD193X_ADC_CTRL2 0x10 68#define AD193X_ADC_CTRL2 0x10
71#define AD193X_ADC_2_CHANNELS 0
72#define AD193X_ADC_4_CHANNELS 1
73#define AD193X_ADC_8_CHANNELS 2
74#define AD193X_ADC_16_CHANNELS 3
75#define AD193X_ADC_CHAN_SHFT 4 69#define AD193X_ADC_CHAN_SHFT 4
76#define AD193X_ADC_CHAN_MASK (3 << AD193X_ADC_CHAN_SHFT) 70#define AD193X_ADC_CHAN_MASK (3 << AD193X_ADC_CHAN_SHFT)
77#define AD193X_ADC_LCR_MASTER (1 << 3) 71#define AD193X_ADC_LCR_MASTER (1 << 3)
78#define AD193X_ADC_BCLK_MASTER (1 << 6) 72#define AD193X_ADC_BCLK_MASTER (1 << 6)
79#define AD193X_ADC_LEFT_HIGH (1 << 2) 73#define AD193X_ADC_LEFT_HIGH (1 << 2)
80#define AD193X_ADC_BCLK_INV (1 << 1) 74#define AD193X_ADC_BCLK_INV (1 << 1)
75#define AD193X_ADC_FMT_MASK (AD193X_ADC_LCR_MASTER | \
76 AD193X_ADC_BCLK_MASTER | AD193X_ADC_LEFT_HIGH | AD193X_ADC_BCLK_INV)
77
78#define AD193X_2_CHANNELS 0
79#define AD193X_4_CHANNELS 1
80#define AD193X_8_CHANNELS 2
81#define AD193X_16_CHANNELS 3
81 82
82#define AD193X_NUM_REGS 17 83#define AD193X_NUM_REGS 17
83 84
diff --git a/sound/soc/codecs/ad1980.c b/sound/soc/codecs/ad1980.c
index e3931cc5e66..9bba7f84946 100644
--- a/sound/soc/codecs/ad1980.c
+++ b/sound/soc/codecs/ad1980.c
@@ -277,17 +277,7 @@ static struct platform_driver ad1980_codec_driver = {
277 .remove = __devexit_p(ad1980_remove), 277 .remove = __devexit_p(ad1980_remove),
278}; 278};
279 279
280static int __init ad1980_init(void) 280module_platform_driver(ad1980_codec_driver);
281{
282 return platform_driver_register(&ad1980_codec_driver);
283}
284module_init(ad1980_init);
285
286static void __exit ad1980_exit(void)
287{
288 platform_driver_unregister(&ad1980_codec_driver);
289}
290module_exit(ad1980_exit);
291 281
292MODULE_DESCRIPTION("ASoC ad1980 driver (Obsolete)"); 282MODULE_DESCRIPTION("ASoC ad1980 driver (Obsolete)");
293MODULE_AUTHOR("Roy Huang, Cliff Cai"); 283MODULE_AUTHOR("Roy Huang, Cliff Cai");
diff --git a/sound/soc/codecs/ad73311.c b/sound/soc/codecs/ad73311.c
index 8d793e993e9..ee7a68dcefd 100644
--- a/sound/soc/codecs/ad73311.c
+++ b/sound/soc/codecs/ad73311.c
@@ -63,17 +63,7 @@ static struct platform_driver ad73311_codec_driver = {
63 .remove = __devexit_p(ad73311_remove), 63 .remove = __devexit_p(ad73311_remove),
64}; 64};
65 65
66static int __init ad73311_init(void) 66module_platform_driver(ad73311_codec_driver);
67{
68 return platform_driver_register(&ad73311_codec_driver);
69}
70module_init(ad73311_init);
71
72static void __exit ad73311_exit(void)
73{
74 platform_driver_unregister(&ad73311_codec_driver);
75}
76module_exit(ad73311_exit);
77 67
78MODULE_DESCRIPTION("ASoC ad73311 driver"); 68MODULE_DESCRIPTION("ASoC ad73311 driver");
79MODULE_AUTHOR("Cliff Cai "); 69MODULE_AUTHOR("Cliff Cai ");
diff --git a/sound/soc/codecs/adau1373.c b/sound/soc/codecs/adau1373.c
index 45c63028b40..971ba452917 100644
--- a/sound/soc/codecs/adau1373.c
+++ b/sound/soc/codecs/adau1373.c
@@ -1321,7 +1321,7 @@ static int adau1373_remove(struct snd_soc_codec *codec)
1321 return 0; 1321 return 0;
1322} 1322}
1323 1323
1324static int adau1373_suspend(struct snd_soc_codec *codec, pm_message_t state) 1324static int adau1373_suspend(struct snd_soc_codec *codec)
1325{ 1325{
1326 return adau1373_set_bias_level(codec, SND_SOC_BIAS_OFF); 1326 return adau1373_set_bias_level(codec, SND_SOC_BIAS_OFF);
1327} 1327}
@@ -1360,7 +1360,7 @@ static int __devinit adau1373_i2c_probe(struct i2c_client *client,
1360 struct adau1373 *adau1373; 1360 struct adau1373 *adau1373;
1361 int ret; 1361 int ret;
1362 1362
1363 adau1373 = kzalloc(sizeof(*adau1373), GFP_KERNEL); 1363 adau1373 = devm_kzalloc(&client->dev, sizeof(*adau1373), GFP_KERNEL);
1364 if (!adau1373) 1364 if (!adau1373)
1365 return -ENOMEM; 1365 return -ENOMEM;
1366 1366
@@ -1368,16 +1368,12 @@ static int __devinit adau1373_i2c_probe(struct i2c_client *client,
1368 1368
1369 ret = snd_soc_register_codec(&client->dev, &adau1373_codec_driver, 1369 ret = snd_soc_register_codec(&client->dev, &adau1373_codec_driver,
1370 adau1373_dai_driver, ARRAY_SIZE(adau1373_dai_driver)); 1370 adau1373_dai_driver, ARRAY_SIZE(adau1373_dai_driver));
1371 if (ret < 0)
1372 kfree(adau1373);
1373
1374 return ret; 1371 return ret;
1375} 1372}
1376 1373
1377static int __devexit adau1373_i2c_remove(struct i2c_client *client) 1374static int __devexit adau1373_i2c_remove(struct i2c_client *client)
1378{ 1375{
1379 snd_soc_unregister_codec(&client->dev); 1376 snd_soc_unregister_codec(&client->dev);
1380 kfree(dev_get_drvdata(&client->dev));
1381 return 0; 1377 return 0;
1382} 1378}
1383 1379
diff --git a/sound/soc/codecs/adau1701.c b/sound/soc/codecs/adau1701.c
index 8b7e1c50d6e..6b325ea0386 100644
--- a/sound/soc/codecs/adau1701.c
+++ b/sound/soc/codecs/adau1701.c
@@ -12,13 +12,13 @@
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/i2c.h> 13#include <linux/i2c.h>
14#include <linux/delay.h> 14#include <linux/delay.h>
15#include <linux/sigma.h>
16#include <linux/slab.h> 15#include <linux/slab.h>
17#include <sound/core.h> 16#include <sound/core.h>
18#include <sound/pcm.h> 17#include <sound/pcm.h>
19#include <sound/pcm_params.h> 18#include <sound/pcm_params.h>
20#include <sound/soc.h> 19#include <sound/soc.h>
21 20
21#include "sigmadsp.h"
22#include "adau1701.h" 22#include "adau1701.h"
23 23
24#define ADAU1701_DSPCTRL 0x1c 24#define ADAU1701_DSPCTRL 0x1c
@@ -496,23 +496,19 @@ static __devinit int adau1701_i2c_probe(struct i2c_client *client,
496 struct adau1701 *adau1701; 496 struct adau1701 *adau1701;
497 int ret; 497 int ret;
498 498
499 adau1701 = kzalloc(sizeof(*adau1701), GFP_KERNEL); 499 adau1701 = devm_kzalloc(&client->dev, sizeof(*adau1701), GFP_KERNEL);
500 if (!adau1701) 500 if (!adau1701)
501 return -ENOMEM; 501 return -ENOMEM;
502 502
503 i2c_set_clientdata(client, adau1701); 503 i2c_set_clientdata(client, adau1701);
504 ret = snd_soc_register_codec(&client->dev, &adau1701_codec_drv, 504 ret = snd_soc_register_codec(&client->dev, &adau1701_codec_drv,
505 &adau1701_dai, 1); 505 &adau1701_dai, 1);
506 if (ret < 0)
507 kfree(adau1701);
508
509 return ret; 506 return ret;
510} 507}
511 508
512static __devexit int adau1701_i2c_remove(struct i2c_client *client) 509static __devexit int adau1701_i2c_remove(struct i2c_client *client)
513{ 510{
514 snd_soc_unregister_codec(&client->dev); 511 snd_soc_unregister_codec(&client->dev);
515 kfree(i2c_get_clientdata(client));
516 return 0; 512 return 0;
517} 513}
518 514
diff --git a/sound/soc/codecs/adav80x.c b/sound/soc/codecs/adav80x.c
index f9f08948e5e..ebd7b37b902 100644
--- a/sound/soc/codecs/adav80x.c
+++ b/sound/soc/codecs/adav80x.c
@@ -798,7 +798,7 @@ static int adav80x_probe(struct snd_soc_codec *codec)
798 return adav80x_set_bias_level(codec, SND_SOC_BIAS_STANDBY); 798 return adav80x_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
799} 799}
800 800
801static int adav80x_suspend(struct snd_soc_codec *codec, pm_message_t state) 801static int adav80x_suspend(struct snd_soc_codec *codec)
802{ 802{
803 return adav80x_set_bias_level(codec, SND_SOC_BIAS_OFF); 803 return adav80x_set_bias_level(codec, SND_SOC_BIAS_OFF);
804} 804}
diff --git a/sound/soc/codecs/ads117x.c b/sound/soc/codecs/ads117x.c
index 9082e0f729f..8103b938b8c 100644
--- a/sound/soc/codecs/ads117x.c
+++ b/sound/soc/codecs/ads117x.c
@@ -58,17 +58,7 @@ static struct platform_driver ads117x_codec_driver = {
58 .remove = __devexit_p(ads117x_remove), 58 .remove = __devexit_p(ads117x_remove),
59}; 59};
60 60
61static int __init ads117x_init(void) 61module_platform_driver(ads117x_codec_driver);
62{
63 return platform_driver_register(&ads117x_codec_driver);
64}
65module_init(ads117x_init);
66
67static void __exit ads117x_exit(void)
68{
69 platform_driver_unregister(&ads117x_codec_driver);
70}
71module_exit(ads117x_exit);
72 62
73MODULE_DESCRIPTION("ASoC ads117x driver"); 63MODULE_DESCRIPTION("ASoC ads117x driver");
74MODULE_AUTHOR("Graeme Gregory"); 64MODULE_AUTHOR("Graeme Gregory");
diff --git a/sound/soc/codecs/ak4104.c b/sound/soc/codecs/ak4104.c
index d3b29dce6ed..d27b5e4cce9 100644
--- a/sound/soc/codecs/ak4104.c
+++ b/sound/soc/codecs/ak4104.c
@@ -170,7 +170,7 @@ static int ak4104_hw_params(struct snd_pcm_substream *substream,
170 return ak4104_spi_write(codec, AK4104_REG_CHN_STATUS(3), val); 170 return ak4104_spi_write(codec, AK4104_REG_CHN_STATUS(3), val);
171} 171}
172 172
173static struct snd_soc_dai_ops ak4101_dai_ops = { 173static const struct snd_soc_dai_ops ak4101_dai_ops = {
174 .hw_params = ak4104_hw_params, 174 .hw_params = ak4104_hw_params,
175 .set_fmt = ak4104_set_dai_fmt, 175 .set_fmt = ak4104_set_dai_fmt,
176}; 176};
@@ -261,7 +261,8 @@ static int ak4104_spi_probe(struct spi_device *spi)
261 if (ret < 0) 261 if (ret < 0)
262 return ret; 262 return ret;
263 263
264 ak4104 = kzalloc(sizeof(struct ak4104_private), GFP_KERNEL); 264 ak4104 = devm_kzalloc(&spi->dev, sizeof(struct ak4104_private),
265 GFP_KERNEL);
265 if (ak4104 == NULL) 266 if (ak4104 == NULL)
266 return -ENOMEM; 267 return -ENOMEM;
267 268
@@ -271,15 +272,12 @@ static int ak4104_spi_probe(struct spi_device *spi)
271 272
272 ret = snd_soc_register_codec(&spi->dev, 273 ret = snd_soc_register_codec(&spi->dev,
273 &soc_codec_device_ak4104, &ak4104_dai, 1); 274 &soc_codec_device_ak4104, &ak4104_dai, 1);
274 if (ret < 0)
275 kfree(ak4104);
276 return ret; 275 return ret;
277} 276}
278 277
279static int __devexit ak4104_spi_remove(struct spi_device *spi) 278static int __devexit ak4104_spi_remove(struct spi_device *spi)
280{ 279{
281 snd_soc_unregister_codec(&spi->dev); 280 snd_soc_unregister_codec(&spi->dev);
282 kfree(spi_get_drvdata(spi));
283 return 0; 281 return 0;
284} 282}
285 283
diff --git a/sound/soc/codecs/ak4535.c b/sound/soc/codecs/ak4535.c
index 95d782d86e7..9e809e05d06 100644
--- a/sound/soc/codecs/ak4535.c
+++ b/sound/soc/codecs/ak4535.c
@@ -18,7 +18,6 @@
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/platform_device.h>
22#include <linux/slab.h> 21#include <linux/slab.h>
23#include <sound/core.h> 22#include <sound/core.h>
24#include <sound/pcm.h> 23#include <sound/pcm.h>
@@ -331,7 +330,7 @@ static int ak4535_set_bias_level(struct snd_soc_codec *codec,
331 SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_22050 |\ 330 SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_22050 |\
332 SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000) 331 SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000)
333 332
334static struct snd_soc_dai_ops ak4535_dai_ops = { 333static const struct snd_soc_dai_ops ak4535_dai_ops = {
335 .hw_params = ak4535_hw_params, 334 .hw_params = ak4535_hw_params,
336 .set_fmt = ak4535_set_dai_fmt, 335 .set_fmt = ak4535_set_dai_fmt,
337 .digital_mute = ak4535_mute, 336 .digital_mute = ak4535_mute,
@@ -355,7 +354,7 @@ static struct snd_soc_dai_driver ak4535_dai = {
355 .ops = &ak4535_dai_ops, 354 .ops = &ak4535_dai_ops,
356}; 355};
357 356
358static int ak4535_suspend(struct snd_soc_codec *codec, pm_message_t state) 357static int ak4535_suspend(struct snd_soc_codec *codec)
359{ 358{
360 ak4535_set_bias_level(codec, SND_SOC_BIAS_OFF); 359 ak4535_set_bias_level(codec, SND_SOC_BIAS_OFF);
361 return 0; 360 return 0;
@@ -417,7 +416,8 @@ static __devinit int ak4535_i2c_probe(struct i2c_client *i2c,
417 struct ak4535_priv *ak4535; 416 struct ak4535_priv *ak4535;
418 int ret; 417 int ret;
419 418
420 ak4535 = kzalloc(sizeof(struct ak4535_priv), GFP_KERNEL); 419 ak4535 = devm_kzalloc(&i2c->dev, sizeof(struct ak4535_priv),
420 GFP_KERNEL);
421 if (ak4535 == NULL) 421 if (ak4535 == NULL)
422 return -ENOMEM; 422 return -ENOMEM;
423 423
@@ -426,15 +426,12 @@ static __devinit int ak4535_i2c_probe(struct i2c_client *i2c,
426 426
427 ret = snd_soc_register_codec(&i2c->dev, 427 ret = snd_soc_register_codec(&i2c->dev,
428 &soc_codec_dev_ak4535, &ak4535_dai, 1); 428 &soc_codec_dev_ak4535, &ak4535_dai, 1);
429 if (ret < 0)
430 kfree(ak4535);
431 return ret; 429 return ret;
432} 430}
433 431
434static __devexit int ak4535_i2c_remove(struct i2c_client *client) 432static __devexit int ak4535_i2c_remove(struct i2c_client *client)
435{ 433{
436 snd_soc_unregister_codec(&client->dev); 434 snd_soc_unregister_codec(&client->dev);
437 kfree(i2c_get_clientdata(client));
438 return 0; 435 return 0;
439} 436}
440 437
diff --git a/sound/soc/codecs/ak4641.c b/sound/soc/codecs/ak4641.c
index 77838586f35..c4d165a4bdd 100644
--- a/sound/soc/codecs/ak4641.c
+++ b/sound/soc/codecs/ak4641.c
@@ -17,7 +17,6 @@
17#include <linux/gpio.h> 17#include <linux/gpio.h>
18#include <linux/pm.h> 18#include <linux/pm.h>
19#include <linux/i2c.h> 19#include <linux/i2c.h>
20#include <linux/platform_device.h>
21#include <linux/slab.h> 20#include <linux/slab.h>
22#include <sound/core.h> 21#include <sound/core.h>
23#include <sound/pcm.h> 22#include <sound/pcm.h>
@@ -340,6 +339,7 @@ static int ak4641_pcm_set_dai_fmt(struct snd_soc_dai *codec_dai,
340{ 339{
341 struct snd_soc_codec *codec = codec_dai->codec; 340 struct snd_soc_codec *codec = codec_dai->codec;
342 u8 btif; 341 u8 btif;
342 int ret;
343 343
344 /* interface format */ 344 /* interface format */
345 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) { 345 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
@@ -359,7 +359,11 @@ static int ak4641_pcm_set_dai_fmt(struct snd_soc_dai *codec_dai,
359 return -EINVAL; 359 return -EINVAL;
360 } 360 }
361 361
362 return snd_soc_update_bits(codec, AK4641_BTIF, (0x3 << 5), btif); 362 ret = snd_soc_update_bits(codec, AK4641_BTIF, (0x3 << 5), btif);
363 if (ret < 0)
364 return ret;
365
366 return 0;
363} 367}
364 368
365static int ak4641_i2s_set_dai_fmt(struct snd_soc_dai *codec_dai, 369static int ak4641_i2s_set_dai_fmt(struct snd_soc_dai *codec_dai,
@@ -442,14 +446,14 @@ static int ak4641_set_bias_level(struct snd_soc_codec *codec,
442 SNDRV_PCM_RATE_16000) 446 SNDRV_PCM_RATE_16000)
443#define AK4641_FORMATS (SNDRV_PCM_FMTBIT_S16_LE) 447#define AK4641_FORMATS (SNDRV_PCM_FMTBIT_S16_LE)
444 448
445static struct snd_soc_dai_ops ak4641_i2s_dai_ops = { 449static const struct snd_soc_dai_ops ak4641_i2s_dai_ops = {
446 .hw_params = ak4641_i2s_hw_params, 450 .hw_params = ak4641_i2s_hw_params,
447 .set_fmt = ak4641_i2s_set_dai_fmt, 451 .set_fmt = ak4641_i2s_set_dai_fmt,
448 .digital_mute = ak4641_mute, 452 .digital_mute = ak4641_mute,
449 .set_sysclk = ak4641_set_dai_sysclk, 453 .set_sysclk = ak4641_set_dai_sysclk,
450}; 454};
451 455
452static struct snd_soc_dai_ops ak4641_pcm_dai_ops = { 456static const struct snd_soc_dai_ops ak4641_pcm_dai_ops = {
453 .hw_params = NULL, /* rates are controlled by BT chip */ 457 .hw_params = NULL, /* rates are controlled by BT chip */
454 .set_fmt = ak4641_pcm_set_dai_fmt, 458 .set_fmt = ak4641_pcm_set_dai_fmt,
455 .digital_mute = ak4641_mute, 459 .digital_mute = ak4641_mute,
@@ -499,7 +503,7 @@ static struct snd_soc_dai_driver ak4641_dai[] = {
499}, 503},
500}; 504};
501 505
502static int ak4641_suspend(struct snd_soc_codec *codec, pm_message_t state) 506static int ak4641_suspend(struct snd_soc_codec *codec)
503{ 507{
504 ak4641_set_bias_level(codec, SND_SOC_BIAS_OFF); 508 ak4641_set_bias_level(codec, SND_SOC_BIAS_OFF);
505 return 0; 509 return 0;
@@ -603,7 +607,8 @@ static int __devinit ak4641_i2c_probe(struct i2c_client *i2c,
603 struct ak4641_priv *ak4641; 607 struct ak4641_priv *ak4641;
604 int ret; 608 int ret;
605 609
606 ak4641 = kzalloc(sizeof(struct ak4641_priv), GFP_KERNEL); 610 ak4641 = devm_kzalloc(&i2c->dev, sizeof(struct ak4641_priv),
611 GFP_KERNEL);
607 if (!ak4641) 612 if (!ak4641)
608 return -ENOMEM; 613 return -ENOMEM;
609 614
@@ -611,16 +616,12 @@ static int __devinit ak4641_i2c_probe(struct i2c_client *i2c,
611 616
612 ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_ak4641, 617 ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_ak4641,
613 ak4641_dai, ARRAY_SIZE(ak4641_dai)); 618 ak4641_dai, ARRAY_SIZE(ak4641_dai));
614 if (ret < 0)
615 kfree(ak4641);
616
617 return ret; 619 return ret;
618} 620}
619 621
620static int __devexit ak4641_i2c_remove(struct i2c_client *i2c) 622static int __devexit ak4641_i2c_remove(struct i2c_client *i2c)
621{ 623{
622 snd_soc_unregister_codec(&i2c->dev); 624 snd_soc_unregister_codec(&i2c->dev);
623 kfree(i2c_get_clientdata(i2c));
624 return 0; 625 return 0;
625} 626}
626 627
diff --git a/sound/soc/codecs/ak4642.c b/sound/soc/codecs/ak4642.c
index 12c1bdef673..5ef70b5d27e 100644
--- a/sound/soc/codecs/ak4642.c
+++ b/sound/soc/codecs/ak4642.c
@@ -18,21 +18,19 @@
18 * This is very simple driver. 18 * This is very simple driver.
19 * It can use headphone output / stereo input only 19 * It can use headphone output / stereo input only
20 * 20 *
21 * AK4642 is not tested. 21 * AK4642 is tested.
22 * AK4643 is tested. 22 * AK4643 is tested.
23 * AK4648 is tested.
23 */ 24 */
24 25
25#include <linux/delay.h> 26#include <linux/delay.h>
26#include <linux/i2c.h> 27#include <linux/i2c.h>
27#include <linux/platform_device.h>
28#include <linux/slab.h> 28#include <linux/slab.h>
29#include <linux/module.h> 29#include <linux/module.h>
30#include <sound/soc.h> 30#include <sound/soc.h>
31#include <sound/initval.h> 31#include <sound/initval.h>
32#include <sound/tlv.h> 32#include <sound/tlv.h>
33 33
34#define AK4642_VERSION "0.0.1"
35
36#define PW_MGMT1 0x00 34#define PW_MGMT1 0x00
37#define PW_MGMT2 0x01 35#define PW_MGMT2 0x01
38#define SG_SL1 0x02 36#define SG_SL1 0x02
@@ -71,8 +69,6 @@
71#define HP_MS 0x23 69#define HP_MS 0x23
72#define SPK_MS 0x24 70#define SPK_MS 0x24
73 71
74#define AK4642_CACHEREGNUM 0x25
75
76/* PW_MGMT1*/ 72/* PW_MGMT1*/
77#define PMVCM (1 << 6) /* VCOM Power Management */ 73#define PMVCM (1 << 6) /* VCOM Power Management */
78#define PMMIN (1 << 5) /* MIN Input Power Management */ 74#define PMMIN (1 << 5) /* MIN Input Power Management */
@@ -150,8 +146,52 @@ static const struct snd_kcontrol_new ak4642_snd_controls[] = {
150 146
151 SOC_DOUBLE_R_TLV("Digital Playback Volume", L_DVC, R_DVC, 147 SOC_DOUBLE_R_TLV("Digital Playback Volume", L_DVC, R_DVC,
152 0, 0xFF, 1, out_tlv), 148 0, 0xFF, 1, out_tlv),
149
150 SOC_SINGLE("Headphone Switch", PW_MGMT2, 6, 1, 0),
151};
152
153static const struct snd_kcontrol_new ak4642_hpout_mixer_controls[] = {
154 SOC_DAPM_SINGLE("DACH", MD_CTL4, 0, 1, 0),
155};
156
157static const struct snd_kcontrol_new ak4642_lout_mixer_controls[] = {
158 SOC_DAPM_SINGLE("DACL", SG_SL1, 4, 1, 0),
159};
160
161static const struct snd_soc_dapm_widget ak4642_dapm_widgets[] = {
162
163 /* Outputs */
164 SND_SOC_DAPM_OUTPUT("HPOUTL"),
165 SND_SOC_DAPM_OUTPUT("HPOUTR"),
166 SND_SOC_DAPM_OUTPUT("LINEOUT"),
167
168 SND_SOC_DAPM_MIXER("HPOUTL Mixer", PW_MGMT2, 5, 0,
169 &ak4642_hpout_mixer_controls[0],
170 ARRAY_SIZE(ak4642_hpout_mixer_controls)),
171
172 SND_SOC_DAPM_MIXER("HPOUTR Mixer", PW_MGMT2, 4, 0,
173 &ak4642_hpout_mixer_controls[0],
174 ARRAY_SIZE(ak4642_hpout_mixer_controls)),
175
176 SND_SOC_DAPM_MIXER("LINEOUT Mixer", PW_MGMT1, 3, 0,
177 &ak4642_lout_mixer_controls[0],
178 ARRAY_SIZE(ak4642_lout_mixer_controls)),
179
180 /* DAC */
181 SND_SOC_DAPM_DAC("DAC", "HiFi Playback", PW_MGMT1, 2, 0),
153}; 182};
154 183
184static const struct snd_soc_dapm_route ak4642_intercon[] = {
185
186 /* Outputs */
187 {"HPOUTL", NULL, "HPOUTL Mixer"},
188 {"HPOUTR", NULL, "HPOUTR Mixer"},
189 {"LINEOUT", NULL, "LINEOUT Mixer"},
190
191 {"HPOUTL Mixer", "DACH", "DAC"},
192 {"HPOUTR Mixer", "DACH", "DAC"},
193 {"LINEOUT Mixer", "DACL", "DAC"},
194};
155 195
156/* codec private data */ 196/* codec private data */
157struct ak4642_priv { 197struct ak4642_priv {
@@ -162,7 +202,7 @@ struct ak4642_priv {
162/* 202/*
163 * ak4642 register cache 203 * ak4642 register cache
164 */ 204 */
165static const u8 ak4642_reg[AK4642_CACHEREGNUM] = { 205static const u8 ak4642_reg[] = {
166 0x00, 0x00, 0x01, 0x00, 206 0x00, 0x00, 0x01, 0x00,
167 0x02, 0x00, 0x00, 0x00, 207 0x02, 0x00, 0x00, 0x00,
168 0xe1, 0xe1, 0x18, 0x00, 208 0xe1, 0xe1, 0x18, 0x00,
@@ -175,6 +215,19 @@ static const u8 ak4642_reg[AK4642_CACHEREGNUM] = {
175 0x00, 215 0x00,
176}; 216};
177 217
218static const u8 ak4648_reg[] = {
219 0x00, 0x00, 0x01, 0x00,
220 0x02, 0x00, 0x00, 0x00,
221 0xe1, 0xe1, 0x18, 0x00,
222 0xe1, 0x18, 0x11, 0xb8,
223 0x00, 0x00, 0x00, 0x00,
224 0x00, 0x00, 0x00, 0x00,
225 0x00, 0x00, 0x00, 0x00,
226 0x00, 0x00, 0x00, 0x00,
227 0x00, 0x00, 0x00, 0x00,
228 0x00, 0x88, 0x88, 0x08,
229};
230
178static int ak4642_dai_startup(struct snd_pcm_substream *substream, 231static int ak4642_dai_startup(struct snd_pcm_substream *substream,
179 struct snd_soc_dai *dai) 232 struct snd_soc_dai *dai)
180{ 233{
@@ -192,14 +245,8 @@ static int ak4642_dai_startup(struct snd_pcm_substream *substream,
192 * This operation came from example code of 245 * This operation came from example code of
193 * "ASAHI KASEI AK4642" (japanese) manual p97. 246 * "ASAHI KASEI AK4642" (japanese) manual p97.
194 */ 247 */
195 snd_soc_update_bits(codec, MD_CTL4, DACH, DACH);
196 snd_soc_update_bits(codec, MD_CTL3, BST1, BST1);
197 snd_soc_write(codec, L_IVC, 0x91); /* volume */ 248 snd_soc_write(codec, L_IVC, 0x91); /* volume */
198 snd_soc_write(codec, R_IVC, 0x91); /* volume */ 249 snd_soc_write(codec, R_IVC, 0x91); /* volume */
199 snd_soc_update_bits(codec, PW_MGMT1, PMVCM | PMMIN | PMDAC,
200 PMVCM | PMMIN | PMDAC);
201 snd_soc_update_bits(codec, PW_MGMT2, PMHP_MASK, PMHP);
202 snd_soc_update_bits(codec, PW_MGMT2, HPMTN, HPMTN);
203 } else { 250 } else {
204 /* 251 /*
205 * start stereo input 252 * start stereo input
@@ -217,8 +264,7 @@ static int ak4642_dai_startup(struct snd_pcm_substream *substream,
217 snd_soc_write(codec, SG_SL1, PMMP | MGAIN0); 264 snd_soc_write(codec, SG_SL1, PMMP | MGAIN0);
218 snd_soc_write(codec, TIMER, ZTM(0x3) | WTM(0x3)); 265 snd_soc_write(codec, TIMER, ZTM(0x3) | WTM(0x3));
219 snd_soc_write(codec, ALC_CTL1, ALC | LMTH0); 266 snd_soc_write(codec, ALC_CTL1, ALC | LMTH0);
220 snd_soc_update_bits(codec, PW_MGMT1, PMVCM | PMADL, 267 snd_soc_update_bits(codec, PW_MGMT1, PMADL, PMADL);
221 PMVCM | PMADL);
222 snd_soc_update_bits(codec, PW_MGMT3, PMADR, PMADR); 268 snd_soc_update_bits(codec, PW_MGMT3, PMADR, PMADR);
223 } 269 }
224 270
@@ -232,12 +278,6 @@ static void ak4642_dai_shutdown(struct snd_pcm_substream *substream,
232 struct snd_soc_codec *codec = dai->codec; 278 struct snd_soc_codec *codec = dai->codec;
233 279
234 if (is_play) { 280 if (is_play) {
235 /* stop headphone output */
236 snd_soc_update_bits(codec, PW_MGMT2, HPMTN, 0);
237 snd_soc_update_bits(codec, PW_MGMT2, PMHP_MASK, 0);
238 snd_soc_update_bits(codec, PW_MGMT1, PMMIN | PMDAC, 0);
239 snd_soc_update_bits(codec, MD_CTL3, BST1, 0);
240 snd_soc_update_bits(codec, MD_CTL4, DACH, 0);
241 } else { 281 } else {
242 /* stop stereo input */ 282 /* stop stereo input */
243 snd_soc_update_bits(codec, PW_MGMT1, PMADL, 0); 283 snd_soc_update_bits(codec, PW_MGMT1, PMADL, 0);
@@ -376,7 +416,23 @@ static int ak4642_dai_hw_params(struct snd_pcm_substream *substream,
376 return 0; 416 return 0;
377} 417}
378 418
379static struct snd_soc_dai_ops ak4642_dai_ops = { 419static int ak4642_set_bias_level(struct snd_soc_codec *codec,
420 enum snd_soc_bias_level level)
421{
422 switch (level) {
423 case SND_SOC_BIAS_OFF:
424 snd_soc_write(codec, PW_MGMT1, 0x00);
425 break;
426 default:
427 snd_soc_update_bits(codec, PW_MGMT1, PMVCM, PMVCM);
428 break;
429 }
430 codec->dapm.bias_level = level;
431
432 return 0;
433}
434
435static const struct snd_soc_dai_ops ak4642_dai_ops = {
380 .startup = ak4642_dai_startup, 436 .startup = ak4642_dai_startup,
381 .shutdown = ak4642_dai_shutdown, 437 .shutdown = ak4642_dai_shutdown,
382 .set_sysclk = ak4642_dai_set_sysclk, 438 .set_sysclk = ak4642_dai_set_sysclk,
@@ -414,8 +470,6 @@ static int ak4642_probe(struct snd_soc_codec *codec)
414 struct ak4642_priv *ak4642 = snd_soc_codec_get_drvdata(codec); 470 struct ak4642_priv *ak4642 = snd_soc_codec_get_drvdata(codec);
415 int ret; 471 int ret;
416 472
417 dev_info(codec->dev, "AK4642 Audio Codec %s", AK4642_VERSION);
418
419 ret = snd_soc_codec_set_cache_io(codec, 8, 8, ak4642->control_type); 473 ret = snd_soc_codec_set_cache_io(codec, 8, 8, ak4642->control_type);
420 if (ret < 0) { 474 if (ret < 0) {
421 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret); 475 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
@@ -425,15 +479,43 @@ static int ak4642_probe(struct snd_soc_codec *codec)
425 snd_soc_add_controls(codec, ak4642_snd_controls, 479 snd_soc_add_controls(codec, ak4642_snd_controls,
426 ARRAY_SIZE(ak4642_snd_controls)); 480 ARRAY_SIZE(ak4642_snd_controls));
427 481
482 ak4642_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
483
484 return 0;
485}
486
487static int ak4642_remove(struct snd_soc_codec *codec)
488{
489 ak4642_set_bias_level(codec, SND_SOC_BIAS_OFF);
428 return 0; 490 return 0;
429} 491}
430 492
431static struct snd_soc_codec_driver soc_codec_dev_ak4642 = { 493static struct snd_soc_codec_driver soc_codec_dev_ak4642 = {
432 .probe = ak4642_probe, 494 .probe = ak4642_probe,
495 .remove = ak4642_remove,
496 .resume = ak4642_resume,
497 .set_bias_level = ak4642_set_bias_level,
498 .reg_cache_default = ak4642_reg, /* ak4642 reg */
499 .reg_cache_size = ARRAY_SIZE(ak4642_reg), /* ak4642 reg */
500 .reg_word_size = sizeof(u8),
501 .dapm_widgets = ak4642_dapm_widgets,
502 .num_dapm_widgets = ARRAY_SIZE(ak4642_dapm_widgets),
503 .dapm_routes = ak4642_intercon,
504 .num_dapm_routes = ARRAY_SIZE(ak4642_intercon),
505};
506
507static struct snd_soc_codec_driver soc_codec_dev_ak4648 = {
508 .probe = ak4642_probe,
509 .remove = ak4642_remove,
433 .resume = ak4642_resume, 510 .resume = ak4642_resume,
434 .reg_cache_size = ARRAY_SIZE(ak4642_reg), 511 .set_bias_level = ak4642_set_bias_level,
512 .reg_cache_default = ak4648_reg, /* ak4648 reg */
513 .reg_cache_size = ARRAY_SIZE(ak4648_reg), /* ak4648 reg */
435 .reg_word_size = sizeof(u8), 514 .reg_word_size = sizeof(u8),
436 .reg_cache_default = ak4642_reg, 515 .dapm_widgets = ak4642_dapm_widgets,
516 .num_dapm_widgets = ARRAY_SIZE(ak4642_dapm_widgets),
517 .dapm_routes = ak4642_intercon,
518 .num_dapm_routes = ARRAY_SIZE(ak4642_intercon),
437}; 519};
438 520
439#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) 521#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
@@ -443,7 +525,8 @@ static __devinit int ak4642_i2c_probe(struct i2c_client *i2c,
443 struct ak4642_priv *ak4642; 525 struct ak4642_priv *ak4642;
444 int ret; 526 int ret;
445 527
446 ak4642 = kzalloc(sizeof(struct ak4642_priv), GFP_KERNEL); 528 ak4642 = devm_kzalloc(&i2c->dev, sizeof(struct ak4642_priv),
529 GFP_KERNEL);
447 if (!ak4642) 530 if (!ak4642)
448 return -ENOMEM; 531 return -ENOMEM;
449 532
@@ -451,22 +534,21 @@ static __devinit int ak4642_i2c_probe(struct i2c_client *i2c,
451 ak4642->control_type = SND_SOC_I2C; 534 ak4642->control_type = SND_SOC_I2C;
452 535
453 ret = snd_soc_register_codec(&i2c->dev, 536 ret = snd_soc_register_codec(&i2c->dev,
454 &soc_codec_dev_ak4642, &ak4642_dai, 1); 537 (struct snd_soc_codec_driver *)id->driver_data,
455 if (ret < 0) 538 &ak4642_dai, 1);
456 kfree(ak4642);
457 return ret; 539 return ret;
458} 540}
459 541
460static __devexit int ak4642_i2c_remove(struct i2c_client *client) 542static __devexit int ak4642_i2c_remove(struct i2c_client *client)
461{ 543{
462 snd_soc_unregister_codec(&client->dev); 544 snd_soc_unregister_codec(&client->dev);
463 kfree(i2c_get_clientdata(client));
464 return 0; 545 return 0;
465} 546}
466 547
467static const struct i2c_device_id ak4642_i2c_id[] = { 548static const struct i2c_device_id ak4642_i2c_id[] = {
468 { "ak4642", 0 }, 549 { "ak4642", (kernel_ulong_t)&soc_codec_dev_ak4642 },
469 { "ak4643", 0 }, 550 { "ak4643", (kernel_ulong_t)&soc_codec_dev_ak4642 },
551 { "ak4648", (kernel_ulong_t)&soc_codec_dev_ak4648 },
470 { } 552 { }
471}; 553};
472MODULE_DEVICE_TABLE(i2c, ak4642_i2c_id); 554MODULE_DEVICE_TABLE(i2c, ak4642_i2c_id);
diff --git a/sound/soc/codecs/ak4671.c b/sound/soc/codecs/ak4671.c
index de9ff66d372..a53b152e6a0 100644
--- a/sound/soc/codecs/ak4671.c
+++ b/sound/soc/codecs/ak4671.c
@@ -594,7 +594,7 @@ static int ak4671_set_bias_level(struct snd_soc_codec *codec,
594 594
595#define AK4671_FORMATS SNDRV_PCM_FMTBIT_S16_LE 595#define AK4671_FORMATS SNDRV_PCM_FMTBIT_S16_LE
596 596
597static struct snd_soc_dai_ops ak4671_dai_ops = { 597static const struct snd_soc_dai_ops ak4671_dai_ops = {
598 .hw_params = ak4671_hw_params, 598 .hw_params = ak4671_hw_params,
599 .set_sysclk = ak4671_set_dai_sysclk, 599 .set_sysclk = ak4671_set_dai_sysclk,
600 .set_fmt = ak4671_set_dai_fmt, 600 .set_fmt = ak4671_set_dai_fmt,
@@ -661,7 +661,8 @@ static int __devinit ak4671_i2c_probe(struct i2c_client *client,
661 struct ak4671_priv *ak4671; 661 struct ak4671_priv *ak4671;
662 int ret; 662 int ret;
663 663
664 ak4671 = kzalloc(sizeof(struct ak4671_priv), GFP_KERNEL); 664 ak4671 = devm_kzalloc(&client->dev, sizeof(struct ak4671_priv),
665 GFP_KERNEL);
665 if (ak4671 == NULL) 666 if (ak4671 == NULL)
666 return -ENOMEM; 667 return -ENOMEM;
667 668
@@ -670,15 +671,12 @@ static int __devinit ak4671_i2c_probe(struct i2c_client *client,
670 671
671 ret = snd_soc_register_codec(&client->dev, 672 ret = snd_soc_register_codec(&client->dev,
672 &soc_codec_dev_ak4671, &ak4671_dai, 1); 673 &soc_codec_dev_ak4671, &ak4671_dai, 1);
673 if (ret < 0)
674 kfree(ak4671);
675 return ret; 674 return ret;
676} 675}
677 676
678static __devexit int ak4671_i2c_remove(struct i2c_client *client) 677static __devexit int ak4671_i2c_remove(struct i2c_client *client)
679{ 678{
680 snd_soc_unregister_codec(&client->dev); 679 snd_soc_unregister_codec(&client->dev);
681 kfree(i2c_get_clientdata(client));
682 return 0; 680 return 0;
683} 681}
684 682
diff --git a/sound/soc/codecs/alc5623.c b/sound/soc/codecs/alc5623.c
index 984b14bcb60..3feee569cee 100644
--- a/sound/soc/codecs/alc5623.c
+++ b/sound/soc/codecs/alc5623.c
@@ -22,7 +22,6 @@
22#include <linux/pm.h> 22#include <linux/pm.h>
23#include <linux/i2c.h> 23#include <linux/i2c.h>
24#include <linux/slab.h> 24#include <linux/slab.h>
25#include <linux/platform_device.h>
26#include <sound/core.h> 25#include <sound/core.h>
27#include <sound/pcm.h> 26#include <sound/pcm.h>
28#include <sound/pcm_params.h> 27#include <sound/pcm_params.h>
@@ -100,7 +99,7 @@ static const unsigned int boost_tlv[] = {
100}; 99};
101static const DECLARE_TLV_DB_SCALE(dig_tlv, 0, 600, 0); 100static const DECLARE_TLV_DB_SCALE(dig_tlv, 0, 600, 0);
102 101
103static const struct snd_kcontrol_new rt5621_vol_snd_controls[] = { 102static const struct snd_kcontrol_new alc5621_vol_snd_controls[] = {
104 SOC_DOUBLE_TLV("Speaker Playback Volume", 103 SOC_DOUBLE_TLV("Speaker Playback Volume",
105 ALC5623_SPK_OUT_VOL, 8, 0, 31, 1, hp_tlv), 104 ALC5623_SPK_OUT_VOL, 8, 0, 31, 1, hp_tlv),
106 SOC_DOUBLE("Speaker Playback Switch", 105 SOC_DOUBLE("Speaker Playback Switch",
@@ -111,7 +110,7 @@ static const struct snd_kcontrol_new rt5621_vol_snd_controls[] = {
111 ALC5623_HP_OUT_VOL, 15, 7, 1, 1), 110 ALC5623_HP_OUT_VOL, 15, 7, 1, 1),
112}; 111};
113 112
114static const struct snd_kcontrol_new rt5622_vol_snd_controls[] = { 113static const struct snd_kcontrol_new alc5622_vol_snd_controls[] = {
115 SOC_DOUBLE_TLV("Speaker Playback Volume", 114 SOC_DOUBLE_TLV("Speaker Playback Volume",
116 ALC5623_SPK_OUT_VOL, 8, 0, 31, 1, hp_tlv), 115 ALC5623_SPK_OUT_VOL, 8, 0, 31, 1, hp_tlv),
117 SOC_DOUBLE("Speaker Playback Switch", 116 SOC_DOUBLE("Speaker Playback Switch",
@@ -839,7 +838,7 @@ static int alc5623_set_bias_level(struct snd_soc_codec *codec,
839 | SNDRV_PCM_FMTBIT_S24_LE \ 838 | SNDRV_PCM_FMTBIT_S24_LE \
840 | SNDRV_PCM_FMTBIT_S32_LE) 839 | SNDRV_PCM_FMTBIT_S32_LE)
841 840
842static struct snd_soc_dai_ops alc5623_dai_ops = { 841static const struct snd_soc_dai_ops alc5623_dai_ops = {
843 .hw_params = alc5623_pcm_hw_params, 842 .hw_params = alc5623_pcm_hw_params,
844 .digital_mute = alc5623_mute, 843 .digital_mute = alc5623_mute,
845 .set_fmt = alc5623_set_dai_fmt, 844 .set_fmt = alc5623_set_dai_fmt,
@@ -869,7 +868,7 @@ static struct snd_soc_dai_driver alc5623_dai = {
869 .ops = &alc5623_dai_ops, 868 .ops = &alc5623_dai_ops,
870}; 869};
871 870
872static int alc5623_suspend(struct snd_soc_codec *codec, pm_message_t mesg) 871static int alc5623_suspend(struct snd_soc_codec *codec)
873{ 872{
874 alc5623_set_bias_level(codec, SND_SOC_BIAS_OFF); 873 alc5623_set_bias_level(codec, SND_SOC_BIAS_OFF);
875 return 0; 874 return 0;
@@ -926,12 +925,12 @@ static int alc5623_probe(struct snd_soc_codec *codec)
926 925
927 switch (alc5623->id) { 926 switch (alc5623->id) {
928 case 0x21: 927 case 0x21:
929 snd_soc_add_controls(codec, rt5621_vol_snd_controls, 928 snd_soc_add_controls(codec, alc5621_vol_snd_controls,
930 ARRAY_SIZE(rt5621_vol_snd_controls)); 929 ARRAY_SIZE(alc5621_vol_snd_controls));
931 break; 930 break;
932 case 0x22: 931 case 0x22:
933 snd_soc_add_controls(codec, rt5622_vol_snd_controls, 932 snd_soc_add_controls(codec, alc5622_vol_snd_controls,
934 ARRAY_SIZE(rt5622_vol_snd_controls)); 933 ARRAY_SIZE(alc5622_vol_snd_controls));
935 break; 934 break;
936 case 0x23: 935 case 0x23:
937 snd_soc_add_controls(codec, alc5623_vol_snd_controls, 936 snd_soc_add_controls(codec, alc5623_vol_snd_controls,
@@ -1023,7 +1022,8 @@ static int alc5623_i2c_probe(struct i2c_client *client,
1023 1022
1024 dev_dbg(&client->dev, "Found codec id : alc56%02x\n", vid2); 1023 dev_dbg(&client->dev, "Found codec id : alc56%02x\n", vid2);
1025 1024
1026 alc5623 = kzalloc(sizeof(struct alc5623_priv), GFP_KERNEL); 1025 alc5623 = devm_kzalloc(&client->dev, sizeof(struct alc5623_priv),
1026 GFP_KERNEL);
1027 if (alc5623 == NULL) 1027 if (alc5623 == NULL)
1028 return -ENOMEM; 1028 return -ENOMEM;
1029 1029
@@ -1045,7 +1045,6 @@ static int alc5623_i2c_probe(struct i2c_client *client,
1045 alc5623_dai.name = "alc5623-hifi"; 1045 alc5623_dai.name = "alc5623-hifi";
1046 break; 1046 break;
1047 default: 1047 default:
1048 kfree(alc5623);
1049 return -EINVAL; 1048 return -EINVAL;
1050 } 1049 }
1051 1050
@@ -1054,20 +1053,15 @@ static int alc5623_i2c_probe(struct i2c_client *client,
1054 1053
1055 ret = snd_soc_register_codec(&client->dev, 1054 ret = snd_soc_register_codec(&client->dev,
1056 &soc_codec_device_alc5623, &alc5623_dai, 1); 1055 &soc_codec_device_alc5623, &alc5623_dai, 1);
1057 if (ret != 0) { 1056 if (ret != 0)
1058 dev_err(&client->dev, "Failed to register codec: %d\n", ret); 1057 dev_err(&client->dev, "Failed to register codec: %d\n", ret);
1059 kfree(alc5623);
1060 }
1061 1058
1062 return ret; 1059 return ret;
1063} 1060}
1064 1061
1065static int alc5623_i2c_remove(struct i2c_client *client) 1062static int alc5623_i2c_remove(struct i2c_client *client)
1066{ 1063{
1067 struct alc5623_priv *alc5623 = i2c_get_clientdata(client);
1068
1069 snd_soc_unregister_codec(&client->dev); 1064 snd_soc_unregister_codec(&client->dev);
1070 kfree(alc5623);
1071 return 0; 1065 return 0;
1072} 1066}
1073 1067
diff --git a/sound/soc/codecs/alc5632.c b/sound/soc/codecs/alc5632.c
new file mode 100644
index 00000000000..390e437d7c5
--- /dev/null
+++ b/sound/soc/codecs/alc5632.c
@@ -0,0 +1,1159 @@
1/*
2* alc5632.c -- ALC5632 ALSA SoC Audio Codec
3*
4* Copyright (C) 2011 The AC100 Kernel Team <ac100@lists.lauchpad.net>
5*
6* Authors: Leon Romanovsky <leon@leon.nu>
7* Andrey Danin <danindrey@mail.ru>
8* Ilya Petrov <ilya.muromec@gmail.com>
9* Marc Dietrich <marvin24@gmx.de>
10*
11* Based on alc5623.c by Arnaud Patard
12*
13* This program is free software; you can redistribute it and/or modify
14* it under the terms of the GNU General Public License version 2 as
15* published by the Free Software Foundation.
16*/
17
18#include <linux/module.h>
19#include <linux/kernel.h>
20#include <linux/init.h>
21#include <linux/delay.h>
22#include <linux/pm.h>
23#include <linux/i2c.h>
24#include <linux/slab.h>
25#include <linux/regmap.h>
26#include <sound/core.h>
27#include <sound/pcm.h>
28#include <sound/pcm_params.h>
29#include <sound/tlv.h>
30#include <sound/soc.h>
31#include <sound/initval.h>
32
33#include "alc5632.h"
34
35/*
36 * ALC5632 register cache
37 */
38static struct reg_default alc5632_reg_defaults[] = {
39 { 2, 0x8080 }, /* R2 - Speaker Output Volume */
40 { 4, 0x8080 }, /* R4 - Headphone Output Volume */
41 { 6, 0x8080 }, /* R6 - AUXOUT Volume */
42 { 8, 0xC800 }, /* R8 - Phone Input */
43 { 10, 0xE808 }, /* R10 - LINE_IN Volume */
44 { 12, 0x1010 }, /* R12 - STEREO DAC Input Volume */
45 { 14, 0x0808 }, /* R14 - MIC Input Volume */
46 { 16, 0xEE0F }, /* R16 - Stereo DAC and MIC Routing Control */
47 { 18, 0xCBCB }, /* R18 - ADC Record Gain */
48 { 20, 0x7F7F }, /* R20 - ADC Record Mixer Control */
49 { 24, 0xE010 }, /* R24 - Voice DAC Volume */
50 { 28, 0x8008 }, /* R28 - Output Mixer Control */
51 { 34, 0x0000 }, /* R34 - Microphone Control */
52 { 36, 0x00C0 }, /* R36 - Codec Digital MIC/Digital Boost
53 Control */
54 { 46, 0x0000 }, /* R46 - Stereo DAC/Voice DAC/Stereo ADC
55 Function Select */
56 { 52, 0x8000 }, /* R52 - Main Serial Data Port Control
57 (Stereo I2S) */
58 { 54, 0x0000 }, /* R54 - Extend Serial Data Port Control
59 (VoDAC_I2S/PCM) */
60 { 58, 0x0000 }, /* R58 - Power Management Addition 1 */
61 { 60, 0x0000 }, /* R60 - Power Management Addition 2 */
62 { 62, 0x8000 }, /* R62 - Power Management Addition 3 */
63 { 64, 0x0C0A }, /* R64 - General Purpose Control Register 1 */
64 { 66, 0x0000 }, /* R66 - General Purpose Control Register 2 */
65 { 68, 0x0000 }, /* R68 - PLL1 Control */
66 { 70, 0x0000 }, /* R70 - PLL2 Control */
67 { 76, 0xBE3E }, /* R76 - GPIO Pin Configuration */
68 { 78, 0xBE3E }, /* R78 - GPIO Pin Polarity */
69 { 80, 0x0000 }, /* R80 - GPIO Pin Sticky */
70 { 82, 0x0000 }, /* R82 - GPIO Pin Wake Up */
71 { 86, 0x0000 }, /* R86 - Pin Sharing */
72 { 90, 0x0009 }, /* R90 - Soft Volume Control Setting */
73 { 92, 0x0000 }, /* R92 - GPIO_Output Pin Control */
74 { 94, 0x3000 }, /* R94 - MISC Control */
75 { 96, 0x3075 }, /* R96 - Stereo DAC Clock Control_1 */
76 { 98, 0x1010 }, /* R98 - Stereo DAC Clock Control_2 */
77 { 100, 0x3110 }, /* R100 - VoDAC_PCM Clock Control_1 */
78 { 104, 0x0553 }, /* R104 - Pseudo Stereo and Spatial Effect
79 Block Control */
80 { 106, 0x0000 }, /* R106 - Private Register Address */
81};
82
83/* codec private data */
84struct alc5632_priv {
85 struct regmap *regmap;
86 u8 id;
87 unsigned int sysclk;
88};
89
90static bool alc5632_volatile_register(struct device *dev,
91 unsigned int reg)
92{
93 switch (reg) {
94 case ALC5632_RESET:
95 case ALC5632_PWR_DOWN_CTRL_STATUS:
96 case ALC5632_GPIO_PIN_STATUS:
97 case ALC5632_OVER_CURR_STATUS:
98 case ALC5632_HID_CTRL_DATA:
99 case ALC5632_EQ_CTRL:
100 case ALC5632_VENDOR_ID1:
101 case ALC5632_VENDOR_ID2:
102 return true;
103
104 default:
105 break;
106 }
107
108 return false;
109}
110
111static inline int alc5632_reset(struct regmap *map)
112{
113 return regmap_write(map, ALC5632_RESET, 0x59B4);
114}
115
116static int amp_mixer_event(struct snd_soc_dapm_widget *w,
117 struct snd_kcontrol *kcontrol, int event)
118{
119 /* to power-on/off class-d amp generators/speaker */
120 /* need to write to 'index-46h' register : */
121 /* so write index num (here 0x46) to reg 0x6a */
122 /* and then 0xffff/0 to reg 0x6c */
123 snd_soc_write(w->codec, ALC5632_HID_CTRL_INDEX, 0x46);
124
125 switch (event) {
126 case SND_SOC_DAPM_PRE_PMU:
127 snd_soc_write(w->codec, ALC5632_HID_CTRL_DATA, 0xFFFF);
128 break;
129 case SND_SOC_DAPM_POST_PMD:
130 snd_soc_write(w->codec, ALC5632_HID_CTRL_DATA, 0);
131 break;
132 }
133
134 return 0;
135}
136
137/*
138 * ALC5632 Controls
139 */
140
141/* -34.5db min scale, 1.5db steps, no mute */
142static const DECLARE_TLV_DB_SCALE(vol_tlv, -3450, 150, 0);
143/* -46.5db min scale, 1.5db steps, no mute */
144static const DECLARE_TLV_DB_SCALE(hp_tlv, -4650, 150, 0);
145/* -16.5db min scale, 1.5db steps, no mute */
146static const DECLARE_TLV_DB_SCALE(adc_rec_tlv, -1650, 150, 0);
147static const unsigned int boost_tlv[] = {
148 TLV_DB_RANGE_HEAD(3),
149 0, 0, TLV_DB_SCALE_ITEM(0, 0, 0),
150 1, 1, TLV_DB_SCALE_ITEM(2000, 0, 0),
151 2, 2, TLV_DB_SCALE_ITEM(3000, 0, 0),
152};
153/* 0db min scale, 6 db steps, no mute */
154static const DECLARE_TLV_DB_SCALE(dig_tlv, 0, 600, 0);
155/* 0db min scalem 0.75db steps, no mute */
156static const DECLARE_TLV_DB_SCALE(vdac_tlv, -3525, 075, 0);
157
158static const struct snd_kcontrol_new alc5632_vol_snd_controls[] = {
159 /* left starts at bit 8, right at bit 0 */
160 /* 31 steps (5 bit), -46.5db scale */
161 SOC_DOUBLE_TLV("Speaker Playback Volume",
162 ALC5632_SPK_OUT_VOL, 8, 0, 31, 1, hp_tlv),
163 /* bit 15 mutes left, bit 7 right */
164 SOC_DOUBLE("Speaker Playback Switch",
165 ALC5632_SPK_OUT_VOL, 15, 7, 1, 1),
166 SOC_DOUBLE_TLV("Headphone Playback Volume",
167 ALC5632_HP_OUT_VOL, 8, 0, 31, 1, hp_tlv),
168 SOC_DOUBLE("Headphone Playback Switch",
169 ALC5632_HP_OUT_VOL, 15, 7, 1, 1),
170};
171
172static const struct snd_kcontrol_new alc5632_snd_controls[] = {
173 SOC_DOUBLE_TLV("Auxout Playback Volume",
174 ALC5632_AUX_OUT_VOL, 8, 0, 31, 1, hp_tlv),
175 SOC_DOUBLE("Auxout Playback Switch",
176 ALC5632_AUX_OUT_VOL, 15, 7, 1, 1),
177 SOC_SINGLE_TLV("Voice DAC Playback Volume",
178 ALC5632_VOICE_DAC_VOL, 0, 63, 0, vdac_tlv),
179 SOC_SINGLE_TLV("Phone Capture Volume",
180 ALC5632_PHONE_IN_VOL, 8, 31, 1, vol_tlv),
181 SOC_DOUBLE_TLV("LineIn Capture Volume",
182 ALC5632_LINE_IN_VOL, 8, 0, 31, 1, vol_tlv),
183 SOC_DOUBLE_TLV("Master Playback Volume",
184 ALC5632_STEREO_DAC_IN_VOL, 8, 0, 63, 1, vdac_tlv),
185 SOC_DOUBLE("Master Playback Switch",
186 ALC5632_STEREO_DAC_IN_VOL, 15, 7, 1, 1),
187 SOC_SINGLE_TLV("Mic1 Capture Volume",
188 ALC5632_MIC_VOL, 8, 31, 1, vol_tlv),
189 SOC_SINGLE_TLV("Mic2 Capture Volume",
190 ALC5632_MIC_VOL, 0, 31, 1, vol_tlv),
191 SOC_DOUBLE_TLV("Rec Capture Volume",
192 ALC5632_ADC_REC_GAIN, 8, 0, 31, 0, adc_rec_tlv),
193 SOC_SINGLE_TLV("Mic 1 Boost Volume",
194 ALC5632_MIC_CTRL, 10, 2, 0, boost_tlv),
195 SOC_SINGLE_TLV("Mic 2 Boost Volume",
196 ALC5632_MIC_CTRL, 8, 2, 0, boost_tlv),
197 SOC_SINGLE_TLV("Digital Boost Volume",
198 ALC5632_DIGI_BOOST_CTRL, 0, 7, 0, dig_tlv),
199};
200
201/*
202 * DAPM Controls
203 */
204static const struct snd_kcontrol_new alc5632_hp_mixer_controls[] = {
205SOC_DAPM_SINGLE("LI2HP Playback Switch", ALC5632_LINE_IN_VOL, 15, 1, 1),
206SOC_DAPM_SINGLE("PHONE2HP Playback Switch", ALC5632_PHONE_IN_VOL, 15, 1, 1),
207SOC_DAPM_SINGLE("MIC12HP Playback Switch", ALC5632_MIC_ROUTING_CTRL, 15, 1, 1),
208SOC_DAPM_SINGLE("MIC22HP Playback Switch", ALC5632_MIC_ROUTING_CTRL, 11, 1, 1),
209SOC_DAPM_SINGLE("VOICE2HP Playback Switch", ALC5632_VOICE_DAC_VOL, 15, 1, 1),
210};
211
212static const struct snd_kcontrol_new alc5632_hpl_mixer_controls[] = {
213SOC_DAPM_SINGLE("ADC2HP_L Playback Switch", ALC5632_ADC_REC_GAIN, 15, 1, 1),
214SOC_DAPM_SINGLE("DACL2HP Playback Switch", ALC5632_MIC_ROUTING_CTRL, 3, 1, 1),
215};
216
217static const struct snd_kcontrol_new alc5632_hpr_mixer_controls[] = {
218SOC_DAPM_SINGLE("ADC2HP_R Playback Switch", ALC5632_ADC_REC_GAIN, 7, 1, 1),
219SOC_DAPM_SINGLE("DACR2HP Playback Switch", ALC5632_MIC_ROUTING_CTRL, 2, 1, 1),
220};
221
222static const struct snd_kcontrol_new alc5632_mono_mixer_controls[] = {
223SOC_DAPM_SINGLE("ADC2MONO_L Playback Switch", ALC5632_ADC_REC_GAIN, 14, 1, 1),
224SOC_DAPM_SINGLE("ADC2MONO_R Playback Switch", ALC5632_ADC_REC_GAIN, 6, 1, 1),
225SOC_DAPM_SINGLE("LI2MONO Playback Switch", ALC5632_LINE_IN_VOL, 13, 1, 1),
226SOC_DAPM_SINGLE("MIC12MONO Playback Switch",
227 ALC5632_MIC_ROUTING_CTRL, 13, 1, 1),
228SOC_DAPM_SINGLE("MIC22MONO Playback Switch",
229 ALC5632_MIC_ROUTING_CTRL, 9, 1, 1),
230SOC_DAPM_SINGLE("DAC2MONO Playback Switch", ALC5632_MIC_ROUTING_CTRL, 0, 1, 1),
231SOC_DAPM_SINGLE("VOICE2MONO Playback Switch", ALC5632_VOICE_DAC_VOL, 13, 1, 1),
232};
233
234static const struct snd_kcontrol_new alc5632_speaker_mixer_controls[] = {
235SOC_DAPM_SINGLE("LI2SPK Playback Switch", ALC5632_LINE_IN_VOL, 14, 1, 1),
236SOC_DAPM_SINGLE("PHONE2SPK Playback Switch", ALC5632_PHONE_IN_VOL, 14, 1, 1),
237SOC_DAPM_SINGLE("MIC12SPK Playback Switch",
238 ALC5632_MIC_ROUTING_CTRL, 14, 1, 1),
239SOC_DAPM_SINGLE("MIC22SPK Playback Switch",
240 ALC5632_MIC_ROUTING_CTRL, 10, 1, 1),
241SOC_DAPM_SINGLE("DAC2SPK Playback Switch", ALC5632_MIC_ROUTING_CTRL, 1, 1, 1),
242SOC_DAPM_SINGLE("VOICE2SPK Playback Switch", ALC5632_VOICE_DAC_VOL, 14, 1, 1),
243};
244
245/* Left Record Mixer */
246static const struct snd_kcontrol_new alc5632_captureL_mixer_controls[] = {
247SOC_DAPM_SINGLE("Mic1 Capture Switch", ALC5632_ADC_REC_MIXER, 14, 1, 1),
248SOC_DAPM_SINGLE("Mic2 Capture Switch", ALC5632_ADC_REC_MIXER, 13, 1, 1),
249SOC_DAPM_SINGLE("LineInL Capture Switch", ALC5632_ADC_REC_MIXER, 12, 1, 1),
250SOC_DAPM_SINGLE("Left Phone Capture Switch", ALC5632_ADC_REC_MIXER, 11, 1, 1),
251SOC_DAPM_SINGLE("HPMixerL Capture Switch", ALC5632_ADC_REC_MIXER, 10, 1, 1),
252SOC_DAPM_SINGLE("SPKMixer Capture Switch", ALC5632_ADC_REC_MIXER, 9, 1, 1),
253SOC_DAPM_SINGLE("MonoMixer Capture Switch", ALC5632_ADC_REC_MIXER, 8, 1, 1),
254};
255
256/* Right Record Mixer */
257static const struct snd_kcontrol_new alc5632_captureR_mixer_controls[] = {
258SOC_DAPM_SINGLE("Mic1 Capture Switch", ALC5632_ADC_REC_MIXER, 6, 1, 1),
259SOC_DAPM_SINGLE("Mic2 Capture Switch", ALC5632_ADC_REC_MIXER, 5, 1, 1),
260SOC_DAPM_SINGLE("LineInR Capture Switch", ALC5632_ADC_REC_MIXER, 4, 1, 1),
261SOC_DAPM_SINGLE("Right Phone Capture Switch", ALC5632_ADC_REC_MIXER, 3, 1, 1),
262SOC_DAPM_SINGLE("HPMixerR Capture Switch", ALC5632_ADC_REC_MIXER, 2, 1, 1),
263SOC_DAPM_SINGLE("SPKMixer Capture Switch", ALC5632_ADC_REC_MIXER, 1, 1, 1),
264SOC_DAPM_SINGLE("MonoMixer Capture Switch", ALC5632_ADC_REC_MIXER, 0, 1, 1),
265};
266
267static const char *alc5632_spk_n_sour_sel[] = {
268 "RN/-R", "RP/+R", "LN/-R", "Mute"};
269static const char *alc5632_hpl_out_input_sel[] = {
270 "Vmid", "HP Left Mix"};
271static const char *alc5632_hpr_out_input_sel[] = {
272 "Vmid", "HP Right Mix"};
273static const char *alc5632_spkout_input_sel[] = {
274 "Vmid", "HPOut Mix", "Speaker Mix", "Mono Mix"};
275static const char *alc5632_aux_out_input_sel[] = {
276 "Vmid", "HPOut Mix", "Speaker Mix", "Mono Mix"};
277
278/* auxout output mux */
279static const struct soc_enum alc5632_aux_out_input_enum =
280SOC_ENUM_SINGLE(ALC5632_OUTPUT_MIXER_CTRL, 6, 4, alc5632_aux_out_input_sel);
281static const struct snd_kcontrol_new alc5632_auxout_mux_controls =
282SOC_DAPM_ENUM("AuxOut Mux", alc5632_aux_out_input_enum);
283
284/* speaker output mux */
285static const struct soc_enum alc5632_spkout_input_enum =
286SOC_ENUM_SINGLE(ALC5632_OUTPUT_MIXER_CTRL, 10, 4, alc5632_spkout_input_sel);
287static const struct snd_kcontrol_new alc5632_spkout_mux_controls =
288SOC_DAPM_ENUM("SpeakerOut Mux", alc5632_spkout_input_enum);
289
290/* headphone left output mux */
291static const struct soc_enum alc5632_hpl_out_input_enum =
292SOC_ENUM_SINGLE(ALC5632_OUTPUT_MIXER_CTRL, 9, 2, alc5632_hpl_out_input_sel);
293static const struct snd_kcontrol_new alc5632_hpl_out_mux_controls =
294SOC_DAPM_ENUM("Left Headphone Mux", alc5632_hpl_out_input_enum);
295
296/* headphone right output mux */
297static const struct soc_enum alc5632_hpr_out_input_enum =
298SOC_ENUM_SINGLE(ALC5632_OUTPUT_MIXER_CTRL, 8, 2, alc5632_hpr_out_input_sel);
299static const struct snd_kcontrol_new alc5632_hpr_out_mux_controls =
300SOC_DAPM_ENUM("Right Headphone Mux", alc5632_hpr_out_input_enum);
301
302/* speaker output N select */
303static const struct soc_enum alc5632_spk_n_sour_enum =
304SOC_ENUM_SINGLE(ALC5632_OUTPUT_MIXER_CTRL, 14, 4, alc5632_spk_n_sour_sel);
305static const struct snd_kcontrol_new alc5632_spkoutn_mux_controls =
306SOC_DAPM_ENUM("SpeakerOut N Mux", alc5632_spk_n_sour_enum);
307
308/* speaker amplifier */
309static const char *alc5632_amp_names[] = {"AB Amp", "D Amp"};
310static const struct soc_enum alc5632_amp_enum =
311 SOC_ENUM_SINGLE(ALC5632_OUTPUT_MIXER_CTRL, 13, 2, alc5632_amp_names);
312static const struct snd_kcontrol_new alc5632_amp_mux_controls =
313 SOC_DAPM_ENUM("AB-D Amp Mux", alc5632_amp_enum);
314
315
316static const struct snd_soc_dapm_widget alc5632_dapm_widgets[] = {
317/* Muxes */
318SND_SOC_DAPM_MUX("AuxOut Mux", SND_SOC_NOPM, 0, 0,
319 &alc5632_auxout_mux_controls),
320SND_SOC_DAPM_MUX("SpeakerOut Mux", SND_SOC_NOPM, 0, 0,
321 &alc5632_spkout_mux_controls),
322SND_SOC_DAPM_MUX("Left Headphone Mux", SND_SOC_NOPM, 0, 0,
323 &alc5632_hpl_out_mux_controls),
324SND_SOC_DAPM_MUX("Right Headphone Mux", SND_SOC_NOPM, 0, 0,
325 &alc5632_hpr_out_mux_controls),
326SND_SOC_DAPM_MUX("SpeakerOut N Mux", SND_SOC_NOPM, 0, 0,
327 &alc5632_spkoutn_mux_controls),
328
329/* output mixers */
330SND_SOC_DAPM_MIXER("HP Mix", SND_SOC_NOPM, 0, 0,
331 &alc5632_hp_mixer_controls[0],
332 ARRAY_SIZE(alc5632_hp_mixer_controls)),
333SND_SOC_DAPM_MIXER("HPR Mix", ALC5632_PWR_MANAG_ADD2, 4, 0,
334 &alc5632_hpr_mixer_controls[0],
335 ARRAY_SIZE(alc5632_hpr_mixer_controls)),
336SND_SOC_DAPM_MIXER("HPL Mix", ALC5632_PWR_MANAG_ADD2, 5, 0,
337 &alc5632_hpl_mixer_controls[0],
338 ARRAY_SIZE(alc5632_hpl_mixer_controls)),
339SND_SOC_DAPM_MIXER("HPOut Mix", SND_SOC_NOPM, 0, 0, NULL, 0),
340SND_SOC_DAPM_MIXER("Mono Mix", ALC5632_PWR_MANAG_ADD2, 2, 0,
341 &alc5632_mono_mixer_controls[0],
342 ARRAY_SIZE(alc5632_mono_mixer_controls)),
343SND_SOC_DAPM_MIXER("Speaker Mix", ALC5632_PWR_MANAG_ADD2, 3, 0,
344 &alc5632_speaker_mixer_controls[0],
345 ARRAY_SIZE(alc5632_speaker_mixer_controls)),
346
347/* input mixers */
348SND_SOC_DAPM_MIXER("Left Capture Mix", ALC5632_PWR_MANAG_ADD2, 1, 0,
349 &alc5632_captureL_mixer_controls[0],
350 ARRAY_SIZE(alc5632_captureL_mixer_controls)),
351SND_SOC_DAPM_MIXER("Right Capture Mix", ALC5632_PWR_MANAG_ADD2, 0, 0,
352 &alc5632_captureR_mixer_controls[0],
353 ARRAY_SIZE(alc5632_captureR_mixer_controls)),
354
355SND_SOC_DAPM_DAC("Left DAC", "HiFi Playback",
356 ALC5632_PWR_MANAG_ADD2, 9, 0),
357SND_SOC_DAPM_DAC("Right DAC", "HiFi Playback",
358 ALC5632_PWR_MANAG_ADD2, 8, 0),
359SND_SOC_DAPM_MIXER("DAC Left Channel", ALC5632_PWR_MANAG_ADD1, 15, 0, NULL, 0),
360SND_SOC_DAPM_MIXER("DAC Right Channel",
361 ALC5632_PWR_MANAG_ADD1, 14, 0, NULL, 0),
362SND_SOC_DAPM_MIXER("I2S Mix", ALC5632_PWR_MANAG_ADD1, 11, 0, NULL, 0),
363SND_SOC_DAPM_MIXER("Phone Mix", SND_SOC_NOPM, 0, 0, NULL, 0),
364SND_SOC_DAPM_MIXER("Line Mix", SND_SOC_NOPM, 0, 0, NULL, 0),
365SND_SOC_DAPM_ADC("Left ADC", "HiFi Capture",
366 ALC5632_PWR_MANAG_ADD2, 7, 0),
367SND_SOC_DAPM_ADC("Right ADC", "HiFi Capture",
368 ALC5632_PWR_MANAG_ADD2, 6, 0),
369SND_SOC_DAPM_PGA("Left Headphone", ALC5632_PWR_MANAG_ADD3, 11, 0, NULL, 0),
370SND_SOC_DAPM_PGA("Right Headphone", ALC5632_PWR_MANAG_ADD3, 10, 0, NULL, 0),
371SND_SOC_DAPM_PGA("Left Speaker", ALC5632_PWR_MANAG_ADD3, 13, 0, NULL, 0),
372SND_SOC_DAPM_PGA("Right Speaker", ALC5632_PWR_MANAG_ADD3, 12, 0, NULL, 0),
373SND_SOC_DAPM_PGA("Aux Out", ALC5632_PWR_MANAG_ADD3, 14, 0, NULL, 0),
374SND_SOC_DAPM_PGA("Left LineIn", ALC5632_PWR_MANAG_ADD3, 7, 0, NULL, 0),
375SND_SOC_DAPM_PGA("Right LineIn", ALC5632_PWR_MANAG_ADD3, 6, 0, NULL, 0),
376SND_SOC_DAPM_PGA("Phone", ALC5632_PWR_MANAG_ADD3, 5, 0, NULL, 0),
377SND_SOC_DAPM_PGA("Phone ADMix", ALC5632_PWR_MANAG_ADD3, 4, 0, NULL, 0),
378SND_SOC_DAPM_PGA("MIC1 PGA", ALC5632_PWR_MANAG_ADD3, 3, 0, NULL, 0),
379SND_SOC_DAPM_PGA("MIC2 PGA", ALC5632_PWR_MANAG_ADD3, 2, 0, NULL, 0),
380SND_SOC_DAPM_PGA("MIC1 Pre Amp", ALC5632_PWR_MANAG_ADD3, 1, 0, NULL, 0),
381SND_SOC_DAPM_PGA("MIC2 Pre Amp", ALC5632_PWR_MANAG_ADD3, 0, 0, NULL, 0),
382SND_SOC_DAPM_SUPPLY("MICBIAS1", ALC5632_PWR_MANAG_ADD1, 3, 0, NULL, 0),
383SND_SOC_DAPM_SUPPLY("MICBIAS2", ALC5632_PWR_MANAG_ADD1, 2, 0, NULL, 0),
384
385SND_SOC_DAPM_PGA_E("D Amp", ALC5632_PWR_MANAG_ADD2, 14, 0, NULL, 0,
386 amp_mixer_event, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
387SND_SOC_DAPM_PGA("AB Amp", ALC5632_PWR_MANAG_ADD2, 15, 0, NULL, 0),
388SND_SOC_DAPM_MUX("AB-D Amp Mux", ALC5632_PWR_MANAG_ADD1, 10, 0,
389 &alc5632_amp_mux_controls),
390
391SND_SOC_DAPM_OUTPUT("AUXOUT"),
392SND_SOC_DAPM_OUTPUT("HPL"),
393SND_SOC_DAPM_OUTPUT("HPR"),
394SND_SOC_DAPM_OUTPUT("SPKOUT"),
395SND_SOC_DAPM_OUTPUT("SPKOUTN"),
396SND_SOC_DAPM_INPUT("LINEINL"),
397SND_SOC_DAPM_INPUT("LINEINR"),
398SND_SOC_DAPM_INPUT("PHONEP"),
399SND_SOC_DAPM_INPUT("PHONEN"),
400SND_SOC_DAPM_INPUT("MIC1"),
401SND_SOC_DAPM_INPUT("MIC2"),
402SND_SOC_DAPM_VMID("Vmid"),
403};
404
405
406static const struct snd_soc_dapm_route alc5632_dapm_routes[] = {
407 /* virtual mixer - mixes left & right channels */
408 {"I2S Mix", NULL, "Left DAC"},
409 {"I2S Mix", NULL, "Right DAC"},
410 {"Line Mix", NULL, "Right LineIn"},
411 {"Line Mix", NULL, "Left LineIn"},
412 {"Phone Mix", NULL, "Phone"},
413 {"Phone Mix", NULL, "Phone ADMix"},
414 {"AUXOUT", NULL, "Aux Out"},
415
416 /* DAC */
417 {"DAC Right Channel", NULL, "I2S Mix"},
418 {"DAC Left Channel", NULL, "I2S Mix"},
419
420 /* HP mixer */
421 {"HPL Mix", "ADC2HP_L Playback Switch", "Left Capture Mix"},
422 {"HPL Mix", NULL, "HP Mix"},
423 {"HPR Mix", "ADC2HP_R Playback Switch", "Right Capture Mix"},
424 {"HPR Mix", NULL, "HP Mix"},
425 {"HP Mix", "LI2HP Playback Switch", "Line Mix"},
426 {"HP Mix", "PHONE2HP Playback Switch", "Phone Mix"},
427 {"HP Mix", "MIC12HP Playback Switch", "MIC1 PGA"},
428 {"HP Mix", "MIC22HP Playback Switch", "MIC2 PGA"},
429
430 {"HPR Mix", "DACR2HP Playback Switch", "DAC Right Channel"},
431 {"HPL Mix", "DACL2HP Playback Switch", "DAC Left Channel"},
432
433 /* speaker mixer */
434 {"Speaker Mix", "LI2SPK Playback Switch", "Line Mix"},
435 {"Speaker Mix", "PHONE2SPK Playback Switch", "Phone Mix"},
436 {"Speaker Mix", "MIC12SPK Playback Switch", "MIC1 PGA"},
437 {"Speaker Mix", "MIC22SPK Playback Switch", "MIC2 PGA"},
438 {"Speaker Mix", "DAC2SPK Playback Switch", "DAC Left Channel"},
439
440
441
442 /* mono mixer */
443 {"Mono Mix", "ADC2MONO_L Playback Switch", "Left Capture Mix"},
444 {"Mono Mix", "ADC2MONO_R Playback Switch", "Right Capture Mix"},
445 {"Mono Mix", "LI2MONO Playback Switch", "Line Mix"},
446 {"Mono Mix", "VOICE2MONO Playback Switch", "Phone Mix"},
447 {"Mono Mix", "MIC12MONO Playback Switch", "MIC1 PGA"},
448 {"Mono Mix", "MIC22MONO Playback Switch", "MIC2 PGA"},
449 {"Mono Mix", "DAC2MONO Playback Switch", "DAC Left Channel"},
450
451 /* Left record mixer */
452 {"Left Capture Mix", "LineInL Capture Switch", "LINEINL"},
453 {"Left Capture Mix", "Left Phone Capture Switch", "PHONEN"},
454 {"Left Capture Mix", "Mic1 Capture Switch", "MIC1 Pre Amp"},
455 {"Left Capture Mix", "Mic2 Capture Switch", "MIC2 Pre Amp"},
456 {"Left Capture Mix", "HPMixerL Capture Switch", "HPL Mix"},
457 {"Left Capture Mix", "SPKMixer Capture Switch", "Speaker Mix"},
458 {"Left Capture Mix", "MonoMixer Capture Switch", "Mono Mix"},
459
460 /*Right record mixer */
461 {"Right Capture Mix", "LineInR Capture Switch", "LINEINR"},
462 {"Right Capture Mix", "Right Phone Capture Switch", "PHONEP"},
463 {"Right Capture Mix", "Mic1 Capture Switch", "MIC1 Pre Amp"},
464 {"Right Capture Mix", "Mic2 Capture Switch", "MIC2 Pre Amp"},
465 {"Right Capture Mix", "HPMixerR Capture Switch", "HPR Mix"},
466 {"Right Capture Mix", "SPKMixer Capture Switch", "Speaker Mix"},
467 {"Right Capture Mix", "MonoMixer Capture Switch", "Mono Mix"},
468
469 /* headphone left mux */
470 {"Left Headphone Mux", "HP Left Mix", "HPL Mix"},
471 {"Left Headphone Mux", "Vmid", "Vmid"},
472
473 /* headphone right mux */
474 {"Right Headphone Mux", "HP Right Mix", "HPR Mix"},
475 {"Right Headphone Mux", "Vmid", "Vmid"},
476
477 /* speaker out mux */
478 {"SpeakerOut Mux", "Vmid", "Vmid"},
479 {"SpeakerOut Mux", "HPOut Mix", "HPOut Mix"},
480 {"SpeakerOut Mux", "Speaker Mix", "Speaker Mix"},
481 {"SpeakerOut Mux", "Mono Mix", "Mono Mix"},
482
483 /* Mono/Aux Out mux */
484 {"AuxOut Mux", "Vmid", "Vmid"},
485 {"AuxOut Mux", "HPOut Mix", "HPOut Mix"},
486 {"AuxOut Mux", "Speaker Mix", "Speaker Mix"},
487 {"AuxOut Mux", "Mono Mix", "Mono Mix"},
488
489 /* output pga */
490 {"HPL", NULL, "Left Headphone"},
491 {"Left Headphone", NULL, "Left Headphone Mux"},
492 {"HPR", NULL, "Right Headphone"},
493 {"Right Headphone", NULL, "Right Headphone Mux"},
494 {"Aux Out", NULL, "AuxOut Mux"},
495
496 /* input pga */
497 {"Left LineIn", NULL, "LINEINL"},
498 {"Right LineIn", NULL, "LINEINR"},
499 {"Phone", NULL, "PHONEP"},
500 {"MIC1 Pre Amp", NULL, "MIC1"},
501 {"MIC2 Pre Amp", NULL, "MIC2"},
502 {"MIC1 PGA", NULL, "MIC1 Pre Amp"},
503 {"MIC2 PGA", NULL, "MIC2 Pre Amp"},
504
505 /* left ADC */
506 {"Left ADC", NULL, "Left Capture Mix"},
507
508 /* right ADC */
509 {"Right ADC", NULL, "Right Capture Mix"},
510
511 {"SpeakerOut N Mux", "RN/-R", "Left Speaker"},
512 {"SpeakerOut N Mux", "RP/+R", "Left Speaker"},
513 {"SpeakerOut N Mux", "LN/-R", "Left Speaker"},
514 {"SpeakerOut N Mux", "Mute", "Vmid"},
515
516 {"SpeakerOut N Mux", "RN/-R", "Right Speaker"},
517 {"SpeakerOut N Mux", "RP/+R", "Right Speaker"},
518 {"SpeakerOut N Mux", "LN/-R", "Right Speaker"},
519 {"SpeakerOut N Mux", "Mute", "Vmid"},
520
521 {"AB Amp", NULL, "SpeakerOut Mux"},
522 {"D Amp", NULL, "SpeakerOut Mux"},
523 {"AB-D Amp Mux", "AB Amp", "AB Amp"},
524 {"AB-D Amp Mux", "D Amp", "D Amp"},
525 {"Left Speaker", NULL, "AB-D Amp Mux"},
526 {"Right Speaker", NULL, "AB-D Amp Mux"},
527
528 {"SPKOUT", NULL, "Left Speaker"},
529 {"SPKOUT", NULL, "Right Speaker"},
530
531 {"SPKOUTN", NULL, "SpeakerOut N Mux"},
532
533};
534
535/* PLL divisors */
536struct _pll_div {
537 u32 pll_in;
538 u32 pll_out;
539 u16 regvalue;
540};
541
542/* Note : pll code from original alc5632 driver. Not sure of how good it is */
543/* usefull only for master mode */
544static const struct _pll_div codec_master_pll_div[] = {
545
546 { 2048000, 8192000, 0x0ea0},
547 { 3686400, 8192000, 0x4e27},
548 { 12000000, 8192000, 0x456b},
549 { 13000000, 8192000, 0x495f},
550 { 13100000, 8192000, 0x0320},
551 { 2048000, 11289600, 0xf637},
552 { 3686400, 11289600, 0x2f22},
553 { 12000000, 11289600, 0x3e2f},
554 { 13000000, 11289600, 0x4d5b},
555 { 13100000, 11289600, 0x363b},
556 { 2048000, 16384000, 0x1ea0},
557 { 3686400, 16384000, 0x9e27},
558 { 12000000, 16384000, 0x452b},
559 { 13000000, 16384000, 0x542f},
560 { 13100000, 16384000, 0x03a0},
561 { 2048000, 16934400, 0xe625},
562 { 3686400, 16934400, 0x9126},
563 { 12000000, 16934400, 0x4d2c},
564 { 13000000, 16934400, 0x742f},
565 { 13100000, 16934400, 0x3c27},
566 { 2048000, 22579200, 0x2aa0},
567 { 3686400, 22579200, 0x2f20},
568 { 12000000, 22579200, 0x7e2f},
569 { 13000000, 22579200, 0x742f},
570 { 13100000, 22579200, 0x3c27},
571 { 2048000, 24576000, 0x2ea0},
572 { 3686400, 24576000, 0xee27},
573 { 12000000, 24576000, 0x2915},
574 { 13000000, 24576000, 0x772e},
575 { 13100000, 24576000, 0x0d20},
576};
577
578/* FOUT = MCLK*(N+2)/((M+2)*(K+2))
579 N: bit 15:8 (div 2 .. div 257)
580 K: bit 6:4 typical 2
581 M: bit 3:0 (div 2 .. div 17)
582
583 same as for 5623 - thanks!
584*/
585
586static const struct _pll_div codec_slave_pll_div[] = {
587
588 { 1024000, 16384000, 0x3ea0},
589 { 1411200, 22579200, 0x3ea0},
590 { 1536000, 24576000, 0x3ea0},
591 { 2048000, 16384000, 0x1ea0},
592 { 2822400, 22579200, 0x1ea0},
593 { 3072000, 24576000, 0x1ea0},
594
595};
596
597static int alc5632_set_dai_pll(struct snd_soc_dai *codec_dai, int pll_id,
598 int source, unsigned int freq_in, unsigned int freq_out)
599{
600 int i;
601 struct snd_soc_codec *codec = codec_dai->codec;
602 int gbl_clk = 0, pll_div = 0;
603 u16 reg;
604
605 if (pll_id < ALC5632_PLL_FR_MCLK || pll_id > ALC5632_PLL_FR_VBCLK)
606 return -EINVAL;
607
608 /* Disable PLL power */
609 snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD2,
610 ALC5632_PWR_ADD2_PLL1,
611 0);
612 snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD2,
613 ALC5632_PWR_ADD2_PLL2,
614 0);
615
616 /* pll is not used in slave mode */
617 reg = snd_soc_read(codec, ALC5632_DAI_CONTROL);
618 if (reg & ALC5632_DAI_SDP_SLAVE_MODE)
619 return 0;
620
621 if (!freq_in || !freq_out)
622 return 0;
623
624 switch (pll_id) {
625 case ALC5632_PLL_FR_MCLK:
626 for (i = 0; i < ARRAY_SIZE(codec_master_pll_div); i++) {
627 if (codec_master_pll_div[i].pll_in == freq_in
628 && codec_master_pll_div[i].pll_out == freq_out) {
629 /* PLL source from MCLK */
630 pll_div = codec_master_pll_div[i].regvalue;
631 break;
632 }
633 }
634 break;
635 case ALC5632_PLL_FR_BCLK:
636 for (i = 0; i < ARRAY_SIZE(codec_slave_pll_div); i++) {
637 if (codec_slave_pll_div[i].pll_in == freq_in
638 && codec_slave_pll_div[i].pll_out == freq_out) {
639 /* PLL source from Bitclk */
640 gbl_clk = ALC5632_PLL_FR_BCLK;
641 pll_div = codec_slave_pll_div[i].regvalue;
642 break;
643 }
644 }
645 break;
646 case ALC5632_PLL_FR_VBCLK:
647 for (i = 0; i < ARRAY_SIZE(codec_slave_pll_div); i++) {
648 if (codec_slave_pll_div[i].pll_in == freq_in
649 && codec_slave_pll_div[i].pll_out == freq_out) {
650 /* PLL source from voice clock */
651 gbl_clk = ALC5632_PLL_FR_VBCLK;
652 pll_div = codec_slave_pll_div[i].regvalue;
653 break;
654 }
655 }
656 break;
657 default:
658 return -EINVAL;
659 }
660
661 if (!pll_div)
662 return -EINVAL;
663
664 /* choose MCLK/BCLK/VBCLK */
665 snd_soc_write(codec, ALC5632_GPCR2, gbl_clk);
666 /* choose PLL1 clock rate */
667 snd_soc_write(codec, ALC5632_PLL1_CTRL, pll_div);
668 /* enable PLL1 */
669 snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD2,
670 ALC5632_PWR_ADD2_PLL1,
671 ALC5632_PWR_ADD2_PLL1);
672 /* enable PLL2 */
673 snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD2,
674 ALC5632_PWR_ADD2_PLL2,
675 ALC5632_PWR_ADD2_PLL2);
676 /* use PLL1 as main SYSCLK */
677 snd_soc_update_bits(codec, ALC5632_GPCR1,
678 ALC5632_GPCR1_CLK_SYS_SRC_SEL_PLL1,
679 ALC5632_GPCR1_CLK_SYS_SRC_SEL_PLL1);
680
681 return 0;
682}
683
684struct _coeff_div {
685 u16 fs;
686 u16 regvalue;
687};
688
689/* codec hifi mclk (after PLL) clock divider coefficients */
690/* values inspired from column BCLK=32Fs of Appendix A table */
691static const struct _coeff_div coeff_div[] = {
692 {512*1, 0x3075},
693};
694
695static int get_coeff(struct snd_soc_codec *codec, int rate)
696{
697 struct alc5632_priv *alc5632 = snd_soc_codec_get_drvdata(codec);
698 int i;
699
700 for (i = 0; i < ARRAY_SIZE(coeff_div); i++) {
701 if (coeff_div[i].fs * rate == alc5632->sysclk)
702 return i;
703 }
704 return -EINVAL;
705}
706
707/*
708 * Clock after PLL and dividers
709 */
710static int alc5632_set_dai_sysclk(struct snd_soc_dai *codec_dai,
711 int clk_id, unsigned int freq, int dir)
712{
713 struct snd_soc_codec *codec = codec_dai->codec;
714 struct alc5632_priv *alc5632 = snd_soc_codec_get_drvdata(codec);
715
716 switch (freq) {
717 case 8192000:
718 case 11289600:
719 case 12288000:
720 case 16384000:
721 case 16934400:
722 case 18432000:
723 case 22579200:
724 case 24576000:
725 alc5632->sysclk = freq;
726 return 0;
727 }
728 return -EINVAL;
729}
730
731static int alc5632_set_dai_fmt(struct snd_soc_dai *codec_dai,
732 unsigned int fmt)
733{
734 struct snd_soc_codec *codec = codec_dai->codec;
735 u16 iface = 0;
736
737 /* set master/slave audio interface */
738 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
739 case SND_SOC_DAIFMT_CBM_CFM:
740 iface = ALC5632_DAI_SDP_MASTER_MODE;
741 break;
742 case SND_SOC_DAIFMT_CBS_CFS:
743 iface = ALC5632_DAI_SDP_SLAVE_MODE;
744 break;
745 default:
746 return -EINVAL;
747 }
748
749 /* interface format */
750 switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
751 case SND_SOC_DAIFMT_I2S:
752 iface |= ALC5632_DAI_I2S_DF_I2S;
753 break;
754 case SND_SOC_DAIFMT_LEFT_J:
755 iface |= ALC5632_DAI_I2S_DF_LEFT;
756 break;
757 case SND_SOC_DAIFMT_DSP_A:
758 iface |= ALC5632_DAI_I2S_DF_PCM_A;
759 break;
760 case SND_SOC_DAIFMT_DSP_B:
761 iface |= ALC5632_DAI_I2S_DF_PCM_B;
762 break;
763 default:
764 return -EINVAL;
765 }
766
767 /* clock inversion */
768 switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
769 case SND_SOC_DAIFMT_NB_NF:
770 break;
771 case SND_SOC_DAIFMT_IB_IF:
772 iface |= ALC5632_DAI_MAIN_I2S_BCLK_POL_CTRL;
773 break;
774 case SND_SOC_DAIFMT_IB_NF:
775 iface |= ALC5632_DAI_MAIN_I2S_BCLK_POL_CTRL;
776 break;
777 case SND_SOC_DAIFMT_NB_IF:
778 break;
779 default:
780 return -EINVAL;
781 }
782
783 return snd_soc_write(codec, ALC5632_DAI_CONTROL, iface);
784}
785
786static int alc5632_pcm_hw_params(struct snd_pcm_substream *substream,
787 struct snd_pcm_hw_params *params, struct snd_soc_dai *dai)
788{
789 struct snd_soc_pcm_runtime *rtd = substream->private_data;
790 struct snd_soc_codec *codec = rtd->codec;
791 int coeff, rate;
792 u16 iface;
793
794 iface = snd_soc_read(codec, ALC5632_DAI_CONTROL);
795 iface &= ~ALC5632_DAI_I2S_DL_MASK;
796
797 /* bit size */
798 switch (params_format(params)) {
799 case SNDRV_PCM_FORMAT_S16_LE:
800 iface |= ALC5632_DAI_I2S_DL_16;
801 break;
802 case SNDRV_PCM_FORMAT_S20_3LE:
803 iface |= ALC5632_DAI_I2S_DL_20;
804 break;
805 case SNDRV_PCM_FORMAT_S24_LE:
806 iface |= ALC5632_DAI_I2S_DL_24;
807 break;
808 default:
809 return -EINVAL;
810 }
811
812 /* set iface & srate */
813 snd_soc_write(codec, ALC5632_DAI_CONTROL, iface);
814 rate = params_rate(params);
815 coeff = get_coeff(codec, rate);
816 if (coeff < 0)
817 return -EINVAL;
818
819 coeff = coeff_div[coeff].regvalue;
820 snd_soc_write(codec, ALC5632_DAC_CLK_CTRL1, coeff);
821
822 return 0;
823}
824
825static int alc5632_mute(struct snd_soc_dai *dai, int mute)
826{
827 struct snd_soc_codec *codec = dai->codec;
828 u16 hp_mute = ALC5632_MISC_HP_DEPOP_MUTE_L
829 |ALC5632_MISC_HP_DEPOP_MUTE_R;
830 u16 mute_reg = snd_soc_read(codec, ALC5632_MISC_CTRL) & ~hp_mute;
831
832 if (mute)
833 mute_reg |= hp_mute;
834
835 return snd_soc_write(codec, ALC5632_MISC_CTRL, mute_reg);
836}
837
838#define ALC5632_ADD2_POWER_EN (ALC5632_PWR_ADD2_VREF)
839
840#define ALC5632_ADD3_POWER_EN (ALC5632_PWR_ADD3_MIC1_BOOST_AD)
841
842#define ALC5632_ADD1_POWER_EN \
843 (ALC5632_PWR_ADD1_DAC_REF \
844 | ALC5632_PWR_ADD1_SOFTGEN_EN \
845 | ALC5632_PWR_ADD1_HP_OUT_AMP \
846 | ALC5632_PWR_ADD1_HP_OUT_ENH_AMP \
847 | ALC5632_PWR_ADD1_MAIN_BIAS)
848
849static void enable_power_depop(struct snd_soc_codec *codec)
850{
851 snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD1,
852 ALC5632_PWR_ADD1_SOFTGEN_EN,
853 ALC5632_PWR_ADD1_SOFTGEN_EN);
854
855 snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD3,
856 ALC5632_ADD3_POWER_EN,
857 ALC5632_ADD3_POWER_EN);
858
859 snd_soc_update_bits(codec, ALC5632_MISC_CTRL,
860 ALC5632_MISC_HP_DEPOP_MODE2_EN,
861 ALC5632_MISC_HP_DEPOP_MODE2_EN);
862
863 /* "normal" mode: 0 @ 26 */
864 /* set all PR0-7 mixers to 0 */
865 snd_soc_update_bits(codec, ALC5632_PWR_DOWN_CTRL_STATUS,
866 ALC5632_PWR_DOWN_CTRL_STATUS_MASK,
867 0);
868
869 msleep(500);
870
871 snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD2,
872 ALC5632_ADD2_POWER_EN,
873 ALC5632_ADD2_POWER_EN);
874
875 snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD1,
876 ALC5632_ADD1_POWER_EN,
877 ALC5632_ADD1_POWER_EN);
878
879 /* disable HP Depop2 */
880 snd_soc_update_bits(codec, ALC5632_MISC_CTRL,
881 ALC5632_MISC_HP_DEPOP_MODE2_EN,
882 0);
883
884}
885
886static int alc5632_set_bias_level(struct snd_soc_codec *codec,
887 enum snd_soc_bias_level level)
888{
889 switch (level) {
890 case SND_SOC_BIAS_ON:
891 enable_power_depop(codec);
892 break;
893 case SND_SOC_BIAS_PREPARE:
894 break;
895 case SND_SOC_BIAS_STANDBY:
896 /* everything off except vref/vmid, */
897 snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD1,
898 ALC5632_PWR_MANAG_ADD1_MASK,
899 ALC5632_PWR_ADD1_MAIN_BIAS);
900 snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD2,
901 ALC5632_PWR_MANAG_ADD2_MASK,
902 ALC5632_PWR_ADD2_VREF);
903 /* "normal" mode: 0 @ 26 */
904 snd_soc_update_bits(codec, ALC5632_PWR_DOWN_CTRL_STATUS,
905 ALC5632_PWR_DOWN_CTRL_STATUS_MASK,
906 0xffff ^ (ALC5632_PWR_VREF_PR3
907 | ALC5632_PWR_VREF_PR2));
908 break;
909 case SND_SOC_BIAS_OFF:
910 /* everything off, dac mute, inactive */
911 snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD2,
912 ALC5632_PWR_MANAG_ADD2_MASK, 0);
913 snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD3,
914 ALC5632_PWR_MANAG_ADD3_MASK, 0);
915 snd_soc_update_bits(codec, ALC5632_PWR_MANAG_ADD1,
916 ALC5632_PWR_MANAG_ADD1_MASK, 0);
917 break;
918 }
919 codec->dapm.bias_level = level;
920 return 0;
921}
922
923#define ALC5632_FORMATS (SNDRV_PCM_FMTBIT_S16_LE \
924 | SNDRV_PCM_FMTBIT_S24_LE \
925 | SNDRV_PCM_FMTBIT_S32_LE)
926
927static const struct snd_soc_dai_ops alc5632_dai_ops = {
928 .hw_params = alc5632_pcm_hw_params,
929 .digital_mute = alc5632_mute,
930 .set_fmt = alc5632_set_dai_fmt,
931 .set_sysclk = alc5632_set_dai_sysclk,
932 .set_pll = alc5632_set_dai_pll,
933};
934
935static struct snd_soc_dai_driver alc5632_dai = {
936 .name = "alc5632-hifi",
937 .playback = {
938 .stream_name = "HiFi Playback",
939 .channels_min = 1,
940 .channels_max = 2,
941 .rate_min = 8000,
942 .rate_max = 48000,
943 .rates = SNDRV_PCM_RATE_8000_48000,
944 .formats = ALC5632_FORMATS,},
945 .capture = {
946 .stream_name = "HiFi Capture",
947 .channels_min = 1,
948 .channels_max = 2,
949 .rate_min = 8000,
950 .rate_max = 48000,
951 .rates = SNDRV_PCM_RATE_8000_48000,
952 .formats = ALC5632_FORMATS,},
953
954 .ops = &alc5632_dai_ops,
955 .symmetric_rates = 1,
956};
957
958#ifdef CONFIG_PM
959static int alc5632_suspend(struct snd_soc_codec *codec)
960{
961 alc5632_set_bias_level(codec, SND_SOC_BIAS_OFF);
962 return 0;
963}
964
965static int alc5632_resume(struct snd_soc_codec *codec)
966{
967 struct alc5632_priv *alc5632 = snd_soc_codec_get_drvdata(codec);
968
969 regcache_sync(alc5632->regmap);
970
971 alc5632_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
972 return 0;
973}
974#else
975#define alc5632_suspend NULL
976#define alc5632_resume NULL
977#endif
978
979static int alc5632_probe(struct snd_soc_codec *codec)
980{
981 struct alc5632_priv *alc5632 = snd_soc_codec_get_drvdata(codec);
982 int ret;
983
984 codec->control_data = alc5632->regmap;
985
986 ret = snd_soc_codec_set_cache_io(codec, 8, 16, SND_SOC_REGMAP);
987 if (ret != 0) {
988 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
989 return ret;
990 }
991
992 /* power on device */
993 alc5632_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
994
995 switch (alc5632->id) {
996 case 0x5c:
997 snd_soc_add_controls(codec, alc5632_vol_snd_controls,
998 ARRAY_SIZE(alc5632_vol_snd_controls));
999 break;
1000 default:
1001 return -EINVAL;
1002 }
1003
1004 return ret;
1005}
1006
1007/* power down chip */
1008static int alc5632_remove(struct snd_soc_codec *codec)
1009{
1010 alc5632_set_bias_level(codec, SND_SOC_BIAS_OFF);
1011 return 0;
1012}
1013
1014static struct snd_soc_codec_driver soc_codec_device_alc5632 = {
1015 .probe = alc5632_probe,
1016 .remove = alc5632_remove,
1017 .suspend = alc5632_suspend,
1018 .resume = alc5632_resume,
1019 .set_bias_level = alc5632_set_bias_level,
1020 .controls = alc5632_snd_controls,
1021 .num_controls = ARRAY_SIZE(alc5632_snd_controls),
1022 .dapm_widgets = alc5632_dapm_widgets,
1023 .num_dapm_widgets = ARRAY_SIZE(alc5632_dapm_widgets),
1024 .dapm_routes = alc5632_dapm_routes,
1025 .num_dapm_routes = ARRAY_SIZE(alc5632_dapm_routes),
1026};
1027
1028static struct regmap_config alc5632_regmap = {
1029 .reg_bits = 8,
1030 .val_bits = 16,
1031
1032 .max_register = ALC5632_MAX_REGISTER,
1033 .reg_defaults = alc5632_reg_defaults,
1034 .num_reg_defaults = ARRAY_SIZE(alc5632_reg_defaults),
1035 .volatile_reg = alc5632_volatile_register,
1036 .cache_type = REGCACHE_RBTREE,
1037};
1038
1039/*
1040 * alc5632 2 wire address is determined by A1 pin
1041 * state during powerup.
1042 * low = 0x1a
1043 * high = 0x1b
1044 */
1045static __devinit int alc5632_i2c_probe(struct i2c_client *client,
1046 const struct i2c_device_id *id)
1047{
1048 struct alc5632_priv *alc5632;
1049 int ret, ret1, ret2;
1050 unsigned int vid1, vid2;
1051
1052 alc5632 = devm_kzalloc(&client->dev,
1053 sizeof(struct alc5632_priv), GFP_KERNEL);
1054 if (alc5632 == NULL)
1055 return -ENOMEM;
1056
1057 i2c_set_clientdata(client, alc5632);
1058
1059 alc5632->regmap = regmap_init_i2c(client, &alc5632_regmap);
1060 if (IS_ERR(alc5632->regmap)) {
1061 ret = PTR_ERR(alc5632->regmap);
1062 dev_err(&client->dev, "regmap_init() failed: %d\n", ret);
1063 return ret;
1064 }
1065
1066 ret1 = regmap_read(alc5632->regmap, ALC5632_VENDOR_ID1, &vid1);
1067 ret2 = regmap_read(alc5632->regmap, ALC5632_VENDOR_ID2, &vid2);
1068 if (ret1 != 0 || ret2 != 0) {
1069 dev_err(&client->dev,
1070 "Failed to read chip ID: ret1=%d, ret2=%d\n", ret1, ret2);
1071 regmap_exit(alc5632->regmap);
1072 return -EIO;
1073 }
1074
1075 vid2 >>= 8;
1076
1077 if ((vid1 != 0x10EC) || (vid2 != id->driver_data)) {
1078 dev_err(&client->dev,
1079 "Device is not a ALC5632: VID1=0x%x, VID2=0x%x\n", vid1, vid2);
1080 regmap_exit(alc5632->regmap);
1081 return -EINVAL;
1082 }
1083
1084 ret = alc5632_reset(alc5632->regmap);
1085 if (ret < 0) {
1086 dev_err(&client->dev, "Failed to issue reset\n");
1087 regmap_exit(alc5632->regmap);
1088 return ret;
1089 }
1090
1091 alc5632->id = vid2;
1092 switch (alc5632->id) {
1093 case 0x5c:
1094 alc5632_dai.name = "alc5632-hifi";
1095 break;
1096 default:
1097 return -EINVAL;
1098 }
1099
1100 ret = snd_soc_register_codec(&client->dev,
1101 &soc_codec_device_alc5632, &alc5632_dai, 1);
1102
1103 if (ret < 0) {
1104 dev_err(&client->dev, "Failed to register codec: %d\n", ret);
1105 regmap_exit(alc5632->regmap);
1106 return ret;
1107 }
1108
1109 return ret;
1110}
1111
1112static int alc5632_i2c_remove(struct i2c_client *client)
1113{
1114 struct alc5632_priv *alc5632 = i2c_get_clientdata(client);
1115 snd_soc_unregister_codec(&client->dev);
1116 regmap_exit(alc5632->regmap);
1117 return 0;
1118}
1119
1120static const struct i2c_device_id alc5632_i2c_table[] = {
1121 {"alc5632", 0x5c},
1122 {}
1123};
1124MODULE_DEVICE_TABLE(i2c, alc5632_i2c_table);
1125
1126/* i2c codec control layer */
1127static struct i2c_driver alc5632_i2c_driver = {
1128 .driver = {
1129 .name = "alc5632",
1130 .owner = THIS_MODULE,
1131 },
1132 .probe = alc5632_i2c_probe,
1133 .remove = __devexit_p(alc5632_i2c_remove),
1134 .id_table = alc5632_i2c_table,
1135};
1136
1137static int __init alc5632_modinit(void)
1138{
1139 int ret;
1140
1141 ret = i2c_add_driver(&alc5632_i2c_driver);
1142 if (ret != 0) {
1143 printk(KERN_ERR "%s: can't add i2c driver", __func__);
1144 return ret;
1145 }
1146
1147 return ret;
1148}
1149module_init(alc5632_modinit);
1150
1151static void __exit alc5632_modexit(void)
1152{
1153 i2c_del_driver(&alc5632_i2c_driver);
1154}
1155module_exit(alc5632_modexit);
1156
1157MODULE_DESCRIPTION("ASoC ALC5632 driver");
1158MODULE_AUTHOR("Leon Romanovsky <leon@leon.nu>");
1159MODULE_LICENSE("GPL");
diff --git a/sound/soc/codecs/alc5632.h b/sound/soc/codecs/alc5632.h
new file mode 100644
index 00000000000..357651ec074
--- /dev/null
+++ b/sound/soc/codecs/alc5632.h
@@ -0,0 +1,251 @@
1/*
2* alc5632.h -- ALC5632 ALSA SoC Audio Codec
3*
4* Copyright (C) 2011 The AC100 Kernel Team <ac100@lists.lauchpad.net>
5*
6* Authors: Leon Romanovsky <leon@leon.nu>
7* Andrey Danin <danindrey@mail.ru>
8* Ilya Petrov <ilya.muromec@gmail.com>
9* Marc Dietrich <marvin24@gmx.de>
10*
11* Based on alc5623.h by Arnaud Patard
12*
13* This program is free software; you can redistribute it and/or modify
14* it under the terms of the GNU General Public License version 2 as
15* published by the Free Software Foundation.
16*/
17
18#ifndef _ALC5632_H
19#define _ALC5632_H
20
21#define ALC5632_RESET 0x00
22/* speaker output vol 2 2 */
23/* line output vol 4 2 */
24/* HP output vol 4 0 4 */
25#define ALC5632_SPK_OUT_VOL 0x02 /* spe out vol */
26#define ALC5632_SPK_OUT_VOL_STEP 1.5
27#define ALC5632_HP_OUT_VOL 0x04 /* hp out vol */
28#define ALC5632_AUX_OUT_VOL 0x06 /* aux out vol */
29#define ALC5632_PHONE_IN_VOL 0x08 /* phone in vol */
30#define ALC5632_LINE_IN_VOL 0x0A /* line in vol */
31#define ALC5632_STEREO_DAC_IN_VOL 0x0C /* stereo dac in vol */
32#define ALC5632_MIC_VOL 0x0E /* mic in vol */
33/* stero dac/mic routing */
34#define ALC5632_MIC_ROUTING_CTRL 0x10
35#define ALC5632_MIC_ROUTE_MONOMIX (1 << 0)
36#define ALC5632_MIC_ROUTE_SPK (1 << 1)
37#define ALC5632_MIC_ROUTE_HP (1 << 2)
38
39#define ALC5632_ADC_REC_GAIN 0x12 /* rec gain */
40#define ALC5632_ADC_REC_GAIN_RANGE 0x1F1F
41#define ALC5632_ADC_REC_GAIN_BASE (-16.5)
42#define ALC5632_ADC_REC_GAIN_STEP 1.5
43
44#define ALC5632_ADC_REC_MIXER 0x14 /* mixer control */
45#define ALC5632_ADC_REC_MIC1 (1 << 6)
46#define ALC5632_ADC_REC_MIC2 (1 << 5)
47#define ALC5632_ADC_REC_LINE_IN (1 << 4)
48#define ALC5632_ADC_REC_AUX (1 << 3)
49#define ALC5632_ADC_REC_HP (1 << 2)
50#define ALC5632_ADC_REC_SPK (1 << 1)
51#define ALC5632_ADC_REC_MONOMIX (1 << 0)
52
53#define ALC5632_VOICE_DAC_VOL 0x18 /* voice dac vol */
54/* ALC5632_OUTPUT_MIXER_CTRL : */
55/* same remark as for reg 2 line vs speaker */
56#define ALC5632_OUTPUT_MIXER_CTRL 0x1C /* out mix ctrl */
57#define ALC5632_OUTPUT_MIXER_RP (1 << 14)
58#define ALC5632_OUTPUT_MIXER_WEEK (1 << 12)
59#define ALC5632_OUTPUT_MIXER_HP (1 << 10)
60#define ALC5632_OUTPUT_MIXER_AUX_SPK (2 << 6)
61#define ALC5632_OUTPUT_MIXER_AUX_HP_LR (1 << 6)
62#define ALC5632_OUTPUT_MIXER_HP_R (1 << 8)
63#define ALC5632_OUTPUT_MIXER_HP_L (1 << 9)
64
65#define ALC5632_MIC_CTRL 0x22 /* mic phone ctrl */
66#define ALC5632_MIC_BOOST_BYPASS 0
67#define ALC5632_MIC_BOOST_20DB 1
68#define ALC5632_MIC_BOOST_30DB 2
69#define ALC5632_MIC_BOOST_40DB 3
70
71#define ALC5632_DIGI_BOOST_CTRL 0x24 /* digi mic / bost ctl */
72#define ALC5632_MIC_BOOST_RANGE 7
73#define ALC5632_MIC_BOOST_STEP 6
74#define ALC5632_PWR_DOWN_CTRL_STATUS 0x26
75#define ALC5632_PWR_DOWN_CTRL_STATUS_MASK 0xEF00
76#define ALC5632_PWR_VREF_PR3 (1 << 11)
77#define ALC5632_PWR_VREF_PR2 (1 << 10)
78#define ALC5632_PWR_VREF_STATUS (1 << 3)
79#define ALC5632_PWR_AMIX_STATUS (1 << 2)
80#define ALC5632_PWR_DAC_STATUS (1 << 1)
81#define ALC5632_PWR_ADC_STATUS (1 << 0)
82/* stereo/voice DAC / stereo adc func ctrl */
83#define ALC5632_DAC_FUNC_SELECT 0x2E
84
85/* Main serial data port ctrl (i2s) */
86#define ALC5632_DAI_CONTROL 0x34
87
88#define ALC5632_DAI_SDP_MASTER_MODE (0 << 15)
89#define ALC5632_DAI_SDP_SLAVE_MODE (1 << 15)
90#define ALC5632_DAI_SADLRCK_MODE (1 << 14)
91/* 0:voice, 1:main */
92#define ALC5632_DAI_MAIN_I2S_SYSCLK_SEL (1 << 8)
93#define ALC5632_DAI_MAIN_I2S_BCLK_POL_CTRL (1 << 7)
94/* 0:normal, 1:invert */
95#define ALC5632_DAI_MAIN_I2S_LRCK_INV (1 << 6)
96#define ALC5632_DAI_I2S_DL_MASK (3 << 2)
97#define ALC5632_DAI_I2S_DL_8 (3 << 2)
98#define ALC5632_DAI_I2S_DL_24 (2 << 2)
99#define ALC5632_DAI_I2S_DL_20 (1 << 2)
100#define ALC5632_DAI_I2S_DL_16 (0 << 2)
101#define ALC5632_DAI_I2S_DF_MASK (3 << 0)
102#define ALC5632_DAI_I2S_DF_PCM_B (3 << 0)
103#define ALC5632_DAI_I2S_DF_PCM_A (2 << 0)
104#define ALC5632_DAI_I2S_DF_LEFT (1 << 0)
105#define ALC5632_DAI_I2S_DF_I2S (0 << 0)
106/* extend serial data port control (VoDAC_i2c/pcm) */
107#define ALC5632_DAI_CONTROL2 0x36
108/* 0:gpio func, 1:voice pcm */
109#define ALC5632_DAI_VOICE_PCM_ENABLE (1 << 15)
110/* 0:master, 1:slave */
111#define ALC5632_DAI_VOICE_MODE_SEL (1 << 14)
112/* 0:disable, 1:enable */
113#define ALC5632_DAI_HPF_CLK_CTRL (1 << 13)
114/* 0:main, 1:voice */
115#define ALC5632_DAI_VOICE_I2S_SYSCLK_SEL (1 << 8)
116/* 0:normal, 1:invert */
117#define ALC5632_DAI_VOICE_VBCLK_SYSCLK_SEL (1 << 7)
118/* 0:normal, 1:invert */
119#define ALC5632_DAI_VOICE_I2S_LR_INV (1 << 6)
120#define ALC5632_DAI_VOICE_DL_MASK (3 << 2)
121#define ALC5632_DAI_VOICE_DL_16 (0 << 2)
122#define ALC5632_DAI_VOICE_DL_20 (1 << 2)
123#define ALC5632_DAI_VOICE_DL_24 (2 << 2)
124#define ALC5632_DAI_VOICE_DL_8 (3 << 2)
125#define ALC5632_DAI_VOICE_DF_MASK (3 << 0)
126#define ALC5632_DAI_VOICE_DF_I2S (0 << 0)
127#define ALC5632_DAI_VOICE_DF_LEFT (1 << 0)
128#define ALC5632_DAI_VOICE_DF_PCM_A (2 << 0)
129#define ALC5632_DAI_VOICE_DF_PCM_B (3 << 0)
130
131#define ALC5632_PWR_MANAG_ADD1 0x3A
132#define ALC5632_PWR_MANAG_ADD1_MASK 0xEFFF
133#define ALC5632_PWR_ADD1_DAC_L_EN (1 << 15)
134#define ALC5632_PWR_ADD1_DAC_R_EN (1 << 14)
135#define ALC5632_PWR_ADD1_ZERO_CROSS (1 << 13)
136#define ALC5632_PWR_ADD1_MAIN_I2S_EN (1 << 11)
137#define ALC5632_PWR_ADD1_SPK_AMP_EN (1 << 10)
138#define ALC5632_PWR_ADD1_HP_OUT_AMP (1 << 9)
139#define ALC5632_PWR_ADD1_HP_OUT_ENH_AMP (1 << 8)
140#define ALC5632_PWR_ADD1_VOICE_DAC_MIX (1 << 7)
141#define ALC5632_PWR_ADD1_SOFTGEN_EN (1 << 6)
142#define ALC5632_PWR_ADD1_MIC1_SHORT_CURR (1 << 5)
143#define ALC5632_PWR_ADD1_MIC2_SHORT_CURR (1 << 4)
144#define ALC5632_PWR_ADD1_MIC1_EN (1 << 3)
145#define ALC5632_PWR_ADD1_MIC2_EN (1 << 2)
146#define ALC5632_PWR_ADD1_MAIN_BIAS (1 << 1)
147#define ALC5632_PWR_ADD1_DAC_REF (1 << 0)
148
149#define ALC5632_PWR_MANAG_ADD2 0x3C
150#define ALC5632_PWR_MANAG_ADD2_MASK 0x7FFF
151#define ALC5632_PWR_ADD2_PLL1 (1 << 15)
152#define ALC5632_PWR_ADD2_PLL2 (1 << 14)
153#define ALC5632_PWR_ADD2_VREF (1 << 13)
154#define ALC5632_PWR_ADD2_OVT_DET (1 << 12)
155#define ALC5632_PWR_ADD2_VOICE_DAC (1 << 10)
156#define ALC5632_PWR_ADD2_L_DAC_CLK (1 << 9)
157#define ALC5632_PWR_ADD2_R_DAC_CLK (1 << 8)
158#define ALC5632_PWR_ADD2_L_ADC_CLK_GAIN (1 << 7)
159#define ALC5632_PWR_ADD2_R_ADC_CLK_GAIN (1 << 6)
160#define ALC5632_PWR_ADD2_L_HP_MIXER (1 << 5)
161#define ALC5632_PWR_ADD2_R_HP_MIXER (1 << 4)
162#define ALC5632_PWR_ADD2_SPK_MIXER (1 << 3)
163#define ALC5632_PWR_ADD2_MONO_MIXER (1 << 2)
164#define ALC5632_PWR_ADD2_L_ADC_REC_MIXER (1 << 1)
165#define ALC5632_PWR_ADD2_R_ADC_REC_MIXER (1 << 0)
166
167#define ALC5632_PWR_MANAG_ADD3 0x3E
168#define ALC5632_PWR_MANAG_ADD3_MASK 0x7CFF
169#define ALC5632_PWR_ADD3_AUXOUT_VOL (1 << 14)
170#define ALC5632_PWR_ADD3_SPK_L_OUT (1 << 13)
171#define ALC5632_PWR_ADD3_SPK_R_OUT (1 << 12)
172#define ALC5632_PWR_ADD3_HP_L_OUT_VOL (1 << 11)
173#define ALC5632_PWR_ADD3_HP_R_OUT_VOL (1 << 10)
174#define ALC5632_PWR_ADD3_LINEIN_L_VOL (1 << 7)
175#define ALC5632_PWR_ADD3_LINEIN_R_VOL (1 << 6)
176#define ALC5632_PWR_ADD3_AUXIN_VOL (1 << 5)
177#define ALC5632_PWR_ADD3_AUXIN_MIX (1 << 4)
178#define ALC5632_PWR_ADD3_MIC1_VOL (1 << 3)
179#define ALC5632_PWR_ADD3_MIC2_VOL (1 << 2)
180#define ALC5632_PWR_ADD3_MIC1_BOOST_AD (1 << 1)
181#define ALC5632_PWR_ADD3_MIC2_BOOST_AD (1 << 0)
182
183#define ALC5632_GPCR1 0x40
184#define ALC5632_GPCR1_CLK_SYS_SRC_SEL_PLL1 (1 << 15)
185#define ALC5632_GPCR1_CLK_SYS_SRC_SEL_MCLK (0 << 15)
186#define ALC5632_GPCR1_DAC_HI_FLT_EN (1 << 10)
187#define ALC5632_GPCR1_SPK_AMP_CTRL (7 << 1)
188#define ALC5632_GPCR1_VDD_100 (5 << 1)
189#define ALC5632_GPCR1_VDD_125 (4 << 1)
190#define ALC5632_GPCR1_VDD_150 (3 << 1)
191#define ALC5632_GPCR1_VDD_175 (2 << 1)
192#define ALC5632_GPCR1_VDD_200 (1 << 1)
193#define ALC5632_GPCR1_VDD_225 (0 << 1)
194
195#define ALC5632_GPCR2 0x42
196#define ALC5632_GPCR2_PLL1_SOUR_SEL (3 << 12)
197#define ALC5632_PLL_FR_MCLK (0 << 12)
198#define ALC5632_PLL_FR_BCLK (2 << 12)
199#define ALC5632_PLL_FR_VBCLK (3 << 12)
200#define ALC5632_GPCR2_CLK_PLL_PRE_DIV1 (0 << 0)
201
202#define ALC5632_PLL1_CTRL 0x44
203#define ALC5632_PLL1_CTRL_N_VAL(n) (((n) & 0x0f) << 8)
204#define ALC5632_PLL1_M_BYPASS (1 << 7)
205#define ALC5632_PLL1_CTRL_K_VAL(k) (((k) & 0x07) << 4)
206#define ALC5632_PLL1_CTRL_M_VAL(m) (((m) & 0x0f) << 0)
207
208#define ALC5632_PLL2_CTRL 0x46
209#define ALC5632_PLL2_EN (1 << 15)
210#define ALC5632_PLL2_RATIO (0 << 15)
211
212#define ALC5632_GPIO_PIN_CONFIG 0x4C
213#define ALC5632_GPIO_PIN_POLARITY 0x4E
214#define ALC5632_GPIO_PIN_STICKY 0x50
215#define ALC5632_GPIO_PIN_WAKEUP 0x52
216#define ALC5632_GPIO_PIN_STATUS 0x54
217#define ALC5632_GPIO_PIN_SHARING 0x56
218#define ALC5632_OVER_CURR_STATUS 0x58
219#define ALC5632_SOFTVOL_CTRL 0x5A
220#define ALC5632_GPIO_OUPUT_PIN_CTRL 0x5C
221
222#define ALC5632_MISC_CTRL 0x5E
223#define ALC5632_MISC_DISABLE_FAST_VREG (1 << 15)
224#define ALC5632_MISC_AVC_TRGT_SEL (3 << 12)
225#define ALC5632_MISC_AVC_TRGT_RIGHT (1 << 12)
226#define ALC5632_MISC_AVC_TRGT_LEFT (2 << 12)
227#define ALC5632_MISC_AVC_TRGT_BOTH (3 << 12)
228#define ALC5632_MISC_HP_DEPOP_MODE1_EN (1 << 9)
229#define ALC5632_MISC_HP_DEPOP_MODE2_EN (1 << 8)
230#define ALC5632_MISC_HP_DEPOP_MUTE_L (1 << 7)
231#define ALC5632_MISC_HP_DEPOP_MUTE_R (1 << 6)
232#define ALC5632_MISC_HP_DEPOP_MUTE (1 << 5)
233#define ALC5632_MISC_GPIO_WAKEUP_CTRL (1 << 1)
234#define ALC5632_MISC_IRQOUT_INV_CTRL (1 << 0)
235
236#define ALC5632_DAC_CLK_CTRL1 0x60
237#define ALC5632_DAC_CLK_CTRL2 0x62
238#define ALC5632_DAC_CLK_CTRL2_DIV1_2 (1 << 0)
239#define ALC5632_VOICE_DAC_PCM_CLK_CTRL1 0x64
240#define ALC5632_PSEUDO_SPATIAL_CTRL 0x68
241#define ALC5632_HID_CTRL_INDEX 0x6A
242#define ALC5632_HID_CTRL_DATA 0x6C
243#define ALC5632_EQ_CTRL 0x6E
244
245/* undocumented */
246#define ALC5632_VENDOR_ID1 0x7C
247#define ALC5632_VENDOR_ID2 0x7E
248
249#define ALC5632_MAX_REGISTER 0x7E
250
251#endif
diff --git a/sound/soc/codecs/cq93vc.c b/sound/soc/codecs/cq93vc.c
index 46dbfd067f7..4854b472d5f 100644
--- a/sound/soc/codecs/cq93vc.c
+++ b/sound/soc/codecs/cq93vc.c
@@ -122,7 +122,7 @@ static int cq93vc_set_bias_level(struct snd_soc_codec *codec,
122#define CQ93VC_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000) 122#define CQ93VC_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000)
123#define CQ93VC_FORMATS (SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE) 123#define CQ93VC_FORMATS (SNDRV_PCM_FMTBIT_U8 | SNDRV_PCM_FMTBIT_S16_LE)
124 124
125static struct snd_soc_dai_ops cq93vc_dai_ops = { 125static const struct snd_soc_dai_ops cq93vc_dai_ops = {
126 .digital_mute = cq93vc_mute, 126 .digital_mute = cq93vc_mute,
127 .set_sysclk = cq93vc_set_dai_sysclk, 127 .set_sysclk = cq93vc_set_dai_sysclk,
128}; 128};
@@ -206,17 +206,7 @@ static struct platform_driver cq93vc_codec_driver = {
206 .remove = __devexit_p(cq93vc_platform_remove), 206 .remove = __devexit_p(cq93vc_platform_remove),
207}; 207};
208 208
209static int __init cq93vc_init(void) 209module_platform_driver(cq93vc_codec_driver);
210{
211 return platform_driver_register(&cq93vc_codec_driver);
212}
213module_init(cq93vc_init);
214
215static void __exit cq93vc_exit(void)
216{
217 platform_driver_unregister(&cq93vc_codec_driver);
218}
219module_exit(cq93vc_exit);
220 210
221MODULE_DESCRIPTION("Texas Instruments DaVinci ASoC CQ0093 Voice Codec Driver"); 211MODULE_DESCRIPTION("Texas Instruments DaVinci ASoC CQ0093 Voice Codec Driver");
222MODULE_AUTHOR("Miguel Aguilar"); 212MODULE_AUTHOR("Miguel Aguilar");
diff --git a/sound/soc/codecs/cs4270.c b/sound/soc/codecs/cs4270.c
index 73f46eb459f..055536645da 100644
--- a/sound/soc/codecs/cs4270.c
+++ b/sound/soc/codecs/cs4270.c
@@ -22,7 +22,6 @@
22 */ 22 */
23 23
24#include <linux/module.h> 24#include <linux/module.h>
25#include <linux/platform_device.h>
26#include <linux/slab.h> 25#include <linux/slab.h>
27#include <sound/core.h> 26#include <sound/core.h>
28#include <sound/soc.h> 27#include <sound/soc.h>
@@ -447,7 +446,7 @@ static const struct snd_kcontrol_new cs4270_snd_controls[] = {
447 snd_soc_get_volsw, cs4270_soc_put_mute), 446 snd_soc_get_volsw, cs4270_soc_put_mute),
448}; 447};
449 448
450static struct snd_soc_dai_ops cs4270_dai_ops = { 449static const struct snd_soc_dai_ops cs4270_dai_ops = {
451 .hw_params = cs4270_hw_params, 450 .hw_params = cs4270_hw_params,
452 .set_sysclk = cs4270_set_dai_sysclk, 451 .set_sysclk = cs4270_set_dai_sysclk,
453 .set_fmt = cs4270_set_dai_fmt, 452 .set_fmt = cs4270_set_dai_fmt,
@@ -579,7 +578,7 @@ static int cs4270_remove(struct snd_soc_codec *codec)
579 * and all registers are written back to the hardware when resuming. 578 * and all registers are written back to the hardware when resuming.
580 */ 579 */
581 580
582static int cs4270_soc_suspend(struct snd_soc_codec *codec, pm_message_t mesg) 581static int cs4270_soc_suspend(struct snd_soc_codec *codec)
583{ 582{
584 struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec); 583 struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec);
585 int reg, ret; 584 int reg, ret;
@@ -672,7 +671,8 @@ static int cs4270_i2c_probe(struct i2c_client *i2c_client,
672 i2c_client->addr); 671 i2c_client->addr);
673 dev_info(&i2c_client->dev, "hardware revision %X\n", ret & 0xF); 672 dev_info(&i2c_client->dev, "hardware revision %X\n", ret & 0xF);
674 673
675 cs4270 = kzalloc(sizeof(struct cs4270_private), GFP_KERNEL); 674 cs4270 = devm_kzalloc(&i2c_client->dev, sizeof(struct cs4270_private),
675 GFP_KERNEL);
676 if (!cs4270) { 676 if (!cs4270) {
677 dev_err(&i2c_client->dev, "could not allocate codec\n"); 677 dev_err(&i2c_client->dev, "could not allocate codec\n");
678 return -ENOMEM; 678 return -ENOMEM;
@@ -683,8 +683,6 @@ static int cs4270_i2c_probe(struct i2c_client *i2c_client,
683 683
684 ret = snd_soc_register_codec(&i2c_client->dev, 684 ret = snd_soc_register_codec(&i2c_client->dev,
685 &soc_codec_device_cs4270, &cs4270_dai, 1); 685 &soc_codec_device_cs4270, &cs4270_dai, 1);
686 if (ret < 0)
687 kfree(cs4270);
688 return ret; 686 return ret;
689} 687}
690 688
@@ -697,7 +695,6 @@ static int cs4270_i2c_probe(struct i2c_client *i2c_client,
697static int cs4270_i2c_remove(struct i2c_client *i2c_client) 695static int cs4270_i2c_remove(struct i2c_client *i2c_client)
698{ 696{
699 snd_soc_unregister_codec(&i2c_client->dev); 697 snd_soc_unregister_codec(&i2c_client->dev);
700 kfree(i2c_get_clientdata(i2c_client));
701 return 0; 698 return 0;
702} 699}
703 700
diff --git a/sound/soc/codecs/cs4271.c b/sound/soc/codecs/cs4271.c
index 69fde1506fe..f6fe846b6a6 100644
--- a/sound/soc/codecs/cs4271.c
+++ b/sound/soc/codecs/cs4271.c
@@ -402,7 +402,7 @@ static const struct snd_kcontrol_new cs4271_snd_controls[] = {
402 7, 1, 1), 402 7, 1, 1),
403}; 403};
404 404
405static struct snd_soc_dai_ops cs4271_dai_ops = { 405static const struct snd_soc_dai_ops cs4271_dai_ops = {
406 .hw_params = cs4271_hw_params, 406 .hw_params = cs4271_hw_params,
407 .set_sysclk = cs4271_set_dai_sysclk, 407 .set_sysclk = cs4271_set_dai_sysclk,
408 .set_fmt = cs4271_set_dai_fmt, 408 .set_fmt = cs4271_set_dai_fmt,
@@ -430,7 +430,7 @@ static struct snd_soc_dai_driver cs4271_dai = {
430}; 430};
431 431
432#ifdef CONFIG_PM 432#ifdef CONFIG_PM
433static int cs4271_soc_suspend(struct snd_soc_codec *codec, pm_message_t mesg) 433static int cs4271_soc_suspend(struct snd_soc_codec *codec)
434{ 434{
435 int ret; 435 int ret;
436 /* Set power-down bit */ 436 /* Set power-down bit */
diff --git a/sound/soc/codecs/cs42l51.c b/sound/soc/codecs/cs42l51.c
index 1ee66361f61..a8bf588e874 100644
--- a/sound/soc/codecs/cs42l51.c
+++ b/sound/soc/codecs/cs42l51.c
@@ -22,7 +22,6 @@
22 */ 22 */
23 23
24#include <linux/module.h> 24#include <linux/module.h>
25#include <linux/platform_device.h>
26#include <linux/slab.h> 25#include <linux/slab.h>
27#include <sound/core.h> 26#include <sound/core.h>
28#include <sound/soc.h> 27#include <sound/soc.h>
@@ -175,21 +174,18 @@ static const struct snd_kcontrol_new cs42l51_snd_controls[] = {
175static int cs42l51_pdn_event(struct snd_soc_dapm_widget *w, 174static int cs42l51_pdn_event(struct snd_soc_dapm_widget *w,
176 struct snd_kcontrol *kcontrol, int event) 175 struct snd_kcontrol *kcontrol, int event)
177{ 176{
178 unsigned long value;
179
180 value = snd_soc_read(w->codec, CS42L51_POWER_CTL1);
181 value &= ~CS42L51_POWER_CTL1_PDN;
182
183 switch (event) { 177 switch (event) {
184 case SND_SOC_DAPM_PRE_PMD: 178 case SND_SOC_DAPM_PRE_PMD:
185 value |= CS42L51_POWER_CTL1_PDN; 179 snd_soc_update_bits(w->codec, CS42L51_POWER_CTL1,
180 CS42L51_POWER_CTL1_PDN,
181 CS42L51_POWER_CTL1_PDN);
186 break; 182 break;
187 default: 183 default:
188 case SND_SOC_DAPM_POST_PMD: 184 case SND_SOC_DAPM_POST_PMD:
185 snd_soc_update_bits(w->codec, CS42L51_POWER_CTL1,
186 CS42L51_POWER_CTL1_PDN, 0);
189 break; 187 break;
190 } 188 }
191 snd_soc_update_bits(w->codec, CS42L51_POWER_CTL1,
192 CS42L51_POWER_CTL1_PDN, value);
193 189
194 return 0; 190 return 0;
195} 191}
@@ -486,7 +482,7 @@ static int cs42l51_dai_mute(struct snd_soc_dai *dai, int mute)
486 return snd_soc_write(codec, CS42L51_DAC_OUT_CTL, reg); 482 return snd_soc_write(codec, CS42L51_DAC_OUT_CTL, reg);
487} 483}
488 484
489static struct snd_soc_dai_ops cs42l51_dai_ops = { 485static const struct snd_soc_dai_ops cs42l51_dai_ops = {
490 .hw_params = cs42l51_hw_params, 486 .hw_params = cs42l51_hw_params,
491 .set_sysclk = cs42l51_set_dai_sysclk, 487 .set_sysclk = cs42l51_set_dai_sysclk,
492 .set_fmt = cs42l51_set_dai_fmt, 488 .set_fmt = cs42l51_set_dai_fmt,
@@ -515,7 +511,6 @@ static struct snd_soc_dai_driver cs42l51_dai = {
515static int cs42l51_probe(struct snd_soc_codec *codec) 511static int cs42l51_probe(struct snd_soc_codec *codec)
516{ 512{
517 struct cs42l51_private *cs42l51 = snd_soc_codec_get_drvdata(codec); 513 struct cs42l51_private *cs42l51 = snd_soc_codec_get_drvdata(codec);
518 struct snd_soc_dapm_context *dapm = &codec->dapm;
519 int ret, reg; 514 int ret, reg;
520 515
521 ret = cs42l51_fill_cache(codec); 516 ret = cs42l51_fill_cache(codec);
@@ -543,20 +538,20 @@ static int cs42l51_probe(struct snd_soc_codec *codec)
543 if (ret < 0) 538 if (ret < 0)
544 return ret; 539 return ret;
545 540
546 snd_soc_add_controls(codec, cs42l51_snd_controls,
547 ARRAY_SIZE(cs42l51_snd_controls));
548 snd_soc_dapm_new_controls(dapm, cs42l51_dapm_widgets,
549 ARRAY_SIZE(cs42l51_dapm_widgets));
550 snd_soc_dapm_add_routes(dapm, cs42l51_routes,
551 ARRAY_SIZE(cs42l51_routes));
552
553 return 0; 541 return 0;
554} 542}
555 543
556static struct snd_soc_codec_driver soc_codec_device_cs42l51 = { 544static struct snd_soc_codec_driver soc_codec_device_cs42l51 = {
557 .probe = cs42l51_probe, 545 .probe = cs42l51_probe,
558 .reg_cache_size = CS42L51_NUMREGS + 1, 546 .reg_cache_size = CS42L51_NUMREGS + 1,
559 .reg_word_size = sizeof(u8), 547 .reg_word_size = sizeof(u8),
548
549 .controls = cs42l51_snd_controls,
550 .num_controls = ARRAY_SIZE(cs42l51_snd_controls),
551 .dapm_widgets = cs42l51_dapm_widgets,
552 .num_dapm_widgets = ARRAY_SIZE(cs42l51_dapm_widgets),
553 .dapm_routes = cs42l51_routes,
554 .num_dapm_routes = ARRAY_SIZE(cs42l51_routes),
560}; 555};
561 556
562static int cs42l51_i2c_probe(struct i2c_client *i2c_client, 557static int cs42l51_i2c_probe(struct i2c_client *i2c_client,
@@ -582,7 +577,8 @@ static int cs42l51_i2c_probe(struct i2c_client *i2c_client,
582 dev_info(&i2c_client->dev, "found device cs42l51 rev %d\n", 577 dev_info(&i2c_client->dev, "found device cs42l51 rev %d\n",
583 ret & 7); 578 ret & 7);
584 579
585 cs42l51 = kzalloc(sizeof(struct cs42l51_private), GFP_KERNEL); 580 cs42l51 = devm_kzalloc(&i2c_client->dev, sizeof(struct cs42l51_private),
581 GFP_KERNEL);
586 if (!cs42l51) { 582 if (!cs42l51) {
587 dev_err(&i2c_client->dev, "could not allocate codec\n"); 583 dev_err(&i2c_client->dev, "could not allocate codec\n");
588 return -ENOMEM; 584 return -ENOMEM;
@@ -593,18 +589,13 @@ static int cs42l51_i2c_probe(struct i2c_client *i2c_client,
593 589
594 ret = snd_soc_register_codec(&i2c_client->dev, 590 ret = snd_soc_register_codec(&i2c_client->dev,
595 &soc_codec_device_cs42l51, &cs42l51_dai, 1); 591 &soc_codec_device_cs42l51, &cs42l51_dai, 1);
596 if (ret < 0)
597 kfree(cs42l51);
598error: 592error:
599 return ret; 593 return ret;
600} 594}
601 595
602static int cs42l51_i2c_remove(struct i2c_client *client) 596static int cs42l51_i2c_remove(struct i2c_client *client)
603{ 597{
604 struct cs42l51_private *cs42l51 = i2c_get_clientdata(client);
605
606 snd_soc_unregister_codec(&client->dev); 598 snd_soc_unregister_codec(&client->dev);
607 kfree(cs42l51);
608 return 0; 599 return 0;
609} 600}
610 601
diff --git a/sound/soc/codecs/cs42l73.c b/sound/soc/codecs/cs42l73.c
new file mode 100644
index 00000000000..9d38db8f191
--- /dev/null
+++ b/sound/soc/codecs/cs42l73.c
@@ -0,0 +1,1453 @@
1/*
2 * cs42l73.c -- CS42L73 ALSA Soc Audio driver
3 *
4 * Copyright 2011 Cirrus Logic, Inc.
5 *
6 * Authors: Georgi Vlaev, Nucleus Systems Ltd, <joe@nucleusys.com>
7 * Brian Austin, Cirrus Logic Inc, <brian.austin@cirrus.com>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2 as
11 * published by the Free Software Foundation.
12 *
13 */
14
15#include <linux/module.h>
16#include <linux/moduleparam.h>
17#include <linux/kernel.h>
18#include <linux/init.h>
19#include <linux/delay.h>
20#include <linux/pm.h>
21#include <linux/i2c.h>
22#include <linux/regmap.h>
23#include <linux/slab.h>
24#include <sound/core.h>
25#include <sound/pcm.h>
26#include <sound/pcm_params.h>
27#include <sound/soc.h>
28#include <sound/soc-dapm.h>
29#include <sound/initval.h>
30#include <sound/tlv.h>
31#include "cs42l73.h"
32
33struct sp_config {
34 u8 spc, mmcc, spfs;
35 u32 srate;
36};
37struct cs42l73_private {
38 struct sp_config config[3];
39 struct regmap *regmap;
40 u32 sysclk;
41 u8 mclksel;
42 u32 mclk;
43};
44
45static const struct reg_default cs42l73_reg_defaults[] = {
46 { 1, 0x42 }, /* r01 - Device ID A&B */
47 { 2, 0xA7 }, /* r02 - Device ID C&D */
48 { 3, 0x30 }, /* r03 - Device ID E */
49 { 6, 0xF1 }, /* r06 - Power Ctl 1 */
50 { 7, 0xDF }, /* r07 - Power Ctl 2 */
51 { 8, 0x3F }, /* r08 - Power Ctl 3 */
52 { 9, 0x50 }, /* r09 - Charge Pump Freq */
53 { 10, 0x53 }, /* r0A - Output Load MicBias Short Detect */
54 { 11, 0x00 }, /* r0B - DMIC Master Clock Ctl */
55 { 12, 0x00 }, /* r0C - Aux PCM Ctl */
56 { 13, 0x15 }, /* r0D - Aux PCM Master Clock Ctl */
57 { 14, 0x00 }, /* r0E - Audio PCM Ctl */
58 { 15, 0x15 }, /* r0F - Audio PCM Master Clock Ctl */
59 { 16, 0x00 }, /* r10 - Voice PCM Ctl */
60 { 17, 0x15 }, /* r11 - Voice PCM Master Clock Ctl */
61 { 18, 0x00 }, /* r12 - Voice/Aux Sample Rate */
62 { 19, 0x06 }, /* r13 - Misc I/O Path Ctl */
63 { 20, 0x00 }, /* r14 - ADC Input Path Ctl */
64 { 21, 0x00 }, /* r15 - MICA Preamp, PGA Volume */
65 { 22, 0x00 }, /* r16 - MICB Preamp, PGA Volume */
66 { 23, 0x00 }, /* r17 - Input Path A Digital Volume */
67 { 24, 0x00 }, /* r18 - Input Path B Digital Volume */
68 { 25, 0x00 }, /* r19 - Playback Digital Ctl */
69 { 26, 0x00 }, /* r1A - HP/LO Left Digital Volume */
70 { 27, 0x00 }, /* r1B - HP/LO Right Digital Volume */
71 { 28, 0x00 }, /* r1C - Speakerphone Digital Volume */
72 { 29, 0x00 }, /* r1D - Ear/SPKLO Digital Volume */
73 { 30, 0x00 }, /* r1E - HP Left Analog Volume */
74 { 31, 0x00 }, /* r1F - HP Right Analog Volume */
75 { 32, 0x00 }, /* r20 - LO Left Analog Volume */
76 { 33, 0x00 }, /* r21 - LO Right Analog Volume */
77 { 34, 0x00 }, /* r22 - Stereo Input Path Advisory Volume */
78 { 35, 0x00 }, /* r23 - Aux PCM Input Advisory Volume */
79 { 36, 0x00 }, /* r24 - Audio PCM Input Advisory Volume */
80 { 37, 0x00 }, /* r25 - Voice PCM Input Advisory Volume */
81 { 38, 0x00 }, /* r26 - Limiter Attack Rate HP/LO */
82 { 39, 0x7F }, /* r27 - Limter Ctl, Release Rate HP/LO */
83 { 40, 0x00 }, /* r28 - Limter Threshold HP/LO */
84 { 41, 0x00 }, /* r29 - Limiter Attack Rate Speakerphone */
85 { 42, 0x3F }, /* r2A - Limter Ctl, Release Rate Speakerphone */
86 { 43, 0x00 }, /* r2B - Limter Threshold Speakerphone */
87 { 44, 0x00 }, /* r2C - Limiter Attack Rate Ear/SPKLO */
88 { 45, 0x3F }, /* r2D - Limter Ctl, Release Rate Ear/SPKLO */
89 { 46, 0x00 }, /* r2E - Limter Threshold Ear/SPKLO */
90 { 47, 0x00 }, /* r2F - ALC Enable, Attack Rate Left/Right */
91 { 48, 0x3F }, /* r30 - ALC Release Rate Left/Right */
92 { 49, 0x00 }, /* r31 - ALC Threshold Left/Right */
93 { 50, 0x00 }, /* r32 - Noise Gate Ctl Left/Right */
94 { 51, 0x00 }, /* r33 - ALC/NG Misc Ctl */
95 { 52, 0x18 }, /* r34 - Mixer Ctl */
96 { 53, 0x3F }, /* r35 - HP/LO Left Mixer Input Path Volume */
97 { 54, 0x3F }, /* r36 - HP/LO Right Mixer Input Path Volume */
98 { 55, 0x3F }, /* r37 - HP/LO Left Mixer Aux PCM Volume */
99 { 56, 0x3F }, /* r38 - HP/LO Right Mixer Aux PCM Volume */
100 { 57, 0x3F }, /* r39 - HP/LO Left Mixer Audio PCM Volume */
101 { 58, 0x3F }, /* r3A - HP/LO Right Mixer Audio PCM Volume */
102 { 59, 0x3F }, /* r3B - HP/LO Left Mixer Voice PCM Mono Volume */
103 { 60, 0x3F }, /* r3C - HP/LO Right Mixer Voice PCM Mono Volume */
104 { 61, 0x3F }, /* r3D - Aux PCM Left Mixer Input Path Volume */
105 { 62, 0x3F }, /* r3E - Aux PCM Right Mixer Input Path Volume */
106 { 63, 0x3F }, /* r3F - Aux PCM Left Mixer Volume */
107 { 64, 0x3F }, /* r40 - Aux PCM Left Mixer Volume */
108 { 65, 0x3F }, /* r41 - Aux PCM Left Mixer Audio PCM L Volume */
109 { 66, 0x3F }, /* r42 - Aux PCM Right Mixer Audio PCM R Volume */
110 { 67, 0x3F }, /* r43 - Aux PCM Left Mixer Voice PCM Volume */
111 { 68, 0x3F }, /* r44 - Aux PCM Right Mixer Voice PCM Volume */
112 { 69, 0x3F }, /* r45 - Audio PCM Left Input Path Volume */
113 { 70, 0x3F }, /* r46 - Audio PCM Right Input Path Volume */
114 { 71, 0x3F }, /* r47 - Audio PCM Left Mixer Aux PCM L Volume */
115 { 72, 0x3F }, /* r48 - Audio PCM Right Mixer Aux PCM R Volume */
116 { 73, 0x3F }, /* r49 - Audio PCM Left Mixer Volume */
117 { 74, 0x3F }, /* r4A - Audio PCM Right Mixer Volume */
118 { 75, 0x3F }, /* r4B - Audio PCM Left Mixer Voice PCM Volume */
119 { 76, 0x3F }, /* r4C - Audio PCM Right Mixer Voice PCM Volume */
120 { 77, 0x3F }, /* r4D - Voice PCM Left Input Path Volume */
121 { 78, 0x3F }, /* r4E - Voice PCM Right Input Path Volume */
122 { 79, 0x3F }, /* r4F - Voice PCM Left Mixer Aux PCM L Volume */
123 { 80, 0x3F }, /* r50 - Voice PCM Right Mixer Aux PCM R Volume */
124 { 81, 0x3F }, /* r51 - Voice PCM Left Mixer Audio PCM L Volume */
125 { 82, 0x3F }, /* r52 - Voice PCM Right Mixer Audio PCM R Volume */
126 { 83, 0x3F }, /* r53 - Voice PCM Left Mixer Voice PCM Volume */
127 { 84, 0x3F }, /* r54 - Voice PCM Right Mixer Voice PCM Volume */
128 { 85, 0xAA }, /* r55 - Mono Mixer Ctl */
129 { 86, 0x3F }, /* r56 - SPK Mono Mixer Input Path Volume */
130 { 87, 0x3F }, /* r57 - SPK Mono Mixer Aux PCM Mono/L/R Volume */
131 { 88, 0x3F }, /* r58 - SPK Mono Mixer Audio PCM Mono/L/R Volume */
132 { 89, 0x3F }, /* r59 - SPK Mono Mixer Voice PCM Mono Volume */
133 { 90, 0x3F }, /* r5A - SPKLO Mono Mixer Input Path Mono Volume */
134 { 91, 0x3F }, /* r5B - SPKLO Mono Mixer Aux Mono/L/R Volume */
135 { 92, 0x3F }, /* r5C - SPKLO Mono Mixer Audio Mono/L/R Volume */
136 { 93, 0x3F }, /* r5D - SPKLO Mono Mixer Voice Mono Volume */
137 { 94, 0x00 }, /* r5E - Interrupt Mask 1 */
138 { 95, 0x00 }, /* r5F - Interrupt Mask 2 */
139};
140
141static bool cs42l73_volatile_register(struct device *dev, unsigned int reg)
142{
143 switch (reg) {
144 case CS42L73_IS1:
145 case CS42L73_IS2:
146 return true;
147 default:
148 return false;
149 }
150}
151
152static bool cs42l73_readable_register(struct device *dev, unsigned int reg)
153{
154 switch (reg) {
155 case CS42L73_DEVID_AB:
156 case CS42L73_DEVID_CD:
157 case CS42L73_DEVID_E:
158 case CS42L73_REVID:
159 case CS42L73_PWRCTL1:
160 case CS42L73_PWRCTL2:
161 case CS42L73_PWRCTL3:
162 case CS42L73_CPFCHC:
163 case CS42L73_OLMBMSDC:
164 case CS42L73_DMMCC:
165 case CS42L73_XSPC:
166 case CS42L73_XSPMMCC:
167 case CS42L73_ASPC:
168 case CS42L73_ASPMMCC:
169 case CS42L73_VSPC:
170 case CS42L73_VSPMMCC:
171 case CS42L73_VXSPFS:
172 case CS42L73_MIOPC:
173 case CS42L73_ADCIPC:
174 case CS42L73_MICAPREPGAAVOL:
175 case CS42L73_MICBPREPGABVOL:
176 case CS42L73_IPADVOL:
177 case CS42L73_IPBDVOL:
178 case CS42L73_PBDC:
179 case CS42L73_HLADVOL:
180 case CS42L73_HLBDVOL:
181 case CS42L73_SPKDVOL:
182 case CS42L73_ESLDVOL:
183 case CS42L73_HPAAVOL:
184 case CS42L73_HPBAVOL:
185 case CS42L73_LOAAVOL:
186 case CS42L73_LOBAVOL:
187 case CS42L73_STRINV:
188 case CS42L73_XSPINV:
189 case CS42L73_ASPINV:
190 case CS42L73_VSPINV:
191 case CS42L73_LIMARATEHL:
192 case CS42L73_LIMRRATEHL:
193 case CS42L73_LMAXHL:
194 case CS42L73_LIMARATESPK:
195 case CS42L73_LIMRRATESPK:
196 case CS42L73_LMAXSPK:
197 case CS42L73_LIMARATEESL:
198 case CS42L73_LIMRRATEESL:
199 case CS42L73_LMAXESL:
200 case CS42L73_ALCARATE:
201 case CS42L73_ALCRRATE:
202 case CS42L73_ALCMINMAX:
203 case CS42L73_NGCAB:
204 case CS42L73_ALCNGMC:
205 case CS42L73_MIXERCTL:
206 case CS42L73_HLAIPAA:
207 case CS42L73_HLBIPBA:
208 case CS42L73_HLAXSPAA:
209 case CS42L73_HLBXSPBA:
210 case CS42L73_HLAASPAA:
211 case CS42L73_HLBASPBA:
212 case CS42L73_HLAVSPMA:
213 case CS42L73_HLBVSPMA:
214 case CS42L73_XSPAIPAA:
215 case CS42L73_XSPBIPBA:
216 case CS42L73_XSPAXSPAA:
217 case CS42L73_XSPBXSPBA:
218 case CS42L73_XSPAASPAA:
219 case CS42L73_XSPAASPBA:
220 case CS42L73_XSPAVSPMA:
221 case CS42L73_XSPBVSPMA:
222 case CS42L73_ASPAIPAA:
223 case CS42L73_ASPBIPBA:
224 case CS42L73_ASPAXSPAA:
225 case CS42L73_ASPBXSPBA:
226 case CS42L73_ASPAASPAA:
227 case CS42L73_ASPBASPBA:
228 case CS42L73_ASPAVSPMA:
229 case CS42L73_ASPBVSPMA:
230 case CS42L73_VSPAIPAA:
231 case CS42L73_VSPBIPBA:
232 case CS42L73_VSPAXSPAA:
233 case CS42L73_VSPBXSPBA:
234 case CS42L73_VSPAASPAA:
235 case CS42L73_VSPBASPBA:
236 case CS42L73_VSPAVSPMA:
237 case CS42L73_VSPBVSPMA:
238 case CS42L73_MMIXCTL:
239 case CS42L73_SPKMIPMA:
240 case CS42L73_SPKMXSPA:
241 case CS42L73_SPKMASPA:
242 case CS42L73_SPKMVSPMA:
243 case CS42L73_ESLMIPMA:
244 case CS42L73_ESLMXSPA:
245 case CS42L73_ESLMASPA:
246 case CS42L73_ESLMVSPMA:
247 case CS42L73_IM1:
248 case CS42L73_IM2:
249 return true;
250 default:
251 return false;
252 }
253}
254
255static const unsigned int hpaloa_tlv[] = {
256 TLV_DB_RANGE_HEAD(2),
257 0, 13, TLV_DB_SCALE_ITEM(-7600, 200, 0),
258 14, 75, TLV_DB_SCALE_ITEM(-4900, 100, 0),
259};
260
261static DECLARE_TLV_DB_SCALE(adc_boost_tlv, 0, 2500, 0);
262
263static DECLARE_TLV_DB_SCALE(hl_tlv, -10200, 50, 0);
264
265static DECLARE_TLV_DB_SCALE(ipd_tlv, -9600, 100, 0);
266
267static DECLARE_TLV_DB_SCALE(micpga_tlv, -600, 50, 0);
268
269static const unsigned int limiter_tlv[] = {
270 TLV_DB_RANGE_HEAD(2),
271 0, 2, TLV_DB_SCALE_ITEM(-3000, 600, 0),
272 3, 7, TLV_DB_SCALE_ITEM(-1200, 300, 0),
273};
274
275static const DECLARE_TLV_DB_SCALE(attn_tlv, -6300, 100, 1);
276
277static const char * const cs42l73_pgaa_text[] = { "Line A", "Mic 1" };
278static const char * const cs42l73_pgab_text[] = { "Line B", "Mic 2" };
279
280static const struct soc_enum pgaa_enum =
281 SOC_ENUM_SINGLE(CS42L73_ADCIPC, 3,
282 ARRAY_SIZE(cs42l73_pgaa_text), cs42l73_pgaa_text);
283
284static const struct soc_enum pgab_enum =
285 SOC_ENUM_SINGLE(CS42L73_ADCIPC, 7,
286 ARRAY_SIZE(cs42l73_pgab_text), cs42l73_pgab_text);
287
288static const struct snd_kcontrol_new pgaa_mux =
289 SOC_DAPM_ENUM("Left Analog Input Capture Mux", pgaa_enum);
290
291static const struct snd_kcontrol_new pgab_mux =
292 SOC_DAPM_ENUM("Right Analog Input Capture Mux", pgab_enum);
293
294static const struct snd_kcontrol_new input_left_mixer[] = {
295 SOC_DAPM_SINGLE("ADC Left Input", CS42L73_PWRCTL1,
296 5, 1, 1),
297 SOC_DAPM_SINGLE("DMIC Left Input", CS42L73_PWRCTL1,
298 4, 1, 1),
299};
300
301static const struct snd_kcontrol_new input_right_mixer[] = {
302 SOC_DAPM_SINGLE("ADC Right Input", CS42L73_PWRCTL1,
303 7, 1, 1),
304 SOC_DAPM_SINGLE("DMIC Right Input", CS42L73_PWRCTL1,
305 6, 1, 1),
306};
307
308static const char * const cs42l73_ng_delay_text[] = {
309 "50ms", "100ms", "150ms", "200ms" };
310
311static const struct soc_enum ng_delay_enum =
312 SOC_ENUM_SINGLE(CS42L73_NGCAB, 0,
313 ARRAY_SIZE(cs42l73_ng_delay_text), cs42l73_ng_delay_text);
314
315static const char * const charge_pump_freq_text[] = {
316 "0", "1", "2", "3", "4",
317 "5", "6", "7", "8", "9",
318 "10", "11", "12", "13", "14", "15" };
319
320static const struct soc_enum charge_pump_enum =
321 SOC_ENUM_SINGLE(CS42L73_CPFCHC, 4,
322 ARRAY_SIZE(charge_pump_freq_text), charge_pump_freq_text);
323
324static const char * const cs42l73_mono_mix_texts[] = {
325 "Left", "Right", "Mono Mix"};
326
327static const unsigned int cs42l73_mono_mix_values[] = { 0, 1, 2 };
328
329static const struct soc_enum spk_asp_enum =
330 SOC_VALUE_ENUM_SINGLE(CS42L73_MMIXCTL, 6, 1,
331 ARRAY_SIZE(cs42l73_mono_mix_texts),
332 cs42l73_mono_mix_texts,
333 cs42l73_mono_mix_values);
334
335static const struct snd_kcontrol_new spk_asp_mixer =
336 SOC_DAPM_ENUM("Route", spk_asp_enum);
337
338static const struct soc_enum spk_xsp_enum =
339 SOC_VALUE_ENUM_SINGLE(CS42L73_MMIXCTL, 4, 3,
340 ARRAY_SIZE(cs42l73_mono_mix_texts),
341 cs42l73_mono_mix_texts,
342 cs42l73_mono_mix_values);
343
344static const struct snd_kcontrol_new spk_xsp_mixer =
345 SOC_DAPM_ENUM("Route", spk_xsp_enum);
346
347static const struct soc_enum esl_asp_enum =
348 SOC_VALUE_ENUM_SINGLE(CS42L73_MMIXCTL, 2, 5,
349 ARRAY_SIZE(cs42l73_mono_mix_texts),
350 cs42l73_mono_mix_texts,
351 cs42l73_mono_mix_values);
352
353static const struct snd_kcontrol_new esl_asp_mixer =
354 SOC_DAPM_ENUM("Route", esl_asp_enum);
355
356static const struct soc_enum esl_xsp_enum =
357 SOC_VALUE_ENUM_SINGLE(CS42L73_MMIXCTL, 0, 7,
358 ARRAY_SIZE(cs42l73_mono_mix_texts),
359 cs42l73_mono_mix_texts,
360 cs42l73_mono_mix_values);
361
362static const struct snd_kcontrol_new esl_xsp_mixer =
363 SOC_DAPM_ENUM("Route", esl_xsp_enum);
364
365static const char * const cs42l73_ip_swap_text[] = {
366 "Stereo", "Mono A", "Mono B", "Swap A-B"};
367
368static const struct soc_enum ip_swap_enum =
369 SOC_ENUM_SINGLE(CS42L73_MIOPC, 6,
370 ARRAY_SIZE(cs42l73_ip_swap_text), cs42l73_ip_swap_text);
371
372static const char * const cs42l73_spo_mixer_text[] = {"Mono", "Stereo"};
373
374static const struct soc_enum vsp_output_mux_enum =
375 SOC_ENUM_SINGLE(CS42L73_MIXERCTL, 5,
376 ARRAY_SIZE(cs42l73_spo_mixer_text), cs42l73_spo_mixer_text);
377
378static const struct soc_enum xsp_output_mux_enum =
379 SOC_ENUM_SINGLE(CS42L73_MIXERCTL, 4,
380 ARRAY_SIZE(cs42l73_spo_mixer_text), cs42l73_spo_mixer_text);
381
382static const struct snd_kcontrol_new vsp_output_mux =
383 SOC_DAPM_ENUM("Route", vsp_output_mux_enum);
384
385static const struct snd_kcontrol_new xsp_output_mux =
386 SOC_DAPM_ENUM("Route", xsp_output_mux_enum);
387
388static const struct snd_kcontrol_new hp_amp_ctl =
389 SOC_DAPM_SINGLE("Switch", CS42L73_PWRCTL3, 0, 1, 1);
390
391static const struct snd_kcontrol_new lo_amp_ctl =
392 SOC_DAPM_SINGLE("Switch", CS42L73_PWRCTL3, 1, 1, 1);
393
394static const struct snd_kcontrol_new spk_amp_ctl =
395 SOC_DAPM_SINGLE("Switch", CS42L73_PWRCTL3, 2, 1, 1);
396
397static const struct snd_kcontrol_new spklo_amp_ctl =
398 SOC_DAPM_SINGLE("Switch", CS42L73_PWRCTL3, 4, 1, 1);
399
400static const struct snd_kcontrol_new ear_amp_ctl =
401 SOC_DAPM_SINGLE("Switch", CS42L73_PWRCTL3, 3, 1, 1);
402
403static const struct snd_kcontrol_new cs42l73_snd_controls[] = {
404 SOC_DOUBLE_R_SX_TLV("Headphone Analog Playback Volume",
405 CS42L73_HPAAVOL, CS42L73_HPBAVOL, 7,
406 0xffffffC1, 0x0C, hpaloa_tlv),
407
408 SOC_DOUBLE_R_SX_TLV("LineOut Analog Playback Volume", CS42L73_LOAAVOL,
409 CS42L73_LOBAVOL, 7, 0xffffffC1, 0x0C, hpaloa_tlv),
410
411 SOC_DOUBLE_R_SX_TLV("Input PGA Analog Volume", CS42L73_MICAPREPGAAVOL,
412 CS42L73_MICBPREPGABVOL, 5, 0xffffff35,
413 0x34, micpga_tlv),
414
415 SOC_DOUBLE_R("MIC Preamp Switch", CS42L73_MICAPREPGAAVOL,
416 CS42L73_MICBPREPGABVOL, 6, 1, 1),
417
418 SOC_DOUBLE_R_SX_TLV("Input Path Digital Volume", CS42L73_IPADVOL,
419 CS42L73_IPBDVOL, 7, 0xffffffA0, 0xA0, ipd_tlv),
420
421 SOC_DOUBLE_R_SX_TLV("HL Digital Playback Volume",
422 CS42L73_HLADVOL, CS42L73_HLBDVOL, 7, 0xffffffE5,
423 0xE4, hl_tlv),
424
425 SOC_SINGLE_TLV("ADC A Boost Volume",
426 CS42L73_ADCIPC, 2, 0x01, 1, adc_boost_tlv),
427
428 SOC_SINGLE_TLV("ADC B Boost Volume",
429 CS42L73_ADCIPC, 6, 0x01, 1, adc_boost_tlv),
430
431 SOC_SINGLE_TLV("Speakerphone Digital Playback Volume",
432 CS42L73_SPKDVOL, 0, 0xE4, 1, hl_tlv),
433
434 SOC_SINGLE_TLV("Ear Speaker Digital Playback Volume",
435 CS42L73_ESLDVOL, 0, 0xE4, 1, hl_tlv),
436
437 SOC_DOUBLE_R("Headphone Analog Playback Switch", CS42L73_HPAAVOL,
438 CS42L73_HPBAVOL, 7, 1, 1),
439
440 SOC_DOUBLE_R("LineOut Analog Playback Switch", CS42L73_LOAAVOL,
441 CS42L73_LOBAVOL, 7, 1, 1),
442 SOC_DOUBLE("Input Path Digital Switch", CS42L73_ADCIPC, 0, 4, 1, 1),
443 SOC_DOUBLE("HL Digital Playback Switch", CS42L73_PBDC, 0,
444 1, 1, 1),
445 SOC_SINGLE("Speakerphone Digital Playback Switch", CS42L73_PBDC, 2, 1,
446 1),
447 SOC_SINGLE("Ear Speaker Digital Playback Switch", CS42L73_PBDC, 3, 1,
448 1),
449
450 SOC_SINGLE("PGA Soft-Ramp Switch", CS42L73_MIOPC, 3, 1, 0),
451 SOC_SINGLE("Analog Zero Cross Switch", CS42L73_MIOPC, 2, 1, 0),
452 SOC_SINGLE("Digital Soft-Ramp Switch", CS42L73_MIOPC, 1, 1, 0),
453 SOC_SINGLE("Analog Output Soft-Ramp Switch", CS42L73_MIOPC, 0, 1, 0),
454
455 SOC_DOUBLE("ADC Signal Polarity Switch", CS42L73_ADCIPC, 1, 5, 1,
456 0),
457
458 SOC_SINGLE("HL Limiter Attack Rate", CS42L73_LIMARATEHL, 0, 0x3F,
459 0),
460 SOC_SINGLE("HL Limiter Release Rate", CS42L73_LIMRRATEHL, 0,
461 0x3F, 0),
462
463
464 SOC_SINGLE("HL Limiter Switch", CS42L73_LIMRRATEHL, 7, 1, 0),
465 SOC_SINGLE("HL Limiter All Channels Switch", CS42L73_LIMRRATEHL, 6, 1,
466 0),
467
468 SOC_SINGLE_TLV("HL Limiter Max Threshold Volume", CS42L73_LMAXHL, 5, 7,
469 1, limiter_tlv),
470
471 SOC_SINGLE_TLV("HL Limiter Cushion Volume", CS42L73_LMAXHL, 2, 7, 1,
472 limiter_tlv),
473
474 SOC_SINGLE("SPK Limiter Attack Rate Volume", CS42L73_LIMARATESPK, 0,
475 0x3F, 0),
476 SOC_SINGLE("SPK Limiter Release Rate Volume", CS42L73_LIMRRATESPK, 0,
477 0x3F, 0),
478 SOC_SINGLE("SPK Limiter Switch", CS42L73_LIMRRATESPK, 7, 1, 0),
479 SOC_SINGLE("SPK Limiter All Channels Switch", CS42L73_LIMRRATESPK,
480 6, 1, 0),
481 SOC_SINGLE_TLV("SPK Limiter Max Threshold Volume", CS42L73_LMAXSPK, 5,
482 7, 1, limiter_tlv),
483
484 SOC_SINGLE_TLV("SPK Limiter Cushion Volume", CS42L73_LMAXSPK, 2, 7, 1,
485 limiter_tlv),
486
487 SOC_SINGLE("ESL Limiter Attack Rate Volume", CS42L73_LIMARATEESL, 0,
488 0x3F, 0),
489 SOC_SINGLE("ESL Limiter Release Rate Volume", CS42L73_LIMRRATEESL, 0,
490 0x3F, 0),
491 SOC_SINGLE("ESL Limiter Switch", CS42L73_LIMRRATEESL, 7, 1, 0),
492 SOC_SINGLE_TLV("ESL Limiter Max Threshold Volume", CS42L73_LMAXESL, 5,
493 7, 1, limiter_tlv),
494
495 SOC_SINGLE_TLV("ESL Limiter Cushion Volume", CS42L73_LMAXESL, 2, 7, 1,
496 limiter_tlv),
497
498 SOC_SINGLE("ALC Attack Rate Volume", CS42L73_ALCARATE, 0, 0x3F, 0),
499 SOC_SINGLE("ALC Release Rate Volume", CS42L73_ALCRRATE, 0, 0x3F, 0),
500 SOC_DOUBLE("ALC Switch", CS42L73_ALCARATE, 6, 7, 1, 0),
501 SOC_SINGLE_TLV("ALC Max Threshold Volume", CS42L73_ALCMINMAX, 5, 7, 0,
502 limiter_tlv),
503 SOC_SINGLE_TLV("ALC Min Threshold Volume", CS42L73_ALCMINMAX, 2, 7, 0,
504 limiter_tlv),
505
506 SOC_DOUBLE("NG Enable Switch", CS42L73_NGCAB, 6, 7, 1, 0),
507 SOC_SINGLE("NG Boost Switch", CS42L73_NGCAB, 5, 1, 0),
508 /*
509 NG Threshold depends on NG_BOOTSAB, which selects
510 between two threshold scales in decibels.
511 Set linear values for now ..
512 */
513 SOC_SINGLE("NG Threshold", CS42L73_NGCAB, 2, 7, 0),
514 SOC_ENUM("NG Delay", ng_delay_enum),
515
516 SOC_ENUM("Charge Pump Frequency", charge_pump_enum),
517
518 SOC_DOUBLE_R_TLV("XSP-IP Volume",
519 CS42L73_XSPAIPAA, CS42L73_XSPBIPBA, 0, 0x3F, 1,
520 attn_tlv),
521 SOC_DOUBLE_R_TLV("XSP-XSP Volume",
522 CS42L73_XSPAXSPAA, CS42L73_XSPBXSPBA, 0, 0x3F, 1,
523 attn_tlv),
524 SOC_DOUBLE_R_TLV("XSP-ASP Volume",
525 CS42L73_XSPAASPAA, CS42L73_XSPAASPBA, 0, 0x3F, 1,
526 attn_tlv),
527 SOC_DOUBLE_R_TLV("XSP-VSP Volume",
528 CS42L73_XSPAVSPMA, CS42L73_XSPBVSPMA, 0, 0x3F, 1,
529 attn_tlv),
530
531 SOC_DOUBLE_R_TLV("ASP-IP Volume",
532 CS42L73_ASPAIPAA, CS42L73_ASPBIPBA, 0, 0x3F, 1,
533 attn_tlv),
534 SOC_DOUBLE_R_TLV("ASP-XSP Volume",
535 CS42L73_ASPAXSPAA, CS42L73_ASPBXSPBA, 0, 0x3F, 1,
536 attn_tlv),
537 SOC_DOUBLE_R_TLV("ASP-ASP Volume",
538 CS42L73_ASPAASPAA, CS42L73_ASPBASPBA, 0, 0x3F, 1,
539 attn_tlv),
540 SOC_DOUBLE_R_TLV("ASP-VSP Volume",
541 CS42L73_ASPAVSPMA, CS42L73_ASPBVSPMA, 0, 0x3F, 1,
542 attn_tlv),
543
544 SOC_DOUBLE_R_TLV("VSP-IP Volume",
545 CS42L73_VSPAIPAA, CS42L73_VSPBIPBA, 0, 0x3F, 1,
546 attn_tlv),
547 SOC_DOUBLE_R_TLV("VSP-XSP Volume",
548 CS42L73_VSPAXSPAA, CS42L73_VSPBXSPBA, 0, 0x3F, 1,
549 attn_tlv),
550 SOC_DOUBLE_R_TLV("VSP-ASP Volume",
551 CS42L73_VSPAASPAA, CS42L73_VSPBASPBA, 0, 0x3F, 1,
552 attn_tlv),
553 SOC_DOUBLE_R_TLV("VSP-VSP Volume",
554 CS42L73_VSPAVSPMA, CS42L73_VSPBVSPMA, 0, 0x3F, 1,
555 attn_tlv),
556
557 SOC_DOUBLE_R_TLV("HL-IP Volume",
558 CS42L73_HLAIPAA, CS42L73_HLBIPBA, 0, 0x3F, 1,
559 attn_tlv),
560 SOC_DOUBLE_R_TLV("HL-XSP Volume",
561 CS42L73_HLAXSPAA, CS42L73_HLBXSPBA, 0, 0x3F, 1,
562 attn_tlv),
563 SOC_DOUBLE_R_TLV("HL-ASP Volume",
564 CS42L73_HLAASPAA, CS42L73_HLBASPBA, 0, 0x3F, 1,
565 attn_tlv),
566 SOC_DOUBLE_R_TLV("HL-VSP Volume",
567 CS42L73_HLAVSPMA, CS42L73_HLBVSPMA, 0, 0x3F, 1,
568 attn_tlv),
569
570 SOC_SINGLE_TLV("SPK-IP Mono Volume",
571 CS42L73_SPKMIPMA, 0, 0x3E, 1, attn_tlv),
572 SOC_SINGLE_TLV("SPK-XSP Mono Volume",
573 CS42L73_SPKMXSPA, 0, 0x3E, 1, attn_tlv),
574 SOC_SINGLE_TLV("SPK-ASP Mono Volume",
575 CS42L73_SPKMASPA, 0, 0x3E, 1, attn_tlv),
576 SOC_SINGLE_TLV("SPK-VSP Mono Volume",
577 CS42L73_SPKMVSPMA, 0, 0x3E, 1, attn_tlv),
578
579 SOC_SINGLE_TLV("ESL-IP Mono Volume",
580 CS42L73_ESLMIPMA, 0, 0x3E, 1, attn_tlv),
581 SOC_SINGLE_TLV("ESL-XSP Mono Volume",
582 CS42L73_ESLMXSPA, 0, 0x3E, 1, attn_tlv),
583 SOC_SINGLE_TLV("ESL-ASP Mono Volume",
584 CS42L73_ESLMASPA, 0, 0x3E, 1, attn_tlv),
585 SOC_SINGLE_TLV("ESL-VSP Mono Volume",
586 CS42L73_ESLMVSPMA, 0, 0x3E, 1, attn_tlv),
587
588 SOC_ENUM("IP Digital Swap/Mono Select", ip_swap_enum),
589
590 SOC_ENUM("VSPOUT Mono/Stereo Select", vsp_output_mux_enum),
591 SOC_ENUM("XSPOUT Mono/Stereo Select", xsp_output_mux_enum),
592};
593
594static const struct snd_soc_dapm_widget cs42l73_dapm_widgets[] = {
595 SND_SOC_DAPM_INPUT("LINEINA"),
596 SND_SOC_DAPM_INPUT("LINEINB"),
597 SND_SOC_DAPM_INPUT("MIC1"),
598 SND_SOC_DAPM_SUPPLY("MIC1 Bias", CS42L73_PWRCTL2, 6, 1, NULL, 0),
599 SND_SOC_DAPM_INPUT("MIC2"),
600 SND_SOC_DAPM_SUPPLY("MIC2 Bias", CS42L73_PWRCTL2, 7, 1, NULL, 0),
601
602 SND_SOC_DAPM_AIF_OUT("XSPOUTL", "XSP Capture", 0,
603 CS42L73_PWRCTL2, 1, 1),
604 SND_SOC_DAPM_AIF_OUT("XSPOUTR", "XSP Capture", 0,
605 CS42L73_PWRCTL2, 1, 1),
606 SND_SOC_DAPM_AIF_OUT("ASPOUTL", "ASP Capture", 0,
607 CS42L73_PWRCTL2, 3, 1),
608 SND_SOC_DAPM_AIF_OUT("ASPOUTR", "ASP Capture", 0,
609 CS42L73_PWRCTL2, 3, 1),
610 SND_SOC_DAPM_AIF_OUT("VSPOUTL", "VSP Capture", 0,
611 CS42L73_PWRCTL2, 4, 1),
612 SND_SOC_DAPM_AIF_OUT("VSPOUTR", "VSP Capture", 0,
613 CS42L73_PWRCTL2, 4, 1),
614
615 SND_SOC_DAPM_PGA("PGA Left", SND_SOC_NOPM, 0, 0, NULL, 0),
616 SND_SOC_DAPM_PGA("PGA Right", SND_SOC_NOPM, 0, 0, NULL, 0),
617
618 SND_SOC_DAPM_MUX("PGA Left Mux", SND_SOC_NOPM, 0, 0, &pgaa_mux),
619 SND_SOC_DAPM_MUX("PGA Right Mux", SND_SOC_NOPM, 0, 0, &pgab_mux),
620
621 SND_SOC_DAPM_ADC("ADC Left", NULL, CS42L73_PWRCTL1, 7, 1),
622 SND_SOC_DAPM_ADC("ADC Right", NULL, CS42L73_PWRCTL1, 5, 1),
623 SND_SOC_DAPM_ADC("DMIC Left", NULL, CS42L73_PWRCTL1, 6, 1),
624 SND_SOC_DAPM_ADC("DMIC Right", NULL, CS42L73_PWRCTL1, 4, 1),
625
626 SND_SOC_DAPM_MIXER_NAMED_CTL("Input Left Capture", SND_SOC_NOPM,
627 0, 0, input_left_mixer,
628 ARRAY_SIZE(input_left_mixer)),
629
630 SND_SOC_DAPM_MIXER_NAMED_CTL("Input Right Capture", SND_SOC_NOPM,
631 0, 0, input_right_mixer,
632 ARRAY_SIZE(input_right_mixer)),
633
634 SND_SOC_DAPM_MIXER("ASPL Output Mixer", SND_SOC_NOPM, 0, 0, NULL, 0),
635 SND_SOC_DAPM_MIXER("ASPR Output Mixer", SND_SOC_NOPM, 0, 0, NULL, 0),
636 SND_SOC_DAPM_MIXER("XSPL Output Mixer", SND_SOC_NOPM, 0, 0, NULL, 0),
637 SND_SOC_DAPM_MIXER("XSPR Output Mixer", SND_SOC_NOPM, 0, 0, NULL, 0),
638 SND_SOC_DAPM_MIXER("VSPL Output Mixer", SND_SOC_NOPM, 0, 0, NULL, 0),
639 SND_SOC_DAPM_MIXER("VSPR Output Mixer", SND_SOC_NOPM, 0, 0, NULL, 0),
640
641 SND_SOC_DAPM_AIF_IN("XSPINL", "XSP Playback", 0,
642 CS42L73_PWRCTL2, 0, 1),
643 SND_SOC_DAPM_AIF_IN("XSPINR", "XSP Playback", 0,
644 CS42L73_PWRCTL2, 0, 1),
645 SND_SOC_DAPM_AIF_IN("XSPINM", "XSP Playback", 0,
646 CS42L73_PWRCTL2, 0, 1),
647
648 SND_SOC_DAPM_AIF_IN("ASPINL", "ASP Playback", 0,
649 CS42L73_PWRCTL2, 2, 1),
650 SND_SOC_DAPM_AIF_IN("ASPINR", "ASP Playback", 0,
651 CS42L73_PWRCTL2, 2, 1),
652 SND_SOC_DAPM_AIF_IN("ASPINM", "ASP Playback", 0,
653 CS42L73_PWRCTL2, 2, 1),
654
655 SND_SOC_DAPM_AIF_IN("VSPIN", "VSP Playback", 0,
656 CS42L73_PWRCTL2, 4, 1),
657
658 SND_SOC_DAPM_MIXER("HL Left Mixer", SND_SOC_NOPM, 0, 0, NULL, 0),
659 SND_SOC_DAPM_MIXER("HL Right Mixer", SND_SOC_NOPM, 0, 0, NULL, 0),
660 SND_SOC_DAPM_MIXER("SPK Mixer", SND_SOC_NOPM, 0, 0, NULL, 0),
661 SND_SOC_DAPM_MIXER("ESL Mixer", SND_SOC_NOPM, 0, 0, NULL, 0),
662
663 SND_SOC_DAPM_MUX("ESL-XSP Mux", SND_SOC_NOPM,
664 0, 0, &esl_xsp_mixer),
665
666 SND_SOC_DAPM_MUX("ESL-ASP Mux", SND_SOC_NOPM,
667 0, 0, &esl_asp_mixer),
668
669 SND_SOC_DAPM_MUX("SPK-ASP Mux", SND_SOC_NOPM,
670 0, 0, &spk_asp_mixer),
671
672 SND_SOC_DAPM_MUX("SPK-XSP Mux", SND_SOC_NOPM,
673 0, 0, &spk_xsp_mixer),
674
675 SND_SOC_DAPM_PGA("HL Left DAC", SND_SOC_NOPM, 0, 0, NULL, 0),
676 SND_SOC_DAPM_PGA("HL Right DAC", SND_SOC_NOPM, 0, 0, NULL, 0),
677 SND_SOC_DAPM_PGA("SPK DAC", SND_SOC_NOPM, 0, 0, NULL, 0),
678 SND_SOC_DAPM_PGA("ESL DAC", SND_SOC_NOPM, 0, 0, NULL, 0),
679
680 SND_SOC_DAPM_SWITCH("HP Amp", CS42L73_PWRCTL3, 0, 1,
681 &hp_amp_ctl),
682 SND_SOC_DAPM_SWITCH("LO Amp", CS42L73_PWRCTL3, 1, 1,
683 &lo_amp_ctl),
684 SND_SOC_DAPM_SWITCH("SPK Amp", CS42L73_PWRCTL3, 2, 1,
685 &spk_amp_ctl),
686 SND_SOC_DAPM_SWITCH("EAR Amp", CS42L73_PWRCTL3, 3, 1,
687 &ear_amp_ctl),
688 SND_SOC_DAPM_SWITCH("SPKLO Amp", CS42L73_PWRCTL3, 4, 1,
689 &spklo_amp_ctl),
690
691 SND_SOC_DAPM_OUTPUT("HPOUTA"),
692 SND_SOC_DAPM_OUTPUT("HPOUTB"),
693 SND_SOC_DAPM_OUTPUT("LINEOUTA"),
694 SND_SOC_DAPM_OUTPUT("LINEOUTB"),
695 SND_SOC_DAPM_OUTPUT("EAROUT"),
696 SND_SOC_DAPM_OUTPUT("SPKOUT"),
697 SND_SOC_DAPM_OUTPUT("SPKLINEOUT"),
698};
699
700static const struct snd_soc_dapm_route cs42l73_audio_map[] = {
701
702 /* SPKLO EARSPK Paths */
703 {"EAROUT", NULL, "EAR Amp"},
704 {"SPKLINEOUT", NULL, "SPKLO Amp"},
705
706 {"EAR Amp", "Switch", "ESL DAC"},
707 {"SPKLO Amp", "Switch", "ESL DAC"},
708
709 {"ESL DAC", "ESL-ASP Mono Volume", "ESL Mixer"},
710 {"ESL DAC", "ESL-XSP Mono Volume", "ESL Mixer"},
711 {"ESL DAC", "ESL-VSP Mono Volume", "VSPIN"},
712 /* Loopback */
713 {"ESL DAC", "ESL-IP Mono Volume", "Input Left Capture"},
714 {"ESL DAC", "ESL-IP Mono Volume", "Input Right Capture"},
715
716 {"ESL Mixer", NULL, "ESL-ASP Mux"},
717 {"ESL Mixer", NULL, "ESL-XSP Mux"},
718
719 {"ESL-ASP Mux", "Left", "ASPINL"},
720 {"ESL-ASP Mux", "Right", "ASPINR"},
721 {"ESL-ASP Mux", "Mono Mix", "ASPINM"},
722
723 {"ESL-XSP Mux", "Left", "XSPINL"},
724 {"ESL-XSP Mux", "Right", "XSPINR"},
725 {"ESL-XSP Mux", "Mono Mix", "XSPINM"},
726
727 /* Speakerphone Paths */
728 {"SPKOUT", NULL, "SPK Amp"},
729 {"SPK Amp", "Switch", "SPK DAC"},
730
731 {"SPK DAC", "SPK-ASP Mono Volume", "SPK Mixer"},
732 {"SPK DAC", "SPK-XSP Mono Volume", "SPK Mixer"},
733 {"SPK DAC", "SPK-VSP Mono Volume", "VSPIN"},
734 /* Loopback */
735 {"SPK DAC", "SPK-IP Mono Volume", "Input Left Capture"},
736 {"SPK DAC", "SPK-IP Mono Volume", "Input Right Capture"},
737
738 {"SPK Mixer", NULL, "SPK-ASP Mux"},
739 {"SPK Mixer", NULL, "SPK-XSP Mux"},
740
741 {"SPK-ASP Mux", "Left", "ASPINL"},
742 {"SPK-ASP Mux", "Mono Mix", "ASPINM"},
743 {"SPK-ASP Mux", "Right", "ASPINR"},
744
745 {"SPK-XSP Mux", "Left", "XSPINL"},
746 {"SPK-XSP Mux", "Mono Mix", "XSPINM"},
747 {"SPK-XSP Mux", "Right", "XSPINR"},
748
749 /* HP LineOUT Paths */
750 {"HPOUTA", NULL, "HP Amp"},
751 {"HPOUTB", NULL, "HP Amp"},
752 {"LINEOUTA", NULL, "LO Amp"},
753 {"LINEOUTB", NULL, "LO Amp"},
754
755 {"HP Amp", "Switch", "HL Left DAC"},
756 {"HP Amp", "Switch", "HL Right DAC"},
757 {"LO Amp", "Switch", "HL Left DAC"},
758 {"LO Amp", "Switch", "HL Right DAC"},
759
760 {"HL Left DAC", "HL-XSP Volume", "HL Left Mixer"},
761 {"HL Right DAC", "HL-XSP Volume", "HL Right Mixer"},
762 {"HL Left DAC", "HL-ASP Volume", "HL Left Mixer"},
763 {"HL Right DAC", "HL-ASP Volume", "HL Right Mixer"},
764 {"HL Left DAC", "HL-VSP Volume", "HL Left Mixer"},
765 {"HL Right DAC", "HL-VSP Volume", "HL Right Mixer"},
766 /* Loopback */
767 {"HL Left DAC", "HL-IP Volume", "HL Left Mixer"},
768 {"HL Right DAC", "HL-IP Volume", "HL Right Mixer"},
769 {"HL Left Mixer", NULL, "Input Left Capture"},
770 {"HL Right Mixer", NULL, "Input Right Capture"},
771
772 {"HL Left Mixer", NULL, "ASPINL"},
773 {"HL Right Mixer", NULL, "ASPINR"},
774 {"HL Left Mixer", NULL, "XSPINL"},
775 {"HL Right Mixer", NULL, "XSPINR"},
776 {"HL Left Mixer", NULL, "VSPIN"},
777 {"HL Right Mixer", NULL, "VSPIN"},
778
779 /* Capture Paths */
780 {"MIC1", NULL, "MIC1 Bias"},
781 {"PGA Left Mux", "Mic 1", "MIC1"},
782 {"MIC2", NULL, "MIC2 Bias"},
783 {"PGA Right Mux", "Mic 2", "MIC2"},
784
785 {"PGA Left Mux", "Line A", "LINEINA"},
786 {"PGA Right Mux", "Line B", "LINEINB"},
787
788 {"PGA Left", NULL, "PGA Left Mux"},
789 {"PGA Right", NULL, "PGA Right Mux"},
790
791 {"ADC Left", NULL, "PGA Left"},
792 {"ADC Right", NULL, "PGA Right"},
793
794 {"Input Left Capture", "ADC Left Input", "ADC Left"},
795 {"Input Right Capture", "ADC Right Input", "ADC Right"},
796 {"Input Left Capture", "DMIC Left Input", "DMIC Left"},
797 {"Input Right Capture", "DMIC Right Input", "DMIC Right"},
798
799 /* Audio Capture */
800 {"ASPL Output Mixer", NULL, "Input Left Capture"},
801 {"ASPR Output Mixer", NULL, "Input Right Capture"},
802
803 {"ASPOUTL", "ASP-IP Volume", "ASPL Output Mixer"},
804 {"ASPOUTR", "ASP-IP Volume", "ASPR Output Mixer"},
805
806 /* Auxillary Capture */
807 {"XSPL Output Mixer", NULL, "Input Left Capture"},
808 {"XSPR Output Mixer", NULL, "Input Right Capture"},
809
810 {"XSPOUTL", "XSP-IP Volume", "XSPL Output Mixer"},
811 {"XSPOUTR", "XSP-IP Volume", "XSPR Output Mixer"},
812
813 {"XSPOUTL", NULL, "XSPL Output Mixer"},
814 {"XSPOUTR", NULL, "XSPR Output Mixer"},
815
816 /* Voice Capture */
817 {"VSPL Output Mixer", NULL, "Input Left Capture"},
818 {"VSPR Output Mixer", NULL, "Input Left Capture"},
819
820 {"VSPOUTL", "VSP-IP Volume", "VSPL Output Mixer"},
821 {"VSPOUTR", "VSP-IP Volume", "VSPR Output Mixer"},
822
823 {"VSPOUTL", NULL, "VSPL Output Mixer"},
824 {"VSPOUTR", NULL, "VSPR Output Mixer"},
825};
826
827struct cs42l73_mclk_div {
828 u32 mclk;
829 u32 srate;
830 u8 mmcc;
831};
832
833static struct cs42l73_mclk_div cs42l73_mclk_coeffs[] = {
834 /* MCLK, Sample Rate, xMMCC[5:0] */
835 {5644800, 11025, 0x30},
836 {5644800, 22050, 0x20},
837 {5644800, 44100, 0x10},
838
839 {6000000, 8000, 0x39},
840 {6000000, 11025, 0x33},
841 {6000000, 12000, 0x31},
842 {6000000, 16000, 0x29},
843 {6000000, 22050, 0x23},
844 {6000000, 24000, 0x21},
845 {6000000, 32000, 0x19},
846 {6000000, 44100, 0x13},
847 {6000000, 48000, 0x11},
848
849 {6144000, 8000, 0x38},
850 {6144000, 12000, 0x30},
851 {6144000, 16000, 0x28},
852 {6144000, 24000, 0x20},
853 {6144000, 32000, 0x18},
854 {6144000, 48000, 0x10},
855
856 {6500000, 8000, 0x3C},
857 {6500000, 11025, 0x35},
858 {6500000, 12000, 0x34},
859 {6500000, 16000, 0x2C},
860 {6500000, 22050, 0x25},
861 {6500000, 24000, 0x24},
862 {6500000, 32000, 0x1C},
863 {6500000, 44100, 0x15},
864 {6500000, 48000, 0x14},
865
866 {6400000, 8000, 0x3E},
867 {6400000, 11025, 0x37},
868 {6400000, 12000, 0x36},
869 {6400000, 16000, 0x2E},
870 {6400000, 22050, 0x27},
871 {6400000, 24000, 0x26},
872 {6400000, 32000, 0x1E},
873 {6400000, 44100, 0x17},
874 {6400000, 48000, 0x16},
875};
876
877struct cs42l73_mclkx_div {
878 u32 mclkx;
879 u8 ratio;
880 u8 mclkdiv;
881};
882
883static struct cs42l73_mclkx_div cs42l73_mclkx_coeffs[] = {
884 {5644800, 1, 0}, /* 5644800 */
885 {6000000, 1, 0}, /* 6000000 */
886 {6144000, 1, 0}, /* 6144000 */
887 {11289600, 2, 2}, /* 5644800 */
888 {12288000, 2, 2}, /* 6144000 */
889 {12000000, 2, 2}, /* 6000000 */
890 {13000000, 2, 2}, /* 6500000 */
891 {19200000, 3, 3}, /* 6400000 */
892 {24000000, 4, 4}, /* 6000000 */
893 {26000000, 4, 4}, /* 6500000 */
894 {38400000, 6, 5} /* 6400000 */
895};
896
897static int cs42l73_get_mclkx_coeff(int mclkx)
898{
899 int i;
900
901 for (i = 0; i < ARRAY_SIZE(cs42l73_mclkx_coeffs); i++) {
902 if (cs42l73_mclkx_coeffs[i].mclkx == mclkx)
903 return i;
904 }
905 return -EINVAL;
906}
907
908static int cs42l73_get_mclk_coeff(int mclk, int srate)
909{
910 int i;
911
912 for (i = 0; i < ARRAY_SIZE(cs42l73_mclk_coeffs); i++) {
913 if (cs42l73_mclk_coeffs[i].mclk == mclk &&
914 cs42l73_mclk_coeffs[i].srate == srate)
915 return i;
916 }
917 return -EINVAL;
918
919}
920
921static int cs42l73_set_mclk(struct snd_soc_dai *dai, unsigned int freq)
922{
923 struct snd_soc_codec *codec = dai->codec;
924 struct cs42l73_private *priv = snd_soc_codec_get_drvdata(codec);
925
926 int mclkx_coeff;
927 u32 mclk = 0;
928 u8 dmmcc = 0;
929
930 /* MCLKX -> MCLK */
931 mclkx_coeff = cs42l73_get_mclkx_coeff(freq);
932
933 mclk = cs42l73_mclkx_coeffs[mclkx_coeff].mclkx /
934 cs42l73_mclkx_coeffs[mclkx_coeff].ratio;
935
936 dev_dbg(codec->dev, "MCLK%u %u <-> internal MCLK %u\n",
937 priv->mclksel + 1, cs42l73_mclkx_coeffs[mclkx_coeff].mclkx,
938 mclk);
939
940 dmmcc = (priv->mclksel << 4) |
941 (cs42l73_mclkx_coeffs[mclkx_coeff].mclkdiv << 1);
942
943 snd_soc_write(codec, CS42L73_DMMCC, dmmcc);
944
945 priv->sysclk = mclkx_coeff;
946 priv->mclk = mclk;
947
948 return 0;
949}
950
951static int cs42l73_set_sysclk(struct snd_soc_dai *dai,
952 int clk_id, unsigned int freq, int dir)
953{
954 struct snd_soc_codec *codec = dai->codec;
955 struct cs42l73_private *priv = snd_soc_codec_get_drvdata(codec);
956
957 switch (clk_id) {
958 case CS42L73_CLKID_MCLK1:
959 break;
960 case CS42L73_CLKID_MCLK2:
961 break;
962 default:
963 return -EINVAL;
964 }
965
966 if ((cs42l73_set_mclk(dai, freq)) < 0) {
967 dev_err(codec->dev, "Unable to set MCLK for dai %s\n",
968 dai->name);
969 return -EINVAL;
970 }
971
972 priv->mclksel = clk_id;
973
974 return 0;
975}
976
977static int cs42l73_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
978{
979 struct snd_soc_codec *codec = codec_dai->codec;
980 struct cs42l73_private *priv = snd_soc_codec_get_drvdata(codec);
981 u8 id = codec_dai->id;
982 unsigned int inv, format;
983 u8 spc, mmcc;
984
985 spc = snd_soc_read(codec, CS42L73_SPC(id));
986 mmcc = snd_soc_read(codec, CS42L73_MMCC(id));
987
988 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
989 case SND_SOC_DAIFMT_CBM_CFM:
990 mmcc |= MS_MASTER;
991 break;
992
993 case SND_SOC_DAIFMT_CBS_CFS:
994 mmcc &= ~MS_MASTER;
995 break;
996
997 default:
998 return -EINVAL;
999 }
1000
1001 format = (fmt & SND_SOC_DAIFMT_FORMAT_MASK);
1002 inv = (fmt & SND_SOC_DAIFMT_INV_MASK);
1003
1004 switch (format) {
1005 case SND_SOC_DAIFMT_I2S:
1006 spc &= ~SPDIF_PCM;
1007 break;
1008 case SND_SOC_DAIFMT_DSP_A:
1009 case SND_SOC_DAIFMT_DSP_B:
1010 if (mmcc & MS_MASTER) {
1011 dev_err(codec->dev,
1012 "PCM format in slave mode only\n");
1013 return -EINVAL;
1014 }
1015 if (id == CS42L73_ASP) {
1016 dev_err(codec->dev,
1017 "PCM format is not supported on ASP port\n");
1018 return -EINVAL;
1019 }
1020 spc |= SPDIF_PCM;
1021 break;
1022 default:
1023 return -EINVAL;
1024 }
1025
1026 if (spc & SPDIF_PCM) {
1027 /* Clear PCM mode, clear PCM_BIT_ORDER bit for MSB->LSB */
1028 spc &= ~(PCM_MODE_MASK | PCM_BIT_ORDER);
1029 switch (format) {
1030 case SND_SOC_DAIFMT_DSP_B:
1031 if (inv == SND_SOC_DAIFMT_IB_IF)
1032 spc |= PCM_MODE0;
1033 if (inv == SND_SOC_DAIFMT_IB_NF)
1034 spc |= PCM_MODE1;
1035 break;
1036 case SND_SOC_DAIFMT_DSP_A:
1037 if (inv == SND_SOC_DAIFMT_IB_IF)
1038 spc |= PCM_MODE1;
1039 break;
1040 default:
1041 return -EINVAL;
1042 }
1043 }
1044
1045 priv->config[id].spc = spc;
1046 priv->config[id].mmcc = mmcc;
1047
1048 return 0;
1049}
1050
1051static u32 cs42l73_asrc_rates[] = {
1052 8000, 11025, 12000, 16000, 22050,
1053 24000, 32000, 44100, 48000
1054};
1055
1056static unsigned int cs42l73_get_xspfs_coeff(u32 rate)
1057{
1058 int i;
1059 for (i = 0; i < ARRAY_SIZE(cs42l73_asrc_rates); i++) {
1060 if (cs42l73_asrc_rates[i] == rate)
1061 return i + 1;
1062 }
1063 return 0; /* 0 = Don't know */
1064}
1065
1066static void cs42l73_update_asrc(struct snd_soc_codec *codec, int id, int srate)
1067{
1068 u8 spfs = 0;
1069
1070 if (srate > 0)
1071 spfs = cs42l73_get_xspfs_coeff(srate);
1072
1073 switch (id) {
1074 case CS42L73_XSP:
1075 snd_soc_update_bits(codec, CS42L73_VXSPFS, 0x0f, spfs);
1076 break;
1077 case CS42L73_ASP:
1078 snd_soc_update_bits(codec, CS42L73_ASPC, 0x3c, spfs << 2);
1079 break;
1080 case CS42L73_VSP:
1081 snd_soc_update_bits(codec, CS42L73_VXSPFS, 0xf0, spfs << 4);
1082 break;
1083 default:
1084 break;
1085 }
1086}
1087
1088static int cs42l73_pcm_hw_params(struct snd_pcm_substream *substream,
1089 struct snd_pcm_hw_params *params,
1090 struct snd_soc_dai *dai)
1091{
1092 struct snd_soc_pcm_runtime *rtd = substream->private_data;
1093 struct snd_soc_codec *codec = rtd->codec;
1094 struct cs42l73_private *priv = snd_soc_codec_get_drvdata(codec);
1095 int id = dai->id;
1096 int mclk_coeff;
1097 int srate = params_rate(params);
1098
1099 if (priv->config[id].mmcc & MS_MASTER) {
1100 /* CS42L73 Master */
1101 /* MCLK -> srate */
1102 mclk_coeff =
1103 cs42l73_get_mclk_coeff(priv->mclk, srate);
1104
1105 if (mclk_coeff < 0)
1106 return -EINVAL;
1107
1108 dev_dbg(codec->dev,
1109 "DAI[%d]: MCLK %u, srate %u, MMCC[5:0] = %x\n",
1110 id, priv->mclk, srate,
1111 cs42l73_mclk_coeffs[mclk_coeff].mmcc);
1112
1113 priv->config[id].mmcc &= 0xC0;
1114 priv->config[id].mmcc |= cs42l73_mclk_coeffs[mclk_coeff].mmcc;
1115 priv->config[id].spc &= 0xFC;
1116 priv->config[id].spc &= MCK_SCLK_64FS;
1117 } else {
1118 /* CS42L73 Slave */
1119 priv->config[id].spc &= 0xFC;
1120 priv->config[id].spc |= MCK_SCLK_64FS;
1121 }
1122 /* Update ASRCs */
1123 priv->config[id].srate = srate;
1124
1125 snd_soc_write(codec, CS42L73_SPC(id), priv->config[id].spc);
1126 snd_soc_write(codec, CS42L73_MMCC(id), priv->config[id].mmcc);
1127
1128 cs42l73_update_asrc(codec, id, srate);
1129
1130 return 0;
1131}
1132
1133static int cs42l73_set_bias_level(struct snd_soc_codec *codec,
1134 enum snd_soc_bias_level level)
1135{
1136 struct cs42l73_private *cs42l73 = snd_soc_codec_get_drvdata(codec);
1137
1138 switch (level) {
1139 case SND_SOC_BIAS_ON:
1140 snd_soc_update_bits(codec, CS42L73_DMMCC, MCLKDIS, 0);
1141 snd_soc_update_bits(codec, CS42L73_PWRCTL1, PDN, 0);
1142 break;
1143
1144 case SND_SOC_BIAS_PREPARE:
1145 break;
1146
1147 case SND_SOC_BIAS_STANDBY:
1148 if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
1149 regcache_cache_only(cs42l73->regmap, false);
1150 regcache_sync(cs42l73->regmap);
1151 }
1152 snd_soc_update_bits(codec, CS42L73_PWRCTL1, PDN, 1);
1153 break;
1154
1155 case SND_SOC_BIAS_OFF:
1156 snd_soc_update_bits(codec, CS42L73_PWRCTL1, PDN, 1);
1157 snd_soc_update_bits(codec, CS42L73_DMMCC, MCLKDIS, 1);
1158 break;
1159 }
1160 codec->dapm.bias_level = level;
1161 return 0;
1162}
1163
1164static int cs42l73_set_tristate(struct snd_soc_dai *dai, int tristate)
1165{
1166 struct snd_soc_codec *codec = dai->codec;
1167 int id = dai->id;
1168
1169 return snd_soc_update_bits(codec, CS42L73_SPC(id),
1170 0x7F, tristate << 7);
1171}
1172
1173static struct snd_pcm_hw_constraint_list constraints_12_24 = {
1174 .count = ARRAY_SIZE(cs42l73_asrc_rates),
1175 .list = cs42l73_asrc_rates,
1176};
1177
1178static int cs42l73_pcm_startup(struct snd_pcm_substream *substream,
1179 struct snd_soc_dai *dai)
1180{
1181 snd_pcm_hw_constraint_list(substream->runtime, 0,
1182 SNDRV_PCM_HW_PARAM_RATE,
1183 &constraints_12_24);
1184 return 0;
1185}
1186
1187/* SNDRV_PCM_RATE_KNOT -> 12000, 24000 Hz, limit with constraint list */
1188#define CS42L73_RATES (SNDRV_PCM_RATE_8000_48000 | SNDRV_PCM_RATE_KNOT)
1189
1190
1191#define CS42L73_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\
1192 SNDRV_PCM_FMTBIT_S24_LE)
1193
1194static const struct snd_soc_dai_ops cs42l73_ops = {
1195 .startup = cs42l73_pcm_startup,
1196 .hw_params = cs42l73_pcm_hw_params,
1197 .set_fmt = cs42l73_set_dai_fmt,
1198 .set_sysclk = cs42l73_set_sysclk,
1199 .set_tristate = cs42l73_set_tristate,
1200};
1201
1202static struct snd_soc_dai_driver cs42l73_dai[] = {
1203 {
1204 .name = "cs42l73-xsp",
1205 .id = CS42L73_XSP,
1206 .playback = {
1207 .stream_name = "XSP Playback",
1208 .channels_min = 1,
1209 .channels_max = 2,
1210 .rates = CS42L73_RATES,
1211 .formats = CS42L73_FORMATS,
1212 },
1213 .capture = {
1214 .stream_name = "XSP Capture",
1215 .channels_min = 1,
1216 .channels_max = 2,
1217 .rates = CS42L73_RATES,
1218 .formats = CS42L73_FORMATS,
1219 },
1220 .ops = &cs42l73_ops,
1221 .symmetric_rates = 1,
1222 },
1223 {
1224 .name = "cs42l73-asp",
1225 .id = CS42L73_ASP,
1226 .playback = {
1227 .stream_name = "ASP Playback",
1228 .channels_min = 2,
1229 .channels_max = 2,
1230 .rates = CS42L73_RATES,
1231 .formats = CS42L73_FORMATS,
1232 },
1233 .capture = {
1234 .stream_name = "ASP Capture",
1235 .channels_min = 2,
1236 .channels_max = 2,
1237 .rates = CS42L73_RATES,
1238 .formats = CS42L73_FORMATS,
1239 },
1240 .ops = &cs42l73_ops,
1241 .symmetric_rates = 1,
1242 },
1243 {
1244 .name = "cs42l73-vsp",
1245 .id = CS42L73_VSP,
1246 .playback = {
1247 .stream_name = "VSP Playback",
1248 .channels_min = 1,
1249 .channels_max = 2,
1250 .rates = CS42L73_RATES,
1251 .formats = CS42L73_FORMATS,
1252 },
1253 .capture = {
1254 .stream_name = "VSP Capture",
1255 .channels_min = 1,
1256 .channels_max = 2,
1257 .rates = CS42L73_RATES,
1258 .formats = CS42L73_FORMATS,
1259 },
1260 .ops = &cs42l73_ops,
1261 .symmetric_rates = 1,
1262 }
1263};
1264
1265static int cs42l73_suspend(struct snd_soc_codec *codec)
1266{
1267 cs42l73_set_bias_level(codec, SND_SOC_BIAS_OFF);
1268
1269 return 0;
1270}
1271
1272static int cs42l73_resume(struct snd_soc_codec *codec)
1273{
1274 cs42l73_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
1275 return 0;
1276}
1277
1278static int cs42l73_probe(struct snd_soc_codec *codec)
1279{
1280 int ret;
1281 struct cs42l73_private *cs42l73 = snd_soc_codec_get_drvdata(codec);
1282
1283 codec->control_data = cs42l73->regmap;
1284
1285 ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_REGMAP);
1286 if (ret < 0) {
1287 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
1288 return ret;
1289 }
1290
1291 regcache_cache_only(cs42l73->regmap, true);
1292
1293 cs42l73_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
1294
1295 cs42l73->mclksel = CS42L73_CLKID_MCLK1; /* MCLK1 as master clk */
1296 cs42l73->mclk = 0;
1297
1298 return ret;
1299}
1300
1301static int cs42l73_remove(struct snd_soc_codec *codec)
1302{
1303 cs42l73_set_bias_level(codec, SND_SOC_BIAS_OFF);
1304 return 0;
1305}
1306
1307static struct snd_soc_codec_driver soc_codec_dev_cs42l73 = {
1308 .probe = cs42l73_probe,
1309 .remove = cs42l73_remove,
1310 .suspend = cs42l73_suspend,
1311 .resume = cs42l73_resume,
1312 .set_bias_level = cs42l73_set_bias_level,
1313
1314 .dapm_widgets = cs42l73_dapm_widgets,
1315 .num_dapm_widgets = ARRAY_SIZE(cs42l73_dapm_widgets),
1316 .dapm_routes = cs42l73_audio_map,
1317 .num_dapm_routes = ARRAY_SIZE(cs42l73_audio_map),
1318
1319 .controls = cs42l73_snd_controls,
1320 .num_controls = ARRAY_SIZE(cs42l73_snd_controls),
1321};
1322
1323static struct regmap_config cs42l73_regmap = {
1324 .reg_bits = 8,
1325 .val_bits = 8,
1326
1327 .max_register = CS42L73_MAX_REGISTER,
1328 .reg_defaults = cs42l73_reg_defaults,
1329 .num_reg_defaults = ARRAY_SIZE(cs42l73_reg_defaults),
1330 .volatile_reg = cs42l73_volatile_register,
1331 .readable_reg = cs42l73_readable_register,
1332 .cache_type = REGCACHE_RBTREE,
1333};
1334
1335static __devinit int cs42l73_i2c_probe(struct i2c_client *i2c_client,
1336 const struct i2c_device_id *id)
1337{
1338 struct cs42l73_private *cs42l73;
1339 int ret;
1340 unsigned int devid = 0;
1341 unsigned int reg;
1342
1343 cs42l73 = devm_kzalloc(&i2c_client->dev, sizeof(struct cs42l73_private),
1344 GFP_KERNEL);
1345 if (!cs42l73) {
1346 dev_err(&i2c_client->dev, "could not allocate codec\n");
1347 return -ENOMEM;
1348 }
1349
1350 i2c_set_clientdata(i2c_client, cs42l73);
1351
1352 cs42l73->regmap = regmap_init_i2c(i2c_client, &cs42l73_regmap);
1353 if (IS_ERR(cs42l73->regmap)) {
1354 ret = PTR_ERR(cs42l73->regmap);
1355 dev_err(&i2c_client->dev, "regmap_init() failed: %d\n", ret);
1356 goto err;
1357 }
1358 /* initialize codec */
1359 ret = regmap_read(cs42l73->regmap, CS42L73_DEVID_AB, &reg);
1360 devid = (reg & 0xFF) << 12;
1361
1362 ret = regmap_read(cs42l73->regmap, CS42L73_DEVID_CD, &reg);
1363 devid |= (reg & 0xFF) << 4;
1364
1365 ret = regmap_read(cs42l73->regmap, CS42L73_DEVID_E, &reg);
1366 devid |= (reg & 0xF0) >> 4;
1367
1368
1369 if (devid != CS42L73_DEVID) {
1370 ret = -ENODEV;
1371 dev_err(&i2c_client->dev,
1372 "CS42L73 Device ID (%X). Expected %X\n",
1373 devid, CS42L73_DEVID);
1374 goto err_regmap;
1375 }
1376
1377 ret = regmap_read(cs42l73->regmap, CS42L73_REVID, &reg);
1378 if (ret < 0) {
1379 dev_err(&i2c_client->dev, "Get Revision ID failed\n");
1380 goto err_regmap;
1381 }
1382
1383 dev_info(&i2c_client->dev,
1384 "Cirrus Logic CS42L73, Revision: %02X\n", reg & 0xFF);
1385
1386 regcache_cache_only(cs42l73->regmap, true);
1387
1388 ret = snd_soc_register_codec(&i2c_client->dev,
1389 &soc_codec_dev_cs42l73, cs42l73_dai,
1390 ARRAY_SIZE(cs42l73_dai));
1391 if (ret < 0)
1392 goto err_regmap;
1393 return 0;
1394
1395err_regmap:
1396 regmap_exit(cs42l73->regmap);
1397
1398err:
1399 return ret;
1400}
1401
1402static __devexit int cs42l73_i2c_remove(struct i2c_client *client)
1403{
1404 struct cs42l73_private *cs42l73 = i2c_get_clientdata(client);
1405
1406 snd_soc_unregister_codec(&client->dev);
1407 regmap_exit(cs42l73->regmap);
1408
1409 return 0;
1410}
1411
1412static const struct i2c_device_id cs42l73_id[] = {
1413 {"cs42l73", 0},
1414 {}
1415};
1416
1417MODULE_DEVICE_TABLE(i2c, cs42l73_id);
1418
1419static struct i2c_driver cs42l73_i2c_driver = {
1420 .driver = {
1421 .name = "cs42l73",
1422 .owner = THIS_MODULE,
1423 },
1424 .id_table = cs42l73_id,
1425 .probe = cs42l73_i2c_probe,
1426 .remove = __devexit_p(cs42l73_i2c_remove),
1427
1428};
1429
1430static int __init cs42l73_modinit(void)
1431{
1432 int ret;
1433 ret = i2c_add_driver(&cs42l73_i2c_driver);
1434 if (ret != 0) {
1435 pr_err("Failed to register CS42L73 I2C driver: %d\n", ret);
1436 return ret;
1437 }
1438 return 0;
1439}
1440
1441module_init(cs42l73_modinit);
1442
1443static void __exit cs42l73_exit(void)
1444{
1445 i2c_del_driver(&cs42l73_i2c_driver);
1446}
1447
1448module_exit(cs42l73_exit);
1449
1450MODULE_DESCRIPTION("ASoC CS42L73 driver");
1451MODULE_AUTHOR("Georgi Vlaev, Nucleus Systems Ltd, <joe@nucleusys.com>");
1452MODULE_AUTHOR("Brian Austin, Cirrus Logic Inc, <brian.austin@cirrus.com>");
1453MODULE_LICENSE("GPL");
diff --git a/sound/soc/codecs/cs42l73.h b/sound/soc/codecs/cs42l73.h
new file mode 100644
index 00000000000..f30a4c4d62e
--- /dev/null
+++ b/sound/soc/codecs/cs42l73.h
@@ -0,0 +1,227 @@
1/*
2 * ALSA SoC CS42L73 codec driver
3 *
4 * Copyright 2011 Cirrus Logic, Inc.
5 *
6 * Author: Georgi Vlaev <joe@nucleusys.com>
7 * Brian Austin <brian.austin@cirrus.com>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * version 2 as published by the Free Software Foundation.
12 *
13 * This program is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
21 * 02110-1301 USA
22 *
23 */
24
25#ifndef __CS42L73_H__
26#define __CS42L73_H__
27
28/* I2C Registers */
29/* I2C Address: 1001010[R/W] - 10010100 = 0x94(Write); 10010101 = 0x95(Read) */
30#define CS42L73_CHIP_ID 0x4a
31#define CS42L73_DEVID_AB 0x01 /* Device ID A & B [RO]. */
32#define CS42L73_DEVID_CD 0x02 /* Device ID C & D [RO]. */
33#define CS42L73_DEVID_E 0x03 /* Device ID E [RO]. */
34#define CS42L73_REVID 0x05 /* Revision ID [RO]. */
35#define CS42L73_PWRCTL1 0x06 /* Power Control 1. */
36#define CS42L73_PWRCTL2 0x07 /* Power Control 2. */
37#define CS42L73_PWRCTL3 0x08 /* Power Control 3. */
38#define CS42L73_CPFCHC 0x09 /* Charge Pump Freq. Class H Ctl. */
39#define CS42L73_OLMBMSDC 0x0A /* Output Load, MIC Bias, MIC2 SDT */
40#define CS42L73_DMMCC 0x0B /* Digital MIC & Master Clock Ctl. */
41#define CS42L73_XSPC 0x0C /* Auxiliary Serial Port (XSP) Ctl. */
42#define CS42L73_XSPMMCC 0x0D /* XSP Master Mode Clocking Control. */
43#define CS42L73_ASPC 0x0E /* Audio Serial Port (ASP) Control. */
44#define CS42L73_ASPMMCC 0x0F /* ASP Master Mode Clocking Control. */
45#define CS42L73_VSPC 0x10 /* Voice Serial Port (VSP) Control. */
46#define CS42L73_VSPMMCC 0x11 /* VSP Master Mode Clocking Control. */
47#define CS42L73_VXSPFS 0x12 /* VSP & XSP Sample Rate. */
48#define CS42L73_MIOPC 0x13 /* Misc. Input & Output Path Control. */
49#define CS42L73_ADCIPC 0x14 /* ADC/IP Control. */
50#define CS42L73_MICAPREPGAAVOL 0x15 /* MIC 1 [A] PreAmp, PGAA Vol. */
51#define CS42L73_MICBPREPGABVOL 0x16 /* MIC 2 [B] PreAmp, PGAB Vol. */
52#define CS42L73_IPADVOL 0x17 /* Input Pat7h A Digital Volume. */
53#define CS42L73_IPBDVOL 0x18 /* Input Path B Digital Volume. */
54#define CS42L73_PBDC 0x19 /* Playback Digital Control. */
55#define CS42L73_HLADVOL 0x1A /* HP/Line A Out Digital Vol. */
56#define CS42L73_HLBDVOL 0x1B /* HP/Line B Out Digital Vol. */
57#define CS42L73_SPKDVOL 0x1C /* Spkphone Out [A] Digital Vol. */
58#define CS42L73_ESLDVOL 0x1D /* Ear/Spkphone LO [B] Digital */
59#define CS42L73_HPAAVOL 0x1E /* HP A Analog Volume. */
60#define CS42L73_HPBAVOL 0x1F /* HP B Analog Volume. */
61#define CS42L73_LOAAVOL 0x20 /* Line Out A Analog Volume. */
62#define CS42L73_LOBAVOL 0x21 /* Line Out B Analog Volume. */
63#define CS42L73_STRINV 0x22 /* Stereo Input Path Adv. Vol. */
64#define CS42L73_XSPINV 0x23 /* Auxiliary Port Input Advisory Vol. */
65#define CS42L73_ASPINV 0x24 /* Audio Port Input Advisory Vol. */
66#define CS42L73_VSPINV 0x25 /* Voice Port Input Advisory Vol. */
67#define CS42L73_LIMARATEHL 0x26 /* Lmtr Attack Rate HP/Line. */
68#define CS42L73_LIMRRATEHL 0x27 /* Lmtr Ctl, Rel.Rate HP/Line. */
69#define CS42L73_LMAXHL 0x28 /* Lmtr Thresholds HP/Line. */
70#define CS42L73_LIMARATESPK 0x29 /* Lmtr Attack Rate Spkphone [A]. */
71#define CS42L73_LIMRRATESPK 0x2A /* Lmtr Ctl,Release Rate Spk. [A]. */
72#define CS42L73_LMAXSPK 0x2B /* Lmtr Thresholds Spkphone [A]. */
73#define CS42L73_LIMARATEESL 0x2C /* Lmtr Attack Rate */
74#define CS42L73_LIMRRATEESL 0x2D /* Lmtr Ctl,Release Rate */
75#define CS42L73_LMAXESL 0x2E /* Lmtr Thresholds */
76#define CS42L73_ALCARATE 0x2F /* ALC Enable, Attack Rate AB. */
77#define CS42L73_ALCRRATE 0x30 /* ALC Release Rate AB. */
78#define CS42L73_ALCMINMAX 0x31 /* ALC Thresholds AB. */
79#define CS42L73_NGCAB 0x32 /* Noise Gate Ctl AB. */
80#define CS42L73_ALCNGMC 0x33 /* ALC & Noise Gate Misc Ctl. */
81#define CS42L73_MIXERCTL 0x34 /* Mixer Control. */
82#define CS42L73_HLAIPAA 0x35 /* HP/LO Left Mixer: L. */
83#define CS42L73_HLBIPBA 0x36 /* HP/LO Right Mixer: R. */
84#define CS42L73_HLAXSPAA 0x37 /* HP/LO Left Mixer: XSP L */
85#define CS42L73_HLBXSPBA 0x38 /* HP/LO Right Mixer: XSP R */
86#define CS42L73_HLAASPAA 0x39 /* HP/LO Left Mixer: ASP L */
87#define CS42L73_HLBASPBA 0x3A /* HP/LO Right Mixer: ASP R */
88#define CS42L73_HLAVSPMA 0x3B /* HP/LO Left Mixer: VSP. */
89#define CS42L73_HLBVSPMA 0x3C /* HP/LO Right Mixer: VSP */
90#define CS42L73_XSPAIPAA 0x3D /* XSP Left Mixer: Left */
91#define CS42L73_XSPBIPBA 0x3E /* XSP Rt. Mixer: Right */
92#define CS42L73_XSPAXSPAA 0x3F /* XSP Left Mixer: XSP L */
93#define CS42L73_XSPBXSPBA 0x40 /* XSP Rt. Mixer: XSP R */
94#define CS42L73_XSPAASPAA 0x41 /* XSP Left Mixer: ASP L */
95#define CS42L73_XSPAASPBA 0x42 /* XSP Rt. Mixer: ASP R */
96#define CS42L73_XSPAVSPMA 0x43 /* XSP Left Mixer: VSP */
97#define CS42L73_XSPBVSPMA 0x44 /* XSP Rt. Mixer: VSP */
98#define CS42L73_ASPAIPAA 0x45 /* ASP Left Mixer: Left */
99#define CS42L73_ASPBIPBA 0x46 /* ASP Rt. Mixer: Right */
100#define CS42L73_ASPAXSPAA 0x47 /* ASP Left Mixer: XSP L */
101#define CS42L73_ASPBXSPBA 0x48 /* ASP Rt. Mixer: XSP R */
102#define CS42L73_ASPAASPAA 0x49 /* ASP Left Mixer: ASP L */
103#define CS42L73_ASPBASPBA 0x4A /* ASP Rt. Mixer: ASP R */
104#define CS42L73_ASPAVSPMA 0x4B /* ASP Left Mixer: VSP */
105#define CS42L73_ASPBVSPMA 0x4C /* ASP Rt. Mixer: VSP */
106#define CS42L73_VSPAIPAA 0x4D /* VSP Left Mixer: Left */
107#define CS42L73_VSPBIPBA 0x4E /* VSP Rt. Mixer: Right */
108#define CS42L73_VSPAXSPAA 0x4F /* VSP Left Mixer: XSP L */
109#define CS42L73_VSPBXSPBA 0x50 /* VSP Rt. Mixer: XSP R */
110#define CS42L73_VSPAASPAA 0x51 /* VSP Left Mixer: ASP Left */
111#define CS42L73_VSPBASPBA 0x52 /* VSP Rt. Mixer: ASP Right */
112#define CS42L73_VSPAVSPMA 0x53 /* VSP Left Mixer: VSP */
113#define CS42L73_VSPBVSPMA 0x54 /* VSP Rt. Mixer: VSP */
114#define CS42L73_MMIXCTL 0x55 /* Mono Mixer Controls. */
115#define CS42L73_SPKMIPMA 0x56 /* SPK Mono Mixer: In. Path */
116#define CS42L73_SPKMXSPA 0x57 /* SPK Mono Mixer: XSP Mono/L/R Att. */
117#define CS42L73_SPKMASPA 0x58 /* SPK Mono Mixer: ASP Mono/L/R Att. */
118#define CS42L73_SPKMVSPMA 0x59 /* SPK Mono Mixer: VSP Mono Atten. */
119#define CS42L73_ESLMIPMA 0x5A /* Ear/SpLO Mono Mixer: */
120#define CS42L73_ESLMXSPA 0x5B /* Ear/SpLO Mono Mixer: XSP */
121#define CS42L73_ESLMASPA 0x5C /* Ear/SpLO Mono Mixer: ASP */
122#define CS42L73_ESLMVSPMA 0x5D /* Ear/SpLO Mono Mixer: VSP */
123#define CS42L73_IM1 0x5E /* Interrupt Mask 1. */
124#define CS42L73_IM2 0x5F /* Interrupt Mask 2. */
125#define CS42L73_IS1 0x60 /* Interrupt Status 1 [RO]. */
126#define CS42L73_IS2 0x61 /* Interrupt Status 2 [RO]. */
127#define CS42L73_MAX_REGISTER 0x61 /* Total Registers */
128/* Bitfield Definitions */
129
130/* CS42L73_PWRCTL1 */
131#define PDN_ADCB (1 << 7)
132#define PDN_DMICB (1 << 6)
133#define PDN_ADCA (1 << 5)
134#define PDN_DMICA (1 << 4)
135#define PDN_LDO (1 << 2)
136#define DISCHG_FILT (1 << 1)
137#define PDN (1 << 0)
138
139/* CS42L73_PWRCTL2 */
140#define PDN_MIC2_BIAS (1 << 7)
141#define PDN_MIC1_BIAS (1 << 6)
142#define PDN_VSP (1 << 4)
143#define PDN_ASP_SDOUT (1 << 3)
144#define PDN_ASP_SDIN (1 << 2)
145#define PDN_XSP_SDOUT (1 << 1)
146#define PDN_XSP_SDIN (1 << 0)
147
148/* CS42L73_PWRCTL3 */
149#define PDN_THMS (1 << 5)
150#define PDN_SPKLO (1 << 4)
151#define PDN_EAR (1 << 3)
152#define PDN_SPK (1 << 2)
153#define PDN_LO (1 << 1)
154#define PDN_HP (1 << 0)
155
156/* Thermal Overload Detect. Requires interrupt ... */
157#define THMOVLD_150C 0
158#define THMOVLD_132C 1
159#define THMOVLD_115C 2
160#define THMOVLD_098C 3
161
162
163/* CS42L73_ASPC, CS42L73_XSPC, CS42L73_VSPC */
164#define SP_3ST (1 << 7)
165#define SPDIF_I2S (0 << 6)
166#define SPDIF_PCM (1 << 6)
167#define PCM_MODE0 (0 << 4)
168#define PCM_MODE1 (1 << 4)
169#define PCM_MODE2 (2 << 4)
170#define PCM_MODE_MASK (3 << 4)
171#define PCM_BIT_ORDER (1 << 3)
172#define MCK_SCLK_64FS (0 << 0)
173#define MCK_SCLK_MCLK (2 << 0)
174#define MCK_SCLK_PREMCLK (3 << 0)
175
176/* CS42L73_xSPMMCC */
177#define MS_MASTER (1 << 7)
178
179
180/* CS42L73_DMMCC */
181#define MCLKDIS (1 << 0)
182#define MCLKSEL_MCLK2 (1 << 4)
183#define MCLKSEL_MCLK1 (0 << 4)
184
185/* CS42L73 MCLK derived from MCLK1 or MCLK2 */
186#define CS42L73_CLKID_MCLK1 0
187#define CS42L73_CLKID_MCLK2 1
188
189#define CS42L73_MCLKXDIV 0
190#define CS42L73_MMCCDIV 1
191
192#define CS42L73_XSP 0
193#define CS42L73_ASP 1
194#define CS42L73_VSP 2
195
196/* IS1, IM1 */
197#define MIC2_SDET (1 << 6)
198#define THMOVLD (1 << 4)
199#define DIGMIXOVFL (1 << 3)
200#define IPBOVFL (1 << 1)
201#define IPAOVFL (1 << 0)
202
203/* Analog Softramp */
204#define ANLGOSFT (1 << 0)
205
206/* HP A/B Analog Mute */
207#define HPA_MUTE (1 << 7)
208/* LO A/B Analog Mute */
209#define LOA_MUTE (1 << 7)
210/* Digital Mute */
211#define HLAD_MUTE (1 << 0)
212#define HLBD_MUTE (1 << 1)
213#define SPKD_MUTE (1 << 2)
214#define ESLD_MUTE (1 << 3)
215
216/* Misc defines for codec */
217#define CS42L73_RESET_GPIO 143
218
219#define CS42L73_DEVID 0x00042A73
220#define CS42L73_MCLKX_MIN 5644800
221#define CS42L73_MCLKX_MAX 38400000
222
223#define CS42L73_SPC(id) (CS42L73_XSPC + (id << 1))
224#define CS42L73_MMCC(id) (CS42L73_XSPMMCC + (id << 1))
225#define CS42L73_SPFS(id) ((id == CS42L73_ASP) ? CS42L73_ASPC : CS42L73_VXSPFS)
226
227#endif /* __CS42L73_H__ */
diff --git a/sound/soc/codecs/cx20442.c b/sound/soc/codecs/cx20442.c
index bc7067db8ae..d5fd00a6474 100644
--- a/sound/soc/codecs/cx20442.c
+++ b/sound/soc/codecs/cx20442.c
@@ -16,6 +16,7 @@
16#include <linux/tty.h> 16#include <linux/tty.h>
17#include <linux/slab.h> 17#include <linux/slab.h>
18#include <linux/module.h> 18#include <linux/module.h>
19#include <linux/regulator/consumer.h>
19 20
20#include <sound/core.h> 21#include <sound/core.h>
21#include <sound/initval.h> 22#include <sound/initval.h>
@@ -25,8 +26,8 @@
25 26
26 27
27struct cx20442_priv { 28struct cx20442_priv {
28 enum snd_soc_control_type control_type;
29 void *control_data; 29 void *control_data;
30 struct regulator *por;
30}; 31};
31 32
32#define CX20442_PM 0x0 33#define CX20442_PM 0x0
@@ -324,6 +325,38 @@ static struct snd_soc_dai_driver cx20442_dai = {
324 }, 325 },
325}; 326};
326 327
328static int cx20442_set_bias_level(struct snd_soc_codec *codec,
329 enum snd_soc_bias_level level)
330{
331 struct cx20442_priv *cx20442 = snd_soc_codec_get_drvdata(codec);
332 int err = 0;
333
334 switch (level) {
335 case SND_SOC_BIAS_PREPARE:
336 if (codec->dapm.bias_level != SND_SOC_BIAS_STANDBY)
337 break;
338 if (IS_ERR(cx20442->por))
339 err = PTR_ERR(cx20442->por);
340 else
341 err = regulator_enable(cx20442->por);
342 break;
343 case SND_SOC_BIAS_STANDBY:
344 if (codec->dapm.bias_level != SND_SOC_BIAS_PREPARE)
345 break;
346 if (IS_ERR(cx20442->por))
347 err = PTR_ERR(cx20442->por);
348 else
349 err = regulator_disable(cx20442->por);
350 break;
351 default:
352 break;
353 }
354 if (!err)
355 codec->dapm.bias_level = level;
356
357 return err;
358}
359
327static int cx20442_codec_probe(struct snd_soc_codec *codec) 360static int cx20442_codec_probe(struct snd_soc_codec *codec)
328{ 361{
329 struct cx20442_priv *cx20442; 362 struct cx20442_priv *cx20442;
@@ -331,9 +364,13 @@ static int cx20442_codec_probe(struct snd_soc_codec *codec)
331 cx20442 = kzalloc(sizeof(struct cx20442_priv), GFP_KERNEL); 364 cx20442 = kzalloc(sizeof(struct cx20442_priv), GFP_KERNEL);
332 if (cx20442 == NULL) 365 if (cx20442 == NULL)
333 return -ENOMEM; 366 return -ENOMEM;
334 snd_soc_codec_set_drvdata(codec, cx20442);
335 367
368 cx20442->por = regulator_get(codec->dev, "POR");
369 if (IS_ERR(cx20442->por))
370 dev_warn(codec->dev, "failed to get the regulator");
336 cx20442->control_data = NULL; 371 cx20442->control_data = NULL;
372
373 snd_soc_codec_set_drvdata(codec, cx20442);
337 codec->hw_write = NULL; 374 codec->hw_write = NULL;
338 codec->card->pop_time = 0; 375 codec->card->pop_time = 0;
339 376
@@ -350,6 +387,12 @@ static int cx20442_codec_remove(struct snd_soc_codec *codec)
350 tty_hangup(tty); 387 tty_hangup(tty);
351 } 388 }
352 389
390 if (!IS_ERR(cx20442->por)) {
391 /* should be already in STANDBY, hence disabled */
392 regulator_put(cx20442->por);
393 }
394
395 snd_soc_codec_set_drvdata(codec, NULL);
353 kfree(cx20442); 396 kfree(cx20442);
354 return 0; 397 return 0;
355} 398}
@@ -359,6 +402,7 @@ static const u8 cx20442_reg;
359static struct snd_soc_codec_driver cx20442_codec_dev = { 402static struct snd_soc_codec_driver cx20442_codec_dev = {
360 .probe = cx20442_codec_probe, 403 .probe = cx20442_codec_probe,
361 .remove = cx20442_codec_remove, 404 .remove = cx20442_codec_remove,
405 .set_bias_level = cx20442_set_bias_level,
362 .reg_cache_default = &cx20442_reg, 406 .reg_cache_default = &cx20442_reg,
363 .reg_cache_size = 1, 407 .reg_cache_size = 1,
364 .reg_word_size = sizeof(u8), 408 .reg_word_size = sizeof(u8),
@@ -391,17 +435,7 @@ static struct platform_driver cx20442_platform_driver = {
391 .remove = __exit_p(cx20442_platform_remove), 435 .remove = __exit_p(cx20442_platform_remove),
392}; 436};
393 437
394static int __init cx20442_init(void) 438module_platform_driver(cx20442_platform_driver);
395{
396 return platform_driver_register(&cx20442_platform_driver);
397}
398module_init(cx20442_init);
399
400static void __exit cx20442_exit(void)
401{
402 platform_driver_unregister(&cx20442_platform_driver);
403}
404module_exit(cx20442_exit);
405 439
406MODULE_DESCRIPTION("ASoC CX20442-11 voice modem codec driver"); 440MODULE_DESCRIPTION("ASoC CX20442-11 voice modem codec driver");
407MODULE_AUTHOR("Janusz Krzysztofik"); 441MODULE_AUTHOR("Janusz Krzysztofik");
diff --git a/sound/soc/codecs/da7210.c b/sound/soc/codecs/da7210.c
index b545b7d3722..ab38e93c354 100644
--- a/sound/soc/codecs/da7210.c
+++ b/sound/soc/codecs/da7210.c
@@ -17,7 +17,6 @@
17 17
18#include <linux/delay.h> 18#include <linux/delay.h>
19#include <linux/i2c.h> 19#include <linux/i2c.h>
20#include <linux/platform_device.h>
21#include <linux/slab.h> 20#include <linux/slab.h>
22#include <linux/module.h> 21#include <linux/module.h>
23#include <sound/pcm.h> 22#include <sound/pcm.h>
@@ -182,9 +181,14 @@
182 181
183/* AUX1_L bit fields */ 182/* AUX1_L bit fields */
184#define DA7210_AUX1_L_VOL (0x3F << 0) 183#define DA7210_AUX1_L_VOL (0x3F << 0)
184#define DA7210_AUX1_L_EN (1 << 7)
185 185
186/* AUX1_R bit fields */ 186/* AUX1_R bit fields */
187#define DA7210_AUX1_R_VOL (0x3F << 0) 187#define DA7210_AUX1_R_VOL (0x3F << 0)
188#define DA7210_AUX1_R_EN (1 << 7)
189
190/* AUX2 bit fields */
191#define DA7210_AUX2_EN (1 << 3)
188 192
189/* Minimum INPGA and AUX1 volume to enable noise suppression */ 193/* Minimum INPGA and AUX1 volume to enable noise suppression */
190#define DA7210_INPGA_MIN_VOL_NS 0x0A /* 10.5dB */ 194#define DA7210_INPGA_MIN_VOL_NS 0x0A /* 10.5dB */
@@ -235,12 +239,22 @@ static const unsigned int mono_vol_tlv[] = {
235 0x3, 0x7, TLV_DB_SCALE_ITEM(-1800, 600, 0) 239 0x3, 0x7, TLV_DB_SCALE_ITEM(-1800, 600, 0)
236}; 240};
237 241
242static const unsigned int aux1_vol_tlv[] = {
243 TLV_DB_RANGE_HEAD(2),
244 0x0, 0x10, TLV_DB_SCALE_ITEM(TLV_DB_GAIN_MUTE, 0, 1),
245 /* -48dB to 21dB */
246 0x11, 0x3f, TLV_DB_SCALE_ITEM(-4800, 150, 0)
247};
248
238static const DECLARE_TLV_DB_SCALE(eq_gain_tlv, -1050, 150, 0); 249static const DECLARE_TLV_DB_SCALE(eq_gain_tlv, -1050, 150, 0);
239static const DECLARE_TLV_DB_SCALE(adc_eq_master_gain_tlv, -1800, 600, 1); 250static const DECLARE_TLV_DB_SCALE(adc_eq_master_gain_tlv, -1800, 600, 1);
240static const DECLARE_TLV_DB_SCALE(dac_gain_tlv, -7725, 75, 0); 251static const DECLARE_TLV_DB_SCALE(dac_gain_tlv, -7725, 75, 0);
252static const DECLARE_TLV_DB_SCALE(mic_vol_tlv, -600, 600, 0);
253static const DECLARE_TLV_DB_SCALE(aux2_vol_tlv, -600, 600, 0);
254static const DECLARE_TLV_DB_SCALE(inpga_gain_tlv, -450, 150, 0);
241 255
242/* ADC and DAC high pass filter f0 value */ 256/* ADC and DAC high pass filter f0 value */
243static const char const *da7210_hpf_cutoff_txt[] = { 257static const char * const da7210_hpf_cutoff_txt[] = {
244 "Fs/8192*pi", "Fs/4096*pi", "Fs/2048*pi", "Fs/1024*pi" 258 "Fs/8192*pi", "Fs/4096*pi", "Fs/2048*pi", "Fs/1024*pi"
245}; 259};
246 260
@@ -251,7 +265,7 @@ static const struct soc_enum da7210_adc_hpf_cutoff =
251 SOC_ENUM_SINGLE(DA7210_ADC_HPF, 0, 4, da7210_hpf_cutoff_txt); 265 SOC_ENUM_SINGLE(DA7210_ADC_HPF, 0, 4, da7210_hpf_cutoff_txt);
252 266
253/* ADC and DAC voice (8kHz) high pass cutoff value */ 267/* ADC and DAC voice (8kHz) high pass cutoff value */
254static const char const *da7210_vf_cutoff_txt[] = { 268static const char * const da7210_vf_cutoff_txt[] = {
255 "2.5Hz", "25Hz", "50Hz", "100Hz", "150Hz", "200Hz", "300Hz", "400Hz" 269 "2.5Hz", "25Hz", "50Hz", "100Hz", "150Hz", "200Hz", "300Hz", "400Hz"
256}; 270};
257 271
@@ -345,6 +359,17 @@ static const struct snd_kcontrol_new da7210_snd_controls[] = {
345 SOC_SINGLE_TLV("Mono Playback Volume", DA7210_OUT2, 0, 0x7, 0, 359 SOC_SINGLE_TLV("Mono Playback Volume", DA7210_OUT2, 0, 0x7, 0,
346 mono_vol_tlv), 360 mono_vol_tlv),
347 361
362 SOC_DOUBLE_R_TLV("Mic Capture Volume",
363 DA7210_MIC_L, DA7210_MIC_R,
364 0, 0x5, 0, mic_vol_tlv),
365 SOC_DOUBLE_R_TLV("Aux1 Capture Volume",
366 DA7210_AUX1_L, DA7210_AUX1_R,
367 0, 0x3f, 0, aux1_vol_tlv),
368 SOC_SINGLE_TLV("Aux2 Capture Volume", DA7210_AUX2, 0, 0x3, 0,
369 aux2_vol_tlv),
370 SOC_DOUBLE_TLV("In PGA Capture Volume", DA7210_IN_GAIN, 0, 4, 0xF, 0,
371 inpga_gain_tlv),
372
348 /* DAC Equalizer controls */ 373 /* DAC Equalizer controls */
349 SOC_SINGLE("DAC EQ Switch", DA7210_DAC_EQ5, 7, 1, 0), 374 SOC_SINGLE("DAC EQ Switch", DA7210_DAC_EQ5, 7, 1, 0),
350 SOC_SINGLE_TLV("DAC EQ1 Volume", DA7210_DAC_EQ1_2, 0, 0xf, 1, 375 SOC_SINGLE_TLV("DAC EQ1 Volume", DA7210_DAC_EQ1_2, 0, 0xf, 1,
@@ -422,26 +447,42 @@ static const struct snd_kcontrol_new da7210_snd_controls[] = {
422static const struct snd_kcontrol_new da7210_dapm_inmixl_controls[] = { 447static const struct snd_kcontrol_new da7210_dapm_inmixl_controls[] = {
423 SOC_DAPM_SINGLE("Mic Left Switch", DA7210_INMIX_L, 0, 1, 0), 448 SOC_DAPM_SINGLE("Mic Left Switch", DA7210_INMIX_L, 0, 1, 0),
424 SOC_DAPM_SINGLE("Mic Right Switch", DA7210_INMIX_L, 1, 1, 0), 449 SOC_DAPM_SINGLE("Mic Right Switch", DA7210_INMIX_L, 1, 1, 0),
450 SOC_DAPM_SINGLE("Aux1 Left Switch", DA7210_INMIX_L, 2, 1, 0),
451 SOC_DAPM_SINGLE("Aux2 Switch", DA7210_INMIX_L, 3, 1, 0),
452 SOC_DAPM_SINGLE("Outmix Left Switch", DA7210_INMIX_L, 4, 1, 0),
425}; 453};
426 454
427/* In Mixer Right */ 455/* In Mixer Right */
428static const struct snd_kcontrol_new da7210_dapm_inmixr_controls[] = { 456static const struct snd_kcontrol_new da7210_dapm_inmixr_controls[] = {
429 SOC_DAPM_SINGLE("Mic Right Switch", DA7210_INMIX_R, 0, 1, 0), 457 SOC_DAPM_SINGLE("Mic Right Switch", DA7210_INMIX_R, 0, 1, 0),
430 SOC_DAPM_SINGLE("Mic Left Switch", DA7210_INMIX_R, 1, 1, 0), 458 SOC_DAPM_SINGLE("Mic Left Switch", DA7210_INMIX_R, 1, 1, 0),
459 SOC_DAPM_SINGLE("Aux1 Right Switch", DA7210_INMIX_R, 2, 1, 0),
460 SOC_DAPM_SINGLE("Aux2 Switch", DA7210_INMIX_R, 3, 1, 0),
461 SOC_DAPM_SINGLE("Outmix Right Switch", DA7210_INMIX_R, 4, 1, 0),
431}; 462};
432 463
433/* Out Mixer Left */ 464/* Out Mixer Left */
434static const struct snd_kcontrol_new da7210_dapm_outmixl_controls[] = { 465static const struct snd_kcontrol_new da7210_dapm_outmixl_controls[] = {
466 SOC_DAPM_SINGLE("Aux1 Left Switch", DA7210_OUTMIX_L, 0, 1, 0),
467 SOC_DAPM_SINGLE("Aux2 Switch", DA7210_OUTMIX_L, 1, 1, 0),
468 SOC_DAPM_SINGLE("INPGA Left Switch", DA7210_OUTMIX_L, 2, 1, 0),
469 SOC_DAPM_SINGLE("INPGA Right Switch", DA7210_OUTMIX_L, 3, 1, 0),
435 SOC_DAPM_SINGLE("DAC Left Switch", DA7210_OUTMIX_L, 4, 1, 0), 470 SOC_DAPM_SINGLE("DAC Left Switch", DA7210_OUTMIX_L, 4, 1, 0),
436}; 471};
437 472
438/* Out Mixer Right */ 473/* Out Mixer Right */
439static const struct snd_kcontrol_new da7210_dapm_outmixr_controls[] = { 474static const struct snd_kcontrol_new da7210_dapm_outmixr_controls[] = {
475 SOC_DAPM_SINGLE("Aux1 Right Switch", DA7210_OUTMIX_R, 0, 1, 0),
476 SOC_DAPM_SINGLE("Aux2 Switch", DA7210_OUTMIX_R, 1, 1, 0),
477 SOC_DAPM_SINGLE("INPGA Left Switch", DA7210_OUTMIX_R, 2, 1, 0),
478 SOC_DAPM_SINGLE("INPGA Right Switch", DA7210_OUTMIX_R, 3, 1, 0),
440 SOC_DAPM_SINGLE("DAC Right Switch", DA7210_OUTMIX_R, 4, 1, 0), 479 SOC_DAPM_SINGLE("DAC Right Switch", DA7210_OUTMIX_R, 4, 1, 0),
441}; 480};
442 481
443/* Mono Mixer */ 482/* Mono Mixer */
444static const struct snd_kcontrol_new da7210_dapm_monomix_controls[] = { 483static const struct snd_kcontrol_new da7210_dapm_monomix_controls[] = {
484 SOC_DAPM_SINGLE("INPGA Right Switch", DA7210_OUT2, 3, 1, 0),
485 SOC_DAPM_SINGLE("INPGA Left Switch", DA7210_OUT2, 4, 1, 0),
445 SOC_DAPM_SINGLE("Outmix Right Switch", DA7210_OUT2, 5, 1, 0), 486 SOC_DAPM_SINGLE("Outmix Right Switch", DA7210_OUT2, 5, 1, 0),
446 SOC_DAPM_SINGLE("Outmix Left Switch", DA7210_OUT2, 6, 1, 0), 487 SOC_DAPM_SINGLE("Outmix Left Switch", DA7210_OUT2, 6, 1, 0),
447}; 488};
@@ -452,14 +493,23 @@ static const struct snd_soc_dapm_widget da7210_dapm_widgets[] = {
452 /* Input Lines */ 493 /* Input Lines */
453 SND_SOC_DAPM_INPUT("MICL"), 494 SND_SOC_DAPM_INPUT("MICL"),
454 SND_SOC_DAPM_INPUT("MICR"), 495 SND_SOC_DAPM_INPUT("MICR"),
496 SND_SOC_DAPM_INPUT("AUX1L"),
497 SND_SOC_DAPM_INPUT("AUX1R"),
498 SND_SOC_DAPM_INPUT("AUX2"),
455 499
456 /* Input PGAs */ 500 /* Input PGAs */
457 SND_SOC_DAPM_PGA("Mic Left", DA7210_STARTUP3, 0, 1, NULL, 0), 501 SND_SOC_DAPM_PGA("Mic Left", DA7210_STARTUP3, 0, 1, NULL, 0),
458 SND_SOC_DAPM_PGA("Mic Right", DA7210_STARTUP3, 1, 1, NULL, 0), 502 SND_SOC_DAPM_PGA("Mic Right", DA7210_STARTUP3, 1, 1, NULL, 0),
503 SND_SOC_DAPM_PGA("Aux1 Left", DA7210_STARTUP3, 2, 1, NULL, 0),
504 SND_SOC_DAPM_PGA("Aux1 Right", DA7210_STARTUP3, 3, 1, NULL, 0),
505 SND_SOC_DAPM_PGA("Aux2 Mono", DA7210_STARTUP3, 4, 1, NULL, 0),
459 506
460 SND_SOC_DAPM_PGA("INPGA Left", DA7210_INMIX_L, 7, 0, NULL, 0), 507 SND_SOC_DAPM_PGA("INPGA Left", DA7210_INMIX_L, 7, 0, NULL, 0),
461 SND_SOC_DAPM_PGA("INPGA Right", DA7210_INMIX_R, 7, 0, NULL, 0), 508 SND_SOC_DAPM_PGA("INPGA Right", DA7210_INMIX_R, 7, 0, NULL, 0),
462 509
510 /* MICBIAS */
511 SND_SOC_DAPM_SUPPLY("Mic Bias", DA7210_MIC_L, 6, 0, NULL, 0),
512
463 /* Input Mixers */ 513 /* Input Mixers */
464 SND_SOC_DAPM_MIXER("In Mixer Left", SND_SOC_NOPM, 0, 0, 514 SND_SOC_DAPM_MIXER("In Mixer Left", SND_SOC_NOPM, 0, 0,
465 &da7210_dapm_inmixl_controls[0], 515 &da7210_dapm_inmixl_controls[0],
@@ -515,12 +565,21 @@ static const struct snd_soc_dapm_route da7210_audio_map[] = {
515 /* Input path */ 565 /* Input path */
516 {"Mic Left", NULL, "MICL"}, 566 {"Mic Left", NULL, "MICL"},
517 {"Mic Right", NULL, "MICR"}, 567 {"Mic Right", NULL, "MICR"},
568 {"Aux1 Left", NULL, "AUX1L"},
569 {"Aux1 Right", NULL, "AUX1R"},
570 {"Aux2 Mono", NULL, "AUX2"},
518 571
519 {"In Mixer Left", "Mic Left Switch", "Mic Left"}, 572 {"In Mixer Left", "Mic Left Switch", "Mic Left"},
520 {"In Mixer Left", "Mic Right Switch", "Mic Right"}, 573 {"In Mixer Left", "Mic Right Switch", "Mic Right"},
574 {"In Mixer Left", "Aux1 Left Switch", "Aux1 Left"},
575 {"In Mixer Left", "Aux2 Switch", "Aux2 Mono"},
576 {"In Mixer Left", "Outmix Left Switch", "Out Mixer Left"},
521 577
522 {"In Mixer Right", "Mic Right Switch", "Mic Right"}, 578 {"In Mixer Right", "Mic Right Switch", "Mic Right"},
523 {"In Mixer Right", "Mic Left Switch", "Mic Left"}, 579 {"In Mixer Right", "Mic Left Switch", "Mic Left"},
580 {"In Mixer Right", "Aux1 Right Switch", "Aux1 Right"},
581 {"In Mixer Right", "Aux2 Switch", "Aux2 Mono"},
582 {"In Mixer Right", "Outmix Right Switch", "Out Mixer Right"},
524 583
525 {"INPGA Left", NULL, "In Mixer Left"}, 584 {"INPGA Left", NULL, "In Mixer Left"},
526 {"ADC Left", NULL, "INPGA Left"}, 585 {"ADC Left", NULL, "INPGA Left"},
@@ -529,9 +588,20 @@ static const struct snd_soc_dapm_route da7210_audio_map[] = {
529 {"ADC Right", NULL, "INPGA Right"}, 588 {"ADC Right", NULL, "INPGA Right"},
530 589
531 /* Output path */ 590 /* Output path */
591 {"Out Mixer Left", "Aux1 Left Switch", "Aux1 Left"},
592 {"Out Mixer Left", "Aux2 Switch", "Aux2 Mono"},
593 {"Out Mixer Left", "INPGA Left Switch", "INPGA Left"},
594 {"Out Mixer Left", "INPGA Right Switch", "INPGA Right"},
532 {"Out Mixer Left", "DAC Left Switch", "DAC Left"}, 595 {"Out Mixer Left", "DAC Left Switch", "DAC Left"},
596
597 {"Out Mixer Right", "Aux1 Right Switch", "Aux1 Right"},
598 {"Out Mixer Right", "Aux2 Switch", "Aux2 Mono"},
599 {"Out Mixer Right", "INPGA Right Switch", "INPGA Right"},
600 {"Out Mixer Right", "INPGA Left Switch", "INPGA Left"},
533 {"Out Mixer Right", "DAC Right Switch", "DAC Right"}, 601 {"Out Mixer Right", "DAC Right Switch", "DAC Right"},
534 602
603 {"Mono Mixer", "INPGA Right Switch", "INPGA Right"},
604 {"Mono Mixer", "INPGA Left Switch", "INPGA Left"},
535 {"Mono Mixer", "Outmix Right Switch", "Out Mixer Right"}, 605 {"Mono Mixer", "Outmix Right Switch", "Out Mixer Right"},
536 {"Mono Mixer", "Outmix Left Switch", "Out Mixer Left"}, 606 {"Mono Mixer", "Outmix Left Switch", "Out Mixer Left"},
537 607
@@ -761,7 +831,7 @@ static int da7210_mute(struct snd_soc_dai *dai, int mute)
761 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE) 831 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE)
762 832
763/* DAI operations */ 833/* DAI operations */
764static struct snd_soc_dai_ops da7210_dai_ops = { 834static const struct snd_soc_dai_ops da7210_dai_ops = {
765 .hw_params = da7210_hw_params, 835 .hw_params = da7210_hw_params,
766 .set_fmt = da7210_set_dai_fmt, 836 .set_fmt = da7210_set_dai_fmt,
767 .digital_mute = da7210_mute, 837 .digital_mute = da7210_mute,
@@ -888,6 +958,12 @@ static int da7210_probe(struct snd_soc_codec *codec)
888 snd_soc_write(codec, DA7210_OUT2, DA7210_OUT2_EN | 958 snd_soc_write(codec, DA7210_OUT2, DA7210_OUT2_EN |
889 DA7210_OUT2_OUTMIX_L | DA7210_OUT2_OUTMIX_R); 959 DA7210_OUT2_OUTMIX_L | DA7210_OUT2_OUTMIX_R);
890 960
961 /* Enable Aux1 */
962 snd_soc_write(codec, DA7210_AUX1_L, DA7210_AUX1_L_EN);
963 snd_soc_write(codec, DA7210_AUX1_R, DA7210_AUX1_R_EN);
964 /* Enable Aux2 */
965 snd_soc_write(codec, DA7210_AUX2, DA7210_AUX2_EN);
966
891 /* Diable PLL and bypass it */ 967 /* Diable PLL and bypass it */
892 snd_soc_write(codec, DA7210_PLL, DA7210_PLL_FS_48000); 968 snd_soc_write(codec, DA7210_PLL, DA7210_PLL_FS_48000);
893 969
@@ -945,7 +1021,8 @@ static int __devinit da7210_i2c_probe(struct i2c_client *i2c,
945 struct da7210_priv *da7210; 1021 struct da7210_priv *da7210;
946 int ret; 1022 int ret;
947 1023
948 da7210 = kzalloc(sizeof(struct da7210_priv), GFP_KERNEL); 1024 da7210 = devm_kzalloc(&i2c->dev, sizeof(struct da7210_priv),
1025 GFP_KERNEL);
949 if (!da7210) 1026 if (!da7210)
950 return -ENOMEM; 1027 return -ENOMEM;
951 1028
@@ -954,16 +1031,12 @@ static int __devinit da7210_i2c_probe(struct i2c_client *i2c,
954 1031
955 ret = snd_soc_register_codec(&i2c->dev, 1032 ret = snd_soc_register_codec(&i2c->dev,
956 &soc_codec_dev_da7210, &da7210_dai, 1); 1033 &soc_codec_dev_da7210, &da7210_dai, 1);
957 if (ret < 0)
958 kfree(da7210);
959
960 return ret; 1034 return ret;
961} 1035}
962 1036
963static int __devexit da7210_i2c_remove(struct i2c_client *client) 1037static int __devexit da7210_i2c_remove(struct i2c_client *client)
964{ 1038{
965 snd_soc_unregister_codec(&client->dev); 1039 snd_soc_unregister_codec(&client->dev);
966 kfree(i2c_get_clientdata(client));
967 return 0; 1040 return 0;
968} 1041}
969 1042
diff --git a/sound/soc/codecs/dfbmcs320.c b/sound/soc/codecs/dfbmcs320.c
index 704bbde6573..bfe46aa9036 100644
--- a/sound/soc/codecs/dfbmcs320.c
+++ b/sound/soc/codecs/dfbmcs320.c
@@ -55,17 +55,7 @@ static struct platform_driver dfmcs320_driver = {
55 .remove = __devexit_p(dfbmcs320_remove), 55 .remove = __devexit_p(dfbmcs320_remove),
56}; 56};
57 57
58static int __init dfbmcs320_init(void) 58module_platform_driver(dfmcs320_driver);
59{
60 return platform_driver_register(&dfmcs320_driver);
61}
62module_init(dfbmcs320_init);
63
64static void __exit dfbmcs320_exit(void)
65{
66 platform_driver_unregister(&dfmcs320_driver);
67}
68module_exit(dfbmcs320_exit);
69 59
70MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>"); 60MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>");
71MODULE_DESCRIPTION("ASoC DFBM-CS320 bluethooth module driver"); 61MODULE_DESCRIPTION("ASoC DFBM-CS320 bluethooth module driver");
diff --git a/sound/soc/codecs/dmic.c b/sound/soc/codecs/dmic.c
index 6fae765e3ad..3e929f079a1 100644
--- a/sound/soc/codecs/dmic.c
+++ b/sound/soc/codecs/dmic.c
@@ -89,17 +89,7 @@ static struct platform_driver dmic_driver = {
89 .remove = __devexit_p(dmic_dev_remove), 89 .remove = __devexit_p(dmic_dev_remove),
90}; 90};
91 91
92static int __init dmic_init(void) 92module_platform_driver(dmic_driver);
93{
94 return platform_driver_register(&dmic_driver);
95}
96module_init(dmic_init);
97
98static void __exit dmic_exit(void)
99{
100 platform_driver_unregister(&dmic_driver);
101}
102module_exit(dmic_exit);
103 93
104MODULE_DESCRIPTION("Generic DMIC driver"); 94MODULE_DESCRIPTION("Generic DMIC driver");
105MODULE_AUTHOR("Liam Girdwood <lrg@slimlogic.co.uk>"); 95MODULE_AUTHOR("Liam Girdwood <lrg@slimlogic.co.uk>");
diff --git a/sound/soc/codecs/jz4740.c b/sound/soc/codecs/jz4740.c
index e373f8f0690..4624e752a18 100644
--- a/sound/soc/codecs/jz4740.c
+++ b/sound/soc/codecs/jz4740.c
@@ -15,6 +15,7 @@
15#include <linux/module.h> 15#include <linux/module.h>
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 19
19#include <linux/delay.h> 20#include <linux/delay.h>
20 21
@@ -206,7 +207,7 @@ static int jz4740_codec_hw_params(struct snd_pcm_substream *substream,
206 return 0; 207 return 0;
207} 208}
208 209
209static struct snd_soc_dai_ops jz4740_codec_dai_ops = { 210static const struct snd_soc_dai_ops jz4740_codec_dai_ops = {
210 .hw_params = jz4740_codec_hw_params, 211 .hw_params = jz4740_codec_hw_params,
211}; 212};
212 213
@@ -311,7 +312,7 @@ static int jz4740_codec_dev_remove(struct snd_soc_codec *codec)
311 312
312#ifdef CONFIG_PM_SLEEP 313#ifdef CONFIG_PM_SLEEP
313 314
314static int jz4740_codec_suspend(struct snd_soc_codec *codec, pm_message_t state) 315static int jz4740_codec_suspend(struct snd_soc_codec *codec)
315{ 316{
316 return jz4740_codec_set_bias_level(codec, SND_SOC_BIAS_OFF); 317 return jz4740_codec_set_bias_level(codec, SND_SOC_BIAS_OFF);
317} 318}
@@ -352,7 +353,8 @@ static int __devinit jz4740_codec_probe(struct platform_device *pdev)
352 struct jz4740_codec *jz4740_codec; 353 struct jz4740_codec *jz4740_codec;
353 struct resource *mem; 354 struct resource *mem;
354 355
355 jz4740_codec = kzalloc(sizeof(*jz4740_codec), GFP_KERNEL); 356 jz4740_codec = devm_kzalloc(&pdev->dev, sizeof(*jz4740_codec),
357 GFP_KERNEL);
356 if (!jz4740_codec) 358 if (!jz4740_codec)
357 return -ENOMEM; 359 return -ENOMEM;
358 360
@@ -360,14 +362,14 @@ static int __devinit jz4740_codec_probe(struct platform_device *pdev)
360 if (!mem) { 362 if (!mem) {
361 dev_err(&pdev->dev, "Failed to get mmio memory resource\n"); 363 dev_err(&pdev->dev, "Failed to get mmio memory resource\n");
362 ret = -ENOENT; 364 ret = -ENOENT;
363 goto err_free_codec; 365 goto err_out;
364 } 366 }
365 367
366 mem = request_mem_region(mem->start, resource_size(mem), pdev->name); 368 mem = request_mem_region(mem->start, resource_size(mem), pdev->name);
367 if (!mem) { 369 if (!mem) {
368 dev_err(&pdev->dev, "Failed to request mmio memory region\n"); 370 dev_err(&pdev->dev, "Failed to request mmio memory region\n");
369 ret = -EBUSY; 371 ret = -EBUSY;
370 goto err_free_codec; 372 goto err_out;
371 } 373 }
372 374
373 jz4740_codec->base = ioremap(mem->start, resource_size(mem)); 375 jz4740_codec->base = ioremap(mem->start, resource_size(mem));
@@ -393,9 +395,7 @@ err_iounmap:
393 iounmap(jz4740_codec->base); 395 iounmap(jz4740_codec->base);
394err_release_mem_region: 396err_release_mem_region:
395 release_mem_region(mem->start, resource_size(mem)); 397 release_mem_region(mem->start, resource_size(mem));
396err_free_codec: 398err_out:
397 kfree(jz4740_codec);
398
399 return ret; 399 return ret;
400} 400}
401 401
@@ -410,7 +410,6 @@ static int __devexit jz4740_codec_remove(struct platform_device *pdev)
410 release_mem_region(mem->start, resource_size(mem)); 410 release_mem_region(mem->start, resource_size(mem));
411 411
412 platform_set_drvdata(pdev, NULL); 412 platform_set_drvdata(pdev, NULL);
413 kfree(jz4740_codec);
414 413
415 return 0; 414 return 0;
416} 415}
@@ -424,17 +423,7 @@ static struct platform_driver jz4740_codec_driver = {
424 }, 423 },
425}; 424};
426 425
427static int __init jz4740_codec_init(void) 426module_platform_driver(jz4740_codec_driver);
428{
429 return platform_driver_register(&jz4740_codec_driver);
430}
431module_init(jz4740_codec_init);
432
433static void __exit jz4740_codec_exit(void)
434{
435 platform_driver_unregister(&jz4740_codec_driver);
436}
437module_exit(jz4740_codec_exit);
438 427
439MODULE_DESCRIPTION("JZ4740 SoC internal codec driver"); 428MODULE_DESCRIPTION("JZ4740 SoC internal codec driver");
440MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>"); 429MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>");
diff --git a/sound/soc/codecs/lm4857.c b/sound/soc/codecs/lm4857.c
index c387dafc6ab..319039240e0 100644
--- a/sound/soc/codecs/lm4857.c
+++ b/sound/soc/codecs/lm4857.c
@@ -215,7 +215,7 @@ static int __devinit lm4857_i2c_probe(struct i2c_client *i2c,
215 struct lm4857 *lm4857; 215 struct lm4857 *lm4857;
216 int ret; 216 int ret;
217 217
218 lm4857 = kzalloc(sizeof(*lm4857), GFP_KERNEL); 218 lm4857 = devm_kzalloc(&i2c->dev, sizeof(*lm4857), GFP_KERNEL);
219 if (!lm4857) 219 if (!lm4857)
220 return -ENOMEM; 220 return -ENOMEM;
221 221
@@ -225,21 +225,12 @@ static int __devinit lm4857_i2c_probe(struct i2c_client *i2c,
225 225
226 ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_lm4857, NULL, 0); 226 ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_lm4857, NULL, 0);
227 227
228 if (ret) { 228 return ret;
229 kfree(lm4857);
230 return ret;
231 }
232
233 return 0;
234} 229}
235 230
236static int __devexit lm4857_i2c_remove(struct i2c_client *i2c) 231static int __devexit lm4857_i2c_remove(struct i2c_client *i2c)
237{ 232{
238 struct lm4857 *lm4857 = i2c_get_clientdata(i2c);
239
240 snd_soc_unregister_codec(&i2c->dev); 233 snd_soc_unregister_codec(&i2c->dev);
241 kfree(lm4857);
242
243 return 0; 234 return 0;
244} 235}
245 236
diff --git a/sound/soc/codecs/max98088.c b/sound/soc/codecs/max98088.c
index ebbf63c79c3..006efcfe6dd 100644
--- a/sound/soc/codecs/max98088.c
+++ b/sound/soc/codecs/max98088.c
@@ -15,7 +15,6 @@
15#include <linux/delay.h> 15#include <linux/delay.h>
16#include <linux/pm.h> 16#include <linux/pm.h>
17#include <linux/i2c.h> 17#include <linux/i2c.h>
18#include <linux/platform_device.h>
19#include <sound/core.h> 18#include <sound/core.h>
20#include <sound/pcm.h> 19#include <sound/pcm.h>
21#include <sound/pcm_params.h> 20#include <sound/pcm_params.h>
@@ -1650,14 +1649,14 @@ static int max98088_set_bias_level(struct snd_soc_codec *codec,
1650#define MAX98088_RATES SNDRV_PCM_RATE_8000_96000 1649#define MAX98088_RATES SNDRV_PCM_RATE_8000_96000
1651#define MAX98088_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE) 1650#define MAX98088_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE)
1652 1651
1653static struct snd_soc_dai_ops max98088_dai1_ops = { 1652static const struct snd_soc_dai_ops max98088_dai1_ops = {
1654 .set_sysclk = max98088_dai_set_sysclk, 1653 .set_sysclk = max98088_dai_set_sysclk,
1655 .set_fmt = max98088_dai1_set_fmt, 1654 .set_fmt = max98088_dai1_set_fmt,
1656 .hw_params = max98088_dai1_hw_params, 1655 .hw_params = max98088_dai1_hw_params,
1657 .digital_mute = max98088_dai1_digital_mute, 1656 .digital_mute = max98088_dai1_digital_mute,
1658}; 1657};
1659 1658
1660static struct snd_soc_dai_ops max98088_dai2_ops = { 1659static const struct snd_soc_dai_ops max98088_dai2_ops = {
1661 .set_sysclk = max98088_dai_set_sysclk, 1660 .set_sysclk = max98088_dai_set_sysclk,
1662 .set_fmt = max98088_dai2_set_fmt, 1661 .set_fmt = max98088_dai2_set_fmt,
1663 .hw_params = max98088_dai2_hw_params, 1662 .hw_params = max98088_dai2_hw_params,
@@ -1947,7 +1946,7 @@ static void max98088_handle_pdata(struct snd_soc_codec *codec)
1947} 1946}
1948 1947
1949#ifdef CONFIG_PM 1948#ifdef CONFIG_PM
1950static int max98088_suspend(struct snd_soc_codec *codec, pm_message_t state) 1949static int max98088_suspend(struct snd_soc_codec *codec)
1951{ 1950{
1952 max98088_set_bias_level(codec, SND_SOC_BIAS_OFF); 1951 max98088_set_bias_level(codec, SND_SOC_BIAS_OFF);
1953 1952
@@ -2070,7 +2069,8 @@ static int max98088_i2c_probe(struct i2c_client *i2c,
2070 struct max98088_priv *max98088; 2069 struct max98088_priv *max98088;
2071 int ret; 2070 int ret;
2072 2071
2073 max98088 = kzalloc(sizeof(struct max98088_priv), GFP_KERNEL); 2072 max98088 = devm_kzalloc(&i2c->dev, sizeof(struct max98088_priv),
2073 GFP_KERNEL);
2074 if (max98088 == NULL) 2074 if (max98088 == NULL)
2075 return -ENOMEM; 2075 return -ENOMEM;
2076 2076
@@ -2081,15 +2081,12 @@ static int max98088_i2c_probe(struct i2c_client *i2c,
2081 2081
2082 ret = snd_soc_register_codec(&i2c->dev, 2082 ret = snd_soc_register_codec(&i2c->dev,
2083 &soc_codec_dev_max98088, &max98088_dai[0], 2); 2083 &soc_codec_dev_max98088, &max98088_dai[0], 2);
2084 if (ret < 0)
2085 kfree(max98088);
2086 return ret; 2084 return ret;
2087} 2085}
2088 2086
2089static int __devexit max98088_i2c_remove(struct i2c_client *client) 2087static int __devexit max98088_i2c_remove(struct i2c_client *client)
2090{ 2088{
2091 snd_soc_unregister_codec(&client->dev); 2089 snd_soc_unregister_codec(&client->dev);
2092 kfree(i2c_get_clientdata(client));
2093 return 0; 2090 return 0;
2094} 2091}
2095 2092
diff --git a/sound/soc/codecs/max98095.c b/sound/soc/codecs/max98095.c
index 26d7b089fb9..fcfa7497d7b 100644
--- a/sound/soc/codecs/max98095.c
+++ b/sound/soc/codecs/max98095.c
@@ -15,7 +15,6 @@
15#include <linux/delay.h> 15#include <linux/delay.h>
16#include <linux/pm.h> 16#include <linux/pm.h>
17#include <linux/i2c.h> 17#include <linux/i2c.h>
18#include <linux/platform_device.h>
19#include <sound/core.h> 18#include <sound/core.h>
20#include <sound/pcm.h> 19#include <sound/pcm.h>
21#include <sound/pcm_params.h> 20#include <sound/pcm_params.h>
@@ -1782,19 +1781,19 @@ static int max98095_set_bias_level(struct snd_soc_codec *codec,
1782#define MAX98095_RATES SNDRV_PCM_RATE_8000_96000 1781#define MAX98095_RATES SNDRV_PCM_RATE_8000_96000
1783#define MAX98095_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE) 1782#define MAX98095_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE)
1784 1783
1785static struct snd_soc_dai_ops max98095_dai1_ops = { 1784static const struct snd_soc_dai_ops max98095_dai1_ops = {
1786 .set_sysclk = max98095_dai_set_sysclk, 1785 .set_sysclk = max98095_dai_set_sysclk,
1787 .set_fmt = max98095_dai1_set_fmt, 1786 .set_fmt = max98095_dai1_set_fmt,
1788 .hw_params = max98095_dai1_hw_params, 1787 .hw_params = max98095_dai1_hw_params,
1789}; 1788};
1790 1789
1791static struct snd_soc_dai_ops max98095_dai2_ops = { 1790static const struct snd_soc_dai_ops max98095_dai2_ops = {
1792 .set_sysclk = max98095_dai_set_sysclk, 1791 .set_sysclk = max98095_dai_set_sysclk,
1793 .set_fmt = max98095_dai2_set_fmt, 1792 .set_fmt = max98095_dai2_set_fmt,
1794 .hw_params = max98095_dai2_hw_params, 1793 .hw_params = max98095_dai2_hw_params,
1795}; 1794};
1796 1795
1797static struct snd_soc_dai_ops max98095_dai3_ops = { 1796static const struct snd_soc_dai_ops max98095_dai3_ops = {
1798 .set_sysclk = max98095_dai_set_sysclk, 1797 .set_sysclk = max98095_dai_set_sysclk,
1799 .set_fmt = max98095_dai3_set_fmt, 1798 .set_fmt = max98095_dai3_set_fmt,
1800 .hw_params = max98095_dai3_hw_params, 1799 .hw_params = max98095_dai3_hw_params,
@@ -2175,7 +2174,7 @@ static void max98095_handle_pdata(struct snd_soc_codec *codec)
2175} 2174}
2176 2175
2177#ifdef CONFIG_PM 2176#ifdef CONFIG_PM
2178static int max98095_suspend(struct snd_soc_codec *codec, pm_message_t state) 2177static int max98095_suspend(struct snd_soc_codec *codec)
2179{ 2178{
2180 max98095_set_bias_level(codec, SND_SOC_BIAS_OFF); 2179 max98095_set_bias_level(codec, SND_SOC_BIAS_OFF);
2181 2180
@@ -2341,7 +2340,8 @@ static int max98095_i2c_probe(struct i2c_client *i2c,
2341 struct max98095_priv *max98095; 2340 struct max98095_priv *max98095;
2342 int ret; 2341 int ret;
2343 2342
2344 max98095 = kzalloc(sizeof(struct max98095_priv), GFP_KERNEL); 2343 max98095 = devm_kzalloc(&i2c->dev, sizeof(struct max98095_priv),
2344 GFP_KERNEL);
2345 if (max98095 == NULL) 2345 if (max98095 == NULL)
2346 return -ENOMEM; 2346 return -ENOMEM;
2347 2347
@@ -2351,16 +2351,12 @@ static int max98095_i2c_probe(struct i2c_client *i2c,
2351 2351
2352 ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_max98095, 2352 ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_max98095,
2353 max98095_dai, ARRAY_SIZE(max98095_dai)); 2353 max98095_dai, ARRAY_SIZE(max98095_dai));
2354 if (ret < 0)
2355 kfree(max98095);
2356 return ret; 2354 return ret;
2357} 2355}
2358 2356
2359static int __devexit max98095_i2c_remove(struct i2c_client *client) 2357static int __devexit max98095_i2c_remove(struct i2c_client *client)
2360{ 2358{
2361 snd_soc_unregister_codec(&client->dev); 2359 snd_soc_unregister_codec(&client->dev);
2362 kfree(i2c_get_clientdata(client));
2363
2364 return 0; 2360 return 0;
2365} 2361}
2366 2362
diff --git a/sound/soc/codecs/max9850.c b/sound/soc/codecs/max9850.c
index 208d2ee6185..a1913091f56 100644
--- a/sound/soc/codecs/max9850.c
+++ b/sound/soc/codecs/max9850.c
@@ -86,7 +86,7 @@ SND_SOC_DAPM_INPUT("INL"),
86SND_SOC_DAPM_INPUT("INR"), 86SND_SOC_DAPM_INPUT("INR"),
87}; 87};
88 88
89static const struct snd_soc_dapm_route intercon[] = { 89static const struct snd_soc_dapm_route max9850_dapm_routes[] = {
90 /* output mixer */ 90 /* output mixer */
91 {"Output Mixer", NULL, "DAC"}, 91 {"Output Mixer", NULL, "DAC"},
92 {"Output Mixer", "Line In Switch", "Line Input"}, 92 {"Output Mixer", "Line In Switch", "Line Input"},
@@ -254,7 +254,7 @@ static int max9850_set_bias_level(struct snd_soc_codec *codec,
254#define MAX9850_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ 254#define MAX9850_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\
255 SNDRV_PCM_FMTBIT_S24_LE) 255 SNDRV_PCM_FMTBIT_S24_LE)
256 256
257static struct snd_soc_dai_ops max9850_dai_ops = { 257static const struct snd_soc_dai_ops max9850_dai_ops = {
258 .hw_params = max9850_hw_params, 258 .hw_params = max9850_hw_params,
259 .set_sysclk = max9850_set_dai_sysclk, 259 .set_sysclk = max9850_set_dai_sysclk,
260 .set_fmt = max9850_set_dai_fmt, 260 .set_fmt = max9850_set_dai_fmt,
@@ -273,7 +273,7 @@ static struct snd_soc_dai_driver max9850_dai = {
273}; 273};
274 274
275#ifdef CONFIG_PM 275#ifdef CONFIG_PM
276static int max9850_suspend(struct snd_soc_codec *codec, pm_message_t state) 276static int max9850_suspend(struct snd_soc_codec *codec)
277{ 277{
278 max9850_set_bias_level(codec, SND_SOC_BIAS_OFF); 278 max9850_set_bias_level(codec, SND_SOC_BIAS_OFF);
279 279
@@ -293,7 +293,6 @@ static int max9850_resume(struct snd_soc_codec *codec)
293 293
294static int max9850_probe(struct snd_soc_codec *codec) 294static int max9850_probe(struct snd_soc_codec *codec)
295{ 295{
296 struct snd_soc_dapm_context *dapm = &codec->dapm;
297 int ret; 296 int ret;
298 297
299 ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_I2C); 298 ret = snd_soc_codec_set_cache_io(codec, 8, 8, SND_SOC_I2C);
@@ -309,13 +308,6 @@ static int max9850_probe(struct snd_soc_codec *codec)
309 /* set slew-rate 125ms */ 308 /* set slew-rate 125ms */
310 snd_soc_update_bits(codec, MAX9850_CHARGE_PUMP, 0xff, 0xc0); 309 snd_soc_update_bits(codec, MAX9850_CHARGE_PUMP, 0xff, 0xc0);
311 310
312 snd_soc_dapm_new_controls(dapm, max9850_dapm_widgets,
313 ARRAY_SIZE(max9850_dapm_widgets));
314 snd_soc_dapm_add_routes(dapm, intercon, ARRAY_SIZE(intercon));
315
316 snd_soc_add_controls(codec, max9850_controls,
317 ARRAY_SIZE(max9850_controls));
318
319 return 0; 311 return 0;
320} 312}
321 313
@@ -328,6 +320,13 @@ static struct snd_soc_codec_driver soc_codec_dev_max9850 = {
328 .reg_word_size = sizeof(u8), 320 .reg_word_size = sizeof(u8),
329 .reg_cache_default = max9850_reg, 321 .reg_cache_default = max9850_reg,
330 .volatile_register = max9850_volatile_register, 322 .volatile_register = max9850_volatile_register,
323
324 .controls = max9850_controls,
325 .num_controls = ARRAY_SIZE(max9850_controls),
326 .dapm_widgets = max9850_dapm_widgets,
327 .num_dapm_widgets = ARRAY_SIZE(max9850_dapm_widgets),
328 .dapm_routes = max9850_dapm_routes,
329 .num_dapm_routes = ARRAY_SIZE(max9850_dapm_routes),
331}; 330};
332 331
333static int __devinit max9850_i2c_probe(struct i2c_client *i2c, 332static int __devinit max9850_i2c_probe(struct i2c_client *i2c,
@@ -336,7 +335,8 @@ static int __devinit max9850_i2c_probe(struct i2c_client *i2c,
336 struct max9850_priv *max9850; 335 struct max9850_priv *max9850;
337 int ret; 336 int ret;
338 337
339 max9850 = kzalloc(sizeof(struct max9850_priv), GFP_KERNEL); 338 max9850 = devm_kzalloc(&i2c->dev, sizeof(struct max9850_priv),
339 GFP_KERNEL);
340 if (max9850 == NULL) 340 if (max9850 == NULL)
341 return -ENOMEM; 341 return -ENOMEM;
342 342
@@ -344,15 +344,12 @@ static int __devinit max9850_i2c_probe(struct i2c_client *i2c,
344 344
345 ret = snd_soc_register_codec(&i2c->dev, 345 ret = snd_soc_register_codec(&i2c->dev,
346 &soc_codec_dev_max9850, &max9850_dai, 1); 346 &soc_codec_dev_max9850, &max9850_dai, 1);
347 if (ret < 0)
348 kfree(max9850);
349 return ret; 347 return ret;
350} 348}
351 349
352static __devexit int max9850_i2c_remove(struct i2c_client *client) 350static __devexit int max9850_i2c_remove(struct i2c_client *client)
353{ 351{
354 snd_soc_unregister_codec(&client->dev); 352 snd_soc_unregister_codec(&client->dev);
355 kfree(i2c_get_clientdata(client));
356 return 0; 353 return 0;
357} 354}
358 355
diff --git a/sound/soc/codecs/pcm3008.c b/sound/soc/codecs/pcm3008.c
index f7316519432..edcaa7ea548 100644
--- a/sound/soc/codecs/pcm3008.c
+++ b/sound/soc/codecs/pcm3008.c
@@ -118,7 +118,7 @@ static int pcm3008_soc_remove(struct snd_soc_codec *codec)
118} 118}
119 119
120#ifdef CONFIG_PM 120#ifdef CONFIG_PM
121static int pcm3008_soc_suspend(struct snd_soc_codec *codec, pm_message_t msg) 121static int pcm3008_soc_suspend(struct snd_soc_codec *codec)
122{ 122{
123 struct pcm3008_setup_data *setup = codec->dev->platform_data; 123 struct pcm3008_setup_data *setup = codec->dev->platform_data;
124 124
@@ -172,17 +172,7 @@ static struct platform_driver pcm3008_codec_driver = {
172 }, 172 },
173}; 173};
174 174
175static int __init pcm3008_modinit(void) 175module_platform_driver(pcm3008_codec_driver);
176{
177 return platform_driver_register(&pcm3008_codec_driver);
178}
179module_init(pcm3008_modinit);
180
181static void __exit pcm3008_exit(void)
182{
183 platform_driver_unregister(&pcm3008_codec_driver);
184}
185module_exit(pcm3008_exit);
186 176
187MODULE_DESCRIPTION("Soc PCM3008 driver"); 177MODULE_DESCRIPTION("Soc PCM3008 driver");
188MODULE_AUTHOR("Hugo Villeneuve"); 178MODULE_AUTHOR("Hugo Villeneuve");
diff --git a/sound/soc/codecs/rt5631.c b/sound/soc/codecs/rt5631.c
index 4646e808b90..20c324c7c34 100644
--- a/sound/soc/codecs/rt5631.c
+++ b/sound/soc/codecs/rt5631.c
@@ -18,7 +18,6 @@
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/platform_device.h>
22#include <linux/spi/spi.h> 21#include <linux/spi/spi.h>
23#include <sound/core.h> 22#include <sound/core.h>
24#include <sound/pcm.h> 23#include <sound/pcm.h>
@@ -1642,7 +1641,7 @@ static int rt5631_remove(struct snd_soc_codec *codec)
1642} 1641}
1643 1642
1644#ifdef CONFIG_PM 1643#ifdef CONFIG_PM
1645static int rt5631_suspend(struct snd_soc_codec *codec, pm_message_t state) 1644static int rt5631_suspend(struct snd_soc_codec *codec)
1646{ 1645{
1647 rt5631_set_bias_level(codec, SND_SOC_BIAS_OFF); 1646 rt5631_set_bias_level(codec, SND_SOC_BIAS_OFF);
1648 return 0; 1647 return 0;
@@ -1664,7 +1663,7 @@ static int rt5631_resume(struct snd_soc_codec *codec)
1664 SNDRV_PCM_FMTBIT_S24_LE | \ 1663 SNDRV_PCM_FMTBIT_S24_LE | \
1665 SNDRV_PCM_FMTBIT_S8) 1664 SNDRV_PCM_FMTBIT_S8)
1666 1665
1667static struct snd_soc_dai_ops rt5631_ops = { 1666static const struct snd_soc_dai_ops rt5631_ops = {
1668 .hw_params = rt5631_hifi_pcm_params, 1667 .hw_params = rt5631_hifi_pcm_params,
1669 .set_fmt = rt5631_hifi_codec_set_dai_fmt, 1668 .set_fmt = rt5631_hifi_codec_set_dai_fmt,
1670 .set_sysclk = rt5631_hifi_codec_set_dai_sysclk, 1669 .set_sysclk = rt5631_hifi_codec_set_dai_sysclk,
@@ -1725,7 +1724,8 @@ static int rt5631_i2c_probe(struct i2c_client *i2c,
1725 struct rt5631_priv *rt5631; 1724 struct rt5631_priv *rt5631;
1726 int ret; 1725 int ret;
1727 1726
1728 rt5631 = kzalloc(sizeof(struct rt5631_priv), GFP_KERNEL); 1727 rt5631 = devm_kzalloc(&i2c->dev, sizeof(struct rt5631_priv),
1728 GFP_KERNEL);
1729 if (NULL == rt5631) 1729 if (NULL == rt5631)
1730 return -ENOMEM; 1730 return -ENOMEM;
1731 1731
@@ -1733,16 +1733,12 @@ static int rt5631_i2c_probe(struct i2c_client *i2c,
1733 1733
1734 ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_rt5631, 1734 ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_rt5631,
1735 rt5631_dai, ARRAY_SIZE(rt5631_dai)); 1735 rt5631_dai, ARRAY_SIZE(rt5631_dai));
1736 if (ret < 0)
1737 kfree(rt5631);
1738
1739 return ret; 1736 return ret;
1740} 1737}
1741 1738
1742static __devexit int rt5631_i2c_remove(struct i2c_client *client) 1739static __devexit int rt5631_i2c_remove(struct i2c_client *client)
1743{ 1740{
1744 snd_soc_unregister_codec(&client->dev); 1741 snd_soc_unregister_codec(&client->dev);
1745 kfree(i2c_get_clientdata(client));
1746 return 0; 1742 return 0;
1747} 1743}
1748 1744
diff --git a/sound/soc/codecs/sgtl5000.c b/sound/soc/codecs/sgtl5000.c
index bbcf921166f..fc9b127206e 100644
--- a/sound/soc/codecs/sgtl5000.c
+++ b/sound/soc/codecs/sgtl5000.c
@@ -16,7 +16,6 @@
16#include <linux/pm.h> 16#include <linux/pm.h>
17#include <linux/i2c.h> 17#include <linux/i2c.h>
18#include <linux/clk.h> 18#include <linux/clk.h>
19#include <linux/platform_device.h>
20#include <linux/regulator/driver.h> 19#include <linux/regulator/driver.h>
21#include <linux/regulator/machine.h> 20#include <linux/regulator/machine.h>
22#include <linux/regulator/consumer.h> 21#include <linux/regulator/consumer.h>
@@ -923,7 +922,7 @@ static int sgtl5000_set_bias_level(struct snd_soc_codec *codec,
923 SNDRV_PCM_FMTBIT_S24_LE |\ 922 SNDRV_PCM_FMTBIT_S24_LE |\
924 SNDRV_PCM_FMTBIT_S32_LE) 923 SNDRV_PCM_FMTBIT_S32_LE)
925 924
926static struct snd_soc_dai_ops sgtl5000_ops = { 925static const struct snd_soc_dai_ops sgtl5000_ops = {
927 .hw_params = sgtl5000_pcm_hw_params, 926 .hw_params = sgtl5000_pcm_hw_params,
928 .digital_mute = sgtl5000_digital_mute, 927 .digital_mute = sgtl5000_digital_mute,
929 .set_fmt = sgtl5000_set_dai_fmt, 928 .set_fmt = sgtl5000_set_dai_fmt,
@@ -968,7 +967,7 @@ static int sgtl5000_volatile_register(struct snd_soc_codec *codec,
968} 967}
969 968
970#ifdef CONFIG_SUSPEND 969#ifdef CONFIG_SUSPEND
971static int sgtl5000_suspend(struct snd_soc_codec *codec, pm_message_t state) 970static int sgtl5000_suspend(struct snd_soc_codec *codec)
972{ 971{
973 sgtl5000_set_bias_level(codec, SND_SOC_BIAS_OFF); 972 sgtl5000_set_bias_level(codec, SND_SOC_BIAS_OFF);
974 973
@@ -1077,7 +1076,7 @@ static int sgtl5000_set_power_regs(struct snd_soc_codec *codec)
1077 /* according to datasheet, maximum voltage of supplies */ 1076 /* according to datasheet, maximum voltage of supplies */
1078 if (vdda > 3600 || vddio > 3600 || vddd > 1980) { 1077 if (vdda > 3600 || vddio > 3600 || vddd > 1980) {
1079 dev_err(codec->dev, 1078 dev_err(codec->dev,
1080 "exceed max voltage vdda %dmv vddio %dma vddd %dma\n", 1079 "exceed max voltage vdda %dmV vddio %dmV vddd %dmV\n",
1081 vdda, vddio, vddd); 1080 vdda, vddio, vddd);
1082 1081
1083 return -EINVAL; 1082 return -EINVAL;
@@ -1402,7 +1401,8 @@ static __devinit int sgtl5000_i2c_probe(struct i2c_client *client,
1402 struct sgtl5000_priv *sgtl5000; 1401 struct sgtl5000_priv *sgtl5000;
1403 int ret; 1402 int ret;
1404 1403
1405 sgtl5000 = kzalloc(sizeof(struct sgtl5000_priv), GFP_KERNEL); 1404 sgtl5000 = devm_kzalloc(&client->dev, sizeof(struct sgtl5000_priv),
1405 GFP_KERNEL);
1406 if (!sgtl5000) 1406 if (!sgtl5000)
1407 return -ENOMEM; 1407 return -ENOMEM;
1408 1408
@@ -1410,22 +1410,13 @@ static __devinit int sgtl5000_i2c_probe(struct i2c_client *client,
1410 1410
1411 ret = snd_soc_register_codec(&client->dev, 1411 ret = snd_soc_register_codec(&client->dev,
1412 &sgtl5000_driver, &sgtl5000_dai, 1); 1412 &sgtl5000_driver, &sgtl5000_dai, 1);
1413 if (ret) { 1413 return ret;
1414 dev_err(&client->dev, "Failed to register codec: %d\n", ret);
1415 kfree(sgtl5000);
1416 return ret;
1417 }
1418
1419 return 0;
1420} 1414}
1421 1415
1422static __devexit int sgtl5000_i2c_remove(struct i2c_client *client) 1416static __devexit int sgtl5000_i2c_remove(struct i2c_client *client)
1423{ 1417{
1424 struct sgtl5000_priv *sgtl5000 = i2c_get_clientdata(client);
1425
1426 snd_soc_unregister_codec(&client->dev); 1418 snd_soc_unregister_codec(&client->dev);
1427 1419
1428 kfree(sgtl5000);
1429 return 0; 1420 return 0;
1430} 1421}
1431 1422
diff --git a/sound/soc/codecs/sigmadsp.c b/sound/soc/codecs/sigmadsp.c
new file mode 100644
index 00000000000..5be42bf5699
--- /dev/null
+++ b/sound/soc/codecs/sigmadsp.c
@@ -0,0 +1,246 @@
1/*
2 * Load Analog Devices SigmaStudio firmware files
3 *
4 * Copyright 2009-2011 Analog Devices Inc.
5 *
6 * Licensed under the GPL-2 or later.
7 */
8
9#include <linux/crc32.h>
10#include <linux/delay.h>
11#include <linux/firmware.h>
12#include <linux/kernel.h>
13#include <linux/i2c.h>
14#include <linux/regmap.h>
15#include <linux/module.h>
16
17#include "sigmadsp.h"
18
19#define SIGMA_MAGIC "ADISIGM"
20
21struct sigma_firmware_header {
22 unsigned char magic[7];
23 u8 version;
24 __le32 crc;
25} __packed;
26
27enum {
28 SIGMA_ACTION_WRITEXBYTES = 0,
29 SIGMA_ACTION_WRITESINGLE,
30 SIGMA_ACTION_WRITESAFELOAD,
31 SIGMA_ACTION_DELAY,
32 SIGMA_ACTION_PLLWAIT,
33 SIGMA_ACTION_NOOP,
34 SIGMA_ACTION_END,
35};
36
37struct sigma_action {
38 u8 instr;
39 u8 len_hi;
40 __le16 len;
41 __be16 addr;
42 unsigned char payload[];
43} __packed;
44
45struct sigma_firmware {
46 const struct firmware *fw;
47 size_t pos;
48
49 void *control_data;
50 int (*write)(void *control_data, const struct sigma_action *sa,
51 size_t len);
52};
53
54static inline u32 sigma_action_len(struct sigma_action *sa)
55{
56 return (sa->len_hi << 16) | le16_to_cpu(sa->len);
57}
58
59static size_t sigma_action_size(struct sigma_action *sa)
60{
61 size_t payload = 0;
62
63 switch (sa->instr) {
64 case SIGMA_ACTION_WRITEXBYTES:
65 case SIGMA_ACTION_WRITESINGLE:
66 case SIGMA_ACTION_WRITESAFELOAD:
67 payload = sigma_action_len(sa);
68 break;
69 default:
70 break;
71 }
72
73 payload = ALIGN(payload, 2);
74
75 return payload + sizeof(struct sigma_action);
76}
77
78/*
79 * Returns a negative error value in case of an error, 0 if processing of
80 * the firmware should be stopped after this action, 1 otherwise.
81 */
82static int
83process_sigma_action(struct sigma_firmware *ssfw, struct sigma_action *sa)
84{
85 size_t len = sigma_action_len(sa);
86 int ret;
87
88 pr_debug("%s: instr:%i addr:%#x len:%zu\n", __func__,
89 sa->instr, sa->addr, len);
90
91 switch (sa->instr) {
92 case SIGMA_ACTION_WRITEXBYTES:
93 case SIGMA_ACTION_WRITESINGLE:
94 case SIGMA_ACTION_WRITESAFELOAD:
95 ret = ssfw->write(ssfw->control_data, sa, len);
96 if (ret < 0)
97 return -EINVAL;
98 break;
99 case SIGMA_ACTION_DELAY:
100 udelay(len);
101 len = 0;
102 break;
103 case SIGMA_ACTION_END:
104 return 0;
105 default:
106 return -EINVAL;
107 }
108
109 return 1;
110}
111
112static int
113process_sigma_actions(struct sigma_firmware *ssfw)
114{
115 struct sigma_action *sa;
116 size_t size;
117 int ret;
118
119 while (ssfw->pos + sizeof(*sa) <= ssfw->fw->size) {
120 sa = (struct sigma_action *)(ssfw->fw->data + ssfw->pos);
121
122 size = sigma_action_size(sa);
123 ssfw->pos += size;
124 if (ssfw->pos > ssfw->fw->size || size == 0)
125 break;
126
127 ret = process_sigma_action(ssfw, sa);
128
129 pr_debug("%s: action returned %i\n", __func__, ret);
130
131 if (ret <= 0)
132 return ret;
133 }
134
135 if (ssfw->pos != ssfw->fw->size)
136 return -EINVAL;
137
138 return 0;
139}
140
141static int _process_sigma_firmware(struct device *dev,
142 struct sigma_firmware *ssfw, const char *name)
143{
144 int ret;
145 struct sigma_firmware_header *ssfw_head;
146 const struct firmware *fw;
147 u32 crc;
148
149 pr_debug("%s: loading firmware %s\n", __func__, name);
150
151 /* first load the blob */
152 ret = request_firmware(&fw, name, dev);
153 if (ret) {
154 pr_debug("%s: request_firmware() failed with %i\n", __func__, ret);
155 return ret;
156 }
157 ssfw->fw = fw;
158
159 /* then verify the header */
160 ret = -EINVAL;
161
162 /*
163 * Reject too small or unreasonable large files. The upper limit has been
164 * chosen a bit arbitrarily, but it should be enough for all practical
165 * purposes and having the limit makes it easier to avoid integer
166 * overflows later in the loading process.
167 */
168 if (fw->size < sizeof(*ssfw_head) || fw->size >= 0x4000000) {
169 dev_err(dev, "Failed to load firmware: Invalid size\n");
170 goto done;
171 }
172
173 ssfw_head = (void *)fw->data;
174 if (memcmp(ssfw_head->magic, SIGMA_MAGIC, ARRAY_SIZE(ssfw_head->magic))) {
175 dev_err(dev, "Failed to load firmware: Invalid magic\n");
176 goto done;
177 }
178
179 crc = crc32(0, fw->data + sizeof(*ssfw_head),
180 fw->size - sizeof(*ssfw_head));
181 pr_debug("%s: crc=%x\n", __func__, crc);
182 if (crc != le32_to_cpu(ssfw_head->crc)) {
183 dev_err(dev, "Failed to load firmware: Wrong crc checksum: expected %x got %x\n",
184 le32_to_cpu(ssfw_head->crc), crc);
185 goto done;
186 }
187
188 ssfw->pos = sizeof(*ssfw_head);
189
190 /* finally process all of the actions */
191 ret = process_sigma_actions(ssfw);
192
193 done:
194 release_firmware(fw);
195
196 pr_debug("%s: loaded %s\n", __func__, name);
197
198 return ret;
199}
200
201#if IS_ENABLED(CONFIG_I2C)
202
203static int sigma_action_write_i2c(void *control_data,
204 const struct sigma_action *sa, size_t len)
205{
206 return i2c_master_send(control_data, (const unsigned char *)&sa->addr,
207 len);
208}
209
210int process_sigma_firmware(struct i2c_client *client, const char *name)
211{
212 struct sigma_firmware ssfw;
213
214 ssfw.control_data = client;
215 ssfw.write = sigma_action_write_i2c;
216
217 return _process_sigma_firmware(&client->dev, &ssfw, name);
218}
219EXPORT_SYMBOL(process_sigma_firmware);
220
221#endif
222
223#if IS_ENABLED(CONFIG_REGMAP)
224
225static int sigma_action_write_regmap(void *control_data,
226 const struct sigma_action *sa, size_t len)
227{
228 return regmap_raw_write(control_data, le16_to_cpu(sa->addr),
229 sa->payload, len - 2);
230}
231
232int process_sigma_firmware_regmap(struct device *dev, struct regmap *regmap,
233 const char *name)
234{
235 struct sigma_firmware ssfw;
236
237 ssfw.control_data = regmap;
238 ssfw.write = sigma_action_write_regmap;
239
240 return _process_sigma_firmware(dev, &ssfw, name);
241}
242EXPORT_SYMBOL(process_sigma_firmware_regmap);
243
244#endif
245
246MODULE_LICENSE("GPL");
diff --git a/sound/soc/codecs/sigmadsp.h b/sound/soc/codecs/sigmadsp.h
new file mode 100644
index 00000000000..e439cbd7af7
--- /dev/null
+++ b/sound/soc/codecs/sigmadsp.h
@@ -0,0 +1,21 @@
1/*
2 * Load firmware files from Analog Devices SigmaStudio
3 *
4 * Copyright 2009-2011 Analog Devices Inc.
5 *
6 * Licensed under the GPL-2 or later.
7 */
8
9#ifndef __SIGMA_FIRMWARE_H__
10#define __SIGMA_FIRMWARE_H__
11
12#include <linux/device.h>
13#include <linux/regmap.h>
14
15struct i2c_client;
16
17extern int process_sigma_firmware(struct i2c_client *client, const char *name);
18extern int process_sigma_firmware_regmap(struct device *dev,
19 struct regmap *regmap, const char *name);
20
21#endif
diff --git a/sound/soc/codecs/sn95031.c b/sound/soc/codecs/sn95031.c
index 887d618f4a6..f99baa0b8c3 100644
--- a/sound/soc/codecs/sn95031.c
+++ b/sound/soc/codecs/sn95031.c
@@ -698,21 +698,21 @@ static int sn95031_pcm_hw_params(struct snd_pcm_substream *substream,
698} 698}
699 699
700/* Codec DAI section */ 700/* Codec DAI section */
701static struct snd_soc_dai_ops sn95031_headset_dai_ops = { 701static const struct snd_soc_dai_ops sn95031_headset_dai_ops = {
702 .digital_mute = sn95031_pcm_hs_mute, 702 .digital_mute = sn95031_pcm_hs_mute,
703 .hw_params = sn95031_pcm_hw_params, 703 .hw_params = sn95031_pcm_hw_params,
704}; 704};
705 705
706static struct snd_soc_dai_ops sn95031_speaker_dai_ops = { 706static const struct snd_soc_dai_ops sn95031_speaker_dai_ops = {
707 .digital_mute = sn95031_pcm_spkr_mute, 707 .digital_mute = sn95031_pcm_spkr_mute,
708 .hw_params = sn95031_pcm_hw_params, 708 .hw_params = sn95031_pcm_hw_params,
709}; 709};
710 710
711static struct snd_soc_dai_ops sn95031_vib1_dai_ops = { 711static const struct snd_soc_dai_ops sn95031_vib1_dai_ops = {
712 .hw_params = sn95031_pcm_hw_params, 712 .hw_params = sn95031_pcm_hw_params,
713}; 713};
714 714
715static struct snd_soc_dai_ops sn95031_vib2_dai_ops = { 715static const struct snd_soc_dai_ops sn95031_vib2_dai_ops = {
716 .hw_params = sn95031_pcm_hw_params, 716 .hw_params = sn95031_pcm_hw_params,
717}; 717};
718 718
@@ -920,19 +920,7 @@ static struct platform_driver sn95031_codec_driver = {
920 .remove = __devexit_p(sn95031_device_remove), 920 .remove = __devexit_p(sn95031_device_remove),
921}; 921};
922 922
923static int __init sn95031_init(void) 923module_platform_driver(sn95031_codec_driver);
924{
925 pr_debug("driver init called\n");
926 return platform_driver_register(&sn95031_codec_driver);
927}
928module_init(sn95031_init);
929
930static void __exit sn95031_exit(void)
931{
932 pr_debug("driver exit called\n");
933 platform_driver_unregister(&sn95031_codec_driver);
934}
935module_exit(sn95031_exit);
936 924
937MODULE_DESCRIPTION("ASoC TI SN95031 codec driver"); 925MODULE_DESCRIPTION("ASoC TI SN95031 codec driver");
938MODULE_AUTHOR("Vinod Koul <vinod.koul@intel.com>"); 926MODULE_AUTHOR("Vinod Koul <vinod.koul@intel.com>");
diff --git a/sound/soc/codecs/spdif_transciever.c b/sound/soc/codecs/spdif_transciever.c
index 6a1a7e705cd..112a49d66e3 100644
--- a/sound/soc/codecs/spdif_transciever.c
+++ b/sound/soc/codecs/spdif_transciever.c
@@ -61,18 +61,7 @@ static struct platform_driver spdif_dit_driver = {
61 }, 61 },
62}; 62};
63 63
64static int __init dit_modinit(void) 64module_platform_driver(spdif_dit_driver);
65{
66 return platform_driver_register(&spdif_dit_driver);
67}
68
69static void __exit dit_exit(void)
70{
71 platform_driver_unregister(&spdif_dit_driver);
72}
73
74module_init(dit_modinit);
75module_exit(dit_exit);
76 65
77MODULE_AUTHOR("Steve Chen <schen@mvista.com>"); 66MODULE_AUTHOR("Steve Chen <schen@mvista.com>");
78MODULE_DESCRIPTION("SPDIF dummy codec driver"); 67MODULE_DESCRIPTION("SPDIF dummy codec driver");
diff --git a/sound/soc/codecs/ssm2602.c b/sound/soc/codecs/ssm2602.c
index 3cb3271c5fe..333dd98af39 100644
--- a/sound/soc/codecs/ssm2602.c
+++ b/sound/soc/codecs/ssm2602.c
@@ -33,7 +33,6 @@
33#include <linux/pm.h> 33#include <linux/pm.h>
34#include <linux/i2c.h> 34#include <linux/i2c.h>
35#include <linux/spi/spi.h> 35#include <linux/spi/spi.h>
36#include <linux/platform_device.h>
37#include <linux/slab.h> 36#include <linux/slab.h>
38#include <sound/core.h> 37#include <sound/core.h>
39#include <sound/pcm.h> 38#include <sound/pcm.h>
@@ -498,7 +497,7 @@ static int ssm2602_set_bias_level(struct snd_soc_codec *codec,
498#define SSM2602_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ 497#define SSM2602_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\
499 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE) 498 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE)
500 499
501static struct snd_soc_dai_ops ssm2602_dai_ops = { 500static const struct snd_soc_dai_ops ssm2602_dai_ops = {
502 .startup = ssm2602_startup, 501 .startup = ssm2602_startup,
503 .hw_params = ssm2602_hw_params, 502 .hw_params = ssm2602_hw_params,
504 .shutdown = ssm2602_shutdown, 503 .shutdown = ssm2602_shutdown,
@@ -524,7 +523,7 @@ static struct snd_soc_dai_driver ssm2602_dai = {
524 .ops = &ssm2602_dai_ops, 523 .ops = &ssm2602_dai_ops,
525}; 524};
526 525
527static int ssm2602_suspend(struct snd_soc_codec *codec, pm_message_t state) 526static int ssm2602_suspend(struct snd_soc_codec *codec)
528{ 527{
529 ssm2602_set_bias_level(codec, SND_SOC_BIAS_OFF); 528 ssm2602_set_bias_level(codec, SND_SOC_BIAS_OFF);
530 return 0; 529 return 0;
@@ -653,7 +652,8 @@ static int __devinit ssm2602_spi_probe(struct spi_device *spi)
653 struct ssm2602_priv *ssm2602; 652 struct ssm2602_priv *ssm2602;
654 int ret; 653 int ret;
655 654
656 ssm2602 = kzalloc(sizeof(struct ssm2602_priv), GFP_KERNEL); 655 ssm2602 = devm_kzalloc(&spi->dev, sizeof(struct ssm2602_priv),
656 GFP_KERNEL);
657 if (ssm2602 == NULL) 657 if (ssm2602 == NULL)
658 return -ENOMEM; 658 return -ENOMEM;
659 659
@@ -663,15 +663,12 @@ static int __devinit ssm2602_spi_probe(struct spi_device *spi)
663 663
664 ret = snd_soc_register_codec(&spi->dev, 664 ret = snd_soc_register_codec(&spi->dev,
665 &soc_codec_dev_ssm2602, &ssm2602_dai, 1); 665 &soc_codec_dev_ssm2602, &ssm2602_dai, 1);
666 if (ret < 0)
667 kfree(ssm2602);
668 return ret; 666 return ret;
669} 667}
670 668
671static int __devexit ssm2602_spi_remove(struct spi_device *spi) 669static int __devexit ssm2602_spi_remove(struct spi_device *spi)
672{ 670{
673 snd_soc_unregister_codec(&spi->dev); 671 snd_soc_unregister_codec(&spi->dev);
674 kfree(spi_get_drvdata(spi));
675 return 0; 672 return 0;
676} 673}
677 674
@@ -698,7 +695,8 @@ static int __devinit ssm2602_i2c_probe(struct i2c_client *i2c,
698 struct ssm2602_priv *ssm2602; 695 struct ssm2602_priv *ssm2602;
699 int ret; 696 int ret;
700 697
701 ssm2602 = kzalloc(sizeof(struct ssm2602_priv), GFP_KERNEL); 698 ssm2602 = devm_kzalloc(&i2c->dev, sizeof(struct ssm2602_priv),
699 GFP_KERNEL);
702 if (ssm2602 == NULL) 700 if (ssm2602 == NULL)
703 return -ENOMEM; 701 return -ENOMEM;
704 702
@@ -708,15 +706,12 @@ static int __devinit ssm2602_i2c_probe(struct i2c_client *i2c,
708 706
709 ret = snd_soc_register_codec(&i2c->dev, 707 ret = snd_soc_register_codec(&i2c->dev,
710 &soc_codec_dev_ssm2602, &ssm2602_dai, 1); 708 &soc_codec_dev_ssm2602, &ssm2602_dai, 1);
711 if (ret < 0)
712 kfree(ssm2602);
713 return ret; 709 return ret;
714} 710}
715 711
716static int __devexit ssm2602_i2c_remove(struct i2c_client *client) 712static int __devexit ssm2602_i2c_remove(struct i2c_client *client)
717{ 713{
718 snd_soc_unregister_codec(&client->dev); 714 snd_soc_unregister_codec(&client->dev);
719 kfree(i2c_get_clientdata(client));
720 return 0; 715 return 0;
721} 716}
722 717
diff --git a/sound/soc/codecs/sta32x.c b/sound/soc/codecs/sta32x.c
index d2f37152f94..7db6fa51502 100644
--- a/sound/soc/codecs/sta32x.c
+++ b/sound/soc/codecs/sta32x.c
@@ -24,9 +24,9 @@
24#include <linux/delay.h> 24#include <linux/delay.h>
25#include <linux/pm.h> 25#include <linux/pm.h>
26#include <linux/i2c.h> 26#include <linux/i2c.h>
27#include <linux/platform_device.h>
28#include <linux/regulator/consumer.h> 27#include <linux/regulator/consumer.h>
29#include <linux/slab.h> 28#include <linux/slab.h>
29#include <linux/workqueue.h>
30#include <sound/core.h> 30#include <sound/core.h>
31#include <sound/pcm.h> 31#include <sound/pcm.h>
32#include <sound/pcm_params.h> 32#include <sound/pcm_params.h>
@@ -35,6 +35,7 @@
35#include <sound/initval.h> 35#include <sound/initval.h>
36#include <sound/tlv.h> 36#include <sound/tlv.h>
37 37
38#include <sound/sta32x.h>
38#include "sta32x.h" 39#include "sta32x.h"
39 40
40#define STA32X_RATES (SNDRV_PCM_RATE_32000 | \ 41#define STA32X_RATES (SNDRV_PCM_RATE_32000 | \
@@ -73,11 +74,14 @@ static const char *sta32x_supply_names[] = {
73struct sta32x_priv { 74struct sta32x_priv {
74 struct regulator_bulk_data supplies[ARRAY_SIZE(sta32x_supply_names)]; 75 struct regulator_bulk_data supplies[ARRAY_SIZE(sta32x_supply_names)];
75 struct snd_soc_codec *codec; 76 struct snd_soc_codec *codec;
77 struct sta32x_platform_data *pdata;
76 78
77 unsigned int mclk; 79 unsigned int mclk;
78 unsigned int format; 80 unsigned int format;
79 81
80 u32 coef_shadow[STA32X_COEF_COUNT]; 82 u32 coef_shadow[STA32X_COEF_COUNT];
83 struct delayed_work watchdog_work;
84 int shutdown;
81}; 85};
82 86
83static const DECLARE_TLV_DB_SCALE(mvol_tlv, -12700, 50, 1); 87static const DECLARE_TLV_DB_SCALE(mvol_tlv, -12700, 50, 1);
@@ -260,7 +264,7 @@ static int sta32x_coefficient_put(struct snd_kcontrol *kcontrol,
260 return 0; 264 return 0;
261} 265}
262 266
263int sta32x_sync_coef_shadow(struct snd_soc_codec *codec) 267static int sta32x_sync_coef_shadow(struct snd_soc_codec *codec)
264{ 268{
265 struct sta32x_priv *sta32x = snd_soc_codec_get_drvdata(codec); 269 struct sta32x_priv *sta32x = snd_soc_codec_get_drvdata(codec);
266 unsigned int cfud; 270 unsigned int cfud;
@@ -285,7 +289,7 @@ int sta32x_sync_coef_shadow(struct snd_soc_codec *codec)
285 return 0; 289 return 0;
286} 290}
287 291
288int sta32x_cache_sync(struct snd_soc_codec *codec) 292static int sta32x_cache_sync(struct snd_soc_codec *codec)
289{ 293{
290 unsigned int mute; 294 unsigned int mute;
291 int rc; 295 int rc;
@@ -302,6 +306,46 @@ int sta32x_cache_sync(struct snd_soc_codec *codec)
302 return rc; 306 return rc;
303} 307}
304 308
309/* work around ESD issue where sta32x resets and loses all configuration */
310static void sta32x_watchdog(struct work_struct *work)
311{
312 struct sta32x_priv *sta32x = container_of(work, struct sta32x_priv,
313 watchdog_work.work);
314 struct snd_soc_codec *codec = sta32x->codec;
315 unsigned int confa, confa_cached;
316
317 /* check if sta32x has reset itself */
318 confa_cached = snd_soc_read(codec, STA32X_CONFA);
319 codec->cache_bypass = 1;
320 confa = snd_soc_read(codec, STA32X_CONFA);
321 codec->cache_bypass = 0;
322 if (confa != confa_cached) {
323 codec->cache_sync = 1;
324 sta32x_cache_sync(codec);
325 }
326
327 if (!sta32x->shutdown)
328 schedule_delayed_work(&sta32x->watchdog_work,
329 round_jiffies_relative(HZ));
330}
331
332static void sta32x_watchdog_start(struct sta32x_priv *sta32x)
333{
334 if (sta32x->pdata->needs_esd_watchdog) {
335 sta32x->shutdown = 0;
336 schedule_delayed_work(&sta32x->watchdog_work,
337 round_jiffies_relative(HZ));
338 }
339}
340
341static void sta32x_watchdog_stop(struct sta32x_priv *sta32x)
342{
343 if (sta32x->pdata->needs_esd_watchdog) {
344 sta32x->shutdown = 1;
345 cancel_delayed_work_sync(&sta32x->watchdog_work);
346 }
347}
348
305#define SINGLE_COEF(xname, index) \ 349#define SINGLE_COEF(xname, index) \
306{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \ 350{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
307 .info = sta32x_coefficient_info, \ 351 .info = sta32x_coefficient_info, \
@@ -478,6 +522,7 @@ static int sta32x_set_dai_sysclk(struct snd_soc_dai *codec_dai,
478 rate_min = fs; 522 rate_min = fs;
479 if (fs > rate_max) 523 if (fs > rate_max)
480 rate_max = fs; 524 rate_max = fs;
525 break;
481 } 526 }
482 } 527 }
483 } 528 }
@@ -712,6 +757,7 @@ static int sta32x_set_bias_level(struct snd_soc_codec *codec,
712 } 757 }
713 758
714 sta32x_cache_sync(codec); 759 sta32x_cache_sync(codec);
760 sta32x_watchdog_start(sta32x);
715 } 761 }
716 762
717 /* Power up to mute */ 763 /* Power up to mute */
@@ -728,7 +774,7 @@ static int sta32x_set_bias_level(struct snd_soc_codec *codec,
728 STA32X_CONFF_PWDN | STA32X_CONFF_EAPD, 774 STA32X_CONFF_PWDN | STA32X_CONFF_EAPD,
729 STA32X_CONFF_PWDN); 775 STA32X_CONFF_PWDN);
730 msleep(300); 776 msleep(300);
731 777 sta32x_watchdog_stop(sta32x);
732 regulator_bulk_disable(ARRAY_SIZE(sta32x->supplies), 778 regulator_bulk_disable(ARRAY_SIZE(sta32x->supplies),
733 sta32x->supplies); 779 sta32x->supplies);
734 break; 780 break;
@@ -737,7 +783,7 @@ static int sta32x_set_bias_level(struct snd_soc_codec *codec,
737 return 0; 783 return 0;
738} 784}
739 785
740static struct snd_soc_dai_ops sta32x_dai_ops = { 786static const struct snd_soc_dai_ops sta32x_dai_ops = {
741 .hw_params = sta32x_hw_params, 787 .hw_params = sta32x_hw_params,
742 .set_sysclk = sta32x_set_dai_sysclk, 788 .set_sysclk = sta32x_set_dai_sysclk,
743 .set_fmt = sta32x_set_dai_fmt, 789 .set_fmt = sta32x_set_dai_fmt,
@@ -756,7 +802,7 @@ static struct snd_soc_dai_driver sta32x_dai = {
756}; 802};
757 803
758#ifdef CONFIG_PM 804#ifdef CONFIG_PM
759static int sta32x_suspend(struct snd_soc_codec *codec, pm_message_t state) 805static int sta32x_suspend(struct snd_soc_codec *codec)
760{ 806{
761 sta32x_set_bias_level(codec, SND_SOC_BIAS_OFF); 807 sta32x_set_bias_level(codec, SND_SOC_BIAS_OFF);
762 return 0; 808 return 0;
@@ -775,9 +821,10 @@ static int sta32x_resume(struct snd_soc_codec *codec)
775static int sta32x_probe(struct snd_soc_codec *codec) 821static int sta32x_probe(struct snd_soc_codec *codec)
776{ 822{
777 struct sta32x_priv *sta32x = snd_soc_codec_get_drvdata(codec); 823 struct sta32x_priv *sta32x = snd_soc_codec_get_drvdata(codec);
778 int i, ret = 0; 824 int i, ret = 0, thermal = 0;
779 825
780 sta32x->codec = codec; 826 sta32x->codec = codec;
827 sta32x->pdata = dev_get_platdata(codec->dev);
781 828
782 /* regulators */ 829 /* regulators */
783 for (i = 0; i < ARRAY_SIZE(sta32x->supplies); i++) 830 for (i = 0; i < ARRAY_SIZE(sta32x->supplies); i++)
@@ -820,25 +867,34 @@ static int sta32x_probe(struct snd_soc_codec *codec)
820 snd_soc_cache_write(codec, STA32X_AUTO3, 0x00); 867 snd_soc_cache_write(codec, STA32X_AUTO3, 0x00);
821 snd_soc_cache_write(codec, STA32X_C3CFG, 0x40); 868 snd_soc_cache_write(codec, STA32X_C3CFG, 0x40);
822 869
823 /* FIXME enable thermal warning adjustment and recovery */ 870 /* set thermal warning adjustment and recovery */
871 if (!(sta32x->pdata->thermal_conf & STA32X_THERMAL_ADJUSTMENT_ENABLE))
872 thermal |= STA32X_CONFA_TWAB;
873 if (!(sta32x->pdata->thermal_conf & STA32X_THERMAL_RECOVERY_ENABLE))
874 thermal |= STA32X_CONFA_TWRB;
824 snd_soc_update_bits(codec, STA32X_CONFA, 875 snd_soc_update_bits(codec, STA32X_CONFA,
825 STA32X_CONFA_TWAB | STA32X_CONFA_TWRB, 0); 876 STA32X_CONFA_TWAB | STA32X_CONFA_TWRB,
877 thermal);
826 878
827 /* FIXME select 2.1 mode */ 879 /* select output configuration */
828 snd_soc_update_bits(codec, STA32X_CONFF, 880 snd_soc_update_bits(codec, STA32X_CONFF,
829 STA32X_CONFF_OCFG_MASK, 881 STA32X_CONFF_OCFG_MASK,
830 1 << STA32X_CONFF_OCFG_SHIFT); 882 sta32x->pdata->output_conf
883 << STA32X_CONFF_OCFG_SHIFT);
831 884
832 /* FIXME channel to output mapping */ 885 /* channel to output mapping */
833 snd_soc_update_bits(codec, STA32X_C1CFG, 886 snd_soc_update_bits(codec, STA32X_C1CFG,
834 STA32X_CxCFG_OM_MASK, 887 STA32X_CxCFG_OM_MASK,
835 0 << STA32X_CxCFG_OM_SHIFT); 888 sta32x->pdata->ch1_output_mapping
889 << STA32X_CxCFG_OM_SHIFT);
836 snd_soc_update_bits(codec, STA32X_C2CFG, 890 snd_soc_update_bits(codec, STA32X_C2CFG,
837 STA32X_CxCFG_OM_MASK, 891 STA32X_CxCFG_OM_MASK,
838 1 << STA32X_CxCFG_OM_SHIFT); 892 sta32x->pdata->ch2_output_mapping
893 << STA32X_CxCFG_OM_SHIFT);
839 snd_soc_update_bits(codec, STA32X_C3CFG, 894 snd_soc_update_bits(codec, STA32X_C3CFG,
840 STA32X_CxCFG_OM_MASK, 895 STA32X_CxCFG_OM_MASK,
841 2 << STA32X_CxCFG_OM_SHIFT); 896 sta32x->pdata->ch3_output_mapping
897 << STA32X_CxCFG_OM_SHIFT);
842 898
843 /* initialize coefficient shadow RAM with reset values */ 899 /* initialize coefficient shadow RAM with reset values */
844 for (i = 4; i <= 49; i += 5) 900 for (i = 4; i <= 49; i += 5)
@@ -851,6 +907,9 @@ static int sta32x_probe(struct snd_soc_codec *codec)
851 sta32x->coef_shadow[60] = 0x400000; 907 sta32x->coef_shadow[60] = 0x400000;
852 sta32x->coef_shadow[61] = 0x400000; 908 sta32x->coef_shadow[61] = 0x400000;
853 909
910 if (sta32x->pdata->needs_esd_watchdog)
911 INIT_DELAYED_WORK(&sta32x->watchdog_work, sta32x_watchdog);
912
854 sta32x_set_bias_level(codec, SND_SOC_BIAS_STANDBY); 913 sta32x_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
855 /* Bias level configuration will have done an extra enable */ 914 /* Bias level configuration will have done an extra enable */
856 regulator_bulk_disable(ARRAY_SIZE(sta32x->supplies), sta32x->supplies); 915 regulator_bulk_disable(ARRAY_SIZE(sta32x->supplies), sta32x->supplies);
@@ -867,6 +926,7 @@ static int sta32x_remove(struct snd_soc_codec *codec)
867{ 926{
868 struct sta32x_priv *sta32x = snd_soc_codec_get_drvdata(codec); 927 struct sta32x_priv *sta32x = snd_soc_codec_get_drvdata(codec);
869 928
929 sta32x_watchdog_stop(sta32x);
870 sta32x_set_bias_level(codec, SND_SOC_BIAS_OFF); 930 sta32x_set_bias_level(codec, SND_SOC_BIAS_OFF);
871 regulator_bulk_disable(ARRAY_SIZE(sta32x->supplies), sta32x->supplies); 931 regulator_bulk_disable(ARRAY_SIZE(sta32x->supplies), sta32x->supplies);
872 regulator_bulk_free(ARRAY_SIZE(sta32x->supplies), sta32x->supplies); 932 regulator_bulk_free(ARRAY_SIZE(sta32x->supplies), sta32x->supplies);
@@ -909,28 +969,23 @@ static __devinit int sta32x_i2c_probe(struct i2c_client *i2c,
909 struct sta32x_priv *sta32x; 969 struct sta32x_priv *sta32x;
910 int ret; 970 int ret;
911 971
912 sta32x = kzalloc(sizeof(struct sta32x_priv), GFP_KERNEL); 972 sta32x = devm_kzalloc(&i2c->dev, sizeof(struct sta32x_priv),
973 GFP_KERNEL);
913 if (!sta32x) 974 if (!sta32x)
914 return -ENOMEM; 975 return -ENOMEM;
915 976
916 i2c_set_clientdata(i2c, sta32x); 977 i2c_set_clientdata(i2c, sta32x);
917 978
918 ret = snd_soc_register_codec(&i2c->dev, &sta32x_codec, &sta32x_dai, 1); 979 ret = snd_soc_register_codec(&i2c->dev, &sta32x_codec, &sta32x_dai, 1);
919 if (ret != 0) { 980 if (ret != 0)
920 dev_err(&i2c->dev, "Failed to register codec (%d)\n", ret); 981 dev_err(&i2c->dev, "Failed to register codec (%d)\n", ret);
921 kfree(sta32x);
922 return ret;
923 }
924 982
925 return 0; 983 return ret;
926} 984}
927 985
928static __devexit int sta32x_i2c_remove(struct i2c_client *client) 986static __devexit int sta32x_i2c_remove(struct i2c_client *client)
929{ 987{
930 struct sta32x_priv *sta32x = i2c_get_clientdata(client);
931
932 snd_soc_unregister_codec(&client->dev); 988 snd_soc_unregister_codec(&client->dev);
933 kfree(sta32x);
934 return 0; 989 return 0;
935} 990}
936 991
diff --git a/sound/soc/codecs/stac9766.c b/sound/soc/codecs/stac9766.c
index 78b2b50271e..cc0566c22ec 100644
--- a/sound/soc/codecs/stac9766.c
+++ b/sound/soc/codecs/stac9766.c
@@ -256,8 +256,7 @@ static int stac9766_reset(struct snd_soc_codec *codec, int try_warm)
256 return 0; 256 return 0;
257} 257}
258 258
259static int stac9766_codec_suspend(struct snd_soc_codec *codec, 259static int stac9766_codec_suspend(struct snd_soc_codec *codec)
260 pm_message_t state)
261{ 260{
262 stac9766_set_bias_level(codec, SND_SOC_BIAS_OFF); 261 stac9766_set_bias_level(codec, SND_SOC_BIAS_OFF);
263 return 0; 262 return 0;
@@ -286,11 +285,11 @@ reset:
286 return 0; 285 return 0;
287} 286}
288 287
289static struct snd_soc_dai_ops stac9766_dai_ops_analog = { 288static const struct snd_soc_dai_ops stac9766_dai_ops_analog = {
290 .prepare = ac97_analog_prepare, 289 .prepare = ac97_analog_prepare,
291}; 290};
292 291
293static struct snd_soc_dai_ops stac9766_dai_ops_digital = { 292static const struct snd_soc_dai_ops stac9766_dai_ops_digital = {
294 .prepare = ac97_digital_prepare, 293 .prepare = ac97_digital_prepare,
295}; 294};
296 295
@@ -380,7 +379,7 @@ static struct snd_soc_codec_driver soc_codec_dev_stac9766 = {
380 .remove = stac9766_codec_remove, 379 .remove = stac9766_codec_remove,
381 .suspend = stac9766_codec_suspend, 380 .suspend = stac9766_codec_suspend,
382 .resume = stac9766_codec_resume, 381 .resume = stac9766_codec_resume,
383 .reg_cache_size = sizeof(stac9766_reg), 382 .reg_cache_size = ARRAY_SIZE(stac9766_reg),
384 .reg_word_size = sizeof(u16), 383 .reg_word_size = sizeof(u16),
385 .reg_cache_step = 2, 384 .reg_cache_step = 2,
386 .reg_cache_default = stac9766_reg, 385 .reg_cache_default = stac9766_reg,
@@ -408,17 +407,7 @@ static struct platform_driver stac9766_codec_driver = {
408 .remove = __devexit_p(stac9766_remove), 407 .remove = __devexit_p(stac9766_remove),
409}; 408};
410 409
411static int __init stac9766_init(void) 410module_platform_driver(stac9766_codec_driver);
412{
413 return platform_driver_register(&stac9766_codec_driver);
414}
415module_init(stac9766_init);
416
417static void __exit stac9766_exit(void)
418{
419 platform_driver_unregister(&stac9766_codec_driver);
420}
421module_exit(stac9766_exit);
422 411
423MODULE_DESCRIPTION("ASoC stac9766 driver"); 412MODULE_DESCRIPTION("ASoC stac9766 driver");
424MODULE_AUTHOR("Jon Smirl <jonsmirl@gmail.com>"); 413MODULE_AUTHOR("Jon Smirl <jonsmirl@gmail.com>");
diff --git a/sound/soc/codecs/tlv320aic23.c b/sound/soc/codecs/tlv320aic23.c
index 336de8f69a0..dfa41a96599 100644
--- a/sound/soc/codecs/tlv320aic23.c
+++ b/sound/soc/codecs/tlv320aic23.c
@@ -24,7 +24,6 @@
24#include <linux/delay.h> 24#include <linux/delay.h>
25#include <linux/pm.h> 25#include <linux/pm.h>
26#include <linux/i2c.h> 26#include <linux/i2c.h>
27#include <linux/platform_device.h>
28#include <linux/slab.h> 27#include <linux/slab.h>
29#include <sound/core.h> 28#include <sound/core.h>
30#include <sound/pcm.h> 29#include <sound/pcm.h>
@@ -503,7 +502,7 @@ static int tlv320aic23_set_bias_level(struct snd_soc_codec *codec,
503#define AIC23_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \ 502#define AIC23_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \
504 SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S32_LE) 503 SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S32_LE)
505 504
506static struct snd_soc_dai_ops tlv320aic23_dai_ops = { 505static const struct snd_soc_dai_ops tlv320aic23_dai_ops = {
507 .prepare = tlv320aic23_pcm_prepare, 506 .prepare = tlv320aic23_pcm_prepare,
508 .hw_params = tlv320aic23_hw_params, 507 .hw_params = tlv320aic23_hw_params,
509 .shutdown = tlv320aic23_shutdown, 508 .shutdown = tlv320aic23_shutdown,
@@ -529,8 +528,7 @@ static struct snd_soc_dai_driver tlv320aic23_dai = {
529 .ops = &tlv320aic23_dai_ops, 528 .ops = &tlv320aic23_dai_ops,
530}; 529};
531 530
532static int tlv320aic23_suspend(struct snd_soc_codec *codec, 531static int tlv320aic23_suspend(struct snd_soc_codec *codec)
533 pm_message_t state)
534{ 532{
535 tlv320aic23_set_bias_level(codec, SND_SOC_BIAS_OFF); 533 tlv320aic23_set_bias_level(codec, SND_SOC_BIAS_OFF);
536 534
@@ -636,7 +634,7 @@ static int tlv320aic23_codec_probe(struct i2c_client *i2c,
636 if (!i2c_check_functionality(i2c->adapter, I2C_FUNC_SMBUS_BYTE_DATA)) 634 if (!i2c_check_functionality(i2c->adapter, I2C_FUNC_SMBUS_BYTE_DATA))
637 return -EINVAL; 635 return -EINVAL;
638 636
639 aic23 = kzalloc(sizeof(struct aic23), GFP_KERNEL); 637 aic23 = devm_kzalloc(&i2c->dev, sizeof(struct aic23), GFP_KERNEL);
640 if (aic23 == NULL) 638 if (aic23 == NULL)
641 return -ENOMEM; 639 return -ENOMEM;
642 640
@@ -645,14 +643,11 @@ static int tlv320aic23_codec_probe(struct i2c_client *i2c,
645 643
646 ret = snd_soc_register_codec(&i2c->dev, 644 ret = snd_soc_register_codec(&i2c->dev,
647 &soc_codec_dev_tlv320aic23, &tlv320aic23_dai, 1); 645 &soc_codec_dev_tlv320aic23, &tlv320aic23_dai, 1);
648 if (ret < 0)
649 kfree(aic23);
650 return ret; 646 return ret;
651} 647}
652static int __exit tlv320aic23_i2c_remove(struct i2c_client *i2c) 648static int __exit tlv320aic23_i2c_remove(struct i2c_client *i2c)
653{ 649{
654 snd_soc_unregister_codec(&i2c->dev); 650 snd_soc_unregister_codec(&i2c->dev);
655 kfree(i2c_get_clientdata(i2c));
656 return 0; 651 return 0;
657} 652}
658 653
diff --git a/sound/soc/codecs/tlv320aic26.c b/sound/soc/codecs/tlv320aic26.c
index 7859bdcc93d..a038daec682 100644
--- a/sound/soc/codecs/tlv320aic26.c
+++ b/sound/soc/codecs/tlv320aic26.c
@@ -275,7 +275,7 @@ static int aic26_set_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt)
275#define AIC26_FORMATS (SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_S16_BE |\ 275#define AIC26_FORMATS (SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_S16_BE |\
276 SNDRV_PCM_FMTBIT_S24_BE | SNDRV_PCM_FMTBIT_S32_BE) 276 SNDRV_PCM_FMTBIT_S24_BE | SNDRV_PCM_FMTBIT_S32_BE)
277 277
278static struct snd_soc_dai_ops aic26_dai_ops = { 278static const struct snd_soc_dai_ops aic26_dai_ops = {
279 .hw_params = aic26_hw_params, 279 .hw_params = aic26_hw_params,
280 .digital_mute = aic26_mute, 280 .digital_mute = aic26_mute,
281 .set_sysclk = aic26_set_sysclk, 281 .set_sysclk = aic26_set_sysclk,
@@ -416,7 +416,7 @@ static int aic26_spi_probe(struct spi_device *spi)
416 dev_dbg(&spi->dev, "probing tlv320aic26 spi device\n"); 416 dev_dbg(&spi->dev, "probing tlv320aic26 spi device\n");
417 417
418 /* Allocate driver data */ 418 /* Allocate driver data */
419 aic26 = kzalloc(sizeof *aic26, GFP_KERNEL); 419 aic26 = devm_kzalloc(&spi->dev, sizeof *aic26, GFP_KERNEL);
420 if (!aic26) 420 if (!aic26)
421 return -ENOMEM; 421 return -ENOMEM;
422 422
@@ -427,18 +427,12 @@ static int aic26_spi_probe(struct spi_device *spi)
427 427
428 ret = snd_soc_register_codec(&spi->dev, 428 ret = snd_soc_register_codec(&spi->dev,
429 &aic26_soc_codec_dev, &aic26_dai, 1); 429 &aic26_soc_codec_dev, &aic26_dai, 1);
430 if (ret < 0)
431 kfree(aic26);
432 return ret; 430 return ret;
433
434 dev_dbg(&spi->dev, "SPI device initialized\n");
435 return 0;
436} 431}
437 432
438static int aic26_spi_remove(struct spi_device *spi) 433static int aic26_spi_remove(struct spi_device *spi)
439{ 434{
440 snd_soc_unregister_codec(&spi->dev); 435 snd_soc_unregister_codec(&spi->dev);
441 kfree(spi_get_drvdata(spi));
442 return 0; 436 return 0;
443} 437}
444 438
diff --git a/sound/soc/codecs/tlv320aic32x4.c b/sound/soc/codecs/tlv320aic32x4.c
index b21c610051c..eb401ef021f 100644
--- a/sound/soc/codecs/tlv320aic32x4.c
+++ b/sound/soc/codecs/tlv320aic32x4.c
@@ -29,7 +29,6 @@
29#include <linux/delay.h> 29#include <linux/delay.h>
30#include <linux/pm.h> 30#include <linux/pm.h>
31#include <linux/i2c.h> 31#include <linux/i2c.h>
32#include <linux/platform_device.h>
33#include <linux/cdev.h> 32#include <linux/cdev.h>
34#include <linux/slab.h> 33#include <linux/slab.h>
35 34
@@ -597,7 +596,7 @@ static int aic32x4_set_bias_level(struct snd_soc_codec *codec,
597#define AIC32X4_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE \ 596#define AIC32X4_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE \
598 | SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S32_LE) 597 | SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S32_LE)
599 598
600static struct snd_soc_dai_ops aic32x4_ops = { 599static const struct snd_soc_dai_ops aic32x4_ops = {
601 .hw_params = aic32x4_hw_params, 600 .hw_params = aic32x4_hw_params,
602 .digital_mute = aic32x4_mute, 601 .digital_mute = aic32x4_mute,
603 .set_fmt = aic32x4_set_dai_fmt, 602 .set_fmt = aic32x4_set_dai_fmt,
@@ -622,7 +621,7 @@ static struct snd_soc_dai_driver aic32x4_dai = {
622 .symmetric_rates = 1, 621 .symmetric_rates = 1,
623}; 622};
624 623
625static int aic32x4_suspend(struct snd_soc_codec *codec, pm_message_t state) 624static int aic32x4_suspend(struct snd_soc_codec *codec)
626{ 625{
627 aic32x4_set_bias_level(codec, SND_SOC_BIAS_OFF); 626 aic32x4_set_bias_level(codec, SND_SOC_BIAS_OFF);
628 return 0; 627 return 0;
@@ -710,7 +709,8 @@ static __devinit int aic32x4_i2c_probe(struct i2c_client *i2c,
710 struct aic32x4_priv *aic32x4; 709 struct aic32x4_priv *aic32x4;
711 int ret; 710 int ret;
712 711
713 aic32x4 = kzalloc(sizeof(struct aic32x4_priv), GFP_KERNEL); 712 aic32x4 = devm_kzalloc(&i2c->dev, sizeof(struct aic32x4_priv),
713 GFP_KERNEL);
714 if (aic32x4 == NULL) 714 if (aic32x4 == NULL)
715 return -ENOMEM; 715 return -ENOMEM;
716 716
@@ -729,15 +729,12 @@ static __devinit int aic32x4_i2c_probe(struct i2c_client *i2c,
729 729
730 ret = snd_soc_register_codec(&i2c->dev, 730 ret = snd_soc_register_codec(&i2c->dev,
731 &soc_codec_dev_aic32x4, &aic32x4_dai, 1); 731 &soc_codec_dev_aic32x4, &aic32x4_dai, 1);
732 if (ret < 0)
733 kfree(aic32x4);
734 return ret; 732 return ret;
735} 733}
736 734
737static __devexit int aic32x4_i2c_remove(struct i2c_client *client) 735static __devexit int aic32x4_i2c_remove(struct i2c_client *client)
738{ 736{
739 snd_soc_unregister_codec(&client->dev); 737 snd_soc_unregister_codec(&client->dev);
740 kfree(i2c_get_clientdata(client));
741 return 0; 738 return 0;
742} 739}
743 740
diff --git a/sound/soc/codecs/tlv320aic3x.c b/sound/soc/codecs/tlv320aic3x.c
index 87d5ef188e2..492f22f8a4d 100644
--- a/sound/soc/codecs/tlv320aic3x.c
+++ b/sound/soc/codecs/tlv320aic3x.c
@@ -40,7 +40,6 @@
40#include <linux/i2c.h> 40#include <linux/i2c.h>
41#include <linux/gpio.h> 41#include <linux/gpio.h>
42#include <linux/regulator/consumer.h> 42#include <linux/regulator/consumer.h>
43#include <linux/platform_device.h>
44#include <linux/slab.h> 43#include <linux/slab.h>
45#include <sound/core.h> 44#include <sound/core.h>
46#include <sound/pcm.h> 45#include <sound/pcm.h>
@@ -833,7 +832,6 @@ static int aic3x_hw_params(struct snd_pcm_substream *substream,
833 int codec_clk = 0, bypass_pll = 0, fsref, last_clk = 0; 832 int codec_clk = 0, bypass_pll = 0, fsref, last_clk = 0;
834 u8 data, j, r, p, pll_q, pll_p = 1, pll_r = 1, pll_j = 1; 833 u8 data, j, r, p, pll_q, pll_p = 1, pll_r = 1, pll_j = 1;
835 u16 d, pll_d = 1; 834 u16 d, pll_d = 1;
836 u8 reg;
837 int clk; 835 int clk;
838 836
839 /* select data word length */ 837 /* select data word length */
@@ -869,14 +867,13 @@ static int aic3x_hw_params(struct snd_pcm_substream *substream,
869 snd_soc_write(codec, AIC3X_PLL_PROGA_REG, pll_q << PLLQ_SHIFT); 867 snd_soc_write(codec, AIC3X_PLL_PROGA_REG, pll_q << PLLQ_SHIFT);
870 snd_soc_write(codec, AIC3X_GPIOB_REG, CODEC_CLKIN_CLKDIV); 868 snd_soc_write(codec, AIC3X_GPIOB_REG, CODEC_CLKIN_CLKDIV);
871 /* disable PLL if it is bypassed */ 869 /* disable PLL if it is bypassed */
872 reg = snd_soc_read(codec, AIC3X_PLL_PROGA_REG); 870 snd_soc_update_bits(codec, AIC3X_PLL_PROGA_REG, PLL_ENABLE, 0);
873 snd_soc_write(codec, AIC3X_PLL_PROGA_REG, reg & ~PLL_ENABLE);
874 871
875 } else { 872 } else {
876 snd_soc_write(codec, AIC3X_GPIOB_REG, CODEC_CLKIN_PLLDIV); 873 snd_soc_write(codec, AIC3X_GPIOB_REG, CODEC_CLKIN_PLLDIV);
877 /* enable PLL when it is used */ 874 /* enable PLL when it is used */
878 reg = snd_soc_read(codec, AIC3X_PLL_PROGA_REG); 875 snd_soc_update_bits(codec, AIC3X_PLL_PROGA_REG,
879 snd_soc_write(codec, AIC3X_PLL_PROGA_REG, reg | PLL_ENABLE); 876 PLL_ENABLE, PLL_ENABLE);
880 } 877 }
881 878
882 /* Route Left DAC to left channel input and 879 /* Route Left DAC to left channel input and
@@ -1156,7 +1153,6 @@ static int aic3x_set_bias_level(struct snd_soc_codec *codec,
1156 enum snd_soc_bias_level level) 1153 enum snd_soc_bias_level level)
1157{ 1154{
1158 struct aic3x_priv *aic3x = snd_soc_codec_get_drvdata(codec); 1155 struct aic3x_priv *aic3x = snd_soc_codec_get_drvdata(codec);
1159 u8 reg;
1160 1156
1161 switch (level) { 1157 switch (level) {
1162 case SND_SOC_BIAS_ON: 1158 case SND_SOC_BIAS_ON:
@@ -1165,9 +1161,8 @@ static int aic3x_set_bias_level(struct snd_soc_codec *codec,
1165 if (codec->dapm.bias_level == SND_SOC_BIAS_STANDBY && 1161 if (codec->dapm.bias_level == SND_SOC_BIAS_STANDBY &&
1166 aic3x->master) { 1162 aic3x->master) {
1167 /* enable pll */ 1163 /* enable pll */
1168 reg = snd_soc_read(codec, AIC3X_PLL_PROGA_REG); 1164 snd_soc_update_bits(codec, AIC3X_PLL_PROGA_REG,
1169 snd_soc_write(codec, AIC3X_PLL_PROGA_REG, 1165 PLL_ENABLE, PLL_ENABLE);
1170 reg | PLL_ENABLE);
1171 } 1166 }
1172 break; 1167 break;
1173 case SND_SOC_BIAS_STANDBY: 1168 case SND_SOC_BIAS_STANDBY:
@@ -1176,9 +1171,8 @@ static int aic3x_set_bias_level(struct snd_soc_codec *codec,
1176 if (codec->dapm.bias_level == SND_SOC_BIAS_PREPARE && 1171 if (codec->dapm.bias_level == SND_SOC_BIAS_PREPARE &&
1177 aic3x->master) { 1172 aic3x->master) {
1178 /* disable pll */ 1173 /* disable pll */
1179 reg = snd_soc_read(codec, AIC3X_PLL_PROGA_REG); 1174 snd_soc_update_bits(codec, AIC3X_PLL_PROGA_REG,
1180 snd_soc_write(codec, AIC3X_PLL_PROGA_REG, 1175 PLL_ENABLE, 0);
1181 reg & ~PLL_ENABLE);
1182 } 1176 }
1183 break; 1177 break;
1184 case SND_SOC_BIAS_OFF: 1178 case SND_SOC_BIAS_OFF:
@@ -1249,7 +1243,7 @@ EXPORT_SYMBOL_GPL(aic3x_button_pressed);
1249#define AIC3X_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \ 1243#define AIC3X_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \
1250 SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S32_LE) 1244 SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S32_LE)
1251 1245
1252static struct snd_soc_dai_ops aic3x_dai_ops = { 1246static const struct snd_soc_dai_ops aic3x_dai_ops = {
1253 .hw_params = aic3x_hw_params, 1247 .hw_params = aic3x_hw_params,
1254 .digital_mute = aic3x_mute, 1248 .digital_mute = aic3x_mute,
1255 .set_sysclk = aic3x_set_dai_sysclk, 1249 .set_sysclk = aic3x_set_dai_sysclk,
@@ -1274,7 +1268,7 @@ static struct snd_soc_dai_driver aic3x_dai = {
1274 .symmetric_rates = 1, 1268 .symmetric_rates = 1,
1275}; 1269};
1276 1270
1277static int aic3x_suspend(struct snd_soc_codec *codec, pm_message_t state) 1271static int aic3x_suspend(struct snd_soc_codec *codec)
1278{ 1272{
1279 aic3x_set_bias_level(codec, SND_SOC_BIAS_OFF); 1273 aic3x_set_bias_level(codec, SND_SOC_BIAS_OFF);
1280 1274
@@ -1295,7 +1289,6 @@ static int aic3x_resume(struct snd_soc_codec *codec)
1295static int aic3x_init(struct snd_soc_codec *codec) 1289static int aic3x_init(struct snd_soc_codec *codec)
1296{ 1290{
1297 struct aic3x_priv *aic3x = snd_soc_codec_get_drvdata(codec); 1291 struct aic3x_priv *aic3x = snd_soc_codec_get_drvdata(codec);
1298 int reg;
1299 1292
1300 snd_soc_write(codec, AIC3X_PAGE_SELECT, PAGE0_SELECT); 1293 snd_soc_write(codec, AIC3X_PAGE_SELECT, PAGE0_SELECT);
1301 snd_soc_write(codec, AIC3X_RESET, SOFT_RESET); 1294 snd_soc_write(codec, AIC3X_RESET, SOFT_RESET);
@@ -1317,20 +1310,13 @@ static int aic3x_init(struct snd_soc_codec *codec)
1317 snd_soc_write(codec, DACR1_2_MONOLOPM_VOL, DEFAULT_VOL | ROUTE_ON); 1310 snd_soc_write(codec, DACR1_2_MONOLOPM_VOL, DEFAULT_VOL | ROUTE_ON);
1318 1311
1319 /* unmute all outputs */ 1312 /* unmute all outputs */
1320 reg = snd_soc_read(codec, LLOPM_CTRL); 1313 snd_soc_update_bits(codec, LLOPM_CTRL, UNMUTE, UNMUTE);
1321 snd_soc_write(codec, LLOPM_CTRL, reg | UNMUTE); 1314 snd_soc_update_bits(codec, RLOPM_CTRL, UNMUTE, UNMUTE);
1322 reg = snd_soc_read(codec, RLOPM_CTRL); 1315 snd_soc_update_bits(codec, MONOLOPM_CTRL, UNMUTE, UNMUTE);
1323 snd_soc_write(codec, RLOPM_CTRL, reg | UNMUTE); 1316 snd_soc_update_bits(codec, HPLOUT_CTRL, UNMUTE, UNMUTE);
1324 reg = snd_soc_read(codec, MONOLOPM_CTRL); 1317 snd_soc_update_bits(codec, HPROUT_CTRL, UNMUTE, UNMUTE);
1325 snd_soc_write(codec, MONOLOPM_CTRL, reg | UNMUTE); 1318 snd_soc_update_bits(codec, HPLCOM_CTRL, UNMUTE, UNMUTE);
1326 reg = snd_soc_read(codec, HPLOUT_CTRL); 1319 snd_soc_update_bits(codec, HPRCOM_CTRL, UNMUTE, UNMUTE);
1327 snd_soc_write(codec, HPLOUT_CTRL, reg | UNMUTE);
1328 reg = snd_soc_read(codec, HPROUT_CTRL);
1329 snd_soc_write(codec, HPROUT_CTRL, reg | UNMUTE);
1330 reg = snd_soc_read(codec, HPLCOM_CTRL);
1331 snd_soc_write(codec, HPLCOM_CTRL, reg | UNMUTE);
1332 reg = snd_soc_read(codec, HPRCOM_CTRL);
1333 snd_soc_write(codec, HPRCOM_CTRL, reg | UNMUTE);
1334 1320
1335 /* ADC default volume and unmute */ 1321 /* ADC default volume and unmute */
1336 snd_soc_write(codec, LADC_VOL, DEFAULT_GAIN); 1322 snd_soc_write(codec, LADC_VOL, DEFAULT_GAIN);
@@ -1494,7 +1480,6 @@ static struct snd_soc_codec_driver soc_codec_dev_aic3x = {
1494 .resume = aic3x_resume, 1480 .resume = aic3x_resume,
1495}; 1481};
1496 1482
1497#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
1498/* 1483/*
1499 * AIC3X 2 wire address can be up to 4 devices with device addresses 1484 * AIC3X 2 wire address can be up to 4 devices with device addresses
1500 * 0x18, 0x19, 0x1A, 0x1B 1485 * 0x18, 0x19, 0x1A, 0x1B
@@ -1519,7 +1504,7 @@ static int aic3x_i2c_probe(struct i2c_client *i2c,
1519 struct aic3x_priv *aic3x; 1504 struct aic3x_priv *aic3x;
1520 int ret; 1505 int ret;
1521 1506
1522 aic3x = kzalloc(sizeof(struct aic3x_priv), GFP_KERNEL); 1507 aic3x = devm_kzalloc(&i2c->dev, sizeof(struct aic3x_priv), GFP_KERNEL);
1523 if (aic3x == NULL) { 1508 if (aic3x == NULL) {
1524 dev_err(&i2c->dev, "failed to create private data\n"); 1509 dev_err(&i2c->dev, "failed to create private data\n");
1525 return -ENOMEM; 1510 return -ENOMEM;
@@ -1539,15 +1524,12 @@ static int aic3x_i2c_probe(struct i2c_client *i2c,
1539 1524
1540 ret = snd_soc_register_codec(&i2c->dev, 1525 ret = snd_soc_register_codec(&i2c->dev,
1541 &soc_codec_dev_aic3x, &aic3x_dai, 1); 1526 &soc_codec_dev_aic3x, &aic3x_dai, 1);
1542 if (ret < 0)
1543 kfree(aic3x);
1544 return ret; 1527 return ret;
1545} 1528}
1546 1529
1547static int aic3x_i2c_remove(struct i2c_client *client) 1530static int aic3x_i2c_remove(struct i2c_client *client)
1548{ 1531{
1549 snd_soc_unregister_codec(&client->dev); 1532 snd_soc_unregister_codec(&client->dev);
1550 kfree(i2c_get_clientdata(client));
1551 return 0; 1533 return 0;
1552} 1534}
1553 1535
@@ -1561,27 +1543,22 @@ static struct i2c_driver aic3x_i2c_driver = {
1561 .remove = aic3x_i2c_remove, 1543 .remove = aic3x_i2c_remove,
1562 .id_table = aic3x_i2c_id, 1544 .id_table = aic3x_i2c_id,
1563}; 1545};
1564#endif
1565 1546
1566static int __init aic3x_modinit(void) 1547static int __init aic3x_modinit(void)
1567{ 1548{
1568 int ret = 0; 1549 int ret = 0;
1569#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
1570 ret = i2c_add_driver(&aic3x_i2c_driver); 1550 ret = i2c_add_driver(&aic3x_i2c_driver);
1571 if (ret != 0) { 1551 if (ret != 0) {
1572 printk(KERN_ERR "Failed to register TLV320AIC3x I2C driver: %d\n", 1552 printk(KERN_ERR "Failed to register TLV320AIC3x I2C driver: %d\n",
1573 ret); 1553 ret);
1574 } 1554 }
1575#endif
1576 return ret; 1555 return ret;
1577} 1556}
1578module_init(aic3x_modinit); 1557module_init(aic3x_modinit);
1579 1558
1580static void __exit aic3x_exit(void) 1559static void __exit aic3x_exit(void)
1581{ 1560{
1582#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
1583 i2c_del_driver(&aic3x_i2c_driver); 1561 i2c_del_driver(&aic3x_i2c_driver);
1584#endif
1585} 1562}
1586module_exit(aic3x_exit); 1563module_exit(aic3x_exit);
1587 1564
diff --git a/sound/soc/codecs/tlv320dac33.c b/sound/soc/codecs/tlv320dac33.c
index dc8a2b2bdc1..f0aad26cdb3 100644
--- a/sound/soc/codecs/tlv320dac33.c
+++ b/sound/soc/codecs/tlv320dac33.c
@@ -27,7 +27,6 @@
27#include <linux/delay.h> 27#include <linux/delay.h>
28#include <linux/pm.h> 28#include <linux/pm.h>
29#include <linux/i2c.h> 29#include <linux/i2c.h>
30#include <linux/platform_device.h>
31#include <linux/interrupt.h> 30#include <linux/interrupt.h>
32#include <linux/gpio.h> 31#include <linux/gpio.h>
33#include <linux/regulator/consumer.h> 32#include <linux/regulator/consumer.h>
@@ -1461,7 +1460,7 @@ static int dac33_soc_remove(struct snd_soc_codec *codec)
1461 return 0; 1460 return 0;
1462} 1461}
1463 1462
1464static int dac33_soc_suspend(struct snd_soc_codec *codec, pm_message_t state) 1463static int dac33_soc_suspend(struct snd_soc_codec *codec)
1465{ 1464{
1466 dac33_set_bias_level(codec, SND_SOC_BIAS_OFF); 1465 dac33_set_bias_level(codec, SND_SOC_BIAS_OFF);
1467 1466
@@ -1499,7 +1498,7 @@ static struct snd_soc_codec_driver soc_codec_dev_tlv320dac33 = {
1499 SNDRV_PCM_RATE_48000) 1498 SNDRV_PCM_RATE_48000)
1500#define DAC33_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S32_LE) 1499#define DAC33_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S32_LE)
1501 1500
1502static struct snd_soc_dai_ops dac33_dai_ops = { 1501static const struct snd_soc_dai_ops dac33_dai_ops = {
1503 .startup = dac33_startup, 1502 .startup = dac33_startup,
1504 .shutdown = dac33_shutdown, 1503 .shutdown = dac33_shutdown,
1505 .hw_params = dac33_hw_params, 1504 .hw_params = dac33_hw_params,
@@ -1533,7 +1532,8 @@ static int __devinit dac33_i2c_probe(struct i2c_client *client,
1533 } 1532 }
1534 pdata = client->dev.platform_data; 1533 pdata = client->dev.platform_data;
1535 1534
1536 dac33 = kzalloc(sizeof(struct tlv320dac33_priv), GFP_KERNEL); 1535 dac33 = devm_kzalloc(&client->dev, sizeof(struct tlv320dac33_priv),
1536 GFP_KERNEL);
1537 if (dac33 == NULL) 1537 if (dac33 == NULL)
1538 return -ENOMEM; 1538 return -ENOMEM;
1539 1539
@@ -1588,7 +1588,6 @@ err_get:
1588 if (dac33->power_gpio >= 0) 1588 if (dac33->power_gpio >= 0)
1589 gpio_free(dac33->power_gpio); 1589 gpio_free(dac33->power_gpio);
1590err_gpio: 1590err_gpio:
1591 kfree(dac33);
1592 return ret; 1591 return ret;
1593} 1592}
1594 1593
@@ -1605,8 +1604,6 @@ static int __devexit dac33_i2c_remove(struct i2c_client *client)
1605 regulator_bulk_free(ARRAY_SIZE(dac33->supplies), dac33->supplies); 1604 regulator_bulk_free(ARRAY_SIZE(dac33->supplies), dac33->supplies);
1606 1605
1607 snd_soc_unregister_codec(&client->dev); 1606 snd_soc_unregister_codec(&client->dev);
1608 kfree(dac33);
1609
1610 return 0; 1607 return 0;
1611} 1608}
1612 1609
diff --git a/sound/soc/codecs/tpa6130a2.c b/sound/soc/codecs/tpa6130a2.c
index 7eeca79d738..363b99dad8e 100644
--- a/sound/soc/codecs/tpa6130a2.c
+++ b/sound/soc/codecs/tpa6130a2.c
@@ -376,7 +376,7 @@ static int __devinit tpa6130a2_probe(struct i2c_client *client,
376 return -ENODEV; 376 return -ENODEV;
377 } 377 }
378 378
379 data = kzalloc(sizeof(*data), GFP_KERNEL); 379 data = devm_kzalloc(&client->dev, sizeof(*data), GFP_KERNEL);
380 if (data == NULL) { 380 if (data == NULL) {
381 dev_err(dev, "Can not allocate memory\n"); 381 dev_err(dev, "Can not allocate memory\n");
382 return -ENOMEM; 382 return -ENOMEM;
@@ -450,7 +450,6 @@ err_regulator:
450 if (data->power_gpio >= 0) 450 if (data->power_gpio >= 0)
451 gpio_free(data->power_gpio); 451 gpio_free(data->power_gpio);
452err_gpio: 452err_gpio:
453 kfree(data);
454 tpa6130a2_client = NULL; 453 tpa6130a2_client = NULL;
455 454
456 return ret; 455 return ret;
@@ -466,8 +465,6 @@ static int __devexit tpa6130a2_remove(struct i2c_client *client)
466 gpio_free(data->power_gpio); 465 gpio_free(data->power_gpio);
467 466
468 regulator_put(data->supply); 467 regulator_put(data->supply);
469
470 kfree(data);
471 tpa6130a2_client = NULL; 468 tpa6130a2_client = NULL;
472 469
473 return 0; 470 return 0;
diff --git a/sound/soc/codecs/twl4030.c b/sound/soc/codecs/twl4030.c
index f798247ac1b..18e71014cc2 100644
--- a/sound/soc/codecs/twl4030.c
+++ b/sound/soc/codecs/twl4030.c
@@ -2149,7 +2149,7 @@ static int twl4030_voice_set_tristate(struct snd_soc_dai *dai, int tristate)
2149#define TWL4030_RATES (SNDRV_PCM_RATE_8000_48000) 2149#define TWL4030_RATES (SNDRV_PCM_RATE_8000_48000)
2150#define TWL4030_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S32_LE) 2150#define TWL4030_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S32_LE)
2151 2151
2152static struct snd_soc_dai_ops twl4030_dai_hifi_ops = { 2152static const struct snd_soc_dai_ops twl4030_dai_hifi_ops = {
2153 .startup = twl4030_startup, 2153 .startup = twl4030_startup,
2154 .shutdown = twl4030_shutdown, 2154 .shutdown = twl4030_shutdown,
2155 .hw_params = twl4030_hw_params, 2155 .hw_params = twl4030_hw_params,
@@ -2158,7 +2158,7 @@ static struct snd_soc_dai_ops twl4030_dai_hifi_ops = {
2158 .set_tristate = twl4030_set_tristate, 2158 .set_tristate = twl4030_set_tristate,
2159}; 2159};
2160 2160
2161static struct snd_soc_dai_ops twl4030_dai_voice_ops = { 2161static const struct snd_soc_dai_ops twl4030_dai_voice_ops = {
2162 .startup = twl4030_voice_startup, 2162 .startup = twl4030_voice_startup,
2163 .shutdown = twl4030_voice_shutdown, 2163 .shutdown = twl4030_voice_shutdown,
2164 .hw_params = twl4030_voice_hw_params, 2164 .hw_params = twl4030_voice_hw_params,
@@ -2202,7 +2202,7 @@ static struct snd_soc_dai_driver twl4030_dai[] = {
2202}, 2202},
2203}; 2203};
2204 2204
2205static int twl4030_soc_suspend(struct snd_soc_codec *codec, pm_message_t state) 2205static int twl4030_soc_suspend(struct snd_soc_codec *codec)
2206{ 2206{
2207 twl4030_set_bias_level(codec, SND_SOC_BIAS_OFF); 2207 twl4030_set_bias_level(codec, SND_SOC_BIAS_OFF);
2208 return 0; 2208 return 0;
@@ -2294,17 +2294,7 @@ static struct platform_driver twl4030_codec_driver = {
2294 }, 2294 },
2295}; 2295};
2296 2296
2297static int __init twl4030_modinit(void) 2297module_platform_driver(twl4030_codec_driver);
2298{
2299 return platform_driver_register(&twl4030_codec_driver);
2300}
2301module_init(twl4030_modinit);
2302
2303static void __exit twl4030_exit(void)
2304{
2305 platform_driver_unregister(&twl4030_codec_driver);
2306}
2307module_exit(twl4030_exit);
2308 2298
2309MODULE_DESCRIPTION("ASoC TWL4030 codec driver"); 2299MODULE_DESCRIPTION("ASoC TWL4030 codec driver");
2310MODULE_AUTHOR("Steve Sakoman"); 2300MODULE_AUTHOR("Steve Sakoman");
diff --git a/sound/soc/codecs/twl6040.c b/sound/soc/codecs/twl6040.c
index 73e11f022de..5b9c79b6f65 100644
--- a/sound/soc/codecs/twl6040.c
+++ b/sound/soc/codecs/twl6040.c
@@ -33,6 +33,7 @@
33#include <sound/pcm.h> 33#include <sound/pcm.h>
34#include <sound/pcm_params.h> 34#include <sound/pcm_params.h>
35#include <sound/soc.h> 35#include <sound/soc.h>
36#include <sound/soc-dapm.h>
36#include <sound/initval.h> 37#include <sound/initval.h>
37#include <sound/tlv.h> 38#include <sound/tlv.h>
38 39
@@ -1012,6 +1013,28 @@ static int twl6040_pll_put_enum(struct snd_kcontrol *kcontrol,
1012 return 0; 1013 return 0;
1013} 1014}
1014 1015
1016int twl6040_get_dl1_gain(struct snd_soc_codec *codec)
1017{
1018 struct snd_soc_dapm_context *dapm = &codec->dapm;
1019
1020 if (snd_soc_dapm_get_pin_status(dapm, "EP"))
1021 return -1; /* -1dB */
1022
1023 if (snd_soc_dapm_get_pin_status(dapm, "HSOR") ||
1024 snd_soc_dapm_get_pin_status(dapm, "HSOL")) {
1025
1026 u8 val = snd_soc_read(codec, TWL6040_REG_HSLCTL);
1027 if (val & TWL6040_HSDACMODE)
1028 /* HSDACL in LP mode */
1029 return -8; /* -8dB */
1030 else
1031 /* HSDACL in HP mode */
1032 return -1; /* -1dB */
1033 }
1034 return 0; /* 0dB */
1035}
1036EXPORT_SYMBOL_GPL(twl6040_get_dl1_gain);
1037
1015int twl6040_get_clk_id(struct snd_soc_codec *codec) 1038int twl6040_get_clk_id(struct snd_soc_codec *codec)
1016{ 1039{
1017 struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec); 1040 struct twl6040_data *priv = snd_soc_codec_get_drvdata(codec);
@@ -1397,7 +1420,7 @@ static int twl6040_set_dai_sysclk(struct snd_soc_dai *codec_dai,
1397 return 0; 1420 return 0;
1398} 1421}
1399 1422
1400static struct snd_soc_dai_ops twl6040_dai_ops = { 1423static const struct snd_soc_dai_ops twl6040_dai_ops = {
1401 .startup = twl6040_startup, 1424 .startup = twl6040_startup,
1402 .hw_params = twl6040_hw_params, 1425 .hw_params = twl6040_hw_params,
1403 .prepare = twl6040_prepare, 1426 .prepare = twl6040_prepare,
@@ -1470,7 +1493,7 @@ static struct snd_soc_dai_driver twl6040_dai[] = {
1470}; 1493};
1471 1494
1472#ifdef CONFIG_PM 1495#ifdef CONFIG_PM
1473static int twl6040_suspend(struct snd_soc_codec *codec, pm_message_t state) 1496static int twl6040_suspend(struct snd_soc_codec *codec)
1474{ 1497{
1475 twl6040_set_bias_level(codec, SND_SOC_BIAS_OFF); 1498 twl6040_set_bias_level(codec, SND_SOC_BIAS_OFF);
1476 1499
@@ -1620,17 +1643,7 @@ static struct platform_driver twl6040_codec_driver = {
1620 .remove = __devexit_p(twl6040_codec_remove), 1643 .remove = __devexit_p(twl6040_codec_remove),
1621}; 1644};
1622 1645
1623static int __init twl6040_codec_init(void) 1646module_platform_driver(twl6040_codec_driver);
1624{
1625 return platform_driver_register(&twl6040_codec_driver);
1626}
1627module_init(twl6040_codec_init);
1628
1629static void __exit twl6040_codec_exit(void)
1630{
1631 platform_driver_unregister(&twl6040_codec_driver);
1632}
1633module_exit(twl6040_codec_exit);
1634 1647
1635MODULE_DESCRIPTION("ASoC TWL6040 codec driver"); 1648MODULE_DESCRIPTION("ASoC TWL6040 codec driver");
1636MODULE_AUTHOR("Misael Lopez Cruz"); 1649MODULE_AUTHOR("Misael Lopez Cruz");
diff --git a/sound/soc/codecs/twl6040.h b/sound/soc/codecs/twl6040.h
index a83277bdb85..ef273f1fac2 100644
--- a/sound/soc/codecs/twl6040.h
+++ b/sound/soc/codecs/twl6040.h
@@ -34,6 +34,7 @@ enum twl6040_trim {
34#define TWL6040_HSF_TRIM_LEFT(x) (x & 0x0f) 34#define TWL6040_HSF_TRIM_LEFT(x) (x & 0x0f)
35#define TWL6040_HSF_TRIM_RIGHT(x) ((x >> 4) & 0x0f) 35#define TWL6040_HSF_TRIM_RIGHT(x) ((x >> 4) & 0x0f)
36 36
37int twl6040_get_dl1_gain(struct snd_soc_codec *codec);
37void twl6040_hs_jack_detect(struct snd_soc_codec *codec, 38void twl6040_hs_jack_detect(struct snd_soc_codec *codec,
38 struct snd_soc_jack *jack, int report); 39 struct snd_soc_jack *jack, int report);
39int twl6040_get_clk_id(struct snd_soc_codec *codec); 40int twl6040_get_clk_id(struct snd_soc_codec *codec);
diff --git a/sound/soc/codecs/uda134x.c b/sound/soc/codecs/uda134x.c
index a7b8f301bad..8f4f469d641 100644
--- a/sound/soc/codecs/uda134x.c
+++ b/sound/soc/codecs/uda134x.c
@@ -452,7 +452,7 @@ SOC_ENUM("PCM Playback De-emphasis", uda134x_mixer_enum[1]),
452SOC_SINGLE("DC Filter Enable Switch", UDA134X_STATUS0, 0, 1, 0), 452SOC_SINGLE("DC Filter Enable Switch", UDA134X_STATUS0, 0, 1, 0),
453}; 453};
454 454
455static struct snd_soc_dai_ops uda134x_dai_ops = { 455static const struct snd_soc_dai_ops uda134x_dai_ops = {
456 .startup = uda134x_startup, 456 .startup = uda134x_startup,
457 .shutdown = uda134x_shutdown, 457 .shutdown = uda134x_shutdown,
458 .hw_params = uda134x_hw_params, 458 .hw_params = uda134x_hw_params,
@@ -571,8 +571,7 @@ static int uda134x_soc_remove(struct snd_soc_codec *codec)
571} 571}
572 572
573#if defined(CONFIG_PM) 573#if defined(CONFIG_PM)
574static int uda134x_soc_suspend(struct snd_soc_codec *codec, 574static int uda134x_soc_suspend(struct snd_soc_codec *codec)
575 pm_message_t state)
576{ 575{
577 uda134x_set_bias_level(codec, SND_SOC_BIAS_STANDBY); 576 uda134x_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
578 uda134x_set_bias_level(codec, SND_SOC_BIAS_OFF); 577 uda134x_set_bias_level(codec, SND_SOC_BIAS_OFF);
@@ -625,17 +624,7 @@ static struct platform_driver uda134x_codec_driver = {
625 .remove = __devexit_p(uda134x_codec_remove), 624 .remove = __devexit_p(uda134x_codec_remove),
626}; 625};
627 626
628static int __init uda134x_codec_init(void) 627module_platform_driver(uda134x_codec_driver);
629{
630 return platform_driver_register(&uda134x_codec_driver);
631}
632module_init(uda134x_codec_init);
633
634static void __exit uda134x_codec_exit(void)
635{
636 platform_driver_unregister(&uda134x_codec_driver);
637}
638module_exit(uda134x_codec_exit);
639 628
640MODULE_DESCRIPTION("UDA134X ALSA soc codec driver"); 629MODULE_DESCRIPTION("UDA134X ALSA soc codec driver");
641MODULE_AUTHOR("Zoltan Devai, Christian Pellegrin <chripell@evolware.org>"); 630MODULE_AUTHOR("Zoltan Devai, Christian Pellegrin <chripell@evolware.org>");
diff --git a/sound/soc/codecs/uda1380.c b/sound/soc/codecs/uda1380.c
index c5ca8cfea60..4f1b23d7e40 100644
--- a/sound/soc/codecs/uda1380.c
+++ b/sound/soc/codecs/uda1380.c
@@ -373,7 +373,7 @@ static const struct snd_soc_dapm_widget uda1380_dapm_widgets[] = {
373 SND_SOC_DAPM_PGA("HeadPhone Driver", UDA1380_PM, 13, 0, NULL, 0), 373 SND_SOC_DAPM_PGA("HeadPhone Driver", UDA1380_PM, 13, 0, NULL, 0),
374}; 374};
375 375
376static const struct snd_soc_dapm_route audio_map[] = { 376static const struct snd_soc_dapm_route uda1380_dapm_routes[] = {
377 377
378 /* output mux */ 378 /* output mux */
379 {"HeadPhone Driver", NULL, "Output Mux"}, 379 {"HeadPhone Driver", NULL, "Output Mux"},
@@ -410,17 +410,6 @@ static const struct snd_soc_dapm_route audio_map[] = {
410 {"Right PGA", NULL, "VINR"}, 410 {"Right PGA", NULL, "VINR"},
411}; 411};
412 412
413static int uda1380_add_widgets(struct snd_soc_codec *codec)
414{
415 struct snd_soc_dapm_context *dapm = &codec->dapm;
416
417 snd_soc_dapm_new_controls(dapm, uda1380_dapm_widgets,
418 ARRAY_SIZE(uda1380_dapm_widgets));
419 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
420
421 return 0;
422}
423
424static int uda1380_set_dai_fmt_both(struct snd_soc_dai *codec_dai, 413static int uda1380_set_dai_fmt_both(struct snd_soc_dai *codec_dai,
425 unsigned int fmt) 414 unsigned int fmt)
426{ 415{
@@ -643,21 +632,21 @@ static int uda1380_set_bias_level(struct snd_soc_codec *codec,
643 SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_22050 |\ 632 SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_22050 |\
644 SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000) 633 SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000)
645 634
646static struct snd_soc_dai_ops uda1380_dai_ops = { 635static const struct snd_soc_dai_ops uda1380_dai_ops = {
647 .hw_params = uda1380_pcm_hw_params, 636 .hw_params = uda1380_pcm_hw_params,
648 .shutdown = uda1380_pcm_shutdown, 637 .shutdown = uda1380_pcm_shutdown,
649 .trigger = uda1380_trigger, 638 .trigger = uda1380_trigger,
650 .set_fmt = uda1380_set_dai_fmt_both, 639 .set_fmt = uda1380_set_dai_fmt_both,
651}; 640};
652 641
653static struct snd_soc_dai_ops uda1380_dai_ops_playback = { 642static const struct snd_soc_dai_ops uda1380_dai_ops_playback = {
654 .hw_params = uda1380_pcm_hw_params, 643 .hw_params = uda1380_pcm_hw_params,
655 .shutdown = uda1380_pcm_shutdown, 644 .shutdown = uda1380_pcm_shutdown,
656 .trigger = uda1380_trigger, 645 .trigger = uda1380_trigger,
657 .set_fmt = uda1380_set_dai_fmt_playback, 646 .set_fmt = uda1380_set_dai_fmt_playback,
658}; 647};
659 648
660static struct snd_soc_dai_ops uda1380_dai_ops_capture = { 649static const struct snd_soc_dai_ops uda1380_dai_ops_capture = {
661 .hw_params = uda1380_pcm_hw_params, 650 .hw_params = uda1380_pcm_hw_params,
662 .shutdown = uda1380_pcm_shutdown, 651 .shutdown = uda1380_pcm_shutdown,
663 .trigger = uda1380_trigger, 652 .trigger = uda1380_trigger,
@@ -705,7 +694,7 @@ static struct snd_soc_dai_driver uda1380_dai[] = {
705}, 694},
706}; 695};
707 696
708static int uda1380_suspend(struct snd_soc_codec *codec, pm_message_t state) 697static int uda1380_suspend(struct snd_soc_codec *codec)
709{ 698{
710 uda1380_set_bias_level(codec, SND_SOC_BIAS_OFF); 699 uda1380_set_bias_level(codec, SND_SOC_BIAS_OFF);
711 return 0; 700 return 0;
@@ -732,27 +721,21 @@ static int uda1380_probe(struct snd_soc_codec *codec)
732 return -EINVAL; 721 return -EINVAL;
733 722
734 if (gpio_is_valid(pdata->gpio_reset)) { 723 if (gpio_is_valid(pdata->gpio_reset)) {
735 ret = gpio_request(pdata->gpio_reset, "uda1380 reset"); 724 ret = gpio_request_one(pdata->gpio_reset, GPIOF_OUT_INIT_LOW,
725 "uda1380 reset");
736 if (ret) 726 if (ret)
737 goto err_out; 727 goto err_out;
738 ret = gpio_direction_output(pdata->gpio_reset, 0);
739 if (ret)
740 goto err_gpio_reset_conf;
741 } 728 }
742 729
743 if (gpio_is_valid(pdata->gpio_power)) { 730 if (gpio_is_valid(pdata->gpio_power)) {
744 ret = gpio_request(pdata->gpio_power, "uda1380 power"); 731 ret = gpio_request_one(pdata->gpio_power, GPIOF_OUT_INIT_LOW,
745 if (ret) 732 "uda1380 power");
746 goto err_gpio;
747 ret = gpio_direction_output(pdata->gpio_power, 0);
748 if (ret) 733 if (ret)
749 goto err_gpio_power_conf; 734 goto err_free_gpio;
750 } else { 735 } else {
751 ret = uda1380_reset(codec); 736 ret = uda1380_reset(codec);
752 if (ret) { 737 if (ret)
753 dev_err(codec->dev, "Failed to issue reset\n"); 738 goto err_free_gpio;
754 goto err_reset;
755 }
756 } 739 }
757 740
758 INIT_WORK(&uda1380->work, uda1380_flush_work); 741 INIT_WORK(&uda1380->work, uda1380_flush_work);
@@ -770,19 +753,9 @@ static int uda1380_probe(struct snd_soc_codec *codec)
770 break; 753 break;
771 } 754 }
772 755
773 snd_soc_add_controls(codec, uda1380_snd_controls,
774 ARRAY_SIZE(uda1380_snd_controls));
775 uda1380_add_widgets(codec);
776
777 return 0; 756 return 0;
778 757
779err_reset: 758err_free_gpio:
780err_gpio_power_conf:
781 if (gpio_is_valid(pdata->gpio_power))
782 gpio_free(pdata->gpio_power);
783
784err_gpio_reset_conf:
785err_gpio:
786 if (gpio_is_valid(pdata->gpio_reset)) 759 if (gpio_is_valid(pdata->gpio_reset))
787 gpio_free(pdata->gpio_reset); 760 gpio_free(pdata->gpio_reset);
788err_out: 761err_out:
@@ -814,6 +787,13 @@ static struct snd_soc_codec_driver soc_codec_dev_uda1380 = {
814 .reg_word_size = sizeof(u16), 787 .reg_word_size = sizeof(u16),
815 .reg_cache_default = uda1380_reg, 788 .reg_cache_default = uda1380_reg,
816 .reg_cache_step = 1, 789 .reg_cache_step = 1,
790
791 .controls = uda1380_snd_controls,
792 .num_controls = ARRAY_SIZE(uda1380_snd_controls),
793 .dapm_widgets = uda1380_dapm_widgets,
794 .num_dapm_widgets = ARRAY_SIZE(uda1380_dapm_widgets),
795 .dapm_routes = uda1380_dapm_routes,
796 .num_dapm_routes = ARRAY_SIZE(uda1380_dapm_routes),
817}; 797};
818 798
819#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) 799#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
@@ -823,7 +803,8 @@ static __devinit int uda1380_i2c_probe(struct i2c_client *i2c,
823 struct uda1380_priv *uda1380; 803 struct uda1380_priv *uda1380;
824 int ret; 804 int ret;
825 805
826 uda1380 = kzalloc(sizeof(struct uda1380_priv), GFP_KERNEL); 806 uda1380 = devm_kzalloc(&i2c->dev, sizeof(struct uda1380_priv),
807 GFP_KERNEL);
827 if (uda1380 == NULL) 808 if (uda1380 == NULL)
828 return -ENOMEM; 809 return -ENOMEM;
829 810
@@ -832,15 +813,12 @@ static __devinit int uda1380_i2c_probe(struct i2c_client *i2c,
832 813
833 ret = snd_soc_register_codec(&i2c->dev, 814 ret = snd_soc_register_codec(&i2c->dev,
834 &soc_codec_dev_uda1380, uda1380_dai, ARRAY_SIZE(uda1380_dai)); 815 &soc_codec_dev_uda1380, uda1380_dai, ARRAY_SIZE(uda1380_dai));
835 if (ret < 0)
836 kfree(uda1380);
837 return ret; 816 return ret;
838} 817}
839 818
840static int __devexit uda1380_i2c_remove(struct i2c_client *i2c) 819static int __devexit uda1380_i2c_remove(struct i2c_client *i2c)
841{ 820{
842 snd_soc_unregister_codec(&i2c->dev); 821 snd_soc_unregister_codec(&i2c->dev);
843 kfree(i2c_get_clientdata(i2c));
844 return 0; 822 return 0;
845} 823}
846 824
@@ -863,13 +841,13 @@ static struct i2c_driver uda1380_i2c_driver = {
863 841
864static int __init uda1380_modinit(void) 842static int __init uda1380_modinit(void)
865{ 843{
866 int ret; 844 int ret = 0;
867#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) 845#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
868 ret = i2c_add_driver(&uda1380_i2c_driver); 846 ret = i2c_add_driver(&uda1380_i2c_driver);
869 if (ret != 0) 847 if (ret != 0)
870 pr_err("Failed to register UDA1380 I2C driver: %d\n", ret); 848 pr_err("Failed to register UDA1380 I2C driver: %d\n", ret);
871#endif 849#endif
872 return 0; 850 return ret;
873} 851}
874module_init(uda1380_modinit); 852module_init(uda1380_modinit);
875 853
diff --git a/sound/soc/codecs/wl1273.c b/sound/soc/codecs/wl1273.c
index a8549898299..44aacf927ba 100644
--- a/sound/soc/codecs/wl1273.c
+++ b/sound/soc/codecs/wl1273.c
@@ -386,7 +386,7 @@ static int wl1273_hw_params(struct snd_pcm_substream *substream,
386 return 0; 386 return 0;
387} 387}
388 388
389static struct snd_soc_dai_ops wl1273_dai_ops = { 389static const struct snd_soc_dai_ops wl1273_dai_ops = {
390 .startup = wl1273_startup, 390 .startup = wl1273_startup,
391 .hw_params = wl1273_hw_params, 391 .hw_params = wl1273_hw_params,
392}; 392};
@@ -510,17 +510,7 @@ static struct platform_driver wl1273_platform_driver = {
510 .remove = __devexit_p(wl1273_platform_remove), 510 .remove = __devexit_p(wl1273_platform_remove),
511}; 511};
512 512
513static int __init wl1273_init(void) 513module_platform_driver(wl1273_platform_driver);
514{
515 return platform_driver_register(&wl1273_platform_driver);
516}
517module_init(wl1273_init);
518
519static void __exit wl1273_exit(void)
520{
521 platform_driver_unregister(&wl1273_platform_driver);
522}
523module_exit(wl1273_exit);
524 514
525MODULE_AUTHOR("Matti Aaltonen <matti.j.aaltonen@nokia.com>"); 515MODULE_AUTHOR("Matti Aaltonen <matti.j.aaltonen@nokia.com>");
526MODULE_DESCRIPTION("ASoC WL1273 codec driver"); 516MODULE_DESCRIPTION("ASoC WL1273 codec driver");
diff --git a/sound/soc/codecs/wm1250-ev1.c b/sound/soc/codecs/wm1250-ev1.c
index cd0ec0fd1db..aefb4f89be0 100644
--- a/sound/soc/codecs/wm1250-ev1.c
+++ b/sound/soc/codecs/wm1250-ev1.c
@@ -116,7 +116,7 @@ static int __devinit wm1250_ev1_pdata(struct i2c_client *i2c)
116 if (!pdata) 116 if (!pdata)
117 return 0; 117 return 0;
118 118
119 wm1250 = kzalloc(sizeof(*wm1250), GFP_KERNEL); 119 wm1250 = devm_kzalloc(&i2c->dev, sizeof(*wm1250), GFP_KERNEL);
120 if (!wm1250) { 120 if (!wm1250) {
121 dev_err(&i2c->dev, "Unable to allocate private data\n"); 121 dev_err(&i2c->dev, "Unable to allocate private data\n");
122 ret = -ENOMEM; 122 ret = -ENOMEM;
@@ -134,15 +134,13 @@ static int __devinit wm1250_ev1_pdata(struct i2c_client *i2c)
134 ret = gpio_request_array(wm1250->gpios, ARRAY_SIZE(wm1250->gpios)); 134 ret = gpio_request_array(wm1250->gpios, ARRAY_SIZE(wm1250->gpios));
135 if (ret != 0) { 135 if (ret != 0) {
136 dev_err(&i2c->dev, "Failed to get GPIOs: %d\n", ret); 136 dev_err(&i2c->dev, "Failed to get GPIOs: %d\n", ret);
137 goto err_alloc; 137 goto err;
138 } 138 }
139 139
140 dev_set_drvdata(&i2c->dev, wm1250); 140 dev_set_drvdata(&i2c->dev, wm1250);
141 141
142 return ret; 142 return ret;
143 143
144err_alloc:
145 kfree(wm1250);
146err: 144err:
147 return ret; 145 return ret;
148} 146}
@@ -151,10 +149,8 @@ static void wm1250_ev1_free(struct i2c_client *i2c)
151{ 149{
152 struct wm1250_priv *wm1250 = dev_get_drvdata(&i2c->dev); 150 struct wm1250_priv *wm1250 = dev_get_drvdata(&i2c->dev);
153 151
154 if (wm1250) { 152 if (wm1250)
155 gpio_free_array(wm1250->gpios, ARRAY_SIZE(wm1250->gpios)); 153 gpio_free_array(wm1250->gpios, ARRAY_SIZE(wm1250->gpios));
156 kfree(wm1250);
157 }
158} 154}
159 155
160static int __devinit wm1250_ev1_probe(struct i2c_client *i2c, 156static int __devinit wm1250_ev1_probe(struct i2c_client *i2c,
diff --git a/sound/soc/codecs/wm2000.c b/sound/soc/codecs/wm2000.c
index a3b9cbb20ee..c2880907fce 100644
--- a/sound/soc/codecs/wm2000.c
+++ b/sound/soc/codecs/wm2000.c
@@ -29,7 +29,7 @@
29#include <linux/delay.h> 29#include <linux/delay.h>
30#include <linux/pm.h> 30#include <linux/pm.h>
31#include <linux/i2c.h> 31#include <linux/i2c.h>
32#include <linux/platform_device.h> 32#include <linux/regmap.h>
33#include <linux/debugfs.h> 33#include <linux/debugfs.h>
34#include <linux/slab.h> 34#include <linux/slab.h>
35#include <sound/core.h> 35#include <sound/core.h>
@@ -52,6 +52,7 @@ enum wm2000_anc_mode {
52 52
53struct wm2000_priv { 53struct wm2000_priv {
54 struct i2c_client *i2c; 54 struct i2c_client *i2c;
55 struct regmap *regmap;
55 56
56 enum wm2000_anc_mode anc_mode; 57 enum wm2000_anc_mode anc_mode;
57 58
@@ -66,59 +67,24 @@ struct wm2000_priv {
66 char *anc_download; 67 char *anc_download;
67}; 68};
68 69
69static struct i2c_client *wm2000_i2c;
70
71static int wm2000_write(struct i2c_client *i2c, unsigned int reg, 70static int wm2000_write(struct i2c_client *i2c, unsigned int reg,
72 unsigned int value) 71 unsigned int value)
73{ 72{
74 u8 data[3]; 73 struct wm2000_priv *wm2000 = i2c_get_clientdata(i2c);
75 int ret; 74 return regmap_write(wm2000->regmap, reg, value);
76
77 data[0] = (reg >> 8) & 0xff;
78 data[1] = reg & 0xff;
79 data[2] = value & 0xff;
80
81 dev_vdbg(&i2c->dev, "write %x = %x\n", reg, value);
82
83 ret = i2c_master_send(i2c, data, 3);
84 if (ret == 3)
85 return 0;
86 if (ret < 0)
87 return ret;
88 else
89 return -EIO;
90} 75}
91 76
92static unsigned int wm2000_read(struct i2c_client *i2c, unsigned int r) 77static unsigned int wm2000_read(struct i2c_client *i2c, unsigned int r)
93{ 78{
94 struct i2c_msg xfer[2]; 79 struct wm2000_priv *wm2000 = i2c_get_clientdata(i2c);
95 u8 reg[2]; 80 unsigned int val;
96 u8 data;
97 int ret; 81 int ret;
98 82
99 /* Write register */ 83 ret = regmap_read(wm2000->regmap, r, &val);
100 reg[0] = (r >> 8) & 0xff; 84 if (ret < 0)
101 reg[1] = r & 0xff; 85 return -1;
102 xfer[0].addr = i2c->addr;
103 xfer[0].flags = 0;
104 xfer[0].len = sizeof(reg);
105 xfer[0].buf = &reg[0];
106
107 /* Read data */
108 xfer[1].addr = i2c->addr;
109 xfer[1].flags = I2C_M_RD;
110 xfer[1].len = 1;
111 xfer[1].buf = &data;
112
113 ret = i2c_transfer(i2c->adapter, xfer, 2);
114 if (ret != 2) {
115 dev_err(&i2c->dev, "i2c_transfer() returned %d\n", ret);
116 return 0;
117 }
118
119 dev_vdbg(&i2c->dev, "read %x from %x\n", data, r);
120 86
121 return data; 87 return val;
122} 88}
123 89
124static void wm2000_reset(struct wm2000_priv *wm2000) 90static void wm2000_reset(struct wm2000_priv *wm2000)
@@ -612,7 +578,8 @@ static int wm2000_anc_set_mode(struct wm2000_priv *wm2000)
612static int wm2000_anc_mode_get(struct snd_kcontrol *kcontrol, 578static int wm2000_anc_mode_get(struct snd_kcontrol *kcontrol,
613 struct snd_ctl_elem_value *ucontrol) 579 struct snd_ctl_elem_value *ucontrol)
614{ 580{
615 struct wm2000_priv *wm2000 = dev_get_drvdata(&wm2000_i2c->dev); 581 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
582 struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev);
616 583
617 ucontrol->value.enumerated.item[0] = wm2000->anc_active; 584 ucontrol->value.enumerated.item[0] = wm2000->anc_active;
618 585
@@ -622,7 +589,8 @@ static int wm2000_anc_mode_get(struct snd_kcontrol *kcontrol,
622static int wm2000_anc_mode_put(struct snd_kcontrol *kcontrol, 589static int wm2000_anc_mode_put(struct snd_kcontrol *kcontrol,
623 struct snd_ctl_elem_value *ucontrol) 590 struct snd_ctl_elem_value *ucontrol)
624{ 591{
625 struct wm2000_priv *wm2000 = dev_get_drvdata(&wm2000_i2c->dev); 592 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
593 struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev);
626 int anc_active = ucontrol->value.enumerated.item[0]; 594 int anc_active = ucontrol->value.enumerated.item[0];
627 595
628 if (anc_active > 1) 596 if (anc_active > 1)
@@ -636,7 +604,8 @@ static int wm2000_anc_mode_put(struct snd_kcontrol *kcontrol,
636static int wm2000_speaker_get(struct snd_kcontrol *kcontrol, 604static int wm2000_speaker_get(struct snd_kcontrol *kcontrol,
637 struct snd_ctl_elem_value *ucontrol) 605 struct snd_ctl_elem_value *ucontrol)
638{ 606{
639 struct wm2000_priv *wm2000 = dev_get_drvdata(&wm2000_i2c->dev); 607 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
608 struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev);
640 609
641 ucontrol->value.enumerated.item[0] = wm2000->spk_ena; 610 ucontrol->value.enumerated.item[0] = wm2000->spk_ena;
642 611
@@ -646,7 +615,8 @@ static int wm2000_speaker_get(struct snd_kcontrol *kcontrol,
646static int wm2000_speaker_put(struct snd_kcontrol *kcontrol, 615static int wm2000_speaker_put(struct snd_kcontrol *kcontrol,
647 struct snd_ctl_elem_value *ucontrol) 616 struct snd_ctl_elem_value *ucontrol)
648{ 617{
649 struct wm2000_priv *wm2000 = dev_get_drvdata(&wm2000_i2c->dev); 618 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
619 struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev);
650 int val = ucontrol->value.enumerated.item[0]; 620 int val = ucontrol->value.enumerated.item[0];
651 621
652 if (val > 1) 622 if (val > 1)
@@ -669,7 +639,8 @@ static const struct snd_kcontrol_new wm2000_controls[] = {
669static int wm2000_anc_power_event(struct snd_soc_dapm_widget *w, 639static int wm2000_anc_power_event(struct snd_soc_dapm_widget *w,
670 struct snd_kcontrol *kcontrol, int event) 640 struct snd_kcontrol *kcontrol, int event)
671{ 641{
672 struct wm2000_priv *wm2000 = dev_get_drvdata(&wm2000_i2c->dev); 642 struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
643 struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev);
673 644
674 if (SND_SOC_DAPM_EVENT_ON(event)) 645 if (SND_SOC_DAPM_EVENT_ON(event))
675 wm2000->anc_eng_ena = 1; 646 wm2000->anc_eng_ena = 1;
@@ -682,11 +653,11 @@ static int wm2000_anc_power_event(struct snd_soc_dapm_widget *w,
682 653
683static const struct snd_soc_dapm_widget wm2000_dapm_widgets[] = { 654static const struct snd_soc_dapm_widget wm2000_dapm_widgets[] = {
684/* Externally visible pins */ 655/* Externally visible pins */
685SND_SOC_DAPM_OUTPUT("WM2000 SPKN"), 656SND_SOC_DAPM_OUTPUT("SPKN"),
686SND_SOC_DAPM_OUTPUT("WM2000 SPKP"), 657SND_SOC_DAPM_OUTPUT("SPKP"),
687 658
688SND_SOC_DAPM_INPUT("WM2000 LINN"), 659SND_SOC_DAPM_INPUT("LINN"),
689SND_SOC_DAPM_INPUT("WM2000 LINP"), 660SND_SOC_DAPM_INPUT("LINP"),
690 661
691SND_SOC_DAPM_PGA_E("ANC Engine", SND_SOC_NOPM, 0, 0, NULL, 0, 662SND_SOC_DAPM_PGA_E("ANC Engine", SND_SOC_NOPM, 0, 0, NULL, 0,
692 wm2000_anc_power_event, 663 wm2000_anc_power_event,
@@ -694,37 +665,67 @@ SND_SOC_DAPM_PGA_E("ANC Engine", SND_SOC_NOPM, 0, 0, NULL, 0,
694}; 665};
695 666
696/* Target, Path, Source */ 667/* Target, Path, Source */
697static const struct snd_soc_dapm_route audio_map[] = { 668static const struct snd_soc_dapm_route wm2000_audio_map[] = {
698 { "WM2000 SPKN", NULL, "ANC Engine" }, 669 { "SPKN", NULL, "ANC Engine" },
699 { "WM2000 SPKP", NULL, "ANC Engine" }, 670 { "SPKP", NULL, "ANC Engine" },
700 { "ANC Engine", NULL, "WM2000 LINN" }, 671 { "ANC Engine", NULL, "LINN" },
701 { "ANC Engine", NULL, "WM2000 LINP" }, 672 { "ANC Engine", NULL, "LINP" },
702}; 673};
703 674
704/* Called from the machine driver */ 675#ifdef CONFIG_PM
705int wm2000_add_controls(struct snd_soc_codec *codec) 676static int wm2000_suspend(struct snd_soc_codec *codec)
706{ 677{
707 struct snd_soc_dapm_context *dapm = &codec->dapm; 678 struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev);
708 int ret;
709 679
710 if (!wm2000_i2c) { 680 return wm2000_anc_transition(wm2000, ANC_OFF);
711 pr_err("WM2000 not yet probed\n"); 681}
712 return -ENODEV;
713 }
714 682
715 ret = snd_soc_dapm_new_controls(dapm, wm2000_dapm_widgets, 683static int wm2000_resume(struct snd_soc_codec *codec)
716 ARRAY_SIZE(wm2000_dapm_widgets)); 684{
717 if (ret < 0) 685 struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev);
718 return ret;
719 686
720 ret = snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map)); 687 return wm2000_anc_set_mode(wm2000);
721 if (ret < 0) 688}
722 return ret; 689#else
690#define wm2000_suspend NULL
691#define wm2000_resume NULL
692#endif
693
694static const struct regmap_config wm2000_regmap = {
695 .reg_bits = 8,
696 .val_bits = 8,
697};
698
699static int wm2000_probe(struct snd_soc_codec *codec)
700{
701 struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev);
702
703 /* This will trigger a transition to standby mode by default */
704 wm2000_anc_set_mode(wm2000);
705
706 return 0;
707}
708
709static int wm2000_remove(struct snd_soc_codec *codec)
710{
711 struct wm2000_priv *wm2000 = dev_get_drvdata(codec->dev);
723 712
724 return snd_soc_add_controls(codec, wm2000_controls, 713 return wm2000_anc_transition(wm2000, ANC_OFF);
725 ARRAY_SIZE(wm2000_controls));
726} 714}
727EXPORT_SYMBOL_GPL(wm2000_add_controls); 715
716static struct snd_soc_codec_driver soc_codec_dev_wm2000 = {
717 .probe = wm2000_probe,
718 .remove = wm2000_remove,
719 .suspend = wm2000_suspend,
720 .resume = wm2000_resume,
721
722 .dapm_widgets = wm2000_dapm_widgets,
723 .num_dapm_widgets = ARRAY_SIZE(wm2000_dapm_widgets),
724 .dapm_routes = wm2000_audio_map,
725 .num_dapm_routes = ARRAY_SIZE(wm2000_audio_map),
726 .controls = wm2000_controls,
727 .num_controls = ARRAY_SIZE(wm2000_controls),
728};
728 729
729static int __devinit wm2000_i2c_probe(struct i2c_client *i2c, 730static int __devinit wm2000_i2c_probe(struct i2c_client *i2c,
730 const struct i2c_device_id *i2c_id) 731 const struct i2c_device_id *i2c_id)
@@ -736,17 +737,23 @@ static int __devinit wm2000_i2c_probe(struct i2c_client *i2c,
736 int reg, ret; 737 int reg, ret;
737 u16 id; 738 u16 id;
738 739
739 if (wm2000_i2c) { 740 wm2000 = devm_kzalloc(&i2c->dev, sizeof(struct wm2000_priv),
740 dev_err(&i2c->dev, "Another WM2000 is already registered\n"); 741 GFP_KERNEL);
741 return -EINVAL;
742 }
743
744 wm2000 = kzalloc(sizeof(struct wm2000_priv), GFP_KERNEL);
745 if (wm2000 == NULL) { 742 if (wm2000 == NULL) {
746 dev_err(&i2c->dev, "Unable to allocate private data\n"); 743 dev_err(&i2c->dev, "Unable to allocate private data\n");
747 return -ENOMEM; 744 return -ENOMEM;
748 } 745 }
749 746
747 dev_set_drvdata(&i2c->dev, wm2000);
748
749 wm2000->regmap = regmap_init_i2c(i2c, &wm2000_regmap);
750 if (IS_ERR(wm2000->regmap)) {
751 ret = PTR_ERR(wm2000->regmap);
752 dev_err(&i2c->dev, "Failed to allocate register map: %d\n",
753 ret);
754 goto err;
755 }
756
750 /* Verify that this is a WM2000 */ 757 /* Verify that this is a WM2000 */
751 reg = wm2000_read(i2c, WM2000_REG_ID1); 758 reg = wm2000_read(i2c, WM2000_REG_ID1);
752 id = reg << 8; 759 id = reg << 8;
@@ -756,7 +763,7 @@ static int __devinit wm2000_i2c_probe(struct i2c_client *i2c,
756 if (id != 0x2000) { 763 if (id != 0x2000) {
757 dev_err(&i2c->dev, "Device is not a WM2000 - ID %x\n", id); 764 dev_err(&i2c->dev, "Device is not a WM2000 - ID %x\n", id);
758 ret = -ENODEV; 765 ret = -ENODEV;
759 goto err; 766 goto err_regmap;
760 } 767 }
761 768
762 reg = wm2000_read(i2c, WM2000_REG_REVISON); 769 reg = wm2000_read(i2c, WM2000_REG_REVISON);
@@ -775,12 +782,14 @@ static int __devinit wm2000_i2c_probe(struct i2c_client *i2c,
775 ret = request_firmware(&fw, filename, &i2c->dev); 782 ret = request_firmware(&fw, filename, &i2c->dev);
776 if (ret != 0) { 783 if (ret != 0) {
777 dev_err(&i2c->dev, "Failed to acquire ANC data: %d\n", ret); 784 dev_err(&i2c->dev, "Failed to acquire ANC data: %d\n", ret);
778 goto err; 785 goto err_regmap;
779 } 786 }
780 787
781 /* Pre-cook the concatenation of the register address onto the image */ 788 /* Pre-cook the concatenation of the register address onto the image */
782 wm2000->anc_download_size = fw->size + 2; 789 wm2000->anc_download_size = fw->size + 2;
783 wm2000->anc_download = kmalloc(wm2000->anc_download_size, GFP_KERNEL); 790 wm2000->anc_download = devm_kzalloc(&i2c->dev,
791 wm2000->anc_download_size,
792 GFP_KERNEL);
784 if (wm2000->anc_download == NULL) { 793 if (wm2000->anc_download == NULL) {
785 dev_err(&i2c->dev, "Out of memory\n"); 794 dev_err(&i2c->dev, "Out of memory\n");
786 ret = -ENOMEM; 795 ret = -ENOMEM;
@@ -793,7 +802,6 @@ static int __devinit wm2000_i2c_probe(struct i2c_client *i2c,
793 802
794 release_firmware(fw); 803 release_firmware(fw);
795 804
796 dev_set_drvdata(&i2c->dev, wm2000);
797 wm2000->anc_eng_ena = 1; 805 wm2000->anc_eng_ena = 1;
798 wm2000->anc_active = 1; 806 wm2000->anc_active = 1;
799 wm2000->spk_ena = 1; 807 wm2000->spk_ena = 1;
@@ -801,17 +809,18 @@ static int __devinit wm2000_i2c_probe(struct i2c_client *i2c,
801 809
802 wm2000_reset(wm2000); 810 wm2000_reset(wm2000);
803 811
804 /* This will trigger a transition to standby mode by default */ 812 ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_wm2000,
805 wm2000_anc_set_mode(wm2000); 813 NULL, 0);
806 814 if (ret != 0)
807 wm2000_i2c = i2c; 815 goto err_fw;
808 816
809 return 0; 817 return 0;
810 818
811err_fw: 819err_fw:
812 release_firmware(fw); 820 release_firmware(fw);
821err_regmap:
822 regmap_exit(wm2000->regmap);
813err: 823err:
814 kfree(wm2000);
815 return ret; 824 return ret;
816} 825}
817 826
@@ -819,42 +828,12 @@ static __devexit int wm2000_i2c_remove(struct i2c_client *i2c)
819{ 828{
820 struct wm2000_priv *wm2000 = dev_get_drvdata(&i2c->dev); 829 struct wm2000_priv *wm2000 = dev_get_drvdata(&i2c->dev);
821 830
822 wm2000_anc_transition(wm2000, ANC_OFF); 831 snd_soc_unregister_codec(&i2c->dev);
823 832 regmap_exit(wm2000->regmap);
824 wm2000_i2c = NULL;
825 kfree(wm2000->anc_download);
826 kfree(wm2000);
827 833
828 return 0; 834 return 0;
829} 835}
830 836
831static void wm2000_i2c_shutdown(struct i2c_client *i2c)
832{
833 struct wm2000_priv *wm2000 = dev_get_drvdata(&i2c->dev);
834
835 wm2000_anc_transition(wm2000, ANC_OFF);
836}
837
838#ifdef CONFIG_PM
839static int wm2000_i2c_suspend(struct device *dev)
840{
841 struct i2c_client *i2c = to_i2c_client(dev);
842 struct wm2000_priv *wm2000 = dev_get_drvdata(&i2c->dev);
843
844 return wm2000_anc_transition(wm2000, ANC_OFF);
845}
846
847static int wm2000_i2c_resume(struct device *dev)
848{
849 struct i2c_client *i2c = to_i2c_client(dev);
850 struct wm2000_priv *wm2000 = dev_get_drvdata(&i2c->dev);
851
852 return wm2000_anc_set_mode(wm2000);
853}
854#endif
855
856static SIMPLE_DEV_PM_OPS(wm2000_pm, wm2000_i2c_suspend, wm2000_i2c_resume);
857
858static const struct i2c_device_id wm2000_i2c_id[] = { 837static const struct i2c_device_id wm2000_i2c_id[] = {
859 { "wm2000", 0 }, 838 { "wm2000", 0 },
860 { } 839 { }
@@ -865,11 +844,9 @@ static struct i2c_driver wm2000_i2c_driver = {
865 .driver = { 844 .driver = {
866 .name = "wm2000", 845 .name = "wm2000",
867 .owner = THIS_MODULE, 846 .owner = THIS_MODULE,
868 .pm = &wm2000_pm,
869 }, 847 },
870 .probe = wm2000_i2c_probe, 848 .probe = wm2000_i2c_probe,
871 .remove = __devexit_p(wm2000_i2c_remove), 849 .remove = __devexit_p(wm2000_i2c_remove),
872 .shutdown = wm2000_i2c_shutdown,
873 .id_table = wm2000_i2c_id, 850 .id_table = wm2000_i2c_id,
874}; 851};
875 852
diff --git a/sound/soc/codecs/wm2000.h b/sound/soc/codecs/wm2000.h
index 0b6f056f73c..abcd82a9399 100644
--- a/sound/soc/codecs/wm2000.h
+++ b/sound/soc/codecs/wm2000.h
@@ -9,13 +9,6 @@
9#ifndef _WM2000_H 9#ifndef _WM2000_H
10#define _WM2000_H 10#define _WM2000_H
11 11
12struct wm2000_setup_data {
13 unsigned short i2c_address;
14 int mclk_div; /* Set to a non-zero value if MCLK_DIV_2 required */
15};
16
17extern int wm2000_add_controls(struct snd_soc_codec *codec);
18
19#define WM2000_REG_SYS_START 0x8000 12#define WM2000_REG_SYS_START 0x8000
20#define WM2000_REG_SPEECH_CLARITY 0x8fef 13#define WM2000_REG_SPEECH_CLARITY 0x8fef
21#define WM2000_REG_SYS_WATCHDOG 0x8ff6 14#define WM2000_REG_SYS_WATCHDOG 0x8ff6
diff --git a/sound/soc/codecs/wm5100-tables.c b/sound/soc/codecs/wm5100-tables.c
index e9ce81a57b8..9a18fae6820 100644
--- a/sound/soc/codecs/wm5100-tables.c
+++ b/sound/soc/codecs/wm5100-tables.c
@@ -13,7 +13,7 @@
13 13
14#include "wm5100.h" 14#include "wm5100.h"
15 15
16int wm5100_volatile_register(struct snd_soc_codec *codec, unsigned int reg) 16bool wm5100_volatile_register(struct device *dev, unsigned int reg)
17{ 17{
18 switch (reg) { 18 switch (reg) {
19 case WM5100_SOFTWARE_RESET: 19 case WM5100_SOFTWARE_RESET:
@@ -36,7 +36,7 @@ int wm5100_volatile_register(struct snd_soc_codec *codec, unsigned int reg)
36 } 36 }
37} 37}
38 38
39int wm5100_readable_register(struct snd_soc_codec *codec, unsigned int reg) 39bool wm5100_readable_register(struct device *dev, unsigned int reg)
40{ 40{
41 switch (reg) { 41 switch (reg) {
42 case WM5100_SOFTWARE_RESET: 42 case WM5100_SOFTWARE_RESET:
@@ -85,6 +85,7 @@ int wm5100_readable_register(struct snd_soc_codec *codec, unsigned int reg)
85 case WM5100_MIC_DETECT_1: 85 case WM5100_MIC_DETECT_1:
86 case WM5100_MIC_DETECT_2: 86 case WM5100_MIC_DETECT_2:
87 case WM5100_MIC_DETECT_3: 87 case WM5100_MIC_DETECT_3:
88 case WM5100_MISC_CONTROL:
88 case WM5100_INPUT_ENABLES: 89 case WM5100_INPUT_ENABLES:
89 case WM5100_INPUT_ENABLES_STATUS: 90 case WM5100_INPUT_ENABLES_STATUS:
90 case WM5100_IN1L_CONTROL: 91 case WM5100_IN1L_CONTROL:
@@ -696,836 +697,668 @@ int wm5100_readable_register(struct snd_soc_codec *codec, unsigned int reg)
696 case WM5100_HPLPF3_2: 697 case WM5100_HPLPF3_2:
697 case WM5100_HPLPF4_1: 698 case WM5100_HPLPF4_1:
698 case WM5100_HPLPF4_2: 699 case WM5100_HPLPF4_2:
699 case WM5100_DSP1_DM_0:
700 case WM5100_DSP1_DM_1:
701 case WM5100_DSP1_DM_2:
702 case WM5100_DSP1_DM_3:
703 case WM5100_DSP1_DM_508:
704 case WM5100_DSP1_DM_509:
705 case WM5100_DSP1_DM_510:
706 case WM5100_DSP1_DM_511:
707 case WM5100_DSP1_PM_0:
708 case WM5100_DSP1_PM_1:
709 case WM5100_DSP1_PM_2:
710 case WM5100_DSP1_PM_3:
711 case WM5100_DSP1_PM_4:
712 case WM5100_DSP1_PM_5:
713 case WM5100_DSP1_PM_1530:
714 case WM5100_DSP1_PM_1531:
715 case WM5100_DSP1_PM_1532:
716 case WM5100_DSP1_PM_1533:
717 case WM5100_DSP1_PM_1534:
718 case WM5100_DSP1_PM_1535:
719 case WM5100_DSP1_ZM_0:
720 case WM5100_DSP1_ZM_1:
721 case WM5100_DSP1_ZM_2:
722 case WM5100_DSP1_ZM_3:
723 case WM5100_DSP1_ZM_2044:
724 case WM5100_DSP1_ZM_2045:
725 case WM5100_DSP1_ZM_2046:
726 case WM5100_DSP1_ZM_2047:
727 case WM5100_DSP2_DM_0:
728 case WM5100_DSP2_DM_1:
729 case WM5100_DSP2_DM_2:
730 case WM5100_DSP2_DM_3:
731 case WM5100_DSP2_DM_508:
732 case WM5100_DSP2_DM_509:
733 case WM5100_DSP2_DM_510:
734 case WM5100_DSP2_DM_511:
735 case WM5100_DSP2_PM_0:
736 case WM5100_DSP2_PM_1:
737 case WM5100_DSP2_PM_2:
738 case WM5100_DSP2_PM_3:
739 case WM5100_DSP2_PM_4:
740 case WM5100_DSP2_PM_5:
741 case WM5100_DSP2_PM_1530:
742 case WM5100_DSP2_PM_1531:
743 case WM5100_DSP2_PM_1532:
744 case WM5100_DSP2_PM_1533:
745 case WM5100_DSP2_PM_1534:
746 case WM5100_DSP2_PM_1535:
747 case WM5100_DSP2_ZM_0:
748 case WM5100_DSP2_ZM_1:
749 case WM5100_DSP2_ZM_2:
750 case WM5100_DSP2_ZM_3:
751 case WM5100_DSP2_ZM_2044:
752 case WM5100_DSP2_ZM_2045:
753 case WM5100_DSP2_ZM_2046:
754 case WM5100_DSP2_ZM_2047:
755 case WM5100_DSP3_DM_0:
756 case WM5100_DSP3_DM_1:
757 case WM5100_DSP3_DM_2:
758 case WM5100_DSP3_DM_3:
759 case WM5100_DSP3_DM_508:
760 case WM5100_DSP3_DM_509:
761 case WM5100_DSP3_DM_510:
762 case WM5100_DSP3_DM_511:
763 case WM5100_DSP3_PM_0:
764 case WM5100_DSP3_PM_1:
765 case WM5100_DSP3_PM_2:
766 case WM5100_DSP3_PM_3:
767 case WM5100_DSP3_PM_4:
768 case WM5100_DSP3_PM_5:
769 case WM5100_DSP3_PM_1530:
770 case WM5100_DSP3_PM_1531:
771 case WM5100_DSP3_PM_1532:
772 case WM5100_DSP3_PM_1533:
773 case WM5100_DSP3_PM_1534:
774 case WM5100_DSP3_PM_1535:
775 case WM5100_DSP3_ZM_0:
776 case WM5100_DSP3_ZM_1:
777 case WM5100_DSP3_ZM_2:
778 case WM5100_DSP3_ZM_3:
779 case WM5100_DSP3_ZM_2044:
780 case WM5100_DSP3_ZM_2045:
781 case WM5100_DSP3_ZM_2046:
782 case WM5100_DSP3_ZM_2047:
783 return 1; 700 return 1;
784 default: 701 default:
785 return 0; 702 return 0;
786 } 703 }
787} 704}
788 705
789u16 wm5100_reg_defaults[WM5100_MAX_REGISTER + 1] = { 706struct reg_default wm5100_reg_defaults[WM5100_REGISTER_COUNT] = {
790 [0x0000] = 0x0000, /* R0 - software reset */ 707 { 0x0000, 0x0000 }, /* R0 - software reset */
791 [0x0001] = 0x0000, /* R1 - Device Revision */ 708 { 0x0001, 0x0000 }, /* R1 - Device Revision */
792 [0x0010] = 0x0801, /* R16 - Ctrl IF 1 */ 709 { 0x0010, 0x0801 }, /* R16 - Ctrl IF 1 */
793 [0x0020] = 0x0000, /* R32 - Tone Generator 1 */ 710 { 0x0020, 0x0000 }, /* R32 - Tone Generator 1 */
794 [0x0030] = 0x0000, /* R48 - PWM Drive 1 */ 711 { 0x0030, 0x0000 }, /* R48 - PWM Drive 1 */
795 [0x0031] = 0x0100, /* R49 - PWM Drive 2 */ 712 { 0x0031, 0x0100 }, /* R49 - PWM Drive 2 */
796 [0x0032] = 0x0100, /* R50 - PWM Drive 3 */ 713 { 0x0032, 0x0100 }, /* R50 - PWM Drive 3 */
797 [0x0100] = 0x0002, /* R256 - Clocking 1 */ 714 { 0x0100, 0x0002 }, /* R256 - Clocking 1 */
798 [0x0101] = 0x0000, /* R257 - Clocking 3 */ 715 { 0x0101, 0x0000 }, /* R257 - Clocking 3 */
799 [0x0102] = 0x0011, /* R258 - Clocking 4 */ 716 { 0x0102, 0x0011 }, /* R258 - Clocking 4 */
800 [0x0103] = 0x0011, /* R259 - Clocking 5 */ 717 { 0x0103, 0x0011 }, /* R259 - Clocking 5 */
801 [0x0104] = 0x0011, /* R260 - Clocking 6 */ 718 { 0x0104, 0x0011 }, /* R260 - Clocking 6 */
802 [0x0107] = 0x0000, /* R263 - Clocking 7 */ 719 { 0x0107, 0x0000 }, /* R263 - Clocking 7 */
803 [0x0108] = 0x0000, /* R264 - Clocking 8 */ 720 { 0x0108, 0x0000 }, /* R264 - Clocking 8 */
804 [0x0120] = 0x0000, /* R288 - ASRC_ENABLE */ 721 { 0x0120, 0x0000 }, /* R288 - ASRC_ENABLE */
805 [0x0121] = 0x0000, /* R289 - ASRC_STATUS */ 722 { 0x0121, 0x0000 }, /* R289 - ASRC_STATUS */
806 [0x0122] = 0x0000, /* R290 - ASRC_RATE1 */ 723 { 0x0122, 0x0000 }, /* R290 - ASRC_RATE1 */
807 [0x0141] = 0x8000, /* R321 - ISRC 1 CTRL 1 */ 724 { 0x0141, 0x8000 }, /* R321 - ISRC 1 CTRL 1 */
808 [0x0142] = 0x0000, /* R322 - ISRC 1 CTRL 2 */ 725 { 0x0142, 0x0000 }, /* R322 - ISRC 1 CTRL 2 */
809 [0x0143] = 0x8000, /* R323 - ISRC 2 CTRL1 */ 726 { 0x0143, 0x8000 }, /* R323 - ISRC 2 CTRL1 */
810 [0x0144] = 0x0000, /* R324 - ISRC 2 CTRL 2 */ 727 { 0x0144, 0x0000 }, /* R324 - ISRC 2 CTRL 2 */
811 [0x0182] = 0x0000, /* R386 - FLL1 Control 1 */ 728 { 0x0182, 0x0000 }, /* R386 - FLL1 Control 1 */
812 [0x0183] = 0x0000, /* R387 - FLL1 Control 2 */ 729 { 0x0183, 0x0000 }, /* R387 - FLL1 Control 2 */
813 [0x0184] = 0x0000, /* R388 - FLL1 Control 3 */ 730 { 0x0184, 0x0000 }, /* R388 - FLL1 Control 3 */
814 [0x0186] = 0x0177, /* R390 - FLL1 Control 5 */ 731 { 0x0186, 0x0177 }, /* R390 - FLL1 Control 5 */
815 [0x0187] = 0x0001, /* R391 - FLL1 Control 6 */ 732 { 0x0187, 0x0001 }, /* R391 - FLL1 Control 6 */
816 [0x0188] = 0x0000, /* R392 - FLL1 EFS 1 */ 733 { 0x0188, 0x0000 }, /* R392 - FLL1 EFS 1 */
817 [0x01A2] = 0x0000, /* R418 - FLL2 Control 1 */ 734 { 0x01A2, 0x0000 }, /* R418 - FLL2 Control 1 */
818 [0x01A3] = 0x0000, /* R419 - FLL2 Control 2 */ 735 { 0x01A3, 0x0000 }, /* R419 - FLL2 Control 2 */
819 [0x01A4] = 0x0000, /* R420 - FLL2 Control 3 */ 736 { 0x01A4, 0x0000 }, /* R420 - FLL2 Control 3 */
820 [0x01A6] = 0x0177, /* R422 - FLL2 Control 5 */ 737 { 0x01A6, 0x0177 }, /* R422 - FLL2 Control 5 */
821 [0x01A7] = 0x0001, /* R423 - FLL2 Control 6 */ 738 { 0x01A7, 0x0001 }, /* R423 - FLL2 Control 6 */
822 [0x01A8] = 0x0000, /* R424 - FLL2 EFS 1 */ 739 { 0x01A8, 0x0000 }, /* R424 - FLL2 EFS 1 */
823 [0x0200] = 0x0020, /* R512 - Mic Charge Pump 1 */ 740 { 0x0200, 0x0020 }, /* R512 - Mic Charge Pump 1 */
824 [0x0201] = 0xB084, /* R513 - Mic Charge Pump 2 */ 741 { 0x0201, 0xB084 }, /* R513 - Mic Charge Pump 2 */
825 [0x0202] = 0xBBDE, /* R514 - HP Charge Pump 1 */ 742 { 0x0202, 0xBBDE }, /* R514 - HP Charge Pump 1 */
826 [0x0211] = 0x20D4, /* R529 - LDO1 Control */ 743 { 0x0211, 0x20D4 }, /* R529 - LDO1 Control */
827 [0x0215] = 0x0062, /* R533 - Mic Bias Ctrl 1 */ 744 { 0x0215, 0x0062 }, /* R533 - Mic Bias Ctrl 1 */
828 [0x0216] = 0x0062, /* R534 - Mic Bias Ctrl 2 */ 745 { 0x0216, 0x0062 }, /* R534 - Mic Bias Ctrl 2 */
829 [0x0217] = 0x0062, /* R535 - Mic Bias Ctrl 3 */ 746 { 0x0217, 0x0062 }, /* R535 - Mic Bias Ctrl 3 */
830 [0x0280] = 0x0004, /* R640 - Accessory Detect Mode 1 */ 747 { 0x0280, 0x0004 }, /* R640 - Accessory Detect Mode 1 */
831 [0x0288] = 0x0020, /* R648 - Headphone Detect 1 */ 748 { 0x0288, 0x0020 }, /* R648 - Headphone Detect 1 */
832 [0x0289] = 0x0000, /* R649 - Headphone Detect 2 */ 749 { 0x0289, 0x0000 }, /* R649 - Headphone Detect 2 */
833 [0x0290] = 0x1100, /* R656 - Mic Detect 1 */ 750 { 0x0290, 0x1100 }, /* R656 - Mic Detect 1 */
834 [0x0291] = 0x009F, /* R657 - Mic Detect 2 */ 751 { 0x0291, 0x009F }, /* R657 - Mic Detect 2 */
835 [0x0292] = 0x0000, /* R658 - Mic Detect 3 */ 752 { 0x0292, 0x0000 }, /* R658 - Mic Detect 3 */
836 [0x0301] = 0x0000, /* R769 - Input Enables */ 753 { 0x0301, 0x0000 }, /* R769 - Input Enables */
837 [0x0302] = 0x0000, /* R770 - Input Enables Status */ 754 { 0x0302, 0x0000 }, /* R770 - Input Enables Status */
838 [0x0310] = 0x2280, /* R784 - Status */ 755 { 0x0310, 0x2280 }, /* R784 - Status */
839 [0x0311] = 0x0080, /* R785 - IN1R Control */ 756 { 0x0311, 0x0080 }, /* R785 - IN1R Control */
840 [0x0312] = 0x2280, /* R786 - IN2L Control */ 757 { 0x0312, 0x2280 }, /* R786 - IN2L Control */
841 [0x0313] = 0x0080, /* R787 - IN2R Control */ 758 { 0x0313, 0x0080 }, /* R787 - IN2R Control */
842 [0x0314] = 0x2280, /* R788 - IN3L Control */ 759 { 0x0314, 0x2280 }, /* R788 - IN3L Control */
843 [0x0315] = 0x0080, /* R789 - IN3R Control */ 760 { 0x0315, 0x0080 }, /* R789 - IN3R Control */
844 [0x0316] = 0x2280, /* R790 - IN4L Control */ 761 { 0x0316, 0x2280 }, /* R790 - IN4L Control */
845 [0x0317] = 0x0080, /* R791 - IN4R Control */ 762 { 0x0317, 0x0080 }, /* R791 - IN4R Control */
846 [0x0318] = 0x0000, /* R792 - RXANC_SRC */ 763 { 0x0318, 0x0000 }, /* R792 - RXANC_SRC */
847 [0x0319] = 0x0022, /* R793 - Input Volume Ramp */ 764 { 0x0319, 0x0022 }, /* R793 - Input Volume Ramp */
848 [0x0320] = 0x0180, /* R800 - ADC Digital Volume 1L */ 765 { 0x0320, 0x0180 }, /* R800 - ADC Digital Volume 1L */
849 [0x0321] = 0x0180, /* R801 - ADC Digital Volume 1R */ 766 { 0x0321, 0x0180 }, /* R801 - ADC Digital Volume 1R */
850 [0x0322] = 0x0180, /* R802 - ADC Digital Volume 2L */ 767 { 0x0322, 0x0180 }, /* R802 - ADC Digital Volume 2L */
851 [0x0323] = 0x0180, /* R803 - ADC Digital Volume 2R */ 768 { 0x0323, 0x0180 }, /* R803 - ADC Digital Volume 2R */
852 [0x0324] = 0x0180, /* R804 - ADC Digital Volume 3L */ 769 { 0x0324, 0x0180 }, /* R804 - ADC Digital Volume 3L */
853 [0x0325] = 0x0180, /* R805 - ADC Digital Volume 3R */ 770 { 0x0325, 0x0180 }, /* R805 - ADC Digital Volume 3R */
854 [0x0326] = 0x0180, /* R806 - ADC Digital Volume 4L */ 771 { 0x0326, 0x0180 }, /* R806 - ADC Digital Volume 4L */
855 [0x0327] = 0x0180, /* R807 - ADC Digital Volume 4R */ 772 { 0x0327, 0x0180 }, /* R807 - ADC Digital Volume 4R */
856 [0x0401] = 0x0000, /* R1025 - Output Enables 2 */ 773 { 0x0401, 0x0000 }, /* R1025 - Output Enables 2 */
857 [0x0402] = 0x0000, /* R1026 - Output Status 1 */ 774 { 0x0402, 0x0000 }, /* R1026 - Output Status 1 */
858 [0x0403] = 0x0000, /* R1027 - Output Status 2 */ 775 { 0x0403, 0x0000 }, /* R1027 - Output Status 2 */
859 [0x0408] = 0x0000, /* R1032 - Channel Enables 1 */ 776 { 0x0408, 0x0000 }, /* R1032 - Channel Enables 1 */
860 [0x0410] = 0x0080, /* R1040 - Out Volume 1L */ 777 { 0x0410, 0x0080 }, /* R1040 - Out Volume 1L */
861 [0x0411] = 0x0080, /* R1041 - Out Volume 1R */ 778 { 0x0411, 0x0080 }, /* R1041 - Out Volume 1R */
862 [0x0412] = 0x0080, /* R1042 - DAC Volume Limit 1L */ 779 { 0x0412, 0x0080 }, /* R1042 - DAC Volume Limit 1L */
863 [0x0413] = 0x0080, /* R1043 - DAC Volume Limit 1R */ 780 { 0x0413, 0x0080 }, /* R1043 - DAC Volume Limit 1R */
864 [0x0414] = 0x0080, /* R1044 - Out Volume 2L */ 781 { 0x0414, 0x0080 }, /* R1044 - Out Volume 2L */
865 [0x0415] = 0x0080, /* R1045 - Out Volume 2R */ 782 { 0x0415, 0x0080 }, /* R1045 - Out Volume 2R */
866 [0x0416] = 0x0080, /* R1046 - DAC Volume Limit 2L */ 783 { 0x0416, 0x0080 }, /* R1046 - DAC Volume Limit 2L */
867 [0x0417] = 0x0080, /* R1047 - DAC Volume Limit 2R */ 784 { 0x0417, 0x0080 }, /* R1047 - DAC Volume Limit 2R */
868 [0x0418] = 0x0080, /* R1048 - Out Volume 3L */ 785 { 0x0418, 0x0080 }, /* R1048 - Out Volume 3L */
869 [0x0419] = 0x0080, /* R1049 - Out Volume 3R */ 786 { 0x0419, 0x0080 }, /* R1049 - Out Volume 3R */
870 [0x041A] = 0x0080, /* R1050 - DAC Volume Limit 3L */ 787 { 0x041A, 0x0080 }, /* R1050 - DAC Volume Limit 3L */
871 [0x041B] = 0x0080, /* R1051 - DAC Volume Limit 3R */ 788 { 0x041B, 0x0080 }, /* R1051 - DAC Volume Limit 3R */
872 [0x041C] = 0x0080, /* R1052 - Out Volume 4L */ 789 { 0x041C, 0x0080 }, /* R1052 - Out Volume 4L */
873 [0x041D] = 0x0080, /* R1053 - Out Volume 4R */ 790 { 0x041D, 0x0080 }, /* R1053 - Out Volume 4R */
874 [0x041E] = 0x0080, /* R1054 - DAC Volume Limit 5L */ 791 { 0x041E, 0x0080 }, /* R1054 - DAC Volume Limit 5L */
875 [0x041F] = 0x0080, /* R1055 - DAC Volume Limit 5R */ 792 { 0x041F, 0x0080 }, /* R1055 - DAC Volume Limit 5R */
876 [0x0420] = 0x0080, /* R1056 - DAC Volume Limit 6L */ 793 { 0x0420, 0x0080 }, /* R1056 - DAC Volume Limit 6L */
877 [0x0421] = 0x0080, /* R1057 - DAC Volume Limit 6R */ 794 { 0x0421, 0x0080 }, /* R1057 - DAC Volume Limit 6R */
878 [0x0440] = 0x0000, /* R1088 - DAC AEC Control 1 */ 795 { 0x0440, 0x0000 }, /* R1088 - DAC AEC Control 1 */
879 [0x0441] = 0x0022, /* R1089 - Output Volume Ramp */ 796 { 0x0441, 0x0022 }, /* R1089 - Output Volume Ramp */
880 [0x0480] = 0x0180, /* R1152 - DAC Digital Volume 1L */ 797 { 0x0480, 0x0180 }, /* R1152 - DAC Digital Volume 1L */
881 [0x0481] = 0x0180, /* R1153 - DAC Digital Volume 1R */ 798 { 0x0481, 0x0180 }, /* R1153 - DAC Digital Volume 1R */
882 [0x0482] = 0x0180, /* R1154 - DAC Digital Volume 2L */ 799 { 0x0482, 0x0180 }, /* R1154 - DAC Digital Volume 2L */
883 [0x0483] = 0x0180, /* R1155 - DAC Digital Volume 2R */ 800 { 0x0483, 0x0180 }, /* R1155 - DAC Digital Volume 2R */
884 [0x0484] = 0x0180, /* R1156 - DAC Digital Volume 3L */ 801 { 0x0484, 0x0180 }, /* R1156 - DAC Digital Volume 3L */
885 [0x0485] = 0x0180, /* R1157 - DAC Digital Volume 3R */ 802 { 0x0485, 0x0180 }, /* R1157 - DAC Digital Volume 3R */
886 [0x0486] = 0x0180, /* R1158 - DAC Digital Volume 4L */ 803 { 0x0486, 0x0180 }, /* R1158 - DAC Digital Volume 4L */
887 [0x0487] = 0x0180, /* R1159 - DAC Digital Volume 4R */ 804 { 0x0487, 0x0180 }, /* R1159 - DAC Digital Volume 4R */
888 [0x0488] = 0x0180, /* R1160 - DAC Digital Volume 5L */ 805 { 0x0488, 0x0180 }, /* R1160 - DAC Digital Volume 5L */
889 [0x0489] = 0x0180, /* R1161 - DAC Digital Volume 5R */ 806 { 0x0489, 0x0180 }, /* R1161 - DAC Digital Volume 5R */
890 [0x048A] = 0x0180, /* R1162 - DAC Digital Volume 6L */ 807 { 0x048A, 0x0180 }, /* R1162 - DAC Digital Volume 6L */
891 [0x048B] = 0x0180, /* R1163 - DAC Digital Volume 6R */ 808 { 0x048B, 0x0180 }, /* R1163 - DAC Digital Volume 6R */
892 [0x04C0] = 0x0069, /* R1216 - PDM SPK1 CTRL 1 */ 809 { 0x04C0, 0x0069 }, /* R1216 - PDM SPK1 CTRL 1 */
893 [0x04C1] = 0x0000, /* R1217 - PDM SPK1 CTRL 2 */ 810 { 0x04C1, 0x0000 }, /* R1217 - PDM SPK1 CTRL 2 */
894 [0x04C2] = 0x0069, /* R1218 - PDM SPK2 CTRL 1 */ 811 { 0x04C2, 0x0069 }, /* R1218 - PDM SPK2 CTRL 1 */
895 [0x04C3] = 0x0000, /* R1219 - PDM SPK2 CTRL 2 */ 812 { 0x04C3, 0x0000 }, /* R1219 - PDM SPK2 CTRL 2 */
896 [0x0500] = 0x000C, /* R1280 - Audio IF 1_1 */ 813 { 0x0500, 0x000C }, /* R1280 - Audio IF 1_1 */
897 [0x0501] = 0x0008, /* R1281 - Audio IF 1_2 */ 814 { 0x0501, 0x0008 }, /* R1281 - Audio IF 1_2 */
898 [0x0502] = 0x0000, /* R1282 - Audio IF 1_3 */ 815 { 0x0502, 0x0000 }, /* R1282 - Audio IF 1_3 */
899 [0x0503] = 0x0000, /* R1283 - Audio IF 1_4 */ 816 { 0x0503, 0x0000 }, /* R1283 - Audio IF 1_4 */
900 [0x0504] = 0x0000, /* R1284 - Audio IF 1_5 */ 817 { 0x0504, 0x0000 }, /* R1284 - Audio IF 1_5 */
901 [0x0505] = 0x0300, /* R1285 - Audio IF 1_6 */ 818 { 0x0505, 0x0300 }, /* R1285 - Audio IF 1_6 */
902 [0x0506] = 0x0300, /* R1286 - Audio IF 1_7 */ 819 { 0x0506, 0x0300 }, /* R1286 - Audio IF 1_7 */
903 [0x0507] = 0x1820, /* R1287 - Audio IF 1_8 */ 820 { 0x0507, 0x1820 }, /* R1287 - Audio IF 1_8 */
904 [0x0508] = 0x1820, /* R1288 - Audio IF 1_9 */ 821 { 0x0508, 0x1820 }, /* R1288 - Audio IF 1_9 */
905 [0x0509] = 0x0000, /* R1289 - Audio IF 1_10 */ 822 { 0x0509, 0x0000 }, /* R1289 - Audio IF 1_10 */
906 [0x050A] = 0x0001, /* R1290 - Audio IF 1_11 */ 823 { 0x050A, 0x0001 }, /* R1290 - Audio IF 1_11 */
907 [0x050B] = 0x0002, /* R1291 - Audio IF 1_12 */ 824 { 0x050B, 0x0002 }, /* R1291 - Audio IF 1_12 */
908 [0x050C] = 0x0003, /* R1292 - Audio IF 1_13 */ 825 { 0x050C, 0x0003 }, /* R1292 - Audio IF 1_13 */
909 [0x050D] = 0x0004, /* R1293 - Audio IF 1_14 */ 826 { 0x050D, 0x0004 }, /* R1293 - Audio IF 1_14 */
910 [0x050E] = 0x0005, /* R1294 - Audio IF 1_15 */ 827 { 0x050E, 0x0005 }, /* R1294 - Audio IF 1_15 */
911 [0x050F] = 0x0006, /* R1295 - Audio IF 1_16 */ 828 { 0x050F, 0x0006 }, /* R1295 - Audio IF 1_16 */
912 [0x0510] = 0x0007, /* R1296 - Audio IF 1_17 */ 829 { 0x0510, 0x0007 }, /* R1296 - Audio IF 1_17 */
913 [0x0511] = 0x0000, /* R1297 - Audio IF 1_18 */ 830 { 0x0511, 0x0000 }, /* R1297 - Audio IF 1_18 */
914 [0x0512] = 0x0001, /* R1298 - Audio IF 1_19 */ 831 { 0x0512, 0x0001 }, /* R1298 - Audio IF 1_19 */
915 [0x0513] = 0x0002, /* R1299 - Audio IF 1_20 */ 832 { 0x0513, 0x0002 }, /* R1299 - Audio IF 1_20 */
916 [0x0514] = 0x0003, /* R1300 - Audio IF 1_21 */ 833 { 0x0514, 0x0003 }, /* R1300 - Audio IF 1_21 */
917 [0x0515] = 0x0004, /* R1301 - Audio IF 1_22 */ 834 { 0x0515, 0x0004 }, /* R1301 - Audio IF 1_22 */
918 [0x0516] = 0x0005, /* R1302 - Audio IF 1_23 */ 835 { 0x0516, 0x0005 }, /* R1302 - Audio IF 1_23 */
919 [0x0517] = 0x0006, /* R1303 - Audio IF 1_24 */ 836 { 0x0517, 0x0006 }, /* R1303 - Audio IF 1_24 */
920 [0x0518] = 0x0007, /* R1304 - Audio IF 1_25 */ 837 { 0x0518, 0x0007 }, /* R1304 - Audio IF 1_25 */
921 [0x0519] = 0x0000, /* R1305 - Audio IF 1_26 */ 838 { 0x0519, 0x0000 }, /* R1305 - Audio IF 1_26 */
922 [0x051A] = 0x0000, /* R1306 - Audio IF 1_27 */ 839 { 0x051A, 0x0000 }, /* R1306 - Audio IF 1_27 */
923 [0x0540] = 0x000C, /* R1344 - Audio IF 2_1 */ 840 { 0x0540, 0x000C }, /* R1344 - Audio IF 2_1 */
924 [0x0541] = 0x0008, /* R1345 - Audio IF 2_2 */ 841 { 0x0541, 0x0008 }, /* R1345 - Audio IF 2_2 */
925 [0x0542] = 0x0000, /* R1346 - Audio IF 2_3 */ 842 { 0x0542, 0x0000 }, /* R1346 - Audio IF 2_3 */
926 [0x0543] = 0x0000, /* R1347 - Audio IF 2_4 */ 843 { 0x0543, 0x0000 }, /* R1347 - Audio IF 2_4 */
927 [0x0544] = 0x0000, /* R1348 - Audio IF 2_5 */ 844 { 0x0544, 0x0000 }, /* R1348 - Audio IF 2_5 */
928 [0x0545] = 0x0300, /* R1349 - Audio IF 2_6 */ 845 { 0x0545, 0x0300 }, /* R1349 - Audio IF 2_6 */
929 [0x0546] = 0x0300, /* R1350 - Audio IF 2_7 */ 846 { 0x0546, 0x0300 }, /* R1350 - Audio IF 2_7 */
930 [0x0547] = 0x1820, /* R1351 - Audio IF 2_8 */ 847 { 0x0547, 0x1820 }, /* R1351 - Audio IF 2_8 */
931 [0x0548] = 0x1820, /* R1352 - Audio IF 2_9 */ 848 { 0x0548, 0x1820 }, /* R1352 - Audio IF 2_9 */
932 [0x0549] = 0x0000, /* R1353 - Audio IF 2_10 */ 849 { 0x0549, 0x0000 }, /* R1353 - Audio IF 2_10 */
933 [0x054A] = 0x0001, /* R1354 - Audio IF 2_11 */ 850 { 0x054A, 0x0001 }, /* R1354 - Audio IF 2_11 */
934 [0x0551] = 0x0000, /* R1361 - Audio IF 2_18 */ 851 { 0x0551, 0x0000 }, /* R1361 - Audio IF 2_18 */
935 [0x0552] = 0x0001, /* R1362 - Audio IF 2_19 */ 852 { 0x0552, 0x0001 }, /* R1362 - Audio IF 2_19 */
936 [0x0559] = 0x0000, /* R1369 - Audio IF 2_26 */ 853 { 0x0559, 0x0000 }, /* R1369 - Audio IF 2_26 */
937 [0x055A] = 0x0000, /* R1370 - Audio IF 2_27 */ 854 { 0x055A, 0x0000 }, /* R1370 - Audio IF 2_27 */
938 [0x0580] = 0x000C, /* R1408 - Audio IF 3_1 */ 855 { 0x0580, 0x000C }, /* R1408 - Audio IF 3_1 */
939 [0x0581] = 0x0008, /* R1409 - Audio IF 3_2 */ 856 { 0x0581, 0x0008 }, /* R1409 - Audio IF 3_2 */
940 [0x0582] = 0x0000, /* R1410 - Audio IF 3_3 */ 857 { 0x0582, 0x0000 }, /* R1410 - Audio IF 3_3 */
941 [0x0583] = 0x0000, /* R1411 - Audio IF 3_4 */ 858 { 0x0583, 0x0000 }, /* R1411 - Audio IF 3_4 */
942 [0x0584] = 0x0000, /* R1412 - Audio IF 3_5 */ 859 { 0x0584, 0x0000 }, /* R1412 - Audio IF 3_5 */
943 [0x0585] = 0x0300, /* R1413 - Audio IF 3_6 */ 860 { 0x0585, 0x0300 }, /* R1413 - Audio IF 3_6 */
944 [0x0586] = 0x0300, /* R1414 - Audio IF 3_7 */ 861 { 0x0586, 0x0300 }, /* R1414 - Audio IF 3_7 */
945 [0x0587] = 0x1820, /* R1415 - Audio IF 3_8 */ 862 { 0x0587, 0x1820 }, /* R1415 - Audio IF 3_8 */
946 [0x0588] = 0x1820, /* R1416 - Audio IF 3_9 */ 863 { 0x0588, 0x1820 }, /* R1416 - Audio IF 3_9 */
947 [0x0589] = 0x0000, /* R1417 - Audio IF 3_10 */ 864 { 0x0589, 0x0000 }, /* R1417 - Audio IF 3_10 */
948 [0x058A] = 0x0001, /* R1418 - Audio IF 3_11 */ 865 { 0x058A, 0x0001 }, /* R1418 - Audio IF 3_11 */
949 [0x0591] = 0x0000, /* R1425 - Audio IF 3_18 */ 866 { 0x0591, 0x0000 }, /* R1425 - Audio IF 3_18 */
950 [0x0592] = 0x0001, /* R1426 - Audio IF 3_19 */ 867 { 0x0592, 0x0001 }, /* R1426 - Audio IF 3_19 */
951 [0x0599] = 0x0000, /* R1433 - Audio IF 3_26 */ 868 { 0x0599, 0x0000 }, /* R1433 - Audio IF 3_26 */
952 [0x059A] = 0x0000, /* R1434 - Audio IF 3_27 */ 869 { 0x059A, 0x0000 }, /* R1434 - Audio IF 3_27 */
953 [0x0640] = 0x0000, /* R1600 - PWM1MIX Input 1 Source */ 870 { 0x0640, 0x0000 }, /* R1600 - PWM1MIX Input 1 Source */
954 [0x0641] = 0x0080, /* R1601 - PWM1MIX Input 1 Volume */ 871 { 0x0641, 0x0080 }, /* R1601 - PWM1MIX Input 1 Volume */
955 [0x0642] = 0x0000, /* R1602 - PWM1MIX Input 2 Source */ 872 { 0x0642, 0x0000 }, /* R1602 - PWM1MIX Input 2 Source */
956 [0x0643] = 0x0080, /* R1603 - PWM1MIX Input 2 Volume */ 873 { 0x0643, 0x0080 }, /* R1603 - PWM1MIX Input 2 Volume */
957 [0x0644] = 0x0000, /* R1604 - PWM1MIX Input 3 Source */ 874 { 0x0644, 0x0000 }, /* R1604 - PWM1MIX Input 3 Source */
958 [0x0645] = 0x0080, /* R1605 - PWM1MIX Input 3 Volume */ 875 { 0x0645, 0x0080 }, /* R1605 - PWM1MIX Input 3 Volume */
959 [0x0646] = 0x0000, /* R1606 - PWM1MIX Input 4 Source */ 876 { 0x0646, 0x0000 }, /* R1606 - PWM1MIX Input 4 Source */
960 [0x0647] = 0x0080, /* R1607 - PWM1MIX Input 4 Volume */ 877 { 0x0647, 0x0080 }, /* R1607 - PWM1MIX Input 4 Volume */
961 [0x0648] = 0x0000, /* R1608 - PWM2MIX Input 1 Source */ 878 { 0x0648, 0x0000 }, /* R1608 - PWM2MIX Input 1 Source */
962 [0x0649] = 0x0080, /* R1609 - PWM2MIX Input 1 Volume */ 879 { 0x0649, 0x0080 }, /* R1609 - PWM2MIX Input 1 Volume */
963 [0x064A] = 0x0000, /* R1610 - PWM2MIX Input 2 Source */ 880 { 0x064A, 0x0000 }, /* R1610 - PWM2MIX Input 2 Source */
964 [0x064B] = 0x0080, /* R1611 - PWM2MIX Input 2 Volume */ 881 { 0x064B, 0x0080 }, /* R1611 - PWM2MIX Input 2 Volume */
965 [0x064C] = 0x0000, /* R1612 - PWM2MIX Input 3 Source */ 882 { 0x064C, 0x0000 }, /* R1612 - PWM2MIX Input 3 Source */
966 [0x064D] = 0x0080, /* R1613 - PWM2MIX Input 3 Volume */ 883 { 0x064D, 0x0080 }, /* R1613 - PWM2MIX Input 3 Volume */
967 [0x064E] = 0x0000, /* R1614 - PWM2MIX Input 4 Source */ 884 { 0x064E, 0x0000 }, /* R1614 - PWM2MIX Input 4 Source */
968 [0x064F] = 0x0080, /* R1615 - PWM2MIX Input 4 Volume */ 885 { 0x064F, 0x0080 }, /* R1615 - PWM2MIX Input 4 Volume */
969 [0x0680] = 0x0000, /* R1664 - OUT1LMIX Input 1 Source */ 886 { 0x0680, 0x0000 }, /* R1664 - OUT1LMIX Input 1 Source */
970 [0x0681] = 0x0080, /* R1665 - OUT1LMIX Input 1 Volume */ 887 { 0x0681, 0x0080 }, /* R1665 - OUT1LMIX Input 1 Volume */
971 [0x0682] = 0x0000, /* R1666 - OUT1LMIX Input 2 Source */ 888 { 0x0682, 0x0000 }, /* R1666 - OUT1LMIX Input 2 Source */
972 [0x0683] = 0x0080, /* R1667 - OUT1LMIX Input 2 Volume */ 889 { 0x0683, 0x0080 }, /* R1667 - OUT1LMIX Input 2 Volume */
973 [0x0684] = 0x0000, /* R1668 - OUT1LMIX Input 3 Source */ 890 { 0x0684, 0x0000 }, /* R1668 - OUT1LMIX Input 3 Source */
974 [0x0685] = 0x0080, /* R1669 - OUT1LMIX Input 3 Volume */ 891 { 0x0685, 0x0080 }, /* R1669 - OUT1LMIX Input 3 Volume */
975 [0x0686] = 0x0000, /* R1670 - OUT1LMIX Input 4 Source */ 892 { 0x0686, 0x0000 }, /* R1670 - OUT1LMIX Input 4 Source */
976 [0x0687] = 0x0080, /* R1671 - OUT1LMIX Input 4 Volume */ 893 { 0x0687, 0x0080 }, /* R1671 - OUT1LMIX Input 4 Volume */
977 [0x0688] = 0x0000, /* R1672 - OUT1RMIX Input 1 Source */ 894 { 0x0688, 0x0000 }, /* R1672 - OUT1RMIX Input 1 Source */
978 [0x0689] = 0x0080, /* R1673 - OUT1RMIX Input 1 Volume */ 895 { 0x0689, 0x0080 }, /* R1673 - OUT1RMIX Input 1 Volume */
979 [0x068A] = 0x0000, /* R1674 - OUT1RMIX Input 2 Source */ 896 { 0x068A, 0x0000 }, /* R1674 - OUT1RMIX Input 2 Source */
980 [0x068B] = 0x0080, /* R1675 - OUT1RMIX Input 2 Volume */ 897 { 0x068B, 0x0080 }, /* R1675 - OUT1RMIX Input 2 Volume */
981 [0x068C] = 0x0000, /* R1676 - OUT1RMIX Input 3 Source */ 898 { 0x068C, 0x0000 }, /* R1676 - OUT1RMIX Input 3 Source */
982 [0x068D] = 0x0080, /* R1677 - OUT1RMIX Input 3 Volume */ 899 { 0x068D, 0x0080 }, /* R1677 - OUT1RMIX Input 3 Volume */
983 [0x068E] = 0x0000, /* R1678 - OUT1RMIX Input 4 Source */ 900 { 0x068E, 0x0000 }, /* R1678 - OUT1RMIX Input 4 Source */
984 [0x068F] = 0x0080, /* R1679 - OUT1RMIX Input 4 Volume */ 901 { 0x068F, 0x0080 }, /* R1679 - OUT1RMIX Input 4 Volume */
985 [0x0690] = 0x0000, /* R1680 - OUT2LMIX Input 1 Source */ 902 { 0x0690, 0x0000 }, /* R1680 - OUT2LMIX Input 1 Source */
986 [0x0691] = 0x0080, /* R1681 - OUT2LMIX Input 1 Volume */ 903 { 0x0691, 0x0080 }, /* R1681 - OUT2LMIX Input 1 Volume */
987 [0x0692] = 0x0000, /* R1682 - OUT2LMIX Input 2 Source */ 904 { 0x0692, 0x0000 }, /* R1682 - OUT2LMIX Input 2 Source */
988 [0x0693] = 0x0080, /* R1683 - OUT2LMIX Input 2 Volume */ 905 { 0x0693, 0x0080 }, /* R1683 - OUT2LMIX Input 2 Volume */
989 [0x0694] = 0x0000, /* R1684 - OUT2LMIX Input 3 Source */ 906 { 0x0694, 0x0000 }, /* R1684 - OUT2LMIX Input 3 Source */
990 [0x0695] = 0x0080, /* R1685 - OUT2LMIX Input 3 Volume */ 907 { 0x0695, 0x0080 }, /* R1685 - OUT2LMIX Input 3 Volume */
991 [0x0696] = 0x0000, /* R1686 - OUT2LMIX Input 4 Source */ 908 { 0x0696, 0x0000 }, /* R1686 - OUT2LMIX Input 4 Source */
992 [0x0697] = 0x0080, /* R1687 - OUT2LMIX Input 4 Volume */ 909 { 0x0697, 0x0080 }, /* R1687 - OUT2LMIX Input 4 Volume */
993 [0x0698] = 0x0000, /* R1688 - OUT2RMIX Input 1 Source */ 910 { 0x0698, 0x0000 }, /* R1688 - OUT2RMIX Input 1 Source */
994 [0x0699] = 0x0080, /* R1689 - OUT2RMIX Input 1 Volume */ 911 { 0x0699, 0x0080 }, /* R1689 - OUT2RMIX Input 1 Volume */
995 [0x069A] = 0x0000, /* R1690 - OUT2RMIX Input 2 Source */ 912 { 0x069A, 0x0000 }, /* R1690 - OUT2RMIX Input 2 Source */
996 [0x069B] = 0x0080, /* R1691 - OUT2RMIX Input 2 Volume */ 913 { 0x069B, 0x0080 }, /* R1691 - OUT2RMIX Input 2 Volume */
997 [0x069C] = 0x0000, /* R1692 - OUT2RMIX Input 3 Source */ 914 { 0x069C, 0x0000 }, /* R1692 - OUT2RMIX Input 3 Source */
998 [0x069D] = 0x0080, /* R1693 - OUT2RMIX Input 3 Volume */ 915 { 0x069D, 0x0080 }, /* R1693 - OUT2RMIX Input 3 Volume */
999 [0x069E] = 0x0000, /* R1694 - OUT2RMIX Input 4 Source */ 916 { 0x069E, 0x0000 }, /* R1694 - OUT2RMIX Input 4 Source */
1000 [0x069F] = 0x0080, /* R1695 - OUT2RMIX Input 4 Volume */ 917 { 0x069F, 0x0080 }, /* R1695 - OUT2RMIX Input 4 Volume */
1001 [0x06A0] = 0x0000, /* R1696 - OUT3LMIX Input 1 Source */ 918 { 0x06A0, 0x0000 }, /* R1696 - OUT3LMIX Input 1 Source */
1002 [0x06A1] = 0x0080, /* R1697 - OUT3LMIX Input 1 Volume */ 919 { 0x06A1, 0x0080 }, /* R1697 - OUT3LMIX Input 1 Volume */
1003 [0x06A2] = 0x0000, /* R1698 - OUT3LMIX Input 2 Source */ 920 { 0x06A2, 0x0000 }, /* R1698 - OUT3LMIX Input 2 Source */
1004 [0x06A3] = 0x0080, /* R1699 - OUT3LMIX Input 2 Volume */ 921 { 0x06A3, 0x0080 }, /* R1699 - OUT3LMIX Input 2 Volume */
1005 [0x06A4] = 0x0000, /* R1700 - OUT3LMIX Input 3 Source */ 922 { 0x06A4, 0x0000 }, /* R1700 - OUT3LMIX Input 3 Source */
1006 [0x06A5] = 0x0080, /* R1701 - OUT3LMIX Input 3 Volume */ 923 { 0x06A5, 0x0080 }, /* R1701 - OUT3LMIX Input 3 Volume */
1007 [0x06A6] = 0x0000, /* R1702 - OUT3LMIX Input 4 Source */ 924 { 0x06A6, 0x0000 }, /* R1702 - OUT3LMIX Input 4 Source */
1008 [0x06A7] = 0x0080, /* R1703 - OUT3LMIX Input 4 Volume */ 925 { 0x06A7, 0x0080 }, /* R1703 - OUT3LMIX Input 4 Volume */
1009 [0x06A8] = 0x0000, /* R1704 - OUT3RMIX Input 1 Source */ 926 { 0x06A8, 0x0000 }, /* R1704 - OUT3RMIX Input 1 Source */
1010 [0x06A9] = 0x0080, /* R1705 - OUT3RMIX Input 1 Volume */ 927 { 0x06A9, 0x0080 }, /* R1705 - OUT3RMIX Input 1 Volume */
1011 [0x06AA] = 0x0000, /* R1706 - OUT3RMIX Input 2 Source */ 928 { 0x06AA, 0x0000 }, /* R1706 - OUT3RMIX Input 2 Source */
1012 [0x06AB] = 0x0080, /* R1707 - OUT3RMIX Input 2 Volume */ 929 { 0x06AB, 0x0080 }, /* R1707 - OUT3RMIX Input 2 Volume */
1013 [0x06AC] = 0x0000, /* R1708 - OUT3RMIX Input 3 Source */ 930 { 0x06AC, 0x0000 }, /* R1708 - OUT3RMIX Input 3 Source */
1014 [0x06AD] = 0x0080, /* R1709 - OUT3RMIX Input 3 Volume */ 931 { 0x06AD, 0x0080 }, /* R1709 - OUT3RMIX Input 3 Volume */
1015 [0x06AE] = 0x0000, /* R1710 - OUT3RMIX Input 4 Source */ 932 { 0x06AE, 0x0000 }, /* R1710 - OUT3RMIX Input 4 Source */
1016 [0x06AF] = 0x0080, /* R1711 - OUT3RMIX Input 4 Volume */ 933 { 0x06AF, 0x0080 }, /* R1711 - OUT3RMIX Input 4 Volume */
1017 [0x06B0] = 0x0000, /* R1712 - OUT4LMIX Input 1 Source */ 934 { 0x06B0, 0x0000 }, /* R1712 - OUT4LMIX Input 1 Source */
1018 [0x06B1] = 0x0080, /* R1713 - OUT4LMIX Input 1 Volume */ 935 { 0x06B1, 0x0080 }, /* R1713 - OUT4LMIX Input 1 Volume */
1019 [0x06B2] = 0x0000, /* R1714 - OUT4LMIX Input 2 Source */ 936 { 0x06B2, 0x0000 }, /* R1714 - OUT4LMIX Input 2 Source */
1020 [0x06B3] = 0x0080, /* R1715 - OUT4LMIX Input 2 Volume */ 937 { 0x06B3, 0x0080 }, /* R1715 - OUT4LMIX Input 2 Volume */
1021 [0x06B4] = 0x0000, /* R1716 - OUT4LMIX Input 3 Source */ 938 { 0x06B4, 0x0000 }, /* R1716 - OUT4LMIX Input 3 Source */
1022 [0x06B5] = 0x0080, /* R1717 - OUT4LMIX Input 3 Volume */ 939 { 0x06B5, 0x0080 }, /* R1717 - OUT4LMIX Input 3 Volume */
1023 [0x06B6] = 0x0000, /* R1718 - OUT4LMIX Input 4 Source */ 940 { 0x06B6, 0x0000 }, /* R1718 - OUT4LMIX Input 4 Source */
1024 [0x06B7] = 0x0080, /* R1719 - OUT4LMIX Input 4 Volume */ 941 { 0x06B7, 0x0080 }, /* R1719 - OUT4LMIX Input 4 Volume */
1025 [0x06B8] = 0x0000, /* R1720 - OUT4RMIX Input 1 Source */ 942 { 0x06B8, 0x0000 }, /* R1720 - OUT4RMIX Input 1 Source */
1026 [0x06B9] = 0x0080, /* R1721 - OUT4RMIX Input 1 Volume */ 943 { 0x06B9, 0x0080 }, /* R1721 - OUT4RMIX Input 1 Volume */
1027 [0x06BA] = 0x0000, /* R1722 - OUT4RMIX Input 2 Source */ 944 { 0x06BA, 0x0000 }, /* R1722 - OUT4RMIX Input 2 Source */
1028 [0x06BB] = 0x0080, /* R1723 - OUT4RMIX Input 2 Volume */ 945 { 0x06BB, 0x0080 }, /* R1723 - OUT4RMIX Input 2 Volume */
1029 [0x06BC] = 0x0000, /* R1724 - OUT4RMIX Input 3 Source */ 946 { 0x06BC, 0x0000 }, /* R1724 - OUT4RMIX Input 3 Source */
1030 [0x06BD] = 0x0080, /* R1725 - OUT4RMIX Input 3 Volume */ 947 { 0x06BD, 0x0080 }, /* R1725 - OUT4RMIX Input 3 Volume */
1031 [0x06BE] = 0x0000, /* R1726 - OUT4RMIX Input 4 Source */ 948 { 0x06BE, 0x0000 }, /* R1726 - OUT4RMIX Input 4 Source */
1032 [0x06BF] = 0x0080, /* R1727 - OUT4RMIX Input 4 Volume */ 949 { 0x06BF, 0x0080 }, /* R1727 - OUT4RMIX Input 4 Volume */
1033 [0x06C0] = 0x0000, /* R1728 - OUT5LMIX Input 1 Source */ 950 { 0x06C0, 0x0000 }, /* R1728 - OUT5LMIX Input 1 Source */
1034 [0x06C1] = 0x0080, /* R1729 - OUT5LMIX Input 1 Volume */ 951 { 0x06C1, 0x0080 }, /* R1729 - OUT5LMIX Input 1 Volume */
1035 [0x06C2] = 0x0000, /* R1730 - OUT5LMIX Input 2 Source */ 952 { 0x06C2, 0x0000 }, /* R1730 - OUT5LMIX Input 2 Source */
1036 [0x06C3] = 0x0080, /* R1731 - OUT5LMIX Input 2 Volume */ 953 { 0x06C3, 0x0080 }, /* R1731 - OUT5LMIX Input 2 Volume */
1037 [0x06C4] = 0x0000, /* R1732 - OUT5LMIX Input 3 Source */ 954 { 0x06C4, 0x0000 }, /* R1732 - OUT5LMIX Input 3 Source */
1038 [0x06C5] = 0x0080, /* R1733 - OUT5LMIX Input 3 Volume */ 955 { 0x06C5, 0x0080 }, /* R1733 - OUT5LMIX Input 3 Volume */
1039 [0x06C6] = 0x0000, /* R1734 - OUT5LMIX Input 4 Source */ 956 { 0x06C6, 0x0000 }, /* R1734 - OUT5LMIX Input 4 Source */
1040 [0x06C7] = 0x0080, /* R1735 - OUT5LMIX Input 4 Volume */ 957 { 0x06C7, 0x0080 }, /* R1735 - OUT5LMIX Input 4 Volume */
1041 [0x06C8] = 0x0000, /* R1736 - OUT5RMIX Input 1 Source */ 958 { 0x06C8, 0x0000 }, /* R1736 - OUT5RMIX Input 1 Source */
1042 [0x06C9] = 0x0080, /* R1737 - OUT5RMIX Input 1 Volume */ 959 { 0x06C9, 0x0080 }, /* R1737 - OUT5RMIX Input 1 Volume */
1043 [0x06CA] = 0x0000, /* R1738 - OUT5RMIX Input 2 Source */ 960 { 0x06CA, 0x0000 }, /* R1738 - OUT5RMIX Input 2 Source */
1044 [0x06CB] = 0x0080, /* R1739 - OUT5RMIX Input 2 Volume */ 961 { 0x06CB, 0x0080 }, /* R1739 - OUT5RMIX Input 2 Volume */
1045 [0x06CC] = 0x0000, /* R1740 - OUT5RMIX Input 3 Source */ 962 { 0x06CC, 0x0000 }, /* R1740 - OUT5RMIX Input 3 Source */
1046 [0x06CD] = 0x0080, /* R1741 - OUT5RMIX Input 3 Volume */ 963 { 0x06CD, 0x0080 }, /* R1741 - OUT5RMIX Input 3 Volume */
1047 [0x06CE] = 0x0000, /* R1742 - OUT5RMIX Input 4 Source */ 964 { 0x06CE, 0x0000 }, /* R1742 - OUT5RMIX Input 4 Source */
1048 [0x06CF] = 0x0080, /* R1743 - OUT5RMIX Input 4 Volume */ 965 { 0x06CF, 0x0080 }, /* R1743 - OUT5RMIX Input 4 Volume */
1049 [0x06D0] = 0x0000, /* R1744 - OUT6LMIX Input 1 Source */ 966 { 0x06D0, 0x0000 }, /* R1744 - OUT6LMIX Input 1 Source */
1050 [0x06D1] = 0x0080, /* R1745 - OUT6LMIX Input 1 Volume */ 967 { 0x06D1, 0x0080 }, /* R1745 - OUT6LMIX Input 1 Volume */
1051 [0x06D2] = 0x0000, /* R1746 - OUT6LMIX Input 2 Source */ 968 { 0x06D2, 0x0000 }, /* R1746 - OUT6LMIX Input 2 Source */
1052 [0x06D3] = 0x0080, /* R1747 - OUT6LMIX Input 2 Volume */ 969 { 0x06D3, 0x0080 }, /* R1747 - OUT6LMIX Input 2 Volume */
1053 [0x06D4] = 0x0000, /* R1748 - OUT6LMIX Input 3 Source */ 970 { 0x06D4, 0x0000 }, /* R1748 - OUT6LMIX Input 3 Source */
1054 [0x06D5] = 0x0080, /* R1749 - OUT6LMIX Input 3 Volume */ 971 { 0x06D5, 0x0080 }, /* R1749 - OUT6LMIX Input 3 Volume */
1055 [0x06D6] = 0x0000, /* R1750 - OUT6LMIX Input 4 Source */ 972 { 0x06D6, 0x0000 }, /* R1750 - OUT6LMIX Input 4 Source */
1056 [0x06D7] = 0x0080, /* R1751 - OUT6LMIX Input 4 Volume */ 973 { 0x06D7, 0x0080 }, /* R1751 - OUT6LMIX Input 4 Volume */
1057 [0x06D8] = 0x0000, /* R1752 - OUT6RMIX Input 1 Source */ 974 { 0x06D8, 0x0000 }, /* R1752 - OUT6RMIX Input 1 Source */
1058 [0x06D9] = 0x0080, /* R1753 - OUT6RMIX Input 1 Volume */ 975 { 0x06D9, 0x0080 }, /* R1753 - OUT6RMIX Input 1 Volume */
1059 [0x06DA] = 0x0000, /* R1754 - OUT6RMIX Input 2 Source */ 976 { 0x06DA, 0x0000 }, /* R1754 - OUT6RMIX Input 2 Source */
1060 [0x06DB] = 0x0080, /* R1755 - OUT6RMIX Input 2 Volume */ 977 { 0x06DB, 0x0080 }, /* R1755 - OUT6RMIX Input 2 Volume */
1061 [0x06DC] = 0x0000, /* R1756 - OUT6RMIX Input 3 Source */ 978 { 0x06DC, 0x0000 }, /* R1756 - OUT6RMIX Input 3 Source */
1062 [0x06DD] = 0x0080, /* R1757 - OUT6RMIX Input 3 Volume */ 979 { 0x06DD, 0x0080 }, /* R1757 - OUT6RMIX Input 3 Volume */
1063 [0x06DE] = 0x0000, /* R1758 - OUT6RMIX Input 4 Source */ 980 { 0x06DE, 0x0000 }, /* R1758 - OUT6RMIX Input 4 Source */
1064 [0x06DF] = 0x0080, /* R1759 - OUT6RMIX Input 4 Volume */ 981 { 0x06DF, 0x0080 }, /* R1759 - OUT6RMIX Input 4 Volume */
1065 [0x0700] = 0x0000, /* R1792 - AIF1TX1MIX Input 1 Source */ 982 { 0x0700, 0x0000 }, /* R1792 - AIF1TX1MIX Input 1 Source */
1066 [0x0701] = 0x0080, /* R1793 - AIF1TX1MIX Input 1 Volume */ 983 { 0x0701, 0x0080 }, /* R1793 - AIF1TX1MIX Input 1 Volume */
1067 [0x0702] = 0x0000, /* R1794 - AIF1TX1MIX Input 2 Source */ 984 { 0x0702, 0x0000 }, /* R1794 - AIF1TX1MIX Input 2 Source */
1068 [0x0703] = 0x0080, /* R1795 - AIF1TX1MIX Input 2 Volume */ 985 { 0x0703, 0x0080 }, /* R1795 - AIF1TX1MIX Input 2 Volume */
1069 [0x0704] = 0x0000, /* R1796 - AIF1TX1MIX Input 3 Source */ 986 { 0x0704, 0x0000 }, /* R1796 - AIF1TX1MIX Input 3 Source */
1070 [0x0705] = 0x0080, /* R1797 - AIF1TX1MIX Input 3 Volume */ 987 { 0x0705, 0x0080 }, /* R1797 - AIF1TX1MIX Input 3 Volume */
1071 [0x0706] = 0x0000, /* R1798 - AIF1TX1MIX Input 4 Source */ 988 { 0x0706, 0x0000 }, /* R1798 - AIF1TX1MIX Input 4 Source */
1072 [0x0707] = 0x0080, /* R1799 - AIF1TX1MIX Input 4 Volume */ 989 { 0x0707, 0x0080 }, /* R1799 - AIF1TX1MIX Input 4 Volume */
1073 [0x0708] = 0x0000, /* R1800 - AIF1TX2MIX Input 1 Source */ 990 { 0x0708, 0x0000 }, /* R1800 - AIF1TX2MIX Input 1 Source */
1074 [0x0709] = 0x0080, /* R1801 - AIF1TX2MIX Input 1 Volume */ 991 { 0x0709, 0x0080 }, /* R1801 - AIF1TX2MIX Input 1 Volume */
1075 [0x070A] = 0x0000, /* R1802 - AIF1TX2MIX Input 2 Source */ 992 { 0x070A, 0x0000 }, /* R1802 - AIF1TX2MIX Input 2 Source */
1076 [0x070B] = 0x0080, /* R1803 - AIF1TX2MIX Input 2 Volume */ 993 { 0x070B, 0x0080 }, /* R1803 - AIF1TX2MIX Input 2 Volume */
1077 [0x070C] = 0x0000, /* R1804 - AIF1TX2MIX Input 3 Source */ 994 { 0x070C, 0x0000 }, /* R1804 - AIF1TX2MIX Input 3 Source */
1078 [0x070D] = 0x0080, /* R1805 - AIF1TX2MIX Input 3 Volume */ 995 { 0x070D, 0x0080 }, /* R1805 - AIF1TX2MIX Input 3 Volume */
1079 [0x070E] = 0x0000, /* R1806 - AIF1TX2MIX Input 4 Source */ 996 { 0x070E, 0x0000 }, /* R1806 - AIF1TX2MIX Input 4 Source */
1080 [0x070F] = 0x0080, /* R1807 - AIF1TX2MIX Input 4 Volume */ 997 { 0x070F, 0x0080 }, /* R1807 - AIF1TX2MIX Input 4 Volume */
1081 [0x0710] = 0x0000, /* R1808 - AIF1TX3MIX Input 1 Source */ 998 { 0x0710, 0x0000 }, /* R1808 - AIF1TX3MIX Input 1 Source */
1082 [0x0711] = 0x0080, /* R1809 - AIF1TX3MIX Input 1 Volume */ 999 { 0x0711, 0x0080 }, /* R1809 - AIF1TX3MIX Input 1 Volume */
1083 [0x0712] = 0x0000, /* R1810 - AIF1TX3MIX Input 2 Source */ 1000 { 0x0712, 0x0000 }, /* R1810 - AIF1TX3MIX Input 2 Source */
1084 [0x0713] = 0x0080, /* R1811 - AIF1TX3MIX Input 2 Volume */ 1001 { 0x0713, 0x0080 }, /* R1811 - AIF1TX3MIX Input 2 Volume */
1085 [0x0714] = 0x0000, /* R1812 - AIF1TX3MIX Input 3 Source */ 1002 { 0x0714, 0x0000 }, /* R1812 - AIF1TX3MIX Input 3 Source */
1086 [0x0715] = 0x0080, /* R1813 - AIF1TX3MIX Input 3 Volume */ 1003 { 0x0715, 0x0080 }, /* R1813 - AIF1TX3MIX Input 3 Volume */
1087 [0x0716] = 0x0000, /* R1814 - AIF1TX3MIX Input 4 Source */ 1004 { 0x0716, 0x0000 }, /* R1814 - AIF1TX3MIX Input 4 Source */
1088 [0x0717] = 0x0080, /* R1815 - AIF1TX3MIX Input 4 Volume */ 1005 { 0x0717, 0x0080 }, /* R1815 - AIF1TX3MIX Input 4 Volume */
1089 [0x0718] = 0x0000, /* R1816 - AIF1TX4MIX Input 1 Source */ 1006 { 0x0718, 0x0000 }, /* R1816 - AIF1TX4MIX Input 1 Source */
1090 [0x0719] = 0x0080, /* R1817 - AIF1TX4MIX Input 1 Volume */ 1007 { 0x0719, 0x0080 }, /* R1817 - AIF1TX4MIX Input 1 Volume */
1091 [0x071A] = 0x0000, /* R1818 - AIF1TX4MIX Input 2 Source */ 1008 { 0x071A, 0x0000 }, /* R1818 - AIF1TX4MIX Input 2 Source */
1092 [0x071B] = 0x0080, /* R1819 - AIF1TX4MIX Input 2 Volume */ 1009 { 0x071B, 0x0080 }, /* R1819 - AIF1TX4MIX Input 2 Volume */
1093 [0x071C] = 0x0000, /* R1820 - AIF1TX4MIX Input 3 Source */ 1010 { 0x071C, 0x0000 }, /* R1820 - AIF1TX4MIX Input 3 Source */
1094 [0x071D] = 0x0080, /* R1821 - AIF1TX4MIX Input 3 Volume */ 1011 { 0x071D, 0x0080 }, /* R1821 - AIF1TX4MIX Input 3 Volume */
1095 [0x071E] = 0x0000, /* R1822 - AIF1TX4MIX Input 4 Source */ 1012 { 0x071E, 0x0000 }, /* R1822 - AIF1TX4MIX Input 4 Source */
1096 [0x071F] = 0x0080, /* R1823 - AIF1TX4MIX Input 4 Volume */ 1013 { 0x071F, 0x0080 }, /* R1823 - AIF1TX4MIX Input 4 Volume */
1097 [0x0720] = 0x0000, /* R1824 - AIF1TX5MIX Input 1 Source */ 1014 { 0x0720, 0x0000 }, /* R1824 - AIF1TX5MIX Input 1 Source */
1098 [0x0721] = 0x0080, /* R1825 - AIF1TX5MIX Input 1 Volume */ 1015 { 0x0721, 0x0080 }, /* R1825 - AIF1TX5MIX Input 1 Volume */
1099 [0x0722] = 0x0000, /* R1826 - AIF1TX5MIX Input 2 Source */ 1016 { 0x0722, 0x0000 }, /* R1826 - AIF1TX5MIX Input 2 Source */
1100 [0x0723] = 0x0080, /* R1827 - AIF1TX5MIX Input 2 Volume */ 1017 { 0x0723, 0x0080 }, /* R1827 - AIF1TX5MIX Input 2 Volume */
1101 [0x0724] = 0x0000, /* R1828 - AIF1TX5MIX Input 3 Source */ 1018 { 0x0724, 0x0000 }, /* R1828 - AIF1TX5MIX Input 3 Source */
1102 [0x0725] = 0x0080, /* R1829 - AIF1TX5MIX Input 3 Volume */ 1019 { 0x0725, 0x0080 }, /* R1829 - AIF1TX5MIX Input 3 Volume */
1103 [0x0726] = 0x0000, /* R1830 - AIF1TX5MIX Input 4 Source */ 1020 { 0x0726, 0x0000 }, /* R1830 - AIF1TX5MIX Input 4 Source */
1104 [0x0727] = 0x0080, /* R1831 - AIF1TX5MIX Input 4 Volume */ 1021 { 0x0727, 0x0080 }, /* R1831 - AIF1TX5MIX Input 4 Volume */
1105 [0x0728] = 0x0000, /* R1832 - AIF1TX6MIX Input 1 Source */ 1022 { 0x0728, 0x0000 }, /* R1832 - AIF1TX6MIX Input 1 Source */
1106 [0x0729] = 0x0080, /* R1833 - AIF1TX6MIX Input 1 Volume */ 1023 { 0x0729, 0x0080 }, /* R1833 - AIF1TX6MIX Input 1 Volume */
1107 [0x072A] = 0x0000, /* R1834 - AIF1TX6MIX Input 2 Source */ 1024 { 0x072A, 0x0000 }, /* R1834 - AIF1TX6MIX Input 2 Source */
1108 [0x072B] = 0x0080, /* R1835 - AIF1TX6MIX Input 2 Volume */ 1025 { 0x072B, 0x0080 }, /* R1835 - AIF1TX6MIX Input 2 Volume */
1109 [0x072C] = 0x0000, /* R1836 - AIF1TX6MIX Input 3 Source */ 1026 { 0x072C, 0x0000 }, /* R1836 - AIF1TX6MIX Input 3 Source */
1110 [0x072D] = 0x0080, /* R1837 - AIF1TX6MIX Input 3 Volume */ 1027 { 0x072D, 0x0080 }, /* R1837 - AIF1TX6MIX Input 3 Volume */
1111 [0x072E] = 0x0000, /* R1838 - AIF1TX6MIX Input 4 Source */ 1028 { 0x072E, 0x0000 }, /* R1838 - AIF1TX6MIX Input 4 Source */
1112 [0x072F] = 0x0080, /* R1839 - AIF1TX6MIX Input 4 Volume */ 1029 { 0x072F, 0x0080 }, /* R1839 - AIF1TX6MIX Input 4 Volume */
1113 [0x0730] = 0x0000, /* R1840 - AIF1TX7MIX Input 1 Source */ 1030 { 0x0730, 0x0000 }, /* R1840 - AIF1TX7MIX Input 1 Source */
1114 [0x0731] = 0x0080, /* R1841 - AIF1TX7MIX Input 1 Volume */ 1031 { 0x0731, 0x0080 }, /* R1841 - AIF1TX7MIX Input 1 Volume */
1115 [0x0732] = 0x0000, /* R1842 - AIF1TX7MIX Input 2 Source */ 1032 { 0x0732, 0x0000 }, /* R1842 - AIF1TX7MIX Input 2 Source */
1116 [0x0733] = 0x0080, /* R1843 - AIF1TX7MIX Input 2 Volume */ 1033 { 0x0733, 0x0080 }, /* R1843 - AIF1TX7MIX Input 2 Volume */
1117 [0x0734] = 0x0000, /* R1844 - AIF1TX7MIX Input 3 Source */ 1034 { 0x0734, 0x0000 }, /* R1844 - AIF1TX7MIX Input 3 Source */
1118 [0x0735] = 0x0080, /* R1845 - AIF1TX7MIX Input 3 Volume */ 1035 { 0x0735, 0x0080 }, /* R1845 - AIF1TX7MIX Input 3 Volume */
1119 [0x0736] = 0x0000, /* R1846 - AIF1TX7MIX Input 4 Source */ 1036 { 0x0736, 0x0000 }, /* R1846 - AIF1TX7MIX Input 4 Source */
1120 [0x0737] = 0x0080, /* R1847 - AIF1TX7MIX Input 4 Volume */ 1037 { 0x0737, 0x0080 }, /* R1847 - AIF1TX7MIX Input 4 Volume */
1121 [0x0738] = 0x0000, /* R1848 - AIF1TX8MIX Input 1 Source */ 1038 { 0x0738, 0x0000 }, /* R1848 - AIF1TX8MIX Input 1 Source */
1122 [0x0739] = 0x0080, /* R1849 - AIF1TX8MIX Input 1 Volume */ 1039 { 0x0739, 0x0080 }, /* R1849 - AIF1TX8MIX Input 1 Volume */
1123 [0x073A] = 0x0000, /* R1850 - AIF1TX8MIX Input 2 Source */ 1040 { 0x073A, 0x0000 }, /* R1850 - AIF1TX8MIX Input 2 Source */
1124 [0x073B] = 0x0080, /* R1851 - AIF1TX8MIX Input 2 Volume */ 1041 { 0x073B, 0x0080 }, /* R1851 - AIF1TX8MIX Input 2 Volume */
1125 [0x073C] = 0x0000, /* R1852 - AIF1TX8MIX Input 3 Source */ 1042 { 0x073C, 0x0000 }, /* R1852 - AIF1TX8MIX Input 3 Source */
1126 [0x073D] = 0x0080, /* R1853 - AIF1TX8MIX Input 3 Volume */ 1043 { 0x073D, 0x0080 }, /* R1853 - AIF1TX8MIX Input 3 Volume */
1127 [0x073E] = 0x0000, /* R1854 - AIF1TX8MIX Input 4 Source */ 1044 { 0x073E, 0x0000 }, /* R1854 - AIF1TX8MIX Input 4 Source */
1128 [0x073F] = 0x0080, /* R1855 - AIF1TX8MIX Input 4 Volume */ 1045 { 0x073F, 0x0080 }, /* R1855 - AIF1TX8MIX Input 4 Volume */
1129 [0x0740] = 0x0000, /* R1856 - AIF2TX1MIX Input 1 Source */ 1046 { 0x0740, 0x0000 }, /* R1856 - AIF2TX1MIX Input 1 Source */
1130 [0x0741] = 0x0080, /* R1857 - AIF2TX1MIX Input 1 Volume */ 1047 { 0x0741, 0x0080 }, /* R1857 - AIF2TX1MIX Input 1 Volume */
1131 [0x0742] = 0x0000, /* R1858 - AIF2TX1MIX Input 2 Source */ 1048 { 0x0742, 0x0000 }, /* R1858 - AIF2TX1MIX Input 2 Source */
1132 [0x0743] = 0x0080, /* R1859 - AIF2TX1MIX Input 2 Volume */ 1049 { 0x0743, 0x0080 }, /* R1859 - AIF2TX1MIX Input 2 Volume */
1133 [0x0744] = 0x0000, /* R1860 - AIF2TX1MIX Input 3 Source */ 1050 { 0x0744, 0x0000 }, /* R1860 - AIF2TX1MIX Input 3 Source */
1134 [0x0745] = 0x0080, /* R1861 - AIF2TX1MIX Input 3 Volume */ 1051 { 0x0745, 0x0080 }, /* R1861 - AIF2TX1MIX Input 3 Volume */
1135 [0x0746] = 0x0000, /* R1862 - AIF2TX1MIX Input 4 Source */ 1052 { 0x0746, 0x0000 }, /* R1862 - AIF2TX1MIX Input 4 Source */
1136 [0x0747] = 0x0080, /* R1863 - AIF2TX1MIX Input 4 Volume */ 1053 { 0x0747, 0x0080 }, /* R1863 - AIF2TX1MIX Input 4 Volume */
1137 [0x0748] = 0x0000, /* R1864 - AIF2TX2MIX Input 1 Source */ 1054 { 0x0748, 0x0000 }, /* R1864 - AIF2TX2MIX Input 1 Source */
1138 [0x0749] = 0x0080, /* R1865 - AIF2TX2MIX Input 1 Volume */ 1055 { 0x0749, 0x0080 }, /* R1865 - AIF2TX2MIX Input 1 Volume */
1139 [0x074A] = 0x0000, /* R1866 - AIF2TX2MIX Input 2 Source */ 1056 { 0x074A, 0x0000 }, /* R1866 - AIF2TX2MIX Input 2 Source */
1140 [0x074B] = 0x0080, /* R1867 - AIF2TX2MIX Input 2 Volume */ 1057 { 0x074B, 0x0080 }, /* R1867 - AIF2TX2MIX Input 2 Volume */
1141 [0x074C] = 0x0000, /* R1868 - AIF2TX2MIX Input 3 Source */ 1058 { 0x074C, 0x0000 }, /* R1868 - AIF2TX2MIX Input 3 Source */
1142 [0x074D] = 0x0080, /* R1869 - AIF2TX2MIX Input 3 Volume */ 1059 { 0x074D, 0x0080 }, /* R1869 - AIF2TX2MIX Input 3 Volume */
1143 [0x074E] = 0x0000, /* R1870 - AIF2TX2MIX Input 4 Source */ 1060 { 0x074E, 0x0000 }, /* R1870 - AIF2TX2MIX Input 4 Source */
1144 [0x074F] = 0x0080, /* R1871 - AIF2TX2MIX Input 4 Volume */ 1061 { 0x074F, 0x0080 }, /* R1871 - AIF2TX2MIX Input 4 Volume */
1145 [0x0780] = 0x0000, /* R1920 - AIF3TX1MIX Input 1 Source */ 1062 { 0x0780, 0x0000 }, /* R1920 - AIF3TX1MIX Input 1 Source */
1146 [0x0781] = 0x0080, /* R1921 - AIF3TX1MIX Input 1 Volume */ 1063 { 0x0781, 0x0080 }, /* R1921 - AIF3TX1MIX Input 1 Volume */
1147 [0x0782] = 0x0000, /* R1922 - AIF3TX1MIX Input 2 Source */ 1064 { 0x0782, 0x0000 }, /* R1922 - AIF3TX1MIX Input 2 Source */
1148 [0x0783] = 0x0080, /* R1923 - AIF3TX1MIX Input 2 Volume */ 1065 { 0x0783, 0x0080 }, /* R1923 - AIF3TX1MIX Input 2 Volume */
1149 [0x0784] = 0x0000, /* R1924 - AIF3TX1MIX Input 3 Source */ 1066 { 0x0784, 0x0000 }, /* R1924 - AIF3TX1MIX Input 3 Source */
1150 [0x0785] = 0x0080, /* R1925 - AIF3TX1MIX Input 3 Volume */ 1067 { 0x0785, 0x0080 }, /* R1925 - AIF3TX1MIX Input 3 Volume */
1151 [0x0786] = 0x0000, /* R1926 - AIF3TX1MIX Input 4 Source */ 1068 { 0x0786, 0x0000 }, /* R1926 - AIF3TX1MIX Input 4 Source */
1152 [0x0787] = 0x0080, /* R1927 - AIF3TX1MIX Input 4 Volume */ 1069 { 0x0787, 0x0080 }, /* R1927 - AIF3TX1MIX Input 4 Volume */
1153 [0x0788] = 0x0000, /* R1928 - AIF3TX2MIX Input 1 Source */ 1070 { 0x0788, 0x0000 }, /* R1928 - AIF3TX2MIX Input 1 Source */
1154 [0x0789] = 0x0080, /* R1929 - AIF3TX2MIX Input 1 Volume */ 1071 { 0x0789, 0x0080 }, /* R1929 - AIF3TX2MIX Input 1 Volume */
1155 [0x078A] = 0x0000, /* R1930 - AIF3TX2MIX Input 2 Source */ 1072 { 0x078A, 0x0000 }, /* R1930 - AIF3TX2MIX Input 2 Source */
1156 [0x078B] = 0x0080, /* R1931 - AIF3TX2MIX Input 2 Volume */ 1073 { 0x078B, 0x0080 }, /* R1931 - AIF3TX2MIX Input 2 Volume */
1157 [0x078C] = 0x0000, /* R1932 - AIF3TX2MIX Input 3 Source */ 1074 { 0x078C, 0x0000 }, /* R1932 - AIF3TX2MIX Input 3 Source */
1158 [0x078D] = 0x0080, /* R1933 - AIF3TX2MIX Input 3 Volume */ 1075 { 0x078D, 0x0080 }, /* R1933 - AIF3TX2MIX Input 3 Volume */
1159 [0x078E] = 0x0000, /* R1934 - AIF3TX2MIX Input 4 Source */ 1076 { 0x078E, 0x0000 }, /* R1934 - AIF3TX2MIX Input 4 Source */
1160 [0x078F] = 0x0080, /* R1935 - AIF3TX2MIX Input 4 Volume */ 1077 { 0x078F, 0x0080 }, /* R1935 - AIF3TX2MIX Input 4 Volume */
1161 [0x0880] = 0x0000, /* R2176 - EQ1MIX Input 1 Source */ 1078 { 0x0880, 0x0000 }, /* R2176 - EQ1MIX Input 1 Source */
1162 [0x0881] = 0x0080, /* R2177 - EQ1MIX Input 1 Volume */ 1079 { 0x0881, 0x0080 }, /* R2177 - EQ1MIX Input 1 Volume */
1163 [0x0882] = 0x0000, /* R2178 - EQ1MIX Input 2 Source */ 1080 { 0x0882, 0x0000 }, /* R2178 - EQ1MIX Input 2 Source */
1164 [0x0883] = 0x0080, /* R2179 - EQ1MIX Input 2 Volume */ 1081 { 0x0883, 0x0080 }, /* R2179 - EQ1MIX Input 2 Volume */
1165 [0x0884] = 0x0000, /* R2180 - EQ1MIX Input 3 Source */ 1082 { 0x0884, 0x0000 }, /* R2180 - EQ1MIX Input 3 Source */
1166 [0x0885] = 0x0080, /* R2181 - EQ1MIX Input 3 Volume */ 1083 { 0x0885, 0x0080 }, /* R2181 - EQ1MIX Input 3 Volume */
1167 [0x0886] = 0x0000, /* R2182 - EQ1MIX Input 4 Source */ 1084 { 0x0886, 0x0000 }, /* R2182 - EQ1MIX Input 4 Source */
1168 [0x0887] = 0x0080, /* R2183 - EQ1MIX Input 4 Volume */ 1085 { 0x0887, 0x0080 }, /* R2183 - EQ1MIX Input 4 Volume */
1169 [0x0888] = 0x0000, /* R2184 - EQ2MIX Input 1 Source */ 1086 { 0x0888, 0x0000 }, /* R2184 - EQ2MIX Input 1 Source */
1170 [0x0889] = 0x0080, /* R2185 - EQ2MIX Input 1 Volume */ 1087 { 0x0889, 0x0080 }, /* R2185 - EQ2MIX Input 1 Volume */
1171 [0x088A] = 0x0000, /* R2186 - EQ2MIX Input 2 Source */ 1088 { 0x088A, 0x0000 }, /* R2186 - EQ2MIX Input 2 Source */
1172 [0x088B] = 0x0080, /* R2187 - EQ2MIX Input 2 Volume */ 1089 { 0x088B, 0x0080 }, /* R2187 - EQ2MIX Input 2 Volume */
1173 [0x088C] = 0x0000, /* R2188 - EQ2MIX Input 3 Source */ 1090 { 0x088C, 0x0000 }, /* R2188 - EQ2MIX Input 3 Source */
1174 [0x088D] = 0x0080, /* R2189 - EQ2MIX Input 3 Volume */ 1091 { 0x088D, 0x0080 }, /* R2189 - EQ2MIX Input 3 Volume */
1175 [0x088E] = 0x0000, /* R2190 - EQ2MIX Input 4 Source */ 1092 { 0x088E, 0x0000 }, /* R2190 - EQ2MIX Input 4 Source */
1176 [0x088F] = 0x0080, /* R2191 - EQ2MIX Input 4 Volume */ 1093 { 0x088F, 0x0080 }, /* R2191 - EQ2MIX Input 4 Volume */
1177 [0x0890] = 0x0000, /* R2192 - EQ3MIX Input 1 Source */ 1094 { 0x0890, 0x0000 }, /* R2192 - EQ3MIX Input 1 Source */
1178 [0x0891] = 0x0080, /* R2193 - EQ3MIX Input 1 Volume */ 1095 { 0x0891, 0x0080 }, /* R2193 - EQ3MIX Input 1 Volume */
1179 [0x0892] = 0x0000, /* R2194 - EQ3MIX Input 2 Source */ 1096 { 0x0892, 0x0000 }, /* R2194 - EQ3MIX Input 2 Source */
1180 [0x0893] = 0x0080, /* R2195 - EQ3MIX Input 2 Volume */ 1097 { 0x0893, 0x0080 }, /* R2195 - EQ3MIX Input 2 Volume */
1181 [0x0894] = 0x0000, /* R2196 - EQ3MIX Input 3 Source */ 1098 { 0x0894, 0x0000 }, /* R2196 - EQ3MIX Input 3 Source */
1182 [0x0895] = 0x0080, /* R2197 - EQ3MIX Input 3 Volume */ 1099 { 0x0895, 0x0080 }, /* R2197 - EQ3MIX Input 3 Volume */
1183 [0x0896] = 0x0000, /* R2198 - EQ3MIX Input 4 Source */ 1100 { 0x0896, 0x0000 }, /* R2198 - EQ3MIX Input 4 Source */
1184 [0x0897] = 0x0080, /* R2199 - EQ3MIX Input 4 Volume */ 1101 { 0x0897, 0x0080 }, /* R2199 - EQ3MIX Input 4 Volume */
1185 [0x0898] = 0x0000, /* R2200 - EQ4MIX Input 1 Source */ 1102 { 0x0898, 0x0000 }, /* R2200 - EQ4MIX Input 1 Source */
1186 [0x0899] = 0x0080, /* R2201 - EQ4MIX Input 1 Volume */ 1103 { 0x0899, 0x0080 }, /* R2201 - EQ4MIX Input 1 Volume */
1187 [0x089A] = 0x0000, /* R2202 - EQ4MIX Input 2 Source */ 1104 { 0x089A, 0x0000 }, /* R2202 - EQ4MIX Input 2 Source */
1188 [0x089B] = 0x0080, /* R2203 - EQ4MIX Input 2 Volume */ 1105 { 0x089B, 0x0080 }, /* R2203 - EQ4MIX Input 2 Volume */
1189 [0x089C] = 0x0000, /* R2204 - EQ4MIX Input 3 Source */ 1106 { 0x089C, 0x0000 }, /* R2204 - EQ4MIX Input 3 Source */
1190 [0x089D] = 0x0080, /* R2205 - EQ4MIX Input 3 Volume */ 1107 { 0x089D, 0x0080 }, /* R2205 - EQ4MIX Input 3 Volume */
1191 [0x089E] = 0x0000, /* R2206 - EQ4MIX Input 4 Source */ 1108 { 0x089E, 0x0000 }, /* R2206 - EQ4MIX Input 4 Source */
1192 [0x089F] = 0x0080, /* R2207 - EQ4MIX Input 4 Volume */ 1109 { 0x089F, 0x0080 }, /* R2207 - EQ4MIX Input 4 Volume */
1193 [0x08C0] = 0x0000, /* R2240 - DRC1LMIX Input 1 Source */ 1110 { 0x08C0, 0x0000 }, /* R2240 - DRC1LMIX Input 1 Source */
1194 [0x08C1] = 0x0080, /* R2241 - DRC1LMIX Input 1 Volume */ 1111 { 0x08C1, 0x0080 }, /* R2241 - DRC1LMIX Input 1 Volume */
1195 [0x08C2] = 0x0000, /* R2242 - DRC1LMIX Input 2 Source */ 1112 { 0x08C2, 0x0000 }, /* R2242 - DRC1LMIX Input 2 Source */
1196 [0x08C3] = 0x0080, /* R2243 - DRC1LMIX Input 2 Volume */ 1113 { 0x08C3, 0x0080 }, /* R2243 - DRC1LMIX Input 2 Volume */
1197 [0x08C4] = 0x0000, /* R2244 - DRC1LMIX Input 3 Source */ 1114 { 0x08C4, 0x0000 }, /* R2244 - DRC1LMIX Input 3 Source */
1198 [0x08C5] = 0x0080, /* R2245 - DRC1LMIX Input 3 Volume */ 1115 { 0x08C5, 0x0080 }, /* R2245 - DRC1LMIX Input 3 Volume */
1199 [0x08C6] = 0x0000, /* R2246 - DRC1LMIX Input 4 Source */ 1116 { 0x08C6, 0x0000 }, /* R2246 - DRC1LMIX Input 4 Source */
1200 [0x08C7] = 0x0080, /* R2247 - DRC1LMIX Input 4 Volume */ 1117 { 0x08C7, 0x0080 }, /* R2247 - DRC1LMIX Input 4 Volume */
1201 [0x08C8] = 0x0000, /* R2248 - DRC1RMIX Input 1 Source */ 1118 { 0x08C8, 0x0000 }, /* R2248 - DRC1RMIX Input 1 Source */
1202 [0x08C9] = 0x0080, /* R2249 - DRC1RMIX Input 1 Volume */ 1119 { 0x08C9, 0x0080 }, /* R2249 - DRC1RMIX Input 1 Volume */
1203 [0x08CA] = 0x0000, /* R2250 - DRC1RMIX Input 2 Source */ 1120 { 0x08CA, 0x0000 }, /* R2250 - DRC1RMIX Input 2 Source */
1204 [0x08CB] = 0x0080, /* R2251 - DRC1RMIX Input 2 Volume */ 1121 { 0x08CB, 0x0080 }, /* R2251 - DRC1RMIX Input 2 Volume */
1205 [0x08CC] = 0x0000, /* R2252 - DRC1RMIX Input 3 Source */ 1122 { 0x08CC, 0x0000 }, /* R2252 - DRC1RMIX Input 3 Source */
1206 [0x08CD] = 0x0080, /* R2253 - DRC1RMIX Input 3 Volume */ 1123 { 0x08CD, 0x0080 }, /* R2253 - DRC1RMIX Input 3 Volume */
1207 [0x08CE] = 0x0000, /* R2254 - DRC1RMIX Input 4 Source */ 1124 { 0x08CE, 0x0000 }, /* R2254 - DRC1RMIX Input 4 Source */
1208 [0x08CF] = 0x0080, /* R2255 - DRC1RMIX Input 4 Volume */ 1125 { 0x08CF, 0x0080 }, /* R2255 - DRC1RMIX Input 4 Volume */
1209 [0x0900] = 0x0000, /* R2304 - HPLP1MIX Input 1 Source */ 1126 { 0x0900, 0x0000 }, /* R2304 - HPLP1MIX Input 1 Source */
1210 [0x0901] = 0x0080, /* R2305 - HPLP1MIX Input 1 Volume */ 1127 { 0x0901, 0x0080 }, /* R2305 - HPLP1MIX Input 1 Volume */
1211 [0x0902] = 0x0000, /* R2306 - HPLP1MIX Input 2 Source */ 1128 { 0x0902, 0x0000 }, /* R2306 - HPLP1MIX Input 2 Source */
1212 [0x0903] = 0x0080, /* R2307 - HPLP1MIX Input 2 Volume */ 1129 { 0x0903, 0x0080 }, /* R2307 - HPLP1MIX Input 2 Volume */
1213 [0x0904] = 0x0000, /* R2308 - HPLP1MIX Input 3 Source */ 1130 { 0x0904, 0x0000 }, /* R2308 - HPLP1MIX Input 3 Source */
1214 [0x0905] = 0x0080, /* R2309 - HPLP1MIX Input 3 Volume */ 1131 { 0x0905, 0x0080 }, /* R2309 - HPLP1MIX Input 3 Volume */
1215 [0x0906] = 0x0000, /* R2310 - HPLP1MIX Input 4 Source */ 1132 { 0x0906, 0x0000 }, /* R2310 - HPLP1MIX Input 4 Source */
1216 [0x0907] = 0x0080, /* R2311 - HPLP1MIX Input 4 Volume */ 1133 { 0x0907, 0x0080 }, /* R2311 - HPLP1MIX Input 4 Volume */
1217 [0x0908] = 0x0000, /* R2312 - HPLP2MIX Input 1 Source */ 1134 { 0x0908, 0x0000 }, /* R2312 - HPLP2MIX Input 1 Source */
1218 [0x0909] = 0x0080, /* R2313 - HPLP2MIX Input 1 Volume */ 1135 { 0x0909, 0x0080 }, /* R2313 - HPLP2MIX Input 1 Volume */
1219 [0x090A] = 0x0000, /* R2314 - HPLP2MIX Input 2 Source */ 1136 { 0x090A, 0x0000 }, /* R2314 - HPLP2MIX Input 2 Source */
1220 [0x090B] = 0x0080, /* R2315 - HPLP2MIX Input 2 Volume */ 1137 { 0x090B, 0x0080 }, /* R2315 - HPLP2MIX Input 2 Volume */
1221 [0x090C] = 0x0000, /* R2316 - HPLP2MIX Input 3 Source */ 1138 { 0x090C, 0x0000 }, /* R2316 - HPLP2MIX Input 3 Source */
1222 [0x090D] = 0x0080, /* R2317 - HPLP2MIX Input 3 Volume */ 1139 { 0x090D, 0x0080 }, /* R2317 - HPLP2MIX Input 3 Volume */
1223 [0x090E] = 0x0000, /* R2318 - HPLP2MIX Input 4 Source */ 1140 { 0x090E, 0x0000 }, /* R2318 - HPLP2MIX Input 4 Source */
1224 [0x090F] = 0x0080, /* R2319 - HPLP2MIX Input 4 Volume */ 1141 { 0x090F, 0x0080 }, /* R2319 - HPLP2MIX Input 4 Volume */
1225 [0x0910] = 0x0000, /* R2320 - HPLP3MIX Input 1 Source */ 1142 { 0x0910, 0x0000 }, /* R2320 - HPLP3MIX Input 1 Source */
1226 [0x0911] = 0x0080, /* R2321 - HPLP3MIX Input 1 Volume */ 1143 { 0x0911, 0x0080 }, /* R2321 - HPLP3MIX Input 1 Volume */
1227 [0x0912] = 0x0000, /* R2322 - HPLP3MIX Input 2 Source */ 1144 { 0x0912, 0x0000 }, /* R2322 - HPLP3MIX Input 2 Source */
1228 [0x0913] = 0x0080, /* R2323 - HPLP3MIX Input 2 Volume */ 1145 { 0x0913, 0x0080 }, /* R2323 - HPLP3MIX Input 2 Volume */
1229 [0x0914] = 0x0000, /* R2324 - HPLP3MIX Input 3 Source */ 1146 { 0x0914, 0x0000 }, /* R2324 - HPLP3MIX Input 3 Source */
1230 [0x0915] = 0x0080, /* R2325 - HPLP3MIX Input 3 Volume */ 1147 { 0x0915, 0x0080 }, /* R2325 - HPLP3MIX Input 3 Volume */
1231 [0x0916] = 0x0000, /* R2326 - HPLP3MIX Input 4 Source */ 1148 { 0x0916, 0x0000 }, /* R2326 - HPLP3MIX Input 4 Source */
1232 [0x0917] = 0x0080, /* R2327 - HPLP3MIX Input 4 Volume */ 1149 { 0x0917, 0x0080 }, /* R2327 - HPLP3MIX Input 4 Volume */
1233 [0x0918] = 0x0000, /* R2328 - HPLP4MIX Input 1 Source */ 1150 { 0x0918, 0x0000 }, /* R2328 - HPLP4MIX Input 1 Source */
1234 [0x0919] = 0x0080, /* R2329 - HPLP4MIX Input 1 Volume */ 1151 { 0x0919, 0x0080 }, /* R2329 - HPLP4MIX Input 1 Volume */
1235 [0x091A] = 0x0000, /* R2330 - HPLP4MIX Input 2 Source */ 1152 { 0x091A, 0x0000 }, /* R2330 - HPLP4MIX Input 2 Source */
1236 [0x091B] = 0x0080, /* R2331 - HPLP4MIX Input 2 Volume */ 1153 { 0x091B, 0x0080 }, /* R2331 - HPLP4MIX Input 2 Volume */
1237 [0x091C] = 0x0000, /* R2332 - HPLP4MIX Input 3 Source */ 1154 { 0x091C, 0x0000 }, /* R2332 - HPLP4MIX Input 3 Source */
1238 [0x091D] = 0x0080, /* R2333 - HPLP4MIX Input 3 Volume */ 1155 { 0x091D, 0x0080 }, /* R2333 - HPLP4MIX Input 3 Volume */
1239 [0x091E] = 0x0000, /* R2334 - HPLP4MIX Input 4 Source */ 1156 { 0x091E, 0x0000 }, /* R2334 - HPLP4MIX Input 4 Source */
1240 [0x091F] = 0x0080, /* R2335 - HPLP4MIX Input 4 Volume */ 1157 { 0x091F, 0x0080 }, /* R2335 - HPLP4MIX Input 4 Volume */
1241 [0x0940] = 0x0000, /* R2368 - DSP1LMIX Input 1 Source */ 1158 { 0x0940, 0x0000 }, /* R2368 - DSP1LMIX Input 1 Source */
1242 [0x0941] = 0x0080, /* R2369 - DSP1LMIX Input 1 Volume */ 1159 { 0x0941, 0x0080 }, /* R2369 - DSP1LMIX Input 1 Volume */
1243 [0x0942] = 0x0000, /* R2370 - DSP1LMIX Input 2 Source */ 1160 { 0x0942, 0x0000 }, /* R2370 - DSP1LMIX Input 2 Source */
1244 [0x0943] = 0x0080, /* R2371 - DSP1LMIX Input 2 Volume */ 1161 { 0x0943, 0x0080 }, /* R2371 - DSP1LMIX Input 2 Volume */
1245 [0x0944] = 0x0000, /* R2372 - DSP1LMIX Input 3 Source */ 1162 { 0x0944, 0x0000 }, /* R2372 - DSP1LMIX Input 3 Source */
1246 [0x0945] = 0x0080, /* R2373 - DSP1LMIX Input 3 Volume */ 1163 { 0x0945, 0x0080 }, /* R2373 - DSP1LMIX Input 3 Volume */
1247 [0x0946] = 0x0000, /* R2374 - DSP1LMIX Input 4 Source */ 1164 { 0x0946, 0x0000 }, /* R2374 - DSP1LMIX Input 4 Source */
1248 [0x0947] = 0x0080, /* R2375 - DSP1LMIX Input 4 Volume */ 1165 { 0x0947, 0x0080 }, /* R2375 - DSP1LMIX Input 4 Volume */
1249 [0x0948] = 0x0000, /* R2376 - DSP1RMIX Input 1 Source */ 1166 { 0x0948, 0x0000 }, /* R2376 - DSP1RMIX Input 1 Source */
1250 [0x0949] = 0x0080, /* R2377 - DSP1RMIX Input 1 Volume */ 1167 { 0x0949, 0x0080 }, /* R2377 - DSP1RMIX Input 1 Volume */
1251 [0x094A] = 0x0000, /* R2378 - DSP1RMIX Input 2 Source */ 1168 { 0x094A, 0x0000 }, /* R2378 - DSP1RMIX Input 2 Source */
1252 [0x094B] = 0x0080, /* R2379 - DSP1RMIX Input 2 Volume */ 1169 { 0x094B, 0x0080 }, /* R2379 - DSP1RMIX Input 2 Volume */
1253 [0x094C] = 0x0000, /* R2380 - DSP1RMIX Input 3 Source */ 1170 { 0x094C, 0x0000 }, /* R2380 - DSP1RMIX Input 3 Source */
1254 [0x094D] = 0x0080, /* R2381 - DSP1RMIX Input 3 Volume */ 1171 { 0x094D, 0x0080 }, /* R2381 - DSP1RMIX Input 3 Volume */
1255 [0x094E] = 0x0000, /* R2382 - DSP1RMIX Input 4 Source */ 1172 { 0x094E, 0x0000 }, /* R2382 - DSP1RMIX Input 4 Source */
1256 [0x094F] = 0x0080, /* R2383 - DSP1RMIX Input 4 Volume */ 1173 { 0x094F, 0x0080 }, /* R2383 - DSP1RMIX Input 4 Volume */
1257 [0x0950] = 0x0000, /* R2384 - DSP1AUX1MIX Input 1 Source */ 1174 { 0x0950, 0x0000 }, /* R2384 - DSP1AUX1MIX Input 1 Source */
1258 [0x0958] = 0x0000, /* R2392 - DSP1AUX2MIX Input 1 Source */ 1175 { 0x0958, 0x0000 }, /* R2392 - DSP1AUX2MIX Input 1 Source */
1259 [0x0960] = 0x0000, /* R2400 - DSP1AUX3MIX Input 1 Source */ 1176 { 0x0960, 0x0000 }, /* R2400 - DSP1AUX3MIX Input 1 Source */
1260 [0x0968] = 0x0000, /* R2408 - DSP1AUX4MIX Input 1 Source */ 1177 { 0x0968, 0x0000 }, /* R2408 - DSP1AUX4MIX Input 1 Source */
1261 [0x0970] = 0x0000, /* R2416 - DSP1AUX5MIX Input 1 Source */ 1178 { 0x0970, 0x0000 }, /* R2416 - DSP1AUX5MIX Input 1 Source */
1262 [0x0978] = 0x0000, /* R2424 - DSP1AUX6MIX Input 1 Source */ 1179 { 0x0978, 0x0000 }, /* R2424 - DSP1AUX6MIX Input 1 Source */
1263 [0x0980] = 0x0000, /* R2432 - DSP2LMIX Input 1 Source */ 1180 { 0x0980, 0x0000 }, /* R2432 - DSP2LMIX Input 1 Source */
1264 [0x0981] = 0x0080, /* R2433 - DSP2LMIX Input 1 Volume */ 1181 { 0x0981, 0x0080 }, /* R2433 - DSP2LMIX Input 1 Volume */
1265 [0x0982] = 0x0000, /* R2434 - DSP2LMIX Input 2 Source */ 1182 { 0x0982, 0x0000 }, /* R2434 - DSP2LMIX Input 2 Source */
1266 [0x0983] = 0x0080, /* R2435 - DSP2LMIX Input 2 Volume */ 1183 { 0x0983, 0x0080 }, /* R2435 - DSP2LMIX Input 2 Volume */
1267 [0x0984] = 0x0000, /* R2436 - DSP2LMIX Input 3 Source */ 1184 { 0x0984, 0x0000 }, /* R2436 - DSP2LMIX Input 3 Source */
1268 [0x0985] = 0x0080, /* R2437 - DSP2LMIX Input 3 Volume */ 1185 { 0x0985, 0x0080 }, /* R2437 - DSP2LMIX Input 3 Volume */
1269 [0x0986] = 0x0000, /* R2438 - DSP2LMIX Input 4 Source */ 1186 { 0x0986, 0x0000 }, /* R2438 - DSP2LMIX Input 4 Source */
1270 [0x0987] = 0x0080, /* R2439 - DSP2LMIX Input 4 Volume */ 1187 { 0x0987, 0x0080 }, /* R2439 - DSP2LMIX Input 4 Volume */
1271 [0x0988] = 0x0000, /* R2440 - DSP2RMIX Input 1 Source */ 1188 { 0x0988, 0x0000 }, /* R2440 - DSP2RMIX Input 1 Source */
1272 [0x0989] = 0x0080, /* R2441 - DSP2RMIX Input 1 Volume */ 1189 { 0x0989, 0x0080 }, /* R2441 - DSP2RMIX Input 1 Volume */
1273 [0x098A] = 0x0000, /* R2442 - DSP2RMIX Input 2 Source */ 1190 { 0x098A, 0x0000 }, /* R2442 - DSP2RMIX Input 2 Source */
1274 [0x098B] = 0x0080, /* R2443 - DSP2RMIX Input 2 Volume */ 1191 { 0x098B, 0x0080 }, /* R2443 - DSP2RMIX Input 2 Volume */
1275 [0x098C] = 0x0000, /* R2444 - DSP2RMIX Input 3 Source */ 1192 { 0x098C, 0x0000 }, /* R2444 - DSP2RMIX Input 3 Source */
1276 [0x098D] = 0x0080, /* R2445 - DSP2RMIX Input 3 Volume */ 1193 { 0x098D, 0x0080 }, /* R2445 - DSP2RMIX Input 3 Volume */
1277 [0x098E] = 0x0000, /* R2446 - DSP2RMIX Input 4 Source */ 1194 { 0x098E, 0x0000 }, /* R2446 - DSP2RMIX Input 4 Source */
1278 [0x098F] = 0x0080, /* R2447 - DSP2RMIX Input 4 Volume */ 1195 { 0x098F, 0x0080 }, /* R2447 - DSP2RMIX Input 4 Volume */
1279 [0x0990] = 0x0000, /* R2448 - DSP2AUX1MIX Input 1 Source */ 1196 { 0x0990, 0x0000 }, /* R2448 - DSP2AUX1MIX Input 1 Source */
1280 [0x0998] = 0x0000, /* R2456 - DSP2AUX2MIX Input 1 Source */ 1197 { 0x0998, 0x0000 }, /* R2456 - DSP2AUX2MIX Input 1 Source */
1281 [0x09A0] = 0x0000, /* R2464 - DSP2AUX3MIX Input 1 Source */ 1198 { 0x09A0, 0x0000 }, /* R2464 - DSP2AUX3MIX Input 1 Source */
1282 [0x09A8] = 0x0000, /* R2472 - DSP2AUX4MIX Input 1 Source */ 1199 { 0x09A8, 0x0000 }, /* R2472 - DSP2AUX4MIX Input 1 Source */
1283 [0x09B0] = 0x0000, /* R2480 - DSP2AUX5MIX Input 1 Source */ 1200 { 0x09B0, 0x0000 }, /* R2480 - DSP2AUX5MIX Input 1 Source */
1284 [0x09B8] = 0x0000, /* R2488 - DSP2AUX6MIX Input 1 Source */ 1201 { 0x09B8, 0x0000 }, /* R2488 - DSP2AUX6MIX Input 1 Source */
1285 [0x09C0] = 0x0000, /* R2496 - DSP3LMIX Input 1 Source */ 1202 { 0x09C0, 0x0000 }, /* R2496 - DSP3LMIX Input 1 Source */
1286 [0x09C1] = 0x0080, /* R2497 - DSP3LMIX Input 1 Volume */ 1203 { 0x09C1, 0x0080 }, /* R2497 - DSP3LMIX Input 1 Volume */
1287 [0x09C2] = 0x0000, /* R2498 - DSP3LMIX Input 2 Source */ 1204 { 0x09C2, 0x0000 }, /* R2498 - DSP3LMIX Input 2 Source */
1288 [0x09C3] = 0x0080, /* R2499 - DSP3LMIX Input 2 Volume */ 1205 { 0x09C3, 0x0080 }, /* R2499 - DSP3LMIX Input 2 Volume */
1289 [0x09C4] = 0x0000, /* R2500 - DSP3LMIX Input 3 Source */ 1206 { 0x09C4, 0x0000 }, /* R2500 - DSP3LMIX Input 3 Source */
1290 [0x09C5] = 0x0080, /* R2501 - DSP3LMIX Input 3 Volume */ 1207 { 0x09C5, 0x0080 }, /* R2501 - DSP3LMIX Input 3 Volume */
1291 [0x09C6] = 0x0000, /* R2502 - DSP3LMIX Input 4 Source */ 1208 { 0x09C6, 0x0000 }, /* R2502 - DSP3LMIX Input 4 Source */
1292 [0x09C7] = 0x0080, /* R2503 - DSP3LMIX Input 4 Volume */ 1209 { 0x09C7, 0x0080 }, /* R2503 - DSP3LMIX Input 4 Volume */
1293 [0x09C8] = 0x0000, /* R2504 - DSP3RMIX Input 1 Source */ 1210 { 0x09C8, 0x0000 }, /* R2504 - DSP3RMIX Input 1 Source */
1294 [0x09C9] = 0x0080, /* R2505 - DSP3RMIX Input 1 Volume */ 1211 { 0x09C9, 0x0080 }, /* R2505 - DSP3RMIX Input 1 Volume */
1295 [0x09CA] = 0x0000, /* R2506 - DSP3RMIX Input 2 Source */ 1212 { 0x09CA, 0x0000 }, /* R2506 - DSP3RMIX Input 2 Source */
1296 [0x09CB] = 0x0080, /* R2507 - DSP3RMIX Input 2 Volume */ 1213 { 0x09CB, 0x0080 }, /* R2507 - DSP3RMIX Input 2 Volume */
1297 [0x09CC] = 0x0000, /* R2508 - DSP3RMIX Input 3 Source */ 1214 { 0x09CC, 0x0000 }, /* R2508 - DSP3RMIX Input 3 Source */
1298 [0x09CD] = 0x0080, /* R2509 - DSP3RMIX Input 3 Volume */ 1215 { 0x09CD, 0x0080 }, /* R2509 - DSP3RMIX Input 3 Volume */
1299 [0x09CE] = 0x0000, /* R2510 - DSP3RMIX Input 4 Source */ 1216 { 0x09CE, 0x0000 }, /* R2510 - DSP3RMIX Input 4 Source */
1300 [0x09CF] = 0x0080, /* R2511 - DSP3RMIX Input 4 Volume */ 1217 { 0x09CF, 0x0080 }, /* R2511 - DSP3RMIX Input 4 Volume */
1301 [0x09D0] = 0x0000, /* R2512 - DSP3AUX1MIX Input 1 Source */ 1218 { 0x09D0, 0x0000 }, /* R2512 - DSP3AUX1MIX Input 1 Source */
1302 [0x09D8] = 0x0000, /* R2520 - DSP3AUX2MIX Input 1 Source */ 1219 { 0x09D8, 0x0000 }, /* R2520 - DSP3AUX2MIX Input 1 Source */
1303 [0x09E0] = 0x0000, /* R2528 - DSP3AUX3MIX Input 1 Source */ 1220 { 0x09E0, 0x0000 }, /* R2528 - DSP3AUX3MIX Input 1 Source */
1304 [0x09E8] = 0x0000, /* R2536 - DSP3AUX4MIX Input 1 Source */ 1221 { 0x09E8, 0x0000 }, /* R2536 - DSP3AUX4MIX Input 1 Source */
1305 [0x09F0] = 0x0000, /* R2544 - DSP3AUX5MIX Input 1 Source */ 1222 { 0x09F0, 0x0000 }, /* R2544 - DSP3AUX5MIX Input 1 Source */
1306 [0x09F8] = 0x0000, /* R2552 - DSP3AUX6MIX Input 1 Source */ 1223 { 0x09F8, 0x0000 }, /* R2552 - DSP3AUX6MIX Input 1 Source */
1307 [0x0A80] = 0x0000, /* R2688 - ASRC1LMIX Input 1 Source */ 1224 { 0x0A80, 0x0000 }, /* R2688 - ASRC1LMIX Input 1 Source */
1308 [0x0A88] = 0x0000, /* R2696 - ASRC1RMIX Input 1 Source */ 1225 { 0x0A88, 0x0000 }, /* R2696 - ASRC1RMIX Input 1 Source */
1309 [0x0A90] = 0x0000, /* R2704 - ASRC2LMIX Input 1 Source */ 1226 { 0x0A90, 0x0000 }, /* R2704 - ASRC2LMIX Input 1 Source */
1310 [0x0A98] = 0x0000, /* R2712 - ASRC2RMIX Input 1 Source */ 1227 { 0x0A98, 0x0000 }, /* R2712 - ASRC2RMIX Input 1 Source */
1311 [0x0B00] = 0x0000, /* R2816 - ISRC1DEC1MIX Input 1 Source */ 1228 { 0x0B00, 0x0000 }, /* R2816 - ISRC1DEC1MIX Input 1 Source */
1312 [0x0B08] = 0x0000, /* R2824 - ISRC1DEC2MIX Input 1 Source */ 1229 { 0x0B08, 0x0000 }, /* R2824 - ISRC1DEC2MIX Input 1 Source */
1313 [0x0B10] = 0x0000, /* R2832 - ISRC1DEC3MIX Input 1 Source */ 1230 { 0x0B10, 0x0000 }, /* R2832 - ISRC1DEC3MIX Input 1 Source */
1314 [0x0B18] = 0x0000, /* R2840 - ISRC1DEC4MIX Input 1 Source */ 1231 { 0x0B18, 0x0000 }, /* R2840 - ISRC1DEC4MIX Input 1 Source */
1315 [0x0B20] = 0x0000, /* R2848 - ISRC1INT1MIX Input 1 Source */ 1232 { 0x0B20, 0x0000 }, /* R2848 - ISRC1INT1MIX Input 1 Source */
1316 [0x0B28] = 0x0000, /* R2856 - ISRC1INT2MIX Input 1 Source */ 1233 { 0x0B28, 0x0000 }, /* R2856 - ISRC1INT2MIX Input 1 Source */
1317 [0x0B30] = 0x0000, /* R2864 - ISRC1INT3MIX Input 1 Source */ 1234 { 0x0B30, 0x0000 }, /* R2864 - ISRC1INT3MIX Input 1 Source */
1318 [0x0B38] = 0x0000, /* R2872 - ISRC1INT4MIX Input 1 Source */ 1235 { 0x0B38, 0x0000 }, /* R2872 - ISRC1INT4MIX Input 1 Source */
1319 [0x0B40] = 0x0000, /* R2880 - ISRC2DEC1MIX Input 1 Source */ 1236 { 0x0B40, 0x0000 }, /* R2880 - ISRC2DEC1MIX Input 1 Source */
1320 [0x0B48] = 0x0000, /* R2888 - ISRC2DEC2MIX Input 1 Source */ 1237 { 0x0B48, 0x0000 }, /* R2888 - ISRC2DEC2MIX Input 1 Source */
1321 [0x0B50] = 0x0000, /* R2896 - ISRC2DEC3MIX Input 1 Source */ 1238 { 0x0B50, 0x0000 }, /* R2896 - ISRC2DEC3MIX Input 1 Source */
1322 [0x0B58] = 0x0000, /* R2904 - ISRC2DEC4MIX Input 1 Source */ 1239 { 0x0B58, 0x0000 }, /* R2904 - ISRC2DEC4MIX Input 1 Source */
1323 [0x0B60] = 0x0000, /* R2912 - ISRC2INT1MIX Input 1 Source */ 1240 { 0x0B60, 0x0000 }, /* R2912 - ISRC2INT1MIX Input 1 Source */
1324 [0x0B68] = 0x0000, /* R2920 - ISRC2INT2MIX Input 1 Source */ 1241 { 0x0B68, 0x0000 }, /* R2920 - ISRC2INT2MIX Input 1 Source */
1325 [0x0B70] = 0x0000, /* R2928 - ISRC2INT3MIX Input 1 Source */ 1242 { 0x0B70, 0x0000 }, /* R2928 - ISRC2INT3MIX Input 1 Source */
1326 [0x0B78] = 0x0000, /* R2936 - ISRC2INT4MIX Input 1 Source */ 1243 { 0x0B78, 0x0000 }, /* R2936 - ISRC2INT4MIX Input 1 Source */
1327 [0x0C00] = 0xA001, /* R3072 - GPIO CTRL 1 */ 1244 { 0x0C00, 0xA001 }, /* R3072 - GPIO CTRL 1 */
1328 [0x0C01] = 0xA001, /* R3073 - GPIO CTRL 2 */ 1245 { 0x0C01, 0xA001 }, /* R3073 - GPIO CTRL 2 */
1329 [0x0C02] = 0xA001, /* R3074 - GPIO CTRL 3 */ 1246 { 0x0C02, 0xA001 }, /* R3074 - GPIO CTRL 3 */
1330 [0x0C03] = 0xA001, /* R3075 - GPIO CTRL 4 */ 1247 { 0x0C03, 0xA001 }, /* R3075 - GPIO CTRL 4 */
1331 [0x0C04] = 0xA001, /* R3076 - GPIO CTRL 5 */ 1248 { 0x0C04, 0xA001 }, /* R3076 - GPIO CTRL 5 */
1332 [0x0C05] = 0xA001, /* R3077 - GPIO CTRL 6 */ 1249 { 0x0C05, 0xA001 }, /* R3077 - GPIO CTRL 6 */
1333 [0x0C23] = 0x4003, /* R3107 - Misc Pad Ctrl 1 */ 1250 { 0x0C23, 0x4003 }, /* R3107 - Misc Pad Ctrl 1 */
1334 [0x0C24] = 0x0000, /* R3108 - Misc Pad Ctrl 2 */ 1251 { 0x0C24, 0x0000 }, /* R3108 - Misc Pad Ctrl 2 */
1335 [0x0C25] = 0x0000, /* R3109 - Misc Pad Ctrl 3 */ 1252 { 0x0C25, 0x0000 }, /* R3109 - Misc Pad Ctrl 3 */
1336 [0x0C26] = 0x0000, /* R3110 - Misc Pad Ctrl 4 */ 1253 { 0x0C26, 0x0000 }, /* R3110 - Misc Pad Ctrl 4 */
1337 [0x0C27] = 0x0000, /* R3111 - Misc Pad Ctrl 5 */ 1254 { 0x0C27, 0x0000 }, /* R3111 - Misc Pad Ctrl 5 */
1338 [0x0C28] = 0x0000, /* R3112 - Misc GPIO 1 */ 1255 { 0x0C28, 0x0000 }, /* R3112 - Misc GPIO 1 */
1339 [0x0D00] = 0x0000, /* R3328 - Interrupt Status 1 */ 1256 { 0x0D00, 0x0000 }, /* R3328 - Interrupt Status 1 */
1340 [0x0D01] = 0x0000, /* R3329 - Interrupt Status 2 */ 1257 { 0x0D01, 0x0000 }, /* R3329 - Interrupt Status 2 */
1341 [0x0D02] = 0x0000, /* R3330 - Interrupt Status 3 */ 1258 { 0x0D02, 0x0000 }, /* R3330 - Interrupt Status 3 */
1342 [0x0D03] = 0x0000, /* R3331 - Interrupt Status 4 */ 1259 { 0x0D03, 0x0000 }, /* R3331 - Interrupt Status 4 */
1343 [0x0D04] = 0x0000, /* R3332 - Interrupt Raw Status 2 */ 1260 { 0x0D04, 0x0000 }, /* R3332 - Interrupt Raw Status 2 */
1344 [0x0D05] = 0x0000, /* R3333 - Interrupt Raw Status 3 */ 1261 { 0x0D05, 0x0000 }, /* R3333 - Interrupt Raw Status 3 */
1345 [0x0D06] = 0x0000, /* R3334 - Interrupt Raw Status 4 */ 1262 { 0x0D06, 0x0000 }, /* R3334 - Interrupt Raw Status 4 */
1346 [0x0D07] = 0xFFFF, /* R3335 - Interrupt Status 1 Mask */ 1263 { 0x0D07, 0xFFFF }, /* R3335 - Interrupt Status 1 Mask */
1347 [0x0D08] = 0xFFFF, /* R3336 - Interrupt Status 2 Mask */ 1264 { 0x0D08, 0xFFFF }, /* R3336 - Interrupt Status 2 Mask */
1348 [0x0D09] = 0xFFFF, /* R3337 - Interrupt Status 3 Mask */ 1265 { 0x0D09, 0xFFFF }, /* R3337 - Interrupt Status 3 Mask */
1349 [0x0D0A] = 0xFFFF, /* R3338 - Interrupt Status 4 Mask */ 1266 { 0x0D0A, 0xFFFF }, /* R3338 - Interrupt Status 4 Mask */
1350 [0x0D1F] = 0x0000, /* R3359 - Interrupt Control */ 1267 { 0x0D1F, 0x0000 }, /* R3359 - Interrupt Control */
1351 [0x0D20] = 0xFFFF, /* R3360 - IRQ Debounce 1 */ 1268 { 0x0D20, 0xFFFF }, /* R3360 - IRQ Debounce 1 */
1352 [0x0D21] = 0xFFFF, /* R3361 - IRQ Debounce 2 */ 1269 { 0x0D21, 0xFFFF }, /* R3361 - IRQ Debounce 2 */
1353 [0x0E00] = 0x0000, /* R3584 - FX_Ctrl */ 1270 { 0x0E00, 0x0000 }, /* R3584 - FX_Ctrl */
1354 [0x0E10] = 0x6318, /* R3600 - EQ1_1 */ 1271 { 0x0E10, 0x6318 }, /* R3600 - EQ1_1 */
1355 [0x0E11] = 0x6300, /* R3601 - EQ1_2 */ 1272 { 0x0E11, 0x6300 }, /* R3601 - EQ1_2 */
1356 [0x0E12] = 0x0FC8, /* R3602 - EQ1_3 */ 1273 { 0x0E12, 0x0FC8 }, /* R3602 - EQ1_3 */
1357 [0x0E13] = 0x03FE, /* R3603 - EQ1_4 */ 1274 { 0x0E13, 0x03FE }, /* R3603 - EQ1_4 */
1358 [0x0E14] = 0x00E0, /* R3604 - EQ1_5 */ 1275 { 0x0E14, 0x00E0 }, /* R3604 - EQ1_5 */
1359 [0x0E15] = 0x1EC4, /* R3605 - EQ1_6 */ 1276 { 0x0E15, 0x1EC4 }, /* R3605 - EQ1_6 */
1360 [0x0E16] = 0xF136, /* R3606 - EQ1_7 */ 1277 { 0x0E16, 0xF136 }, /* R3606 - EQ1_7 */
1361 [0x0E17] = 0x0409, /* R3607 - EQ1_8 */ 1278 { 0x0E17, 0x0409 }, /* R3607 - EQ1_8 */
1362 [0x0E18] = 0x04CC, /* R3608 - EQ1_9 */ 1279 { 0x0E18, 0x04CC }, /* R3608 - EQ1_9 */
1363 [0x0E19] = 0x1C9B, /* R3609 - EQ1_10 */ 1280 { 0x0E19, 0x1C9B }, /* R3609 - EQ1_10 */
1364 [0x0E1A] = 0xF337, /* R3610 - EQ1_11 */ 1281 { 0x0E1A, 0xF337 }, /* R3610 - EQ1_11 */
1365 [0x0E1B] = 0x040B, /* R3611 - EQ1_12 */ 1282 { 0x0E1B, 0x040B }, /* R3611 - EQ1_12 */
1366 [0x0E1C] = 0x0CBB, /* R3612 - EQ1_13 */ 1283 { 0x0E1C, 0x0CBB }, /* R3612 - EQ1_13 */
1367 [0x0E1D] = 0x16F8, /* R3613 - EQ1_14 */ 1284 { 0x0E1D, 0x16F8 }, /* R3613 - EQ1_14 */
1368 [0x0E1E] = 0xF7D9, /* R3614 - EQ1_15 */ 1285 { 0x0E1E, 0xF7D9 }, /* R3614 - EQ1_15 */
1369 [0x0E1F] = 0x040A, /* R3615 - EQ1_16 */ 1286 { 0x0E1F, 0x040A }, /* R3615 - EQ1_16 */
1370 [0x0E20] = 0x1F14, /* R3616 - EQ1_17 */ 1287 { 0x0E20, 0x1F14 }, /* R3616 - EQ1_17 */
1371 [0x0E21] = 0x058C, /* R3617 - EQ1_18 */ 1288 { 0x0E21, 0x058C }, /* R3617 - EQ1_18 */
1372 [0x0E22] = 0x0563, /* R3618 - EQ1_19 */ 1289 { 0x0E22, 0x0563 }, /* R3618 - EQ1_19 */
1373 [0x0E23] = 0x4000, /* R3619 - EQ1_20 */ 1290 { 0x0E23, 0x4000 }, /* R3619 - EQ1_20 */
1374 [0x0E26] = 0x6318, /* R3622 - EQ2_1 */ 1291 { 0x0E26, 0x6318 }, /* R3622 - EQ2_1 */
1375 [0x0E27] = 0x6300, /* R3623 - EQ2_2 */ 1292 { 0x0E27, 0x6300 }, /* R3623 - EQ2_2 */
1376 [0x0E28] = 0x0FC8, /* R3624 - EQ2_3 */ 1293 { 0x0E28, 0x0FC8 }, /* R3624 - EQ2_3 */
1377 [0x0E29] = 0x03FE, /* R3625 - EQ2_4 */ 1294 { 0x0E29, 0x03FE }, /* R3625 - EQ2_4 */
1378 [0x0E2A] = 0x00E0, /* R3626 - EQ2_5 */ 1295 { 0x0E2A, 0x00E0 }, /* R3626 - EQ2_5 */
1379 [0x0E2B] = 0x1EC4, /* R3627 - EQ2_6 */ 1296 { 0x0E2B, 0x1EC4 }, /* R3627 - EQ2_6 */
1380 [0x0E2C] = 0xF136, /* R3628 - EQ2_7 */ 1297 { 0x0E2C, 0xF136 }, /* R3628 - EQ2_7 */
1381 [0x0E2D] = 0x0409, /* R3629 - EQ2_8 */ 1298 { 0x0E2D, 0x0409 }, /* R3629 - EQ2_8 */
1382 [0x0E2E] = 0x04CC, /* R3630 - EQ2_9 */ 1299 { 0x0E2E, 0x04CC }, /* R3630 - EQ2_9 */
1383 [0x0E2F] = 0x1C9B, /* R3631 - EQ2_10 */ 1300 { 0x0E2F, 0x1C9B }, /* R3631 - EQ2_10 */
1384 [0x0E30] = 0xF337, /* R3632 - EQ2_11 */ 1301 { 0x0E30, 0xF337 }, /* R3632 - EQ2_11 */
1385 [0x0E31] = 0x040B, /* R3633 - EQ2_12 */ 1302 { 0x0E31, 0x040B }, /* R3633 - EQ2_12 */
1386 [0x0E32] = 0x0CBB, /* R3634 - EQ2_13 */ 1303 { 0x0E32, 0x0CBB }, /* R3634 - EQ2_13 */
1387 [0x0E33] = 0x16F8, /* R3635 - EQ2_14 */ 1304 { 0x0E33, 0x16F8 }, /* R3635 - EQ2_14 */
1388 [0x0E34] = 0xF7D9, /* R3636 - EQ2_15 */ 1305 { 0x0E34, 0xF7D9 }, /* R3636 - EQ2_15 */
1389 [0x0E35] = 0x040A, /* R3637 - EQ2_16 */ 1306 { 0x0E35, 0x040A }, /* R3637 - EQ2_16 */
1390 [0x0E36] = 0x1F14, /* R3638 - EQ2_17 */ 1307 { 0x0E36, 0x1F14 }, /* R3638 - EQ2_17 */
1391 [0x0E37] = 0x058C, /* R3639 - EQ2_18 */ 1308 { 0x0E37, 0x058C }, /* R3639 - EQ2_18 */
1392 [0x0E38] = 0x0563, /* R3640 - EQ2_19 */ 1309 { 0x0E38, 0x0563 }, /* R3640 - EQ2_19 */
1393 [0x0E39] = 0x4000, /* R3641 - EQ2_20 */ 1310 { 0x0E39, 0x4000 }, /* R3641 - EQ2_20 */
1394 [0x0E3C] = 0x6318, /* R3644 - EQ3_1 */ 1311 { 0x0E3C, 0x6318 }, /* R3644 - EQ3_1 */
1395 [0x0E3D] = 0x6300, /* R3645 - EQ3_2 */ 1312 { 0x0E3D, 0x6300 }, /* R3645 - EQ3_2 */
1396 [0x0E3E] = 0x0FC8, /* R3646 - EQ3_3 */ 1313 { 0x0E3E, 0x0FC8 }, /* R3646 - EQ3_3 */
1397 [0x0E3F] = 0x03FE, /* R3647 - EQ3_4 */ 1314 { 0x0E3F, 0x03FE }, /* R3647 - EQ3_4 */
1398 [0x0E40] = 0x00E0, /* R3648 - EQ3_5 */ 1315 { 0x0E40, 0x00E0 }, /* R3648 - EQ3_5 */
1399 [0x0E41] = 0x1EC4, /* R3649 - EQ3_6 */ 1316 { 0x0E41, 0x1EC4 }, /* R3649 - EQ3_6 */
1400 [0x0E42] = 0xF136, /* R3650 - EQ3_7 */ 1317 { 0x0E42, 0xF136 }, /* R3650 - EQ3_7 */
1401 [0x0E43] = 0x0409, /* R3651 - EQ3_8 */ 1318 { 0x0E43, 0x0409 }, /* R3651 - EQ3_8 */
1402 [0x0E44] = 0x04CC, /* R3652 - EQ3_9 */ 1319 { 0x0E44, 0x04CC }, /* R3652 - EQ3_9 */
1403 [0x0E45] = 0x1C9B, /* R3653 - EQ3_10 */ 1320 { 0x0E45, 0x1C9B }, /* R3653 - EQ3_10 */
1404 [0x0E46] = 0xF337, /* R3654 - EQ3_11 */ 1321 { 0x0E46, 0xF337 }, /* R3654 - EQ3_11 */
1405 [0x0E47] = 0x040B, /* R3655 - EQ3_12 */ 1322 { 0x0E47, 0x040B }, /* R3655 - EQ3_12 */
1406 [0x0E48] = 0x0CBB, /* R3656 - EQ3_13 */ 1323 { 0x0E48, 0x0CBB }, /* R3656 - EQ3_13 */
1407 [0x0E49] = 0x16F8, /* R3657 - EQ3_14 */ 1324 { 0x0E49, 0x16F8 }, /* R3657 - EQ3_14 */
1408 [0x0E4A] = 0xF7D9, /* R3658 - EQ3_15 */ 1325 { 0x0E4A, 0xF7D9 }, /* R3658 - EQ3_15 */
1409 [0x0E4B] = 0x040A, /* R3659 - EQ3_16 */ 1326 { 0x0E4B, 0x040A }, /* R3659 - EQ3_16 */
1410 [0x0E4C] = 0x1F14, /* R3660 - EQ3_17 */ 1327 { 0x0E4C, 0x1F14 }, /* R3660 - EQ3_17 */
1411 [0x0E4D] = 0x058C, /* R3661 - EQ3_18 */ 1328 { 0x0E4D, 0x058C }, /* R3661 - EQ3_18 */
1412 [0x0E4E] = 0x0563, /* R3662 - EQ3_19 */ 1329 { 0x0E4E, 0x0563 }, /* R3662 - EQ3_19 */
1413 [0x0E4F] = 0x4000, /* R3663 - EQ3_20 */ 1330 { 0x0E4F, 0x4000 }, /* R3663 - EQ3_20 */
1414 [0x0E52] = 0x6318, /* R3666 - EQ4_1 */ 1331 { 0x0E52, 0x6318 }, /* R3666 - EQ4_1 */
1415 [0x0E53] = 0x6300, /* R3667 - EQ4_2 */ 1332 { 0x0E53, 0x6300 }, /* R3667 - EQ4_2 */
1416 [0x0E54] = 0x0FC8, /* R3668 - EQ4_3 */ 1333 { 0x0E54, 0x0FC8 }, /* R3668 - EQ4_3 */
1417 [0x0E55] = 0x03FE, /* R3669 - EQ4_4 */ 1334 { 0x0E55, 0x03FE }, /* R3669 - EQ4_4 */
1418 [0x0E56] = 0x00E0, /* R3670 - EQ4_5 */ 1335 { 0x0E56, 0x00E0 }, /* R3670 - EQ4_5 */
1419 [0x0E57] = 0x1EC4, /* R3671 - EQ4_6 */ 1336 { 0x0E57, 0x1EC4 }, /* R3671 - EQ4_6 */
1420 [0x0E58] = 0xF136, /* R3672 - EQ4_7 */ 1337 { 0x0E58, 0xF136 }, /* R3672 - EQ4_7 */
1421 [0x0E59] = 0x0409, /* R3673 - EQ4_8 */ 1338 { 0x0E59, 0x0409 }, /* R3673 - EQ4_8 */
1422 [0x0E5A] = 0x04CC, /* R3674 - EQ4_9 */ 1339 { 0x0E5A, 0x04CC }, /* R3674 - EQ4_9 */
1423 [0x0E5B] = 0x1C9B, /* R3675 - EQ4_10 */ 1340 { 0x0E5B, 0x1C9B }, /* R3675 - EQ4_10 */
1424 [0x0E5C] = 0xF337, /* R3676 - EQ4_11 */ 1341 { 0x0E5C, 0xF337 }, /* R3676 - EQ4_11 */
1425 [0x0E5D] = 0x040B, /* R3677 - EQ4_12 */ 1342 { 0x0E5D, 0x040B }, /* R3677 - EQ4_12 */
1426 [0x0E5E] = 0x0CBB, /* R3678 - EQ4_13 */ 1343 { 0x0E5E, 0x0CBB }, /* R3678 - EQ4_13 */
1427 [0x0E5F] = 0x16F8, /* R3679 - EQ4_14 */ 1344 { 0x0E5F, 0x16F8 }, /* R3679 - EQ4_14 */
1428 [0x0E60] = 0xF7D9, /* R3680 - EQ4_15 */ 1345 { 0x0E60, 0xF7D9 }, /* R3680 - EQ4_15 */
1429 [0x0E61] = 0x040A, /* R3681 - EQ4_16 */ 1346 { 0x0E61, 0x040A }, /* R3681 - EQ4_16 */
1430 [0x0E62] = 0x1F14, /* R3682 - EQ4_17 */ 1347 { 0x0E62, 0x1F14 }, /* R3682 - EQ4_17 */
1431 [0x0E63] = 0x058C, /* R3683 - EQ4_18 */ 1348 { 0x0E63, 0x058C }, /* R3683 - EQ4_18 */
1432 [0x0E64] = 0x0563, /* R3684 - EQ4_19 */ 1349 { 0x0E64, 0x0563 }, /* R3684 - EQ4_19 */
1433 [0x0E65] = 0x4000, /* R3685 - EQ4_20 */ 1350 { 0x0E65, 0x4000 }, /* R3685 - EQ4_20 */
1434 [0x0E80] = 0x0018, /* R3712 - DRC1 ctrl1 */ 1351 { 0x0E80, 0x0018 }, /* R3712 - DRC1 ctrl1 */
1435 [0x0E81] = 0x0933, /* R3713 - DRC1 ctrl2 */ 1352 { 0x0E81, 0x0933 }, /* R3713 - DRC1 ctrl2 */
1436 [0x0E82] = 0x0018, /* R3714 - DRC1 ctrl3 */ 1353 { 0x0E82, 0x0018 }, /* R3714 - DRC1 ctrl3 */
1437 [0x0E83] = 0x0000, /* R3715 - DRC1 ctrl4 */ 1354 { 0x0E83, 0x0000 }, /* R3715 - DRC1 ctrl4 */
1438 [0x0E84] = 0x0000, /* R3716 - DRC1 ctrl5 */ 1355 { 0x0E84, 0x0000 }, /* R3716 - DRC1 ctrl5 */
1439 [0x0EC0] = 0x0000, /* R3776 - HPLPF1_1 */ 1356 { 0x0EC0, 0x0000 }, /* R3776 - HPLPF1_1 */
1440 [0x0EC1] = 0x0000, /* R3777 - HPLPF1_2 */ 1357 { 0x0EC1, 0x0000 }, /* R3777 - HPLPF1_2 */
1441 [0x0EC4] = 0x0000, /* R3780 - HPLPF2_1 */ 1358 { 0x0EC4, 0x0000 }, /* R3780 - HPLPF2_1 */
1442 [0x0EC5] = 0x0000, /* R3781 - HPLPF2_2 */ 1359 { 0x0EC5, 0x0000 }, /* R3781 - HPLPF2_2 */
1443 [0x0EC8] = 0x0000, /* R3784 - HPLPF3_1 */ 1360 { 0x0EC8, 0x0000 }, /* R3784 - HPLPF3_1 */
1444 [0x0EC9] = 0x0000, /* R3785 - HPLPF3_2 */ 1361 { 0x0EC9, 0x0000 }, /* R3785 - HPLPF3_2 */
1445 [0x0ECC] = 0x0000, /* R3788 - HPLPF4_1 */ 1362 { 0x0ECC, 0x0000 }, /* R3788 - HPLPF4_1 */
1446 [0x0ECD] = 0x0000, /* R3789 - HPLPF4_2 */ 1363 { 0x0ECD, 0x0000 }, /* R3789 - HPLPF4_2 */
1447 [0x4000] = 0x0000, /* R16384 - DSP1 DM 0 */
1448 [0x4001] = 0x0000, /* R16385 - DSP1 DM 1 */
1449 [0x4002] = 0x0000, /* R16386 - DSP1 DM 2 */
1450 [0x4003] = 0x0000, /* R16387 - DSP1 DM 3 */
1451 [0x41FC] = 0x0000, /* R16892 - DSP1 DM 508 */
1452 [0x41FD] = 0x0000, /* R16893 - DSP1 DM 509 */
1453 [0x41FE] = 0x0000, /* R16894 - DSP1 DM 510 */
1454 [0x41FF] = 0x0000, /* R16895 - DSP1 DM 511 */
1455 [0x4800] = 0x0000, /* R18432 - DSP1 PM 0 */
1456 [0x4801] = 0x0000, /* R18433 - DSP1 PM 1 */
1457 [0x4802] = 0x0000, /* R18434 - DSP1 PM 2 */
1458 [0x4803] = 0x0000, /* R18435 - DSP1 PM 3 */
1459 [0x4804] = 0x0000, /* R18436 - DSP1 PM 4 */
1460 [0x4805] = 0x0000, /* R18437 - DSP1 PM 5 */
1461 [0x4DFA] = 0x0000, /* R19962 - DSP1 PM 1530 */
1462 [0x4DFB] = 0x0000, /* R19963 - DSP1 PM 1531 */
1463 [0x4DFC] = 0x0000, /* R19964 - DSP1 PM 1532 */
1464 [0x4DFD] = 0x0000, /* R19965 - DSP1 PM 1533 */
1465 [0x4DFE] = 0x0000, /* R19966 - DSP1 PM 1534 */
1466 [0x4DFF] = 0x0000, /* R19967 - DSP1 PM 1535 */
1467 [0x5000] = 0x0000, /* R20480 - DSP1 ZM 0 */
1468 [0x5001] = 0x0000, /* R20481 - DSP1 ZM 1 */
1469 [0x5002] = 0x0000, /* R20482 - DSP1 ZM 2 */
1470 [0x5003] = 0x0000, /* R20483 - DSP1 ZM 3 */
1471 [0x57FC] = 0x0000, /* R22524 - DSP1 ZM 2044 */
1472 [0x57FD] = 0x0000, /* R22525 - DSP1 ZM 2045 */
1473 [0x57FE] = 0x0000, /* R22526 - DSP1 ZM 2046 */
1474 [0x57FF] = 0x0000, /* R22527 - DSP1 ZM 2047 */
1475 [0x6000] = 0x0000, /* R24576 - DSP2 DM 0 */
1476 [0x6001] = 0x0000, /* R24577 - DSP2 DM 1 */
1477 [0x6002] = 0x0000, /* R24578 - DSP2 DM 2 */
1478 [0x6003] = 0x0000, /* R24579 - DSP2 DM 3 */
1479 [0x61FC] = 0x0000, /* R25084 - DSP2 DM 508 */
1480 [0x61FD] = 0x0000, /* R25085 - DSP2 DM 509 */
1481 [0x61FE] = 0x0000, /* R25086 - DSP2 DM 510 */
1482 [0x61FF] = 0x0000, /* R25087 - DSP2 DM 511 */
1483 [0x6800] = 0x0000, /* R26624 - DSP2 PM 0 */
1484 [0x6801] = 0x0000, /* R26625 - DSP2 PM 1 */
1485 [0x6802] = 0x0000, /* R26626 - DSP2 PM 2 */
1486 [0x6803] = 0x0000, /* R26627 - DSP2 PM 3 */
1487 [0x6804] = 0x0000, /* R26628 - DSP2 PM 4 */
1488 [0x6805] = 0x0000, /* R26629 - DSP2 PM 5 */
1489 [0x6DFA] = 0x0000, /* R28154 - DSP2 PM 1530 */
1490 [0x6DFB] = 0x0000, /* R28155 - DSP2 PM 1531 */
1491 [0x6DFC] = 0x0000, /* R28156 - DSP2 PM 1532 */
1492 [0x6DFD] = 0x0000, /* R28157 - DSP2 PM 1533 */
1493 [0x6DFE] = 0x0000, /* R28158 - DSP2 PM 1534 */
1494 [0x6DFF] = 0x0000, /* R28159 - DSP2 PM 1535 */
1495 [0x7000] = 0x0000, /* R28672 - DSP2 ZM 0 */
1496 [0x7001] = 0x0000, /* R28673 - DSP2 ZM 1 */
1497 [0x7002] = 0x0000, /* R28674 - DSP2 ZM 2 */
1498 [0x7003] = 0x0000, /* R28675 - DSP2 ZM 3 */
1499 [0x77FC] = 0x0000, /* R30716 - DSP2 ZM 2044 */
1500 [0x77FD] = 0x0000, /* R30717 - DSP2 ZM 2045 */
1501 [0x77FE] = 0x0000, /* R30718 - DSP2 ZM 2046 */
1502 [0x77FF] = 0x0000, /* R30719 - DSP2 ZM 2047 */
1503 [0x8000] = 0x0000, /* R32768 - DSP3 DM 0 */
1504 [0x8001] = 0x0000, /* R32769 - DSP3 DM 1 */
1505 [0x8002] = 0x0000, /* R32770 - DSP3 DM 2 */
1506 [0x8003] = 0x0000, /* R32771 - DSP3 DM 3 */
1507 [0x81FC] = 0x0000, /* R33276 - DSP3 DM 508 */
1508 [0x81FD] = 0x0000, /* R33277 - DSP3 DM 509 */
1509 [0x81FE] = 0x0000, /* R33278 - DSP3 DM 510 */
1510 [0x81FF] = 0x0000, /* R33279 - DSP3 DM 511 */
1511 [0x8800] = 0x0000, /* R34816 - DSP3 PM 0 */
1512 [0x8801] = 0x0000, /* R34817 - DSP3 PM 1 */
1513 [0x8802] = 0x0000, /* R34818 - DSP3 PM 2 */
1514 [0x8803] = 0x0000, /* R34819 - DSP3 PM 3 */
1515 [0x8804] = 0x0000, /* R34820 - DSP3 PM 4 */
1516 [0x8805] = 0x0000, /* R34821 - DSP3 PM 5 */
1517 [0x8DFA] = 0x0000, /* R36346 - DSP3 PM 1530 */
1518 [0x8DFB] = 0x0000, /* R36347 - DSP3 PM 1531 */
1519 [0x8DFC] = 0x0000, /* R36348 - DSP3 PM 1532 */
1520 [0x8DFD] = 0x0000, /* R36349 - DSP3 PM 1533 */
1521 [0x8DFE] = 0x0000, /* R36350 - DSP3 PM 1534 */
1522 [0x8DFF] = 0x0000, /* R36351 - DSP3 PM 1535 */
1523 [0x9000] = 0x0000, /* R36864 - DSP3 ZM 0 */
1524 [0x9001] = 0x0000, /* R36865 - DSP3 ZM 1 */
1525 [0x9002] = 0x0000, /* R36866 - DSP3 ZM 2 */
1526 [0x9003] = 0x0000, /* R36867 - DSP3 ZM 3 */
1527 [0x97FC] = 0x0000, /* R38908 - DSP3 ZM 2044 */
1528 [0x97FD] = 0x0000, /* R38909 - DSP3 ZM 2045 */
1529 [0x97FE] = 0x0000, /* R38910 - DSP3 ZM 2046 */
1530 [0x97FF] = 0x0000 /* R38911 - DSP3 ZM 2047 */
1531}; 1364};
diff --git a/sound/soc/codecs/wm5100.c b/sound/soc/codecs/wm5100.c
index 42d9039a49e..8b24323d6b2 100644
--- a/sound/soc/codecs/wm5100.c
+++ b/sound/soc/codecs/wm5100.c
@@ -18,7 +18,6 @@
18#include <linux/gcd.h> 18#include <linux/gcd.h>
19#include <linux/gpio.h> 19#include <linux/gpio.h>
20#include <linux/i2c.h> 20#include <linux/i2c.h>
21#include <linux/platform_device.h>
22#include <linux/regulator/consumer.h> 21#include <linux/regulator/consumer.h>
23#include <linux/regulator/fixed.h> 22#include <linux/regulator/fixed.h>
24#include <linux/slab.h> 23#include <linux/slab.h>
@@ -51,6 +50,7 @@ struct wm5100_fll {
51 50
52/* codec private data */ 51/* codec private data */
53struct wm5100_priv { 52struct wm5100_priv {
53 struct regmap *regmap;
54 struct snd_soc_codec *codec; 54 struct snd_soc_codec *codec;
55 55
56 struct regulator_bulk_data core_supplies[WM5100_NUM_CORE_SUPPLIES]; 56 struct regulator_bulk_data core_supplies[WM5100_NUM_CORE_SUPPLIES];
@@ -204,17 +204,15 @@ static void wm5100_free_sr(struct snd_soc_codec *codec, int rate)
204 } 204 }
205} 205}
206 206
207static int wm5100_reset(struct snd_soc_codec *codec) 207static int wm5100_reset(struct wm5100_priv *wm5100)
208{ 208{
209 struct wm5100_priv *wm5100 = snd_soc_codec_get_drvdata(codec);
210
211 if (wm5100->pdata.reset) { 209 if (wm5100->pdata.reset) {
212 gpio_set_value_cansleep(wm5100->pdata.reset, 0); 210 gpio_set_value_cansleep(wm5100->pdata.reset, 0);
213 gpio_set_value_cansleep(wm5100->pdata.reset, 1); 211 gpio_set_value_cansleep(wm5100->pdata.reset, 1);
214 212
215 return 0; 213 return 0;
216 } else { 214 } else {
217 return snd_soc_write(codec, WM5100_SOFTWARE_RESET, 0); 215 return regmap_write(wm5100->regmap, WM5100_SOFTWARE_RESET, 0);
218 } 216 }
219} 217}
220 218
@@ -954,7 +952,7 @@ SND_SOC_DAPM_INPUT("IN3L"),
954SND_SOC_DAPM_INPUT("IN3R"), 952SND_SOC_DAPM_INPUT("IN3R"),
955SND_SOC_DAPM_INPUT("IN4L"), 953SND_SOC_DAPM_INPUT("IN4L"),
956SND_SOC_DAPM_INPUT("IN4R"), 954SND_SOC_DAPM_INPUT("IN4R"),
957SND_SOC_DAPM_INPUT("TONE"), 955SND_SOC_DAPM_SIGGEN("TONE"),
958 956
959SND_SOC_DAPM_PGA_E("IN1L PGA", WM5100_INPUT_ENABLES, WM5100_IN1L_ENA_SHIFT, 0, 957SND_SOC_DAPM_PGA_E("IN1L PGA", WM5100_INPUT_ENABLES, WM5100_IN1L_ENA_SHIFT, 0,
960 NULL, 0, wm5100_out_ev, SND_SOC_DAPM_POST_PMU), 958 NULL, 0, wm5100_out_ev, SND_SOC_DAPM_POST_PMU),
@@ -1375,7 +1373,7 @@ static int wm5100_set_bias_level(struct snd_soc_codec *codec,
1375 msleep(2); 1373 msleep(2);
1376 } 1374 }
1377 1375
1378 codec->cache_only = false; 1376 regcache_cache_only(wm5100->regmap, false);
1379 1377
1380 switch (wm5100->rev) { 1378 switch (wm5100->rev) {
1381 case 0: 1379 case 0:
@@ -1399,7 +1397,7 @@ static int wm5100_set_bias_level(struct snd_soc_codec *codec,
1399 break; 1397 break;
1400 } 1398 }
1401 1399
1402 snd_soc_cache_sync(codec); 1400 regcache_sync(wm5100->regmap);
1403 } 1401 }
1404 break; 1402 break;
1405 1403
@@ -1662,7 +1660,7 @@ static int wm5100_hw_params(struct snd_pcm_substream *substream,
1662 return 0; 1660 return 0;
1663} 1661}
1664 1662
1665static struct snd_soc_dai_ops wm5100_dai_ops = { 1663static const struct snd_soc_dai_ops wm5100_dai_ops = {
1666 .set_fmt = wm5100_set_fmt, 1664 .set_fmt = wm5100_set_fmt,
1667 .hw_params = wm5100_hw_params, 1665 .hw_params = wm5100_hw_params,
1668}; 1666};
@@ -1993,6 +1991,9 @@ static int wm5100_set_fll(struct snd_soc_codec *codec, int fll_id, int source,
1993 else 1991 else
1994 timeout = 50; 1992 timeout = 50;
1995 1993
1994 snd_soc_update_bits(codec, WM5100_CLOCKING_3, WM5100_SYSCLK_ENA,
1995 WM5100_SYSCLK_ENA);
1996
1996 /* Poll for the lock; will use interrupt when we can test */ 1997 /* Poll for the lock; will use interrupt when we can test */
1997 for (i = 0; i < timeout; i++) { 1998 for (i = 0; i < timeout; i++) {
1998 if (i2c->irq) { 1999 if (i2c->irq) {
@@ -2350,24 +2351,22 @@ static inline struct wm5100_priv *gpio_to_wm5100(struct gpio_chip *chip)
2350static void wm5100_gpio_set(struct gpio_chip *chip, unsigned offset, int value) 2351static void wm5100_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
2351{ 2352{
2352 struct wm5100_priv *wm5100 = gpio_to_wm5100(chip); 2353 struct wm5100_priv *wm5100 = gpio_to_wm5100(chip);
2353 struct snd_soc_codec *codec = wm5100->codec;
2354 2354
2355 snd_soc_update_bits(codec, WM5100_GPIO_CTRL_1 + offset, 2355 regmap_update_bits(wm5100->regmap, WM5100_GPIO_CTRL_1 + offset,
2356 WM5100_GP1_LVL, !!value << WM5100_GP1_LVL_SHIFT); 2356 WM5100_GP1_LVL, !!value << WM5100_GP1_LVL_SHIFT);
2357} 2357}
2358 2358
2359static int wm5100_gpio_direction_out(struct gpio_chip *chip, 2359static int wm5100_gpio_direction_out(struct gpio_chip *chip,
2360 unsigned offset, int value) 2360 unsigned offset, int value)
2361{ 2361{
2362 struct wm5100_priv *wm5100 = gpio_to_wm5100(chip); 2362 struct wm5100_priv *wm5100 = gpio_to_wm5100(chip);
2363 struct snd_soc_codec *codec = wm5100->codec;
2364 int val, ret; 2363 int val, ret;
2365 2364
2366 val = (1 << WM5100_GP1_FN_SHIFT) | (!!value << WM5100_GP1_LVL_SHIFT); 2365 val = (1 << WM5100_GP1_FN_SHIFT) | (!!value << WM5100_GP1_LVL_SHIFT);
2367 2366
2368 ret = snd_soc_update_bits(codec, WM5100_GPIO_CTRL_1 + offset, 2367 ret = regmap_update_bits(wm5100->regmap, WM5100_GPIO_CTRL_1 + offset,
2369 WM5100_GP1_FN_MASK | WM5100_GP1_DIR | 2368 WM5100_GP1_FN_MASK | WM5100_GP1_DIR |
2370 WM5100_GP1_LVL, val); 2369 WM5100_GP1_LVL, val);
2371 if (ret < 0) 2370 if (ret < 0)
2372 return ret; 2371 return ret;
2373 else 2372 else
@@ -2377,25 +2376,24 @@ static int wm5100_gpio_direction_out(struct gpio_chip *chip,
2377static int wm5100_gpio_get(struct gpio_chip *chip, unsigned offset) 2376static int wm5100_gpio_get(struct gpio_chip *chip, unsigned offset)
2378{ 2377{
2379 struct wm5100_priv *wm5100 = gpio_to_wm5100(chip); 2378 struct wm5100_priv *wm5100 = gpio_to_wm5100(chip);
2380 struct snd_soc_codec *codec = wm5100->codec; 2379 unsigned int reg;
2381 int ret; 2380 int ret;
2382 2381
2383 ret = snd_soc_read(codec, WM5100_GPIO_CTRL_1 + offset); 2382 ret = regmap_read(wm5100->regmap, WM5100_GPIO_CTRL_1 + offset, &reg);
2384 if (ret < 0) 2383 if (ret < 0)
2385 return ret; 2384 return ret;
2386 2385
2387 return (ret & WM5100_GP1_LVL) != 0; 2386 return (reg & WM5100_GP1_LVL) != 0;
2388} 2387}
2389 2388
2390static int wm5100_gpio_direction_in(struct gpio_chip *chip, unsigned offset) 2389static int wm5100_gpio_direction_in(struct gpio_chip *chip, unsigned offset)
2391{ 2390{
2392 struct wm5100_priv *wm5100 = gpio_to_wm5100(chip); 2391 struct wm5100_priv *wm5100 = gpio_to_wm5100(chip);
2393 struct snd_soc_codec *codec = wm5100->codec;
2394 2392
2395 return snd_soc_update_bits(codec, WM5100_GPIO_CTRL_1 + offset, 2393 return regmap_update_bits(wm5100->regmap, WM5100_GPIO_CTRL_1 + offset,
2396 WM5100_GP1_FN_MASK | WM5100_GP1_DIR, 2394 WM5100_GP1_FN_MASK | WM5100_GP1_DIR,
2397 (1 << WM5100_GP1_FN_SHIFT) | 2395 (1 << WM5100_GP1_FN_SHIFT) |
2398 (1 << WM5100_GP1_DIR_SHIFT)); 2396 (1 << WM5100_GP1_DIR_SHIFT));
2399} 2397}
2400 2398
2401static struct gpio_chip wm5100_template_chip = { 2399static struct gpio_chip wm5100_template_chip = {
@@ -2408,14 +2406,14 @@ static struct gpio_chip wm5100_template_chip = {
2408 .can_sleep = 1, 2406 .can_sleep = 1,
2409}; 2407};
2410 2408
2411static void wm5100_init_gpio(struct snd_soc_codec *codec) 2409static void wm5100_init_gpio(struct i2c_client *i2c)
2412{ 2410{
2413 struct wm5100_priv *wm5100 = snd_soc_codec_get_drvdata(codec); 2411 struct wm5100_priv *wm5100 = i2c_get_clientdata(i2c);
2414 int ret; 2412 int ret;
2415 2413
2416 wm5100->gpio_chip = wm5100_template_chip; 2414 wm5100->gpio_chip = wm5100_template_chip;
2417 wm5100->gpio_chip.ngpio = 6; 2415 wm5100->gpio_chip.ngpio = 6;
2418 wm5100->gpio_chip.dev = codec->dev; 2416 wm5100->gpio_chip.dev = &i2c->dev;
2419 2417
2420 if (wm5100->pdata.gpio_base) 2418 if (wm5100->pdata.gpio_base)
2421 wm5100->gpio_chip.base = wm5100->pdata.gpio_base; 2419 wm5100->gpio_chip.base = wm5100->pdata.gpio_base;
@@ -2424,24 +2422,24 @@ static void wm5100_init_gpio(struct snd_soc_codec *codec)
2424 2422
2425 ret = gpiochip_add(&wm5100->gpio_chip); 2423 ret = gpiochip_add(&wm5100->gpio_chip);
2426 if (ret != 0) 2424 if (ret != 0)
2427 dev_err(codec->dev, "Failed to add GPIOs: %d\n", ret); 2425 dev_err(&i2c->dev, "Failed to add GPIOs: %d\n", ret);
2428} 2426}
2429 2427
2430static void wm5100_free_gpio(struct snd_soc_codec *codec) 2428static void wm5100_free_gpio(struct i2c_client *i2c)
2431{ 2429{
2432 struct wm5100_priv *wm5100 = snd_soc_codec_get_drvdata(codec); 2430 struct wm5100_priv *wm5100 = i2c_get_clientdata(i2c);
2433 int ret; 2431 int ret;
2434 2432
2435 ret = gpiochip_remove(&wm5100->gpio_chip); 2433 ret = gpiochip_remove(&wm5100->gpio_chip);
2436 if (ret != 0) 2434 if (ret != 0)
2437 dev_err(codec->dev, "Failed to remove GPIOs: %d\n", ret); 2435 dev_err(&i2c->dev, "Failed to remove GPIOs: %d\n", ret);
2438} 2436}
2439#else 2437#else
2440static void wm5100_init_gpio(struct snd_soc_codec *codec) 2438static void wm5100_init_gpio(struct i2c_client *i2c)
2441{ 2439{
2442} 2440}
2443 2441
2444static void wm5100_free_gpio(struct snd_soc_codec *codec) 2442static void wm5100_free_gpio(struct i2c_client *i2c)
2445{ 2443{
2446} 2444}
2447#endif 2445#endif
@@ -2453,131 +2451,21 @@ static int wm5100_probe(struct snd_soc_codec *codec)
2453 int ret, i, irq_flags; 2451 int ret, i, irq_flags;
2454 2452
2455 wm5100->codec = codec; 2453 wm5100->codec = codec;
2454 codec->control_data = wm5100->regmap;
2456 2455
2457 ret = snd_soc_codec_set_cache_io(codec, 16, 16, SND_SOC_I2C); 2456 ret = snd_soc_codec_set_cache_io(codec, 16, 16, SND_SOC_REGMAP);
2458 if (ret != 0) { 2457 if (ret != 0) {
2459 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret); 2458 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
2460 return ret; 2459 return ret;
2461 } 2460 }
2462 2461
2463 for (i = 0; i < ARRAY_SIZE(wm5100->core_supplies); i++) 2462 regcache_cache_only(wm5100->regmap, true);
2464 wm5100->core_supplies[i].supply = wm5100_core_supply_names[i];
2465
2466 ret = regulator_bulk_get(&i2c->dev, ARRAY_SIZE(wm5100->core_supplies),
2467 wm5100->core_supplies);
2468 if (ret != 0) {
2469 dev_err(codec->dev, "Failed to request core supplies: %d\n",
2470 ret);
2471 return ret;
2472 }
2473
2474 wm5100->cpvdd = regulator_get(&i2c->dev, "CPVDD");
2475 if (IS_ERR(wm5100->cpvdd)) {
2476 ret = PTR_ERR(wm5100->cpvdd);
2477 dev_err(&i2c->dev, "Failed to get CPVDD: %d\n", ret);
2478 goto err_core;
2479 }
2480
2481 wm5100->dbvdd2 = regulator_get(&i2c->dev, "DBVDD2");
2482 if (IS_ERR(wm5100->dbvdd2)) {
2483 ret = PTR_ERR(wm5100->dbvdd2);
2484 dev_err(&i2c->dev, "Failed to get DBVDD2: %d\n", ret);
2485 goto err_cpvdd;
2486 }
2487 2463
2488 wm5100->dbvdd3 = regulator_get(&i2c->dev, "DBVDD3");
2489 if (IS_ERR(wm5100->dbvdd3)) {
2490 ret = PTR_ERR(wm5100->dbvdd3);
2491 dev_err(&i2c->dev, "Failed to get DBVDD2: %d\n", ret);
2492 goto err_dbvdd2;
2493 }
2494
2495 ret = regulator_bulk_enable(ARRAY_SIZE(wm5100->core_supplies),
2496 wm5100->core_supplies);
2497 if (ret != 0) {
2498 dev_err(codec->dev, "Failed to enable core supplies: %d\n",
2499 ret);
2500 goto err_dbvdd3;
2501 }
2502
2503 if (wm5100->pdata.ldo_ena) {
2504 ret = gpio_request_one(wm5100->pdata.ldo_ena,
2505 GPIOF_OUT_INIT_HIGH, "WM5100 LDOENA");
2506 if (ret < 0) {
2507 dev_err(&i2c->dev, "Failed to request LDOENA %d: %d\n",
2508 wm5100->pdata.ldo_ena, ret);
2509 goto err_enable;
2510 }
2511 msleep(2);
2512 }
2513
2514 if (wm5100->pdata.reset) {
2515 ret = gpio_request_one(wm5100->pdata.reset,
2516 GPIOF_OUT_INIT_HIGH, "WM5100 /RESET");
2517 if (ret < 0) {
2518 dev_err(&i2c->dev, "Failed to request /RESET %d: %d\n",
2519 wm5100->pdata.reset, ret);
2520 goto err_ldo;
2521 }
2522 }
2523
2524 ret = snd_soc_read(codec, WM5100_SOFTWARE_RESET);
2525 if (ret < 0) {
2526 dev_err(codec->dev, "Failed to read ID register\n");
2527 goto err_reset;
2528 }
2529 switch (ret) {
2530 case 0x8997:
2531 case 0x5100:
2532 break;
2533
2534 default:
2535 dev_err(codec->dev, "Device is not a WM5100, ID is %x\n", ret);
2536 ret = -EINVAL;
2537 goto err_reset;
2538 }
2539
2540 ret = snd_soc_read(codec, WM5100_DEVICE_REVISION);
2541 if (ret < 0) {
2542 dev_err(codec->dev, "Failed to read revision register\n");
2543 goto err_reset;
2544 }
2545 wm5100->rev = ret & WM5100_DEVICE_REVISION_MASK;
2546
2547 dev_info(codec->dev, "revision %c\n", wm5100->rev + 'A');
2548
2549 ret = wm5100_reset(codec);
2550 if (ret < 0) {
2551 dev_err(codec->dev, "Failed to issue reset\n");
2552 goto err_reset;
2553 }
2554
2555 codec->cache_only = true;
2556
2557 wm5100_init_gpio(codec);
2558 2464
2559 for (i = 0; i < ARRAY_SIZE(wm5100_dig_vu); i++) 2465 for (i = 0; i < ARRAY_SIZE(wm5100_dig_vu); i++)
2560 snd_soc_update_bits(codec, wm5100_dig_vu[i], WM5100_OUT_VU, 2466 snd_soc_update_bits(codec, wm5100_dig_vu[i], WM5100_OUT_VU,
2561 WM5100_OUT_VU); 2467 WM5100_OUT_VU);
2562 2468
2563 for (i = 0; i < ARRAY_SIZE(wm5100->pdata.in_mode); i++) {
2564 snd_soc_update_bits(codec, WM5100_IN1L_CONTROL,
2565 WM5100_IN1_MODE_MASK |
2566 WM5100_IN1_DMIC_SUP_MASK,
2567 (wm5100->pdata.in_mode[i] <<
2568 WM5100_IN1_MODE_SHIFT) |
2569 (wm5100->pdata.dmic_sup[i] <<
2570 WM5100_IN1_DMIC_SUP_SHIFT));
2571 }
2572
2573 for (i = 0; i < ARRAY_SIZE(wm5100->pdata.gpio_defaults); i++) {
2574 if (!wm5100->pdata.gpio_defaults[i])
2575 continue;
2576
2577 snd_soc_write(codec, WM5100_GPIO_CTRL_1 + i,
2578 wm5100->pdata.gpio_defaults[i]);
2579 }
2580
2581 /* Don't debounce interrupts to support use of SYSCLK only */ 2469 /* Don't debounce interrupts to support use of SYSCLK only */
2582 snd_soc_write(codec, WM5100_IRQ_DEBOUNCE_1, 0); 2470 snd_soc_write(codec, WM5100_IRQ_DEBOUNCE_1, 0);
2583 snd_soc_write(codec, WM5100_IRQ_DEBOUNCE_2, 0); 2471 snd_soc_write(codec, WM5100_IRQ_DEBOUNCE_2, 0);
@@ -2662,29 +2550,6 @@ static int wm5100_probe(struct snd_soc_codec *codec)
2662err_gpio: 2550err_gpio:
2663 if (i2c->irq) 2551 if (i2c->irq)
2664 free_irq(i2c->irq, codec); 2552 free_irq(i2c->irq, codec);
2665 wm5100_free_gpio(codec);
2666err_reset:
2667 if (wm5100->pdata.reset) {
2668 gpio_set_value_cansleep(wm5100->pdata.reset, 1);
2669 gpio_free(wm5100->pdata.reset);
2670 }
2671err_ldo:
2672 if (wm5100->pdata.ldo_ena) {
2673 gpio_set_value_cansleep(wm5100->pdata.ldo_ena, 0);
2674 gpio_free(wm5100->pdata.ldo_ena);
2675 }
2676err_enable:
2677 regulator_bulk_disable(ARRAY_SIZE(wm5100->core_supplies),
2678 wm5100->core_supplies);
2679err_dbvdd3:
2680 regulator_put(wm5100->dbvdd3);
2681err_dbvdd2:
2682 regulator_put(wm5100->dbvdd2);
2683err_cpvdd:
2684 regulator_put(wm5100->cpvdd);
2685err_core:
2686 regulator_bulk_free(ARRAY_SIZE(wm5100->core_supplies),
2687 wm5100->core_supplies);
2688 2553
2689 return ret; 2554 return ret;
2690} 2555}
@@ -2700,23 +2565,16 @@ static int wm5100_remove(struct snd_soc_codec *codec)
2700 } 2565 }
2701 if (i2c->irq) 2566 if (i2c->irq)
2702 free_irq(i2c->irq, codec); 2567 free_irq(i2c->irq, codec);
2703 wm5100_free_gpio(codec);
2704 if (wm5100->pdata.reset) {
2705 gpio_set_value_cansleep(wm5100->pdata.reset, 1);
2706 gpio_free(wm5100->pdata.reset);
2707 }
2708 if (wm5100->pdata.ldo_ena) {
2709 gpio_set_value_cansleep(wm5100->pdata.ldo_ena, 0);
2710 gpio_free(wm5100->pdata.ldo_ena);
2711 }
2712 regulator_put(wm5100->dbvdd3);
2713 regulator_put(wm5100->dbvdd2);
2714 regulator_put(wm5100->cpvdd);
2715 regulator_bulk_free(ARRAY_SIZE(wm5100->core_supplies),
2716 wm5100->core_supplies);
2717 return 0; 2568 return 0;
2718} 2569}
2719 2570
2571static int wm5100_soc_volatile(struct snd_soc_codec *codec,
2572 unsigned int reg)
2573{
2574 return true;
2575}
2576
2577
2720static struct snd_soc_codec_driver soc_codec_dev_wm5100 = { 2578static struct snd_soc_codec_driver soc_codec_dev_wm5100 = {
2721 .probe = wm5100_probe, 2579 .probe = wm5100_probe,
2722 .remove = wm5100_remove, 2580 .remove = wm5100_remove,
@@ -2725,6 +2583,8 @@ static struct snd_soc_codec_driver soc_codec_dev_wm5100 = {
2725 .set_pll = wm5100_set_fll, 2583 .set_pll = wm5100_set_fll,
2726 .set_bias_level = wm5100_set_bias_level, 2584 .set_bias_level = wm5100_set_bias_level,
2727 .idle_bias_off = 1, 2585 .idle_bias_off = 1,
2586 .reg_cache_size = WM5100_MAX_REGISTER,
2587 .volatile_register = wm5100_soc_volatile,
2728 2588
2729 .seq_notifier = wm5100_seq_notifier, 2589 .seq_notifier = wm5100_seq_notifier,
2730 .controls = wm5100_snd_controls, 2590 .controls = wm5100_snd_controls,
@@ -2733,14 +2593,18 @@ static struct snd_soc_codec_driver soc_codec_dev_wm5100 = {
2733 .num_dapm_widgets = ARRAY_SIZE(wm5100_dapm_widgets), 2593 .num_dapm_widgets = ARRAY_SIZE(wm5100_dapm_widgets),
2734 .dapm_routes = wm5100_dapm_routes, 2594 .dapm_routes = wm5100_dapm_routes,
2735 .num_dapm_routes = ARRAY_SIZE(wm5100_dapm_routes), 2595 .num_dapm_routes = ARRAY_SIZE(wm5100_dapm_routes),
2596};
2736 2597
2737 .reg_cache_size = ARRAY_SIZE(wm5100_reg_defaults), 2598static const struct regmap_config wm5100_regmap = {
2738 .reg_word_size = sizeof(u16), 2599 .reg_bits = 16,
2739 .compress_type = SND_SOC_RBTREE_COMPRESSION, 2600 .val_bits = 16,
2740 .reg_cache_default = wm5100_reg_defaults,
2741 2601
2742 .volatile_register = wm5100_volatile_register, 2602 .max_register = WM5100_MAX_REGISTER,
2743 .readable_register = wm5100_readable_register, 2603 .reg_defaults = wm5100_reg_defaults,
2604 .num_reg_defaults = ARRAY_SIZE(wm5100_reg_defaults),
2605 .volatile_reg = wm5100_volatile_register,
2606 .readable_reg = wm5100_readable_register,
2607 .cache_type = REGCACHE_RBTREE,
2744}; 2608};
2745 2609
2746static __devinit int wm5100_i2c_probe(struct i2c_client *i2c, 2610static __devinit int wm5100_i2c_probe(struct i2c_client *i2c,
@@ -2748,12 +2612,22 @@ static __devinit int wm5100_i2c_probe(struct i2c_client *i2c,
2748{ 2612{
2749 struct wm5100_pdata *pdata = dev_get_platdata(&i2c->dev); 2613 struct wm5100_pdata *pdata = dev_get_platdata(&i2c->dev);
2750 struct wm5100_priv *wm5100; 2614 struct wm5100_priv *wm5100;
2615 unsigned int reg;
2751 int ret, i; 2616 int ret, i;
2752 2617
2753 wm5100 = kzalloc(sizeof(struct wm5100_priv), GFP_KERNEL); 2618 wm5100 = devm_kzalloc(&i2c->dev, sizeof(struct wm5100_priv),
2619 GFP_KERNEL);
2754 if (wm5100 == NULL) 2620 if (wm5100 == NULL)
2755 return -ENOMEM; 2621 return -ENOMEM;
2756 2622
2623 wm5100->regmap = regmap_init_i2c(i2c, &wm5100_regmap);
2624 if (IS_ERR(wm5100->regmap)) {
2625 ret = PTR_ERR(wm5100->regmap);
2626 dev_err(&i2c->dev, "Failed to allocate register map: %d\n",
2627 ret);
2628 goto err;
2629 }
2630
2757 for (i = 0; i < ARRAY_SIZE(wm5100->fll); i++) 2631 for (i = 0; i < ARRAY_SIZE(wm5100->fll); i++)
2758 init_completion(&wm5100->fll[i].lock); 2632 init_completion(&wm5100->fll[i].lock);
2759 2633
@@ -2762,21 +2636,178 @@ static __devinit int wm5100_i2c_probe(struct i2c_client *i2c,
2762 2636
2763 i2c_set_clientdata(i2c, wm5100); 2637 i2c_set_clientdata(i2c, wm5100);
2764 2638
2639 for (i = 0; i < ARRAY_SIZE(wm5100->core_supplies); i++)
2640 wm5100->core_supplies[i].supply = wm5100_core_supply_names[i];
2641
2642 ret = regulator_bulk_get(&i2c->dev, ARRAY_SIZE(wm5100->core_supplies),
2643 wm5100->core_supplies);
2644 if (ret != 0) {
2645 dev_err(&i2c->dev, "Failed to request core supplies: %d\n",
2646 ret);
2647 goto err_regmap;
2648 }
2649
2650 wm5100->cpvdd = regulator_get(&i2c->dev, "CPVDD");
2651 if (IS_ERR(wm5100->cpvdd)) {
2652 ret = PTR_ERR(wm5100->cpvdd);
2653 dev_err(&i2c->dev, "Failed to get CPVDD: %d\n", ret);
2654 goto err_core;
2655 }
2656
2657 wm5100->dbvdd2 = regulator_get(&i2c->dev, "DBVDD2");
2658 if (IS_ERR(wm5100->dbvdd2)) {
2659 ret = PTR_ERR(wm5100->dbvdd2);
2660 dev_err(&i2c->dev, "Failed to get DBVDD2: %d\n", ret);
2661 goto err_cpvdd;
2662 }
2663
2664 wm5100->dbvdd3 = regulator_get(&i2c->dev, "DBVDD3");
2665 if (IS_ERR(wm5100->dbvdd3)) {
2666 ret = PTR_ERR(wm5100->dbvdd3);
2667 dev_err(&i2c->dev, "Failed to get DBVDD2: %d\n", ret);
2668 goto err_dbvdd2;
2669 }
2670
2671 ret = regulator_bulk_enable(ARRAY_SIZE(wm5100->core_supplies),
2672 wm5100->core_supplies);
2673 if (ret != 0) {
2674 dev_err(&i2c->dev, "Failed to enable core supplies: %d\n",
2675 ret);
2676 goto err_dbvdd3;
2677 }
2678
2679 if (wm5100->pdata.ldo_ena) {
2680 ret = gpio_request_one(wm5100->pdata.ldo_ena,
2681 GPIOF_OUT_INIT_HIGH, "WM5100 LDOENA");
2682 if (ret < 0) {
2683 dev_err(&i2c->dev, "Failed to request LDOENA %d: %d\n",
2684 wm5100->pdata.ldo_ena, ret);
2685 goto err_enable;
2686 }
2687 msleep(2);
2688 }
2689
2690 if (wm5100->pdata.reset) {
2691 ret = gpio_request_one(wm5100->pdata.reset,
2692 GPIOF_OUT_INIT_HIGH, "WM5100 /RESET");
2693 if (ret < 0) {
2694 dev_err(&i2c->dev, "Failed to request /RESET %d: %d\n",
2695 wm5100->pdata.reset, ret);
2696 goto err_ldo;
2697 }
2698 }
2699
2700 ret = regmap_read(wm5100->regmap, WM5100_SOFTWARE_RESET, &reg);
2701 if (ret < 0) {
2702 dev_err(&i2c->dev, "Failed to read ID register\n");
2703 goto err_reset;
2704 }
2705 switch (reg) {
2706 case 0x8997:
2707 case 0x5100:
2708 break;
2709
2710 default:
2711 dev_err(&i2c->dev, "Device is not a WM5100, ID is %x\n", reg);
2712 ret = -EINVAL;
2713 goto err_reset;
2714 }
2715
2716 ret = regmap_read(wm5100->regmap, WM5100_DEVICE_REVISION, &reg);
2717 if (ret < 0) {
2718 dev_err(&i2c->dev, "Failed to read revision register\n");
2719 goto err_reset;
2720 }
2721 wm5100->rev = reg & WM5100_DEVICE_REVISION_MASK;
2722
2723 dev_info(&i2c->dev, "revision %c\n", wm5100->rev + 'A');
2724
2725 ret = wm5100_reset(wm5100);
2726 if (ret < 0) {
2727 dev_err(&i2c->dev, "Failed to issue reset\n");
2728 goto err_reset;
2729 }
2730
2731 wm5100_init_gpio(i2c);
2732
2733 for (i = 0; i < ARRAY_SIZE(wm5100->pdata.gpio_defaults); i++) {
2734 if (!wm5100->pdata.gpio_defaults[i])
2735 continue;
2736
2737 regmap_write(wm5100->regmap, WM5100_GPIO_CTRL_1 + i,
2738 wm5100->pdata.gpio_defaults[i]);
2739 }
2740
2741 for (i = 0; i < ARRAY_SIZE(wm5100->pdata.in_mode); i++) {
2742 regmap_update_bits(wm5100->regmap, WM5100_IN1L_CONTROL,
2743 WM5100_IN1_MODE_MASK |
2744 WM5100_IN1_DMIC_SUP_MASK,
2745 (wm5100->pdata.in_mode[i] <<
2746 WM5100_IN1_MODE_SHIFT) |
2747 (wm5100->pdata.dmic_sup[i] <<
2748 WM5100_IN1_DMIC_SUP_SHIFT));
2749 }
2750
2765 ret = snd_soc_register_codec(&i2c->dev, 2751 ret = snd_soc_register_codec(&i2c->dev,
2766 &soc_codec_dev_wm5100, wm5100_dai, 2752 &soc_codec_dev_wm5100, wm5100_dai,
2767 ARRAY_SIZE(wm5100_dai)); 2753 ARRAY_SIZE(wm5100_dai));
2768 if (ret < 0) { 2754 if (ret < 0) {
2769 dev_err(&i2c->dev, "Failed to register WM5100: %d\n", ret); 2755 dev_err(&i2c->dev, "Failed to register WM5100: %d\n", ret);
2770 kfree(wm5100); 2756 goto err_reset;
2771 } 2757 }
2772 2758
2773 return ret; 2759 return ret;
2760
2761err_reset:
2762 wm5100_free_gpio(i2c);
2763 if (wm5100->pdata.reset) {
2764 gpio_set_value_cansleep(wm5100->pdata.reset, 1);
2765 gpio_free(wm5100->pdata.reset);
2766 }
2767err_ldo:
2768 if (wm5100->pdata.ldo_ena) {
2769 gpio_set_value_cansleep(wm5100->pdata.ldo_ena, 0);
2770 gpio_free(wm5100->pdata.ldo_ena);
2771 }
2772err_enable:
2773 regulator_bulk_disable(ARRAY_SIZE(wm5100->core_supplies),
2774 wm5100->core_supplies);
2775err_dbvdd3:
2776 regulator_put(wm5100->dbvdd3);
2777err_dbvdd2:
2778 regulator_put(wm5100->dbvdd2);
2779err_cpvdd:
2780 regulator_put(wm5100->cpvdd);
2781err_core:
2782 regulator_bulk_free(ARRAY_SIZE(wm5100->core_supplies),
2783 wm5100->core_supplies);
2784err_regmap:
2785 regmap_exit(wm5100->regmap);
2786err:
2787 return ret;
2774} 2788}
2775 2789
2776static __devexit int wm5100_i2c_remove(struct i2c_client *client) 2790static __devexit int wm5100_i2c_remove(struct i2c_client *client)
2777{ 2791{
2792 struct wm5100_priv *wm5100 = i2c_get_clientdata(client);
2793
2778 snd_soc_unregister_codec(&client->dev); 2794 snd_soc_unregister_codec(&client->dev);
2779 kfree(i2c_get_clientdata(client)); 2795 wm5100_free_gpio(client);
2796 if (wm5100->pdata.reset) {
2797 gpio_set_value_cansleep(wm5100->pdata.reset, 1);
2798 gpio_free(wm5100->pdata.reset);
2799 }
2800 if (wm5100->pdata.ldo_ena) {
2801 gpio_set_value_cansleep(wm5100->pdata.ldo_ena, 0);
2802 gpio_free(wm5100->pdata.ldo_ena);
2803 }
2804 regulator_put(wm5100->dbvdd3);
2805 regulator_put(wm5100->dbvdd2);
2806 regulator_put(wm5100->cpvdd);
2807 regulator_bulk_free(ARRAY_SIZE(wm5100->core_supplies),
2808 wm5100->core_supplies);
2809 regmap_exit(wm5100->regmap);
2810
2780 return 0; 2811 return 0;
2781} 2812}
2782 2813
diff --git a/sound/soc/codecs/wm5100.h b/sound/soc/codecs/wm5100.h
index 970759636bd..25cb6016f9d 100644
--- a/sound/soc/codecs/wm5100.h
+++ b/sound/soc/codecs/wm5100.h
@@ -15,6 +15,7 @@
15#define WM5100_ASOC_H 15#define WM5100_ASOC_H
16 16
17#include <sound/soc.h> 17#include <sound/soc.h>
18#include <linux/regmap.h>
18 19
19int wm5100_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack); 20int wm5100_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack);
20 21
@@ -5147,9 +5148,9 @@ int wm5100_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack);
5147#define WM5100_DSP3_ZM_END_SHIFT 0 /* DSP3_ZM_END - [15:0] */ 5148#define WM5100_DSP3_ZM_END_SHIFT 0 /* DSP3_ZM_END - [15:0] */
5148#define WM5100_DSP3_ZM_END_WIDTH 16 /* DSP3_ZM_END - [15:0] */ 5149#define WM5100_DSP3_ZM_END_WIDTH 16 /* DSP3_ZM_END - [15:0] */
5149 5150
5150int wm5100_readable_register(struct snd_soc_codec *codec, unsigned int reg); 5151bool wm5100_readable_register(struct device *dev, unsigned int reg);
5151int wm5100_volatile_register(struct snd_soc_codec *codec, unsigned int reg); 5152bool wm5100_volatile_register(struct device *dev, unsigned int reg);
5152 5153
5153extern u16 wm5100_reg_defaults[WM5100_MAX_REGISTER + 1]; 5154extern struct reg_default wm5100_reg_defaults[WM5100_REGISTER_COUNT];
5154 5155
5155#endif 5156#endif
diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c
index 35f3ad83dfb..8c4c9591ec0 100644
--- a/sound/soc/codecs/wm8350.c
+++ b/sound/soc/codecs/wm8350.c
@@ -696,7 +696,7 @@ static const struct snd_soc_dapm_widget wm8350_dapm_widgets[] = {
696 SND_SOC_DAPM_INPUT("IN3L"), 696 SND_SOC_DAPM_INPUT("IN3L"),
697}; 697};
698 698
699static const struct snd_soc_dapm_route audio_map[] = { 699static const struct snd_soc_dapm_route wm8350_dapm_routes[] = {
700 700
701 /* left playback mixer */ 701 /* left playback mixer */
702 {"Left Playback Mixer", "Playback Switch", "Left DAC"}, 702 {"Left Playback Mixer", "Playback Switch", "Left DAC"},
@@ -777,29 +777,6 @@ static const struct snd_soc_dapm_route audio_map[] = {
777 {"Beep", NULL, "IN3R PGA"}, 777 {"Beep", NULL, "IN3R PGA"},
778}; 778};
779 779
780static int wm8350_add_widgets(struct snd_soc_codec *codec)
781{
782 struct snd_soc_dapm_context *dapm = &codec->dapm;
783 int ret;
784
785 ret = snd_soc_dapm_new_controls(dapm,
786 wm8350_dapm_widgets,
787 ARRAY_SIZE(wm8350_dapm_widgets));
788 if (ret != 0) {
789 dev_err(codec->dev, "dapm control register failed\n");
790 return ret;
791 }
792
793 /* set up audio paths */
794 ret = snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
795 if (ret != 0) {
796 dev_err(codec->dev, "DAPM route register failed\n");
797 return ret;
798 }
799
800 return 0;
801}
802
803static int wm8350_set_dai_sysclk(struct snd_soc_dai *codec_dai, 780static int wm8350_set_dai_sysclk(struct snd_soc_dai *codec_dai,
804 int clk_id, unsigned int freq, int dir) 781 int clk_id, unsigned int freq, int dir)
805{ 782{
@@ -1315,7 +1292,7 @@ static int wm8350_set_bias_level(struct snd_soc_codec *codec,
1315 return 0; 1292 return 0;
1316} 1293}
1317 1294
1318static int wm8350_suspend(struct snd_soc_codec *codec, pm_message_t state) 1295static int wm8350_suspend(struct snd_soc_codec *codec)
1319{ 1296{
1320 wm8350_set_bias_level(codec, SND_SOC_BIAS_OFF); 1297 wm8350_set_bias_level(codec, SND_SOC_BIAS_OFF);
1321 return 0; 1298 return 0;
@@ -1511,7 +1488,7 @@ EXPORT_SYMBOL_GPL(wm8350_mic_jack_detect);
1511 SNDRV_PCM_FMTBIT_S20_3LE |\ 1488 SNDRV_PCM_FMTBIT_S20_3LE |\
1512 SNDRV_PCM_FMTBIT_S24_LE) 1489 SNDRV_PCM_FMTBIT_S24_LE)
1513 1490
1514static struct snd_soc_dai_ops wm8350_dai_ops = { 1491static const struct snd_soc_dai_ops wm8350_dai_ops = {
1515 .hw_params = wm8350_pcm_hw_params, 1492 .hw_params = wm8350_pcm_hw_params,
1516 .digital_mute = wm8350_mute, 1493 .digital_mute = wm8350_mute,
1517 .trigger = wm8350_pcm_trigger, 1494 .trigger = wm8350_pcm_trigger,
@@ -1553,7 +1530,8 @@ static int wm8350_codec_probe(struct snd_soc_codec *codec)
1553 return -EINVAL; 1530 return -EINVAL;
1554 } 1531 }
1555 1532
1556 priv = kzalloc(sizeof(struct wm8350_data), GFP_KERNEL); 1533 priv = devm_kzalloc(codec->dev, sizeof(struct wm8350_data),
1534 GFP_KERNEL);
1557 if (priv == NULL) 1535 if (priv == NULL)
1558 return -ENOMEM; 1536 return -ENOMEM;
1559 snd_soc_codec_set_drvdata(codec, priv); 1537 snd_soc_codec_set_drvdata(codec, priv);
@@ -1564,7 +1542,7 @@ static int wm8350_codec_probe(struct snd_soc_codec *codec)
1564 ret = regulator_bulk_get(wm8350->dev, ARRAY_SIZE(priv->supplies), 1542 ret = regulator_bulk_get(wm8350->dev, ARRAY_SIZE(priv->supplies),
1565 priv->supplies); 1543 priv->supplies);
1566 if (ret != 0) 1544 if (ret != 0)
1567 goto err_priv; 1545 return ret;
1568 1546
1569 wm8350->codec.codec = codec; 1547 wm8350->codec.codec = codec;
1570 codec->control_data = wm8350; 1548 codec->control_data = wm8350;
@@ -1633,17 +1611,9 @@ static int wm8350_codec_probe(struct snd_soc_codec *codec)
1633 wm8350_mic_handler, 0, "Microphone detect", priv); 1611 wm8350_mic_handler, 0, "Microphone detect", priv);
1634 1612
1635 1613
1636 snd_soc_add_controls(codec, wm8350_snd_controls,
1637 ARRAY_SIZE(wm8350_snd_controls));
1638 wm8350_add_widgets(codec);
1639
1640 wm8350_set_bias_level(codec, SND_SOC_BIAS_STANDBY); 1614 wm8350_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
1641 1615
1642 return 0; 1616 return 0;
1643
1644err_priv:
1645 kfree(priv);
1646 return ret;
1647} 1617}
1648 1618
1649static int wm8350_codec_remove(struct snd_soc_codec *codec) 1619static int wm8350_codec_remove(struct snd_soc_codec *codec)
@@ -1676,7 +1646,7 @@ static int wm8350_codec_remove(struct snd_soc_codec *codec)
1676 wm8350_clear_bits(wm8350, WM8350_POWER_MGMT_5, WM8350_CODEC_ENA); 1646 wm8350_clear_bits(wm8350, WM8350_POWER_MGMT_5, WM8350_CODEC_ENA);
1677 1647
1678 regulator_bulk_free(ARRAY_SIZE(priv->supplies), priv->supplies); 1648 regulator_bulk_free(ARRAY_SIZE(priv->supplies), priv->supplies);
1679 kfree(priv); 1649
1680 return 0; 1650 return 0;
1681} 1651}
1682 1652
@@ -1688,6 +1658,13 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8350 = {
1688 .read = wm8350_codec_read, 1658 .read = wm8350_codec_read,
1689 .write = wm8350_codec_write, 1659 .write = wm8350_codec_write,
1690 .set_bias_level = wm8350_set_bias_level, 1660 .set_bias_level = wm8350_set_bias_level,
1661
1662 .controls = wm8350_snd_controls,
1663 .num_controls = ARRAY_SIZE(wm8350_snd_controls),
1664 .dapm_widgets = wm8350_dapm_widgets,
1665 .num_dapm_widgets = ARRAY_SIZE(wm8350_dapm_widgets),
1666 .dapm_routes = wm8350_dapm_routes,
1667 .num_dapm_routes = ARRAY_SIZE(wm8350_dapm_routes),
1691}; 1668};
1692 1669
1693static int __devinit wm8350_probe(struct platform_device *pdev) 1670static int __devinit wm8350_probe(struct platform_device *pdev)
@@ -1711,17 +1688,7 @@ static struct platform_driver wm8350_codec_driver = {
1711 .remove = __devexit_p(wm8350_remove), 1688 .remove = __devexit_p(wm8350_remove),
1712}; 1689};
1713 1690
1714static __init int wm8350_init(void) 1691module_platform_driver(wm8350_codec_driver);
1715{
1716 return platform_driver_register(&wm8350_codec_driver);
1717}
1718module_init(wm8350_init);
1719
1720static __exit void wm8350_exit(void)
1721{
1722 platform_driver_unregister(&wm8350_codec_driver);
1723}
1724module_exit(wm8350_exit);
1725 1692
1726MODULE_DESCRIPTION("ASoC WM8350 driver"); 1693MODULE_DESCRIPTION("ASoC WM8350 driver");
1727MODULE_AUTHOR("Liam Girdwood"); 1694MODULE_AUTHOR("Liam Girdwood");
diff --git a/sound/soc/codecs/wm8400.c b/sound/soc/codecs/wm8400.c
index dc13be2a09c..898979d2301 100644
--- a/sound/soc/codecs/wm8400.c
+++ b/sound/soc/codecs/wm8400.c
@@ -353,13 +353,6 @@ SOC_SINGLE("RIN34 Mute Switch", WM8400_RIGHT_LINE_INPUT_3_4_VOLUME,
353 353
354}; 354};
355 355
356/* add non dapm controls */
357static int wm8400_add_controls(struct snd_soc_codec *codec)
358{
359 return snd_soc_add_controls(codec, wm8400_snd_controls,
360 ARRAY_SIZE(wm8400_snd_controls));
361}
362
363/* 356/*
364 * _DAPM_ Controls 357 * _DAPM_ Controls
365 */ 358 */
@@ -766,8 +759,8 @@ SND_SOC_DAPM_PGA("ROPGA", WM8400_POWER_MANAGEMENT_3, WM8400_ROPGA_ENA_SHIFT, 0,
766 NULL, 0), 759 NULL, 0),
767 760
768/* MICBIAS */ 761/* MICBIAS */
769SND_SOC_DAPM_MICBIAS("MICBIAS", WM8400_POWER_MANAGEMENT_1, 762SND_SOC_DAPM_SUPPLY("MICBIAS", WM8400_POWER_MANAGEMENT_1,
770 WM8400_MIC1BIAS_ENA_SHIFT, 0), 763 WM8400_MIC1BIAS_ENA_SHIFT, 0, NULL, 0),
771 764
772SND_SOC_DAPM_OUTPUT("LON"), 765SND_SOC_DAPM_OUTPUT("LON"),
773SND_SOC_DAPM_OUTPUT("LOP"), 766SND_SOC_DAPM_OUTPUT("LOP"),
@@ -783,7 +776,7 @@ SND_SOC_DAPM_OUTPUT("RON"),
783SND_SOC_DAPM_OUTPUT("Internal DAC Sink"), 776SND_SOC_DAPM_OUTPUT("Internal DAC Sink"),
784}; 777};
785 778
786static const struct snd_soc_dapm_route audio_map[] = { 779static const struct snd_soc_dapm_route wm8400_dapm_routes[] = {
787 /* Make DACs turn on when playing even if not mixed into any outputs */ 780 /* Make DACs turn on when playing even if not mixed into any outputs */
788 {"Internal DAC Sink", NULL, "Left DAC"}, 781 {"Internal DAC Sink", NULL, "Left DAC"},
789 {"Internal DAC Sink", NULL, "Right DAC"}, 782 {"Internal DAC Sink", NULL, "Right DAC"},
@@ -909,17 +902,6 @@ static const struct snd_soc_dapm_route audio_map[] = {
909 {"RON", NULL, "RONMIX"}, 902 {"RON", NULL, "RONMIX"},
910}; 903};
911 904
912static int wm8400_add_widgets(struct snd_soc_codec *codec)
913{
914 struct snd_soc_dapm_context *dapm = &codec->dapm;
915
916 snd_soc_dapm_new_controls(dapm, wm8400_dapm_widgets,
917 ARRAY_SIZE(wm8400_dapm_widgets));
918 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
919
920 return 0;
921}
922
923/* 905/*
924 * Clock after FLL and dividers 906 * Clock after FLL and dividers
925 */ 907 */
@@ -1059,7 +1041,7 @@ static int wm8400_set_dai_pll(struct snd_soc_dai *codec_dai, int pll_id,
1059 wm8400_write(codec, WM8400_FLL_CONTROL_3, factors.n); 1041 wm8400_write(codec, WM8400_FLL_CONTROL_3, factors.n);
1060 1042
1061 reg = wm8400_read(codec, WM8400_FLL_CONTROL_4); 1043 reg = wm8400_read(codec, WM8400_FLL_CONTROL_4);
1062 reg &= WM8400_FLL_OUTDIV_MASK; 1044 reg &= ~WM8400_FLL_OUTDIV_MASK;
1063 reg |= factors.outdiv; 1045 reg |= factors.outdiv;
1064 wm8400_write(codec, WM8400_FLL_CONTROL_4, reg); 1046 wm8400_write(codec, WM8400_FLL_CONTROL_4, reg);
1065 1047
@@ -1316,7 +1298,7 @@ static int wm8400_set_bias_level(struct snd_soc_codec *codec,
1316#define WM8400_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ 1298#define WM8400_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\
1317 SNDRV_PCM_FMTBIT_S24_LE) 1299 SNDRV_PCM_FMTBIT_S24_LE)
1318 1300
1319static struct snd_soc_dai_ops wm8400_dai_ops = { 1301static const struct snd_soc_dai_ops wm8400_dai_ops = {
1320 .hw_params = wm8400_hw_params, 1302 .hw_params = wm8400_hw_params,
1321 .digital_mute = wm8400_mute, 1303 .digital_mute = wm8400_mute,
1322 .set_fmt = wm8400_set_dai_fmt, 1304 .set_fmt = wm8400_set_dai_fmt,
@@ -1352,7 +1334,7 @@ static struct snd_soc_dai_driver wm8400_dai = {
1352 .ops = &wm8400_dai_ops, 1334 .ops = &wm8400_dai_ops,
1353}; 1335};
1354 1336
1355static int wm8400_suspend(struct snd_soc_codec *codec, pm_message_t state) 1337static int wm8400_suspend(struct snd_soc_codec *codec)
1356{ 1338{
1357 wm8400_set_bias_level(codec, SND_SOC_BIAS_OFF); 1339 wm8400_set_bias_level(codec, SND_SOC_BIAS_OFF);
1358 1340
@@ -1383,7 +1365,8 @@ static int wm8400_codec_probe(struct snd_soc_codec *codec)
1383 int ret; 1365 int ret;
1384 u16 reg; 1366 u16 reg;
1385 1367
1386 priv = kzalloc(sizeof(struct wm8400_priv), GFP_KERNEL); 1368 priv = devm_kzalloc(codec->dev, sizeof(struct wm8400_priv),
1369 GFP_KERNEL);
1387 if (priv == NULL) 1370 if (priv == NULL)
1388 return -ENOMEM; 1371 return -ENOMEM;
1389 1372
@@ -1395,7 +1378,7 @@ static int wm8400_codec_probe(struct snd_soc_codec *codec)
1395 ARRAY_SIZE(power), &power[0]); 1378 ARRAY_SIZE(power), &power[0]);
1396 if (ret != 0) { 1379 if (ret != 0) {
1397 dev_err(codec->dev, "Failed to get regulators: %d\n", ret); 1380 dev_err(codec->dev, "Failed to get regulators: %d\n", ret);
1398 goto err; 1381 return ret;
1399 } 1382 }
1400 1383
1401 INIT_WORK(&priv->work, wm8400_probe_deferred); 1384 INIT_WORK(&priv->work, wm8400_probe_deferred);
@@ -1420,20 +1403,15 @@ static int wm8400_codec_probe(struct snd_soc_codec *codec)
1420 ret = -EINVAL; 1403 ret = -EINVAL;
1421 goto err_regulator; 1404 goto err_regulator;
1422 } 1405 }
1423 wm8400_add_controls(codec);
1424 wm8400_add_widgets(codec);
1425 return 0; 1406 return 0;
1426 1407
1427err_regulator: 1408err_regulator:
1428 regulator_bulk_free(ARRAY_SIZE(power), power); 1409 regulator_bulk_free(ARRAY_SIZE(power), power);
1429err:
1430 kfree(priv);
1431 return ret; 1410 return ret;
1432} 1411}
1433 1412
1434static int wm8400_codec_remove(struct snd_soc_codec *codec) 1413static int wm8400_codec_remove(struct snd_soc_codec *codec)
1435{ 1414{
1436 struct wm8400_priv *priv = snd_soc_codec_get_drvdata(codec);
1437 u16 reg; 1415 u16 reg;
1438 1416
1439 reg = wm8400_read(codec, WM8400_POWER_MANAGEMENT_1); 1417 reg = wm8400_read(codec, WM8400_POWER_MANAGEMENT_1);
@@ -1441,7 +1419,6 @@ static int wm8400_codec_remove(struct snd_soc_codec *codec)
1441 reg & (~WM8400_CODEC_ENA)); 1419 reg & (~WM8400_CODEC_ENA));
1442 1420
1443 regulator_bulk_free(ARRAY_SIZE(power), power); 1421 regulator_bulk_free(ARRAY_SIZE(power), power);
1444 kfree(priv);
1445 1422
1446 return 0; 1423 return 0;
1447} 1424}
@@ -1454,6 +1431,13 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8400 = {
1454 .read = wm8400_read, 1431 .read = wm8400_read,
1455 .write = wm8400_write, 1432 .write = wm8400_write,
1456 .set_bias_level = wm8400_set_bias_level, 1433 .set_bias_level = wm8400_set_bias_level,
1434
1435 .controls = wm8400_snd_controls,
1436 .num_controls = ARRAY_SIZE(wm8400_snd_controls),
1437 .dapm_widgets = wm8400_dapm_widgets,
1438 .num_dapm_widgets = ARRAY_SIZE(wm8400_dapm_widgets),
1439 .dapm_routes = wm8400_dapm_routes,
1440 .num_dapm_routes = ARRAY_SIZE(wm8400_dapm_routes),
1457}; 1441};
1458 1442
1459static int __devinit wm8400_probe(struct platform_device *pdev) 1443static int __devinit wm8400_probe(struct platform_device *pdev)
@@ -1477,17 +1461,7 @@ static struct platform_driver wm8400_codec_driver = {
1477 .remove = __devexit_p(wm8400_remove), 1461 .remove = __devexit_p(wm8400_remove),
1478}; 1462};
1479 1463
1480static __init int wm8400_init(void) 1464module_platform_driver(wm8400_codec_driver);
1481{
1482 return platform_driver_register(&wm8400_codec_driver);
1483}
1484module_init(wm8400_init);
1485
1486static __exit void wm8400_exit(void)
1487{
1488 platform_driver_unregister(&wm8400_codec_driver);
1489}
1490module_exit(wm8400_exit);
1491 1465
1492MODULE_DESCRIPTION("ASoC WM8400 driver"); 1466MODULE_DESCRIPTION("ASoC WM8400 driver");
1493MODULE_AUTHOR("Mark Brown"); 1467MODULE_AUTHOR("Mark Brown");
diff --git a/sound/soc/codecs/wm8510.c b/sound/soc/codecs/wm8510.c
index 07c9cc759e9..9166126bd31 100644
--- a/sound/soc/codecs/wm8510.c
+++ b/sound/soc/codecs/wm8510.c
@@ -17,7 +17,6 @@
17#include <linux/delay.h> 17#include <linux/delay.h>
18#include <linux/pm.h> 18#include <linux/pm.h>
19#include <linux/i2c.h> 19#include <linux/i2c.h>
20#include <linux/platform_device.h>
21#include <linux/spi/spi.h> 20#include <linux/spi/spi.h>
22#include <linux/slab.h> 21#include <linux/slab.h>
23#include <linux/of_device.h> 22#include <linux/of_device.h>
@@ -182,7 +181,7 @@ SND_SOC_DAPM_OUTPUT("SPKOUTP"),
182SND_SOC_DAPM_OUTPUT("SPKOUTN"), 181SND_SOC_DAPM_OUTPUT("SPKOUTN"),
183}; 182};
184 183
185static const struct snd_soc_dapm_route audio_map[] = { 184static const struct snd_soc_dapm_route wm8510_dapm_routes[] = {
186 /* Mono output mixer */ 185 /* Mono output mixer */
187 {"Mono Mixer", "PCM Playback Switch", "DAC"}, 186 {"Mono Mixer", "PCM Playback Switch", "DAC"},
188 {"Mono Mixer", "Aux Playback Switch", "Aux Input"}, 187 {"Mono Mixer", "Aux Playback Switch", "Aux Input"},
@@ -214,17 +213,6 @@ static const struct snd_soc_dapm_route audio_map[] = {
214 {"ADC", NULL, "Boost Mixer"}, 213 {"ADC", NULL, "Boost Mixer"},
215}; 214};
216 215
217static int wm8510_add_widgets(struct snd_soc_codec *codec)
218{
219 struct snd_soc_dapm_context *dapm = &codec->dapm;
220
221 snd_soc_dapm_new_controls(dapm, wm8510_dapm_widgets,
222 ARRAY_SIZE(wm8510_dapm_widgets));
223 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
224
225 return 0;
226}
227
228struct pll_ { 216struct pll_ {
229 unsigned int pre_div:4; /* prescale - 1 */ 217 unsigned int pre_div:4; /* prescale - 1 */
230 unsigned int n:4; 218 unsigned int n:4;
@@ -509,7 +497,7 @@ static int wm8510_set_bias_level(struct snd_soc_codec *codec,
509#define WM8510_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ 497#define WM8510_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\
510 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE) 498 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE)
511 499
512static struct snd_soc_dai_ops wm8510_dai_ops = { 500static const struct snd_soc_dai_ops wm8510_dai_ops = {
513 .hw_params = wm8510_pcm_hw_params, 501 .hw_params = wm8510_pcm_hw_params,
514 .digital_mute = wm8510_mute, 502 .digital_mute = wm8510_mute,
515 .set_fmt = wm8510_set_dai_fmt, 503 .set_fmt = wm8510_set_dai_fmt,
@@ -535,7 +523,7 @@ static struct snd_soc_dai_driver wm8510_dai = {
535 .symmetric_rates = 1, 523 .symmetric_rates = 1,
536}; 524};
537 525
538static int wm8510_suspend(struct snd_soc_codec *codec, pm_message_t state) 526static int wm8510_suspend(struct snd_soc_codec *codec)
539{ 527{
540 wm8510_set_bias_level(codec, SND_SOC_BIAS_OFF); 528 wm8510_set_bias_level(codec, SND_SOC_BIAS_OFF);
541 return 0; 529 return 0;
@@ -562,9 +550,6 @@ static int wm8510_probe(struct snd_soc_codec *codec)
562 550
563 /* power on device */ 551 /* power on device */
564 wm8510_set_bias_level(codec, SND_SOC_BIAS_STANDBY); 552 wm8510_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
565 snd_soc_add_controls(codec, wm8510_snd_controls,
566 ARRAY_SIZE(wm8510_snd_controls));
567 wm8510_add_widgets(codec);
568 553
569 return ret; 554 return ret;
570} 555}
@@ -588,6 +573,13 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8510 = {
588 .reg_cache_size = ARRAY_SIZE(wm8510_reg), 573 .reg_cache_size = ARRAY_SIZE(wm8510_reg),
589 .reg_word_size = sizeof(u16), 574 .reg_word_size = sizeof(u16),
590 .reg_cache_default =wm8510_reg, 575 .reg_cache_default =wm8510_reg,
576
577 .controls = wm8510_snd_controls,
578 .num_controls = ARRAY_SIZE(wm8510_snd_controls),
579 .dapm_widgets = wm8510_dapm_widgets,
580 .num_dapm_widgets = ARRAY_SIZE(wm8510_dapm_widgets),
581 .dapm_routes = wm8510_dapm_routes,
582 .num_dapm_routes = ARRAY_SIZE(wm8510_dapm_routes),
591}; 583};
592 584
593static const struct of_device_id wm8510_of_match[] = { 585static const struct of_device_id wm8510_of_match[] = {
@@ -667,7 +659,7 @@ MODULE_DEVICE_TABLE(i2c, wm8510_i2c_id);
667 659
668static struct i2c_driver wm8510_i2c_driver = { 660static struct i2c_driver wm8510_i2c_driver = {
669 .driver = { 661 .driver = {
670 .name = "wm8510-codec", 662 .name = "wm8510",
671 .owner = THIS_MODULE, 663 .owner = THIS_MODULE,
672 .of_match_table = wm8510_of_match, 664 .of_match_table = wm8510_of_match,
673 }, 665 },
diff --git a/sound/soc/codecs/wm8523.c b/sound/soc/codecs/wm8523.c
index db7a6819499..7fea2c3bf7e 100644
--- a/sound/soc/codecs/wm8523.c
+++ b/sound/soc/codecs/wm8523.c
@@ -17,7 +17,6 @@
17#include <linux/delay.h> 17#include <linux/delay.h>
18#include <linux/pm.h> 18#include <linux/pm.h>
19#include <linux/i2c.h> 19#include <linux/i2c.h>
20#include <linux/platform_device.h>
21#include <linux/regulator/consumer.h> 20#include <linux/regulator/consumer.h>
22#include <linux/slab.h> 21#include <linux/slab.h>
23#include <linux/of_device.h> 22#include <linux/of_device.h>
@@ -365,7 +364,7 @@ static int wm8523_set_bias_level(struct snd_soc_codec *codec,
365#define WM8523_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ 364#define WM8523_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\
366 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE) 365 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE)
367 366
368static struct snd_soc_dai_ops wm8523_dai_ops = { 367static const struct snd_soc_dai_ops wm8523_dai_ops = {
369 .startup = wm8523_startup, 368 .startup = wm8523_startup,
370 .hw_params = wm8523_hw_params, 369 .hw_params = wm8523_hw_params,
371 .set_sysclk = wm8523_set_dai_sysclk, 370 .set_sysclk = wm8523_set_dai_sysclk,
@@ -385,7 +384,7 @@ static struct snd_soc_dai_driver wm8523_dai = {
385}; 384};
386 385
387#ifdef CONFIG_PM 386#ifdef CONFIG_PM
388static int wm8523_suspend(struct snd_soc_codec *codec, pm_message_t state) 387static int wm8523_suspend(struct snd_soc_codec *codec)
389{ 388{
390 wm8523_set_bias_level(codec, SND_SOC_BIAS_OFF); 389 wm8523_set_bias_level(codec, SND_SOC_BIAS_OFF);
391 return 0; 390 return 0;
diff --git a/sound/soc/codecs/wm8580.c b/sound/soc/codecs/wm8580.c
index 8212b3c8bfd..211285164d7 100644
--- a/sound/soc/codecs/wm8580.c
+++ b/sound/soc/codecs/wm8580.c
@@ -23,7 +23,6 @@
23#include <linux/delay.h> 23#include <linux/delay.h>
24#include <linux/pm.h> 24#include <linux/pm.h>
25#include <linux/i2c.h> 25#include <linux/i2c.h>
26#include <linux/platform_device.h>
27#include <linux/regulator/consumer.h> 26#include <linux/regulator/consumer.h>
28#include <linux/slab.h> 27#include <linux/slab.h>
29#include <linux/of_device.h> 28#include <linux/of_device.h>
@@ -273,7 +272,7 @@ SND_SOC_DAPM_INPUT("AINL"),
273SND_SOC_DAPM_INPUT("AINR"), 272SND_SOC_DAPM_INPUT("AINR"),
274}; 273};
275 274
276static const struct snd_soc_dapm_route audio_map[] = { 275static const struct snd_soc_dapm_route wm8580_dapm_routes[] = {
277 { "VOUT1L", NULL, "DAC1" }, 276 { "VOUT1L", NULL, "DAC1" },
278 { "VOUT1R", NULL, "DAC1" }, 277 { "VOUT1R", NULL, "DAC1" },
279 278
@@ -287,17 +286,6 @@ static const struct snd_soc_dapm_route audio_map[] = {
287 { "ADC", NULL, "AINR" }, 286 { "ADC", NULL, "AINR" },
288}; 287};
289 288
290static int wm8580_add_widgets(struct snd_soc_codec *codec)
291{
292 struct snd_soc_dapm_context *dapm = &codec->dapm;
293
294 snd_soc_dapm_new_controls(dapm, wm8580_dapm_widgets,
295 ARRAY_SIZE(wm8580_dapm_widgets));
296 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
297
298 return 0;
299}
300
301/* PLL divisors */ 289/* PLL divisors */
302struct _pll_div { 290struct _pll_div {
303 u32 prescale:1; 291 u32 prescale:1;
@@ -682,7 +670,7 @@ static int wm8580_set_sysclk(struct snd_soc_dai *dai, int clk_id,
682{ 670{
683 struct snd_soc_codec *codec = dai->codec; 671 struct snd_soc_codec *codec = dai->codec;
684 struct wm8580_priv *wm8580 = snd_soc_codec_get_drvdata(codec); 672 struct wm8580_priv *wm8580 = snd_soc_codec_get_drvdata(codec);
685 int sel, sel_mask, sel_shift; 673 int ret, sel, sel_mask, sel_shift;
686 674
687 switch (dai->driver->id) { 675 switch (dai->driver->id) {
688 case WM8580_DAI_PAIFRX: 676 case WM8580_DAI_PAIFRX:
@@ -723,7 +711,11 @@ static int wm8580_set_sysclk(struct snd_soc_dai *dai, int clk_id,
723 /* We really should validate PLL settings but not yet */ 711 /* We really should validate PLL settings but not yet */
724 wm8580->sysclk[dai->driver->id] = freq; 712 wm8580->sysclk[dai->driver->id] = freq;
725 713
726 return snd_soc_update_bits(codec, WM8580_CLKSEL, sel_mask, sel); 714 ret = snd_soc_update_bits(codec, WM8580_CLKSEL, sel_mask, sel);
715 if (ret < 0)
716 return ret;
717
718 return 0;
727} 719}
728 720
729static int wm8580_digital_mute(struct snd_soc_dai *codec_dai, int mute) 721static int wm8580_digital_mute(struct snd_soc_dai *codec_dai, int mute)
@@ -776,7 +768,7 @@ static int wm8580_set_bias_level(struct snd_soc_codec *codec,
776#define WM8580_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ 768#define WM8580_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\
777 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE) 769 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE)
778 770
779static struct snd_soc_dai_ops wm8580_dai_ops_playback = { 771static const struct snd_soc_dai_ops wm8580_dai_ops_playback = {
780 .set_sysclk = wm8580_set_sysclk, 772 .set_sysclk = wm8580_set_sysclk,
781 .hw_params = wm8580_paif_hw_params, 773 .hw_params = wm8580_paif_hw_params,
782 .set_fmt = wm8580_set_paif_dai_fmt, 774 .set_fmt = wm8580_set_paif_dai_fmt,
@@ -785,7 +777,7 @@ static struct snd_soc_dai_ops wm8580_dai_ops_playback = {
785 .digital_mute = wm8580_digital_mute, 777 .digital_mute = wm8580_digital_mute,
786}; 778};
787 779
788static struct snd_soc_dai_ops wm8580_dai_ops_capture = { 780static const struct snd_soc_dai_ops wm8580_dai_ops_capture = {
789 .set_sysclk = wm8580_set_sysclk, 781 .set_sysclk = wm8580_set_sysclk,
790 .hw_params = wm8580_paif_hw_params, 782 .hw_params = wm8580_paif_hw_params,
791 .set_fmt = wm8580_set_paif_dai_fmt, 783 .set_fmt = wm8580_set_paif_dai_fmt,
@@ -857,10 +849,6 @@ static int wm8580_probe(struct snd_soc_codec *codec)
857 849
858 wm8580_set_bias_level(codec, SND_SOC_BIAS_STANDBY); 850 wm8580_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
859 851
860 snd_soc_add_controls(codec, wm8580_snd_controls,
861 ARRAY_SIZE(wm8580_snd_controls));
862 wm8580_add_widgets(codec);
863
864 return 0; 852 return 0;
865 853
866err_regulator_enable: 854err_regulator_enable:
@@ -890,6 +878,13 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8580 = {
890 .reg_cache_size = ARRAY_SIZE(wm8580_reg), 878 .reg_cache_size = ARRAY_SIZE(wm8580_reg),
891 .reg_word_size = sizeof(u16), 879 .reg_word_size = sizeof(u16),
892 .reg_cache_default = wm8580_reg, 880 .reg_cache_default = wm8580_reg,
881
882 .controls = wm8580_snd_controls,
883 .num_controls = ARRAY_SIZE(wm8580_snd_controls),
884 .dapm_widgets = wm8580_dapm_widgets,
885 .num_dapm_widgets = ARRAY_SIZE(wm8580_dapm_widgets),
886 .dapm_routes = wm8580_dapm_routes,
887 .num_dapm_routes = ARRAY_SIZE(wm8580_dapm_routes),
893}; 888};
894 889
895static const struct of_device_id wm8580_of_match[] = { 890static const struct of_device_id wm8580_of_match[] = {
diff --git a/sound/soc/codecs/wm8711.c b/sound/soc/codecs/wm8711.c
index 076bdb9930a..0b76d1dca5e 100644
--- a/sound/soc/codecs/wm8711.c
+++ b/sound/soc/codecs/wm8711.c
@@ -18,7 +18,6 @@
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/platform_device.h>
22#include <linux/spi/spi.h> 21#include <linux/spi/spi.h>
23#include <linux/slab.h> 22#include <linux/slab.h>
24#include <linux/of_device.h> 23#include <linux/of_device.h>
@@ -318,7 +317,7 @@ static int wm8711_set_bias_level(struct snd_soc_codec *codec,
318#define WM8711_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ 317#define WM8711_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\
319 SNDRV_PCM_FMTBIT_S24_LE) 318 SNDRV_PCM_FMTBIT_S24_LE)
320 319
321static struct snd_soc_dai_ops wm8711_ops = { 320static const struct snd_soc_dai_ops wm8711_ops = {
322 .prepare = wm8711_pcm_prepare, 321 .prepare = wm8711_pcm_prepare,
323 .hw_params = wm8711_hw_params, 322 .hw_params = wm8711_hw_params,
324 .shutdown = wm8711_shutdown, 323 .shutdown = wm8711_shutdown,
@@ -339,7 +338,7 @@ static struct snd_soc_dai_driver wm8711_dai = {
339 .ops = &wm8711_ops, 338 .ops = &wm8711_ops,
340}; 339};
341 340
342static int wm8711_suspend(struct snd_soc_codec *codec, pm_message_t state) 341static int wm8711_suspend(struct snd_soc_codec *codec)
343{ 342{
344 snd_soc_write(codec, WM8711_ACTIVE, 0x0); 343 snd_soc_write(codec, WM8711_ACTIVE, 0x0);
345 wm8711_set_bias_level(codec, SND_SOC_BIAS_OFF); 344 wm8711_set_bias_level(codec, SND_SOC_BIAS_OFF);
@@ -375,9 +374,6 @@ static int wm8711_probe(struct snd_soc_codec *codec)
375 snd_soc_update_bits(codec, WM8711_LOUT1V, 0x0100, 0x0100); 374 snd_soc_update_bits(codec, WM8711_LOUT1V, 0x0100, 0x0100);
376 snd_soc_update_bits(codec, WM8711_ROUT1V, 0x0100, 0x0100); 375 snd_soc_update_bits(codec, WM8711_ROUT1V, 0x0100, 0x0100);
377 376
378 snd_soc_add_controls(codec, wm8711_snd_controls,
379 ARRAY_SIZE(wm8711_snd_controls));
380
381 return ret; 377 return ret;
382 378
383} 379}
@@ -398,6 +394,8 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8711 = {
398 .reg_cache_size = ARRAY_SIZE(wm8711_reg), 394 .reg_cache_size = ARRAY_SIZE(wm8711_reg),
399 .reg_word_size = sizeof(u16), 395 .reg_word_size = sizeof(u16),
400 .reg_cache_default = wm8711_reg, 396 .reg_cache_default = wm8711_reg,
397 .controls = wm8711_snd_controls,
398 .num_controls = ARRAY_SIZE(wm8711_snd_controls),
401 .dapm_widgets = wm8711_dapm_widgets, 399 .dapm_widgets = wm8711_dapm_widgets,
402 .num_dapm_widgets = ARRAY_SIZE(wm8711_dapm_widgets), 400 .num_dapm_widgets = ARRAY_SIZE(wm8711_dapm_widgets),
403 .dapm_routes = wm8711_intercon, 401 .dapm_routes = wm8711_intercon,
diff --git a/sound/soc/codecs/wm8727.c b/sound/soc/codecs/wm8727.c
index 74880828511..e8170562071 100644
--- a/sound/soc/codecs/wm8727.c
+++ b/sound/soc/codecs/wm8727.c
@@ -59,7 +59,7 @@ static int __devexit wm8727_remove(struct platform_device *pdev)
59 59
60static struct platform_driver wm8727_codec_driver = { 60static struct platform_driver wm8727_codec_driver = {
61 .driver = { 61 .driver = {
62 .name = "wm8727-codec", 62 .name = "wm8727",
63 .owner = THIS_MODULE, 63 .owner = THIS_MODULE,
64 }, 64 },
65 65
@@ -67,17 +67,7 @@ static struct platform_driver wm8727_codec_driver = {
67 .remove = __devexit_p(wm8727_remove), 67 .remove = __devexit_p(wm8727_remove),
68}; 68};
69 69
70static int __init wm8727_init(void) 70module_platform_driver(wm8727_codec_driver);
71{
72 return platform_driver_register(&wm8727_codec_driver);
73}
74module_init(wm8727_init);
75
76static void __exit wm8727_exit(void)
77{
78 platform_driver_unregister(&wm8727_codec_driver);
79}
80module_exit(wm8727_exit);
81 71
82MODULE_DESCRIPTION("ASoC wm8727 driver"); 72MODULE_DESCRIPTION("ASoC wm8727 driver");
83MODULE_AUTHOR("Neil Jones"); 73MODULE_AUTHOR("Neil Jones");
diff --git a/sound/soc/codecs/wm8728.c b/sound/soc/codecs/wm8728.c
index 04b027efd5c..fc3d59e4908 100644
--- a/sound/soc/codecs/wm8728.c
+++ b/sound/soc/codecs/wm8728.c
@@ -196,7 +196,7 @@ static int wm8728_set_bias_level(struct snd_soc_codec *codec,
196#define WM8728_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ 196#define WM8728_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\
197 SNDRV_PCM_FMTBIT_S24_LE) 197 SNDRV_PCM_FMTBIT_S24_LE)
198 198
199static struct snd_soc_dai_ops wm8728_dai_ops = { 199static const struct snd_soc_dai_ops wm8728_dai_ops = {
200 .hw_params = wm8728_hw_params, 200 .hw_params = wm8728_hw_params,
201 .digital_mute = wm8728_mute, 201 .digital_mute = wm8728_mute,
202 .set_fmt = wm8728_set_dai_fmt, 202 .set_fmt = wm8728_set_dai_fmt,
@@ -214,7 +214,7 @@ static struct snd_soc_dai_driver wm8728_dai = {
214 .ops = &wm8728_dai_ops, 214 .ops = &wm8728_dai_ops,
215}; 215};
216 216
217static int wm8728_suspend(struct snd_soc_codec *codec, pm_message_t state) 217static int wm8728_suspend(struct snd_soc_codec *codec)
218{ 218{
219 wm8728_set_bias_level(codec, SND_SOC_BIAS_OFF); 219 wm8728_set_bias_level(codec, SND_SOC_BIAS_OFF);
220 220
@@ -243,9 +243,6 @@ static int wm8728_probe(struct snd_soc_codec *codec)
243 /* power on device */ 243 /* power on device */
244 wm8728_set_bias_level(codec, SND_SOC_BIAS_STANDBY); 244 wm8728_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
245 245
246 snd_soc_add_controls(codec, wm8728_snd_controls,
247 ARRAY_SIZE(wm8728_snd_controls));
248
249 return ret; 246 return ret;
250} 247}
251 248
@@ -264,6 +261,8 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8728 = {
264 .reg_cache_size = ARRAY_SIZE(wm8728_reg_defaults), 261 .reg_cache_size = ARRAY_SIZE(wm8728_reg_defaults),
265 .reg_word_size = sizeof(u16), 262 .reg_word_size = sizeof(u16),
266 .reg_cache_default = wm8728_reg_defaults, 263 .reg_cache_default = wm8728_reg_defaults,
264 .controls = wm8728_snd_controls,
265 .num_controls = ARRAY_SIZE(wm8728_snd_controls),
267 .dapm_widgets = wm8728_dapm_widgets, 266 .dapm_widgets = wm8728_dapm_widgets,
268 .num_dapm_widgets = ARRAY_SIZE(wm8728_dapm_widgets), 267 .num_dapm_widgets = ARRAY_SIZE(wm8728_dapm_widgets),
269 .dapm_routes = wm8728_intercon, 268 .dapm_routes = wm8728_intercon,
diff --git a/sound/soc/codecs/wm8731.c b/sound/soc/codecs/wm8731.c
index a7c9ae17fc7..8821af70e66 100644
--- a/sound/soc/codecs/wm8731.c
+++ b/sound/soc/codecs/wm8731.c
@@ -19,7 +19,6 @@
19#include <linux/pm.h> 19#include <linux/pm.h>
20#include <linux/i2c.h> 20#include <linux/i2c.h>
21#include <linux/slab.h> 21#include <linux/slab.h>
22#include <linux/platform_device.h>
23#include <linux/regulator/consumer.h> 22#include <linux/regulator/consumer.h>
24#include <linux/spi/spi.h> 23#include <linux/spi/spi.h>
25#include <linux/of_device.h> 24#include <linux/of_device.h>
@@ -465,7 +464,7 @@ static int wm8731_set_bias_level(struct snd_soc_codec *codec,
465#define WM8731_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ 464#define WM8731_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\
466 SNDRV_PCM_FMTBIT_S24_LE) 465 SNDRV_PCM_FMTBIT_S24_LE)
467 466
468static struct snd_soc_dai_ops wm8731_dai_ops = { 467static const struct snd_soc_dai_ops wm8731_dai_ops = {
469 .hw_params = wm8731_hw_params, 468 .hw_params = wm8731_hw_params,
470 .digital_mute = wm8731_mute, 469 .digital_mute = wm8731_mute,
471 .set_sysclk = wm8731_set_dai_sysclk, 470 .set_sysclk = wm8731_set_dai_sysclk,
@@ -491,7 +490,7 @@ static struct snd_soc_dai_driver wm8731_dai = {
491}; 490};
492 491
493#ifdef CONFIG_PM 492#ifdef CONFIG_PM
494static int wm8731_suspend(struct snd_soc_codec *codec, pm_message_t state) 493static int wm8731_suspend(struct snd_soc_codec *codec)
495{ 494{
496 wm8731_set_bias_level(codec, SND_SOC_BIAS_OFF); 495 wm8731_set_bias_level(codec, SND_SOC_BIAS_OFF);
497 496
@@ -554,9 +553,6 @@ static int wm8731_probe(struct snd_soc_codec *codec)
554 /* Disable bypass path by default */ 553 /* Disable bypass path by default */
555 snd_soc_update_bits(codec, WM8731_APANA, 0x8, 0); 554 snd_soc_update_bits(codec, WM8731_APANA, 0x8, 0);
556 555
557 snd_soc_add_controls(codec, wm8731_snd_controls,
558 ARRAY_SIZE(wm8731_snd_controls));
559
560 /* Regulators will have been enabled by bias management */ 556 /* Regulators will have been enabled by bias management */
561 regulator_bulk_disable(ARRAY_SIZE(wm8731->supplies), wm8731->supplies); 557 regulator_bulk_disable(ARRAY_SIZE(wm8731->supplies), wm8731->supplies);
562 558
@@ -596,6 +592,8 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8731 = {
596 .num_dapm_widgets = ARRAY_SIZE(wm8731_dapm_widgets), 592 .num_dapm_widgets = ARRAY_SIZE(wm8731_dapm_widgets),
597 .dapm_routes = wm8731_intercon, 593 .dapm_routes = wm8731_intercon,
598 .num_dapm_routes = ARRAY_SIZE(wm8731_intercon), 594 .num_dapm_routes = ARRAY_SIZE(wm8731_intercon),
595 .controls = wm8731_snd_controls,
596 .num_controls = ARRAY_SIZE(wm8731_snd_controls),
599}; 597};
600 598
601static const struct of_device_id wm8731_of_match[] = { 599static const struct of_device_id wm8731_of_match[] = {
diff --git a/sound/soc/codecs/wm8737.c b/sound/soc/codecs/wm8737.c
index f6aef58845c..ff95e62c56b 100644
--- a/sound/soc/codecs/wm8737.c
+++ b/sound/soc/codecs/wm8737.c
@@ -16,7 +16,6 @@
16#include <linux/delay.h> 16#include <linux/delay.h>
17#include <linux/pm.h> 17#include <linux/pm.h>
18#include <linux/i2c.h> 18#include <linux/i2c.h>
19#include <linux/platform_device.h>
20#include <linux/regulator/consumer.h> 19#include <linux/regulator/consumer.h>
21#include <linux/spi/spi.h> 20#include <linux/spi/spi.h>
22#include <linux/slab.h> 21#include <linux/slab.h>
@@ -521,7 +520,7 @@ static int wm8737_set_bias_level(struct snd_soc_codec *codec,
521#define WM8737_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ 520#define WM8737_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\
522 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE) 521 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE)
523 522
524static struct snd_soc_dai_ops wm8737_dai_ops = { 523static const struct snd_soc_dai_ops wm8737_dai_ops = {
525 .hw_params = wm8737_hw_params, 524 .hw_params = wm8737_hw_params,
526 .set_sysclk = wm8737_set_dai_sysclk, 525 .set_sysclk = wm8737_set_dai_sysclk,
527 .set_fmt = wm8737_set_dai_fmt, 526 .set_fmt = wm8737_set_dai_fmt,
@@ -540,7 +539,7 @@ static struct snd_soc_dai_driver wm8737_dai = {
540}; 539};
541 540
542#ifdef CONFIG_PM 541#ifdef CONFIG_PM
543static int wm8737_suspend(struct snd_soc_codec *codec, pm_message_t state) 542static int wm8737_suspend(struct snd_soc_codec *codec)
544{ 543{
545 wm8737_set_bias_level(codec, SND_SOC_BIAS_OFF); 544 wm8737_set_bias_level(codec, SND_SOC_BIAS_OFF);
546 return 0; 545 return 0;
diff --git a/sound/soc/codecs/wm8741.c b/sound/soc/codecs/wm8741.c
index 57ad22aacc5..3941f50bf18 100644
--- a/sound/soc/codecs/wm8741.c
+++ b/sound/soc/codecs/wm8741.c
@@ -18,7 +18,6 @@
18#include <linux/pm.h> 18#include <linux/pm.h>
19#include <linux/i2c.h> 19#include <linux/i2c.h>
20#include <linux/spi/spi.h> 20#include <linux/spi/spi.h>
21#include <linux/platform_device.h>
22#include <linux/regulator/consumer.h> 21#include <linux/regulator/consumer.h>
23#include <linux/slab.h> 22#include <linux/slab.h>
24#include <linux/of_device.h> 23#include <linux/of_device.h>
@@ -86,24 +85,13 @@ SND_SOC_DAPM_OUTPUT("VOUTRP"),
86SND_SOC_DAPM_OUTPUT("VOUTRN"), 85SND_SOC_DAPM_OUTPUT("VOUTRN"),
87}; 86};
88 87
89static const struct snd_soc_dapm_route intercon[] = { 88static const struct snd_soc_dapm_route wm8741_dapm_routes[] = {
90 { "VOUTLP", NULL, "DACL" }, 89 { "VOUTLP", NULL, "DACL" },
91 { "VOUTLN", NULL, "DACL" }, 90 { "VOUTLN", NULL, "DACL" },
92 { "VOUTRP", NULL, "DACR" }, 91 { "VOUTRP", NULL, "DACR" },
93 { "VOUTRN", NULL, "DACR" }, 92 { "VOUTRN", NULL, "DACR" },
94}; 93};
95 94
96static int wm8741_add_widgets(struct snd_soc_codec *codec)
97{
98 struct snd_soc_dapm_context *dapm = &codec->dapm;
99
100 snd_soc_dapm_new_controls(dapm, wm8741_dapm_widgets,
101 ARRAY_SIZE(wm8741_dapm_widgets));
102 snd_soc_dapm_add_routes(dapm, intercon, ARRAY_SIZE(intercon));
103
104 return 0;
105}
106
107static struct { 95static struct {
108 int value; 96 int value;
109 int ratio; 97 int ratio;
@@ -382,7 +370,7 @@ static int wm8741_set_dai_fmt(struct snd_soc_dai *codec_dai,
382#define WM8741_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ 370#define WM8741_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\
383 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE) 371 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE)
384 372
385static struct snd_soc_dai_ops wm8741_dai_ops = { 373static const struct snd_soc_dai_ops wm8741_dai_ops = {
386 .startup = wm8741_startup, 374 .startup = wm8741_startup,
387 .hw_params = wm8741_hw_params, 375 .hw_params = wm8741_hw_params,
388 .set_sysclk = wm8741_set_dai_sysclk, 376 .set_sysclk = wm8741_set_dai_sysclk,
@@ -457,10 +445,6 @@ static int wm8741_probe(struct snd_soc_codec *codec)
457 snd_soc_update_bits(codec, WM8741_DACRMSB_ATTENUATION, 445 snd_soc_update_bits(codec, WM8741_DACRMSB_ATTENUATION,
458 WM8741_UPDATERM, WM8741_UPDATERM); 446 WM8741_UPDATERM, WM8741_UPDATERM);
459 447
460 snd_soc_add_controls(codec, wm8741_snd_controls,
461 ARRAY_SIZE(wm8741_snd_controls));
462 wm8741_add_widgets(codec);
463
464 dev_dbg(codec->dev, "Successful registration\n"); 448 dev_dbg(codec->dev, "Successful registration\n");
465 return ret; 449 return ret;
466 450
@@ -489,6 +473,13 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8741 = {
489 .reg_cache_size = ARRAY_SIZE(wm8741_reg_defaults), 473 .reg_cache_size = ARRAY_SIZE(wm8741_reg_defaults),
490 .reg_word_size = sizeof(u16), 474 .reg_word_size = sizeof(u16),
491 .reg_cache_default = wm8741_reg_defaults, 475 .reg_cache_default = wm8741_reg_defaults,
476
477 .controls = wm8741_snd_controls,
478 .num_controls = ARRAY_SIZE(wm8741_snd_controls),
479 .dapm_widgets = wm8741_dapm_widgets,
480 .num_dapm_widgets = ARRAY_SIZE(wm8741_dapm_widgets),
481 .dapm_routes = wm8741_dapm_routes,
482 .num_dapm_routes = ARRAY_SIZE(wm8741_dapm_routes),
492}; 483};
493 484
494static const struct of_device_id wm8741_of_match[] = { 485static const struct of_device_id wm8741_of_match[] = {
@@ -504,7 +495,8 @@ static int wm8741_i2c_probe(struct i2c_client *i2c,
504 struct wm8741_priv *wm8741; 495 struct wm8741_priv *wm8741;
505 int ret; 496 int ret;
506 497
507 wm8741 = kzalloc(sizeof(struct wm8741_priv), GFP_KERNEL); 498 wm8741 = devm_kzalloc(&i2c->dev, sizeof(struct wm8741_priv),
499 GFP_KERNEL);
508 if (wm8741 == NULL) 500 if (wm8741 == NULL)
509 return -ENOMEM; 501 return -ENOMEM;
510 502
@@ -513,20 +505,13 @@ static int wm8741_i2c_probe(struct i2c_client *i2c,
513 505
514 ret = snd_soc_register_codec(&i2c->dev, 506 ret = snd_soc_register_codec(&i2c->dev,
515 &soc_codec_dev_wm8741, &wm8741_dai, 1); 507 &soc_codec_dev_wm8741, &wm8741_dai, 1);
516 if (ret != 0)
517 goto err;
518 508
519 return ret; 509 return ret;
520
521err:
522 kfree(wm8741);
523 return ret;
524} 510}
525 511
526static int wm8741_i2c_remove(struct i2c_client *client) 512static int wm8741_i2c_remove(struct i2c_client *client)
527{ 513{
528 snd_soc_unregister_codec(&client->dev); 514 snd_soc_unregister_codec(&client->dev);
529 kfree(i2c_get_clientdata(client));
530 return 0; 515 return 0;
531} 516}
532 517
@@ -554,7 +539,8 @@ static int __devinit wm8741_spi_probe(struct spi_device *spi)
554 struct wm8741_priv *wm8741; 539 struct wm8741_priv *wm8741;
555 int ret; 540 int ret;
556 541
557 wm8741 = kzalloc(sizeof(struct wm8741_priv), GFP_KERNEL); 542 wm8741 = devm_kzalloc(&spi->dev, sizeof(struct wm8741_priv),
543 GFP_KERNEL);
558 if (wm8741 == NULL) 544 if (wm8741 == NULL)
559 return -ENOMEM; 545 return -ENOMEM;
560 546
@@ -563,15 +549,12 @@ static int __devinit wm8741_spi_probe(struct spi_device *spi)
563 549
564 ret = snd_soc_register_codec(&spi->dev, 550 ret = snd_soc_register_codec(&spi->dev,
565 &soc_codec_dev_wm8741, &wm8741_dai, 1); 551 &soc_codec_dev_wm8741, &wm8741_dai, 1);
566 if (ret < 0)
567 kfree(wm8741);
568 return ret; 552 return ret;
569} 553}
570 554
571static int __devexit wm8741_spi_remove(struct spi_device *spi) 555static int __devexit wm8741_spi_remove(struct spi_device *spi)
572{ 556{
573 snd_soc_unregister_codec(&spi->dev); 557 snd_soc_unregister_codec(&spi->dev);
574 kfree(spi_get_drvdata(spi));
575 return 0; 558 return 0;
576} 559}
577 560
diff --git a/sound/soc/codecs/wm8750.c b/sound/soc/codecs/wm8750.c
index ca75a818070..e4c50ce7d9c 100644
--- a/sound/soc/codecs/wm8750.c
+++ b/sound/soc/codecs/wm8750.c
@@ -18,7 +18,6 @@
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/platform_device.h>
22#include <linux/spi/spi.h> 21#include <linux/spi/spi.h>
23#include <linux/slab.h> 22#include <linux/slab.h>
24#include <linux/of_device.h> 23#include <linux/of_device.h>
@@ -302,7 +301,7 @@ static const struct snd_soc_dapm_widget wm8750_dapm_widgets[] = {
302 SND_SOC_DAPM_INPUT("RINPUT3"), 301 SND_SOC_DAPM_INPUT("RINPUT3"),
303}; 302};
304 303
305static const struct snd_soc_dapm_route audio_map[] = { 304static const struct snd_soc_dapm_route wm8750_dapm_routes[] = {
306 /* left mixer */ 305 /* left mixer */
307 {"Left Mixer", "Playback Switch", "Left DAC"}, 306 {"Left Mixer", "Playback Switch", "Left DAC"},
308 {"Left Mixer", "Left Bypass Switch", "Left Line Mux"}, 307 {"Left Mixer", "Left Bypass Switch", "Left Line Mux"},
@@ -396,17 +395,6 @@ static const struct snd_soc_dapm_route audio_map[] = {
396 {"Right ADC", NULL, "Right ADC Mux"}, 395 {"Right ADC", NULL, "Right ADC Mux"},
397}; 396};
398 397
399static int wm8750_add_widgets(struct snd_soc_codec *codec)
400{
401 struct snd_soc_dapm_context *dapm = &codec->dapm;
402
403 snd_soc_dapm_new_controls(dapm, wm8750_dapm_widgets,
404 ARRAY_SIZE(wm8750_dapm_widgets));
405 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
406
407 return 0;
408}
409
410struct _coeff_div { 398struct _coeff_div {
411 u32 mclk; 399 u32 mclk;
412 u32 rate; 400 u32 rate;
@@ -643,7 +631,7 @@ static int wm8750_set_bias_level(struct snd_soc_codec *codec,
643#define WM8750_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ 631#define WM8750_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\
644 SNDRV_PCM_FMTBIT_S24_LE) 632 SNDRV_PCM_FMTBIT_S24_LE)
645 633
646static struct snd_soc_dai_ops wm8750_dai_ops = { 634static const struct snd_soc_dai_ops wm8750_dai_ops = {
647 .hw_params = wm8750_pcm_hw_params, 635 .hw_params = wm8750_pcm_hw_params,
648 .digital_mute = wm8750_mute, 636 .digital_mute = wm8750_mute,
649 .set_fmt = wm8750_set_dai_fmt, 637 .set_fmt = wm8750_set_dai_fmt,
@@ -667,7 +655,7 @@ static struct snd_soc_dai_driver wm8750_dai = {
667 .ops = &wm8750_dai_ops, 655 .ops = &wm8750_dai_ops,
668}; 656};
669 657
670static int wm8750_suspend(struct snd_soc_codec *codec, pm_message_t state) 658static int wm8750_suspend(struct snd_soc_codec *codec)
671{ 659{
672 wm8750_set_bias_level(codec, SND_SOC_BIAS_OFF); 660 wm8750_set_bias_level(codec, SND_SOC_BIAS_OFF);
673 return 0; 661 return 0;
@@ -709,9 +697,6 @@ static int wm8750_probe(struct snd_soc_codec *codec)
709 snd_soc_update_bits(codec, WM8750_LINVOL, 0x0100, 0x0100); 697 snd_soc_update_bits(codec, WM8750_LINVOL, 0x0100, 0x0100);
710 snd_soc_update_bits(codec, WM8750_RINVOL, 0x0100, 0x0100); 698 snd_soc_update_bits(codec, WM8750_RINVOL, 0x0100, 0x0100);
711 699
712 snd_soc_add_controls(codec, wm8750_snd_controls,
713 ARRAY_SIZE(wm8750_snd_controls));
714 wm8750_add_widgets(codec);
715 return ret; 700 return ret;
716} 701}
717 702
@@ -730,6 +715,13 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8750 = {
730 .reg_cache_size = ARRAY_SIZE(wm8750_reg), 715 .reg_cache_size = ARRAY_SIZE(wm8750_reg),
731 .reg_word_size = sizeof(u16), 716 .reg_word_size = sizeof(u16),
732 .reg_cache_default = wm8750_reg, 717 .reg_cache_default = wm8750_reg,
718
719 .controls = wm8750_snd_controls,
720 .num_controls = ARRAY_SIZE(wm8750_snd_controls),
721 .dapm_widgets = wm8750_dapm_widgets,
722 .num_dapm_widgets = ARRAY_SIZE(wm8750_dapm_widgets),
723 .dapm_routes = wm8750_dapm_routes,
724 .num_dapm_routes = ARRAY_SIZE(wm8750_dapm_routes),
733}; 725};
734 726
735static const struct of_device_id wm8750_of_match[] = { 727static const struct of_device_id wm8750_of_match[] = {
@@ -745,7 +737,8 @@ static int __devinit wm8750_spi_probe(struct spi_device *spi)
745 struct wm8750_priv *wm8750; 737 struct wm8750_priv *wm8750;
746 int ret; 738 int ret;
747 739
748 wm8750 = kzalloc(sizeof(struct wm8750_priv), GFP_KERNEL); 740 wm8750 = devm_kzalloc(&spi->dev, sizeof(struct wm8750_priv),
741 GFP_KERNEL);
749 if (wm8750 == NULL) 742 if (wm8750 == NULL)
750 return -ENOMEM; 743 return -ENOMEM;
751 744
@@ -754,15 +747,12 @@ static int __devinit wm8750_spi_probe(struct spi_device *spi)
754 747
755 ret = snd_soc_register_codec(&spi->dev, 748 ret = snd_soc_register_codec(&spi->dev,
756 &soc_codec_dev_wm8750, &wm8750_dai, 1); 749 &soc_codec_dev_wm8750, &wm8750_dai, 1);
757 if (ret < 0)
758 kfree(wm8750);
759 return ret; 750 return ret;
760} 751}
761 752
762static int __devexit wm8750_spi_remove(struct spi_device *spi) 753static int __devexit wm8750_spi_remove(struct spi_device *spi)
763{ 754{
764 snd_soc_unregister_codec(&spi->dev); 755 snd_soc_unregister_codec(&spi->dev);
765 kfree(spi_get_drvdata(spi));
766 return 0; 756 return 0;
767} 757}
768 758
@@ -792,7 +782,8 @@ static __devinit int wm8750_i2c_probe(struct i2c_client *i2c,
792 struct wm8750_priv *wm8750; 782 struct wm8750_priv *wm8750;
793 int ret; 783 int ret;
794 784
795 wm8750 = kzalloc(sizeof(struct wm8750_priv), GFP_KERNEL); 785 wm8750 = devm_kzalloc(&i2c->dev, sizeof(struct wm8750_priv),
786 GFP_KERNEL);
796 if (wm8750 == NULL) 787 if (wm8750 == NULL)
797 return -ENOMEM; 788 return -ENOMEM;
798 789
@@ -801,15 +792,12 @@ static __devinit int wm8750_i2c_probe(struct i2c_client *i2c,
801 792
802 ret = snd_soc_register_codec(&i2c->dev, 793 ret = snd_soc_register_codec(&i2c->dev,
803 &soc_codec_dev_wm8750, &wm8750_dai, 1); 794 &soc_codec_dev_wm8750, &wm8750_dai, 1);
804 if (ret < 0)
805 kfree(wm8750);
806 return ret; 795 return ret;
807} 796}
808 797
809static __devexit int wm8750_i2c_remove(struct i2c_client *client) 798static __devexit int wm8750_i2c_remove(struct i2c_client *client)
810{ 799{
811 snd_soc_unregister_codec(&client->dev); 800 snd_soc_unregister_codec(&client->dev);
812 kfree(i2c_get_clientdata(client));
813 return 0; 801 return 0;
814} 802}
815 803
diff --git a/sound/soc/codecs/wm8753.c b/sound/soc/codecs/wm8753.c
index 3a629d0d690..b114c19f530 100644
--- a/sound/soc/codecs/wm8753.c
+++ b/sound/soc/codecs/wm8753.c
@@ -39,7 +39,6 @@
39#include <linux/pm.h> 39#include <linux/pm.h>
40#include <linux/i2c.h> 40#include <linux/i2c.h>
41#include <linux/of_device.h> 41#include <linux/of_device.h>
42#include <linux/platform_device.h>
43#include <linux/spi/spi.h> 42#include <linux/spi/spi.h>
44#include <linux/slab.h> 43#include <linux/slab.h>
45#include <sound/core.h> 44#include <sound/core.h>
@@ -486,7 +485,7 @@ SND_SOC_DAPM_INPUT("MIC2"),
486SND_SOC_DAPM_VMID("VREF"), 485SND_SOC_DAPM_VMID("VREF"),
487}; 486};
488 487
489static const struct snd_soc_dapm_route audio_map[] = { 488static const struct snd_soc_dapm_route wm8753_dapm_routes[] = {
490 /* left mixer */ 489 /* left mixer */
491 {"Left Mixer", "Left Playback Switch", "Left DAC"}, 490 {"Left Mixer", "Left Playback Switch", "Left DAC"},
492 {"Left Mixer", "Voice Playback Switch", "Voice DAC"}, 491 {"Left Mixer", "Voice Playback Switch", "Voice DAC"},
@@ -640,17 +639,6 @@ static const struct snd_soc_dapm_route audio_map[] = {
640 {"ACOP", NULL, "ALC Mixer"}, 639 {"ACOP", NULL, "ALC Mixer"},
641}; 640};
642 641
643static int wm8753_add_widgets(struct snd_soc_codec *codec)
644{
645 struct snd_soc_dapm_context *dapm = &codec->dapm;
646
647 snd_soc_dapm_new_controls(dapm, wm8753_dapm_widgets,
648 ARRAY_SIZE(wm8753_dapm_widgets));
649 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
650
651 return 0;
652}
653
654/* PLL divisors */ 642/* PLL divisors */
655struct _pll_div { 643struct _pll_div {
656 u32 div2:1; 644 u32 div2:1;
@@ -1326,7 +1314,7 @@ static int wm8753_set_bias_level(struct snd_soc_codec *codec,
1326 * 3. Voice disabled - HIFI over HIFI 1314 * 3. Voice disabled - HIFI over HIFI
1327 * 4. Voice disabled - HIFI over HIFI, uses voice DAI LRC for capture 1315 * 4. Voice disabled - HIFI over HIFI, uses voice DAI LRC for capture
1328 */ 1316 */
1329static struct snd_soc_dai_ops wm8753_dai_ops_hifi_mode = { 1317static const struct snd_soc_dai_ops wm8753_dai_ops_hifi_mode = {
1330 .hw_params = wm8753_i2s_hw_params, 1318 .hw_params = wm8753_i2s_hw_params,
1331 .digital_mute = wm8753_mute, 1319 .digital_mute = wm8753_mute,
1332 .set_fmt = wm8753_hifi_set_dai_fmt, 1320 .set_fmt = wm8753_hifi_set_dai_fmt,
@@ -1335,7 +1323,7 @@ static struct snd_soc_dai_ops wm8753_dai_ops_hifi_mode = {
1335 .set_sysclk = wm8753_set_dai_sysclk, 1323 .set_sysclk = wm8753_set_dai_sysclk,
1336}; 1324};
1337 1325
1338static struct snd_soc_dai_ops wm8753_dai_ops_voice_mode = { 1326static const struct snd_soc_dai_ops wm8753_dai_ops_voice_mode = {
1339 .hw_params = wm8753_pcm_hw_params, 1327 .hw_params = wm8753_pcm_hw_params,
1340 .digital_mute = wm8753_mute, 1328 .digital_mute = wm8753_mute,
1341 .set_fmt = wm8753_voice_set_dai_fmt, 1329 .set_fmt = wm8753_voice_set_dai_fmt,
@@ -1392,7 +1380,7 @@ static void wm8753_work(struct work_struct *work)
1392 wm8753_set_bias_level(codec, dapm->bias_level); 1380 wm8753_set_bias_level(codec, dapm->bias_level);
1393} 1381}
1394 1382
1395static int wm8753_suspend(struct snd_soc_codec *codec, pm_message_t state) 1383static int wm8753_suspend(struct snd_soc_codec *codec)
1396{ 1384{
1397 wm8753_set_bias_level(codec, SND_SOC_BIAS_OFF); 1385 wm8753_set_bias_level(codec, SND_SOC_BIAS_OFF);
1398 return 0; 1386 return 0;
@@ -1467,10 +1455,6 @@ static int wm8753_probe(struct snd_soc_codec *codec)
1467 snd_soc_update_bits(codec, WM8753_LINVOL, 0x0100, 0x0100); 1455 snd_soc_update_bits(codec, WM8753_LINVOL, 0x0100, 0x0100);
1468 snd_soc_update_bits(codec, WM8753_RINVOL, 0x0100, 0x0100); 1456 snd_soc_update_bits(codec, WM8753_RINVOL, 0x0100, 0x0100);
1469 1457
1470 snd_soc_add_controls(codec, wm8753_snd_controls,
1471 ARRAY_SIZE(wm8753_snd_controls));
1472 wm8753_add_widgets(codec);
1473
1474 return 0; 1458 return 0;
1475} 1459}
1476 1460
@@ -1492,6 +1476,13 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8753 = {
1492 .reg_cache_size = ARRAY_SIZE(wm8753_reg), 1476 .reg_cache_size = ARRAY_SIZE(wm8753_reg),
1493 .reg_word_size = sizeof(u16), 1477 .reg_word_size = sizeof(u16),
1494 .reg_cache_default = wm8753_reg, 1478 .reg_cache_default = wm8753_reg,
1479
1480 .controls = wm8753_snd_controls,
1481 .num_controls = ARRAY_SIZE(wm8753_snd_controls),
1482 .dapm_widgets = wm8753_dapm_widgets,
1483 .num_dapm_widgets = ARRAY_SIZE(wm8753_dapm_widgets),
1484 .dapm_routes = wm8753_dapm_routes,
1485 .num_dapm_routes = ARRAY_SIZE(wm8753_dapm_routes),
1495}; 1486};
1496 1487
1497static const struct of_device_id wm8753_of_match[] = { 1488static const struct of_device_id wm8753_of_match[] = {
diff --git a/sound/soc/codecs/wm8770.c b/sound/soc/codecs/wm8770.c
index aa05e6507f8..19374a9e5ba 100644
--- a/sound/soc/codecs/wm8770.c
+++ b/sound/soc/codecs/wm8770.c
@@ -16,7 +16,6 @@
16#include <linux/delay.h> 16#include <linux/delay.h>
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/platform_device.h>
20#include <linux/spi/spi.h> 19#include <linux/spi/spi.h>
21#include <linux/regulator/consumer.h> 20#include <linux/regulator/consumer.h>
22#include <linux/slab.h> 21#include <linux/slab.h>
@@ -528,7 +527,7 @@ static int wm8770_set_bias_level(struct snd_soc_codec *codec,
528#define WM8770_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \ 527#define WM8770_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \
529 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE) 528 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE)
530 529
531static struct snd_soc_dai_ops wm8770_dai_ops = { 530static const struct snd_soc_dai_ops wm8770_dai_ops = {
532 .digital_mute = wm8770_mute, 531 .digital_mute = wm8770_mute,
533 .hw_params = wm8770_hw_params, 532 .hw_params = wm8770_hw_params,
534 .set_fmt = wm8770_set_fmt, 533 .set_fmt = wm8770_set_fmt,
@@ -556,7 +555,7 @@ static struct snd_soc_dai_driver wm8770_dai = {
556}; 555};
557 556
558#ifdef CONFIG_PM 557#ifdef CONFIG_PM
559static int wm8770_suspend(struct snd_soc_codec *codec, pm_message_t state) 558static int wm8770_suspend(struct snd_soc_codec *codec)
560{ 559{
561 wm8770_set_bias_level(codec, SND_SOC_BIAS_OFF); 560 wm8770_set_bias_level(codec, SND_SOC_BIAS_OFF);
562 return 0; 561 return 0;
@@ -691,13 +690,13 @@ static const struct of_device_id wm8770_of_match[] = {
691}; 690};
692MODULE_DEVICE_TABLE(of, wm8770_of_match); 691MODULE_DEVICE_TABLE(of, wm8770_of_match);
693 692
694#if defined(CONFIG_SPI_MASTER)
695static int __devinit wm8770_spi_probe(struct spi_device *spi) 693static int __devinit wm8770_spi_probe(struct spi_device *spi)
696{ 694{
697 struct wm8770_priv *wm8770; 695 struct wm8770_priv *wm8770;
698 int ret; 696 int ret;
699 697
700 wm8770 = kzalloc(sizeof(struct wm8770_priv), GFP_KERNEL); 698 wm8770 = devm_kzalloc(&spi->dev, sizeof(struct wm8770_priv),
699 GFP_KERNEL);
701 if (!wm8770) 700 if (!wm8770)
702 return -ENOMEM; 701 return -ENOMEM;
703 702
@@ -706,15 +705,13 @@ static int __devinit wm8770_spi_probe(struct spi_device *spi)
706 705
707 ret = snd_soc_register_codec(&spi->dev, 706 ret = snd_soc_register_codec(&spi->dev,
708 &soc_codec_dev_wm8770, &wm8770_dai, 1); 707 &soc_codec_dev_wm8770, &wm8770_dai, 1);
709 if (ret < 0) 708
710 kfree(wm8770);
711 return ret; 709 return ret;
712} 710}
713 711
714static int __devexit wm8770_spi_remove(struct spi_device *spi) 712static int __devexit wm8770_spi_remove(struct spi_device *spi)
715{ 713{
716 snd_soc_unregister_codec(&spi->dev); 714 snd_soc_unregister_codec(&spi->dev);
717 kfree(spi_get_drvdata(spi));
718 return 0; 715 return 0;
719} 716}
720 717
@@ -727,28 +724,23 @@ static struct spi_driver wm8770_spi_driver = {
727 .probe = wm8770_spi_probe, 724 .probe = wm8770_spi_probe,
728 .remove = __devexit_p(wm8770_spi_remove) 725 .remove = __devexit_p(wm8770_spi_remove)
729}; 726};
730#endif
731 727
732static int __init wm8770_modinit(void) 728static int __init wm8770_modinit(void)
733{ 729{
734 int ret = 0; 730 int ret = 0;
735 731
736#if defined(CONFIG_SPI_MASTER)
737 ret = spi_register_driver(&wm8770_spi_driver); 732 ret = spi_register_driver(&wm8770_spi_driver);
738 if (ret) { 733 if (ret) {
739 printk(KERN_ERR "Failed to register wm8770 SPI driver: %d\n", 734 printk(KERN_ERR "Failed to register wm8770 SPI driver: %d\n",
740 ret); 735 ret);
741 } 736 }
742#endif
743 return ret; 737 return ret;
744} 738}
745module_init(wm8770_modinit); 739module_init(wm8770_modinit);
746 740
747static void __exit wm8770_exit(void) 741static void __exit wm8770_exit(void)
748{ 742{
749#if defined(CONFIG_SPI_MASTER)
750 spi_unregister_driver(&wm8770_spi_driver); 743 spi_unregister_driver(&wm8770_spi_driver);
751#endif
752} 744}
753module_exit(wm8770_exit); 745module_exit(wm8770_exit);
754 746
diff --git a/sound/soc/codecs/wm8776.c b/sound/soc/codecs/wm8776.c
index bfdc52370ad..33e97d1d8f4 100644
--- a/sound/soc/codecs/wm8776.c
+++ b/sound/soc/codecs/wm8776.c
@@ -19,7 +19,6 @@
19#include <linux/pm.h> 19#include <linux/pm.h>
20#include <linux/i2c.h> 20#include <linux/i2c.h>
21#include <linux/of_device.h> 21#include <linux/of_device.h>
22#include <linux/platform_device.h>
23#include <linux/spi/spi.h> 22#include <linux/spi/spi.h>
24#include <linux/slab.h> 23#include <linux/slab.h>
25#include <sound/core.h> 24#include <sound/core.h>
@@ -235,6 +234,7 @@ static int wm8776_hw_params(struct snd_pcm_substream *substream,
235 switch (snd_pcm_format_width(params_format(params))) { 234 switch (snd_pcm_format_width(params_format(params))) {
236 case 16: 235 case 16:
237 iface = 0; 236 iface = 0;
237 break;
238 case 20: 238 case 20:
239 iface = 0x10; 239 iface = 0x10;
240 break; 240 break;
@@ -327,14 +327,14 @@ static int wm8776_set_bias_level(struct snd_soc_codec *codec,
327#define WM8776_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ 327#define WM8776_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\
328 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE) 328 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE)
329 329
330static struct snd_soc_dai_ops wm8776_dac_ops = { 330static const struct snd_soc_dai_ops wm8776_dac_ops = {
331 .digital_mute = wm8776_mute, 331 .digital_mute = wm8776_mute,
332 .hw_params = wm8776_hw_params, 332 .hw_params = wm8776_hw_params,
333 .set_fmt = wm8776_set_fmt, 333 .set_fmt = wm8776_set_fmt,
334 .set_sysclk = wm8776_set_sysclk, 334 .set_sysclk = wm8776_set_sysclk,
335}; 335};
336 336
337static struct snd_soc_dai_ops wm8776_adc_ops = { 337static const struct snd_soc_dai_ops wm8776_adc_ops = {
338 .hw_params = wm8776_hw_params, 338 .hw_params = wm8776_hw_params,
339 .set_fmt = wm8776_set_fmt, 339 .set_fmt = wm8776_set_fmt,
340 .set_sysclk = wm8776_set_sysclk, 340 .set_sysclk = wm8776_set_sysclk,
@@ -372,7 +372,7 @@ static struct snd_soc_dai_driver wm8776_dai[] = {
372}; 372};
373 373
374#ifdef CONFIG_PM 374#ifdef CONFIG_PM
375static int wm8776_suspend(struct snd_soc_codec *codec, pm_message_t state) 375static int wm8776_suspend(struct snd_soc_codec *codec)
376{ 376{
377 wm8776_set_bias_level(codec, SND_SOC_BIAS_OFF); 377 wm8776_set_bias_level(codec, SND_SOC_BIAS_OFF);
378 378
@@ -392,7 +392,6 @@ static int wm8776_resume(struct snd_soc_codec *codec)
392static int wm8776_probe(struct snd_soc_codec *codec) 392static int wm8776_probe(struct snd_soc_codec *codec)
393{ 393{
394 struct wm8776_priv *wm8776 = snd_soc_codec_get_drvdata(codec); 394 struct wm8776_priv *wm8776 = snd_soc_codec_get_drvdata(codec);
395 struct snd_soc_dapm_context *dapm = &codec->dapm;
396 int ret = 0; 395 int ret = 0;
397 396
398 ret = snd_soc_codec_set_cache_io(codec, 7, 9, wm8776->control_type); 397 ret = snd_soc_codec_set_cache_io(codec, 7, 9, wm8776->control_type);
@@ -414,12 +413,6 @@ static int wm8776_probe(struct snd_soc_codec *codec)
414 snd_soc_update_bits(codec, WM8776_HPRVOL, 0x100, 0x100); 413 snd_soc_update_bits(codec, WM8776_HPRVOL, 0x100, 0x100);
415 snd_soc_update_bits(codec, WM8776_DACRVOL, 0x100, 0x100); 414 snd_soc_update_bits(codec, WM8776_DACRVOL, 0x100, 0x100);
416 415
417 snd_soc_add_controls(codec, wm8776_snd_controls,
418 ARRAY_SIZE(wm8776_snd_controls));
419 snd_soc_dapm_new_controls(dapm, wm8776_dapm_widgets,
420 ARRAY_SIZE(wm8776_dapm_widgets));
421 snd_soc_dapm_add_routes(dapm, routes, ARRAY_SIZE(routes));
422
423 return ret; 416 return ret;
424} 417}
425 418
@@ -439,6 +432,13 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8776 = {
439 .reg_cache_size = ARRAY_SIZE(wm8776_reg), 432 .reg_cache_size = ARRAY_SIZE(wm8776_reg),
440 .reg_word_size = sizeof(u16), 433 .reg_word_size = sizeof(u16),
441 .reg_cache_default = wm8776_reg, 434 .reg_cache_default = wm8776_reg,
435
436 .controls = wm8776_snd_controls,
437 .num_controls = ARRAY_SIZE(wm8776_snd_controls),
438 .dapm_widgets = wm8776_dapm_widgets,
439 .num_dapm_widgets = ARRAY_SIZE(wm8776_dapm_widgets),
440 .dapm_routes = routes,
441 .num_dapm_routes = ARRAY_SIZE(routes),
442}; 442};
443 443
444static const struct of_device_id wm8776_of_match[] = { 444static const struct of_device_id wm8776_of_match[] = {
@@ -453,7 +453,8 @@ static int __devinit wm8776_spi_probe(struct spi_device *spi)
453 struct wm8776_priv *wm8776; 453 struct wm8776_priv *wm8776;
454 int ret; 454 int ret;
455 455
456 wm8776 = kzalloc(sizeof(struct wm8776_priv), GFP_KERNEL); 456 wm8776 = devm_kzalloc(&spi->dev, sizeof(struct wm8776_priv),
457 GFP_KERNEL);
457 if (wm8776 == NULL) 458 if (wm8776 == NULL)
458 return -ENOMEM; 459 return -ENOMEM;
459 460
@@ -462,15 +463,13 @@ static int __devinit wm8776_spi_probe(struct spi_device *spi)
462 463
463 ret = snd_soc_register_codec(&spi->dev, 464 ret = snd_soc_register_codec(&spi->dev,
464 &soc_codec_dev_wm8776, wm8776_dai, ARRAY_SIZE(wm8776_dai)); 465 &soc_codec_dev_wm8776, wm8776_dai, ARRAY_SIZE(wm8776_dai));
465 if (ret < 0) 466
466 kfree(wm8776);
467 return ret; 467 return ret;
468} 468}
469 469
470static int __devexit wm8776_spi_remove(struct spi_device *spi) 470static int __devexit wm8776_spi_remove(struct spi_device *spi)
471{ 471{
472 snd_soc_unregister_codec(&spi->dev); 472 snd_soc_unregister_codec(&spi->dev);
473 kfree(spi_get_drvdata(spi));
474 return 0; 473 return 0;
475} 474}
476 475
@@ -492,7 +491,8 @@ static __devinit int wm8776_i2c_probe(struct i2c_client *i2c,
492 struct wm8776_priv *wm8776; 491 struct wm8776_priv *wm8776;
493 int ret; 492 int ret;
494 493
495 wm8776 = kzalloc(sizeof(struct wm8776_priv), GFP_KERNEL); 494 wm8776 = devm_kzalloc(&i2c->dev, sizeof(struct wm8776_priv),
495 GFP_KERNEL);
496 if (wm8776 == NULL) 496 if (wm8776 == NULL)
497 return -ENOMEM; 497 return -ENOMEM;
498 498
@@ -501,15 +501,13 @@ static __devinit int wm8776_i2c_probe(struct i2c_client *i2c,
501 501
502 ret = snd_soc_register_codec(&i2c->dev, 502 ret = snd_soc_register_codec(&i2c->dev,
503 &soc_codec_dev_wm8776, wm8776_dai, ARRAY_SIZE(wm8776_dai)); 503 &soc_codec_dev_wm8776, wm8776_dai, ARRAY_SIZE(wm8776_dai));
504 if (ret < 0) 504
505 kfree(wm8776);
506 return ret; 505 return ret;
507} 506}
508 507
509static __devexit int wm8776_i2c_remove(struct i2c_client *client) 508static __devexit int wm8776_i2c_remove(struct i2c_client *client)
510{ 509{
511 snd_soc_unregister_codec(&client->dev); 510 snd_soc_unregister_codec(&client->dev);
512 kfree(i2c_get_clientdata(client));
513 return 0; 511 return 0;
514} 512}
515 513
diff --git a/sound/soc/codecs/wm8782.c b/sound/soc/codecs/wm8782.c
index f2ced71328b..3fdea98f732 100644
--- a/sound/soc/codecs/wm8782.c
+++ b/sound/soc/codecs/wm8782.c
@@ -63,17 +63,7 @@ static struct platform_driver wm8782_codec_driver = {
63 .remove = __devexit_p(wm8782_remove), 63 .remove = __devexit_p(wm8782_remove),
64}; 64};
65 65
66static int __init wm8782_init(void) 66module_platform_driver(wm8782_codec_driver);
67{
68 return platform_driver_register(&wm8782_codec_driver);
69}
70module_init(wm8782_init);
71
72static void __exit wm8782_exit(void)
73{
74 platform_driver_unregister(&wm8782_codec_driver);
75}
76module_exit(wm8782_exit);
77 67
78MODULE_DESCRIPTION("ASoC WM8782 driver"); 68MODULE_DESCRIPTION("ASoC WM8782 driver");
79MODULE_AUTHOR("Johannes Stezenbach <js@sig21.net>"); 69MODULE_AUTHOR("Johannes Stezenbach <js@sig21.net>");
diff --git a/sound/soc/codecs/wm8804.c b/sound/soc/codecs/wm8804.c
index 9ee072b8597..d54a3ca5e19 100644
--- a/sound/soc/codecs/wm8804.c
+++ b/sound/soc/codecs/wm8804.c
@@ -542,7 +542,7 @@ static int wm8804_set_bias_level(struct snd_soc_codec *codec,
542} 542}
543 543
544#ifdef CONFIG_PM 544#ifdef CONFIG_PM
545static int wm8804_suspend(struct snd_soc_codec *codec, pm_message_t state) 545static int wm8804_suspend(struct snd_soc_codec *codec)
546{ 546{
547 wm8804_set_bias_level(codec, SND_SOC_BIAS_OFF); 547 wm8804_set_bias_level(codec, SND_SOC_BIAS_OFF);
548 return 0; 548 return 0;
@@ -659,8 +659,6 @@ static int wm8804_probe(struct snd_soc_codec *codec)
659 659
660 wm8804_set_bias_level(codec, SND_SOC_BIAS_STANDBY); 660 wm8804_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
661 661
662 snd_soc_add_controls(codec, wm8804_snd_controls,
663 ARRAY_SIZE(wm8804_snd_controls));
664 return 0; 662 return 0;
665 663
666err_reg_enable: 664err_reg_enable:
@@ -670,7 +668,7 @@ err_reg_get:
670 return ret; 668 return ret;
671} 669}
672 670
673static struct snd_soc_dai_ops wm8804_dai_ops = { 671static const struct snd_soc_dai_ops wm8804_dai_ops = {
674 .hw_params = wm8804_hw_params, 672 .hw_params = wm8804_hw_params,
675 .set_fmt = wm8804_set_fmt, 673 .set_fmt = wm8804_set_fmt,
676 .set_sysclk = wm8804_set_sysclk, 674 .set_sysclk = wm8804_set_sysclk,
@@ -715,7 +713,10 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8804 = {
715 .reg_cache_size = ARRAY_SIZE(wm8804_reg_defs), 713 .reg_cache_size = ARRAY_SIZE(wm8804_reg_defs),
716 .reg_word_size = sizeof(u8), 714 .reg_word_size = sizeof(u8),
717 .reg_cache_default = wm8804_reg_defs, 715 .reg_cache_default = wm8804_reg_defs,
718 .volatile_register = wm8804_volatile 716 .volatile_register = wm8804_volatile,
717
718 .controls = wm8804_snd_controls,
719 .num_controls = ARRAY_SIZE(wm8804_snd_controls),
719}; 720};
720 721
721static const struct of_device_id wm8804_of_match[] = { 722static const struct of_device_id wm8804_of_match[] = {
diff --git a/sound/soc/codecs/wm8900.c b/sound/soc/codecs/wm8900.c
index 3d0dc1591ec..f18c554efc9 100644
--- a/sound/soc/codecs/wm8900.c
+++ b/sound/soc/codecs/wm8900.c
@@ -24,7 +24,6 @@
24#include <linux/pm.h> 24#include <linux/pm.h>
25#include <linux/i2c.h> 25#include <linux/i2c.h>
26#include <linux/spi/spi.h> 26#include <linux/spi/spi.h>
27#include <linux/platform_device.h>
28#include <linux/slab.h> 27#include <linux/slab.h>
29#include <sound/core.h> 28#include <sound/core.h>
30#include <sound/pcm.h> 29#include <sound/pcm.h>
@@ -513,7 +512,7 @@ SND_SOC_DAPM_MIXER("Right Input Mixer", WM8900_REG_POWER2, 4, 0,
513 wm8900_rinmix_controls, 512 wm8900_rinmix_controls,
514 ARRAY_SIZE(wm8900_rinmix_controls)), 513 ARRAY_SIZE(wm8900_rinmix_controls)),
515 514
516SND_SOC_DAPM_MICBIAS("Mic Bias", WM8900_REG_POWER1, 4, 0), 515SND_SOC_DAPM_SUPPLY("Mic Bias", WM8900_REG_POWER1, 4, 0, NULL, 0),
517 516
518SND_SOC_DAPM_ADC("ADCL", "Left HiFi Capture", WM8900_REG_POWER2, 1, 0), 517SND_SOC_DAPM_ADC("ADCL", "Left HiFi Capture", WM8900_REG_POWER2, 1, 0),
519SND_SOC_DAPM_ADC("ADCR", "Right HiFi Capture", WM8900_REG_POWER2, 0, 0), 518SND_SOC_DAPM_ADC("ADCR", "Right HiFi Capture", WM8900_REG_POWER2, 0, 0),
@@ -543,7 +542,7 @@ SND_SOC_DAPM_MIXER("Right Output Mixer", WM8900_REG_POWER3, 2, 0,
543}; 542};
544 543
545/* Target, Path, Source */ 544/* Target, Path, Source */
546static const struct snd_soc_dapm_route audio_map[] = { 545static const struct snd_soc_dapm_route wm8900_dapm_routes[] = {
547/* Inputs */ 546/* Inputs */
548{"Left Input PGA", "LINPUT1 Switch", "LINPUT1"}, 547{"Left Input PGA", "LINPUT1 Switch", "LINPUT1"},
549{"Left Input PGA", "LINPUT2 Switch", "LINPUT2"}, 548{"Left Input PGA", "LINPUT2 Switch", "LINPUT2"},
@@ -607,17 +606,6 @@ static const struct snd_soc_dapm_route audio_map[] = {
607{"HP_R", NULL, "Headphone Amplifier"}, 606{"HP_R", NULL, "Headphone Amplifier"},
608}; 607};
609 608
610static int wm8900_add_widgets(struct snd_soc_codec *codec)
611{
612 struct snd_soc_dapm_context *dapm = &codec->dapm;
613
614 snd_soc_dapm_new_controls(dapm, wm8900_dapm_widgets,
615 ARRAY_SIZE(wm8900_dapm_widgets));
616 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
617
618 return 0;
619}
620
621static int wm8900_hw_params(struct snd_pcm_substream *substream, 609static int wm8900_hw_params(struct snd_pcm_substream *substream,
622 struct snd_pcm_hw_params *params, 610 struct snd_pcm_hw_params *params,
623 struct snd_soc_dai *dai) 611 struct snd_soc_dai *dai)
@@ -987,7 +975,7 @@ static int wm8900_digital_mute(struct snd_soc_dai *codec_dai, int mute)
987 (SNDRV_PCM_FORMAT_S16_LE | SNDRV_PCM_FORMAT_S20_3LE | \ 975 (SNDRV_PCM_FORMAT_S16_LE | SNDRV_PCM_FORMAT_S20_3LE | \
988 SNDRV_PCM_FORMAT_S24_LE) 976 SNDRV_PCM_FORMAT_S24_LE)
989 977
990static struct snd_soc_dai_ops wm8900_dai_ops = { 978static const struct snd_soc_dai_ops wm8900_dai_ops = {
991 .hw_params = wm8900_hw_params, 979 .hw_params = wm8900_hw_params,
992 .set_clkdiv = wm8900_set_dai_clkdiv, 980 .set_clkdiv = wm8900_set_dai_clkdiv,
993 .set_pll = wm8900_set_dai_pll, 981 .set_pll = wm8900_set_dai_pll,
@@ -1107,7 +1095,7 @@ static int wm8900_set_bias_level(struct snd_soc_codec *codec,
1107 return 0; 1095 return 0;
1108} 1096}
1109 1097
1110static int wm8900_suspend(struct snd_soc_codec *codec, pm_message_t state) 1098static int wm8900_suspend(struct snd_soc_codec *codec)
1111{ 1099{
1112 struct wm8900_priv *wm8900 = snd_soc_codec_get_drvdata(codec); 1100 struct wm8900_priv *wm8900 = snd_soc_codec_get_drvdata(codec);
1113 int fll_out = wm8900->fll_out; 1101 int fll_out = wm8900->fll_out;
@@ -1204,10 +1192,6 @@ static int wm8900_probe(struct snd_soc_codec *codec)
1204 /* Set the DAC and mixer output bias */ 1192 /* Set the DAC and mixer output bias */
1205 snd_soc_write(codec, WM8900_REG_OUTBIASCTL, 0x81); 1193 snd_soc_write(codec, WM8900_REG_OUTBIASCTL, 0x81);
1206 1194
1207 snd_soc_add_controls(codec, wm8900_snd_controls,
1208 ARRAY_SIZE(wm8900_snd_controls));
1209 wm8900_add_widgets(codec);
1210
1211 return 0; 1195 return 0;
1212} 1196}
1213 1197
@@ -1228,6 +1212,13 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8900 = {
1228 .reg_cache_size = ARRAY_SIZE(wm8900_reg_defaults), 1212 .reg_cache_size = ARRAY_SIZE(wm8900_reg_defaults),
1229 .reg_word_size = sizeof(u16), 1213 .reg_word_size = sizeof(u16),
1230 .reg_cache_default = wm8900_reg_defaults, 1214 .reg_cache_default = wm8900_reg_defaults,
1215
1216 .controls = wm8900_snd_controls,
1217 .num_controls = ARRAY_SIZE(wm8900_snd_controls),
1218 .dapm_widgets = wm8900_dapm_widgets,
1219 .num_dapm_widgets = ARRAY_SIZE(wm8900_dapm_widgets),
1220 .dapm_routes = wm8900_dapm_routes,
1221 .num_dapm_routes = ARRAY_SIZE(wm8900_dapm_routes),
1231}; 1222};
1232 1223
1233#if defined(CONFIG_SPI_MASTER) 1224#if defined(CONFIG_SPI_MASTER)
@@ -1259,7 +1250,7 @@ static int __devexit wm8900_spi_remove(struct spi_device *spi)
1259 1250
1260static struct spi_driver wm8900_spi_driver = { 1251static struct spi_driver wm8900_spi_driver = {
1261 .driver = { 1252 .driver = {
1262 .name = "wm8900-codec", 1253 .name = "wm8900",
1263 .owner = THIS_MODULE, 1254 .owner = THIS_MODULE,
1264 }, 1255 },
1265 .probe = wm8900_spi_probe, 1256 .probe = wm8900_spi_probe,
@@ -1303,7 +1294,7 @@ MODULE_DEVICE_TABLE(i2c, wm8900_i2c_id);
1303 1294
1304static struct i2c_driver wm8900_i2c_driver = { 1295static struct i2c_driver wm8900_i2c_driver = {
1305 .driver = { 1296 .driver = {
1306 .name = "wm8900-codec", 1297 .name = "wm8900",
1307 .owner = THIS_MODULE, 1298 .owner = THIS_MODULE,
1308 }, 1299 },
1309 .probe = wm8900_i2c_probe, 1300 .probe = wm8900_i2c_probe,
diff --git a/sound/soc/codecs/wm8903.c b/sound/soc/codecs/wm8903.c
index 4ad8ebd290e..c91fb2f99c1 100644
--- a/sound/soc/codecs/wm8903.c
+++ b/sound/soc/codecs/wm8903.c
@@ -23,8 +23,9 @@
23#include <linux/gpio.h> 23#include <linux/gpio.h>
24#include <linux/pm.h> 24#include <linux/pm.h>
25#include <linux/i2c.h> 25#include <linux/i2c.h>
26#include <linux/platform_device.h> 26#include <linux/regmap.h>
27#include <linux/slab.h> 27#include <linux/slab.h>
28#include <linux/irq.h>
28#include <sound/core.h> 29#include <sound/core.h>
29#include <sound/jack.h> 30#include <sound/jack.h>
30#include <sound/pcm.h> 31#include <sound/pcm.h>
@@ -38,184 +39,85 @@
38#include "wm8903.h" 39#include "wm8903.h"
39 40
40/* Register defaults at reset */ 41/* Register defaults at reset */
41static u16 wm8903_reg_defaults[] = { 42static const struct reg_default wm8903_reg_defaults[] = {
42 0x8903, /* R0 - SW Reset and ID */ 43 { 4, 0x0018 }, /* R4 - Bias Control 0 */
43 0x0000, /* R1 - Revision Number */ 44 { 5, 0x0000 }, /* R5 - VMID Control 0 */
44 0x0000, /* R2 */ 45 { 6, 0x0000 }, /* R6 - Mic Bias Control 0 */
45 0x0000, /* R3 */ 46 { 8, 0x0001 }, /* R8 - Analogue DAC 0 */
46 0x0018, /* R4 - Bias Control 0 */ 47 { 10, 0x0001 }, /* R10 - Analogue ADC 0 */
47 0x0000, /* R5 - VMID Control 0 */ 48 { 12, 0x0000 }, /* R12 - Power Management 0 */
48 0x0000, /* R6 - Mic Bias Control 0 */ 49 { 13, 0x0000 }, /* R13 - Power Management 1 */
49 0x0000, /* R7 */ 50 { 14, 0x0000 }, /* R14 - Power Management 2 */
50 0x0001, /* R8 - Analogue DAC 0 */ 51 { 15, 0x0000 }, /* R15 - Power Management 3 */
51 0x0000, /* R9 */ 52 { 16, 0x0000 }, /* R16 - Power Management 4 */
52 0x0001, /* R10 - Analogue ADC 0 */ 53 { 17, 0x0000 }, /* R17 - Power Management 5 */
53 0x0000, /* R11 */ 54 { 18, 0x0000 }, /* R18 - Power Management 6 */
54 0x0000, /* R12 - Power Management 0 */ 55 { 20, 0x0400 }, /* R20 - Clock Rates 0 */
55 0x0000, /* R13 - Power Management 1 */ 56 { 21, 0x0D07 }, /* R21 - Clock Rates 1 */
56 0x0000, /* R14 - Power Management 2 */ 57 { 22, 0x0000 }, /* R22 - Clock Rates 2 */
57 0x0000, /* R15 - Power Management 3 */ 58 { 24, 0x0050 }, /* R24 - Audio Interface 0 */
58 0x0000, /* R16 - Power Management 4 */ 59 { 25, 0x0242 }, /* R25 - Audio Interface 1 */
59 0x0000, /* R17 - Power Management 5 */ 60 { 26, 0x0008 }, /* R26 - Audio Interface 2 */
60 0x0000, /* R18 - Power Management 6 */ 61 { 27, 0x0022 }, /* R27 - Audio Interface 3 */
61 0x0000, /* R19 */ 62 { 30, 0x00C0 }, /* R30 - DAC Digital Volume Left */
62 0x0400, /* R20 - Clock Rates 0 */ 63 { 31, 0x00C0 }, /* R31 - DAC Digital Volume Right */
63 0x0D07, /* R21 - Clock Rates 1 */ 64 { 32, 0x0000 }, /* R32 - DAC Digital 0 */
64 0x0000, /* R22 - Clock Rates 2 */ 65 { 33, 0x0000 }, /* R33 - DAC Digital 1 */
65 0x0000, /* R23 */ 66 { 36, 0x00C0 }, /* R36 - ADC Digital Volume Left */
66 0x0050, /* R24 - Audio Interface 0 */ 67 { 37, 0x00C0 }, /* R37 - ADC Digital Volume Right */
67 0x0242, /* R25 - Audio Interface 1 */ 68 { 38, 0x0000 }, /* R38 - ADC Digital 0 */
68 0x0008, /* R26 - Audio Interface 2 */ 69 { 39, 0x0073 }, /* R39 - Digital Microphone 0 */
69 0x0022, /* R27 - Audio Interface 3 */ 70 { 40, 0x09BF }, /* R40 - DRC 0 */
70 0x0000, /* R28 */ 71 { 41, 0x3241 }, /* R41 - DRC 1 */
71 0x0000, /* R29 */ 72 { 42, 0x0020 }, /* R42 - DRC 2 */
72 0x00C0, /* R30 - DAC Digital Volume Left */ 73 { 43, 0x0000 }, /* R43 - DRC 3 */
73 0x00C0, /* R31 - DAC Digital Volume Right */ 74 { 44, 0x0085 }, /* R44 - Analogue Left Input 0 */
74 0x0000, /* R32 - DAC Digital 0 */ 75 { 45, 0x0085 }, /* R45 - Analogue Right Input 0 */
75 0x0000, /* R33 - DAC Digital 1 */ 76 { 46, 0x0044 }, /* R46 - Analogue Left Input 1 */
76 0x0000, /* R34 */ 77 { 47, 0x0044 }, /* R47 - Analogue Right Input 1 */
77 0x0000, /* R35 */ 78 { 50, 0x0008 }, /* R50 - Analogue Left Mix 0 */
78 0x00C0, /* R36 - ADC Digital Volume Left */ 79 { 51, 0x0004 }, /* R51 - Analogue Right Mix 0 */
79 0x00C0, /* R37 - ADC Digital Volume Right */ 80 { 52, 0x0000 }, /* R52 - Analogue Spk Mix Left 0 */
80 0x0000, /* R38 - ADC Digital 0 */ 81 { 53, 0x0000 }, /* R53 - Analogue Spk Mix Left 1 */
81 0x0073, /* R39 - Digital Microphone 0 */ 82 { 54, 0x0000 }, /* R54 - Analogue Spk Mix Right 0 */
82 0x09BF, /* R40 - DRC 0 */ 83 { 55, 0x0000 }, /* R55 - Analogue Spk Mix Right 1 */
83 0x3241, /* R41 - DRC 1 */ 84 { 57, 0x002D }, /* R57 - Analogue OUT1 Left */
84 0x0020, /* R42 - DRC 2 */ 85 { 58, 0x002D }, /* R58 - Analogue OUT1 Right */
85 0x0000, /* R43 - DRC 3 */ 86 { 59, 0x0039 }, /* R59 - Analogue OUT2 Left */
86 0x0085, /* R44 - Analogue Left Input 0 */ 87 { 60, 0x0039 }, /* R60 - Analogue OUT2 Right */
87 0x0085, /* R45 - Analogue Right Input 0 */ 88 { 62, 0x0139 }, /* R62 - Analogue OUT3 Left */
88 0x0044, /* R46 - Analogue Left Input 1 */ 89 { 63, 0x0139 }, /* R63 - Analogue OUT3 Right */
89 0x0044, /* R47 - Analogue Right Input 1 */ 90 { 64, 0x0000 }, /* R65 - Analogue SPK Output Control 0 */
90 0x0000, /* R48 */ 91 { 67, 0x0010 }, /* R67 - DC Servo 0 */
91 0x0000, /* R49 */ 92 { 69, 0x00A4 }, /* R69 - DC Servo 2 */
92 0x0008, /* R50 - Analogue Left Mix 0 */ 93 { 90, 0x0000 }, /* R90 - Analogue HP 0 */
93 0x0004, /* R51 - Analogue Right Mix 0 */ 94 { 94, 0x0000 }, /* R94 - Analogue Lineout 0 */
94 0x0000, /* R52 - Analogue Spk Mix Left 0 */ 95 { 98, 0x0000 }, /* R98 - Charge Pump 0 */
95 0x0000, /* R53 - Analogue Spk Mix Left 1 */ 96 { 104, 0x0000 }, /* R104 - Class W 0 */
96 0x0000, /* R54 - Analogue Spk Mix Right 0 */ 97 { 108, 0x0000 }, /* R108 - Write Sequencer 0 */
97 0x0000, /* R55 - Analogue Spk Mix Right 1 */ 98 { 109, 0x0000 }, /* R109 - Write Sequencer 1 */
98 0x0000, /* R56 */ 99 { 110, 0x0000 }, /* R110 - Write Sequencer 2 */
99 0x002D, /* R57 - Analogue OUT1 Left */ 100 { 111, 0x0000 }, /* R111 - Write Sequencer 3 */
100 0x002D, /* R58 - Analogue OUT1 Right */ 101 { 112, 0x0000 }, /* R112 - Write Sequencer 4 */
101 0x0039, /* R59 - Analogue OUT2 Left */ 102 { 114, 0x0000 }, /* R114 - Control Interface */
102 0x0039, /* R60 - Analogue OUT2 Right */ 103 { 116, 0x00A8 }, /* R116 - GPIO Control 1 */
103 0x0100, /* R61 */ 104 { 117, 0x00A8 }, /* R117 - GPIO Control 2 */
104 0x0139, /* R62 - Analogue OUT3 Left */ 105 { 118, 0x00A8 }, /* R118 - GPIO Control 3 */
105 0x0139, /* R63 - Analogue OUT3 Right */ 106 { 119, 0x0220 }, /* R119 - GPIO Control 4 */
106 0x0000, /* R64 */ 107 { 120, 0x01A0 }, /* R120 - GPIO Control 5 */
107 0x0000, /* R65 - Analogue SPK Output Control 0 */ 108 { 122, 0xFFFF }, /* R122 - Interrupt Status 1 Mask */
108 0x0000, /* R66 */ 109 { 123, 0x0000 }, /* R123 - Interrupt Polarity 1 */
109 0x0010, /* R67 - DC Servo 0 */ 110 { 126, 0x0000 }, /* R126 - Interrupt Control */
110 0x0100, /* R68 */ 111 { 129, 0x0000 }, /* R129 - Control Interface Test 1 */
111 0x00A4, /* R69 - DC Servo 2 */ 112 { 149, 0x6810 }, /* R149 - Charge Pump Test 1 */
112 0x0807, /* R70 */ 113 { 164, 0x0028 }, /* R164 - Clock Rate Test 4 */
113 0x0000, /* R71 */ 114 { 172, 0x0000 }, /* R172 - Analogue Output Bias 0 */
114 0x0000, /* R72 */
115 0x0000, /* R73 */
116 0x0000, /* R74 */
117 0x0000, /* R75 */
118 0x0000, /* R76 */
119 0x0000, /* R77 */
120 0x0000, /* R78 */
121 0x000E, /* R79 */
122 0x0000, /* R80 */
123 0x0000, /* R81 */
124 0x0000, /* R82 */
125 0x0000, /* R83 */
126 0x0000, /* R84 */
127 0x0000, /* R85 */
128 0x0000, /* R86 */
129 0x0006, /* R87 */
130 0x0000, /* R88 */
131 0x0000, /* R89 */
132 0x0000, /* R90 - Analogue HP 0 */
133 0x0060, /* R91 */
134 0x0000, /* R92 */
135 0x0000, /* R93 */
136 0x0000, /* R94 - Analogue Lineout 0 */
137 0x0060, /* R95 */
138 0x0000, /* R96 */
139 0x0000, /* R97 */
140 0x0000, /* R98 - Charge Pump 0 */
141 0x1F25, /* R99 */
142 0x2B19, /* R100 */
143 0x01C0, /* R101 */
144 0x01EF, /* R102 */
145 0x2B00, /* R103 */
146 0x0000, /* R104 - Class W 0 */
147 0x01C0, /* R105 */
148 0x1C10, /* R106 */
149 0x0000, /* R107 */
150 0x0000, /* R108 - Write Sequencer 0 */
151 0x0000, /* R109 - Write Sequencer 1 */
152 0x0000, /* R110 - Write Sequencer 2 */
153 0x0000, /* R111 - Write Sequencer 3 */
154 0x0000, /* R112 - Write Sequencer 4 */
155 0x0000, /* R113 */
156 0x0000, /* R114 - Control Interface */
157 0x0000, /* R115 */
158 0x00A8, /* R116 - GPIO Control 1 */
159 0x00A8, /* R117 - GPIO Control 2 */
160 0x00A8, /* R118 - GPIO Control 3 */
161 0x0220, /* R119 - GPIO Control 4 */
162 0x01A0, /* R120 - GPIO Control 5 */
163 0x0000, /* R121 - Interrupt Status 1 */
164 0xFFFF, /* R122 - Interrupt Status 1 Mask */
165 0x0000, /* R123 - Interrupt Polarity 1 */
166 0x0000, /* R124 */
167 0x0003, /* R125 */
168 0x0000, /* R126 - Interrupt Control */
169 0x0000, /* R127 */
170 0x0005, /* R128 */
171 0x0000, /* R129 - Control Interface Test 1 */
172 0x0000, /* R130 */
173 0x0000, /* R131 */
174 0x0000, /* R132 */
175 0x0000, /* R133 */
176 0x0000, /* R134 */
177 0x03FF, /* R135 */
178 0x0007, /* R136 */
179 0x0040, /* R137 */
180 0x0000, /* R138 */
181 0x0000, /* R139 */
182 0x0000, /* R140 */
183 0x0000, /* R141 */
184 0x0000, /* R142 */
185 0x0000, /* R143 */
186 0x0000, /* R144 */
187 0x0000, /* R145 */
188 0x0000, /* R146 */
189 0x0000, /* R147 */
190 0x4000, /* R148 */
191 0x6810, /* R149 - Charge Pump Test 1 */
192 0x0004, /* R150 */
193 0x0000, /* R151 */
194 0x0000, /* R152 */
195 0x0000, /* R153 */
196 0x0000, /* R154 */
197 0x0000, /* R155 */
198 0x0000, /* R156 */
199 0x0000, /* R157 */
200 0x0000, /* R158 */
201 0x0000, /* R159 */
202 0x0000, /* R160 */
203 0x0000, /* R161 */
204 0x0000, /* R162 */
205 0x0000, /* R163 */
206 0x0028, /* R164 - Clock Rate Test 4 */
207 0x0004, /* R165 */
208 0x0000, /* R166 */
209 0x0060, /* R167 */
210 0x0000, /* R168 */
211 0x0000, /* R169 */
212 0x0000, /* R170 */
213 0x0000, /* R171 */
214 0x0000, /* R172 - Analogue Output Bias 0 */
215}; 115};
216 116
217struct wm8903_priv { 117struct wm8903_priv {
118 struct wm8903_platform_data *pdata;
218 struct snd_soc_codec *codec; 119 struct snd_soc_codec *codec;
120 struct regmap *regmap;
219 121
220 int sysclk; 122 int sysclk;
221 int irq; 123 int irq;
@@ -240,7 +142,93 @@ struct wm8903_priv {
240#endif 142#endif
241}; 143};
242 144
243static int wm8903_volatile_register(struct snd_soc_codec *codec, unsigned int reg) 145static bool wm8903_readable_register(struct device *dev, unsigned int reg)
146{
147 switch (reg) {
148 case WM8903_SW_RESET_AND_ID:
149 case WM8903_REVISION_NUMBER:
150 case WM8903_BIAS_CONTROL_0:
151 case WM8903_VMID_CONTROL_0:
152 case WM8903_MIC_BIAS_CONTROL_0:
153 case WM8903_ANALOGUE_DAC_0:
154 case WM8903_ANALOGUE_ADC_0:
155 case WM8903_POWER_MANAGEMENT_0:
156 case WM8903_POWER_MANAGEMENT_1:
157 case WM8903_POWER_MANAGEMENT_2:
158 case WM8903_POWER_MANAGEMENT_3:
159 case WM8903_POWER_MANAGEMENT_4:
160 case WM8903_POWER_MANAGEMENT_5:
161 case WM8903_POWER_MANAGEMENT_6:
162 case WM8903_CLOCK_RATES_0:
163 case WM8903_CLOCK_RATES_1:
164 case WM8903_CLOCK_RATES_2:
165 case WM8903_AUDIO_INTERFACE_0:
166 case WM8903_AUDIO_INTERFACE_1:
167 case WM8903_AUDIO_INTERFACE_2:
168 case WM8903_AUDIO_INTERFACE_3:
169 case WM8903_DAC_DIGITAL_VOLUME_LEFT:
170 case WM8903_DAC_DIGITAL_VOLUME_RIGHT:
171 case WM8903_DAC_DIGITAL_0:
172 case WM8903_DAC_DIGITAL_1:
173 case WM8903_ADC_DIGITAL_VOLUME_LEFT:
174 case WM8903_ADC_DIGITAL_VOLUME_RIGHT:
175 case WM8903_ADC_DIGITAL_0:
176 case WM8903_DIGITAL_MICROPHONE_0:
177 case WM8903_DRC_0:
178 case WM8903_DRC_1:
179 case WM8903_DRC_2:
180 case WM8903_DRC_3:
181 case WM8903_ANALOGUE_LEFT_INPUT_0:
182 case WM8903_ANALOGUE_RIGHT_INPUT_0:
183 case WM8903_ANALOGUE_LEFT_INPUT_1:
184 case WM8903_ANALOGUE_RIGHT_INPUT_1:
185 case WM8903_ANALOGUE_LEFT_MIX_0:
186 case WM8903_ANALOGUE_RIGHT_MIX_0:
187 case WM8903_ANALOGUE_SPK_MIX_LEFT_0:
188 case WM8903_ANALOGUE_SPK_MIX_LEFT_1:
189 case WM8903_ANALOGUE_SPK_MIX_RIGHT_0:
190 case WM8903_ANALOGUE_SPK_MIX_RIGHT_1:
191 case WM8903_ANALOGUE_OUT1_LEFT:
192 case WM8903_ANALOGUE_OUT1_RIGHT:
193 case WM8903_ANALOGUE_OUT2_LEFT:
194 case WM8903_ANALOGUE_OUT2_RIGHT:
195 case WM8903_ANALOGUE_OUT3_LEFT:
196 case WM8903_ANALOGUE_OUT3_RIGHT:
197 case WM8903_ANALOGUE_SPK_OUTPUT_CONTROL_0:
198 case WM8903_DC_SERVO_0:
199 case WM8903_DC_SERVO_2:
200 case WM8903_DC_SERVO_READBACK_1:
201 case WM8903_DC_SERVO_READBACK_2:
202 case WM8903_DC_SERVO_READBACK_3:
203 case WM8903_DC_SERVO_READBACK_4:
204 case WM8903_ANALOGUE_HP_0:
205 case WM8903_ANALOGUE_LINEOUT_0:
206 case WM8903_CHARGE_PUMP_0:
207 case WM8903_CLASS_W_0:
208 case WM8903_WRITE_SEQUENCER_0:
209 case WM8903_WRITE_SEQUENCER_1:
210 case WM8903_WRITE_SEQUENCER_2:
211 case WM8903_WRITE_SEQUENCER_3:
212 case WM8903_WRITE_SEQUENCER_4:
213 case WM8903_CONTROL_INTERFACE:
214 case WM8903_GPIO_CONTROL_1:
215 case WM8903_GPIO_CONTROL_2:
216 case WM8903_GPIO_CONTROL_3:
217 case WM8903_GPIO_CONTROL_4:
218 case WM8903_GPIO_CONTROL_5:
219 case WM8903_INTERRUPT_STATUS_1:
220 case WM8903_INTERRUPT_STATUS_1_MASK:
221 case WM8903_INTERRUPT_POLARITY_1:
222 case WM8903_INTERRUPT_CONTROL:
223 case WM8903_CLOCK_RATE_TEST_4:
224 case WM8903_ANALOGUE_OUTPUT_BIAS_0:
225 return true;
226 default:
227 return false;
228 }
229}
230
231static bool wm8903_volatile_register(struct device *dev, unsigned int reg)
244{ 232{
245 switch (reg) { 233 switch (reg) {
246 case WM8903_SW_RESET_AND_ID: 234 case WM8903_SW_RESET_AND_ID:
@@ -258,13 +246,6 @@ static int wm8903_volatile_register(struct snd_soc_codec *codec, unsigned int re
258 } 246 }
259} 247}
260 248
261static void wm8903_reset(struct snd_soc_codec *codec)
262{
263 snd_soc_write(codec, WM8903_SW_RESET_AND_ID, 0);
264 memcpy(codec->reg_cache, wm8903_reg_defaults,
265 sizeof(wm8903_reg_defaults));
266}
267
268static int wm8903_cp_event(struct snd_soc_dapm_widget *w, 249static int wm8903_cp_event(struct snd_soc_dapm_widget *w,
269 struct snd_kcontrol *kcontrol, int event) 250 struct snd_kcontrol *kcontrol, int event)
270{ 251{
@@ -839,7 +820,7 @@ SND_SOC_DAPM_OUTPUT("LON"),
839SND_SOC_DAPM_OUTPUT("ROP"), 820SND_SOC_DAPM_OUTPUT("ROP"),
840SND_SOC_DAPM_OUTPUT("RON"), 821SND_SOC_DAPM_OUTPUT("RON"),
841 822
842SND_SOC_DAPM_MICBIAS("Mic Bias", WM8903_MIC_BIAS_CONTROL_0, 0, 0), 823SND_SOC_DAPM_SUPPLY("MICBIAS", WM8903_MIC_BIAS_CONTROL_0, 0, 0, NULL, 0),
843 824
844SND_SOC_DAPM_MUX("Left Input Mux", SND_SOC_NOPM, 0, 0, &linput_mux), 825SND_SOC_DAPM_MUX("Left Input Mux", SND_SOC_NOPM, 0, 0, &linput_mux),
845SND_SOC_DAPM_MUX("Left Input Inverting Mux", SND_SOC_NOPM, 0, 0, 826SND_SOC_DAPM_MUX("Left Input Inverting Mux", SND_SOC_NOPM, 0, 0,
@@ -948,7 +929,7 @@ SND_SOC_DAPM_SUPPLY("CLK_SYS", WM8903_CLOCK_RATES_2, 2, 0, NULL, 0),
948static const struct snd_soc_dapm_route wm8903_intercon[] = { 929static const struct snd_soc_dapm_route wm8903_intercon[] = {
949 930
950 { "CLK_DSP", NULL, "CLK_SYS" }, 931 { "CLK_DSP", NULL, "CLK_SYS" },
951 { "Mic Bias", NULL, "CLK_SYS" }, 932 { "MICBIAS", NULL, "CLK_SYS" },
952 { "HPL_DCS", NULL, "CLK_SYS" }, 933 { "HPL_DCS", NULL, "CLK_SYS" },
953 { "HPR_DCS", NULL, "CLK_SYS" }, 934 { "HPR_DCS", NULL, "CLK_SYS" },
954 { "LINEOUTL_DCS", NULL, "CLK_SYS" }, 935 { "LINEOUTL_DCS", NULL, "CLK_SYS" },
@@ -1732,7 +1713,7 @@ static irqreturn_t wm8903_irq(int irq, void *data)
1732 SNDRV_PCM_FMTBIT_S20_3LE |\ 1713 SNDRV_PCM_FMTBIT_S20_3LE |\
1733 SNDRV_PCM_FMTBIT_S24_LE) 1714 SNDRV_PCM_FMTBIT_S24_LE)
1734 1715
1735static struct snd_soc_dai_ops wm8903_dai_ops = { 1716static const struct snd_soc_dai_ops wm8903_dai_ops = {
1736 .hw_params = wm8903_hw_params, 1717 .hw_params = wm8903_hw_params,
1737 .digital_mute = wm8903_digital_mute, 1718 .digital_mute = wm8903_digital_mute,
1738 .set_fmt = wm8903_set_dai_fmt, 1719 .set_fmt = wm8903_set_dai_fmt,
@@ -1759,7 +1740,7 @@ static struct snd_soc_dai_driver wm8903_dai = {
1759 .symmetric_rates = 1, 1740 .symmetric_rates = 1,
1760}; 1741};
1761 1742
1762static int wm8903_suspend(struct snd_soc_codec *codec, pm_message_t state) 1743static int wm8903_suspend(struct snd_soc_codec *codec)
1763{ 1744{
1764 wm8903_set_bias_level(codec, SND_SOC_BIAS_OFF); 1745 wm8903_set_bias_level(codec, SND_SOC_BIAS_OFF);
1765 1746
@@ -1768,23 +1749,11 @@ static int wm8903_suspend(struct snd_soc_codec *codec, pm_message_t state)
1768 1749
1769static int wm8903_resume(struct snd_soc_codec *codec) 1750static int wm8903_resume(struct snd_soc_codec *codec)
1770{ 1751{
1771 int i; 1752 struct wm8903_priv *wm8903 = snd_soc_codec_get_drvdata(codec);
1772 u16 *reg_cache = codec->reg_cache;
1773 u16 *tmp_cache = kmemdup(reg_cache, sizeof(wm8903_reg_defaults),
1774 GFP_KERNEL);
1775 1753
1776 /* Bring the codec back up to standby first to minimise pop/clicks */ 1754 regcache_sync(wm8903->regmap);
1777 wm8903_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
1778 1755
1779 /* Sync back everything else */ 1756 wm8903_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
1780 if (tmp_cache) {
1781 for (i = 2; i < ARRAY_SIZE(wm8903_reg_defaults); i++)
1782 if (tmp_cache[i] != reg_cache[i])
1783 snd_soc_write(codec, i, tmp_cache[i]);
1784 kfree(tmp_cache);
1785 } else {
1786 dev_err(codec->dev, "Failed to allocate temporary cache\n");
1787 }
1788 1757
1789 return 0; 1758 return 0;
1790} 1759}
@@ -1808,13 +1777,18 @@ static int wm8903_gpio_direction_in(struct gpio_chip *chip, unsigned offset)
1808 struct wm8903_priv *wm8903 = gpio_to_wm8903(chip); 1777 struct wm8903_priv *wm8903 = gpio_to_wm8903(chip);
1809 struct snd_soc_codec *codec = wm8903->codec; 1778 struct snd_soc_codec *codec = wm8903->codec;
1810 unsigned int mask, val; 1779 unsigned int mask, val;
1780 int ret;
1811 1781
1812 mask = WM8903_GP1_FN_MASK | WM8903_GP1_DIR_MASK; 1782 mask = WM8903_GP1_FN_MASK | WM8903_GP1_DIR_MASK;
1813 val = (WM8903_GPn_FN_GPIO_INPUT << WM8903_GP1_FN_SHIFT) | 1783 val = (WM8903_GPn_FN_GPIO_INPUT << WM8903_GP1_FN_SHIFT) |
1814 WM8903_GP1_DIR; 1784 WM8903_GP1_DIR;
1815 1785
1816 return snd_soc_update_bits(codec, WM8903_GPIO_CONTROL_1 + offset, 1786 ret = snd_soc_update_bits(codec, WM8903_GPIO_CONTROL_1 + offset,
1817 mask, val); 1787 mask, val);
1788 if (ret < 0)
1789 return ret;
1790
1791 return 0;
1818} 1792}
1819 1793
1820static int wm8903_gpio_get(struct gpio_chip *chip, unsigned offset) 1794static int wm8903_gpio_get(struct gpio_chip *chip, unsigned offset)
@@ -1834,13 +1808,18 @@ static int wm8903_gpio_direction_out(struct gpio_chip *chip,
1834 struct wm8903_priv *wm8903 = gpio_to_wm8903(chip); 1808 struct wm8903_priv *wm8903 = gpio_to_wm8903(chip);
1835 struct snd_soc_codec *codec = wm8903->codec; 1809 struct snd_soc_codec *codec = wm8903->codec;
1836 unsigned int mask, val; 1810 unsigned int mask, val;
1811 int ret;
1837 1812
1838 mask = WM8903_GP1_FN_MASK | WM8903_GP1_DIR_MASK | WM8903_GP1_LVL_MASK; 1813 mask = WM8903_GP1_FN_MASK | WM8903_GP1_DIR_MASK | WM8903_GP1_LVL_MASK;
1839 val = (WM8903_GPn_FN_GPIO_OUTPUT << WM8903_GP1_FN_SHIFT) | 1814 val = (WM8903_GPn_FN_GPIO_OUTPUT << WM8903_GP1_FN_SHIFT) |
1840 (value << WM8903_GP2_LVL_SHIFT); 1815 (value << WM8903_GP2_LVL_SHIFT);
1841 1816
1842 return snd_soc_update_bits(codec, WM8903_GPIO_CONTROL_1 + offset, 1817 ret = snd_soc_update_bits(codec, WM8903_GPIO_CONTROL_1 + offset,
1843 mask, val); 1818 mask, val);
1819 if (ret < 0)
1820 return ret;
1821
1822 return 0;
1844} 1823}
1845 1824
1846static void wm8903_gpio_set(struct gpio_chip *chip, unsigned offset, int value) 1825static void wm8903_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
@@ -1867,14 +1846,14 @@ static struct gpio_chip wm8903_template_chip = {
1867static void wm8903_init_gpio(struct snd_soc_codec *codec) 1846static void wm8903_init_gpio(struct snd_soc_codec *codec)
1868{ 1847{
1869 struct wm8903_priv *wm8903 = snd_soc_codec_get_drvdata(codec); 1848 struct wm8903_priv *wm8903 = snd_soc_codec_get_drvdata(codec);
1870 struct wm8903_platform_data *pdata = dev_get_platdata(codec->dev); 1849 struct wm8903_platform_data *pdata = wm8903->pdata;
1871 int ret; 1850 int ret;
1872 1851
1873 wm8903->gpio_chip = wm8903_template_chip; 1852 wm8903->gpio_chip = wm8903_template_chip;
1874 wm8903->gpio_chip.ngpio = WM8903_NUM_GPIO; 1853 wm8903->gpio_chip.ngpio = WM8903_NUM_GPIO;
1875 wm8903->gpio_chip.dev = codec->dev; 1854 wm8903->gpio_chip.dev = codec->dev;
1876 1855
1877 if (pdata && pdata->gpio_base) 1856 if (pdata->gpio_base)
1878 wm8903->gpio_chip.base = pdata->gpio_base; 1857 wm8903->gpio_chip.base = pdata->gpio_base;
1879 else 1858 else
1880 wm8903->gpio_chip.base = -1; 1859 wm8903->gpio_chip.base = -1;
@@ -1905,78 +1884,65 @@ static void wm8903_free_gpio(struct snd_soc_codec *codec)
1905 1884
1906static int wm8903_probe(struct snd_soc_codec *codec) 1885static int wm8903_probe(struct snd_soc_codec *codec)
1907{ 1886{
1908 struct wm8903_platform_data *pdata = dev_get_platdata(codec->dev);
1909 struct wm8903_priv *wm8903 = snd_soc_codec_get_drvdata(codec); 1887 struct wm8903_priv *wm8903 = snd_soc_codec_get_drvdata(codec);
1888 struct wm8903_platform_data *pdata = wm8903->pdata;
1910 int ret, i; 1889 int ret, i;
1911 int trigger, irq_pol; 1890 int trigger, irq_pol;
1912 u16 val; 1891 u16 val;
1892 bool mic_gpio = false;
1913 1893
1914 wm8903->codec = codec; 1894 wm8903->codec = codec;
1895 codec->control_data = wm8903->regmap;
1915 1896
1916 ret = snd_soc_codec_set_cache_io(codec, 8, 16, SND_SOC_I2C); 1897 ret = snd_soc_codec_set_cache_io(codec, 8, 16, SND_SOC_REGMAP);
1917 if (ret != 0) { 1898 if (ret != 0) {
1918 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret); 1899 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
1919 return ret; 1900 return ret;
1920 } 1901 }
1921 1902
1922 val = snd_soc_read(codec, WM8903_SW_RESET_AND_ID); 1903 /* Set up GPIOs, detect if any are MIC detect outputs */
1923 if (val != wm8903_reg_defaults[WM8903_SW_RESET_AND_ID]) { 1904 for (i = 0; i < ARRAY_SIZE(pdata->gpio_cfg); i++) {
1924 dev_err(codec->dev, 1905 if ((!pdata->gpio_cfg[i]) ||
1925 "Device with ID register %x is not a WM8903\n", val); 1906 (pdata->gpio_cfg[i] > WM8903_GPIO_CONFIG_ZERO))
1926 return -ENODEV; 1907 continue;
1927 }
1928
1929 val = snd_soc_read(codec, WM8903_REVISION_NUMBER);
1930 dev_info(codec->dev, "WM8903 revision %c\n",
1931 (val & WM8903_CHIP_REV_MASK) + 'A');
1932 1908
1933 wm8903_reset(codec); 1909 snd_soc_write(codec, WM8903_GPIO_CONTROL_1 + i,
1910 pdata->gpio_cfg[i] & 0x7fff);
1934 1911
1935 /* Set up GPIOs and microphone detection */ 1912 val = (pdata->gpio_cfg[i] & WM8903_GP1_FN_MASK)
1936 if (pdata) { 1913 >> WM8903_GP1_FN_SHIFT;
1937 bool mic_gpio = false;
1938 1914
1939 for (i = 0; i < ARRAY_SIZE(pdata->gpio_cfg); i++) { 1915 switch (val) {
1940 if (pdata->gpio_cfg[i] == WM8903_GPIO_NO_CONFIG) 1916 case WM8903_GPn_FN_MICBIAS_CURRENT_DETECT:
1941 continue; 1917 case WM8903_GPn_FN_MICBIAS_SHORT_DETECT:
1942 1918 mic_gpio = true;
1943 snd_soc_write(codec, WM8903_GPIO_CONTROL_1 + i, 1919 break;
1944 pdata->gpio_cfg[i] & 0xffff); 1920 default:
1945 1921 break;
1946 val = (pdata->gpio_cfg[i] & WM8903_GP1_FN_MASK)
1947 >> WM8903_GP1_FN_SHIFT;
1948
1949 switch (val) {
1950 case WM8903_GPn_FN_MICBIAS_CURRENT_DETECT:
1951 case WM8903_GPn_FN_MICBIAS_SHORT_DETECT:
1952 mic_gpio = true;
1953 break;
1954 default:
1955 break;
1956 }
1957 } 1922 }
1923 }
1924
1925 /* Set up microphone detection */
1926 snd_soc_write(codec, WM8903_MIC_BIAS_CONTROL_0,
1927 pdata->micdet_cfg);
1958 1928
1959 snd_soc_write(codec, WM8903_MIC_BIAS_CONTROL_0, 1929 /* Microphone detection needs the WSEQ clock */
1960 pdata->micdet_cfg); 1930 if (pdata->micdet_cfg)
1931 snd_soc_update_bits(codec, WM8903_WRITE_SEQUENCER_0,
1932 WM8903_WSEQ_ENA, WM8903_WSEQ_ENA);
1961 1933
1962 /* Microphone detection needs the WSEQ clock */ 1934 /* If microphone detection is enabled by pdata but
1963 if (pdata->micdet_cfg) 1935 * detected via IRQ then interrupts can be lost before
1964 snd_soc_update_bits(codec, WM8903_WRITE_SEQUENCER_0, 1936 * the machine driver has set up microphone detection
1965 WM8903_WSEQ_ENA, WM8903_WSEQ_ENA); 1937 * IRQs as the IRQs are clear on read. The detection
1938 * will be enabled when the machine driver configures.
1939 */
1940 WARN_ON(!mic_gpio && (pdata->micdet_cfg & WM8903_MICDET_ENA));
1966 1941
1967 /* If microphone detection is enabled by pdata but 1942 wm8903->mic_delay = pdata->micdet_delay;
1968 * detected via IRQ then interrupts can be lost before
1969 * the machine driver has set up microphone detection
1970 * IRQs as the IRQs are clear on read. The detection
1971 * will be enabled when the machine driver configures.
1972 */
1973 WARN_ON(!mic_gpio && (pdata->micdet_cfg & WM8903_MICDET_ENA));
1974 1943
1975 wm8903->mic_delay = pdata->micdet_delay;
1976 }
1977
1978 if (wm8903->irq) { 1944 if (wm8903->irq) {
1979 if (pdata && pdata->irq_active_low) { 1945 if (pdata->irq_active_low) {
1980 trigger = IRQF_TRIGGER_LOW; 1946 trigger = IRQF_TRIGGER_LOW;
1981 irq_pol = WM8903_IRQ_POL; 1947 irq_pol = WM8903_IRQ_POL;
1982 } else { 1948 } else {
@@ -2035,9 +2001,6 @@ static int wm8903_probe(struct snd_soc_codec *codec)
2035 WM8903_DAC_MUTEMODE | WM8903_DAC_MUTE, 2001 WM8903_DAC_MUTEMODE | WM8903_DAC_MUTE,
2036 WM8903_DAC_MUTEMODE | WM8903_DAC_MUTE); 2002 WM8903_DAC_MUTEMODE | WM8903_DAC_MUTE);
2037 2003
2038 snd_soc_add_controls(codec, wm8903_snd_controls,
2039 ARRAY_SIZE(wm8903_snd_controls));
2040
2041 wm8903_init_gpio(codec); 2004 wm8903_init_gpio(codec);
2042 2005
2043 return ret; 2006 return ret;
@@ -2062,45 +2025,198 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8903 = {
2062 .suspend = wm8903_suspend, 2025 .suspend = wm8903_suspend,
2063 .resume = wm8903_resume, 2026 .resume = wm8903_resume,
2064 .set_bias_level = wm8903_set_bias_level, 2027 .set_bias_level = wm8903_set_bias_level,
2065 .reg_cache_size = ARRAY_SIZE(wm8903_reg_defaults),
2066 .reg_word_size = sizeof(u16),
2067 .reg_cache_default = wm8903_reg_defaults,
2068 .volatile_register = wm8903_volatile_register,
2069 .seq_notifier = wm8903_seq_notifier, 2028 .seq_notifier = wm8903_seq_notifier,
2029 .controls = wm8903_snd_controls,
2030 .num_controls = ARRAY_SIZE(wm8903_snd_controls),
2070 .dapm_widgets = wm8903_dapm_widgets, 2031 .dapm_widgets = wm8903_dapm_widgets,
2071 .num_dapm_widgets = ARRAY_SIZE(wm8903_dapm_widgets), 2032 .num_dapm_widgets = ARRAY_SIZE(wm8903_dapm_widgets),
2072 .dapm_routes = wm8903_intercon, 2033 .dapm_routes = wm8903_intercon,
2073 .num_dapm_routes = ARRAY_SIZE(wm8903_intercon), 2034 .num_dapm_routes = ARRAY_SIZE(wm8903_intercon),
2074}; 2035};
2075 2036
2076#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) 2037static const struct regmap_config wm8903_regmap = {
2038 .reg_bits = 8,
2039 .val_bits = 16,
2040
2041 .max_register = WM8903_MAX_REGISTER,
2042 .volatile_reg = wm8903_volatile_register,
2043 .readable_reg = wm8903_readable_register,
2044
2045 .cache_type = REGCACHE_RBTREE,
2046 .reg_defaults = wm8903_reg_defaults,
2047 .num_reg_defaults = ARRAY_SIZE(wm8903_reg_defaults),
2048};
2049
2050static int wm8903_set_pdata_irq_trigger(struct i2c_client *i2c,
2051 struct wm8903_platform_data *pdata)
2052{
2053 struct irq_data *irq_data = irq_get_irq_data(i2c->irq);
2054 if (!irq_data) {
2055 dev_err(&i2c->dev, "Invalid IRQ: %d\n",
2056 i2c->irq);
2057 return -EINVAL;
2058 }
2059
2060 switch (irqd_get_trigger_type(irq_data)) {
2061 case IRQ_TYPE_NONE:
2062 default:
2063 /*
2064 * We assume the controller imposes no restrictions,
2065 * so we are able to select active-high
2066 */
2067 /* Fall-through */
2068 case IRQ_TYPE_LEVEL_HIGH:
2069 pdata->irq_active_low = false;
2070 break;
2071 case IRQ_TYPE_LEVEL_LOW:
2072 pdata->irq_active_low = true;
2073 break;
2074 }
2075
2076 return 0;
2077}
2078
2079static int wm8903_set_pdata_from_of(struct i2c_client *i2c,
2080 struct wm8903_platform_data *pdata)
2081{
2082 const struct device_node *np = i2c->dev.of_node;
2083 u32 val32;
2084 int i;
2085
2086 if (of_property_read_u32(np, "micdet-cfg", &val32) >= 0)
2087 pdata->micdet_cfg = val32;
2088
2089 if (of_property_read_u32(np, "micdet-delay", &val32) >= 0)
2090 pdata->micdet_delay = val32;
2091
2092 if (of_property_read_u32_array(np, "gpio-cfg", pdata->gpio_cfg,
2093 ARRAY_SIZE(pdata->gpio_cfg)) >= 0) {
2094 /*
2095 * In device tree: 0 means "write 0",
2096 * 0xffffffff means "don't touch".
2097 *
2098 * In platform data: 0 means "don't touch",
2099 * 0x8000 means "write 0".
2100 *
2101 * Note: WM8903_GPIO_CONFIG_ZERO == 0x8000.
2102 *
2103 * Convert from DT to pdata representation here,
2104 * so no other code needs to change.
2105 */
2106 for (i = 0; i < ARRAY_SIZE(pdata->gpio_cfg); i++) {
2107 if (pdata->gpio_cfg[i] == 0) {
2108 pdata->gpio_cfg[i] = WM8903_GPIO_CONFIG_ZERO;
2109 } else if (pdata->gpio_cfg[i] == 0xffffffff) {
2110 pdata->gpio_cfg[i] = 0;
2111 } else if (pdata->gpio_cfg[i] > 0x7fff) {
2112 dev_err(&i2c->dev, "Invalid gpio-cfg[%d] %x\n",
2113 i, pdata->gpio_cfg[i]);
2114 return -EINVAL;
2115 }
2116 }
2117 }
2118
2119 return 0;
2120}
2121
2077static __devinit int wm8903_i2c_probe(struct i2c_client *i2c, 2122static __devinit int wm8903_i2c_probe(struct i2c_client *i2c,
2078 const struct i2c_device_id *id) 2123 const struct i2c_device_id *id)
2079{ 2124{
2125 struct wm8903_platform_data *pdata = dev_get_platdata(&i2c->dev);
2080 struct wm8903_priv *wm8903; 2126 struct wm8903_priv *wm8903;
2127 unsigned int val;
2081 int ret; 2128 int ret;
2082 2129
2083 wm8903 = kzalloc(sizeof(struct wm8903_priv), GFP_KERNEL); 2130 wm8903 = devm_kzalloc(&i2c->dev, sizeof(struct wm8903_priv),
2131 GFP_KERNEL);
2084 if (wm8903 == NULL) 2132 if (wm8903 == NULL)
2085 return -ENOMEM; 2133 return -ENOMEM;
2086 2134
2135 wm8903->regmap = regmap_init_i2c(i2c, &wm8903_regmap);
2136 if (IS_ERR(wm8903->regmap)) {
2137 ret = PTR_ERR(wm8903->regmap);
2138 dev_err(&i2c->dev, "Failed to allocate register map: %d\n",
2139 ret);
2140 return ret;
2141 }
2142
2087 i2c_set_clientdata(i2c, wm8903); 2143 i2c_set_clientdata(i2c, wm8903);
2088 wm8903->irq = i2c->irq; 2144 wm8903->irq = i2c->irq;
2089 2145
2146 /* If no platform data was supplied, create storage for defaults */
2147 if (pdata) {
2148 wm8903->pdata = pdata;
2149 } else {
2150 wm8903->pdata = devm_kzalloc(&i2c->dev,
2151 sizeof(struct wm8903_platform_data),
2152 GFP_KERNEL);
2153 if (wm8903->pdata == NULL) {
2154 dev_err(&i2c->dev, "Failed to allocate pdata\n");
2155 return -ENOMEM;
2156 }
2157
2158 if (i2c->irq) {
2159 ret = wm8903_set_pdata_irq_trigger(i2c, wm8903->pdata);
2160 if (ret != 0)
2161 return ret;
2162 }
2163
2164 if (i2c->dev.of_node) {
2165 ret = wm8903_set_pdata_from_of(i2c, wm8903->pdata);
2166 if (ret != 0)
2167 return ret;
2168 }
2169 }
2170
2171 ret = regmap_read(wm8903->regmap, WM8903_SW_RESET_AND_ID, &val);
2172 if (ret != 0) {
2173 dev_err(&i2c->dev, "Failed to read chip ID: %d\n", ret);
2174 goto err;
2175 }
2176 if (val != 0x8903) {
2177 dev_err(&i2c->dev, "Device with ID %x is not a WM8903\n", val);
2178 ret = -ENODEV;
2179 goto err;
2180 }
2181
2182 ret = regmap_read(wm8903->regmap, WM8903_REVISION_NUMBER, &val);
2183 if (ret != 0) {
2184 dev_err(&i2c->dev, "Failed to read chip revision: %d\n", ret);
2185 goto err;
2186 }
2187 dev_info(&i2c->dev, "WM8903 revision %c\n",
2188 (val & WM8903_CHIP_REV_MASK) + 'A');
2189
2190 /* Reset the device */
2191 regmap_write(wm8903->regmap, WM8903_SW_RESET_AND_ID, 0x8903);
2192
2090 ret = snd_soc_register_codec(&i2c->dev, 2193 ret = snd_soc_register_codec(&i2c->dev,
2091 &soc_codec_dev_wm8903, &wm8903_dai, 1); 2194 &soc_codec_dev_wm8903, &wm8903_dai, 1);
2092 if (ret < 0) 2195 if (ret != 0)
2093 kfree(wm8903); 2196 goto err;
2197
2198 return 0;
2199err:
2200 regmap_exit(wm8903->regmap);
2094 return ret; 2201 return ret;
2095} 2202}
2096 2203
2097static __devexit int wm8903_i2c_remove(struct i2c_client *client) 2204static __devexit int wm8903_i2c_remove(struct i2c_client *client)
2098{ 2205{
2206 struct wm8903_priv *wm8903 = i2c_get_clientdata(client);
2207
2208 regmap_exit(wm8903->regmap);
2099 snd_soc_unregister_codec(&client->dev); 2209 snd_soc_unregister_codec(&client->dev);
2100 kfree(i2c_get_clientdata(client)); 2210
2101 return 0; 2211 return 0;
2102} 2212}
2103 2213
2214static const struct of_device_id wm8903_of_match[] = {
2215 { .compatible = "wlf,wm8903", },
2216 {},
2217};
2218MODULE_DEVICE_TABLE(of, wm8903_of_match);
2219
2104static const struct i2c_device_id wm8903_i2c_id[] = { 2220static const struct i2c_device_id wm8903_i2c_id[] = {
2105 { "wm8903", 0 }, 2221 { "wm8903", 0 },
2106 { } 2222 { }
@@ -2111,32 +2227,28 @@ static struct i2c_driver wm8903_i2c_driver = {
2111 .driver = { 2227 .driver = {
2112 .name = "wm8903", 2228 .name = "wm8903",
2113 .owner = THIS_MODULE, 2229 .owner = THIS_MODULE,
2230 .of_match_table = wm8903_of_match,
2114 }, 2231 },
2115 .probe = wm8903_i2c_probe, 2232 .probe = wm8903_i2c_probe,
2116 .remove = __devexit_p(wm8903_i2c_remove), 2233 .remove = __devexit_p(wm8903_i2c_remove),
2117 .id_table = wm8903_i2c_id, 2234 .id_table = wm8903_i2c_id,
2118}; 2235};
2119#endif
2120 2236
2121static int __init wm8903_modinit(void) 2237static int __init wm8903_modinit(void)
2122{ 2238{
2123 int ret = 0; 2239 int ret = 0;
2124#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
2125 ret = i2c_add_driver(&wm8903_i2c_driver); 2240 ret = i2c_add_driver(&wm8903_i2c_driver);
2126 if (ret != 0) { 2241 if (ret != 0) {
2127 printk(KERN_ERR "Failed to register wm8903 I2C driver: %d\n", 2242 printk(KERN_ERR "Failed to register wm8903 I2C driver: %d\n",
2128 ret); 2243 ret);
2129 } 2244 }
2130#endif
2131 return ret; 2245 return ret;
2132} 2246}
2133module_init(wm8903_modinit); 2247module_init(wm8903_modinit);
2134 2248
2135static void __exit wm8903_exit(void) 2249static void __exit wm8903_exit(void)
2136{ 2250{
2137#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
2138 i2c_del_driver(&wm8903_i2c_driver); 2251 i2c_del_driver(&wm8903_i2c_driver);
2139#endif
2140} 2252}
2141module_exit(wm8903_exit); 2253module_exit(wm8903_exit);
2142 2254
diff --git a/sound/soc/codecs/wm8904.c b/sound/soc/codecs/wm8904.c
index 285ef87e670..f31c754c886 100644
--- a/sound/soc/codecs/wm8904.c
+++ b/sound/soc/codecs/wm8904.c
@@ -17,7 +17,6 @@
17#include <linux/delay.h> 17#include <linux/delay.h>
18#include <linux/pm.h> 18#include <linux/pm.h>
19#include <linux/i2c.h> 19#include <linux/i2c.h>
20#include <linux/platform_device.h>
21#include <linux/regulator/consumer.h> 20#include <linux/regulator/consumer.h>
22#include <linux/slab.h> 21#include <linux/slab.h>
23#include <sound/core.h> 22#include <sound/core.h>
@@ -1196,7 +1195,7 @@ SND_SOC_DAPM_INPUT("IN2R"),
1196SND_SOC_DAPM_INPUT("IN3L"), 1195SND_SOC_DAPM_INPUT("IN3L"),
1197SND_SOC_DAPM_INPUT("IN3R"), 1196SND_SOC_DAPM_INPUT("IN3R"),
1198 1197
1199SND_SOC_DAPM_MICBIAS("MICBIAS", WM8904_MIC_BIAS_CONTROL_0, 0, 0), 1198SND_SOC_DAPM_SUPPLY("MICBIAS", WM8904_MIC_BIAS_CONTROL_0, 0, 0, NULL, 0),
1200 1199
1201SND_SOC_DAPM_MUX("Left Capture Mux", SND_SOC_NOPM, 0, 0, &lin_mux), 1200SND_SOC_DAPM_MUX("Left Capture Mux", SND_SOC_NOPM, 0, 0, &lin_mux),
1202SND_SOC_DAPM_MUX("Left Capture Inverting Mux", SND_SOC_NOPM, 0, 0, 1201SND_SOC_DAPM_MUX("Left Capture Inverting Mux", SND_SOC_NOPM, 0, 0,
@@ -2205,7 +2204,7 @@ static int wm8904_set_bias_level(struct snd_soc_codec *codec,
2205#define WM8904_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ 2204#define WM8904_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\
2206 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE) 2205 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE)
2207 2206
2208static struct snd_soc_dai_ops wm8904_dai_ops = { 2207static const struct snd_soc_dai_ops wm8904_dai_ops = {
2209 .set_sysclk = wm8904_set_sysclk, 2208 .set_sysclk = wm8904_set_sysclk,
2210 .set_fmt = wm8904_set_fmt, 2209 .set_fmt = wm8904_set_fmt,
2211 .set_tdm_slot = wm8904_set_tdm_slot, 2210 .set_tdm_slot = wm8904_set_tdm_slot,
@@ -2235,7 +2234,7 @@ static struct snd_soc_dai_driver wm8904_dai = {
2235}; 2234};
2236 2235
2237#ifdef CONFIG_PM 2236#ifdef CONFIG_PM
2238static int wm8904_suspend(struct snd_soc_codec *codec, pm_message_t state) 2237static int wm8904_suspend(struct snd_soc_codec *codec)
2239{ 2238{
2240 wm8904_set_bias_level(codec, SND_SOC_BIAS_OFF); 2239 wm8904_set_bias_level(codec, SND_SOC_BIAS_OFF);
2241 2240
@@ -2565,7 +2564,7 @@ MODULE_DEVICE_TABLE(i2c, wm8904_i2c_id);
2565 2564
2566static struct i2c_driver wm8904_i2c_driver = { 2565static struct i2c_driver wm8904_i2c_driver = {
2567 .driver = { 2566 .driver = {
2568 .name = "wm8904-codec", 2567 .name = "wm8904",
2569 .owner = THIS_MODULE, 2568 .owner = THIS_MODULE,
2570 }, 2569 },
2571 .probe = wm8904_i2c_probe, 2570 .probe = wm8904_i2c_probe,
diff --git a/sound/soc/codecs/wm8940.c b/sound/soc/codecs/wm8940.c
index de9ec9b8b7d..14039ea2f3e 100644
--- a/sound/soc/codecs/wm8940.c
+++ b/sound/soc/codecs/wm8940.c
@@ -28,7 +28,6 @@
28#include <linux/delay.h> 28#include <linux/delay.h>
29#include <linux/pm.h> 29#include <linux/pm.h>
30#include <linux/i2c.h> 30#include <linux/i2c.h>
31#include <linux/platform_device.h>
32#include <linux/spi/spi.h> 31#include <linux/spi/spi.h>
33#include <linux/slab.h> 32#include <linux/slab.h>
34#include <sound/core.h> 33#include <sound/core.h>
@@ -629,8 +628,8 @@ static int wm8940_set_dai_clkdiv(struct snd_soc_dai *codec_dai,
629 ret = snd_soc_write(codec, WM8940_CLOCK, reg | (div << 5)); 628 ret = snd_soc_write(codec, WM8940_CLOCK, reg | (div << 5));
630 break; 629 break;
631 case WM8940_OPCLKDIV: 630 case WM8940_OPCLKDIV:
632 reg = snd_soc_read(codec, WM8940_ADDCNTRL) & 0xFFCF; 631 reg = snd_soc_read(codec, WM8940_GPIO) & 0xFFCF;
633 ret = snd_soc_write(codec, WM8940_ADDCNTRL, reg | (div << 4)); 632 ret = snd_soc_write(codec, WM8940_GPIO, reg | (div << 4));
634 break; 633 break;
635 } 634 }
636 return ret; 635 return ret;
@@ -644,7 +643,7 @@ static int wm8940_set_dai_clkdiv(struct snd_soc_dai *codec_dai,
644 SNDRV_PCM_FMTBIT_S24_LE | \ 643 SNDRV_PCM_FMTBIT_S24_LE | \
645 SNDRV_PCM_FMTBIT_S32_LE) 644 SNDRV_PCM_FMTBIT_S32_LE)
646 645
647static struct snd_soc_dai_ops wm8940_dai_ops = { 646static const struct snd_soc_dai_ops wm8940_dai_ops = {
648 .hw_params = wm8940_i2s_hw_params, 647 .hw_params = wm8940_i2s_hw_params,
649 .set_sysclk = wm8940_set_dai_sysclk, 648 .set_sysclk = wm8940_set_dai_sysclk,
650 .digital_mute = wm8940_mute, 649 .digital_mute = wm8940_mute,
@@ -673,7 +672,7 @@ static struct snd_soc_dai_driver wm8940_dai = {
673 .symmetric_rates = 1, 672 .symmetric_rates = 1,
674}; 673};
675 674
676static int wm8940_suspend(struct snd_soc_codec *codec, pm_message_t state) 675static int wm8940_suspend(struct snd_soc_codec *codec)
677{ 676{
678 return wm8940_set_bias_level(codec, SND_SOC_BIAS_OFF); 677 return wm8940_set_bias_level(codec, SND_SOC_BIAS_OFF);
679} 678}
@@ -780,7 +779,7 @@ MODULE_DEVICE_TABLE(i2c, wm8940_i2c_id);
780 779
781static struct i2c_driver wm8940_i2c_driver = { 780static struct i2c_driver wm8940_i2c_driver = {
782 .driver = { 781 .driver = {
783 .name = "wm8940-codec", 782 .name = "wm8940",
784 .owner = THIS_MODULE, 783 .owner = THIS_MODULE,
785 }, 784 },
786 .probe = wm8940_i2c_probe, 785 .probe = wm8940_i2c_probe,
diff --git a/sound/soc/codecs/wm8955.c b/sound/soc/codecs/wm8955.c
index 3c7198779c3..924548182d5 100644
--- a/sound/soc/codecs/wm8955.c
+++ b/sound/soc/codecs/wm8955.c
@@ -16,7 +16,6 @@
16#include <linux/delay.h> 16#include <linux/delay.h>
17#include <linux/pm.h> 17#include <linux/pm.h>
18#include <linux/i2c.h> 18#include <linux/i2c.h>
19#include <linux/platform_device.h>
20#include <linux/regulator/consumer.h> 19#include <linux/regulator/consumer.h>
21#include <linux/slab.h> 20#include <linux/slab.h>
22#include <sound/core.h> 21#include <sound/core.h>
@@ -859,7 +858,7 @@ static int wm8955_set_bias_level(struct snd_soc_codec *codec,
859#define WM8955_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ 858#define WM8955_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\
860 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE) 859 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE)
861 860
862static struct snd_soc_dai_ops wm8955_dai_ops = { 861static const struct snd_soc_dai_ops wm8955_dai_ops = {
863 .set_sysclk = wm8955_set_sysclk, 862 .set_sysclk = wm8955_set_sysclk,
864 .set_fmt = wm8955_set_fmt, 863 .set_fmt = wm8955_set_fmt,
865 .hw_params = wm8955_hw_params, 864 .hw_params = wm8955_hw_params,
@@ -879,7 +878,7 @@ static struct snd_soc_dai_driver wm8955_dai = {
879}; 878};
880 879
881#ifdef CONFIG_PM 880#ifdef CONFIG_PM
882static int wm8955_suspend(struct snd_soc_codec *codec, pm_message_t state) 881static int wm8955_suspend(struct snd_soc_codec *codec)
883{ 882{
884 wm8955_set_bias_level(codec, SND_SOC_BIAS_OFF); 883 wm8955_set_bias_level(codec, SND_SOC_BIAS_OFF);
885 884
@@ -1038,7 +1037,7 @@ MODULE_DEVICE_TABLE(i2c, wm8955_i2c_id);
1038 1037
1039static struct i2c_driver wm8955_i2c_driver = { 1038static struct i2c_driver wm8955_i2c_driver = {
1040 .driver = { 1039 .driver = {
1041 .name = "wm8955-codec", 1040 .name = "wm8955",
1042 .owner = THIS_MODULE, 1041 .owner = THIS_MODULE,
1043 }, 1042 },
1044 .probe = wm8955_i2c_probe, 1043 .probe = wm8955_i2c_probe,
diff --git a/sound/soc/codecs/wm8958-dsp2.c b/sound/soc/codecs/wm8958-dsp2.c
index 0293763debe..8d4ea43d40a 100644
--- a/sound/soc/codecs/wm8958-dsp2.c
+++ b/sound/soc/codecs/wm8958-dsp2.c
@@ -55,11 +55,14 @@ static int wm8958_dsp2_fw(struct snd_soc_codec *codec, const char *name,
55 return 0; 55 return 0;
56 56
57 if (fw->size < 32) { 57 if (fw->size < 32) {
58 dev_err(codec->dev, "%s: firmware too short\n", name); 58 dev_err(codec->dev, "%s: firmware too short (%d bytes)\n",
59 name, fw->size);
59 goto err; 60 goto err;
60 } 61 }
61 62
62 if (memcmp(fw->data, "WMFW", 4) != 0) { 63 if (memcmp(fw->data, "WMFW", 4) != 0) {
64 memcpy(&data32, fw->data, sizeof(data32));
65 data32 = be32_to_cpu(data32);
63 dev_err(codec->dev, "%s: firmware has bad file magic %08x\n", 66 dev_err(codec->dev, "%s: firmware has bad file magic %08x\n",
64 name, data32); 67 name, data32);
65 goto err; 68 goto err;
diff --git a/sound/soc/codecs/wm8960.c b/sound/soc/codecs/wm8960.c
index 2df253c1856..e5caae32e54 100644
--- a/sound/soc/codecs/wm8960.c
+++ b/sound/soc/codecs/wm8960.c
@@ -14,7 +14,6 @@
14#include <linux/delay.h> 14#include <linux/delay.h>
15#include <linux/pm.h> 15#include <linux/pm.h>
16#include <linux/i2c.h> 16#include <linux/i2c.h>
17#include <linux/platform_device.h>
18#include <linux/slab.h> 17#include <linux/slab.h>
19#include <sound/core.h> 18#include <sound/core.h>
20#include <sound/pcm.h> 19#include <sound/pcm.h>
@@ -26,8 +25,6 @@
26 25
27#include "wm8960.h" 26#include "wm8960.h"
28 27
29#define AUDIO_NAME "wm8960"
30
31/* R25 - Power 1 */ 28/* R25 - Power 1 */
32#define WM8960_VMID_MASK 0x180 29#define WM8960_VMID_MASK 0x180
33#define WM8960_VREF 0x40 30#define WM8960_VREF 0x40
@@ -265,7 +262,7 @@ SND_SOC_DAPM_INPUT("RINPUT2"),
265SND_SOC_DAPM_INPUT("LINPUT3"), 262SND_SOC_DAPM_INPUT("LINPUT3"),
266SND_SOC_DAPM_INPUT("RINPUT3"), 263SND_SOC_DAPM_INPUT("RINPUT3"),
267 264
268SND_SOC_DAPM_MICBIAS("MICB", WM8960_POWER1, 1, 0), 265SND_SOC_DAPM_SUPPLY("MICB", WM8960_POWER1, 1, 0, NULL, 0),
269 266
270SND_SOC_DAPM_MIXER("Left Boost Mixer", WM8960_POWER1, 5, 0, 267SND_SOC_DAPM_MIXER("Left Boost Mixer", WM8960_POWER1, 5, 0,
271 wm8960_lin_boost, ARRAY_SIZE(wm8960_lin_boost)), 268 wm8960_lin_boost, ARRAY_SIZE(wm8960_lin_boost)),
@@ -546,30 +543,24 @@ static int wm8960_hw_params(struct snd_pcm_substream *substream,
546static int wm8960_mute(struct snd_soc_dai *dai, int mute) 543static int wm8960_mute(struct snd_soc_dai *dai, int mute)
547{ 544{
548 struct snd_soc_codec *codec = dai->codec; 545 struct snd_soc_codec *codec = dai->codec;
549 u16 mute_reg = snd_soc_read(codec, WM8960_DACCTL1) & 0xfff7;
550 546
551 if (mute) 547 if (mute)
552 snd_soc_write(codec, WM8960_DACCTL1, mute_reg | 0x8); 548 snd_soc_update_bits(codec, WM8960_DACCTL1, 0x8, 0x8);
553 else 549 else
554 snd_soc_write(codec, WM8960_DACCTL1, mute_reg); 550 snd_soc_update_bits(codec, WM8960_DACCTL1, 0x8, 0);
555 return 0; 551 return 0;
556} 552}
557 553
558static int wm8960_set_bias_level_out3(struct snd_soc_codec *codec, 554static int wm8960_set_bias_level_out3(struct snd_soc_codec *codec,
559 enum snd_soc_bias_level level) 555 enum snd_soc_bias_level level)
560{ 556{
561 u16 reg;
562
563 switch (level) { 557 switch (level) {
564 case SND_SOC_BIAS_ON: 558 case SND_SOC_BIAS_ON:
565 break; 559 break;
566 560
567 case SND_SOC_BIAS_PREPARE: 561 case SND_SOC_BIAS_PREPARE:
568 /* Set VMID to 2x50k */ 562 /* Set VMID to 2x50k */
569 reg = snd_soc_read(codec, WM8960_POWER1); 563 snd_soc_update_bits(codec, WM8960_POWER1, 0x180, 0x80);
570 reg &= ~0x180;
571 reg |= 0x80;
572 snd_soc_write(codec, WM8960_POWER1, reg);
573 break; 564 break;
574 565
575 case SND_SOC_BIAS_STANDBY: 566 case SND_SOC_BIAS_STANDBY:
@@ -582,23 +573,19 @@ static int wm8960_set_bias_level_out3(struct snd_soc_codec *codec,
582 WM8960_BUFDCOPEN | WM8960_BUFIOEN); 573 WM8960_BUFDCOPEN | WM8960_BUFIOEN);
583 574
584 /* Enable & ramp VMID at 2x50k */ 575 /* Enable & ramp VMID at 2x50k */
585 reg = snd_soc_read(codec, WM8960_POWER1); 576 snd_soc_update_bits(codec, WM8960_POWER1, 0x80, 0x80);
586 reg |= 0x80;
587 snd_soc_write(codec, WM8960_POWER1, reg);
588 msleep(100); 577 msleep(100);
589 578
590 /* Enable VREF */ 579 /* Enable VREF */
591 snd_soc_write(codec, WM8960_POWER1, reg | WM8960_VREF); 580 snd_soc_update_bits(codec, WM8960_POWER1, WM8960_VREF,
581 WM8960_VREF);
592 582
593 /* Disable anti-pop features */ 583 /* Disable anti-pop features */
594 snd_soc_write(codec, WM8960_APOP1, WM8960_BUFIOEN); 584 snd_soc_write(codec, WM8960_APOP1, WM8960_BUFIOEN);
595 } 585 }
596 586
597 /* Set VMID to 2x250k */ 587 /* Set VMID to 2x250k */
598 reg = snd_soc_read(codec, WM8960_POWER1); 588 snd_soc_update_bits(codec, WM8960_POWER1, 0x180, 0x100);
599 reg &= ~0x180;
600 reg |= 0x100;
601 snd_soc_write(codec, WM8960_POWER1, reg);
602 break; 589 break;
603 590
604 case SND_SOC_BIAS_OFF: 591 case SND_SOC_BIAS_OFF:
@@ -790,10 +777,8 @@ static int wm8960_set_dai_pll(struct snd_soc_dai *codec_dai, int pll_id,
790 777
791 /* Disable the PLL: even if we are changing the frequency the 778 /* Disable the PLL: even if we are changing the frequency the
792 * PLL needs to be disabled while we do so. */ 779 * PLL needs to be disabled while we do so. */
793 snd_soc_write(codec, WM8960_CLOCK1, 780 snd_soc_update_bits(codec, WM8960_CLOCK1, 0x1, 0);
794 snd_soc_read(codec, WM8960_CLOCK1) & ~1); 781 snd_soc_update_bits(codec, WM8960_POWER2, 0x1, 0);
795 snd_soc_write(codec, WM8960_POWER2,
796 snd_soc_read(codec, WM8960_POWER2) & ~1);
797 782
798 if (!freq_in || !freq_out) 783 if (!freq_in || !freq_out)
799 return 0; 784 return 0;
@@ -812,11 +797,9 @@ static int wm8960_set_dai_pll(struct snd_soc_dai *codec_dai, int pll_id,
812 snd_soc_write(codec, WM8960_PLL1, reg); 797 snd_soc_write(codec, WM8960_PLL1, reg);
813 798
814 /* Turn it on */ 799 /* Turn it on */
815 snd_soc_write(codec, WM8960_POWER2, 800 snd_soc_update_bits(codec, WM8960_POWER2, 0x1, 0x1);
816 snd_soc_read(codec, WM8960_POWER2) | 1);
817 msleep(250); 801 msleep(250);
818 snd_soc_write(codec, WM8960_CLOCK1, 802 snd_soc_update_bits(codec, WM8960_CLOCK1, 0x1, 0x1);
819 snd_soc_read(codec, WM8960_CLOCK1) | 1);
820 803
821 return 0; 804 return 0;
822} 805}
@@ -869,7 +852,7 @@ static int wm8960_set_bias_level(struct snd_soc_codec *codec,
869 (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \ 852 (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \
870 SNDRV_PCM_FMTBIT_S24_LE) 853 SNDRV_PCM_FMTBIT_S24_LE)
871 854
872static struct snd_soc_dai_ops wm8960_dai_ops = { 855static const struct snd_soc_dai_ops wm8960_dai_ops = {
873 .hw_params = wm8960_hw_params, 856 .hw_params = wm8960_hw_params,
874 .digital_mute = wm8960_mute, 857 .digital_mute = wm8960_mute,
875 .set_fmt = wm8960_set_dai_fmt, 858 .set_fmt = wm8960_set_dai_fmt,
@@ -895,7 +878,7 @@ static struct snd_soc_dai_driver wm8960_dai = {
895 .symmetric_rates = 1, 878 .symmetric_rates = 1,
896}; 879};
897 880
898static int wm8960_suspend(struct snd_soc_codec *codec, pm_message_t state) 881static int wm8960_suspend(struct snd_soc_codec *codec)
899{ 882{
900 struct wm8960_priv *wm8960 = snd_soc_codec_get_drvdata(codec); 883 struct wm8960_priv *wm8960 = snd_soc_codec_get_drvdata(codec);
901 884
@@ -916,7 +899,6 @@ static int wm8960_probe(struct snd_soc_codec *codec)
916 struct wm8960_priv *wm8960 = snd_soc_codec_get_drvdata(codec); 899 struct wm8960_priv *wm8960 = snd_soc_codec_get_drvdata(codec);
917 struct wm8960_data *pdata = dev_get_platdata(codec->dev); 900 struct wm8960_data *pdata = dev_get_platdata(codec->dev);
918 int ret; 901 int ret;
919 u16 reg;
920 902
921 wm8960->set_bias_level = wm8960_set_bias_level_out3; 903 wm8960->set_bias_level = wm8960_set_bias_level_out3;
922 904
@@ -947,26 +929,16 @@ static int wm8960_probe(struct snd_soc_codec *codec)
947 wm8960->set_bias_level(codec, SND_SOC_BIAS_STANDBY); 929 wm8960->set_bias_level(codec, SND_SOC_BIAS_STANDBY);
948 930
949 /* Latch the update bits */ 931 /* Latch the update bits */
950 reg = snd_soc_read(codec, WM8960_LINVOL); 932 snd_soc_update_bits(codec, WM8960_LINVOL, 0x100, 0x100);
951 snd_soc_write(codec, WM8960_LINVOL, reg | 0x100); 933 snd_soc_update_bits(codec, WM8960_RINVOL, 0x100, 0x100);
952 reg = snd_soc_read(codec, WM8960_RINVOL); 934 snd_soc_update_bits(codec, WM8960_LADC, 0x100, 0x100);
953 snd_soc_write(codec, WM8960_RINVOL, reg | 0x100); 935 snd_soc_update_bits(codec, WM8960_RADC, 0x100, 0x100);
954 reg = snd_soc_read(codec, WM8960_LADC); 936 snd_soc_update_bits(codec, WM8960_LDAC, 0x100, 0x100);
955 snd_soc_write(codec, WM8960_LADC, reg | 0x100); 937 snd_soc_update_bits(codec, WM8960_RDAC, 0x100, 0x100);
956 reg = snd_soc_read(codec, WM8960_RADC); 938 snd_soc_update_bits(codec, WM8960_LOUT1, 0x100, 0x100);
957 snd_soc_write(codec, WM8960_RADC, reg | 0x100); 939 snd_soc_update_bits(codec, WM8960_ROUT1, 0x100, 0x100);
958 reg = snd_soc_read(codec, WM8960_LDAC); 940 snd_soc_update_bits(codec, WM8960_LOUT2, 0x100, 0x100);
959 snd_soc_write(codec, WM8960_LDAC, reg | 0x100); 941 snd_soc_update_bits(codec, WM8960_ROUT2, 0x100, 0x100);
960 reg = snd_soc_read(codec, WM8960_RDAC);
961 snd_soc_write(codec, WM8960_RDAC, reg | 0x100);
962 reg = snd_soc_read(codec, WM8960_LOUT1);
963 snd_soc_write(codec, WM8960_LOUT1, reg | 0x100);
964 reg = snd_soc_read(codec, WM8960_ROUT1);
965 snd_soc_write(codec, WM8960_ROUT1, reg | 0x100);
966 reg = snd_soc_read(codec, WM8960_LOUT2);
967 snd_soc_write(codec, WM8960_LOUT2, reg | 0x100);
968 reg = snd_soc_read(codec, WM8960_ROUT2);
969 snd_soc_write(codec, WM8960_ROUT2, reg | 0x100);
970 942
971 snd_soc_add_controls(codec, wm8960_snd_controls, 943 snd_soc_add_controls(codec, wm8960_snd_controls,
972 ARRAY_SIZE(wm8960_snd_controls)); 944 ARRAY_SIZE(wm8960_snd_controls));
@@ -995,14 +967,14 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8960 = {
995 .reg_cache_default = wm8960_reg, 967 .reg_cache_default = wm8960_reg,
996}; 968};
997 969
998#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
999static __devinit int wm8960_i2c_probe(struct i2c_client *i2c, 970static __devinit int wm8960_i2c_probe(struct i2c_client *i2c,
1000 const struct i2c_device_id *id) 971 const struct i2c_device_id *id)
1001{ 972{
1002 struct wm8960_priv *wm8960; 973 struct wm8960_priv *wm8960;
1003 int ret; 974 int ret;
1004 975
1005 wm8960 = kzalloc(sizeof(struct wm8960_priv), GFP_KERNEL); 976 wm8960 = devm_kzalloc(&i2c->dev, sizeof(struct wm8960_priv),
977 GFP_KERNEL);
1006 if (wm8960 == NULL) 978 if (wm8960 == NULL)
1007 return -ENOMEM; 979 return -ENOMEM;
1008 980
@@ -1011,15 +983,13 @@ static __devinit int wm8960_i2c_probe(struct i2c_client *i2c,
1011 983
1012 ret = snd_soc_register_codec(&i2c->dev, 984 ret = snd_soc_register_codec(&i2c->dev,
1013 &soc_codec_dev_wm8960, &wm8960_dai, 1); 985 &soc_codec_dev_wm8960, &wm8960_dai, 1);
1014 if (ret < 0) 986
1015 kfree(wm8960);
1016 return ret; 987 return ret;
1017} 988}
1018 989
1019static __devexit int wm8960_i2c_remove(struct i2c_client *client) 990static __devexit int wm8960_i2c_remove(struct i2c_client *client)
1020{ 991{
1021 snd_soc_unregister_codec(&client->dev); 992 snd_soc_unregister_codec(&client->dev);
1022 kfree(i2c_get_clientdata(client));
1023 return 0; 993 return 0;
1024} 994}
1025 995
@@ -1031,34 +1001,29 @@ MODULE_DEVICE_TABLE(i2c, wm8960_i2c_id);
1031 1001
1032static struct i2c_driver wm8960_i2c_driver = { 1002static struct i2c_driver wm8960_i2c_driver = {
1033 .driver = { 1003 .driver = {
1034 .name = "wm8960-codec", 1004 .name = "wm8960",
1035 .owner = THIS_MODULE, 1005 .owner = THIS_MODULE,
1036 }, 1006 },
1037 .probe = wm8960_i2c_probe, 1007 .probe = wm8960_i2c_probe,
1038 .remove = __devexit_p(wm8960_i2c_remove), 1008 .remove = __devexit_p(wm8960_i2c_remove),
1039 .id_table = wm8960_i2c_id, 1009 .id_table = wm8960_i2c_id,
1040}; 1010};
1041#endif
1042 1011
1043static int __init wm8960_modinit(void) 1012static int __init wm8960_modinit(void)
1044{ 1013{
1045 int ret = 0; 1014 int ret = 0;
1046#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
1047 ret = i2c_add_driver(&wm8960_i2c_driver); 1015 ret = i2c_add_driver(&wm8960_i2c_driver);
1048 if (ret != 0) { 1016 if (ret != 0) {
1049 printk(KERN_ERR "Failed to register WM8960 I2C driver: %d\n", 1017 printk(KERN_ERR "Failed to register WM8960 I2C driver: %d\n",
1050 ret); 1018 ret);
1051 } 1019 }
1052#endif
1053 return ret; 1020 return ret;
1054} 1021}
1055module_init(wm8960_modinit); 1022module_init(wm8960_modinit);
1056 1023
1057static void __exit wm8960_exit(void) 1024static void __exit wm8960_exit(void)
1058{ 1025{
1059#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
1060 i2c_del_driver(&wm8960_i2c_driver); 1026 i2c_del_driver(&wm8960_i2c_driver);
1061#endif
1062} 1027}
1063module_exit(wm8960_exit); 1028module_exit(wm8960_exit);
1064 1029
diff --git a/sound/soc/codecs/wm8961.c b/sound/soc/codecs/wm8961.c
index 9568c8a49f9..4f20c72a0f1 100644
--- a/sound/soc/codecs/wm8961.c
+++ b/sound/soc/codecs/wm8961.c
@@ -17,7 +17,6 @@
17#include <linux/delay.h> 17#include <linux/delay.h>
18#include <linux/pm.h> 18#include <linux/pm.h>
19#include <linux/i2c.h> 19#include <linux/i2c.h>
20#include <linux/platform_device.h>
21#include <linux/slab.h> 20#include <linux/slab.h>
22#include <sound/core.h> 21#include <sound/core.h>
23#include <sound/pcm.h> 22#include <sound/pcm.h>
@@ -423,11 +422,11 @@ static int wm8961_spk_event(struct snd_soc_dapm_widget *w,
423 } 422 }
424 423
425 if (event & SND_SOC_DAPM_PRE_PMD) { 424 if (event & SND_SOC_DAPM_PRE_PMD) {
426 /* Enable the amplifier */ 425 /* Disable the amplifier */
427 spk_reg &= ~(WM8961_SPKL_ENA | WM8961_SPKR_ENA); 426 spk_reg &= ~(WM8961_SPKL_ENA | WM8961_SPKR_ENA);
428 snd_soc_write(codec, WM8961_CLASS_D_CONTROL_1, spk_reg); 427 snd_soc_write(codec, WM8961_CLASS_D_CONTROL_1, spk_reg);
429 428
430 /* Enable the PGA */ 429 /* Disable the PGA */
431 pwr_reg &= ~(WM8961_SPKL_PGA | WM8961_SPKR_PGA); 430 pwr_reg &= ~(WM8961_SPKL_PGA | WM8961_SPKR_PGA);
432 snd_soc_write(codec, WM8961_PWR_MGMT_2, pwr_reg); 431 snd_soc_write(codec, WM8961_PWR_MGMT_2, pwr_reg);
433 } 432 }
@@ -531,7 +530,7 @@ SND_SOC_DAPM_PGA("Right Input", WM8961_PWR_MGMT_1, 4, 0, NULL, 0),
531SND_SOC_DAPM_ADC("ADCL", "HiFi Capture", WM8961_PWR_MGMT_1, 3, 0), 530SND_SOC_DAPM_ADC("ADCL", "HiFi Capture", WM8961_PWR_MGMT_1, 3, 0),
532SND_SOC_DAPM_ADC("ADCR", "HiFi Capture", WM8961_PWR_MGMT_1, 2, 0), 531SND_SOC_DAPM_ADC("ADCR", "HiFi Capture", WM8961_PWR_MGMT_1, 2, 0),
533 532
534SND_SOC_DAPM_MICBIAS("MICBIAS", WM8961_PWR_MGMT_1, 1, 0), 533SND_SOC_DAPM_SUPPLY("MICBIAS", WM8961_PWR_MGMT_1, 1, 0, NULL, 0),
535 534
536SND_SOC_DAPM_MUX("DACL Sidetone", SND_SOC_NOPM, 0, 0, &dacl_mux), 535SND_SOC_DAPM_MUX("DACL Sidetone", SND_SOC_NOPM, 0, 0, &dacl_mux),
537SND_SOC_DAPM_MUX("DACR Sidetone", SND_SOC_NOPM, 0, 0, &dacr_mux), 536SND_SOC_DAPM_MUX("DACR Sidetone", SND_SOC_NOPM, 0, 0, &dacr_mux),
@@ -929,7 +928,7 @@ static int wm8961_set_bias_level(struct snd_soc_codec *codec,
929 (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \ 928 (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \
930 SNDRV_PCM_FMTBIT_S24_LE) 929 SNDRV_PCM_FMTBIT_S24_LE)
931 930
932static struct snd_soc_dai_ops wm8961_dai_ops = { 931static const struct snd_soc_dai_ops wm8961_dai_ops = {
933 .hw_params = wm8961_hw_params, 932 .hw_params = wm8961_hw_params,
934 .set_sysclk = wm8961_set_sysclk, 933 .set_sysclk = wm8961_set_sysclk,
935 .set_fmt = wm8961_set_fmt, 934 .set_fmt = wm8961_set_fmt,
@@ -1039,7 +1038,7 @@ static int wm8961_remove(struct snd_soc_codec *codec)
1039} 1038}
1040 1039
1041#ifdef CONFIG_PM 1040#ifdef CONFIG_PM
1042static int wm8961_suspend(struct snd_soc_codec *codec, pm_message_t state) 1041static int wm8961_suspend(struct snd_soc_codec *codec)
1043{ 1042{
1044 wm8961_set_bias_level(codec, SND_SOC_BIAS_OFF); 1043 wm8961_set_bias_level(codec, SND_SOC_BIAS_OFF);
1045 1044
@@ -1048,18 +1047,7 @@ static int wm8961_suspend(struct snd_soc_codec *codec, pm_message_t state)
1048 1047
1049static int wm8961_resume(struct snd_soc_codec *codec) 1048static int wm8961_resume(struct snd_soc_codec *codec)
1050{ 1049{
1051 u16 *reg_cache = codec->reg_cache; 1050 snd_soc_cache_sync(codec);
1052 int i;
1053
1054 for (i = 0; i < codec->driver->reg_cache_size; i++) {
1055 if (reg_cache[i] == wm8961_reg_defaults[i])
1056 continue;
1057
1058 if (i == WM8961_SOFTWARE_RESET)
1059 continue;
1060
1061 snd_soc_write(codec, i, reg_cache[i]);
1062 }
1063 1051
1064 wm8961_set_bias_level(codec, SND_SOC_BIAS_STANDBY); 1052 wm8961_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
1065 1053
@@ -1082,14 +1070,14 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8961 = {
1082 .volatile_register = wm8961_volatile_register, 1070 .volatile_register = wm8961_volatile_register,
1083}; 1071};
1084 1072
1085#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
1086static __devinit int wm8961_i2c_probe(struct i2c_client *i2c, 1073static __devinit int wm8961_i2c_probe(struct i2c_client *i2c,
1087 const struct i2c_device_id *id) 1074 const struct i2c_device_id *id)
1088{ 1075{
1089 struct wm8961_priv *wm8961; 1076 struct wm8961_priv *wm8961;
1090 int ret; 1077 int ret;
1091 1078
1092 wm8961 = kzalloc(sizeof(struct wm8961_priv), GFP_KERNEL); 1079 wm8961 = devm_kzalloc(&i2c->dev, sizeof(struct wm8961_priv),
1080 GFP_KERNEL);
1093 if (wm8961 == NULL) 1081 if (wm8961 == NULL)
1094 return -ENOMEM; 1082 return -ENOMEM;
1095 1083
@@ -1097,15 +1085,14 @@ static __devinit int wm8961_i2c_probe(struct i2c_client *i2c,
1097 1085
1098 ret = snd_soc_register_codec(&i2c->dev, 1086 ret = snd_soc_register_codec(&i2c->dev,
1099 &soc_codec_dev_wm8961, &wm8961_dai, 1); 1087 &soc_codec_dev_wm8961, &wm8961_dai, 1);
1100 if (ret < 0) 1088
1101 kfree(wm8961);
1102 return ret; 1089 return ret;
1103} 1090}
1104 1091
1105static __devexit int wm8961_i2c_remove(struct i2c_client *client) 1092static __devexit int wm8961_i2c_remove(struct i2c_client *client)
1106{ 1093{
1107 snd_soc_unregister_codec(&client->dev); 1094 snd_soc_unregister_codec(&client->dev);
1108 kfree(i2c_get_clientdata(client)); 1095
1109 return 0; 1096 return 0;
1110} 1097}
1111 1098
@@ -1117,34 +1104,29 @@ MODULE_DEVICE_TABLE(i2c, wm8961_i2c_id);
1117 1104
1118static struct i2c_driver wm8961_i2c_driver = { 1105static struct i2c_driver wm8961_i2c_driver = {
1119 .driver = { 1106 .driver = {
1120 .name = "wm8961-codec", 1107 .name = "wm8961",
1121 .owner = THIS_MODULE, 1108 .owner = THIS_MODULE,
1122 }, 1109 },
1123 .probe = wm8961_i2c_probe, 1110 .probe = wm8961_i2c_probe,
1124 .remove = __devexit_p(wm8961_i2c_remove), 1111 .remove = __devexit_p(wm8961_i2c_remove),
1125 .id_table = wm8961_i2c_id, 1112 .id_table = wm8961_i2c_id,
1126}; 1113};
1127#endif
1128 1114
1129static int __init wm8961_modinit(void) 1115static int __init wm8961_modinit(void)
1130{ 1116{
1131 int ret = 0; 1117 int ret = 0;
1132#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
1133 ret = i2c_add_driver(&wm8961_i2c_driver); 1118 ret = i2c_add_driver(&wm8961_i2c_driver);
1134 if (ret != 0) { 1119 if (ret != 0) {
1135 printk(KERN_ERR "Failed to register wm8961 I2C driver: %d\n", 1120 printk(KERN_ERR "Failed to register wm8961 I2C driver: %d\n",
1136 ret); 1121 ret);
1137 } 1122 }
1138#endif
1139 return ret; 1123 return ret;
1140} 1124}
1141module_init(wm8961_modinit); 1125module_init(wm8961_modinit);
1142 1126
1143static void __exit wm8961_exit(void) 1127static void __exit wm8961_exit(void)
1144{ 1128{
1145#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
1146 i2c_del_driver(&wm8961_i2c_driver); 1129 i2c_del_driver(&wm8961_i2c_driver);
1147#endif
1148} 1130}
1149module_exit(wm8961_exit); 1131module_exit(wm8961_exit);
1150 1132
diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c
index 53edd9a8c75..296de4e30d2 100644
--- a/sound/soc/codecs/wm8962.c
+++ b/sound/soc/codecs/wm8962.c
@@ -20,7 +20,7 @@
20#include <linux/gpio.h> 20#include <linux/gpio.h>
21#include <linux/i2c.h> 21#include <linux/i2c.h>
22#include <linux/input.h> 22#include <linux/input.h>
23#include <linux/platform_device.h> 23#include <linux/regmap.h>
24#include <linux/regulator/consumer.h> 24#include <linux/regulator/consumer.h>
25#include <linux/slab.h> 25#include <linux/slab.h>
26#include <linux/workqueue.h> 26#include <linux/workqueue.h>
@@ -50,6 +50,7 @@ static const char *wm8962_supply_names[WM8962_NUM_SUPPLIES] = {
50 50
51/* codec private data */ 51/* codec private data */
52struct wm8962_priv { 52struct wm8962_priv {
53 struct regmap *regmap;
53 struct snd_soc_codec *codec; 54 struct snd_soc_codec *codec;
54 55
55 int sysclk; 56 int sysclk;
@@ -95,7 +96,7 @@ static int wm8962_regulator_event_##n(struct notifier_block *nb, \
95 struct wm8962_priv *wm8962 = container_of(nb, struct wm8962_priv, \ 96 struct wm8962_priv *wm8962 = container_of(nb, struct wm8962_priv, \
96 disable_nb[n]); \ 97 disable_nb[n]); \
97 if (event & REGULATOR_EVENT_DISABLE) { \ 98 if (event & REGULATOR_EVENT_DISABLE) { \
98 wm8962->codec->cache_sync = 1; \ 99 regcache_cache_only(wm8962->regmap, true); \
99 } \ 100 } \
100 return 0; \ 101 return 0; \
101} 102}
@@ -109,691 +110,691 @@ WM8962_REGULATOR_EVENT(5)
109WM8962_REGULATOR_EVENT(6) 110WM8962_REGULATOR_EVENT(6)
110WM8962_REGULATOR_EVENT(7) 111WM8962_REGULATOR_EVENT(7)
111 112
112static const u16 wm8962_reg[WM8962_MAX_REGISTER + 1] = { 113static struct reg_default wm8962_reg[] = {
113 [0] = 0x009F, /* R0 - Left Input volume */ 114 { 0, 0x009F }, /* R0 - Left Input volume */
114 [1] = 0x049F, /* R1 - Right Input volume */ 115 { 1, 0x049F }, /* R1 - Right Input volume */
115 [2] = 0x0000, /* R2 - HPOUTL volume */ 116 { 2, 0x0000 }, /* R2 - HPOUTL volume */
116 [3] = 0x0000, /* R3 - HPOUTR volume */ 117 { 3, 0x0000 }, /* R3 - HPOUTR volume */
117 [4] = 0x0020, /* R4 - Clocking1 */ 118 { 4, 0x0020 }, /* R4 - Clocking1 */
118 [5] = 0x0018, /* R5 - ADC & DAC Control 1 */ 119 { 5, 0x0018 }, /* R5 - ADC & DAC Control 1 */
119 [6] = 0x2008, /* R6 - ADC & DAC Control 2 */ 120 { 6, 0x2008 }, /* R6 - ADC & DAC Control 2 */
120 [7] = 0x000A, /* R7 - Audio Interface 0 */ 121 { 7, 0x000A }, /* R7 - Audio Interface 0 */
121 [8] = 0x01E4, /* R8 - Clocking2 */ 122 { 8, 0x01E4 }, /* R8 - Clocking2 */
122 [9] = 0x0300, /* R9 - Audio Interface 1 */ 123 { 9, 0x0300 }, /* R9 - Audio Interface 1 */
123 [10] = 0x00C0, /* R10 - Left DAC volume */ 124 { 10, 0x00C0 }, /* R10 - Left DAC volume */
124 [11] = 0x00C0, /* R11 - Right DAC volume */ 125 { 11, 0x00C0 }, /* R11 - Right DAC volume */
125 126
126 [14] = 0x0040, /* R14 - Audio Interface 2 */ 127 { 14, 0x0040 }, /* R14 - Audio Interface 2 */
127 [15] = 0x6243, /* R15 - Software Reset */ 128 { 15, 0x6243 }, /* R15 - Software Reset */
128 129
129 [17] = 0x007B, /* R17 - ALC1 */ 130 { 17, 0x007B }, /* R17 - ALC1 */
130 [18] = 0x0000, /* R18 - ALC2 */ 131 { 18, 0x0000 }, /* R18 - ALC2 */
131 [19] = 0x1C32, /* R19 - ALC3 */ 132 { 19, 0x1C32 }, /* R19 - ALC3 */
132 [20] = 0x3200, /* R20 - Noise Gate */ 133 { 20, 0x3200 }, /* R20 - Noise Gate */
133 [21] = 0x00C0, /* R21 - Left ADC volume */ 134 { 21, 0x00C0 }, /* R21 - Left ADC volume */
134 [22] = 0x00C0, /* R22 - Right ADC volume */ 135 { 22, 0x00C0 }, /* R22 - Right ADC volume */
135 [23] = 0x0160, /* R23 - Additional control(1) */ 136 { 23, 0x0160 }, /* R23 - Additional control(1) */
136 [24] = 0x0000, /* R24 - Additional control(2) */ 137 { 24, 0x0000 }, /* R24 - Additional control(2) */
137 [25] = 0x0000, /* R25 - Pwr Mgmt (1) */ 138 { 25, 0x0000 }, /* R25 - Pwr Mgmt (1) */
138 [26] = 0x0000, /* R26 - Pwr Mgmt (2) */ 139 { 26, 0x0000 }, /* R26 - Pwr Mgmt (2) */
139 [27] = 0x0010, /* R27 - Additional Control (3) */ 140 { 27, 0x0010 }, /* R27 - Additional Control (3) */
140 [28] = 0x0000, /* R28 - Anti-pop */ 141 { 28, 0x0000 }, /* R28 - Anti-pop */
141 142
142 [30] = 0x005E, /* R30 - Clocking 3 */ 143 { 30, 0x005E }, /* R30 - Clocking 3 */
143 [31] = 0x0000, /* R31 - Input mixer control (1) */ 144 { 31, 0x0000 }, /* R31 - Input mixer control (1) */
144 [32] = 0x0145, /* R32 - Left input mixer volume */ 145 { 32, 0x0145 }, /* R32 - Left input mixer volume */
145 [33] = 0x0145, /* R33 - Right input mixer volume */ 146 { 33, 0x0145 }, /* R33 - Right input mixer volume */
146 [34] = 0x0009, /* R34 - Input mixer control (2) */ 147 { 34, 0x0009 }, /* R34 - Input mixer control (2) */
147 [35] = 0x0003, /* R35 - Input bias control */ 148 { 35, 0x0003 }, /* R35 - Input bias control */
148 [37] = 0x0008, /* R37 - Left input PGA control */ 149 { 37, 0x0008 }, /* R37 - Left input PGA control */
149 [38] = 0x0008, /* R38 - Right input PGA control */ 150 { 38, 0x0008 }, /* R38 - Right input PGA control */
150 151
151 [40] = 0x0000, /* R40 - SPKOUTL volume */ 152 { 40, 0x0000 }, /* R40 - SPKOUTL volume */
152 [41] = 0x0000, /* R41 - SPKOUTR volume */ 153 { 41, 0x0000 }, /* R41 - SPKOUTR volume */
153 154
154 [47] = 0x0000, /* R47 - Thermal Shutdown Status */ 155 { 47, 0x0000 }, /* R47 - Thermal Shutdown Status */
155 [48] = 0x8027, /* R48 - Additional Control (4) */ 156 { 48, 0x8027 }, /* R48 - Additional Control (4) */
156 [49] = 0x0010, /* R49 - Class D Control 1 */ 157 { 49, 0x0010 }, /* R49 - Class D Control 1 */
157 158
158 [51] = 0x0003, /* R51 - Class D Control 2 */ 159 { 51, 0x0003 }, /* R51 - Class D Control 2 */
159 160
160 [56] = 0x0506, /* R56 - Clocking 4 */ 161 { 56, 0x0506 }, /* R56 - Clocking 4 */
161 [57] = 0x0000, /* R57 - DAC DSP Mixing (1) */ 162 { 57, 0x0000 }, /* R57 - DAC DSP Mixing (1) */
162 [58] = 0x0000, /* R58 - DAC DSP Mixing (2) */ 163 { 58, 0x0000 }, /* R58 - DAC DSP Mixing (2) */
163 164
164 [60] = 0x0300, /* R60 - DC Servo 0 */ 165 { 60, 0x0300 }, /* R60 - DC Servo 0 */
165 [61] = 0x0300, /* R61 - DC Servo 1 */ 166 { 61, 0x0300 }, /* R61 - DC Servo 1 */
166 167
167 [64] = 0x0810, /* R64 - DC Servo 4 */ 168 { 64, 0x0810 }, /* R64 - DC Servo 4 */
168 169
169 [66] = 0x0000, /* R66 - DC Servo 6 */ 170 { 66, 0x0000 }, /* R66 - DC Servo 6 */
170 171
171 [68] = 0x001B, /* R68 - Analogue PGA Bias */ 172 { 68, 0x001B }, /* R68 - Analogue PGA Bias */
172 [69] = 0x0000, /* R69 - Analogue HP 0 */ 173 { 69, 0x0000 }, /* R69 - Analogue HP 0 */
173 174
174 [71] = 0x01FB, /* R71 - Analogue HP 2 */ 175 { 71, 0x01FB }, /* R71 - Analogue HP 2 */
175 [72] = 0x0000, /* R72 - Charge Pump 1 */ 176 { 72, 0x0000 }, /* R72 - Charge Pump 1 */
176 177
177 [82] = 0x0004, /* R82 - Charge Pump B */ 178 { 82, 0x0004 }, /* R82 - Charge Pump B */
178 179
179 [87] = 0x0000, /* R87 - Write Sequencer Control 1 */ 180 { 87, 0x0000 }, /* R87 - Write Sequencer Control 1 */
180 181
181 [90] = 0x0000, /* R90 - Write Sequencer Control 2 */ 182 { 90, 0x0000 }, /* R90 - Write Sequencer Control 2 */
182 183
183 [93] = 0x0000, /* R93 - Write Sequencer Control 3 */ 184 { 93, 0x0000 }, /* R93 - Write Sequencer Control 3 */
184 [94] = 0x0000, /* R94 - Control Interface */ 185 { 94, 0x0000 }, /* R94 - Control Interface */
185 186
186 [99] = 0x0000, /* R99 - Mixer Enables */ 187 { 99, 0x0000 }, /* R99 - Mixer Enables */
187 [100] = 0x0000, /* R100 - Headphone Mixer (1) */ 188 { 100, 0x0000 }, /* R100 - Headphone Mixer (1) */
188 [101] = 0x0000, /* R101 - Headphone Mixer (2) */ 189 { 101, 0x0000 }, /* R101 - Headphone Mixer (2) */
189 [102] = 0x013F, /* R102 - Headphone Mixer (3) */ 190 { 102, 0x013F }, /* R102 - Headphone Mixer (3) */
190 [103] = 0x013F, /* R103 - Headphone Mixer (4) */ 191 { 103, 0x013F }, /* R103 - Headphone Mixer (4) */
191 192
192 [105] = 0x0000, /* R105 - Speaker Mixer (1) */ 193 { 105, 0x0000 }, /* R105 - Speaker Mixer (1) */
193 [106] = 0x0000, /* R106 - Speaker Mixer (2) */ 194 { 106, 0x0000 }, /* R106 - Speaker Mixer (2) */
194 [107] = 0x013F, /* R107 - Speaker Mixer (3) */ 195 { 107, 0x013F }, /* R107 - Speaker Mixer (3) */
195 [108] = 0x013F, /* R108 - Speaker Mixer (4) */ 196 { 108, 0x013F }, /* R108 - Speaker Mixer (4) */
196 [109] = 0x0003, /* R109 - Speaker Mixer (5) */ 197 { 109, 0x0003 }, /* R109 - Speaker Mixer (5) */
197 [110] = 0x0002, /* R110 - Beep Generator (1) */ 198 { 110, 0x0002 }, /* R110 - Beep Generator (1) */
198 199
199 [115] = 0x0006, /* R115 - Oscillator Trim (3) */ 200 { 115, 0x0006 }, /* R115 - Oscillator Trim (3) */
200 [116] = 0x0026, /* R116 - Oscillator Trim (4) */ 201 { 116, 0x0026 }, /* R116 - Oscillator Trim (4) */
201 202
202 [119] = 0x0000, /* R119 - Oscillator Trim (7) */ 203 { 119, 0x0000 }, /* R119 - Oscillator Trim (7) */
203 204
204 [124] = 0x0011, /* R124 - Analogue Clocking1 */ 205 { 124, 0x0011 }, /* R124 - Analogue Clocking1 */
205 [125] = 0x004B, /* R125 - Analogue Clocking2 */ 206 { 125, 0x004B }, /* R125 - Analogue Clocking2 */
206 [126] = 0x000D, /* R126 - Analogue Clocking3 */ 207 { 126, 0x000D }, /* R126 - Analogue Clocking3 */
207 [127] = 0x0000, /* R127 - PLL Software Reset */ 208 { 127, 0x0000 }, /* R127 - PLL Software Reset */
208 209
209 [129] = 0x0000, /* R129 - PLL2 */ 210 { 129, 0x0000 }, /* R129 - PLL2 */
210 211
211 [131] = 0x0000, /* R131 - PLL 4 */ 212 { 131, 0x0000 }, /* R131 - PLL 4 */
212 213
213 [136] = 0x0067, /* R136 - PLL 9 */ 214 { 136, 0x0067 }, /* R136 - PLL 9 */
214 [137] = 0x001C, /* R137 - PLL 10 */ 215 { 137, 0x001C }, /* R137 - PLL 10 */
215 [138] = 0x0071, /* R138 - PLL 11 */ 216 { 138, 0x0071 }, /* R138 - PLL 11 */
216 [139] = 0x00C7, /* R139 - PLL 12 */ 217 { 139, 0x00C7 }, /* R139 - PLL 12 */
217 [140] = 0x0067, /* R140 - PLL 13 */ 218 { 140, 0x0067 }, /* R140 - PLL 13 */
218 [141] = 0x0048, /* R141 - PLL 14 */ 219 { 141, 0x0048 }, /* R141 - PLL 14 */
219 [142] = 0x0022, /* R142 - PLL 15 */ 220 { 142, 0x0022 }, /* R142 - PLL 15 */
220 [143] = 0x0097, /* R143 - PLL 16 */ 221 { 143, 0x0097 }, /* R143 - PLL 16 */
221 222
222 [155] = 0x000C, /* R155 - FLL Control (1) */ 223 { 155, 0x000C }, /* R155 - FLL Control (1) */
223 [156] = 0x0039, /* R156 - FLL Control (2) */ 224 { 156, 0x0039 }, /* R156 - FLL Control (2) */
224 [157] = 0x0180, /* R157 - FLL Control (3) */ 225 { 157, 0x0180 }, /* R157 - FLL Control (3) */
225 226
226 [159] = 0x0032, /* R159 - FLL Control (5) */ 227 { 159, 0x0032 }, /* R159 - FLL Control (5) */
227 [160] = 0x0018, /* R160 - FLL Control (6) */ 228 { 160, 0x0018 }, /* R160 - FLL Control (6) */
228 [161] = 0x007D, /* R161 - FLL Control (7) */ 229 { 161, 0x007D }, /* R161 - FLL Control (7) */
229 [162] = 0x0008, /* R162 - FLL Control (8) */ 230 { 162, 0x0008 }, /* R162 - FLL Control (8) */
230 231
231 [252] = 0x0005, /* R252 - General test 1 */ 232 { 252, 0x0005 }, /* R252 - General test 1 */
232 233
233 [256] = 0x0000, /* R256 - DF1 */ 234 { 256, 0x0000 }, /* R256 - DF1 */
234 [257] = 0x0000, /* R257 - DF2 */ 235 { 257, 0x0000 }, /* R257 - DF2 */
235 [258] = 0x0000, /* R258 - DF3 */ 236 { 258, 0x0000 }, /* R258 - DF3 */
236 [259] = 0x0000, /* R259 - DF4 */ 237 { 259, 0x0000 }, /* R259 - DF4 */
237 [260] = 0x0000, /* R260 - DF5 */ 238 { 260, 0x0000 }, /* R260 - DF5 */
238 [261] = 0x0000, /* R261 - DF6 */ 239 { 261, 0x0000 }, /* R261 - DF6 */
239 [262] = 0x0000, /* R262 - DF7 */ 240 { 262, 0x0000 }, /* R262 - DF7 */
240 241
241 [264] = 0x0000, /* R264 - LHPF1 */ 242 { 264, 0x0000 }, /* R264 - LHPF1 */
242 [265] = 0x0000, /* R265 - LHPF2 */ 243 { 265, 0x0000 }, /* R265 - LHPF2 */
243 244
244 [268] = 0x0000, /* R268 - THREED1 */ 245 { 268, 0x0000 }, /* R268 - THREED1 */
245 [269] = 0x0000, /* R269 - THREED2 */ 246 { 269, 0x0000 }, /* R269 - THREED2 */
246 [270] = 0x0000, /* R270 - THREED3 */ 247 { 270, 0x0000 }, /* R270 - THREED3 */
247 [271] = 0x0000, /* R271 - THREED4 */ 248 { 271, 0x0000 }, /* R271 - THREED4 */
248 249
249 [276] = 0x000C, /* R276 - DRC 1 */ 250 { 276, 0x000C }, /* R276 - DRC 1 */
250 [277] = 0x0925, /* R277 - DRC 2 */ 251 { 277, 0x0925 }, /* R277 - DRC 2 */
251 [278] = 0x0000, /* R278 - DRC 3 */ 252 { 278, 0x0000 }, /* R278 - DRC 3 */
252 [279] = 0x0000, /* R279 - DRC 4 */ 253 { 279, 0x0000 }, /* R279 - DRC 4 */
253 [280] = 0x0000, /* R280 - DRC 5 */ 254 { 280, 0x0000 }, /* R280 - DRC 5 */
254 255
255 [285] = 0x0000, /* R285 - Tloopback */ 256 { 285, 0x0000 }, /* R285 - Tloopback */
256 257
257 [335] = 0x0004, /* R335 - EQ1 */ 258 { 335, 0x0004 }, /* R335 - EQ1 */
258 [336] = 0x6318, /* R336 - EQ2 */ 259 { 336, 0x6318 }, /* R336 - EQ2 */
259 [337] = 0x6300, /* R337 - EQ3 */ 260 { 337, 0x6300 }, /* R337 - EQ3 */
260 [338] = 0x0FCA, /* R338 - EQ4 */ 261 { 338, 0x0FCA }, /* R338 - EQ4 */
261 [339] = 0x0400, /* R339 - EQ5 */ 262 { 339, 0x0400 }, /* R339 - EQ5 */
262 [340] = 0x00D8, /* R340 - EQ6 */ 263 { 340, 0x00D8 }, /* R340 - EQ6 */
263 [341] = 0x1EB5, /* R341 - EQ7 */ 264 { 341, 0x1EB5 }, /* R341 - EQ7 */
264 [342] = 0xF145, /* R342 - EQ8 */ 265 { 342, 0xF145 }, /* R342 - EQ8 */
265 [343] = 0x0B75, /* R343 - EQ9 */ 266 { 343, 0x0B75 }, /* R343 - EQ9 */
266 [344] = 0x01C5, /* R344 - EQ10 */ 267 { 344, 0x01C5 }, /* R344 - EQ10 */
267 [345] = 0x1C58, /* R345 - EQ11 */ 268 { 345, 0x1C58 }, /* R345 - EQ11 */
268 [346] = 0xF373, /* R346 - EQ12 */ 269 { 346, 0xF373 }, /* R346 - EQ12 */
269 [347] = 0x0A54, /* R347 - EQ13 */ 270 { 347, 0x0A54 }, /* R347 - EQ13 */
270 [348] = 0x0558, /* R348 - EQ14 */ 271 { 348, 0x0558 }, /* R348 - EQ14 */
271 [349] = 0x168E, /* R349 - EQ15 */ 272 { 349, 0x168E }, /* R349 - EQ15 */
272 [350] = 0xF829, /* R350 - EQ16 */ 273 { 350, 0xF829 }, /* R350 - EQ16 */
273 [351] = 0x07AD, /* R351 - EQ17 */ 274 { 351, 0x07AD }, /* R351 - EQ17 */
274 [352] = 0x1103, /* R352 - EQ18 */ 275 { 352, 0x1103 }, /* R352 - EQ18 */
275 [353] = 0x0564, /* R353 - EQ19 */ 276 { 353, 0x0564 }, /* R353 - EQ19 */
276 [354] = 0x0559, /* R354 - EQ20 */ 277 { 354, 0x0559 }, /* R354 - EQ20 */
277 [355] = 0x4000, /* R355 - EQ21 */ 278 { 355, 0x4000 }, /* R355 - EQ21 */
278 [356] = 0x6318, /* R356 - EQ22 */ 279 { 356, 0x6318 }, /* R356 - EQ22 */
279 [357] = 0x6300, /* R357 - EQ23 */ 280 { 357, 0x6300 }, /* R357 - EQ23 */
280 [358] = 0x0FCA, /* R358 - EQ24 */ 281 { 358, 0x0FCA }, /* R358 - EQ24 */
281 [359] = 0x0400, /* R359 - EQ25 */ 282 { 359, 0x0400 }, /* R359 - EQ25 */
282 [360] = 0x00D8, /* R360 - EQ26 */ 283 { 360, 0x00D8 }, /* R360 - EQ26 */
283 [361] = 0x1EB5, /* R361 - EQ27 */ 284 { 361, 0x1EB5 }, /* R361 - EQ27 */
284 [362] = 0xF145, /* R362 - EQ28 */ 285 { 362, 0xF145 }, /* R362 - EQ28 */
285 [363] = 0x0B75, /* R363 - EQ29 */ 286 { 363, 0x0B75 }, /* R363 - EQ29 */
286 [364] = 0x01C5, /* R364 - EQ30 */ 287 { 364, 0x01C5 }, /* R364 - EQ30 */
287 [365] = 0x1C58, /* R365 - EQ31 */ 288 { 365, 0x1C58 }, /* R365 - EQ31 */
288 [366] = 0xF373, /* R366 - EQ32 */ 289 { 366, 0xF373 }, /* R366 - EQ32 */
289 [367] = 0x0A54, /* R367 - EQ33 */ 290 { 367, 0x0A54 }, /* R367 - EQ33 */
290 [368] = 0x0558, /* R368 - EQ34 */ 291 { 368, 0x0558 }, /* R368 - EQ34 */
291 [369] = 0x168E, /* R369 - EQ35 */ 292 { 369, 0x168E }, /* R369 - EQ35 */
292 [370] = 0xF829, /* R370 - EQ36 */ 293 { 370, 0xF829 }, /* R370 - EQ36 */
293 [371] = 0x07AD, /* R371 - EQ37 */ 294 { 371, 0x07AD }, /* R371 - EQ37 */
294 [372] = 0x1103, /* R372 - EQ38 */ 295 { 372, 0x1103 }, /* R372 - EQ38 */
295 [373] = 0x0564, /* R373 - EQ39 */ 296 { 373, 0x0564 }, /* R373 - EQ39 */
296 [374] = 0x0559, /* R374 - EQ40 */ 297 { 374, 0x0559 }, /* R374 - EQ40 */
297 [375] = 0x4000, /* R375 - EQ41 */ 298 { 375, 0x4000 }, /* R375 - EQ41 */
298 299
299 [513] = 0x0000, /* R513 - GPIO 2 */ 300 { 513, 0x0000 }, /* R513 - GPIO 2 */
300 [514] = 0x0000, /* R514 - GPIO 3 */ 301 { 514, 0x0000 }, /* R514 - GPIO 3 */
301 302
302 [516] = 0x8100, /* R516 - GPIO 5 */ 303 { 516, 0x8100 }, /* R516 - GPIO 5 */
303 [517] = 0x8100, /* R517 - GPIO 6 */ 304 { 517, 0x8100 }, /* R517 - GPIO 6 */
304 305
305 [560] = 0x0000, /* R560 - Interrupt Status 1 */ 306 { 560, 0x0000 }, /* R560 - Interrupt Status 1 */
306 [561] = 0x0000, /* R561 - Interrupt Status 2 */ 307 { 561, 0x0000 }, /* R561 - Interrupt Status 2 */
307 308
308 [568] = 0x0030, /* R568 - Interrupt Status 1 Mask */ 309 { 568, 0x0030 }, /* R568 - Interrupt Status 1 Mask */
309 [569] = 0xFFED, /* R569 - Interrupt Status 2 Mask */ 310 { 569, 0xFFED }, /* R569 - Interrupt Status 2 Mask */
310 311
311 [576] = 0x0000, /* R576 - Interrupt Control */ 312 { 576, 0x0000 }, /* R576 - Interrupt Control */
312 313
313 [584] = 0x002D, /* R584 - IRQ Debounce */ 314 { 584, 0x002D }, /* R584 - IRQ Debounce */
314 315
315 [586] = 0x0000, /* R586 - MICINT Source Pol */ 316 { 586, 0x0000 }, /* R586 - MICINT Source Pol */
316 317
317 [768] = 0x1C00, /* R768 - DSP2 Power Management */ 318 { 768, 0x1C00 }, /* R768 - DSP2 Power Management */
318 319
319 [1037] = 0x0000, /* R1037 - DSP2_ExecControl */ 320 { 1037, 0x0000 }, /* R1037 - DSP2_ExecControl */
320 321
321 [8192] = 0x0000, /* R8192 - DSP2 Instruction RAM 0 */ 322 { 8192, 0x0000 }, /* R8192 - DSP2 Instruction RAM 0 */
322 323
323 [9216] = 0x0030, /* R9216 - DSP2 Address RAM 2 */ 324 { 9216, 0x0030 }, /* R9216 - DSP2 Address RAM 2 */
324 [9217] = 0x0000, /* R9217 - DSP2 Address RAM 1 */ 325 { 9217, 0x0000 }, /* R9217 - DSP2 Address RAM 1 */
325 [9218] = 0x0000, /* R9218 - DSP2 Address RAM 0 */ 326 { 9218, 0x0000 }, /* R9218 - DSP2 Address RAM 0 */
326 327
327 [12288] = 0x0000, /* R12288 - DSP2 Data1 RAM 1 */ 328 { 12288, 0x0000 }, /* R12288 - DSP2 Data1 RAM 1 */
328 [12289] = 0x0000, /* R12289 - DSP2 Data1 RAM 0 */ 329 { 12289, 0x0000 }, /* R12289 - DSP2 Data1 RAM 0 */
329 330
330 [13312] = 0x0000, /* R13312 - DSP2 Data2 RAM 1 */ 331 { 13312, 0x0000 }, /* R13312 - DSP2 Data2 RAM 1 */
331 [13313] = 0x0000, /* R13313 - DSP2 Data2 RAM 0 */ 332 { 13313, 0x0000 }, /* R13313 - DSP2 Data2 RAM 0 */
332 333
333 [14336] = 0x0000, /* R14336 - DSP2 Data3 RAM 1 */ 334 { 14336, 0x0000 }, /* R14336 - DSP2 Data3 RAM 1 */
334 [14337] = 0x0000, /* R14337 - DSP2 Data3 RAM 0 */ 335 { 14337, 0x0000 }, /* R14337 - DSP2 Data3 RAM 0 */
335 336
336 [15360] = 0x000A, /* R15360 - DSP2 Coeff RAM 0 */ 337 { 15360, 0x000A }, /* R15360 - DSP2 Coeff RAM 0 */
337 338
338 [16384] = 0x0000, /* R16384 - RETUNEADC_SHARED_COEFF_1 */ 339 { 16384, 0x0000 }, /* R16384 - RETUNEADC_SHARED_COEFF_1 */
339 [16385] = 0x0000, /* R16385 - RETUNEADC_SHARED_COEFF_0 */ 340 { 16385, 0x0000 }, /* R16385 - RETUNEADC_SHARED_COEFF_0 */
340 [16386] = 0x0000, /* R16386 - RETUNEDAC_SHARED_COEFF_1 */ 341 { 16386, 0x0000 }, /* R16386 - RETUNEDAC_SHARED_COEFF_1 */
341 [16387] = 0x0000, /* R16387 - RETUNEDAC_SHARED_COEFF_0 */ 342 { 16387, 0x0000 }, /* R16387 - RETUNEDAC_SHARED_COEFF_0 */
342 [16388] = 0x0000, /* R16388 - SOUNDSTAGE_ENABLES_1 */ 343 { 16388, 0x0000 }, /* R16388 - SOUNDSTAGE_ENABLES_1 */
343 [16389] = 0x0000, /* R16389 - SOUNDSTAGE_ENABLES_0 */ 344 { 16389, 0x0000 }, /* R16389 - SOUNDSTAGE_ENABLES_0 */
344 345
345 [16896] = 0x0002, /* R16896 - HDBASS_AI_1 */ 346 { 16896, 0x0002 }, /* R16896 - HDBASS_AI_1 */
346 [16897] = 0xBD12, /* R16897 - HDBASS_AI_0 */ 347 { 16897, 0xBD12 }, /* R16897 - HDBASS_AI_0 */
347 [16898] = 0x007C, /* R16898 - HDBASS_AR_1 */ 348 { 16898, 0x007C }, /* R16898 - HDBASS_AR_1 */
348 [16899] = 0x586C, /* R16899 - HDBASS_AR_0 */ 349 { 16899, 0x586C }, /* R16899 - HDBASS_AR_0 */
349 [16900] = 0x0053, /* R16900 - HDBASS_B_1 */ 350 { 16900, 0x0053 }, /* R16900 - HDBASS_B_1 */
350 [16901] = 0x8121, /* R16901 - HDBASS_B_0 */ 351 { 16901, 0x8121 }, /* R16901 - HDBASS_B_0 */
351 [16902] = 0x003F, /* R16902 - HDBASS_K_1 */ 352 { 16902, 0x003F }, /* R16902 - HDBASS_K_1 */
352 [16903] = 0x8BD8, /* R16903 - HDBASS_K_0 */ 353 { 16903, 0x8BD8 }, /* R16903 - HDBASS_K_0 */
353 [16904] = 0x0032, /* R16904 - HDBASS_N1_1 */ 354 { 16904, 0x0032 }, /* R16904 - HDBASS_N1_1 */
354 [16905] = 0xF52D, /* R16905 - HDBASS_N1_0 */ 355 { 16905, 0xF52D }, /* R16905 - HDBASS_N1_0 */
355 [16906] = 0x0065, /* R16906 - HDBASS_N2_1 */ 356 { 16906, 0x0065 }, /* R16906 - HDBASS_N2_1 */
356 [16907] = 0xAC8C, /* R16907 - HDBASS_N2_0 */ 357 { 16907, 0xAC8C }, /* R16907 - HDBASS_N2_0 */
357 [16908] = 0x006B, /* R16908 - HDBASS_N3_1 */ 358 { 16908, 0x006B }, /* R16908 - HDBASS_N3_1 */
358 [16909] = 0xE087, /* R16909 - HDBASS_N3_0 */ 359 { 16909, 0xE087 }, /* R16909 - HDBASS_N3_0 */
359 [16910] = 0x0072, /* R16910 - HDBASS_N4_1 */ 360 { 16910, 0x0072 }, /* R16910 - HDBASS_N4_1 */
360 [16911] = 0x1483, /* R16911 - HDBASS_N4_0 */ 361 { 16911, 0x1483 }, /* R16911 - HDBASS_N4_0 */
361 [16912] = 0x0072, /* R16912 - HDBASS_N5_1 */ 362 { 16912, 0x0072 }, /* R16912 - HDBASS_N5_1 */
362 [16913] = 0x1483, /* R16913 - HDBASS_N5_0 */ 363 { 16913, 0x1483 }, /* R16913 - HDBASS_N5_0 */
363 [16914] = 0x0043, /* R16914 - HDBASS_X1_1 */ 364 { 16914, 0x0043 }, /* R16914 - HDBASS_X1_1 */
364 [16915] = 0x3525, /* R16915 - HDBASS_X1_0 */ 365 { 16915, 0x3525 }, /* R16915 - HDBASS_X1_0 */
365 [16916] = 0x0006, /* R16916 - HDBASS_X2_1 */ 366 { 16916, 0x0006 }, /* R16916 - HDBASS_X2_1 */
366 [16917] = 0x6A4A, /* R16917 - HDBASS_X2_0 */ 367 { 16917, 0x6A4A }, /* R16917 - HDBASS_X2_0 */
367 [16918] = 0x0043, /* R16918 - HDBASS_X3_1 */ 368 { 16918, 0x0043 }, /* R16918 - HDBASS_X3_1 */
368 [16919] = 0x6079, /* R16919 - HDBASS_X3_0 */ 369 { 16919, 0x6079 }, /* R16919 - HDBASS_X3_0 */
369 [16920] = 0x0008, /* R16920 - HDBASS_ATK_1 */ 370 { 16920, 0x0008 }, /* R16920 - HDBASS_ATK_1 */
370 [16921] = 0x0000, /* R16921 - HDBASS_ATK_0 */ 371 { 16921, 0x0000 }, /* R16921 - HDBASS_ATK_0 */
371 [16922] = 0x0001, /* R16922 - HDBASS_DCY_1 */ 372 { 16922, 0x0001 }, /* R16922 - HDBASS_DCY_1 */
372 [16923] = 0x0000, /* R16923 - HDBASS_DCY_0 */ 373 { 16923, 0x0000 }, /* R16923 - HDBASS_DCY_0 */
373 [16924] = 0x0059, /* R16924 - HDBASS_PG_1 */ 374 { 16924, 0x0059 }, /* R16924 - HDBASS_PG_1 */
374 [16925] = 0x999A, /* R16925 - HDBASS_PG_0 */ 375 { 16925, 0x999A }, /* R16925 - HDBASS_PG_0 */
375 376
376 [17048] = 0x0083, /* R17408 - HPF_C_1 */ 377 { 17048, 0x0083 }, /* R17408 - HPF_C_1 */
377 [17049] = 0x98AD, /* R17409 - HPF_C_0 */ 378 { 17049, 0x98AD }, /* R17409 - HPF_C_0 */
378 379
379 [17920] = 0x007F, /* R17920 - ADCL_RETUNE_C1_1 */ 380 { 17920, 0x007F }, /* R17920 - ADCL_RETUNE_C1_1 */
380 [17921] = 0xFFFF, /* R17921 - ADCL_RETUNE_C1_0 */ 381 { 17921, 0xFFFF }, /* R17921 - ADCL_RETUNE_C1_0 */
381 [17922] = 0x0000, /* R17922 - ADCL_RETUNE_C2_1 */ 382 { 17922, 0x0000 }, /* R17922 - ADCL_RETUNE_C2_1 */
382 [17923] = 0x0000, /* R17923 - ADCL_RETUNE_C2_0 */ 383 { 17923, 0x0000 }, /* R17923 - ADCL_RETUNE_C2_0 */
383 [17924] = 0x0000, /* R17924 - ADCL_RETUNE_C3_1 */ 384 { 17924, 0x0000 }, /* R17924 - ADCL_RETUNE_C3_1 */
384 [17925] = 0x0000, /* R17925 - ADCL_RETUNE_C3_0 */ 385 { 17925, 0x0000 }, /* R17925 - ADCL_RETUNE_C3_0 */
385 [17926] = 0x0000, /* R17926 - ADCL_RETUNE_C4_1 */ 386 { 17926, 0x0000 }, /* R17926 - ADCL_RETUNE_C4_1 */
386 [17927] = 0x0000, /* R17927 - ADCL_RETUNE_C4_0 */ 387 { 17927, 0x0000 }, /* R17927 - ADCL_RETUNE_C4_0 */
387 [17928] = 0x0000, /* R17928 - ADCL_RETUNE_C5_1 */ 388 { 17928, 0x0000 }, /* R17928 - ADCL_RETUNE_C5_1 */
388 [17929] = 0x0000, /* R17929 - ADCL_RETUNE_C5_0 */ 389 { 17929, 0x0000 }, /* R17929 - ADCL_RETUNE_C5_0 */
389 [17930] = 0x0000, /* R17930 - ADCL_RETUNE_C6_1 */ 390 { 17930, 0x0000 }, /* R17930 - ADCL_RETUNE_C6_1 */
390 [17931] = 0x0000, /* R17931 - ADCL_RETUNE_C6_0 */ 391 { 17931, 0x0000 }, /* R17931 - ADCL_RETUNE_C6_0 */
391 [17932] = 0x0000, /* R17932 - ADCL_RETUNE_C7_1 */ 392 { 17932, 0x0000 }, /* R17932 - ADCL_RETUNE_C7_1 */
392 [17933] = 0x0000, /* R17933 - ADCL_RETUNE_C7_0 */ 393 { 17933, 0x0000 }, /* R17933 - ADCL_RETUNE_C7_0 */
393 [17934] = 0x0000, /* R17934 - ADCL_RETUNE_C8_1 */ 394 { 17934, 0x0000 }, /* R17934 - ADCL_RETUNE_C8_1 */
394 [17935] = 0x0000, /* R17935 - ADCL_RETUNE_C8_0 */ 395 { 17935, 0x0000 }, /* R17935 - ADCL_RETUNE_C8_0 */
395 [17936] = 0x0000, /* R17936 - ADCL_RETUNE_C9_1 */ 396 { 17936, 0x0000 }, /* R17936 - ADCL_RETUNE_C9_1 */
396 [17937] = 0x0000, /* R17937 - ADCL_RETUNE_C9_0 */ 397 { 17937, 0x0000 }, /* R17937 - ADCL_RETUNE_C9_0 */
397 [17938] = 0x0000, /* R17938 - ADCL_RETUNE_C10_1 */ 398 { 17938, 0x0000 }, /* R17938 - ADCL_RETUNE_C10_1 */
398 [17939] = 0x0000, /* R17939 - ADCL_RETUNE_C10_0 */ 399 { 17939, 0x0000 }, /* R17939 - ADCL_RETUNE_C10_0 */
399 [17940] = 0x0000, /* R17940 - ADCL_RETUNE_C11_1 */ 400 { 17940, 0x0000 }, /* R17940 - ADCL_RETUNE_C11_1 */
400 [17941] = 0x0000, /* R17941 - ADCL_RETUNE_C11_0 */ 401 { 17941, 0x0000 }, /* R17941 - ADCL_RETUNE_C11_0 */
401 [17942] = 0x0000, /* R17942 - ADCL_RETUNE_C12_1 */ 402 { 17942, 0x0000 }, /* R17942 - ADCL_RETUNE_C12_1 */
402 [17943] = 0x0000, /* R17943 - ADCL_RETUNE_C12_0 */ 403 { 17943, 0x0000 }, /* R17943 - ADCL_RETUNE_C12_0 */
403 [17944] = 0x0000, /* R17944 - ADCL_RETUNE_C13_1 */ 404 { 17944, 0x0000 }, /* R17944 - ADCL_RETUNE_C13_1 */
404 [17945] = 0x0000, /* R17945 - ADCL_RETUNE_C13_0 */ 405 { 17945, 0x0000 }, /* R17945 - ADCL_RETUNE_C13_0 */
405 [17946] = 0x0000, /* R17946 - ADCL_RETUNE_C14_1 */ 406 { 17946, 0x0000 }, /* R17946 - ADCL_RETUNE_C14_1 */
406 [17947] = 0x0000, /* R17947 - ADCL_RETUNE_C14_0 */ 407 { 17947, 0x0000 }, /* R17947 - ADCL_RETUNE_C14_0 */
407 [17948] = 0x0000, /* R17948 - ADCL_RETUNE_C15_1 */ 408 { 17948, 0x0000 }, /* R17948 - ADCL_RETUNE_C15_1 */
408 [17949] = 0x0000, /* R17949 - ADCL_RETUNE_C15_0 */ 409 { 17949, 0x0000 }, /* R17949 - ADCL_RETUNE_C15_0 */
409 [17950] = 0x0000, /* R17950 - ADCL_RETUNE_C16_1 */ 410 { 17950, 0x0000 }, /* R17950 - ADCL_RETUNE_C16_1 */
410 [17951] = 0x0000, /* R17951 - ADCL_RETUNE_C16_0 */ 411 { 17951, 0x0000 }, /* R17951 - ADCL_RETUNE_C16_0 */
411 [17952] = 0x0000, /* R17952 - ADCL_RETUNE_C17_1 */ 412 { 17952, 0x0000 }, /* R17952 - ADCL_RETUNE_C17_1 */
412 [17953] = 0x0000, /* R17953 - ADCL_RETUNE_C17_0 */ 413 { 17953, 0x0000 }, /* R17953 - ADCL_RETUNE_C17_0 */
413 [17954] = 0x0000, /* R17954 - ADCL_RETUNE_C18_1 */ 414 { 17954, 0x0000 }, /* R17954 - ADCL_RETUNE_C18_1 */
414 [17955] = 0x0000, /* R17955 - ADCL_RETUNE_C18_0 */ 415 { 17955, 0x0000 }, /* R17955 - ADCL_RETUNE_C18_0 */
415 [17956] = 0x0000, /* R17956 - ADCL_RETUNE_C19_1 */ 416 { 17956, 0x0000 }, /* R17956 - ADCL_RETUNE_C19_1 */
416 [17957] = 0x0000, /* R17957 - ADCL_RETUNE_C19_0 */ 417 { 17957, 0x0000 }, /* R17957 - ADCL_RETUNE_C19_0 */
417 [17958] = 0x0000, /* R17958 - ADCL_RETUNE_C20_1 */ 418 { 17958, 0x0000 }, /* R17958 - ADCL_RETUNE_C20_1 */
418 [17959] = 0x0000, /* R17959 - ADCL_RETUNE_C20_0 */ 419 { 17959, 0x0000 }, /* R17959 - ADCL_RETUNE_C20_0 */
419 [17960] = 0x0000, /* R17960 - ADCL_RETUNE_C21_1 */ 420 { 17960, 0x0000 }, /* R17960 - ADCL_RETUNE_C21_1 */
420 [17961] = 0x0000, /* R17961 - ADCL_RETUNE_C21_0 */ 421 { 17961, 0x0000 }, /* R17961 - ADCL_RETUNE_C21_0 */
421 [17962] = 0x0000, /* R17962 - ADCL_RETUNE_C22_1 */ 422 { 17962, 0x0000 }, /* R17962 - ADCL_RETUNE_C22_1 */
422 [17963] = 0x0000, /* R17963 - ADCL_RETUNE_C22_0 */ 423 { 17963, 0x0000 }, /* R17963 - ADCL_RETUNE_C22_0 */
423 [17964] = 0x0000, /* R17964 - ADCL_RETUNE_C23_1 */ 424 { 17964, 0x0000 }, /* R17964 - ADCL_RETUNE_C23_1 */
424 [17965] = 0x0000, /* R17965 - ADCL_RETUNE_C23_0 */ 425 { 17965, 0x0000 }, /* R17965 - ADCL_RETUNE_C23_0 */
425 [17966] = 0x0000, /* R17966 - ADCL_RETUNE_C24_1 */ 426 { 17966, 0x0000 }, /* R17966 - ADCL_RETUNE_C24_1 */
426 [17967] = 0x0000, /* R17967 - ADCL_RETUNE_C24_0 */ 427 { 17967, 0x0000 }, /* R17967 - ADCL_RETUNE_C24_0 */
427 [17968] = 0x0000, /* R17968 - ADCL_RETUNE_C25_1 */ 428 { 17968, 0x0000 }, /* R17968 - ADCL_RETUNE_C25_1 */
428 [17969] = 0x0000, /* R17969 - ADCL_RETUNE_C25_0 */ 429 { 17969, 0x0000 }, /* R17969 - ADCL_RETUNE_C25_0 */
429 [17970] = 0x0000, /* R17970 - ADCL_RETUNE_C26_1 */ 430 { 17970, 0x0000 }, /* R17970 - ADCL_RETUNE_C26_1 */
430 [17971] = 0x0000, /* R17971 - ADCL_RETUNE_C26_0 */ 431 { 17971, 0x0000 }, /* R17971 - ADCL_RETUNE_C26_0 */
431 [17972] = 0x0000, /* R17972 - ADCL_RETUNE_C27_1 */ 432 { 17972, 0x0000 }, /* R17972 - ADCL_RETUNE_C27_1 */
432 [17973] = 0x0000, /* R17973 - ADCL_RETUNE_C27_0 */ 433 { 17973, 0x0000 }, /* R17973 - ADCL_RETUNE_C27_0 */
433 [17974] = 0x0000, /* R17974 - ADCL_RETUNE_C28_1 */ 434 { 17974, 0x0000 }, /* R17974 - ADCL_RETUNE_C28_1 */
434 [17975] = 0x0000, /* R17975 - ADCL_RETUNE_C28_0 */ 435 { 17975, 0x0000 }, /* R17975 - ADCL_RETUNE_C28_0 */
435 [17976] = 0x0000, /* R17976 - ADCL_RETUNE_C29_1 */ 436 { 17976, 0x0000 }, /* R17976 - ADCL_RETUNE_C29_1 */
436 [17977] = 0x0000, /* R17977 - ADCL_RETUNE_C29_0 */ 437 { 17977, 0x0000 }, /* R17977 - ADCL_RETUNE_C29_0 */
437 [17978] = 0x0000, /* R17978 - ADCL_RETUNE_C30_1 */ 438 { 17978, 0x0000 }, /* R17978 - ADCL_RETUNE_C30_1 */
438 [17979] = 0x0000, /* R17979 - ADCL_RETUNE_C30_0 */ 439 { 17979, 0x0000 }, /* R17979 - ADCL_RETUNE_C30_0 */
439 [17980] = 0x0000, /* R17980 - ADCL_RETUNE_C31_1 */ 440 { 17980, 0x0000 }, /* R17980 - ADCL_RETUNE_C31_1 */
440 [17981] = 0x0000, /* R17981 - ADCL_RETUNE_C31_0 */ 441 { 17981, 0x0000 }, /* R17981 - ADCL_RETUNE_C31_0 */
441 [17982] = 0x0000, /* R17982 - ADCL_RETUNE_C32_1 */ 442 { 17982, 0x0000 }, /* R17982 - ADCL_RETUNE_C32_1 */
442 [17983] = 0x0000, /* R17983 - ADCL_RETUNE_C32_0 */ 443 { 17983, 0x0000 }, /* R17983 - ADCL_RETUNE_C32_0 */
443 444
444 [18432] = 0x0020, /* R18432 - RETUNEADC_PG2_1 */ 445 { 18432, 0x0020 }, /* R18432 - RETUNEADC_PG2_1 */
445 [18433] = 0x0000, /* R18433 - RETUNEADC_PG2_0 */ 446 { 18433, 0x0000 }, /* R18433 - RETUNEADC_PG2_0 */
446 [18434] = 0x0040, /* R18434 - RETUNEADC_PG_1 */ 447 { 18434, 0x0040 }, /* R18434 - RETUNEADC_PG_1 */
447 [18435] = 0x0000, /* R18435 - RETUNEADC_PG_0 */ 448 { 18435, 0x0000 }, /* R18435 - RETUNEADC_PG_0 */
448 449
449 [18944] = 0x007F, /* R18944 - ADCR_RETUNE_C1_1 */ 450 { 18944, 0x007F }, /* R18944 - ADCR_RETUNE_C1_1 */
450 [18945] = 0xFFFF, /* R18945 - ADCR_RETUNE_C1_0 */ 451 { 18945, 0xFFFF }, /* R18945 - ADCR_RETUNE_C1_0 */
451 [18946] = 0x0000, /* R18946 - ADCR_RETUNE_C2_1 */ 452 { 18946, 0x0000 }, /* R18946 - ADCR_RETUNE_C2_1 */
452 [18947] = 0x0000, /* R18947 - ADCR_RETUNE_C2_0 */ 453 { 18947, 0x0000 }, /* R18947 - ADCR_RETUNE_C2_0 */
453 [18948] = 0x0000, /* R18948 - ADCR_RETUNE_C3_1 */ 454 { 18948, 0x0000 }, /* R18948 - ADCR_RETUNE_C3_1 */
454 [18949] = 0x0000, /* R18949 - ADCR_RETUNE_C3_0 */ 455 { 18949, 0x0000 }, /* R18949 - ADCR_RETUNE_C3_0 */
455 [18950] = 0x0000, /* R18950 - ADCR_RETUNE_C4_1 */ 456 { 18950, 0x0000 }, /* R18950 - ADCR_RETUNE_C4_1 */
456 [18951] = 0x0000, /* R18951 - ADCR_RETUNE_C4_0 */ 457 { 18951, 0x0000 }, /* R18951 - ADCR_RETUNE_C4_0 */
457 [18952] = 0x0000, /* R18952 - ADCR_RETUNE_C5_1 */ 458 { 18952, 0x0000 }, /* R18952 - ADCR_RETUNE_C5_1 */
458 [18953] = 0x0000, /* R18953 - ADCR_RETUNE_C5_0 */ 459 { 18953, 0x0000 }, /* R18953 - ADCR_RETUNE_C5_0 */
459 [18954] = 0x0000, /* R18954 - ADCR_RETUNE_C6_1 */ 460 { 18954, 0x0000 }, /* R18954 - ADCR_RETUNE_C6_1 */
460 [18955] = 0x0000, /* R18955 - ADCR_RETUNE_C6_0 */ 461 { 18955, 0x0000 }, /* R18955 - ADCR_RETUNE_C6_0 */
461 [18956] = 0x0000, /* R18956 - ADCR_RETUNE_C7_1 */ 462 { 18956, 0x0000 }, /* R18956 - ADCR_RETUNE_C7_1 */
462 [18957] = 0x0000, /* R18957 - ADCR_RETUNE_C7_0 */ 463 { 18957, 0x0000 }, /* R18957 - ADCR_RETUNE_C7_0 */
463 [18958] = 0x0000, /* R18958 - ADCR_RETUNE_C8_1 */ 464 { 18958, 0x0000 }, /* R18958 - ADCR_RETUNE_C8_1 */
464 [18959] = 0x0000, /* R18959 - ADCR_RETUNE_C8_0 */ 465 { 18959, 0x0000 }, /* R18959 - ADCR_RETUNE_C8_0 */
465 [18960] = 0x0000, /* R18960 - ADCR_RETUNE_C9_1 */ 466 { 18960, 0x0000 }, /* R18960 - ADCR_RETUNE_C9_1 */
466 [18961] = 0x0000, /* R18961 - ADCR_RETUNE_C9_0 */ 467 { 18961, 0x0000 }, /* R18961 - ADCR_RETUNE_C9_0 */
467 [18962] = 0x0000, /* R18962 - ADCR_RETUNE_C10_1 */ 468 { 18962, 0x0000 }, /* R18962 - ADCR_RETUNE_C10_1 */
468 [18963] = 0x0000, /* R18963 - ADCR_RETUNE_C10_0 */ 469 { 18963, 0x0000 }, /* R18963 - ADCR_RETUNE_C10_0 */
469 [18964] = 0x0000, /* R18964 - ADCR_RETUNE_C11_1 */ 470 { 18964, 0x0000 }, /* R18964 - ADCR_RETUNE_C11_1 */
470 [18965] = 0x0000, /* R18965 - ADCR_RETUNE_C11_0 */ 471 { 18965, 0x0000 }, /* R18965 - ADCR_RETUNE_C11_0 */
471 [18966] = 0x0000, /* R18966 - ADCR_RETUNE_C12_1 */ 472 { 18966, 0x0000 }, /* R18966 - ADCR_RETUNE_C12_1 */
472 [18967] = 0x0000, /* R18967 - ADCR_RETUNE_C12_0 */ 473 { 18967, 0x0000 }, /* R18967 - ADCR_RETUNE_C12_0 */
473 [18968] = 0x0000, /* R18968 - ADCR_RETUNE_C13_1 */ 474 { 18968, 0x0000 }, /* R18968 - ADCR_RETUNE_C13_1 */
474 [18969] = 0x0000, /* R18969 - ADCR_RETUNE_C13_0 */ 475 { 18969, 0x0000 }, /* R18969 - ADCR_RETUNE_C13_0 */
475 [18970] = 0x0000, /* R18970 - ADCR_RETUNE_C14_1 */ 476 { 18970, 0x0000 }, /* R18970 - ADCR_RETUNE_C14_1 */
476 [18971] = 0x0000, /* R18971 - ADCR_RETUNE_C14_0 */ 477 { 18971, 0x0000 }, /* R18971 - ADCR_RETUNE_C14_0 */
477 [18972] = 0x0000, /* R18972 - ADCR_RETUNE_C15_1 */ 478 { 18972, 0x0000 }, /* R18972 - ADCR_RETUNE_C15_1 */
478 [18973] = 0x0000, /* R18973 - ADCR_RETUNE_C15_0 */ 479 { 18973, 0x0000 }, /* R18973 - ADCR_RETUNE_C15_0 */
479 [18974] = 0x0000, /* R18974 - ADCR_RETUNE_C16_1 */ 480 { 18974, 0x0000 }, /* R18974 - ADCR_RETUNE_C16_1 */
480 [18975] = 0x0000, /* R18975 - ADCR_RETUNE_C16_0 */ 481 { 18975, 0x0000 }, /* R18975 - ADCR_RETUNE_C16_0 */
481 [18976] = 0x0000, /* R18976 - ADCR_RETUNE_C17_1 */ 482 { 18976, 0x0000 }, /* R18976 - ADCR_RETUNE_C17_1 */
482 [18977] = 0x0000, /* R18977 - ADCR_RETUNE_C17_0 */ 483 { 18977, 0x0000 }, /* R18977 - ADCR_RETUNE_C17_0 */
483 [18978] = 0x0000, /* R18978 - ADCR_RETUNE_C18_1 */ 484 { 18978, 0x0000 }, /* R18978 - ADCR_RETUNE_C18_1 */
484 [18979] = 0x0000, /* R18979 - ADCR_RETUNE_C18_0 */ 485 { 18979, 0x0000 }, /* R18979 - ADCR_RETUNE_C18_0 */
485 [18980] = 0x0000, /* R18980 - ADCR_RETUNE_C19_1 */ 486 { 18980, 0x0000 }, /* R18980 - ADCR_RETUNE_C19_1 */
486 [18981] = 0x0000, /* R18981 - ADCR_RETUNE_C19_0 */ 487 { 18981, 0x0000 }, /* R18981 - ADCR_RETUNE_C19_0 */
487 [18982] = 0x0000, /* R18982 - ADCR_RETUNE_C20_1 */ 488 { 18982, 0x0000 }, /* R18982 - ADCR_RETUNE_C20_1 */
488 [18983] = 0x0000, /* R18983 - ADCR_RETUNE_C20_0 */ 489 { 18983, 0x0000 }, /* R18983 - ADCR_RETUNE_C20_0 */
489 [18984] = 0x0000, /* R18984 - ADCR_RETUNE_C21_1 */ 490 { 18984, 0x0000 }, /* R18984 - ADCR_RETUNE_C21_1 */
490 [18985] = 0x0000, /* R18985 - ADCR_RETUNE_C21_0 */ 491 { 18985, 0x0000 }, /* R18985 - ADCR_RETUNE_C21_0 */
491 [18986] = 0x0000, /* R18986 - ADCR_RETUNE_C22_1 */ 492 { 18986, 0x0000 }, /* R18986 - ADCR_RETUNE_C22_1 */
492 [18987] = 0x0000, /* R18987 - ADCR_RETUNE_C22_0 */ 493 { 18987, 0x0000 }, /* R18987 - ADCR_RETUNE_C22_0 */
493 [18988] = 0x0000, /* R18988 - ADCR_RETUNE_C23_1 */ 494 { 18988, 0x0000 }, /* R18988 - ADCR_RETUNE_C23_1 */
494 [18989] = 0x0000, /* R18989 - ADCR_RETUNE_C23_0 */ 495 { 18989, 0x0000 }, /* R18989 - ADCR_RETUNE_C23_0 */
495 [18990] = 0x0000, /* R18990 - ADCR_RETUNE_C24_1 */ 496 { 18990, 0x0000 }, /* R18990 - ADCR_RETUNE_C24_1 */
496 [18991] = 0x0000, /* R18991 - ADCR_RETUNE_C24_0 */ 497 { 18991, 0x0000 }, /* R18991 - ADCR_RETUNE_C24_0 */
497 [18992] = 0x0000, /* R18992 - ADCR_RETUNE_C25_1 */ 498 { 18992, 0x0000 }, /* R18992 - ADCR_RETUNE_C25_1 */
498 [18993] = 0x0000, /* R18993 - ADCR_RETUNE_C25_0 */ 499 { 18993, 0x0000 }, /* R18993 - ADCR_RETUNE_C25_0 */
499 [18994] = 0x0000, /* R18994 - ADCR_RETUNE_C26_1 */ 500 { 18994, 0x0000 }, /* R18994 - ADCR_RETUNE_C26_1 */
500 [18995] = 0x0000, /* R18995 - ADCR_RETUNE_C26_0 */ 501 { 18995, 0x0000 }, /* R18995 - ADCR_RETUNE_C26_0 */
501 [18996] = 0x0000, /* R18996 - ADCR_RETUNE_C27_1 */ 502 { 18996, 0x0000 }, /* R18996 - ADCR_RETUNE_C27_1 */
502 [18997] = 0x0000, /* R18997 - ADCR_RETUNE_C27_0 */ 503 { 18997, 0x0000 }, /* R18997 - ADCR_RETUNE_C27_0 */
503 [18998] = 0x0000, /* R18998 - ADCR_RETUNE_C28_1 */ 504 { 18998, 0x0000 }, /* R18998 - ADCR_RETUNE_C28_1 */
504 [18999] = 0x0000, /* R18999 - ADCR_RETUNE_C28_0 */ 505 { 18999, 0x0000 }, /* R18999 - ADCR_RETUNE_C28_0 */
505 [19000] = 0x0000, /* R19000 - ADCR_RETUNE_C29_1 */ 506 { 19000, 0x0000 }, /* R19000 - ADCR_RETUNE_C29_1 */
506 [19001] = 0x0000, /* R19001 - ADCR_RETUNE_C29_0 */ 507 { 19001, 0x0000 }, /* R19001 - ADCR_RETUNE_C29_0 */
507 [19002] = 0x0000, /* R19002 - ADCR_RETUNE_C30_1 */ 508 { 19002, 0x0000 }, /* R19002 - ADCR_RETUNE_C30_1 */
508 [19003] = 0x0000, /* R19003 - ADCR_RETUNE_C30_0 */ 509 { 19003, 0x0000 }, /* R19003 - ADCR_RETUNE_C30_0 */
509 [19004] = 0x0000, /* R19004 - ADCR_RETUNE_C31_1 */ 510 { 19004, 0x0000 }, /* R19004 - ADCR_RETUNE_C31_1 */
510 [19005] = 0x0000, /* R19005 - ADCR_RETUNE_C31_0 */ 511 { 19005, 0x0000 }, /* R19005 - ADCR_RETUNE_C31_0 */
511 [19006] = 0x0000, /* R19006 - ADCR_RETUNE_C32_1 */ 512 { 19006, 0x0000 }, /* R19006 - ADCR_RETUNE_C32_1 */
512 [19007] = 0x0000, /* R19007 - ADCR_RETUNE_C32_0 */ 513 { 19007, 0x0000 }, /* R19007 - ADCR_RETUNE_C32_0 */
513 514
514 [19456] = 0x007F, /* R19456 - DACL_RETUNE_C1_1 */ 515 { 19456, 0x007F }, /* R19456 - DACL_RETUNE_C1_1 */
515 [19457] = 0xFFFF, /* R19457 - DACL_RETUNE_C1_0 */ 516 { 19457, 0xFFFF }, /* R19457 - DACL_RETUNE_C1_0 */
516 [19458] = 0x0000, /* R19458 - DACL_RETUNE_C2_1 */ 517 { 19458, 0x0000 }, /* R19458 - DACL_RETUNE_C2_1 */
517 [19459] = 0x0000, /* R19459 - DACL_RETUNE_C2_0 */ 518 { 19459, 0x0000 }, /* R19459 - DACL_RETUNE_C2_0 */
518 [19460] = 0x0000, /* R19460 - DACL_RETUNE_C3_1 */ 519 { 19460, 0x0000 }, /* R19460 - DACL_RETUNE_C3_1 */
519 [19461] = 0x0000, /* R19461 - DACL_RETUNE_C3_0 */ 520 { 19461, 0x0000 }, /* R19461 - DACL_RETUNE_C3_0 */
520 [19462] = 0x0000, /* R19462 - DACL_RETUNE_C4_1 */ 521 { 19462, 0x0000 }, /* R19462 - DACL_RETUNE_C4_1 */
521 [19463] = 0x0000, /* R19463 - DACL_RETUNE_C4_0 */ 522 { 19463, 0x0000 }, /* R19463 - DACL_RETUNE_C4_0 */
522 [19464] = 0x0000, /* R19464 - DACL_RETUNE_C5_1 */ 523 { 19464, 0x0000 }, /* R19464 - DACL_RETUNE_C5_1 */
523 [19465] = 0x0000, /* R19465 - DACL_RETUNE_C5_0 */ 524 { 19465, 0x0000 }, /* R19465 - DACL_RETUNE_C5_0 */
524 [19466] = 0x0000, /* R19466 - DACL_RETUNE_C6_1 */ 525 { 19466, 0x0000 }, /* R19466 - DACL_RETUNE_C6_1 */
525 [19467] = 0x0000, /* R19467 - DACL_RETUNE_C6_0 */ 526 { 19467, 0x0000 }, /* R19467 - DACL_RETUNE_C6_0 */
526 [19468] = 0x0000, /* R19468 - DACL_RETUNE_C7_1 */ 527 { 19468, 0x0000 }, /* R19468 - DACL_RETUNE_C7_1 */
527 [19469] = 0x0000, /* R19469 - DACL_RETUNE_C7_0 */ 528 { 19469, 0x0000 }, /* R19469 - DACL_RETUNE_C7_0 */
528 [19470] = 0x0000, /* R19470 - DACL_RETUNE_C8_1 */ 529 { 19470, 0x0000 }, /* R19470 - DACL_RETUNE_C8_1 */
529 [19471] = 0x0000, /* R19471 - DACL_RETUNE_C8_0 */ 530 { 19471, 0x0000 }, /* R19471 - DACL_RETUNE_C8_0 */
530 [19472] = 0x0000, /* R19472 - DACL_RETUNE_C9_1 */ 531 { 19472, 0x0000 }, /* R19472 - DACL_RETUNE_C9_1 */
531 [19473] = 0x0000, /* R19473 - DACL_RETUNE_C9_0 */ 532 { 19473, 0x0000 }, /* R19473 - DACL_RETUNE_C9_0 */
532 [19474] = 0x0000, /* R19474 - DACL_RETUNE_C10_1 */ 533 { 19474, 0x0000 }, /* R19474 - DACL_RETUNE_C10_1 */
533 [19475] = 0x0000, /* R19475 - DACL_RETUNE_C10_0 */ 534 { 19475, 0x0000 }, /* R19475 - DACL_RETUNE_C10_0 */
534 [19476] = 0x0000, /* R19476 - DACL_RETUNE_C11_1 */ 535 { 19476, 0x0000 }, /* R19476 - DACL_RETUNE_C11_1 */
535 [19477] = 0x0000, /* R19477 - DACL_RETUNE_C11_0 */ 536 { 19477, 0x0000 }, /* R19477 - DACL_RETUNE_C11_0 */
536 [19478] = 0x0000, /* R19478 - DACL_RETUNE_C12_1 */ 537 { 19478, 0x0000 }, /* R19478 - DACL_RETUNE_C12_1 */
537 [19479] = 0x0000, /* R19479 - DACL_RETUNE_C12_0 */ 538 { 19479, 0x0000 }, /* R19479 - DACL_RETUNE_C12_0 */
538 [19480] = 0x0000, /* R19480 - DACL_RETUNE_C13_1 */ 539 { 19480, 0x0000 }, /* R19480 - DACL_RETUNE_C13_1 */
539 [19481] = 0x0000, /* R19481 - DACL_RETUNE_C13_0 */ 540 { 19481, 0x0000 }, /* R19481 - DACL_RETUNE_C13_0 */
540 [19482] = 0x0000, /* R19482 - DACL_RETUNE_C14_1 */ 541 { 19482, 0x0000 }, /* R19482 - DACL_RETUNE_C14_1 */
541 [19483] = 0x0000, /* R19483 - DACL_RETUNE_C14_0 */ 542 { 19483, 0x0000 }, /* R19483 - DACL_RETUNE_C14_0 */
542 [19484] = 0x0000, /* R19484 - DACL_RETUNE_C15_1 */ 543 { 19484, 0x0000 }, /* R19484 - DACL_RETUNE_C15_1 */
543 [19485] = 0x0000, /* R19485 - DACL_RETUNE_C15_0 */ 544 { 19485, 0x0000 }, /* R19485 - DACL_RETUNE_C15_0 */
544 [19486] = 0x0000, /* R19486 - DACL_RETUNE_C16_1 */ 545 { 19486, 0x0000 }, /* R19486 - DACL_RETUNE_C16_1 */
545 [19487] = 0x0000, /* R19487 - DACL_RETUNE_C16_0 */ 546 { 19487, 0x0000 }, /* R19487 - DACL_RETUNE_C16_0 */
546 [19488] = 0x0000, /* R19488 - DACL_RETUNE_C17_1 */ 547 { 19488, 0x0000 }, /* R19488 - DACL_RETUNE_C17_1 */
547 [19489] = 0x0000, /* R19489 - DACL_RETUNE_C17_0 */ 548 { 19489, 0x0000 }, /* R19489 - DACL_RETUNE_C17_0 */
548 [19490] = 0x0000, /* R19490 - DACL_RETUNE_C18_1 */ 549 { 19490, 0x0000 }, /* R19490 - DACL_RETUNE_C18_1 */
549 [19491] = 0x0000, /* R19491 - DACL_RETUNE_C18_0 */ 550 { 19491, 0x0000 }, /* R19491 - DACL_RETUNE_C18_0 */
550 [19492] = 0x0000, /* R19492 - DACL_RETUNE_C19_1 */ 551 { 19492, 0x0000 }, /* R19492 - DACL_RETUNE_C19_1 */
551 [19493] = 0x0000, /* R19493 - DACL_RETUNE_C19_0 */ 552 { 19493, 0x0000 }, /* R19493 - DACL_RETUNE_C19_0 */
552 [19494] = 0x0000, /* R19494 - DACL_RETUNE_C20_1 */ 553 { 19494, 0x0000 }, /* R19494 - DACL_RETUNE_C20_1 */
553 [19495] = 0x0000, /* R19495 - DACL_RETUNE_C20_0 */ 554 { 19495, 0x0000 }, /* R19495 - DACL_RETUNE_C20_0 */
554 [19496] = 0x0000, /* R19496 - DACL_RETUNE_C21_1 */ 555 { 19496, 0x0000 }, /* R19496 - DACL_RETUNE_C21_1 */
555 [19497] = 0x0000, /* R19497 - DACL_RETUNE_C21_0 */ 556 { 19497, 0x0000 }, /* R19497 - DACL_RETUNE_C21_0 */
556 [19498] = 0x0000, /* R19498 - DACL_RETUNE_C22_1 */ 557 { 19498, 0x0000 }, /* R19498 - DACL_RETUNE_C22_1 */
557 [19499] = 0x0000, /* R19499 - DACL_RETUNE_C22_0 */ 558 { 19499, 0x0000 }, /* R19499 - DACL_RETUNE_C22_0 */
558 [19500] = 0x0000, /* R19500 - DACL_RETUNE_C23_1 */ 559 { 19500, 0x0000 }, /* R19500 - DACL_RETUNE_C23_1 */
559 [19501] = 0x0000, /* R19501 - DACL_RETUNE_C23_0 */ 560 { 19501, 0x0000 }, /* R19501 - DACL_RETUNE_C23_0 */
560 [19502] = 0x0000, /* R19502 - DACL_RETUNE_C24_1 */ 561 { 19502, 0x0000 }, /* R19502 - DACL_RETUNE_C24_1 */
561 [19503] = 0x0000, /* R19503 - DACL_RETUNE_C24_0 */ 562 { 19503, 0x0000 }, /* R19503 - DACL_RETUNE_C24_0 */
562 [19504] = 0x0000, /* R19504 - DACL_RETUNE_C25_1 */ 563 { 19504, 0x0000 }, /* R19504 - DACL_RETUNE_C25_1 */
563 [19505] = 0x0000, /* R19505 - DACL_RETUNE_C25_0 */ 564 { 19505, 0x0000 }, /* R19505 - DACL_RETUNE_C25_0 */
564 [19506] = 0x0000, /* R19506 - DACL_RETUNE_C26_1 */ 565 { 19506, 0x0000 }, /* R19506 - DACL_RETUNE_C26_1 */
565 [19507] = 0x0000, /* R19507 - DACL_RETUNE_C26_0 */ 566 { 19507, 0x0000 }, /* R19507 - DACL_RETUNE_C26_0 */
566 [19508] = 0x0000, /* R19508 - DACL_RETUNE_C27_1 */ 567 { 19508, 0x0000 }, /* R19508 - DACL_RETUNE_C27_1 */
567 [19509] = 0x0000, /* R19509 - DACL_RETUNE_C27_0 */ 568 { 19509, 0x0000 }, /* R19509 - DACL_RETUNE_C27_0 */
568 [19510] = 0x0000, /* R19510 - DACL_RETUNE_C28_1 */ 569 { 19510, 0x0000 }, /* R19510 - DACL_RETUNE_C28_1 */
569 [19511] = 0x0000, /* R19511 - DACL_RETUNE_C28_0 */ 570 { 19511, 0x0000 }, /* R19511 - DACL_RETUNE_C28_0 */
570 [19512] = 0x0000, /* R19512 - DACL_RETUNE_C29_1 */ 571 { 19512, 0x0000 }, /* R19512 - DACL_RETUNE_C29_1 */
571 [19513] = 0x0000, /* R19513 - DACL_RETUNE_C29_0 */ 572 { 19513, 0x0000 }, /* R19513 - DACL_RETUNE_C29_0 */
572 [19514] = 0x0000, /* R19514 - DACL_RETUNE_C30_1 */ 573 { 19514, 0x0000 }, /* R19514 - DACL_RETUNE_C30_1 */
573 [19515] = 0x0000, /* R19515 - DACL_RETUNE_C30_0 */ 574 { 19515, 0x0000 }, /* R19515 - DACL_RETUNE_C30_0 */
574 [19516] = 0x0000, /* R19516 - DACL_RETUNE_C31_1 */ 575 { 19516, 0x0000 }, /* R19516 - DACL_RETUNE_C31_1 */
575 [19517] = 0x0000, /* R19517 - DACL_RETUNE_C31_0 */ 576 { 19517, 0x0000 }, /* R19517 - DACL_RETUNE_C31_0 */
576 [19518] = 0x0000, /* R19518 - DACL_RETUNE_C32_1 */ 577 { 19518, 0x0000 }, /* R19518 - DACL_RETUNE_C32_1 */
577 [19519] = 0x0000, /* R19519 - DACL_RETUNE_C32_0 */ 578 { 19519, 0x0000 }, /* R19519 - DACL_RETUNE_C32_0 */
578 579
579 [19968] = 0x0020, /* R19968 - RETUNEDAC_PG2_1 */ 580 { 19968, 0x0020 }, /* R19968 - RETUNEDAC_PG2_1 */
580 [19969] = 0x0000, /* R19969 - RETUNEDAC_PG2_0 */ 581 { 19969, 0x0000 }, /* R19969 - RETUNEDAC_PG2_0 */
581 [19970] = 0x0040, /* R19970 - RETUNEDAC_PG_1 */ 582 { 19970, 0x0040 }, /* R19970 - RETUNEDAC_PG_1 */
582 [19971] = 0x0000, /* R19971 - RETUNEDAC_PG_0 */ 583 { 19971, 0x0000 }, /* R19971 - RETUNEDAC_PG_0 */
583 584
584 [20480] = 0x007F, /* R20480 - DACR_RETUNE_C1_1 */ 585 { 20480, 0x007F }, /* R20480 - DACR_RETUNE_C1_1 */
585 [20481] = 0xFFFF, /* R20481 - DACR_RETUNE_C1_0 */ 586 { 20481, 0xFFFF }, /* R20481 - DACR_RETUNE_C1_0 */
586 [20482] = 0x0000, /* R20482 - DACR_RETUNE_C2_1 */ 587 { 20482, 0x0000 }, /* R20482 - DACR_RETUNE_C2_1 */
587 [20483] = 0x0000, /* R20483 - DACR_RETUNE_C2_0 */ 588 { 20483, 0x0000 }, /* R20483 - DACR_RETUNE_C2_0 */
588 [20484] = 0x0000, /* R20484 - DACR_RETUNE_C3_1 */ 589 { 20484, 0x0000 }, /* R20484 - DACR_RETUNE_C3_1 */
589 [20485] = 0x0000, /* R20485 - DACR_RETUNE_C3_0 */ 590 { 20485, 0x0000 }, /* R20485 - DACR_RETUNE_C3_0 */
590 [20486] = 0x0000, /* R20486 - DACR_RETUNE_C4_1 */ 591 { 20486, 0x0000 }, /* R20486 - DACR_RETUNE_C4_1 */
591 [20487] = 0x0000, /* R20487 - DACR_RETUNE_C4_0 */ 592 { 20487, 0x0000 }, /* R20487 - DACR_RETUNE_C4_0 */
592 [20488] = 0x0000, /* R20488 - DACR_RETUNE_C5_1 */ 593 { 20488, 0x0000 }, /* R20488 - DACR_RETUNE_C5_1 */
593 [20489] = 0x0000, /* R20489 - DACR_RETUNE_C5_0 */ 594 { 20489, 0x0000 }, /* R20489 - DACR_RETUNE_C5_0 */
594 [20490] = 0x0000, /* R20490 - DACR_RETUNE_C6_1 */ 595 { 20490, 0x0000 }, /* R20490 - DACR_RETUNE_C6_1 */
595 [20491] = 0x0000, /* R20491 - DACR_RETUNE_C6_0 */ 596 { 20491, 0x0000 }, /* R20491 - DACR_RETUNE_C6_0 */
596 [20492] = 0x0000, /* R20492 - DACR_RETUNE_C7_1 */ 597 { 20492, 0x0000 }, /* R20492 - DACR_RETUNE_C7_1 */
597 [20493] = 0x0000, /* R20493 - DACR_RETUNE_C7_0 */ 598 { 20493, 0x0000 }, /* R20493 - DACR_RETUNE_C7_0 */
598 [20494] = 0x0000, /* R20494 - DACR_RETUNE_C8_1 */ 599 { 20494, 0x0000 }, /* R20494 - DACR_RETUNE_C8_1 */
599 [20495] = 0x0000, /* R20495 - DACR_RETUNE_C8_0 */ 600 { 20495, 0x0000 }, /* R20495 - DACR_RETUNE_C8_0 */
600 [20496] = 0x0000, /* R20496 - DACR_RETUNE_C9_1 */ 601 { 20496, 0x0000 }, /* R20496 - DACR_RETUNE_C9_1 */
601 [20497] = 0x0000, /* R20497 - DACR_RETUNE_C9_0 */ 602 { 20497, 0x0000 }, /* R20497 - DACR_RETUNE_C9_0 */
602 [20498] = 0x0000, /* R20498 - DACR_RETUNE_C10_1 */ 603 { 20498, 0x0000 }, /* R20498 - DACR_RETUNE_C10_1 */
603 [20499] = 0x0000, /* R20499 - DACR_RETUNE_C10_0 */ 604 { 20499, 0x0000 }, /* R20499 - DACR_RETUNE_C10_0 */
604 [20500] = 0x0000, /* R20500 - DACR_RETUNE_C11_1 */ 605 { 20500, 0x0000 }, /* R20500 - DACR_RETUNE_C11_1 */
605 [20501] = 0x0000, /* R20501 - DACR_RETUNE_C11_0 */ 606 { 20501, 0x0000 }, /* R20501 - DACR_RETUNE_C11_0 */
606 [20502] = 0x0000, /* R20502 - DACR_RETUNE_C12_1 */ 607 { 20502, 0x0000 }, /* R20502 - DACR_RETUNE_C12_1 */
607 [20503] = 0x0000, /* R20503 - DACR_RETUNE_C12_0 */ 608 { 20503, 0x0000 }, /* R20503 - DACR_RETUNE_C12_0 */
608 [20504] = 0x0000, /* R20504 - DACR_RETUNE_C13_1 */ 609 { 20504, 0x0000 }, /* R20504 - DACR_RETUNE_C13_1 */
609 [20505] = 0x0000, /* R20505 - DACR_RETUNE_C13_0 */ 610 { 20505, 0x0000 }, /* R20505 - DACR_RETUNE_C13_0 */
610 [20506] = 0x0000, /* R20506 - DACR_RETUNE_C14_1 */ 611 { 20506, 0x0000 }, /* R20506 - DACR_RETUNE_C14_1 */
611 [20507] = 0x0000, /* R20507 - DACR_RETUNE_C14_0 */ 612 { 20507, 0x0000 }, /* R20507 - DACR_RETUNE_C14_0 */
612 [20508] = 0x0000, /* R20508 - DACR_RETUNE_C15_1 */ 613 { 20508, 0x0000 }, /* R20508 - DACR_RETUNE_C15_1 */
613 [20509] = 0x0000, /* R20509 - DACR_RETUNE_C15_0 */ 614 { 20509, 0x0000 }, /* R20509 - DACR_RETUNE_C15_0 */
614 [20510] = 0x0000, /* R20510 - DACR_RETUNE_C16_1 */ 615 { 20510, 0x0000 }, /* R20510 - DACR_RETUNE_C16_1 */
615 [20511] = 0x0000, /* R20511 - DACR_RETUNE_C16_0 */ 616 { 20511, 0x0000 }, /* R20511 - DACR_RETUNE_C16_0 */
616 [20512] = 0x0000, /* R20512 - DACR_RETUNE_C17_1 */ 617 { 20512, 0x0000 }, /* R20512 - DACR_RETUNE_C17_1 */
617 [20513] = 0x0000, /* R20513 - DACR_RETUNE_C17_0 */ 618 { 20513, 0x0000 }, /* R20513 - DACR_RETUNE_C17_0 */
618 [20514] = 0x0000, /* R20514 - DACR_RETUNE_C18_1 */ 619 { 20514, 0x0000 }, /* R20514 - DACR_RETUNE_C18_1 */
619 [20515] = 0x0000, /* R20515 - DACR_RETUNE_C18_0 */ 620 { 20515, 0x0000 }, /* R20515 - DACR_RETUNE_C18_0 */
620 [20516] = 0x0000, /* R20516 - DACR_RETUNE_C19_1 */ 621 { 20516, 0x0000 }, /* R20516 - DACR_RETUNE_C19_1 */
621 [20517] = 0x0000, /* R20517 - DACR_RETUNE_C19_0 */ 622 { 20517, 0x0000 }, /* R20517 - DACR_RETUNE_C19_0 */
622 [20518] = 0x0000, /* R20518 - DACR_RETUNE_C20_1 */ 623 { 20518, 0x0000 }, /* R20518 - DACR_RETUNE_C20_1 */
623 [20519] = 0x0000, /* R20519 - DACR_RETUNE_C20_0 */ 624 { 20519, 0x0000 }, /* R20519 - DACR_RETUNE_C20_0 */
624 [20520] = 0x0000, /* R20520 - DACR_RETUNE_C21_1 */ 625 { 20520, 0x0000 }, /* R20520 - DACR_RETUNE_C21_1 */
625 [20521] = 0x0000, /* R20521 - DACR_RETUNE_C21_0 */ 626 { 20521, 0x0000 }, /* R20521 - DACR_RETUNE_C21_0 */
626 [20522] = 0x0000, /* R20522 - DACR_RETUNE_C22_1 */ 627 { 20522, 0x0000 }, /* R20522 - DACR_RETUNE_C22_1 */
627 [20523] = 0x0000, /* R20523 - DACR_RETUNE_C22_0 */ 628 { 20523, 0x0000 }, /* R20523 - DACR_RETUNE_C22_0 */
628 [20524] = 0x0000, /* R20524 - DACR_RETUNE_C23_1 */ 629 { 20524, 0x0000 }, /* R20524 - DACR_RETUNE_C23_1 */
629 [20525] = 0x0000, /* R20525 - DACR_RETUNE_C23_0 */ 630 { 20525, 0x0000 }, /* R20525 - DACR_RETUNE_C23_0 */
630 [20526] = 0x0000, /* R20526 - DACR_RETUNE_C24_1 */ 631 { 20526, 0x0000 }, /* R20526 - DACR_RETUNE_C24_1 */
631 [20527] = 0x0000, /* R20527 - DACR_RETUNE_C24_0 */ 632 { 20527, 0x0000 }, /* R20527 - DACR_RETUNE_C24_0 */
632 [20528] = 0x0000, /* R20528 - DACR_RETUNE_C25_1 */ 633 { 20528, 0x0000 }, /* R20528 - DACR_RETUNE_C25_1 */
633 [20529] = 0x0000, /* R20529 - DACR_RETUNE_C25_0 */ 634 { 20529, 0x0000 }, /* R20529 - DACR_RETUNE_C25_0 */
634 [20530] = 0x0000, /* R20530 - DACR_RETUNE_C26_1 */ 635 { 20530, 0x0000 }, /* R20530 - DACR_RETUNE_C26_1 */
635 [20531] = 0x0000, /* R20531 - DACR_RETUNE_C26_0 */ 636 { 20531, 0x0000 }, /* R20531 - DACR_RETUNE_C26_0 */
636 [20532] = 0x0000, /* R20532 - DACR_RETUNE_C27_1 */ 637 { 20532, 0x0000 }, /* R20532 - DACR_RETUNE_C27_1 */
637 [20533] = 0x0000, /* R20533 - DACR_RETUNE_C27_0 */ 638 { 20533, 0x0000 }, /* R20533 - DACR_RETUNE_C27_0 */
638 [20534] = 0x0000, /* R20534 - DACR_RETUNE_C28_1 */ 639 { 20534, 0x0000 }, /* R20534 - DACR_RETUNE_C28_1 */
639 [20535] = 0x0000, /* R20535 - DACR_RETUNE_C28_0 */ 640 { 20535, 0x0000 }, /* R20535 - DACR_RETUNE_C28_0 */
640 [20536] = 0x0000, /* R20536 - DACR_RETUNE_C29_1 */ 641 { 20536, 0x0000 }, /* R20536 - DACR_RETUNE_C29_1 */
641 [20537] = 0x0000, /* R20537 - DACR_RETUNE_C29_0 */ 642 { 20537, 0x0000 }, /* R20537 - DACR_RETUNE_C29_0 */
642 [20538] = 0x0000, /* R20538 - DACR_RETUNE_C30_1 */ 643 { 20538, 0x0000 }, /* R20538 - DACR_RETUNE_C30_1 */
643 [20539] = 0x0000, /* R20539 - DACR_RETUNE_C30_0 */ 644 { 20539, 0x0000 }, /* R20539 - DACR_RETUNE_C30_0 */
644 [20540] = 0x0000, /* R20540 - DACR_RETUNE_C31_1 */ 645 { 20540, 0x0000 }, /* R20540 - DACR_RETUNE_C31_1 */
645 [20541] = 0x0000, /* R20541 - DACR_RETUNE_C31_0 */ 646 { 20541, 0x0000 }, /* R20541 - DACR_RETUNE_C31_0 */
646 [20542] = 0x0000, /* R20542 - DACR_RETUNE_C32_1 */ 647 { 20542, 0x0000 }, /* R20542 - DACR_RETUNE_C32_1 */
647 [20543] = 0x0000, /* R20543 - DACR_RETUNE_C32_0 */ 648 { 20543, 0x0000 }, /* R20543 - DACR_RETUNE_C32_0 */
648 649
649 [20992] = 0x008C, /* R20992 - VSS_XHD2_1 */ 650 { 20992, 0x008C }, /* R20992 - VSS_XHD2_1 */
650 [20993] = 0x0200, /* R20993 - VSS_XHD2_0 */ 651 { 20993, 0x0200 }, /* R20993 - VSS_XHD2_0 */
651 [20994] = 0x0035, /* R20994 - VSS_XHD3_1 */ 652 { 20994, 0x0035 }, /* R20994 - VSS_XHD3_1 */
652 [20995] = 0x0700, /* R20995 - VSS_XHD3_0 */ 653 { 20995, 0x0700 }, /* R20995 - VSS_XHD3_0 */
653 [20996] = 0x003A, /* R20996 - VSS_XHN1_1 */ 654 { 20996, 0x003A }, /* R20996 - VSS_XHN1_1 */
654 [20997] = 0x4100, /* R20997 - VSS_XHN1_0 */ 655 { 20997, 0x4100 }, /* R20997 - VSS_XHN1_0 */
655 [20998] = 0x008B, /* R20998 - VSS_XHN2_1 */ 656 { 20998, 0x008B }, /* R20998 - VSS_XHN2_1 */
656 [20999] = 0x7D00, /* R20999 - VSS_XHN2_0 */ 657 { 20999, 0x7D00 }, /* R20999 - VSS_XHN2_0 */
657 [21000] = 0x003A, /* R21000 - VSS_XHN3_1 */ 658 { 21000, 0x003A }, /* R21000 - VSS_XHN3_1 */
658 [21001] = 0x4100, /* R21001 - VSS_XHN3_0 */ 659 { 21001, 0x4100 }, /* R21001 - VSS_XHN3_0 */
659 [21002] = 0x008C, /* R21002 - VSS_XLA_1 */ 660 { 21002, 0x008C }, /* R21002 - VSS_XLA_1 */
660 [21003] = 0xFEE8, /* R21003 - VSS_XLA_0 */ 661 { 21003, 0xFEE8 }, /* R21003 - VSS_XLA_0 */
661 [21004] = 0x0078, /* R21004 - VSS_XLB_1 */ 662 { 21004, 0x0078 }, /* R21004 - VSS_XLB_1 */
662 [21005] = 0x0000, /* R21005 - VSS_XLB_0 */ 663 { 21005, 0x0000 }, /* R21005 - VSS_XLB_0 */
663 [21006] = 0x003F, /* R21006 - VSS_XLG_1 */ 664 { 21006, 0x003F }, /* R21006 - VSS_XLG_1 */
664 [21007] = 0xB260, /* R21007 - VSS_XLG_0 */ 665 { 21007, 0xB260 }, /* R21007 - VSS_XLG_0 */
665 [21008] = 0x002D, /* R21008 - VSS_PG2_1 */ 666 { 21008, 0x002D }, /* R21008 - VSS_PG2_1 */
666 [21009] = 0x1818, /* R21009 - VSS_PG2_0 */ 667 { 21009, 0x1818 }, /* R21009 - VSS_PG2_0 */
667 [21010] = 0x0020, /* R21010 - VSS_PG_1 */ 668 { 21010, 0x0020 }, /* R21010 - VSS_PG_1 */
668 [21011] = 0x0000, /* R21011 - VSS_PG_0 */ 669 { 21011, 0x0000 }, /* R21011 - VSS_PG_0 */
669 [21012] = 0x00F1, /* R21012 - VSS_XTD1_1 */ 670 { 21012, 0x00F1 }, /* R21012 - VSS_XTD1_1 */
670 [21013] = 0x8340, /* R21013 - VSS_XTD1_0 */ 671 { 21013, 0x8340 }, /* R21013 - VSS_XTD1_0 */
671 [21014] = 0x00FB, /* R21014 - VSS_XTD2_1 */ 672 { 21014, 0x00FB }, /* R21014 - VSS_XTD2_1 */
672 [21015] = 0x8300, /* R21015 - VSS_XTD2_0 */ 673 { 21015, 0x8300 }, /* R21015 - VSS_XTD2_0 */
673 [21016] = 0x00EE, /* R21016 - VSS_XTD3_1 */ 674 { 21016, 0x00EE }, /* R21016 - VSS_XTD3_1 */
674 [21017] = 0xAEC0, /* R21017 - VSS_XTD3_0 */ 675 { 21017, 0xAEC0 }, /* R21017 - VSS_XTD3_0 */
675 [21018] = 0x00FB, /* R21018 - VSS_XTD4_1 */ 676 { 21018, 0x00FB }, /* R21018 - VSS_XTD4_1 */
676 [21019] = 0xAC40, /* R21019 - VSS_XTD4_0 */ 677 { 21019, 0xAC40 }, /* R21019 - VSS_XTD4_0 */
677 [21020] = 0x00F1, /* R21020 - VSS_XTD5_1 */ 678 { 21020, 0x00F1 }, /* R21020 - VSS_XTD5_1 */
678 [21021] = 0x7F80, /* R21021 - VSS_XTD5_0 */ 679 { 21021, 0x7F80 }, /* R21021 - VSS_XTD5_0 */
679 [21022] = 0x00F4, /* R21022 - VSS_XTD6_1 */ 680 { 21022, 0x00F4 }, /* R21022 - VSS_XTD6_1 */
680 [21023] = 0x3B40, /* R21023 - VSS_XTD6_0 */ 681 { 21023, 0x3B40 }, /* R21023 - VSS_XTD6_0 */
681 [21024] = 0x00F5, /* R21024 - VSS_XTD7_1 */ 682 { 21024, 0x00F5 }, /* R21024 - VSS_XTD7_1 */
682 [21025] = 0xFB00, /* R21025 - VSS_XTD7_0 */ 683 { 21025, 0xFB00 }, /* R21025 - VSS_XTD7_0 */
683 [21026] = 0x00EA, /* R21026 - VSS_XTD8_1 */ 684 { 21026, 0x00EA }, /* R21026 - VSS_XTD8_1 */
684 [21027] = 0x10C0, /* R21027 - VSS_XTD8_0 */ 685 { 21027, 0x10C0 }, /* R21027 - VSS_XTD8_0 */
685 [21028] = 0x00FC, /* R21028 - VSS_XTD9_1 */ 686 { 21028, 0x00FC }, /* R21028 - VSS_XTD9_1 */
686 [21029] = 0xC580, /* R21029 - VSS_XTD9_0 */ 687 { 21029, 0xC580 }, /* R21029 - VSS_XTD9_0 */
687 [21030] = 0x00E2, /* R21030 - VSS_XTD10_1 */ 688 { 21030, 0x00E2 }, /* R21030 - VSS_XTD10_1 */
688 [21031] = 0x75C0, /* R21031 - VSS_XTD10_0 */ 689 { 21031, 0x75C0 }, /* R21031 - VSS_XTD10_0 */
689 [21032] = 0x0004, /* R21032 - VSS_XTD11_1 */ 690 { 21032, 0x0004 }, /* R21032 - VSS_XTD11_1 */
690 [21033] = 0xB480, /* R21033 - VSS_XTD11_0 */ 691 { 21033, 0xB480 }, /* R21033 - VSS_XTD11_0 */
691 [21034] = 0x00D4, /* R21034 - VSS_XTD12_1 */ 692 { 21034, 0x00D4 }, /* R21034 - VSS_XTD12_1 */
692 [21035] = 0xF980, /* R21035 - VSS_XTD12_0 */ 693 { 21035, 0xF980 }, /* R21035 - VSS_XTD12_0 */
693 [21036] = 0x0004, /* R21036 - VSS_XTD13_1 */ 694 { 21036, 0x0004 }, /* R21036 - VSS_XTD13_1 */
694 [21037] = 0x9140, /* R21037 - VSS_XTD13_0 */ 695 { 21037, 0x9140 }, /* R21037 - VSS_XTD13_0 */
695 [21038] = 0x00D8, /* R21038 - VSS_XTD14_1 */ 696 { 21038, 0x00D8 }, /* R21038 - VSS_XTD14_1 */
696 [21039] = 0xA480, /* R21039 - VSS_XTD14_0 */ 697 { 21039, 0xA480 }, /* R21039 - VSS_XTD14_0 */
697 [21040] = 0x0002, /* R21040 - VSS_XTD15_1 */ 698 { 21040, 0x0002 }, /* R21040 - VSS_XTD15_1 */
698 [21041] = 0x3DC0, /* R21041 - VSS_XTD15_0 */ 699 { 21041, 0x3DC0 }, /* R21041 - VSS_XTD15_0 */
699 [21042] = 0x00CF, /* R21042 - VSS_XTD16_1 */ 700 { 21042, 0x00CF }, /* R21042 - VSS_XTD16_1 */
700 [21043] = 0x7A80, /* R21043 - VSS_XTD16_0 */ 701 { 21043, 0x7A80 }, /* R21043 - VSS_XTD16_0 */
701 [21044] = 0x00DC, /* R21044 - VSS_XTD17_1 */ 702 { 21044, 0x00DC }, /* R21044 - VSS_XTD17_1 */
702 [21045] = 0x0600, /* R21045 - VSS_XTD17_0 */ 703 { 21045, 0x0600 }, /* R21045 - VSS_XTD17_0 */
703 [21046] = 0x00F2, /* R21046 - VSS_XTD18_1 */ 704 { 21046, 0x00F2 }, /* R21046 - VSS_XTD18_1 */
704 [21047] = 0xDAC0, /* R21047 - VSS_XTD18_0 */ 705 { 21047, 0xDAC0 }, /* R21047 - VSS_XTD18_0 */
705 [21048] = 0x00BA, /* R21048 - VSS_XTD19_1 */ 706 { 21048, 0x00BA }, /* R21048 - VSS_XTD19_1 */
706 [21049] = 0xF340, /* R21049 - VSS_XTD19_0 */ 707 { 21049, 0xF340 }, /* R21049 - VSS_XTD19_0 */
707 [21050] = 0x000A, /* R21050 - VSS_XTD20_1 */ 708 { 21050, 0x000A }, /* R21050 - VSS_XTD20_1 */
708 [21051] = 0x7940, /* R21051 - VSS_XTD20_0 */ 709 { 21051, 0x7940 }, /* R21051 - VSS_XTD20_0 */
709 [21052] = 0x001C, /* R21052 - VSS_XTD21_1 */ 710 { 21052, 0x001C }, /* R21052 - VSS_XTD21_1 */
710 [21053] = 0x0680, /* R21053 - VSS_XTD21_0 */ 711 { 21053, 0x0680 }, /* R21053 - VSS_XTD21_0 */
711 [21054] = 0x00FD, /* R21054 - VSS_XTD22_1 */ 712 { 21054, 0x00FD }, /* R21054 - VSS_XTD22_1 */
712 [21055] = 0x2D00, /* R21055 - VSS_XTD22_0 */ 713 { 21055, 0x2D00 }, /* R21055 - VSS_XTD22_0 */
713 [21056] = 0x001C, /* R21056 - VSS_XTD23_1 */ 714 { 21056, 0x001C }, /* R21056 - VSS_XTD23_1 */
714 [21057] = 0xE840, /* R21057 - VSS_XTD23_0 */ 715 { 21057, 0xE840 }, /* R21057 - VSS_XTD23_0 */
715 [21058] = 0x000D, /* R21058 - VSS_XTD24_1 */ 716 { 21058, 0x000D }, /* R21058 - VSS_XTD24_1 */
716 [21059] = 0xDC40, /* R21059 - VSS_XTD24_0 */ 717 { 21059, 0xDC40 }, /* R21059 - VSS_XTD24_0 */
717 [21060] = 0x00FC, /* R21060 - VSS_XTD25_1 */ 718 { 21060, 0x00FC }, /* R21060 - VSS_XTD25_1 */
718 [21061] = 0x9D00, /* R21061 - VSS_XTD25_0 */ 719 { 21061, 0x9D00 }, /* R21061 - VSS_XTD25_0 */
719 [21062] = 0x0009, /* R21062 - VSS_XTD26_1 */ 720 { 21062, 0x0009 }, /* R21062 - VSS_XTD26_1 */
720 [21063] = 0x5580, /* R21063 - VSS_XTD26_0 */ 721 { 21063, 0x5580 }, /* R21063 - VSS_XTD26_0 */
721 [21064] = 0x00FE, /* R21064 - VSS_XTD27_1 */ 722 { 21064, 0x00FE }, /* R21064 - VSS_XTD27_1 */
722 [21065] = 0x7E80, /* R21065 - VSS_XTD27_0 */ 723 { 21065, 0x7E80 }, /* R21065 - VSS_XTD27_0 */
723 [21066] = 0x000E, /* R21066 - VSS_XTD28_1 */ 724 { 21066, 0x000E }, /* R21066 - VSS_XTD28_1 */
724 [21067] = 0xAB40, /* R21067 - VSS_XTD28_0 */ 725 { 21067, 0xAB40 }, /* R21067 - VSS_XTD28_0 */
725 [21068] = 0x00F9, /* R21068 - VSS_XTD29_1 */ 726 { 21068, 0x00F9 }, /* R21068 - VSS_XTD29_1 */
726 [21069] = 0x9880, /* R21069 - VSS_XTD29_0 */ 727 { 21069, 0x9880 }, /* R21069 - VSS_XTD29_0 */
727 [21070] = 0x0009, /* R21070 - VSS_XTD30_1 */ 728 { 21070, 0x0009 }, /* R21070 - VSS_XTD30_1 */
728 [21071] = 0x87C0, /* R21071 - VSS_XTD30_0 */ 729 { 21071, 0x87C0 }, /* R21071 - VSS_XTD30_0 */
729 [21072] = 0x00FD, /* R21072 - VSS_XTD31_1 */ 730 { 21072, 0x00FD }, /* R21072 - VSS_XTD31_1 */
730 [21073] = 0x2C40, /* R21073 - VSS_XTD31_0 */ 731 { 21073, 0x2C40 }, /* R21073 - VSS_XTD31_0 */
731 [21074] = 0x0009, /* R21074 - VSS_XTD32_1 */ 732 { 21074, 0x0009 }, /* R21074 - VSS_XTD32_1 */
732 [21075] = 0x4800, /* R21075 - VSS_XTD32_0 */ 733 { 21075, 0x4800 }, /* R21075 - VSS_XTD32_0 */
733 [21076] = 0x0003, /* R21076 - VSS_XTS1_1 */ 734 { 21076, 0x0003 }, /* R21076 - VSS_XTS1_1 */
734 [21077] = 0x5F40, /* R21077 - VSS_XTS1_0 */ 735 { 21077, 0x5F40 }, /* R21077 - VSS_XTS1_0 */
735 [21078] = 0x0000, /* R21078 - VSS_XTS2_1 */ 736 { 21078, 0x0000 }, /* R21078 - VSS_XTS2_1 */
736 [21079] = 0x8700, /* R21079 - VSS_XTS2_0 */ 737 { 21079, 0x8700 }, /* R21079 - VSS_XTS2_0 */
737 [21080] = 0x00FA, /* R21080 - VSS_XTS3_1 */ 738 { 21080, 0x00FA }, /* R21080 - VSS_XTS3_1 */
738 [21081] = 0xE4C0, /* R21081 - VSS_XTS3_0 */ 739 { 21081, 0xE4C0 }, /* R21081 - VSS_XTS3_0 */
739 [21082] = 0x0000, /* R21082 - VSS_XTS4_1 */ 740 { 21082, 0x0000 }, /* R21082 - VSS_XTS4_1 */
740 [21083] = 0x0B40, /* R21083 - VSS_XTS4_0 */ 741 { 21083, 0x0B40 }, /* R21083 - VSS_XTS4_0 */
741 [21084] = 0x0004, /* R21084 - VSS_XTS5_1 */ 742 { 21084, 0x0004 }, /* R21084 - VSS_XTS5_1 */
742 [21085] = 0xE180, /* R21085 - VSS_XTS5_0 */ 743 { 21085, 0xE180 }, /* R21085 - VSS_XTS5_0 */
743 [21086] = 0x0001, /* R21086 - VSS_XTS6_1 */ 744 { 21086, 0x0001 }, /* R21086 - VSS_XTS6_1 */
744 [21087] = 0x1F40, /* R21087 - VSS_XTS6_0 */ 745 { 21087, 0x1F40 }, /* R21087 - VSS_XTS6_0 */
745 [21088] = 0x00F8, /* R21088 - VSS_XTS7_1 */ 746 { 21088, 0x00F8 }, /* R21088 - VSS_XTS7_1 */
746 [21089] = 0xB000, /* R21089 - VSS_XTS7_0 */ 747 { 21089, 0xB000 }, /* R21089 - VSS_XTS7_0 */
747 [21090] = 0x00FB, /* R21090 - VSS_XTS8_1 */ 748 { 21090, 0x00FB }, /* R21090 - VSS_XTS8_1 */
748 [21091] = 0xCBC0, /* R21091 - VSS_XTS8_0 */ 749 { 21091, 0xCBC0 }, /* R21091 - VSS_XTS8_0 */
749 [21092] = 0x0004, /* R21092 - VSS_XTS9_1 */ 750 { 21092, 0x0004 }, /* R21092 - VSS_XTS9_1 */
750 [21093] = 0xF380, /* R21093 - VSS_XTS9_0 */ 751 { 21093, 0xF380 }, /* R21093 - VSS_XTS9_0 */
751 [21094] = 0x0007, /* R21094 - VSS_XTS10_1 */ 752 { 21094, 0x0007 }, /* R21094 - VSS_XTS10_1 */
752 [21095] = 0xDF40, /* R21095 - VSS_XTS10_0 */ 753 { 21095, 0xDF40 }, /* R21095 - VSS_XTS10_0 */
753 [21096] = 0x00FF, /* R21096 - VSS_XTS11_1 */ 754 { 21096, 0x00FF }, /* R21096 - VSS_XTS11_1 */
754 [21097] = 0x0700, /* R21097 - VSS_XTS11_0 */ 755 { 21097, 0x0700 }, /* R21097 - VSS_XTS11_0 */
755 [21098] = 0x00EF, /* R21098 - VSS_XTS12_1 */ 756 { 21098, 0x00EF }, /* R21098 - VSS_XTS12_1 */
756 [21099] = 0xD700, /* R21099 - VSS_XTS12_0 */ 757 { 21099, 0xD700 }, /* R21099 - VSS_XTS12_0 */
757 [21100] = 0x00FB, /* R21100 - VSS_XTS13_1 */ 758 { 21100, 0x00FB }, /* R21100 - VSS_XTS13_1 */
758 [21101] = 0xAF40, /* R21101 - VSS_XTS13_0 */ 759 { 21101, 0xAF40 }, /* R21101 - VSS_XTS13_0 */
759 [21102] = 0x0010, /* R21102 - VSS_XTS14_1 */ 760 { 21102, 0x0010 }, /* R21102 - VSS_XTS14_1 */
760 [21103] = 0x8A80, /* R21103 - VSS_XTS14_0 */ 761 { 21103, 0x8A80 }, /* R21103 - VSS_XTS14_0 */
761 [21104] = 0x0011, /* R21104 - VSS_XTS15_1 */ 762 { 21104, 0x0011 }, /* R21104 - VSS_XTS15_1 */
762 [21105] = 0x07C0, /* R21105 - VSS_XTS15_0 */ 763 { 21105, 0x07C0 }, /* R21105 - VSS_XTS15_0 */
763 [21106] = 0x00E0, /* R21106 - VSS_XTS16_1 */ 764 { 21106, 0x00E0 }, /* R21106 - VSS_XTS16_1 */
764 [21107] = 0x0800, /* R21107 - VSS_XTS16_0 */ 765 { 21107, 0x0800 }, /* R21107 - VSS_XTS16_0 */
765 [21108] = 0x00D2, /* R21108 - VSS_XTS17_1 */ 766 { 21108, 0x00D2 }, /* R21108 - VSS_XTS17_1 */
766 [21109] = 0x7600, /* R21109 - VSS_XTS17_0 */ 767 { 21109, 0x7600 }, /* R21109 - VSS_XTS17_0 */
767 [21110] = 0x0020, /* R21110 - VSS_XTS18_1 */ 768 { 21110, 0x0020 }, /* R21110 - VSS_XTS18_1 */
768 [21111] = 0xCF40, /* R21111 - VSS_XTS18_0 */ 769 { 21111, 0xCF40 }, /* R21111 - VSS_XTS18_0 */
769 [21112] = 0x0030, /* R21112 - VSS_XTS19_1 */ 770 { 21112, 0x0030 }, /* R21112 - VSS_XTS19_1 */
770 [21113] = 0x2340, /* R21113 - VSS_XTS19_0 */ 771 { 21113, 0x2340 }, /* R21113 - VSS_XTS19_0 */
771 [21114] = 0x00FD, /* R21114 - VSS_XTS20_1 */ 772 { 21114, 0x00FD }, /* R21114 - VSS_XTS20_1 */
772 [21115] = 0x69C0, /* R21115 - VSS_XTS20_0 */ 773 { 21115, 0x69C0 }, /* R21115 - VSS_XTS20_0 */
773 [21116] = 0x0028, /* R21116 - VSS_XTS21_1 */ 774 { 21116, 0x0028 }, /* R21116 - VSS_XTS21_1 */
774 [21117] = 0x3500, /* R21117 - VSS_XTS21_0 */ 775 { 21117, 0x3500 }, /* R21117 - VSS_XTS21_0 */
775 [21118] = 0x0006, /* R21118 - VSS_XTS22_1 */ 776 { 21118, 0x0006 }, /* R21118 - VSS_XTS22_1 */
776 [21119] = 0x3300, /* R21119 - VSS_XTS22_0 */ 777 { 21119, 0x3300 }, /* R21119 - VSS_XTS22_0 */
777 [21120] = 0x00D9, /* R21120 - VSS_XTS23_1 */ 778 { 21120, 0x00D9 }, /* R21120 - VSS_XTS23_1 */
778 [21121] = 0xF6C0, /* R21121 - VSS_XTS23_0 */ 779 { 21121, 0xF6C0 }, /* R21121 - VSS_XTS23_0 */
779 [21122] = 0x00F3, /* R21122 - VSS_XTS24_1 */ 780 { 21122, 0x00F3 }, /* R21122 - VSS_XTS24_1 */
780 [21123] = 0x3340, /* R21123 - VSS_XTS24_0 */ 781 { 21123, 0x3340 }, /* R21123 - VSS_XTS24_0 */
781 [21124] = 0x000F, /* R21124 - VSS_XTS25_1 */ 782 { 21124, 0x000F }, /* R21124 - VSS_XTS25_1 */
782 [21125] = 0x4200, /* R21125 - VSS_XTS25_0 */ 783 { 21125, 0x4200 }, /* R21125 - VSS_XTS25_0 */
783 [21126] = 0x0004, /* R21126 - VSS_XTS26_1 */ 784 { 21126, 0x0004 }, /* R21126 - VSS_XTS26_1 */
784 [21127] = 0x0C80, /* R21127 - VSS_XTS26_0 */ 785 { 21127, 0x0C80 }, /* R21127 - VSS_XTS26_0 */
785 [21128] = 0x00FB, /* R21128 - VSS_XTS27_1 */ 786 { 21128, 0x00FB }, /* R21128 - VSS_XTS27_1 */
786 [21129] = 0x3F80, /* R21129 - VSS_XTS27_0 */ 787 { 21129, 0x3F80 }, /* R21129 - VSS_XTS27_0 */
787 [21130] = 0x00F7, /* R21130 - VSS_XTS28_1 */ 788 { 21130, 0x00F7 }, /* R21130 - VSS_XTS28_1 */
788 [21131] = 0x57C0, /* R21131 - VSS_XTS28_0 */ 789 { 21131, 0x57C0 }, /* R21131 - VSS_XTS28_0 */
789 [21132] = 0x0003, /* R21132 - VSS_XTS29_1 */ 790 { 21132, 0x0003 }, /* R21132 - VSS_XTS29_1 */
790 [21133] = 0x5400, /* R21133 - VSS_XTS29_0 */ 791 { 21133, 0x5400 }, /* R21133 - VSS_XTS29_0 */
791 [21134] = 0x0000, /* R21134 - VSS_XTS30_1 */ 792 { 21134, 0x0000 }, /* R21134 - VSS_XTS30_1 */
792 [21135] = 0xC6C0, /* R21135 - VSS_XTS30_0 */ 793 { 21135, 0xC6C0 }, /* R21135 - VSS_XTS30_0 */
793 [21136] = 0x0003, /* R21136 - VSS_XTS31_1 */ 794 { 21136, 0x0003 }, /* R21136 - VSS_XTS31_1 */
794 [21137] = 0x12C0, /* R21137 - VSS_XTS31_0 */ 795 { 21137, 0x12C0 }, /* R21137 - VSS_XTS31_0 */
795 [21138] = 0x00FD, /* R21138 - VSS_XTS32_1 */ 796 { 21138, 0x00FD }, /* R21138 - VSS_XTS32_1 */
796 [21139] = 0x8580, /* R21139 - VSS_XTS32_0 */ 797 { 21139, 0x8580 }, /* R21139 - VSS_XTS32_0 */
797}; 798};
798 799
799static const struct wm8962_reg_access { 800static const struct wm8962_reg_access {
@@ -802,7 +803,7 @@ static const struct wm8962_reg_access {
802 u16 vol; 803 u16 vol;
803} wm8962_reg_access[WM8962_MAX_REGISTER + 1] = { 804} wm8962_reg_access[WM8962_MAX_REGISTER + 1] = {
804 [0] = { 0x00FF, 0x01FF, 0x0000 }, /* R0 - Left Input volume */ 805 [0] = { 0x00FF, 0x01FF, 0x0000 }, /* R0 - Left Input volume */
805 [1] = { 0xFEFF, 0x01FF, 0xFFFF }, /* R1 - Right Input volume */ 806 [1] = { 0xFEFF, 0x01FF, 0x0000 }, /* R1 - Right Input volume */
806 [2] = { 0x00FF, 0x01FF, 0x0000 }, /* R2 - HPOUTL volume */ 807 [2] = { 0x00FF, 0x01FF, 0x0000 }, /* R2 - HPOUTL volume */
807 [3] = { 0x00FF, 0x01FF, 0x0000 }, /* R3 - HPOUTR volume */ 808 [3] = { 0x00FF, 0x01FF, 0x0000 }, /* R3 - HPOUTR volume */
808 [4] = { 0x07FE, 0x07FE, 0xFFFF }, /* R4 - Clocking1 */ 809 [4] = { 0x07FE, 0x07FE, 0xFFFF }, /* R4 - Clocking1 */
@@ -1943,7 +1944,7 @@ static const struct wm8962_reg_access {
1943 [21139] = { 0xFFFF, 0xFFFF, 0x0000 }, /* R21139 - VSS_XTS32_0 */ 1944 [21139] = { 0xFFFF, 0xFFFF, 0x0000 }, /* R21139 - VSS_XTS32_0 */
1944}; 1945};
1945 1946
1946static int wm8962_volatile_register(struct snd_soc_codec *codec, unsigned int reg) 1947static bool wm8962_volatile_register(struct device *dev, unsigned int reg)
1947{ 1948{
1948 if (wm8962_reg_access[reg].vol) 1949 if (wm8962_reg_access[reg].vol)
1949 return 1; 1950 return 1;
@@ -1951,7 +1952,7 @@ static int wm8962_volatile_register(struct snd_soc_codec *codec, unsigned int re
1951 return 0; 1952 return 0;
1952} 1953}
1953 1954
1954static int wm8962_readable_register(struct snd_soc_codec *codec, unsigned int reg) 1955static bool wm8962_readable_register(struct device *dev, unsigned int reg)
1955{ 1956{
1956 if (wm8962_reg_access[reg].read) 1957 if (wm8962_reg_access[reg].read)
1957 return 1; 1958 return 1;
@@ -1959,15 +1960,15 @@ static int wm8962_readable_register(struct snd_soc_codec *codec, unsigned int re
1959 return 0; 1960 return 0;
1960} 1961}
1961 1962
1962static int wm8962_reset(struct snd_soc_codec *codec) 1963static int wm8962_reset(struct wm8962_priv *wm8962)
1963{ 1964{
1964 int ret; 1965 int ret;
1965 1966
1966 ret = snd_soc_write(codec, WM8962_SOFTWARE_RESET, 0x6243); 1967 ret = regmap_write(wm8962->regmap, WM8962_SOFTWARE_RESET, 0x6243);
1967 if (ret != 0) 1968 if (ret != 0)
1968 return ret; 1969 return ret;
1969 1970
1970 return snd_soc_write(codec, WM8962_PLL_SOFTWARE_RESET, 0); 1971 return regmap_write(wm8962->regmap, WM8962_PLL_SOFTWARE_RESET, 0);
1971} 1972}
1972 1973
1973static const DECLARE_TLV_DB_SCALE(inpga_tlv, -2325, 75, 0); 1974static const DECLARE_TLV_DB_SCALE(inpga_tlv, -2325, 75, 0);
@@ -2345,6 +2346,10 @@ static int sysclk_event(struct snd_soc_dapm_widget *w,
2345 int src; 2346 int src;
2346 int fll; 2347 int fll;
2347 2348
2349 /* Ignore attempts to run the event during startup */
2350 if (codec->dapm.bias_level == SND_SOC_BIAS_OFF)
2351 return 0;
2352
2348 src = snd_soc_read(codec, WM8962_CLOCKING2) & WM8962_SYSCLK_SRC_MASK; 2353 src = snd_soc_read(codec, WM8962_CLOCKING2) & WM8962_SYSCLK_SRC_MASK;
2349 2354
2350 switch (src) { 2355 switch (src) {
@@ -2670,7 +2675,7 @@ SND_SOC_DAPM_INPUT("IN3L"),
2670SND_SOC_DAPM_INPUT("IN3R"), 2675SND_SOC_DAPM_INPUT("IN3R"),
2671SND_SOC_DAPM_INPUT("IN4L"), 2676SND_SOC_DAPM_INPUT("IN4L"),
2672SND_SOC_DAPM_INPUT("IN4R"), 2677SND_SOC_DAPM_INPUT("IN4R"),
2673SND_SOC_DAPM_INPUT("Beep"), 2678SND_SOC_DAPM_SIGGEN("Beep"),
2674SND_SOC_DAPM_INPUT("DMICDAT"), 2679SND_SOC_DAPM_INPUT("DMICDAT"),
2675 2680
2676SND_SOC_DAPM_SUPPLY("MICBIAS", WM8962_PWR_MGMT_1, 1, 0, NULL, 0), 2681SND_SOC_DAPM_SUPPLY("MICBIAS", WM8962_PWR_MGMT_1, 1, 0, NULL, 0),
@@ -2684,6 +2689,8 @@ SND_SOC_DAPM_SUPPLY("TOCLK", WM8962_ADDITIONAL_CONTROL_1, 0, 0, NULL, 0),
2684SND_SOC_DAPM_SUPPLY_S("DSP2", 1, WM8962_DSP2_POWER_MANAGEMENT, 2689SND_SOC_DAPM_SUPPLY_S("DSP2", 1, WM8962_DSP2_POWER_MANAGEMENT,
2685 WM8962_DSP2_ENA_SHIFT, 0, dsp2_event, 2690 WM8962_DSP2_ENA_SHIFT, 0, dsp2_event,
2686 SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD), 2691 SND_SOC_DAPM_POST_PMU | SND_SOC_DAPM_PRE_PMD),
2692SND_SOC_DAPM_SUPPLY("TEMP_HP", WM8962_ADDITIONAL_CONTROL_4, 2, 0, NULL, 0),
2693SND_SOC_DAPM_SUPPLY("TEMP_SPK", WM8962_ADDITIONAL_CONTROL_4, 1, 0, NULL, 0),
2687 2694
2688SND_SOC_DAPM_MIXER("INPGAL", WM8962_LEFT_INPUT_PGA_CONTROL, 4, 0, 2695SND_SOC_DAPM_MIXER("INPGAL", WM8962_LEFT_INPUT_PGA_CONTROL, 4, 0,
2689 inpgal, ARRAY_SIZE(inpgal)), 2696 inpgal, ARRAY_SIZE(inpgal)),
@@ -2839,6 +2846,9 @@ static const struct snd_soc_dapm_route wm8962_intercon[] = {
2839 2846
2840 { "HPOUTL", NULL, "HPOUT" }, 2847 { "HPOUTL", NULL, "HPOUT" },
2841 { "HPOUTR", NULL, "HPOUT" }, 2848 { "HPOUTR", NULL, "HPOUT" },
2849
2850 { "HPOUTL", NULL, "TEMP_HP" },
2851 { "HPOUTR", NULL, "TEMP_HP" },
2842}; 2852};
2843 2853
2844static const struct snd_soc_dapm_route wm8962_spk_mono_intercon[] = { 2854static const struct snd_soc_dapm_route wm8962_spk_mono_intercon[] = {
@@ -2855,6 +2865,7 @@ static const struct snd_soc_dapm_route wm8962_spk_mono_intercon[] = {
2855 { "Speaker Output", NULL, "Speaker PGA" }, 2865 { "Speaker Output", NULL, "Speaker PGA" },
2856 { "Speaker Output", NULL, "SYSCLK" }, 2866 { "Speaker Output", NULL, "SYSCLK" },
2857 { "Speaker Output", NULL, "TOCLK" }, 2867 { "Speaker Output", NULL, "TOCLK" },
2868 { "Speaker Output", NULL, "TEMP_SPK" },
2858 2869
2859 { "SPKOUT", NULL, "Speaker Output" }, 2870 { "SPKOUT", NULL, "Speaker Output" },
2860}; 2871};
@@ -2883,10 +2894,12 @@ static const struct snd_soc_dapm_route wm8962_spk_stereo_intercon[] = {
2883 { "SPKOUTL Output", NULL, "SPKOUTL PGA" }, 2894 { "SPKOUTL Output", NULL, "SPKOUTL PGA" },
2884 { "SPKOUTL Output", NULL, "SYSCLK" }, 2895 { "SPKOUTL Output", NULL, "SYSCLK" },
2885 { "SPKOUTL Output", NULL, "TOCLK" }, 2896 { "SPKOUTL Output", NULL, "TOCLK" },
2897 { "SPKOUTL Output", NULL, "TEMP_SPK" },
2886 2898
2887 { "SPKOUTR Output", NULL, "SPKOUTR PGA" }, 2899 { "SPKOUTR Output", NULL, "SPKOUTR PGA" },
2888 { "SPKOUTR Output", NULL, "SYSCLK" }, 2900 { "SPKOUTR Output", NULL, "SYSCLK" },
2889 { "SPKOUTR Output", NULL, "TOCLK" }, 2901 { "SPKOUTR Output", NULL, "TOCLK" },
2902 { "SPKOUTR Output", NULL, "TEMP_SPK" },
2890 2903
2891 { "SPKOUTL", NULL, "SPKOUTL Output" }, 2904 { "SPKOUTL", NULL, "SPKOUTL Output" },
2892 { "SPKOUTR", NULL, "SPKOUTR Output" }, 2905 { "SPKOUTR", NULL, "SPKOUTR Output" },
@@ -2931,33 +2944,6 @@ static int wm8962_add_widgets(struct snd_soc_codec *codec)
2931 return 0; 2944 return 0;
2932} 2945}
2933 2946
2934static void wm8962_sync_cache(struct snd_soc_codec *codec)
2935{
2936 u16 *reg_cache = codec->reg_cache;
2937 int i;
2938
2939 if (!codec->cache_sync)
2940 return;
2941
2942 dev_dbg(codec->dev, "Syncing cache\n");
2943
2944 codec->cache_only = 0;
2945
2946 /* Sync back cached values if they're different from the
2947 * hardware default.
2948 */
2949 for (i = 1; i < codec->driver->reg_cache_size; i++) {
2950 if (i == WM8962_SOFTWARE_RESET)
2951 continue;
2952 if (reg_cache[i] == wm8962_reg[i])
2953 continue;
2954
2955 snd_soc_write(codec, i, reg_cache[i]);
2956 }
2957
2958 codec->cache_sync = 0;
2959}
2960
2961/* -1 for reserved values */ 2947/* -1 for reserved values */
2962static const int bclk_divs[] = { 2948static const int bclk_divs[] = {
2963 1, -1, 2, 3, 4, -1, 6, 8, -1, 12, 16, 24, -1, 32, 32, 32 2949 1, -1, 2, 3, 4, -1, 6, 8, -1, 12, 16, 24, -1, 32, 32, 32
@@ -3085,7 +3071,8 @@ static int wm8962_set_bias_level(struct snd_soc_codec *codec,
3085 return ret; 3071 return ret;
3086 } 3072 }
3087 3073
3088 wm8962_sync_cache(codec); 3074 regcache_cache_only(wm8962->regmap, false);
3075 regcache_sync(wm8962->regmap);
3089 3076
3090 snd_soc_update_bits(codec, WM8962_ANTI_POP, 3077 snd_soc_update_bits(codec, WM8962_ANTI_POP,
3091 WM8962_STARTUP_BIAS_ENA | 3078 WM8962_STARTUP_BIAS_ENA |
@@ -3399,6 +3386,7 @@ static int wm8962_set_fll(struct snd_soc_codec *codec, int fll_id, int source,
3399 unsigned long timeout; 3386 unsigned long timeout;
3400 int ret; 3387 int ret;
3401 int fll1 = snd_soc_read(codec, WM8962_FLL_CONTROL_1) & WM8962_FLL_ENA; 3388 int fll1 = snd_soc_read(codec, WM8962_FLL_CONTROL_1) & WM8962_FLL_ENA;
3389 int sysclk = snd_soc_read(codec, WM8962_CLOCKING2) & WM8962_SYSCLK_ENA;
3402 3390
3403 /* Any change? */ 3391 /* Any change? */
3404 if (source == wm8962->fll_src && Fref == wm8962->fll_fref && 3392 if (source == wm8962->fll_src && Fref == wm8962->fll_fref &&
@@ -3459,6 +3447,9 @@ static int wm8962_set_fll(struct snd_soc_codec *codec, int fll_id, int source,
3459 3447
3460 try_wait_for_completion(&wm8962->fll_lock); 3448 try_wait_for_completion(&wm8962->fll_lock);
3461 3449
3450 if (sysclk)
3451 fll1 |= WM8962_FLL_ENA;
3452
3462 snd_soc_update_bits(codec, WM8962_FLL_CONTROL_1, 3453 snd_soc_update_bits(codec, WM8962_FLL_CONTROL_1,
3463 WM8962_FLL_FRAC | WM8962_FLL_REFCLK_SRC_MASK | 3454 WM8962_FLL_FRAC | WM8962_FLL_REFCLK_SRC_MASK |
3464 WM8962_FLL_ENA, fll1); 3455 WM8962_FLL_ENA, fll1);
@@ -3511,7 +3502,7 @@ static int wm8962_mute(struct snd_soc_dai *dai, int mute)
3511#define WM8962_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ 3502#define WM8962_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\
3512 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE) 3503 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE)
3513 3504
3514static struct snd_soc_dai_ops wm8962_dai_ops = { 3505static const struct snd_soc_dai_ops wm8962_dai_ops = {
3515 .hw_params = wm8962_hw_params, 3506 .hw_params = wm8962_hw_params,
3516 .set_sysclk = wm8962_set_dai_sysclk, 3507 .set_sysclk = wm8962_set_dai_sysclk,
3517 .set_fmt = wm8962_set_dai_fmt, 3508 .set_fmt = wm8962_set_dai_fmt,
@@ -3662,6 +3653,14 @@ int wm8962_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack)
3662 snd_soc_jack_report(wm8962->jack, 0, 3653 snd_soc_jack_report(wm8962->jack, 0,
3663 SND_JACK_MICROPHONE | SND_JACK_BTN_0); 3654 SND_JACK_MICROPHONE | SND_JACK_BTN_0);
3664 3655
3656 if (jack) {
3657 snd_soc_dapm_force_enable_pin(&codec->dapm, "SYSCLK");
3658 snd_soc_dapm_force_enable_pin(&codec->dapm, "MICBIAS");
3659 } else {
3660 snd_soc_dapm_disable_pin(&codec->dapm, "SYSCLK");
3661 snd_soc_dapm_disable_pin(&codec->dapm, "MICBIAS");
3662 }
3663
3665 return 0; 3664 return 0;
3666} 3665}
3667EXPORT_SYMBOL_GPL(wm8962_mic_detect); 3666EXPORT_SYMBOL_GPL(wm8962_mic_detect);
@@ -3879,13 +3878,17 @@ static int wm8962_gpio_direction_out(struct gpio_chip *chip,
3879{ 3878{
3880 struct wm8962_priv *wm8962 = gpio_to_wm8962(chip); 3879 struct wm8962_priv *wm8962 = gpio_to_wm8962(chip);
3881 struct snd_soc_codec *codec = wm8962->codec; 3880 struct snd_soc_codec *codec = wm8962->codec;
3882 int val; 3881 int ret, val;
3883 3882
3884 /* Force function 1 (logic output) */ 3883 /* Force function 1 (logic output) */
3885 val = (1 << WM8962_GP2_FN_SHIFT) | (value << WM8962_GP2_LVL_SHIFT); 3884 val = (1 << WM8962_GP2_FN_SHIFT) | (value << WM8962_GP2_LVL_SHIFT);
3886 3885
3887 return snd_soc_update_bits(codec, WM8962_GPIO_BASE + offset, 3886 ret = snd_soc_update_bits(codec, WM8962_GPIO_BASE + offset,
3888 WM8962_GP2_FN_MASK | WM8962_GP2_LVL, val); 3887 WM8962_GP2_FN_MASK | WM8962_GP2_LVL, val);
3888 if (ret < 0)
3889 return ret;
3890
3891 return 0;
3889} 3892}
3890 3893
3891static struct gpio_chip wm8962_template_chip = { 3894static struct gpio_chip wm8962_template_chip = {
@@ -3946,26 +3949,12 @@ static int wm8962_probe(struct snd_soc_codec *codec)
3946 bool dmicclk, dmicdat; 3949 bool dmicclk, dmicdat;
3947 3950
3948 wm8962->codec = codec; 3951 wm8962->codec = codec;
3949 INIT_DELAYED_WORK(&wm8962->mic_work, wm8962_mic_work); 3952 codec->control_data = wm8962->regmap;
3950 init_completion(&wm8962->fll_lock);
3951
3952 codec->cache_sync = 1;
3953 codec->dapm.idle_bias_off = 1;
3954 3953
3955 ret = snd_soc_codec_set_cache_io(codec, 16, 16, SND_SOC_I2C); 3954 ret = snd_soc_codec_set_cache_io(codec, 16, 16, SND_SOC_REGMAP);
3956 if (ret != 0) { 3955 if (ret != 0) {
3957 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret); 3956 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
3958 goto err; 3957 return ret;
3959 }
3960
3961 for (i = 0; i < ARRAY_SIZE(wm8962->supplies); i++)
3962 wm8962->supplies[i].supply = wm8962_supply_names[i];
3963
3964 ret = regulator_bulk_get(codec->dev, ARRAY_SIZE(wm8962->supplies),
3965 wm8962->supplies);
3966 if (ret != 0) {
3967 dev_err(codec->dev, "Failed to request supplies: %d\n", ret);
3968 goto err;
3969 } 3958 }
3970 3959
3971 wm8962->disable_nb[0].notifier_call = wm8962_regulator_event_0; 3960 wm8962->disable_nb[0].notifier_call = wm8962_regulator_event_0;
@@ -3988,43 +3977,6 @@ static int wm8962_probe(struct snd_soc_codec *codec)
3988 } 3977 }
3989 } 3978 }
3990 3979
3991 ret = regulator_bulk_enable(ARRAY_SIZE(wm8962->supplies),
3992 wm8962->supplies);
3993 if (ret != 0) {
3994 dev_err(codec->dev, "Failed to enable supplies: %d\n", ret);
3995 goto err_get;
3996 }
3997
3998 ret = snd_soc_read(codec, WM8962_SOFTWARE_RESET);
3999 if (ret < 0) {
4000 dev_err(codec->dev, "Failed to read ID register\n");
4001 goto err_enable;
4002 }
4003 if (ret != wm8962_reg[WM8962_SOFTWARE_RESET]) {
4004 dev_err(codec->dev, "Device is not a WM8962, ID %x != %x\n",
4005 ret, wm8962_reg[WM8962_SOFTWARE_RESET]);
4006 ret = -EINVAL;
4007 goto err_enable;
4008 }
4009
4010 ret = snd_soc_read(codec, WM8962_RIGHT_INPUT_VOLUME);
4011 if (ret < 0) {
4012 dev_err(codec->dev, "Failed to read device revision: %d\n",
4013 ret);
4014 goto err_enable;
4015 }
4016
4017 dev_info(codec->dev, "customer id %x revision %c\n",
4018 (ret & WM8962_CUST_ID_MASK) >> WM8962_CUST_ID_SHIFT,
4019 ((ret & WM8962_CHIP_REV_MASK) >> WM8962_CHIP_REV_SHIFT)
4020 + 'A');
4021
4022 ret = wm8962_reset(codec);
4023 if (ret < 0) {
4024 dev_err(codec->dev, "Failed to issue reset\n");
4025 goto err_enable;
4026 }
4027
4028 /* SYSCLK defaults to on; make sure it is off so we can safely 3980 /* SYSCLK defaults to on; make sure it is off so we can safely
4029 * write to registers if the device is declocked. 3981 * write to registers if the device is declocked.
4030 */ 3982 */
@@ -4039,8 +3991,6 @@ static int wm8962_probe(struct snd_soc_codec *codec)
4039 WM8962_OSC_ENA | WM8962_PLL2_ENA | WM8962_PLL3_ENA, 3991 WM8962_OSC_ENA | WM8962_PLL2_ENA | WM8962_PLL3_ENA,
4040 0); 3992 0);
4041 3993
4042 regulator_bulk_disable(ARRAY_SIZE(wm8962->supplies), wm8962->supplies);
4043
4044 if (pdata) { 3994 if (pdata) {
4045 /* Apply static configuration for GPIOs */ 3995 /* Apply static configuration for GPIOs */
4046 for (i = 0; i < ARRAY_SIZE(pdata->gpio_init); i++) 3996 for (i = 0; i < ARRAY_SIZE(pdata->gpio_init); i++)
@@ -4091,6 +4041,12 @@ static int wm8962_probe(struct snd_soc_codec *codec)
4091 /* Stereo control for EQ */ 4041 /* Stereo control for EQ */
4092 snd_soc_update_bits(codec, WM8962_EQ1, WM8962_EQ_SHARED_COEFF, 0); 4042 snd_soc_update_bits(codec, WM8962_EQ1, WM8962_EQ_SHARED_COEFF, 0);
4093 4043
4044 /* Don't debouce interrupts so we don't need SYSCLK */
4045 snd_soc_update_bits(codec, WM8962_IRQ_DEBOUNCE,
4046 WM8962_FLL_LOCK_DB | WM8962_PLL3_LOCK_DB |
4047 WM8962_PLL2_LOCK_DB | WM8962_TEMP_SHUT_DB,
4048 0);
4049
4094 wm8962_add_widgets(codec); 4050 wm8962_add_widgets(codec);
4095 4051
4096 /* Save boards having to disable DMIC when not in use */ 4052 /* Save boards having to disable DMIC when not in use */
@@ -4150,13 +4106,6 @@ static int wm8962_probe(struct snd_soc_codec *codec)
4150 } 4106 }
4151 4107
4152 return 0; 4108 return 0;
4153
4154err_enable:
4155 regulator_bulk_disable(ARRAY_SIZE(wm8962->supplies), wm8962->supplies);
4156err_get:
4157 regulator_bulk_free(ARRAY_SIZE(wm8962->supplies), wm8962->supplies);
4158err:
4159 return ret;
4160} 4109}
4161 4110
4162static int wm8962_remove(struct snd_soc_codec *codec) 4111static int wm8962_remove(struct snd_soc_codec *codec)
@@ -4174,21 +4123,36 @@ static int wm8962_remove(struct snd_soc_codec *codec)
4174 for (i = 0; i < ARRAY_SIZE(wm8962->supplies); i++) 4123 for (i = 0; i < ARRAY_SIZE(wm8962->supplies); i++)
4175 regulator_unregister_notifier(wm8962->supplies[i].consumer, 4124 regulator_unregister_notifier(wm8962->supplies[i].consumer,
4176 &wm8962->disable_nb[i]); 4125 &wm8962->disable_nb[i]);
4177 regulator_bulk_free(ARRAY_SIZE(wm8962->supplies), wm8962->supplies);
4178 4126
4179 return 0; 4127 return 0;
4180} 4128}
4181 4129
4130static int wm8962_soc_volatile(struct snd_soc_codec *codec,
4131 unsigned int reg)
4132{
4133 return true;
4134}
4135
4136
4182static struct snd_soc_codec_driver soc_codec_dev_wm8962 = { 4137static struct snd_soc_codec_driver soc_codec_dev_wm8962 = {
4183 .probe = wm8962_probe, 4138 .probe = wm8962_probe,
4184 .remove = wm8962_remove, 4139 .remove = wm8962_remove,
4185 .set_bias_level = wm8962_set_bias_level, 4140 .set_bias_level = wm8962_set_bias_level,
4186 .reg_cache_size = WM8962_MAX_REGISTER + 1,
4187 .reg_word_size = sizeof(u16),
4188 .reg_cache_default = wm8962_reg,
4189 .volatile_register = wm8962_volatile_register,
4190 .readable_register = wm8962_readable_register,
4191 .set_pll = wm8962_set_fll, 4141 .set_pll = wm8962_set_fll,
4142 .reg_cache_size = WM8962_MAX_REGISTER,
4143 .volatile_register = wm8962_soc_volatile,
4144};
4145
4146static const struct regmap_config wm8962_regmap = {
4147 .reg_bits = 16,
4148 .val_bits = 16,
4149
4150 .max_register = WM8962_MAX_REGISTER,
4151 .reg_defaults = wm8962_reg,
4152 .num_reg_defaults = ARRAY_SIZE(wm8962_reg),
4153 .volatile_reg = wm8962_volatile_register,
4154 .readable_reg = wm8962_readable_register,
4155 .cache_type = REGCACHE_RBTREE,
4192}; 4156};
4193 4157
4194#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) 4158#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
@@ -4196,28 +4160,112 @@ static __devinit int wm8962_i2c_probe(struct i2c_client *i2c,
4196 const struct i2c_device_id *id) 4160 const struct i2c_device_id *id)
4197{ 4161{
4198 struct wm8962_priv *wm8962; 4162 struct wm8962_priv *wm8962;
4199 int ret; 4163 unsigned int reg;
4164 int ret, i;
4200 4165
4201 wm8962 = kzalloc(sizeof(struct wm8962_priv), GFP_KERNEL); 4166 wm8962 = devm_kzalloc(&i2c->dev, sizeof(struct wm8962_priv),
4167 GFP_KERNEL);
4202 if (wm8962 == NULL) 4168 if (wm8962 == NULL)
4203 return -ENOMEM; 4169 return -ENOMEM;
4204 4170
4205 i2c_set_clientdata(i2c, wm8962); 4171 i2c_set_clientdata(i2c, wm8962);
4206 4172
4173 INIT_DELAYED_WORK(&wm8962->mic_work, wm8962_mic_work);
4174 init_completion(&wm8962->fll_lock);
4207 wm8962->irq = i2c->irq; 4175 wm8962->irq = i2c->irq;
4208 4176
4177 for (i = 0; i < ARRAY_SIZE(wm8962->supplies); i++)
4178 wm8962->supplies[i].supply = wm8962_supply_names[i];
4179
4180 ret = regulator_bulk_get(&i2c->dev, ARRAY_SIZE(wm8962->supplies),
4181 wm8962->supplies);
4182 if (ret != 0) {
4183 dev_err(&i2c->dev, "Failed to request supplies: %d\n", ret);
4184 goto err;
4185 }
4186
4187 ret = regulator_bulk_enable(ARRAY_SIZE(wm8962->supplies),
4188 wm8962->supplies);
4189 if (ret != 0) {
4190 dev_err(&i2c->dev, "Failed to enable supplies: %d\n", ret);
4191 goto err_get;
4192 }
4193
4194 wm8962->regmap = regmap_init_i2c(i2c, &wm8962_regmap);
4195 if (IS_ERR(wm8962->regmap)) {
4196 ret = PTR_ERR(wm8962->regmap);
4197 dev_err(&i2c->dev, "Failed to allocate regmap: %d\n", ret);
4198 goto err_enable;
4199 }
4200
4201 /*
4202 * We haven't marked the chip revision as volatile due to
4203 * sharing a register with the right input volume; explicitly
4204 * bypass the cache to read it.
4205 */
4206 regcache_cache_bypass(wm8962->regmap, true);
4207
4208 ret = regmap_read(wm8962->regmap, WM8962_SOFTWARE_RESET, &reg);
4209 if (ret < 0) {
4210 dev_err(&i2c->dev, "Failed to read ID register\n");
4211 goto err_regmap;
4212 }
4213 if (reg != 0x6243) {
4214 dev_err(&i2c->dev,
4215 "Device is not a WM8962, ID %x != 0x6243\n", ret);
4216 ret = -EINVAL;
4217 goto err_regmap;
4218 }
4219
4220 ret = regmap_read(wm8962->regmap, WM8962_RIGHT_INPUT_VOLUME, &reg);
4221 if (ret < 0) {
4222 dev_err(&i2c->dev, "Failed to read device revision: %d\n",
4223 ret);
4224 goto err_regmap;
4225 }
4226
4227 dev_info(&i2c->dev, "customer id %x revision %c\n",
4228 (reg & WM8962_CUST_ID_MASK) >> WM8962_CUST_ID_SHIFT,
4229 ((reg & WM8962_CHIP_REV_MASK) >> WM8962_CHIP_REV_SHIFT)
4230 + 'A');
4231
4232 regcache_cache_bypass(wm8962->regmap, false);
4233
4234 ret = wm8962_reset(wm8962);
4235 if (ret < 0) {
4236 dev_err(&i2c->dev, "Failed to issue reset\n");
4237 goto err_regmap;
4238 }
4239
4240 regcache_cache_only(wm8962->regmap, true);
4241
4209 ret = snd_soc_register_codec(&i2c->dev, 4242 ret = snd_soc_register_codec(&i2c->dev,
4210 &soc_codec_dev_wm8962, &wm8962_dai, 1); 4243 &soc_codec_dev_wm8962, &wm8962_dai, 1);
4211 if (ret < 0) 4244 if (ret < 0)
4212 kfree(wm8962); 4245 goto err_regmap;
4246
4247 /* The drivers should power up as needed */
4248 regulator_bulk_disable(ARRAY_SIZE(wm8962->supplies), wm8962->supplies);
4249
4250 return 0;
4213 4251
4252err_regmap:
4253 regmap_exit(wm8962->regmap);
4254err_enable:
4255 regulator_bulk_disable(ARRAY_SIZE(wm8962->supplies), wm8962->supplies);
4256err_get:
4257 regulator_bulk_free(ARRAY_SIZE(wm8962->supplies), wm8962->supplies);
4258err:
4214 return ret; 4259 return ret;
4215} 4260}
4216 4261
4217static __devexit int wm8962_i2c_remove(struct i2c_client *client) 4262static __devexit int wm8962_i2c_remove(struct i2c_client *client)
4218{ 4263{
4264 struct wm8962_priv *wm8962 = dev_get_drvdata(&client->dev);
4265
4219 snd_soc_unregister_codec(&client->dev); 4266 snd_soc_unregister_codec(&client->dev);
4220 kfree(i2c_get_clientdata(client)); 4267 regmap_exit(wm8962->regmap);
4268 regulator_bulk_free(ARRAY_SIZE(wm8962->supplies), wm8962->supplies);
4221 return 0; 4269 return 0;
4222} 4270}
4223 4271
diff --git a/sound/soc/codecs/wm8971.c b/sound/soc/codecs/wm8971.c
index b444b297d0b..4af893601f0 100644
--- a/sound/soc/codecs/wm8971.c
+++ b/sound/soc/codecs/wm8971.c
@@ -19,7 +19,6 @@
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/platform_device.h>
23#include <linux/slab.h> 22#include <linux/slab.h>
24#include <sound/core.h> 23#include <sound/core.h>
25#include <sound/pcm.h> 24#include <sound/pcm.h>
@@ -224,7 +223,7 @@ static const struct snd_soc_dapm_widget wm8971_dapm_widgets[] = {
224 SND_SOC_DAPM_DAC("Left DAC", "Left Playback", WM8971_PWR2, 8, 0), 223 SND_SOC_DAPM_DAC("Left DAC", "Left Playback", WM8971_PWR2, 8, 0),
225 SND_SOC_DAPM_PGA("Mono Out 1", WM8971_PWR2, 2, 0, NULL, 0), 224 SND_SOC_DAPM_PGA("Mono Out 1", WM8971_PWR2, 2, 0, NULL, 0),
226 225
227 SND_SOC_DAPM_MICBIAS("Mic Bias", WM8971_PWR1, 1, 0), 226 SND_SOC_DAPM_SUPPLY("Mic Bias", WM8971_PWR1, 1, 0, NULL, 0),
228 SND_SOC_DAPM_ADC("Right ADC", "Right Capture", WM8971_PWR1, 2, 0), 227 SND_SOC_DAPM_ADC("Right ADC", "Right Capture", WM8971_PWR1, 2, 0),
229 SND_SOC_DAPM_ADC("Left ADC", "Left Capture", WM8971_PWR1, 3, 0), 228 SND_SOC_DAPM_ADC("Left ADC", "Left Capture", WM8971_PWR1, 3, 0),
230 229
@@ -567,7 +566,7 @@ static int wm8971_set_bias_level(struct snd_soc_codec *codec,
567#define WM8971_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ 566#define WM8971_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\
568 SNDRV_PCM_FMTBIT_S24_LE) 567 SNDRV_PCM_FMTBIT_S24_LE)
569 568
570static struct snd_soc_dai_ops wm8971_dai_ops = { 569static const struct snd_soc_dai_ops wm8971_dai_ops = {
571 .hw_params = wm8971_pcm_hw_params, 570 .hw_params = wm8971_pcm_hw_params,
572 .digital_mute = wm8971_mute, 571 .digital_mute = wm8971_mute,
573 .set_fmt = wm8971_set_dai_fmt, 572 .set_fmt = wm8971_set_dai_fmt,
@@ -600,7 +599,7 @@ static void wm8971_work(struct work_struct *work)
600 wm8971_set_bias_level(codec, codec->dapm.bias_level); 599 wm8971_set_bias_level(codec, codec->dapm.bias_level);
601} 600}
602 601
603static int wm8971_suspend(struct snd_soc_codec *codec, pm_message_t state) 602static int wm8971_suspend(struct snd_soc_codec *codec)
604{ 603{
605 wm8971_set_bias_level(codec, SND_SOC_BIAS_OFF); 604 wm8971_set_bias_level(codec, SND_SOC_BIAS_OFF);
606 return 0; 605 return 0;
@@ -725,7 +724,7 @@ MODULE_DEVICE_TABLE(i2c, wm8971_i2c_id);
725 724
726static struct i2c_driver wm8971_i2c_driver = { 725static struct i2c_driver wm8971_i2c_driver = {
727 .driver = { 726 .driver = {
728 .name = "wm8971-codec", 727 .name = "wm8971",
729 .owner = THIS_MODULE, 728 .owner = THIS_MODULE,
730 }, 729 },
731 .probe = wm8971_i2c_probe, 730 .probe = wm8971_i2c_probe,
diff --git a/sound/soc/codecs/wm8974.c b/sound/soc/codecs/wm8974.c
index 9352f1e088d..4a6a7b5a61b 100644
--- a/sound/soc/codecs/wm8974.c
+++ b/sound/soc/codecs/wm8974.c
@@ -17,7 +17,6 @@
17#include <linux/delay.h> 17#include <linux/delay.h>
18#include <linux/pm.h> 18#include <linux/pm.h>
19#include <linux/i2c.h> 19#include <linux/i2c.h>
20#include <linux/platform_device.h>
21#include <linux/slab.h> 20#include <linux/slab.h>
22#include <sound/core.h> 21#include <sound/core.h>
23#include <sound/pcm.h> 22#include <sound/pcm.h>
@@ -226,7 +225,7 @@ SND_SOC_DAPM_MIXER("Input PGA", WM8974_POWER2, 2, 0, wm8974_inpga,
226SND_SOC_DAPM_MIXER("Boost Mixer", WM8974_POWER2, 4, 0, 225SND_SOC_DAPM_MIXER("Boost Mixer", WM8974_POWER2, 4, 0,
227 wm8974_boost_mixer, ARRAY_SIZE(wm8974_boost_mixer)), 226 wm8974_boost_mixer, ARRAY_SIZE(wm8974_boost_mixer)),
228 227
229SND_SOC_DAPM_MICBIAS("Mic Bias", WM8974_POWER1, 4, 0), 228SND_SOC_DAPM_SUPPLY("Mic Bias", WM8974_POWER1, 4, 0, NULL, 0),
230 229
231SND_SOC_DAPM_INPUT("MICN"), 230SND_SOC_DAPM_INPUT("MICN"),
232SND_SOC_DAPM_INPUT("MICP"), 231SND_SOC_DAPM_INPUT("MICP"),
@@ -557,7 +556,7 @@ static int wm8974_set_bias_level(struct snd_soc_codec *codec,
557#define WM8974_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ 556#define WM8974_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\
558 SNDRV_PCM_FMTBIT_S24_LE) 557 SNDRV_PCM_FMTBIT_S24_LE)
559 558
560static struct snd_soc_dai_ops wm8974_ops = { 559static const struct snd_soc_dai_ops wm8974_ops = {
561 .hw_params = wm8974_pcm_hw_params, 560 .hw_params = wm8974_pcm_hw_params,
562 .digital_mute = wm8974_mute, 561 .digital_mute = wm8974_mute,
563 .set_fmt = wm8974_set_dai_fmt, 562 .set_fmt = wm8974_set_dai_fmt,
@@ -583,7 +582,7 @@ static struct snd_soc_dai_driver wm8974_dai = {
583 .symmetric_rates = 1, 582 .symmetric_rates = 1,
584}; 583};
585 584
586static int wm8974_suspend(struct snd_soc_codec *codec, pm_message_t state) 585static int wm8974_suspend(struct snd_soc_codec *codec)
587{ 586{
588 wm8974_set_bias_level(codec, SND_SOC_BIAS_OFF); 587 wm8974_set_bias_level(codec, SND_SOC_BIAS_OFF);
589 return 0; 588 return 0;
@@ -672,7 +671,7 @@ MODULE_DEVICE_TABLE(i2c, wm8974_i2c_id);
672 671
673static struct i2c_driver wm8974_i2c_driver = { 672static struct i2c_driver wm8974_i2c_driver = {
674 .driver = { 673 .driver = {
675 .name = "wm8974-codec", 674 .name = "wm8974",
676 .owner = THIS_MODULE, 675 .owner = THIS_MODULE,
677 }, 676 },
678 .probe = wm8974_i2c_probe, 677 .probe = wm8974_i2c_probe,
diff --git a/sound/soc/codecs/wm8978.c b/sound/soc/codecs/wm8978.c
index 41ca4d9ac20..85d514d63a4 100644
--- a/sound/soc/codecs/wm8978.c
+++ b/sound/soc/codecs/wm8978.c
@@ -18,7 +18,6 @@
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/platform_device.h>
22#include <linux/slab.h> 21#include <linux/slab.h>
23#include <sound/core.h> 22#include <sound/core.h>
24#include <sound/pcm.h> 23#include <sound/pcm.h>
@@ -865,7 +864,7 @@ static int wm8978_set_bias_level(struct snd_soc_codec *codec,
865#define WM8978_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \ 864#define WM8978_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \
866 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE) 865 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE)
867 866
868static struct snd_soc_dai_ops wm8978_dai_ops = { 867static const struct snd_soc_dai_ops wm8978_dai_ops = {
869 .hw_params = wm8978_hw_params, 868 .hw_params = wm8978_hw_params,
870 .digital_mute = wm8978_mute, 869 .digital_mute = wm8978_mute,
871 .set_fmt = wm8978_set_dai_fmt, 870 .set_fmt = wm8978_set_dai_fmt,
@@ -893,7 +892,7 @@ static struct snd_soc_dai_driver wm8978_dai = {
893 .ops = &wm8978_dai_ops, 892 .ops = &wm8978_dai_ops,
894}; 893};
895 894
896static int wm8978_suspend(struct snd_soc_codec *codec, pm_message_t state) 895static int wm8978_suspend(struct snd_soc_codec *codec)
897{ 896{
898 wm8978_set_bias_level(codec, SND_SOC_BIAS_OFF); 897 wm8978_set_bias_level(codec, SND_SOC_BIAS_OFF);
899 /* Also switch PLL off */ 898 /* Also switch PLL off */
diff --git a/sound/soc/codecs/wm8983.c b/sound/soc/codecs/wm8983.c
index 93ee28439be..cebde568d19 100644
--- a/sound/soc/codecs/wm8983.c
+++ b/sound/soc/codecs/wm8983.c
@@ -481,7 +481,8 @@ static const struct snd_soc_dapm_widget wm8983_dapm_widgets[] = {
481 SND_SOC_DAPM_PGA("OUT4 Out", WM8983_POWER_MANAGEMENT_3, 481 SND_SOC_DAPM_PGA("OUT4 Out", WM8983_POWER_MANAGEMENT_3,
482 8, 0, NULL, 0), 482 8, 0, NULL, 0),
483 483
484 SND_SOC_DAPM_MICBIAS("Mic Bias", WM8983_POWER_MANAGEMENT_1, 4, 0), 484 SND_SOC_DAPM_SUPPLY("Mic Bias", WM8983_POWER_MANAGEMENT_1, 4, 0,
485 NULL, 0),
485 486
486 SND_SOC_DAPM_INPUT("LIN"), 487 SND_SOC_DAPM_INPUT("LIN"),
487 SND_SOC_DAPM_INPUT("LIP"), 488 SND_SOC_DAPM_INPUT("LIP"),
@@ -973,7 +974,7 @@ static int wm8983_set_bias_level(struct snd_soc_codec *codec,
973} 974}
974 975
975#ifdef CONFIG_PM 976#ifdef CONFIG_PM
976static int wm8983_suspend(struct snd_soc_codec *codec, pm_message_t state) 977static int wm8983_suspend(struct snd_soc_codec *codec)
977{ 978{
978 wm8983_set_bias_level(codec, SND_SOC_BIAS_OFF); 979 wm8983_set_bias_level(codec, SND_SOC_BIAS_OFF);
979 return 0; 980 return 0;
@@ -1034,7 +1035,7 @@ static int wm8983_probe(struct snd_soc_codec *codec)
1034 return 0; 1035 return 0;
1035} 1036}
1036 1037
1037static struct snd_soc_dai_ops wm8983_dai_ops = { 1038static const struct snd_soc_dai_ops wm8983_dai_ops = {
1038 .digital_mute = wm8983_dac_mute, 1039 .digital_mute = wm8983_dac_mute,
1039 .hw_params = wm8983_hw_params, 1040 .hw_params = wm8983_hw_params,
1040 .set_fmt = wm8983_set_fmt, 1041 .set_fmt = wm8983_set_fmt,
diff --git a/sound/soc/codecs/wm8985.c b/sound/soc/codecs/wm8985.c
index bae510acdec..c0c86b3c6ad 100644
--- a/sound/soc/codecs/wm8985.c
+++ b/sound/soc/codecs/wm8985.c
@@ -411,7 +411,8 @@ static const struct snd_soc_dapm_widget wm8985_dapm_widgets[] = {
411 SND_SOC_DAPM_PGA("Right Speaker Out", WM8985_POWER_MANAGEMENT_3, 411 SND_SOC_DAPM_PGA("Right Speaker Out", WM8985_POWER_MANAGEMENT_3,
412 6, 0, NULL, 0), 412 6, 0, NULL, 0),
413 413
414 SND_SOC_DAPM_MICBIAS("Mic Bias", WM8985_POWER_MANAGEMENT_1, 4, 0), 414 SND_SOC_DAPM_SUPPLY("Mic Bias", WM8985_POWER_MANAGEMENT_1, 4, 0,
415 NULL, 0),
415 416
416 SND_SOC_DAPM_INPUT("LIN"), 417 SND_SOC_DAPM_INPUT("LIN"),
417 SND_SOC_DAPM_INPUT("LIP"), 418 SND_SOC_DAPM_INPUT("LIP"),
@@ -944,7 +945,7 @@ static int wm8985_set_bias_level(struct snd_soc_codec *codec,
944} 945}
945 946
946#ifdef CONFIG_PM 947#ifdef CONFIG_PM
947static int wm8985_suspend(struct snd_soc_codec *codec, pm_message_t state) 948static int wm8985_suspend(struct snd_soc_codec *codec)
948{ 949{
949 wm8985_set_bias_level(codec, SND_SOC_BIAS_OFF); 950 wm8985_set_bias_level(codec, SND_SOC_BIAS_OFF);
950 return 0; 951 return 0;
@@ -1030,7 +1031,7 @@ err_reg_get:
1030 return ret; 1031 return ret;
1031} 1032}
1032 1033
1033static struct snd_soc_dai_ops wm8985_dai_ops = { 1034static const struct snd_soc_dai_ops wm8985_dai_ops = {
1034 .digital_mute = wm8985_dac_mute, 1035 .digital_mute = wm8985_dac_mute,
1035 .hw_params = wm8985_hw_params, 1036 .hw_params = wm8985_hw_params,
1036 .set_fmt = wm8985_set_fmt, 1037 .set_fmt = wm8985_set_fmt,
diff --git a/sound/soc/codecs/wm8988.c b/sound/soc/codecs/wm8988.c
index 2e9eba717d1..ab52963dd04 100644
--- a/sound/soc/codecs/wm8988.c
+++ b/sound/soc/codecs/wm8988.c
@@ -18,7 +18,6 @@
18#include <linux/pm.h> 18#include <linux/pm.h>
19#include <linux/i2c.h> 19#include <linux/i2c.h>
20#include <linux/spi/spi.h> 20#include <linux/spi/spi.h>
21#include <linux/platform_device.h>
22#include <linux/slab.h> 21#include <linux/slab.h>
23#include <sound/core.h> 22#include <sound/core.h>
24#include <sound/pcm.h> 23#include <sound/pcm.h>
@@ -267,7 +266,7 @@ static const struct snd_kcontrol_new wm8988_monomux_controls =
267 SOC_DAPM_ENUM("Route", monomux); 266 SOC_DAPM_ENUM("Route", monomux);
268 267
269static const struct snd_soc_dapm_widget wm8988_dapm_widgets[] = { 268static const struct snd_soc_dapm_widget wm8988_dapm_widgets[] = {
270 SND_SOC_DAPM_MICBIAS("Mic Bias", WM8988_PWR1, 1, 0), 269 SND_SOC_DAPM_SUPPLY("Mic Bias", WM8988_PWR1, 1, 0, NULL, 0),
271 270
272 SND_SOC_DAPM_MUX("Differential Mux", SND_SOC_NOPM, 0, 0, 271 SND_SOC_DAPM_MUX("Differential Mux", SND_SOC_NOPM, 0, 0,
273 &wm8988_diffmux_controls), 272 &wm8988_diffmux_controls),
@@ -701,7 +700,7 @@ static int wm8988_set_bias_level(struct snd_soc_codec *codec,
701#define WM8988_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ 700#define WM8988_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\
702 SNDRV_PCM_FMTBIT_S24_LE) 701 SNDRV_PCM_FMTBIT_S24_LE)
703 702
704static struct snd_soc_dai_ops wm8988_ops = { 703static const struct snd_soc_dai_ops wm8988_ops = {
705 .startup = wm8988_pcm_startup, 704 .startup = wm8988_pcm_startup,
706 .hw_params = wm8988_pcm_hw_params, 705 .hw_params = wm8988_pcm_hw_params,
707 .set_fmt = wm8988_set_dai_fmt, 706 .set_fmt = wm8988_set_dai_fmt,
@@ -729,7 +728,7 @@ static struct snd_soc_dai_driver wm8988_dai = {
729 .symmetric_rates = 1, 728 .symmetric_rates = 1,
730}; 729};
731 730
732static int wm8988_suspend(struct snd_soc_codec *codec, pm_message_t state) 731static int wm8988_suspend(struct snd_soc_codec *codec)
733{ 732{
734 wm8988_set_bias_level(codec, SND_SOC_BIAS_OFF); 733 wm8988_set_bias_level(codec, SND_SOC_BIAS_OFF);
735 return 0; 734 return 0;
@@ -823,7 +822,7 @@ static int __devexit wm8988_spi_remove(struct spi_device *spi)
823 822
824static struct spi_driver wm8988_spi_driver = { 823static struct spi_driver wm8988_spi_driver = {
825 .driver = { 824 .driver = {
826 .name = "wm8988-codec", 825 .name = "wm8988",
827 .owner = THIS_MODULE, 826 .owner = THIS_MODULE,
828 }, 827 },
829 .probe = wm8988_spi_probe, 828 .probe = wm8988_spi_probe,
diff --git a/sound/soc/codecs/wm8990.c b/sound/soc/codecs/wm8990.c
index d29a9622964..e538edaae1f 100644
--- a/sound/soc/codecs/wm8990.c
+++ b/sound/soc/codecs/wm8990.c
@@ -17,7 +17,6 @@
17#include <linux/delay.h> 17#include <linux/delay.h>
18#include <linux/pm.h> 18#include <linux/pm.h>
19#include <linux/i2c.h> 19#include <linux/i2c.h>
20#include <linux/platform_device.h>
21#include <linux/slab.h> 20#include <linux/slab.h>
22#include <sound/core.h> 21#include <sound/core.h>
23#include <sound/pcm.h> 22#include <sound/pcm.h>
@@ -776,8 +775,8 @@ SND_SOC_DAPM_PGA("ROPGA", WM8990_POWER_MANAGEMENT_3, WM8990_ROPGA_ENA_BIT, 0,
776 NULL, 0), 775 NULL, 0),
777 776
778/* MICBIAS */ 777/* MICBIAS */
779SND_SOC_DAPM_MICBIAS("MICBIAS", WM8990_POWER_MANAGEMENT_1, 778SND_SOC_DAPM_SUPPLY("MICBIAS", WM8990_POWER_MANAGEMENT_1,
780 WM8990_MICBIAS_ENA_BIT, 0), 779 WM8990_MICBIAS_ENA_BIT, 0, NULL, 0),
781 780
782SND_SOC_DAPM_OUTPUT("LON"), 781SND_SOC_DAPM_OUTPUT("LON"),
783SND_SOC_DAPM_OUTPUT("LOP"), 782SND_SOC_DAPM_OUTPUT("LOP"),
@@ -1287,7 +1286,7 @@ static int wm8990_set_bias_level(struct snd_soc_codec *codec,
1287 * 1. ADC/DAC on Primary Interface 1286 * 1. ADC/DAC on Primary Interface
1288 * 2. ADC on Primary Interface/DAC on secondary 1287 * 2. ADC on Primary Interface/DAC on secondary
1289 */ 1288 */
1290static struct snd_soc_dai_ops wm8990_dai_ops = { 1289static const struct snd_soc_dai_ops wm8990_dai_ops = {
1291 .hw_params = wm8990_hw_params, 1290 .hw_params = wm8990_hw_params,
1292 .digital_mute = wm8990_mute, 1291 .digital_mute = wm8990_mute,
1293 .set_fmt = wm8990_set_dai_fmt, 1292 .set_fmt = wm8990_set_dai_fmt,
@@ -1314,7 +1313,7 @@ static struct snd_soc_dai_driver wm8990_dai = {
1314 .ops = &wm8990_dai_ops, 1313 .ops = &wm8990_dai_ops,
1315}; 1314};
1316 1315
1317static int wm8990_suspend(struct snd_soc_codec *codec, pm_message_t state) 1316static int wm8990_suspend(struct snd_soc_codec *codec)
1318{ 1317{
1319 wm8990_set_bias_level(codec, SND_SOC_BIAS_OFF); 1318 wm8990_set_bias_level(codec, SND_SOC_BIAS_OFF);
1320 return 0; 1319 return 0;
@@ -1418,7 +1417,7 @@ MODULE_DEVICE_TABLE(i2c, wm8990_i2c_id);
1418 1417
1419static struct i2c_driver wm8990_i2c_driver = { 1418static struct i2c_driver wm8990_i2c_driver = {
1420 .driver = { 1419 .driver = {
1421 .name = "wm8990-codec", 1420 .name = "wm8990",
1422 .owner = THIS_MODULE, 1421 .owner = THIS_MODULE,
1423 }, 1422 },
1424 .probe = wm8990_i2c_probe, 1423 .probe = wm8990_i2c_probe,
diff --git a/sound/soc/codecs/wm8991.c b/sound/soc/codecs/wm8991.c
index c9ab3ba9bce..7ee40da8dbb 100644
--- a/sound/soc/codecs/wm8991.c
+++ b/sound/soc/codecs/wm8991.c
@@ -18,7 +18,6 @@
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/platform_device.h>
22#include <linux/slab.h> 21#include <linux/slab.h>
23#include <sound/core.h> 22#include <sound/core.h>
24#include <sound/pcm.h> 23#include <sound/pcm.h>
@@ -770,8 +769,8 @@ static const struct snd_soc_dapm_widget wm8991_dapm_widgets[] = {
770 NULL, 0), 769 NULL, 0),
771 770
772 /* MICBIAS */ 771 /* MICBIAS */
773 SND_SOC_DAPM_MICBIAS("MICBIAS", WM8991_POWER_MANAGEMENT_1, 772 SND_SOC_DAPM_SUPPLY("MICBIAS", WM8991_POWER_MANAGEMENT_1,
774 WM8991_MICBIAS_ENA_BIT, 0), 773 WM8991_MICBIAS_ENA_BIT, 0, NULL, 0),
775 774
776 SND_SOC_DAPM_OUTPUT("LON"), 775 SND_SOC_DAPM_OUTPUT("LON"),
777 SND_SOC_DAPM_OUTPUT("LOP"), 776 SND_SOC_DAPM_OUTPUT("LOP"),
@@ -1241,7 +1240,7 @@ static int wm8991_set_bias_level(struct snd_soc_codec *codec,
1241 return 0; 1240 return 0;
1242} 1241}
1243 1242
1244static int wm8991_suspend(struct snd_soc_codec *codec, pm_message_t state) 1243static int wm8991_suspend(struct snd_soc_codec *codec)
1245{ 1244{
1246 wm8991_set_bias_level(codec, SND_SOC_BIAS_OFF); 1245 wm8991_set_bias_level(codec, SND_SOC_BIAS_OFF);
1247 return 0; 1246 return 0;
@@ -1311,7 +1310,7 @@ static int wm8991_probe(struct snd_soc_codec *codec)
1311#define WM8991_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ 1310#define WM8991_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\
1312 SNDRV_PCM_FMTBIT_S24_LE) 1311 SNDRV_PCM_FMTBIT_S24_LE)
1313 1312
1314static struct snd_soc_dai_ops wm8991_ops = { 1313static const struct snd_soc_dai_ops wm8991_ops = {
1315 .hw_params = wm8991_hw_params, 1314 .hw_params = wm8991_hw_params,
1316 .digital_mute = wm8991_mute, 1315 .digital_mute = wm8991_mute,
1317 .set_fmt = wm8991_set_dai_fmt, 1316 .set_fmt = wm8991_set_dai_fmt,
diff --git a/sound/soc/codecs/wm8993.c b/sound/soc/codecs/wm8993.c
index d1a142f48b0..2b40c93601e 100644
--- a/sound/soc/codecs/wm8993.c
+++ b/sound/soc/codecs/wm8993.c
@@ -934,28 +934,6 @@ static const struct snd_soc_dapm_route routes[] = {
934 { "Right Headphone Mux", "DAC", "DACR" }, 934 { "Right Headphone Mux", "DAC", "DACR" },
935}; 935};
936 936
937static void wm8993_cache_restore(struct snd_soc_codec *codec)
938{
939 u16 *cache = codec->reg_cache;
940 int i;
941
942 if (!codec->cache_sync)
943 return;
944
945 /* Reenable hardware writes */
946 codec->cache_only = 0;
947
948 /* Restore the register settings */
949 for (i = 1; i < WM8993_MAX_REGISTER; i++) {
950 if (cache[i] == wm8993_reg_defaults[i])
951 continue;
952 snd_soc_write(codec, i, cache[i]);
953 }
954
955 /* We're in sync again */
956 codec->cache_sync = 0;
957}
958
959static int wm8993_set_bias_level(struct snd_soc_codec *codec, 937static int wm8993_set_bias_level(struct snd_soc_codec *codec,
960 enum snd_soc_bias_level level) 938 enum snd_soc_bias_level level)
961{ 939{
@@ -979,7 +957,7 @@ static int wm8993_set_bias_level(struct snd_soc_codec *codec,
979 if (ret != 0) 957 if (ret != 0)
980 return ret; 958 return ret;
981 959
982 wm8993_cache_restore(codec); 960 snd_soc_cache_sync(codec);
983 961
984 /* Tune DC servo configuration */ 962 /* Tune DC servo configuration */
985 snd_soc_write(codec, 0x44, 3); 963 snd_soc_write(codec, 0x44, 3);
@@ -1394,7 +1372,7 @@ out:
1394 return 0; 1372 return 0;
1395} 1373}
1396 1374
1397static struct snd_soc_dai_ops wm8993_ops = { 1375static const struct snd_soc_dai_ops wm8993_ops = {
1398 .set_sysclk = wm8993_set_sysclk, 1376 .set_sysclk = wm8993_set_sysclk,
1399 .set_fmt = wm8993_set_dai_fmt, 1377 .set_fmt = wm8993_set_dai_fmt,
1400 .hw_params = wm8993_hw_params, 1378 .hw_params = wm8993_hw_params,
@@ -1544,7 +1522,7 @@ static int wm8993_remove(struct snd_soc_codec *codec)
1544} 1522}
1545 1523
1546#ifdef CONFIG_PM 1524#ifdef CONFIG_PM
1547static int wm8993_suspend(struct snd_soc_codec *codec, pm_message_t state) 1525static int wm8993_suspend(struct snd_soc_codec *codec)
1548{ 1526{
1549 struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec); 1527 struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec);
1550 int fll_fout = wm8993->fll_fout; 1528 int fll_fout = wm8993->fll_fout;
@@ -1613,7 +1591,8 @@ static __devinit int wm8993_i2c_probe(struct i2c_client *i2c,
1613 struct wm8993_priv *wm8993; 1591 struct wm8993_priv *wm8993;
1614 int ret; 1592 int ret;
1615 1593
1616 wm8993 = kzalloc(sizeof(struct wm8993_priv), GFP_KERNEL); 1594 wm8993 = devm_kzalloc(&i2c->dev, sizeof(struct wm8993_priv),
1595 GFP_KERNEL);
1617 if (wm8993 == NULL) 1596 if (wm8993 == NULL)
1618 return -ENOMEM; 1597 return -ENOMEM;
1619 1598
@@ -1621,8 +1600,6 @@ static __devinit int wm8993_i2c_probe(struct i2c_client *i2c,
1621 1600
1622 ret = snd_soc_register_codec(&i2c->dev, 1601 ret = snd_soc_register_codec(&i2c->dev,
1623 &soc_codec_dev_wm8993, &wm8993_dai, 1); 1602 &soc_codec_dev_wm8993, &wm8993_dai, 1);
1624 if (ret < 0)
1625 kfree(wm8993);
1626 return ret; 1603 return ret;
1627} 1604}
1628 1605
@@ -1641,7 +1618,7 @@ MODULE_DEVICE_TABLE(i2c, wm8993_i2c_id);
1641 1618
1642static struct i2c_driver wm8993_i2c_driver = { 1619static struct i2c_driver wm8993_i2c_driver = {
1643 .driver = { 1620 .driver = {
1644 .name = "wm8993-codec", 1621 .name = "wm8993",
1645 .owner = THIS_MODULE, 1622 .owner = THIS_MODULE,
1646 }, 1623 },
1647 .probe = wm8993_i2c_probe, 1624 .probe = wm8993_i2c_probe,
diff --git a/sound/soc/codecs/wm8994-tables.c b/sound/soc/codecs/wm8994-tables.c
deleted file mode 100644
index df5a8b9a250..00000000000
--- a/sound/soc/codecs/wm8994-tables.c
+++ /dev/null
@@ -1,3147 +0,0 @@
1#include "wm8994.h"
2
3const struct wm8994_access_mask wm8994_access_masks[WM8994_CACHE_SIZE] = {
4 { 0xFFFF, 0xFFFF }, /* R0 - Software Reset */
5 { 0x3B37, 0x3B37 }, /* R1 - Power Management (1) */
6 { 0x6BF0, 0x6BF0 }, /* R2 - Power Management (2) */
7 { 0x3FF0, 0x3FF0 }, /* R3 - Power Management (3) */
8 { 0x3F3F, 0x3F3F }, /* R4 - Power Management (4) */
9 { 0x3F0F, 0x3F0F }, /* R5 - Power Management (5) */
10 { 0x003F, 0x003F }, /* R6 - Power Management (6) */
11 { 0x0000, 0x0000 }, /* R7 */
12 { 0x0000, 0x0000 }, /* R8 */
13 { 0x0000, 0x0000 }, /* R9 */
14 { 0x0000, 0x0000 }, /* R10 */
15 { 0x0000, 0x0000 }, /* R11 */
16 { 0x0000, 0x0000 }, /* R12 */
17 { 0x0000, 0x0000 }, /* R13 */
18 { 0x0000, 0x0000 }, /* R14 */
19 { 0x0000, 0x0000 }, /* R15 */
20 { 0x0000, 0x0000 }, /* R16 */
21 { 0x0000, 0x0000 }, /* R17 */
22 { 0x0000, 0x0000 }, /* R18 */
23 { 0x0000, 0x0000 }, /* R19 */
24 { 0x0000, 0x0000 }, /* R20 */
25 { 0x01C0, 0x01C0 }, /* R21 - Input Mixer (1) */
26 { 0x0000, 0x0000 }, /* R22 */
27 { 0x0000, 0x0000 }, /* R23 */
28 { 0x00DF, 0x01DF }, /* R24 - Left Line Input 1&2 Volume */
29 { 0x00DF, 0x01DF }, /* R25 - Left Line Input 3&4 Volume */
30 { 0x00DF, 0x01DF }, /* R26 - Right Line Input 1&2 Volume */
31 { 0x00DF, 0x01DF }, /* R27 - Right Line Input 3&4 Volume */
32 { 0x00FF, 0x01FF }, /* R28 - Left Output Volume */
33 { 0x00FF, 0x01FF }, /* R29 - Right Output Volume */
34 { 0x0077, 0x0077 }, /* R30 - Line Outputs Volume */
35 { 0x0030, 0x0030 }, /* R31 - HPOUT2 Volume */
36 { 0x00FF, 0x01FF }, /* R32 - Left OPGA Volume */
37 { 0x00FF, 0x01FF }, /* R33 - Right OPGA Volume */
38 { 0x007F, 0x007F }, /* R34 - SPKMIXL Attenuation */
39 { 0x017F, 0x017F }, /* R35 - SPKMIXR Attenuation */
40 { 0x003F, 0x003F }, /* R36 - SPKOUT Mixers */
41 { 0x003F, 0x003F }, /* R37 - ClassD */
42 { 0x00FF, 0x01FF }, /* R38 - Speaker Volume Left */
43 { 0x00FF, 0x01FF }, /* R39 - Speaker Volume Right */
44 { 0x00FF, 0x00FF }, /* R40 - Input Mixer (2) */
45 { 0x01B7, 0x01B7 }, /* R41 - Input Mixer (3) */
46 { 0x01B7, 0x01B7 }, /* R42 - Input Mixer (4) */
47 { 0x01C7, 0x01C7 }, /* R43 - Input Mixer (5) */
48 { 0x01C7, 0x01C7 }, /* R44 - Input Mixer (6) */
49 { 0x01FF, 0x01FF }, /* R45 - Output Mixer (1) */
50 { 0x01FF, 0x01FF }, /* R46 - Output Mixer (2) */
51 { 0x0FFF, 0x0FFF }, /* R47 - Output Mixer (3) */
52 { 0x0FFF, 0x0FFF }, /* R48 - Output Mixer (4) */
53 { 0x0FFF, 0x0FFF }, /* R49 - Output Mixer (5) */
54 { 0x0FFF, 0x0FFF }, /* R50 - Output Mixer (6) */
55 { 0x0038, 0x0038 }, /* R51 - HPOUT2 Mixer */
56 { 0x0077, 0x0077 }, /* R52 - Line Mixer (1) */
57 { 0x0077, 0x0077 }, /* R53 - Line Mixer (2) */
58 { 0x03FF, 0x03FF }, /* R54 - Speaker Mixer */
59 { 0x00C1, 0x00C1 }, /* R55 - Additional Control */
60 { 0x00F0, 0x00F0 }, /* R56 - AntiPOP (1) */
61 { 0x01EF, 0x01EF }, /* R57 - AntiPOP (2) */
62 { 0x00FF, 0x00FF }, /* R58 - MICBIAS */
63 { 0x000F, 0x000F }, /* R59 - LDO 1 */
64 { 0x0007, 0x0007 }, /* R60 - LDO 2 */
65 { 0xFFFF, 0xFFFF }, /* R61 */
66 { 0xFFFF, 0xFFFF }, /* R62 */
67 { 0x0000, 0x0000 }, /* R63 */
68 { 0x0000, 0x0000 }, /* R64 */
69 { 0x0000, 0x0000 }, /* R65 */
70 { 0x0000, 0x0000 }, /* R66 */
71 { 0x0000, 0x0000 }, /* R67 */
72 { 0x0000, 0x0000 }, /* R68 */
73 { 0x0000, 0x0000 }, /* R69 */
74 { 0x0000, 0x0000 }, /* R70 */
75 { 0x0000, 0x0000 }, /* R71 */
76 { 0x0000, 0x0000 }, /* R72 */
77 { 0x0000, 0x0000 }, /* R73 */
78 { 0x0000, 0x0000 }, /* R74 */
79 { 0x0000, 0x0000 }, /* R75 */
80 { 0x8000, 0x8000 }, /* R76 - Charge Pump (1) */
81 { 0x0000, 0x0000 }, /* R77 */
82 { 0x0000, 0x0000 }, /* R78 */
83 { 0x0000, 0x0000 }, /* R79 */
84 { 0x0000, 0x0000 }, /* R80 */
85 { 0x0301, 0x0301 }, /* R81 - Class W (1) */
86 { 0x0000, 0x0000 }, /* R82 */
87 { 0x0000, 0x0000 }, /* R83 */
88 { 0x333F, 0x333F }, /* R84 - DC Servo (1) */
89 { 0x0FEF, 0x0FEF }, /* R85 - DC Servo (2) */
90 { 0x0000, 0x0000 }, /* R86 */
91 { 0xFFFF, 0xFFFF }, /* R87 - DC Servo (4) */
92 { 0x0333, 0x0000 }, /* R88 - DC Servo Readback */
93 { 0x0000, 0x0000 }, /* R89 */
94 { 0x0000, 0x0000 }, /* R90 */
95 { 0x0000, 0x0000 }, /* R91 */
96 { 0x0000, 0x0000 }, /* R92 */
97 { 0x0000, 0x0000 }, /* R93 */
98 { 0x0000, 0x0000 }, /* R94 */
99 { 0x0000, 0x0000 }, /* R95 */
100 { 0x00EE, 0x00EE }, /* R96 - Analogue HP (1) */
101 { 0x0000, 0x0000 }, /* R97 */
102 { 0x0000, 0x0000 }, /* R98 */
103 { 0x0000, 0x0000 }, /* R99 */
104 { 0x0000, 0x0000 }, /* R100 */
105 { 0x0000, 0x0000 }, /* R101 */
106 { 0x0000, 0x0000 }, /* R102 */
107 { 0x0000, 0x0000 }, /* R103 */
108 { 0x0000, 0x0000 }, /* R104 */
109 { 0x0000, 0x0000 }, /* R105 */
110 { 0x0000, 0x0000 }, /* R106 */
111 { 0x0000, 0x0000 }, /* R107 */
112 { 0x0000, 0x0000 }, /* R108 */
113 { 0x0000, 0x0000 }, /* R109 */
114 { 0x0000, 0x0000 }, /* R110 */
115 { 0x0000, 0x0000 }, /* R111 */
116 { 0x0000, 0x0000 }, /* R112 */
117 { 0x0000, 0x0000 }, /* R113 */
118 { 0x0000, 0x0000 }, /* R114 */
119 { 0x0000, 0x0000 }, /* R115 */
120 { 0x0000, 0x0000 }, /* R116 */
121 { 0x0000, 0x0000 }, /* R117 */
122 { 0x0000, 0x0000 }, /* R118 */
123 { 0x0000, 0x0000 }, /* R119 */
124 { 0x0000, 0x0000 }, /* R120 */
125 { 0x0000, 0x0000 }, /* R121 */
126 { 0x0000, 0x0000 }, /* R122 */
127 { 0x0000, 0x0000 }, /* R123 */
128 { 0x0000, 0x0000 }, /* R124 */
129 { 0x0000, 0x0000 }, /* R125 */
130 { 0x0000, 0x0000 }, /* R126 */
131 { 0x0000, 0x0000 }, /* R127 */
132 { 0x0000, 0x0000 }, /* R128 */
133 { 0x0000, 0x0000 }, /* R129 */
134 { 0x0000, 0x0000 }, /* R130 */
135 { 0x0000, 0x0000 }, /* R131 */
136 { 0x0000, 0x0000 }, /* R132 */
137 { 0x0000, 0x0000 }, /* R133 */
138 { 0x0000, 0x0000 }, /* R134 */
139 { 0x0000, 0x0000 }, /* R135 */
140 { 0x0000, 0x0000 }, /* R136 */
141 { 0x0000, 0x0000 }, /* R137 */
142 { 0x0000, 0x0000 }, /* R138 */
143 { 0x0000, 0x0000 }, /* R139 */
144 { 0x0000, 0x0000 }, /* R140 */
145 { 0x0000, 0x0000 }, /* R141 */
146 { 0x0000, 0x0000 }, /* R142 */
147 { 0x0000, 0x0000 }, /* R143 */
148 { 0x0000, 0x0000 }, /* R144 */
149 { 0x0000, 0x0000 }, /* R145 */
150 { 0x0000, 0x0000 }, /* R146 */
151 { 0x0000, 0x0000 }, /* R147 */
152 { 0x0000, 0x0000 }, /* R148 */
153 { 0x0000, 0x0000 }, /* R149 */
154 { 0x0000, 0x0000 }, /* R150 */
155 { 0x0000, 0x0000 }, /* R151 */
156 { 0x0000, 0x0000 }, /* R152 */
157 { 0x0000, 0x0000 }, /* R153 */
158 { 0x0000, 0x0000 }, /* R154 */
159 { 0x0000, 0x0000 }, /* R155 */
160 { 0x0000, 0x0000 }, /* R156 */
161 { 0x0000, 0x0000 }, /* R157 */
162 { 0x0000, 0x0000 }, /* R158 */
163 { 0x0000, 0x0000 }, /* R159 */
164 { 0x0000, 0x0000 }, /* R160 */
165 { 0x0000, 0x0000 }, /* R161 */
166 { 0x0000, 0x0000 }, /* R162 */
167 { 0x0000, 0x0000 }, /* R163 */
168 { 0x0000, 0x0000 }, /* R164 */
169 { 0x0000, 0x0000 }, /* R165 */
170 { 0x0000, 0x0000 }, /* R166 */
171 { 0x0000, 0x0000 }, /* R167 */
172 { 0x0000, 0x0000 }, /* R168 */
173 { 0x0000, 0x0000 }, /* R169 */
174 { 0x0000, 0x0000 }, /* R170 */
175 { 0x0000, 0x0000 }, /* R171 */
176 { 0x0000, 0x0000 }, /* R172 */
177 { 0x0000, 0x0000 }, /* R173 */
178 { 0x0000, 0x0000 }, /* R174 */
179 { 0x0000, 0x0000 }, /* R175 */
180 { 0x0000, 0x0000 }, /* R176 */
181 { 0x0000, 0x0000 }, /* R177 */
182 { 0x0000, 0x0000 }, /* R178 */
183 { 0x0000, 0x0000 }, /* R179 */
184 { 0x0000, 0x0000 }, /* R180 */
185 { 0x0000, 0x0000 }, /* R181 */
186 { 0x0000, 0x0000 }, /* R182 */
187 { 0x0000, 0x0000 }, /* R183 */
188 { 0x0000, 0x0000 }, /* R184 */
189 { 0x0000, 0x0000 }, /* R185 */
190 { 0x0000, 0x0000 }, /* R186 */
191 { 0x0000, 0x0000 }, /* R187 */
192 { 0x0000, 0x0000 }, /* R188 */
193 { 0x0000, 0x0000 }, /* R189 */
194 { 0x0000, 0x0000 }, /* R190 */
195 { 0x0000, 0x0000 }, /* R191 */
196 { 0x0000, 0x0000 }, /* R192 */
197 { 0x0000, 0x0000 }, /* R193 */
198 { 0x0000, 0x0000 }, /* R194 */
199 { 0x0000, 0x0000 }, /* R195 */
200 { 0x0000, 0x0000 }, /* R196 */
201 { 0x0000, 0x0000 }, /* R197 */
202 { 0x0000, 0x0000 }, /* R198 */
203 { 0x0000, 0x0000 }, /* R199 */
204 { 0x0000, 0x0000 }, /* R200 */
205 { 0x0000, 0x0000 }, /* R201 */
206 { 0x0000, 0x0000 }, /* R202 */
207 { 0x0000, 0x0000 }, /* R203 */
208 { 0x0000, 0x0000 }, /* R204 */
209 { 0x0000, 0x0000 }, /* R205 */
210 { 0x0000, 0x0000 }, /* R206 */
211 { 0x0000, 0x0000 }, /* R207 */
212 { 0xFFFF, 0xFFFF }, /* R208 */
213 { 0xFFFF, 0xFFFF }, /* R209 */
214 { 0xFFFF, 0xFFFF }, /* R210 */
215 { 0x0000, 0x0000 }, /* R211 */
216 { 0x0000, 0x0000 }, /* R212 */
217 { 0x0000, 0x0000 }, /* R213 */
218 { 0x0000, 0x0000 }, /* R214 */
219 { 0x0000, 0x0000 }, /* R215 */
220 { 0x0000, 0x0000 }, /* R216 */
221 { 0x0000, 0x0000 }, /* R217 */
222 { 0x0000, 0x0000 }, /* R218 */
223 { 0x0000, 0x0000 }, /* R219 */
224 { 0x0000, 0x0000 }, /* R220 */
225 { 0x0000, 0x0000 }, /* R221 */
226 { 0x0000, 0x0000 }, /* R222 */
227 { 0x0000, 0x0000 }, /* R223 */
228 { 0x0000, 0x0000 }, /* R224 */
229 { 0x0000, 0x0000 }, /* R225 */
230 { 0x0000, 0x0000 }, /* R226 */
231 { 0x0000, 0x0000 }, /* R227 */
232 { 0x0000, 0x0000 }, /* R228 */
233 { 0x0000, 0x0000 }, /* R229 */
234 { 0x0000, 0x0000 }, /* R230 */
235 { 0x0000, 0x0000 }, /* R231 */
236 { 0x0000, 0x0000 }, /* R232 */
237 { 0x0000, 0x0000 }, /* R233 */
238 { 0x0000, 0x0000 }, /* R234 */
239 { 0x0000, 0x0000 }, /* R235 */
240 { 0x0000, 0x0000 }, /* R236 */
241 { 0x0000, 0x0000 }, /* R237 */
242 { 0x0000, 0x0000 }, /* R238 */
243 { 0x0000, 0x0000 }, /* R239 */
244 { 0x0000, 0x0000 }, /* R240 */
245 { 0x0000, 0x0000 }, /* R241 */
246 { 0x0000, 0x0000 }, /* R242 */
247 { 0x0000, 0x0000 }, /* R243 */
248 { 0x0000, 0x0000 }, /* R244 */
249 { 0x0000, 0x0000 }, /* R245 */
250 { 0x0000, 0x0000 }, /* R246 */
251 { 0x0000, 0x0000 }, /* R247 */
252 { 0x0000, 0x0000 }, /* R248 */
253 { 0x0000, 0x0000 }, /* R249 */
254 { 0x0000, 0x0000 }, /* R250 */
255 { 0x0000, 0x0000 }, /* R251 */
256 { 0x0000, 0x0000 }, /* R252 */
257 { 0x0000, 0x0000 }, /* R253 */
258 { 0x0000, 0x0000 }, /* R254 */
259 { 0x0000, 0x0000 }, /* R255 */
260 { 0x000F, 0x0000 }, /* R256 - Chip Revision */
261 { 0x0074, 0x0074 }, /* R257 - Control Interface */
262 { 0x0000, 0x0000 }, /* R258 */
263 { 0x0000, 0x0000 }, /* R259 */
264 { 0x0000, 0x0000 }, /* R260 */
265 { 0x0000, 0x0000 }, /* R261 */
266 { 0x0000, 0x0000 }, /* R262 */
267 { 0x0000, 0x0000 }, /* R263 */
268 { 0x0000, 0x0000 }, /* R264 */
269 { 0x0000, 0x0000 }, /* R265 */
270 { 0x0000, 0x0000 }, /* R266 */
271 { 0x0000, 0x0000 }, /* R267 */
272 { 0x0000, 0x0000 }, /* R268 */
273 { 0x0000, 0x0000 }, /* R269 */
274 { 0x0000, 0x0000 }, /* R270 */
275 { 0x0000, 0x0000 }, /* R271 */
276 { 0x807F, 0x837F }, /* R272 - Write Sequencer Ctrl (1) */
277 { 0x017F, 0x0000 }, /* R273 - Write Sequencer Ctrl (2) */
278 { 0x0000, 0x0000 }, /* R274 */
279 { 0x0000, 0x0000 }, /* R275 */
280 { 0x0000, 0x0000 }, /* R276 */
281 { 0x0000, 0x0000 }, /* R277 */
282 { 0x0000, 0x0000 }, /* R278 */
283 { 0x0000, 0x0000 }, /* R279 */
284 { 0x0000, 0x0000 }, /* R280 */
285 { 0x0000, 0x0000 }, /* R281 */
286 { 0x0000, 0x0000 }, /* R282 */
287 { 0x0000, 0x0000 }, /* R283 */
288 { 0x0000, 0x0000 }, /* R284 */
289 { 0x0000, 0x0000 }, /* R285 */
290 { 0x0000, 0x0000 }, /* R286 */
291 { 0x0000, 0x0000 }, /* R287 */
292 { 0x0000, 0x0000 }, /* R288 */
293 { 0x0000, 0x0000 }, /* R289 */
294 { 0x0000, 0x0000 }, /* R290 */
295 { 0x0000, 0x0000 }, /* R291 */
296 { 0x0000, 0x0000 }, /* R292 */
297 { 0x0000, 0x0000 }, /* R293 */
298 { 0x0000, 0x0000 }, /* R294 */
299 { 0x0000, 0x0000 }, /* R295 */
300 { 0x0000, 0x0000 }, /* R296 */
301 { 0x0000, 0x0000 }, /* R297 */
302 { 0x0000, 0x0000 }, /* R298 */
303 { 0x0000, 0x0000 }, /* R299 */
304 { 0x0000, 0x0000 }, /* R300 */
305 { 0x0000, 0x0000 }, /* R301 */
306 { 0x0000, 0x0000 }, /* R302 */
307 { 0x0000, 0x0000 }, /* R303 */
308 { 0x0000, 0x0000 }, /* R304 */
309 { 0x0000, 0x0000 }, /* R305 */
310 { 0x0000, 0x0000 }, /* R306 */
311 { 0x0000, 0x0000 }, /* R307 */
312 { 0x0000, 0x0000 }, /* R308 */
313 { 0x0000, 0x0000 }, /* R309 */
314 { 0x0000, 0x0000 }, /* R310 */
315 { 0x0000, 0x0000 }, /* R311 */
316 { 0x0000, 0x0000 }, /* R312 */
317 { 0x0000, 0x0000 }, /* R313 */
318 { 0x0000, 0x0000 }, /* R314 */
319 { 0x0000, 0x0000 }, /* R315 */
320 { 0x0000, 0x0000 }, /* R316 */
321 { 0x0000, 0x0000 }, /* R317 */
322 { 0x0000, 0x0000 }, /* R318 */
323 { 0x0000, 0x0000 }, /* R319 */
324 { 0x0000, 0x0000 }, /* R320 */
325 { 0x0000, 0x0000 }, /* R321 */
326 { 0x0000, 0x0000 }, /* R322 */
327 { 0x0000, 0x0000 }, /* R323 */
328 { 0x0000, 0x0000 }, /* R324 */
329 { 0x0000, 0x0000 }, /* R325 */
330 { 0x0000, 0x0000 }, /* R326 */
331 { 0x0000, 0x0000 }, /* R327 */
332 { 0x0000, 0x0000 }, /* R328 */
333 { 0x0000, 0x0000 }, /* R329 */
334 { 0x0000, 0x0000 }, /* R330 */
335 { 0x0000, 0x0000 }, /* R331 */
336 { 0x0000, 0x0000 }, /* R332 */
337 { 0x0000, 0x0000 }, /* R333 */
338 { 0x0000, 0x0000 }, /* R334 */
339 { 0x0000, 0x0000 }, /* R335 */
340 { 0x0000, 0x0000 }, /* R336 */
341 { 0x0000, 0x0000 }, /* R337 */
342 { 0x0000, 0x0000 }, /* R338 */
343 { 0x0000, 0x0000 }, /* R339 */
344 { 0x0000, 0x0000 }, /* R340 */
345 { 0x0000, 0x0000 }, /* R341 */
346 { 0x0000, 0x0000 }, /* R342 */
347 { 0x0000, 0x0000 }, /* R343 */
348 { 0x0000, 0x0000 }, /* R344 */
349 { 0x0000, 0x0000 }, /* R345 */
350 { 0x0000, 0x0000 }, /* R346 */
351 { 0x0000, 0x0000 }, /* R347 */
352 { 0x0000, 0x0000 }, /* R348 */
353 { 0x0000, 0x0000 }, /* R349 */
354 { 0x0000, 0x0000 }, /* R350 */
355 { 0x0000, 0x0000 }, /* R351 */
356 { 0x0000, 0x0000 }, /* R352 */
357 { 0x0000, 0x0000 }, /* R353 */
358 { 0x0000, 0x0000 }, /* R354 */
359 { 0x0000, 0x0000 }, /* R355 */
360 { 0x0000, 0x0000 }, /* R356 */
361 { 0x0000, 0x0000 }, /* R357 */
362 { 0x0000, 0x0000 }, /* R358 */
363 { 0x0000, 0x0000 }, /* R359 */
364 { 0x0000, 0x0000 }, /* R360 */
365 { 0x0000, 0x0000 }, /* R361 */
366 { 0x0000, 0x0000 }, /* R362 */
367 { 0x0000, 0x0000 }, /* R363 */
368 { 0x0000, 0x0000 }, /* R364 */
369 { 0x0000, 0x0000 }, /* R365 */
370 { 0x0000, 0x0000 }, /* R366 */
371 { 0x0000, 0x0000 }, /* R367 */
372 { 0x0000, 0x0000 }, /* R368 */
373 { 0x0000, 0x0000 }, /* R369 */
374 { 0x0000, 0x0000 }, /* R370 */
375 { 0x0000, 0x0000 }, /* R371 */
376 { 0x0000, 0x0000 }, /* R372 */
377 { 0x0000, 0x0000 }, /* R373 */
378 { 0x0000, 0x0000 }, /* R374 */
379 { 0x0000, 0x0000 }, /* R375 */
380 { 0x0000, 0x0000 }, /* R376 */
381 { 0x0000, 0x0000 }, /* R377 */
382 { 0x0000, 0x0000 }, /* R378 */
383 { 0x0000, 0x0000 }, /* R379 */
384 { 0x0000, 0x0000 }, /* R380 */
385 { 0x0000, 0x0000 }, /* R381 */
386 { 0x0000, 0x0000 }, /* R382 */
387 { 0x0000, 0x0000 }, /* R383 */
388 { 0x0000, 0x0000 }, /* R384 */
389 { 0x0000, 0x0000 }, /* R385 */
390 { 0x0000, 0x0000 }, /* R386 */
391 { 0x0000, 0x0000 }, /* R387 */
392 { 0x0000, 0x0000 }, /* R388 */
393 { 0x0000, 0x0000 }, /* R389 */
394 { 0x0000, 0x0000 }, /* R390 */
395 { 0x0000, 0x0000 }, /* R391 */
396 { 0x0000, 0x0000 }, /* R392 */
397 { 0x0000, 0x0000 }, /* R393 */
398 { 0x0000, 0x0000 }, /* R394 */
399 { 0x0000, 0x0000 }, /* R395 */
400 { 0x0000, 0x0000 }, /* R396 */
401 { 0x0000, 0x0000 }, /* R397 */
402 { 0x0000, 0x0000 }, /* R398 */
403 { 0x0000, 0x0000 }, /* R399 */
404 { 0x0000, 0x0000 }, /* R400 */
405 { 0x0000, 0x0000 }, /* R401 */
406 { 0x0000, 0x0000 }, /* R402 */
407 { 0x0000, 0x0000 }, /* R403 */
408 { 0x0000, 0x0000 }, /* R404 */
409 { 0x0000, 0x0000 }, /* R405 */
410 { 0x0000, 0x0000 }, /* R406 */
411 { 0x0000, 0x0000 }, /* R407 */
412 { 0x0000, 0x0000 }, /* R408 */
413 { 0x0000, 0x0000 }, /* R409 */
414 { 0x0000, 0x0000 }, /* R410 */
415 { 0x0000, 0x0000 }, /* R411 */
416 { 0x0000, 0x0000 }, /* R412 */
417 { 0x0000, 0x0000 }, /* R413 */
418 { 0x0000, 0x0000 }, /* R414 */
419 { 0x0000, 0x0000 }, /* R415 */
420 { 0x0000, 0x0000 }, /* R416 */
421 { 0x0000, 0x0000 }, /* R417 */
422 { 0x0000, 0x0000 }, /* R418 */
423 { 0x0000, 0x0000 }, /* R419 */
424 { 0x0000, 0x0000 }, /* R420 */
425 { 0x0000, 0x0000 }, /* R421 */
426 { 0x0000, 0x0000 }, /* R422 */
427 { 0x0000, 0x0000 }, /* R423 */
428 { 0x0000, 0x0000 }, /* R424 */
429 { 0x0000, 0x0000 }, /* R425 */
430 { 0x0000, 0x0000 }, /* R426 */
431 { 0x0000, 0x0000 }, /* R427 */
432 { 0x0000, 0x0000 }, /* R428 */
433 { 0x0000, 0x0000 }, /* R429 */
434 { 0x0000, 0x0000 }, /* R430 */
435 { 0x0000, 0x0000 }, /* R431 */
436 { 0x0000, 0x0000 }, /* R432 */
437 { 0x0000, 0x0000 }, /* R433 */
438 { 0x0000, 0x0000 }, /* R434 */
439 { 0x0000, 0x0000 }, /* R435 */
440 { 0x0000, 0x0000 }, /* R436 */
441 { 0x0000, 0x0000 }, /* R437 */
442 { 0x0000, 0x0000 }, /* R438 */
443 { 0x0000, 0x0000 }, /* R439 */
444 { 0x0000, 0x0000 }, /* R440 */
445 { 0x0000, 0x0000 }, /* R441 */
446 { 0x0000, 0x0000 }, /* R442 */
447 { 0x0000, 0x0000 }, /* R443 */
448 { 0x0000, 0x0000 }, /* R444 */
449 { 0x0000, 0x0000 }, /* R445 */
450 { 0x0000, 0x0000 }, /* R446 */
451 { 0x0000, 0x0000 }, /* R447 */
452 { 0x0000, 0x0000 }, /* R448 */
453 { 0x0000, 0x0000 }, /* R449 */
454 { 0x0000, 0x0000 }, /* R450 */
455 { 0x0000, 0x0000 }, /* R451 */
456 { 0x0000, 0x0000 }, /* R452 */
457 { 0x0000, 0x0000 }, /* R453 */
458 { 0x0000, 0x0000 }, /* R454 */
459 { 0x0000, 0x0000 }, /* R455 */
460 { 0x0000, 0x0000 }, /* R456 */
461 { 0x0000, 0x0000 }, /* R457 */
462 { 0x0000, 0x0000 }, /* R458 */
463 { 0x0000, 0x0000 }, /* R459 */
464 { 0x0000, 0x0000 }, /* R460 */
465 { 0x0000, 0x0000 }, /* R461 */
466 { 0x0000, 0x0000 }, /* R462 */
467 { 0x0000, 0x0000 }, /* R463 */
468 { 0x0000, 0x0000 }, /* R464 */
469 { 0x0000, 0x0000 }, /* R465 */
470 { 0x0000, 0x0000 }, /* R466 */
471 { 0x0000, 0x0000 }, /* R467 */
472 { 0x0000, 0x0000 }, /* R468 */
473 { 0x0000, 0x0000 }, /* R469 */
474 { 0x0000, 0x0000 }, /* R470 */
475 { 0x0000, 0x0000 }, /* R471 */
476 { 0x0000, 0x0000 }, /* R472 */
477 { 0x0000, 0x0000 }, /* R473 */
478 { 0x0000, 0x0000 }, /* R474 */
479 { 0x0000, 0x0000 }, /* R475 */
480 { 0x0000, 0x0000 }, /* R476 */
481 { 0x0000, 0x0000 }, /* R477 */
482 { 0x0000, 0x0000 }, /* R478 */
483 { 0x0000, 0x0000 }, /* R479 */
484 { 0x0000, 0x0000 }, /* R480 */
485 { 0x0000, 0x0000 }, /* R481 */
486 { 0x0000, 0x0000 }, /* R482 */
487 { 0x0000, 0x0000 }, /* R483 */
488 { 0x0000, 0x0000 }, /* R484 */
489 { 0x0000, 0x0000 }, /* R485 */
490 { 0x0000, 0x0000 }, /* R486 */
491 { 0x0000, 0x0000 }, /* R487 */
492 { 0x0000, 0x0000 }, /* R488 */
493 { 0x0000, 0x0000 }, /* R489 */
494 { 0x0000, 0x0000 }, /* R490 */
495 { 0x0000, 0x0000 }, /* R491 */
496 { 0x0000, 0x0000 }, /* R492 */
497 { 0x0000, 0x0000 }, /* R493 */
498 { 0x0000, 0x0000 }, /* R494 */
499 { 0x0000, 0x0000 }, /* R495 */
500 { 0x0000, 0x0000 }, /* R496 */
501 { 0x0000, 0x0000 }, /* R497 */
502 { 0x0000, 0x0000 }, /* R498 */
503 { 0x0000, 0x0000 }, /* R499 */
504 { 0x0000, 0x0000 }, /* R500 */
505 { 0x0000, 0x0000 }, /* R501 */
506 { 0x0000, 0x0000 }, /* R502 */
507 { 0x0000, 0x0000 }, /* R503 */
508 { 0x0000, 0x0000 }, /* R504 */
509 { 0x0000, 0x0000 }, /* R505 */
510 { 0x0000, 0x0000 }, /* R506 */
511 { 0x0000, 0x0000 }, /* R507 */
512 { 0x0000, 0x0000 }, /* R508 */
513 { 0x0000, 0x0000 }, /* R509 */
514 { 0x0000, 0x0000 }, /* R510 */
515 { 0x0000, 0x0000 }, /* R511 */
516 { 0x001F, 0x001F }, /* R512 - AIF1 Clocking (1) */
517 { 0x003F, 0x003F }, /* R513 - AIF1 Clocking (2) */
518 { 0x0000, 0x0000 }, /* R514 */
519 { 0x0000, 0x0000 }, /* R515 */
520 { 0x001F, 0x001F }, /* R516 - AIF2 Clocking (1) */
521 { 0x003F, 0x003F }, /* R517 - AIF2 Clocking (2) */
522 { 0x0000, 0x0000 }, /* R518 */
523 { 0x0000, 0x0000 }, /* R519 */
524 { 0x001F, 0x001F }, /* R520 - Clocking (1) */
525 { 0x0777, 0x0777 }, /* R521 - Clocking (2) */
526 { 0x0000, 0x0000 }, /* R522 */
527 { 0x0000, 0x0000 }, /* R523 */
528 { 0x0000, 0x0000 }, /* R524 */
529 { 0x0000, 0x0000 }, /* R525 */
530 { 0x0000, 0x0000 }, /* R526 */
531 { 0x0000, 0x0000 }, /* R527 */
532 { 0x00FF, 0x00FF }, /* R528 - AIF1 Rate */
533 { 0x00FF, 0x00FF }, /* R529 - AIF2 Rate */
534 { 0x000F, 0x0000 }, /* R530 - Rate Status */
535 { 0x0000, 0x0000 }, /* R531 */
536 { 0x0000, 0x0000 }, /* R532 */
537 { 0x0000, 0x0000 }, /* R533 */
538 { 0x0000, 0x0000 }, /* R534 */
539 { 0x0000, 0x0000 }, /* R535 */
540 { 0x0000, 0x0000 }, /* R536 */
541 { 0x0000, 0x0000 }, /* R537 */
542 { 0x0000, 0x0000 }, /* R538 */
543 { 0x0000, 0x0000 }, /* R539 */
544 { 0x0000, 0x0000 }, /* R540 */
545 { 0x0000, 0x0000 }, /* R541 */
546 { 0x0000, 0x0000 }, /* R542 */
547 { 0x0000, 0x0000 }, /* R543 */
548 { 0x0007, 0x0007 }, /* R544 - FLL1 Control (1) */
549 { 0x3F77, 0x3F77 }, /* R545 - FLL1 Control (2) */
550 { 0xFFFF, 0xFFFF }, /* R546 - FLL1 Control (3) */
551 { 0x7FEF, 0x7FEF }, /* R547 - FLL1 Control (4) */
552 { 0x1FDB, 0x1FDB }, /* R548 - FLL1 Control (5) */
553 { 0x0000, 0x0000 }, /* R549 */
554 { 0x0000, 0x0000 }, /* R550 */
555 { 0x0000, 0x0000 }, /* R551 */
556 { 0x0000, 0x0000 }, /* R552 */
557 { 0x0000, 0x0000 }, /* R553 */
558 { 0x0000, 0x0000 }, /* R554 */
559 { 0x0000, 0x0000 }, /* R555 */
560 { 0x0000, 0x0000 }, /* R556 */
561 { 0x0000, 0x0000 }, /* R557 */
562 { 0x0000, 0x0000 }, /* R558 */
563 { 0x0000, 0x0000 }, /* R559 */
564 { 0x0000, 0x0000 }, /* R560 */
565 { 0x0000, 0x0000 }, /* R561 */
566 { 0x0000, 0x0000 }, /* R562 */
567 { 0x0000, 0x0000 }, /* R563 */
568 { 0x0000, 0x0000 }, /* R564 */
569 { 0x0000, 0x0000 }, /* R565 */
570 { 0x0000, 0x0000 }, /* R566 */
571 { 0x0000, 0x0000 }, /* R567 */
572 { 0x0000, 0x0000 }, /* R568 */
573 { 0x0000, 0x0000 }, /* R569 */
574 { 0x0000, 0x0000 }, /* R570 */
575 { 0x0000, 0x0000 }, /* R571 */
576 { 0x0000, 0x0000 }, /* R572 */
577 { 0x0000, 0x0000 }, /* R573 */
578 { 0x0000, 0x0000 }, /* R574 */
579 { 0x0000, 0x0000 }, /* R575 */
580 { 0x0007, 0x0007 }, /* R576 - FLL2 Control (1) */
581 { 0x3F77, 0x3F77 }, /* R577 - FLL2 Control (2) */
582 { 0xFFFF, 0xFFFF }, /* R578 - FLL2 Control (3) */
583 { 0x7FEF, 0x7FEF }, /* R579 - FLL2 Control (4) */
584 { 0x1FDB, 0x1FDB }, /* R580 - FLL2 Control (5) */
585 { 0x0000, 0x0000 }, /* R581 */
586 { 0x0000, 0x0000 }, /* R582 */
587 { 0x0000, 0x0000 }, /* R583 */
588 { 0x0000, 0x0000 }, /* R584 */
589 { 0x0000, 0x0000 }, /* R585 */
590 { 0x0000, 0x0000 }, /* R586 */
591 { 0x0000, 0x0000 }, /* R587 */
592 { 0x0000, 0x0000 }, /* R588 */
593 { 0x0000, 0x0000 }, /* R589 */
594 { 0x0000, 0x0000 }, /* R590 */
595 { 0x0000, 0x0000 }, /* R591 */
596 { 0x0000, 0x0000 }, /* R592 */
597 { 0x0000, 0x0000 }, /* R593 */
598 { 0x0000, 0x0000 }, /* R594 */
599 { 0x0000, 0x0000 }, /* R595 */
600 { 0x0000, 0x0000 }, /* R596 */
601 { 0x0000, 0x0000 }, /* R597 */
602 { 0x0000, 0x0000 }, /* R598 */
603 { 0x0000, 0x0000 }, /* R599 */
604 { 0x0000, 0x0000 }, /* R600 */
605 { 0x0000, 0x0000 }, /* R601 */
606 { 0x0000, 0x0000 }, /* R602 */
607 { 0x0000, 0x0000 }, /* R603 */
608 { 0x0000, 0x0000 }, /* R604 */
609 { 0x0000, 0x0000 }, /* R605 */
610 { 0x0000, 0x0000 }, /* R606 */
611 { 0x0000, 0x0000 }, /* R607 */
612 { 0x0000, 0x0000 }, /* R608 */
613 { 0x0000, 0x0000 }, /* R609 */
614 { 0x0000, 0x0000 }, /* R610 */
615 { 0x0000, 0x0000 }, /* R611 */
616 { 0x0000, 0x0000 }, /* R612 */
617 { 0x0000, 0x0000 }, /* R613 */
618 { 0x0000, 0x0000 }, /* R614 */
619 { 0x0000, 0x0000 }, /* R615 */
620 { 0x0000, 0x0000 }, /* R616 */
621 { 0x0000, 0x0000 }, /* R617 */
622 { 0x0000, 0x0000 }, /* R618 */
623 { 0x0000, 0x0000 }, /* R619 */
624 { 0x0000, 0x0000 }, /* R620 */
625 { 0x0000, 0x0000 }, /* R621 */
626 { 0x0000, 0x0000 }, /* R622 */
627 { 0x0000, 0x0000 }, /* R623 */
628 { 0x0000, 0x0000 }, /* R624 */
629 { 0x0000, 0x0000 }, /* R625 */
630 { 0x0000, 0x0000 }, /* R626 */
631 { 0x0000, 0x0000 }, /* R627 */
632 { 0x0000, 0x0000 }, /* R628 */
633 { 0x0000, 0x0000 }, /* R629 */
634 { 0x0000, 0x0000 }, /* R630 */
635 { 0x0000, 0x0000 }, /* R631 */
636 { 0x0000, 0x0000 }, /* R632 */
637 { 0x0000, 0x0000 }, /* R633 */
638 { 0x0000, 0x0000 }, /* R634 */
639 { 0x0000, 0x0000 }, /* R635 */
640 { 0x0000, 0x0000 }, /* R636 */
641 { 0x0000, 0x0000 }, /* R637 */
642 { 0x0000, 0x0000 }, /* R638 */
643 { 0x0000, 0x0000 }, /* R639 */
644 { 0x0000, 0x0000 }, /* R640 */
645 { 0x0000, 0x0000 }, /* R641 */
646 { 0x0000, 0x0000 }, /* R642 */
647 { 0x0000, 0x0000 }, /* R643 */
648 { 0x0000, 0x0000 }, /* R644 */
649 { 0x0000, 0x0000 }, /* R645 */
650 { 0x0000, 0x0000 }, /* R646 */
651 { 0x0000, 0x0000 }, /* R647 */
652 { 0x0000, 0x0000 }, /* R648 */
653 { 0x0000, 0x0000 }, /* R649 */
654 { 0x0000, 0x0000 }, /* R650 */
655 { 0x0000, 0x0000 }, /* R651 */
656 { 0x0000, 0x0000 }, /* R652 */
657 { 0x0000, 0x0000 }, /* R653 */
658 { 0x0000, 0x0000 }, /* R654 */
659 { 0x0000, 0x0000 }, /* R655 */
660 { 0x0000, 0x0000 }, /* R656 */
661 { 0x0000, 0x0000 }, /* R657 */
662 { 0x0000, 0x0000 }, /* R658 */
663 { 0x0000, 0x0000 }, /* R659 */
664 { 0x0000, 0x0000 }, /* R660 */
665 { 0x0000, 0x0000 }, /* R661 */
666 { 0x0000, 0x0000 }, /* R662 */
667 { 0x0000, 0x0000 }, /* R663 */
668 { 0x0000, 0x0000 }, /* R664 */
669 { 0x0000, 0x0000 }, /* R665 */
670 { 0x0000, 0x0000 }, /* R666 */
671 { 0x0000, 0x0000 }, /* R667 */
672 { 0x0000, 0x0000 }, /* R668 */
673 { 0x0000, 0x0000 }, /* R669 */
674 { 0x0000, 0x0000 }, /* R670 */
675 { 0x0000, 0x0000 }, /* R671 */
676 { 0x0000, 0x0000 }, /* R672 */
677 { 0x0000, 0x0000 }, /* R673 */
678 { 0x0000, 0x0000 }, /* R674 */
679 { 0x0000, 0x0000 }, /* R675 */
680 { 0x0000, 0x0000 }, /* R676 */
681 { 0x0000, 0x0000 }, /* R677 */
682 { 0x0000, 0x0000 }, /* R678 */
683 { 0x0000, 0x0000 }, /* R679 */
684 { 0x0000, 0x0000 }, /* R680 */
685 { 0x0000, 0x0000 }, /* R681 */
686 { 0x0000, 0x0000 }, /* R682 */
687 { 0x0000, 0x0000 }, /* R683 */
688 { 0x0000, 0x0000 }, /* R684 */
689 { 0x0000, 0x0000 }, /* R685 */
690 { 0x0000, 0x0000 }, /* R686 */
691 { 0x0000, 0x0000 }, /* R687 */
692 { 0x0000, 0x0000 }, /* R688 */
693 { 0x0000, 0x0000 }, /* R689 */
694 { 0x0000, 0x0000 }, /* R690 */
695 { 0x0000, 0x0000 }, /* R691 */
696 { 0x0000, 0x0000 }, /* R692 */
697 { 0x0000, 0x0000 }, /* R693 */
698 { 0x0000, 0x0000 }, /* R694 */
699 { 0x0000, 0x0000 }, /* R695 */
700 { 0x0000, 0x0000 }, /* R696 */
701 { 0x0000, 0x0000 }, /* R697 */
702 { 0x0000, 0x0000 }, /* R698 */
703 { 0x0000, 0x0000 }, /* R699 */
704 { 0x0000, 0x0000 }, /* R700 */
705 { 0x0000, 0x0000 }, /* R701 */
706 { 0x0000, 0x0000 }, /* R702 */
707 { 0x0000, 0x0000 }, /* R703 */
708 { 0x0000, 0x0000 }, /* R704 */
709 { 0x0000, 0x0000 }, /* R705 */
710 { 0x0000, 0x0000 }, /* R706 */
711 { 0x0000, 0x0000 }, /* R707 */
712 { 0x0000, 0x0000 }, /* R708 */
713 { 0x0000, 0x0000 }, /* R709 */
714 { 0x0000, 0x0000 }, /* R710 */
715 { 0x0000, 0x0000 }, /* R711 */
716 { 0x0000, 0x0000 }, /* R712 */
717 { 0x0000, 0x0000 }, /* R713 */
718 { 0x0000, 0x0000 }, /* R714 */
719 { 0x0000, 0x0000 }, /* R715 */
720 { 0x0000, 0x0000 }, /* R716 */
721 { 0x0000, 0x0000 }, /* R717 */
722 { 0x0000, 0x0000 }, /* R718 */
723 { 0x0000, 0x0000 }, /* R719 */
724 { 0x0000, 0x0000 }, /* R720 */
725 { 0x0000, 0x0000 }, /* R721 */
726 { 0x0000, 0x0000 }, /* R722 */
727 { 0x0000, 0x0000 }, /* R723 */
728 { 0x0000, 0x0000 }, /* R724 */
729 { 0x0000, 0x0000 }, /* R725 */
730 { 0x0000, 0x0000 }, /* R726 */
731 { 0x0000, 0x0000 }, /* R727 */
732 { 0x0000, 0x0000 }, /* R728 */
733 { 0x0000, 0x0000 }, /* R729 */
734 { 0x0000, 0x0000 }, /* R730 */
735 { 0x0000, 0x0000 }, /* R731 */
736 { 0x0000, 0x0000 }, /* R732 */
737 { 0x0000, 0x0000 }, /* R733 */
738 { 0x0000, 0x0000 }, /* R734 */
739 { 0x0000, 0x0000 }, /* R735 */
740 { 0x0000, 0x0000 }, /* R736 */
741 { 0x0000, 0x0000 }, /* R737 */
742 { 0x0000, 0x0000 }, /* R738 */
743 { 0x0000, 0x0000 }, /* R739 */
744 { 0x0000, 0x0000 }, /* R740 */
745 { 0x0000, 0x0000 }, /* R741 */
746 { 0x0000, 0x0000 }, /* R742 */
747 { 0x0000, 0x0000 }, /* R743 */
748 { 0x0000, 0x0000 }, /* R744 */
749 { 0x0000, 0x0000 }, /* R745 */
750 { 0x0000, 0x0000 }, /* R746 */
751 { 0x0000, 0x0000 }, /* R747 */
752 { 0x0000, 0x0000 }, /* R748 */
753 { 0x0000, 0x0000 }, /* R749 */
754 { 0x0000, 0x0000 }, /* R750 */
755 { 0x0000, 0x0000 }, /* R751 */
756 { 0x0000, 0x0000 }, /* R752 */
757 { 0x0000, 0x0000 }, /* R753 */
758 { 0x0000, 0x0000 }, /* R754 */
759 { 0x0000, 0x0000 }, /* R755 */
760 { 0x0000, 0x0000 }, /* R756 */
761 { 0x0000, 0x0000 }, /* R757 */
762 { 0x0000, 0x0000 }, /* R758 */
763 { 0x0000, 0x0000 }, /* R759 */
764 { 0x0000, 0x0000 }, /* R760 */
765 { 0x0000, 0x0000 }, /* R761 */
766 { 0x0000, 0x0000 }, /* R762 */
767 { 0x0000, 0x0000 }, /* R763 */
768 { 0x0000, 0x0000 }, /* R764 */
769 { 0x0000, 0x0000 }, /* R765 */
770 { 0x0000, 0x0000 }, /* R766 */
771 { 0x0000, 0x0000 }, /* R767 */
772 { 0xE1F8, 0xE1F8 }, /* R768 - AIF1 Control (1) */
773 { 0xCD1F, 0xCD1F }, /* R769 - AIF1 Control (2) */
774 { 0xF000, 0xF000 }, /* R770 - AIF1 Master/Slave */
775 { 0x01F0, 0x01F0 }, /* R771 - AIF1 BCLK */
776 { 0x0FFF, 0x0FFF }, /* R772 - AIF1ADC LRCLK */
777 { 0x0FFF, 0x0FFF }, /* R773 - AIF1DAC LRCLK */
778 { 0x0003, 0x0003 }, /* R774 - AIF1DAC Data */
779 { 0x0003, 0x0003 }, /* R775 - AIF1ADC Data */
780 { 0x0000, 0x0000 }, /* R776 */
781 { 0x0000, 0x0000 }, /* R777 */
782 { 0x0000, 0x0000 }, /* R778 */
783 { 0x0000, 0x0000 }, /* R779 */
784 { 0x0000, 0x0000 }, /* R780 */
785 { 0x0000, 0x0000 }, /* R781 */
786 { 0x0000, 0x0000 }, /* R782 */
787 { 0x0000, 0x0000 }, /* R783 */
788 { 0xF1F8, 0xF1F8 }, /* R784 - AIF2 Control (1) */
789 { 0xFD1F, 0xFD1F }, /* R785 - AIF2 Control (2) */
790 { 0xF000, 0xF000 }, /* R786 - AIF2 Master/Slave */
791 { 0x01F0, 0x01F0 }, /* R787 - AIF2 BCLK */
792 { 0x0FFF, 0x0FFF }, /* R788 - AIF2ADC LRCLK */
793 { 0x0FFF, 0x0FFF }, /* R789 - AIF2DAC LRCLK */
794 { 0x0003, 0x0003 }, /* R790 - AIF2DAC Data */
795 { 0x0003, 0x0003 }, /* R791 - AIF2ADC Data */
796 { 0x0000, 0x0000 }, /* R792 */
797 { 0x0000, 0x0000 }, /* R793 */
798 { 0x0000, 0x0000 }, /* R794 */
799 { 0x0000, 0x0000 }, /* R795 */
800 { 0x0000, 0x0000 }, /* R796 */
801 { 0x0000, 0x0000 }, /* R797 */
802 { 0x0000, 0x0000 }, /* R798 */
803 { 0x0000, 0x0000 }, /* R799 */
804 { 0x0000, 0x0000 }, /* R800 */
805 { 0x0000, 0x0000 }, /* R801 */
806 { 0x0000, 0x0000 }, /* R802 */
807 { 0x0000, 0x0000 }, /* R803 */
808 { 0x0000, 0x0000 }, /* R804 */
809 { 0x0000, 0x0000 }, /* R805 */
810 { 0x0000, 0x0000 }, /* R806 */
811 { 0x0000, 0x0000 }, /* R807 */
812 { 0x0000, 0x0000 }, /* R808 */
813 { 0x0000, 0x0000 }, /* R809 */
814 { 0x0000, 0x0000 }, /* R810 */
815 { 0x0000, 0x0000 }, /* R811 */
816 { 0x0000, 0x0000 }, /* R812 */
817 { 0x0000, 0x0000 }, /* R813 */
818 { 0x0000, 0x0000 }, /* R814 */
819 { 0x0000, 0x0000 }, /* R815 */
820 { 0x0000, 0x0000 }, /* R816 */
821 { 0x0000, 0x0000 }, /* R817 */
822 { 0x0000, 0x0000 }, /* R818 */
823 { 0x0000, 0x0000 }, /* R819 */
824 { 0x0000, 0x0000 }, /* R820 */
825 { 0x0000, 0x0000 }, /* R821 */
826 { 0x0000, 0x0000 }, /* R822 */
827 { 0x0000, 0x0000 }, /* R823 */
828 { 0x0000, 0x0000 }, /* R824 */
829 { 0x0000, 0x0000 }, /* R825 */
830 { 0x0000, 0x0000 }, /* R826 */
831 { 0x0000, 0x0000 }, /* R827 */
832 { 0x0000, 0x0000 }, /* R828 */
833 { 0x0000, 0x0000 }, /* R829 */
834 { 0x0000, 0x0000 }, /* R830 */
835 { 0x0000, 0x0000 }, /* R831 */
836 { 0x0000, 0x0000 }, /* R832 */
837 { 0x0000, 0x0000 }, /* R833 */
838 { 0x0000, 0x0000 }, /* R834 */
839 { 0x0000, 0x0000 }, /* R835 */
840 { 0x0000, 0x0000 }, /* R836 */
841 { 0x0000, 0x0000 }, /* R837 */
842 { 0x0000, 0x0000 }, /* R838 */
843 { 0x0000, 0x0000 }, /* R839 */
844 { 0x0000, 0x0000 }, /* R840 */
845 { 0x0000, 0x0000 }, /* R841 */
846 { 0x0000, 0x0000 }, /* R842 */
847 { 0x0000, 0x0000 }, /* R843 */
848 { 0x0000, 0x0000 }, /* R844 */
849 { 0x0000, 0x0000 }, /* R845 */
850 { 0x0000, 0x0000 }, /* R846 */
851 { 0x0000, 0x0000 }, /* R847 */
852 { 0x0000, 0x0000 }, /* R848 */
853 { 0x0000, 0x0000 }, /* R849 */
854 { 0x0000, 0x0000 }, /* R850 */
855 { 0x0000, 0x0000 }, /* R851 */
856 { 0x0000, 0x0000 }, /* R852 */
857 { 0x0000, 0x0000 }, /* R853 */
858 { 0x0000, 0x0000 }, /* R854 */
859 { 0x0000, 0x0000 }, /* R855 */
860 { 0x0000, 0x0000 }, /* R856 */
861 { 0x0000, 0x0000 }, /* R857 */
862 { 0x0000, 0x0000 }, /* R858 */
863 { 0x0000, 0x0000 }, /* R859 */
864 { 0x0000, 0x0000 }, /* R860 */
865 { 0x0000, 0x0000 }, /* R861 */
866 { 0x0000, 0x0000 }, /* R862 */
867 { 0x0000, 0x0000 }, /* R863 */
868 { 0x0000, 0x0000 }, /* R864 */
869 { 0x0000, 0x0000 }, /* R865 */
870 { 0x0000, 0x0000 }, /* R866 */
871 { 0x0000, 0x0000 }, /* R867 */
872 { 0x0000, 0x0000 }, /* R868 */
873 { 0x0000, 0x0000 }, /* R869 */
874 { 0x0000, 0x0000 }, /* R870 */
875 { 0x0000, 0x0000 }, /* R871 */
876 { 0x0000, 0x0000 }, /* R872 */
877 { 0x0000, 0x0000 }, /* R873 */
878 { 0x0000, 0x0000 }, /* R874 */
879 { 0x0000, 0x0000 }, /* R875 */
880 { 0x0000, 0x0000 }, /* R876 */
881 { 0x0000, 0x0000 }, /* R877 */
882 { 0x0000, 0x0000 }, /* R878 */
883 { 0x0000, 0x0000 }, /* R879 */
884 { 0x0000, 0x0000 }, /* R880 */
885 { 0x0000, 0x0000 }, /* R881 */
886 { 0x0000, 0x0000 }, /* R882 */
887 { 0x0000, 0x0000 }, /* R883 */
888 { 0x0000, 0x0000 }, /* R884 */
889 { 0x0000, 0x0000 }, /* R885 */
890 { 0x0000, 0x0000 }, /* R886 */
891 { 0x0000, 0x0000 }, /* R887 */
892 { 0x0000, 0x0000 }, /* R888 */
893 { 0x0000, 0x0000 }, /* R889 */
894 { 0x0000, 0x0000 }, /* R890 */
895 { 0x0000, 0x0000 }, /* R891 */
896 { 0x0000, 0x0000 }, /* R892 */
897 { 0x0000, 0x0000 }, /* R893 */
898 { 0x0000, 0x0000 }, /* R894 */
899 { 0x0000, 0x0000 }, /* R895 */
900 { 0x0000, 0x0000 }, /* R896 */
901 { 0x0000, 0x0000 }, /* R897 */
902 { 0x0000, 0x0000 }, /* R898 */
903 { 0x0000, 0x0000 }, /* R899 */
904 { 0x0000, 0x0000 }, /* R900 */
905 { 0x0000, 0x0000 }, /* R901 */
906 { 0x0000, 0x0000 }, /* R902 */
907 { 0x0000, 0x0000 }, /* R903 */
908 { 0x0000, 0x0000 }, /* R904 */
909 { 0x0000, 0x0000 }, /* R905 */
910 { 0x0000, 0x0000 }, /* R906 */
911 { 0x0000, 0x0000 }, /* R907 */
912 { 0x0000, 0x0000 }, /* R908 */
913 { 0x0000, 0x0000 }, /* R909 */
914 { 0x0000, 0x0000 }, /* R910 */
915 { 0x0000, 0x0000 }, /* R911 */
916 { 0x0000, 0x0000 }, /* R912 */
917 { 0x0000, 0x0000 }, /* R913 */
918 { 0x0000, 0x0000 }, /* R914 */
919 { 0x0000, 0x0000 }, /* R915 */
920 { 0x0000, 0x0000 }, /* R916 */
921 { 0x0000, 0x0000 }, /* R917 */
922 { 0x0000, 0x0000 }, /* R918 */
923 { 0x0000, 0x0000 }, /* R919 */
924 { 0x0000, 0x0000 }, /* R920 */
925 { 0x0000, 0x0000 }, /* R921 */
926 { 0x0000, 0x0000 }, /* R922 */
927 { 0x0000, 0x0000 }, /* R923 */
928 { 0x0000, 0x0000 }, /* R924 */
929 { 0x0000, 0x0000 }, /* R925 */
930 { 0x0000, 0x0000 }, /* R926 */
931 { 0x0000, 0x0000 }, /* R927 */
932 { 0x0000, 0x0000 }, /* R928 */
933 { 0x0000, 0x0000 }, /* R929 */
934 { 0x0000, 0x0000 }, /* R930 */
935 { 0x0000, 0x0000 }, /* R931 */
936 { 0x0000, 0x0000 }, /* R932 */
937 { 0x0000, 0x0000 }, /* R933 */
938 { 0x0000, 0x0000 }, /* R934 */
939 { 0x0000, 0x0000 }, /* R935 */
940 { 0x0000, 0x0000 }, /* R936 */
941 { 0x0000, 0x0000 }, /* R937 */
942 { 0x0000, 0x0000 }, /* R938 */
943 { 0x0000, 0x0000 }, /* R939 */
944 { 0x0000, 0x0000 }, /* R940 */
945 { 0x0000, 0x0000 }, /* R941 */
946 { 0x0000, 0x0000 }, /* R942 */
947 { 0x0000, 0x0000 }, /* R943 */
948 { 0x0000, 0x0000 }, /* R944 */
949 { 0x0000, 0x0000 }, /* R945 */
950 { 0x0000, 0x0000 }, /* R946 */
951 { 0x0000, 0x0000 }, /* R947 */
952 { 0x0000, 0x0000 }, /* R948 */
953 { 0x0000, 0x0000 }, /* R949 */
954 { 0x0000, 0x0000 }, /* R950 */
955 { 0x0000, 0x0000 }, /* R951 */
956 { 0x0000, 0x0000 }, /* R952 */
957 { 0x0000, 0x0000 }, /* R953 */
958 { 0x0000, 0x0000 }, /* R954 */
959 { 0x0000, 0x0000 }, /* R955 */
960 { 0x0000, 0x0000 }, /* R956 */
961 { 0x0000, 0x0000 }, /* R957 */
962 { 0x0000, 0x0000 }, /* R958 */
963 { 0x0000, 0x0000 }, /* R959 */
964 { 0x0000, 0x0000 }, /* R960 */
965 { 0x0000, 0x0000 }, /* R961 */
966 { 0x0000, 0x0000 }, /* R962 */
967 { 0x0000, 0x0000 }, /* R963 */
968 { 0x0000, 0x0000 }, /* R964 */
969 { 0x0000, 0x0000 }, /* R965 */
970 { 0x0000, 0x0000 }, /* R966 */
971 { 0x0000, 0x0000 }, /* R967 */
972 { 0x0000, 0x0000 }, /* R968 */
973 { 0x0000, 0x0000 }, /* R969 */
974 { 0x0000, 0x0000 }, /* R970 */
975 { 0x0000, 0x0000 }, /* R971 */
976 { 0x0000, 0x0000 }, /* R972 */
977 { 0x0000, 0x0000 }, /* R973 */
978 { 0x0000, 0x0000 }, /* R974 */
979 { 0x0000, 0x0000 }, /* R975 */
980 { 0x0000, 0x0000 }, /* R976 */
981 { 0x0000, 0x0000 }, /* R977 */
982 { 0x0000, 0x0000 }, /* R978 */
983 { 0x0000, 0x0000 }, /* R979 */
984 { 0x0000, 0x0000 }, /* R980 */
985 { 0x0000, 0x0000 }, /* R981 */
986 { 0x0000, 0x0000 }, /* R982 */
987 { 0x0000, 0x0000 }, /* R983 */
988 { 0x0000, 0x0000 }, /* R984 */
989 { 0x0000, 0x0000 }, /* R985 */
990 { 0x0000, 0x0000 }, /* R986 */
991 { 0x0000, 0x0000 }, /* R987 */
992 { 0x0000, 0x0000 }, /* R988 */
993 { 0x0000, 0x0000 }, /* R989 */
994 { 0x0000, 0x0000 }, /* R990 */
995 { 0x0000, 0x0000 }, /* R991 */
996 { 0x0000, 0x0000 }, /* R992 */
997 { 0x0000, 0x0000 }, /* R993 */
998 { 0x0000, 0x0000 }, /* R994 */
999 { 0x0000, 0x0000 }, /* R995 */
1000 { 0x0000, 0x0000 }, /* R996 */
1001 { 0x0000, 0x0000 }, /* R997 */
1002 { 0x0000, 0x0000 }, /* R998 */
1003 { 0x0000, 0x0000 }, /* R999 */
1004 { 0x0000, 0x0000 }, /* R1000 */
1005 { 0x0000, 0x0000 }, /* R1001 */
1006 { 0x0000, 0x0000 }, /* R1002 */
1007 { 0x0000, 0x0000 }, /* R1003 */
1008 { 0x0000, 0x0000 }, /* R1004 */
1009 { 0x0000, 0x0000 }, /* R1005 */
1010 { 0x0000, 0x0000 }, /* R1006 */
1011 { 0x0000, 0x0000 }, /* R1007 */
1012 { 0x0000, 0x0000 }, /* R1008 */
1013 { 0x0000, 0x0000 }, /* R1009 */
1014 { 0x0000, 0x0000 }, /* R1010 */
1015 { 0x0000, 0x0000 }, /* R1011 */
1016 { 0x0000, 0x0000 }, /* R1012 */
1017 { 0x0000, 0x0000 }, /* R1013 */
1018 { 0x0000, 0x0000 }, /* R1014 */
1019 { 0x0000, 0x0000 }, /* R1015 */
1020 { 0x0000, 0x0000 }, /* R1016 */
1021 { 0x0000, 0x0000 }, /* R1017 */
1022 { 0x0000, 0x0000 }, /* R1018 */
1023 { 0x0000, 0x0000 }, /* R1019 */
1024 { 0x0000, 0x0000 }, /* R1020 */
1025 { 0x0000, 0x0000 }, /* R1021 */
1026 { 0x0000, 0x0000 }, /* R1022 */
1027 { 0x0000, 0x0000 }, /* R1023 */
1028 { 0x00FF, 0x01FF }, /* R1024 - AIF1 ADC1 Left Volume */
1029 { 0x00FF, 0x01FF }, /* R1025 - AIF1 ADC1 Right Volume */
1030 { 0x00FF, 0x01FF }, /* R1026 - AIF1 DAC1 Left Volume */
1031 { 0x00FF, 0x01FF }, /* R1027 - AIF1 DAC1 Right Volume */
1032 { 0x00FF, 0x01FF }, /* R1028 - AIF1 ADC2 Left Volume */
1033 { 0x00FF, 0x01FF }, /* R1029 - AIF1 ADC2 Right Volume */
1034 { 0x00FF, 0x01FF }, /* R1030 - AIF1 DAC2 Left Volume */
1035 { 0x00FF, 0x01FF }, /* R1031 - AIF1 DAC2 Right Volume */
1036 { 0x0000, 0x0000 }, /* R1032 */
1037 { 0x0000, 0x0000 }, /* R1033 */
1038 { 0x0000, 0x0000 }, /* R1034 */
1039 { 0x0000, 0x0000 }, /* R1035 */
1040 { 0x0000, 0x0000 }, /* R1036 */
1041 { 0x0000, 0x0000 }, /* R1037 */
1042 { 0x0000, 0x0000 }, /* R1038 */
1043 { 0x0000, 0x0000 }, /* R1039 */
1044 { 0xF800, 0xF800 }, /* R1040 - AIF1 ADC1 Filters */
1045 { 0x7800, 0x7800 }, /* R1041 - AIF1 ADC2 Filters */
1046 { 0x0000, 0x0000 }, /* R1042 */
1047 { 0x0000, 0x0000 }, /* R1043 */
1048 { 0x0000, 0x0000 }, /* R1044 */
1049 { 0x0000, 0x0000 }, /* R1045 */
1050 { 0x0000, 0x0000 }, /* R1046 */
1051 { 0x0000, 0x0000 }, /* R1047 */
1052 { 0x0000, 0x0000 }, /* R1048 */
1053 { 0x0000, 0x0000 }, /* R1049 */
1054 { 0x0000, 0x0000 }, /* R1050 */
1055 { 0x0000, 0x0000 }, /* R1051 */
1056 { 0x0000, 0x0000 }, /* R1052 */
1057 { 0x0000, 0x0000 }, /* R1053 */
1058 { 0x0000, 0x0000 }, /* R1054 */
1059 { 0x0000, 0x0000 }, /* R1055 */
1060 { 0x02B6, 0x02B6 }, /* R1056 - AIF1 DAC1 Filters (1) */
1061 { 0x3F00, 0x3F00 }, /* R1057 - AIF1 DAC1 Filters (2) */
1062 { 0x02B6, 0x02B6 }, /* R1058 - AIF1 DAC2 Filters (1) */
1063 { 0x3F00, 0x3F00 }, /* R1059 - AIF1 DAC2 Filters (2) */
1064 { 0x0000, 0x0000 }, /* R1060 */
1065 { 0x0000, 0x0000 }, /* R1061 */
1066 { 0x0000, 0x0000 }, /* R1062 */
1067 { 0x0000, 0x0000 }, /* R1063 */
1068 { 0x0000, 0x0000 }, /* R1064 */
1069 { 0x0000, 0x0000 }, /* R1065 */
1070 { 0x0000, 0x0000 }, /* R1066 */
1071 { 0x0000, 0x0000 }, /* R1067 */
1072 { 0x0000, 0x0000 }, /* R1068 */
1073 { 0x0000, 0x0000 }, /* R1069 */
1074 { 0x0000, 0x0000 }, /* R1070 */
1075 { 0x0000, 0x0000 }, /* R1071 */
1076 { 0x006F, 0x006F }, /* R1072 - AIF1 DAC1 Noise Gate */
1077 { 0x006F, 0x006F }, /* R1073 - AIF1 DAC2 Noise Gate */
1078 { 0x0000, 0x0000 }, /* R1074 */
1079 { 0x0000, 0x0000 }, /* R1075 */
1080 { 0x0000, 0x0000 }, /* R1076 */
1081 { 0x0000, 0x0000 }, /* R1077 */
1082 { 0x0000, 0x0000 }, /* R1078 */
1083 { 0x0000, 0x0000 }, /* R1079 */
1084 { 0x0000, 0x0000 }, /* R1080 */
1085 { 0x0000, 0x0000 }, /* R1081 */
1086 { 0x0000, 0x0000 }, /* R1082 */
1087 { 0x0000, 0x0000 }, /* R1083 */
1088 { 0x0000, 0x0000 }, /* R1084 */
1089 { 0x0000, 0x0000 }, /* R1085 */
1090 { 0x0000, 0x0000 }, /* R1086 */
1091 { 0x0000, 0x0000 }, /* R1087 */
1092 { 0xFFFF, 0xFFFF }, /* R1088 - AIF1 DRC1 (1) */
1093 { 0x1FFF, 0x1FFF }, /* R1089 - AIF1 DRC1 (2) */
1094 { 0xFFFF, 0xFFFF }, /* R1090 - AIF1 DRC1 (3) */
1095 { 0x07FF, 0x07FF }, /* R1091 - AIF1 DRC1 (4) */
1096 { 0x03FF, 0x03FF }, /* R1092 - AIF1 DRC1 (5) */
1097 { 0x0000, 0x0000 }, /* R1093 */
1098 { 0x0000, 0x0000 }, /* R1094 */
1099 { 0x0000, 0x0000 }, /* R1095 */
1100 { 0x0000, 0x0000 }, /* R1096 */
1101 { 0x0000, 0x0000 }, /* R1097 */
1102 { 0x0000, 0x0000 }, /* R1098 */
1103 { 0x0000, 0x0000 }, /* R1099 */
1104 { 0x0000, 0x0000 }, /* R1100 */
1105 { 0x0000, 0x0000 }, /* R1101 */
1106 { 0x0000, 0x0000 }, /* R1102 */
1107 { 0x0000, 0x0000 }, /* R1103 */
1108 { 0xFFFF, 0xFFFF }, /* R1104 - AIF1 DRC2 (1) */
1109 { 0x1FFF, 0x1FFF }, /* R1105 - AIF1 DRC2 (2) */
1110 { 0xFFFF, 0xFFFF }, /* R1106 - AIF1 DRC2 (3) */
1111 { 0x07FF, 0x07FF }, /* R1107 - AIF1 DRC2 (4) */
1112 { 0x03FF, 0x03FF }, /* R1108 - AIF1 DRC2 (5) */
1113 { 0x0000, 0x0000 }, /* R1109 */
1114 { 0x0000, 0x0000 }, /* R1110 */
1115 { 0x0000, 0x0000 }, /* R1111 */
1116 { 0x0000, 0x0000 }, /* R1112 */
1117 { 0x0000, 0x0000 }, /* R1113 */
1118 { 0x0000, 0x0000 }, /* R1114 */
1119 { 0x0000, 0x0000 }, /* R1115 */
1120 { 0x0000, 0x0000 }, /* R1116 */
1121 { 0x0000, 0x0000 }, /* R1117 */
1122 { 0x0000, 0x0000 }, /* R1118 */
1123 { 0x0000, 0x0000 }, /* R1119 */
1124 { 0x0000, 0x0000 }, /* R1120 */
1125 { 0x0000, 0x0000 }, /* R1121 */
1126 { 0x0000, 0x0000 }, /* R1122 */
1127 { 0x0000, 0x0000 }, /* R1123 */
1128 { 0x0000, 0x0000 }, /* R1124 */
1129 { 0x0000, 0x0000 }, /* R1125 */
1130 { 0x0000, 0x0000 }, /* R1126 */
1131 { 0x0000, 0x0000 }, /* R1127 */
1132 { 0x0000, 0x0000 }, /* R1128 */
1133 { 0x0000, 0x0000 }, /* R1129 */
1134 { 0x0000, 0x0000 }, /* R1130 */
1135 { 0x0000, 0x0000 }, /* R1131 */
1136 { 0x0000, 0x0000 }, /* R1132 */
1137 { 0x0000, 0x0000 }, /* R1133 */
1138 { 0x0000, 0x0000 }, /* R1134 */
1139 { 0x0000, 0x0000 }, /* R1135 */
1140 { 0x0000, 0x0000 }, /* R1136 */
1141 { 0x0000, 0x0000 }, /* R1137 */
1142 { 0x0000, 0x0000 }, /* R1138 */
1143 { 0x0000, 0x0000 }, /* R1139 */
1144 { 0x0000, 0x0000 }, /* R1140 */
1145 { 0x0000, 0x0000 }, /* R1141 */
1146 { 0x0000, 0x0000 }, /* R1142 */
1147 { 0x0000, 0x0000 }, /* R1143 */
1148 { 0x0000, 0x0000 }, /* R1144 */
1149 { 0x0000, 0x0000 }, /* R1145 */
1150 { 0x0000, 0x0000 }, /* R1146 */
1151 { 0x0000, 0x0000 }, /* R1147 */
1152 { 0x0000, 0x0000 }, /* R1148 */
1153 { 0x0000, 0x0000 }, /* R1149 */
1154 { 0x0000, 0x0000 }, /* R1150 */
1155 { 0x0000, 0x0000 }, /* R1151 */
1156 { 0xFFFF, 0xFFFF }, /* R1152 - AIF1 DAC1 EQ Gains (1) */
1157 { 0xFFC0, 0xFFC0 }, /* R1153 - AIF1 DAC1 EQ Gains (2) */
1158 { 0xFFFF, 0xFFFF }, /* R1154 - AIF1 DAC1 EQ Band 1 A */
1159 { 0xFFFF, 0xFFFF }, /* R1155 - AIF1 DAC1 EQ Band 1 B */
1160 { 0xFFFF, 0xFFFF }, /* R1156 - AIF1 DAC1 EQ Band 1 PG */
1161 { 0xFFFF, 0xFFFF }, /* R1157 - AIF1 DAC1 EQ Band 2 A */
1162 { 0xFFFF, 0xFFFF }, /* R1158 - AIF1 DAC1 EQ Band 2 B */
1163 { 0xFFFF, 0xFFFF }, /* R1159 - AIF1 DAC1 EQ Band 2 C */
1164 { 0xFFFF, 0xFFFF }, /* R1160 - AIF1 DAC1 EQ Band 2 PG */
1165 { 0xFFFF, 0xFFFF }, /* R1161 - AIF1 DAC1 EQ Band 3 A */
1166 { 0xFFFF, 0xFFFF }, /* R1162 - AIF1 DAC1 EQ Band 3 B */
1167 { 0xFFFF, 0xFFFF }, /* R1163 - AIF1 DAC1 EQ Band 3 C */
1168 { 0xFFFF, 0xFFFF }, /* R1164 - AIF1 DAC1 EQ Band 3 PG */
1169 { 0xFFFF, 0xFFFF }, /* R1165 - AIF1 DAC1 EQ Band 4 A */
1170 { 0xFFFF, 0xFFFF }, /* R1166 - AIF1 DAC1 EQ Band 4 B */
1171 { 0xFFFF, 0xFFFF }, /* R1167 - AIF1 DAC1 EQ Band 4 C */
1172 { 0xFFFF, 0xFFFF }, /* R1168 - AIF1 DAC1 EQ Band 4 PG */
1173 { 0xFFFF, 0xFFFF }, /* R1169 - AIF1 DAC1 EQ Band 5 A */
1174 { 0xFFFF, 0xFFFF }, /* R1170 - AIF1 DAC1 EQ Band 5 B */
1175 { 0xFFFF, 0xFFFF }, /* R1171 - AIF1 DAC1 EQ Band 5 PG */
1176 { 0x0000, 0x0000 }, /* R1172 */
1177 { 0x0000, 0x0000 }, /* R1173 */
1178 { 0x0000, 0x0000 }, /* R1174 */
1179 { 0x0000, 0x0000 }, /* R1175 */
1180 { 0x0000, 0x0000 }, /* R1176 */
1181 { 0x0000, 0x0000 }, /* R1177 */
1182 { 0x0000, 0x0000 }, /* R1178 */
1183 { 0x0000, 0x0000 }, /* R1179 */
1184 { 0x0000, 0x0000 }, /* R1180 */
1185 { 0x0000, 0x0000 }, /* R1181 */
1186 { 0x0000, 0x0000 }, /* R1182 */
1187 { 0x0000, 0x0000 }, /* R1183 */
1188 { 0xFFFF, 0xFFFF }, /* R1184 - AIF1 DAC2 EQ Gains (1) */
1189 { 0xFFC0, 0xFFC0 }, /* R1185 - AIF1 DAC2 EQ Gains (2) */
1190 { 0xFFFF, 0xFFFF }, /* R1186 - AIF1 DAC2 EQ Band 1 A */
1191 { 0xFFFF, 0xFFFF }, /* R1187 - AIF1 DAC2 EQ Band 1 B */
1192 { 0xFFFF, 0xFFFF }, /* R1188 - AIF1 DAC2 EQ Band 1 PG */
1193 { 0xFFFF, 0xFFFF }, /* R1189 - AIF1 DAC2 EQ Band 2 A */
1194 { 0xFFFF, 0xFFFF }, /* R1190 - AIF1 DAC2 EQ Band 2 B */
1195 { 0xFFFF, 0xFFFF }, /* R1191 - AIF1 DAC2 EQ Band 2 C */
1196 { 0xFFFF, 0xFFFF }, /* R1192 - AIF1 DAC2 EQ Band 2 PG */
1197 { 0xFFFF, 0xFFFF }, /* R1193 - AIF1 DAC2 EQ Band 3 A */
1198 { 0xFFFF, 0xFFFF }, /* R1194 - AIF1 DAC2 EQ Band 3 B */
1199 { 0xFFFF, 0xFFFF }, /* R1195 - AIF1 DAC2 EQ Band 3 C */
1200 { 0xFFFF, 0xFFFF }, /* R1196 - AIF1 DAC2 EQ Band 3 PG */
1201 { 0xFFFF, 0xFFFF }, /* R1197 - AIF1 DAC2 EQ Band 4 A */
1202 { 0xFFFF, 0xFFFF }, /* R1198 - AIF1 DAC2 EQ Band 4 B */
1203 { 0xFFFF, 0xFFFF }, /* R1199 - AIF1 DAC2 EQ Band 4 C */
1204 { 0xFFFF, 0xFFFF }, /* R1200 - AIF1 DAC2 EQ Band 4 PG */
1205 { 0xFFFF, 0xFFFF }, /* R1201 - AIF1 DAC2 EQ Band 5 A */
1206 { 0xFFFF, 0xFFFF }, /* R1202 - AIF1 DAC2 EQ Band 5 B */
1207 { 0xFFFF, 0xFFFF }, /* R1203 - AIF1 DAC2 EQ Band 5 PG */
1208 { 0x0000, 0x0000 }, /* R1204 */
1209 { 0x0000, 0x0000 }, /* R1205 */
1210 { 0x0000, 0x0000 }, /* R1206 */
1211 { 0x0000, 0x0000 }, /* R1207 */
1212 { 0x0000, 0x0000 }, /* R1208 */
1213 { 0x0000, 0x0000 }, /* R1209 */
1214 { 0x0000, 0x0000 }, /* R1210 */
1215 { 0x0000, 0x0000 }, /* R1211 */
1216 { 0x0000, 0x0000 }, /* R1212 */
1217 { 0x0000, 0x0000 }, /* R1213 */
1218 { 0x0000, 0x0000 }, /* R1214 */
1219 { 0x0000, 0x0000 }, /* R1215 */
1220 { 0x0000, 0x0000 }, /* R1216 */
1221 { 0x0000, 0x0000 }, /* R1217 */
1222 { 0x0000, 0x0000 }, /* R1218 */
1223 { 0x0000, 0x0000 }, /* R1219 */
1224 { 0x0000, 0x0000 }, /* R1220 */
1225 { 0x0000, 0x0000 }, /* R1221 */
1226 { 0x0000, 0x0000 }, /* R1222 */
1227 { 0x0000, 0x0000 }, /* R1223 */
1228 { 0x0000, 0x0000 }, /* R1224 */
1229 { 0x0000, 0x0000 }, /* R1225 */
1230 { 0x0000, 0x0000 }, /* R1226 */
1231 { 0x0000, 0x0000 }, /* R1227 */
1232 { 0x0000, 0x0000 }, /* R1228 */
1233 { 0x0000, 0x0000 }, /* R1229 */
1234 { 0x0000, 0x0000 }, /* R1230 */
1235 { 0x0000, 0x0000 }, /* R1231 */
1236 { 0x0000, 0x0000 }, /* R1232 */
1237 { 0x0000, 0x0000 }, /* R1233 */
1238 { 0x0000, 0x0000 }, /* R1234 */
1239 { 0x0000, 0x0000 }, /* R1235 */
1240 { 0x0000, 0x0000 }, /* R1236 */
1241 { 0x0000, 0x0000 }, /* R1237 */
1242 { 0x0000, 0x0000 }, /* R1238 */
1243 { 0x0000, 0x0000 }, /* R1239 */
1244 { 0x0000, 0x0000 }, /* R1240 */
1245 { 0x0000, 0x0000 }, /* R1241 */
1246 { 0x0000, 0x0000 }, /* R1242 */
1247 { 0x0000, 0x0000 }, /* R1243 */
1248 { 0x0000, 0x0000 }, /* R1244 */
1249 { 0x0000, 0x0000 }, /* R1245 */
1250 { 0x0000, 0x0000 }, /* R1246 */
1251 { 0x0000, 0x0000 }, /* R1247 */
1252 { 0x0000, 0x0000 }, /* R1248 */
1253 { 0x0000, 0x0000 }, /* R1249 */
1254 { 0x0000, 0x0000 }, /* R1250 */
1255 { 0x0000, 0x0000 }, /* R1251 */
1256 { 0x0000, 0x0000 }, /* R1252 */
1257 { 0x0000, 0x0000 }, /* R1253 */
1258 { 0x0000, 0x0000 }, /* R1254 */
1259 { 0x0000, 0x0000 }, /* R1255 */
1260 { 0x0000, 0x0000 }, /* R1256 */
1261 { 0x0000, 0x0000 }, /* R1257 */
1262 { 0x0000, 0x0000 }, /* R1258 */
1263 { 0x0000, 0x0000 }, /* R1259 */
1264 { 0x0000, 0x0000 }, /* R1260 */
1265 { 0x0000, 0x0000 }, /* R1261 */
1266 { 0x0000, 0x0000 }, /* R1262 */
1267 { 0x0000, 0x0000 }, /* R1263 */
1268 { 0x0000, 0x0000 }, /* R1264 */
1269 { 0x0000, 0x0000 }, /* R1265 */
1270 { 0x0000, 0x0000 }, /* R1266 */
1271 { 0x0000, 0x0000 }, /* R1267 */
1272 { 0x0000, 0x0000 }, /* R1268 */
1273 { 0x0000, 0x0000 }, /* R1269 */
1274 { 0x0000, 0x0000 }, /* R1270 */
1275 { 0x0000, 0x0000 }, /* R1271 */
1276 { 0x0000, 0x0000 }, /* R1272 */
1277 { 0x0000, 0x0000 }, /* R1273 */
1278 { 0x0000, 0x0000 }, /* R1274 */
1279 { 0x0000, 0x0000 }, /* R1275 */
1280 { 0x0000, 0x0000 }, /* R1276 */
1281 { 0x0000, 0x0000 }, /* R1277 */
1282 { 0x0000, 0x0000 }, /* R1278 */
1283 { 0x0000, 0x0000 }, /* R1279 */
1284 { 0x00FF, 0x01FF }, /* R1280 - AIF2 ADC Left Volume */
1285 { 0x00FF, 0x01FF }, /* R1281 - AIF2 ADC Right Volume */
1286 { 0x00FF, 0x01FF }, /* R1282 - AIF2 DAC Left Volume */
1287 { 0x00FF, 0x01FF }, /* R1283 - AIF2 DAC Right Volume */
1288 { 0x0000, 0x0000 }, /* R1284 */
1289 { 0x0000, 0x0000 }, /* R1285 */
1290 { 0x0000, 0x0000 }, /* R1286 */
1291 { 0x0000, 0x0000 }, /* R1287 */
1292 { 0x0000, 0x0000 }, /* R1288 */
1293 { 0x0000, 0x0000 }, /* R1289 */
1294 { 0x0000, 0x0000 }, /* R1290 */
1295 { 0x0000, 0x0000 }, /* R1291 */
1296 { 0x0000, 0x0000 }, /* R1292 */
1297 { 0x0000, 0x0000 }, /* R1293 */
1298 { 0x0000, 0x0000 }, /* R1294 */
1299 { 0x0000, 0x0000 }, /* R1295 */
1300 { 0xF800, 0xF800 }, /* R1296 - AIF2 ADC Filters */
1301 { 0x0000, 0x0000 }, /* R1297 */
1302 { 0x0000, 0x0000 }, /* R1298 */
1303 { 0x0000, 0x0000 }, /* R1299 */
1304 { 0x0000, 0x0000 }, /* R1300 */
1305 { 0x0000, 0x0000 }, /* R1301 */
1306 { 0x0000, 0x0000 }, /* R1302 */
1307 { 0x0000, 0x0000 }, /* R1303 */
1308 { 0x0000, 0x0000 }, /* R1304 */
1309 { 0x0000, 0x0000 }, /* R1305 */
1310 { 0x0000, 0x0000 }, /* R1306 */
1311 { 0x0000, 0x0000 }, /* R1307 */
1312 { 0x0000, 0x0000 }, /* R1308 */
1313 { 0x0000, 0x0000 }, /* R1309 */
1314 { 0x0000, 0x0000 }, /* R1310 */
1315 { 0x0000, 0x0000 }, /* R1311 */
1316 { 0x02B6, 0x02B6 }, /* R1312 - AIF2 DAC Filters (1) */
1317 { 0x3F00, 0x3F00 }, /* R1313 - AIF2 DAC Filters (2) */
1318 { 0x0000, 0x0000 }, /* R1314 */
1319 { 0x0000, 0x0000 }, /* R1315 */
1320 { 0x0000, 0x0000 }, /* R1316 */
1321 { 0x0000, 0x0000 }, /* R1317 */
1322 { 0x0000, 0x0000 }, /* R1318 */
1323 { 0x0000, 0x0000 }, /* R1319 */
1324 { 0x0000, 0x0000 }, /* R1320 */
1325 { 0x0000, 0x0000 }, /* R1321 */
1326 { 0x0000, 0x0000 }, /* R1322 */
1327 { 0x0000, 0x0000 }, /* R1323 */
1328 { 0x0000, 0x0000 }, /* R1324 */
1329 { 0x0000, 0x0000 }, /* R1325 */
1330 { 0x0000, 0x0000 }, /* R1326 */
1331 { 0x0000, 0x0000 }, /* R1327 */
1332 { 0x006F, 0x006F }, /* R1328 - AIF2 DAC Noise Gate */
1333 { 0x0000, 0x0000 }, /* R1329 */
1334 { 0x0000, 0x0000 }, /* R1330 */
1335 { 0x0000, 0x0000 }, /* R1331 */
1336 { 0x0000, 0x0000 }, /* R1332 */
1337 { 0x0000, 0x0000 }, /* R1333 */
1338 { 0x0000, 0x0000 }, /* R1334 */
1339 { 0x0000, 0x0000 }, /* R1335 */
1340 { 0x0000, 0x0000 }, /* R1336 */
1341 { 0x0000, 0x0000 }, /* R1337 */
1342 { 0x0000, 0x0000 }, /* R1338 */
1343 { 0x0000, 0x0000 }, /* R1339 */
1344 { 0x0000, 0x0000 }, /* R1340 */
1345 { 0x0000, 0x0000 }, /* R1341 */
1346 { 0x0000, 0x0000 }, /* R1342 */
1347 { 0x0000, 0x0000 }, /* R1343 */
1348 { 0xFFFF, 0xFFFF }, /* R1344 - AIF2 DRC (1) */
1349 { 0x1FFF, 0x1FFF }, /* R1345 - AIF2 DRC (2) */
1350 { 0xFFFF, 0xFFFF }, /* R1346 - AIF2 DRC (3) */
1351 { 0x07FF, 0x07FF }, /* R1347 - AIF2 DRC (4) */
1352 { 0x03FF, 0x03FF }, /* R1348 - AIF2 DRC (5) */
1353 { 0x0000, 0x0000 }, /* R1349 */
1354 { 0x0000, 0x0000 }, /* R1350 */
1355 { 0x0000, 0x0000 }, /* R1351 */
1356 { 0x0000, 0x0000 }, /* R1352 */
1357 { 0x0000, 0x0000 }, /* R1353 */
1358 { 0x0000, 0x0000 }, /* R1354 */
1359 { 0x0000, 0x0000 }, /* R1355 */
1360 { 0x0000, 0x0000 }, /* R1356 */
1361 { 0x0000, 0x0000 }, /* R1357 */
1362 { 0x0000, 0x0000 }, /* R1358 */
1363 { 0x0000, 0x0000 }, /* R1359 */
1364 { 0x0000, 0x0000 }, /* R1360 */
1365 { 0x0000, 0x0000 }, /* R1361 */
1366 { 0x0000, 0x0000 }, /* R1362 */
1367 { 0x0000, 0x0000 }, /* R1363 */
1368 { 0x0000, 0x0000 }, /* R1364 */
1369 { 0x0000, 0x0000 }, /* R1365 */
1370 { 0x0000, 0x0000 }, /* R1366 */
1371 { 0x0000, 0x0000 }, /* R1367 */
1372 { 0x0000, 0x0000 }, /* R1368 */
1373 { 0x0000, 0x0000 }, /* R1369 */
1374 { 0x0000, 0x0000 }, /* R1370 */
1375 { 0x0000, 0x0000 }, /* R1371 */
1376 { 0x0000, 0x0000 }, /* R1372 */
1377 { 0x0000, 0x0000 }, /* R1373 */
1378 { 0x0000, 0x0000 }, /* R1374 */
1379 { 0x0000, 0x0000 }, /* R1375 */
1380 { 0x0000, 0x0000 }, /* R1376 */
1381 { 0x0000, 0x0000 }, /* R1377 */
1382 { 0x0000, 0x0000 }, /* R1378 */
1383 { 0x0000, 0x0000 }, /* R1379 */
1384 { 0x0000, 0x0000 }, /* R1380 */
1385 { 0x0000, 0x0000 }, /* R1381 */
1386 { 0x0000, 0x0000 }, /* R1382 */
1387 { 0x0000, 0x0000 }, /* R1383 */
1388 { 0x0000, 0x0000 }, /* R1384 */
1389 { 0x0000, 0x0000 }, /* R1385 */
1390 { 0x0000, 0x0000 }, /* R1386 */
1391 { 0x0000, 0x0000 }, /* R1387 */
1392 { 0x0000, 0x0000 }, /* R1388 */
1393 { 0x0000, 0x0000 }, /* R1389 */
1394 { 0x0000, 0x0000 }, /* R1390 */
1395 { 0x0000, 0x0000 }, /* R1391 */
1396 { 0x0000, 0x0000 }, /* R1392 */
1397 { 0x0000, 0x0000 }, /* R1393 */
1398 { 0x0000, 0x0000 }, /* R1394 */
1399 { 0x0000, 0x0000 }, /* R1395 */
1400 { 0x0000, 0x0000 }, /* R1396 */
1401 { 0x0000, 0x0000 }, /* R1397 */
1402 { 0x0000, 0x0000 }, /* R1398 */
1403 { 0x0000, 0x0000 }, /* R1399 */
1404 { 0x0000, 0x0000 }, /* R1400 */
1405 { 0x0000, 0x0000 }, /* R1401 */
1406 { 0x0000, 0x0000 }, /* R1402 */
1407 { 0x0000, 0x0000 }, /* R1403 */
1408 { 0x0000, 0x0000 }, /* R1404 */
1409 { 0x0000, 0x0000 }, /* R1405 */
1410 { 0x0000, 0x0000 }, /* R1406 */
1411 { 0x0000, 0x0000 }, /* R1407 */
1412 { 0xFFFF, 0xFFFF }, /* R1408 - AIF2 EQ Gains (1) */
1413 { 0xFFC0, 0xFFC0 }, /* R1409 - AIF2 EQ Gains (2) */
1414 { 0xFFFF, 0xFFFF }, /* R1410 - AIF2 EQ Band 1 A */
1415 { 0xFFFF, 0xFFFF }, /* R1411 - AIF2 EQ Band 1 B */
1416 { 0xFFFF, 0xFFFF }, /* R1412 - AIF2 EQ Band 1 PG */
1417 { 0xFFFF, 0xFFFF }, /* R1413 - AIF2 EQ Band 2 A */
1418 { 0xFFFF, 0xFFFF }, /* R1414 - AIF2 EQ Band 2 B */
1419 { 0xFFFF, 0xFFFF }, /* R1415 - AIF2 EQ Band 2 C */
1420 { 0xFFFF, 0xFFFF }, /* R1416 - AIF2 EQ Band 2 PG */
1421 { 0xFFFF, 0xFFFF }, /* R1417 - AIF2 EQ Band 3 A */
1422 { 0xFFFF, 0xFFFF }, /* R1418 - AIF2 EQ Band 3 B */
1423 { 0xFFFF, 0xFFFF }, /* R1419 - AIF2 EQ Band 3 C */
1424 { 0xFFFF, 0xFFFF }, /* R1420 - AIF2 EQ Band 3 PG */
1425 { 0xFFFF, 0xFFFF }, /* R1421 - AIF2 EQ Band 4 A */
1426 { 0xFFFF, 0xFFFF }, /* R1422 - AIF2 EQ Band 4 B */
1427 { 0xFFFF, 0xFFFF }, /* R1423 - AIF2 EQ Band 4 C */
1428 { 0xFFFF, 0xFFFF }, /* R1424 - AIF2 EQ Band 4 PG */
1429 { 0xFFFF, 0xFFFF }, /* R1425 - AIF2 EQ Band 5 A */
1430 { 0xFFFF, 0xFFFF }, /* R1426 - AIF2 EQ Band 5 B */
1431 { 0xFFFF, 0xFFFF }, /* R1427 - AIF2 EQ Band 5 PG */
1432 { 0x0000, 0x0000 }, /* R1428 */
1433 { 0x0000, 0x0000 }, /* R1429 */
1434 { 0x0000, 0x0000 }, /* R1430 */
1435 { 0x0000, 0x0000 }, /* R1431 */
1436 { 0x0000, 0x0000 }, /* R1432 */
1437 { 0x0000, 0x0000 }, /* R1433 */
1438 { 0x0000, 0x0000 }, /* R1434 */
1439 { 0x0000, 0x0000 }, /* R1435 */
1440 { 0x0000, 0x0000 }, /* R1436 */
1441 { 0x0000, 0x0000 }, /* R1437 */
1442 { 0x0000, 0x0000 }, /* R1438 */
1443 { 0x0000, 0x0000 }, /* R1439 */
1444 { 0x0000, 0x0000 }, /* R1440 */
1445 { 0x0000, 0x0000 }, /* R1441 */
1446 { 0x0000, 0x0000 }, /* R1442 */
1447 { 0x0000, 0x0000 }, /* R1443 */
1448 { 0x0000, 0x0000 }, /* R1444 */
1449 { 0x0000, 0x0000 }, /* R1445 */
1450 { 0x0000, 0x0000 }, /* R1446 */
1451 { 0x0000, 0x0000 }, /* R1447 */
1452 { 0x0000, 0x0000 }, /* R1448 */
1453 { 0x0000, 0x0000 }, /* R1449 */
1454 { 0x0000, 0x0000 }, /* R1450 */
1455 { 0x0000, 0x0000 }, /* R1451 */
1456 { 0x0000, 0x0000 }, /* R1452 */
1457 { 0x0000, 0x0000 }, /* R1453 */
1458 { 0x0000, 0x0000 }, /* R1454 */
1459 { 0x0000, 0x0000 }, /* R1455 */
1460 { 0x0000, 0x0000 }, /* R1456 */
1461 { 0x0000, 0x0000 }, /* R1457 */
1462 { 0x0000, 0x0000 }, /* R1458 */
1463 { 0x0000, 0x0000 }, /* R1459 */
1464 { 0x0000, 0x0000 }, /* R1460 */
1465 { 0x0000, 0x0000 }, /* R1461 */
1466 { 0x0000, 0x0000 }, /* R1462 */
1467 { 0x0000, 0x0000 }, /* R1463 */
1468 { 0x0000, 0x0000 }, /* R1464 */
1469 { 0x0000, 0x0000 }, /* R1465 */
1470 { 0x0000, 0x0000 }, /* R1466 */
1471 { 0x0000, 0x0000 }, /* R1467 */
1472 { 0x0000, 0x0000 }, /* R1468 */
1473 { 0x0000, 0x0000 }, /* R1469 */
1474 { 0x0000, 0x0000 }, /* R1470 */
1475 { 0x0000, 0x0000 }, /* R1471 */
1476 { 0x0000, 0x0000 }, /* R1472 */
1477 { 0x0000, 0x0000 }, /* R1473 */
1478 { 0x0000, 0x0000 }, /* R1474 */
1479 { 0x0000, 0x0000 }, /* R1475 */
1480 { 0x0000, 0x0000 }, /* R1476 */
1481 { 0x0000, 0x0000 }, /* R1477 */
1482 { 0x0000, 0x0000 }, /* R1478 */
1483 { 0x0000, 0x0000 }, /* R1479 */
1484 { 0x0000, 0x0000 }, /* R1480 */
1485 { 0x0000, 0x0000 }, /* R1481 */
1486 { 0x0000, 0x0000 }, /* R1482 */
1487 { 0x0000, 0x0000 }, /* R1483 */
1488 { 0x0000, 0x0000 }, /* R1484 */
1489 { 0x0000, 0x0000 }, /* R1485 */
1490 { 0x0000, 0x0000 }, /* R1486 */
1491 { 0x0000, 0x0000 }, /* R1487 */
1492 { 0x0000, 0x0000 }, /* R1488 */
1493 { 0x0000, 0x0000 }, /* R1489 */
1494 { 0x0000, 0x0000 }, /* R1490 */
1495 { 0x0000, 0x0000 }, /* R1491 */
1496 { 0x0000, 0x0000 }, /* R1492 */
1497 { 0x0000, 0x0000 }, /* R1493 */
1498 { 0x0000, 0x0000 }, /* R1494 */
1499 { 0x0000, 0x0000 }, /* R1495 */
1500 { 0x0000, 0x0000 }, /* R1496 */
1501 { 0x0000, 0x0000 }, /* R1497 */
1502 { 0x0000, 0x0000 }, /* R1498 */
1503 { 0x0000, 0x0000 }, /* R1499 */
1504 { 0x0000, 0x0000 }, /* R1500 */
1505 { 0x0000, 0x0000 }, /* R1501 */
1506 { 0x0000, 0x0000 }, /* R1502 */
1507 { 0x0000, 0x0000 }, /* R1503 */
1508 { 0x0000, 0x0000 }, /* R1504 */
1509 { 0x0000, 0x0000 }, /* R1505 */
1510 { 0x0000, 0x0000 }, /* R1506 */
1511 { 0x0000, 0x0000 }, /* R1507 */
1512 { 0x0000, 0x0000 }, /* R1508 */
1513 { 0x0000, 0x0000 }, /* R1509 */
1514 { 0x0000, 0x0000 }, /* R1510 */
1515 { 0x0000, 0x0000 }, /* R1511 */
1516 { 0x0000, 0x0000 }, /* R1512 */
1517 { 0x0000, 0x0000 }, /* R1513 */
1518 { 0x0000, 0x0000 }, /* R1514 */
1519 { 0x0000, 0x0000 }, /* R1515 */
1520 { 0x0000, 0x0000 }, /* R1516 */
1521 { 0x0000, 0x0000 }, /* R1517 */
1522 { 0x0000, 0x0000 }, /* R1518 */
1523 { 0x0000, 0x0000 }, /* R1519 */
1524 { 0x0000, 0x0000 }, /* R1520 */
1525 { 0x0000, 0x0000 }, /* R1521 */
1526 { 0x0000, 0x0000 }, /* R1522 */
1527 { 0x0000, 0x0000 }, /* R1523 */
1528 { 0x0000, 0x0000 }, /* R1524 */
1529 { 0x0000, 0x0000 }, /* R1525 */
1530 { 0x0000, 0x0000 }, /* R1526 */
1531 { 0x0000, 0x0000 }, /* R1527 */
1532 { 0x0000, 0x0000 }, /* R1528 */
1533 { 0x0000, 0x0000 }, /* R1529 */
1534 { 0x0000, 0x0000 }, /* R1530 */
1535 { 0x0000, 0x0000 }, /* R1531 */
1536 { 0x0000, 0x0000 }, /* R1532 */
1537 { 0x0000, 0x0000 }, /* R1533 */
1538 { 0x0000, 0x0000 }, /* R1534 */
1539 { 0x0000, 0x0000 }, /* R1535 */
1540 { 0x01EF, 0x01EF }, /* R1536 - DAC1 Mixer Volumes */
1541 { 0x0037, 0x0037 }, /* R1537 - DAC1 Left Mixer Routing */
1542 { 0x0037, 0x0037 }, /* R1538 - DAC1 Right Mixer Routing */
1543 { 0x01EF, 0x01EF }, /* R1539 - DAC2 Mixer Volumes */
1544 { 0x0037, 0x0037 }, /* R1540 - DAC2 Left Mixer Routing */
1545 { 0x0037, 0x0037 }, /* R1541 - DAC2 Right Mixer Routing */
1546 { 0x0003, 0x0003 }, /* R1542 - AIF1 ADC1 Left Mixer Routing */
1547 { 0x0003, 0x0003 }, /* R1543 - AIF1 ADC1 Right Mixer Routing */
1548 { 0x0003, 0x0003 }, /* R1544 - AIF1 ADC2 Left Mixer Routing */
1549 { 0x0003, 0x0003 }, /* R1545 - AIF1 ADC2 Right mixer Routing */
1550 { 0x0000, 0x0000 }, /* R1546 */
1551 { 0x0000, 0x0000 }, /* R1547 */
1552 { 0x0000, 0x0000 }, /* R1548 */
1553 { 0x0000, 0x0000 }, /* R1549 */
1554 { 0x0000, 0x0000 }, /* R1550 */
1555 { 0x0000, 0x0000 }, /* R1551 */
1556 { 0x02FF, 0x03FF }, /* R1552 - DAC1 Left Volume */
1557 { 0x02FF, 0x03FF }, /* R1553 - DAC1 Right Volume */
1558 { 0x02FF, 0x03FF }, /* R1554 - DAC2 Left Volume */
1559 { 0x02FF, 0x03FF }, /* R1555 - DAC2 Right Volume */
1560 { 0x0003, 0x0003 }, /* R1556 - DAC Softmute */
1561 { 0x0000, 0x0000 }, /* R1557 */
1562 { 0x0000, 0x0000 }, /* R1558 */
1563 { 0x0000, 0x0000 }, /* R1559 */
1564 { 0x0000, 0x0000 }, /* R1560 */
1565 { 0x0000, 0x0000 }, /* R1561 */
1566 { 0x0000, 0x0000 }, /* R1562 */
1567 { 0x0000, 0x0000 }, /* R1563 */
1568 { 0x0000, 0x0000 }, /* R1564 */
1569 { 0x0000, 0x0000 }, /* R1565 */
1570 { 0x0000, 0x0000 }, /* R1566 */
1571 { 0x0000, 0x0000 }, /* R1567 */
1572 { 0x0003, 0x0003 }, /* R1568 - Oversampling */
1573 { 0x03C3, 0x03C3 }, /* R1569 - Sidetone */
1574};
1575
1576const u16 wm8994_reg_defaults[WM8994_CACHE_SIZE] = {
1577 0x8994, /* R0 - Software Reset */
1578 0x0000, /* R1 - Power Management (1) */
1579 0x6000, /* R2 - Power Management (2) */
1580 0x0000, /* R3 - Power Management (3) */
1581 0x0000, /* R4 - Power Management (4) */
1582 0x0000, /* R5 - Power Management (5) */
1583 0x0000, /* R6 - Power Management (6) */
1584 0x0000, /* R7 */
1585 0x0000, /* R8 */
1586 0x0000, /* R9 */
1587 0x0000, /* R10 */
1588 0x0000, /* R11 */
1589 0x0000, /* R12 */
1590 0x0000, /* R13 */
1591 0x0000, /* R14 */
1592 0x0000, /* R15 */
1593 0x0000, /* R16 */
1594 0x0000, /* R17 */
1595 0x0000, /* R18 */
1596 0x0000, /* R19 */
1597 0x0000, /* R20 */
1598 0x0000, /* R21 - Input Mixer (1) */
1599 0x0000, /* R22 */
1600 0x0000, /* R23 */
1601 0x008B, /* R24 - Left Line Input 1&2 Volume */
1602 0x008B, /* R25 - Left Line Input 3&4 Volume */
1603 0x008B, /* R26 - Right Line Input 1&2 Volume */
1604 0x008B, /* R27 - Right Line Input 3&4 Volume */
1605 0x006D, /* R28 - Left Output Volume */
1606 0x006D, /* R29 - Right Output Volume */
1607 0x0066, /* R30 - Line Outputs Volume */
1608 0x0020, /* R31 - HPOUT2 Volume */
1609 0x0079, /* R32 - Left OPGA Volume */
1610 0x0079, /* R33 - Right OPGA Volume */
1611 0x0003, /* R34 - SPKMIXL Attenuation */
1612 0x0003, /* R35 - SPKMIXR Attenuation */
1613 0x0011, /* R36 - SPKOUT Mixers */
1614 0x0140, /* R37 - ClassD */
1615 0x0079, /* R38 - Speaker Volume Left */
1616 0x0079, /* R39 - Speaker Volume Right */
1617 0x0000, /* R40 - Input Mixer (2) */
1618 0x0000, /* R41 - Input Mixer (3) */
1619 0x0000, /* R42 - Input Mixer (4) */
1620 0x0000, /* R43 - Input Mixer (5) */
1621 0x0000, /* R44 - Input Mixer (6) */
1622 0x0000, /* R45 - Output Mixer (1) */
1623 0x0000, /* R46 - Output Mixer (2) */
1624 0x0000, /* R47 - Output Mixer (3) */
1625 0x0000, /* R48 - Output Mixer (4) */
1626 0x0000, /* R49 - Output Mixer (5) */
1627 0x0000, /* R50 - Output Mixer (6) */
1628 0x0000, /* R51 - HPOUT2 Mixer */
1629 0x0000, /* R52 - Line Mixer (1) */
1630 0x0000, /* R53 - Line Mixer (2) */
1631 0x0000, /* R54 - Speaker Mixer */
1632 0x0000, /* R55 - Additional Control */
1633 0x0000, /* R56 - AntiPOP (1) */
1634 0x0000, /* R57 - AntiPOP (2) */
1635 0x0000, /* R58 - MICBIAS */
1636 0x000D, /* R59 - LDO 1 */
1637 0x0003, /* R60 - LDO 2 */
1638 0x0039, /* R61 - MICBIAS1 */
1639 0x0039, /* R62 - MICBIAS2 */
1640 0x0000, /* R63 */
1641 0x0000, /* R64 */
1642 0x0000, /* R65 */
1643 0x0000, /* R66 */
1644 0x0000, /* R67 */
1645 0x0000, /* R68 */
1646 0x0000, /* R69 */
1647 0x0000, /* R70 */
1648 0x0000, /* R71 */
1649 0x0000, /* R72 */
1650 0x0000, /* R73 */
1651 0x0000, /* R74 */
1652 0x0000, /* R75 */
1653 0x1F25, /* R76 - Charge Pump (1) */
1654 0x0000, /* R77 */
1655 0x0000, /* R78 */
1656 0x0000, /* R79 */
1657 0x0000, /* R80 */
1658 0x0004, /* R81 - Class W (1) */
1659 0x0000, /* R82 */
1660 0x0000, /* R83 */
1661 0x0000, /* R84 - DC Servo (1) */
1662 0x054A, /* R85 - DC Servo (2) */
1663 0x0000, /* R86 */
1664 0x0000, /* R87 - DC Servo (4) */
1665 0x0000, /* R88 - DC Servo Readback */
1666 0x0000, /* R89 */
1667 0x0000, /* R90 */
1668 0x0000, /* R91 */
1669 0x0000, /* R92 */
1670 0x0000, /* R93 */
1671 0x0000, /* R94 */
1672 0x0000, /* R95 */
1673 0x0000, /* R96 - Analogue HP (1) */
1674 0x0000, /* R97 */
1675 0x0000, /* R98 */
1676 0x0000, /* R99 */
1677 0x0000, /* R100 */
1678 0x0000, /* R101 */
1679 0x0000, /* R102 */
1680 0x0000, /* R103 */
1681 0x0000, /* R104 */
1682 0x0000, /* R105 */
1683 0x0000, /* R106 */
1684 0x0000, /* R107 */
1685 0x0000, /* R108 */
1686 0x0000, /* R109 */
1687 0x0000, /* R110 */
1688 0x0000, /* R111 */
1689 0x0000, /* R112 */
1690 0x0000, /* R113 */
1691 0x0000, /* R114 */
1692 0x0000, /* R115 */
1693 0x0000, /* R116 */
1694 0x0000, /* R117 */
1695 0x0000, /* R118 */
1696 0x0000, /* R119 */
1697 0x0000, /* R120 */
1698 0x0000, /* R121 */
1699 0x0000, /* R122 */
1700 0x0000, /* R123 */
1701 0x0000, /* R124 */
1702 0x0000, /* R125 */
1703 0x0000, /* R126 */
1704 0x0000, /* R127 */
1705 0x0000, /* R128 */
1706 0x0000, /* R129 */
1707 0x0000, /* R130 */
1708 0x0000, /* R131 */
1709 0x0000, /* R132 */
1710 0x0000, /* R133 */
1711 0x0000, /* R134 */
1712 0x0000, /* R135 */
1713 0x0000, /* R136 */
1714 0x0000, /* R137 */
1715 0x0000, /* R138 */
1716 0x0000, /* R139 */
1717 0x0000, /* R140 */
1718 0x0000, /* R141 */
1719 0x0000, /* R142 */
1720 0x0000, /* R143 */
1721 0x0000, /* R144 */
1722 0x0000, /* R145 */
1723 0x0000, /* R146 */
1724 0x0000, /* R147 */
1725 0x0000, /* R148 */
1726 0x0000, /* R149 */
1727 0x0000, /* R150 */
1728 0x0000, /* R151 */
1729 0x0000, /* R152 */
1730 0x0000, /* R153 */
1731 0x0000, /* R154 */
1732 0x0000, /* R155 */
1733 0x0000, /* R156 */
1734 0x0000, /* R157 */
1735 0x0000, /* R158 */
1736 0x0000, /* R159 */
1737 0x0000, /* R160 */
1738 0x0000, /* R161 */
1739 0x0000, /* R162 */
1740 0x0000, /* R163 */
1741 0x0000, /* R164 */
1742 0x0000, /* R165 */
1743 0x0000, /* R166 */
1744 0x0000, /* R167 */
1745 0x0000, /* R168 */
1746 0x0000, /* R169 */
1747 0x0000, /* R170 */
1748 0x0000, /* R171 */
1749 0x0000, /* R172 */
1750 0x0000, /* R173 */
1751 0x0000, /* R174 */
1752 0x0000, /* R175 */
1753 0x0000, /* R176 */
1754 0x0000, /* R177 */
1755 0x0000, /* R178 */
1756 0x0000, /* R179 */
1757 0x0000, /* R180 */
1758 0x0000, /* R181 */
1759 0x0000, /* R182 */
1760 0x0000, /* R183 */
1761 0x0000, /* R184 */
1762 0x0000, /* R185 */
1763 0x0000, /* R186 */
1764 0x0000, /* R187 */
1765 0x0000, /* R188 */
1766 0x0000, /* R189 */
1767 0x0000, /* R190 */
1768 0x0000, /* R191 */
1769 0x0000, /* R192 */
1770 0x0000, /* R193 */
1771 0x0000, /* R194 */
1772 0x0000, /* R195 */
1773 0x0000, /* R196 */
1774 0x0000, /* R197 */
1775 0x0000, /* R198 */
1776 0x0000, /* R199 */
1777 0x0000, /* R200 */
1778 0x0000, /* R201 */
1779 0x0000, /* R202 */
1780 0x0000, /* R203 */
1781 0x0000, /* R204 */
1782 0x0000, /* R205 */
1783 0x0000, /* R206 */
1784 0x0000, /* R207 */
1785 0x0000, /* R208 */
1786 0x0000, /* R209 */
1787 0x0000, /* R210 */
1788 0x0000, /* R211 */
1789 0x0000, /* R212 */
1790 0x0000, /* R213 */
1791 0x0000, /* R214 */
1792 0x0000, /* R215 */
1793 0x0000, /* R216 */
1794 0x0000, /* R217 */
1795 0x0000, /* R218 */
1796 0x0000, /* R219 */
1797 0x0000, /* R220 */
1798 0x0000, /* R221 */
1799 0x0000, /* R222 */
1800 0x0000, /* R223 */
1801 0x0000, /* R224 */
1802 0x0000, /* R225 */
1803 0x0000, /* R226 */
1804 0x0000, /* R227 */
1805 0x0000, /* R228 */
1806 0x0000, /* R229 */
1807 0x0000, /* R230 */
1808 0x0000, /* R231 */
1809 0x0000, /* R232 */
1810 0x0000, /* R233 */
1811 0x0000, /* R234 */
1812 0x0000, /* R235 */
1813 0x0000, /* R236 */
1814 0x0000, /* R237 */
1815 0x0000, /* R238 */
1816 0x0000, /* R239 */
1817 0x0000, /* R240 */
1818 0x0000, /* R241 */
1819 0x0000, /* R242 */
1820 0x0000, /* R243 */
1821 0x0000, /* R244 */
1822 0x0000, /* R245 */
1823 0x0000, /* R246 */
1824 0x0000, /* R247 */
1825 0x0000, /* R248 */
1826 0x0000, /* R249 */
1827 0x0000, /* R250 */
1828 0x0000, /* R251 */
1829 0x0000, /* R252 */
1830 0x0000, /* R253 */
1831 0x0000, /* R254 */
1832 0x0000, /* R255 */
1833 0x0003, /* R256 - Chip Revision */
1834 0x8004, /* R257 - Control Interface */
1835 0x0000, /* R258 */
1836 0x0000, /* R259 */
1837 0x0000, /* R260 */
1838 0x0000, /* R261 */
1839 0x0000, /* R262 */
1840 0x0000, /* R263 */
1841 0x0000, /* R264 */
1842 0x0000, /* R265 */
1843 0x0000, /* R266 */
1844 0x0000, /* R267 */
1845 0x0000, /* R268 */
1846 0x0000, /* R269 */
1847 0x0000, /* R270 */
1848 0x0000, /* R271 */
1849 0x0000, /* R272 - Write Sequencer Ctrl (1) */
1850 0x0000, /* R273 - Write Sequencer Ctrl (2) */
1851 0x0000, /* R274 */
1852 0x0000, /* R275 */
1853 0x0000, /* R276 */
1854 0x0000, /* R277 */
1855 0x0000, /* R278 */
1856 0x0000, /* R279 */
1857 0x0000, /* R280 */
1858 0x0000, /* R281 */
1859 0x0000, /* R282 */
1860 0x0000, /* R283 */
1861 0x0000, /* R284 */
1862 0x0000, /* R285 */
1863 0x0000, /* R286 */
1864 0x0000, /* R287 */
1865 0x0000, /* R288 */
1866 0x0000, /* R289 */
1867 0x0000, /* R290 */
1868 0x0000, /* R291 */
1869 0x0000, /* R292 */
1870 0x0000, /* R293 */
1871 0x0000, /* R294 */
1872 0x0000, /* R295 */
1873 0x0000, /* R296 */
1874 0x0000, /* R297 */
1875 0x0000, /* R298 */
1876 0x0000, /* R299 */
1877 0x0000, /* R300 */
1878 0x0000, /* R301 */
1879 0x0000, /* R302 */
1880 0x0000, /* R303 */
1881 0x0000, /* R304 */
1882 0x0000, /* R305 */
1883 0x0000, /* R306 */
1884 0x0000, /* R307 */
1885 0x0000, /* R308 */
1886 0x0000, /* R309 */
1887 0x0000, /* R310 */
1888 0x0000, /* R311 */
1889 0x0000, /* R312 */
1890 0x0000, /* R313 */
1891 0x0000, /* R314 */
1892 0x0000, /* R315 */
1893 0x0000, /* R316 */
1894 0x0000, /* R317 */
1895 0x0000, /* R318 */
1896 0x0000, /* R319 */
1897 0x0000, /* R320 */
1898 0x0000, /* R321 */
1899 0x0000, /* R322 */
1900 0x0000, /* R323 */
1901 0x0000, /* R324 */
1902 0x0000, /* R325 */
1903 0x0000, /* R326 */
1904 0x0000, /* R327 */
1905 0x0000, /* R328 */
1906 0x0000, /* R329 */
1907 0x0000, /* R330 */
1908 0x0000, /* R331 */
1909 0x0000, /* R332 */
1910 0x0000, /* R333 */
1911 0x0000, /* R334 */
1912 0x0000, /* R335 */
1913 0x0000, /* R336 */
1914 0x0000, /* R337 */
1915 0x0000, /* R338 */
1916 0x0000, /* R339 */
1917 0x0000, /* R340 */
1918 0x0000, /* R341 */
1919 0x0000, /* R342 */
1920 0x0000, /* R343 */
1921 0x0000, /* R344 */
1922 0x0000, /* R345 */
1923 0x0000, /* R346 */
1924 0x0000, /* R347 */
1925 0x0000, /* R348 */
1926 0x0000, /* R349 */
1927 0x0000, /* R350 */
1928 0x0000, /* R351 */
1929 0x0000, /* R352 */
1930 0x0000, /* R353 */
1931 0x0000, /* R354 */
1932 0x0000, /* R355 */
1933 0x0000, /* R356 */
1934 0x0000, /* R357 */
1935 0x0000, /* R358 */
1936 0x0000, /* R359 */
1937 0x0000, /* R360 */
1938 0x0000, /* R361 */
1939 0x0000, /* R362 */
1940 0x0000, /* R363 */
1941 0x0000, /* R364 */
1942 0x0000, /* R365 */
1943 0x0000, /* R366 */
1944 0x0000, /* R367 */
1945 0x0000, /* R368 */
1946 0x0000, /* R369 */
1947 0x0000, /* R370 */
1948 0x0000, /* R371 */
1949 0x0000, /* R372 */
1950 0x0000, /* R373 */
1951 0x0000, /* R374 */
1952 0x0000, /* R375 */
1953 0x0000, /* R376 */
1954 0x0000, /* R377 */
1955 0x0000, /* R378 */
1956 0x0000, /* R379 */
1957 0x0000, /* R380 */
1958 0x0000, /* R381 */
1959 0x0000, /* R382 */
1960 0x0000, /* R383 */
1961 0x0000, /* R384 */
1962 0x0000, /* R385 */
1963 0x0000, /* R386 */
1964 0x0000, /* R387 */
1965 0x0000, /* R388 */
1966 0x0000, /* R389 */
1967 0x0000, /* R390 */
1968 0x0000, /* R391 */
1969 0x0000, /* R392 */
1970 0x0000, /* R393 */
1971 0x0000, /* R394 */
1972 0x0000, /* R395 */
1973 0x0000, /* R396 */
1974 0x0000, /* R397 */
1975 0x0000, /* R398 */
1976 0x0000, /* R399 */
1977 0x0000, /* R400 */
1978 0x0000, /* R401 */
1979 0x0000, /* R402 */
1980 0x0000, /* R403 */
1981 0x0000, /* R404 */
1982 0x0000, /* R405 */
1983 0x0000, /* R406 */
1984 0x0000, /* R407 */
1985 0x0000, /* R408 */
1986 0x0000, /* R409 */
1987 0x0000, /* R410 */
1988 0x0000, /* R411 */
1989 0x0000, /* R412 */
1990 0x0000, /* R413 */
1991 0x0000, /* R414 */
1992 0x0000, /* R415 */
1993 0x0000, /* R416 */
1994 0x0000, /* R417 */
1995 0x0000, /* R418 */
1996 0x0000, /* R419 */
1997 0x0000, /* R420 */
1998 0x0000, /* R421 */
1999 0x0000, /* R422 */
2000 0x0000, /* R423 */
2001 0x0000, /* R424 */
2002 0x0000, /* R425 */
2003 0x0000, /* R426 */
2004 0x0000, /* R427 */
2005 0x0000, /* R428 */
2006 0x0000, /* R429 */
2007 0x0000, /* R430 */
2008 0x0000, /* R431 */
2009 0x0000, /* R432 */
2010 0x0000, /* R433 */
2011 0x0000, /* R434 */
2012 0x0000, /* R435 */
2013 0x0000, /* R436 */
2014 0x0000, /* R437 */
2015 0x0000, /* R438 */
2016 0x0000, /* R439 */
2017 0x0000, /* R440 */
2018 0x0000, /* R441 */
2019 0x0000, /* R442 */
2020 0x0000, /* R443 */
2021 0x0000, /* R444 */
2022 0x0000, /* R445 */
2023 0x0000, /* R446 */
2024 0x0000, /* R447 */
2025 0x0000, /* R448 */
2026 0x0000, /* R449 */
2027 0x0000, /* R450 */
2028 0x0000, /* R451 */
2029 0x0000, /* R452 */
2030 0x0000, /* R453 */
2031 0x0000, /* R454 */
2032 0x0000, /* R455 */
2033 0x0000, /* R456 */
2034 0x0000, /* R457 */
2035 0x0000, /* R458 */
2036 0x0000, /* R459 */
2037 0x0000, /* R460 */
2038 0x0000, /* R461 */
2039 0x0000, /* R462 */
2040 0x0000, /* R463 */
2041 0x0000, /* R464 */
2042 0x0000, /* R465 */
2043 0x0000, /* R466 */
2044 0x0000, /* R467 */
2045 0x0000, /* R468 */
2046 0x0000, /* R469 */
2047 0x0000, /* R470 */
2048 0x0000, /* R471 */
2049 0x0000, /* R472 */
2050 0x0000, /* R473 */
2051 0x0000, /* R474 */
2052 0x0000, /* R475 */
2053 0x0000, /* R476 */
2054 0x0000, /* R477 */
2055 0x0000, /* R478 */
2056 0x0000, /* R479 */
2057 0x0000, /* R480 */
2058 0x0000, /* R481 */
2059 0x0000, /* R482 */
2060 0x0000, /* R483 */
2061 0x0000, /* R484 */
2062 0x0000, /* R485 */
2063 0x0000, /* R486 */
2064 0x0000, /* R487 */
2065 0x0000, /* R488 */
2066 0x0000, /* R489 */
2067 0x0000, /* R490 */
2068 0x0000, /* R491 */
2069 0x0000, /* R492 */
2070 0x0000, /* R493 */
2071 0x0000, /* R494 */
2072 0x0000, /* R495 */
2073 0x0000, /* R496 */
2074 0x0000, /* R497 */
2075 0x0000, /* R498 */
2076 0x0000, /* R499 */
2077 0x0000, /* R500 */
2078 0x0000, /* R501 */
2079 0x0000, /* R502 */
2080 0x0000, /* R503 */
2081 0x0000, /* R504 */
2082 0x0000, /* R505 */
2083 0x0000, /* R506 */
2084 0x0000, /* R507 */
2085 0x0000, /* R508 */
2086 0x0000, /* R509 */
2087 0x0000, /* R510 */
2088 0x0000, /* R511 */
2089 0x0000, /* R512 - AIF1 Clocking (1) */
2090 0x0000, /* R513 - AIF1 Clocking (2) */
2091 0x0000, /* R514 */
2092 0x0000, /* R515 */
2093 0x0000, /* R516 - AIF2 Clocking (1) */
2094 0x0000, /* R517 - AIF2 Clocking (2) */
2095 0x0000, /* R518 */
2096 0x0000, /* R519 */
2097 0x0000, /* R520 - Clocking (1) */
2098 0x0000, /* R521 - Clocking (2) */
2099 0x0000, /* R522 */
2100 0x0000, /* R523 */
2101 0x0000, /* R524 */
2102 0x0000, /* R525 */
2103 0x0000, /* R526 */
2104 0x0000, /* R527 */
2105 0x0083, /* R528 - AIF1 Rate */
2106 0x0083, /* R529 - AIF2 Rate */
2107 0x0000, /* R530 - Rate Status */
2108 0x0000, /* R531 */
2109 0x0000, /* R532 */
2110 0x0000, /* R533 */
2111 0x0000, /* R534 */
2112 0x0000, /* R535 */
2113 0x0000, /* R536 */
2114 0x0000, /* R537 */
2115 0x0000, /* R538 */
2116 0x0000, /* R539 */
2117 0x0000, /* R540 */
2118 0x0000, /* R541 */
2119 0x0000, /* R542 */
2120 0x0000, /* R543 */
2121 0x0000, /* R544 - FLL1 Control (1) */
2122 0x0000, /* R545 - FLL1 Control (2) */
2123 0x0000, /* R546 - FLL1 Control (3) */
2124 0x0000, /* R547 - FLL1 Control (4) */
2125 0x0C80, /* R548 - FLL1 Control (5) */
2126 0x0000, /* R549 */
2127 0x0000, /* R550 */
2128 0x0000, /* R551 */
2129 0x0000, /* R552 */
2130 0x0000, /* R553 */
2131 0x0000, /* R554 */
2132 0x0000, /* R555 */
2133 0x0000, /* R556 */
2134 0x0000, /* R557 */
2135 0x0000, /* R558 */
2136 0x0000, /* R559 */
2137 0x0000, /* R560 */
2138 0x0000, /* R561 */
2139 0x0000, /* R562 */
2140 0x0000, /* R563 */
2141 0x0000, /* R564 */
2142 0x0000, /* R565 */
2143 0x0000, /* R566 */
2144 0x0000, /* R567 */
2145 0x0000, /* R568 */
2146 0x0000, /* R569 */
2147 0x0000, /* R570 */
2148 0x0000, /* R571 */
2149 0x0000, /* R572 */
2150 0x0000, /* R573 */
2151 0x0000, /* R574 */
2152 0x0000, /* R575 */
2153 0x0000, /* R576 - FLL2 Control (1) */
2154 0x0000, /* R577 - FLL2 Control (2) */
2155 0x0000, /* R578 - FLL2 Control (3) */
2156 0x0000, /* R579 - FLL2 Control (4) */
2157 0x0C80, /* R580 - FLL2 Control (5) */
2158 0x0000, /* R581 */
2159 0x0000, /* R582 */
2160 0x0000, /* R583 */
2161 0x0000, /* R584 */
2162 0x0000, /* R585 */
2163 0x0000, /* R586 */
2164 0x0000, /* R587 */
2165 0x0000, /* R588 */
2166 0x0000, /* R589 */
2167 0x0000, /* R590 */
2168 0x0000, /* R591 */
2169 0x0000, /* R592 */
2170 0x0000, /* R593 */
2171 0x0000, /* R594 */
2172 0x0000, /* R595 */
2173 0x0000, /* R596 */
2174 0x0000, /* R597 */
2175 0x0000, /* R598 */
2176 0x0000, /* R599 */
2177 0x0000, /* R600 */
2178 0x0000, /* R601 */
2179 0x0000, /* R602 */
2180 0x0000, /* R603 */
2181 0x0000, /* R604 */
2182 0x0000, /* R605 */
2183 0x0000, /* R606 */
2184 0x0000, /* R607 */
2185 0x0000, /* R608 */
2186 0x0000, /* R609 */
2187 0x0000, /* R610 */
2188 0x0000, /* R611 */
2189 0x0000, /* R612 */
2190 0x0000, /* R613 */
2191 0x0000, /* R614 */
2192 0x0000, /* R615 */
2193 0x0000, /* R616 */
2194 0x0000, /* R617 */
2195 0x0000, /* R618 */
2196 0x0000, /* R619 */
2197 0x0000, /* R620 */
2198 0x0000, /* R621 */
2199 0x0000, /* R622 */
2200 0x0000, /* R623 */
2201 0x0000, /* R624 */
2202 0x0000, /* R625 */
2203 0x0000, /* R626 */
2204 0x0000, /* R627 */
2205 0x0000, /* R628 */
2206 0x0000, /* R629 */
2207 0x0000, /* R630 */
2208 0x0000, /* R631 */
2209 0x0000, /* R632 */
2210 0x0000, /* R633 */
2211 0x0000, /* R634 */
2212 0x0000, /* R635 */
2213 0x0000, /* R636 */
2214 0x0000, /* R637 */
2215 0x0000, /* R638 */
2216 0x0000, /* R639 */
2217 0x0000, /* R640 */
2218 0x0000, /* R641 */
2219 0x0000, /* R642 */
2220 0x0000, /* R643 */
2221 0x0000, /* R644 */
2222 0x0000, /* R645 */
2223 0x0000, /* R646 */
2224 0x0000, /* R647 */
2225 0x0000, /* R648 */
2226 0x0000, /* R649 */
2227 0x0000, /* R650 */
2228 0x0000, /* R651 */
2229 0x0000, /* R652 */
2230 0x0000, /* R653 */
2231 0x0000, /* R654 */
2232 0x0000, /* R655 */
2233 0x0000, /* R656 */
2234 0x0000, /* R657 */
2235 0x0000, /* R658 */
2236 0x0000, /* R659 */
2237 0x0000, /* R660 */
2238 0x0000, /* R661 */
2239 0x0000, /* R662 */
2240 0x0000, /* R663 */
2241 0x0000, /* R664 */
2242 0x0000, /* R665 */
2243 0x0000, /* R666 */
2244 0x0000, /* R667 */
2245 0x0000, /* R668 */
2246 0x0000, /* R669 */
2247 0x0000, /* R670 */
2248 0x0000, /* R671 */
2249 0x0000, /* R672 */
2250 0x0000, /* R673 */
2251 0x0000, /* R674 */
2252 0x0000, /* R675 */
2253 0x0000, /* R676 */
2254 0x0000, /* R677 */
2255 0x0000, /* R678 */
2256 0x0000, /* R679 */
2257 0x0000, /* R680 */
2258 0x0000, /* R681 */
2259 0x0000, /* R682 */
2260 0x0000, /* R683 */
2261 0x0000, /* R684 */
2262 0x0000, /* R685 */
2263 0x0000, /* R686 */
2264 0x0000, /* R687 */
2265 0x0000, /* R688 */
2266 0x0000, /* R689 */
2267 0x0000, /* R690 */
2268 0x0000, /* R691 */
2269 0x0000, /* R692 */
2270 0x0000, /* R693 */
2271 0x0000, /* R694 */
2272 0x0000, /* R695 */
2273 0x0000, /* R696 */
2274 0x0000, /* R697 */
2275 0x0000, /* R698 */
2276 0x0000, /* R699 */
2277 0x0000, /* R700 */
2278 0x0000, /* R701 */
2279 0x0000, /* R702 */
2280 0x0000, /* R703 */
2281 0x0000, /* R704 */
2282 0x0000, /* R705 */
2283 0x0000, /* R706 */
2284 0x0000, /* R707 */
2285 0x0000, /* R708 */
2286 0x0000, /* R709 */
2287 0x0000, /* R710 */
2288 0x0000, /* R711 */
2289 0x0000, /* R712 */
2290 0x0000, /* R713 */
2291 0x0000, /* R714 */
2292 0x0000, /* R715 */
2293 0x0000, /* R716 */
2294 0x0000, /* R717 */
2295 0x0000, /* R718 */
2296 0x0000, /* R719 */
2297 0x0000, /* R720 */
2298 0x0000, /* R721 */
2299 0x0000, /* R722 */
2300 0x0000, /* R723 */
2301 0x0000, /* R724 */
2302 0x0000, /* R725 */
2303 0x0000, /* R726 */
2304 0x0000, /* R727 */
2305 0x0000, /* R728 */
2306 0x0000, /* R729 */
2307 0x0000, /* R730 */
2308 0x0000, /* R731 */
2309 0x0000, /* R732 */
2310 0x0000, /* R733 */
2311 0x0000, /* R734 */
2312 0x0000, /* R735 */
2313 0x0000, /* R736 */
2314 0x0000, /* R737 */
2315 0x0000, /* R738 */
2316 0x0000, /* R739 */
2317 0x0000, /* R740 */
2318 0x0000, /* R741 */
2319 0x0000, /* R742 */
2320 0x0000, /* R743 */
2321 0x0000, /* R744 */
2322 0x0000, /* R745 */
2323 0x0000, /* R746 */
2324 0x0000, /* R747 */
2325 0x0000, /* R748 */
2326 0x0000, /* R749 */
2327 0x0000, /* R750 */
2328 0x0000, /* R751 */
2329 0x0000, /* R752 */
2330 0x0000, /* R753 */
2331 0x0000, /* R754 */
2332 0x0000, /* R755 */
2333 0x0000, /* R756 */
2334 0x0000, /* R757 */
2335 0x0000, /* R758 */
2336 0x0000, /* R759 */
2337 0x0000, /* R760 */
2338 0x0000, /* R761 */
2339 0x0000, /* R762 */
2340 0x0000, /* R763 */
2341 0x0000, /* R764 */
2342 0x0000, /* R765 */
2343 0x0000, /* R766 */
2344 0x0000, /* R767 */
2345 0x4050, /* R768 - AIF1 Control (1) */
2346 0x4000, /* R769 - AIF1 Control (2) */
2347 0x0000, /* R770 - AIF1 Master/Slave */
2348 0x0040, /* R771 - AIF1 BCLK */
2349 0x0040, /* R772 - AIF1ADC LRCLK */
2350 0x0040, /* R773 - AIF1DAC LRCLK */
2351 0x0004, /* R774 - AIF1DAC Data */
2352 0x0100, /* R775 - AIF1ADC Data */
2353 0x0000, /* R776 */
2354 0x0000, /* R777 */
2355 0x0000, /* R778 */
2356 0x0000, /* R779 */
2357 0x0000, /* R780 */
2358 0x0000, /* R781 */
2359 0x0000, /* R782 */
2360 0x0000, /* R783 */
2361 0x4050, /* R784 - AIF2 Control (1) */
2362 0x4000, /* R785 - AIF2 Control (2) */
2363 0x0000, /* R786 - AIF2 Master/Slave */
2364 0x0040, /* R787 - AIF2 BCLK */
2365 0x0040, /* R788 - AIF2ADC LRCLK */
2366 0x0040, /* R789 - AIF2DAC LRCLK */
2367 0x0000, /* R790 - AIF2DAC Data */
2368 0x0000, /* R791 - AIF2ADC Data */
2369 0x0000, /* R792 */
2370 0x0000, /* R793 */
2371 0x0000, /* R794 */
2372 0x0000, /* R795 */
2373 0x0000, /* R796 */
2374 0x0000, /* R797 */
2375 0x0000, /* R798 */
2376 0x0000, /* R799 */
2377 0x0000, /* R800 */
2378 0x0000, /* R801 */
2379 0x0000, /* R802 */
2380 0x0000, /* R803 */
2381 0x0000, /* R804 */
2382 0x0000, /* R805 */
2383 0x0000, /* R806 */
2384 0x0000, /* R807 */
2385 0x0000, /* R808 */
2386 0x0000, /* R809 */
2387 0x0000, /* R810 */
2388 0x0000, /* R811 */
2389 0x0000, /* R812 */
2390 0x0000, /* R813 */
2391 0x0000, /* R814 */
2392 0x0000, /* R815 */
2393 0x0000, /* R816 */
2394 0x0000, /* R817 */
2395 0x0000, /* R818 */
2396 0x0000, /* R819 */
2397 0x0000, /* R820 */
2398 0x0000, /* R821 */
2399 0x0000, /* R822 */
2400 0x0000, /* R823 */
2401 0x0000, /* R824 */
2402 0x0000, /* R825 */
2403 0x0000, /* R826 */
2404 0x0000, /* R827 */
2405 0x0000, /* R828 */
2406 0x0000, /* R829 */
2407 0x0000, /* R830 */
2408 0x0000, /* R831 */
2409 0x0000, /* R832 */
2410 0x0000, /* R833 */
2411 0x0000, /* R834 */
2412 0x0000, /* R835 */
2413 0x0000, /* R836 */
2414 0x0000, /* R837 */
2415 0x0000, /* R838 */
2416 0x0000, /* R839 */
2417 0x0000, /* R840 */
2418 0x0000, /* R841 */
2419 0x0000, /* R842 */
2420 0x0000, /* R843 */
2421 0x0000, /* R844 */
2422 0x0000, /* R845 */
2423 0x0000, /* R846 */
2424 0x0000, /* R847 */
2425 0x0000, /* R848 */
2426 0x0000, /* R849 */
2427 0x0000, /* R850 */
2428 0x0000, /* R851 */
2429 0x0000, /* R852 */
2430 0x0000, /* R853 */
2431 0x0000, /* R854 */
2432 0x0000, /* R855 */
2433 0x0000, /* R856 */
2434 0x0000, /* R857 */
2435 0x0000, /* R858 */
2436 0x0000, /* R859 */
2437 0x0000, /* R860 */
2438 0x0000, /* R861 */
2439 0x0000, /* R862 */
2440 0x0000, /* R863 */
2441 0x0000, /* R864 */
2442 0x0000, /* R865 */
2443 0x0000, /* R866 */
2444 0x0000, /* R867 */
2445 0x0000, /* R868 */
2446 0x0000, /* R869 */
2447 0x0000, /* R870 */
2448 0x0000, /* R871 */
2449 0x0000, /* R872 */
2450 0x0000, /* R873 */
2451 0x0000, /* R874 */
2452 0x0000, /* R875 */
2453 0x0000, /* R876 */
2454 0x0000, /* R877 */
2455 0x0000, /* R878 */
2456 0x0000, /* R879 */
2457 0x0000, /* R880 */
2458 0x0000, /* R881 */
2459 0x0000, /* R882 */
2460 0x0000, /* R883 */
2461 0x0000, /* R884 */
2462 0x0000, /* R885 */
2463 0x0000, /* R886 */
2464 0x0000, /* R887 */
2465 0x0000, /* R888 */
2466 0x0000, /* R889 */
2467 0x0000, /* R890 */
2468 0x0000, /* R891 */
2469 0x0000, /* R892 */
2470 0x0000, /* R893 */
2471 0x0000, /* R894 */
2472 0x0000, /* R895 */
2473 0x0000, /* R896 */
2474 0x0000, /* R897 */
2475 0x0000, /* R898 */
2476 0x0000, /* R899 */
2477 0x0000, /* R900 */
2478 0x0000, /* R901 */
2479 0x0000, /* R902 */
2480 0x0000, /* R903 */
2481 0x0000, /* R904 */
2482 0x0000, /* R905 */
2483 0x0000, /* R906 */
2484 0x0000, /* R907 */
2485 0x0000, /* R908 */
2486 0x0000, /* R909 */
2487 0x0000, /* R910 */
2488 0x0000, /* R911 */
2489 0x0000, /* R912 */
2490 0x0000, /* R913 */
2491 0x0000, /* R914 */
2492 0x0000, /* R915 */
2493 0x0000, /* R916 */
2494 0x0000, /* R917 */
2495 0x0000, /* R918 */
2496 0x0000, /* R919 */
2497 0x0000, /* R920 */
2498 0x0000, /* R921 */
2499 0x0000, /* R922 */
2500 0x0000, /* R923 */
2501 0x0000, /* R924 */
2502 0x0000, /* R925 */
2503 0x0000, /* R926 */
2504 0x0000, /* R927 */
2505 0x0000, /* R928 */
2506 0x0000, /* R929 */
2507 0x0000, /* R930 */
2508 0x0000, /* R931 */
2509 0x0000, /* R932 */
2510 0x0000, /* R933 */
2511 0x0000, /* R934 */
2512 0x0000, /* R935 */
2513 0x0000, /* R936 */
2514 0x0000, /* R937 */
2515 0x0000, /* R938 */
2516 0x0000, /* R939 */
2517 0x0000, /* R940 */
2518 0x0000, /* R941 */
2519 0x0000, /* R942 */
2520 0x0000, /* R943 */
2521 0x0000, /* R944 */
2522 0x0000, /* R945 */
2523 0x0000, /* R946 */
2524 0x0000, /* R947 */
2525 0x0000, /* R948 */
2526 0x0000, /* R949 */
2527 0x0000, /* R950 */
2528 0x0000, /* R951 */
2529 0x0000, /* R952 */
2530 0x0000, /* R953 */
2531 0x0000, /* R954 */
2532 0x0000, /* R955 */
2533 0x0000, /* R956 */
2534 0x0000, /* R957 */
2535 0x0000, /* R958 */
2536 0x0000, /* R959 */
2537 0x0000, /* R960 */
2538 0x0000, /* R961 */
2539 0x0000, /* R962 */
2540 0x0000, /* R963 */
2541 0x0000, /* R964 */
2542 0x0000, /* R965 */
2543 0x0000, /* R966 */
2544 0x0000, /* R967 */
2545 0x0000, /* R968 */
2546 0x0000, /* R969 */
2547 0x0000, /* R970 */
2548 0x0000, /* R971 */
2549 0x0000, /* R972 */
2550 0x0000, /* R973 */
2551 0x0000, /* R974 */
2552 0x0000, /* R975 */
2553 0x0000, /* R976 */
2554 0x0000, /* R977 */
2555 0x0000, /* R978 */
2556 0x0000, /* R979 */
2557 0x0000, /* R980 */
2558 0x0000, /* R981 */
2559 0x0000, /* R982 */
2560 0x0000, /* R983 */
2561 0x0000, /* R984 */
2562 0x0000, /* R985 */
2563 0x0000, /* R986 */
2564 0x0000, /* R987 */
2565 0x0000, /* R988 */
2566 0x0000, /* R989 */
2567 0x0000, /* R990 */
2568 0x0000, /* R991 */
2569 0x0000, /* R992 */
2570 0x0000, /* R993 */
2571 0x0000, /* R994 */
2572 0x0000, /* R995 */
2573 0x0000, /* R996 */
2574 0x0000, /* R997 */
2575 0x0000, /* R998 */
2576 0x0000, /* R999 */
2577 0x0000, /* R1000 */
2578 0x0000, /* R1001 */
2579 0x0000, /* R1002 */
2580 0x0000, /* R1003 */
2581 0x0000, /* R1004 */
2582 0x0000, /* R1005 */
2583 0x0000, /* R1006 */
2584 0x0000, /* R1007 */
2585 0x0000, /* R1008 */
2586 0x0000, /* R1009 */
2587 0x0000, /* R1010 */
2588 0x0000, /* R1011 */
2589 0x0000, /* R1012 */
2590 0x0000, /* R1013 */
2591 0x0000, /* R1014 */
2592 0x0000, /* R1015 */
2593 0x0000, /* R1016 */
2594 0x0000, /* R1017 */
2595 0x0000, /* R1018 */
2596 0x0000, /* R1019 */
2597 0x0000, /* R1020 */
2598 0x0000, /* R1021 */
2599 0x0000, /* R1022 */
2600 0x0000, /* R1023 */
2601 0x00C0, /* R1024 - AIF1 ADC1 Left Volume */
2602 0x00C0, /* R1025 - AIF1 ADC1 Right Volume */
2603 0x00C0, /* R1026 - AIF1 DAC1 Left Volume */
2604 0x00C0, /* R1027 - AIF1 DAC1 Right Volume */
2605 0x00C0, /* R1028 - AIF1 ADC2 Left Volume */
2606 0x00C0, /* R1029 - AIF1 ADC2 Right Volume */
2607 0x00C0, /* R1030 - AIF1 DAC2 Left Volume */
2608 0x00C0, /* R1031 - AIF1 DAC2 Right Volume */
2609 0x0000, /* R1032 */
2610 0x0000, /* R1033 */
2611 0x0000, /* R1034 */
2612 0x0000, /* R1035 */
2613 0x0000, /* R1036 */
2614 0x0000, /* R1037 */
2615 0x0000, /* R1038 */
2616 0x0000, /* R1039 */
2617 0x0000, /* R1040 - AIF1 ADC1 Filters */
2618 0x0000, /* R1041 - AIF1 ADC2 Filters */
2619 0x0000, /* R1042 */
2620 0x0000, /* R1043 */
2621 0x0000, /* R1044 */
2622 0x0000, /* R1045 */
2623 0x0000, /* R1046 */
2624 0x0000, /* R1047 */
2625 0x0000, /* R1048 */
2626 0x0000, /* R1049 */
2627 0x0000, /* R1050 */
2628 0x0000, /* R1051 */
2629 0x0000, /* R1052 */
2630 0x0000, /* R1053 */
2631 0x0000, /* R1054 */
2632 0x0000, /* R1055 */
2633 0x0200, /* R1056 - AIF1 DAC1 Filters (1) */
2634 0x0010, /* R1057 - AIF1 DAC1 Filters (2) */
2635 0x0200, /* R1058 - AIF1 DAC2 Filters (1) */
2636 0x0010, /* R1059 - AIF1 DAC2 Filters (2) */
2637 0x0000, /* R1060 */
2638 0x0000, /* R1061 */
2639 0x0000, /* R1062 */
2640 0x0000, /* R1063 */
2641 0x0000, /* R1064 */
2642 0x0000, /* R1065 */
2643 0x0000, /* R1066 */
2644 0x0000, /* R1067 */
2645 0x0000, /* R1068 */
2646 0x0000, /* R1069 */
2647 0x0000, /* R1070 */
2648 0x0000, /* R1071 */
2649 0x0068, /* R1072 - AIF1 DAC1 Noise Gate */
2650 0x0068, /* R1073 - AIF1 DAC2 Noise Gate */
2651 0x0000, /* R1074 */
2652 0x0000, /* R1075 */
2653 0x0000, /* R1076 */
2654 0x0000, /* R1077 */
2655 0x0000, /* R1078 */
2656 0x0000, /* R1079 */
2657 0x0000, /* R1080 */
2658 0x0000, /* R1081 */
2659 0x0000, /* R1082 */
2660 0x0000, /* R1083 */
2661 0x0000, /* R1084 */
2662 0x0000, /* R1085 */
2663 0x0000, /* R1086 */
2664 0x0000, /* R1087 */
2665 0x0098, /* R1088 - AIF1 DRC1 (1) */
2666 0x0845, /* R1089 - AIF1 DRC1 (2) */
2667 0x0000, /* R1090 - AIF1 DRC1 (3) */
2668 0x0000, /* R1091 - AIF1 DRC1 (4) */
2669 0x0000, /* R1092 - AIF1 DRC1 (5) */
2670 0x0000, /* R1093 */
2671 0x0000, /* R1094 */
2672 0x0000, /* R1095 */
2673 0x0000, /* R1096 */
2674 0x0000, /* R1097 */
2675 0x0000, /* R1098 */
2676 0x0000, /* R1099 */
2677 0x0000, /* R1100 */
2678 0x0000, /* R1101 */
2679 0x0000, /* R1102 */
2680 0x0000, /* R1103 */
2681 0x0098, /* R1104 - AIF1 DRC2 (1) */
2682 0x0845, /* R1105 - AIF1 DRC2 (2) */
2683 0x0000, /* R1106 - AIF1 DRC2 (3) */
2684 0x0000, /* R1107 - AIF1 DRC2 (4) */
2685 0x0000, /* R1108 - AIF1 DRC2 (5) */
2686 0x0000, /* R1109 */
2687 0x0000, /* R1110 */
2688 0x0000, /* R1111 */
2689 0x0000, /* R1112 */
2690 0x0000, /* R1113 */
2691 0x0000, /* R1114 */
2692 0x0000, /* R1115 */
2693 0x0000, /* R1116 */
2694 0x0000, /* R1117 */
2695 0x0000, /* R1118 */
2696 0x0000, /* R1119 */
2697 0x0000, /* R1120 */
2698 0x0000, /* R1121 */
2699 0x0000, /* R1122 */
2700 0x0000, /* R1123 */
2701 0x0000, /* R1124 */
2702 0x0000, /* R1125 */
2703 0x0000, /* R1126 */
2704 0x0000, /* R1127 */
2705 0x0000, /* R1128 */
2706 0x0000, /* R1129 */
2707 0x0000, /* R1130 */
2708 0x0000, /* R1131 */
2709 0x0000, /* R1132 */
2710 0x0000, /* R1133 */
2711 0x0000, /* R1134 */
2712 0x0000, /* R1135 */
2713 0x0000, /* R1136 */
2714 0x0000, /* R1137 */
2715 0x0000, /* R1138 */
2716 0x0000, /* R1139 */
2717 0x0000, /* R1140 */
2718 0x0000, /* R1141 */
2719 0x0000, /* R1142 */
2720 0x0000, /* R1143 */
2721 0x0000, /* R1144 */
2722 0x0000, /* R1145 */
2723 0x0000, /* R1146 */
2724 0x0000, /* R1147 */
2725 0x0000, /* R1148 */
2726 0x0000, /* R1149 */
2727 0x0000, /* R1150 */
2728 0x0000, /* R1151 */
2729 0x6318, /* R1152 - AIF1 DAC1 EQ Gains (1) */
2730 0x6300, /* R1153 - AIF1 DAC1 EQ Gains (2) */
2731 0x0FCA, /* R1154 - AIF1 DAC1 EQ Band 1 A */
2732 0x0400, /* R1155 - AIF1 DAC1 EQ Band 1 B */
2733 0x00D8, /* R1156 - AIF1 DAC1 EQ Band 1 PG */
2734 0x1EB5, /* R1157 - AIF1 DAC1 EQ Band 2 A */
2735 0xF145, /* R1158 - AIF1 DAC1 EQ Band 2 B */
2736 0x0B75, /* R1159 - AIF1 DAC1 EQ Band 2 C */
2737 0x01C5, /* R1160 - AIF1 DAC1 EQ Band 2 PG */
2738 0x1C58, /* R1161 - AIF1 DAC1 EQ Band 3 A */
2739 0xF373, /* R1162 - AIF1 DAC1 EQ Band 3 B */
2740 0x0A54, /* R1163 - AIF1 DAC1 EQ Band 3 C */
2741 0x0558, /* R1164 - AIF1 DAC1 EQ Band 3 PG */
2742 0x168E, /* R1165 - AIF1 DAC1 EQ Band 4 A */
2743 0xF829, /* R1166 - AIF1 DAC1 EQ Band 4 B */
2744 0x07AD, /* R1167 - AIF1 DAC1 EQ Band 4 C */
2745 0x1103, /* R1168 - AIF1 DAC1 EQ Band 4 PG */
2746 0x0564, /* R1169 - AIF1 DAC1 EQ Band 5 A */
2747 0x0559, /* R1170 - AIF1 DAC1 EQ Band 5 B */
2748 0x4000, /* R1171 - AIF1 DAC1 EQ Band 5 PG */
2749 0x0000, /* R1172 */
2750 0x0000, /* R1173 */
2751 0x0000, /* R1174 */
2752 0x0000, /* R1175 */
2753 0x0000, /* R1176 */
2754 0x0000, /* R1177 */
2755 0x0000, /* R1178 */
2756 0x0000, /* R1179 */
2757 0x0000, /* R1180 */
2758 0x0000, /* R1181 */
2759 0x0000, /* R1182 */
2760 0x0000, /* R1183 */
2761 0x6318, /* R1184 - AIF1 DAC2 EQ Gains (1) */
2762 0x6300, /* R1185 - AIF1 DAC2 EQ Gains (2) */
2763 0x0FCA, /* R1186 - AIF1 DAC2 EQ Band 1 A */
2764 0x0400, /* R1187 - AIF1 DAC2 EQ Band 1 B */
2765 0x00D8, /* R1188 - AIF1 DAC2 EQ Band 1 PG */
2766 0x1EB5, /* R1189 - AIF1 DAC2 EQ Band 2 A */
2767 0xF145, /* R1190 - AIF1 DAC2 EQ Band 2 B */
2768 0x0B75, /* R1191 - AIF1 DAC2 EQ Band 2 C */
2769 0x01C5, /* R1192 - AIF1 DAC2 EQ Band 2 PG */
2770 0x1C58, /* R1193 - AIF1 DAC2 EQ Band 3 A */
2771 0xF373, /* R1194 - AIF1 DAC2 EQ Band 3 B */
2772 0x0A54, /* R1195 - AIF1 DAC2 EQ Band 3 C */
2773 0x0558, /* R1196 - AIF1 DAC2 EQ Band 3 PG */
2774 0x168E, /* R1197 - AIF1 DAC2 EQ Band 4 A */
2775 0xF829, /* R1198 - AIF1 DAC2 EQ Band 4 B */
2776 0x07AD, /* R1199 - AIF1 DAC2 EQ Band 4 C */
2777 0x1103, /* R1200 - AIF1 DAC2 EQ Band 4 PG */
2778 0x0564, /* R1201 - AIF1 DAC2 EQ Band 5 A */
2779 0x0559, /* R1202 - AIF1 DAC2 EQ Band 5 B */
2780 0x4000, /* R1203 - AIF1 DAC2 EQ Band 5 PG */
2781 0x0000, /* R1204 */
2782 0x0000, /* R1205 */
2783 0x0000, /* R1206 */
2784 0x0000, /* R1207 */
2785 0x0000, /* R1208 */
2786 0x0000, /* R1209 */
2787 0x0000, /* R1210 */
2788 0x0000, /* R1211 */
2789 0x0000, /* R1212 */
2790 0x0000, /* R1213 */
2791 0x0000, /* R1214 */
2792 0x0000, /* R1215 */
2793 0x0000, /* R1216 */
2794 0x0000, /* R1217 */
2795 0x0000, /* R1218 */
2796 0x0000, /* R1219 */
2797 0x0000, /* R1220 */
2798 0x0000, /* R1221 */
2799 0x0000, /* R1222 */
2800 0x0000, /* R1223 */
2801 0x0000, /* R1224 */
2802 0x0000, /* R1225 */
2803 0x0000, /* R1226 */
2804 0x0000, /* R1227 */
2805 0x0000, /* R1228 */
2806 0x0000, /* R1229 */
2807 0x0000, /* R1230 */
2808 0x0000, /* R1231 */
2809 0x0000, /* R1232 */
2810 0x0000, /* R1233 */
2811 0x0000, /* R1234 */
2812 0x0000, /* R1235 */
2813 0x0000, /* R1236 */
2814 0x0000, /* R1237 */
2815 0x0000, /* R1238 */
2816 0x0000, /* R1239 */
2817 0x0000, /* R1240 */
2818 0x0000, /* R1241 */
2819 0x0000, /* R1242 */
2820 0x0000, /* R1243 */
2821 0x0000, /* R1244 */
2822 0x0000, /* R1245 */
2823 0x0000, /* R1246 */
2824 0x0000, /* R1247 */
2825 0x0000, /* R1248 */
2826 0x0000, /* R1249 */
2827 0x0000, /* R1250 */
2828 0x0000, /* R1251 */
2829 0x0000, /* R1252 */
2830 0x0000, /* R1253 */
2831 0x0000, /* R1254 */
2832 0x0000, /* R1255 */
2833 0x0000, /* R1256 */
2834 0x0000, /* R1257 */
2835 0x0000, /* R1258 */
2836 0x0000, /* R1259 */
2837 0x0000, /* R1260 */
2838 0x0000, /* R1261 */
2839 0x0000, /* R1262 */
2840 0x0000, /* R1263 */
2841 0x0000, /* R1264 */
2842 0x0000, /* R1265 */
2843 0x0000, /* R1266 */
2844 0x0000, /* R1267 */
2845 0x0000, /* R1268 */
2846 0x0000, /* R1269 */
2847 0x0000, /* R1270 */
2848 0x0000, /* R1271 */
2849 0x0000, /* R1272 */
2850 0x0000, /* R1273 */
2851 0x0000, /* R1274 */
2852 0x0000, /* R1275 */
2853 0x0000, /* R1276 */
2854 0x0000, /* R1277 */
2855 0x0000, /* R1278 */
2856 0x0000, /* R1279 */
2857 0x00C0, /* R1280 - AIF2 ADC Left Volume */
2858 0x00C0, /* R1281 - AIF2 ADC Right Volume */
2859 0x00C0, /* R1282 - AIF2 DAC Left Volume */
2860 0x00C0, /* R1283 - AIF2 DAC Right Volume */
2861 0x0000, /* R1284 */
2862 0x0000, /* R1285 */
2863 0x0000, /* R1286 */
2864 0x0000, /* R1287 */
2865 0x0000, /* R1288 */
2866 0x0000, /* R1289 */
2867 0x0000, /* R1290 */
2868 0x0000, /* R1291 */
2869 0x0000, /* R1292 */
2870 0x0000, /* R1293 */
2871 0x0000, /* R1294 */
2872 0x0000, /* R1295 */
2873 0x0000, /* R1296 - AIF2 ADC Filters */
2874 0x0000, /* R1297 */
2875 0x0000, /* R1298 */
2876 0x0000, /* R1299 */
2877 0x0000, /* R1300 */
2878 0x0000, /* R1301 */
2879 0x0000, /* R1302 */
2880 0x0000, /* R1303 */
2881 0x0000, /* R1304 */
2882 0x0000, /* R1305 */
2883 0x0000, /* R1306 */
2884 0x0000, /* R1307 */
2885 0x0000, /* R1308 */
2886 0x0000, /* R1309 */
2887 0x0000, /* R1310 */
2888 0x0000, /* R1311 */
2889 0x0200, /* R1312 - AIF2 DAC Filters (1) */
2890 0x0010, /* R1313 - AIF2 DAC Filters (2) */
2891 0x0000, /* R1314 */
2892 0x0000, /* R1315 */
2893 0x0000, /* R1316 */
2894 0x0000, /* R1317 */
2895 0x0000, /* R1318 */
2896 0x0000, /* R1319 */
2897 0x0000, /* R1320 */
2898 0x0000, /* R1321 */
2899 0x0000, /* R1322 */
2900 0x0000, /* R1323 */
2901 0x0000, /* R1324 */
2902 0x0000, /* R1325 */
2903 0x0000, /* R1326 */
2904 0x0000, /* R1327 */
2905 0x0068, /* R1328 - AIF2 DAC Noise Gate */
2906 0x0000, /* R1329 */
2907 0x0000, /* R1330 */
2908 0x0000, /* R1331 */
2909 0x0000, /* R1332 */
2910 0x0000, /* R1333 */
2911 0x0000, /* R1334 */
2912 0x0000, /* R1335 */
2913 0x0000, /* R1336 */
2914 0x0000, /* R1337 */
2915 0x0000, /* R1338 */
2916 0x0000, /* R1339 */
2917 0x0000, /* R1340 */
2918 0x0000, /* R1341 */
2919 0x0000, /* R1342 */
2920 0x0000, /* R1343 */
2921 0x0098, /* R1344 - AIF2 DRC (1) */
2922 0x0845, /* R1345 - AIF2 DRC (2) */
2923 0x0000, /* R1346 - AIF2 DRC (3) */
2924 0x0000, /* R1347 - AIF2 DRC (4) */
2925 0x0000, /* R1348 - AIF2 DRC (5) */
2926 0x0000, /* R1349 */
2927 0x0000, /* R1350 */
2928 0x0000, /* R1351 */
2929 0x0000, /* R1352 */
2930 0x0000, /* R1353 */
2931 0x0000, /* R1354 */
2932 0x0000, /* R1355 */
2933 0x0000, /* R1356 */
2934 0x0000, /* R1357 */
2935 0x0000, /* R1358 */
2936 0x0000, /* R1359 */
2937 0x0000, /* R1360 */
2938 0x0000, /* R1361 */
2939 0x0000, /* R1362 */
2940 0x0000, /* R1363 */
2941 0x0000, /* R1364 */
2942 0x0000, /* R1365 */
2943 0x0000, /* R1366 */
2944 0x0000, /* R1367 */
2945 0x0000, /* R1368 */
2946 0x0000, /* R1369 */
2947 0x0000, /* R1370 */
2948 0x0000, /* R1371 */
2949 0x0000, /* R1372 */
2950 0x0000, /* R1373 */
2951 0x0000, /* R1374 */
2952 0x0000, /* R1375 */
2953 0x0000, /* R1376 */
2954 0x0000, /* R1377 */
2955 0x0000, /* R1378 */
2956 0x0000, /* R1379 */
2957 0x0000, /* R1380 */
2958 0x0000, /* R1381 */
2959 0x0000, /* R1382 */
2960 0x0000, /* R1383 */
2961 0x0000, /* R1384 */
2962 0x0000, /* R1385 */
2963 0x0000, /* R1386 */
2964 0x0000, /* R1387 */
2965 0x0000, /* R1388 */
2966 0x0000, /* R1389 */
2967 0x0000, /* R1390 */
2968 0x0000, /* R1391 */
2969 0x0000, /* R1392 */
2970 0x0000, /* R1393 */
2971 0x0000, /* R1394 */
2972 0x0000, /* R1395 */
2973 0x0000, /* R1396 */
2974 0x0000, /* R1397 */
2975 0x0000, /* R1398 */
2976 0x0000, /* R1399 */
2977 0x0000, /* R1400 */
2978 0x0000, /* R1401 */
2979 0x0000, /* R1402 */
2980 0x0000, /* R1403 */
2981 0x0000, /* R1404 */
2982 0x0000, /* R1405 */
2983 0x0000, /* R1406 */
2984 0x0000, /* R1407 */
2985 0x6318, /* R1408 - AIF2 EQ Gains (1) */
2986 0x6300, /* R1409 - AIF2 EQ Gains (2) */
2987 0x0FCA, /* R1410 - AIF2 EQ Band 1 A */
2988 0x0400, /* R1411 - AIF2 EQ Band 1 B */
2989 0x00D8, /* R1412 - AIF2 EQ Band 1 PG */
2990 0x1EB5, /* R1413 - AIF2 EQ Band 2 A */
2991 0xF145, /* R1414 - AIF2 EQ Band 2 B */
2992 0x0B75, /* R1415 - AIF2 EQ Band 2 C */
2993 0x01C5, /* R1416 - AIF2 EQ Band 2 PG */
2994 0x1C58, /* R1417 - AIF2 EQ Band 3 A */
2995 0xF373, /* R1418 - AIF2 EQ Band 3 B */
2996 0x0A54, /* R1419 - AIF2 EQ Band 3 C */
2997 0x0558, /* R1420 - AIF2 EQ Band 3 PG */
2998 0x168E, /* R1421 - AIF2 EQ Band 4 A */
2999 0xF829, /* R1422 - AIF2 EQ Band 4 B */
3000 0x07AD, /* R1423 - AIF2 EQ Band 4 C */
3001 0x1103, /* R1424 - AIF2 EQ Band 4 PG */
3002 0x0564, /* R1425 - AIF2 EQ Band 5 A */
3003 0x0559, /* R1426 - AIF2 EQ Band 5 B */
3004 0x4000, /* R1427 - AIF2 EQ Band 5 PG */
3005 0x0000, /* R1428 */
3006 0x0000, /* R1429 */
3007 0x0000, /* R1430 */
3008 0x0000, /* R1431 */
3009 0x0000, /* R1432 */
3010 0x0000, /* R1433 */
3011 0x0000, /* R1434 */
3012 0x0000, /* R1435 */
3013 0x0000, /* R1436 */
3014 0x0000, /* R1437 */
3015 0x0000, /* R1438 */
3016 0x0000, /* R1439 */
3017 0x0000, /* R1440 */
3018 0x0000, /* R1441 */
3019 0x0000, /* R1442 */
3020 0x0000, /* R1443 */
3021 0x0000, /* R1444 */
3022 0x0000, /* R1445 */
3023 0x0000, /* R1446 */
3024 0x0000, /* R1447 */
3025 0x0000, /* R1448 */
3026 0x0000, /* R1449 */
3027 0x0000, /* R1450 */
3028 0x0000, /* R1451 */
3029 0x0000, /* R1452 */
3030 0x0000, /* R1453 */
3031 0x0000, /* R1454 */
3032 0x0000, /* R1455 */
3033 0x0000, /* R1456 */
3034 0x0000, /* R1457 */
3035 0x0000, /* R1458 */
3036 0x0000, /* R1459 */
3037 0x0000, /* R1460 */
3038 0x0000, /* R1461 */
3039 0x0000, /* R1462 */
3040 0x0000, /* R1463 */
3041 0x0000, /* R1464 */
3042 0x0000, /* R1465 */
3043 0x0000, /* R1466 */
3044 0x0000, /* R1467 */
3045 0x0000, /* R1468 */
3046 0x0000, /* R1469 */
3047 0x0000, /* R1470 */
3048 0x0000, /* R1471 */
3049 0x0000, /* R1472 */
3050 0x0000, /* R1473 */
3051 0x0000, /* R1474 */
3052 0x0000, /* R1475 */
3053 0x0000, /* R1476 */
3054 0x0000, /* R1477 */
3055 0x0000, /* R1478 */
3056 0x0000, /* R1479 */
3057 0x0000, /* R1480 */
3058 0x0000, /* R1481 */
3059 0x0000, /* R1482 */
3060 0x0000, /* R1483 */
3061 0x0000, /* R1484 */
3062 0x0000, /* R1485 */
3063 0x0000, /* R1486 */
3064 0x0000, /* R1487 */
3065 0x0000, /* R1488 */
3066 0x0000, /* R1489 */
3067 0x0000, /* R1490 */
3068 0x0000, /* R1491 */
3069 0x0000, /* R1492 */
3070 0x0000, /* R1493 */
3071 0x0000, /* R1494 */
3072 0x0000, /* R1495 */
3073 0x0000, /* R1496 */
3074 0x0000, /* R1497 */
3075 0x0000, /* R1498 */
3076 0x0000, /* R1499 */
3077 0x0000, /* R1500 */
3078 0x0000, /* R1501 */
3079 0x0000, /* R1502 */
3080 0x0000, /* R1503 */
3081 0x0000, /* R1504 */
3082 0x0000, /* R1505 */
3083 0x0000, /* R1506 */
3084 0x0000, /* R1507 */
3085 0x0000, /* R1508 */
3086 0x0000, /* R1509 */
3087 0x0000, /* R1510 */
3088 0x0000, /* R1511 */
3089 0x0000, /* R1512 */
3090 0x0000, /* R1513 */
3091 0x0000, /* R1514 */
3092 0x0000, /* R1515 */
3093 0x0000, /* R1516 */
3094 0x0000, /* R1517 */
3095 0x0000, /* R1518 */
3096 0x0000, /* R1519 */
3097 0x0000, /* R1520 */
3098 0x0000, /* R1521 */
3099 0x0000, /* R1522 */
3100 0x0000, /* R1523 */
3101 0x0000, /* R1524 */
3102 0x0000, /* R1525 */
3103 0x0000, /* R1526 */
3104 0x0000, /* R1527 */
3105 0x0000, /* R1528 */
3106 0x0000, /* R1529 */
3107 0x0000, /* R1530 */
3108 0x0000, /* R1531 */
3109 0x0000, /* R1532 */
3110 0x0000, /* R1533 */
3111 0x0000, /* R1534 */
3112 0x0000, /* R1535 */
3113 0x0000, /* R1536 - DAC1 Mixer Volumes */
3114 0x0000, /* R1537 - DAC1 Left Mixer Routing */
3115 0x0000, /* R1538 - DAC1 Right Mixer Routing */
3116 0x0000, /* R1539 - DAC2 Mixer Volumes */
3117 0x0000, /* R1540 - DAC2 Left Mixer Routing */
3118 0x0000, /* R1541 - DAC2 Right Mixer Routing */
3119 0x0000, /* R1542 - AIF1 ADC1 Left Mixer Routing */
3120 0x0000, /* R1543 - AIF1 ADC1 Right Mixer Routing */
3121 0x0000, /* R1544 - AIF1 ADC2 Left Mixer Routing */
3122 0x0000, /* R1545 - AIF1 ADC2 Right mixer Routing */
3123 0x0000, /* R1546 */
3124 0x0000, /* R1547 */
3125 0x0000, /* R1548 */
3126 0x0000, /* R1549 */
3127 0x0000, /* R1550 */
3128 0x0000, /* R1551 */
3129 0x02C0, /* R1552 - DAC1 Left Volume */
3130 0x02C0, /* R1553 - DAC1 Right Volume */
3131 0x02C0, /* R1554 - DAC2 Left Volume */
3132 0x02C0, /* R1555 - DAC2 Right Volume */
3133 0x0000, /* R1556 - DAC Softmute */
3134 0x0000, /* R1557 */
3135 0x0000, /* R1558 */
3136 0x0000, /* R1559 */
3137 0x0000, /* R1560 */
3138 0x0000, /* R1561 */
3139 0x0000, /* R1562 */
3140 0x0000, /* R1563 */
3141 0x0000, /* R1564 */
3142 0x0000, /* R1565 */
3143 0x0000, /* R1566 */
3144 0x0000, /* R1567 */
3145 0x0002, /* R1568 - Oversampling */
3146 0x0000, /* R1569 - Sidetone */
3147};
diff --git a/sound/soc/codecs/wm8994.c b/sound/soc/codecs/wm8994.c
index 6c298854900..93d27b66025 100644
--- a/sound/soc/codecs/wm8994.c
+++ b/sound/soc/codecs/wm8994.c
@@ -38,6 +38,11 @@
38#include "wm8994.h" 38#include "wm8994.h"
39#include "wm_hubs.h" 39#include "wm_hubs.h"
40 40
41#define WM1811_JACKDET_MODE_NONE 0x0000
42#define WM1811_JACKDET_MODE_JACK 0x0100
43#define WM1811_JACKDET_MODE_MIC 0x0080
44#define WM1811_JACKDET_MODE_AUDIO 0x0180
45
41#define WM8994_NUM_DRC 3 46#define WM8994_NUM_DRC 3
42#define WM8994_NUM_EQ 3 47#define WM8994_NUM_EQ 3
43 48
@@ -53,103 +58,69 @@ static int wm8994_retune_mobile_base[] = {
53 WM8994_AIF2_EQ_GAINS_1, 58 WM8994_AIF2_EQ_GAINS_1,
54}; 59};
55 60
56static int wm8994_readable(struct snd_soc_codec *codec, unsigned int reg) 61static void wm8958_default_micdet(u16 status, void *data);
57{
58 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
59 struct wm8994 *control = codec->control_data;
60
61 switch (reg) {
62 case WM8994_GPIO_1:
63 case WM8994_GPIO_2:
64 case WM8994_GPIO_3:
65 case WM8994_GPIO_4:
66 case WM8994_GPIO_5:
67 case WM8994_GPIO_6:
68 case WM8994_GPIO_7:
69 case WM8994_GPIO_8:
70 case WM8994_GPIO_9:
71 case WM8994_GPIO_10:
72 case WM8994_GPIO_11:
73 case WM8994_INTERRUPT_STATUS_1:
74 case WM8994_INTERRUPT_STATUS_2:
75 case WM8994_INTERRUPT_RAW_STATUS_2:
76 return 1;
77
78 case WM8958_DSP2_PROGRAM:
79 case WM8958_DSP2_CONFIG:
80 case WM8958_DSP2_EXECCONTROL:
81 if (control->type == WM8958)
82 return 1;
83 else
84 return 0;
85 62
86 default: 63static const struct wm8958_micd_rate micdet_rates[] = {
87 break; 64 { 32768, true, 1, 4 },
88 } 65 { 32768, false, 1, 1 },
66 { 44100 * 256, true, 7, 10 },
67 { 44100 * 256, false, 7, 10 },
68};
89 69
90 if (reg >= WM8994_CACHE_SIZE) 70static const struct wm8958_micd_rate jackdet_rates[] = {
91 return 0; 71 { 32768, true, 0, 1 },
92 return wm8994_access_masks[reg].readable != 0; 72 { 32768, false, 0, 1 },
93} 73 { 44100 * 256, true, 7, 10 },
74 { 44100 * 256, false, 7, 10 },
75};
94 76
95static int wm8994_volatile(struct snd_soc_codec *codec, unsigned int reg) 77static void wm8958_micd_set_rate(struct snd_soc_codec *codec)
96{ 78{
97 if (reg >= WM8994_CACHE_SIZE) 79 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
98 return 1; 80 int best, i, sysclk, val;
99 81 bool idle;
100 switch (reg) { 82 const struct wm8958_micd_rate *rates;
101 case WM8994_SOFTWARE_RESET: 83 int num_rates;
102 case WM8994_CHIP_REVISION:
103 case WM8994_DC_SERVO_1:
104 case WM8994_DC_SERVO_READBACK:
105 case WM8994_RATE_STATUS:
106 case WM8994_LDO_1:
107 case WM8994_LDO_2:
108 case WM8958_DSP2_EXECCONTROL:
109 case WM8958_MIC_DETECT_3:
110 case WM8994_DC_SERVO_4E:
111 return 1;
112 default:
113 return 0;
114 }
115}
116 84
117static int wm8994_write(struct snd_soc_codec *codec, unsigned int reg, 85 if (wm8994->jack_cb != wm8958_default_micdet)
118 unsigned int value) 86 return;
119{
120 int ret;
121 87
122 BUG_ON(reg > WM8994_MAX_REGISTER); 88 idle = !wm8994->jack_mic;
123 89
124 if (!wm8994_volatile(codec, reg)) { 90 sysclk = snd_soc_read(codec, WM8994_CLOCKING_1);
125 ret = snd_soc_cache_write(codec, reg, value); 91 if (sysclk & WM8994_SYSCLK_SRC)
126 if (ret != 0) 92 sysclk = wm8994->aifclk[1];
127 dev_err(codec->dev, "Cache write to %x failed: %d\n", 93 else
128 reg, ret); 94 sysclk = wm8994->aifclk[0];
95
96 if (wm8994->pdata && wm8994->pdata->micd_rates) {
97 rates = wm8994->pdata->micd_rates;
98 num_rates = wm8994->pdata->num_micd_rates;
99 } else if (wm8994->jackdet) {
100 rates = jackdet_rates;
101 num_rates = ARRAY_SIZE(jackdet_rates);
102 } else {
103 rates = micdet_rates;
104 num_rates = ARRAY_SIZE(micdet_rates);
129 } 105 }
130 106
131 return wm8994_reg_write(codec->control_data, reg, value); 107 best = 0;
132} 108 for (i = 0; i < num_rates; i++) {
133 109 if (rates[i].idle != idle)
134static unsigned int wm8994_read(struct snd_soc_codec *codec, 110 continue;
135 unsigned int reg) 111 if (abs(rates[i].sysclk - sysclk) <
136{ 112 abs(rates[best].sysclk - sysclk))
137 unsigned int val; 113 best = i;
138 int ret; 114 else if (rates[best].idle != idle)
139 115 best = i;
140 BUG_ON(reg > WM8994_MAX_REGISTER);
141
142 if (!wm8994_volatile(codec, reg) && wm8994_readable(codec, reg) &&
143 reg < codec->driver->reg_cache_size) {
144 ret = snd_soc_cache_read(codec, reg, &val);
145 if (ret >= 0)
146 return val;
147 else
148 dev_err(codec->dev, "Cache read from %x failed: %d\n",
149 reg, ret);
150 } 116 }
151 117
152 return wm8994_reg_read(codec->control_data, reg); 118 val = rates[best].start << WM8958_MICD_BIAS_STARTTIME_SHIFT
119 | rates[best].rate << WM8958_MICD_RATE_SHIFT;
120
121 snd_soc_update_bits(codec, WM8958_MIC_DETECT_1,
122 WM8958_MICD_BIAS_STARTTIME_MASK |
123 WM8958_MICD_RATE_MASK, val);
153} 124}
154 125
155static int configure_aif_clock(struct snd_soc_codec *codec, int aif) 126static int configure_aif_clock(struct snd_soc_codec *codec, int aif)
@@ -221,8 +192,10 @@ static int configure_clock(struct snd_soc_codec *codec)
221 */ 192 */
222 193
223 /* If they're equal it doesn't matter which is used */ 194 /* If they're equal it doesn't matter which is used */
224 if (wm8994->aifclk[0] == wm8994->aifclk[1]) 195 if (wm8994->aifclk[0] == wm8994->aifclk[1]) {
196 wm8958_micd_set_rate(codec);
225 return 0; 197 return 0;
198 }
226 199
227 if (wm8994->aifclk[0] < wm8994->aifclk[1]) 200 if (wm8994->aifclk[0] < wm8994->aifclk[1])
228 new = WM8994_SYSCLK_SRC; 201 new = WM8994_SYSCLK_SRC;
@@ -231,10 +204,10 @@ static int configure_clock(struct snd_soc_codec *codec)
231 204
232 change = snd_soc_update_bits(codec, WM8994_CLOCKING_1, 205 change = snd_soc_update_bits(codec, WM8994_CLOCKING_1,
233 WM8994_SYSCLK_SRC, new); 206 WM8994_SYSCLK_SRC, new);
234 if (!change) 207 if (change)
235 return 0; 208 snd_soc_dapm_sync(&codec->dapm);
236 209
237 snd_soc_dapm_sync(&codec->dapm); 210 wm8958_micd_set_rate(codec);
238 211
239 return 0; 212 return 0;
240} 213}
@@ -708,6 +681,74 @@ SOC_SINGLE_TLV("MIXINL IN1RP Boost Volume", WM8994_INPUT_MIXER_1, 8, 1, 0,
708 mixin_boost_tlv), 681 mixin_boost_tlv),
709}; 682};
710 683
684/* We run all mode setting through a function to enforce audio mode */
685static void wm1811_jackdet_set_mode(struct snd_soc_codec *codec, u16 mode)
686{
687 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
688
689 if (wm8994->active_refcount)
690 mode = WM1811_JACKDET_MODE_AUDIO;
691
692 snd_soc_update_bits(codec, WM8994_ANTIPOP_2,
693 WM1811_JACKDET_MODE_MASK, mode);
694
695 if (mode == WM1811_JACKDET_MODE_MIC)
696 msleep(2);
697}
698
699static void active_reference(struct snd_soc_codec *codec)
700{
701 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
702
703 mutex_lock(&wm8994->accdet_lock);
704
705 wm8994->active_refcount++;
706
707 dev_dbg(codec->dev, "Active refcount incremented, now %d\n",
708 wm8994->active_refcount);
709
710 if (wm8994->active_refcount == 1) {
711 /* If we're using jack detection go into audio mode */
712 if (wm8994->jackdet && wm8994->jack_cb) {
713 snd_soc_update_bits(codec, WM8994_ANTIPOP_2,
714 WM1811_JACKDET_MODE_MASK,
715 WM1811_JACKDET_MODE_AUDIO);
716 msleep(2);
717 }
718 }
719
720 mutex_unlock(&wm8994->accdet_lock);
721}
722
723static void active_dereference(struct snd_soc_codec *codec)
724{
725 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
726 u16 mode;
727
728 mutex_lock(&wm8994->accdet_lock);
729
730 wm8994->active_refcount--;
731
732 dev_dbg(codec->dev, "Active refcount decremented, now %d\n",
733 wm8994->active_refcount);
734
735 if (wm8994->active_refcount == 0) {
736 /* Go into appropriate detection only mode */
737 if (wm8994->jackdet && wm8994->jack_cb) {
738 if (wm8994->jack_mic || wm8994->mic_detecting)
739 mode = WM1811_JACKDET_MODE_MIC;
740 else
741 mode = WM1811_JACKDET_MODE_JACK;
742
743 snd_soc_update_bits(codec, WM8994_ANTIPOP_2,
744 WM1811_JACKDET_MODE_MASK,
745 mode);
746 }
747 }
748
749 mutex_unlock(&wm8994->accdet_lock);
750}
751
711static int clk_sys_event(struct snd_soc_dapm_widget *w, 752static int clk_sys_event(struct snd_soc_dapm_widget *w,
712 struct snd_kcontrol *kcontrol, int event) 753 struct snd_kcontrol *kcontrol, int event)
713{ 754{
@@ -1325,15 +1366,15 @@ SND_SOC_DAPM_DAC("DAC1R", NULL, WM8994_POWER_MANAGEMENT_5, 0, 0),
1325}; 1366};
1326 1367
1327static const struct snd_soc_dapm_widget wm8994_adc_revd_widgets[] = { 1368static const struct snd_soc_dapm_widget wm8994_adc_revd_widgets[] = {
1328SND_SOC_DAPM_MUX_E("ADCL Mux", WM8994_POWER_MANAGEMENT_4, 1, 0, &adcl_mux, 1369SND_SOC_DAPM_VIRT_MUX_E("ADCL Mux", WM8994_POWER_MANAGEMENT_4, 1, 0, &adcl_mux,
1329 adc_mux_ev, SND_SOC_DAPM_PRE_PMU), 1370 adc_mux_ev, SND_SOC_DAPM_PRE_PMU),
1330SND_SOC_DAPM_MUX_E("ADCR Mux", WM8994_POWER_MANAGEMENT_4, 0, 0, &adcr_mux, 1371SND_SOC_DAPM_VIRT_MUX_E("ADCR Mux", WM8994_POWER_MANAGEMENT_4, 0, 0, &adcr_mux,
1331 adc_mux_ev, SND_SOC_DAPM_PRE_PMU), 1372 adc_mux_ev, SND_SOC_DAPM_PRE_PMU),
1332}; 1373};
1333 1374
1334static const struct snd_soc_dapm_widget wm8994_adc_widgets[] = { 1375static const struct snd_soc_dapm_widget wm8994_adc_widgets[] = {
1335SND_SOC_DAPM_MUX("ADCL Mux", WM8994_POWER_MANAGEMENT_4, 1, 0, &adcl_mux), 1376SND_SOC_DAPM_VIRT_MUX("ADCL Mux", WM8994_POWER_MANAGEMENT_4, 1, 0, &adcl_mux),
1336SND_SOC_DAPM_MUX("ADCR Mux", WM8994_POWER_MANAGEMENT_4, 0, 0, &adcr_mux), 1377SND_SOC_DAPM_VIRT_MUX("ADCR Mux", WM8994_POWER_MANAGEMENT_4, 0, 0, &adcr_mux),
1337}; 1378};
1338 1379
1339static const struct snd_soc_dapm_widget wm8994_dapm_widgets[] = { 1380static const struct snd_soc_dapm_widget wm8994_dapm_widgets[] = {
@@ -1768,7 +1809,7 @@ static int _wm8994_set_fll(struct snd_soc_codec *codec, int id, int src,
1768 unsigned int freq_in, unsigned int freq_out) 1809 unsigned int freq_in, unsigned int freq_out)
1769{ 1810{
1770 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); 1811 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
1771 struct wm8994 *control = codec->control_data; 1812 struct wm8994 *control = wm8994->wm8994;
1772 int reg_offset, ret; 1813 int reg_offset, ret;
1773 struct fll_div fll; 1814 struct fll_div fll;
1774 u16 reg, aif1, aif2; 1815 u16 reg, aif1, aif2;
@@ -1865,6 +1906,8 @@ static int _wm8994_set_fll(struct snd_soc_codec *codec, int id, int src,
1865 if (freq_out) { 1906 if (freq_out) {
1866 /* Enable VMID if we need it */ 1907 /* Enable VMID if we need it */
1867 if (!was_enabled) { 1908 if (!was_enabled) {
1909 active_reference(codec);
1910
1868 switch (control->type) { 1911 switch (control->type) {
1869 case WM8994: 1912 case WM8994:
1870 vmid_reference(codec); 1913 vmid_reference(codec);
@@ -1908,6 +1951,8 @@ static int _wm8994_set_fll(struct snd_soc_codec *codec, int id, int src,
1908 default: 1951 default:
1909 break; 1952 break;
1910 } 1953 }
1954
1955 active_dereference(codec);
1911 } 1956 }
1912 } 1957 }
1913 1958
@@ -2017,20 +2062,33 @@ static int wm8994_set_dai_sysclk(struct snd_soc_dai *dai,
2017static int wm8994_set_bias_level(struct snd_soc_codec *codec, 2062static int wm8994_set_bias_level(struct snd_soc_codec *codec,
2018 enum snd_soc_bias_level level) 2063 enum snd_soc_bias_level level)
2019{ 2064{
2020 struct wm8994 *control = codec->control_data;
2021 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); 2065 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
2066 struct wm8994 *control = wm8994->wm8994;
2022 2067
2023 switch (level) { 2068 switch (level) {
2024 case SND_SOC_BIAS_ON: 2069 case SND_SOC_BIAS_ON:
2025 break; 2070 break;
2026 2071
2027 case SND_SOC_BIAS_PREPARE: 2072 case SND_SOC_BIAS_PREPARE:
2073 /* MICBIAS into regulating mode */
2074 switch (control->type) {
2075 case WM8958:
2076 case WM1811:
2077 snd_soc_update_bits(codec, WM8958_MICBIAS1,
2078 WM8958_MICB1_MODE, 0);
2079 snd_soc_update_bits(codec, WM8958_MICBIAS2,
2080 WM8958_MICB2_MODE, 0);
2081 break;
2082 default:
2083 break;
2084 }
2085
2086 if (codec->dapm.bias_level == SND_SOC_BIAS_STANDBY)
2087 active_reference(codec);
2028 break; 2088 break;
2029 2089
2030 case SND_SOC_BIAS_STANDBY: 2090 case SND_SOC_BIAS_STANDBY:
2031 if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { 2091 if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
2032 pm_runtime_get_sync(codec->dev);
2033
2034 switch (control->type) { 2092 switch (control->type) {
2035 case WM8994: 2093 case WM8994:
2036 if (wm8994->revision < 4) { 2094 if (wm8994->revision < 4) {
@@ -2077,25 +2135,40 @@ static int wm8994_set_bias_level(struct snd_soc_codec *codec,
2077 WM8994_LINEOUT2_DISCH); 2135 WM8994_LINEOUT2_DISCH);
2078 } 2136 }
2079 2137
2138 if (codec->dapm.bias_level == SND_SOC_BIAS_PREPARE)
2139 active_dereference(codec);
2080 2140
2141 /* MICBIAS into bypass mode on newer devices */
2142 switch (control->type) {
2143 case WM8958:
2144 case WM1811:
2145 snd_soc_update_bits(codec, WM8958_MICBIAS1,
2146 WM8958_MICB1_MODE,
2147 WM8958_MICB1_MODE);
2148 snd_soc_update_bits(codec, WM8958_MICBIAS2,
2149 WM8958_MICB2_MODE,
2150 WM8958_MICB2_MODE);
2151 break;
2152 default:
2153 break;
2154 }
2081 break; 2155 break;
2082 2156
2083 case SND_SOC_BIAS_OFF: 2157 case SND_SOC_BIAS_OFF:
2084 if (codec->dapm.bias_level == SND_SOC_BIAS_STANDBY) { 2158 if (codec->dapm.bias_level == SND_SOC_BIAS_STANDBY)
2085 wm8994->cur_fw = NULL; 2159 wm8994->cur_fw = NULL;
2086
2087 pm_runtime_put(codec->dev);
2088 }
2089 break; 2160 break;
2090 } 2161 }
2091 codec->dapm.bias_level = level; 2162 codec->dapm.bias_level = level;
2163
2092 return 0; 2164 return 0;
2093} 2165}
2094 2166
2095static int wm8994_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt) 2167static int wm8994_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
2096{ 2168{
2097 struct snd_soc_codec *codec = dai->codec; 2169 struct snd_soc_codec *codec = dai->codec;
2098 struct wm8994 *control = codec->control_data; 2170 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
2171 struct wm8994 *control = wm8994->wm8994;
2099 int ms_reg; 2172 int ms_reg;
2100 int aif1_reg; 2173 int aif1_reg;
2101 int ms = 0; 2174 int ms = 0;
@@ -2395,7 +2468,8 @@ static int wm8994_aif3_hw_params(struct snd_pcm_substream *substream,
2395 struct snd_soc_dai *dai) 2468 struct snd_soc_dai *dai)
2396{ 2469{
2397 struct snd_soc_codec *codec = dai->codec; 2470 struct snd_soc_codec *codec = dai->codec;
2398 struct wm8994 *control = codec->control_data; 2471 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
2472 struct wm8994 *control = wm8994->wm8994;
2399 int aif1_reg; 2473 int aif1_reg;
2400 int aif1 = 0; 2474 int aif1 = 0;
2401 2475
@@ -2536,7 +2610,7 @@ static int wm8994_aif2_probe(struct snd_soc_dai *dai)
2536#define WM8994_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ 2610#define WM8994_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\
2537 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE) 2611 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE)
2538 2612
2539static struct snd_soc_dai_ops wm8994_aif1_dai_ops = { 2613static const struct snd_soc_dai_ops wm8994_aif1_dai_ops = {
2540 .set_sysclk = wm8994_set_dai_sysclk, 2614 .set_sysclk = wm8994_set_dai_sysclk,
2541 .set_fmt = wm8994_set_dai_fmt, 2615 .set_fmt = wm8994_set_dai_fmt,
2542 .hw_params = wm8994_hw_params, 2616 .hw_params = wm8994_hw_params,
@@ -2546,7 +2620,7 @@ static struct snd_soc_dai_ops wm8994_aif1_dai_ops = {
2546 .set_tristate = wm8994_set_tristate, 2620 .set_tristate = wm8994_set_tristate,
2547}; 2621};
2548 2622
2549static struct snd_soc_dai_ops wm8994_aif2_dai_ops = { 2623static const struct snd_soc_dai_ops wm8994_aif2_dai_ops = {
2550 .set_sysclk = wm8994_set_dai_sysclk, 2624 .set_sysclk = wm8994_set_dai_sysclk,
2551 .set_fmt = wm8994_set_dai_fmt, 2625 .set_fmt = wm8994_set_dai_fmt,
2552 .hw_params = wm8994_hw_params, 2626 .hw_params = wm8994_hw_params,
@@ -2556,7 +2630,7 @@ static struct snd_soc_dai_ops wm8994_aif2_dai_ops = {
2556 .set_tristate = wm8994_set_tristate, 2630 .set_tristate = wm8994_set_tristate,
2557}; 2631};
2558 2632
2559static struct snd_soc_dai_ops wm8994_aif3_dai_ops = { 2633static const struct snd_soc_dai_ops wm8994_aif3_dai_ops = {
2560 .hw_params = wm8994_aif3_hw_params, 2634 .hw_params = wm8994_aif3_hw_params,
2561 .set_tristate = wm8994_set_tristate, 2635 .set_tristate = wm8994_set_tristate,
2562}; 2636};
@@ -2623,10 +2697,10 @@ static struct snd_soc_dai_driver wm8994_dai[] = {
2623}; 2697};
2624 2698
2625#ifdef CONFIG_PM 2699#ifdef CONFIG_PM
2626static int wm8994_suspend(struct snd_soc_codec *codec, pm_message_t state) 2700static int wm8994_suspend(struct snd_soc_codec *codec)
2627{ 2701{
2628 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); 2702 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
2629 struct wm8994 *control = codec->control_data; 2703 struct wm8994 *control = wm8994->wm8994;
2630 int i, ret; 2704 int i, ret;
2631 2705
2632 switch (control->type) { 2706 switch (control->type) {
@@ -2634,6 +2708,9 @@ static int wm8994_suspend(struct snd_soc_codec *codec, pm_message_t state)
2634 snd_soc_update_bits(codec, WM8994_MICBIAS, WM8994_MICD_ENA, 0); 2708 snd_soc_update_bits(codec, WM8994_MICBIAS, WM8994_MICD_ENA, 0);
2635 break; 2709 break;
2636 case WM1811: 2710 case WM1811:
2711 snd_soc_update_bits(codec, WM8994_ANTIPOP_2,
2712 WM1811_JACKDET_MODE_MASK, 0);
2713 /* Fall through */
2637 case WM8958: 2714 case WM8958:
2638 snd_soc_update_bits(codec, WM8958_MIC_DETECT_1, 2715 snd_soc_update_bits(codec, WM8958_MIC_DETECT_1,
2639 WM8958_MICD_ENA, 0); 2716 WM8958_MICD_ENA, 0);
@@ -2657,14 +2734,14 @@ static int wm8994_suspend(struct snd_soc_codec *codec, pm_message_t state)
2657static int wm8994_resume(struct snd_soc_codec *codec) 2734static int wm8994_resume(struct snd_soc_codec *codec)
2658{ 2735{
2659 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); 2736 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
2660 struct wm8994 *control = codec->control_data; 2737 struct wm8994 *control = wm8994->wm8994;
2661 int i, ret; 2738 int i, ret;
2662 unsigned int val, mask; 2739 unsigned int val, mask;
2663 2740
2664 if (wm8994->revision < 4) { 2741 if (wm8994->revision < 4) {
2665 /* force a HW read */ 2742 /* force a HW read */
2666 val = wm8994_reg_read(codec->control_data, 2743 ret = regmap_read(control->regmap,
2667 WM8994_POWER_MANAGEMENT_5); 2744 WM8994_POWER_MANAGEMENT_5, &val);
2668 2745
2669 /* modify the cache only */ 2746 /* modify the cache only */
2670 codec->cache_only = 1; 2747 codec->cache_only = 1;
@@ -2703,6 +2780,13 @@ static int wm8994_resume(struct snd_soc_codec *codec)
2703 WM8994_MICD_ENA, WM8994_MICD_ENA); 2780 WM8994_MICD_ENA, WM8994_MICD_ENA);
2704 break; 2781 break;
2705 case WM1811: 2782 case WM1811:
2783 if (wm8994->jackdet && wm8994->jack_cb) {
2784 /* Restart from idle */
2785 snd_soc_update_bits(codec, WM8994_ANTIPOP_2,
2786 WM1811_JACKDET_MODE_MASK,
2787 WM1811_JACKDET_MODE_JACK);
2788 break;
2789 }
2706 case WM8958: 2790 case WM8958:
2707 if (wm8994->jack_cb) 2791 if (wm8994->jack_cb)
2708 snd_soc_update_bits(codec, WM8958_MIC_DETECT_1, 2792 snd_soc_update_bits(codec, WM8958_MIC_DETECT_1,
@@ -2815,8 +2899,8 @@ static void wm8994_handle_pdata(struct wm8994_priv *wm8994)
2815 }; 2899 };
2816 2900
2817 /* We need an array of texts for the enum API */ 2901 /* We need an array of texts for the enum API */
2818 wm8994->drc_texts = kmalloc(sizeof(char *) 2902 wm8994->drc_texts = devm_kzalloc(wm8994->codec->dev,
2819 * pdata->num_drc_cfgs, GFP_KERNEL); 2903 sizeof(char *) * pdata->num_drc_cfgs, GFP_KERNEL);
2820 if (!wm8994->drc_texts) { 2904 if (!wm8994->drc_texts) {
2821 dev_err(wm8994->codec->dev, 2905 dev_err(wm8994->codec->dev,
2822 "Failed to allocate %d DRC config texts\n", 2906 "Failed to allocate %d DRC config texts\n",
@@ -2879,7 +2963,7 @@ int wm8994_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack,
2879{ 2963{
2880 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); 2964 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
2881 struct wm8994_micdet *micdet; 2965 struct wm8994_micdet *micdet;
2882 struct wm8994 *control = codec->control_data; 2966 struct wm8994 *control = wm8994->wm8994;
2883 int reg; 2967 int reg;
2884 2968
2885 if (control->type != WM8994) 2969 if (control->type != WM8994)
@@ -2962,21 +3046,136 @@ static void wm8958_default_micdet(u16 status, void *data)
2962{ 3046{
2963 struct snd_soc_codec *codec = data; 3047 struct snd_soc_codec *codec = data;
2964 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); 3048 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
2965 int report = 0; 3049 int report;
3050
3051 dev_dbg(codec->dev, "MICDET %x\n", status);
3052
3053 /* Either nothing present or just starting detection */
3054 if (!(status & WM8958_MICD_STS)) {
3055 if (!wm8994->jackdet) {
3056 /* If nothing present then clear our statuses */
3057 dev_dbg(codec->dev, "Detected open circuit\n");
3058 wm8994->jack_mic = false;
3059 wm8994->mic_detecting = true;
3060
3061 wm8958_micd_set_rate(codec);
3062
3063 snd_soc_jack_report(wm8994->micdet[0].jack, 0,
3064 wm8994->btn_mask |
3065 SND_JACK_HEADSET);
3066 }
3067 return;
3068 }
3069
3070 /* If the measurement is showing a high impedence we've got a
3071 * microphone.
3072 */
3073 if (wm8994->mic_detecting && (status & 0x600)) {
3074 dev_dbg(codec->dev, "Detected microphone\n");
3075
3076 wm8994->mic_detecting = false;
3077 wm8994->jack_mic = true;
3078
3079 wm8958_micd_set_rate(codec);
3080
3081 snd_soc_jack_report(wm8994->micdet[0].jack, SND_JACK_HEADSET,
3082 SND_JACK_HEADSET);
3083 }
3084
3085
3086 if (wm8994->mic_detecting && status & 0x4) {
3087 dev_dbg(codec->dev, "Detected headphone\n");
3088 wm8994->mic_detecting = false;
3089
3090 wm8958_micd_set_rate(codec);
3091
3092 snd_soc_jack_report(wm8994->micdet[0].jack, SND_JACK_HEADPHONE,
3093 SND_JACK_HEADSET);
3094
3095 /* If we have jackdet that will detect removal */
3096 if (wm8994->jackdet) {
3097 snd_soc_update_bits(codec, WM8958_MIC_DETECT_1,
3098 WM8958_MICD_ENA, 0);
3099
3100 wm1811_jackdet_set_mode(codec,
3101 WM1811_JACKDET_MODE_JACK);
3102 }
3103 }
3104
3105 /* Report short circuit as a button */
3106 if (wm8994->jack_mic) {
3107 report = 0;
3108 if (status & 0x4)
3109 report |= SND_JACK_BTN_0;
3110
3111 if (status & 0x8)
3112 report |= SND_JACK_BTN_1;
3113
3114 if (status & 0x10)
3115 report |= SND_JACK_BTN_2;
3116
3117 if (status & 0x20)
3118 report |= SND_JACK_BTN_3;
3119
3120 if (status & 0x40)
3121 report |= SND_JACK_BTN_4;
3122
3123 if (status & 0x80)
3124 report |= SND_JACK_BTN_5;
3125
3126 snd_soc_jack_report(wm8994->micdet[0].jack, report,
3127 wm8994->btn_mask);
3128 }
3129}
3130
3131static irqreturn_t wm1811_jackdet_irq(int irq, void *data)
3132{
3133 struct wm8994_priv *wm8994 = data;
3134 struct snd_soc_codec *codec = wm8994->codec;
3135 int reg;
3136
3137 mutex_lock(&wm8994->accdet_lock);
3138
3139 reg = snd_soc_read(codec, WM1811_JACKDET_CTRL);
3140 if (reg < 0) {
3141 dev_err(codec->dev, "Failed to read jack status: %d\n", reg);
3142 mutex_unlock(&wm8994->accdet_lock);
3143 return IRQ_NONE;
3144 }
3145
3146 dev_dbg(codec->dev, "JACKDET %x\n", reg);
2966 3147
2967 /* If nothing present then clear our statuses */ 3148 if (reg & WM1811_JACKDET_LVL) {
2968 if (!(status & WM8958_MICD_STS)) 3149 dev_dbg(codec->dev, "Jack detected\n");
2969 goto done;
2970 3150
2971 report = SND_JACK_MICROPHONE; 3151 snd_soc_jack_report(wm8994->micdet[0].jack,
3152 SND_JACK_MECHANICAL, SND_JACK_MECHANICAL);
3153
3154 /*
3155 * Start off measument of microphone impedence to find
3156 * out what's actually there.
3157 */
3158 wm8994->mic_detecting = true;
3159 wm1811_jackdet_set_mode(codec, WM1811_JACKDET_MODE_MIC);
3160 snd_soc_update_bits(codec, WM8958_MIC_DETECT_1,
3161 WM8958_MICD_ENA, WM8958_MICD_ENA);
3162 } else {
3163 dev_dbg(codec->dev, "Jack not detected\n");
2972 3164
2973 /* Everything else is buttons; just assign slots */ 3165 snd_soc_jack_report(wm8994->micdet[0].jack, 0,
2974 if (status & 0x1c) 3166 SND_JACK_MECHANICAL | SND_JACK_HEADSET |
2975 report |= SND_JACK_BTN_0; 3167 wm8994->btn_mask);
2976 3168
2977done: 3169 wm8994->mic_detecting = false;
2978 snd_soc_jack_report(wm8994->micdet[0].jack, report, 3170 wm8994->jack_mic = false;
2979 SND_JACK_BTN_0 | SND_JACK_MICROPHONE); 3171 snd_soc_update_bits(codec, WM8958_MIC_DETECT_1,
3172 WM8958_MICD_ENA, 0);
3173 wm1811_jackdet_set_mode(codec, WM1811_JACKDET_MODE_JACK);
3174 }
3175
3176 mutex_unlock(&wm8994->accdet_lock);
3177
3178 return IRQ_HANDLED;
2980} 3179}
2981 3180
2982/** 3181/**
@@ -2999,7 +3198,8 @@ int wm8958_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack,
2999 wm8958_micdet_cb cb, void *cb_data) 3198 wm8958_micdet_cb cb, void *cb_data)
3000{ 3199{
3001 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); 3200 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
3002 struct wm8994 *control = codec->control_data; 3201 struct wm8994 *control = wm8994->wm8994;
3202 u16 micd_lvl_sel;
3003 3203
3004 switch (control->type) { 3204 switch (control->type) {
3005 case WM1811: 3205 case WM1811:
@@ -3016,15 +3216,50 @@ int wm8958_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack,
3016 cb_data = codec; 3216 cb_data = codec;
3017 } 3217 }
3018 3218
3219 snd_soc_dapm_force_enable_pin(&codec->dapm, "CLK_SYS");
3220
3019 wm8994->micdet[0].jack = jack; 3221 wm8994->micdet[0].jack = jack;
3020 wm8994->jack_cb = cb; 3222 wm8994->jack_cb = cb;
3021 wm8994->jack_cb_data = cb_data; 3223 wm8994->jack_cb_data = cb_data;
3022 3224
3023 snd_soc_update_bits(codec, WM8958_MIC_DETECT_1, 3225 wm8994->mic_detecting = true;
3024 WM8958_MICD_ENA, WM8958_MICD_ENA); 3226 wm8994->jack_mic = false;
3227
3228 wm8958_micd_set_rate(codec);
3229
3230 /* Detect microphones and short circuits by default */
3231 if (wm8994->pdata->micd_lvl_sel)
3232 micd_lvl_sel = wm8994->pdata->micd_lvl_sel;
3233 else
3234 micd_lvl_sel = 0x41;
3235
3236 wm8994->btn_mask = SND_JACK_BTN_0 | SND_JACK_BTN_1 |
3237 SND_JACK_BTN_2 | SND_JACK_BTN_3 |
3238 SND_JACK_BTN_4 | SND_JACK_BTN_5;
3239
3240 snd_soc_update_bits(codec, WM8958_MIC_DETECT_2,
3241 WM8958_MICD_LVL_SEL_MASK, micd_lvl_sel);
3242
3243 WARN_ON(codec->dapm.bias_level > SND_SOC_BIAS_STANDBY);
3244
3245 /*
3246 * If we can use jack detection start off with that,
3247 * otherwise jump straight to microphone detection.
3248 */
3249 if (wm8994->jackdet) {
3250 snd_soc_update_bits(codec, WM8994_LDO_1,
3251 WM8994_LDO1_DISCH, 0);
3252 wm1811_jackdet_set_mode(codec,
3253 WM1811_JACKDET_MODE_JACK);
3254 } else {
3255 snd_soc_update_bits(codec, WM8958_MIC_DETECT_1,
3256 WM8958_MICD_ENA, WM8958_MICD_ENA);
3257 }
3258
3025 } else { 3259 } else {
3026 snd_soc_update_bits(codec, WM8958_MIC_DETECT_1, 3260 snd_soc_update_bits(codec, WM8958_MIC_DETECT_1,
3027 WM8958_MICD_ENA, 0); 3261 WM8958_MICD_ENA, 0);
3262 snd_soc_dapm_disable_pin(&codec->dapm, "CLK_SYS");
3028 } 3263 }
3029 3264
3030 return 0; 3265 return 0;
@@ -3037,6 +3272,18 @@ static irqreturn_t wm8958_mic_irq(int irq, void *data)
3037 struct snd_soc_codec *codec = wm8994->codec; 3272 struct snd_soc_codec *codec = wm8994->codec;
3038 int reg, count; 3273 int reg, count;
3039 3274
3275 mutex_lock(&wm8994->accdet_lock);
3276
3277 /*
3278 * Jack detection may have detected a removal simulataneously
3279 * with an update of the MICDET status; if so it will have
3280 * stopped detection and we can ignore this interrupt.
3281 */
3282 if (!(snd_soc_read(codec, WM8958_MIC_DETECT_1) & WM8958_MICD_ENA)) {
3283 mutex_unlock(&wm8994->accdet_lock);
3284 return IRQ_HANDLED;
3285 }
3286
3040 /* We may occasionally read a detection without an impedence 3287 /* We may occasionally read a detection without an impedence
3041 * range being provided - if that happens loop again. 3288 * range being provided - if that happens loop again.
3042 */ 3289 */
@@ -3044,6 +3291,7 @@ static irqreturn_t wm8958_mic_irq(int irq, void *data)
3044 do { 3291 do {
3045 reg = snd_soc_read(codec, WM8958_MIC_DETECT_3); 3292 reg = snd_soc_read(codec, WM8958_MIC_DETECT_3);
3046 if (reg < 0) { 3293 if (reg < 0) {
3294 mutex_unlock(&wm8994->accdet_lock);
3047 dev_err(codec->dev, 3295 dev_err(codec->dev,
3048 "Failed to read mic detect status: %d\n", 3296 "Failed to read mic detect status: %d\n",
3049 reg); 3297 reg);
@@ -3074,6 +3322,8 @@ static irqreturn_t wm8958_mic_irq(int irq, void *data)
3074 dev_warn(codec->dev, "Accessory detection with no callback\n"); 3322 dev_warn(codec->dev, "Accessory detection with no callback\n");
3075 3323
3076out: 3324out:
3325 mutex_unlock(&wm8994->accdet_lock);
3326
3077 return IRQ_HANDLED; 3327 return IRQ_HANDLED;
3078} 3328}
3079 3329
@@ -3106,22 +3356,28 @@ static irqreturn_t wm8994_temp_shut(int irq, void *data)
3106 3356
3107static int wm8994_codec_probe(struct snd_soc_codec *codec) 3357static int wm8994_codec_probe(struct snd_soc_codec *codec)
3108{ 3358{
3109 struct wm8994 *control; 3359 struct wm8994 *control = dev_get_drvdata(codec->dev->parent);
3110 struct wm8994_priv *wm8994; 3360 struct wm8994_priv *wm8994;
3111 struct snd_soc_dapm_context *dapm = &codec->dapm; 3361 struct snd_soc_dapm_context *dapm = &codec->dapm;
3362 unsigned int reg;
3112 int ret, i; 3363 int ret, i;
3113 3364
3114 codec->control_data = dev_get_drvdata(codec->dev->parent); 3365 codec->control_data = control->regmap;
3115 control = codec->control_data;
3116 3366
3117 wm8994 = kzalloc(sizeof(struct wm8994_priv), GFP_KERNEL); 3367 wm8994 = devm_kzalloc(codec->dev, sizeof(struct wm8994_priv),
3368 GFP_KERNEL);
3118 if (wm8994 == NULL) 3369 if (wm8994 == NULL)
3119 return -ENOMEM; 3370 return -ENOMEM;
3120 snd_soc_codec_set_drvdata(codec, wm8994); 3371 snd_soc_codec_set_drvdata(codec, wm8994);
3121 3372
3373 snd_soc_codec_set_cache_io(codec, 16, 16, SND_SOC_REGMAP);
3374
3375 wm8994->wm8994 = dev_get_drvdata(codec->dev->parent);
3122 wm8994->pdata = dev_get_platdata(codec->dev->parent); 3376 wm8994->pdata = dev_get_platdata(codec->dev->parent);
3123 wm8994->codec = codec; 3377 wm8994->codec = codec;
3124 3378
3379 mutex_init(&wm8994->accdet_lock);
3380
3125 for (i = 0; i < ARRAY_SIZE(wm8994->fll_locked); i++) 3381 for (i = 0; i < ARRAY_SIZE(wm8994->fll_locked); i++)
3126 init_completion(&wm8994->fll_locked[i]); 3382 init_completion(&wm8994->fll_locked[i]);
3127 3383
@@ -3134,25 +3390,6 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec)
3134 pm_runtime_enable(codec->dev); 3390 pm_runtime_enable(codec->dev);
3135 pm_runtime_resume(codec->dev); 3391 pm_runtime_resume(codec->dev);
3136 3392
3137 /* Read our current status back from the chip - we don't want to
3138 * reset as this may interfere with the GPIO or LDO operation. */
3139 for (i = 0; i < WM8994_CACHE_SIZE; i++) {
3140 if (!wm8994_readable(codec, i) || wm8994_volatile(codec, i))
3141 continue;
3142
3143 ret = wm8994_reg_read(codec->control_data, i);
3144 if (ret <= 0)
3145 continue;
3146
3147 ret = snd_soc_cache_write(codec, i, ret);
3148 if (ret != 0) {
3149 dev_err(codec->dev,
3150 "Failed to initialise cache for 0x%x: %d\n",
3151 i, ret);
3152 goto err;
3153 }
3154 }
3155
3156 /* Set revision-specific configuration */ 3393 /* Set revision-specific configuration */
3157 wm8994->revision = snd_soc_read(codec, WM8994_CHIP_REVISION); 3394 wm8994->revision = snd_soc_read(codec, WM8994_CHIP_REVISION);
3158 switch (control->type) { 3395 switch (control->type) {
@@ -3200,14 +3437,14 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec)
3200 break; 3437 break;
3201 } 3438 }
3202 3439
3203 wm8994_request_irq(codec->control_data, WM8994_IRQ_FIFOS_ERR, 3440 wm8994_request_irq(wm8994->wm8994, WM8994_IRQ_FIFOS_ERR,
3204 wm8994_fifo_error, "FIFO error", codec); 3441 wm8994_fifo_error, "FIFO error", codec);
3205 wm8994_request_irq(codec->control_data, WM8994_IRQ_TEMP_WARN, 3442 wm8994_request_irq(wm8994->wm8994, WM8994_IRQ_TEMP_WARN,
3206 wm8994_temp_warn, "Thermal warning", codec); 3443 wm8994_temp_warn, "Thermal warning", codec);
3207 wm8994_request_irq(codec->control_data, WM8994_IRQ_TEMP_SHUT, 3444 wm8994_request_irq(wm8994->wm8994, WM8994_IRQ_TEMP_SHUT,
3208 wm8994_temp_shut, "Thermal shutdown", codec); 3445 wm8994_temp_shut, "Thermal shutdown", codec);
3209 3446
3210 ret = wm8994_request_irq(codec->control_data, WM8994_IRQ_DCS_DONE, 3447 ret = wm8994_request_irq(wm8994->wm8994, WM8994_IRQ_DCS_DONE,
3211 wm_hubs_dcs_done, "DC servo done", 3448 wm_hubs_dcs_done, "DC servo done",
3212 &wm8994->hubs); 3449 &wm8994->hubs);
3213 if (ret == 0) 3450 if (ret == 0)
@@ -3227,7 +3464,7 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec)
3227 ret); 3464 ret);
3228 } 3465 }
3229 3466
3230 ret = wm8994_request_irq(codec->control_data, 3467 ret = wm8994_request_irq(wm8994->wm8994,
3231 WM8994_IRQ_MIC1_SHRT, 3468 WM8994_IRQ_MIC1_SHRT,
3232 wm8994_mic_irq, "Mic 1 short", 3469 wm8994_mic_irq, "Mic 1 short",
3233 wm8994); 3470 wm8994);
@@ -3236,7 +3473,7 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec)
3236 "Failed to request Mic1 short IRQ: %d\n", 3473 "Failed to request Mic1 short IRQ: %d\n",
3237 ret); 3474 ret);
3238 3475
3239 ret = wm8994_request_irq(codec->control_data, 3476 ret = wm8994_request_irq(wm8994->wm8994,
3240 WM8994_IRQ_MIC2_DET, 3477 WM8994_IRQ_MIC2_DET,
3241 wm8994_mic_irq, "Mic 2 detect", 3478 wm8994_mic_irq, "Mic 2 detect",
3242 wm8994); 3479 wm8994);
@@ -3245,7 +3482,7 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec)
3245 "Failed to request Mic2 detect IRQ: %d\n", 3482 "Failed to request Mic2 detect IRQ: %d\n",
3246 ret); 3483 ret);
3247 3484
3248 ret = wm8994_request_irq(codec->control_data, 3485 ret = wm8994_request_irq(wm8994->wm8994,
3249 WM8994_IRQ_MIC2_SHRT, 3486 WM8994_IRQ_MIC2_SHRT,
3250 wm8994_mic_irq, "Mic 2 short", 3487 wm8994_mic_irq, "Mic 2 short",
3251 wm8994); 3488 wm8994);
@@ -3270,9 +3507,24 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec)
3270 } 3507 }
3271 } 3508 }
3272 3509
3510 switch (control->type) {
3511 case WM1811:
3512 if (wm8994->revision > 1) {
3513 ret = wm8994_request_irq(wm8994->wm8994,
3514 WM8994_IRQ_GPIO(6),
3515 wm1811_jackdet_irq, "JACKDET",
3516 wm8994);
3517 if (ret == 0)
3518 wm8994->jackdet = true;
3519 }
3520 break;
3521 default:
3522 break;
3523 }
3524
3273 wm8994->fll_locked_irq = true; 3525 wm8994->fll_locked_irq = true;
3274 for (i = 0; i < ARRAY_SIZE(wm8994->fll_locked); i++) { 3526 for (i = 0; i < ARRAY_SIZE(wm8994->fll_locked); i++) {
3275 ret = wm8994_request_irq(codec->control_data, 3527 ret = wm8994_request_irq(wm8994->wm8994,
3276 WM8994_IRQ_FLL1_LOCK + i, 3528 WM8994_IRQ_FLL1_LOCK + i,
3277 wm8994_fll_locked_irq, "FLL lock", 3529 wm8994_fll_locked_irq, "FLL lock",
3278 &wm8994->fll_locked[i]); 3530 &wm8994->fll_locked[i]);
@@ -3284,24 +3536,24 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec)
3284 * configured on init - if a system wants to do this dynamically 3536 * configured on init - if a system wants to do this dynamically
3285 * at runtime we can deal with that then. 3537 * at runtime we can deal with that then.
3286 */ 3538 */
3287 ret = wm8994_reg_read(codec->control_data, WM8994_GPIO_1); 3539 ret = regmap_read(control->regmap, WM8994_GPIO_1, &reg);
3288 if (ret < 0) { 3540 if (ret < 0) {
3289 dev_err(codec->dev, "Failed to read GPIO1 state: %d\n", ret); 3541 dev_err(codec->dev, "Failed to read GPIO1 state: %d\n", ret);
3290 goto err_irq; 3542 goto err_irq;
3291 } 3543 }
3292 if ((ret & WM8994_GPN_FN_MASK) != WM8994_GP_FN_PIN_SPECIFIC) { 3544 if ((reg & WM8994_GPN_FN_MASK) != WM8994_GP_FN_PIN_SPECIFIC) {
3293 wm8994->lrclk_shared[0] = 1; 3545 wm8994->lrclk_shared[0] = 1;
3294 wm8994_dai[0].symmetric_rates = 1; 3546 wm8994_dai[0].symmetric_rates = 1;
3295 } else { 3547 } else {
3296 wm8994->lrclk_shared[0] = 0; 3548 wm8994->lrclk_shared[0] = 0;
3297 } 3549 }
3298 3550
3299 ret = wm8994_reg_read(codec->control_data, WM8994_GPIO_6); 3551 ret = regmap_read(control->regmap, WM8994_GPIO_6, &reg);
3300 if (ret < 0) { 3552 if (ret < 0) {
3301 dev_err(codec->dev, "Failed to read GPIO6 state: %d\n", ret); 3553 dev_err(codec->dev, "Failed to read GPIO6 state: %d\n", ret);
3302 goto err_irq; 3554 goto err_irq;
3303 } 3555 }
3304 if ((ret & WM8994_GPN_FN_MASK) != WM8994_GP_FN_PIN_SPECIFIC) { 3556 if ((reg & WM8994_GPN_FN_MASK) != WM8994_GP_FN_PIN_SPECIFIC) {
3305 wm8994->lrclk_shared[1] = 1; 3557 wm8994->lrclk_shared[1] = 1;
3306 wm8994_dai[1].symmetric_rates = 1; 3558 wm8994_dai[1].symmetric_rates = 1;
3307 } else { 3559 } else {
@@ -3368,6 +3620,19 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec)
3368 break; 3620 break;
3369 } 3621 }
3370 3622
3623 /* Put MICBIAS into bypass mode by default on newer devices */
3624 switch (control->type) {
3625 case WM8958:
3626 case WM1811:
3627 snd_soc_update_bits(codec, WM8958_MICBIAS1,
3628 WM8958_MICB1_MODE, WM8958_MICB1_MODE);
3629 snd_soc_update_bits(codec, WM8958_MICBIAS2,
3630 WM8958_MICB2_MODE, WM8958_MICB2_MODE);
3631 break;
3632 default:
3633 break;
3634 }
3635
3371 wm8994_update_class_w(codec); 3636 wm8994_update_class_w(codec);
3372 3637
3373 wm8994_handle_pdata(wm8994); 3638 wm8994_handle_pdata(wm8994);
@@ -3479,28 +3744,29 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec)
3479 return 0; 3744 return 0;
3480 3745
3481err_irq: 3746err_irq:
3482 wm8994_free_irq(codec->control_data, WM8994_IRQ_MIC2_SHRT, wm8994); 3747 if (wm8994->jackdet)
3483 wm8994_free_irq(codec->control_data, WM8994_IRQ_MIC2_DET, wm8994); 3748 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_GPIO(6), wm8994);
3484 wm8994_free_irq(codec->control_data, WM8994_IRQ_MIC1_SHRT, wm8994); 3749 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_MIC2_SHRT, wm8994);
3750 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_MIC2_DET, wm8994);
3751 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_MIC1_SHRT, wm8994);
3485 if (wm8994->micdet_irq) 3752 if (wm8994->micdet_irq)
3486 free_irq(wm8994->micdet_irq, wm8994); 3753 free_irq(wm8994->micdet_irq, wm8994);
3487 for (i = 0; i < ARRAY_SIZE(wm8994->fll_locked); i++) 3754 for (i = 0; i < ARRAY_SIZE(wm8994->fll_locked); i++)
3488 wm8994_free_irq(codec->control_data, WM8994_IRQ_FLL1_LOCK + i, 3755 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_FLL1_LOCK + i,
3489 &wm8994->fll_locked[i]); 3756 &wm8994->fll_locked[i]);
3490 wm8994_free_irq(codec->control_data, WM8994_IRQ_DCS_DONE, 3757 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_DCS_DONE,
3491 &wm8994->hubs); 3758 &wm8994->hubs);
3492 wm8994_free_irq(codec->control_data, WM8994_IRQ_FIFOS_ERR, codec); 3759 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_FIFOS_ERR, codec);
3493 wm8994_free_irq(codec->control_data, WM8994_IRQ_TEMP_SHUT, codec); 3760 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_TEMP_SHUT, codec);
3494 wm8994_free_irq(codec->control_data, WM8994_IRQ_TEMP_WARN, codec); 3761 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_TEMP_WARN, codec);
3495err: 3762
3496 kfree(wm8994);
3497 return ret; 3763 return ret;
3498} 3764}
3499 3765
3500static int wm8994_codec_remove(struct snd_soc_codec *codec) 3766static int wm8994_codec_remove(struct snd_soc_codec *codec)
3501{ 3767{
3502 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); 3768 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
3503 struct wm8994 *control = codec->control_data; 3769 struct wm8994 *control = wm8994->wm8994;
3504 int i; 3770 int i;
3505 3771
3506 wm8994_set_bias_level(codec, SND_SOC_BIAS_OFF); 3772 wm8994_set_bias_level(codec, SND_SOC_BIAS_OFF);
@@ -3508,24 +3774,27 @@ static int wm8994_codec_remove(struct snd_soc_codec *codec)
3508 pm_runtime_disable(codec->dev); 3774 pm_runtime_disable(codec->dev);
3509 3775
3510 for (i = 0; i < ARRAY_SIZE(wm8994->fll_locked); i++) 3776 for (i = 0; i < ARRAY_SIZE(wm8994->fll_locked); i++)
3511 wm8994_free_irq(codec->control_data, WM8994_IRQ_FLL1_LOCK + i, 3777 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_FLL1_LOCK + i,
3512 &wm8994->fll_locked[i]); 3778 &wm8994->fll_locked[i]);
3513 3779
3514 wm8994_free_irq(codec->control_data, WM8994_IRQ_DCS_DONE, 3780 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_DCS_DONE,
3515 &wm8994->hubs); 3781 &wm8994->hubs);
3516 wm8994_free_irq(codec->control_data, WM8994_IRQ_FIFOS_ERR, codec); 3782 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_FIFOS_ERR, codec);
3517 wm8994_free_irq(codec->control_data, WM8994_IRQ_TEMP_SHUT, codec); 3783 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_TEMP_SHUT, codec);
3518 wm8994_free_irq(codec->control_data, WM8994_IRQ_TEMP_WARN, codec); 3784 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_TEMP_WARN, codec);
3785
3786 if (wm8994->jackdet)
3787 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_GPIO(6), wm8994);
3519 3788
3520 switch (control->type) { 3789 switch (control->type) {
3521 case WM8994: 3790 case WM8994:
3522 if (wm8994->micdet_irq) 3791 if (wm8994->micdet_irq)
3523 free_irq(wm8994->micdet_irq, wm8994); 3792 free_irq(wm8994->micdet_irq, wm8994);
3524 wm8994_free_irq(codec->control_data, WM8994_IRQ_MIC2_DET, 3793 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_MIC2_DET,
3525 wm8994); 3794 wm8994);
3526 wm8994_free_irq(codec->control_data, WM8994_IRQ_MIC1_SHRT, 3795 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_MIC1_SHRT,
3527 wm8994); 3796 wm8994);
3528 wm8994_free_irq(codec->control_data, WM8994_IRQ_MIC1_DET, 3797 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_MIC1_DET,
3529 wm8994); 3798 wm8994);
3530 break; 3799 break;
3531 3800
@@ -3542,27 +3811,24 @@ static int wm8994_codec_remove(struct snd_soc_codec *codec)
3542 if (wm8994->enh_eq) 3811 if (wm8994->enh_eq)
3543 release_firmware(wm8994->enh_eq); 3812 release_firmware(wm8994->enh_eq);
3544 kfree(wm8994->retune_mobile_texts); 3813 kfree(wm8994->retune_mobile_texts);
3545 kfree(wm8994->drc_texts);
3546 kfree(wm8994);
3547 3814
3548 return 0; 3815 return 0;
3549} 3816}
3550 3817
3818static int wm8994_soc_volatile(struct snd_soc_codec *codec,
3819 unsigned int reg)
3820{
3821 return true;
3822}
3823
3551static struct snd_soc_codec_driver soc_codec_dev_wm8994 = { 3824static struct snd_soc_codec_driver soc_codec_dev_wm8994 = {
3552 .probe = wm8994_codec_probe, 3825 .probe = wm8994_codec_probe,
3553 .remove = wm8994_codec_remove, 3826 .remove = wm8994_codec_remove,
3554 .suspend = wm8994_suspend, 3827 .suspend = wm8994_suspend,
3555 .resume = wm8994_resume, 3828 .resume = wm8994_resume,
3556 .read = wm8994_read,
3557 .write = wm8994_write,
3558 .readable_register = wm8994_readable,
3559 .volatile_register = wm8994_volatile,
3560 .set_bias_level = wm8994_set_bias_level, 3829 .set_bias_level = wm8994_set_bias_level,
3561 3830 .reg_cache_size = WM8994_MAX_REGISTER,
3562 .reg_cache_size = WM8994_CACHE_SIZE, 3831 .volatile_register = wm8994_soc_volatile,
3563 .reg_cache_default = wm8994_reg_defaults,
3564 .reg_word_size = 2,
3565 .compress_type = SND_SOC_RBTREE_COMPRESSION,
3566}; 3832};
3567 3833
3568static int __devinit wm8994_probe(struct platform_device *pdev) 3834static int __devinit wm8994_probe(struct platform_device *pdev)
@@ -3586,18 +3852,7 @@ static struct platform_driver wm8994_codec_driver = {
3586 .remove = __devexit_p(wm8994_remove), 3852 .remove = __devexit_p(wm8994_remove),
3587}; 3853};
3588 3854
3589static __init int wm8994_init(void) 3855module_platform_driver(wm8994_codec_driver);
3590{
3591 return platform_driver_register(&wm8994_codec_driver);
3592}
3593module_init(wm8994_init);
3594
3595static __exit void wm8994_exit(void)
3596{
3597 platform_driver_unregister(&wm8994_codec_driver);
3598}
3599module_exit(wm8994_exit);
3600
3601 3856
3602MODULE_DESCRIPTION("ASoC WM8994 driver"); 3857MODULE_DESCRIPTION("ASoC WM8994 driver");
3603MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>"); 3858MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>");
diff --git a/sound/soc/codecs/wm8994.h b/sound/soc/codecs/wm8994.h
index f4f1355efc8..c3a42474ab1 100644
--- a/sound/soc/codecs/wm8994.h
+++ b/sound/soc/codecs/wm8994.h
@@ -39,16 +39,6 @@ int wm8994_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack,
39int wm8958_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack, 39int wm8958_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack,
40 wm8958_micdet_cb cb, void *cb_data); 40 wm8958_micdet_cb cb, void *cb_data);
41 41
42#define WM8994_CACHE_SIZE 1570
43
44struct wm8994_access_mask {
45 unsigned short readable; /* Mask of readable bits */
46 unsigned short writable; /* Mask of writable bits */
47};
48
49extern const struct wm8994_access_mask wm8994_access_masks[WM8994_CACHE_SIZE];
50extern const u16 wm8994_reg_defaults[WM8994_CACHE_SIZE];
51
52int wm8958_aif_ev(struct snd_soc_dapm_widget *w, 42int wm8958_aif_ev(struct snd_soc_dapm_widget *w,
53 struct snd_kcontrol *kcontrol, int event); 43 struct snd_kcontrol *kcontrol, int event);
54 44
@@ -70,10 +60,11 @@ struct wm8994_fll_config {
70#define WM8994_NUM_DRC 3 60#define WM8994_NUM_DRC 3
71#define WM8994_NUM_EQ 3 61#define WM8994_NUM_EQ 3
72 62
63struct wm8994;
64
73struct wm8994_priv { 65struct wm8994_priv {
74 struct wm_hubs_data hubs; 66 struct wm_hubs_data hubs;
75 enum snd_soc_control_type control_type; 67 struct wm8994 *wm8994;
76 void *control_data;
77 struct snd_soc_codec *codec; 68 struct snd_soc_codec *codec;
78 int sysclk[2]; 69 int sysclk[2];
79 int sysclk_rate[2]; 70 int sysclk_rate[2];
@@ -84,6 +75,7 @@ struct wm8994_priv {
84 bool fll_locked_irq; 75 bool fll_locked_irq;
85 76
86 int vmid_refcount; 77 int vmid_refcount;
78 int active_refcount;
87 79
88 int dac_rates[2]; 80 int dac_rates[2];
89 int lrclk_shared[2]; 81 int lrclk_shared[2];
@@ -125,7 +117,12 @@ struct wm8994_priv {
125 const char **enh_eq_texts; 117 const char **enh_eq_texts;
126 struct soc_enum enh_eq_enum; 118 struct soc_enum enh_eq_enum;
127 119
120 struct mutex accdet_lock;
128 struct wm8994_micdet micdet[2]; 121 struct wm8994_micdet micdet[2];
122 bool mic_detecting;
123 bool jack_mic;
124 int btn_mask;
125 bool jackdet;
129 126
130 wm8958_micdet_cb jack_cb; 127 wm8958_micdet_cb jack_cb;
131 void *jack_cb_data; 128 void *jack_cb_data;
diff --git a/sound/soc/codecs/wm8995.c b/sound/soc/codecs/wm8995.c
index 78eeb21e669..c8aada597d7 100644
--- a/sound/soc/codecs/wm8995.c
+++ b/sound/soc/codecs/wm8995.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/regulator/consumer.h> 23#include <linux/regulator/consumer.h>
23#include <linux/slab.h> 24#include <linux/slab.h>
@@ -43,88 +44,331 @@ static const char *wm8995_supply_names[WM8995_NUM_SUPPLIES] = {
43 "MICVDD" 44 "MICVDD"
44}; 45};
45 46
46static const u16 wm8995_reg_defs[WM8995_MAX_REGISTER + 1] = { 47static struct reg_default wm8995_reg_defaults[] = {
47 [0] = 0x8995, [5] = 0x0100, [16] = 0x000b, [17] = 0x000b, 48 { 0, 0x8995 },
48 [24] = 0x02c0, [25] = 0x02c0, [26] = 0x02c0, [27] = 0x02c0, 49 { 5, 0x0100 },
49 [28] = 0x000f, [32] = 0x0005, [33] = 0x0005, [40] = 0x0003, 50 { 16, 0x000b },
50 [41] = 0x0013, [48] = 0x0004, [56] = 0x09f8, [64] = 0x1f25, 51 { 17, 0x000b },
51 [69] = 0x0004, [82] = 0xaaaa, [84] = 0x2a2a, [146] = 0x0060, 52 { 24, 0x02c0 },
52 [256] = 0x0002, [257] = 0x8004, [520] = 0x0010, [528] = 0x0083, 53 { 25, 0x02c0 },
53 [529] = 0x0083, [548] = 0x0c80, [580] = 0x0c80, [768] = 0x4050, 54 { 26, 0x02c0 },
54 [769] = 0x4000, [771] = 0x0040, [772] = 0x0040, [773] = 0x0040, 55 { 27, 0x02c0 },
55 [774] = 0x0004, [775] = 0x0100, [784] = 0x4050, [785] = 0x4000, 56 { 28, 0x000f },
56 [787] = 0x0040, [788] = 0x0040, [789] = 0x0040, [1024] = 0x00c0, 57 { 32, 0x0005 },
57 [1025] = 0x00c0, [1026] = 0x00c0, [1027] = 0x00c0, [1028] = 0x00c0, 58 { 33, 0x0005 },
58 [1029] = 0x00c0, [1030] = 0x00c0, [1031] = 0x00c0, [1056] = 0x0200, 59 { 40, 0x0003 },
59 [1057] = 0x0010, [1058] = 0x0200, [1059] = 0x0010, [1088] = 0x0098, 60 { 41, 0x0013 },
60 [1089] = 0x0845, [1104] = 0x0098, [1105] = 0x0845, [1152] = 0x6318, 61 { 48, 0x0004 },
61 [1153] = 0x6300, [1154] = 0x0fca, [1155] = 0x0400, [1156] = 0x00d8, 62 { 56, 0x09f8 },
62 [1157] = 0x1eb5, [1158] = 0xf145, [1159] = 0x0b75, [1160] = 0x01c5, 63 { 64, 0x1f25 },
63 [1161] = 0x1c58, [1162] = 0xf373, [1163] = 0x0a54, [1164] = 0x0558, 64 { 69, 0x0004 },
64 [1165] = 0x168e, [1166] = 0xf829, [1167] = 0x07ad, [1168] = 0x1103, 65 { 82, 0xaaaa },
65 [1169] = 0x0564, [1170] = 0x0559, [1171] = 0x4000, [1184] = 0x6318, 66 { 84, 0x2a2a },
66 [1185] = 0x6300, [1186] = 0x0fca, [1187] = 0x0400, [1188] = 0x00d8, 67 { 146, 0x0060 },
67 [1189] = 0x1eb5, [1190] = 0xf145, [1191] = 0x0b75, [1192] = 0x01c5, 68 { 256, 0x0002 },
68 [1193] = 0x1c58, [1194] = 0xf373, [1195] = 0x0a54, [1196] = 0x0558, 69 { 257, 0x8004 },
69 [1197] = 0x168e, [1198] = 0xf829, [1199] = 0x07ad, [1200] = 0x1103, 70 { 520, 0x0010 },
70 [1201] = 0x0564, [1202] = 0x0559, [1203] = 0x4000, [1280] = 0x00c0, 71 { 528, 0x0083 },
71 [1281] = 0x00c0, [1282] = 0x00c0, [1283] = 0x00c0, [1312] = 0x0200, 72 { 529, 0x0083 },
72 [1313] = 0x0010, [1344] = 0x0098, [1345] = 0x0845, [1408] = 0x6318, 73 { 548, 0x0c80 },
73 [1409] = 0x6300, [1410] = 0x0fca, [1411] = 0x0400, [1412] = 0x00d8, 74 { 580, 0x0c80 },
74 [1413] = 0x1eb5, [1414] = 0xf145, [1415] = 0x0b75, [1416] = 0x01c5, 75 { 768, 0x4050 },
75 [1417] = 0x1c58, [1418] = 0xf373, [1419] = 0x0a54, [1420] = 0x0558, 76 { 769, 0x4000 },
76 [1421] = 0x168e, [1422] = 0xf829, [1423] = 0x07ad, [1424] = 0x1103, 77 { 771, 0x0040 },
77 [1425] = 0x0564, [1426] = 0x0559, [1427] = 0x4000, [1568] = 0x0002, 78 { 772, 0x0040 },
78 [1792] = 0xa100, [1793] = 0xa101, [1794] = 0xa101, [1795] = 0xa101, 79 { 773, 0x0040 },
79 [1796] = 0xa101, [1797] = 0xa101, [1798] = 0xa101, [1799] = 0xa101, 80 { 774, 0x0004 },
80 [1800] = 0xa101, [1801] = 0xa101, [1802] = 0xa101, [1803] = 0xa101, 81 { 775, 0x0100 },
81 [1804] = 0xa101, [1805] = 0xa101, [1825] = 0x0055, [1848] = 0x3fff, 82 { 784, 0x4050 },
82 [1849] = 0x1fff, [2049] = 0x0001, [2050] = 0x0069, [2056] = 0x0002, 83 { 785, 0x4000 },
83 [2057] = 0x0003, [2058] = 0x0069, [12288] = 0x0001, [12289] = 0x0001, 84 { 787, 0x0040 },
84 [12291] = 0x0006, [12292] = 0x0040, [12293] = 0x0001, [12294] = 0x000f, 85 { 788, 0x0040 },
85 [12295] = 0x0006, [12296] = 0x0001, [12297] = 0x0003, [12298] = 0x0104, 86 { 789, 0x0040 },
86 [12300] = 0x0060, [12301] = 0x0011, [12302] = 0x0401, [12304] = 0x0050, 87 { 1024, 0x00c0 },
87 [12305] = 0x0003, [12306] = 0x0100, [12308] = 0x0051, [12309] = 0x0003, 88 { 1025, 0x00c0 },
88 [12310] = 0x0104, [12311] = 0x000a, [12312] = 0x0060, [12313] = 0x003b, 89 { 1026, 0x00c0 },
89 [12314] = 0x0502, [12315] = 0x0100, [12316] = 0x2fff, [12320] = 0x2fff, 90 { 1027, 0x00c0 },
90 [12324] = 0x2fff, [12328] = 0x2fff, [12332] = 0x2fff, [12336] = 0x2fff, 91 { 1028, 0x00c0 },
91 [12340] = 0x2fff, [12344] = 0x2fff, [12348] = 0x2fff, [12352] = 0x0001, 92 { 1029, 0x00c0 },
92 [12353] = 0x0001, [12355] = 0x0006, [12356] = 0x0040, [12357] = 0x0001, 93 { 1030, 0x00c0 },
93 [12358] = 0x000f, [12359] = 0x0006, [12360] = 0x0001, [12361] = 0x0003, 94 { 1031, 0x00c0 },
94 [12362] = 0x0104, [12364] = 0x0060, [12365] = 0x0011, [12366] = 0x0401, 95 { 1056, 0x0200 },
95 [12368] = 0x0050, [12369] = 0x0003, [12370] = 0x0100, [12372] = 0x0060, 96 { 1057, 0x0010 },
96 [12373] = 0x003b, [12374] = 0x0502, [12375] = 0x0100, [12376] = 0x2fff, 97 { 1058, 0x0200 },
97 [12380] = 0x2fff, [12384] = 0x2fff, [12388] = 0x2fff, [12392] = 0x2fff, 98 { 1059, 0x0010 },
98 [12396] = 0x2fff, [12400] = 0x2fff, [12404] = 0x2fff, [12408] = 0x2fff, 99 { 1088, 0x0098 },
99 [12412] = 0x2fff, [12416] = 0x0001, [12417] = 0x0001, [12419] = 0x0006, 100 { 1089, 0x0845 },
100 [12420] = 0x0040, [12421] = 0x0001, [12422] = 0x000f, [12423] = 0x0006, 101 { 1104, 0x0098 },
101 [12424] = 0x0001, [12425] = 0x0003, [12426] = 0x0106, [12428] = 0x0061, 102 { 1105, 0x0845 },
102 [12429] = 0x0011, [12430] = 0x0401, [12432] = 0x0050, [12433] = 0x0003, 103 { 1152, 0x6318 },
103 [12434] = 0x0102, [12436] = 0x0051, [12437] = 0x0003, [12438] = 0x0106, 104 { 1153, 0x6300 },
104 [12439] = 0x000a, [12440] = 0x0061, [12441] = 0x003b, [12442] = 0x0502, 105 { 1154, 0x0fca },
105 [12443] = 0x0100, [12444] = 0x2fff, [12448] = 0x2fff, [12452] = 0x2fff, 106 { 1155, 0x0400 },
106 [12456] = 0x2fff, [12460] = 0x2fff, [12464] = 0x2fff, [12468] = 0x2fff, 107 { 1156, 0x00d8 },
107 [12472] = 0x2fff, [12476] = 0x2fff, [12480] = 0x0001, [12481] = 0x0001, 108 { 1157, 0x1eb5 },
108 [12483] = 0x0006, [12484] = 0x0040, [12485] = 0x0001, [12486] = 0x000f, 109 { 1158, 0xf145 },
109 [12487] = 0x0006, [12488] = 0x0001, [12489] = 0x0003, [12490] = 0x0106, 110 { 1159, 0x0b75 },
110 [12492] = 0x0061, [12493] = 0x0011, [12494] = 0x0401, [12496] = 0x0050, 111 { 1160, 0x01c5 },
111 [12497] = 0x0003, [12498] = 0x0102, [12500] = 0x0061, [12501] = 0x003b, 112 { 1161, 0x1c58 },
112 [12502] = 0x0502, [12503] = 0x0100, [12504] = 0x2fff, [12508] = 0x2fff, 113 { 1162, 0xf373 },
113 [12512] = 0x2fff, [12516] = 0x2fff, [12520] = 0x2fff, [12524] = 0x2fff, 114 { 1163, 0x0a54 },
114 [12528] = 0x2fff, [12532] = 0x2fff, [12536] = 0x2fff, [12540] = 0x2fff, 115 { 1164, 0x0558 },
115 [12544] = 0x0060, [12546] = 0x0601, [12548] = 0x0050, [12550] = 0x0100, 116 { 1165, 0x168e },
116 [12552] = 0x0001, [12554] = 0x0104, [12555] = 0x0100, [12556] = 0x2fff, 117 { 1166, 0xf829 },
117 [12560] = 0x2fff, [12564] = 0x2fff, [12568] = 0x2fff, [12572] = 0x2fff, 118 { 1167, 0x07ad },
118 [12576] = 0x2fff, [12580] = 0x2fff, [12584] = 0x2fff, [12588] = 0x2fff, 119 { 1168, 0x1103 },
119 [12592] = 0x2fff, [12596] = 0x2fff, [12600] = 0x2fff, [12604] = 0x2fff, 120 { 1169, 0x0564 },
120 [12608] = 0x0061, [12610] = 0x0601, [12612] = 0x0050, [12614] = 0x0102, 121 { 1170, 0x0559 },
121 [12616] = 0x0001, [12618] = 0x0106, [12619] = 0x0100, [12620] = 0x2fff, 122 { 1171, 0x4000 },
122 [12624] = 0x2fff, [12628] = 0x2fff, [12632] = 0x2fff, [12636] = 0x2fff, 123 { 1184, 0x6318 },
123 [12640] = 0x2fff, [12644] = 0x2fff, [12648] = 0x2fff, [12652] = 0x2fff, 124 { 1185, 0x6300 },
124 [12656] = 0x2fff, [12660] = 0x2fff, [12664] = 0x2fff, [12668] = 0x2fff, 125 { 1186, 0x0fca },
125 [12672] = 0x0060, [12674] = 0x0601, [12676] = 0x0061, [12678] = 0x0601, 126 { 1187, 0x0400 },
126 [12680] = 0x0050, [12682] = 0x0300, [12684] = 0x0001, [12686] = 0x0304, 127 { 1188, 0x00d8 },
127 [12688] = 0x0040, [12690] = 0x000f, [12692] = 0x0001, [12695] = 0x0100 128 { 1189, 0x1eb5 },
129 { 1190, 0xf145 },
130 { 1191, 0x0b75 },
131 { 1192, 0x01c5 },
132 { 1193, 0x1c58 },
133 { 1194, 0xf373 },
134 { 1195, 0x0a54 },
135 { 1196, 0x0558 },
136 { 1197, 0x168e },
137 { 1198, 0xf829 },
138 { 1199, 0x07ad },
139 { 1200, 0x1103 },
140 { 1201, 0x0564 },
141 { 1202, 0x0559 },
142 { 1203, 0x4000 },
143 { 1280, 0x00c0 },
144 { 1281, 0x00c0 },
145 { 1282, 0x00c0 },
146 { 1283, 0x00c0 },
147 { 1312, 0x0200 },
148 { 1313, 0x0010 },
149 { 1344, 0x0098 },
150 { 1345, 0x0845 },
151 { 1408, 0x6318 },
152 { 1409, 0x6300 },
153 { 1410, 0x0fca },
154 { 1411, 0x0400 },
155 { 1412, 0x00d8 },
156 { 1413, 0x1eb5 },
157 { 1414, 0xf145 },
158 { 1415, 0x0b75 },
159 { 1416, 0x01c5 },
160 { 1417, 0x1c58 },
161 { 1418, 0xf373 },
162 { 1419, 0x0a54 },
163 { 1420, 0x0558 },
164 { 1421, 0x168e },
165 { 1422, 0xf829 },
166 { 1423, 0x07ad },
167 { 1424, 0x1103 },
168 { 1425, 0x0564 },
169 { 1426, 0x0559 },
170 { 1427, 0x4000 },
171 { 1568, 0x0002 },
172 { 1792, 0xa100 },
173 { 1793, 0xa101 },
174 { 1794, 0xa101 },
175 { 1795, 0xa101 },
176 { 1796, 0xa101 },
177 { 1797, 0xa101 },
178 { 1798, 0xa101 },
179 { 1799, 0xa101 },
180 { 1800, 0xa101 },
181 { 1801, 0xa101 },
182 { 1802, 0xa101 },
183 { 1803, 0xa101 },
184 { 1804, 0xa101 },
185 { 1805, 0xa101 },
186 { 1825, 0x0055 },
187 { 1848, 0x3fff },
188 { 1849, 0x1fff },
189 { 2049, 0x0001 },
190 { 2050, 0x0069 },
191 { 2056, 0x0002 },
192 { 2057, 0x0003 },
193 { 2058, 0x0069 },
194 { 12288, 0x0001 },
195 { 12289, 0x0001 },
196 { 12291, 0x0006 },
197 { 12292, 0x0040 },
198 { 12293, 0x0001 },
199 { 12294, 0x000f },
200 { 12295, 0x0006 },
201 { 12296, 0x0001 },
202 { 12297, 0x0003 },
203 { 12298, 0x0104 },
204 { 12300, 0x0060 },
205 { 12301, 0x0011 },
206 { 12302, 0x0401 },
207 { 12304, 0x0050 },
208 { 12305, 0x0003 },
209 { 12306, 0x0100 },
210 { 12308, 0x0051 },
211 { 12309, 0x0003 },
212 { 12310, 0x0104 },
213 { 12311, 0x000a },
214 { 12312, 0x0060 },
215 { 12313, 0x003b },
216 { 12314, 0x0502 },
217 { 12315, 0x0100 },
218 { 12316, 0x2fff },
219 { 12320, 0x2fff },
220 { 12324, 0x2fff },
221 { 12328, 0x2fff },
222 { 12332, 0x2fff },
223 { 12336, 0x2fff },
224 { 12340, 0x2fff },
225 { 12344, 0x2fff },
226 { 12348, 0x2fff },
227 { 12352, 0x0001 },
228 { 12353, 0x0001 },
229 { 12355, 0x0006 },
230 { 12356, 0x0040 },
231 { 12357, 0x0001 },
232 { 12358, 0x000f },
233 { 12359, 0x0006 },
234 { 12360, 0x0001 },
235 { 12361, 0x0003 },
236 { 12362, 0x0104 },
237 { 12364, 0x0060 },
238 { 12365, 0x0011 },
239 { 12366, 0x0401 },
240 { 12368, 0x0050 },
241 { 12369, 0x0003 },
242 { 12370, 0x0100 },
243 { 12372, 0x0060 },
244 { 12373, 0x003b },
245 { 12374, 0x0502 },
246 { 12375, 0x0100 },
247 { 12376, 0x2fff },
248 { 12380, 0x2fff },
249 { 12384, 0x2fff },
250 { 12388, 0x2fff },
251 { 12392, 0x2fff },
252 { 12396, 0x2fff },
253 { 12400, 0x2fff },
254 { 12404, 0x2fff },
255 { 12408, 0x2fff },
256 { 12412, 0x2fff },
257 { 12416, 0x0001 },
258 { 12417, 0x0001 },
259 { 12419, 0x0006 },
260 { 12420, 0x0040 },
261 { 12421, 0x0001 },
262 { 12422, 0x000f },
263 { 12423, 0x0006 },
264 { 12424, 0x0001 },
265 { 12425, 0x0003 },
266 { 12426, 0x0106 },
267 { 12428, 0x0061 },
268 { 12429, 0x0011 },
269 { 12430, 0x0401 },
270 { 12432, 0x0050 },
271 { 12433, 0x0003 },
272 { 12434, 0x0102 },
273 { 12436, 0x0051 },
274 { 12437, 0x0003 },
275 { 12438, 0x0106 },
276 { 12439, 0x000a },
277 { 12440, 0x0061 },
278 { 12441, 0x003b },
279 { 12442, 0x0502 },
280 { 12443, 0x0100 },
281 { 12444, 0x2fff },
282 { 12448, 0x2fff },
283 { 12452, 0x2fff },
284 { 12456, 0x2fff },
285 { 12460, 0x2fff },
286 { 12464, 0x2fff },
287 { 12468, 0x2fff },
288 { 12472, 0x2fff },
289 { 12476, 0x2fff },
290 { 12480, 0x0001 },
291 { 12481, 0x0001 },
292 { 12483, 0x0006 },
293 { 12484, 0x0040 },
294 { 12485, 0x0001 },
295 { 12486, 0x000f },
296 { 12487, 0x0006 },
297 { 12488, 0x0001 },
298 { 12489, 0x0003 },
299 { 12490, 0x0106 },
300 { 12492, 0x0061 },
301 { 12493, 0x0011 },
302 { 12494, 0x0401 },
303 { 12496, 0x0050 },
304 { 12497, 0x0003 },
305 { 12498, 0x0102 },
306 { 12500, 0x0061 },
307 { 12501, 0x003b },
308 { 12502, 0x0502 },
309 { 12503, 0x0100 },
310 { 12504, 0x2fff },
311 { 12508, 0x2fff },
312 { 12512, 0x2fff },
313 { 12516, 0x2fff },
314 { 12520, 0x2fff },
315 { 12524, 0x2fff },
316 { 12528, 0x2fff },
317 { 12532, 0x2fff },
318 { 12536, 0x2fff },
319 { 12540, 0x2fff },
320 { 12544, 0x0060 },
321 { 12546, 0x0601 },
322 { 12548, 0x0050 },
323 { 12550, 0x0100 },
324 { 12552, 0x0001 },
325 { 12554, 0x0104 },
326 { 12555, 0x0100 },
327 { 12556, 0x2fff },
328 { 12560, 0x2fff },
329 { 12564, 0x2fff },
330 { 12568, 0x2fff },
331 { 12572, 0x2fff },
332 { 12576, 0x2fff },
333 { 12580, 0x2fff },
334 { 12584, 0x2fff },
335 { 12588, 0x2fff },
336 { 12592, 0x2fff },
337 { 12596, 0x2fff },
338 { 12600, 0x2fff },
339 { 12604, 0x2fff },
340 { 12608, 0x0061 },
341 { 12610, 0x0601 },
342 { 12612, 0x0050 },
343 { 12614, 0x0102 },
344 { 12616, 0x0001 },
345 { 12618, 0x0106 },
346 { 12619, 0x0100 },
347 { 12620, 0x2fff },
348 { 12624, 0x2fff },
349 { 12628, 0x2fff },
350 { 12632, 0x2fff },
351 { 12636, 0x2fff },
352 { 12640, 0x2fff },
353 { 12644, 0x2fff },
354 { 12648, 0x2fff },
355 { 12652, 0x2fff },
356 { 12656, 0x2fff },
357 { 12660, 0x2fff },
358 { 12664, 0x2fff },
359 { 12668, 0x2fff },
360 { 12672, 0x0060 },
361 { 12674, 0x0601 },
362 { 12676, 0x0061 },
363 { 12678, 0x0601 },
364 { 12680, 0x0050 },
365 { 12682, 0x0300 },
366 { 12684, 0x0001 },
367 { 12686, 0x0304 },
368 { 12688, 0x0040 },
369 { 12690, 0x000f },
370 { 12692, 0x0001 },
371 { 12695, 0x0100 },
128}; 372};
129 373
130struct fll_config { 374struct fll_config {
@@ -134,7 +378,7 @@ struct fll_config {
134}; 378};
135 379
136struct wm8995_priv { 380struct wm8995_priv {
137 enum snd_soc_control_type control_type; 381 struct regmap *regmap;
138 int sysclk[2]; 382 int sysclk[2];
139 int mclk[2]; 383 int mclk[2];
140 int aifclk[2]; 384 int aifclk[2];
@@ -156,7 +400,7 @@ static int wm8995_regulator_event_##n(struct notifier_block *nb, \
156 struct wm8995_priv *wm8995 = container_of(nb, struct wm8995_priv, \ 400 struct wm8995_priv *wm8995 = container_of(nb, struct wm8995_priv, \
157 disable_nb[n]); \ 401 disable_nb[n]); \
158 if (event & REGULATOR_EVENT_DISABLE) { \ 402 if (event & REGULATOR_EVENT_DISABLE) { \
159 wm8995->codec->cache_sync = 1; \ 403 regcache_mark_dirty(wm8995->regmap); \
160 } \ 404 } \
161 return 0; \ 405 return 0; \
162} 406}
@@ -688,8 +932,10 @@ static const struct snd_soc_dapm_widget wm8995_dapm_widgets[] = {
688 SND_SOC_DAPM_MIXER("IN1R PGA", SND_SOC_NOPM, 0, 0, 932 SND_SOC_DAPM_MIXER("IN1R PGA", SND_SOC_NOPM, 0, 0,
689 &in1r_pga, 1), 933 &in1r_pga, 1),
690 934
691 SND_SOC_DAPM_MICBIAS("MICBIAS1", WM8995_POWER_MANAGEMENT_1, 8, 0), 935 SND_SOC_DAPM_SUPPLY("MICBIAS1", WM8995_POWER_MANAGEMENT_1, 8, 0,
692 SND_SOC_DAPM_MICBIAS("MICBIAS2", WM8995_POWER_MANAGEMENT_1, 9, 0), 936 NULL, 0),
937 SND_SOC_DAPM_SUPPLY("MICBIAS2", WM8995_POWER_MANAGEMENT_1, 9, 0,
938 NULL, 0),
693 939
694 SND_SOC_DAPM_SUPPLY("AIF1CLK", WM8995_AIF1_CLOCKING_1, 0, 0, NULL, 0), 940 SND_SOC_DAPM_SUPPLY("AIF1CLK", WM8995_AIF1_CLOCKING_1, 0, 0, NULL, 0),
695 SND_SOC_DAPM_SUPPLY("AIF2CLK", WM8995_AIF2_CLOCKING_1, 0, 0, NULL, 0), 941 SND_SOC_DAPM_SUPPLY("AIF2CLK", WM8995_AIF2_CLOCKING_1, 0, 0, NULL, 0),
@@ -947,31 +1193,244 @@ static const struct snd_soc_dapm_route wm8995_intercon[] = {
947 { "SPK2R", NULL, "SPK2R Driver" } 1193 { "SPK2R", NULL, "SPK2R Driver" }
948}; 1194};
949 1195
950static int wm8995_volatile(struct snd_soc_codec *codec, unsigned int reg) 1196static bool wm8995_readable(struct device *dev, unsigned int reg)
951{ 1197{
952 /* out of bounds registers are generally considered
953 * volatile to support register banks that are partially
954 * owned by something else for e.g. a DSP
955 */
956 if (reg > WM8995_MAX_CACHED_REGISTER)
957 return 1;
958
959 switch (reg) { 1198 switch (reg) {
960 case WM8995_SOFTWARE_RESET: 1199 case WM8995_SOFTWARE_RESET:
1200 case WM8995_POWER_MANAGEMENT_1:
1201 case WM8995_POWER_MANAGEMENT_2:
1202 case WM8995_POWER_MANAGEMENT_3:
1203 case WM8995_POWER_MANAGEMENT_4:
1204 case WM8995_POWER_MANAGEMENT_5:
1205 case WM8995_LEFT_LINE_INPUT_1_VOLUME:
1206 case WM8995_RIGHT_LINE_INPUT_1_VOLUME:
1207 case WM8995_LEFT_LINE_INPUT_CONTROL:
1208 case WM8995_DAC1_LEFT_VOLUME:
1209 case WM8995_DAC1_RIGHT_VOLUME:
1210 case WM8995_DAC2_LEFT_VOLUME:
1211 case WM8995_DAC2_RIGHT_VOLUME:
1212 case WM8995_OUTPUT_VOLUME_ZC_1:
1213 case WM8995_MICBIAS_1:
1214 case WM8995_MICBIAS_2:
1215 case WM8995_LDO_1:
1216 case WM8995_LDO_2:
1217 case WM8995_ACCESSORY_DETECT_MODE1:
1218 case WM8995_ACCESSORY_DETECT_MODE2:
1219 case WM8995_HEADPHONE_DETECT1:
1220 case WM8995_HEADPHONE_DETECT2:
1221 case WM8995_MIC_DETECT_1:
1222 case WM8995_MIC_DETECT_2:
1223 case WM8995_CHARGE_PUMP_1:
1224 case WM8995_CLASS_W_1:
1225 case WM8995_DC_SERVO_1:
1226 case WM8995_DC_SERVO_2:
1227 case WM8995_DC_SERVO_3:
1228 case WM8995_DC_SERVO_5:
1229 case WM8995_DC_SERVO_6:
1230 case WM8995_DC_SERVO_7:
961 case WM8995_DC_SERVO_READBACK_0: 1231 case WM8995_DC_SERVO_READBACK_0:
1232 case WM8995_ANALOGUE_HP_1:
1233 case WM8995_ANALOGUE_HP_2:
1234 case WM8995_CHIP_REVISION:
1235 case WM8995_CONTROL_INTERFACE_1:
1236 case WM8995_CONTROL_INTERFACE_2:
1237 case WM8995_WRITE_SEQUENCER_CTRL_1:
1238 case WM8995_WRITE_SEQUENCER_CTRL_2:
1239 case WM8995_AIF1_CLOCKING_1:
1240 case WM8995_AIF1_CLOCKING_2:
1241 case WM8995_AIF2_CLOCKING_1:
1242 case WM8995_AIF2_CLOCKING_2:
1243 case WM8995_CLOCKING_1:
1244 case WM8995_CLOCKING_2:
1245 case WM8995_AIF1_RATE:
1246 case WM8995_AIF2_RATE:
1247 case WM8995_RATE_STATUS:
1248 case WM8995_FLL1_CONTROL_1:
1249 case WM8995_FLL1_CONTROL_2:
1250 case WM8995_FLL1_CONTROL_3:
1251 case WM8995_FLL1_CONTROL_4:
1252 case WM8995_FLL1_CONTROL_5:
1253 case WM8995_FLL2_CONTROL_1:
1254 case WM8995_FLL2_CONTROL_2:
1255 case WM8995_FLL2_CONTROL_3:
1256 case WM8995_FLL2_CONTROL_4:
1257 case WM8995_FLL2_CONTROL_5:
1258 case WM8995_AIF1_CONTROL_1:
1259 case WM8995_AIF1_CONTROL_2:
1260 case WM8995_AIF1_MASTER_SLAVE:
1261 case WM8995_AIF1_BCLK:
1262 case WM8995_AIF1ADC_LRCLK:
1263 case WM8995_AIF1DAC_LRCLK:
1264 case WM8995_AIF1DAC_DATA:
1265 case WM8995_AIF1ADC_DATA:
1266 case WM8995_AIF2_CONTROL_1:
1267 case WM8995_AIF2_CONTROL_2:
1268 case WM8995_AIF2_MASTER_SLAVE:
1269 case WM8995_AIF2_BCLK:
1270 case WM8995_AIF2ADC_LRCLK:
1271 case WM8995_AIF2DAC_LRCLK:
1272 case WM8995_AIF2DAC_DATA:
1273 case WM8995_AIF2ADC_DATA:
1274 case WM8995_AIF1_ADC1_LEFT_VOLUME:
1275 case WM8995_AIF1_ADC1_RIGHT_VOLUME:
1276 case WM8995_AIF1_DAC1_LEFT_VOLUME:
1277 case WM8995_AIF1_DAC1_RIGHT_VOLUME:
1278 case WM8995_AIF1_ADC2_LEFT_VOLUME:
1279 case WM8995_AIF1_ADC2_RIGHT_VOLUME:
1280 case WM8995_AIF1_DAC2_LEFT_VOLUME:
1281 case WM8995_AIF1_DAC2_RIGHT_VOLUME:
1282 case WM8995_AIF1_ADC1_FILTERS:
1283 case WM8995_AIF1_ADC2_FILTERS:
1284 case WM8995_AIF1_DAC1_FILTERS_1:
1285 case WM8995_AIF1_DAC1_FILTERS_2:
1286 case WM8995_AIF1_DAC2_FILTERS_1:
1287 case WM8995_AIF1_DAC2_FILTERS_2:
1288 case WM8995_AIF1_DRC1_1:
1289 case WM8995_AIF1_DRC1_2:
1290 case WM8995_AIF1_DRC1_3:
1291 case WM8995_AIF1_DRC1_4:
1292 case WM8995_AIF1_DRC1_5:
1293 case WM8995_AIF1_DRC2_1:
1294 case WM8995_AIF1_DRC2_2:
1295 case WM8995_AIF1_DRC2_3:
1296 case WM8995_AIF1_DRC2_4:
1297 case WM8995_AIF1_DRC2_5:
1298 case WM8995_AIF1_DAC1_EQ_GAINS_1:
1299 case WM8995_AIF1_DAC1_EQ_GAINS_2:
1300 case WM8995_AIF1_DAC1_EQ_BAND_1_A:
1301 case WM8995_AIF1_DAC1_EQ_BAND_1_B:
1302 case WM8995_AIF1_DAC1_EQ_BAND_1_PG:
1303 case WM8995_AIF1_DAC1_EQ_BAND_2_A:
1304 case WM8995_AIF1_DAC1_EQ_BAND_2_B:
1305 case WM8995_AIF1_DAC1_EQ_BAND_2_C:
1306 case WM8995_AIF1_DAC1_EQ_BAND_2_PG:
1307 case WM8995_AIF1_DAC1_EQ_BAND_3_A:
1308 case WM8995_AIF1_DAC1_EQ_BAND_3_B:
1309 case WM8995_AIF1_DAC1_EQ_BAND_3_C:
1310 case WM8995_AIF1_DAC1_EQ_BAND_3_PG:
1311 case WM8995_AIF1_DAC1_EQ_BAND_4_A:
1312 case WM8995_AIF1_DAC1_EQ_BAND_4_B:
1313 case WM8995_AIF1_DAC1_EQ_BAND_4_C:
1314 case WM8995_AIF1_DAC1_EQ_BAND_4_PG:
1315 case WM8995_AIF1_DAC1_EQ_BAND_5_A:
1316 case WM8995_AIF1_DAC1_EQ_BAND_5_B:
1317 case WM8995_AIF1_DAC1_EQ_BAND_5_PG:
1318 case WM8995_AIF1_DAC2_EQ_GAINS_1:
1319 case WM8995_AIF1_DAC2_EQ_GAINS_2:
1320 case WM8995_AIF1_DAC2_EQ_BAND_1_A:
1321 case WM8995_AIF1_DAC2_EQ_BAND_1_B:
1322 case WM8995_AIF1_DAC2_EQ_BAND_1_PG:
1323 case WM8995_AIF1_DAC2_EQ_BAND_2_A:
1324 case WM8995_AIF1_DAC2_EQ_BAND_2_B:
1325 case WM8995_AIF1_DAC2_EQ_BAND_2_C:
1326 case WM8995_AIF1_DAC2_EQ_BAND_2_PG:
1327 case WM8995_AIF1_DAC2_EQ_BAND_3_A:
1328 case WM8995_AIF1_DAC2_EQ_BAND_3_B:
1329 case WM8995_AIF1_DAC2_EQ_BAND_3_C:
1330 case WM8995_AIF1_DAC2_EQ_BAND_3_PG:
1331 case WM8995_AIF1_DAC2_EQ_BAND_4_A:
1332 case WM8995_AIF1_DAC2_EQ_BAND_4_B:
1333 case WM8995_AIF1_DAC2_EQ_BAND_4_C:
1334 case WM8995_AIF1_DAC2_EQ_BAND_4_PG:
1335 case WM8995_AIF1_DAC2_EQ_BAND_5_A:
1336 case WM8995_AIF1_DAC2_EQ_BAND_5_B:
1337 case WM8995_AIF1_DAC2_EQ_BAND_5_PG:
1338 case WM8995_AIF2_ADC_LEFT_VOLUME:
1339 case WM8995_AIF2_ADC_RIGHT_VOLUME:
1340 case WM8995_AIF2_DAC_LEFT_VOLUME:
1341 case WM8995_AIF2_DAC_RIGHT_VOLUME:
1342 case WM8995_AIF2_ADC_FILTERS:
1343 case WM8995_AIF2_DAC_FILTERS_1:
1344 case WM8995_AIF2_DAC_FILTERS_2:
1345 case WM8995_AIF2_DRC_1:
1346 case WM8995_AIF2_DRC_2:
1347 case WM8995_AIF2_DRC_3:
1348 case WM8995_AIF2_DRC_4:
1349 case WM8995_AIF2_DRC_5:
1350 case WM8995_AIF2_EQ_GAINS_1:
1351 case WM8995_AIF2_EQ_GAINS_2:
1352 case WM8995_AIF2_EQ_BAND_1_A:
1353 case WM8995_AIF2_EQ_BAND_1_B:
1354 case WM8995_AIF2_EQ_BAND_1_PG:
1355 case WM8995_AIF2_EQ_BAND_2_A:
1356 case WM8995_AIF2_EQ_BAND_2_B:
1357 case WM8995_AIF2_EQ_BAND_2_C:
1358 case WM8995_AIF2_EQ_BAND_2_PG:
1359 case WM8995_AIF2_EQ_BAND_3_A:
1360 case WM8995_AIF2_EQ_BAND_3_B:
1361 case WM8995_AIF2_EQ_BAND_3_C:
1362 case WM8995_AIF2_EQ_BAND_3_PG:
1363 case WM8995_AIF2_EQ_BAND_4_A:
1364 case WM8995_AIF2_EQ_BAND_4_B:
1365 case WM8995_AIF2_EQ_BAND_4_C:
1366 case WM8995_AIF2_EQ_BAND_4_PG:
1367 case WM8995_AIF2_EQ_BAND_5_A:
1368 case WM8995_AIF2_EQ_BAND_5_B:
1369 case WM8995_AIF2_EQ_BAND_5_PG:
1370 case WM8995_DAC1_MIXER_VOLUMES:
1371 case WM8995_DAC1_LEFT_MIXER_ROUTING:
1372 case WM8995_DAC1_RIGHT_MIXER_ROUTING:
1373 case WM8995_DAC2_MIXER_VOLUMES:
1374 case WM8995_DAC2_LEFT_MIXER_ROUTING:
1375 case WM8995_DAC2_RIGHT_MIXER_ROUTING:
1376 case WM8995_AIF1_ADC1_LEFT_MIXER_ROUTING:
1377 case WM8995_AIF1_ADC1_RIGHT_MIXER_ROUTING:
1378 case WM8995_AIF1_ADC2_LEFT_MIXER_ROUTING:
1379 case WM8995_AIF1_ADC2_RIGHT_MIXER_ROUTING:
1380 case WM8995_DAC_SOFTMUTE:
1381 case WM8995_OVERSAMPLING:
1382 case WM8995_SIDETONE:
1383 case WM8995_GPIO_1:
1384 case WM8995_GPIO_2:
1385 case WM8995_GPIO_3:
1386 case WM8995_GPIO_4:
1387 case WM8995_GPIO_5:
1388 case WM8995_GPIO_6:
1389 case WM8995_GPIO_7:
1390 case WM8995_GPIO_8:
1391 case WM8995_GPIO_9:
1392 case WM8995_GPIO_10:
1393 case WM8995_GPIO_11:
1394 case WM8995_GPIO_12:
1395 case WM8995_GPIO_13:
1396 case WM8995_GPIO_14:
1397 case WM8995_PULL_CONTROL_1:
1398 case WM8995_PULL_CONTROL_2:
962 case WM8995_INTERRUPT_STATUS_1: 1399 case WM8995_INTERRUPT_STATUS_1:
963 case WM8995_INTERRUPT_STATUS_2: 1400 case WM8995_INTERRUPT_STATUS_2:
1401 case WM8995_INTERRUPT_RAW_STATUS_2:
964 case WM8995_INTERRUPT_STATUS_1_MASK: 1402 case WM8995_INTERRUPT_STATUS_1_MASK:
965 case WM8995_INTERRUPT_STATUS_2_MASK: 1403 case WM8995_INTERRUPT_STATUS_2_MASK:
966 case WM8995_INTERRUPT_CONTROL: 1404 case WM8995_INTERRUPT_CONTROL:
1405 case WM8995_LEFT_PDM_SPEAKER_1:
1406 case WM8995_RIGHT_PDM_SPEAKER_1:
1407 case WM8995_PDM_SPEAKER_1_MUTE_SEQUENCE:
1408 case WM8995_LEFT_PDM_SPEAKER_2:
1409 case WM8995_RIGHT_PDM_SPEAKER_2:
1410 case WM8995_PDM_SPEAKER_2_MUTE_SEQUENCE:
1411 return true;
1412 default:
1413 return false;
1414 }
1415}
1416
1417static bool wm8995_volatile(struct device *dev, unsigned int reg)
1418{
1419 switch (reg) {
1420 case WM8995_SOFTWARE_RESET:
1421 case WM8995_DC_SERVO_READBACK_0:
1422 case WM8995_INTERRUPT_STATUS_1:
1423 case WM8995_INTERRUPT_STATUS_2:
1424 case WM8995_INTERRUPT_CONTROL:
967 case WM8995_ACCESSORY_DETECT_MODE1: 1425 case WM8995_ACCESSORY_DETECT_MODE1:
968 case WM8995_ACCESSORY_DETECT_MODE2: 1426 case WM8995_ACCESSORY_DETECT_MODE2:
969 case WM8995_HEADPHONE_DETECT1: 1427 case WM8995_HEADPHONE_DETECT1:
970 case WM8995_HEADPHONE_DETECT2: 1428 case WM8995_HEADPHONE_DETECT2:
971 return 1; 1429 case WM8995_RATE_STATUS:
1430 return true;
1431 default:
1432 return false;
972 } 1433 }
973
974 return 0;
975} 1434}
976 1435
977static int wm8995_aif_mute(struct snd_soc_dai *dai, int mute) 1436static int wm8995_aif_mute(struct snd_soc_dai *dai, int mute)
@@ -1526,7 +1985,7 @@ static int wm8995_set_bias_level(struct snd_soc_codec *codec,
1526 if (ret) 1985 if (ret)
1527 return ret; 1986 return ret;
1528 1987
1529 ret = snd_soc_cache_sync(codec); 1988 ret = regcache_sync(wm8995->regmap);
1530 if (ret) { 1989 if (ret) {
1531 dev_err(codec->dev, 1990 dev_err(codec->dev,
1532 "Failed to sync cache: %d\n", ret); 1991 "Failed to sync cache: %d\n", ret);
@@ -1550,7 +2009,7 @@ static int wm8995_set_bias_level(struct snd_soc_codec *codec,
1550} 2009}
1551 2010
1552#ifdef CONFIG_PM 2011#ifdef CONFIG_PM
1553static int wm8995_suspend(struct snd_soc_codec *codec, pm_message_t state) 2012static int wm8995_suspend(struct snd_soc_codec *codec)
1554{ 2013{
1555 wm8995_set_bias_level(codec, SND_SOC_BIAS_OFF); 2014 wm8995_set_bias_level(codec, SND_SOC_BIAS_OFF);
1556 return 0; 2015 return 0;
@@ -1592,7 +2051,8 @@ static int wm8995_probe(struct snd_soc_codec *codec)
1592 wm8995 = snd_soc_codec_get_drvdata(codec); 2051 wm8995 = snd_soc_codec_get_drvdata(codec);
1593 wm8995->codec = codec; 2052 wm8995->codec = codec;
1594 2053
1595 ret = snd_soc_codec_set_cache_io(codec, 16, 16, wm8995->control_type); 2054 codec->control_data = wm8995->regmap;
2055 ret = snd_soc_codec_set_cache_io(codec, 16, 16, SND_SOC_REGMAP);
1596 if (ret < 0) { 2056 if (ret < 0) {
1597 dev_err(codec->dev, "Failed to set cache i/o: %d\n", ret); 2057 dev_err(codec->dev, "Failed to set cache i/o: %d\n", ret);
1598 return ret; 2058 return ret;
@@ -1696,7 +2156,7 @@ err_reg_get:
1696#define WM8995_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\ 2156#define WM8995_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\
1697 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE) 2157 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE)
1698 2158
1699static struct snd_soc_dai_ops wm8995_aif1_dai_ops = { 2159static const struct snd_soc_dai_ops wm8995_aif1_dai_ops = {
1700 .set_sysclk = wm8995_set_dai_sysclk, 2160 .set_sysclk = wm8995_set_dai_sysclk,
1701 .set_fmt = wm8995_set_dai_fmt, 2161 .set_fmt = wm8995_set_dai_fmt,
1702 .hw_params = wm8995_hw_params, 2162 .hw_params = wm8995_hw_params,
@@ -1705,7 +2165,7 @@ static struct snd_soc_dai_ops wm8995_aif1_dai_ops = {
1705 .set_tristate = wm8995_set_tristate, 2165 .set_tristate = wm8995_set_tristate,
1706}; 2166};
1707 2167
1708static struct snd_soc_dai_ops wm8995_aif2_dai_ops = { 2168static const struct snd_soc_dai_ops wm8995_aif2_dai_ops = {
1709 .set_sysclk = wm8995_set_dai_sysclk, 2169 .set_sysclk = wm8995_set_dai_sysclk,
1710 .set_fmt = wm8995_set_dai_fmt, 2170 .set_fmt = wm8995_set_dai_fmt,
1711 .hw_params = wm8995_hw_params, 2171 .hw_params = wm8995_hw_params,
@@ -1714,7 +2174,7 @@ static struct snd_soc_dai_ops wm8995_aif2_dai_ops = {
1714 .set_tristate = wm8995_set_tristate, 2174 .set_tristate = wm8995_set_tristate,
1715}; 2175};
1716 2176
1717static struct snd_soc_dai_ops wm8995_aif3_dai_ops = { 2177static const struct snd_soc_dai_ops wm8995_aif3_dai_ops = {
1718 .set_tristate = wm8995_set_tristate, 2178 .set_tristate = wm8995_set_tristate,
1719}; 2179};
1720 2180
@@ -1781,11 +2241,18 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8995 = {
1781 .suspend = wm8995_suspend, 2241 .suspend = wm8995_suspend,
1782 .resume = wm8995_resume, 2242 .resume = wm8995_resume,
1783 .set_bias_level = wm8995_set_bias_level, 2243 .set_bias_level = wm8995_set_bias_level,
1784 .reg_cache_size = ARRAY_SIZE(wm8995_reg_defs), 2244};
1785 .reg_word_size = sizeof(u16), 2245
1786 .reg_cache_default = wm8995_reg_defs, 2246static struct regmap_config wm8995_regmap = {
1787 .volatile_register = wm8995_volatile, 2247 .reg_bits = 16,
1788 .compress_type = SND_SOC_RBTREE_COMPRESSION 2248 .val_bits = 16,
2249
2250 .max_register = WM8995_MAX_REGISTER,
2251 .reg_defaults = wm8995_reg_defaults,
2252 .num_reg_defaults = ARRAY_SIZE(wm8995_reg_defaults),
2253 .volatile_reg = wm8995_volatile,
2254 .readable_reg = wm8995_readable,
2255 .cache_type = REGCACHE_RBTREE,
1789}; 2256};
1790 2257
1791#if defined(CONFIG_SPI_MASTER) 2258#if defined(CONFIG_SPI_MASTER)
@@ -1798,21 +2265,37 @@ static int __devinit wm8995_spi_probe(struct spi_device *spi)
1798 if (!wm8995) 2265 if (!wm8995)
1799 return -ENOMEM; 2266 return -ENOMEM;
1800 2267
1801 wm8995->control_type = SND_SOC_SPI;
1802 spi_set_drvdata(spi, wm8995); 2268 spi_set_drvdata(spi, wm8995);
1803 2269
2270 wm8995->regmap = regmap_init_spi(spi, &wm8995_regmap);
2271 if (IS_ERR(wm8995->regmap)) {
2272 ret = PTR_ERR(wm8995->regmap);
2273 dev_err(&spi->dev, "Failed to register regmap: %d\n", ret);
2274 goto err_alloc;
2275 }
2276
1804 ret = snd_soc_register_codec(&spi->dev, 2277 ret = snd_soc_register_codec(&spi->dev,
1805 &soc_codec_dev_wm8995, wm8995_dai, 2278 &soc_codec_dev_wm8995, wm8995_dai,
1806 ARRAY_SIZE(wm8995_dai)); 2279 ARRAY_SIZE(wm8995_dai));
1807 if (ret < 0) 2280 if (ret < 0)
1808 kfree(wm8995); 2281 goto err_regmap;
2282
2283 return ret;
2284
2285err_regmap:
2286 regmap_exit(wm8995->regmap);
2287err_alloc:
2288 kfree(wm8995);
2289
1809 return ret; 2290 return ret;
1810} 2291}
1811 2292
1812static int __devexit wm8995_spi_remove(struct spi_device *spi) 2293static int __devexit wm8995_spi_remove(struct spi_device *spi)
1813{ 2294{
2295 struct wm8995_priv *wm8995 = spi_get_drvdata(spi);
1814 snd_soc_unregister_codec(&spi->dev); 2296 snd_soc_unregister_codec(&spi->dev);
1815 kfree(spi_get_drvdata(spi)); 2297 regmap_exit(wm8995->regmap);
2298 kfree(wm8995);
1816 return 0; 2299 return 0;
1817} 2300}
1818 2301
@@ -1837,21 +2320,40 @@ static __devinit int wm8995_i2c_probe(struct i2c_client *i2c,
1837 if (!wm8995) 2320 if (!wm8995)
1838 return -ENOMEM; 2321 return -ENOMEM;
1839 2322
1840 wm8995->control_type = SND_SOC_I2C;
1841 i2c_set_clientdata(i2c, wm8995); 2323 i2c_set_clientdata(i2c, wm8995);
1842 2324
2325 wm8995->regmap = regmap_init_i2c(i2c, &wm8995_regmap);
2326 if (IS_ERR(wm8995->regmap)) {
2327 ret = PTR_ERR(wm8995->regmap);
2328 dev_err(&i2c->dev, "Failed to register regmap: %d\n", ret);
2329 goto err_alloc;
2330 }
2331
1843 ret = snd_soc_register_codec(&i2c->dev, 2332 ret = snd_soc_register_codec(&i2c->dev,
1844 &soc_codec_dev_wm8995, wm8995_dai, 2333 &soc_codec_dev_wm8995, wm8995_dai,
1845 ARRAY_SIZE(wm8995_dai)); 2334 ARRAY_SIZE(wm8995_dai));
1846 if (ret < 0) 2335 if (ret < 0) {
1847 kfree(wm8995); 2336 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
1848 return ret; 2347 return ret;
1849} 2348}
1850 2349
1851static __devexit int wm8995_i2c_remove(struct i2c_client *client) 2350static __devexit int wm8995_i2c_remove(struct i2c_client *client)
1852{ 2351{
2352 struct wm8995_priv *wm8995 = i2c_get_clientdata(client);
2353
1853 snd_soc_unregister_codec(&client->dev); 2354 snd_soc_unregister_codec(&client->dev);
1854 kfree(i2c_get_clientdata(client)); 2355 regmap_exit(wm8995->regmap);
2356 kfree(wm8995);
1855 return 0; 2357 return 0;
1856} 2358}
1857 2359
diff --git a/sound/soc/codecs/wm8996.c b/sound/soc/codecs/wm8996.c
index 645c980d6b8..d8da10fe5b5 100644
--- a/sound/soc/codecs/wm8996.c
+++ b/sound/soc/codecs/wm8996.c
@@ -19,6 +19,7 @@
19#include <linux/gcd.h> 19#include <linux/gcd.h>
20#include <linux/gpio.h> 20#include <linux/gpio.h>
21#include <linux/i2c.h> 21#include <linux/i2c.h>
22#include <linux/regmap.h>
22#include <linux/regulator/consumer.h> 23#include <linux/regulator/consumer.h>
23#include <linux/slab.h> 24#include <linux/slab.h>
24#include <linux/workqueue.h> 25#include <linux/workqueue.h>
@@ -49,6 +50,8 @@ static const char *wm8996_supply_names[WM8996_NUM_SUPPLIES] = {
49}; 50};
50 51
51struct wm8996_priv { 52struct wm8996_priv {
53 struct device *dev;
54 struct regmap *regmap;
52 struct snd_soc_codec *codec; 55 struct snd_soc_codec *codec;
53 56
54 int ldo1ena; 57 int ldo1ena;
@@ -105,7 +108,7 @@ static int wm8996_regulator_event_##n(struct notifier_block *nb, \
105 struct wm8996_priv *wm8996 = container_of(nb, struct wm8996_priv, \ 108 struct wm8996_priv *wm8996 = container_of(nb, struct wm8996_priv, \
106 disable_nb[n]); \ 109 disable_nb[n]); \
107 if (event & REGULATOR_EVENT_DISABLE) { \ 110 if (event & REGULATOR_EVENT_DISABLE) { \
108 wm8996->codec->cache_sync = 1; \ 111 regcache_cache_only(wm8996->regmap, true); \
109 } \ 112 } \
110 return 0; \ 113 return 0; \
111} 114}
@@ -114,297 +117,365 @@ WM8996_REGULATOR_EVENT(0)
114WM8996_REGULATOR_EVENT(1) 117WM8996_REGULATOR_EVENT(1)
115WM8996_REGULATOR_EVENT(2) 118WM8996_REGULATOR_EVENT(2)
116 119
117static const u16 wm8996_reg[WM8996_MAX_REGISTER] = { 120static struct reg_default wm8996_reg[] = {
118 [WM8996_SOFTWARE_RESET] = 0x8996, 121 { WM8996_SOFTWARE_RESET, 0x8996 },
119 [WM8996_POWER_MANAGEMENT_7] = 0x10, 122 { WM8996_POWER_MANAGEMENT_1, 0x0 },
120 [WM8996_DAC1_HPOUT1_VOLUME] = 0x88, 123 { WM8996_POWER_MANAGEMENT_2, 0x0 },
121 [WM8996_DAC2_HPOUT2_VOLUME] = 0x88, 124 { WM8996_POWER_MANAGEMENT_3, 0x0 },
122 [WM8996_DAC1_LEFT_VOLUME] = 0x2c0, 125 { WM8996_POWER_MANAGEMENT_4, 0x0 },
123 [WM8996_DAC1_RIGHT_VOLUME] = 0x2c0, 126 { WM8996_POWER_MANAGEMENT_5, 0x0 },
124 [WM8996_DAC2_LEFT_VOLUME] = 0x2c0, 127 { WM8996_POWER_MANAGEMENT_6, 0x0 },
125 [WM8996_DAC2_RIGHT_VOLUME] = 0x2c0, 128 { WM8996_POWER_MANAGEMENT_7, 0x10 },
126 [WM8996_OUTPUT1_LEFT_VOLUME] = 0x80, 129 { WM8996_POWER_MANAGEMENT_8, 0x0 },
127 [WM8996_OUTPUT1_RIGHT_VOLUME] = 0x80, 130 { WM8996_LEFT_LINE_INPUT_VOLUME, 0x0 },
128 [WM8996_OUTPUT2_LEFT_VOLUME] = 0x80, 131 { WM8996_RIGHT_LINE_INPUT_VOLUME, 0x0 },
129 [WM8996_OUTPUT2_RIGHT_VOLUME] = 0x80, 132 { WM8996_LINE_INPUT_CONTROL, 0x0 },
130 [WM8996_MICBIAS_1] = 0x39, 133 { WM8996_DAC1_HPOUT1_VOLUME, 0x88 },
131 [WM8996_MICBIAS_2] = 0x39, 134 { WM8996_DAC2_HPOUT2_VOLUME, 0x88 },
132 [WM8996_LDO_1] = 0x3, 135 { WM8996_DAC1_LEFT_VOLUME, 0x2c0 },
133 [WM8996_LDO_2] = 0x13, 136 { WM8996_DAC1_RIGHT_VOLUME, 0x2c0 },
134 [WM8996_ACCESSORY_DETECT_MODE_1] = 0x4, 137 { WM8996_DAC2_LEFT_VOLUME, 0x2c0 },
135 [WM8996_HEADPHONE_DETECT_1] = 0x20, 138 { WM8996_DAC2_RIGHT_VOLUME, 0x2c0 },
136 [WM8996_MIC_DETECT_1] = 0x7600, 139 { WM8996_OUTPUT1_LEFT_VOLUME, 0x80 },
137 [WM8996_MIC_DETECT_2] = 0xbf, 140 { WM8996_OUTPUT1_RIGHT_VOLUME, 0x80 },
138 [WM8996_CHARGE_PUMP_1] = 0x1f25, 141 { WM8996_OUTPUT2_LEFT_VOLUME, 0x80 },
139 [WM8996_CHARGE_PUMP_2] = 0xab19, 142 { WM8996_OUTPUT2_RIGHT_VOLUME, 0x80 },
140 [WM8996_DC_SERVO_5] = 0x2a2a, 143 { WM8996_MICBIAS_1, 0x39 },
141 [WM8996_CONTROL_INTERFACE_1] = 0x8004, 144 { WM8996_MICBIAS_2, 0x39 },
142 [WM8996_CLOCKING_1] = 0x10, 145 { WM8996_LDO_1, 0x3 },
143 [WM8996_AIF_RATE] = 0x83, 146 { WM8996_LDO_2, 0x13 },
144 [WM8996_FLL_CONTROL_4] = 0x5dc0, 147 { WM8996_ACCESSORY_DETECT_MODE_1, 0x4 },
145 [WM8996_FLL_CONTROL_5] = 0xc84, 148 { WM8996_ACCESSORY_DETECT_MODE_2, 0x0 },
146 [WM8996_FLL_EFS_2] = 0x2, 149 { WM8996_HEADPHONE_DETECT_1, 0x20 },
147 [WM8996_AIF1_TX_LRCLK_1] = 0x80, 150 { WM8996_HEADPHONE_DETECT_2, 0x0 },
148 [WM8996_AIF1_TX_LRCLK_2] = 0x8, 151 { WM8996_MIC_DETECT_1, 0x7600 },
149 [WM8996_AIF1_RX_LRCLK_1] = 0x80, 152 { WM8996_MIC_DETECT_2, 0xbf },
150 [WM8996_AIF1TX_DATA_CONFIGURATION_1] = 0x1818, 153 { WM8996_CHARGE_PUMP_1, 0x1f25 },
151 [WM8996_AIF1RX_DATA_CONFIGURATION] = 0x1818, 154 { WM8996_CHARGE_PUMP_2, 0xab19 },
152 [WM8996_AIF1TX_TEST] = 0x7, 155 { WM8996_DC_SERVO_1, 0x0 },
153 [WM8996_AIF2_TX_LRCLK_1] = 0x80, 156 { WM8996_DC_SERVO_2, 0x0 },
154 [WM8996_AIF2_TX_LRCLK_2] = 0x8, 157 { WM8996_DC_SERVO_3, 0x0 },
155 [WM8996_AIF2_RX_LRCLK_1] = 0x80, 158 { WM8996_DC_SERVO_5, 0x2a2a },
156 [WM8996_AIF2TX_DATA_CONFIGURATION_1] = 0x1818, 159 { WM8996_DC_SERVO_6, 0x0 },
157 [WM8996_AIF2RX_DATA_CONFIGURATION] = 0x1818, 160 { WM8996_DC_SERVO_7, 0x0 },
158 [WM8996_AIF2TX_TEST] = 0x1, 161 { WM8996_ANALOGUE_HP_1, 0x0 },
159 [WM8996_DSP1_TX_LEFT_VOLUME] = 0xc0, 162 { WM8996_ANALOGUE_HP_2, 0x0 },
160 [WM8996_DSP1_TX_RIGHT_VOLUME] = 0xc0, 163 { WM8996_CONTROL_INTERFACE_1, 0x8004 },
161 [WM8996_DSP1_RX_LEFT_VOLUME] = 0xc0, 164 { WM8996_WRITE_SEQUENCER_CTRL_1, 0x0 },
162 [WM8996_DSP1_RX_RIGHT_VOLUME] = 0xc0, 165 { WM8996_WRITE_SEQUENCER_CTRL_2, 0x0 },
163 [WM8996_DSP1_TX_FILTERS] = 0x2000, 166 { WM8996_AIF_CLOCKING_1, 0x0 },
164 [WM8996_DSP1_RX_FILTERS_1] = 0x200, 167 { WM8996_AIF_CLOCKING_2, 0x0 },
165 [WM8996_DSP1_RX_FILTERS_2] = 0x10, 168 { WM8996_CLOCKING_1, 0x10 },
166 [WM8996_DSP1_DRC_1] = 0x98, 169 { WM8996_CLOCKING_2, 0x0 },
167 [WM8996_DSP1_DRC_2] = 0x845, 170 { WM8996_AIF_RATE, 0x83 },
168 [WM8996_DSP1_RX_EQ_GAINS_1] = 0x6318, 171 { WM8996_FLL_CONTROL_1, 0x0 },
169 [WM8996_DSP1_RX_EQ_GAINS_2] = 0x6300, 172 { WM8996_FLL_CONTROL_2, 0x0 },
170 [WM8996_DSP1_RX_EQ_BAND_1_A] = 0xfca, 173 { WM8996_FLL_CONTROL_3, 0x0 },
171 [WM8996_DSP1_RX_EQ_BAND_1_B] = 0x400, 174 { WM8996_FLL_CONTROL_4, 0x5dc0 },
172 [WM8996_DSP1_RX_EQ_BAND_1_PG] = 0xd8, 175 { WM8996_FLL_CONTROL_5, 0xc84 },
173 [WM8996_DSP1_RX_EQ_BAND_2_A] = 0x1eb5, 176 { WM8996_FLL_EFS_1, 0x0 },
174 [WM8996_DSP1_RX_EQ_BAND_2_B] = 0xf145, 177 { WM8996_FLL_EFS_2, 0x2 },
175 [WM8996_DSP1_RX_EQ_BAND_2_C] = 0xb75, 178 { WM8996_AIF1_CONTROL, 0x0 },
176 [WM8996_DSP1_RX_EQ_BAND_2_PG] = 0x1c5, 179 { WM8996_AIF1_BCLK, 0x0 },
177 [WM8996_DSP1_RX_EQ_BAND_3_A] = 0x1c58, 180 { WM8996_AIF1_TX_LRCLK_1, 0x80 },
178 [WM8996_DSP1_RX_EQ_BAND_3_B] = 0xf373, 181 { WM8996_AIF1_TX_LRCLK_2, 0x8 },
179 [WM8996_DSP1_RX_EQ_BAND_3_C] = 0xa54, 182 { WM8996_AIF1_RX_LRCLK_1, 0x80 },
180 [WM8996_DSP1_RX_EQ_BAND_3_PG] = 0x558, 183 { WM8996_AIF1_RX_LRCLK_2, 0x0 },
181 [WM8996_DSP1_RX_EQ_BAND_4_A] = 0x168e, 184 { WM8996_AIF1TX_DATA_CONFIGURATION_1, 0x1818 },
182 [WM8996_DSP1_RX_EQ_BAND_4_B] = 0xf829, 185 { WM8996_AIF1TX_DATA_CONFIGURATION_2, 0 },
183 [WM8996_DSP1_RX_EQ_BAND_4_C] = 0x7ad, 186 { WM8996_AIF1RX_DATA_CONFIGURATION, 0x1818 },
184 [WM8996_DSP1_RX_EQ_BAND_4_PG] = 0x1103, 187 { WM8996_AIF1TX_CHANNEL_0_CONFIGURATION, 0x0 },
185 [WM8996_DSP1_RX_EQ_BAND_5_A] = 0x564, 188 { WM8996_AIF1TX_CHANNEL_1_CONFIGURATION, 0x0 },
186 [WM8996_DSP1_RX_EQ_BAND_5_B] = 0x559, 189 { WM8996_AIF1TX_CHANNEL_2_CONFIGURATION, 0x0 },
187 [WM8996_DSP1_RX_EQ_BAND_5_PG] = 0x4000, 190 { WM8996_AIF1TX_CHANNEL_3_CONFIGURATION, 0x0 },
188 [WM8996_DSP2_TX_LEFT_VOLUME] = 0xc0, 191 { WM8996_AIF1TX_CHANNEL_4_CONFIGURATION, 0x0 },
189 [WM8996_DSP2_TX_RIGHT_VOLUME] = 0xc0, 192 { WM8996_AIF1TX_CHANNEL_5_CONFIGURATION, 0x0 },
190 [WM8996_DSP2_RX_LEFT_VOLUME] = 0xc0, 193 { WM8996_AIF1RX_CHANNEL_0_CONFIGURATION, 0x0 },
191 [WM8996_DSP2_RX_RIGHT_VOLUME] = 0xc0, 194 { WM8996_AIF1RX_CHANNEL_1_CONFIGURATION, 0x0 },
192 [WM8996_DSP2_TX_FILTERS] = 0x2000, 195 { WM8996_AIF1RX_CHANNEL_2_CONFIGURATION, 0x0 },
193 [WM8996_DSP2_RX_FILTERS_1] = 0x200, 196 { WM8996_AIF1RX_CHANNEL_3_CONFIGURATION, 0x0 },
194 [WM8996_DSP2_RX_FILTERS_2] = 0x10, 197 { WM8996_AIF1RX_CHANNEL_4_CONFIGURATION, 0x0 },
195 [WM8996_DSP2_DRC_1] = 0x98, 198 { WM8996_AIF1RX_CHANNEL_5_CONFIGURATION, 0x0 },
196 [WM8996_DSP2_DRC_2] = 0x845, 199 { WM8996_AIF1RX_MONO_CONFIGURATION, 0x0 },
197 [WM8996_DSP2_RX_EQ_GAINS_1] = 0x6318, 200 { WM8996_AIF1TX_TEST, 0x7 },
198 [WM8996_DSP2_RX_EQ_GAINS_2] = 0x6300, 201 { WM8996_AIF2_CONTROL, 0x0 },
199 [WM8996_DSP2_RX_EQ_BAND_1_A] = 0xfca, 202 { WM8996_AIF2_BCLK, 0x0 },
200 [WM8996_DSP2_RX_EQ_BAND_1_B] = 0x400, 203 { WM8996_AIF2_TX_LRCLK_1, 0x80 },
201 [WM8996_DSP2_RX_EQ_BAND_1_PG] = 0xd8, 204 { WM8996_AIF2_TX_LRCLK_2, 0x8 },
202 [WM8996_DSP2_RX_EQ_BAND_2_A] = 0x1eb5, 205 { WM8996_AIF2_RX_LRCLK_1, 0x80 },
203 [WM8996_DSP2_RX_EQ_BAND_2_B] = 0xf145, 206 { WM8996_AIF2_RX_LRCLK_2, 0x0 },
204 [WM8996_DSP2_RX_EQ_BAND_2_C] = 0xb75, 207 { WM8996_AIF2TX_DATA_CONFIGURATION_1, 0x1818 },
205 [WM8996_DSP2_RX_EQ_BAND_2_PG] = 0x1c5, 208 { WM8996_AIF2RX_DATA_CONFIGURATION, 0x1818 },
206 [WM8996_DSP2_RX_EQ_BAND_3_A] = 0x1c58, 209 { WM8996_AIF2RX_DATA_CONFIGURATION, 0x0 },
207 [WM8996_DSP2_RX_EQ_BAND_3_B] = 0xf373, 210 { WM8996_AIF2TX_CHANNEL_0_CONFIGURATION, 0x0 },
208 [WM8996_DSP2_RX_EQ_BAND_3_C] = 0xa54, 211 { WM8996_AIF2TX_CHANNEL_1_CONFIGURATION, 0x0 },
209 [WM8996_DSP2_RX_EQ_BAND_3_PG] = 0x558, 212 { WM8996_AIF2RX_CHANNEL_0_CONFIGURATION, 0x0 },
210 [WM8996_DSP2_RX_EQ_BAND_4_A] = 0x168e, 213 { WM8996_AIF2RX_CHANNEL_1_CONFIGURATION, 0x0 },
211 [WM8996_DSP2_RX_EQ_BAND_4_B] = 0xf829, 214 { WM8996_AIF2RX_MONO_CONFIGURATION, 0x0 },
212 [WM8996_DSP2_RX_EQ_BAND_4_C] = 0x7ad, 215 { WM8996_AIF2TX_TEST, 0x1 },
213 [WM8996_DSP2_RX_EQ_BAND_4_PG] = 0x1103, 216 { WM8996_DSP1_TX_LEFT_VOLUME, 0xc0 },
214 [WM8996_DSP2_RX_EQ_BAND_5_A] = 0x564, 217 { WM8996_DSP1_TX_RIGHT_VOLUME, 0xc0 },
215 [WM8996_DSP2_RX_EQ_BAND_5_B] = 0x559, 218 { WM8996_DSP1_RX_LEFT_VOLUME, 0xc0 },
216 [WM8996_DSP2_RX_EQ_BAND_5_PG] = 0x4000, 219 { WM8996_DSP1_RX_RIGHT_VOLUME, 0xc0 },
217 [WM8996_OVERSAMPLING] = 0xd, 220 { WM8996_DSP1_TX_FILTERS, 0x2000 },
218 [WM8996_SIDETONE] = 0x1040, 221 { WM8996_DSP1_RX_FILTERS_1, 0x200 },
219 [WM8996_GPIO_1] = 0xa101, 222 { WM8996_DSP1_RX_FILTERS_2, 0x10 },
220 [WM8996_GPIO_2] = 0xa101, 223 { WM8996_DSP1_DRC_1, 0x98 },
221 [WM8996_GPIO_3] = 0xa101, 224 { WM8996_DSP1_DRC_2, 0x845 },
222 [WM8996_GPIO_4] = 0xa101, 225 { WM8996_DSP1_RX_EQ_GAINS_1, 0x6318 },
223 [WM8996_GPIO_5] = 0xa101, 226 { WM8996_DSP1_RX_EQ_GAINS_2, 0x6300 },
224 [WM8996_PULL_CONTROL_2] = 0x140, 227 { WM8996_DSP1_RX_EQ_BAND_1_A, 0xfca },
225 [WM8996_INTERRUPT_STATUS_1_MASK] = 0x1f, 228 { WM8996_DSP1_RX_EQ_BAND_1_B, 0x400 },
226 [WM8996_INTERRUPT_STATUS_2_MASK] = 0x1ecf, 229 { WM8996_DSP1_RX_EQ_BAND_1_PG, 0xd8 },
227 [WM8996_RIGHT_PDM_SPEAKER] = 0x1, 230 { WM8996_DSP1_RX_EQ_BAND_2_A, 0x1eb5 },
228 [WM8996_PDM_SPEAKER_MUTE_SEQUENCE] = 0x69, 231 { WM8996_DSP1_RX_EQ_BAND_2_B, 0xf145 },
229 [WM8996_PDM_SPEAKER_VOLUME] = 0x66, 232 { WM8996_DSP1_RX_EQ_BAND_2_C, 0xb75 },
230 [WM8996_WRITE_SEQUENCER_0] = 0x1, 233 { WM8996_DSP1_RX_EQ_BAND_2_PG, 0x1c5 },
231 [WM8996_WRITE_SEQUENCER_1] = 0x1, 234 { WM8996_DSP1_RX_EQ_BAND_3_A, 0x1c58 },
232 [WM8996_WRITE_SEQUENCER_3] = 0x6, 235 { WM8996_DSP1_RX_EQ_BAND_3_B, 0xf373 },
233 [WM8996_WRITE_SEQUENCER_4] = 0x40, 236 { WM8996_DSP1_RX_EQ_BAND_3_C, 0xa54 },
234 [WM8996_WRITE_SEQUENCER_5] = 0x1, 237 { WM8996_DSP1_RX_EQ_BAND_3_PG, 0x558 },
235 [WM8996_WRITE_SEQUENCER_6] = 0xf, 238 { WM8996_DSP1_RX_EQ_BAND_4_A, 0x168e },
236 [WM8996_WRITE_SEQUENCER_7] = 0x6, 239 { WM8996_DSP1_RX_EQ_BAND_4_B, 0xf829 },
237 [WM8996_WRITE_SEQUENCER_8] = 0x1, 240 { WM8996_DSP1_RX_EQ_BAND_4_C, 0x7ad },
238 [WM8996_WRITE_SEQUENCER_9] = 0x3, 241 { WM8996_DSP1_RX_EQ_BAND_4_PG, 0x1103 },
239 [WM8996_WRITE_SEQUENCER_10] = 0x104, 242 { WM8996_DSP1_RX_EQ_BAND_5_A, 0x564 },
240 [WM8996_WRITE_SEQUENCER_12] = 0x60, 243 { WM8996_DSP1_RX_EQ_BAND_5_B, 0x559 },
241 [WM8996_WRITE_SEQUENCER_13] = 0x11, 244 { WM8996_DSP1_RX_EQ_BAND_5_PG, 0x4000 },
242 [WM8996_WRITE_SEQUENCER_14] = 0x401, 245 { WM8996_DSP2_TX_LEFT_VOLUME, 0xc0 },
243 [WM8996_WRITE_SEQUENCER_16] = 0x50, 246 { WM8996_DSP2_TX_RIGHT_VOLUME, 0xc0 },
244 [WM8996_WRITE_SEQUENCER_17] = 0x3, 247 { WM8996_DSP2_RX_LEFT_VOLUME, 0xc0 },
245 [WM8996_WRITE_SEQUENCER_18] = 0x100, 248 { WM8996_DSP2_RX_RIGHT_VOLUME, 0xc0 },
246 [WM8996_WRITE_SEQUENCER_20] = 0x51, 249 { WM8996_DSP2_TX_FILTERS, 0x2000 },
247 [WM8996_WRITE_SEQUENCER_21] = 0x3, 250 { WM8996_DSP2_RX_FILTERS_1, 0x200 },
248 [WM8996_WRITE_SEQUENCER_22] = 0x104, 251 { WM8996_DSP2_RX_FILTERS_2, 0x10 },
249 [WM8996_WRITE_SEQUENCER_23] = 0xa, 252 { WM8996_DSP2_DRC_1, 0x98 },
250 [WM8996_WRITE_SEQUENCER_24] = 0x60, 253 { WM8996_DSP2_DRC_2, 0x845 },
251 [WM8996_WRITE_SEQUENCER_25] = 0x3b, 254 { WM8996_DSP2_RX_EQ_GAINS_1, 0x6318 },
252 [WM8996_WRITE_SEQUENCER_26] = 0x502, 255 { WM8996_DSP2_RX_EQ_GAINS_2, 0x6300 },
253 [WM8996_WRITE_SEQUENCER_27] = 0x100, 256 { WM8996_DSP2_RX_EQ_BAND_1_A, 0xfca },
254 [WM8996_WRITE_SEQUENCER_28] = 0x2fff, 257 { WM8996_DSP2_RX_EQ_BAND_1_B, 0x400 },
255 [WM8996_WRITE_SEQUENCER_32] = 0x2fff, 258 { WM8996_DSP2_RX_EQ_BAND_1_PG, 0xd8 },
256 [WM8996_WRITE_SEQUENCER_36] = 0x2fff, 259 { WM8996_DSP2_RX_EQ_BAND_2_A, 0x1eb5 },
257 [WM8996_WRITE_SEQUENCER_40] = 0x2fff, 260 { WM8996_DSP2_RX_EQ_BAND_2_B, 0xf145 },
258 [WM8996_WRITE_SEQUENCER_44] = 0x2fff, 261 { WM8996_DSP2_RX_EQ_BAND_2_C, 0xb75 },
259 [WM8996_WRITE_SEQUENCER_48] = 0x2fff, 262 { WM8996_DSP2_RX_EQ_BAND_2_PG, 0x1c5 },
260 [WM8996_WRITE_SEQUENCER_52] = 0x2fff, 263 { WM8996_DSP2_RX_EQ_BAND_3_A, 0x1c58 },
261 [WM8996_WRITE_SEQUENCER_56] = 0x2fff, 264 { WM8996_DSP2_RX_EQ_BAND_3_B, 0xf373 },
262 [WM8996_WRITE_SEQUENCER_60] = 0x2fff, 265 { WM8996_DSP2_RX_EQ_BAND_3_C, 0xa54 },
263 [WM8996_WRITE_SEQUENCER_64] = 0x1, 266 { WM8996_DSP2_RX_EQ_BAND_3_PG, 0x558 },
264 [WM8996_WRITE_SEQUENCER_65] = 0x1, 267 { WM8996_DSP2_RX_EQ_BAND_4_A, 0x168e },
265 [WM8996_WRITE_SEQUENCER_67] = 0x6, 268 { WM8996_DSP2_RX_EQ_BAND_4_B, 0xf829 },
266 [WM8996_WRITE_SEQUENCER_68] = 0x40, 269 { WM8996_DSP2_RX_EQ_BAND_4_C, 0x7ad },
267 [WM8996_WRITE_SEQUENCER_69] = 0x1, 270 { WM8996_DSP2_RX_EQ_BAND_4_PG, 0x1103 },
268 [WM8996_WRITE_SEQUENCER_70] = 0xf, 271 { WM8996_DSP2_RX_EQ_BAND_5_A, 0x564 },
269 [WM8996_WRITE_SEQUENCER_71] = 0x6, 272 { WM8996_DSP2_RX_EQ_BAND_5_B, 0x559 },
270 [WM8996_WRITE_SEQUENCER_72] = 0x1, 273 { WM8996_DSP2_RX_EQ_BAND_5_PG, 0x4000 },
271 [WM8996_WRITE_SEQUENCER_73] = 0x3, 274 { WM8996_DAC1_MIXER_VOLUMES, 0x0 },
272 [WM8996_WRITE_SEQUENCER_74] = 0x104, 275 { WM8996_DAC1_LEFT_MIXER_ROUTING, 0x0 },
273 [WM8996_WRITE_SEQUENCER_76] = 0x60, 276 { WM8996_DAC1_RIGHT_MIXER_ROUTING, 0x0 },
274 [WM8996_WRITE_SEQUENCER_77] = 0x11, 277 { WM8996_DAC2_MIXER_VOLUMES, 0x0 },
275 [WM8996_WRITE_SEQUENCER_78] = 0x401, 278 { WM8996_DAC2_LEFT_MIXER_ROUTING, 0x0 },
276 [WM8996_WRITE_SEQUENCER_80] = 0x50, 279 { WM8996_DAC2_RIGHT_MIXER_ROUTING, 0x0 },
277 [WM8996_WRITE_SEQUENCER_81] = 0x3, 280 { WM8996_DSP1_TX_LEFT_MIXER_ROUTING, 0x0 },
278 [WM8996_WRITE_SEQUENCER_82] = 0x100, 281 { WM8996_DSP1_TX_RIGHT_MIXER_ROUTING, 0x0 },
279 [WM8996_WRITE_SEQUENCER_84] = 0x60, 282 { WM8996_DSP2_TX_LEFT_MIXER_ROUTING, 0x0 },
280 [WM8996_WRITE_SEQUENCER_85] = 0x3b, 283 { WM8996_DSP2_TX_RIGHT_MIXER_ROUTING, 0x0 },
281 [WM8996_WRITE_SEQUENCER_86] = 0x502, 284 { WM8996_DSP_TX_MIXER_SELECT, 0x0 },
282 [WM8996_WRITE_SEQUENCER_87] = 0x100, 285 { WM8996_DAC_SOFTMUTE, 0x0 },
283 [WM8996_WRITE_SEQUENCER_88] = 0x2fff, 286 { WM8996_OVERSAMPLING, 0xd },
284 [WM8996_WRITE_SEQUENCER_92] = 0x2fff, 287 { WM8996_SIDETONE, 0x1040 },
285 [WM8996_WRITE_SEQUENCER_96] = 0x2fff, 288 { WM8996_GPIO_1, 0xa101 },
286 [WM8996_WRITE_SEQUENCER_100] = 0x2fff, 289 { WM8996_GPIO_2, 0xa101 },
287 [WM8996_WRITE_SEQUENCER_104] = 0x2fff, 290 { WM8996_GPIO_3, 0xa101 },
288 [WM8996_WRITE_SEQUENCER_108] = 0x2fff, 291 { WM8996_GPIO_4, 0xa101 },
289 [WM8996_WRITE_SEQUENCER_112] = 0x2fff, 292 { WM8996_GPIO_5, 0xa101 },
290 [WM8996_WRITE_SEQUENCER_116] = 0x2fff, 293 { WM8996_PULL_CONTROL_1, 0x0 },
291 [WM8996_WRITE_SEQUENCER_120] = 0x2fff, 294 { WM8996_PULL_CONTROL_2, 0x140 },
292 [WM8996_WRITE_SEQUENCER_124] = 0x2fff, 295 { WM8996_INTERRUPT_STATUS_1_MASK, 0x1f },
293 [WM8996_WRITE_SEQUENCER_128] = 0x1, 296 { WM8996_INTERRUPT_STATUS_2_MASK, 0x1ecf },
294 [WM8996_WRITE_SEQUENCER_129] = 0x1, 297 { WM8996_LEFT_PDM_SPEAKER, 0x0 },
295 [WM8996_WRITE_SEQUENCER_131] = 0x6, 298 { WM8996_RIGHT_PDM_SPEAKER, 0x1 },
296 [WM8996_WRITE_SEQUENCER_132] = 0x40, 299 { WM8996_PDM_SPEAKER_MUTE_SEQUENCE, 0x69 },
297 [WM8996_WRITE_SEQUENCER_133] = 0x1, 300 { WM8996_PDM_SPEAKER_VOLUME, 0x66 },
298 [WM8996_WRITE_SEQUENCER_134] = 0xf, 301 { WM8996_WRITE_SEQUENCER_0, 0x1 },
299 [WM8996_WRITE_SEQUENCER_135] = 0x6, 302 { WM8996_WRITE_SEQUENCER_1, 0x1 },
300 [WM8996_WRITE_SEQUENCER_136] = 0x1, 303 { WM8996_WRITE_SEQUENCER_3, 0x6 },
301 [WM8996_WRITE_SEQUENCER_137] = 0x3, 304 { WM8996_WRITE_SEQUENCER_4, 0x40 },
302 [WM8996_WRITE_SEQUENCER_138] = 0x106, 305 { WM8996_WRITE_SEQUENCER_5, 0x1 },
303 [WM8996_WRITE_SEQUENCER_140] = 0x61, 306 { WM8996_WRITE_SEQUENCER_6, 0xf },
304 [WM8996_WRITE_SEQUENCER_141] = 0x11, 307 { WM8996_WRITE_SEQUENCER_7, 0x6 },
305 [WM8996_WRITE_SEQUENCER_142] = 0x401, 308 { WM8996_WRITE_SEQUENCER_8, 0x1 },
306 [WM8996_WRITE_SEQUENCER_144] = 0x50, 309 { WM8996_WRITE_SEQUENCER_9, 0x3 },
307 [WM8996_WRITE_SEQUENCER_145] = 0x3, 310 { WM8996_WRITE_SEQUENCER_10, 0x104 },
308 [WM8996_WRITE_SEQUENCER_146] = 0x102, 311 { WM8996_WRITE_SEQUENCER_12, 0x60 },
309 [WM8996_WRITE_SEQUENCER_148] = 0x51, 312 { WM8996_WRITE_SEQUENCER_13, 0x11 },
310 [WM8996_WRITE_SEQUENCER_149] = 0x3, 313 { WM8996_WRITE_SEQUENCER_14, 0x401 },
311 [WM8996_WRITE_SEQUENCER_150] = 0x106, 314 { WM8996_WRITE_SEQUENCER_16, 0x50 },
312 [WM8996_WRITE_SEQUENCER_151] = 0xa, 315 { WM8996_WRITE_SEQUENCER_17, 0x3 },
313 [WM8996_WRITE_SEQUENCER_152] = 0x61, 316 { WM8996_WRITE_SEQUENCER_18, 0x100 },
314 [WM8996_WRITE_SEQUENCER_153] = 0x3b, 317 { WM8996_WRITE_SEQUENCER_20, 0x51 },
315 [WM8996_WRITE_SEQUENCER_154] = 0x502, 318 { WM8996_WRITE_SEQUENCER_21, 0x3 },
316 [WM8996_WRITE_SEQUENCER_155] = 0x100, 319 { WM8996_WRITE_SEQUENCER_22, 0x104 },
317 [WM8996_WRITE_SEQUENCER_156] = 0x2fff, 320 { WM8996_WRITE_SEQUENCER_23, 0xa },
318 [WM8996_WRITE_SEQUENCER_160] = 0x2fff, 321 { WM8996_WRITE_SEQUENCER_24, 0x60 },
319 [WM8996_WRITE_SEQUENCER_164] = 0x2fff, 322 { WM8996_WRITE_SEQUENCER_25, 0x3b },
320 [WM8996_WRITE_SEQUENCER_168] = 0x2fff, 323 { WM8996_WRITE_SEQUENCER_26, 0x502 },
321 [WM8996_WRITE_SEQUENCER_172] = 0x2fff, 324 { WM8996_WRITE_SEQUENCER_27, 0x100 },
322 [WM8996_WRITE_SEQUENCER_176] = 0x2fff, 325 { WM8996_WRITE_SEQUENCER_28, 0x2fff },
323 [WM8996_WRITE_SEQUENCER_180] = 0x2fff, 326 { WM8996_WRITE_SEQUENCER_32, 0x2fff },
324 [WM8996_WRITE_SEQUENCER_184] = 0x2fff, 327 { WM8996_WRITE_SEQUENCER_36, 0x2fff },
325 [WM8996_WRITE_SEQUENCER_188] = 0x2fff, 328 { WM8996_WRITE_SEQUENCER_40, 0x2fff },
326 [WM8996_WRITE_SEQUENCER_192] = 0x1, 329 { WM8996_WRITE_SEQUENCER_44, 0x2fff },
327 [WM8996_WRITE_SEQUENCER_193] = 0x1, 330 { WM8996_WRITE_SEQUENCER_48, 0x2fff },
328 [WM8996_WRITE_SEQUENCER_195] = 0x6, 331 { WM8996_WRITE_SEQUENCER_52, 0x2fff },
329 [WM8996_WRITE_SEQUENCER_196] = 0x40, 332 { WM8996_WRITE_SEQUENCER_56, 0x2fff },
330 [WM8996_WRITE_SEQUENCER_197] = 0x1, 333 { WM8996_WRITE_SEQUENCER_60, 0x2fff },
331 [WM8996_WRITE_SEQUENCER_198] = 0xf, 334 { WM8996_WRITE_SEQUENCER_64, 0x1 },
332 [WM8996_WRITE_SEQUENCER_199] = 0x6, 335 { WM8996_WRITE_SEQUENCER_65, 0x1 },
333 [WM8996_WRITE_SEQUENCER_200] = 0x1, 336 { WM8996_WRITE_SEQUENCER_67, 0x6 },
334 [WM8996_WRITE_SEQUENCER_201] = 0x3, 337 { WM8996_WRITE_SEQUENCER_68, 0x40 },
335 [WM8996_WRITE_SEQUENCER_202] = 0x106, 338 { WM8996_WRITE_SEQUENCER_69, 0x1 },
336 [WM8996_WRITE_SEQUENCER_204] = 0x61, 339 { WM8996_WRITE_SEQUENCER_70, 0xf },
337 [WM8996_WRITE_SEQUENCER_205] = 0x11, 340 { WM8996_WRITE_SEQUENCER_71, 0x6 },
338 [WM8996_WRITE_SEQUENCER_206] = 0x401, 341 { WM8996_WRITE_SEQUENCER_72, 0x1 },
339 [WM8996_WRITE_SEQUENCER_208] = 0x50, 342 { WM8996_WRITE_SEQUENCER_73, 0x3 },
340 [WM8996_WRITE_SEQUENCER_209] = 0x3, 343 { WM8996_WRITE_SEQUENCER_74, 0x104 },
341 [WM8996_WRITE_SEQUENCER_210] = 0x102, 344 { WM8996_WRITE_SEQUENCER_76, 0x60 },
342 [WM8996_WRITE_SEQUENCER_212] = 0x61, 345 { WM8996_WRITE_SEQUENCER_77, 0x11 },
343 [WM8996_WRITE_SEQUENCER_213] = 0x3b, 346 { WM8996_WRITE_SEQUENCER_78, 0x401 },
344 [WM8996_WRITE_SEQUENCER_214] = 0x502, 347 { WM8996_WRITE_SEQUENCER_80, 0x50 },
345 [WM8996_WRITE_SEQUENCER_215] = 0x100, 348 { WM8996_WRITE_SEQUENCER_81, 0x3 },
346 [WM8996_WRITE_SEQUENCER_216] = 0x2fff, 349 { WM8996_WRITE_SEQUENCER_82, 0x100 },
347 [WM8996_WRITE_SEQUENCER_220] = 0x2fff, 350 { WM8996_WRITE_SEQUENCER_84, 0x60 },
348 [WM8996_WRITE_SEQUENCER_224] = 0x2fff, 351 { WM8996_WRITE_SEQUENCER_85, 0x3b },
349 [WM8996_WRITE_SEQUENCER_228] = 0x2fff, 352 { WM8996_WRITE_SEQUENCER_86, 0x502 },
350 [WM8996_WRITE_SEQUENCER_232] = 0x2fff, 353 { WM8996_WRITE_SEQUENCER_87, 0x100 },
351 [WM8996_WRITE_SEQUENCER_236] = 0x2fff, 354 { WM8996_WRITE_SEQUENCER_88, 0x2fff },
352 [WM8996_WRITE_SEQUENCER_240] = 0x2fff, 355 { WM8996_WRITE_SEQUENCER_92, 0x2fff },
353 [WM8996_WRITE_SEQUENCER_244] = 0x2fff, 356 { WM8996_WRITE_SEQUENCER_96, 0x2fff },
354 [WM8996_WRITE_SEQUENCER_248] = 0x2fff, 357 { WM8996_WRITE_SEQUENCER_100, 0x2fff },
355 [WM8996_WRITE_SEQUENCER_252] = 0x2fff, 358 { WM8996_WRITE_SEQUENCER_104, 0x2fff },
356 [WM8996_WRITE_SEQUENCER_256] = 0x60, 359 { WM8996_WRITE_SEQUENCER_108, 0x2fff },
357 [WM8996_WRITE_SEQUENCER_258] = 0x601, 360 { WM8996_WRITE_SEQUENCER_112, 0x2fff },
358 [WM8996_WRITE_SEQUENCER_260] = 0x50, 361 { WM8996_WRITE_SEQUENCER_116, 0x2fff },
359 [WM8996_WRITE_SEQUENCER_262] = 0x100, 362 { WM8996_WRITE_SEQUENCER_120, 0x2fff },
360 [WM8996_WRITE_SEQUENCER_264] = 0x1, 363 { WM8996_WRITE_SEQUENCER_124, 0x2fff },
361 [WM8996_WRITE_SEQUENCER_266] = 0x104, 364 { WM8996_WRITE_SEQUENCER_128, 0x1 },
362 [WM8996_WRITE_SEQUENCER_267] = 0x100, 365 { WM8996_WRITE_SEQUENCER_129, 0x1 },
363 [WM8996_WRITE_SEQUENCER_268] = 0x2fff, 366 { WM8996_WRITE_SEQUENCER_131, 0x6 },
364 [WM8996_WRITE_SEQUENCER_272] = 0x2fff, 367 { WM8996_WRITE_SEQUENCER_132, 0x40 },
365 [WM8996_WRITE_SEQUENCER_276] = 0x2fff, 368 { WM8996_WRITE_SEQUENCER_133, 0x1 },
366 [WM8996_WRITE_SEQUENCER_280] = 0x2fff, 369 { WM8996_WRITE_SEQUENCER_134, 0xf },
367 [WM8996_WRITE_SEQUENCER_284] = 0x2fff, 370 { WM8996_WRITE_SEQUENCER_135, 0x6 },
368 [WM8996_WRITE_SEQUENCER_288] = 0x2fff, 371 { WM8996_WRITE_SEQUENCER_136, 0x1 },
369 [WM8996_WRITE_SEQUENCER_292] = 0x2fff, 372 { WM8996_WRITE_SEQUENCER_137, 0x3 },
370 [WM8996_WRITE_SEQUENCER_296] = 0x2fff, 373 { WM8996_WRITE_SEQUENCER_138, 0x106 },
371 [WM8996_WRITE_SEQUENCER_300] = 0x2fff, 374 { WM8996_WRITE_SEQUENCER_140, 0x61 },
372 [WM8996_WRITE_SEQUENCER_304] = 0x2fff, 375 { WM8996_WRITE_SEQUENCER_141, 0x11 },
373 [WM8996_WRITE_SEQUENCER_308] = 0x2fff, 376 { WM8996_WRITE_SEQUENCER_142, 0x401 },
374 [WM8996_WRITE_SEQUENCER_312] = 0x2fff, 377 { WM8996_WRITE_SEQUENCER_144, 0x50 },
375 [WM8996_WRITE_SEQUENCER_316] = 0x2fff, 378 { WM8996_WRITE_SEQUENCER_145, 0x3 },
376 [WM8996_WRITE_SEQUENCER_320] = 0x61, 379 { WM8996_WRITE_SEQUENCER_146, 0x102 },
377 [WM8996_WRITE_SEQUENCER_322] = 0x601, 380 { WM8996_WRITE_SEQUENCER_148, 0x51 },
378 [WM8996_WRITE_SEQUENCER_324] = 0x50, 381 { WM8996_WRITE_SEQUENCER_149, 0x3 },
379 [WM8996_WRITE_SEQUENCER_326] = 0x102, 382 { WM8996_WRITE_SEQUENCER_150, 0x106 },
380 [WM8996_WRITE_SEQUENCER_328] = 0x1, 383 { WM8996_WRITE_SEQUENCER_151, 0xa },
381 [WM8996_WRITE_SEQUENCER_330] = 0x106, 384 { WM8996_WRITE_SEQUENCER_152, 0x61 },
382 [WM8996_WRITE_SEQUENCER_331] = 0x100, 385 { WM8996_WRITE_SEQUENCER_153, 0x3b },
383 [WM8996_WRITE_SEQUENCER_332] = 0x2fff, 386 { WM8996_WRITE_SEQUENCER_154, 0x502 },
384 [WM8996_WRITE_SEQUENCER_336] = 0x2fff, 387 { WM8996_WRITE_SEQUENCER_155, 0x100 },
385 [WM8996_WRITE_SEQUENCER_340] = 0x2fff, 388 { WM8996_WRITE_SEQUENCER_156, 0x2fff },
386 [WM8996_WRITE_SEQUENCER_344] = 0x2fff, 389 { WM8996_WRITE_SEQUENCER_160, 0x2fff },
387 [WM8996_WRITE_SEQUENCER_348] = 0x2fff, 390 { WM8996_WRITE_SEQUENCER_164, 0x2fff },
388 [WM8996_WRITE_SEQUENCER_352] = 0x2fff, 391 { WM8996_WRITE_SEQUENCER_168, 0x2fff },
389 [WM8996_WRITE_SEQUENCER_356] = 0x2fff, 392 { WM8996_WRITE_SEQUENCER_172, 0x2fff },
390 [WM8996_WRITE_SEQUENCER_360] = 0x2fff, 393 { WM8996_WRITE_SEQUENCER_176, 0x2fff },
391 [WM8996_WRITE_SEQUENCER_364] = 0x2fff, 394 { WM8996_WRITE_SEQUENCER_180, 0x2fff },
392 [WM8996_WRITE_SEQUENCER_368] = 0x2fff, 395 { WM8996_WRITE_SEQUENCER_184, 0x2fff },
393 [WM8996_WRITE_SEQUENCER_372] = 0x2fff, 396 { WM8996_WRITE_SEQUENCER_188, 0x2fff },
394 [WM8996_WRITE_SEQUENCER_376] = 0x2fff, 397 { WM8996_WRITE_SEQUENCER_192, 0x1 },
395 [WM8996_WRITE_SEQUENCER_380] = 0x2fff, 398 { WM8996_WRITE_SEQUENCER_193, 0x1 },
396 [WM8996_WRITE_SEQUENCER_384] = 0x60, 399 { WM8996_WRITE_SEQUENCER_195, 0x6 },
397 [WM8996_WRITE_SEQUENCER_386] = 0x601, 400 { WM8996_WRITE_SEQUENCER_196, 0x40 },
398 [WM8996_WRITE_SEQUENCER_388] = 0x61, 401 { WM8996_WRITE_SEQUENCER_197, 0x1 },
399 [WM8996_WRITE_SEQUENCER_390] = 0x601, 402 { WM8996_WRITE_SEQUENCER_198, 0xf },
400 [WM8996_WRITE_SEQUENCER_392] = 0x50, 403 { WM8996_WRITE_SEQUENCER_199, 0x6 },
401 [WM8996_WRITE_SEQUENCER_394] = 0x300, 404 { WM8996_WRITE_SEQUENCER_200, 0x1 },
402 [WM8996_WRITE_SEQUENCER_396] = 0x1, 405 { WM8996_WRITE_SEQUENCER_201, 0x3 },
403 [WM8996_WRITE_SEQUENCER_398] = 0x304, 406 { WM8996_WRITE_SEQUENCER_202, 0x106 },
404 [WM8996_WRITE_SEQUENCER_400] = 0x40, 407 { WM8996_WRITE_SEQUENCER_204, 0x61 },
405 [WM8996_WRITE_SEQUENCER_402] = 0xf, 408 { WM8996_WRITE_SEQUENCER_205, 0x11 },
406 [WM8996_WRITE_SEQUENCER_404] = 0x1, 409 { WM8996_WRITE_SEQUENCER_206, 0x401 },
407 [WM8996_WRITE_SEQUENCER_407] = 0x100, 410 { WM8996_WRITE_SEQUENCER_208, 0x50 },
411 { WM8996_WRITE_SEQUENCER_209, 0x3 },
412 { WM8996_WRITE_SEQUENCER_210, 0x102 },
413 { WM8996_WRITE_SEQUENCER_212, 0x61 },
414 { WM8996_WRITE_SEQUENCER_213, 0x3b },
415 { WM8996_WRITE_SEQUENCER_214, 0x502 },
416 { WM8996_WRITE_SEQUENCER_215, 0x100 },
417 { WM8996_WRITE_SEQUENCER_216, 0x2fff },
418 { WM8996_WRITE_SEQUENCER_220, 0x2fff },
419 { WM8996_WRITE_SEQUENCER_224, 0x2fff },
420 { WM8996_WRITE_SEQUENCER_228, 0x2fff },
421 { WM8996_WRITE_SEQUENCER_232, 0x2fff },
422 { WM8996_WRITE_SEQUENCER_236, 0x2fff },
423 { WM8996_WRITE_SEQUENCER_240, 0x2fff },
424 { WM8996_WRITE_SEQUENCER_244, 0x2fff },
425 { WM8996_WRITE_SEQUENCER_248, 0x2fff },
426 { WM8996_WRITE_SEQUENCER_252, 0x2fff },
427 { WM8996_WRITE_SEQUENCER_256, 0x60 },
428 { WM8996_WRITE_SEQUENCER_258, 0x601 },
429 { WM8996_WRITE_SEQUENCER_260, 0x50 },
430 { WM8996_WRITE_SEQUENCER_262, 0x100 },
431 { WM8996_WRITE_SEQUENCER_264, 0x1 },
432 { WM8996_WRITE_SEQUENCER_266, 0x104 },
433 { WM8996_WRITE_SEQUENCER_267, 0x100 },
434 { WM8996_WRITE_SEQUENCER_268, 0x2fff },
435 { WM8996_WRITE_SEQUENCER_272, 0x2fff },
436 { WM8996_WRITE_SEQUENCER_276, 0x2fff },
437 { WM8996_WRITE_SEQUENCER_280, 0x2fff },
438 { WM8996_WRITE_SEQUENCER_284, 0x2fff },
439 { WM8996_WRITE_SEQUENCER_288, 0x2fff },
440 { WM8996_WRITE_SEQUENCER_292, 0x2fff },
441 { WM8996_WRITE_SEQUENCER_296, 0x2fff },
442 { WM8996_WRITE_SEQUENCER_300, 0x2fff },
443 { WM8996_WRITE_SEQUENCER_304, 0x2fff },
444 { WM8996_WRITE_SEQUENCER_308, 0x2fff },
445 { WM8996_WRITE_SEQUENCER_312, 0x2fff },
446 { WM8996_WRITE_SEQUENCER_316, 0x2fff },
447 { WM8996_WRITE_SEQUENCER_320, 0x61 },
448 { WM8996_WRITE_SEQUENCER_322, 0x601 },
449 { WM8996_WRITE_SEQUENCER_324, 0x50 },
450 { WM8996_WRITE_SEQUENCER_326, 0x102 },
451 { WM8996_WRITE_SEQUENCER_328, 0x1 },
452 { WM8996_WRITE_SEQUENCER_330, 0x106 },
453 { WM8996_WRITE_SEQUENCER_331, 0x100 },
454 { WM8996_WRITE_SEQUENCER_332, 0x2fff },
455 { WM8996_WRITE_SEQUENCER_336, 0x2fff },
456 { WM8996_WRITE_SEQUENCER_340, 0x2fff },
457 { WM8996_WRITE_SEQUENCER_344, 0x2fff },
458 { WM8996_WRITE_SEQUENCER_348, 0x2fff },
459 { WM8996_WRITE_SEQUENCER_352, 0x2fff },
460 { WM8996_WRITE_SEQUENCER_356, 0x2fff },
461 { WM8996_WRITE_SEQUENCER_360, 0x2fff },
462 { WM8996_WRITE_SEQUENCER_364, 0x2fff },
463 { WM8996_WRITE_SEQUENCER_368, 0x2fff },
464 { WM8996_WRITE_SEQUENCER_372, 0x2fff },
465 { WM8996_WRITE_SEQUENCER_376, 0x2fff },
466 { WM8996_WRITE_SEQUENCER_380, 0x2fff },
467 { WM8996_WRITE_SEQUENCER_384, 0x60 },
468 { WM8996_WRITE_SEQUENCER_386, 0x601 },
469 { WM8996_WRITE_SEQUENCER_388, 0x61 },
470 { WM8996_WRITE_SEQUENCER_390, 0x601 },
471 { WM8996_WRITE_SEQUENCER_392, 0x50 },
472 { WM8996_WRITE_SEQUENCER_394, 0x300 },
473 { WM8996_WRITE_SEQUENCER_396, 0x1 },
474 { WM8996_WRITE_SEQUENCER_398, 0x304 },
475 { WM8996_WRITE_SEQUENCER_400, 0x40 },
476 { WM8996_WRITE_SEQUENCER_402, 0xf },
477 { WM8996_WRITE_SEQUENCER_404, 0x1 },
478 { WM8996_WRITE_SEQUENCER_407, 0x100 },
408}; 479};
409 480
410static const DECLARE_TLV_DB_SCALE(inpga_tlv, 0, 100, 0); 481static const DECLARE_TLV_DB_SCALE(inpga_tlv, 0, 100, 0);
@@ -1413,8 +1484,7 @@ static const struct snd_soc_dapm_route wm8996_dapm_routes[] = {
1413 { "SPKDAT", NULL, "SPKR PGA" }, 1484 { "SPKDAT", NULL, "SPKR PGA" },
1414}; 1485};
1415 1486
1416static int wm8996_readable_register(struct snd_soc_codec *codec, 1487static bool wm8996_readable_register(struct device *dev, unsigned int reg)
1417 unsigned int reg)
1418{ 1488{
1419 /* Due to the sparseness of the register map the compiler 1489 /* Due to the sparseness of the register map the compiler
1420 * output from an explicit switch statement ends up being much 1490 * output from an explicit switch statement ends up being much
@@ -1621,8 +1691,7 @@ static int wm8996_readable_register(struct snd_soc_codec *codec,
1621 } 1691 }
1622} 1692}
1623 1693
1624static int wm8996_volatile_register(struct snd_soc_codec *codec, 1694static bool wm8996_volatile_register(struct device *dev, unsigned int reg)
1625 unsigned int reg)
1626{ 1695{
1627 switch (reg) { 1696 switch (reg) {
1628 case WM8996_SOFTWARE_RESET: 1697 case WM8996_SOFTWARE_RESET:
@@ -1646,9 +1715,15 @@ static int wm8996_volatile_register(struct snd_soc_codec *codec,
1646 } 1715 }
1647} 1716}
1648 1717
1649static int wm8996_reset(struct snd_soc_codec *codec) 1718static int wm8996_reset(struct wm8996_priv *wm8996)
1650{ 1719{
1651 return snd_soc_write(codec, WM8996_SOFTWARE_RESET, 0x8915); 1720 if (wm8996->pdata.ldo_ena > 0) {
1721 gpio_set_value_cansleep(wm8996->pdata.ldo_ena, 0);
1722 return 0;
1723 } else {
1724 return regmap_write(wm8996->regmap, WM8996_SOFTWARE_RESET,
1725 0x8915);
1726 }
1652} 1727}
1653 1728
1654static const int bclk_divs[] = { 1729static const int bclk_divs[] = {
@@ -1723,13 +1798,13 @@ static int wm8996_set_bias_level(struct snd_soc_codec *codec,
1723 msleep(5); 1798 msleep(5);
1724 } 1799 }
1725 1800
1726 codec->cache_only = false; 1801 regcache_cache_only(codec->control_data, false);
1727 snd_soc_cache_sync(codec); 1802 regcache_sync(codec->control_data);
1728 } 1803 }
1729 break; 1804 break;
1730 1805
1731 case SND_SOC_BIAS_OFF: 1806 case SND_SOC_BIAS_OFF:
1732 codec->cache_only = true; 1807 regcache_cache_only(codec->control_data, true);
1733 if (wm8996->pdata.ldo_ena >= 0) 1808 if (wm8996->pdata.ldo_ena >= 0)
1734 gpio_set_value_cansleep(wm8996->pdata.ldo_ena, 0); 1809 gpio_set_value_cansleep(wm8996->pdata.ldo_ena, 0);
1735 regulator_bulk_disable(ARRAY_SIZE(wm8996->supplies), 1810 regulator_bulk_disable(ARRAY_SIZE(wm8996->supplies),
@@ -1968,6 +2043,7 @@ static int wm8996_set_sysclk(struct snd_soc_dai *dai,
1968 break; 2043 break;
1969 case 24576000: 2044 case 24576000:
1970 ratediv = WM8996_SYSCLK_DIV; 2045 ratediv = WM8996_SYSCLK_DIV;
2046 wm8996->sysclk /= 2;
1971 case 12288000: 2047 case 12288000:
1972 snd_soc_update_bits(codec, WM8996_AIF_RATE, 2048 snd_soc_update_bits(codec, WM8996_AIF_RATE,
1973 WM8996_SYSCLK_RATE, WM8996_SYSCLK_RATE); 2049 WM8996_SYSCLK_RATE, WM8996_SYSCLK_RATE);
@@ -2251,48 +2327,45 @@ static inline struct wm8996_priv *gpio_to_wm8996(struct gpio_chip *chip)
2251static void wm8996_gpio_set(struct gpio_chip *chip, unsigned offset, int value) 2327static void wm8996_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
2252{ 2328{
2253 struct wm8996_priv *wm8996 = gpio_to_wm8996(chip); 2329 struct wm8996_priv *wm8996 = gpio_to_wm8996(chip);
2254 struct snd_soc_codec *codec = wm8996->codec;
2255 2330
2256 snd_soc_update_bits(codec, WM8996_GPIO_1 + offset, 2331 regmap_update_bits(wm8996->regmap, WM8996_GPIO_1 + offset,
2257 WM8996_GP1_LVL, !!value << WM8996_GP1_LVL_SHIFT); 2332 WM8996_GP1_LVL, !!value << WM8996_GP1_LVL_SHIFT);
2258} 2333}
2259 2334
2260static int wm8996_gpio_direction_out(struct gpio_chip *chip, 2335static int wm8996_gpio_direction_out(struct gpio_chip *chip,
2261 unsigned offset, int value) 2336 unsigned offset, int value)
2262{ 2337{
2263 struct wm8996_priv *wm8996 = gpio_to_wm8996(chip); 2338 struct wm8996_priv *wm8996 = gpio_to_wm8996(chip);
2264 struct snd_soc_codec *codec = wm8996->codec;
2265 int val; 2339 int val;
2266 2340
2267 val = (1 << WM8996_GP1_FN_SHIFT) | (!!value << WM8996_GP1_LVL_SHIFT); 2341 val = (1 << WM8996_GP1_FN_SHIFT) | (!!value << WM8996_GP1_LVL_SHIFT);
2268 2342
2269 return snd_soc_update_bits(codec, WM8996_GPIO_1 + offset, 2343 return regmap_update_bits(wm8996->regmap, WM8996_GPIO_1 + offset,
2270 WM8996_GP1_FN_MASK | WM8996_GP1_DIR | 2344 WM8996_GP1_FN_MASK | WM8996_GP1_DIR |
2271 WM8996_GP1_LVL, val); 2345 WM8996_GP1_LVL, val);
2272} 2346}
2273 2347
2274static int wm8996_gpio_get(struct gpio_chip *chip, unsigned offset) 2348static int wm8996_gpio_get(struct gpio_chip *chip, unsigned offset)
2275{ 2349{
2276 struct wm8996_priv *wm8996 = gpio_to_wm8996(chip); 2350 struct wm8996_priv *wm8996 = gpio_to_wm8996(chip);
2277 struct snd_soc_codec *codec = wm8996->codec; 2351 unsigned int reg;
2278 int ret; 2352 int ret;
2279 2353
2280 ret = snd_soc_read(codec, WM8996_GPIO_1 + offset); 2354 ret = regmap_read(wm8996->regmap, WM8996_GPIO_1 + offset, &reg);
2281 if (ret < 0) 2355 if (ret < 0)
2282 return ret; 2356 return ret;
2283 2357
2284 return (ret & WM8996_GP1_LVL) != 0; 2358 return (reg & WM8996_GP1_LVL) != 0;
2285} 2359}
2286 2360
2287static int wm8996_gpio_direction_in(struct gpio_chip *chip, unsigned offset) 2361static int wm8996_gpio_direction_in(struct gpio_chip *chip, unsigned offset)
2288{ 2362{
2289 struct wm8996_priv *wm8996 = gpio_to_wm8996(chip); 2363 struct wm8996_priv *wm8996 = gpio_to_wm8996(chip);
2290 struct snd_soc_codec *codec = wm8996->codec;
2291 2364
2292 return snd_soc_update_bits(codec, WM8996_GPIO_1 + offset, 2365 return regmap_update_bits(wm8996->regmap, WM8996_GPIO_1 + offset,
2293 WM8996_GP1_FN_MASK | WM8996_GP1_DIR, 2366 WM8996_GP1_FN_MASK | WM8996_GP1_DIR,
2294 (1 << WM8996_GP1_FN_SHIFT) | 2367 (1 << WM8996_GP1_FN_SHIFT) |
2295 (1 << WM8996_GP1_DIR_SHIFT)); 2368 (1 << WM8996_GP1_DIR_SHIFT));
2296} 2369}
2297 2370
2298static struct gpio_chip wm8996_template_chip = { 2371static struct gpio_chip wm8996_template_chip = {
@@ -2305,14 +2378,13 @@ static struct gpio_chip wm8996_template_chip = {
2305 .can_sleep = 1, 2378 .can_sleep = 1,
2306}; 2379};
2307 2380
2308static void wm8996_init_gpio(struct snd_soc_codec *codec) 2381static void wm8996_init_gpio(struct wm8996_priv *wm8996)
2309{ 2382{
2310 struct wm8996_priv *wm8996 = snd_soc_codec_get_drvdata(codec);
2311 int ret; 2383 int ret;
2312 2384
2313 wm8996->gpio_chip = wm8996_template_chip; 2385 wm8996->gpio_chip = wm8996_template_chip;
2314 wm8996->gpio_chip.ngpio = 5; 2386 wm8996->gpio_chip.ngpio = 5;
2315 wm8996->gpio_chip.dev = codec->dev; 2387 wm8996->gpio_chip.dev = wm8996->dev;
2316 2388
2317 if (wm8996->pdata.gpio_base) 2389 if (wm8996->pdata.gpio_base)
2318 wm8996->gpio_chip.base = wm8996->pdata.gpio_base; 2390 wm8996->gpio_chip.base = wm8996->pdata.gpio_base;
@@ -2321,24 +2393,23 @@ static void wm8996_init_gpio(struct snd_soc_codec *codec)
2321 2393
2322 ret = gpiochip_add(&wm8996->gpio_chip); 2394 ret = gpiochip_add(&wm8996->gpio_chip);
2323 if (ret != 0) 2395 if (ret != 0)
2324 dev_err(codec->dev, "Failed to add GPIOs: %d\n", ret); 2396 dev_err(wm8996->dev, "Failed to add GPIOs: %d\n", ret);
2325} 2397}
2326 2398
2327static void wm8996_free_gpio(struct snd_soc_codec *codec) 2399static void wm8996_free_gpio(struct wm8996_priv *wm8996)
2328{ 2400{
2329 struct wm8996_priv *wm8996 = snd_soc_codec_get_drvdata(codec);
2330 int ret; 2401 int ret;
2331 2402
2332 ret = gpiochip_remove(&wm8996->gpio_chip); 2403 ret = gpiochip_remove(&wm8996->gpio_chip);
2333 if (ret != 0) 2404 if (ret != 0)
2334 dev_err(codec->dev, "Failed to remove GPIOs: %d\n", ret); 2405 dev_err(wm8996->dev, "Failed to remove GPIOs: %d\n", ret);
2335} 2406}
2336#else 2407#else
2337static void wm8996_init_gpio(struct snd_soc_codec *codec) 2408static void wm8996_init_gpio(struct wm8996_priv *wm8996)
2338{ 2409{
2339} 2410}
2340 2411
2341static void wm8996_free_gpio(struct snd_soc_codec *codec) 2412static void wm8996_free_gpio(struct wm8996_priv *wm8996)
2342{ 2413{
2343} 2414}
2344#endif 2415#endif
@@ -2501,8 +2572,10 @@ static void wm8996_micd(struct snd_soc_codec *codec)
2501 SND_JACK_BTN_0); 2572 SND_JACK_BTN_0);
2502 2573
2503 snd_soc_update_bits(codec, WM8996_MIC_DETECT_1, 2574 snd_soc_update_bits(codec, WM8996_MIC_DETECT_1,
2504 WM8996_MICD_RATE_MASK, 2575 WM8996_MICD_RATE_MASK |
2505 WM8996_MICD_RATE_MASK); 2576 WM8996_MICD_BIAS_STARTTIME_MASK,
2577 WM8996_MICD_RATE_MASK |
2578 9 << WM8996_MICD_BIAS_STARTTIME_SHIFT);
2506 return; 2579 return;
2507 } 2580 }
2508 2581
@@ -2519,8 +2592,10 @@ static void wm8996_micd(struct snd_soc_codec *codec)
2519 /* Increase poll rate to give better responsiveness 2592 /* Increase poll rate to give better responsiveness
2520 * for buttons */ 2593 * for buttons */
2521 snd_soc_update_bits(codec, WM8996_MIC_DETECT_1, 2594 snd_soc_update_bits(codec, WM8996_MIC_DETECT_1,
2522 WM8996_MICD_RATE_MASK, 2595 WM8996_MICD_RATE_MASK |
2523 5 << WM8996_MICD_RATE_SHIFT); 2596 WM8996_MICD_BIAS_STARTTIME_MASK,
2597 5 << WM8996_MICD_RATE_SHIFT |
2598 7 << WM8996_MICD_BIAS_STARTTIME_SHIFT);
2524 } else { 2599 } else {
2525 dev_dbg(codec->dev, "Mic button up\n"); 2600 dev_dbg(codec->dev, "Mic button up\n");
2526 snd_soc_jack_report(wm8996->jack, 0, SND_JACK_BTN_0); 2601 snd_soc_jack_report(wm8996->jack, 0, SND_JACK_BTN_0);
@@ -2568,8 +2643,10 @@ static void wm8996_micd(struct snd_soc_codec *codec)
2568 * responsiveness. 2643 * responsiveness.
2569 */ 2644 */
2570 snd_soc_update_bits(codec, WM8996_MIC_DETECT_1, 2645 snd_soc_update_bits(codec, WM8996_MIC_DETECT_1,
2571 WM8996_MICD_RATE_MASK, 2646 WM8996_MICD_RATE_MASK |
2572 7 << WM8996_MICD_RATE_SHIFT); 2647 WM8996_MICD_BIAS_STARTTIME_MASK,
2648 7 << WM8996_MICD_RATE_SHIFT |
2649 7 << WM8996_MICD_BIAS_STARTTIME_SHIFT);
2573 } 2650 }
2574 } 2651 }
2575} 2652}
@@ -2692,6 +2769,18 @@ static void wm8996_retune_mobile_pdata(struct snd_soc_codec *codec)
2692 "Failed to add ReTune Mobile controls: %d\n", ret); 2769 "Failed to add ReTune Mobile controls: %d\n", ret);
2693} 2770}
2694 2771
2772static const struct regmap_config wm8996_regmap = {
2773 .reg_bits = 16,
2774 .val_bits = 16,
2775
2776 .max_register = WM8996_MAX_REGISTER,
2777 .reg_defaults = wm8996_reg,
2778 .num_reg_defaults = ARRAY_SIZE(wm8996_reg),
2779 .volatile_reg = wm8996_volatile_register,
2780 .readable_reg = wm8996_readable_register,
2781 .cache_type = REGCACHE_RBTREE,
2782};
2783
2695static int wm8996_probe(struct snd_soc_codec *codec) 2784static int wm8996_probe(struct snd_soc_codec *codec)
2696{ 2785{
2697 int ret; 2786 int ret;
@@ -2707,19 +2796,11 @@ static int wm8996_probe(struct snd_soc_codec *codec)
2707 2796
2708 dapm->idle_bias_off = true; 2797 dapm->idle_bias_off = true;
2709 2798
2710 ret = snd_soc_codec_set_cache_io(codec, 16, 16, SND_SOC_I2C); 2799 codec->control_data = wm8996->regmap;
2711 if (ret != 0) {
2712 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
2713 goto err;
2714 }
2715
2716 for (i = 0; i < ARRAY_SIZE(wm8996->supplies); i++)
2717 wm8996->supplies[i].supply = wm8996_supply_names[i];
2718 2800
2719 ret = regulator_bulk_get(codec->dev, ARRAY_SIZE(wm8996->supplies), 2801 ret = snd_soc_codec_set_cache_io(codec, 16, 16, SND_SOC_REGMAP);
2720 wm8996->supplies);
2721 if (ret != 0) { 2802 if (ret != 0) {
2722 dev_err(codec->dev, "Failed to request supplies: %d\n", ret); 2803 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
2723 goto err; 2804 goto err;
2724 } 2805 }
2725 2806
@@ -2727,13 +2808,6 @@ static int wm8996_probe(struct snd_soc_codec *codec)
2727 wm8996->disable_nb[1].notifier_call = wm8996_regulator_event_1; 2808 wm8996->disable_nb[1].notifier_call = wm8996_regulator_event_1;
2728 wm8996->disable_nb[2].notifier_call = wm8996_regulator_event_2; 2809 wm8996->disable_nb[2].notifier_call = wm8996_regulator_event_2;
2729 2810
2730 wm8996->cpvdd = regulator_get(&i2c->dev, "CPVDD");
2731 if (IS_ERR(wm8996->cpvdd)) {
2732 ret = PTR_ERR(wm8996->cpvdd);
2733 dev_err(&i2c->dev, "Failed to get CPVDD: %d\n", ret);
2734 goto err_get;
2735 }
2736
2737 /* This should really be moved into the regulator core */ 2811 /* This should really be moved into the regulator core */
2738 for (i = 0; i < ARRAY_SIZE(wm8996->supplies); i++) { 2812 for (i = 0; i < ARRAY_SIZE(wm8996->supplies); i++) {
2739 ret = regulator_register_notifier(wm8996->supplies[i].consumer, 2813 ret = regulator_register_notifier(wm8996->supplies[i].consumer,
@@ -2745,50 +2819,7 @@ static int wm8996_probe(struct snd_soc_codec *codec)
2745 } 2819 }
2746 } 2820 }
2747 2821
2748 ret = regulator_bulk_enable(ARRAY_SIZE(wm8996->supplies), 2822 regcache_cache_only(codec->control_data, true);
2749 wm8996->supplies);
2750 if (ret != 0) {
2751 dev_err(codec->dev, "Failed to enable supplies: %d\n", ret);
2752 goto err_cpvdd;
2753 }
2754
2755 if (wm8996->pdata.ldo_ena >= 0) {
2756 gpio_set_value_cansleep(wm8996->pdata.ldo_ena, 1);
2757 msleep(5);
2758 }
2759
2760 ret = snd_soc_read(codec, WM8996_SOFTWARE_RESET);
2761 if (ret < 0) {
2762 dev_err(codec->dev, "Failed to read ID register: %d\n", ret);
2763 goto err_enable;
2764 }
2765 if (ret != 0x8915) {
2766 dev_err(codec->dev, "Device is not a WM8996, ID %x\n", ret);
2767 ret = -EINVAL;
2768 goto err_enable;
2769 }
2770
2771 ret = snd_soc_read(codec, WM8996_CHIP_REVISION);
2772 if (ret < 0) {
2773 dev_err(codec->dev, "Failed to read device revision: %d\n",
2774 ret);
2775 goto err_enable;
2776 }
2777
2778 dev_info(codec->dev, "revision %c\n",
2779 (ret & WM8996_CHIP_REV_MASK) + 'A');
2780
2781 if (wm8996->pdata.ldo_ena >= 0) {
2782 gpio_set_value_cansleep(wm8996->pdata.ldo_ena, 0);
2783 } else {
2784 ret = wm8996_reset(codec);
2785 if (ret < 0) {
2786 dev_err(codec->dev, "Failed to issue reset\n");
2787 goto err_enable;
2788 }
2789 }
2790
2791 codec->cache_only = true;
2792 2823
2793 /* Apply platform data settings */ 2824 /* Apply platform data settings */
2794 snd_soc_update_bits(codec, WM8996_LINE_INPUT_CONTROL, 2825 snd_soc_update_bits(codec, WM8996_LINE_INPUT_CONTROL,
@@ -2946,10 +2977,6 @@ static int wm8996_probe(struct snd_soc_codec *codec)
2946 WM8996_AIF2TX_LRCLK_MODE, 2977 WM8996_AIF2TX_LRCLK_MODE,
2947 WM8996_AIF2TX_LRCLK_MODE); 2978 WM8996_AIF2TX_LRCLK_MODE);
2948 2979
2949 regulator_bulk_disable(ARRAY_SIZE(wm8996->supplies), wm8996->supplies);
2950
2951 wm8996_init_gpio(codec);
2952
2953 if (i2c->irq) { 2980 if (i2c->irq) {
2954 if (wm8996->pdata.irq_flags) 2981 if (wm8996->pdata.irq_flags)
2955 irq_flags = wm8996->pdata.irq_flags; 2982 irq_flags = wm8996->pdata.irq_flags;
@@ -2987,15 +3014,6 @@ static int wm8996_probe(struct snd_soc_codec *codec)
2987 3014
2988 return 0; 3015 return 0;
2989 3016
2990err_enable:
2991 if (wm8996->pdata.ldo_ena >= 0)
2992 gpio_set_value_cansleep(wm8996->pdata.ldo_ena, 0);
2993
2994 regulator_bulk_disable(ARRAY_SIZE(wm8996->supplies), wm8996->supplies);
2995err_cpvdd:
2996 regulator_put(wm8996->cpvdd);
2997err_get:
2998 regulator_bulk_free(ARRAY_SIZE(wm8996->supplies), wm8996->supplies);
2999err: 3017err:
3000 return ret; 3018 return ret;
3001} 3019}
@@ -3012,8 +3030,6 @@ static int wm8996_remove(struct snd_soc_codec *codec)
3012 if (i2c->irq) 3030 if (i2c->irq)
3013 free_irq(i2c->irq, codec); 3031 free_irq(i2c->irq, codec);
3014 3032
3015 wm8996_free_gpio(codec);
3016
3017 for (i = 0; i < ARRAY_SIZE(wm8996->supplies); i++) 3033 for (i = 0; i < ARRAY_SIZE(wm8996->supplies); i++)
3018 regulator_unregister_notifier(wm8996->supplies[i].consumer, 3034 regulator_unregister_notifier(wm8996->supplies[i].consumer,
3019 &wm8996->disable_nb[i]); 3035 &wm8996->disable_nb[i]);
@@ -3023,17 +3039,17 @@ static int wm8996_remove(struct snd_soc_codec *codec)
3023 return 0; 3039 return 0;
3024} 3040}
3025 3041
3042static int wm8996_soc_volatile_register(struct snd_soc_codec *codec,
3043 unsigned int reg)
3044{
3045 return true;
3046}
3047
3026static struct snd_soc_codec_driver soc_codec_dev_wm8996 = { 3048static struct snd_soc_codec_driver soc_codec_dev_wm8996 = {
3027 .probe = wm8996_probe, 3049 .probe = wm8996_probe,
3028 .remove = wm8996_remove, 3050 .remove = wm8996_remove,
3029 .set_bias_level = wm8996_set_bias_level, 3051 .set_bias_level = wm8996_set_bias_level,
3030 .seq_notifier = wm8996_seq_notifier, 3052 .seq_notifier = wm8996_seq_notifier,
3031 .reg_cache_size = WM8996_MAX_REGISTER + 1,
3032 .reg_word_size = sizeof(u16),
3033 .reg_cache_default = wm8996_reg,
3034 .volatile_register = wm8996_volatile_register,
3035 .readable_register = wm8996_readable_register,
3036 .compress_type = SND_SOC_RBTREE_COMPRESSION,
3037 .controls = wm8996_snd_controls, 3053 .controls = wm8996_snd_controls,
3038 .num_controls = ARRAY_SIZE(wm8996_snd_controls), 3054 .num_controls = ARRAY_SIZE(wm8996_snd_controls),
3039 .dapm_widgets = wm8996_dapm_widgets, 3055 .dapm_widgets = wm8996_dapm_widgets,
@@ -3041,6 +3057,8 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8996 = {
3041 .dapm_routes = wm8996_dapm_routes, 3057 .dapm_routes = wm8996_dapm_routes,
3042 .num_dapm_routes = ARRAY_SIZE(wm8996_dapm_routes), 3058 .num_dapm_routes = ARRAY_SIZE(wm8996_dapm_routes),
3043 .set_pll = wm8996_set_fll, 3059 .set_pll = wm8996_set_fll,
3060 .reg_cache_size = WM8996_MAX_REGISTER,
3061 .volatile_register = wm8996_soc_volatile_register,
3044}; 3062};
3045 3063
3046#define WM8996_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 |\ 3064#define WM8996_RATES (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 |\
@@ -3049,7 +3067,7 @@ static struct snd_soc_codec_driver soc_codec_dev_wm8996 = {
3049 SNDRV_PCM_FMTBIT_S20_3LE | SNDRV_PCM_FMTBIT_S24_LE |\ 3067 SNDRV_PCM_FMTBIT_S20_3LE | SNDRV_PCM_FMTBIT_S24_LE |\
3050 SNDRV_PCM_FMTBIT_S32_LE) 3068 SNDRV_PCM_FMTBIT_S32_LE)
3051 3069
3052static struct snd_soc_dai_ops wm8996_dai_ops = { 3070static const struct snd_soc_dai_ops wm8996_dai_ops = {
3053 .set_fmt = wm8996_set_fmt, 3071 .set_fmt = wm8996_set_fmt,
3054 .hw_params = wm8996_hw_params, 3072 .hw_params = wm8996_hw_params,
3055 .set_sysclk = wm8996_set_sysclk, 3073 .set_sysclk = wm8996_set_sysclk,
@@ -3098,13 +3116,16 @@ static __devinit int wm8996_i2c_probe(struct i2c_client *i2c,
3098 const struct i2c_device_id *id) 3116 const struct i2c_device_id *id)
3099{ 3117{
3100 struct wm8996_priv *wm8996; 3118 struct wm8996_priv *wm8996;
3101 int ret; 3119 int ret, i;
3120 unsigned int reg;
3102 3121
3103 wm8996 = kzalloc(sizeof(struct wm8996_priv), GFP_KERNEL); 3122 wm8996 = devm_kzalloc(&i2c->dev, sizeof(struct wm8996_priv),
3123 GFP_KERNEL);
3104 if (wm8996 == NULL) 3124 if (wm8996 == NULL)
3105 return -ENOMEM; 3125 return -ENOMEM;
3106 3126
3107 i2c_set_clientdata(i2c, wm8996); 3127 i2c_set_clientdata(i2c, wm8996);
3128 wm8996->dev = &i2c->dev;
3108 3129
3109 if (dev_get_platdata(&i2c->dev)) 3130 if (dev_get_platdata(&i2c->dev))
3110 memcpy(&wm8996->pdata, dev_get_platdata(&i2c->dev), 3131 memcpy(&wm8996->pdata, dev_get_platdata(&i2c->dev),
@@ -3120,19 +3141,97 @@ static __devinit int wm8996_i2c_probe(struct i2c_client *i2c,
3120 } 3141 }
3121 } 3142 }
3122 3143
3144 for (i = 0; i < ARRAY_SIZE(wm8996->supplies); i++)
3145 wm8996->supplies[i].supply = wm8996_supply_names[i];
3146
3147 ret = regulator_bulk_get(&i2c->dev, ARRAY_SIZE(wm8996->supplies),
3148 wm8996->supplies);
3149 if (ret != 0) {
3150 dev_err(&i2c->dev, "Failed to request supplies: %d\n", ret);
3151 goto err_gpio;
3152 }
3153
3154 wm8996->cpvdd = regulator_get(&i2c->dev, "CPVDD");
3155 if (IS_ERR(wm8996->cpvdd)) {
3156 ret = PTR_ERR(wm8996->cpvdd);
3157 dev_err(&i2c->dev, "Failed to get CPVDD: %d\n", ret);
3158 goto err_get;
3159 }
3160
3161 ret = regulator_bulk_enable(ARRAY_SIZE(wm8996->supplies),
3162 wm8996->supplies);
3163 if (ret != 0) {
3164 dev_err(&i2c->dev, "Failed to enable supplies: %d\n", ret);
3165 goto err_cpvdd;
3166 }
3167
3168 if (wm8996->pdata.ldo_ena > 0) {
3169 gpio_set_value_cansleep(wm8996->pdata.ldo_ena, 1);
3170 msleep(5);
3171 }
3172
3173 wm8996->regmap = regmap_init_i2c(i2c, &wm8996_regmap);
3174 if (IS_ERR(wm8996->regmap)) {
3175 ret = PTR_ERR(wm8996->regmap);
3176 dev_err(&i2c->dev, "regmap_init() failed: %d\n", ret);
3177 goto err_enable;
3178 }
3179
3180 ret = regmap_read(wm8996->regmap, WM8996_SOFTWARE_RESET, &reg);
3181 if (ret < 0) {
3182 dev_err(&i2c->dev, "Failed to read ID register: %d\n", ret);
3183 goto err_regmap;
3184 }
3185 if (reg != 0x8915) {
3186 dev_err(&i2c->dev, "Device is not a WM8996, ID %x\n", ret);
3187 ret = -EINVAL;
3188 goto err_regmap;
3189 }
3190
3191 ret = regmap_read(wm8996->regmap, WM8996_CHIP_REVISION, &reg);
3192 if (ret < 0) {
3193 dev_err(&i2c->dev, "Failed to read device revision: %d\n",
3194 ret);
3195 goto err_regmap;
3196 }
3197
3198 dev_info(&i2c->dev, "revision %c\n",
3199 (reg & WM8996_CHIP_REV_MASK) + 'A');
3200
3201 regulator_bulk_disable(ARRAY_SIZE(wm8996->supplies), wm8996->supplies);
3202
3203 ret = wm8996_reset(wm8996);
3204 if (ret < 0) {
3205 dev_err(&i2c->dev, "Failed to issue reset\n");
3206 goto err_regmap;
3207 }
3208
3209 wm8996_init_gpio(wm8996);
3210
3123 ret = snd_soc_register_codec(&i2c->dev, 3211 ret = snd_soc_register_codec(&i2c->dev,
3124 &soc_codec_dev_wm8996, wm8996_dai, 3212 &soc_codec_dev_wm8996, wm8996_dai,
3125 ARRAY_SIZE(wm8996_dai)); 3213 ARRAY_SIZE(wm8996_dai));
3126 if (ret < 0) 3214 if (ret < 0)
3127 goto err_gpio; 3215 goto err_gpiolib;
3128 3216
3129 return ret; 3217 return ret;
3130 3218
3219err_gpiolib:
3220 wm8996_free_gpio(wm8996);
3221err_regmap:
3222 regmap_exit(wm8996->regmap);
3223err_enable:
3224 if (wm8996->pdata.ldo_ena > 0)
3225 gpio_set_value_cansleep(wm8996->pdata.ldo_ena, 0);
3226 regulator_bulk_disable(ARRAY_SIZE(wm8996->supplies), wm8996->supplies);
3227err_cpvdd:
3228 regulator_put(wm8996->cpvdd);
3229err_get:
3230 regulator_bulk_free(ARRAY_SIZE(wm8996->supplies), wm8996->supplies);
3131err_gpio: 3231err_gpio:
3132 if (wm8996->pdata.ldo_ena > 0) 3232 if (wm8996->pdata.ldo_ena > 0)
3133 gpio_free(wm8996->pdata.ldo_ena); 3233 gpio_free(wm8996->pdata.ldo_ena);
3134err: 3234err:
3135 kfree(wm8996);
3136 3235
3137 return ret; 3236 return ret;
3138} 3237}
@@ -3142,9 +3241,14 @@ static __devexit int wm8996_i2c_remove(struct i2c_client *client)
3142 struct wm8996_priv *wm8996 = i2c_get_clientdata(client); 3241 struct wm8996_priv *wm8996 = i2c_get_clientdata(client);
3143 3242
3144 snd_soc_unregister_codec(&client->dev); 3243 snd_soc_unregister_codec(&client->dev);
3145 if (wm8996->pdata.ldo_ena > 0) 3244 wm8996_free_gpio(wm8996);
3245 regulator_put(wm8996->cpvdd);
3246 regulator_bulk_free(ARRAY_SIZE(wm8996->supplies), wm8996->supplies);
3247 regmap_exit(wm8996->regmap);
3248 if (wm8996->pdata.ldo_ena > 0) {
3249 gpio_set_value_cansleep(wm8996->pdata.ldo_ena, 0);
3146 gpio_free(wm8996->pdata.ldo_ena); 3250 gpio_free(wm8996->pdata.ldo_ena);
3147 kfree(i2c_get_clientdata(client)); 3251 }
3148 return 0; 3252 return 0;
3149} 3253}
3150 3254
diff --git a/sound/soc/codecs/wm9081.c b/sound/soc/codecs/wm9081.c
index 4a398c3bfe8..a6bab392700 100644
--- a/sound/soc/codecs/wm9081.c
+++ b/sound/soc/codecs/wm9081.c
@@ -18,7 +18,7 @@
18#include <linux/device.h> 18#include <linux/device.h>
19#include <linux/pm.h> 19#include <linux/pm.h>
20#include <linux/i2c.h> 20#include <linux/i2c.h>
21#include <linux/platform_device.h> 21#include <linux/regmap.h>
22#include <linux/slab.h> 22#include <linux/slab.h>
23#include <sound/core.h> 23#include <sound/core.h>
24#include <sound/pcm.h> 24#include <sound/pcm.h>
@@ -30,69 +30,60 @@
30#include <sound/wm9081.h> 30#include <sound/wm9081.h>
31#include "wm9081.h" 31#include "wm9081.h"
32 32
33static u16 wm9081_reg_defaults[] = { 33static struct reg_default wm9081_reg[] = {
34 0x0000, /* R0 - Software Reset */ 34 { 2, 0x00B9 }, /* R2 - Analogue Lineout */
35 0x0000, /* R1 */ 35 { 3, 0x00B9 }, /* R3 - Analogue Speaker PGA */
36 0x00B9, /* R2 - Analogue Lineout */ 36 { 4, 0x0001 }, /* R4 - VMID Control */
37 0x00B9, /* R3 - Analogue Speaker PGA */ 37 { 5, 0x0068 }, /* R5 - Bias Control 1 */
38 0x0001, /* R4 - VMID Control */ 38 { 7, 0x0000 }, /* R7 - Analogue Mixer */
39 0x0068, /* R5 - Bias Control 1 */ 39 { 8, 0x0000 }, /* R8 - Anti Pop Control */
40 0x0000, /* R6 */ 40 { 9, 0x01DB }, /* R9 - Analogue Speaker 1 */
41 0x0000, /* R7 - Analogue Mixer */ 41 { 10, 0x0018 }, /* R10 - Analogue Speaker 2 */
42 0x0000, /* R8 - Anti Pop Control */ 42 { 11, 0x0180 }, /* R11 - Power Management */
43 0x01DB, /* R9 - Analogue Speaker 1 */ 43 { 12, 0x0000 }, /* R12 - Clock Control 1 */
44 0x0018, /* R10 - Analogue Speaker 2 */ 44 { 13, 0x0038 }, /* R13 - Clock Control 2 */
45 0x0180, /* R11 - Power Management */ 45 { 14, 0x4000 }, /* R14 - Clock Control 3 */
46 0x0000, /* R12 - Clock Control 1 */ 46 { 16, 0x0000 }, /* R16 - FLL Control 1 */
47 0x0038, /* R13 - Clock Control 2 */ 47 { 17, 0x0200 }, /* R17 - FLL Control 2 */
48 0x4000, /* R14 - Clock Control 3 */ 48 { 18, 0x0000 }, /* R18 - FLL Control 3 */
49 0x0000, /* R15 */ 49 { 19, 0x0204 }, /* R19 - FLL Control 4 */
50 0x0000, /* R16 - FLL Control 1 */ 50 { 20, 0x0000 }, /* R20 - FLL Control 5 */
51 0x0200, /* R17 - FLL Control 2 */ 51 { 22, 0x0000 }, /* R22 - Audio Interface 1 */
52 0x0000, /* R18 - FLL Control 3 */ 52 { 23, 0x0002 }, /* R23 - Audio Interface 2 */
53 0x0204, /* R19 - FLL Control 4 */ 53 { 24, 0x0008 }, /* R24 - Audio Interface 3 */
54 0x0000, /* R20 - FLL Control 5 */ 54 { 25, 0x0022 }, /* R25 - Audio Interface 4 */
55 0x0000, /* R21 */ 55 { 27, 0x0006 }, /* R27 - Interrupt Status Mask */
56 0x0000, /* R22 - Audio Interface 1 */ 56 { 28, 0x0000 }, /* R28 - Interrupt Polarity */
57 0x0002, /* R23 - Audio Interface 2 */ 57 { 29, 0x0000 }, /* R29 - Interrupt Control */
58 0x0008, /* R24 - Audio Interface 3 */ 58 { 30, 0x00C0 }, /* R30 - DAC Digital 1 */
59 0x0022, /* R25 - Audio Interface 4 */ 59 { 31, 0x0008 }, /* R31 - DAC Digital 2 */
60 0x0000, /* R26 - Interrupt Status */ 60 { 32, 0x09AF }, /* R32 - DRC 1 */
61 0x0006, /* R27 - Interrupt Status Mask */ 61 { 33, 0x4201 }, /* R33 - DRC 2 */
62 0x0000, /* R28 - Interrupt Polarity */ 62 { 34, 0x0000 }, /* R34 - DRC 3 */
63 0x0000, /* R29 - Interrupt Control */ 63 { 35, 0x0000 }, /* R35 - DRC 4 */
64 0x00C0, /* R30 - DAC Digital 1 */ 64 { 38, 0x0000 }, /* R38 - Write Sequencer 1 */
65 0x0008, /* R31 - DAC Digital 2 */ 65 { 39, 0x0000 }, /* R39 - Write Sequencer 2 */
66 0x09AF, /* R32 - DRC 1 */ 66 { 40, 0x0002 }, /* R40 - MW Slave 1 */
67 0x4201, /* R33 - DRC 2 */ 67 { 42, 0x0000 }, /* R42 - EQ 1 */
68 0x0000, /* R34 - DRC 3 */ 68 { 43, 0x0000 }, /* R43 - EQ 2 */
69 0x0000, /* R35 - DRC 4 */ 69 { 44, 0x0FCA }, /* R44 - EQ 3 */
70 0x0000, /* R36 */ 70 { 45, 0x0400 }, /* R45 - EQ 4 */
71 0x0000, /* R37 */ 71 { 46, 0x00B8 }, /* R46 - EQ 5 */
72 0x0000, /* R38 - Write Sequencer 1 */ 72 { 47, 0x1EB5 }, /* R47 - EQ 6 */
73 0x0000, /* R39 - Write Sequencer 2 */ 73 { 48, 0xF145 }, /* R48 - EQ 7 */
74 0x0002, /* R40 - MW Slave 1 */ 74 { 49, 0x0B75 }, /* R49 - EQ 8 */
75 0x0000, /* R41 */ 75 { 50, 0x01C5 }, /* R50 - EQ 9 */
76 0x0000, /* R42 - EQ 1 */ 76 { 51, 0x169E }, /* R51 - EQ 10 */
77 0x0000, /* R43 - EQ 2 */ 77 { 52, 0xF829 }, /* R52 - EQ 11 */
78 0x0FCA, /* R44 - EQ 3 */ 78 { 53, 0x07AD }, /* R53 - EQ 12 */
79 0x0400, /* R45 - EQ 4 */ 79 { 54, 0x1103 }, /* R54 - EQ 13 */
80 0x00B8, /* R46 - EQ 5 */ 80 { 55, 0x1C58 }, /* R55 - EQ 14 */
81 0x1EB5, /* R47 - EQ 6 */ 81 { 56, 0xF373 }, /* R56 - EQ 15 */
82 0xF145, /* R48 - EQ 7 */ 82 { 57, 0x0A54 }, /* R57 - EQ 16 */
83 0x0B75, /* R49 - EQ 8 */ 83 { 58, 0x0558 }, /* R58 - EQ 17 */
84 0x01C5, /* R50 - EQ 9 */ 84 { 59, 0x0564 }, /* R59 - EQ 18 */
85 0x169E, /* R51 - EQ 10 */ 85 { 60, 0x0559 }, /* R60 - EQ 19 */
86 0xF829, /* R52 - EQ 11 */ 86 { 61, 0x4000 }, /* R61 - EQ 20 */
87 0x07AD, /* R53 - EQ 12 */
88 0x1103, /* R54 - EQ 13 */
89 0x1C58, /* R55 - EQ 14 */
90 0xF373, /* R56 - EQ 15 */
91 0x0A54, /* R57 - EQ 16 */
92 0x0558, /* R58 - EQ 17 */
93 0x0564, /* R59 - EQ 18 */
94 0x0559, /* R60 - EQ 19 */
95 0x4000, /* R61 - EQ 20 */
96}; 87};
97 88
98static struct { 89static struct {
@@ -156,7 +147,7 @@ static struct {
156}; 147};
157 148
158struct wm9081_priv { 149struct wm9081_priv {
159 enum snd_soc_control_type control_type; 150 struct regmap *regmap;
160 int sysclk_source; 151 int sysclk_source;
161 int mclk_rate; 152 int mclk_rate;
162 int sysclk_rate; 153 int sysclk_rate;
@@ -169,20 +160,84 @@ struct wm9081_priv {
169 struct wm9081_pdata pdata; 160 struct wm9081_pdata pdata;
170}; 161};
171 162
172static int wm9081_volatile_register(struct snd_soc_codec *codec, unsigned int reg) 163static bool wm9081_volatile_register(struct device *dev, unsigned int reg)
173{ 164{
174 switch (reg) { 165 switch (reg) {
175 case WM9081_SOFTWARE_RESET: 166 case WM9081_SOFTWARE_RESET:
176 case WM9081_INTERRUPT_STATUS: 167 case WM9081_INTERRUPT_STATUS:
177 return 1; 168 return true;
178 default: 169 default:
179 return 0; 170 return false;
171 }
172}
173
174static bool wm9081_readable_register(struct device *dev, unsigned int reg)
175{
176 switch (reg) {
177 case WM9081_SOFTWARE_RESET:
178 case WM9081_ANALOGUE_LINEOUT:
179 case WM9081_ANALOGUE_SPEAKER_PGA:
180 case WM9081_VMID_CONTROL:
181 case WM9081_BIAS_CONTROL_1:
182 case WM9081_ANALOGUE_MIXER:
183 case WM9081_ANTI_POP_CONTROL:
184 case WM9081_ANALOGUE_SPEAKER_1:
185 case WM9081_ANALOGUE_SPEAKER_2:
186 case WM9081_POWER_MANAGEMENT:
187 case WM9081_CLOCK_CONTROL_1:
188 case WM9081_CLOCK_CONTROL_2:
189 case WM9081_CLOCK_CONTROL_3:
190 case WM9081_FLL_CONTROL_1:
191 case WM9081_FLL_CONTROL_2:
192 case WM9081_FLL_CONTROL_3:
193 case WM9081_FLL_CONTROL_4:
194 case WM9081_FLL_CONTROL_5:
195 case WM9081_AUDIO_INTERFACE_1:
196 case WM9081_AUDIO_INTERFACE_2:
197 case WM9081_AUDIO_INTERFACE_3:
198 case WM9081_AUDIO_INTERFACE_4:
199 case WM9081_INTERRUPT_STATUS:
200 case WM9081_INTERRUPT_STATUS_MASK:
201 case WM9081_INTERRUPT_POLARITY:
202 case WM9081_INTERRUPT_CONTROL:
203 case WM9081_DAC_DIGITAL_1:
204 case WM9081_DAC_DIGITAL_2:
205 case WM9081_DRC_1:
206 case WM9081_DRC_2:
207 case WM9081_DRC_3:
208 case WM9081_DRC_4:
209 case WM9081_WRITE_SEQUENCER_1:
210 case WM9081_WRITE_SEQUENCER_2:
211 case WM9081_MW_SLAVE_1:
212 case WM9081_EQ_1:
213 case WM9081_EQ_2:
214 case WM9081_EQ_3:
215 case WM9081_EQ_4:
216 case WM9081_EQ_5:
217 case WM9081_EQ_6:
218 case WM9081_EQ_7:
219 case WM9081_EQ_8:
220 case WM9081_EQ_9:
221 case WM9081_EQ_10:
222 case WM9081_EQ_11:
223 case WM9081_EQ_12:
224 case WM9081_EQ_13:
225 case WM9081_EQ_14:
226 case WM9081_EQ_15:
227 case WM9081_EQ_16:
228 case WM9081_EQ_17:
229 case WM9081_EQ_18:
230 case WM9081_EQ_19:
231 case WM9081_EQ_20:
232 return true;
233 default:
234 return false;
180 } 235 }
181} 236}
182 237
183static int wm9081_reset(struct snd_soc_codec *codec) 238static int wm9081_reset(struct regmap *map)
184{ 239{
185 return snd_soc_write(codec, WM9081_SOFTWARE_RESET, 0); 240 return regmap_write(map, WM9081_SOFTWARE_RESET, 0x9081);
186} 241}
187 242
188static const DECLARE_TLV_DB_SCALE(drc_in_tlv, -4500, 75, 0); 243static const DECLARE_TLV_DB_SCALE(drc_in_tlv, -4500, 75, 0);
@@ -737,6 +792,7 @@ SND_SOC_DAPM_SUPPLY("CLK_SYS", WM9081_CLOCK_CONTROL_3, 0, 0, clk_sys_event,
737 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), 792 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
738SND_SOC_DAPM_SUPPLY("CLK_DSP", WM9081_CLOCK_CONTROL_3, 1, 0, NULL, 0), 793SND_SOC_DAPM_SUPPLY("CLK_DSP", WM9081_CLOCK_CONTROL_3, 1, 0, NULL, 0),
739SND_SOC_DAPM_SUPPLY("TOCLK", WM9081_CLOCK_CONTROL_3, 2, 0, NULL, 0), 794SND_SOC_DAPM_SUPPLY("TOCLK", WM9081_CLOCK_CONTROL_3, 2, 0, NULL, 0),
795SND_SOC_DAPM_SUPPLY("TSENSE", WM9081_POWER_MANAGEMENT, 7, 0, NULL, 0),
740}; 796};
741 797
742 798
@@ -759,6 +815,7 @@ static const struct snd_soc_dapm_route wm9081_audio_paths[] = {
759 { "Speaker PGA", NULL, "CLK_SYS" }, 815 { "Speaker PGA", NULL, "CLK_SYS" },
760 816
761 { "Speaker", NULL, "Speaker PGA" }, 817 { "Speaker", NULL, "Speaker PGA" },
818 { "Speaker", NULL, "TSENSE" },
762 819
763 { "SPKN", NULL, "Speaker" }, 820 { "SPKN", NULL, "Speaker" },
764 { "SPKP", NULL, "Speaker" }, 821 { "SPKP", NULL, "Speaker" },
@@ -767,84 +824,74 @@ static const struct snd_soc_dapm_route wm9081_audio_paths[] = {
767static int wm9081_set_bias_level(struct snd_soc_codec *codec, 824static int wm9081_set_bias_level(struct snd_soc_codec *codec,
768 enum snd_soc_bias_level level) 825 enum snd_soc_bias_level level)
769{ 826{
770 u16 reg;
771
772 switch (level) { 827 switch (level) {
773 case SND_SOC_BIAS_ON: 828 case SND_SOC_BIAS_ON:
774 break; 829 break;
775 830
776 case SND_SOC_BIAS_PREPARE: 831 case SND_SOC_BIAS_PREPARE:
777 /* VMID=2*40k */ 832 /* VMID=2*40k */
778 reg = snd_soc_read(codec, WM9081_VMID_CONTROL); 833 snd_soc_update_bits(codec, WM9081_VMID_CONTROL,
779 reg &= ~WM9081_VMID_SEL_MASK; 834 WM9081_VMID_SEL_MASK, 0x2);
780 reg |= 0x2;
781 snd_soc_write(codec, WM9081_VMID_CONTROL, reg);
782 835
783 /* Normal bias current */ 836 /* Normal bias current */
784 reg = snd_soc_read(codec, WM9081_BIAS_CONTROL_1); 837 snd_soc_update_bits(codec, WM9081_BIAS_CONTROL_1,
785 reg &= ~WM9081_STBY_BIAS_ENA; 838 WM9081_STBY_BIAS_ENA, 0);
786 snd_soc_write(codec, WM9081_BIAS_CONTROL_1, reg);
787 break; 839 break;
788 840
789 case SND_SOC_BIAS_STANDBY: 841 case SND_SOC_BIAS_STANDBY:
790 /* Initial cold start */ 842 /* Initial cold start */
791 if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { 843 if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
792 /* Disable LINEOUT discharge */ 844 /* Disable LINEOUT discharge */
793 reg = snd_soc_read(codec, WM9081_ANTI_POP_CONTROL); 845 snd_soc_update_bits(codec, WM9081_ANTI_POP_CONTROL,
794 reg &= ~WM9081_LINEOUT_DISCH; 846 WM9081_LINEOUT_DISCH, 0);
795 snd_soc_write(codec, WM9081_ANTI_POP_CONTROL, reg);
796 847
797 /* Select startup bias source */ 848 /* Select startup bias source */
798 reg = snd_soc_read(codec, WM9081_BIAS_CONTROL_1); 849 snd_soc_update_bits(codec, WM9081_BIAS_CONTROL_1,
799 reg |= WM9081_BIAS_SRC | WM9081_BIAS_ENA; 850 WM9081_BIAS_SRC | WM9081_BIAS_ENA,
800 snd_soc_write(codec, WM9081_BIAS_CONTROL_1, reg); 851 WM9081_BIAS_SRC | WM9081_BIAS_ENA);
801 852
802 /* VMID 2*4k; Soft VMID ramp enable */ 853 /* VMID 2*4k; Soft VMID ramp enable */
803 reg = snd_soc_read(codec, WM9081_VMID_CONTROL); 854 snd_soc_update_bits(codec, WM9081_VMID_CONTROL,
804 reg |= WM9081_VMID_RAMP | 0x6; 855 WM9081_VMID_RAMP |
805 snd_soc_write(codec, WM9081_VMID_CONTROL, reg); 856 WM9081_VMID_SEL_MASK,
857 WM9081_VMID_RAMP | 0x6);
806 858
807 mdelay(100); 859 mdelay(100);
808 860
809 /* Normal bias enable & soft start off */ 861 /* Normal bias enable & soft start off */
810 reg &= ~WM9081_VMID_RAMP; 862 snd_soc_update_bits(codec, WM9081_VMID_CONTROL,
811 snd_soc_write(codec, WM9081_VMID_CONTROL, reg); 863 WM9081_VMID_RAMP, 0);
812 864
813 /* Standard bias source */ 865 /* Standard bias source */
814 reg = snd_soc_read(codec, WM9081_BIAS_CONTROL_1); 866 snd_soc_update_bits(codec, WM9081_BIAS_CONTROL_1,
815 reg &= ~WM9081_BIAS_SRC; 867 WM9081_BIAS_SRC, 0);
816 snd_soc_write(codec, WM9081_BIAS_CONTROL_1, reg);
817 } 868 }
818 869
819 /* VMID 2*240k */ 870 /* VMID 2*240k */
820 reg = snd_soc_read(codec, WM9081_VMID_CONTROL); 871 snd_soc_update_bits(codec, WM9081_VMID_CONTROL,
821 reg &= ~WM9081_VMID_SEL_MASK; 872 WM9081_VMID_SEL_MASK, 0x04);
822 reg |= 0x04;
823 snd_soc_write(codec, WM9081_VMID_CONTROL, reg);
824 873
825 /* Standby bias current on */ 874 /* Standby bias current on */
826 reg = snd_soc_read(codec, WM9081_BIAS_CONTROL_1); 875 snd_soc_update_bits(codec, WM9081_BIAS_CONTROL_1,
827 reg |= WM9081_STBY_BIAS_ENA; 876 WM9081_STBY_BIAS_ENA,
828 snd_soc_write(codec, WM9081_BIAS_CONTROL_1, reg); 877 WM9081_STBY_BIAS_ENA);
829 break; 878 break;
830 879
831 case SND_SOC_BIAS_OFF: 880 case SND_SOC_BIAS_OFF:
832 /* Startup bias source and disable bias */ 881 /* Startup bias source and disable bias */
833 reg = snd_soc_read(codec, WM9081_BIAS_CONTROL_1); 882 snd_soc_update_bits(codec, WM9081_BIAS_CONTROL_1,
834 reg |= WM9081_BIAS_SRC; 883 WM9081_BIAS_SRC | WM9081_BIAS_ENA,
835 reg &= ~WM9081_BIAS_ENA; 884 WM9081_BIAS_SRC);
836 snd_soc_write(codec, WM9081_BIAS_CONTROL_1, reg);
837 885
838 /* Disable VMID with soft ramping */ 886 /* Disable VMID with soft ramping */
839 reg = snd_soc_read(codec, WM9081_VMID_CONTROL); 887 snd_soc_update_bits(codec, WM9081_VMID_CONTROL,
840 reg &= ~WM9081_VMID_SEL_MASK; 888 WM9081_VMID_RAMP | WM9081_VMID_SEL_MASK,
841 reg |= WM9081_VMID_RAMP; 889 WM9081_VMID_RAMP);
842 snd_soc_write(codec, WM9081_VMID_CONTROL, reg);
843 890
844 /* Actively discharge LINEOUT */ 891 /* Actively discharge LINEOUT */
845 reg = snd_soc_read(codec, WM9081_ANTI_POP_CONTROL); 892 snd_soc_update_bits(codec, WM9081_ANTI_POP_CONTROL,
846 reg |= WM9081_LINEOUT_DISCH; 893 WM9081_LINEOUT_DISCH,
847 snd_soc_write(codec, WM9081_ANTI_POP_CONTROL, reg); 894 WM9081_LINEOUT_DISCH);
848 break; 895 break;
849 } 896 }
850 897
@@ -1185,7 +1232,7 @@ static int wm9081_set_tdm_slot(struct snd_soc_dai *dai,
1185 (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \ 1232 (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \
1186 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE) 1233 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE)
1187 1234
1188static struct snd_soc_dai_ops wm9081_dai_ops = { 1235static const struct snd_soc_dai_ops wm9081_dai_ops = {
1189 .hw_params = wm9081_hw_params, 1236 .hw_params = wm9081_hw_params,
1190 .set_fmt = wm9081_set_dai_fmt, 1237 .set_fmt = wm9081_set_dai_fmt,
1191 .digital_mute = wm9081_digital_mute, 1238 .digital_mute = wm9081_digital_mute,
@@ -1213,25 +1260,14 @@ static int wm9081_probe(struct snd_soc_codec *codec)
1213 int ret; 1260 int ret;
1214 u16 reg; 1261 u16 reg;
1215 1262
1216 ret = snd_soc_codec_set_cache_io(codec, 8, 16, wm9081->control_type); 1263 codec->control_data = wm9081->regmap;
1264
1265 ret = snd_soc_codec_set_cache_io(codec, 8, 16, SND_SOC_REGMAP);
1217 if (ret != 0) { 1266 if (ret != 0) {
1218 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret); 1267 dev_err(codec->dev, "Failed to set cache I/O: %d\n", ret);
1219 return ret; 1268 return ret;
1220 } 1269 }
1221 1270
1222 reg = snd_soc_read(codec, WM9081_SOFTWARE_RESET);
1223 if (reg != 0x9081) {
1224 dev_err(codec->dev, "Device is not a WM9081: ID=0x%x\n", reg);
1225 ret = -EINVAL;
1226 return ret;
1227 }
1228
1229 ret = wm9081_reset(codec);
1230 if (ret < 0) {
1231 dev_err(codec->dev, "Failed to issue reset\n");
1232 return ret;
1233 }
1234
1235 reg = 0; 1271 reg = 0;
1236 if (wm9081->pdata.irq_high) 1272 if (wm9081->pdata.irq_high)
1237 reg |= WM9081_IRQ_POL; 1273 reg |= WM9081_IRQ_POL;
@@ -1243,11 +1279,10 @@ static int wm9081_probe(struct snd_soc_codec *codec)
1243 wm9081_set_bias_level(codec, SND_SOC_BIAS_STANDBY); 1279 wm9081_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
1244 1280
1245 /* Enable zero cross by default */ 1281 /* Enable zero cross by default */
1246 reg = snd_soc_read(codec, WM9081_ANALOGUE_LINEOUT); 1282 snd_soc_update_bits(codec, WM9081_ANALOGUE_LINEOUT,
1247 snd_soc_write(codec, WM9081_ANALOGUE_LINEOUT, reg | WM9081_LINEOUTZC); 1283 WM9081_LINEOUTZC, WM9081_LINEOUTZC);
1248 reg = snd_soc_read(codec, WM9081_ANALOGUE_SPEAKER_PGA); 1284 snd_soc_update_bits(codec, WM9081_ANALOGUE_SPEAKER_PGA,
1249 snd_soc_write(codec, WM9081_ANALOGUE_SPEAKER_PGA, 1285 WM9081_SPKPGAZC, WM9081_SPKPGAZC);
1250 reg | WM9081_SPKPGAZC);
1251 1286
1252 if (!wm9081->pdata.num_retune_configs) { 1287 if (!wm9081->pdata.num_retune_configs) {
1253 dev_dbg(codec->dev, 1288 dev_dbg(codec->dev,
@@ -1266,7 +1301,7 @@ static int wm9081_remove(struct snd_soc_codec *codec)
1266} 1301}
1267 1302
1268#ifdef CONFIG_PM 1303#ifdef CONFIG_PM
1269static int wm9081_suspend(struct snd_soc_codec *codec, pm_message_t state) 1304static int wm9081_suspend(struct snd_soc_codec *codec)
1270{ 1305{
1271 wm9081_set_bias_level(codec, SND_SOC_BIAS_OFF); 1306 wm9081_set_bias_level(codec, SND_SOC_BIAS_OFF);
1272 1307
@@ -1275,15 +1310,9 @@ static int wm9081_suspend(struct snd_soc_codec *codec, pm_message_t state)
1275 1310
1276static int wm9081_resume(struct snd_soc_codec *codec) 1311static int wm9081_resume(struct snd_soc_codec *codec)
1277{ 1312{
1278 u16 *reg_cache = codec->reg_cache; 1313 struct wm9081_priv *wm9081 = snd_soc_codec_get_drvdata(codec);
1279 int i;
1280
1281 for (i = 0; i < codec->driver->reg_cache_size; i++) {
1282 if (i == WM9081_SOFTWARE_RESET)
1283 continue;
1284 1314
1285 snd_soc_write(codec, i, reg_cache[i]); 1315 regcache_sync(wm9081->regmap);
1286 }
1287 1316
1288 wm9081_set_bias_level(codec, SND_SOC_BIAS_STANDBY); 1317 wm9081_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
1289 1318
@@ -1303,11 +1332,6 @@ static struct snd_soc_codec_driver soc_codec_dev_wm9081 = {
1303 .set_sysclk = wm9081_set_sysclk, 1332 .set_sysclk = wm9081_set_sysclk,
1304 .set_bias_level = wm9081_set_bias_level, 1333 .set_bias_level = wm9081_set_bias_level,
1305 1334
1306 .reg_cache_size = ARRAY_SIZE(wm9081_reg_defaults),
1307 .reg_word_size = sizeof(u16),
1308 .reg_cache_default = wm9081_reg_defaults,
1309 .volatile_register = wm9081_volatile_register,
1310
1311 .controls = wm9081_snd_controls, 1335 .controls = wm9081_snd_controls,
1312 .num_controls = ARRAY_SIZE(wm9081_snd_controls), 1336 .num_controls = ARRAY_SIZE(wm9081_snd_controls),
1313 .dapm_widgets = wm9081_dapm_widgets, 1337 .dapm_widgets = wm9081_dapm_widgets,
@@ -1316,19 +1340,56 @@ static struct snd_soc_codec_driver soc_codec_dev_wm9081 = {
1316 .num_dapm_routes = ARRAY_SIZE(wm9081_audio_paths), 1340 .num_dapm_routes = ARRAY_SIZE(wm9081_audio_paths),
1317}; 1341};
1318 1342
1343static const struct regmap_config wm9081_regmap = {
1344 .reg_bits = 8,
1345 .val_bits = 16,
1346
1347 .max_register = WM9081_MAX_REGISTER,
1348 .reg_defaults = wm9081_reg,
1349 .num_reg_defaults = ARRAY_SIZE(wm9081_reg),
1350 .volatile_reg = wm9081_volatile_register,
1351 .readable_reg = wm9081_readable_register,
1352 .cache_type = REGCACHE_RBTREE,
1353};
1354
1319#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE) 1355#if defined(CONFIG_I2C) || defined(CONFIG_I2C_MODULE)
1320static __devinit int wm9081_i2c_probe(struct i2c_client *i2c, 1356static __devinit int wm9081_i2c_probe(struct i2c_client *i2c,
1321 const struct i2c_device_id *id) 1357 const struct i2c_device_id *id)
1322{ 1358{
1323 struct wm9081_priv *wm9081; 1359 struct wm9081_priv *wm9081;
1360 unsigned int reg;
1324 int ret; 1361 int ret;
1325 1362
1326 wm9081 = kzalloc(sizeof(struct wm9081_priv), GFP_KERNEL); 1363 wm9081 = devm_kzalloc(&i2c->dev, sizeof(struct wm9081_priv),
1364 GFP_KERNEL);
1327 if (wm9081 == NULL) 1365 if (wm9081 == NULL)
1328 return -ENOMEM; 1366 return -ENOMEM;
1329 1367
1330 i2c_set_clientdata(i2c, wm9081); 1368 i2c_set_clientdata(i2c, wm9081);
1331 wm9081->control_type = SND_SOC_I2C; 1369
1370 wm9081->regmap = regmap_init_i2c(i2c, &wm9081_regmap);
1371 if (IS_ERR(wm9081->regmap)) {
1372 ret = PTR_ERR(wm9081->regmap);
1373 dev_err(&i2c->dev, "regmap_init() failed: %d\n", ret);
1374 goto err;
1375 }
1376
1377 ret = regmap_read(wm9081->regmap, WM9081_SOFTWARE_RESET, &reg);
1378 if (ret != 0) {
1379 dev_err(&i2c->dev, "Failed to read chip ID: %d\n", ret);
1380 goto err_regmap;
1381 }
1382 if (reg != 0x9081) {
1383 dev_err(&i2c->dev, "Device is not a WM9081: ID=0x%x\n", reg);
1384 ret = -EINVAL;
1385 goto err_regmap;
1386 }
1387
1388 ret = wm9081_reset(wm9081->regmap);
1389 if (ret < 0) {
1390 dev_err(&i2c->dev, "Failed to issue reset\n");
1391 goto err_regmap;
1392 }
1332 1393
1333 if (dev_get_platdata(&i2c->dev)) 1394 if (dev_get_platdata(&i2c->dev))
1334 memcpy(&wm9081->pdata, dev_get_platdata(&i2c->dev), 1395 memcpy(&wm9081->pdata, dev_get_platdata(&i2c->dev),
@@ -1337,14 +1398,23 @@ static __devinit int wm9081_i2c_probe(struct i2c_client *i2c,
1337 ret = snd_soc_register_codec(&i2c->dev, 1398 ret = snd_soc_register_codec(&i2c->dev,
1338 &soc_codec_dev_wm9081, &wm9081_dai, 1); 1399 &soc_codec_dev_wm9081, &wm9081_dai, 1);
1339 if (ret < 0) 1400 if (ret < 0)
1340 kfree(wm9081); 1401 goto err_regmap;
1402
1403 return 0;
1404
1405err_regmap:
1406 regmap_exit(wm9081->regmap);
1407err:
1408
1341 return ret; 1409 return ret;
1342} 1410}
1343 1411
1344static __devexit int wm9081_i2c_remove(struct i2c_client *client) 1412static __devexit int wm9081_i2c_remove(struct i2c_client *client)
1345{ 1413{
1414 struct wm9081_priv *wm9081 = i2c_get_clientdata(client);
1415
1346 snd_soc_unregister_codec(&client->dev); 1416 snd_soc_unregister_codec(&client->dev);
1347 kfree(i2c_get_clientdata(client)); 1417 regmap_exit(wm9081->regmap);
1348 return 0; 1418 return 0;
1349} 1419}
1350 1420
diff --git a/sound/soc/codecs/wm9090.c b/sound/soc/codecs/wm9090.c
index f94c06057c6..41ebe0dce77 100644
--- a/sound/soc/codecs/wm9090.c
+++ b/sound/soc/codecs/wm9090.c
@@ -513,18 +513,7 @@ static int wm9090_set_bias_level(struct snd_soc_codec *codec,
513 case SND_SOC_BIAS_STANDBY: 513 case SND_SOC_BIAS_STANDBY:
514 if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) { 514 if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) {
515 /* Restore the register cache */ 515 /* Restore the register cache */
516 for (i = 1; i < codec->driver->reg_cache_size; i++) { 516 snd_soc_cache_sync(codec);
517 if (reg_cache[i] == wm9090_reg_defaults[i])
518 continue;
519 if (wm9090_volatile(codec, i))
520 continue;
521
522 ret = snd_soc_write(codec, i, reg_cache[i]);
523 if (ret != 0)
524 dev_warn(codec->dev,
525 "Failed to restore register %d: %d\n",
526 i, ret);
527 }
528 } 517 }
529 518
530 /* We keep VMID off during standby since the combination of 519 /* We keep VMID off during standby since the combination of
@@ -604,7 +593,7 @@ static int wm9090_probe(struct snd_soc_codec *codec)
604} 593}
605 594
606#ifdef CONFIG_PM 595#ifdef CONFIG_PM
607static int wm9090_suspend(struct snd_soc_codec *codec, pm_message_t state) 596static int wm9090_suspend(struct snd_soc_codec *codec)
608{ 597{
609 wm9090_set_bias_level(codec, SND_SOC_BIAS_OFF); 598 wm9090_set_bias_level(codec, SND_SOC_BIAS_OFF);
610 599
@@ -647,7 +636,7 @@ static int wm9090_i2c_probe(struct i2c_client *i2c,
647 struct wm9090_priv *wm9090; 636 struct wm9090_priv *wm9090;
648 int ret; 637 int ret;
649 638
650 wm9090 = kzalloc(sizeof(*wm9090), GFP_KERNEL); 639 wm9090 = devm_kzalloc(&i2c->dev, sizeof(*wm9090), GFP_KERNEL);
651 if (wm9090 == NULL) { 640 if (wm9090 == NULL) {
652 dev_err(&i2c->dev, "Can not allocate memory\n"); 641 dev_err(&i2c->dev, "Can not allocate memory\n");
653 return -ENOMEM; 642 return -ENOMEM;
@@ -661,8 +650,6 @@ static int wm9090_i2c_probe(struct i2c_client *i2c,
661 650
662 ret = snd_soc_register_codec(&i2c->dev, 651 ret = snd_soc_register_codec(&i2c->dev,
663 &soc_codec_dev_wm9090, NULL, 0); 652 &soc_codec_dev_wm9090, NULL, 0);
664 if (ret < 0)
665 kfree(wm9090);
666 return ret; 653 return ret;
667} 654}
668 655
@@ -671,7 +658,6 @@ static int __devexit wm9090_i2c_remove(struct i2c_client *i2c)
671 struct wm9090_priv *wm9090 = i2c_get_clientdata(i2c); 658 struct wm9090_priv *wm9090 = i2c_get_clientdata(i2c);
672 659
673 snd_soc_unregister_codec(&i2c->dev); 660 snd_soc_unregister_codec(&i2c->dev);
674 kfree(wm9090);
675 661
676 return 0; 662 return 0;
677} 663}
@@ -685,7 +671,7 @@ MODULE_DEVICE_TABLE(i2c, wm9090_id);
685 671
686static struct i2c_driver wm9090_i2c_driver = { 672static struct i2c_driver wm9090_i2c_driver = {
687 .driver = { 673 .driver = {
688 .name = "wm9090-codec", 674 .name = "wm9090",
689 .owner = THIS_MODULE, 675 .owner = THIS_MODULE,
690 }, 676 },
691 .probe = wm9090_i2c_probe, 677 .probe = wm9090_i2c_probe,
diff --git a/sound/soc/codecs/wm9705.c b/sound/soc/codecs/wm9705.c
index 646b58dda84..40c92ead85a 100644
--- a/sound/soc/codecs/wm9705.c
+++ b/sound/soc/codecs/wm9705.c
@@ -258,7 +258,7 @@ static int ac97_prepare(struct snd_pcm_substream *substream,
258 SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | \ 258 SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | \
259 SNDRV_PCM_RATE_48000) 259 SNDRV_PCM_RATE_48000)
260 260
261static struct snd_soc_dai_ops wm9705_dai_ops = { 261static const struct snd_soc_dai_ops wm9705_dai_ops = {
262 .prepare = ac97_prepare, 262 .prepare = ac97_prepare,
263}; 263};
264 264
@@ -306,7 +306,7 @@ static int wm9705_reset(struct snd_soc_codec *codec)
306} 306}
307 307
308#ifdef CONFIG_PM 308#ifdef CONFIG_PM
309static int wm9705_soc_suspend(struct snd_soc_codec *codec, pm_message_t msg) 309static int wm9705_soc_suspend(struct snd_soc_codec *codec)
310{ 310{
311 soc_ac97_ops.write(codec->ac97, AC97_POWERDOWN, 0xffff); 311 soc_ac97_ops.write(codec->ac97, AC97_POWERDOWN, 0xffff);
312 312
@@ -406,17 +406,7 @@ static struct platform_driver wm9705_codec_driver = {
406 .remove = __devexit_p(wm9705_remove), 406 .remove = __devexit_p(wm9705_remove),
407}; 407};
408 408
409static int __init wm9705_init(void) 409module_platform_driver(wm9705_codec_driver);
410{
411 return platform_driver_register(&wm9705_codec_driver);
412}
413module_init(wm9705_init);
414
415static void __exit wm9705_exit(void)
416{
417 platform_driver_unregister(&wm9705_codec_driver);
418}
419module_exit(wm9705_exit);
420 410
421MODULE_DESCRIPTION("ASoC WM9705 driver"); 411MODULE_DESCRIPTION("ASoC WM9705 driver");
422MODULE_AUTHOR("Ian Molton"); 412MODULE_AUTHOR("Ian Molton");
diff --git a/sound/soc/codecs/wm9712.c b/sound/soc/codecs/wm9712.c
index 90117f8156e..b7b31f84c10 100644
--- a/sound/soc/codecs/wm9712.c
+++ b/sound/soc/codecs/wm9712.c
@@ -505,11 +505,11 @@ static int ac97_aux_prepare(struct snd_pcm_substream *substream,
505 SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_44100 |\ 505 SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_44100 |\
506 SNDRV_PCM_RATE_48000) 506 SNDRV_PCM_RATE_48000)
507 507
508static struct snd_soc_dai_ops wm9712_dai_ops_hifi = { 508static const struct snd_soc_dai_ops wm9712_dai_ops_hifi = {
509 .prepare = ac97_prepare, 509 .prepare = ac97_prepare,
510}; 510};
511 511
512static struct snd_soc_dai_ops wm9712_dai_ops_aux = { 512static const struct snd_soc_dai_ops wm9712_dai_ops_aux = {
513 .prepare = ac97_aux_prepare, 513 .prepare = ac97_aux_prepare,
514}; 514};
515 515
@@ -583,8 +583,7 @@ err:
583 return -EIO; 583 return -EIO;
584} 584}
585 585
586static int wm9712_soc_suspend(struct snd_soc_codec *codec, 586static int wm9712_soc_suspend(struct snd_soc_codec *codec)
587 pm_message_t state)
588{ 587{
589 wm9712_set_bias_level(codec, SND_SOC_BIAS_OFF); 588 wm9712_set_bias_level(codec, SND_SOC_BIAS_OFF);
590 return 0; 589 return 0;
@@ -694,17 +693,7 @@ static struct platform_driver wm9712_codec_driver = {
694 .remove = __devexit_p(wm9712_remove), 693 .remove = __devexit_p(wm9712_remove),
695}; 694};
696 695
697static int __init wm9712_init(void) 696module_platform_driver(wm9712_codec_driver);
698{
699 return platform_driver_register(&wm9712_codec_driver);
700}
701module_init(wm9712_init);
702
703static void __exit wm9712_exit(void)
704{
705 platform_driver_unregister(&wm9712_codec_driver);
706}
707module_exit(wm9712_exit);
708 697
709MODULE_DESCRIPTION("ASoC WM9711/WM9712 driver"); 698MODULE_DESCRIPTION("ASoC WM9711/WM9712 driver");
710MODULE_AUTHOR("Liam Girdwood"); 699MODULE_AUTHOR("Liam Girdwood");
diff --git a/sound/soc/codecs/wm9713.c b/sound/soc/codecs/wm9713.c
index 7167cb6787d..2b8479bfcd9 100644
--- a/sound/soc/codecs/wm9713.c
+++ b/sound/soc/codecs/wm9713.c
@@ -1026,19 +1026,19 @@ static int ac97_aux_prepare(struct snd_pcm_substream *substream,
1026 (SNDRV_PCM_FORMAT_S16_LE | SNDRV_PCM_FORMAT_S20_3LE | \ 1026 (SNDRV_PCM_FORMAT_S16_LE | SNDRV_PCM_FORMAT_S20_3LE | \
1027 SNDRV_PCM_FORMAT_S24_LE) 1027 SNDRV_PCM_FORMAT_S24_LE)
1028 1028
1029static struct snd_soc_dai_ops wm9713_dai_ops_hifi = { 1029static const struct snd_soc_dai_ops wm9713_dai_ops_hifi = {
1030 .prepare = ac97_hifi_prepare, 1030 .prepare = ac97_hifi_prepare,
1031 .set_clkdiv = wm9713_set_dai_clkdiv, 1031 .set_clkdiv = wm9713_set_dai_clkdiv,
1032 .set_pll = wm9713_set_dai_pll, 1032 .set_pll = wm9713_set_dai_pll,
1033}; 1033};
1034 1034
1035static struct snd_soc_dai_ops wm9713_dai_ops_aux = { 1035static const struct snd_soc_dai_ops wm9713_dai_ops_aux = {
1036 .prepare = ac97_aux_prepare, 1036 .prepare = ac97_aux_prepare,
1037 .set_clkdiv = wm9713_set_dai_clkdiv, 1037 .set_clkdiv = wm9713_set_dai_clkdiv,
1038 .set_pll = wm9713_set_dai_pll, 1038 .set_pll = wm9713_set_dai_pll,
1039}; 1039};
1040 1040
1041static struct snd_soc_dai_ops wm9713_dai_ops_voice = { 1041static const struct snd_soc_dai_ops wm9713_dai_ops_voice = {
1042 .hw_params = wm9713_pcm_hw_params, 1042 .hw_params = wm9713_pcm_hw_params,
1043 .set_clkdiv = wm9713_set_dai_clkdiv, 1043 .set_clkdiv = wm9713_set_dai_clkdiv,
1044 .set_pll = wm9713_set_dai_pll, 1044 .set_pll = wm9713_set_dai_pll,
@@ -1140,8 +1140,7 @@ static int wm9713_set_bias_level(struct snd_soc_codec *codec,
1140 return 0; 1140 return 0;
1141} 1141}
1142 1142
1143static int wm9713_soc_suspend(struct snd_soc_codec *codec, 1143static int wm9713_soc_suspend(struct snd_soc_codec *codec)
1144 pm_message_t state)
1145{ 1144{
1146 u16 reg; 1145 u16 reg;
1147 1146
@@ -1277,17 +1276,7 @@ static struct platform_driver wm9713_codec_driver = {
1277 .remove = __devexit_p(wm9713_remove), 1276 .remove = __devexit_p(wm9713_remove),
1278}; 1277};
1279 1278
1280static int __init wm9713_init(void) 1279module_platform_driver(wm9713_codec_driver);
1281{
1282 return platform_driver_register(&wm9713_codec_driver);
1283}
1284module_init(wm9713_init);
1285
1286static void __exit wm9713_exit(void)
1287{
1288 platform_driver_unregister(&wm9713_codec_driver);
1289}
1290module_exit(wm9713_exit);
1291 1280
1292MODULE_DESCRIPTION("ASoC WM9713/WM9714 driver"); 1281MODULE_DESCRIPTION("ASoC WM9713/WM9714 driver");
1293MODULE_AUTHOR("Liam Girdwood"); 1282MODULE_AUTHOR("Liam Girdwood");
diff --git a/sound/soc/codecs/wm_hubs.c b/sound/soc/codecs/wm_hubs.c
index 48e61e91240..2a61094075f 100644
--- a/sound/soc/codecs/wm_hubs.c
+++ b/sound/soc/codecs/wm_hubs.c
@@ -17,7 +17,6 @@
17#include <linux/delay.h> 17#include <linux/delay.h>
18#include <linux/pm.h> 18#include <linux/pm.h>
19#include <linux/i2c.h> 19#include <linux/i2c.h>
20#include <linux/platform_device.h>
21#include <linux/mfd/wm8994/registers.h> 20#include <linux/mfd/wm8994/registers.h>
22#include <sound/core.h> 21#include <sound/core.h>
23#include <sound/pcm.h> 22#include <sound/pcm.h>
@@ -611,8 +610,8 @@ SND_SOC_DAPM_INPUT("IN1RP"),
611SND_SOC_DAPM_INPUT("IN2RN"), 610SND_SOC_DAPM_INPUT("IN2RN"),
612SND_SOC_DAPM_INPUT("IN2RP:VXRP"), 611SND_SOC_DAPM_INPUT("IN2RP:VXRP"),
613 612
614SND_SOC_DAPM_MICBIAS("MICBIAS2", WM8993_POWER_MANAGEMENT_1, 5, 0), 613SND_SOC_DAPM_SUPPLY("MICBIAS2", WM8993_POWER_MANAGEMENT_1, 5, 0, NULL, 0),
615SND_SOC_DAPM_MICBIAS("MICBIAS1", WM8993_POWER_MANAGEMENT_1, 4, 0), 614SND_SOC_DAPM_SUPPLY("MICBIAS1", WM8993_POWER_MANAGEMENT_1, 4, 0, NULL, 0),
616 615
617SND_SOC_DAPM_MIXER("IN1L PGA", WM8993_POWER_MANAGEMENT_2, 6, 0, 616SND_SOC_DAPM_MIXER("IN1L PGA", WM8993_POWER_MANAGEMENT_2, 6, 0,
618 in1l_pga, ARRAY_SIZE(in1l_pga)), 617 in1l_pga, ARRAY_SIZE(in1l_pga)),
@@ -654,6 +653,7 @@ SND_SOC_DAPM_MIXER("SPKL Boost", SND_SOC_NOPM, 0, 0,
654SND_SOC_DAPM_MIXER("SPKR Boost", SND_SOC_NOPM, 0, 0, 653SND_SOC_DAPM_MIXER("SPKR Boost", SND_SOC_NOPM, 0, 0,
655 right_speaker_boost, ARRAY_SIZE(right_speaker_boost)), 654 right_speaker_boost, ARRAY_SIZE(right_speaker_boost)),
656 655
656SND_SOC_DAPM_SUPPLY("TSHUT", WM8993_POWER_MANAGEMENT_2, 14, 0, NULL, 0),
657SND_SOC_DAPM_PGA("SPKL Driver", WM8993_POWER_MANAGEMENT_1, 12, 0, 657SND_SOC_DAPM_PGA("SPKL Driver", WM8993_POWER_MANAGEMENT_1, 12, 0,
658 NULL, 0), 658 NULL, 0),
659SND_SOC_DAPM_PGA("SPKR Driver", WM8993_POWER_MANAGEMENT_1, 13, 0, 659SND_SOC_DAPM_PGA("SPKR Driver", WM8993_POWER_MANAGEMENT_1, 13, 0,
@@ -789,10 +789,12 @@ static const struct snd_soc_dapm_route analogue_routes[] = {
789 { "SPKL Driver", NULL, "VMID" }, 789 { "SPKL Driver", NULL, "VMID" },
790 { "SPKL Driver", NULL, "SPKL Boost" }, 790 { "SPKL Driver", NULL, "SPKL Boost" },
791 { "SPKL Driver", NULL, "CLK_SYS" }, 791 { "SPKL Driver", NULL, "CLK_SYS" },
792 { "SPKL Driver", NULL, "TSHUT" },
792 793
793 { "SPKR Driver", NULL, "VMID" }, 794 { "SPKR Driver", NULL, "VMID" },
794 { "SPKR Driver", NULL, "SPKR Boost" }, 795 { "SPKR Driver", NULL, "SPKR Boost" },
795 { "SPKR Driver", NULL, "CLK_SYS" }, 796 { "SPKR Driver", NULL, "CLK_SYS" },
797 { "SPKR Driver", NULL, "TSHUT" },
796 798
797 { "SPKOUTLP", NULL, "SPKL Driver" }, 799 { "SPKOUTLP", NULL, "SPKL Driver" },
798 { "SPKOUTLN", NULL, "SPKL Driver" }, 800 { "SPKOUTLN", NULL, "SPKL Driver" },
diff --git a/sound/soc/davinci/davinci-evm.c b/sound/soc/davinci/davinci-evm.c
index f78c3f0f280..10a2d8c788b 100644
--- a/sound/soc/davinci/davinci-evm.c
+++ b/sound/soc/davinci/davinci-evm.c
@@ -242,6 +242,7 @@ static struct snd_soc_dai_link da850_evm_dai = {
242/* davinci dm6446 evm audio machine driver */ 242/* davinci dm6446 evm audio machine driver */
243static struct snd_soc_card dm6446_snd_soc_card_evm = { 243static struct snd_soc_card dm6446_snd_soc_card_evm = {
244 .name = "DaVinci DM6446 EVM", 244 .name = "DaVinci DM6446 EVM",
245 .owner = THIS_MODULE,
245 .dai_link = &dm6446_evm_dai, 246 .dai_link = &dm6446_evm_dai,
246 .num_links = 1, 247 .num_links = 1,
247}; 248};
@@ -249,6 +250,7 @@ static struct snd_soc_card dm6446_snd_soc_card_evm = {
249/* davinci dm355 evm audio machine driver */ 250/* davinci dm355 evm audio machine driver */
250static struct snd_soc_card dm355_snd_soc_card_evm = { 251static struct snd_soc_card dm355_snd_soc_card_evm = {
251 .name = "DaVinci DM355 EVM", 252 .name = "DaVinci DM355 EVM",
253 .owner = THIS_MODULE,
252 .dai_link = &dm355_evm_dai, 254 .dai_link = &dm355_evm_dai,
253 .num_links = 1, 255 .num_links = 1,
254}; 256};
@@ -256,6 +258,7 @@ static struct snd_soc_card dm355_snd_soc_card_evm = {
256/* davinci dm365 evm audio machine driver */ 258/* davinci dm365 evm audio machine driver */
257static struct snd_soc_card dm365_snd_soc_card_evm = { 259static struct snd_soc_card dm365_snd_soc_card_evm = {
258 .name = "DaVinci DM365 EVM", 260 .name = "DaVinci DM365 EVM",
261 .owner = THIS_MODULE,
259 .dai_link = &dm365_evm_dai, 262 .dai_link = &dm365_evm_dai,
260 .num_links = 1, 263 .num_links = 1,
261}; 264};
@@ -263,18 +266,21 @@ static struct snd_soc_card dm365_snd_soc_card_evm = {
263/* davinci dm6467 evm audio machine driver */ 266/* davinci dm6467 evm audio machine driver */
264static struct snd_soc_card dm6467_snd_soc_card_evm = { 267static struct snd_soc_card dm6467_snd_soc_card_evm = {
265 .name = "DaVinci DM6467 EVM", 268 .name = "DaVinci DM6467 EVM",
269 .owner = THIS_MODULE,
266 .dai_link = dm6467_evm_dai, 270 .dai_link = dm6467_evm_dai,
267 .num_links = ARRAY_SIZE(dm6467_evm_dai), 271 .num_links = ARRAY_SIZE(dm6467_evm_dai),
268}; 272};
269 273
270static struct snd_soc_card da830_snd_soc_card = { 274static struct snd_soc_card da830_snd_soc_card = {
271 .name = "DA830/OMAP-L137 EVM", 275 .name = "DA830/OMAP-L137 EVM",
276 .owner = THIS_MODULE,
272 .dai_link = &da830_evm_dai, 277 .dai_link = &da830_evm_dai,
273 .num_links = 1, 278 .num_links = 1,
274}; 279};
275 280
276static struct snd_soc_card da850_snd_soc_card = { 281static struct snd_soc_card da850_snd_soc_card = {
277 .name = "DA850/OMAP-L138 EVM", 282 .name = "DA850/OMAP-L138 EVM",
283 .owner = THIS_MODULE,
278 .dai_link = &da850_evm_dai, 284 .dai_link = &da850_evm_dai,
279 .num_links = 1, 285 .num_links = 1,
280}; 286};
diff --git a/sound/soc/davinci/davinci-i2s.c b/sound/soc/davinci/davinci-i2s.c
index 300e12118c0..0a74b9587a2 100644
--- a/sound/soc/davinci/davinci-i2s.c
+++ b/sound/soc/davinci/davinci-i2s.c
@@ -620,7 +620,7 @@ static void davinci_i2s_shutdown(struct snd_pcm_substream *substream,
620 620
621#define DAVINCI_I2S_RATES SNDRV_PCM_RATE_8000_96000 621#define DAVINCI_I2S_RATES SNDRV_PCM_RATE_8000_96000
622 622
623static struct snd_soc_dai_ops davinci_i2s_dai_ops = { 623static const struct snd_soc_dai_ops davinci_i2s_dai_ops = {
624 .startup = davinci_i2s_startup, 624 .startup = davinci_i2s_startup,
625 .shutdown = davinci_i2s_shutdown, 625 .shutdown = davinci_i2s_shutdown,
626 .prepare = davinci_i2s_prepare, 626 .prepare = davinci_i2s_prepare,
@@ -661,18 +661,18 @@ static int davinci_i2s_probe(struct platform_device *pdev)
661 return -ENODEV; 661 return -ENODEV;
662 } 662 }
663 663
664 ioarea = request_mem_region(mem->start, resource_size(mem), 664 ioarea = devm_request_mem_region(&pdev->dev, mem->start,
665 pdev->name); 665 resource_size(mem),
666 pdev->name);
666 if (!ioarea) { 667 if (!ioarea) {
667 dev_err(&pdev->dev, "McBSP region already claimed\n"); 668 dev_err(&pdev->dev, "McBSP region already claimed\n");
668 return -EBUSY; 669 return -EBUSY;
669 } 670 }
670 671
671 dev = kzalloc(sizeof(struct davinci_mcbsp_dev), GFP_KERNEL); 672 dev = devm_kzalloc(&pdev->dev, sizeof(struct davinci_mcbsp_dev),
672 if (!dev) { 673 GFP_KERNEL);
673 ret = -ENOMEM; 674 if (!dev)
674 goto err_release_region; 675 return -ENOMEM;
675 }
676 if (pdata) { 676 if (pdata) {
677 dev->enable_channel_combine = pdata->enable_channel_combine; 677 dev->enable_channel_combine = pdata->enable_channel_combine;
678 dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK].sram_size = 678 dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK].sram_size =
@@ -691,13 +691,11 @@ static int davinci_i2s_probe(struct platform_device *pdev)
691 dev->dma_params[SNDRV_PCM_STREAM_CAPTURE].ram_chan_q = ram_chan_q; 691 dev->dma_params[SNDRV_PCM_STREAM_CAPTURE].ram_chan_q = ram_chan_q;
692 692
693 dev->clk = clk_get(&pdev->dev, NULL); 693 dev->clk = clk_get(&pdev->dev, NULL);
694 if (IS_ERR(dev->clk)) { 694 if (IS_ERR(dev->clk))
695 ret = -ENODEV; 695 return -ENODEV;
696 goto err_free_mem;
697 }
698 clk_enable(dev->clk); 696 clk_enable(dev->clk);
699 697
700 dev->base = ioremap(mem->start, resource_size(mem)); 698 dev->base = devm_ioremap(&pdev->dev, mem->start, resource_size(mem));
701 if (!dev->base) { 699 if (!dev->base) {
702 dev_err(&pdev->dev, "ioremap failed\n"); 700 dev_err(&pdev->dev, "ioremap failed\n");
703 ret = -ENOMEM; 701 ret = -ENOMEM;
@@ -715,7 +713,7 @@ static int davinci_i2s_probe(struct platform_device *pdev)
715 if (!res) { 713 if (!res) {
716 dev_err(&pdev->dev, "no DMA resource\n"); 714 dev_err(&pdev->dev, "no DMA resource\n");
717 ret = -ENXIO; 715 ret = -ENXIO;
718 goto err_iounmap; 716 goto err_release_clk;
719 } 717 }
720 dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK].channel = res->start; 718 dev->dma_params[SNDRV_PCM_STREAM_PLAYBACK].channel = res->start;
721 719
@@ -723,7 +721,7 @@ static int davinci_i2s_probe(struct platform_device *pdev)
723 if (!res) { 721 if (!res) {
724 dev_err(&pdev->dev, "no DMA resource\n"); 722 dev_err(&pdev->dev, "no DMA resource\n");
725 ret = -ENXIO; 723 ret = -ENXIO;
726 goto err_iounmap; 724 goto err_release_clk;
727 } 725 }
728 dev->dma_params[SNDRV_PCM_STREAM_CAPTURE].channel = res->start; 726 dev->dma_params[SNDRV_PCM_STREAM_CAPTURE].channel = res->start;
729 dev->dev = &pdev->dev; 727 dev->dev = &pdev->dev;
@@ -732,35 +730,24 @@ static int davinci_i2s_probe(struct platform_device *pdev)
732 730
733 ret = snd_soc_register_dai(&pdev->dev, &davinci_i2s_dai); 731 ret = snd_soc_register_dai(&pdev->dev, &davinci_i2s_dai);
734 if (ret != 0) 732 if (ret != 0)
735 goto err_iounmap; 733 goto err_release_clk;
736 734
737 return 0; 735 return 0;
738 736
739err_iounmap:
740 iounmap(dev->base);
741err_release_clk: 737err_release_clk:
742 clk_disable(dev->clk); 738 clk_disable(dev->clk);
743 clk_put(dev->clk); 739 clk_put(dev->clk);
744err_free_mem:
745 kfree(dev);
746err_release_region:
747 release_mem_region(mem->start, resource_size(mem));
748
749 return ret; 740 return ret;
750} 741}
751 742
752static int davinci_i2s_remove(struct platform_device *pdev) 743static int davinci_i2s_remove(struct platform_device *pdev)
753{ 744{
754 struct davinci_mcbsp_dev *dev = dev_get_drvdata(&pdev->dev); 745 struct davinci_mcbsp_dev *dev = dev_get_drvdata(&pdev->dev);
755 struct resource *mem;
756 746
757 snd_soc_unregister_dai(&pdev->dev); 747 snd_soc_unregister_dai(&pdev->dev);
758 clk_disable(dev->clk); 748 clk_disable(dev->clk);
759 clk_put(dev->clk); 749 clk_put(dev->clk);
760 dev->clk = NULL; 750 dev->clk = NULL;
761 kfree(dev);
762 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
763 release_mem_region(mem->start, resource_size(mem));
764 751
765 return 0; 752 return 0;
766} 753}
@@ -774,17 +761,7 @@ static struct platform_driver davinci_mcbsp_driver = {
774 }, 761 },
775}; 762};
776 763
777static int __init davinci_i2s_init(void) 764module_platform_driver(davinci_mcbsp_driver);
778{
779 return platform_driver_register(&davinci_mcbsp_driver);
780}
781module_init(davinci_i2s_init);
782
783static void __exit davinci_i2s_exit(void)
784{
785 platform_driver_unregister(&davinci_mcbsp_driver);
786}
787module_exit(davinci_i2s_exit);
788 765
789MODULE_AUTHOR("Vladimir Barinov"); 766MODULE_AUTHOR("Vladimir Barinov");
790MODULE_DESCRIPTION("TI DAVINCI I2S (McBSP) SoC Interface"); 767MODULE_DESCRIPTION("TI DAVINCI I2S (McBSP) SoC Interface");
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c
index 7173df254a9..95441bfc819 100644
--- a/sound/soc/davinci/davinci-mcasp.c
+++ b/sound/soc/davinci/davinci-mcasp.c
@@ -813,7 +813,7 @@ static int davinci_mcasp_startup(struct snd_pcm_substream *substream,
813 return 0; 813 return 0;
814} 814}
815 815
816static struct snd_soc_dai_ops davinci_mcasp_dai_ops = { 816static const struct snd_soc_dai_ops davinci_mcasp_dai_ops = {
817 .startup = davinci_mcasp_startup, 817 .startup = davinci_mcasp_startup,
818 .trigger = davinci_mcasp_trigger, 818 .trigger = davinci_mcasp_trigger,
819 .hw_params = davinci_mcasp_hw_params, 819 .hw_params = davinci_mcasp_hw_params,
@@ -865,38 +865,35 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
865 struct resource *mem, *ioarea, *res; 865 struct resource *mem, *ioarea, *res;
866 struct snd_platform_data *pdata; 866 struct snd_platform_data *pdata;
867 struct davinci_audio_dev *dev; 867 struct davinci_audio_dev *dev;
868 int ret = 0; 868 int ret;
869 869
870 dev = kzalloc(sizeof(struct davinci_audio_dev), GFP_KERNEL); 870 dev = devm_kzalloc(&pdev->dev, sizeof(struct davinci_audio_dev),
871 GFP_KERNEL);
871 if (!dev) 872 if (!dev)
872 return -ENOMEM; 873 return -ENOMEM;
873 874
874 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); 875 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
875 if (!mem) { 876 if (!mem) {
876 dev_err(&pdev->dev, "no mem resource?\n"); 877 dev_err(&pdev->dev, "no mem resource?\n");
877 ret = -ENODEV; 878 return -ENODEV;
878 goto err_release_data;
879 } 879 }
880 880
881 ioarea = request_mem_region(mem->start, 881 ioarea = devm_request_mem_region(&pdev->dev, mem->start,
882 resource_size(mem), pdev->name); 882 resource_size(mem), pdev->name);
883 if (!ioarea) { 883 if (!ioarea) {
884 dev_err(&pdev->dev, "Audio region already claimed\n"); 884 dev_err(&pdev->dev, "Audio region already claimed\n");
885 ret = -EBUSY; 885 return -EBUSY;
886 goto err_release_data;
887 } 886 }
888 887
889 pdata = pdev->dev.platform_data; 888 pdata = pdev->dev.platform_data;
890 dev->clk = clk_get(&pdev->dev, NULL); 889 dev->clk = clk_get(&pdev->dev, NULL);
891 if (IS_ERR(dev->clk)) { 890 if (IS_ERR(dev->clk))
892 ret = -ENODEV; 891 return -ENODEV;
893 goto err_release_region;
894 }
895 892
896 clk_enable(dev->clk); 893 clk_enable(dev->clk);
897 dev->clk_active = 1; 894 dev->clk_active = 1;
898 895
899 dev->base = ioremap(mem->start, resource_size(mem)); 896 dev->base = devm_ioremap(&pdev->dev, mem->start, resource_size(mem));
900 if (!dev->base) { 897 if (!dev->base) {
901 dev_err(&pdev->dev, "ioremap failed\n"); 898 dev_err(&pdev->dev, "ioremap failed\n");
902 ret = -ENOMEM; 899 ret = -ENOMEM;
@@ -924,7 +921,7 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
924 if (!res) { 921 if (!res) {
925 dev_err(&pdev->dev, "no DMA resource\n"); 922 dev_err(&pdev->dev, "no DMA resource\n");
926 ret = -ENODEV; 923 ret = -ENODEV;
927 goto err_iounmap; 924 goto err_release_clk;
928 } 925 }
929 926
930 dma_data->channel = res->start; 927 dma_data->channel = res->start;
@@ -940,7 +937,7 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
940 if (!res) { 937 if (!res) {
941 dev_err(&pdev->dev, "no DMA resource\n"); 938 dev_err(&pdev->dev, "no DMA resource\n");
942 ret = -ENODEV; 939 ret = -ENODEV;
943 goto err_iounmap; 940 goto err_release_clk;
944 } 941 }
945 942
946 dma_data->channel = res->start; 943 dma_data->channel = res->start;
@@ -948,37 +945,24 @@ static int davinci_mcasp_probe(struct platform_device *pdev)
948 ret = snd_soc_register_dai(&pdev->dev, &davinci_mcasp_dai[pdata->op_mode]); 945 ret = snd_soc_register_dai(&pdev->dev, &davinci_mcasp_dai[pdata->op_mode]);
949 946
950 if (ret != 0) 947 if (ret != 0)
951 goto err_iounmap; 948 goto err_release_clk;
952 return 0; 949 return 0;
953 950
954err_iounmap:
955 iounmap(dev->base);
956err_release_clk: 951err_release_clk:
957 clk_disable(dev->clk); 952 clk_disable(dev->clk);
958 clk_put(dev->clk); 953 clk_put(dev->clk);
959err_release_region:
960 release_mem_region(mem->start, resource_size(mem));
961err_release_data:
962 kfree(dev);
963
964 return ret; 954 return ret;
965} 955}
966 956
967static int davinci_mcasp_remove(struct platform_device *pdev) 957static int davinci_mcasp_remove(struct platform_device *pdev)
968{ 958{
969 struct davinci_audio_dev *dev = dev_get_drvdata(&pdev->dev); 959 struct davinci_audio_dev *dev = dev_get_drvdata(&pdev->dev);
970 struct resource *mem;
971 960
972 snd_soc_unregister_dai(&pdev->dev); 961 snd_soc_unregister_dai(&pdev->dev);
973 clk_disable(dev->clk); 962 clk_disable(dev->clk);
974 clk_put(dev->clk); 963 clk_put(dev->clk);
975 dev->clk = NULL; 964 dev->clk = NULL;
976 965
977 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
978 release_mem_region(mem->start, resource_size(mem));
979
980 kfree(dev);
981
982 return 0; 966 return 0;
983} 967}
984 968
@@ -991,17 +975,7 @@ static struct platform_driver davinci_mcasp_driver = {
991 }, 975 },
992}; 976};
993 977
994static int __init davinci_mcasp_init(void) 978module_platform_driver(davinci_mcasp_driver);
995{
996 return platform_driver_register(&davinci_mcasp_driver);
997}
998module_init(davinci_mcasp_init);
999
1000static void __exit davinci_mcasp_exit(void)
1001{
1002 platform_driver_unregister(&davinci_mcasp_driver);
1003}
1004module_exit(davinci_mcasp_exit);
1005 979
1006MODULE_AUTHOR("Steve Chen"); 980MODULE_AUTHOR("Steve Chen");
1007MODULE_DESCRIPTION("TI DAVINCI McASP SoC Interface"); 981MODULE_DESCRIPTION("TI DAVINCI McASP SoC Interface");
diff --git a/sound/soc/davinci/davinci-pcm.c b/sound/soc/davinci/davinci-pcm.c
index d5fe08cc5db..b26401f87b8 100644
--- a/sound/soc/davinci/davinci-pcm.c
+++ b/sound/soc/davinci/davinci-pcm.c
@@ -831,7 +831,6 @@ static u64 davinci_pcm_dmamask = 0xffffffff;
831static int davinci_pcm_new(struct snd_soc_pcm_runtime *rtd) 831static int davinci_pcm_new(struct snd_soc_pcm_runtime *rtd)
832{ 832{
833 struct snd_card *card = rtd->card->snd_card; 833 struct snd_card *card = rtd->card->snd_card;
834 struct snd_soc_dai *dai = rtd->cpu_dai;
835 struct snd_pcm *pcm = rtd->pcm; 834 struct snd_pcm *pcm = rtd->pcm;
836 int ret; 835 int ret;
837 836
@@ -840,7 +839,7 @@ static int davinci_pcm_new(struct snd_soc_pcm_runtime *rtd)
840 if (!card->dev->coherent_dma_mask) 839 if (!card->dev->coherent_dma_mask)
841 card->dev->coherent_dma_mask = 0xffffffff; 840 card->dev->coherent_dma_mask = 0xffffffff;
842 841
843 if (dai->driver->playback.channels_min) { 842 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
844 ret = davinci_pcm_preallocate_dma_buffer(pcm, 843 ret = davinci_pcm_preallocate_dma_buffer(pcm,
845 SNDRV_PCM_STREAM_PLAYBACK, 844 SNDRV_PCM_STREAM_PLAYBACK,
846 pcm_hardware_playback.buffer_bytes_max); 845 pcm_hardware_playback.buffer_bytes_max);
@@ -848,7 +847,7 @@ static int davinci_pcm_new(struct snd_soc_pcm_runtime *rtd)
848 return ret; 847 return ret;
849 } 848 }
850 849
851 if (dai->driver->capture.channels_min) { 850 if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) {
852 ret = davinci_pcm_preallocate_dma_buffer(pcm, 851 ret = davinci_pcm_preallocate_dma_buffer(pcm,
853 SNDRV_PCM_STREAM_CAPTURE, 852 SNDRV_PCM_STREAM_CAPTURE,
854 pcm_hardware_capture.buffer_bytes_max); 853 pcm_hardware_capture.buffer_bytes_max);
@@ -886,17 +885,7 @@ static struct platform_driver davinci_pcm_driver = {
886 .remove = __devexit_p(davinci_soc_platform_remove), 885 .remove = __devexit_p(davinci_soc_platform_remove),
887}; 886};
888 887
889static int __init snd_davinci_pcm_init(void) 888module_platform_driver(davinci_pcm_driver);
890{
891 return platform_driver_register(&davinci_pcm_driver);
892}
893module_init(snd_davinci_pcm_init);
894
895static void __exit snd_davinci_pcm_exit(void)
896{
897 platform_driver_unregister(&davinci_pcm_driver);
898}
899module_exit(snd_davinci_pcm_exit);
900 889
901MODULE_AUTHOR("Vladimir Barinov"); 890MODULE_AUTHOR("Vladimir Barinov");
902MODULE_DESCRIPTION("TI DAVINCI PCM DMA module"); 891MODULE_DESCRIPTION("TI DAVINCI PCM DMA module");
diff --git a/sound/soc/davinci/davinci-sffsdr.c b/sound/soc/davinci/davinci-sffsdr.c
index 0fe558c6514..f71175b29e3 100644
--- a/sound/soc/davinci/davinci-sffsdr.c
+++ b/sound/soc/davinci/davinci-sffsdr.c
@@ -93,6 +93,7 @@ static struct snd_soc_dai_link sffsdr_dai = {
93/* davinci-sffsdr audio machine driver */ 93/* davinci-sffsdr audio machine driver */
94static struct snd_soc_card snd_soc_sffsdr = { 94static struct snd_soc_card snd_soc_sffsdr = {
95 .name = "DaVinci SFFSDR", 95 .name = "DaVinci SFFSDR",
96 .owner = THIS_MODULE,
96 .dai_link = &sffsdr_dai, 97 .dai_link = &sffsdr_dai,
97 .num_links = 1, 98 .num_links = 1,
98}; 99};
diff --git a/sound/soc/davinci/davinci-vcif.c b/sound/soc/davinci/davinci-vcif.c
index 1f11525d97e..da030ff883d 100644
--- a/sound/soc/davinci/davinci-vcif.c
+++ b/sound/soc/davinci/davinci-vcif.c
@@ -183,7 +183,7 @@ static int davinci_vcif_startup(struct snd_pcm_substream *substream,
183 183
184#define DAVINCI_VCIF_RATES SNDRV_PCM_RATE_8000_48000 184#define DAVINCI_VCIF_RATES SNDRV_PCM_RATE_8000_48000
185 185
186static struct snd_soc_dai_ops davinci_vcif_dai_ops = { 186static const struct snd_soc_dai_ops davinci_vcif_dai_ops = {
187 .startup = davinci_vcif_startup, 187 .startup = davinci_vcif_startup,
188 .trigger = davinci_vcif_trigger, 188 .trigger = davinci_vcif_trigger,
189 .hw_params = davinci_vcif_hw_params, 189 .hw_params = davinci_vcif_hw_params,
@@ -210,7 +210,9 @@ static int davinci_vcif_probe(struct platform_device *pdev)
210 struct davinci_vcif_dev *davinci_vcif_dev; 210 struct davinci_vcif_dev *davinci_vcif_dev;
211 int ret; 211 int ret;
212 212
213 davinci_vcif_dev = kzalloc(sizeof(struct davinci_vcif_dev), GFP_KERNEL); 213 davinci_vcif_dev = devm_kzalloc(&pdev->dev,
214 sizeof(struct davinci_vcif_dev),
215 GFP_KERNEL);
214 if (!davinci_vcif_dev) { 216 if (!davinci_vcif_dev) {
215 dev_dbg(&pdev->dev, 217 dev_dbg(&pdev->dev,
216 "could not allocate memory for private data\n"); 218 "could not allocate memory for private data\n");
@@ -235,23 +237,15 @@ static int davinci_vcif_probe(struct platform_device *pdev)
235 ret = snd_soc_register_dai(&pdev->dev, &davinci_vcif_dai); 237 ret = snd_soc_register_dai(&pdev->dev, &davinci_vcif_dai);
236 if (ret != 0) { 238 if (ret != 0) {
237 dev_err(&pdev->dev, "could not register dai\n"); 239 dev_err(&pdev->dev, "could not register dai\n");
238 goto fail; 240 return ret;
239 } 241 }
240 242
241 return 0; 243 return 0;
242
243fail:
244 kfree(davinci_vcif_dev);
245
246 return ret;
247} 244}
248 245
249static int davinci_vcif_remove(struct platform_device *pdev) 246static int davinci_vcif_remove(struct platform_device *pdev)
250{ 247{
251 struct davinci_vcif_dev *davinci_vcif_dev = dev_get_drvdata(&pdev->dev);
252
253 snd_soc_unregister_dai(&pdev->dev); 248 snd_soc_unregister_dai(&pdev->dev);
254 kfree(davinci_vcif_dev);
255 249
256 return 0; 250 return 0;
257} 251}
@@ -265,17 +259,7 @@ static struct platform_driver davinci_vcif_driver = {
265 }, 259 },
266}; 260};
267 261
268static int __init davinci_vcif_init(void) 262module_platform_driver(davinci_vcif_driver);
269{
270 return platform_driver_probe(&davinci_vcif_driver, davinci_vcif_probe);
271}
272module_init(davinci_vcif_init);
273
274static void __exit davinci_vcif_exit(void)
275{
276 platform_driver_unregister(&davinci_vcif_driver);
277}
278module_exit(davinci_vcif_exit);
279 263
280MODULE_AUTHOR("Miguel Aguilar"); 264MODULE_AUTHOR("Miguel Aguilar");
281MODULE_DESCRIPTION("Texas Instruments DaVinci ASoC Voice Codec Interface"); 265MODULE_DESCRIPTION("Texas Instruments DaVinci ASoC Voice Codec Interface");
diff --git a/sound/soc/ep93xx/edb93xx.c b/sound/soc/ep93xx/edb93xx.c
index 51930b6a83a..bae5cbbbd2b 100644
--- a/sound/soc/ep93xx/edb93xx.c
+++ b/sound/soc/ep93xx/edb93xx.c
@@ -48,18 +48,6 @@ static int edb93xx_hw_params(struct snd_pcm_substream *substream,
48 else 48 else
49 mclk_rate = rate * 64 * 2; 49 mclk_rate = rate * 64 * 2;
50 50
51 err = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S |
52 SND_SOC_DAIFMT_NB_IF |
53 SND_SOC_DAIFMT_CBS_CFS);
54 if (err)
55 return err;
56
57 err = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S |
58 SND_SOC_DAIFMT_NB_IF |
59 SND_SOC_DAIFMT_CBS_CFS);
60 if (err)
61 return err;
62
63 err = snd_soc_dai_set_sysclk(codec_dai, 0, mclk_rate, 51 err = snd_soc_dai_set_sysclk(codec_dai, 0, mclk_rate,
64 SND_SOC_CLOCK_IN); 52 SND_SOC_CLOCK_IN);
65 if (err) 53 if (err)
@@ -80,11 +68,14 @@ static struct snd_soc_dai_link edb93xx_dai = {
80 .cpu_dai_name = "ep93xx-i2s", 68 .cpu_dai_name = "ep93xx-i2s",
81 .codec_name = "spi0.0", 69 .codec_name = "spi0.0",
82 .codec_dai_name = "cs4271-hifi", 70 .codec_dai_name = "cs4271-hifi",
71 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_IF |
72 SND_SOC_DAIFMT_CBS_CFS,
83 .ops = &edb93xx_ops, 73 .ops = &edb93xx_ops,
84}; 74};
85 75
86static struct snd_soc_card snd_soc_edb93xx = { 76static struct snd_soc_card snd_soc_edb93xx = {
87 .name = "EDB93XX", 77 .name = "EDB93XX",
78 .owner = THIS_MODULE,
88 .dai_link = &edb93xx_dai, 79 .dai_link = &edb93xx_dai,
89 .num_links = 1, 80 .num_links = 1,
90}; 81};
@@ -131,17 +122,7 @@ static struct platform_driver edb93xx_driver = {
131 .remove = __devexit_p(edb93xx_remove), 122 .remove = __devexit_p(edb93xx_remove),
132}; 123};
133 124
134static int __init edb93xx_init(void) 125module_platform_driver(edb93xx_driver);
135{
136 return platform_driver_register(&edb93xx_driver);
137}
138module_init(edb93xx_init);
139
140static void __exit edb93xx_exit(void)
141{
142 platform_driver_unregister(&edb93xx_driver);
143}
144module_exit(edb93xx_exit);
145 126
146MODULE_AUTHOR("Alexander Sverdlin <subaparts@yandex.ru>"); 127MODULE_AUTHOR("Alexander Sverdlin <subaparts@yandex.ru>");
147MODULE_DESCRIPTION("ALSA SoC EDB93xx"); 128MODULE_DESCRIPTION("ALSA SoC EDB93xx");
diff --git a/sound/soc/ep93xx/ep93xx-ac97.c b/sound/soc/ep93xx/ep93xx-ac97.c
index 3cd6158d83e..0678637abd6 100644
--- a/sound/soc/ep93xx/ep93xx-ac97.c
+++ b/sound/soc/ep93xx/ep93xx-ac97.c
@@ -330,7 +330,7 @@ static int ep93xx_ac97_startup(struct snd_pcm_substream *substream,
330 return 0; 330 return 0;
331} 331}
332 332
333static struct snd_soc_dai_ops ep93xx_ac97_dai_ops = { 333static const struct snd_soc_dai_ops ep93xx_ac97_dai_ops = {
334 .startup = ep93xx_ac97_startup, 334 .startup = ep93xx_ac97_startup,
335 .trigger = ep93xx_ac97_trigger, 335 .trigger = ep93xx_ac97_trigger,
336}; 336};
@@ -449,17 +449,7 @@ static struct platform_driver ep93xx_ac97_driver = {
449 }, 449 },
450}; 450};
451 451
452static int __init ep93xx_ac97_init(void) 452module_platform_driver(ep93xx_ac97_driver);
453{
454 return platform_driver_register(&ep93xx_ac97_driver);
455}
456module_init(ep93xx_ac97_init);
457
458static void __exit ep93xx_ac97_exit(void)
459{
460 platform_driver_unregister(&ep93xx_ac97_driver);
461}
462module_exit(ep93xx_ac97_exit);
463 453
464MODULE_DESCRIPTION("EP93xx AC97 ASoC Driver"); 454MODULE_DESCRIPTION("EP93xx AC97 ASoC Driver");
465MODULE_AUTHOR("Mika Westerberg <mika.westerberg@iki.fi>"); 455MODULE_AUTHOR("Mika Westerberg <mika.westerberg@iki.fi>");
diff --git a/sound/soc/ep93xx/ep93xx-i2s.c b/sound/soc/ep93xx/ep93xx-i2s.c
index 099614e1665..f7a62348e3f 100644
--- a/sound/soc/ep93xx/ep93xx-i2s.c
+++ b/sound/soc/ep93xx/ep93xx-i2s.c
@@ -338,7 +338,7 @@ static int ep93xx_i2s_resume(struct snd_soc_dai *dai)
338#define ep93xx_i2s_resume NULL 338#define ep93xx_i2s_resume NULL
339#endif 339#endif
340 340
341static struct snd_soc_dai_ops ep93xx_i2s_dai_ops = { 341static const struct snd_soc_dai_ops ep93xx_i2s_dai_ops = {
342 .startup = ep93xx_i2s_startup, 342 .startup = ep93xx_i2s_startup,
343 .shutdown = ep93xx_i2s_shutdown, 343 .shutdown = ep93xx_i2s_shutdown,
344 .hw_params = ep93xx_i2s_hw_params, 344 .hw_params = ep93xx_i2s_hw_params,
@@ -464,18 +464,7 @@ static struct platform_driver ep93xx_i2s_driver = {
464 }, 464 },
465}; 465};
466 466
467static int __init ep93xx_i2s_init(void) 467module_platform_driver(ep93xx_i2s_driver);
468{
469 return platform_driver_register(&ep93xx_i2s_driver);
470}
471
472static void __exit ep93xx_i2s_exit(void)
473{
474 platform_driver_unregister(&ep93xx_i2s_driver);
475}
476
477module_init(ep93xx_i2s_init);
478module_exit(ep93xx_i2s_exit);
479 468
480MODULE_ALIAS("platform:ep93xx-i2s"); 469MODULE_ALIAS("platform:ep93xx-i2s");
481MODULE_AUTHOR("Ryan Mallon"); 470MODULE_AUTHOR("Ryan Mallon");
diff --git a/sound/soc/ep93xx/ep93xx-pcm.c b/sound/soc/ep93xx/ep93xx-pcm.c
index d00230a591b..3fc96130d1a 100644
--- a/sound/soc/ep93xx/ep93xx-pcm.c
+++ b/sound/soc/ep93xx/ep93xx-pcm.c
@@ -286,7 +286,6 @@ static u64 ep93xx_pcm_dmamask = 0xffffffff;
286static int ep93xx_pcm_new(struct snd_soc_pcm_runtime *rtd) 286static int ep93xx_pcm_new(struct snd_soc_pcm_runtime *rtd)
287{ 287{
288 struct snd_card *card = rtd->card->snd_card; 288 struct snd_card *card = rtd->card->snd_card;
289 struct snd_soc_dai *dai = rtd->cpu_dai;
290 struct snd_pcm *pcm = rtd->pcm; 289 struct snd_pcm *pcm = rtd->pcm;
291 int ret = 0; 290 int ret = 0;
292 291
@@ -295,14 +294,14 @@ static int ep93xx_pcm_new(struct snd_soc_pcm_runtime *rtd)
295 if (!card->dev->coherent_dma_mask) 294 if (!card->dev->coherent_dma_mask)
296 card->dev->coherent_dma_mask = 0xffffffff; 295 card->dev->coherent_dma_mask = 0xffffffff;
297 296
298 if (dai->driver->playback.channels_min) { 297 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
299 ret = ep93xx_pcm_preallocate_dma_buffer(pcm, 298 ret = ep93xx_pcm_preallocate_dma_buffer(pcm,
300 SNDRV_PCM_STREAM_PLAYBACK); 299 SNDRV_PCM_STREAM_PLAYBACK);
301 if (ret) 300 if (ret)
302 return ret; 301 return ret;
303 } 302 }
304 303
305 if (dai->driver->capture.channels_min) { 304 if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) {
306 ret = ep93xx_pcm_preallocate_dma_buffer(pcm, 305 ret = ep93xx_pcm_preallocate_dma_buffer(pcm,
307 SNDRV_PCM_STREAM_CAPTURE); 306 SNDRV_PCM_STREAM_CAPTURE);
308 if (ret) 307 if (ret)
@@ -339,18 +338,7 @@ static struct platform_driver ep93xx_pcm_driver = {
339 .remove = __devexit_p(ep93xx_soc_platform_remove), 338 .remove = __devexit_p(ep93xx_soc_platform_remove),
340}; 339};
341 340
342static int __init ep93xx_soc_platform_init(void) 341module_platform_driver(ep93xx_pcm_driver);
343{
344 return platform_driver_register(&ep93xx_pcm_driver);
345}
346
347static void __exit ep93xx_soc_platform_exit(void)
348{
349 platform_driver_unregister(&ep93xx_pcm_driver);
350}
351
352module_init(ep93xx_soc_platform_init);
353module_exit(ep93xx_soc_platform_exit);
354 342
355MODULE_AUTHOR("Ryan Mallon"); 343MODULE_AUTHOR("Ryan Mallon");
356MODULE_DESCRIPTION("EP93xx ALSA PCM interface"); 344MODULE_DESCRIPTION("EP93xx ALSA PCM interface");
diff --git a/sound/soc/ep93xx/simone.c b/sound/soc/ep93xx/simone.c
index 968cb316d51..dd997094eb3 100644
--- a/sound/soc/ep93xx/simone.c
+++ b/sound/soc/ep93xx/simone.c
@@ -34,6 +34,7 @@ static struct snd_soc_dai_link simone_dai = {
34 34
35static struct snd_soc_card snd_soc_simone = { 35static struct snd_soc_card snd_soc_simone = {
36 .name = "Sim.One", 36 .name = "Sim.One",
37 .owner = THIS_MODULE,
37 .dai_link = &simone_dai, 38 .dai_link = &simone_dai,
38 .num_links = 1, 39 .num_links = 1,
39}; 40};
@@ -81,17 +82,7 @@ static struct platform_driver simone_driver = {
81 .remove = __devexit_p(simone_remove), 82 .remove = __devexit_p(simone_remove),
82}; 83};
83 84
84static int __init simone_init(void) 85module_platform_driver(simone_driver);
85{
86 return platform_driver_register(&simone_driver);
87}
88module_init(simone_init);
89
90static void __exit simone_exit(void)
91{
92 platform_driver_unregister(&simone_driver);
93}
94module_exit(simone_exit);
95 86
96MODULE_DESCRIPTION("ALSA SoC Simplemachines Sim.One"); 87MODULE_DESCRIPTION("ALSA SoC Simplemachines Sim.One");
97MODULE_AUTHOR("Mika Westerberg <mika.westerberg@iki.fi>"); 88MODULE_AUTHOR("Mika Westerberg <mika.westerberg@iki.fi>");
diff --git a/sound/soc/ep93xx/snappercl15.c b/sound/soc/ep93xx/snappercl15.c
index 2cde43321ee..ccae34a3f28 100644
--- a/sound/soc/ep93xx/snappercl15.c
+++ b/sound/soc/ep93xx/snappercl15.c
@@ -33,16 +33,6 @@ static int snappercl15_hw_params(struct snd_pcm_substream *substream,
33 struct snd_soc_dai *cpu_dai = rtd->cpu_dai; 33 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
34 int err; 34 int err;
35 35
36 err = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S |
37 SND_SOC_DAIFMT_NB_IF |
38 SND_SOC_DAIFMT_CBS_CFS);
39
40 err = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S |
41 SND_SOC_DAIFMT_NB_IF |
42 SND_SOC_DAIFMT_CBS_CFS);
43 if (err)
44 return err;
45
46 err = snd_soc_dai_set_sysclk(codec_dai, 0, CODEC_CLOCK, 36 err = snd_soc_dai_set_sysclk(codec_dai, 0, CODEC_CLOCK,
47 SND_SOC_CLOCK_IN); 37 SND_SOC_CLOCK_IN);
48 if (err) 38 if (err)
@@ -96,11 +86,14 @@ static struct snd_soc_dai_link snappercl15_dai = {
96 .codec_name = "tlv320aic23-codec.0-001a", 86 .codec_name = "tlv320aic23-codec.0-001a",
97 .platform_name = "ep93xx-pcm-audio", 87 .platform_name = "ep93xx-pcm-audio",
98 .init = snappercl15_tlv320aic23_init, 88 .init = snappercl15_tlv320aic23_init,
89 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_IF |
90 SND_SOC_DAIFMT_CBS_CFS,
99 .ops = &snappercl15_ops, 91 .ops = &snappercl15_ops,
100}; 92};
101 93
102static struct snd_soc_card snd_soc_snappercl15 = { 94static struct snd_soc_card snd_soc_snappercl15 = {
103 .name = "Snapper CL15", 95 .name = "Snapper CL15",
96 .owner = THIS_MODULE,
104 .dai_link = &snappercl15_dai, 97 .dai_link = &snappercl15_dai,
105 .num_links = 1, 98 .num_links = 1,
106}; 99};
@@ -147,18 +140,7 @@ static struct platform_driver snappercl15_driver = {
147 .remove = __devexit_p(snappercl15_remove), 140 .remove = __devexit_p(snappercl15_remove),
148}; 141};
149 142
150static int __init snappercl15_init(void) 143module_platform_driver(snappercl15_driver);
151{
152 return platform_driver_register(&snappercl15_driver);
153}
154
155static void __exit snappercl15_exit(void)
156{
157 platform_driver_unregister(&snappercl15_driver);
158}
159
160module_init(snappercl15_init);
161module_exit(snappercl15_exit);
162 144
163MODULE_AUTHOR("Ryan Mallon"); 145MODULE_AUTHOR("Ryan Mallon");
164MODULE_DESCRIPTION("ALSA SoC Snapper CL15"); 146MODULE_DESCRIPTION("ALSA SoC Snapper CL15");
diff --git a/sound/soc/fsl/efika-audio-fabric.c b/sound/soc/fsl/efika-audio-fabric.c
index 108b5d8bd0e..b2acd3293ea 100644
--- a/sound/soc/fsl/efika-audio-fabric.c
+++ b/sound/soc/fsl/efika-audio-fabric.c
@@ -31,8 +31,6 @@
31 31
32#define DRV_NAME "efika-audio-fabric" 32#define DRV_NAME "efika-audio-fabric"
33 33
34static struct snd_soc_card card;
35
36static struct snd_soc_dai_link efika_fabric_dai[] = { 34static struct snd_soc_dai_link efika_fabric_dai[] = {
37{ 35{
38 .name = "AC97", 36 .name = "AC97",
@@ -52,6 +50,13 @@ static struct snd_soc_dai_link efika_fabric_dai[] = {
52}, 50},
53}; 51};
54 52
53static struct snd_soc_card card = {
54 .name = "Efika",
55 .owner = THIS_MODULE,
56 .dai_link = efika_fabric_dai,
57 .num_links = ARRAY_SIZE(efika_fabric_dai),
58};
59
55static __init int efika_fabric_init(void) 60static __init int efika_fabric_init(void)
56{ 61{
57 struct platform_device *pdev; 62 struct platform_device *pdev;
@@ -60,11 +65,6 @@ static __init int efika_fabric_init(void)
60 if (!of_machine_is_compatible("bplan,efika")) 65 if (!of_machine_is_compatible("bplan,efika"))
61 return -ENODEV; 66 return -ENODEV;
62 67
63 card.name = "Efika";
64 card.dai_link = efika_fabric_dai;
65 card.num_links = ARRAY_SIZE(efika_fabric_dai);
66
67
68 pdev = platform_device_alloc("soc-audio", 1); 68 pdev = platform_device_alloc("soc-audio", 1);
69 if (!pdev) { 69 if (!pdev) {
70 pr_err("efika_fabric_init: platform_device_alloc() failed\n"); 70 pr_err("efika_fabric_init: platform_device_alloc() failed\n");
diff --git a/sound/soc/fsl/fsl_dma.c b/sound/soc/fsl/fsl_dma.c
index ef15402a3bc..4f59bbaba48 100644
--- a/sound/soc/fsl/fsl_dma.c
+++ b/sound/soc/fsl/fsl_dma.c
@@ -992,20 +992,7 @@ static struct platform_driver fsl_soc_dma_driver = {
992 .remove = __devexit_p(fsl_soc_dma_remove), 992 .remove = __devexit_p(fsl_soc_dma_remove),
993}; 993};
994 994
995static int __init fsl_soc_dma_init(void) 995module_platform_driver(fsl_soc_dma_driver);
996{
997 pr_info("Freescale Elo DMA ASoC PCM Driver\n");
998
999 return platform_driver_register(&fsl_soc_dma_driver);
1000}
1001
1002static void __exit fsl_soc_dma_exit(void)
1003{
1004 platform_driver_unregister(&fsl_soc_dma_driver);
1005}
1006
1007module_init(fsl_soc_dma_init);
1008module_exit(fsl_soc_dma_exit);
1009 996
1010MODULE_AUTHOR("Timur Tabi <timur@freescale.com>"); 997MODULE_AUTHOR("Timur Tabi <timur@freescale.com>");
1011MODULE_DESCRIPTION("Freescale Elo DMA ASoC PCM Driver"); 998MODULE_DESCRIPTION("Freescale Elo DMA ASoC PCM Driver");
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index 83c4bd5b2dd..3e066966d87 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -514,7 +514,7 @@ static void fsl_ssi_shutdown(struct snd_pcm_substream *substream,
514 } 514 }
515} 515}
516 516
517static struct snd_soc_dai_ops fsl_ssi_dai_ops = { 517static const struct snd_soc_dai_ops fsl_ssi_dai_ops = {
518 .startup = fsl_ssi_startup, 518 .startup = fsl_ssi_startup,
519 .hw_params = fsl_ssi_hw_params, 519 .hw_params = fsl_ssi_hw_params,
520 .shutdown = fsl_ssi_shutdown, 520 .shutdown = fsl_ssi_shutdown,
@@ -793,20 +793,7 @@ static struct platform_driver fsl_ssi_driver = {
793 .remove = fsl_ssi_remove, 793 .remove = fsl_ssi_remove,
794}; 794};
795 795
796static int __init fsl_ssi_init(void) 796module_platform_driver(fsl_ssi_driver);
797{
798 printk(KERN_INFO "Freescale Synchronous Serial Interface (SSI) ASoC Driver\n");
799
800 return platform_driver_register(&fsl_ssi_driver);
801}
802
803static void __exit fsl_ssi_exit(void)
804{
805 platform_driver_unregister(&fsl_ssi_driver);
806}
807
808module_init(fsl_ssi_init);
809module_exit(fsl_ssi_exit);
810 797
811MODULE_AUTHOR("Timur Tabi <timur@freescale.com>"); 798MODULE_AUTHOR("Timur Tabi <timur@freescale.com>");
812MODULE_DESCRIPTION("Freescale Synchronous Serial Interface (SSI) ASoC Driver"); 799MODULE_DESCRIPTION("Freescale Synchronous Serial Interface (SSI) ASoC Driver");
diff --git a/sound/soc/fsl/mpc5200_dma.c b/sound/soc/fsl/mpc5200_dma.c
index 5c6c2457386..e7803d34c42 100644
--- a/sound/soc/fsl/mpc5200_dma.c
+++ b/sound/soc/fsl/mpc5200_dma.c
@@ -526,17 +526,7 @@ static struct platform_driver mpc5200_hpcd_of_driver = {
526 } 526 }
527}; 527};
528 528
529static int __init mpc5200_hpcd_init(void) 529module_platform_driver(mpc5200_hpcd_of_driver);
530{
531 return platform_driver_register(&mpc5200_hpcd_of_driver);
532}
533module_init(mpc5200_hpcd_init);
534
535static void __exit mpc5200_hpcd_exit(void)
536{
537 platform_driver_unregister(&mpc5200_hpcd_of_driver);
538}
539module_exit(mpc5200_hpcd_exit);
540 530
541MODULE_AUTHOR("Grant Likely <grant.likely@secretlab.ca>"); 531MODULE_AUTHOR("Grant Likely <grant.likely@secretlab.ca>");
542MODULE_DESCRIPTION("Freescale MPC5200 PSC in DMA mode ASoC Driver"); 532MODULE_DESCRIPTION("Freescale MPC5200 PSC in DMA mode ASoC Driver");
diff --git a/sound/soc/fsl/mpc5200_psc_ac97.c b/sound/soc/fsl/mpc5200_psc_ac97.c
index ad36b095bb7..ffa00a2eb77 100644
--- a/sound/soc/fsl/mpc5200_psc_ac97.c
+++ b/sound/soc/fsl/mpc5200_psc_ac97.c
@@ -226,12 +226,12 @@ static int psc_ac97_probe(struct snd_soc_dai *cpu_dai)
226/** 226/**
227 * psc_ac97_dai_template: template CPU Digital Audio Interface 227 * psc_ac97_dai_template: template CPU Digital Audio Interface
228 */ 228 */
229static struct snd_soc_dai_ops psc_ac97_analog_ops = { 229static const struct snd_soc_dai_ops psc_ac97_analog_ops = {
230 .hw_params = psc_ac97_hw_analog_params, 230 .hw_params = psc_ac97_hw_analog_params,
231 .trigger = psc_ac97_trigger, 231 .trigger = psc_ac97_trigger,
232}; 232};
233 233
234static struct snd_soc_dai_ops psc_ac97_digital_ops = { 234static const struct snd_soc_dai_ops psc_ac97_digital_ops = {
235 .hw_params = psc_ac97_hw_digital_params, 235 .hw_params = psc_ac97_hw_digital_params,
236}; 236};
237 237
@@ -325,21 +325,7 @@ static struct platform_driver psc_ac97_driver = {
325 }, 325 },
326}; 326};
327 327
328/* --------------------------------------------------------------------- 328module_platform_driver(psc_ac97_driver);
329 * Module setup and teardown; simply register the of_platform driver
330 * for the PSC in AC97 mode.
331 */
332static int __init psc_ac97_init(void)
333{
334 return platform_driver_register(&psc_ac97_driver);
335}
336module_init(psc_ac97_init);
337
338static void __exit psc_ac97_exit(void)
339{
340 platform_driver_unregister(&psc_ac97_driver);
341}
342module_exit(psc_ac97_exit);
343 329
344MODULE_AUTHOR("Jon Smirl <jonsmirl@gmail.com>"); 330MODULE_AUTHOR("Jon Smirl <jonsmirl@gmail.com>");
345MODULE_DESCRIPTION("mpc5200 AC97 module"); 331MODULE_DESCRIPTION("mpc5200 AC97 module");
diff --git a/sound/soc/fsl/mpc5200_psc_i2s.c b/sound/soc/fsl/mpc5200_psc_i2s.c
index 87cf2a5c2b2..7b530327553 100644
--- a/sound/soc/fsl/mpc5200_psc_i2s.c
+++ b/sound/soc/fsl/mpc5200_psc_i2s.c
@@ -123,7 +123,7 @@ static int psc_i2s_set_fmt(struct snd_soc_dai *cpu_dai, unsigned int format)
123/** 123/**
124 * psc_i2s_dai_template: template CPU Digital Audio Interface 124 * psc_i2s_dai_template: template CPU Digital Audio Interface
125 */ 125 */
126static struct snd_soc_dai_ops psc_i2s_dai_ops = { 126static const struct snd_soc_dai_ops psc_i2s_dai_ops = {
127 .hw_params = psc_i2s_hw_params, 127 .hw_params = psc_i2s_hw_params,
128 .set_sysclk = psc_i2s_set_sysclk, 128 .set_sysclk = psc_i2s_set_sysclk,
129 .set_fmt = psc_i2s_set_fmt, 129 .set_fmt = psc_i2s_set_fmt,
@@ -222,21 +222,7 @@ static struct platform_driver psc_i2s_driver = {
222 }, 222 },
223}; 223};
224 224
225/* --------------------------------------------------------------------- 225module_platform_driver(psc_i2s_driver);
226 * Module setup and teardown; simply register the of_platform driver
227 * for the PSC in I2S mode.
228 */
229static int __init psc_i2s_init(void)
230{
231 return platform_driver_register(&psc_i2s_driver);
232}
233module_init(psc_i2s_init);
234
235static void __exit psc_i2s_exit(void)
236{
237 platform_driver_unregister(&psc_i2s_driver);
238}
239module_exit(psc_i2s_exit);
240 226
241MODULE_AUTHOR("Grant Likely <grant.likely@secretlab.ca>"); 227MODULE_AUTHOR("Grant Likely <grant.likely@secretlab.ca>");
242MODULE_DESCRIPTION("Freescale MPC5200 PSC in I2S mode ASoC Driver"); 228MODULE_DESCRIPTION("Freescale MPC5200 PSC in I2S mode ASoC Driver");
diff --git a/sound/soc/fsl/mpc8610_hpcd.c b/sound/soc/fsl/mpc8610_hpcd.c
index ae49f1c78c6..0ea4a5a96e0 100644
--- a/sound/soc/fsl/mpc8610_hpcd.c
+++ b/sound/soc/fsl/mpc8610_hpcd.c
@@ -14,6 +14,7 @@
14#include <linux/interrupt.h> 14#include <linux/interrupt.h>
15#include <linux/of_device.h> 15#include <linux/of_device.h>
16#include <linux/slab.h> 16#include <linux/slab.h>
17#include <linux/of_i2c.h>
17#include <sound/soc.h> 18#include <sound/soc.h>
18#include <asm/fsl_guts.h> 19#include <asm/fsl_guts.h>
19 20
@@ -249,8 +250,9 @@ static int get_parent_cell_index(struct device_node *np)
249static int codec_node_dev_name(struct device_node *np, char *buf, size_t len) 250static int codec_node_dev_name(struct device_node *np, char *buf, size_t len)
250{ 251{
251 const u32 *iprop; 252 const u32 *iprop;
252 int bus, addr; 253 int addr;
253 char temp[DAI_NAME_SIZE]; 254 char temp[DAI_NAME_SIZE];
255 struct i2c_client *i2c;
254 256
255 of_modalias_node(np, temp, DAI_NAME_SIZE); 257 of_modalias_node(np, temp, DAI_NAME_SIZE);
256 258
@@ -260,11 +262,12 @@ static int codec_node_dev_name(struct device_node *np, char *buf, size_t len)
260 262
261 addr = be32_to_cpup(iprop); 263 addr = be32_to_cpup(iprop);
262 264
263 bus = get_parent_cell_index(np); 265 /* We need the adapter number */
264 if (bus < 0) 266 i2c = of_find_i2c_device_by_node(np);
265 return bus; 267 if (!i2c)
268 return -ENODEV;
266 269
267 snprintf(buf, len, "%s-codec.%u-%04x", temp, bus, addr); 270 snprintf(buf, len, "%s-codec.%u-%04x", temp, i2c->adapter->nr, addr);
268 271
269 return 0; 272 return 0;
270} 273}
diff --git a/sound/soc/fsl/p1022_ds.c b/sound/soc/fsl/p1022_ds.c
index 2c064a9824a..a5d4e80a9cf 100644
--- a/sound/soc/fsl/p1022_ds.c
+++ b/sound/soc/fsl/p1022_ds.c
@@ -14,6 +14,7 @@
14#include <linux/interrupt.h> 14#include <linux/interrupt.h>
15#include <linux/of_device.h> 15#include <linux/of_device.h>
16#include <linux/slab.h> 16#include <linux/slab.h>
17#include <linux/of_i2c.h>
17#include <sound/soc.h> 18#include <sound/soc.h>
18#include <asm/fsl_guts.h> 19#include <asm/fsl_guts.h>
19 20
@@ -252,8 +253,9 @@ static int get_parent_cell_index(struct device_node *np)
252static int codec_node_dev_name(struct device_node *np, char *buf, size_t len) 253static int codec_node_dev_name(struct device_node *np, char *buf, size_t len)
253{ 254{
254 const u32 *iprop; 255 const u32 *iprop;
255 int bus, addr; 256 int addr;
256 char temp[DAI_NAME_SIZE]; 257 char temp[DAI_NAME_SIZE];
258 struct i2c_client *i2c;
257 259
258 of_modalias_node(np, temp, DAI_NAME_SIZE); 260 of_modalias_node(np, temp, DAI_NAME_SIZE);
259 261
@@ -263,11 +265,12 @@ static int codec_node_dev_name(struct device_node *np, char *buf, size_t len)
263 265
264 addr = be32_to_cpup(iprop); 266 addr = be32_to_cpup(iprop);
265 267
266 bus = get_parent_cell_index(np); 268 /* We need the adapter number */
267 if (bus < 0) 269 i2c = of_find_i2c_device_by_node(np);
268 return bus; 270 if (!i2c)
271 return -ENODEV;
269 272
270 snprintf(buf, len, "%s.%u-%04x", temp, bus, addr); 273 snprintf(buf, len, "%s.%u-%04x", temp, i2c->adapter->nr, addr);
271 274
272 return 0; 275 return 0;
273} 276}
@@ -540,12 +543,6 @@ static struct platform_driver p1022_ds_driver = {
540 .probe = p1022_ds_probe, 543 .probe = p1022_ds_probe,
541 .remove = __devexit_p(p1022_ds_remove), 544 .remove = __devexit_p(p1022_ds_remove),
542 .driver = { 545 .driver = {
543 /* The name must match the 'model' property in the device tree,
544 * in lowercase letters, but only the part after that last
545 * comma. This is because some model properties have a "fsl,"
546 * prefix.
547 */
548 .name = "snd-soc-p1022",
549 .owner = THIS_MODULE, 546 .owner = THIS_MODULE,
550 }, 547 },
551}; 548};
@@ -559,13 +556,39 @@ static int __init p1022_ds_init(void)
559{ 556{
560 struct device_node *guts_np; 557 struct device_node *guts_np;
561 struct resource res; 558 struct resource res;
559 const char *sprop;
560
561 /*
562 * Check if we're actually running on a P1022DS. Older device trees
563 * have a model of "fsl,P1022" and newer ones use "fsl,P1022DS", so we
564 * need to support both. The SSI driver uses that property to link to
565 * the machine driver, so have to match it.
566 */
567 sprop = of_get_property(of_find_node_by_path("/"), "model", NULL);
568 if (!sprop) {
569 pr_err("snd-soc-p1022ds: missing /model node");
570 return -ENODEV;
571 }
572
573 pr_debug("snd-soc-p1022ds: board model name is %s\n", sprop);
562 574
563 pr_info("Freescale P1022 DS ALSA SoC machine driver\n"); 575 /*
576 * The name of this board, taken from the device tree. Normally, this is a*
577 * fixed string, but some P1022DS device trees have a /model property of
578 * "fsl,P1022", and others have "fsl,P1022DS".
579 */
580 if (strcasecmp(sprop, "fsl,p1022ds") == 0)
581 p1022_ds_driver.driver.name = "snd-soc-p1022ds";
582 else if (strcasecmp(sprop, "fsl,p1022") == 0)
583 p1022_ds_driver.driver.name = "snd-soc-p1022";
584 else
585 return -ENODEV;
564 586
565 /* Get the physical address of the global utilities registers */ 587 /* Get the physical address of the global utilities registers */
566 guts_np = of_find_compatible_node(NULL, NULL, "fsl,p1022-guts"); 588 guts_np = of_find_compatible_node(NULL, NULL, "fsl,p1022-guts");
567 if (of_address_to_resource(guts_np, 0, &res)) { 589 if (of_address_to_resource(guts_np, 0, &res)) {
568 pr_err("p1022-ds: missing/invalid global utilities node\n"); 590 pr_err("snd-soc-p1022ds: missing/invalid global utils node\n");
591 of_node_put(guts_np);
569 return -EINVAL; 592 return -EINVAL;
570 } 593 }
571 guts_phys = res.start; 594 guts_phys = res.start;
diff --git a/sound/soc/fsl/pcm030-audio-fabric.c b/sound/soc/fsl/pcm030-audio-fabric.c
index ba4d85e317e..b3af55dcde9 100644
--- a/sound/soc/fsl/pcm030-audio-fabric.c
+++ b/sound/soc/fsl/pcm030-audio-fabric.c
@@ -31,8 +31,6 @@
31 31
32#define DRV_NAME "pcm030-audio-fabric" 32#define DRV_NAME "pcm030-audio-fabric"
33 33
34static struct snd_soc_card card;
35
36static struct snd_soc_dai_link pcm030_fabric_dai[] = { 34static struct snd_soc_dai_link pcm030_fabric_dai[] = {
37{ 35{
38 .name = "AC97", 36 .name = "AC97",
@@ -52,6 +50,13 @@ static struct snd_soc_dai_link pcm030_fabric_dai[] = {
52}, 50},
53}; 51};
54 52
53static struct snd_soc_card card = {
54 .name = "pcm030",
55 .owner = THIS_MODULE,
56 .dai_link = pcm030_fabric_dai,
57 .num_links = ARRAY_SIZE(pcm030_fabric_dai),
58};
59
55static __init int pcm030_fabric_init(void) 60static __init int pcm030_fabric_init(void)
56{ 61{
57 struct platform_device *pdev; 62 struct platform_device *pdev;
@@ -60,11 +65,6 @@ static __init int pcm030_fabric_init(void)
60 if (!of_machine_is_compatible("phytec,pcm030")) 65 if (!of_machine_is_compatible("phytec,pcm030"))
61 return -ENODEV; 66 return -ENODEV;
62 67
63
64 card.name = "pcm030";
65 card.dai_link = pcm030_fabric_dai;
66 card.num_links = ARRAY_SIZE(pcm030_fabric_dai);
67
68 pdev = platform_device_alloc("soc-audio", 1); 68 pdev = platform_device_alloc("soc-audio", 1);
69 if (!pdev) { 69 if (!pdev) {
70 pr_err("pcm030_fabric_init: platform_device_alloc() failed\n"); 70 pr_err("pcm030_fabric_init: platform_device_alloc() failed\n");
diff --git a/sound/soc/imx/Kconfig b/sound/soc/imx/Kconfig
index b133bfcc584..738391757f2 100644
--- a/sound/soc/imx/Kconfig
+++ b/sound/soc/imx/Kconfig
@@ -28,7 +28,7 @@ config SND_MXC_SOC_WM1133_EV1
28 28
29config SND_SOC_MX27VIS_AIC32X4 29config SND_SOC_MX27VIS_AIC32X4
30 tristate "SoC audio support for Visstrim M10 boards" 30 tristate "SoC audio support for Visstrim M10 boards"
31 depends on MACH_IMX27_VISSTRIM_M10 31 depends on MACH_IMX27_VISSTRIM_M10 && I2C
32 select SND_SOC_TLV320AIC32X4 32 select SND_SOC_TLV320AIC32X4
33 select SND_MXC_SOC_MX2 33 select SND_MXC_SOC_MX2
34 help 34 help
diff --git a/sound/soc/imx/eukrea-tlv320.c b/sound/soc/imx/eukrea-tlv320.c
index 75fb4b83548..1c1fdd10f73 100644
--- a/sound/soc/imx/eukrea-tlv320.c
+++ b/sound/soc/imx/eukrea-tlv320.c
@@ -87,6 +87,7 @@ static struct snd_soc_dai_link eukrea_tlv320_dai = {
87 87
88static struct snd_soc_card eukrea_tlv320 = { 88static struct snd_soc_card eukrea_tlv320 = {
89 .name = "cpuimx-audio", 89 .name = "cpuimx-audio",
90 .owner = THIS_MODULE,
90 .dai_link = &eukrea_tlv320_dai, 91 .dai_link = &eukrea_tlv320_dai,
91 .num_links = 1, 92 .num_links = 1,
92}; 93};
diff --git a/sound/soc/imx/imx-pcm-dma-mx2.c b/sound/soc/imx/imx-pcm-dma-mx2.c
index 43fdc24f7e8..1cf2fe889f6 100644
--- a/sound/soc/imx/imx-pcm-dma-mx2.c
+++ b/sound/soc/imx/imx-pcm-dma-mx2.c
@@ -326,16 +326,6 @@ static struct platform_driver imx_pcm_driver = {
326 .remove = __devexit_p(imx_soc_platform_remove), 326 .remove = __devexit_p(imx_soc_platform_remove),
327}; 327};
328 328
329static int __init snd_imx_pcm_init(void) 329module_platform_driver(imx_pcm_driver);
330{
331 return platform_driver_register(&imx_pcm_driver);
332}
333module_init(snd_imx_pcm_init);
334
335static void __exit snd_imx_pcm_exit(void)
336{
337 platform_driver_unregister(&imx_pcm_driver);
338}
339module_exit(snd_imx_pcm_exit);
340MODULE_LICENSE("GPL"); 330MODULE_LICENSE("GPL");
341MODULE_ALIAS("platform:imx-pcm-audio"); 331MODULE_ALIAS("platform:imx-pcm-audio");
diff --git a/sound/soc/imx/imx-pcm-fiq.c b/sound/soc/imx/imx-pcm-fiq.c
index 8df0fae2194..456b7d723d6 100644
--- a/sound/soc/imx/imx-pcm-fiq.c
+++ b/sound/soc/imx/imx-pcm-fiq.c
@@ -331,14 +331,6 @@ static struct platform_driver imx_pcm_driver = {
331 .remove = __devexit_p(imx_soc_platform_remove), 331 .remove = __devexit_p(imx_soc_platform_remove),
332}; 332};
333 333
334static int __init snd_imx_pcm_init(void) 334module_platform_driver(imx_pcm_driver);
335{
336 return platform_driver_register(&imx_pcm_driver);
337}
338module_init(snd_imx_pcm_init);
339 335
340static void __exit snd_imx_pcm_exit(void) 336MODULE_LICENSE("GPL");
341{
342 platform_driver_unregister(&imx_pcm_driver);
343}
344module_exit(snd_imx_pcm_exit);
diff --git a/sound/soc/imx/imx-ssi.c b/sound/soc/imx/imx-ssi.c
index 4c05e2b8f4d..01d1f749cf0 100644
--- a/sound/soc/imx/imx-ssi.c
+++ b/sound/soc/imx/imx-ssi.c
@@ -342,7 +342,7 @@ static int imx_ssi_trigger(struct snd_pcm_substream *substream, int cmd,
342 return 0; 342 return 0;
343} 343}
344 344
345static struct snd_soc_dai_ops imx_ssi_pcm_dai_ops = { 345static const struct snd_soc_dai_ops imx_ssi_pcm_dai_ops = {
346 .hw_params = imx_ssi_hw_params, 346 .hw_params = imx_ssi_hw_params,
347 .set_fmt = imx_ssi_set_dai_fmt, 347 .set_fmt = imx_ssi_set_dai_fmt,
348 .set_clkdiv = imx_ssi_set_dai_clkdiv, 348 .set_clkdiv = imx_ssi_set_dai_clkdiv,
@@ -757,18 +757,7 @@ static struct platform_driver imx_ssi_driver = {
757 }, 757 },
758}; 758};
759 759
760static int __init imx_ssi_init(void) 760module_platform_driver(imx_ssi_driver);
761{
762 return platform_driver_register(&imx_ssi_driver);
763}
764
765static void __exit imx_ssi_exit(void)
766{
767 platform_driver_unregister(&imx_ssi_driver);
768}
769
770module_init(imx_ssi_init);
771module_exit(imx_ssi_exit);
772 761
773/* Module information */ 762/* Module information */
774MODULE_AUTHOR("Sascha Hauer, <s.hauer@pengutronix.de>"); 763MODULE_AUTHOR("Sascha Hauer, <s.hauer@pengutronix.de>");
diff --git a/sound/soc/imx/mx27vis-aic32x4.c b/sound/soc/imx/mx27vis-aic32x4.c
index 054110b91d4..3c2eed9094d 100644
--- a/sound/soc/imx/mx27vis-aic32x4.c
+++ b/sound/soc/imx/mx27vis-aic32x4.c
@@ -86,6 +86,7 @@ static struct snd_soc_dai_link mx27vis_aic32x4_dai = {
86 86
87static struct snd_soc_card mx27vis_aic32x4 = { 87static struct snd_soc_card mx27vis_aic32x4 = {
88 .name = "visstrim_m10-audio", 88 .name = "visstrim_m10-audio",
89 .owner = THIS_MODULE,
89 .dai_link = &mx27vis_aic32x4_dai, 90 .dai_link = &mx27vis_aic32x4_dai,
90 .num_links = 1, 91 .num_links = 1,
91}; 92};
diff --git a/sound/soc/imx/phycore-ac97.c b/sound/soc/imx/phycore-ac97.c
index a7deb5cb243..6ac12111de6 100644
--- a/sound/soc/imx/phycore-ac97.c
+++ b/sound/soc/imx/phycore-ac97.c
@@ -38,6 +38,7 @@ static struct snd_soc_dai_link imx_phycore_dai_ac97[] = {
38 38
39static struct snd_soc_card imx_phycore = { 39static struct snd_soc_card imx_phycore = {
40 .name = "PhyCORE-ac97-audio", 40 .name = "PhyCORE-ac97-audio",
41 .owner = THIS_MODULE,
41 .dai_link = imx_phycore_dai_ac97, 42 .dai_link = imx_phycore_dai_ac97,
42 .num_links = ARRAY_SIZE(imx_phycore_dai_ac97), 43 .num_links = ARRAY_SIZE(imx_phycore_dai_ac97),
43}; 44};
diff --git a/sound/soc/imx/wm1133-ev1.c b/sound/soc/imx/wm1133-ev1.c
index 490a1260c22..37480c90e99 100644
--- a/sound/soc/imx/wm1133-ev1.c
+++ b/sound/soc/imx/wm1133-ev1.c
@@ -255,6 +255,7 @@ static struct snd_soc_dai_link wm1133_ev1_dai = {
255 255
256static struct snd_soc_card wm1133_ev1 = { 256static struct snd_soc_card wm1133_ev1 = {
257 .name = "WM1133-EV1", 257 .name = "WM1133-EV1",
258 .owner = THIS_MODULE,
258 .dai_link = &wm1133_ev1_dai, 259 .dai_link = &wm1133_ev1_dai,
259 .num_links = 1, 260 .num_links = 1,
260}; 261};
diff --git a/sound/soc/jz4740/jz4740-i2s.c b/sound/soc/jz4740/jz4740-i2s.c
index cd22a54b2f1..a5af7c42e62 100644
--- a/sound/soc/jz4740/jz4740-i2s.c
+++ b/sound/soc/jz4740/jz4740-i2s.c
@@ -392,7 +392,7 @@ static int jz4740_i2s_dai_remove(struct snd_soc_dai *dai)
392 return 0; 392 return 0;
393} 393}
394 394
395static struct snd_soc_dai_ops jz4740_i2s_dai_ops = { 395static const struct snd_soc_dai_ops jz4740_i2s_dai_ops = {
396 .startup = jz4740_i2s_startup, 396 .startup = jz4740_i2s_startup,
397 .shutdown = jz4740_i2s_shutdown, 397 .shutdown = jz4740_i2s_shutdown,
398 .trigger = jz4740_i2s_trigger, 398 .trigger = jz4740_i2s_trigger,
@@ -519,17 +519,7 @@ static struct platform_driver jz4740_i2s_driver = {
519 }, 519 },
520}; 520};
521 521
522static int __init jz4740_i2s_init(void) 522module_platform_driver(jz4740_i2s_driver);
523{
524 return platform_driver_register(&jz4740_i2s_driver);
525}
526module_init(jz4740_i2s_init);
527
528static void __exit jz4740_i2s_exit(void)
529{
530 platform_driver_unregister(&jz4740_i2s_driver);
531}
532module_exit(jz4740_i2s_exit);
533 523
534MODULE_AUTHOR("Lars-Peter Clausen, <lars@metafoo.de>"); 524MODULE_AUTHOR("Lars-Peter Clausen, <lars@metafoo.de>");
535MODULE_DESCRIPTION("Ingenic JZ4740 SoC I2S driver"); 525MODULE_DESCRIPTION("Ingenic JZ4740 SoC I2S driver");
diff --git a/sound/soc/jz4740/jz4740-pcm.c b/sound/soc/jz4740/jz4740-pcm.c
index d1989cde9f1..9b8cf256847 100644
--- a/sound/soc/jz4740/jz4740-pcm.c
+++ b/sound/soc/jz4740/jz4740-pcm.c
@@ -302,7 +302,6 @@ static u64 jz4740_pcm_dmamask = DMA_BIT_MASK(32);
302static int jz4740_pcm_new(struct snd_soc_pcm_runtime *rtd) 302static int jz4740_pcm_new(struct snd_soc_pcm_runtime *rtd)
303{ 303{
304 struct snd_card *card = rtd->card->snd_card; 304 struct snd_card *card = rtd->card->snd_card;
305 struct snd_soc_dai *dai = rtd->cpu_dai;
306 struct snd_pcm *pcm = rtd->pcm; 305 struct snd_pcm *pcm = rtd->pcm;
307 int ret = 0; 306 int ret = 0;
308 307
@@ -312,14 +311,14 @@ static int jz4740_pcm_new(struct snd_soc_pcm_runtime *rtd)
312 if (!card->dev->coherent_dma_mask) 311 if (!card->dev->coherent_dma_mask)
313 card->dev->coherent_dma_mask = DMA_BIT_MASK(32); 312 card->dev->coherent_dma_mask = DMA_BIT_MASK(32);
314 313
315 if (dai->driver->playback.channels_min) { 314 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
316 ret = jz4740_pcm_preallocate_dma_buffer(pcm, 315 ret = jz4740_pcm_preallocate_dma_buffer(pcm,
317 SNDRV_PCM_STREAM_PLAYBACK); 316 SNDRV_PCM_STREAM_PLAYBACK);
318 if (ret) 317 if (ret)
319 goto err; 318 goto err;
320 } 319 }
321 320
322 if (dai->driver->capture.channels_min) { 321 if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) {
323 ret = jz4740_pcm_preallocate_dma_buffer(pcm, 322 ret = jz4740_pcm_preallocate_dma_buffer(pcm,
324 SNDRV_PCM_STREAM_CAPTURE); 323 SNDRV_PCM_STREAM_CAPTURE);
325 if (ret) 324 if (ret)
@@ -356,17 +355,7 @@ static struct platform_driver jz4740_pcm_driver = {
356 }, 355 },
357}; 356};
358 357
359static int __init jz4740_soc_platform_init(void) 358module_platform_driver(jz4740_pcm_driver);
360{
361 return platform_driver_register(&jz4740_pcm_driver);
362}
363module_init(jz4740_soc_platform_init);
364
365static void __exit jz4740_soc_platform_exit(void)
366{
367 return platform_driver_unregister(&jz4740_pcm_driver);
368}
369module_exit(jz4740_soc_platform_exit);
370 359
371MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>"); 360MODULE_AUTHOR("Lars-Peter Clausen <lars@metafoo.de>");
372MODULE_DESCRIPTION("Ingenic SoC JZ4740 PCM driver"); 361MODULE_DESCRIPTION("Ingenic SoC JZ4740 PCM driver");
diff --git a/sound/soc/jz4740/qi_lb60.c b/sound/soc/jz4740/qi_lb60.c
index c5fc339f68f..0097c3b13a1 100644
--- a/sound/soc/jz4740/qi_lb60.c
+++ b/sound/soc/jz4740/qi_lb60.c
@@ -81,6 +81,7 @@ static struct snd_soc_dai_link qi_lb60_dai = {
81 81
82static struct snd_soc_card qi_lb60 = { 82static struct snd_soc_card qi_lb60 = {
83 .name = "QI LB60", 83 .name = "QI LB60",
84 .owner = THIS_MODULE,
84 .dai_link = &qi_lb60_dai, 85 .dai_link = &qi_lb60_dai,
85 .num_links = 1, 86 .num_links = 1,
86 87
diff --git a/sound/soc/kirkwood/Kconfig b/sound/soc/kirkwood/Kconfig
index 8f49e165f4d..c62d715235e 100644
--- a/sound/soc/kirkwood/Kconfig
+++ b/sound/soc/kirkwood/Kconfig
@@ -12,6 +12,7 @@ config SND_KIRKWOOD_SOC_I2S
12config SND_KIRKWOOD_SOC_OPENRD 12config SND_KIRKWOOD_SOC_OPENRD
13 tristate "SoC Audio support for Kirkwood Openrd Client" 13 tristate "SoC Audio support for Kirkwood Openrd Client"
14 depends on SND_KIRKWOOD_SOC && (MACH_OPENRD_CLIENT || MACH_OPENRD_ULTIMATE) 14 depends on SND_KIRKWOOD_SOC && (MACH_OPENRD_CLIENT || MACH_OPENRD_ULTIMATE)
15 depends on I2C
15 select SND_KIRKWOOD_SOC_I2S 16 select SND_KIRKWOOD_SOC_I2S
16 select SND_SOC_CS42L51 17 select SND_SOC_CS42L51
17 help 18 help
@@ -20,7 +21,7 @@ config SND_KIRKWOOD_SOC_OPENRD
20 21
21config SND_KIRKWOOD_SOC_T5325 22config SND_KIRKWOOD_SOC_T5325
22 tristate "SoC Audio support for HP t5325" 23 tristate "SoC Audio support for HP t5325"
23 depends on SND_KIRKWOOD_SOC && MACH_T5325 24 depends on SND_KIRKWOOD_SOC && MACH_T5325 && I2C
24 select SND_KIRKWOOD_SOC_I2S 25 select SND_KIRKWOOD_SOC_I2S
25 select SND_SOC_ALC5623 26 select SND_SOC_ALC5623
26 help 27 help
diff --git a/sound/soc/kirkwood/kirkwood-dma.c b/sound/soc/kirkwood/kirkwood-dma.c
index cd33de1c5b7..d4a17780cef 100644
--- a/sound/soc/kirkwood/kirkwood-dma.c
+++ b/sound/soc/kirkwood/kirkwood-dma.c
@@ -315,7 +315,6 @@ static int kirkwood_dma_preallocate_dma_buffer(struct snd_pcm *pcm,
315static int kirkwood_dma_new(struct snd_soc_pcm_runtime *rtd) 315static int kirkwood_dma_new(struct snd_soc_pcm_runtime *rtd)
316{ 316{
317 struct snd_card *card = rtd->card->snd_card; 317 struct snd_card *card = rtd->card->snd_card;
318 struct snd_soc_dai *dai = rtd->cpu_dai;
319 struct snd_pcm *pcm = rtd->pcm; 318 struct snd_pcm *pcm = rtd->pcm;
320 int ret; 319 int ret;
321 320
@@ -324,14 +323,14 @@ static int kirkwood_dma_new(struct snd_soc_pcm_runtime *rtd)
324 if (!card->dev->coherent_dma_mask) 323 if (!card->dev->coherent_dma_mask)
325 card->dev->coherent_dma_mask = 0xffffffff; 324 card->dev->coherent_dma_mask = 0xffffffff;
326 325
327 if (dai->driver->playback.channels_min) { 326 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
328 ret = kirkwood_dma_preallocate_dma_buffer(pcm, 327 ret = kirkwood_dma_preallocate_dma_buffer(pcm,
329 SNDRV_PCM_STREAM_PLAYBACK); 328 SNDRV_PCM_STREAM_PLAYBACK);
330 if (ret) 329 if (ret)
331 return ret; 330 return ret;
332 } 331 }
333 332
334 if (dai->driver->capture.channels_min) { 333 if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) {
335 ret = kirkwood_dma_preallocate_dma_buffer(pcm, 334 ret = kirkwood_dma_preallocate_dma_buffer(pcm,
336 SNDRV_PCM_STREAM_CAPTURE); 335 SNDRV_PCM_STREAM_CAPTURE);
337 if (ret) 336 if (ret)
@@ -388,17 +387,7 @@ static struct platform_driver kirkwood_pcm_driver = {
388 .remove = __devexit_p(kirkwood_soc_platform_remove), 387 .remove = __devexit_p(kirkwood_soc_platform_remove),
389}; 388};
390 389
391static int __init kirkwood_pcm_init(void) 390module_platform_driver(kirkwood_pcm_driver);
392{
393 return platform_driver_register(&kirkwood_pcm_driver);
394}
395module_init(kirkwood_pcm_init);
396
397static void __exit kirkwood_pcm_exit(void)
398{
399 platform_driver_unregister(&kirkwood_pcm_driver);
400}
401module_exit(kirkwood_pcm_exit);
402 391
403MODULE_AUTHOR("Arnaud Patard <arnaud.patard@rtp-net.org>"); 392MODULE_AUTHOR("Arnaud Patard <arnaud.patard@rtp-net.org>");
404MODULE_DESCRIPTION("Marvell Kirkwood Audio DMA module"); 393MODULE_DESCRIPTION("Marvell Kirkwood Audio DMA module");
diff --git a/sound/soc/kirkwood/kirkwood-i2s.c b/sound/soc/kirkwood/kirkwood-i2s.c
index 715e841c050..3cb9aa4299d 100644
--- a/sound/soc/kirkwood/kirkwood-i2s.c
+++ b/sound/soc/kirkwood/kirkwood-i2s.c
@@ -373,7 +373,7 @@ static int kirkwood_i2s_remove(struct snd_soc_dai *dai)
373 return 0; 373 return 0;
374} 374}
375 375
376static struct snd_soc_dai_ops kirkwood_i2s_dai_ops = { 376static const struct snd_soc_dai_ops kirkwood_i2s_dai_ops = {
377 .startup = kirkwood_i2s_startup, 377 .startup = kirkwood_i2s_startup,
378 .trigger = kirkwood_i2s_trigger, 378 .trigger = kirkwood_i2s_trigger,
379 .hw_params = kirkwood_i2s_hw_params, 379 .hw_params = kirkwood_i2s_hw_params,
@@ -441,13 +441,12 @@ static __devinit int kirkwood_i2s_dev_probe(struct platform_device *pdev)
441 goto err_ioremap; 441 goto err_ioremap;
442 } 442 }
443 443
444 if (!data || !data->dram) { 444 if (!data) {
445 dev_err(&pdev->dev, "no platform data ?!\n"); 445 dev_err(&pdev->dev, "no platform data ?!\n");
446 err = -EINVAL; 446 err = -EINVAL;
447 goto err_ioremap; 447 goto err_ioremap;
448 } 448 }
449 449
450 priv->dram = data->dram;
451 priv->burst = data->burst; 450 priv->burst = data->burst;
452 451
453 return snd_soc_register_dai(&pdev->dev, &kirkwood_i2s_dai); 452 return snd_soc_register_dai(&pdev->dev, &kirkwood_i2s_dai);
@@ -483,17 +482,7 @@ static struct platform_driver kirkwood_i2s_driver = {
483 }, 482 },
484}; 483};
485 484
486static int __init kirkwood_i2s_init(void) 485module_platform_driver(kirkwood_i2s_driver);
487{
488 return platform_driver_register(&kirkwood_i2s_driver);
489}
490module_init(kirkwood_i2s_init);
491
492static void __exit kirkwood_i2s_exit(void)
493{
494 platform_driver_unregister(&kirkwood_i2s_driver);
495}
496module_exit(kirkwood_i2s_exit);
497 486
498/* Module information */ 487/* Module information */
499MODULE_AUTHOR("Arnaud Patard, <arnaud.patard@rtp-net.org>"); 488MODULE_AUTHOR("Arnaud Patard, <arnaud.patard@rtp-net.org>");
diff --git a/sound/soc/kirkwood/kirkwood-openrd.c b/sound/soc/kirkwood/kirkwood-openrd.c
index d863afb3ee5..55d2ed3df30 100644
--- a/sound/soc/kirkwood/kirkwood-openrd.c
+++ b/sound/soc/kirkwood/kirkwood-openrd.c
@@ -26,18 +26,7 @@ static int openrd_client_hw_params(struct snd_pcm_substream *substream,
26{ 26{
27 struct snd_soc_pcm_runtime *rtd = substream->private_data; 27 struct snd_soc_pcm_runtime *rtd = substream->private_data;
28 struct snd_soc_dai *codec_dai = rtd->codec_dai; 28 struct snd_soc_dai *codec_dai = rtd->codec_dai;
29 struct snd_soc_dai *cpu_dai = rtd->cpu_dai; 29 unsigned int freq;
30 int ret;
31 unsigned int freq, fmt;
32
33 fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBS_CFS;
34 ret = snd_soc_dai_set_fmt(cpu_dai, fmt);
35 if (ret < 0)
36 return ret;
37
38 ret = snd_soc_dai_set_fmt(codec_dai, fmt);
39 if (ret < 0)
40 return ret;
41 30
42 switch (params_rate(params)) { 31 switch (params_rate(params)) {
43 default: 32 default:
@@ -69,6 +58,7 @@ static struct snd_soc_dai_link openrd_client_dai[] = {
69 .platform_name = "kirkwood-pcm-audio", 58 .platform_name = "kirkwood-pcm-audio",
70 .codec_dai_name = "cs42l51-hifi", 59 .codec_dai_name = "cs42l51-hifi",
71 .codec_name = "cs42l51-codec.0-004a", 60 .codec_name = "cs42l51-codec.0-004a",
61 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBS_CFS,
72 .ops = &openrd_client_ops, 62 .ops = &openrd_client_ops,
73}, 63},
74}; 64};
@@ -76,6 +66,7 @@ static struct snd_soc_dai_link openrd_client_dai[] = {
76 66
77static struct snd_soc_card openrd_client = { 67static struct snd_soc_card openrd_client = {
78 .name = "OpenRD Client", 68 .name = "OpenRD Client",
69 .owner = THIS_MODULE,
79 .dai_link = openrd_client_dai, 70 .dai_link = openrd_client_dai,
80 .num_links = ARRAY_SIZE(openrd_client_dai), 71 .num_links = ARRAY_SIZE(openrd_client_dai),
81}; 72};
diff --git a/sound/soc/kirkwood/kirkwood-t5325.c b/sound/soc/kirkwood/kirkwood-t5325.c
index c772b3cf403..b47cc4e9b74 100644
--- a/sound/soc/kirkwood/kirkwood-t5325.c
+++ b/sound/soc/kirkwood/kirkwood-t5325.c
@@ -25,18 +25,7 @@ static int t5325_hw_params(struct snd_pcm_substream *substream,
25{ 25{
26 struct snd_soc_pcm_runtime *rtd = substream->private_data; 26 struct snd_soc_pcm_runtime *rtd = substream->private_data;
27 struct snd_soc_dai *codec_dai = rtd->codec_dai; 27 struct snd_soc_dai *codec_dai = rtd->codec_dai;
28 struct snd_soc_dai *cpu_dai = rtd->cpu_dai; 28 unsigned int freq;
29 int ret;
30 unsigned int freq, fmt;
31
32 fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBS_CFS;
33 ret = snd_soc_dai_set_fmt(cpu_dai, fmt);
34 if (ret < 0)
35 return ret;
36
37 ret = snd_soc_dai_set_fmt(codec_dai, fmt);
38 if (ret < 0)
39 return ret;
40 29
41 freq = params_rate(params) * 256; 30 freq = params_rate(params) * 256;
42 31
@@ -70,11 +59,6 @@ static int t5325_dai_init(struct snd_soc_pcm_runtime *rtd)
70 struct snd_soc_codec *codec = rtd->codec; 59 struct snd_soc_codec *codec = rtd->codec;
71 struct snd_soc_dapm_context *dapm = &codec->dapm; 60 struct snd_soc_dapm_context *dapm = &codec->dapm;
72 61
73 snd_soc_dapm_new_controls(dapm, t5325_dapm_widgets,
74 ARRAY_SIZE(t5325_dapm_widgets));
75
76 snd_soc_dapm_add_routes(dapm, t5325_route, ARRAY_SIZE(t5325_route));
77
78 snd_soc_dapm_enable_pin(dapm, "Mic Jack"); 62 snd_soc_dapm_enable_pin(dapm, "Mic Jack");
79 snd_soc_dapm_enable_pin(dapm, "Headphone Jack"); 63 snd_soc_dapm_enable_pin(dapm, "Headphone Jack");
80 snd_soc_dapm_enable_pin(dapm, "Speaker"); 64 snd_soc_dapm_enable_pin(dapm, "Speaker");
@@ -90,6 +74,7 @@ static struct snd_soc_dai_link t5325_dai[] = {
90 .platform_name = "kirkwood-pcm-audio", 74 .platform_name = "kirkwood-pcm-audio",
91 .codec_dai_name = "alc5621-hifi", 75 .codec_dai_name = "alc5621-hifi",
92 .codec_name = "alc562x-codec.0-001a", 76 .codec_name = "alc562x-codec.0-001a",
77 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBS_CFS,
93 .ops = &t5325_ops, 78 .ops = &t5325_ops,
94 .init = t5325_dai_init, 79 .init = t5325_dai_init,
95}, 80},
@@ -98,8 +83,14 @@ static struct snd_soc_dai_link t5325_dai[] = {
98 83
99static struct snd_soc_card t5325 = { 84static struct snd_soc_card t5325 = {
100 .name = "t5325", 85 .name = "t5325",
86 .owner = THIS_MODULE,
101 .dai_link = t5325_dai, 87 .dai_link = t5325_dai,
102 .num_links = ARRAY_SIZE(t5325_dai), 88 .num_links = ARRAY_SIZE(t5325_dai),
89
90 .dapm_widgets = t5325_dapm_widgets,
91 .num_dapm_widgets = ARRAY_SIZE(t5325_dapm_widgets),
92 .dapm_routes = t5325_route,
93 .num_dapm_routes = ARRAY_SIZE(t5325_route),
103}; 94};
104 95
105static struct platform_device *t5325_snd_device; 96static struct platform_device *t5325_snd_device;
diff --git a/sound/soc/kirkwood/kirkwood.h b/sound/soc/kirkwood/kirkwood.h
index bb6e6a5648c..9047436b393 100644
--- a/sound/soc/kirkwood/kirkwood.h
+++ b/sound/soc/kirkwood/kirkwood.h
@@ -123,7 +123,6 @@ struct kirkwood_dma_data {
123 void __iomem *io; 123 void __iomem *io;
124 int irq; 124 int irq;
125 int burst; 125 int burst;
126 struct mbus_dram_target_info *dram;
127}; 126};
128 127
129#endif 128#endif
diff --git a/sound/soc/mid-x86/Kconfig b/sound/soc/mid-x86/Kconfig
index 29350428f1c..61c10bf503d 100644
--- a/sound/soc/mid-x86/Kconfig
+++ b/sound/soc/mid-x86/Kconfig
@@ -1,7 +1,6 @@
1config SND_MFLD_MACHINE 1config SND_MFLD_MACHINE
2 tristate "SOC Machine Audio driver for Intel Medfield MID platform" 2 tristate "SOC Machine Audio driver for Intel Medfield MID platform"
3 depends on INTEL_SCU_IPC 3 depends on INTEL_SCU_IPC
4 depends on SND_INTEL_SST
5 select SND_SOC_SN95031 4 select SND_SOC_SN95031
6 select SND_SST_PLATFORM 5 select SND_SST_PLATFORM
7 help 6 help
diff --git a/sound/soc/mid-x86/mfld_machine.c b/sound/soc/mid-x86/mfld_machine.c
index cca693ae1bd..6f77eef0f13 100644
--- a/sound/soc/mid-x86/mfld_machine.c
+++ b/sound/soc/mid-x86/mfld_machine.c
@@ -281,7 +281,7 @@ static int mfld_init(struct snd_soc_pcm_runtime *runtime)
281 return ret_val; 281 return ret_val;
282} 282}
283 283
284struct snd_soc_dai_link mfld_msic_dailink[] = { 284static struct snd_soc_dai_link mfld_msic_dailink[] = {
285 { 285 {
286 .name = "Medfield Headset", 286 .name = "Medfield Headset",
287 .stream_name = "Headset", 287 .stream_name = "Headset",
@@ -323,6 +323,7 @@ struct snd_soc_dai_link mfld_msic_dailink[] = {
323/* SoC card */ 323/* SoC card */
324static struct snd_soc_card snd_soc_card_mfld = { 324static struct snd_soc_card snd_soc_card_mfld = {
325 .name = "medfield_audio", 325 .name = "medfield_audio",
326 .owner = THIS_MODULE,
326 .dai_link = mfld_msic_dailink, 327 .dai_link = mfld_msic_dailink,
327 .num_links = ARRAY_SIZE(mfld_msic_dailink), 328 .num_links = ARRAY_SIZE(mfld_msic_dailink),
328}; 329};
@@ -428,19 +429,7 @@ static struct platform_driver snd_mfld_mc_driver = {
428 .remove = __devexit_p(snd_mfld_mc_remove), 429 .remove = __devexit_p(snd_mfld_mc_remove),
429}; 430};
430 431
431static int __init snd_mfld_driver_init(void) 432module_platform_driver(snd_mfld_mc_driver);
432{
433 pr_debug("snd_mfld_driver_init called\n");
434 return platform_driver_register(&snd_mfld_mc_driver);
435}
436module_init(snd_mfld_driver_init);
437
438static void __exit snd_mfld_driver_exit(void)
439{
440 pr_debug("snd_mfld_driver_exit called\n");
441 platform_driver_unregister(&snd_mfld_mc_driver);
442}
443module_exit(snd_mfld_driver_exit);
444 433
445MODULE_DESCRIPTION("ASoC Intel(R) MID Machine driver"); 434MODULE_DESCRIPTION("ASoC Intel(R) MID Machine driver");
446MODULE_AUTHOR("Vinod Koul <vinod.koul@intel.com>"); 435MODULE_AUTHOR("Vinod Koul <vinod.koul@intel.com>");
diff --git a/sound/soc/mid-x86/sst_platform.c b/sound/soc/mid-x86/sst_platform.c
index 23057020aa0..d34563b12c3 100644
--- a/sound/soc/mid-x86/sst_platform.c
+++ b/sound/soc/mid-x86/sst_platform.c
@@ -32,10 +32,51 @@
32#include <sound/pcm.h> 32#include <sound/pcm.h>
33#include <sound/pcm_params.h> 33#include <sound/pcm_params.h>
34#include <sound/soc.h> 34#include <sound/soc.h>
35#include "../../../drivers/staging/intel_sst/intel_sst_ioctl.h"
36#include "../../../drivers/staging/intel_sst/intel_sst.h"
37#include "sst_platform.h" 35#include "sst_platform.h"
38 36
37static struct sst_device *sst;
38static DEFINE_MUTEX(sst_lock);
39
40int sst_register_dsp(struct sst_device *dev)
41{
42 BUG_ON(!dev);
43 if (!try_module_get(dev->dev->driver->owner))
44 return -ENODEV;
45 mutex_lock(&sst_lock);
46 if (sst) {
47 pr_err("we already have a device %s\n", sst->name);
48 module_put(dev->dev->driver->owner);
49 mutex_unlock(&sst_lock);
50 return -EEXIST;
51 }
52 pr_debug("registering device %s\n", dev->name);
53 sst = dev;
54 mutex_unlock(&sst_lock);
55 return 0;
56}
57EXPORT_SYMBOL_GPL(sst_register_dsp);
58
59int sst_unregister_dsp(struct sst_device *dev)
60{
61 BUG_ON(!dev);
62 if (dev != sst)
63 return -EINVAL;
64
65 mutex_lock(&sst_lock);
66
67 if (!sst) {
68 mutex_unlock(&sst_lock);
69 return -EIO;
70 }
71
72 module_put(sst->dev->driver->owner);
73 pr_debug("unreg %s\n", sst->name);
74 sst = NULL;
75 mutex_unlock(&sst_lock);
76 return 0;
77}
78EXPORT_SYMBOL_GPL(sst_unregister_dsp);
79
39static struct snd_pcm_hardware sst_platform_pcm_hw = { 80static struct snd_pcm_hardware sst_platform_pcm_hw = {
40 .info = (SNDRV_PCM_INFO_INTERLEAVED | 81 .info = (SNDRV_PCM_INFO_INTERLEAVED |
41 SNDRV_PCM_INFO_DOUBLE | 82 SNDRV_PCM_INFO_DOUBLE |
@@ -135,37 +176,34 @@ static inline int sst_get_stream_status(struct sst_runtime_stream *stream)
135} 176}
136 177
137static void sst_fill_pcm_params(struct snd_pcm_substream *substream, 178static void sst_fill_pcm_params(struct snd_pcm_substream *substream,
138 struct snd_sst_stream_params *param) 179 struct sst_pcm_params *param)
139{ 180{
140 181
141 param->uc.pcm_params.codec = SST_CODEC_TYPE_PCM; 182 param->codec = SST_CODEC_TYPE_PCM;
142 param->uc.pcm_params.num_chan = (u8) substream->runtime->channels; 183 param->num_chan = (u8) substream->runtime->channels;
143 param->uc.pcm_params.pcm_wd_sz = substream->runtime->sample_bits; 184 param->pcm_wd_sz = substream->runtime->sample_bits;
144 param->uc.pcm_params.reserved = 0; 185 param->reserved = 0;
145 param->uc.pcm_params.sfreq = substream->runtime->rate; 186 param->sfreq = substream->runtime->rate;
146 param->uc.pcm_params.ring_buffer_size = 187 param->ring_buffer_size = snd_pcm_lib_buffer_bytes(substream);
147 snd_pcm_lib_buffer_bytes(substream); 188 param->period_count = substream->runtime->period_size;
148 param->uc.pcm_params.period_count = substream->runtime->period_size; 189 param->ring_buffer_addr = virt_to_phys(substream->dma_buffer.area);
149 param->uc.pcm_params.ring_buffer_addr = 190 pr_debug("period_cnt = %d\n", param->period_count);
150 virt_to_phys(substream->dma_buffer.area); 191 pr_debug("sfreq= %d, wd_sz = %d\n", param->sfreq, param->pcm_wd_sz);
151 pr_debug("period_cnt = %d\n", param->uc.pcm_params.period_count);
152 pr_debug("sfreq= %d, wd_sz = %d\n",
153 param->uc.pcm_params.sfreq, param->uc.pcm_params.pcm_wd_sz);
154} 192}
155 193
156static int sst_platform_alloc_stream(struct snd_pcm_substream *substream) 194static int sst_platform_alloc_stream(struct snd_pcm_substream *substream)
157{ 195{
158 struct sst_runtime_stream *stream = 196 struct sst_runtime_stream *stream =
159 substream->runtime->private_data; 197 substream->runtime->private_data;
160 struct snd_sst_stream_params param = {{{0,},},}; 198 struct sst_pcm_params param = {0};
161 struct snd_sst_params str_params = {0}; 199 struct sst_stream_params str_params = {0};
162 int ret_val; 200 int ret_val;
163 201
164 /* set codec params and inform SST driver the same */ 202 /* set codec params and inform SST driver the same */
165 sst_fill_pcm_params(substream, &param); 203 sst_fill_pcm_params(substream, &param);
166 substream->runtime->dma_area = substream->dma_buffer.area; 204 substream->runtime->dma_area = substream->dma_buffer.area;
167 str_params.sparams = param; 205 str_params.sparams = param;
168 str_params.codec = param.uc.pcm_params.codec; 206 str_params.codec = param.codec;
169 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { 207 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
170 str_params.ops = STREAM_OPS_PLAYBACK; 208 str_params.ops = STREAM_OPS_PLAYBACK;
171 str_params.device_type = substream->pcm->device + 1; 209 str_params.device_type = substream->pcm->device + 1;
@@ -177,7 +215,7 @@ static int sst_platform_alloc_stream(struct snd_pcm_substream *substream)
177 pr_debug("Capture stream,Device %d\n", 215 pr_debug("Capture stream,Device %d\n",
178 substream->pcm->device); 216 substream->pcm->device);
179 } 217 }
180 ret_val = stream->sstdrv_ops->pcm_control->open(&str_params); 218 ret_val = stream->ops->open(&str_params);
181 pr_debug("SST_SND_PLAY/CAPTURE ret_val = %x\n", ret_val); 219 pr_debug("SST_SND_PLAY/CAPTURE ret_val = %x\n", ret_val);
182 if (ret_val < 0) 220 if (ret_val < 0)
183 return ret_val; 221 return ret_val;
@@ -216,7 +254,7 @@ static int sst_platform_init_stream(struct snd_pcm_substream *substream)
216 stream->stream_info.mad_substream = substream; 254 stream->stream_info.mad_substream = substream;
217 stream->stream_info.buffer_ptr = 0; 255 stream->stream_info.buffer_ptr = 0;
218 stream->stream_info.sfreq = substream->runtime->rate; 256 stream->stream_info.sfreq = substream->runtime->rate;
219 ret_val = stream->sstdrv_ops->pcm_control->device_control( 257 ret_val = stream->ops->device_control(
220 SST_SND_STREAM_INIT, &stream->stream_info); 258 SST_SND_STREAM_INIT, &stream->stream_info);
221 if (ret_val) 259 if (ret_val)
222 pr_err("control_set ret error %d\n", ret_val); 260 pr_err("control_set ret error %d\n", ret_val);
@@ -229,7 +267,7 @@ static int sst_platform_open(struct snd_pcm_substream *substream)
229{ 267{
230 struct snd_pcm_runtime *runtime = substream->runtime; 268 struct snd_pcm_runtime *runtime = substream->runtime;
231 struct sst_runtime_stream *stream; 269 struct sst_runtime_stream *stream;
232 int ret_val = 0; 270 int ret_val;
233 271
234 pr_debug("sst_platform_open called\n"); 272 pr_debug("sst_platform_open called\n");
235 273
@@ -243,27 +281,27 @@ static int sst_platform_open(struct snd_pcm_substream *substream)
243 if (!stream) 281 if (!stream)
244 return -ENOMEM; 282 return -ENOMEM;
245 spin_lock_init(&stream->status_lock); 283 spin_lock_init(&stream->status_lock);
246 stream->stream_info.str_id = 0; 284
247 sst_set_stream_status(stream, SST_PLATFORM_INIT); 285 /* get the sst ops */
248 stream->stream_info.mad_substream = substream; 286 mutex_lock(&sst_lock);
249 /* allocate memory for SST API set */ 287 if (!sst) {
250 stream->sstdrv_ops = kzalloc(sizeof(*stream->sstdrv_ops), 288 pr_err("no device available to run\n");
251 GFP_KERNEL); 289 mutex_unlock(&sst_lock);
252 if (!stream->sstdrv_ops) {
253 pr_err("sst: mem allocation for ops fail\n");
254 kfree(stream); 290 kfree(stream);
255 return -ENOMEM; 291 return -ENODEV;
256 } 292 }
257 stream->sstdrv_ops->vendor_id = MSIC_VENDOR_ID; 293 if (!try_module_get(sst->dev->driver->owner)) {
258 stream->sstdrv_ops->module_name = SST_CARD_NAMES; 294 mutex_unlock(&sst_lock);
259 /* registering with SST driver to get access to SST APIs to use */
260 ret_val = register_sst_card(stream->sstdrv_ops);
261 if (ret_val) {
262 pr_err("sst: sst card registration failed\n");
263 kfree(stream->sstdrv_ops);
264 kfree(stream); 295 kfree(stream);
265 return ret_val; 296 return -ENODEV;
266 } 297 }
298 stream->ops = sst->ops;
299 mutex_unlock(&sst_lock);
300
301 stream->stream_info.str_id = 0;
302 sst_set_stream_status(stream, SST_PLATFORM_INIT);
303 stream->stream_info.mad_substream = substream;
304 /* allocate memory for SST API set */
267 runtime->private_data = stream; 305 runtime->private_data = stream;
268 306
269 return 0; 307 return 0;
@@ -278,9 +316,8 @@ static int sst_platform_close(struct snd_pcm_substream *substream)
278 stream = substream->runtime->private_data; 316 stream = substream->runtime->private_data;
279 str_id = stream->stream_info.str_id; 317 str_id = stream->stream_info.str_id;
280 if (str_id) 318 if (str_id)
281 ret_val = stream->sstdrv_ops->pcm_control->close(str_id); 319 ret_val = stream->ops->close(str_id);
282 unregister_sst_card(stream->sstdrv_ops); 320 module_put(sst->dev->driver->owner);
283 kfree(stream->sstdrv_ops);
284 kfree(stream); 321 kfree(stream);
285 return ret_val; 322 return ret_val;
286} 323}
@@ -294,8 +331,8 @@ static int sst_platform_pcm_prepare(struct snd_pcm_substream *substream)
294 stream = substream->runtime->private_data; 331 stream = substream->runtime->private_data;
295 str_id = stream->stream_info.str_id; 332 str_id = stream->stream_info.str_id;
296 if (stream->stream_info.str_id) { 333 if (stream->stream_info.str_id) {
297 ret_val = stream->sstdrv_ops->pcm_control->device_control( 334 ret_val = stream->ops->device_control(
298 SST_SND_DROP, &str_id); 335 SST_SND_DROP, &str_id);
299 return ret_val; 336 return ret_val;
300 } 337 }
301 338
@@ -347,8 +384,7 @@ static int sst_platform_pcm_trigger(struct snd_pcm_substream *substream,
347 default: 384 default:
348 return -EINVAL; 385 return -EINVAL;
349 } 386 }
350 ret_val = stream->sstdrv_ops->pcm_control->device_control(str_cmd, 387 ret_val = stream->ops->device_control(str_cmd, &str_id);
351 &str_id);
352 if (!ret_val) 388 if (!ret_val)
353 sst_set_stream_status(stream, status); 389 sst_set_stream_status(stream, status);
354 390
@@ -368,7 +404,7 @@ static snd_pcm_uframes_t sst_platform_pcm_pointer
368 if (status == SST_PLATFORM_INIT) 404 if (status == SST_PLATFORM_INIT)
369 return 0; 405 return 0;
370 str_info = &stream->stream_info; 406 str_info = &stream->stream_info;
371 ret_val = stream->sstdrv_ops->pcm_control->device_control( 407 ret_val = stream->ops->device_control(
372 SST_SND_BUFFER_POINTER, str_info); 408 SST_SND_BUFFER_POINTER, str_info);
373 if (ret_val) { 409 if (ret_val) {
374 pr_err("sst: error code = %d\n", ret_val); 410 pr_err("sst: error code = %d\n", ret_val);
@@ -408,15 +444,14 @@ static void sst_pcm_free(struct snd_pcm *pcm)
408 snd_pcm_lib_preallocate_free_for_all(pcm); 444 snd_pcm_lib_preallocate_free_for_all(pcm);
409} 445}
410 446
411int sst_pcm_new(struct snd_soc_pcm_runtime *rtd) 447static int sst_pcm_new(struct snd_soc_pcm_runtime *rtd)
412{ 448{
413 struct snd_soc_dai *dai = rtd->cpu_dai;
414 struct snd_pcm *pcm = rtd->pcm; 449 struct snd_pcm *pcm = rtd->pcm;
415 int retval = 0; 450 int retval = 0;
416 451
417 pr_debug("sst_pcm_new called\n"); 452 pr_debug("sst_pcm_new called\n");
418 if (dai->driver->playback.channels_min || 453 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream ||
419 dai->driver->capture.channels_min) { 454 pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) {
420 retval = snd_pcm_lib_preallocate_pages_for_all(pcm, 455 retval = snd_pcm_lib_preallocate_pages_for_all(pcm,
421 SNDRV_DMA_TYPE_CONTINUOUS, 456 SNDRV_DMA_TYPE_CONTINUOUS,
422 snd_dma_continuous_data(GFP_KERNEL), 457 snd_dma_continuous_data(GFP_KERNEL),
@@ -428,7 +463,7 @@ int sst_pcm_new(struct snd_soc_pcm_runtime *rtd)
428 } 463 }
429 return retval; 464 return retval;
430} 465}
431struct snd_soc_platform_driver sst_soc_platform_drv = { 466static struct snd_soc_platform_driver sst_soc_platform_drv = {
432 .ops = &sst_platform_ops, 467 .ops = &sst_platform_ops,
433 .pcm_new = sst_pcm_new, 468 .pcm_new = sst_pcm_new,
434 .pcm_free = sst_pcm_free, 469 .pcm_free = sst_pcm_free,
@@ -439,6 +474,7 @@ static int sst_platform_probe(struct platform_device *pdev)
439 int ret; 474 int ret;
440 475
441 pr_debug("sst_platform_probe called\n"); 476 pr_debug("sst_platform_probe called\n");
477 sst = NULL;
442 ret = snd_soc_register_platform(&pdev->dev, &sst_soc_platform_drv); 478 ret = snd_soc_register_platform(&pdev->dev, &sst_soc_platform_drv);
443 if (ret) { 479 if (ret) {
444 pr_err("registering soc platform failed\n"); 480 pr_err("registering soc platform failed\n");
@@ -472,19 +508,7 @@ static struct platform_driver sst_platform_driver = {
472 .remove = sst_platform_remove, 508 .remove = sst_platform_remove,
473}; 509};
474 510
475static int __init sst_soc_platform_init(void) 511module_platform_driver(sst_platform_driver);
476{
477 pr_debug("sst_soc_platform_init called\n");
478 return platform_driver_register(&sst_platform_driver);
479}
480module_init(sst_soc_platform_init);
481
482static void __exit sst_soc_platform_exit(void)
483{
484 platform_driver_unregister(&sst_platform_driver);
485 pr_debug("sst_soc_platform_exit success\n");
486}
487module_exit(sst_soc_platform_exit);
488 512
489MODULE_DESCRIPTION("ASoC Intel(R) MID Platform driver"); 513MODULE_DESCRIPTION("ASoC Intel(R) MID Platform driver");
490MODULE_AUTHOR("Vinod Koul <vinod.koul@intel.com>"); 514MODULE_AUTHOR("Vinod Koul <vinod.koul@intel.com>");
diff --git a/sound/soc/mid-x86/sst_platform.h b/sound/soc/mid-x86/sst_platform.h
index df370286694..f04f4f72daa 100644
--- a/sound/soc/mid-x86/sst_platform.h
+++ b/sound/soc/mid-x86/sst_platform.h
@@ -42,14 +42,14 @@
42#define SST_MIN_PERIODS 2 42#define SST_MIN_PERIODS 2
43#define SST_MAX_PERIODS (1024*2) 43#define SST_MAX_PERIODS (1024*2)
44#define SST_FIFO_SIZE 0 44#define SST_FIFO_SIZE 0
45#define SST_CARD_NAMES "intel_mid_card" 45#define SST_CODEC_TYPE_PCM 1
46#define MSIC_VENDOR_ID 3
47 46
48struct sst_runtime_stream { 47struct pcm_stream_info {
49 int stream_status; 48 int str_id;
50 struct pcm_stream_info stream_info; 49 void *mad_substream;
51 struct intel_sst_card_ops *sstdrv_ops; 50 void (*period_elapsed) (void *mad_substream);
52 spinlock_t status_lock; 51 unsigned long long buffer_ptr;
52 int sfreq;
53}; 53};
54 54
55enum sst_drv_status { 55enum sst_drv_status {
@@ -60,4 +60,72 @@ enum sst_drv_status {
60 SST_PLATFORM_DROPPED, 60 SST_PLATFORM_DROPPED,
61}; 61};
62 62
63enum sst_controls {
64 SST_SND_ALLOC = 0x00,
65 SST_SND_PAUSE = 0x01,
66 SST_SND_RESUME = 0x02,
67 SST_SND_DROP = 0x03,
68 SST_SND_FREE = 0x04,
69 SST_SND_BUFFER_POINTER = 0x05,
70 SST_SND_STREAM_INIT = 0x06,
71 SST_SND_START = 0x07,
72 SST_MAX_CONTROLS = 0x07,
73};
74
75enum sst_stream_ops {
76 STREAM_OPS_PLAYBACK = 0,
77 STREAM_OPS_CAPTURE,
78};
79
80enum sst_audio_device_type {
81 SND_SST_DEVICE_HEADSET = 1,
82 SND_SST_DEVICE_IHF,
83 SND_SST_DEVICE_VIBRA,
84 SND_SST_DEVICE_HAPTIC,
85 SND_SST_DEVICE_CAPTURE,
86};
87
88/* PCM Parameters */
89struct sst_pcm_params {
90 u16 codec; /* codec type */
91 u8 num_chan; /* 1=Mono, 2=Stereo */
92 u8 pcm_wd_sz; /* 16/24 - bit*/
93 u32 reserved; /* Bitrate in bits per second */
94 u32 sfreq; /* Sampling rate in Hz */
95 u32 ring_buffer_size;
96 u32 period_count; /* period elapsed in samples*/
97 u32 ring_buffer_addr;
98};
99
100struct sst_stream_params {
101 u32 result;
102 u32 stream_id;
103 u8 codec;
104 u8 ops;
105 u8 stream_type;
106 u8 device_type;
107 struct sst_pcm_params sparams;
108};
109
110struct sst_ops {
111 int (*open) (struct sst_stream_params *str_param);
112 int (*device_control) (int cmd, void *arg);
113 int (*close) (unsigned int str_id);
114};
115
116struct sst_runtime_stream {
117 int stream_status;
118 struct pcm_stream_info stream_info;
119 struct sst_ops *ops;
120 spinlock_t status_lock;
121};
122
123struct sst_device {
124 char *name;
125 struct device *dev;
126 struct sst_ops *ops;
127};
128
129int sst_register_dsp(struct sst_device *sst);
130int sst_unregister_dsp(struct sst_device *sst);
63#endif 131#endif
diff --git a/sound/soc/mxs/mxs-pcm.c b/sound/soc/mxs/mxs-pcm.c
index dea5aa4aa64..0e12f4e0a76 100644
--- a/sound/soc/mxs/mxs-pcm.c
+++ b/sound/soc/mxs/mxs-pcm.c
@@ -346,14 +346,7 @@ static struct platform_driver mxs_pcm_driver = {
346 .remove = __devexit_p(mxs_soc_platform_remove), 346 .remove = __devexit_p(mxs_soc_platform_remove),
347}; 347};
348 348
349static int __init snd_mxs_pcm_init(void) 349module_platform_driver(mxs_pcm_driver);
350{
351 return platform_driver_register(&mxs_pcm_driver);
352}
353module_init(snd_mxs_pcm_init);
354 350
355static void __exit snd_mxs_pcm_exit(void) 351MODULE_LICENSE("GPL");
356{ 352MODULE_ALIAS("platform:mxs-pcm-audio");
357 platform_driver_unregister(&mxs_pcm_driver);
358}
359module_exit(snd_mxs_pcm_exit);
diff --git a/sound/soc/mxs/mxs-saif.c b/sound/soc/mxs/mxs-saif.c
index 76dc74d24fc..1a13ab8b8e0 100644
--- a/sound/soc/mxs/mxs-saif.c
+++ b/sound/soc/mxs/mxs-saif.c
@@ -550,7 +550,7 @@ static int mxs_saif_trigger(struct snd_pcm_substream *substream, int cmd,
550 (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \ 550 (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE | \
551 SNDRV_PCM_FMTBIT_S24_LE) 551 SNDRV_PCM_FMTBIT_S24_LE)
552 552
553static struct snd_soc_dai_ops mxs_saif_dai_ops = { 553static const struct snd_soc_dai_ops mxs_saif_dai_ops = {
554 .startup = mxs_saif_startup, 554 .startup = mxs_saif_startup,
555 .trigger = mxs_saif_trigger, 555 .trigger = mxs_saif_trigger,
556 .prepare = mxs_saif_prepare, 556 .prepare = mxs_saif_prepare,
@@ -781,18 +781,8 @@ static struct platform_driver mxs_saif_driver = {
781 }, 781 },
782}; 782};
783 783
784static int __init mxs_saif_init(void) 784module_platform_driver(mxs_saif_driver);
785{
786 return platform_driver_register(&mxs_saif_driver);
787}
788
789static void __exit mxs_saif_exit(void)
790{
791 platform_driver_unregister(&mxs_saif_driver);
792}
793 785
794module_init(mxs_saif_init);
795module_exit(mxs_saif_exit);
796MODULE_AUTHOR("Freescale Semiconductor, Inc."); 786MODULE_AUTHOR("Freescale Semiconductor, Inc.");
797MODULE_DESCRIPTION("MXS ASoC SAIF driver"); 787MODULE_DESCRIPTION("MXS ASoC SAIF driver");
798MODULE_LICENSE("GPL"); 788MODULE_LICENSE("GPL");
diff --git a/sound/soc/mxs/mxs-sgtl5000.c b/sound/soc/mxs/mxs-sgtl5000.c
index 7fbeaec06eb..60f052b7cf2 100644
--- a/sound/soc/mxs/mxs-sgtl5000.c
+++ b/sound/soc/mxs/mxs-sgtl5000.c
@@ -105,6 +105,7 @@ static struct snd_soc_dai_link mxs_sgtl5000_dai[] = {
105 105
106static struct snd_soc_card mxs_sgtl5000 = { 106static struct snd_soc_card mxs_sgtl5000 = {
107 .name = "mxs_sgtl5000", 107 .name = "mxs_sgtl5000",
108 .owner = THIS_MODULE,
108 .dai_link = mxs_sgtl5000_dai, 109 .dai_link = mxs_sgtl5000_dai,
109 .num_links = ARRAY_SIZE(mxs_sgtl5000_dai), 110 .num_links = ARRAY_SIZE(mxs_sgtl5000_dai),
110}; 111};
@@ -156,18 +157,9 @@ static struct platform_driver mxs_sgtl5000_audio_driver = {
156 .remove = __devexit_p(mxs_sgtl5000_remove), 157 .remove = __devexit_p(mxs_sgtl5000_remove),
157}; 158};
158 159
159static int __init mxs_sgtl5000_init(void) 160module_platform_driver(mxs_sgtl5000_audio_driver);
160{
161 return platform_driver_register(&mxs_sgtl5000_audio_driver);
162}
163module_init(mxs_sgtl5000_init);
164
165static void __exit mxs_sgtl5000_exit(void)
166{
167 platform_driver_unregister(&mxs_sgtl5000_audio_driver);
168}
169module_exit(mxs_sgtl5000_exit);
170 161
171MODULE_AUTHOR("Freescale Semiconductor, Inc."); 162MODULE_AUTHOR("Freescale Semiconductor, Inc.");
172MODULE_DESCRIPTION("MXS ALSA SoC Machine driver"); 163MODULE_DESCRIPTION("MXS ALSA SoC Machine driver");
173MODULE_LICENSE("GPL"); 164MODULE_LICENSE("GPL");
165MODULE_ALIAS("platform:mxs-sgtl5000");
diff --git a/sound/soc/nuc900/nuc900-ac97.c b/sound/soc/nuc900/nuc900-ac97.c
index 9c0edad90d8..f0c790451bd 100644
--- a/sound/soc/nuc900/nuc900-ac97.c
+++ b/sound/soc/nuc900/nuc900-ac97.c
@@ -291,7 +291,7 @@ static int nuc900_ac97_remove(struct snd_soc_dai *dai)
291 return 0; 291 return 0;
292} 292}
293 293
294static struct snd_soc_dai_ops nuc900_ac97_dai_ops = { 294static const struct snd_soc_dai_ops nuc900_ac97_dai_ops = {
295 .trigger = nuc900_ac97_trigger, 295 .trigger = nuc900_ac97_trigger,
296}; 296};
297 297
@@ -405,18 +405,7 @@ static struct platform_driver nuc900_ac97_driver = {
405 .remove = __devexit_p(nuc900_ac97_drvremove), 405 .remove = __devexit_p(nuc900_ac97_drvremove),
406}; 406};
407 407
408static int __init nuc900_ac97_init(void) 408module_platform_driver(nuc900_ac97_driver);
409{
410 return platform_driver_register(&nuc900_ac97_driver);
411}
412
413static void __exit nuc900_ac97_exit(void)
414{
415 platform_driver_unregister(&nuc900_ac97_driver);
416}
417
418module_init(nuc900_ac97_init);
419module_exit(nuc900_ac97_exit);
420 409
421MODULE_AUTHOR("Wan ZongShun <mcuos.com@gmail.com>"); 410MODULE_AUTHOR("Wan ZongShun <mcuos.com@gmail.com>");
422MODULE_DESCRIPTION("NUC900 AC97 SoC driver!"); 411MODULE_DESCRIPTION("NUC900 AC97 SoC driver!");
diff --git a/sound/soc/nuc900/nuc900-audio.c b/sound/soc/nuc900/nuc900-audio.c
index 38a2d0d883b..2f6e6fd6e05 100644
--- a/sound/soc/nuc900/nuc900-audio.c
+++ b/sound/soc/nuc900/nuc900-audio.c
@@ -32,6 +32,7 @@ static struct snd_soc_dai_link nuc900evb_ac97_dai = {
32 32
33static struct snd_soc_card nuc900evb_audio_machine = { 33static struct snd_soc_card nuc900evb_audio_machine = {
34 .name = "NUC900EVB_AC97", 34 .name = "NUC900EVB_AC97",
35 .owner = THIS_MODULE,
35 .dai_link = &nuc900evb_ac97_dai, 36 .dai_link = &nuc900evb_ac97_dai,
36 .num_links = 1, 37 .num_links = 1,
37}; 38};
diff --git a/sound/soc/nuc900/nuc900-pcm.c b/sound/soc/nuc900/nuc900-pcm.c
index ae8d6806966..37585b47f4e 100644
--- a/sound/soc/nuc900/nuc900-pcm.c
+++ b/sound/soc/nuc900/nuc900-pcm.c
@@ -358,17 +358,7 @@ static struct platform_driver nuc900_pcm_driver = {
358 .remove = __devexit_p(nuc900_soc_platform_remove), 358 .remove = __devexit_p(nuc900_soc_platform_remove),
359}; 359};
360 360
361static int __init nuc900_pcm_init(void) 361module_platform_driver(nuc900_pcm_driver);
362{
363 return platform_driver_register(&nuc900_pcm_driver);
364}
365module_init(nuc900_pcm_init);
366
367static void __exit nuc900_pcm_exit(void)
368{
369 platform_driver_unregister(&nuc900_pcm_driver);
370}
371module_exit(nuc900_pcm_exit);
372 362
373MODULE_AUTHOR("Wan ZongShun, <mcuos.com@gmail.com>"); 363MODULE_AUTHOR("Wan ZongShun, <mcuos.com@gmail.com>");
374MODULE_DESCRIPTION("nuc900 Audio DMA module"); 364MODULE_DESCRIPTION("nuc900 Audio DMA module");
diff --git a/sound/soc/omap/Kconfig b/sound/soc/omap/Kconfig
index fe83d0d176b..fb1bf2581ef 100644
--- a/sound/soc/omap/Kconfig
+++ b/sound/soc/omap/Kconfig
@@ -2,6 +2,9 @@ config SND_OMAP_SOC
2 tristate "SoC Audio for the Texas Instruments OMAP chips" 2 tristate "SoC Audio for the Texas Instruments OMAP chips"
3 depends on ARCH_OMAP 3 depends on ARCH_OMAP
4 4
5config SND_OMAP_SOC_DMIC
6 tristate
7
5config SND_OMAP_SOC_MCBSP 8config SND_OMAP_SOC_MCBSP
6 tristate 9 tristate
7 select OMAP_MCBSP 10 select OMAP_MCBSP
@@ -97,8 +100,10 @@ config SND_OMAP_SOC_SDP3430
97config SND_OMAP_SOC_SDP4430 100config SND_OMAP_SOC_SDP4430
98 tristate "SoC Audio support for Texas Instruments SDP4430" 101 tristate "SoC Audio support for Texas Instruments SDP4430"
99 depends on TWL4030_CORE && SND_OMAP_SOC && MACH_OMAP_4430SDP 102 depends on TWL4030_CORE && SND_OMAP_SOC && MACH_OMAP_4430SDP
103 select SND_OMAP_SOC_DMIC
100 select SND_OMAP_SOC_MCPDM 104 select SND_OMAP_SOC_MCPDM
101 select SND_SOC_TWL6040 105 select SND_SOC_TWL6040
106 select SND_SOC_DMIC
102 help 107 help
103 Say Y if you want to add support for SoC audio on Texas Instruments 108 Say Y if you want to add support for SoC audio on Texas Instruments
104 SDP4430. 109 SDP4430.
diff --git a/sound/soc/omap/Makefile b/sound/soc/omap/Makefile
index 052fd758722..1fd723fb559 100644
--- a/sound/soc/omap/Makefile
+++ b/sound/soc/omap/Makefile
@@ -1,10 +1,12 @@
1# OMAP Platform Support 1# OMAP Platform Support
2snd-soc-omap-objs := omap-pcm.o 2snd-soc-omap-objs := omap-pcm.o
3snd-soc-omap-dmic-objs := omap-dmic.o
3snd-soc-omap-mcbsp-objs := omap-mcbsp.o 4snd-soc-omap-mcbsp-objs := omap-mcbsp.o
4snd-soc-omap-mcpdm-objs := omap-mcpdm.o 5snd-soc-omap-mcpdm-objs := omap-mcpdm.o
5snd-soc-omap-hdmi-objs := omap-hdmi.o 6snd-soc-omap-hdmi-objs := omap-hdmi.o
6 7
7obj-$(CONFIG_SND_OMAP_SOC) += snd-soc-omap.o 8obj-$(CONFIG_SND_OMAP_SOC) += snd-soc-omap.o
9obj-$(CONFIG_SND_OMAP_SOC_DMIC) += snd-soc-omap-dmic.o
8obj-$(CONFIG_SND_OMAP_SOC_MCBSP) += snd-soc-omap-mcbsp.o 10obj-$(CONFIG_SND_OMAP_SOC_MCBSP) += snd-soc-omap-mcbsp.o
9obj-$(CONFIG_SND_OMAP_SOC_MCPDM) += snd-soc-omap-mcpdm.o 11obj-$(CONFIG_SND_OMAP_SOC_MCPDM) += snd-soc-omap-mcpdm.o
10obj-$(CONFIG_SND_OMAP_SOC_HDMI) += snd-soc-omap-hdmi.o 12obj-$(CONFIG_SND_OMAP_SOC_HDMI) += snd-soc-omap-hdmi.o
diff --git a/sound/soc/omap/am3517evm.c b/sound/soc/omap/am3517evm.c
index c1cd4a0cbe9..add4866d7e6 100644
--- a/sound/soc/omap/am3517evm.c
+++ b/sound/soc/omap/am3517evm.c
@@ -107,6 +107,7 @@ static struct snd_soc_dai_link am3517evm_dai = {
107/* Audio machine driver */ 107/* Audio machine driver */
108static struct snd_soc_card snd_soc_am3517evm = { 108static struct snd_soc_card snd_soc_am3517evm = {
109 .name = "am3517evm", 109 .name = "am3517evm",
110 .owner = THIS_MODULE,
110 .dai_link = &am3517evm_dai, 111 .dai_link = &am3517evm_dai,
111 .num_links = 1, 112 .num_links = 1,
112 113
diff --git a/sound/soc/omap/ams-delta.c b/sound/soc/omap/ams-delta.c
index ccb8a6aa181..a67f4370bc9 100644
--- a/sound/soc/omap/ams-delta.c
+++ b/sound/soc/omap/ams-delta.c
@@ -431,22 +431,20 @@ static int ams_delta_set_bias_level(struct snd_soc_card *card,
431 struct snd_soc_dapm_context *dapm, 431 struct snd_soc_dapm_context *dapm,
432 enum snd_soc_bias_level level) 432 enum snd_soc_bias_level level)
433{ 433{
434 struct snd_soc_codec *codec = card->rtd->codec;
435
436 switch (level) { 434 switch (level) {
437 case SND_SOC_BIAS_ON: 435 case SND_SOC_BIAS_ON:
438 case SND_SOC_BIAS_PREPARE: 436 case SND_SOC_BIAS_PREPARE:
439 case SND_SOC_BIAS_STANDBY: 437 case SND_SOC_BIAS_STANDBY:
440 if (codec->dapm.bias_level == SND_SOC_BIAS_OFF) 438 if (card->dapm.bias_level == SND_SOC_BIAS_OFF)
441 ams_delta_latch2_write(AMS_DELTA_LATCH2_MODEM_NRESET, 439 ams_delta_latch2_write(AMS_DELTA_LATCH2_MODEM_NRESET,
442 AMS_DELTA_LATCH2_MODEM_NRESET); 440 AMS_DELTA_LATCH2_MODEM_NRESET);
443 break; 441 break;
444 case SND_SOC_BIAS_OFF: 442 case SND_SOC_BIAS_OFF:
445 if (codec->dapm.bias_level != SND_SOC_BIAS_OFF) 443 if (card->dapm.bias_level != SND_SOC_BIAS_OFF)
446 ams_delta_latch2_write(AMS_DELTA_LATCH2_MODEM_NRESET, 444 ams_delta_latch2_write(AMS_DELTA_LATCH2_MODEM_NRESET,
447 0); 445 0);
448 } 446 }
449 codec->dapm.bias_level = level; 447 card->dapm.bias_level = level;
450 448
451 return 0; 449 return 0;
452} 450}
@@ -474,7 +472,7 @@ static int ams_delta_digital_mute(struct snd_soc_dai *dai, int mute)
474} 472}
475 473
476/* Our codec DAI probably doesn't have its own .ops structure */ 474/* Our codec DAI probably doesn't have its own .ops structure */
477static struct snd_soc_dai_ops ams_delta_dai_ops = { 475static const struct snd_soc_dai_ops ams_delta_dai_ops = {
478 .digital_mute = ams_delta_digital_mute, 476 .digital_mute = ams_delta_digital_mute,
479}; 477};
480 478
@@ -597,6 +595,7 @@ static struct snd_soc_dai_link ams_delta_dai_link = {
597/* Audio card driver */ 595/* Audio card driver */
598static struct snd_soc_card ams_delta_audio_card = { 596static struct snd_soc_card ams_delta_audio_card = {
599 .name = "AMS_DELTA", 597 .name = "AMS_DELTA",
598 .owner = THIS_MODULE,
600 .dai_link = &ams_delta_dai_link, 599 .dai_link = &ams_delta_dai_link,
601 .num_links = 1, 600 .num_links = 1,
602 .set_bias_level = ams_delta_set_bias_level, 601 .set_bias_level = ams_delta_set_bias_level,
diff --git a/sound/soc/omap/igep0020.c b/sound/soc/omap/igep0020.c
index 591fbf8f7cd..ccae58a1339 100644
--- a/sound/soc/omap/igep0020.c
+++ b/sound/soc/omap/igep0020.c
@@ -72,6 +72,7 @@ static struct snd_soc_dai_link igep2_dai = {
72/* Audio machine driver */ 72/* Audio machine driver */
73static struct snd_soc_card snd_soc_card_igep2 = { 73static struct snd_soc_card snd_soc_card_igep2 = {
74 .name = "igep2", 74 .name = "igep2",
75 .owner = THIS_MODULE,
75 .dai_link = &igep2_dai, 76 .dai_link = &igep2_dai,
76 .num_links = 1, 77 .num_links = 1,
77}; 78};
diff --git a/sound/soc/omap/n810.c b/sound/soc/omap/n810.c
index fc6209b3f20..597be412f1e 100644
--- a/sound/soc/omap/n810.c
+++ b/sound/soc/omap/n810.c
@@ -289,6 +289,7 @@ static struct snd_soc_dai_link n810_dai = {
289/* Audio machine driver */ 289/* Audio machine driver */
290static struct snd_soc_card snd_soc_n810 = { 290static struct snd_soc_card snd_soc_n810 = {
291 .name = "N810", 291 .name = "N810",
292 .owner = THIS_MODULE,
292 .dai_link = &n810_dai, 293 .dai_link = &n810_dai,
293 .num_links = 1, 294 .num_links = 1,
294 295
diff --git a/sound/soc/omap/omap-dmic.c b/sound/soc/omap/omap-dmic.c
new file mode 100644
index 00000000000..0855c1cfa7f
--- /dev/null
+++ b/sound/soc/omap/omap-dmic.c
@@ -0,0 +1,546 @@
1/*
2 * omap-dmic.c -- OMAP ASoC DMIC DAI driver
3 *
4 * Copyright (C) 2010 - 2011 Texas Instruments
5 *
6 * Author: David Lambert <dlambert@ti.com>
7 * Misael Lopez Cruz <misael.lopez@ti.com>
8 * Liam Girdwood <lrg@ti.com>
9 * Peter Ujfalusi <peter.ujfalusi@ti.com>
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * version 2 as published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
23 * 02110-1301 USA
24 *
25 */
26
27#include <linux/init.h>
28#include <linux/module.h>
29#include <linux/platform_device.h>
30#include <linux/err.h>
31#include <linux/clk.h>
32#include <linux/io.h>
33#include <linux/slab.h>
34#include <linux/pm_runtime.h>
35#include <plat/dma.h>
36
37#include <sound/core.h>
38#include <sound/pcm.h>
39#include <sound/pcm_params.h>
40#include <sound/initval.h>
41#include <sound/soc.h>
42
43#include "omap-pcm.h"
44#include "omap-dmic.h"
45
46struct omap_dmic {
47 struct device *dev;
48 void __iomem *io_base;
49 struct clk *fclk;
50 int fclk_freq;
51 int out_freq;
52 int clk_div;
53 int sysclk;
54 int threshold;
55 u32 ch_enabled;
56 bool active;
57 struct mutex mutex;
58};
59
60/*
61 * Stream DMA parameters
62 */
63static struct omap_pcm_dma_data omap_dmic_dai_dma_params = {
64 .name = "DMIC capture",
65 .data_type = OMAP_DMA_DATA_TYPE_S32,
66 .sync_mode = OMAP_DMA_SYNC_PACKET,
67};
68
69static inline void omap_dmic_write(struct omap_dmic *dmic, u16 reg, u32 val)
70{
71 __raw_writel(val, dmic->io_base + reg);
72}
73
74static inline int omap_dmic_read(struct omap_dmic *dmic, u16 reg)
75{
76 return __raw_readl(dmic->io_base + reg);
77}
78
79static inline void omap_dmic_start(struct omap_dmic *dmic)
80{
81 u32 ctrl = omap_dmic_read(dmic, OMAP_DMIC_CTRL_REG);
82
83 /* Configure DMA controller */
84 omap_dmic_write(dmic, OMAP_DMIC_DMAENABLE_SET_REG,
85 OMAP_DMIC_DMA_ENABLE);
86
87 omap_dmic_write(dmic, OMAP_DMIC_CTRL_REG, ctrl | dmic->ch_enabled);
88}
89
90static inline void omap_dmic_stop(struct omap_dmic *dmic)
91{
92 u32 ctrl = omap_dmic_read(dmic, OMAP_DMIC_CTRL_REG);
93 omap_dmic_write(dmic, OMAP_DMIC_CTRL_REG,
94 ctrl & ~OMAP_DMIC_UP_ENABLE_MASK);
95
96 /* Disable DMA request generation */
97 omap_dmic_write(dmic, OMAP_DMIC_DMAENABLE_CLR_REG,
98 OMAP_DMIC_DMA_ENABLE);
99
100}
101
102static inline int dmic_is_enabled(struct omap_dmic *dmic)
103{
104 return omap_dmic_read(dmic, OMAP_DMIC_CTRL_REG) &
105 OMAP_DMIC_UP_ENABLE_MASK;
106}
107
108static int omap_dmic_dai_startup(struct snd_pcm_substream *substream,
109 struct snd_soc_dai *dai)
110{
111 struct omap_dmic *dmic = snd_soc_dai_get_drvdata(dai);
112 int ret = 0;
113
114 mutex_lock(&dmic->mutex);
115
116 if (!dai->active) {
117 snd_pcm_hw_constraint_msbits(substream->runtime, 0, 32, 24);
118 dmic->active = 1;
119 } else {
120 ret = -EBUSY;
121 }
122
123 mutex_unlock(&dmic->mutex);
124
125 return ret;
126}
127
128static void omap_dmic_dai_shutdown(struct snd_pcm_substream *substream,
129 struct snd_soc_dai *dai)
130{
131 struct omap_dmic *dmic = snd_soc_dai_get_drvdata(dai);
132
133 mutex_lock(&dmic->mutex);
134
135 if (!dai->active)
136 dmic->active = 0;
137
138 mutex_unlock(&dmic->mutex);
139}
140
141static int omap_dmic_select_divider(struct omap_dmic *dmic, int sample_rate)
142{
143 int divider = -EINVAL;
144
145 /*
146 * 192KHz rate is only supported with 19.2MHz/3.84MHz clock
147 * configuration.
148 */
149 if (sample_rate == 192000) {
150 if (dmic->fclk_freq == 19200000 && dmic->out_freq == 3840000)
151 divider = 0x6; /* Divider: 5 (192KHz sampling rate) */
152 else
153 dev_err(dmic->dev,
154 "invalid clock configuration for 192KHz\n");
155
156 return divider;
157 }
158
159 switch (dmic->out_freq) {
160 case 1536000:
161 if (dmic->fclk_freq != 24576000)
162 goto div_err;
163 divider = 0x4; /* Divider: 16 */
164 break;
165 case 2400000:
166 switch (dmic->fclk_freq) {
167 case 12000000:
168 divider = 0x5; /* Divider: 5 */
169 break;
170 case 19200000:
171 divider = 0x0; /* Divider: 8 */
172 break;
173 case 24000000:
174 divider = 0x2; /* Divider: 10 */
175 break;
176 default:
177 goto div_err;
178 }
179 break;
180 case 3072000:
181 if (dmic->fclk_freq != 24576000)
182 goto div_err;
183 divider = 0x3; /* Divider: 8 */
184 break;
185 case 3840000:
186 if (dmic->fclk_freq != 19200000)
187 goto div_err;
188 divider = 0x1; /* Divider: 5 (96KHz sampling rate) */
189 break;
190 default:
191 dev_err(dmic->dev, "invalid out frequency: %dHz\n",
192 dmic->out_freq);
193 break;
194 }
195
196 return divider;
197
198div_err:
199 dev_err(dmic->dev, "invalid out frequency %dHz for %dHz input\n",
200 dmic->out_freq, dmic->fclk_freq);
201 return -EINVAL;
202}
203
204static int omap_dmic_dai_hw_params(struct snd_pcm_substream *substream,
205 struct snd_pcm_hw_params *params,
206 struct snd_soc_dai *dai)
207{
208 struct omap_dmic *dmic = snd_soc_dai_get_drvdata(dai);
209 int channels;
210
211 dmic->clk_div = omap_dmic_select_divider(dmic, params_rate(params));
212 if (dmic->clk_div < 0) {
213 dev_err(dmic->dev, "no valid divider for %dHz from %dHz\n",
214 dmic->out_freq, dmic->fclk_freq);
215 return -EINVAL;
216 }
217
218 dmic->ch_enabled = 0;
219 channels = params_channels(params);
220 switch (channels) {
221 case 6:
222 dmic->ch_enabled |= OMAP_DMIC_UP3_ENABLE;
223 case 4:
224 dmic->ch_enabled |= OMAP_DMIC_UP2_ENABLE;
225 case 2:
226 dmic->ch_enabled |= OMAP_DMIC_UP1_ENABLE;
227 break;
228 default:
229 dev_err(dmic->dev, "invalid number of legacy channels\n");
230 return -EINVAL;
231 }
232
233 /* packet size is threshold * channels */
234 omap_dmic_dai_dma_params.packet_size = dmic->threshold * channels;
235 snd_soc_dai_set_dma_data(dai, substream, &omap_dmic_dai_dma_params);
236
237 return 0;
238}
239
240static int omap_dmic_dai_prepare(struct snd_pcm_substream *substream,
241 struct snd_soc_dai *dai)
242{
243 struct omap_dmic *dmic = snd_soc_dai_get_drvdata(dai);
244 u32 ctrl;
245
246 /* Configure uplink threshold */
247 omap_dmic_write(dmic, OMAP_DMIC_FIFO_CTRL_REG, dmic->threshold);
248
249 ctrl = omap_dmic_read(dmic, OMAP_DMIC_CTRL_REG);
250
251 /* Set dmic out format */
252 ctrl &= ~(OMAP_DMIC_FORMAT | OMAP_DMIC_POLAR_MASK);
253 ctrl |= (OMAP_DMICOUTFORMAT_LJUST | OMAP_DMIC_POLAR1 |
254 OMAP_DMIC_POLAR2 | OMAP_DMIC_POLAR3);
255
256 /* Configure dmic clock divider */
257 ctrl &= ~OMAP_DMIC_CLK_DIV_MASK;
258 ctrl |= OMAP_DMIC_CLK_DIV(dmic->clk_div);
259
260 omap_dmic_write(dmic, OMAP_DMIC_CTRL_REG, ctrl);
261
262 omap_dmic_write(dmic, OMAP_DMIC_CTRL_REG,
263 ctrl | OMAP_DMICOUTFORMAT_LJUST | OMAP_DMIC_POLAR1 |
264 OMAP_DMIC_POLAR2 | OMAP_DMIC_POLAR3);
265
266 return 0;
267}
268
269static int omap_dmic_dai_trigger(struct snd_pcm_substream *substream,
270 int cmd, struct snd_soc_dai *dai)
271{
272 struct omap_dmic *dmic = snd_soc_dai_get_drvdata(dai);
273
274 switch (cmd) {
275 case SNDRV_PCM_TRIGGER_START:
276 omap_dmic_start(dmic);
277 break;
278 case SNDRV_PCM_TRIGGER_STOP:
279 omap_dmic_stop(dmic);
280 break;
281 default:
282 break;
283 }
284
285 return 0;
286}
287
288static int omap_dmic_select_fclk(struct omap_dmic *dmic, int clk_id,
289 unsigned int freq)
290{
291 struct clk *parent_clk;
292 char *parent_clk_name;
293 int ret = 0;
294
295 switch (freq) {
296 case 12000000:
297 case 19200000:
298 case 24000000:
299 case 24576000:
300 break;
301 default:
302 dev_err(dmic->dev, "invalid input frequency: %dHz\n", freq);
303 dmic->fclk_freq = 0;
304 return -EINVAL;
305 }
306
307 if (dmic->sysclk == clk_id) {
308 dmic->fclk_freq = freq;
309 return 0;
310 }
311
312 /* re-parent not allowed if a stream is ongoing */
313 if (dmic->active && dmic_is_enabled(dmic)) {
314 dev_err(dmic->dev, "can't re-parent when DMIC active\n");
315 return -EBUSY;
316 }
317
318 switch (clk_id) {
319 case OMAP_DMIC_SYSCLK_PAD_CLKS:
320 parent_clk_name = "pad_clks_ck";
321 break;
322 case OMAP_DMIC_SYSCLK_SLIMBLUS_CLKS:
323 parent_clk_name = "slimbus_clk";
324 break;
325 case OMAP_DMIC_SYSCLK_SYNC_MUX_CLKS:
326 parent_clk_name = "dmic_sync_mux_ck";
327 break;
328 default:
329 dev_err(dmic->dev, "fclk clk_id (%d) not supported\n", clk_id);
330 return -EINVAL;
331 }
332
333 parent_clk = clk_get(dmic->dev, parent_clk_name);
334 if (IS_ERR(parent_clk)) {
335 dev_err(dmic->dev, "can't get %s\n", parent_clk_name);
336 return -ENODEV;
337 }
338
339 mutex_lock(&dmic->mutex);
340 if (dmic->active) {
341 /* disable clock while reparenting */
342 pm_runtime_put_sync(dmic->dev);
343 ret = clk_set_parent(dmic->fclk, parent_clk);
344 pm_runtime_get_sync(dmic->dev);
345 } else {
346 ret = clk_set_parent(dmic->fclk, parent_clk);
347 }
348 mutex_unlock(&dmic->mutex);
349
350 if (ret < 0) {
351 dev_err(dmic->dev, "re-parent failed\n");
352 goto err_busy;
353 }
354
355 dmic->sysclk = clk_id;
356 dmic->fclk_freq = freq;
357
358err_busy:
359 clk_put(parent_clk);
360
361 return ret;
362}
363
364static int omap_dmic_select_outclk(struct omap_dmic *dmic, int clk_id,
365 unsigned int freq)
366{
367 int ret = 0;
368
369 if (clk_id != OMAP_DMIC_ABE_DMIC_CLK) {
370 dev_err(dmic->dev, "output clk_id (%d) not supported\n",
371 clk_id);
372 return -EINVAL;
373 }
374
375 switch (freq) {
376 case 1536000:
377 case 2400000:
378 case 3072000:
379 case 3840000:
380 dmic->out_freq = freq;
381 break;
382 default:
383 dev_err(dmic->dev, "invalid out frequency: %dHz\n", freq);
384 dmic->out_freq = 0;
385 ret = -EINVAL;
386 }
387
388 return ret;
389}
390
391static int omap_dmic_set_dai_sysclk(struct snd_soc_dai *dai, int clk_id,
392 unsigned int freq, int dir)
393{
394 struct omap_dmic *dmic = snd_soc_dai_get_drvdata(dai);
395
396 if (dir == SND_SOC_CLOCK_IN)
397 return omap_dmic_select_fclk(dmic, clk_id, freq);
398 else if (dir == SND_SOC_CLOCK_OUT)
399 return omap_dmic_select_outclk(dmic, clk_id, freq);
400
401 dev_err(dmic->dev, "invalid clock direction (%d)\n", dir);
402 return -EINVAL;
403}
404
405static const struct snd_soc_dai_ops omap_dmic_dai_ops = {
406 .startup = omap_dmic_dai_startup,
407 .shutdown = omap_dmic_dai_shutdown,
408 .hw_params = omap_dmic_dai_hw_params,
409 .prepare = omap_dmic_dai_prepare,
410 .trigger = omap_dmic_dai_trigger,
411 .set_sysclk = omap_dmic_set_dai_sysclk,
412};
413
414static int omap_dmic_probe(struct snd_soc_dai *dai)
415{
416 struct omap_dmic *dmic = snd_soc_dai_get_drvdata(dai);
417
418 pm_runtime_enable(dmic->dev);
419
420 /* Disable lines while request is ongoing */
421 pm_runtime_get_sync(dmic->dev);
422 omap_dmic_write(dmic, OMAP_DMIC_CTRL_REG, 0x00);
423 pm_runtime_put_sync(dmic->dev);
424
425 /* Configure DMIC threshold value */
426 dmic->threshold = OMAP_DMIC_THRES_MAX - 3;
427 return 0;
428}
429
430static int omap_dmic_remove(struct snd_soc_dai *dai)
431{
432 struct omap_dmic *dmic = snd_soc_dai_get_drvdata(dai);
433
434 pm_runtime_disable(dmic->dev);
435
436 return 0;
437}
438
439static struct snd_soc_dai_driver omap_dmic_dai = {
440 .name = "omap-dmic",
441 .probe = omap_dmic_probe,
442 .remove = omap_dmic_remove,
443 .capture = {
444 .channels_min = 2,
445 .channels_max = 6,
446 .rates = SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_192000,
447 .formats = SNDRV_PCM_FMTBIT_S32_LE,
448 },
449 .ops = &omap_dmic_dai_ops,
450};
451
452static __devinit int asoc_dmic_probe(struct platform_device *pdev)
453{
454 struct omap_dmic *dmic;
455 struct resource *res;
456 int ret;
457
458 dmic = devm_kzalloc(&pdev->dev, sizeof(struct omap_dmic), GFP_KERNEL);
459 if (!dmic)
460 return -ENOMEM;
461
462 platform_set_drvdata(pdev, dmic);
463 dmic->dev = &pdev->dev;
464 dmic->sysclk = OMAP_DMIC_SYSCLK_SYNC_MUX_CLKS;
465
466 mutex_init(&dmic->mutex);
467
468 dmic->fclk = clk_get(dmic->dev, "dmic_fck");
469 if (IS_ERR(dmic->fclk)) {
470 dev_err(dmic->dev, "cant get dmic_fck\n");
471 return -ENODEV;
472 }
473
474 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "dma");
475 if (!res) {
476 dev_err(dmic->dev, "invalid dma memory resource\n");
477 ret = -ENODEV;
478 goto err_put_clk;
479 }
480 omap_dmic_dai_dma_params.port_addr = res->start + OMAP_DMIC_DATA_REG;
481
482 res = platform_get_resource(pdev, IORESOURCE_DMA, 0);
483 if (!res) {
484 dev_err(dmic->dev, "invalid dma resource\n");
485 ret = -ENODEV;
486 goto err_put_clk;
487 }
488 omap_dmic_dai_dma_params.dma_req = res->start;
489
490 res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "mpu");
491 if (!res) {
492 dev_err(dmic->dev, "invalid memory resource\n");
493 ret = -ENODEV;
494 goto err_put_clk;
495 }
496
497 if (!devm_request_mem_region(&pdev->dev, res->start,
498 resource_size(res), pdev->name)) {
499 dev_err(dmic->dev, "memory region already claimed\n");
500 ret = -ENODEV;
501 goto err_put_clk;
502 }
503
504 dmic->io_base = devm_ioremap(&pdev->dev, res->start,
505 resource_size(res));
506 if (!dmic->io_base) {
507 ret = -ENOMEM;
508 goto err_put_clk;
509 }
510
511 ret = snd_soc_register_dai(&pdev->dev, &omap_dmic_dai);
512 if (ret)
513 goto err_put_clk;
514
515 return 0;
516
517err_put_clk:
518 clk_put(dmic->fclk);
519 return ret;
520}
521
522static int __devexit asoc_dmic_remove(struct platform_device *pdev)
523{
524 struct omap_dmic *dmic = platform_get_drvdata(pdev);
525
526 snd_soc_unregister_dai(&pdev->dev);
527 clk_put(dmic->fclk);
528
529 return 0;
530}
531
532static struct platform_driver asoc_dmic_driver = {
533 .driver = {
534 .name = "omap-dmic",
535 .owner = THIS_MODULE,
536 },
537 .probe = asoc_dmic_probe,
538 .remove = __devexit_p(asoc_dmic_remove),
539};
540
541module_platform_driver(asoc_dmic_driver);
542
543MODULE_ALIAS("platform:omap-dmic");
544MODULE_AUTHOR("Peter Ujfalusi <peter.ujfalusi@ti.com>");
545MODULE_DESCRIPTION("OMAP DMIC ASoC Interface");
546MODULE_LICENSE("GPL");
diff --git a/sound/soc/omap/omap-dmic.h b/sound/soc/omap/omap-dmic.h
new file mode 100644
index 00000000000..231e728bff0
--- /dev/null
+++ b/sound/soc/omap/omap-dmic.h
@@ -0,0 +1,69 @@
1/*
2 * omap-dmic.h -- OMAP Digital Microphone Controller
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
7 */
8
9#ifndef _OMAP_DMIC_H
10#define _OMAP_DMIC_H
11
12#define OMAP_DMIC_REVISION_REG 0x00
13#define OMAP_DMIC_SYSCONFIG_REG 0x10
14#define OMAP_DMIC_IRQSTATUS_RAW_REG 0x24
15#define OMAP_DMIC_IRQSTATUS_REG 0x28
16#define OMAP_DMIC_IRQENABLE_SET_REG 0x2C
17#define OMAP_DMIC_IRQENABLE_CLR_REG 0x30
18#define OMAP_DMIC_IRQWAKE_EN_REG 0x34
19#define OMAP_DMIC_DMAENABLE_SET_REG 0x38
20#define OMAP_DMIC_DMAENABLE_CLR_REG 0x3C
21#define OMAP_DMIC_DMAWAKEEN_REG 0x40
22#define OMAP_DMIC_CTRL_REG 0x44
23#define OMAP_DMIC_DATA_REG 0x48
24#define OMAP_DMIC_FIFO_CTRL_REG 0x4C
25#define OMAP_DMIC_FIFO_DMIC1R_DATA_REG 0x50
26#define OMAP_DMIC_FIFO_DMIC1L_DATA_REG 0x54
27#define OMAP_DMIC_FIFO_DMIC2R_DATA_REG 0x58
28#define OMAP_DMIC_FIFO_DMIC2L_DATA_REG 0x5C
29#define OMAP_DMIC_FIFO_DMIC3R_DATA_REG 0x60
30#define OMAP_DMIC_FIFO_DMIC3L_DATA_REG 0x64
31
32/* IRQSTATUS_RAW, IRQSTATUS, IRQENABLE_SET, IRQENABLE_CLR bit fields */
33#define OMAP_DMIC_IRQ (1 << 0)
34#define OMAP_DMIC_IRQ_FULL (1 << 1)
35#define OMAP_DMIC_IRQ_ALMST_EMPTY (1 << 2)
36#define OMAP_DMIC_IRQ_EMPTY (1 << 3)
37#define OMAP_DMIC_IRQ_MASK 0x07
38
39/* DMIC_DMAENABLE bit fields */
40#define OMAP_DMIC_DMA_ENABLE 0x1
41
42/* DMIC_CTRL bit fields */
43#define OMAP_DMIC_UP1_ENABLE (1 << 0)
44#define OMAP_DMIC_UP2_ENABLE (1 << 1)
45#define OMAP_DMIC_UP3_ENABLE (1 << 2)
46#define OMAP_DMIC_UP_ENABLE_MASK 0x7
47#define OMAP_DMIC_FORMAT (1 << 3)
48#define OMAP_DMIC_POLAR1 (1 << 4)
49#define OMAP_DMIC_POLAR2 (1 << 5)
50#define OMAP_DMIC_POLAR3 (1 << 6)
51#define OMAP_DMIC_POLAR_MASK (0x7 << 4)
52#define OMAP_DMIC_CLK_DIV(x) (((x) & 0x7) << 7)
53#define OMAP_DMIC_CLK_DIV_MASK (0x7 << 7)
54#define OMAP_DMIC_RESET (1 << 10)
55
56#define OMAP_DMICOUTFORMAT_LJUST (0 << 3)
57#define OMAP_DMICOUTFORMAT_RJUST (1 << 3)
58
59/* DMIC_FIFO_CTRL bit fields */
60#define OMAP_DMIC_THRES_MAX 0xF
61
62enum omap_dmic_clk {
63 OMAP_DMIC_SYSCLK_PAD_CLKS, /* PAD_CLKS */
64 OMAP_DMIC_SYSCLK_SLIMBLUS_CLKS, /* SLIMBUS_CLK */
65 OMAP_DMIC_SYSCLK_SYNC_MUX_CLKS, /* DMIC_SYNC_MUX_CLK */
66 OMAP_DMIC_ABE_DMIC_CLK, /* abe_dmic_clk */
67};
68
69#endif
diff --git a/sound/soc/omap/omap-hdmi.c b/sound/soc/omap/omap-hdmi.c
index 36c6eaeffb0..38e0defa707 100644
--- a/sound/soc/omap/omap-hdmi.c
+++ b/sound/soc/omap/omap-hdmi.c
@@ -83,7 +83,7 @@ static int omap_hdmi_dai_hw_params(struct snd_pcm_substream *substream,
83 return err; 83 return err;
84} 84}
85 85
86static struct snd_soc_dai_ops omap_hdmi_dai_ops = { 86static const struct snd_soc_dai_ops omap_hdmi_dai_ops = {
87 .startup = omap_hdmi_dai_startup, 87 .startup = omap_hdmi_dai_startup,
88 .hw_params = omap_hdmi_dai_hw_params, 88 .hw_params = omap_hdmi_dai_hw_params,
89}; 89};
@@ -139,17 +139,7 @@ static struct platform_driver hdmi_dai_driver = {
139 .remove = __devexit_p(omap_hdmi_remove), 139 .remove = __devexit_p(omap_hdmi_remove),
140}; 140};
141 141
142static int __init hdmi_dai_init(void) 142module_platform_driver(hdmi_dai_driver);
143{
144 return platform_driver_register(&hdmi_dai_driver);
145}
146module_init(hdmi_dai_init);
147
148static void __exit hdmi_dai_exit(void)
149{
150 platform_driver_unregister(&hdmi_dai_driver);
151}
152module_exit(hdmi_dai_exit);
153 143
154MODULE_AUTHOR("Jorge Candelaria <jorge.candelaria@ti.com>"); 144MODULE_AUTHOR("Jorge Candelaria <jorge.candelaria@ti.com>");
155MODULE_AUTHOR("Ricardo Neri <ricardo.neri@ti.com>"); 145MODULE_AUTHOR("Ricardo Neri <ricardo.neri@ti.com>");
diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c
index 4314647e735..017371913ec 100644
--- a/sound/soc/omap/omap-mcbsp.c
+++ b/sound/soc/omap/omap-mcbsp.c
@@ -258,7 +258,7 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream,
258 default: 258 default:
259 return -EINVAL; 259 return -EINVAL;
260 } 260 }
261 if (cpu_is_omap34xx()) { 261 if (cpu_is_omap34xx() || cpu_is_omap44xx()) {
262 dma_data->set_threshold = omap_mcbsp_set_threshold; 262 dma_data->set_threshold = omap_mcbsp_set_threshold;
263 /* TODO: Currently, MODE_ELEMENT == MODE_FRAME */ 263 /* TODO: Currently, MODE_ELEMENT == MODE_FRAME */
264 if (omap_mcbsp_get_dma_op_mode(bus_id) == 264 if (omap_mcbsp_get_dma_op_mode(bus_id) ==
@@ -599,7 +599,7 @@ static int omap_mcbsp_dai_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
599 return err; 599 return err;
600} 600}
601 601
602static struct snd_soc_dai_ops mcbsp_dai_ops = { 602static const struct snd_soc_dai_ops mcbsp_dai_ops = {
603 .startup = omap_mcbsp_dai_startup, 603 .startup = omap_mcbsp_dai_startup,
604 .shutdown = omap_mcbsp_dai_shutdown, 604 .shutdown = omap_mcbsp_dai_shutdown,
605 .trigger = omap_mcbsp_dai_trigger, 605 .trigger = omap_mcbsp_dai_trigger,
@@ -785,17 +785,7 @@ static struct platform_driver asoc_mcbsp_driver = {
785 .remove = __devexit_p(asoc_mcbsp_remove), 785 .remove = __devexit_p(asoc_mcbsp_remove),
786}; 786};
787 787
788static int __init snd_omap_mcbsp_init(void) 788module_platform_driver(asoc_mcbsp_driver);
789{
790 return platform_driver_register(&asoc_mcbsp_driver);
791}
792module_init(snd_omap_mcbsp_init);
793
794static void __exit snd_omap_mcbsp_exit(void)
795{
796 platform_driver_unregister(&asoc_mcbsp_driver);
797}
798module_exit(snd_omap_mcbsp_exit);
799 789
800MODULE_AUTHOR("Jarkko Nikula <jarkko.nikula@bitmer.com>"); 790MODULE_AUTHOR("Jarkko Nikula <jarkko.nikula@bitmer.com>");
801MODULE_DESCRIPTION("OMAP I2S SoC Interface"); 791MODULE_DESCRIPTION("OMAP I2S SoC Interface");
diff --git a/sound/soc/omap/omap-mcpdm.c b/sound/soc/omap/omap-mcpdm.c
index 41d17067cc7..0e25df4fa9e 100644
--- a/sound/soc/omap/omap-mcpdm.c
+++ b/sound/soc/omap/omap-mcpdm.c
@@ -266,8 +266,6 @@ static int omap_mcpdm_dai_startup(struct snd_pcm_substream *substream,
266 mutex_lock(&mcpdm->mutex); 266 mutex_lock(&mcpdm->mutex);
267 267
268 if (!dai->active) { 268 if (!dai->active) {
269 pm_runtime_get_sync(mcpdm->dev);
270
271 /* Enable watch dog for ES above ES 1.0 to avoid saturation */ 269 /* Enable watch dog for ES above ES 1.0 to avoid saturation */
272 if (omap_rev() != OMAP4430_REV_ES1_0) { 270 if (omap_rev() != OMAP4430_REV_ES1_0) {
273 u32 ctrl = omap_mcpdm_read(mcpdm, MCPDM_REG_CTRL); 271 u32 ctrl = omap_mcpdm_read(mcpdm, MCPDM_REG_CTRL);
@@ -295,9 +293,6 @@ static void omap_mcpdm_dai_shutdown(struct snd_pcm_substream *substream,
295 omap_mcpdm_stop(mcpdm); 293 omap_mcpdm_stop(mcpdm);
296 omap_mcpdm_close_streams(mcpdm); 294 omap_mcpdm_close_streams(mcpdm);
297 } 295 }
298
299 if (!omap_mcpdm_active(mcpdm))
300 pm_runtime_put_sync(mcpdm->dev);
301 } 296 }
302 297
303 mutex_unlock(&mcpdm->mutex); 298 mutex_unlock(&mcpdm->mutex);
@@ -367,7 +362,7 @@ static int omap_mcpdm_prepare(struct snd_pcm_substream *substream,
367 return 0; 362 return 0;
368} 363}
369 364
370static struct snd_soc_dai_ops omap_mcpdm_dai_ops = { 365static const struct snd_soc_dai_ops omap_mcpdm_dai_ops = {
371 .startup = omap_mcpdm_dai_startup, 366 .startup = omap_mcpdm_dai_startup,
372 .shutdown = omap_mcpdm_dai_shutdown, 367 .shutdown = omap_mcpdm_dai_shutdown,
373 .hw_params = omap_mcpdm_dai_hw_params, 368 .hw_params = omap_mcpdm_dai_hw_params,
@@ -520,17 +515,7 @@ static struct platform_driver asoc_mcpdm_driver = {
520 .remove = __devexit_p(asoc_mcpdm_remove), 515 .remove = __devexit_p(asoc_mcpdm_remove),
521}; 516};
522 517
523static int __init snd_omap_mcpdm_init(void) 518module_platform_driver(asoc_mcpdm_driver);
524{
525 return platform_driver_register(&asoc_mcpdm_driver);
526}
527module_init(snd_omap_mcpdm_init);
528
529static void __exit snd_omap_mcpdm_exit(void)
530{
531 platform_driver_unregister(&asoc_mcpdm_driver);
532}
533module_exit(snd_omap_mcpdm_exit);
534 519
535MODULE_AUTHOR("Misael Lopez Cruz <misael.lopez@ti.com>"); 520MODULE_AUTHOR("Misael Lopez Cruz <misael.lopez@ti.com>");
536MODULE_DESCRIPTION("OMAP PDM SoC Interface"); 521MODULE_DESCRIPTION("OMAP PDM SoC Interface");
diff --git a/sound/soc/omap/omap-pcm.c b/sound/soc/omap/omap-pcm.c
index 6ede7dc6c10..a59bd352d34 100644
--- a/sound/soc/omap/omap-pcm.c
+++ b/sound/soc/omap/omap-pcm.c
@@ -378,7 +378,6 @@ static void omap_pcm_free_dma_buffers(struct snd_pcm *pcm)
378static int omap_pcm_new(struct snd_soc_pcm_runtime *rtd) 378static int omap_pcm_new(struct snd_soc_pcm_runtime *rtd)
379{ 379{
380 struct snd_card *card = rtd->card->snd_card; 380 struct snd_card *card = rtd->card->snd_card;
381 struct snd_soc_dai *dai = rtd->cpu_dai;
382 struct snd_pcm *pcm = rtd->pcm; 381 struct snd_pcm *pcm = rtd->pcm;
383 int ret = 0; 382 int ret = 0;
384 383
@@ -387,14 +386,14 @@ static int omap_pcm_new(struct snd_soc_pcm_runtime *rtd)
387 if (!card->dev->coherent_dma_mask) 386 if (!card->dev->coherent_dma_mask)
388 card->dev->coherent_dma_mask = DMA_BIT_MASK(64); 387 card->dev->coherent_dma_mask = DMA_BIT_MASK(64);
389 388
390 if (dai->driver->playback.channels_min) { 389 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
391 ret = omap_pcm_preallocate_dma_buffer(pcm, 390 ret = omap_pcm_preallocate_dma_buffer(pcm,
392 SNDRV_PCM_STREAM_PLAYBACK); 391 SNDRV_PCM_STREAM_PLAYBACK);
393 if (ret) 392 if (ret)
394 goto out; 393 goto out;
395 } 394 }
396 395
397 if (dai->driver->capture.channels_min) { 396 if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) {
398 ret = omap_pcm_preallocate_dma_buffer(pcm, 397 ret = omap_pcm_preallocate_dma_buffer(pcm,
399 SNDRV_PCM_STREAM_CAPTURE); 398 SNDRV_PCM_STREAM_CAPTURE);
400 if (ret) 399 if (ret)
@@ -433,17 +432,7 @@ static struct platform_driver omap_pcm_driver = {
433 .remove = __devexit_p(omap_pcm_remove), 432 .remove = __devexit_p(omap_pcm_remove),
434}; 433};
435 434
436static int __init snd_omap_pcm_init(void) 435module_platform_driver(omap_pcm_driver);
437{
438 return platform_driver_register(&omap_pcm_driver);
439}
440module_init(snd_omap_pcm_init);
441
442static void __exit snd_omap_pcm_exit(void)
443{
444 platform_driver_unregister(&omap_pcm_driver);
445}
446module_exit(snd_omap_pcm_exit);
447 436
448MODULE_AUTHOR("Jarkko Nikula <jarkko.nikula@bitmer.com>"); 437MODULE_AUTHOR("Jarkko Nikula <jarkko.nikula@bitmer.com>");
449MODULE_DESCRIPTION("OMAP PCM DMA module"); 438MODULE_DESCRIPTION("OMAP PCM DMA module");
diff --git a/sound/soc/omap/omap3evm.c b/sound/soc/omap/omap3evm.c
index 68578959e4a..071fcb09b8b 100644
--- a/sound/soc/omap/omap3evm.c
+++ b/sound/soc/omap/omap3evm.c
@@ -70,6 +70,7 @@ static struct snd_soc_dai_link omap3evm_dai = {
70/* Audio machine driver */ 70/* Audio machine driver */
71static struct snd_soc_card snd_soc_omap3evm = { 71static struct snd_soc_card snd_soc_omap3evm = {
72 .name = "omap3evm", 72 .name = "omap3evm",
73 .owner = THIS_MODULE,
73 .dai_link = &omap3evm_dai, 74 .dai_link = &omap3evm_dai,
74 .num_links = 1, 75 .num_links = 1,
75}; 76};
diff --git a/sound/soc/omap/omap3pandora.c b/sound/soc/omap/omap3pandora.c
index 7605c37c91e..07794bd1095 100644
--- a/sound/soc/omap/omap3pandora.c
+++ b/sound/soc/omap/omap3pandora.c
@@ -233,6 +233,7 @@ static struct snd_soc_dai_link omap3pandora_dai[] = {
233/* SoC card */ 233/* SoC card */
234static struct snd_soc_card snd_soc_card_omap3pandora = { 234static struct snd_soc_card snd_soc_card_omap3pandora = {
235 .name = "omap3pandora", 235 .name = "omap3pandora",
236 .owner = THIS_MODULE,
236 .dai_link = omap3pandora_dai, 237 .dai_link = omap3pandora_dai,
237 .num_links = ARRAY_SIZE(omap3pandora_dai), 238 .num_links = ARRAY_SIZE(omap3pandora_dai),
238}; 239};
diff --git a/sound/soc/omap/omap4-hdmi-card.c b/sound/soc/omap/omap4-hdmi-card.c
index 8671261ba16..28d689b2714 100644
--- a/sound/soc/omap/omap4-hdmi-card.c
+++ b/sound/soc/omap/omap4-hdmi-card.c
@@ -74,6 +74,7 @@ static struct snd_soc_dai_link omap4_hdmi_dai = {
74 74
75static struct snd_soc_card snd_soc_omap4_hdmi = { 75static struct snd_soc_card snd_soc_omap4_hdmi = {
76 .name = "OMAP4HDMI", 76 .name = "OMAP4HDMI",
77 .owner = THIS_MODULE,
77 .dai_link = &omap4_hdmi_dai, 78 .dai_link = &omap4_hdmi_dai,
78 .num_links = 1, 79 .num_links = 1,
79}; 80};
@@ -112,17 +113,7 @@ static struct platform_driver omap4_hdmi_driver = {
112 .remove = __devexit_p(omap4_hdmi_remove), 113 .remove = __devexit_p(omap4_hdmi_remove),
113}; 114};
114 115
115static int __init omap4_hdmi_init(void) 116module_platform_driver(omap4_hdmi_driver);
116{
117 return platform_driver_register(&omap4_hdmi_driver);
118}
119module_init(omap4_hdmi_init);
120
121static void __exit omap4_hdmi_exit(void)
122{
123 platform_driver_unregister(&omap4_hdmi_driver);
124}
125module_exit(omap4_hdmi_exit);
126 117
127MODULE_AUTHOR("Ricardo Neri <ricardo.neri@ti.com>"); 118MODULE_AUTHOR("Ricardo Neri <ricardo.neri@ti.com>");
128MODULE_DESCRIPTION("OMAP4 HDMI machine ASoC driver"); 119MODULE_DESCRIPTION("OMAP4 HDMI machine ASoC driver");
diff --git a/sound/soc/omap/osk5912.c b/sound/soc/omap/osk5912.c
index 351ec9db384..d859b597e7e 100644
--- a/sound/soc/omap/osk5912.c
+++ b/sound/soc/omap/osk5912.c
@@ -108,6 +108,7 @@ static struct snd_soc_dai_link osk_dai = {
108/* Audio machine driver */ 108/* Audio machine driver */
109static struct snd_soc_card snd_soc_card_osk = { 109static struct snd_soc_card snd_soc_card_osk = {
110 .name = "OSK5912", 110 .name = "OSK5912",
111 .owner = THIS_MODULE,
111 .dai_link = &osk_dai, 112 .dai_link = &osk_dai,
112 .num_links = 1, 113 .num_links = 1,
113 114
diff --git a/sound/soc/omap/overo.c b/sound/soc/omap/overo.c
index c3550aeee53..2ee889c5025 100644
--- a/sound/soc/omap/overo.c
+++ b/sound/soc/omap/overo.c
@@ -72,6 +72,7 @@ static struct snd_soc_dai_link overo_dai = {
72/* Audio machine driver */ 72/* Audio machine driver */
73static struct snd_soc_card snd_soc_card_overo = { 73static struct snd_soc_card snd_soc_card_overo = {
74 .name = "overo", 74 .name = "overo",
75 .owner = THIS_MODULE,
75 .dai_link = &overo_dai, 76 .dai_link = &overo_dai,
76 .num_links = 1, 77 .num_links = 1,
77}; 78};
diff --git a/sound/soc/omap/rx51.c b/sound/soc/omap/rx51.c
index 4cabb74d97e..fada6ef43ee 100644
--- a/sound/soc/omap/rx51.c
+++ b/sound/soc/omap/rx51.c
@@ -365,7 +365,7 @@ static struct snd_soc_dai_link rx51_dai[] = {
365 }, 365 },
366}; 366};
367 367
368struct snd_soc_aux_dev rx51_aux_dev[] = { 368static struct snd_soc_aux_dev rx51_aux_dev[] = {
369 { 369 {
370 .name = "TLV320AIC34b", 370 .name = "TLV320AIC34b",
371 .codec_name = "tlv320aic3x-codec.2-0019", 371 .codec_name = "tlv320aic3x-codec.2-0019",
@@ -383,6 +383,7 @@ static struct snd_soc_codec_conf rx51_codec_conf[] = {
383/* Audio card */ 383/* Audio card */
384static struct snd_soc_card rx51_sound_card = { 384static struct snd_soc_card rx51_sound_card = {
385 .name = "RX-51", 385 .name = "RX-51",
386 .owner = THIS_MODULE,
386 .dai_link = rx51_dai, 387 .dai_link = rx51_dai,
387 .num_links = ARRAY_SIZE(rx51_dai), 388 .num_links = ARRAY_SIZE(rx51_dai),
388 .aux_dev = rx51_aux_dev, 389 .aux_dev = rx51_aux_dev,
diff --git a/sound/soc/omap/sdp3430.c b/sound/soc/omap/sdp3430.c
index e8fbf8efdbb..2c850662ea7 100644
--- a/sound/soc/omap/sdp3430.c
+++ b/sound/soc/omap/sdp3430.c
@@ -213,6 +213,7 @@ static struct snd_soc_dai_link sdp3430_dai[] = {
213/* Audio machine driver */ 213/* Audio machine driver */
214static struct snd_soc_card snd_soc_sdp3430 = { 214static struct snd_soc_card snd_soc_sdp3430 = {
215 .name = "SDP3430", 215 .name = "SDP3430",
216 .owner = THIS_MODULE,
216 .dai_link = sdp3430_dai, 217 .dai_link = sdp3430_dai,
217 .num_links = ARRAY_SIZE(sdp3430_dai), 218 .num_links = ARRAY_SIZE(sdp3430_dai),
218 219
diff --git a/sound/soc/omap/sdp4430.c b/sound/soc/omap/sdp4430.c
index 03d9fa4192f..175ba9a04ed 100644
--- a/sound/soc/omap/sdp4430.c
+++ b/sound/soc/omap/sdp4430.c
@@ -33,6 +33,7 @@
33#include <plat/hardware.h> 33#include <plat/hardware.h>
34#include <plat/mux.h> 34#include <plat/mux.h>
35 35
36#include "omap-dmic.h"
36#include "omap-mcpdm.h" 37#include "omap-mcpdm.h"
37#include "omap-pcm.h" 38#include "omap-pcm.h"
38#include "../codecs/twl6040.h" 39#include "../codecs/twl6040.h"
@@ -67,6 +68,32 @@ static struct snd_soc_ops sdp4430_ops = {
67 .hw_params = sdp4430_hw_params, 68 .hw_params = sdp4430_hw_params,
68}; 69};
69 70
71static int sdp4430_dmic_hw_params(struct snd_pcm_substream *substream,
72 struct snd_pcm_hw_params *params)
73{
74 struct snd_soc_pcm_runtime *rtd = substream->private_data;
75 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
76 int ret = 0;
77
78 ret = snd_soc_dai_set_sysclk(cpu_dai, OMAP_DMIC_SYSCLK_PAD_CLKS,
79 19200000, SND_SOC_CLOCK_IN);
80 if (ret < 0) {
81 printk(KERN_ERR "can't set DMIC cpu system clock\n");
82 return ret;
83 }
84 ret = snd_soc_dai_set_sysclk(cpu_dai, OMAP_DMIC_ABE_DMIC_CLK, 2400000,
85 SND_SOC_CLOCK_OUT);
86 if (ret < 0) {
87 printk(KERN_ERR "can't set DMIC output clock\n");
88 return ret;
89 }
90 return 0;
91}
92
93static struct snd_soc_ops sdp4430_dmic_ops = {
94 .hw_params = sdp4430_dmic_hw_params,
95};
96
70/* Headset jack */ 97/* Headset jack */
71static struct snd_soc_jack hs_jack; 98static struct snd_soc_jack hs_jack;
72 99
@@ -148,23 +175,60 @@ static int sdp4430_twl6040_init(struct snd_soc_pcm_runtime *rtd)
148 return ret; 175 return ret;
149} 176}
150 177
178static const struct snd_soc_dapm_widget sdp4430_dmic_dapm_widgets[] = {
179 SND_SOC_DAPM_MIC("Digital Mic", NULL),
180};
181
182static const struct snd_soc_dapm_route dmic_audio_map[] = {
183 {"DMic", NULL, "Digital Mic1 Bias"},
184 {"Digital Mic1 Bias", NULL, "Digital Mic"},
185};
186
187static int sdp4430_dmic_init(struct snd_soc_pcm_runtime *rtd)
188{
189 struct snd_soc_codec *codec = rtd->codec;
190 struct snd_soc_dapm_context *dapm = &codec->dapm;
191 int ret;
192
193 ret = snd_soc_dapm_new_controls(dapm, sdp4430_dmic_dapm_widgets,
194 ARRAY_SIZE(sdp4430_dmic_dapm_widgets));
195 if (ret)
196 return ret;
197
198 return snd_soc_dapm_add_routes(dapm, dmic_audio_map,
199 ARRAY_SIZE(dmic_audio_map));
200}
201
151/* Digital audio interface glue - connects codec <--> CPU */ 202/* Digital audio interface glue - connects codec <--> CPU */
152static struct snd_soc_dai_link sdp4430_dai = { 203static struct snd_soc_dai_link sdp4430_dai[] = {
153 .name = "TWL6040", 204 {
154 .stream_name = "TWL6040", 205 .name = "TWL6040",
155 .cpu_dai_name = "omap-mcpdm", 206 .stream_name = "TWL6040",
156 .codec_dai_name = "twl6040-legacy", 207 .cpu_dai_name = "omap-mcpdm",
157 .platform_name = "omap-pcm-audio", 208 .codec_dai_name = "twl6040-legacy",
158 .codec_name = "twl6040-codec", 209 .platform_name = "omap-pcm-audio",
159 .init = sdp4430_twl6040_init, 210 .codec_name = "twl6040-codec",
160 .ops = &sdp4430_ops, 211 .init = sdp4430_twl6040_init,
212 .ops = &sdp4430_ops,
213 },
214 {
215 .name = "DMIC",
216 .stream_name = "DMIC Capture",
217 .cpu_dai_name = "omap-dmic",
218 .codec_dai_name = "dmic-hifi",
219 .platform_name = "omap-pcm-audio",
220 .codec_name = "dmic-codec",
221 .init = sdp4430_dmic_init,
222 .ops = &sdp4430_dmic_ops,
223 },
161}; 224};
162 225
163/* Audio machine driver */ 226/* Audio machine driver */
164static struct snd_soc_card snd_soc_sdp4430 = { 227static struct snd_soc_card snd_soc_sdp4430 = {
165 .name = "SDP4430", 228 .name = "SDP4430",
166 .dai_link = &sdp4430_dai, 229 .owner = THIS_MODULE,
167 .num_links = 1, 230 .dai_link = sdp4430_dai,
231 .num_links = ARRAY_SIZE(sdp4430_dai),
168 232
169 .dapm_widgets = sdp4430_twl6040_dapm_widgets, 233 .dapm_widgets = sdp4430_twl6040_dapm_widgets,
170 .num_dapm_widgets = ARRAY_SIZE(sdp4430_twl6040_dapm_widgets), 234 .num_dapm_widgets = ARRAY_SIZE(sdp4430_twl6040_dapm_widgets),
diff --git a/sound/soc/omap/zoom2.c b/sound/soc/omap/zoom2.c
index 7641a7fa8f9..981616d61f6 100644
--- a/sound/soc/omap/zoom2.c
+++ b/sound/soc/omap/zoom2.c
@@ -157,6 +157,7 @@ static struct snd_soc_dai_link zoom2_dai[] = {
157/* Audio machine driver */ 157/* Audio machine driver */
158static struct snd_soc_card snd_soc_zoom2 = { 158static struct snd_soc_card snd_soc_zoom2 = {
159 .name = "Zoom2", 159 .name = "Zoom2",
160 .owner = THIS_MODULE,
160 .dai_link = zoom2_dai, 161 .dai_link = zoom2_dai,
161 .num_links = ARRAY_SIZE(zoom2_dai), 162 .num_links = ARRAY_SIZE(zoom2_dai),
162 163
diff --git a/sound/soc/pxa/Kconfig b/sound/soc/pxa/Kconfig
index ffd2242e305..a0f7d3cfa47 100644
--- a/sound/soc/pxa/Kconfig
+++ b/sound/soc/pxa/Kconfig
@@ -151,6 +151,7 @@ config SND_SOC_ZYLONITE
151config SND_SOC_RAUMFELD 151config SND_SOC_RAUMFELD
152 tristate "SoC Audio support Raumfeld audio adapter" 152 tristate "SoC Audio support Raumfeld audio adapter"
153 depends on SND_PXA2XX_SOC && (MACH_RAUMFELD_SPEAKER || MACH_RAUMFELD_CONNECTOR) 153 depends on SND_PXA2XX_SOC && (MACH_RAUMFELD_SPEAKER || MACH_RAUMFELD_CONNECTOR)
154 depends on I2C && SPI_MASTER
154 select SND_PXA_SOC_SSP 155 select SND_PXA_SOC_SSP
155 select SND_SOC_CS4270 156 select SND_SOC_CS4270
156 select SND_SOC_AK4104 157 select SND_SOC_AK4104
@@ -159,7 +160,7 @@ config SND_SOC_RAUMFELD
159 160
160config SND_PXA2XX_SOC_HX4700 161config SND_PXA2XX_SOC_HX4700
161 tristate "SoC Audio support for HP iPAQ hx4700" 162 tristate "SoC Audio support for HP iPAQ hx4700"
162 depends on SND_PXA2XX_SOC && MACH_H4700 163 depends on SND_PXA2XX_SOC && MACH_H4700 && I2C
163 select SND_PXA2XX_SOC_I2S 164 select SND_PXA2XX_SOC_I2S
164 select SND_SOC_AK4641 165 select SND_SOC_AK4641
165 help 166 help
diff --git a/sound/soc/pxa/corgi.c b/sound/soc/pxa/corgi.c
index b0e2fb72091..bc21944851c 100644
--- a/sound/soc/pxa/corgi.c
+++ b/sound/soc/pxa/corgi.c
@@ -142,18 +142,6 @@ static int corgi_hw_params(struct snd_pcm_substream *substream,
142 break; 142 break;
143 } 143 }
144 144
145 /* set codec DAI configuration */
146 ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S |
147 SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS);
148 if (ret < 0)
149 return ret;
150
151 /* set cpu DAI configuration */
152 ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S |
153 SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS);
154 if (ret < 0)
155 return ret;
156
157 /* set the codec system clock for DAC and ADC */ 145 /* set the codec system clock for DAC and ADC */
158 ret = snd_soc_dai_set_sysclk(codec_dai, WM8731_SYSCLK_XTAL, clk, 146 ret = snd_soc_dai_set_sysclk(codec_dai, WM8731_SYSCLK_XTAL, clk,
159 SND_SOC_CLOCK_IN); 147 SND_SOC_CLOCK_IN);
@@ -239,7 +227,7 @@ SND_SOC_DAPM_HP("Headset Jack", NULL),
239}; 227};
240 228
241/* Corgi machine audio map (connections to the codec pins) */ 229/* Corgi machine audio map (connections to the codec pins) */
242static const struct snd_soc_dapm_route audio_map[] = { 230static const struct snd_soc_dapm_route corgi_audio_map[] = {
243 231
244 /* headset Jack - in = micin, out = LHPOUT*/ 232 /* headset Jack - in = micin, out = LHPOUT*/
245 {"Headset Jack", NULL, "LHPOUT"}, 233 {"Headset Jack", NULL, "LHPOUT"},
@@ -281,24 +269,10 @@ static int corgi_wm8731_init(struct snd_soc_pcm_runtime *rtd)
281{ 269{
282 struct snd_soc_codec *codec = rtd->codec; 270 struct snd_soc_codec *codec = rtd->codec;
283 struct snd_soc_dapm_context *dapm = &codec->dapm; 271 struct snd_soc_dapm_context *dapm = &codec->dapm;
284 int err;
285 272
286 snd_soc_dapm_nc_pin(dapm, "LLINEIN"); 273 snd_soc_dapm_nc_pin(dapm, "LLINEIN");
287 snd_soc_dapm_nc_pin(dapm, "RLINEIN"); 274 snd_soc_dapm_nc_pin(dapm, "RLINEIN");
288 275
289 /* Add corgi specific controls */
290 err = snd_soc_add_controls(codec, wm8731_corgi_controls,
291 ARRAY_SIZE(wm8731_corgi_controls));
292 if (err < 0)
293 return err;
294
295 /* Add corgi specific widgets */
296 snd_soc_dapm_new_controls(dapm, wm8731_dapm_widgets,
297 ARRAY_SIZE(wm8731_dapm_widgets));
298
299 /* Set up corgi specific audio path audio_map */
300 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
301
302 return 0; 276 return 0;
303} 277}
304 278
@@ -311,48 +285,61 @@ static struct snd_soc_dai_link corgi_dai = {
311 .platform_name = "pxa-pcm-audio", 285 .platform_name = "pxa-pcm-audio",
312 .codec_name = "wm8731.0-001b", 286 .codec_name = "wm8731.0-001b",
313 .init = corgi_wm8731_init, 287 .init = corgi_wm8731_init,
288 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
289 SND_SOC_DAIFMT_CBS_CFS,
314 .ops = &corgi_ops, 290 .ops = &corgi_ops,
315}; 291};
316 292
317/* corgi audio machine driver */ 293/* corgi audio machine driver */
318static struct snd_soc_card snd_soc_corgi = { 294static struct snd_soc_card corgi = {
319 .name = "Corgi", 295 .name = "Corgi",
296 .owner = THIS_MODULE,
320 .dai_link = &corgi_dai, 297 .dai_link = &corgi_dai,
321 .num_links = 1, 298 .num_links = 1,
322};
323 299
324static struct platform_device *corgi_snd_device; 300 .controls = wm8731_corgi_controls,
301 .num_controls = ARRAY_SIZE(wm8731_corgi_controls),
302 .dapm_widgets = wm8731_dapm_widgets,
303 .num_dapm_widgets = ARRAY_SIZE(wm8731_dapm_widgets),
304 .dapm_routes = corgi_audio_map,
305 .num_dapm_routes = ARRAY_SIZE(corgi_audio_map),
306};
325 307
326static int __init corgi_init(void) 308static int __devinit corgi_probe(struct platform_device *pdev)
327{ 309{
310 struct snd_soc_card *card = &corgi;
328 int ret; 311 int ret;
329 312
330 if (!(machine_is_corgi() || machine_is_shepherd() || 313 card->dev = &pdev->dev;
331 machine_is_husky()))
332 return -ENODEV;
333
334 corgi_snd_device = platform_device_alloc("soc-audio", -1);
335 if (!corgi_snd_device)
336 return -ENOMEM;
337
338 platform_set_drvdata(corgi_snd_device, &snd_soc_corgi);
339 ret = platform_device_add(corgi_snd_device);
340 314
315 ret = snd_soc_register_card(card);
341 if (ret) 316 if (ret)
342 platform_device_put(corgi_snd_device); 317 dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n",
343 318 ret);
344 return ret; 319 return ret;
345} 320}
346 321
347static void __exit corgi_exit(void) 322static int __devexit corgi_remove(struct platform_device *pdev)
348{ 323{
349 platform_device_unregister(corgi_snd_device); 324 struct snd_soc_card *card = platform_get_drvdata(pdev);
325
326 snd_soc_unregister_card(card);
327 return 0;
350} 328}
351 329
352module_init(corgi_init); 330static struct platform_driver corgi_driver = {
353module_exit(corgi_exit); 331 .driver = {
332 .name = "corgi-audio",
333 .owner = THIS_MODULE,
334 },
335 .probe = corgi_probe,
336 .remove = __devexit_p(corgi_remove),
337};
338
339module_platform_driver(corgi_driver);
354 340
355/* Module information */ 341/* Module information */
356MODULE_AUTHOR("Richard Purdie"); 342MODULE_AUTHOR("Richard Purdie");
357MODULE_DESCRIPTION("ALSA SoC Corgi"); 343MODULE_DESCRIPTION("ALSA SoC Corgi");
358MODULE_LICENSE("GPL"); 344MODULE_LICENSE("GPL");
345MODULE_ALIAS("platform:corgi-audio");
diff --git a/sound/soc/pxa/e740_wm9705.c b/sound/soc/pxa/e740_wm9705.c
index 35ed7eb8cff..7b1bc239003 100644
--- a/sound/soc/pxa/e740_wm9705.c
+++ b/sound/soc/pxa/e740_wm9705.c
@@ -133,78 +133,60 @@ static struct snd_soc_dai_link e740_dai[] = {
133 133
134static struct snd_soc_card e740 = { 134static struct snd_soc_card e740 = {
135 .name = "Toshiba e740", 135 .name = "Toshiba e740",
136 .owner = THIS_MODULE,
136 .dai_link = e740_dai, 137 .dai_link = e740_dai,
137 .num_links = ARRAY_SIZE(e740_dai), 138 .num_links = ARRAY_SIZE(e740_dai),
138}; 139};
139 140
140static struct platform_device *e740_snd_device; 141static struct gpio e740_audio_gpios[] = {
142 { GPIO_E740_MIC_ON, GPIOF_OUT_INIT_LOW, "Mic amp" },
143 { GPIO_E740_AMP_ON, GPIOF_OUT_INIT_LOW, "Output amp" },
144 { GPIO_E740_WM9705_nAVDD2, GPIOF_OUT_INIT_HIGH, "Audio power" },
145};
141 146
142static int __init e740_init(void) 147static int __devinit e740_probe(struct platform_device *pdev)
143{ 148{
149 struct snd_soc_card *card = &e740;
144 int ret; 150 int ret;
145 151
146 if (!machine_is_e740()) 152 ret = gpio_request_array(e740_audio_gpios,
147 return -ENODEV; 153 ARRAY_SIZE(e740_audio_gpios));
148
149 ret = gpio_request(GPIO_E740_MIC_ON, "Mic amp");
150 if (ret) 154 if (ret)
151 return ret; 155 return ret;
152 156
153 ret = gpio_request(GPIO_E740_AMP_ON, "Output amp"); 157 card->dev = &pdev->dev;
154 if (ret)
155 goto free_mic_amp_gpio;
156
157 ret = gpio_request(GPIO_E740_WM9705_nAVDD2, "Audio power");
158 if (ret)
159 goto free_op_amp_gpio;
160
161 /* Disable audio */
162 ret = gpio_direction_output(GPIO_E740_MIC_ON, 0);
163 if (ret)
164 goto free_apwr_gpio;
165 ret = gpio_direction_output(GPIO_E740_AMP_ON, 0);
166 if (ret)
167 goto free_apwr_gpio;
168 ret = gpio_direction_output(GPIO_E740_WM9705_nAVDD2, 1);
169 if (ret)
170 goto free_apwr_gpio;
171 158
172 e740_snd_device = platform_device_alloc("soc-audio", -1); 159 ret = snd_soc_register_card(card);
173 if (!e740_snd_device) { 160 if (ret) {
174 ret = -ENOMEM; 161 dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n",
175 goto free_apwr_gpio; 162 ret);
163 gpio_free_array(e740_audio_gpios, ARRAY_SIZE(e740_audio_gpios));
176 } 164 }
177
178 platform_set_drvdata(e740_snd_device, &e740);
179 ret = platform_device_add(e740_snd_device);
180
181 if (!ret)
182 return 0;
183
184/* Fail gracefully */
185 platform_device_put(e740_snd_device);
186free_apwr_gpio:
187 gpio_free(GPIO_E740_WM9705_nAVDD2);
188free_op_amp_gpio:
189 gpio_free(GPIO_E740_AMP_ON);
190free_mic_amp_gpio:
191 gpio_free(GPIO_E740_MIC_ON);
192
193 return ret; 165 return ret;
194} 166}
195 167
196static void __exit e740_exit(void) 168static int __devexit e740_remove(struct platform_device *pdev)
197{ 169{
198 platform_device_unregister(e740_snd_device); 170 struct snd_soc_card *card = platform_get_drvdata(pdev);
199 gpio_free(GPIO_E740_WM9705_nAVDD2); 171
200 gpio_free(GPIO_E740_AMP_ON); 172 gpio_free_array(e740_audio_gpios, ARRAY_SIZE(e740_audio_gpios));
201 gpio_free(GPIO_E740_MIC_ON); 173 snd_soc_unregister_card(card);
174 return 0;
202} 175}
203 176
204module_init(e740_init); 177static struct platform_driver e740_driver = {
205module_exit(e740_exit); 178 .driver = {
179 .name = "e740-audio",
180 .owner = THIS_MODULE,
181 },
182 .probe = e740_probe,
183 .remove = __devexit_p(e740_remove),
184};
185
186module_platform_driver(e740_driver);
206 187
207/* Module information */ 188/* Module information */
208MODULE_AUTHOR("Ian Molton <spyro@f2s.com>"); 189MODULE_AUTHOR("Ian Molton <spyro@f2s.com>");
209MODULE_DESCRIPTION("ALSA SoC driver for e740"); 190MODULE_DESCRIPTION("ALSA SoC driver for e740");
210MODULE_LICENSE("GPL v2"); 191MODULE_LICENSE("GPL v2");
192MODULE_ALIAS("platform:e740-audio");
diff --git a/sound/soc/pxa/e750_wm9705.c b/sound/soc/pxa/e750_wm9705.c
index ce5f056009a..47b89d71e28 100644
--- a/sound/soc/pxa/e750_wm9705.c
+++ b/sound/soc/pxa/e750_wm9705.c
@@ -116,68 +116,59 @@ static struct snd_soc_dai_link e750_dai[] = {
116 116
117static struct snd_soc_card e750 = { 117static struct snd_soc_card e750 = {
118 .name = "Toshiba e750", 118 .name = "Toshiba e750",
119 .owner = THIS_MODULE,
119 .dai_link = e750_dai, 120 .dai_link = e750_dai,
120 .num_links = ARRAY_SIZE(e750_dai), 121 .num_links = ARRAY_SIZE(e750_dai),
121}; 122};
122 123
123static struct platform_device *e750_snd_device; 124static struct gpio e750_audio_gpios[] = {
125 { GPIO_E750_HP_AMP_OFF, GPIOF_OUT_INIT_HIGH, "Headphone amp" },
126 { GPIO_E750_SPK_AMP_OFF, GPIOF_OUT_INIT_HIGH, "Speaker amp" },
127};
124 128
125static int __init e750_init(void) 129static int __devinit e750_probe(struct platform_device *pdev)
126{ 130{
131 struct snd_soc_card *card = &e750;
127 int ret; 132 int ret;
128 133
129 if (!machine_is_e750()) 134 ret = gpio_request_array(e750_audio_gpios,
130 return -ENODEV; 135 ARRAY_SIZE(e750_audio_gpios));
131
132 ret = gpio_request(GPIO_E750_HP_AMP_OFF, "Headphone amp");
133 if (ret) 136 if (ret)
134 return ret; 137 return ret;
135 138
136 ret = gpio_request(GPIO_E750_SPK_AMP_OFF, "Speaker amp"); 139 card->dev = &pdev->dev;
137 if (ret)
138 goto free_hp_amp_gpio;
139
140 ret = gpio_direction_output(GPIO_E750_HP_AMP_OFF, 1);
141 if (ret)
142 goto free_spk_amp_gpio;
143
144 ret = gpio_direction_output(GPIO_E750_SPK_AMP_OFF, 1);
145 if (ret)
146 goto free_spk_amp_gpio;
147 140
148 e750_snd_device = platform_device_alloc("soc-audio", -1); 141 ret = snd_soc_register_card(card);
149 if (!e750_snd_device) { 142 if (ret) {
150 ret = -ENOMEM; 143 dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n",
151 goto free_spk_amp_gpio; 144 ret);
145 gpio_free_array(e750_audio_gpios, ARRAY_SIZE(e750_audio_gpios));
152 } 146 }
153
154 platform_set_drvdata(e750_snd_device, &e750);
155 ret = platform_device_add(e750_snd_device);
156
157 if (!ret)
158 return 0;
159
160/* Fail gracefully */
161 platform_device_put(e750_snd_device);
162free_spk_amp_gpio:
163 gpio_free(GPIO_E750_SPK_AMP_OFF);
164free_hp_amp_gpio:
165 gpio_free(GPIO_E750_HP_AMP_OFF);
166
167 return ret; 147 return ret;
168} 148}
169 149
170static void __exit e750_exit(void) 150static int __devexit e750_remove(struct platform_device *pdev)
171{ 151{
172 platform_device_unregister(e750_snd_device); 152 struct snd_soc_card *card = platform_get_drvdata(pdev);
173 gpio_free(GPIO_E750_SPK_AMP_OFF); 153
174 gpio_free(GPIO_E750_HP_AMP_OFF); 154 gpio_free_array(e750_audio_gpios, ARRAY_SIZE(e750_audio_gpios));
155 snd_soc_unregister_card(card);
156 return 0;
175} 157}
176 158
177module_init(e750_init); 159static struct platform_driver e750_driver = {
178module_exit(e750_exit); 160 .driver = {
161 .name = "e750-audio",
162 .owner = THIS_MODULE,
163 },
164 .probe = e750_probe,
165 .remove = __devexit_p(e750_remove),
166};
167
168module_platform_driver(e750_driver);
179 169
180/* Module information */ 170/* Module information */
181MODULE_AUTHOR("Ian Molton <spyro@f2s.com>"); 171MODULE_AUTHOR("Ian Molton <spyro@f2s.com>");
182MODULE_DESCRIPTION("ALSA SoC driver for e750"); 172MODULE_DESCRIPTION("ALSA SoC driver for e750");
183MODULE_LICENSE("GPL v2"); 173MODULE_LICENSE("GPL v2");
174MODULE_ALIAS("platform:e750-audio");
diff --git a/sound/soc/pxa/e800_wm9712.c b/sound/soc/pxa/e800_wm9712.c
index 6a8f38b6c37..ea9707ec6f2 100644
--- a/sound/soc/pxa/e800_wm9712.c
+++ b/sound/soc/pxa/e800_wm9712.c
@@ -106,66 +106,59 @@ static struct snd_soc_dai_link e800_dai[] = {
106 106
107static struct snd_soc_card e800 = { 107static struct snd_soc_card e800 = {
108 .name = "Toshiba e800", 108 .name = "Toshiba e800",
109 .owner = THIS_MODULE,
109 .dai_link = e800_dai, 110 .dai_link = e800_dai,
110 .num_links = ARRAY_SIZE(e800_dai), 111 .num_links = ARRAY_SIZE(e800_dai),
111}; 112};
112 113
113static struct platform_device *e800_snd_device; 114static struct gpio e800_audio_gpios[] = {
115 { GPIO_E800_SPK_AMP_ON, GPIOF_OUT_INIT_HIGH, "Headphone amp" },
116 { GPIO_E800_HP_AMP_OFF, GPIOF_OUT_INIT_HIGH, "Speaker amp" },
117};
114 118
115static int __init e800_init(void) 119static int __devinit e800_probe(struct platform_device *pdev)
116{ 120{
121 struct snd_soc_card *card = &e800;
117 int ret; 122 int ret;
118 123
119 if (!machine_is_e800()) 124 ret = gpio_request_array(e800_audio_gpios,
120 return -ENODEV; 125 ARRAY_SIZE(e800_audio_gpios));
121
122 ret = gpio_request(GPIO_E800_HP_AMP_OFF, "Headphone amp");
123 if (ret) 126 if (ret)
124 return ret; 127 return ret;
125 128
126 ret = gpio_request(GPIO_E800_SPK_AMP_ON, "Speaker amp"); 129 card->dev = &pdev->dev;
127 if (ret)
128 goto free_hp_amp_gpio;
129
130 ret = gpio_direction_output(GPIO_E800_HP_AMP_OFF, 1);
131 if (ret)
132 goto free_spk_amp_gpio;
133
134 ret = gpio_direction_output(GPIO_E800_SPK_AMP_ON, 1);
135 if (ret)
136 goto free_spk_amp_gpio;
137
138 e800_snd_device = platform_device_alloc("soc-audio", -1);
139 if (!e800_snd_device)
140 return -ENOMEM;
141
142 platform_set_drvdata(e800_snd_device, &e800);
143 ret = platform_device_add(e800_snd_device);
144
145 if (!ret)
146 return 0;
147
148/* Fail gracefully */
149 platform_device_put(e800_snd_device);
150free_spk_amp_gpio:
151 gpio_free(GPIO_E800_SPK_AMP_ON);
152free_hp_amp_gpio:
153 gpio_free(GPIO_E800_HP_AMP_OFF);
154 130
131 ret = snd_soc_register_card(card);
132 if (ret) {
133 dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n",
134 ret);
135 gpio_free_array(e800_audio_gpios, ARRAY_SIZE(e800_audio_gpios));
136 }
155 return ret; 137 return ret;
156} 138}
157 139
158static void __exit e800_exit(void) 140static int __devexit e800_remove(struct platform_device *pdev)
159{ 141{
160 platform_device_unregister(e800_snd_device); 142 struct snd_soc_card *card = platform_get_drvdata(pdev);
161 gpio_free(GPIO_E800_SPK_AMP_ON); 143
162 gpio_free(GPIO_E800_HP_AMP_OFF); 144 gpio_free_array(e800_audio_gpios, ARRAY_SIZE(e800_audio_gpios));
145 snd_soc_unregister_card(card);
146 return 0;
163} 147}
164 148
165module_init(e800_init); 149static struct platform_driver e800_driver = {
166module_exit(e800_exit); 150 .driver = {
151 .name = "e800-audio",
152 .owner = THIS_MODULE,
153 },
154 .probe = e800_probe,
155 .remove = __devexit_p(e800_remove),
156};
157
158module_platform_driver(e800_driver);
167 159
168/* Module information */ 160/* Module information */
169MODULE_AUTHOR("Ian Molton <spyro@f2s.com>"); 161MODULE_AUTHOR("Ian Molton <spyro@f2s.com>");
170MODULE_DESCRIPTION("ALSA SoC driver for e800"); 162MODULE_DESCRIPTION("ALSA SoC driver for e800");
171MODULE_LICENSE("GPL v2"); 163MODULE_LICENSE("GPL v2");
164MODULE_ALIAS("platform:e800-audio");
diff --git a/sound/soc/pxa/em-x270.c b/sound/soc/pxa/em-x270.c
index b13a4252812..64743a05aea 100644
--- a/sound/soc/pxa/em-x270.c
+++ b/sound/soc/pxa/em-x270.c
@@ -54,6 +54,7 @@ static struct snd_soc_dai_link em_x270_dai[] = {
54 54
55static struct snd_soc_card em_x270 = { 55static struct snd_soc_card em_x270 = {
56 .name = "EM-X270", 56 .name = "EM-X270",
57 .owner = THIS_MODULE,
57 .dai_link = em_x270_dai, 58 .dai_link = em_x270_dai,
58 .num_links = ARRAY_SIZE(em_x270_dai), 59 .num_links = ARRAY_SIZE(em_x270_dai),
59}; 60};
diff --git a/sound/soc/pxa/hx4700.c b/sound/soc/pxa/hx4700.c
index 65c124831a0..2a342c92d82 100644
--- a/sound/soc/pxa/hx4700.c
+++ b/sound/soc/pxa/hx4700.c
@@ -65,20 +65,6 @@ static int hx4700_hw_params(struct snd_pcm_substream *substream,
65 struct snd_soc_dai *cpu_dai = rtd->cpu_dai; 65 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
66 int ret = 0; 66 int ret = 0;
67 67
68 /* set codec DAI configuration */
69 ret = snd_soc_dai_set_fmt(codec_dai,
70 SND_SOC_DAIFMT_MSB | SND_SOC_DAIFMT_NB_NF |
71 SND_SOC_DAIFMT_CBS_CFS);
72 if (ret < 0)
73 return ret;
74
75 /* set cpu DAI configuration */
76 ret = snd_soc_dai_set_fmt(cpu_dai,
77 SND_SOC_DAIFMT_MSB | SND_SOC_DAIFMT_NB_NF |
78 SND_SOC_DAIFMT_CBS_CFS);
79 if (ret < 0)
80 return ret;
81
82 /* set the I2S system clock as output */ 68 /* set the I2S system clock as output */
83 ret = snd_soc_dai_set_sysclk(cpu_dai, PXA2XX_I2S_SYSCLK, 0, 69 ret = snd_soc_dai_set_sysclk(cpu_dai, PXA2XX_I2S_SYSCLK, 0,
84 SND_SOC_CLOCK_OUT); 70 SND_SOC_CLOCK_OUT);
@@ -175,12 +161,15 @@ static struct snd_soc_dai_link hx4700_dai = {
175 .platform_name = "pxa-pcm-audio", 161 .platform_name = "pxa-pcm-audio",
176 .codec_name = "ak4641.0-0012", 162 .codec_name = "ak4641.0-0012",
177 .init = hx4700_ak4641_init, 163 .init = hx4700_ak4641_init,
164 .dai_fmt = SND_SOC_DAIFMT_MSB | SND_SOC_DAIFMT_NB_NF |
165 SND_SOC_DAIFMT_CBS_CFS,
178 .ops = &hx4700_ops, 166 .ops = &hx4700_ops,
179}; 167};
180 168
181/* hx4700 audio machine driver */ 169/* hx4700 audio machine driver */
182static struct snd_soc_card snd_soc_card_hx4700 = { 170static struct snd_soc_card snd_soc_card_hx4700 = {
183 .name = "iPAQ hx4700", 171 .name = "iPAQ hx4700",
172 .owner = THIS_MODULE,
184 .dai_link = &hx4700_dai, 173 .dai_link = &hx4700_dai,
185 .num_links = 1, 174 .num_links = 1,
186 .dapm_widgets = hx4700_dapm_widgets, 175 .dapm_widgets = hx4700_dapm_widgets,
@@ -209,9 +198,10 @@ static int __devinit hx4700_audio_probe(struct platform_device *pdev)
209 snd_soc_card_hx4700.dev = &pdev->dev; 198 snd_soc_card_hx4700.dev = &pdev->dev;
210 ret = snd_soc_register_card(&snd_soc_card_hx4700); 199 ret = snd_soc_register_card(&snd_soc_card_hx4700);
211 if (ret) 200 if (ret)
212 return ret; 201 gpio_free_array(hx4700_audio_gpios,
202 ARRAY_SIZE(hx4700_audio_gpios));
213 203
214 return 0; 204 return ret;
215} 205}
216 206
217static int __devexit hx4700_audio_remove(struct platform_device *pdev) 207static int __devexit hx4700_audio_remove(struct platform_device *pdev)
@@ -236,18 +226,7 @@ static struct platform_driver hx4700_audio_driver = {
236 .remove = __devexit_p(hx4700_audio_remove), 226 .remove = __devexit_p(hx4700_audio_remove),
237}; 227};
238 228
239static int __init hx4700_modinit(void) 229module_platform_driver(hx4700_audio_driver);
240{
241 return platform_driver_register(&hx4700_audio_driver);
242}
243module_init(hx4700_modinit);
244
245static void __exit hx4700_modexit(void)
246{
247 platform_driver_unregister(&hx4700_audio_driver);
248}
249
250module_exit(hx4700_modexit);
251 230
252MODULE_AUTHOR("Philipp Zabel"); 231MODULE_AUTHOR("Philipp Zabel");
253MODULE_DESCRIPTION("ALSA SoC iPAQ hx4700"); 232MODULE_DESCRIPTION("ALSA SoC iPAQ hx4700");
diff --git a/sound/soc/pxa/imote2.c b/sound/soc/pxa/imote2.c
index 154fc6f2343..b93dafd32b8 100644
--- a/sound/soc/pxa/imote2.c
+++ b/sound/soc/pxa/imote2.c
@@ -30,20 +30,6 @@ static int imote2_asoc_hw_params(struct snd_pcm_substream *substream,
30 break; 30 break;
31 } 31 }
32 32
33 /* set codec DAI configuration */
34 ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S
35 | SND_SOC_DAIFMT_NB_NF
36 | SND_SOC_DAIFMT_CBS_CFS);
37 if (ret < 0)
38 return ret;
39
40 /* CPU should be clock master */
41 ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S
42 | SND_SOC_DAIFMT_NB_NF
43 | SND_SOC_DAIFMT_CBS_CFS);
44 if (ret < 0)
45 return ret;
46
47 ret = snd_soc_dai_set_sysclk(codec_dai, 0, clk, 33 ret = snd_soc_dai_set_sysclk(codec_dai, 0, clk,
48 SND_SOC_CLOCK_IN); 34 SND_SOC_CLOCK_IN);
49 if (ret < 0) 35 if (ret < 0)
@@ -67,42 +53,52 @@ static struct snd_soc_dai_link imote2_dai = {
67 .codec_dai_name = "wm8940-hifi", 53 .codec_dai_name = "wm8940-hifi",
68 .platform_name = "pxa-pcm-audio", 54 .platform_name = "pxa-pcm-audio",
69 .codec_name = "wm8940-codec.0-0034", 55 .codec_name = "wm8940-codec.0-0034",
56 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
57 SND_SOC_DAIFMT_CBS_CFS,
70 .ops = &imote2_asoc_ops, 58 .ops = &imote2_asoc_ops,
71}; 59};
72 60
73static struct snd_soc_card snd_soc_imote2 = { 61static struct snd_soc_card imote2 = {
74 .name = "Imote2", 62 .name = "Imote2",
63 .owner = THIS_MODULE,
75 .dai_link = &imote2_dai, 64 .dai_link = &imote2_dai,
76 .num_links = 1, 65 .num_links = 1,
77}; 66};
78 67
79static struct platform_device *imote2_snd_device; 68static int __devinit imote2_probe(struct platform_device *pdev)
80
81static int __init imote2_asoc_init(void)
82{ 69{
70 struct snd_soc_card *card = &imote2;
83 int ret; 71 int ret;
84 72
85 if (!machine_is_intelmote2()) 73 card->dev = &pdev->dev;
86 return -ENODEV;
87 imote2_snd_device = platform_device_alloc("soc-audio", -1);
88 if (!imote2_snd_device)
89 return -ENOMEM;
90 74
91 platform_set_drvdata(imote2_snd_device, &snd_soc_imote2); 75 ret = snd_soc_register_card(card);
92 ret = platform_device_add(imote2_snd_device);
93 if (ret) 76 if (ret)
94 platform_device_put(imote2_snd_device); 77 dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n",
95 78 ret);
96 return ret; 79 return ret;
97} 80}
98module_init(imote2_asoc_init);
99 81
100static void __exit imote2_asoc_exit(void) 82static int __devexit imote2_remove(struct platform_device *pdev)
101{ 83{
102 platform_device_unregister(imote2_snd_device); 84 struct snd_soc_card *card = platform_get_drvdata(pdev);
85
86 snd_soc_unregister_card(card);
87 return 0;
103} 88}
104module_exit(imote2_asoc_exit); 89
90static struct platform_driver imote2_driver = {
91 .driver = {
92 .name = "imote2-audio",
93 .owner = THIS_MODULE,
94 },
95 .probe = imote2_probe,
96 .remove = __devexit_p(imote2_remove),
97};
98
99module_platform_driver(imote2_driver);
105 100
106MODULE_AUTHOR("Jonathan Cameron"); 101MODULE_AUTHOR("Jonathan Cameron");
107MODULE_DESCRIPTION("ALSA SoC Imote 2"); 102MODULE_DESCRIPTION("ALSA SoC Imote 2");
108MODULE_LICENSE("GPL"); 103MODULE_LICENSE("GPL");
104MODULE_ALIAS("platform:imote2-audio");
diff --git a/sound/soc/pxa/magician.c b/sound/soc/pxa/magician.c
index e79f516c400..3f7a8ecb972 100644
--- a/sound/soc/pxa/magician.c
+++ b/sound/soc/pxa/magician.c
@@ -452,6 +452,7 @@ static struct snd_soc_dai_link magician_dai[] = {
452/* magician audio machine driver */ 452/* magician audio machine driver */
453static struct snd_soc_card snd_soc_card_magician = { 453static struct snd_soc_card snd_soc_card_magician = {
454 .name = "Magician", 454 .name = "Magician",
455 .owner = THIS_MODULE,
455 .dai_link = magician_dai, 456 .dai_link = magician_dai,
456 .num_links = ARRAY_SIZE(magician_dai), 457 .num_links = ARRAY_SIZE(magician_dai),
457 458
diff --git a/sound/soc/pxa/mioa701_wm9713.c b/sound/soc/pxa/mioa701_wm9713.c
index 0b8d1ee738a..9c585af59b5 100644
--- a/sound/soc/pxa/mioa701_wm9713.c
+++ b/sound/soc/pxa/mioa701_wm9713.c
@@ -181,6 +181,7 @@ static struct snd_soc_dai_link mioa701_dai[] = {
181 181
182static struct snd_soc_card mioa701 = { 182static struct snd_soc_card mioa701 = {
183 .name = "MioA701", 183 .name = "MioA701",
184 .owner = THIS_MODULE,
184 .dai_link = mioa701_dai, 185 .dai_link = mioa701_dai,
185 .num_links = ARRAY_SIZE(mioa701_dai), 186 .num_links = ARRAY_SIZE(mioa701_dai),
186}; 187};
@@ -227,18 +228,7 @@ static struct platform_driver mioa701_wm9713_driver = {
227 }, 228 },
228}; 229};
229 230
230static int __init mioa701_asoc_init(void) 231module_platform_driver(mioa701_wm9713_driver);
231{
232 return platform_driver_register(&mioa701_wm9713_driver);
233}
234
235static void __exit mioa701_asoc_exit(void)
236{
237 platform_driver_unregister(&mioa701_wm9713_driver);
238}
239
240module_init(mioa701_asoc_init);
241module_exit(mioa701_asoc_exit);
242 232
243/* Module information */ 233/* Module information */
244MODULE_AUTHOR("Robert Jarzmik (rjarzmik@free.fr)"); 234MODULE_AUTHOR("Robert Jarzmik (rjarzmik@free.fr)");
diff --git a/sound/soc/pxa/palm27x.c b/sound/soc/pxa/palm27x.c
index 7edc1fb71fa..db24bc685bd 100644
--- a/sound/soc/pxa/palm27x.c
+++ b/sound/soc/pxa/palm27x.c
@@ -146,6 +146,7 @@ static struct snd_soc_dai_link palm27x_dai[] = {
146 146
147static struct snd_soc_card palm27x_asoc = { 147static struct snd_soc_card palm27x_asoc = {
148 .name = "Palm/PXA27x", 148 .name = "Palm/PXA27x",
149 .owner = THIS_MODULE,
149 .dai_link = palm27x_dai, 150 .dai_link = palm27x_dai,
150 .num_links = ARRAY_SIZE(palm27x_dai), 151 .num_links = ARRAY_SIZE(palm27x_dai),
151}; 152};
@@ -201,18 +202,7 @@ static struct platform_driver palm27x_wm9712_driver = {
201 }, 202 },
202}; 203};
203 204
204static int __init palm27x_asoc_init(void) 205module_platform_driver(palm27x_wm9712_driver);
205{
206 return platform_driver_register(&palm27x_wm9712_driver);
207}
208
209static void __exit palm27x_asoc_exit(void)
210{
211 platform_driver_unregister(&palm27x_wm9712_driver);
212}
213
214module_init(palm27x_asoc_init);
215module_exit(palm27x_asoc_exit);
216 206
217/* Module information */ 207/* Module information */
218MODULE_AUTHOR("Marek Vasut <marek.vasut@gmail.com>"); 208MODULE_AUTHOR("Marek Vasut <marek.vasut@gmail.com>");
diff --git a/sound/soc/pxa/poodle.c b/sound/soc/pxa/poodle.c
index 4c29bc1f9cf..fd0ed10c6fe 100644
--- a/sound/soc/pxa/poodle.c
+++ b/sound/soc/pxa/poodle.c
@@ -121,18 +121,6 @@ static int poodle_hw_params(struct snd_pcm_substream *substream,
121 break; 121 break;
122 } 122 }
123 123
124 /* set codec DAI configuration */
125 ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S |
126 SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS);
127 if (ret < 0)
128 return ret;
129
130 /* set cpu DAI configuration */
131 ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S |
132 SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS);
133 if (ret < 0)
134 return ret;
135
136 /* set the codec system clock for DAC and ADC */ 124 /* set the codec system clock for DAC and ADC */
137 ret = snd_soc_dai_set_sysclk(codec_dai, WM8731_SYSCLK_XTAL, clk, 125 ret = snd_soc_dai_set_sysclk(codec_dai, WM8731_SYSCLK_XTAL, clk,
138 SND_SOC_CLOCK_IN); 126 SND_SOC_CLOCK_IN);
@@ -214,7 +202,7 @@ SND_SOC_DAPM_SPK("Ext Spk", poodle_amp_event),
214}; 202};
215 203
216/* Corgi machine connections to the codec pins */ 204/* Corgi machine connections to the codec pins */
217static const struct snd_soc_dapm_route audio_map[] = { 205static const struct snd_soc_dapm_route poodle_audio_map[] = {
218 206
219 /* headphone connected to LHPOUT1, RHPOUT1 */ 207 /* headphone connected to LHPOUT1, RHPOUT1 */
220 {"Headphone Jack", NULL, "LHPOUT"}, 208 {"Headphone Jack", NULL, "LHPOUT"},
@@ -246,25 +234,11 @@ static int poodle_wm8731_init(struct snd_soc_pcm_runtime *rtd)
246{ 234{
247 struct snd_soc_codec *codec = rtd->codec; 235 struct snd_soc_codec *codec = rtd->codec;
248 struct snd_soc_dapm_context *dapm = &codec->dapm; 236 struct snd_soc_dapm_context *dapm = &codec->dapm;
249 int err;
250 237
251 snd_soc_dapm_nc_pin(dapm, "LLINEIN"); 238 snd_soc_dapm_nc_pin(dapm, "LLINEIN");
252 snd_soc_dapm_nc_pin(dapm, "RLINEIN"); 239 snd_soc_dapm_nc_pin(dapm, "RLINEIN");
253 snd_soc_dapm_enable_pin(dapm, "MICIN"); 240 snd_soc_dapm_enable_pin(dapm, "MICIN");
254 241
255 /* Add poodle specific controls */
256 err = snd_soc_add_controls(codec, wm8731_poodle_controls,
257 ARRAY_SIZE(wm8731_poodle_controls));
258 if (err < 0)
259 return err;
260
261 /* Add poodle specific widgets */
262 snd_soc_dapm_new_controls(dapm, wm8731_dapm_widgets,
263 ARRAY_SIZE(wm8731_dapm_widgets));
264
265 /* Set up poodle specific audio path audio_map */
266 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
267
268 return 0; 242 return 0;
269} 243}
270 244
@@ -277,26 +251,31 @@ static struct snd_soc_dai_link poodle_dai = {
277 .platform_name = "pxa-pcm-audio", 251 .platform_name = "pxa-pcm-audio",
278 .codec_name = "wm8731.0-001b", 252 .codec_name = "wm8731.0-001b",
279 .init = poodle_wm8731_init, 253 .init = poodle_wm8731_init,
254 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
255 SND_SOC_DAIFMT_CBS_CFS,
280 .ops = &poodle_ops, 256 .ops = &poodle_ops,
281}; 257};
282 258
283/* poodle audio machine driver */ 259/* poodle audio machine driver */
284static struct snd_soc_card snd_soc_poodle = { 260static struct snd_soc_card poodle = {
285 .name = "Poodle", 261 .name = "Poodle",
286 .dai_link = &poodle_dai, 262 .dai_link = &poodle_dai,
287 .num_links = 1, 263 .num_links = 1,
288 .owner = THIS_MODULE, 264 .owner = THIS_MODULE,
289};
290 265
291static struct platform_device *poodle_snd_device; 266 .controls = wm8731_poodle_controls,
267 .num_controls = ARRAY_SIZE(wm8731_poodle_controls),
268 .dapm_widgets = wm8731_dapm_widgets,
269 .num_dapm_widgets = ARRAY_SIZE(wm8731_dapm_widgets),
270 .dapm_routes = poodle_audio_map,
271 .num_dapm_routes = ARRAY_SIZE(poodle_audio_map),
272};
292 273
293static int __init poodle_init(void) 274static int __devinit poodle_probe(struct platform_device *pdev)
294{ 275{
276 struct snd_soc_card *card = &poodle;
295 int ret; 277 int ret;
296 278
297 if (!machine_is_poodle())
298 return -ENODEV;
299
300 locomo_gpio_set_dir(&poodle_locomo_device.dev, 279 locomo_gpio_set_dir(&poodle_locomo_device.dev,
301 POODLE_LOCOMO_GPIO_AMP_ON, 0); 280 POODLE_LOCOMO_GPIO_AMP_ON, 0);
302 /* should we mute HP at startup - burning power ?*/ 281 /* should we mute HP at startup - burning power ?*/
@@ -305,28 +284,36 @@ static int __init poodle_init(void)
305 locomo_gpio_set_dir(&poodle_locomo_device.dev, 284 locomo_gpio_set_dir(&poodle_locomo_device.dev,
306 POODLE_LOCOMO_GPIO_MUTE_R, 0); 285 POODLE_LOCOMO_GPIO_MUTE_R, 0);
307 286
308 poodle_snd_device = platform_device_alloc("soc-audio", -1); 287 card->dev = &pdev->dev;
309 if (!poodle_snd_device)
310 return -ENOMEM;
311
312 platform_set_drvdata(poodle_snd_device, &snd_soc_poodle);
313 ret = platform_device_add(poodle_snd_device);
314 288
289 ret = snd_soc_register_card(card);
315 if (ret) 290 if (ret)
316 platform_device_put(poodle_snd_device); 291 dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n",
317 292 ret);
318 return ret; 293 return ret;
319} 294}
320 295
321static void __exit poodle_exit(void) 296static int __devexit poodle_remove(struct platform_device *pdev)
322{ 297{
323 platform_device_unregister(poodle_snd_device); 298 struct snd_soc_card *card = platform_get_drvdata(pdev);
299
300 snd_soc_unregister_card(card);
301 return 0;
324} 302}
325 303
326module_init(poodle_init); 304static struct platform_driver poodle_driver = {
327module_exit(poodle_exit); 305 .driver = {
306 .name = "poodle-audio",
307 .owner = THIS_MODULE,
308 },
309 .probe = poodle_probe,
310 .remove = __devexit_p(poodle_remove),
311};
312
313module_platform_driver(poodle_driver);
328 314
329/* Module information */ 315/* Module information */
330MODULE_AUTHOR("Richard Purdie"); 316MODULE_AUTHOR("Richard Purdie");
331MODULE_DESCRIPTION("ALSA SoC Poodle"); 317MODULE_DESCRIPTION("ALSA SoC Poodle");
332MODULE_LICENSE("GPL"); 318MODULE_LICENSE("GPL");
319MODULE_ALIAS("platform:poodle-audio");
diff --git a/sound/soc/pxa/pxa-ssp.c b/sound/soc/pxa/pxa-ssp.c
index 8ad93ee2e92..a57cfbc038e 100644
--- a/sound/soc/pxa/pxa-ssp.c
+++ b/sound/soc/pxa/pxa-ssp.c
@@ -771,7 +771,7 @@ static int pxa_ssp_remove(struct snd_soc_dai *dai)
771 SNDRV_PCM_FMTBIT_S24_LE | \ 771 SNDRV_PCM_FMTBIT_S24_LE | \
772 SNDRV_PCM_FMTBIT_S32_LE) 772 SNDRV_PCM_FMTBIT_S32_LE)
773 773
774static struct snd_soc_dai_ops pxa_ssp_dai_ops = { 774static const struct snd_soc_dai_ops pxa_ssp_dai_ops = {
775 .startup = pxa_ssp_startup, 775 .startup = pxa_ssp_startup,
776 .shutdown = pxa_ssp_shutdown, 776 .shutdown = pxa_ssp_shutdown,
777 .trigger = pxa_ssp_trigger, 777 .trigger = pxa_ssp_trigger,
@@ -825,17 +825,7 @@ static struct platform_driver asoc_ssp_driver = {
825 .remove = __devexit_p(asoc_ssp_remove), 825 .remove = __devexit_p(asoc_ssp_remove),
826}; 826};
827 827
828static int __init pxa_ssp_init(void) 828module_platform_driver(asoc_ssp_driver);
829{
830 return platform_driver_register(&asoc_ssp_driver);
831}
832module_init(pxa_ssp_init);
833
834static void __exit pxa_ssp_exit(void)
835{
836 platform_driver_unregister(&asoc_ssp_driver);
837}
838module_exit(pxa_ssp_exit);
839 829
840/* Module information */ 830/* Module information */
841MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>"); 831MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>");
diff --git a/sound/soc/pxa/pxa2xx-ac97.c b/sound/soc/pxa/pxa2xx-ac97.c
index ac51c6d25c4..837ff341fd6 100644
--- a/sound/soc/pxa/pxa2xx-ac97.c
+++ b/sound/soc/pxa/pxa2xx-ac97.c
@@ -163,15 +163,15 @@ static int pxa2xx_ac97_hw_mic_params(struct snd_pcm_substream *substream,
163 SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_44100 | \ 163 SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_44100 | \
164 SNDRV_PCM_RATE_48000) 164 SNDRV_PCM_RATE_48000)
165 165
166static struct snd_soc_dai_ops pxa_ac97_hifi_dai_ops = { 166static const struct snd_soc_dai_ops pxa_ac97_hifi_dai_ops = {
167 .hw_params = pxa2xx_ac97_hw_params, 167 .hw_params = pxa2xx_ac97_hw_params,
168}; 168};
169 169
170static struct snd_soc_dai_ops pxa_ac97_aux_dai_ops = { 170static const struct snd_soc_dai_ops pxa_ac97_aux_dai_ops = {
171 .hw_params = pxa2xx_ac97_hw_aux_params, 171 .hw_params = pxa2xx_ac97_hw_aux_params,
172}; 172};
173 173
174static struct snd_soc_dai_ops pxa_ac97_mic_dai_ops = { 174static const struct snd_soc_dai_ops pxa_ac97_mic_dai_ops = {
175 .hw_params = pxa2xx_ac97_hw_mic_params, 175 .hw_params = pxa2xx_ac97_hw_mic_params,
176}; 176};
177 177
@@ -263,17 +263,7 @@ static struct platform_driver pxa2xx_ac97_driver = {
263 }, 263 },
264}; 264};
265 265
266static int __init pxa_ac97_init(void) 266module_platform_driver(pxa2xx_ac97_driver);
267{
268 return platform_driver_register(&pxa2xx_ac97_driver);
269}
270module_init(pxa_ac97_init);
271
272static void __exit pxa_ac97_exit(void)
273{
274 platform_driver_unregister(&pxa2xx_ac97_driver);
275}
276module_exit(pxa_ac97_exit);
277 267
278MODULE_AUTHOR("Nicolas Pitre"); 268MODULE_AUTHOR("Nicolas Pitre");
279MODULE_DESCRIPTION("AC97 driver for the Intel PXA2xx chip"); 269MODULE_DESCRIPTION("AC97 driver for the Intel PXA2xx chip");
diff --git a/sound/soc/pxa/pxa2xx-i2s.c b/sound/soc/pxa/pxa2xx-i2s.c
index 11be5952a50..609abd51e55 100644
--- a/sound/soc/pxa/pxa2xx-i2s.c
+++ b/sound/soc/pxa/pxa2xx-i2s.c
@@ -331,7 +331,7 @@ static int pxa2xx_i2s_remove(struct snd_soc_dai *dai)
331 SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_44100 | \ 331 SNDRV_PCM_RATE_16000 | SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_44100 | \
332 SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_96000) 332 SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_96000)
333 333
334static struct snd_soc_dai_ops pxa_i2s_dai_ops = { 334static const struct snd_soc_dai_ops pxa_i2s_dai_ops = {
335 .startup = pxa2xx_i2s_startup, 335 .startup = pxa2xx_i2s_startup,
336 .shutdown = pxa2xx_i2s_shutdown, 336 .shutdown = pxa2xx_i2s_shutdown,
337 .trigger = pxa2xx_i2s_trigger, 337 .trigger = pxa2xx_i2s_trigger,
diff --git a/sound/soc/pxa/pxa2xx-pcm.c b/sound/soc/pxa/pxa2xx-pcm.c
index 600676f709a..fdd6bedef9b 100644
--- a/sound/soc/pxa/pxa2xx-pcm.c
+++ b/sound/soc/pxa/pxa2xx-pcm.c
@@ -141,17 +141,7 @@ static struct platform_driver pxa_pcm_driver = {
141 .remove = __devexit_p(pxa2xx_soc_platform_remove), 141 .remove = __devexit_p(pxa2xx_soc_platform_remove),
142}; 142};
143 143
144static int __init snd_pxa_pcm_init(void) 144module_platform_driver(pxa_pcm_driver);
145{
146 return platform_driver_register(&pxa_pcm_driver);
147}
148module_init(snd_pxa_pcm_init);
149
150static void __exit snd_pxa_pcm_exit(void)
151{
152 platform_driver_unregister(&pxa_pcm_driver);
153}
154module_exit(snd_pxa_pcm_exit);
155 145
156MODULE_AUTHOR("Nicolas Pitre"); 146MODULE_AUTHOR("Nicolas Pitre");
157MODULE_DESCRIPTION("Intel PXA2xx PCM DMA module"); 147MODULE_DESCRIPTION("Intel PXA2xx PCM DMA module");
diff --git a/sound/soc/pxa/raumfeld.c b/sound/soc/pxa/raumfeld.c
index b899a3bc8f4..ba1545188ec 100644
--- a/sound/soc/pxa/raumfeld.c
+++ b/sound/soc/pxa/raumfeld.c
@@ -260,6 +260,7 @@ static struct snd_soc_dai_link snd_soc_raumfeld_speaker_dai[] =
260 260
261static struct snd_soc_card snd_soc_raumfeld_connector = { 261static struct snd_soc_card snd_soc_raumfeld_connector = {
262 .name = "Raumfeld Connector", 262 .name = "Raumfeld Connector",
263 .owner = THIS_MODULE,
263 .dai_link = snd_soc_raumfeld_connector_dai, 264 .dai_link = snd_soc_raumfeld_connector_dai,
264 .num_links = ARRAY_SIZE(snd_soc_raumfeld_connector_dai), 265 .num_links = ARRAY_SIZE(snd_soc_raumfeld_connector_dai),
265 .suspend_post = raumfeld_analog_suspend, 266 .suspend_post = raumfeld_analog_suspend,
@@ -268,6 +269,7 @@ static struct snd_soc_card snd_soc_raumfeld_connector = {
268 269
269static struct snd_soc_card snd_soc_raumfeld_speaker = { 270static struct snd_soc_card snd_soc_raumfeld_speaker = {
270 .name = "Raumfeld Speaker", 271 .name = "Raumfeld Speaker",
272 .owner = THIS_MODULE,
271 .dai_link = snd_soc_raumfeld_speaker_dai, 273 .dai_link = snd_soc_raumfeld_speaker_dai,
272 .num_links = ARRAY_SIZE(snd_soc_raumfeld_speaker_dai), 274 .num_links = ARRAY_SIZE(snd_soc_raumfeld_speaker_dai),
273 .suspend_post = raumfeld_analog_suspend, 275 .suspend_post = raumfeld_analog_suspend,
diff --git a/sound/soc/pxa/saarb.c b/sound/soc/pxa/saarb.c
index d9467a2c6de..c34146b776b 100644
--- a/sound/soc/pxa/saarb.c
+++ b/sound/soc/pxa/saarb.c
@@ -51,7 +51,7 @@ static const struct snd_soc_dapm_widget saarb_dapm_widgets[] = {
51}; 51};
52 52
53/* saarb machine audio map */ 53/* saarb machine audio map */
54static const struct snd_soc_dapm_route audio_map[] = { 54static const struct snd_soc_dapm_route saarb_audio_map[] = {
55 {"Headset Stereophone", NULL, "HS1"}, 55 {"Headset Stereophone", NULL, "HS1"},
56 {"Headset Stereophone", NULL, "HS2"}, 56 {"Headset Stereophone", NULL, "HS2"},
57 57
@@ -92,15 +92,6 @@ static int saarb_i2s_hw_params(struct snd_pcm_substream *substream,
92 if (ret < 0) 92 if (ret < 0)
93 return ret; 93 return ret;
94 94
95 ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S |
96 SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM);
97 if (ret < 0)
98 return ret;
99 ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S |
100 SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM);
101 if (ret < 0)
102 return ret;
103
104 ret = snd_soc_dai_set_tdm_slot(cpu_dai, 3, 3, 2, width); 95 ret = snd_soc_dai_set_tdm_slot(cpu_dai, 3, 3, 2, width);
105 96
106 return ret; 97 return ret;
@@ -119,25 +110,28 @@ static struct snd_soc_dai_link saarb_dai[] = {
119 .platform_name = "pxa-pcm-audio", 110 .platform_name = "pxa-pcm-audio",
120 .codec_name = "88pm860x-codec", 111 .codec_name = "88pm860x-codec",
121 .init = saarb_pm860x_init, 112 .init = saarb_pm860x_init,
113 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
114 SND_SOC_DAIFMT_CBM_CFM,
122 .ops = &saarb_i2s_ops, 115 .ops = &saarb_i2s_ops,
123 }, 116 },
124}; 117};
125 118
126static struct snd_soc_card snd_soc_card_saarb = { 119static struct snd_soc_card snd_soc_card_saarb = {
127 .name = "Saarb", 120 .name = "Saarb",
121 .owner = THIS_MODULE,
128 .dai_link = saarb_dai, 122 .dai_link = saarb_dai,
129 .num_links = ARRAY_SIZE(saarb_dai), 123 .num_links = ARRAY_SIZE(saarb_dai),
124
125 .dapm_widgets = saarb_dapm_widgets,
126 .num_dapm_widgets = ARRAY_SIZE(saarb_dapm_widgets),
127 .dapm_routes = saarb_audio_map,
128 .num_dapm_routes = ARRAY_SIZE(saarb_audio_map),
130}; 129};
131 130
132static int saarb_pm860x_init(struct snd_soc_pcm_runtime *rtd) 131static int saarb_pm860x_init(struct snd_soc_pcm_runtime *rtd)
133{ 132{
134 struct snd_soc_codec *codec = rtd->codec; 133 struct snd_soc_codec *codec = rtd->codec;
135 struct snd_soc_dapm_context *dapm = &codec->dapm; 134 struct snd_soc_dapm_context *dapm = &codec->dapm;
136 int ret;
137
138 snd_soc_dapm_new_controls(dapm, saarb_dapm_widgets,
139 ARRAY_SIZE(saarb_dapm_widgets));
140 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
141 135
142 /* connected pins */ 136 /* connected pins */
143 snd_soc_dapm_enable_pin(dapm, "Ext Speaker"); 137 snd_soc_dapm_enable_pin(dapm, "Ext Speaker");
diff --git a/sound/soc/pxa/spitz.c b/sound/soc/pxa/spitz.c
index c2d6ff9b158..90c5245c474 100644
--- a/sound/soc/pxa/spitz.c
+++ b/sound/soc/pxa/spitz.c
@@ -143,18 +143,6 @@ static int spitz_hw_params(struct snd_pcm_substream *substream,
143 break; 143 break;
144 } 144 }
145 145
146 /* set codec DAI configuration */
147 ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S |
148 SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS);
149 if (ret < 0)
150 return ret;
151
152 /* set cpu DAI configuration */
153 ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S |
154 SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS);
155 if (ret < 0)
156 return ret;
157
158 /* set the codec system clock for DAC and ADC */ 146 /* set the codec system clock for DAC and ADC */
159 ret = snd_soc_dai_set_sysclk(codec_dai, WM8750_SYSCLK, clk, 147 ret = snd_soc_dai_set_sysclk(codec_dai, WM8750_SYSCLK, clk,
160 SND_SOC_CLOCK_IN); 148 SND_SOC_CLOCK_IN);
@@ -234,7 +222,7 @@ static const struct snd_soc_dapm_widget wm8750_dapm_widgets[] = {
234}; 222};
235 223
236/* Spitz machine audio_map */ 224/* Spitz machine audio_map */
237static const struct snd_soc_dapm_route audio_map[] = { 225static const struct snd_soc_dapm_route spitz_audio_map[] = {
238 226
239 /* headphone connected to LOUT1, ROUT1 */ 227 /* headphone connected to LOUT1, ROUT1 */
240 {"Headphone Jack", NULL, "LOUT1"}, 228 {"Headphone Jack", NULL, "LOUT1"},
@@ -277,7 +265,6 @@ static int spitz_wm8750_init(struct snd_soc_pcm_runtime *rtd)
277{ 265{
278 struct snd_soc_codec *codec = rtd->codec; 266 struct snd_soc_codec *codec = rtd->codec;
279 struct snd_soc_dapm_context *dapm = &codec->dapm; 267 struct snd_soc_dapm_context *dapm = &codec->dapm;
280 int err;
281 268
282 /* NC codec pins */ 269 /* NC codec pins */
283 snd_soc_dapm_nc_pin(dapm, "RINPUT1"); 270 snd_soc_dapm_nc_pin(dapm, "RINPUT1");
@@ -288,19 +275,6 @@ static int spitz_wm8750_init(struct snd_soc_pcm_runtime *rtd)
288 snd_soc_dapm_nc_pin(dapm, "OUT3"); 275 snd_soc_dapm_nc_pin(dapm, "OUT3");
289 snd_soc_dapm_nc_pin(dapm, "MONO1"); 276 snd_soc_dapm_nc_pin(dapm, "MONO1");
290 277
291 /* Add spitz specific controls */
292 err = snd_soc_add_controls(codec, wm8750_spitz_controls,
293 ARRAY_SIZE(wm8750_spitz_controls));
294 if (err < 0)
295 return err;
296
297 /* Add spitz specific widgets */
298 snd_soc_dapm_new_controls(dapm, wm8750_dapm_widgets,
299 ARRAY_SIZE(wm8750_dapm_widgets));
300
301 /* Set up spitz specific audio paths */
302 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
303
304 return 0; 278 return 0;
305} 279}
306 280
@@ -313,14 +287,24 @@ static struct snd_soc_dai_link spitz_dai = {
313 .platform_name = "pxa-pcm-audio", 287 .platform_name = "pxa-pcm-audio",
314 .codec_name = "wm8750.0-001b", 288 .codec_name = "wm8750.0-001b",
315 .init = spitz_wm8750_init, 289 .init = spitz_wm8750_init,
290 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
291 SND_SOC_DAIFMT_CBS_CFS,
316 .ops = &spitz_ops, 292 .ops = &spitz_ops,
317}; 293};
318 294
319/* spitz audio machine driver */ 295/* spitz audio machine driver */
320static struct snd_soc_card snd_soc_spitz = { 296static struct snd_soc_card snd_soc_spitz = {
321 .name = "Spitz", 297 .name = "Spitz",
298 .owner = THIS_MODULE,
322 .dai_link = &spitz_dai, 299 .dai_link = &spitz_dai,
323 .num_links = 1, 300 .num_links = 1,
301
302 .controls = wm8750_spitz_controls,
303 .num_controls = ARRAY_SIZE(wm8750_spitz_controls),
304 .dapm_widgets = wm8750_dapm_widgets,
305 .num_dapm_widgets = ARRAY_SIZE(wm8750_dapm_widgets),
306 .dapm_routes = spitz_audio_map,
307 .num_dapm_routes = ARRAY_SIZE(spitz_audio_map),
324}; 308};
325 309
326static struct platform_device *spitz_snd_device; 310static struct platform_device *spitz_snd_device;
diff --git a/sound/soc/pxa/tavorevb3.c b/sound/soc/pxa/tavorevb3.c
index eeec892e0e0..8b5ab8f7272 100644
--- a/sound/soc/pxa/tavorevb3.c
+++ b/sound/soc/pxa/tavorevb3.c
@@ -51,7 +51,7 @@ static const struct snd_soc_dapm_widget evb3_dapm_widgets[] = {
51}; 51};
52 52
53/* tavorevb3 machine audio map */ 53/* tavorevb3 machine audio map */
54static const struct snd_soc_dapm_route audio_map[] = { 54static const struct snd_soc_dapm_route evb3_audio_map[] = {
55 {"Headset Stereophone", NULL, "HS1"}, 55 {"Headset Stereophone", NULL, "HS1"},
56 {"Headset Stereophone", NULL, "HS2"}, 56 {"Headset Stereophone", NULL, "HS2"},
57 57
@@ -92,16 +92,6 @@ static int evb3_i2s_hw_params(struct snd_pcm_substream *substream,
92 if (ret < 0) 92 if (ret < 0)
93 return ret; 93 return ret;
94 94
95 ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S |
96 SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM);
97 if (ret < 0)
98 return ret;
99
100 ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S |
101 SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBM_CFM);
102 if (ret < 0)
103 return ret;
104
105 ret = snd_soc_dai_set_tdm_slot(cpu_dai, 3, 3, 2, width); 95 ret = snd_soc_dai_set_tdm_slot(cpu_dai, 3, 3, 2, width);
106 return ret; 96 return ret;
107} 97}
@@ -119,25 +109,28 @@ static struct snd_soc_dai_link evb3_dai[] = {
119 .platform_name = "pxa-pcm-audio", 109 .platform_name = "pxa-pcm-audio",
120 .codec_name = "88pm860x-codec", 110 .codec_name = "88pm860x-codec",
121 .init = evb3_pm860x_init, 111 .init = evb3_pm860x_init,
112 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
113 SND_SOC_DAIFMT_CBM_CFM,
122 .ops = &evb3_i2s_ops, 114 .ops = &evb3_i2s_ops,
123 }, 115 },
124}; 116};
125 117
126static struct snd_soc_card snd_soc_card_evb3 = { 118static struct snd_soc_card snd_soc_card_evb3 = {
127 .name = "Tavor EVB3", 119 .name = "Tavor EVB3",
120 .owner = THIS_MODULE,
128 .dai_link = evb3_dai, 121 .dai_link = evb3_dai,
129 .num_links = ARRAY_SIZE(evb3_dai), 122 .num_links = ARRAY_SIZE(evb3_dai),
123
124 .dapm_widgets = evb3_dapm_widgets,
125 .num_dapm_widgets = ARRAY_SIZE(evb3_dapm_widgets),
126 .dapm_routes = evb3_audio_map,
127 .num_dapm_routes = ARRAY_SIZE(evb3_audio_map),
130}; 128};
131 129
132static int evb3_pm860x_init(struct snd_soc_pcm_runtime *rtd) 130static int evb3_pm860x_init(struct snd_soc_pcm_runtime *rtd)
133{ 131{
134 struct snd_soc_codec *codec = rtd->codec; 132 struct snd_soc_codec *codec = rtd->codec;
135 struct snd_soc_dapm_context *dapm = &codec->dapm; 133 struct snd_soc_dapm_context *dapm = &codec->dapm;
136 int ret;
137
138 snd_soc_dapm_new_controls(dapm, evb3_dapm_widgets,
139 ARRAY_SIZE(evb3_dapm_widgets));
140 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
141 134
142 /* connected pins */ 135 /* connected pins */
143 snd_soc_dapm_enable_pin(dapm, "Ext Speaker"); 136 snd_soc_dapm_enable_pin(dapm, "Ext Speaker");
diff --git a/sound/soc/pxa/tosa.c b/sound/soc/pxa/tosa.c
index 620fc69ae63..564ef08a89f 100644
--- a/sound/soc/pxa/tosa.c
+++ b/sound/soc/pxa/tosa.c
@@ -34,8 +34,6 @@
34#include "../codecs/wm9712.h" 34#include "../codecs/wm9712.h"
35#include "pxa2xx-ac97.h" 35#include "pxa2xx-ac97.h"
36 36
37static struct snd_soc_card tosa;
38
39#define TOSA_HP 0 37#define TOSA_HP 0
40#define TOSA_MIC_INT 1 38#define TOSA_MIC_INT 1
41#define TOSA_HEADSET 2 39#define TOSA_HEADSET 2
@@ -236,70 +234,56 @@ static struct snd_soc_dai_link tosa_dai[] = {
236}, 234},
237}; 235};
238 236
239static int tosa_probe(struct snd_soc_card *card)
240{
241 int ret;
242
243 ret = gpio_request(TOSA_GPIO_L_MUTE, "Headphone Jack");
244 if (ret)
245 return ret;
246 ret = gpio_direction_output(TOSA_GPIO_L_MUTE, 0);
247 if (ret)
248 gpio_free(TOSA_GPIO_L_MUTE);
249
250 return ret;
251}
252
253static int tosa_remove(struct snd_soc_card *card)
254{
255 gpio_free(TOSA_GPIO_L_MUTE);
256 return 0;
257}
258
259static struct snd_soc_card tosa = { 237static struct snd_soc_card tosa = {
260 .name = "Tosa", 238 .name = "Tosa",
239 .owner = THIS_MODULE,
261 .dai_link = tosa_dai, 240 .dai_link = tosa_dai,
262 .num_links = ARRAY_SIZE(tosa_dai), 241 .num_links = ARRAY_SIZE(tosa_dai),
263 .probe = tosa_probe,
264 .remove = tosa_remove,
265}; 242};
266 243
267static struct platform_device *tosa_snd_device; 244static int __devinit tosa_probe(struct platform_device *pdev)
268
269static int __init tosa_init(void)
270{ 245{
246 struct snd_soc_card *card = &tosa;
271 int ret; 247 int ret;
272 248
273 if (!machine_is_tosa()) 249 ret = gpio_request_one(TOSA_GPIO_L_MUTE, GPIOF_OUT_INIT_LOW,
274 return -ENODEV; 250 "Headphone Jack");
275 251 if (ret)
276 tosa_snd_device = platform_device_alloc("soc-audio", -1); 252 return ret;
277 if (!tosa_snd_device) {
278 ret = -ENOMEM;
279 goto err_alloc;
280 }
281
282 platform_set_drvdata(tosa_snd_device, &tosa);
283 ret = platform_device_add(tosa_snd_device);
284
285 if (!ret)
286 return 0;
287 253
288 platform_device_put(tosa_snd_device); 254 card->dev = &pdev->dev;
289 255
290err_alloc: 256 ret = snd_soc_register_card(card);
257 if (ret) {
258 dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n",
259 ret);
260 gpio_free(TOSA_GPIO_L_MUTE);
261 }
291 return ret; 262 return ret;
292} 263}
293 264
294static void __exit tosa_exit(void) 265static int __devexit tosa_remove(struct platform_device *pdev)
295{ 266{
296 platform_device_unregister(tosa_snd_device); 267 struct snd_soc_card *card = platform_get_drvdata(pdev);
268
269 gpio_free(TOSA_GPIO_L_MUTE);
270 snd_soc_unregister_card(card);
271 return 0;
297} 272}
298 273
299module_init(tosa_init); 274static struct platform_driver tosa_driver = {
300module_exit(tosa_exit); 275 .driver = {
276 .name = "tosa-audio",
277 .owner = THIS_MODULE,
278 },
279 .probe = tosa_probe,
280 .remove = __devexit_p(tosa_remove),
281};
282
283module_platform_driver(tosa_driver);
301 284
302/* Module information */ 285/* Module information */
303MODULE_AUTHOR("Richard Purdie"); 286MODULE_AUTHOR("Richard Purdie");
304MODULE_DESCRIPTION("ALSA SoC Tosa"); 287MODULE_DESCRIPTION("ALSA SoC Tosa");
305MODULE_LICENSE("GPL"); 288MODULE_LICENSE("GPL");
289MODULE_ALIAS("platform:tosa-audio");
diff --git a/sound/soc/pxa/z2.c b/sound/soc/pxa/z2.c
index b311ffe04b7..76ccb172d0a 100644
--- a/sound/soc/pxa/z2.c
+++ b/sound/soc/pxa/z2.c
@@ -56,18 +56,6 @@ static int z2_hw_params(struct snd_pcm_substream *substream,
56 break; 56 break;
57 } 57 }
58 58
59 /* set codec DAI configuration */
60 ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S |
61 SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS);
62 if (ret < 0)
63 return ret;
64
65 /* set cpu DAI configuration */
66 ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S |
67 SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS);
68 if (ret < 0)
69 return ret;
70
71 /* set the codec system clock for DAC and ADC */ 59 /* set the codec system clock for DAC and ADC */
72 ret = snd_soc_dai_set_sysclk(codec_dai, WM8750_SYSCLK, clk, 60 ret = snd_soc_dai_set_sysclk(codec_dai, WM8750_SYSCLK, clk,
73 SND_SOC_CLOCK_IN); 61 SND_SOC_CLOCK_IN);
@@ -124,7 +112,7 @@ static const struct snd_soc_dapm_widget wm8750_dapm_widgets[] = {
124}; 112};
125 113
126/* Z2 machine audio_map */ 114/* Z2 machine audio_map */
127static const struct snd_soc_dapm_route audio_map[] = { 115static const struct snd_soc_dapm_route z2_audio_map[] = {
128 116
129 /* headphone connected to LOUT1, ROUT1 */ 117 /* headphone connected to LOUT1, ROUT1 */
130 {"Headphone Jack", NULL, "LOUT1"}, 118 {"Headphone Jack", NULL, "LOUT1"},
@@ -154,13 +142,6 @@ static int z2_wm8750_init(struct snd_soc_pcm_runtime *rtd)
154 snd_soc_dapm_disable_pin(dapm, "OUT3"); 142 snd_soc_dapm_disable_pin(dapm, "OUT3");
155 snd_soc_dapm_disable_pin(dapm, "MONO1"); 143 snd_soc_dapm_disable_pin(dapm, "MONO1");
156 144
157 /* Add z2 specific widgets */
158 snd_soc_dapm_new_controls(dapm, wm8750_dapm_widgets,
159 ARRAY_SIZE(wm8750_dapm_widgets));
160
161 /* Set up z2 specific audio paths */
162 snd_soc_dapm_add_routes(dapm, audio_map, ARRAY_SIZE(audio_map));
163
164 /* Jack detection API stuff */ 145 /* Jack detection API stuff */
165 ret = snd_soc_jack_new(codec, "Headset Jack", SND_JACK_HEADSET, 146 ret = snd_soc_jack_new(codec, "Headset Jack", SND_JACK_HEADSET,
166 &hs_jack); 147 &hs_jack);
@@ -196,14 +177,22 @@ static struct snd_soc_dai_link z2_dai = {
196 .platform_name = "pxa-pcm-audio", 177 .platform_name = "pxa-pcm-audio",
197 .codec_name = "wm8750.0-001b", 178 .codec_name = "wm8750.0-001b",
198 .init = z2_wm8750_init, 179 .init = z2_wm8750_init,
180 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF |
181 SND_SOC_DAIFMT_CBS_CFS,
199 .ops = &z2_ops, 182 .ops = &z2_ops,
200}; 183};
201 184
202/* z2 audio machine driver */ 185/* z2 audio machine driver */
203static struct snd_soc_card snd_soc_z2 = { 186static struct snd_soc_card snd_soc_z2 = {
204 .name = "Z2", 187 .name = "Z2",
188 .owner = THIS_MODULE,
205 .dai_link = &z2_dai, 189 .dai_link = &z2_dai,
206 .num_links = 1, 190 .num_links = 1,
191
192 .dapm_widgets = wm8750_dapm_widgets,
193 .num_dapm_widgets = ARRAY_SIZE(wm8750_dapm_widgets),
194 .dapm_routes = z2_audio_map,
195 .num_dapm_routes = ARRAY_SIZE(z2_audio_map),
207}; 196};
208 197
209static struct platform_device *z2_snd_device; 198static struct platform_device *z2_snd_device;
diff --git a/sound/soc/pxa/zylonite.c b/sound/soc/pxa/zylonite.c
index 580aae38e50..ceb656695b0 100644
--- a/sound/soc/pxa/zylonite.c
+++ b/sound/soc/pxa/zylonite.c
@@ -249,6 +249,7 @@ static int zylonite_resume_pre(struct snd_soc_card *card)
249 249
250static struct snd_soc_card zylonite = { 250static struct snd_soc_card zylonite = {
251 .name = "Zylonite", 251 .name = "Zylonite",
252 .owner = THIS_MODULE,
252 .probe = &zylonite_probe, 253 .probe = &zylonite_probe,
253 .remove = &zylonite_remove, 254 .remove = &zylonite_remove,
254 .suspend_post = &zylonite_suspend_post, 255 .suspend_post = &zylonite_suspend_post,
diff --git a/sound/soc/s6000/s6000-i2s.c b/sound/soc/s6000/s6000-i2s.c
index 3052f64b240..aaabdbaec19 100644
--- a/sound/soc/s6000/s6000-i2s.c
+++ b/sound/soc/s6000/s6000-i2s.c
@@ -409,7 +409,7 @@ static int s6000_i2s_dai_probe(struct snd_soc_dai *dai)
409 SNDRV_PCM_RATE_8000_192000) 409 SNDRV_PCM_RATE_8000_192000)
410#define S6000_I2S_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S32_LE) 410#define S6000_I2S_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S32_LE)
411 411
412static struct snd_soc_dai_ops s6000_i2s_dai_ops = { 412static const struct snd_soc_dai_ops s6000_i2s_dai_ops = {
413 .set_fmt = s6000_i2s_set_dai_fmt, 413 .set_fmt = s6000_i2s_set_dai_fmt,
414 .set_clkdiv = s6000_i2s_set_clkdiv, 414 .set_clkdiv = s6000_i2s_set_clkdiv,
415 .hw_params = s6000_i2s_hw_params, 415 .hw_params = s6000_i2s_hw_params,
@@ -604,17 +604,7 @@ static struct platform_driver s6000_i2s_driver = {
604 }, 604 },
605}; 605};
606 606
607static int __init s6000_i2s_init(void) 607module_platform_driver(s6000_i2s_driver);
608{
609 return platform_driver_register(&s6000_i2s_driver);
610}
611module_init(s6000_i2s_init);
612
613static void __exit s6000_i2s_exit(void)
614{
615 platform_driver_unregister(&s6000_i2s_driver);
616}
617module_exit(s6000_i2s_exit);
618 608
619MODULE_AUTHOR("Daniel Gloeckner"); 609MODULE_AUTHOR("Daniel Gloeckner");
620MODULE_DESCRIPTION("Stretch s6000 family I2S SoC Interface"); 610MODULE_DESCRIPTION("Stretch s6000 family I2S SoC Interface");
diff --git a/sound/soc/s6000/s6000-pcm.c b/sound/soc/s6000/s6000-pcm.c
index 55efc2bdf0b..43c014f362f 100644
--- a/sound/soc/s6000/s6000-pcm.c
+++ b/sound/soc/s6000/s6000-pcm.c
@@ -520,17 +520,7 @@ static struct platform_driver s6000_pcm_driver = {
520 .remove = __devexit_p(s6000_soc_platform_remove), 520 .remove = __devexit_p(s6000_soc_platform_remove),
521}; 521};
522 522
523static int __init snd_s6000_pcm_init(void) 523module_platform_driver(s6000_pcm_driver);
524{
525 return platform_driver_register(&s6000_pcm_driver);
526}
527module_init(snd_s6000_pcm_init);
528
529static void __exit snd_s6000_pcm_exit(void)
530{
531 platform_driver_unregister(&s6000_pcm_driver);
532}
533module_exit(snd_s6000_pcm_exit);
534 524
535MODULE_AUTHOR("Daniel Gloeckner"); 525MODULE_AUTHOR("Daniel Gloeckner");
536MODULE_DESCRIPTION("Stretch s6000 family PCM DMA module"); 526MODULE_DESCRIPTION("Stretch s6000 family PCM DMA module");
diff --git a/sound/soc/s6000/s6105-ipcam.c b/sound/soc/s6000/s6105-ipcam.c
index 5890e431852..58cfb1eb7dd 100644
--- a/sound/soc/s6000/s6105-ipcam.c
+++ b/sound/soc/s6000/s6105-ipcam.c
@@ -187,6 +187,7 @@ static struct snd_soc_dai_link s6105_dai = {
187/* s6105 audio machine driver */ 187/* s6105 audio machine driver */
188static struct snd_soc_card snd_soc_card_s6105 = { 188static struct snd_soc_card snd_soc_card_s6105 = {
189 .name = "Stretch IP Camera", 189 .name = "Stretch IP Camera",
190 .owner = THIS_MODULE,
190 .dai_link = &s6105_dai, 191 .dai_link = &s6105_dai,
191 .num_links = 1, 192 .num_links = 1,
192}; 193};
diff --git a/sound/soc/samsung/Kconfig b/sound/soc/samsung/Kconfig
index 53aaa69eda0..f3417f2311b 100644
--- a/sound/soc/samsung/Kconfig
+++ b/sound/soc/samsung/Kconfig
@@ -193,8 +193,22 @@ config SND_SOC_SPEYSIDE
193 select SND_SOC_WM9081 193 select SND_SOC_WM9081
194 select SND_SOC_WM1250_EV1 194 select SND_SOC_WM1250_EV1
195 195
196config SND_SOC_SPEYSIDE_WM8962 196config SND_SOC_TOBERMORY
197 tristate "Audio support for Wolfson Speyside with WM8962" 197 tristate "Audio support for Wolfson Tobermory"
198 depends on SND_SOC_SAMSUNG && MACH_WLF_CRAGG_6410 198 depends on SND_SOC_SAMSUNG && MACH_WLF_CRAGG_6410
199 select SND_SAMSUNG_I2S 199 select SND_SAMSUNG_I2S
200 select SND_SOC_WM8962 200 select SND_SOC_WM8962
201
202config SND_SOC_LOWLAND
203 tristate "Audio support for Wolfson Lowland"
204 depends on SND_SOC_SAMSUNG && MACH_WLF_CRAGG_6410
205 select SND_SAMSUNG_I2S
206 select SND_SOC_WM5100
207 select SND_SOC_WM9081
208
209config SND_SOC_LITTLEMILL
210 tristate "Audio support for Wolfson Littlemill"
211 depends on SND_SOC_SAMSUNG && MACH_WLF_CRAGG_6410
212 select SND_SAMSUNG_I2S
213 select MFD_WM8994
214 select SND_SOC_WM8994
diff --git a/sound/soc/samsung/Makefile b/sound/soc/samsung/Makefile
index 8509d3c4366..9d03beb40c8 100644
--- a/sound/soc/samsung/Makefile
+++ b/sound/soc/samsung/Makefile
@@ -39,7 +39,9 @@ snd-soc-smdk-spdif-objs := smdk_spdif.o
39snd-soc-smdk-wm8580pcm-objs := smdk_wm8580pcm.o 39snd-soc-smdk-wm8580pcm-objs := smdk_wm8580pcm.o
40snd-soc-smdk-wm8994pcm-objs := smdk_wm8994pcm.o 40snd-soc-smdk-wm8994pcm-objs := smdk_wm8994pcm.o
41snd-soc-speyside-objs := speyside.o 41snd-soc-speyside-objs := speyside.o
42snd-soc-speyside-wm8962-objs := speyside_wm8962.o 42snd-soc-tobermory-objs := tobermory.o
43snd-soc-lowland-objs := lowland.o
44snd-soc-littlemill-objs := littlemill.o
43 45
44obj-$(CONFIG_SND_SOC_SAMSUNG_JIVE_WM8750) += snd-soc-jive-wm8750.o 46obj-$(CONFIG_SND_SOC_SAMSUNG_JIVE_WM8750) += snd-soc-jive-wm8750.o
45obj-$(CONFIG_SND_SOC_SAMSUNG_NEO1973_WM8753) += snd-soc-neo1973-wm8753.o 47obj-$(CONFIG_SND_SOC_SAMSUNG_NEO1973_WM8753) += snd-soc-neo1973-wm8753.o
@@ -60,4 +62,6 @@ obj-$(CONFIG_SND_SOC_GONI_AQUILA_WM8994) += snd-soc-goni-wm8994.o
60obj-$(CONFIG_SND_SOC_SMDK_WM8580_PCM) += snd-soc-smdk-wm8580pcm.o 62obj-$(CONFIG_SND_SOC_SMDK_WM8580_PCM) += snd-soc-smdk-wm8580pcm.o
61obj-$(CONFIG_SND_SOC_SMDK_WM8994_PCM) += snd-soc-smdk-wm8994pcm.o 63obj-$(CONFIG_SND_SOC_SMDK_WM8994_PCM) += snd-soc-smdk-wm8994pcm.o
62obj-$(CONFIG_SND_SOC_SPEYSIDE) += snd-soc-speyside.o 64obj-$(CONFIG_SND_SOC_SPEYSIDE) += snd-soc-speyside.o
63obj-$(CONFIG_SND_SOC_SPEYSIDE_WM8962) += snd-soc-speyside-wm8962.o 65obj-$(CONFIG_SND_SOC_TOBERMORY) += snd-soc-tobermory.o
66obj-$(CONFIG_SND_SOC_LOWLAND) += snd-soc-lowland.o
67obj-$(CONFIG_SND_SOC_LITTLEMILL) += snd-soc-littlemill.o
diff --git a/sound/soc/samsung/ac97.c b/sound/soc/samsung/ac97.c
index 16521e3ffc0..7b9bf93e370 100644
--- a/sound/soc/samsung/ac97.c
+++ b/sound/soc/samsung/ac97.c
@@ -329,12 +329,12 @@ static int s3c_ac97_mic_trigger(struct snd_pcm_substream *substream,
329 return 0; 329 return 0;
330} 330}
331 331
332static struct snd_soc_dai_ops s3c_ac97_dai_ops = { 332static const struct snd_soc_dai_ops s3c_ac97_dai_ops = {
333 .hw_params = s3c_ac97_hw_params, 333 .hw_params = s3c_ac97_hw_params,
334 .trigger = s3c_ac97_trigger, 334 .trigger = s3c_ac97_trigger,
335}; 335};
336 336
337static struct snd_soc_dai_ops s3c_ac97_mic_dai_ops = { 337static const struct snd_soc_dai_ops s3c_ac97_mic_dai_ops = {
338 .hw_params = s3c_ac97_hw_mic_params, 338 .hw_params = s3c_ac97_hw_mic_params,
339 .trigger = s3c_ac97_mic_trigger, 339 .trigger = s3c_ac97_mic_trigger,
340}; 340};
@@ -509,17 +509,7 @@ static struct platform_driver s3c_ac97_driver = {
509 }, 509 },
510}; 510};
511 511
512static int __init s3c_ac97_init(void) 512module_platform_driver(s3c_ac97_driver);
513{
514 return platform_driver_register(&s3c_ac97_driver);
515}
516module_init(s3c_ac97_init);
517
518static void __exit s3c_ac97_exit(void)
519{
520 platform_driver_unregister(&s3c_ac97_driver);
521}
522module_exit(s3c_ac97_exit);
523 513
524MODULE_AUTHOR("Jaswinder Singh, <jassi.brar@samsung.com>"); 514MODULE_AUTHOR("Jaswinder Singh, <jassi.brar@samsung.com>");
525MODULE_DESCRIPTION("AC97 driver for the Samsung SoC"); 515MODULE_DESCRIPTION("AC97 driver for the Samsung SoC");
diff --git a/sound/soc/samsung/dma.c b/sound/soc/samsung/dma.c
index a68b2644178..427ae0d9817 100644
--- a/sound/soc/samsung/dma.c
+++ b/sound/soc/samsung/dma.c
@@ -403,7 +403,6 @@ static u64 dma_mask = DMA_BIT_MASK(32);
403static int dma_new(struct snd_soc_pcm_runtime *rtd) 403static int dma_new(struct snd_soc_pcm_runtime *rtd)
404{ 404{
405 struct snd_card *card = rtd->card->snd_card; 405 struct snd_card *card = rtd->card->snd_card;
406 struct snd_soc_dai *dai = rtd->cpu_dai;
407 struct snd_pcm *pcm = rtd->pcm; 406 struct snd_pcm *pcm = rtd->pcm;
408 int ret = 0; 407 int ret = 0;
409 408
@@ -414,14 +413,14 @@ static int dma_new(struct snd_soc_pcm_runtime *rtd)
414 if (!card->dev->coherent_dma_mask) 413 if (!card->dev->coherent_dma_mask)
415 card->dev->coherent_dma_mask = 0xffffffff; 414 card->dev->coherent_dma_mask = 0xffffffff;
416 415
417 if (dai->driver->playback.channels_min) { 416 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
418 ret = preallocate_dma_buffer(pcm, 417 ret = preallocate_dma_buffer(pcm,
419 SNDRV_PCM_STREAM_PLAYBACK); 418 SNDRV_PCM_STREAM_PLAYBACK);
420 if (ret) 419 if (ret)
421 goto out; 420 goto out;
422 } 421 }
423 422
424 if (dai->driver->capture.channels_min) { 423 if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) {
425 ret = preallocate_dma_buffer(pcm, 424 ret = preallocate_dma_buffer(pcm,
426 SNDRV_PCM_STREAM_CAPTURE); 425 SNDRV_PCM_STREAM_CAPTURE);
427 if (ret) 426 if (ret)
@@ -458,17 +457,7 @@ static struct platform_driver asoc_dma_driver = {
458 .remove = __devexit_p(samsung_asoc_platform_remove), 457 .remove = __devexit_p(samsung_asoc_platform_remove),
459}; 458};
460 459
461static int __init samsung_asoc_init(void) 460module_platform_driver(asoc_dma_driver);
462{
463 return platform_driver_register(&asoc_dma_driver);
464}
465module_init(samsung_asoc_init);
466
467static void __exit samsung_asoc_exit(void)
468{
469 platform_driver_unregister(&asoc_dma_driver);
470}
471module_exit(samsung_asoc_exit);
472 461
473MODULE_AUTHOR("Ben Dooks, <ben@simtec.co.uk>"); 462MODULE_AUTHOR("Ben Dooks, <ben@simtec.co.uk>");
474MODULE_DESCRIPTION("Samsung ASoC DMA Driver"); 463MODULE_DESCRIPTION("Samsung ASoC DMA Driver");
diff --git a/sound/soc/samsung/goni_wm8994.c b/sound/soc/samsung/goni_wm8994.c
index 84f9c3cf7f3..c23c2ae91f5 100644
--- a/sound/soc/samsung/goni_wm8994.c
+++ b/sound/soc/samsung/goni_wm8994.c
@@ -244,6 +244,7 @@ static struct snd_soc_dai_link goni_dai[] = {
244 244
245static struct snd_soc_card goni = { 245static struct snd_soc_card goni = {
246 .name = "goni", 246 .name = "goni",
247 .owner = THIS_MODULE,
247 .dai_link = goni_dai, 248 .dai_link = goni_dai,
248 .num_links = ARRAY_SIZE(goni_dai), 249 .num_links = ARRAY_SIZE(goni_dai),
249 250
diff --git a/sound/soc/samsung/h1940_uda1380.c b/sound/soc/samsung/h1940_uda1380.c
index 03cfa5fcdcc..6e3257717c5 100644
--- a/sound/soc/samsung/h1940_uda1380.c
+++ b/sound/soc/samsung/h1940_uda1380.c
@@ -215,6 +215,7 @@ static struct snd_soc_dai_link h1940_uda1380_dai[] = {
215 215
216static struct snd_soc_card h1940_asoc = { 216static struct snd_soc_card h1940_asoc = {
217 .name = "h1940", 217 .name = "h1940",
218 .owner = THIS_MODULE,
218 .dai_link = h1940_uda1380_dai, 219 .dai_link = h1940_uda1380_dai,
219 .num_links = ARRAY_SIZE(h1940_uda1380_dai), 220 .num_links = ARRAY_SIZE(h1940_uda1380_dai),
220 221
diff --git a/sound/soc/samsung/i2s.c b/sound/soc/samsung/i2s.c
index bff42bf370b..87a874dc7a3 100644
--- a/sound/soc/samsung/i2s.c
+++ b/sound/soc/samsung/i2s.c
@@ -15,6 +15,7 @@
15#include <linux/clk.h> 15#include <linux/clk.h>
16#include <linux/io.h> 16#include <linux/io.h>
17#include <linux/module.h> 17#include <linux/module.h>
18#include <linux/pm_runtime.h>
18 19
19#include <sound/soc.h> 20#include <sound/soc.h>
20#include <sound/pcm_params.h> 21#include <sound/pcm_params.h>
@@ -881,7 +882,7 @@ static int samsung_i2s_dai_probe(struct snd_soc_dai *dai)
881 writel(CON_RSTCLR, i2s->addr + I2SCON); 882 writel(CON_RSTCLR, i2s->addr + I2SCON);
882 883
883 if (i2s->quirks & QUIRK_SEC_DAI) 884 if (i2s->quirks & QUIRK_SEC_DAI)
884 idma_reg_addr_init((void *)i2s->addr, 885 idma_reg_addr_init(i2s->addr,
885 i2s->sec_dai->idma_playback.dma_addr); 886 i2s->sec_dai->idma_playback.dma_addr);
886 887
887probe_exit: 888probe_exit:
@@ -923,7 +924,7 @@ static int samsung_i2s_dai_remove(struct snd_soc_dai *dai)
923 return 0; 924 return 0;
924} 925}
925 926
926static struct snd_soc_dai_ops samsung_i2s_dai_ops = { 927static const struct snd_soc_dai_ops samsung_i2s_dai_ops = {
927 .trigger = i2s_trigger, 928 .trigger = i2s_trigger,
928 .hw_params = i2s_hw_params, 929 .hw_params = i2s_hw_params,
929 .set_fmt = i2s_set_fmt, 930 .set_fmt = i2s_set_fmt,
@@ -945,7 +946,7 @@ struct i2s_dai *i2s_alloc_dai(struct platform_device *pdev, bool sec)
945{ 946{
946 struct i2s_dai *i2s; 947 struct i2s_dai *i2s;
947 948
948 i2s = kzalloc(sizeof(struct i2s_dai), GFP_KERNEL); 949 i2s = devm_kzalloc(&pdev->dev, sizeof(struct i2s_dai), GFP_KERNEL);
949 if (i2s == NULL) 950 if (i2s == NULL)
950 return NULL; 951 return NULL;
951 952
@@ -972,10 +973,8 @@ struct i2s_dai *i2s_alloc_dai(struct platform_device *pdev, bool sec)
972 i2s->pdev = platform_device_register_resndata(NULL, 973 i2s->pdev = platform_device_register_resndata(NULL,
973 pdev->name, pdev->id + SAMSUNG_I2S_SECOFF, 974 pdev->name, pdev->id + SAMSUNG_I2S_SECOFF,
974 NULL, 0, NULL, 0); 975 NULL, 0, NULL, 0);
975 if (IS_ERR(i2s->pdev)) { 976 if (IS_ERR(i2s->pdev))
976 kfree(i2s);
977 return NULL; 977 return NULL;
978 }
979 } 978 }
980 979
981 /* Pre-assign snd_soc_dai_set_drvdata */ 980 /* Pre-assign snd_soc_dai_set_drvdata */
@@ -1048,7 +1047,7 @@ static __devinit int samsung_i2s_probe(struct platform_device *pdev)
1048 if (!pri_dai) { 1047 if (!pri_dai) {
1049 dev_err(&pdev->dev, "Unable to alloc I2S_pri\n"); 1048 dev_err(&pdev->dev, "Unable to alloc I2S_pri\n");
1050 ret = -ENOMEM; 1049 ret = -ENOMEM;
1051 goto err1; 1050 goto err;
1052 } 1051 }
1053 1052
1054 pri_dai->dma_playback.dma_addr = regs_base + I2STXD; 1053 pri_dai->dma_playback.dma_addr = regs_base + I2STXD;
@@ -1073,7 +1072,7 @@ static __devinit int samsung_i2s_probe(struct platform_device *pdev)
1073 if (!sec_dai) { 1072 if (!sec_dai) {
1074 dev_err(&pdev->dev, "Unable to alloc I2S_sec\n"); 1073 dev_err(&pdev->dev, "Unable to alloc I2S_sec\n");
1075 ret = -ENOMEM; 1074 ret = -ENOMEM;
1076 goto err2; 1075 goto err;
1077 } 1076 }
1078 sec_dai->dma_playback.dma_addr = regs_base + I2STXDS; 1077 sec_dai->dma_playback.dma_addr = regs_base + I2STXDS;
1079 sec_dai->dma_playback.client = 1078 sec_dai->dma_playback.client =
@@ -1092,17 +1091,15 @@ static __devinit int samsung_i2s_probe(struct platform_device *pdev)
1092 if (i2s_pdata->cfg_gpio && i2s_pdata->cfg_gpio(pdev)) { 1091 if (i2s_pdata->cfg_gpio && i2s_pdata->cfg_gpio(pdev)) {
1093 dev_err(&pdev->dev, "Unable to configure gpio\n"); 1092 dev_err(&pdev->dev, "Unable to configure gpio\n");
1094 ret = -EINVAL; 1093 ret = -EINVAL;
1095 goto err3; 1094 goto err;
1096 } 1095 }
1097 1096
1098 snd_soc_register_dai(&pri_dai->pdev->dev, &pri_dai->i2s_dai_drv); 1097 snd_soc_register_dai(&pri_dai->pdev->dev, &pri_dai->i2s_dai_drv);
1099 1098
1099 pm_runtime_enable(&pdev->dev);
1100
1100 return 0; 1101 return 0;
1101err3: 1102err:
1102 kfree(sec_dai);
1103err2:
1104 kfree(pri_dai);
1105err1:
1106 release_mem_region(regs_base, resource_size(res)); 1103 release_mem_region(regs_base, resource_size(res));
1107 1104
1108 return ret; 1105 return ret;
@@ -1111,6 +1108,7 @@ err1:
1111static __devexit int samsung_i2s_remove(struct platform_device *pdev) 1108static __devexit int samsung_i2s_remove(struct platform_device *pdev)
1112{ 1109{
1113 struct i2s_dai *i2s, *other; 1110 struct i2s_dai *i2s, *other;
1111 struct resource *res;
1114 1112
1115 i2s = dev_get_drvdata(&pdev->dev); 1113 i2s = dev_get_drvdata(&pdev->dev);
1116 other = i2s->pri_dai ? : i2s->sec_dai; 1114 other = i2s->pri_dai ? : i2s->sec_dai;
@@ -1119,7 +1117,7 @@ static __devexit int samsung_i2s_remove(struct platform_device *pdev)
1119 other->pri_dai = NULL; 1117 other->pri_dai = NULL;
1120 other->sec_dai = NULL; 1118 other->sec_dai = NULL;
1121 } else { 1119 } else {
1122 struct resource *res; 1120 pm_runtime_disable(&pdev->dev);
1123 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1121 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
1124 if (res) 1122 if (res)
1125 release_mem_region(res->start, resource_size(res)); 1123 release_mem_region(res->start, resource_size(res));
@@ -1128,8 +1126,6 @@ static __devexit int samsung_i2s_remove(struct platform_device *pdev)
1128 i2s->pri_dai = NULL; 1126 i2s->pri_dai = NULL;
1129 i2s->sec_dai = NULL; 1127 i2s->sec_dai = NULL;
1130 1128
1131 kfree(i2s);
1132
1133 snd_soc_unregister_dai(&pdev->dev); 1129 snd_soc_unregister_dai(&pdev->dev);
1134 1130
1135 return 0; 1131 return 0;
@@ -1144,17 +1140,7 @@ static struct platform_driver samsung_i2s_driver = {
1144 }, 1140 },
1145}; 1141};
1146 1142
1147static int __init samsung_i2s_init(void) 1143module_platform_driver(samsung_i2s_driver);
1148{
1149 return platform_driver_register(&samsung_i2s_driver);
1150}
1151module_init(samsung_i2s_init);
1152
1153static void __exit samsung_i2s_exit(void)
1154{
1155 platform_driver_unregister(&samsung_i2s_driver);
1156}
1157module_exit(samsung_i2s_exit);
1158 1144
1159/* Module information */ 1145/* Module information */
1160MODULE_AUTHOR("Jaswinder Singh, <jassi.brar@samsung.com>"); 1146MODULE_AUTHOR("Jaswinder Singh, <jassi.brar@samsung.com>");
diff --git a/sound/soc/samsung/idma.c b/sound/soc/samsung/idma.c
index c41178efc90..c227c3163ca 100644
--- a/sound/soc/samsung/idma.c
+++ b/sound/soc/samsung/idma.c
@@ -387,7 +387,6 @@ static u64 idma_mask = DMA_BIT_MASK(32);
387static int idma_new(struct snd_soc_pcm_runtime *rtd) 387static int idma_new(struct snd_soc_pcm_runtime *rtd)
388{ 388{
389 struct snd_card *card = rtd->card->snd_card; 389 struct snd_card *card = rtd->card->snd_card;
390 struct snd_soc_dai *dai = rtd->cpu_dai;
391 struct snd_pcm *pcm = rtd->pcm; 390 struct snd_pcm *pcm = rtd->pcm;
392 int ret = 0; 391 int ret = 0;
393 392
@@ -396,21 +395,22 @@ static int idma_new(struct snd_soc_pcm_runtime *rtd)
396 if (!card->dev->coherent_dma_mask) 395 if (!card->dev->coherent_dma_mask)
397 card->dev->coherent_dma_mask = DMA_BIT_MASK(32); 396 card->dev->coherent_dma_mask = DMA_BIT_MASK(32);
398 397
399 if (dai->driver->playback.channels_min) 398 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
400 ret = preallocate_idma_buffer(pcm, 399 ret = preallocate_idma_buffer(pcm,
401 SNDRV_PCM_STREAM_PLAYBACK); 400 SNDRV_PCM_STREAM_PLAYBACK);
401 }
402 402
403 return ret; 403 return ret;
404} 404}
405 405
406void idma_reg_addr_init(void *regs, dma_addr_t addr) 406void idma_reg_addr_init(void __iomem *regs, dma_addr_t addr)
407{ 407{
408 spin_lock_init(&idma.lock); 408 spin_lock_init(&idma.lock);
409 idma.regs = regs; 409 idma.regs = regs;
410 idma.lp_tx_addr = addr; 410 idma.lp_tx_addr = addr;
411} 411}
412 412
413struct snd_soc_platform_driver asoc_idma_platform = { 413static struct snd_soc_platform_driver asoc_idma_platform = {
414 .ops = &idma_ops, 414 .ops = &idma_ops,
415 .pcm_new = idma_new, 415 .pcm_new = idma_new,
416 .pcm_free = idma_free, 416 .pcm_free = idma_free,
@@ -437,17 +437,7 @@ static struct platform_driver asoc_idma_driver = {
437 .remove = __devexit_p(asoc_idma_platform_remove), 437 .remove = __devexit_p(asoc_idma_platform_remove),
438}; 438};
439 439
440static int __init asoc_idma_init(void) 440module_platform_driver(asoc_idma_driver);
441{
442 return platform_driver_register(&asoc_idma_driver);
443}
444module_init(asoc_idma_init);
445
446static void __exit asoc_idma_exit(void)
447{
448 platform_driver_unregister(&asoc_idma_driver);
449}
450module_exit(asoc_idma_exit);
451 441
452MODULE_AUTHOR("Jaswinder Singh, <jassisinghbrar@gmail.com>"); 442MODULE_AUTHOR("Jaswinder Singh, <jassisinghbrar@gmail.com>");
453MODULE_DESCRIPTION("Samsung ASoC IDMA Driver"); 443MODULE_DESCRIPTION("Samsung ASoC IDMA Driver");
diff --git a/sound/soc/samsung/idma.h b/sound/soc/samsung/idma.h
index 48273216166..8644946973e 100644
--- a/sound/soc/samsung/idma.h
+++ b/sound/soc/samsung/idma.h
@@ -14,7 +14,7 @@
14#ifndef __SND_SOC_SAMSUNG_IDMA_H_ 14#ifndef __SND_SOC_SAMSUNG_IDMA_H_
15#define __SND_SOC_SAMSUNG_IDMA_H_ 15#define __SND_SOC_SAMSUNG_IDMA_H_
16 16
17extern void idma_reg_addr_init(void *regs, dma_addr_t addr); 17extern void idma_reg_addr_init(void __iomem *regs, dma_addr_t addr);
18 18
19/* dma_state */ 19/* dma_state */
20#define LPAM_DMA_STOP 0 20#define LPAM_DMA_STOP 0
diff --git a/sound/soc/samsung/jive_wm8750.c b/sound/soc/samsung/jive_wm8750.c
index 1826acf20f7..1578663a1fa 100644
--- a/sound/soc/samsung/jive_wm8750.c
+++ b/sound/soc/samsung/jive_wm8750.c
@@ -101,7 +101,6 @@ static int jive_wm8750_init(struct snd_soc_pcm_runtime *rtd)
101{ 101{
102 struct snd_soc_codec *codec = rtd->codec; 102 struct snd_soc_codec *codec = rtd->codec;
103 struct snd_soc_dapm_context *dapm = &codec->dapm; 103 struct snd_soc_dapm_context *dapm = &codec->dapm;
104 int err;
105 104
106 /* These endpoints are not being used. */ 105 /* These endpoints are not being used. */
107 snd_soc_dapm_nc_pin(dapm, "LINPUT2"); 106 snd_soc_dapm_nc_pin(dapm, "LINPUT2");
@@ -128,10 +127,11 @@ static struct snd_soc_dai_link jive_dai = {
128/* jive audio machine driver */ 127/* jive audio machine driver */
129static struct snd_soc_card snd_soc_machine_jive = { 128static struct snd_soc_card snd_soc_machine_jive = {
130 .name = "Jive", 129 .name = "Jive",
130 .owner = THIS_MODULE,
131 .dai_link = &jive_dai, 131 .dai_link = &jive_dai,
132 .num_links = 1, 132 .num_links = 1,
133 133
134 .dapm_widgtets = wm8750_dapm_widgets, 134 .dapm_widgets = wm8750_dapm_widgets,
135 .num_dapm_widgets = ARRAY_SIZE(wm8750_dapm_widgets), 135 .num_dapm_widgets = ARRAY_SIZE(wm8750_dapm_widgets),
136 .dapm_routes = audio_map, 136 .dapm_routes = audio_map,
137 .num_dapm_routes = ARRAY_SIZE(audio_map), 137 .num_dapm_routes = ARRAY_SIZE(audio_map),
diff --git a/sound/soc/samsung/littlemill.c b/sound/soc/samsung/littlemill.c
new file mode 100644
index 00000000000..9dd818bde06
--- /dev/null
+++ b/sound/soc/samsung/littlemill.c
@@ -0,0 +1,253 @@
1/*
2 * Littlemill audio support
3 *
4 * Copyright 2011 Wolfson Microelectronics
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 */
11
12#include <sound/soc.h>
13#include <sound/soc-dapm.h>
14#include <sound/jack.h>
15#include <linux/gpio.h>
16#include <linux/module.h>
17
18#include "../codecs/wm8994.h"
19
20static int sample_rate = 44100;
21
22static int littlemill_set_bias_level(struct snd_soc_card *card,
23 struct snd_soc_dapm_context *dapm,
24 enum snd_soc_bias_level level)
25{
26 struct snd_soc_dai *codec_dai = card->rtd[0].codec_dai;
27 int ret;
28
29 if (dapm->dev != codec_dai->dev)
30 return 0;
31
32 switch (level) {
33 case SND_SOC_BIAS_PREPARE:
34 /*
35 * If we've not already clocked things via hw_params()
36 * then do so now, otherwise these are noops.
37 */
38 if (dapm->bias_level == SND_SOC_BIAS_STANDBY) {
39 ret = snd_soc_dai_set_pll(codec_dai, WM8994_FLL1,
40 WM8994_FLL_SRC_MCLK2, 32768,
41 sample_rate * 512);
42 if (ret < 0) {
43 pr_err("Failed to start FLL: %d\n", ret);
44 return ret;
45 }
46
47 ret = snd_soc_dai_set_sysclk(codec_dai,
48 WM8994_SYSCLK_FLL1,
49 sample_rate * 512,
50 SND_SOC_CLOCK_IN);
51 if (ret < 0) {
52 pr_err("Failed to set SYSCLK: %d\n", ret);
53 return ret;
54 }
55 }
56 break;
57
58 default:
59 break;
60 }
61
62 return 0;
63}
64
65static int littlemill_set_bias_level_post(struct snd_soc_card *card,
66 struct snd_soc_dapm_context *dapm,
67 enum snd_soc_bias_level level)
68{
69 struct snd_soc_dai *codec_dai = card->rtd[0].codec_dai;
70 int ret;
71
72 if (dapm->dev != codec_dai->dev)
73 return 0;
74
75 switch (level) {
76 case SND_SOC_BIAS_STANDBY:
77 ret = snd_soc_dai_set_sysclk(codec_dai, WM8994_SYSCLK_MCLK2,
78 32768, SND_SOC_CLOCK_IN);
79 if (ret < 0) {
80 pr_err("Failed to switch away from FLL: %d\n", ret);
81 return ret;
82 }
83
84 ret = snd_soc_dai_set_pll(codec_dai, WM8994_FLL1,
85 0, 0, 0);
86 if (ret < 0) {
87 pr_err("Failed to stop FLL: %d\n", ret);
88 return ret;
89 }
90 break;
91
92 default:
93 break;
94 }
95
96 dapm->bias_level = level;
97
98 return 0;
99}
100
101static int littlemill_hw_params(struct snd_pcm_substream *substream,
102 struct snd_pcm_hw_params *params)
103{
104 struct snd_soc_pcm_runtime *rtd = substream->private_data;
105 struct snd_soc_dai *codec_dai = rtd->codec_dai;
106 int ret;
107
108 sample_rate = params_rate(params);
109
110 ret = snd_soc_dai_set_pll(codec_dai, WM8994_FLL1,
111 WM8994_FLL_SRC_MCLK2, 32768,
112 sample_rate * 512);
113 if (ret < 0) {
114 pr_err("Failed to start FLL: %d\n", ret);
115 return ret;
116 }
117
118 ret = snd_soc_dai_set_sysclk(codec_dai,
119 WM8994_SYSCLK_FLL1,
120 sample_rate * 512,
121 SND_SOC_CLOCK_IN);
122 if (ret < 0) {
123 pr_err("Failed to set SYSCLK: %d\n", ret);
124 return ret;
125 }
126
127 return 0;
128}
129
130static struct snd_soc_ops littlemill_ops = {
131 .hw_params = littlemill_hw_params,
132};
133
134static struct snd_soc_dai_link littlemill_dai[] = {
135 {
136 .name = "CPU",
137 .stream_name = "CPU",
138 .cpu_dai_name = "samsung-i2s.0",
139 .codec_dai_name = "wm8994-aif1",
140 .platform_name = "samsung-audio",
141 .codec_name = "wm8994-codec",
142 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
143 | SND_SOC_DAIFMT_CBM_CFM,
144 .ops = &littlemill_ops,
145 },
146};
147
148static struct snd_soc_dapm_widget widgets[] = {
149 SND_SOC_DAPM_HP("Headphone", NULL),
150
151 SND_SOC_DAPM_MIC("AMIC", NULL),
152 SND_SOC_DAPM_MIC("DMIC", NULL),
153};
154
155static struct snd_soc_dapm_route audio_paths[] = {
156 { "Headphone", NULL, "HPOUT1L" },
157 { "Headphone", NULL, "HPOUT1R" },
158
159 { "AMIC", NULL, "MICBIAS1" }, /* Default for AMICBIAS jumper */
160 { "IN1LN", NULL, "AMIC" },
161
162 { "DMIC", NULL, "MICBIAS2" }, /* Default for DMICBIAS jumper */
163 { "DMIC1DAT", NULL, "DMIC" },
164 { "DMIC2DAT", NULL, "DMIC" },
165};
166
167static struct snd_soc_jack littlemill_headset;
168
169static int littlemill_late_probe(struct snd_soc_card *card)
170{
171 struct snd_soc_codec *codec = card->rtd[0].codec;
172 struct snd_soc_dai *codec_dai = card->rtd[0].codec_dai;
173 int ret;
174
175 ret = snd_soc_dai_set_sysclk(codec_dai, WM8994_SYSCLK_MCLK2,
176 32768, SND_SOC_CLOCK_IN);
177 if (ret < 0)
178 return ret;
179
180 ret = snd_soc_jack_new(codec, "Headset",
181 SND_JACK_HEADSET | SND_JACK_MECHANICAL |
182 SND_JACK_BTN_0 | SND_JACK_BTN_1 |
183 SND_JACK_BTN_2 | SND_JACK_BTN_3 |
184 SND_JACK_BTN_4 | SND_JACK_BTN_5,
185 &littlemill_headset);
186 if (ret)
187 return ret;
188
189 /* This will check device compatibility itself */
190 wm8958_mic_detect(codec, &littlemill_headset, NULL, NULL);
191
192 return 0;
193}
194
195static struct snd_soc_card littlemill = {
196 .name = "Littlemill",
197 .owner = THIS_MODULE,
198 .dai_link = littlemill_dai,
199 .num_links = ARRAY_SIZE(littlemill_dai),
200
201 .set_bias_level = littlemill_set_bias_level,
202 .set_bias_level_post = littlemill_set_bias_level_post,
203
204 .dapm_widgets = widgets,
205 .num_dapm_widgets = ARRAY_SIZE(widgets),
206 .dapm_routes = audio_paths,
207 .num_dapm_routes = ARRAY_SIZE(audio_paths),
208
209 .late_probe = littlemill_late_probe,
210};
211
212static __devinit int littlemill_probe(struct platform_device *pdev)
213{
214 struct snd_soc_card *card = &littlemill;
215 int ret;
216
217 card->dev = &pdev->dev;
218
219 ret = snd_soc_register_card(card);
220 if (ret) {
221 dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n",
222 ret);
223 return ret;
224 }
225
226 return 0;
227}
228
229static int __devexit littlemill_remove(struct platform_device *pdev)
230{
231 struct snd_soc_card *card = platform_get_drvdata(pdev);
232
233 snd_soc_unregister_card(card);
234
235 return 0;
236}
237
238static struct platform_driver littlemill_driver = {
239 .driver = {
240 .name = "littlemill",
241 .owner = THIS_MODULE,
242 .pm = &snd_soc_pm_ops,
243 },
244 .probe = littlemill_probe,
245 .remove = __devexit_p(littlemill_remove),
246};
247
248module_platform_driver(littlemill_driver);
249
250MODULE_DESCRIPTION("Littlemill audio support");
251MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>");
252MODULE_LICENSE("GPL");
253MODULE_ALIAS("platform:littlemill");
diff --git a/sound/soc/samsung/ln2440sbc_alc650.c b/sound/soc/samsung/ln2440sbc_alc650.c
index cde38b8e9dc..69c4a5934a4 100644
--- a/sound/soc/samsung/ln2440sbc_alc650.c
+++ b/sound/soc/samsung/ln2440sbc_alc650.c
@@ -34,6 +34,7 @@ static struct snd_soc_dai_link ln2440sbc_dai[] = {
34 34
35static struct snd_soc_card ln2440sbc = { 35static struct snd_soc_card ln2440sbc = {
36 .name = "LN2440SBC", 36 .name = "LN2440SBC",
37 .owner = THIS_MODULE,
37 .dai_link = ln2440sbc_dai, 38 .dai_link = ln2440sbc_dai,
38 .num_links = ARRAY_SIZE(ln2440sbc_dai), 39 .num_links = ARRAY_SIZE(ln2440sbc_dai),
39}; 40};
diff --git a/sound/soc/samsung/lowland.c b/sound/soc/samsung/lowland.c
new file mode 100644
index 00000000000..4adff934f77
--- /dev/null
+++ b/sound/soc/samsung/lowland.c
@@ -0,0 +1,237 @@
1/*
2 * Lowland audio support
3 *
4 * Copyright 2011 Wolfson Microelectronics
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2 of the License, or (at your
9 * option) any later version.
10 */
11
12#include <sound/soc.h>
13#include <sound/soc-dapm.h>
14#include <sound/jack.h>
15#include <linux/gpio.h>
16#include <linux/module.h>
17
18#include "../codecs/wm5100.h"
19#include "../codecs/wm9081.h"
20
21#define MCLK1_RATE (44100 * 512)
22#define CLKOUT_RATE (44100 * 256)
23
24static int lowland_hw_params(struct snd_pcm_substream *substream,
25 struct snd_pcm_hw_params *params)
26{
27 struct snd_soc_pcm_runtime *rtd = substream->private_data;
28 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
29 struct snd_soc_dai *codec_dai = rtd->codec_dai;
30 int ret;
31
32 ret = snd_soc_dai_set_fmt(codec_dai, SND_SOC_DAIFMT_I2S
33 | SND_SOC_DAIFMT_NB_NF
34 | SND_SOC_DAIFMT_CBM_CFM);
35 if (ret < 0)
36 return ret;
37
38 ret = snd_soc_dai_set_fmt(cpu_dai, SND_SOC_DAIFMT_I2S
39 | SND_SOC_DAIFMT_NB_NF
40 | SND_SOC_DAIFMT_CBM_CFM);
41 if (ret < 0)
42 return ret;
43
44 return 0;
45}
46
47static struct snd_soc_ops lowland_ops = {
48 .hw_params = lowland_hw_params,
49};
50
51static struct snd_soc_jack lowland_headset;
52
53/* Headset jack detection DAPM pins */
54static struct snd_soc_jack_pin lowland_headset_pins[] = {
55 {
56 .pin = "Headphone",
57 .mask = SND_JACK_HEADPHONE | SND_JACK_LINEOUT,
58 },
59 {
60 .pin = "Headset Mic",
61 .mask = SND_JACK_MICROPHONE,
62 },
63};
64
65static int lowland_wm5100_init(struct snd_soc_pcm_runtime *rtd)
66{
67 struct snd_soc_codec *codec = rtd->codec;
68 int ret;
69
70 ret = snd_soc_codec_set_sysclk(codec, WM5100_CLK_SYSCLK,
71 WM5100_CLKSRC_MCLK1, MCLK1_RATE,
72 SND_SOC_CLOCK_IN);
73 if (ret < 0) {
74 pr_err("Failed to set SYSCLK clock source: %d\n", ret);
75 return ret;
76 }
77
78 /* Clock OPCLK, used by the other audio components. */
79 ret = snd_soc_codec_set_sysclk(codec, WM5100_CLK_OPCLK, 0,
80 CLKOUT_RATE, 0);
81 if (ret < 0) {
82 pr_err("Failed to set OPCLK rate: %d\n", ret);
83 return ret;
84 }
85
86 ret = snd_soc_jack_new(codec, "Headset",
87 SND_JACK_LINEOUT | SND_JACK_HEADSET |
88 SND_JACK_BTN_0,
89 &lowland_headset);
90 if (ret)
91 return ret;
92
93 ret = snd_soc_jack_add_pins(&lowland_headset,
94 ARRAY_SIZE(lowland_headset_pins),
95 lowland_headset_pins);
96 if (ret)
97 return ret;
98
99 wm5100_detect(codec, &lowland_headset);
100
101 return 0;
102}
103
104static struct snd_soc_dai_link lowland_dai[] = {
105 {
106 .name = "CPU",
107 .stream_name = "CPU",
108 .cpu_dai_name = "samsung-i2s.0",
109 .codec_dai_name = "wm5100-aif1",
110 .platform_name = "samsung-audio",
111 .codec_name = "wm5100.1-001a",
112 .ops = &lowland_ops,
113 .init = lowland_wm5100_init,
114 },
115 {
116 .name = "Baseband",
117 .stream_name = "Baseband",
118 .cpu_dai_name = "wm5100-aif2",
119 .codec_dai_name = "wm1250-ev1",
120 .codec_name = "wm1250-ev1.1-0027",
121 .ops = &lowland_ops,
122 .ignore_suspend = 1,
123 },
124};
125
126static int lowland_wm9081_init(struct snd_soc_dapm_context *dapm)
127{
128 snd_soc_dapm_nc_pin(dapm, "LINEOUT");
129
130 /* At any time the WM9081 is active it will have this clock */
131 return snd_soc_codec_set_sysclk(dapm->codec, WM9081_SYSCLK_MCLK, 0,
132 CLKOUT_RATE, 0);
133}
134
135static struct snd_soc_aux_dev lowland_aux_dev[] = {
136 {
137 .name = "wm9081",
138 .codec_name = "wm9081.1-006c",
139 .init = lowland_wm9081_init,
140 },
141};
142
143static struct snd_soc_codec_conf lowland_codec_conf[] = {
144 {
145 .dev_name = "wm9081.1-006c",
146 .name_prefix = "Sub",
147 },
148};
149
150static const struct snd_kcontrol_new controls[] = {
151 SOC_DAPM_PIN_SWITCH("Main Speaker"),
152 SOC_DAPM_PIN_SWITCH("Main DMIC"),
153 SOC_DAPM_PIN_SWITCH("Main AMIC"),
154 SOC_DAPM_PIN_SWITCH("WM1250 Input"),
155 SOC_DAPM_PIN_SWITCH("WM1250 Output"),
156 SOC_DAPM_PIN_SWITCH("Headphone"),
157};
158
159static struct snd_soc_dapm_widget widgets[] = {
160 SND_SOC_DAPM_HP("Headphone", NULL),
161 SND_SOC_DAPM_MIC("Headset Mic", NULL),
162
163 SND_SOC_DAPM_SPK("Main Speaker", NULL),
164
165 SND_SOC_DAPM_MIC("Main AMIC", NULL),
166 SND_SOC_DAPM_MIC("Main DMIC", NULL),
167};
168
169static struct snd_soc_dapm_route audio_paths[] = {
170 { "Sub IN1", NULL, "HPOUT2L" },
171 { "Sub IN2", NULL, "HPOUT2R" },
172
173 { "Main Speaker", NULL, "Sub SPKN" },
174 { "Main Speaker", NULL, "Sub SPKP" },
175 { "Main Speaker", NULL, "SPKDAT1" },
176};
177
178static struct snd_soc_card lowland = {
179 .name = "Lowland",
180 .owner = THIS_MODULE,
181 .dai_link = lowland_dai,
182 .num_links = ARRAY_SIZE(lowland_dai),
183 .aux_dev = lowland_aux_dev,
184 .num_aux_devs = ARRAY_SIZE(lowland_aux_dev),
185 .codec_conf = lowland_codec_conf,
186 .num_configs = ARRAY_SIZE(lowland_codec_conf),
187
188 .controls = controls,
189 .num_controls = ARRAY_SIZE(controls),
190 .dapm_widgets = widgets,
191 .num_dapm_widgets = ARRAY_SIZE(widgets),
192 .dapm_routes = audio_paths,
193 .num_dapm_routes = ARRAY_SIZE(audio_paths),
194};
195
196static __devinit int lowland_probe(struct platform_device *pdev)
197{
198 struct snd_soc_card *card = &lowland;
199 int ret;
200
201 card->dev = &pdev->dev;
202
203 ret = snd_soc_register_card(card);
204 if (ret) {
205 dev_err(&pdev->dev, "snd_soc_register_card() failed: %d\n",
206 ret);
207 return ret;
208 }
209
210 return 0;
211}
212
213static int __devexit lowland_remove(struct platform_device *pdev)
214{
215 struct snd_soc_card *card = platform_get_drvdata(pdev);
216
217 snd_soc_unregister_card(card);
218
219 return 0;
220}
221
222static struct platform_driver lowland_driver = {
223 .driver = {
224 .name = "lowland",
225 .owner = THIS_MODULE,
226 .pm = &snd_soc_pm_ops,
227 },
228 .probe = lowland_probe,
229 .remove = __devexit_p(lowland_remove),
230};
231
232module_platform_driver(lowland_driver);
233
234MODULE_DESCRIPTION("Lowland audio support");
235MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>");
236MODULE_LICENSE("GPL");
237MODULE_ALIAS("platform:lowland");
diff --git a/sound/soc/samsung/neo1973_wm8753.c b/sound/soc/samsung/neo1973_wm8753.c
index 7207189cd21..7ac0ba2025c 100644
--- a/sound/soc/samsung/neo1973_wm8753.c
+++ b/sound/soc/samsung/neo1973_wm8753.c
@@ -465,6 +465,7 @@ static const struct gpio neo1973_gta02_gpios[] = {};
465 465
466static struct snd_soc_card neo1973 = { 466static struct snd_soc_card neo1973 = {
467 .name = "neo1973", 467 .name = "neo1973",
468 .owner = THIS_MODULE,
468 .dai_link = neo1973_dai, 469 .dai_link = neo1973_dai,
469 .num_links = ARRAY_SIZE(neo1973_dai), 470 .num_links = ARRAY_SIZE(neo1973_dai),
470 .aux_dev = neo1973_aux_devs, 471 .aux_dev = neo1973_aux_devs,
diff --git a/sound/soc/samsung/pcm.c b/sound/soc/samsung/pcm.c
index 05a47cf7f06..56780206c00 100644
--- a/sound/soc/samsung/pcm.c
+++ b/sound/soc/samsung/pcm.c
@@ -14,6 +14,7 @@
14#include <linux/clk.h> 14#include <linux/clk.h>
15#include <linux/io.h> 15#include <linux/io.h>
16#include <linux/module.h> 16#include <linux/module.h>
17#include <linux/pm_runtime.h>
17 18
18#include <sound/soc.h> 19#include <sound/soc.h>
19#include <sound/pcm_params.h> 20#include <sound/pcm_params.h>
@@ -452,7 +453,7 @@ static int s3c_pcm_set_sysclk(struct snd_soc_dai *cpu_dai,
452 return 0; 453 return 0;
453} 454}
454 455
455static struct snd_soc_dai_ops s3c_pcm_dai_ops = { 456static const struct snd_soc_dai_ops s3c_pcm_dai_ops = {
456 .set_sysclk = s3c_pcm_set_sysclk, 457 .set_sysclk = s3c_pcm_set_sysclk,
457 .set_clkdiv = s3c_pcm_set_clkdiv, 458 .set_clkdiv = s3c_pcm_set_clkdiv,
458 .trigger = s3c_pcm_trigger, 459 .trigger = s3c_pcm_trigger,
@@ -478,7 +479,7 @@ static struct snd_soc_dai_ops s3c_pcm_dai_ops = {
478 .formats = SNDRV_PCM_FMTBIT_S16_LE, \ 479 .formats = SNDRV_PCM_FMTBIT_S16_LE, \
479 } 480 }
480 481
481struct snd_soc_dai_driver s3c_pcm_dai[] = { 482static struct snd_soc_dai_driver s3c_pcm_dai[] = {
482 [0] = { 483 [0] = {
483 .name = "samsung-pcm.0", 484 .name = "samsung-pcm.0",
484 S3C_PCM_DAI_DECLARE, 485 S3C_PCM_DAI_DECLARE,
@@ -488,7 +489,6 @@ struct snd_soc_dai_driver s3c_pcm_dai[] = {
488 S3C_PCM_DAI_DECLARE, 489 S3C_PCM_DAI_DECLARE,
489 }, 490 },
490}; 491};
491EXPORT_SYMBOL_GPL(s3c_pcm_dai);
492 492
493static __devinit int s3c_pcm_dev_probe(struct platform_device *pdev) 493static __devinit int s3c_pcm_dev_probe(struct platform_device *pdev)
494{ 494{
@@ -570,12 +570,6 @@ static __devinit int s3c_pcm_dev_probe(struct platform_device *pdev)
570 } 570 }
571 clk_enable(pcm->pclk); 571 clk_enable(pcm->pclk);
572 572
573 ret = snd_soc_register_dai(&pdev->dev, &s3c_pcm_dai[pdev->id]);
574 if (ret != 0) {
575 dev_err(&pdev->dev, "failed to get pcm_clock\n");
576 goto err5;
577 }
578
579 s3c_pcm_stereo_in[pdev->id].dma_addr = mem_res->start 573 s3c_pcm_stereo_in[pdev->id].dma_addr = mem_res->start
580 + S3C_PCM_RXFIFO; 574 + S3C_PCM_RXFIFO;
581 s3c_pcm_stereo_out[pdev->id].dma_addr = mem_res->start 575 s3c_pcm_stereo_out[pdev->id].dma_addr = mem_res->start
@@ -587,6 +581,14 @@ static __devinit int s3c_pcm_dev_probe(struct platform_device *pdev)
587 pcm->dma_capture = &s3c_pcm_stereo_in[pdev->id]; 581 pcm->dma_capture = &s3c_pcm_stereo_in[pdev->id];
588 pcm->dma_playback = &s3c_pcm_stereo_out[pdev->id]; 582 pcm->dma_playback = &s3c_pcm_stereo_out[pdev->id];
589 583
584 pm_runtime_enable(&pdev->dev);
585
586 ret = snd_soc_register_dai(&pdev->dev, &s3c_pcm_dai[pdev->id]);
587 if (ret != 0) {
588 dev_err(&pdev->dev, "failed to get register DAI: %d\n", ret);
589 goto err5;
590 }
591
590 return 0; 592 return 0;
591 593
592err5: 594err5:
@@ -610,6 +612,8 @@ static __devexit int s3c_pcm_dev_remove(struct platform_device *pdev)
610 612
611 snd_soc_unregister_dai(&pdev->dev); 613 snd_soc_unregister_dai(&pdev->dev);
612 614
615 pm_runtime_disable(&pdev->dev);
616
613 iounmap(pcm->regs); 617 iounmap(pcm->regs);
614 618
615 mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 619 mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -632,17 +636,7 @@ static struct platform_driver s3c_pcm_driver = {
632 }, 636 },
633}; 637};
634 638
635static int __init s3c_pcm_init(void) 639module_platform_driver(s3c_pcm_driver);
636{
637 return platform_driver_register(&s3c_pcm_driver);
638}
639module_init(s3c_pcm_init);
640
641static void __exit s3c_pcm_exit(void)
642{
643 platform_driver_unregister(&s3c_pcm_driver);
644}
645module_exit(s3c_pcm_exit);
646 640
647/* Module information */ 641/* Module information */
648MODULE_AUTHOR("Jaswinder Singh, <jassi.brar@samsung.com>"); 642MODULE_AUTHOR("Jaswinder Singh, <jassi.brar@samsung.com>");
diff --git a/sound/soc/samsung/rx1950_uda1380.c b/sound/soc/samsung/rx1950_uda1380.c
index 71b4c029fc3..21e12361a9c 100644
--- a/sound/soc/samsung/rx1950_uda1380.c
+++ b/sound/soc/samsung/rx1950_uda1380.c
@@ -114,6 +114,7 @@ static const struct snd_soc_dapm_route audio_map[] = {
114 114
115static struct snd_soc_card rx1950_asoc = { 115static struct snd_soc_card rx1950_asoc = {
116 .name = "rx1950", 116 .name = "rx1950",
117 .owner = THIS_MODULE,
117 .dai_link = rx1950_uda1380_dai, 118 .dai_link = rx1950_uda1380_dai,
118 .num_links = ARRAY_SIZE(rx1950_uda1380_dai), 119 .num_links = ARRAY_SIZE(rx1950_uda1380_dai),
119 120
diff --git a/sound/soc/samsung/s3c2412-i2s.c b/sound/soc/samsung/s3c2412-i2s.c
index 7bbec25e6e1..72185078ddf 100644
--- a/sound/soc/samsung/s3c2412-i2s.c
+++ b/sound/soc/samsung/s3c2412-i2s.c
@@ -142,7 +142,7 @@ static int s3c2412_i2s_hw_params(struct snd_pcm_substream *substream,
142 SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | \ 142 SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | \
143 SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000) 143 SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000)
144 144
145static struct snd_soc_dai_ops s3c2412_i2s_dai_ops = { 145static const struct snd_soc_dai_ops s3c2412_i2s_dai_ops = {
146 .hw_params = s3c2412_i2s_hw_params, 146 .hw_params = s3c2412_i2s_hw_params,
147}; 147};
148 148
@@ -184,17 +184,7 @@ static struct platform_driver s3c2412_iis_driver = {
184 }, 184 },
185}; 185};
186 186
187static int __init s3c2412_i2s_init(void) 187module_platform_driver(s3c2412_iis_driver);
188{
189 return platform_driver_register(&s3c2412_iis_driver);
190}
191module_init(s3c2412_i2s_init);
192
193static void __exit s3c2412_i2s_exit(void)
194{
195 platform_driver_unregister(&s3c2412_iis_driver);
196}
197module_exit(s3c2412_i2s_exit);
198 188
199/* Module information */ 189/* Module information */
200MODULE_AUTHOR("Ben Dooks, <ben@simtec.co.uk>"); 190MODULE_AUTHOR("Ben Dooks, <ben@simtec.co.uk>");
diff --git a/sound/soc/samsung/s3c24xx-i2s.c b/sound/soc/samsung/s3c24xx-i2s.c
index 558c64bbed2..c4aa4d412fb 100644
--- a/sound/soc/samsung/s3c24xx-i2s.c
+++ b/sound/soc/samsung/s3c24xx-i2s.c
@@ -444,7 +444,7 @@ static int s3c24xx_i2s_resume(struct snd_soc_dai *cpu_dai)
444 SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | \ 444 SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_32000 | SNDRV_PCM_RATE_44100 | \
445 SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000) 445 SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_88200 | SNDRV_PCM_RATE_96000)
446 446
447static struct snd_soc_dai_ops s3c24xx_i2s_dai_ops = { 447static const struct snd_soc_dai_ops s3c24xx_i2s_dai_ops = {
448 .trigger = s3c24xx_i2s_trigger, 448 .trigger = s3c24xx_i2s_trigger,
449 .hw_params = s3c24xx_i2s_hw_params, 449 .hw_params = s3c24xx_i2s_hw_params,
450 .set_fmt = s3c24xx_i2s_set_fmt, 450 .set_fmt = s3c24xx_i2s_set_fmt,
@@ -489,17 +489,7 @@ static struct platform_driver s3c24xx_iis_driver = {
489 }, 489 },
490}; 490};
491 491
492static int __init s3c24xx_i2s_init(void) 492module_platform_driver(s3c24xx_iis_driver);
493{
494 return platform_driver_register(&s3c24xx_iis_driver);
495}
496module_init(s3c24xx_i2s_init);
497
498static void __exit s3c24xx_i2s_exit(void)
499{
500 platform_driver_unregister(&s3c24xx_iis_driver);
501}
502module_exit(s3c24xx_i2s_exit);
503 493
504/* Module information */ 494/* Module information */
505MODULE_AUTHOR("Ben Dooks, <ben@simtec.co.uk>"); 495MODULE_AUTHOR("Ben Dooks, <ben@simtec.co.uk>");
diff --git a/sound/soc/samsung/s3c24xx_simtec_hermes.c b/sound/soc/samsung/s3c24xx_simtec_hermes.c
index d125e79baf7..7ace6a87f41 100644
--- a/sound/soc/samsung/s3c24xx_simtec_hermes.c
+++ b/sound/soc/samsung/s3c24xx_simtec_hermes.c
@@ -89,6 +89,7 @@ static struct snd_soc_dai_link simtec_dai_aic33 = {
89/* simtec audio machine driver */ 89/* simtec audio machine driver */
90static struct snd_soc_card snd_soc_machine_simtec_aic33 = { 90static struct snd_soc_card snd_soc_machine_simtec_aic33 = {
91 .name = "Simtec-Hermes", 91 .name = "Simtec-Hermes",
92 .owner = THIS_MODULE,
92 .dai_link = &simtec_dai_aic33, 93 .dai_link = &simtec_dai_aic33,
93 .num_links = 1, 94 .num_links = 1,
94 95
@@ -114,21 +115,9 @@ static struct platform_driver simtec_audio_hermes_platdrv = {
114 .remove = __devexit_p(simtec_audio_remove), 115 .remove = __devexit_p(simtec_audio_remove),
115}; 116};
116 117
117MODULE_ALIAS("platform:s3c24xx-simtec-hermes-snd"); 118module_platform_driver(simtec_audio_hermes_platdrv);
118
119static int __init simtec_hermes_modinit(void)
120{
121 return platform_driver_register(&simtec_audio_hermes_platdrv);
122}
123
124static void __exit simtec_hermes_modexit(void)
125{
126 platform_driver_unregister(&simtec_audio_hermes_platdrv);
127}
128
129module_init(simtec_hermes_modinit);
130module_exit(simtec_hermes_modexit);
131 119
120MODULE_ALIAS("platform:s3c24xx-simtec-hermes-snd");
132MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>"); 121MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>");
133MODULE_DESCRIPTION("ALSA SoC Simtec Audio support"); 122MODULE_DESCRIPTION("ALSA SoC Simtec Audio support");
134MODULE_LICENSE("GPL"); 123MODULE_LICENSE("GPL");
diff --git a/sound/soc/samsung/s3c24xx_simtec_tlv320aic23.c b/sound/soc/samsung/s3c24xx_simtec_tlv320aic23.c
index 5e4fd46b720..c42d5f00b0e 100644
--- a/sound/soc/samsung/s3c24xx_simtec_tlv320aic23.c
+++ b/sound/soc/samsung/s3c24xx_simtec_tlv320aic23.c
@@ -78,6 +78,7 @@ static struct snd_soc_dai_link simtec_dai_aic23 = {
78/* simtec audio machine driver */ 78/* simtec audio machine driver */
79static struct snd_soc_card snd_soc_machine_simtec_aic23 = { 79static struct snd_soc_card snd_soc_machine_simtec_aic23 = {
80 .name = "Simtec", 80 .name = "Simtec",
81 .owner = THIS_MODULE,
81 .dai_link = &simtec_dai_aic23, 82 .dai_link = &simtec_dai_aic23,
82 .num_links = 1, 83 .num_links = 1,
83 84
@@ -92,7 +93,7 @@ static int __devinit simtec_audio_tlv320aic23_probe(struct platform_device *pd)
92 return simtec_audio_core_probe(pd, &snd_soc_machine_simtec_aic23); 93 return simtec_audio_core_probe(pd, &snd_soc_machine_simtec_aic23);
93} 94}
94 95
95static struct platform_driver simtec_audio_tlv320aic23_platdrv = { 96static struct platform_driver simtec_audio_tlv320aic23_driver = {
96 .driver = { 97 .driver = {
97 .owner = THIS_MODULE, 98 .owner = THIS_MODULE,
98 .name = "s3c24xx-simtec-tlv320aic23", 99 .name = "s3c24xx-simtec-tlv320aic23",
@@ -102,21 +103,9 @@ static struct platform_driver simtec_audio_tlv320aic23_platdrv = {
102 .remove = __devexit_p(simtec_audio_remove), 103 .remove = __devexit_p(simtec_audio_remove),
103}; 104};
104 105
105MODULE_ALIAS("platform:s3c24xx-simtec-tlv320aic23"); 106module_platform_driver(simtec_audio_tlv320aic23_driver);
106
107static int __init simtec_tlv320aic23_modinit(void)
108{
109 return platform_driver_register(&simtec_audio_tlv320aic23_platdrv);
110}
111
112static void __exit simtec_tlv320aic23_modexit(void)
113{
114 platform_driver_unregister(&simtec_audio_tlv320aic23_platdrv);
115}
116
117module_init(simtec_tlv320aic23_modinit);
118module_exit(simtec_tlv320aic23_modexit);
119 107
108MODULE_ALIAS("platform:s3c24xx-simtec-tlv320aic23");
120MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>"); 109MODULE_AUTHOR("Ben Dooks <ben@simtec.co.uk>");
121MODULE_DESCRIPTION("ALSA SoC Simtec Audio support"); 110MODULE_DESCRIPTION("ALSA SoC Simtec Audio support");
122MODULE_LICENSE("GPL"); 111MODULE_LICENSE("GPL");
diff --git a/sound/soc/samsung/s3c24xx_uda134x.c b/sound/soc/samsung/s3c24xx_uda134x.c
index 548c6ac6e7b..d731042e51b 100644
--- a/sound/soc/samsung/s3c24xx_uda134x.c
+++ b/sound/soc/samsung/s3c24xx_uda134x.c
@@ -229,6 +229,7 @@ static struct snd_soc_dai_link s3c24xx_uda134x_dai_link = {
229 229
230static struct snd_soc_card snd_soc_s3c24xx_uda134x = { 230static struct snd_soc_card snd_soc_s3c24xx_uda134x = {
231 .name = "S3C24XX_UDA134X", 231 .name = "S3C24XX_UDA134X",
232 .owner = THIS_MODULE,
232 .dai_link = &s3c24xx_uda134x_dai_link, 233 .dai_link = &s3c24xx_uda134x_dai_link,
233 .num_links = 1, 234 .num_links = 1,
234}; 235};
@@ -343,19 +344,7 @@ static struct platform_driver s3c24xx_uda134x_driver = {
343 }, 344 },
344}; 345};
345 346
346static int __init s3c24xx_uda134x_init(void) 347module_platform_driver(s3c24xx_uda134x_driver);
347{
348 return platform_driver_register(&s3c24xx_uda134x_driver);
349}
350
351static void __exit s3c24xx_uda134x_exit(void)
352{
353 platform_driver_unregister(&s3c24xx_uda134x_driver);
354}
355
356
357module_init(s3c24xx_uda134x_init);
358module_exit(s3c24xx_uda134x_exit);
359 348
360MODULE_AUTHOR("Zoltan Devai, Christian Pellegrin <chripell@evolware.org>"); 349MODULE_AUTHOR("Zoltan Devai, Christian Pellegrin <chripell@evolware.org>");
361MODULE_DESCRIPTION("S3C24XX_UDA134X ALSA SoC audio driver"); 350MODULE_DESCRIPTION("S3C24XX_UDA134X ALSA SoC audio driver");
diff --git a/sound/soc/samsung/smartq_wm8987.c b/sound/soc/samsung/smartq_wm8987.c
index a22fc440280..f2dcb424ea2 100644
--- a/sound/soc/samsung/smartq_wm8987.c
+++ b/sound/soc/samsung/smartq_wm8987.c
@@ -198,6 +198,7 @@ static struct snd_soc_dai_link smartq_dai[] = {
198 198
199static struct snd_soc_card snd_soc_smartq = { 199static struct snd_soc_card snd_soc_smartq = {
200 .name = "SmartQ", 200 .name = "SmartQ",
201 .owner = THIS_MODULE,
201 .dai_link = smartq_dai, 202 .dai_link = smartq_dai,
202 .num_links = ARRAY_SIZE(smartq_dai), 203 .num_links = ARRAY_SIZE(smartq_dai),
203 204
diff --git a/sound/soc/samsung/smdk2443_wm9710.c b/sound/soc/samsung/smdk2443_wm9710.c
index 3a0dbfc793f..720ba29bb7e 100644
--- a/sound/soc/samsung/smdk2443_wm9710.c
+++ b/sound/soc/samsung/smdk2443_wm9710.c
@@ -12,6 +12,7 @@
12 * 12 *
13 */ 13 */
14 14
15#include <linux/module.h>
15#include <sound/soc.h> 16#include <sound/soc.h>
16 17
17static struct snd_soc_card smdk2443; 18static struct snd_soc_card smdk2443;
@@ -29,6 +30,7 @@ static struct snd_soc_dai_link smdk2443_dai[] = {
29 30
30static struct snd_soc_card smdk2443 = { 31static struct snd_soc_card smdk2443 = {
31 .name = "SMDK2443", 32 .name = "SMDK2443",
33 .owner = THIS_MODULE,
32 .dai_link = smdk2443_dai, 34 .dai_link = smdk2443_dai,
33 .num_links = ARRAY_SIZE(smdk2443_dai), 35 .num_links = ARRAY_SIZE(smdk2443_dai),
34}; 36};
diff --git a/sound/soc/samsung/smdk_spdif.c b/sound/soc/samsung/smdk_spdif.c
index e0fd8ad2355..beaa9c15d69 100644
--- a/sound/soc/samsung/smdk_spdif.c
+++ b/sound/soc/samsung/smdk_spdif.c
@@ -160,6 +160,7 @@ static struct snd_soc_dai_link smdk_dai = {
160 160
161static struct snd_soc_card smdk = { 161static struct snd_soc_card smdk = {
162 .name = "SMDK-S/PDIF", 162 .name = "SMDK-S/PDIF",
163 .owner = THIS_MODULE,
163 .dai_link = &smdk_dai, 164 .dai_link = &smdk_dai,
164 .num_links = 1, 165 .num_links = 1,
165}; 166};
diff --git a/sound/soc/samsung/smdk_wm8580.c b/sound/soc/samsung/smdk_wm8580.c
index 81b44782399..bff8758e7f2 100644
--- a/sound/soc/samsung/smdk_wm8580.c
+++ b/sound/soc/samsung/smdk_wm8580.c
@@ -203,6 +203,7 @@ static struct snd_soc_dai_link smdk_dai[] = {
203 203
204static struct snd_soc_card smdk = { 204static struct snd_soc_card smdk = {
205 .name = "SMDK-I2S", 205 .name = "SMDK-I2S",
206 .owner = THIS_MODULE,
206 .dai_link = smdk_dai, 207 .dai_link = smdk_dai,
207 .num_links = 2, 208 .num_links = 2,
208 209
diff --git a/sound/soc/samsung/smdk_wm8580pcm.c b/sound/soc/samsung/smdk_wm8580pcm.c
index 0677473e6b6..fab5322e9f0 100644
--- a/sound/soc/samsung/smdk_wm8580pcm.c
+++ b/sound/soc/samsung/smdk_wm8580pcm.c
@@ -143,6 +143,7 @@ static struct snd_soc_dai_link smdk_dai[] = {
143 143
144static struct snd_soc_card smdk_pcm = { 144static struct snd_soc_card smdk_pcm = {
145 .name = "SMDK-PCM", 145 .name = "SMDK-PCM",
146 .owner = THIS_MODULE,
146 .dai_link = smdk_dai, 147 .dai_link = smdk_dai,
147 .num_links = 2, 148 .num_links = 2,
148}; 149};
@@ -188,19 +189,7 @@ static struct platform_driver snd_smdk_driver = {
188 .remove = __devexit_p(snd_smdk_remove), 189 .remove = __devexit_p(snd_smdk_remove),
189}; 190};
190 191
191static int __init smdk_audio_init(void) 192module_platform_driver(snd_smdk_driver);
192{
193 return platform_driver_register(&snd_smdk_driver);
194}
195
196module_init(smdk_audio_init);
197
198static void __exit smdk_audio_exit(void)
199{
200 platform_driver_unregister(&snd_smdk_driver);
201}
202
203module_exit(smdk_audio_exit);
204 193
205MODULE_AUTHOR("Sangbeom Kim, <sbkim73@samsung.com>"); 194MODULE_AUTHOR("Sangbeom Kim, <sbkim73@samsung.com>");
206MODULE_DESCRIPTION("ALSA SoC SMDK WM8580 for PCM"); 195MODULE_DESCRIPTION("ALSA SoC SMDK WM8580 for PCM");
diff --git a/sound/soc/samsung/smdk_wm8994.c b/sound/soc/samsung/smdk_wm8994.c
index ad9ac42522e..8eb309f23d1 100644
--- a/sound/soc/samsung/smdk_wm8994.c
+++ b/sound/soc/samsung/smdk_wm8994.c
@@ -144,6 +144,7 @@ static struct snd_soc_dai_link smdk_dai[] = {
144 144
145static struct snd_soc_card smdk = { 145static struct snd_soc_card smdk = {
146 .name = "SMDK-I2S", 146 .name = "SMDK-I2S",
147 .owner = THIS_MODULE,
147 .dai_link = smdk_dai, 148 .dai_link = smdk_dai,
148 .num_links = ARRAY_SIZE(smdk_dai), 149 .num_links = ARRAY_SIZE(smdk_dai),
149}; 150};
diff --git a/sound/soc/samsung/smdk_wm8994pcm.c b/sound/soc/samsung/smdk_wm8994pcm.c
index da9c2a264d9..77ecba93511 100644
--- a/sound/soc/samsung/smdk_wm8994pcm.c
+++ b/sound/soc/samsung/smdk_wm8994pcm.c
@@ -124,6 +124,7 @@ static struct snd_soc_dai_link smdk_dai[] = {
124 124
125static struct snd_soc_card smdk_pcm = { 125static struct snd_soc_card smdk_pcm = {
126 .name = "SMDK-PCM", 126 .name = "SMDK-PCM",
127 .owner = THIS_MODULE,
127 .dai_link = smdk_dai, 128 .dai_link = smdk_dai,
128 .num_links = 1, 129 .num_links = 1,
129}; 130};
@@ -158,19 +159,7 @@ static struct platform_driver snd_smdk_driver = {
158 .remove = __devexit_p(snd_smdk_remove), 159 .remove = __devexit_p(snd_smdk_remove),
159}; 160};
160 161
161static int __init smdk_audio_init(void) 162module_platform_driver(snd_smdk_driver);
162{
163 return platform_driver_register(&snd_smdk_driver);
164}
165
166module_init(smdk_audio_init);
167
168static void __exit smdk_audio_exit(void)
169{
170 platform_driver_unregister(&snd_smdk_driver);
171}
172
173module_exit(smdk_audio_exit);
174 163
175MODULE_AUTHOR("Sangbeom Kim, <sbkim73@samsung.com>"); 164MODULE_AUTHOR("Sangbeom Kim, <sbkim73@samsung.com>");
176MODULE_DESCRIPTION("ALSA SoC SMDK WM8994 for PCM"); 165MODULE_DESCRIPTION("ALSA SoC SMDK WM8994 for PCM");
diff --git a/sound/soc/samsung/smdk_wm9713.c b/sound/soc/samsung/smdk_wm9713.c
index 31c6daf6d4d..8e26a730fcd 100644
--- a/sound/soc/samsung/smdk_wm9713.c
+++ b/sound/soc/samsung/smdk_wm9713.c
@@ -50,6 +50,7 @@ static struct snd_soc_dai_link smdk_dai = {
50 50
51static struct snd_soc_card smdk = { 51static struct snd_soc_card smdk = {
52 .name = "SMDK WM9713", 52 .name = "SMDK WM9713",
53 .owner = THIS_MODULE,
53 .dai_link = &smdk_dai, 54 .dai_link = &smdk_dai,
54 .num_links = 1, 55 .num_links = 1,
55}; 56};
diff --git a/sound/soc/samsung/spdif.c b/sound/soc/samsung/spdif.c
index 468cff1bb1a..a5a56a12034 100644
--- a/sound/soc/samsung/spdif.c
+++ b/sound/soc/samsung/spdif.c
@@ -334,7 +334,7 @@ static int spdif_resume(struct snd_soc_dai *cpu_dai)
334#define spdif_resume NULL 334#define spdif_resume NULL
335#endif 335#endif
336 336
337static struct snd_soc_dai_ops spdif_dai_ops = { 337static const struct snd_soc_dai_ops spdif_dai_ops = {
338 .set_sysclk = spdif_set_sysclk, 338 .set_sysclk = spdif_set_sysclk,
339 .trigger = spdif_trigger, 339 .trigger = spdif_trigger,
340 .hw_params = spdif_hw_params, 340 .hw_params = spdif_hw_params,
@@ -483,17 +483,7 @@ static struct platform_driver samsung_spdif_driver = {
483 }, 483 },
484}; 484};
485 485
486static int __init spdif_init(void) 486module_platform_driver(samsung_spdif_driver);
487{
488 return platform_driver_register(&samsung_spdif_driver);
489}
490module_init(spdif_init);
491
492static void __exit spdif_exit(void)
493{
494 platform_driver_unregister(&samsung_spdif_driver);
495}
496module_exit(spdif_exit);
497 487
498MODULE_AUTHOR("Seungwhan Youn, <sw.youn@samsung.com>"); 488MODULE_AUTHOR("Seungwhan Youn, <sw.youn@samsung.com>");
499MODULE_DESCRIPTION("Samsung S/PDIF Controller Driver"); 489MODULE_DESCRIPTION("Samsung S/PDIF Controller Driver");
diff --git a/sound/soc/samsung/speyside.c b/sound/soc/samsung/speyside.c
index 4b8e35410eb..f9ab7707a3e 100644
--- a/sound/soc/samsung/speyside.c
+++ b/sound/soc/samsung/speyside.c
@@ -19,6 +19,7 @@
19#include "../codecs/wm9081.h" 19#include "../codecs/wm9081.h"
20 20
21#define WM8996_HPSEL_GPIO 214 21#define WM8996_HPSEL_GPIO 214
22#define MCLK_AUDIO_RATE (512 * 48000)
22 23
23static int speyside_set_bias_level(struct snd_soc_card *card, 24static int speyside_set_bias_level(struct snd_soc_card *card,
24 struct snd_soc_dapm_context *dapm, 25 struct snd_soc_dapm_context *dapm,
@@ -67,7 +68,7 @@ static int speyside_set_bias_level_post(struct snd_soc_card *card,
67 if (card->dapm.bias_level == SND_SOC_BIAS_STANDBY) { 68 if (card->dapm.bias_level == SND_SOC_BIAS_STANDBY) {
68 ret = snd_soc_dai_set_pll(codec_dai, 0, 69 ret = snd_soc_dai_set_pll(codec_dai, 0,
69 WM8996_FLL_MCLK2, 70 WM8996_FLL_MCLK2,
70 32768, 48000 * 256); 71 32768, MCLK_AUDIO_RATE);
71 if (ret < 0) { 72 if (ret < 0) {
72 pr_err("Failed to start FLL\n"); 73 pr_err("Failed to start FLL\n");
73 return ret; 74 return ret;
@@ -75,7 +76,7 @@ static int speyside_set_bias_level_post(struct snd_soc_card *card,
75 76
76 ret = snd_soc_dai_set_sysclk(codec_dai, 77 ret = snd_soc_dai_set_sysclk(codec_dai,
77 WM8996_SYSCLK_FLL, 78 WM8996_SYSCLK_FLL,
78 48000 * 256, 79 MCLK_AUDIO_RATE,
79 SND_SOC_CLOCK_IN); 80 SND_SOC_CLOCK_IN);
80 if (ret < 0) 81 if (ret < 0)
81 return ret; 82 return ret;
@@ -222,11 +223,9 @@ static struct snd_soc_dai_link speyside_dai[] = {
222 223
223static int speyside_wm9081_init(struct snd_soc_dapm_context *dapm) 224static int speyside_wm9081_init(struct snd_soc_dapm_context *dapm)
224{ 225{
225 snd_soc_dapm_nc_pin(dapm, "LINEOUT");
226
227 /* At any time the WM9081 is active it will have this clock */ 226 /* At any time the WM9081 is active it will have this clock */
228 return snd_soc_codec_set_sysclk(dapm->codec, WM9081_SYSCLK_MCLK, 0, 227 return snd_soc_codec_set_sysclk(dapm->codec, WM9081_SYSCLK_MCLK, 0,
229 48000 * 256, 0); 228 MCLK_AUDIO_RATE, 0);
230} 229}
231 230
232static struct snd_soc_aux_dev speyside_aux_dev[] = { 231static struct snd_soc_aux_dev speyside_aux_dev[] = {
@@ -292,6 +291,7 @@ static struct snd_soc_dapm_route audio_paths[] = {
292 291
293static struct snd_soc_card speyside = { 292static struct snd_soc_card speyside = {
294 .name = "Speyside", 293 .name = "Speyside",
294 .owner = THIS_MODULE,
295 .dai_link = speyside_dai, 295 .dai_link = speyside_dai,
296 .num_links = ARRAY_SIZE(speyside_dai), 296 .num_links = ARRAY_SIZE(speyside_dai),
297 .aux_dev = speyside_aux_dev, 297 .aux_dev = speyside_aux_dev,
@@ -308,6 +308,7 @@ static struct snd_soc_card speyside = {
308 .num_dapm_widgets = ARRAY_SIZE(widgets), 308 .num_dapm_widgets = ARRAY_SIZE(widgets),
309 .dapm_routes = audio_paths, 309 .dapm_routes = audio_paths,
310 .num_dapm_routes = ARRAY_SIZE(audio_paths), 310 .num_dapm_routes = ARRAY_SIZE(audio_paths),
311 .fully_routed = true,
311 312
312 .late_probe = speyside_late_probe, 313 .late_probe = speyside_late_probe,
313}; 314};
@@ -348,17 +349,7 @@ static struct platform_driver speyside_driver = {
348 .remove = __devexit_p(speyside_remove), 349 .remove = __devexit_p(speyside_remove),
349}; 350};
350 351
351static int __init speyside_audio_init(void) 352module_platform_driver(speyside_driver);
352{
353 return platform_driver_register(&speyside_driver);
354}
355module_init(speyside_audio_init);
356
357static void __exit speyside_audio_exit(void)
358{
359 platform_driver_unregister(&speyside_driver);
360}
361module_exit(speyside_audio_exit);
362 353
363MODULE_DESCRIPTION("Speyside audio support"); 354MODULE_DESCRIPTION("Speyside audio support");
364MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>"); 355MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>");
diff --git a/sound/soc/samsung/speyside_wm8962.c b/sound/soc/samsung/tobermory.c
index e3e27166cc5..9199649bf78 100644
--- a/sound/soc/samsung/speyside_wm8962.c
+++ b/sound/soc/samsung/tobermory.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * Speyside with WM8962 audio support 2 * Tobermory audio support
3 * 3 *
4 * Copyright 2011 Wolfson Microelectronics 4 * Copyright 2011 Wolfson Microelectronics
5 * 5 *
@@ -19,7 +19,7 @@
19 19
20static int sample_rate = 44100; 20static int sample_rate = 44100;
21 21
22static int speyside_wm8962_set_bias_level(struct snd_soc_card *card, 22static int tobermory_set_bias_level(struct snd_soc_card *card,
23 struct snd_soc_dapm_context *dapm, 23 struct snd_soc_dapm_context *dapm,
24 enum snd_soc_bias_level level) 24 enum snd_soc_bias_level level)
25{ 25{
@@ -56,7 +56,7 @@ static int speyside_wm8962_set_bias_level(struct snd_soc_card *card,
56 return 0; 56 return 0;
57} 57}
58 58
59static int speyside_wm8962_set_bias_level_post(struct snd_soc_card *card, 59static int tobermory_set_bias_level_post(struct snd_soc_card *card,
60 struct snd_soc_dapm_context *dapm, 60 struct snd_soc_dapm_context *dapm,
61 enum snd_soc_bias_level level) 61 enum snd_soc_bias_level level)
62{ 62{
@@ -92,7 +92,7 @@ static int speyside_wm8962_set_bias_level_post(struct snd_soc_card *card,
92 return 0; 92 return 0;
93} 93}
94 94
95static int speyside_wm8962_hw_params(struct snd_pcm_substream *substream, 95static int tobermory_hw_params(struct snd_pcm_substream *substream,
96 struct snd_pcm_hw_params *params) 96 struct snd_pcm_hw_params *params)
97{ 97{
98 sample_rate = params_rate(params); 98 sample_rate = params_rate(params);
@@ -100,11 +100,11 @@ static int speyside_wm8962_hw_params(struct snd_pcm_substream *substream,
100 return 0; 100 return 0;
101} 101}
102 102
103static struct snd_soc_ops speyside_wm8962_ops = { 103static struct snd_soc_ops tobermory_ops = {
104 .hw_params = speyside_wm8962_hw_params, 104 .hw_params = tobermory_hw_params,
105}; 105};
106 106
107static struct snd_soc_dai_link speyside_wm8962_dai[] = { 107static struct snd_soc_dai_link tobermory_dai[] = {
108 { 108 {
109 .name = "CPU", 109 .name = "CPU",
110 .stream_name = "CPU", 110 .stream_name = "CPU",
@@ -114,7 +114,7 @@ static struct snd_soc_dai_link speyside_wm8962_dai[] = {
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,
117 .ops = &speyside_wm8962_ops, 117 .ops = &tobermory_ops,
118 }, 118 },
119}; 119};
120 120
@@ -152,10 +152,10 @@ static struct snd_soc_dapm_route audio_paths[] = {
152 { "DMICDAT", NULL, "DMIC" }, 152 { "DMICDAT", NULL, "DMIC" },
153}; 153};
154 154
155static struct snd_soc_jack speyside_wm8962_headset; 155static struct snd_soc_jack tobermory_headset;
156 156
157/* Headset jack detection DAPM pins */ 157/* Headset jack detection DAPM pins */
158static struct snd_soc_jack_pin speyside_wm8962_headset_pins[] = { 158static struct snd_soc_jack_pin tobermory_headset_pins[] = {
159 { 159 {
160 .pin = "Headset Mic", 160 .pin = "Headset Mic",
161 .mask = SND_JACK_MICROPHONE, 161 .mask = SND_JACK_MICROPHONE,
@@ -166,7 +166,7 @@ static struct snd_soc_jack_pin speyside_wm8962_headset_pins[] = {
166 }, 166 },
167}; 167};
168 168
169static int speyside_wm8962_late_probe(struct snd_soc_card *card) 169static int tobermory_late_probe(struct snd_soc_card *card)
170{ 170{
171 struct snd_soc_codec *codec = card->rtd[0].codec; 171 struct snd_soc_codec *codec = card->rtd[0].codec;
172 struct snd_soc_dai *codec_dai = card->rtd[0].codec_dai; 172 struct snd_soc_dai *codec_dai = card->rtd[0].codec_dai;
@@ -179,28 +179,29 @@ static int speyside_wm8962_late_probe(struct snd_soc_card *card)
179 179
180 ret = snd_soc_jack_new(codec, "Headset", 180 ret = snd_soc_jack_new(codec, "Headset",
181 SND_JACK_HEADSET | SND_JACK_BTN_0, 181 SND_JACK_HEADSET | SND_JACK_BTN_0,
182 &speyside_wm8962_headset); 182 &tobermory_headset);
183 if (ret) 183 if (ret)
184 return ret; 184 return ret;
185 185
186 ret = snd_soc_jack_add_pins(&speyside_wm8962_headset, 186 ret = snd_soc_jack_add_pins(&tobermory_headset,
187 ARRAY_SIZE(speyside_wm8962_headset_pins), 187 ARRAY_SIZE(tobermory_headset_pins),
188 speyside_wm8962_headset_pins); 188 tobermory_headset_pins);
189 if (ret) 189 if (ret)
190 return ret; 190 return ret;
191 191
192 wm8962_mic_detect(codec, &speyside_wm8962_headset); 192 wm8962_mic_detect(codec, &tobermory_headset);
193 193
194 return 0; 194 return 0;
195} 195}
196 196
197static struct snd_soc_card speyside_wm8962 = { 197static struct snd_soc_card tobermory = {
198 .name = "Speyside WM8962", 198 .name = "Tobermory",
199 .dai_link = speyside_wm8962_dai, 199 .owner = THIS_MODULE,
200 .num_links = ARRAY_SIZE(speyside_wm8962_dai), 200 .dai_link = tobermory_dai,
201 .num_links = ARRAY_SIZE(tobermory_dai),
201 202
202 .set_bias_level = speyside_wm8962_set_bias_level, 203 .set_bias_level = tobermory_set_bias_level,
203 .set_bias_level_post = speyside_wm8962_set_bias_level_post, 204 .set_bias_level_post = tobermory_set_bias_level_post,
204 205
205 .controls = controls, 206 .controls = controls,
206 .num_controls = ARRAY_SIZE(controls), 207 .num_controls = ARRAY_SIZE(controls),
@@ -208,13 +209,14 @@ static struct snd_soc_card speyside_wm8962 = {
208 .num_dapm_widgets = ARRAY_SIZE(widgets), 209 .num_dapm_widgets = ARRAY_SIZE(widgets),
209 .dapm_routes = audio_paths, 210 .dapm_routes = audio_paths,
210 .num_dapm_routes = ARRAY_SIZE(audio_paths), 211 .num_dapm_routes = ARRAY_SIZE(audio_paths),
212 .fully_routed = true,
211 213
212 .late_probe = speyside_wm8962_late_probe, 214 .late_probe = tobermory_late_probe,
213}; 215};
214 216
215static __devinit int speyside_wm8962_probe(struct platform_device *pdev) 217static __devinit int tobermory_probe(struct platform_device *pdev)
216{ 218{
217 struct snd_soc_card *card = &speyside_wm8962; 219 struct snd_soc_card *card = &tobermory;
218 int ret; 220 int ret;
219 221
220 card->dev = &pdev->dev; 222 card->dev = &pdev->dev;
@@ -229,7 +231,7 @@ static __devinit int speyside_wm8962_probe(struct platform_device *pdev)
229 return 0; 231 return 0;
230} 232}
231 233
232static int __devexit speyside_wm8962_remove(struct platform_device *pdev) 234static int __devexit tobermory_remove(struct platform_device *pdev)
233{ 235{
234 struct snd_soc_card *card = platform_get_drvdata(pdev); 236 struct snd_soc_card *card = platform_get_drvdata(pdev);
235 237
@@ -238,29 +240,19 @@ static int __devexit speyside_wm8962_remove(struct platform_device *pdev)
238 return 0; 240 return 0;
239} 241}
240 242
241static struct platform_driver speyside_wm8962_driver = { 243static struct platform_driver tobermory_driver = {
242 .driver = { 244 .driver = {
243 .name = "speyside-wm8962", 245 .name = "tobermory",
244 .owner = THIS_MODULE, 246 .owner = THIS_MODULE,
245 .pm = &snd_soc_pm_ops, 247 .pm = &snd_soc_pm_ops,
246 }, 248 },
247 .probe = speyside_wm8962_probe, 249 .probe = tobermory_probe,
248 .remove = __devexit_p(speyside_wm8962_remove), 250 .remove = __devexit_p(tobermory_remove),
249}; 251};
250 252
251static int __init speyside_wm8962_audio_init(void) 253module_platform_driver(tobermory_driver);
252{
253 return platform_driver_register(&speyside_wm8962_driver);
254}
255module_init(speyside_wm8962_audio_init);
256
257static void __exit speyside_wm8962_audio_exit(void)
258{
259 platform_driver_unregister(&speyside_wm8962_driver);
260}
261module_exit(speyside_wm8962_audio_exit);
262 254
263MODULE_DESCRIPTION("Speyside WM8962 audio support"); 255MODULE_DESCRIPTION("Tobermory audio support");
264MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>"); 256MODULE_AUTHOR("Mark Brown <broonie@opensource.wolfsonmicro.com>");
265MODULE_LICENSE("GPL"); 257MODULE_LICENSE("GPL");
266MODULE_ALIAS("platform:speyside-wm8962"); 258MODULE_ALIAS("platform:tobermory");
diff --git a/sound/soc/sh/dma-sh7760.c b/sound/soc/sh/dma-sh7760.c
index db74005f37c..7da20186b19 100644
--- a/sound/soc/sh/dma-sh7760.c
+++ b/sound/soc/sh/dma-sh7760.c
@@ -369,17 +369,7 @@ static struct platform_driver sh7760_pcm_driver = {
369 .remove = __devexit_p(sh7760_soc_platform_remove), 369 .remove = __devexit_p(sh7760_soc_platform_remove),
370}; 370};
371 371
372static int __init snd_sh7760_pcm_init(void) 372module_platform_driver(sh7760_pcm_driver);
373{
374 return platform_driver_register(&sh7760_pcm_driver);
375}
376module_init(snd_sh7760_pcm_init);
377
378static void __exit snd_sh7760_pcm_exit(void)
379{
380 platform_driver_unregister(&sh7760_pcm_driver);
381}
382module_exit(snd_sh7760_pcm_exit);
383 373
384MODULE_LICENSE("GPL"); 374MODULE_LICENSE("GPL");
385MODULE_DESCRIPTION("SH7760 Audio DMA (DMABRG) driver"); 375MODULE_DESCRIPTION("SH7760 Audio DMA (DMABRG) driver");
diff --git a/sound/soc/sh/fsi-ak4642.c b/sound/soc/sh/fsi-ak4642.c
index dff64b95f5d..97f540aabbd 100644
--- a/sound/soc/sh/fsi-ak4642.c
+++ b/sound/soc/sh/fsi-ak4642.c
@@ -49,6 +49,7 @@ static struct snd_soc_dai_link fsi_dai_link = {
49}; 49};
50 50
51static struct snd_soc_card fsi_soc_card = { 51static struct snd_soc_card fsi_soc_card = {
52 .owner = THIS_MODULE,
52 .dai_link = &fsi_dai_link, 53 .dai_link = &fsi_dai_link,
53 .num_links = 1, 54 .num_links = 1,
54}; 55};
@@ -58,27 +59,23 @@ static struct platform_device *fsi_snd_device;
58static int fsi_ak4642_probe(struct platform_device *pdev) 59static int fsi_ak4642_probe(struct platform_device *pdev)
59{ 60{
60 int ret = -ENOMEM; 61 int ret = -ENOMEM;
61 const struct platform_device_id *id_entry; 62 struct fsi_ak4642_info *pinfo = pdev->dev.platform_data;
62 struct fsi_ak4642_data *pdata;
63 63
64 id_entry = pdev->id_entry; 64 if (!pinfo) {
65 if (!id_entry) { 65 dev_err(&pdev->dev, "no info for fsi ak4642\n");
66 dev_err(&pdev->dev, "unknown fsi ak4642\n"); 66 goto out;
67 return -ENODEV;
68 } 67 }
69 68
70 pdata = (struct fsi_ak4642_data *)id_entry->driver_data; 69 fsi_snd_device = platform_device_alloc("soc-audio", pinfo->id);
71
72 fsi_snd_device = platform_device_alloc("soc-audio", pdata->id);
73 if (!fsi_snd_device) 70 if (!fsi_snd_device)
74 goto out; 71 goto out;
75 72
76 fsi_dai_link.name = pdata->name; 73 fsi_dai_link.name = pinfo->name;
77 fsi_dai_link.stream_name = pdata->name; 74 fsi_dai_link.stream_name = pinfo->name;
78 fsi_dai_link.cpu_dai_name = pdata->cpu_dai; 75 fsi_dai_link.cpu_dai_name = pinfo->cpu_dai;
79 fsi_dai_link.platform_name = pdata->platform; 76 fsi_dai_link.platform_name = pinfo->platform;
80 fsi_dai_link.codec_name = pdata->codec; 77 fsi_dai_link.codec_name = pinfo->codec;
81 fsi_soc_card.name = pdata->card; 78 fsi_soc_card.name = pinfo->card;
82 79
83 platform_set_drvdata(fsi_snd_device, &fsi_soc_card); 80 platform_set_drvdata(fsi_snd_device, &fsi_soc_card);
84 ret = platform_device_add(fsi_snd_device); 81 ret = platform_device_add(fsi_snd_device);
@@ -96,114 +93,15 @@ static int fsi_ak4642_remove(struct platform_device *pdev)
96 return 0; 93 return 0;
97} 94}
98 95
99static struct fsi_ak4642_data fsi_a_ak4642 = {
100 .name = "AK4642",
101 .card = "FSIA-AK4642",
102 .cpu_dai = "fsia-dai",
103 .codec = "ak4642-codec.0-0012",
104 .platform = "sh_fsi.0",
105 .id = FSI_PORT_A,
106};
107
108static struct fsi_ak4642_data fsi_b_ak4642 = {
109 .name = "AK4642",
110 .card = "FSIB-AK4642",
111 .cpu_dai = "fsib-dai",
112 .codec = "ak4642-codec.0-0012",
113 .platform = "sh_fsi.0",
114 .id = FSI_PORT_B,
115};
116
117static struct fsi_ak4642_data fsi_a_ak4643 = {
118 .name = "AK4643",
119 .card = "FSIA-AK4643",
120 .cpu_dai = "fsia-dai",
121 .codec = "ak4642-codec.0-0013",
122 .platform = "sh_fsi.0",
123 .id = FSI_PORT_A,
124};
125
126static struct fsi_ak4642_data fsi_b_ak4643 = {
127 .name = "AK4643",
128 .card = "FSIB-AK4643",
129 .cpu_dai = "fsib-dai",
130 .codec = "ak4642-codec.0-0013",
131 .platform = "sh_fsi.0",
132 .id = FSI_PORT_B,
133};
134
135static struct fsi_ak4642_data fsi2_a_ak4642 = {
136 .name = "AK4642",
137 .card = "FSI2A-AK4642",
138 .cpu_dai = "fsia-dai",
139 .codec = "ak4642-codec.0-0012",
140 .platform = "sh_fsi2",
141 .id = FSI_PORT_A,
142};
143
144static struct fsi_ak4642_data fsi2_b_ak4642 = {
145 .name = "AK4642",
146 .card = "FSI2B-AK4642",
147 .cpu_dai = "fsib-dai",
148 .codec = "ak4642-codec.0-0012",
149 .platform = "sh_fsi2",
150 .id = FSI_PORT_B,
151};
152
153static struct fsi_ak4642_data fsi2_a_ak4643 = {
154 .name = "AK4643",
155 .card = "FSI2A-AK4643",
156 .cpu_dai = "fsia-dai",
157 .codec = "ak4642-codec.0-0013",
158 .platform = "sh_fsi2",
159 .id = FSI_PORT_A,
160};
161
162static struct fsi_ak4642_data fsi2_b_ak4643 = {
163 .name = "AK4643",
164 .card = "FSI2B-AK4643",
165 .cpu_dai = "fsib-dai",
166 .codec = "ak4642-codec.0-0013",
167 .platform = "sh_fsi2",
168 .id = FSI_PORT_B,
169};
170
171static struct platform_device_id fsi_id_table[] = {
172 /* FSI */
173 { "sh_fsi_a_ak4642", (kernel_ulong_t)&fsi_a_ak4642 },
174 { "sh_fsi_b_ak4642", (kernel_ulong_t)&fsi_b_ak4642 },
175 { "sh_fsi_a_ak4643", (kernel_ulong_t)&fsi_a_ak4643 },
176 { "sh_fsi_b_ak4643", (kernel_ulong_t)&fsi_b_ak4643 },
177
178 /* FSI 2 */
179 { "sh_fsi2_a_ak4642", (kernel_ulong_t)&fsi2_a_ak4642 },
180 { "sh_fsi2_b_ak4642", (kernel_ulong_t)&fsi2_b_ak4642 },
181 { "sh_fsi2_a_ak4643", (kernel_ulong_t)&fsi2_a_ak4643 },
182 { "sh_fsi2_b_ak4643", (kernel_ulong_t)&fsi2_b_ak4643 },
183 {},
184};
185
186static struct platform_driver fsi_ak4642 = { 96static struct platform_driver fsi_ak4642 = {
187 .driver = { 97 .driver = {
188 .name = "fsi-ak4642-audio", 98 .name = "fsi-ak4642-audio",
189 }, 99 },
190 .probe = fsi_ak4642_probe, 100 .probe = fsi_ak4642_probe,
191 .remove = fsi_ak4642_remove, 101 .remove = fsi_ak4642_remove,
192 .id_table = fsi_id_table,
193}; 102};
194 103
195static int __init fsi_ak4642_init(void) 104module_platform_driver(fsi_ak4642);
196{
197 return platform_driver_register(&fsi_ak4642);
198}
199
200static void __exit fsi_ak4642_exit(void)
201{
202 platform_driver_unregister(&fsi_ak4642);
203}
204
205module_init(fsi_ak4642_init);
206module_exit(fsi_ak4642_exit);
207 105
208MODULE_LICENSE("GPL"); 106MODULE_LICENSE("GPL");
209MODULE_DESCRIPTION("Generic SH4 FSI-AK4642 sound card"); 107MODULE_DESCRIPTION("Generic SH4 FSI-AK4642 sound card");
diff --git a/sound/soc/sh/fsi-da7210.c b/sound/soc/sh/fsi-da7210.c
index f5586b5b0c3..1dd3354c741 100644
--- a/sound/soc/sh/fsi-da7210.c
+++ b/sound/soc/sh/fsi-da7210.c
@@ -44,6 +44,7 @@ static struct snd_soc_dai_link fsi_da7210_dai = {
44 44
45static struct snd_soc_card fsi_soc_card = { 45static struct snd_soc_card fsi_soc_card = {
46 .name = "FSI-DA7210", 46 .name = "FSI-DA7210",
47 .owner = THIS_MODULE,
47 .dai_link = &fsi_da7210_dai, 48 .dai_link = &fsi_da7210_dai,
48 .num_links = 1, 49 .num_links = 1,
49}; 50};
diff --git a/sound/soc/sh/fsi-hdmi.c b/sound/soc/sh/fsi-hdmi.c
index 3ebebe706ad..6e41908323e 100644
--- a/sound/soc/sh/fsi-hdmi.c
+++ b/sound/soc/sh/fsi-hdmi.c
@@ -39,6 +39,7 @@ static struct snd_soc_dai_link fsi_dai_link = {
39}; 39};
40 40
41static struct snd_soc_card fsi_soc_card = { 41static struct snd_soc_card fsi_soc_card = {
42 .owner = THIS_MODULE,
42 .dai_link = &fsi_dai_link, 43 .dai_link = &fsi_dai_link,
43 .num_links = 1, 44 .num_links = 1,
44}; 45};
@@ -110,18 +111,7 @@ static struct platform_driver fsi_hdmi = {
110 .id_table = fsi_id_table, 111 .id_table = fsi_id_table,
111}; 112};
112 113
113static int __init fsi_hdmi_init(void) 114module_platform_driver(fsi_hdmi);
114{
115 return platform_driver_register(&fsi_hdmi);
116}
117
118static void __exit fsi_hdmi_exit(void)
119{
120 platform_driver_unregister(&fsi_hdmi);
121}
122
123module_init(fsi_hdmi_init);
124module_exit(fsi_hdmi_exit);
125 115
126MODULE_LICENSE("GPL"); 116MODULE_LICENSE("GPL");
127MODULE_DESCRIPTION("Generic SH4 FSI-HDMI sound card"); 117MODULE_DESCRIPTION("Generic SH4 FSI-HDMI sound card");
diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c
index 3d7016e128f..db6c89a28bd 100644
--- a/sound/soc/sh/fsi.c
+++ b/sound/soc/sh/fsi.c
@@ -32,7 +32,9 @@
32#define REG_DIDT 0x0020 32#define REG_DIDT 0x0020
33#define REG_DODT 0x0024 33#define REG_DODT 0x0024
34#define REG_MUTE_ST 0x0028 34#define REG_MUTE_ST 0x0028
35#define REG_OUT_DMAC 0x002C
35#define REG_OUT_SEL 0x0030 36#define REG_OUT_SEL 0x0030
37#define REG_IN_DMAC 0x0038
36 38
37/* master register */ 39/* master register */
38#define MST_CLK_RST 0x0210 40#define MST_CLK_RST 0x0210
@@ -235,13 +237,13 @@ static void __fsi_reg_mask_set(u32 __iomem *reg, u32 mask, u32 data)
235} 237}
236 238
237#define fsi_reg_write(p, r, d)\ 239#define fsi_reg_write(p, r, d)\
238 __fsi_reg_write((u32)(p->base + REG_##r), d) 240 __fsi_reg_write((p->base + REG_##r), d)
239 241
240#define fsi_reg_read(p, r)\ 242#define fsi_reg_read(p, r)\
241 __fsi_reg_read((u32)(p->base + REG_##r)) 243 __fsi_reg_read((p->base + REG_##r))
242 244
243#define fsi_reg_mask_set(p, r, m, d)\ 245#define fsi_reg_mask_set(p, r, m, d)\
244 __fsi_reg_mask_set((u32)(p->base + REG_##r), m, d) 246 __fsi_reg_mask_set((p->base + REG_##r), m, d)
245 247
246#define fsi_master_read(p, r) _fsi_master_read(p, MST_##r) 248#define fsi_master_read(p, r) _fsi_master_read(p, MST_##r)
247#define fsi_core_read(p, r) _fsi_master_read(p, p->core->r) 249#define fsi_core_read(p, r) _fsi_master_read(p, p->core->r)
@@ -886,11 +888,11 @@ static int fsi_hw_startup(struct fsi_priv *fsi,
886 int is_play, 888 int is_play,
887 struct device *dev) 889 struct device *dev)
888{ 890{
891 struct fsi_master *master = fsi_get_master(fsi);
892 int fsi_ver = master->core->ver;
889 u32 flags = fsi_get_info_flags(fsi); 893 u32 flags = fsi_get_info_flags(fsi);
890 u32 data = 0; 894 u32 data = 0;
891 895
892 pm_runtime_get_sync(dev);
893
894 /* clock setting */ 896 /* clock setting */
895 if (fsi_is_clk_master(fsi)) 897 if (fsi_is_clk_master(fsi))
896 data = DIMD | DOMD; 898 data = DIMD | DOMD;
@@ -920,6 +922,17 @@ static int fsi_hw_startup(struct fsi_priv *fsi,
920 fsi_reg_mask_set(fsi, OUT_SEL, DMMD, DMMD); 922 fsi_reg_mask_set(fsi, OUT_SEL, DMMD, DMMD);
921 } 923 }
922 924
925 /*
926 * FIXME
927 *
928 * FSI driver assumed that data package is in-back.
929 * FSI2 chip can select it.
930 */
931 if (fsi_ver >= 2) {
932 fsi_reg_write(fsi, OUT_DMAC, (1 << 4));
933 fsi_reg_write(fsi, IN_DMAC, (1 << 4));
934 }
935
923 /* irq clear */ 936 /* irq clear */
924 fsi_irq_disable(fsi, is_play); 937 fsi_irq_disable(fsi, is_play);
925 fsi_irq_clear_status(fsi); 938 fsi_irq_clear_status(fsi);
@@ -936,8 +949,6 @@ static void fsi_hw_shutdown(struct fsi_priv *fsi,
936{ 949{
937 if (fsi_is_clk_master(fsi)) 950 if (fsi_is_clk_master(fsi))
938 fsi_set_master_clk(dev, fsi, fsi->rate, 0); 951 fsi_set_master_clk(dev, fsi, fsi->rate, 0);
939
940 pm_runtime_put_sync(dev);
941} 952}
942 953
943static int fsi_dai_startup(struct snd_pcm_substream *substream, 954static int fsi_dai_startup(struct snd_pcm_substream *substream,
@@ -1081,7 +1092,7 @@ static int fsi_dai_hw_params(struct snd_pcm_substream *substream,
1081 return ret; 1092 return ret;
1082} 1093}
1083 1094
1084static struct snd_soc_dai_ops fsi_dai_ops = { 1095static const struct snd_soc_dai_ops fsi_dai_ops = {
1085 .startup = fsi_dai_startup, 1096 .startup = fsi_dai_startup,
1086 .shutdown = fsi_dai_shutdown, 1097 .shutdown = fsi_dai_shutdown,
1087 .trigger = fsi_dai_trigger, 1098 .trigger = fsi_dai_trigger,
@@ -1453,18 +1464,7 @@ static struct platform_driver fsi_driver = {
1453 .id_table = fsi_id_table, 1464 .id_table = fsi_id_table,
1454}; 1465};
1455 1466
1456static int __init fsi_mobile_init(void) 1467module_platform_driver(fsi_driver);
1457{
1458 return platform_driver_register(&fsi_driver);
1459}
1460
1461static void __exit fsi_mobile_exit(void)
1462{
1463 platform_driver_unregister(&fsi_driver);
1464}
1465
1466module_init(fsi_mobile_init);
1467module_exit(fsi_mobile_exit);
1468 1468
1469MODULE_LICENSE("GPL"); 1469MODULE_LICENSE("GPL");
1470MODULE_DESCRIPTION("SuperH onchip FSI audio driver"); 1470MODULE_DESCRIPTION("SuperH onchip FSI audio driver");
diff --git a/sound/soc/sh/hac.c b/sound/soc/sh/hac.c
index c87e3ff28a0..3474d7befe5 100644
--- a/sound/soc/sh/hac.c
+++ b/sound/soc/sh/hac.c
@@ -266,7 +266,7 @@ static int hac_hw_params(struct snd_pcm_substream *substream,
266#define AC97_FMTS \ 266#define AC97_FMTS \
267 SNDRV_PCM_FMTBIT_S16_LE 267 SNDRV_PCM_FMTBIT_S16_LE
268 268
269static struct snd_soc_dai_ops hac_dai_ops = { 269static const struct snd_soc_dai_ops hac_dai_ops = {
270 .hw_params = hac_hw_params, 270 .hw_params = hac_hw_params,
271}; 271};
272 272
@@ -332,17 +332,7 @@ static struct platform_driver hac_pcm_driver = {
332 .remove = __devexit_p(hac_soc_platform_remove), 332 .remove = __devexit_p(hac_soc_platform_remove),
333}; 333};
334 334
335static int __init sh4_hac_pcm_init(void) 335module_platform_driver(hac_pcm_driver);
336{
337 return platform_driver_register(&hac_pcm_driver);
338}
339module_init(sh4_hac_pcm_init);
340
341static void __exit sh4_hac_pcm_exit(void)
342{
343 platform_driver_unregister(&hac_pcm_driver);
344}
345module_exit(sh4_hac_pcm_exit);
346 336
347MODULE_LICENSE("GPL"); 337MODULE_LICENSE("GPL");
348MODULE_DESCRIPTION("SuperH onchip HAC (AC97) audio driver"); 338MODULE_DESCRIPTION("SuperH onchip HAC (AC97) audio driver");
diff --git a/sound/soc/sh/migor.c b/sound/soc/sh/migor.c
index 6088a6a3238..9d9ad8d61c0 100644
--- a/sound/soc/sh/migor.c
+++ b/sound/soc/sh/migor.c
@@ -164,6 +164,7 @@ static struct snd_soc_dai_link migor_dai = {
164/* migor audio machine driver */ 164/* migor audio machine driver */
165static struct snd_soc_card snd_soc_migor = { 165static struct snd_soc_card snd_soc_migor = {
166 .name = "Migo-R", 166 .name = "Migo-R",
167 .owner = THIS_MODULE,
167 .dai_link = &migor_dai, 168 .dai_link = &migor_dai,
168 .num_links = 1, 169 .num_links = 1,
169}; 170};
diff --git a/sound/soc/sh/sh7760-ac97.c b/sound/soc/sh/sh7760-ac97.c
index c62ae689c4a..4a3568a9bf5 100644
--- a/sound/soc/sh/sh7760-ac97.c
+++ b/sound/soc/sh/sh7760-ac97.c
@@ -16,10 +16,6 @@
16 16
17#define IPSEL 0xFE400034 17#define IPSEL 0xFE400034
18 18
19/* platform specific structs can be declared here */
20extern struct snd_soc_dai_driver sh4_hac_dai[2];
21extern struct snd_soc_platform_driver sh7760_soc_platform;
22
23static struct snd_soc_dai_link sh7760_ac97_dai = { 19static struct snd_soc_dai_link sh7760_ac97_dai = {
24 .name = "AC97", 20 .name = "AC97",
25 .stream_name = "AC97 HiFi", 21 .stream_name = "AC97 HiFi",
@@ -32,6 +28,7 @@ static struct snd_soc_dai_link sh7760_ac97_dai = {
32 28
33static struct snd_soc_card sh7760_ac97_soc_machine = { 29static struct snd_soc_card sh7760_ac97_soc_machine = {
34 .name = "SH7760 AC97", 30 .name = "SH7760 AC97",
31 .owner = THIS_MODULE,
35 .dai_link = &sh7760_ac97_dai, 32 .dai_link = &sh7760_ac97_dai,
36 .num_links = 1, 33 .num_links = 1,
37}; 34};
diff --git a/sound/soc/sh/siu_dai.c b/sound/soc/sh/siu_dai.c
index edacfeb13b9..52d4c17b123 100644
--- a/sound/soc/sh/siu_dai.c
+++ b/sound/soc/sh/siu_dai.c
@@ -112,9 +112,6 @@ static void siu_dai_start(struct siu_port *port_info)
112 112
113 dev_dbg(port_info->pcm->card->dev, "%s\n", __func__); 113 dev_dbg(port_info->pcm->card->dev, "%s\n", __func__);
114 114
115 /* Turn on SIU clock */
116 pm_runtime_get_sync(info->dev);
117
118 /* Issue software reset to siu */ 115 /* Issue software reset to siu */
119 siu_write32(base + SIU_SRCTL, 0); 116 siu_write32(base + SIU_SRCTL, 0);
120 117
@@ -158,9 +155,6 @@ static void siu_dai_stop(struct siu_port *port_info)
158 155
159 /* SIU software reset */ 156 /* SIU software reset */
160 siu_write32(base + SIU_SRCTL, 0); 157 siu_write32(base + SIU_SRCTL, 0);
161
162 /* Turn off SIU clock */
163 pm_runtime_put_sync(info->dev);
164} 158}
165 159
166static void siu_dai_spbAselect(struct siu_port *port_info) 160static void siu_dai_spbAselect(struct siu_port *port_info)
@@ -707,7 +701,7 @@ epclkget:
707 return ret; 701 return ret;
708} 702}
709 703
710static struct snd_soc_dai_ops siu_dai_ops = { 704static const struct snd_soc_dai_ops siu_dai_ops = {
711 .startup = siu_dai_startup, 705 .startup = siu_dai_startup,
712 .shutdown = siu_dai_shutdown, 706 .shutdown = siu_dai_shutdown,
713 .prepare = siu_dai_prepare, 707 .prepare = siu_dai_prepare,
@@ -852,18 +846,7 @@ static struct platform_driver siu_driver = {
852 .remove = __devexit_p(siu_remove), 846 .remove = __devexit_p(siu_remove),
853}; 847};
854 848
855static int __init siu_init(void) 849module_platform_driver(siu_driver);
856{
857 return platform_driver_register(&siu_driver);
858}
859
860static void __exit siu_exit(void)
861{
862 platform_driver_unregister(&siu_driver);
863}
864
865module_init(siu_init)
866module_exit(siu_exit)
867 850
868MODULE_AUTHOR("Carlos Munoz <carlos@kenati.com>"); 851MODULE_AUTHOR("Carlos Munoz <carlos@kenati.com>");
869MODULE_DESCRIPTION("ALSA SoC SH7722 SIU driver"); 852MODULE_DESCRIPTION("ALSA SoC SH7722 SIU driver");
diff --git a/sound/soc/sh/ssi.c b/sound/soc/sh/ssi.c
index e0c621c0553..ff82b56a886 100644
--- a/sound/soc/sh/ssi.c
+++ b/sound/soc/sh/ssi.c
@@ -332,7 +332,7 @@ static int ssi_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
332 SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_U24_3LE | \ 332 SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_U24_3LE | \
333 SNDRV_PCM_FMTBIT_S32_LE | SNDRV_PCM_FMTBIT_U32_LE) 333 SNDRV_PCM_FMTBIT_S32_LE | SNDRV_PCM_FMTBIT_U32_LE)
334 334
335static struct snd_soc_dai_ops ssi_dai_ops = { 335static const struct snd_soc_dai_ops ssi_dai_ops = {
336 .startup = ssi_startup, 336 .startup = ssi_startup,
337 .shutdown = ssi_shutdown, 337 .shutdown = ssi_shutdown,
338 .trigger = ssi_trigger, 338 .trigger = ssi_trigger,
@@ -401,17 +401,7 @@ static struct platform_driver sh4_ssi_driver = {
401 .remove = __devexit_p(sh4_soc_dai_remove), 401 .remove = __devexit_p(sh4_soc_dai_remove),
402}; 402};
403 403
404static int __init snd_sh4_ssi_init(void) 404module_platform_driver(sh4_ssi_driver);
405{
406 return platform_driver_register(&sh4_ssi_driver);
407}
408module_init(snd_sh4_ssi_init);
409
410static void __exit snd_sh4_ssi_exit(void)
411{
412 platform_driver_unregister(&sh4_ssi_driver);
413}
414module_exit(snd_sh4_ssi_exit);
415 405
416MODULE_LICENSE("GPL"); 406MODULE_LICENSE("GPL");
417MODULE_DESCRIPTION("SuperH onchip SSI (I2S) audio driver"); 407MODULE_DESCRIPTION("SuperH onchip SSI (I2S) audio driver");
diff --git a/sound/soc/soc-cache.c b/sound/soc/soc-cache.c
index 9077aa4b3b4..9d56f0218f4 100644
--- a/sound/soc/soc-cache.c
+++ b/sound/soc/soc-cache.c
@@ -14,7 +14,6 @@
14#include <linux/i2c.h> 14#include <linux/i2c.h>
15#include <linux/spi/spi.h> 15#include <linux/spi/spi.h>
16#include <sound/soc.h> 16#include <sound/soc.h>
17#include <linux/lzo.h>
18#include <linux/bitmap.h> 17#include <linux/bitmap.h>
19#include <linux/rbtree.h> 18#include <linux/rbtree.h>
20#include <linux/export.h> 19#include <linux/export.h>
@@ -67,750 +66,6 @@ static unsigned int snd_soc_get_cache_val(const void *base, unsigned int idx,
67 return -1; 66 return -1;
68} 67}
69 68
70struct snd_soc_rbtree_node {
71 struct rb_node node; /* the actual rbtree node holding this block */
72 unsigned int base_reg; /* base register handled by this block */
73 unsigned int word_size; /* number of bytes needed to represent the register index */
74 void *block; /* block of adjacent registers */
75 unsigned int blklen; /* number of registers available in the block */
76} __attribute__ ((packed));
77
78struct snd_soc_rbtree_ctx {
79 struct rb_root root;
80 struct snd_soc_rbtree_node *cached_rbnode;
81};
82
83static inline void snd_soc_rbtree_get_base_top_reg(
84 struct snd_soc_rbtree_node *rbnode,
85 unsigned int *base, unsigned int *top)
86{
87 *base = rbnode->base_reg;
88 *top = rbnode->base_reg + rbnode->blklen - 1;
89}
90
91static unsigned int snd_soc_rbtree_get_register(
92 struct snd_soc_rbtree_node *rbnode, unsigned int idx)
93{
94 unsigned int val;
95
96 switch (rbnode->word_size) {
97 case 1: {
98 u8 *p = rbnode->block;
99 val = p[idx];
100 return val;
101 }
102 case 2: {
103 u16 *p = rbnode->block;
104 val = p[idx];
105 return val;
106 }
107 default:
108 BUG();
109 break;
110 }
111 return -1;
112}
113
114static void snd_soc_rbtree_set_register(struct snd_soc_rbtree_node *rbnode,
115 unsigned int idx, unsigned int val)
116{
117 switch (rbnode->word_size) {
118 case 1: {
119 u8 *p = rbnode->block;
120 p[idx] = val;
121 break;
122 }
123 case 2: {
124 u16 *p = rbnode->block;
125 p[idx] = val;
126 break;
127 }
128 default:
129 BUG();
130 break;
131 }
132}
133
134static struct snd_soc_rbtree_node *snd_soc_rbtree_lookup(
135 struct rb_root *root, unsigned int reg)
136{
137 struct rb_node *node;
138 struct snd_soc_rbtree_node *rbnode;
139 unsigned int base_reg, top_reg;
140
141 node = root->rb_node;
142 while (node) {
143 rbnode = container_of(node, struct snd_soc_rbtree_node, node);
144 snd_soc_rbtree_get_base_top_reg(rbnode, &base_reg, &top_reg);
145 if (reg >= base_reg && reg <= top_reg)
146 return rbnode;
147 else if (reg > top_reg)
148 node = node->rb_right;
149 else if (reg < base_reg)
150 node = node->rb_left;
151 }
152
153 return NULL;
154}
155
156static int snd_soc_rbtree_insert(struct rb_root *root,
157 struct snd_soc_rbtree_node *rbnode)
158{
159 struct rb_node **new, *parent;
160 struct snd_soc_rbtree_node *rbnode_tmp;
161 unsigned int base_reg_tmp, top_reg_tmp;
162 unsigned int base_reg;
163
164 parent = NULL;
165 new = &root->rb_node;
166 while (*new) {
167 rbnode_tmp = container_of(*new, struct snd_soc_rbtree_node,
168 node);
169 /* base and top registers of the current rbnode */
170 snd_soc_rbtree_get_base_top_reg(rbnode_tmp, &base_reg_tmp,
171 &top_reg_tmp);
172 /* base register of the rbnode to be added */
173 base_reg = rbnode->base_reg;
174 parent = *new;
175 /* if this register has already been inserted, just return */
176 if (base_reg >= base_reg_tmp &&
177 base_reg <= top_reg_tmp)
178 return 0;
179 else if (base_reg > top_reg_tmp)
180 new = &((*new)->rb_right);
181 else if (base_reg < base_reg_tmp)
182 new = &((*new)->rb_left);
183 }
184
185 /* insert the node into the rbtree */
186 rb_link_node(&rbnode->node, parent, new);
187 rb_insert_color(&rbnode->node, root);
188
189 return 1;
190}
191
192static int snd_soc_rbtree_cache_sync(struct snd_soc_codec *codec)
193{
194 struct snd_soc_rbtree_ctx *rbtree_ctx;
195 struct rb_node *node;
196 struct snd_soc_rbtree_node *rbnode;
197 unsigned int regtmp;
198 unsigned int val, def;
199 int ret;
200 int i;
201
202 rbtree_ctx = codec->reg_cache;
203 for (node = rb_first(&rbtree_ctx->root); node; node = rb_next(node)) {
204 rbnode = rb_entry(node, struct snd_soc_rbtree_node, node);
205 for (i = 0; i < rbnode->blklen; ++i) {
206 regtmp = rbnode->base_reg + i;
207 val = snd_soc_rbtree_get_register(rbnode, i);
208 def = snd_soc_get_cache_val(codec->reg_def_copy, i,
209 rbnode->word_size);
210 if (val == def)
211 continue;
212
213 WARN_ON(!snd_soc_codec_writable_register(codec, regtmp));
214
215 codec->cache_bypass = 1;
216 ret = snd_soc_write(codec, regtmp, val);
217 codec->cache_bypass = 0;
218 if (ret)
219 return ret;
220 dev_dbg(codec->dev, "Synced register %#x, value = %#x\n",
221 regtmp, val);
222 }
223 }
224
225 return 0;
226}
227
228static int snd_soc_rbtree_insert_to_block(struct snd_soc_rbtree_node *rbnode,
229 unsigned int pos, unsigned int reg,
230 unsigned int value)
231{
232 u8 *blk;
233
234 blk = krealloc(rbnode->block,
235 (rbnode->blklen + 1) * rbnode->word_size, GFP_KERNEL);
236 if (!blk)
237 return -ENOMEM;
238
239 /* insert the register value in the correct place in the rbnode block */
240 memmove(blk + (pos + 1) * rbnode->word_size,
241 blk + pos * rbnode->word_size,
242 (rbnode->blklen - pos) * rbnode->word_size);
243
244 /* update the rbnode block, its size and the base register */
245 rbnode->block = blk;
246 rbnode->blklen++;
247 if (!pos)
248 rbnode->base_reg = reg;
249
250 snd_soc_rbtree_set_register(rbnode, pos, value);
251 return 0;
252}
253
254static int snd_soc_rbtree_cache_write(struct snd_soc_codec *codec,
255 unsigned int reg, unsigned int value)
256{
257 struct snd_soc_rbtree_ctx *rbtree_ctx;
258 struct snd_soc_rbtree_node *rbnode, *rbnode_tmp;
259 struct rb_node *node;
260 unsigned int val;
261 unsigned int reg_tmp;
262 unsigned int base_reg, top_reg;
263 unsigned int pos;
264 int i;
265 int ret;
266
267 rbtree_ctx = codec->reg_cache;
268 /* look up the required register in the cached rbnode */
269 rbnode = rbtree_ctx->cached_rbnode;
270 if (rbnode) {
271 snd_soc_rbtree_get_base_top_reg(rbnode, &base_reg, &top_reg);
272 if (reg >= base_reg && reg <= top_reg) {
273 reg_tmp = reg - base_reg;
274 val = snd_soc_rbtree_get_register(rbnode, reg_tmp);
275 if (val == value)
276 return 0;
277 snd_soc_rbtree_set_register(rbnode, reg_tmp, value);
278 return 0;
279 }
280 }
281 /* if we can't locate it in the cached rbnode we'll have
282 * to traverse the rbtree looking for it.
283 */
284 rbnode = snd_soc_rbtree_lookup(&rbtree_ctx->root, reg);
285 if (rbnode) {
286 reg_tmp = reg - rbnode->base_reg;
287 val = snd_soc_rbtree_get_register(rbnode, reg_tmp);
288 if (val == value)
289 return 0;
290 snd_soc_rbtree_set_register(rbnode, reg_tmp, value);
291 rbtree_ctx->cached_rbnode = rbnode;
292 } else {
293 /* bail out early, no need to create the rbnode yet */
294 if (!value)
295 return 0;
296 /* look for an adjacent register to the one we are about to add */
297 for (node = rb_first(&rbtree_ctx->root); node;
298 node = rb_next(node)) {
299 rbnode_tmp = rb_entry(node, struct snd_soc_rbtree_node, node);
300 for (i = 0; i < rbnode_tmp->blklen; ++i) {
301 reg_tmp = rbnode_tmp->base_reg + i;
302 if (abs(reg_tmp - reg) != 1)
303 continue;
304 /* decide where in the block to place our register */
305 if (reg_tmp + 1 == reg)
306 pos = i + 1;
307 else
308 pos = i;
309 ret = snd_soc_rbtree_insert_to_block(rbnode_tmp, pos,
310 reg, value);
311 if (ret)
312 return ret;
313 rbtree_ctx->cached_rbnode = rbnode_tmp;
314 return 0;
315 }
316 }
317 /* we did not manage to find a place to insert it in an existing
318 * block so create a new rbnode with a single register in its block.
319 * This block will get populated further if any other adjacent
320 * registers get modified in the future.
321 */
322 rbnode = kzalloc(sizeof *rbnode, GFP_KERNEL);
323 if (!rbnode)
324 return -ENOMEM;
325 rbnode->blklen = 1;
326 rbnode->base_reg = reg;
327 rbnode->word_size = codec->driver->reg_word_size;
328 rbnode->block = kmalloc(rbnode->blklen * rbnode->word_size,
329 GFP_KERNEL);
330 if (!rbnode->block) {
331 kfree(rbnode);
332 return -ENOMEM;
333 }
334 snd_soc_rbtree_set_register(rbnode, 0, value);
335 snd_soc_rbtree_insert(&rbtree_ctx->root, rbnode);
336 rbtree_ctx->cached_rbnode = rbnode;
337 }
338
339 return 0;
340}
341
342static int snd_soc_rbtree_cache_read(struct snd_soc_codec *codec,
343 unsigned int reg, unsigned int *value)
344{
345 struct snd_soc_rbtree_ctx *rbtree_ctx;
346 struct snd_soc_rbtree_node *rbnode;
347 unsigned int base_reg, top_reg;
348 unsigned int reg_tmp;
349
350 rbtree_ctx = codec->reg_cache;
351 /* look up the required register in the cached rbnode */
352 rbnode = rbtree_ctx->cached_rbnode;
353 if (rbnode) {
354 snd_soc_rbtree_get_base_top_reg(rbnode, &base_reg, &top_reg);
355 if (reg >= base_reg && reg <= top_reg) {
356 reg_tmp = reg - base_reg;
357 *value = snd_soc_rbtree_get_register(rbnode, reg_tmp);
358 return 0;
359 }
360 }
361 /* if we can't locate it in the cached rbnode we'll have
362 * to traverse the rbtree looking for it.
363 */
364 rbnode = snd_soc_rbtree_lookup(&rbtree_ctx->root, reg);
365 if (rbnode) {
366 reg_tmp = reg - rbnode->base_reg;
367 *value = snd_soc_rbtree_get_register(rbnode, reg_tmp);
368 rbtree_ctx->cached_rbnode = rbnode;
369 } else {
370 /* uninitialized registers default to 0 */
371 *value = 0;
372 }
373
374 return 0;
375}
376
377static int snd_soc_rbtree_cache_exit(struct snd_soc_codec *codec)
378{
379 struct rb_node *next;
380 struct snd_soc_rbtree_ctx *rbtree_ctx;
381 struct snd_soc_rbtree_node *rbtree_node;
382
383 /* if we've already been called then just return */
384 rbtree_ctx = codec->reg_cache;
385 if (!rbtree_ctx)
386 return 0;
387
388 /* free up the rbtree */
389 next = rb_first(&rbtree_ctx->root);
390 while (next) {
391 rbtree_node = rb_entry(next, struct snd_soc_rbtree_node, node);
392 next = rb_next(&rbtree_node->node);
393 rb_erase(&rbtree_node->node, &rbtree_ctx->root);
394 kfree(rbtree_node->block);
395 kfree(rbtree_node);
396 }
397
398 /* release the resources */
399 kfree(codec->reg_cache);
400 codec->reg_cache = NULL;
401
402 return 0;
403}
404
405static int snd_soc_rbtree_cache_init(struct snd_soc_codec *codec)
406{
407 struct snd_soc_rbtree_ctx *rbtree_ctx;
408 unsigned int word_size;
409 unsigned int val;
410 int i;
411 int ret;
412
413 codec->reg_cache = kmalloc(sizeof *rbtree_ctx, GFP_KERNEL);
414 if (!codec->reg_cache)
415 return -ENOMEM;
416
417 rbtree_ctx = codec->reg_cache;
418 rbtree_ctx->root = RB_ROOT;
419 rbtree_ctx->cached_rbnode = NULL;
420
421 if (!codec->reg_def_copy)
422 return 0;
423
424 word_size = codec->driver->reg_word_size;
425 for (i = 0; i < codec->driver->reg_cache_size; ++i) {
426 val = snd_soc_get_cache_val(codec->reg_def_copy, i,
427 word_size);
428 if (!val)
429 continue;
430 ret = snd_soc_rbtree_cache_write(codec, i, val);
431 if (ret)
432 goto err;
433 }
434
435 return 0;
436
437err:
438 snd_soc_cache_exit(codec);
439 return ret;
440}
441
442#ifdef CONFIG_SND_SOC_CACHE_LZO
443struct snd_soc_lzo_ctx {
444 void *wmem;
445 void *dst;
446 const void *src;
447 size_t src_len;
448 size_t dst_len;
449 size_t decompressed_size;
450 unsigned long *sync_bmp;
451 int sync_bmp_nbits;
452};
453
454#define LZO_BLOCK_NUM 8
455static int snd_soc_lzo_block_count(void)
456{
457 return LZO_BLOCK_NUM;
458}
459
460static int snd_soc_lzo_prepare(struct snd_soc_lzo_ctx *lzo_ctx)
461{
462 lzo_ctx->wmem = kmalloc(LZO1X_MEM_COMPRESS, GFP_KERNEL);
463 if (!lzo_ctx->wmem)
464 return -ENOMEM;
465 return 0;
466}
467
468static int snd_soc_lzo_compress(struct snd_soc_lzo_ctx *lzo_ctx)
469{
470 size_t compress_size;
471 int ret;
472
473 ret = lzo1x_1_compress(lzo_ctx->src, lzo_ctx->src_len,
474 lzo_ctx->dst, &compress_size, lzo_ctx->wmem);
475 if (ret != LZO_E_OK || compress_size > lzo_ctx->dst_len)
476 return -EINVAL;
477 lzo_ctx->dst_len = compress_size;
478 return 0;
479}
480
481static int snd_soc_lzo_decompress(struct snd_soc_lzo_ctx *lzo_ctx)
482{
483 size_t dst_len;
484 int ret;
485
486 dst_len = lzo_ctx->dst_len;
487 ret = lzo1x_decompress_safe(lzo_ctx->src, lzo_ctx->src_len,
488 lzo_ctx->dst, &dst_len);
489 if (ret != LZO_E_OK || dst_len != lzo_ctx->dst_len)
490 return -EINVAL;
491 return 0;
492}
493
494static int snd_soc_lzo_compress_cache_block(struct snd_soc_codec *codec,
495 struct snd_soc_lzo_ctx *lzo_ctx)
496{
497 int ret;
498
499 lzo_ctx->dst_len = lzo1x_worst_compress(PAGE_SIZE);
500 lzo_ctx->dst = kmalloc(lzo_ctx->dst_len, GFP_KERNEL);
501 if (!lzo_ctx->dst) {
502 lzo_ctx->dst_len = 0;
503 return -ENOMEM;
504 }
505
506 ret = snd_soc_lzo_compress(lzo_ctx);
507 if (ret < 0)
508 return ret;
509 return 0;
510}
511
512static int snd_soc_lzo_decompress_cache_block(struct snd_soc_codec *codec,
513 struct snd_soc_lzo_ctx *lzo_ctx)
514{
515 int ret;
516
517 lzo_ctx->dst_len = lzo_ctx->decompressed_size;
518 lzo_ctx->dst = kmalloc(lzo_ctx->dst_len, GFP_KERNEL);
519 if (!lzo_ctx->dst) {
520 lzo_ctx->dst_len = 0;
521 return -ENOMEM;
522 }
523
524 ret = snd_soc_lzo_decompress(lzo_ctx);
525 if (ret < 0)
526 return ret;
527 return 0;
528}
529
530static inline int snd_soc_lzo_get_blkindex(struct snd_soc_codec *codec,
531 unsigned int reg)
532{
533 const struct snd_soc_codec_driver *codec_drv;
534
535 codec_drv = codec->driver;
536 return (reg * codec_drv->reg_word_size) /
537 DIV_ROUND_UP(codec->reg_size, snd_soc_lzo_block_count());
538}
539
540static inline int snd_soc_lzo_get_blkpos(struct snd_soc_codec *codec,
541 unsigned int reg)
542{
543 const struct snd_soc_codec_driver *codec_drv;
544
545 codec_drv = codec->driver;
546 return reg % (DIV_ROUND_UP(codec->reg_size, snd_soc_lzo_block_count()) /
547 codec_drv->reg_word_size);
548}
549
550static inline int snd_soc_lzo_get_blksize(struct snd_soc_codec *codec)
551{
552 return DIV_ROUND_UP(codec->reg_size, snd_soc_lzo_block_count());
553}
554
555static int snd_soc_lzo_cache_sync(struct snd_soc_codec *codec)
556{
557 struct snd_soc_lzo_ctx **lzo_blocks;
558 unsigned int val;
559 int i;
560 int ret;
561
562 lzo_blocks = codec->reg_cache;
563 for_each_set_bit(i, lzo_blocks[0]->sync_bmp, lzo_blocks[0]->sync_bmp_nbits) {
564 WARN_ON(!snd_soc_codec_writable_register(codec, i));
565 ret = snd_soc_cache_read(codec, i, &val);
566 if (ret)
567 return ret;
568 codec->cache_bypass = 1;
569 ret = snd_soc_write(codec, i, val);
570 codec->cache_bypass = 0;
571 if (ret)
572 return ret;
573 dev_dbg(codec->dev, "Synced register %#x, value = %#x\n",
574 i, val);
575 }
576
577 return 0;
578}
579
580static int snd_soc_lzo_cache_write(struct snd_soc_codec *codec,
581 unsigned int reg, unsigned int value)
582{
583 struct snd_soc_lzo_ctx *lzo_block, **lzo_blocks;
584 int ret, blkindex, blkpos;
585 size_t blksize, tmp_dst_len;
586 void *tmp_dst;
587
588 /* index of the compressed lzo block */
589 blkindex = snd_soc_lzo_get_blkindex(codec, reg);
590 /* register index within the decompressed block */
591 blkpos = snd_soc_lzo_get_blkpos(codec, reg);
592 /* size of the compressed block */
593 blksize = snd_soc_lzo_get_blksize(codec);
594 lzo_blocks = codec->reg_cache;
595 lzo_block = lzo_blocks[blkindex];
596
597 /* save the pointer and length of the compressed block */
598 tmp_dst = lzo_block->dst;
599 tmp_dst_len = lzo_block->dst_len;
600
601 /* prepare the source to be the compressed block */
602 lzo_block->src = lzo_block->dst;
603 lzo_block->src_len = lzo_block->dst_len;
604
605 /* decompress the block */
606 ret = snd_soc_lzo_decompress_cache_block(codec, lzo_block);
607 if (ret < 0) {
608 kfree(lzo_block->dst);
609 goto out;
610 }
611
612 /* write the new value to the cache */
613 if (snd_soc_set_cache_val(lzo_block->dst, blkpos, value,
614 codec->driver->reg_word_size)) {
615 kfree(lzo_block->dst);
616 goto out;
617 }
618
619 /* prepare the source to be the decompressed block */
620 lzo_block->src = lzo_block->dst;
621 lzo_block->src_len = lzo_block->dst_len;
622
623 /* compress the block */
624 ret = snd_soc_lzo_compress_cache_block(codec, lzo_block);
625 if (ret < 0) {
626 kfree(lzo_block->dst);
627 kfree(lzo_block->src);
628 goto out;
629 }
630
631 /* set the bit so we know we have to sync this register */
632 set_bit(reg, lzo_block->sync_bmp);
633 kfree(tmp_dst);
634 kfree(lzo_block->src);
635 return 0;
636out:
637 lzo_block->dst = tmp_dst;
638 lzo_block->dst_len = tmp_dst_len;
639 return ret;
640}
641
642static int snd_soc_lzo_cache_read(struct snd_soc_codec *codec,
643 unsigned int reg, unsigned int *value)
644{
645 struct snd_soc_lzo_ctx *lzo_block, **lzo_blocks;
646 int ret, blkindex, blkpos;
647 size_t blksize, tmp_dst_len;
648 void *tmp_dst;
649
650 *value = 0;
651 /* index of the compressed lzo block */
652 blkindex = snd_soc_lzo_get_blkindex(codec, reg);
653 /* register index within the decompressed block */
654 blkpos = snd_soc_lzo_get_blkpos(codec, reg);
655 /* size of the compressed block */
656 blksize = snd_soc_lzo_get_blksize(codec);
657 lzo_blocks = codec->reg_cache;
658 lzo_block = lzo_blocks[blkindex];
659
660 /* save the pointer and length of the compressed block */
661 tmp_dst = lzo_block->dst;
662 tmp_dst_len = lzo_block->dst_len;
663
664 /* prepare the source to be the compressed block */
665 lzo_block->src = lzo_block->dst;
666 lzo_block->src_len = lzo_block->dst_len;
667
668 /* decompress the block */
669 ret = snd_soc_lzo_decompress_cache_block(codec, lzo_block);
670 if (ret >= 0)
671 /* fetch the value from the cache */
672 *value = snd_soc_get_cache_val(lzo_block->dst, blkpos,
673 codec->driver->reg_word_size);
674
675 kfree(lzo_block->dst);
676 /* restore the pointer and length of the compressed block */
677 lzo_block->dst = tmp_dst;
678 lzo_block->dst_len = tmp_dst_len;
679 return 0;
680}
681
682static int snd_soc_lzo_cache_exit(struct snd_soc_codec *codec)
683{
684 struct snd_soc_lzo_ctx **lzo_blocks;
685 int i, blkcount;
686
687 lzo_blocks = codec->reg_cache;
688 if (!lzo_blocks)
689 return 0;
690
691 blkcount = snd_soc_lzo_block_count();
692 /*
693 * the pointer to the bitmap used for syncing the cache
694 * is shared amongst all lzo_blocks. Ensure it is freed
695 * only once.
696 */
697 if (lzo_blocks[0])
698 kfree(lzo_blocks[0]->sync_bmp);
699 for (i = 0; i < blkcount; ++i) {
700 if (lzo_blocks[i]) {
701 kfree(lzo_blocks[i]->wmem);
702 kfree(lzo_blocks[i]->dst);
703 }
704 /* each lzo_block is a pointer returned by kmalloc or NULL */
705 kfree(lzo_blocks[i]);
706 }
707 kfree(lzo_blocks);
708 codec->reg_cache = NULL;
709 return 0;
710}
711
712static int snd_soc_lzo_cache_init(struct snd_soc_codec *codec)
713{
714 struct snd_soc_lzo_ctx **lzo_blocks;
715 size_t bmp_size;
716 const struct snd_soc_codec_driver *codec_drv;
717 int ret, tofree, i, blksize, blkcount;
718 const char *p, *end;
719 unsigned long *sync_bmp;
720
721 ret = 0;
722 codec_drv = codec->driver;
723
724 /*
725 * If we have not been given a default register cache
726 * then allocate a dummy zero-ed out region, compress it
727 * and remember to free it afterwards.
728 */
729 tofree = 0;
730 if (!codec->reg_def_copy)
731 tofree = 1;
732
733 if (!codec->reg_def_copy) {
734 codec->reg_def_copy = kzalloc(codec->reg_size, GFP_KERNEL);
735 if (!codec->reg_def_copy)
736 return -ENOMEM;
737 }
738
739 blkcount = snd_soc_lzo_block_count();
740 codec->reg_cache = kzalloc(blkcount * sizeof *lzo_blocks,
741 GFP_KERNEL);
742 if (!codec->reg_cache) {
743 ret = -ENOMEM;
744 goto err_tofree;
745 }
746 lzo_blocks = codec->reg_cache;
747
748 /*
749 * allocate a bitmap to be used when syncing the cache with
750 * the hardware. Each time a register is modified, the corresponding
751 * bit is set in the bitmap, so we know that we have to sync
752 * that register.
753 */
754 bmp_size = codec_drv->reg_cache_size;
755 sync_bmp = kmalloc(BITS_TO_LONGS(bmp_size) * sizeof(long),
756 GFP_KERNEL);
757 if (!sync_bmp) {
758 ret = -ENOMEM;
759 goto err;
760 }
761 bitmap_zero(sync_bmp, bmp_size);
762
763 /* allocate the lzo blocks and initialize them */
764 for (i = 0; i < blkcount; ++i) {
765 lzo_blocks[i] = kzalloc(sizeof **lzo_blocks,
766 GFP_KERNEL);
767 if (!lzo_blocks[i]) {
768 kfree(sync_bmp);
769 ret = -ENOMEM;
770 goto err;
771 }
772 lzo_blocks[i]->sync_bmp = sync_bmp;
773 lzo_blocks[i]->sync_bmp_nbits = bmp_size;
774 /* alloc the working space for the compressed block */
775 ret = snd_soc_lzo_prepare(lzo_blocks[i]);
776 if (ret < 0)
777 goto err;
778 }
779
780 blksize = snd_soc_lzo_get_blksize(codec);
781 p = codec->reg_def_copy;
782 end = codec->reg_def_copy + codec->reg_size;
783 /* compress the register map and fill the lzo blocks */
784 for (i = 0; i < blkcount; ++i, p += blksize) {
785 lzo_blocks[i]->src = p;
786 if (p + blksize > end)
787 lzo_blocks[i]->src_len = end - p;
788 else
789 lzo_blocks[i]->src_len = blksize;
790 ret = snd_soc_lzo_compress_cache_block(codec,
791 lzo_blocks[i]);
792 if (ret < 0)
793 goto err;
794 lzo_blocks[i]->decompressed_size =
795 lzo_blocks[i]->src_len;
796 }
797
798 if (tofree) {
799 kfree(codec->reg_def_copy);
800 codec->reg_def_copy = NULL;
801 }
802 return 0;
803err:
804 snd_soc_cache_exit(codec);
805err_tofree:
806 if (tofree) {
807 kfree(codec->reg_def_copy);
808 codec->reg_def_copy = NULL;
809 }
810 return ret;
811}
812#endif
813
814static int snd_soc_flat_cache_sync(struct snd_soc_codec *codec) 69static int snd_soc_flat_cache_sync(struct snd_soc_codec *codec)
815{ 70{
816 int i; 71 int i;
@@ -889,26 +144,6 @@ static const struct snd_soc_cache_ops cache_types[] = {
889 .write = snd_soc_flat_cache_write, 144 .write = snd_soc_flat_cache_write,
890 .sync = snd_soc_flat_cache_sync 145 .sync = snd_soc_flat_cache_sync
891 }, 146 },
892#ifdef CONFIG_SND_SOC_CACHE_LZO
893 {
894 .id = SND_SOC_LZO_COMPRESSION,
895 .name = "LZO",
896 .init = snd_soc_lzo_cache_init,
897 .exit = snd_soc_lzo_cache_exit,
898 .read = snd_soc_lzo_cache_read,
899 .write = snd_soc_lzo_cache_write,
900 .sync = snd_soc_lzo_cache_sync
901 },
902#endif
903 {
904 .id = SND_SOC_RBTREE_COMPRESSION,
905 .name = "rbtree",
906 .init = snd_soc_rbtree_cache_init,
907 .exit = snd_soc_rbtree_cache_exit,
908 .read = snd_soc_rbtree_cache_read,
909 .write = snd_soc_rbtree_cache_write,
910 .sync = snd_soc_rbtree_cache_sync
911 }
912}; 147};
913 148
914int snd_soc_cache_init(struct snd_soc_codec *codec) 149int snd_soc_cache_init(struct snd_soc_codec *codec)
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index a25fa63ce9a..3986520b467 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -32,6 +32,7 @@
32#include <linux/platform_device.h> 32#include <linux/platform_device.h>
33#include <linux/ctype.h> 33#include <linux/ctype.h>
34#include <linux/slab.h> 34#include <linux/slab.h>
35#include <linux/of.h>
35#include <sound/ac97_codec.h> 36#include <sound/ac97_codec.h>
36#include <sound/core.h> 37#include <sound/core.h>
37#include <sound/jack.h> 38#include <sound/jack.h>
@@ -58,8 +59,6 @@ static LIST_HEAD(dai_list);
58static LIST_HEAD(platform_list); 59static LIST_HEAD(platform_list);
59static LIST_HEAD(codec_list); 60static LIST_HEAD(codec_list);
60 61
61int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num);
62
63/* 62/*
64 * This is a timeout to do a DAPM powerdown after a stream is closed(). 63 * This is a timeout to do a DAPM powerdown after a stream is closed().
65 * It can be used to eliminate pops between different playback streams, e.g. 64 * It can be used to eliminate pops between different playback streams, e.g.
@@ -170,8 +169,7 @@ static ssize_t soc_codec_reg_show(struct snd_soc_codec *codec, char *buf,
170static ssize_t codec_reg_show(struct device *dev, 169static ssize_t codec_reg_show(struct device *dev,
171 struct device_attribute *attr, char *buf) 170 struct device_attribute *attr, char *buf)
172{ 171{
173 struct snd_soc_pcm_runtime *rtd = 172 struct snd_soc_pcm_runtime *rtd = dev_get_drvdata(dev);
174 container_of(dev, struct snd_soc_pcm_runtime, dev);
175 173
176 return soc_codec_reg_show(rtd->codec, buf, PAGE_SIZE, 0); 174 return soc_codec_reg_show(rtd->codec, buf, PAGE_SIZE, 0);
177} 175}
@@ -181,8 +179,7 @@ static DEVICE_ATTR(codec_reg, 0444, codec_reg_show, NULL);
181static ssize_t pmdown_time_show(struct device *dev, 179static ssize_t pmdown_time_show(struct device *dev,
182 struct device_attribute *attr, char *buf) 180 struct device_attribute *attr, char *buf)
183{ 181{
184 struct snd_soc_pcm_runtime *rtd = 182 struct snd_soc_pcm_runtime *rtd = dev_get_drvdata(dev);
185 container_of(dev, struct snd_soc_pcm_runtime, dev);
186 183
187 return sprintf(buf, "%ld\n", rtd->pmdown_time); 184 return sprintf(buf, "%ld\n", rtd->pmdown_time);
188} 185}
@@ -191,8 +188,7 @@ static ssize_t pmdown_time_set(struct device *dev,
191 struct device_attribute *attr, 188 struct device_attribute *attr,
192 const char *buf, size_t count) 189 const char *buf, size_t count)
193{ 190{
194 struct snd_soc_pcm_runtime *rtd = 191 struct snd_soc_pcm_runtime *rtd = dev_get_drvdata(dev);
195 container_of(dev, struct snd_soc_pcm_runtime, dev);
196 int ret; 192 int ret;
197 193
198 ret = strict_strtol(buf, 10, &rtd->pmdown_time); 194 ret = strict_strtol(buf, 10, &rtd->pmdown_time);
@@ -412,7 +408,7 @@ static void soc_init_card_debugfs(struct snd_soc_card *card)
412 snd_soc_debugfs_root); 408 snd_soc_debugfs_root);
413 if (!card->debugfs_card_root) { 409 if (!card->debugfs_card_root) {
414 dev_warn(card->dev, 410 dev_warn(card->dev,
415 "ASoC: Failed to create codec debugfs directory\n"); 411 "ASoC: Failed to create card debugfs directory\n");
416 return; 412 return;
417 } 413 }
418 414
@@ -572,7 +568,7 @@ int snd_soc_suspend(struct device *dev)
572 switch (codec->dapm.bias_level) { 568 switch (codec->dapm.bias_level) {
573 case SND_SOC_BIAS_STANDBY: 569 case SND_SOC_BIAS_STANDBY:
574 case SND_SOC_BIAS_OFF: 570 case SND_SOC_BIAS_OFF:
575 codec->driver->suspend(codec, PMSG_SUSPEND); 571 codec->driver->suspend(codec);
576 codec->suspended = 1; 572 codec->suspended = 1;
577 codec->cache_sync = 1; 573 codec->cache_sync = 1;
578 break; 574 break;
@@ -741,7 +737,7 @@ EXPORT_SYMBOL_GPL(snd_soc_resume);
741#define snd_soc_resume NULL 737#define snd_soc_resume NULL
742#endif 738#endif
743 739
744static struct snd_soc_dai_ops null_dai_ops = { 740static const struct snd_soc_dai_ops null_dai_ops = {
745}; 741};
746 742
747static int soc_bind_dai_link(struct snd_soc_card *card, int num) 743static int soc_bind_dai_link(struct snd_soc_card *card, int num)
@@ -763,10 +759,16 @@ static int soc_bind_dai_link(struct snd_soc_card *card, int num)
763 } 759 }
764 /* no, then find CPU DAI from registered DAIs*/ 760 /* no, then find CPU DAI from registered DAIs*/
765 list_for_each_entry(cpu_dai, &dai_list, list) { 761 list_for_each_entry(cpu_dai, &dai_list, list) {
766 if (!strcmp(cpu_dai->name, dai_link->cpu_dai_name)) { 762 if (dai_link->cpu_dai_of_node) {
767 rtd->cpu_dai = cpu_dai; 763 if (cpu_dai->dev->of_node != dai_link->cpu_dai_of_node)
768 goto find_codec; 764 continue;
765 } else {
766 if (strcmp(cpu_dai->name, dai_link->cpu_dai_name))
767 continue;
769 } 768 }
769
770 rtd->cpu_dai = cpu_dai;
771 goto find_codec;
770 } 772 }
771 dev_dbg(card->dev, "CPU DAI %s not registered\n", 773 dev_dbg(card->dev, "CPU DAI %s not registered\n",
772 dai_link->cpu_dai_name); 774 dai_link->cpu_dai_name);
@@ -779,22 +781,33 @@ find_codec:
779 781
780 /* no, then find CODEC from registered CODECs*/ 782 /* no, then find CODEC from registered CODECs*/
781 list_for_each_entry(codec, &codec_list, list) { 783 list_for_each_entry(codec, &codec_list, list) {
782 if (!strcmp(codec->name, dai_link->codec_name)) { 784 if (dai_link->codec_of_node) {
783 rtd->codec = codec; 785 if (codec->dev->of_node != dai_link->codec_of_node)
784 786 continue;
785 /* CODEC found, so find CODEC DAI from registered DAIs from this CODEC*/ 787 } else {
786 list_for_each_entry(codec_dai, &dai_list, list) { 788 if (strcmp(codec->name, dai_link->codec_name))
787 if (codec->dev == codec_dai->dev && 789 continue;
788 !strcmp(codec_dai->name, dai_link->codec_dai_name)) { 790 }
789 rtd->codec_dai = codec_dai; 791
790 goto find_platform; 792 rtd->codec = codec;
791 }
792 }
793 dev_dbg(card->dev, "CODEC DAI %s not registered\n",
794 dai_link->codec_dai_name);
795 793
796 goto find_platform; 794 /*
795 * CODEC found, so find CODEC DAI from registered DAIs from
796 * this CODEC
797 */
798 list_for_each_entry(codec_dai, &dai_list, list) {
799 if (codec->dev == codec_dai->dev &&
800 !strcmp(codec_dai->name,
801 dai_link->codec_dai_name)) {
802
803 rtd->codec_dai = codec_dai;
804 goto find_platform;
805 }
797 } 806 }
807 dev_dbg(card->dev, "CODEC DAI %s not registered\n",
808 dai_link->codec_dai_name);
809
810 goto find_platform;
798 } 811 }
799 dev_dbg(card->dev, "CODEC %s not registered\n", 812 dev_dbg(card->dev, "CODEC %s not registered\n",
800 dai_link->codec_name); 813 dai_link->codec_name);
@@ -806,15 +819,22 @@ find_platform:
806 819
807 /* if there's no platform we match on the empty platform */ 820 /* if there's no platform we match on the empty platform */
808 platform_name = dai_link->platform_name; 821 platform_name = dai_link->platform_name;
809 if (!platform_name) 822 if (!platform_name && !dai_link->platform_of_node)
810 platform_name = "snd-soc-dummy"; 823 platform_name = "snd-soc-dummy";
811 824
812 /* no, then find one from the set of registered platforms */ 825 /* no, then find one from the set of registered platforms */
813 list_for_each_entry(platform, &platform_list, list) { 826 list_for_each_entry(platform, &platform_list, list) {
814 if (!strcmp(platform->name, platform_name)) { 827 if (dai_link->platform_of_node) {
815 rtd->platform = platform; 828 if (platform->dev->of_node !=
816 goto out; 829 dai_link->platform_of_node)
830 continue;
831 } else {
832 if (strcmp(platform->name, platform_name))
833 continue;
817 } 834 }
835
836 rtd->platform = platform;
837 goto out;
818 } 838 }
819 839
820 dev_dbg(card->dev, "platform %s not registered\n", 840 dev_dbg(card->dev, "platform %s not registered\n",
@@ -861,9 +881,9 @@ static void soc_remove_dai_link(struct snd_soc_card *card, int num, int order)
861 881
862 /* unregister the rtd device */ 882 /* unregister the rtd device */
863 if (rtd->dev_registered) { 883 if (rtd->dev_registered) {
864 device_remove_file(&rtd->dev, &dev_attr_pmdown_time); 884 device_remove_file(rtd->dev, &dev_attr_pmdown_time);
865 device_remove_file(&rtd->dev, &dev_attr_codec_reg); 885 device_remove_file(rtd->dev, &dev_attr_codec_reg);
866 device_unregister(&rtd->dev); 886 device_unregister(rtd->dev);
867 rtd->dev_registered = 0; 887 rtd->dev_registered = 0;
868 } 888 }
869 889
@@ -1038,7 +1058,10 @@ err_probe:
1038 return ret; 1058 return ret;
1039} 1059}
1040 1060
1041static void rtd_release(struct device *dev) {} 1061static void rtd_release(struct device *dev)
1062{
1063 kfree(dev);
1064}
1042 1065
1043static int soc_post_component_init(struct snd_soc_card *card, 1066static int soc_post_component_init(struct snd_soc_card *card,
1044 struct snd_soc_codec *codec, 1067 struct snd_soc_codec *codec,
@@ -1081,11 +1104,17 @@ static int soc_post_component_init(struct snd_soc_card *card,
1081 1104
1082 /* register the rtd device */ 1105 /* register the rtd device */
1083 rtd->codec = codec; 1106 rtd->codec = codec;
1084 rtd->dev.parent = card->dev; 1107
1085 rtd->dev.release = rtd_release; 1108 rtd->dev = kzalloc(sizeof(struct device), GFP_KERNEL);
1086 rtd->dev.init_name = name; 1109 if (!rtd->dev)
1110 return -ENOMEM;
1111 device_initialize(rtd->dev);
1112 rtd->dev->parent = card->dev;
1113 rtd->dev->release = rtd_release;
1114 rtd->dev->init_name = name;
1115 dev_set_drvdata(rtd->dev, rtd);
1087 mutex_init(&rtd->pcm_mutex); 1116 mutex_init(&rtd->pcm_mutex);
1088 ret = device_register(&rtd->dev); 1117 ret = device_add(rtd->dev);
1089 if (ret < 0) { 1118 if (ret < 0) {
1090 dev_err(card->dev, 1119 dev_err(card->dev,
1091 "asoc: failed to register runtime device: %d\n", ret); 1120 "asoc: failed to register runtime device: %d\n", ret);
@@ -1094,14 +1123,14 @@ static int soc_post_component_init(struct snd_soc_card *card,
1094 rtd->dev_registered = 1; 1123 rtd->dev_registered = 1;
1095 1124
1096 /* add DAPM sysfs entries for this codec */ 1125 /* add DAPM sysfs entries for this codec */
1097 ret = snd_soc_dapm_sys_add(&rtd->dev); 1126 ret = snd_soc_dapm_sys_add(rtd->dev);
1098 if (ret < 0) 1127 if (ret < 0)
1099 dev_err(codec->dev, 1128 dev_err(codec->dev,
1100 "asoc: failed to add codec dapm sysfs entries: %d\n", 1129 "asoc: failed to add codec dapm sysfs entries: %d\n",
1101 ret); 1130 ret);
1102 1131
1103 /* add codec sysfs entries */ 1132 /* add codec sysfs entries */
1104 ret = device_create_file(&rtd->dev, &dev_attr_codec_reg); 1133 ret = device_create_file(rtd->dev, &dev_attr_codec_reg);
1105 if (ret < 0) 1134 if (ret < 0)
1106 dev_err(codec->dev, 1135 dev_err(codec->dev,
1107 "asoc: failed to add codec sysfs files: %d\n", ret); 1136 "asoc: failed to add codec sysfs files: %d\n", ret);
@@ -1190,7 +1219,7 @@ static int soc_probe_dai_link(struct snd_soc_card *card, int num, int order)
1190 if (ret) 1219 if (ret)
1191 return ret; 1220 return ret;
1192 1221
1193 ret = device_create_file(&rtd->dev, &dev_attr_pmdown_time); 1222 ret = device_create_file(rtd->dev, &dev_attr_pmdown_time);
1194 if (ret < 0) 1223 if (ret < 0)
1195 printk(KERN_WARNING "asoc: failed to add pmdown_time sysfs\n"); 1224 printk(KERN_WARNING "asoc: failed to add pmdown_time sysfs\n");
1196 1225
@@ -1288,8 +1317,8 @@ static void soc_remove_aux_dev(struct snd_soc_card *card, int num)
1288 1317
1289 /* unregister the rtd device */ 1318 /* unregister the rtd device */
1290 if (rtd->dev_registered) { 1319 if (rtd->dev_registered) {
1291 device_remove_file(&rtd->dev, &dev_attr_codec_reg); 1320 device_remove_file(rtd->dev, &dev_attr_codec_reg);
1292 device_unregister(&rtd->dev); 1321 device_del(rtd->dev);
1293 rtd->dev_registered = 0; 1322 rtd->dev_registered = 0;
1294 } 1323 }
1295 1324
@@ -1488,6 +1517,10 @@ static void snd_soc_instantiate_card(struct snd_soc_card *card)
1488 1517
1489 snd_soc_dapm_new_widgets(&card->dapm); 1518 snd_soc_dapm_new_widgets(&card->dapm);
1490 1519
1520 if (card->fully_routed)
1521 list_for_each_entry(codec, &card->codec_dev_list, card_list)
1522 snd_soc_dapm_auto_nc_codec_pins(codec);
1523
1491 ret = snd_card_register(card->snd_card); 1524 ret = snd_card_register(card->snd_card);
1492 if (ret < 0) { 1525 if (ret < 0) {
1493 printk(KERN_ERR "asoc: failed to register soundcard for %s\n", card->name); 1526 printk(KERN_ERR "asoc: failed to register soundcard for %s\n", card->name);
@@ -2818,6 +2851,40 @@ int snd_soc_register_card(struct snd_soc_card *card)
2818 if (!card->name || !card->dev) 2851 if (!card->name || !card->dev)
2819 return -EINVAL; 2852 return -EINVAL;
2820 2853
2854 for (i = 0; i < card->num_links; i++) {
2855 struct snd_soc_dai_link *link = &card->dai_link[i];
2856
2857 /*
2858 * Codec must be specified by 1 of name or OF node,
2859 * not both or neither.
2860 */
2861 if (!!link->codec_name == !!link->codec_of_node) {
2862 dev_err(card->dev,
2863 "Neither/both codec name/of_node are set\n");
2864 return -EINVAL;
2865 }
2866
2867 /*
2868 * Platform may be specified by either name or OF node, but
2869 * can be left unspecified, and a dummy platform will be used.
2870 */
2871 if (link->platform_name && link->platform_of_node) {
2872 dev_err(card->dev,
2873 "Both platform name/of_node are set\n");
2874 return -EINVAL;
2875 }
2876
2877 /*
2878 * CPU DAI must be specified by 1 of name or OF node,
2879 * not both or neither.
2880 */
2881 if (!!link->cpu_dai_name == !!link->cpu_dai_of_node) {
2882 dev_err(card->dev,
2883 "Neither/both cpu_dai name/of_node are set\n");
2884 return -EINVAL;
2885 }
2886 }
2887
2821 dev_set_drvdata(card->dev, card); 2888 dev_set_drvdata(card->dev, card);
2822 2889
2823 snd_soc_initialize_card_lists(card); 2890 snd_soc_initialize_card_lists(card);
@@ -3305,6 +3372,87 @@ found:
3305} 3372}
3306EXPORT_SYMBOL_GPL(snd_soc_unregister_codec); 3373EXPORT_SYMBOL_GPL(snd_soc_unregister_codec);
3307 3374
3375/* Retrieve a card's name from device tree */
3376int snd_soc_of_parse_card_name(struct snd_soc_card *card,
3377 const char *propname)
3378{
3379 struct device_node *np = card->dev->of_node;
3380 int ret;
3381
3382 ret = of_property_read_string_index(np, propname, 0, &card->name);
3383 /*
3384 * EINVAL means the property does not exist. This is fine providing
3385 * card->name was previously set, which is checked later in
3386 * snd_soc_register_card.
3387 */
3388 if (ret < 0 && ret != -EINVAL) {
3389 dev_err(card->dev,
3390 "Property '%s' could not be read: %d\n",
3391 propname, ret);
3392 return ret;
3393 }
3394
3395 return 0;
3396}
3397EXPORT_SYMBOL_GPL(snd_soc_of_parse_card_name);
3398
3399int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
3400 const char *propname)
3401{
3402 struct device_node *np = card->dev->of_node;
3403 int num_routes;
3404 struct snd_soc_dapm_route *routes;
3405 int i, ret;
3406
3407 num_routes = of_property_count_strings(np, propname);
3408 if (num_routes & 1) {
3409 dev_err(card->dev,
3410 "Property '%s's length is not even\n",
3411 propname);
3412 return -EINVAL;
3413 }
3414 num_routes /= 2;
3415 if (!num_routes) {
3416 dev_err(card->dev,
3417 "Property '%s's length is zero\n",
3418 propname);
3419 return -EINVAL;
3420 }
3421
3422 routes = devm_kzalloc(card->dev, num_routes * sizeof(*routes),
3423 GFP_KERNEL);
3424 if (!routes) {
3425 dev_err(card->dev,
3426 "Could not allocate DAPM route table\n");
3427 return -EINVAL;
3428 }
3429
3430 for (i = 0; i < num_routes; i++) {
3431 ret = of_property_read_string_index(np, propname,
3432 2 * i, &routes[i].sink);
3433 if (ret) {
3434 dev_err(card->dev,
3435 "Property '%s' index %d could not be read: %d\n",
3436 propname, 2 * i, ret);
3437 return -EINVAL;
3438 }
3439 ret = of_property_read_string_index(np, propname,
3440 (2 * i) + 1, &routes[i].source);
3441 if (ret) {
3442 dev_err(card->dev,
3443 "Property '%s' index %d could not be read: %d\n",
3444 propname, (2 * i) + 1, ret);
3445 return -EINVAL;
3446 }
3447 }
3448
3449 card->num_dapm_routes = num_routes;
3450 card->dapm_routes = routes;
3451
3452 return 0;
3453}
3454EXPORT_SYMBOL_GPL(snd_soc_of_parse_audio_routing);
3455
3308static int __init snd_soc_init(void) 3456static int __init snd_soc_init(void)
3309{ 3457{
3310#ifdef CONFIG_DEBUG_FS 3458#ifdef CONFIG_DEBUG_FS
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index f42e8b9fb17..3ad1f59b802 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -39,6 +39,7 @@
39#include <linux/platform_device.h> 39#include <linux/platform_device.h>
40#include <linux/jiffies.h> 40#include <linux/jiffies.h>
41#include <linux/debugfs.h> 41#include <linux/debugfs.h>
42#include <linux/pm_runtime.h>
42#include <linux/slab.h> 43#include <linux/slab.h>
43#include <sound/core.h> 44#include <sound/core.h>
44#include <sound/pcm.h> 45#include <sound/pcm.h>
@@ -339,6 +340,7 @@ static void dapm_set_path_status(struct snd_soc_dapm_widget *w,
339 case snd_soc_dapm_output: 340 case snd_soc_dapm_output:
340 case snd_soc_dapm_adc: 341 case snd_soc_dapm_adc:
341 case snd_soc_dapm_input: 342 case snd_soc_dapm_input:
343 case snd_soc_dapm_siggen:
342 case snd_soc_dapm_dac: 344 case snd_soc_dapm_dac:
343 case snd_soc_dapm_micbias: 345 case snd_soc_dapm_micbias:
344 case snd_soc_dapm_vmid: 346 case snd_soc_dapm_vmid:
@@ -772,6 +774,11 @@ static int is_connected_input_ep(struct snd_soc_dapm_widget *widget)
772 return widget->inputs; 774 return widget->inputs;
773 } 775 }
774 776
777 /* signal generator */
778 if (widget->id == snd_soc_dapm_siggen) {
779 widget->inputs = snd_soc_dapm_suspend_check(widget);
780 return widget->inputs;
781 }
775 } 782 }
776 783
777 list_for_each_entry(path, &widget->sources, list_sink) { 784 list_for_each_entry(path, &widget->sources, list_sink) {
@@ -1200,6 +1207,9 @@ static void dapm_pre_sequence_async(void *data, async_cookie_t cookie)
1200 /* If we're off and we're not supposed to be go into STANDBY */ 1207 /* If we're off and we're not supposed to be go into STANDBY */
1201 if (d->bias_level == SND_SOC_BIAS_OFF && 1208 if (d->bias_level == SND_SOC_BIAS_OFF &&
1202 d->target_bias_level != SND_SOC_BIAS_OFF) { 1209 d->target_bias_level != SND_SOC_BIAS_OFF) {
1210 if (d->dev)
1211 pm_runtime_get_sync(d->dev);
1212
1203 ret = snd_soc_dapm_set_bias_level(d, SND_SOC_BIAS_STANDBY); 1213 ret = snd_soc_dapm_set_bias_level(d, SND_SOC_BIAS_STANDBY);
1204 if (ret != 0) 1214 if (ret != 0)
1205 dev_err(d->dev, 1215 dev_err(d->dev,
@@ -1239,6 +1249,9 @@ static void dapm_post_sequence_async(void *data, async_cookie_t cookie)
1239 ret = snd_soc_dapm_set_bias_level(d, SND_SOC_BIAS_OFF); 1249 ret = snd_soc_dapm_set_bias_level(d, SND_SOC_BIAS_OFF);
1240 if (ret != 0) 1250 if (ret != 0)
1241 dev_err(d->dev, "Failed to turn off bias: %d\n", ret); 1251 dev_err(d->dev, "Failed to turn off bias: %d\n", ret);
1252
1253 if (d->dev)
1254 pm_runtime_put_sync(d->dev);
1242 } 1255 }
1243 1256
1244 /* If we just powered up then move to active bias */ 1257 /* If we just powered up then move to active bias */
@@ -1725,8 +1738,7 @@ static int dapm_mixer_update_power(struct snd_soc_dapm_widget *widget,
1725static ssize_t dapm_widget_show(struct device *dev, 1738static ssize_t dapm_widget_show(struct device *dev,
1726 struct device_attribute *attr, char *buf) 1739 struct device_attribute *attr, char *buf)
1727{ 1740{
1728 struct snd_soc_pcm_runtime *rtd = 1741 struct snd_soc_pcm_runtime *rtd = dev_get_drvdata(dev);
1729 container_of(dev, struct snd_soc_pcm_runtime, dev);
1730 struct snd_soc_codec *codec =rtd->codec; 1742 struct snd_soc_codec *codec =rtd->codec;
1731 struct snd_soc_dapm_widget *w; 1743 struct snd_soc_dapm_widget *w;
1732 int count = 0; 1744 int count = 0;
@@ -1982,6 +1994,7 @@ static int snd_soc_dapm_add_route(struct snd_soc_dapm_context *dapm,
1982 case snd_soc_dapm_out_drv: 1994 case snd_soc_dapm_out_drv:
1983 case snd_soc_dapm_input: 1995 case snd_soc_dapm_input:
1984 case snd_soc_dapm_output: 1996 case snd_soc_dapm_output:
1997 case snd_soc_dapm_siggen:
1985 case snd_soc_dapm_micbias: 1998 case snd_soc_dapm_micbias:
1986 case snd_soc_dapm_vmid: 1999 case snd_soc_dapm_vmid:
1987 case snd_soc_dapm_pre: 2000 case snd_soc_dapm_pre:
@@ -2947,6 +2960,79 @@ int snd_soc_dapm_ignore_suspend(struct snd_soc_dapm_context *dapm,
2947} 2960}
2948EXPORT_SYMBOL_GPL(snd_soc_dapm_ignore_suspend); 2961EXPORT_SYMBOL_GPL(snd_soc_dapm_ignore_suspend);
2949 2962
2963static bool snd_soc_dapm_widget_in_card_paths(struct snd_soc_card *card,
2964 struct snd_soc_dapm_widget *w)
2965{
2966 struct snd_soc_dapm_path *p;
2967
2968 list_for_each_entry(p, &card->paths, list) {
2969 if ((p->source == w) || (p->sink == w)) {
2970 dev_dbg(card->dev,
2971 "... Path %s(id:%d dapm:%p) - %s(id:%d dapm:%p)\n",
2972 p->source->name, p->source->id, p->source->dapm,
2973 p->sink->name, p->sink->id, p->sink->dapm);
2974
2975 /* Connected to something other than the codec */
2976 if (p->source->dapm != p->sink->dapm)
2977 return true;
2978 /*
2979 * Loopback connection from codec external pin to
2980 * codec external pin
2981 */
2982 if (p->sink->id == snd_soc_dapm_input) {
2983 switch (p->source->id) {
2984 case snd_soc_dapm_output:
2985 case snd_soc_dapm_micbias:
2986 return true;
2987 default:
2988 break;
2989 }
2990 }
2991 }
2992 }
2993
2994 return false;
2995}
2996
2997/**
2998 * snd_soc_dapm_auto_nc_codec_pins - call snd_soc_dapm_nc_pin for unused pins
2999 * @codec: The codec whose pins should be processed
3000 *
3001 * Automatically call snd_soc_dapm_nc_pin() for any external pins in the codec
3002 * which are unused. Pins are used if they are connected externally to the
3003 * codec, whether that be to some other device, or a loop-back connection to
3004 * the codec itself.
3005 */
3006void snd_soc_dapm_auto_nc_codec_pins(struct snd_soc_codec *codec)
3007{
3008 struct snd_soc_card *card = codec->card;
3009 struct snd_soc_dapm_context *dapm = &codec->dapm;
3010 struct snd_soc_dapm_widget *w;
3011
3012 dev_dbg(codec->dev, "Auto NC: DAPMs: card:%p codec:%p\n",
3013 &card->dapm, &codec->dapm);
3014
3015 list_for_each_entry(w, &card->widgets, list) {
3016 if (w->dapm != dapm)
3017 continue;
3018 switch (w->id) {
3019 case snd_soc_dapm_input:
3020 case snd_soc_dapm_output:
3021 case snd_soc_dapm_micbias:
3022 dev_dbg(codec->dev, "Auto NC: Checking widget %s\n",
3023 w->name);
3024 if (!snd_soc_dapm_widget_in_card_paths(card, w)) {
3025 dev_dbg(codec->dev,
3026 "... Not in map; disabling\n");
3027 snd_soc_dapm_nc_pin(dapm, w->name);
3028 }
3029 break;
3030 default:
3031 break;
3032 }
3033 }
3034}
3035
2950/** 3036/**
2951 * snd_soc_dapm_free - free dapm resources 3037 * snd_soc_dapm_free - free dapm resources
2952 * @dapm: DAPM context 3038 * @dapm: DAPM context
diff --git a/sound/soc/soc-jack.c b/sound/soc/soc-jack.c
index 6c5ebd38c1b..ee4353f843e 100644
--- a/sound/soc/soc-jack.c
+++ b/sound/soc/soc-jack.c
@@ -341,10 +341,8 @@ int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count,
341 gpios[i].gpio, ret); 341 gpios[i].gpio, ret);
342 } 342 }
343 343
344#ifdef CONFIG_GPIO_SYSFS
345 /* Expose GPIO value over sysfs for diagnostic purposes */ 344 /* Expose GPIO value over sysfs for diagnostic purposes */
346 gpio_export(gpios[i].gpio, false); 345 gpio_export(gpios[i].gpio, false);
347#endif
348 346
349 /* Update initial jack status */ 347 /* Update initial jack status */
350 snd_soc_jack_gpio_detect(&gpios[i]); 348 snd_soc_jack_gpio_detect(&gpios[i]);
@@ -376,9 +374,7 @@ void snd_soc_jack_free_gpios(struct snd_soc_jack *jack, int count,
376 int i; 374 int i;
377 375
378 for (i = 0; i < count; i++) { 376 for (i = 0; i < count; i++) {
379#ifdef CONFIG_GPIO_SYSFS
380 gpio_unexport(gpios[i].gpio); 377 gpio_unexport(gpios[i].gpio);
381#endif
382 free_irq(gpio_to_irq(gpios[i].gpio), &gpios[i]); 378 free_irq(gpio_to_irq(gpios[i].gpio), &gpios[i]);
383 cancel_delayed_work_sync(&gpios[i].work); 379 cancel_delayed_work_sync(&gpios[i].work);
384 gpio_free(gpios[i].gpio); 380 gpio_free(gpios[i].gpio);
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index ee15337353f..cdc860a5ff3 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -19,6 +19,7 @@
19#include <linux/kernel.h> 19#include <linux/kernel.h>
20#include <linux/init.h> 20#include <linux/init.h>
21#include <linux/delay.h> 21#include <linux/delay.h>
22#include <linux/pm_runtime.h>
22#include <linux/slab.h> 23#include <linux/slab.h>
23#include <linux/workqueue.h> 24#include <linux/workqueue.h>
24#include <sound/core.h> 25#include <sound/core.h>
@@ -77,6 +78,10 @@ static int soc_pcm_open(struct snd_pcm_substream *substream)
77 struct snd_soc_dai_driver *codec_dai_drv = codec_dai->driver; 78 struct snd_soc_dai_driver *codec_dai_drv = codec_dai->driver;
78 int ret = 0; 79 int ret = 0;
79 80
81 pm_runtime_get_sync(cpu_dai->dev);
82 pm_runtime_get_sync(codec_dai->dev);
83 pm_runtime_get_sync(platform->dev);
84
80 mutex_lock_nested(&rtd->pcm_mutex, rtd->pcm_subclass); 85 mutex_lock_nested(&rtd->pcm_mutex, rtd->pcm_subclass);
81 86
82 /* startup the audio subsystem */ 87 /* startup the audio subsystem */
@@ -233,6 +238,11 @@ platform_err:
233 cpu_dai->driver->ops->shutdown(substream, cpu_dai); 238 cpu_dai->driver->ops->shutdown(substream, cpu_dai);
234out: 239out:
235 mutex_unlock(&rtd->pcm_mutex); 240 mutex_unlock(&rtd->pcm_mutex);
241
242 pm_runtime_put(platform->dev);
243 pm_runtime_put(codec_dai->dev);
244 pm_runtime_put(cpu_dai->dev);
245
236 return ret; 246 return ret;
237} 247}
238 248
@@ -319,7 +329,8 @@ static int soc_pcm_close(struct snd_pcm_substream *substream)
319 cpu_dai->runtime = NULL; 329 cpu_dai->runtime = NULL;
320 330
321 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { 331 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
322 if (unlikely(codec->ignore_pmdown_time)) { 332 if (codec->ignore_pmdown_time ||
333 rtd->dai_link->ignore_pmdown_time) {
323 /* powered down playback stream now */ 334 /* powered down playback stream now */
324 snd_soc_dapm_stream_event(rtd, 335 snd_soc_dapm_stream_event(rtd,
325 codec_dai->driver->playback.stream_name, 336 codec_dai->driver->playback.stream_name,
@@ -338,6 +349,11 @@ static int soc_pcm_close(struct snd_pcm_substream *substream)
338 } 349 }
339 350
340 mutex_unlock(&rtd->pcm_mutex); 351 mutex_unlock(&rtd->pcm_mutex);
352
353 pm_runtime_put(platform->dev);
354 pm_runtime_put(codec_dai->dev);
355 pm_runtime_put(cpu_dai->dev);
356
341 return 0; 357 return 0;
342} 358}
343 359
@@ -582,17 +598,6 @@ static snd_pcm_uframes_t soc_pcm_pointer(struct snd_pcm_substream *substream)
582 return offset; 598 return offset;
583} 599}
584 600
585/* ASoC PCM operations */
586static struct snd_pcm_ops soc_pcm_ops = {
587 .open = soc_pcm_open,
588 .close = soc_pcm_close,
589 .hw_params = soc_pcm_hw_params,
590 .hw_free = soc_pcm_hw_free,
591 .prepare = soc_pcm_prepare,
592 .trigger = soc_pcm_trigger,
593 .pointer = soc_pcm_pointer,
594};
595
596/* create a new pcm */ 601/* create a new pcm */
597int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num) 602int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num)
598{ 603{
@@ -600,10 +605,19 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num)
600 struct snd_soc_platform *platform = rtd->platform; 605 struct snd_soc_platform *platform = rtd->platform;
601 struct snd_soc_dai *codec_dai = rtd->codec_dai; 606 struct snd_soc_dai *codec_dai = rtd->codec_dai;
602 struct snd_soc_dai *cpu_dai = rtd->cpu_dai; 607 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
608 struct snd_pcm_ops *soc_pcm_ops = &rtd->ops;
603 struct snd_pcm *pcm; 609 struct snd_pcm *pcm;
604 char new_name[64]; 610 char new_name[64];
605 int ret = 0, playback = 0, capture = 0; 611 int ret = 0, playback = 0, capture = 0;
606 612
613 soc_pcm_ops->open = soc_pcm_open;
614 soc_pcm_ops->close = soc_pcm_close;
615 soc_pcm_ops->hw_params = soc_pcm_hw_params;
616 soc_pcm_ops->hw_free = soc_pcm_hw_free;
617 soc_pcm_ops->prepare = soc_pcm_prepare;
618 soc_pcm_ops->trigger = soc_pcm_trigger;
619 soc_pcm_ops->pointer = soc_pcm_pointer;
620
607 /* check client and interface hw capabilities */ 621 /* check client and interface hw capabilities */
608 snprintf(new_name, sizeof(new_name), "%s %s-%d", 622 snprintf(new_name, sizeof(new_name), "%s %s-%d",
609 rtd->dai_link->stream_name, codec_dai->name, num); 623 rtd->dai_link->stream_name, codec_dai->name, num);
@@ -627,20 +641,20 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num)
627 rtd->pcm = pcm; 641 rtd->pcm = pcm;
628 pcm->private_data = rtd; 642 pcm->private_data = rtd;
629 if (platform->driver->ops) { 643 if (platform->driver->ops) {
630 soc_pcm_ops.mmap = platform->driver->ops->mmap; 644 soc_pcm_ops->mmap = platform->driver->ops->mmap;
631 soc_pcm_ops.pointer = platform->driver->ops->pointer; 645 soc_pcm_ops->pointer = platform->driver->ops->pointer;
632 soc_pcm_ops.ioctl = platform->driver->ops->ioctl; 646 soc_pcm_ops->ioctl = platform->driver->ops->ioctl;
633 soc_pcm_ops.copy = platform->driver->ops->copy; 647 soc_pcm_ops->copy = platform->driver->ops->copy;
634 soc_pcm_ops.silence = platform->driver->ops->silence; 648 soc_pcm_ops->silence = platform->driver->ops->silence;
635 soc_pcm_ops.ack = platform->driver->ops->ack; 649 soc_pcm_ops->ack = platform->driver->ops->ack;
636 soc_pcm_ops.page = platform->driver->ops->page; 650 soc_pcm_ops->page = platform->driver->ops->page;
637 } 651 }
638 652
639 if (playback) 653 if (playback)
640 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &soc_pcm_ops); 654 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, soc_pcm_ops);
641 655
642 if (capture) 656 if (capture)
643 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &soc_pcm_ops); 657 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, soc_pcm_ops);
644 658
645 if (platform->driver->pcm_new) { 659 if (platform->driver->pcm_new) {
646 ret = platform->driver->pcm_new(rtd); 660 ret = platform->driver->pcm_new(rtd);
diff --git a/sound/soc/soc-utils.c b/sound/soc/soc-utils.c
index 0c12b98484b..4220bb0f273 100644
--- a/sound/soc/soc-utils.c
+++ b/sound/soc/soc-utils.c
@@ -58,7 +58,36 @@ int snd_soc_params_to_bclk(struct snd_pcm_hw_params *params)
58} 58}
59EXPORT_SYMBOL_GPL(snd_soc_params_to_bclk); 59EXPORT_SYMBOL_GPL(snd_soc_params_to_bclk);
60 60
61static struct snd_soc_platform_driver dummy_platform; 61static const struct snd_pcm_hardware dummy_dma_hardware = {
62 .formats = 0xffffffff,
63 .channels_min = 1,
64 .channels_max = UINT_MAX,
65
66 /* Random values to keep userspace happy when checking constraints */
67 .info = SNDRV_PCM_INFO_INTERLEAVED |
68 SNDRV_PCM_INFO_BLOCK_TRANSFER,
69 .buffer_bytes_max = 128*1024,
70 .period_bytes_min = PAGE_SIZE,
71 .period_bytes_max = PAGE_SIZE*2,
72 .periods_min = 2,
73 .periods_max = 128,
74};
75
76static int dummy_dma_open(struct snd_pcm_substream *substream)
77{
78 snd_soc_set_runtime_hwparams(substream, &dummy_dma_hardware);
79
80 return 0;
81}
82
83static struct snd_pcm_ops dummy_dma_ops = {
84 .open = dummy_dma_open,
85 .ioctl = snd_pcm_lib_ioctl,
86};
87
88static struct snd_soc_platform_driver dummy_platform = {
89 .ops = &dummy_dma_ops,
90};
62 91
63static __devinit int snd_soc_dummy_probe(struct platform_device *pdev) 92static __devinit int snd_soc_dummy_probe(struct platform_device *pdev)
64{ 93{
diff --git a/sound/soc/tegra/Kconfig b/sound/soc/tegra/Kconfig
index c6af1fd707f..ce1b773c351 100644
--- a/sound/soc/tegra/Kconfig
+++ b/sound/soc/tegra/Kconfig
@@ -47,3 +47,12 @@ config SND_SOC_TEGRA_TRIMSLICE
47 help 47 help
48 Say Y or M here if you want to add support for SoC audio on the 48 Say Y or M here if you want to add support for SoC audio on the
49 TrimSlice platform. 49 TrimSlice platform.
50
51config SND_SOC_TEGRA_ALC5632
52 tristate "SoC Audio support for Tegra boards using an ALC5632 codec"
53 depends on SND_SOC_TEGRA && I2C
54 select SND_SOC_TEGRA_I2S
55 select SND_SOC_ALC5632
56 help
57 Say Y or M here if you want to add support for SoC audio on the
58 Toshiba AC100 netbook.
diff --git a/sound/soc/tegra/Makefile b/sound/soc/tegra/Makefile
index 4d943b3fe15..8e584b8fcfb 100644
--- a/sound/soc/tegra/Makefile
+++ b/sound/soc/tegra/Makefile
@@ -14,6 +14,8 @@ obj-$(CONFIG_SND_SOC_TEGRA_SPDIF) += snd-soc-tegra-spdif.o
14# Tegra machine Support 14# Tegra machine Support
15snd-soc-tegra-wm8903-objs := tegra_wm8903.o 15snd-soc-tegra-wm8903-objs := tegra_wm8903.o
16snd-soc-tegra-trimslice-objs := trimslice.o 16snd-soc-tegra-trimslice-objs := trimslice.o
17snd-soc-tegra-alc5632-objs := tegra_alc5632.o
17 18
18obj-$(CONFIG_SND_SOC_TEGRA_WM8903) += snd-soc-tegra-wm8903.o 19obj-$(CONFIG_SND_SOC_TEGRA_WM8903) += snd-soc-tegra-wm8903.o
19obj-$(CONFIG_SND_SOC_TEGRA_TRIMSLICE) += snd-soc-tegra-trimslice.o 20obj-$(CONFIG_SND_SOC_TEGRA_TRIMSLICE) += snd-soc-tegra-trimslice.o
21obj-$(CONFIG_SND_SOC_TEGRA_ALC5632) += snd-soc-tegra-alc5632.o
diff --git a/sound/soc/tegra/tegra_alc5632.c b/sound/soc/tegra/tegra_alc5632.c
new file mode 100644
index 00000000000..4a0e805c4ed
--- /dev/null
+++ b/sound/soc/tegra/tegra_alc5632.c
@@ -0,0 +1,214 @@
1/*
2* tegra_alc5632.c -- Toshiba AC100(PAZ00) machine ASoC driver
3*
4* Copyright (C) 2011 The AC100 Kernel Team <ac100@lists.lauchpad.net>
5*
6* Authors: Leon Romanovsky <leon@leon.nu>
7* Andrey Danin <danindrey@mail.ru>
8* Marc Dietrich <marvin24@gmx.de>
9*
10* This program is free software; you can redistribute it and/or modify
11* it under the terms of the GNU General Public License version 2 as
12* published by the Free Software Foundation.
13*/
14
15#include <asm/mach-types.h>
16
17#include <linux/module.h>
18#include <linux/platform_device.h>
19#include <linux/slab.h>
20#include <linux/gpio.h>
21
22#include <sound/core.h>
23#include <sound/jack.h>
24#include <sound/pcm.h>
25#include <sound/pcm_params.h>
26#include <sound/soc.h>
27
28#include "../codecs/alc5632.h"
29
30#include "tegra_das.h"
31#include "tegra_i2s.h"
32#include "tegra_pcm.h"
33#include "tegra_asoc_utils.h"
34
35#define DRV_NAME "tegra-alc5632"
36
37struct tegra_alc5632 {
38 struct tegra_asoc_utils_data util_data;
39};
40
41static int tegra_alc5632_asoc_hw_params(struct snd_pcm_substream *substream,
42 struct snd_pcm_hw_params *params)
43{
44 struct snd_soc_pcm_runtime *rtd = substream->private_data;
45 struct snd_soc_dai *codec_dai = rtd->codec_dai;
46 struct snd_soc_codec *codec = rtd->codec;
47 struct snd_soc_card *card = codec->card;
48 struct tegra_alc5632 *alc5632 = snd_soc_card_get_drvdata(card);
49 int srate, mclk;
50 int err;
51
52 srate = params_rate(params);
53 mclk = 512 * srate;
54
55 err = tegra_asoc_utils_set_rate(&alc5632->util_data, srate, mclk);
56 if (err < 0) {
57 dev_err(card->dev, "Can't configure clocks\n");
58 return err;
59 }
60
61 err = snd_soc_dai_set_sysclk(codec_dai, 0, mclk,
62 SND_SOC_CLOCK_IN);
63 if (err < 0) {
64 dev_err(card->dev, "codec_dai clock not set\n");
65 return err;
66 }
67
68 return 0;
69}
70
71static struct snd_soc_ops tegra_alc5632_asoc_ops = {
72 .hw_params = tegra_alc5632_asoc_hw_params,
73};
74
75static struct snd_soc_jack tegra_alc5632_hs_jack;
76
77static struct snd_soc_jack_pin tegra_alc5632_hs_jack_pins[] = {
78 {
79 .pin = "Headset Mic",
80 .mask = SND_JACK_MICROPHONE,
81 },
82 {
83 .pin = "Headset Stereophone",
84 .mask = SND_JACK_HEADPHONE,
85 },
86};
87
88static const struct snd_soc_dapm_widget tegra_alc5632_dapm_widgets[] = {
89 SND_SOC_DAPM_SPK("Int Spk", NULL),
90 SND_SOC_DAPM_HP("Headset Stereophone", NULL),
91 SND_SOC_DAPM_MIC("Headset Mic", NULL),
92};
93
94static const struct snd_soc_dapm_route tegra_alc5632_audio_map[] = {
95 /* Internal Speaker */
96 {"Int Spk", NULL, "SPKOUT"},
97 {"Int Spk", NULL, "SPKOUTN"},
98
99 /* Headset Mic */
100 {"MIC1", NULL, "MICBIAS1"},
101 {"MICBIAS1", NULL, "Headset Mic"},
102
103 /* Headset Stereophone */
104 {"Headset Stereophone", NULL, "HPR"},
105 {"Headset Stereophone", NULL, "HPL"},
106};
107
108static const struct snd_kcontrol_new tegra_alc5632_controls[] = {
109 SOC_DAPM_PIN_SWITCH("Int Spk"),
110};
111
112static int tegra_alc5632_asoc_init(struct snd_soc_pcm_runtime *rtd)
113{
114 struct snd_soc_codec *codec = rtd->codec;
115 struct snd_soc_dapm_context *dapm = &codec->dapm;
116
117 snd_soc_jack_new(codec, "Headset Jack", SND_JACK_HEADSET,
118 &tegra_alc5632_hs_jack);
119 snd_soc_jack_add_pins(&tegra_alc5632_hs_jack,
120 ARRAY_SIZE(tegra_alc5632_hs_jack_pins),
121 tegra_alc5632_hs_jack_pins);
122
123 snd_soc_dapm_force_enable_pin(dapm, "MICBIAS1");
124
125 return 0;
126}
127
128static struct snd_soc_dai_link tegra_alc5632_dai = {
129 .name = "ALC5632",
130 .stream_name = "ALC5632 PCM",
131 .codec_name = "alc5632.0-001e",
132 .platform_name = "tegra-pcm-audio",
133 .cpu_dai_name = "tegra-i2s.0",
134 .codec_dai_name = "alc5632-hifi",
135 .init = tegra_alc5632_asoc_init,
136 .ops = &tegra_alc5632_asoc_ops,
137 .dai_fmt = SND_SOC_DAIFMT_I2S
138 | SND_SOC_DAIFMT_NB_NF
139 | SND_SOC_DAIFMT_CBS_CFS,
140};
141
142static struct snd_soc_card snd_soc_tegra_alc5632 = {
143 .name = "tegra-alc5632",
144 .owner = THIS_MODULE,
145 .dai_link = &tegra_alc5632_dai,
146 .num_links = 1,
147 .controls = tegra_alc5632_controls,
148 .num_controls = ARRAY_SIZE(tegra_alc5632_controls),
149 .dapm_widgets = tegra_alc5632_dapm_widgets,
150 .num_dapm_widgets = ARRAY_SIZE(tegra_alc5632_dapm_widgets),
151 .dapm_routes = tegra_alc5632_audio_map,
152 .num_dapm_routes = ARRAY_SIZE(tegra_alc5632_audio_map),
153 .fully_routed = true,
154};
155
156static __devinit int tegra_alc5632_probe(struct platform_device *pdev)
157{
158 struct snd_soc_card *card = &snd_soc_tegra_alc5632;
159 struct tegra_alc5632 *alc5632;
160 int ret;
161
162 alc5632 = devm_kzalloc(&pdev->dev,
163 sizeof(struct tegra_alc5632), GFP_KERNEL);
164 if (!alc5632) {
165 dev_err(&pdev->dev, "Can't allocate tegra_alc5632\n");
166 return -ENOMEM;
167 }
168
169 ret = tegra_asoc_utils_init(&alc5632->util_data, &pdev->dev);
170 if (ret)
171 return ret;
172
173 card->dev = &pdev->dev;
174 platform_set_drvdata(pdev, card);
175 snd_soc_card_set_drvdata(card, alc5632);
176
177 ret = snd_soc_register_card(card);
178 if (ret) {
179 dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n",
180 ret);
181 tegra_asoc_utils_fini(&alc5632->util_data);
182 return ret;
183 }
184
185 return 0;
186}
187
188static int __devexit tegra_alc5632_remove(struct platform_device *pdev)
189{
190 struct snd_soc_card *card = platform_get_drvdata(pdev);
191 struct tegra_alc5632 *alc5632 = snd_soc_card_get_drvdata(card);
192
193 snd_soc_unregister_card(card);
194
195 tegra_asoc_utils_fini(&alc5632->util_data);
196
197 return 0;
198}
199
200static struct platform_driver tegra_alc5632_driver = {
201 .driver = {
202 .name = DRV_NAME,
203 .owner = THIS_MODULE,
204 .pm = &snd_soc_pm_ops,
205 },
206 .probe = tegra_alc5632_probe,
207 .remove = __devexit_p(tegra_alc5632_remove),
208};
209module_platform_driver(tegra_alc5632_driver);
210
211MODULE_AUTHOR("Leon Romanovsky <leon@leon.nu>");
212MODULE_DESCRIPTION("Tegra+ALC5632 machine ASoC driver");
213MODULE_LICENSE("GPL");
214MODULE_ALIAS("platform:" DRV_NAME);
diff --git a/sound/soc/tegra/tegra_das.c b/sound/soc/tegra/tegra_das.c
index 3b55a44146a..3b3c1ba4d23 100644
--- a/sound/soc/tegra/tegra_das.c
+++ b/sound/soc/tegra/tegra_das.c
@@ -172,11 +172,11 @@ static int __devinit tegra_das_probe(struct platform_device *pdev)
172 if (das) 172 if (das)
173 return -ENODEV; 173 return -ENODEV;
174 174
175 das = kzalloc(sizeof(struct tegra_das), GFP_KERNEL); 175 das = devm_kzalloc(&pdev->dev, sizeof(struct tegra_das), GFP_KERNEL);
176 if (!das) { 176 if (!das) {
177 dev_err(&pdev->dev, "Can't allocate tegra_das\n"); 177 dev_err(&pdev->dev, "Can't allocate tegra_das\n");
178 ret = -ENOMEM; 178 ret = -ENOMEM;
179 goto exit; 179 goto err;
180 } 180 }
181 das->dev = &pdev->dev; 181 das->dev = &pdev->dev;
182 182
@@ -184,22 +184,35 @@ static int __devinit tegra_das_probe(struct platform_device *pdev)
184 if (!res) { 184 if (!res) {
185 dev_err(&pdev->dev, "No memory resource\n"); 185 dev_err(&pdev->dev, "No memory resource\n");
186 ret = -ENODEV; 186 ret = -ENODEV;
187 goto err_free; 187 goto err;
188 } 188 }
189 189
190 region = request_mem_region(res->start, resource_size(res), 190 region = devm_request_mem_region(&pdev->dev, res->start,
191 pdev->name); 191 resource_size(res), pdev->name);
192 if (!region) { 192 if (!region) {
193 dev_err(&pdev->dev, "Memory region already claimed\n"); 193 dev_err(&pdev->dev, "Memory region already claimed\n");
194 ret = -EBUSY; 194 ret = -EBUSY;
195 goto err_free; 195 goto err;
196 } 196 }
197 197
198 das->regs = ioremap(res->start, resource_size(res)); 198 das->regs = devm_ioremap(&pdev->dev, res->start, resource_size(res));
199 if (!das->regs) { 199 if (!das->regs) {
200 dev_err(&pdev->dev, "ioremap failed\n"); 200 dev_err(&pdev->dev, "ioremap failed\n");
201 ret = -ENOMEM; 201 ret = -ENOMEM;
202 goto err_release; 202 goto err;
203 }
204
205 ret = tegra_das_connect_dap_to_dac(TEGRA_DAS_DAP_ID_1,
206 TEGRA_DAS_DAP_SEL_DAC1);
207 if (ret) {
208 dev_err(&pdev->dev, "Can't set up DAS DAP connection\n");
209 goto err;
210 }
211 ret = tegra_das_connect_dac_to_dap(TEGRA_DAS_DAC_ID_1,
212 TEGRA_DAS_DAC_SEL_DAP1);
213 if (ret) {
214 dev_err(&pdev->dev, "Can't set up DAS DAC connection\n");
215 goto err;
203 } 216 }
204 217
205 tegra_das_debug_add(das); 218 tegra_das_debug_add(das);
@@ -208,58 +221,41 @@ static int __devinit tegra_das_probe(struct platform_device *pdev)
208 221
209 return 0; 222 return 0;
210 223
211err_release: 224err:
212 release_mem_region(res->start, resource_size(res));
213err_free:
214 kfree(das);
215 das = NULL; 225 das = NULL;
216exit:
217 return ret; 226 return ret;
218} 227}
219 228
220static int __devexit tegra_das_remove(struct platform_device *pdev) 229static int __devexit tegra_das_remove(struct platform_device *pdev)
221{ 230{
222 struct resource *res;
223
224 if (!das) 231 if (!das)
225 return -ENODEV; 232 return -ENODEV;
226 233
227 platform_set_drvdata(pdev, NULL);
228
229 tegra_das_debug_remove(das); 234 tegra_das_debug_remove(das);
230 235
231 iounmap(das->regs);
232
233 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
234 release_mem_region(res->start, resource_size(res));
235
236 kfree(das);
237 das = NULL; 236 das = NULL;
238 237
239 return 0; 238 return 0;
240} 239}
241 240
241static const struct of_device_id tegra_das_of_match[] __devinitconst = {
242 { .compatible = "nvidia,tegra20-das", },
243 {},
244};
245
242static struct platform_driver tegra_das_driver = { 246static struct platform_driver tegra_das_driver = {
243 .probe = tegra_das_probe, 247 .probe = tegra_das_probe,
244 .remove = __devexit_p(tegra_das_remove), 248 .remove = __devexit_p(tegra_das_remove),
245 .driver = { 249 .driver = {
246 .name = DRV_NAME, 250 .name = DRV_NAME,
251 .owner = THIS_MODULE,
252 .of_match_table = tegra_das_of_match,
247 }, 253 },
248}; 254};
249 255module_platform_driver(tegra_das_driver);
250static int __init tegra_das_modinit(void)
251{
252 return platform_driver_register(&tegra_das_driver);
253}
254module_init(tegra_das_modinit);
255
256static void __exit tegra_das_modexit(void)
257{
258 platform_driver_unregister(&tegra_das_driver);
259}
260module_exit(tegra_das_modexit);
261 256
262MODULE_AUTHOR("Stephen Warren <swarren@nvidia.com>"); 257MODULE_AUTHOR("Stephen Warren <swarren@nvidia.com>");
263MODULE_DESCRIPTION("Tegra DAS driver"); 258MODULE_DESCRIPTION("Tegra DAS driver");
264MODULE_LICENSE("GPL"); 259MODULE_LICENSE("GPL");
265MODULE_ALIAS("platform:" DRV_NAME); 260MODULE_ALIAS("platform:" DRV_NAME);
261MODULE_DEVICE_TABLE(of, tegra_das_of_match);
diff --git a/sound/soc/tegra/tegra_i2s.c b/sound/soc/tegra/tegra_i2s.c
index 6728fab8c41..33509de5254 100644
--- a/sound/soc/tegra/tegra_i2s.c
+++ b/sound/soc/tegra/tegra_i2s.c
@@ -36,13 +36,13 @@
36#include <linux/seq_file.h> 36#include <linux/seq_file.h>
37#include <linux/slab.h> 37#include <linux/slab.h>
38#include <linux/io.h> 38#include <linux/io.h>
39#include <linux/of.h>
39#include <mach/iomap.h> 40#include <mach/iomap.h>
40#include <sound/core.h> 41#include <sound/core.h>
41#include <sound/pcm.h> 42#include <sound/pcm.h>
42#include <sound/pcm_params.h> 43#include <sound/pcm_params.h>
43#include <sound/soc.h> 44#include <sound/soc.h>
44 45
45#include "tegra_das.h"
46#include "tegra_i2s.h" 46#include "tegra_i2s.h"
47 47
48#define DRV_NAME "tegra-i2s" 48#define DRV_NAME "tegra-i2s"
@@ -99,13 +99,11 @@ static const struct file_operations tegra_i2s_debug_fops = {
99 .release = single_release, 99 .release = single_release,
100}; 100};
101 101
102static void tegra_i2s_debug_add(struct tegra_i2s *i2s, int id) 102static void tegra_i2s_debug_add(struct tegra_i2s *i2s)
103{ 103{
104 char name[] = DRV_NAME ".0"; 104 i2s->debug = debugfs_create_file(i2s->dai.name, S_IRUGO,
105 105 snd_soc_debugfs_root, i2s,
106 snprintf(name, sizeof(name), DRV_NAME".%1d", id); 106 &tegra_i2s_debug_fops);
107 i2s->debug = debugfs_create_file(name, S_IRUGO, snd_soc_debugfs_root,
108 i2s, &tegra_i2s_debug_fops);
109} 107}
110 108
111static void tegra_i2s_debug_remove(struct tegra_i2s *i2s) 109static void tegra_i2s_debug_remove(struct tegra_i2s *i2s)
@@ -306,93 +304,54 @@ static int tegra_i2s_probe(struct snd_soc_dai *dai)
306 return 0; 304 return 0;
307} 305}
308 306
309static struct snd_soc_dai_ops tegra_i2s_dai_ops = { 307static const struct snd_soc_dai_ops tegra_i2s_dai_ops = {
310 .set_fmt = tegra_i2s_set_fmt, 308 .set_fmt = tegra_i2s_set_fmt,
311 .hw_params = tegra_i2s_hw_params, 309 .hw_params = tegra_i2s_hw_params,
312 .trigger = tegra_i2s_trigger, 310 .trigger = tegra_i2s_trigger,
313}; 311};
314 312
315static struct snd_soc_dai_driver tegra_i2s_dai[] = { 313static const struct snd_soc_dai_driver tegra_i2s_dai_template = {
316 { 314 .probe = tegra_i2s_probe,
317 .name = DRV_NAME ".0", 315 .playback = {
318 .probe = tegra_i2s_probe, 316 .channels_min = 2,
319 .playback = { 317 .channels_max = 2,
320 .channels_min = 2, 318 .rates = SNDRV_PCM_RATE_8000_96000,
321 .channels_max = 2, 319 .formats = SNDRV_PCM_FMTBIT_S16_LE,
322 .rates = SNDRV_PCM_RATE_8000_96000,
323 .formats = SNDRV_PCM_FMTBIT_S16_LE,
324 },
325 .capture = {
326 .channels_min = 2,
327 .channels_max = 2,
328 .rates = SNDRV_PCM_RATE_8000_96000,
329 .formats = SNDRV_PCM_FMTBIT_S16_LE,
330 },
331 .ops = &tegra_i2s_dai_ops,
332 .symmetric_rates = 1,
333 }, 320 },
334 { 321 .capture = {
335 .name = DRV_NAME ".1", 322 .channels_min = 2,
336 .probe = tegra_i2s_probe, 323 .channels_max = 2,
337 .playback = { 324 .rates = SNDRV_PCM_RATE_8000_96000,
338 .channels_min = 2, 325 .formats = SNDRV_PCM_FMTBIT_S16_LE,
339 .channels_max = 2,
340 .rates = SNDRV_PCM_RATE_8000_96000,
341 .formats = SNDRV_PCM_FMTBIT_S16_LE,
342 },
343 .capture = {
344 .channels_min = 2,
345 .channels_max = 2,
346 .rates = SNDRV_PCM_RATE_8000_96000,
347 .formats = SNDRV_PCM_FMTBIT_S16_LE,
348 },
349 .ops = &tegra_i2s_dai_ops,
350 .symmetric_rates = 1,
351 }, 326 },
327 .ops = &tegra_i2s_dai_ops,
328 .symmetric_rates = 1,
352}; 329};
353 330
354static __devinit int tegra_i2s_platform_probe(struct platform_device *pdev) 331static __devinit int tegra_i2s_platform_probe(struct platform_device *pdev)
355{ 332{
356 struct tegra_i2s * i2s; 333 struct tegra_i2s * i2s;
357 struct resource *mem, *memregion, *dmareq; 334 struct resource *mem, *memregion, *dmareq;
335 u32 of_dma[2];
336 u32 dma_ch;
358 int ret; 337 int ret;
359 338
360 if ((pdev->id < 0) || 339 i2s = devm_kzalloc(&pdev->dev, sizeof(struct tegra_i2s), GFP_KERNEL);
361 (pdev->id >= ARRAY_SIZE(tegra_i2s_dai))) {
362 dev_err(&pdev->dev, "ID %d out of range\n", pdev->id);
363 return -EINVAL;
364 }
365
366 /*
367 * FIXME: Until a codec driver exists for the tegra DAS, hard-code a
368 * 1:1 mapping between audio controllers and audio ports.
369 */
370 ret = tegra_das_connect_dap_to_dac(TEGRA_DAS_DAP_ID_1 + pdev->id,
371 TEGRA_DAS_DAP_SEL_DAC1 + pdev->id);
372 if (ret) {
373 dev_err(&pdev->dev, "Can't set up DAP connection\n");
374 return ret;
375 }
376 ret = tegra_das_connect_dac_to_dap(TEGRA_DAS_DAC_ID_1 + pdev->id,
377 TEGRA_DAS_DAC_SEL_DAP1 + pdev->id);
378 if (ret) {
379 dev_err(&pdev->dev, "Can't set up DAC connection\n");
380 return ret;
381 }
382
383 i2s = kzalloc(sizeof(struct tegra_i2s), GFP_KERNEL);
384 if (!i2s) { 340 if (!i2s) {
385 dev_err(&pdev->dev, "Can't allocate tegra_i2s\n"); 341 dev_err(&pdev->dev, "Can't allocate tegra_i2s\n");
386 ret = -ENOMEM; 342 ret = -ENOMEM;
387 goto exit; 343 goto err;
388 } 344 }
389 dev_set_drvdata(&pdev->dev, i2s); 345 dev_set_drvdata(&pdev->dev, i2s);
390 346
347 i2s->dai = tegra_i2s_dai_template;
348 i2s->dai.name = dev_name(&pdev->dev);
349
391 i2s->clk_i2s = clk_get(&pdev->dev, NULL); 350 i2s->clk_i2s = clk_get(&pdev->dev, NULL);
392 if (IS_ERR(i2s->clk_i2s)) { 351 if (IS_ERR(i2s->clk_i2s)) {
393 dev_err(&pdev->dev, "Can't retrieve i2s clock\n"); 352 dev_err(&pdev->dev, "Can't retrieve i2s clock\n");
394 ret = PTR_ERR(i2s->clk_i2s); 353 ret = PTR_ERR(i2s->clk_i2s);
395 goto err_free; 354 goto err;
396 } 355 }
397 356
398 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); 357 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
@@ -404,104 +363,93 @@ static __devinit int tegra_i2s_platform_probe(struct platform_device *pdev)
404 363
405 dmareq = platform_get_resource(pdev, IORESOURCE_DMA, 0); 364 dmareq = platform_get_resource(pdev, IORESOURCE_DMA, 0);
406 if (!dmareq) { 365 if (!dmareq) {
407 dev_err(&pdev->dev, "No DMA resource\n"); 366 if (of_property_read_u32_array(pdev->dev.of_node,
408 ret = -ENODEV; 367 "nvidia,dma-request-selector",
409 goto err_clk_put; 368 of_dma, 2) < 0) {
369 dev_err(&pdev->dev, "No DMA resource\n");
370 ret = -ENODEV;
371 goto err_clk_put;
372 }
373 dma_ch = of_dma[1];
374 } else {
375 dma_ch = dmareq->start;
410 } 376 }
411 377
412 memregion = request_mem_region(mem->start, resource_size(mem), 378 memregion = devm_request_mem_region(&pdev->dev, mem->start,
413 DRV_NAME); 379 resource_size(mem), DRV_NAME);
414 if (!memregion) { 380 if (!memregion) {
415 dev_err(&pdev->dev, "Memory region already claimed\n"); 381 dev_err(&pdev->dev, "Memory region already claimed\n");
416 ret = -EBUSY; 382 ret = -EBUSY;
417 goto err_clk_put; 383 goto err_clk_put;
418 } 384 }
419 385
420 i2s->regs = ioremap(mem->start, resource_size(mem)); 386 i2s->regs = devm_ioremap(&pdev->dev, mem->start, resource_size(mem));
421 if (!i2s->regs) { 387 if (!i2s->regs) {
422 dev_err(&pdev->dev, "ioremap failed\n"); 388 dev_err(&pdev->dev, "ioremap failed\n");
423 ret = -ENOMEM; 389 ret = -ENOMEM;
424 goto err_release; 390 goto err_clk_put;
425 } 391 }
426 392
427 i2s->capture_dma_data.addr = mem->start + TEGRA_I2S_FIFO2; 393 i2s->capture_dma_data.addr = mem->start + TEGRA_I2S_FIFO2;
428 i2s->capture_dma_data.wrap = 4; 394 i2s->capture_dma_data.wrap = 4;
429 i2s->capture_dma_data.width = 32; 395 i2s->capture_dma_data.width = 32;
430 i2s->capture_dma_data.req_sel = dmareq->start; 396 i2s->capture_dma_data.req_sel = dma_ch;
431 397
432 i2s->playback_dma_data.addr = mem->start + TEGRA_I2S_FIFO1; 398 i2s->playback_dma_data.addr = mem->start + TEGRA_I2S_FIFO1;
433 i2s->playback_dma_data.wrap = 4; 399 i2s->playback_dma_data.wrap = 4;
434 i2s->playback_dma_data.width = 32; 400 i2s->playback_dma_data.width = 32;
435 i2s->playback_dma_data.req_sel = dmareq->start; 401 i2s->playback_dma_data.req_sel = dma_ch;
436 402
437 i2s->reg_ctrl = TEGRA_I2S_CTRL_FIFO_FORMAT_PACKED; 403 i2s->reg_ctrl = TEGRA_I2S_CTRL_FIFO_FORMAT_PACKED;
438 404
439 ret = snd_soc_register_dai(&pdev->dev, &tegra_i2s_dai[pdev->id]); 405 ret = snd_soc_register_dai(&pdev->dev, &i2s->dai);
440 if (ret) { 406 if (ret) {
441 dev_err(&pdev->dev, "Could not register DAI: %d\n", ret); 407 dev_err(&pdev->dev, "Could not register DAI: %d\n", ret);
442 ret = -ENOMEM; 408 ret = -ENOMEM;
443 goto err_unmap; 409 goto err_clk_put;
444 } 410 }
445 411
446 tegra_i2s_debug_add(i2s, pdev->id); 412 tegra_i2s_debug_add(i2s);
447 413
448 return 0; 414 return 0;
449 415
450err_unmap:
451 iounmap(i2s->regs);
452err_release:
453 release_mem_region(mem->start, resource_size(mem));
454err_clk_put: 416err_clk_put:
455 clk_put(i2s->clk_i2s); 417 clk_put(i2s->clk_i2s);
456err_free: 418err:
457 kfree(i2s);
458exit:
459 return ret; 419 return ret;
460} 420}
461 421
462static int __devexit tegra_i2s_platform_remove(struct platform_device *pdev) 422static int __devexit tegra_i2s_platform_remove(struct platform_device *pdev)
463{ 423{
464 struct tegra_i2s *i2s = dev_get_drvdata(&pdev->dev); 424 struct tegra_i2s *i2s = dev_get_drvdata(&pdev->dev);
465 struct resource *res;
466 425
467 snd_soc_unregister_dai(&pdev->dev); 426 snd_soc_unregister_dai(&pdev->dev);
468 427
469 tegra_i2s_debug_remove(i2s); 428 tegra_i2s_debug_remove(i2s);
470 429
471 iounmap(i2s->regs);
472
473 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
474 release_mem_region(res->start, resource_size(res));
475
476 clk_put(i2s->clk_i2s); 430 clk_put(i2s->clk_i2s);
477 431
478 kfree(i2s);
479
480 return 0; 432 return 0;
481} 433}
482 434
435static const struct of_device_id tegra_i2s_of_match[] __devinitconst = {
436 { .compatible = "nvidia,tegra20-i2s", },
437 {},
438};
439
483static struct platform_driver tegra_i2s_driver = { 440static struct platform_driver tegra_i2s_driver = {
484 .driver = { 441 .driver = {
485 .name = DRV_NAME, 442 .name = DRV_NAME,
486 .owner = THIS_MODULE, 443 .owner = THIS_MODULE,
444 .of_match_table = tegra_i2s_of_match,
487 }, 445 },
488 .probe = tegra_i2s_platform_probe, 446 .probe = tegra_i2s_platform_probe,
489 .remove = __devexit_p(tegra_i2s_platform_remove), 447 .remove = __devexit_p(tegra_i2s_platform_remove),
490}; 448};
491 449module_platform_driver(tegra_i2s_driver);
492static int __init snd_tegra_i2s_init(void)
493{
494 return platform_driver_register(&tegra_i2s_driver);
495}
496module_init(snd_tegra_i2s_init);
497
498static void __exit snd_tegra_i2s_exit(void)
499{
500 platform_driver_unregister(&tegra_i2s_driver);
501}
502module_exit(snd_tegra_i2s_exit);
503 450
504MODULE_AUTHOR("Stephen Warren <swarren@nvidia.com>"); 451MODULE_AUTHOR("Stephen Warren <swarren@nvidia.com>");
505MODULE_DESCRIPTION("Tegra I2S ASoC driver"); 452MODULE_DESCRIPTION("Tegra I2S ASoC driver");
506MODULE_LICENSE("GPL"); 453MODULE_LICENSE("GPL");
507MODULE_ALIAS("platform:" DRV_NAME); 454MODULE_ALIAS("platform:" DRV_NAME);
455MODULE_DEVICE_TABLE(of, tegra_i2s_of_match);
diff --git a/sound/soc/tegra/tegra_i2s.h b/sound/soc/tegra/tegra_i2s.h
index 2b38a096f46..15ce1e2e8bd 100644
--- a/sound/soc/tegra/tegra_i2s.h
+++ b/sound/soc/tegra/tegra_i2s.h
@@ -153,6 +153,7 @@
153#define TEGRA_I2S_FIFO_SCR_FIFO1_ATN_LVL_TWELVE_SLOTS (TEGRA_I2S_FIFO_ATN_LVL_TWELVE_SLOTS << TEGRA_I2S_FIFO_SCR_FIFO1_ATN_LVL_SHIFT) 153#define TEGRA_I2S_FIFO_SCR_FIFO1_ATN_LVL_TWELVE_SLOTS (TEGRA_I2S_FIFO_ATN_LVL_TWELVE_SLOTS << TEGRA_I2S_FIFO_SCR_FIFO1_ATN_LVL_SHIFT)
154 154
155struct tegra_i2s { 155struct tegra_i2s {
156 struct snd_soc_dai_driver dai;
156 struct clk *clk_i2s; 157 struct clk *clk_i2s;
157 int clk_refs; 158 int clk_refs;
158 struct tegra_pcm_dma_params capture_dma_data; 159 struct tegra_pcm_dma_params capture_dma_data;
diff --git a/sound/soc/tegra/tegra_pcm.c b/sound/soc/tegra/tegra_pcm.c
index 436def1dfa3..c22431516ab 100644
--- a/sound/soc/tegra/tegra_pcm.c
+++ b/sound/soc/tegra/tegra_pcm.c
@@ -330,7 +330,6 @@ static u64 tegra_dma_mask = DMA_BIT_MASK(32);
330static int tegra_pcm_new(struct snd_soc_pcm_runtime *rtd) 330static int tegra_pcm_new(struct snd_soc_pcm_runtime *rtd)
331{ 331{
332 struct snd_card *card = rtd->card->snd_card; 332 struct snd_card *card = rtd->card->snd_card;
333 struct snd_soc_dai *dai = rtd->cpu_dai;
334 struct snd_pcm *pcm = rtd->pcm; 333 struct snd_pcm *pcm = rtd->pcm;
335 int ret = 0; 334 int ret = 0;
336 335
@@ -339,14 +338,14 @@ static int tegra_pcm_new(struct snd_soc_pcm_runtime *rtd)
339 if (!card->dev->coherent_dma_mask) 338 if (!card->dev->coherent_dma_mask)
340 card->dev->coherent_dma_mask = 0xffffffff; 339 card->dev->coherent_dma_mask = 0xffffffff;
341 340
342 if (dai->driver->playback.channels_min) { 341 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
343 ret = tegra_pcm_preallocate_dma_buffer(pcm, 342 ret = tegra_pcm_preallocate_dma_buffer(pcm,
344 SNDRV_PCM_STREAM_PLAYBACK); 343 SNDRV_PCM_STREAM_PLAYBACK);
345 if (ret) 344 if (ret)
346 goto err; 345 goto err;
347 } 346 }
348 347
349 if (dai->driver->capture.channels_min) { 348 if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) {
350 ret = tegra_pcm_preallocate_dma_buffer(pcm, 349 ret = tegra_pcm_preallocate_dma_buffer(pcm,
351 SNDRV_PCM_STREAM_CAPTURE); 350 SNDRV_PCM_STREAM_CAPTURE);
352 if (ret) 351 if (ret)
@@ -392,18 +391,7 @@ static struct platform_driver tegra_pcm_driver = {
392 .probe = tegra_pcm_platform_probe, 391 .probe = tegra_pcm_platform_probe,
393 .remove = __devexit_p(tegra_pcm_platform_remove), 392 .remove = __devexit_p(tegra_pcm_platform_remove),
394}; 393};
395 394module_platform_driver(tegra_pcm_driver);
396static int __init snd_tegra_pcm_init(void)
397{
398 return platform_driver_register(&tegra_pcm_driver);
399}
400module_init(snd_tegra_pcm_init);
401
402static void __exit snd_tegra_pcm_exit(void)
403{
404 platform_driver_unregister(&tegra_pcm_driver);
405}
406module_exit(snd_tegra_pcm_exit);
407 395
408MODULE_AUTHOR("Stephen Warren <swarren@nvidia.com>"); 396MODULE_AUTHOR("Stephen Warren <swarren@nvidia.com>");
409MODULE_DESCRIPTION("Tegra PCM ASoC driver"); 397MODULE_DESCRIPTION("Tegra PCM ASoC driver");
diff --git a/sound/soc/tegra/tegra_spdif.c b/sound/soc/tegra/tegra_spdif.c
index dd11d0c6347..475428cf270 100644
--- a/sound/soc/tegra/tegra_spdif.c
+++ b/sound/soc/tegra/tegra_spdif.c
@@ -226,7 +226,7 @@ static int tegra_spdif_probe(struct snd_soc_dai *dai)
226 return 0; 226 return 0;
227} 227}
228 228
229static struct snd_soc_dai_ops tegra_spdif_dai_ops = { 229static const struct snd_soc_dai_ops tegra_spdif_dai_ops = {
230 .hw_params = tegra_spdif_hw_params, 230 .hw_params = tegra_spdif_hw_params,
231 .trigger = tegra_spdif_trigger, 231 .trigger = tegra_spdif_trigger,
232}; 232};
@@ -352,17 +352,7 @@ static struct platform_driver tegra_spdif_driver = {
352 .remove = __devexit_p(tegra_spdif_platform_remove), 352 .remove = __devexit_p(tegra_spdif_platform_remove),
353}; 353};
354 354
355static int __init snd_tegra_spdif_init(void) 355module_platform_driver(tegra_spdif_driver);
356{
357 return platform_driver_register(&tegra_spdif_driver);
358}
359module_init(snd_tegra_spdif_init);
360
361static void __exit snd_tegra_spdif_exit(void)
362{
363 platform_driver_unregister(&tegra_spdif_driver);
364}
365module_exit(snd_tegra_spdif_exit);
366 356
367MODULE_AUTHOR("Stephen Warren <swarren@nvidia.com>"); 357MODULE_AUTHOR("Stephen Warren <swarren@nvidia.com>");
368MODULE_DESCRIPTION("Tegra SPDIF ASoC driver"); 358MODULE_DESCRIPTION("Tegra SPDIF ASoC driver");
diff --git a/sound/soc/tegra/tegra_wm8903.c b/sound/soc/tegra/tegra_wm8903.c
index a81cf39257b..566655e23b7 100644
--- a/sound/soc/tegra/tegra_wm8903.c
+++ b/sound/soc/tegra/tegra_wm8903.c
@@ -34,6 +34,7 @@
34#include <linux/platform_device.h> 34#include <linux/platform_device.h>
35#include <linux/slab.h> 35#include <linux/slab.h>
36#include <linux/gpio.h> 36#include <linux/gpio.h>
37#include <linux/of_gpio.h>
37 38
38#include <mach/tegra_wm8903_pdata.h> 39#include <mach/tegra_wm8903_pdata.h>
39 40
@@ -59,8 +60,9 @@
59#define GPIO_HP_DET BIT(4) 60#define GPIO_HP_DET BIT(4)
60 61
61struct tegra_wm8903 { 62struct tegra_wm8903 {
63 struct tegra_wm8903_platform_data pdata;
64 struct platform_device *pcm_dev;
62 struct tegra_asoc_utils_data util_data; 65 struct tegra_asoc_utils_data util_data;
63 struct tegra_wm8903_platform_data *pdata;
64 int gpio_requested; 66 int gpio_requested;
65}; 67};
66 68
@@ -160,7 +162,7 @@ static int tegra_wm8903_event_int_spk(struct snd_soc_dapm_widget *w,
160 struct snd_soc_dapm_context *dapm = w->dapm; 162 struct snd_soc_dapm_context *dapm = w->dapm;
161 struct snd_soc_card *card = dapm->card; 163 struct snd_soc_card *card = dapm->card;
162 struct tegra_wm8903 *machine = snd_soc_card_get_drvdata(card); 164 struct tegra_wm8903 *machine = snd_soc_card_get_drvdata(card);
163 struct tegra_wm8903_platform_data *pdata = machine->pdata; 165 struct tegra_wm8903_platform_data *pdata = &machine->pdata;
164 166
165 if (!(machine->gpio_requested & GPIO_SPKR_EN)) 167 if (!(machine->gpio_requested & GPIO_SPKR_EN))
166 return 0; 168 return 0;
@@ -177,7 +179,7 @@ static int tegra_wm8903_event_hp(struct snd_soc_dapm_widget *w,
177 struct snd_soc_dapm_context *dapm = w->dapm; 179 struct snd_soc_dapm_context *dapm = w->dapm;
178 struct snd_soc_card *card = dapm->card; 180 struct snd_soc_card *card = dapm->card;
179 struct tegra_wm8903 *machine = snd_soc_card_get_drvdata(card); 181 struct tegra_wm8903 *machine = snd_soc_card_get_drvdata(card);
180 struct tegra_wm8903_platform_data *pdata = machine->pdata; 182 struct tegra_wm8903_platform_data *pdata = &machine->pdata;
181 183
182 if (!(machine->gpio_requested & GPIO_HP_MUTE)) 184 if (!(machine->gpio_requested & GPIO_HP_MUTE))
183 return 0; 185 return 0;
@@ -201,8 +203,8 @@ static const struct snd_soc_dapm_route harmony_audio_map[] = {
201 {"Int Spk", NULL, "RON"}, 203 {"Int Spk", NULL, "RON"},
202 {"Int Spk", NULL, "LOP"}, 204 {"Int Spk", NULL, "LOP"},
203 {"Int Spk", NULL, "LON"}, 205 {"Int Spk", NULL, "LON"},
204 {"Mic Bias", NULL, "Mic Jack"}, 206 {"Mic Jack", NULL, "MICBIAS"},
205 {"IN1L", NULL, "Mic Bias"}, 207 {"IN1L", NULL, "Mic Jack"},
206}; 208};
207 209
208static const struct snd_soc_dapm_route seaboard_audio_map[] = { 210static const struct snd_soc_dapm_route seaboard_audio_map[] = {
@@ -212,8 +214,8 @@ static const struct snd_soc_dapm_route seaboard_audio_map[] = {
212 {"Int Spk", NULL, "RON"}, 214 {"Int Spk", NULL, "RON"},
213 {"Int Spk", NULL, "LOP"}, 215 {"Int Spk", NULL, "LOP"},
214 {"Int Spk", NULL, "LON"}, 216 {"Int Spk", NULL, "LON"},
215 {"Mic Bias", NULL, "Mic Jack"}, 217 {"Mic Jack", NULL, "MICBIAS"},
216 {"IN1R", NULL, "Mic Bias"}, 218 {"IN1R", NULL, "Mic Jack"},
217}; 219};
218 220
219static const struct snd_soc_dapm_route kaen_audio_map[] = { 221static const struct snd_soc_dapm_route kaen_audio_map[] = {
@@ -223,8 +225,8 @@ static const struct snd_soc_dapm_route kaen_audio_map[] = {
223 {"Int Spk", NULL, "RON"}, 225 {"Int Spk", NULL, "RON"},
224 {"Int Spk", NULL, "LOP"}, 226 {"Int Spk", NULL, "LOP"},
225 {"Int Spk", NULL, "LON"}, 227 {"Int Spk", NULL, "LON"},
226 {"Mic Bias", NULL, "Mic Jack"}, 228 {"Mic Jack", NULL, "MICBIAS"},
227 {"IN2R", NULL, "Mic Bias"}, 229 {"IN2R", NULL, "Mic Jack"},
228}; 230};
229 231
230static const struct snd_soc_dapm_route aebl_audio_map[] = { 232static const struct snd_soc_dapm_route aebl_audio_map[] = {
@@ -232,8 +234,8 @@ static const struct snd_soc_dapm_route aebl_audio_map[] = {
232 {"Headphone Jack", NULL, "HPOUTL"}, 234 {"Headphone Jack", NULL, "HPOUTL"},
233 {"Int Spk", NULL, "LINEOUTR"}, 235 {"Int Spk", NULL, "LINEOUTR"},
234 {"Int Spk", NULL, "LINEOUTL"}, 236 {"Int Spk", NULL, "LINEOUTL"},
235 {"Mic Bias", NULL, "Mic Jack"}, 237 {"Mic Jack", NULL, "MICBIAS"},
236 {"IN1R", NULL, "Mic Bias"}, 238 {"IN1R", NULL, "Mic Jack"},
237}; 239};
238 240
239static const struct snd_kcontrol_new tegra_wm8903_controls[] = { 241static const struct snd_kcontrol_new tegra_wm8903_controls[] = {
@@ -246,9 +248,36 @@ static int tegra_wm8903_init(struct snd_soc_pcm_runtime *rtd)
246 struct snd_soc_dapm_context *dapm = &codec->dapm; 248 struct snd_soc_dapm_context *dapm = &codec->dapm;
247 struct snd_soc_card *card = codec->card; 249 struct snd_soc_card *card = codec->card;
248 struct tegra_wm8903 *machine = snd_soc_card_get_drvdata(card); 250 struct tegra_wm8903 *machine = snd_soc_card_get_drvdata(card);
249 struct tegra_wm8903_platform_data *pdata = machine->pdata; 251 struct tegra_wm8903_platform_data *pdata = &machine->pdata;
252 struct device_node *np = card->dev->of_node;
250 int ret; 253 int ret;
251 254
255 if (card->dev->platform_data) {
256 memcpy(pdata, card->dev->platform_data, sizeof(*pdata));
257 } else if (np) {
258 /*
259 * This part must be in init() rather than probe() in order to
260 * guarantee that the WM8903 has been probed, and hence its
261 * GPIO controller registered, which is a pre-condition for
262 * of_get_named_gpio() to be able to map the phandles in the
263 * properties to the controller node. Given this, all
264 * pdata handling is in init() for consistency.
265 */
266 pdata->gpio_spkr_en = of_get_named_gpio(np,
267 "nvidia,spkr-en-gpios", 0);
268 pdata->gpio_hp_mute = of_get_named_gpio(np,
269 "nvidia,hp-mute-gpios", 0);
270 pdata->gpio_hp_det = of_get_named_gpio(np,
271 "nvidia,hp-det-gpios", 0);
272 pdata->gpio_int_mic_en = of_get_named_gpio(np,
273 "nvidia,int-mic-en-gpios", 0);
274 pdata->gpio_ext_mic_en = of_get_named_gpio(np,
275 "nvidia,ext-mic-en-gpios", 0);
276 } else {
277 dev_err(card->dev, "No platform data supplied\n");
278 return -EINVAL;
279 }
280
252 if (gpio_is_valid(pdata->gpio_spkr_en)) { 281 if (gpio_is_valid(pdata->gpio_spkr_en)) {
253 ret = gpio_request(pdata->gpio_spkr_en, "spkr_en"); 282 ret = gpio_request(pdata->gpio_spkr_en, "spkr_en");
254 if (ret) { 283 if (ret) {
@@ -316,28 +345,7 @@ static int tegra_wm8903_init(struct snd_soc_pcm_runtime *rtd)
316 wm8903_mic_detect(codec, &tegra_wm8903_mic_jack, SND_JACK_MICROPHONE, 345 wm8903_mic_detect(codec, &tegra_wm8903_mic_jack, SND_JACK_MICROPHONE,
317 0); 346 0);
318 347
319 snd_soc_dapm_force_enable_pin(dapm, "Mic Bias"); 348 snd_soc_dapm_force_enable_pin(dapm, "MICBIAS");
320
321 /* FIXME: Calculate automatically based on DAPM routes? */
322 if (!machine_is_harmony())
323 snd_soc_dapm_nc_pin(dapm, "IN1L");
324 if (!machine_is_seaboard() && !machine_is_aebl())
325 snd_soc_dapm_nc_pin(dapm, "IN1R");
326 snd_soc_dapm_nc_pin(dapm, "IN2L");
327 if (!machine_is_kaen())
328 snd_soc_dapm_nc_pin(dapm, "IN2R");
329 snd_soc_dapm_nc_pin(dapm, "IN3L");
330 snd_soc_dapm_nc_pin(dapm, "IN3R");
331
332 if (machine_is_aebl()) {
333 snd_soc_dapm_nc_pin(dapm, "LON");
334 snd_soc_dapm_nc_pin(dapm, "RON");
335 snd_soc_dapm_nc_pin(dapm, "ROP");
336 snd_soc_dapm_nc_pin(dapm, "LOP");
337 } else {
338 snd_soc_dapm_nc_pin(dapm, "LINEOUTR");
339 snd_soc_dapm_nc_pin(dapm, "LINEOUTL");
340 }
341 349
342 return 0; 350 return 0;
343} 351}
@@ -355,6 +363,7 @@ static struct snd_soc_dai_link tegra_wm8903_dai = {
355 363
356static struct snd_soc_card snd_soc_tegra_wm8903 = { 364static struct snd_soc_card snd_soc_tegra_wm8903 = {
357 .name = "tegra-wm8903", 365 .name = "tegra-wm8903",
366 .owner = THIS_MODULE,
358 .dai_link = &tegra_wm8903_dai, 367 .dai_link = &tegra_wm8903_dai,
359 .num_links = 1, 368 .num_links = 1,
360 369
@@ -362,51 +371,91 @@ static struct snd_soc_card snd_soc_tegra_wm8903 = {
362 .num_controls = ARRAY_SIZE(tegra_wm8903_controls), 371 .num_controls = ARRAY_SIZE(tegra_wm8903_controls),
363 .dapm_widgets = tegra_wm8903_dapm_widgets, 372 .dapm_widgets = tegra_wm8903_dapm_widgets,
364 .num_dapm_widgets = ARRAY_SIZE(tegra_wm8903_dapm_widgets), 373 .num_dapm_widgets = ARRAY_SIZE(tegra_wm8903_dapm_widgets),
374 .fully_routed = true,
365}; 375};
366 376
367static __devinit int tegra_wm8903_driver_probe(struct platform_device *pdev) 377static __devinit int tegra_wm8903_driver_probe(struct platform_device *pdev)
368{ 378{
369 struct snd_soc_card *card = &snd_soc_tegra_wm8903; 379 struct snd_soc_card *card = &snd_soc_tegra_wm8903;
370 struct tegra_wm8903 *machine; 380 struct tegra_wm8903 *machine;
371 struct tegra_wm8903_platform_data *pdata;
372 int ret; 381 int ret;
373 382
374 pdata = pdev->dev.platform_data; 383 if (!pdev->dev.platform_data && !pdev->dev.of_node) {
375 if (!pdata) {
376 dev_err(&pdev->dev, "No platform data supplied\n"); 384 dev_err(&pdev->dev, "No platform data supplied\n");
377 return -EINVAL; 385 return -EINVAL;
378 } 386 }
379 387
380 machine = kzalloc(sizeof(struct tegra_wm8903), GFP_KERNEL); 388 machine = devm_kzalloc(&pdev->dev, sizeof(struct tegra_wm8903),
389 GFP_KERNEL);
381 if (!machine) { 390 if (!machine) {
382 dev_err(&pdev->dev, "Can't allocate tegra_wm8903 struct\n"); 391 dev_err(&pdev->dev, "Can't allocate tegra_wm8903 struct\n");
383 return -ENOMEM; 392 ret = -ENOMEM;
393 goto err;
384 } 394 }
385 395 machine->pcm_dev = ERR_PTR(-EINVAL);
386 machine->pdata = pdata;
387
388 ret = tegra_asoc_utils_init(&machine->util_data, &pdev->dev);
389 if (ret)
390 goto err_free_machine;
391 396
392 card->dev = &pdev->dev; 397 card->dev = &pdev->dev;
393 platform_set_drvdata(pdev, card); 398 platform_set_drvdata(pdev, card);
394 snd_soc_card_set_drvdata(card, machine); 399 snd_soc_card_set_drvdata(card, machine);
395 400
396 if (machine_is_harmony()) { 401 if (pdev->dev.of_node) {
397 card->dapm_routes = harmony_audio_map; 402 ret = snd_soc_of_parse_card_name(card, "nvidia,model");
398 card->num_dapm_routes = ARRAY_SIZE(harmony_audio_map); 403 if (ret)
399 } else if (machine_is_seaboard()) { 404 goto err;
400 card->dapm_routes = seaboard_audio_map; 405
401 card->num_dapm_routes = ARRAY_SIZE(seaboard_audio_map); 406 ret = snd_soc_of_parse_audio_routing(card,
402 } else if (machine_is_kaen()) { 407 "nvidia,audio-routing");
403 card->dapm_routes = kaen_audio_map; 408 if (ret)
404 card->num_dapm_routes = ARRAY_SIZE(kaen_audio_map); 409 goto err;
410
411 tegra_wm8903_dai.codec_name = NULL;
412 tegra_wm8903_dai.codec_of_node = of_parse_phandle(
413 pdev->dev.of_node, "nvidia,audio-codec", 0);
414 if (!tegra_wm8903_dai.codec_of_node) {
415 dev_err(&pdev->dev,
416 "Property 'nvidia,audio-codec' missing or invalid\n");
417 ret = -EINVAL;
418 goto err;
419 }
420
421 tegra_wm8903_dai.cpu_dai_name = NULL;
422 tegra_wm8903_dai.cpu_dai_of_node = of_parse_phandle(
423 pdev->dev.of_node, "nvidia,i2s-controller", 0);
424 if (!tegra_wm8903_dai.cpu_dai_of_node) {
425 dev_err(&pdev->dev,
426 "Property 'nvidia,i2s-controller' missing or invalid\n");
427 ret = -EINVAL;
428 goto err;
429 }
430
431 machine->pcm_dev = platform_device_register_simple(
432 "tegra-pcm-audio", -1, NULL, 0);
433 if (IS_ERR(machine->pcm_dev)) {
434 dev_err(&pdev->dev,
435 "Can't instantiate tegra-pcm-audio\n");
436 ret = PTR_ERR(machine->pcm_dev);
437 goto err;
438 }
405 } else { 439 } else {
406 card->dapm_routes = aebl_audio_map; 440 if (machine_is_harmony()) {
407 card->num_dapm_routes = ARRAY_SIZE(aebl_audio_map); 441 card->dapm_routes = harmony_audio_map;
442 card->num_dapm_routes = ARRAY_SIZE(harmony_audio_map);
443 } else if (machine_is_seaboard()) {
444 card->dapm_routes = seaboard_audio_map;
445 card->num_dapm_routes = ARRAY_SIZE(seaboard_audio_map);
446 } else if (machine_is_kaen()) {
447 card->dapm_routes = kaen_audio_map;
448 card->num_dapm_routes = ARRAY_SIZE(kaen_audio_map);
449 } else {
450 card->dapm_routes = aebl_audio_map;
451 card->num_dapm_routes = ARRAY_SIZE(aebl_audio_map);
452 }
408 } 453 }
409 454
455 ret = tegra_asoc_utils_init(&machine->util_data, &pdev->dev);
456 if (ret)
457 goto err_unregister;
458
410 ret = snd_soc_register_card(card); 459 ret = snd_soc_register_card(card);
411 if (ret) { 460 if (ret) {
412 dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n", 461 dev_err(&pdev->dev, "snd_soc_register_card failed (%d)\n",
@@ -418,8 +467,10 @@ static __devinit int tegra_wm8903_driver_probe(struct platform_device *pdev)
418 467
419err_fini_utils: 468err_fini_utils:
420 tegra_asoc_utils_fini(&machine->util_data); 469 tegra_asoc_utils_fini(&machine->util_data);
421err_free_machine: 470err_unregister:
422 kfree(machine); 471 if (!IS_ERR(machine->pcm_dev))
472 platform_device_unregister(machine->pcm_dev);
473err:
423 return ret; 474 return ret;
424} 475}
425 476
@@ -427,7 +478,7 @@ static int __devexit tegra_wm8903_driver_remove(struct platform_device *pdev)
427{ 478{
428 struct snd_soc_card *card = platform_get_drvdata(pdev); 479 struct snd_soc_card *card = platform_get_drvdata(pdev);
429 struct tegra_wm8903 *machine = snd_soc_card_get_drvdata(card); 480 struct tegra_wm8903 *machine = snd_soc_card_get_drvdata(card);
430 struct tegra_wm8903_platform_data *pdata = machine->pdata; 481 struct tegra_wm8903_platform_data *pdata = &machine->pdata;
431 482
432 if (machine->gpio_requested & GPIO_HP_DET) 483 if (machine->gpio_requested & GPIO_HP_DET)
433 snd_soc_jack_free_gpios(&tegra_wm8903_hp_jack, 484 snd_soc_jack_free_gpios(&tegra_wm8903_hp_jack,
@@ -446,35 +497,31 @@ static int __devexit tegra_wm8903_driver_remove(struct platform_device *pdev)
446 snd_soc_unregister_card(card); 497 snd_soc_unregister_card(card);
447 498
448 tegra_asoc_utils_fini(&machine->util_data); 499 tegra_asoc_utils_fini(&machine->util_data);
449 500 if (!IS_ERR(machine->pcm_dev))
450 kfree(machine); 501 platform_device_unregister(machine->pcm_dev);
451 502
452 return 0; 503 return 0;
453} 504}
454 505
506static const struct of_device_id tegra_wm8903_of_match[] __devinitconst = {
507 { .compatible = "nvidia,tegra-audio-wm8903", },
508 {},
509};
510
455static struct platform_driver tegra_wm8903_driver = { 511static struct platform_driver tegra_wm8903_driver = {
456 .driver = { 512 .driver = {
457 .name = DRV_NAME, 513 .name = DRV_NAME,
458 .owner = THIS_MODULE, 514 .owner = THIS_MODULE,
459 .pm = &snd_soc_pm_ops, 515 .pm = &snd_soc_pm_ops,
516 .of_match_table = tegra_wm8903_of_match,
460 }, 517 },
461 .probe = tegra_wm8903_driver_probe, 518 .probe = tegra_wm8903_driver_probe,
462 .remove = __devexit_p(tegra_wm8903_driver_remove), 519 .remove = __devexit_p(tegra_wm8903_driver_remove),
463}; 520};
464 521module_platform_driver(tegra_wm8903_driver);
465static int __init tegra_wm8903_modinit(void)
466{
467 return platform_driver_register(&tegra_wm8903_driver);
468}
469module_init(tegra_wm8903_modinit);
470
471static void __exit tegra_wm8903_modexit(void)
472{
473 platform_driver_unregister(&tegra_wm8903_driver);
474}
475module_exit(tegra_wm8903_modexit);
476 522
477MODULE_AUTHOR("Stephen Warren <swarren@nvidia.com>"); 523MODULE_AUTHOR("Stephen Warren <swarren@nvidia.com>");
478MODULE_DESCRIPTION("Tegra+WM8903 machine ASoC driver"); 524MODULE_DESCRIPTION("Tegra+WM8903 machine ASoC driver");
479MODULE_LICENSE("GPL"); 525MODULE_LICENSE("GPL");
480MODULE_ALIAS("platform:" DRV_NAME); 526MODULE_ALIAS("platform:" DRV_NAME);
527MODULE_DEVICE_TABLE(of, tegra_wm8903_of_match);
diff --git a/sound/soc/tegra/trimslice.c b/sound/soc/tegra/trimslice.c
index b3a7efa6d96..2bdfc550cff 100644
--- a/sound/soc/tegra/trimslice.c
+++ b/sound/soc/tegra/trimslice.c
@@ -115,18 +115,6 @@ static const struct snd_soc_dapm_route trimslice_audio_map[] = {
115 {"RLINEIN", NULL, "Line In"}, 115 {"RLINEIN", NULL, "Line In"},
116}; 116};
117 117
118static int trimslice_asoc_init(struct snd_soc_pcm_runtime *rtd)
119{
120 struct snd_soc_codec *codec = rtd->codec;
121 struct snd_soc_dapm_context *dapm = &codec->dapm;
122
123 snd_soc_dapm_nc_pin(dapm, "LHPOUT");
124 snd_soc_dapm_nc_pin(dapm, "RHPOUT");
125 snd_soc_dapm_nc_pin(dapm, "MICIN");
126
127 return 0;
128}
129
130static struct snd_soc_dai_link trimslice_tlv320aic23_dai = { 118static struct snd_soc_dai_link trimslice_tlv320aic23_dai = {
131 .name = "TLV320AIC23", 119 .name = "TLV320AIC23",
132 .stream_name = "AIC23", 120 .stream_name = "AIC23",
@@ -134,12 +122,12 @@ static struct snd_soc_dai_link trimslice_tlv320aic23_dai = {
134 .platform_name = "tegra-pcm-audio", 122 .platform_name = "tegra-pcm-audio",
135 .cpu_dai_name = "tegra-i2s.0", 123 .cpu_dai_name = "tegra-i2s.0",
136 .codec_dai_name = "tlv320aic23-hifi", 124 .codec_dai_name = "tlv320aic23-hifi",
137 .init = trimslice_asoc_init,
138 .ops = &trimslice_asoc_ops, 125 .ops = &trimslice_asoc_ops,
139}; 126};
140 127
141static struct snd_soc_card snd_soc_trimslice = { 128static struct snd_soc_card snd_soc_trimslice = {
142 .name = "tegra-trimslice", 129 .name = "tegra-trimslice",
130 .owner = THIS_MODULE,
143 .dai_link = &trimslice_tlv320aic23_dai, 131 .dai_link = &trimslice_tlv320aic23_dai,
144 .num_links = 1, 132 .num_links = 1,
145 133
@@ -147,6 +135,7 @@ static struct snd_soc_card snd_soc_trimslice = {
147 .num_dapm_widgets = ARRAY_SIZE(trimslice_dapm_widgets), 135 .num_dapm_widgets = ARRAY_SIZE(trimslice_dapm_widgets),
148 .dapm_routes = trimslice_audio_map, 136 .dapm_routes = trimslice_audio_map,
149 .num_dapm_routes = ARRAY_SIZE(trimslice_audio_map), 137 .num_dapm_routes = ARRAY_SIZE(trimslice_audio_map),
138 .fully_routed = true,
150}; 139};
151 140
152static __devinit int tegra_snd_trimslice_probe(struct platform_device *pdev) 141static __devinit int tegra_snd_trimslice_probe(struct platform_device *pdev)
@@ -155,15 +144,17 @@ static __devinit int tegra_snd_trimslice_probe(struct platform_device *pdev)
155 struct tegra_trimslice *trimslice; 144 struct tegra_trimslice *trimslice;
156 int ret; 145 int ret;
157 146
158 trimslice = kzalloc(sizeof(struct tegra_trimslice), GFP_KERNEL); 147 trimslice = devm_kzalloc(&pdev->dev, sizeof(struct tegra_trimslice),
148 GFP_KERNEL);
159 if (!trimslice) { 149 if (!trimslice) {
160 dev_err(&pdev->dev, "Can't allocate tegra_trimslice\n"); 150 dev_err(&pdev->dev, "Can't allocate tegra_trimslice\n");
161 return -ENOMEM; 151 ret = -ENOMEM;
152 goto err;
162 } 153 }
163 154
164 ret = tegra_asoc_utils_init(&trimslice->util_data, &pdev->dev); 155 ret = tegra_asoc_utils_init(&trimslice->util_data, &pdev->dev);
165 if (ret) 156 if (ret)
166 goto err_free_trimslice; 157 goto err;
167 158
168 card->dev = &pdev->dev; 159 card->dev = &pdev->dev;
169 platform_set_drvdata(pdev, card); 160 platform_set_drvdata(pdev, card);
@@ -180,8 +171,7 @@ static __devinit int tegra_snd_trimslice_probe(struct platform_device *pdev)
180 171
181err_fini_utils: 172err_fini_utils:
182 tegra_asoc_utils_fini(&trimslice->util_data); 173 tegra_asoc_utils_fini(&trimslice->util_data);
183err_free_trimslice: 174err:
184 kfree(trimslice);
185 return ret; 175 return ret;
186} 176}
187 177
@@ -194,8 +184,6 @@ static int __devexit tegra_snd_trimslice_remove(struct platform_device *pdev)
194 184
195 tegra_asoc_utils_fini(&trimslice->util_data); 185 tegra_asoc_utils_fini(&trimslice->util_data);
196 186
197 kfree(trimslice);
198
199 return 0; 187 return 0;
200} 188}
201 189
@@ -207,18 +195,7 @@ static struct platform_driver tegra_snd_trimslice_driver = {
207 .probe = tegra_snd_trimslice_probe, 195 .probe = tegra_snd_trimslice_probe,
208 .remove = __devexit_p(tegra_snd_trimslice_remove), 196 .remove = __devexit_p(tegra_snd_trimslice_remove),
209}; 197};
210 198module_platform_driver(tegra_snd_trimslice_driver);
211static int __init snd_tegra_trimslice_init(void)
212{
213 return platform_driver_register(&tegra_snd_trimslice_driver);
214}
215module_init(snd_tegra_trimslice_init);
216
217static void __exit snd_tegra_trimslice_exit(void)
218{
219 platform_driver_unregister(&tegra_snd_trimslice_driver);
220}
221module_exit(snd_tegra_trimslice_exit);
222 199
223MODULE_AUTHOR("Mike Rapoport <mike@compulab.co.il>"); 200MODULE_AUTHOR("Mike Rapoport <mike@compulab.co.il>");
224MODULE_DESCRIPTION("Trimslice machine ASoC driver"); 201MODULE_DESCRIPTION("Trimslice machine ASoC driver");
diff --git a/sound/soc/txx9/txx9aclc-ac97.c b/sound/soc/txx9/txx9aclc-ac97.c
index a4e3f550184..28db4ca997c 100644
--- a/sound/soc/txx9/txx9aclc-ac97.c
+++ b/sound/soc/txx9/txx9aclc-ac97.c
@@ -223,18 +223,7 @@ static struct platform_driver txx9aclc_ac97_driver = {
223 }, 223 },
224}; 224};
225 225
226static int __init txx9aclc_ac97_init(void) 226module_platform_driver(txx9aclc_ac97_driver);
227{
228 return platform_driver_register(&txx9aclc_ac97_driver);
229}
230
231static void __exit txx9aclc_ac97_exit(void)
232{
233 platform_driver_unregister(&txx9aclc_ac97_driver);
234}
235
236module_init(txx9aclc_ac97_init);
237module_exit(txx9aclc_ac97_exit);
238 227
239MODULE_AUTHOR("Atsushi Nemoto <anemo@mba.ocn.ne.jp>"); 228MODULE_AUTHOR("Atsushi Nemoto <anemo@mba.ocn.ne.jp>");
240MODULE_DESCRIPTION("TXx9 ACLC AC97 driver"); 229MODULE_DESCRIPTION("TXx9 ACLC AC97 driver");
diff --git a/sound/soc/txx9/txx9aclc-generic.c b/sound/soc/txx9/txx9aclc-generic.c
index 9b5e283af51..b056a1431ed 100644
--- a/sound/soc/txx9/txx9aclc-generic.c
+++ b/sound/soc/txx9/txx9aclc-generic.c
@@ -32,6 +32,7 @@ static struct snd_soc_dai_link txx9aclc_generic_dai = {
32 32
33static struct snd_soc_card txx9aclc_generic_card = { 33static struct snd_soc_card txx9aclc_generic_card = {
34 .name = "Generic TXx9 ACLC Audio", 34 .name = "Generic TXx9 ACLC Audio",
35 .owner = THIS_MODULE,
35 .dai_link = &txx9aclc_generic_dai, 36 .dai_link = &txx9aclc_generic_dai,
36 .num_links = 1, 37 .num_links = 1,
37}; 38};
diff --git a/sound/soc/txx9/txx9aclc.c b/sound/soc/txx9/txx9aclc.c
index 3de99af8cb8..93931def0dc 100644
--- a/sound/soc/txx9/txx9aclc.c
+++ b/sound/soc/txx9/txx9aclc.c
@@ -438,17 +438,7 @@ static struct platform_driver txx9aclc_pcm_driver = {
438 .remove = __devexit_p(txx9aclc_soc_platform_remove), 438 .remove = __devexit_p(txx9aclc_soc_platform_remove),
439}; 439};
440 440
441static int __init snd_txx9aclc_pcm_init(void) 441module_platform_driver(txx9aclc_pcm_driver);
442{
443 return platform_driver_register(&txx9aclc_pcm_driver);
444}
445module_init(snd_txx9aclc_pcm_init);
446
447static void __exit snd_txx9aclc_pcm_exit(void)
448{
449 platform_driver_unregister(&txx9aclc_pcm_driver);
450}
451module_exit(snd_txx9aclc_pcm_exit);
452 442
453MODULE_AUTHOR("Atsushi Nemoto <anemo@mba.ocn.ne.jp>"); 443MODULE_AUTHOR("Atsushi Nemoto <anemo@mba.ocn.ne.jp>");
454MODULE_DESCRIPTION("TXx9 ACLC Audio DMA driver"); 444MODULE_DESCRIPTION("TXx9 ACLC Audio DMA driver");