aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
Diffstat (limited to 'sound')
-rw-r--r--sound/aoa/codecs/Kconfig8
-rw-r--r--sound/arm/aaci.c2
-rw-r--r--sound/arm/pxa2xx-ac97.c13
-rw-r--r--sound/atmel/abdac.c2
-rw-r--r--sound/atmel/ac97c.c14
-rw-r--r--sound/core/Kconfig7
-rw-r--r--sound/core/Makefile5
-rw-r--r--sound/core/compress_offload.c765
-rw-r--r--sound/core/ctljack.c56
-rw-r--r--sound/core/oss/pcm_oss.c2
-rw-r--r--sound/core/seq/seq_dummy.c2
-rw-r--r--sound/core/sound.c1
-rw-r--r--sound/drivers/aloop.c2
-rw-r--r--sound/drivers/dummy.c6
-rw-r--r--sound/drivers/ml403-ac97cr.c15
-rw-r--r--sound/drivers/mpu401/mpu401.c6
-rw-r--r--sound/drivers/mts64.c2
-rw-r--r--sound/drivers/opl3/opl3_midi.c2
-rw-r--r--sound/drivers/opl3/opl3_seq.c2
-rw-r--r--sound/drivers/pcsp/pcsp.c4
-rw-r--r--sound/drivers/pcsp/pcsp_lib.c2
-rw-r--r--sound/drivers/portman2x4.c2
-rw-r--r--sound/drivers/serial-u16550.c4
-rw-r--r--sound/drivers/virmidi.c2
-rw-r--r--sound/isa/ad1816a/ad1816a.c2
-rw-r--r--sound/isa/ad1848/ad1848.c4
-rw-r--r--sound/isa/adlib.c2
-rw-r--r--sound/isa/als100.c2
-rw-r--r--sound/isa/azt2320.c2
-rw-r--r--sound/isa/cmi8330.c4
-rw-r--r--sound/isa/cs423x/cs4231.c2
-rw-r--r--sound/isa/cs423x/cs4236.c4
-rw-r--r--sound/isa/es1688/es1688.c4
-rw-r--r--sound/isa/es18xx.c4
-rw-r--r--sound/isa/galaxy/galaxy.c2
-rw-r--r--sound/isa/gus/gusclassic.c2
-rw-r--r--sound/isa/gus/gusextreme.c2
-rw-r--r--sound/isa/gus/gusmax.c2
-rw-r--r--sound/isa/gus/interwave.c4
-rw-r--r--sound/isa/msnd/msnd_pinnacle.c2
-rw-r--r--sound/isa/opl3sa2.c4
-rw-r--r--sound/isa/opti9xx/miro.c2
-rw-r--r--sound/isa/opti9xx/opti92x-ad1848.c2
-rw-r--r--sound/isa/sb/jazz16.c2
-rw-r--r--sound/isa/sb/sb16.c4
-rw-r--r--sound/isa/sb/sb8.c2
-rw-r--r--sound/isa/sc6000.c2
-rw-r--r--sound/isa/wavefront/wavefront.c6
-rw-r--r--sound/mips/hal2.c13
-rw-r--r--sound/mips/sgio2audio.c13
-rw-r--r--sound/oss/Kconfig2
-rw-r--r--sound/oss/ad1848.c8
-rw-r--r--sound/oss/msnd_pinnacle.c2
-rw-r--r--sound/oss/pas2_card.c12
-rw-r--r--sound/oss/pss.c10
-rw-r--r--sound/oss/trix.c2
-rw-r--r--sound/pci/ac97/ac97_codec.c2
-rw-r--r--sound/pci/ad1889.c2
-rw-r--r--sound/pci/ali5451/ali5451.c4
-rw-r--r--sound/pci/als300.c9
-rw-r--r--sound/pci/als4000.c2
-rw-r--r--sound/pci/asihpi/asihpi.c294
-rw-r--r--sound/pci/asihpi/hpi.h74
-rw-r--r--sound/pci/asihpi/hpi6000.c61
-rw-r--r--sound/pci/asihpi/hpi6000.h2
-rw-r--r--sound/pci/asihpi/hpi6205.c57
-rw-r--r--sound/pci/asihpi/hpi_internal.h115
-rw-r--r--sound/pci/asihpi/hpi_version.h32
-rw-r--r--sound/pci/asihpi/hpicmn.c32
-rw-r--r--sound/pci/asihpi/hpicmn.h13
-rw-r--r--sound/pci/asihpi/hpidebug.c2
-rw-r--r--sound/pci/asihpi/hpidebug.h2
-rw-r--r--sound/pci/asihpi/hpidspcd.c30
-rw-r--r--sound/pci/asihpi/hpidspcd.h4
-rw-r--r--sound/pci/asihpi/hpifunc.c10
-rw-r--r--sound/pci/asihpi/hpimsginit.c2
-rw-r--r--sound/pci/asihpi/hpimsginit.h2
-rw-r--r--sound/pci/asihpi/hpimsgx.c3
-rw-r--r--sound/pci/asihpi/hpimsgx.h2
-rw-r--r--sound/pci/asihpi/hpioctl.c63
-rw-r--r--sound/pci/asihpi/hpioctl.h2
-rw-r--r--sound/pci/asihpi/hpios.c2
-rw-r--r--sound/pci/asihpi/hpios.h16
-rw-r--r--sound/pci/asihpi/hpipcida.h2
-rw-r--r--sound/pci/atiixp.c4
-rw-r--r--sound/pci/atiixp_modem.c2
-rw-r--r--sound/pci/au88x0/au88x0.c15
-rw-r--r--sound/pci/au88x0/au88x0.h1
-rw-r--r--sound/pci/au88x0/au88x0_core.c10
-rw-r--r--sound/pci/au88x0/au88x0_pcm.c8
-rw-r--r--sound/pci/au88x0/au88x0_xtalk.c151
-rw-r--r--sound/pci/aw2/aw2-alsa.c2
-rw-r--r--sound/pci/azt3328.c2
-rw-r--r--sound/pci/bt87x.c4
-rw-r--r--sound/pci/ca0106/ca0106_main.c2
-rw-r--r--sound/pci/cmipci.c4
-rw-r--r--sound/pci/cs4281.c4
-rw-r--r--sound/pci/cs46xx/cs46xx.c8
-rw-r--r--sound/pci/cs5530.c9
-rw-r--r--sound/pci/cs5535audio/cs5535audio.c2
-rw-r--r--sound/pci/ctxfi/ctsrc.c2
-rw-r--r--sound/pci/ctxfi/cttimer.c4
-rw-r--r--sound/pci/ctxfi/xfi.c2
-rw-r--r--sound/pci/echoaudio/echoaudio.c2
-rw-r--r--sound/pci/emu10k1/emu10k1.c4
-rw-r--r--sound/pci/emu10k1/emu10k1_main.c12
-rw-r--r--sound/pci/emu10k1/emu10k1x.c2
-rw-r--r--sound/pci/ens1370.c4
-rw-r--r--sound/pci/es1938.c2
-rw-r--r--sound/pci/es1968.c4
-rw-r--r--sound/pci/fm801.c2
-rw-r--r--sound/pci/hda/Kconfig1
-rw-r--r--sound/pci/hda/Makefile2
-rw-r--r--sound/pci/hda/alc262_quirks.c875
-rw-r--r--sound/pci/hda/alc880_quirks.c193
-rw-r--r--sound/pci/hda/alc882_quirks.c2867
-rw-r--r--sound/pci/hda/hda_codec.c302
-rw-r--r--sound/pci/hda/hda_codec.h6
-rw-r--r--sound/pci/hda/hda_intel.c116
-rw-r--r--sound/pci/hda/hda_jack.c353
-rw-r--r--sound/pci/hda/hda_jack.h86
-rw-r--r--sound/pci/hda/hda_local.h51
-rw-r--r--sound/pci/hda/hda_proc.c2
-rw-r--r--sound/pci/hda/patch_analog.c1
-rw-r--r--sound/pci/hda/patch_ca0110.c6
-rw-r--r--sound/pci/hda/patch_cirrus.c187
-rw-r--r--sound/pci/hda/patch_conexant.c79
-rw-r--r--sound/pci/hda/patch_hdmi.c59
-rw-r--r--sound/pci/hda/patch_realtek.c758
-rw-r--r--sound/pci/hda/patch_sigmatel.c323
-rw-r--r--sound/pci/hda/patch_via.c30
-rw-r--r--sound/pci/ice1712/amp.c7
-rw-r--r--sound/pci/ice1712/envy24ht.h1
-rw-r--r--sound/pci/ice1712/ice1712.c4
-rw-r--r--sound/pci/ice1712/ice1724.c65
-rw-r--r--sound/pci/intel8x0.c10
-rw-r--r--sound/pci/intel8x0m.c2
-rw-r--r--sound/pci/korg1212/korg1212.c2
-rw-r--r--sound/pci/lola/lola.c2
-rw-r--r--sound/pci/lx6464es/lx6464es.c2
-rw-r--r--sound/pci/maestro3.c4
-rw-r--r--sound/pci/mixart/mixart.c2
-rw-r--r--sound/pci/nm256/nm256.c12
-rw-r--r--sound/pci/oxygen/oxygen.c2
-rw-r--r--sound/pci/oxygen/virtuoso.c2
-rw-r--r--sound/pci/oxygen/xonar_cs43xx.c1
-rw-r--r--sound/pci/oxygen/xonar_dg.c3
-rw-r--r--sound/pci/oxygen/xonar_wm87x6.c7
-rw-r--r--sound/pci/pcxhr/pcxhr.c4
-rw-r--r--sound/pci/riptide/riptide.c2
-rw-r--r--sound/pci/rme32.c4
-rw-r--r--sound/pci/rme96.c2
-rw-r--r--sound/pci/rme9652/hdsp.c5
-rw-r--r--sound/pci/rme9652/hdspm.c32
-rw-r--r--sound/pci/rme9652/rme9652.c4
-rw-r--r--sound/pci/sis7019.c89
-rw-r--r--sound/pci/sonicvibes.c6
-rw-r--r--sound/pci/trident/trident.c2
-rw-r--r--sound/pci/via82xx.c4
-rw-r--r--sound/pci/via82xx_modem.c2
-rw-r--r--sound/pci/vx222/vx222.c4
-rw-r--r--sound/pci/ymfpci/ymfpci.c4
-rw-r--r--sound/pcmcia/pdaudiocf/pdaudiocf.c2
-rw-r--r--sound/pcmcia/vx/vxpocket.c2
-rw-r--r--sound/ppc/powermac.c2
-rw-r--r--sound/sh/aica.c2
-rw-r--r--sound/sh/sh_dac_audio.c13
-rw-r--r--sound/soc/Kconfig15
-rw-r--r--sound/soc/atmel/Kconfig23
-rw-r--r--sound/soc/atmel/Makefile4
-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/playpaq_wm8510.c473
-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/Kconfig14
-rw-r--r--sound/soc/au1x/ac97c.c42
-rw-r--r--sound/soc/au1x/db1000.c14
-rw-r--r--sound/soc/au1x/db1200.c88
-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/ad1836.h2
-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.c21
-rw-r--r--sound/soc/codecs/cs4271.c4
-rw-r--r--sound/soc/codecs/cs42l51.c43
-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/max9877.c10
-rw-r--r--sound/soc/codecs/pcm3008.c14
-rw-r--r--sound/soc/codecs/rt5631.c12
-rw-r--r--sound/soc/codecs/sgtl5000.c25
-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.c41
-rw-r--r--sound/soc/codecs/wm8994-tables.c3147
-rw-r--r--sound/soc/codecs/wm8994.c678
-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.c22
-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.c37
-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.c30
-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.c32
-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.c15
-rw-r--r--sound/soc/mxs/mxs-saif.c38
-rw-r--r--sound/soc/mxs/mxs-sgtl5000.c14
-rw-r--r--sound/soc/nuc900/nuc900-ac97.c17
-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.c21
-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.c2
-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.c25
-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/siu_pcm.c4
-rw-r--r--sound/soc/sh/ssi.c14
-rw-r--r--sound/soc/soc-cache.c765
-rw-r--r--sound/soc/soc-core.c248
-rw-r--r--sound/soc/soc-dapm.c92
-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.c14
-rw-r--r--sound/sound_core.c2
-rw-r--r--sound/sparc/amd7930.c2
-rw-r--r--sound/sparc/cs4231.c15
-rw-r--r--sound/sparc/dbri.c16
-rw-r--r--sound/usb/6fire/chip.c17
-rw-r--r--sound/usb/caiaq/device.c15
-rw-r--r--sound/usb/card.c6
-rw-r--r--sound/usb/endpoint.c5
-rw-r--r--sound/usb/format.c8
-rw-r--r--sound/usb/misc/ua101.c16
-rw-r--r--sound/usb/quirks-table.h67
-rw-r--r--sound/usb/usx2y/us122l.c16
-rw-r--r--sound/usb/usx2y/usb_stream.c6
-rw-r--r--sound/usb/usx2y/usbusx2y.c15
481 files changed, 14853 insertions, 16901 deletions
diff --git a/sound/aoa/codecs/Kconfig b/sound/aoa/codecs/Kconfig
index 808eb11ebac..0c68e32834c 100644
--- a/sound/aoa/codecs/Kconfig
+++ b/sound/aoa/codecs/Kconfig
@@ -7,14 +7,6 @@ config SND_AOA_ONYX
7 codec chip found in the latest Apple machines 7 codec chip found in the latest Apple machines
8 (most of those with digital audio output). 8 (most of those with digital audio output).
9 9
10#config SND_AOA_TOPAZ
11# tristate "support Topaz chips"
12# ---help---
13# This option enables support for the Topaz (CS84xx)
14# codec chips found in the latest Apple machines,
15# these chips do the digital input and output on
16# some PowerMacs.
17
18config SND_AOA_TAS 10config SND_AOA_TAS
19 tristate "support TAS chips" 11 tristate "support TAS chips"
20 select I2C 12 select I2C
diff --git a/sound/arm/aaci.c b/sound/arm/aaci.c
index e518d38b1c7..b37b702a3a6 100644
--- a/sound/arm/aaci.c
+++ b/sound/arm/aaci.c
@@ -1097,6 +1097,8 @@ static struct amba_id aaci_ids[] = {
1097 { 0, 0 }, 1097 { 0, 0 },
1098}; 1098};
1099 1099
1100MODULE_DEVICE_TABLE(amba, aaci_ids);
1101
1100static struct amba_driver aaci_driver = { 1102static struct amba_driver aaci_driver = {
1101 .drv = { 1103 .drv = {
1102 .name = DRIVER_NAME, 1104 .name = DRIVER_NAME,
diff --git a/sound/arm/pxa2xx-ac97.c b/sound/arm/pxa2xx-ac97.c
index 5d9411839cd..3a39626a82d 100644
--- a/sound/arm/pxa2xx-ac97.c
+++ b/sound/arm/pxa2xx-ac97.c
@@ -251,18 +251,7 @@ static struct platform_driver pxa2xx_ac97_driver = {
251 }, 251 },
252}; 252};
253 253
254static int __init pxa2xx_ac97_init(void) 254module_platform_driver(pxa2xx_ac97_driver);
255{
256 return platform_driver_register(&pxa2xx_ac97_driver);
257}
258
259static void __exit pxa2xx_ac97_exit(void)
260{
261 platform_driver_unregister(&pxa2xx_ac97_driver);
262}
263
264module_init(pxa2xx_ac97_init);
265module_exit(pxa2xx_ac97_exit);
266 255
267MODULE_AUTHOR("Nicolas Pitre"); 256MODULE_AUTHOR("Nicolas Pitre");
268MODULE_DESCRIPTION("AC97 driver for the Intel PXA2xx chip"); 257MODULE_DESCRIPTION("AC97 driver for the Intel PXA2xx chip");
diff --git a/sound/atmel/abdac.c b/sound/atmel/abdac.c
index 6fd9391b3a6..4fa1dbd8ee8 100644
--- a/sound/atmel/abdac.c
+++ b/sound/atmel/abdac.c
@@ -133,7 +133,7 @@ static int atmel_abdac_prepare_dma(struct atmel_abdac *dac,
133 period_len = frames_to_bytes(runtime, runtime->period_size); 133 period_len = frames_to_bytes(runtime, runtime->period_size);
134 134
135 cdesc = dw_dma_cyclic_prep(chan, runtime->dma_addr, buffer_len, 135 cdesc = dw_dma_cyclic_prep(chan, runtime->dma_addr, buffer_len,
136 period_len, DMA_TO_DEVICE); 136 period_len, DMA_MEM_TO_DEV);
137 if (IS_ERR(cdesc)) { 137 if (IS_ERR(cdesc)) {
138 dev_dbg(&dac->pdev->dev, "could not prepare cyclic DMA\n"); 138 dev_dbg(&dac->pdev->dev, "could not prepare cyclic DMA\n");
139 return PTR_ERR(cdesc); 139 return PTR_ERR(cdesc);
diff --git a/sound/atmel/ac97c.c b/sound/atmel/ac97c.c
index 6e5addeb236..61dade69835 100644
--- a/sound/atmel/ac97c.c
+++ b/sound/atmel/ac97c.c
@@ -102,7 +102,7 @@ static void atmel_ac97c_dma_capture_period_done(void *arg)
102 102
103static int atmel_ac97c_prepare_dma(struct atmel_ac97c *chip, 103static int atmel_ac97c_prepare_dma(struct atmel_ac97c *chip,
104 struct snd_pcm_substream *substream, 104 struct snd_pcm_substream *substream,
105 enum dma_data_direction direction) 105 enum dma_transfer_direction direction)
106{ 106{
107 struct dma_chan *chan; 107 struct dma_chan *chan;
108 struct dw_cyclic_desc *cdesc; 108 struct dw_cyclic_desc *cdesc;
@@ -118,7 +118,7 @@ static int atmel_ac97c_prepare_dma(struct atmel_ac97c *chip,
118 return -EINVAL; 118 return -EINVAL;
119 } 119 }
120 120
121 if (direction == DMA_TO_DEVICE) 121 if (direction == DMA_MEM_TO_DEV)
122 chan = chip->dma.tx_chan; 122 chan = chip->dma.tx_chan;
123 else 123 else
124 chan = chip->dma.rx_chan; 124 chan = chip->dma.rx_chan;
@@ -133,7 +133,7 @@ static int atmel_ac97c_prepare_dma(struct atmel_ac97c *chip,
133 return PTR_ERR(cdesc); 133 return PTR_ERR(cdesc);
134 } 134 }
135 135
136 if (direction == DMA_TO_DEVICE) { 136 if (direction == DMA_MEM_TO_DEV) {
137 cdesc->period_callback = atmel_ac97c_dma_playback_period_done; 137 cdesc->period_callback = atmel_ac97c_dma_playback_period_done;
138 set_bit(DMA_TX_READY, &chip->flags); 138 set_bit(DMA_TX_READY, &chip->flags);
139 } else { 139 } else {
@@ -393,7 +393,7 @@ static int atmel_ac97c_playback_prepare(struct snd_pcm_substream *substream)
393 if (cpu_is_at32ap7000()) { 393 if (cpu_is_at32ap7000()) {
394 if (!test_bit(DMA_TX_READY, &chip->flags)) 394 if (!test_bit(DMA_TX_READY, &chip->flags))
395 retval = atmel_ac97c_prepare_dma(chip, substream, 395 retval = atmel_ac97c_prepare_dma(chip, substream,
396 DMA_TO_DEVICE); 396 DMA_MEM_TO_DEV);
397 } else { 397 } else {
398 /* Initialize and start the PDC */ 398 /* Initialize and start the PDC */
399 writel(runtime->dma_addr, chip->regs + ATMEL_PDC_TPR); 399 writel(runtime->dma_addr, chip->regs + ATMEL_PDC_TPR);
@@ -484,7 +484,7 @@ static int atmel_ac97c_capture_prepare(struct snd_pcm_substream *substream)
484 if (cpu_is_at32ap7000()) { 484 if (cpu_is_at32ap7000()) {
485 if (!test_bit(DMA_RX_READY, &chip->flags)) 485 if (!test_bit(DMA_RX_READY, &chip->flags))
486 retval = atmel_ac97c_prepare_dma(chip, substream, 486 retval = atmel_ac97c_prepare_dma(chip, substream,
487 DMA_FROM_DEVICE); 487 DMA_DEV_TO_MEM);
488 } else { 488 } else {
489 /* Initialize and start the PDC */ 489 /* Initialize and start the PDC */
490 writel(runtime->dma_addr, chip->regs + ATMEL_PDC_RPR); 490 writel(runtime->dma_addr, chip->regs + ATMEL_PDC_RPR);
@@ -899,6 +899,10 @@ static void atmel_ac97c_reset(struct atmel_ac97c *chip)
899 /* AC97 v2.2 specifications says minimum 1 us. */ 899 /* AC97 v2.2 specifications says minimum 1 us. */
900 udelay(2); 900 udelay(2);
901 gpio_set_value(chip->reset_pin, 1); 901 gpio_set_value(chip->reset_pin, 1);
902 } else {
903 ac97c_writel(chip, MR, AC97C_MR_WRST | AC97C_MR_ENA);
904 udelay(2);
905 ac97c_writel(chip, MR, AC97C_MR_ENA);
902 } 906 }
903} 907}
904 908
diff --git a/sound/core/Kconfig b/sound/core/Kconfig
index 475455c7661..b413ed05e74 100644
--- a/sound/core/Kconfig
+++ b/sound/core/Kconfig
@@ -5,7 +5,6 @@ config SND_TIMER
5config SND_PCM 5config SND_PCM
6 tristate 6 tristate
7 select SND_TIMER 7 select SND_TIMER
8 select GCD
9 8
10config SND_HWDEP 9config SND_HWDEP
11 tristate 10 tristate
@@ -13,6 +12,9 @@ config SND_HWDEP
13config SND_RAWMIDI 12config SND_RAWMIDI
14 tristate 13 tristate
15 14
15config SND_COMPRESS_OFFLOAD
16 tristate
17
16# To be effective this also requires INPUT - users should say: 18# To be effective this also requires INPUT - users should say:
17# select SND_JACK if INPUT=y || INPUT=SND 19# select SND_JACK if INPUT=y || INPUT=SND
18# to avoid having to force INPUT on. 20# to avoid having to force INPUT on.
@@ -207,6 +209,9 @@ config SND_PCM_XRUN_DEBUG
207config SND_VMASTER 209config SND_VMASTER
208 bool 210 bool
209 211
212config SND_KCTL_JACK
213 bool
214
210config SND_DMA_SGBUF 215config SND_DMA_SGBUF
211 def_bool y 216 def_bool y
212 depends on X86 217 depends on X86
diff --git a/sound/core/Makefile b/sound/core/Makefile
index 350a08d277f..43d4117428a 100644
--- a/sound/core/Makefile
+++ b/sound/core/Makefile
@@ -7,6 +7,7 @@ snd-y := sound.o init.o memory.o info.o control.o misc.o device.o
7snd-$(CONFIG_ISA_DMA_API) += isadma.o 7snd-$(CONFIG_ISA_DMA_API) += isadma.o
8snd-$(CONFIG_SND_OSSEMUL) += sound_oss.o info_oss.o 8snd-$(CONFIG_SND_OSSEMUL) += sound_oss.o info_oss.o
9snd-$(CONFIG_SND_VMASTER) += vmaster.o 9snd-$(CONFIG_SND_VMASTER) += vmaster.o
10snd-$(CONFIG_SND_KCTL_JACK) += ctljack.o
10snd-$(CONFIG_SND_JACK) += jack.o 11snd-$(CONFIG_SND_JACK) += jack.o
11 12
12snd-pcm-objs := pcm.o pcm_native.o pcm_lib.o pcm_timer.o pcm_misc.o \ 13snd-pcm-objs := pcm.o pcm_native.o pcm_lib.o pcm_timer.o pcm_misc.o \
@@ -21,6 +22,8 @@ snd-hrtimer-objs := hrtimer.o
21snd-rtctimer-objs := rtctimer.o 22snd-rtctimer-objs := rtctimer.o
22snd-hwdep-objs := hwdep.o 23snd-hwdep-objs := hwdep.o
23 24
25snd-compress-objs := compress_offload.o
26
24obj-$(CONFIG_SND) += snd.o 27obj-$(CONFIG_SND) += snd.o
25obj-$(CONFIG_SND_HWDEP) += snd-hwdep.o 28obj-$(CONFIG_SND_HWDEP) += snd-hwdep.o
26obj-$(CONFIG_SND_TIMER) += snd-timer.o 29obj-$(CONFIG_SND_TIMER) += snd-timer.o
@@ -31,3 +34,5 @@ obj-$(CONFIG_SND_RAWMIDI) += snd-rawmidi.o
31 34
32obj-$(CONFIG_SND_OSSEMUL) += oss/ 35obj-$(CONFIG_SND_OSSEMUL) += oss/
33obj-$(CONFIG_SND_SEQUENCER) += seq/ 36obj-$(CONFIG_SND_SEQUENCER) += seq/
37
38obj-$(CONFIG_SND_COMPRESS_OFFLOAD) += snd-compress.o
diff --git a/sound/core/compress_offload.c b/sound/core/compress_offload.c
new file mode 100644
index 00000000000..dac3633507c
--- /dev/null
+++ b/sound/core/compress_offload.c
@@ -0,0 +1,765 @@
1/*
2 * compress_core.c - compress offload core
3 *
4 * Copyright (C) 2011 Intel Corporation
5 * Authors: Vinod Koul <vinod.koul@linux.intel.com>
6 * Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
7 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
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 as published by
11 * the Free Software Foundation; version 2 of the License.
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 along
19 * with this program; if not, write to the Free Software Foundation, Inc.,
20 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
21 *
22 * ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
23 *
24 */
25#define FORMAT(fmt) "%s: %d: " fmt, __func__, __LINE__
26#define pr_fmt(fmt) KBUILD_MODNAME ": " FORMAT(fmt)
27
28#include <linux/file.h>
29#include <linux/fs.h>
30#include <linux/list.h>
31#include <linux/mm.h>
32#include <linux/mutex.h>
33#include <linux/poll.h>
34#include <linux/slab.h>
35#include <linux/sched.h>
36#include <linux/uio.h>
37#include <linux/uaccess.h>
38#include <linux/module.h>
39#include <sound/core.h>
40#include <sound/initval.h>
41#include <sound/compress_params.h>
42#include <sound/compress_offload.h>
43#include <sound/compress_driver.h>
44
45/* TODO:
46 * - add substream support for multiple devices in case of
47 * SND_DYNAMIC_MINORS is not used
48 * - Multiple node representation
49 * driver should be able to register multiple nodes
50 */
51
52static DEFINE_MUTEX(device_mutex);
53
54struct snd_compr_file {
55 unsigned long caps;
56 struct snd_compr_stream stream;
57};
58
59/*
60 * a note on stream states used:
61 * we use follwing states in the compressed core
62 * SNDRV_PCM_STATE_OPEN: When stream has been opened.
63 * SNDRV_PCM_STATE_SETUP: When stream has been initialized. This is done by
64 * calling SNDRV_COMPRESS_SET_PARAMS. running streams will come to this
65 * state at stop by calling SNDRV_COMPRESS_STOP, or at end of drain.
66 * SNDRV_PCM_STATE_RUNNING: When stream has been started and is
67 * decoding/encoding and rendering/capturing data.
68 * SNDRV_PCM_STATE_DRAINING: When stream is draining current data. This is done
69 * by calling SNDRV_COMPRESS_DRAIN.
70 * SNDRV_PCM_STATE_PAUSED: When stream is paused. This is done by calling
71 * SNDRV_COMPRESS_PAUSE. It can be stopped or resumed by calling
72 * SNDRV_COMPRESS_STOP or SNDRV_COMPRESS_RESUME respectively.
73 */
74static int snd_compr_open(struct inode *inode, struct file *f)
75{
76 struct snd_compr *compr;
77 struct snd_compr_file *data;
78 struct snd_compr_runtime *runtime;
79 enum snd_compr_direction dirn;
80 int maj = imajor(inode);
81 int ret;
82
83 if (f->f_flags & O_WRONLY)
84 dirn = SND_COMPRESS_PLAYBACK;
85 else if (f->f_flags & O_RDONLY)
86 dirn = SND_COMPRESS_CAPTURE;
87 else {
88 pr_err("invalid direction\n");
89 return -EINVAL;
90 }
91
92 if (maj == snd_major)
93 compr = snd_lookup_minor_data(iminor(inode),
94 SNDRV_DEVICE_TYPE_COMPRESS);
95 else
96 return -EBADFD;
97
98 if (compr == NULL) {
99 pr_err("no device data!!!\n");
100 return -ENODEV;
101 }
102
103 if (dirn != compr->direction) {
104 pr_err("this device doesn't support this direction\n");
105 return -EINVAL;
106 }
107
108 data = kzalloc(sizeof(*data), GFP_KERNEL);
109 if (!data)
110 return -ENOMEM;
111 data->stream.ops = compr->ops;
112 data->stream.direction = dirn;
113 data->stream.private_data = compr->private_data;
114 data->stream.device = compr;
115 runtime = kzalloc(sizeof(*runtime), GFP_KERNEL);
116 if (!runtime) {
117 kfree(data);
118 return -ENOMEM;
119 }
120 runtime->state = SNDRV_PCM_STATE_OPEN;
121 init_waitqueue_head(&runtime->sleep);
122 data->stream.runtime = runtime;
123 f->private_data = (void *)data;
124 mutex_lock(&compr->lock);
125 ret = compr->ops->open(&data->stream);
126 mutex_unlock(&compr->lock);
127 if (ret) {
128 kfree(runtime);
129 kfree(data);
130 }
131 return ret;
132}
133
134static int snd_compr_free(struct inode *inode, struct file *f)
135{
136 struct snd_compr_file *data = f->private_data;
137 data->stream.ops->free(&data->stream);
138 kfree(data->stream.runtime->buffer);
139 kfree(data->stream.runtime);
140 kfree(data);
141 return 0;
142}
143
144static void snd_compr_update_tstamp(struct snd_compr_stream *stream,
145 struct snd_compr_tstamp *tstamp)
146{
147 if (!stream->ops->pointer)
148 return;
149 stream->ops->pointer(stream, tstamp);
150 pr_debug("dsp consumed till %d total %d bytes\n",
151 tstamp->byte_offset, tstamp->copied_total);
152 stream->runtime->hw_pointer = tstamp->byte_offset;
153 stream->runtime->total_bytes_transferred = tstamp->copied_total;
154}
155
156static size_t snd_compr_calc_avail(struct snd_compr_stream *stream,
157 struct snd_compr_avail *avail)
158{
159 long avail_calc; /*this needs to be signed variable */
160
161 snd_compr_update_tstamp(stream, &avail->tstamp);
162
163 /* FIXME: This needs to be different for capture stream,
164 available is # of compressed data, for playback it's
165 remainder of buffer */
166
167 if (stream->runtime->total_bytes_available == 0 &&
168 stream->runtime->state == SNDRV_PCM_STATE_SETUP) {
169 pr_debug("detected init and someone forgot to do a write\n");
170 return stream->runtime->buffer_size;
171 }
172 pr_debug("app wrote %lld, DSP consumed %lld\n",
173 stream->runtime->total_bytes_available,
174 stream->runtime->total_bytes_transferred);
175 if (stream->runtime->total_bytes_available ==
176 stream->runtime->total_bytes_transferred) {
177 pr_debug("both pointers are same, returning full avail\n");
178 return stream->runtime->buffer_size;
179 }
180
181 /* FIXME: this routine isn't consistent, in one test we use
182 * cumulative values and in the other byte offsets. Do we
183 * really need the byte offsets if the cumulative values have
184 * been updated? In the PCM interface app_ptr and hw_ptr are
185 * already cumulative */
186
187 avail_calc = stream->runtime->buffer_size -
188 (stream->runtime->app_pointer - stream->runtime->hw_pointer);
189 pr_debug("calc avail as %ld, app_ptr %lld, hw+ptr %lld\n", avail_calc,
190 stream->runtime->app_pointer,
191 stream->runtime->hw_pointer);
192 if (avail_calc >= stream->runtime->buffer_size)
193 avail_calc -= stream->runtime->buffer_size;
194 pr_debug("ret avail as %ld\n", avail_calc);
195 avail->avail = avail_calc;
196 return avail_calc;
197}
198
199static inline size_t snd_compr_get_avail(struct snd_compr_stream *stream)
200{
201 struct snd_compr_avail avail;
202
203 return snd_compr_calc_avail(stream, &avail);
204}
205
206static int
207snd_compr_ioctl_avail(struct snd_compr_stream *stream, unsigned long arg)
208{
209 struct snd_compr_avail ioctl_avail;
210 size_t avail;
211
212 avail = snd_compr_calc_avail(stream, &ioctl_avail);
213 ioctl_avail.avail = avail;
214
215 if (copy_to_user((__u64 __user *)arg,
216 &ioctl_avail, sizeof(ioctl_avail)))
217 return -EFAULT;
218 return 0;
219}
220
221static int snd_compr_write_data(struct snd_compr_stream *stream,
222 const char __user *buf, size_t count)
223{
224 void *dstn;
225 size_t copy;
226 struct snd_compr_runtime *runtime = stream->runtime;
227
228 dstn = runtime->buffer + runtime->app_pointer;
229 pr_debug("copying %ld at %lld\n",
230 (unsigned long)count, runtime->app_pointer);
231 if (count < runtime->buffer_size - runtime->app_pointer) {
232 if (copy_from_user(dstn, buf, count))
233 return -EFAULT;
234 runtime->app_pointer += count;
235 } else {
236 copy = runtime->buffer_size - runtime->app_pointer;
237 if (copy_from_user(dstn, buf, copy))
238 return -EFAULT;
239 if (copy_from_user(runtime->buffer, buf + copy, count - copy))
240 return -EFAULT;
241 runtime->app_pointer = count - copy;
242 }
243 /* if DSP cares, let it know data has been written */
244 if (stream->ops->ack)
245 stream->ops->ack(stream, count);
246 return count;
247}
248
249static ssize_t snd_compr_write(struct file *f, const char __user *buf,
250 size_t count, loff_t *offset)
251{
252 struct snd_compr_file *data = f->private_data;
253 struct snd_compr_stream *stream;
254 size_t avail;
255 int retval;
256
257 if (snd_BUG_ON(!data))
258 return -EFAULT;
259
260 stream = &data->stream;
261 mutex_lock(&stream->device->lock);
262 /* write is allowed when stream is running or has been steup */
263 if (stream->runtime->state != SNDRV_PCM_STATE_SETUP &&
264 stream->runtime->state != SNDRV_PCM_STATE_RUNNING) {
265 mutex_unlock(&stream->device->lock);
266 return -EBADFD;
267 }
268
269 avail = snd_compr_get_avail(stream);
270 pr_debug("avail returned %ld\n", (unsigned long)avail);
271 /* calculate how much we can write to buffer */
272 if (avail > count)
273 avail = count;
274
275 if (stream->ops->copy)
276 retval = stream->ops->copy(stream, buf, avail);
277 else
278 retval = snd_compr_write_data(stream, buf, avail);
279 if (retval > 0)
280 stream->runtime->total_bytes_available += retval;
281
282 /* while initiating the stream, write should be called before START
283 * call, so in setup move state */
284 if (stream->runtime->state == SNDRV_PCM_STATE_SETUP) {
285 stream->runtime->state = SNDRV_PCM_STATE_PREPARED;
286 pr_debug("stream prepared, Houston we are good to go\n");
287 }
288
289 mutex_unlock(&stream->device->lock);
290 return retval;
291}
292
293
294static ssize_t snd_compr_read(struct file *f, char __user *buf,
295 size_t count, loff_t *offset)
296{
297 return -ENXIO;
298}
299
300static int snd_compr_mmap(struct file *f, struct vm_area_struct *vma)
301{
302 return -ENXIO;
303}
304
305static inline int snd_compr_get_poll(struct snd_compr_stream *stream)
306{
307 if (stream->direction == SND_COMPRESS_PLAYBACK)
308 return POLLOUT | POLLWRNORM;
309 else
310 return POLLIN | POLLRDNORM;
311}
312
313static unsigned int snd_compr_poll(struct file *f, poll_table *wait)
314{
315 struct snd_compr_file *data = f->private_data;
316 struct snd_compr_stream *stream;
317 size_t avail;
318 int retval = 0;
319
320 if (snd_BUG_ON(!data))
321 return -EFAULT;
322 stream = &data->stream;
323 if (snd_BUG_ON(!stream))
324 return -EFAULT;
325
326 mutex_lock(&stream->device->lock);
327 if (stream->runtime->state == SNDRV_PCM_STATE_PAUSED ||
328 stream->runtime->state == SNDRV_PCM_STATE_OPEN) {
329 retval = -EBADFD;
330 goto out;
331 }
332 poll_wait(f, &stream->runtime->sleep, wait);
333
334 avail = snd_compr_get_avail(stream);
335 pr_debug("avail is %ld\n", (unsigned long)avail);
336 /* check if we have at least one fragment to fill */
337 switch (stream->runtime->state) {
338 case SNDRV_PCM_STATE_DRAINING:
339 /* stream has been woken up after drain is complete
340 * draining done so set stream state to stopped
341 */
342 retval = snd_compr_get_poll(stream);
343 stream->runtime->state = SNDRV_PCM_STATE_SETUP;
344 break;
345 case SNDRV_PCM_STATE_RUNNING:
346 case SNDRV_PCM_STATE_PREPARED:
347 case SNDRV_PCM_STATE_PAUSED:
348 if (avail >= stream->runtime->fragment_size)
349 retval = snd_compr_get_poll(stream);
350 break;
351 default:
352 if (stream->direction == SND_COMPRESS_PLAYBACK)
353 retval = POLLOUT | POLLWRNORM | POLLERR;
354 else
355 retval = POLLIN | POLLRDNORM | POLLERR;
356 break;
357 }
358out:
359 mutex_unlock(&stream->device->lock);
360 return retval;
361}
362
363static int
364snd_compr_get_caps(struct snd_compr_stream *stream, unsigned long arg)
365{
366 int retval;
367 struct snd_compr_caps caps;
368
369 if (!stream->ops->get_caps)
370 return -ENXIO;
371
372 retval = stream->ops->get_caps(stream, &caps);
373 if (retval)
374 goto out;
375 if (copy_to_user((void __user *)arg, &caps, sizeof(caps)))
376 retval = -EFAULT;
377out:
378 return retval;
379}
380
381static int
382snd_compr_get_codec_caps(struct snd_compr_stream *stream, unsigned long arg)
383{
384 int retval;
385 struct snd_compr_codec_caps *caps;
386
387 if (!stream->ops->get_codec_caps)
388 return -ENXIO;
389
390 caps = kmalloc(sizeof(*caps), GFP_KERNEL);
391 if (!caps)
392 return -ENOMEM;
393
394 retval = stream->ops->get_codec_caps(stream, caps);
395 if (retval)
396 goto out;
397 if (copy_to_user((void __user *)arg, caps, sizeof(*caps)))
398 retval = -EFAULT;
399
400out:
401 kfree(caps);
402 return retval;
403}
404
405/* revisit this with snd_pcm_preallocate_xxx */
406static int snd_compr_allocate_buffer(struct snd_compr_stream *stream,
407 struct snd_compr_params *params)
408{
409 unsigned int buffer_size;
410 void *buffer;
411
412 buffer_size = params->buffer.fragment_size * params->buffer.fragments;
413 if (stream->ops->copy) {
414 buffer = NULL;
415 /* if copy is defined the driver will be required to copy
416 * the data from core
417 */
418 } else {
419 buffer = kmalloc(buffer_size, GFP_KERNEL);
420 if (!buffer)
421 return -ENOMEM;
422 }
423 stream->runtime->fragment_size = params->buffer.fragment_size;
424 stream->runtime->fragments = params->buffer.fragments;
425 stream->runtime->buffer = buffer;
426 stream->runtime->buffer_size = buffer_size;
427 return 0;
428}
429
430static int
431snd_compr_set_params(struct snd_compr_stream *stream, unsigned long arg)
432{
433 struct snd_compr_params *params;
434 int retval;
435
436 if (stream->runtime->state == SNDRV_PCM_STATE_OPEN) {
437 /*
438 * we should allow parameter change only when stream has been
439 * opened not in other cases
440 */
441 params = kmalloc(sizeof(*params), GFP_KERNEL);
442 if (!params)
443 return -ENOMEM;
444 if (copy_from_user(params, (void __user *)arg, sizeof(*params)))
445 return -EFAULT;
446 retval = snd_compr_allocate_buffer(stream, params);
447 if (retval) {
448 kfree(params);
449 return -ENOMEM;
450 }
451 retval = stream->ops->set_params(stream, params);
452 if (retval)
453 goto out;
454 stream->runtime->state = SNDRV_PCM_STATE_SETUP;
455 } else
456 return -EPERM;
457out:
458 kfree(params);
459 return retval;
460}
461
462static int
463snd_compr_get_params(struct snd_compr_stream *stream, unsigned long arg)
464{
465 struct snd_codec *params;
466 int retval;
467
468 if (!stream->ops->get_params)
469 return -EBADFD;
470
471 params = kmalloc(sizeof(*params), GFP_KERNEL);
472 if (!params)
473 return -ENOMEM;
474 retval = stream->ops->get_params(stream, params);
475 if (retval)
476 goto out;
477 if (copy_to_user((char __user *)arg, params, sizeof(*params)))
478 retval = -EFAULT;
479
480out:
481 kfree(params);
482 return retval;
483}
484
485static inline int
486snd_compr_tstamp(struct snd_compr_stream *stream, unsigned long arg)
487{
488 struct snd_compr_tstamp tstamp;
489
490 snd_compr_update_tstamp(stream, &tstamp);
491 return copy_to_user((struct snd_compr_tstamp __user *)arg,
492 &tstamp, sizeof(tstamp)) ? -EFAULT : 0;
493}
494
495static int snd_compr_pause(struct snd_compr_stream *stream)
496{
497 int retval;
498
499 if (stream->runtime->state != SNDRV_PCM_STATE_RUNNING)
500 return -EPERM;
501 retval = stream->ops->trigger(stream, SNDRV_PCM_TRIGGER_PAUSE_PUSH);
502 if (!retval) {
503 stream->runtime->state = SNDRV_PCM_STATE_PAUSED;
504 wake_up(&stream->runtime->sleep);
505 }
506 return retval;
507}
508
509static int snd_compr_resume(struct snd_compr_stream *stream)
510{
511 int retval;
512
513 if (stream->runtime->state != SNDRV_PCM_STATE_PAUSED)
514 return -EPERM;
515 retval = stream->ops->trigger(stream, SNDRV_PCM_TRIGGER_PAUSE_RELEASE);
516 if (!retval)
517 stream->runtime->state = SNDRV_PCM_STATE_RUNNING;
518 return retval;
519}
520
521static int snd_compr_start(struct snd_compr_stream *stream)
522{
523 int retval;
524
525 if (stream->runtime->state != SNDRV_PCM_STATE_PREPARED)
526 return -EPERM;
527 retval = stream->ops->trigger(stream, SNDRV_PCM_TRIGGER_START);
528 if (!retval)
529 stream->runtime->state = SNDRV_PCM_STATE_RUNNING;
530 return retval;
531}
532
533static int snd_compr_stop(struct snd_compr_stream *stream)
534{
535 int retval;
536
537 if (stream->runtime->state == SNDRV_PCM_STATE_PREPARED ||
538 stream->runtime->state == SNDRV_PCM_STATE_SETUP)
539 return -EPERM;
540 retval = stream->ops->trigger(stream, SNDRV_PCM_TRIGGER_STOP);
541 if (!retval) {
542 stream->runtime->state = SNDRV_PCM_STATE_SETUP;
543 wake_up(&stream->runtime->sleep);
544 }
545 return retval;
546}
547
548static int snd_compr_drain(struct snd_compr_stream *stream)
549{
550 int retval;
551
552 if (stream->runtime->state == SNDRV_PCM_STATE_PREPARED ||
553 stream->runtime->state == SNDRV_PCM_STATE_SETUP)
554 return -EPERM;
555 retval = stream->ops->trigger(stream, SND_COMPR_TRIGGER_DRAIN);
556 if (!retval) {
557 stream->runtime->state = SNDRV_PCM_STATE_DRAINING;
558 wake_up(&stream->runtime->sleep);
559 }
560 return retval;
561}
562
563static long snd_compr_ioctl(struct file *f, unsigned int cmd, unsigned long arg)
564{
565 struct snd_compr_file *data = f->private_data;
566 struct snd_compr_stream *stream;
567 int retval = -ENOTTY;
568
569 if (snd_BUG_ON(!data))
570 return -EFAULT;
571 stream = &data->stream;
572 if (snd_BUG_ON(!stream))
573 return -EFAULT;
574 mutex_lock(&stream->device->lock);
575 switch (_IOC_NR(cmd)) {
576 case _IOC_NR(SNDRV_COMPRESS_IOCTL_VERSION):
577 put_user(SNDRV_COMPRESS_VERSION,
578 (int __user *)arg) ? -EFAULT : 0;
579 break;
580 case _IOC_NR(SNDRV_COMPRESS_GET_CAPS):
581 retval = snd_compr_get_caps(stream, arg);
582 break;
583 case _IOC_NR(SNDRV_COMPRESS_GET_CODEC_CAPS):
584 retval = snd_compr_get_codec_caps(stream, arg);
585 break;
586 case _IOC_NR(SNDRV_COMPRESS_SET_PARAMS):
587 retval = snd_compr_set_params(stream, arg);
588 break;
589 case _IOC_NR(SNDRV_COMPRESS_GET_PARAMS):
590 retval = snd_compr_get_params(stream, arg);
591 break;
592 case _IOC_NR(SNDRV_COMPRESS_TSTAMP):
593 retval = snd_compr_tstamp(stream, arg);
594 break;
595 case _IOC_NR(SNDRV_COMPRESS_AVAIL):
596 retval = snd_compr_ioctl_avail(stream, arg);
597 break;
598 case _IOC_NR(SNDRV_COMPRESS_PAUSE):
599 retval = snd_compr_pause(stream);
600 break;
601 case _IOC_NR(SNDRV_COMPRESS_RESUME):
602 retval = snd_compr_resume(stream);
603 break;
604 case _IOC_NR(SNDRV_COMPRESS_START):
605 retval = snd_compr_start(stream);
606 break;
607 case _IOC_NR(SNDRV_COMPRESS_STOP):
608 retval = snd_compr_stop(stream);
609 break;
610 case _IOC_NR(SNDRV_COMPRESS_DRAIN):
611 retval = snd_compr_drain(stream);
612 break;
613 }
614 mutex_unlock(&stream->device->lock);
615 return retval;
616}
617
618static const struct file_operations snd_compr_file_ops = {
619 .owner = THIS_MODULE,
620 .open = snd_compr_open,
621 .release = snd_compr_free,
622 .write = snd_compr_write,
623 .read = snd_compr_read,
624 .unlocked_ioctl = snd_compr_ioctl,
625 .mmap = snd_compr_mmap,
626 .poll = snd_compr_poll,
627};
628
629static int snd_compress_dev_register(struct snd_device *device)
630{
631 int ret = -EINVAL;
632 char str[16];
633 struct snd_compr *compr;
634
635 if (snd_BUG_ON(!device || !device->device_data))
636 return -EBADFD;
637 compr = device->device_data;
638
639 sprintf(str, "comprC%iD%i", compr->card->number, compr->device);
640 pr_debug("reg %s for device %s, direction %d\n", str, compr->name,
641 compr->direction);
642 /* register compressed device */
643 ret = snd_register_device(SNDRV_DEVICE_TYPE_COMPRESS, compr->card,
644 compr->device, &snd_compr_file_ops, compr, str);
645 if (ret < 0) {
646 pr_err("snd_register_device failed\n %d", ret);
647 return ret;
648 }
649 return ret;
650
651}
652
653static int snd_compress_dev_disconnect(struct snd_device *device)
654{
655 struct snd_compr *compr;
656
657 compr = device->device_data;
658 snd_unregister_device(compr->direction, compr->card, compr->device);
659 return 0;
660}
661
662/*
663 * snd_compress_new: create new compress device
664 * @card: sound card pointer
665 * @device: device number
666 * @dirn: device direction, should be of type enum snd_compr_direction
667 * @compr: compress device pointer
668 */
669int snd_compress_new(struct snd_card *card, int device,
670 int dirn, struct snd_compr *compr)
671{
672 static struct snd_device_ops ops = {
673 .dev_free = NULL,
674 .dev_register = snd_compress_dev_register,
675 .dev_disconnect = snd_compress_dev_disconnect,
676 };
677
678 compr->card = card;
679 compr->device = device;
680 compr->direction = dirn;
681 return snd_device_new(card, SNDRV_DEV_COMPRESS, compr, &ops);
682}
683EXPORT_SYMBOL_GPL(snd_compress_new);
684
685static int snd_compress_add_device(struct snd_compr *device)
686{
687 int ret;
688
689 if (!device->card)
690 return -EINVAL;
691
692 /* register the card */
693 ret = snd_card_register(device->card);
694 if (ret)
695 goto out;
696 return 0;
697
698out:
699 pr_err("failed with %d\n", ret);
700 return ret;
701
702}
703
704static int snd_compress_remove_device(struct snd_compr *device)
705{
706 return snd_card_free(device->card);
707}
708
709/**
710 * snd_compress_register - register compressed device
711 *
712 * @device: compressed device to register
713 */
714int snd_compress_register(struct snd_compr *device)
715{
716 int retval;
717
718 if (device->name == NULL || device->dev == NULL || device->ops == NULL)
719 return -EINVAL;
720
721 pr_debug("Registering compressed device %s\n", device->name);
722 if (snd_BUG_ON(!device->ops->open))
723 return -EINVAL;
724 if (snd_BUG_ON(!device->ops->free))
725 return -EINVAL;
726 if (snd_BUG_ON(!device->ops->set_params))
727 return -EINVAL;
728 if (snd_BUG_ON(!device->ops->trigger))
729 return -EINVAL;
730
731 mutex_init(&device->lock);
732
733 /* register a compressed card */
734 mutex_lock(&device_mutex);
735 retval = snd_compress_add_device(device);
736 mutex_unlock(&device_mutex);
737 return retval;
738}
739EXPORT_SYMBOL_GPL(snd_compress_register);
740
741int snd_compress_deregister(struct snd_compr *device)
742{
743 pr_debug("Removing compressed device %s\n", device->name);
744 mutex_lock(&device_mutex);
745 snd_compress_remove_device(device);
746 mutex_unlock(&device_mutex);
747 return 0;
748}
749EXPORT_SYMBOL_GPL(snd_compress_deregister);
750
751static int __init snd_compress_init(void)
752{
753 return 0;
754}
755
756static void __exit snd_compress_exit(void)
757{
758}
759
760module_init(snd_compress_init);
761module_exit(snd_compress_exit);
762
763MODULE_DESCRIPTION("ALSA Compressed offload framework");
764MODULE_AUTHOR("Vinod Koul <vinod.koul@linux.intel.com>");
765MODULE_LICENSE("GPL v2");
diff --git a/sound/core/ctljack.c b/sound/core/ctljack.c
new file mode 100644
index 00000000000..e4b38fbe51d
--- /dev/null
+++ b/sound/core/ctljack.c
@@ -0,0 +1,56 @@
1/*
2 * Helper functions for jack-detection kcontrols
3 *
4 * Copyright (c) 2011 Takashi Iwai <tiwai@suse.de>
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 Free
8 * Software Foundation; either version 2 of the License, or (at your option)
9 * any later version.
10 */
11
12#include <linux/kernel.h>
13#include <linux/export.h>
14#include <sound/core.h>
15#include <sound/control.h>
16
17#define jack_detect_kctl_info snd_ctl_boolean_mono_info
18
19static int jack_detect_kctl_get(struct snd_kcontrol *kcontrol,
20 struct snd_ctl_elem_value *ucontrol)
21{
22 ucontrol->value.integer.value[0] = kcontrol->private_value;
23 return 0;
24}
25
26static struct snd_kcontrol_new jack_detect_kctl = {
27 /* name is filled later */
28 .iface = SNDRV_CTL_ELEM_IFACE_CARD,
29 .access = SNDRV_CTL_ELEM_ACCESS_READ,
30 .info = jack_detect_kctl_info,
31 .get = jack_detect_kctl_get,
32};
33
34struct snd_kcontrol *
35snd_kctl_jack_new(const char *name, int idx, void *private_data)
36{
37 struct snd_kcontrol *kctl;
38 kctl = snd_ctl_new1(&jack_detect_kctl, private_data);
39 if (!kctl)
40 return NULL;
41 snprintf(kctl->id.name, sizeof(kctl->id.name), "%s Jack", name);
42 kctl->id.index = idx;
43 kctl->private_value = 0;
44 return kctl;
45}
46EXPORT_SYMBOL_GPL(snd_kctl_jack_new);
47
48void snd_kctl_jack_report(struct snd_card *card,
49 struct snd_kcontrol *kctl, bool status)
50{
51 if (kctl->private_value == status)
52 return;
53 kctl->private_value = status;
54 snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE, &kctl->id);
55}
56EXPORT_SYMBOL_GPL(snd_kctl_jack_report);
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c
index 3cc4b86dfb7..08fde0060fd 100644
--- a/sound/core/oss/pcm_oss.c
+++ b/sound/core/oss/pcm_oss.c
@@ -47,7 +47,7 @@
47 47
48static int dsp_map[SNDRV_CARDS]; 48static int dsp_map[SNDRV_CARDS];
49static int adsp_map[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = 1}; 49static int adsp_map[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = 1};
50static int nonblock_open = 1; 50static bool nonblock_open = 1;
51 51
52MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>, Abramo Bagnara <abramo@alsa-project.org>"); 52MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>, Abramo Bagnara <abramo@alsa-project.org>");
53MODULE_DESCRIPTION("PCM OSS emulation for ALSA."); 53MODULE_DESCRIPTION("PCM OSS emulation for ALSA.");
diff --git a/sound/core/seq/seq_dummy.c b/sound/core/seq/seq_dummy.c
index b9b2235d9ab..bbe32d2177d 100644
--- a/sound/core/seq/seq_dummy.c
+++ b/sound/core/seq/seq_dummy.c
@@ -65,7 +65,7 @@ MODULE_LICENSE("GPL");
65MODULE_ALIAS("snd-seq-client-" __stringify(SNDRV_SEQ_CLIENT_DUMMY)); 65MODULE_ALIAS("snd-seq-client-" __stringify(SNDRV_SEQ_CLIENT_DUMMY));
66 66
67static int ports = 1; 67static int ports = 1;
68static int duplex; 68static bool duplex;
69 69
70module_param(ports, int, 0444); 70module_param(ports, int, 0444);
71MODULE_PARM_DESC(ports, "number of ports to be created"); 71MODULE_PARM_DESC(ports, "number of ports to be created");
diff --git a/sound/core/sound.c b/sound/core/sound.c
index 828af353ea9..28f35593a75 100644
--- a/sound/core/sound.c
+++ b/sound/core/sound.c
@@ -229,6 +229,7 @@ static int snd_kernel_minor(int type, struct snd_card *card, int dev)
229 case SNDRV_DEVICE_TYPE_RAWMIDI: 229 case SNDRV_DEVICE_TYPE_RAWMIDI:
230 case SNDRV_DEVICE_TYPE_PCM_PLAYBACK: 230 case SNDRV_DEVICE_TYPE_PCM_PLAYBACK:
231 case SNDRV_DEVICE_TYPE_PCM_CAPTURE: 231 case SNDRV_DEVICE_TYPE_PCM_CAPTURE:
232 case SNDRV_DEVICE_TYPE_COMPRESS:
232 if (snd_BUG_ON(!card)) 233 if (snd_BUG_ON(!card))
233 return -EINVAL; 234 return -EINVAL;
234 minor = SNDRV_MINOR(card->number, type + dev); 235 minor = SNDRV_MINOR(card->number, type + dev);
diff --git a/sound/drivers/aloop.c b/sound/drivers/aloop.c
index d83bafc5d8b..ad079b63b8b 100644
--- a/sound/drivers/aloop.c
+++ b/sound/drivers/aloop.c
@@ -51,7 +51,7 @@ MODULE_SUPPORTED_DEVICE("{{ALSA,Loopback soundcard}}");
51 51
52static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 52static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
53static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 53static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
54static int enable[SNDRV_CARDS] = {1, [1 ... (SNDRV_CARDS - 1)] = 0}; 54static bool enable[SNDRV_CARDS] = {1, [1 ... (SNDRV_CARDS - 1)] = 0};
55static int pcm_substreams[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 8}; 55static int pcm_substreams[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 8};
56static int pcm_notify[SNDRV_CARDS]; 56static int pcm_notify[SNDRV_CARDS];
57 57
diff --git a/sound/drivers/dummy.c b/sound/drivers/dummy.c
index 97f1f93ed27..ad9434fd637 100644
--- a/sound/drivers/dummy.c
+++ b/sound/drivers/dummy.c
@@ -60,15 +60,15 @@ MODULE_SUPPORTED_DEVICE("{{ALSA,Dummy soundcard}}");
60 60
61static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 61static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
62static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 62static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
63static int enable[SNDRV_CARDS] = {1, [1 ... (SNDRV_CARDS - 1)] = 0}; 63static bool enable[SNDRV_CARDS] = {1, [1 ... (SNDRV_CARDS - 1)] = 0};
64static char *model[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = NULL}; 64static char *model[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = NULL};
65static int pcm_devs[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; 65static int pcm_devs[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1};
66static int pcm_substreams[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 8}; 66static int pcm_substreams[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 8};
67//static int midi_devs[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 2}; 67//static int midi_devs[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 2};
68#ifdef CONFIG_HIGH_RES_TIMERS 68#ifdef CONFIG_HIGH_RES_TIMERS
69static int hrtimer = 1; 69static bool hrtimer = 1;
70#endif 70#endif
71static int fake_buffer = 1; 71static bool fake_buffer = 1;
72 72
73module_param_array(index, int, NULL, 0444); 73module_param_array(index, int, NULL, 0444);
74MODULE_PARM_DESC(index, "Index value for dummy soundcard."); 74MODULE_PARM_DESC(index, "Index value for dummy soundcard.");
diff --git a/sound/drivers/ml403-ac97cr.c b/sound/drivers/ml403-ac97cr.c
index 2ee82c5d9ee..6c83b1aed28 100644
--- a/sound/drivers/ml403-ac97cr.c
+++ b/sound/drivers/ml403-ac97cr.c
@@ -73,7 +73,7 @@ MODULE_SUPPORTED_DEVICE("{{Xilinx,ML403 AC97 Controller Reference}}");
73 73
74static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 74static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
75static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 75static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
76static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; 76static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE;
77 77
78module_param_array(index, int, NULL, 0444); 78module_param_array(index, int, NULL, 0444);
79MODULE_PARM_DESC(index, "Index value for ML403 AC97 Controller Reference."); 79MODULE_PARM_DESC(index, "Index value for ML403 AC97 Controller Reference.");
@@ -1341,15 +1341,4 @@ static struct platform_driver snd_ml403_ac97cr_driver = {
1341 }, 1341 },
1342}; 1342};
1343 1343
1344static int __init alsa_card_ml403_ac97cr_init(void) 1344module_platform_driver(snd_ml403_ac97cr_driver);
1345{
1346 return platform_driver_register(&snd_ml403_ac97cr_driver);
1347}
1348
1349static void __exit alsa_card_ml403_ac97cr_exit(void)
1350{
1351 platform_driver_unregister(&snd_ml403_ac97cr_driver);
1352}
1353
1354module_init(alsa_card_ml403_ac97cr_init)
1355module_exit(alsa_card_ml403_ac97cr_exit)
diff --git a/sound/drivers/mpu401/mpu401.c b/sound/drivers/mpu401/mpu401.c
index 257569014f2..86f5fbc2da7 100644
--- a/sound/drivers/mpu401/mpu401.c
+++ b/sound/drivers/mpu401/mpu401.c
@@ -35,13 +35,13 @@ MODULE_LICENSE("GPL");
35 35
36static int index[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = -2}; /* exclude the first card */ 36static int index[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = -2}; /* exclude the first card */
37static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 37static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
38static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ 38static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */
39#ifdef CONFIG_PNP 39#ifdef CONFIG_PNP
40static int pnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; 40static bool pnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1};
41#endif 41#endif
42static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* MPU-401 port number */ 42static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* MPU-401 port number */
43static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* MPU-401 IRQ */ 43static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* MPU-401 IRQ */
44static int uart_enter[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; 44static bool uart_enter[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1};
45 45
46module_param_array(index, int, NULL, 0444); 46module_param_array(index, int, NULL, 0444);
47MODULE_PARM_DESC(index, "Index value for MPU-401 device."); 47MODULE_PARM_DESC(index, "Index value for MPU-401 device.");
diff --git a/sound/drivers/mts64.c b/sound/drivers/mts64.c
index f24bf9a06cf..621e60e2029 100644
--- a/sound/drivers/mts64.c
+++ b/sound/drivers/mts64.c
@@ -36,7 +36,7 @@
36 36
37static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 37static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
38static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 38static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
39static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 39static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
40 40
41static struct platform_device *platform_devices[SNDRV_CARDS]; 41static struct platform_device *platform_devices[SNDRV_CARDS];
42static int device_count; 42static int device_count;
diff --git a/sound/drivers/opl3/opl3_midi.c b/sound/drivers/opl3/opl3_midi.c
index 7d722a025d0..2bfe4bcb7a7 100644
--- a/sound/drivers/opl3/opl3_midi.c
+++ b/sound/drivers/opl3/opl3_midi.c
@@ -27,7 +27,7 @@
27 27
28extern char snd_opl3_regmap[MAX_OPL2_VOICES][4]; 28extern char snd_opl3_regmap[MAX_OPL2_VOICES][4];
29 29
30extern int use_internal_drums; 30extern bool use_internal_drums;
31 31
32static void snd_opl3_note_off_unsafe(void *p, int note, int vel, 32static void snd_opl3_note_off_unsafe(void *p, int note, int vel,
33 struct snd_midi_channel *chan); 33 struct snd_midi_channel *chan);
diff --git a/sound/drivers/opl3/opl3_seq.c b/sound/drivers/opl3/opl3_seq.c
index 723562e34fc..68399538e43 100644
--- a/sound/drivers/opl3/opl3_seq.c
+++ b/sound/drivers/opl3/opl3_seq.c
@@ -32,7 +32,7 @@ MODULE_AUTHOR("Uros Bizjak <uros@kss-loka.si>");
32MODULE_LICENSE("GPL"); 32MODULE_LICENSE("GPL");
33MODULE_DESCRIPTION("ALSA driver for OPL3 FM synth"); 33MODULE_DESCRIPTION("ALSA driver for OPL3 FM synth");
34 34
35int use_internal_drums = 0; 35bool use_internal_drums = 0;
36module_param(use_internal_drums, bool, 0444); 36module_param(use_internal_drums, bool, 0444);
37MODULE_PARM_DESC(use_internal_drums, "Enable internal OPL2/3 drums."); 37MODULE_PARM_DESC(use_internal_drums, "Enable internal OPL2/3 drums.");
38 38
diff --git a/sound/drivers/pcsp/pcsp.c b/sound/drivers/pcsp/pcsp.c
index 946a0cb996a..99704e6a2e2 100644
--- a/sound/drivers/pcsp/pcsp.c
+++ b/sound/drivers/pcsp/pcsp.c
@@ -25,8 +25,8 @@ MODULE_ALIAS("platform:pcspkr");
25 25
26static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */ 26static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */
27static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ 27static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */
28static int enable = SNDRV_DEFAULT_ENABLE1; /* Enable this card */ 28static bool enable = SNDRV_DEFAULT_ENABLE1; /* Enable this card */
29static int nopcm; /* Disable PCM capability of the driver */ 29static bool nopcm; /* Disable PCM capability of the driver */
30 30
31module_param(index, int, 0444); 31module_param(index, int, 0444);
32MODULE_PARM_DESC(index, "Index value for pcsp soundcard."); 32MODULE_PARM_DESC(index, "Index value for pcsp soundcard.");
diff --git a/sound/drivers/pcsp/pcsp_lib.c b/sound/drivers/pcsp/pcsp_lib.c
index ce9e7d170c0..434981dd4a6 100644
--- a/sound/drivers/pcsp/pcsp_lib.c
+++ b/sound/drivers/pcsp/pcsp_lib.c
@@ -14,7 +14,7 @@
14#include <asm/io.h> 14#include <asm/io.h>
15#include "pcsp.h" 15#include "pcsp.h"
16 16
17static int nforce_wa; 17static bool nforce_wa;
18module_param(nforce_wa, bool, 0444); 18module_param(nforce_wa, bool, 0444);
19MODULE_PARM_DESC(nforce_wa, "Apply NForce chipset workaround " 19MODULE_PARM_DESC(nforce_wa, "Apply NForce chipset workaround "
20 "(expect bad sound)"); 20 "(expect bad sound)");
diff --git a/sound/drivers/portman2x4.c b/sound/drivers/portman2x4.c
index f664823a963..3e32bd3d95d 100644
--- a/sound/drivers/portman2x4.c
+++ b/sound/drivers/portman2x4.c
@@ -55,7 +55,7 @@
55 55
56static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 56static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
57static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 57static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
58static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 58static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
59 59
60static struct platform_device *platform_devices[SNDRV_CARDS]; 60static struct platform_device *platform_devices[SNDRV_CARDS];
61static int device_count; 61static int device_count;
diff --git a/sound/drivers/serial-u16550.c b/sound/drivers/serial-u16550.c
index 85aad43f0b1..b2d0e8e49be 100644
--- a/sound/drivers/serial-u16550.c
+++ b/sound/drivers/serial-u16550.c
@@ -69,7 +69,7 @@ static char *adaptor_names[] = {
69 69
70static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 70static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
71static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 71static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
72static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ 72static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */
73static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x3f8,0x2f8,0x3e8,0x2e8 */ 73static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x3f8,0x2f8,0x3e8,0x2e8 */
74static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* 3,4,5,7,9,10,11,14,15 */ 74static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* 3,4,5,7,9,10,11,14,15 */
75static int speed[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 38400}; /* 9600,19200,38400,57600,115200 */ 75static int speed[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 38400}; /* 9600,19200,38400,57600,115200 */
@@ -77,7 +77,7 @@ static int base[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 115200}; /* baud bas
77static int outs[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; /* 1 to 16 */ 77static int outs[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; /* 1 to 16 */
78static int ins[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; /* 1 to 16 */ 78static int ins[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; /* 1 to 16 */
79static int adaptor[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = SNDRV_SERIAL_SOUNDCANVAS}; 79static int adaptor[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = SNDRV_SERIAL_SOUNDCANVAS};
80static int droponfull[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS -1)] = SNDRV_SERIAL_NORMALBUFF }; 80static bool droponfull[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS -1)] = SNDRV_SERIAL_NORMALBUFF };
81 81
82module_param_array(index, int, NULL, 0444); 82module_param_array(index, int, NULL, 0444);
83MODULE_PARM_DESC(index, "Index value for Serial MIDI."); 83MODULE_PARM_DESC(index, "Index value for Serial MIDI.");
diff --git a/sound/drivers/virmidi.c b/sound/drivers/virmidi.c
index d79d6edc0f5..9d97478a18b 100644
--- a/sound/drivers/virmidi.c
+++ b/sound/drivers/virmidi.c
@@ -63,7 +63,7 @@ MODULE_SUPPORTED_DEVICE("{{ALSA,Virtual rawmidi device}}");
63 63
64static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 64static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
65static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 65static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
66static int enable[SNDRV_CARDS] = {1, [1 ... (SNDRV_CARDS - 1)] = 0}; 66static bool enable[SNDRV_CARDS] = {1, [1 ... (SNDRV_CARDS - 1)] = 0};
67static int midi_devs[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 4}; 67static int midi_devs[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 4};
68 68
69module_param_array(index, int, NULL, 0444); 69module_param_array(index, int, NULL, 0444);
diff --git a/sound/isa/ad1816a/ad1816a.c b/sound/isa/ad1816a/ad1816a.c
index cd44c74207d..94b83b6e46a 100644
--- a/sound/isa/ad1816a/ad1816a.c
+++ b/sound/isa/ad1816a/ad1816a.c
@@ -44,7 +44,7 @@ MODULE_SUPPORTED_DEVICE("{{Highscreen,Sound-Boostar 16 3D},"
44 44
45static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 1-MAX */ 45static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 1-MAX */
46static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 46static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
47static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */ 47static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */
48static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ 48static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */
49static long mpu_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ 49static long mpu_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */
50static long fm_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ 50static long fm_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */
diff --git a/sound/isa/ad1848/ad1848.c b/sound/isa/ad1848/ad1848.c
index 34ab69bdffc..2af77faefbb 100644
--- a/sound/isa/ad1848/ad1848.c
+++ b/sound/isa/ad1848/ad1848.c
@@ -43,11 +43,11 @@ MODULE_SUPPORTED_DEVICE("{{Analog Devices,AD1848},"
43 43
44static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 44static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
45static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 45static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
46static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ 46static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */
47static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ 47static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */
48static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* 5,7,9,11,12,15 */ 48static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* 5,7,9,11,12,15 */
49static int dma1[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; /* 0,1,3,5,6,7 */ 49static int dma1[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; /* 0,1,3,5,6,7 */
50static int thinkpad[SNDRV_CARDS]; /* Thinkpad special case */ 50static bool thinkpad[SNDRV_CARDS]; /* Thinkpad special case */
51 51
52module_param_array(index, int, NULL, 0444); 52module_param_array(index, int, NULL, 0444);
53MODULE_PARM_DESC(index, "Index value for " CRD_NAME " soundcard."); 53MODULE_PARM_DESC(index, "Index value for " CRD_NAME " soundcard.");
diff --git a/sound/isa/adlib.c b/sound/isa/adlib.c
index 7465ae036e0..4d50c69f329 100644
--- a/sound/isa/adlib.c
+++ b/sound/isa/adlib.c
@@ -18,7 +18,7 @@ MODULE_LICENSE("GPL");
18 18
19static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 19static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
20static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 20static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
21static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; 21static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE;
22static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; 22static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT;
23 23
24module_param_array(index, int, NULL, 0444); 24module_param_array(index, int, NULL, 0444);
diff --git a/sound/isa/als100.c b/sound/isa/als100.c
index fc5b38fd265..d1f4351fb6e 100644
--- a/sound/isa/als100.c
+++ b/sound/isa/als100.c
@@ -54,7 +54,7 @@ MODULE_LICENSE("GPL");
54 54
55static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 55static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
56static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 56static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
57static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ 57static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */
58static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ 58static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */
59static long mpu_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ 59static long mpu_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */
60static long fm_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ 60static long fm_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */
diff --git a/sound/isa/azt2320.c b/sound/isa/azt2320.c
index e55f3ebe87b..6a2c78ef1d8 100644
--- a/sound/isa/azt2320.c
+++ b/sound/isa/azt2320.c
@@ -55,7 +55,7 @@ MODULE_SUPPORTED_DEVICE("{{Aztech Systems,PRO16V},"
55 55
56static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 56static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
57static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 57static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
58static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */ 58static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */
59static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ 59static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */
60static long wss_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ 60static long wss_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */
61static long mpu_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ 61static long mpu_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */
diff --git a/sound/isa/cmi8330.c b/sound/isa/cmi8330.c
index c94578d40b1..7bd5e337ee9 100644
--- a/sound/isa/cmi8330.c
+++ b/sound/isa/cmi8330.c
@@ -69,9 +69,9 @@ MODULE_SUPPORTED_DEVICE("{{C-Media,CMI8330,isapnp:{CMI0001,@@@0001,@X@0001}}}");
69 69
70static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 70static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
71static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 71static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
72static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; 72static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP;
73#ifdef CONFIG_PNP 73#ifdef CONFIG_PNP
74static int isapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; 74static bool isapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1};
75#endif 75#endif
76static long sbport[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; 76static long sbport[SNDRV_CARDS] = SNDRV_DEFAULT_PORT;
77static int sbirq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; 77static int sbirq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ;
diff --git a/sound/isa/cs423x/cs4231.c b/sound/isa/cs423x/cs4231.c
index 6d81fa75c33..99dda45e82f 100644
--- a/sound/isa/cs423x/cs4231.c
+++ b/sound/isa/cs423x/cs4231.c
@@ -41,7 +41,7 @@ MODULE_SUPPORTED_DEVICE("{{Crystal Semiconductors,CS4231}}");
41 41
42static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 42static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
43static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 43static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
44static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ 44static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */
45static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ 45static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */
46static long mpu_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ 46static long mpu_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */
47static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* 5,7,9,11,12,15 */ 47static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* 5,7,9,11,12,15 */
diff --git a/sound/isa/cs423x/cs4236.c b/sound/isa/cs423x/cs4236.c
index f5a94b6e624..740c51a1ed7 100644
--- a/sound/isa/cs423x/cs4236.c
+++ b/sound/isa/cs423x/cs4236.c
@@ -74,9 +74,9 @@ MODULE_ALIAS("snd_cs4232");
74 74
75static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 75static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
76static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 76static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
77static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */ 77static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */
78#ifdef CONFIG_PNP 78#ifdef CONFIG_PNP
79static int isapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; 79static bool isapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1};
80#endif 80#endif
81static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ 81static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */
82static long cport[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ 82static long cport[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */
diff --git a/sound/isa/es1688/es1688.c b/sound/isa/es1688/es1688.c
index 9a1a6f2c448..b036e60f62d 100644
--- a/sound/isa/es1688/es1688.c
+++ b/sound/isa/es1688/es1688.c
@@ -51,9 +51,9 @@ MODULE_ALIAS("snd_es968");
51static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 51static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
52static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 52static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
53#ifdef CONFIG_PNP 53#ifdef CONFIG_PNP
54static int isapnp[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; 54static bool isapnp[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP;
55#endif 55#endif
56static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ 56static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */
57static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x220,0x240,0x260 */ 57static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x220,0x240,0x260 */
58static long fm_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* Usually 0x388 */ 58static long fm_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* Usually 0x388 */
59static long mpu_port[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = -1}; 59static long mpu_port[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = -1};
diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c
index 98e3ac1cfa0..c20baafd9b7 100644
--- a/sound/isa/es18xx.c
+++ b/sound/isa/es18xx.c
@@ -1964,9 +1964,9 @@ MODULE_SUPPORTED_DEVICE("{{ESS,ES1868 PnP AudioDrive},"
1964 1964
1965static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 1965static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
1966static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 1966static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
1967static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */ 1967static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */
1968#ifdef CONFIG_PNP 1968#ifdef CONFIG_PNP
1969static int isapnp[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; 1969static bool isapnp[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP;
1970#endif 1970#endif
1971static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x220,0x240,0x260,0x280 */ 1971static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x220,0x240,0x260,0x280 */
1972#ifndef CONFIG_PNP 1972#ifndef CONFIG_PNP
diff --git a/sound/isa/galaxy/galaxy.c b/sound/isa/galaxy/galaxy.c
index e51d3244742..55e20782858 100644
--- a/sound/isa/galaxy/galaxy.c
+++ b/sound/isa/galaxy/galaxy.c
@@ -35,7 +35,7 @@ MODULE_LICENSE("GPL");
35 35
36static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 36static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
37static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 37static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
38static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; 38static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE;
39 39
40module_param_array(index, int, NULL, 0444); 40module_param_array(index, int, NULL, 0444);
41MODULE_PARM_DESC(index, "Index value for " CRD_NAME " soundcard."); 41MODULE_PARM_DESC(index, "Index value for " CRD_NAME " soundcard.");
diff --git a/sound/isa/gus/gusclassic.c b/sound/isa/gus/gusclassic.c
index d7296500bce..bf633367161 100644
--- a/sound/isa/gus/gusclassic.c
+++ b/sound/isa/gus/gusclassic.c
@@ -42,7 +42,7 @@ MODULE_SUPPORTED_DEVICE("{{Gravis,UltraSound Classic}}");
42 42
43static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 43static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
44static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 44static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
45static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ 45static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */
46static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x220,0x230,0x240,0x250,0x260 */ 46static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x220,0x230,0x240,0x250,0x260 */
47static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* 3,5,9,11,12,15 */ 47static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* 3,5,9,11,12,15 */
48static int dma1[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; /* 1,3,5,6,7 */ 48static int dma1[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; /* 1,3,5,6,7 */
diff --git a/sound/isa/gus/gusextreme.c b/sound/isa/gus/gusextreme.c
index 597accdb15d..bc10cc26e5f 100644
--- a/sound/isa/gus/gusextreme.c
+++ b/sound/isa/gus/gusextreme.c
@@ -46,7 +46,7 @@ MODULE_SUPPORTED_DEVICE("{{Gravis,UltraSound Extreme}}");
46 46
47static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 47static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
48static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 48static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
49static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ 49static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */
50static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x220,0x240,0x260 */ 50static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x220,0x240,0x260 */
51static long gf1_port[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS) - 1] = -1}; /* 0x210,0x220,0x230,0x240,0x250,0x260,0x270 */ 51static long gf1_port[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS) - 1] = -1}; /* 0x210,0x220,0x230,0x240,0x250,0x260,0x270 */
52static long mpu_port[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS) - 1] = -1}; /* 0x300,0x310,0x320 */ 52static long mpu_port[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS) - 1] = -1}; /* 0x300,0x310,0x320 */
diff --git a/sound/isa/gus/gusmax.c b/sound/isa/gus/gusmax.c
index 933cb0f4c54..41c3f448745 100644
--- a/sound/isa/gus/gusmax.c
+++ b/sound/isa/gus/gusmax.c
@@ -40,7 +40,7 @@ MODULE_SUPPORTED_DEVICE("{{Gravis,UltraSound MAX}}");
40 40
41static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 41static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
42static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 42static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
43static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ 43static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */
44static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x220,0x230,0x240,0x250,0x260 */ 44static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x220,0x230,0x240,0x250,0x260 */
45static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* 2,3,5,9,11,12,15 */ 45static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* 2,3,5,9,11,12,15 */
46static int dma1[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; /* 1,3,5,6,7 */ 46static int dma1[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; /* 1,3,5,6,7 */
diff --git a/sound/isa/gus/interwave.c b/sound/isa/gus/interwave.c
index 8e7e19484da..a76bc8d27c1 100644
--- a/sound/isa/gus/interwave.c
+++ b/sound/isa/gus/interwave.c
@@ -55,9 +55,9 @@ MODULE_SUPPORTED_DEVICE("{{AMD,InterWave STB with TEA6330T}}");
55 55
56static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 56static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
57static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 57static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
58static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */ 58static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */
59#ifdef CONFIG_PNP 59#ifdef CONFIG_PNP
60static int isapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; 60static bool isapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1};
61#endif 61#endif
62static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x210,0x220,0x230,0x240,0x250,0x260 */ 62static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x210,0x220,0x230,0x240,0x250,0x260 */
63#ifdef SNDRV_STB 63#ifdef SNDRV_STB
diff --git a/sound/isa/msnd/msnd_pinnacle.c b/sound/isa/msnd/msnd_pinnacle.c
index 0961e2cf20c..29cc8e162b0 100644
--- a/sound/isa/msnd/msnd_pinnacle.c
+++ b/sound/isa/msnd/msnd_pinnacle.c
@@ -785,7 +785,7 @@ static int write_ndelay[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = 1 };
785static int calibrate_signal; 785static int calibrate_signal;
786 786
787#ifdef CONFIG_PNP 787#ifdef CONFIG_PNP
788static int isapnp[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 788static bool isapnp[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
789module_param_array(isapnp, bool, NULL, 0444); 789module_param_array(isapnp, bool, NULL, 0444);
790MODULE_PARM_DESC(isapnp, "ISA PnP detection for specified soundcard."); 790MODULE_PARM_DESC(isapnp, "ISA PnP detection for specified soundcard.");
791#define has_isapnp(x) isapnp[x] 791#define has_isapnp(x) isapnp[x]
diff --git a/sound/isa/opl3sa2.c b/sound/isa/opl3sa2.c
index 64a9a2177f4..f6cc0b917ef 100644
--- a/sound/isa/opl3sa2.c
+++ b/sound/isa/opl3sa2.c
@@ -46,9 +46,9 @@ MODULE_SUPPORTED_DEVICE("{{Yamaha,YMF719E-S},"
46 46
47static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 47static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
48static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 48static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
49static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */ 49static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */
50#ifdef CONFIG_PNP 50#ifdef CONFIG_PNP
51static int isapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; 51static bool isapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1};
52#endif 52#endif
53static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0xf86,0x370,0x100 */ 53static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0xf86,0x370,0x100 */
54static long sb_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x220,0x240,0x260 */ 54static long sb_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x220,0x240,0x260 */
diff --git a/sound/isa/opti9xx/miro.c b/sound/isa/opti9xx/miro.c
index 3785b7a784c..c24594c866f 100644
--- a/sound/isa/opti9xx/miro.c
+++ b/sound/isa/opti9xx/miro.c
@@ -61,7 +61,7 @@ static int dma2 = SNDRV_DEFAULT_DMA1; /* 0,1,3 */
61static int wss; 61static int wss;
62static int ide; 62static int ide;
63#ifdef CONFIG_PNP 63#ifdef CONFIG_PNP
64static int isapnp = 1; /* Enable ISA PnP detection */ 64static bool isapnp = 1; /* Enable ISA PnP detection */
65#endif 65#endif
66 66
67module_param(index, int, 0444); 67module_param(index, int, 0444);
diff --git a/sound/isa/opti9xx/opti92x-ad1848.c b/sound/isa/opti9xx/opti92x-ad1848.c
index 97871bebea9..babaedd242f 100644
--- a/sound/isa/opti9xx/opti92x-ad1848.c
+++ b/sound/isa/opti9xx/opti92x-ad1848.c
@@ -63,7 +63,7 @@ MODULE_SUPPORTED_DEVICE("{{OPTi,82C924 (AD1848)},"
63 63
64static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */ 64static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */
65static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ 65static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */
66//static int enable = SNDRV_DEFAULT_ENABLE1; /* Enable this card */ 66//static bool enable = SNDRV_DEFAULT_ENABLE1; /* Enable this card */
67#ifdef CONFIG_PNP 67#ifdef CONFIG_PNP
68static int isapnp = 1; /* Enable ISA PnP detection */ 68static int isapnp = 1; /* Enable ISA PnP detection */
69#endif 69#endif
diff --git a/sound/isa/sb/jazz16.c b/sound/isa/sb/jazz16.c
index 54e3c2c1806..410758c6809 100644
--- a/sound/isa/sb/jazz16.c
+++ b/sound/isa/sb/jazz16.c
@@ -36,7 +36,7 @@ MODULE_LICENSE("GPL");
36 36
37static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 37static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
38static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 38static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
39static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ 39static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */
40static unsigned long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; 40static unsigned long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT;
41static unsigned long mpu_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; 41static unsigned long mpu_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT;
42static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; 42static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ;
diff --git a/sound/isa/sb/sb16.c b/sound/isa/sb/sb16.c
index 115c7748204..39b8eca1521 100644
--- a/sound/isa/sb/sb16.c
+++ b/sound/isa/sb/sb16.c
@@ -68,9 +68,9 @@ MODULE_SUPPORTED_DEVICE("{{Creative Labs,SB AWE 32},"
68 68
69static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 69static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
70static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 70static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
71static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */ 71static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */
72#ifdef CONFIG_PNP 72#ifdef CONFIG_PNP
73static int isapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; 73static bool isapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1};
74#endif 74#endif
75static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x220,0x240,0x260,0x280 */ 75static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x220,0x240,0x260,0x280 */
76static long mpu_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x330,0x300 */ 76static long mpu_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x330,0x300 */
diff --git a/sound/isa/sb/sb8.c b/sound/isa/sb/sb8.c
index 453ef283491..ab5cebea52e 100644
--- a/sound/isa/sb/sb8.c
+++ b/sound/isa/sb/sb8.c
@@ -36,7 +36,7 @@ MODULE_SUPPORTED_DEVICE("{{Creative Labs,SB 1.0/SB 2.0/SB Pro}}");
36 36
37static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 37static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
38static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 38static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
39static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ 39static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */
40static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x220,0x240,0x260 */ 40static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x220,0x240,0x260 */
41static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* 5,7,9,10 */ 41static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* 5,7,9,10 */
42static int dma8[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; /* 1,3 */ 42static int dma8[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; /* 1,3 */
diff --git a/sound/isa/sc6000.c b/sound/isa/sc6000.c
index 207c161f100..d97d0f38181 100644
--- a/sound/isa/sc6000.c
+++ b/sound/isa/sc6000.c
@@ -48,7 +48,7 @@ MODULE_SUPPORTED_DEVICE("{{Gallant, SC-6000},"
48 48
49static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 49static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
50static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 50static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
51static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ 51static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */
52static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x220, 0x240 */ 52static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x220, 0x240 */
53static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* 5, 7, 9, 10, 11 */ 53static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* 5, 7, 9, 10, 11 */
54static long mss_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x530, 0xe80 */ 54static long mss_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x530, 0xe80 */
diff --git a/sound/isa/wavefront/wavefront.c b/sound/isa/wavefront/wavefront.c
index 150b96b3ea1..e0a73271cb9 100644
--- a/sound/isa/wavefront/wavefront.c
+++ b/sound/isa/wavefront/wavefront.c
@@ -38,9 +38,9 @@ MODULE_SUPPORTED_DEVICE("{{Turtle Beach,Maui/Tropez/Tropez+}}");
38 38
39static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 39static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
40static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 40static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
41static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ 41static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */
42#ifdef CONFIG_PNP 42#ifdef CONFIG_PNP
43static int isapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; 43static bool isapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1};
44#endif 44#endif
45static long cs4232_pcm_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ 45static long cs4232_pcm_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */
46static int cs4232_pcm_irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* 5,7,9,11,12,15 */ 46static int cs4232_pcm_irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* 5,7,9,11,12,15 */
@@ -51,7 +51,7 @@ static int ics2115_irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* 2,9,11,12,15 */
51static long fm_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ 51static long fm_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */
52static int dma1[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; /* 0,1,3,5,6,7 */ 52static int dma1[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; /* 0,1,3,5,6,7 */
53static int dma2[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; /* 0,1,3,5,6,7 */ 53static int dma2[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; /* 0,1,3,5,6,7 */
54static int use_cs4232_midi[SNDRV_CARDS]; 54static bool use_cs4232_midi[SNDRV_CARDS];
55 55
56module_param_array(index, int, NULL, 0444); 56module_param_array(index, int, NULL, 0444);
57MODULE_PARM_DESC(index, "Index value for WaveFront soundcard."); 57MODULE_PARM_DESC(index, "Index value for WaveFront soundcard.");
diff --git a/sound/mips/hal2.c b/sound/mips/hal2.c
index 2e6c85894e0..5f88d1f09ff 100644
--- a/sound/mips/hal2.c
+++ b/sound/mips/hal2.c
@@ -935,15 +935,4 @@ static struct platform_driver hal2_driver = {
935 } 935 }
936}; 936};
937 937
938static int __init alsa_card_hal2_init(void) 938module_platform_driver(hal2_driver);
939{
940 return platform_driver_register(&hal2_driver);
941}
942
943static void __exit alsa_card_hal2_exit(void)
944{
945 platform_driver_unregister(&hal2_driver);
946}
947
948module_init(alsa_card_hal2_init);
949module_exit(alsa_card_hal2_exit);
diff --git a/sound/mips/sgio2audio.c b/sound/mips/sgio2audio.c
index 69425d4c91f..ceaa593ea4e 100644
--- a/sound/mips/sgio2audio.c
+++ b/sound/mips/sgio2audio.c
@@ -976,15 +976,4 @@ static struct platform_driver sgio2audio_driver = {
976 } 976 }
977}; 977};
978 978
979static int __init alsa_card_sgio2audio_init(void) 979module_platform_driver(sgio2audio_driver);
980{
981 return platform_driver_register(&sgio2audio_driver);
982}
983
984static void __exit alsa_card_sgio2audio_exit(void)
985{
986 platform_driver_unregister(&sgio2audio_driver);
987}
988
989module_init(alsa_card_sgio2audio_init)
990module_exit(alsa_card_sgio2audio_exit)
diff --git a/sound/oss/Kconfig b/sound/oss/Kconfig
index 6c9e8e8f45f..5849b129e50 100644
--- a/sound/oss/Kconfig
+++ b/sound/oss/Kconfig
@@ -521,7 +521,7 @@ config SC6600_CDROMBASE
521 521
522config SOUND_VIDC 522config SOUND_VIDC
523 tristate "VIDC 16-bit sound" 523 tristate "VIDC 16-bit sound"
524 depends on ARM && (ARCH_ACORN || ARCH_CLPS7500) 524 depends on ARM && ARCH_ACORN
525 help 525 help
526 16-bit support for the VIDC onboard sound hardware found on Acorn 526 16-bit support for the VIDC onboard sound hardware found on Acorn
527 machines. 527 machines.
diff --git a/sound/oss/ad1848.c b/sound/oss/ad1848.c
index 8a197fd3c57..98d23bdcaf2 100644
--- a/sound/oss/ad1848.c
+++ b/sound/oss/ad1848.c
@@ -119,9 +119,9 @@ ad1848_port_info;
119static struct address_info cfg; 119static struct address_info cfg;
120static int nr_ad1848_devs; 120static int nr_ad1848_devs;
121 121
122static int deskpro_xl; 122static bool deskpro_xl;
123static int deskpro_m; 123static bool deskpro_m;
124static int soundpro; 124static bool soundpro;
125 125
126static volatile signed char irq2dev[17] = { 126static volatile signed char irq2dev[17] = {
127 -1, -1, -1, -1, -1, -1, -1, -1, 127 -1, -1, -1, -1, -1, -1, -1, -1,
@@ -177,7 +177,7 @@ static struct {
177#ifdef CONFIG_PNP 177#ifdef CONFIG_PNP
178static int isapnp = 1; 178static int isapnp = 1;
179static int isapnpjump; 179static int isapnpjump;
180static int reverse; 180static bool reverse;
181 181
182static int audio_activated; 182static int audio_activated;
183#else 183#else
diff --git a/sound/oss/msnd_pinnacle.c b/sound/oss/msnd_pinnacle.c
index 7b5c77b32a9..eba734560f6 100644
--- a/sound/oss/msnd_pinnacle.c
+++ b/sound/oss/msnd_pinnacle.c
@@ -1701,7 +1701,7 @@ static int joystick_io __initdata = CONFIG_MSNDPIN_JOYSTICK_IO;
1701#ifndef CONFIG_MSNDPIN_DIGITAL 1701#ifndef CONFIG_MSNDPIN_DIGITAL
1702# define CONFIG_MSNDPIN_DIGITAL 0 1702# define CONFIG_MSNDPIN_DIGITAL 0
1703#endif 1703#endif
1704static int digital __initdata = CONFIG_MSNDPIN_DIGITAL; 1704static bool digital __initdata = CONFIG_MSNDPIN_DIGITAL;
1705 1705
1706#endif /* MSND_CLASSIC */ 1706#endif /* MSND_CLASSIC */
1707 1707
diff --git a/sound/oss/pas2_card.c b/sound/oss/pas2_card.c
index 7f377ec3486..dabf8a871dc 100644
--- a/sound/oss/pas2_card.c
+++ b/sound/oss/pas2_card.c
@@ -41,19 +41,19 @@ static int pas_irq;
41static int pas_sb_base; 41static int pas_sb_base;
42DEFINE_SPINLOCK(pas_lock); 42DEFINE_SPINLOCK(pas_lock);
43#ifndef CONFIG_PAS_JOYSTICK 43#ifndef CONFIG_PAS_JOYSTICK
44static int joystick; 44static bool joystick;
45#else 45#else
46static int joystick = 1; 46static bool joystick = 1;
47#endif 47#endif
48#ifdef SYMPHONY_PAS 48#ifdef SYMPHONY_PAS
49static int symphony = 1; 49static bool symphony = 1;
50#else 50#else
51static int symphony; 51static bool symphony;
52#endif 52#endif
53#ifdef BROKEN_BUS_CLOCK 53#ifdef BROKEN_BUS_CLOCK
54static int broken_bus_clock = 1; 54static bool broken_bus_clock = 1;
55#else 55#else
56static int broken_bus_clock; 56static bool broken_bus_clock;
57#endif 57#endif
58 58
59static struct address_info cfg; 59static struct address_info cfg;
diff --git a/sound/oss/pss.c b/sound/oss/pss.c
index 2fc0624024b..0f32a561f15 100644
--- a/sound/oss/pss.c
+++ b/sound/oss/pss.c
@@ -117,9 +117,9 @@
117 117
118/* If compiled into kernel, it enable or disable pss mixer */ 118/* If compiled into kernel, it enable or disable pss mixer */
119#ifdef CONFIG_PSS_MIXER 119#ifdef CONFIG_PSS_MIXER
120static int pss_mixer = 1; 120static bool pss_mixer = 1;
121#else 121#else
122static int pss_mixer; 122static bool pss_mixer;
123#endif 123#endif
124 124
125 125
@@ -147,7 +147,7 @@ static DEFINE_SPINLOCK(lock);
147static int pss_initialized; 147static int pss_initialized;
148static int nonstandard_microcode; 148static int nonstandard_microcode;
149static int pss_cdrom_port = -1; /* Parameter for the PSS cdrom port */ 149static int pss_cdrom_port = -1; /* Parameter for the PSS cdrom port */
150static int pss_enable_joystick; /* Parameter for enabling the joystick */ 150static bool pss_enable_joystick; /* Parameter for enabling the joystick */
151static coproc_operations pss_coproc_operations; 151static coproc_operations pss_coproc_operations;
152 152
153static void pss_write(pss_confdata *devc, int data) 153static void pss_write(pss_confdata *devc, int data)
@@ -1133,8 +1133,8 @@ static int mss_irq __initdata = -1;
1133static int mss_dma __initdata = -1; 1133static int mss_dma __initdata = -1;
1134static int mpu_io __initdata = -1; 1134static int mpu_io __initdata = -1;
1135static int mpu_irq __initdata = -1; 1135static int mpu_irq __initdata = -1;
1136static int pss_no_sound = 0; /* Just configure non-sound components */ 1136static bool pss_no_sound = 0; /* Just configure non-sound components */
1137static int pss_keep_settings = 1; /* Keep hardware settings at module exit */ 1137static bool pss_keep_settings = 1; /* Keep hardware settings at module exit */
1138static char *pss_firmware = "/etc/sound/pss_synth"; 1138static char *pss_firmware = "/etc/sound/pss_synth";
1139 1139
1140module_param(pss_io, int, 0); 1140module_param(pss_io, int, 0);
diff --git a/sound/oss/trix.c b/sound/oss/trix.c
index e04169e8e3f..944e0c01548 100644
--- a/sound/oss/trix.c
+++ b/sound/oss/trix.c
@@ -31,7 +31,7 @@
31 31
32static int mpu; 32static int mpu;
33 33
34static int joystick; 34static bool joystick;
35 35
36static unsigned char trix_read(int addr) 36static unsigned char trix_read(int addr)
37{ 37{
diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c
index fac51eef272..9473fca9681 100644
--- a/sound/pci/ac97/ac97_codec.c
+++ b/sound/pci/ac97/ac97_codec.c
@@ -42,7 +42,7 @@ MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>");
42MODULE_DESCRIPTION("Universal interface for Audio Codec '97"); 42MODULE_DESCRIPTION("Universal interface for Audio Codec '97");
43MODULE_LICENSE("GPL"); 43MODULE_LICENSE("GPL");
44 44
45static int enable_loopback; 45static bool enable_loopback;
46 46
47module_param(enable_loopback, bool, 0444); 47module_param(enable_loopback, bool, 0444);
48MODULE_PARM_DESC(enable_loopback, "Enable AC97 ADC/DAC Loopback Control"); 48MODULE_PARM_DESC(enable_loopback, "Enable AC97 ADC/DAC Loopback Control");
diff --git a/sound/pci/ad1889.c b/sound/pci/ad1889.c
index 6e311184bb1..9d91d61902b 100644
--- a/sound/pci/ad1889.c
+++ b/sound/pci/ad1889.c
@@ -66,7 +66,7 @@ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
66module_param_array(id, charp, NULL, 0444); 66module_param_array(id, charp, NULL, 0444);
67MODULE_PARM_DESC(id, "ID string for the AD1889 soundcard."); 67MODULE_PARM_DESC(id, "ID string for the AD1889 soundcard.");
68 68
69static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 69static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
70module_param_array(enable, bool, NULL, 0444); 70module_param_array(enable, bool, NULL, 0444);
71MODULE_PARM_DESC(enable, "Enable AD1889 soundcard."); 71MODULE_PARM_DESC(enable, "Enable AD1889 soundcard.");
72 72
diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c
index ef85ac5d900..bdd6164e9c7 100644
--- a/sound/pci/ali5451/ali5451.c
+++ b/sound/pci/ali5451/ali5451.c
@@ -48,7 +48,7 @@ MODULE_SUPPORTED_DEVICE("{{ALI,M5451,pci},{ALI,M5451}}");
48static int index = SNDRV_DEFAULT_IDX1; /* Index */ 48static int index = SNDRV_DEFAULT_IDX1; /* Index */
49static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ 49static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */
50static int pcm_channels = 32; 50static int pcm_channels = 32;
51static int spdif; 51static bool spdif;
52 52
53module_param(index, int, 0444); 53module_param(index, int, 0444);
54MODULE_PARM_DESC(index, "Index value for ALI M5451 PCI Audio."); 54MODULE_PARM_DESC(index, "Index value for ALI M5451 PCI Audio.");
@@ -60,7 +60,7 @@ module_param(spdif, bool, 0444);
60MODULE_PARM_DESC(spdif, "Support SPDIF I/O"); 60MODULE_PARM_DESC(spdif, "Support SPDIF I/O");
61 61
62/* just for backward compatibility */ 62/* just for backward compatibility */
63static int enable; 63static bool enable;
64module_param(enable, bool, 0444); 64module_param(enable, bool, 0444);
65 65
66 66
diff --git a/sound/pci/als300.c b/sound/pci/als300.c
index 8dc77a0a5d8..8196e229b2d 100644
--- a/sound/pci/als300.c
+++ b/sound/pci/als300.c
@@ -115,7 +115,14 @@ MODULE_SUPPORTED_DEVICE("{{Avance Logic,ALS300},{Avance Logic,ALS300+}}");
115 115
116static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 116static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
117static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 117static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
118static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 118static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
119
120module_param_array(index, int, NULL, 0444);
121MODULE_PARM_DESC(index, "Index value for ALS300 sound card.");
122module_param_array(id, charp, NULL, 0444);
123MODULE_PARM_DESC(id, "ID string for ALS300 sound card.");
124module_param_array(enable, bool, NULL, 0444);
125MODULE_PARM_DESC(enable, "Enable ALS300 sound card.");
119 126
120struct snd_als300 { 127struct snd_als300 {
121 unsigned long port; 128 unsigned long port;
diff --git a/sound/pci/als4000.c b/sound/pci/als4000.c
index 28ef40e01cc..3269b8011ea 100644
--- a/sound/pci/als4000.c
+++ b/sound/pci/als4000.c
@@ -90,7 +90,7 @@ MODULE_SUPPORTED_DEVICE("{{Avance Logic,ALS4000}}");
90 90
91static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 91static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
92static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 92static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
93static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 93static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
94#ifdef SUPPORT_JOYSTICK 94#ifdef SUPPORT_JOYSTICK
95static int joystick_port[SNDRV_CARDS]; 95static int joystick_port[SNDRV_CARDS];
96#endif 96#endif
diff --git a/sound/pci/asihpi/asihpi.c b/sound/pci/asihpi/asihpi.c
index f4b9e2b7ae8..e8de831f98b 100644
--- a/sound/pci/asihpi/asihpi.c
+++ b/sound/pci/asihpi/asihpi.c
@@ -23,8 +23,11 @@
23 */ 23 */
24 24
25#include "hpi_internal.h" 25#include "hpi_internal.h"
26#include "hpi_version.h"
26#include "hpimsginit.h" 27#include "hpimsginit.h"
27#include "hpioctl.h" 28#include "hpioctl.h"
29#include "hpicmn.h"
30
28 31
29#include <linux/pci.h> 32#include <linux/pci.h>
30#include <linux/init.h> 33#include <linux/init.h>
@@ -44,7 +47,8 @@
44 47
45MODULE_LICENSE("GPL"); 48MODULE_LICENSE("GPL");
46MODULE_AUTHOR("AudioScience inc. <support@audioscience.com>"); 49MODULE_AUTHOR("AudioScience inc. <support@audioscience.com>");
47MODULE_DESCRIPTION("AudioScience ALSA ASI5000 ASI6000 ASI87xx ASI89xx"); 50MODULE_DESCRIPTION("AudioScience ALSA ASI5000 ASI6000 ASI87xx ASI89xx "
51 HPI_VER_STRING);
48 52
49#if defined CONFIG_SND_DEBUG_VERBOSE 53#if defined CONFIG_SND_DEBUG_VERBOSE
50/** 54/**
@@ -63,8 +67,8 @@ MODULE_DESCRIPTION("AudioScience ALSA ASI5000 ASI6000 ASI87xx ASI89xx");
63 67
64static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* index 0-MAX */ 68static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* index 0-MAX */
65static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 69static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
66static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 70static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
67static int enable_hpi_hwdep = 1; 71static bool enable_hpi_hwdep = 1;
68 72
69module_param_array(index, int, NULL, S_IRUGO); 73module_param_array(index, int, NULL, S_IRUGO);
70MODULE_PARM_DESC(index, "ALSA index value for AudioScience soundcard."); 74MODULE_PARM_DESC(index, "ALSA index value for AudioScience soundcard.");
@@ -119,12 +123,7 @@ struct clk_cache {
119struct snd_card_asihpi { 123struct snd_card_asihpi {
120 struct snd_card *card; 124 struct snd_card *card;
121 struct pci_dev *pci; 125 struct pci_dev *pci;
122 u16 adapter_index; 126 struct hpi_adapter *hpi;
123 u32 serial_number;
124 u16 type;
125 u16 version;
126 u16 num_outstreams;
127 u16 num_instreams;
128 127
129 u32 h_mixer; 128 u32 h_mixer;
130 struct clk_cache cc; 129 struct clk_cache cc;
@@ -135,6 +134,8 @@ struct snd_card_asihpi {
135 u16 update_interval_frames; 134 u16 update_interval_frames;
136 u16 in_max_chans; 135 u16 in_max_chans;
137 u16 out_max_chans; 136 u16 out_max_chans;
137 u16 in_min_chans;
138 u16 out_min_chans;
138}; 139};
139 140
140/* Per stream data */ 141/* Per stream data */
@@ -495,6 +496,7 @@ static int snd_card_asihpi_pcm_hw_params(struct snd_pcm_substream *substream,
495 496
496 snd_printdd("stream_host_buffer_attach status 0x%x\n", 497 snd_printdd("stream_host_buffer_attach status 0x%x\n",
497 dpcm->hpi_buffer_attached); 498 dpcm->hpi_buffer_attached);
499
498 } 500 }
499 bytes_per_sec = params_rate(params) * params_channels(params); 501 bytes_per_sec = params_rate(params) * params_channels(params);
500 width = snd_pcm_format_width(params_format(params)); 502 width = snd_pcm_format_width(params_format(params));
@@ -757,8 +759,7 @@ static void snd_card_asihpi_timer_function(unsigned long data)
757 if (s->stream == SNDRV_PCM_STREAM_PLAYBACK) { 759 if (s->stream == SNDRV_PCM_STREAM_PLAYBACK) {
758 pcm_buf_dma_ofs = ds->pcm_buf_host_rw_ofs - bytes_avail; 760 pcm_buf_dma_ofs = ds->pcm_buf_host_rw_ofs - bytes_avail;
759 if (state == HPI_STATE_STOPPED) { 761 if (state == HPI_STATE_STOPPED) {
760 if ((bytes_avail == 0) && 762 if (bytes_avail == 0) {
761 (on_card_bytes < ds->pcm_buf_host_rw_ofs)) {
762 hpi_handle_error(hpi_stream_start(ds->h_stream)); 763 hpi_handle_error(hpi_stream_start(ds->h_stream));
763 snd_printdd("P%d start\n", s->number); 764 snd_printdd("P%d start\n", s->number);
764 ds->drained_count = 0; 765 ds->drained_count = 0;
@@ -767,7 +768,7 @@ static void snd_card_asihpi_timer_function(unsigned long data)
767 snd_printd(KERN_WARNING "P%d drained\n", 768 snd_printd(KERN_WARNING "P%d drained\n",
768 s->number); 769 s->number);
769 ds->drained_count++; 770 ds->drained_count++;
770 if (ds->drained_count > 2) { 771 if (ds->drained_count > 20) {
771 snd_pcm_stop(s, SNDRV_PCM_STATE_XRUN); 772 snd_pcm_stop(s, SNDRV_PCM_STATE_XRUN);
772 continue; 773 continue;
773 } 774 }
@@ -888,8 +889,8 @@ static void snd_card_asihpi_timer_function(unsigned long data)
888 pd, xfer2)); 889 pd, xfer2));
889 } 890 }
890 } 891 }
891 ds->pcm_buf_host_rw_ofs = ds->pcm_buf_host_rw_ofs + xfercount; 892 ds->pcm_buf_host_rw_ofs += xfercount;
892 ds->pcm_buf_elapsed_dma_ofs = pcm_buf_dma_ofs; 893 ds->pcm_buf_elapsed_dma_ofs += xfercount;
893 snd_pcm_period_elapsed(s); 894 snd_pcm_period_elapsed(s);
894 } 895 }
895 } 896 }
@@ -902,7 +903,9 @@ static void snd_card_asihpi_timer_function(unsigned long data)
902static int snd_card_asihpi_playback_ioctl(struct snd_pcm_substream *substream, 903static int snd_card_asihpi_playback_ioctl(struct snd_pcm_substream *substream,
903 unsigned int cmd, void *arg) 904 unsigned int cmd, void *arg)
904{ 905{
905 snd_printddd(KERN_INFO "P%d ioctl %d\n", substream->number, cmd); 906 char name[16];
907 snd_pcm_debug_name(substream, name, sizeof(name));
908 snd_printddd(KERN_INFO "%s ioctl %d\n", name, cmd);
906 return snd_pcm_lib_ioctl(substream, cmd, arg); 909 return snd_pcm_lib_ioctl(substream, cmd, arg);
907} 910}
908 911
@@ -927,21 +930,23 @@ snd_card_asihpi_playback_pointer(struct snd_pcm_substream *substream)
927 struct snd_pcm_runtime *runtime = substream->runtime; 930 struct snd_pcm_runtime *runtime = substream->runtime;
928 struct snd_card_asihpi_pcm *dpcm = runtime->private_data; 931 struct snd_card_asihpi_pcm *dpcm = runtime->private_data;
929 snd_pcm_uframes_t ptr; 932 snd_pcm_uframes_t ptr;
933 char name[16];
934 snd_pcm_debug_name(substream, name, sizeof(name));
930 935
931 ptr = bytes_to_frames(runtime, dpcm->pcm_buf_dma_ofs % dpcm->buffer_bytes); 936 ptr = bytes_to_frames(runtime, dpcm->pcm_buf_dma_ofs % dpcm->buffer_bytes);
932 snd_printddd("P%d pointer = 0x%04lx\n", substream->number, (unsigned long)ptr); 937 snd_printddd("%s pointer = 0x%04lx\n", name, (unsigned long)ptr);
933 return ptr; 938 return ptr;
934} 939}
935 940
936static void snd_card_asihpi_playback_format(struct snd_card_asihpi *asihpi, 941static u64 snd_card_asihpi_playback_formats(struct snd_card_asihpi *asihpi,
937 u32 h_stream, 942 u32 h_stream)
938 struct snd_pcm_hardware *pcmhw)
939{ 943{
940 struct hpi_format hpi_format; 944 struct hpi_format hpi_format;
941 u16 format; 945 u16 format;
942 u16 err; 946 u16 err;
943 u32 h_control; 947 u32 h_control;
944 u32 sample_rate = 48000; 948 u32 sample_rate = 48000;
949 u64 formats = 0;
945 950
946 /* on cards without SRC, must query at valid rate, 951 /* on cards without SRC, must query at valid rate,
947 * maybe set by external sync 952 * maybe set by external sync
@@ -956,41 +961,29 @@ static void snd_card_asihpi_playback_format(struct snd_card_asihpi *asihpi,
956 961
957 for (format = HPI_FORMAT_PCM8_UNSIGNED; 962 for (format = HPI_FORMAT_PCM8_UNSIGNED;
958 format <= HPI_FORMAT_PCM24_SIGNED; format++) { 963 format <= HPI_FORMAT_PCM24_SIGNED; format++) {
959 err = hpi_format_create(&hpi_format, 964 err = hpi_format_create(&hpi_format, asihpi->out_max_chans,
960 2, format, sample_rate, 128000, 0); 965 format, sample_rate, 128000, 0);
961 if (!err) 966 if (!err)
962 err = hpi_outstream_query_format(h_stream, 967 err = hpi_outstream_query_format(h_stream, &hpi_format);
963 &hpi_format);
964 if (!err && (hpi_to_alsa_formats[format] != -1)) 968 if (!err && (hpi_to_alsa_formats[format] != -1))
965 pcmhw->formats |= 969 formats |= (1ULL << hpi_to_alsa_formats[format]);
966 (1ULL << hpi_to_alsa_formats[format]);
967 } 970 }
971 return formats;
968} 972}
969 973
970static struct snd_pcm_hardware snd_card_asihpi_playback = {
971 .channels_min = 1,
972 .channels_max = 2,
973 .buffer_bytes_max = BUFFER_BYTES_MAX,
974 .period_bytes_min = PERIOD_BYTES_MIN,
975 .period_bytes_max = BUFFER_BYTES_MAX / PERIODS_MIN,
976 .periods_min = PERIODS_MIN,
977 .periods_max = BUFFER_BYTES_MAX / PERIOD_BYTES_MIN,
978 .fifo_size = 0,
979};
980
981static int snd_card_asihpi_playback_open(struct snd_pcm_substream *substream) 974static int snd_card_asihpi_playback_open(struct snd_pcm_substream *substream)
982{ 975{
983 struct snd_pcm_runtime *runtime = substream->runtime; 976 struct snd_pcm_runtime *runtime = substream->runtime;
984 struct snd_card_asihpi_pcm *dpcm; 977 struct snd_card_asihpi_pcm *dpcm;
985 struct snd_card_asihpi *card = snd_pcm_substream_chip(substream); 978 struct snd_card_asihpi *card = snd_pcm_substream_chip(substream);
979 struct snd_pcm_hardware snd_card_asihpi_playback;
986 int err; 980 int err;
987 981
988 dpcm = kzalloc(sizeof(*dpcm), GFP_KERNEL); 982 dpcm = kzalloc(sizeof(*dpcm), GFP_KERNEL);
989 if (dpcm == NULL) 983 if (dpcm == NULL)
990 return -ENOMEM; 984 return -ENOMEM;
991 985
992 err = 986 err = hpi_outstream_open(card->hpi->adapter->index,
993 hpi_outstream_open(card->adapter_index,
994 substream->number, &dpcm->h_stream); 987 substream->number, &dpcm->h_stream);
995 hpi_handle_error(err); 988 hpi_handle_error(err);
996 if (err) 989 if (err)
@@ -1012,12 +1005,19 @@ static int snd_card_asihpi_playback_open(struct snd_pcm_substream *substream)
1012 runtime->private_data = dpcm; 1005 runtime->private_data = dpcm;
1013 runtime->private_free = snd_card_asihpi_runtime_free; 1006 runtime->private_free = snd_card_asihpi_runtime_free;
1014 1007
1015 snd_card_asihpi_playback.channels_max = card->out_max_chans; 1008 memset(&snd_card_asihpi_playback, 0, sizeof(snd_card_asihpi_playback));
1009 snd_card_asihpi_playback.buffer_bytes_max = BUFFER_BYTES_MAX;
1010 snd_card_asihpi_playback.period_bytes_min = PERIOD_BYTES_MIN;
1016 /*?snd_card_asihpi_playback.period_bytes_min = 1011 /*?snd_card_asihpi_playback.period_bytes_min =
1017 card->out_max_chans * 4096; */ 1012 card->out_max_chans * 4096; */
1018 1013 snd_card_asihpi_playback.period_bytes_max = BUFFER_BYTES_MAX / PERIODS_MIN;
1019 snd_card_asihpi_playback_format(card, dpcm->h_stream, 1014 snd_card_asihpi_playback.periods_min = PERIODS_MIN;
1020 &snd_card_asihpi_playback); 1015 snd_card_asihpi_playback.periods_max = BUFFER_BYTES_MAX / PERIOD_BYTES_MIN;
1016 /* snd_card_asihpi_playback.fifo_size = 0; */
1017 snd_card_asihpi_playback.channels_max = card->out_max_chans;
1018 snd_card_asihpi_playback.channels_min = card->out_min_chans;
1019 snd_card_asihpi_playback.formats =
1020 snd_card_asihpi_playback_formats(card, dpcm->h_stream);
1021 1021
1022 snd_card_asihpi_pcm_samplerates(card, &snd_card_asihpi_playback); 1022 snd_card_asihpi_pcm_samplerates(card, &snd_card_asihpi_playback);
1023 1023
@@ -1029,8 +1029,10 @@ static int snd_card_asihpi_playback_open(struct snd_pcm_substream *substream)
1029 SNDRV_PCM_INFO_MMAP | 1029 SNDRV_PCM_INFO_MMAP |
1030 SNDRV_PCM_INFO_MMAP_VALID; 1030 SNDRV_PCM_INFO_MMAP_VALID;
1031 1031
1032 if (card->support_grouping) 1032 if (card->support_grouping) {
1033 snd_card_asihpi_playback.info |= SNDRV_PCM_INFO_SYNC_START; 1033 snd_card_asihpi_playback.info |= SNDRV_PCM_INFO_SYNC_START;
1034 snd_pcm_set_sync(substream);
1035 }
1034 1036
1035 /* struct is copied, so can create initializer dynamically */ 1037 /* struct is copied, so can create initializer dynamically */
1036 runtime->hw = snd_card_asihpi_playback; 1038 runtime->hw = snd_card_asihpi_playback;
@@ -1047,8 +1049,6 @@ static int snd_card_asihpi_playback_open(struct snd_pcm_substream *substream)
1047 snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIOD_SIZE, 1049 snd_pcm_hw_constraint_minmax(runtime, SNDRV_PCM_HW_PARAM_PERIOD_SIZE,
1048 card->update_interval_frames * 2, UINT_MAX); 1050 card->update_interval_frames * 2, UINT_MAX);
1049 1051
1050 snd_pcm_set_sync(substream);
1051
1052 snd_printdd("playback open\n"); 1052 snd_printdd("playback open\n");
1053 1053
1054 return 0; 1054 return 0;
@@ -1114,15 +1114,15 @@ static int snd_card_asihpi_capture_prepare(struct snd_pcm_substream *substream)
1114 1114
1115 1115
1116 1116
1117static void snd_card_asihpi_capture_format(struct snd_card_asihpi *asihpi, 1117static u64 snd_card_asihpi_capture_formats(struct snd_card_asihpi *asihpi,
1118 u32 h_stream, 1118 u32 h_stream)
1119 struct snd_pcm_hardware *pcmhw)
1120{ 1119{
1121 struct hpi_format hpi_format; 1120 struct hpi_format hpi_format;
1122 u16 format; 1121 u16 format;
1123 u16 err; 1122 u16 err;
1124 u32 h_control; 1123 u32 h_control;
1125 u32 sample_rate = 48000; 1124 u32 sample_rate = 48000;
1125 u64 formats = 0;
1126 1126
1127 /* on cards without SRC, must query at valid rate, 1127 /* on cards without SRC, must query at valid rate,
1128 maybe set by external sync */ 1128 maybe set by external sync */
@@ -1137,34 +1137,22 @@ static void snd_card_asihpi_capture_format(struct snd_card_asihpi *asihpi,
1137 for (format = HPI_FORMAT_PCM8_UNSIGNED; 1137 for (format = HPI_FORMAT_PCM8_UNSIGNED;
1138 format <= HPI_FORMAT_PCM24_SIGNED; format++) { 1138 format <= HPI_FORMAT_PCM24_SIGNED; format++) {
1139 1139
1140 err = hpi_format_create(&hpi_format, 2, format, 1140 err = hpi_format_create(&hpi_format, asihpi->in_max_chans,
1141 sample_rate, 128000, 0); 1141 format, sample_rate, 128000, 0);
1142 if (!err) 1142 if (!err)
1143 err = hpi_instream_query_format(h_stream, 1143 err = hpi_instream_query_format(h_stream, &hpi_format);
1144 &hpi_format);
1145 if (!err) 1144 if (!err)
1146 pcmhw->formats |= 1145 formats |= (1ULL << hpi_to_alsa_formats[format]);
1147 (1ULL << hpi_to_alsa_formats[format]);
1148 } 1146 }
1147 return formats;
1149} 1148}
1150 1149
1151
1152static struct snd_pcm_hardware snd_card_asihpi_capture = {
1153 .channels_min = 1,
1154 .channels_max = 2,
1155 .buffer_bytes_max = BUFFER_BYTES_MAX,
1156 .period_bytes_min = PERIOD_BYTES_MIN,
1157 .period_bytes_max = BUFFER_BYTES_MAX / PERIODS_MIN,
1158 .periods_min = PERIODS_MIN,
1159 .periods_max = BUFFER_BYTES_MAX / PERIOD_BYTES_MIN,
1160 .fifo_size = 0,
1161};
1162
1163static int snd_card_asihpi_capture_open(struct snd_pcm_substream *substream) 1150static int snd_card_asihpi_capture_open(struct snd_pcm_substream *substream)
1164{ 1151{
1165 struct snd_pcm_runtime *runtime = substream->runtime; 1152 struct snd_pcm_runtime *runtime = substream->runtime;
1166 struct snd_card_asihpi *card = snd_pcm_substream_chip(substream); 1153 struct snd_card_asihpi *card = snd_pcm_substream_chip(substream);
1167 struct snd_card_asihpi_pcm *dpcm; 1154 struct snd_card_asihpi_pcm *dpcm;
1155 struct snd_pcm_hardware snd_card_asihpi_capture;
1168 int err; 1156 int err;
1169 1157
1170 dpcm = kzalloc(sizeof(*dpcm), GFP_KERNEL); 1158 dpcm = kzalloc(sizeof(*dpcm), GFP_KERNEL);
@@ -1172,10 +1160,10 @@ static int snd_card_asihpi_capture_open(struct snd_pcm_substream *substream)
1172 return -ENOMEM; 1160 return -ENOMEM;
1173 1161
1174 snd_printdd("capture open adapter %d stream %d\n", 1162 snd_printdd("capture open adapter %d stream %d\n",
1175 card->adapter_index, substream->number); 1163 card->hpi->adapter->index, substream->number);
1176 1164
1177 err = hpi_handle_error( 1165 err = hpi_handle_error(
1178 hpi_instream_open(card->adapter_index, 1166 hpi_instream_open(card->hpi->adapter->index,
1179 substream->number, &dpcm->h_stream)); 1167 substream->number, &dpcm->h_stream));
1180 if (err) 1168 if (err)
1181 kfree(dpcm); 1169 kfree(dpcm);
@@ -1184,7 +1172,6 @@ static int snd_card_asihpi_capture_open(struct snd_pcm_substream *substream)
1184 if (err) 1172 if (err)
1185 return -EIO; 1173 return -EIO;
1186 1174
1187
1188 init_timer(&dpcm->timer); 1175 init_timer(&dpcm->timer);
1189 dpcm->timer.data = (unsigned long) dpcm; 1176 dpcm->timer.data = (unsigned long) dpcm;
1190 dpcm->timer.function = snd_card_asihpi_timer_function; 1177 dpcm->timer.function = snd_card_asihpi_timer_function;
@@ -1192,9 +1179,17 @@ static int snd_card_asihpi_capture_open(struct snd_pcm_substream *substream)
1192 runtime->private_data = dpcm; 1179 runtime->private_data = dpcm;
1193 runtime->private_free = snd_card_asihpi_runtime_free; 1180 runtime->private_free = snd_card_asihpi_runtime_free;
1194 1181
1182 memset(&snd_card_asihpi_capture, 0, sizeof(snd_card_asihpi_capture));
1183 snd_card_asihpi_capture.buffer_bytes_max = BUFFER_BYTES_MAX;
1184 snd_card_asihpi_capture.period_bytes_min = PERIOD_BYTES_MIN;
1185 snd_card_asihpi_capture.period_bytes_max = BUFFER_BYTES_MAX / PERIODS_MIN;
1186 snd_card_asihpi_capture.periods_min = PERIODS_MIN;
1187 snd_card_asihpi_capture.periods_max = BUFFER_BYTES_MAX / PERIOD_BYTES_MIN;
1188 /* snd_card_asihpi_capture.fifo_size = 0; */
1195 snd_card_asihpi_capture.channels_max = card->in_max_chans; 1189 snd_card_asihpi_capture.channels_max = card->in_max_chans;
1196 snd_card_asihpi_capture_format(card, dpcm->h_stream, 1190 snd_card_asihpi_capture.channels_min = card->in_min_chans;
1197 &snd_card_asihpi_capture); 1191 snd_card_asihpi_capture.formats =
1192 snd_card_asihpi_capture_formats(card, dpcm->h_stream);
1198 snd_card_asihpi_pcm_samplerates(card, &snd_card_asihpi_capture); 1193 snd_card_asihpi_pcm_samplerates(card, &snd_card_asihpi_capture);
1199 snd_card_asihpi_capture.info = SNDRV_PCM_INFO_INTERLEAVED | 1194 snd_card_asihpi_capture.info = SNDRV_PCM_INFO_INTERLEAVED |
1200 SNDRV_PCM_INFO_MMAP | 1195 SNDRV_PCM_INFO_MMAP |
@@ -1240,15 +1235,20 @@ static struct snd_pcm_ops snd_card_asihpi_capture_mmap_ops = {
1240 .pointer = snd_card_asihpi_capture_pointer, 1235 .pointer = snd_card_asihpi_capture_pointer,
1241}; 1236};
1242 1237
1243static int __devinit snd_card_asihpi_pcm_new(struct snd_card_asihpi *asihpi, 1238static int __devinit snd_card_asihpi_pcm_new(
1244 int device, int substreams) 1239 struct snd_card_asihpi *asihpi, int device)
1245{ 1240{
1246 struct snd_pcm *pcm; 1241 struct snd_pcm *pcm;
1247 int err; 1242 int err;
1243 u16 num_instreams, num_outstreams, x16;
1244 u32 x32;
1245
1246 err = hpi_adapter_get_info(asihpi->hpi->adapter->index,
1247 &num_outstreams, &num_instreams,
1248 &x16, &x32, &x16);
1248 1249
1249 err = snd_pcm_new(asihpi->card, "Asihpi PCM", device, 1250 err = snd_pcm_new(asihpi->card, "Asihpi PCM", device,
1250 asihpi->num_outstreams, asihpi->num_instreams, 1251 num_outstreams, num_instreams, &pcm);
1251 &pcm);
1252 if (err < 0) 1252 if (err < 0)
1253 return err; 1253 return err;
1254 /* pointer to ops struct is stored, dont change ops afterwards! */ 1254 /* pointer to ops struct is stored, dont change ops afterwards! */
@@ -1314,7 +1314,7 @@ static const char * const asihpi_src_names[] = {
1314 "Analog", 1314 "Analog",
1315 "Adapter", 1315 "Adapter",
1316 "RTP", 1316 "RTP",
1317 "GPI", 1317 "Internal"
1318}; 1318};
1319 1319
1320compile_time_assert( 1320compile_time_assert(
@@ -1332,7 +1332,6 @@ static const char * const asihpi_dst_names[] = {
1332 "Net", 1332 "Net",
1333 "Analog", 1333 "Analog",
1334 "RTP", 1334 "RTP",
1335 "GPO",
1336}; 1335};
1337 1336
1338compile_time_assert( 1337compile_time_assert(
@@ -1410,6 +1409,7 @@ static int snd_asihpi_volume_info(struct snd_kcontrol *kcontrol,
1410 struct snd_ctl_elem_info *uinfo) 1409 struct snd_ctl_elem_info *uinfo)
1411{ 1410{
1412 u32 h_control = kcontrol->private_value; 1411 u32 h_control = kcontrol->private_value;
1412 u32 count;
1413 u16 err; 1413 u16 err;
1414 /* native gains are in millibels */ 1414 /* native gains are in millibels */
1415 short min_gain_mB; 1415 short min_gain_mB;
@@ -1424,8 +1424,12 @@ static int snd_asihpi_volume_info(struct snd_kcontrol *kcontrol,
1424 step_gain_mB = VOL_STEP_mB; 1424 step_gain_mB = VOL_STEP_mB;
1425 } 1425 }
1426 1426
1427 err = hpi_meter_query_channels(h_control, &count);
1428 if (err)
1429 count = HPI_MAX_CHANNELS;
1430
1427 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; 1431 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
1428 uinfo->count = 2; 1432 uinfo->count = count;
1429 uinfo->value.integer.min = min_gain_mB / VOL_STEP_mB; 1433 uinfo->value.integer.min = min_gain_mB / VOL_STEP_mB;
1430 uinfo->value.integer.max = max_gain_mB / VOL_STEP_mB; 1434 uinfo->value.integer.max = max_gain_mB / VOL_STEP_mB;
1431 uinfo->value.integer.step = step_gain_mB / VOL_STEP_mB; 1435 uinfo->value.integer.step = step_gain_mB / VOL_STEP_mB;
@@ -2033,8 +2037,15 @@ static int __devinit snd_asihpi_tuner_add(struct snd_card_asihpi *asihpi,
2033static int snd_asihpi_meter_info(struct snd_kcontrol *kcontrol, 2037static int snd_asihpi_meter_info(struct snd_kcontrol *kcontrol,
2034 struct snd_ctl_elem_info *uinfo) 2038 struct snd_ctl_elem_info *uinfo)
2035{ 2039{
2040 u32 h_control = kcontrol->private_value;
2041 u32 count;
2042 u16 err;
2043 err = hpi_meter_query_channels(h_control, &count);
2044 if (err)
2045 count = HPI_MAX_CHANNELS;
2046
2036 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; 2047 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
2037 uinfo->count = HPI_MAX_CHANNELS; 2048 uinfo->count = count;
2038 uinfo->value.integer.min = 0; 2049 uinfo->value.integer.min = 0;
2039 uinfo->value.integer.max = 0x7FFFFFFF; 2050 uinfo->value.integer.max = 0x7FFFFFFF;
2040 return 0; 2051 return 0;
@@ -2248,6 +2259,9 @@ static int snd_asihpi_cmode_info(struct snd_kcontrol *kcontrol,
2248 valid_modes++; 2259 valid_modes++;
2249 } 2260 }
2250 2261
2262 if (!valid_modes)
2263 return -EINVAL;
2264
2251 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 2265 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
2252 uinfo->count = 1; 2266 uinfo->count = 1;
2253 uinfo->value.enumerated.items = valid_modes; 2267 uinfo->value.enumerated.items = valid_modes;
@@ -2547,7 +2561,7 @@ static int __devinit snd_card_asihpi_mixer_new(struct snd_card_asihpi *asihpi)
2547 strcpy(card->mixername, "Asihpi Mixer"); 2561 strcpy(card->mixername, "Asihpi Mixer");
2548 2562
2549 err = 2563 err =
2550 hpi_mixer_open(asihpi->adapter_index, 2564 hpi_mixer_open(asihpi->hpi->adapter->index,
2551 &asihpi->h_mixer); 2565 &asihpi->h_mixer);
2552 hpi_handle_error(err); 2566 hpi_handle_error(err);
2553 if (err) 2567 if (err)
@@ -2665,24 +2679,33 @@ snd_asihpi_proc_read(struct snd_info_entry *entry,
2665 struct snd_info_buffer *buffer) 2679 struct snd_info_buffer *buffer)
2666{ 2680{
2667 struct snd_card_asihpi *asihpi = entry->private_data; 2681 struct snd_card_asihpi *asihpi = entry->private_data;
2668 u16 version;
2669 u32 h_control; 2682 u32 h_control;
2670 u32 rate = 0; 2683 u32 rate = 0;
2671 u16 source = 0; 2684 u16 source = 0;
2685
2686 u16 num_outstreams;
2687 u16 num_instreams;
2688 u16 version;
2689 u32 serial_number;
2690 u16 type;
2691
2672 int err; 2692 int err;
2673 2693
2674 snd_iprintf(buffer, "ASIHPI driver proc file\n"); 2694 snd_iprintf(buffer, "ASIHPI driver proc file\n");
2695
2696 hpi_handle_error(hpi_adapter_get_info(asihpi->hpi->adapter->index,
2697 &num_outstreams, &num_instreams,
2698 &version, &serial_number, &type));
2699
2675 snd_iprintf(buffer, 2700 snd_iprintf(buffer,
2676 "adapter ID=%4X\n_index=%d\n" 2701 "Adapter type ASI%4X\nHardware Index %d\n"
2677 "num_outstreams=%d\n_num_instreams=%d\n", 2702 "%d outstreams\n%d instreams\n",
2678 asihpi->type, asihpi->adapter_index, 2703 type, asihpi->hpi->adapter->index,
2679 asihpi->num_outstreams, asihpi->num_instreams); 2704 num_outstreams, num_instreams);
2680 2705
2681 version = asihpi->version;
2682 snd_iprintf(buffer, 2706 snd_iprintf(buffer,
2683 "serial#=%d\n_hw version %c%d\nDSP code version %03d\n", 2707 "Serial#%d\nHardware version %c%d\nDSP code version %03d\n",
2684 asihpi->serial_number, ((version >> 3) & 0xf) + 'A', 2708 serial_number, ((version >> 3) & 0xf) + 'A', version & 0x7,
2685 version & 0x7,
2686 ((version >> 13) * 100) + ((version >> 7) & 0x3f)); 2709 ((version >> 13) * 100) + ((version >> 7) & 0x3f));
2687 2710
2688 err = hpi_mixer_get_control(asihpi->h_mixer, 2711 err = hpi_mixer_get_control(asihpi->h_mixer,
@@ -2690,18 +2713,15 @@ snd_asihpi_proc_read(struct snd_info_entry *entry,
2690 HPI_CONTROL_SAMPLECLOCK, &h_control); 2713 HPI_CONTROL_SAMPLECLOCK, &h_control);
2691 2714
2692 if (!err) { 2715 if (!err) {
2693 err = hpi_sample_clock_get_sample_rate( 2716 err = hpi_sample_clock_get_sample_rate(h_control, &rate);
2694 h_control, &rate);
2695 err += hpi_sample_clock_get_source(h_control, &source); 2717 err += hpi_sample_clock_get_source(h_control, &source);
2696 2718
2697 if (!err) 2719 if (!err)
2698 snd_iprintf(buffer, "sample_clock=%d_hz, source %s\n", 2720 snd_iprintf(buffer, "Sample Clock %dHz, source %s\n",
2699 rate, sampleclock_sources[source]); 2721 rate, sampleclock_sources[source]);
2700 } 2722 }
2701
2702} 2723}
2703 2724
2704
2705static void __devinit snd_asihpi_proc_init(struct snd_card_asihpi *asihpi) 2725static void __devinit snd_asihpi_proc_init(struct snd_card_asihpi *asihpi)
2706{ 2726{
2707 struct snd_info_entry *entry; 2727 struct snd_info_entry *entry;
@@ -2773,35 +2793,34 @@ static int __devinit snd_asihpi_probe(struct pci_dev *pci_dev,
2773 const struct pci_device_id *pci_id) 2793 const struct pci_device_id *pci_id)
2774{ 2794{
2775 int err; 2795 int err;
2776 2796 struct hpi_adapter *hpi;
2777 u16 version;
2778 int pcm_substreams;
2779
2780 struct hpi_adapter *hpi_card;
2781 struct snd_card *card; 2797 struct snd_card *card;
2782 struct snd_card_asihpi *asihpi; 2798 struct snd_card_asihpi *asihpi;
2783 2799
2784 u32 h_control; 2800 u32 h_control;
2785 u32 h_stream; 2801 u32 h_stream;
2802 u32 adapter_index;
2786 2803
2787 static int dev; 2804 static int dev;
2788 if (dev >= SNDRV_CARDS) 2805 if (dev >= SNDRV_CARDS)
2789 return -ENODEV; 2806 return -ENODEV;
2790 2807
2791 /* Should this be enable[hpi_card->index] ? */ 2808 /* Should this be enable[hpi->index] ? */
2792 if (!enable[dev]) { 2809 if (!enable[dev]) {
2793 dev++; 2810 dev++;
2794 return -ENOENT; 2811 return -ENOENT;
2795 } 2812 }
2796 2813
2814 /* Initialise low-level HPI driver */
2797 err = asihpi_adapter_probe(pci_dev, pci_id); 2815 err = asihpi_adapter_probe(pci_dev, pci_id);
2798 if (err < 0) 2816 if (err < 0)
2799 return err; 2817 return err;
2800 2818
2801 hpi_card = pci_get_drvdata(pci_dev); 2819 hpi = pci_get_drvdata(pci_dev);
2820 adapter_index = hpi->adapter->index;
2802 /* first try to give the card the same index as its hardware index */ 2821 /* first try to give the card the same index as its hardware index */
2803 err = snd_card_create(hpi_card->index, 2822 err = snd_card_create(adapter_index,
2804 id[hpi_card->index], THIS_MODULE, 2823 id[adapter_index], THIS_MODULE,
2805 sizeof(struct snd_card_asihpi), 2824 sizeof(struct snd_card_asihpi),
2806 &card); 2825 &card);
2807 if (err < 0) { 2826 if (err < 0) {
@@ -2815,50 +2834,32 @@ static int __devinit snd_asihpi_probe(struct pci_dev *pci_dev,
2815 return err; 2834 return err;
2816 snd_printk(KERN_WARNING 2835 snd_printk(KERN_WARNING
2817 "**** WARNING **** Adapter index %d->ALSA index %d\n", 2836 "**** WARNING **** Adapter index %d->ALSA index %d\n",
2818 hpi_card->index, card->number); 2837 adapter_index, card->number);
2819 } 2838 }
2820 2839
2821 snd_card_set_dev(card, &pci_dev->dev); 2840 snd_card_set_dev(card, &pci_dev->dev);
2822 2841
2823 asihpi = (struct snd_card_asihpi *) card->private_data; 2842 asihpi = card->private_data;
2824 asihpi->card = card; 2843 asihpi->card = card;
2825 asihpi->pci = pci_dev; 2844 asihpi->pci = pci_dev;
2826 asihpi->adapter_index = hpi_card->index; 2845 asihpi->hpi = hpi;
2827 hpi_handle_error(hpi_adapter_get_info( 2846
2828 asihpi->adapter_index, 2847 snd_printk(KERN_INFO "adapter ID=%4X index=%d\n",
2829 &asihpi->num_outstreams, 2848 asihpi->hpi->adapter->type, adapter_index);
2830 &asihpi->num_instreams, 2849
2831 &asihpi->version, 2850 err = hpi_adapter_get_property(adapter_index,
2832 &asihpi->serial_number, &asihpi->type));
2833
2834 version = asihpi->version;
2835 snd_printk(KERN_INFO "adapter ID=%4X index=%d num_outstreams=%d "
2836 "num_instreams=%d S/N=%d\n"
2837 "Hw Version %c%d DSP code version %03d\n",
2838 asihpi->type, asihpi->adapter_index,
2839 asihpi->num_outstreams,
2840 asihpi->num_instreams, asihpi->serial_number,
2841 ((version >> 3) & 0xf) + 'A',
2842 version & 0x7,
2843 ((version >> 13) * 100) + ((version >> 7) & 0x3f));
2844
2845 pcm_substreams = asihpi->num_outstreams;
2846 if (pcm_substreams < asihpi->num_instreams)
2847 pcm_substreams = asihpi->num_instreams;
2848
2849 err = hpi_adapter_get_property(asihpi->adapter_index,
2850 HPI_ADAPTER_PROPERTY_CAPS1, 2851 HPI_ADAPTER_PROPERTY_CAPS1,
2851 NULL, &asihpi->support_grouping); 2852 NULL, &asihpi->support_grouping);
2852 if (err) 2853 if (err)
2853 asihpi->support_grouping = 0; 2854 asihpi->support_grouping = 0;
2854 2855
2855 err = hpi_adapter_get_property(asihpi->adapter_index, 2856 err = hpi_adapter_get_property(adapter_index,
2856 HPI_ADAPTER_PROPERTY_CAPS2, 2857 HPI_ADAPTER_PROPERTY_CAPS2,
2857 &asihpi->support_mrx, NULL); 2858 &asihpi->support_mrx, NULL);
2858 if (err) 2859 if (err)
2859 asihpi->support_mrx = 0; 2860 asihpi->support_mrx = 0;
2860 2861
2861 err = hpi_adapter_get_property(asihpi->adapter_index, 2862 err = hpi_adapter_get_property(adapter_index,
2862 HPI_ADAPTER_PROPERTY_INTERVAL, 2863 HPI_ADAPTER_PROPERTY_INTERVAL,
2863 NULL, &asihpi->update_interval_frames); 2864 NULL, &asihpi->update_interval_frames);
2864 if (err) 2865 if (err)
@@ -2867,7 +2868,7 @@ static int __devinit snd_asihpi_probe(struct pci_dev *pci_dev,
2867 if (!asihpi->can_dma) 2868 if (!asihpi->can_dma)
2868 asihpi->update_interval_frames *= 2; 2869 asihpi->update_interval_frames *= 2;
2869 2870
2870 hpi_handle_error(hpi_instream_open(asihpi->adapter_index, 2871 hpi_handle_error(hpi_instream_open(adapter_index,
2871 0, &h_stream)); 2872 0, &h_stream));
2872 2873
2873 err = hpi_instream_host_buffer_free(h_stream); 2874 err = hpi_instream_host_buffer_free(h_stream);
@@ -2875,7 +2876,7 @@ static int __devinit snd_asihpi_probe(struct pci_dev *pci_dev,
2875 2876
2876 hpi_handle_error(hpi_instream_close(h_stream)); 2877 hpi_handle_error(hpi_instream_close(h_stream));
2877 2878
2878 err = hpi_adapter_get_property(asihpi->adapter_index, 2879 err = hpi_adapter_get_property(adapter_index,
2879 HPI_ADAPTER_PROPERTY_CURCHANNELS, 2880 HPI_ADAPTER_PROPERTY_CURCHANNELS,
2880 &asihpi->in_max_chans, &asihpi->out_max_chans); 2881 &asihpi->in_max_chans, &asihpi->out_max_chans);
2881 if (err) { 2882 if (err) {
@@ -2883,13 +2884,22 @@ static int __devinit snd_asihpi_probe(struct pci_dev *pci_dev,
2883 asihpi->out_max_chans = 2; 2884 asihpi->out_max_chans = 2;
2884 } 2885 }
2885 2886
2886 snd_printk(KERN_INFO "has dma:%d, grouping:%d, mrx:%d\n", 2887 if (asihpi->out_max_chans > 2) { /* assume LL mode */
2888 asihpi->out_min_chans = asihpi->out_max_chans;
2889 asihpi->in_min_chans = asihpi->in_max_chans;
2890 asihpi->support_grouping = 0;
2891 } else {
2892 asihpi->out_min_chans = 1;
2893 asihpi->in_min_chans = 1;
2894 }
2895
2896 snd_printk(KERN_INFO "Has dma:%d, grouping:%d, mrx:%d\n",
2887 asihpi->can_dma, 2897 asihpi->can_dma,
2888 asihpi->support_grouping, 2898 asihpi->support_grouping,
2889 asihpi->support_mrx 2899 asihpi->support_mrx
2890 ); 2900 );
2891 2901
2892 err = snd_card_asihpi_pcm_new(asihpi, 0, pcm_substreams); 2902 err = snd_card_asihpi_pcm_new(asihpi, 0);
2893 if (err < 0) { 2903 if (err < 0) {
2894 snd_printk(KERN_ERR "pcm_new failed\n"); 2904 snd_printk(KERN_ERR "pcm_new failed\n");
2895 goto __nodev; 2905 goto __nodev;
@@ -2916,13 +2926,14 @@ static int __devinit snd_asihpi_probe(struct pci_dev *pci_dev,
2916 2926
2917 strcpy(card->driver, "ASIHPI"); 2927 strcpy(card->driver, "ASIHPI");
2918 2928
2919 sprintf(card->shortname, "AudioScience ASI%4X", asihpi->type); 2929 sprintf(card->shortname, "AudioScience ASI%4X",
2930 asihpi->hpi->adapter->type);
2920 sprintf(card->longname, "%s %i", 2931 sprintf(card->longname, "%s %i",
2921 card->shortname, asihpi->adapter_index); 2932 card->shortname, adapter_index);
2922 err = snd_card_register(card); 2933 err = snd_card_register(card);
2923 2934
2924 if (!err) { 2935 if (!err) {
2925 hpi_card->snd_card_asihpi = card; 2936 hpi->snd_card = card;
2926 dev++; 2937 dev++;
2927 return 0; 2938 return 0;
2928 } 2939 }
@@ -2935,10 +2946,9 @@ __nodev:
2935 2946
2936static void __devexit snd_asihpi_remove(struct pci_dev *pci_dev) 2947static void __devexit snd_asihpi_remove(struct pci_dev *pci_dev)
2937{ 2948{
2938 struct hpi_adapter *hpi_card = pci_get_drvdata(pci_dev); 2949 struct hpi_adapter *hpi = pci_get_drvdata(pci_dev);
2939 2950 snd_card_free(hpi->snd_card);
2940 snd_card_free(hpi_card->snd_card_asihpi); 2951 hpi->snd_card = NULL;
2941 hpi_card->snd_card_asihpi = NULL;
2942 asihpi_adapter_remove(pci_dev); 2952 asihpi_adapter_remove(pci_dev);
2943} 2953}
2944 2954
diff --git a/sound/pci/asihpi/hpi.h b/sound/pci/asihpi/hpi.h
index f2072728899..20887241a3a 100644
--- a/sound/pci/asihpi/hpi.h
+++ b/sound/pci/asihpi/hpi.h
@@ -30,26 +30,8 @@
30 30
31#ifndef _HPI_H_ 31#ifndef _HPI_H_
32#define _HPI_H_ 32#define _HPI_H_
33/* HPI Version
34If HPI_VER_MINOR is odd then its a development release not intended for the
35public. If HPI_VER_MINOR is even then is a release version
36i.e 3.05.02 is a development version
37*/
38#define HPI_VERSION_CONSTRUCTOR(maj, min, rel) \
39 ((maj << 16) + (min << 8) + rel)
40
41#define HPI_VER_MAJOR(v) ((int)(v >> 16))
42#define HPI_VER_MINOR(v) ((int)((v >> 8) & 0xFF))
43#define HPI_VER_RELEASE(v) ((int)(v & 0xFF))
44
45#define HPI_VER HPI_VERSION_CONSTRUCTOR(4L, 8, 0)
46#define HPI_VER_STRING "4.08.00"
47
48/* Library version as documented in hpi-api-versions.txt */
49#define HPI_LIB_VER HPI_VERSION_CONSTRUCTOR(10, 0, 0)
50 33
51#include <linux/types.h> 34#include <linux/types.h>
52#define HPI_BUILD_EXCLUDE_DEPRECATED
53#define HPI_BUILD_KERNEL_MODE 35#define HPI_BUILD_KERNEL_MODE
54 36
55/******************************************************************************/ 37/******************************************************************************/
@@ -213,7 +195,7 @@ enum HPI_SOURCENODES {
213 /** RTP stream input node - This node is a destination for 195 /** RTP stream input node - This node is a destination for
214 packets of RTP audio samples from other devices. */ 196 packets of RTP audio samples from other devices. */
215 HPI_SOURCENODE_RTP_DESTINATION = 112, 197 HPI_SOURCENODE_RTP_DESTINATION = 112,
216 HPI_SOURCENODE_GP_IN = 113, /**< general purpose input. */ 198 HPI_SOURCENODE_INTERNAL = 113, /**< node internal to the device. */
217 /* !!!Update this AND hpidebug.h if you add a new sourcenode type!!! */ 199 /* !!!Update this AND hpidebug.h if you add a new sourcenode type!!! */
218 HPI_SOURCENODE_LAST_INDEX = 113 /**< largest ID */ 200 HPI_SOURCENODE_LAST_INDEX = 113 /**< largest ID */
219 /* AX6 max sourcenode types = 15 */ 201 /* AX6 max sourcenode types = 15 */
@@ -242,9 +224,8 @@ enum HPI_DESTNODES {
242 /** RTP stream output node - This node is a source for 224 /** RTP stream output node - This node is a source for
243 packets of RTP audio samples that are sent to other devices. */ 225 packets of RTP audio samples that are sent to other devices. */
244 HPI_DESTNODE_RTP_SOURCE = 208, 226 HPI_DESTNODE_RTP_SOURCE = 208,
245 HPI_DESTNODE_GP_OUT = 209, /**< general purpose output node. */
246 /* !!!Update this AND hpidebug.h if you add a new destnode type!!! */ 227 /* !!!Update this AND hpidebug.h if you add a new destnode type!!! */
247 HPI_DESTNODE_LAST_INDEX = 209 /**< largest ID */ 228 HPI_DESTNODE_LAST_INDEX = 208 /**< largest ID */
248 /* AX6 max destnode types = 15 */ 229 /* AX6 max destnode types = 15 */
249}; 230};
250 231
@@ -450,7 +431,19 @@ Indicates that the adapter in it's current mode supports interrupts
450across the host bus. Note, this does not imply that interrupts are 431across the host bus. Note, this does not imply that interrupts are
451enabled. Instead it indicates that they can be enabled. 432enabled. Instead it indicates that they can be enabled.
452*/ 433*/
453 HPI_ADAPTER_PROPERTY_SUPPORTS_IRQ = 272 434 HPI_ADAPTER_PROPERTY_SUPPORTS_IRQ = 272,
435/** Readonly supports firmware updating.
436Indicates that the adapter implements an interface to update firmware
437on the adapter.
438*/
439 HPI_ADAPTER_PROPERTY_SUPPORTS_FW_UPDATE = 273,
440/** Readonly Firmware IDs
441Identifiy firmware independent of individual adapter type.
442May be used as a filter for firmware update images.
443Property 1 = Bootloader ID
444Property 2 = Main program ID
445*/
446 HPI_ADAPTER_PROPERTY_FIRMWARE_ID = 274
454}; 447};
455 448
456/** Adapter mode commands 449/** Adapter mode commands
@@ -638,7 +631,7 @@ enum HPI_MIXER_STORE_COMMAND {
638 HPI_MIXER_STORE_ENABLE = 4, 631 HPI_MIXER_STORE_ENABLE = 4,
639/** Disable auto storage of some control settings. */ 632/** Disable auto storage of some control settings. */
640 HPI_MIXER_STORE_DISABLE = 5, 633 HPI_MIXER_STORE_DISABLE = 5,
641/** Save the attributes of a single control. */ 634/** Unimplemented - save the attributes of a single control. */
642 HPI_MIXER_STORE_SAVE_SINGLE = 6 635 HPI_MIXER_STORE_SAVE_SINGLE = 6
643}; 636};
644 637
@@ -941,7 +934,7 @@ enum HPI_ERROR_CODES {
941 HPI_ERROR_BAD_ADAPTER_NUMBER = 202, 934 HPI_ERROR_BAD_ADAPTER_NUMBER = 202,
942 /** 2 adapters with the same adapter number. */ 935 /** 2 adapters with the same adapter number. */
943 HPI_ERROR_DUPLICATE_ADAPTER_NUMBER = 203, 936 HPI_ERROR_DUPLICATE_ADAPTER_NUMBER = 203,
944 /** DSP code failed to bootload. (unused?) */ 937 /** DSP code failed to bootload. Usually a DSP memory test failure. */
945 HPI_ERROR_DSP_BOOTLOAD = 204, 938 HPI_ERROR_DSP_BOOTLOAD = 204,
946 /** Couldn't find or open the DSP code file. */ 939 /** Couldn't find or open the DSP code file. */
947 HPI_ERROR_DSP_FILE_NOT_FOUND = 206, 940 HPI_ERROR_DSP_FILE_NOT_FOUND = 206,
@@ -978,6 +971,9 @@ enum HPI_ERROR_CODES {
978 HPI_ERROR_FLASH_VERIFY = 225, 971 HPI_ERROR_FLASH_VERIFY = 225,
979 HPI_ERROR_FLASH_TYPE = 226, 972 HPI_ERROR_FLASH_TYPE = 226,
980 HPI_ERROR_FLASH_START = 227, 973 HPI_ERROR_FLASH_START = 227,
974 HPI_ERROR_FLASH_READ = 228,
975 HPI_ERROR_FLASH_READ_NO_FILE = 229,
976 HPI_ERROR_FLASH_SIZE = 230,
981 977
982 /** Reserved for OEMs. */ 978 /** Reserved for OEMs. */
983 HPI_ERROR_RESERVED_1 = 290, 979 HPI_ERROR_RESERVED_1 = 290,
@@ -1020,6 +1016,8 @@ enum HPI_ERROR_CODES {
1020 HPI_ERROR_NO_INTERDSP_GROUPS = 315, 1016 HPI_ERROR_NO_INTERDSP_GROUPS = 315,
1021 /** Stream wait cancelled before threshold reached. */ 1017 /** Stream wait cancelled before threshold reached. */
1022 HPI_ERROR_WAIT_CANCELLED = 316, 1018 HPI_ERROR_WAIT_CANCELLED = 316,
1019 /** A character string is invalid. */
1020 HPI_ERROR_INVALID_STRING = 317,
1023 1021
1024 /** Invalid mixer node for this adapter. */ 1022 /** Invalid mixer node for this adapter. */
1025 HPI_ERROR_INVALID_NODE = 400, 1023 HPI_ERROR_INVALID_NODE = 400,
@@ -1046,11 +1044,15 @@ enum HPI_ERROR_CODES {
1046 /** I2C */ 1044 /** I2C */
1047 HPI_ERROR_I2C_BAD_ADR = 460, 1045 HPI_ERROR_I2C_BAD_ADR = 460,
1048 1046
1049 /** Entity errors */ 1047 /** Entity type did not match requested type */
1050 HPI_ERROR_ENTITY_TYPE_MISMATCH = 470, 1048 HPI_ERROR_ENTITY_TYPE_MISMATCH = 470,
1049 /** Entity item count did not match requested count */
1051 HPI_ERROR_ENTITY_ITEM_COUNT = 471, 1050 HPI_ERROR_ENTITY_ITEM_COUNT = 471,
1051 /** Entity type is not one of the valid types */
1052 HPI_ERROR_ENTITY_TYPE_INVALID = 472, 1052 HPI_ERROR_ENTITY_TYPE_INVALID = 472,
1053 /** Entity role is not one of the valid roles */
1053 HPI_ERROR_ENTITY_ROLE_INVALID = 473, 1054 HPI_ERROR_ENTITY_ROLE_INVALID = 473,
1055 /** Entity size doesn't match target size */
1054 HPI_ERROR_ENTITY_SIZE_MISMATCH = 474, 1056 HPI_ERROR_ENTITY_SIZE_MISMATCH = 474,
1055 1057
1056 /* AES18 specific errors were 500..507 */ 1058 /* AES18 specific errors were 500..507 */
@@ -1078,8 +1080,7 @@ enum HPI_ERROR_CODES {
1078/** \defgroup maximums HPI maximum values 1080/** \defgroup maximums HPI maximum values
1079\{ 1081\{
1080*/ 1082*/
1081/** Maximum number of adapters per HPI sub-system 1083/** Maximum number of PCI HPI adapters */
1082 WARNING: modifying this value changes the response structure size.*/
1083#define HPI_MAX_ADAPTERS 20 1084#define HPI_MAX_ADAPTERS 20
1084/** Maximum number of in or out streams per adapter */ 1085/** Maximum number of in or out streams per adapter */
1085#define HPI_MAX_STREAMS 16 1086#define HPI_MAX_STREAMS 16
@@ -1090,6 +1091,9 @@ enum HPI_ERROR_CODES {
1090#define HPI_MAX_ANC_BYTES_PER_FRAME (64) 1091#define HPI_MAX_ANC_BYTES_PER_FRAME (64)
1091#define HPI_STRING_LEN 16 1092#define HPI_STRING_LEN 16
1092 1093
1094/** Networked adapters have index >= 100 */
1095#define HPI_MIN_NETWORK_ADAPTER_IDX 100
1096
1093/** Velocity units */ 1097/** Velocity units */
1094#define HPI_OSTREAM_VELOCITY_UNITS 4096 1098#define HPI_OSTREAM_VELOCITY_UNITS 4096
1095/** OutStream timescale units */ 1099/** OutStream timescale units */
@@ -1111,14 +1115,14 @@ enum HPI_ERROR_CODES {
1111struct hpi_format { 1115struct hpi_format {
1112 u32 sample_rate; 1116 u32 sample_rate;
1113 /**< 11025, 32000, 44100 ... */ 1117 /**< 11025, 32000, 44100 ... */
1114 u32 bit_rate; /**< for MPEG */ 1118 u32 bit_rate; /**< for MPEG */
1115 u32 attributes; 1119 u32 attributes;
1116 /**< Stereo/JointStereo/Mono */ 1120 /**< Stereo/JointStereo/Mono */
1117 u16 mode_legacy; 1121 u16 mode_legacy;
1118 /**< Legacy ancillary mode or idle bit */ 1122 /**< Legacy ancillary mode or idle bit */
1119 u16 unused; /**< Unused */ 1123 u16 unused; /**< Unused */
1120 u16 channels; /**< 1,2..., (or ancillary mode or idle bit */ 1124 u16 channels; /**< 1,2..., (or ancillary mode or idle bit */
1121 u16 format; /**< HPI_FORMAT_PCM16, _MPEG etc. see #HPI_FORMATS. */ 1125 u16 format; /**< HPI_FORMAT_PCM16, _MPEG etc. see #HPI_FORMATS. */
1122}; 1126};
1123 1127
1124struct hpi_anc_frame { 1128struct hpi_anc_frame {
@@ -1144,9 +1148,6 @@ struct hpi_async_event {
1144 } u; 1148 } u;
1145}; 1149};
1146 1150
1147/* skip host side function declarations for
1148 DSP compile and documentation extraction */
1149
1150#ifndef DISABLE_PRAGMA_PACK1 1151#ifndef DISABLE_PRAGMA_PACK1
1151#pragma pack(pop) 1152#pragma pack(pop)
1152#endif 1153#endif
@@ -1357,7 +1358,7 @@ u16 hpi_volume_get_mute(u32 h_control, u32 *mute);
1357u16 hpi_volume_query_range(u32 h_control, short *min_gain_01dB, 1358u16 hpi_volume_query_range(u32 h_control, short *min_gain_01dB,
1358 short *max_gain_01dB, short *step_gain_01dB); 1359 short *max_gain_01dB, short *step_gain_01dB);
1359 1360
1360u16 hpi_volume_query_channels(const u32 h_volume, u32 *p_channels); 1361u16 hpi_volume_query_channels(const u32 h_control, u32 *p_channels);
1361 1362
1362u16 hpi_volume_auto_fade(u32 h_control, 1363u16 hpi_volume_auto_fade(u32 h_control,
1363 short an_stop_gain0_01dB[HPI_MAX_CHANNELS], u32 duration_ms); 1364 short an_stop_gain0_01dB[HPI_MAX_CHANNELS], u32 duration_ms);
@@ -1366,6 +1367,9 @@ u16 hpi_volume_auto_fade_profile(u32 h_control,
1366 short an_stop_gain0_01dB[HPI_MAX_CHANNELS], u32 duration_ms, 1367 short an_stop_gain0_01dB[HPI_MAX_CHANNELS], u32 duration_ms,
1367 u16 profile); 1368 u16 profile);
1368 1369
1370u16 hpi_volume_query_auto_fade_profile(const u32 h_control, const u32 i,
1371 u16 *profile);
1372
1369/*****************/ 1373/*****************/
1370/* Level control */ 1374/* Level control */
1371/*****************/ 1375/*****************/
diff --git a/sound/pci/asihpi/hpi6000.c b/sound/pci/asihpi/hpi6000.c
index 3cc6f11c20a..2414d7a2239 100644
--- a/sound/pci/asihpi/hpi6000.c
+++ b/sound/pci/asihpi/hpi6000.c
@@ -1,7 +1,7 @@
1/****************************************************************************** 1/******************************************************************************
2 2
3 AudioScience HPI driver 3 AudioScience HPI driver
4 Copyright (C) 1997-2010 AudioScience Inc. <support@audioscience.com> 4 Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of version 2 of the GNU General Public License as 7 it under the terms of version 2 of the GNU General Public License as
@@ -231,6 +231,8 @@ static void subsys_message(struct hpi_message *phm, struct hpi_response *phr)
231static void control_message(struct hpi_adapter_obj *pao, 231static void control_message(struct hpi_adapter_obj *pao,
232 struct hpi_message *phm, struct hpi_response *phr) 232 struct hpi_message *phm, struct hpi_response *phr)
233{ 233{
234 struct hpi_hw_obj *phw = pao->priv;
235
234 switch (phm->function) { 236 switch (phm->function) {
235 case HPI_CONTROL_GET_STATE: 237 case HPI_CONTROL_GET_STATE:
236 if (pao->has_control_cache) { 238 if (pao->has_control_cache) {
@@ -248,17 +250,14 @@ static void control_message(struct hpi_adapter_obj *pao,
248 break; 250 break;
249 } 251 }
250 252
251 if (hpi_check_control_cache(((struct hpi_hw_obj *) 253 if (hpi_check_control_cache(phw->p_cache, phm, phr))
252 pao->priv)->p_cache, phm,
253 phr))
254 break; 254 break;
255 } 255 }
256 hw_message(pao, phm, phr); 256 hw_message(pao, phm, phr);
257 break; 257 break;
258 case HPI_CONTROL_SET_STATE: 258 case HPI_CONTROL_SET_STATE:
259 hw_message(pao, phm, phr); 259 hw_message(pao, phm, phr);
260 hpi_cmn_control_cache_sync_to_msg(((struct hpi_hw_obj *)pao-> 260 hpi_cmn_control_cache_sync_to_msg(phw->p_cache, phm, phr);
261 priv)->p_cache, phm, phr);
262 break; 261 break;
263 262
264 case HPI_CONTROL_GET_INFO: 263 case HPI_CONTROL_GET_INFO:
@@ -451,11 +450,11 @@ static void subsys_create_adapter(struct hpi_message *phm,
451 } 450 }
452 451
453 for (dsp_index = 0; dsp_index < MAX_DSPS; dsp_index++) { 452 for (dsp_index = 0; dsp_index < MAX_DSPS; dsp_index++) {
454 struct hpi_hw_obj *phw = (struct hpi_hw_obj *)pao->priv; 453 struct hpi_hw_obj *phw = pao->priv;
455 phw->ado[dsp_index].pa_parent_adapter = pao; 454 phw->ado[dsp_index].pa_parent_adapter = pao;
456 } 455 }
457 456
458 phr->u.s.adapter_type = ao.adapter_type; 457 phr->u.s.adapter_type = ao.type;
459 phr->u.s.adapter_index = ao.index; 458 phr->u.s.adapter_index = ao.index;
460 phr->error = 0; 459 phr->error = 0;
461} 460}
@@ -476,7 +475,7 @@ static short create_adapter_obj(struct hpi_adapter_obj *pao,
476 u32 dsp_index = 0; 475 u32 dsp_index = 0;
477 u32 control_cache_size = 0; 476 u32 control_cache_size = 0;
478 u32 control_cache_count = 0; 477 u32 control_cache_count = 0;
479 struct hpi_hw_obj *phw = (struct hpi_hw_obj *)pao->priv; 478 struct hpi_hw_obj *phw = pao->priv;
480 479
481 /* The PCI2040 has the following address map */ 480 /* The PCI2040 has the following address map */
482 /* BAR0 - 4K = HPI control and status registers on PCI2040 (HPI CSR) */ 481 /* BAR0 - 4K = HPI control and status registers on PCI2040 (HPI CSR) */
@@ -559,7 +558,7 @@ static short create_adapter_obj(struct hpi_adapter_obj *pao,
559 if (error) 558 if (error)
560 return error; 559 return error;
561 } 560 }
562 pao->adapter_type = hr0.u.ax.info.adapter_type; 561 pao->type = hr0.u.ax.info.adapter_type;
563 pao->index = hr0.u.ax.info.adapter_index; 562 pao->index = hr0.u.ax.info.adapter_index;
564 } 563 }
565 564
@@ -584,9 +583,8 @@ static short create_adapter_obj(struct hpi_adapter_obj *pao,
584 pao->has_control_cache = 1; 583 pao->has_control_cache = 1;
585 } 584 }
586 585
587 HPI_DEBUG_LOG(DEBUG, "get adapter info ASI%04X index %d\n", 586 HPI_DEBUG_LOG(DEBUG, "get adapter info ASI%04X index %d\n", pao->type,
588 pao->adapter_type, pao->index); 587 pao->index);
589 pao->open = 0; /* upon creation the adapter is closed */
590 588
591 if (phw->p_cache) 589 if (phw->p_cache)
592 phw->p_cache->adap_idx = pao->index; 590 phw->p_cache->adap_idx = pao->index;
@@ -596,7 +594,7 @@ static short create_adapter_obj(struct hpi_adapter_obj *pao,
596 594
597static void delete_adapter_obj(struct hpi_adapter_obj *pao) 595static void delete_adapter_obj(struct hpi_adapter_obj *pao)
598{ 596{
599 struct hpi_hw_obj *phw = (struct hpi_hw_obj *)pao->priv; 597 struct hpi_hw_obj *phw = pao->priv;
600 598
601 if (pao->has_control_cache) 599 if (pao->has_control_cache)
602 hpi_free_control_cache(phw->p_cache); 600 hpi_free_control_cache(phw->p_cache);
@@ -639,7 +637,7 @@ static void adapter_get_asserts(struct hpi_adapter_obj *pao,
639static short hpi6000_adapter_boot_load_dsp(struct hpi_adapter_obj *pao, 637static short hpi6000_adapter_boot_load_dsp(struct hpi_adapter_obj *pao,
640 u32 *pos_error_code) 638 u32 *pos_error_code)
641{ 639{
642 struct hpi_hw_obj *phw = (struct hpi_hw_obj *)pao->priv; 640 struct hpi_hw_obj *phw = pao->priv;
643 short error; 641 short error;
644 u32 timeout; 642 u32 timeout;
645 u32 read = 0; 643 u32 read = 0;
@@ -1220,8 +1218,8 @@ static void hpi_read_block(struct dsp_obj *pdo, u32 address, u32 *pdata,
1220static u16 hpi6000_dsp_block_write32(struct hpi_adapter_obj *pao, 1218static u16 hpi6000_dsp_block_write32(struct hpi_adapter_obj *pao,
1221 u16 dsp_index, u32 hpi_address, u32 *source, u32 count) 1219 u16 dsp_index, u32 hpi_address, u32 *source, u32 count)
1222{ 1220{
1223 struct dsp_obj *pdo = 1221 struct hpi_hw_obj *phw = pao->priv;
1224 &(*(struct hpi_hw_obj *)pao->priv).ado[dsp_index]; 1222 struct dsp_obj *pdo = &phw->ado[dsp_index];
1225 u32 time_out = PCI_TIMEOUT; 1223 u32 time_out = PCI_TIMEOUT;
1226 int c6711_burst_size = 128; 1224 int c6711_burst_size = 128;
1227 u32 local_hpi_address = hpi_address; 1225 u32 local_hpi_address = hpi_address;
@@ -1258,8 +1256,8 @@ static u16 hpi6000_dsp_block_write32(struct hpi_adapter_obj *pao,
1258static u16 hpi6000_dsp_block_read32(struct hpi_adapter_obj *pao, 1256static u16 hpi6000_dsp_block_read32(struct hpi_adapter_obj *pao,
1259 u16 dsp_index, u32 hpi_address, u32 *dest, u32 count) 1257 u16 dsp_index, u32 hpi_address, u32 *dest, u32 count)
1260{ 1258{
1261 struct dsp_obj *pdo = 1259 struct hpi_hw_obj *phw = pao->priv;
1262 &(*(struct hpi_hw_obj *)pao->priv).ado[dsp_index]; 1260 struct dsp_obj *pdo = &phw->ado[dsp_index];
1263 u32 time_out = PCI_TIMEOUT; 1261 u32 time_out = PCI_TIMEOUT;
1264 int c6711_burst_size = 16; 1262 int c6711_burst_size = 16;
1265 u32 local_hpi_address = hpi_address; 1263 u32 local_hpi_address = hpi_address;
@@ -1298,7 +1296,7 @@ static u16 hpi6000_dsp_block_read32(struct hpi_adapter_obj *pao,
1298static short hpi6000_message_response_sequence(struct hpi_adapter_obj *pao, 1296static short hpi6000_message_response_sequence(struct hpi_adapter_obj *pao,
1299 u16 dsp_index, struct hpi_message *phm, struct hpi_response *phr) 1297 u16 dsp_index, struct hpi_message *phm, struct hpi_response *phr)
1300{ 1298{
1301 struct hpi_hw_obj *phw = (struct hpi_hw_obj *)pao->priv; 1299 struct hpi_hw_obj *phw = pao->priv;
1302 struct dsp_obj *pdo = &phw->ado[dsp_index]; 1300 struct dsp_obj *pdo = &phw->ado[dsp_index];
1303 u32 timeout; 1301 u32 timeout;
1304 u16 ack; 1302 u16 ack;
@@ -1414,8 +1412,8 @@ static short hpi6000_send_data_check_adr(u32 address, u32 length_in_dwords)
1414static short hpi6000_send_data(struct hpi_adapter_obj *pao, u16 dsp_index, 1412static short hpi6000_send_data(struct hpi_adapter_obj *pao, u16 dsp_index,
1415 struct hpi_message *phm, struct hpi_response *phr) 1413 struct hpi_message *phm, struct hpi_response *phr)
1416{ 1414{
1417 struct dsp_obj *pdo = 1415 struct hpi_hw_obj *phw = pao->priv;
1418 &(*(struct hpi_hw_obj *)pao->priv).ado[dsp_index]; 1416 struct dsp_obj *pdo = &phw->ado[dsp_index];
1419 u32 data_sent = 0; 1417 u32 data_sent = 0;
1420 u16 ack; 1418 u16 ack;
1421 u32 length, address; 1419 u32 length, address;
@@ -1487,8 +1485,8 @@ static short hpi6000_send_data(struct hpi_adapter_obj *pao, u16 dsp_index,
1487static short hpi6000_get_data(struct hpi_adapter_obj *pao, u16 dsp_index, 1485static short hpi6000_get_data(struct hpi_adapter_obj *pao, u16 dsp_index,
1488 struct hpi_message *phm, struct hpi_response *phr) 1486 struct hpi_message *phm, struct hpi_response *phr)
1489{ 1487{
1490 struct dsp_obj *pdo = 1488 struct hpi_hw_obj *phw = pao->priv;
1491 &(*(struct hpi_hw_obj *)pao->priv).ado[dsp_index]; 1489 struct dsp_obj *pdo = &phw->ado[dsp_index];
1492 u32 data_got = 0; 1490 u32 data_got = 0;
1493 u16 ack; 1491 u16 ack;
1494 u32 length, address; 1492 u32 length, address;
@@ -1551,8 +1549,8 @@ static void hpi6000_send_dsp_interrupt(struct dsp_obj *pdo)
1551static short hpi6000_send_host_command(struct hpi_adapter_obj *pao, 1549static short hpi6000_send_host_command(struct hpi_adapter_obj *pao,
1552 u16 dsp_index, u32 host_cmd) 1550 u16 dsp_index, u32 host_cmd)
1553{ 1551{
1554 struct dsp_obj *pdo = 1552 struct hpi_hw_obj *phw = pao->priv;
1555 &(*(struct hpi_hw_obj *)pao->priv).ado[dsp_index]; 1553 struct dsp_obj *pdo = &phw->ado[dsp_index];
1556 u32 timeout = TIMEOUT; 1554 u32 timeout = TIMEOUT;
1557 1555
1558 /* set command */ 1556 /* set command */
@@ -1577,7 +1575,7 @@ static short hpi6000_check_PCI2040_error_flag(struct hpi_adapter_obj *pao,
1577{ 1575{
1578 u32 hPI_error; 1576 u32 hPI_error;
1579 1577
1580 struct hpi_hw_obj *phw = (struct hpi_hw_obj *)pao->priv; 1578 struct hpi_hw_obj *phw = pao->priv;
1581 1579
1582 /* read the error bits from the PCI2040 */ 1580 /* read the error bits from the PCI2040 */
1583 hPI_error = ioread32(phw->dw2040_HPICSR + HPI_ERROR_REPORT); 1581 hPI_error = ioread32(phw->dw2040_HPICSR + HPI_ERROR_REPORT);
@@ -1597,8 +1595,8 @@ static short hpi6000_check_PCI2040_error_flag(struct hpi_adapter_obj *pao,
1597static short hpi6000_wait_dsp_ack(struct hpi_adapter_obj *pao, u16 dsp_index, 1595static short hpi6000_wait_dsp_ack(struct hpi_adapter_obj *pao, u16 dsp_index,
1598 u32 ack_value) 1596 u32 ack_value)
1599{ 1597{
1600 struct dsp_obj *pdo = 1598 struct hpi_hw_obj *phw = pao->priv;
1601 &(*(struct hpi_hw_obj *)pao->priv).ado[dsp_index]; 1599 struct dsp_obj *pdo = &phw->ado[dsp_index];
1602 u32 ack = 0L; 1600 u32 ack = 0L;
1603 u32 timeout; 1601 u32 timeout;
1604 u32 hPIC = 0L; 1602 u32 hPIC = 0L;
@@ -1640,7 +1638,7 @@ static short hpi6000_update_control_cache(struct hpi_adapter_obj *pao,
1640 struct hpi_message *phm) 1638 struct hpi_message *phm)
1641{ 1639{
1642 const u16 dsp_index = 0; 1640 const u16 dsp_index = 0;
1643 struct hpi_hw_obj *phw = (struct hpi_hw_obj *)pao->priv; 1641 struct hpi_hw_obj *phw = pao->priv;
1644 struct dsp_obj *pdo = &phw->ado[dsp_index]; 1642 struct dsp_obj *pdo = &phw->ado[dsp_index];
1645 u32 timeout; 1643 u32 timeout;
1646 u32 cache_dirty_flag; 1644 u32 cache_dirty_flag;
@@ -1740,7 +1738,8 @@ static void hw_message(struct hpi_adapter_obj *pao, struct hpi_message *phm,
1740{ 1738{
1741 u16 error = 0; 1739 u16 error = 0;
1742 u16 dsp_index = 0; 1740 u16 dsp_index = 0;
1743 u16 num_dsp = ((struct hpi_hw_obj *)pao->priv)->num_dsp; 1741 struct hpi_hw_obj *phw = pao->priv;
1742 u16 num_dsp = phw->num_dsp;
1744 1743
1745 if (num_dsp < 2) 1744 if (num_dsp < 2)
1746 dsp_index = 0; 1745 dsp_index = 0;
diff --git a/sound/pci/asihpi/hpi6000.h b/sound/pci/asihpi/hpi6000.h
index 4c7d507c0ec..7e0deeff5e7 100644
--- a/sound/pci/asihpi/hpi6000.h
+++ b/sound/pci/asihpi/hpi6000.h
@@ -1,7 +1,7 @@
1/***************************************************************************** 1/*****************************************************************************
2 2
3 AudioScience HPI driver 3 AudioScience HPI driver
4 Copyright (C) 1997-2010 AudioScience Inc. <support@audioscience.com> 4 Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of version 2 of the GNU General Public License as 7 it under the terms of version 2 of the GNU General Public License as
diff --git a/sound/pci/asihpi/hpi6205.c b/sound/pci/asihpi/hpi6205.c
index e041a6ae1c5..4f2873880b1 100644
--- a/sound/pci/asihpi/hpi6205.c
+++ b/sound/pci/asihpi/hpi6205.c
@@ -1,7 +1,7 @@
1/****************************************************************************** 1/******************************************************************************
2 2
3 AudioScience HPI driver 3 AudioScience HPI driver
4 Copyright (C) 1997-2010 AudioScience Inc. <support@audioscience.com> 4 Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of version 2 of the GNU General Public License as 7 it under the terms of version 2 of the GNU General Public License as
@@ -45,18 +45,21 @@
45#define HPI6205_ERROR_MSG_RESP_TIMEOUT 1016 45#define HPI6205_ERROR_MSG_RESP_TIMEOUT 1016
46 46
47/* initialization/bootload errors */ 47/* initialization/bootload errors */
48#define HPI6205_ERROR_6205_NO_IRQ 1002 48#define HPI6205_ERROR_6205_NO_IRQ 1002
49#define HPI6205_ERROR_6205_INIT_FAILED 1003 49#define HPI6205_ERROR_6205_INIT_FAILED 1003
50#define HPI6205_ERROR_6205_REG 1006 50#define HPI6205_ERROR_6205_REG 1006
51#define HPI6205_ERROR_6205_DSPPAGE 1007 51#define HPI6205_ERROR_6205_DSPPAGE 1007
52#define HPI6205_ERROR_C6713_HPIC 1009 52#define HPI6205_ERROR_C6713_HPIC 1009
53#define HPI6205_ERROR_C6713_HPIA 1010 53#define HPI6205_ERROR_C6713_HPIA 1010
54#define HPI6205_ERROR_C6713_PLL 1011 54#define HPI6205_ERROR_C6713_PLL 1011
55#define HPI6205_ERROR_DSP_INTMEM 1012 55#define HPI6205_ERROR_DSP_INTMEM 1012
56#define HPI6205_ERROR_DSP_EXTMEM 1013 56#define HPI6205_ERROR_DSP_EXTMEM 1013
57#define HPI6205_ERROR_DSP_PLD 1014 57#define HPI6205_ERROR_DSP_PLD 1014
58#define HPI6205_ERROR_6205_EEPROM 1017 58#define HPI6205_ERROR_6205_EEPROM 1017
59#define HPI6205_ERROR_DSP_EMIF 1018 59#define HPI6205_ERROR_DSP_EMIF1 1018
60#define HPI6205_ERROR_DSP_EMIF2 1019
61#define HPI6205_ERROR_DSP_EMIF3 1020
62#define HPI6205_ERROR_DSP_EMIF4 1021
60 63
61/*****************************************************************************/ 64/*****************************************************************************/
62/* for C6205 PCI i/f */ 65/* for C6205 PCI i/f */
@@ -488,7 +491,7 @@ static void subsys_create_adapter(struct hpi_message *phm,
488 return; 491 return;
489 } 492 }
490 493
491 phr->u.s.adapter_type = ao.adapter_type; 494 phr->u.s.adapter_type = ao.type;
492 phr->u.s.adapter_index = ao.index; 495 phr->u.s.adapter_index = ao.index;
493 phr->error = 0; 496 phr->error = 0;
494} 497}
@@ -503,7 +506,7 @@ static void adapter_delete(struct hpi_adapter_obj *pao,
503 phr->error = HPI_ERROR_INVALID_OBJ_INDEX; 506 phr->error = HPI_ERROR_INVALID_OBJ_INDEX;
504 return; 507 return;
505 } 508 }
506 phw = (struct hpi_hw_obj *)pao->priv; 509 phw = pao->priv;
507 /* reset adapter h/w */ 510 /* reset adapter h/w */
508 /* Reset C6713 #1 */ 511 /* Reset C6713 #1 */
509 boot_loader_write_mem32(pao, 0, C6205_BAR0_TIMER1_CTL, 0); 512 boot_loader_write_mem32(pao, 0, C6205_BAR0_TIMER1_CTL, 0);
@@ -652,7 +655,7 @@ static u16 create_adapter_obj(struct hpi_adapter_obj *pao,
652 if (hr.error) 655 if (hr.error)
653 return hr.error; 656 return hr.error;
654 657
655 pao->adapter_type = hr.u.ax.info.adapter_type; 658 pao->type = hr.u.ax.info.adapter_type;
656 pao->index = hr.u.ax.info.adapter_index; 659 pao->index = hr.u.ax.info.adapter_index;
657 660
658 max_streams = 661 max_streams =
@@ -665,8 +668,6 @@ static u16 create_adapter_obj(struct hpi_adapter_obj *pao,
665 hr.u.ax.info.serial_number); 668 hr.u.ax.info.serial_number);
666 } 669 }
667 670
668 pao->open = 0; /* upon creation the adapter is closed */
669
670 if (phw->p_cache) 671 if (phw->p_cache)
671 phw->p_cache->adap_idx = pao->index; 672 phw->p_cache->adap_idx = pao->index;
672 673
@@ -803,8 +804,8 @@ static void outstream_host_buffer_allocate(struct hpi_adapter_obj *pao,
803 obj_index]; 804 obj_index];
804 status->samples_processed = 0; 805 status->samples_processed = 0;
805 status->stream_state = HPI_STATE_STOPPED; 806 status->stream_state = HPI_STATE_STOPPED;
806 status->dSP_index = 0; 807 status->dsp_index = 0;
807 status->host_index = status->dSP_index; 808 status->host_index = status->dsp_index;
808 status->size_in_bytes = phm->u.d.u.buffer.buffer_size; 809 status->size_in_bytes = phm->u.d.u.buffer.buffer_size;
809 status->auxiliary_data_available = 0; 810 status->auxiliary_data_available = 0;
810 811
@@ -878,7 +879,7 @@ static void outstream_host_buffer_free(struct hpi_adapter_obj *pao,
878static u32 outstream_get_space_available(struct hpi_hostbuffer_status *status) 879static u32 outstream_get_space_available(struct hpi_hostbuffer_status *status)
879{ 880{
880 return status->size_in_bytes - (status->host_index - 881 return status->size_in_bytes - (status->host_index -
881 status->dSP_index); 882 status->dsp_index);
882} 883}
883 884
884static void outstream_write(struct hpi_adapter_obj *pao, 885static void outstream_write(struct hpi_adapter_obj *pao,
@@ -1080,8 +1081,8 @@ static void instream_host_buffer_allocate(struct hpi_adapter_obj *pao,
1080 obj_index]; 1081 obj_index];
1081 status->samples_processed = 0; 1082 status->samples_processed = 0;
1082 status->stream_state = HPI_STATE_STOPPED; 1083 status->stream_state = HPI_STATE_STOPPED;
1083 status->dSP_index = 0; 1084 status->dsp_index = 0;
1084 status->host_index = status->dSP_index; 1085 status->host_index = status->dsp_index;
1085 status->size_in_bytes = phm->u.d.u.buffer.buffer_size; 1086 status->size_in_bytes = phm->u.d.u.buffer.buffer_size;
1086 status->auxiliary_data_available = 0; 1087 status->auxiliary_data_available = 0;
1087 1088
@@ -1162,7 +1163,7 @@ static void instream_start(struct hpi_adapter_obj *pao,
1162 1163
1163static u32 instream_get_bytes_available(struct hpi_hostbuffer_status *status) 1164static u32 instream_get_bytes_available(struct hpi_hostbuffer_status *status)
1164{ 1165{
1165 return status->dSP_index - status->host_index; 1166 return status->dsp_index - status->host_index;
1166} 1167}
1167 1168
1168static void instream_read(struct hpi_adapter_obj *pao, 1169static void instream_read(struct hpi_adapter_obj *pao,
@@ -1614,7 +1615,7 @@ static u16 boot_loader_config_emif(struct hpi_adapter_obj *pao, int dsp_index)
1614 boot_loader_write_mem32(pao, dsp_index, 0x01800008, setting); 1615 boot_loader_write_mem32(pao, dsp_index, 0x01800008, setting);
1615 if (setting != boot_loader_read_mem32(pao, dsp_index, 1616 if (setting != boot_loader_read_mem32(pao, dsp_index,
1616 0x01800008)) 1617 0x01800008))
1617 return HPI6205_ERROR_DSP_EMIF; 1618 return HPI6205_ERROR_DSP_EMIF1;
1618 1619
1619 /* EMIF CE1 setup - 32 bit async. This is 6713 #1 HPI, */ 1620 /* EMIF CE1 setup - 32 bit async. This is 6713 #1 HPI, */
1620 /* which occupies D15..0. 6713 starts at 27MHz, so need */ 1621 /* which occupies D15..0. 6713 starts at 27MHz, so need */
@@ -1627,7 +1628,7 @@ static u16 boot_loader_config_emif(struct hpi_adapter_obj *pao, int dsp_index)
1627 boot_loader_write_mem32(pao, dsp_index, 0x01800004, setting); 1628 boot_loader_write_mem32(pao, dsp_index, 0x01800004, setting);
1628 if (setting != boot_loader_read_mem32(pao, dsp_index, 1629 if (setting != boot_loader_read_mem32(pao, dsp_index,
1629 0x01800004)) 1630 0x01800004))
1630 return HPI6205_ERROR_DSP_EMIF; 1631 return HPI6205_ERROR_DSP_EMIF2;
1631 1632
1632 /* EMIF CE2 setup - 32 bit async. This is 6713 #2 HPI, */ 1633 /* EMIF CE2 setup - 32 bit async. This is 6713 #2 HPI, */
1633 /* which occupies D15..0. 6713 starts at 27MHz, so need */ 1634 /* which occupies D15..0. 6713 starts at 27MHz, so need */
@@ -1639,7 +1640,7 @@ static u16 boot_loader_config_emif(struct hpi_adapter_obj *pao, int dsp_index)
1639 boot_loader_write_mem32(pao, dsp_index, 0x01800010, setting); 1640 boot_loader_write_mem32(pao, dsp_index, 0x01800010, setting);
1640 if (setting != boot_loader_read_mem32(pao, dsp_index, 1641 if (setting != boot_loader_read_mem32(pao, dsp_index,
1641 0x01800010)) 1642 0x01800010))
1642 return HPI6205_ERROR_DSP_EMIF; 1643 return HPI6205_ERROR_DSP_EMIF3;
1643 1644
1644 /* EMIF CE3 setup - 32 bit async. */ 1645 /* EMIF CE3 setup - 32 bit async. */
1645 /* This is the PLD on the ASI5000 cards only */ 1646 /* This is the PLD on the ASI5000 cards only */
@@ -1650,7 +1651,7 @@ static u16 boot_loader_config_emif(struct hpi_adapter_obj *pao, int dsp_index)
1650 boot_loader_write_mem32(pao, dsp_index, 0x01800014, setting); 1651 boot_loader_write_mem32(pao, dsp_index, 0x01800014, setting);
1651 if (setting != boot_loader_read_mem32(pao, dsp_index, 1652 if (setting != boot_loader_read_mem32(pao, dsp_index,
1652 0x01800014)) 1653 0x01800014))
1653 return HPI6205_ERROR_DSP_EMIF; 1654 return HPI6205_ERROR_DSP_EMIF4;
1654 1655
1655 /* set EMIF SDRAM control for 2Mx32 SDRAM (512x32x4 bank) */ 1656 /* set EMIF SDRAM control for 2Mx32 SDRAM (512x32x4 bank) */
1656 /* need to use this else DSP code crashes? */ 1657 /* need to use this else DSP code crashes? */
diff --git a/sound/pci/asihpi/hpi_internal.h b/sound/pci/asihpi/hpi_internal.h
index d497030c160..4cc315daeda 100644
--- a/sound/pci/asihpi/hpi_internal.h
+++ b/sound/pci/asihpi/hpi_internal.h
@@ -25,6 +25,7 @@ HPI internal definitions
25#define _HPI_INTERNAL_H_ 25#define _HPI_INTERNAL_H_
26 26
27#include "hpi.h" 27#include "hpi.h"
28
28/** maximum number of memory regions mapped to an adapter */ 29/** maximum number of memory regions mapped to an adapter */
29#define HPI_MAX_ADAPTER_MEM_SPACES (2) 30#define HPI_MAX_ADAPTER_MEM_SPACES (2)
30 31
@@ -220,8 +221,6 @@ enum HPI_CONTROL_ATTRIBUTES {
220 221
221 HPI_COBRANET_SET = HPI_CTL_ATTR(COBRANET, 1), 222 HPI_COBRANET_SET = HPI_CTL_ATTR(COBRANET, 1),
222 HPI_COBRANET_GET = HPI_CTL_ATTR(COBRANET, 2), 223 HPI_COBRANET_GET = HPI_CTL_ATTR(COBRANET, 2),
223 /*HPI_COBRANET_SET_DATA = HPI_CTL_ATTR(COBRANET, 3), */
224 /*HPI_COBRANET_GET_DATA = HPI_CTL_ATTR(COBRANET, 4), */
225 HPI_COBRANET_GET_STATUS = HPI_CTL_ATTR(COBRANET, 5), 224 HPI_COBRANET_GET_STATUS = HPI_CTL_ATTR(COBRANET, 5),
226 HPI_COBRANET_SEND_PACKET = HPI_CTL_ATTR(COBRANET, 6), 225 HPI_COBRANET_SEND_PACKET = HPI_CTL_ATTR(COBRANET, 6),
227 HPI_COBRANET_GET_PACKET = HPI_CTL_ATTR(COBRANET, 7), 226 HPI_COBRANET_GET_PACKET = HPI_CTL_ATTR(COBRANET, 7),
@@ -241,7 +240,9 @@ enum HPI_CONTROL_ATTRIBUTES {
241 HPI_PAD_PROGRAM_TYPE = HPI_CTL_ATTR(PAD, 5), 240 HPI_PAD_PROGRAM_TYPE = HPI_CTL_ATTR(PAD, 5),
242 HPI_PAD_PROGRAM_ID = HPI_CTL_ATTR(PAD, 6), 241 HPI_PAD_PROGRAM_ID = HPI_CTL_ATTR(PAD, 6),
243 HPI_PAD_TA_SUPPORT = HPI_CTL_ATTR(PAD, 7), 242 HPI_PAD_TA_SUPPORT = HPI_CTL_ATTR(PAD, 7),
244 HPI_PAD_TA_ACTIVE = HPI_CTL_ATTR(PAD, 8) 243 HPI_PAD_TA_ACTIVE = HPI_CTL_ATTR(PAD, 8),
244
245 HPI_UNIVERSAL_ENTITY = HPI_CTL_ATTR(UNIVERSAL, 1)
245}; 246};
246 247
247#define HPI_POLARITY_POSITIVE 0 248#define HPI_POLARITY_POSITIVE 0
@@ -393,14 +394,10 @@ enum HPI_FUNCTION_IDS {
393 HPI_SUBSYS_OPEN = HPI_FUNC_ID(SUBSYSTEM, 1), 394 HPI_SUBSYS_OPEN = HPI_FUNC_ID(SUBSYSTEM, 1),
394 HPI_SUBSYS_GET_VERSION = HPI_FUNC_ID(SUBSYSTEM, 2), 395 HPI_SUBSYS_GET_VERSION = HPI_FUNC_ID(SUBSYSTEM, 2),
395 HPI_SUBSYS_GET_INFO = HPI_FUNC_ID(SUBSYSTEM, 3), 396 HPI_SUBSYS_GET_INFO = HPI_FUNC_ID(SUBSYSTEM, 3),
396 /* HPI_SUBSYS_FIND_ADAPTERS = HPI_FUNC_ID(SUBSYSTEM, 4), */
397 HPI_SUBSYS_CREATE_ADAPTER = HPI_FUNC_ID(SUBSYSTEM, 5), 397 HPI_SUBSYS_CREATE_ADAPTER = HPI_FUNC_ID(SUBSYSTEM, 5),
398 HPI_SUBSYS_CLOSE = HPI_FUNC_ID(SUBSYSTEM, 6), 398 HPI_SUBSYS_CLOSE = HPI_FUNC_ID(SUBSYSTEM, 6),
399 /* HPI_SUBSYS_DELETE_ADAPTER = HPI_FUNC_ID(SUBSYSTEM, 7), */
400 HPI_SUBSYS_DRIVER_LOAD = HPI_FUNC_ID(SUBSYSTEM, 8), 399 HPI_SUBSYS_DRIVER_LOAD = HPI_FUNC_ID(SUBSYSTEM, 8),
401 HPI_SUBSYS_DRIVER_UNLOAD = HPI_FUNC_ID(SUBSYSTEM, 9), 400 HPI_SUBSYS_DRIVER_UNLOAD = HPI_FUNC_ID(SUBSYSTEM, 9),
402 /* HPI_SUBSYS_READ_PORT_8 = HPI_FUNC_ID(SUBSYSTEM, 10), */
403 /* HPI_SUBSYS_WRITE_PORT_8 = HPI_FUNC_ID(SUBSYSTEM, 11), */
404 HPI_SUBSYS_GET_NUM_ADAPTERS = HPI_FUNC_ID(SUBSYSTEM, 12), 401 HPI_SUBSYS_GET_NUM_ADAPTERS = HPI_FUNC_ID(SUBSYSTEM, 12),
405 HPI_SUBSYS_GET_ADAPTER = HPI_FUNC_ID(SUBSYSTEM, 13), 402 HPI_SUBSYS_GET_ADAPTER = HPI_FUNC_ID(SUBSYSTEM, 13),
406 HPI_SUBSYS_SET_NETWORK_INTERFACE = HPI_FUNC_ID(SUBSYSTEM, 14), 403 HPI_SUBSYS_SET_NETWORK_INTERFACE = HPI_FUNC_ID(SUBSYSTEM, 14),
@@ -430,7 +427,10 @@ enum HPI_FUNCTION_IDS {
430 HPI_ADAPTER_IRQ_QUERY_AND_CLEAR = HPI_FUNC_ID(ADAPTER, 19), 427 HPI_ADAPTER_IRQ_QUERY_AND_CLEAR = HPI_FUNC_ID(ADAPTER, 19),
431 HPI_ADAPTER_IRQ_CALLBACK = HPI_FUNC_ID(ADAPTER, 20), 428 HPI_ADAPTER_IRQ_CALLBACK = HPI_FUNC_ID(ADAPTER, 20),
432 HPI_ADAPTER_DELETE = HPI_FUNC_ID(ADAPTER, 21), 429 HPI_ADAPTER_DELETE = HPI_FUNC_ID(ADAPTER, 21),
433#define HPI_ADAPTER_FUNCTION_COUNT 21 430 HPI_ADAPTER_READ_FLASH = HPI_FUNC_ID(ADAPTER, 22),
431 HPI_ADAPTER_END_FLASH = HPI_FUNC_ID(ADAPTER, 23),
432 HPI_ADAPTER_FILESTORE_DELETE_ALL = HPI_FUNC_ID(ADAPTER, 24),
433#define HPI_ADAPTER_FUNCTION_COUNT 24
434 434
435 HPI_OSTREAM_OPEN = HPI_FUNC_ID(OSTREAM, 1), 435 HPI_OSTREAM_OPEN = HPI_FUNC_ID(OSTREAM, 1),
436 HPI_OSTREAM_CLOSE = HPI_FUNC_ID(OSTREAM, 2), 436 HPI_OSTREAM_CLOSE = HPI_FUNC_ID(OSTREAM, 2),
@@ -495,7 +495,9 @@ enum HPI_FUNCTION_IDS {
495 HPI_MIXER_GET_CONTROL_MULTIPLE_VALUES = HPI_FUNC_ID(MIXER, 10), 495 HPI_MIXER_GET_CONTROL_MULTIPLE_VALUES = HPI_FUNC_ID(MIXER, 10),
496 HPI_MIXER_STORE = HPI_FUNC_ID(MIXER, 11), 496 HPI_MIXER_STORE = HPI_FUNC_ID(MIXER, 11),
497 HPI_MIXER_GET_CACHE_INFO = HPI_FUNC_ID(MIXER, 12), 497 HPI_MIXER_GET_CACHE_INFO = HPI_FUNC_ID(MIXER, 12),
498#define HPI_MIXER_FUNCTION_COUNT 12 498 HPI_MIXER_GET_BLOCK_HANDLE = HPI_FUNC_ID(MIXER, 13),
499 HPI_MIXER_GET_PARAMETER_HANDLE = HPI_FUNC_ID(MIXER, 14),
500#define HPI_MIXER_FUNCTION_COUNT 14
499 501
500 HPI_CONTROL_GET_INFO = HPI_FUNC_ID(CONTROL, 1), 502 HPI_CONTROL_GET_INFO = HPI_FUNC_ID(CONTROL, 1),
501 HPI_CONTROL_GET_STATE = HPI_FUNC_ID(CONTROL, 2), 503 HPI_CONTROL_GET_STATE = HPI_FUNC_ID(CONTROL, 2),
@@ -618,7 +620,7 @@ struct hpi_hostbuffer_status {
618 u32 auxiliary_data_available; 620 u32 auxiliary_data_available;
619 u32 stream_state; 621 u32 stream_state;
620 /* DSP index in to the host bus master buffer. */ 622 /* DSP index in to the host bus master buffer. */
621 u32 dSP_index; 623 u32 dsp_index;
622 /* Host index in to the host bus master buffer. */ 624 /* Host index in to the host bus master buffer. */
623 u32 host_index; 625 u32 host_index;
624 u32 size_in_bytes; 626 u32 size_in_bytes;
@@ -661,13 +663,6 @@ union hpi_adapterx_msg {
661 u16 index; 663 u16 index;
662 } module_info; 664 } module_info;
663 struct { 665 struct {
664 u32 checksum;
665 u16 sequence;
666 u16 length;
667 u16 offset; /**< offset from start of msg to data */
668 u16 unused;
669 } program_flash;
670 struct {
671 u16 index; 666 u16 index;
672 u16 what; 667 u16 what;
673 u16 property_index; 668 u16 property_index;
@@ -678,25 +673,18 @@ union hpi_adapterx_msg {
678 u16 parameter2; 673 u16 parameter2;
679 } property_set; 674 } property_set;
680 struct { 675 struct {
681 u32 offset;
682 } query_flash;
683 struct {
684 u32 pad32; 676 u32 pad32;
685 u16 key1; 677 u16 key1;
686 u16 key2; 678 u16 key2;
687 } restart; 679 } restart;
688 struct { 680 struct {
689 u32 offset;
690 u32 length;
691 u32 key;
692 } start_flash;
693 struct {
694 u32 pad32; 681 u32 pad32;
695 u16 value; 682 u16 value;
696 } test_assert; 683 } test_assert;
697 struct { 684 struct {
698 u32 yes; 685 u32 yes;
699 } irq_query; 686 } irq_query;
687 u32 pad[3];
700}; 688};
701 689
702struct hpi_adapter_res { 690struct hpi_adapter_res {
@@ -724,18 +712,10 @@ union hpi_adapterx_res {
724 u32 adapter_mode; 712 u32 adapter_mode;
725 } mode; 713 } mode;
726 struct { 714 struct {
727 u16 sequence;
728 } program_flash;
729 struct {
730 u16 parameter1; 715 u16 parameter1;
731 u16 parameter2; 716 u16 parameter2;
732 } property_get; 717 } property_get;
733 struct { 718 struct {
734 u32 checksum;
735 u32 length;
736 u32 version;
737 } query_flash;
738 struct {
739 u32 yes; 719 u32 yes;
740 } irq_query; 720 } irq_query;
741}; 721};
@@ -1150,74 +1130,9 @@ struct hpi_res_adapter_get_info {
1150 struct hpi_adapter_res p; 1130 struct hpi_adapter_res p;
1151}; 1131};
1152 1132
1153/* padding is so these are same size as v0 hpi_message */
1154struct hpi_msg_adapter_query_flash {
1155 struct hpi_message_header h;
1156 u32 offset;
1157 u8 pad_to_version0_size[sizeof(struct hpi_message) - /* V0 res */
1158 sizeof(struct hpi_message_header) - 1 * sizeof(u32)];
1159};
1160
1161/* padding is so these are same size as v0 hpi_response */
1162struct hpi_res_adapter_query_flash {
1163 struct hpi_response_header h;
1164 u32 checksum;
1165 u32 length;
1166 u32 version;
1167 u8 pad_to_version0_size[sizeof(struct hpi_response) - /* V0 res */
1168 sizeof(struct hpi_response_header) - 3 * sizeof(u32)];
1169};
1170
1171struct hpi_msg_adapter_start_flash {
1172 struct hpi_message_header h;
1173 u32 offset;
1174 u32 length;
1175 u32 key;
1176 u8 pad_to_version0_size[sizeof(struct hpi_message) - /* V0 res */
1177 sizeof(struct hpi_message_header) - 3 * sizeof(u32)];
1178};
1179
1180struct hpi_res_adapter_start_flash {
1181 struct hpi_response_header h;
1182 u8 pad_to_version0_size[sizeof(struct hpi_response) - /* V0 res */
1183 sizeof(struct hpi_response_header)];
1184};
1185
1186struct hpi_msg_adapter_program_flash_payload {
1187 u32 checksum;
1188 u16 sequence;
1189 u16 length;
1190 u16 offset; /**< offset from start of msg to data */
1191 u16 unused;
1192 /* ensure sizeof(header + payload) == sizeof(hpi_message_V0)
1193 because old firmware expects data after message of this size */
1194 u8 pad_to_version0_size[sizeof(struct hpi_message) - /* V0 message */
1195 sizeof(struct hpi_message_header) - sizeof(u32) -
1196 4 * sizeof(u16)];
1197};
1198
1199struct hpi_msg_adapter_program_flash {
1200 struct hpi_message_header h;
1201 struct hpi_msg_adapter_program_flash_payload p;
1202 u32 data[256];
1203};
1204
1205struct hpi_res_adapter_program_flash {
1206 struct hpi_response_header h;
1207 u16 sequence;
1208 u8 pad_to_version0_size[sizeof(struct hpi_response) - /* V0 res */
1209 sizeof(struct hpi_response_header) - sizeof(u16)];
1210};
1211
1212struct hpi_msg_adapter_debug_read {
1213 struct hpi_message_header h;
1214 u32 dsp_address;
1215 u32 count_bytes;
1216};
1217
1218struct hpi_res_adapter_debug_read { 1133struct hpi_res_adapter_debug_read {
1219 struct hpi_response_header h; 1134 struct hpi_response_header h;
1220 u8 bytes[256]; 1135 u8 bytes[1024];
1221}; 1136};
1222 1137
1223struct hpi_msg_cobranet_hmi { 1138struct hpi_msg_cobranet_hmi {
@@ -1461,7 +1376,7 @@ struct hpi_control_cache_pad {
1461/* 2^N sized FIFO buffer (internal to HPI<->DSP interaction) */ 1376/* 2^N sized FIFO buffer (internal to HPI<->DSP interaction) */
1462struct hpi_fifo_buffer { 1377struct hpi_fifo_buffer {
1463 u32 size; 1378 u32 size;
1464 u32 dSP_index; 1379 u32 dsp_index;
1465 u32 host_index; 1380 u32 host_index;
1466}; 1381};
1467 1382
diff --git a/sound/pci/asihpi/hpi_version.h b/sound/pci/asihpi/hpi_version.h
new file mode 100644
index 00000000000..e9146e53bd5
--- /dev/null
+++ b/sound/pci/asihpi/hpi_version.h
@@ -0,0 +1,32 @@
1/** HPI Version Definitions
2Development releases have odd minor version.
3Production releases have even minor version.
4
5\file hpi_version.h
6*/
7
8#ifndef _HPI_VERSION_H
9#define _HPI_VERSION_H
10
11/* Use single digits for versions less that 10 to avoid octal. */
12/* *** HPI_VER is the only edit required to update version *** */
13/** HPI version */
14#define HPI_VER HPI_VERSION_CONSTRUCTOR(4, 10, 1)
15
16/** HPI version string in dotted decimal format */
17#define HPI_VER_STRING "4.10.01"
18
19/** Library version as documented in hpi-api-versions.txt */
20#define HPI_LIB_VER HPI_VERSION_CONSTRUCTOR(10, 2, 0)
21
22/** Construct hpi version number from major, minor, release numbers */
23#define HPI_VERSION_CONSTRUCTOR(maj, min, r) ((maj << 16) + (min << 8) + r)
24
25/** Extract major version from hpi version number */
26#define HPI_VER_MAJOR(v) ((int)(v >> 16))
27/** Extract minor version from hpi version number */
28#define HPI_VER_MINOR(v) ((int)((v >> 8) & 0xFF))
29/** Extract release from hpi version number */
30#define HPI_VER_RELEASE(v) ((int)(v & 0xFF))
31
32#endif
diff --git a/sound/pci/asihpi/hpicmn.c b/sound/pci/asihpi/hpicmn.c
index bd47521b24e..7ed5c26c373 100644
--- a/sound/pci/asihpi/hpicmn.c
+++ b/sound/pci/asihpi/hpicmn.c
@@ -1,7 +1,7 @@
1/****************************************************************************** 1/******************************************************************************
2 2
3 AudioScience HPI driver 3 AudioScience HPI driver
4 Copyright (C) 1997-2010 AudioScience Inc. <support@audioscience.com> 4 Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of version 2 of the GNU General Public License as 7 it under the terms of version 2 of the GNU General Public License as
@@ -68,7 +68,7 @@ u16 hpi_validate_response(struct hpi_message *phm, struct hpi_response *phr)
68u16 hpi_add_adapter(struct hpi_adapter_obj *pao) 68u16 hpi_add_adapter(struct hpi_adapter_obj *pao)
69{ 69{
70 u16 retval = 0; 70 u16 retval = 0;
71 /*HPI_ASSERT(pao->wAdapterType); */ 71 /*HPI_ASSERT(pao->type); */
72 72
73 hpios_alistlock_lock(&adapters); 73 hpios_alistlock_lock(&adapters);
74 74
@@ -77,13 +77,13 @@ u16 hpi_add_adapter(struct hpi_adapter_obj *pao)
77 goto unlock; 77 goto unlock;
78 } 78 }
79 79
80 if (adapters.adapter[pao->index].adapter_type) { 80 if (adapters.adapter[pao->index].type) {
81 int a; 81 int a;
82 for (a = HPI_MAX_ADAPTERS - 1; a >= 0; a--) { 82 for (a = HPI_MAX_ADAPTERS - 1; a >= 0; a--) {
83 if (!adapters.adapter[a].adapter_type) { 83 if (!adapters.adapter[a].type) {
84 HPI_DEBUG_LOG(WARNING, 84 HPI_DEBUG_LOG(WARNING,
85 "ASI%X duplicate index %d moved to %d\n", 85 "ASI%X duplicate index %d moved to %d\n",
86 pao->adapter_type, pao->index, a); 86 pao->type, pao->index, a);
87 pao->index = a; 87 pao->index = a;
88 break; 88 break;
89 } 89 }
@@ -104,13 +104,13 @@ unlock:
104 104
105void hpi_delete_adapter(struct hpi_adapter_obj *pao) 105void hpi_delete_adapter(struct hpi_adapter_obj *pao)
106{ 106{
107 if (!pao->adapter_type) { 107 if (!pao->type) {
108 HPI_DEBUG_LOG(ERROR, "removing null adapter?\n"); 108 HPI_DEBUG_LOG(ERROR, "removing null adapter?\n");
109 return; 109 return;
110 } 110 }
111 111
112 hpios_alistlock_lock(&adapters); 112 hpios_alistlock_lock(&adapters);
113 if (adapters.adapter[pao->index].adapter_type) 113 if (adapters.adapter[pao->index].type)
114 adapters.gw_num_adapters--; 114 adapters.gw_num_adapters--;
115 memset(&adapters.adapter[pao->index], 0, sizeof(adapters.adapter[0])); 115 memset(&adapters.adapter[pao->index], 0, sizeof(adapters.adapter[0]));
116 hpios_alistlock_unlock(&adapters); 116 hpios_alistlock_unlock(&adapters);
@@ -132,7 +132,7 @@ struct hpi_adapter_obj *hpi_find_adapter(u16 adapter_index)
132 } 132 }
133 133
134 pao = &adapters.adapter[adapter_index]; 134 pao = &adapters.adapter[adapter_index];
135 if (pao->adapter_type != 0) { 135 if (pao->type != 0) {
136 /* 136 /*
137 HPI_DEBUG_LOG(VERBOSE, "Found adapter index %d\n", 137 HPI_DEBUG_LOG(VERBOSE, "Found adapter index %d\n",
138 wAdapterIndex); 138 wAdapterIndex);
@@ -165,7 +165,7 @@ static void subsys_get_adapter(struct hpi_message *phm,
165 165
166 /* find the nCount'th nonzero adapter in array */ 166 /* find the nCount'th nonzero adapter in array */
167 for (index = 0; index < HPI_MAX_ADAPTERS; index++) { 167 for (index = 0; index < HPI_MAX_ADAPTERS; index++) {
168 if (adapters.adapter[index].adapter_type) { 168 if (adapters.adapter[index].type) {
169 if (!count) 169 if (!count)
170 break; 170 break;
171 count--; 171 count--;
@@ -174,11 +174,11 @@ static void subsys_get_adapter(struct hpi_message *phm,
174 174
175 if (index < HPI_MAX_ADAPTERS) { 175 if (index < HPI_MAX_ADAPTERS) {
176 phr->u.s.adapter_index = adapters.adapter[index].index; 176 phr->u.s.adapter_index = adapters.adapter[index].index;
177 phr->u.s.adapter_type = adapters.adapter[index].adapter_type; 177 phr->u.s.adapter_type = adapters.adapter[index].type;
178 } else { 178 } else {
179 phr->u.s.adapter_index = 0; 179 phr->u.s.adapter_index = 0;
180 phr->u.s.adapter_type = 0; 180 phr->u.s.adapter_type = 0;
181 phr->error = HPI_ERROR_BAD_ADAPTER_NUMBER; 181 phr->error = HPI_ERROR_INVALID_OBJ_INDEX;
182 } 182 }
183} 183}
184 184
@@ -324,6 +324,8 @@ short hpi_check_control_cache(struct hpi_control_cache *p_cache,
324 } 324 }
325 325
326 phr->error = 0; 326 phr->error = 0;
327 phr->specific_error = 0;
328 phr->version = 0;
327 329
328 /* set the default response size */ 330 /* set the default response size */
329 response_size = 331 response_size =
@@ -531,8 +533,12 @@ short hpi_check_control_cache(struct hpi_control_cache *p_cache,
531 found ? "Cached" : "Uncached", phm->adapter_index, 533 found ? "Cached" : "Uncached", phm->adapter_index,
532 pI->control_index, pI->control_type, phm->u.c.attribute); 534 pI->control_index, pI->control_type, phm->u.c.attribute);
533 535
534 if (found) 536 if (found) {
535 phr->size = (u16)response_size; 537 phr->size = (u16)response_size;
538 phr->type = HPI_TYPE_RESPONSE;
539 phr->object = phm->object;
540 phr->function = phm->function;
541 }
536 542
537 return found; 543 return found;
538} 544}
@@ -631,7 +637,7 @@ struct hpi_control_cache *hpi_alloc_control_cache(const u32 control_count,
631 if (!p_cache) 637 if (!p_cache)
632 return NULL; 638 return NULL;
633 639
634 p_cache->p_info = kzalloc(sizeof(*p_cache->p_info) * control_count, 640 p_cache->p_info = kcalloc(control_count, sizeof(*p_cache->p_info),
635 GFP_KERNEL); 641 GFP_KERNEL);
636 if (!p_cache->p_info) { 642 if (!p_cache->p_info) {
637 kfree(p_cache); 643 kfree(p_cache);
diff --git a/sound/pci/asihpi/hpicmn.h b/sound/pci/asihpi/hpicmn.h
index d53cdf6e535..e4412128304 100644
--- a/sound/pci/asihpi/hpicmn.h
+++ b/sound/pci/asihpi/hpicmn.h
@@ -1,7 +1,7 @@
1/** 1/**
2 2
3 AudioScience HPI driver 3 AudioScience HPI driver
4 Copyright (C) 1997-2010 AudioScience Inc. <support@audioscience.com> 4 Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of version 2 of the GNU General Public License as 7 it under the terms of version 2 of the GNU General Public License as
@@ -18,12 +18,15 @@
18 18
19*/ 19*/
20 20
21struct hpi_adapter_obj;
22
23/* a function that takes an adapter obj and returns an int */
24typedef int adapter_int_func(struct hpi_adapter_obj *pao);
25
21struct hpi_adapter_obj { 26struct hpi_adapter_obj {
22 struct hpi_pci pci; /* PCI info - bus#,dev#,address etc */ 27 struct hpi_pci pci; /* PCI info - bus#,dev#,address etc */
23 u16 adapter_type; /* ASI6701 etc */ 28 u16 type; /* 0x6644 == ASI6644 etc */
24 u16 index; /* */ 29 u16 index;
25 u16 open; /* =1 when adapter open */
26 u16 mixer_open;
27 30
28 struct hpios_spinlock dsp_lock; 31 struct hpios_spinlock dsp_lock;
29 32
diff --git a/sound/pci/asihpi/hpidebug.c b/sound/pci/asihpi/hpidebug.c
index b52baf62791..ac86a1f1d3b 100644
--- a/sound/pci/asihpi/hpidebug.c
+++ b/sound/pci/asihpi/hpidebug.c
@@ -1,7 +1,7 @@
1/************************************************************************ 1/************************************************************************
2 2
3 AudioScience HPI driver 3 AudioScience HPI driver
4 Copyright (C) 1997-2010 AudioScience Inc. <support@audioscience.com> 4 Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of version 2 of the GNU General Public License as 7 it under the terms of version 2 of the GNU General Public License as
diff --git a/sound/pci/asihpi/hpidebug.h b/sound/pci/asihpi/hpidebug.h
index 940f54c3c53..2c9af2329d3 100644
--- a/sound/pci/asihpi/hpidebug.h
+++ b/sound/pci/asihpi/hpidebug.h
@@ -1,7 +1,7 @@
1/***************************************************************************** 1/*****************************************************************************
2 2
3 AudioScience HPI driver 3 AudioScience HPI driver
4 Copyright (C) 1997-2010 AudioScience Inc. <support@audioscience.com> 4 Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of version 2 of the GNU General Public License as 7 it under the terms of version 2 of the GNU General Public License as
diff --git a/sound/pci/asihpi/hpidspcd.c b/sound/pci/asihpi/hpidspcd.c
index 71d32c868c9..456a758f04f 100644
--- a/sound/pci/asihpi/hpidspcd.c
+++ b/sound/pci/asihpi/hpidspcd.c
@@ -25,6 +25,7 @@ hotplug firmware loader from individual dsp code files
25#define SOURCEFILE_NAME "hpidspcd.c" 25#define SOURCEFILE_NAME "hpidspcd.c"
26#include "hpidspcd.h" 26#include "hpidspcd.h"
27#include "hpidebug.h" 27#include "hpidebug.h"
28#include "hpi_version.h"
28 29
29struct dsp_code_private { 30struct dsp_code_private {
30 /** Firmware descriptor */ 31 /** Firmware descriptor */
@@ -32,9 +33,6 @@ struct dsp_code_private {
32 struct pci_dev *dev; 33 struct pci_dev *dev;
33}; 34};
34 35
35#define HPI_VER_DECIMAL ((int)(HPI_VER_MAJOR(HPI_VER) * 10000 + \
36 HPI_VER_MINOR(HPI_VER) * 100 + HPI_VER_RELEASE(HPI_VER)))
37
38/*-------------------------------------------------------------------*/ 36/*-------------------------------------------------------------------*/
39short hpi_dsp_code_open(u32 adapter, void *os_data, struct dsp_code *dsp_code, 37short hpi_dsp_code_open(u32 adapter, void *os_data, struct dsp_code *dsp_code,
40 u32 *os_error_code) 38 u32 *os_error_code)
@@ -66,22 +64,25 @@ short hpi_dsp_code_open(u32 adapter, void *os_data, struct dsp_code *dsp_code,
66 if ((header.type != 0x45444F43) || /* "CODE" */ 64 if ((header.type != 0x45444F43) || /* "CODE" */
67 (header.adapter != adapter) 65 (header.adapter != adapter)
68 || (header.size != firmware->size)) { 66 || (header.size != firmware->size)) {
69 dev_printk(KERN_ERR, &dev->dev, "Invalid firmware file\n"); 67 dev_printk(KERN_ERR, &dev->dev,
68 "Invalid firmware header size %d != file %zd\n",
69 header.size, firmware->size);
70 goto error2; 70 goto error2;
71 } 71 }
72 72
73 if ((header.version / 100 & ~1) != (HPI_VER_DECIMAL / 100 & ~1)) { 73 if ((header.version >> 9) != (HPI_VER >> 9)) {
74 /* Consider even and subsequent odd minor versions to be compatible */
74 dev_printk(KERN_ERR, &dev->dev, 75 dev_printk(KERN_ERR, &dev->dev,
75 "Incompatible firmware version " 76 "Incompatible firmware version "
76 "DSP image %d != Driver %d\n", header.version, 77 "DSP image %X != Driver %X\n", header.version,
77 HPI_VER_DECIMAL); 78 HPI_VER);
78 goto error2; 79 goto error2;
79 } 80 }
80 81
81 if (header.version != HPI_VER_DECIMAL) { 82 if (header.version != HPI_VER) {
82 dev_printk(KERN_WARNING, &dev->dev, 83 dev_printk(KERN_INFO, &dev->dev,
83 "Firmware: release version mismatch DSP image %d != Driver %d\n", 84 "Firmware: release version mismatch DSP image %X != Driver %X\n",
84 header.version, HPI_VER_DECIMAL); 85 header.version, HPI_VER);
85 } 86 }
86 87
87 HPI_DEBUG_LOG(DEBUG, "dsp code %s opened\n", fw_name); 88 HPI_DEBUG_LOG(DEBUG, "dsp code %s opened\n", fw_name);
@@ -108,11 +109,8 @@ error1:
108/*-------------------------------------------------------------------*/ 109/*-------------------------------------------------------------------*/
109void hpi_dsp_code_close(struct dsp_code *dsp_code) 110void hpi_dsp_code_close(struct dsp_code *dsp_code)
110{ 111{
111 if (dsp_code->pvt->firmware) { 112 HPI_DEBUG_LOG(DEBUG, "dsp code closed\n");
112 HPI_DEBUG_LOG(DEBUG, "dsp code closed\n"); 113 release_firmware(dsp_code->pvt->firmware);
113 release_firmware(dsp_code->pvt->firmware);
114 dsp_code->pvt->firmware = NULL;
115 }
116 kfree(dsp_code->pvt); 114 kfree(dsp_code->pvt);
117} 115}
118 116
diff --git a/sound/pci/asihpi/hpidspcd.h b/sound/pci/asihpi/hpidspcd.h
index b22881122f1..659d19ca6d4 100644
--- a/sound/pci/asihpi/hpidspcd.h
+++ b/sound/pci/asihpi/hpidspcd.h
@@ -27,10 +27,6 @@ Functions for reading DSP code to load into DSP
27 27
28#include "hpi_internal.h" 28#include "hpi_internal.h"
29 29
30/** Code header version is decimal encoded e.g. 4.06.10 is 40601 */
31#define HPI_VER_DECIMAL ((int)(HPI_VER_MAJOR(HPI_VER) * 10000 + \
32HPI_VER_MINOR(HPI_VER) * 100 + HPI_VER_RELEASE(HPI_VER)))
33
34/** Header structure for dsp firmware file 30/** Header structure for dsp firmware file
35 This structure must match that used in s2bin.c for generation of asidsp.bin 31 This structure must match that used in s2bin.c for generation of asidsp.bin
36 */ 32 */
diff --git a/sound/pci/asihpi/hpifunc.c b/sound/pci/asihpi/hpifunc.c
index ebb568d695f..510e56cffd3 100644
--- a/sound/pci/asihpi/hpifunc.c
+++ b/sound/pci/asihpi/hpifunc.c
@@ -2826,6 +2826,16 @@ u16 hpi_volume_auto_fade(u32 h_control,
2826 duration_ms, HPI_VOLUME_AUTOFADE_LOG); 2826 duration_ms, HPI_VOLUME_AUTOFADE_LOG);
2827} 2827}
2828 2828
2829u16 hpi_volume_query_auto_fade_profile(const u32 h_volume, const u32 i,
2830 u16 *profile)
2831{
2832 u16 e;
2833 u32 u;
2834 e = hpi_control_query(h_volume, HPI_VOLUME_AUTOFADE, i, 0, &u);
2835 *profile = (u16)u;
2836 return e;
2837}
2838
2829u16 hpi_vox_set_threshold(u32 h_control, short an_gain0_01dB) 2839u16 hpi_vox_set_threshold(u32 h_control, short an_gain0_01dB)
2830{ 2840{
2831 struct hpi_message hm; 2841 struct hpi_message hm;
diff --git a/sound/pci/asihpi/hpimsginit.c b/sound/pci/asihpi/hpimsginit.c
index 52400a6b5f1..032d563e370 100644
--- a/sound/pci/asihpi/hpimsginit.c
+++ b/sound/pci/asihpi/hpimsginit.c
@@ -1,7 +1,7 @@
1/****************************************************************************** 1/******************************************************************************
2 2
3 AudioScience HPI driver 3 AudioScience HPI driver
4 Copyright (C) 1997-2010 AudioScience Inc. <support@audioscience.com> 4 Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of version 2 of the GNU General Public License as 7 it under the terms of version 2 of the GNU General Public License as
diff --git a/sound/pci/asihpi/hpimsginit.h b/sound/pci/asihpi/hpimsginit.h
index bfd330d78b5..5b48708c7d1 100644
--- a/sound/pci/asihpi/hpimsginit.h
+++ b/sound/pci/asihpi/hpimsginit.h
@@ -1,7 +1,7 @@
1/****************************************************************************** 1/******************************************************************************
2 2
3 AudioScience HPI driver 3 AudioScience HPI driver
4 Copyright (C) 1997-2010 AudioScience Inc. <support@audioscience.com> 4 Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of version 2 of the GNU General Public License as 7 it under the terms of version 2 of the GNU General Public License as
diff --git a/sound/pci/asihpi/hpimsgx.c b/sound/pci/asihpi/hpimsgx.c
index 2e779421a61..d4790ddc225 100644
--- a/sound/pci/asihpi/hpimsgx.c
+++ b/sound/pci/asihpi/hpimsgx.c
@@ -1,7 +1,7 @@
1/****************************************************************************** 1/******************************************************************************
2 2
3 AudioScience HPI driver 3 AudioScience HPI driver
4 Copyright (C) 1997-2010 AudioScience Inc. <support@audioscience.com> 4 Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of version 2 of the GNU General Public License as 7 it under the terms of version 2 of the GNU General Public License as
@@ -22,6 +22,7 @@ Extended Message Function With Response Caching
22*****************************************************************************/ 22*****************************************************************************/
23#define SOURCEFILE_NAME "hpimsgx.c" 23#define SOURCEFILE_NAME "hpimsgx.c"
24#include "hpi_internal.h" 24#include "hpi_internal.h"
25#include "hpi_version.h"
25#include "hpimsginit.h" 26#include "hpimsginit.h"
26#include "hpicmn.h" 27#include "hpicmn.h"
27#include "hpimsgx.h" 28#include "hpimsgx.h"
diff --git a/sound/pci/asihpi/hpimsgx.h b/sound/pci/asihpi/hpimsgx.h
index fd49e7542a8..37f3efd95a7 100644
--- a/sound/pci/asihpi/hpimsgx.h
+++ b/sound/pci/asihpi/hpimsgx.h
@@ -1,7 +1,7 @@
1/****************************************************************************** 1/******************************************************************************
2 2
3 AudioScience HPI driver 3 AudioScience HPI driver
4 Copyright (C) 1997-2010 AudioScience Inc. <support@audioscience.com> 4 Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of version 2 of the GNU General Public License as 7 it under the terms of version 2 of the GNU General Public License as
diff --git a/sound/pci/asihpi/hpioctl.c b/sound/pci/asihpi/hpioctl.c
index f6b9517b469..60915620556 100644
--- a/sound/pci/asihpi/hpioctl.c
+++ b/sound/pci/asihpi/hpioctl.c
@@ -21,6 +21,7 @@ Common Linux HPI ioctl and module probe/remove functions
21#define SOURCEFILE_NAME "hpioctl.c" 21#define SOURCEFILE_NAME "hpioctl.c"
22 22
23#include "hpi_internal.h" 23#include "hpi_internal.h"
24#include "hpi_version.h"
24#include "hpimsginit.h" 25#include "hpimsginit.h"
25#include "hpidebug.h" 26#include "hpidebug.h"
26#include "hpimsgx.h" 27#include "hpimsgx.h"
@@ -65,9 +66,7 @@ static struct hpi_adapter adapters[HPI_MAX_ADAPTERS];
65static void hpi_send_recv_f(struct hpi_message *phm, struct hpi_response *phr, 66static void hpi_send_recv_f(struct hpi_message *phm, struct hpi_response *phr,
66 struct file *file) 67 struct file *file)
67{ 68{
68 int adapter = phm->adapter_index; 69 if ((phm->adapter_index >= HPI_MAX_ADAPTERS)
69
70 if ((adapter >= HPI_MAX_ADAPTERS || adapter < 0)
71 && (phm->object != HPI_OBJ_SUBSYSTEM)) 70 && (phm->object != HPI_OBJ_SUBSYSTEM))
72 phr->error = HPI_ERROR_INVALID_OBJ_INDEX; 71 phr->error = HPI_ERROR_INVALID_OBJ_INDEX;
73 else 72 else
@@ -178,19 +177,14 @@ long asihpi_hpi_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
178 } else { 177 } else {
179 u16 __user *ptr = NULL; 178 u16 __user *ptr = NULL;
180 u32 size = 0; 179 u32 size = 0;
181 u32 adapter_present;
182 /* -1=no data 0=read from user mem, 1=write to user mem */ 180 /* -1=no data 0=read from user mem, 1=write to user mem */
183 int wrflag = -1; 181 int wrflag = -1;
184 struct hpi_adapter *pa; 182 struct hpi_adapter *pa = NULL;
185 183
186 if (hm->h.adapter_index < HPI_MAX_ADAPTERS) { 184 if (hm->h.adapter_index < ARRAY_SIZE(adapters))
187 pa = &adapters[hm->h.adapter_index]; 185 pa = &adapters[hm->h.adapter_index];
188 adapter_present = pa->type;
189 } else {
190 adapter_present = 0;
191 }
192 186
193 if (!adapter_present) { 187 if (!pa || !pa->adapter || !pa->adapter->type) {
194 hpi_init_response(&hr->r0, hm->h.object, 188 hpi_init_response(&hr->r0, hm->h.object,
195 hm->h.function, HPI_ERROR_BAD_ADAPTER_NUMBER); 189 hm->h.function, HPI_ERROR_BAD_ADAPTER_NUMBER);
196 190
@@ -317,6 +311,7 @@ int __devinit asihpi_adapter_probe(struct pci_dev *pci_dev,
317 const struct pci_device_id *pci_id) 311 const struct pci_device_id *pci_id)
318{ 312{
319 int idx, nm; 313 int idx, nm;
314 int adapter_index;
320 unsigned int memlen; 315 unsigned int memlen;
321 struct hpi_message hm; 316 struct hpi_message hm;
322 struct hpi_response hr; 317 struct hpi_response hr;
@@ -345,8 +340,6 @@ int __devinit asihpi_adapter_probe(struct pci_dev *pci_dev,
345 340
346 hm.adapter_index = HPI_ADAPTER_INDEX_INVALID; 341 hm.adapter_index = HPI_ADAPTER_INDEX_INVALID;
347 342
348 adapter.pci = pci_dev;
349
350 nm = HPI_MAX_ADAPTER_MEM_SPACES; 343 nm = HPI_MAX_ADAPTER_MEM_SPACES;
351 344
352 for (idx = 0; idx < nm; idx++) { 345 for (idx = 0; idx < nm; idx++) {
@@ -355,18 +348,16 @@ int __devinit asihpi_adapter_probe(struct pci_dev *pci_dev,
355 348
356 if (pci_resource_flags(pci_dev, idx) & IORESOURCE_MEM) { 349 if (pci_resource_flags(pci_dev, idx) & IORESOURCE_MEM) {
357 memlen = pci_resource_len(pci_dev, idx); 350 memlen = pci_resource_len(pci_dev, idx);
358 adapter.ap_remapped_mem_base[idx] = 351 pci.ap_mem_base[idx] =
359 ioremap(pci_resource_start(pci_dev, idx), 352 ioremap(pci_resource_start(pci_dev, idx),
360 memlen); 353 memlen);
361 if (!adapter.ap_remapped_mem_base[idx]) { 354 if (!pci.ap_mem_base[idx]) {
362 HPI_DEBUG_LOG(ERROR, 355 HPI_DEBUG_LOG(ERROR,
363 "ioremap failed, aborting\n"); 356 "ioremap failed, aborting\n");
364 /* unmap previously mapped pci mem space */ 357 /* unmap previously mapped pci mem space */
365 goto err; 358 goto err;
366 } 359 }
367 } 360 }
368
369 pci.ap_mem_base[idx] = adapter.ap_remapped_mem_base[idx];
370 } 361 }
371 362
372 pci.pci_dev = pci_dev; 363 pci.pci_dev = pci_dev;
@@ -378,6 +369,9 @@ int __devinit asihpi_adapter_probe(struct pci_dev *pci_dev,
378 if (hr.error) 369 if (hr.error)
379 goto err; 370 goto err;
380 371
372 adapter_index = hr.u.s.adapter_index;
373 adapter.adapter = hpi_find_adapter(adapter_index);
374
381 if (prealloc_stream_buf) { 375 if (prealloc_stream_buf) {
382 adapter.p_buffer = vmalloc(prealloc_stream_buf); 376 adapter.p_buffer = vmalloc(prealloc_stream_buf);
383 if (!adapter.p_buffer) { 377 if (!adapter.p_buffer) {
@@ -389,36 +383,32 @@ int __devinit asihpi_adapter_probe(struct pci_dev *pci_dev,
389 } 383 }
390 } 384 }
391 385
392 adapter.index = hr.u.s.adapter_index;
393 adapter.type = hr.u.s.adapter_type;
394
395 hpi_init_message_response(&hm, &hr, HPI_OBJ_ADAPTER, 386 hpi_init_message_response(&hm, &hr, HPI_OBJ_ADAPTER,
396 HPI_ADAPTER_OPEN); 387 HPI_ADAPTER_OPEN);
397 hm.adapter_index = adapter.index; 388 hm.adapter_index = adapter.adapter->index;
398 hpi_send_recv_ex(&hm, &hr, HOWNER_KERNEL); 389 hpi_send_recv_ex(&hm, &hr, HOWNER_KERNEL);
399 390
400 if (hr.error) 391 if (hr.error)
401 goto err; 392 goto err;
402 393
403 adapter.snd_card_asihpi = NULL;
404 /* WARNING can't init mutex in 'adapter' 394 /* WARNING can't init mutex in 'adapter'
405 * and then copy it to adapters[] ?!?! 395 * and then copy it to adapters[] ?!?!
406 */ 396 */
407 adapters[adapter.index] = adapter; 397 adapters[adapter_index] = adapter;
408 mutex_init(&adapters[adapter.index].mutex); 398 mutex_init(&adapters[adapter_index].mutex);
409 pci_set_drvdata(pci_dev, &adapters[adapter.index]); 399 pci_set_drvdata(pci_dev, &adapters[adapter_index]);
410 400
411 dev_printk(KERN_INFO, &pci_dev->dev, 401 dev_printk(KERN_INFO, &pci_dev->dev,
412 "probe succeeded for ASI%04X HPI index %d\n", adapter.type, 402 "probe succeeded for ASI%04X HPI index %d\n",
413 adapter.index); 403 adapter.adapter->type, adapter_index);
414 404
415 return 0; 405 return 0;
416 406
417err: 407err:
418 for (idx = 0; idx < HPI_MAX_ADAPTER_MEM_SPACES; idx++) { 408 for (idx = 0; idx < HPI_MAX_ADAPTER_MEM_SPACES; idx++) {
419 if (adapter.ap_remapped_mem_base[idx]) { 409 if (pci.ap_mem_base[idx]) {
420 iounmap(adapter.ap_remapped_mem_base[idx]); 410 iounmap(pci.ap_mem_base[idx]);
421 adapter.ap_remapped_mem_base[idx] = NULL; 411 pci.ap_mem_base[idx] = NULL;
422 } 412 }
423 } 413 }
424 414
@@ -437,19 +427,20 @@ void __devexit asihpi_adapter_remove(struct pci_dev *pci_dev)
437 struct hpi_message hm; 427 struct hpi_message hm;
438 struct hpi_response hr; 428 struct hpi_response hr;
439 struct hpi_adapter *pa; 429 struct hpi_adapter *pa;
430 struct hpi_pci pci;
431
440 pa = pci_get_drvdata(pci_dev); 432 pa = pci_get_drvdata(pci_dev);
433 pci = pa->adapter->pci;
441 434
442 hpi_init_message_response(&hm, &hr, HPI_OBJ_ADAPTER, 435 hpi_init_message_response(&hm, &hr, HPI_OBJ_ADAPTER,
443 HPI_ADAPTER_DELETE); 436 HPI_ADAPTER_DELETE);
444 hm.adapter_index = pa->index; 437 hm.adapter_index = pa->adapter->index;
445 hpi_send_recv_ex(&hm, &hr, HOWNER_KERNEL); 438 hpi_send_recv_ex(&hm, &hr, HOWNER_KERNEL);
446 439
447 /* unmap PCI memory space, mapped during device init. */ 440 /* unmap PCI memory space, mapped during device init. */
448 for (idx = 0; idx < HPI_MAX_ADAPTER_MEM_SPACES; idx++) { 441 for (idx = 0; idx < HPI_MAX_ADAPTER_MEM_SPACES; idx++) {
449 if (pa->ap_remapped_mem_base[idx]) { 442 if (pci.ap_mem_base[idx])
450 iounmap(pa->ap_remapped_mem_base[idx]); 443 iounmap(pci.ap_mem_base[idx]);
451 pa->ap_remapped_mem_base[idx] = NULL;
452 }
453 } 444 }
454 445
455 if (pa->p_buffer) 446 if (pa->p_buffer)
@@ -461,7 +452,7 @@ void __devexit asihpi_adapter_remove(struct pci_dev *pci_dev)
461 "remove %04x:%04x,%04x:%04x,%04x," " HPI index %d.\n", 452 "remove %04x:%04x,%04x:%04x,%04x," " HPI index %d.\n",
462 pci_dev->vendor, pci_dev->device, 453 pci_dev->vendor, pci_dev->device,
463 pci_dev->subsystem_vendor, pci_dev->subsystem_device, 454 pci_dev->subsystem_vendor, pci_dev->subsystem_device,
464 pci_dev->devfn, pa->index); 455 pci_dev->devfn, pa->adapter->index);
465 456
466 memset(pa, 0, sizeof(*pa)); 457 memset(pa, 0, sizeof(*pa));
467} 458}
diff --git a/sound/pci/asihpi/hpioctl.h b/sound/pci/asihpi/hpioctl.h
index 847f72f03fe..2614aff672e 100644
--- a/sound/pci/asihpi/hpioctl.h
+++ b/sound/pci/asihpi/hpioctl.h
@@ -1,7 +1,7 @@
1/******************************************************************************* 1/*******************************************************************************
2 2
3 AudioScience HPI driver 3 AudioScience HPI driver
4 Copyright (C) 1997-2010 AudioScience Inc. <support@audioscience.com> 4 Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of version 2 of the GNU General Public License as 7 it under the terms of version 2 of the GNU General Public License as
diff --git a/sound/pci/asihpi/hpios.c b/sound/pci/asihpi/hpios.c
index ff2a19b544f..2d7d1c2e1d0 100644
--- a/sound/pci/asihpi/hpios.c
+++ b/sound/pci/asihpi/hpios.c
@@ -1,7 +1,7 @@
1/****************************************************************************** 1/******************************************************************************
2 2
3 AudioScience HPI driver 3 AudioScience HPI driver
4 Copyright (C) 1997-2010 AudioScience Inc. <support@audioscience.com> 4 Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of version 2 of the GNU General Public License as 7 it under the terms of version 2 of the GNU General Public License as
diff --git a/sound/pci/asihpi/hpios.h b/sound/pci/asihpi/hpios.h
index 2f605e34bad..c5cef113c20 100644
--- a/sound/pci/asihpi/hpios.h
+++ b/sound/pci/asihpi/hpios.h
@@ -1,7 +1,7 @@
1/****************************************************************************** 1/******************************************************************************
2 2
3 AudioScience HPI driver 3 AudioScience HPI driver
4 Copyright (C) 1997-2010 AudioScience Inc. <support@audioscience.com> 4 Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of version 2 of the GNU General Public License as 7 it under the terms of version 2 of the GNU General Public License as
@@ -149,20 +149,18 @@ static inline void cond_unlock(struct hpios_spinlock *l)
149#define hpios_alistlock_lock(obj) spin_lock(&((obj)->list_lock.lock)) 149#define hpios_alistlock_lock(obj) spin_lock(&((obj)->list_lock.lock))
150#define hpios_alistlock_unlock(obj) spin_unlock(&((obj)->list_lock.lock)) 150#define hpios_alistlock_unlock(obj) spin_unlock(&((obj)->list_lock.lock))
151 151
152struct snd_card;
153
154/** pci drvdata points to an instance of this struct */
152struct hpi_adapter { 155struct hpi_adapter {
156 struct hpi_adapter_obj *adapter;
157 struct snd_card *snd_card;
158
153 /* mutex prevents contention for one card 159 /* mutex prevents contention for one card
154 between multiple user programs (via ioctl) */ 160 between multiple user programs (via ioctl) */
155 struct mutex mutex; 161 struct mutex mutex;
156 u16 index;
157 u16 type;
158
159 /* ALSA card structure */
160 void *snd_card_asihpi;
161
162 char *p_buffer; 162 char *p_buffer;
163 size_t buffer_size; 163 size_t buffer_size;
164 struct pci_dev *pci;
165 void __iomem *ap_remapped_mem_base[HPI_MAX_ADAPTER_MEM_SPACES];
166}; 164};
167 165
168#endif 166#endif
diff --git a/sound/pci/asihpi/hpipcida.h b/sound/pci/asihpi/hpipcida.h
index bb30868ce1a..db570ddf64b 100644
--- a/sound/pci/asihpi/hpipcida.h
+++ b/sound/pci/asihpi/hpipcida.h
@@ -1,7 +1,7 @@
1/****************************************************************************** 1/******************************************************************************
2 2
3 AudioScience HPI driver 3 AudioScience HPI driver
4 Copyright (C) 1997-2010 AudioScience Inc. <support@audioscience.com> 4 Copyright (C) 1997-2011 AudioScience Inc. <support@audioscience.com>
5 5
6 This program is free software; you can redistribute it and/or modify 6 This program is free software; you can redistribute it and/or modify
7 it under the terms of version 2 of the GNU General Public License as 7 it under the terms of version 2 of the GNU General Public License as
diff --git a/sound/pci/atiixp.c b/sound/pci/atiixp.c
index 15e4e5ee388..590682f115e 100644
--- a/sound/pci/atiixp.c
+++ b/sound/pci/atiixp.c
@@ -43,7 +43,7 @@ static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */
43static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ 43static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */
44static int ac97_clock = 48000; 44static int ac97_clock = 48000;
45static char *ac97_quirk; 45static char *ac97_quirk;
46static int spdif_aclink = 1; 46static bool spdif_aclink = 1;
47static int ac97_codec = -1; 47static int ac97_codec = -1;
48 48
49module_param(index, int, 0444); 49module_param(index, int, 0444);
@@ -60,7 +60,7 @@ module_param(spdif_aclink, bool, 0444);
60MODULE_PARM_DESC(spdif_aclink, "S/PDIF over AC-link."); 60MODULE_PARM_DESC(spdif_aclink, "S/PDIF over AC-link.");
61 61
62/* just for backward compatibility */ 62/* just for backward compatibility */
63static int enable; 63static bool enable;
64module_param(enable, bool, 0444); 64module_param(enable, bool, 0444);
65 65
66 66
diff --git a/sound/pci/atiixp_modem.c b/sound/pci/atiixp_modem.c
index 57bf8f4bc7a..524d35f3123 100644
--- a/sound/pci/atiixp_modem.c
+++ b/sound/pci/atiixp_modem.c
@@ -51,7 +51,7 @@ module_param(ac97_clock, int, 0444);
51MODULE_PARM_DESC(ac97_clock, "AC'97 codec clock (default 48000Hz)."); 51MODULE_PARM_DESC(ac97_clock, "AC'97 codec clock (default 48000Hz).");
52 52
53/* just for backward compatibility */ 53/* just for backward compatibility */
54static int enable; 54static bool enable;
55module_param(enable, bool, 0444); 55module_param(enable, bool, 0444);
56 56
57 57
diff --git a/sound/pci/au88x0/au88x0.c b/sound/pci/au88x0/au88x0.c
index dc326be58c4..f13ad536b2d 100644
--- a/sound/pci/au88x0/au88x0.c
+++ b/sound/pci/au88x0/au88x0.c
@@ -26,7 +26,7 @@
26// module parameters (see "Module Parameters") 26// module parameters (see "Module Parameters")
27static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 27static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
28static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 28static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
29static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 29static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
30static int pcifix[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 255 }; 30static int pcifix[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 255 };
31 31
32module_param_array(index, int, NULL, 0444); 32module_param_array(index, int, NULL, 0444);
@@ -268,8 +268,14 @@ snd_vortex_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
268 card->shortname, chip->io, chip->irq); 268 card->shortname, chip->io, chip->irq);
269 269
270 // (4) Alloc components. 270 // (4) Alloc components.
271 err = snd_vortex_mixer(chip);
272 if (err < 0) {
273 snd_card_free(card);
274 return err;
275 }
271 // ADB pcm. 276 // ADB pcm.
272 if ((err = snd_vortex_new_pcm(chip, VORTEX_PCM_ADB, NR_ADB)) < 0) { 277 err = snd_vortex_new_pcm(chip, VORTEX_PCM_ADB, NR_PCM);
278 if (err < 0) {
273 snd_card_free(card); 279 snd_card_free(card);
274 return err; 280 return err;
275 } 281 }
@@ -299,11 +305,6 @@ snd_vortex_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
299 return err; 305 return err;
300 } 306 }
301#endif 307#endif
302 // snd_ac97_mixer and Vortex mixer.
303 if ((err = snd_vortex_mixer(chip)) < 0) {
304 snd_card_free(card);
305 return err;
306 }
307 if ((err = snd_vortex_midi(chip)) < 0) { 308 if ((err = snd_vortex_midi(chip)) < 0) {
308 snd_card_free(card); 309 snd_card_free(card);
309 return err; 310 return err;
diff --git a/sound/pci/au88x0/au88x0.h b/sound/pci/au88x0/au88x0.h
index 02f6e08f759..bb938153a96 100644
--- a/sound/pci/au88x0/au88x0.h
+++ b/sound/pci/au88x0/au88x0.h
@@ -105,6 +105,7 @@
105#define MIX_SPDIF(x) (vortex->mixspdif[x]) 105#define MIX_SPDIF(x) (vortex->mixspdif[x])
106 106
107#define NR_WTPB 0x20 /* WT channels per each bank. */ 107#define NR_WTPB 0x20 /* WT channels per each bank. */
108#define NR_PCM 0x10
108 109
109/* Structs */ 110/* Structs */
110typedef struct { 111typedef struct {
diff --git a/sound/pci/au88x0/au88x0_core.c b/sound/pci/au88x0/au88x0_core.c
index 489150380ea..6933a27a5d7 100644
--- a/sound/pci/au88x0/au88x0_core.c
+++ b/sound/pci/au88x0/au88x0_core.c
@@ -805,7 +805,7 @@ static void vortex_fifo_setadbvalid(vortex_t * vortex, int fifo, int en)
805} 805}
806 806
807static void 807static void
808vortex_fifo_setadbctrl(vortex_t * vortex, int fifo, int b, int priority, 808vortex_fifo_setadbctrl(vortex_t * vortex, int fifo, int stereo, int priority,
809 int empty, int valid, int f) 809 int empty, int valid, int f)
810{ 810{
811 int temp, lifeboat = 0; 811 int temp, lifeboat = 0;
@@ -837,7 +837,7 @@ vortex_fifo_setadbctrl(vortex_t * vortex, int fifo, int b, int priority,
837#else 837#else
838 temp = (this_4 & 0x3f) << 0xc; 838 temp = (this_4 & 0x3f) << 0xc;
839#endif 839#endif
840 temp = (temp & 0xfffffffd) | ((b & 1) << 1); 840 temp = (temp & 0xfffffffd) | ((stereo & 1) << 1);
841 temp = (temp & 0xfffffff3) | ((priority & 3) << 2); 841 temp = (temp & 0xfffffff3) | ((priority & 3) << 2);
842 temp = (temp & 0xffffffef) | ((valid & 1) << 4); 842 temp = (temp & 0xffffffef) | ((valid & 1) << 4);
843 temp |= FIFO_U1; 843 temp |= FIFO_U1;
@@ -1148,11 +1148,11 @@ vortex_adbdma_setbuffers(vortex_t * vortex, int adbdma,
1148 1148
1149static void 1149static void
1150vortex_adbdma_setmode(vortex_t * vortex, int adbdma, int ie, int dir, 1150vortex_adbdma_setmode(vortex_t * vortex, int adbdma, int ie, int dir,
1151 int fmt, int d, u32 offset) 1151 int fmt, int stereo, u32 offset)
1152{ 1152{
1153 stream_t *dma = &vortex->dma_adb[adbdma]; 1153 stream_t *dma = &vortex->dma_adb[adbdma];
1154 1154
1155 dma->dma_unknown = d; 1155 dma->dma_unknown = stereo;
1156 dma->dma_ctrl = 1156 dma->dma_ctrl =
1157 ((offset & OFFSET_MASK) | (dma->dma_ctrl & ~OFFSET_MASK)); 1157 ((offset & OFFSET_MASK) | (dma->dma_ctrl & ~OFFSET_MASK));
1158 /* Enable PCMOUT interrupts. */ 1158 /* Enable PCMOUT interrupts. */
@@ -1336,7 +1336,6 @@ static void vortex_adbdma_pausefifo(vortex_t * vortex, int adbdma)
1336 dma->fifo_status = FIFO_PAUSE; 1336 dma->fifo_status = FIFO_PAUSE;
1337} 1337}
1338 1338
1339#if 0 // Using pause instead
1340static void vortex_adbdma_stopfifo(vortex_t * vortex, int adbdma) 1339static void vortex_adbdma_stopfifo(vortex_t * vortex, int adbdma)
1341{ 1340{
1342 stream_t *dma = &vortex->dma_adb[adbdma]; 1341 stream_t *dma = &vortex->dma_adb[adbdma];
@@ -1351,7 +1350,6 @@ static void vortex_adbdma_stopfifo(vortex_t * vortex, int adbdma)
1351 dma->fifo_enabled = 0; 1350 dma->fifo_enabled = 0;
1352} 1351}
1353 1352
1354#endif
1355/* WTDMA */ 1353/* WTDMA */
1356 1354
1357#ifndef CHIP_AU8810 1355#ifndef CHIP_AU8810
diff --git a/sound/pci/au88x0/au88x0_pcm.c b/sound/pci/au88x0/au88x0_pcm.c
index c5f7ae46afe..0ef2f971220 100644
--- a/sound/pci/au88x0/au88x0_pcm.c
+++ b/sound/pci/au88x0/au88x0_pcm.c
@@ -168,6 +168,7 @@ static int snd_vortex_pcm_open(struct snd_pcm_substream *substream)
168 runtime->hw = snd_vortex_playback_hw_adb; 168 runtime->hw = snd_vortex_playback_hw_adb;
169#ifdef CHIP_AU8830 169#ifdef CHIP_AU8830
170 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK && 170 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK &&
171 VORTEX_IS_QUAD(vortex) &&
171 VORTEX_PCM_TYPE(substream->pcm) == VORTEX_PCM_ADB) { 172 VORTEX_PCM_TYPE(substream->pcm) == VORTEX_PCM_ADB) {
172 runtime->hw.channels_max = 4; 173 runtime->hw.channels_max = 4;
173 snd_pcm_hw_constraint_list(runtime, 0, 174 snd_pcm_hw_constraint_list(runtime, 0,
@@ -307,8 +308,8 @@ static int snd_vortex_pcm_prepare(struct snd_pcm_substream *substream)
307 fmt = vortex_alsafmt_aspfmt(runtime->format); 308 fmt = vortex_alsafmt_aspfmt(runtime->format);
308 spin_lock_irq(&chip->lock); 309 spin_lock_irq(&chip->lock);
309 if (VORTEX_PCM_TYPE(substream->pcm) != VORTEX_PCM_WT) { 310 if (VORTEX_PCM_TYPE(substream->pcm) != VORTEX_PCM_WT) {
310 vortex_adbdma_setmode(chip, dma, 1, dir, fmt, 0 /*? */ , 311 vortex_adbdma_setmode(chip, dma, 1, dir, fmt,
311 0); 312 runtime->channels == 1 ? 0 : 1, 0);
312 vortex_adbdma_setstartbuffer(chip, dma, 0); 313 vortex_adbdma_setstartbuffer(chip, dma, 0);
313 if (VORTEX_PCM_TYPE(substream->pcm) != VORTEX_PCM_SPDIF) 314 if (VORTEX_PCM_TYPE(substream->pcm) != VORTEX_PCM_SPDIF)
314 vortex_adb_setsrc(chip, dma, runtime->rate, dir); 315 vortex_adb_setsrc(chip, dma, runtime->rate, dir);
@@ -353,8 +354,7 @@ static int snd_vortex_pcm_trigger(struct snd_pcm_substream *substream, int cmd)
353 //printk(KERN_INFO "vortex: stop %d\n", dma); 354 //printk(KERN_INFO "vortex: stop %d\n", dma);
354 stream->fifo_enabled = 0; 355 stream->fifo_enabled = 0;
355 if (VORTEX_PCM_TYPE(substream->pcm) != VORTEX_PCM_WT) 356 if (VORTEX_PCM_TYPE(substream->pcm) != VORTEX_PCM_WT)
356 vortex_adbdma_pausefifo(chip, dma); 357 vortex_adbdma_stopfifo(chip, dma);
357 //vortex_adbdma_stopfifo(chip, dma);
358#ifndef CHIP_AU8810 358#ifndef CHIP_AU8810
359 else { 359 else {
360 printk(KERN_INFO "vortex: wt stop %d\n", dma); 360 printk(KERN_INFO "vortex: wt stop %d\n", dma);
diff --git a/sound/pci/au88x0/au88x0_xtalk.c b/sound/pci/au88x0/au88x0_xtalk.c
index b4151e208b7..b278e285fd4 100644
--- a/sound/pci/au88x0/au88x0_xtalk.c
+++ b/sound/pci/au88x0/au88x0_xtalk.c
@@ -48,43 +48,61 @@ static unsigned short const wXtalkNarrowLeftDelay = 0x7;
48static unsigned short const wXtalkNarrowRightDelay = 0x7; 48static unsigned short const wXtalkNarrowRightDelay = 0x7;
49 49
50static xtalk_gains_t const asXtalkGainsDefault = { 50static xtalk_gains_t const asXtalkGainsDefault = {
51 0x4000, 0x4000, 4000, 0x4000, 4000, 0x4000, 4000, 0x4000, 4000, 51 0x4000, 0x4000, 0x4000, 0x4000, 0x4000,
52 0x4000 52 0x4000, 0x4000, 0x4000, 0x4000, 0x4000
53}; 53};
54 54
55static xtalk_gains_t const asXtalkGainsTest = { 55static xtalk_gains_t const asXtalkGainsTest = {
56 0x8000, 0x7FFF, 0, 0xFFFF, 0x0001, 0xC000, 0x4000, 0xFFFE, 0x0002, 56 0x7fff, 0x8000, 0x0000, 0x0000, 0x0001,
57 0 57 0xffff, 0x4000, 0xc000, 0x0002, 0xfffe
58}; 58};
59
59static xtalk_gains_t const asXtalkGains1Chan = { 60static xtalk_gains_t const asXtalkGains1Chan = {
60 0x7FFF, 0, 0, 0, 0x7FFF, 0, 0, 0, 0, 0 61 0x7FFF, 0, 0, 0, 0,
62 0x7FFF, 0, 0, 0, 0,
61}; 63};
62 64
63// Input gain for 4 A3D slices. One possible input pair is left zero. 65// Input gain for 4 A3D slices. One possible input pair is left zero.
64static xtalk_gains_t const asXtalkGainsAllChan = { 66static xtalk_gains_t const asXtalkGainsAllChan = {
65 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0, 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 67 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0,
66 0 68 0x7FFF, 0x7FFF, 0x7FFF, 0x7FFF, 0
67 //0x7FFF,0x7FFF,0x7FFF,0x7FFF,0x7fff,0x7FFF,0x7FFF,0x7FFF,0x7FFF,0x7fff 69};
70
71static xtalk_gains_t const asXtalkGainsZeros = {
72 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
68}; 73};
69static xtalk_gains_t const asXtalkGainsZeros;
70 74
71static xtalk_dline_t const alXtalkDlineZeros; 75static xtalk_dline_t const alXtalkDlineZeros = {
76 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
77 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
78};
72static xtalk_dline_t const alXtalkDlineTest = { 79static xtalk_dline_t const alXtalkDlineTest = {
73 0xFC18, 0x03E8FFFF, 0x186A0, 0x7960FFFE, 1, 0xFFFFFFFF, 80 0x0000fc18, 0xfff03e8, 0x000186a0, 0xfffe7960, 1, 0xffffffff, 0, 0,
74 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 81 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
82 0, 0, 0, 0, 0, 0, 0, 0
83};
84
85static xtalk_instate_t const asXtalkInStateZeros = {
75 0, 0, 0, 0 86 0, 0, 0, 0
76}; 87};
77 88
78static xtalk_instate_t const asXtalkInStateZeros; 89static xtalk_instate_t const asXtalkInStateTest = {
79static xtalk_instate_t const asXtalkInStateTest = 90 0x0080, 0xff80, 0x0001, 0xffff
80 { 0xFF80, 0x0080, 0xFFFF, 0x0001 }; 91};
81static xtalk_state_t const asXtalkOutStateZeros; 92
93static xtalk_state_t const asXtalkOutStateZeros = {
94 {0, 0, 0, 0},
95 {0, 0, 0, 0},
96 {0, 0, 0, 0},
97 {0, 0, 0, 0},
98 {0, 0, 0, 0}
99};
82 100
83static short const sDiamondKLeftEq = 0x401d; 101static short const sDiamondKLeftEq = 0x401d;
84static short const sDiamondKRightEq = 0x401d; 102static short const sDiamondKRightEq = 0x401d;
85static short const sDiamondKLeftXt = 0xF90E; 103static short const sDiamondKLeftXt = 0xF90E;
86static short const sDiamondKRightXt = 0xF90E; 104static short const sDiamondKRightXt = 0xF90E;
87static short const sDiamondShiftLeftEq = 1; /* 0xF90E Is this a bug ??? */ 105static short const sDiamondShiftLeftEq = 1;
88static short const sDiamondShiftRightEq = 1; 106static short const sDiamondShiftRightEq = 1;
89static short const sDiamondShiftLeftXt = 0; 107static short const sDiamondShiftLeftXt = 0;
90static short const sDiamondShiftRightXt = 0; 108static short const sDiamondShiftRightXt = 0;
@@ -94,29 +112,29 @@ static unsigned short const wDiamondRightDelay = 0xb;
94static xtalk_coefs_t const asXtalkWideCoefsLeftEq = { 112static xtalk_coefs_t const asXtalkWideCoefsLeftEq = {
95 {0xEC4C, 0xDCE9, 0xFDC2, 0xFEEC, 0}, 113 {0xEC4C, 0xDCE9, 0xFDC2, 0xFEEC, 0},
96 {0x5F60, 0xCBCB, 0xFC26, 0x0305, 0}, 114 {0x5F60, 0xCBCB, 0xFC26, 0x0305, 0},
97 {0x340B, 0xf504, 0x6CE8, 0x0D23, 0x00E4}, 115 {0x340B, 0xe8f5, 0x236c, 0xe40d, 0},
98 {0xD500, 0x8D76, 0xACC7, 0x5B05, 0x00FA}, 116 {0x76d5, 0xc78d, 0x05ac, 0xfa5b, 0},
99 {0x7F04, 0xC0FA, 0x0263, 0xFDA2, 0} 117 {0x7F04, 0xC0FA, 0x0263, 0xFDA2, 0}
100}; 118};
101static xtalk_coefs_t const asXtalkWideCoefsRightEq = { 119static xtalk_coefs_t const asXtalkWideCoefsRightEq = {
102 {0xEC4C, 0xDCE9, 0xFDC2, 0xFEEC, 0}, 120 {0xEC4C, 0xDCE9, 0xFDC2, 0xFEEC, 0},
103 {0x5F60, 0xCBCB, 0xFC26, 0x0305, 0}, 121 {0x5F60, 0xCBCB, 0xFC26, 0x0305, 0},
104 {0x340B, 0xF504, 0x6CE8, 0x0D23, 0x00E4}, 122 {0x340B, 0xe8f5, 0x236c, 0xe40d, 0},
105 {0xD500, 0x8D76, 0xACC7, 0x5B05, 0x00FA}, 123 {0x76d5, 0xc78d, 0x05ac, 0xfa5b, 0},
106 {0x7F04, 0xC0FA, 0x0263, 0xFDA2, 0} 124 {0x7F04, 0xC0FA, 0x0263, 0xFDA2, 0}
107}; 125};
108static xtalk_coefs_t const asXtalkWideCoefsLeftXt = { 126static xtalk_coefs_t const asXtalkWideCoefsLeftXt = {
109 {0x86C3, 0x7B55, 0x89C3, 0x005B, 0x0047}, 127 {0x55c6, 0xc97b, 0x005b, 0x0047, 0},
110 {0x6000, 0x206A, 0xC6CA, 0x40FF, 0}, 128 {0x6a60, 0xca20, 0xffc6, 0x0040, 0},
111 {0x1100, 0x1164, 0xA1D7, 0x90FC, 0x0001}, 129 {0x6411, 0xd711, 0xfca1, 0x0190, 0},
112 {0xDC00, 0x9E77, 0xB8C7, 0x0AFF, 0}, 130 {0x77dc, 0xc79e, 0xffb8, 0x000a, 0},
113 {0, 0, 0, 0, 0} 131 {0, 0, 0, 0, 0}
114}; 132};
115static xtalk_coefs_t const asXtalkWideCoefsRightXt = { 133static xtalk_coefs_t const asXtalkWideCoefsRightXt = {
116 {0x86C3, 0x7B55, 0x89C3, 0x005B, 0x0047}, 134 {0x55c6, 0xc97b, 0x005b, 0x0047, 0},
117 {0x6000, 0x206A, 0xC6CA, 0x40FF, 0}, 135 {0x6a60, 0xca20, 0xffc6, 0x0040, 0},
118 {0x1100, 0x1164, 0xA1D7, 0x90FC, 0x0001}, 136 {0x6411, 0xd711, 0xfca1, 0x0190, 0},
119 {0xDC00, 0x9E77, 0xB8C7, 0x0AFF, 0}, 137 {0x77dc, 0xc79e, 0xffb8, 0x000a, 0},
120 {0, 0, 0, 0, 0} 138 {0, 0, 0, 0, 0}
121}; 139};
122static xtalk_coefs_t const asXtalkNarrowCoefsLeftEq = { 140static xtalk_coefs_t const asXtalkNarrowCoefsLeftEq = {
@@ -151,7 +169,14 @@ static xtalk_coefs_t const asXtalkNarrowCoefsRightXt = {
151 {0, 0, 0, 0, 0} 169 {0, 0, 0, 0, 0}
152}; 170};
153 171
154static xtalk_coefs_t const asXtalkCoefsZeros; 172static xtalk_coefs_t const asXtalkCoefsZeros = {
173 {0, 0, 0, 0, 0},
174 {0, 0, 0, 0, 0},
175 {0, 0, 0, 0, 0},
176 {0, 0, 0, 0, 0},
177 {0, 0, 0, 0, 0}
178};
179
155static xtalk_coefs_t const asXtalkCoefsPipe = { 180static xtalk_coefs_t const asXtalkCoefsPipe = {
156 {0, 0, 0x0FA0, 0, 0}, 181 {0, 0, 0x0FA0, 0, 0},
157 {0, 0, 0x0FA0, 0, 0}, 182 {0, 0, 0x0FA0, 0, 0},
@@ -186,7 +211,7 @@ static xtalk_coefs_t const asXtalkCoefsDenTest = {
186static xtalk_state_t const asXtalkOutStateTest = { 211static xtalk_state_t const asXtalkOutStateTest = {
187 {0x7FFF, 0x0004, 0xFFFC, 0}, 212 {0x7FFF, 0x0004, 0xFFFC, 0},
188 {0xFE00, 0x0008, 0xFFF8, 0x4000}, 213 {0xFE00, 0x0008, 0xFFF8, 0x4000},
189 {0x200, 0x0010, 0xFFF0, 0xC000}, 214 {0x0200, 0x0010, 0xFFF0, 0xC000},
190 {0x8000, 0x0020, 0xFFE0, 0}, 215 {0x8000, 0x0020, 0xFFE0, 0},
191 {0, 0, 0, 0} 216 {0, 0, 0, 0}
192}; 217};
@@ -306,10 +331,10 @@ vortex_XtalkHw_SetLeftEQStates(vortex_t * vortex,
306 hwwrite(vortex->mmio, 0x2421C + i * 0x24, coefs[i][2]); 331 hwwrite(vortex->mmio, 0x2421C + i * 0x24, coefs[i][2]);
307 hwwrite(vortex->mmio, 0x24220 + i * 0x24, coefs[i][3]); 332 hwwrite(vortex->mmio, 0x24220 + i * 0x24, coefs[i][3]);
308 } 333 }
309 hwwrite(vortex->mmio, 0x244F8 + i * 0x24, arg_0[0]); 334 hwwrite(vortex->mmio, 0x244F8, arg_0[0]);
310 hwwrite(vortex->mmio, 0x244FC + i * 0x24, arg_0[1]); 335 hwwrite(vortex->mmio, 0x244FC, arg_0[1]);
311 hwwrite(vortex->mmio, 0x24500 + i * 0x24, arg_0[2]); 336 hwwrite(vortex->mmio, 0x24500, arg_0[2]);
312 hwwrite(vortex->mmio, 0x24504 + i * 0x24, arg_0[3]); 337 hwwrite(vortex->mmio, 0x24504, arg_0[3]);
313} 338}
314 339
315static void 340static void
@@ -325,10 +350,10 @@ vortex_XtalkHw_SetRightEQStates(vortex_t * vortex,
325 hwwrite(vortex->mmio, 0x242D0 + i * 0x24, coefs[i][2]); 350 hwwrite(vortex->mmio, 0x242D0 + i * 0x24, coefs[i][2]);
326 hwwrite(vortex->mmio, 0x244D4 + i * 0x24, coefs[i][3]); 351 hwwrite(vortex->mmio, 0x244D4 + i * 0x24, coefs[i][3]);
327 } 352 }
328 hwwrite(vortex->mmio, 0x24508 + i * 0x24, arg_0[0]); 353 hwwrite(vortex->mmio, 0x24508, arg_0[0]);
329 hwwrite(vortex->mmio, 0x2450C + i * 0x24, arg_0[1]); 354 hwwrite(vortex->mmio, 0x2450C, arg_0[1]);
330 hwwrite(vortex->mmio, 0x24510 + i * 0x24, arg_0[2]); 355 hwwrite(vortex->mmio, 0x24510, arg_0[2]);
331 hwwrite(vortex->mmio, 0x24514 + i * 0x24, arg_0[3]); 356 hwwrite(vortex->mmio, 0x24514, arg_0[3]);
332} 357}
333 358
334static void 359static void
@@ -344,10 +369,10 @@ vortex_XtalkHw_SetLeftXTStates(vortex_t * vortex,
344 hwwrite(vortex->mmio, 0x24384 + i * 0x24, coefs[i][2]); 369 hwwrite(vortex->mmio, 0x24384 + i * 0x24, coefs[i][2]);
345 hwwrite(vortex->mmio, 0x24388 + i * 0x24, coefs[i][3]); 370 hwwrite(vortex->mmio, 0x24388 + i * 0x24, coefs[i][3]);
346 } 371 }
347 hwwrite(vortex->mmio, 0x24518 + i * 0x24, arg_0[0]); 372 hwwrite(vortex->mmio, 0x24518, arg_0[0]);
348 hwwrite(vortex->mmio, 0x2451C + i * 0x24, arg_0[1]); 373 hwwrite(vortex->mmio, 0x2451C, arg_0[1]);
349 hwwrite(vortex->mmio, 0x24520 + i * 0x24, arg_0[2]); 374 hwwrite(vortex->mmio, 0x24520, arg_0[2]);
350 hwwrite(vortex->mmio, 0x24524 + i * 0x24, arg_0[3]); 375 hwwrite(vortex->mmio, 0x24524, arg_0[3]);
351} 376}
352 377
353static void 378static void
@@ -363,10 +388,10 @@ vortex_XtalkHw_SetRightXTStates(vortex_t * vortex,
363 hwwrite(vortex->mmio, 0x24438 + i * 0x24, coefs[i][2]); 388 hwwrite(vortex->mmio, 0x24438 + i * 0x24, coefs[i][2]);
364 hwwrite(vortex->mmio, 0x2443C + i * 0x24, coefs[i][3]); 389 hwwrite(vortex->mmio, 0x2443C + i * 0x24, coefs[i][3]);
365 } 390 }
366 hwwrite(vortex->mmio, 0x24528 + i * 0x24, arg_0[0]); 391 hwwrite(vortex->mmio, 0x24528, arg_0[0]);
367 hwwrite(vortex->mmio, 0x2452C + i * 0x24, arg_0[1]); 392 hwwrite(vortex->mmio, 0x2452C, arg_0[1]);
368 hwwrite(vortex->mmio, 0x24530 + i * 0x24, arg_0[2]); 393 hwwrite(vortex->mmio, 0x24530, arg_0[2]);
369 hwwrite(vortex->mmio, 0x24534 + i * 0x24, arg_0[3]); 394 hwwrite(vortex->mmio, 0x24534, arg_0[3]);
370} 395}
371 396
372#if 0 397#if 0
@@ -450,10 +475,10 @@ vortex_XtalkHw_GetLeftEQStates(vortex_t * vortex, xtalk_instate_t arg_0,
450 coefs[i][2] = hwread(vortex->mmio, 0x2421C + i * 0x24); 475 coefs[i][2] = hwread(vortex->mmio, 0x2421C + i * 0x24);
451 coefs[i][3] = hwread(vortex->mmio, 0x24220 + i * 0x24); 476 coefs[i][3] = hwread(vortex->mmio, 0x24220 + i * 0x24);
452 } 477 }
453 arg_0[0] = hwread(vortex->mmio, 0x244F8 + i * 0x24); 478 arg_0[0] = hwread(vortex->mmio, 0x244F8);
454 arg_0[1] = hwread(vortex->mmio, 0x244FC + i * 0x24); 479 arg_0[1] = hwread(vortex->mmio, 0x244FC);
455 arg_0[2] = hwread(vortex->mmio, 0x24500 + i * 0x24); 480 arg_0[2] = hwread(vortex->mmio, 0x24500);
456 arg_0[3] = hwread(vortex->mmio, 0x24504 + i * 0x24); 481 arg_0[3] = hwread(vortex->mmio, 0x24504);
457} 482}
458 483
459static void 484static void
@@ -468,10 +493,10 @@ vortex_XtalkHw_GetRightEQStates(vortex_t * vortex, xtalk_instate_t arg_0,
468 coefs[i][2] = hwread(vortex->mmio, 0x242D0 + i * 0x24); 493 coefs[i][2] = hwread(vortex->mmio, 0x242D0 + i * 0x24);
469 coefs[i][3] = hwread(vortex->mmio, 0x242D4 + i * 0x24); 494 coefs[i][3] = hwread(vortex->mmio, 0x242D4 + i * 0x24);
470 } 495 }
471 arg_0[0] = hwread(vortex->mmio, 0x24508 + i * 0x24); 496 arg_0[0] = hwread(vortex->mmio, 0x24508);
472 arg_0[1] = hwread(vortex->mmio, 0x2450C + i * 0x24); 497 arg_0[1] = hwread(vortex->mmio, 0x2450C);
473 arg_0[2] = hwread(vortex->mmio, 0x24510 + i * 0x24); 498 arg_0[2] = hwread(vortex->mmio, 0x24510);
474 arg_0[3] = hwread(vortex->mmio, 0x24514 + i * 0x24); 499 arg_0[3] = hwread(vortex->mmio, 0x24514);
475} 500}
476 501
477static void 502static void
@@ -486,10 +511,10 @@ vortex_XtalkHw_GetLeftXTStates(vortex_t * vortex, xtalk_instate_t arg_0,
486 coefs[i][2] = hwread(vortex->mmio, 0x24384 + i * 0x24); 511 coefs[i][2] = hwread(vortex->mmio, 0x24384 + i * 0x24);
487 coefs[i][3] = hwread(vortex->mmio, 0x24388 + i * 0x24); 512 coefs[i][3] = hwread(vortex->mmio, 0x24388 + i * 0x24);
488 } 513 }
489 arg_0[0] = hwread(vortex->mmio, 0x24518 + i * 0x24); 514 arg_0[0] = hwread(vortex->mmio, 0x24518);
490 arg_0[1] = hwread(vortex->mmio, 0x2451C + i * 0x24); 515 arg_0[1] = hwread(vortex->mmio, 0x2451C);
491 arg_0[2] = hwread(vortex->mmio, 0x24520 + i * 0x24); 516 arg_0[2] = hwread(vortex->mmio, 0x24520);
492 arg_0[3] = hwread(vortex->mmio, 0x24524 + i * 0x24); 517 arg_0[3] = hwread(vortex->mmio, 0x24524);
493} 518}
494 519
495static void 520static void
@@ -504,10 +529,10 @@ vortex_XtalkHw_GetRightXTStates(vortex_t * vortex, xtalk_instate_t arg_0,
504 coefs[i][2] = hwread(vortex->mmio, 0x24438 + i * 0x24); 529 coefs[i][2] = hwread(vortex->mmio, 0x24438 + i * 0x24);
505 coefs[i][3] = hwread(vortex->mmio, 0x2443C + i * 0x24); 530 coefs[i][3] = hwread(vortex->mmio, 0x2443C + i * 0x24);
506 } 531 }
507 arg_0[0] = hwread(vortex->mmio, 0x24528 + i * 0x24); 532 arg_0[0] = hwread(vortex->mmio, 0x24528);
508 arg_0[1] = hwread(vortex->mmio, 0x2452C + i * 0x24); 533 arg_0[1] = hwread(vortex->mmio, 0x2452C);
509 arg_0[2] = hwread(vortex->mmio, 0x24530 + i * 0x24); 534 arg_0[2] = hwread(vortex->mmio, 0x24530);
510 arg_0[3] = hwread(vortex->mmio, 0x24534 + i * 0x24); 535 arg_0[3] = hwread(vortex->mmio, 0x24534);
511} 536}
512 537
513#endif 538#endif
diff --git a/sound/pci/aw2/aw2-alsa.c b/sound/pci/aw2/aw2-alsa.c
index 7a581151db0..1c523193146 100644
--- a/sound/pci/aw2/aw2-alsa.c
+++ b/sound/pci/aw2/aw2-alsa.c
@@ -153,7 +153,7 @@ static int snd_aw2_control_switch_capture_put(struct snd_kcontrol *kcontrol,
153 ********************************/ 153 ********************************/
154static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 154static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
155static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 155static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
156static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 156static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
157 157
158module_param_array(index, int, NULL, 0444); 158module_param_array(index, int, NULL, 0444);
159MODULE_PARM_DESC(index, "Index value for Audiowerk2 soundcard."); 159MODULE_PARM_DESC(index, "Index value for Audiowerk2 soundcard.");
diff --git a/sound/pci/azt3328.c b/sound/pci/azt3328.c
index bc1e6830b50..95ffa6a9db6 100644
--- a/sound/pci/azt3328.c
+++ b/sound/pci/azt3328.c
@@ -301,7 +301,7 @@ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
301module_param_array(id, charp, NULL, 0444); 301module_param_array(id, charp, NULL, 0444);
302MODULE_PARM_DESC(id, "ID string for AZF3328 soundcard."); 302MODULE_PARM_DESC(id, "ID string for AZF3328 soundcard.");
303 303
304static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 304static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
305module_param_array(enable, bool, NULL, 0444); 305module_param_array(enable, bool, NULL, 0444);
306MODULE_PARM_DESC(enable, "Enable AZF3328 soundcard."); 306MODULE_PARM_DESC(enable, "Enable AZF3328 soundcard.");
307 307
diff --git a/sound/pci/bt87x.c b/sound/pci/bt87x.c
index c1c2d0c1c7f..62d6163fc9d 100644
--- a/sound/pci/bt87x.c
+++ b/sound/pci/bt87x.c
@@ -42,9 +42,9 @@ MODULE_SUPPORTED_DEVICE("{{Brooktree,Bt878},"
42 42
43static int index[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = -2}; /* Exclude the first card */ 43static int index[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = -2}; /* Exclude the first card */
44static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 44static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
45static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 45static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
46static int digital_rate[SNDRV_CARDS]; /* digital input rate */ 46static int digital_rate[SNDRV_CARDS]; /* digital input rate */
47static int load_all; /* allow to load the non-whitelisted cards */ 47static bool load_all; /* allow to load the non-whitelisted cards */
48 48
49module_param_array(index, int, NULL, 0444); 49module_param_array(index, int, NULL, 0444);
50MODULE_PARM_DESC(index, "Index value for Bt87x soundcard"); 50MODULE_PARM_DESC(index, "Index value for Bt87x soundcard");
diff --git a/sound/pci/ca0106/ca0106_main.c b/sound/pci/ca0106/ca0106_main.c
index fe99fdeaf15..08d6ebfe5a6 100644
--- a/sound/pci/ca0106/ca0106_main.c
+++ b/sound/pci/ca0106/ca0106_main.c
@@ -156,7 +156,7 @@ MODULE_SUPPORTED_DEVICE("{{Creative,SB CA0106 chip}}");
156// module parameters (see "Module Parameters") 156// module parameters (see "Module Parameters")
157static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 157static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
158static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 158static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
159static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 159static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
160static uint subsystem[SNDRV_CARDS]; /* Force card subsystem model */ 160static uint subsystem[SNDRV_CARDS]; /* Force card subsystem model */
161 161
162module_param_array(index, int, NULL, 0444); 162module_param_array(index, int, NULL, 0444);
diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c
index 954c9934748..19b06269adc 100644
--- a/sound/pci/cmipci.c
+++ b/sound/pci/cmipci.c
@@ -54,10 +54,10 @@ MODULE_SUPPORTED_DEVICE("{{C-Media,CMI8738},"
54 54
55static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 55static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
56static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 56static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
57static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable switches */ 57static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable switches */
58static long mpu_port[SNDRV_CARDS]; 58static long mpu_port[SNDRV_CARDS];
59static long fm_port[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)]=1}; 59static long fm_port[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)]=1};
60static int soft_ac3[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)]=1}; 60static bool soft_ac3[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)]=1};
61#ifdef SUPPORT_JOYSTICK 61#ifdef SUPPORT_JOYSTICK
62static int joystick_port[SNDRV_CARDS]; 62static int joystick_port[SNDRV_CARDS];
63#endif 63#endif
diff --git a/sound/pci/cs4281.c b/sound/pci/cs4281.c
index a6c6c5c53af..a9f368f60df 100644
--- a/sound/pci/cs4281.c
+++ b/sound/pci/cs4281.c
@@ -44,8 +44,8 @@ MODULE_SUPPORTED_DEVICE("{{Cirrus Logic,CS4281}}");
44 44
45static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 45static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
46static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 46static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
47static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable switches */ 47static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable switches */
48static int dual_codec[SNDRV_CARDS]; /* dual codec */ 48static bool dual_codec[SNDRV_CARDS]; /* dual codec */
49 49
50module_param_array(index, int, NULL, 0444); 50module_param_array(index, int, NULL, 0444);
51MODULE_PARM_DESC(index, "Index value for CS4281 soundcard."); 51MODULE_PARM_DESC(index, "Index value for CS4281 soundcard.");
diff --git a/sound/pci/cs46xx/cs46xx.c b/sound/pci/cs46xx/cs46xx.c
index a4ecb40f850..819d79d0586 100644
--- a/sound/pci/cs46xx/cs46xx.c
+++ b/sound/pci/cs46xx/cs46xx.c
@@ -46,10 +46,10 @@ MODULE_SUPPORTED_DEVICE("{{Cirrus Logic,Sound Fusion (CS4280)},"
46 46
47static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 47static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
48static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 48static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
49static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 49static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
50static int external_amp[SNDRV_CARDS]; 50static bool external_amp[SNDRV_CARDS];
51static int thinkpad[SNDRV_CARDS]; 51static bool thinkpad[SNDRV_CARDS];
52static int mmap_valid[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; 52static bool mmap_valid[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1};
53 53
54module_param_array(index, int, NULL, 0444); 54module_param_array(index, int, NULL, 0444);
55MODULE_PARM_DESC(index, "Index value for the CS46xx soundcard."); 55MODULE_PARM_DESC(index, "Index value for the CS46xx soundcard.");
diff --git a/sound/pci/cs5530.c b/sound/pci/cs5530.c
index 958f4949e97..c47cabff2bf 100644
--- a/sound/pci/cs5530.c
+++ b/sound/pci/cs5530.c
@@ -50,7 +50,14 @@ MODULE_LICENSE("GPL");
50 50
51static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 51static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
52static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 52static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
53static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 53static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
54
55module_param_array(index, int, NULL, 0444);
56MODULE_PARM_DESC(index, "Index value for CS5530 Audio driver.");
57module_param_array(id, charp, NULL, 0444);
58MODULE_PARM_DESC(id, "ID string for CS5530 Audio driver.");
59module_param_array(enable, bool, NULL, 0444);
60MODULE_PARM_DESC(enable, "Enable CS5530 Audio driver.");
54 61
55struct snd_cs5530 { 62struct snd_cs5530 {
56 struct snd_card *card; 63 struct snd_card *card;
diff --git a/sound/pci/cs5535audio/cs5535audio.c b/sound/pci/cs5535audio/cs5535audio.c
index b8959d2c804..a2fb2173e98 100644
--- a/sound/pci/cs5535audio/cs5535audio.c
+++ b/sound/pci/cs5535audio/cs5535audio.c
@@ -57,7 +57,7 @@ static struct ac97_quirk ac97_quirks[] __devinitdata = {
57 57
58static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 58static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
59static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 59static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
60static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 60static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
61 61
62module_param_array(index, int, NULL, 0444); 62module_param_array(index, int, NULL, 0444);
63MODULE_PARM_DESC(index, "Index value for " DRIVER_NAME); 63MODULE_PARM_DESC(index, "Index value for " DRIVER_NAME);
diff --git a/sound/pci/ctxfi/ctsrc.c b/sound/pci/ctxfi/ctsrc.c
index e134b3a5780..6e77e86307c 100644
--- a/sound/pci/ctxfi/ctsrc.c
+++ b/sound/pci/ctxfi/ctsrc.c
@@ -437,7 +437,7 @@ get_src_rsc(struct src_mgr *mgr, const struct src_desc *desc, struct src **rsrc)
437 437
438 /* Allocate mem for master src resource */ 438 /* Allocate mem for master src resource */
439 if (MEMRD == desc->mode) 439 if (MEMRD == desc->mode)
440 src = kzalloc(sizeof(*src)*desc->multi, GFP_KERNEL); 440 src = kcalloc(desc->multi, sizeof(*src), GFP_KERNEL);
441 else 441 else
442 src = kzalloc(sizeof(*src), GFP_KERNEL); 442 src = kzalloc(sizeof(*src), GFP_KERNEL);
443 443
diff --git a/sound/pci/ctxfi/cttimer.c b/sound/pci/ctxfi/cttimer.c
index 93b0aedc36d..03fb909085a 100644
--- a/sound/pci/ctxfi/cttimer.c
+++ b/sound/pci/ctxfi/cttimer.c
@@ -15,8 +15,8 @@
15#include "cthardware.h" 15#include "cthardware.h"
16#include "cttimer.h" 16#include "cttimer.h"
17 17
18static int use_system_timer; 18static bool use_system_timer;
19MODULE_PARM_DESC(use_system_timer, "Foce to use system-timer"); 19MODULE_PARM_DESC(use_system_timer, "Force to use system-timer");
20module_param(use_system_timer, bool, S_IRUGO); 20module_param(use_system_timer, bool, S_IRUGO);
21 21
22struct ct_timer_ops { 22struct ct_timer_ops {
diff --git a/sound/pci/ctxfi/xfi.c b/sound/pci/ctxfi/xfi.c
index 33931ef5e12..15d95d2bace 100644
--- a/sound/pci/ctxfi/xfi.c
+++ b/sound/pci/ctxfi/xfi.c
@@ -32,7 +32,7 @@ module_param(multiple, uint, S_IRUGO);
32 32
33static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 33static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
34static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 34static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
35static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 35static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
36static unsigned int subsystem[SNDRV_CARDS]; 36static unsigned int subsystem[SNDRV_CARDS];
37 37
38module_param_array(index, int, NULL, 0444); 38module_param_array(index, int, NULL, 0444);
diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c
index 9fd694c6186..595c11f904b 100644
--- a/sound/pci/echoaudio/echoaudio.c
+++ b/sound/pci/echoaudio/echoaudio.c
@@ -26,7 +26,7 @@ MODULE_DEVICE_TABLE(pci, snd_echo_ids);
26 26
27static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 27static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
28static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 28static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
29static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 29static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
30 30
31module_param_array(index, int, NULL, 0444); 31module_param_array(index, int, NULL, 0444);
32MODULE_PARM_DESC(index, "Index value for " ECHOCARD_NAME " soundcard."); 32MODULE_PARM_DESC(index, "Index value for " ECHOCARD_NAME " soundcard.");
diff --git a/sound/pci/emu10k1/emu10k1.c b/sound/pci/emu10k1/emu10k1.c
index eaa198e122c..790c65d980c 100644
--- a/sound/pci/emu10k1/emu10k1.c
+++ b/sound/pci/emu10k1/emu10k1.c
@@ -44,13 +44,13 @@ MODULE_SUPPORTED_DEVICE("{{Creative Labs,SB Live!/PCI512/E-mu APS},"
44 44
45static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 45static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
46static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 46static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
47static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 47static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
48static int extin[SNDRV_CARDS]; 48static int extin[SNDRV_CARDS];
49static int extout[SNDRV_CARDS]; 49static int extout[SNDRV_CARDS];
50static int seq_ports[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 4}; 50static int seq_ports[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 4};
51static int max_synth_voices[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 64}; 51static int max_synth_voices[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 64};
52static int max_buffer_size[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 128}; 52static int max_buffer_size[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 128};
53static int enable_ir[SNDRV_CARDS]; 53static bool enable_ir[SNDRV_CARDS];
54static uint subsystem[SNDRV_CARDS]; /* Force card subsystem model */ 54static uint subsystem[SNDRV_CARDS]; /* Force card subsystem model */
55static uint delay_pcm_irq[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 2}; 55static uint delay_pcm_irq[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 2};
56 56
diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c
index 6a3e5677f59..754924081d0 100644
--- a/sound/pci/emu10k1/emu10k1_main.c
+++ b/sound/pci/emu10k1/emu10k1_main.c
@@ -1480,6 +1480,18 @@ static struct snd_emu_chip_details emu_chip_details[] = {
1480 .spdif_bug = 1, 1480 .spdif_bug = 1,
1481 .invert_shared_spdif = 1, /* digital/analog switch swapped */ 1481 .invert_shared_spdif = 1, /* digital/analog switch swapped */
1482 .ac97_chip = 1} , 1482 .ac97_chip = 1} ,
1483 /* 0x20051102 also has SB0350 written on it, treated as Audigy 2 ZS by
1484 Creative's Windows driver */
1485 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x20051102,
1486 .driver = "Audigy2", .name = "SB Audigy 2 ZS [SB0350a]",
1487 .id = "Audigy2",
1488 .emu10k2_chip = 1,
1489 .ca0102_chip = 1,
1490 .ca0151_chip = 1,
1491 .spk71 = 1,
1492 .spdif_bug = 1,
1493 .invert_shared_spdif = 1, /* digital/analog switch swapped */
1494 .ac97_chip = 1} ,
1483 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x20021102, 1495 {.vendor = 0x1102, .device = 0x0004, .subsystem = 0x20021102,
1484 .driver = "Audigy2", .name = "SB Audigy 2 ZS [SB0350]", 1496 .driver = "Audigy2", .name = "SB Audigy 2 ZS [SB0350]",
1485 .id = "Audigy2", 1497 .id = "Audigy2",
diff --git a/sound/pci/emu10k1/emu10k1x.c b/sound/pci/emu10k1/emu10k1x.c
index 2228be9f30e..47a651cb6e8 100644
--- a/sound/pci/emu10k1/emu10k1x.c
+++ b/sound/pci/emu10k1/emu10k1x.c
@@ -50,7 +50,7 @@ MODULE_SUPPORTED_DEVICE("{{Dell Creative Labs,SB Live!}");
50// module parameters (see "Module Parameters") 50// module parameters (see "Module Parameters")
51static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 51static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
52static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 52static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
53static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 53static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
54 54
55module_param_array(index, int, NULL, 0444); 55module_param_array(index, int, NULL, 0444);
56MODULE_PARM_DESC(index, "Index value for the EMU10K1X soundcard."); 56MODULE_PARM_DESC(index, "Index value for the EMU10K1X soundcard.");
diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c
index d085ad03efe..47a245e8419 100644
--- a/sound/pci/ens1370.c
+++ b/sound/pci/ens1370.c
@@ -83,12 +83,12 @@ MODULE_SUPPORTED_DEVICE("{{Ensoniq,AudioPCI ES1371/73},"
83 83
84static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 84static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
85static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 85static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
86static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable switches */ 86static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable switches */
87#ifdef SUPPORT_JOYSTICK 87#ifdef SUPPORT_JOYSTICK
88#ifdef CHIP1371 88#ifdef CHIP1371
89static int joystick_port[SNDRV_CARDS]; 89static int joystick_port[SNDRV_CARDS];
90#else 90#else
91static int joystick[SNDRV_CARDS]; 91static bool joystick[SNDRV_CARDS];
92#endif 92#endif
93#endif 93#endif
94#ifdef CHIP1371 94#ifdef CHIP1371
diff --git a/sound/pci/es1938.c b/sound/pci/es1938.c
index 04cc21f5d01..53eb76b4110 100644
--- a/sound/pci/es1938.c
+++ b/sound/pci/es1938.c
@@ -79,7 +79,7 @@ MODULE_SUPPORTED_DEVICE("{{ESS,ES1938},"
79 79
80static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 80static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
81static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 81static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
82static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 82static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
83 83
84module_param_array(index, int, NULL, 0444); 84module_param_array(index, int, NULL, 0444);
85MODULE_PARM_DESC(index, "Index value for ESS Solo-1 soundcard."); 85MODULE_PARM_DESC(index, "Index value for ESS Solo-1 soundcard.");
diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c
index 297a151bdba..cb557c603a8 100644
--- a/sound/pci/es1968.c
+++ b/sound/pci/es1968.c
@@ -132,7 +132,7 @@ MODULE_SUPPORTED_DEVICE("{{ESS,Maestro 2e},"
132 132
133static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 1-MAX */ 133static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 1-MAX */
134static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 134static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
135static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 135static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
136static int total_bufsize[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1024 }; 136static int total_bufsize[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1024 };
137static int pcm_substreams_p[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 4 }; 137static int pcm_substreams_p[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 4 };
138static int pcm_substreams_c[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1 }; 138static int pcm_substreams_c[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1 };
@@ -140,7 +140,7 @@ static int clock[SNDRV_CARDS];
140static int use_pm[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 2}; 140static int use_pm[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 2};
141static int enable_mpu[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 2}; 141static int enable_mpu[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 2};
142#ifdef SUPPORT_JOYSTICK 142#ifdef SUPPORT_JOYSTICK
143static int joystick[SNDRV_CARDS]; 143static bool joystick[SNDRV_CARDS];
144#endif 144#endif
145 145
146module_param_array(index, int, NULL, 0444); 146module_param_array(index, int, NULL, 0444);
diff --git a/sound/pci/fm801.c b/sound/pci/fm801.c
index ec05ef5a5ab..9597ef1eccc 100644
--- a/sound/pci/fm801.c
+++ b/sound/pci/fm801.c
@@ -48,7 +48,7 @@ MODULE_SUPPORTED_DEVICE("{{ForteMedia,FM801},"
48 48
49static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 49static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
50static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 50static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
51static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 51static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
52/* 52/*
53 * Enable TEA575x tuner 53 * Enable TEA575x tuner
54 * 1 = MediaForte 256-PCS 54 * 1 = MediaForte 256-PCS
diff --git a/sound/pci/hda/Kconfig b/sound/pci/hda/Kconfig
index bb7e102d672..163b6b5de3e 100644
--- a/sound/pci/hda/Kconfig
+++ b/sound/pci/hda/Kconfig
@@ -2,6 +2,7 @@ menuconfig SND_HDA_INTEL
2 tristate "Intel HD Audio" 2 tristate "Intel HD Audio"
3 select SND_PCM 3 select SND_PCM
4 select SND_VMASTER 4 select SND_VMASTER
5 select SND_KCTL_JACK
5 help 6 help
6 Say Y here to include support for Intel "High Definition 7 Say Y here to include support for Intel "High Definition
7 Audio" (Azalia) and its compatible devices. 8 Audio" (Azalia) and its compatible devices.
diff --git a/sound/pci/hda/Makefile b/sound/pci/hda/Makefile
index f928d663472..ace157cc3d1 100644
--- a/sound/pci/hda/Makefile
+++ b/sound/pci/hda/Makefile
@@ -1,6 +1,6 @@
1snd-hda-intel-objs := hda_intel.o 1snd-hda-intel-objs := hda_intel.o
2 2
3snd-hda-codec-y := hda_codec.o 3snd-hda-codec-y := hda_codec.o hda_jack.o
4snd-hda-codec-$(CONFIG_SND_HDA_GENERIC) += hda_generic.o 4snd-hda-codec-$(CONFIG_SND_HDA_GENERIC) += hda_generic.o
5snd-hda-codec-$(CONFIG_PROC_FS) += hda_proc.o 5snd-hda-codec-$(CONFIG_PROC_FS) += hda_proc.o
6snd-hda-codec-$(CONFIG_SND_HDA_HWDEP) += hda_hwdep.o 6snd-hda-codec-$(CONFIG_SND_HDA_HWDEP) += hda_hwdep.o
diff --git a/sound/pci/hda/alc262_quirks.c b/sound/pci/hda/alc262_quirks.c
deleted file mode 100644
index 7894b2b5aac..00000000000
--- a/sound/pci/hda/alc262_quirks.c
+++ /dev/null
@@ -1,875 +0,0 @@
1/*
2 * ALC262 quirk models
3 * included by patch_realtek.c
4 */
5
6/* ALC262 models */
7enum {
8 ALC262_AUTO,
9 ALC262_BASIC,
10 ALC262_HIPPO,
11 ALC262_HIPPO_1,
12 ALC262_FUJITSU,
13 ALC262_BENQ_ED8,
14 ALC262_BENQ_T31,
15 ALC262_ULTRA,
16 ALC262_LENOVO_3000,
17 ALC262_NEC,
18 ALC262_TOSHIBA_S06,
19 ALC262_TOSHIBA_RX1,
20 ALC262_TYAN,
21 ALC262_MODEL_LAST /* last tag */
22};
23
24#define ALC262_DIGOUT_NID ALC880_DIGOUT_NID
25#define ALC262_DIGIN_NID ALC880_DIGIN_NID
26
27#define alc262_dac_nids alc260_dac_nids
28#define alc262_adc_nids alc882_adc_nids
29#define alc262_adc_nids_alt alc882_adc_nids_alt
30#define alc262_capsrc_nids alc882_capsrc_nids
31#define alc262_capsrc_nids_alt alc882_capsrc_nids_alt
32
33#define alc262_modes alc260_modes
34#define alc262_capture_source alc882_capture_source
35
36static const hda_nid_t alc262_dmic_adc_nids[1] = {
37 /* ADC0 */
38 0x09
39};
40
41static const hda_nid_t alc262_dmic_capsrc_nids[1] = { 0x22 };
42
43static const struct snd_kcontrol_new alc262_base_mixer[] = {
44 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
45 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
46 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
47 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
48 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
49 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
50 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
51 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
52 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
53 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
54 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
55 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
56 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0D, 0x0, HDA_OUTPUT),
57 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
58 HDA_CODEC_VOLUME_MONO("Mono Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
59 HDA_CODEC_MUTE_MONO("Mono Playback Switch", 0x16, 2, 0x0, HDA_OUTPUT),
60 { } /* end */
61};
62
63/* bind hp and internal speaker mute (with plug check) as master switch */
64
65static int alc262_hippo_master_sw_get(struct snd_kcontrol *kcontrol,
66 struct snd_ctl_elem_value *ucontrol)
67{
68 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
69 struct alc_spec *spec = codec->spec;
70 *ucontrol->value.integer.value = !spec->master_mute;
71 return 0;
72}
73
74static int alc262_hippo_master_sw_put(struct snd_kcontrol *kcontrol,
75 struct snd_ctl_elem_value *ucontrol)
76{
77 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
78 struct alc_spec *spec = codec->spec;
79 int val = !*ucontrol->value.integer.value;
80
81 if (val == spec->master_mute)
82 return 0;
83 spec->master_mute = val;
84 update_outputs(codec);
85 return 1;
86}
87
88#define ALC262_HIPPO_MASTER_SWITCH \
89 { \
90 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, \
91 .name = "Master Playback Switch", \
92 .info = snd_ctl_boolean_mono_info, \
93 .get = alc262_hippo_master_sw_get, \
94 .put = alc262_hippo_master_sw_put, \
95 }, \
96 { \
97 .iface = NID_MAPPING, \
98 .name = "Master Playback Switch", \
99 .subdevice = SUBDEV_HP(0) | (SUBDEV_LINE(0) << 8) | \
100 (SUBDEV_SPEAKER(0) << 16), \
101 }
102
103#define alc262_hp_master_sw_get alc262_hippo_master_sw_get
104#define alc262_hp_master_sw_put alc262_hippo_master_sw_put
105
106static const struct snd_kcontrol_new alc262_hippo_mixer[] = {
107 ALC262_HIPPO_MASTER_SWITCH,
108 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
109 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
110 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
111 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
112 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
113 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
114 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
115 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
116 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
117 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
118 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
119 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
120 { } /* end */
121};
122
123static const struct snd_kcontrol_new alc262_hippo1_mixer[] = {
124 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
125 ALC262_HIPPO_MASTER_SWITCH,
126 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
127 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
128 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
129 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
130 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
131 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
132 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
133 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
134 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
135 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
136 { } /* end */
137};
138
139/* mute/unmute internal speaker according to the hp jack and mute state */
140static void alc262_hippo_setup(struct hda_codec *codec)
141{
142 struct alc_spec *spec = codec->spec;
143
144 spec->autocfg.hp_pins[0] = 0x15;
145 spec->autocfg.speaker_pins[0] = 0x14;
146 alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP);
147}
148
149static void alc262_hippo1_setup(struct hda_codec *codec)
150{
151 struct alc_spec *spec = codec->spec;
152
153 spec->autocfg.hp_pins[0] = 0x1b;
154 spec->autocfg.speaker_pins[0] = 0x14;
155 alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP);
156}
157
158
159static const struct snd_kcontrol_new alc262_sony_mixer[] = {
160 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
161 ALC262_HIPPO_MASTER_SWITCH,
162 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
163 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
164 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
165 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
166 { } /* end */
167};
168
169static const struct snd_kcontrol_new alc262_benq_t31_mixer[] = {
170 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
171 ALC262_HIPPO_MASTER_SWITCH,
172 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
173 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
174 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
175 HDA_CODEC_VOLUME("ATAPI Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
176 HDA_CODEC_MUTE("ATAPI Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
177 { } /* end */
178};
179
180static const struct snd_kcontrol_new alc262_tyan_mixer[] = {
181 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
182 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
183 HDA_CODEC_VOLUME("Aux Playback Volume", 0x0b, 0x06, HDA_INPUT),
184 HDA_CODEC_MUTE("Aux Playback Switch", 0x0b, 0x06, HDA_INPUT),
185 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
186 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
187 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
188 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
189 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
190 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
191 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
192 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
193 { } /* end */
194};
195
196static const struct hda_verb alc262_tyan_verbs[] = {
197 /* Headphone automute */
198 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
199 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
200 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
201
202 /* P11 AUX_IN, white 4-pin connector */
203 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
204 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_1, 0xe1},
205 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_2, 0x93},
206 {0x14, AC_VERB_SET_CONFIG_DEFAULT_BYTES_3, 0x19},
207
208 {}
209};
210
211/* unsolicited event for HP jack sensing */
212static void alc262_tyan_setup(struct hda_codec *codec)
213{
214 struct alc_spec *spec = codec->spec;
215
216 spec->autocfg.hp_pins[0] = 0x1b;
217 spec->autocfg.speaker_pins[0] = 0x15;
218 alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP);
219}
220
221
222#define alc262_capture_mixer alc882_capture_mixer
223#define alc262_capture_alt_mixer alc882_capture_alt_mixer
224
225/*
226 * generic initialization of ADC, input mixers and output mixers
227 */
228static const struct hda_verb alc262_init_verbs[] = {
229 /*
230 * Unmute ADC0-2 and set the default input to mic-in
231 */
232 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
233 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
234 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
235 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
236 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
237 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
238
239 /* Mute input amps (CD, Line In, Mic 1 & Mic 2) of the analog-loopback
240 * mixer widget
241 * Note: PASD motherboards uses the Line In 2 as the input for
242 * front panel mic (mic 2)
243 */
244 /* Amp Indices: Mic1 = 0, Mic2 = 1, Line1 = 2, Line2 = 3, CD = 4 */
245 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
246 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
247 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
248 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
249 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
250
251 /*
252 * Set up output mixers (0x0c - 0x0e)
253 */
254 /* set vol=0 to output mixers */
255 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
256 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
257 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
258 /* set up input amps for analog loopback */
259 /* Amp Indices: DAC = 0, mixer = 1 */
260 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
261 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
262 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
263 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
264 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
265 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
266
267 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
268 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
269 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x40},
270 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
271 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
272 {0x1c, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x20},
273
274 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
275 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
276 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
277 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
278 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
279
280 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
281 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
282
283 /* FIXME: use matrix-type input source selection */
284 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
285 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
286 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
287 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
288 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
289 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
290 /* Input mixer2 */
291 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
292 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
293 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
294 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
295 /* Input mixer3 */
296 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7000 | (0x00 << 8))},
297 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x03 << 8))},
298 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x02 << 8))},
299 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, (0x7080 | (0x04 << 8))},
300
301 { }
302};
303
304static const struct hda_verb alc262_eapd_verbs[] = {
305 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
306 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
307 { }
308};
309
310static const struct hda_verb alc262_hippo1_unsol_verbs[] = {
311 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
312 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
313 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, 0x0000},
314
315 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
316 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
317 {}
318};
319
320static const struct hda_verb alc262_sony_unsol_verbs[] = {
321 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc0},
322 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
323 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24}, // Front Mic
324
325 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
326 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
327 {}
328};
329
330static const struct snd_kcontrol_new alc262_toshiba_s06_mixer[] = {
331 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
332 HDA_CODEC_MUTE("Speaker Playback Switch", 0x14, 0x0, HDA_OUTPUT),
333 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
334 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
335 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
336 { } /* end */
337};
338
339static const struct hda_verb alc262_toshiba_s06_verbs[] = {
340 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
341 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
342 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
343 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
344 {0x22, AC_VERB_SET_CONNECT_SEL, 0x09},
345 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
346 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_MIC_EVENT},
347 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
348 {}
349};
350
351static void alc262_toshiba_s06_setup(struct hda_codec *codec)
352{
353 struct alc_spec *spec = codec->spec;
354
355 spec->autocfg.hp_pins[0] = 0x15;
356 spec->autocfg.speaker_pins[0] = 0x14;
357 spec->ext_mic_pin = 0x18;
358 spec->int_mic_pin = 0x12;
359 spec->auto_mic = 1;
360 alc_simple_setup_automute(spec, ALC_AUTOMUTE_PIN);
361}
362
363/*
364 * nec model
365 * 0x15 = headphone
366 * 0x16 = internal speaker
367 * 0x18 = external mic
368 */
369
370static const struct snd_kcontrol_new alc262_nec_mixer[] = {
371 HDA_CODEC_VOLUME_MONO("Speaker Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
372 HDA_CODEC_MUTE_MONO("Speaker Playback Switch", 0x16, 0, 0x0, HDA_OUTPUT),
373
374 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
375 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
376 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
377
378 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
379 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
380 { } /* end */
381};
382
383static const struct hda_verb alc262_nec_verbs[] = {
384 /* Unmute Speaker */
385 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
386
387 /* Headphone */
388 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
389 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
390
391 /* External mic to headphone */
392 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
393 /* External mic to speaker */
394 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
395 {}
396};
397
398/*
399 * fujitsu model
400 * 0x14 = headphone/spdif-out, 0x15 = internal speaker,
401 * 0x1b = port replicator headphone out
402 */
403
404static const struct hda_verb alc262_fujitsu_unsol_verbs[] = {
405 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
406 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
407 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
408 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
409 {}
410};
411
412static const struct hda_verb alc262_lenovo_3000_unsol_verbs[] = {
413 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
414 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
415 {}
416};
417
418static const struct hda_verb alc262_lenovo_3000_init_verbs[] = {
419 /* Front Mic pin: input vref at 50% */
420 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50},
421 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
422 {}
423};
424
425static const struct hda_input_mux alc262_fujitsu_capture_source = {
426 .num_items = 3,
427 .items = {
428 { "Mic", 0x0 },
429 { "Internal Mic", 0x1 },
430 { "CD", 0x4 },
431 },
432};
433
434static void alc262_fujitsu_setup(struct hda_codec *codec)
435{
436 struct alc_spec *spec = codec->spec;
437
438 spec->autocfg.hp_pins[0] = 0x14;
439 spec->autocfg.hp_pins[1] = 0x1b;
440 spec->autocfg.speaker_pins[0] = 0x15;
441 alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP);
442}
443
444/* bind volumes of both NID 0x0c and 0x0d */
445static const struct hda_bind_ctls alc262_fujitsu_bind_master_vol = {
446 .ops = &snd_hda_bind_vol,
447 .values = {
448 HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT),
449 HDA_COMPOSE_AMP_VAL(0x0d, 3, 0, HDA_OUTPUT),
450 0
451 },
452};
453
454static const struct snd_kcontrol_new alc262_fujitsu_mixer[] = {
455 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
456 {
457 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
458 .name = "Master Playback Switch",
459 .subdevice = HDA_SUBDEV_NID_FLAG | 0x14,
460 .info = snd_ctl_boolean_mono_info,
461 .get = alc262_hp_master_sw_get,
462 .put = alc262_hp_master_sw_put,
463 },
464 {
465 .iface = NID_MAPPING,
466 .name = "Master Playback Switch",
467 .private_value = 0x1b,
468 },
469 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
470 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
471 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
472 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
473 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
474 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
475 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
476 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
477 { } /* end */
478};
479
480static void alc262_lenovo_3000_setup(struct hda_codec *codec)
481{
482 struct alc_spec *spec = codec->spec;
483
484 spec->autocfg.hp_pins[0] = 0x1b;
485 spec->autocfg.speaker_pins[0] = 0x14;
486 spec->autocfg.speaker_pins[1] = 0x16;
487 alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP);
488}
489
490static const struct snd_kcontrol_new alc262_lenovo_3000_mixer[] = {
491 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
492 {
493 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
494 .name = "Master Playback Switch",
495 .subdevice = HDA_SUBDEV_NID_FLAG | 0x1b,
496 .info = snd_ctl_boolean_mono_info,
497 .get = alc262_hp_master_sw_get,
498 .put = alc262_hp_master_sw_put,
499 },
500 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
501 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
502 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
503 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
504 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
505 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
506 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
507 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
508 { } /* end */
509};
510
511static const struct snd_kcontrol_new alc262_toshiba_rx1_mixer[] = {
512 HDA_BIND_VOL("Master Playback Volume", &alc262_fujitsu_bind_master_vol),
513 ALC262_HIPPO_MASTER_SWITCH,
514 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
515 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
516 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
517 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
518 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
519 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
520 { } /* end */
521};
522
523/* additional init verbs for Benq laptops */
524static const struct hda_verb alc262_EAPD_verbs[] = {
525 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
526 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
527 {}
528};
529
530static const struct hda_verb alc262_benq_t31_EAPD_verbs[] = {
531 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
532 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x24},
533
534 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
535 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
536 {}
537};
538
539/* Samsung Q1 Ultra Vista model setup */
540static const struct snd_kcontrol_new alc262_ultra_mixer[] = {
541 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
542 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
543 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
544 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
545 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT),
546 HDA_CODEC_VOLUME("Headphone Mic Boost Volume", 0x15, 0, HDA_INPUT),
547 { } /* end */
548};
549
550static const struct hda_verb alc262_ultra_verbs[] = {
551 /* output mixer */
552 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
553 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
554 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
555 /* speaker */
556 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
557 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
558 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
559 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
560 /* HP */
561 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
562 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
563 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
564 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
565 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
566 /* internal mic */
567 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
568 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
569 /* ADC, choose mic */
570 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
571 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
572 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
573 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
574 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
575 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
576 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(5)},
577 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(6)},
578 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
579 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(8)},
580 {}
581};
582
583/* mute/unmute internal speaker according to the hp jack and mute state */
584static void alc262_ultra_automute(struct hda_codec *codec)
585{
586 struct alc_spec *spec = codec->spec;
587 unsigned int mute;
588
589 mute = 0;
590 /* auto-mute only when HP is used as HP */
591 if (!spec->cur_mux[0]) {
592 spec->hp_jack_present = snd_hda_jack_detect(codec, 0x15);
593 if (spec->hp_jack_present)
594 mute = HDA_AMP_MUTE;
595 }
596 /* mute/unmute internal speaker */
597 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
598 HDA_AMP_MUTE, mute);
599 /* mute/unmute HP */
600 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
601 HDA_AMP_MUTE, mute ? 0 : HDA_AMP_MUTE);
602}
603
604/* unsolicited event for HP jack sensing */
605static void alc262_ultra_unsol_event(struct hda_codec *codec,
606 unsigned int res)
607{
608 if ((res >> 26) != ALC_HP_EVENT)
609 return;
610 alc262_ultra_automute(codec);
611}
612
613static const struct hda_input_mux alc262_ultra_capture_source = {
614 .num_items = 2,
615 .items = {
616 { "Mic", 0x1 },
617 { "Headphone", 0x7 },
618 },
619};
620
621static int alc262_ultra_mux_enum_put(struct snd_kcontrol *kcontrol,
622 struct snd_ctl_elem_value *ucontrol)
623{
624 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
625 struct alc_spec *spec = codec->spec;
626 int ret;
627
628 ret = alc_mux_enum_put(kcontrol, ucontrol);
629 if (!ret)
630 return 0;
631 /* reprogram the HP pin as mic or HP according to the input source */
632 snd_hda_codec_write_cache(codec, 0x15, 0,
633 AC_VERB_SET_PIN_WIDGET_CONTROL,
634 spec->cur_mux[0] ? PIN_VREF80 : PIN_HP);
635 alc262_ultra_automute(codec); /* mute/unmute HP */
636 return ret;
637}
638
639static const struct snd_kcontrol_new alc262_ultra_capture_mixer[] = {
640 HDA_CODEC_VOLUME("Capture Volume", 0x07, 0x0, HDA_INPUT),
641 HDA_CODEC_MUTE("Capture Switch", 0x07, 0x0, HDA_INPUT),
642 {
643 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
644 .name = "Capture Source",
645 .info = alc_mux_enum_info,
646 .get = alc_mux_enum_get,
647 .put = alc262_ultra_mux_enum_put,
648 },
649 {
650 .iface = NID_MAPPING,
651 .name = "Capture Source",
652 .private_value = 0x15,
653 },
654 { } /* end */
655};
656
657static const struct hda_verb alc262_toshiba_rx1_unsol_verbs[] = {
658
659 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT }, /* Front Speaker */
660 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
661 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
662
663 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* MIC jack */
664 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 }, /* Front MIC */
665 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
666 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0) },
667
668 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP }, /* HP jack */
669 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
670 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
671 {}
672};
673
674/*
675 * configuration and preset
676 */
677static const char * const alc262_models[ALC262_MODEL_LAST] = {
678 [ALC262_BASIC] = "basic",
679 [ALC262_HIPPO] = "hippo",
680 [ALC262_HIPPO_1] = "hippo_1",
681 [ALC262_FUJITSU] = "fujitsu",
682 [ALC262_BENQ_ED8] = "benq",
683 [ALC262_BENQ_T31] = "benq-t31",
684 [ALC262_TOSHIBA_S06] = "toshiba-s06",
685 [ALC262_TOSHIBA_RX1] = "toshiba-rx1",
686 [ALC262_ULTRA] = "ultra",
687 [ALC262_LENOVO_3000] = "lenovo-3000",
688 [ALC262_NEC] = "nec",
689 [ALC262_TYAN] = "tyan",
690 [ALC262_AUTO] = "auto",
691};
692
693static const struct snd_pci_quirk alc262_cfg_tbl[] = {
694 SND_PCI_QUIRK(0x1002, 0x437b, "Hippo", ALC262_HIPPO),
695 SND_PCI_QUIRK(0x1033, 0x8895, "NEC Versa S9100", ALC262_NEC),
696 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
697 ALC262_TOSHIBA_RX1),
698 SND_PCI_QUIRK(0x1179, 0xff7b, "Toshiba S06", ALC262_TOSHIBA_S06),
699 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FUJITSU),
700 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FUJITSU),
701 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_TYAN),
702 SND_PCI_QUIRK_MASK(0x144d, 0xff00, 0xc032, "Samsung Q1",
703 ALC262_ULTRA),
704 SND_PCI_QUIRK(0x144d, 0xc510, "Samsung Q45", ALC262_HIPPO),
705 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000 y410", ALC262_LENOVO_3000),
706 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_BENQ_ED8),
707 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_BENQ_T31),
708 SND_PCI_QUIRK(0x17ff, 0x058f, "Benq Hippo", ALC262_HIPPO_1),
709 {}
710};
711
712static const struct alc_config_preset alc262_presets[] = {
713 [ALC262_BASIC] = {
714 .mixers = { alc262_base_mixer },
715 .init_verbs = { alc262_init_verbs },
716 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
717 .dac_nids = alc262_dac_nids,
718 .hp_nid = 0x03,
719 .num_channel_mode = ARRAY_SIZE(alc262_modes),
720 .channel_mode = alc262_modes,
721 .input_mux = &alc262_capture_source,
722 },
723 [ALC262_HIPPO] = {
724 .mixers = { alc262_hippo_mixer },
725 .init_verbs = { alc262_init_verbs, alc_hp15_unsol_verbs},
726 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
727 .dac_nids = alc262_dac_nids,
728 .hp_nid = 0x03,
729 .dig_out_nid = ALC262_DIGOUT_NID,
730 .num_channel_mode = ARRAY_SIZE(alc262_modes),
731 .channel_mode = alc262_modes,
732 .input_mux = &alc262_capture_source,
733 .unsol_event = alc_sku_unsol_event,
734 .setup = alc262_hippo_setup,
735 .init_hook = alc_inithook,
736 },
737 [ALC262_HIPPO_1] = {
738 .mixers = { alc262_hippo1_mixer },
739 .init_verbs = { alc262_init_verbs, alc262_hippo1_unsol_verbs},
740 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
741 .dac_nids = alc262_dac_nids,
742 .hp_nid = 0x02,
743 .dig_out_nid = ALC262_DIGOUT_NID,
744 .num_channel_mode = ARRAY_SIZE(alc262_modes),
745 .channel_mode = alc262_modes,
746 .input_mux = &alc262_capture_source,
747 .unsol_event = alc_sku_unsol_event,
748 .setup = alc262_hippo1_setup,
749 .init_hook = alc_inithook,
750 },
751 [ALC262_FUJITSU] = {
752 .mixers = { alc262_fujitsu_mixer },
753 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
754 alc262_fujitsu_unsol_verbs },
755 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
756 .dac_nids = alc262_dac_nids,
757 .hp_nid = 0x03,
758 .dig_out_nid = ALC262_DIGOUT_NID,
759 .num_channel_mode = ARRAY_SIZE(alc262_modes),
760 .channel_mode = alc262_modes,
761 .input_mux = &alc262_fujitsu_capture_source,
762 .unsol_event = alc_sku_unsol_event,
763 .setup = alc262_fujitsu_setup,
764 .init_hook = alc_inithook,
765 },
766 [ALC262_BENQ_ED8] = {
767 .mixers = { alc262_base_mixer },
768 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs },
769 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
770 .dac_nids = alc262_dac_nids,
771 .hp_nid = 0x03,
772 .num_channel_mode = ARRAY_SIZE(alc262_modes),
773 .channel_mode = alc262_modes,
774 .input_mux = &alc262_capture_source,
775 },
776 [ALC262_BENQ_T31] = {
777 .mixers = { alc262_benq_t31_mixer },
778 .init_verbs = { alc262_init_verbs, alc262_benq_t31_EAPD_verbs,
779 alc_hp15_unsol_verbs },
780 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
781 .dac_nids = alc262_dac_nids,
782 .hp_nid = 0x03,
783 .num_channel_mode = ARRAY_SIZE(alc262_modes),
784 .channel_mode = alc262_modes,
785 .input_mux = &alc262_capture_source,
786 .unsol_event = alc_sku_unsol_event,
787 .setup = alc262_hippo_setup,
788 .init_hook = alc_inithook,
789 },
790 [ALC262_ULTRA] = {
791 .mixers = { alc262_ultra_mixer },
792 .cap_mixer = alc262_ultra_capture_mixer,
793 .init_verbs = { alc262_ultra_verbs },
794 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
795 .dac_nids = alc262_dac_nids,
796 .num_channel_mode = ARRAY_SIZE(alc262_modes),
797 .channel_mode = alc262_modes,
798 .input_mux = &alc262_ultra_capture_source,
799 .adc_nids = alc262_adc_nids, /* ADC0 */
800 .capsrc_nids = alc262_capsrc_nids,
801 .num_adc_nids = 1, /* single ADC */
802 .unsol_event = alc262_ultra_unsol_event,
803 .init_hook = alc262_ultra_automute,
804 },
805 [ALC262_LENOVO_3000] = {
806 .mixers = { alc262_lenovo_3000_mixer },
807 .init_verbs = { alc262_init_verbs, alc262_EAPD_verbs,
808 alc262_lenovo_3000_unsol_verbs,
809 alc262_lenovo_3000_init_verbs },
810 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
811 .dac_nids = alc262_dac_nids,
812 .hp_nid = 0x03,
813 .dig_out_nid = ALC262_DIGOUT_NID,
814 .num_channel_mode = ARRAY_SIZE(alc262_modes),
815 .channel_mode = alc262_modes,
816 .input_mux = &alc262_fujitsu_capture_source,
817 .unsol_event = alc_sku_unsol_event,
818 .setup = alc262_lenovo_3000_setup,
819 .init_hook = alc_inithook,
820 },
821 [ALC262_NEC] = {
822 .mixers = { alc262_nec_mixer },
823 .init_verbs = { alc262_nec_verbs },
824 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
825 .dac_nids = alc262_dac_nids,
826 .hp_nid = 0x03,
827 .num_channel_mode = ARRAY_SIZE(alc262_modes),
828 .channel_mode = alc262_modes,
829 .input_mux = &alc262_capture_source,
830 },
831 [ALC262_TOSHIBA_S06] = {
832 .mixers = { alc262_toshiba_s06_mixer },
833 .init_verbs = { alc262_init_verbs, alc262_toshiba_s06_verbs,
834 alc262_eapd_verbs },
835 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
836 .capsrc_nids = alc262_dmic_capsrc_nids,
837 .dac_nids = alc262_dac_nids,
838 .adc_nids = alc262_dmic_adc_nids, /* ADC0 */
839 .num_adc_nids = 1, /* single ADC */
840 .dig_out_nid = ALC262_DIGOUT_NID,
841 .num_channel_mode = ARRAY_SIZE(alc262_modes),
842 .channel_mode = alc262_modes,
843 .unsol_event = alc_sku_unsol_event,
844 .setup = alc262_toshiba_s06_setup,
845 .init_hook = alc_inithook,
846 },
847 [ALC262_TOSHIBA_RX1] = {
848 .mixers = { alc262_toshiba_rx1_mixer },
849 .init_verbs = { alc262_init_verbs, alc262_toshiba_rx1_unsol_verbs },
850 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
851 .dac_nids = alc262_dac_nids,
852 .hp_nid = 0x03,
853 .num_channel_mode = ARRAY_SIZE(alc262_modes),
854 .channel_mode = alc262_modes,
855 .input_mux = &alc262_capture_source,
856 .unsol_event = alc_sku_unsol_event,
857 .setup = alc262_hippo_setup,
858 .init_hook = alc_inithook,
859 },
860 [ALC262_TYAN] = {
861 .mixers = { alc262_tyan_mixer },
862 .init_verbs = { alc262_init_verbs, alc262_tyan_verbs},
863 .num_dacs = ARRAY_SIZE(alc262_dac_nids),
864 .dac_nids = alc262_dac_nids,
865 .hp_nid = 0x02,
866 .dig_out_nid = ALC262_DIGOUT_NID,
867 .num_channel_mode = ARRAY_SIZE(alc262_modes),
868 .channel_mode = alc262_modes,
869 .input_mux = &alc262_capture_source,
870 .unsol_event = alc_sku_unsol_event,
871 .setup = alc262_tyan_setup,
872 .init_hook = alc_hp_automute,
873 },
874};
875
diff --git a/sound/pci/hda/alc880_quirks.c b/sound/pci/hda/alc880_quirks.c
index bea22edcfd8..5b68435d195 100644
--- a/sound/pci/hda/alc880_quirks.c
+++ b/sound/pci/hda/alc880_quirks.c
@@ -26,8 +26,6 @@ enum {
26 ALC880_CLEVO, 26 ALC880_CLEVO,
27 ALC880_TCL_S700, 27 ALC880_TCL_S700,
28 ALC880_LG, 28 ALC880_LG,
29 ALC880_LG_LW,
30 ALC880_MEDION_RIM,
31#ifdef CONFIG_SND_DEBUG 29#ifdef CONFIG_SND_DEBUG
32 ALC880_TEST, 30 ALC880_TEST,
33#endif 31#endif
@@ -1052,163 +1050,6 @@ static void alc880_lg_setup(struct hda_codec *codec)
1052 alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); 1050 alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP);
1053} 1051}
1054 1052
1055/*
1056 * LG LW20
1057 *
1058 * Pin assignment:
1059 * Speaker-out: 0x14
1060 * Mic-In: 0x18
1061 * Built-in Mic-In: 0x19
1062 * Line-In: 0x1b
1063 * HP-Out: 0x1a
1064 * SPDIF-Out: 0x1e
1065 */
1066
1067static const struct hda_input_mux alc880_lg_lw_capture_source = {
1068 .num_items = 3,
1069 .items = {
1070 { "Mic", 0x0 },
1071 { "Internal Mic", 0x1 },
1072 { "Line In", 0x2 },
1073 },
1074};
1075
1076#define alc880_lg_lw_modes alc880_threestack_modes
1077
1078static const struct snd_kcontrol_new alc880_lg_lw_mixer[] = {
1079 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1080 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1081 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1082 HDA_BIND_MUTE("Surround Playback Switch", 0x0f, 2, HDA_INPUT),
1083 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1084 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1085 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1086 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1087 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1088 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1089 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1090 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1091 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x01, HDA_INPUT),
1092 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x01, HDA_INPUT),
1093 {
1094 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1095 .name = "Channel Mode",
1096 .info = alc_ch_mode_info,
1097 .get = alc_ch_mode_get,
1098 .put = alc_ch_mode_put,
1099 },
1100 { } /* end */
1101};
1102
1103static const struct hda_verb alc880_lg_lw_init_verbs[] = {
1104 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1105 {0x10, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
1106 {0x12, AC_VERB_SET_CONNECT_SEL, 0x03}, /* line/surround */
1107
1108 /* set capture source to mic-in */
1109 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1110 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1111 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1112 {0x0b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(7)},
1113 /* speaker-out */
1114 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1115 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1116 /* HP-out */
1117 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1118 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1119 /* mic-in to input */
1120 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1121 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1122 /* built-in mic */
1123 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1124 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1125 /* jack sense */
1126 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
1127 { }
1128};
1129
1130/* toggle speaker-output according to the hp-jack state */
1131static void alc880_lg_lw_setup(struct hda_codec *codec)
1132{
1133 struct alc_spec *spec = codec->spec;
1134
1135 spec->autocfg.hp_pins[0] = 0x1b;
1136 spec->autocfg.speaker_pins[0] = 0x14;
1137 alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP);
1138}
1139
1140static const struct snd_kcontrol_new alc880_medion_rim_mixer[] = {
1141 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1142 HDA_BIND_MUTE("Master Playback Switch", 0x0c, 2, HDA_INPUT),
1143 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1144 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1145 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1146 HDA_CODEC_MUTE("Internal Playback Switch", 0x0b, 0x1, HDA_INPUT),
1147 { } /* end */
1148};
1149
1150static const struct hda_input_mux alc880_medion_rim_capture_source = {
1151 .num_items = 2,
1152 .items = {
1153 { "Mic", 0x0 },
1154 { "Internal Mic", 0x1 },
1155 },
1156};
1157
1158static const struct hda_verb alc880_medion_rim_init_verbs[] = {
1159 {0x13, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1160
1161 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1162 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1163
1164 /* Mic1 (rear panel) pin widget for input and vref at 80% */
1165 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1166 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1167 /* Mic2 (as headphone out) for HP output */
1168 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1169 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1170 /* Internal Speaker */
1171 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1172 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1173
1174 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
1175 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
1176
1177 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
1178 { }
1179};
1180
1181/* toggle speaker-output according to the hp-jack state */
1182static void alc880_medion_rim_automute(struct hda_codec *codec)
1183{
1184 struct alc_spec *spec = codec->spec;
1185 alc_hp_automute(codec);
1186 /* toggle EAPD */
1187 if (spec->hp_jack_present)
1188 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 0);
1189 else
1190 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_DATA, 2);
1191}
1192
1193static void alc880_medion_rim_unsol_event(struct hda_codec *codec,
1194 unsigned int res)
1195{
1196 /* Looks like the unsol event is incompatible with the standard
1197 * definition. 4bit tag is placed at 28 bit!
1198 */
1199 if ((res >> 28) == ALC_HP_EVENT)
1200 alc880_medion_rim_automute(codec);
1201}
1202
1203static void alc880_medion_rim_setup(struct hda_codec *codec)
1204{
1205 struct alc_spec *spec = codec->spec;
1206
1207 spec->autocfg.hp_pins[0] = 0x14;
1208 spec->autocfg.speaker_pins[0] = 0x1b;
1209 alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP);
1210}
1211
1212#ifdef CONFIG_SND_HDA_POWER_SAVE 1053#ifdef CONFIG_SND_HDA_POWER_SAVE
1213static const struct hda_amp_list alc880_lg_loopbacks[] = { 1054static const struct hda_amp_list alc880_lg_loopbacks[] = {
1214 { 0x0b, HDA_INPUT, 1 }, 1055 { 0x0b, HDA_INPUT, 1 },
@@ -1505,8 +1346,6 @@ static const char * const alc880_models[ALC880_MODEL_LAST] = {
1505 [ALC880_FUJITSU] = "fujitsu", 1346 [ALC880_FUJITSU] = "fujitsu",
1506 [ALC880_F1734] = "F1734", 1347 [ALC880_F1734] = "F1734",
1507 [ALC880_LG] = "lg", 1348 [ALC880_LG] = "lg",
1508 [ALC880_LG_LW] = "lg-lw",
1509 [ALC880_MEDION_RIM] = "medion",
1510#ifdef CONFIG_SND_DEBUG 1349#ifdef CONFIG_SND_DEBUG
1511 [ALC880_TEST] = "test", 1350 [ALC880_TEST] = "test",
1512#endif 1351#endif
@@ -1557,18 +1396,15 @@ static const struct snd_pci_quirk alc880_cfg_tbl[] = {
1557 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL), 1396 SND_PCI_QUIRK(0x1584, 0x9070, "Uniwill", ALC880_UNIWILL),
1558 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53), 1397 SND_PCI_QUIRK(0x1584, 0x9077, "Uniwill P53", ALC880_UNIWILL_P53),
1559 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810), 1398 SND_PCI_QUIRK(0x161f, 0x203d, "W810", ALC880_W810),
1560 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_MEDION_RIM),
1561 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG), 1399 SND_PCI_QUIRK(0x1695, 0x400d, "EPoX", ALC880_5ST_DIG),
1562 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG), 1400 SND_PCI_QUIRK(0x1695, 0x4012, "EPox EP-5LDA", ALC880_5ST_DIG),
1563 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734), 1401 SND_PCI_QUIRK(0x1734, 0x107c, "FSC F1734", ALC880_F1734),
1564 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU), 1402 SND_PCI_QUIRK(0x1734, 0x1094, "FSC Amilo M1451G", ALC880_FUJITSU),
1565 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734), 1403 SND_PCI_QUIRK(0x1734, 0x10ac, "FSC AMILO Xi 1526", ALC880_F1734),
1566 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU), 1404 SND_PCI_QUIRK(0x1734, 0x10b0, "Fujitsu", ALC880_FUJITSU),
1567 SND_PCI_QUIRK(0x1854, 0x0018, "LG LW20", ALC880_LG_LW),
1568 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG), 1405 SND_PCI_QUIRK(0x1854, 0x003b, "LG", ALC880_LG),
1569 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_LG), 1406 SND_PCI_QUIRK(0x1854, 0x005f, "LG P1 Express", ALC880_LG),
1570 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG), 1407 SND_PCI_QUIRK(0x1854, 0x0068, "LG w1", ALC880_LG),
1571 SND_PCI_QUIRK(0x1854, 0x0077, "LG LW25", ALC880_LG_LW),
1572 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700), 1408 SND_PCI_QUIRK(0x19db, 0x4188, "TCL S700", ALC880_TCL_S700),
1573 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */ 1409 SND_PCI_QUIRK(0x2668, 0x8086, NULL, ALC880_6ST_DIG), /* broken BIOS */
1574 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG), 1410 SND_PCI_QUIRK(0x8086, 0x2668, NULL, ALC880_6ST_DIG),
@@ -1848,35 +1684,6 @@ static const struct alc_config_preset alc880_presets[] = {
1848 .loopbacks = alc880_lg_loopbacks, 1684 .loopbacks = alc880_lg_loopbacks,
1849#endif 1685#endif
1850 }, 1686 },
1851 [ALC880_LG_LW] = {
1852 .mixers = { alc880_lg_lw_mixer },
1853 .init_verbs = { alc880_volume_init_verbs,
1854 alc880_lg_lw_init_verbs },
1855 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
1856 .dac_nids = alc880_dac_nids,
1857 .dig_out_nid = ALC880_DIGOUT_NID,
1858 .num_channel_mode = ARRAY_SIZE(alc880_lg_lw_modes),
1859 .channel_mode = alc880_lg_lw_modes,
1860 .input_mux = &alc880_lg_lw_capture_source,
1861 .unsol_event = alc_sku_unsol_event,
1862 .setup = alc880_lg_lw_setup,
1863 .init_hook = alc_hp_automute,
1864 },
1865 [ALC880_MEDION_RIM] = {
1866 .mixers = { alc880_medion_rim_mixer },
1867 .init_verbs = { alc880_volume_init_verbs,
1868 alc880_medion_rim_init_verbs,
1869 alc_gpio2_init_verbs },
1870 .num_dacs = ARRAY_SIZE(alc880_dac_nids),
1871 .dac_nids = alc880_dac_nids,
1872 .dig_out_nid = ALC880_DIGOUT_NID,
1873 .num_channel_mode = ARRAY_SIZE(alc880_2_jack_modes),
1874 .channel_mode = alc880_2_jack_modes,
1875 .input_mux = &alc880_medion_rim_capture_source,
1876 .unsol_event = alc880_medion_rim_unsol_event,
1877 .setup = alc880_medion_rim_setup,
1878 .init_hook = alc880_medion_rim_automute,
1879 },
1880#ifdef CONFIG_SND_DEBUG 1687#ifdef CONFIG_SND_DEBUG
1881 [ALC880_TEST] = { 1688 [ALC880_TEST] = {
1882 .mixers = { alc880_test_mixer }, 1689 .mixers = { alc880_test_mixer },
diff --git a/sound/pci/hda/alc882_quirks.c b/sound/pci/hda/alc882_quirks.c
index e251514a26a..bdf0ed4ab3e 100644
--- a/sound/pci/hda/alc882_quirks.c
+++ b/sound/pci/hda/alc882_quirks.c
@@ -6,509 +6,15 @@
6/* ALC882 models */ 6/* ALC882 models */
7enum { 7enum {
8 ALC882_AUTO, 8 ALC882_AUTO,
9 ALC882_3ST_DIG,
10 ALC882_6ST_DIG,
11 ALC882_ARIMA,
12 ALC882_W2JC,
13 ALC882_TARGA,
14 ALC882_ASUS_A7J,
15 ALC882_ASUS_A7M,
16 ALC885_MACPRO,
17 ALC885_MBA21, 9 ALC885_MBA21,
18 ALC885_MBP3, 10 ALC885_MBP3,
19 ALC885_MB5, 11 ALC885_MB5,
20 ALC885_MACMINI3, 12 ALC885_MACMINI3,
21 ALC885_IMAC24,
22 ALC885_IMAC91, 13 ALC885_IMAC91,
23 ALC883_3ST_2ch_DIG,
24 ALC883_3ST_6ch_DIG,
25 ALC883_3ST_6ch,
26 ALC883_6ST_DIG,
27 ALC883_TARGA_DIG,
28 ALC883_TARGA_2ch_DIG,
29 ALC883_TARGA_8ch_DIG,
30 ALC883_ACER,
31 ALC883_ACER_ASPIRE,
32 ALC888_ACER_ASPIRE_4930G,
33 ALC888_ACER_ASPIRE_6530G,
34 ALC888_ACER_ASPIRE_8930G,
35 ALC888_ACER_ASPIRE_7730G,
36 ALC883_MEDION,
37 ALC883_MEDION_WIM2160,
38 ALC883_LAPTOP_EAPD,
39 ALC883_LENOVO_101E_2ch,
40 ALC883_LENOVO_NB0763,
41 ALC888_LENOVO_MS7195_DIG,
42 ALC888_LENOVO_SKY,
43 ALC883_HAIER_W66,
44 ALC888_3ST_HP,
45 ALC888_6ST_DELL,
46 ALC883_MITAC,
47 ALC883_CLEVO_M540R,
48 ALC883_CLEVO_M720,
49 ALC883_FUJITSU_PI2515,
50 ALC888_FUJITSU_XA3530,
51 ALC883_3ST_6ch_INTEL,
52 ALC889A_INTEL,
53 ALC889_INTEL,
54 ALC888_ASUS_M90V,
55 ALC888_ASUS_EEE1601,
56 ALC889A_MB31, 14 ALC889A_MB31,
57 ALC1200_ASUS_P5Q,
58 ALC883_SONY_VAIO_TT,
59 ALC882_MODEL_LAST, 15 ALC882_MODEL_LAST,
60}; 16};
61 17
62/*
63 * 2ch mode
64 */
65static const struct hda_verb alc888_4ST_ch2_intel_init[] = {
66/* Mic-in jack as mic in */
67 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
68 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
69/* Line-in jack as Line in */
70 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
71 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
72/* Line-Out as Front */
73 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
74 { } /* end */
75};
76
77/*
78 * 4ch mode
79 */
80static const struct hda_verb alc888_4ST_ch4_intel_init[] = {
81/* Mic-in jack as mic in */
82 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
83 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
84/* Line-in jack as Surround */
85 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
86 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
87/* Line-Out as Front */
88 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
89 { } /* end */
90};
91
92/*
93 * 6ch mode
94 */
95static const struct hda_verb alc888_4ST_ch6_intel_init[] = {
96/* Mic-in jack as CLFE */
97 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
98 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
99/* Line-in jack as Surround */
100 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
101 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
102/* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
103 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
104 { } /* end */
105};
106
107/*
108 * 8ch mode
109 */
110static const struct hda_verb alc888_4ST_ch8_intel_init[] = {
111/* Mic-in jack as CLFE */
112 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
113 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
114/* Line-in jack as Surround */
115 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
116 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
117/* Line-Out as Side */
118 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
119 { } /* end */
120};
121
122static const struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
123 { 2, alc888_4ST_ch2_intel_init },
124 { 4, alc888_4ST_ch4_intel_init },
125 { 6, alc888_4ST_ch6_intel_init },
126 { 8, alc888_4ST_ch8_intel_init },
127};
128
129/*
130 * ALC888 Fujitsu Siemens Amillo xa3530
131 */
132
133static const struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
134/* Front Mic: set to PIN_IN (empty by default) */
135 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
136/* Connect Internal HP to Front */
137 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
138 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
139 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
140/* Connect Bass HP to Front */
141 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
142 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
143 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
144/* Connect Line-Out side jack (SPDIF) to Side */
145 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
146 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
147 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
148/* Connect Mic jack to CLFE */
149 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
150 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
151 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
152/* Connect Line-in jack to Surround */
153 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
154 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
155 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
156/* Connect HP out jack to Front */
157 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
158 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
159 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
160/* Enable unsolicited event for HP jack and Line-out jack */
161 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
162 {0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
163 {}
164};
165
166static void alc889_automute_setup(struct hda_codec *codec)
167{
168 struct alc_spec *spec = codec->spec;
169
170 spec->autocfg.hp_pins[0] = 0x15;
171 spec->autocfg.speaker_pins[0] = 0x14;
172 spec->autocfg.speaker_pins[1] = 0x16;
173 spec->autocfg.speaker_pins[2] = 0x17;
174 spec->autocfg.speaker_pins[3] = 0x19;
175 spec->autocfg.speaker_pins[4] = 0x1a;
176 alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP);
177}
178
179static void alc889_intel_init_hook(struct hda_codec *codec)
180{
181 alc889_coef_init(codec);
182 alc_hp_automute(codec);
183}
184
185static void alc888_fujitsu_xa3530_setup(struct hda_codec *codec)
186{
187 struct alc_spec *spec = codec->spec;
188
189 spec->autocfg.hp_pins[0] = 0x17; /* line-out */
190 spec->autocfg.hp_pins[1] = 0x1b; /* hp */
191 spec->autocfg.speaker_pins[0] = 0x14; /* speaker */
192 spec->autocfg.speaker_pins[1] = 0x15; /* bass */
193 alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP);
194}
195
196/*
197 * ALC888 Acer Aspire 4930G model
198 */
199
200static const struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
201/* Front Mic: set to PIN_IN (empty by default) */
202 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
203/* Unselect Front Mic by default in input mixer 3 */
204 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
205/* Enable unsolicited event for HP jack */
206 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
207/* Connect Internal HP to front */
208 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
209 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
210 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
211/* Connect HP out to front */
212 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
213 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
214 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
215 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
216 { }
217};
218
219/*
220 * ALC888 Acer Aspire 6530G model
221 */
222
223static const struct hda_verb alc888_acer_aspire_6530g_verbs[] = {
224/* Route to built-in subwoofer as well as speakers */
225 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
226 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
227 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
228 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
229/* Bias voltage on for external mic port */
230 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
231/* Front Mic: set to PIN_IN (empty by default) */
232 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
233/* Unselect Front Mic by default in input mixer 3 */
234 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
235/* Enable unsolicited event for HP jack */
236 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
237/* Enable speaker output */
238 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
239 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
240 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
241/* Enable headphone output */
242 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
243 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
244 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
245 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
246 { }
247};
248
249/*
250 *ALC888 Acer Aspire 7730G model
251 */
252
253static const struct hda_verb alc888_acer_aspire_7730G_verbs[] = {
254/* Bias voltage on for external mic port */
255 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN | PIN_VREF80},
256/* Front Mic: set to PIN_IN (empty by default) */
257 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
258/* Unselect Front Mic by default in input mixer 3 */
259 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
260/* Enable unsolicited event for HP jack */
261 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
262/* Enable speaker output */
263 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
264 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
265 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
266/* Enable headphone output */
267 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
268 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
269 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
270 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
271/*Enable internal subwoofer */
272 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
273 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
274 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
275 {0x17, AC_VERB_SET_EAPD_BTLENABLE, 2},
276 { }
277};
278
279/*
280 * ALC889 Acer Aspire 8930G model
281 */
282
283static const struct hda_verb alc889_acer_aspire_8930g_verbs[] = {
284/* Front Mic: set to PIN_IN (empty by default) */
285 {0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
286/* Unselect Front Mic by default in input mixer 3 */
287 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
288/* Enable unsolicited event for HP jack */
289 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
290/* Connect Internal Front to Front */
291 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
292 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
293 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
294/* Connect Internal Rear to Rear */
295 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
296 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
297 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x01},
298/* Connect Internal CLFE to CLFE */
299 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
300 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
301 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
302/* Connect HP out to Front */
303 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT | PIN_HP},
304 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
305 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
306/* Enable all DACs */
307/* DAC DISABLE/MUTE 1? */
308/* setting bits 1-5 disables DAC nids 0x02-0x06 apparently. Init=0x38 */
309 {0x20, AC_VERB_SET_COEF_INDEX, 0x03},
310 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
311/* DAC DISABLE/MUTE 2? */
312/* some bit here disables the other DACs. Init=0x4900 */
313 {0x20, AC_VERB_SET_COEF_INDEX, 0x08},
314 {0x20, AC_VERB_SET_PROC_COEF, 0x0000},
315/* DMIC fix
316 * This laptop has a stereo digital microphone. The mics are only 1cm apart
317 * which makes the stereo useless. However, either the mic or the ALC889
318 * makes the signal become a difference/sum signal instead of standard
319 * stereo, which is annoying. So instead we flip this bit which makes the
320 * codec replicate the sum signal to both channels, turning it into a
321 * normal mono mic.
322 */
323/* DMIC_CONTROL? Init value = 0x0001 */
324 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
325 {0x20, AC_VERB_SET_PROC_COEF, 0x0003},
326 { }
327};
328
329static const struct hda_input_mux alc888_2_capture_sources[2] = {
330 /* Front mic only available on one ADC */
331 {
332 .num_items = 4,
333 .items = {
334 { "Mic", 0x0 },
335 { "Line", 0x2 },
336 { "CD", 0x4 },
337 { "Front Mic", 0xb },
338 },
339 },
340 {
341 .num_items = 3,
342 .items = {
343 { "Mic", 0x0 },
344 { "Line", 0x2 },
345 { "CD", 0x4 },
346 },
347 }
348};
349
350static const struct hda_input_mux alc888_acer_aspire_6530_sources[2] = {
351 /* Interal mic only available on one ADC */
352 {
353 .num_items = 5,
354 .items = {
355 { "Mic", 0x0 },
356 { "Line In", 0x2 },
357 { "CD", 0x4 },
358 { "Input Mix", 0xa },
359 { "Internal Mic", 0xb },
360 },
361 },
362 {
363 .num_items = 4,
364 .items = {
365 { "Mic", 0x0 },
366 { "Line In", 0x2 },
367 { "CD", 0x4 },
368 { "Input Mix", 0xa },
369 },
370 }
371};
372
373static const struct hda_input_mux alc889_capture_sources[3] = {
374 /* Digital mic only available on first "ADC" */
375 {
376 .num_items = 5,
377 .items = {
378 { "Mic", 0x0 },
379 { "Line", 0x2 },
380 { "CD", 0x4 },
381 { "Front Mic", 0xb },
382 { "Input Mix", 0xa },
383 },
384 },
385 {
386 .num_items = 4,
387 .items = {
388 { "Mic", 0x0 },
389 { "Line", 0x2 },
390 { "CD", 0x4 },
391 { "Input Mix", 0xa },
392 },
393 },
394 {
395 .num_items = 4,
396 .items = {
397 { "Mic", 0x0 },
398 { "Line", 0x2 },
399 { "CD", 0x4 },
400 { "Input Mix", 0xa },
401 },
402 }
403};
404
405static const struct snd_kcontrol_new alc888_base_mixer[] = {
406 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
407 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
408 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
409 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
410 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
411 HDA_OUTPUT),
412 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
413 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
414 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
415 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
416 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
417 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
418 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
419 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
420 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
421 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
422 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
423 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
424 { } /* end */
425};
426
427static const struct snd_kcontrol_new alc888_acer_aspire_4930g_mixer[] = {
428 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
429 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
430 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
431 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
432 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
433 HDA_OUTPUT),
434 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
435 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
436 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
437 HDA_CODEC_VOLUME_MONO("Internal LFE Playback Volume", 0x0f, 1, 0x0, HDA_OUTPUT),
438 HDA_BIND_MUTE_MONO("Internal LFE Playback Switch", 0x0f, 1, 2, HDA_INPUT),
439 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
440 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
441 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
442 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
443 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
444 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
445 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
446 { } /* end */
447};
448
449static const struct snd_kcontrol_new alc889_acer_aspire_8930g_mixer[] = {
450 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
451 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
452 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
453 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
454 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
455 HDA_OUTPUT),
456 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
457 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
458 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
459 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
460 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
461 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
462 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
463 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
464 { } /* end */
465};
466
467
468static void alc888_acer_aspire_4930g_setup(struct hda_codec *codec)
469{
470 struct alc_spec *spec = codec->spec;
471
472 spec->autocfg.hp_pins[0] = 0x15;
473 spec->autocfg.speaker_pins[0] = 0x14;
474 spec->autocfg.speaker_pins[1] = 0x16;
475 spec->autocfg.speaker_pins[2] = 0x17;
476 alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP);
477}
478
479static void alc888_acer_aspire_6530g_setup(struct hda_codec *codec)
480{
481 struct alc_spec *spec = codec->spec;
482
483 spec->autocfg.hp_pins[0] = 0x15;
484 spec->autocfg.speaker_pins[0] = 0x14;
485 spec->autocfg.speaker_pins[1] = 0x16;
486 spec->autocfg.speaker_pins[2] = 0x17;
487 alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP);
488}
489
490static void alc888_acer_aspire_7730g_setup(struct hda_codec *codec)
491{
492 struct alc_spec *spec = codec->spec;
493
494 spec->autocfg.hp_pins[0] = 0x15;
495 spec->autocfg.speaker_pins[0] = 0x14;
496 spec->autocfg.speaker_pins[1] = 0x16;
497 spec->autocfg.speaker_pins[2] = 0x17;
498 alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP);
499}
500
501static void alc889_acer_aspire_8930g_setup(struct hda_codec *codec)
502{
503 struct alc_spec *spec = codec->spec;
504
505 spec->autocfg.hp_pins[0] = 0x15;
506 spec->autocfg.speaker_pins[0] = 0x14;
507 spec->autocfg.speaker_pins[1] = 0x16;
508 spec->autocfg.speaker_pins[2] = 0x1b;
509 alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP);
510}
511
512#define ALC882_DIGOUT_NID 0x06 18#define ALC882_DIGOUT_NID 0x06
513#define ALC882_DIGIN_NID 0x0a 19#define ALC882_DIGIN_NID 0x0a
514#define ALC883_DIGOUT_NID ALC882_DIGOUT_NID 20#define ALC883_DIGOUT_NID ALC882_DIGOUT_NID
@@ -531,15 +37,9 @@ static const hda_nid_t alc882_dac_nids[4] = {
531#define alc882_adc_nids alc880_adc_nids 37#define alc882_adc_nids alc880_adc_nids
532#define alc882_adc_nids_alt alc880_adc_nids_alt 38#define alc882_adc_nids_alt alc880_adc_nids_alt
533#define alc883_adc_nids alc882_adc_nids_alt 39#define alc883_adc_nids alc882_adc_nids_alt
534static const hda_nid_t alc883_adc_nids_alt[1] = { 0x08 };
535static const hda_nid_t alc883_adc_nids_rev[2] = { 0x09, 0x08 };
536#define alc889_adc_nids alc880_adc_nids
537 40
538static const hda_nid_t alc882_capsrc_nids[3] = { 0x24, 0x23, 0x22 };
539static const hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 }; 41static const hda_nid_t alc882_capsrc_nids_alt[2] = { 0x23, 0x22 };
540#define alc883_capsrc_nids alc882_capsrc_nids_alt 42#define alc883_capsrc_nids alc882_capsrc_nids_alt
541static const hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
542#define alc889_capsrc_nids alc882_capsrc_nids
543 43
544/* input MUX */ 44/* input MUX */
545/* FIXME: should be a matrix-type input source selection */ 45/* FIXME: should be a matrix-type input source selection */
@@ -556,15 +56,6 @@ static const struct hda_input_mux alc882_capture_source = {
556 56
557#define alc883_capture_source alc882_capture_source 57#define alc883_capture_source alc882_capture_source
558 58
559static const struct hda_input_mux alc889_capture_source = {
560 .num_items = 3,
561 .items = {
562 { "Front Mic", 0x0 },
563 { "Mic", 0x3 },
564 { "Line", 0x2 },
565 },
566};
567
568static const struct hda_input_mux mb5_capture_source = { 59static const struct hda_input_mux mb5_capture_source = {
569 .num_items = 3, 60 .num_items = 3,
570 .items = { 61 .items = {
@@ -592,49 +83,6 @@ static const struct hda_input_mux alc883_3stack_6ch_intel = {
592 }, 83 },
593}; 84};
594 85
595static const struct hda_input_mux alc883_lenovo_101e_capture_source = {
596 .num_items = 2,
597 .items = {
598 { "Mic", 0x1 },
599 { "Line", 0x2 },
600 },
601};
602
603static const struct hda_input_mux alc883_lenovo_nb0763_capture_source = {
604 .num_items = 4,
605 .items = {
606 { "Mic", 0x0 },
607 { "Internal Mic", 0x1 },
608 { "Line", 0x2 },
609 { "CD", 0x4 },
610 },
611};
612
613static const struct hda_input_mux alc883_fujitsu_pi2515_capture_source = {
614 .num_items = 2,
615 .items = {
616 { "Mic", 0x0 },
617 { "Internal Mic", 0x1 },
618 },
619};
620
621static const struct hda_input_mux alc883_lenovo_sky_capture_source = {
622 .num_items = 3,
623 .items = {
624 { "Mic", 0x0 },
625 { "Front Mic", 0x1 },
626 { "Line", 0x4 },
627 },
628};
629
630static const struct hda_input_mux alc883_asus_eee1601_capture_source = {
631 .num_items = 2,
632 .items = {
633 { "Mic", 0x0 },
634 { "Line", 0x2 },
635 },
636};
637
638static const struct hda_input_mux alc889A_mb31_capture_source = { 86static const struct hda_input_mux alc889A_mb31_capture_source = {
639 .num_items = 2, 87 .num_items = 2,
640 .items = { 88 .items = {
@@ -654,131 +102,6 @@ static const struct hda_input_mux alc889A_imac91_capture_source = {
654 }, 102 },
655}; 103};
656 104
657/*
658 * 2ch mode
659 */
660static const struct hda_channel_mode alc883_3ST_2ch_modes[1] = {
661 { 2, NULL }
662};
663
664/*
665 * 2ch mode
666 */
667static const struct hda_verb alc882_3ST_ch2_init[] = {
668 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
669 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
670 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
671 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
672 { } /* end */
673};
674
675/*
676 * 4ch mode
677 */
678static const struct hda_verb alc882_3ST_ch4_init[] = {
679 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
680 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
681 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
682 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
683 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
684 { } /* end */
685};
686
687/*
688 * 6ch mode
689 */
690static const struct hda_verb alc882_3ST_ch6_init[] = {
691 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
692 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
693 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
694 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
695 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
696 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
697 { } /* end */
698};
699
700static const struct hda_channel_mode alc882_3ST_6ch_modes[3] = {
701 { 2, alc882_3ST_ch2_init },
702 { 4, alc882_3ST_ch4_init },
703 { 6, alc882_3ST_ch6_init },
704};
705
706#define alc883_3ST_6ch_modes alc882_3ST_6ch_modes
707
708/*
709 * 2ch mode
710 */
711static const struct hda_verb alc883_3ST_ch2_clevo_init[] = {
712 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP },
713 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
714 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
715 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
716 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
717 { } /* end */
718};
719
720/*
721 * 4ch mode
722 */
723static const struct hda_verb alc883_3ST_ch4_clevo_init[] = {
724 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
725 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
726 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
727 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
728 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
729 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
730 { } /* end */
731};
732
733/*
734 * 6ch mode
735 */
736static const struct hda_verb alc883_3ST_ch6_clevo_init[] = {
737 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
738 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
739 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
740 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
741 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
742 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
743 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
744 { } /* end */
745};
746
747static const struct hda_channel_mode alc883_3ST_6ch_clevo_modes[3] = {
748 { 2, alc883_3ST_ch2_clevo_init },
749 { 4, alc883_3ST_ch4_clevo_init },
750 { 6, alc883_3ST_ch6_clevo_init },
751};
752
753
754/*
755 * 6ch mode
756 */
757static const struct hda_verb alc882_sixstack_ch6_init[] = {
758 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
759 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
760 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
761 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
762 { } /* end */
763};
764
765/*
766 * 8ch mode
767 */
768static const struct hda_verb alc882_sixstack_ch8_init[] = {
769 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
770 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
771 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
772 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
773 { } /* end */
774};
775
776static const struct hda_channel_mode alc882_sixstack_modes[2] = {
777 { 6, alc882_sixstack_ch6_init },
778 { 8, alc882_sixstack_ch8_init },
779};
780
781
782/* Macbook Air 2,1 */ 105/* Macbook Air 2,1 */
783 106
784static const struct hda_channel_mode alc885_mba21_ch_modes[1] = { 107static const struct hda_channel_mode alc885_mba21_ch_modes[1] = {
@@ -847,216 +170,6 @@ static const struct hda_channel_mode alc885_mb5_6ch_modes[2] = {
847 170
848#define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes 171#define alc885_macmini3_6ch_modes alc885_mb5_6ch_modes
849 172
850/*
851 * 2ch mode
852 */
853static const struct hda_verb alc883_4ST_ch2_init[] = {
854 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
855 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
856 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
857 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
858 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
859 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
860 { } /* end */
861};
862
863/*
864 * 4ch mode
865 */
866static const struct hda_verb alc883_4ST_ch4_init[] = {
867 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
868 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
869 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
870 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
871 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
872 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
873 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
874 { } /* end */
875};
876
877/*
878 * 6ch mode
879 */
880static const struct hda_verb alc883_4ST_ch6_init[] = {
881 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
882 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
883 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
884 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
885 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
886 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
887 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
888 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
889 { } /* end */
890};
891
892/*
893 * 8ch mode
894 */
895static const struct hda_verb alc883_4ST_ch8_init[] = {
896 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
897 { 0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
898 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
899 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
900 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
901 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
902 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
903 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
904 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
905 { } /* end */
906};
907
908static const struct hda_channel_mode alc883_4ST_8ch_modes[4] = {
909 { 2, alc883_4ST_ch2_init },
910 { 4, alc883_4ST_ch4_init },
911 { 6, alc883_4ST_ch6_init },
912 { 8, alc883_4ST_ch8_init },
913};
914
915
916/*
917 * 2ch mode
918 */
919static const struct hda_verb alc883_3ST_ch2_intel_init[] = {
920 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
921 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
922 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
923 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
924 { } /* end */
925};
926
927/*
928 * 4ch mode
929 */
930static const struct hda_verb alc883_3ST_ch4_intel_init[] = {
931 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
932 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
933 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
934 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
935 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
936 { } /* end */
937};
938
939/*
940 * 6ch mode
941 */
942static const struct hda_verb alc883_3ST_ch6_intel_init[] = {
943 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
944 { 0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
945 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x02 },
946 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
947 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
948 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x01 },
949 { } /* end */
950};
951
952static const struct hda_channel_mode alc883_3ST_6ch_intel_modes[3] = {
953 { 2, alc883_3ST_ch2_intel_init },
954 { 4, alc883_3ST_ch4_intel_init },
955 { 6, alc883_3ST_ch6_intel_init },
956};
957
958/*
959 * 2ch mode
960 */
961static const struct hda_verb alc889_ch2_intel_init[] = {
962 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
963 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x00 },
964 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x00 },
965 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x00 },
966 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
967 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
968 { } /* end */
969};
970
971/*
972 * 6ch mode
973 */
974static const struct hda_verb alc889_ch6_intel_init[] = {
975 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
976 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
977 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
978 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
979 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
980 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
981 { } /* end */
982};
983
984/*
985 * 8ch mode
986 */
987static const struct hda_verb alc889_ch8_intel_init[] = {
988 { 0x14, AC_VERB_SET_CONNECT_SEL, 0x00 },
989 { 0x19, AC_VERB_SET_CONNECT_SEL, 0x01 },
990 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x02 },
991 { 0x17, AC_VERB_SET_CONNECT_SEL, 0x03 },
992 { 0x1a, AC_VERB_SET_CONNECT_SEL, 0x03 },
993 { 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
994 { 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
995 { } /* end */
996};
997
998static const struct hda_channel_mode alc889_8ch_intel_modes[3] = {
999 { 2, alc889_ch2_intel_init },
1000 { 6, alc889_ch6_intel_init },
1001 { 8, alc889_ch8_intel_init },
1002};
1003
1004/*
1005 * 6ch mode
1006 */
1007static const struct hda_verb alc883_sixstack_ch6_init[] = {
1008 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, 0x00 },
1009 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1010 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1011 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1012 { } /* end */
1013};
1014
1015/*
1016 * 8ch mode
1017 */
1018static const struct hda_verb alc883_sixstack_ch8_init[] = {
1019 { 0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1020 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1021 { 0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1022 { 0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
1023 { } /* end */
1024};
1025
1026static const struct hda_channel_mode alc883_sixstack_modes[2] = {
1027 { 6, alc883_sixstack_ch6_init },
1028 { 8, alc883_sixstack_ch8_init },
1029};
1030
1031
1032/* Pin assignment: Front=0x14, Rear=0x15, CLFE=0x16, Side=0x17
1033 * Mic=0x18, Front Mic=0x19, Line-In=0x1a, HP=0x1b
1034 */
1035static const struct snd_kcontrol_new alc882_base_mixer[] = {
1036 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1037 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1038 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1039 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
1040 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1041 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1042 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1043 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1044 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
1045 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
1046 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1047 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1048 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1049 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1050 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1051 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1052 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
1053 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1054 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1055 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
1056 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1057 { } /* end */
1058};
1059
1060/* Macbook Air 2,1 same control for HP and internal Speaker */ 173/* Macbook Air 2,1 same control for HP and internal Speaker */
1061 174
1062static const struct snd_kcontrol_new alc885_mba21_mixer[] = { 175static const struct snd_kcontrol_new alc885_mba21_mixer[] = {
@@ -1121,70 +234,6 @@ static const struct snd_kcontrol_new alc885_imac91_mixer[] = {
1121}; 234};
1122 235
1123 236
1124static const struct snd_kcontrol_new alc882_w2jc_mixer[] = {
1125 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1126 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1127 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1128 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1129 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1130 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1131 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1132 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
1133 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1134 { } /* end */
1135};
1136
1137static const struct snd_kcontrol_new alc882_targa_mixer[] = {
1138 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1139 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1140 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1141 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1142 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1143 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1144 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1145 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1146 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1147 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
1148 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1149 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1150 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
1151 { } /* end */
1152};
1153
1154/* Pin assignment: Front=0x14, HP = 0x15, Front = 0x16, ???
1155 * Front Mic=0x18, Line In = 0x1a, Line In = 0x1b, CD = 0x1c
1156 */
1157static const struct snd_kcontrol_new alc882_asus_a7j_mixer[] = {
1158 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1159 HDA_CODEC_MUTE("Front Playback Switch", 0x14, 0x0, HDA_OUTPUT),
1160 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
1161 HDA_CODEC_MUTE("Mobile Front Playback Switch", 0x16, 0x0, HDA_OUTPUT),
1162 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1163 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1164 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1165 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1166 HDA_CODEC_VOLUME("Mobile Line Playback Volume", 0x0b, 0x03, HDA_INPUT),
1167 HDA_CODEC_MUTE("Mobile Line Playback Switch", 0x0b, 0x03, HDA_INPUT),
1168 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1169 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1170 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
1171 { } /* end */
1172};
1173
1174static const struct snd_kcontrol_new alc882_asus_a7m_mixer[] = {
1175 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1176 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1177 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
1178 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1179 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1180 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1181 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1182 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1183 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
1184 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1185 { } /* end */
1186};
1187
1188static const struct snd_kcontrol_new alc882_chmode_mixer[] = { 237static const struct snd_kcontrol_new alc882_chmode_mixer[] = {
1189 { 238 {
1190 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 239 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
@@ -1258,179 +307,8 @@ static const struct hda_verb alc882_base_init_verbs[] = {
1258 { } 307 { }
1259}; 308};
1260 309
1261static const struct hda_verb alc882_adc1_init_verbs[] = {
1262 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
1263 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1264 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
1265 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
1266 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
1267 /* ADC1: mute amp left and right */
1268 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1269 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
1270 { }
1271};
1272
1273static const struct hda_verb alc882_eapd_verbs[] = {
1274 /* change to EAPD mode */
1275 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
1276 {0x20, AC_VERB_SET_PROC_COEF, 0x3060},
1277 { }
1278};
1279
1280static const struct hda_verb alc889_eapd_verbs[] = {
1281 {0x14, AC_VERB_SET_EAPD_BTLENABLE, 2},
1282 {0x15, AC_VERB_SET_EAPD_BTLENABLE, 2},
1283 { }
1284};
1285
1286static const struct hda_verb alc_hp15_unsol_verbs[] = {
1287 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
1288 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1289 {}
1290};
1291
1292static const struct hda_verb alc885_init_verbs[] = {
1293 /* Front mixer: unmute input/output amp left and right (volume = 0) */
1294 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1295 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1296 /* Rear mixer */
1297 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1298 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1299 /* CLFE mixer */
1300 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1301 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1302 /* Side mixer */
1303 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1304 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1305
1306 /* Front HP Pin: output 0 (0x0c) */
1307 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1308 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1309 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1310 /* Front Pin: output 0 (0x0c) */
1311 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1312 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1313 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1314 /* Rear Pin: output 1 (0x0d) */
1315 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1316 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1317 {0x19, AC_VERB_SET_CONNECT_SEL, 0x01},
1318 /* CLFE Pin: output 2 (0x0e) */
1319 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1320 {0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1321 {0x16, AC_VERB_SET_CONNECT_SEL, 0x02},
1322 /* Side Pin: output 3 (0x0f) */
1323 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1324 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1325 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
1326 /* Mic (rear) pin: input vref at 80% */
1327 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1328 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1329 /* Front Mic pin: input vref at 80% */
1330 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1331 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1332 /* Line In pin: input */
1333 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
1334 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1335
1336 /* Mixer elements: 0x18, , 0x1a, 0x1b */
1337 /* Input mixer1 */
1338 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1339 /* Input mixer2 */
1340 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1341 /* Input mixer3 */
1342 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1343 /* ADC2: mute amp left and right */
1344 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1345 /* ADC3: mute amp left and right */
1346 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1347
1348 { }
1349};
1350
1351static const struct hda_verb alc885_init_input_verbs[] = {
1352 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1353 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(2)},
1354 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(3)},
1355 { }
1356};
1357
1358
1359/* Unmute Selector 24h and set the default input to front mic */
1360static const struct hda_verb alc889_init_input_verbs[] = {
1361 {0x24, AC_VERB_SET_CONNECT_SEL, 0x00},
1362 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1363 { }
1364};
1365
1366
1367#define alc883_init_verbs alc882_base_init_verbs 310#define alc883_init_verbs alc882_base_init_verbs
1368 311
1369/* Mac Pro test */
1370static const struct snd_kcontrol_new alc882_macpro_mixer[] = {
1371 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1372 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1373 HDA_CODEC_MUTE("Headphone Playback Switch", 0x18, 0x0, HDA_OUTPUT),
1374 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x01, HDA_INPUT),
1375 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x01, HDA_INPUT),
1376 /* FIXME: this looks suspicious...
1377 HDA_CODEC_VOLUME("Beep Playback Volume", 0x0b, 0x02, HDA_INPUT),
1378 HDA_CODEC_MUTE("Beep Playback Switch", 0x0b, 0x02, HDA_INPUT),
1379 */
1380 { } /* end */
1381};
1382
1383static const struct hda_verb alc882_macpro_init_verbs[] = {
1384 /* Front mixer: unmute input/output amp left and right (volume = 0) */
1385 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_ZERO},
1386 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1387 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
1388 /* Front Pin: output 0 (0x0c) */
1389 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1390 {0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1391 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
1392 /* Front Mic pin: input vref at 80% */
1393 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1394 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1395 /* Speaker: output */
1396 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1397 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1398 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x04},
1399 /* Headphone output (output 0 - 0x0c) */
1400 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1401 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1402 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
1403
1404 /* FIXME: use matrix-type input source selection */
1405 /* Mixer elements: 0x18, 19, 1a, 1b, 1c, 1d, 14, 15, 16, 17, 0b */
1406 /* Input mixer1: unmute Mic, F-Mic, Line, CD inputs */
1407 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1408 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
1409 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
1410 {0x24, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
1411 /* Input mixer2 */
1412 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1413 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
1414 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
1415 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
1416 /* Input mixer3 */
1417 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1418 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(3)},
1419 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(2)},
1420 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(4)},
1421 /* ADC1: mute amp left and right */
1422 {0x07, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1423 {0x07, AC_VERB_SET_CONNECT_SEL, 0x00},
1424 /* ADC2: mute amp left and right */
1425 {0x08, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1426 {0x08, AC_VERB_SET_CONNECT_SEL, 0x00},
1427 /* ADC3: mute amp left and right */
1428 {0x09, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
1429 {0x09, AC_VERB_SET_CONNECT_SEL, 0x00},
1430
1431 { }
1432};
1433
1434/* Macbook 5,1 */ 312/* Macbook 5,1 */
1435static const struct hda_verb alc885_mb5_init_verbs[] = { 313static const struct hda_verb alc885_mb5_init_verbs[] = {
1436 /* DACs */ 314 /* DACs */
@@ -1669,34 +547,6 @@ static const struct hda_verb alc885_imac91_init_verbs[] = {
1669 { } 547 { }
1670}; 548};
1671 549
1672/* iMac 24 mixer. */
1673static const struct snd_kcontrol_new alc885_imac24_mixer[] = {
1674 HDA_CODEC_VOLUME("Master Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
1675 HDA_CODEC_MUTE("Master Playback Switch", 0x0c, 0x00, HDA_INPUT),
1676 { } /* end */
1677};
1678
1679/* iMac 24 init verbs. */
1680static const struct hda_verb alc885_imac24_init_verbs[] = {
1681 /* Internal speakers: output 0 (0x0c) */
1682 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1683 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1684 {0x18, AC_VERB_SET_CONNECT_SEL, 0x00},
1685 /* Internal speakers: output 0 (0x0c) */
1686 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1687 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1688 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
1689 /* Headphone: output 0 (0x0c) */
1690 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1691 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
1692 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
1693 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
1694 /* Front Mic: input vref at 80% */
1695 {0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80},
1696 {0x19, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},
1697 { }
1698};
1699
1700/* Toggle speaker-output according to the hp-jack state */ 550/* Toggle speaker-output according to the hp-jack state */
1701static void alc885_imac24_setup(struct hda_codec *codec) 551static void alc885_imac24_setup(struct hda_codec *codec)
1702{ 552{
@@ -1742,127 +592,6 @@ static void alc885_imac91_setup(struct hda_codec *codec)
1742 alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP); 592 alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP);
1743} 593}
1744 594
1745static const struct hda_verb alc882_targa_verbs[] = {
1746 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1747 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1748
1749 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1750 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1751
1752 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
1753 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
1754 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1755
1756 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
1757 { } /* end */
1758};
1759
1760/* toggle speaker-output according to the hp-jack state */
1761static void alc882_targa_automute(struct hda_codec *codec)
1762{
1763 struct alc_spec *spec = codec->spec;
1764 alc_hp_automute(codec);
1765 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
1766 spec->hp_jack_present ? 1 : 3);
1767}
1768
1769static void alc882_targa_setup(struct hda_codec *codec)
1770{
1771 struct alc_spec *spec = codec->spec;
1772
1773 spec->autocfg.hp_pins[0] = 0x14;
1774 spec->autocfg.speaker_pins[0] = 0x1b;
1775 alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP);
1776}
1777
1778static void alc882_targa_unsol_event(struct hda_codec *codec, unsigned int res)
1779{
1780 if ((res >> 26) == ALC_HP_EVENT)
1781 alc882_targa_automute(codec);
1782}
1783
1784static const struct hda_verb alc882_asus_a7j_verbs[] = {
1785 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1786 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1787
1788 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1789 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1790 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1791
1792 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
1793 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1794 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
1795
1796 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
1797 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
1798 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1799 { } /* end */
1800};
1801
1802static const struct hda_verb alc882_asus_a7m_verbs[] = {
1803 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
1804 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
1805
1806 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
1807 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1808 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
1809
1810 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
1811 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1812 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front */
1813
1814 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* mic/clfe */
1815 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01}, /* line/surround */
1816 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP */
1817 { } /* end */
1818};
1819
1820static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
1821{
1822 unsigned int gpiostate, gpiomask, gpiodir;
1823
1824 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
1825 AC_VERB_GET_GPIO_DATA, 0);
1826
1827 if (!muted)
1828 gpiostate |= (1 << pin);
1829 else
1830 gpiostate &= ~(1 << pin);
1831
1832 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
1833 AC_VERB_GET_GPIO_MASK, 0);
1834 gpiomask |= (1 << pin);
1835
1836 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
1837 AC_VERB_GET_GPIO_DIRECTION, 0);
1838 gpiodir |= (1 << pin);
1839
1840
1841 snd_hda_codec_write(codec, codec->afg, 0,
1842 AC_VERB_SET_GPIO_MASK, gpiomask);
1843 snd_hda_codec_write(codec, codec->afg, 0,
1844 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
1845
1846 msleep(1);
1847
1848 snd_hda_codec_write(codec, codec->afg, 0,
1849 AC_VERB_SET_GPIO_DATA, gpiostate);
1850}
1851
1852/* set up GPIO at initialization */
1853static void alc885_macpro_init_hook(struct hda_codec *codec)
1854{
1855 alc882_gpio_mute(codec, 0, 0);
1856 alc882_gpio_mute(codec, 1, 0);
1857}
1858
1859/* set up GPIO and update auto-muting at initialization */
1860static void alc885_imac24_init_hook(struct hda_codec *codec)
1861{
1862 alc885_macpro_init_hook(codec);
1863 alc_hp_automute(codec);
1864}
1865
1866/* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */ 595/* 2ch mode (Speaker:front, Subwoofer:CLFE, Line:input, Headphones:front) */
1867static const struct hda_verb alc889A_mb31_ch2_init[] = { 596static const struct hda_verb alc889A_mb31_ch2_init[] = {
1868 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */ 597 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00}, /* HP as front */
@@ -1906,77 +635,6 @@ static const struct hda_channel_mode alc889A_mb31_6ch_modes[4] = {
1906 { 6, alc889A_mb31_ch6_init }, 635 { 6, alc889A_mb31_ch6_init },
1907}; 636};
1908 637
1909static const struct hda_verb alc883_medion_eapd_verbs[] = {
1910 /* eanable EAPD on medion laptop */
1911 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
1912 {0x20, AC_VERB_SET_PROC_COEF, 0x3070},
1913 { }
1914};
1915
1916#define alc883_base_mixer alc882_base_mixer
1917
1918static const struct snd_kcontrol_new alc883_mitac_mixer[] = {
1919 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1920 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1921 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
1922 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
1923 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
1924 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
1925 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
1926 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1927 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
1928 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1929 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1930 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
1931 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1932 { } /* end */
1933};
1934
1935static const struct snd_kcontrol_new alc883_clevo_m720_mixer[] = {
1936 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1937 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1938 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1939 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1940 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1941 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
1942 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1943 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1944 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
1945 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1946 { } /* end */
1947};
1948
1949static const struct snd_kcontrol_new alc883_2ch_fujitsu_pi2515_mixer[] = {
1950 HDA_CODEC_VOLUME("Headphone Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1951 HDA_BIND_MUTE("Headphone Playback Switch", 0x0c, 2, HDA_INPUT),
1952 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
1953 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
1954 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1955 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
1956 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1957 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1958 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
1959 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1960 { } /* end */
1961};
1962
1963static const struct snd_kcontrol_new alc883_3ST_2ch_mixer[] = {
1964 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1965 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
1966 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
1967 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
1968 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
1969 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
1970 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
1971 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
1972 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
1973 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
1974 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
1975 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
1976 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
1977 { } /* end */
1978};
1979
1980static const struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = { 638static const struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
1981 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT), 639 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
1982 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT), 640 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
@@ -2000,235 +658,6 @@ static const struct snd_kcontrol_new alc883_3ST_6ch_mixer[] = {
2000 { } /* end */ 658 { } /* end */
2001}; 659};
2002 660
2003static const struct snd_kcontrol_new alc883_3ST_6ch_intel_mixer[] = {
2004 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2005 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2006 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2007 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2008 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
2009 HDA_OUTPUT),
2010 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2011 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2012 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2013 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
2014 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2015 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2016 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2017 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2018 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2019 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT),
2020 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2021 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2022 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT),
2023 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2024 { } /* end */
2025};
2026
2027static const struct snd_kcontrol_new alc885_8ch_intel_mixer[] = {
2028 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2029 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2030 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2031 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2032 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
2033 HDA_OUTPUT),
2034 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2035 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2036 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2037 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2038 HDA_BIND_MUTE("Speaker Playback Switch", 0x0f, 2, HDA_INPUT),
2039 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
2040 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2041 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2042 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x3, HDA_INPUT),
2043 HDA_CODEC_VOLUME("Mic Boost Volume", 0x1b, 0, HDA_INPUT),
2044 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x3, HDA_INPUT),
2045 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2046 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x18, 0, HDA_INPUT),
2047 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2048 { } /* end */
2049};
2050
2051static const struct snd_kcontrol_new alc883_fivestack_mixer[] = {
2052 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2053 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2054 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2055 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2056 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2057 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2058 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2059 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2060 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2061 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2062 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2063 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2064 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2065 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2066 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
2067 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2068 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2069 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
2070 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2071 { } /* end */
2072};
2073
2074static const struct snd_kcontrol_new alc883_targa_mixer[] = {
2075 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2076 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2077 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2078 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2079 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2080 HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
2081 HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
2082 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
2083 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
2084 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
2085 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2086 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2087 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2088 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2089 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2090 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
2091 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2092 { } /* end */
2093};
2094
2095static const struct snd_kcontrol_new alc883_targa_2ch_mixer[] = {
2096 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2097 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2098 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2099 HDA_CODEC_MUTE("Speaker Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2100 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2101 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2102 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2103 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
2104 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2105 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2106 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
2107 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2108 { } /* end */
2109};
2110
2111static const struct snd_kcontrol_new alc883_targa_8ch_mixer[] = {
2112 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2113 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2114 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2115 HDA_CODEC_VOLUME("Internal Mic Boost Volume", 0x19, 0, HDA_INPUT),
2116 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2117 { } /* end */
2118};
2119
2120static const struct snd_kcontrol_new alc883_lenovo_101e_2ch_mixer[] = {
2121 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2122 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2123 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
2124 HDA_BIND_MUTE("Speaker Playback Switch", 0x0d, 2, HDA_INPUT),
2125 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1b, 0x0, HDA_OUTPUT),
2126 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2127 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
2128 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2129 { } /* end */
2130};
2131
2132static const struct snd_kcontrol_new alc883_lenovo_nb0763_mixer[] = {
2133 HDA_CODEC_VOLUME("Speaker Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2134 HDA_BIND_MUTE("Speaker Playback Switch", 0x0c, 2, HDA_INPUT),
2135 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2136 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2137 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2138 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2139 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2140 HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2141 HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2142 { } /* end */
2143};
2144
2145static const struct snd_kcontrol_new alc883_medion_wim2160_mixer[] = {
2146 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2147 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2148 HDA_CODEC_MUTE("Speaker Playback Switch", 0x15, 0x0, HDA_OUTPUT),
2149 HDA_CODEC_MUTE("Headphone Playback Switch", 0x1a, 0x0, HDA_OUTPUT),
2150 HDA_CODEC_VOLUME("Line Playback Volume", 0x08, 0x0, HDA_INPUT),
2151 HDA_CODEC_MUTE("Line Playback Switch", 0x08, 0x0, HDA_INPUT),
2152 { } /* end */
2153};
2154
2155static const struct hda_verb alc883_medion_wim2160_verbs[] = {
2156 /* Unmute front mixer */
2157 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2158 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2159
2160 /* Set speaker pin to front mixer */
2161 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2162
2163 /* Init headphone pin */
2164 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2165 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2166 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
2167 {0x1a, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
2168
2169 { } /* end */
2170};
2171
2172/* toggle speaker-output according to the hp-jack state */
2173static void alc883_medion_wim2160_setup(struct hda_codec *codec)
2174{
2175 struct alc_spec *spec = codec->spec;
2176
2177 spec->autocfg.hp_pins[0] = 0x1a;
2178 spec->autocfg.speaker_pins[0] = 0x15;
2179 alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP);
2180}
2181
2182static const struct snd_kcontrol_new alc883_acer_aspire_mixer[] = {
2183 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2184 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2185 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2186 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2187 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2188 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2189 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
2190 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2191 { } /* end */
2192};
2193
2194static const struct snd_kcontrol_new alc888_acer_aspire_6530_mixer[] = {
2195 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2196 HDA_CODEC_VOLUME("LFE Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2197 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2198 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2199 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2200 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2201 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2202 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
2203 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2204 { } /* end */
2205};
2206
2207static const struct snd_kcontrol_new alc888_lenovo_sky_mixer[] = {
2208 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2209 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2210 HDA_CODEC_VOLUME("Surround Playback Volume", 0x0e, 0x0, HDA_OUTPUT),
2211 HDA_BIND_MUTE("Surround Playback Switch", 0x0e, 2, HDA_INPUT),
2212 HDA_CODEC_VOLUME_MONO("Center Playback Volume",
2213 0x0d, 1, 0x0, HDA_OUTPUT),
2214 HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0d, 2, 0x0, HDA_OUTPUT),
2215 HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0d, 1, 2, HDA_INPUT),
2216 HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0d, 2, 2, HDA_INPUT),
2217 HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
2218 HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
2219 HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
2220 HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
2221 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2222 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2223 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2224 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
2225 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2226 HDA_CODEC_VOLUME("Front Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2227 HDA_CODEC_VOLUME("Front Mic Boost Volume", 0x19, 0, HDA_INPUT),
2228 HDA_CODEC_MUTE("Front Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2229 { } /* end */
2230};
2231
2232static const struct snd_kcontrol_new alc889A_mb31_mixer[] = { 661static const struct snd_kcontrol_new alc889A_mb31_mixer[] = {
2233 /* Output mixers */ 662 /* Output mixers */
2234 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT), 663 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x00, HDA_OUTPUT),
@@ -2255,61 +684,6 @@ static const struct snd_kcontrol_new alc889A_mb31_mixer[] = {
2255 { } /* end */ 684 { } /* end */
2256}; 685};
2257 686
2258static const struct snd_kcontrol_new alc883_vaiott_mixer[] = {
2259 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2260 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2261 HDA_CODEC_MUTE("Headphone Playback Switch", 0x15, 0x0, HDA_OUTPUT),
2262 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x1, HDA_INPUT),
2263 HDA_CODEC_VOLUME("Mic Boost Volume", 0x19, 0, HDA_INPUT),
2264 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x1, HDA_INPUT),
2265 { } /* end */
2266};
2267
2268static const struct hda_bind_ctls alc883_bind_cap_vol = {
2269 .ops = &snd_hda_bind_vol,
2270 .values = {
2271 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
2272 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
2273 0
2274 },
2275};
2276
2277static const struct hda_bind_ctls alc883_bind_cap_switch = {
2278 .ops = &snd_hda_bind_sw,
2279 .values = {
2280 HDA_COMPOSE_AMP_VAL(0x08, 3, 0, HDA_INPUT),
2281 HDA_COMPOSE_AMP_VAL(0x09, 3, 0, HDA_INPUT),
2282 0
2283 },
2284};
2285
2286static const struct snd_kcontrol_new alc883_asus_eee1601_mixer[] = {
2287 HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
2288 HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
2289 HDA_CODEC_MUTE("Headphone Playback Switch", 0x14, 0x0, HDA_OUTPUT),
2290 HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
2291 HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
2292 HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
2293 HDA_CODEC_VOLUME("Mic Boost Volume", 0x18, 0, HDA_INPUT),
2294 HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
2295 { } /* end */
2296};
2297
2298static const struct snd_kcontrol_new alc883_asus_eee1601_cap_mixer[] = {
2299 HDA_BIND_VOL("Capture Volume", &alc883_bind_cap_vol),
2300 HDA_BIND_SW("Capture Switch", &alc883_bind_cap_switch),
2301 {
2302 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2303 /* .name = "Capture Source", */
2304 .name = "Input Source",
2305 .count = 1,
2306 .info = alc_mux_enum_info,
2307 .get = alc_mux_enum_get,
2308 .put = alc_mux_enum_put,
2309 },
2310 { } /* end */
2311};
2312
2313static const struct snd_kcontrol_new alc883_chmode_mixer[] = { 687static const struct snd_kcontrol_new alc883_chmode_mixer[] = {
2314 { 688 {
2315 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 689 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
@@ -2321,423 +695,6 @@ static const struct snd_kcontrol_new alc883_chmode_mixer[] = {
2321 { } /* end */ 695 { } /* end */
2322}; 696};
2323 697
2324/* toggle speaker-output according to the hp-jack state */
2325static void alc883_mitac_setup(struct hda_codec *codec)
2326{
2327 struct alc_spec *spec = codec->spec;
2328
2329 spec->autocfg.hp_pins[0] = 0x15;
2330 spec->autocfg.speaker_pins[0] = 0x14;
2331 spec->autocfg.speaker_pins[1] = 0x17;
2332 alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP);
2333}
2334
2335static const struct hda_verb alc883_mitac_verbs[] = {
2336 /* HP */
2337 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2338 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2339 /* Subwoofer */
2340 {0x17, AC_VERB_SET_CONNECT_SEL, 0x02},
2341 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2342
2343 /* enable unsolicited event */
2344 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
2345 /* {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_MIC_EVENT | AC_USRSP_EN}, */
2346
2347 { } /* end */
2348};
2349
2350static const struct hda_verb alc883_clevo_m540r_verbs[] = {
2351 /* HP */
2352 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2353 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2354 /* Int speaker */
2355 /*{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},*/
2356
2357 /* enable unsolicited event */
2358 /*
2359 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
2360 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_MIC_EVENT | AC_USRSP_EN},
2361 */
2362
2363 { } /* end */
2364};
2365
2366static const struct hda_verb alc883_clevo_m720_verbs[] = {
2367 /* HP */
2368 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2369 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2370 /* Int speaker */
2371 {0x14, AC_VERB_SET_CONNECT_SEL, 0x01},
2372 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2373
2374 /* enable unsolicited event */
2375 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
2376 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_MIC_EVENT | AC_USRSP_EN},
2377
2378 { } /* end */
2379};
2380
2381static const struct hda_verb alc883_2ch_fujitsu_pi2515_verbs[] = {
2382 /* HP */
2383 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
2384 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2385 /* Subwoofer */
2386 {0x15, AC_VERB_SET_CONNECT_SEL, 0x01},
2387 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2388
2389 /* enable unsolicited event */
2390 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
2391
2392 { } /* end */
2393};
2394
2395static const struct hda_verb alc883_targa_verbs[] = {
2396 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2397 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2398
2399 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2400 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2401
2402/* Connect Line-Out side jack (SPDIF) to Side */
2403 {0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2404 {0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2405 {0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
2406/* Connect Mic jack to CLFE */
2407 {0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2408 {0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2409 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
2410/* Connect Line-in jack to Surround */
2411 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2412 {0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2413 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
2414/* Connect HP out jack to Front */
2415 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2416 {0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2417 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2418
2419 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
2420
2421 { } /* end */
2422};
2423
2424static const struct hda_verb alc883_lenovo_101e_verbs[] = {
2425 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2426 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_FRONT_EVENT|AC_USRSP_EN},
2427 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT|AC_USRSP_EN},
2428 { } /* end */
2429};
2430
2431static const struct hda_verb alc883_lenovo_nb0763_verbs[] = {
2432 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2433 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2434 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
2435 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2436 { } /* end */
2437};
2438
2439static const struct hda_verb alc888_lenovo_ms7195_verbs[] = {
2440 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2441 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2442 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2443 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_FRONT_EVENT | AC_USRSP_EN},
2444 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
2445 { } /* end */
2446};
2447
2448static const struct hda_verb alc883_haier_w66_verbs[] = {
2449 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2450 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2451
2452 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2453
2454 {0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
2455 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2456 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
2457 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2458 { } /* end */
2459};
2460
2461static const struct hda_verb alc888_lenovo_sky_verbs[] = {
2462 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2463 {0x0c, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2464 {0x0d, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2465 {0x0e, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2466 {0x0f, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2467 {0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2468 {0x1a, AC_VERB_SET_CONNECT_SEL, 0x00},
2469 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
2470 { } /* end */
2471};
2472
2473static const struct hda_verb alc888_6st_dell_verbs[] = {
2474 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
2475 { }
2476};
2477
2478static const struct hda_verb alc883_vaiott_verbs[] = {
2479 /* HP */
2480 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2481 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2482
2483 /* enable unsolicited event */
2484 {0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
2485
2486 { } /* end */
2487};
2488
2489static void alc888_3st_hp_setup(struct hda_codec *codec)
2490{
2491 struct alc_spec *spec = codec->spec;
2492
2493 spec->autocfg.hp_pins[0] = 0x1b;
2494 spec->autocfg.speaker_pins[0] = 0x14;
2495 spec->autocfg.speaker_pins[1] = 0x16;
2496 spec->autocfg.speaker_pins[2] = 0x18;
2497 alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP);
2498}
2499
2500static const struct hda_verb alc888_3st_hp_verbs[] = {
2501 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00}, /* Front: output 0 (0x0c) */
2502 {0x16, AC_VERB_SET_CONNECT_SEL, 0x01}, /* Rear : output 1 (0x0d) */
2503 {0x18, AC_VERB_SET_CONNECT_SEL, 0x02}, /* CLFE : output 2 (0x0e) */
2504 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
2505 { } /* end */
2506};
2507
2508/*
2509 * 2ch mode
2510 */
2511static const struct hda_verb alc888_3st_hp_2ch_init[] = {
2512 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2513 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2514 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
2515 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2516 { } /* end */
2517};
2518
2519/*
2520 * 4ch mode
2521 */
2522static const struct hda_verb alc888_3st_hp_4ch_init[] = {
2523 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
2524 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
2525 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2526 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2527 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
2528 { } /* end */
2529};
2530
2531/*
2532 * 6ch mode
2533 */
2534static const struct hda_verb alc888_3st_hp_6ch_init[] = {
2535 { 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2536 { 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2537 { 0x18, AC_VERB_SET_CONNECT_SEL, 0x02 },
2538 { 0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
2539 { 0x16, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
2540 { 0x16, AC_VERB_SET_CONNECT_SEL, 0x01 },
2541 { } /* end */
2542};
2543
2544static const struct hda_channel_mode alc888_3st_hp_modes[3] = {
2545 { 2, alc888_3st_hp_2ch_init },
2546 { 4, alc888_3st_hp_4ch_init },
2547 { 6, alc888_3st_hp_6ch_init },
2548};
2549
2550static void alc888_lenovo_ms7195_setup(struct hda_codec *codec)
2551{
2552 struct alc_spec *spec = codec->spec;
2553
2554 spec->autocfg.hp_pins[0] = 0x1b;
2555 spec->autocfg.line_out_pins[0] = 0x14;
2556 spec->autocfg.speaker_pins[0] = 0x15;
2557 alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP);
2558}
2559
2560/* toggle speaker-output according to the hp-jack state */
2561static void alc883_lenovo_nb0763_setup(struct hda_codec *codec)
2562{
2563 struct alc_spec *spec = codec->spec;
2564
2565 spec->autocfg.hp_pins[0] = 0x14;
2566 spec->autocfg.speaker_pins[0] = 0x15;
2567 alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP);
2568}
2569
2570/* toggle speaker-output according to the hp-jack state */
2571#define alc883_targa_init_hook alc882_targa_init_hook
2572#define alc883_targa_unsol_event alc882_targa_unsol_event
2573
2574static void alc883_clevo_m720_setup(struct hda_codec *codec)
2575{
2576 struct alc_spec *spec = codec->spec;
2577
2578 spec->autocfg.hp_pins[0] = 0x15;
2579 spec->autocfg.speaker_pins[0] = 0x14;
2580 alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP);
2581}
2582
2583static void alc883_clevo_m720_init_hook(struct hda_codec *codec)
2584{
2585 alc_hp_automute(codec);
2586 alc88x_simple_mic_automute(codec);
2587}
2588
2589static void alc883_clevo_m720_unsol_event(struct hda_codec *codec,
2590 unsigned int res)
2591{
2592 switch (res >> 26) {
2593 case ALC_MIC_EVENT:
2594 alc88x_simple_mic_automute(codec);
2595 break;
2596 default:
2597 alc_sku_unsol_event(codec, res);
2598 break;
2599 }
2600}
2601
2602/* toggle speaker-output according to the hp-jack state */
2603static void alc883_2ch_fujitsu_pi2515_setup(struct hda_codec *codec)
2604{
2605 struct alc_spec *spec = codec->spec;
2606
2607 spec->autocfg.hp_pins[0] = 0x14;
2608 spec->autocfg.speaker_pins[0] = 0x15;
2609 alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP);
2610}
2611
2612static void alc883_haier_w66_setup(struct hda_codec *codec)
2613{
2614 struct alc_spec *spec = codec->spec;
2615
2616 spec->autocfg.hp_pins[0] = 0x1b;
2617 spec->autocfg.speaker_pins[0] = 0x14;
2618 alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP);
2619}
2620
2621static void alc883_lenovo_101e_setup(struct hda_codec *codec)
2622{
2623 struct alc_spec *spec = codec->spec;
2624
2625 spec->autocfg.hp_pins[0] = 0x1b;
2626 spec->autocfg.line_out_pins[0] = 0x14;
2627 spec->autocfg.speaker_pins[0] = 0x15;
2628 alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP);
2629}
2630
2631/* toggle speaker-output according to the hp-jack state */
2632static void alc883_acer_aspire_setup(struct hda_codec *codec)
2633{
2634 struct alc_spec *spec = codec->spec;
2635
2636 spec->autocfg.hp_pins[0] = 0x14;
2637 spec->autocfg.speaker_pins[0] = 0x15;
2638 spec->autocfg.speaker_pins[1] = 0x16;
2639 alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP);
2640}
2641
2642static const struct hda_verb alc883_acer_eapd_verbs[] = {
2643 /* HP Pin: output 0 (0x0c) */
2644 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2645 {0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
2646 {0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
2647 /* Front Pin: output 0 (0x0c) */
2648 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2649 {0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
2650 {0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2651 {0x16, AC_VERB_SET_CONNECT_SEL, 0x00},
2652 /* eanable EAPD on medion laptop */
2653 {0x20, AC_VERB_SET_COEF_INDEX, 0x07},
2654 {0x20, AC_VERB_SET_PROC_COEF, 0x3050},
2655 /* enable unsolicited event */
2656 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
2657 { }
2658};
2659
2660static void alc888_6st_dell_setup(struct hda_codec *codec)
2661{
2662 struct alc_spec *spec = codec->spec;
2663
2664 spec->autocfg.hp_pins[0] = 0x1b;
2665 spec->autocfg.speaker_pins[0] = 0x14;
2666 spec->autocfg.speaker_pins[1] = 0x15;
2667 spec->autocfg.speaker_pins[2] = 0x16;
2668 spec->autocfg.speaker_pins[3] = 0x17;
2669 alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP);
2670}
2671
2672static void alc888_lenovo_sky_setup(struct hda_codec *codec)
2673{
2674 struct alc_spec *spec = codec->spec;
2675
2676 spec->autocfg.hp_pins[0] = 0x1b;
2677 spec->autocfg.speaker_pins[0] = 0x14;
2678 spec->autocfg.speaker_pins[1] = 0x15;
2679 spec->autocfg.speaker_pins[2] = 0x16;
2680 spec->autocfg.speaker_pins[3] = 0x17;
2681 spec->autocfg.speaker_pins[4] = 0x1a;
2682 alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP);
2683}
2684
2685static void alc883_vaiott_setup(struct hda_codec *codec)
2686{
2687 struct alc_spec *spec = codec->spec;
2688
2689 spec->autocfg.hp_pins[0] = 0x15;
2690 spec->autocfg.speaker_pins[0] = 0x14;
2691 spec->autocfg.speaker_pins[1] = 0x17;
2692 alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP);
2693}
2694
2695static const struct hda_verb alc888_asus_m90v_verbs[] = {
2696 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2697 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2698 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(1)},
2699 /* enable unsolicited event */
2700 {0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
2701 {0x18, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_MIC_EVENT | AC_USRSP_EN},
2702 { } /* end */
2703};
2704
2705static void alc883_mode2_setup(struct hda_codec *codec)
2706{
2707 struct alc_spec *spec = codec->spec;
2708
2709 spec->autocfg.hp_pins[0] = 0x1b;
2710 spec->autocfg.speaker_pins[0] = 0x14;
2711 spec->autocfg.speaker_pins[1] = 0x15;
2712 spec->autocfg.speaker_pins[2] = 0x16;
2713 spec->ext_mic_pin = 0x18;
2714 spec->int_mic_pin = 0x19;
2715 spec->auto_mic = 1;
2716 alc_simple_setup_automute(spec, ALC_AUTOMUTE_AMP);
2717}
2718
2719static const struct hda_verb alc888_asus_eee1601_verbs[] = {
2720 {0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
2721 {0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
2722 {0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
2723 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(0)},
2724 {0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(1)},
2725 {0x20, AC_VERB_SET_COEF_INDEX, 0x0b},
2726 {0x20, AC_VERB_SET_PROC_COEF, 0x0838},
2727 /* enable unsolicited event */
2728 {0x14, AC_VERB_SET_UNSOLICITED_ENABLE, ALC_HP_EVENT | AC_USRSP_EN},
2729 { } /* end */
2730};
2731
2732static void alc883_eee1601_inithook(struct hda_codec *codec)
2733{
2734 struct alc_spec *spec = codec->spec;
2735
2736 spec->autocfg.hp_pins[0] = 0x14;
2737 spec->autocfg.speaker_pins[0] = 0x1b;
2738 alc_hp_automute(codec);
2739}
2740
2741static const struct hda_verb alc889A_mb31_verbs[] = { 698static const struct hda_verb alc889A_mb31_verbs[] = {
2742 /* Init rear pin (used as headphone output) */ 699 /* Init rear pin (used as headphone output) */
2743 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */ 700 {0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, 0xc4}, /* Apple Headphones */
@@ -2773,211 +730,30 @@ static void alc889A_mb31_unsol_event(struct hda_codec *codec, unsigned int res)
2773 alc889A_mb31_automute(codec); 730 alc889A_mb31_automute(codec);
2774} 731}
2775 732
2776static const hda_nid_t alc883_slave_dig_outs[] = {
2777 ALC1200_DIGOUT_NID, 0,
2778};
2779
2780static const hda_nid_t alc1200_slave_dig_outs[] = {
2781 ALC883_DIGOUT_NID, 0,
2782};
2783
2784/* 733/*
2785 * configuration and preset 734 * configuration and preset
2786 */ 735 */
2787static const char * const alc882_models[ALC882_MODEL_LAST] = { 736static const char * const alc882_models[ALC882_MODEL_LAST] = {
2788 [ALC882_3ST_DIG] = "3stack-dig",
2789 [ALC882_6ST_DIG] = "6stack-dig",
2790 [ALC882_ARIMA] = "arima",
2791 [ALC882_W2JC] = "w2jc",
2792 [ALC882_TARGA] = "targa",
2793 [ALC882_ASUS_A7J] = "asus-a7j",
2794 [ALC882_ASUS_A7M] = "asus-a7m",
2795 [ALC885_MACPRO] = "macpro",
2796 [ALC885_MB5] = "mb5", 737 [ALC885_MB5] = "mb5",
2797 [ALC885_MACMINI3] = "macmini3", 738 [ALC885_MACMINI3] = "macmini3",
2798 [ALC885_MBA21] = "mba21", 739 [ALC885_MBA21] = "mba21",
2799 [ALC885_MBP3] = "mbp3", 740 [ALC885_MBP3] = "mbp3",
2800 [ALC885_IMAC24] = "imac24",
2801 [ALC885_IMAC91] = "imac91", 741 [ALC885_IMAC91] = "imac91",
2802 [ALC883_3ST_2ch_DIG] = "3stack-2ch-dig",
2803 [ALC883_3ST_6ch_DIG] = "3stack-6ch-dig",
2804 [ALC883_3ST_6ch] = "3stack-6ch",
2805 [ALC883_6ST_DIG] = "alc883-6stack-dig",
2806 [ALC883_TARGA_DIG] = "targa-dig",
2807 [ALC883_TARGA_2ch_DIG] = "targa-2ch-dig",
2808 [ALC883_TARGA_8ch_DIG] = "targa-8ch-dig",
2809 [ALC883_ACER] = "acer",
2810 [ALC883_ACER_ASPIRE] = "acer-aspire",
2811 [ALC888_ACER_ASPIRE_4930G] = "acer-aspire-4930g",
2812 [ALC888_ACER_ASPIRE_6530G] = "acer-aspire-6530g",
2813 [ALC888_ACER_ASPIRE_8930G] = "acer-aspire-8930g",
2814 [ALC888_ACER_ASPIRE_7730G] = "acer-aspire-7730g",
2815 [ALC883_MEDION] = "medion",
2816 [ALC883_MEDION_WIM2160] = "medion-wim2160",
2817 [ALC883_LAPTOP_EAPD] = "laptop-eapd",
2818 [ALC883_LENOVO_101E_2ch] = "lenovo-101e",
2819 [ALC883_LENOVO_NB0763] = "lenovo-nb0763",
2820 [ALC888_LENOVO_MS7195_DIG] = "lenovo-ms7195-dig",
2821 [ALC888_LENOVO_SKY] = "lenovo-sky",
2822 [ALC883_HAIER_W66] = "haier-w66",
2823 [ALC888_3ST_HP] = "3stack-hp",
2824 [ALC888_6ST_DELL] = "6stack-dell",
2825 [ALC883_MITAC] = "mitac",
2826 [ALC883_CLEVO_M540R] = "clevo-m540r",
2827 [ALC883_CLEVO_M720] = "clevo-m720",
2828 [ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
2829 [ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
2830 [ALC883_3ST_6ch_INTEL] = "3stack-6ch-intel",
2831 [ALC889A_INTEL] = "intel-alc889a",
2832 [ALC889_INTEL] = "intel-x58",
2833 [ALC1200_ASUS_P5Q] = "asus-p5q",
2834 [ALC889A_MB31] = "mb31", 742 [ALC889A_MB31] = "mb31",
2835 [ALC883_SONY_VAIO_TT] = "sony-vaio-tt",
2836 [ALC882_AUTO] = "auto", 743 [ALC882_AUTO] = "auto",
2837}; 744};
2838 745
2839static const struct snd_pci_quirk alc882_cfg_tbl[] = {
2840 SND_PCI_QUIRK(0x1019, 0x6668, "ECS", ALC882_6ST_DIG),
2841
2842 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_ACER_ASPIRE),
2843 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_ACER_ASPIRE),
2844 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_ACER_ASPIRE),
2845 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
2846 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
2847 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
2848 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
2849 ALC888_ACER_ASPIRE_4930G),
2850 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
2851 ALC888_ACER_ASPIRE_4930G),
2852 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
2853 ALC888_ACER_ASPIRE_8930G),
2854 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
2855 ALC888_ACER_ASPIRE_8930G),
2856 SND_PCI_QUIRK(0x1025, 0x0157, "Acer X3200", ALC882_AUTO),
2857 SND_PCI_QUIRK(0x1025, 0x0158, "Acer AX1700-U3700A", ALC882_AUTO),
2858 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
2859 ALC888_ACER_ASPIRE_6530G),
2860 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
2861 ALC888_ACER_ASPIRE_6530G),
2862 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
2863 ALC888_ACER_ASPIRE_7730G),
2864 /* default Acer -- disabled as it causes more problems.
2865 * model=auto should work fine now
2866 */
2867 /* SND_PCI_QUIRK_VENDOR(0x1025, "Acer laptop", ALC883_ACER), */
2868
2869 SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
2870
2871 SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavilion", ALC883_6ST_DIG),
2872 SND_PCI_QUIRK(0x103c, 0x2a4f, "HP Samba", ALC888_3ST_HP),
2873 SND_PCI_QUIRK(0x103c, 0x2a60, "HP Lucknow", ALC888_3ST_HP),
2874 SND_PCI_QUIRK(0x103c, 0x2a61, "HP Nettle", ALC883_6ST_DIG),
2875 SND_PCI_QUIRK(0x103c, 0x2a66, "HP Acacia", ALC888_3ST_HP),
2876 SND_PCI_QUIRK(0x103c, 0x2a72, "HP Educ.ar", ALC888_3ST_HP),
2877
2878 SND_PCI_QUIRK(0x1043, 0x060d, "Asus A7J", ALC882_ASUS_A7J),
2879 SND_PCI_QUIRK(0x1043, 0x1243, "Asus A7J", ALC882_ASUS_A7J),
2880 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_ASUS_A7M),
2881 SND_PCI_QUIRK(0x1043, 0x1873, "Asus M90V", ALC888_ASUS_M90V),
2882 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_W2JC),
2883 SND_PCI_QUIRK(0x1043, 0x817f, "Asus P5LD2", ALC882_6ST_DIG),
2884 SND_PCI_QUIRK(0x1043, 0x81d8, "Asus P5WD", ALC882_6ST_DIG),
2885 SND_PCI_QUIRK(0x1043, 0x8249, "Asus M2A-VM HDMI", ALC883_3ST_6ch_DIG),
2886 SND_PCI_QUIRK(0x1043, 0x8284, "Asus Z37E", ALC883_6ST_DIG),
2887 SND_PCI_QUIRK(0x1043, 0x82fe, "Asus P5Q-EM HDMI", ALC1200_ASUS_P5Q),
2888 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_ASUS_EEE1601),
2889
2890 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC883_SONY_VAIO_TT),
2891 SND_PCI_QUIRK(0x105b, 0x0ce8, "Foxconn P35AX-S", ALC883_6ST_DIG),
2892 SND_PCI_QUIRK(0x105b, 0x6668, "Foxconn", ALC882_6ST_DIG),
2893 SND_PCI_QUIRK(0x1071, 0x8227, "Mitac 82801H", ALC883_MITAC),
2894 SND_PCI_QUIRK(0x1071, 0x8253, "Mitac 8252d", ALC883_MITAC),
2895 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC883_LAPTOP_EAPD),
2896 SND_PCI_QUIRK(0x10f1, 0x2350, "TYAN-S2350", ALC888_6ST_DELL),
2897 SND_PCI_QUIRK(0x108e, 0x534d, NULL, ALC883_3ST_6ch),
2898 SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte P35 DS3R", ALC882_6ST_DIG),
2899
2900 SND_PCI_QUIRK(0x1462, 0x0349, "MSI", ALC883_TARGA_2ch_DIG),
2901 SND_PCI_QUIRK(0x1462, 0x040d, "MSI", ALC883_TARGA_2ch_DIG),
2902 SND_PCI_QUIRK(0x1462, 0x0579, "MSI", ALC883_TARGA_2ch_DIG),
2903 SND_PCI_QUIRK(0x1462, 0x28fb, "Targa T8", ALC882_TARGA), /* MSI-1049 T8 */
2904 SND_PCI_QUIRK(0x1462, 0x2fb3, "MSI", ALC882_AUTO),
2905 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC882_6ST_DIG),
2906 SND_PCI_QUIRK(0x1462, 0x3729, "MSI S420", ALC883_TARGA_DIG),
2907 SND_PCI_QUIRK(0x1462, 0x3783, "NEC S970", ALC883_TARGA_DIG),
2908 SND_PCI_QUIRK(0x1462, 0x3b7f, "MSI", ALC883_TARGA_2ch_DIG),
2909 SND_PCI_QUIRK(0x1462, 0x3ef9, "MSI", ALC883_TARGA_DIG),
2910 SND_PCI_QUIRK(0x1462, 0x3fc1, "MSI", ALC883_TARGA_DIG),
2911 SND_PCI_QUIRK(0x1462, 0x3fc3, "MSI", ALC883_TARGA_DIG),
2912 SND_PCI_QUIRK(0x1462, 0x3fcc, "MSI", ALC883_TARGA_DIG),
2913 SND_PCI_QUIRK(0x1462, 0x3fdf, "MSI", ALC883_TARGA_DIG),
2914 SND_PCI_QUIRK(0x1462, 0x42cd, "MSI", ALC883_TARGA_DIG),
2915 SND_PCI_QUIRK(0x1462, 0x4314, "MSI", ALC883_TARGA_DIG),
2916 SND_PCI_QUIRK(0x1462, 0x4319, "MSI", ALC883_TARGA_DIG),
2917 SND_PCI_QUIRK(0x1462, 0x4324, "MSI", ALC883_TARGA_DIG),
2918 SND_PCI_QUIRK(0x1462, 0x4570, "MSI Wind Top AE2220", ALC883_TARGA_DIG),
2919 SND_PCI_QUIRK(0x1462, 0x6510, "MSI GX620", ALC883_TARGA_8ch_DIG),
2920 SND_PCI_QUIRK(0x1462, 0x6668, "MSI", ALC883_6ST_DIG),
2921 SND_PCI_QUIRK(0x1462, 0x7187, "MSI", ALC883_6ST_DIG),
2922 SND_PCI_QUIRK(0x1462, 0x7250, "MSI", ALC883_6ST_DIG),
2923 SND_PCI_QUIRK(0x1462, 0x7260, "MSI 7260", ALC883_TARGA_DIG),
2924 SND_PCI_QUIRK(0x1462, 0x7267, "MSI", ALC883_3ST_6ch_DIG),
2925 SND_PCI_QUIRK(0x1462, 0x7280, "MSI", ALC883_6ST_DIG),
2926 SND_PCI_QUIRK(0x1462, 0x7327, "MSI", ALC883_6ST_DIG),
2927 SND_PCI_QUIRK(0x1462, 0x7350, "MSI", ALC883_6ST_DIG),
2928 SND_PCI_QUIRK(0x1462, 0x7437, "MSI NetOn AP1900", ALC883_TARGA_DIG),
2929 SND_PCI_QUIRK(0x1462, 0xa422, "MSI", ALC883_TARGA_2ch_DIG),
2930 SND_PCI_QUIRK(0x1462, 0xaa08, "MSI", ALC883_TARGA_2ch_DIG),
2931
2932 SND_PCI_QUIRK(0x147b, 0x1083, "Abit IP35-PRO", ALC883_6ST_DIG),
2933 SND_PCI_QUIRK(0x1558, 0x0571, "Clevo laptop M570U", ALC883_3ST_6ch_DIG),
2934 SND_PCI_QUIRK(0x1558, 0x0721, "Clevo laptop M720R", ALC883_CLEVO_M720),
2935 SND_PCI_QUIRK(0x1558, 0x0722, "Clevo laptop M720SR", ALC883_CLEVO_M720),
2936 SND_PCI_QUIRK(0x1558, 0x5409, "Clevo laptop M540R", ALC883_CLEVO_M540R),
2937 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC883_LAPTOP_EAPD),
2938 SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
2939 /* SND_PCI_QUIRK(0x161f, 0x2054, "Arima W820", ALC882_ARIMA), */
2940 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
2941 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1100, "FSC AMILO Xi/Pi25xx",
2942 ALC883_FUJITSU_PI2515),
2943 SND_PCI_QUIRK_MASK(0x1734, 0xfff0, 0x1130, "Fujitsu AMILO Xa35xx",
2944 ALC888_FUJITSU_XA3530),
2945 SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
2946 SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
2947 SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
2948 SND_PCI_QUIRK(0x17aa, 0x3bfd, "Lenovo NB0763", ALC883_LENOVO_NB0763),
2949 SND_PCI_QUIRK(0x17aa, 0x101d, "Lenovo Sky", ALC888_LENOVO_SKY),
2950 SND_PCI_QUIRK(0x17c0, 0x4085, "MEDION MD96630", ALC888_LENOVO_MS7195_DIG),
2951 SND_PCI_QUIRK(0x17f2, 0x5000, "Albatron KI690-AM2", ALC883_6ST_DIG),
2952 SND_PCI_QUIRK(0x1991, 0x5625, "Haier W66", ALC883_HAIER_W66),
2953
2954 SND_PCI_QUIRK(0x8086, 0x0001, "DG33BUC", ALC883_3ST_6ch_INTEL),
2955 SND_PCI_QUIRK(0x8086, 0x0002, "DG33FBC", ALC883_3ST_6ch_INTEL),
2956 SND_PCI_QUIRK(0x8086, 0x2503, "82801H", ALC883_MITAC),
2957 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_INTEL),
2958 SND_PCI_QUIRK(0x8086, 0x0021, "Intel IbexPeak", ALC889A_INTEL),
2959 SND_PCI_QUIRK(0x8086, 0x3b56, "Intel IbexPeak", ALC889A_INTEL),
2960 SND_PCI_QUIRK(0x8086, 0xd601, "D102GGC", ALC882_6ST_DIG),
2961
2962 {}
2963};
2964
2965/* codec SSID table for Intel Mac */ 746/* codec SSID table for Intel Mac */
2966static const struct snd_pci_quirk alc882_ssid_cfg_tbl[] = { 747static const struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
2967 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3), 748 SND_PCI_QUIRK(0x106b, 0x00a0, "MacBookPro 3,1", ALC885_MBP3),
2968 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3), 749 SND_PCI_QUIRK(0x106b, 0x00a1, "Macbook", ALC885_MBP3),
2969 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3), 750 SND_PCI_QUIRK(0x106b, 0x00a4, "MacbookPro 4,1", ALC885_MBP3),
2970 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_MACPRO),
2971 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_IMAC24),
2972 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_IMAC24),
2973 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3), 751 SND_PCI_QUIRK(0x106b, 0x2c00, "MacbookPro rev3", ALC885_MBP3),
2974 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31), 752 SND_PCI_QUIRK(0x106b, 0x3000, "iMac", ALC889A_MB31),
2975 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_ASUS_A7M),
2976 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3), 753 SND_PCI_QUIRK(0x106b, 0x3400, "MacBookAir 1,1", ALC885_MBP3),
2977 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21), 754 SND_PCI_QUIRK(0x106b, 0x3500, "MacBookAir 2,1", ALC885_MBA21),
2978 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31), 755 SND_PCI_QUIRK(0x106b, 0x3600, "Macbook 3,1", ALC889A_MB31),
2979 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3), 756 SND_PCI_QUIRK(0x106b, 0x3800, "MacbookPro 4,1", ALC885_MBP3),
2980 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_IMAC24),
2981 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91), 757 SND_PCI_QUIRK(0x106b, 0x4900, "iMac 9,1 Aluminum", ALC885_IMAC91),
2982 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5), 758 SND_PCI_QUIRK(0x106b, 0x3f00, "Macbook 5,1", ALC885_MB5),
2983 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5), 759 SND_PCI_QUIRK(0x106b, 0x4a00, "Macbook 5,2", ALC885_MB5),
@@ -2991,53 +767,6 @@ static const struct snd_pci_quirk alc882_ssid_cfg_tbl[] = {
2991}; 767};
2992 768
2993static const struct alc_config_preset alc882_presets[] = { 769static const struct alc_config_preset alc882_presets[] = {
2994 [ALC882_3ST_DIG] = {
2995 .mixers = { alc882_base_mixer },
2996 .init_verbs = { alc882_base_init_verbs,
2997 alc882_adc1_init_verbs },
2998 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
2999 .dac_nids = alc882_dac_nids,
3000 .dig_out_nid = ALC882_DIGOUT_NID,
3001 .dig_in_nid = ALC882_DIGIN_NID,
3002 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
3003 .channel_mode = alc882_ch_modes,
3004 .need_dac_fix = 1,
3005 .input_mux = &alc882_capture_source,
3006 },
3007 [ALC882_6ST_DIG] = {
3008 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
3009 .init_verbs = { alc882_base_init_verbs,
3010 alc882_adc1_init_verbs },
3011 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
3012 .dac_nids = alc882_dac_nids,
3013 .dig_out_nid = ALC882_DIGOUT_NID,
3014 .dig_in_nid = ALC882_DIGIN_NID,
3015 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
3016 .channel_mode = alc882_sixstack_modes,
3017 .input_mux = &alc882_capture_source,
3018 },
3019 [ALC882_ARIMA] = {
3020 .mixers = { alc882_base_mixer, alc882_chmode_mixer },
3021 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
3022 alc882_eapd_verbs },
3023 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
3024 .dac_nids = alc882_dac_nids,
3025 .num_channel_mode = ARRAY_SIZE(alc882_sixstack_modes),
3026 .channel_mode = alc882_sixstack_modes,
3027 .input_mux = &alc882_capture_source,
3028 },
3029 [ALC882_W2JC] = {
3030 .mixers = { alc882_w2jc_mixer, alc882_chmode_mixer },
3031 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
3032 alc882_eapd_verbs, alc880_gpio1_init_verbs },
3033 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
3034 .dac_nids = alc882_dac_nids,
3035 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3036 .channel_mode = alc880_threestack_modes,
3037 .need_dac_fix = 1,
3038 .input_mux = &alc882_capture_source,
3039 .dig_out_nid = ALC882_DIGOUT_NID,
3040 },
3041 [ALC885_MBA21] = { 770 [ALC885_MBA21] = {
3042 .mixers = { alc885_mba21_mixer }, 771 .mixers = { alc885_mba21_mixer },
3043 .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs }, 772 .init_verbs = { alc885_mba21_init_verbs, alc880_gpio1_init_verbs },
@@ -3096,32 +825,6 @@ static const struct alc_config_preset alc882_presets[] = {
3096 .setup = alc885_macmini3_setup, 825 .setup = alc885_macmini3_setup,
3097 .init_hook = alc_hp_automute, 826 .init_hook = alc_hp_automute,
3098 }, 827 },
3099 [ALC885_MACPRO] = {
3100 .mixers = { alc882_macpro_mixer },
3101 .init_verbs = { alc882_macpro_init_verbs },
3102 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
3103 .dac_nids = alc882_dac_nids,
3104 .dig_out_nid = ALC882_DIGOUT_NID,
3105 .dig_in_nid = ALC882_DIGIN_NID,
3106 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
3107 .channel_mode = alc882_ch_modes,
3108 .input_mux = &alc882_capture_source,
3109 .init_hook = alc885_macpro_init_hook,
3110 },
3111 [ALC885_IMAC24] = {
3112 .mixers = { alc885_imac24_mixer },
3113 .init_verbs = { alc885_imac24_init_verbs },
3114 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
3115 .dac_nids = alc882_dac_nids,
3116 .dig_out_nid = ALC882_DIGOUT_NID,
3117 .dig_in_nid = ALC882_DIGIN_NID,
3118 .num_channel_mode = ARRAY_SIZE(alc882_ch_modes),
3119 .channel_mode = alc882_ch_modes,
3120 .input_mux = &alc882_capture_source,
3121 .unsol_event = alc_sku_unsol_event,
3122 .setup = alc885_imac24_setup,
3123 .init_hook = alc885_imac24_init_hook,
3124 },
3125 [ALC885_IMAC91] = { 828 [ALC885_IMAC91] = {
3126 .mixers = {alc885_imac91_mixer}, 829 .mixers = {alc885_imac91_mixer},
3127 .init_verbs = { alc885_imac91_init_verbs, 830 .init_verbs = { alc885_imac91_init_verbs,
@@ -3137,564 +840,6 @@ static const struct alc_config_preset alc882_presets[] = {
3137 .setup = alc885_imac91_setup, 840 .setup = alc885_imac91_setup,
3138 .init_hook = alc_hp_automute, 841 .init_hook = alc_hp_automute,
3139 }, 842 },
3140 [ALC882_TARGA] = {
3141 .mixers = { alc882_targa_mixer, alc882_chmode_mixer },
3142 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
3143 alc880_gpio3_init_verbs, alc882_targa_verbs},
3144 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
3145 .dac_nids = alc882_dac_nids,
3146 .dig_out_nid = ALC882_DIGOUT_NID,
3147 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
3148 .adc_nids = alc882_adc_nids,
3149 .capsrc_nids = alc882_capsrc_nids,
3150 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
3151 .channel_mode = alc882_3ST_6ch_modes,
3152 .need_dac_fix = 1,
3153 .input_mux = &alc882_capture_source,
3154 .unsol_event = alc_sku_unsol_event,
3155 .setup = alc882_targa_setup,
3156 .init_hook = alc882_targa_automute,
3157 },
3158 [ALC882_ASUS_A7J] = {
3159 .mixers = { alc882_asus_a7j_mixer, alc882_chmode_mixer },
3160 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
3161 alc882_asus_a7j_verbs},
3162 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
3163 .dac_nids = alc882_dac_nids,
3164 .dig_out_nid = ALC882_DIGOUT_NID,
3165 .num_adc_nids = ARRAY_SIZE(alc882_adc_nids),
3166 .adc_nids = alc882_adc_nids,
3167 .capsrc_nids = alc882_capsrc_nids,
3168 .num_channel_mode = ARRAY_SIZE(alc882_3ST_6ch_modes),
3169 .channel_mode = alc882_3ST_6ch_modes,
3170 .need_dac_fix = 1,
3171 .input_mux = &alc882_capture_source,
3172 },
3173 [ALC882_ASUS_A7M] = {
3174 .mixers = { alc882_asus_a7m_mixer, alc882_chmode_mixer },
3175 .init_verbs = { alc882_base_init_verbs, alc882_adc1_init_verbs,
3176 alc882_eapd_verbs, alc880_gpio1_init_verbs,
3177 alc882_asus_a7m_verbs },
3178 .num_dacs = ARRAY_SIZE(alc882_dac_nids),
3179 .dac_nids = alc882_dac_nids,
3180 .dig_out_nid = ALC882_DIGOUT_NID,
3181 .num_channel_mode = ARRAY_SIZE(alc880_threestack_modes),
3182 .channel_mode = alc880_threestack_modes,
3183 .need_dac_fix = 1,
3184 .input_mux = &alc882_capture_source,
3185 },
3186 [ALC883_3ST_2ch_DIG] = {
3187 .mixers = { alc883_3ST_2ch_mixer },
3188 .init_verbs = { alc883_init_verbs },
3189 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3190 .dac_nids = alc883_dac_nids,
3191 .dig_out_nid = ALC883_DIGOUT_NID,
3192 .dig_in_nid = ALC883_DIGIN_NID,
3193 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
3194 .channel_mode = alc883_3ST_2ch_modes,
3195 .input_mux = &alc883_capture_source,
3196 },
3197 [ALC883_3ST_6ch_DIG] = {
3198 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
3199 .init_verbs = { alc883_init_verbs },
3200 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3201 .dac_nids = alc883_dac_nids,
3202 .dig_out_nid = ALC883_DIGOUT_NID,
3203 .dig_in_nid = ALC883_DIGIN_NID,
3204 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
3205 .channel_mode = alc883_3ST_6ch_modes,
3206 .need_dac_fix = 1,
3207 .input_mux = &alc883_capture_source,
3208 },
3209 [ALC883_3ST_6ch] = {
3210 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
3211 .init_verbs = { alc883_init_verbs },
3212 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3213 .dac_nids = alc883_dac_nids,
3214 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
3215 .channel_mode = alc883_3ST_6ch_modes,
3216 .need_dac_fix = 1,
3217 .input_mux = &alc883_capture_source,
3218 },
3219 [ALC883_3ST_6ch_INTEL] = {
3220 .mixers = { alc883_3ST_6ch_intel_mixer, alc883_chmode_mixer },
3221 .init_verbs = { alc883_init_verbs },
3222 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3223 .dac_nids = alc883_dac_nids,
3224 .dig_out_nid = ALC883_DIGOUT_NID,
3225 .dig_in_nid = ALC883_DIGIN_NID,
3226 .slave_dig_outs = alc883_slave_dig_outs,
3227 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_intel_modes),
3228 .channel_mode = alc883_3ST_6ch_intel_modes,
3229 .need_dac_fix = 1,
3230 .input_mux = &alc883_3stack_6ch_intel,
3231 },
3232 [ALC889A_INTEL] = {
3233 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
3234 .init_verbs = { alc885_init_verbs, alc885_init_input_verbs,
3235 alc_hp15_unsol_verbs },
3236 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3237 .dac_nids = alc883_dac_nids,
3238 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
3239 .adc_nids = alc889_adc_nids,
3240 .dig_out_nid = ALC883_DIGOUT_NID,
3241 .dig_in_nid = ALC883_DIGIN_NID,
3242 .slave_dig_outs = alc883_slave_dig_outs,
3243 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
3244 .channel_mode = alc889_8ch_intel_modes,
3245 .capsrc_nids = alc889_capsrc_nids,
3246 .input_mux = &alc889_capture_source,
3247 .setup = alc889_automute_setup,
3248 .init_hook = alc_hp_automute,
3249 .unsol_event = alc_sku_unsol_event,
3250 .need_dac_fix = 1,
3251 },
3252 [ALC889_INTEL] = {
3253 .mixers = { alc885_8ch_intel_mixer, alc883_chmode_mixer },
3254 .init_verbs = { alc885_init_verbs, alc889_init_input_verbs,
3255 alc889_eapd_verbs, alc_hp15_unsol_verbs},
3256 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3257 .dac_nids = alc883_dac_nids,
3258 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
3259 .adc_nids = alc889_adc_nids,
3260 .dig_out_nid = ALC883_DIGOUT_NID,
3261 .dig_in_nid = ALC883_DIGIN_NID,
3262 .slave_dig_outs = alc883_slave_dig_outs,
3263 .num_channel_mode = ARRAY_SIZE(alc889_8ch_intel_modes),
3264 .channel_mode = alc889_8ch_intel_modes,
3265 .capsrc_nids = alc889_capsrc_nids,
3266 .input_mux = &alc889_capture_source,
3267 .setup = alc889_automute_setup,
3268 .init_hook = alc889_intel_init_hook,
3269 .unsol_event = alc_sku_unsol_event,
3270 .need_dac_fix = 1,
3271 },
3272 [ALC883_6ST_DIG] = {
3273 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
3274 .init_verbs = { alc883_init_verbs },
3275 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3276 .dac_nids = alc883_dac_nids,
3277 .dig_out_nid = ALC883_DIGOUT_NID,
3278 .dig_in_nid = ALC883_DIGIN_NID,
3279 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
3280 .channel_mode = alc883_sixstack_modes,
3281 .input_mux = &alc883_capture_source,
3282 },
3283 [ALC883_TARGA_DIG] = {
3284 .mixers = { alc883_targa_mixer, alc883_chmode_mixer },
3285 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
3286 alc883_targa_verbs},
3287 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3288 .dac_nids = alc883_dac_nids,
3289 .dig_out_nid = ALC883_DIGOUT_NID,
3290 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
3291 .channel_mode = alc883_3ST_6ch_modes,
3292 .need_dac_fix = 1,
3293 .input_mux = &alc883_capture_source,
3294 .unsol_event = alc883_targa_unsol_event,
3295 .setup = alc882_targa_setup,
3296 .init_hook = alc882_targa_automute,
3297 },
3298 [ALC883_TARGA_2ch_DIG] = {
3299 .mixers = { alc883_targa_2ch_mixer},
3300 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
3301 alc883_targa_verbs},
3302 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3303 .dac_nids = alc883_dac_nids,
3304 .adc_nids = alc883_adc_nids_alt,
3305 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
3306 .capsrc_nids = alc883_capsrc_nids,
3307 .dig_out_nid = ALC883_DIGOUT_NID,
3308 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
3309 .channel_mode = alc883_3ST_2ch_modes,
3310 .input_mux = &alc883_capture_source,
3311 .unsol_event = alc883_targa_unsol_event,
3312 .setup = alc882_targa_setup,
3313 .init_hook = alc882_targa_automute,
3314 },
3315 [ALC883_TARGA_8ch_DIG] = {
3316 .mixers = { alc883_targa_mixer, alc883_targa_8ch_mixer,
3317 alc883_chmode_mixer },
3318 .init_verbs = { alc883_init_verbs, alc880_gpio3_init_verbs,
3319 alc883_targa_verbs },
3320 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3321 .dac_nids = alc883_dac_nids,
3322 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
3323 .adc_nids = alc883_adc_nids_rev,
3324 .capsrc_nids = alc883_capsrc_nids_rev,
3325 .dig_out_nid = ALC883_DIGOUT_NID,
3326 .dig_in_nid = ALC883_DIGIN_NID,
3327 .num_channel_mode = ARRAY_SIZE(alc883_4ST_8ch_modes),
3328 .channel_mode = alc883_4ST_8ch_modes,
3329 .need_dac_fix = 1,
3330 .input_mux = &alc883_capture_source,
3331 .unsol_event = alc883_targa_unsol_event,
3332 .setup = alc882_targa_setup,
3333 .init_hook = alc882_targa_automute,
3334 },
3335 [ALC883_ACER] = {
3336 .mixers = { alc883_base_mixer },
3337 /* On TravelMate laptops, GPIO 0 enables the internal speaker
3338 * and the headphone jack. Turn this on and rely on the
3339 * standard mute methods whenever the user wants to turn
3340 * these outputs off.
3341 */
3342 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs },
3343 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3344 .dac_nids = alc883_dac_nids,
3345 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
3346 .channel_mode = alc883_3ST_2ch_modes,
3347 .input_mux = &alc883_capture_source,
3348 },
3349 [ALC883_ACER_ASPIRE] = {
3350 .mixers = { alc883_acer_aspire_mixer },
3351 .init_verbs = { alc883_init_verbs, alc883_acer_eapd_verbs },
3352 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3353 .dac_nids = alc883_dac_nids,
3354 .dig_out_nid = ALC883_DIGOUT_NID,
3355 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
3356 .channel_mode = alc883_3ST_2ch_modes,
3357 .input_mux = &alc883_capture_source,
3358 .unsol_event = alc_sku_unsol_event,
3359 .setup = alc883_acer_aspire_setup,
3360 .init_hook = alc_hp_automute,
3361 },
3362 [ALC888_ACER_ASPIRE_4930G] = {
3363 .mixers = { alc888_acer_aspire_4930g_mixer,
3364 alc883_chmode_mixer },
3365 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
3366 alc888_acer_aspire_4930g_verbs },
3367 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3368 .dac_nids = alc883_dac_nids,
3369 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
3370 .adc_nids = alc883_adc_nids_rev,
3371 .capsrc_nids = alc883_capsrc_nids_rev,
3372 .dig_out_nid = ALC883_DIGOUT_NID,
3373 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
3374 .channel_mode = alc883_3ST_6ch_modes,
3375 .need_dac_fix = 1,
3376 .const_channel_count = 6,
3377 .num_mux_defs =
3378 ARRAY_SIZE(alc888_2_capture_sources),
3379 .input_mux = alc888_2_capture_sources,
3380 .unsol_event = alc_sku_unsol_event,
3381 .setup = alc888_acer_aspire_4930g_setup,
3382 .init_hook = alc_hp_automute,
3383 },
3384 [ALC888_ACER_ASPIRE_6530G] = {
3385 .mixers = { alc888_acer_aspire_6530_mixer },
3386 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
3387 alc888_acer_aspire_6530g_verbs },
3388 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3389 .dac_nids = alc883_dac_nids,
3390 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
3391 .adc_nids = alc883_adc_nids_rev,
3392 .capsrc_nids = alc883_capsrc_nids_rev,
3393 .dig_out_nid = ALC883_DIGOUT_NID,
3394 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
3395 .channel_mode = alc883_3ST_2ch_modes,
3396 .num_mux_defs =
3397 ARRAY_SIZE(alc888_2_capture_sources),
3398 .input_mux = alc888_acer_aspire_6530_sources,
3399 .unsol_event = alc_sku_unsol_event,
3400 .setup = alc888_acer_aspire_6530g_setup,
3401 .init_hook = alc_hp_automute,
3402 },
3403 [ALC888_ACER_ASPIRE_8930G] = {
3404 .mixers = { alc889_acer_aspire_8930g_mixer,
3405 alc883_chmode_mixer },
3406 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
3407 alc889_acer_aspire_8930g_verbs,
3408 alc889_eapd_verbs},
3409 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3410 .dac_nids = alc883_dac_nids,
3411 .num_adc_nids = ARRAY_SIZE(alc889_adc_nids),
3412 .adc_nids = alc889_adc_nids,
3413 .capsrc_nids = alc889_capsrc_nids,
3414 .dig_out_nid = ALC883_DIGOUT_NID,
3415 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
3416 .channel_mode = alc883_3ST_6ch_modes,
3417 .need_dac_fix = 1,
3418 .const_channel_count = 6,
3419 .num_mux_defs =
3420 ARRAY_SIZE(alc889_capture_sources),
3421 .input_mux = alc889_capture_sources,
3422 .unsol_event = alc_sku_unsol_event,
3423 .setup = alc889_acer_aspire_8930g_setup,
3424 .init_hook = alc_hp_automute,
3425#ifdef CONFIG_SND_HDA_POWER_SAVE
3426 .power_hook = alc_power_eapd,
3427#endif
3428 },
3429 [ALC888_ACER_ASPIRE_7730G] = {
3430 .mixers = { alc883_3ST_6ch_mixer,
3431 alc883_chmode_mixer },
3432 .init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
3433 alc888_acer_aspire_7730G_verbs },
3434 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3435 .dac_nids = alc883_dac_nids,
3436 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
3437 .adc_nids = alc883_adc_nids_rev,
3438 .capsrc_nids = alc883_capsrc_nids_rev,
3439 .dig_out_nid = ALC883_DIGOUT_NID,
3440 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
3441 .channel_mode = alc883_3ST_6ch_modes,
3442 .need_dac_fix = 1,
3443 .const_channel_count = 6,
3444 .input_mux = &alc883_capture_source,
3445 .unsol_event = alc_sku_unsol_event,
3446 .setup = alc888_acer_aspire_7730g_setup,
3447 .init_hook = alc_hp_automute,
3448 },
3449 [ALC883_MEDION] = {
3450 .mixers = { alc883_fivestack_mixer,
3451 alc883_chmode_mixer },
3452 .init_verbs = { alc883_init_verbs,
3453 alc883_medion_eapd_verbs },
3454 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3455 .dac_nids = alc883_dac_nids,
3456 .adc_nids = alc883_adc_nids_alt,
3457 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
3458 .capsrc_nids = alc883_capsrc_nids,
3459 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
3460 .channel_mode = alc883_sixstack_modes,
3461 .input_mux = &alc883_capture_source,
3462 },
3463 [ALC883_MEDION_WIM2160] = {
3464 .mixers = { alc883_medion_wim2160_mixer },
3465 .init_verbs = { alc883_init_verbs, alc883_medion_wim2160_verbs },
3466 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3467 .dac_nids = alc883_dac_nids,
3468 .dig_out_nid = ALC883_DIGOUT_NID,
3469 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids),
3470 .adc_nids = alc883_adc_nids,
3471 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
3472 .channel_mode = alc883_3ST_2ch_modes,
3473 .input_mux = &alc883_capture_source,
3474 .unsol_event = alc_sku_unsol_event,
3475 .setup = alc883_medion_wim2160_setup,
3476 .init_hook = alc_hp_automute,
3477 },
3478 [ALC883_LAPTOP_EAPD] = {
3479 .mixers = { alc883_base_mixer },
3480 .init_verbs = { alc883_init_verbs, alc882_eapd_verbs },
3481 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3482 .dac_nids = alc883_dac_nids,
3483 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
3484 .channel_mode = alc883_3ST_2ch_modes,
3485 .input_mux = &alc883_capture_source,
3486 },
3487 [ALC883_CLEVO_M540R] = {
3488 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
3489 .init_verbs = { alc883_init_verbs, alc883_clevo_m540r_verbs },
3490 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3491 .dac_nids = alc883_dac_nids,
3492 .dig_out_nid = ALC883_DIGOUT_NID,
3493 .dig_in_nid = ALC883_DIGIN_NID,
3494 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_clevo_modes),
3495 .channel_mode = alc883_3ST_6ch_clevo_modes,
3496 .need_dac_fix = 1,
3497 .input_mux = &alc883_capture_source,
3498 /* This machine has the hardware HP auto-muting, thus
3499 * we need no software mute via unsol event
3500 */
3501 },
3502 [ALC883_CLEVO_M720] = {
3503 .mixers = { alc883_clevo_m720_mixer },
3504 .init_verbs = { alc883_init_verbs, alc883_clevo_m720_verbs },
3505 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3506 .dac_nids = alc883_dac_nids,
3507 .dig_out_nid = ALC883_DIGOUT_NID,
3508 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
3509 .channel_mode = alc883_3ST_2ch_modes,
3510 .input_mux = &alc883_capture_source,
3511 .unsol_event = alc883_clevo_m720_unsol_event,
3512 .setup = alc883_clevo_m720_setup,
3513 .init_hook = alc883_clevo_m720_init_hook,
3514 },
3515 [ALC883_LENOVO_101E_2ch] = {
3516 .mixers = { alc883_lenovo_101e_2ch_mixer},
3517 .init_verbs = { alc883_init_verbs, alc883_lenovo_101e_verbs},
3518 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3519 .dac_nids = alc883_dac_nids,
3520 .adc_nids = alc883_adc_nids_alt,
3521 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_alt),
3522 .capsrc_nids = alc883_capsrc_nids,
3523 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
3524 .channel_mode = alc883_3ST_2ch_modes,
3525 .input_mux = &alc883_lenovo_101e_capture_source,
3526 .setup = alc883_lenovo_101e_setup,
3527 .unsol_event = alc_sku_unsol_event,
3528 .init_hook = alc_inithook,
3529 },
3530 [ALC883_LENOVO_NB0763] = {
3531 .mixers = { alc883_lenovo_nb0763_mixer },
3532 .init_verbs = { alc883_init_verbs, alc883_lenovo_nb0763_verbs},
3533 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3534 .dac_nids = alc883_dac_nids,
3535 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
3536 .channel_mode = alc883_3ST_2ch_modes,
3537 .need_dac_fix = 1,
3538 .input_mux = &alc883_lenovo_nb0763_capture_source,
3539 .unsol_event = alc_sku_unsol_event,
3540 .setup = alc883_lenovo_nb0763_setup,
3541 .init_hook = alc_hp_automute,
3542 },
3543 [ALC888_LENOVO_MS7195_DIG] = {
3544 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
3545 .init_verbs = { alc883_init_verbs, alc888_lenovo_ms7195_verbs},
3546 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3547 .dac_nids = alc883_dac_nids,
3548 .dig_out_nid = ALC883_DIGOUT_NID,
3549 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
3550 .channel_mode = alc883_3ST_6ch_modes,
3551 .need_dac_fix = 1,
3552 .input_mux = &alc883_capture_source,
3553 .unsol_event = alc_sku_unsol_event,
3554 .setup = alc888_lenovo_ms7195_setup,
3555 .init_hook = alc_inithook,
3556 },
3557 [ALC883_HAIER_W66] = {
3558 .mixers = { alc883_targa_2ch_mixer},
3559 .init_verbs = { alc883_init_verbs, alc883_haier_w66_verbs},
3560 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3561 .dac_nids = alc883_dac_nids,
3562 .dig_out_nid = ALC883_DIGOUT_NID,
3563 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
3564 .channel_mode = alc883_3ST_2ch_modes,
3565 .input_mux = &alc883_capture_source,
3566 .unsol_event = alc_sku_unsol_event,
3567 .setup = alc883_haier_w66_setup,
3568 .init_hook = alc_hp_automute,
3569 },
3570 [ALC888_3ST_HP] = {
3571 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
3572 .init_verbs = { alc883_init_verbs, alc888_3st_hp_verbs },
3573 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3574 .dac_nids = alc883_dac_nids,
3575 .num_channel_mode = ARRAY_SIZE(alc888_3st_hp_modes),
3576 .channel_mode = alc888_3st_hp_modes,
3577 .need_dac_fix = 1,
3578 .input_mux = &alc883_capture_source,
3579 .unsol_event = alc_sku_unsol_event,
3580 .setup = alc888_3st_hp_setup,
3581 .init_hook = alc_hp_automute,
3582 },
3583 [ALC888_6ST_DELL] = {
3584 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
3585 .init_verbs = { alc883_init_verbs, alc888_6st_dell_verbs },
3586 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3587 .dac_nids = alc883_dac_nids,
3588 .dig_out_nid = ALC883_DIGOUT_NID,
3589 .dig_in_nid = ALC883_DIGIN_NID,
3590 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
3591 .channel_mode = alc883_sixstack_modes,
3592 .input_mux = &alc883_capture_source,
3593 .unsol_event = alc_sku_unsol_event,
3594 .setup = alc888_6st_dell_setup,
3595 .init_hook = alc_hp_automute,
3596 },
3597 [ALC883_MITAC] = {
3598 .mixers = { alc883_mitac_mixer },
3599 .init_verbs = { alc883_init_verbs, alc883_mitac_verbs },
3600 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3601 .dac_nids = alc883_dac_nids,
3602 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
3603 .channel_mode = alc883_3ST_2ch_modes,
3604 .input_mux = &alc883_capture_source,
3605 .unsol_event = alc_sku_unsol_event,
3606 .setup = alc883_mitac_setup,
3607 .init_hook = alc_hp_automute,
3608 },
3609 [ALC883_FUJITSU_PI2515] = {
3610 .mixers = { alc883_2ch_fujitsu_pi2515_mixer },
3611 .init_verbs = { alc883_init_verbs,
3612 alc883_2ch_fujitsu_pi2515_verbs},
3613 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3614 .dac_nids = alc883_dac_nids,
3615 .dig_out_nid = ALC883_DIGOUT_NID,
3616 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
3617 .channel_mode = alc883_3ST_2ch_modes,
3618 .input_mux = &alc883_fujitsu_pi2515_capture_source,
3619 .unsol_event = alc_sku_unsol_event,
3620 .setup = alc883_2ch_fujitsu_pi2515_setup,
3621 .init_hook = alc_hp_automute,
3622 },
3623 [ALC888_FUJITSU_XA3530] = {
3624 .mixers = { alc888_base_mixer, alc883_chmode_mixer },
3625 .init_verbs = { alc883_init_verbs,
3626 alc888_fujitsu_xa3530_verbs },
3627 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3628 .dac_nids = alc883_dac_nids,
3629 .num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
3630 .adc_nids = alc883_adc_nids_rev,
3631 .capsrc_nids = alc883_capsrc_nids_rev,
3632 .dig_out_nid = ALC883_DIGOUT_NID,
3633 .num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
3634 .channel_mode = alc888_4ST_8ch_intel_modes,
3635 .num_mux_defs =
3636 ARRAY_SIZE(alc888_2_capture_sources),
3637 .input_mux = alc888_2_capture_sources,
3638 .unsol_event = alc_sku_unsol_event,
3639 .setup = alc888_fujitsu_xa3530_setup,
3640 .init_hook = alc_hp_automute,
3641 },
3642 [ALC888_LENOVO_SKY] = {
3643 .mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
3644 .init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},
3645 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3646 .dac_nids = alc883_dac_nids,
3647 .dig_out_nid = ALC883_DIGOUT_NID,
3648 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
3649 .channel_mode = alc883_sixstack_modes,
3650 .need_dac_fix = 1,
3651 .input_mux = &alc883_lenovo_sky_capture_source,
3652 .unsol_event = alc_sku_unsol_event,
3653 .setup = alc888_lenovo_sky_setup,
3654 .init_hook = alc_hp_automute,
3655 },
3656 [ALC888_ASUS_M90V] = {
3657 .mixers = { alc883_3ST_6ch_mixer, alc883_chmode_mixer },
3658 .init_verbs = { alc883_init_verbs, alc888_asus_m90v_verbs },
3659 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3660 .dac_nids = alc883_dac_nids,
3661 .dig_out_nid = ALC883_DIGOUT_NID,
3662 .dig_in_nid = ALC883_DIGIN_NID,
3663 .num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
3664 .channel_mode = alc883_3ST_6ch_modes,
3665 .need_dac_fix = 1,
3666 .input_mux = &alc883_fujitsu_pi2515_capture_source,
3667 .unsol_event = alc_sku_unsol_event,
3668 .setup = alc883_mode2_setup,
3669 .init_hook = alc_inithook,
3670 },
3671 [ALC888_ASUS_EEE1601] = {
3672 .mixers = { alc883_asus_eee1601_mixer },
3673 .cap_mixer = alc883_asus_eee1601_cap_mixer,
3674 .init_verbs = { alc883_init_verbs, alc888_asus_eee1601_verbs },
3675 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3676 .dac_nids = alc883_dac_nids,
3677 .dig_out_nid = ALC883_DIGOUT_NID,
3678 .dig_in_nid = ALC883_DIGIN_NID,
3679 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
3680 .channel_mode = alc883_3ST_2ch_modes,
3681 .need_dac_fix = 1,
3682 .input_mux = &alc883_asus_eee1601_capture_source,
3683 .unsol_event = alc_sku_unsol_event,
3684 .init_hook = alc883_eee1601_inithook,
3685 },
3686 [ALC1200_ASUS_P5Q] = {
3687 .mixers = { alc883_base_mixer, alc883_chmode_mixer },
3688 .init_verbs = { alc883_init_verbs },
3689 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3690 .dac_nids = alc883_dac_nids,
3691 .dig_out_nid = ALC1200_DIGOUT_NID,
3692 .dig_in_nid = ALC883_DIGIN_NID,
3693 .slave_dig_outs = alc1200_slave_dig_outs,
3694 .num_channel_mode = ARRAY_SIZE(alc883_sixstack_modes),
3695 .channel_mode = alc883_sixstack_modes,
3696 .input_mux = &alc883_capture_source,
3697 },
3698 [ALC889A_MB31] = { 843 [ALC889A_MB31] = {
3699 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer}, 844 .mixers = { alc889A_mb31_mixer, alc883_chmode_mixer},
3700 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs, 845 .init_verbs = { alc883_init_verbs, alc889A_mb31_verbs,
@@ -3711,18 +856,6 @@ static const struct alc_config_preset alc882_presets[] = {
3711 .unsol_event = alc889A_mb31_unsol_event, 856 .unsol_event = alc889A_mb31_unsol_event,
3712 .init_hook = alc889A_mb31_automute, 857 .init_hook = alc889A_mb31_automute,
3713 }, 858 },
3714 [ALC883_SONY_VAIO_TT] = {
3715 .mixers = { alc883_vaiott_mixer },
3716 .init_verbs = { alc883_init_verbs, alc883_vaiott_verbs },
3717 .num_dacs = ARRAY_SIZE(alc883_dac_nids),
3718 .dac_nids = alc883_dac_nids,
3719 .num_channel_mode = ARRAY_SIZE(alc883_3ST_2ch_modes),
3720 .channel_mode = alc883_3ST_2ch_modes,
3721 .input_mux = &alc883_capture_source,
3722 .unsol_event = alc_sku_unsol_event,
3723 .setup = alc883_vaiott_setup,
3724 .init_hook = alc_hp_automute,
3725 },
3726}; 859};
3727 860
3728 861
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 4562e9de6a1..4df72c0e8c3 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -33,6 +33,7 @@
33#include <sound/jack.h> 33#include <sound/jack.h>
34#include "hda_local.h" 34#include "hda_local.h"
35#include "hda_beep.h" 35#include "hda_beep.h"
36#include "hda_jack.h"
36#include <sound/hda_hwdep.h> 37#include <sound/hda_hwdep.h>
37 38
38#define CREATE_TRACE_POINTS 39#define CREATE_TRACE_POINTS
@@ -1723,43 +1724,6 @@ int snd_hda_override_pin_caps(struct hda_codec *codec, hda_nid_t nid,
1723} 1724}
1724EXPORT_SYMBOL_HDA(snd_hda_override_pin_caps); 1725EXPORT_SYMBOL_HDA(snd_hda_override_pin_caps);
1725 1726
1726/**
1727 * snd_hda_pin_sense - execute pin sense measurement
1728 * @codec: the CODEC to sense
1729 * @nid: the pin NID to sense
1730 *
1731 * Execute necessary pin sense measurement and return its Presence Detect,
1732 * Impedance, ELD Valid etc. status bits.
1733 */
1734u32 snd_hda_pin_sense(struct hda_codec *codec, hda_nid_t nid)
1735{
1736 u32 pincap;
1737
1738 if (!codec->no_trigger_sense) {
1739 pincap = snd_hda_query_pin_caps(codec, nid);
1740 if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */
1741 snd_hda_codec_read(codec, nid, 0,
1742 AC_VERB_SET_PIN_SENSE, 0);
1743 }
1744 return snd_hda_codec_read(codec, nid, 0,
1745 AC_VERB_GET_PIN_SENSE, 0);
1746}
1747EXPORT_SYMBOL_HDA(snd_hda_pin_sense);
1748
1749/**
1750 * snd_hda_jack_detect - query pin Presence Detect status
1751 * @codec: the CODEC to sense
1752 * @nid: the pin NID to sense
1753 *
1754 * Query and return the pin's Presence Detect status.
1755 */
1756int snd_hda_jack_detect(struct hda_codec *codec, hda_nid_t nid)
1757{
1758 u32 sense = snd_hda_pin_sense(codec, nid);
1759 return !!(sense & AC_PINSENSE_PRESENCE);
1760}
1761EXPORT_SYMBOL_HDA(snd_hda_jack_detect);
1762
1763/* 1727/*
1764 * read the current volume to info 1728 * read the current volume to info
1765 * if the cache exists, read the cache value. 1729 * if the cache exists, read the cache value.
@@ -2308,6 +2272,7 @@ int snd_hda_codec_reset(struct hda_codec *codec)
2308 } 2272 }
2309 if (codec->patch_ops.free) 2273 if (codec->patch_ops.free)
2310 codec->patch_ops.free(codec); 2274 codec->patch_ops.free(codec);
2275 snd_hda_jack_tbl_clear(codec);
2311 codec->proc_widget_hook = NULL; 2276 codec->proc_widget_hook = NULL;
2312 codec->spec = NULL; 2277 codec->spec = NULL;
2313 free_hda_cache(&codec->amp_cache); 2278 free_hda_cache(&codec->amp_cache);
@@ -3364,6 +3329,7 @@ static void hda_call_codec_resume(struct hda_codec *codec)
3364 restore_pincfgs(codec); /* restore all current pin configs */ 3329 restore_pincfgs(codec); /* restore all current pin configs */
3365 restore_shutup_pins(codec); 3330 restore_shutup_pins(codec);
3366 hda_exec_init_verbs(codec); 3331 hda_exec_init_verbs(codec);
3332 snd_hda_jack_set_dirty_all(codec);
3367 if (codec->patch_ops.resume) 3333 if (codec->patch_ops.resume)
3368 codec->patch_ops.resume(codec); 3334 codec->patch_ops.resume(codec);
3369 else { 3335 else {
@@ -3850,6 +3816,12 @@ static int get_empty_pcm_device(struct hda_bus *bus, int type)
3850 if (!test_and_set_bit(audio_idx[type][i], bus->pcm_dev_bits)) 3816 if (!test_and_set_bit(audio_idx[type][i], bus->pcm_dev_bits))
3851 return audio_idx[type][i]; 3817 return audio_idx[type][i];
3852 3818
3819 /* non-fixed slots starting from 10 */
3820 for (i = 10; i < 32; i++) {
3821 if (!test_and_set_bit(i, bus->pcm_dev_bits))
3822 return i;
3823 }
3824
3853 snd_printk(KERN_WARNING "Too many %s devices\n", 3825 snd_printk(KERN_WARNING "Too many %s devices\n",
3854 snd_hda_pcm_type_name[type]); 3826 snd_hda_pcm_type_name[type]);
3855 return -EAGAIN; 3827 return -EAGAIN;
@@ -5004,8 +4976,8 @@ EXPORT_SYMBOL_HDA(snd_hda_get_input_pin_attr);
5004 * "Rear", "Internal". 4976 * "Rear", "Internal".
5005 */ 4977 */
5006 4978
5007const char *hda_get_input_pin_label(struct hda_codec *codec, hda_nid_t pin, 4979static const char *hda_get_input_pin_label(struct hda_codec *codec,
5008 int check_location) 4980 hda_nid_t pin, bool check_location)
5009{ 4981{
5010 unsigned int def_conf; 4982 unsigned int def_conf;
5011 static const char * const mic_names[] = { 4983 static const char * const mic_names[] = {
@@ -5044,7 +5016,6 @@ const char *hda_get_input_pin_label(struct hda_codec *codec, hda_nid_t pin,
5044 return "Misc"; 5016 return "Misc";
5045 } 5017 }
5046} 5018}
5047EXPORT_SYMBOL_HDA(hda_get_input_pin_label);
5048 5019
5049/* Check whether the location prefix needs to be added to the label. 5020/* Check whether the location prefix needs to be added to the label.
5050 * If all mic-jacks are in the same location (e.g. rear panel), we don't 5021 * If all mic-jacks are in the same location (e.g. rear panel), we don't
@@ -5101,6 +5072,149 @@ const char *hda_get_autocfg_input_label(struct hda_codec *codec,
5101} 5072}
5102EXPORT_SYMBOL_HDA(hda_get_autocfg_input_label); 5073EXPORT_SYMBOL_HDA(hda_get_autocfg_input_label);
5103 5074
5075/* return the position of NID in the list, or -1 if not found */
5076static int find_idx_in_nid_list(hda_nid_t nid, const hda_nid_t *list, int nums)
5077{
5078 int i;
5079 for (i = 0; i < nums; i++)
5080 if (list[i] == nid)
5081 return i;
5082 return -1;
5083}
5084
5085/* get a unique suffix or an index number */
5086static const char *check_output_sfx(hda_nid_t nid, const hda_nid_t *pins,
5087 int num_pins, int *indexp)
5088{
5089 static const char * const channel_sfx[] = {
5090 " Front", " Surround", " CLFE", " Side"
5091 };
5092 int i;
5093
5094 i = find_idx_in_nid_list(nid, pins, num_pins);
5095 if (i < 0)
5096 return NULL;
5097 if (num_pins == 1)
5098 return "";
5099 if (num_pins > ARRAY_SIZE(channel_sfx)) {
5100 if (indexp)
5101 *indexp = i;
5102 return "";
5103 }
5104 return channel_sfx[i];
5105}
5106
5107static int fill_audio_out_name(struct hda_codec *codec, hda_nid_t nid,
5108 const struct auto_pin_cfg *cfg,
5109 const char *name, char *label, int maxlen,
5110 int *indexp)
5111{
5112 unsigned int def_conf = snd_hda_codec_get_pincfg(codec, nid);
5113 int attr = snd_hda_get_input_pin_attr(def_conf);
5114 const char *pfx = "", *sfx = "";
5115
5116 /* handle as a speaker if it's a fixed line-out */
5117 if (!strcmp(name, "Line-Out") && attr == INPUT_PIN_ATTR_INT)
5118 name = "Speaker";
5119 /* check the location */
5120 switch (attr) {
5121 case INPUT_PIN_ATTR_DOCK:
5122 pfx = "Dock ";
5123 break;
5124 case INPUT_PIN_ATTR_FRONT:
5125 pfx = "Front ";
5126 break;
5127 }
5128 if (cfg) {
5129 /* try to give a unique suffix if needed */
5130 sfx = check_output_sfx(nid, cfg->line_out_pins, cfg->line_outs,
5131 indexp);
5132 if (!sfx)
5133 sfx = check_output_sfx(nid, cfg->speaker_pins, cfg->speaker_outs,
5134 indexp);
5135 if (!sfx) {
5136 /* don't add channel suffix for Headphone controls */
5137 int idx = find_idx_in_nid_list(nid, cfg->hp_pins,
5138 cfg->hp_outs);
5139 if (idx >= 0)
5140 *indexp = idx;
5141 sfx = "";
5142 }
5143 }
5144 snprintf(label, maxlen, "%s%s%s", pfx, name, sfx);
5145 return 1;
5146}
5147
5148/**
5149 * snd_hda_get_pin_label - Get a label for the given I/O pin
5150 *
5151 * Get a label for the given pin. This function works for both input and
5152 * output pins. When @cfg is given as non-NULL, the function tries to get
5153 * an optimized label using hda_get_autocfg_input_label().
5154 *
5155 * This function tries to give a unique label string for the pin as much as
5156 * possible. For example, when the multiple line-outs are present, it adds
5157 * the channel suffix like "Front", "Surround", etc (only when @cfg is given).
5158 * If no unique name with a suffix is available and @indexp is non-NULL, the
5159 * index number is stored in the pointer.
5160 */
5161int snd_hda_get_pin_label(struct hda_codec *codec, hda_nid_t nid,
5162 const struct auto_pin_cfg *cfg,
5163 char *label, int maxlen, int *indexp)
5164{
5165 unsigned int def_conf = snd_hda_codec_get_pincfg(codec, nid);
5166 const char *name = NULL;
5167 int i;
5168
5169 if (indexp)
5170 *indexp = 0;
5171 if (get_defcfg_connect(def_conf) == AC_JACK_PORT_NONE)
5172 return 0;
5173
5174 switch (get_defcfg_device(def_conf)) {
5175 case AC_JACK_LINE_OUT:
5176 return fill_audio_out_name(codec, nid, cfg, "Line-Out",
5177 label, maxlen, indexp);
5178 case AC_JACK_SPEAKER:
5179 return fill_audio_out_name(codec, nid, cfg, "Speaker",
5180 label, maxlen, indexp);
5181 case AC_JACK_HP_OUT:
5182 return fill_audio_out_name(codec, nid, cfg, "Headphone",
5183 label, maxlen, indexp);
5184 case AC_JACK_SPDIF_OUT:
5185 case AC_JACK_DIG_OTHER_OUT:
5186 if (get_defcfg_location(def_conf) == AC_JACK_LOC_HDMI)
5187 name = "HDMI";
5188 else
5189 name = "SPDIF";
5190 if (cfg && indexp) {
5191 i = find_idx_in_nid_list(nid, cfg->dig_out_pins,
5192 cfg->dig_outs);
5193 if (i >= 0)
5194 *indexp = i;
5195 }
5196 break;
5197 default:
5198 if (cfg) {
5199 for (i = 0; i < cfg->num_inputs; i++) {
5200 if (cfg->inputs[i].pin != nid)
5201 continue;
5202 name = hda_get_autocfg_input_label(codec, cfg, i);
5203 if (name)
5204 break;
5205 }
5206 }
5207 if (!name)
5208 name = hda_get_input_pin_label(codec, nid, true);
5209 break;
5210 }
5211 if (!name)
5212 return 0;
5213 strlcpy(label, name, maxlen);
5214 return 1;
5215}
5216EXPORT_SYMBOL_HDA(snd_hda_get_pin_label);
5217
5104/** 5218/**
5105 * snd_hda_add_imux_item - Add an item to input_mux 5219 * snd_hda_add_imux_item - Add an item to input_mux
5106 * 5220 *
@@ -5252,113 +5366,5 @@ void snd_print_pcm_bits(int pcm, char *buf, int buflen)
5252} 5366}
5253EXPORT_SYMBOL_HDA(snd_print_pcm_bits); 5367EXPORT_SYMBOL_HDA(snd_print_pcm_bits);
5254 5368
5255#ifdef CONFIG_SND_HDA_INPUT_JACK
5256/*
5257 * Input-jack notification support
5258 */
5259struct hda_jack_item {
5260 hda_nid_t nid;
5261 int type;
5262 struct snd_jack *jack;
5263};
5264
5265static const char *get_jack_default_name(struct hda_codec *codec, hda_nid_t nid,
5266 int type)
5267{
5268 switch (type) {
5269 case SND_JACK_HEADPHONE:
5270 return "Headphone";
5271 case SND_JACK_MICROPHONE:
5272 return "Mic";
5273 case SND_JACK_LINEOUT:
5274 return "Line-out";
5275 case SND_JACK_LINEIN:
5276 return "Line-in";
5277 case SND_JACK_HEADSET:
5278 return "Headset";
5279 case SND_JACK_VIDEOOUT:
5280 return "HDMI/DP";
5281 default:
5282 return "Misc";
5283 }
5284}
5285
5286static void hda_free_jack_priv(struct snd_jack *jack)
5287{
5288 struct hda_jack_item *jacks = jack->private_data;
5289 jacks->nid = 0;
5290 jacks->jack = NULL;
5291}
5292
5293int snd_hda_input_jack_add(struct hda_codec *codec, hda_nid_t nid, int type,
5294 const char *name)
5295{
5296 struct hda_jack_item *jack;
5297 int err;
5298
5299 snd_array_init(&codec->jacks, sizeof(*jack), 32);
5300 jack = snd_array_new(&codec->jacks);
5301 if (!jack)
5302 return -ENOMEM;
5303
5304 jack->nid = nid;
5305 jack->type = type;
5306 if (!name)
5307 name = get_jack_default_name(codec, nid, type);
5308 err = snd_jack_new(codec->bus->card, name, type, &jack->jack);
5309 if (err < 0) {
5310 jack->nid = 0;
5311 return err;
5312 }
5313 jack->jack->private_data = jack;
5314 jack->jack->private_free = hda_free_jack_priv;
5315 return 0;
5316}
5317EXPORT_SYMBOL_HDA(snd_hda_input_jack_add);
5318
5319void snd_hda_input_jack_report(struct hda_codec *codec, hda_nid_t nid)
5320{
5321 struct hda_jack_item *jacks = codec->jacks.list;
5322 int i;
5323
5324 if (!jacks)
5325 return;
5326
5327 for (i = 0; i < codec->jacks.used; i++, jacks++) {
5328 unsigned int pin_ctl;
5329 unsigned int present;
5330 int type;
5331
5332 if (jacks->nid != nid)
5333 continue;
5334 present = snd_hda_jack_detect(codec, nid);
5335 type = jacks->type;
5336 if (type == (SND_JACK_HEADPHONE | SND_JACK_LINEOUT)) {
5337 pin_ctl = snd_hda_codec_read(codec, nid, 0,
5338 AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
5339 type = (pin_ctl & AC_PINCTL_HP_EN) ?
5340 SND_JACK_HEADPHONE : SND_JACK_LINEOUT;
5341 }
5342 snd_jack_report(jacks->jack, present ? type : 0);
5343 }
5344}
5345EXPORT_SYMBOL_HDA(snd_hda_input_jack_report);
5346
5347/* free jack instances manually when clearing/reconfiguring */
5348void snd_hda_input_jack_free(struct hda_codec *codec)
5349{
5350 if (!codec->bus->shutdown && codec->jacks.list) {
5351 struct hda_jack_item *jacks = codec->jacks.list;
5352 int i;
5353 for (i = 0; i < codec->jacks.used; i++, jacks++) {
5354 if (jacks->jack)
5355 snd_device_free(codec->bus->card, jacks->jack);
5356 }
5357 }
5358 snd_array_free(&codec->jacks);
5359}
5360EXPORT_SYMBOL_HDA(snd_hda_input_jack_free);
5361#endif /* CONFIG_SND_HDA_INPUT_JACK */
5362
5363MODULE_DESCRIPTION("HDA codec core"); 5369MODULE_DESCRIPTION("HDA codec core");
5364MODULE_LICENSE("GPL"); 5370MODULE_LICENSE("GPL");
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h
index 564471169ca..e9f71dc0d46 100644
--- a/sound/pci/hda/hda_codec.h
+++ b/sound/pci/hda/hda_codec.h
@@ -547,9 +547,6 @@ enum {
547/* max. codec address */ 547/* max. codec address */
548#define HDA_MAX_CODEC_ADDRESS 0x0f 548#define HDA_MAX_CODEC_ADDRESS 0x0f
549 549
550/* max number of PCM devics per card */
551#define HDA_MAX_PCMS 10
552
553/* 550/*
554 * generic arrays 551 * generic arrays
555 */ 552 */
@@ -869,6 +866,9 @@ struct hda_codec {
869 void (*proc_widget_hook)(struct snd_info_buffer *buffer, 866 void (*proc_widget_hook)(struct snd_info_buffer *buffer,
870 struct hda_codec *codec, hda_nid_t nid); 867 struct hda_codec *codec, hda_nid_t nid);
871 868
869 /* jack detection */
870 struct snd_array jacktbl;
871
872#ifdef CONFIG_SND_HDA_INPUT_JACK 872#ifdef CONFIG_SND_HDA_INPUT_JACK
873 /* jack detection */ 873 /* jack detection */
874 struct snd_array jacks; 874 struct snd_array jacks;
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 096507d2ca9..fb35474c120 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -58,13 +58,13 @@
58 58
59static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 59static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
60static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 60static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
61static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 61static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
62static char *model[SNDRV_CARDS]; 62static char *model[SNDRV_CARDS];
63static int position_fix[SNDRV_CARDS]; 63static int position_fix[SNDRV_CARDS];
64static int bdl_pos_adj[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = -1}; 64static int bdl_pos_adj[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = -1};
65static int probe_mask[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = -1}; 65static int probe_mask[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = -1};
66static int probe_only[SNDRV_CARDS]; 66static int probe_only[SNDRV_CARDS];
67static int single_cmd; 67static bool single_cmd;
68static int enable_msi = -1; 68static int enable_msi = -1;
69#ifdef CONFIG_SND_HDA_PATCH_LOADER 69#ifdef CONFIG_SND_HDA_PATCH_LOADER
70static char *patch[SNDRV_CARDS]; 70static char *patch[SNDRV_CARDS];
@@ -116,12 +116,12 @@ MODULE_PARM_DESC(power_save, "Automatic power-saving timeout "
116 * this may give more power-saving, but will take longer time to 116 * this may give more power-saving, but will take longer time to
117 * wake up. 117 * wake up.
118 */ 118 */
119static int power_save_controller = 1; 119static bool power_save_controller = 1;
120module_param(power_save_controller, bool, 0644); 120module_param(power_save_controller, bool, 0644);
121MODULE_PARM_DESC(power_save_controller, "Reset controller in power save mode."); 121MODULE_PARM_DESC(power_save_controller, "Reset controller in power save mode.");
122#endif 122#endif
123 123
124static int align_buffer_size = 1; 124static bool align_buffer_size = 1;
125module_param(align_buffer_size, bool, 0644); 125module_param(align_buffer_size, bool, 0644);
126MODULE_PARM_DESC(align_buffer_size, 126MODULE_PARM_DESC(align_buffer_size,
127 "Force buffer and period sizes to be multiple of 128 bytes."); 127 "Force buffer and period sizes to be multiple of 128 bytes.");
@@ -407,6 +407,14 @@ struct azx_rb {
407 u32 res[AZX_MAX_CODECS]; /* last read value */ 407 u32 res[AZX_MAX_CODECS]; /* last read value */
408}; 408};
409 409
410struct azx_pcm {
411 struct azx *chip;
412 struct snd_pcm *pcm;
413 struct hda_codec *codec;
414 struct hda_pcm_stream *hinfo[2];
415 struct list_head list;
416};
417
410struct azx { 418struct azx {
411 struct snd_card *card; 419 struct snd_card *card;
412 struct pci_dev *pci; 420 struct pci_dev *pci;
@@ -434,7 +442,7 @@ struct azx {
434 struct azx_dev *azx_dev; 442 struct azx_dev *azx_dev;
435 443
436 /* PCM */ 444 /* PCM */
437 struct snd_pcm *pcm[HDA_MAX_PCMS]; 445 struct list_head pcm_list; /* azx_pcm list */
438 446
439 /* HD codec */ 447 /* HD codec */
440 unsigned short codec_mask; 448 unsigned short codec_mask;
@@ -479,6 +487,7 @@ enum {
479 AZX_DRIVER_SCH, 487 AZX_DRIVER_SCH,
480 AZX_DRIVER_ATI, 488 AZX_DRIVER_ATI,
481 AZX_DRIVER_ATIHDMI, 489 AZX_DRIVER_ATIHDMI,
490 AZX_DRIVER_ATIHDMI_NS,
482 AZX_DRIVER_VIA, 491 AZX_DRIVER_VIA,
483 AZX_DRIVER_SIS, 492 AZX_DRIVER_SIS,
484 AZX_DRIVER_ULI, 493 AZX_DRIVER_ULI,
@@ -525,6 +534,7 @@ static char *driver_short_names[] __devinitdata = {
525 [AZX_DRIVER_SCH] = "HDA Intel MID", 534 [AZX_DRIVER_SCH] = "HDA Intel MID",
526 [AZX_DRIVER_ATI] = "HDA ATI SB", 535 [AZX_DRIVER_ATI] = "HDA ATI SB",
527 [AZX_DRIVER_ATIHDMI] = "HDA ATI HDMI", 536 [AZX_DRIVER_ATIHDMI] = "HDA ATI HDMI",
537 [AZX_DRIVER_ATIHDMI_NS] = "HDA ATI HDMI",
528 [AZX_DRIVER_VIA] = "HDA VIA VT82xx", 538 [AZX_DRIVER_VIA] = "HDA VIA VT82xx",
529 [AZX_DRIVER_SIS] = "HDA SIS966", 539 [AZX_DRIVER_SIS] = "HDA SIS966",
530 [AZX_DRIVER_ULI] = "HDA ULI M5461", 540 [AZX_DRIVER_ULI] = "HDA ULI M5461",
@@ -1143,16 +1153,6 @@ static void update_pci_byte(struct pci_dev *pci, unsigned int reg,
1143 1153
1144static void azx_init_pci(struct azx *chip) 1154static void azx_init_pci(struct azx *chip)
1145{ 1155{
1146 /* force to non-snoop mode for a new VIA controller when BIOS is set */
1147 if (chip->snoop && chip->driver_type == AZX_DRIVER_VIA) {
1148 u8 snoop;
1149 pci_read_config_byte(chip->pci, 0x42, &snoop);
1150 if (!(snoop & 0x80) && chip->pci->revision == 0x30) {
1151 chip->snoop = 0;
1152 snd_printdd(SFX "Force to non-snoop mode\n");
1153 }
1154 }
1155
1156 /* Clear bits 0-2 of PCI register TCSEL (at offset 0x44) 1156 /* Clear bits 0-2 of PCI register TCSEL (at offset 0x44)
1157 * TCSEL == Traffic Class Select Register, which sets PCI express QOS 1157 * TCSEL == Traffic Class Select Register, which sets PCI express QOS
1158 * Ensuring these bits are 0 clears playback static on some HD Audio 1158 * Ensuring these bits are 0 clears playback static on some HD Audio
@@ -1486,10 +1486,9 @@ static void azx_bus_reset(struct hda_bus *bus)
1486 azx_init_chip(chip, 1); 1486 azx_init_chip(chip, 1);
1487#ifdef CONFIG_PM 1487#ifdef CONFIG_PM
1488 if (chip->initialized) { 1488 if (chip->initialized) {
1489 int i; 1489 struct azx_pcm *p;
1490 1490 list_for_each_entry(p, &chip->pcm_list, list)
1491 for (i = 0; i < HDA_MAX_PCMS; i++) 1491 snd_pcm_suspend_all(p->pcm);
1492 snd_pcm_suspend_all(chip->pcm[i]);
1493 snd_hda_suspend(chip->bus); 1492 snd_hda_suspend(chip->bus);
1494 snd_hda_resume(chip->bus); 1493 snd_hda_resume(chip->bus);
1495 } 1494 }
@@ -1667,12 +1666,6 @@ static struct snd_pcm_hardware azx_pcm_hw = {
1667 .fifo_size = 0, 1666 .fifo_size = 0,
1668}; 1667};
1669 1668
1670struct azx_pcm {
1671 struct azx *chip;
1672 struct hda_codec *codec;
1673 struct hda_pcm_stream *hinfo[2];
1674};
1675
1676static int azx_pcm_open(struct snd_pcm_substream *substream) 1669static int azx_pcm_open(struct snd_pcm_substream *substream)
1677{ 1670{
1678 struct azx_pcm *apcm = snd_pcm_substream_chip(substream); 1671 struct azx_pcm *apcm = snd_pcm_substream_chip(substream);
@@ -2197,7 +2190,7 @@ static void azx_pcm_free(struct snd_pcm *pcm)
2197{ 2190{
2198 struct azx_pcm *apcm = pcm->private_data; 2191 struct azx_pcm *apcm = pcm->private_data;
2199 if (apcm) { 2192 if (apcm) {
2200 apcm->chip->pcm[pcm->device] = NULL; 2193 list_del(&apcm->list);
2201 kfree(apcm); 2194 kfree(apcm);
2202 } 2195 }
2203} 2196}
@@ -2215,14 +2208,11 @@ azx_attach_pcm_stream(struct hda_bus *bus, struct hda_codec *codec,
2215 unsigned int size; 2208 unsigned int size;
2216 int s, err; 2209 int s, err;
2217 2210
2218 if (pcm_dev >= HDA_MAX_PCMS) { 2211 list_for_each_entry(apcm, &chip->pcm_list, list) {
2219 snd_printk(KERN_ERR SFX "Invalid PCM device number %d\n", 2212 if (apcm->pcm->device == pcm_dev) {
2220 pcm_dev); 2213 snd_printk(KERN_ERR SFX "PCM %d already exists\n", pcm_dev);
2221 return -EINVAL; 2214 return -EBUSY;
2222 } 2215 }
2223 if (chip->pcm[pcm_dev]) {
2224 snd_printk(KERN_ERR SFX "PCM %d already exists\n", pcm_dev);
2225 return -EBUSY;
2226 } 2216 }
2227 err = snd_pcm_new(chip->card, cpcm->name, pcm_dev, 2217 err = snd_pcm_new(chip->card, cpcm->name, pcm_dev,
2228 cpcm->stream[SNDRV_PCM_STREAM_PLAYBACK].substreams, 2218 cpcm->stream[SNDRV_PCM_STREAM_PLAYBACK].substreams,
@@ -2235,12 +2225,13 @@ azx_attach_pcm_stream(struct hda_bus *bus, struct hda_codec *codec,
2235 if (apcm == NULL) 2225 if (apcm == NULL)
2236 return -ENOMEM; 2226 return -ENOMEM;
2237 apcm->chip = chip; 2227 apcm->chip = chip;
2228 apcm->pcm = pcm;
2238 apcm->codec = codec; 2229 apcm->codec = codec;
2239 pcm->private_data = apcm; 2230 pcm->private_data = apcm;
2240 pcm->private_free = azx_pcm_free; 2231 pcm->private_free = azx_pcm_free;
2241 if (cpcm->pcm_type == HDA_PCM_TYPE_MODEM) 2232 if (cpcm->pcm_type == HDA_PCM_TYPE_MODEM)
2242 pcm->dev_class = SNDRV_PCM_CLASS_MODEM; 2233 pcm->dev_class = SNDRV_PCM_CLASS_MODEM;
2243 chip->pcm[pcm_dev] = pcm; 2234 list_add_tail(&apcm->list, &chip->pcm_list);
2244 cpcm->pcm = pcm; 2235 cpcm->pcm = pcm;
2245 for (s = 0; s < 2; s++) { 2236 for (s = 0; s < 2; s++) {
2246 apcm->hinfo[s] = &cpcm->stream[s]; 2237 apcm->hinfo[s] = &cpcm->stream[s];
@@ -2370,12 +2361,12 @@ static int azx_suspend(struct pci_dev *pci, pm_message_t state)
2370{ 2361{
2371 struct snd_card *card = pci_get_drvdata(pci); 2362 struct snd_card *card = pci_get_drvdata(pci);
2372 struct azx *chip = card->private_data; 2363 struct azx *chip = card->private_data;
2373 int i; 2364 struct azx_pcm *p;
2374 2365
2375 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); 2366 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
2376 azx_clear_irq_pending(chip); 2367 azx_clear_irq_pending(chip);
2377 for (i = 0; i < HDA_MAX_PCMS; i++) 2368 list_for_each_entry(p, &chip->pcm_list, list)
2378 snd_pcm_suspend_all(chip->pcm[i]); 2369 snd_pcm_suspend_all(p->pcm);
2379 if (chip->initialized) 2370 if (chip->initialized)
2380 snd_hda_suspend(chip->bus); 2371 snd_hda_suspend(chip->bus);
2381 azx_stop_chip(chip); 2372 azx_stop_chip(chip);
@@ -2502,13 +2493,12 @@ static int azx_dev_free(struct snd_device *device)
2502static struct snd_pci_quirk position_fix_list[] __devinitdata = { 2493static struct snd_pci_quirk position_fix_list[] __devinitdata = {
2503 SND_PCI_QUIRK(0x1028, 0x01cc, "Dell D820", POS_FIX_LPIB), 2494 SND_PCI_QUIRK(0x1028, 0x01cc, "Dell D820", POS_FIX_LPIB),
2504 SND_PCI_QUIRK(0x1028, 0x01de, "Dell Precision 390", POS_FIX_LPIB), 2495 SND_PCI_QUIRK(0x1028, 0x01de, "Dell Precision 390", POS_FIX_LPIB),
2505 SND_PCI_QUIRK(0x1028, 0x02c6, "Dell Inspiron 1010", POS_FIX_LPIB),
2506 SND_PCI_QUIRK(0x103c, 0x306d, "HP dv3", POS_FIX_LPIB), 2496 SND_PCI_QUIRK(0x103c, 0x306d, "HP dv3", POS_FIX_LPIB),
2507 SND_PCI_QUIRK(0x1043, 0x813d, "ASUS P5AD2", POS_FIX_LPIB), 2497 SND_PCI_QUIRK(0x1043, 0x813d, "ASUS P5AD2", POS_FIX_LPIB),
2508 SND_PCI_QUIRK(0x1043, 0x81b3, "ASUS", POS_FIX_LPIB), 2498 SND_PCI_QUIRK(0x1043, 0x81b3, "ASUS", POS_FIX_LPIB),
2509 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS M2V", POS_FIX_LPIB), 2499 SND_PCI_QUIRK(0x1043, 0x81e7, "ASUS M2V", POS_FIX_LPIB),
2510 SND_PCI_QUIRK(0x104d, 0x9069, "Sony VPCS11V9E", POS_FIX_LPIB), 2500 SND_PCI_QUIRK(0x104d, 0x9069, "Sony VPCS11V9E", POS_FIX_LPIB),
2511 SND_PCI_QUIRK(0x1106, 0x3288, "ASUS M2V-MX SE", POS_FIX_LPIB), 2501 SND_PCI_QUIRK(0x10de, 0xcb89, "Macbook Pro 7,1", POS_FIX_LPIB),
2512 SND_PCI_QUIRK(0x1297, 0x3166, "Shuttle", POS_FIX_LPIB), 2502 SND_PCI_QUIRK(0x1297, 0x3166, "Shuttle", POS_FIX_LPIB),
2513 SND_PCI_QUIRK(0x1458, 0xa022, "ga-ma770-ud3", POS_FIX_LPIB), 2503 SND_PCI_QUIRK(0x1458, 0xa022, "ga-ma770-ud3", POS_FIX_LPIB),
2514 SND_PCI_QUIRK(0x1462, 0x1002, "MSI Wind U115", POS_FIX_LPIB), 2504 SND_PCI_QUIRK(0x1462, 0x1002, "MSI Wind U115", POS_FIX_LPIB),
@@ -2634,6 +2624,35 @@ static void __devinit check_msi(struct azx *chip)
2634 } 2624 }
2635} 2625}
2636 2626
2627/* check the snoop mode availability */
2628static void __devinit azx_check_snoop_available(struct azx *chip)
2629{
2630 bool snoop = chip->snoop;
2631
2632 switch (chip->driver_type) {
2633 case AZX_DRIVER_VIA:
2634 /* force to non-snoop mode for a new VIA controller
2635 * when BIOS is set
2636 */
2637 if (snoop) {
2638 u8 val;
2639 pci_read_config_byte(chip->pci, 0x42, &val);
2640 if (!(val & 0x80) && chip->pci->revision == 0x30)
2641 snoop = false;
2642 }
2643 break;
2644 case AZX_DRIVER_ATIHDMI_NS:
2645 /* new ATI HDMI requires non-snoop */
2646 snoop = false;
2647 break;
2648 }
2649
2650 if (snoop != chip->snoop) {
2651 snd_printk(KERN_INFO SFX "Force to %s mode\n",
2652 snoop ? "snoop" : "non-snoop");
2653 chip->snoop = snoop;
2654 }
2655}
2637 2656
2638/* 2657/*
2639 * constructor 2658 * constructor
@@ -2672,6 +2691,7 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci,
2672 check_msi(chip); 2691 check_msi(chip);
2673 chip->dev_index = dev; 2692 chip->dev_index = dev;
2674 INIT_WORK(&chip->irq_pending_work, azx_irq_pending_work); 2693 INIT_WORK(&chip->irq_pending_work, azx_irq_pending_work);
2694 INIT_LIST_HEAD(&chip->pcm_list);
2675 2695
2676 chip->position_fix[0] = chip->position_fix[1] = 2696 chip->position_fix[0] = chip->position_fix[1] =
2677 check_position_fix(chip, position_fix[dev]); 2697 check_position_fix(chip, position_fix[dev]);
@@ -2679,6 +2699,7 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci,
2679 2699
2680 chip->single_cmd = single_cmd; 2700 chip->single_cmd = single_cmd;
2681 chip->snoop = hda_snoop; 2701 chip->snoop = hda_snoop;
2702 azx_check_snoop_available(chip);
2682 2703
2683 if (bdl_pos_adj[dev] < 0) { 2704 if (bdl_pos_adj[dev] < 0) {
2684 switch (chip->driver_type) { 2705 switch (chip->driver_type) {
@@ -2777,6 +2798,7 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci,
2777 chip->capture_streams = ULI_NUM_CAPTURE; 2798 chip->capture_streams = ULI_NUM_CAPTURE;
2778 break; 2799 break;
2779 case AZX_DRIVER_ATIHDMI: 2800 case AZX_DRIVER_ATIHDMI:
2801 case AZX_DRIVER_ATIHDMI_NS:
2780 chip->playback_streams = ATIHDMI_NUM_PLAYBACK; 2802 chip->playback_streams = ATIHDMI_NUM_PLAYBACK;
2781 chip->capture_streams = ATIHDMI_NUM_CAPTURE; 2803 chip->capture_streams = ATIHDMI_NUM_CAPTURE;
2782 break; 2804 break;
@@ -2971,7 +2993,11 @@ static DEFINE_PCI_DEVICE_TABLE(azx_ids) = {
2971 /* SCH */ 2993 /* SCH */
2972 { PCI_DEVICE(0x8086, 0x811b), 2994 { PCI_DEVICE(0x8086, 0x811b),
2973 .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_SCH_SNOOP | 2995 .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_SCH_SNOOP |
2974 AZX_DCAPS_BUFSIZE}, 2996 AZX_DCAPS_BUFSIZE | AZX_DCAPS_POSFIX_LPIB }, /* Poulsbo */
2997 { PCI_DEVICE(0x8086, 0x080a),
2998 .driver_data = AZX_DRIVER_SCH | AZX_DCAPS_SCH_SNOOP |
2999 AZX_DCAPS_BUFSIZE | AZX_DCAPS_POSFIX_LPIB }, /* Oaktrail */
3000 /* ICH */
2975 { PCI_DEVICE(0x8086, 0x2668), 3001 { PCI_DEVICE(0x8086, 0x2668),
2976 .driver_data = AZX_DRIVER_ICH | AZX_DCAPS_OLD_SSYNC | 3002 .driver_data = AZX_DRIVER_ICH | AZX_DCAPS_OLD_SSYNC |
2977 AZX_DCAPS_BUFSIZE }, /* ICH6 */ 3003 AZX_DCAPS_BUFSIZE }, /* ICH6 */
@@ -3038,6 +3064,14 @@ static DEFINE_PCI_DEVICE_TABLE(azx_ids) = {
3038 .driver_data = AZX_DRIVER_ATIHDMI | AZX_DCAPS_PRESET_ATI_HDMI }, 3064 .driver_data = AZX_DRIVER_ATIHDMI | AZX_DCAPS_PRESET_ATI_HDMI },
3039 { PCI_DEVICE(0x1002, 0xaa48), 3065 { PCI_DEVICE(0x1002, 0xaa48),
3040 .driver_data = AZX_DRIVER_ATIHDMI | AZX_DCAPS_PRESET_ATI_HDMI }, 3066 .driver_data = AZX_DRIVER_ATIHDMI | AZX_DCAPS_PRESET_ATI_HDMI },
3067 { PCI_DEVICE(0x1002, 0x9902),
3068 .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI },
3069 { PCI_DEVICE(0x1002, 0xaaa0),
3070 .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI },
3071 { PCI_DEVICE(0x1002, 0xaaa8),
3072 .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI },
3073 { PCI_DEVICE(0x1002, 0xaab0),
3074 .driver_data = AZX_DRIVER_ATIHDMI_NS | AZX_DCAPS_PRESET_ATI_HDMI },
3041 /* VIA VT8251/VT8237A */ 3075 /* VIA VT8251/VT8237A */
3042 { PCI_DEVICE(0x1106, 0x3288), 3076 { PCI_DEVICE(0x1106, 0x3288),
3043 .driver_data = AZX_DRIVER_VIA | AZX_DCAPS_POSFIX_VIA }, 3077 .driver_data = AZX_DRIVER_VIA | AZX_DCAPS_POSFIX_VIA },
diff --git a/sound/pci/hda/hda_jack.c b/sound/pci/hda/hda_jack.c
new file mode 100644
index 00000000000..d8a35da0803
--- /dev/null
+++ b/sound/pci/hda/hda_jack.c
@@ -0,0 +1,353 @@
1/*
2 * Jack-detection handling for HD-audio
3 *
4 * Copyright (c) 2011 Takashi Iwai <tiwai@suse.de>
5 *
6 * This driver is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 */
11
12#include <linux/init.h>
13#include <linux/slab.h>
14#include <linux/export.h>
15#include <sound/core.h>
16#include <sound/control.h>
17#include <sound/jack.h>
18#include "hda_codec.h"
19#include "hda_local.h"
20#include "hda_jack.h"
21
22/* execute pin sense measurement */
23static u32 read_pin_sense(struct hda_codec *codec, hda_nid_t nid)
24{
25 u32 pincap;
26
27 if (!codec->no_trigger_sense) {
28 pincap = snd_hda_query_pin_caps(codec, nid);
29 if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */
30 snd_hda_codec_read(codec, nid, 0,
31 AC_VERB_SET_PIN_SENSE, 0);
32 }
33 return snd_hda_codec_read(codec, nid, 0,
34 AC_VERB_GET_PIN_SENSE, 0);
35}
36
37/**
38 * snd_hda_jack_tbl_get - query the jack-table entry for the given NID
39 */
40struct hda_jack_tbl *
41snd_hda_jack_tbl_get(struct hda_codec *codec, hda_nid_t nid)
42{
43 struct hda_jack_tbl *jack = codec->jacktbl.list;
44 int i;
45
46 if (!nid || !jack)
47 return NULL;
48 for (i = 0; i < codec->jacktbl.used; i++, jack++)
49 if (jack->nid == nid)
50 return jack;
51 return NULL;
52}
53EXPORT_SYMBOL_HDA(snd_hda_jack_tbl_get);
54
55/**
56 * snd_hda_jack_tbl_get_from_tag - query the jack-table entry for the given tag
57 */
58struct hda_jack_tbl *
59snd_hda_jack_tbl_get_from_tag(struct hda_codec *codec, unsigned char tag)
60{
61 struct hda_jack_tbl *jack = codec->jacktbl.list;
62 int i;
63
64 if (!tag || !jack)
65 return NULL;
66 for (i = 0; i < codec->jacktbl.used; i++, jack++)
67 if (jack->tag == tag)
68 return jack;
69 return NULL;
70}
71EXPORT_SYMBOL_HDA(snd_hda_jack_tbl_get_from_tag);
72
73/**
74 * snd_hda_jack_tbl_new - create a jack-table entry for the given NID
75 */
76struct hda_jack_tbl *
77snd_hda_jack_tbl_new(struct hda_codec *codec, hda_nid_t nid)
78{
79 struct hda_jack_tbl *jack = snd_hda_jack_tbl_get(codec, nid);
80 if (jack)
81 return jack;
82 snd_array_init(&codec->jacktbl, sizeof(*jack), 16);
83 jack = snd_array_new(&codec->jacktbl);
84 if (!jack)
85 return NULL;
86 jack->nid = nid;
87 jack->jack_dirty = 1;
88 jack->tag = codec->jacktbl.used;
89 return jack;
90}
91EXPORT_SYMBOL_HDA(snd_hda_jack_tbl_new);
92
93void snd_hda_jack_tbl_clear(struct hda_codec *codec)
94{
95#ifdef CONFIG_SND_HDA_INPUT_JACK
96 /* free jack instances manually when clearing/reconfiguring */
97 if (!codec->bus->shutdown && codec->jacktbl.list) {
98 struct hda_jack_tbl *jack = codec->jacktbl.list;
99 int i;
100 for (i = 0; i < codec->jacktbl.used; i++, jack++) {
101 if (jack->jack)
102 snd_device_free(codec->bus->card, jack->jack);
103 }
104 }
105#endif
106 snd_array_free(&codec->jacktbl);
107}
108
109/* update the cached value and notification flag if needed */
110static void jack_detect_update(struct hda_codec *codec,
111 struct hda_jack_tbl *jack)
112{
113 if (jack->jack_dirty || !jack->jack_detect) {
114 jack->pin_sense = read_pin_sense(codec, jack->nid);
115 jack->jack_dirty = 0;
116 }
117}
118
119/**
120 * snd_hda_set_dirty_all - Mark all the cached as dirty
121 *
122 * This function sets the dirty flag to all entries of jack table.
123 * It's called from the resume path in hda_codec.c.
124 */
125void snd_hda_jack_set_dirty_all(struct hda_codec *codec)
126{
127 struct hda_jack_tbl *jack = codec->jacktbl.list;
128 int i;
129
130 for (i = 0; i < codec->jacktbl.used; i++, jack++)
131 if (jack->nid)
132 jack->jack_dirty = 1;
133}
134EXPORT_SYMBOL_HDA(snd_hda_jack_set_dirty_all);
135
136/**
137 * snd_hda_pin_sense - execute pin sense measurement
138 * @codec: the CODEC to sense
139 * @nid: the pin NID to sense
140 *
141 * Execute necessary pin sense measurement and return its Presence Detect,
142 * Impedance, ELD Valid etc. status bits.
143 */
144u32 snd_hda_pin_sense(struct hda_codec *codec, hda_nid_t nid)
145{
146 struct hda_jack_tbl *jack = snd_hda_jack_tbl_get(codec, nid);
147 if (jack) {
148 jack_detect_update(codec, jack);
149 return jack->pin_sense;
150 }
151 return read_pin_sense(codec, nid);
152}
153EXPORT_SYMBOL_HDA(snd_hda_pin_sense);
154
155#define get_jack_plug_state(sense) !!(sense & AC_PINSENSE_PRESENCE)
156
157/**
158 * snd_hda_jack_detect - query pin Presence Detect status
159 * @codec: the CODEC to sense
160 * @nid: the pin NID to sense
161 *
162 * Query and return the pin's Presence Detect status.
163 */
164int snd_hda_jack_detect(struct hda_codec *codec, hda_nid_t nid)
165{
166 u32 sense = snd_hda_pin_sense(codec, nid);
167 return get_jack_plug_state(sense);
168}
169EXPORT_SYMBOL_HDA(snd_hda_jack_detect);
170
171/**
172 * snd_hda_jack_detect_enable - enable the jack-detection
173 */
174int snd_hda_jack_detect_enable(struct hda_codec *codec, hda_nid_t nid,
175 unsigned char action)
176{
177 struct hda_jack_tbl *jack = snd_hda_jack_tbl_new(codec, nid);
178 if (!jack)
179 return -ENOMEM;
180 if (jack->jack_detect)
181 return 0; /* already registered */
182 jack->jack_detect = 1;
183 if (action)
184 jack->action = action;
185 return snd_hda_codec_write_cache(codec, nid, 0,
186 AC_VERB_SET_UNSOLICITED_ENABLE,
187 AC_USRSP_EN | jack->tag);
188}
189EXPORT_SYMBOL_HDA(snd_hda_jack_detect_enable);
190
191/**
192 * snd_hda_jack_report_sync - sync the states of all jacks and report if changed
193 */
194void snd_hda_jack_report_sync(struct hda_codec *codec)
195{
196 struct hda_jack_tbl *jack = codec->jacktbl.list;
197 int i, state;
198
199 for (i = 0; i < codec->jacktbl.used; i++, jack++)
200 if (jack->nid) {
201 jack_detect_update(codec, jack);
202 if (!jack->kctl)
203 continue;
204 state = get_jack_plug_state(jack->pin_sense);
205 snd_kctl_jack_report(codec->bus->card, jack->kctl, state);
206#ifdef CONFIG_SND_HDA_INPUT_JACK
207 if (jack->jack)
208 snd_jack_report(jack->jack,
209 state ? jack->type : 0);
210#endif
211 }
212}
213EXPORT_SYMBOL_HDA(snd_hda_jack_report_sync);
214
215#ifdef CONFIG_SND_HDA_INPUT_JACK
216/* guess the jack type from the pin-config */
217static int get_input_jack_type(struct hda_codec *codec, hda_nid_t nid)
218{
219 unsigned int def_conf = snd_hda_codec_get_pincfg(codec, nid);
220 switch (get_defcfg_device(def_conf)) {
221 case AC_JACK_LINE_OUT:
222 case AC_JACK_SPEAKER:
223 return SND_JACK_LINEOUT;
224 case AC_JACK_HP_OUT:
225 return SND_JACK_HEADPHONE;
226 case AC_JACK_SPDIF_OUT:
227 case AC_JACK_DIG_OTHER_OUT:
228 return SND_JACK_AVOUT;
229 case AC_JACK_MIC_IN:
230 return SND_JACK_MICROPHONE;
231 default:
232 return SND_JACK_LINEIN;
233 }
234}
235
236static void hda_free_jack_priv(struct snd_jack *jack)
237{
238 struct hda_jack_tbl *jacks = jack->private_data;
239 jacks->nid = 0;
240 jacks->jack = NULL;
241}
242#endif
243
244/**
245 * snd_hda_jack_add_kctl - Add a kctl for the given pin
246 *
247 * This assigns a jack-detection kctl to the given pin. The kcontrol
248 * will have the given name and index.
249 */
250int snd_hda_jack_add_kctl(struct hda_codec *codec, hda_nid_t nid,
251 const char *name, int idx)
252{
253 struct hda_jack_tbl *jack;
254 struct snd_kcontrol *kctl;
255 int err, state;
256
257 jack = snd_hda_jack_tbl_new(codec, nid);
258 if (!jack)
259 return 0;
260 if (jack->kctl)
261 return 0; /* already created */
262 kctl = snd_kctl_jack_new(name, idx, codec);
263 if (!kctl)
264 return -ENOMEM;
265 err = snd_hda_ctl_add(codec, nid, kctl);
266 if (err < 0)
267 return err;
268 jack->kctl = kctl;
269 state = snd_hda_jack_detect(codec, nid);
270 snd_kctl_jack_report(codec->bus->card, kctl, state);
271#ifdef CONFIG_SND_HDA_INPUT_JACK
272 jack->type = get_input_jack_type(codec, nid);
273 err = snd_jack_new(codec->bus->card, name, jack->type, &jack->jack);
274 if (err < 0)
275 return err;
276 jack->jack->private_data = jack;
277 jack->jack->private_free = hda_free_jack_priv;
278 snd_jack_report(jack->jack, state ? jack->type : 0);
279#endif
280 return 0;
281}
282EXPORT_SYMBOL_HDA(snd_hda_jack_add_kctl);
283
284static int add_jack_kctl(struct hda_codec *codec, hda_nid_t nid,
285 const struct auto_pin_cfg *cfg)
286{
287 unsigned int def_conf, conn;
288 char name[44];
289 int idx, err;
290
291 if (!nid)
292 return 0;
293 if (!is_jack_detectable(codec, nid))
294 return 0;
295 def_conf = snd_hda_codec_get_pincfg(codec, nid);
296 conn = get_defcfg_connect(def_conf);
297 if (conn != AC_JACK_PORT_COMPLEX)
298 return 0;
299
300 snd_hda_get_pin_label(codec, nid, cfg, name, sizeof(name), &idx);
301 err = snd_hda_jack_add_kctl(codec, nid, name, idx);
302 if (err < 0)
303 return err;
304 return snd_hda_jack_detect_enable(codec, nid, 0);
305}
306
307/**
308 * snd_hda_jack_add_kctls - Add kctls for all pins included in the given pincfg
309 */
310int snd_hda_jack_add_kctls(struct hda_codec *codec,
311 const struct auto_pin_cfg *cfg)
312{
313 const hda_nid_t *p;
314 int i, err;
315
316 for (i = 0, p = cfg->line_out_pins; i < cfg->line_outs; i++, p++) {
317 err = add_jack_kctl(codec, *p, cfg);
318 if (err < 0)
319 return err;
320 }
321 for (i = 0, p = cfg->hp_pins; i < cfg->hp_outs; i++, p++) {
322 if (*p == *cfg->line_out_pins) /* might be duplicated */
323 break;
324 err = add_jack_kctl(codec, *p, cfg);
325 if (err < 0)
326 return err;
327 }
328 for (i = 0, p = cfg->speaker_pins; i < cfg->speaker_outs; i++, p++) {
329 if (*p == *cfg->line_out_pins) /* might be duplicated */
330 break;
331 err = add_jack_kctl(codec, *p, cfg);
332 if (err < 0)
333 return err;
334 }
335 for (i = 0; i < cfg->num_inputs; i++) {
336 err = add_jack_kctl(codec, cfg->inputs[i].pin, cfg);
337 if (err < 0)
338 return err;
339 }
340 for (i = 0, p = cfg->dig_out_pins; i < cfg->dig_outs; i++, p++) {
341 err = add_jack_kctl(codec, *p, cfg);
342 if (err < 0)
343 return err;
344 }
345 err = add_jack_kctl(codec, cfg->dig_in_pin, cfg);
346 if (err < 0)
347 return err;
348 err = add_jack_kctl(codec, cfg->mono_out_pin, cfg);
349 if (err < 0)
350 return err;
351 return 0;
352}
353EXPORT_SYMBOL_HDA(snd_hda_jack_add_kctls);
diff --git a/sound/pci/hda/hda_jack.h b/sound/pci/hda/hda_jack.h
new file mode 100644
index 00000000000..f8f97c71c9c
--- /dev/null
+++ b/sound/pci/hda/hda_jack.h
@@ -0,0 +1,86 @@
1/*
2 * Jack-detection handling for HD-audio
3 *
4 * Copyright (c) 2011 Takashi Iwai <tiwai@suse.de>
5 *
6 * This driver is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 */
11
12#ifndef __SOUND_HDA_JACK_H
13#define __SOUND_HDA_JACK_H
14
15struct hda_jack_tbl {
16 hda_nid_t nid;
17 unsigned char action; /* event action (0 = none) */
18 unsigned char tag; /* unsol event tag */
19 unsigned int private_data; /* arbitrary data */
20 /* jack-detection stuff */
21 unsigned int pin_sense; /* cached pin-sense value */
22 unsigned int jack_detect:1; /* capable of jack-detection? */
23 unsigned int jack_dirty:1; /* needs to update? */
24 struct snd_kcontrol *kctl; /* assigned kctl for jack-detection */
25#ifdef CONFIG_SND_HDA_INPUT_JACK
26 int type;
27 struct snd_jack *jack;
28#endif
29};
30
31struct hda_jack_tbl *
32snd_hda_jack_tbl_get(struct hda_codec *codec, hda_nid_t nid);
33struct hda_jack_tbl *
34snd_hda_jack_tbl_get_from_tag(struct hda_codec *codec, unsigned char tag);
35
36struct hda_jack_tbl *
37snd_hda_jack_tbl_new(struct hda_codec *codec, hda_nid_t nid);
38void snd_hda_jack_tbl_clear(struct hda_codec *codec);
39
40/**
41 * snd_hda_jack_get_action - get jack-tbl entry for the tag
42 *
43 * Call this from the unsol event handler to get the assigned action for the
44 * event. This will mark the dirty flag for the later reporting, too.
45 */
46static inline unsigned char
47snd_hda_jack_get_action(struct hda_codec *codec, unsigned int tag)
48{
49 struct hda_jack_tbl *jack = snd_hda_jack_tbl_get_from_tag(codec, tag);
50 if (jack) {
51 jack->jack_dirty = 1;
52 return jack->action;
53 }
54 return 0;
55}
56
57void snd_hda_jack_set_dirty_all(struct hda_codec *codec);
58
59int snd_hda_jack_detect_enable(struct hda_codec *codec, hda_nid_t nid,
60 unsigned char action);
61
62u32 snd_hda_pin_sense(struct hda_codec *codec, hda_nid_t nid);
63int snd_hda_jack_detect(struct hda_codec *codec, hda_nid_t nid);
64
65static inline bool is_jack_detectable(struct hda_codec *codec, hda_nid_t nid)
66{
67 if (!(snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_PRES_DETECT))
68 return false;
69 if (!codec->ignore_misc_bit &&
70 (get_defcfg_misc(snd_hda_codec_get_pincfg(codec, nid)) &
71 AC_DEFCFG_MISC_NO_PRESENCE))
72 return false;
73 if (!(get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP))
74 return false;
75 return true;
76}
77
78int snd_hda_jack_add_kctl(struct hda_codec *codec, hda_nid_t nid,
79 const char *name, int idx);
80int snd_hda_jack_add_kctls(struct hda_codec *codec,
81 const struct auto_pin_cfg *cfg);
82
83void snd_hda_jack_report_sync(struct hda_codec *codec);
84
85
86#endif /* __SOUND_HDA_JACK_H */
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h
index 618ddad1723..aca8d3193b9 100644
--- a/sound/pci/hda/hda_local.h
+++ b/sound/pci/hda/hda_local.h
@@ -394,11 +394,12 @@ struct auto_pin_cfg_item {
394}; 394};
395 395
396struct auto_pin_cfg; 396struct auto_pin_cfg;
397const char *hda_get_input_pin_label(struct hda_codec *codec, hda_nid_t pin,
398 int check_location);
399const char *hda_get_autocfg_input_label(struct hda_codec *codec, 397const char *hda_get_autocfg_input_label(struct hda_codec *codec,
400 const struct auto_pin_cfg *cfg, 398 const struct auto_pin_cfg *cfg,
401 int input); 399 int input);
400int snd_hda_get_pin_label(struct hda_codec *codec, hda_nid_t nid,
401 const struct auto_pin_cfg *cfg,
402 char *label, int maxlen, int *indexp);
402int snd_hda_add_imux_item(struct hda_input_mux *imux, const char *label, 403int snd_hda_add_imux_item(struct hda_input_mux *imux, const char *label,
403 int index, int *type_index_ret); 404 int index, int *type_index_ret);
404 405
@@ -487,7 +488,12 @@ static inline u32 get_wcaps(struct hda_codec *codec, hda_nid_t nid)
487} 488}
488 489
489/* get the widget type from widget capability bits */ 490/* get the widget type from widget capability bits */
490#define get_wcaps_type(wcaps) (((wcaps) & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT) 491static inline int get_wcaps_type(unsigned int wcaps)
492{
493 if (!wcaps)
494 return -1; /* invalid type */
495 return (wcaps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
496}
491 497
492static inline unsigned int get_wcaps_channels(u32 wcaps) 498static inline unsigned int get_wcaps_channels(u32 wcaps)
493{ 499{
@@ -505,21 +511,6 @@ int snd_hda_override_amp_caps(struct hda_codec *codec, hda_nid_t nid, int dir,
505u32 snd_hda_query_pin_caps(struct hda_codec *codec, hda_nid_t nid); 511u32 snd_hda_query_pin_caps(struct hda_codec *codec, hda_nid_t nid);
506int snd_hda_override_pin_caps(struct hda_codec *codec, hda_nid_t nid, 512int snd_hda_override_pin_caps(struct hda_codec *codec, hda_nid_t nid,
507 unsigned int caps); 513 unsigned int caps);
508u32 snd_hda_pin_sense(struct hda_codec *codec, hda_nid_t nid);
509int snd_hda_jack_detect(struct hda_codec *codec, hda_nid_t nid);
510
511static inline bool is_jack_detectable(struct hda_codec *codec, hda_nid_t nid)
512{
513 if (!(snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_PRES_DETECT))
514 return false;
515 if (!codec->ignore_misc_bit &&
516 (get_defcfg_misc(snd_hda_codec_get_pincfg(codec, nid)) &
517 AC_DEFCFG_MISC_NO_PRESENCE))
518 return false;
519 if (!(get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP))
520 return false;
521 return true;
522}
523 514
524/* flags for hda_nid_item */ 515/* flags for hda_nid_item */
525#define HDA_NID_ITEM_AMP (1<<0) 516#define HDA_NID_ITEM_AMP (1<<0)
@@ -688,28 +679,4 @@ static inline void snd_hda_eld_proc_free(struct hda_codec *codec,
688#define SND_PRINT_CHANNEL_ALLOCATION_ADVISED_BUFSIZE 80 679#define SND_PRINT_CHANNEL_ALLOCATION_ADVISED_BUFSIZE 80
689void snd_print_channel_allocation(int spk_alloc, char *buf, int buflen); 680void snd_print_channel_allocation(int spk_alloc, char *buf, int buflen);
690 681
691/*
692 * Input-jack notification support
693 */
694#ifdef CONFIG_SND_HDA_INPUT_JACK
695int snd_hda_input_jack_add(struct hda_codec *codec, hda_nid_t nid, int type,
696 const char *name);
697void snd_hda_input_jack_report(struct hda_codec *codec, hda_nid_t nid);
698void snd_hda_input_jack_free(struct hda_codec *codec);
699#else /* CONFIG_SND_HDA_INPUT_JACK */
700static inline int snd_hda_input_jack_add(struct hda_codec *codec,
701 hda_nid_t nid, int type,
702 const char *name)
703{
704 return 0;
705}
706static inline void snd_hda_input_jack_report(struct hda_codec *codec,
707 hda_nid_t nid)
708{
709}
710static inline void snd_hda_input_jack_free(struct hda_codec *codec)
711{
712}
713#endif /* CONFIG_SND_HDA_INPUT_JACK */
714
715#endif /* __SOUND_HDA_LOCAL_H */ 682#endif /* __SOUND_HDA_LOCAL_H */
diff --git a/sound/pci/hda/hda_proc.c b/sound/pci/hda/hda_proc.c
index 2c981b55940..254ab520460 100644
--- a/sound/pci/hda/hda_proc.c
+++ b/sound/pci/hda/hda_proc.c
@@ -54,6 +54,8 @@ static const char *get_wid_type_name(unsigned int wid_value)
54 [AC_WID_BEEP] = "Beep Generator Widget", 54 [AC_WID_BEEP] = "Beep Generator Widget",
55 [AC_WID_VENDOR] = "Vendor Defined Widget", 55 [AC_WID_VENDOR] = "Vendor Defined Widget",
56 }; 56 };
57 if (wid_value == -1)
58 return "UNKNOWN Widget";
57 wid_value &= 0xf; 59 wid_value &= 0xf;
58 if (names[wid_value]) 60 if (names[wid_value])
59 return names[wid_value]; 61 return names[wid_value];
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
index bcb3310c394..9cb14b42dff 100644
--- a/sound/pci/hda/patch_analog.c
+++ b/sound/pci/hda/patch_analog.c
@@ -29,6 +29,7 @@
29#include "hda_codec.h" 29#include "hda_codec.h"
30#include "hda_local.h" 30#include "hda_local.h"
31#include "hda_beep.h" 31#include "hda_beep.h"
32#include "hda_jack.h"
32 33
33struct ad198x_spec { 34struct ad198x_spec {
34 const struct snd_kcontrol_new *mixers[6]; 35 const struct snd_kcontrol_new *mixers[6];
diff --git a/sound/pci/hda/patch_ca0110.c b/sound/pci/hda/patch_ca0110.c
index 993757b6573..09ccfabb4a1 100644
--- a/sound/pci/hda/patch_ca0110.c
+++ b/sound/pci/hda/patch_ca0110.c
@@ -41,7 +41,7 @@ struct ca0110_spec {
41 hda_nid_t dig_out; 41 hda_nid_t dig_out;
42 hda_nid_t dig_in; 42 hda_nid_t dig_in;
43 unsigned int num_inputs; 43 unsigned int num_inputs;
44 const char *input_labels[AUTO_PIN_LAST]; 44 char input_labels[AUTO_PIN_LAST][32];
45 struct hda_pcm pcm_rec[2]; /* PCM information */ 45 struct hda_pcm pcm_rec[2]; /* PCM information */
46}; 46};
47 47
@@ -476,7 +476,9 @@ static void parse_input(struct hda_codec *codec)
476 if (j >= cfg->num_inputs) 476 if (j >= cfg->num_inputs)
477 continue; 477 continue;
478 spec->input_pins[n] = pin; 478 spec->input_pins[n] = pin;
479 spec->input_labels[n] = hda_get_input_pin_label(codec, pin, 1); 479 snd_hda_get_pin_label(codec, pin, cfg,
480 spec->input_labels[n],
481 sizeof(spec->input_labels[n]), NULL);
480 spec->adcs[n] = nid; 482 spec->adcs[n] = nid;
481 n++; 483 n++;
482 } 484 }
diff --git a/sound/pci/hda/patch_cirrus.c b/sound/pci/hda/patch_cirrus.c
index 70a7abda7e2..0e99357e822 100644
--- a/sound/pci/hda/patch_cirrus.c
+++ b/sound/pci/hda/patch_cirrus.c
@@ -26,6 +26,7 @@
26#include <sound/core.h> 26#include <sound/core.h>
27#include "hda_codec.h" 27#include "hda_codec.h"
28#include "hda_local.h" 28#include "hda_local.h"
29#include "hda_jack.h"
29#include <sound/tlv.h> 30#include <sound/tlv.h>
30 31
31/* 32/*
@@ -78,6 +79,7 @@ enum {
78 CS420X_MBP53, 79 CS420X_MBP53,
79 CS420X_MBP55, 80 CS420X_MBP55,
80 CS420X_IMAC27, 81 CS420X_IMAC27,
82 CS420X_IMAC27_122,
81 CS420X_APPLE, 83 CS420X_APPLE,
82 CS420X_AUTO, 84 CS420X_AUTO,
83 CS420X_MODELS 85 CS420X_MODELS
@@ -137,7 +139,7 @@ enum {
137*/ 139*/
138#define CS4210_DAC_NID 0x02 140#define CS4210_DAC_NID 0x02
139#define CS4210_ADC_NID 0x03 141#define CS4210_ADC_NID 0x03
140#define CS421X_VENDOR_NID 0x0B 142#define CS4210_VENDOR_NID 0x0B
141#define CS421X_DMIC_PIN_NID 0x09 /* Port E */ 143#define CS421X_DMIC_PIN_NID 0x09 /* Port E */
142#define CS421X_SPDIF_PIN_NID 0x0A /* Port H */ 144#define CS421X_SPDIF_PIN_NID 0x0A /* Port H */
143 145
@@ -148,6 +150,10 @@ enum {
148 150
149#define SPDIF_EVENT 0x04 151#define SPDIF_EVENT 0x04
150 152
153/* Cirrus Logic CS4213 is like CS4210 but does not have SPDIF input/output */
154#define CS4213_VENDOR_NID 0x09
155
156
151static inline int cs_vendor_coef_get(struct hda_codec *codec, unsigned int idx) 157static inline int cs_vendor_coef_get(struct hda_codec *codec, unsigned int idx)
152{ 158{
153 struct cs_spec *spec = codec->spec; 159 struct cs_spec *spec = codec->spec;
@@ -721,8 +727,9 @@ static int cs_capture_source_info(struct snd_kcontrol *kcontrol,
721 if (uinfo->value.enumerated.item >= spec->num_inputs) 727 if (uinfo->value.enumerated.item >= spec->num_inputs)
722 uinfo->value.enumerated.item = spec->num_inputs - 1; 728 uinfo->value.enumerated.item = spec->num_inputs - 1;
723 idx = spec->input_idx[uinfo->value.enumerated.item]; 729 idx = spec->input_idx[uinfo->value.enumerated.item];
724 strcpy(uinfo->value.enumerated.name, 730 snd_hda_get_pin_label(codec, cfg->inputs[idx].pin, cfg,
725 hda_get_input_pin_label(codec, cfg->inputs[idx].pin, 1)); 731 uinfo->value.enumerated.name,
732 sizeof(uinfo->value.enumerated.name), NULL);
726 return 0; 733 return 0;
727} 734}
728 735
@@ -920,16 +927,14 @@ static void cs_automute(struct hda_codec *codec)
920 927
921 /* mute speakers if spdif or hp jack is plugged in */ 928 /* mute speakers if spdif or hp jack is plugged in */
922 for (i = 0; i < cfg->speaker_outs; i++) { 929 for (i = 0; i < cfg->speaker_outs; i++) {
930 int pin_ctl = hp_present ? 0 : PIN_OUT;
931 /* detect on spdif is specific to CS4210 */
932 if (spdif_present && (spec->vendor_nid == CS4210_VENDOR_NID))
933 pin_ctl = 0;
934
923 nid = cfg->speaker_pins[i]; 935 nid = cfg->speaker_pins[i];
924 snd_hda_codec_write(codec, nid, 0, 936 snd_hda_codec_write(codec, nid, 0,
925 AC_VERB_SET_PIN_WIDGET_CONTROL, 937 AC_VERB_SET_PIN_WIDGET_CONTROL, pin_ctl);
926 hp_present ? 0 : PIN_OUT);
927 /* detect on spdif is specific to CS421x */
928 if (spec->vendor_nid == CS421X_VENDOR_NID) {
929 snd_hda_codec_write(codec, nid, 0,
930 AC_VERB_SET_PIN_WIDGET_CONTROL,
931 spdif_present ? 0 : PIN_OUT);
932 }
933 } 938 }
934 if (spec->gpio_eapd_hp) { 939 if (spec->gpio_eapd_hp) {
935 unsigned int gpio = hp_present ? 940 unsigned int gpio = hp_present ?
@@ -938,8 +943,8 @@ static void cs_automute(struct hda_codec *codec)
938 AC_VERB_SET_GPIO_DATA, gpio); 943 AC_VERB_SET_GPIO_DATA, gpio);
939 } 944 }
940 945
941 /* specific to CS421x */ 946 /* specific to CS4210 */
942 if (spec->vendor_nid == CS421X_VENDOR_NID) { 947 if (spec->vendor_nid == CS4210_VENDOR_NID) {
943 /* mute HPs if spdif jack (SENSE_B) is present */ 948 /* mute HPs if spdif jack (SENSE_B) is present */
944 for (i = 0; i < cfg->hp_outs; i++) { 949 for (i = 0; i < cfg->hp_outs; i++) {
945 nid = cfg->hp_pins[i]; 950 nid = cfg->hp_pins[i];
@@ -976,7 +981,12 @@ static void cs_automic(struct hda_codec *codec)
976 present = snd_hda_jack_detect(codec, nid); 981 present = snd_hda_jack_detect(codec, nid);
977 982
978 /* specific to CS421x, single ADC */ 983 /* specific to CS421x, single ADC */
979 if (spec->vendor_nid == CS421X_VENDOR_NID) { 984 if (spec->vendor_nid == CS420X_VENDOR_NID) {
985 if (present)
986 change_cur_input(codec, spec->automic_idx, 0);
987 else
988 change_cur_input(codec, !spec->automic_idx, 0);
989 } else {
980 if (present) { 990 if (present) {
981 spec->last_input = spec->cur_input; 991 spec->last_input = spec->cur_input;
982 spec->cur_input = spec->automic_idx; 992 spec->cur_input = spec->automic_idx;
@@ -984,11 +994,6 @@ static void cs_automic(struct hda_codec *codec)
984 spec->cur_input = spec->last_input; 994 spec->cur_input = spec->last_input;
985 } 995 }
986 cs_update_input_select(codec); 996 cs_update_input_select(codec);
987 } else {
988 if (present)
989 change_cur_input(codec, spec->automic_idx, 0);
990 else
991 change_cur_input(codec, !spec->automic_idx, 0);
992 } 997 }
993} 998}
994 999
@@ -1027,9 +1032,7 @@ static void init_output(struct hda_codec *codec)
1027 if (!cfg->speaker_outs) 1032 if (!cfg->speaker_outs)
1028 continue; 1033 continue;
1029 if (get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP) { 1034 if (get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP) {
1030 snd_hda_codec_write(codec, nid, 0, 1035 snd_hda_jack_detect_enable(codec, nid, HP_EVENT);
1031 AC_VERB_SET_UNSOLICITED_ENABLE,
1032 AC_USRSP_EN | HP_EVENT);
1033 spec->hp_detect = 1; 1036 spec->hp_detect = 1;
1034 } 1037 }
1035 } 1038 }
@@ -1070,19 +1073,10 @@ static void init_input(struct hda_codec *codec)
1070 AC_VERB_SET_AMP_GAIN_MUTE, 1073 AC_VERB_SET_AMP_GAIN_MUTE,
1071 AMP_IN_MUTE(spec->adc_idx[i])); 1074 AMP_IN_MUTE(spec->adc_idx[i]));
1072 if (spec->mic_detect && spec->automic_idx == i) 1075 if (spec->mic_detect && spec->automic_idx == i)
1073 snd_hda_codec_write(codec, pin, 0, 1076 snd_hda_jack_detect_enable(codec, pin, MIC_EVENT);
1074 AC_VERB_SET_UNSOLICITED_ENABLE,
1075 AC_USRSP_EN | MIC_EVENT);
1076 } 1077 }
1077 /* specific to CS421x */ 1078 /* CS420x has multiple ADC, CS421x has single ADC */
1078 if (spec->vendor_nid == CS421X_VENDOR_NID) { 1079 if (spec->vendor_nid == CS420X_VENDOR_NID) {
1079 if (spec->mic_detect)
1080 cs_automic(codec);
1081 else {
1082 spec->cur_adc = spec->adc_nid[spec->cur_input];
1083 cs_update_input_select(codec);
1084 }
1085 } else {
1086 change_cur_input(codec, spec->cur_input, 1); 1080 change_cur_input(codec, spec->cur_input, 1);
1087 if (spec->mic_detect) 1081 if (spec->mic_detect)
1088 cs_automic(codec); 1082 cs_automic(codec);
@@ -1096,6 +1090,13 @@ static void init_input(struct hda_codec *codec)
1096 * selected in IDX_SPDIF_CTL. 1090 * selected in IDX_SPDIF_CTL.
1097 */ 1091 */
1098 cs_vendor_coef_set(codec, IDX_ADC_CFG, coef); 1092 cs_vendor_coef_set(codec, IDX_ADC_CFG, coef);
1093 } else {
1094 if (spec->mic_detect)
1095 cs_automic(codec);
1096 else {
1097 spec->cur_adc = spec->adc_nid[spec->cur_input];
1098 cs_update_input_select(codec);
1099 }
1099 } 1100 }
1100} 1101}
1101 1102
@@ -1200,11 +1201,14 @@ static int cs_init(struct hda_codec *codec)
1200 init_output(codec); 1201 init_output(codec);
1201 init_input(codec); 1202 init_input(codec);
1202 init_digital(codec); 1203 init_digital(codec);
1204 snd_hda_jack_report_sync(codec);
1205
1203 return 0; 1206 return 0;
1204} 1207}
1205 1208
1206static int cs_build_controls(struct hda_codec *codec) 1209static int cs_build_controls(struct hda_codec *codec)
1207{ 1210{
1211 struct cs_spec *spec = codec->spec;
1208 int err; 1212 int err;
1209 1213
1210 err = build_output(codec); 1214 err = build_output(codec);
@@ -1219,7 +1223,15 @@ static int cs_build_controls(struct hda_codec *codec)
1219 err = build_digital_input(codec); 1223 err = build_digital_input(codec);
1220 if (err < 0) 1224 if (err < 0)
1221 return err; 1225 return err;
1222 return cs_init(codec); 1226 err = cs_init(codec);
1227 if (err < 0)
1228 return err;
1229
1230 err = snd_hda_jack_add_kctls(codec, &spec->autocfg);
1231 if (err < 0)
1232 return err;
1233
1234 return 0;
1223} 1235}
1224 1236
1225static void cs_free(struct hda_codec *codec) 1237static void cs_free(struct hda_codec *codec)
@@ -1232,7 +1244,7 @@ static void cs_free(struct hda_codec *codec)
1232 1244
1233static void cs_unsol_event(struct hda_codec *codec, unsigned int res) 1245static void cs_unsol_event(struct hda_codec *codec, unsigned int res)
1234{ 1246{
1235 switch ((res >> 26) & 0x7f) { 1247 switch (snd_hda_jack_get_action(codec, res >> 26)) {
1236 case HP_EVENT: 1248 case HP_EVENT:
1237 cs_automute(codec); 1249 cs_automute(codec);
1238 break; 1250 break;
@@ -1240,6 +1252,7 @@ static void cs_unsol_event(struct hda_codec *codec, unsigned int res)
1240 cs_automic(codec); 1252 cs_automic(codec);
1241 break; 1253 break;
1242 } 1254 }
1255 snd_hda_jack_report_sync(codec);
1243} 1256}
1244 1257
1245static const struct hda_codec_ops cs_patch_ops = { 1258static const struct hda_codec_ops cs_patch_ops = {
@@ -1278,6 +1291,7 @@ static const char * const cs420x_models[CS420X_MODELS] = {
1278 [CS420X_MBP53] = "mbp53", 1291 [CS420X_MBP53] = "mbp53",
1279 [CS420X_MBP55] = "mbp55", 1292 [CS420X_MBP55] = "mbp55",
1280 [CS420X_IMAC27] = "imac27", 1293 [CS420X_IMAC27] = "imac27",
1294 [CS420X_IMAC27_122] = "imac27_122",
1281 [CS420X_APPLE] = "apple", 1295 [CS420X_APPLE] = "apple",
1282 [CS420X_AUTO] = "auto", 1296 [CS420X_AUTO] = "auto",
1283}; 1297};
@@ -1294,6 +1308,7 @@ static const struct snd_pci_quirk cs420x_cfg_tbl[] = {
1294}; 1308};
1295 1309
1296static const struct snd_pci_quirk cs420x_codec_cfg_tbl[] = { 1310static const struct snd_pci_quirk cs420x_codec_cfg_tbl[] = {
1311 SND_PCI_QUIRK(0x106b, 0x2000, "iMac 12,2", CS420X_IMAC27_122),
1297 SND_PCI_QUIRK_VENDOR(0x106b, "Apple", CS420X_APPLE), 1312 SND_PCI_QUIRK_VENDOR(0x106b, "Apple", CS420X_APPLE),
1298 {} /* terminator */ 1313 {} /* terminator */
1299}; 1314};
@@ -1393,6 +1408,12 @@ static int patch_cs420x(struct hda_codec *codec)
1393 spec->gpio_mask = spec->gpio_dir = 1408 spec->gpio_mask = spec->gpio_dir =
1394 spec->gpio_eapd_hp | spec->gpio_eapd_speaker; 1409 spec->gpio_eapd_hp | spec->gpio_eapd_speaker;
1395 break; 1410 break;
1411 case CS420X_IMAC27_122:
1412 spec->gpio_eapd_hp = 4; /* GPIO2 = headphones */
1413 spec->gpio_eapd_speaker = 8; /* GPIO3 = speakers */
1414 spec->gpio_mask = spec->gpio_dir =
1415 spec->gpio_eapd_hp | spec->gpio_eapd_speaker;
1416 break;
1396 } 1417 }
1397 1418
1398 err = cs_parse_auto_config(codec); 1419 err = cs_parse_auto_config(codec);
@@ -1557,7 +1578,7 @@ static const struct snd_kcontrol_new cs421x_speaker_bost_ctl = {
1557 .tlv = { .p = cs421x_speaker_boost_db_scale }, 1578 .tlv = { .p = cs421x_speaker_boost_db_scale },
1558}; 1579};
1559 1580
1560static void cs421x_pinmux_init(struct hda_codec *codec) 1581static void cs4210_pinmux_init(struct hda_codec *codec)
1561{ 1582{
1562 struct cs_spec *spec = codec->spec; 1583 struct cs_spec *spec = codec->spec;
1563 unsigned int def_conf, coef; 1584 unsigned int def_conf, coef;
@@ -1602,10 +1623,7 @@ static void init_cs421x_digital(struct hda_codec *codec)
1602 if (!cfg->speaker_outs) 1623 if (!cfg->speaker_outs)
1603 continue; 1624 continue;
1604 if (get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP) { 1625 if (get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP) {
1605 1626 snd_hda_jack_detect_enable(codec, nid, SPDIF_EVENT);
1606 snd_hda_codec_write(codec, nid, 0,
1607 AC_VERB_SET_UNSOLICITED_ENABLE,
1608 AC_USRSP_EN | SPDIF_EVENT);
1609 spec->spdif_detect = 1; 1627 spec->spdif_detect = 1;
1610 } 1628 }
1611 } 1629 }
@@ -1615,10 +1633,11 @@ static int cs421x_init(struct hda_codec *codec)
1615{ 1633{
1616 struct cs_spec *spec = codec->spec; 1634 struct cs_spec *spec = codec->spec;
1617 1635
1618 snd_hda_sequence_write(codec, cs421x_coef_init_verbs); 1636 if (spec->vendor_nid == CS4210_VENDOR_NID) {
1619 snd_hda_sequence_write(codec, cs421x_coef_init_verbs_A1_silicon_fixes); 1637 snd_hda_sequence_write(codec, cs421x_coef_init_verbs);
1620 1638 snd_hda_sequence_write(codec, cs421x_coef_init_verbs_A1_silicon_fixes);
1621 cs421x_pinmux_init(codec); 1639 cs4210_pinmux_init(codec);
1640 }
1622 1641
1623 if (spec->gpio_mask) { 1642 if (spec->gpio_mask) {
1624 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_MASK, 1643 snd_hda_codec_write(codec, 0x01, 0, AC_VERB_SET_GPIO_MASK,
@@ -1632,6 +1651,7 @@ static int cs421x_init(struct hda_codec *codec)
1632 init_output(codec); 1651 init_output(codec);
1633 init_input(codec); 1652 init_input(codec);
1634 init_cs421x_digital(codec); 1653 init_cs421x_digital(codec);
1654 snd_hda_jack_report_sync(codec);
1635 1655
1636 return 0; 1656 return 0;
1637} 1657}
@@ -1771,32 +1791,21 @@ static int build_cs421x_output(struct hda_codec *codec)
1771 struct auto_pin_cfg *cfg = &spec->autocfg; 1791 struct auto_pin_cfg *cfg = &spec->autocfg;
1772 struct snd_kcontrol *kctl; 1792 struct snd_kcontrol *kctl;
1773 int err; 1793 int err;
1774 char *name = "HP/Speakers"; 1794 char *name = "Master";
1775 1795
1776 fix_volume_caps(codec, dac); 1796 fix_volume_caps(codec, dac);
1777 if (!spec->vmaster_sw) {
1778 err = add_vmaster(codec, dac);
1779 if (err < 0)
1780 return err;
1781 }
1782 1797
1783 err = add_mute(codec, name, 0, 1798 err = add_mute(codec, name, 0,
1784 HDA_COMPOSE_AMP_VAL(dac, 3, 0, HDA_OUTPUT), 0, &kctl); 1799 HDA_COMPOSE_AMP_VAL(dac, 3, 0, HDA_OUTPUT), 0, &kctl);
1785 if (err < 0) 1800 if (err < 0)
1786 return err; 1801 return err;
1787 err = snd_ctl_add_slave(spec->vmaster_sw, kctl);
1788 if (err < 0)
1789 return err;
1790 1802
1791 err = add_volume(codec, name, 0, 1803 err = add_volume(codec, name, 0,
1792 HDA_COMPOSE_AMP_VAL(dac, 3, 0, HDA_OUTPUT), 0, &kctl); 1804 HDA_COMPOSE_AMP_VAL(dac, 3, 0, HDA_OUTPUT), 0, &kctl);
1793 if (err < 0) 1805 if (err < 0)
1794 return err; 1806 return err;
1795 err = snd_ctl_add_slave(spec->vmaster_vol, kctl);
1796 if (err < 0)
1797 return err;
1798 1807
1799 if (cfg->speaker_outs) { 1808 if (cfg->speaker_outs && (spec->vendor_nid == CS4210_VENDOR_NID)) {
1800 err = snd_hda_ctl_add(codec, 0, 1809 err = snd_hda_ctl_add(codec, 0,
1801 snd_ctl_new1(&cs421x_speaker_bost_ctl, codec)); 1810 snd_ctl_new1(&cs421x_speaker_bost_ctl, codec));
1802 if (err < 0) 1811 if (err < 0)
@@ -1807,6 +1816,7 @@ static int build_cs421x_output(struct hda_codec *codec)
1807 1816
1808static int cs421x_build_controls(struct hda_codec *codec) 1817static int cs421x_build_controls(struct hda_codec *codec)
1809{ 1818{
1819 struct cs_spec *spec = codec->spec;
1810 int err; 1820 int err;
1811 1821
1812 err = build_cs421x_output(codec); 1822 err = build_cs421x_output(codec);
@@ -1818,12 +1828,20 @@ static int cs421x_build_controls(struct hda_codec *codec)
1818 err = build_digital_output(codec); 1828 err = build_digital_output(codec);
1819 if (err < 0) 1829 if (err < 0)
1820 return err; 1830 return err;
1821 return cs421x_init(codec); 1831 err = cs421x_init(codec);
1832 if (err < 0)
1833 return err;
1834
1835 err = snd_hda_jack_add_kctls(codec, &spec->autocfg);
1836 if (err < 0)
1837 return err;
1838
1839 return 0;
1822} 1840}
1823 1841
1824static void cs421x_unsol_event(struct hda_codec *codec, unsigned int res) 1842static void cs421x_unsol_event(struct hda_codec *codec, unsigned int res)
1825{ 1843{
1826 switch ((res >> 26) & 0x3f) { 1844 switch (snd_hda_jack_get_action(codec, res >> 26)) {
1827 case HP_EVENT: 1845 case HP_EVENT:
1828 case SPDIF_EVENT: 1846 case SPDIF_EVENT:
1829 cs_automute(codec); 1847 cs_automute(codec);
@@ -1833,6 +1851,7 @@ static void cs421x_unsol_event(struct hda_codec *codec, unsigned int res)
1833 cs_automic(codec); 1851 cs_automic(codec);
1834 break; 1852 break;
1835 } 1853 }
1854 snd_hda_jack_report_sync(codec);
1836} 1855}
1837 1856
1838static int parse_cs421x_input(struct hda_codec *codec) 1857static int parse_cs421x_input(struct hda_codec *codec)
@@ -1883,6 +1902,7 @@ static int cs421x_parse_auto_config(struct hda_codec *codec)
1883*/ 1902*/
1884static int cs421x_suspend(struct hda_codec *codec, pm_message_t state) 1903static int cs421x_suspend(struct hda_codec *codec, pm_message_t state)
1885{ 1904{
1905 struct cs_spec *spec = codec->spec;
1886 unsigned int coef; 1906 unsigned int coef;
1887 1907
1888 snd_hda_shutup_pins(codec); 1908 snd_hda_shutup_pins(codec);
@@ -1892,15 +1912,17 @@ static int cs421x_suspend(struct hda_codec *codec, pm_message_t state)
1892 snd_hda_codec_write(codec, CS4210_ADC_NID, 0, 1912 snd_hda_codec_write(codec, CS4210_ADC_NID, 0,
1893 AC_VERB_SET_POWER_STATE, AC_PWRST_D3); 1913 AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
1894 1914
1895 coef = cs_vendor_coef_get(codec, CS421X_IDX_DEV_CFG); 1915 if (spec->vendor_nid == CS4210_VENDOR_NID) {
1896 coef |= 0x0004; /* PDREF */ 1916 coef = cs_vendor_coef_get(codec, CS421X_IDX_DEV_CFG);
1897 cs_vendor_coef_set(codec, CS421X_IDX_DEV_CFG, coef); 1917 coef |= 0x0004; /* PDREF */
1918 cs_vendor_coef_set(codec, CS421X_IDX_DEV_CFG, coef);
1919 }
1898 1920
1899 return 0; 1921 return 0;
1900} 1922}
1901#endif 1923#endif
1902 1924
1903static struct hda_codec_ops cs4210_patch_ops = { 1925static struct hda_codec_ops cs421x_patch_ops = {
1904 .build_controls = cs421x_build_controls, 1926 .build_controls = cs421x_build_controls,
1905 .build_pcms = cs_build_pcms, 1927 .build_pcms = cs_build_pcms,
1906 .init = cs421x_init, 1928 .init = cs421x_init,
@@ -1911,7 +1933,7 @@ static struct hda_codec_ops cs4210_patch_ops = {
1911#endif 1933#endif
1912}; 1934};
1913 1935
1914static int patch_cs421x(struct hda_codec *codec) 1936static int patch_cs4210(struct hda_codec *codec)
1915{ 1937{
1916 struct cs_spec *spec; 1938 struct cs_spec *spec;
1917 int err; 1939 int err;
@@ -1921,7 +1943,7 @@ static int patch_cs421x(struct hda_codec *codec)
1921 return -ENOMEM; 1943 return -ENOMEM;
1922 codec->spec = spec; 1944 codec->spec = spec;
1923 1945
1924 spec->vendor_nid = CS421X_VENDOR_NID; 1946 spec->vendor_nid = CS4210_VENDOR_NID;
1925 1947
1926 spec->board_config = 1948 spec->board_config =
1927 snd_hda_check_board_config(codec, CS421X_MODELS, 1949 snd_hda_check_board_config(codec, CS421X_MODELS,
@@ -1949,14 +1971,39 @@ static int patch_cs421x(struct hda_codec *codec)
1949 is auto-parsed. If GPIO or SENSE_B is forced, DMIC input 1971 is auto-parsed. If GPIO or SENSE_B is forced, DMIC input
1950 is disabled. 1972 is disabled.
1951 */ 1973 */
1952 cs421x_pinmux_init(codec); 1974 cs4210_pinmux_init(codec);
1953 1975
1954 err = cs421x_parse_auto_config(codec); 1976 err = cs421x_parse_auto_config(codec);
1955 if (err < 0) 1977 if (err < 0)
1956 goto error; 1978 goto error;
1957 1979
1958 codec->patch_ops = cs4210_patch_ops; 1980 codec->patch_ops = cs421x_patch_ops;
1981
1982 return 0;
1983
1984 error:
1985 kfree(codec->spec);
1986 codec->spec = NULL;
1987 return err;
1988}
1989
1990static int patch_cs4213(struct hda_codec *codec)
1991{
1992 struct cs_spec *spec;
1993 int err;
1994
1995 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
1996 if (!spec)
1997 return -ENOMEM;
1998 codec->spec = spec;
1999
2000 spec->vendor_nid = CS4213_VENDOR_NID;
2001
2002 err = cs421x_parse_auto_config(codec);
2003 if (err < 0)
2004 goto error;
1959 2005
2006 codec->patch_ops = cs421x_patch_ops;
1960 return 0; 2007 return 0;
1961 2008
1962 error: 2009 error:
@@ -1972,13 +2019,15 @@ static int patch_cs421x(struct hda_codec *codec)
1972static const struct hda_codec_preset snd_hda_preset_cirrus[] = { 2019static const struct hda_codec_preset snd_hda_preset_cirrus[] = {
1973 { .id = 0x10134206, .name = "CS4206", .patch = patch_cs420x }, 2020 { .id = 0x10134206, .name = "CS4206", .patch = patch_cs420x },
1974 { .id = 0x10134207, .name = "CS4207", .patch = patch_cs420x }, 2021 { .id = 0x10134207, .name = "CS4207", .patch = patch_cs420x },
1975 { .id = 0x10134210, .name = "CS4210", .patch = patch_cs421x }, 2022 { .id = 0x10134210, .name = "CS4210", .patch = patch_cs4210 },
2023 { .id = 0x10134213, .name = "CS4213", .patch = patch_cs4213 },
1976 {} /* terminator */ 2024 {} /* terminator */
1977}; 2025};
1978 2026
1979MODULE_ALIAS("snd-hda-codec-id:10134206"); 2027MODULE_ALIAS("snd-hda-codec-id:10134206");
1980MODULE_ALIAS("snd-hda-codec-id:10134207"); 2028MODULE_ALIAS("snd-hda-codec-id:10134207");
1981MODULE_ALIAS("snd-hda-codec-id:10134210"); 2029MODULE_ALIAS("snd-hda-codec-id:10134210");
2030MODULE_ALIAS("snd-hda-codec-id:10134213");
1982 2031
1983MODULE_LICENSE("GPL"); 2032MODULE_LICENSE("GPL");
1984MODULE_DESCRIPTION("Cirrus Logic HD-audio codec"); 2033MODULE_DESCRIPTION("Cirrus Logic HD-audio codec");
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index 0de21193a2b..8a32a69c83c 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -31,6 +31,7 @@
31#include "hda_codec.h" 31#include "hda_codec.h"
32#include "hda_local.h" 32#include "hda_local.h"
33#include "hda_beep.h" 33#include "hda_beep.h"
34#include "hda_jack.h"
34 35
35#define CXT_PIN_DIR_IN 0x00 36#define CXT_PIN_DIR_IN 0x00
36#define CXT_PIN_DIR_OUT 0x01 37#define CXT_PIN_DIR_OUT 0x01
@@ -415,40 +416,6 @@ static int conexant_mux_enum_put(struct snd_kcontrol *kcontrol,
415 &spec->cur_mux[adc_idx]); 416 &spec->cur_mux[adc_idx]);
416} 417}
417 418
418static int conexant_init_jacks(struct hda_codec *codec)
419{
420#ifdef CONFIG_SND_HDA_INPUT_JACK
421 struct conexant_spec *spec = codec->spec;
422 int i;
423
424 for (i = 0; i < spec->num_init_verbs; i++) {
425 const struct hda_verb *hv;
426
427 hv = spec->init_verbs[i];
428 while (hv->nid) {
429 int err = 0;
430 switch (hv->param ^ AC_USRSP_EN) {
431 case CONEXANT_HP_EVENT:
432 err = snd_hda_input_jack_add(codec, hv->nid,
433 SND_JACK_HEADPHONE, NULL);
434 snd_hda_input_jack_report(codec, hv->nid);
435 break;
436 case CXT5051_PORTC_EVENT:
437 case CONEXANT_MIC_EVENT:
438 err = snd_hda_input_jack_add(codec, hv->nid,
439 SND_JACK_MICROPHONE, NULL);
440 snd_hda_input_jack_report(codec, hv->nid);
441 break;
442 }
443 if (err < 0)
444 return err;
445 ++hv;
446 }
447 }
448#endif /* CONFIG_SND_HDA_INPUT_JACK */
449 return 0;
450}
451
452static void conexant_set_power(struct hda_codec *codec, hda_nid_t fg, 419static void conexant_set_power(struct hda_codec *codec, hda_nid_t fg,
453 unsigned int power_state) 420 unsigned int power_state)
454{ 421{
@@ -474,7 +441,6 @@ static int conexant_init(struct hda_codec *codec)
474 441
475static void conexant_free(struct hda_codec *codec) 442static void conexant_free(struct hda_codec *codec)
476{ 443{
477 snd_hda_input_jack_free(codec);
478 snd_hda_detach_beep_device(codec); 444 snd_hda_detach_beep_device(codec);
479 kfree(codec->spec); 445 kfree(codec->spec);
480} 446}
@@ -1120,8 +1086,6 @@ static const char * const cxt5045_models[CXT5045_MODELS] = {
1120 1086
1121static const struct snd_pci_quirk cxt5045_cfg_tbl[] = { 1087static const struct snd_pci_quirk cxt5045_cfg_tbl[] = {
1122 SND_PCI_QUIRK(0x103c, 0x30d5, "HP 530", CXT5045_LAPTOP_HP530), 1088 SND_PCI_QUIRK(0x103c, 0x30d5, "HP 530", CXT5045_LAPTOP_HP530),
1123 SND_PCI_QUIRK_MASK(0x103c, 0xff00, 0x3000, "HP DV Series",
1124 CXT5045_LAPTOP_HPSENSE),
1125 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba P105", CXT5045_LAPTOP_MICSENSE), 1089 SND_PCI_QUIRK(0x1179, 0xff31, "Toshiba P105", CXT5045_LAPTOP_MICSENSE),
1126 SND_PCI_QUIRK(0x152d, 0x0753, "Benq R55E", CXT5045_BENQ), 1090 SND_PCI_QUIRK(0x152d, 0x0753, "Benq R55E", CXT5045_BENQ),
1127 SND_PCI_QUIRK(0x1734, 0x10ad, "Fujitsu Si1520", CXT5045_LAPTOP_MICSENSE), 1091 SND_PCI_QUIRK(0x1734, 0x10ad, "Fujitsu Si1520", CXT5045_LAPTOP_MICSENSE),
@@ -1750,7 +1714,6 @@ static void cxt5051_hp_automute(struct hda_codec *codec)
1750static void cxt5051_hp_unsol_event(struct hda_codec *codec, 1714static void cxt5051_hp_unsol_event(struct hda_codec *codec,
1751 unsigned int res) 1715 unsigned int res)
1752{ 1716{
1753 int nid = (res & AC_UNSOL_RES_SUBTAG) >> 20;
1754 switch (res >> 26) { 1717 switch (res >> 26) {
1755 case CONEXANT_HP_EVENT: 1718 case CONEXANT_HP_EVENT:
1756 cxt5051_hp_automute(codec); 1719 cxt5051_hp_automute(codec);
@@ -1762,7 +1725,6 @@ static void cxt5051_hp_unsol_event(struct hda_codec *codec,
1762 cxt5051_portc_automic(codec); 1725 cxt5051_portc_automic(codec);
1763 break; 1726 break;
1764 } 1727 }
1765 snd_hda_input_jack_report(codec, nid);
1766} 1728}
1767 1729
1768static const struct snd_kcontrol_new cxt5051_playback_mixers[] = { 1730static const struct snd_kcontrol_new cxt5051_playback_mixers[] = {
@@ -1901,8 +1863,6 @@ static void cxt5051_init_mic_port(struct hda_codec *codec, hda_nid_t nid,
1901 snd_hda_codec_write(codec, nid, 0, 1863 snd_hda_codec_write(codec, nid, 0,
1902 AC_VERB_SET_UNSOLICITED_ENABLE, 1864 AC_VERB_SET_UNSOLICITED_ENABLE,
1903 AC_USRSP_EN | event); 1865 AC_USRSP_EN | event);
1904 snd_hda_input_jack_add(codec, nid, SND_JACK_MICROPHONE, NULL);
1905 snd_hda_input_jack_report(codec, nid);
1906} 1866}
1907 1867
1908static const struct hda_verb cxt5051_ideapad_init_verbs[] = { 1868static const struct hda_verb cxt5051_ideapad_init_verbs[] = {
@@ -1918,7 +1878,6 @@ static int cxt5051_init(struct hda_codec *codec)
1918 struct conexant_spec *spec = codec->spec; 1878 struct conexant_spec *spec = codec->spec;
1919 1879
1920 conexant_init(codec); 1880 conexant_init(codec);
1921 conexant_init_jacks(codec);
1922 1881
1923 if (spec->auto_mic & AUTO_MIC_PORTB) 1882 if (spec->auto_mic & AUTO_MIC_PORTB)
1924 cxt5051_init_mic_port(codec, 0x17, CXT5051_PORTB_EVENT); 1883 cxt5051_init_mic_port(codec, 0x17, CXT5051_PORTB_EVENT);
@@ -3450,7 +3409,6 @@ static int detect_jacks(struct hda_codec *codec, int num_pins, hda_nid_t *pins)
3450 hda_nid_t nid = pins[i]; 3409 hda_nid_t nid = pins[i];
3451 if (!nid || !is_jack_detectable(codec, nid)) 3410 if (!nid || !is_jack_detectable(codec, nid))
3452 break; 3411 break;
3453 snd_hda_input_jack_report(codec, nid);
3454 present |= snd_hda_jack_detect(codec, nid); 3412 present |= snd_hda_jack_detect(codec, nid);
3455 } 3413 }
3456 return present; 3414 return present;
@@ -3755,8 +3713,7 @@ static void cx_auto_automic(struct hda_codec *codec)
3755 3713
3756static void cx_auto_unsol_event(struct hda_codec *codec, unsigned int res) 3714static void cx_auto_unsol_event(struct hda_codec *codec, unsigned int res)
3757{ 3715{
3758 int nid = (res & AC_UNSOL_RES_SUBTAG) >> 20; 3716 switch (snd_hda_jack_get_action(codec, res >> 26)) {
3759 switch (res >> 26) {
3760 case CONEXANT_HP_EVENT: 3717 case CONEXANT_HP_EVENT:
3761 cx_auto_hp_automute(codec); 3718 cx_auto_hp_automute(codec);
3762 break; 3719 break;
@@ -3765,9 +3722,9 @@ static void cx_auto_unsol_event(struct hda_codec *codec, unsigned int res)
3765 break; 3722 break;
3766 case CONEXANT_MIC_EVENT: 3723 case CONEXANT_MIC_EVENT:
3767 cx_auto_automic(codec); 3724 cx_auto_automic(codec);
3768 snd_hda_input_jack_report(codec, nid);
3769 break; 3725 break;
3770 } 3726 }
3727 snd_hda_jack_report_sync(codec);
3771} 3728}
3772 3729
3773/* check whether the pin config is suitable for auto-mic switching; 3730/* check whether the pin config is suitable for auto-mic switching;
@@ -3979,13 +3936,11 @@ static void mute_outputs(struct hda_codec *codec, int num_nids,
3979} 3936}
3980 3937
3981static void enable_unsol_pins(struct hda_codec *codec, int num_pins, 3938static void enable_unsol_pins(struct hda_codec *codec, int num_pins,
3982 hda_nid_t *pins, unsigned int tag) 3939 hda_nid_t *pins, unsigned int action)
3983{ 3940{
3984 int i; 3941 int i;
3985 for (i = 0; i < num_pins; i++) 3942 for (i = 0; i < num_pins; i++)
3986 snd_hda_codec_write(codec, pins[i], 0, 3943 snd_hda_jack_detect_enable(codec, pins[i], action);
3987 AC_VERB_SET_UNSOLICITED_ENABLE,
3988 AC_USRSP_EN | tag);
3989} 3944}
3990 3945
3991static void cx_auto_init_output(struct hda_codec *codec) 3946static void cx_auto_init_output(struct hda_codec *codec)
@@ -4060,16 +4015,14 @@ static void cx_auto_init_input(struct hda_codec *codec)
4060 4015
4061 if (spec->auto_mic) { 4016 if (spec->auto_mic) {
4062 if (spec->auto_mic_ext >= 0) { 4017 if (spec->auto_mic_ext >= 0) {
4063 snd_hda_codec_write(codec, 4018 snd_hda_jack_detect_enable(codec,
4064 cfg->inputs[spec->auto_mic_ext].pin, 0, 4019 cfg->inputs[spec->auto_mic_ext].pin,
4065 AC_VERB_SET_UNSOLICITED_ENABLE, 4020 CONEXANT_MIC_EVENT);
4066 AC_USRSP_EN | CONEXANT_MIC_EVENT);
4067 } 4021 }
4068 if (spec->auto_mic_dock >= 0) { 4022 if (spec->auto_mic_dock >= 0) {
4069 snd_hda_codec_write(codec, 4023 snd_hda_jack_detect_enable(codec,
4070 cfg->inputs[spec->auto_mic_dock].pin, 0, 4024 cfg->inputs[spec->auto_mic_dock].pin,
4071 AC_VERB_SET_UNSOLICITED_ENABLE, 4025 CONEXANT_MIC_EVENT);
4072 AC_USRSP_EN | CONEXANT_MIC_EVENT);
4073 } 4026 }
4074 cx_auto_automic(codec); 4027 cx_auto_automic(codec);
4075 } else { 4028 } else {
@@ -4097,6 +4050,7 @@ static int cx_auto_init(struct hda_codec *codec)
4097 cx_auto_init_output(codec); 4050 cx_auto_init_output(codec);
4098 cx_auto_init_input(codec); 4051 cx_auto_init_input(codec);
4099 cx_auto_init_digital(codec); 4052 cx_auto_init_digital(codec);
4053 snd_hda_jack_report_sync(codec);
4100 return 0; 4054 return 0;
4101} 4055}
4102 4056
@@ -4326,6 +4280,7 @@ static int cx_auto_build_input_controls(struct hda_codec *codec)
4326 4280
4327static int cx_auto_build_controls(struct hda_codec *codec) 4281static int cx_auto_build_controls(struct hda_codec *codec)
4328{ 4282{
4283 struct conexant_spec *spec = codec->spec;
4329 int err; 4284 int err;
4330 4285
4331 err = cx_auto_build_output_controls(codec); 4286 err = cx_auto_build_output_controls(codec);
@@ -4334,7 +4289,13 @@ static int cx_auto_build_controls(struct hda_codec *codec)
4334 err = cx_auto_build_input_controls(codec); 4289 err = cx_auto_build_input_controls(codec);
4335 if (err < 0) 4290 if (err < 0)
4336 return err; 4291 return err;
4337 return conexant_build_controls(codec); 4292 err = conexant_build_controls(codec);
4293 if (err < 0)
4294 return err;
4295 err = snd_hda_jack_add_kctls(codec, &spec->autocfg);
4296 if (err < 0)
4297 return err;
4298 return 0;
4338} 4299}
4339 4300
4340static int cx_auto_search_adcs(struct hda_codec *codec) 4301static int cx_auto_search_adcs(struct hda_codec *codec)
diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c
index c505fd5d338..1168ebd3fb5 100644
--- a/sound/pci/hda/patch_hdmi.c
+++ b/sound/pci/hda/patch_hdmi.c
@@ -36,6 +36,7 @@
36#include <sound/jack.h> 36#include <sound/jack.h>
37#include "hda_codec.h" 37#include "hda_codec.h"
38#include "hda_local.h" 38#include "hda_local.h"
39#include "hda_jack.h"
39 40
40static bool static_hdmi_pcm; 41static bool static_hdmi_pcm;
41module_param(static_hdmi_pcm, bool, 0644); 42module_param(static_hdmi_pcm, bool, 0644);
@@ -48,8 +49,8 @@ MODULE_PARM_DESC(static_hdmi_pcm, "Don't restrict PCM parameters per ELD info");
48 * 49 *
49 * The HDA correspondence of pipes/ports are converter/pin nodes. 50 * The HDA correspondence of pipes/ports are converter/pin nodes.
50 */ 51 */
51#define MAX_HDMI_CVTS 4 52#define MAX_HDMI_CVTS 8
52#define MAX_HDMI_PINS 4 53#define MAX_HDMI_PINS 8
53 54
54struct hdmi_spec_per_cvt { 55struct hdmi_spec_per_cvt {
55 hda_nid_t cvt_nid; 56 hda_nid_t cvt_nid;
@@ -754,10 +755,18 @@ static void hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll);
754static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res) 755static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res)
755{ 756{
756 struct hdmi_spec *spec = codec->spec; 757 struct hdmi_spec *spec = codec->spec;
757 int pin_nid = res >> AC_UNSOL_RES_TAG_SHIFT; 758 int tag = res >> AC_UNSOL_RES_TAG_SHIFT;
759 int pin_nid;
758 int pd = !!(res & AC_UNSOL_RES_PD); 760 int pd = !!(res & AC_UNSOL_RES_PD);
759 int eldv = !!(res & AC_UNSOL_RES_ELDV); 761 int eldv = !!(res & AC_UNSOL_RES_ELDV);
760 int pin_idx; 762 int pin_idx;
763 struct hda_jack_tbl *jack;
764
765 jack = snd_hda_jack_tbl_get_from_tag(codec, tag);
766 if (!jack)
767 return;
768 pin_nid = jack->nid;
769 jack->jack_dirty = 1;
761 770
762 printk(KERN_INFO 771 printk(KERN_INFO
763 "HDMI hot plug event: Codec=%d Pin=%d Presence_Detect=%d ELD_Valid=%d\n", 772 "HDMI hot plug event: Codec=%d Pin=%d Presence_Detect=%d ELD_Valid=%d\n",
@@ -768,6 +777,7 @@ static void hdmi_intrinsic_event(struct hda_codec *codec, unsigned int res)
768 return; 777 return;
769 778
770 hdmi_present_sense(&spec->pins[pin_idx], 1); 779 hdmi_present_sense(&spec->pins[pin_idx], 1);
780 snd_hda_jack_report_sync(codec);
771} 781}
772 782
773static void hdmi_non_intrinsic_event(struct hda_codec *codec, unsigned int res) 783static void hdmi_non_intrinsic_event(struct hda_codec *codec, unsigned int res)
@@ -795,11 +805,10 @@ static void hdmi_non_intrinsic_event(struct hda_codec *codec, unsigned int res)
795 805
796static void hdmi_unsol_event(struct hda_codec *codec, unsigned int res) 806static void hdmi_unsol_event(struct hda_codec *codec, unsigned int res)
797{ 807{
798 struct hdmi_spec *spec = codec->spec;
799 int tag = res >> AC_UNSOL_RES_TAG_SHIFT; 808 int tag = res >> AC_UNSOL_RES_TAG_SHIFT;
800 int subtag = (res & AC_UNSOL_RES_SUBTAG) >> AC_UNSOL_RES_SUBTAG_SHIFT; 809 int subtag = (res & AC_UNSOL_RES_SUBTAG) >> AC_UNSOL_RES_SUBTAG_SHIFT;
801 810
802 if (pin_nid_to_pin_index(spec, tag) < 0) { 811 if (!snd_hda_jack_tbl_get_from_tag(codec, tag)) {
803 snd_printd(KERN_INFO "Unexpected HDMI event tag 0x%x\n", tag); 812 snd_printd(KERN_INFO "Unexpected HDMI event tag 0x%x\n", tag);
804 return; 813 return;
805 } 814 }
@@ -996,8 +1005,6 @@ static void hdmi_present_sense(struct hdmi_spec_per_pin *per_pin, int repoll)
996 msecs_to_jiffies(300)); 1005 msecs_to_jiffies(300));
997 } 1006 }
998 } 1007 }
999
1000 snd_hda_input_jack_report(codec, pin_nid);
1001} 1008}
1002 1009
1003static void hdmi_repoll_eld(struct work_struct *work) 1010static void hdmi_repoll_eld(struct work_struct *work)
@@ -1126,12 +1133,12 @@ static int hdmi_parse_codec(struct hda_codec *codec)
1126 1133
1127/* 1134/*
1128 */ 1135 */
1129static char *generic_hdmi_pcm_names[MAX_HDMI_PINS] = { 1136static char *get_hdmi_pcm_name(int idx)
1130 "HDMI 0", 1137{
1131 "HDMI 1", 1138 static char names[MAX_HDMI_PINS][8];
1132 "HDMI 2", 1139 sprintf(&names[idx][0], "HDMI %d", idx);
1133 "HDMI 3", 1140 return &names[idx][0];
1134}; 1141}
1135 1142
1136/* 1143/*
1137 * HDMI callbacks 1144 * HDMI callbacks
@@ -1209,7 +1216,7 @@ static int generic_hdmi_build_pcms(struct hda_codec *codec)
1209 struct hda_pcm_stream *pstr; 1216 struct hda_pcm_stream *pstr;
1210 1217
1211 info = &spec->pcm_rec[pin_idx]; 1218 info = &spec->pcm_rec[pin_idx];
1212 info->name = generic_hdmi_pcm_names[pin_idx]; 1219 info->name = get_hdmi_pcm_name(pin_idx);
1213 info->pcm_type = HDA_PCM_TYPE_HDMI; 1220 info->pcm_type = HDA_PCM_TYPE_HDMI;
1214 1221
1215 pstr = &info->stream[SNDRV_PCM_STREAM_PLAYBACK]; 1222 pstr = &info->stream[SNDRV_PCM_STREAM_PLAYBACK];
@@ -1226,21 +1233,15 @@ static int generic_hdmi_build_pcms(struct hda_codec *codec)
1226 1233
1227static int generic_hdmi_build_jack(struct hda_codec *codec, int pin_idx) 1234static int generic_hdmi_build_jack(struct hda_codec *codec, int pin_idx)
1228{ 1235{
1229 int err; 1236 char hdmi_str[32] = "HDMI/DP";
1230 char hdmi_str[32];
1231 struct hdmi_spec *spec = codec->spec; 1237 struct hdmi_spec *spec = codec->spec;
1232 struct hdmi_spec_per_pin *per_pin = &spec->pins[pin_idx]; 1238 struct hdmi_spec_per_pin *per_pin = &spec->pins[pin_idx];
1233 int pcmdev = spec->pcm_rec[pin_idx].device; 1239 int pcmdev = spec->pcm_rec[pin_idx].device;
1234 1240
1235 snprintf(hdmi_str, sizeof(hdmi_str), "HDMI/DP,pcm=%d", pcmdev); 1241 if (pcmdev > 0)
1236 1242 sprintf(hdmi_str + strlen(hdmi_str), ",pcm=%d", pcmdev);
1237 err = snd_hda_input_jack_add(codec, per_pin->pin_nid,
1238 SND_JACK_VIDEOOUT, pcmdev > 0 ? hdmi_str : NULL);
1239 if (err < 0)
1240 return err;
1241 1243
1242 hdmi_present_sense(per_pin, 0); 1244 return snd_hda_jack_add_kctl(codec, per_pin->pin_nid, hdmi_str, 0);
1243 return 0;
1244} 1245}
1245 1246
1246static int generic_hdmi_build_controls(struct hda_codec *codec) 1247static int generic_hdmi_build_controls(struct hda_codec *codec)
@@ -1270,6 +1271,8 @@ static int generic_hdmi_build_controls(struct hda_codec *codec)
1270 1271
1271 if (err < 0) 1272 if (err < 0)
1272 return err; 1273 return err;
1274
1275 hdmi_present_sense(per_pin, 0);
1273 } 1276 }
1274 1277
1275 return 0; 1278 return 0;
@@ -1286,14 +1289,13 @@ static int generic_hdmi_init(struct hda_codec *codec)
1286 struct hdmi_eld *eld = &per_pin->sink_eld; 1289 struct hdmi_eld *eld = &per_pin->sink_eld;
1287 1290
1288 hdmi_init_pin(codec, pin_nid); 1291 hdmi_init_pin(codec, pin_nid);
1289 snd_hda_codec_write(codec, pin_nid, 0, 1292 snd_hda_jack_detect_enable(codec, pin_nid, pin_nid);
1290 AC_VERB_SET_UNSOLICITED_ENABLE,
1291 AC_USRSP_EN | pin_nid);
1292 1293
1293 per_pin->codec = codec; 1294 per_pin->codec = codec;
1294 INIT_DELAYED_WORK(&per_pin->work, hdmi_repoll_eld); 1295 INIT_DELAYED_WORK(&per_pin->work, hdmi_repoll_eld);
1295 snd_hda_eld_proc_new(codec, eld, pin_idx); 1296 snd_hda_eld_proc_new(codec, eld, pin_idx);
1296 } 1297 }
1298 snd_hda_jack_report_sync(codec);
1297 return 0; 1299 return 0;
1298} 1300}
1299 1301
@@ -1309,7 +1311,6 @@ static void generic_hdmi_free(struct hda_codec *codec)
1309 cancel_delayed_work(&per_pin->work); 1311 cancel_delayed_work(&per_pin->work);
1310 snd_hda_eld_proc_free(codec, eld); 1312 snd_hda_eld_proc_free(codec, eld);
1311 } 1313 }
1312 snd_hda_input_jack_free(codec);
1313 1314
1314 flush_workqueue(codec->bus->workq); 1315 flush_workqueue(codec->bus->workq);
1315 kfree(spec); 1316 kfree(spec);
@@ -1364,7 +1365,7 @@ static int simple_playback_build_pcms(struct hda_codec *codec)
1364 chans = get_wcaps(codec, spec->cvts[i].cvt_nid); 1365 chans = get_wcaps(codec, spec->cvts[i].cvt_nid);
1365 chans = get_wcaps_channels(chans); 1366 chans = get_wcaps_channels(chans);
1366 1367
1367 info->name = generic_hdmi_pcm_names[i]; 1368 info->name = get_hdmi_pcm_name(i);
1368 info->pcm_type = HDA_PCM_TYPE_HDMI; 1369 info->pcm_type = HDA_PCM_TYPE_HDMI;
1369 pstr = &info->stream[SNDRV_PCM_STREAM_PLAYBACK]; 1370 pstr = &info->stream[SNDRV_PCM_STREAM_PLAYBACK];
1370 snd_BUG_ON(!spec->pcm_playback); 1371 snd_BUG_ON(!spec->pcm_playback);
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index cbde019d3d5..5e82acf77c5 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -33,6 +33,7 @@
33#include "hda_codec.h" 33#include "hda_codec.h"
34#include "hda_local.h" 34#include "hda_local.h"
35#include "hda_beep.h" 35#include "hda_beep.h"
36#include "hda_jack.h"
36 37
37/* unsol event tags */ 38/* unsol event tags */
38#define ALC_FRONT_EVENT 0x01 39#define ALC_FRONT_EVENT 0x01
@@ -183,6 +184,8 @@ struct alc_spec {
183 unsigned int single_input_src:1; 184 unsigned int single_input_src:1;
184 unsigned int vol_in_capsrc:1; /* use capsrc volume (ADC has no vol) */ 185 unsigned int vol_in_capsrc:1; /* use capsrc volume (ADC has no vol) */
185 unsigned int parse_flags; /* passed to snd_hda_parse_pin_defcfg() */ 186 unsigned int parse_flags; /* passed to snd_hda_parse_pin_defcfg() */
187 unsigned int shared_mic_hp:1; /* HP/Mic-in sharing */
188 unsigned int use_jack_tbl:1; /* 1 for model=auto */
186 189
187 /* auto-mute control */ 190 /* auto-mute control */
188 int automute_mode; 191 int automute_mode;
@@ -283,6 +286,8 @@ static inline hda_nid_t get_capsrc(struct alc_spec *spec, int idx)
283 spec->capsrc_nids[idx] : spec->adc_nids[idx]; 286 spec->capsrc_nids[idx] : spec->adc_nids[idx];
284} 287}
285 288
289static void call_update_outputs(struct hda_codec *codec);
290
286/* select the given imux item; either unmute exclusively or select the route */ 291/* select the given imux item; either unmute exclusively or select the route */
287static int alc_mux_select(struct hda_codec *codec, unsigned int adc_idx, 292static int alc_mux_select(struct hda_codec *codec, unsigned int adc_idx,
288 unsigned int idx, bool force) 293 unsigned int idx, bool force)
@@ -297,6 +302,8 @@ static int alc_mux_select(struct hda_codec *codec, unsigned int adc_idx,
297 imux = &spec->input_mux[mux_idx]; 302 imux = &spec->input_mux[mux_idx];
298 if (!imux->num_items && mux_idx > 0) 303 if (!imux->num_items && mux_idx > 0)
299 imux = &spec->input_mux[0]; 304 imux = &spec->input_mux[0];
305 if (!imux->num_items)
306 return 0;
300 307
301 if (idx >= imux->num_items) 308 if (idx >= imux->num_items)
302 idx = imux->num_items - 1; 309 idx = imux->num_items - 1;
@@ -304,6 +311,19 @@ static int alc_mux_select(struct hda_codec *codec, unsigned int adc_idx,
304 return 0; 311 return 0;
305 spec->cur_mux[adc_idx] = idx; 312 spec->cur_mux[adc_idx] = idx;
306 313
314 /* for shared I/O, change the pin-control accordingly */
315 if (spec->shared_mic_hp) {
316 /* NOTE: this assumes that there are only two inputs, the
317 * first is the real internal mic and the second is HP jack.
318 */
319 snd_hda_codec_write(codec, spec->autocfg.inputs[1].pin, 0,
320 AC_VERB_SET_PIN_WIDGET_CONTROL,
321 spec->cur_mux[adc_idx] ?
322 PIN_VREF80 : PIN_HP);
323 spec->automute_speaker = !spec->cur_mux[adc_idx];
324 call_update_outputs(codec);
325 }
326
307 if (spec->dyn_adc_switch) { 327 if (spec->dyn_adc_switch) {
308 alc_dyn_adc_pcm_resetup(codec, idx); 328 alc_dyn_adc_pcm_resetup(codec, idx);
309 adc_idx = spec->dyn_adc_idx[idx]; 329 adc_idx = spec->dyn_adc_idx[idx];
@@ -448,46 +468,6 @@ static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
448} 468}
449 469
450/* 470/*
451 * Jack-reporting via input-jack layer
452 */
453
454/* initialization of jacks; currently checks only a few known pins */
455static int alc_init_jacks(struct hda_codec *codec)
456{
457#ifdef CONFIG_SND_HDA_INPUT_JACK
458 struct alc_spec *spec = codec->spec;
459 int err;
460 unsigned int hp_nid = spec->autocfg.hp_pins[0];
461 unsigned int mic_nid = spec->ext_mic_pin;
462 unsigned int dock_nid = spec->dock_mic_pin;
463
464 if (hp_nid) {
465 err = snd_hda_input_jack_add(codec, hp_nid,
466 SND_JACK_HEADPHONE, NULL);
467 if (err < 0)
468 return err;
469 snd_hda_input_jack_report(codec, hp_nid);
470 }
471
472 if (mic_nid) {
473 err = snd_hda_input_jack_add(codec, mic_nid,
474 SND_JACK_MICROPHONE, NULL);
475 if (err < 0)
476 return err;
477 snd_hda_input_jack_report(codec, mic_nid);
478 }
479 if (dock_nid) {
480 err = snd_hda_input_jack_add(codec, dock_nid,
481 SND_JACK_MICROPHONE, NULL);
482 if (err < 0)
483 return err;
484 snd_hda_input_jack_report(codec, dock_nid);
485 }
486#endif /* CONFIG_SND_HDA_INPUT_JACK */
487 return 0;
488}
489
490/*
491 * Jack detections for HP auto-mute and mic-switch 471 * Jack detections for HP auto-mute and mic-switch
492 */ 472 */
493 473
@@ -500,7 +480,6 @@ static bool detect_jacks(struct hda_codec *codec, int num_pins, hda_nid_t *pins)
500 hda_nid_t nid = pins[i]; 480 hda_nid_t nid = pins[i];
501 if (!nid) 481 if (!nid)
502 break; 482 break;
503 snd_hda_input_jack_report(codec, nid);
504 present |= snd_hda_jack_detect(codec, nid); 483 present |= snd_hda_jack_detect(codec, nid);
505 } 484 }
506 return present; 485 return present;
@@ -552,7 +531,8 @@ static void update_outputs(struct hda_codec *codec)
552 * in general, HP pins/amps control should be enabled in all cases, 531 * in general, HP pins/amps control should be enabled in all cases,
553 * but currently set only for master_mute, just to be safe 532 * but currently set only for master_mute, just to be safe
554 */ 533 */
555 do_automute(codec, ARRAY_SIZE(spec->autocfg.hp_pins), 534 if (!spec->shared_mic_hp) /* don't change HP-pin when shared with mic */
535 do_automute(codec, ARRAY_SIZE(spec->autocfg.hp_pins),
556 spec->autocfg.hp_pins, spec->master_mute, true); 536 spec->autocfg.hp_pins, spec->master_mute, true);
557 537
558 if (!spec->automute_speaker) 538 if (!spec->automute_speaker)
@@ -639,19 +619,18 @@ static void alc_mic_automute(struct hda_codec *codec)
639 alc_mux_select(codec, 0, spec->dock_mic_idx, false); 619 alc_mux_select(codec, 0, spec->dock_mic_idx, false);
640 else 620 else
641 alc_mux_select(codec, 0, spec->int_mic_idx, false); 621 alc_mux_select(codec, 0, spec->int_mic_idx, false);
642
643 snd_hda_input_jack_report(codec, pins[spec->ext_mic_idx]);
644 if (spec->dock_mic_idx >= 0)
645 snd_hda_input_jack_report(codec, pins[spec->dock_mic_idx]);
646} 622}
647 623
648/* unsolicited event for HP jack sensing */ 624/* unsolicited event for HP jack sensing */
649static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res) 625static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
650{ 626{
627 struct alc_spec *spec = codec->spec;
651 if (codec->vendor_id == 0x10ec0880) 628 if (codec->vendor_id == 0x10ec0880)
652 res >>= 28; 629 res >>= 28;
653 else 630 else
654 res >>= 26; 631 res >>= 26;
632 if (spec->use_jack_tbl)
633 res = snd_hda_jack_get_action(codec, res);
655 switch (res) { 634 switch (res) {
656 case ALC_HP_EVENT: 635 case ALC_HP_EVENT:
657 alc_hp_automute(codec); 636 alc_hp_automute(codec);
@@ -663,6 +642,7 @@ static void alc_sku_unsol_event(struct hda_codec *codec, unsigned int res)
663 alc_mic_automute(codec); 642 alc_mic_automute(codec);
664 break; 643 break;
665 } 644 }
645 snd_hda_jack_report_sync(codec);
666} 646}
667 647
668/* call init functions of standard auto-mute helpers */ 648/* call init functions of standard auto-mute helpers */
@@ -952,9 +932,7 @@ static void alc_init_automute(struct hda_codec *codec)
952 continue; 932 continue;
953 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n", 933 snd_printdd("realtek: Enable HP auto-muting on NID 0x%x\n",
954 nid); 934 nid);
955 snd_hda_codec_write_cache(codec, nid, 0, 935 snd_hda_jack_detect_enable(codec, nid, ALC_HP_EVENT);
956 AC_VERB_SET_UNSOLICITED_ENABLE,
957 AC_USRSP_EN | ALC_HP_EVENT);
958 spec->detect_hp = 1; 936 spec->detect_hp = 1;
959 } 937 }
960 938
@@ -966,9 +944,8 @@ static void alc_init_automute(struct hda_codec *codec)
966 continue; 944 continue;
967 snd_printdd("realtek: Enable Line-Out " 945 snd_printdd("realtek: Enable Line-Out "
968 "auto-muting on NID 0x%x\n", nid); 946 "auto-muting on NID 0x%x\n", nid);
969 snd_hda_codec_write_cache(codec, nid, 0, 947 snd_hda_jack_detect_enable(codec, nid,
970 AC_VERB_SET_UNSOLICITED_ENABLE, 948 ALC_FRONT_EVENT);
971 AC_USRSP_EN | ALC_FRONT_EVENT);
972 spec->detect_lo = 1; 949 spec->detect_lo = 1;
973 } 950 }
974 spec->automute_lo_possible = spec->detect_hp; 951 spec->automute_lo_possible = spec->detect_hp;
@@ -1107,13 +1084,10 @@ static bool alc_auto_mic_check_imux(struct hda_codec *codec)
1107 return false; /* no corresponding imux */ 1084 return false; /* no corresponding imux */
1108 } 1085 }
1109 1086
1110 snd_hda_codec_write_cache(codec, spec->ext_mic_pin, 0, 1087 snd_hda_jack_detect_enable(codec, spec->ext_mic_pin, ALC_MIC_EVENT);
1111 AC_VERB_SET_UNSOLICITED_ENABLE,
1112 AC_USRSP_EN | ALC_MIC_EVENT);
1113 if (spec->dock_mic_pin) 1088 if (spec->dock_mic_pin)
1114 snd_hda_codec_write_cache(codec, spec->dock_mic_pin, 0, 1089 snd_hda_jack_detect_enable(codec, spec->dock_mic_pin,
1115 AC_VERB_SET_UNSOLICITED_ENABLE, 1090 ALC_MIC_EVENT);
1116 AC_USRSP_EN | ALC_MIC_EVENT);
1117 1091
1118 spec->auto_mic_valid_imux = 1; 1092 spec->auto_mic_valid_imux = 1;
1119 spec->auto_mic = 1; 1093 spec->auto_mic = 1;
@@ -1131,6 +1105,9 @@ static void alc_init_auto_mic(struct hda_codec *codec)
1131 hda_nid_t fixed, ext, dock; 1105 hda_nid_t fixed, ext, dock;
1132 int i; 1106 int i;
1133 1107
1108 if (spec->shared_mic_hp)
1109 return; /* no auto-mic for the shared I/O */
1110
1134 spec->ext_mic_idx = spec->int_mic_idx = spec->dock_mic_idx = -1; 1111 spec->ext_mic_idx = spec->int_mic_idx = spec->dock_mic_idx = -1;
1135 1112
1136 fixed = ext = dock = 0; 1113 fixed = ext = dock = 0;
@@ -1522,6 +1499,7 @@ static void alc_pick_fixup(struct hda_codec *codec,
1522 const struct alc_fixup *fixlist) 1499 const struct alc_fixup *fixlist)
1523{ 1500{
1524 struct alc_spec *spec = codec->spec; 1501 struct alc_spec *spec = codec->spec;
1502 const struct snd_pci_quirk *q;
1525 int id = -1; 1503 int id = -1;
1526 const char *name = NULL; 1504 const char *name = NULL;
1527 1505
@@ -1536,12 +1514,25 @@ static void alc_pick_fixup(struct hda_codec *codec,
1536 } 1514 }
1537 } 1515 }
1538 if (id < 0) { 1516 if (id < 0) {
1539 quirk = snd_pci_quirk_lookup(codec->bus->pci, quirk); 1517 q = snd_pci_quirk_lookup(codec->bus->pci, quirk);
1540 if (quirk) { 1518 if (q) {
1541 id = quirk->value; 1519 id = q->value;
1520#ifdef CONFIG_SND_DEBUG_VERBOSE
1521 name = q->name;
1522#endif
1523 }
1524 }
1525 if (id < 0) {
1526 for (q = quirk; q->subvendor; q++) {
1527 unsigned int vendorid =
1528 q->subdevice | (q->subvendor << 16);
1529 if (vendorid == codec->subsystem_id) {
1530 id = q->value;
1542#ifdef CONFIG_SND_DEBUG_VERBOSE 1531#ifdef CONFIG_SND_DEBUG_VERBOSE
1543 name = quirk->name; 1532 name = q->name;
1544#endif 1533#endif
1534 break;
1535 }
1545 } 1536 }
1546 } 1537 }
1547 1538
@@ -2038,6 +2029,10 @@ static int alc_build_controls(struct hda_codec *codec)
2038 2029
2039 alc_free_kctls(codec); /* no longer needed */ 2030 alc_free_kctls(codec); /* no longer needed */
2040 2031
2032 err = snd_hda_jack_add_kctls(codec, &spec->autocfg);
2033 if (err < 0)
2034 return err;
2035
2041 return 0; 2036 return 0;
2042} 2037}
2043 2038
@@ -2065,6 +2060,8 @@ static int alc_init(struct hda_codec *codec)
2065 2060
2066 alc_apply_fixup(codec, ALC_FIXUP_ACT_INIT); 2061 alc_apply_fixup(codec, ALC_FIXUP_ACT_INIT);
2067 2062
2063 snd_hda_jack_report_sync(codec);
2064
2068 hda_call_check_power_status(codec, 0x01); 2065 hda_call_check_power_status(codec, 0x01);
2069 return 0; 2066 return 0;
2070} 2067}
@@ -2448,7 +2445,6 @@ static void alc_free(struct hda_codec *codec)
2448 return; 2445 return;
2449 2446
2450 alc_shutup(codec); 2447 alc_shutup(codec);
2451 snd_hda_input_jack_free(codec);
2452 alc_free_kctls(codec); 2448 alc_free_kctls(codec);
2453 alc_free_bind_ctls(codec); 2449 alc_free_bind_ctls(codec);
2454 kfree(spec); 2450 kfree(spec);
@@ -2629,6 +2625,8 @@ static const char *alc_get_line_out_pfx(struct alc_spec *spec, int ch,
2629 case AUTO_PIN_SPEAKER_OUT: 2625 case AUTO_PIN_SPEAKER_OUT:
2630 if (cfg->line_outs == 1) 2626 if (cfg->line_outs == 1)
2631 return "Speaker"; 2627 return "Speaker";
2628 if (cfg->line_outs == 2)
2629 return ch ? "Bass Speaker" : "Speaker";
2632 break; 2630 break;
2633 case AUTO_PIN_HP_OUT: 2631 case AUTO_PIN_HP_OUT:
2634 /* for multi-io case, only the primary out */ 2632 /* for multi-io case, only the primary out */
@@ -2681,6 +2679,9 @@ static int alc_auto_fill_adc_caps(struct hda_codec *codec)
2681 int max_nums = ARRAY_SIZE(spec->private_adc_nids); 2679 int max_nums = ARRAY_SIZE(spec->private_adc_nids);
2682 int i, nums = 0; 2680 int i, nums = 0;
2683 2681
2682 if (spec->shared_mic_hp)
2683 max_nums = 1; /* no multi streams with the shared HP/mic */
2684
2684 nid = codec->start_nid; 2685 nid = codec->start_nid;
2685 for (i = 0; i < codec->num_nodes; i++, nid++) { 2686 for (i = 0; i < codec->num_nodes; i++, nid++) {
2686 hda_nid_t src; 2687 hda_nid_t src;
@@ -2743,6 +2744,8 @@ static int alc_auto_create_input_ctls(struct hda_codec *codec)
2743 continue; 2744 continue;
2744 2745
2745 label = hda_get_autocfg_input_label(codec, cfg, i); 2746 label = hda_get_autocfg_input_label(codec, cfg, i);
2747 if (spec->shared_mic_hp && !strcmp(label, "Misc"))
2748 label = "Headphone Mic";
2746 if (prev_label && !strcmp(label, prev_label)) 2749 if (prev_label && !strcmp(label, prev_label))
2747 type_idx++; 2750 type_idx++;
2748 else 2751 else
@@ -2777,6 +2780,39 @@ static int alc_auto_create_input_ctls(struct hda_codec *codec)
2777 return 0; 2780 return 0;
2778} 2781}
2779 2782
2783/* create a shared input with the headphone out */
2784static int alc_auto_create_shared_input(struct hda_codec *codec)
2785{
2786 struct alc_spec *spec = codec->spec;
2787 struct auto_pin_cfg *cfg = &spec->autocfg;
2788 unsigned int defcfg;
2789 hda_nid_t nid;
2790
2791 /* only one internal input pin? */
2792 if (cfg->num_inputs != 1)
2793 return 0;
2794 defcfg = snd_hda_codec_get_pincfg(codec, cfg->inputs[0].pin);
2795 if (snd_hda_get_input_pin_attr(defcfg) != INPUT_PIN_ATTR_INT)
2796 return 0;
2797
2798 if (cfg->hp_outs == 1 && cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
2799 nid = cfg->hp_pins[0]; /* OK, we have a single HP-out */
2800 else if (cfg->line_outs == 1 && cfg->line_out_type == AUTO_PIN_HP_OUT)
2801 nid = cfg->line_out_pins[0]; /* OK, we have a single line-out */
2802 else
2803 return 0; /* both not available */
2804
2805 if (!(snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_IN))
2806 return 0; /* no input */
2807
2808 cfg->inputs[1].pin = nid;
2809 cfg->inputs[1].type = AUTO_PIN_MIC;
2810 cfg->num_inputs = 2;
2811 spec->shared_mic_hp = 1;
2812 snd_printdd("realtek: Enable shared I/O jack on NID 0x%x\n", nid);
2813 return 0;
2814}
2815
2780static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid, 2816static void alc_set_pin_output(struct hda_codec *codec, hda_nid_t nid,
2781 unsigned int pin_type) 2817 unsigned int pin_type)
2782{ 2818{
@@ -2902,7 +2938,7 @@ static hda_nid_t alc_auto_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
2902 if (!nid) 2938 if (!nid)
2903 continue; 2939 continue;
2904 if (found_in_nid_list(nid, spec->multiout.dac_nids, 2940 if (found_in_nid_list(nid, spec->multiout.dac_nids,
2905 spec->multiout.num_dacs)) 2941 ARRAY_SIZE(spec->private_dac_nids)))
2906 continue; 2942 continue;
2907 if (found_in_nid_list(nid, spec->multiout.hp_out_nid, 2943 if (found_in_nid_list(nid, spec->multiout.hp_out_nid,
2908 ARRAY_SIZE(spec->multiout.hp_out_nid))) 2944 ARRAY_SIZE(spec->multiout.hp_out_nid)))
@@ -2915,6 +2951,23 @@ static hda_nid_t alc_auto_look_for_dac(struct hda_codec *codec, hda_nid_t pin)
2915 return 0; 2951 return 0;
2916} 2952}
2917 2953
2954/* check whether the DAC is reachable from the pin */
2955static bool alc_auto_is_dac_reachable(struct hda_codec *codec,
2956 hda_nid_t pin, hda_nid_t dac)
2957{
2958 hda_nid_t srcs[5];
2959 int i, num;
2960
2961 pin = alc_go_down_to_selector(codec, pin);
2962 num = snd_hda_get_connections(codec, pin, srcs, ARRAY_SIZE(srcs));
2963 for (i = 0; i < num; i++) {
2964 hda_nid_t nid = alc_auto_mix_to_dac(codec, srcs[i]);
2965 if (nid == dac)
2966 return true;
2967 }
2968 return false;
2969}
2970
2918static hda_nid_t get_dac_if_single(struct hda_codec *codec, hda_nid_t pin) 2971static hda_nid_t get_dac_if_single(struct hda_codec *codec, hda_nid_t pin)
2919{ 2972{
2920 hda_nid_t sel = alc_go_down_to_selector(codec, pin); 2973 hda_nid_t sel = alc_go_down_to_selector(codec, pin);
@@ -2923,6 +2976,7 @@ static hda_nid_t get_dac_if_single(struct hda_codec *codec, hda_nid_t pin)
2923 return 0; 2976 return 0;
2924} 2977}
2925 2978
2979/* return 0 if no possible DAC is found, 1 if one or more found */
2926static int alc_auto_fill_extra_dacs(struct hda_codec *codec, int num_outs, 2980static int alc_auto_fill_extra_dacs(struct hda_codec *codec, int num_outs,
2927 const hda_nid_t *pins, hda_nid_t *dacs) 2981 const hda_nid_t *pins, hda_nid_t *dacs)
2928{ 2982{
@@ -2940,17 +2994,21 @@ static int alc_auto_fill_extra_dacs(struct hda_codec *codec, int num_outs,
2940 if (!dacs[i]) 2994 if (!dacs[i])
2941 dacs[i] = alc_auto_look_for_dac(codec, pins[i]); 2995 dacs[i] = alc_auto_look_for_dac(codec, pins[i]);
2942 } 2996 }
2943 return 0; 2997 return 1;
2944} 2998}
2945 2999
2946static int alc_auto_fill_multi_ios(struct hda_codec *codec, 3000static int alc_auto_fill_multi_ios(struct hda_codec *codec,
2947 unsigned int location); 3001 unsigned int location, int offset);
3002static hda_nid_t alc_look_for_out_vol_nid(struct hda_codec *codec,
3003 hda_nid_t pin, hda_nid_t dac);
2948 3004
2949/* fill in the dac_nids table from the parsed pin configuration */ 3005/* fill in the dac_nids table from the parsed pin configuration */
2950static int alc_auto_fill_dac_nids(struct hda_codec *codec) 3006static int alc_auto_fill_dac_nids(struct hda_codec *codec)
2951{ 3007{
2952 struct alc_spec *spec = codec->spec; 3008 struct alc_spec *spec = codec->spec;
2953 const struct auto_pin_cfg *cfg = &spec->autocfg; 3009 struct auto_pin_cfg *cfg = &spec->autocfg;
3010 unsigned int location, defcfg;
3011 int num_pins;
2954 bool redone = false; 3012 bool redone = false;
2955 int i; 3013 int i;
2956 3014
@@ -2961,6 +3019,7 @@ static int alc_auto_fill_dac_nids(struct hda_codec *codec)
2961 spec->multiout.extra_out_nid[0] = 0; 3019 spec->multiout.extra_out_nid[0] = 0;
2962 memset(spec->private_dac_nids, 0, sizeof(spec->private_dac_nids)); 3020 memset(spec->private_dac_nids, 0, sizeof(spec->private_dac_nids));
2963 spec->multiout.dac_nids = spec->private_dac_nids; 3021 spec->multiout.dac_nids = spec->private_dac_nids;
3022 spec->multi_ios = 0;
2964 3023
2965 /* fill hard-wired DACs first */ 3024 /* fill hard-wired DACs first */
2966 if (!redone) { 3025 if (!redone) {
@@ -2994,21 +3053,20 @@ static int alc_auto_fill_dac_nids(struct hda_codec *codec)
2994 for (i = 0; i < cfg->line_outs; i++) { 3053 for (i = 0; i < cfg->line_outs; i++) {
2995 if (spec->private_dac_nids[i]) 3054 if (spec->private_dac_nids[i])
2996 spec->multiout.num_dacs++; 3055 spec->multiout.num_dacs++;
2997 else 3056 else {
2998 memmove(spec->private_dac_nids + i, 3057 memmove(spec->private_dac_nids + i,
2999 spec->private_dac_nids + i + 1, 3058 spec->private_dac_nids + i + 1,
3000 sizeof(hda_nid_t) * (cfg->line_outs - i - 1)); 3059 sizeof(hda_nid_t) * (cfg->line_outs - i - 1));
3060 spec->private_dac_nids[cfg->line_outs - 1] = 0;
3061 }
3001 } 3062 }
3002 3063
3003 if (cfg->line_outs == 1 && cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) { 3064 if (cfg->line_outs == 1 && cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) {
3004 /* try to fill multi-io first */ 3065 /* try to fill multi-io first */
3005 unsigned int location, defcfg;
3006 int num_pins;
3007
3008 defcfg = snd_hda_codec_get_pincfg(codec, cfg->line_out_pins[0]); 3066 defcfg = snd_hda_codec_get_pincfg(codec, cfg->line_out_pins[0]);
3009 location = get_defcfg_location(defcfg); 3067 location = get_defcfg_location(defcfg);
3010 3068
3011 num_pins = alc_auto_fill_multi_ios(codec, location); 3069 num_pins = alc_auto_fill_multi_ios(codec, location, 0);
3012 if (num_pins > 0) { 3070 if (num_pins > 0) {
3013 spec->multi_ios = num_pins; 3071 spec->multi_ios = num_pins;
3014 spec->ext_channel_count = 2; 3072 spec->ext_channel_count = 2;
@@ -3019,10 +3077,48 @@ static int alc_auto_fill_dac_nids(struct hda_codec *codec)
3019 if (cfg->line_out_type != AUTO_PIN_HP_OUT) 3077 if (cfg->line_out_type != AUTO_PIN_HP_OUT)
3020 alc_auto_fill_extra_dacs(codec, cfg->hp_outs, cfg->hp_pins, 3078 alc_auto_fill_extra_dacs(codec, cfg->hp_outs, cfg->hp_pins,
3021 spec->multiout.hp_out_nid); 3079 spec->multiout.hp_out_nid);
3022 if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) 3080 if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) {
3023 alc_auto_fill_extra_dacs(codec, cfg->speaker_outs, cfg->speaker_pins, 3081 int err = alc_auto_fill_extra_dacs(codec, cfg->speaker_outs,
3024 spec->multiout.extra_out_nid); 3082 cfg->speaker_pins,
3083 spec->multiout.extra_out_nid);
3084 /* if no speaker volume is assigned, try again as the primary
3085 * output
3086 */
3087 if (!err && cfg->speaker_outs > 0 &&
3088 cfg->line_out_type == AUTO_PIN_HP_OUT) {
3089 cfg->hp_outs = cfg->line_outs;
3090 memcpy(cfg->hp_pins, cfg->line_out_pins,
3091 sizeof(cfg->hp_pins));
3092 cfg->line_outs = cfg->speaker_outs;
3093 memcpy(cfg->line_out_pins, cfg->speaker_pins,
3094 sizeof(cfg->speaker_pins));
3095 cfg->speaker_outs = 0;
3096 memset(cfg->speaker_pins, 0, sizeof(cfg->speaker_pins));
3097 cfg->line_out_type = AUTO_PIN_SPEAKER_OUT;
3098 redone = false;
3099 goto again;
3100 }
3101 }
3102
3103 if (!spec->multi_ios &&
3104 cfg->line_out_type == AUTO_PIN_SPEAKER_OUT &&
3105 cfg->hp_outs) {
3106 /* try multi-ios with HP + inputs */
3107 defcfg = snd_hda_codec_get_pincfg(codec, cfg->hp_pins[0]);
3108 location = get_defcfg_location(defcfg);
3025 3109
3110 num_pins = alc_auto_fill_multi_ios(codec, location, 1);
3111 if (num_pins > 0) {
3112 spec->multi_ios = num_pins;
3113 spec->ext_channel_count = 2;
3114 spec->multiout.num_dacs = num_pins + 1;
3115 }
3116 }
3117
3118 if (cfg->line_out_pins[0])
3119 spec->vmaster_nid =
3120 alc_look_for_out_vol_nid(codec, cfg->line_out_pins[0],
3121 spec->multiout.dac_nids[0]);
3026 return 0; 3122 return 0;
3027} 3123}
3028 3124
@@ -3054,8 +3150,15 @@ static int alc_auto_add_vol_ctl(struct hda_codec *codec,
3054 val); 3150 val);
3055} 3151}
3056 3152
3057#define alc_auto_add_stereo_vol(codec, pfx, cidx, nid) \ 3153static int alc_auto_add_stereo_vol(struct hda_codec *codec,
3058 alc_auto_add_vol_ctl(codec, pfx, cidx, nid, 3) 3154 const char *pfx, int cidx,
3155 hda_nid_t nid)
3156{
3157 int chs = 1;
3158 if (get_wcaps(codec, nid) & AC_WCAP_STEREO)
3159 chs = 3;
3160 return alc_auto_add_vol_ctl(codec, pfx, cidx, nid, chs);
3161}
3059 3162
3060/* create a mute-switch for the given mixer widget; 3163/* create a mute-switch for the given mixer widget;
3061 * if it has multiple sources (e.g. DAC and loopback), create a bind-mute 3164 * if it has multiple sources (e.g. DAC and loopback), create a bind-mute
@@ -3087,8 +3190,14 @@ static int alc_auto_add_sw_ctl(struct hda_codec *codec,
3087 return __add_pb_sw_ctrl(codec->spec, type, pfx, cidx, val); 3190 return __add_pb_sw_ctrl(codec->spec, type, pfx, cidx, val);
3088} 3191}
3089 3192
3090#define alc_auto_add_stereo_sw(codec, pfx, cidx, nid) \ 3193static int alc_auto_add_stereo_sw(struct hda_codec *codec, const char *pfx,
3091 alc_auto_add_sw_ctl(codec, pfx, cidx, nid, 3) 3194 int cidx, hda_nid_t nid)
3195{
3196 int chs = 1;
3197 if (get_wcaps(codec, nid) & AC_WCAP_STEREO)
3198 chs = 3;
3199 return alc_auto_add_sw_ctl(codec, pfx, cidx, nid, chs);
3200}
3092 3201
3093static hda_nid_t alc_look_for_out_mute_nid(struct hda_codec *codec, 3202static hda_nid_t alc_look_for_out_mute_nid(struct hda_codec *codec,
3094 hda_nid_t pin, hda_nid_t dac) 3203 hda_nid_t pin, hda_nid_t dac)
@@ -3171,7 +3280,8 @@ static int alc_auto_create_multi_out_ctls(struct hda_codec *codec,
3171} 3280}
3172 3281
3173static int alc_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin, 3282static int alc_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
3174 hda_nid_t dac, const char *pfx) 3283 hda_nid_t dac, const char *pfx,
3284 int cidx)
3175{ 3285{
3176 struct alc_spec *spec = codec->spec; 3286 struct alc_spec *spec = codec->spec;
3177 hda_nid_t sw, vol; 3287 hda_nid_t sw, vol;
@@ -3187,15 +3297,15 @@ static int alc_auto_create_extra_out(struct hda_codec *codec, hda_nid_t pin,
3187 if (is_ctl_used(spec->sw_ctls, val)) 3297 if (is_ctl_used(spec->sw_ctls, val))
3188 return 0; /* already created */ 3298 return 0; /* already created */
3189 mark_ctl_usage(spec->sw_ctls, val); 3299 mark_ctl_usage(spec->sw_ctls, val);
3190 return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, val); 3300 return __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, cidx, val);
3191 } 3301 }
3192 3302
3193 sw = alc_look_for_out_mute_nid(codec, pin, dac); 3303 sw = alc_look_for_out_mute_nid(codec, pin, dac);
3194 vol = alc_look_for_out_vol_nid(codec, pin, dac); 3304 vol = alc_look_for_out_vol_nid(codec, pin, dac);
3195 err = alc_auto_add_stereo_vol(codec, pfx, 0, vol); 3305 err = alc_auto_add_stereo_vol(codec, pfx, cidx, vol);
3196 if (err < 0) 3306 if (err < 0)
3197 return err; 3307 return err;
3198 err = alc_auto_add_stereo_sw(codec, pfx, 0, sw); 3308 err = alc_auto_add_stereo_sw(codec, pfx, cidx, sw);
3199 if (err < 0) 3309 if (err < 0)
3200 return err; 3310 return err;
3201 return 0; 3311 return 0;
@@ -3236,16 +3346,21 @@ static int alc_auto_create_extra_outs(struct hda_codec *codec, int num_pins,
3236 hda_nid_t dac = *dacs; 3346 hda_nid_t dac = *dacs;
3237 if (!dac) 3347 if (!dac)
3238 dac = spec->multiout.dac_nids[0]; 3348 dac = spec->multiout.dac_nids[0];
3239 return alc_auto_create_extra_out(codec, *pins, dac, pfx); 3349 return alc_auto_create_extra_out(codec, *pins, dac, pfx, 0);
3240 } 3350 }
3241 3351
3242 if (dacs[num_pins - 1]) { 3352 if (dacs[num_pins - 1]) {
3243 /* OK, we have a multi-output system with individual volumes */ 3353 /* OK, we have a multi-output system with individual volumes */
3244 for (i = 0; i < num_pins; i++) { 3354 for (i = 0; i < num_pins; i++) {
3245 snprintf(name, sizeof(name), "%s %s", 3355 if (num_pins >= 3) {
3246 pfx, channel_name[i]); 3356 snprintf(name, sizeof(name), "%s %s",
3247 err = alc_auto_create_extra_out(codec, pins[i], dacs[i], 3357 pfx, channel_name[i]);
3248 name); 3358 err = alc_auto_create_extra_out(codec, pins[i], dacs[i],
3359 name, 0);
3360 } else {
3361 err = alc_auto_create_extra_out(codec, pins[i], dacs[i],
3362 pfx, i);
3363 }
3249 if (err < 0) 3364 if (err < 0)
3250 return err; 3365 return err;
3251 } 3366 }
@@ -3408,17 +3523,19 @@ static void alc_auto_init_extra_out(struct hda_codec *codec)
3408 * multi-io helper 3523 * multi-io helper
3409 */ 3524 */
3410static int alc_auto_fill_multi_ios(struct hda_codec *codec, 3525static int alc_auto_fill_multi_ios(struct hda_codec *codec,
3411 unsigned int location) 3526 unsigned int location,
3527 int offset)
3412{ 3528{
3413 struct alc_spec *spec = codec->spec; 3529 struct alc_spec *spec = codec->spec;
3414 struct auto_pin_cfg *cfg = &spec->autocfg; 3530 struct auto_pin_cfg *cfg = &spec->autocfg;
3415 hda_nid_t prime_dac = spec->private_dac_nids[0]; 3531 hda_nid_t prime_dac = spec->private_dac_nids[0];
3416 int type, i, num_pins = 0; 3532 int type, i, dacs, num_pins = 0;
3417 3533
3534 dacs = spec->multiout.num_dacs;
3418 for (type = AUTO_PIN_LINE_IN; type >= AUTO_PIN_MIC; type--) { 3535 for (type = AUTO_PIN_LINE_IN; type >= AUTO_PIN_MIC; type--) {
3419 for (i = 0; i < cfg->num_inputs; i++) { 3536 for (i = 0; i < cfg->num_inputs; i++) {
3420 hda_nid_t nid = cfg->inputs[i].pin; 3537 hda_nid_t nid = cfg->inputs[i].pin;
3421 hda_nid_t dac; 3538 hda_nid_t dac = 0;
3422 unsigned int defcfg, caps; 3539 unsigned int defcfg, caps;
3423 if (cfg->inputs[i].type != type) 3540 if (cfg->inputs[i].type != type)
3424 continue; 3541 continue;
@@ -3430,7 +3547,13 @@ static int alc_auto_fill_multi_ios(struct hda_codec *codec,
3430 caps = snd_hda_query_pin_caps(codec, nid); 3547 caps = snd_hda_query_pin_caps(codec, nid);
3431 if (!(caps & AC_PINCAP_OUT)) 3548 if (!(caps & AC_PINCAP_OUT))
3432 continue; 3549 continue;
3433 dac = alc_auto_look_for_dac(codec, nid); 3550 if (offset && offset + num_pins < dacs) {
3551 dac = spec->private_dac_nids[offset + num_pins];
3552 if (!alc_auto_is_dac_reachable(codec, nid, dac))
3553 dac = 0;
3554 }
3555 if (!dac)
3556 dac = alc_auto_look_for_dac(codec, nid);
3434 if (!dac) 3557 if (!dac)
3435 continue; 3558 continue;
3436 spec->multi_io[num_pins].pin = nid; 3559 spec->multi_io[num_pins].pin = nid;
@@ -3439,11 +3562,11 @@ static int alc_auto_fill_multi_ios(struct hda_codec *codec,
3439 spec->private_dac_nids[spec->multiout.num_dacs++] = dac; 3562 spec->private_dac_nids[spec->multiout.num_dacs++] = dac;
3440 } 3563 }
3441 } 3564 }
3442 spec->multiout.num_dacs = 1; 3565 spec->multiout.num_dacs = dacs;
3443 if (num_pins < 2) { 3566 if (num_pins < 2) {
3444 /* clear up again */ 3567 /* clear up again */
3445 memset(spec->private_dac_nids, 0, 3568 memset(spec->private_dac_nids + dacs, 0,
3446 sizeof(spec->private_dac_nids)); 3569 sizeof(hda_nid_t) * (AUTO_CFG_MAX_OUTS - dacs));
3447 spec->private_dac_nids[0] = prime_dac; 3570 spec->private_dac_nids[0] = prime_dac;
3448 return 0; 3571 return 0;
3449 } 3572 }
@@ -3667,6 +3790,8 @@ static int alc_auto_add_mic_boost(struct hda_codec *codec)
3667 char boost_label[32]; 3790 char boost_label[32];
3668 3791
3669 label = hda_get_autocfg_input_label(codec, cfg, i); 3792 label = hda_get_autocfg_input_label(codec, cfg, i);
3793 if (spec->shared_mic_hp && !strcmp(label, "Misc"))
3794 label = "Headphone Mic";
3670 if (prev_label && !strcmp(label, prev_label)) 3795 if (prev_label && !strcmp(label, prev_label))
3671 type_idx++; 3796 type_idx++;
3672 else 3797 else
@@ -3779,6 +3904,7 @@ static void set_capture_mixer(struct hda_codec *codec)
3779static void alc_auto_init_std(struct hda_codec *codec) 3904static void alc_auto_init_std(struct hda_codec *codec)
3780{ 3905{
3781 struct alc_spec *spec = codec->spec; 3906 struct alc_spec *spec = codec->spec;
3907 spec->use_jack_tbl = 1;
3782 alc_auto_init_multi_out(codec); 3908 alc_auto_init_multi_out(codec);
3783 alc_auto_init_extra_out(codec); 3909 alc_auto_init_extra_out(codec);
3784 alc_auto_init_analog_input(codec); 3910 alc_auto_init_analog_input(codec);
@@ -3871,6 +3997,9 @@ static int alc_parse_auto_config(struct hda_codec *codec,
3871 err = alc_auto_create_speaker_out(codec); 3997 err = alc_auto_create_speaker_out(codec);
3872 if (err < 0) 3998 if (err < 0)
3873 return err; 3999 return err;
4000 err = alc_auto_create_shared_input(codec);
4001 if (err < 0)
4002 return err;
3874 err = alc_auto_create_input_ctls(codec); 4003 err = alc_auto_create_input_ctls(codec);
3875 if (err < 0) 4004 if (err < 0)
3876 return err; 4005 return err;
@@ -3918,6 +4047,37 @@ static const struct hda_amp_list alc880_loopbacks[] = {
3918#endif 4047#endif
3919 4048
3920/* 4049/*
4050 * ALC880 fix-ups
4051 */
4052enum {
4053 ALC880_FIXUP_GPIO2,
4054 ALC880_FIXUP_MEDION_RIM,
4055};
4056
4057static const struct alc_fixup alc880_fixups[] = {
4058 [ALC880_FIXUP_GPIO2] = {
4059 .type = ALC_FIXUP_VERBS,
4060 .v.verbs = alc_gpio2_init_verbs,
4061 },
4062 [ALC880_FIXUP_MEDION_RIM] = {
4063 .type = ALC_FIXUP_VERBS,
4064 .v.verbs = (const struct hda_verb[]) {
4065 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
4066 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
4067 { }
4068 },
4069 .chained = true,
4070 .chain_id = ALC880_FIXUP_GPIO2,
4071 },
4072};
4073
4074static const struct snd_pci_quirk alc880_fixup_tbl[] = {
4075 SND_PCI_QUIRK(0x161f, 0x205d, "Medion Rim 2150", ALC880_FIXUP_MEDION_RIM),
4076 {}
4077};
4078
4079
4080/*
3921 * board setups 4081 * board setups
3922 */ 4082 */
3923#ifdef CONFIG_SND_HDA_ENABLE_REALTEK_QUIRKS 4083#ifdef CONFIG_SND_HDA_ENABLE_REALTEK_QUIRKS
@@ -3963,6 +4123,11 @@ static int patch_alc880(struct hda_codec *codec)
3963 } 4123 }
3964 4124
3965 if (board_config == ALC_MODEL_AUTO) { 4125 if (board_config == ALC_MODEL_AUTO) {
4126 alc_pick_fixup(codec, NULL, alc880_fixup_tbl, alc880_fixups);
4127 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
4128 }
4129
4130 if (board_config == ALC_MODEL_AUTO) {
3966 /* automatic parse from the BIOS config */ 4131 /* automatic parse from the BIOS config */
3967 err = alc880_parse_auto_config(codec); 4132 err = alc880_parse_auto_config(codec);
3968 if (err < 0) 4133 if (err < 0)
@@ -3977,8 +4142,10 @@ static int patch_alc880(struct hda_codec *codec)
3977#endif 4142#endif
3978 } 4143 }
3979 4144
3980 if (board_config != ALC_MODEL_AUTO) 4145 if (board_config != ALC_MODEL_AUTO) {
4146 spec->vmaster_nid = 0x0c;
3981 setup_preset(codec, &alc880_presets[board_config]); 4147 setup_preset(codec, &alc880_presets[board_config]);
4148 }
3982 4149
3983 if (!spec->no_analog && !spec->adc_nids) { 4150 if (!spec->no_analog && !spec->adc_nids) {
3984 alc_auto_fill_adc_caps(codec); 4151 alc_auto_fill_adc_caps(codec);
@@ -3996,7 +4163,7 @@ static int patch_alc880(struct hda_codec *codec)
3996 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); 4163 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
3997 } 4164 }
3998 4165
3999 spec->vmaster_nid = 0x0c; 4166 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
4000 4167
4001 codec->patch_ops = alc_patch_ops; 4168 codec->patch_ops = alc_patch_ops;
4002 if (board_config == ALC_MODEL_AUTO) 4169 if (board_config == ALC_MODEL_AUTO)
@@ -4104,8 +4271,10 @@ static int patch_alc260(struct hda_codec *codec)
4104#endif 4271#endif
4105 } 4272 }
4106 4273
4107 if (board_config != ALC_MODEL_AUTO) 4274 if (board_config != ALC_MODEL_AUTO) {
4108 setup_preset(codec, &alc260_presets[board_config]); 4275 setup_preset(codec, &alc260_presets[board_config]);
4276 spec->vmaster_nid = 0x08;
4277 }
4109 4278
4110 if (!spec->no_analog && !spec->adc_nids) { 4279 if (!spec->no_analog && !spec->adc_nids) {
4111 alc_auto_fill_adc_caps(codec); 4280 alc_auto_fill_adc_caps(codec);
@@ -4125,8 +4294,6 @@ static int patch_alc260(struct hda_codec *codec)
4125 4294
4126 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); 4295 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
4127 4296
4128 spec->vmaster_nid = 0x08;
4129
4130 codec->patch_ops = alc_patch_ops; 4297 codec->patch_ops = alc_patch_ops;
4131 if (board_config == ALC_MODEL_AUTO) 4298 if (board_config == ALC_MODEL_AUTO)
4132 spec->init_hook = alc_auto_init_std; 4299 spec->init_hook = alc_auto_init_std;
@@ -4163,15 +4330,78 @@ static int patch_alc260(struct hda_codec *codec)
4163 * Pin config fixes 4330 * Pin config fixes
4164 */ 4331 */
4165enum { 4332enum {
4166 PINFIX_ABIT_AW9D_MAX, 4333 ALC882_FIXUP_ABIT_AW9D_MAX,
4167 PINFIX_LENOVO_Y530, 4334 ALC882_FIXUP_LENOVO_Y530,
4168 PINFIX_PB_M5210, 4335 ALC882_FIXUP_PB_M5210,
4169 PINFIX_ACER_ASPIRE_7736, 4336 ALC882_FIXUP_ACER_ASPIRE_7736,
4170 PINFIX_ASUS_W90V, 4337 ALC882_FIXUP_ASUS_W90V,
4338 ALC889_FIXUP_VAIO_TT,
4339 ALC888_FIXUP_EEE1601,
4340 ALC882_FIXUP_EAPD,
4341 ALC883_FIXUP_EAPD,
4342 ALC883_FIXUP_ACER_EAPD,
4343 ALC882_FIXUP_GPIO3,
4344 ALC889_FIXUP_COEF,
4345 ALC882_FIXUP_ASUS_W2JC,
4346 ALC882_FIXUP_ACER_ASPIRE_4930G,
4347 ALC882_FIXUP_ACER_ASPIRE_8930G,
4348 ALC882_FIXUP_ASPIRE_8930G_VERBS,
4349 ALC885_FIXUP_MACPRO_GPIO,
4171}; 4350};
4172 4351
4352static void alc889_fixup_coef(struct hda_codec *codec,
4353 const struct alc_fixup *fix, int action)
4354{
4355 if (action != ALC_FIXUP_ACT_INIT)
4356 return;
4357 alc889_coef_init(codec);
4358}
4359
4360/* toggle speaker-output according to the hp-jack state */
4361static void alc882_gpio_mute(struct hda_codec *codec, int pin, int muted)
4362{
4363 unsigned int gpiostate, gpiomask, gpiodir;
4364
4365 gpiostate = snd_hda_codec_read(codec, codec->afg, 0,
4366 AC_VERB_GET_GPIO_DATA, 0);
4367
4368 if (!muted)
4369 gpiostate |= (1 << pin);
4370 else
4371 gpiostate &= ~(1 << pin);
4372
4373 gpiomask = snd_hda_codec_read(codec, codec->afg, 0,
4374 AC_VERB_GET_GPIO_MASK, 0);
4375 gpiomask |= (1 << pin);
4376
4377 gpiodir = snd_hda_codec_read(codec, codec->afg, 0,
4378 AC_VERB_GET_GPIO_DIRECTION, 0);
4379 gpiodir |= (1 << pin);
4380
4381
4382 snd_hda_codec_write(codec, codec->afg, 0,
4383 AC_VERB_SET_GPIO_MASK, gpiomask);
4384 snd_hda_codec_write(codec, codec->afg, 0,
4385 AC_VERB_SET_GPIO_DIRECTION, gpiodir);
4386
4387 msleep(1);
4388
4389 snd_hda_codec_write(codec, codec->afg, 0,
4390 AC_VERB_SET_GPIO_DATA, gpiostate);
4391}
4392
4393/* set up GPIO at initialization */
4394static void alc885_fixup_macpro_gpio(struct hda_codec *codec,
4395 const struct alc_fixup *fix, int action)
4396{
4397 if (action != ALC_FIXUP_ACT_INIT)
4398 return;
4399 alc882_gpio_mute(codec, 0, 0);
4400 alc882_gpio_mute(codec, 1, 0);
4401}
4402
4173static const struct alc_fixup alc882_fixups[] = { 4403static const struct alc_fixup alc882_fixups[] = {
4174 [PINFIX_ABIT_AW9D_MAX] = { 4404 [ALC882_FIXUP_ABIT_AW9D_MAX] = {
4175 .type = ALC_FIXUP_PINS, 4405 .type = ALC_FIXUP_PINS,
4176 .v.pins = (const struct alc_pincfg[]) { 4406 .v.pins = (const struct alc_pincfg[]) {
4177 { 0x15, 0x01080104 }, /* side */ 4407 { 0x15, 0x01080104 }, /* side */
@@ -4180,7 +4410,7 @@ static const struct alc_fixup alc882_fixups[] = {
4180 { } 4410 { }
4181 } 4411 }
4182 }, 4412 },
4183 [PINFIX_LENOVO_Y530] = { 4413 [ALC882_FIXUP_LENOVO_Y530] = {
4184 .type = ALC_FIXUP_PINS, 4414 .type = ALC_FIXUP_PINS,
4185 .v.pins = (const struct alc_pincfg[]) { 4415 .v.pins = (const struct alc_pincfg[]) {
4186 { 0x15, 0x99130112 }, /* rear int speakers */ 4416 { 0x15, 0x99130112 }, /* rear int speakers */
@@ -4188,32 +4418,180 @@ static const struct alc_fixup alc882_fixups[] = {
4188 { } 4418 { }
4189 } 4419 }
4190 }, 4420 },
4191 [PINFIX_PB_M5210] = { 4421 [ALC882_FIXUP_PB_M5210] = {
4192 .type = ALC_FIXUP_VERBS, 4422 .type = ALC_FIXUP_VERBS,
4193 .v.verbs = (const struct hda_verb[]) { 4423 .v.verbs = (const struct hda_verb[]) {
4194 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 }, 4424 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 },
4195 {} 4425 {}
4196 } 4426 }
4197 }, 4427 },
4198 [PINFIX_ACER_ASPIRE_7736] = { 4428 [ALC882_FIXUP_ACER_ASPIRE_7736] = {
4199 .type = ALC_FIXUP_SKU, 4429 .type = ALC_FIXUP_SKU,
4200 .v.sku = ALC_FIXUP_SKU_IGNORE, 4430 .v.sku = ALC_FIXUP_SKU_IGNORE,
4201 }, 4431 },
4202 [PINFIX_ASUS_W90V] = { 4432 [ALC882_FIXUP_ASUS_W90V] = {
4203 .type = ALC_FIXUP_PINS, 4433 .type = ALC_FIXUP_PINS,
4204 .v.pins = (const struct alc_pincfg[]) { 4434 .v.pins = (const struct alc_pincfg[]) {
4205 { 0x16, 0x99130110 }, /* fix sequence for CLFE */ 4435 { 0x16, 0x99130110 }, /* fix sequence for CLFE */
4206 { } 4436 { }
4207 } 4437 }
4208 }, 4438 },
4439 [ALC889_FIXUP_VAIO_TT] = {
4440 .type = ALC_FIXUP_PINS,
4441 .v.pins = (const struct alc_pincfg[]) {
4442 { 0x17, 0x90170111 }, /* hidden surround speaker */
4443 { }
4444 }
4445 },
4446 [ALC888_FIXUP_EEE1601] = {
4447 .type = ALC_FIXUP_VERBS,
4448 .v.verbs = (const struct hda_verb[]) {
4449 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
4450 { 0x20, AC_VERB_SET_PROC_COEF, 0x0838 },
4451 { }
4452 }
4453 },
4454 [ALC882_FIXUP_EAPD] = {
4455 .type = ALC_FIXUP_VERBS,
4456 .v.verbs = (const struct hda_verb[]) {
4457 /* change to EAPD mode */
4458 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
4459 { 0x20, AC_VERB_SET_PROC_COEF, 0x3060 },
4460 { }
4461 }
4462 },
4463 [ALC883_FIXUP_EAPD] = {
4464 .type = ALC_FIXUP_VERBS,
4465 .v.verbs = (const struct hda_verb[]) {
4466 /* change to EAPD mode */
4467 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
4468 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
4469 { }
4470 }
4471 },
4472 [ALC883_FIXUP_ACER_EAPD] = {
4473 .type = ALC_FIXUP_VERBS,
4474 .v.verbs = (const struct hda_verb[]) {
4475 /* eanable EAPD on Acer laptops */
4476 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
4477 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
4478 { }
4479 }
4480 },
4481 [ALC882_FIXUP_GPIO3] = {
4482 .type = ALC_FIXUP_VERBS,
4483 .v.verbs = alc_gpio3_init_verbs,
4484 },
4485 [ALC882_FIXUP_ASUS_W2JC] = {
4486 .type = ALC_FIXUP_VERBS,
4487 .v.verbs = alc_gpio1_init_verbs,
4488 .chained = true,
4489 .chain_id = ALC882_FIXUP_EAPD,
4490 },
4491 [ALC889_FIXUP_COEF] = {
4492 .type = ALC_FIXUP_FUNC,
4493 .v.func = alc889_fixup_coef,
4494 },
4495 [ALC882_FIXUP_ACER_ASPIRE_4930G] = {
4496 .type = ALC_FIXUP_PINS,
4497 .v.pins = (const struct alc_pincfg[]) {
4498 { 0x16, 0x99130111 }, /* CLFE speaker */
4499 { 0x17, 0x99130112 }, /* surround speaker */
4500 { }
4501 }
4502 },
4503 [ALC882_FIXUP_ACER_ASPIRE_8930G] = {
4504 .type = ALC_FIXUP_PINS,
4505 .v.pins = (const struct alc_pincfg[]) {
4506 { 0x16, 0x99130111 }, /* CLFE speaker */
4507 { 0x1b, 0x99130112 }, /* surround speaker */
4508 { }
4509 },
4510 .chained = true,
4511 .chain_id = ALC882_FIXUP_ASPIRE_8930G_VERBS,
4512 },
4513 [ALC882_FIXUP_ASPIRE_8930G_VERBS] = {
4514 /* additional init verbs for Acer Aspire 8930G */
4515 .type = ALC_FIXUP_VERBS,
4516 .v.verbs = (const struct hda_verb[]) {
4517 /* Enable all DACs */
4518 /* DAC DISABLE/MUTE 1? */
4519 /* setting bits 1-5 disables DAC nids 0x02-0x06
4520 * apparently. Init=0x38 */
4521 { 0x20, AC_VERB_SET_COEF_INDEX, 0x03 },
4522 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
4523 /* DAC DISABLE/MUTE 2? */
4524 /* some bit here disables the other DACs.
4525 * Init=0x4900 */
4526 { 0x20, AC_VERB_SET_COEF_INDEX, 0x08 },
4527 { 0x20, AC_VERB_SET_PROC_COEF, 0x0000 },
4528 /* DMIC fix
4529 * This laptop has a stereo digital microphone.
4530 * The mics are only 1cm apart which makes the stereo
4531 * useless. However, either the mic or the ALC889
4532 * makes the signal become a difference/sum signal
4533 * instead of standard stereo, which is annoying.
4534 * So instead we flip this bit which makes the
4535 * codec replicate the sum signal to both channels,
4536 * turning it into a normal mono mic.
4537 */
4538 /* DMIC_CONTROL? Init value = 0x0001 */
4539 { 0x20, AC_VERB_SET_COEF_INDEX, 0x0b },
4540 { 0x20, AC_VERB_SET_PROC_COEF, 0x0003 },
4541 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
4542 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
4543 { }
4544 }
4545 },
4546 [ALC885_FIXUP_MACPRO_GPIO] = {
4547 .type = ALC_FIXUP_FUNC,
4548 .v.func = alc885_fixup_macpro_gpio,
4549 },
4209}; 4550};
4210 4551
4211static const struct snd_pci_quirk alc882_fixup_tbl[] = { 4552static const struct snd_pci_quirk alc882_fixup_tbl[] = {
4212 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", PINFIX_PB_M5210), 4553 SND_PCI_QUIRK(0x1025, 0x006c, "Acer Aspire 9810", ALC883_FIXUP_ACER_EAPD),
4213 SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", PINFIX_ASUS_W90V), 4554 SND_PCI_QUIRK(0x1025, 0x0090, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
4214 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", PINFIX_LENOVO_Y530), 4555 SND_PCI_QUIRK(0x1025, 0x010a, "Acer Ferrari 5000", ALC883_FIXUP_ACER_EAPD),
4215 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", PINFIX_ABIT_AW9D_MAX), 4556 SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_FIXUP_ACER_EAPD),
4216 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", PINFIX_ACER_ASPIRE_7736), 4557 SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_FIXUP_ACER_EAPD),
4558 SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_FIXUP_ACER_EAPD),
4559 SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
4560 ALC882_FIXUP_ACER_ASPIRE_4930G),
4561 SND_PCI_QUIRK(0x1025, 0x013f, "Acer Aspire 5930G",
4562 ALC882_FIXUP_ACER_ASPIRE_4930G),
4563 SND_PCI_QUIRK(0x1025, 0x0145, "Acer Aspire 8930G",
4564 ALC882_FIXUP_ACER_ASPIRE_8930G),
4565 SND_PCI_QUIRK(0x1025, 0x0146, "Acer Aspire 6935G",
4566 ALC882_FIXUP_ACER_ASPIRE_8930G),
4567 SND_PCI_QUIRK(0x1025, 0x015e, "Acer Aspire 6930G",
4568 ALC882_FIXUP_ACER_ASPIRE_4930G),
4569 SND_PCI_QUIRK(0x1025, 0x0166, "Acer Aspire 6530G",
4570 ALC882_FIXUP_ACER_ASPIRE_4930G),
4571 SND_PCI_QUIRK(0x1025, 0x0142, "Acer Aspire 7730G",
4572 ALC882_FIXUP_ACER_ASPIRE_4930G),
4573 SND_PCI_QUIRK(0x1025, 0x0155, "Packard-Bell M5120", ALC882_FIXUP_PB_M5210),
4574 SND_PCI_QUIRK(0x1025, 0x0296, "Acer Aspire 7736z", ALC882_FIXUP_ACER_ASPIRE_7736),
4575 SND_PCI_QUIRK(0x1043, 0x13c2, "Asus A7M", ALC882_FIXUP_EAPD),
4576 SND_PCI_QUIRK(0x1043, 0x1873, "ASUS W90V", ALC882_FIXUP_ASUS_W90V),
4577 SND_PCI_QUIRK(0x1043, 0x1971, "Asus W2JC", ALC882_FIXUP_ASUS_W2JC),
4578 SND_PCI_QUIRK(0x1043, 0x835f, "Asus Eee 1601", ALC888_FIXUP_EEE1601),
4579 SND_PCI_QUIRK(0x104d, 0x9047, "Sony Vaio TT", ALC889_FIXUP_VAIO_TT),
4580
4581 /* All Apple entries are in codec SSIDs */
4582 SND_PCI_QUIRK(0x106b, 0x0c00, "Mac Pro", ALC885_FIXUP_MACPRO_GPIO),
4583 SND_PCI_QUIRK(0x106b, 0x1000, "iMac 24", ALC885_FIXUP_MACPRO_GPIO),
4584 SND_PCI_QUIRK(0x106b, 0x2800, "AppleTV", ALC885_FIXUP_MACPRO_GPIO),
4585 SND_PCI_QUIRK(0x106b, 0x3200, "iMac 7,1 Aluminum", ALC882_FIXUP_EAPD),
4586 SND_PCI_QUIRK(0x106b, 0x3e00, "iMac 24 Aluminum", ALC885_FIXUP_MACPRO_GPIO),
4587
4588 SND_PCI_QUIRK(0x1071, 0x8258, "Evesham Voyaeger", ALC882_FIXUP_EAPD),
4589 SND_PCI_QUIRK_VENDOR(0x1462, "MSI", ALC882_FIXUP_GPIO3),
4590 SND_PCI_QUIRK(0x147b, 0x107a, "Abit AW9D-MAX", ALC882_FIXUP_ABIT_AW9D_MAX),
4591 SND_PCI_QUIRK_VENDOR(0x1558, "Clevo laptop", ALC882_FIXUP_EAPD),
4592 SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_FIXUP_EAPD),
4593 SND_PCI_QUIRK(0x17aa, 0x3a0d, "Lenovo Y530", ALC882_FIXUP_LENOVO_Y530),
4594 SND_PCI_QUIRK(0x8086, 0x0022, "DX58SO", ALC889_FIXUP_COEF),
4217 {} 4595 {}
4218}; 4596};
4219 4597
@@ -4262,8 +4640,7 @@ static int patch_alc882(struct hda_codec *codec)
4262 goto error; 4640 goto error;
4263 4641
4264 board_config = alc_board_config(codec, ALC882_MODEL_LAST, 4642 board_config = alc_board_config(codec, ALC882_MODEL_LAST,
4265 alc882_models, alc882_cfg_tbl); 4643 alc882_models, NULL);
4266
4267 if (board_config < 0) 4644 if (board_config < 0)
4268 board_config = alc_board_codec_sid_config(codec, 4645 board_config = alc_board_codec_sid_config(codec,
4269 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl); 4646 ALC882_MODEL_LAST, alc882_models, alc882_ssid_cfg_tbl);
@@ -4286,18 +4663,12 @@ static int patch_alc882(struct hda_codec *codec)
4286 err = alc882_parse_auto_config(codec); 4663 err = alc882_parse_auto_config(codec);
4287 if (err < 0) 4664 if (err < 0)
4288 goto error; 4665 goto error;
4289#ifdef CONFIG_SND_HDA_ENABLE_REALTEK_QUIRKS
4290 else if (!err) {
4291 printk(KERN_INFO
4292 "hda_codec: Cannot set up configuration "
4293 "from BIOS. Using base mode...\n");
4294 board_config = ALC882_3ST_DIG;
4295 }
4296#endif
4297 } 4666 }
4298 4667
4299 if (board_config != ALC_MODEL_AUTO) 4668 if (board_config != ALC_MODEL_AUTO) {
4300 setup_preset(codec, &alc882_presets[board_config]); 4669 setup_preset(codec, &alc882_presets[board_config]);
4670 spec->vmaster_nid = 0x0c;
4671 }
4301 4672
4302 if (!spec->no_analog && !spec->adc_nids) { 4673 if (!spec->no_analog && !spec->adc_nids) {
4303 alc_auto_fill_adc_caps(codec); 4674 alc_auto_fill_adc_caps(codec);
@@ -4317,13 +4688,10 @@ static int patch_alc882(struct hda_codec *codec)
4317 4688
4318 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); 4689 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
4319 4690
4320 spec->vmaster_nid = 0x0c;
4321
4322 codec->patch_ops = alc_patch_ops; 4691 codec->patch_ops = alc_patch_ops;
4323 if (board_config == ALC_MODEL_AUTO) 4692 if (board_config == ALC_MODEL_AUTO)
4324 spec->init_hook = alc_auto_init_std; 4693 spec->init_hook = alc_auto_init_std;
4325 4694
4326 alc_init_jacks(codec);
4327#ifdef CONFIG_SND_HDA_POWER_SAVE 4695#ifdef CONFIG_SND_HDA_POWER_SAVE
4328 if (!spec->loopback.amplist) 4696 if (!spec->loopback.amplist)
4329 spec->loopback.amplist = alc882_loopbacks; 4697 spec->loopback.amplist = alc882_loopbacks;
@@ -4351,12 +4719,17 @@ static int alc262_parse_auto_config(struct hda_codec *codec)
4351 * Pin config fixes 4719 * Pin config fixes
4352 */ 4720 */
4353enum { 4721enum {
4354 PINFIX_FSC_H270, 4722 ALC262_FIXUP_FSC_H270,
4355 PINFIX_HP_Z200, 4723 ALC262_FIXUP_HP_Z200,
4724 ALC262_FIXUP_TYAN,
4725 ALC262_FIXUP_TOSHIBA_RX1,
4726 ALC262_FIXUP_LENOVO_3000,
4727 ALC262_FIXUP_BENQ,
4728 ALC262_FIXUP_BENQ_T31,
4356}; 4729};
4357 4730
4358static const struct alc_fixup alc262_fixups[] = { 4731static const struct alc_fixup alc262_fixups[] = {
4359 [PINFIX_FSC_H270] = { 4732 [ALC262_FIXUP_FSC_H270] = {
4360 .type = ALC_FIXUP_PINS, 4733 .type = ALC_FIXUP_PINS,
4361 .v.pins = (const struct alc_pincfg[]) { 4734 .v.pins = (const struct alc_pincfg[]) {
4362 { 0x14, 0x99130110 }, /* speaker */ 4735 { 0x14, 0x99130110 }, /* speaker */
@@ -4365,18 +4738,68 @@ static const struct alc_fixup alc262_fixups[] = {
4365 { } 4738 { }
4366 } 4739 }
4367 }, 4740 },
4368 [PINFIX_HP_Z200] = { 4741 [ALC262_FIXUP_HP_Z200] = {
4369 .type = ALC_FIXUP_PINS, 4742 .type = ALC_FIXUP_PINS,
4370 .v.pins = (const struct alc_pincfg[]) { 4743 .v.pins = (const struct alc_pincfg[]) {
4371 { 0x16, 0x99130120 }, /* internal speaker */ 4744 { 0x16, 0x99130120 }, /* internal speaker */
4372 { } 4745 { }
4373 } 4746 }
4374 }, 4747 },
4748 [ALC262_FIXUP_TYAN] = {
4749 .type = ALC_FIXUP_PINS,
4750 .v.pins = (const struct alc_pincfg[]) {
4751 { 0x14, 0x1993e1f0 }, /* int AUX */
4752 { }
4753 }
4754 },
4755 [ALC262_FIXUP_TOSHIBA_RX1] = {
4756 .type = ALC_FIXUP_PINS,
4757 .v.pins = (const struct alc_pincfg[]) {
4758 { 0x14, 0x90170110 }, /* speaker */
4759 { 0x15, 0x0421101f }, /* HP */
4760 { 0x1a, 0x40f000f0 }, /* N/A */
4761 { 0x1b, 0x40f000f0 }, /* N/A */
4762 { 0x1e, 0x40f000f0 }, /* N/A */
4763 }
4764 },
4765 [ALC262_FIXUP_LENOVO_3000] = {
4766 .type = ALC_FIXUP_VERBS,
4767 .v.verbs = (const struct hda_verb[]) {
4768 { 0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF50 },
4769 {}
4770 },
4771 .chained = true,
4772 .chain_id = ALC262_FIXUP_BENQ,
4773 },
4774 [ALC262_FIXUP_BENQ] = {
4775 .type = ALC_FIXUP_VERBS,
4776 .v.verbs = (const struct hda_verb[]) {
4777 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
4778 { 0x20, AC_VERB_SET_PROC_COEF, 0x3070 },
4779 {}
4780 }
4781 },
4782 [ALC262_FIXUP_BENQ_T31] = {
4783 .type = ALC_FIXUP_VERBS,
4784 .v.verbs = (const struct hda_verb[]) {
4785 { 0x20, AC_VERB_SET_COEF_INDEX, 0x07 },
4786 { 0x20, AC_VERB_SET_PROC_COEF, 0x3050 },
4787 {}
4788 }
4789 },
4375}; 4790};
4376 4791
4377static const struct snd_pci_quirk alc262_fixup_tbl[] = { 4792static const struct snd_pci_quirk alc262_fixup_tbl[] = {
4378 SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", PINFIX_HP_Z200), 4793 SND_PCI_QUIRK(0x103c, 0x170b, "HP Z200", ALC262_FIXUP_HP_Z200),
4379 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", PINFIX_FSC_H270), 4794 SND_PCI_QUIRK(0x10cf, 0x1397, "Fujitsu", ALC262_FIXUP_BENQ),
4795 SND_PCI_QUIRK(0x10cf, 0x142d, "Fujitsu Lifebook E8410", ALC262_FIXUP_BENQ),
4796 SND_PCI_QUIRK(0x10f1, 0x2915, "Tyan Thunder n6650W", ALC262_FIXUP_TYAN),
4797 SND_PCI_QUIRK(0x1179, 0x0001, "Toshiba dynabook SS RX1",
4798 ALC262_FIXUP_TOSHIBA_RX1),
4799 SND_PCI_QUIRK(0x1734, 0x1147, "FSC Celsius H270", ALC262_FIXUP_FSC_H270),
4800 SND_PCI_QUIRK(0x17aa, 0x384e, "Lenovo 3000", ALC262_FIXUP_LENOVO_3000),
4801 SND_PCI_QUIRK(0x17ff, 0x0560, "Benq ED8", ALC262_FIXUP_BENQ),
4802 SND_PCI_QUIRK(0x17ff, 0x058d, "Benq T31-16", ALC262_FIXUP_BENQ_T31),
4380 {} 4803 {}
4381}; 4804};
4382 4805
@@ -4387,14 +4810,9 @@ static const struct snd_pci_quirk alc262_fixup_tbl[] = {
4387 4810
4388/* 4811/*
4389 */ 4812 */
4390#ifdef CONFIG_SND_HDA_ENABLE_REALTEK_QUIRKS
4391#include "alc262_quirks.c"
4392#endif
4393
4394static int patch_alc262(struct hda_codec *codec) 4813static int patch_alc262(struct hda_codec *codec)
4395{ 4814{
4396 struct alc_spec *spec; 4815 struct alc_spec *spec;
4397 int board_config;
4398 int err; 4816 int err;
4399 4817
4400 spec = kzalloc(sizeof(*spec), GFP_KERNEL); 4818 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
@@ -4421,37 +4839,13 @@ static int patch_alc262(struct hda_codec *codec)
4421 4839
4422 alc_fix_pll_init(codec, 0x20, 0x0a, 10); 4840 alc_fix_pll_init(codec, 0x20, 0x0a, 10);
4423 4841
4424 board_config = alc_board_config(codec, ALC262_MODEL_LAST, 4842 alc_pick_fixup(codec, NULL, alc262_fixup_tbl, alc262_fixups);
4425 alc262_models, alc262_cfg_tbl); 4843 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
4426
4427 if (board_config < 0) {
4428 printk(KERN_INFO "hda_codec: %s: BIOS auto-probing.\n",
4429 codec->chip_name);
4430 board_config = ALC_MODEL_AUTO;
4431 }
4432
4433 if (board_config == ALC_MODEL_AUTO) {
4434 alc_pick_fixup(codec, NULL, alc262_fixup_tbl, alc262_fixups);
4435 alc_apply_fixup(codec, ALC_FIXUP_ACT_PRE_PROBE);
4436 }
4437
4438 if (board_config == ALC_MODEL_AUTO) {
4439 /* automatic parse from the BIOS config */
4440 err = alc262_parse_auto_config(codec);
4441 if (err < 0)
4442 goto error;
4443#ifdef CONFIG_SND_HDA_ENABLE_REALTEK_QUIRKS
4444 else if (!err) {
4445 printk(KERN_INFO
4446 "hda_codec: Cannot set up configuration "
4447 "from BIOS. Using base mode...\n");
4448 board_config = ALC262_BASIC;
4449 }
4450#endif
4451 }
4452 4844
4453 if (board_config != ALC_MODEL_AUTO) 4845 /* automatic parse from the BIOS config */
4454 setup_preset(codec, &alc262_presets[board_config]); 4846 err = alc262_parse_auto_config(codec);
4847 if (err < 0)
4848 goto error;
4455 4849
4456 if (!spec->no_analog && !spec->adc_nids) { 4850 if (!spec->no_analog && !spec->adc_nids) {
4457 alc_auto_fill_adc_caps(codec); 4851 alc_auto_fill_adc_caps(codec);
@@ -4471,14 +4865,10 @@ static int patch_alc262(struct hda_codec *codec)
4471 4865
4472 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); 4866 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
4473 4867
4474 spec->vmaster_nid = 0x0c;
4475
4476 codec->patch_ops = alc_patch_ops; 4868 codec->patch_ops = alc_patch_ops;
4477 if (board_config == ALC_MODEL_AUTO) 4869 spec->init_hook = alc_auto_init_std;
4478 spec->init_hook = alc_auto_init_std;
4479 spec->shutup = alc_eapd_shutup; 4870 spec->shutup = alc_eapd_shutup;
4480 4871
4481 alc_init_jacks(codec);
4482#ifdef CONFIG_SND_HDA_POWER_SAVE 4872#ifdef CONFIG_SND_HDA_POWER_SAVE
4483 if (!spec->loopback.amplist) 4873 if (!spec->loopback.amplist)
4484 spec->loopback.amplist = alc262_loopbacks; 4874 spec->loopback.amplist = alc262_loopbacks;
@@ -4585,14 +4975,10 @@ static int patch_alc268(struct hda_codec *codec)
4585 if (!spec->no_analog && !spec->cap_mixer) 4975 if (!spec->no_analog && !spec->cap_mixer)
4586 set_capture_mixer(codec); 4976 set_capture_mixer(codec);
4587 4977
4588 spec->vmaster_nid = 0x02;
4589
4590 codec->patch_ops = alc_patch_ops; 4978 codec->patch_ops = alc_patch_ops;
4591 spec->init_hook = alc_auto_init_std; 4979 spec->init_hook = alc_auto_init_std;
4592 spec->shutup = alc_eapd_shutup; 4980 spec->shutup = alc_eapd_shutup;
4593 4981
4594 alc_init_jacks(codec);
4595
4596 return 0; 4982 return 0;
4597 4983
4598 error: 4984 error:
@@ -4934,7 +5320,7 @@ static const struct alc_fixup alc269_fixups[] = {
4934 { } 5320 { }
4935 }, 5321 },
4936 }, 5322 },
4937 [ALC269_FIXUP_DMIC] = { 5323 [ALC269VB_FIXUP_DMIC] = {
4938 .type = ALC_FIXUP_PINS, 5324 .type = ALC_FIXUP_PINS,
4939 .v.pins = (const struct alc_pincfg[]) { 5325 .v.pins = (const struct alc_pincfg[]) {
4940 { 0x12, 0x99a3092f }, /* int-mic */ 5326 { 0x12, 0x99a3092f }, /* int-mic */
@@ -5141,8 +5527,6 @@ static int patch_alc269(struct hda_codec *codec)
5141 5527
5142 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); 5528 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
5143 5529
5144 spec->vmaster_nid = 0x02;
5145
5146 codec->patch_ops = alc_patch_ops; 5530 codec->patch_ops = alc_patch_ops;
5147#ifdef CONFIG_PM 5531#ifdef CONFIG_PM
5148 codec->patch_ops.resume = alc269_resume; 5532 codec->patch_ops.resume = alc269_resume;
@@ -5150,7 +5534,6 @@ static int patch_alc269(struct hda_codec *codec)
5150 spec->init_hook = alc_auto_init_std; 5534 spec->init_hook = alc_auto_init_std;
5151 spec->shutup = alc269_shutup; 5535 spec->shutup = alc269_shutup;
5152 5536
5153 alc_init_jacks(codec);
5154#ifdef CONFIG_SND_HDA_POWER_SAVE 5537#ifdef CONFIG_SND_HDA_POWER_SAVE
5155 if (!spec->loopback.amplist) 5538 if (!spec->loopback.amplist)
5156 spec->loopback.amplist = alc269_loopbacks; 5539 spec->loopback.amplist = alc269_loopbacks;
@@ -5247,8 +5630,6 @@ static int patch_alc861(struct hda_codec *codec)
5247 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT); 5630 set_beep_amp(spec, 0x23, 0, HDA_OUTPUT);
5248 } 5631 }
5249 5632
5250 spec->vmaster_nid = 0x03;
5251
5252 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); 5633 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
5253 5634
5254 codec->patch_ops = alc_patch_ops; 5635 codec->patch_ops = alc_patch_ops;
@@ -5373,8 +5754,6 @@ static int patch_alc861vd(struct hda_codec *codec)
5373 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT); 5754 set_beep_amp(spec, 0x0b, 0x05, HDA_INPUT);
5374 } 5755 }
5375 5756
5376 spec->vmaster_nid = 0x02;
5377
5378 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); 5757 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
5379 5758
5380 codec->patch_ops = alc_patch_ops; 5759 codec->patch_ops = alc_patch_ops;
@@ -5757,7 +6136,6 @@ static int patch_alc662(struct hda_codec *codec)
5757 break; 6136 break;
5758 } 6137 }
5759 } 6138 }
5760 spec->vmaster_nid = 0x02;
5761 6139
5762 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE); 6140 alc_apply_fixup(codec, ALC_FIXUP_ACT_PROBE);
5763 6141
@@ -5765,8 +6143,6 @@ static int patch_alc662(struct hda_codec *codec)
5765 spec->init_hook = alc_auto_init_std; 6143 spec->init_hook = alc_auto_init_std;
5766 spec->shutup = alc_eapd_shutup; 6144 spec->shutup = alc_eapd_shutup;
5767 6145
5768 alc_init_jacks(codec);
5769
5770#ifdef CONFIG_SND_HDA_POWER_SAVE 6146#ifdef CONFIG_SND_HDA_POWER_SAVE
5771 if (!spec->loopback.amplist) 6147 if (!spec->loopback.amplist)
5772 spec->loopback.amplist = alc662_loopbacks; 6148 spec->loopback.amplist = alc662_loopbacks;
@@ -5813,8 +6189,6 @@ static int patch_alc680(struct hda_codec *codec)
5813 if (!spec->no_analog && !spec->cap_mixer) 6189 if (!spec->no_analog && !spec->cap_mixer)
5814 set_capture_mixer(codec); 6190 set_capture_mixer(codec);
5815 6191
5816 spec->vmaster_nid = 0x02;
5817
5818 codec->patch_ops = alc_patch_ops; 6192 codec->patch_ops = alc_patch_ops;
5819 spec->init_hook = alc_auto_init_std; 6193 spec->init_hook = alc_auto_init_std;
5820 6194
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index f3658658548..3556408d6ec 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -37,6 +37,7 @@
37#include "hda_codec.h" 37#include "hda_codec.h"
38#include "hda_local.h" 38#include "hda_local.h"
39#include "hda_beep.h" 39#include "hda_beep.h"
40#include "hda_jack.h"
40 41
41enum { 42enum {
42 STAC_VREF_EVENT = 1, 43 STAC_VREF_EVENT = 1,
@@ -96,7 +97,6 @@ enum {
96 STAC_92HD83XXX_PWR_REF, 97 STAC_92HD83XXX_PWR_REF,
97 STAC_DELL_S14, 98 STAC_DELL_S14,
98 STAC_DELL_VOSTRO_3500, 99 STAC_DELL_VOSTRO_3500,
99 STAC_92HD83XXX_HP,
100 STAC_92HD83XXX_HP_cNB11_INTQUAD, 100 STAC_92HD83XXX_HP_cNB11_INTQUAD,
101 STAC_HP_DV7_4000, 101 STAC_HP_DV7_4000,
102 STAC_92HD83XXX_MODELS 102 STAC_92HD83XXX_MODELS
@@ -176,13 +176,6 @@ enum {
176 STAC_9872_MODELS 176 STAC_9872_MODELS
177}; 177};
178 178
179struct sigmatel_event {
180 hda_nid_t nid;
181 unsigned char type;
182 unsigned char tag;
183 int data;
184};
185
186struct sigmatel_mic_route { 179struct sigmatel_mic_route {
187 hda_nid_t pin; 180 hda_nid_t pin;
188 signed char mux_idx; 181 signed char mux_idx;
@@ -215,6 +208,7 @@ struct sigmatel_spec {
215 unsigned int gpio_mute; 208 unsigned int gpio_mute;
216 unsigned int gpio_led; 209 unsigned int gpio_led;
217 unsigned int gpio_led_polarity; 210 unsigned int gpio_led_polarity;
211 unsigned int vref_mute_led_nid; /* pin NID for mute-LED vref control */
218 unsigned int vref_led; 212 unsigned int vref_led;
219 213
220 /* stream */ 214 /* stream */
@@ -230,9 +224,6 @@ struct sigmatel_spec {
230 const hda_nid_t *pwr_nids; 224 const hda_nid_t *pwr_nids;
231 const hda_nid_t *dac_list; 225 const hda_nid_t *dac_list;
232 226
233 /* events */
234 struct snd_array events;
235
236 /* playback */ 227 /* playback */
237 struct hda_input_mux *mono_mux; 228 struct hda_input_mux *mono_mux;
238 unsigned int cur_mmux; 229 unsigned int cur_mmux;
@@ -1093,13 +1084,10 @@ static const char * const slave_sws[] = {
1093}; 1084};
1094 1085
1095static void stac92xx_free_kctls(struct hda_codec *codec); 1086static void stac92xx_free_kctls(struct hda_codec *codec);
1096static int stac92xx_add_jack(struct hda_codec *codec, hda_nid_t nid, int type);
1097 1087
1098static int stac92xx_build_controls(struct hda_codec *codec) 1088static int stac92xx_build_controls(struct hda_codec *codec)
1099{ 1089{
1100 struct sigmatel_spec *spec = codec->spec; 1090 struct sigmatel_spec *spec = codec->spec;
1101 struct auto_pin_cfg *cfg = &spec->autocfg;
1102 hda_nid_t nid;
1103 int err; 1091 int err;
1104 int i; 1092 int i;
1105 1093
@@ -1185,31 +1173,9 @@ static int stac92xx_build_controls(struct hda_codec *codec)
1185 1173
1186 stac92xx_free_kctls(codec); /* no longer needed */ 1174 stac92xx_free_kctls(codec); /* no longer needed */
1187 1175
1188 /* create jack input elements */ 1176 err = snd_hda_jack_add_kctls(codec, &spec->autocfg);
1189 if (spec->hp_detect) { 1177 if (err < 0)
1190 for (i = 0; i < cfg->hp_outs; i++) { 1178 return err;
1191 int type = SND_JACK_HEADPHONE;
1192 nid = cfg->hp_pins[i];
1193 /* jack detection */
1194 if (cfg->hp_outs == i)
1195 type |= SND_JACK_LINEOUT;
1196 err = stac92xx_add_jack(codec, nid, type);
1197 if (err < 0)
1198 return err;
1199 }
1200 }
1201 for (i = 0; i < cfg->line_outs; i++) {
1202 err = stac92xx_add_jack(codec, cfg->line_out_pins[i],
1203 SND_JACK_LINEOUT);
1204 if (err < 0)
1205 return err;
1206 }
1207 for (i = 0; i < cfg->num_inputs; i++) {
1208 nid = cfg->inputs[i].pin;
1209 err = stac92xx_add_jack(codec, nid, SND_JACK_MICROPHONE);
1210 if (err < 0)
1211 return err;
1212 }
1213 1179
1214 return 0; 1180 return 0;
1215} 1181}
@@ -1630,7 +1596,7 @@ static const struct snd_pci_quirk stac92hd73xx_cfg_tbl[] = {
1630 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02bd, 1596 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02bd,
1631 "Dell Studio 1557", STAC_DELL_M6_DMIC), 1597 "Dell Studio 1557", STAC_DELL_M6_DMIC),
1632 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02fe, 1598 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x02fe,
1633 "Dell Studio XPS 1645", STAC_DELL_M6_BOTH), 1599 "Dell Studio XPS 1645", STAC_DELL_M6_DMIC),
1634 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0413, 1600 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x0413,
1635 "Dell Studio 1558", STAC_DELL_M6_DMIC), 1601 "Dell Studio 1558", STAC_DELL_M6_DMIC),
1636 {} /* terminator */ 1602 {} /* terminator */
@@ -1691,7 +1657,6 @@ static const char * const stac92hd83xxx_models[STAC_92HD83XXX_MODELS] = {
1691 [STAC_92HD83XXX_PWR_REF] = "mic-ref", 1657 [STAC_92HD83XXX_PWR_REF] = "mic-ref",
1692 [STAC_DELL_S14] = "dell-s14", 1658 [STAC_DELL_S14] = "dell-s14",
1693 [STAC_DELL_VOSTRO_3500] = "dell-vostro-3500", 1659 [STAC_DELL_VOSTRO_3500] = "dell-vostro-3500",
1694 [STAC_92HD83XXX_HP] = "hp",
1695 [STAC_92HD83XXX_HP_cNB11_INTQUAD] = "hp_cNB11_intquad", 1660 [STAC_92HD83XXX_HP_cNB11_INTQUAD] = "hp_cNB11_intquad",
1696 [STAC_HP_DV7_4000] = "hp-dv7-4000", 1661 [STAC_HP_DV7_4000] = "hp-dv7-4000",
1697}; 1662};
@@ -1706,8 +1671,6 @@ static const struct snd_pci_quirk stac92hd83xxx_cfg_tbl[] = {
1706 "unknown Dell", STAC_DELL_S14), 1671 "unknown Dell", STAC_DELL_S14),
1707 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x1028, 1672 SND_PCI_QUIRK(PCI_VENDOR_ID_DELL, 0x1028,
1708 "Dell Vostro 3500", STAC_DELL_VOSTRO_3500), 1673 "Dell Vostro 3500", STAC_DELL_VOSTRO_3500),
1709 SND_PCI_QUIRK_MASK(PCI_VENDOR_ID_HP, 0xff00, 0x3600,
1710 "HP", STAC_92HD83XXX_HP),
1711 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1656, 1674 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1656,
1712 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD), 1675 "HP", STAC_92HD83XXX_HP_cNB11_INTQUAD),
1713 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1657, 1676 SND_PCI_QUIRK(PCI_VENDOR_ID_HP, 0x1657,
@@ -2874,7 +2837,8 @@ static inline int stac92xx_add_jack_mode_control(struct hda_codec *codec,
2874 } 2837 }
2875 2838
2876 if (control) { 2839 if (control) {
2877 strcpy(name, hda_get_input_pin_label(codec, nid, 1)); 2840 snd_hda_get_pin_label(codec, nid, &spec->autocfg,
2841 name, sizeof(name), NULL);
2878 return stac92xx_add_control(codec->spec, control, 2842 return stac92xx_add_control(codec->spec, control,
2879 strcat(name, " Jack Mode"), nid); 2843 strcat(name, " Jack Mode"), nid);
2880 } 2844 }
@@ -3552,7 +3516,7 @@ static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec *codec,
3552 for (i = 0; i < spec->num_dmics; i++) { 3516 for (i = 0; i < spec->num_dmics; i++) {
3553 hda_nid_t nid; 3517 hda_nid_t nid;
3554 int index, type_idx; 3518 int index, type_idx;
3555 const char *label; 3519 char label[32];
3556 3520
3557 nid = spec->dmic_nids[i]; 3521 nid = spec->dmic_nids[i];
3558 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN) 3522 if (get_wcaps_type(get_wcaps(codec, nid)) != AC_WID_PIN)
@@ -3565,7 +3529,8 @@ static int stac92xx_auto_create_dmic_input_ctls(struct hda_codec *codec,
3565 if (index < 0) 3529 if (index < 0)
3566 continue; 3530 continue;
3567 3531
3568 label = hda_get_input_pin_label(codec, nid, 1); 3532 snd_hda_get_pin_label(codec, nid, &spec->autocfg,
3533 label, sizeof(label), NULL);
3569 snd_hda_add_imux_item(dimux, label, index, &type_idx); 3534 snd_hda_add_imux_item(dimux, label, index, &type_idx);
3570 if (snd_hda_get_bool_hint(codec, "separate_dmux") != 1) 3535 if (snd_hda_get_bool_hint(codec, "separate_dmux") != 1)
3571 snd_hda_add_imux_item(imux, label, index, &type_idx); 3536 snd_hda_add_imux_item(imux, label, index, &type_idx);
@@ -4163,65 +4128,18 @@ static void stac_gpio_set(struct hda_codec *codec, unsigned int mask,
4163 AC_VERB_SET_GPIO_DATA, gpiostate); /* sync */ 4128 AC_VERB_SET_GPIO_DATA, gpiostate); /* sync */
4164} 4129}
4165 4130
4166static int stac92xx_add_jack(struct hda_codec *codec, 4131static int stac_add_event(struct hda_codec *codec, hda_nid_t nid,
4167 hda_nid_t nid, int type)
4168{
4169#ifdef CONFIG_SND_HDA_INPUT_JACK
4170 int def_conf = snd_hda_codec_get_pincfg(codec, nid);
4171 int connectivity = get_defcfg_connect(def_conf);
4172
4173 if (connectivity && connectivity != AC_JACK_PORT_FIXED)
4174 return 0;
4175
4176 return snd_hda_input_jack_add(codec, nid, type, NULL);
4177#else
4178 return 0;
4179#endif /* CONFIG_SND_HDA_INPUT_JACK */
4180}
4181
4182static int stac_add_event(struct sigmatel_spec *spec, hda_nid_t nid,
4183 unsigned char type, int data) 4132 unsigned char type, int data)
4184{ 4133{
4185 struct sigmatel_event *event; 4134 struct hda_jack_tbl *event;
4186 4135
4187 snd_array_init(&spec->events, sizeof(*event), 32); 4136 event = snd_hda_jack_tbl_new(codec, nid);
4188 event = snd_array_new(&spec->events);
4189 if (!event) 4137 if (!event)
4190 return -ENOMEM; 4138 return -ENOMEM;
4191 event->nid = nid; 4139 event->action = type;
4192 event->type = type; 4140 event->private_data = data;
4193 event->tag = spec->events.used;
4194 event->data = data;
4195
4196 return event->tag;
4197}
4198
4199static struct sigmatel_event *stac_get_event(struct hda_codec *codec,
4200 hda_nid_t nid)
4201{
4202 struct sigmatel_spec *spec = codec->spec;
4203 struct sigmatel_event *event = spec->events.list;
4204 int i;
4205
4206 for (i = 0; i < spec->events.used; i++, event++) {
4207 if (event->nid == nid)
4208 return event;
4209 }
4210 return NULL;
4211}
4212
4213static struct sigmatel_event *stac_get_event_from_tag(struct hda_codec *codec,
4214 unsigned char tag)
4215{
4216 struct sigmatel_spec *spec = codec->spec;
4217 struct sigmatel_event *event = spec->events.list;
4218 int i;
4219 4141
4220 for (i = 0; i < spec->events.used; i++, event++) { 4142 return 0;
4221 if (event->tag == tag)
4222 return event;
4223 }
4224 return NULL;
4225} 4143}
4226 4144
4227/* check if given nid is a valid pin and no other events are assigned 4145/* check if given nid is a valid pin and no other events are assigned
@@ -4231,24 +4149,17 @@ static struct sigmatel_event *stac_get_event_from_tag(struct hda_codec *codec,
4231static int enable_pin_detect(struct hda_codec *codec, hda_nid_t nid, 4149static int enable_pin_detect(struct hda_codec *codec, hda_nid_t nid,
4232 unsigned int type) 4150 unsigned int type)
4233{ 4151{
4234 struct sigmatel_event *event; 4152 struct hda_jack_tbl *event;
4235 int tag;
4236 4153
4237 if (!is_jack_detectable(codec, nid)) 4154 if (!is_jack_detectable(codec, nid))
4238 return 0; 4155 return 0;
4239 event = stac_get_event(codec, nid); 4156 event = snd_hda_jack_tbl_new(codec, nid);
4240 if (event) { 4157 if (!event)
4241 if (event->type != type) 4158 return -ENOMEM;
4242 return 0; 4159 if (event->action && event->action != type)
4243 tag = event->tag; 4160 return 0;
4244 } else { 4161 event->action = type;
4245 tag = stac_add_event(codec->spec, nid, type, 0); 4162 snd_hda_jack_detect_enable(codec, nid, 0);
4246 if (tag < 0)
4247 return 0;
4248 }
4249 snd_hda_codec_write_cache(codec, nid, 0,
4250 AC_VERB_SET_UNSOLICITED_ENABLE,
4251 AC_USRSP_EN | tag);
4252 return 1; 4163 return 1;
4253} 4164}
4254 4165
@@ -4318,15 +4229,34 @@ static void stac_store_hints(struct hda_codec *codec)
4318 spec->eapd_switch = val; 4229 spec->eapd_switch = val;
4319 get_int_hint(codec, "gpio_led_polarity", &spec->gpio_led_polarity); 4230 get_int_hint(codec, "gpio_led_polarity", &spec->gpio_led_polarity);
4320 if (get_int_hint(codec, "gpio_led", &spec->gpio_led)) { 4231 if (get_int_hint(codec, "gpio_led", &spec->gpio_led)) {
4321 if (spec->gpio_led <= 8) { 4232 spec->gpio_mask |= spec->gpio_led;
4322 spec->gpio_mask |= spec->gpio_led; 4233 spec->gpio_dir |= spec->gpio_led;
4323 spec->gpio_dir |= spec->gpio_led; 4234 if (spec->gpio_led_polarity)
4324 if (spec->gpio_led_polarity) 4235 spec->gpio_data |= spec->gpio_led;
4325 spec->gpio_data |= spec->gpio_led;
4326 }
4327 } 4236 }
4328} 4237}
4329 4238
4239static void stac_issue_unsol_events(struct hda_codec *codec, int num_pins,
4240 const hda_nid_t *pins)
4241{
4242 while (num_pins--)
4243 stac_issue_unsol_event(codec, *pins++);
4244}
4245
4246/* fake event to set up pins */
4247static void stac_fake_hp_events(struct hda_codec *codec)
4248{
4249 struct sigmatel_spec *spec = codec->spec;
4250
4251 if (spec->autocfg.hp_outs)
4252 stac_issue_unsol_events(codec, spec->autocfg.hp_outs,
4253 spec->autocfg.hp_pins);
4254 if (spec->autocfg.line_outs &&
4255 spec->autocfg.line_out_pins[0] != spec->autocfg.hp_pins[0])
4256 stac_issue_unsol_events(codec, spec->autocfg.line_outs,
4257 spec->autocfg.line_out_pins);
4258}
4259
4330static int stac92xx_init(struct hda_codec *codec) 4260static int stac92xx_init(struct hda_codec *codec)
4331{ 4261{
4332 struct sigmatel_spec *spec = codec->spec; 4262 struct sigmatel_spec *spec = codec->spec;
@@ -4377,10 +4307,7 @@ static int stac92xx_init(struct hda_codec *codec)
4377 stac92xx_auto_set_pinctl(codec, spec->autocfg.line_out_pins[0], 4307 stac92xx_auto_set_pinctl(codec, spec->autocfg.line_out_pins[0],
4378 AC_PINCTL_OUT_EN); 4308 AC_PINCTL_OUT_EN);
4379 /* fake event to set up pins */ 4309 /* fake event to set up pins */
4380 if (cfg->hp_pins[0]) 4310 stac_fake_hp_events(codec);
4381 stac_issue_unsol_event(codec, cfg->hp_pins[0]);
4382 else if (cfg->line_out_pins[0])
4383 stac_issue_unsol_event(codec, cfg->line_out_pins[0]);
4384 } else { 4311 } else {
4385 stac92xx_auto_init_multi_out(codec); 4312 stac92xx_auto_init_multi_out(codec);
4386 stac92xx_auto_init_hp_out(codec); 4313 stac92xx_auto_init_hp_out(codec);
@@ -4441,7 +4368,9 @@ static int stac92xx_init(struct hda_codec *codec)
4441 int pinctl, def_conf; 4368 int pinctl, def_conf;
4442 4369
4443 /* power on when no jack detection is available */ 4370 /* power on when no jack detection is available */
4444 if (!spec->hp_detect) { 4371 /* or when the VREF is used for controlling LED */
4372 if (!spec->hp_detect ||
4373 spec->vref_mute_led_nid == nid) {
4445 stac_toggle_power_map(codec, nid, 1); 4374 stac_toggle_power_map(codec, nid, 1);
4446 continue; 4375 continue;
4447 } 4376 }
@@ -4476,6 +4405,8 @@ static int stac92xx_init(struct hda_codec *codec)
4476 stac_toggle_power_map(codec, nid, 0); 4405 stac_toggle_power_map(codec, nid, 0);
4477 } 4406 }
4478 4407
4408 snd_hda_jack_report_sync(codec);
4409
4479 /* sync mute LED */ 4410 /* sync mute LED */
4480 if (spec->gpio_led) 4411 if (spec->gpio_led)
4481 hda_call_check_power_status(codec, 0x01); 4412 hda_call_check_power_status(codec, 0x01);
@@ -4532,8 +4463,6 @@ static void stac92xx_free(struct hda_codec *codec)
4532 return; 4463 return;
4533 4464
4534 stac92xx_shutup(codec); 4465 stac92xx_shutup(codec);
4535 snd_hda_input_jack_free(codec);
4536 snd_array_free(&spec->events);
4537 4466
4538 kfree(spec); 4467 kfree(spec);
4539 snd_hda_detach_beep_device(codec); 4468 snd_hda_detach_beep_device(codec);
@@ -4797,26 +4726,13 @@ static void stac92xx_mic_detect(struct hda_codec *codec)
4797 mic->mux_idx); 4726 mic->mux_idx);
4798} 4727}
4799 4728
4800static void stac_issue_unsol_event(struct hda_codec *codec, hda_nid_t nid) 4729static void handle_unsol_event(struct hda_codec *codec,
4801{ 4730 struct hda_jack_tbl *event)
4802 struct sigmatel_event *event = stac_get_event(codec, nid);
4803 if (!event)
4804 return;
4805 codec->patch_ops.unsol_event(codec, (unsigned)event->tag << 26);
4806}
4807
4808static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res)
4809{ 4731{
4810 struct sigmatel_spec *spec = codec->spec; 4732 struct sigmatel_spec *spec = codec->spec;
4811 struct sigmatel_event *event; 4733 int data;
4812 int tag, data;
4813
4814 tag = (res >> 26) & 0x7f;
4815 event = stac_get_event_from_tag(codec, tag);
4816 if (!event)
4817 return;
4818 4734
4819 switch (event->type) { 4735 switch (event->action) {
4820 case STAC_HP_EVENT: 4736 case STAC_HP_EVENT:
4821 case STAC_LO_EVENT: 4737 case STAC_LO_EVENT:
4822 stac92xx_hp_detect(codec); 4738 stac92xx_hp_detect(codec);
@@ -4826,7 +4742,7 @@ static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res)
4826 break; 4742 break;
4827 } 4743 }
4828 4744
4829 switch (event->type) { 4745 switch (event->action) {
4830 case STAC_HP_EVENT: 4746 case STAC_HP_EVENT:
4831 case STAC_LO_EVENT: 4747 case STAC_LO_EVENT:
4832 case STAC_MIC_EVENT: 4748 case STAC_MIC_EVENT:
@@ -4834,7 +4750,6 @@ static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res)
4834 case STAC_PWR_EVENT: 4750 case STAC_PWR_EVENT:
4835 if (spec->num_pwrs > 0) 4751 if (spec->num_pwrs > 0)
4836 stac92xx_pin_sense(codec, event->nid); 4752 stac92xx_pin_sense(codec, event->nid);
4837 snd_hda_input_jack_report(codec, event->nid);
4838 4753
4839 switch (codec->subsystem_id) { 4754 switch (codec->subsystem_id) {
4840 case 0x103c308f: 4755 case 0x103c308f:
@@ -4859,11 +4774,33 @@ static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res)
4859 AC_VERB_GET_GPIO_DATA, 0); 4774 AC_VERB_GET_GPIO_DATA, 0);
4860 /* toggle VREF state based on GPIOx status */ 4775 /* toggle VREF state based on GPIOx status */
4861 snd_hda_codec_write(codec, codec->afg, 0, 0x7e0, 4776 snd_hda_codec_write(codec, codec->afg, 0, 0x7e0,
4862 !!(data & (1 << event->data))); 4777 !!(data & (1 << event->private_data)));
4863 break; 4778 break;
4864 } 4779 }
4865} 4780}
4866 4781
4782static void stac_issue_unsol_event(struct hda_codec *codec, hda_nid_t nid)
4783{
4784 struct hda_jack_tbl *event = snd_hda_jack_tbl_get(codec, nid);
4785 if (!event)
4786 return;
4787 handle_unsol_event(codec, event);
4788}
4789
4790static void stac92xx_unsol_event(struct hda_codec *codec, unsigned int res)
4791{
4792 struct hda_jack_tbl *event;
4793 int tag;
4794
4795 tag = (res >> 26) & 0x7f;
4796 event = snd_hda_jack_tbl_get_from_tag(codec, tag);
4797 if (!event)
4798 return;
4799 event->jack_dirty = 1;
4800 handle_unsol_event(codec, event);
4801 snd_hda_jack_report_sync(codec);
4802}
4803
4867static int hp_blike_system(u32 subsystem_id); 4804static int hp_blike_system(u32 subsystem_id);
4868 4805
4869static void set_hp_led_gpio(struct hda_codec *codec) 4806static void set_hp_led_gpio(struct hda_codec *codec)
@@ -4902,7 +4839,7 @@ static void set_hp_led_gpio(struct hda_codec *codec)
4902 * Need more information on whether it is true across the entire series. 4839 * Need more information on whether it is true across the entire series.
4903 * -- kunal 4840 * -- kunal
4904 */ 4841 */
4905static int find_mute_led_gpio(struct hda_codec *codec, int default_polarity) 4842static int find_mute_led_cfg(struct hda_codec *codec, int default_polarity)
4906{ 4843{
4907 struct sigmatel_spec *spec = codec->spec; 4844 struct sigmatel_spec *spec = codec->spec;
4908 const struct dmi_device *dev = NULL; 4845 const struct dmi_device *dev = NULL;
@@ -4913,8 +4850,14 @@ static int find_mute_led_gpio(struct hda_codec *codec, int default_polarity)
4913 if (sscanf(dev->name, "HP_Mute_LED_%d_%x", 4850 if (sscanf(dev->name, "HP_Mute_LED_%d_%x",
4914 &spec->gpio_led_polarity, 4851 &spec->gpio_led_polarity,
4915 &spec->gpio_led) == 2) { 4852 &spec->gpio_led) == 2) {
4916 if (spec->gpio_led < 4) 4853 unsigned int max_gpio;
4854 max_gpio = snd_hda_param_read(codec, codec->afg,
4855 AC_PAR_GPIO_CAP);
4856 max_gpio &= AC_GPIO_IO_COUNT;
4857 if (spec->gpio_led < max_gpio)
4917 spec->gpio_led = 1 << spec->gpio_led; 4858 spec->gpio_led = 1 << spec->gpio_led;
4859 else
4860 spec->vref_mute_led_nid = spec->gpio_led;
4918 return 1; 4861 return 1;
4919 } 4862 }
4920 if (sscanf(dev->name, "HP_Mute_LED_%d", 4863 if (sscanf(dev->name, "HP_Mute_LED_%d",
@@ -4922,13 +4865,21 @@ static int find_mute_led_gpio(struct hda_codec *codec, int default_polarity)
4922 set_hp_led_gpio(codec); 4865 set_hp_led_gpio(codec);
4923 return 1; 4866 return 1;
4924 } 4867 }
4868 /* BIOS bug: unfilled OEM string */
4869 if (strstr(dev->name, "HP_Mute_LED_P_G")) {
4870 set_hp_led_gpio(codec);
4871 spec->gpio_led_polarity = 1;
4872 return 1;
4873 }
4925 } 4874 }
4926 4875
4927 /* 4876 /*
4928 * Fallback case - if we don't find the DMI strings, 4877 * Fallback case - if we don't find the DMI strings,
4929 * we statically set the GPIO - if not a B-series system. 4878 * we statically set the GPIO - if not a B-series system
4879 * and default polarity is provided
4930 */ 4880 */
4931 if (!hp_blike_system(codec->subsystem_id)) { 4881 if (!hp_blike_system(codec->subsystem_id) &&
4882 (default_polarity == 0 || default_polarity == 1)) {
4932 set_hp_led_gpio(codec); 4883 set_hp_led_gpio(codec);
4933 spec->gpio_led_polarity = default_polarity; 4884 spec->gpio_led_polarity = default_polarity;
4934 return 1; 4885 return 1;
@@ -5015,19 +4966,11 @@ static void stac927x_proc_hook(struct snd_info_buffer *buffer,
5015#ifdef CONFIG_PM 4966#ifdef CONFIG_PM
5016static int stac92xx_resume(struct hda_codec *codec) 4967static int stac92xx_resume(struct hda_codec *codec)
5017{ 4968{
5018 struct sigmatel_spec *spec = codec->spec;
5019
5020 stac92xx_init(codec); 4969 stac92xx_init(codec);
5021 snd_hda_codec_resume_amp(codec); 4970 snd_hda_codec_resume_amp(codec);
5022 snd_hda_codec_resume_cache(codec); 4971 snd_hda_codec_resume_cache(codec);
5023 /* fake event to set up pins again to override cached values */ 4972 /* fake event to set up pins again to override cached values */
5024 if (spec->hp_detect) { 4973 stac_fake_hp_events(codec);
5025 if (spec->autocfg.hp_pins[0])
5026 stac_issue_unsol_event(codec, spec->autocfg.hp_pins[0]);
5027 else if (spec->autocfg.line_out_pins[0])
5028 stac_issue_unsol_event(codec,
5029 spec->autocfg.line_out_pins[0]);
5030 }
5031 return 0; 4974 return 0;
5032} 4975}
5033 4976
@@ -5043,29 +4986,12 @@ static int stac92xx_pre_resume(struct hda_codec *codec)
5043 struct sigmatel_spec *spec = codec->spec; 4986 struct sigmatel_spec *spec = codec->spec;
5044 4987
5045 /* sync mute LED */ 4988 /* sync mute LED */
5046 if (spec->gpio_led) { 4989 if (spec->vref_mute_led_nid)
5047 if (spec->gpio_led <= 8) { 4990 stac_vrefout_set(codec, spec->vref_mute_led_nid,
5048 stac_gpio_set(codec, spec->gpio_mask, 4991 spec->vref_led);
5049 spec->gpio_dir, spec->gpio_data); 4992 else if (spec->gpio_led)
5050 } else { 4993 stac_gpio_set(codec, spec->gpio_mask,
5051 stac_vrefout_set(codec, 4994 spec->gpio_dir, spec->gpio_data);
5052 spec->gpio_led, spec->vref_led);
5053 }
5054 }
5055 return 0;
5056}
5057
5058static int stac92xx_post_suspend(struct hda_codec *codec)
5059{
5060 struct sigmatel_spec *spec = codec->spec;
5061 if (spec->gpio_led > 8) {
5062 /* with vref-out pin used for mute led control
5063 * codec AFG is prevented from D3 state, but on
5064 * system suspend it can (and should) be used
5065 */
5066 snd_hda_codec_read(codec, codec->afg, 0,
5067 AC_VERB_SET_POWER_STATE, AC_PWRST_D3);
5068 }
5069 return 0; 4995 return 0;
5070} 4996}
5071 4997
@@ -5076,7 +5002,7 @@ static void stac92xx_set_power_state(struct hda_codec *codec, hda_nid_t fg,
5076 struct sigmatel_spec *spec = codec->spec; 5002 struct sigmatel_spec *spec = codec->spec;
5077 5003
5078 if (power_state == AC_PWRST_D3) { 5004 if (power_state == AC_PWRST_D3) {
5079 if (spec->gpio_led > 8) { 5005 if (spec->vref_mute_led_nid) {
5080 /* with vref-out pin used for mute led control 5006 /* with vref-out pin used for mute led control
5081 * codec AFG is prevented from D3 state 5007 * codec AFG is prevented from D3 state
5082 */ 5008 */
@@ -5129,7 +5055,7 @@ static int stac92xx_update_led_status(struct hda_codec *codec)
5129 } 5055 }
5130 } 5056 }
5131 /*polarity defines *not* muted state level*/ 5057 /*polarity defines *not* muted state level*/
5132 if (spec->gpio_led <= 8) { 5058 if (!spec->vref_mute_led_nid) {
5133 if (muted) 5059 if (muted)
5134 spec->gpio_data &= ~spec->gpio_led; /* orange */ 5060 spec->gpio_data &= ~spec->gpio_led; /* orange */
5135 else 5061 else
@@ -5147,7 +5073,8 @@ static int stac92xx_update_led_status(struct hda_codec *codec)
5147 muted_lvl = spec->gpio_led_polarity ? 5073 muted_lvl = spec->gpio_led_polarity ?
5148 AC_PINCTL_VREF_GRD : AC_PINCTL_VREF_HIZ; 5074 AC_PINCTL_VREF_GRD : AC_PINCTL_VREF_HIZ;
5149 spec->vref_led = muted ? muted_lvl : notmtd_lvl; 5075 spec->vref_led = muted ? muted_lvl : notmtd_lvl;
5150 stac_vrefout_set(codec, spec->gpio_led, spec->vref_led); 5076 stac_vrefout_set(codec, spec->vref_mute_led_nid,
5077 spec->vref_led);
5151 } 5078 }
5152 return 0; 5079 return 0;
5153} 5080}
@@ -5654,22 +5581,20 @@ again:
5654 5581
5655 codec->patch_ops = stac92xx_patch_ops; 5582 codec->patch_ops = stac92xx_patch_ops;
5656 5583
5657 if (find_mute_led_gpio(codec, 0)) 5584 if (find_mute_led_cfg(codec, -1/*no default cfg*/))
5658 snd_printd("mute LED gpio %d polarity %d\n", 5585 snd_printd("mute LED gpio %d polarity %d\n",
5659 spec->gpio_led, 5586 spec->gpio_led,
5660 spec->gpio_led_polarity); 5587 spec->gpio_led_polarity);
5661 5588
5662#ifdef CONFIG_SND_HDA_POWER_SAVE 5589#ifdef CONFIG_SND_HDA_POWER_SAVE
5663 if (spec->gpio_led) { 5590 if (spec->gpio_led) {
5664 if (spec->gpio_led <= 8) { 5591 if (!spec->vref_mute_led_nid) {
5665 spec->gpio_mask |= spec->gpio_led; 5592 spec->gpio_mask |= spec->gpio_led;
5666 spec->gpio_dir |= spec->gpio_led; 5593 spec->gpio_dir |= spec->gpio_led;
5667 spec->gpio_data |= spec->gpio_led; 5594 spec->gpio_data |= spec->gpio_led;
5668 } else { 5595 } else {
5669 codec->patch_ops.set_power_state = 5596 codec->patch_ops.set_power_state =
5670 stac92xx_set_power_state; 5597 stac92xx_set_power_state;
5671 codec->patch_ops.post_suspend =
5672 stac92xx_post_suspend;
5673 } 5598 }
5674 codec->patch_ops.pre_resume = stac92xx_pre_resume; 5599 codec->patch_ops.pre_resume = stac92xx_pre_resume;
5675 codec->patch_ops.check_power_status = 5600 codec->patch_ops.check_power_status =
@@ -5844,15 +5769,13 @@ again:
5844 switch (spec->board_config) { 5769 switch (spec->board_config) {
5845 case STAC_HP_M4: 5770 case STAC_HP_M4:
5846 /* Enable VREF power saving on GPIO1 detect */ 5771 /* Enable VREF power saving on GPIO1 detect */
5847 err = stac_add_event(spec, codec->afg, 5772 err = stac_add_event(codec, codec->afg,
5848 STAC_VREF_EVENT, 0x02); 5773 STAC_VREF_EVENT, 0x02);
5849 if (err < 0) 5774 if (err < 0)
5850 return err; 5775 return err;
5851 snd_hda_codec_write_cache(codec, codec->afg, 0, 5776 snd_hda_codec_write_cache(codec, codec->afg, 0,
5852 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x02); 5777 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x02);
5853 snd_hda_codec_write_cache(codec, codec->afg, 0, 5778 snd_hda_jack_detect_enable(codec, codec->afg, 0);
5854 AC_VERB_SET_UNSOLICITED_ENABLE,
5855 AC_USRSP_EN | err);
5856 spec->gpio_mask |= 0x02; 5779 spec->gpio_mask |= 0x02;
5857 break; 5780 break;
5858 } 5781 }
@@ -5969,22 +5892,20 @@ again:
5969 } 5892 }
5970 } 5893 }
5971 5894
5972 if (find_mute_led_gpio(codec, 1)) 5895 if (find_mute_led_cfg(codec, 1))
5973 snd_printd("mute LED gpio %d polarity %d\n", 5896 snd_printd("mute LED gpio %d polarity %d\n",
5974 spec->gpio_led, 5897 spec->gpio_led,
5975 spec->gpio_led_polarity); 5898 spec->gpio_led_polarity);
5976 5899
5977#ifdef CONFIG_SND_HDA_POWER_SAVE 5900#ifdef CONFIG_SND_HDA_POWER_SAVE
5978 if (spec->gpio_led) { 5901 if (spec->gpio_led) {
5979 if (spec->gpio_led <= 8) { 5902 if (!spec->vref_mute_led_nid) {
5980 spec->gpio_mask |= spec->gpio_led; 5903 spec->gpio_mask |= spec->gpio_led;
5981 spec->gpio_dir |= spec->gpio_led; 5904 spec->gpio_dir |= spec->gpio_led;
5982 spec->gpio_data |= spec->gpio_led; 5905 spec->gpio_data |= spec->gpio_led;
5983 } else { 5906 } else {
5984 codec->patch_ops.set_power_state = 5907 codec->patch_ops.set_power_state =
5985 stac92xx_set_power_state; 5908 stac92xx_set_power_state;
5986 codec->patch_ops.post_suspend =
5987 stac92xx_post_suspend;
5988 } 5909 }
5989 codec->patch_ops.pre_resume = stac92xx_pre_resume; 5910 codec->patch_ops.pre_resume = stac92xx_pre_resume;
5990 codec->patch_ops.check_power_status = 5911 codec->patch_ops.check_power_status =
@@ -6325,14 +6246,12 @@ static int patch_stac9205(struct hda_codec *codec)
6325 snd_hda_codec_set_pincfg(codec, 0x20, 0x1c410030); 6246 snd_hda_codec_set_pincfg(codec, 0x20, 0x1c410030);
6326 6247
6327 /* Enable unsol response for GPIO4/Dock HP connection */ 6248 /* Enable unsol response for GPIO4/Dock HP connection */
6328 err = stac_add_event(spec, codec->afg, STAC_VREF_EVENT, 0x01); 6249 err = stac_add_event(codec, codec->afg, STAC_VREF_EVENT, 0x01);
6329 if (err < 0) 6250 if (err < 0)
6330 return err; 6251 return err;
6331 snd_hda_codec_write_cache(codec, codec->afg, 0, 6252 snd_hda_codec_write_cache(codec, codec->afg, 0,
6332 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x10); 6253 AC_VERB_SET_GPIO_UNSOLICITED_RSP_MASK, 0x10);
6333 snd_hda_codec_write_cache(codec, codec->afg, 0, 6254 snd_hda_jack_detect_enable(codec, codec->afg, 0);
6334 AC_VERB_SET_UNSOLICITED_ENABLE,
6335 AC_USRSP_EN | err);
6336 6255
6337 spec->gpio_dir = 0x0b; 6256 spec->gpio_dir = 0x0b;
6338 spec->eapd_mask = 0x01; 6257 spec->eapd_mask = 0x01;
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c
index b5137629f8e..03e63fed9ca 100644
--- a/sound/pci/hda/patch_via.c
+++ b/sound/pci/hda/patch_via.c
@@ -54,6 +54,7 @@
54#include <sound/asoundef.h> 54#include <sound/asoundef.h>
55#include "hda_codec.h" 55#include "hda_codec.h"
56#include "hda_local.h" 56#include "hda_local.h"
57#include "hda_jack.h"
57 58
58/* Pin Widget NID */ 59/* Pin Widget NID */
59#define VT1708_HP_PIN_NID 0x20 60#define VT1708_HP_PIN_NID 0x20
@@ -1503,6 +1504,11 @@ static int via_build_controls(struct hda_codec *codec)
1503 analog_low_current_mode(codec); 1504 analog_low_current_mode(codec);
1504 1505
1505 via_free_kctls(codec); /* no longer needed */ 1506 via_free_kctls(codec); /* no longer needed */
1507
1508 err = snd_hda_jack_add_kctls(codec, &spec->autocfg);
1509 if (err < 0)
1510 return err;
1511
1506 return 0; 1512 return 0;
1507} 1513}
1508 1514
@@ -1714,6 +1720,7 @@ static void via_unsol_event(struct hda_codec *codec,
1714 unsigned int res) 1720 unsigned int res)
1715{ 1721{
1716 res >>= 26; 1722 res >>= 26;
1723 res = snd_hda_jack_get_action(codec, res);
1717 1724
1718 if (res & VIA_JACK_EVENT) 1725 if (res & VIA_JACK_EVENT)
1719 set_widgets_power_state(codec); 1726 set_widgets_power_state(codec);
@@ -1724,6 +1731,7 @@ static void via_unsol_event(struct hda_codec *codec,
1724 via_hp_automute(codec); 1731 via_hp_automute(codec);
1725 else if (res == VIA_GPIO_EVENT) 1732 else if (res == VIA_GPIO_EVENT)
1726 via_gpio_control(codec); 1733 via_gpio_control(codec);
1734 snd_hda_jack_report_sync(codec);
1727} 1735}
1728 1736
1729#ifdef CONFIG_PM 1737#ifdef CONFIG_PM
@@ -2200,7 +2208,10 @@ static int via_auto_create_loopback_switch(struct hda_codec *codec)
2200{ 2208{
2201 struct via_spec *spec = codec->spec; 2209 struct via_spec *spec = codec->spec;
2202 2210
2203 if (!spec->aa_mix_nid || !spec->out_mix_path.depth) 2211 if (!spec->aa_mix_nid)
2212 return 0; /* no loopback switching available */
2213 if (!(spec->out_mix_path.depth || spec->hp_mix_path.depth ||
2214 spec->speaker_path.depth))
2204 return 0; /* no loopback switching available */ 2215 return 0; /* no loopback switching available */
2205 if (!via_clone_control(spec, &via_aamix_ctl_enum)) 2216 if (!via_clone_control(spec, &via_aamix_ctl_enum))
2206 return -ENOMEM; 2217 return -ENOMEM;
@@ -2736,9 +2747,8 @@ static void via_auto_init_unsol_event(struct hda_codec *codec)
2736 int i; 2747 int i;
2737 2748
2738 if (cfg->hp_pins[0] && is_jack_detectable(codec, cfg->hp_pins[0])) 2749 if (cfg->hp_pins[0] && is_jack_detectable(codec, cfg->hp_pins[0]))
2739 snd_hda_codec_write(codec, cfg->hp_pins[0], 0, 2750 snd_hda_jack_detect_enable(codec, cfg->hp_pins[0],
2740 AC_VERB_SET_UNSOLICITED_ENABLE, 2751 VIA_HP_EVENT | VIA_JACK_EVENT);
2741 AC_USRSP_EN | VIA_HP_EVENT | VIA_JACK_EVENT);
2742 2752
2743 if (cfg->speaker_pins[0]) 2753 if (cfg->speaker_pins[0])
2744 ev = VIA_LINE_EVENT; 2754 ev = VIA_LINE_EVENT;
@@ -2747,16 +2757,14 @@ static void via_auto_init_unsol_event(struct hda_codec *codec)
2747 for (i = 0; i < cfg->line_outs; i++) { 2757 for (i = 0; i < cfg->line_outs; i++) {
2748 if (cfg->line_out_pins[i] && 2758 if (cfg->line_out_pins[i] &&
2749 is_jack_detectable(codec, cfg->line_out_pins[i])) 2759 is_jack_detectable(codec, cfg->line_out_pins[i]))
2750 snd_hda_codec_write(codec, cfg->line_out_pins[i], 0, 2760 snd_hda_jack_detect_enable(codec, cfg->line_out_pins[i],
2751 AC_VERB_SET_UNSOLICITED_ENABLE, 2761 ev | VIA_JACK_EVENT);
2752 AC_USRSP_EN | ev | VIA_JACK_EVENT);
2753 } 2762 }
2754 2763
2755 for (i = 0; i < cfg->num_inputs; i++) { 2764 for (i = 0; i < cfg->num_inputs; i++) {
2756 if (is_jack_detectable(codec, cfg->inputs[i].pin)) 2765 if (is_jack_detectable(codec, cfg->inputs[i].pin))
2757 snd_hda_codec_write(codec, cfg->inputs[i].pin, 0, 2766 snd_hda_jack_detect_enable(codec, cfg->inputs[i].pin,
2758 AC_VERB_SET_UNSOLICITED_ENABLE, 2767 VIA_JACK_EVENT);
2759 AC_USRSP_EN | VIA_JACK_EVENT);
2760 } 2768 }
2761} 2769}
2762 2770
@@ -2779,6 +2787,7 @@ static int via_init(struct hda_codec *codec)
2779 2787
2780 via_hp_automute(codec); 2788 via_hp_automute(codec);
2781 vt1708_update_hp_work(spec); 2789 vt1708_update_hp_work(spec);
2790 snd_hda_jack_report_sync(codec);
2782 2791
2783 return 0; 2792 return 0;
2784} 2793}
@@ -2789,6 +2798,7 @@ static void vt1708_update_hp_jack_state(struct work_struct *work)
2789 vt1708_hp_work.work); 2798 vt1708_hp_work.work);
2790 if (spec->codec_type != VT1708) 2799 if (spec->codec_type != VT1708)
2791 return; 2800 return;
2801 snd_hda_jack_set_dirty_all(spec->codec);
2792 /* if jack state toggled */ 2802 /* if jack state toggled */
2793 if (spec->vt1708_hp_present 2803 if (spec->vt1708_hp_present
2794 != snd_hda_jack_detect(spec->codec, spec->autocfg.hp_pins[0])) { 2804 != snd_hda_jack_detect(spec->codec, spec->autocfg.hp_pins[0])) {
diff --git a/sound/pci/ice1712/amp.c b/sound/pci/ice1712/amp.c
index e328cfb7620..e525da2673b 100644
--- a/sound/pci/ice1712/amp.c
+++ b/sound/pci/ice1712/amp.c
@@ -68,8 +68,11 @@ static int __devinit snd_vt1724_amp_init(struct snd_ice1712 *ice)
68 68
69static int __devinit snd_vt1724_amp_add_controls(struct snd_ice1712 *ice) 69static int __devinit snd_vt1724_amp_add_controls(struct snd_ice1712 *ice)
70{ 70{
71 /* we use pins 39 and 41 of the VT1616 for left and right read outputs */ 71 if (ice->ac97)
72 snd_ac97_write_cache(ice->ac97, 0x5a, snd_ac97_read(ice->ac97, 0x5a) & ~0x8000); 72 /* we use pins 39 and 41 of the VT1616 for left and right
73 read outputs */
74 snd_ac97_write_cache(ice->ac97, 0x5a,
75 snd_ac97_read(ice->ac97, 0x5a) & ~0x8000);
73 return 0; 76 return 0;
74} 77}
75 78
diff --git a/sound/pci/ice1712/envy24ht.h b/sound/pci/ice1712/envy24ht.h
index a0c5e009bb4..4ca33a800bc 100644
--- a/sound/pci/ice1712/envy24ht.h
+++ b/sound/pci/ice1712/envy24ht.h
@@ -66,6 +66,7 @@ enum {
66#define VT1724_CFG_CLOCK384 0x40 /* 16.9344Mhz, 44.1kHz*384 */ 66#define VT1724_CFG_CLOCK384 0x40 /* 16.9344Mhz, 44.1kHz*384 */
67#define VT1724_CFG_MPU401 0x20 /* MPU401 UARTs */ 67#define VT1724_CFG_MPU401 0x20 /* MPU401 UARTs */
68#define VT1724_CFG_ADC_MASK 0x0c /* one, two or one and S/PDIF, stereo ADCs */ 68#define VT1724_CFG_ADC_MASK 0x0c /* one, two or one and S/PDIF, stereo ADCs */
69#define VT1724_CFG_ADC_NONE 0x0c /* no ADCs */
69#define VT1724_CFG_DAC_MASK 0x03 /* one, two, three, four stereo DACs */ 70#define VT1724_CFG_DAC_MASK 0x03 /* one, two, three, four stereo DACs */
70 71
71#define VT1724_REG_AC97_CFG 0x05 /* byte */ 72#define VT1724_REG_AC97_CFG 0x05 /* byte */
diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c
index 44446f2222d..132a86e09d0 100644
--- a/sound/pci/ice1712/ice1712.c
+++ b/sound/pci/ice1712/ice1712.c
@@ -84,9 +84,9 @@ MODULE_SUPPORTED_DEVICE("{"
84 84
85static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 85static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
86static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 86static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
87static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;/* Enable this card */ 87static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;/* Enable this card */
88static char *model[SNDRV_CARDS]; 88static char *model[SNDRV_CARDS];
89static int omni[SNDRV_CARDS]; /* Delta44 & 66 Omni I/O support */ 89static bool omni[SNDRV_CARDS]; /* Delta44 & 66 Omni I/O support */
90static int cs8427_timeout[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = 500}; /* CS8427 S/PDIF transceiver reset timeout value in msec */ 90static int cs8427_timeout[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS-1)] = 500}; /* CS8427 S/PDIF transceiver reset timeout value in msec */
91static int dxr_enable[SNDRV_CARDS]; /* DXR enable for DMX6FIRE */ 91static int dxr_enable[SNDRV_CARDS]; /* DXR enable for DMX6FIRE */
92 92
diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c
index 4353e76bf0a..92362973764 100644
--- a/sound/pci/ice1712/ice1724.c
+++ b/sound/pci/ice1712/ice1724.c
@@ -80,7 +80,7 @@ MODULE_SUPPORTED_DEVICE("{"
80 80
81static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 81static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
82static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 82static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
83static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 83static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
84static char *model[SNDRV_CARDS]; 84static char *model[SNDRV_CARDS];
85 85
86module_param_array(index, int, NULL, 0444); 86module_param_array(index, int, NULL, 0444);
@@ -1117,14 +1117,21 @@ static struct snd_pcm_ops snd_vt1724_capture_pro_ops = {
1117static int __devinit snd_vt1724_pcm_profi(struct snd_ice1712 *ice, int device) 1117static int __devinit snd_vt1724_pcm_profi(struct snd_ice1712 *ice, int device)
1118{ 1118{
1119 struct snd_pcm *pcm; 1119 struct snd_pcm *pcm;
1120 int err; 1120 int capt, err;
1121 1121
1122 err = snd_pcm_new(ice->card, "ICE1724", device, 1, 1, &pcm); 1122 if ((ice->eeprom.data[ICE_EEP2_SYSCONF] & VT1724_CFG_ADC_MASK) ==
1123 VT1724_CFG_ADC_NONE)
1124 capt = 0;
1125 else
1126 capt = 1;
1127 err = snd_pcm_new(ice->card, "ICE1724", device, 1, capt, &pcm);
1123 if (err < 0) 1128 if (err < 0)
1124 return err; 1129 return err;
1125 1130
1126 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_vt1724_playback_pro_ops); 1131 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_vt1724_playback_pro_ops);
1127 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_vt1724_capture_pro_ops); 1132 if (capt)
1133 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE,
1134 &snd_vt1724_capture_pro_ops);
1128 1135
1129 pcm->private_data = ice; 1136 pcm->private_data = ice;
1130 pcm->info_flags = 0; 1137 pcm->info_flags = 0;
@@ -1825,7 +1832,12 @@ static int snd_vt1724_pro_internal_clock_info(struct snd_kcontrol *kcontrol,
1825 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 1832 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
1826 uinfo->count = 1; 1833 uinfo->count = 1;
1827 1834
1828 uinfo->value.enumerated.items = hw_rates_count + ice->ext_clock_count; 1835 /* internal clocks */
1836 uinfo->value.enumerated.items = hw_rates_count;
1837 /* external clocks */
1838 if (ice->force_rdma1 ||
1839 (ice->eeprom.data[ICE_EEP2_SPDIF] & VT1724_CFG_SPDIF_IN))
1840 uinfo->value.enumerated.items += ice->ext_clock_count;
1829 /* upper limit - keep at top */ 1841 /* upper limit - keep at top */
1830 if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) 1842 if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items)
1831 uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1; 1843 uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1;
@@ -2173,6 +2185,40 @@ static struct snd_kcontrol_new snd_vt1724_mixer_pro_peak __devinitdata = {
2173 2185
2174static struct snd_ice1712_card_info no_matched __devinitdata; 2186static struct snd_ice1712_card_info no_matched __devinitdata;
2175 2187
2188
2189/*
2190 ooAoo cards with no controls
2191*/
2192static unsigned char ooaoo_sq210_eeprom[] __devinitdata = {
2193 [ICE_EEP2_SYSCONF] = 0x4c, /* 49MHz crystal, no mpu401, no ADC,
2194 1xDACs */
2195 [ICE_EEP2_ACLINK] = 0x80, /* I2S */
2196 [ICE_EEP2_I2S] = 0x78, /* no volume, 96k, 24bit, 192k */
2197 [ICE_EEP2_SPDIF] = 0xc1, /* out-en, out-int, out-ext */
2198 [ICE_EEP2_GPIO_DIR] = 0x00, /* no GPIOs are used */
2199 [ICE_EEP2_GPIO_DIR1] = 0x00,
2200 [ICE_EEP2_GPIO_DIR2] = 0x00,
2201 [ICE_EEP2_GPIO_MASK] = 0xff,
2202 [ICE_EEP2_GPIO_MASK1] = 0xff,
2203 [ICE_EEP2_GPIO_MASK2] = 0xff,
2204
2205 [ICE_EEP2_GPIO_STATE] = 0x00, /* inputs */
2206 [ICE_EEP2_GPIO_STATE1] = 0x00, /* all 1, but GPIO_CPLD_RW
2207 and GPIO15 always zero */
2208 [ICE_EEP2_GPIO_STATE2] = 0x00, /* inputs */
2209};
2210
2211
2212struct snd_ice1712_card_info snd_vt1724_ooaoo_cards[] __devinitdata = {
2213 {
2214 .name = "ooAoo SQ210a",
2215 .model = "sq210a",
2216 .eeprom_size = sizeof(ooaoo_sq210_eeprom),
2217 .eeprom_data = ooaoo_sq210_eeprom,
2218 },
2219 { } /* terminator */
2220};
2221
2176static struct snd_ice1712_card_info *card_tables[] __devinitdata = { 2222static struct snd_ice1712_card_info *card_tables[] __devinitdata = {
2177 snd_vt1724_revo_cards, 2223 snd_vt1724_revo_cards,
2178 snd_vt1724_amp_cards, 2224 snd_vt1724_amp_cards,
@@ -2187,6 +2233,7 @@ static struct snd_ice1712_card_info *card_tables[] __devinitdata = {
2187 snd_vt1724_wtm_cards, 2233 snd_vt1724_wtm_cards,
2188 snd_vt1724_se_cards, 2234 snd_vt1724_se_cards,
2189 snd_vt1724_qtet_cards, 2235 snd_vt1724_qtet_cards,
2236 snd_vt1724_ooaoo_cards,
2190 NULL, 2237 NULL,
2191}; 2238};
2192 2239
@@ -2270,7 +2317,7 @@ static int __devinit snd_vt1724_read_eeprom(struct snd_ice1712 *ice,
2270 } 2317 }
2271 } 2318 }
2272 for (tbl = card_tables; *tbl; tbl++) { 2319 for (tbl = card_tables; *tbl; tbl++) {
2273 for (c = *tbl; c->subvendor; c++) { 2320 for (c = *tbl; c->name; c++) {
2274 if (modelname && c->model && 2321 if (modelname && c->model &&
2275 !strcmp(modelname, c->model)) { 2322 !strcmp(modelname, c->model)) {
2276 printk(KERN_INFO "ice1724: Using board model %s\n", 2323 printk(KERN_INFO "ice1724: Using board model %s\n",
@@ -2579,8 +2626,10 @@ static int __devinit snd_vt1724_probe(struct pci_dev *pci,
2579 ice->ext_clock_count = 0; 2626 ice->ext_clock_count = 0;
2580 2627
2581 for (tbl = card_tables; *tbl; tbl++) { 2628 for (tbl = card_tables; *tbl; tbl++) {
2582 for (c = *tbl; c->subvendor; c++) { 2629 for (c = *tbl; c->name; c++) {
2583 if (c->subvendor == ice->eeprom.subvendor) { 2630 if ((model[dev] && c->model &&
2631 !strcmp(model[dev], c->model)) ||
2632 (c->subvendor == ice->eeprom.subvendor)) {
2584 strcpy(card->shortname, c->name); 2633 strcpy(card->shortname, c->name);
2585 if (c->driver) /* specific driver? */ 2634 if (c->driver) /* specific driver? */
2586 strcpy(card->driver, c->driver); 2635 strcpy(card->driver, c->driver);
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c
index 11718b49b2e..9f3b01bb72c 100644
--- a/sound/pci/intel8x0.c
+++ b/sound/pci/intel8x0.c
@@ -79,9 +79,9 @@ static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */
79static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ 79static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */
80static int ac97_clock; 80static int ac97_clock;
81static char *ac97_quirk; 81static char *ac97_quirk;
82static int buggy_semaphore; 82static bool buggy_semaphore;
83static int buggy_irq = -1; /* auto-check */ 83static int buggy_irq = -1; /* auto-check */
84static int xbox; 84static bool xbox;
85static int spdif_aclink = -1; 85static int spdif_aclink = -1;
86static int inside_vm = -1; 86static int inside_vm = -1;
87 87
@@ -95,17 +95,17 @@ module_param(ac97_quirk, charp, 0444);
95MODULE_PARM_DESC(ac97_quirk, "AC'97 workaround for strange hardware."); 95MODULE_PARM_DESC(ac97_quirk, "AC'97 workaround for strange hardware.");
96module_param(buggy_semaphore, bool, 0444); 96module_param(buggy_semaphore, bool, 0444);
97MODULE_PARM_DESC(buggy_semaphore, "Enable workaround for hardwares with problematic codec semaphores."); 97MODULE_PARM_DESC(buggy_semaphore, "Enable workaround for hardwares with problematic codec semaphores.");
98module_param(buggy_irq, bool, 0444); 98module_param(buggy_irq, bint, 0444);
99MODULE_PARM_DESC(buggy_irq, "Enable workaround for buggy interrupts on some motherboards."); 99MODULE_PARM_DESC(buggy_irq, "Enable workaround for buggy interrupts on some motherboards.");
100module_param(xbox, bool, 0444); 100module_param(xbox, bool, 0444);
101MODULE_PARM_DESC(xbox, "Set to 1 for Xbox, if you have problems with the AC'97 codec detection."); 101MODULE_PARM_DESC(xbox, "Set to 1 for Xbox, if you have problems with the AC'97 codec detection.");
102module_param(spdif_aclink, int, 0444); 102module_param(spdif_aclink, int, 0444);
103MODULE_PARM_DESC(spdif_aclink, "S/PDIF over AC-link."); 103MODULE_PARM_DESC(spdif_aclink, "S/PDIF over AC-link.");
104module_param(inside_vm, bool, 0444); 104module_param(inside_vm, bint, 0444);
105MODULE_PARM_DESC(inside_vm, "KVM/Parallels optimization."); 105MODULE_PARM_DESC(inside_vm, "KVM/Parallels optimization.");
106 106
107/* just for backward compatibility */ 107/* just for backward compatibility */
108static int enable; 108static bool enable;
109module_param(enable, bool, 0444); 109module_param(enable, bool, 0444);
110static int joystick; 110static int joystick;
111module_param(joystick, int, 0444); 111module_param(joystick, int, 0444);
diff --git a/sound/pci/intel8x0m.c b/sound/pci/intel8x0m.c
index 0f7041ec7dd..d689913a61b 100644
--- a/sound/pci/intel8x0m.c
+++ b/sound/pci/intel8x0m.c
@@ -68,7 +68,7 @@ module_param(ac97_clock, int, 0444);
68MODULE_PARM_DESC(ac97_clock, "AC'97 codec clock (0 = auto-detect)."); 68MODULE_PARM_DESC(ac97_clock, "AC'97 codec clock (0 = auto-detect).");
69 69
70/* just for backward compatibility */ 70/* just for backward compatibility */
71static int enable; 71static bool enable;
72module_param(enable, bool, 0444); 72module_param(enable, bool, 0444);
73 73
74/* 74/*
diff --git a/sound/pci/korg1212/korg1212.c b/sound/pci/korg1212/korg1212.c
index 841864b6b37..8fea45ab588 100644
--- a/sound/pci/korg1212/korg1212.c
+++ b/sound/pci/korg1212/korg1212.c
@@ -408,7 +408,7 @@ MODULE_FIRMWARE("korg/k1212.dsp");
408 408
409static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 409static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
410static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 410static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
411static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ 411static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */
412 412
413module_param_array(index, int, NULL, 0444); 413module_param_array(index, int, NULL, 0444);
414MODULE_PARM_DESC(index, "Index value for Korg 1212 soundcard."); 414MODULE_PARM_DESC(index, "Index value for Korg 1212 soundcard.");
diff --git a/sound/pci/lola/lola.c b/sound/pci/lola/lola.c
index 924168ef1ed..37598273685 100644
--- a/sound/pci/lola/lola.c
+++ b/sound/pci/lola/lola.c
@@ -35,7 +35,7 @@
35/* Standard options */ 35/* Standard options */
36static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 36static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
37static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 37static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
38static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 38static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
39 39
40module_param_array(index, int, NULL, 0444); 40module_param_array(index, int, NULL, 0444);
41MODULE_PARM_DESC(index, "Index value for Digigram Lola driver."); 41MODULE_PARM_DESC(index, "Index value for Digigram Lola driver.");
diff --git a/sound/pci/lx6464es/lx6464es.c b/sound/pci/lx6464es/lx6464es.c
index 04ae84b2a10..d94c0c292bd 100644
--- a/sound/pci/lx6464es/lx6464es.c
+++ b/sound/pci/lx6464es/lx6464es.c
@@ -42,7 +42,7 @@ MODULE_SUPPORTED_DEVICE("{digigram lx6464es{}}");
42 42
43static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 43static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
44static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 44static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
45static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 45static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
46 46
47module_param_array(index, int, NULL, 0444); 47module_param_array(index, int, NULL, 0444);
48MODULE_PARM_DESC(index, "Index value for Digigram LX6464ES interface."); 48MODULE_PARM_DESC(index, "Index value for Digigram LX6464ES interface.");
diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c
index 863c8bdaecd..78229b0dad2 100644
--- a/sound/pci/maestro3.c
+++ b/sound/pci/maestro3.c
@@ -64,8 +64,8 @@ MODULE_FIRMWARE("ess/maestro3_assp_minisrc.fw");
64 64
65static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 65static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
66static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 66static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
67static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* all enabled */ 67static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* all enabled */
68static int external_amp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; 68static bool external_amp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1};
69static int amp_gpio[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = -1}; 69static int amp_gpio[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = -1};
70 70
71module_param_array(index, int, NULL, 0444); 71module_param_array(index, int, NULL, 0444);
diff --git a/sound/pci/mixart/mixart.c b/sound/pci/mixart/mixart.c
index a0bd1d99793..487837c01c9 100644
--- a/sound/pci/mixart/mixart.c
+++ b/sound/pci/mixart/mixart.c
@@ -49,7 +49,7 @@ MODULE_SUPPORTED_DEVICE("{{Digigram," CARD_NAME "}}");
49 49
50static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 50static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
51static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 51static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
52static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 52static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
53 53
54module_param_array(index, int, NULL, 0444); 54module_param_array(index, int, NULL, 0444);
55MODULE_PARM_DESC(index, "Index value for Digigram " CARD_NAME " soundcard."); 55MODULE_PARM_DESC(index, "Index value for Digigram " CARD_NAME " soundcard.");
diff --git a/sound/pci/nm256/nm256.c b/sound/pci/nm256/nm256.c
index c6c45d979f7..ade2c64bd60 100644
--- a/sound/pci/nm256/nm256.c
+++ b/sound/pci/nm256/nm256.c
@@ -57,12 +57,12 @@ static int index = SNDRV_DEFAULT_IDX1; /* Index */
57static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ 57static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */
58static int playback_bufsize = 16; 58static int playback_bufsize = 16;
59static int capture_bufsize = 16; 59static int capture_bufsize = 16;
60static int force_ac97; /* disabled as default */ 60static bool force_ac97; /* disabled as default */
61static int buffer_top; /* not specified */ 61static int buffer_top; /* not specified */
62static int use_cache; /* disabled */ 62static bool use_cache; /* disabled */
63static int vaio_hack; /* disabled */ 63static bool vaio_hack; /* disabled */
64static int reset_workaround; 64static bool reset_workaround;
65static int reset_workaround_2; 65static bool reset_workaround_2;
66 66
67module_param(index, int, 0444); 67module_param(index, int, 0444);
68MODULE_PARM_DESC(index, "Index value for " CARD_NAME " soundcard."); 68MODULE_PARM_DESC(index, "Index value for " CARD_NAME " soundcard.");
@@ -86,7 +86,7 @@ module_param(reset_workaround_2, bool, 0444);
86MODULE_PARM_DESC(reset_workaround_2, "Enable extended AC97 RESET workaround for some other laptops."); 86MODULE_PARM_DESC(reset_workaround_2, "Enable extended AC97 RESET workaround for some other laptops.");
87 87
88/* just for backward compatibility */ 88/* just for backward compatibility */
89static int enable; 89static bool enable;
90module_param(enable, bool, 0444); 90module_param(enable, bool, 0444);
91 91
92 92
diff --git a/sound/pci/oxygen/oxygen.c b/sound/pci/oxygen/oxygen.c
index 5f3a13d4369..eab663eef11 100644
--- a/sound/pci/oxygen/oxygen.c
+++ b/sound/pci/oxygen/oxygen.c
@@ -74,7 +74,7 @@ MODULE_SUPPORTED_DEVICE("{{C-Media,CMI8786}"
74 74
75static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 75static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
76static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 76static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
77static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 77static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
78 78
79module_param_array(index, int, NULL, 0444); 79module_param_array(index, int, NULL, 0444);
80MODULE_PARM_DESC(index, "card index"); 80MODULE_PARM_DESC(index, "card index");
diff --git a/sound/pci/oxygen/virtuoso.c b/sound/pci/oxygen/virtuoso.c
index 4149a0cb8b7..3fdee495017 100644
--- a/sound/pci/oxygen/virtuoso.c
+++ b/sound/pci/oxygen/virtuoso.c
@@ -32,7 +32,7 @@ MODULE_SUPPORTED_DEVICE("{{Asus,AV66},{Asus,AV100},{Asus,AV200}}");
32 32
33static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 33static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
34static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 34static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
35static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 35static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
36 36
37module_param_array(index, int, NULL, 0444); 37module_param_array(index, int, NULL, 0444);
38MODULE_PARM_DESC(index, "card index"); 38MODULE_PARM_DESC(index, "card index");
diff --git a/sound/pci/oxygen/xonar_cs43xx.c b/sound/pci/oxygen/xonar_cs43xx.c
index 252719101c4..c8febf4b9bd 100644
--- a/sound/pci/oxygen/xonar_cs43xx.c
+++ b/sound/pci/oxygen/xonar_cs43xx.c
@@ -418,6 +418,7 @@ static const struct oxygen_model model_xonar_d1 = {
418 .device_config = PLAYBACK_0_TO_I2S | 418 .device_config = PLAYBACK_0_TO_I2S |
419 PLAYBACK_1_TO_SPDIF | 419 PLAYBACK_1_TO_SPDIF |
420 CAPTURE_0_FROM_I2S_2 | 420 CAPTURE_0_FROM_I2S_2 |
421 CAPTURE_1_FROM_SPDIF |
421 AC97_FMIC_SWITCH, 422 AC97_FMIC_SWITCH,
422 .dac_channels_pcm = 8, 423 .dac_channels_pcm = 8,
423 .dac_channels_mixer = 8, 424 .dac_channels_mixer = 8,
diff --git a/sound/pci/oxygen/xonar_dg.c b/sound/pci/oxygen/xonar_dg.c
index bc6eb58be38..793bdf03d7e 100644
--- a/sound/pci/oxygen/xonar_dg.c
+++ b/sound/pci/oxygen/xonar_dg.c
@@ -597,7 +597,8 @@ struct oxygen_model model_xonar_dg = {
597 .model_data_size = sizeof(struct dg), 597 .model_data_size = sizeof(struct dg),
598 .device_config = PLAYBACK_0_TO_I2S | 598 .device_config = PLAYBACK_0_TO_I2S |
599 PLAYBACK_1_TO_SPDIF | 599 PLAYBACK_1_TO_SPDIF |
600 CAPTURE_0_FROM_I2S_2, 600 CAPTURE_0_FROM_I2S_2 |
601 CAPTURE_1_FROM_SPDIF,
601 .dac_channels_pcm = 6, 602 .dac_channels_pcm = 6,
602 .dac_channels_mixer = 0, 603 .dac_channels_mixer = 0,
603 .function_flags = OXYGEN_FUNCTION_SPI, 604 .function_flags = OXYGEN_FUNCTION_SPI,
diff --git a/sound/pci/oxygen/xonar_wm87x6.c b/sound/pci/oxygen/xonar_wm87x6.c
index 42d1ab13621..63cff90706b 100644
--- a/sound/pci/oxygen/xonar_wm87x6.c
+++ b/sound/pci/oxygen/xonar_wm87x6.c
@@ -177,6 +177,7 @@ static void wm8776_registers_init(struct oxygen *chip)
177 struct xonar_wm87x6 *data = chip->model_data; 177 struct xonar_wm87x6 *data = chip->model_data;
178 178
179 wm8776_write(chip, WM8776_RESET, 0); 179 wm8776_write(chip, WM8776_RESET, 0);
180 wm8776_write(chip, WM8776_PHASESWAP, WM8776_PH_MASK);
180 wm8776_write(chip, WM8776_DACCTRL1, WM8776_DZCEN | 181 wm8776_write(chip, WM8776_DACCTRL1, WM8776_DZCEN |
181 WM8776_PL_LEFT_LEFT | WM8776_PL_RIGHT_RIGHT); 182 WM8776_PL_LEFT_LEFT | WM8776_PL_RIGHT_RIGHT);
182 wm8776_write(chip, WM8776_DACMUTE, chip->dac_mute ? WM8776_DMUTE : 0); 183 wm8776_write(chip, WM8776_DACMUTE, chip->dac_mute ? WM8776_DMUTE : 0);
@@ -1274,7 +1275,8 @@ static const struct oxygen_model model_xonar_ds = {
1274 .model_data_size = sizeof(struct xonar_wm87x6), 1275 .model_data_size = sizeof(struct xonar_wm87x6),
1275 .device_config = PLAYBACK_0_TO_I2S | 1276 .device_config = PLAYBACK_0_TO_I2S |
1276 PLAYBACK_1_TO_SPDIF | 1277 PLAYBACK_1_TO_SPDIF |
1277 CAPTURE_0_FROM_I2S_1, 1278 CAPTURE_0_FROM_I2S_1 |
1279 CAPTURE_1_FROM_SPDIF,
1278 .dac_channels_pcm = 8, 1280 .dac_channels_pcm = 8,
1279 .dac_channels_mixer = 8, 1281 .dac_channels_mixer = 8,
1280 .dac_volume_min = 255 - 2*60, 1282 .dac_volume_min = 255 - 2*60,
@@ -1306,7 +1308,8 @@ static const struct oxygen_model model_xonar_hdav_slim = {
1306 .model_data_size = sizeof(struct xonar_wm87x6), 1308 .model_data_size = sizeof(struct xonar_wm87x6),
1307 .device_config = PLAYBACK_0_TO_I2S | 1309 .device_config = PLAYBACK_0_TO_I2S |
1308 PLAYBACK_1_TO_SPDIF | 1310 PLAYBACK_1_TO_SPDIF |
1309 CAPTURE_0_FROM_I2S_1, 1311 CAPTURE_0_FROM_I2S_1 |
1312 CAPTURE_1_FROM_SPDIF,
1310 .dac_channels_pcm = 8, 1313 .dac_channels_pcm = 8,
1311 .dac_channels_mixer = 2, 1314 .dac_channels_mixer = 2,
1312 .dac_volume_min = 255 - 2*60, 1315 .dac_volume_min = 255 - 2*60,
diff --git a/sound/pci/pcxhr/pcxhr.c b/sound/pci/pcxhr/pcxhr.c
index 56a52659742..fd1809ab73b 100644
--- a/sound/pci/pcxhr/pcxhr.c
+++ b/sound/pci/pcxhr/pcxhr.c
@@ -52,8 +52,8 @@ MODULE_SUPPORTED_DEVICE("{{Digigram," DRIVER_NAME "}}");
52 52
53static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 53static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
54static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 54static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
55static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;/* Enable this card */ 55static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;/* Enable this card */
56static int mono[SNDRV_CARDS]; /* capture mono only */ 56static bool mono[SNDRV_CARDS]; /* capture mono only */
57 57
58module_param_array(index, int, NULL, 0444); 58module_param_array(index, int, NULL, 0444);
59MODULE_PARM_DESC(index, "Index value for Digigram " DRIVER_NAME " soundcard"); 59MODULE_PARM_DESC(index, "Index value for Digigram " DRIVER_NAME " soundcard");
diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c
index dcbedd33a62..0481d94aac9 100644
--- a/sound/pci/riptide/riptide.c
+++ b/sound/pci/riptide/riptide.c
@@ -122,7 +122,7 @@ MODULE_FIRMWARE("riptide.hex");
122 122
123static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 123static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
124static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 124static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
125static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; 125static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE;
126 126
127#ifdef SUPPORT_JOYSTICK 127#ifdef SUPPORT_JOYSTICK
128static int joystick_port[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS - 1)] = 0x200 }; 128static int joystick_port[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS - 1)] = 0x200 };
diff --git a/sound/pci/rme32.c b/sound/pci/rme32.c
index 21bcb47fab5..b4819d5e41d 100644
--- a/sound/pci/rme32.c
+++ b/sound/pci/rme32.c
@@ -89,8 +89,8 @@
89 89
90static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 90static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
91static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 91static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
92static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 92static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
93static int fullduplex[SNDRV_CARDS]; // = {[0 ... (SNDRV_CARDS - 1)] = 1}; 93static bool fullduplex[SNDRV_CARDS]; // = {[0 ... (SNDRV_CARDS - 1)] = 1};
94 94
95module_param_array(index, int, NULL, 0444); 95module_param_array(index, int, NULL, 0444);
96MODULE_PARM_DESC(index, "Index value for RME Digi32 soundcard."); 96MODULE_PARM_DESC(index, "Index value for RME Digi32 soundcard.");
diff --git a/sound/pci/rme96.c b/sound/pci/rme96.c
index 4585c9729fe..ba894158e76 100644
--- a/sound/pci/rme96.c
+++ b/sound/pci/rme96.c
@@ -53,7 +53,7 @@ MODULE_SUPPORTED_DEVICE("{{RME,Digi96},"
53 53
54static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 54static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
55static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 55static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
56static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 56static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
57 57
58module_param_array(index, int, NULL, 0444); 58module_param_array(index, int, NULL, 0444);
59MODULE_PARM_DESC(index, "Index value for RME Digi96 soundcard."); 59MODULE_PARM_DESC(index, "Index value for RME Digi96 soundcard.");
diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c
index f2a3758dac5..b68cdec03b9 100644
--- a/sound/pci/rme9652/hdsp.c
+++ b/sound/pci/rme9652/hdsp.c
@@ -45,7 +45,7 @@
45 45
46static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 46static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
47static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 47static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
48static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 48static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
49 49
50module_param_array(index, int, NULL, 0444); 50module_param_array(index, int, NULL, 0444);
51MODULE_PARM_DESC(index, "Index value for RME Hammerfall DSP interface."); 51MODULE_PARM_DESC(index, "Index value for RME Hammerfall DSP interface.");
@@ -2640,8 +2640,7 @@ static int snd_hdsp_info_pref_sync_ref(struct snd_kcontrol *kcontrol, struct snd
2640 uinfo->value.enumerated.items = 3; 2640 uinfo->value.enumerated.items = 3;
2641 break; 2641 break;
2642 default: 2642 default:
2643 uinfo->value.enumerated.items = 0; 2643 return -EINVAL;
2644 break;
2645 } 2644 }
2646 2645
2647 if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items) 2646 if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items)
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c
index 19ee2203cbb..cc9f6c83d66 100644
--- a/sound/pci/rme9652/hdspm.c
+++ b/sound/pci/rme9652/hdspm.c
@@ -61,7 +61,7 @@
61 61
62static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 62static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
63static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 63static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
64static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;/* Enable this card */ 64static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;/* Enable this card */
65 65
66module_param_array(index, int, NULL, 0444); 66module_param_array(index, int, NULL, 0444);
67MODULE_PARM_DESC(index, "Index value for RME HDSPM interface."); 67MODULE_PARM_DESC(index, "Index value for RME HDSPM interface.");
@@ -941,6 +941,8 @@ struct hdspm {
941 941
942 cycles_t last_interrupt; 942 cycles_t last_interrupt;
943 943
944 unsigned int serial;
945
944 struct hdspm_peak_rms peak_rms; 946 struct hdspm_peak_rms peak_rms;
945}; 947};
946 948
@@ -4694,7 +4696,7 @@ snd_hdspm_proc_read_madi(struct snd_info_entry * entry,
4694 4696
4695 snd_iprintf(buffer, "HW Serial: 0x%06x%06x\n", 4697 snd_iprintf(buffer, "HW Serial: 0x%06x%06x\n",
4696 (hdspm_read(hdspm, HDSPM_midiStatusIn1)>>8) & 0xFFFFFF, 4698 (hdspm_read(hdspm, HDSPM_midiStatusIn1)>>8) & 0xFFFFFF,
4697 (hdspm_read(hdspm, HDSPM_midiStatusIn0)>>8) & 0xFFFFFF); 4699 hdspm->serial);
4698 4700
4699 snd_iprintf(buffer, "IRQ: %d Registers bus: 0x%lx VM: 0x%lx\n", 4701 snd_iprintf(buffer, "IRQ: %d Registers bus: 0x%lx VM: 0x%lx\n",
4700 hdspm->irq, hdspm->port, (unsigned long)hdspm->iobase); 4702 hdspm->irq, hdspm->port, (unsigned long)hdspm->iobase);
@@ -6266,8 +6268,7 @@ static int snd_hdspm_hwdep_ioctl(struct snd_hwdep *hw, struct file *file,
6266 hdspm_version.card_type = hdspm->io_type; 6268 hdspm_version.card_type = hdspm->io_type;
6267 strncpy(hdspm_version.cardname, hdspm->card_name, 6269 strncpy(hdspm_version.cardname, hdspm->card_name,
6268 sizeof(hdspm_version.cardname)); 6270 sizeof(hdspm_version.cardname));
6269 hdspm_version.serial = (hdspm_read(hdspm, 6271 hdspm_version.serial = hdspm->serial;
6270 HDSPM_midiStatusIn0)>>8) & 0xFFFFFF;
6271 hdspm_version.firmware_rev = hdspm->firmware_rev; 6272 hdspm_version.firmware_rev = hdspm->firmware_rev;
6272 hdspm_version.addons = 0; 6273 hdspm_version.addons = 0;
6273 if (hdspm->tco) 6274 if (hdspm->tco)
@@ -6782,6 +6783,25 @@ static int __devinit snd_hdspm_create(struct snd_card *card,
6782 tasklet_init(&hdspm->midi_tasklet, 6783 tasklet_init(&hdspm->midi_tasklet,
6783 hdspm_midi_tasklet, (unsigned long) hdspm); 6784 hdspm_midi_tasklet, (unsigned long) hdspm);
6784 6785
6786
6787 if (hdspm->io_type != MADIface) {
6788 hdspm->serial = (hdspm_read(hdspm,
6789 HDSPM_midiStatusIn0)>>8) & 0xFFFFFF;
6790 /* id contains either a user-provided value or the default
6791 * NULL. If it's the default, we're safe to
6792 * fill card->id with the serial number.
6793 *
6794 * If the serial number is 0xFFFFFF, then we're dealing with
6795 * an old PCI revision that comes without a sane number. In
6796 * this case, we don't set card->id to avoid collisions
6797 * when running with multiple cards.
6798 */
6799 if (NULL == id[hdspm->dev] && hdspm->serial != 0xFFFFFF) {
6800 sprintf(card->id, "HDSPMx%06x", hdspm->serial);
6801 snd_card_set_id(card, card->id);
6802 }
6803 }
6804
6785 snd_printdd("create alsa devices.\n"); 6805 snd_printdd("create alsa devices.\n");
6786 err = snd_hdspm_create_alsa_devices(card, hdspm); 6806 err = snd_hdspm_create_alsa_devices(card, hdspm);
6787 if (err < 0) 6807 if (err < 0)
@@ -6868,10 +6888,10 @@ static int __devinit snd_hdspm_probe(struct pci_dev *pci,
6868 if (hdspm->io_type != MADIface) { 6888 if (hdspm->io_type != MADIface) {
6869 sprintf(card->shortname, "%s_%x", 6889 sprintf(card->shortname, "%s_%x",
6870 hdspm->card_name, 6890 hdspm->card_name,
6871 (hdspm_read(hdspm, HDSPM_midiStatusIn0)>>8) & 0xFFFFFF); 6891 hdspm->serial);
6872 sprintf(card->longname, "%s S/N 0x%x at 0x%lx, irq %d", 6892 sprintf(card->longname, "%s S/N 0x%x at 0x%lx, irq %d",
6873 hdspm->card_name, 6893 hdspm->card_name,
6874 (hdspm_read(hdspm, HDSPM_midiStatusIn0)>>8) & 0xFFFFFF, 6894 hdspm->serial,
6875 hdspm->port, hdspm->irq); 6895 hdspm->port, hdspm->irq);
6876 } else { 6896 } else {
6877 sprintf(card->shortname, "%s", hdspm->card_name); 6897 sprintf(card->shortname, "%s", hdspm->card_name);
diff --git a/sound/pci/rme9652/rme9652.c b/sound/pci/rme9652/rme9652.c
index 732c5e83743..b737d1619cc 100644
--- a/sound/pci/rme9652/rme9652.c
+++ b/sound/pci/rme9652/rme9652.c
@@ -38,8 +38,8 @@
38 38
39static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 39static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
40static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 40static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
41static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 41static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
42static int precise_ptr[SNDRV_CARDS]; /* Enable precise pointer */ 42static bool precise_ptr[SNDRV_CARDS]; /* Enable precise pointer */
43 43
44module_param_array(index, int, NULL, 0444); 44module_param_array(index, int, NULL, 0444);
45MODULE_PARM_DESC(index, "Index value for RME Digi9652 (Hammerfall) soundcard."); 45MODULE_PARM_DESC(index, "Index value for RME Digi9652 (Hammerfall) soundcard.");
diff --git a/sound/pci/sis7019.c b/sound/pci/sis7019.c
index a391e622a19..ff500a87f76 100644
--- a/sound/pci/sis7019.c
+++ b/sound/pci/sis7019.c
@@ -40,7 +40,8 @@ MODULE_SUPPORTED_DEVICE("{{SiS,SiS7019 Audio Accelerator}}");
40 40
41static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */ 41static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */
42static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ 42static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */
43static int enable = 1; 43static bool enable = 1;
44static int codecs = 1;
44 45
45module_param(index, int, 0444); 46module_param(index, int, 0444);
46MODULE_PARM_DESC(index, "Index value for SiS7019 Audio Accelerator."); 47MODULE_PARM_DESC(index, "Index value for SiS7019 Audio Accelerator.");
@@ -48,6 +49,8 @@ module_param(id, charp, 0444);
48MODULE_PARM_DESC(id, "ID string for SiS7019 Audio Accelerator."); 49MODULE_PARM_DESC(id, "ID string for SiS7019 Audio Accelerator.");
49module_param(enable, bool, 0444); 50module_param(enable, bool, 0444);
50MODULE_PARM_DESC(enable, "Enable SiS7019 Audio Accelerator."); 51MODULE_PARM_DESC(enable, "Enable SiS7019 Audio Accelerator.");
52module_param(codecs, int, 0444);
53MODULE_PARM_DESC(codecs, "Set bit to indicate that codec number is expected to be present (default 1)");
51 54
52static DEFINE_PCI_DEVICE_TABLE(snd_sis7019_ids) = { 55static DEFINE_PCI_DEVICE_TABLE(snd_sis7019_ids) = {
53 { PCI_DEVICE(PCI_VENDOR_ID_SI, 0x7019) }, 56 { PCI_DEVICE(PCI_VENDOR_ID_SI, 0x7019) },
@@ -140,6 +143,9 @@ struct sis7019 {
140 dma_addr_t silence_dma_addr; 143 dma_addr_t silence_dma_addr;
141}; 144};
142 145
146/* These values are also used by the module param 'codecs' to indicate
147 * which codecs should be present.
148 */
143#define SIS_PRIMARY_CODEC_PRESENT 0x0001 149#define SIS_PRIMARY_CODEC_PRESENT 0x0001
144#define SIS_SECONDARY_CODEC_PRESENT 0x0002 150#define SIS_SECONDARY_CODEC_PRESENT 0x0002
145#define SIS_TERTIARY_CODEC_PRESENT 0x0004 151#define SIS_TERTIARY_CODEC_PRESENT 0x0004
@@ -977,7 +983,7 @@ timeout:
977 mutex_unlock(&sis->ac97_mutex); 983 mutex_unlock(&sis->ac97_mutex);
978 984
979 if (!count) { 985 if (!count) {
980 printk(KERN_ERR "sis7019: ac97 codec %d timeout cmd 0x%08x\n", 986 dev_err(&sis->pci->dev, "ac97 codec %d timeout cmd 0x%08x\n",
981 codec, cmd); 987 codec, cmd);
982 } 988 }
983 989
@@ -1078,6 +1084,7 @@ static int sis_chip_init(struct sis7019 *sis)
1078{ 1084{
1079 unsigned long io = sis->ioport; 1085 unsigned long io = sis->ioport;
1080 void __iomem *ioaddr = sis->ioaddr; 1086 void __iomem *ioaddr = sis->ioaddr;
1087 unsigned long timeout;
1081 u16 status; 1088 u16 status;
1082 int count; 1089 int count;
1083 int i; 1090 int i;
@@ -1104,21 +1111,45 @@ static int sis_chip_init(struct sis7019 *sis)
1104 while ((inw(io + SIS_AC97_STATUS) & SIS_AC97_STATUS_BUSY) && --count) 1111 while ((inw(io + SIS_AC97_STATUS) & SIS_AC97_STATUS_BUSY) && --count)
1105 udelay(1); 1112 udelay(1);
1106 1113
1114 /* Command complete, we can let go of the semaphore now.
1115 */
1116 outl(SIS_AC97_SEMA_RELEASE, io + SIS_AC97_SEMA);
1117 if (!count)
1118 return -EIO;
1119
1107 /* Now that we've finished the reset, find out what's attached. 1120 /* Now that we've finished the reset, find out what's attached.
1121 * There are some codec/board combinations that take an extremely
1122 * long time to come up. 350+ ms has been observed in the field,
1123 * so we'll give them up to 500ms.
1108 */ 1124 */
1109 status = inl(io + SIS_AC97_STATUS); 1125 sis->codecs_present = 0;
1110 if (status & SIS_AC97_STATUS_CODEC_READY) 1126 timeout = msecs_to_jiffies(500) + jiffies;
1111 sis->codecs_present |= SIS_PRIMARY_CODEC_PRESENT; 1127 while (time_before_eq(jiffies, timeout)) {
1112 if (status & SIS_AC97_STATUS_CODEC2_READY) 1128 status = inl(io + SIS_AC97_STATUS);
1113 sis->codecs_present |= SIS_SECONDARY_CODEC_PRESENT; 1129 if (status & SIS_AC97_STATUS_CODEC_READY)
1114 if (status & SIS_AC97_STATUS_CODEC3_READY) 1130 sis->codecs_present |= SIS_PRIMARY_CODEC_PRESENT;
1115 sis->codecs_present |= SIS_TERTIARY_CODEC_PRESENT; 1131 if (status & SIS_AC97_STATUS_CODEC2_READY)
1116 1132 sis->codecs_present |= SIS_SECONDARY_CODEC_PRESENT;
1117 /* All done, let go of the semaphore, and check for errors 1133 if (status & SIS_AC97_STATUS_CODEC3_READY)
1134 sis->codecs_present |= SIS_TERTIARY_CODEC_PRESENT;
1135
1136 if (sis->codecs_present == codecs)
1137 break;
1138
1139 msleep(1);
1140 }
1141
1142 /* All done, check for errors.
1118 */ 1143 */
1119 outl(SIS_AC97_SEMA_RELEASE, io + SIS_AC97_SEMA); 1144 if (!sis->codecs_present) {
1120 if (!sis->codecs_present || !count) 1145 dev_err(&sis->pci->dev, "could not find any codecs\n");
1121 return -EIO; 1146 return -EIO;
1147 }
1148
1149 if (sis->codecs_present != codecs) {
1150 dev_warn(&sis->pci->dev, "missing codecs, found %0x, expected %0x\n",
1151 sis->codecs_present, codecs);
1152 }
1122 1153
1123 /* Let the hardware know that the audio driver is alive, 1154 /* Let the hardware know that the audio driver is alive,
1124 * and enable PCM slots on the AC-link for L/R playback (3 & 4) and 1155 * and enable PCM slots on the AC-link for L/R playback (3 & 4) and
@@ -1225,18 +1256,18 @@ static int sis_resume(struct pci_dev *pci)
1225 pci_restore_state(pci); 1256 pci_restore_state(pci);
1226 1257
1227 if (pci_enable_device(pci) < 0) { 1258 if (pci_enable_device(pci) < 0) {
1228 printk(KERN_ERR "sis7019: unable to re-enable device\n"); 1259 dev_err(&pci->dev, "unable to re-enable device\n");
1229 goto error; 1260 goto error;
1230 } 1261 }
1231 1262
1232 if (sis_chip_init(sis)) { 1263 if (sis_chip_init(sis)) {
1233 printk(KERN_ERR "sis7019: unable to re-init controller\n"); 1264 dev_err(&pci->dev, "unable to re-init controller\n");
1234 goto error; 1265 goto error;
1235 } 1266 }
1236 1267
1237 if (request_irq(pci->irq, sis_interrupt, IRQF_SHARED, 1268 if (request_irq(pci->irq, sis_interrupt, IRQF_SHARED,
1238 KBUILD_MODNAME, sis)) { 1269 KBUILD_MODNAME, sis)) {
1239 printk(KERN_ERR "sis7019: unable to regain IRQ %d\n", pci->irq); 1270 dev_err(&pci->dev, "unable to regain IRQ %d\n", pci->irq);
1240 goto error; 1271 goto error;
1241 } 1272 }
1242 1273
@@ -1304,8 +1335,7 @@ static int __devinit sis_chip_create(struct snd_card *card,
1304 goto error_out; 1335 goto error_out;
1305 1336
1306 if (pci_set_dma_mask(pci, DMA_BIT_MASK(30)) < 0) { 1337 if (pci_set_dma_mask(pci, DMA_BIT_MASK(30)) < 0) {
1307 printk(KERN_ERR "sis7019: architecture does not support " 1338 dev_err(&pci->dev, "architecture does not support 30-bit PCI busmaster DMA");
1308 "30-bit PCI busmaster DMA");
1309 goto error_out_enabled; 1339 goto error_out_enabled;
1310 } 1340 }
1311 1341
@@ -1319,20 +1349,20 @@ static int __devinit sis_chip_create(struct snd_card *card,
1319 1349
1320 rc = pci_request_regions(pci, "SiS7019"); 1350 rc = pci_request_regions(pci, "SiS7019");
1321 if (rc) { 1351 if (rc) {
1322 printk(KERN_ERR "sis7019: unable request regions\n"); 1352 dev_err(&pci->dev, "unable request regions\n");
1323 goto error_out_enabled; 1353 goto error_out_enabled;
1324 } 1354 }
1325 1355
1326 rc = -EIO; 1356 rc = -EIO;
1327 sis->ioaddr = ioremap_nocache(pci_resource_start(pci, 1), 0x4000); 1357 sis->ioaddr = ioremap_nocache(pci_resource_start(pci, 1), 0x4000);
1328 if (!sis->ioaddr) { 1358 if (!sis->ioaddr) {
1329 printk(KERN_ERR "sis7019: unable to remap MMIO, aborting\n"); 1359 dev_err(&pci->dev, "unable to remap MMIO, aborting\n");
1330 goto error_out_cleanup; 1360 goto error_out_cleanup;
1331 } 1361 }
1332 1362
1333 rc = sis_alloc_suspend(sis); 1363 rc = sis_alloc_suspend(sis);
1334 if (rc < 0) { 1364 if (rc < 0) {
1335 printk(KERN_ERR "sis7019: unable to allocate state storage\n"); 1365 dev_err(&pci->dev, "unable to allocate state storage\n");
1336 goto error_out_cleanup; 1366 goto error_out_cleanup;
1337 } 1367 }
1338 1368
@@ -1340,9 +1370,9 @@ static int __devinit sis_chip_create(struct snd_card *card,
1340 if (rc) 1370 if (rc)
1341 goto error_out_cleanup; 1371 goto error_out_cleanup;
1342 1372
1343 if (request_irq(pci->irq, sis_interrupt, IRQF_SHARED, 1373 if (request_irq(pci->irq, sis_interrupt, IRQF_SHARED, KBUILD_MODNAME,
1344 KBUILD_MODNAME, sis)) { 1374 sis)) {
1345 printk(KERN_ERR "unable to allocate irq %d\n", sis->irq); 1375 dev_err(&pci->dev, "unable to allocate irq %d\n", sis->irq);
1346 goto error_out_cleanup; 1376 goto error_out_cleanup;
1347 } 1377 }
1348 1378
@@ -1390,6 +1420,17 @@ static int __devinit snd_sis7019_probe(struct pci_dev *pci,
1390 if (!enable) 1420 if (!enable)
1391 goto error_out; 1421 goto error_out;
1392 1422
1423 /* The user can specify which codecs should be present so that we
1424 * can wait for them to show up if they are slow to recover from
1425 * the AC97 cold reset. We default to a single codec, the primary.
1426 *
1427 * We assume that SIS_PRIMARY_*_PRESENT matches bits 0-2.
1428 */
1429 codecs &= SIS_PRIMARY_CODEC_PRESENT | SIS_SECONDARY_CODEC_PRESENT |
1430 SIS_TERTIARY_CODEC_PRESENT;
1431 if (!codecs)
1432 codecs = SIS_PRIMARY_CODEC_PRESENT;
1433
1393 rc = snd_card_create(index, id, THIS_MODULE, sizeof(*sis), &card); 1434 rc = snd_card_create(index, id, THIS_MODULE, sizeof(*sis), &card);
1394 if (rc < 0) 1435 if (rc < 0)
1395 goto error_out; 1436 goto error_out;
diff --git a/sound/pci/sonicvibes.c b/sound/pci/sonicvibes.c
index 31b6ad3ab1d..54cc802050f 100644
--- a/sound/pci/sonicvibes.c
+++ b/sound/pci/sonicvibes.c
@@ -52,9 +52,9 @@ MODULE_SUPPORTED_DEVICE("{{S3,SonicVibes PCI}}");
52 52
53static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 53static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
54static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 54static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
55static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 55static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
56static int reverb[SNDRV_CARDS]; 56static bool reverb[SNDRV_CARDS];
57static int mge[SNDRV_CARDS]; 57static bool mge[SNDRV_CARDS];
58static unsigned int dmaio = 0x7a00; /* DDMA i/o address */ 58static unsigned int dmaio = 0x7a00; /* DDMA i/o address */
59 59
60module_param_array(index, int, NULL, 0444); 60module_param_array(index, int, NULL, 0444);
diff --git a/sound/pci/trident/trident.c b/sound/pci/trident/trident.c
index deb04b92412..5f1def7f45e 100644
--- a/sound/pci/trident/trident.c
+++ b/sound/pci/trident/trident.c
@@ -47,7 +47,7 @@ MODULE_SUPPORTED_DEVICE("{{Trident,4DWave DX},"
47 47
48static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 48static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
49static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 49static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
50static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 50static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
51static int pcm_channels[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 32}; 51static int pcm_channels[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 32};
52static int wavetable_size[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 8192}; 52static int wavetable_size[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 8192};
53 53
diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c
index ae98d56d05b..75630408c6d 100644
--- a/sound/pci/via82xx.c
+++ b/sound/pci/via82xx.c
@@ -80,7 +80,7 @@ static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */
80static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ 80static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */
81static long mpu_port; 81static long mpu_port;
82#ifdef SUPPORT_JOYSTICK 82#ifdef SUPPORT_JOYSTICK
83static int joystick; 83static bool joystick;
84#endif 84#endif
85static int ac97_clock = 48000; 85static int ac97_clock = 48000;
86static char *ac97_quirk; 86static char *ac97_quirk;
@@ -110,7 +110,7 @@ module_param(nodelay, int, 0444);
110MODULE_PARM_DESC(nodelay, "Disable 500ms init delay"); 110MODULE_PARM_DESC(nodelay, "Disable 500ms init delay");
111 111
112/* just for backward compatibility */ 112/* just for backward compatibility */
113static int enable; 113static bool enable;
114module_param(enable, bool, 0444); 114module_param(enable, bool, 0444);
115 115
116 116
diff --git a/sound/pci/via82xx_modem.c b/sound/pci/via82xx_modem.c
index 80a9c2bf330..5efcbcac506 100644
--- a/sound/pci/via82xx_modem.c
+++ b/sound/pci/via82xx_modem.c
@@ -66,7 +66,7 @@ module_param(ac97_clock, int, 0444);
66MODULE_PARM_DESC(ac97_clock, "AC'97 codec clock (default 48000Hz)."); 66MODULE_PARM_DESC(ac97_clock, "AC'97 codec clock (default 48000Hz).");
67 67
68/* just for backward compatibility */ 68/* just for backward compatibility */
69static int enable; 69static bool enable;
70module_param(enable, bool, 0444); 70module_param(enable, bool, 0444);
71 71
72 72
diff --git a/sound/pci/vx222/vx222.c b/sound/pci/vx222/vx222.c
index 6765822fb3b..6a534bfe127 100644
--- a/sound/pci/vx222/vx222.c
+++ b/sound/pci/vx222/vx222.c
@@ -37,8 +37,8 @@ MODULE_SUPPORTED_DEVICE("{{Digigram," CARD_NAME "}}");
37 37
38static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 38static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
39static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 39static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
40static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 40static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
41static int mic[SNDRV_CARDS]; /* microphone */ 41static bool mic[SNDRV_CARDS]; /* microphone */
42static int ibl[SNDRV_CARDS]; /* microphone */ 42static int ibl[SNDRV_CARDS]; /* microphone */
43 43
44module_param_array(index, int, NULL, 0444); 44module_param_array(index, int, NULL, 0444);
diff --git a/sound/pci/ymfpci/ymfpci.c b/sound/pci/ymfpci/ymfpci.c
index e97ddcac0d3..e57b89e8aa8 100644
--- a/sound/pci/ymfpci/ymfpci.c
+++ b/sound/pci/ymfpci/ymfpci.c
@@ -41,13 +41,13 @@ MODULE_SUPPORTED_DEVICE("{{Yamaha,YMF724},"
41 41
42static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 42static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
43static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 43static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
44static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 44static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
45static long fm_port[SNDRV_CARDS]; 45static long fm_port[SNDRV_CARDS];
46static long mpu_port[SNDRV_CARDS]; 46static long mpu_port[SNDRV_CARDS];
47#ifdef SUPPORT_JOYSTICK 47#ifdef SUPPORT_JOYSTICK
48static long joystick_port[SNDRV_CARDS]; 48static long joystick_port[SNDRV_CARDS];
49#endif 49#endif
50static int rear_switch[SNDRV_CARDS]; 50static bool rear_switch[SNDRV_CARDS];
51 51
52module_param_array(index, int, NULL, 0444); 52module_param_array(index, int, NULL, 0444);
53MODULE_PARM_DESC(index, "Index value for the Yamaha DS-1 PCI soundcard."); 53MODULE_PARM_DESC(index, "Index value for the Yamaha DS-1 PCI soundcard.");
diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf.c b/sound/pcmcia/pdaudiocf/pdaudiocf.c
index 6af41d2d8fc..830839a874b 100644
--- a/sound/pcmcia/pdaudiocf/pdaudiocf.c
+++ b/sound/pcmcia/pdaudiocf/pdaudiocf.c
@@ -39,7 +39,7 @@ MODULE_SUPPORTED_DEVICE("{{Sound Core," CARD_NAME "}}");
39 39
40static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 40static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
41static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 41static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
42static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable switches */ 42static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable switches */
43 43
44module_param_array(index, int, NULL, 0444); 44module_param_array(index, int, NULL, 0444);
45MODULE_PARM_DESC(index, "Index value for " CARD_NAME " soundcard."); 45MODULE_PARM_DESC(index, "Index value for " CARD_NAME " soundcard.");
diff --git a/sound/pcmcia/vx/vxpocket.c b/sound/pcmcia/vx/vxpocket.c
index 9e361c9d5bf..512f0b47237 100644
--- a/sound/pcmcia/vx/vxpocket.c
+++ b/sound/pcmcia/vx/vxpocket.c
@@ -39,7 +39,7 @@ MODULE_SUPPORTED_DEVICE("{{Digigram,VXPocket},{Digigram,VXPocket440}}");
39 39
40static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 40static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
41static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 41static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
42static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable switches */ 42static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable switches */
43static int ibl[SNDRV_CARDS]; 43static int ibl[SNDRV_CARDS];
44 44
45module_param_array(index, int, NULL, 0444); 45module_param_array(index, int, NULL, 0444);
diff --git a/sound/ppc/powermac.c b/sound/ppc/powermac.c
index 65645693c48..5a4e263b5b0 100644
--- a/sound/ppc/powermac.c
+++ b/sound/ppc/powermac.c
@@ -36,7 +36,7 @@ MODULE_LICENSE("GPL");
36 36
37static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */ 37static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */
38static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ 38static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */
39static int enable_beep = 1; 39static bool enable_beep = 1;
40 40
41module_param(index, int, 0444); 41module_param(index, int, 0444);
42MODULE_PARM_DESC(index, "Index value for " CHIP_NAME " soundchip."); 42MODULE_PARM_DESC(index, "Index value for " CHIP_NAME " soundchip.");
diff --git a/sound/sh/aica.c b/sound/sh/aica.c
index 1120ca49edd..391a38ca58b 100644
--- a/sound/sh/aica.c
+++ b/sound/sh/aica.c
@@ -55,7 +55,7 @@ MODULE_FIRMWARE("aica_firmware.bin");
55#define CARD_NAME "AICA" 55#define CARD_NAME "AICA"
56static int index = -1; 56static int index = -1;
57static char *id; 57static char *id;
58static int enable = 1; 58static bool enable = 1;
59module_param(index, int, 0444); 59module_param(index, int, 0444);
60MODULE_PARM_DESC(index, "Index value for " CARD_NAME " soundcard."); 60MODULE_PARM_DESC(index, "Index value for " CARD_NAME " soundcard.");
61module_param(id, charp, 0444); 61module_param(id, charp, 0444);
diff --git a/sound/sh/sh_dac_audio.c b/sound/sh/sh_dac_audio.c
index 56bcb46abf0..b11f82b5718 100644
--- a/sound/sh/sh_dac_audio.c
+++ b/sound/sh/sh_dac_audio.c
@@ -441,15 +441,4 @@ static struct platform_driver driver = {
441 }, 441 },
442}; 442};
443 443
444static int __init sh_dac_init(void) 444module_platform_driver(driver);
445{
446 return platform_driver_register(&driver);
447}
448
449static void __exit sh_dac_exit(void)
450{
451 platform_driver_unregister(&driver);
452}
453
454module_init(sh_dac_init);
455module_exit(sh_dac_exit);
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 bee3c94f58b..72b09cfd3dc 100644
--- a/sound/soc/atmel/Kconfig
+++ b/sound/soc/atmel/Kconfig
@@ -1,6 +1,6 @@
1config SND_ATMEL_SOC 1config SND_ATMEL_SOC
2 tristate "SoC Audio for the Atmel System-on-Chip" 2 tristate "SoC Audio for the Atmel System-on-Chip"
3 depends on ARCH_AT91 || AVR32 3 depends on ARCH_AT91
4 help 4 help
5 Say Y or M if you want to add support for codecs attached to 5 Say Y or M if you want to add support for codecs attached to
6 the ATMEL SSC interface. You will also need 6 the ATMEL SSC interface. You will also need
@@ -24,28 +24,9 @@ config SND_AT91_SOC_SAM9G20_WM8731
24 Say Y if you want to add support for SoC audio on WM8731-based 24 Say Y if you want to add support for SoC audio on WM8731-based
25 AT91sam9g20 evaluation board. 25 AT91sam9g20 evaluation board.
26 26
27config SND_AT32_SOC_PLAYPAQ
28 tristate "SoC Audio support for PlayPaq with WM8510"
29 depends on SND_ATMEL_SOC && BOARD_PLAYPAQ && AT91_PROGRAMMABLE_CLOCKS
30 select SND_ATMEL_SOC_SSC
31 select SND_SOC_WM8510
32 help
33 Say Y or M here if you want to add support for SoC audio
34 on the LRS PlayPaq.
35
36config SND_AT32_SOC_PLAYPAQ_SLAVE
37 bool "Run CODEC on PlayPaq in slave mode"
38 depends on SND_AT32_SOC_PLAYPAQ
39 default n
40 help
41 Say Y if you want to run with the AT32 SSC generating the BCLK
42 and FRAME signals on the PlayPaq. Unless you want to play
43 with the AT32 as the SSC master, you probably want to say N here,
44 as this will give you better sound quality.
45
46config SND_AT91_SOC_AFEB9260 27config SND_AT91_SOC_AFEB9260
47 tristate "SoC Audio support for AFEB9260 board" 28 tristate "SoC Audio support for AFEB9260 board"
48 depends on ARCH_AT91 && MACH_AFEB9260 && SND_ATMEL_SOC 29 depends on ATMEL_SSC && ARCH_AT91 && MACH_AFEB9260 && SND_ATMEL_SOC
49 select SND_ATMEL_SOC_SSC 30 select SND_ATMEL_SOC_SSC
50 select SND_SOC_TLV320AIC23 31 select SND_SOC_TLV320AIC23
51 help 32 help
diff --git a/sound/soc/atmel/Makefile b/sound/soc/atmel/Makefile
index e7ea56bd5f8..a5c0bf19da7 100644
--- a/sound/soc/atmel/Makefile
+++ b/sound/soc/atmel/Makefile
@@ -8,9 +8,5 @@ obj-$(CONFIG_SND_ATMEL_SOC_SSC) += snd-soc-atmel_ssc_dai.o
8# AT91 Machine Support 8# AT91 Machine Support
9snd-soc-sam9g20-wm8731-objs := sam9g20_wm8731.o 9snd-soc-sam9g20-wm8731-objs := sam9g20_wm8731.o
10 10
11# AT32 Machine Support
12snd-soc-playpaq-objs := playpaq_wm8510.o
13
14obj-$(CONFIG_SND_AT91_SOC_SAM9G20_WM8731) += snd-soc-sam9g20-wm8731.o 11obj-$(CONFIG_SND_AT91_SOC_SAM9G20_WM8731) += snd-soc-sam9g20-wm8731.o
15obj-$(CONFIG_SND_AT32_SOC_PLAYPAQ) += snd-soc-playpaq.o
16obj-$(CONFIG_SND_AT91_SOC_AFEB9260) += snd-soc-afeb9260.o 12obj-$(CONFIG_SND_AT91_SOC_AFEB9260) += snd-soc-afeb9260.o
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/playpaq_wm8510.c b/sound/soc/atmel/playpaq_wm8510.c
deleted file mode 100644
index 73ae99ad457..00000000000
--- a/sound/soc/atmel/playpaq_wm8510.c
+++ /dev/null
@@ -1,473 +0,0 @@
1/* sound/soc/at32/playpaq_wm8510.c
2 * ASoC machine driver for PlayPaq using WM8510 codec
3 *
4 * Copyright (C) 2008 Long Range Systems
5 * Geoffrey Wossum <gwossum@acm.org>
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
10 *
11 * This code is largely inspired by sound/soc/at91/eti_b1_wm8731.c
12 *
13 * NOTE: If you don't have the AT32 enhanced portmux configured (which
14 * isn't currently in the mainline or Atmel patched kernel), you will
15 * need to set the MCLK pin (PA30) to peripheral A in your board initialization
16 * code. Something like:
17 * at32_select_periph(GPIO_PIN_PA(30), GPIO_PERIPH_A, 0);
18 *
19 */
20
21/* #define DEBUG */
22
23#include <linux/module.h>
24#include <linux/moduleparam.h>
25#include <linux/kernel.h>
26#include <linux/errno.h>
27#include <linux/clk.h>
28#include <linux/timer.h>
29#include <linux/interrupt.h>
30#include <linux/platform_device.h>
31
32#include <sound/core.h>
33#include <sound/pcm.h>
34#include <sound/pcm_params.h>
35#include <sound/soc.h>
36
37#include <mach/at32ap700x.h>
38#include <mach/portmux.h>
39
40#include "../codecs/wm8510.h"
41#include "atmel-pcm.h"
42#include "atmel_ssc_dai.h"
43
44
45/*-------------------------------------------------------------------------*\
46 * constants
47\*-------------------------------------------------------------------------*/
48#define MCLK_PIN GPIO_PIN_PA(30)
49#define MCLK_PERIPH GPIO_PERIPH_A
50
51
52/*-------------------------------------------------------------------------*\
53 * data types
54\*-------------------------------------------------------------------------*/
55/* SSC clocking data */
56struct ssc_clock_data {
57 /* CMR div */
58 unsigned int cmr_div;
59
60 /* Frame period (as needed by xCMR.PERIOD) */
61 unsigned int period;
62
63 /* The SSC clock rate these settings where calculated for */
64 unsigned long ssc_rate;
65};
66
67
68/*-------------------------------------------------------------------------*\
69 * module data
70\*-------------------------------------------------------------------------*/
71static struct clk *_gclk0;
72static struct clk *_pll0;
73
74#define CODEC_CLK (_gclk0)
75
76
77/*-------------------------------------------------------------------------*\
78 * Sound SOC operations
79\*-------------------------------------------------------------------------*/
80#if defined CONFIG_SND_AT32_SOC_PLAYPAQ_SLAVE
81static struct ssc_clock_data playpaq_wm8510_calc_ssc_clock(
82 struct snd_pcm_hw_params *params,
83 struct snd_soc_dai *cpu_dai)
84{
85 struct at32_ssc_info *ssc_p = snd_soc_dai_get_drvdata(cpu_dai);
86 struct ssc_device *ssc = ssc_p->ssc;
87 struct ssc_clock_data cd;
88 unsigned int rate, width_bits, channels;
89 unsigned int bitrate, ssc_div;
90 unsigned actual_rate;
91
92
93 /*
94 * Figure out required bitrate
95 */
96 rate = params_rate(params);
97 channels = params_channels(params);
98 width_bits = snd_pcm_format_physical_width(params_format(params));
99 bitrate = rate * width_bits * channels;
100
101
102 /*
103 * Figure out required SSC divider and period for required bitrate
104 */
105 cd.ssc_rate = clk_get_rate(ssc->clk);
106 ssc_div = cd.ssc_rate / bitrate;
107 cd.cmr_div = ssc_div / 2;
108 if (ssc_div & 1) {
109 /* round cmr_div up */
110 cd.cmr_div++;
111 }
112 cd.period = width_bits - 1;
113
114
115 /*
116 * Find actual rate, compare to requested rate
117 */
118 actual_rate = (cd.ssc_rate / (cd.cmr_div * 2)) / (2 * (cd.period + 1));
119 pr_debug("playpaq_wm8510: Request rate = %u, actual rate = %u\n",
120 rate, actual_rate);
121
122
123 return cd;
124}
125#endif /* CONFIG_SND_AT32_SOC_PLAYPAQ_SLAVE */
126
127
128
129static int playpaq_wm8510_hw_params(struct snd_pcm_substream *substream,
130 struct snd_pcm_hw_params *params)
131{
132 struct snd_soc_pcm_runtime *rtd = substream->private_data;
133 struct snd_soc_dai *codec_dai = rtd->codec_dai;
134 struct snd_soc_dai *cpu_dai = rtd->cpu_dai;
135 struct at32_ssc_info *ssc_p = snd_soc_dai_get_drvdata(cpu_dai);
136 struct ssc_device *ssc = ssc_p->ssc;
137 unsigned int pll_out = 0, bclk = 0, mclk_div = 0;
138 int ret;
139
140
141 /* Due to difficulties with getting the correct clocks from the AT32's
142 * PLL0, we're going to let the CODEC be in charge of all the clocks
143 */
144#if !defined CONFIG_SND_AT32_SOC_PLAYPAQ_SLAVE
145 const unsigned int fmt = (SND_SOC_DAIFMT_I2S |
146 SND_SOC_DAIFMT_NB_NF |
147 SND_SOC_DAIFMT_CBM_CFM);
148#else
149 struct ssc_clock_data cd;
150 const unsigned int fmt = (SND_SOC_DAIFMT_I2S |
151 SND_SOC_DAIFMT_NB_NF |
152 SND_SOC_DAIFMT_CBS_CFS);
153#endif
154
155 if (ssc == NULL) {
156 pr_warning("playpaq_wm8510_hw_params: ssc is NULL!\n");
157 return -EINVAL;
158 }
159
160
161 /*
162 * Figure out PLL and BCLK dividers for WM8510
163 */
164 switch (params_rate(params)) {
165 case 48000:
166 pll_out = 24576000;
167 mclk_div = WM8510_MCLKDIV_2;
168 bclk = WM8510_BCLKDIV_8;
169 break;
170
171 case 44100:
172 pll_out = 22579200;
173 mclk_div = WM8510_MCLKDIV_2;
174 bclk = WM8510_BCLKDIV_8;
175 break;
176
177 case 22050:
178 pll_out = 22579200;
179 mclk_div = WM8510_MCLKDIV_4;
180 bclk = WM8510_BCLKDIV_8;
181 break;
182
183 case 16000:
184 pll_out = 24576000;
185 mclk_div = WM8510_MCLKDIV_6;
186 bclk = WM8510_BCLKDIV_8;
187 break;
188
189 case 11025:
190 pll_out = 22579200;
191 mclk_div = WM8510_MCLKDIV_8;
192 bclk = WM8510_BCLKDIV_8;
193 break;
194
195 case 8000:
196 pll_out = 24576000;
197 mclk_div = WM8510_MCLKDIV_12;
198 bclk = WM8510_BCLKDIV_8;
199 break;
200
201 default:
202 pr_warning("playpaq_wm8510: Unsupported sample rate %d\n",
203 params_rate(params));
204 return -EINVAL;
205 }
206
207
208 /*
209 * set CPU and CODEC DAI configuration
210 */
211 ret = snd_soc_dai_set_fmt(codec_dai, fmt);
212 if (ret < 0) {
213 pr_warning("playpaq_wm8510: "
214 "Failed to set CODEC DAI format (%d)\n",
215 ret);
216 return ret;
217 }
218 ret = snd_soc_dai_set_fmt(cpu_dai, fmt);
219 if (ret < 0) {
220 pr_warning("playpaq_wm8510: "
221 "Failed to set CPU DAI format (%d)\n",
222 ret);
223 return ret;
224 }
225
226
227 /*
228 * Set CPU clock configuration
229 */
230#if defined CONFIG_SND_AT32_SOC_PLAYPAQ_SLAVE
231 cd = playpaq_wm8510_calc_ssc_clock(params, cpu_dai);
232 pr_debug("playpaq_wm8510: cmr_div = %d, period = %d\n",
233 cd.cmr_div, cd.period);
234 ret = snd_soc_dai_set_clkdiv(cpu_dai, AT32_SSC_CMR_DIV, cd.cmr_div);
235 if (ret < 0) {
236 pr_warning("playpaq_wm8510: Failed to set CPU CMR_DIV (%d)\n",
237 ret);
238 return ret;
239 }
240 ret = snd_soc_dai_set_clkdiv(cpu_dai, AT32_SSC_TCMR_PERIOD,
241 cd.period);
242 if (ret < 0) {
243 pr_warning("playpaq_wm8510: "
244 "Failed to set CPU transmit period (%d)\n",
245 ret);
246 return ret;
247 }
248#endif /* CONFIG_SND_AT32_SOC_PLAYPAQ_SLAVE */
249
250
251 /*
252 * Set CODEC clock configuration
253 */
254 pr_debug("playpaq_wm8510: "
255 "pll_in = %ld, pll_out = %u, bclk = %x, mclk = %x\n",
256 clk_get_rate(CODEC_CLK), pll_out, bclk, mclk_div);
257
258
259#if !defined CONFIG_SND_AT32_SOC_PLAYPAQ_SLAVE
260 ret = snd_soc_dai_set_clkdiv(codec_dai, WM8510_BCLKDIV, bclk);
261 if (ret < 0) {
262 pr_warning
263 ("playpaq_wm8510: Failed to set CODEC DAI BCLKDIV (%d)\n",
264 ret);
265 return ret;
266 }
267#endif /* CONFIG_SND_AT32_SOC_PLAYPAQ_SLAVE */
268
269
270 ret = snd_soc_dai_set_pll(codec_dai, 0, 0,
271 clk_get_rate(CODEC_CLK), pll_out);
272 if (ret < 0) {
273 pr_warning("playpaq_wm8510: Failed to set CODEC DAI PLL (%d)\n",
274 ret);
275 return ret;
276 }
277
278
279 ret = snd_soc_dai_set_clkdiv(codec_dai, WM8510_MCLKDIV, mclk_div);
280 if (ret < 0) {
281 pr_warning("playpaq_wm8510: Failed to set CODEC MCLKDIV (%d)\n",
282 ret);
283 return ret;
284 }
285
286
287 return 0;
288}
289
290
291
292static struct snd_soc_ops playpaq_wm8510_ops = {
293 .hw_params = playpaq_wm8510_hw_params,
294};
295
296
297
298static const struct snd_soc_dapm_widget playpaq_dapm_widgets[] = {
299 SND_SOC_DAPM_MIC("Int Mic", NULL),
300 SND_SOC_DAPM_SPK("Ext Spk", NULL),
301};
302
303
304
305static const struct snd_soc_dapm_route intercon[] = {
306 /* speaker connected to SPKOUT */
307 {"Ext Spk", NULL, "SPKOUTP"},
308 {"Ext Spk", NULL, "SPKOUTN"},
309
310 {"Mic Bias", NULL, "Int Mic"},
311 {"MICN", NULL, "Mic Bias"},
312 {"MICP", NULL, "Mic Bias"},
313};
314
315
316
317static int playpaq_wm8510_init(struct snd_soc_pcm_runtime *rtd)
318{
319 struct snd_soc_codec *codec = rtd->codec;
320 struct snd_soc_dapm_context *dapm = &codec->dapm;
321 int i;
322
323 /*
324 * Add DAPM widgets
325 */
326 for (i = 0; i < ARRAY_SIZE(playpaq_dapm_widgets); i++)
327 snd_soc_dapm_new_control(dapm, &playpaq_dapm_widgets[i]);
328
329
330
331 /*
332 * Setup audio path interconnects
333 */
334 snd_soc_dapm_add_routes(dapm, intercon, ARRAY_SIZE(intercon));
335
336
337
338 /* always connected pins */
339 snd_soc_dapm_enable_pin(dapm, "Int Mic");
340 snd_soc_dapm_enable_pin(dapm, "Ext Spk");
341
342
343
344 /* Make CSB show PLL rate */
345 snd_soc_dai_set_clkdiv(rtd->codec_dai, WM8510_OPCLKDIV,
346 WM8510_OPCLKDIV_1 | 4);
347
348 return 0;
349}
350
351
352
353static struct snd_soc_dai_link playpaq_wm8510_dai = {
354 .name = "WM8510",
355 .stream_name = "WM8510 PCM",
356 .cpu_dai_name= "atmel-ssc-dai.0",
357 .platform_name = "atmel-pcm-audio",
358 .codec_name = "wm8510-codec.0-0x1a",
359 .codec_dai_name = "wm8510-hifi",
360 .init = playpaq_wm8510_init,
361 .ops = &playpaq_wm8510_ops,
362};
363
364
365
366static struct snd_soc_card snd_soc_playpaq = {
367 .name = "LRS_PlayPaq_WM8510",
368 .dai_link = &playpaq_wm8510_dai,
369 .num_links = 1,
370};
371
372static struct platform_device *playpaq_snd_device;
373
374
375static int __init playpaq_asoc_init(void)
376{
377 int ret = 0;
378
379 /*
380 * Configure MCLK for WM8510
381 */
382 _gclk0 = clk_get(NULL, "gclk0");
383 if (IS_ERR(_gclk0)) {
384 _gclk0 = NULL;
385 ret = PTR_ERR(_gclk0);
386 goto err_gclk0;
387 }
388 _pll0 = clk_get(NULL, "pll0");
389 if (IS_ERR(_pll0)) {
390 _pll0 = NULL;
391 ret = PTR_ERR(_pll0);
392 goto err_pll0;
393 }
394 ret = clk_set_parent(_gclk0, _pll0);
395 if (ret) {
396 pr_warning("snd-soc-playpaq: "
397 "Failed to set PLL0 as parent for DAC clock\n");
398 goto err_set_clk;
399 }
400 clk_set_rate(CODEC_CLK, 12000000);
401 clk_enable(CODEC_CLK);
402
403#if defined CONFIG_AT32_ENHANCED_PORTMUX
404 at32_select_periph(MCLK_PIN, MCLK_PERIPH, 0);
405#endif
406
407
408 /*
409 * Create and register platform device
410 */
411 playpaq_snd_device = platform_device_alloc("soc-audio", 0);
412 if (playpaq_snd_device == NULL) {
413 ret = -ENOMEM;
414 goto err_device_alloc;
415 }
416
417 platform_set_drvdata(playpaq_snd_device, &snd_soc_playpaq);
418
419 ret = platform_device_add(playpaq_snd_device);
420 if (ret) {
421 pr_warning("playpaq_wm8510: platform_device_add failed (%d)\n",
422 ret);
423 goto err_device_add;
424 }
425
426 return 0;
427
428
429err_device_add:
430 if (playpaq_snd_device != NULL) {
431 platform_device_put(playpaq_snd_device);
432 playpaq_snd_device = NULL;
433 }
434err_device_alloc:
435err_set_clk:
436 if (_pll0 != NULL) {
437 clk_put(_pll0);
438 _pll0 = NULL;
439 }
440err_pll0:
441 if (_gclk0 != NULL) {
442 clk_put(_gclk0);
443 _gclk0 = NULL;
444 }
445 return ret;
446}
447
448
449static void __exit playpaq_asoc_exit(void)
450{
451 if (_gclk0 != NULL) {
452 clk_put(_gclk0);
453 _gclk0 = NULL;
454 }
455 if (_pll0 != NULL) {
456 clk_put(_pll0);
457 _pll0 = NULL;
458 }
459
460#if defined CONFIG_AT32_ENHANCED_PORTMUX
461 at32_free_pin(MCLK_PIN);
462#endif
463
464 platform_device_unregister(playpaq_snd_device);
465 playpaq_snd_device = NULL;
466}
467
468module_init(playpaq_asoc_init);
469module_exit(playpaq_asoc_exit);
470
471MODULE_AUTHOR("Geoffrey Wossum <gwossum@acm.org>");
472MODULE_DESCRIPTION("ASoC machine driver for LRS PlayPaq");
473MODULE_LICENSE("GPL");
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/Kconfig b/sound/soc/au1x/Kconfig
index e908a812311..a56104040e8 100644
--- a/sound/soc/au1x/Kconfig
+++ b/sound/soc/au1x/Kconfig
@@ -1,13 +1,13 @@
1## 1##
2## Au1200/Au1550 PSC + DBDMA 2## Au1200/Au1550/Au1300 PSC + DBDMA
3## 3##
4config SND_SOC_AU1XPSC 4config SND_SOC_AU1XPSC
5 tristate "SoC Audio for Au1200/Au1250/Au1550" 5 tristate "SoC Audio for Au12xx/Au13xx/Au1550"
6 depends on MIPS_ALCHEMY 6 depends on MIPS_ALCHEMY
7 help 7 help
8 This option enables support for the Programmable Serial 8 This option enables support for the Programmable Serial
9 Controllers in AC97 and I2S mode, and the Descriptor-Based DMA 9 Controllers in AC97 and I2S mode, and the Descriptor-Based DMA
10 Controller (DBDMA) as found on the Au1200/Au1250/Au1550 SoC. 10 Controller (DBDMA) as found on the Au12xx/Au13xx/Au1550 SoC.
11 11
12config SND_SOC_AU1XPSC_I2S 12config SND_SOC_AU1XPSC_I2S
13 tristate 13 tristate
@@ -51,12 +51,14 @@ config SND_SOC_DB1000
51 of boards (DB1000/DB1500/DB1100). 51 of boards (DB1000/DB1500/DB1100).
52 52
53config SND_SOC_DB1200 53config SND_SOC_DB1200
54 tristate "DB1200 AC97+I2S audio support" 54 tristate "DB1200/DB1300/DB1550 Audio support"
55 depends on SND_SOC_AU1XPSC 55 depends on SND_SOC_AU1XPSC
56 select SND_SOC_AU1XPSC_AC97 56 select SND_SOC_AU1XPSC_AC97
57 select SND_SOC_AC97_CODEC 57 select SND_SOC_AC97_CODEC
58 select SND_SOC_WM9712
58 select SND_SOC_AU1XPSC_I2S 59 select SND_SOC_AU1XPSC_I2S
59 select SND_SOC_WM8731 60 select SND_SOC_WM8731
60 help 61 help
61 Select this option to enable audio (AC97 or I2S) on the 62 Select this option to enable audio (AC97 and I2S) on the
62 Alchemy/AMD/RMI DB1200 demoboard. 63 Alchemy/AMD/RMI/NetLogic Db1200, Db1550 and Db1300 evaluation boards.
64 If you need Db1300 touchscreen support, you definitely want to say Y.
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..30ea513d81d 100644
--- a/sound/soc/au1x/db1200.c
+++ b/sound/soc/au1x/db1200.c
@@ -1,5 +1,5 @@
1/* 1/*
2 * DB1200 ASoC audio fabric support code. 2 * DB1200/DB1300/DB1550 ASoC audio fabric support code.
3 * 3 *
4 * (c) 2008-2011 Manuel Lauss <manuel.lauss@googlemail.com> 4 * (c) 2008-2011 Manuel Lauss <manuel.lauss@googlemail.com>
5 * 5 *
@@ -28,6 +28,18 @@ static struct platform_device_id db1200_pids[] = {
28 }, { 28 }, {
29 .name = "db1200-i2s", 29 .name = "db1200-i2s",
30 .driver_data = 1, 30 .driver_data = 1,
31 }, {
32 .name = "db1300-ac97",
33 .driver_data = 2,
34 }, {
35 .name = "db1300-i2s",
36 .driver_data = 3,
37 }, {
38 .name = "db1550-ac97",
39 .driver_data = 4,
40 }, {
41 .name = "db1550-i2s",
42 .driver_data = 5,
31 }, 43 },
32 {}, 44 {},
33}; 45};
@@ -45,6 +57,28 @@ static struct snd_soc_dai_link db1200_ac97_dai = {
45 57
46static struct snd_soc_card db1200_ac97_machine = { 58static struct snd_soc_card db1200_ac97_machine = {
47 .name = "DB1200_AC97", 59 .name = "DB1200_AC97",
60 .owner = THIS_MODULE,
61 .dai_link = &db1200_ac97_dai,
62 .num_links = 1,
63};
64
65static struct snd_soc_dai_link db1300_ac97_dai = {
66 .name = "AC97",
67 .stream_name = "AC97 HiFi",
68 .codec_dai_name = "wm9712-hifi",
69 .cpu_dai_name = "au1xpsc_ac97.1",
70 .platform_name = "au1xpsc-pcm.1",
71 .codec_name = "wm9712-codec.1",
72};
73
74static struct snd_soc_card db1300_ac97_machine = {
75 .name = "DB1300_AC97",
76 .dai_link = &db1300_ac97_dai,
77 .num_links = 1,
78};
79
80static struct snd_soc_card db1550_ac97_machine = {
81 .name = "DB1550_AC97",
48 .dai_link = &db1200_ac97_dai, 82 .dai_link = &db1200_ac97_dai,
49 .num_links = 1, 83 .num_links = 1,
50}; 84};
@@ -94,15 +128,52 @@ static struct snd_soc_dai_link db1200_i2s_dai = {
94 128
95static struct snd_soc_card db1200_i2s_machine = { 129static struct snd_soc_card db1200_i2s_machine = {
96 .name = "DB1200_I2S", 130 .name = "DB1200_I2S",
131 .owner = THIS_MODULE,
97 .dai_link = &db1200_i2s_dai, 132 .dai_link = &db1200_i2s_dai,
98 .num_links = 1, 133 .num_links = 1,
99}; 134};
100 135
136static struct snd_soc_dai_link db1300_i2s_dai = {
137 .name = "WM8731",
138 .stream_name = "WM8731 PCM",
139 .codec_dai_name = "wm8731-hifi",
140 .cpu_dai_name = "au1xpsc_i2s.2",
141 .platform_name = "au1xpsc-pcm.2",
142 .codec_name = "wm8731.0-001b",
143 .ops = &db1200_i2s_wm8731_ops,
144};
145
146static struct snd_soc_card db1300_i2s_machine = {
147 .name = "DB1300_I2S",
148 .dai_link = &db1300_i2s_dai,
149 .num_links = 1,
150};
151
152static struct snd_soc_dai_link db1550_i2s_dai = {
153 .name = "WM8731",
154 .stream_name = "WM8731 PCM",
155 .codec_dai_name = "wm8731-hifi",
156 .cpu_dai_name = "au1xpsc_i2s.3",
157 .platform_name = "au1xpsc-pcm.3",
158 .codec_name = "wm8731.0-001b",
159 .ops = &db1200_i2s_wm8731_ops,
160};
161
162static struct snd_soc_card db1550_i2s_machine = {
163 .name = "DB1550_I2S",
164 .dai_link = &db1550_i2s_dai,
165 .num_links = 1,
166};
167
101/*------------------------- COMMON PART ---------------------------*/ 168/*------------------------- COMMON PART ---------------------------*/
102 169
103static struct snd_soc_card *db1200_cards[] __devinitdata = { 170static struct snd_soc_card *db1200_cards[] __devinitdata = {
104 &db1200_ac97_machine, 171 &db1200_ac97_machine,
105 &db1200_i2s_machine, 172 &db1200_i2s_machine,
173 &db1300_ac97_machine,
174 &db1300_i2s_machine,
175 &db1550_ac97_machine,
176 &db1550_i2s_machine,
106}; 177};
107 178
108static int __devinit db1200_audio_probe(struct platform_device *pdev) 179static int __devinit db1200_audio_probe(struct platform_device *pdev)
@@ -133,19 +204,8 @@ static struct platform_driver db1200_audio_driver = {
133 .remove = __devexit_p(db1200_audio_remove), 204 .remove = __devexit_p(db1200_audio_remove),
134}; 205};
135 206
136static int __init db1200_audio_load(void) 207module_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 208
149MODULE_LICENSE("GPL"); 209MODULE_LICENSE("GPL");
150MODULE_DESCRIPTION("DB1200 ASoC audio support"); 210MODULE_DESCRIPTION("DB1200/DB1300/DB1550 ASoC audio support");
151MODULE_AUTHOR("Manuel Lauss"); 211MODULE_AUTHOR("Manuel Lauss");
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/ad1836.h b/sound/soc/codecs/ad1836.h
index 444747f0db2..dd7be0dbbc5 100644
--- a/sound/soc/codecs/ad1836.h
+++ b/sound/soc/codecs/ad1836.h
@@ -34,7 +34,7 @@
34 34
35#define AD1836_ADC_CTRL2 13 35#define AD1836_ADC_CTRL2 13
36#define AD1836_ADC_WORD_LEN_MASK 0x30 36#define AD1836_ADC_WORD_LEN_MASK 0x30
37#define AD1836_ADC_WORD_OFFSET 5 37#define AD1836_ADC_WORD_OFFSET 4
38#define AD1836_ADC_SERFMT_MASK (7 << 6) 38#define AD1836_ADC_SERFMT_MASK (7 << 6)
39#define AD1836_ADC_SERFMT_PCK256 (0x4 << 6) 39#define AD1836_ADC_SERFMT_PCK256 (0x4 << 6)
40#define AD1836_ADC_SERFMT_PCK128 (0x5 << 6) 40#define AD1836_ADC_SERFMT_PCK128 (0x5 << 6)
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 f1f237ecec2..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;
@@ -601,7 +600,6 @@ static int cs4270_soc_suspend(struct snd_soc_codec *codec, pm_message_t mesg)
601static int cs4270_soc_resume(struct snd_soc_codec *codec) 600static int cs4270_soc_resume(struct snd_soc_codec *codec)
602{ 601{
603 struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec); 602 struct cs4270_private *cs4270 = snd_soc_codec_get_drvdata(codec);
604 struct i2c_client *i2c_client = to_i2c_client(codec->dev);
605 int reg; 603 int reg;
606 604
607 regulator_bulk_enable(ARRAY_SIZE(cs4270->supplies), 605 regulator_bulk_enable(ARRAY_SIZE(cs4270->supplies),
@@ -612,14 +610,7 @@ static int cs4270_soc_resume(struct snd_soc_codec *codec)
612 ndelay(500); 610 ndelay(500);
613 611
614 /* first restore the entire register cache ... */ 612 /* first restore the entire register cache ... */
615 for (reg = CS4270_FIRSTREG; reg <= CS4270_LASTREG; reg++) { 613 snd_soc_cache_sync(codec);
616 u8 val = snd_soc_read(codec, reg);
617
618 if (i2c_smbus_write_byte_data(i2c_client, reg, val)) {
619 dev_err(codec->dev, "i2c write failed\n");
620 return -EIO;
621 }
622 }
623 614
624 /* ... then disable the power-down bits */ 615 /* ... then disable the power-down bits */
625 reg = snd_soc_read(codec, CS4270_PWRCTL); 616 reg = snd_soc_read(codec, CS4270_PWRCTL);
@@ -680,7 +671,8 @@ static int cs4270_i2c_probe(struct i2c_client *i2c_client,
680 i2c_client->addr); 671 i2c_client->addr);
681 dev_info(&i2c_client->dev, "hardware revision %X\n", ret & 0xF); 672 dev_info(&i2c_client->dev, "hardware revision %X\n", ret & 0xF);
682 673
683 cs4270 = kzalloc(sizeof(struct cs4270_private), GFP_KERNEL); 674 cs4270 = devm_kzalloc(&i2c_client->dev, sizeof(struct cs4270_private),
675 GFP_KERNEL);
684 if (!cs4270) { 676 if (!cs4270) {
685 dev_err(&i2c_client->dev, "could not allocate codec\n"); 677 dev_err(&i2c_client->dev, "could not allocate codec\n");
686 return -ENOMEM; 678 return -ENOMEM;
@@ -691,8 +683,6 @@ static int cs4270_i2c_probe(struct i2c_client *i2c_client,
691 683
692 ret = snd_soc_register_codec(&i2c_client->dev, 684 ret = snd_soc_register_codec(&i2c_client->dev,
693 &soc_codec_device_cs4270, &cs4270_dai, 1); 685 &soc_codec_device_cs4270, &cs4270_dai, 1);
694 if (ret < 0)
695 kfree(cs4270);
696 return ret; 686 return ret;
697} 687}
698 688
@@ -705,7 +695,6 @@ static int cs4270_i2c_probe(struct i2c_client *i2c_client,
705static int cs4270_i2c_remove(struct i2c_client *i2c_client) 695static int cs4270_i2c_remove(struct i2c_client *i2c_client)
706{ 696{
707 snd_soc_unregister_codec(&i2c_client->dev); 697 snd_soc_unregister_codec(&i2c_client->dev);
708 kfree(i2c_get_clientdata(i2c_client));
709 return 0; 698 return 0;
710} 699}
711 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 8c3c8205d19..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, 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/max9877.c b/sound/soc/codecs/max9877.c
index 9e7e964a5fa..dcf6f2a1600 100644
--- a/sound/soc/codecs/max9877.c
+++ b/sound/soc/codecs/max9877.c
@@ -106,13 +106,13 @@ static int max9877_set_2reg(struct snd_kcontrol *kcontrol,
106 unsigned int mask = mc->max; 106 unsigned int mask = mc->max;
107 unsigned int val = (ucontrol->value.integer.value[0] & mask); 107 unsigned int val = (ucontrol->value.integer.value[0] & mask);
108 unsigned int val2 = (ucontrol->value.integer.value[1] & mask); 108 unsigned int val2 = (ucontrol->value.integer.value[1] & mask);
109 unsigned int change = 1; 109 unsigned int change = 0;
110 110
111 if (((max9877_regs[reg] >> shift) & mask) == val) 111 if (((max9877_regs[reg] >> shift) & mask) != val)
112 change = 0; 112 change = 1;
113 113
114 if (((max9877_regs[reg2] >> shift) & mask) == val2) 114 if (((max9877_regs[reg2] >> shift) & mask) != val2)
115 change = 0; 115 change = 1;
116 116
117 if (change) { 117 if (change) {
118 max9877_regs[reg] &= ~(mask << shift); 118 max9877_regs[reg] &= ~(mask << shift);
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..f8863ebb430 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>
@@ -833,7 +832,7 @@ static int ldo_regulator_register(struct snd_soc_codec *codec,
833 ldo->voltage = voltage; 832 ldo->voltage = voltage;
834 833
835 ldo->dev = regulator_register(&ldo->desc, codec->dev, 834 ldo->dev = regulator_register(&ldo->desc, codec->dev,
836 init_data, ldo); 835 init_data, ldo, NULL);
837 if (IS_ERR(ldo->dev)) { 836 if (IS_ERR(ldo->dev)) {
838 int ret = PTR_ERR(ldo->dev); 837 int ret = PTR_ERR(ldo->dev);
839 838
@@ -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
@@ -1466,5 +1457,5 @@ static void __exit sgtl5000_exit(void)
1466module_exit(sgtl5000_exit); 1457module_exit(sgtl5000_exit);
1467 1458
1468MODULE_DESCRIPTION("Freescale SGTL5000 ALSA SoC Codec Driver"); 1459MODULE_DESCRIPTION("Freescale SGTL5000 ALSA SoC Codec Driver");
1469MODULE_AUTHOR("Zeng Zhaoming <zhaoming.zeng@freescale.com>"); 1460MODULE_AUTHOR("Zeng Zhaoming <zengzm.kernel@gmail.com>");
1470MODULE_LICENSE("GPL"); 1461MODULE_LICENSE("GPL");
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..7c7fd925db8 100644
--- a/sound/soc/codecs/wm8993.c
+++ b/sound/soc/codecs/wm8993.c
@@ -444,6 +444,12 @@ static int _wm8993_set_fll(struct snd_soc_codec *codec, int fll_id, int source,
444 /* Enable the FLL */ 444 /* Enable the FLL */
445 snd_soc_write(codec, WM8993_FLL_CONTROL_1, reg1 | WM8993_FLL_ENA); 445 snd_soc_write(codec, WM8993_FLL_CONTROL_1, reg1 | WM8993_FLL_ENA);
446 446
447 /* Both overestimates */
448 if (Fref < 1000000)
449 msleep(3);
450 else
451 msleep(1);
452
447 dev_dbg(codec->dev, "FLL enabled at %dHz->%dHz\n", Fref, Fout); 453 dev_dbg(codec->dev, "FLL enabled at %dHz->%dHz\n", Fref, Fout);
448 454
449 wm8993->fll_fref = Fref; 455 wm8993->fll_fref = Fref;
@@ -934,28 +940,6 @@ static const struct snd_soc_dapm_route routes[] = {
934 { "Right Headphone Mux", "DAC", "DACR" }, 940 { "Right Headphone Mux", "DAC", "DACR" },
935}; 941};
936 942
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, 943static int wm8993_set_bias_level(struct snd_soc_codec *codec,
960 enum snd_soc_bias_level level) 944 enum snd_soc_bias_level level)
961{ 945{
@@ -979,7 +963,7 @@ static int wm8993_set_bias_level(struct snd_soc_codec *codec,
979 if (ret != 0) 963 if (ret != 0)
980 return ret; 964 return ret;
981 965
982 wm8993_cache_restore(codec); 966 snd_soc_cache_sync(codec);
983 967
984 /* Tune DC servo configuration */ 968 /* Tune DC servo configuration */
985 snd_soc_write(codec, 0x44, 3); 969 snd_soc_write(codec, 0x44, 3);
@@ -1394,7 +1378,7 @@ out:
1394 return 0; 1378 return 0;
1395} 1379}
1396 1380
1397static struct snd_soc_dai_ops wm8993_ops = { 1381static const struct snd_soc_dai_ops wm8993_ops = {
1398 .set_sysclk = wm8993_set_sysclk, 1382 .set_sysclk = wm8993_set_sysclk,
1399 .set_fmt = wm8993_set_dai_fmt, 1383 .set_fmt = wm8993_set_dai_fmt,
1400 .hw_params = wm8993_hw_params, 1384 .hw_params = wm8993_hw_params,
@@ -1544,7 +1528,7 @@ static int wm8993_remove(struct snd_soc_codec *codec)
1544} 1528}
1545 1529
1546#ifdef CONFIG_PM 1530#ifdef CONFIG_PM
1547static int wm8993_suspend(struct snd_soc_codec *codec, pm_message_t state) 1531static int wm8993_suspend(struct snd_soc_codec *codec)
1548{ 1532{
1549 struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec); 1533 struct wm8993_priv *wm8993 = snd_soc_codec_get_drvdata(codec);
1550 int fll_fout = wm8993->fll_fout; 1534 int fll_fout = wm8993->fll_fout;
@@ -1613,7 +1597,8 @@ static __devinit int wm8993_i2c_probe(struct i2c_client *i2c,
1613 struct wm8993_priv *wm8993; 1597 struct wm8993_priv *wm8993;
1614 int ret; 1598 int ret;
1615 1599
1616 wm8993 = kzalloc(sizeof(struct wm8993_priv), GFP_KERNEL); 1600 wm8993 = devm_kzalloc(&i2c->dev, sizeof(struct wm8993_priv),
1601 GFP_KERNEL);
1617 if (wm8993 == NULL) 1602 if (wm8993 == NULL)
1618 return -ENOMEM; 1603 return -ENOMEM;
1619 1604
@@ -1621,8 +1606,6 @@ static __devinit int wm8993_i2c_probe(struct i2c_client *i2c,
1621 1606
1622 ret = snd_soc_register_codec(&i2c->dev, 1607 ret = snd_soc_register_codec(&i2c->dev,
1623 &soc_codec_dev_wm8993, &wm8993_dai, 1); 1608 &soc_codec_dev_wm8993, &wm8993_dai, 1);
1624 if (ret < 0)
1625 kfree(wm8993);
1626 return ret; 1609 return ret;
1627} 1610}
1628 1611
@@ -1641,7 +1624,7 @@ MODULE_DEVICE_TABLE(i2c, wm8993_i2c_id);
1641 1624
1642static struct i2c_driver wm8993_i2c_driver = { 1625static struct i2c_driver wm8993_i2c_driver = {
1643 .driver = { 1626 .driver = {
1644 .name = "wm8993-codec", 1627 .name = "wm8993",
1645 .owner = THIS_MODULE, 1628 .owner = THIS_MODULE,
1646 }, 1629 },
1647 .probe = wm8993_i2c_probe, 1630 .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 9c982e47eb9..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;
@@ -2357,6 +2430,11 @@ static int wm8994_hw_params(struct snd_pcm_substream *substream,
2357 bclk |= best << WM8994_AIF1_BCLK_DIV_SHIFT; 2430 bclk |= best << WM8994_AIF1_BCLK_DIV_SHIFT;
2358 2431
2359 lrclk = bclk_rate / params_rate(params); 2432 lrclk = bclk_rate / params_rate(params);
2433 if (!lrclk) {
2434 dev_err(dai->dev, "Unable to generate LRCLK from %dHz BCLK\n",
2435 bclk_rate);
2436 return -EINVAL;
2437 }
2360 dev_dbg(dai->dev, "Using LRCLK rate %d for actual LRCLK %dHz\n", 2438 dev_dbg(dai->dev, "Using LRCLK rate %d for actual LRCLK %dHz\n",
2361 lrclk, bclk_rate / lrclk); 2439 lrclk, bclk_rate / lrclk);
2362 2440
@@ -2390,7 +2468,8 @@ static int wm8994_aif3_hw_params(struct snd_pcm_substream *substream,
2390 struct snd_soc_dai *dai) 2468 struct snd_soc_dai *dai)
2391{ 2469{
2392 struct snd_soc_codec *codec = dai->codec; 2470 struct snd_soc_codec *codec = dai->codec;
2393 struct wm8994 *control = codec->control_data; 2471 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
2472 struct wm8994 *control = wm8994->wm8994;
2394 int aif1_reg; 2473 int aif1_reg;
2395 int aif1 = 0; 2474 int aif1 = 0;
2396 2475
@@ -2531,7 +2610,7 @@ static int wm8994_aif2_probe(struct snd_soc_dai *dai)
2531#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 |\
2532 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE) 2611 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE)
2533 2612
2534static struct snd_soc_dai_ops wm8994_aif1_dai_ops = { 2613static const struct snd_soc_dai_ops wm8994_aif1_dai_ops = {
2535 .set_sysclk = wm8994_set_dai_sysclk, 2614 .set_sysclk = wm8994_set_dai_sysclk,
2536 .set_fmt = wm8994_set_dai_fmt, 2615 .set_fmt = wm8994_set_dai_fmt,
2537 .hw_params = wm8994_hw_params, 2616 .hw_params = wm8994_hw_params,
@@ -2541,7 +2620,7 @@ static struct snd_soc_dai_ops wm8994_aif1_dai_ops = {
2541 .set_tristate = wm8994_set_tristate, 2620 .set_tristate = wm8994_set_tristate,
2542}; 2621};
2543 2622
2544static struct snd_soc_dai_ops wm8994_aif2_dai_ops = { 2623static const struct snd_soc_dai_ops wm8994_aif2_dai_ops = {
2545 .set_sysclk = wm8994_set_dai_sysclk, 2624 .set_sysclk = wm8994_set_dai_sysclk,
2546 .set_fmt = wm8994_set_dai_fmt, 2625 .set_fmt = wm8994_set_dai_fmt,
2547 .hw_params = wm8994_hw_params, 2626 .hw_params = wm8994_hw_params,
@@ -2551,7 +2630,7 @@ static struct snd_soc_dai_ops wm8994_aif2_dai_ops = {
2551 .set_tristate = wm8994_set_tristate, 2630 .set_tristate = wm8994_set_tristate,
2552}; 2631};
2553 2632
2554static struct snd_soc_dai_ops wm8994_aif3_dai_ops = { 2633static const struct snd_soc_dai_ops wm8994_aif3_dai_ops = {
2555 .hw_params = wm8994_aif3_hw_params, 2634 .hw_params = wm8994_aif3_hw_params,
2556 .set_tristate = wm8994_set_tristate, 2635 .set_tristate = wm8994_set_tristate,
2557}; 2636};
@@ -2618,10 +2697,10 @@ static struct snd_soc_dai_driver wm8994_dai[] = {
2618}; 2697};
2619 2698
2620#ifdef CONFIG_PM 2699#ifdef CONFIG_PM
2621static int wm8994_suspend(struct snd_soc_codec *codec, pm_message_t state) 2700static int wm8994_suspend(struct snd_soc_codec *codec)
2622{ 2701{
2623 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); 2702 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
2624 struct wm8994 *control = codec->control_data; 2703 struct wm8994 *control = wm8994->wm8994;
2625 int i, ret; 2704 int i, ret;
2626 2705
2627 switch (control->type) { 2706 switch (control->type) {
@@ -2629,6 +2708,9 @@ static int wm8994_suspend(struct snd_soc_codec *codec, pm_message_t state)
2629 snd_soc_update_bits(codec, WM8994_MICBIAS, WM8994_MICD_ENA, 0); 2708 snd_soc_update_bits(codec, WM8994_MICBIAS, WM8994_MICD_ENA, 0);
2630 break; 2709 break;
2631 case WM1811: 2710 case WM1811:
2711 snd_soc_update_bits(codec, WM8994_ANTIPOP_2,
2712 WM1811_JACKDET_MODE_MASK, 0);
2713 /* Fall through */
2632 case WM8958: 2714 case WM8958:
2633 snd_soc_update_bits(codec, WM8958_MIC_DETECT_1, 2715 snd_soc_update_bits(codec, WM8958_MIC_DETECT_1,
2634 WM8958_MICD_ENA, 0); 2716 WM8958_MICD_ENA, 0);
@@ -2652,14 +2734,14 @@ static int wm8994_suspend(struct snd_soc_codec *codec, pm_message_t state)
2652static int wm8994_resume(struct snd_soc_codec *codec) 2734static int wm8994_resume(struct snd_soc_codec *codec)
2653{ 2735{
2654 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); 2736 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
2655 struct wm8994 *control = codec->control_data; 2737 struct wm8994 *control = wm8994->wm8994;
2656 int i, ret; 2738 int i, ret;
2657 unsigned int val, mask; 2739 unsigned int val, mask;
2658 2740
2659 if (wm8994->revision < 4) { 2741 if (wm8994->revision < 4) {
2660 /* force a HW read */ 2742 /* force a HW read */
2661 val = wm8994_reg_read(codec->control_data, 2743 ret = regmap_read(control->regmap,
2662 WM8994_POWER_MANAGEMENT_5); 2744 WM8994_POWER_MANAGEMENT_5, &val);
2663 2745
2664 /* modify the cache only */ 2746 /* modify the cache only */
2665 codec->cache_only = 1; 2747 codec->cache_only = 1;
@@ -2698,6 +2780,13 @@ static int wm8994_resume(struct snd_soc_codec *codec)
2698 WM8994_MICD_ENA, WM8994_MICD_ENA); 2780 WM8994_MICD_ENA, WM8994_MICD_ENA);
2699 break; 2781 break;
2700 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 }
2701 case WM8958: 2790 case WM8958:
2702 if (wm8994->jack_cb) 2791 if (wm8994->jack_cb)
2703 snd_soc_update_bits(codec, WM8958_MIC_DETECT_1, 2792 snd_soc_update_bits(codec, WM8958_MIC_DETECT_1,
@@ -2810,8 +2899,8 @@ static void wm8994_handle_pdata(struct wm8994_priv *wm8994)
2810 }; 2899 };
2811 2900
2812 /* We need an array of texts for the enum API */ 2901 /* We need an array of texts for the enum API */
2813 wm8994->drc_texts = kmalloc(sizeof(char *) 2902 wm8994->drc_texts = devm_kzalloc(wm8994->codec->dev,
2814 * pdata->num_drc_cfgs, GFP_KERNEL); 2903 sizeof(char *) * pdata->num_drc_cfgs, GFP_KERNEL);
2815 if (!wm8994->drc_texts) { 2904 if (!wm8994->drc_texts) {
2816 dev_err(wm8994->codec->dev, 2905 dev_err(wm8994->codec->dev,
2817 "Failed to allocate %d DRC config texts\n", 2906 "Failed to allocate %d DRC config texts\n",
@@ -2874,7 +2963,7 @@ int wm8994_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack,
2874{ 2963{
2875 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); 2964 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
2876 struct wm8994_micdet *micdet; 2965 struct wm8994_micdet *micdet;
2877 struct wm8994 *control = codec->control_data; 2966 struct wm8994 *control = wm8994->wm8994;
2878 int reg; 2967 int reg;
2879 2968
2880 if (control->type != WM8994) 2969 if (control->type != WM8994)
@@ -2957,21 +3046,136 @@ static void wm8958_default_micdet(u16 status, void *data)
2957{ 3046{
2958 struct snd_soc_codec *codec = data; 3047 struct snd_soc_codec *codec = data;
2959 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); 3048 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
2960 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);
2961 3099
2962 /* If nothing present then clear our statuses */ 3100 wm1811_jackdet_set_mode(codec,
2963 if (!(status & WM8958_MICD_STS)) 3101 WM1811_JACKDET_MODE_JACK);
2964 goto done; 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;
2965 3113
2966 report = SND_JACK_MICROPHONE; 3114 if (status & 0x10)
3115 report |= SND_JACK_BTN_2;
2967 3116
2968 /* Everything else is buttons; just assign slots */ 3117 if (status & 0x20)
2969 if (status & 0x1c) 3118 report |= SND_JACK_BTN_3;
2970 report |= SND_JACK_BTN_0;
2971 3119
2972done: 3120 if (status & 0x40)
2973 snd_soc_jack_report(wm8994->micdet[0].jack, report, 3121 report |= SND_JACK_BTN_4;
2974 SND_JACK_BTN_0 | SND_JACK_MICROPHONE); 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);
3147
3148 if (reg & WM1811_JACKDET_LVL) {
3149 dev_dbg(codec->dev, "Jack detected\n");
3150
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");
3164
3165 snd_soc_jack_report(wm8994->micdet[0].jack, 0,
3166 SND_JACK_MECHANICAL | SND_JACK_HEADSET |
3167 wm8994->btn_mask);
3168
3169 wm8994->mic_detecting = false;
3170 wm8994->jack_mic = false;
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;
2975} 3179}
2976 3180
2977/** 3181/**
@@ -2994,7 +3198,8 @@ int wm8958_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack,
2994 wm8958_micdet_cb cb, void *cb_data) 3198 wm8958_micdet_cb cb, void *cb_data)
2995{ 3199{
2996 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); 3200 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
2997 struct wm8994 *control = codec->control_data; 3201 struct wm8994 *control = wm8994->wm8994;
3202 u16 micd_lvl_sel;
2998 3203
2999 switch (control->type) { 3204 switch (control->type) {
3000 case WM1811: 3205 case WM1811:
@@ -3011,15 +3216,50 @@ int wm8958_mic_detect(struct snd_soc_codec *codec, struct snd_soc_jack *jack,
3011 cb_data = codec; 3216 cb_data = codec;
3012 } 3217 }
3013 3218
3219 snd_soc_dapm_force_enable_pin(&codec->dapm, "CLK_SYS");
3220
3014 wm8994->micdet[0].jack = jack; 3221 wm8994->micdet[0].jack = jack;
3015 wm8994->jack_cb = cb; 3222 wm8994->jack_cb = cb;
3016 wm8994->jack_cb_data = cb_data; 3223 wm8994->jack_cb_data = cb_data;
3017 3224
3018 snd_soc_update_bits(codec, WM8958_MIC_DETECT_1, 3225 wm8994->mic_detecting = true;
3019 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
3020 } else { 3259 } else {
3021 snd_soc_update_bits(codec, WM8958_MIC_DETECT_1, 3260 snd_soc_update_bits(codec, WM8958_MIC_DETECT_1,
3022 WM8958_MICD_ENA, 0); 3261 WM8958_MICD_ENA, 0);
3262 snd_soc_dapm_disable_pin(&codec->dapm, "CLK_SYS");
3023 } 3263 }
3024 3264
3025 return 0; 3265 return 0;
@@ -3032,6 +3272,18 @@ static irqreturn_t wm8958_mic_irq(int irq, void *data)
3032 struct snd_soc_codec *codec = wm8994->codec; 3272 struct snd_soc_codec *codec = wm8994->codec;
3033 int reg, count; 3273 int reg, count;
3034 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
3035 /* We may occasionally read a detection without an impedence 3287 /* We may occasionally read a detection without an impedence
3036 * range being provided - if that happens loop again. 3288 * range being provided - if that happens loop again.
3037 */ 3289 */
@@ -3039,6 +3291,7 @@ static irqreturn_t wm8958_mic_irq(int irq, void *data)
3039 do { 3291 do {
3040 reg = snd_soc_read(codec, WM8958_MIC_DETECT_3); 3292 reg = snd_soc_read(codec, WM8958_MIC_DETECT_3);
3041 if (reg < 0) { 3293 if (reg < 0) {
3294 mutex_unlock(&wm8994->accdet_lock);
3042 dev_err(codec->dev, 3295 dev_err(codec->dev,
3043 "Failed to read mic detect status: %d\n", 3296 "Failed to read mic detect status: %d\n",
3044 reg); 3297 reg);
@@ -3069,6 +3322,8 @@ static irqreturn_t wm8958_mic_irq(int irq, void *data)
3069 dev_warn(codec->dev, "Accessory detection with no callback\n"); 3322 dev_warn(codec->dev, "Accessory detection with no callback\n");
3070 3323
3071out: 3324out:
3325 mutex_unlock(&wm8994->accdet_lock);
3326
3072 return IRQ_HANDLED; 3327 return IRQ_HANDLED;
3073} 3328}
3074 3329
@@ -3101,22 +3356,28 @@ static irqreturn_t wm8994_temp_shut(int irq, void *data)
3101 3356
3102static int wm8994_codec_probe(struct snd_soc_codec *codec) 3357static int wm8994_codec_probe(struct snd_soc_codec *codec)
3103{ 3358{
3104 struct wm8994 *control; 3359 struct wm8994 *control = dev_get_drvdata(codec->dev->parent);
3105 struct wm8994_priv *wm8994; 3360 struct wm8994_priv *wm8994;
3106 struct snd_soc_dapm_context *dapm = &codec->dapm; 3361 struct snd_soc_dapm_context *dapm = &codec->dapm;
3362 unsigned int reg;
3107 int ret, i; 3363 int ret, i;
3108 3364
3109 codec->control_data = dev_get_drvdata(codec->dev->parent); 3365 codec->control_data = control->regmap;
3110 control = codec->control_data;
3111 3366
3112 wm8994 = kzalloc(sizeof(struct wm8994_priv), GFP_KERNEL); 3367 wm8994 = devm_kzalloc(codec->dev, sizeof(struct wm8994_priv),
3368 GFP_KERNEL);
3113 if (wm8994 == NULL) 3369 if (wm8994 == NULL)
3114 return -ENOMEM; 3370 return -ENOMEM;
3115 snd_soc_codec_set_drvdata(codec, wm8994); 3371 snd_soc_codec_set_drvdata(codec, wm8994);
3116 3372
3373 snd_soc_codec_set_cache_io(codec, 16, 16, SND_SOC_REGMAP);
3374
3375 wm8994->wm8994 = dev_get_drvdata(codec->dev->parent);
3117 wm8994->pdata = dev_get_platdata(codec->dev->parent); 3376 wm8994->pdata = dev_get_platdata(codec->dev->parent);
3118 wm8994->codec = codec; 3377 wm8994->codec = codec;
3119 3378
3379 mutex_init(&wm8994->accdet_lock);
3380
3120 for (i = 0; i < ARRAY_SIZE(wm8994->fll_locked); i++) 3381 for (i = 0; i < ARRAY_SIZE(wm8994->fll_locked); i++)
3121 init_completion(&wm8994->fll_locked[i]); 3382 init_completion(&wm8994->fll_locked[i]);
3122 3383
@@ -3129,25 +3390,6 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec)
3129 pm_runtime_enable(codec->dev); 3390 pm_runtime_enable(codec->dev);
3130 pm_runtime_resume(codec->dev); 3391 pm_runtime_resume(codec->dev);
3131 3392
3132 /* Read our current status back from the chip - we don't want to
3133 * reset as this may interfere with the GPIO or LDO operation. */
3134 for (i = 0; i < WM8994_CACHE_SIZE; i++) {
3135 if (!wm8994_readable(codec, i) || wm8994_volatile(codec, i))
3136 continue;
3137
3138 ret = wm8994_reg_read(codec->control_data, i);
3139 if (ret <= 0)
3140 continue;
3141
3142 ret = snd_soc_cache_write(codec, i, ret);
3143 if (ret != 0) {
3144 dev_err(codec->dev,
3145 "Failed to initialise cache for 0x%x: %d\n",
3146 i, ret);
3147 goto err;
3148 }
3149 }
3150
3151 /* Set revision-specific configuration */ 3393 /* Set revision-specific configuration */
3152 wm8994->revision = snd_soc_read(codec, WM8994_CHIP_REVISION); 3394 wm8994->revision = snd_soc_read(codec, WM8994_CHIP_REVISION);
3153 switch (control->type) { 3395 switch (control->type) {
@@ -3178,6 +3420,8 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec)
3178 switch (wm8994->revision) { 3420 switch (wm8994->revision) {
3179 case 0: 3421 case 0:
3180 case 1: 3422 case 1:
3423 case 2:
3424 case 3:
3181 wm8994->hubs.dcs_codes_l = -9; 3425 wm8994->hubs.dcs_codes_l = -9;
3182 wm8994->hubs.dcs_codes_r = -5; 3426 wm8994->hubs.dcs_codes_r = -5;
3183 break; 3427 break;
@@ -3193,14 +3437,14 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec)
3193 break; 3437 break;
3194 } 3438 }
3195 3439
3196 wm8994_request_irq(codec->control_data, WM8994_IRQ_FIFOS_ERR, 3440 wm8994_request_irq(wm8994->wm8994, WM8994_IRQ_FIFOS_ERR,
3197 wm8994_fifo_error, "FIFO error", codec); 3441 wm8994_fifo_error, "FIFO error", codec);
3198 wm8994_request_irq(codec->control_data, WM8994_IRQ_TEMP_WARN, 3442 wm8994_request_irq(wm8994->wm8994, WM8994_IRQ_TEMP_WARN,
3199 wm8994_temp_warn, "Thermal warning", codec); 3443 wm8994_temp_warn, "Thermal warning", codec);
3200 wm8994_request_irq(codec->control_data, WM8994_IRQ_TEMP_SHUT, 3444 wm8994_request_irq(wm8994->wm8994, WM8994_IRQ_TEMP_SHUT,
3201 wm8994_temp_shut, "Thermal shutdown", codec); 3445 wm8994_temp_shut, "Thermal shutdown", codec);
3202 3446
3203 ret = wm8994_request_irq(codec->control_data, WM8994_IRQ_DCS_DONE, 3447 ret = wm8994_request_irq(wm8994->wm8994, WM8994_IRQ_DCS_DONE,
3204 wm_hubs_dcs_done, "DC servo done", 3448 wm_hubs_dcs_done, "DC servo done",
3205 &wm8994->hubs); 3449 &wm8994->hubs);
3206 if (ret == 0) 3450 if (ret == 0)
@@ -3220,7 +3464,7 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec)
3220 ret); 3464 ret);
3221 } 3465 }
3222 3466
3223 ret = wm8994_request_irq(codec->control_data, 3467 ret = wm8994_request_irq(wm8994->wm8994,
3224 WM8994_IRQ_MIC1_SHRT, 3468 WM8994_IRQ_MIC1_SHRT,
3225 wm8994_mic_irq, "Mic 1 short", 3469 wm8994_mic_irq, "Mic 1 short",
3226 wm8994); 3470 wm8994);
@@ -3229,7 +3473,7 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec)
3229 "Failed to request Mic1 short IRQ: %d\n", 3473 "Failed to request Mic1 short IRQ: %d\n",
3230 ret); 3474 ret);
3231 3475
3232 ret = wm8994_request_irq(codec->control_data, 3476 ret = wm8994_request_irq(wm8994->wm8994,
3233 WM8994_IRQ_MIC2_DET, 3477 WM8994_IRQ_MIC2_DET,
3234 wm8994_mic_irq, "Mic 2 detect", 3478 wm8994_mic_irq, "Mic 2 detect",
3235 wm8994); 3479 wm8994);
@@ -3238,7 +3482,7 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec)
3238 "Failed to request Mic2 detect IRQ: %d\n", 3482 "Failed to request Mic2 detect IRQ: %d\n",
3239 ret); 3483 ret);
3240 3484
3241 ret = wm8994_request_irq(codec->control_data, 3485 ret = wm8994_request_irq(wm8994->wm8994,
3242 WM8994_IRQ_MIC2_SHRT, 3486 WM8994_IRQ_MIC2_SHRT,
3243 wm8994_mic_irq, "Mic 2 short", 3487 wm8994_mic_irq, "Mic 2 short",
3244 wm8994); 3488 wm8994);
@@ -3263,9 +3507,24 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec)
3263 } 3507 }
3264 } 3508 }
3265 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
3266 wm8994->fll_locked_irq = true; 3525 wm8994->fll_locked_irq = true;
3267 for (i = 0; i < ARRAY_SIZE(wm8994->fll_locked); i++) { 3526 for (i = 0; i < ARRAY_SIZE(wm8994->fll_locked); i++) {
3268 ret = wm8994_request_irq(codec->control_data, 3527 ret = wm8994_request_irq(wm8994->wm8994,
3269 WM8994_IRQ_FLL1_LOCK + i, 3528 WM8994_IRQ_FLL1_LOCK + i,
3270 wm8994_fll_locked_irq, "FLL lock", 3529 wm8994_fll_locked_irq, "FLL lock",
3271 &wm8994->fll_locked[i]); 3530 &wm8994->fll_locked[i]);
@@ -3277,24 +3536,24 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec)
3277 * configured on init - if a system wants to do this dynamically 3536 * configured on init - if a system wants to do this dynamically
3278 * at runtime we can deal with that then. 3537 * at runtime we can deal with that then.
3279 */ 3538 */
3280 ret = wm8994_reg_read(codec->control_data, WM8994_GPIO_1); 3539 ret = regmap_read(control->regmap, WM8994_GPIO_1, &reg);
3281 if (ret < 0) { 3540 if (ret < 0) {
3282 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);
3283 goto err_irq; 3542 goto err_irq;
3284 } 3543 }
3285 if ((ret & WM8994_GPN_FN_MASK) != WM8994_GP_FN_PIN_SPECIFIC) { 3544 if ((reg & WM8994_GPN_FN_MASK) != WM8994_GP_FN_PIN_SPECIFIC) {
3286 wm8994->lrclk_shared[0] = 1; 3545 wm8994->lrclk_shared[0] = 1;
3287 wm8994_dai[0].symmetric_rates = 1; 3546 wm8994_dai[0].symmetric_rates = 1;
3288 } else { 3547 } else {
3289 wm8994->lrclk_shared[0] = 0; 3548 wm8994->lrclk_shared[0] = 0;
3290 } 3549 }
3291 3550
3292 ret = wm8994_reg_read(codec->control_data, WM8994_GPIO_6); 3551 ret = regmap_read(control->regmap, WM8994_GPIO_6, &reg);
3293 if (ret < 0) { 3552 if (ret < 0) {
3294 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);
3295 goto err_irq; 3554 goto err_irq;
3296 } 3555 }
3297 if ((ret & WM8994_GPN_FN_MASK) != WM8994_GP_FN_PIN_SPECIFIC) { 3556 if ((reg & WM8994_GPN_FN_MASK) != WM8994_GP_FN_PIN_SPECIFIC) {
3298 wm8994->lrclk_shared[1] = 1; 3557 wm8994->lrclk_shared[1] = 1;
3299 wm8994_dai[1].symmetric_rates = 1; 3558 wm8994_dai[1].symmetric_rates = 1;
3300 } else { 3559 } else {
@@ -3361,6 +3620,19 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec)
3361 break; 3620 break;
3362 } 3621 }
3363 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
3364 wm8994_update_class_w(codec); 3636 wm8994_update_class_w(codec);
3365 3637
3366 wm8994_handle_pdata(wm8994); 3638 wm8994_handle_pdata(wm8994);
@@ -3472,28 +3744,29 @@ static int wm8994_codec_probe(struct snd_soc_codec *codec)
3472 return 0; 3744 return 0;
3473 3745
3474err_irq: 3746err_irq:
3475 wm8994_free_irq(codec->control_data, WM8994_IRQ_MIC2_SHRT, wm8994); 3747 if (wm8994->jackdet)
3476 wm8994_free_irq(codec->control_data, WM8994_IRQ_MIC2_DET, wm8994); 3748 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_GPIO(6), wm8994);
3477 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);
3478 if (wm8994->micdet_irq) 3752 if (wm8994->micdet_irq)
3479 free_irq(wm8994->micdet_irq, wm8994); 3753 free_irq(wm8994->micdet_irq, wm8994);
3480 for (i = 0; i < ARRAY_SIZE(wm8994->fll_locked); i++) 3754 for (i = 0; i < ARRAY_SIZE(wm8994->fll_locked); i++)
3481 wm8994_free_irq(codec->control_data, WM8994_IRQ_FLL1_LOCK + i, 3755 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_FLL1_LOCK + i,
3482 &wm8994->fll_locked[i]); 3756 &wm8994->fll_locked[i]);
3483 wm8994_free_irq(codec->control_data, WM8994_IRQ_DCS_DONE, 3757 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_DCS_DONE,
3484 &wm8994->hubs); 3758 &wm8994->hubs);
3485 wm8994_free_irq(codec->control_data, WM8994_IRQ_FIFOS_ERR, codec); 3759 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_FIFOS_ERR, codec);
3486 wm8994_free_irq(codec->control_data, WM8994_IRQ_TEMP_SHUT, codec); 3760 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_TEMP_SHUT, codec);
3487 wm8994_free_irq(codec->control_data, WM8994_IRQ_TEMP_WARN, codec); 3761 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_TEMP_WARN, codec);
3488err: 3762
3489 kfree(wm8994);
3490 return ret; 3763 return ret;
3491} 3764}
3492 3765
3493static int wm8994_codec_remove(struct snd_soc_codec *codec) 3766static int wm8994_codec_remove(struct snd_soc_codec *codec)
3494{ 3767{
3495 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec); 3768 struct wm8994_priv *wm8994 = snd_soc_codec_get_drvdata(codec);
3496 struct wm8994 *control = codec->control_data; 3769 struct wm8994 *control = wm8994->wm8994;
3497 int i; 3770 int i;
3498 3771
3499 wm8994_set_bias_level(codec, SND_SOC_BIAS_OFF); 3772 wm8994_set_bias_level(codec, SND_SOC_BIAS_OFF);
@@ -3501,24 +3774,27 @@ static int wm8994_codec_remove(struct snd_soc_codec *codec)
3501 pm_runtime_disable(codec->dev); 3774 pm_runtime_disable(codec->dev);
3502 3775
3503 for (i = 0; i < ARRAY_SIZE(wm8994->fll_locked); i++) 3776 for (i = 0; i < ARRAY_SIZE(wm8994->fll_locked); i++)
3504 wm8994_free_irq(codec->control_data, WM8994_IRQ_FLL1_LOCK + i, 3777 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_FLL1_LOCK + i,
3505 &wm8994->fll_locked[i]); 3778 &wm8994->fll_locked[i]);
3506 3779
3507 wm8994_free_irq(codec->control_data, WM8994_IRQ_DCS_DONE, 3780 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_DCS_DONE,
3508 &wm8994->hubs); 3781 &wm8994->hubs);
3509 wm8994_free_irq(codec->control_data, WM8994_IRQ_FIFOS_ERR, codec); 3782 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_FIFOS_ERR, codec);
3510 wm8994_free_irq(codec->control_data, WM8994_IRQ_TEMP_SHUT, codec); 3783 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_TEMP_SHUT, codec);
3511 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);
3512 3788
3513 switch (control->type) { 3789 switch (control->type) {
3514 case WM8994: 3790 case WM8994:
3515 if (wm8994->micdet_irq) 3791 if (wm8994->micdet_irq)
3516 free_irq(wm8994->micdet_irq, wm8994); 3792 free_irq(wm8994->micdet_irq, wm8994);
3517 wm8994_free_irq(codec->control_data, WM8994_IRQ_MIC2_DET, 3793 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_MIC2_DET,
3518 wm8994); 3794 wm8994);
3519 wm8994_free_irq(codec->control_data, WM8994_IRQ_MIC1_SHRT, 3795 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_MIC1_SHRT,
3520 wm8994); 3796 wm8994);
3521 wm8994_free_irq(codec->control_data, WM8994_IRQ_MIC1_DET, 3797 wm8994_free_irq(wm8994->wm8994, WM8994_IRQ_MIC1_DET,
3522 wm8994); 3798 wm8994);
3523 break; 3799 break;
3524 3800
@@ -3535,27 +3811,24 @@ static int wm8994_codec_remove(struct snd_soc_codec *codec)
3535 if (wm8994->enh_eq) 3811 if (wm8994->enh_eq)
3536 release_firmware(wm8994->enh_eq); 3812 release_firmware(wm8994->enh_eq);
3537 kfree(wm8994->retune_mobile_texts); 3813 kfree(wm8994->retune_mobile_texts);
3538 kfree(wm8994->drc_texts);
3539 kfree(wm8994);
3540 3814
3541 return 0; 3815 return 0;
3542} 3816}
3543 3817
3818static int wm8994_soc_volatile(struct snd_soc_codec *codec,
3819 unsigned int reg)
3820{
3821 return true;
3822}
3823
3544static struct snd_soc_codec_driver soc_codec_dev_wm8994 = { 3824static struct snd_soc_codec_driver soc_codec_dev_wm8994 = {
3545 .probe = wm8994_codec_probe, 3825 .probe = wm8994_codec_probe,
3546 .remove = wm8994_codec_remove, 3826 .remove = wm8994_codec_remove,
3547 .suspend = wm8994_suspend, 3827 .suspend = wm8994_suspend,
3548 .resume = wm8994_resume, 3828 .resume = wm8994_resume,
3549 .read = wm8994_read,
3550 .write = wm8994_write,
3551 .readable_register = wm8994_readable,
3552 .volatile_register = wm8994_volatile,
3553 .set_bias_level = wm8994_set_bias_level, 3829 .set_bias_level = wm8994_set_bias_level,
3554 3830 .reg_cache_size = WM8994_MAX_REGISTER,
3555 .reg_cache_size = WM8994_CACHE_SIZE, 3831 .volatile_register = wm8994_soc_volatile,
3556 .reg_cache_default = wm8994_reg_defaults,
3557 .reg_word_size = 2,
3558 .compress_type = SND_SOC_RBTREE_COMPRESSION,
3559}; 3832};
3560 3833
3561static int __devinit wm8994_probe(struct platform_device *pdev) 3834static int __devinit wm8994_probe(struct platform_device *pdev)
@@ -3579,18 +3852,7 @@ static struct platform_driver wm8994_codec_driver = {
3579 .remove = __devexit_p(wm8994_remove), 3852 .remove = __devexit_p(wm8994_remove),
3580}; 3853};
3581 3854
3582static __init int wm8994_init(void) 3855module_platform_driver(wm8994_codec_driver);
3583{
3584 return platform_driver_register(&wm8994_codec_driver);
3585}
3586module_init(wm8994_init);
3587
3588static __exit void wm8994_exit(void)
3589{
3590 platform_driver_unregister(&wm8994_codec_driver);
3591}
3592module_exit(wm8994_exit);
3593
3594 3856
3595MODULE_DESCRIPTION("ASoC WM8994 driver"); 3857MODULE_DESCRIPTION("ASoC WM8994 driver");
3596MODULE_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..de839044987 100644
--- a/sound/soc/ep93xx/ep93xx-pcm.c
+++ b/sound/soc/ep93xx/ep93xx-pcm.c
@@ -113,9 +113,9 @@ static int ep93xx_pcm_open(struct snd_pcm_substream *substream)
113 rtd->dma_data.name = dma_params->name; 113 rtd->dma_data.name = dma_params->name;
114 114
115 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) 115 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
116 rtd->dma_data.direction = DMA_TO_DEVICE; 116 rtd->dma_data.direction = DMA_MEM_TO_DEV;
117 else 117 else
118 rtd->dma_data.direction = DMA_FROM_DEVICE; 118 rtd->dma_data.direction = DMA_DEV_TO_MEM;
119 119
120 rtd->dma_chan = dma_request_channel(mask, ep93xx_pcm_dma_filter, 120 rtd->dma_chan = dma_request_channel(mask, ep93xx_pcm_dma_filter,
121 &rtd->dma_data); 121 &rtd->dma_data);
@@ -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 31af405bda8..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}
@@ -392,7 +395,8 @@ static int mpc8610_hpcd_probe(struct platform_device *pdev)
392 } 395 }
393 396
394 if (strcasecmp(sprop, "i2s-slave") == 0) { 397 if (strcasecmp(sprop, "i2s-slave") == 0) {
395 machine_data->dai_format = SND_SOC_DAIFMT_I2S; 398 machine_data->dai_format =
399 SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBM_CFM;
396 machine_data->codec_clk_direction = SND_SOC_CLOCK_OUT; 400 machine_data->codec_clk_direction = SND_SOC_CLOCK_OUT;
397 machine_data->cpu_clk_direction = SND_SOC_CLOCK_IN; 401 machine_data->cpu_clk_direction = SND_SOC_CLOCK_IN;
398 402
@@ -409,31 +413,38 @@ static int mpc8610_hpcd_probe(struct platform_device *pdev)
409 } 413 }
410 machine_data->clk_frequency = be32_to_cpup(iprop); 414 machine_data->clk_frequency = be32_to_cpup(iprop);
411 } else if (strcasecmp(sprop, "i2s-master") == 0) { 415 } else if (strcasecmp(sprop, "i2s-master") == 0) {
412 machine_data->dai_format = SND_SOC_DAIFMT_I2S; 416 machine_data->dai_format =
417 SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_CBS_CFS;
413 machine_data->codec_clk_direction = SND_SOC_CLOCK_IN; 418 machine_data->codec_clk_direction = SND_SOC_CLOCK_IN;
414 machine_data->cpu_clk_direction = SND_SOC_CLOCK_OUT; 419 machine_data->cpu_clk_direction = SND_SOC_CLOCK_OUT;
415 } else if (strcasecmp(sprop, "lj-slave") == 0) { 420 } else if (strcasecmp(sprop, "lj-slave") == 0) {
416 machine_data->dai_format = SND_SOC_DAIFMT_LEFT_J; 421 machine_data->dai_format =
422 SND_SOC_DAIFMT_LEFT_J | SND_SOC_DAIFMT_CBM_CFM;
417 machine_data->codec_clk_direction = SND_SOC_CLOCK_OUT; 423 machine_data->codec_clk_direction = SND_SOC_CLOCK_OUT;
418 machine_data->cpu_clk_direction = SND_SOC_CLOCK_IN; 424 machine_data->cpu_clk_direction = SND_SOC_CLOCK_IN;
419 } else if (strcasecmp(sprop, "lj-master") == 0) { 425 } else if (strcasecmp(sprop, "lj-master") == 0) {
420 machine_data->dai_format = SND_SOC_DAIFMT_LEFT_J; 426 machine_data->dai_format =
427 SND_SOC_DAIFMT_LEFT_J | SND_SOC_DAIFMT_CBS_CFS;
421 machine_data->codec_clk_direction = SND_SOC_CLOCK_IN; 428 machine_data->codec_clk_direction = SND_SOC_CLOCK_IN;
422 machine_data->cpu_clk_direction = SND_SOC_CLOCK_OUT; 429 machine_data->cpu_clk_direction = SND_SOC_CLOCK_OUT;
423 } else if (strcasecmp(sprop, "rj-slave") == 0) { 430 } else if (strcasecmp(sprop, "rj-slave") == 0) {
424 machine_data->dai_format = SND_SOC_DAIFMT_RIGHT_J; 431 machine_data->dai_format =
432 SND_SOC_DAIFMT_RIGHT_J | SND_SOC_DAIFMT_CBM_CFM;
425 machine_data->codec_clk_direction = SND_SOC_CLOCK_OUT; 433 machine_data->codec_clk_direction = SND_SOC_CLOCK_OUT;
426 machine_data->cpu_clk_direction = SND_SOC_CLOCK_IN; 434 machine_data->cpu_clk_direction = SND_SOC_CLOCK_IN;
427 } else if (strcasecmp(sprop, "rj-master") == 0) { 435 } else if (strcasecmp(sprop, "rj-master") == 0) {
428 machine_data->dai_format = SND_SOC_DAIFMT_RIGHT_J; 436 machine_data->dai_format =
437 SND_SOC_DAIFMT_RIGHT_J | SND_SOC_DAIFMT_CBS_CFS;
429 machine_data->codec_clk_direction = SND_SOC_CLOCK_IN; 438 machine_data->codec_clk_direction = SND_SOC_CLOCK_IN;
430 machine_data->cpu_clk_direction = SND_SOC_CLOCK_OUT; 439 machine_data->cpu_clk_direction = SND_SOC_CLOCK_OUT;
431 } else if (strcasecmp(sprop, "ac97-slave") == 0) { 440 } else if (strcasecmp(sprop, "ac97-slave") == 0) {
432 machine_data->dai_format = SND_SOC_DAIFMT_AC97; 441 machine_data->dai_format =
442 SND_SOC_DAIFMT_AC97 | SND_SOC_DAIFMT_CBM_CFM;
433 machine_data->codec_clk_direction = SND_SOC_CLOCK_OUT; 443 machine_data->codec_clk_direction = SND_SOC_CLOCK_OUT;
434 machine_data->cpu_clk_direction = SND_SOC_CLOCK_IN; 444 machine_data->cpu_clk_direction = SND_SOC_CLOCK_IN;
435 } else if (strcasecmp(sprop, "ac97-master") == 0) { 445 } else if (strcasecmp(sprop, "ac97-master") == 0) {
436 machine_data->dai_format = SND_SOC_DAIFMT_AC97; 446 machine_data->dai_format =
447 SND_SOC_DAIFMT_AC97 | SND_SOC_DAIFMT_CBS_CFS;
437 machine_data->codec_clk_direction = SND_SOC_CLOCK_IN; 448 machine_data->codec_clk_direction = SND_SOC_CLOCK_IN;
438 machine_data->cpu_clk_direction = SND_SOC_CLOCK_OUT; 449 machine_data->cpu_clk_direction = SND_SOC_CLOCK_OUT;
439 } else { 450 } else {
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..5780c9b9d56 100644
--- a/sound/soc/imx/imx-pcm-dma-mx2.c
+++ b/sound/soc/imx/imx-pcm-dma-mx2.c
@@ -88,11 +88,13 @@ static int imx_ssi_dma_alloc(struct snd_pcm_substream *substream,
88 iprtd->dma_data.dma_request = dma_params->dma; 88 iprtd->dma_data.dma_request = dma_params->dma;
89 89
90 /* Try to grab a DMA channel */ 90 /* Try to grab a DMA channel */
91 dma_cap_zero(mask); 91 if (!iprtd->dma_chan) {
92 dma_cap_set(DMA_SLAVE, mask); 92 dma_cap_zero(mask);
93 iprtd->dma_chan = dma_request_channel(mask, filter, iprtd); 93 dma_cap_set(DMA_SLAVE, mask);
94 if (!iprtd->dma_chan) 94 iprtd->dma_chan = dma_request_channel(mask, filter, iprtd);
95 return -EINVAL; 95 if (!iprtd->dma_chan)
96 return -EINVAL;
97 }
96 98
97 switch (params_format(params)) { 99 switch (params_format(params)) {
98 case SNDRV_PCM_FORMAT_S16_LE: 100 case SNDRV_PCM_FORMAT_S16_LE:
@@ -107,12 +109,12 @@ static int imx_ssi_dma_alloc(struct snd_pcm_substream *substream,
107 } 109 }
108 110
109 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { 111 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
110 slave_config.direction = DMA_TO_DEVICE; 112 slave_config.direction = DMA_MEM_TO_DEV;
111 slave_config.dst_addr = dma_params->dma_addr; 113 slave_config.dst_addr = dma_params->dma_addr;
112 slave_config.dst_addr_width = buswidth; 114 slave_config.dst_addr_width = buswidth;
113 slave_config.dst_maxburst = dma_params->burstsize; 115 slave_config.dst_maxburst = dma_params->burstsize;
114 } else { 116 } else {
115 slave_config.direction = DMA_FROM_DEVICE; 117 slave_config.direction = DMA_DEV_TO_MEM;
116 slave_config.src_addr = dma_params->dma_addr; 118 slave_config.src_addr = dma_params->dma_addr;
117 slave_config.src_addr_width = buswidth; 119 slave_config.src_addr_width = buswidth;
118 slave_config.src_maxburst = dma_params->burstsize; 120 slave_config.src_maxburst = dma_params->burstsize;
@@ -159,7 +161,7 @@ static int snd_imx_pcm_hw_params(struct snd_pcm_substream *substream,
159 iprtd->period_bytes * iprtd->periods, 161 iprtd->period_bytes * iprtd->periods,
160 iprtd->period_bytes, 162 iprtd->period_bytes,
161 substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? 163 substream->stream == SNDRV_PCM_STREAM_PLAYBACK ?
162 DMA_TO_DEVICE : DMA_FROM_DEVICE); 164 DMA_MEM_TO_DEV : DMA_DEV_TO_MEM);
163 if (!iprtd->desc) { 165 if (!iprtd->desc) {
164 dev_err(&chan->dev->device, "cannot prepare slave dma\n"); 166 dev_err(&chan->dev->device, "cannot prepare slave dma\n");
165 return -EINVAL; 167 return -EINVAL;
@@ -326,16 +328,6 @@ static struct platform_driver imx_pcm_driver = {
326 .remove = __devexit_p(imx_soc_platform_remove), 328 .remove = __devexit_p(imx_soc_platform_remove),
327}; 329};
328 330
329static int __init snd_imx_pcm_init(void) 331module_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"); 332MODULE_LICENSE("GPL");
341MODULE_ALIAS("platform:imx-pcm-audio"); 333MODULE_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..d0385402712 100644
--- a/sound/soc/kirkwood/kirkwood-dma.c
+++ b/sound/soc/kirkwood/kirkwood-dma.c
@@ -94,9 +94,10 @@ static irqreturn_t kirkwood_dma_irq(int irq, void *dev_id)
94 return IRQ_HANDLED; 94 return IRQ_HANDLED;
95} 95}
96 96
97static void kirkwood_dma_conf_mbus_windows(void __iomem *base, int win, 97static void
98 unsigned long dma, 98kirkwood_dma_conf_mbus_windows(void __iomem *base, int win,
99 struct mbus_dram_target_info *dram) 99 unsigned long dma,
100 const struct mbus_dram_target_info *dram)
100{ 101{
101 int i; 102 int i;
102 103
@@ -106,7 +107,7 @@ static void kirkwood_dma_conf_mbus_windows(void __iomem *base, int win,
106 107
107 /* try to find matching cs for current dma address */ 108 /* try to find matching cs for current dma address */
108 for (i = 0; i < dram->num_cs; i++) { 109 for (i = 0; i < dram->num_cs; i++) {
109 struct mbus_dram_window *cs = dram->cs + i; 110 const struct mbus_dram_window *cs = dram->cs + i;
110 if ((cs->base & 0xffff0000) < (dma & 0xffff0000)) { 111 if ((cs->base & 0xffff0000) < (dma & 0xffff0000)) {
111 writel(cs->base & 0xffff0000, 112 writel(cs->base & 0xffff0000,
112 base + KIRKWOOD_AUDIO_WIN_BASE_REG(win)); 113 base + KIRKWOOD_AUDIO_WIN_BASE_REG(win));
@@ -127,6 +128,7 @@ static int kirkwood_dma_open(struct snd_pcm_substream *substream)
127 struct snd_soc_dai *cpu_dai = soc_runtime->cpu_dai; 128 struct snd_soc_dai *cpu_dai = soc_runtime->cpu_dai;
128 struct kirkwood_dma_data *priv; 129 struct kirkwood_dma_data *priv;
129 struct kirkwood_dma_priv *prdata = snd_soc_platform_get_drvdata(platform); 130 struct kirkwood_dma_priv *prdata = snd_soc_platform_get_drvdata(platform);
131 const struct mbus_dram_target_info *dram;
130 unsigned long addr; 132 unsigned long addr;
131 133
132 priv = snd_soc_dai_get_dma_data(cpu_dai, substream); 134 priv = snd_soc_dai_get_dma_data(cpu_dai, substream);
@@ -175,15 +177,16 @@ static int kirkwood_dma_open(struct snd_pcm_substream *substream)
175 writel((unsigned long)-1, priv->io + KIRKWOOD_ERR_MASK); 177 writel((unsigned long)-1, priv->io + KIRKWOOD_ERR_MASK);
176 } 178 }
177 179
180 dram = mv_mbus_dram_info();
178 addr = virt_to_phys(substream->dma_buffer.area); 181 addr = virt_to_phys(substream->dma_buffer.area);
179 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) { 182 if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
180 prdata->play_stream = substream; 183 prdata->play_stream = substream;
181 kirkwood_dma_conf_mbus_windows(priv->io, 184 kirkwood_dma_conf_mbus_windows(priv->io,
182 KIRKWOOD_PLAYBACK_WIN, addr, priv->dram); 185 KIRKWOOD_PLAYBACK_WIN, addr, dram);
183 } else { 186 } else {
184 prdata->rec_stream = substream; 187 prdata->rec_stream = substream;
185 kirkwood_dma_conf_mbus_windows(priv->io, 188 kirkwood_dma_conf_mbus_windows(priv->io,
186 KIRKWOOD_RECORD_WIN, addr, priv->dram); 189 KIRKWOOD_RECORD_WIN, addr, dram);
187 } 190 }
188 191
189 return 0; 192 return 0;
@@ -315,7 +318,6 @@ static int kirkwood_dma_preallocate_dma_buffer(struct snd_pcm *pcm,
315static int kirkwood_dma_new(struct snd_soc_pcm_runtime *rtd) 318static int kirkwood_dma_new(struct snd_soc_pcm_runtime *rtd)
316{ 319{
317 struct snd_card *card = rtd->card->snd_card; 320 struct snd_card *card = rtd->card->snd_card;
318 struct snd_soc_dai *dai = rtd->cpu_dai;
319 struct snd_pcm *pcm = rtd->pcm; 321 struct snd_pcm *pcm = rtd->pcm;
320 int ret; 322 int ret;
321 323
@@ -324,14 +326,14 @@ static int kirkwood_dma_new(struct snd_soc_pcm_runtime *rtd)
324 if (!card->dev->coherent_dma_mask) 326 if (!card->dev->coherent_dma_mask)
325 card->dev->coherent_dma_mask = 0xffffffff; 327 card->dev->coherent_dma_mask = 0xffffffff;
326 328
327 if (dai->driver->playback.channels_min) { 329 if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream) {
328 ret = kirkwood_dma_preallocate_dma_buffer(pcm, 330 ret = kirkwood_dma_preallocate_dma_buffer(pcm,
329 SNDRV_PCM_STREAM_PLAYBACK); 331 SNDRV_PCM_STREAM_PLAYBACK);
330 if (ret) 332 if (ret)
331 return ret; 333 return ret;
332 } 334 }
333 335
334 if (dai->driver->capture.channels_min) { 336 if (pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream) {
335 ret = kirkwood_dma_preallocate_dma_buffer(pcm, 337 ret = kirkwood_dma_preallocate_dma_buffer(pcm,
336 SNDRV_PCM_STREAM_CAPTURE); 338 SNDRV_PCM_STREAM_CAPTURE);
337 if (ret) 339 if (ret)
@@ -388,17 +390,7 @@ static struct platform_driver kirkwood_pcm_driver = {
388 .remove = __devexit_p(kirkwood_soc_platform_remove), 390 .remove = __devexit_p(kirkwood_soc_platform_remove),
389}; 391};
390 392
391static int __init kirkwood_pcm_init(void) 393module_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 394
403MODULE_AUTHOR("Arnaud Patard <arnaud.patard@rtp-net.org>"); 395MODULE_AUTHOR("Arnaud Patard <arnaud.patard@rtp-net.org>");
404MODULE_DESCRIPTION("Marvell Kirkwood Audio DMA module"); 396MODULE_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..105f42a394d 100644
--- a/sound/soc/mxs/mxs-pcm.c
+++ b/sound/soc/mxs/mxs-pcm.c
@@ -136,7 +136,7 @@ static int snd_mxs_pcm_hw_params(struct snd_pcm_substream *substream,
136 iprtd->period_bytes * iprtd->periods, 136 iprtd->period_bytes * iprtd->periods,
137 iprtd->period_bytes, 137 iprtd->period_bytes,
138 substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? 138 substream->stream == SNDRV_PCM_STREAM_PLAYBACK ?
139 DMA_TO_DEVICE : DMA_FROM_DEVICE); 139 DMA_MEM_TO_DEV : DMA_DEV_TO_MEM);
140 if (!iprtd->desc) { 140 if (!iprtd->desc) {
141 dev_err(&chan->dev->device, "cannot prepare slave dma\n"); 141 dev_err(&chan->dev->device, "cannot prepare slave dma\n");
142 return -EINVAL; 142 return -EINVAL;
@@ -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..dccfb37a962 100644
--- a/sound/soc/mxs/mxs-saif.c
+++ b/sound/soc/mxs/mxs-saif.c
@@ -210,7 +210,7 @@ int mxs_saif_put_mclk(unsigned int saif_id)
210 return -EBUSY; 210 return -EBUSY;
211 } 211 }
212 212
213 clk_disable(saif->clk); 213 clk_disable_unprepare(saif->clk);
214 214
215 /* disable MCLK output */ 215 /* disable MCLK output */
216 __raw_writel(BM_SAIF_CTRL_CLKGATE, 216 __raw_writel(BM_SAIF_CTRL_CLKGATE,
@@ -264,7 +264,7 @@ int mxs_saif_get_mclk(unsigned int saif_id, unsigned int mclk,
264 if (ret) 264 if (ret)
265 return ret; 265 return ret;
266 266
267 ret = clk_enable(saif->clk); 267 ret = clk_prepare_enable(saif->clk);
268 if (ret) 268 if (ret)
269 return ret; 269 return ret;
270 270
@@ -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,
@@ -625,13 +625,6 @@ static int mxs_saif_probe(struct platform_device *pdev)
625 if (pdev->id >= ARRAY_SIZE(mxs_saif)) 625 if (pdev->id >= ARRAY_SIZE(mxs_saif))
626 return -EINVAL; 626 return -EINVAL;
627 627
628 pdata = pdev->dev.platform_data;
629 if (pdata && pdata->init) {
630 ret = pdata->init();
631 if (ret)
632 return ret;
633 }
634
635 saif = kzalloc(sizeof(*saif), GFP_KERNEL); 628 saif = kzalloc(sizeof(*saif), GFP_KERNEL);
636 if (!saif) 629 if (!saif)
637 return -ENOMEM; 630 return -ENOMEM;
@@ -639,12 +632,17 @@ static int mxs_saif_probe(struct platform_device *pdev)
639 mxs_saif[pdev->id] = saif; 632 mxs_saif[pdev->id] = saif;
640 saif->id = pdev->id; 633 saif->id = pdev->id;
641 634
642 saif->master_id = saif->id; 635 pdata = pdev->dev.platform_data;
643 if (pdata && pdata->get_master_id) { 636 if (pdata && !pdata->master_mode) {
644 saif->master_id = pdata->get_master_id(saif->id); 637 saif->master_id = pdata->master_id;
645 if (saif->master_id < 0 || 638 if (saif->master_id < 0 ||
646 saif->master_id >= ARRAY_SIZE(mxs_saif)) 639 saif->master_id >= ARRAY_SIZE(mxs_saif) ||
640 saif->master_id == saif->id) {
641 dev_err(&pdev->dev, "get wrong master id\n");
647 return -EINVAL; 642 return -EINVAL;
643 }
644 } else {
645 saif->master_id = saif->id;
648 } 646 }
649 647
650 saif->clk = clk_get(&pdev->dev, NULL); 648 saif->clk = clk_get(&pdev->dev, NULL);
@@ -781,18 +779,8 @@ static struct platform_driver mxs_saif_driver = {
781 }, 779 },
782}; 780};
783 781
784static int __init mxs_saif_init(void) 782module_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 783
794module_init(mxs_saif_init);
795module_exit(mxs_saif_exit);
796MODULE_AUTHOR("Freescale Semiconductor, Inc."); 784MODULE_AUTHOR("Freescale Semiconductor, Inc.");
797MODULE_DESCRIPTION("MXS ASoC SAIF driver"); 785MODULE_DESCRIPTION("MXS ASoC SAIF driver");
798MODULE_LICENSE("GPL"); 786MODULE_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 a4e3237956e..946020a647d 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
@@ -366,7 +366,7 @@ static int __devinit nuc900_ac97_drvprobe(struct platform_device *pdev)
366 goto out3; 366 goto out3;
367 367
368 /* enbale ac97 multifunction pin */ 368 /* enbale ac97 multifunction pin */
369 mfp_set_groupg(nuc900_audio->dev, "nuc900-audio"); 369 mfp_set_groupg(nuc900_audio->dev, NULL);
370 370
371 return 0; 371 return 0;
372 372
@@ -406,18 +406,7 @@ static struct platform_driver nuc900_ac97_driver = {
406 .remove = __devexit_p(nuc900_ac97_drvremove), 406 .remove = __devexit_p(nuc900_ac97_drvremove),
407}; 407};
408 408
409static int __init nuc900_ac97_init(void) 409module_platform_driver(nuc900_ac97_driver);
410{
411 return platform_driver_register(&nuc900_ac97_driver);
412}
413
414static void __exit nuc900_ac97_exit(void)
415{
416 platform_driver_unregister(&nuc900_ac97_driver);
417}
418
419module_init(nuc900_ac97_init);
420module_exit(nuc900_ac97_exit);
421 410
422MODULE_AUTHOR("Wan ZongShun <mcuos.com@gmail.com>"); 411MODULE_AUTHOR("Wan ZongShun <mcuos.com@gmail.com>");
423MODULE_DESCRIPTION("NUC900 AC97 SoC driver!"); 412MODULE_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 be81bc791b1..da6e005c1c4 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..e4ba17ce6b3 100644
--- a/sound/soc/samsung/dma.c
+++ b/sound/soc/samsung/dma.c
@@ -86,7 +86,7 @@ static void dma_enqueue(struct snd_pcm_substream *substream)
86 dma_info.cap = (samsung_dma_has_circular() ? DMA_CYCLIC : DMA_SLAVE); 86 dma_info.cap = (samsung_dma_has_circular() ? DMA_CYCLIC : DMA_SLAVE);
87 dma_info.direction = 87 dma_info.direction =
88 (substream->stream == SNDRV_PCM_STREAM_PLAYBACK 88 (substream->stream == SNDRV_PCM_STREAM_PLAYBACK
89 ? DMA_TO_DEVICE : DMA_FROM_DEVICE); 89 ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM);
90 dma_info.fp = audio_buffdone; 90 dma_info.fp = audio_buffdone;
91 dma_info.fp_param = substream; 91 dma_info.fp_param = substream;
92 dma_info.period = prtd->dma_period; 92 dma_info.period = prtd->dma_period;
@@ -171,7 +171,7 @@ static int dma_hw_params(struct snd_pcm_substream *substream,
171 dma_info.client = prtd->params->client; 171 dma_info.client = prtd->params->client;
172 dma_info.direction = 172 dma_info.direction =
173 (substream->stream == SNDRV_PCM_STREAM_PLAYBACK 173 (substream->stream == SNDRV_PCM_STREAM_PLAYBACK
174 ? DMA_TO_DEVICE : DMA_FROM_DEVICE); 174 ? DMA_MEM_TO_DEV : DMA_DEV_TO_MEM);
175 dma_info.width = prtd->params->dma_size; 175 dma_info.width = prtd->params->dma_size;
176 dma_info.fifo = prtd->params->dma_addr; 176 dma_info.fifo = prtd->params->dma_addr;
177 prtd->params->ch = prtd->params->ops->request( 177 prtd->params->ch = prtd->params->ops->request(
@@ -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 f75e43997d5..8eb309f23d1 100644
--- a/sound/soc/samsung/smdk_wm8994.c
+++ b/sound/soc/samsung/smdk_wm8994.c
@@ -9,6 +9,7 @@
9 9
10#include "../codecs/wm8994.h" 10#include "../codecs/wm8994.h"
11#include <sound/pcm_params.h> 11#include <sound/pcm_params.h>
12#include <linux/module.h>
12 13
13 /* 14 /*
14 * Default CFG switch settings to use this driver: 15 * Default CFG switch settings to use this driver:
@@ -143,6 +144,7 @@ static struct snd_soc_dai_link smdk_dai[] = {
143 144
144static struct snd_soc_card smdk = { 145static struct snd_soc_card smdk = {
145 .name = "SMDK-I2S", 146 .name = "SMDK-I2S",
147 .owner = THIS_MODULE,
146 .dai_link = smdk_dai, 148 .dai_link = smdk_dai,
147 .num_links = ARRAY_SIZE(smdk_dai), 149 .num_links = ARRAY_SIZE(smdk_dai),
148}; 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 85bf541a771..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;
@@ -191,7 +192,7 @@ static int speyside_late_probe(struct snd_soc_card *card)
191 snd_soc_dapm_ignore_suspend(&card->dapm, "Headset Mic"); 192 snd_soc_dapm_ignore_suspend(&card->dapm, "Headset Mic");
192 snd_soc_dapm_ignore_suspend(&card->dapm, "Main AMIC"); 193 snd_soc_dapm_ignore_suspend(&card->dapm, "Main AMIC");
193 snd_soc_dapm_ignore_suspend(&card->dapm, "Main DMIC"); 194 snd_soc_dapm_ignore_suspend(&card->dapm, "Main DMIC");
194 snd_soc_dapm_ignore_suspend(&card->dapm, "Speaker"); 195 snd_soc_dapm_ignore_suspend(&card->dapm, "Main Speaker");
195 snd_soc_dapm_ignore_suspend(&card->dapm, "WM1250 Output"); 196 snd_soc_dapm_ignore_suspend(&card->dapm, "WM1250 Output");
196 snd_soc_dapm_ignore_suspend(&card->dapm, "WM1250 Input"); 197 snd_soc_dapm_ignore_suspend(&card->dapm, "WM1250 Input");
197 198
@@ -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/siu_pcm.c b/sound/soc/sh/siu_pcm.c
index f8f681690a7..0193e595d41 100644
--- a/sound/soc/sh/siu_pcm.c
+++ b/sound/soc/sh/siu_pcm.c
@@ -131,7 +131,7 @@ static int siu_pcm_wr_set(struct siu_port *port_info,
131 sg_dma_address(&sg) = buff; 131 sg_dma_address(&sg) = buff;
132 132
133 desc = siu_stream->chan->device->device_prep_slave_sg(siu_stream->chan, 133 desc = siu_stream->chan->device->device_prep_slave_sg(siu_stream->chan,
134 &sg, 1, DMA_TO_DEVICE, DMA_PREP_INTERRUPT | DMA_CTRL_ACK); 134 &sg, 1, DMA_MEM_TO_DEV, DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
135 if (!desc) { 135 if (!desc) {
136 dev_err(dev, "Failed to allocate a dma descriptor\n"); 136 dev_err(dev, "Failed to allocate a dma descriptor\n");
137 return -ENOMEM; 137 return -ENOMEM;
@@ -181,7 +181,7 @@ static int siu_pcm_rd_set(struct siu_port *port_info,
181 sg_dma_address(&sg) = buff; 181 sg_dma_address(&sg) = buff;
182 182
183 desc = siu_stream->chan->device->device_prep_slave_sg(siu_stream->chan, 183 desc = siu_stream->chan->device->device_prep_slave_sg(siu_stream->chan,
184 &sg, 1, DMA_FROM_DEVICE, DMA_PREP_INTERRUPT | DMA_CTRL_ACK); 184 &sg, 1, DMA_DEV_TO_MEM, DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
185 if (!desc) { 185 if (!desc) {
186 dev_err(dev, "Failed to allocate dma descriptor\n"); 186 dev_err(dev, "Failed to allocate dma descriptor\n");
187 return -ENOMEM; 187 return -ENOMEM;
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 a5d3685a5d3..b5ecf6d2321 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;
@@ -709,6 +705,12 @@ int snd_soc_resume(struct device *dev)
709 struct snd_soc_card *card = dev_get_drvdata(dev); 705 struct snd_soc_card *card = dev_get_drvdata(dev);
710 int i, ac97_control = 0; 706 int i, ac97_control = 0;
711 707
708 /* If the initialization of this soc device failed, there is no codec
709 * associated with it. Just bail out in this case.
710 */
711 if (list_empty(&card->codec_dev_list))
712 return 0;
713
712 /* AC97 devices might have other drivers hanging off them so 714 /* AC97 devices might have other drivers hanging off them so
713 * need to resume immediately. Other drivers don't have that 715 * need to resume immediately. Other drivers don't have that
714 * problem and may take a substantial amount of time to resume 716 * problem and may take a substantial amount of time to resume
@@ -735,7 +737,7 @@ EXPORT_SYMBOL_GPL(snd_soc_resume);
735#define snd_soc_resume NULL 737#define snd_soc_resume NULL
736#endif 738#endif
737 739
738static struct snd_soc_dai_ops null_dai_ops = { 740static const struct snd_soc_dai_ops null_dai_ops = {
739}; 741};
740 742
741static 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)
@@ -757,10 +759,16 @@ static int soc_bind_dai_link(struct snd_soc_card *card, int num)
757 } 759 }
758 /* no, then find CPU DAI from registered DAIs*/ 760 /* no, then find CPU DAI from registered DAIs*/
759 list_for_each_entry(cpu_dai, &dai_list, list) { 761 list_for_each_entry(cpu_dai, &dai_list, list) {
760 if (!strcmp(cpu_dai->name, dai_link->cpu_dai_name)) { 762 if (dai_link->cpu_dai_of_node) {
761 rtd->cpu_dai = cpu_dai; 763 if (cpu_dai->dev->of_node != dai_link->cpu_dai_of_node)
762 goto find_codec; 764 continue;
765 } else {
766 if (strcmp(cpu_dai->name, dai_link->cpu_dai_name))
767 continue;
763 } 768 }
769
770 rtd->cpu_dai = cpu_dai;
771 goto find_codec;
764 } 772 }
765 dev_dbg(card->dev, "CPU DAI %s not registered\n", 773 dev_dbg(card->dev, "CPU DAI %s not registered\n",
766 dai_link->cpu_dai_name); 774 dai_link->cpu_dai_name);
@@ -773,22 +781,33 @@ find_codec:
773 781
774 /* no, then find CODEC from registered CODECs*/ 782 /* no, then find CODEC from registered CODECs*/
775 list_for_each_entry(codec, &codec_list, list) { 783 list_for_each_entry(codec, &codec_list, list) {
776 if (!strcmp(codec->name, dai_link->codec_name)) { 784 if (dai_link->codec_of_node) {
777 rtd->codec = codec; 785 if (codec->dev->of_node != dai_link->codec_of_node)
778 786 continue;
779 /* CODEC found, so find CODEC DAI from registered DAIs from this CODEC*/ 787 } else {
780 list_for_each_entry(codec_dai, &dai_list, list) { 788 if (strcmp(codec->name, dai_link->codec_name))
781 if (codec->dev == codec_dai->dev && 789 continue;
782 !strcmp(codec_dai->name, dai_link->codec_dai_name)) { 790 }
783 rtd->codec_dai = codec_dai; 791
784 goto find_platform; 792 rtd->codec = codec;
785 } 793
786 } 794 /*
787 dev_dbg(card->dev, "CODEC DAI %s not registered\n", 795 * CODEC found, so find CODEC DAI from registered DAIs from
788 dai_link->codec_dai_name); 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)) {
789 802
790 goto find_platform; 803 rtd->codec_dai = codec_dai;
804 goto find_platform;
805 }
791 } 806 }
807 dev_dbg(card->dev, "CODEC DAI %s not registered\n",
808 dai_link->codec_dai_name);
809
810 goto find_platform;
792 } 811 }
793 dev_dbg(card->dev, "CODEC %s not registered\n", 812 dev_dbg(card->dev, "CODEC %s not registered\n",
794 dai_link->codec_name); 813 dai_link->codec_name);
@@ -800,15 +819,22 @@ find_platform:
800 819
801 /* if there's no platform we match on the empty platform */ 820 /* if there's no platform we match on the empty platform */
802 platform_name = dai_link->platform_name; 821 platform_name = dai_link->platform_name;
803 if (!platform_name) 822 if (!platform_name && !dai_link->platform_of_node)
804 platform_name = "snd-soc-dummy"; 823 platform_name = "snd-soc-dummy";
805 824
806 /* no, then find one from the set of registered platforms */ 825 /* no, then find one from the set of registered platforms */
807 list_for_each_entry(platform, &platform_list, list) { 826 list_for_each_entry(platform, &platform_list, list) {
808 if (!strcmp(platform->name, platform_name)) { 827 if (dai_link->platform_of_node) {
809 rtd->platform = platform; 828 if (platform->dev->of_node !=
810 goto out; 829 dai_link->platform_of_node)
830 continue;
831 } else {
832 if (strcmp(platform->name, platform_name))
833 continue;
811 } 834 }
835
836 rtd->platform = platform;
837 goto out;
812 } 838 }
813 839
814 dev_dbg(card->dev, "platform %s not registered\n", 840 dev_dbg(card->dev, "platform %s not registered\n",
@@ -855,9 +881,9 @@ static void soc_remove_dai_link(struct snd_soc_card *card, int num, int order)
855 881
856 /* unregister the rtd device */ 882 /* unregister the rtd device */
857 if (rtd->dev_registered) { 883 if (rtd->dev_registered) {
858 device_remove_file(&rtd->dev, &dev_attr_pmdown_time); 884 device_remove_file(rtd->dev, &dev_attr_pmdown_time);
859 device_remove_file(&rtd->dev, &dev_attr_codec_reg); 885 device_remove_file(rtd->dev, &dev_attr_codec_reg);
860 device_unregister(&rtd->dev); 886 device_unregister(rtd->dev);
861 rtd->dev_registered = 0; 887 rtd->dev_registered = 0;
862 } 888 }
863 889
@@ -881,6 +907,10 @@ static void soc_remove_dai_link(struct snd_soc_card *card, int num, int order)
881 if (err < 0) 907 if (err < 0)
882 printk(KERN_ERR "asoc: failed to remove %s\n", platform->name); 908 printk(KERN_ERR "asoc: failed to remove %s\n", platform->name);
883 } 909 }
910
911 /* Make sure all DAPM widgets are freed */
912 snd_soc_dapm_free(&platform->dapm);
913
884 platform->probed = 0; 914 platform->probed = 0;
885 list_del(&platform->card_list); 915 list_del(&platform->card_list);
886 module_put(platform->dev->driver->owner); 916 module_put(platform->dev->driver->owner);
@@ -1032,7 +1062,10 @@ err_probe:
1032 return ret; 1062 return ret;
1033} 1063}
1034 1064
1035static void rtd_release(struct device *dev) {} 1065static void rtd_release(struct device *dev)
1066{
1067 kfree(dev);
1068}
1036 1069
1037static int soc_post_component_init(struct snd_soc_card *card, 1070static int soc_post_component_init(struct snd_soc_card *card,
1038 struct snd_soc_codec *codec, 1071 struct snd_soc_codec *codec,
@@ -1075,11 +1108,17 @@ static int soc_post_component_init(struct snd_soc_card *card,
1075 1108
1076 /* register the rtd device */ 1109 /* register the rtd device */
1077 rtd->codec = codec; 1110 rtd->codec = codec;
1078 rtd->dev.parent = card->dev; 1111
1079 rtd->dev.release = rtd_release; 1112 rtd->dev = kzalloc(sizeof(struct device), GFP_KERNEL);
1080 rtd->dev.init_name = name; 1113 if (!rtd->dev)
1114 return -ENOMEM;
1115 device_initialize(rtd->dev);
1116 rtd->dev->parent = card->dev;
1117 rtd->dev->release = rtd_release;
1118 rtd->dev->init_name = name;
1119 dev_set_drvdata(rtd->dev, rtd);
1081 mutex_init(&rtd->pcm_mutex); 1120 mutex_init(&rtd->pcm_mutex);
1082 ret = device_register(&rtd->dev); 1121 ret = device_add(rtd->dev);
1083 if (ret < 0) { 1122 if (ret < 0) {
1084 dev_err(card->dev, 1123 dev_err(card->dev,
1085 "asoc: failed to register runtime device: %d\n", ret); 1124 "asoc: failed to register runtime device: %d\n", ret);
@@ -1088,14 +1127,14 @@ static int soc_post_component_init(struct snd_soc_card *card,
1088 rtd->dev_registered = 1; 1127 rtd->dev_registered = 1;
1089 1128
1090 /* add DAPM sysfs entries for this codec */ 1129 /* add DAPM sysfs entries for this codec */
1091 ret = snd_soc_dapm_sys_add(&rtd->dev); 1130 ret = snd_soc_dapm_sys_add(rtd->dev);
1092 if (ret < 0) 1131 if (ret < 0)
1093 dev_err(codec->dev, 1132 dev_err(codec->dev,
1094 "asoc: failed to add codec dapm sysfs entries: %d\n", 1133 "asoc: failed to add codec dapm sysfs entries: %d\n",
1095 ret); 1134 ret);
1096 1135
1097 /* add codec sysfs entries */ 1136 /* add codec sysfs entries */
1098 ret = device_create_file(&rtd->dev, &dev_attr_codec_reg); 1137 ret = device_create_file(rtd->dev, &dev_attr_codec_reg);
1099 if (ret < 0) 1138 if (ret < 0)
1100 dev_err(codec->dev, 1139 dev_err(codec->dev,
1101 "asoc: failed to add codec sysfs files: %d\n", ret); 1140 "asoc: failed to add codec sysfs files: %d\n", ret);
@@ -1184,7 +1223,7 @@ static int soc_probe_dai_link(struct snd_soc_card *card, int num, int order)
1184 if (ret) 1223 if (ret)
1185 return ret; 1224 return ret;
1186 1225
1187 ret = device_create_file(&rtd->dev, &dev_attr_pmdown_time); 1226 ret = device_create_file(rtd->dev, &dev_attr_pmdown_time);
1188 if (ret < 0) 1227 if (ret < 0)
1189 printk(KERN_WARNING "asoc: failed to add pmdown_time sysfs\n"); 1228 printk(KERN_WARNING "asoc: failed to add pmdown_time sysfs\n");
1190 1229
@@ -1282,8 +1321,8 @@ static void soc_remove_aux_dev(struct snd_soc_card *card, int num)
1282 1321
1283 /* unregister the rtd device */ 1322 /* unregister the rtd device */
1284 if (rtd->dev_registered) { 1323 if (rtd->dev_registered) {
1285 device_remove_file(&rtd->dev, &dev_attr_codec_reg); 1324 device_remove_file(rtd->dev, &dev_attr_codec_reg);
1286 device_unregister(&rtd->dev); 1325 device_del(rtd->dev);
1287 rtd->dev_registered = 0; 1326 rtd->dev_registered = 0;
1288 } 1327 }
1289 1328
@@ -1482,6 +1521,10 @@ static void snd_soc_instantiate_card(struct snd_soc_card *card)
1482 1521
1483 snd_soc_dapm_new_widgets(&card->dapm); 1522 snd_soc_dapm_new_widgets(&card->dapm);
1484 1523
1524 if (card->fully_routed)
1525 list_for_each_entry(codec, &card->codec_dev_list, card_list)
1526 snd_soc_dapm_auto_nc_codec_pins(codec);
1527
1485 ret = snd_card_register(card->snd_card); 1528 ret = snd_card_register(card->snd_card);
1486 if (ret < 0) { 1529 if (ret < 0) {
1487 printk(KERN_ERR "asoc: failed to register soundcard for %s\n", card->name); 1530 printk(KERN_ERR "asoc: failed to register soundcard for %s\n", card->name);
@@ -2812,6 +2855,40 @@ int snd_soc_register_card(struct snd_soc_card *card)
2812 if (!card->name || !card->dev) 2855 if (!card->name || !card->dev)
2813 return -EINVAL; 2856 return -EINVAL;
2814 2857
2858 for (i = 0; i < card->num_links; i++) {
2859 struct snd_soc_dai_link *link = &card->dai_link[i];
2860
2861 /*
2862 * Codec must be specified by 1 of name or OF node,
2863 * not both or neither.
2864 */
2865 if (!!link->codec_name == !!link->codec_of_node) {
2866 dev_err(card->dev,
2867 "Neither/both codec name/of_node are set\n");
2868 return -EINVAL;
2869 }
2870
2871 /*
2872 * Platform may be specified by either name or OF node, but
2873 * can be left unspecified, and a dummy platform will be used.
2874 */
2875 if (link->platform_name && link->platform_of_node) {
2876 dev_err(card->dev,
2877 "Both platform name/of_node are set\n");
2878 return -EINVAL;
2879 }
2880
2881 /*
2882 * CPU DAI must be specified by 1 of name or OF node,
2883 * not both or neither.
2884 */
2885 if (!!link->cpu_dai_name == !!link->cpu_dai_of_node) {
2886 dev_err(card->dev,
2887 "Neither/both cpu_dai name/of_node are set\n");
2888 return -EINVAL;
2889 }
2890 }
2891
2815 dev_set_drvdata(card->dev, card); 2892 dev_set_drvdata(card->dev, card);
2816 2893
2817 snd_soc_initialize_card_lists(card); 2894 snd_soc_initialize_card_lists(card);
@@ -3299,6 +3376,87 @@ found:
3299} 3376}
3300EXPORT_SYMBOL_GPL(snd_soc_unregister_codec); 3377EXPORT_SYMBOL_GPL(snd_soc_unregister_codec);
3301 3378
3379/* Retrieve a card's name from device tree */
3380int snd_soc_of_parse_card_name(struct snd_soc_card *card,
3381 const char *propname)
3382{
3383 struct device_node *np = card->dev->of_node;
3384 int ret;
3385
3386 ret = of_property_read_string_index(np, propname, 0, &card->name);
3387 /*
3388 * EINVAL means the property does not exist. This is fine providing
3389 * card->name was previously set, which is checked later in
3390 * snd_soc_register_card.
3391 */
3392 if (ret < 0 && ret != -EINVAL) {
3393 dev_err(card->dev,
3394 "Property '%s' could not be read: %d\n",
3395 propname, ret);
3396 return ret;
3397 }
3398
3399 return 0;
3400}
3401EXPORT_SYMBOL_GPL(snd_soc_of_parse_card_name);
3402
3403int snd_soc_of_parse_audio_routing(struct snd_soc_card *card,
3404 const char *propname)
3405{
3406 struct device_node *np = card->dev->of_node;
3407 int num_routes;
3408 struct snd_soc_dapm_route *routes;
3409 int i, ret;
3410
3411 num_routes = of_property_count_strings(np, propname);
3412 if (num_routes & 1) {
3413 dev_err(card->dev,
3414 "Property '%s's length is not even\n",
3415 propname);
3416 return -EINVAL;
3417 }
3418 num_routes /= 2;
3419 if (!num_routes) {
3420 dev_err(card->dev,
3421 "Property '%s's length is zero\n",
3422 propname);
3423 return -EINVAL;
3424 }
3425
3426 routes = devm_kzalloc(card->dev, num_routes * sizeof(*routes),
3427 GFP_KERNEL);
3428 if (!routes) {
3429 dev_err(card->dev,
3430 "Could not allocate DAPM route table\n");
3431 return -EINVAL;
3432 }
3433
3434 for (i = 0; i < num_routes; i++) {
3435 ret = of_property_read_string_index(np, propname,
3436 2 * i, &routes[i].sink);
3437 if (ret) {
3438 dev_err(card->dev,
3439 "Property '%s' index %d could not be read: %d\n",
3440 propname, 2 * i, ret);
3441 return -EINVAL;
3442 }
3443 ret = of_property_read_string_index(np, propname,
3444 (2 * i) + 1, &routes[i].source);
3445 if (ret) {
3446 dev_err(card->dev,
3447 "Property '%s' index %d could not be read: %d\n",
3448 propname, (2 * i) + 1, ret);
3449 return -EINVAL;
3450 }
3451 }
3452
3453 card->num_dapm_routes = num_routes;
3454 card->dapm_routes = routes;
3455
3456 return 0;
3457}
3458EXPORT_SYMBOL_GPL(snd_soc_of_parse_audio_routing);
3459
3302static int __init snd_soc_init(void) 3460static int __init snd_soc_init(void)
3303{ 3461{
3304#ifdef CONFIG_DEBUG_FS 3462#ifdef CONFIG_DEBUG_FS
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index f42e8b9fb17..1f55ded4047 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 */
@@ -1413,7 +1426,7 @@ static int dapm_power_widgets(struct snd_soc_dapm_context *dapm, int event)
1413 dapm->target_bias_level = SND_SOC_BIAS_ON; 1426 dapm->target_bias_level = SND_SOC_BIAS_ON;
1414 break; 1427 break;
1415 case SND_SOC_DAPM_STREAM_STOP: 1428 case SND_SOC_DAPM_STREAM_STOP:
1416 if (dapm->codec->active) 1429 if (dapm->codec && dapm->codec->active)
1417 dapm->target_bias_level = SND_SOC_BIAS_ON; 1430 dapm->target_bias_level = SND_SOC_BIAS_ON;
1418 else 1431 else
1419 dapm->target_bias_level = SND_SOC_BIAS_STANDBY; 1432 dapm->target_bias_level = SND_SOC_BIAS_STANDBY;
@@ -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..21554611557 100644
--- a/sound/soc/txx9/txx9aclc.c
+++ b/sound/soc/txx9/txx9aclc.c
@@ -134,7 +134,7 @@ txx9aclc_dma_submit(struct txx9aclc_dmadata *dmadata, dma_addr_t buf_dma_addr)
134 sg_dma_address(&sg) = buf_dma_addr; 134 sg_dma_address(&sg) = buf_dma_addr;
135 desc = chan->device->device_prep_slave_sg(chan, &sg, 1, 135 desc = chan->device->device_prep_slave_sg(chan, &sg, 1,
136 dmadata->substream->stream == SNDRV_PCM_STREAM_PLAYBACK ? 136 dmadata->substream->stream == SNDRV_PCM_STREAM_PLAYBACK ?
137 DMA_TO_DEVICE : DMA_FROM_DEVICE, 137 DMA_MEM_TO_DEV : DMA_DEV_TO_MEM,
138 DMA_PREP_INTERRUPT | DMA_CTRL_ACK); 138 DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
139 if (!desc) { 139 if (!desc) {
140 dev_err(&chan->dev->device, "cannot prepare slave dma\n"); 140 dev_err(&chan->dev->device, "cannot prepare slave dma\n");
@@ -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");
diff --git a/sound/sound_core.c b/sound/sound_core.c
index 6ce277860fd..c6e81fb928e 100644
--- a/sound/sound_core.c
+++ b/sound/sound_core.c
@@ -29,7 +29,7 @@ MODULE_DESCRIPTION("Core sound module");
29MODULE_AUTHOR("Alan Cox"); 29MODULE_AUTHOR("Alan Cox");
30MODULE_LICENSE("GPL"); 30MODULE_LICENSE("GPL");
31 31
32static char *sound_devnode(struct device *dev, mode_t *mode) 32static char *sound_devnode(struct device *dev, umode_t *mode)
33{ 33{
34 if (MAJOR(dev->devt) == SOUND_MAJOR) 34 if (MAJOR(dev->devt) == SOUND_MAJOR)
35 return NULL; 35 return NULL;
diff --git a/sound/sparc/amd7930.c b/sound/sparc/amd7930.c
index f036776380b..b63b3a86d3f 100644
--- a/sound/sparc/amd7930.c
+++ b/sound/sparc/amd7930.c
@@ -50,7 +50,7 @@
50 50
51static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 51static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
52static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 52static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
53static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 53static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
54 54
55module_param_array(index, int, NULL, 0444); 55module_param_array(index, int, NULL, 0444);
56MODULE_PARM_DESC(index, "Index value for Sun AMD7930 soundcard."); 56MODULE_PARM_DESC(index, "Index value for Sun AMD7930 soundcard.");
diff --git a/sound/sparc/cs4231.c b/sound/sparc/cs4231.c
index 0e618f82808..f2eabd3f22f 100644
--- a/sound/sparc/cs4231.c
+++ b/sound/sparc/cs4231.c
@@ -40,7 +40,7 @@
40static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 40static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
41static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 41static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
42/* Enable this card */ 42/* Enable this card */
43static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 43static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
44 44
45module_param_array(index, int, NULL, 0444); 45module_param_array(index, int, NULL, 0444);
46MODULE_PARM_DESC(index, "Index value for Sun CS4231 soundcard."); 46MODULE_PARM_DESC(index, "Index value for Sun CS4231 soundcard.");
@@ -2118,15 +2118,4 @@ static struct platform_driver cs4231_driver = {
2118 .remove = __devexit_p(cs4231_remove), 2118 .remove = __devexit_p(cs4231_remove),
2119}; 2119};
2120 2120
2121static int __init cs4231_init(void) 2121module_platform_driver(cs4231_driver);
2122{
2123 return platform_driver_register(&cs4231_driver);
2124}
2125
2126static void __exit cs4231_exit(void)
2127{
2128 platform_driver_unregister(&cs4231_driver);
2129}
2130
2131module_init(cs4231_init);
2132module_exit(cs4231_exit);
diff --git a/sound/sparc/dbri.c b/sound/sparc/dbri.c
index 4a4f1d74033..a6b0deb7774 100644
--- a/sound/sparc/dbri.c
+++ b/sound/sparc/dbri.c
@@ -80,7 +80,7 @@ MODULE_SUPPORTED_DEVICE("{{Sun,DBRI}}");
80static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 80static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
81static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 81static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
82/* Enable this card */ 82/* Enable this card */
83static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 83static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
84 84
85module_param_array(index, int, NULL, 0444); 85module_param_array(index, int, NULL, 0444);
86MODULE_PARM_DESC(index, "Index value for Sun DBRI soundcard."); 86MODULE_PARM_DESC(index, "Index value for Sun DBRI soundcard.");
@@ -2697,16 +2697,4 @@ static struct platform_driver dbri_sbus_driver = {
2697 .remove = __devexit_p(dbri_remove), 2697 .remove = __devexit_p(dbri_remove),
2698}; 2698};
2699 2699
2700/* Probe for the dbri chip and then attach the driver. */ 2700module_platform_driver(dbri_sbus_driver);
2701static int __init dbri_init(void)
2702{
2703 return platform_driver_register(&dbri_sbus_driver);
2704}
2705
2706static void __exit dbri_exit(void)
2707{
2708 platform_driver_unregister(&dbri_sbus_driver);
2709}
2710
2711module_init(dbri_init);
2712module_exit(dbri_exit);
diff --git a/sound/usb/6fire/chip.c b/sound/usb/6fire/chip.c
index c7dca7b0b9f..8af92e3e9c1 100644
--- a/sound/usb/6fire/chip.c
+++ b/sound/usb/6fire/chip.c
@@ -35,7 +35,7 @@ MODULE_SUPPORTED_DEVICE("{{TerraTec, DMX 6Fire USB}}");
35 35
36static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-max */ 36static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-max */
37static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* Id for card */ 37static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* Id for card */
38static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable card */ 38static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable card */
39static struct sfire_chip *chips[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; 39static struct sfire_chip *chips[SNDRV_CARDS] = SNDRV_DEFAULT_PTR;
40static struct usb_device *devices[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; 40static struct usb_device *devices[SNDRV_CARDS] = SNDRV_DEFAULT_PTR;
41 41
@@ -211,22 +211,11 @@ static struct usb_device_id device_table[] = {
211 211
212MODULE_DEVICE_TABLE(usb, device_table); 212MODULE_DEVICE_TABLE(usb, device_table);
213 213
214static struct usb_driver driver = { 214static struct usb_driver usb_driver = {
215 .name = "snd-usb-6fire", 215 .name = "snd-usb-6fire",
216 .probe = usb6fire_chip_probe, 216 .probe = usb6fire_chip_probe,
217 .disconnect = usb6fire_chip_disconnect, 217 .disconnect = usb6fire_chip_disconnect,
218 .id_table = device_table, 218 .id_table = device_table,
219}; 219};
220 220
221static int __init usb6fire_chip_init(void) 221module_usb_driver(usb_driver);
222{
223 return usb_register(&driver);
224}
225
226static void __exit usb6fire_chip_cleanup(void)
227{
228 usb_deregister(&driver);
229}
230
231module_init(usb6fire_chip_init);
232module_exit(usb6fire_chip_cleanup);
diff --git a/sound/usb/caiaq/device.c b/sound/usb/caiaq/device.c
index 3eb605bd950..64aed432ae2 100644
--- a/sound/usb/caiaq/device.c
+++ b/sound/usb/caiaq/device.c
@@ -55,7 +55,7 @@ MODULE_SUPPORTED_DEVICE("{{Native Instruments, RigKontrol2},"
55 55
56static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-max */ 56static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-max */
57static char* id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* Id for this card */ 57static char* id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* Id for this card */
58static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 58static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
59static int snd_card_used[SNDRV_CARDS]; 59static int snd_card_used[SNDRV_CARDS];
60 60
61module_param_array(index, int, NULL, 0444); 61module_param_array(index, int, NULL, 0444);
@@ -538,16 +538,5 @@ static struct usb_driver snd_usb_driver = {
538 .id_table = snd_usb_id_table, 538 .id_table = snd_usb_id_table,
539}; 539};
540 540
541static int __init snd_module_init(void) 541module_usb_driver(snd_usb_driver);
542{
543 return usb_register(&snd_usb_driver);
544}
545
546static void __exit snd_module_exit(void)
547{
548 usb_deregister(&snd_usb_driver);
549}
550
551module_init(snd_module_init)
552module_exit(snd_module_exit)
553 542
diff --git a/sound/usb/card.c b/sound/usb/card.c
index 0f6dc0d457b..4a7be7b9833 100644
--- a/sound/usb/card.c
+++ b/sound/usb/card.c
@@ -78,14 +78,14 @@ MODULE_SUPPORTED_DEVICE("{{Generic,USB Audio}}");
78 78
79static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 79static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
80static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 80static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
81static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;/* Enable this card */ 81static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;/* Enable this card */
82/* Vendor/product IDs for this card */ 82/* Vendor/product IDs for this card */
83static int vid[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = -1 }; 83static int vid[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = -1 };
84static int pid[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = -1 }; 84static int pid[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = -1 };
85static int nrpacks = 8; /* max. number of packets per urb */ 85static int nrpacks = 8; /* max. number of packets per urb */
86static int async_unlink = 1; 86static bool async_unlink = 1;
87static int device_setup[SNDRV_CARDS]; /* device parameter for this card */ 87static int device_setup[SNDRV_CARDS]; /* device parameter for this card */
88static int ignore_ctl_error; 88static bool ignore_ctl_error;
89 89
90module_param_array(index, int, NULL, 0444); 90module_param_array(index, int, NULL, 0444);
91MODULE_PARM_DESC(index, "Index value for the USB audio adapter."); 91MODULE_PARM_DESC(index, "Index value for the USB audio adapter.");
diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c
index 81c6edecd86..08dcce53720 100644
--- a/sound/usb/endpoint.c
+++ b/sound/usb/endpoint.c
@@ -17,6 +17,7 @@
17 17
18#include <linux/gfp.h> 18#include <linux/gfp.h>
19#include <linux/init.h> 19#include <linux/init.h>
20#include <linux/ratelimit.h>
20#include <linux/usb.h> 21#include <linux/usb.h>
21#include <linux/usb/audio.h> 22#include <linux/usb/audio.h>
22 23
@@ -458,8 +459,8 @@ static int retire_capture_urb(struct snd_usb_substream *subs,
458 459
459 for (i = 0; i < urb->number_of_packets; i++) { 460 for (i = 0; i < urb->number_of_packets; i++) {
460 cp = (unsigned char *)urb->transfer_buffer + urb->iso_frame_desc[i].offset; 461 cp = (unsigned char *)urb->transfer_buffer + urb->iso_frame_desc[i].offset;
461 if (urb->iso_frame_desc[i].status) { 462 if (urb->iso_frame_desc[i].status && printk_ratelimit()) {
462 snd_printd(KERN_ERR "frame %d active: %d\n", i, urb->iso_frame_desc[i].status); 463 snd_printdd("frame %d active: %d\n", i, urb->iso_frame_desc[i].status);
463 // continue; 464 // continue;
464 } 465 }
465 bytes = urb->iso_frame_desc[i].actual_length; 466 bytes = urb->iso_frame_desc[i].actual_length;
diff --git a/sound/usb/format.c b/sound/usb/format.c
index 89421d17657..e09aba19375 100644
--- a/sound/usb/format.c
+++ b/sound/usb/format.c
@@ -209,6 +209,8 @@ static int parse_audio_format_rates_v1(struct snd_usb_audio *chip, struct audiof
209 return 0; 209 return 0;
210} 210}
211 211
212#define MAX_UAC2_NR_RATES 1024
213
212/* 214/*
213 * Helper function to walk the array of sample rate triplets reported by 215 * Helper function to walk the array of sample rate triplets reported by
214 * the device. The problem is that we need to parse whole array first to 216 * the device. The problem is that we need to parse whole array first to
@@ -226,7 +228,7 @@ static int parse_uac2_sample_rate_range(struct audioformat *fp, int nr_triplets,
226 int min = combine_quad(&data[2 + 12 * i]); 228 int min = combine_quad(&data[2 + 12 * i]);
227 int max = combine_quad(&data[6 + 12 * i]); 229 int max = combine_quad(&data[6 + 12 * i]);
228 int res = combine_quad(&data[10 + 12 * i]); 230 int res = combine_quad(&data[10 + 12 * i]);
229 int rate; 231 unsigned int rate;
230 232
231 if ((max < 0) || (min < 0) || (res < 0) || (max < min)) 233 if ((max < 0) || (min < 0) || (res < 0) || (max < min))
232 continue; 234 continue;
@@ -253,6 +255,10 @@ static int parse_uac2_sample_rate_range(struct audioformat *fp, int nr_triplets,
253 fp->rates |= snd_pcm_rate_to_rate_bit(rate); 255 fp->rates |= snd_pcm_rate_to_rate_bit(rate);
254 256
255 nr_rates++; 257 nr_rates++;
258 if (nr_rates >= MAX_UAC2_NR_RATES) {
259 snd_printk(KERN_ERR "invalid uac2 rates\n");
260 break;
261 }
256 262
257 /* avoid endless loop */ 263 /* avoid endless loop */
258 if (res == 0) 264 if (res == 0)
diff --git a/sound/usb/misc/ua101.c b/sound/usb/misc/ua101.c
index c0609c21030..8b81cb54026 100644
--- a/sound/usb/misc/ua101.c
+++ b/sound/usb/misc/ua101.c
@@ -52,7 +52,7 @@ MODULE_SUPPORTED_DEVICE("{{Edirol,UA-101},{Edirol,UA-1000}}");
52 52
53static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 53static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
54static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 54static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
55static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 55static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
56static unsigned int queue_length = 21; 56static unsigned int queue_length = 21;
57 57
58module_param_array(index, int, NULL, 0444); 58module_param_array(index, int, NULL, 0444);
@@ -1387,16 +1387,4 @@ static struct usb_driver ua101_driver = {
1387#endif 1387#endif
1388}; 1388};
1389 1389
1390static int __init alsa_card_ua101_init(void) 1390module_usb_driver(ua101_driver);
1391{
1392 return usb_register(&ua101_driver);
1393}
1394
1395static void __exit alsa_card_ua101_exit(void)
1396{
1397 usb_deregister(&ua101_driver);
1398 mutex_destroy(&devices_mutex);
1399}
1400
1401module_init(alsa_card_ua101_init);
1402module_exit(alsa_card_ua101_exit);
diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h
index b61945f3af9..8edc5035fc8 100644
--- a/sound/usb/quirks-table.h
+++ b/sound/usb/quirks-table.h
@@ -269,6 +269,32 @@ YAMAHA_DEVICE(0x105a, NULL),
269YAMAHA_DEVICE(0x105b, NULL), 269YAMAHA_DEVICE(0x105b, NULL),
270YAMAHA_DEVICE(0x105c, NULL), 270YAMAHA_DEVICE(0x105c, NULL),
271YAMAHA_DEVICE(0x105d, NULL), 271YAMAHA_DEVICE(0x105d, NULL),
272{
273 USB_DEVICE(0x0499, 0x1503),
274 .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
275 /* .vendor_name = "Yamaha", */
276 /* .product_name = "MOX6/MOX8", */
277 .ifnum = QUIRK_ANY_INTERFACE,
278 .type = QUIRK_COMPOSITE,
279 .data = (const struct snd_usb_audio_quirk[]) {
280 {
281 .ifnum = 1,
282 .type = QUIRK_AUDIO_STANDARD_INTERFACE
283 },
284 {
285 .ifnum = 2,
286 .type = QUIRK_AUDIO_STANDARD_INTERFACE
287 },
288 {
289 .ifnum = 3,
290 .type = QUIRK_MIDI_YAMAHA
291 },
292 {
293 .ifnum = -1
294 }
295 }
296 }
297},
272YAMAHA_DEVICE(0x2000, "DGP-7"), 298YAMAHA_DEVICE(0x2000, "DGP-7"),
273YAMAHA_DEVICE(0x2001, "DGP-5"), 299YAMAHA_DEVICE(0x2001, "DGP-5"),
274YAMAHA_DEVICE(0x2002, NULL), 300YAMAHA_DEVICE(0x2002, NULL),
@@ -1633,6 +1659,37 @@ YAMAHA_DEVICE(0x7010, "UB99"),
1633 } 1659 }
1634}, 1660},
1635{ 1661{
1662 /* Roland GAIA SH-01 */
1663 USB_DEVICE(0x0582, 0x0111),
1664 .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) {
1665 .vendor_name = "Roland",
1666 .product_name = "GAIA",
1667 .ifnum = QUIRK_ANY_INTERFACE,
1668 .type = QUIRK_COMPOSITE,
1669 .data = (const struct snd_usb_audio_quirk[]) {
1670 {
1671 .ifnum = 0,
1672 .type = QUIRK_AUDIO_STANDARD_INTERFACE
1673 },
1674 {
1675 .ifnum = 1,
1676 .type = QUIRK_AUDIO_STANDARD_INTERFACE
1677 },
1678 {
1679 .ifnum = 2,
1680 .type = QUIRK_MIDI_FIXED_ENDPOINT,
1681 .data = &(const struct snd_usb_midi_endpoint_info) {
1682 .out_cables = 0x0003,
1683 .in_cables = 0x0003
1684 }
1685 },
1686 {
1687 .ifnum = -1
1688 }
1689 }
1690 }
1691},
1692{
1636 USB_DEVICE(0x0582, 0x0113), 1693 USB_DEVICE(0x0582, 0x0113),
1637 .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) { 1694 .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
1638 /* .vendor_name = "BOSS", */ 1695 /* .vendor_name = "BOSS", */
@@ -2305,6 +2362,16 @@ YAMAHA_DEVICE(0x7010, "UB99"),
2305 } 2362 }
2306}, 2363},
2307 2364
2365{
2366 USB_DEVICE_VENDOR_SPEC(0x0944, 0x0201),
2367 .driver_info = (unsigned long) & (const struct snd_usb_audio_quirk) {
2368 .vendor_name = "KORG, Inc.",
2369 /* .product_name = "ToneLab ST", */
2370 .ifnum = 3,
2371 .type = QUIRK_MIDI_STANDARD_INTERFACE,
2372 }
2373},
2374
2308/* AKAI devices */ 2375/* AKAI devices */
2309{ 2376{
2310 USB_DEVICE(0x09e8, 0x0062), 2377 USB_DEVICE(0x09e8, 0x0062),
diff --git a/sound/usb/usx2y/us122l.c b/sound/usb/usx2y/us122l.c
index 726c1a7b89b..c4fd3b1d959 100644
--- a/sound/usb/usx2y/us122l.c
+++ b/sound/usb/usx2y/us122l.c
@@ -37,7 +37,7 @@ MODULE_LICENSE("GPL");
37static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-max */ 37static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-max */
38static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* Id for this card */ 38static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* Id for this card */
39 /* Enable this card */ 39 /* Enable this card */
40static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 40static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
41 41
42module_param_array(index, int, NULL, 0444); 42module_param_array(index, int, NULL, 0444);
43MODULE_PARM_DESC(index, "Index value for "NAME_ALLCAPS"."); 43MODULE_PARM_DESC(index, "Index value for "NAME_ALLCAPS".");
@@ -772,16 +772,4 @@ static struct usb_driver snd_us122l_usb_driver = {
772 .supports_autosuspend = 1 772 .supports_autosuspend = 1
773}; 773};
774 774
775 775module_usb_driver(snd_us122l_usb_driver);
776static int __init snd_us122l_module_init(void)
777{
778 return usb_register(&snd_us122l_usb_driver);
779}
780
781static void __exit snd_us122l_module_exit(void)
782{
783 usb_deregister(&snd_us122l_usb_driver);
784}
785
786module_init(snd_us122l_module_init)
787module_exit(snd_us122l_module_exit)
diff --git a/sound/usb/usx2y/usb_stream.c b/sound/usb/usx2y/usb_stream.c
index c400ade3ff0..1e7a47a8660 100644
--- a/sound/usb/usx2y/usb_stream.c
+++ b/sound/usb/usx2y/usb_stream.c
@@ -674,7 +674,7 @@ dotry:
674 inurb->transfer_buffer_length = 674 inurb->transfer_buffer_length =
675 inurb->number_of_packets * 675 inurb->number_of_packets *
676 inurb->iso_frame_desc[0].length; 676 inurb->iso_frame_desc[0].length;
677 preempt_disable(); 677
678 if (u == 0) { 678 if (u == 0) {
679 int now; 679 int now;
680 struct usb_device *dev = inurb->dev; 680 struct usb_device *dev = inurb->dev;
@@ -686,19 +686,17 @@ dotry:
686 } 686 }
687 err = usb_submit_urb(inurb, GFP_ATOMIC); 687 err = usb_submit_urb(inurb, GFP_ATOMIC);
688 if (err < 0) { 688 if (err < 0) {
689 preempt_enable();
690 snd_printk(KERN_ERR"usb_submit_urb(sk->inurb[%i])" 689 snd_printk(KERN_ERR"usb_submit_urb(sk->inurb[%i])"
691 " returned %i\n", u, err); 690 " returned %i\n", u, err);
692 return err; 691 return err;
693 } 692 }
694 err = usb_submit_urb(outurb, GFP_ATOMIC); 693 err = usb_submit_urb(outurb, GFP_ATOMIC);
695 if (err < 0) { 694 if (err < 0) {
696 preempt_enable();
697 snd_printk(KERN_ERR"usb_submit_urb(sk->outurb[%i])" 695 snd_printk(KERN_ERR"usb_submit_urb(sk->outurb[%i])"
698 " returned %i\n", u, err); 696 " returned %i\n", u, err);
699 return err; 697 return err;
700 } 698 }
701 preempt_enable(); 699
702 if (inurb->start_frame != outurb->start_frame) { 700 if (inurb->start_frame != outurb->start_frame) {
703 snd_printd(KERN_DEBUG 701 snd_printd(KERN_DEBUG
704 "u[%i] start_frames differ in:%u out:%u\n", 702 "u[%i] start_frames differ in:%u out:%u\n",
diff --git a/sound/usb/usx2y/usbusx2y.c b/sound/usb/usx2y/usbusx2y.c
index cbd37f2c76d..9af7c1f1741 100644
--- a/sound/usb/usx2y/usbusx2y.c
+++ b/sound/usb/usx2y/usbusx2y.c
@@ -154,7 +154,7 @@ MODULE_SUPPORTED_DEVICE("{{TASCAM(0x1604), "NAME_ALLCAPS"(0x8001)(0x8005)(0x8007
154 154
155static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-max */ 155static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-max */
156static char* id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* Id for this card */ 156static char* id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* Id for this card */
157static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 157static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
158 158
159module_param_array(index, int, NULL, 0444); 159module_param_array(index, int, NULL, 0444);
160MODULE_PARM_DESC(index, "Index value for "NAME_ALLCAPS"."); 160MODULE_PARM_DESC(index, "Index value for "NAME_ALLCAPS".");
@@ -459,15 +459,4 @@ static void usX2Y_usb_disconnect(struct usb_device *device, void* ptr)
459 } 459 }
460} 460}
461 461
462static int __init snd_usX2Y_module_init(void) 462module_usb_driver(snd_usX2Y_usb_driver);
463{
464 return usb_register(&snd_usX2Y_usb_driver);
465}
466
467static void __exit snd_usX2Y_module_exit(void)
468{
469 usb_deregister(&snd_usX2Y_usb_driver);
470}
471
472module_init(snd_usX2Y_module_init)
473module_exit(snd_usX2Y_module_exit)