Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
authorLinus Torvalds <torvalds@linux-foundation.org>
Thu, 26 Mar 2009 18:05:17 +0000 (11:05 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 26 Mar 2009 18:05:17 +0000 (11:05 -0700)
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6: (430 commits)
  ALSA: hda - Add quirk for Acer Ferrari 5000
  ALSA: hda - Use cached calls to get widget caps and pin caps
  ALSA: hda - Don't create empty/single-item input source
  ALSA: hda - Fix the wrong pin-cap check in patch_realtek.c
  ALSA: hda - Cache pin-cap values
  ALSA: hda - Avoid output amp manipulation to digital mic pins
  ALSA: hda - Add function id to proc output
  ALSA: pcm - Safer boundary checks
  ALSA: hda - Detect digital-mic inputs on ALC663 / ALC272
  ALSA: sound/ali5451: typo: s/resouces/resources/
  ALSA: hda - Don't show the current connection for power widgets
  ALSA: Fix wrong pointer to dev_err() in arm/pxa2xx-ac97-lib.c
  ASoC: Declare Headset as Mic and Headphone widgets for SDP3430
  ASoC: OMAP: N810: Add more jack functions
  ASoC: OMAP: N810: Mark not connected input pins
  ASoC: Add FLL support for WM8400
  ALSA: hda - Don't reset stream at each prepare callback
  ALSA: hda - Don't reset BDL unnecessarily
  ALSA: pcm - Fix delta calculation at boundary overlap
  ALSA: pcm - Reset invalid position even without debug option
  ...

415 files changed:
Documentation/DocBook/Makefile
Documentation/DocBook/alsa-driver-api.tmpl [moved from Documentation/sound/alsa/DocBook/alsa-driver-api.tmpl with 87% similarity]
Documentation/DocBook/writing-an-alsa-driver.tmpl [moved from Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl with 99% similarity]
Documentation/sound/alsa/ALSA-Configuration.txt
Documentation/sound/alsa/HD-Audio-Models.txt
Documentation/sound/alsa/HD-Audio.txt
Documentation/sound/alsa/soc/dapm.txt
Documentation/sound/oss/CS4232 [deleted file]
Documentation/sound/oss/Introduction
arch/arm/mach-pxa/e740.c
arch/arm/mach-pxa/e750.c
arch/arm/mach-pxa/h5000.c
arch/arm/mach-pxa/include/mach/eseries-gpio.h
arch/arm/mach-pxa/include/mach/regs-ssp.h
arch/arm/mach-pxa/spitz.c
arch/arm/mach-s3c2410/dma.c
arch/arm/mach-s3c2412/dma.c
arch/arm/mach-s3c2440/dma.c
arch/arm/mach-s3c2443/dma.c
arch/arm/plat-s3c/include/plat/audio.h [moved from arch/arm/mach-s3c2410/include/mach/audio.h with 100% similarity]
arch/arm/plat-s3c/include/plat/regs-s3c2412-iis.h [moved from include/asm-arm/plat-s3c24xx/regs-s3c2412-iis.h with 93% similarity]
arch/arm/plat-s3c24xx/include/plat/regs-iis.h [moved from include/asm-arm/plat-s3c24xx/regs-iis.h with 100% similarity]
drivers/media/video/cx88/cx88-alsa.c
drivers/media/video/em28xx/em28xx-audio.c
drivers/media/video/saa7134/saa7134-alsa.c
drivers/staging/go7007/snd-go7007.c
drivers/usb/gadget/gmidi.c
include/linux/input.h
include/linux/mfd/wm8350/audio.h
include/linux/mfd/wm8400-audio.h
include/linux/pci_ids.h
include/sound/ad1816a.h
include/sound/asound.h
include/sound/atmel-abdac.h [new file with mode: 0644]
include/sound/atmel-ac97c.h [new file with mode: 0644]
include/sound/control.h
include/sound/core.h
include/sound/hwdep.h
include/sound/jack.h
include/sound/pcm.h
include/sound/pxa2xx-lib.h
include/sound/rawmidi.h
include/sound/sb.h
include/sound/sfnt_info.h
include/sound/soc-dai.h
include/sound/soc-dapm.h
include/sound/soc.h
include/sound/uda1341.h [deleted file]
include/sound/version.h
include/sound/wss.h
sound/Kconfig
sound/Makefile
sound/aoa/aoa-gpio.h
sound/aoa/core/alsa.c
sound/aoa/core/gpio-feature.c
sound/aoa/fabrics/layout.c
sound/aoa/soundbus/i2sbus/core.c
sound/arm/Kconfig
sound/arm/Makefile
sound/arm/aaci.c
sound/arm/pxa2xx-ac97-lib.c
sound/arm/pxa2xx-ac97.c
sound/arm/sa11xx-uda1341.c [deleted file]
sound/atmel/Kconfig [new file with mode: 0644]
sound/atmel/Makefile [new file with mode: 0644]
sound/atmel/abdac.c [new file with mode: 0644]
sound/atmel/ac97c.c [new file with mode: 0644]
sound/atmel/ac97c.h [new file with mode: 0644]
sound/core/hwdep.c
sound/core/init.c
sound/core/jack.c
sound/core/misc.c
sound/core/oss/pcm_oss.c
sound/core/oss/pcm_plugin.h
sound/core/pcm.c
sound/core/pcm_lib.c
sound/core/pcm_native.c
sound/core/pcm_timer.c
sound/core/rawmidi.c
sound/core/seq/oss/seq_oss_device.h
sound/core/seq/seq_prioq.c
sound/core/vmaster.c
sound/drivers/dummy.c
sound/drivers/ml403-ac97cr.c
sound/drivers/mpu401/mpu401.c
sound/drivers/mtpav.c
sound/drivers/mts64.c
sound/drivers/opl3/opl3_lib.c
sound/drivers/opl3/opl3_midi.c
sound/drivers/opl3/opl3_oss.c
sound/drivers/opl3/opl3_synth.c
sound/drivers/pcsp/pcsp.c
sound/drivers/portman2x4.c
sound/drivers/serial-u16550.c
sound/drivers/virmidi.c
sound/drivers/vx/vx_core.c
sound/drivers/vx/vx_hwdep.c
sound/drivers/vx/vx_uer.c
sound/i2c/Makefile
sound/i2c/l3/Makefile [deleted file]
sound/i2c/l3/uda1341.c [deleted file]
sound/isa/Kconfig
sound/isa/Makefile
sound/isa/ad1816a/ad1816a.c
sound/isa/ad1816a/ad1816a_lib.c
sound/isa/ad1848/ad1848.c
sound/isa/adlib.c
sound/isa/als100.c
sound/isa/azt2320.c
sound/isa/cmi8330.c
sound/isa/cs423x/Makefile
sound/isa/cs423x/cs4231.c
sound/isa/cs423x/cs4232.c [deleted file]
sound/isa/cs423x/cs4236.c
sound/isa/cs423x/cs4236_lib.c
sound/isa/dt019x.c
sound/isa/es1688/es1688.c
sound/isa/es1688/es1688_lib.c
sound/isa/es18xx.c
sound/isa/gus/gus_dma.c
sound/isa/gus/gus_irq.c
sound/isa/gus/gus_pcm.c
sound/isa/gus/gus_uart.c
sound/isa/gus/gusclassic.c
sound/isa/gus/gusextreme.c
sound/isa/gus/gusmax.c
sound/isa/gus/interwave.c
sound/isa/msnd/Makefile [new file with mode: 0644]
sound/isa/msnd/msnd.c [new file with mode: 0644]
sound/isa/msnd/msnd.h [new file with mode: 0644]
sound/isa/msnd/msnd_classic.c [new file with mode: 0644]
sound/isa/msnd/msnd_classic.h [new file with mode: 0644]
sound/isa/msnd/msnd_midi.c [new file with mode: 0644]
sound/isa/msnd/msnd_pinnacle.c [new file with mode: 0644]
sound/isa/msnd/msnd_pinnacle.h [new file with mode: 0644]
sound/isa/msnd/msnd_pinnacle_mixer.c [new file with mode: 0644]
sound/isa/opl3sa2.c
sound/isa/opti9xx/miro.c
sound/isa/opti9xx/opti92x-ad1848.c
sound/isa/sb/es968.c
sound/isa/sb/sb16.c
sound/isa/sb/sb8.c
sound/isa/sb/sb_mixer.c
sound/isa/sc6000.c
sound/isa/sgalaxy.c
sound/isa/sscape.c
sound/isa/wavefront/wavefront.c
sound/isa/wavefront/wavefront_synth.c
sound/isa/wss/wss_lib.c
sound/mips/au1x00.c
sound/mips/hal2.c
sound/mips/sgio2audio.c
sound/oss/ad1848.c
sound/oss/dmabuf.c
sound/oss/pas2_card.c
sound/oss/pss.c
sound/oss/sequencer.c
sound/parisc/harmony.c
sound/pci/Kconfig
sound/pci/ac97/ac97_codec.c
sound/pci/ac97/ac97_proc.c
sound/pci/ad1889.c
sound/pci/ak4531_codec.c
sound/pci/ali5451/ali5451.c
sound/pci/als300.c
sound/pci/als4000.c
sound/pci/atiixp.c
sound/pci/atiixp_modem.c
sound/pci/au88x0/au88x0.c
sound/pci/au88x0/au88x0_a3d.c
sound/pci/au88x0/au88x0_core.c
sound/pci/au88x0/au88x0_synth.c
sound/pci/aw2/aw2-alsa.c
sound/pci/azt3328.c
sound/pci/bt87x.c
sound/pci/ca0106/ca0106_main.c
sound/pci/cmipci.c
sound/pci/cs4281.c
sound/pci/cs46xx/cs46xx.c
sound/pci/cs46xx/cs46xx_lib.c
sound/pci/cs46xx/cs46xx_lib.h
sound/pci/cs5530.c
sound/pci/cs5535audio/cs5535audio.c
sound/pci/echoaudio/Makefile
sound/pci/echoaudio/echo3g_dsp.c
sound/pci/echoaudio/echoaudio.c
sound/pci/echoaudio/echoaudio.h
sound/pci/echoaudio/echoaudio_3g.c
sound/pci/echoaudio/echoaudio_dsp.c
sound/pci/echoaudio/echoaudio_dsp.h
sound/pci/echoaudio/gina20_dsp.c
sound/pci/echoaudio/indigo_dsp.c
sound/pci/echoaudio/indigo_express_dsp.c [new file with mode: 0644]
sound/pci/echoaudio/indigodj_dsp.c
sound/pci/echoaudio/indigodjx.c [new file with mode: 0644]
sound/pci/echoaudio/indigodjx_dsp.c [new file with mode: 0644]
sound/pci/echoaudio/indigoio_dsp.c
sound/pci/echoaudio/indigoiox.c [new file with mode: 0644]
sound/pci/echoaudio/indigoiox_dsp.c [new file with mode: 0644]
sound/pci/echoaudio/layla20_dsp.c
sound/pci/echoaudio/mia_dsp.c
sound/pci/echoaudio/midi.c
sound/pci/emu10k1/emu10k1.c
sound/pci/emu10k1/emu10k1_callback.c
sound/pci/emu10k1/emu10k1_main.c
sound/pci/emu10k1/emu10k1x.c
sound/pci/emu10k1/emufx.c
sound/pci/emu10k1/emupcm.c
sound/pci/emu10k1/io.c
sound/pci/emu10k1/p16v.c
sound/pci/emu10k1/voice.c
sound/pci/ens1370.c
sound/pci/es1938.c
sound/pci/es1968.c
sound/pci/fm801.c
sound/pci/hda/hda_beep.c
sound/pci/hda/hda_beep.h
sound/pci/hda/hda_codec.c
sound/pci/hda/hda_codec.h
sound/pci/hda/hda_generic.c
sound/pci/hda/hda_hwdep.c
sound/pci/hda/hda_intel.c
sound/pci/hda/hda_local.h
sound/pci/hda/hda_proc.c
sound/pci/hda/patch_analog.c
sound/pci/hda/patch_cmedia.c
sound/pci/hda/patch_conexant.c
sound/pci/hda/patch_realtek.c
sound/pci/hda/patch_sigmatel.c
sound/pci/hda/patch_via.c
sound/pci/ice1712/ice1712.c
sound/pci/ice1712/ice1724.c
sound/pci/ice1712/juli.c
sound/pci/ice1712/prodigy192.c
sound/pci/intel8x0.c
sound/pci/intel8x0m.c
sound/pci/korg1212/korg1212.c
sound/pci/maestro3.c
sound/pci/mixart/mixart.c
sound/pci/mixart/mixart_hwdep.c
sound/pci/nm256/nm256.c
sound/pci/oxygen/hifier.c
sound/pci/oxygen/oxygen.c
sound/pci/oxygen/oxygen.h
sound/pci/oxygen/oxygen_io.c
sound/pci/oxygen/oxygen_lib.c
sound/pci/oxygen/virtuoso.c
sound/pci/pcxhr/pcxhr.c
sound/pci/pcxhr/pcxhr.h
sound/pci/pcxhr/pcxhr_core.h
sound/pci/pcxhr/pcxhr_hwdep.c
sound/pci/pcxhr/pcxhr_mix22.c
sound/pci/pcxhr/pcxhr_mix22.h
sound/pci/pcxhr/pcxhr_mixer.c
sound/pci/riptide/riptide.c
sound/pci/rme32.c
sound/pci/rme96.c
sound/pci/rme9652/hdsp.c
sound/pci/rme9652/hdspm.c
sound/pci/rme9652/rme9652.c
sound/pci/sis7019.c
sound/pci/sonicvibes.c
sound/pci/trident/trident.c
sound/pci/trident/trident_main.c
sound/pci/via82xx.c
sound/pci/via82xx_modem.c
sound/pci/vx222/vx222.c
sound/pci/vx222/vx222_ops.c
sound/pci/ymfpci/ymfpci.c
sound/pci/ymfpci/ymfpci_main.c
sound/pcmcia/pdaudiocf/pdaudiocf.c
sound/pcmcia/pdaudiocf/pdaudiocf_core.c
sound/pcmcia/pdaudiocf/pdaudiocf_irq.c
sound/pcmcia/vx/vxpocket.c
sound/ppc/Kconfig
sound/ppc/awacs.c
sound/ppc/burgundy.c
sound/ppc/daca.c
sound/ppc/pmac.c
sound/ppc/powermac.c
sound/ppc/snd_ps3.c
sound/ppc/tumbler.c
sound/sh/aica.c
sound/soc/Kconfig
sound/soc/Makefile
sound/soc/atmel/atmel-pcm.c
sound/soc/atmel/atmel_ssc_dai.c
sound/soc/atmel/playpaq_wm8510.c
sound/soc/atmel/sam9g20_wm8731.c
sound/soc/au1x/dbdma2.c
sound/soc/au1x/psc-ac97.c
sound/soc/au1x/psc-i2s.c
sound/soc/blackfin/bf5xx-ac97-pcm.c
sound/soc/blackfin/bf5xx-ac97.c
sound/soc/blackfin/bf5xx-ad73311.c
sound/soc/blackfin/bf5xx-i2s-pcm.c
sound/soc/blackfin/bf5xx-i2s.c
sound/soc/blackfin/bf5xx-sport.c
sound/soc/codecs/Kconfig
sound/soc/codecs/Makefile
sound/soc/codecs/ac97.c
sound/soc/codecs/ad1980.c
sound/soc/codecs/ad73311.c
sound/soc/codecs/ad73311.h
sound/soc/codecs/ak4104.c [new file with mode: 0644]
sound/soc/codecs/ak4104.h [new file with mode: 0644]
sound/soc/codecs/ak4535.c
sound/soc/codecs/cs4270.c
sound/soc/codecs/pcm3008.c
sound/soc/codecs/ssm2602.c
sound/soc/codecs/tlv320aic23.c
sound/soc/codecs/tlv320aic26.c
sound/soc/codecs/tlv320aic3x.c
sound/soc/codecs/twl4030.c
sound/soc/codecs/twl4030.h
sound/soc/codecs/uda134x.c
sound/soc/codecs/uda1380.c
sound/soc/codecs/wm8350.c
sound/soc/codecs/wm8350.h
sound/soc/codecs/wm8400.c [new file with mode: 0644]
sound/soc/codecs/wm8400.h [new file with mode: 0644]
sound/soc/codecs/wm8510.c
sound/soc/codecs/wm8580.c
sound/soc/codecs/wm8580.h
sound/soc/codecs/wm8728.c
sound/soc/codecs/wm8731.c
sound/soc/codecs/wm8731.h
sound/soc/codecs/wm8750.c
sound/soc/codecs/wm8753.c
sound/soc/codecs/wm8753.h
sound/soc/codecs/wm8900.c
sound/soc/codecs/wm8903.c
sound/soc/codecs/wm8971.c
sound/soc/codecs/wm8990.c
sound/soc/codecs/wm9705.c [new file with mode: 0644]
sound/soc/codecs/wm9705.h [new file with mode: 0644]
sound/soc/codecs/wm9712.c
sound/soc/codecs/wm9713.c
sound/soc/davinci/Kconfig
sound/soc/davinci/davinci-evm.c
sound/soc/davinci/davinci-i2s.c
sound/soc/davinci/davinci-pcm.c
sound/soc/davinci/davinci-sffsdr.c
sound/soc/fsl/Kconfig
sound/soc/fsl/Makefile
sound/soc/fsl/fsl_dma.c
sound/soc/fsl/fsl_ssi.c
sound/soc/fsl/fsl_ssi.h
sound/soc/fsl/mpc5200_psc_i2s.c
sound/soc/fsl/mpc8610_hpcd.c
sound/soc/omap/Kconfig
sound/soc/omap/Makefile
sound/soc/omap/n810.c
sound/soc/omap/omap-mcbsp.c
sound/soc/omap/omap-pcm.c
sound/soc/omap/omap3pandora.c
sound/soc/omap/osk5912.c
sound/soc/omap/sdp3430.c
sound/soc/pxa/Kconfig
sound/soc/pxa/Makefile
sound/soc/pxa/corgi.c
sound/soc/pxa/e740_wm9705.c [new file with mode: 0644]
sound/soc/pxa/e750_wm9705.c [new file with mode: 0644]
sound/soc/pxa/e800_wm9712.c
sound/soc/pxa/mioa701_wm9713.c [new file with mode: 0644]
sound/soc/pxa/palm27x.c
sound/soc/pxa/poodle.c
sound/soc/pxa/pxa-ssp.c
sound/soc/pxa/pxa2xx-ac97.c
sound/soc/pxa/pxa2xx-i2s.c
sound/soc/pxa/spitz.c
sound/soc/pxa/tosa.c
sound/soc/pxa/zylonite.c
sound/soc/s3c24xx/Kconfig
sound/soc/s3c24xx/Makefile
sound/soc/s3c24xx/jive_wm8750.c [new file with mode: 0644]
sound/soc/s3c24xx/neo1973_wm8753.c
sound/soc/s3c24xx/s3c-i2s-v2.c [new file with mode: 0644]
sound/soc/s3c24xx/s3c-i2s-v2.h [new file with mode: 0644]
sound/soc/s3c24xx/s3c2412-i2s.c
sound/soc/s3c24xx/s3c2412-i2s.h
sound/soc/s3c24xx/s3c2443-ac97.c
sound/soc/s3c24xx/s3c24xx-i2s.c
sound/soc/s3c24xx/s3c24xx-pcm.c
sound/soc/s3c24xx/s3c24xx_uda134x.c
sound/soc/s3c24xx/s3c64xx-i2s.c [new file with mode: 0644]
sound/soc/s3c24xx/s3c64xx-i2s.h [new file with mode: 0644]
sound/soc/sh/hac.c
sound/soc/sh/ssi.c
sound/soc/soc-core.c
sound/soc/soc-dapm.c
sound/soc/soc-jack.c [new file with mode: 0644]
sound/sparc/amd7930.c
sound/sparc/cs4231.c
sound/sparc/dbri.c
sound/spi/at73c213.c
sound/synth/emux/emux_hwdep.c
sound/synth/emux/emux_oss.c
sound/synth/emux/emux_seq.c
sound/synth/emux/emux_synth.c
sound/synth/emux/soundfont.c
sound/usb/Kconfig
sound/usb/caiaq/caiaq-audio.c
sound/usb/caiaq/caiaq-control.c
sound/usb/caiaq/caiaq-device.c
sound/usb/caiaq/caiaq-device.h
sound/usb/usbaudio.c
sound/usb/usbmixer.c
sound/usb/usbmixer_maps.c
sound/usb/usbquirks.h
sound/usb/usx2y/us122l.c
sound/usb/usx2y/usX2Yhwdep.c
sound/usb/usx2y/usb_stream.c
sound/usb/usx2y/usbusx2y.c
sound/usb/usx2y/usx2yhwdeppcm.h

index 1462ed86d40aec28e0d54e947c93ad43f22333ae..a3a83d38f96fa44a1d17d917e297959cce5036fc 100644 (file)
@@ -12,7 +12,8 @@ DOCBOOKS := z8530book.xml mcabook.xml device-drivers.xml \
            kernel-api.xml filesystems.xml lsm.xml usb.xml kgdb.xml \
            gadget.xml libata.xml mtdnand.xml librs.xml rapidio.xml \
            genericirq.xml s390-drivers.xml uio-howto.xml scsi.xml \
-           mac80211.xml debugobjects.xml sh.xml regulator.xml
+           mac80211.xml debugobjects.xml sh.xml regulator.xml \
+           alsa-driver-api.xml writing-an-alsa-driver.xml
 
 ###
 # The build process is as follows (targets):
similarity index 87%
rename from Documentation/sound/alsa/DocBook/alsa-driver-api.tmpl
rename to Documentation/DocBook/alsa-driver-api.tmpl
index 9d644f7e241e43a0df46189ce3d5a678c0addcb0..0230a96f0564ec6cab7a250e10a7ae62ee41558a 100644 (file)
@@ -1,11 +1,11 @@
-<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V4.1//EN">
-
-<book>
-<?dbhtml filename="index.html">
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
+       "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" []>
 
 <!-- ****************************************************** -->
 <!-- Header  -->
 <!-- ****************************************************** -->
+<book id="ALSA-Driver-API">
   <bookinfo>
     <title>The ALSA Driver API</title>
 
@@ -35,6 +35,8 @@
 
   </bookinfo>
 
+<toc></toc>
+
   <chapter><title>Management of Cards and Devices</title>
      <sect1><title>Card Management</title>
 !Esound/core/init.c
 !Esound/pci/ac97/ac97_codec.c
 !Esound/pci/ac97/ac97_pcm.c
      </sect1>
+     <sect1><title>Virtual Master Control API</title>
+!Esound/core/vmaster.c
+!Iinclude/sound/control.h
+     </sect1>
   </chapter>
   <chapter><title>MIDI API</title>
      <sect1><title>Raw MIDI API</title>
@@ -88,6 +94,9 @@
   <chapter><title>Miscellaneous Functions</title>
      <sect1><title>Hardware-Dependent Devices API</title>
 !Esound/core/hwdep.c
+     </sect1>
+     <sect1><title>Jack Abstraction Layer API</title>
+!Esound/core/jack.c
      </sect1>
      <sect1><title>ISA DMA Helpers</title>
 !Esound/core/isadma.c
similarity index 99%
rename from Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl
rename to Documentation/DocBook/writing-an-alsa-driver.tmpl
index 87a7c07ab6581ecd6a96d354ac5920e633548ea8..46b08fef37445b4d0455f570e1fe65871a053dda 100644 (file)
@@ -1,11 +1,11 @@
-<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook V4.1//EN">
-
-<book>
-<?dbhtml filename="index.html">
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN"
+       "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" []>
 
 <!-- ****************************************************** -->
 <!-- Header  -->
 <!-- ****************************************************** -->
+<book id="Writing-an-ALSA-Driver">
   <bookinfo>
     <title>Writing an ALSA Driver</title>
     <author>
           }
 
           /* (2) */
-          card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0);
-          if (card == NULL)
-                  return -ENOMEM;
+          err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
+          if (err < 0)
+                  return err;
 
           /* (3) */
           err = snd_mychip_create(card, pci, &chip);
             <programlisting>
 <![CDATA[
   struct snd_card *card;
+  int err;
   ....
-  card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0);
+  err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
 ]]>
             </programlisting>
           </informalexample>
 
       <para>
         As mentioned above, to create a card instance, call
-      <function>snd_card_new()</function>.
+      <function>snd_card_create()</function>.
 
         <informalexample>
           <programlisting>
 <![CDATA[
   struct snd_card *card;
-  card = snd_card_new(index, id, module, extra_size);
+  int err;
+  err = snd_card_create(index, id, module, extra_size, &card);
 ]]>
           </programlisting>
         </informalexample>
       </para>
 
       <para>
-        The function takes four arguments, the card-index number, the
+        The function takes five arguments, the card-index number, the
         id string, the module pointer (usually
         <constant>THIS_MODULE</constant>),
-        and the size of extra-data space.  The last argument is used to
+        the size of extra-data space, and the pointer to return the
+        card instance.  The extra_size argument is used to
         allocate card-&gt;private_data for the
         chip-specific data.  Note that these data
-        are allocated by <function>snd_card_new()</function>.
+        are allocated by <function>snd_card_create()</function>.
       </para>
     </section>
 
       </para>
 
       <section id="card-management-chip-specific-snd-card-new">
-        <title>1. Allocating via <function>snd_card_new()</function>.</title>
+        <title>1. Allocating via <function>snd_card_create()</function>.</title>
         <para>
           As mentioned above, you can pass the extra-data-length
-         to the 4th argument of <function>snd_card_new()</function>, i.e.
+         to the 4th argument of <function>snd_card_create()</function>, i.e.
 
           <informalexample>
             <programlisting>
 <![CDATA[
-  card = snd_card_new(index[dev], id[dev], THIS_MODULE, sizeof(struct mychip));
+  err = snd_card_create(index[dev], id[dev], THIS_MODULE,
+                        sizeof(struct mychip), &card);
 ]]>
             </programlisting>
           </informalexample>
 
         <para>
           After allocating a card instance via
-          <function>snd_card_new()</function> (with
-          <constant>NULL</constant> on the 4th arg), call
+          <function>snd_card_create()</function> (with
+          <constant>0</constant> on the 4th arg), call
           <function>kzalloc()</function>. 
 
           <informalexample>
 <![CDATA[
   struct snd_card *card;
   struct mychip *chip;
-  card = snd_card_new(index[dev], id[dev], THIS_MODULE, NULL);
+  err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
   .....
   chip = kzalloc(sizeof(*chip), GFP_KERNEL);
 ]]>
@@ -5750,8 +5754,9 @@ struct _snd_pcm_runtime {
           ....
           struct snd_card *card;
           struct mychip *chip;
+          int err;
           ....
-          card = snd_card_new(index[dev], id[dev], THIS_MODULE, NULL);
+          err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
           ....
           chip = kzalloc(sizeof(*chip), GFP_KERNEL);
           ....
@@ -5763,7 +5768,7 @@ struct _snd_pcm_runtime {
       </informalexample>
 
        When you created the chip data with
-       <function>snd_card_new()</function>, it's anyway accessible
+       <function>snd_card_create()</function>, it's anyway accessible
        via <structfield>private_data</structfield> field.
 
       <informalexample>
@@ -5775,9 +5780,10 @@ struct _snd_pcm_runtime {
           ....
           struct snd_card *card;
           struct mychip *chip;
+          int err;
           ....
-          card = snd_card_new(index[dev], id[dev], THIS_MODULE,
-                              sizeof(struct mychip));
+          err = snd_card_create(index[dev], id[dev], THIS_MODULE,
+                                sizeof(struct mychip), &card);
           ....
           chip = card->private_data;
           ....
index 841a9365d5fdd67b5018c7551ff7bb2433056c8a..012858d2b11935aa711e4cf9d2d8fbe637403813 100644 (file)
@@ -346,6 +346,9 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
     sbirq      - IRQ # for CMI8330 chip (SB16)
     sbdma8     - 8bit DMA # for CMI8330 chip (SB16)
     sbdma16    - 16bit DMA # for CMI8330 chip (SB16)
+    fmport     - (optional) OPL3 I/O port
+    mpuport    - (optional) MPU401 I/O port
+    mpuirq     - (optional) MPU401 irq #
 
     This module supports multiple cards and autoprobe.
 
@@ -388,34 +391,11 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
 
     The power-management is supported.
     
-  Module snd-cs4232
-  -----------------
-
-    Module for sound cards based on CS4232/CS4232A ISA chips.
-
-    isapnp     - ISA PnP detection - 0 = disable, 1 = enable (default)
-
-    with isapnp=0, the following options are available:
-
-    port       - port # for CS4232 chip (PnP setup - 0x534)
-    cport      - control port # for CS4232 chip (PnP setup - 0x120,0x210,0xf00)
-    mpu_port   - port # for MPU-401 UART (PnP setup - 0x300), -1 = disable
-    fm_port    - FM port # for CS4232 chip (PnP setup - 0x388), -1 = disable
-    irq                - IRQ # for CS4232 chip (5,7,9,11,12,15)
-    mpu_irq    - IRQ # for MPU-401 UART (9,11,12,15)
-    dma1       - first DMA # for CS4232 chip (0,1,3)
-    dma2       - second DMA # for Yamaha CS4232 chip (0,1,3), -1 = disable
-    
-    This module supports multiple cards. This module does not support autoprobe
-    (if ISA PnP is not used) thus main port must be specified!!! Other ports are
-    optional.
-
-    The power-management is supported.
-    
   Module snd-cs4236
   -----------------
 
-    Module for sound cards based on CS4235/CS4236/CS4236B/CS4237B/
+    Module for sound cards based on CS4232/CS4232A,
+                                  CS4235/CS4236/CS4236B/CS4237B/
                                    CS4238B/CS4239 ISA chips.
 
     isapnp     - ISA PnP detection - 0 = disable, 1 = enable (default)
@@ -437,6 +417,9 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
 
     The power-management is supported.
 
+    This module is aliased as snd-cs4232 since it provides the old
+    snd-cs4232 functionality, too.
+
   Module snd-cs4281
   -----------------
 
@@ -606,6 +589,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
     Module for ESS AudioDrive ES-1688 and ES-688 sound cards.
 
     port       - port # for ES-1688 chip (0x220,0x240,0x260)
+    fm_port    - port # for OPL3 (option; share the same port as default)
     mpu_port   - port # for MPU-401 port (0x300,0x310,0x320,0x330), -1 = disable (default)
     irq                - IRQ # for ES-1688 chip (5,7,9,10)
     mpu_irq    - IRQ # for MPU-401 port (5,7,9,10)
@@ -757,6 +741,9 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
     model      - force the model name
     position_fix - Fix DMA pointer (0 = auto, 1 = use LPIB, 2 = POSBUF)
     probe_mask  - Bitmask to probe codecs (default = -1, meaning all slots)
+                 When the bit 8 (0x100) is set, the lower 8 bits are used
+                 as the "fixed" codec slots; i.e. the driver probes the
+                 slots regardless what hardware reports back
     probe_only - Only probing and no codec initialization (default=off);
                  Useful to check the initial codec status for debugging
     bdl_pos_adj        - Specifies the DMA IRQ timing delay in samples.
@@ -1185,6 +1172,54 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
 
     This module supports multiple devices and PnP.
     
+  Module snd-msnd-classic
+  -----------------------
+
+    Module for Turtle Beach MultiSound Classic, Tahiti or Monterey
+    soundcards.
+
+    io         - Port # for msnd-classic card
+    irq                - IRQ # for msnd-classic card
+    mem                - Memory address (0xb0000, 0xc8000, 0xd0000, 0xd8000,
+                 0xe0000 or 0xe8000)
+    write_ndelay - enable write ndelay (default = 1)
+    calibrate_signal - calibrate signal (default = 0)
+    isapnp     - ISA PnP detection - 0 = disable, 1 = enable (default)
+    digital    - Digital daughterboard present (default = 0)
+    cfg                - Config port (0x250, 0x260 or 0x270) default = PnP
+    reset      - Reset all devices
+    mpu_io     - MPU401 I/O port
+    mpu_irq    - MPU401 irq#
+    ide_io0    - IDE port #0
+    ide_io1    - IDE port #1
+    ide_irq    - IDE irq#
+    joystick_io        - Joystick I/O port
+
+    The driver requires firmware files "turtlebeach/msndinit.bin" and
+    "turtlebeach/msndperm.bin" in the proper firmware directory.
+
+    See Documentation/sound/oss/MultiSound for important information
+    about this driver.  Note that it has been discontinued, but the 
+    Voyetra Turtle Beach knowledge base entry for it is still available
+    at
+       http://www.turtlebeach.com/site/kb_ftp/790.asp
+
+  Module snd-msnd-pinnacle
+  ------------------------
+
+    Module for Turtle Beach MultiSound Pinnacle/Fiji soundcards.
+
+    io         - Port # for pinnacle/fiji card
+    irq                - IRQ # for pinnalce/fiji card
+    mem                - Memory address (0xb0000, 0xc8000, 0xd0000, 0xd8000,
+                 0xe0000 or 0xe8000)
+    write_ndelay - enable write ndelay (default = 1)
+    calibrate_signal - calibrate signal (default = 0)
+    isapnp     - ISA PnP detection - 0 = disable, 1 = enable (default)
+
+    The driver requires firmware files "turtlebeach/pndspini.bin" and
+    "turtlebeach/pndsperm.bin" in the proper firmware directory.
+
   Module snd-mtpav
   ----------------
 
@@ -1824,7 +1859,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
   -------------------
 
     Module for sound cards based on the Asus AV100/AV200 chips,
-    i.e., Xonar D1, DX, D2, D2X and HDAV1.3 (Deluxe).
+    i.e., Xonar D1, DX, D2, D2X, HDAV1.3 (Deluxe), and Essence STX.
 
     This module supports autoprobe and multiple cards.
 
index 0f5d26bea80f882ef471c858d0cc0277f4051671..8eec05bc079ebfcc0af9e030ceee652e0a9bf024 100644 (file)
@@ -56,6 +56,7 @@ ALC262
   sony-assamd  Sony ASSAMD
   toshiba-s06  Toshiba S06
   toshiba-rx1  Toshiba RX1
+  tyan         Tyan Thunder n6650W (S2915-E)
   ultra                Samsung Q1 Ultra Vista model
   lenovo-3000  Lenovo 3000 y410
   nec          NEC Versa S9100
@@ -261,6 +262,8 @@ Conexant 5051
 =============
   laptop       Basic Laptop config (default)
   hp           HP Spartan laptop
+  hp-dv6736    HP dv6736
+  lenovo-x200  Lenovo X200 laptop
 
 STAC9200
 ========
@@ -278,6 +281,7 @@ STAC9200
   gateway-m4   Gateway laptops with EAPD control
   gateway-m4-2 Gateway laptops with EAPD control
   panasonic    Panasonic CF-74
+  auto         BIOS setup (default)
 
 STAC9205/9254
 =============
@@ -285,6 +289,8 @@ STAC9205/9254
   dell-m42     Dell (unknown)
   dell-m43     Dell Precision
   dell-m44     Dell Inspiron
+  eapd         Keep EAPD on (e.g. Gateway T1616)
+  auto         BIOS setup (default)
 
 STAC9220/9221
 =============
@@ -308,6 +314,7 @@ STAC9220/9221
   dell-d82     Dell (unknown)
   dell-m81     Dell (unknown)
   dell-m82     Dell XPS M1210
+  auto         BIOS setup (default)
 
 STAC9202/9250/9251
 ==================
@@ -319,6 +326,7 @@ STAC9202/9250/9251
   m3           Some Gateway MX series laptops
   m5           Some Gateway MX series laptops (MP6954)
   m6           Some Gateway NX series laptops
+  auto         BIOS setup (default)
 
 STAC9227/9228/9229/927x
 =======================
@@ -328,6 +336,7 @@ STAC9227/9228/9229/927x
   5stack       D965 5stack + SPDIF
   dell-3stack  Dell Dimension E520
   dell-bios    Fixes with Dell BIOS setup
+  auto         BIOS setup (default)
 
 STAC92HD71B*
 ============
@@ -335,7 +344,10 @@ STAC92HD71B*
   dell-m4-1    Dell desktops
   dell-m4-2    Dell desktops
   dell-m4-3    Dell desktops
-  hp-m4                HP dv laptops
+  hp-m4                HP mini 1000
+  hp-dv5       HP dv series
+  hp-hdx       HP HDX series
+  auto         BIOS setup (default)
 
 STAC92HD73*
 ===========
@@ -345,13 +357,16 @@ STAC92HD73*
   dell-m6-dmic Dell desktops/laptops with digital mics
   dell-m6      Dell desktops/laptops with both type of mics
   dell-eq      Dell desktops/laptops
+  auto         BIOS setup (default)
 
 STAC92HD83*
 ===========
   ref          Reference board
   mic-ref      Reference board with power managment for ports
+  dell-s14     Dell laptop
+  auto         BIOS setup (default)
 
 STAC9872
 ========
-  vaio         Setup for VAIO FE550G/SZ110
-  vaio-ar Setup for VAIO AR
+  vaio         VAIO laptop without SPDIF
+  auto         BIOS setup (default)
index 8d68fff7183945a6b2dba6386ff4cf7da7ea5753..c5948f2f9a253eab2e2764a7002e912ae478fc8c 100644 (file)
@@ -109,6 +109,13 @@ slot, pass `probe_mask=1`.  For the first and the third slots, pass
 Since 2.6.29 kernel, the driver has a more robust probing method, so
 this error might happen rarely, though.
 
+On a machine with a broken BIOS, sometimes you need to force the
+driver to probe the codec slots the hardware doesn't report for use.
+In such a case, turn the bit 8 (0x100) of `probe_mask` option on.
+Then the rest 8 bits are passed as the codec slots to probe
+unconditionally.  For example, `probe_mask=0x103` will force to probe
+the codec slots 0 and 1 no matter what the hardware reports.
+
 
 Interrupt Handling
 ~~~~~~~~~~~~~~~~~~
@@ -358,10 +365,26 @@ modelname::
   to this file.
 init_verbs::
   The extra verbs to execute at initialization.  You can add a verb by
-  writing to this file.  Pass tree numbers, nid, verb and parameter.
+  writing to this file.  Pass three numbers: nid, verb and parameter
+  (separated with a space).
 hints::
-  Shows hint strings for codec parsers for any use.  Right now it's
-  not used.
+  Shows / stores hint strings for codec parsers for any use.
+  Its format is `key = value`.  For example, passing `hp_detect = yes`
+  to IDT/STAC codec parser will result in the disablement of the
+  headphone detection.
+init_pin_configs::
+  Shows the initial pin default config values set by BIOS.
+driver_pin_configs::
+  Shows the pin default values set by the codec parser explicitly.
+  This doesn't show all pin values but only the changed values by
+  the parser.  That is, if the parser doesn't change the pin default
+  config values by itself, this will contain nothing.
+user_pin_configs::
+  Shows the pin default config values to override the BIOS setup.
+  Writing this (with two numbers, NID and value) appends the new
+  value.  The given will be used instead of the initial BIOS value at
+  the next reconfiguration time.  Note that this config will override
+  even the driver pin configs, too.
 reconfig::
   Triggers the codec re-configuration.  When any value is written to
   this file, the driver re-initialize and parses the codec tree
@@ -371,6 +394,14 @@ clear::
   Resets the codec, removes the mixer elements and PCM stuff of the
   specified codec, and clear all init verbs and hints.
 
+For example, when you want to change the pin default configuration
+value of the pin widget 0x14 to 0x9993013f, and let the driver
+re-configure based on that state, run like below:
+------------------------------------------------------------------------
+  # echo 0x14 0x9993013f > /sys/class/sound/hwC0D0/user_pin_configs
+  # echo 1 > /sys/class/sound/hwC0D0/reconfig  
+------------------------------------------------------------------------
+
 
 Power-Saving
 ~~~~~~~~~~~~
@@ -461,6 +492,16 @@ run with `--no-upload` option, and attach the generated file.
 There are some other useful options.  See `--help` option output for
 details.
 
+When a probe error occurs or when the driver obviously assigns a
+mismatched model, it'd be helpful to load the driver with
+`probe_only=1` option (at best after the cold reboot) and run
+alsa-info at this state.  With this option, the driver won't configure
+the mixer and PCM but just tries to probe the codec slot.  After
+probing, the proc file is available, so you can get the raw codec
+information before modified by the driver.  Of course, the driver
+isn't usable with `probe_only=1`.  But you can continue the
+configuration via hwdep sysfs file if hda-reconfig option is enabled.
+
 
 hda-verb
 ~~~~~~~~
index 46f9684d0b29d8550824073f0ddf925035b5c327..9e6763264a2ee1cb5b549cc27c51f47557d3ba0d 100644 (file)
@@ -116,6 +116,9 @@ SOC_DAPM_SINGLE("HiFi Playback Switch", WM8731_APANA, 4, 1, 0),
 SND_SOC_DAPM_MIXER("Output Mixer", WM8731_PWR, 4, 1, wm8731_output_mixer_controls,
        ARRAY_SIZE(wm8731_output_mixer_controls)),
 
+If you dont want the mixer elements prefixed with the name of the mixer widget,
+you can use SND_SOC_DAPM_MIXER_NAMED_CTL instead. the parameters are the same
+as for SND_SOC_DAPM_MIXER.
 
 2.3 Platform/Machine domain Widgets
 -----------------------------------
diff --git a/Documentation/sound/oss/CS4232 b/Documentation/sound/oss/CS4232
deleted file mode 100644 (file)
index 7d6af7a..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-To configure the Crystal CS423x sound chip and activate its DSP functions,
-modules may be loaded in this order:
-  
-       modprobe sound
-       insmod ad1848
-       insmod uart401
-       insmod cs4232 io=* irq=* dma=* dma2=*
-  
-This is the meaning of the parameters:
-  
-       io--I/O address of the Windows Sound System (normally 0x534)
-       irq--IRQ of this device
-       dma and dma2--DMA channels (DMA2 may be 0)
-  
-On some cards, the board attempts to do non-PnP setup, and fails.  If you
-have problems, use Linux' PnP facilities. 
-  
-To get MIDI facilities add
-  
-       insmod opl3 io=*
-  
-where "io" is the I/O address of the OPL3 synthesizer. This will be shown
-in /proc/sys/pnp and is normally 0x388.
index f04ba6bb7395685719bb883abd74b7ee7c5333a0..75d967ff92663dd7fd72db9be9ef8926d8e6cf7e 100644 (file)
@@ -80,7 +80,7 @@ Notes:
     additional features.
 
 2.  The commercial OSS driver may be obtained from the site:
-    http://www/opensound.com.  This may be used for cards that
+    http://www.opensound.com.  This may be used for cards that
     are unsupported by the kernel driver, or may be used
     by other operating systems.  
 
index 6d48e00f4f0b444913f49cdcd58c01900cddf10d..a6fff782e7a8cfcd78c0a267f5f4817dfb309c3a 100644 (file)
@@ -135,6 +135,11 @@ static unsigned long e740_pin_config[] __initdata = {
        /* IrDA */
        GPIO38_GPIO | MFP_LPM_DRIVE_HIGH,
 
+       /* Audio power control */
+       GPIO16_GPIO,  /* AC97 codec AVDD2 supply (analogue power) */
+       GPIO40_GPIO,  /* Mic amp power */
+       GPIO41_GPIO,  /* Headphone amp power */
+
        /* PC Card */
        GPIO8_GPIO,   /* CD0 */
        GPIO44_GPIO,  /* CD1 */
index be1ab8edb973eab021c7730c66246bdcac856b29..665066fd280ee123236b77e5d3d12e6f21b100ca 100644 (file)
@@ -133,6 +133,11 @@ static unsigned long e750_pin_config[] __initdata = {
        /* IrDA */
        GPIO38_GPIO | MFP_LPM_DRIVE_HIGH,
 
+       /* Audio power control */
+       GPIO4_GPIO,  /* Headphone amp power */
+       GPIO7_GPIO,  /* Speaker amp power */
+       GPIO37_GPIO, /* Headphone detect */
+
        /* PC Card */
        GPIO8_GPIO,   /* CD0 */
        GPIO44_GPIO,  /* CD1 */
index da6e4422c0f3204bfdd8a553ec4c0c59c52ed107..295ec413d804f951046eecf5fda1fc069f10a085 100644 (file)
@@ -153,6 +153,13 @@ static unsigned long h5000_pin_config[] __initdata = {
        GPIO23_SSP1_SCLK,
        GPIO25_SSP1_TXD,
        GPIO26_SSP1_RXD,
+
+       /* I2S */
+       GPIO28_I2S_BITCLK_OUT,
+       GPIO29_I2S_SDATA_IN,
+       GPIO30_I2S_SDATA_OUT,
+       GPIO31_I2S_SYNC,
+       GPIO32_I2S_SYSCLK,
 };
 
 /*
index efbd2aa9ecec394e7cf98270dfd38a0df993ad26..f3e5509820d7360270a202698d61511c31dd9be6 100644 (file)
 /* e7xx IrDA power control */
 #define GPIO_E7XX_IR_OFF         38
 
+/* e740 audio control GPIOs */
+#define GPIO_E740_WM9705_nAVDD2  16
+#define GPIO_E740_MIC_ON         40
+#define GPIO_E740_AMP_ON         41
+
+/* e750 audio control GPIOs */
+#define GPIO_E750_HP_AMP_OFF      4
+#define GPIO_E750_SPK_AMP_OFF     7
+#define GPIO_E750_HP_DETECT      37
+
+/* e800 audio control GPIOs */
+#define GPIO_E800_HP_DETECT      81
+#define GPIO_E800_HP_AMP_OFF     82
+#define GPIO_E800_SPK_AMP_ON     83
+
 /* ASIC related GPIOs */
 #define GPIO_ESERIES_TMIO_IRQ        5
 #define GPIO_ESERIES_TMIO_PCLR      19
index cf31986f6f05d1b0f8637e020c4fd421e97e03fd..018f6d65b57ba93948dc58c3d4745700fd5d0064 100644 (file)
@@ -50,7 +50,7 @@
 #define SSCR0_TUM      (1 << 23)       /* Transmit FIFO underrun interrupt mask */
 #define SSCR0_FRDC     (0x07000000)    /* Frame rate divider control (mask) */
 #define SSCR0_SlotsPerFrm(x) (((x) - 1) << 24) /* Time slots per frame [1..8] */
-#define SSCR0_ADC      (1 << 30)       /* Audio clock select */
+#define SSCR0_ACS      (1 << 30)       /* Audio clock select */
 #define SSCR0_MOD      (1 << 31)       /* Mode (normal or network) */
 #endif
 
 #define SSSR_TINT              (1 << 19)       /* Receiver Time-out Interrupt */
 #define SSSR_PINT              (1 << 18)       /* Peripheral Trailing Byte Interrupt */
 
+#if defined(CONFIG_PXA3xx)
+#define SSPSP_EDMYSTOP(x)      ((x) << 28)     /* Extended Dummy Stop */
+#define SSPSP_EDMYSTRT(x)      ((x) << 26)     /* Extended Dummy Start */
+#endif
+
 #define SSPSP_FSRT             (1 << 25)       /* Frame Sync Relative Timing */
 #define SSPSP_DMYSTOP(x)       ((x) << 23)     /* Dummy Stop */
 #define SSPSP_SFRMWDTH(x)      ((x) << 16)     /* Serial Frame Width */
index 6d447c9ce8abfcadb2743f11330a48ab93d7d125..0d62d311d41ac8dfacdd4b9aba6c517968b4997d 100644 (file)
@@ -105,6 +105,12 @@ static unsigned long spitz_pin_config[] __initdata = {
        GPIO57_nIOIS16,
        GPIO104_PSKTSEL,
 
+       /* I2S */
+       GPIO28_I2S_BITCLK_OUT,
+       GPIO29_I2S_SDATA_IN,
+       GPIO30_I2S_SDATA_OUT,
+       GPIO31_I2S_SYNC,
+
        /* MMC */
        GPIO32_MMC_CLK,
        GPIO112_MMC_CMD,
index 552b4c778fdc7f6ab450cae8df014570f7f36ee1..440c014e24b31bf9b00b536bcd8e7900d836850a 100644 (file)
@@ -28,7 +28,7 @@
 #include <mach/regs-mem.h>
 #include <mach/regs-lcd.h>
 #include <mach/regs-sdi.h>
-#include <asm/plat-s3c24xx/regs-iis.h>
+#include <plat/regs-iis.h>
 #include <plat/regs-spi.h>
 
 static struct s3c24xx_dma_map __initdata s3c2410_dma_mappings[] = {
index 919856c9433f013fb81678a485a32abc8290859c..9e3478506c6f67ef1dd307971b2d7786b32f1104 100644 (file)
@@ -29,8 +29,8 @@
 #include <mach/regs-mem.h>
 #include <mach/regs-lcd.h>
 #include <mach/regs-sdi.h>
-#include <asm/plat-s3c24xx/regs-s3c2412-iis.h>
-#include <asm/plat-s3c24xx/regs-iis.h>
+#include <plat/regs-s3c2412-iis.h>
+#include <plat/regs-iis.h>
 #include <plat/regs-spi.h>
 
 #define MAP(x) { (x)| DMA_CH_VALID, (x)| DMA_CH_VALID, (x)| DMA_CH_VALID, (x)| DMA_CH_VALID }
index 5b5ee0b8f4e0b236ec9a4922f90e3f69b3ce67d0..69b6cf34df4728907e5d9dbba631c8d3fbb90a2d 100644 (file)
@@ -28,7 +28,7 @@
 #include <mach/regs-mem.h>
 #include <mach/regs-lcd.h>
 #include <mach/regs-sdi.h>
-#include <asm/plat-s3c24xx/regs-iis.h>
+#include <plat/regs-iis.h>
 #include <plat/regs-spi.h>
 
 static struct s3c24xx_dma_map __initdata s3c2440_dma_mappings[] = {
index 2a58a4d5aa5ae44e196c59acb8838e851defe4a3..8430e5829186da2d56f39d3069c6b99e0d708ffa 100644 (file)
@@ -29,7 +29,7 @@
 #include <mach/regs-mem.h>
 #include <mach/regs-lcd.h>
 #include <mach/regs-sdi.h>
-#include <asm/plat-s3c24xx/regs-iis.h>
+#include <plat/regs-iis.h>
 #include <plat/regs-spi.h>
 
 #define MAP(x) { \
similarity index 93%
rename from include/asm-arm/plat-s3c24xx/regs-s3c2412-iis.h
rename to arch/arm/plat-s3c/include/plat/regs-s3c2412-iis.h
index 25d4058bcfedf8f30e472a2a62c167eba5db10fd..0fad7571030eb9f911529e85f4d1d17c729ad704 100644 (file)
@@ -33,6 +33,9 @@
 #define S3C2412_IISCON_RXDMA_ACTIVE    (1 << 1)
 #define S3C2412_IISCON_IIS_ACTIVE      (1 << 0)
 
+#define S3C64XX_IISMOD_IMS_PCLK                (0 << 10)
+#define S3C64XX_IISMOD_IMS_SYSMUX      (1 << 10)
+
 #define S3C2412_IISMOD_MASTER_INTERNAL (0 << 10)
 #define S3C2412_IISMOD_MASTER_EXTERNAL (1 << 10)
 #define S3C2412_IISMOD_SLAVE           (2 << 10)
@@ -44,8 +47,8 @@
 #define S3C2412_IISMOD_LR_LLOW         (0 << 7)
 #define S3C2412_IISMOD_LR_RLOW         (1 << 7)
 #define S3C2412_IISMOD_SDF_IIS         (0 << 5)
-#define S3C2412_IISMOD_SDF_MSB         (0 << 5)
-#define S3C2412_IISMOD_SDF_LSB         (0 << 5)
+#define S3C2412_IISMOD_SDF_MSB         (1 << 5)
+#define S3C2412_IISMOD_SDF_LSB         (2 << 5)
 #define S3C2412_IISMOD_SDF_MASK                (3 << 5)
 #define S3C2412_IISMOD_RCLK_256FS      (0 << 3)
 #define S3C2412_IISMOD_RCLK_512FS      (1 << 3)
index 66c755c116dcbc8190f7305257b8201e6bc88496..ce98d955231ae4f505b8e018836698d33a3ebde8 100644 (file)
@@ -803,9 +803,10 @@ static int __devinit cx88_audio_initdev(struct pci_dev *pci,
                return (-ENOENT);
        }
 
-       card = snd_card_new(index[devno], id[devno], THIS_MODULE, sizeof(snd_cx88_card_t));
-       if (!card)
-               return (-ENOMEM);
+       err = snd_card_create(index[devno], id[devno], THIS_MODULE,
+                             sizeof(snd_cx88_card_t), &card);
+       if (err < 0)
+               return err;
 
        card->private_free = snd_cx88_dev_free;
 
index 2ac738fa6a07e0cd66fac559fd3c9688060dff39..f132e31f6edd8c4bcd7e7262739255437195ec5e 100644 (file)
@@ -448,9 +448,10 @@ static int em28xx_audio_init(struct em28xx *dev)
        printk(KERN_INFO "em28xx-audio.c: Copyright (C) 2006 Markus "
                         "Rechberger\n");
 
-       card = snd_card_new(index[devnr], "Em28xx Audio", THIS_MODULE, 0);
-       if (card == NULL)
-               return -ENOMEM;
+       err = snd_card_create(index[devnr], "Em28xx Audio", THIS_MODULE, 0,
+                             &card);
+       if (err < 0)
+               return err;
 
        spin_lock_init(&adev->slock);
        err = snd_pcm_new(card, "Em28xx Audio", 0, 0, 1, &pcm);
index c750d3dd57d20c2f8a858c342ada09b21fd1b1c1..8b0b64a89874dcbaa1e591c72af22074477a8c88 100644 (file)
@@ -990,10 +990,10 @@ static int alsa_card_saa7134_create(struct saa7134_dev *dev, int devnum)
        if (!enable[devnum])
                return -ENODEV;
 
-       card = snd_card_new(index[devnum], id[devnum], THIS_MODULE, sizeof(snd_card_saa7134_t));
-
-       if (card == NULL)
-               return -ENOMEM;
+       err = snd_card_create(index[devnum], id[devnum], THIS_MODULE,
+                             sizeof(snd_card_saa7134_t), &card);
+       if (err < 0)
+               return err;
 
        strcpy(card->driver, "SAA7134");
 
index a7de401f61ab22d1636939ba87ba939ad1f15654..cd19be6c00e09fa1f0256c3657f81989f1f1e4fe 100644 (file)
@@ -248,10 +248,11 @@ int go7007_snd_init(struct go7007 *go)
        spin_lock_init(&gosnd->lock);
        gosnd->hw_ptr = gosnd->w_idx = gosnd->avail = 0;
        gosnd->capturing = 0;
-       gosnd->card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0);
-       if (gosnd->card == NULL) {
+       ret = snd_card_create(index[dev], id[dev], THIS_MODULE, 0,
+                             &gosnd->card);
+       if (ret < 0) {
                kfree(gosnd);
-               return -ENOMEM;
+               return ret;
        }
        ret = snd_device_new(gosnd->card, SNDRV_DEV_LOWLEVEL, go,
                        &go7007_snd_device_ops);
index 60d3f9e9b51fdef421f239b3055b09325a30f74a..14e09abbddfcb0463e701a08cc3ec48702686875 100644 (file)
@@ -1099,10 +1099,9 @@ static int gmidi_register_card(struct gmidi_device *dev)
                .dev_free = gmidi_snd_free,
        };
 
-       card = snd_card_new(index, id, THIS_MODULE, 0);
-       if (!card) {
-               ERROR(dev, "snd_card_new failed\n");
-               err = -ENOMEM;
+       err = snd_card_create(index, id, THIS_MODULE, 0, &card);
+       if (err < 0) {
+               ERROR(dev, "snd_card_create failed\n");
                goto fail;
        }
        dev->card = card;
index 1249a0c20a38258f7cf3064ece21f6e54dcbf254..6b28048fc56820152a1f95074b2721e285bab762 100644 (file)
@@ -661,6 +661,7 @@ struct input_absinfo {
 #define SW_DOCK                        0x05  /* set = plugged into dock */
 #define SW_LINEOUT_INSERT      0x06  /* set = inserted */
 #define SW_JACK_PHYSICAL_INSERT 0x07  /* set = mechanical switch set */
+#define SW_VIDEOOUT_INSERT     0x08  /* set = inserted */
 #define SW_MAX                 0x0f
 #define SW_CNT                 (SW_MAX+1)
 
index af95a1d2f3a11e333fbe6a00fcb2354f16657a2a..d899dc0223ba642b41757bd6d85ffa5c20aae292 100644 (file)
 /*
  * R231 (0xE7) - Jack Status
  */
+#define WM8350_JACK_L_LVL                      0x0800
 #define WM8350_JACK_R_LVL                       0x0400
 
 /*
index b6640e018046a4cdf629dcbaa25cb9715b9a9ba2..e06ed3eb1d0a7e90c252c5d6adf9d204c8f78c0b 100644 (file)
 #define WM8400_FLL_OUTDIV_SHIFT                      0  /* FLL_OUTDIV - [2:0] */
 #define WM8400_FLL_OUTDIV_WIDTH                      3  /* FLL_OUTDIV - [2:0] */
 
+struct wm8400;
 void wm8400_reset_codec_reg_cache(struct wm8400 *wm8400);
 
 #endif
index aca8c458aa8a7a23e87198ce8a9cb9eba8f3d87b..02c18b903986b3e3168fba80098425deaf046c78 100644 (file)
 #define PCI_DEVICE_ID_MELLANOX_SINAI_OLD 0x5e8c
 #define PCI_DEVICE_ID_MELLANOX_SINAI   0x6274
 
+#define PCI_VENDOR_ID_DFI              0x15bd
+
 #define PCI_VENDOR_ID_QUICKNET         0x15e2
 #define PCI_DEVICE_ID_QUICKNET_XJ      0x0500
 
index b3aa62ee3c8d4ebf2cc1d29ccbc0f5ba7ddbc5a3..d010858c33c2f975d3ed606c0102e1e8888287d4 100644 (file)
@@ -169,5 +169,7 @@ extern int snd_ad1816a_create(struct snd_card *card, unsigned long port,
 
 extern int snd_ad1816a_pcm(struct snd_ad1816a *chip, int device, struct snd_pcm **rpcm);
 extern int snd_ad1816a_mixer(struct snd_ad1816a *chip);
+extern int snd_ad1816a_timer(struct snd_ad1816a *chip, int device,
+                            struct snd_timer **rtimer);
 
 #endif /* __SOUND_AD1816A_H */
index 1c02ed1d7c4aab6f49dcb8616437d4d24da25db9..fad3e0c7b932942827801d0f457fc3d8dfa0a736 100644 (file)
@@ -126,12 +126,10 @@ struct snd_hwdep_dsp_image {
        unsigned long driver_data;      /* W: driver-specific data */
 };
 
-enum {
-       SNDRV_HWDEP_IOCTL_PVERSION = _IOR ('H', 0x00, int),
-       SNDRV_HWDEP_IOCTL_INFO = _IOR ('H', 0x01, struct snd_hwdep_info),
-       SNDRV_HWDEP_IOCTL_DSP_STATUS = _IOR('H', 0x02, struct snd_hwdep_dsp_status),
-       SNDRV_HWDEP_IOCTL_DSP_LOAD   = _IOW('H', 0x03, struct snd_hwdep_dsp_image)
-};
+#define SNDRV_HWDEP_IOCTL_PVERSION     _IOR ('H', 0x00, int)
+#define SNDRV_HWDEP_IOCTL_INFO         _IOR ('H', 0x01, struct snd_hwdep_info)
+#define SNDRV_HWDEP_IOCTL_DSP_STATUS   _IOR('H', 0x02, struct snd_hwdep_dsp_status)
+#define SNDRV_HWDEP_IOCTL_DSP_LOAD     _IOW('H', 0x03, struct snd_hwdep_dsp_image)
 
 /*****************************************************************************
  *                                                                           *
@@ -451,40 +449,35 @@ enum {
        SNDRV_PCM_TSTAMP_TYPE_LAST = SNDRV_PCM_TSTAMP_TYPE_MONOTONIC,
 };
 
-enum {
-       SNDRV_PCM_IOCTL_PVERSION = _IOR('A', 0x00, int),
-       SNDRV_PCM_IOCTL_INFO = _IOR('A', 0x01, struct snd_pcm_info),
-       SNDRV_PCM_IOCTL_TSTAMP = _IOW('A', 0x02, int),
-       SNDRV_PCM_IOCTL_TTSTAMP = _IOW('A', 0x03, int),
-       SNDRV_PCM_IOCTL_HW_REFINE = _IOWR('A', 0x10, struct snd_pcm_hw_params),
-       SNDRV_PCM_IOCTL_HW_PARAMS = _IOWR('A', 0x11, struct snd_pcm_hw_params),
-       SNDRV_PCM_IOCTL_HW_FREE = _IO('A', 0x12),
-       SNDRV_PCM_IOCTL_SW_PARAMS = _IOWR('A', 0x13, struct snd_pcm_sw_params),
-       SNDRV_PCM_IOCTL_STATUS = _IOR('A', 0x20, struct snd_pcm_status),
-       SNDRV_PCM_IOCTL_DELAY = _IOR('A', 0x21, snd_pcm_sframes_t),
-       SNDRV_PCM_IOCTL_HWSYNC = _IO('A', 0x22),
-       SNDRV_PCM_IOCTL_SYNC_PTR = _IOWR('A', 0x23, struct snd_pcm_sync_ptr),
-       SNDRV_PCM_IOCTL_CHANNEL_INFO = _IOR('A', 0x32, struct snd_pcm_channel_info),
-       SNDRV_PCM_IOCTL_PREPARE = _IO('A', 0x40),
-       SNDRV_PCM_IOCTL_RESET = _IO('A', 0x41),
-       SNDRV_PCM_IOCTL_START = _IO('A', 0x42),
-       SNDRV_PCM_IOCTL_DROP = _IO('A', 0x43),
-       SNDRV_PCM_IOCTL_DRAIN = _IO('A', 0x44),
-       SNDRV_PCM_IOCTL_PAUSE = _IOW('A', 0x45, int),
-       SNDRV_PCM_IOCTL_REWIND = _IOW('A', 0x46, snd_pcm_uframes_t),
-       SNDRV_PCM_IOCTL_RESUME = _IO('A', 0x47),
-       SNDRV_PCM_IOCTL_XRUN = _IO('A', 0x48),
-       SNDRV_PCM_IOCTL_FORWARD = _IOW('A', 0x49, snd_pcm_uframes_t),
-       SNDRV_PCM_IOCTL_WRITEI_FRAMES = _IOW('A', 0x50, struct snd_xferi),
-       SNDRV_PCM_IOCTL_READI_FRAMES = _IOR('A', 0x51, struct snd_xferi),
-       SNDRV_PCM_IOCTL_WRITEN_FRAMES = _IOW('A', 0x52, struct snd_xfern),
-       SNDRV_PCM_IOCTL_READN_FRAMES = _IOR('A', 0x53, struct snd_xfern),
-       SNDRV_PCM_IOCTL_LINK = _IOW('A', 0x60, int),
-       SNDRV_PCM_IOCTL_UNLINK = _IO('A', 0x61),
-};
-
-/* Trick to make alsa-lib/acinclude.m4 happy */
-#define SNDRV_PCM_IOCTL_REWIND SNDRV_PCM_IOCTL_REWIND
+#define SNDRV_PCM_IOCTL_PVERSION       _IOR('A', 0x00, int)
+#define SNDRV_PCM_IOCTL_INFO           _IOR('A', 0x01, struct snd_pcm_info)
+#define SNDRV_PCM_IOCTL_TSTAMP         _IOW('A', 0x02, int)
+#define SNDRV_PCM_IOCTL_TTSTAMP                _IOW('A', 0x03, int)
+#define SNDRV_PCM_IOCTL_HW_REFINE      _IOWR('A', 0x10, struct snd_pcm_hw_params)
+#define SNDRV_PCM_IOCTL_HW_PARAMS      _IOWR('A', 0x11, struct snd_pcm_hw_params)
+#define SNDRV_PCM_IOCTL_HW_FREE                _IO('A', 0x12)
+#define SNDRV_PCM_IOCTL_SW_PARAMS      _IOWR('A', 0x13, struct snd_pcm_sw_params)
+#define SNDRV_PCM_IOCTL_STATUS         _IOR('A', 0x20, struct snd_pcm_status)
+#define SNDRV_PCM_IOCTL_DELAY          _IOR('A', 0x21, snd_pcm_sframes_t)
+#define SNDRV_PCM_IOCTL_HWSYNC         _IO('A', 0x22)
+#define SNDRV_PCM_IOCTL_SYNC_PTR       _IOWR('A', 0x23, struct snd_pcm_sync_ptr)
+#define SNDRV_PCM_IOCTL_CHANNEL_INFO   _IOR('A', 0x32, struct snd_pcm_channel_info)
+#define SNDRV_PCM_IOCTL_PREPARE                _IO('A', 0x40)
+#define SNDRV_PCM_IOCTL_RESET          _IO('A', 0x41)
+#define SNDRV_PCM_IOCTL_START          _IO('A', 0x42)
+#define SNDRV_PCM_IOCTL_DROP           _IO('A', 0x43)
+#define SNDRV_PCM_IOCTL_DRAIN          _IO('A', 0x44)
+#define SNDRV_PCM_IOCTL_PAUSE          _IOW('A', 0x45, int)
+#define SNDRV_PCM_IOCTL_REWIND         _IOW('A', 0x46, snd_pcm_uframes_t)
+#define SNDRV_PCM_IOCTL_RESUME         _IO('A', 0x47)
+#define SNDRV_PCM_IOCTL_XRUN           _IO('A', 0x48)
+#define SNDRV_PCM_IOCTL_FORWARD                _IOW('A', 0x49, snd_pcm_uframes_t)
+#define SNDRV_PCM_IOCTL_WRITEI_FRAMES  _IOW('A', 0x50, struct snd_xferi)
+#define SNDRV_PCM_IOCTL_READI_FRAMES   _IOR('A', 0x51, struct snd_xferi)
+#define SNDRV_PCM_IOCTL_WRITEN_FRAMES  _IOW('A', 0x52, struct snd_xfern)
+#define SNDRV_PCM_IOCTL_READN_FRAMES   _IOR('A', 0x53, struct snd_xfern)
+#define SNDRV_PCM_IOCTL_LINK           _IOW('A', 0x60, int)
+#define SNDRV_PCM_IOCTL_UNLINK         _IO('A', 0x61)
 
 /*****************************************************************************
  *                                                                           *
@@ -538,14 +531,12 @@ struct snd_rawmidi_status {
        unsigned char reserved[16];     /* reserved for future use */
 };
 
-enum {
-       SNDRV_RAWMIDI_IOCTL_PVERSION = _IOR('W', 0x00, int),
-       SNDRV_RAWMIDI_IOCTL_INFO = _IOR('W', 0x01, struct snd_rawmidi_info),
-       SNDRV_RAWMIDI_IOCTL_PARAMS = _IOWR('W', 0x10, struct snd_rawmidi_params),
-       SNDRV_RAWMIDI_IOCTL_STATUS = _IOWR('W', 0x20, struct snd_rawmidi_status),
-       SNDRV_RAWMIDI_IOCTL_DROP = _IOW('W', 0x30, int),
-       SNDRV_RAWMIDI_IOCTL_DRAIN = _IOW('W', 0x31, int),
-};
+#define SNDRV_RAWMIDI_IOCTL_PVERSION   _IOR('W', 0x00, int)
+#define SNDRV_RAWMIDI_IOCTL_INFO       _IOR('W', 0x01, struct snd_rawmidi_info)
+#define SNDRV_RAWMIDI_IOCTL_PARAMS     _IOWR('W', 0x10, struct snd_rawmidi_params)
+#define SNDRV_RAWMIDI_IOCTL_STATUS     _IOWR('W', 0x20, struct snd_rawmidi_status)
+#define SNDRV_RAWMIDI_IOCTL_DROP       _IOW('W', 0x30, int)
+#define SNDRV_RAWMIDI_IOCTL_DRAIN      _IOW('W', 0x31, int)
 
 /*
  *  Timer section - /dev/snd/timer
@@ -654,23 +645,21 @@ struct snd_timer_status {
        unsigned char reserved[64];     /* reserved */
 };
 
-enum {
-       SNDRV_TIMER_IOCTL_PVERSION = _IOR('T', 0x00, int),
-       SNDRV_TIMER_IOCTL_NEXT_DEVICE = _IOWR('T', 0x01, struct snd_timer_id),
-       SNDRV_TIMER_IOCTL_TREAD = _IOW('T', 0x02, int),
-       SNDRV_TIMER_IOCTL_GINFO = _IOWR('T', 0x03, struct snd_timer_ginfo),
-       SNDRV_TIMER_IOCTL_GPARAMS = _IOW('T', 0x04, struct snd_timer_gparams),
-       SNDRV_TIMER_IOCTL_GSTATUS = _IOWR('T', 0x05, struct snd_timer_gstatus),
-       SNDRV_TIMER_IOCTL_SELECT = _IOW('T', 0x10, struct snd_timer_select),
-       SNDRV_TIMER_IOCTL_INFO = _IOR('T', 0x11, struct snd_timer_info),
-       SNDRV_TIMER_IOCTL_PARAMS = _IOW('T', 0x12, struct snd_timer_params),
-       SNDRV_TIMER_IOCTL_STATUS = _IOR('T', 0x14, struct snd_timer_status),
-       /* The following four ioctls are changed since 1.0.9 due to confliction */
-       SNDRV_TIMER_IOCTL_START = _IO('T', 0xa0),
-       SNDRV_TIMER_IOCTL_STOP = _IO('T', 0xa1),
-       SNDRV_TIMER_IOCTL_CONTINUE = _IO('T', 0xa2),
-       SNDRV_TIMER_IOCTL_PAUSE = _IO('T', 0xa3),
-};
+#define SNDRV_TIMER_IOCTL_PVERSION     _IOR('T', 0x00, int)
+#define SNDRV_TIMER_IOCTL_NEXT_DEVICE  _IOWR('T', 0x01, struct snd_timer_id)
+#define SNDRV_TIMER_IOCTL_TREAD                _IOW('T', 0x02, int)
+#define SNDRV_TIMER_IOCTL_GINFO                _IOWR('T', 0x03, struct snd_timer_ginfo)
+#define SNDRV_TIMER_IOCTL_GPARAMS      _IOW('T', 0x04, struct snd_timer_gparams)
+#define SNDRV_TIMER_IOCTL_GSTATUS      _IOWR('T', 0x05, struct snd_timer_gstatus)
+#define SNDRV_TIMER_IOCTL_SELECT       _IOW('T', 0x10, struct snd_timer_select)
+#define SNDRV_TIMER_IOCTL_INFO         _IOR('T', 0x11, struct snd_timer_info)
+#define SNDRV_TIMER_IOCTL_PARAMS       _IOW('T', 0x12, struct snd_timer_params)
+#define SNDRV_TIMER_IOCTL_STATUS       _IOR('T', 0x14, struct snd_timer_status)
+/* The following four ioctls are changed since 1.0.9 due to confliction */
+#define SNDRV_TIMER_IOCTL_START                _IO('T', 0xa0)
+#define SNDRV_TIMER_IOCTL_STOP         _IO('T', 0xa1)
+#define SNDRV_TIMER_IOCTL_CONTINUE     _IO('T', 0xa2)
+#define SNDRV_TIMER_IOCTL_PAUSE                _IO('T', 0xa3)
 
 struct snd_timer_read {
        unsigned int resolution;
@@ -847,33 +836,31 @@ struct snd_ctl_tlv {
         unsigned int tlv[0];   /* first TLV */
 };
 
-enum {
-       SNDRV_CTL_IOCTL_PVERSION = _IOR('U', 0x00, int),
-       SNDRV_CTL_IOCTL_CARD_INFO = _IOR('U', 0x01, struct snd_ctl_card_info),
-       SNDRV_CTL_IOCTL_ELEM_LIST = _IOWR('U', 0x10, struct snd_ctl_elem_list),
-       SNDRV_CTL_IOCTL_ELEM_INFO = _IOWR('U', 0x11, struct snd_ctl_elem_info),
-       SNDRV_CTL_IOCTL_ELEM_READ = _IOWR('U', 0x12, struct snd_ctl_elem_value),
-       SNDRV_CTL_IOCTL_ELEM_WRITE = _IOWR('U', 0x13, struct snd_ctl_elem_value),
-       SNDRV_CTL_IOCTL_ELEM_LOCK = _IOW('U', 0x14, struct snd_ctl_elem_id),
-       SNDRV_CTL_IOCTL_ELEM_UNLOCK = _IOW('U', 0x15, struct snd_ctl_elem_id),
-       SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS = _IOWR('U', 0x16, int),
-       SNDRV_CTL_IOCTL_ELEM_ADD = _IOWR('U', 0x17, struct snd_ctl_elem_info),
-       SNDRV_CTL_IOCTL_ELEM_REPLACE = _IOWR('U', 0x18, struct snd_ctl_elem_info),
-       SNDRV_CTL_IOCTL_ELEM_REMOVE = _IOWR('U', 0x19, struct snd_ctl_elem_id),
-       SNDRV_CTL_IOCTL_TLV_READ = _IOWR('U', 0x1a, struct snd_ctl_tlv),
-       SNDRV_CTL_IOCTL_TLV_WRITE = _IOWR('U', 0x1b, struct snd_ctl_tlv),
-       SNDRV_CTL_IOCTL_TLV_COMMAND = _IOWR('U', 0x1c, struct snd_ctl_tlv),
-       SNDRV_CTL_IOCTL_HWDEP_NEXT_DEVICE = _IOWR('U', 0x20, int),
-       SNDRV_CTL_IOCTL_HWDEP_INFO = _IOR('U', 0x21, struct snd_hwdep_info),
-       SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE = _IOR('U', 0x30, int),
-       SNDRV_CTL_IOCTL_PCM_INFO = _IOWR('U', 0x31, struct snd_pcm_info),
-       SNDRV_CTL_IOCTL_PCM_PREFER_SUBDEVICE = _IOW('U', 0x32, int),
-       SNDRV_CTL_IOCTL_RAWMIDI_NEXT_DEVICE = _IOWR('U', 0x40, int),
-       SNDRV_CTL_IOCTL_RAWMIDI_INFO = _IOWR('U', 0x41, struct snd_rawmidi_info),
-       SNDRV_CTL_IOCTL_RAWMIDI_PREFER_SUBDEVICE = _IOW('U', 0x42, int),
-       SNDRV_CTL_IOCTL_POWER = _IOWR('U', 0xd0, int),
-       SNDRV_CTL_IOCTL_POWER_STATE = _IOR('U', 0xd1, int),
-};
+#define SNDRV_CTL_IOCTL_PVERSION       _IOR('U', 0x00, int)
+#define SNDRV_CTL_IOCTL_CARD_INFO      _IOR('U', 0x01, struct snd_ctl_card_info)
+#define SNDRV_CTL_IOCTL_ELEM_LIST      _IOWR('U', 0x10, struct snd_ctl_elem_list)
+#define SNDRV_CTL_IOCTL_ELEM_INFO      _IOWR('U', 0x11, struct snd_ctl_elem_info)
+#define SNDRV_CTL_IOCTL_ELEM_READ      _IOWR('U', 0x12, struct snd_ctl_elem_value)
+#define SNDRV_CTL_IOCTL_ELEM_WRITE     _IOWR('U', 0x13, struct snd_ctl_elem_value)
+#define SNDRV_CTL_IOCTL_ELEM_LOCK      _IOW('U', 0x14, struct snd_ctl_elem_id)
+#define SNDRV_CTL_IOCTL_ELEM_UNLOCK    _IOW('U', 0x15, struct snd_ctl_elem_id)
+#define SNDRV_CTL_IOCTL_SUBSCRIBE_EVENTS _IOWR('U', 0x16, int)
+#define SNDRV_CTL_IOCTL_ELEM_ADD       _IOWR('U', 0x17, struct snd_ctl_elem_info)
+#define SNDRV_CTL_IOCTL_ELEM_REPLACE   _IOWR('U', 0x18, struct snd_ctl_elem_info)
+#define SNDRV_CTL_IOCTL_ELEM_REMOVE    _IOWR('U', 0x19, struct snd_ctl_elem_id)
+#define SNDRV_CTL_IOCTL_TLV_READ       _IOWR('U', 0x1a, struct snd_ctl_tlv)
+#define SNDRV_CTL_IOCTL_TLV_WRITE      _IOWR('U', 0x1b, struct snd_ctl_tlv)
+#define SNDRV_CTL_IOCTL_TLV_COMMAND    _IOWR('U', 0x1c, struct snd_ctl_tlv)
+#define SNDRV_CTL_IOCTL_HWDEP_NEXT_DEVICE _IOWR('U', 0x20, int)
+#define SNDRV_CTL_IOCTL_HWDEP_INFO     _IOR('U', 0x21, struct snd_hwdep_info)
+#define SNDRV_CTL_IOCTL_PCM_NEXT_DEVICE        _IOR('U', 0x30, int)
+#define SNDRV_CTL_IOCTL_PCM_INFO       _IOWR('U', 0x31, struct snd_pcm_info)
+#define SNDRV_CTL_IOCTL_PCM_PREFER_SUBDEVICE _IOW('U', 0x32, int)
+#define SNDRV_CTL_IOCTL_RAWMIDI_NEXT_DEVICE _IOWR('U', 0x40, int)
+#define SNDRV_CTL_IOCTL_RAWMIDI_INFO   _IOWR('U', 0x41, struct snd_rawmidi_info)
+#define SNDRV_CTL_IOCTL_RAWMIDI_PREFER_SUBDEVICE _IOW('U', 0x42, int)
+#define SNDRV_CTL_IOCTL_POWER          _IOWR('U', 0xd0, int)
+#define SNDRV_CTL_IOCTL_POWER_STATE    _IOR('U', 0xd1, int)
 
 /*
  *  Read interface.
@@ -919,18 +906,4 @@ struct snd_ctl_event {
 #define SNDRV_CTL_NAME_IEC958_PCM_STREAM               "PCM Stream"
 #define SNDRV_CTL_NAME_IEC958(expl,direction,what)     "IEC958 " expl SNDRV_CTL_NAME_##direction SNDRV_CTL_NAME_IEC958_##what
 
-/*
- *
- */
-
-struct snd_xferv {
-       const struct iovec *vector;
-       unsigned long count;
-};
-
-enum {
-       SNDRV_IOCTL_READV = _IOW('K', 0x00, struct snd_xferv),
-       SNDRV_IOCTL_WRITEV = _IOW('K', 0x01, struct snd_xferv),
-};
-
 #endif /* __SOUND_ASOUND_H */
diff --git a/include/sound/atmel-abdac.h b/include/sound/atmel-abdac.h
new file mode 100644 (file)
index 0000000..edff6a8
--- /dev/null
@@ -0,0 +1,23 @@
+/*
+ * Driver for the Atmel Audio Bitstream DAC (ABDAC)
+ *
+ * Copyright (C) 2009 Atmel Corporation
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ */
+#ifndef __INCLUDE_SOUND_ATMEL_ABDAC_H
+#define __INCLUDE_SOUND_ATMEL_ABDAC_H
+
+#include <linux/dw_dmac.h>
+
+/**
+ * struct atmel_abdac_pdata - board specific ABDAC configuration
+ * @dws: DMA slave interface to use for sound playback.
+ */
+struct atmel_abdac_pdata {
+       struct dw_dma_slave     dws;
+};
+
+#endif /* __INCLUDE_SOUND_ATMEL_ABDAC_H */
diff --git a/include/sound/atmel-ac97c.h b/include/sound/atmel-ac97c.h
new file mode 100644 (file)
index 0000000..e6aabdb
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * Driver for the Atmel AC97C controller
+ *
+ * Copyright (C) 2005-2009 Atmel Corporation
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ */
+#ifndef __INCLUDE_SOUND_ATMEL_AC97C_H
+#define __INCLUDE_SOUND_ATMEL_AC97C_H
+
+#include <linux/dw_dmac.h>
+
+#define AC97C_CAPTURE  0x01
+#define AC97C_PLAYBACK 0x02
+#define AC97C_BOTH     (AC97C_CAPTURE | AC97C_PLAYBACK)
+
+/**
+ * struct atmel_ac97c_pdata - board specific AC97C configuration
+ * @rx_dws: DMA slave interface to use for sound capture.
+ * @tx_dws: DMA slave interface to use for sound playback.
+ * @reset_pin: GPIO pin wired to the reset input on the external AC97 codec,
+ *             optional to use, set to -ENODEV if not in use. AC97 layer will
+ *             try to do a software reset of the external codec anyway.
+ * @flags: Flags for which directions should be enabled.
+ *
+ * If the user do not want to use a DMA channel for playback or capture, i.e.
+ * only one feature is required on the board. The slave for playback or capture
+ * can be set to NULL. The AC97C driver will take use of this when setting up
+ * the sound streams.
+ */
+struct ac97c_platform_data {
+       struct dw_dma_slave     rx_dws;
+       struct dw_dma_slave     tx_dws;
+       unsigned int            flags;
+       int                     reset_pin;
+};
+
+#endif /* __INCLUDE_SOUND_ATMEL_AC97C_H */
index 4721b4bba0538360cd808db6c6cc0f13db9a3c7a..ef96f07aa03b112352235f735b7277b0d8d58f9a 100644 (file)
@@ -171,6 +171,54 @@ int snd_ctl_boolean_stereo_info(struct snd_kcontrol *kcontrol,
  */
 struct snd_kcontrol *snd_ctl_make_virtual_master(char *name,
                                                 const unsigned int *tlv);
-int snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave);
-                     
+int _snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave,
+                      unsigned int flags);
+/* optional flags for slave */
+#define SND_CTL_SLAVE_NEED_UPDATE      (1 << 0)
+
+/**
+ * snd_ctl_add_slave - Add a virtual slave control
+ * @master: vmaster element
+ * @slave: slave element to add
+ *
+ * Add a virtual slave control to the given master element created via
+ * snd_ctl_create_virtual_master() beforehand.
+ * Returns zero if successful or a negative error code.
+ *
+ * All slaves must be the same type (returning the same information
+ * via info callback).  The fucntion doesn't check it, so it's your
+ * responsibility.
+ *
+ * Also, some additional limitations:
+ * at most two channels,
+ * logarithmic volume control (dB level) thus no linear volume,
+ * master can only attenuate the volume without gain
+ */
+static inline int
+snd_ctl_add_slave(struct snd_kcontrol *master, struct snd_kcontrol *slave)
+{
+       return _snd_ctl_add_slave(master, slave, 0);
+}
+
+/**
+ * snd_ctl_add_slave_uncached - Add a virtual slave control
+ * @master: vmaster element
+ * @slave: slave element to add
+ *
+ * Add a virtual slave control to the given master.
+ * Unlike snd_ctl_add_slave(), the element added via this function
+ * is supposed to have volatile values, and get callback is called
+ * at each time quried from the master.
+ *
+ * When the control peeks the hardware values directly and the value
+ * can be changed by other means than the put callback of the element,
+ * this function should be used to keep the value always up-to-date.
+ */
+static inline int
+snd_ctl_add_slave_uncached(struct snd_kcontrol *master,
+                          struct snd_kcontrol *slave)
+{
+       return _snd_ctl_add_slave(master, slave, SND_CTL_SLAVE_NEED_UPDATE);
+}
+
 #endif /* __SOUND_CONTROL_H */
index f632484bc7439171d1b682788305981b66e074f4..3dea79829acc0c53673533d421aa9ca15f3b9c06 100644 (file)
@@ -97,9 +97,9 @@ struct snd_device {
 
 struct snd_monitor_file {
        struct file *file;
-       struct snd_monitor_file *next;
        const struct file_operations *disconnected_f_op;
-       struct list_head shutdown_list;
+       struct list_head shutdown_list; /* still need to shutdown */
+       struct list_head list;  /* link of monitor files */
 };
 
 /* main structure for soundcard */
@@ -134,7 +134,7 @@ struct snd_card {
        struct snd_info_entry *proc_id; /* the card id */
        struct proc_dir_entry *proc_root_link;  /* number link to real id */
 
-       struct snd_monitor_file *files; /* all files associated to this card */
+       struct list_head files_list;    /* all files associated to this card */
        struct snd_shutdown_f_ops *s_f_ops; /* file operations in the shutdown
                                                                state */
        spinlock_t files_lock;          /* lock the files for this card */
@@ -296,8 +296,20 @@ int snd_card_locked(int card);
 extern int (*snd_mixer_oss_notify_callback)(struct snd_card *card, int cmd);
 #endif
 
+int snd_card_create(int idx, const char *id,
+                   struct module *module, int extra_size,
+                   struct snd_card **card_ret);
+
+static inline __deprecated
 struct snd_card *snd_card_new(int idx, const char *id,
-                        struct module *module, int extra_size);
+                             struct module *module, int extra_size)
+{
+       struct snd_card *card;
+       if (snd_card_create(idx, id, module, extra_size, &card) < 0)
+               return NULL;
+       return card;
+}
+
 int snd_card_disconnect(struct snd_card *card);
 int snd_card_free(struct snd_card *card);
 int snd_card_free_when_closed(struct snd_card *card);
@@ -446,21 +458,33 @@ static inline int __snd_bug_on(int cond)
 struct snd_pci_quirk {
        unsigned short subvendor;       /* PCI subvendor ID */
        unsigned short subdevice;       /* PCI subdevice ID */
+       unsigned short subdevice_mask;  /* bitmask to match */
        int value;                      /* value */
 #ifdef CONFIG_SND_DEBUG_VERBOSE
        const char *name;               /* name of the device (optional) */
 #endif
 };
 
-#define _SND_PCI_QUIRK_ID(vend,dev) \
-       .subvendor = (vend), .subdevice = (dev)
+#define _SND_PCI_QUIRK_ID_MASK(vend, mask, dev)        \
+       .subvendor = (vend), .subdevice = (dev), .subdevice_mask = (mask)
+#define _SND_PCI_QUIRK_ID(vend, dev) \
+       _SND_PCI_QUIRK_ID_MASK(vend, 0xffff, dev)
 #define SND_PCI_QUIRK_ID(vend,dev) {_SND_PCI_QUIRK_ID(vend, dev)}
 #ifdef CONFIG_SND_DEBUG_VERBOSE
 #define SND_PCI_QUIRK(vend,dev,xname,val) \
        {_SND_PCI_QUIRK_ID(vend, dev), .value = (val), .name = (xname)}
+#define SND_PCI_QUIRK_VENDOR(vend, xname, val)                 \
+       {_SND_PCI_QUIRK_ID_MASK(vend, 0, 0), .value = (val), .name = (xname)}
+#define SND_PCI_QUIRK_MASK(vend, mask, dev, xname, val)                        \
+       {_SND_PCI_QUIRK_ID_MASK(vend, mask, dev),                       \
+                       .value = (val), .name = (xname)}
 #else
 #define SND_PCI_QUIRK(vend,dev,xname,val) \
        {_SND_PCI_QUIRK_ID(vend, dev), .value = (val)}
+#define SND_PCI_QUIRK_MASK(vend, mask, dev, xname, val)                        \
+       {_SND_PCI_QUIRK_ID_MASK(vend, mask, dev), .value = (val)}
+#define SND_PCI_QUIRK_VENDOR(vend, xname, val)                 \
+       {_SND_PCI_QUIRK_ID_MASK(vend, 0, 0), .value = (val)}
 #endif
 
 const struct snd_pci_quirk *
index d9eea013c753209a4dcb90f9bfc69eb95b697559..8c05e47a409053c69ddec36b60aee44b84907330 100644 (file)
 
 struct snd_hwdep;
 
+/* hwdep file ops; all ops can be NULL */
 struct snd_hwdep_ops {
-       long long (*llseek) (struct snd_hwdep *hw, struct file * file, long long offset, int orig);
-       long (*read) (struct snd_hwdep *hw, char __user *buf, long count, loff_t *offset);
-       long (*write) (struct snd_hwdep *hw, const char __user *buf, long count, loff_t *offset);
-       int (*open) (struct snd_hwdep * hw, struct file * file);
-       int (*release) (struct snd_hwdep *hw, struct file * file);
-       unsigned int (*poll) (struct snd_hwdep *hw, struct file * file, poll_table * wait);
-       int (*ioctl) (struct snd_hwdep *hw, struct file * file, unsigned int cmd, unsigned long arg);
-       int (*ioctl_compat) (struct snd_hwdep *hw, struct file * file, unsigned int cmd, unsigned long arg);
-       int (*mmap) (struct snd_hwdep *hw, struct file * file, struct vm_area_struct * vma);
-       int (*dsp_status) (struct snd_hwdep *hw, struct snd_hwdep_dsp_status *status);
-       int (*dsp_load) (struct snd_hwdep *hw, struct snd_hwdep_dsp_image *image);
+       long long (*llseek)(struct snd_hwdep *hw, struct file *file,
+                           long long offset, int orig);
+       long (*read)(struct snd_hwdep *hw, char __user *buf,
+                    long count, loff_t *offset);
+       long (*write)(struct snd_hwdep *hw, const char __user *buf,
+                     long count, loff_t *offset);
+       int (*open)(struct snd_hwdep *hw, struct file * file);
+       int (*release)(struct snd_hwdep *hw, struct file * file);
+       unsigned int (*poll)(struct snd_hwdep *hw, struct file *file,
+                            poll_table *wait);
+       int (*ioctl)(struct snd_hwdep *hw, struct file *file,
+                    unsigned int cmd, unsigned long arg);
+       int (*ioctl_compat)(struct snd_hwdep *hw, struct file *file,
+                           unsigned int cmd, unsigned long arg);
+       int (*mmap)(struct snd_hwdep *hw, struct file *file,
+                   struct vm_area_struct *vma);
+       int (*dsp_status)(struct snd_hwdep *hw,
+                         struct snd_hwdep_dsp_status *status);
+       int (*dsp_load)(struct snd_hwdep *hw,
+                       struct snd_hwdep_dsp_image *image);
 };
 
 struct snd_hwdep {
@@ -61,9 +71,9 @@ struct snd_hwdep {
        void (*private_free) (struct snd_hwdep *hwdep);
 
        struct mutex open_mutex;
-       int used;
-       unsigned int dsp_loaded;
-       unsigned int exclusive: 1;
+       int used;                       /* reference counter */
+       unsigned int dsp_loaded;        /* bit fields of loaded dsp indices */
+       unsigned int exclusive:1;       /* exclusive access mode */
 };
 
 extern int snd_hwdep_new(struct snd_card *card, char *id, int device,
index 2e0315cdd0d6780636d25dce4304dba14702238c..6b013c6f6a049b980c6b6de1f7ac4f094597ef24 100644 (file)
@@ -30,6 +30,9 @@ struct input_dev;
 /**
  * Jack types which can be reported.  These values are used as a
  * bitmask.
+ *
+ * Note that this must be kept in sync with the lookup table in
+ * sound/core/jack.c.
  */
 enum snd_jack_types {
        SND_JACK_HEADPHONE      = 0x0001,
@@ -37,6 +40,8 @@ enum snd_jack_types {
        SND_JACK_HEADSET        = SND_JACK_HEADPHONE | SND_JACK_MICROPHONE,
        SND_JACK_LINEOUT        = 0x0004,
        SND_JACK_MECHANICAL     = 0x0008, /* If detected separately */
+       SND_JACK_VIDEOOUT       = 0x0010,
+       SND_JACK_AVOUT          = SND_JACK_LINEOUT | SND_JACK_VIDEOOUT,
 };
 
 struct snd_jack {
index 40c5a6fa6bcd3635334f0405ee0d53f37c3944c7..8904b1900d7ffa7969bf82603a9142dc8d2f7807 100644 (file)
@@ -364,7 +364,6 @@ struct snd_pcm_substream {
         /* -- timer section -- */
        struct snd_timer *timer;                /* timer */
        unsigned timer_running: 1;      /* time is running */
-       spinlock_t timer_lock;
        /* -- next substream -- */
        struct snd_pcm_substream *next;
        /* -- linked substreams -- */
@@ -451,7 +450,7 @@ struct snd_pcm_notify {
 
 extern const struct file_operations snd_pcm_f_ops[2];
 
-int snd_pcm_new(struct snd_card *card, char *id, int device,
+int snd_pcm_new(struct snd_card *card, const char *id, int device,
                int playback_count, int capture_count,
                struct snd_pcm **rpcm);
 int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count);
index 2fd3d251d9a54e4896453508fcd3bcd86ebfbf26..2c894b600e5b972ac3dcbaa617c9e1596f8056e3 100644 (file)
@@ -42,4 +42,19 @@ extern int pxa2xx_ac97_hw_resume(void);
 extern int pxa2xx_ac97_hw_probe(struct platform_device *dev);
 extern void pxa2xx_ac97_hw_remove(struct platform_device *dev);
 
+/* AC97 platform_data */
+/**
+ * struct pxa2xx_ac97_platform_data - pxa ac97 platform data
+ * @reset_gpio: AC97 reset gpio (normally gpio113 or gpio95)
+ *              a -1 value means no gpio will be used for reset
+ *
+ * Platform data should only be specified for pxa27x CPUs where a silicon bug
+ * prevents correct operation of the reset line. If not specified, the default
+ * behaviour is to consider gpio 113 as the AC97 reset line, which is the
+ * default on most boards.
+ */
+struct pxa2xx_ac97_platform_data {
+       int reset_gpio;
+};
+
 #endif
index b550a416d075b9d0cefbdd684c24d953a46fd936..c23c26585700a91dc58eaa80d6cb44a6e5cb1248 100644 (file)
@@ -42,7 +42,6 @@
 #define SNDRV_RAWMIDI_LFLG_INPUT       (1<<1)
 #define SNDRV_RAWMIDI_LFLG_OPEN                (3<<0)
 #define SNDRV_RAWMIDI_LFLG_APPEND      (1<<2)
-#define        SNDRV_RAWMIDI_LFLG_NOOPENLOCK   (1<<3)
 
 struct snd_rawmidi;
 struct snd_rawmidi_substream;
index 85f93c5fe1e4030b297a1381819db5aafa82c235..4e62ee1e4115222ad42c1fb52beea6c03b27da52 100644 (file)
@@ -249,6 +249,7 @@ struct snd_sb {
 #define SB_ALS4000_3D_AUTO_MUTE        0x52
 #define SB_ALS4000_ANALOG_BLOCK_CTRL 0x53
 #define SB_ALS4000_3D_DELAYLINE_PATTERN 0x54
+#define SB_ALS4000_CR3_CONFIGURATION   0xc3 /* bit 7 is Digital Loop Enable */
 #define SB_ALS4000_QSOUND      0xdb
 
 /* IRQ setting bitmap */
@@ -330,7 +331,8 @@ enum {
        SB_MIX_DOUBLE,
        SB_MIX_INPUT_SW,
        SB_MIX_CAPTURE_PRO,
-       SB_MIX_CAPTURE_DT019X
+       SB_MIX_CAPTURE_DT019X,
+       SB_MIX_MONO_CAPTURE_ALS4K
 };
 
 #define SB_MIXVAL_DOUBLE(left_reg, right_reg, left_shift, right_shift, mask) \
index 5d1ab9c4950ffae3b370551a4aa30ed7667a10d8..1bce7fd1725f6b4d5a0237fd2410173d6da46344 100644 (file)
@@ -202,13 +202,11 @@ struct snd_emux_misc_mode {
        int value2;     /* reserved */
 };
 
-enum {
-       SNDRV_EMUX_IOCTL_VERSION = _IOR('H', 0x80, unsigned int),
-       SNDRV_EMUX_IOCTL_LOAD_PATCH = _IOWR('H', 0x81, struct soundfont_patch_info),
-       SNDRV_EMUX_IOCTL_RESET_SAMPLES = _IO('H', 0x82),
-       SNDRV_EMUX_IOCTL_REMOVE_LAST_SAMPLES = _IO('H', 0x83),
-       SNDRV_EMUX_IOCTL_MEM_AVAIL = _IOW('H', 0x84, int),
-       SNDRV_EMUX_IOCTL_MISC_MODE = _IOWR('H', 0x84, struct snd_emux_misc_mode),
-};
+#define SNDRV_EMUX_IOCTL_VERSION       _IOR('H', 0x80, unsigned int)
+#define SNDRV_EMUX_IOCTL_LOAD_PATCH    _IOWR('H', 0x81, struct soundfont_patch_info)
+#define SNDRV_EMUX_IOCTL_RESET_SAMPLES _IO('H', 0x82)
+#define SNDRV_EMUX_IOCTL_REMOVE_LAST_SAMPLES _IO('H', 0x83)
+#define SNDRV_EMUX_IOCTL_MEM_AVAIL     _IOW('H', 0x84, int)
+#define SNDRV_EMUX_IOCTL_MISC_MODE     _IOWR('H', 0x84, struct snd_emux_misc_mode)
 
 #endif /* __SOUND_SFNT_INFO_H */
index 24247f763608d7c5b654a0c87f7af5ac6ec7016d..13676472ddfcca7ace85a4bc407c66d40a746b79 100644 (file)
@@ -203,7 +203,7 @@ struct snd_soc_dai {
        int (*resume)(struct snd_soc_dai *dai);
 
        /* ops */
-       struct snd_soc_dai_ops ops;
+       struct snd_soc_dai_ops *ops;
 
        /* DAI capabilities */
        struct snd_soc_pcm_stream capture;
index dfa804958820d631f52422f55ff2390e477eea9b..a7def6a9a030e00671cb40ea6da2498ffca9caa2 100644 (file)
         wcontrols, wncontrols)\
 {      .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \
        .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = wncontrols}
+#define SND_SOC_DAPM_MIXER_NAMED_CTL(wname, wreg, wshift, winvert, \
+        wcontrols, wncontrols)\
+{       .id = snd_soc_dapm_mixer_named_ctl, .name = wname, .reg = wreg, \
+       .shift = wshift, .invert = winvert, .kcontrols = wcontrols, \
+       .num_kcontrols = wncontrols}
 #define SND_SOC_DAPM_MICBIAS(wname, wreg, wshift, winvert) \
 {      .id = snd_soc_dapm_micbias, .name = wname, .reg = wreg, .shift = wshift, \
        .invert = winvert, .kcontrols = NULL, .num_kcontrols = 0}
 {      .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \
        .invert = winvert, .kcontrols = wcontrols, .num_kcontrols = wncontrols, \
        .event = wevent, .event_flags = wflags}
+#define SND_SOC_DAPM_MIXER_NAMED_CTL_E(wname, wreg, wshift, winvert, \
+       wcontrols, wncontrols, wevent, wflags) \
+{       .id = snd_soc_dapm_mixer, .name = wname, .reg = wreg, .shift = wshift, \
+       .invert = winvert, .kcontrols = wcontrols, \
+       .num_kcontrols = wncontrols, .event = wevent, .event_flags = wflags}
 #define SND_SOC_DAPM_MICBIAS_E(wname, wreg, wshift, winvert, wevent, wflags) \
 {      .id = snd_soc_dapm_micbias, .name = wname, .reg = wreg, .shift = wshift, \
        .invert = winvert, .kcontrols = NULL, .num_kcontrols = 0, \
        .get = snd_soc_dapm_get_value_enum_double, \
        .put = snd_soc_dapm_put_value_enum_double, \
        .private_value = (unsigned long)&xenum }
+#define SOC_DAPM_PIN_SWITCH(xname) \
+{      .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname " Switch", \
+       .info = snd_soc_dapm_info_pin_switch, \
+       .get = snd_soc_dapm_get_pin_switch, \
+       .put = snd_soc_dapm_put_pin_switch, \
+       .private_value = (unsigned long)xname }
 
 /* dapm stream operations */
 #define SND_SOC_DAPM_STREAM_NOP                        0x0
@@ -228,6 +244,12 @@ int snd_soc_dapm_get_value_enum_double(struct snd_kcontrol *kcontrol,
        struct snd_ctl_elem_value *ucontrol);
 int snd_soc_dapm_put_value_enum_double(struct snd_kcontrol *kcontrol,
        struct snd_ctl_elem_value *ucontrol);
+int snd_soc_dapm_info_pin_switch(struct snd_kcontrol *kcontrol,
+       struct snd_ctl_elem_info *uinfo);
+int snd_soc_dapm_get_pin_switch(struct snd_kcontrol *kcontrol,
+       struct snd_ctl_elem_value *uncontrol);
+int snd_soc_dapm_put_pin_switch(struct snd_kcontrol *kcontrol,
+       struct snd_ctl_elem_value *uncontrol);
 int snd_soc_dapm_new_control(struct snd_soc_codec *codec,
        const struct snd_soc_dapm_widget *widget);
 int snd_soc_dapm_new_controls(struct snd_soc_codec *codec,
@@ -250,10 +272,10 @@ int snd_soc_dapm_set_bias_level(struct snd_soc_device *socdev,
 int snd_soc_dapm_sys_add(struct device *dev);
 
 /* dapm audio pin control and status */
-int snd_soc_dapm_enable_pin(struct snd_soc_codec *codec, char *pin);
-int snd_soc_dapm_disable_pin(struct snd_soc_codec *codec, char *pin);
-int snd_soc_dapm_nc_pin(struct snd_soc_codec *codec, char *pin);
-int snd_soc_dapm_get_pin_status(struct snd_soc_codec *codec, char *pin);
+int snd_soc_dapm_enable_pin(struct snd_soc_codec *codec, const char *pin);
+int snd_soc_dapm_disable_pin(struct snd_soc_codec *codec, const char *pin);
+int snd_soc_dapm_nc_pin(struct snd_soc_codec *codec, const char *pin);
+int snd_soc_dapm_get_pin_status(struct snd_soc_codec *codec, const char *pin);
 int snd_soc_dapm_sync(struct snd_soc_codec *codec);
 
 /* dapm widget types */
@@ -263,6 +285,7 @@ enum snd_soc_dapm_type {
        snd_soc_dapm_mux,                       /* selects 1 analog signal from many inputs */
        snd_soc_dapm_value_mux,                 /* selects 1 analog signal from many inputs */
        snd_soc_dapm_mixer,                     /* mixes several analog signals together */
+       snd_soc_dapm_mixer_named_ctl,           /* mixer with named controls */
        snd_soc_dapm_pga,                       /* programmable gain/attenuation (volume) */
        snd_soc_dapm_adc,                       /* analog to digital converter */
        snd_soc_dapm_dac,                       /* digital to analog converter */
index 24593ac3ea19528749da10d77aeb0ca1e00c3f94..a40bc6f316fc668b6328374315aded850a40262d 100644 (file)
@@ -16,6 +16,8 @@
 #include <linux/platform_device.h>
 #include <linux/types.h>
 #include <linux/workqueue.h>
+#include <linux/interrupt.h>
+#include <linux/kernel.h>
 #include <sound/core.h>
 #include <sound/pcm.h>
 #include <sound/control.h>
@@ -154,6 +156,8 @@ enum snd_soc_bias_level {
        SND_SOC_BIAS_OFF,
 };
 
+struct snd_jack;
+struct snd_soc_card;
 struct snd_soc_device;
 struct snd_soc_pcm_stream;
 struct snd_soc_ops;
@@ -164,6 +168,11 @@ struct snd_soc_platform;
 struct snd_soc_codec;
 struct soc_enum;
 struct snd_soc_ac97_ops;
+struct snd_soc_jack;
+struct snd_soc_jack_pin;
+#ifdef CONFIG_GPIOLIB
+struct snd_soc_jack_gpio;
+#endif
 
 typedef int (*hw_write_t)(void *,const char* ,int);
 typedef int (*hw_read_t)(void *,char* ,int);
@@ -184,6 +193,19 @@ int snd_soc_init_card(struct snd_soc_device *socdev);
 int snd_soc_set_runtime_hwparams(struct snd_pcm_substream *substream,
        const struct snd_pcm_hardware *hw);
 
+/* Jack reporting */
+int snd_soc_jack_new(struct snd_soc_card *card, const char *id, int type,
+                    struct snd_soc_jack *jack);
+void snd_soc_jack_report(struct snd_soc_jack *jack, int status, int mask);
+int snd_soc_jack_add_pins(struct snd_soc_jack *jack, int count,
+                         struct snd_soc_jack_pin *pins);
+#ifdef CONFIG_GPIOLIB
+int snd_soc_jack_add_gpios(struct snd_soc_jack *jack, int count,
+                       struct snd_soc_jack_gpio *gpios);
+void snd_soc_jack_free_gpios(struct snd_soc_jack *jack, int count,
+                       struct snd_soc_jack_gpio *gpios);
+#endif
+
 /* codec IO */
 #define snd_soc_read(codec, reg) codec->read(codec, reg)
 #define snd_soc_write(codec, reg, value) codec->write(codec, reg, value)
@@ -203,6 +225,8 @@ void snd_soc_free_ac97_codec(struct snd_soc_codec *codec);
  */
 struct snd_kcontrol *snd_soc_cnew(const struct snd_kcontrol_new *_template,
        void *data, char *long_name);
+int snd_soc_add_controls(struct snd_soc_codec *codec,
+       const struct snd_kcontrol_new *controls, int num_controls);
 int snd_soc_info_enum_double(struct snd_kcontrol *kcontrol,
        struct snd_ctl_elem_info *uinfo);
 int snd_soc_info_enum_ext(struct snd_kcontrol *kcontrol,
@@ -237,6 +261,48 @@ int snd_soc_get_volsw_s8(struct snd_kcontrol *kcontrol,
 int snd_soc_put_volsw_s8(struct snd_kcontrol *kcontrol,
        struct snd_ctl_elem_value *ucontrol);
 
+/**
+ * struct snd_soc_jack_pin - Describes a pin to update based on jack detection
+ *
+ * @pin:    name of the pin to update
+ * @mask:   bits to check for in reported jack status
+ * @invert: if non-zero then pin is enabled when status is not reported
+ */
+struct snd_soc_jack_pin {
+       struct list_head list;
+       const char *pin;
+       int mask;
+       bool invert;
+};
+
+/**
+ * struct snd_soc_jack_gpio - Describes a gpio pin for jack detection
+ *
+ * @gpio:         gpio number
+ * @name:         gpio name
+ * @report:       value to report when jack detected
+ * @invert:       report presence in low state
+ * @debouce_time: debouce time in ms
+ */
+#ifdef CONFIG_GPIOLIB
+struct snd_soc_jack_gpio {
+       unsigned int gpio;
+       const char *name;
+       int report;
+       int invert;
+       int debounce_time;
+       struct snd_soc_jack *jack;
+       struct work_struct work;
+};
+#endif
+
+struct snd_soc_jack {
+       struct snd_jack *jack;
+       struct snd_soc_card *card;
+       struct list_head pins;
+       int status;
+};
+
 /* SoC PCM stream information */
 struct snd_soc_pcm_stream {
        char *stream_name;
@@ -384,6 +450,8 @@ struct snd_soc_card {
 
        struct snd_soc_device *socdev;
 
+       struct snd_soc_codec *codec;
+
        struct snd_soc_platform *platform;
        struct delayed_work delayed_work;
        struct work_struct deferred_resume_work;
@@ -393,7 +461,6 @@ struct snd_soc_card {
 struct snd_soc_device {
        struct device *dev;
        struct snd_soc_card *card;
-       struct snd_soc_codec *codec;
        struct snd_soc_codec_device *codec_dev;
        void *codec_data;
 };
diff --git a/include/sound/uda1341.h b/include/sound/uda1341.h
deleted file mode 100644 (file)
index 110d5dc..0000000
+++ /dev/null
@@ -1,126 +0,0 @@
-/*
- *  linux/include/linux/l3/uda1341.h
- *
- * Philips UDA1341 mixer device driver for ALSA
- *
- * Copyright (c) 2002 Tomas Kasparek <tomas.kasparek@seznam.cz>
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License.
- *
- * History:
- *
- * 2002-03-13 Tomas Kasparek Initial release - based on uda1341.h from OSS
- * 2002-03-30 Tomas Kasparek Proc filesystem support, complete mixer and DSP
- *                           features support
- */
-
-#define UDA1341_ALSA_NAME "snd-uda1341"
-
-/*
- * Default rate set after inicialization
- */
-#define AUDIO_RATE_DEFAULT     44100
-
-/*
- * UDA1341 L3 address and command types
- */
-#define UDA1341_L3ADDR         5
-#define UDA1341_DATA0          (UDA1341_L3ADDR << 2 | 0)
-#define UDA1341_DATA1          (UDA1341_L3ADDR << 2 | 1)
-#define UDA1341_STATUS         (UDA1341_L3ADDR << 2 | 2)
-
-enum uda1341_onoff {
-       OFF=0,
-       ON,
-};
-
-enum uda1341_format {
-       I2S=0,
-       LSB16,
-       LSB18,
-       LSB20,
-       MSB,
-       LSB16MSB,
-       LSB18MSB,
-       LSB20MSB,        
-};
-
-enum uda1341_fs {
-       F512=0,
-       F384,
-       F256,
-       Funused,
-};
-
-enum uda1341_peak {
-       BEFORE=0,
-       AFTER,
-};
-
-enum uda1341_filter {
-       FLAT=0,
-       MIN,
-       MIN2,
-       MAX,
-};
-
-enum uda1341_mixer {
-       DOUBLE,
-       LINE,
-       MIC,
-       MIXER,
-};
-
-enum uda1341_deemp {
-       NONE,
-       D32,
-       D44,
-       D48,
-};
-
-enum uda1341_config {
-       CMD_READ_REG = 0,
-       CMD_RESET,
-       CMD_FS,
-       CMD_FORMAT,
-       CMD_OGAIN,
-       CMD_IGAIN,
-       CMD_DAC,
-       CMD_ADC,
-       CMD_VOLUME,
-       CMD_BASS,
-       CMD_TREBBLE,
-       CMD_PEAK,
-       CMD_DEEMP,
-       CMD_MUTE,        
-       CMD_FILTER,
-       CMD_CH1,
-       CMD_CH2,
-       CMD_MIC,       
-       CMD_MIXER,
-       CMD_AGC,
-       CMD_IG,
-       CMD_AGC_TIME,
-       CMD_AGC_LEVEL,
-#ifdef CONFIG_PM
-       CMD_SUSPEND,
-       CMD_RESUME,
-#endif
-       CMD_LAST,
-};
-
-enum write_through {
-       //used in update_bits (write_cfg) to avoid l3_write - just update local copy of regs.
-       REGS_ONLY=0,
-       //update local regs and write value to uda1341 - do l3_write
-       FLUSH,
-};
-
-int __init snd_chip_uda1341_mixer_new(struct snd_card *card, struct l3_client **clnt);
-
-/*
- * Local variables:
- * indent-tabs-mode: t
- * End:
- */
index 2b48237e23bfae6ac9a432059933a2c3555b5a8f..a7e74e23ad2ee92255530f011ad1df12de03e73c 100644 (file)
@@ -1,3 +1,3 @@
 /* include/version.h */
-#define CONFIG_SND_VERSION "1.0.18a"
+#define CONFIG_SND_VERSION "1.0.19"
 #define CONFIG_SND_DATE ""
index fd01f22825cdda88235ee4c05aa0a834af309258..6d65f322f1d556f7e5d50af18cd24c153bb2bfe7 100644 (file)
@@ -154,6 +154,7 @@ int snd_wss_create(struct snd_card *card,
                      unsigned short hardware,
                      unsigned short hwshare,
                      struct snd_wss **rchip);
+int snd_wss_free(struct snd_wss *chip);
 int snd_wss_pcm(struct snd_wss *chip, int device, struct snd_pcm **rpcm);
 int snd_wss_timer(struct snd_wss *chip, int device, struct snd_timer **rtimer);
 int snd_wss_mixer(struct snd_wss *chip);
index 200aca1faa7112f0413f3cd92ab0a55cec48f588..1eceb85287c5f8197a25fe4a326c25b5dbf8e5be 100644 (file)
@@ -60,6 +60,8 @@ source "sound/aoa/Kconfig"
 
 source "sound/arm/Kconfig"
 
+source "sound/atmel/Kconfig"
+
 source "sound/spi/Kconfig"
 
 source "sound/mips/Kconfig"
index c76d70716fa537edccbe4ceada9b3eea1fbfa9f4..ec467decfa7913d19b663fc57ecde40be21093d2 100644 (file)
@@ -6,7 +6,7 @@ obj-$(CONFIG_SOUND_PRIME) += sound_firmware.o
 obj-$(CONFIG_SOUND_PRIME) += oss/
 obj-$(CONFIG_DMASOUND) += oss/
 obj-$(CONFIG_SND) += core/ i2c/ drivers/ isa/ pci/ ppc/ arm/ sh/ synth/ usb/ \
-       sparc/ spi/ parisc/ pcmcia/ mips/ soc/
+       sparc/ spi/ parisc/ pcmcia/ mips/ soc/ atmel/
 obj-$(CONFIG_SND_AOA) += aoa/
 
 # This one must be compilable even if sound is configured out
index ee64f5de896617b1f17dbb4b5a7064eef257b552..6065b0344e23ce888a2ce5eea1015c35165e0c66 100644 (file)
@@ -34,10 +34,12 @@ struct gpio_methods {
        void (*set_headphone)(struct gpio_runtime *rt, int on);
        void (*set_speakers)(struct gpio_runtime *rt, int on);
        void (*set_lineout)(struct gpio_runtime *rt, int on);
+       void (*set_master)(struct gpio_runtime *rt, int on);
 
        int (*get_headphone)(struct gpio_runtime *rt);
        int (*get_speakers)(struct gpio_runtime *rt);
        int (*get_lineout)(struct gpio_runtime *rt);
+       int (*get_master)(struct gpio_runtime *rt);
 
        void (*set_hw_reset)(struct gpio_runtime *rt, int on);
 
index 617850463582fc682696969659bcda553ec02eb6..0fa3855b4790e30753b7b8ea4fb29644a6e8cd1f 100644 (file)
@@ -23,9 +23,10 @@ int aoa_alsa_init(char *name, struct module *mod, struct device *dev)
                /* cannot be EEXIST due to usage in aoa_fabric_register */
                return -EBUSY;
 
-       alsa_card = snd_card_new(index, name, mod, sizeof(struct aoa_card));
-       if (!alsa_card)
-               return -ENOMEM;
+       err = snd_card_create(index, name, mod, sizeof(struct aoa_card),
+                             &alsa_card);
+       if (err < 0)
+               return err;
        aoa_card = alsa_card->private_data;
        aoa_card->alsa_card = alsa_card;
        alsa_card->dev = dev;
index c93ad5dec66b54d7e50f10b98a06cd0ac9c5e5a8..de8e03afa97b2e09d8602be884a56f252dcf3069 100644 (file)
@@ -14,7 +14,7 @@
 #include <linux/interrupt.h>
 #include "../aoa.h"
 
-/* TODO: these are 20 global variables
+/* TODO: these are lots of global variables
  * that aren't used on most machines...
  * Move them into a dynamically allocated
  * structure and use that.
@@ -23,6 +23,7 @@
 /* these are the GPIO numbers (register addresses as offsets into
  * the GPIO space) */
 static int headphone_mute_gpio;
+static int master_mute_gpio;
 static int amp_mute_gpio;
 static int lineout_mute_gpio;
 static int hw_reset_gpio;
@@ -32,6 +33,7 @@ static int linein_detect_gpio;
 
 /* see the SWITCH_GPIO macro */
 static int headphone_mute_gpio_activestate;
+static int master_mute_gpio_activestate;
 static int amp_mute_gpio_activestate;
 static int lineout_mute_gpio_activestate;
 static int hw_reset_gpio_activestate;
@@ -156,6 +158,7 @@ static int ftr_gpio_get_##name(struct gpio_runtime *rt)             \
 FTR_GPIO(headphone, 0);
 FTR_GPIO(amp, 1);
 FTR_GPIO(lineout, 2);
+FTR_GPIO(master, 3);
 
 static void ftr_gpio_set_hw_reset(struct gpio_runtime *rt, int on)
 {
@@ -172,6 +175,8 @@ static void ftr_gpio_set_hw_reset(struct gpio_runtime *rt, int on)
                          hw_reset_gpio, v);
 }
 
+static struct gpio_methods methods;
+
 static void ftr_gpio_all_amps_off(struct gpio_runtime *rt)
 {
        int saved;
@@ -181,6 +186,8 @@ static void ftr_gpio_all_amps_off(struct gpio_runtime *rt)
        ftr_gpio_set_headphone(rt, 0);
        ftr_gpio_set_amp(rt, 0);
        ftr_gpio_set_lineout(rt, 0);
+       if (methods.set_master)
+               ftr_gpio_set_master(rt, 0);
        rt->implementation_private = saved;
 }
 
@@ -193,6 +200,8 @@ static void ftr_gpio_all_amps_restore(struct gpio_runtime *rt)
        ftr_gpio_set_headphone(rt, (s>>0)&1);
        ftr_gpio_set_amp(rt, (s>>1)&1);
        ftr_gpio_set_lineout(rt, (s>>2)&1);
+       if (methods.set_master)
+               ftr_gpio_set_master(rt, (s>>3)&1);
 }
 
 static void ftr_handle_notify(struct work_struct *work)
@@ -231,6 +240,12 @@ static void ftr_gpio_init(struct gpio_runtime *rt)
        get_gpio("hw-reset", "audio-hw-reset",
                 &hw_reset_gpio,
                 &hw_reset_gpio_activestate);
+       if (get_gpio("master-mute", NULL,
+                    &master_mute_gpio,
+                    &master_mute_gpio_activestate)) {
+               methods.set_master = ftr_gpio_set_master;
+               methods.get_master = ftr_gpio_get_master;
+       }
 
        headphone_detect_node = get_gpio("headphone-detect", NULL,
                                         &headphone_detect_gpio,
index ad60f5d10e82543195e17e843c62e39d7d0aa367..fbf5c933baa4aa1487e9f2559210ac61f262be07 100644 (file)
@@ -1,16 +1,14 @@
 /*
- * Apple Onboard Audio driver -- layout fabric
+ * Apple Onboard Audio driver -- layout/machine id fabric
  *
- * Copyright 2006 Johannes Berg <johannes@sipsolutions.net>
+ * Copyright 2006-2008 Johannes Berg <johannes@sipsolutions.net>
  *
  * GPL v2, can be found in COPYING.
  *
  *
- * This fabric module looks for sound codecs
- * based on the layout-id property in the device tree.
- *
+ * This fabric module looks for sound codecs based on the
+ * layout-id or device-id property in the device tree.
  */
-
 #include <asm/prom.h>
 #include <linux/list.h>
 #include <linux/module.h>
@@ -63,7 +61,7 @@ struct codec_connect_info {
 #define LAYOUT_FLAG_COMBO_LINEOUT_SPDIF        (1<<0)
 
 struct layout {
-       unsigned int layout_id;
+       unsigned int layout_id, device_id;
        struct codec_connect_info codecs[MAX_CODECS_PER_BUS];
        int flags;
 
@@ -111,6 +109,10 @@ MODULE_ALIAS("sound-layout-96");
 MODULE_ALIAS("sound-layout-98");
 MODULE_ALIAS("sound-layout-100");
 
+MODULE_ALIAS("aoa-device-id-14");
+MODULE_ALIAS("aoa-device-id-22");
+MODULE_ALIAS("aoa-device-id-35");
+
 /* onyx with all but microphone connected */
 static struct codec_connection onyx_connections_nomic[] = {
        {
@@ -518,6 +520,27 @@ static struct layout layouts[] = {
                .connections = onyx_connections_noheadphones,
          },
        },
+       /* PowerMac3,4 */
+       { .device_id = 14,
+         .codecs[0] = {
+               .name = "tas",
+               .connections = tas_connections_noline,
+         },
+       },
+       /* PowerMac3,6 */
+       { .device_id = 22,
+         .codecs[0] = {
+               .name = "tas",
+               .connections = tas_connections_all,
+         },
+       },
+       /* PowerBook5,2 */
+       { .device_id = 35,
+         .codecs[0] = {
+               .name = "tas",
+               .connections = tas_connections_all,
+         },
+       },
        {}
 };
 
@@ -526,7 +549,7 @@ static struct layout *find_layout_by_id(unsigned int id)
        struct layout *l;
 
        l = layouts;
-       while (l->layout_id) {
+       while (l->codecs[0].name) {
                if (l->layout_id == id)
                        return l;
                l++;
@@ -534,6 +557,19 @@ static struct layout *find_layout_by_id(unsigned int id)
        return NULL;
 }
 
+static struct layout *find_layout_by_device(unsigned int id)
+{
+       struct layout *l;
+
+       l = layouts;
+       while (l->codecs[0].name) {
+               if (l->device_id == id)
+                       return l;
+               l++;
+       }
+       return NULL;
+}
+
 static void use_layout(struct layout *l)
 {
        int i;
@@ -564,6 +600,7 @@ struct layout_dev {
        struct snd_kcontrol *headphone_ctrl;
        struct snd_kcontrol *lineout_ctrl;
        struct snd_kcontrol *speaker_ctrl;
+       struct snd_kcontrol *master_ctrl;
        struct snd_kcontrol *headphone_detected_ctrl;
        struct snd_kcontrol *lineout_detected_ctrl;
 
@@ -615,6 +652,7 @@ static struct snd_kcontrol_new n##_ctl = {                          \
 AMP_CONTROL(headphone, "Headphone Switch");
 AMP_CONTROL(speakers, "Speakers Switch");
 AMP_CONTROL(lineout, "Line-Out Switch");
+AMP_CONTROL(master, "Master Switch");
 
 static int detect_choice_get(struct snd_kcontrol *kcontrol,
                             struct snd_ctl_elem_value *ucontrol)
@@ -855,6 +893,11 @@ static void layout_attached_codec(struct aoa_codec *codec)
        lineout = codec->gpio->methods->get_detect(codec->gpio,
                                                   AOA_NOTIFY_LINE_OUT);
 
+       if (codec->gpio->methods->set_master) {
+               ctl = snd_ctl_new1(&master_ctl, codec->gpio);
+               ldev->master_ctrl = ctl;
+               aoa_snd_ctl_add(ctl);
+       }
        while (cc->connected) {
                if (cc->connected & CC_SPEAKERS) {
                        if (headphones <= 0 && lineout <= 0)
@@ -938,8 +981,8 @@ static struct aoa_fabric layout_fabric = {
 static int aoa_fabric_layout_probe(struct soundbus_dev *sdev)
 {
        struct device_node *sound = NULL;
-       const unsigned int *layout_id;
-       struct layout *layout;
+       const unsigned int *id;
+       struct layout *layout = NULL;
        struct layout_dev *ldev = NULL;
        int err;
 
@@ -952,15 +995,18 @@ static int aoa_fabric_layout_probe(struct soundbus_dev *sdev)
                if (sound->type && strcasecmp(sound->type, "soundchip") == 0)
                        break;
        }
-       if (!sound) return -ENODEV;
+       if (!sound)
+               return -ENODEV;
 
-       layout_id = of_get_property(sound, "layout-id", NULL);
-       if (!layout_id)
-               goto outnodev;
-       printk(KERN_INFO "snd-aoa-fabric-layout: found bus with layout %d\n",
-              *layout_id);
+       id = of_get_property(sound, "layout-id", NULL);
+       if (id) {
+               layout = find_layout_by_id(*id);
+       } else {
+               id = of_get_property(sound, "device-id", NULL);
+               if (id)
+                       layout = find_layout_by_device(*id);
+       }
 
-       layout = find_layout_by_id(*layout_id);
        if (!layout) {
                printk(KERN_ERR "snd-aoa-fabric-layout: unknown layout\n");
                goto outnodev;
@@ -976,6 +1022,7 @@ static int aoa_fabric_layout_probe(struct soundbus_dev *sdev)
        ldev->layout = layout;
        ldev->gpio.node = sound->parent;
        switch (layout->layout_id) {
+       case 0:  /* anything with device_id, not layout_id */
        case 41: /* that unknown machine no one seems to have */
        case 51: /* PowerBook5,4 */
        case 58: /* Mac Mini */
index be468edf3ecb990ba68b4117808a2ebdf55472ce..418c84c99d6946d8cb4982569ada0542c1327dfa 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * i2sbus driver
  *
- * Copyright 2006 Johannes Berg <johannes@sipsolutions.net>
+ * Copyright 2006-2008 Johannes Berg <johannes@sipsolutions.net>
  *
  * GPL v2, can be found in COPYING.
  */
@@ -186,13 +186,25 @@ static int i2sbus_add_dev(struct macio_dev *macio,
                }
        }
        if (i == 1) {
-               const u32 *layout_id =
-                       of_get_property(sound, "layout-id", NULL);
-               if (layout_id) {
-                       layout = *layout_id;
+               const u32 *id = of_get_property(sound, "layout-id", NULL);
+
+               if (id) {
+                       layout = *id;
                        snprintf(dev->sound.modalias, 32,
                                 "sound-layout-%d", layout);
                        ok = 1;
+               } else {
+                       id = of_get_property(sound, "device-id", NULL);
+                       /*
+                        * We probably cannot handle all device-id machines,
+                        * so restrict to those we do handle for now.
+                        */
+                       if (id && (*id == 22 || *id == 14 || *id == 35)) {
+                               snprintf(dev->sound.modalias, 32,
+                                        "aoa-device-id-%d", *id);
+                               ok = 1;
+                               layout = -1;
+                       }
                }
        }
        /* for the time being, until we can handle non-layout-id
index f8e6de48d816a49d4451b88b8417069ae1062510..885683a3b0bdf084985328151d35308d4ebb5afb 100644 (file)
@@ -11,17 +11,6 @@ menuconfig SND_ARM
 
 if SND_ARM
 
-config SND_SA11XX_UDA1341
-       tristate "SA11xx UDA1341TS driver (iPaq H3600)"
-       depends on ARCH_SA1100 && L3
-       select SND_PCM
-       help
-         Say Y here if you have a Compaq iPaq H3x00 handheld computer
-         and want to use its Philips UDA 1341 audio chip.
-
-         To compile this driver as a module, choose M here: the module
-         will be called snd-sa11xx-uda1341.
-
 config SND_ARMAACI
        tristate "ARM PrimeCell PL041 AC Link support"
        depends on ARM_AMBA
index 2054de11de8a2140ce7f4052c0233ba5fb183fb6..5a549ed6c8aa500bc4a202ec3ac20206f5fa038a 100644 (file)
@@ -2,9 +2,6 @@
 # Makefile for ALSA
 #
 
-obj-$(CONFIG_SND_SA11XX_UDA1341) += snd-sa11xx-uda1341.o 
-snd-sa11xx-uda1341-objs                := sa11xx-uda1341.o
-
 obj-$(CONFIG_SND_ARMAACI)      += snd-aaci.o
 snd-aaci-objs                  := aaci.o devdma.o
 
index 772901e41ecb5fe86d83633e0e2137847233a745..7fbd68fab944e08ecba5bd4424331007198705e2 100644 (file)
@@ -995,10 +995,11 @@ static struct aaci * __devinit aaci_init_card(struct amba_device *dev)
 {
        struct aaci *aaci;
        struct snd_card *card;
+       int err;
 
-       card = snd_card_new(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
-                           THIS_MODULE, sizeof(struct aaci));
-       if (card == NULL)
+       err = snd_card_create(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
+                             THIS_MODULE, sizeof(struct aaci), &card);
+       if (err < 0)
                return NULL;
 
        card->private_free = aaci_free_card;
index 35afd0c33be58b1a74b1e1be7685bd88dd65a801..2e6355f4cbb926d888f7c2b5711512354ba2890e 100644 (file)
@@ -31,6 +31,7 @@ static DECLARE_WAIT_QUEUE_HEAD(gsr_wq);
 static volatile long gsr_bits;
 static struct clk *ac97_clk;
 static struct clk *ac97conf_clk;
+static int reset_gpio;
 
 /*
  * Beware PXA27x bugs:
@@ -42,6 +43,45 @@ static struct clk *ac97conf_clk;
  * 1 jiffy timeout if interrupt never comes).
  */
 
+enum {
+       RESETGPIO_FORCE_HIGH,
+       RESETGPIO_FORCE_LOW,
+       RESETGPIO_NORMAL_ALTFUNC
+};
+
+/**
+ * set_resetgpio_mode - computes and sets the AC97_RESET gpio mode on PXA
+ * @mode: chosen action
+ *
+ * As the PXA27x CPUs suffer from a AC97 bug, a manual control of the reset line
+ * must be done to insure proper work of AC97 reset line.  This function
+ * computes the correct gpio_mode for further use by reset functions, and
+ * applied the change through pxa_gpio_mode.
+ */
+static void set_resetgpio_mode(int resetgpio_action)
+{
+       int mode = 0;
+
+       if (reset_gpio)
+               switch (resetgpio_action) {
+               case RESETGPIO_NORMAL_ALTFUNC:
+                       if (reset_gpio == 113)
+                               mode = 113 | GPIO_OUT | GPIO_DFLT_LOW;
+                       if (reset_gpio == 95)
+                               mode = 95 | GPIO_ALT_FN_1_OUT;
+                       break;
+               case RESETGPIO_FORCE_LOW:
+                       mode = reset_gpio | GPIO_OUT | GPIO_DFLT_LOW;
+                       break;
+               case RESETGPIO_FORCE_HIGH:
+                       mode = reset_gpio | GPIO_OUT | GPIO_DFLT_HIGH;
+                       break;
+               };
+
+       if (mode)
+               pxa_gpio_mode(mode);
+}
+
 unsigned short pxa2xx_ac97_read(struct snd_ac97 *ac97, unsigned short reg)
 {
        unsigned short val = -1;
@@ -137,10 +177,10 @@ static inline void pxa_ac97_warm_pxa27x(void)
 
        /* warm reset broken on Bulverde,
           so manually keep AC97 reset high */
-       pxa_gpio_mode(113 | GPIO_OUT | GPIO_DFLT_HIGH);
+       set_resetgpio_mode(RESETGPIO_FORCE_HIGH);
        udelay(10);
        GCR |= GCR_WARM_RST;
-       pxa_gpio_mode(113 | GPIO_ALT_FN_2_OUT);
+       set_resetgpio_mode(RESETGPIO_NORMAL_ALTFUNC);
        udelay(500);
 }
 
@@ -308,8 +348,8 @@ int pxa2xx_ac97_hw_resume(void)
                pxa_gpio_mode(GPIO29_SDATA_IN_AC97_MD);
        }
        if (cpu_is_pxa27x()) {
-               /* Use GPIO 113 as AC97 Reset on Bulverde */
-               pxa_gpio_mode(113 | GPIO_ALT_FN_2_OUT);
+               /* Use GPIO 113 or 95 as AC97 Reset on Bulverde */
+               set_resetgpio_mode(RESETGPIO_NORMAL_ALTFUNC);
        }
        clk_enable(ac97_clk);
        return 0;
@@ -320,6 +360,27 @@ EXPORT_SYMBOL_GPL(pxa2xx_ac97_hw_resume);
 int __devinit pxa2xx_ac97_hw_probe(struct platform_device *dev)
 {
        int ret;
+       struct pxa2xx_ac97_platform_data *pdata = dev->dev.platform_data;
+
+       if (pdata) {
+               switch (pdata->reset_gpio) {
+               case 95:
+               case 113:
+                       reset_gpio = pdata->reset_gpio;
+                       break;
+               case 0:
+                       reset_gpio = 113;
+                       break;
+               case -1:
+                       break;
+               default:
+                       dev_err(&dev->dev, "Invalid reset GPIO %d\n",
+                               pdata->reset_gpio);
+               }
+       } else {
+               if (cpu_is_pxa27x())
+                       reset_gpio = 113;
+       }
 
        if (cpu_is_pxa25x() || cpu_is_pxa27x()) {
                pxa_gpio_mode(GPIO31_SYNC_AC97_MD);
@@ -330,7 +391,7 @@ int __devinit pxa2xx_ac97_hw_probe(struct platform_device *dev)
 
        if (cpu_is_pxa27x()) {
                /* Use GPIO 113 as AC97 Reset on Bulverde */
-               pxa_gpio_mode(113 | GPIO_ALT_FN_2_OUT);
+               set_resetgpio_mode(RESETGPIO_NORMAL_ALTFUNC);
                ac97conf_clk = clk_get(&dev->dev, "AC97CONFCLK");
                if (IS_ERR(ac97conf_clk)) {
                        ret = PTR_ERR(ac97conf_clk);
index 85cf591d4e11d594d96ac970ec1bed41d473bbb2..7ed100c80a5f752a7768cc11d152eb1e01471a8c 100644 (file)
@@ -173,10 +173,9 @@ static int __devinit pxa2xx_ac97_probe(struct platform_device *dev)
        struct snd_ac97_template ac97_template;
        int ret;
 
-       ret = -ENOMEM;
-       card = snd_card_new(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
-                           THIS_MODULE, 0);
-       if (!card)
+       ret = snd_card_create(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
+                             THIS_MODULE, 0, &card);
+       if (ret < 0)
                goto err;
 
        card->dev = &dev->dev;
diff --git a/sound/arm/sa11xx-uda1341.c b/sound/arm/sa11xx-uda1341.c
deleted file mode 100644 (file)
index 1dcd51d..0000000
+++ /dev/null
@@ -1,983 +0,0 @@
-/*
- *  Driver for Philips UDA1341TS on Compaq iPAQ H3600 soundcard
- *  Copyright (C) 2002 Tomas Kasparek <tomas.kasparek@seznam.cz>
- *
- *   This program is free software; you can redistribute it and/or modify
- *   it under the terms of the GNU General Public License.
- * 
- * History:
- *
- * 2002-03-13   Tomas Kasparek  initial release - based on h3600-uda1341.c from OSS
- * 2002-03-20   Tomas Kasparek  playback over ALSA is working
- * 2002-03-28   Tomas Kasparek  playback over OSS emulation is working
- * 2002-03-29   Tomas Kasparek  basic capture is working (native ALSA)
- * 2002-03-29   Tomas Kasparek  capture is working (OSS emulation)
- * 2002-04-04   Tomas Kasparek  better rates handling (allow non-standard rates)
- * 2003-02-14   Brian Avery     fixed full duplex mode, other updates
- * 2003-02-20   Tomas Kasparek  merged updates by Brian (except HAL)
- * 2003-04-19   Jaroslav Kysela recoded DMA stuff to follow 2.4.18rmk3-hh24 kernel
- *                              working suspend and resume
- * 2003-04-28   Tomas Kasparek  updated work by Jaroslav to compile it under 2.5.x again
- *                              merged HAL layer (patches from Brian)
- */
-
-/***************************************************************************************************
-*
-* To understand what Alsa Drivers should be doing look at "Writing an Alsa Driver" by Takashi Iwai
-* available in the Alsa doc section on the website             
-* 
-* A few notes to make things clearer. The UDA1341 is hooked up to Serial port 4 on the SA1100.
-* We are using  SSP mode to talk to the UDA1341. The UDA1341 bit & wordselect clocks are generated
-* by this UART. Unfortunately, the clock only runs if the transmit buffer has something in it.
-* So, if we are just recording, we feed the transmit DMA stream a bunch of 0x0000 so that the
-* transmit buffer is full and the clock keeps going. The zeroes come from FLUSH_BASE_PHYS which
-* is a mem loc that always decodes to 0's w/ no off chip access.
-*
-* Some alsa terminology:
-*      frame => num_channels * sample_size  e.g stereo 16 bit is 2 * 16 = 32 bytes
-*      period => the least number of bytes that will generate an interrupt e.g. we have a 1024 byte
-*             buffer and 4 periods in the runtime structure this means we'll get an int every 256
-*             bytes or 4 times per buffer.
-*             A number of the sizes are in frames rather than bytes, use frames_to_bytes and
-*             bytes_to_frames to convert.  The easiest way to tell the units is to look at the
-*             type i.e. runtime-> buffer_size is in frames and its type is snd_pcm_uframes_t
-*             
-*      Notes about the pointer fxn:
-*      The pointer fxn needs to return the offset into the dma buffer in frames.
-*      Interrupts must be blocked before calling the dma_get_pos fxn to avoid race with interrupts.
-*
-*      Notes about pause/resume
-*      Implementing this would be complicated so it's skipped.  The problem case is:
-*      A full duplex connection is going, then play is paused. At this point you need to start xmitting
-*      0's to keep the record active which means you cant just freeze the dma and resume it later you'd
-*      need to save off the dma info, and restore it properly on a resume.  Yeach!
-*
-*      Notes about transfer methods:
-*      The async write calls fail.  I probably need to implement something else to support them?
-* 
-***************************************************************************************************/
-
-#include <linux/module.h>
-#include <linux/moduleparam.h>
-#include <linux/init.h>
-#include <linux/err.h>
-#include <linux/platform_device.h>
-#include <linux/errno.h>
-#include <linux/ioctl.h>
-#include <linux/delay.h>
-#include <linux/slab.h>
-
-#ifdef CONFIG_PM
-#include <linux/pm.h>
-#endif
-
-#include <mach/hardware.h>
-#include <mach/h3600.h>
-#include <asm/mach-types.h>
-#include <asm/dma.h>
-
-#include <sound/core.h>
-#include <sound/pcm.h>
-#include <sound/initval.h>
-
-#include <linux/l3/l3.h>
-
-#undef DEBUG_MODE
-#undef DEBUG_FUNCTION_NAMES
-#include <sound/uda1341.h>
-
-/*
- * FIXME: Is this enough as autodetection of 2.4.X-rmkY-hhZ kernels?
- * We use DMA stuff from 2.4.18-rmk3-hh24 here to be able to compile this
- * module for Familiar 0.6.1
- */
-
-/* {{{ Type definitions */
-
-MODULE_AUTHOR("Tomas Kasparek <tomas.kasparek@seznam.cz>");
-MODULE_LICENSE("GPL");
-MODULE_DESCRIPTION("SA1100/SA1111 + UDA1341TS driver for ALSA");
-MODULE_SUPPORTED_DEVICE("{{UDA1341,iPAQ H3600 UDA1341TS}}");
-
-static char *id;       /* ID for this card */
-
-module_param(id, charp, 0444);
-MODULE_PARM_DESC(id, "ID string for SA1100/SA1111 + UDA1341TS soundcard.");
-
-struct audio_stream {
-       char *id;               /* identification string */
-       int stream_id;          /* numeric identification */    
-       dma_device_t dma_dev;   /* device identifier for DMA */
-#ifdef HH_VERSION
-       dmach_t dmach;          /* dma channel identification */
-#else
-       dma_regs_t *dma_regs;   /* points to our DMA registers */
-#endif
-       unsigned int active:1;  /* we are using this stream for transfer now */
-       int period;             /* current transfer period */
-       int periods;            /* current count of periods registerd in the DMA engine */
-       int tx_spin;            /* are we recoding - flag used to do DMA trans. for sync */
-       unsigned int old_offset;
-       spinlock_t dma_lock;    /* for locking in DMA operations (see dma-sa1100.c in the kernel) */
-       struct snd_pcm_substream *stream;
-};
-
-struct sa11xx_uda1341 {
-       struct snd_card *card;
-       struct l3_client *uda1341;
-       struct snd_pcm *pcm;
-       long samplerate;
-       struct audio_stream s[2];       /* playback & capture */
-};
-
-static unsigned int rates[] = {
-       8000,  10666, 10985, 14647,
-       16000, 21970, 22050, 24000,
-       29400, 32000, 44100, 48000,
-};
-
-static struct snd_pcm_hw_constraint_list hw_constraints_rates = {
-       .count  = ARRAY_SIZE(rates),
-       .list   = rates,
-       .mask   = 0,
-};
-
-static struct platform_device *device;
-
-/* }}} */
-
-/* {{{ Clock and sample rate stuff */
-
-/*
- * Stop-gap solution until rest of hh.org HAL stuff is merged.
- */
-#define GPIO_H3600_CLK_SET0            GPIO_GPIO (12)
-#define GPIO_H3600_CLK_SET1            GPIO_GPIO (13)
-
-#ifdef CONFIG_SA1100_H3XXX
-#define        clr_sa11xx_uda1341_egpio(x)     clr_h3600_egpio(x)
-#define set_sa11xx_uda1341_egpio(x)    set_h3600_egpio(x)
-#else
-#error This driver could serve H3x00 handhelds only!
-#endif
-
-static void sa11xx_uda1341_set_audio_clock(long val)
-{
-       switch (val) {
-       case 24000: case 32000: case 48000:     /* 00: 12.288 MHz */
-               GPCR = GPIO_H3600_CLK_SET0 | GPIO_H3600_CLK_SET1;
-               break;
-
-       case 22050: case 29400: case 44100:     /* 01: 11.2896 MHz */
-               GPSR = GPIO_H3600_CLK_SET0;
-               GPCR = GPIO_H3600_CLK_SET1;
-               break;
-
-       case 8000: case 10666: case 16000:      /* 10: 4.096 MHz */
-               GPCR = GPIO_H3600_CLK_SET0;
-               GPSR = GPIO_H3600_CLK_SET1;
-               break;
-
-       case 10985: case 14647: case 21970:     /* 11: 5.6245 MHz */
-               GPSR = GPIO_H3600_CLK_SET0 | GPIO_H3600_CLK_SET1;
-               break;
-       }
-}
-
-static void sa11xx_uda1341_set_samplerate(struct sa11xx_uda1341 *sa11xx_uda1341, long rate)
-{
-       int clk_div = 0;
-       int clk=0;
-
-       /* We don't want to mess with clocks when frames are in flight */
-       Ser4SSCR0 &= ~SSCR0_SSE;
-       /* wait for any frame to complete */
-       udelay(125);
-
-       /*
-        * We have the following clock sources:
-        * 4.096 MHz, 5.6245 MHz, 11.2896 MHz, 12.288 MHz
-        * Those can be divided either by 256, 384 or 512.
-        * This makes up 12 combinations for the following samplerates...
-        */
-       if (rate >= 48000)
-               rate = 48000;
-       else if (rate >= 44100)
-               rate = 44100;
-       else if (rate >= 32000)
-               rate = 32000;
-       else if (rate >= 29400)
-               rate = 29400;
-       else if (rate >= 24000)
-               rate = 24000;
-       else if (rate >= 22050)
-               rate = 22050;
-       else if (rate >= 21970)
-               rate = 21970;
-       else if (rate >= 16000)
-               rate = 16000;
-       else if (rate >= 14647)
-               rate = 14647;
-       else if (rate >= 10985)
-               rate = 10985;
-       else if (rate >= 10666)
-               rate = 10666;
-       else
-               rate = 8000;
-
-       /* Set the external clock generator */
-       
-       sa11xx_uda1341_set_audio_clock(rate);
-
-       /* Select the clock divisor */
-       switch (rate) {
-       case 8000:
-       case 10985:
-       case 22050:
-       case 24000:
-               clk = F512;
-               clk_div = SSCR0_SerClkDiv(16);
-               break;
-       case 16000:
-       case 21970:
-       case 44100:
-       case 48000:
-               clk = F256;
-               clk_div = SSCR0_SerClkDiv(8);
-               break;
-       case 10666:
-       case 14647:
-       case 29400:
-       case 32000:
-               clk = F384;
-               clk_div = SSCR0_SerClkDiv(12);
-               break;
-       }
-
-       /* FMT setting should be moved away when other FMTs are added (FIXME) */
-       l3_command(sa11xx_uda1341->uda1341, CMD_FORMAT, (void *)LSB16);
-       
-       l3_command(sa11xx_uda1341->uda1341, CMD_FS, (void *)clk);        
-       Ser4SSCR0 = (Ser4SSCR0 & ~0xff00) + clk_div + SSCR0_SSE;
-       sa11xx_uda1341->samplerate = rate;
-}
-
-/* }}} */
-
-/* {{{ HW init and shutdown */
-
-static void sa11xx_uda1341_audio_init(struct sa11xx_uda1341 *sa11xx_uda1341)
-{
-       unsigned long flags;
-
-       /* Setup DMA stuff */
-       sa11xx_uda1341->s[SNDRV_PCM_STREAM_PLAYBACK].id = "UDA1341 out";
-       sa11xx_uda1341->s[SNDRV_PCM_STREAM_PLAYBACK].stream_id = SNDRV_PCM_STREAM_PLAYBACK;
-       sa11xx_uda1341->s[SNDRV_PCM_STREAM_PLAYBACK].dma_dev = DMA_Ser4SSPWr;
-
-       sa11xx_uda1341->s[SNDRV_PCM_STREAM_CAPTURE].id = "UDA1341 in";
-       sa11xx_uda1341->s[SNDRV_PCM_STREAM_CAPTURE].stream_id = SNDRV_PCM_STREAM_CAPTURE;
-       sa11xx_uda1341->s[SNDRV_PCM_STREAM_CAPTURE].dma_dev = DMA_Ser4SSPRd;
-
-       /* Initialize the UDA1341 internal state */
-       
-       /* Setup the uarts */
-       local_irq_save(flags);
-       GAFR |= (GPIO_SSP_CLK);
-       GPDR &= ~(GPIO_SSP_CLK);
-       Ser4SSCR0 = 0;
-       Ser4SSCR0 = SSCR0_DataSize(16) + SSCR0_TI + SSCR0_SerClkDiv(8);
-       Ser4SSCR1 = SSCR1_SClkIactL + SSCR1_SClk1P + SSCR1_ExtClk;
-       Ser4SSCR0 |= SSCR0_SSE;
-       local_irq_restore(flags);
-
-       /* Enable the audio power */
-
-       clr_sa11xx_uda1341_egpio(IPAQ_EGPIO_CODEC_NRESET);
-       set_sa11xx_uda1341_egpio(IPAQ_EGPIO_AUDIO_ON);
-       set_sa11xx_uda1341_egpio(IPAQ_EGPIO_QMUTE);
-       /* Wait for the UDA1341 to wake up */
-       mdelay(1); //FIXME - was removed by Perex - Why?
-
-       /* Initialize the UDA1341 internal state */
-       l3_open(sa11xx_uda1341->uda1341);
-       
-       /* external clock configuration (after l3_open - regs must be initialized */
-       sa11xx_uda1341_set_samplerate(sa11xx_uda1341, sa11xx_uda1341->samplerate);
-
-       /* Wait for the UDA1341 to wake up */
-       set_sa11xx_uda1341_egpio(IPAQ_EGPIO_CODEC_NRESET);
-       mdelay(1);      
-
-       /* make the left and right channels unswapped (flip the WS latch) */
-       Ser4SSDR = 0;
-
-       clr_sa11xx_uda1341_egpio(IPAQ_EGPIO_QMUTE);
-}
-
-static void sa11xx_uda1341_audio_shutdown(struct sa11xx_uda1341 *sa11xx_uda1341)
-{
-       /* mute on */
-       set_sa11xx_uda1341_egpio(IPAQ_EGPIO_QMUTE);
-       
-       /* disable the audio power and all signals leading to the audio chip */
-       l3_close(sa11xx_uda1341->uda1341);
-       Ser4SSCR0 = 0;
-       clr_sa11xx_uda1341_egpio(IPAQ_EGPIO_CODEC_NRESET);
-
-       /* power off and mute off */
-       /* FIXME - is muting off necesary??? */
-
-       clr_sa11xx_uda1341_egpio(IPAQ_EGPIO_AUDIO_ON);
-       clr_sa11xx_uda1341_egpio(IPAQ_EGPIO_QMUTE);
-}
-
-/* }}} */
-
-/* {{{ DMA staff */
-
-/*
- * these are the address and sizes used to fill the xmit buffer
- * so we can get a clock in record only mode
- */
-#define FORCE_CLOCK_ADDR               (dma_addr_t)FLUSH_BASE_PHYS
-#define FORCE_CLOCK_SIZE               4096 // was 2048
-
-// FIXME Why this value exactly - wrote comment
-#define DMA_BUF_SIZE   8176    /* <= MAX_DMA_SIZE from asm/arch-sa1100/dma.h */
-
-#ifdef HH_VERSION
-
-static int audio_dma_request(struct audio_stream *s, void (*callback)(void *, int))
-{
-       int ret;
-
-       ret = sa1100_request_dma(&s->dmach, s->id, s->dma_dev);
-       if (ret < 0) {
-               printk(KERN_ERR "unable to grab audio dma 0x%x\n", s->dma_dev);
-               return ret;
-       }
-       sa1100_dma_set_callback(s->dmach, callback);
-       return 0;
-}
-
-static inline void audio_dma_free(struct audio_stream *s)
-{
-       sa1100_free_dma(s->dmach);
-       s->dmach = -1;
-}
-
-#else
-
-static int audio_dma_request(struct audio_stream *s, void (*callback)(void *))
-{
-       int ret;
-
-       ret = sa1100_request_dma(s->dma_dev, s->id, callback, s, &s->dma_regs);
-       if (ret < 0)
-               printk(KERN_ERR "unable to grab audio dma 0x%x\n", s->dma_dev);
-       return ret;
-}
-
-static void audio_dma_free(struct audio_stream *s)
-{
-       sa1100_free_dma(s->dma_regs);
-       s->dma_regs = 0;
-}
-
-#endif
-
-static u_int audio_get_dma_pos(struct audio_stream *s)
-{
-       struct snd_pcm_substream *substream = s->stream;
-       struct snd_pcm_runtime *runtime = substream->runtime;
-       unsigned int offset;
-       unsigned long flags;
-       dma_addr_t addr;
-       
-       // this must be called w/ interrupts locked out see dma-sa1100.c in the kernel
-       spin_lock_irqsave(&s->dma_lock, flags);
-#ifdef HH_VERSION      
-       sa1100_dma_get_current(s->dmach, NULL, &addr);
-#else
-       addr = sa1100_get_dma_pos((s)->dma_regs);
-#endif
-       offset = addr - runtime->dma_addr;
-       spin_unlock_irqrestore(&s->dma_lock, flags);
-       
-       offset = bytes_to_frames(runtime,offset);
-       if (offset >= runtime->buffer_size)
-               offset = 0;
-
-       return offset;
-}
-
-/*
- * this stops the dma and clears the dma ptrs
- */
-static void audio_stop_dma(struct audio_stream *s)
-{
-       unsigned long flags;
-
-       spin_lock_irqsave(&s->dma_lock, flags); 
-       s->active = 0;
-       s->period = 0;
-       /* this stops the dma channel and clears the buffer ptrs */
-#ifdef HH_VERSION
-       sa1100_dma_flush_all(s->dmach);
-#else
-       sa1100_clear_dma(s->dma_regs);  
-#endif
-       spin_unlock_irqrestore(&s->dma_lock, flags);
-}
-
-static void audio_process_dma(struct audio_stream *s)
-{
-       struct snd_pcm_substream *substream = s->stream;
-       struct snd_pcm_runtime *runtime;
-       unsigned int dma_size;          
-       unsigned int offset;
-       int ret;
-                
-       /* we are requested to process synchronization DMA transfer */
-       if (s->tx_spin) {
-               if (snd_BUG_ON(s->stream_id != SNDRV_PCM_STREAM_PLAYBACK))
-                       return;
-               /* fill the xmit dma buffers and return */
-#ifdef HH_VERSION
-               sa1100_dma_set_spin(s->dmach, FORCE_CLOCK_ADDR, FORCE_CLOCK_SIZE);
-#else
-               while (1) {
-                       ret = sa1100_start_dma(s->dma_regs, FORCE_CLOCK_ADDR, FORCE_CLOCK_SIZE);
-                       if (ret)
-                               return;   
-               }
-#endif
-               return;
-       }
-
-       /* must be set here - only valid for running streams, not for forced_clock dma fills  */
-       runtime = substream->runtime;
-       while (s->active && s->periods < runtime->periods) {
-               dma_size = frames_to_bytes(runtime, runtime->period_size);
-               if (s->old_offset) {
-                       /* a little trick, we need resume from old position */
-                       offset = frames_to_bytes(runtime, s->old_offset - 1);
-                       s->old_offset = 0;
-                       s->periods = 0;
-                       s->period = offset / dma_size;
-                       offset %= dma_size;
-                       dma_size = dma_size - offset;
-                       if (!dma_size)
-                               continue;               /* special case */
-               } else {
-                       offset = dma_size * s->period;
-                       snd_BUG_ON(dma_size > DMA_BUF_SIZE);
-               }
-#ifdef HH_VERSION
-               ret = sa1100_dma_queue_buffer(s->dmach, s, runtime->dma_addr + offset, dma_size);
-               if (ret)
-                       return; //FIXME
-#else
-               ret = sa1100_start_dma((s)->dma_regs, runtime->dma_addr + offset, dma_size);
-               if (ret) {
-                       printk(KERN_ERR "audio_process_dma: cannot queue DMA buffer (%i)\n", ret);
-                       return;
-               }
-#endif
-
-               s->period++;
-               s->period %= runtime->periods;
-               s->periods++;
-       }
-}
-
-#ifdef HH_VERSION
-static void audio_dma_callback(void *data, int size)
-#else
-static void audio_dma_callback(void *data)
-#endif
-{
-       struct audio_stream *s = data;
-        
-       /* 
-        * If we are getting a callback for an active stream then we inform
-        * the PCM middle layer we've finished a period
-        */
-       if (s->active)
-               snd_pcm_period_elapsed(s->stream);
-
-       spin_lock(&s->dma_lock);
-       if (!s->tx_spin && s->periods > 0)
-               s->periods--;
-       audio_process_dma(s);
-       spin_unlock(&s->dma_lock);
-}
-
-/* }}} */
-
-/* {{{ PCM setting */
-
-/* {{{ trigger & timer */
-
-static int snd_sa11xx_uda1341_trigger(struct snd_pcm_substream *substream, int cmd)
-{
-       struct sa11xx_uda1341 *chip = snd_pcm_substream_chip(substream);
-       int stream_id = substream->pstr->stream;
-       struct audio_stream *s = &chip->s[stream_id];
-       struct audio_stream *s1 = &chip->s[stream_id ^ 1];
-       int err = 0;
-
-       /* note local interrupts are already disabled in the midlevel code */
-       spin_lock(&s->dma_lock);
-       switch (cmd) {
-       case SNDRV_PCM_TRIGGER_START:
-               /* now we need to make sure a record only stream has a clock */
-               if (stream_id == SNDRV_PCM_STREAM_CAPTURE && !s1->active) {
-                       /* we need to force fill the xmit DMA with zeros */
-                       s1->tx_spin = 1;
-                       audio_process_dma(s1);
-               }
-               /* this case is when you were recording then you turn on a
-                * playback stream so we stop (also clears it) the dma first,
-                * clear the sync flag and then we let it turned on
-                */             
-               else {
-                       s->tx_spin = 0;
-               }
-
-               /* requested stream startup */
-               s->active = 1;
-               audio_process_dma(s);
-               break;
-       case SNDRV_PCM_TRIGGER_STOP:
-               /* requested stream shutdown */
-               audio_stop_dma(s);
-               
-               /*
-                * now we need to make sure a record only stream has a clock
-                * so if we're stopping a playback with an active capture
-                * we need to turn the 0 fill dma on for the xmit side
-                */
-               if (stream_id == SNDRV_PCM_STREAM_PLAYBACK && s1->active) {
-                       /* we need to force fill the xmit DMA with zeros */
-                       s->tx_spin = 1;
-                       audio_process_dma(s);
-               }
-               /*
-                * we killed a capture only stream, so we should also kill
-                * the zero fill transmit
-                */
-               else {
-                       if (s1->tx_spin) {
-                               s1->tx_spin = 0;
-                               audio_stop_dma(s1);
-                       }
-               }
-               
-               break;
-       case SNDRV_PCM_TRIGGER_SUSPEND:
-               s->active = 0;
-#ifdef HH_VERSION              
-               sa1100_dma_stop(s->dmach);
-#else
-               //FIXME - DMA API
-#endif         
-               s->old_offset = audio_get_dma_pos(s) + 1;
-#ifdef HH_VERSION              
-               sa1100_dma_flush_all(s->dmach);
-#else
-               //FIXME - DMA API
-#endif         
-               s->periods = 0;
-               break;
-       case SNDRV_PCM_TRIGGER_RESUME:
-               s->active = 1;
-               s->tx_spin = 0;
-               audio_process_dma(s);
-               if (stream_id == SNDRV_PCM_STREAM_CAPTURE && !s1->active) {
-                       s1->tx_spin = 1;
-                       audio_process_dma(s1);
-               }
-               break;
-       case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
-#ifdef HH_VERSION              
-               sa1100_dma_stop(s->dmach);
-#else
-               //FIXME - DMA API
-#endif
-               s->active = 0;
-               if (stream_id == SNDRV_PCM_STREAM_PLAYBACK) {
-                       if (s1->active) {
-                               s->tx_spin = 1;
-                               s->old_offset = audio_get_dma_pos(s) + 1;
-#ifdef HH_VERSION                              
-                               sa1100_dma_flush_all(s->dmach);
-#else
-                               //FIXME - DMA API
-#endif                         
-                               audio_process_dma(s);
-                       }
-               } else {
-                       if (s1->tx_spin) {
-                               s1->tx_spin = 0;
-#ifdef HH_VERSION                              
-                               sa1100_dma_flush_all(s1->dmach);
-#else
-                               //FIXME - DMA API
-#endif                         
-                       }
-               }
-               break;
-       case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
-               s->active = 1;
-               if (s->old_offset) {
-                       s->tx_spin = 0;
-                       audio_process_dma(s);
-                       break;
-               }
-               if (stream_id == SNDRV_PCM_STREAM_CAPTURE && !s1->active) {
-                       s1->tx_spin = 1;
-                       audio_process_dma(s1);
-               }
-#ifdef HH_VERSION              
-               sa1100_dma_resume(s->dmach);
-#else
-               //FIXME - DMA API
-#endif
-               break;
-       default:
-               err = -EINVAL;
-               break;
-       }
-       spin_unlock(&s->dma_lock);      
-       return err;
-}
-
-static int snd_sa11xx_uda1341_prepare(struct snd_pcm_substream *substream)
-{
-       struct sa11xx_uda1341 *chip = snd_pcm_substream_chip(substream);
-       struct snd_pcm_runtime *runtime = substream->runtime;
-       struct audio_stream *s = &chip->s[substream->pstr->stream];
-        
-       /* set requested samplerate */
-       sa11xx_uda1341_set_samplerate(chip, runtime->rate);
-
-       /* set requestd format when available */
-       /* set FMT here !!! FIXME */
-
-       s->period = 0;
-       s->periods = 0;
-        
-       return 0;
-}
-
-static snd_pcm_uframes_t snd_sa11xx_uda1341_pointer(struct snd_pcm_substream *substream)
-{
-       struct sa11xx_uda1341 *chip = snd_pcm_substream_chip(substream);
-       return audio_get_dma_pos(&chip->s[substream->pstr->stream]);
-}
-
-/* }}} */
-
-static struct snd_pcm_hardware snd_sa11xx_uda1341_capture =
-{
-       .info                   = (SNDRV_PCM_INFO_INTERLEAVED |
-                                  SNDRV_PCM_INFO_BLOCK_TRANSFER |
-                                  SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID |
-                                  SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME),
-       .formats                = SNDRV_PCM_FMTBIT_S16_LE,
-       .rates                  = (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 |\
-                                  SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_32000 |\
-                                  SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 |\
-                                  SNDRV_PCM_RATE_KNOT),
-       .rate_min               = 8000,
-       .rate_max               = 48000,
-       .channels_min           = 2,
-       .channels_max           = 2,
-       .buffer_bytes_max       = 64*1024,
-       .period_bytes_min       = 64,
-       .period_bytes_max       = DMA_BUF_SIZE,
-       .periods_min            = 2,
-       .periods_max            = 255,
-       .fifo_size              = 0,
-};
-
-static struct snd_pcm_hardware snd_sa11xx_uda1341_playback =
-{
-       .info                   = (SNDRV_PCM_INFO_INTERLEAVED |
-                                  SNDRV_PCM_INFO_BLOCK_TRANSFER |
-                                  SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_MMAP_VALID |
-                                  SNDRV_PCM_INFO_PAUSE | SNDRV_PCM_INFO_RESUME),
-       .formats                = SNDRV_PCM_FMTBIT_S16_LE,
-       .rates                  = (SNDRV_PCM_RATE_8000 | SNDRV_PCM_RATE_16000 |\
-                                   SNDRV_PCM_RATE_22050 | SNDRV_PCM_RATE_32000 |\
-                                  SNDRV_PCM_RATE_44100 | SNDRV_PCM_RATE_48000 |\
-                                  SNDRV_PCM_RATE_KNOT),
-       .rate_min               = 8000,
-       .rate_max               = 48000,
-       .channels_min           = 2,
-       .channels_max           = 2,
-       .buffer_bytes_max       = 64*1024,
-       .period_bytes_min       = 64,
-       .period_bytes_max       = DMA_BUF_SIZE,
-       .periods_min            = 2,
-       .periods_max            = 255,
-       .fifo_size              = 0,
-};
-
-static int snd_card_sa11xx_uda1341_open(struct snd_pcm_substream *substream)
-{
-       struct sa11xx_uda1341 *chip = snd_pcm_substream_chip(substream);
-       struct snd_pcm_runtime *runtime = substream->runtime;
-       int stream_id = substream->pstr->stream;
-       int err;
-
-       chip->s[stream_id].stream = substream;
-
-       if (stream_id == SNDRV_PCM_STREAM_PLAYBACK)
-               runtime->hw = snd_sa11xx_uda1341_playback;
-       else
-               runtime->hw = snd_sa11xx_uda1341_capture;
-       if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0)
-               return err;
-       if ((err = snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &hw_constraints_rates)) < 0)
-               return err;
-        
-       return 0;
-}
-
-static int snd_card_sa11xx_uda1341_close(struct snd_pcm_substream *substream)
-{
-       struct sa11xx_uda1341 *chip = snd_pcm_substream_chip(substream);
-
-       chip->s[substream->pstr->stream].stream = NULL;
-       return 0;
-}
-
-/* {{{ HW params & free */
-
-static int snd_sa11xx_uda1341_hw_params(struct snd_pcm_substream *substream,
-                                       struct snd_pcm_hw_params *hw_params)
-{
-        
-       return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));
-}
-
-static int snd_sa11xx_uda1341_hw_free(struct snd_pcm_substream *substream)
-{
-       return snd_pcm_lib_free_pages(substream);
-}
-
-/* }}} */
-
-static struct snd_pcm_ops snd_card_sa11xx_uda1341_playback_ops = {
-       .open                   = snd_card_sa11xx_uda1341_open,
-       .close                  = snd_card_sa11xx_uda1341_close,
-       .ioctl                  = snd_pcm_lib_ioctl,
-       .hw_params              = snd_sa11xx_uda1341_hw_params,
-       .hw_free                = snd_sa11xx_uda1341_hw_free,
-       .prepare                = snd_sa11xx_uda1341_prepare,
-       .trigger                = snd_sa11xx_uda1341_trigger,
-       .pointer                = snd_sa11xx_uda1341_pointer,
-};
-
-static struct snd_pcm_ops snd_card_sa11xx_uda1341_capture_ops = {
-       .open                   = snd_card_sa11xx_uda1341_open,
-       .close                  = snd_card_sa11xx_uda1341_close,
-       .ioctl                  = snd_pcm_lib_ioctl,
-       .hw_params              = snd_sa11xx_uda1341_hw_params,
-       .hw_free                = snd_sa11xx_uda1341_hw_free,
-       .prepare                = snd_sa11xx_uda1341_prepare,
-       .trigger                = snd_sa11xx_uda1341_trigger,
-       .pointer                = snd_sa11xx_uda1341_pointer,
-};
-
-static int __init snd_card_sa11xx_uda1341_pcm(struct sa11xx_uda1341 *sa11xx_uda1341, int device)
-{
-       struct snd_pcm *pcm;
-       int err;
-
-       if ((err = snd_pcm_new(sa11xx_uda1341->card, "UDA1341 PCM", device, 1, 1, &pcm)) < 0)
-               return err;
-
-       /*
-        * this sets up our initial buffers and sets the dma_type to isa.
-        * isa works but I'm not sure why (or if) it's the right choice
-        * this may be too large, trying it for now
-        */
-       snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, 
-                                             snd_dma_isa_data(),
-                                             64*1024, 64*1024);
-
-       snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_card_sa11xx_uda1341_playback_ops);
-       snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_card_sa11xx_uda1341_capture_ops);
-       pcm->private_data = sa11xx_uda1341;
-       pcm->info_flags = 0;
-       strcpy(pcm->name, "UDA1341 PCM");
-
-       sa11xx_uda1341_audio_init(sa11xx_uda1341);
-
-       /* setup DMA controller */
-       audio_dma_request(&sa11xx_uda1341->s[SNDRV_PCM_STREAM_PLAYBACK], audio_dma_callback);
-       audio_dma_request(&sa11xx_uda1341->s[SNDRV_PCM_STREAM_CAPTURE], audio_dma_callback);
-
-       sa11xx_uda1341->pcm = pcm;
-
-       return 0;
-}
-
-/* }}} */
-
-/* {{{ module init & exit */
-
-#ifdef CONFIG_PM
-
-static int snd_sa11xx_uda1341_suspend(struct platform_device *devptr,
-                                     pm_message_t state)
-{
-       struct snd_card *card = platform_get_drvdata(devptr);
-       struct sa11xx_uda1341 *chip = card->private_data;
-
-       snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
-       snd_pcm_suspend_all(chip->pcm);
-#ifdef HH_VERSION
-       sa1100_dma_sleep(chip->s[SNDRV_PCM_STREAM_PLAYBACK].dmach);
-       sa1100_dma_sleep(chip->s[SNDRV_PCM_STREAM_CAPTURE].dmach);
-#else
-       //FIXME
-#endif
-       l3_command(chip->uda1341, CMD_SUSPEND, NULL);
-       sa11xx_uda1341_audio_shutdown(chip);
-
-       return 0;
-}
-
-static int snd_sa11xx_uda1341_resume(struct platform_device *devptr)
-{
-       struct snd_card *card = platform_get_drvdata(devptr);
-       struct sa11xx_uda1341 *chip = card->private_data;
-
-       sa11xx_uda1341_audio_init(chip);
-       l3_command(chip->uda1341, CMD_RESUME, NULL);
-#ifdef HH_VERSION      
-       sa1100_dma_wakeup(chip->s[SNDRV_PCM_STREAM_PLAYBACK].dmach);
-       sa1100_dma_wakeup(chip->s[SNDRV_PCM_STREAM_CAPTURE].dmach);
-#else
-       //FIXME
-#endif
-       snd_power_change_state(card, SNDRV_CTL_POWER_D0);
-       return 0;
-}
-#endif /* COMFIG_PM */
-
-void snd_sa11xx_uda1341_free(struct snd_card *card)
-{
-       struct sa11xx_uda1341 *chip = card->private_data;
-
-       audio_dma_free(&chip->s[SNDRV_PCM_STREAM_PLAYBACK]);
-       audio_dma_free(&chip->s[SNDRV_PCM_STREAM_CAPTURE]);
-}
-
-static int __devinit sa11xx_uda1341_probe(struct platform_device *devptr)
-{
-       int err;
-       struct snd_card *card;
-       struct sa11xx_uda1341 *chip;
-
-       /* register the soundcard */
-       card = snd_card_new(-1, id, THIS_MODULE, sizeof(struct sa11xx_uda1341));
-       if (card == NULL)
-               return -ENOMEM;
-
-       chip = card->private_data;
-       spin_lock_init(&chip->s[0].dma_lock);
-       spin_lock_init(&chip->s[1].dma_lock);
-
-       card->private_free = snd_sa11xx_uda1341_free;
-       chip->card = card;
-       chip->samplerate = AUDIO_RATE_DEFAULT;
-
-       // mixer
-       if ((err = snd_chip_uda1341_mixer_new(card, &chip->uda1341)))
-               goto nodev;
-
-       // PCM
-       if ((err = snd_card_sa11xx_uda1341_pcm(chip, 0)) < 0)
-               goto nodev;
-        
-       strcpy(card->driver, "UDA1341");
-       strcpy(card->shortname, "H3600 UDA1341TS");
-       sprintf(card->longname, "Compaq iPAQ H3600 with Philips UDA1341TS");
-        
-       snd_card_set_dev(card, &devptr->dev);
-
-       if ((err = snd_card_register(card)) == 0) {
-               printk( KERN_INFO "iPAQ audio support initialized\n" );
-               platform_set_drvdata(devptr, card);
-               return 0;
-       }
-        
- nodev:
-       snd_card_free(card);
-       return err;
-}
-
-static int __devexit sa11xx_uda1341_remove(struct platform_device *devptr)
-{
-       snd_card_free(platform_get_drvdata(devptr));
-       platform_set_drvdata(devptr, NULL);
-       return 0;
-}
-
-#define SA11XX_UDA1341_DRIVER  "sa11xx_uda1341"
-
-static struct platform_driver sa11xx_uda1341_driver = {
-       .probe          = sa11xx_uda1341_probe,
-       .remove         = __devexit_p(sa11xx_uda1341_remove),
-#ifdef CONFIG_PM
-       .suspend        = snd_sa11xx_uda1341_suspend,
-       .resume         = snd_sa11xx_uda1341_resume,
-#endif
-       .driver         = {
-               .name   = SA11XX_UDA1341_DRIVER,
-       },
-};
-
-static int __init sa11xx_uda1341_init(void)
-{
-       int err;
-
-       if (!machine_is_h3xxx())
-               return -ENODEV;
-       if ((err = platform_driver_register(&sa11xx_uda1341_driver)) < 0)
-               return err;
-       device = platform_device_register_simple(SA11XX_UDA1341_DRIVER, -1, NULL, 0);
-       if (!IS_ERR(device)) {
-               if (platform_get_drvdata(device))
-                       return 0;
-               platform_device_unregister(device);
-               err = -ENODEV;
-       } else
-               err = PTR_ERR(device);
-       platform_driver_unregister(&sa11xx_uda1341_driver);
-       return err;
-}
-
-static void __exit sa11xx_uda1341_exit(void)
-{
-       platform_device_unregister(device);
-       platform_driver_unregister(&sa11xx_uda1341_driver);
-}
-
-module_init(sa11xx_uda1341_init);
-module_exit(sa11xx_uda1341_exit);
-
-/* }}} */
-
-/*
- * Local variables:
- * indent-tabs-mode: t
- * End:
- */
diff --git a/sound/atmel/Kconfig b/sound/atmel/Kconfig
new file mode 100644 (file)
index 0000000..6c228a9
--- /dev/null
@@ -0,0 +1,19 @@
+menu "Atmel devices (AVR32 and AT91)"
+       depends on AVR32 || ARCH_AT91
+
+config SND_ATMEL_ABDAC
+       tristate "Atmel Audio Bitstream DAC (ABDAC) driver"
+       select SND_PCM
+       depends on DW_DMAC && AVR32
+       help
+         ALSA sound driver for the Atmel Audio Bitstream DAC (ABDAC).
+
+config SND_ATMEL_AC97C
+       tristate "Atmel AC97 Controller (AC97C) driver"
+       select SND_PCM
+       select SND_AC97_CODEC
+       depends on DW_DMAC && AVR32
+       help
+         ALSA sound driver for the Atmel AC97 controller.
+
+endmenu
diff --git a/sound/atmel/Makefile b/sound/atmel/Makefile
new file mode 100644 (file)
index 0000000..219dcfa
--- /dev/null
@@ -0,0 +1,5 @@
+snd-atmel-abdac-objs           := abdac.o
+snd-atmel-ac97c-objs           := ac97c.o
+
+obj-$(CONFIG_SND_ATMEL_ABDAC)  += snd-atmel-abdac.o
+obj-$(CONFIG_SND_ATMEL_AC97C)  += snd-atmel-ac97c.o
diff --git a/sound/atmel/abdac.c b/sound/atmel/abdac.c
new file mode 100644 (file)
index 0000000..28b3c7f
--- /dev/null
@@ -0,0 +1,602 @@
+/*
+ * Driver for the Atmel on-chip Audio Bitstream DAC (ABDAC)
+ *
+ * Copyright (C) 2006-2009 Atmel Corporation
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by
+ * the Free Software Foundation.
+ */
+#include <linux/clk.h>
+#include <linux/bitmap.h>
+#include <linux/dw_dmac.h>
+#include <linux/dmaengine.h>
+#include <linux/dma-mapping.h>
+#include <linux/init.h>
+#include <linux/interrupt.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/io.h>
+
+#include <sound/core.h>
+#include <sound/initval.h>
+#include <sound/pcm.h>
+#include <sound/pcm_params.h>
+#include <sound/atmel-abdac.h>
+
+/* DAC register offsets */
+#define DAC_DATA                                0x0000
+#define DAC_CTRL                                0x0008
+#define DAC_INT_MASK                            0x000c
+#define DAC_INT_EN                              0x0010
+#define DAC_INT_DIS                             0x0014
+#define DAC_INT_CLR                             0x0018
+#define DAC_INT_STATUS                          0x001c
+
+/* Bitfields in CTRL */
+#define DAC_SWAP_OFFSET                         30
+#define DAC_SWAP_SIZE                           1
+#define DAC_EN_OFFSET                           31
+#define DAC_EN_SIZE                             1
+
+/* Bitfields in INT_MASK/INT_EN/INT_DIS/INT_STATUS/INT_CLR */
+#define DAC_UNDERRUN_OFFSET                     28
+#define DAC_UNDERRUN_SIZE                       1
+#define DAC_TX_READY_OFFSET                     29
+#define DAC_TX_READY_SIZE                       1
+
+/* Bit manipulation macros */
+#define DAC_BIT(name)                                  \
+       (1 << DAC_##name##_OFFSET)
+#define DAC_BF(name, value)                            \
+       (((value) & ((1 << DAC_##name##_SIZE) - 1))     \
+        << DAC_##name##_OFFSET)
+#define DAC_BFEXT(name, value)                         \
+       (((value) >> DAC_##name##_OFFSET)               \
+        & ((1 << DAC_##name##_SIZE) - 1))
+#define DAC_BFINS(name, value, old)                    \
+       (((old) & ~(((1 << DAC_##name##_SIZE) - 1)      \
+                   << DAC_##name##_OFFSET))            \
+        | DAC_BF(name, value))
+
+/* Register access macros */
+#define dac_readl(port, reg)                           \
+       __raw_readl((port)->regs + DAC_##reg)
+#define dac_writel(port, reg, value)                   \
+       __raw_writel((value), (port)->regs + DAC_##reg)
+
+/*
+ * ABDAC supports a maximum of 6 different rates from a generic clock. The
+ * generic clock has a power of two divider, which gives 6 steps from 192 kHz
+ * to 5112 Hz.
+ */
+#define MAX_NUM_RATES  6
+/* ALSA seems to use rates between 192000 Hz and 5112 Hz. */
+#define RATE_MAX       192000
+#define RATE_MIN       5112
+
+enum {
+       DMA_READY = 0,
+};
+
+struct atmel_abdac_dma {
+       struct dma_chan         *chan;
+       struct dw_cyclic_desc   *cdesc;
+};
+
+struct atmel_abdac {
+       struct clk                              *pclk;
+       struct clk                              *sample_clk;
+       struct platform_device                  *pdev;
+       struct atmel_abdac_dma                  dma;
+
+       struct snd_pcm_hw_constraint_list       constraints_rates;
+       struct snd_pcm_substream                *substream;
+       struct snd_card                         *card;
+       struct snd_pcm                          *pcm;
+
+       void __iomem                            *regs;
+       unsigned long                           flags;
+       unsigned int                            rates[MAX_NUM_RATES];
+       unsigned int                            rates_num;
+       int                                     irq;
+};
+
+#define get_dac(card) ((struct atmel_abdac *)(card)->private_data)
+
+/* This function is called by the DMA driver. */
+static void atmel_abdac_dma_period_done(void *arg)
+{
+       struct atmel_abdac *dac = arg;
+       snd_pcm_period_elapsed(dac->substream);
+}
+
+static int atmel_abdac_prepare_dma(struct atmel_abdac *dac,
+               struct snd_pcm_substream *substream,
+               enum dma_data_direction direction)
+{
+       struct dma_chan                 *chan = dac->dma.chan;
+       struct dw_cyclic_desc           *cdesc;
+       struct snd_pcm_runtime          *runtime = substream->runtime;
+       unsigned long                   buffer_len, period_len;
+
+       /*
+        * We don't do DMA on "complex" transfers, i.e. with
+        * non-halfword-aligned buffers or lengths.
+        */
+       if (runtime->dma_addr & 1 || runtime->buffer_size & 1) {
+               dev_dbg(&dac->pdev->dev, "too complex transfer\n");
+               return -EINVAL;
+       }
+
+       buffer_len = frames_to_bytes(runtime, runtime->buffer_size);
+       period_len = frames_to_bytes(runtime, runtime->period_size);
+
+       cdesc = dw_dma_cyclic_prep(chan, runtime->dma_addr, buffer_len,
+                       period_len, DMA_TO_DEVICE);
+       if (IS_ERR(cdesc)) {
+               dev_dbg(&dac->pdev->dev, "could not prepare cyclic DMA\n");
+               return PTR_ERR(cdesc);
+       }
+
+       cdesc->period_callback = atmel_abdac_dma_period_done;
+       cdesc->period_callback_param = dac;
+
+       dac->dma.cdesc = cdesc;
+
+       set_bit(DMA_READY, &dac->flags);
+
+       return 0;
+}
+
+static struct snd_pcm_hardware atmel_abdac_hw = {
+       .info                   = (SNDRV_PCM_INFO_MMAP
+                                 | SNDRV_PCM_INFO_MMAP_VALID
+                                 | SNDRV_PCM_INFO_INTERLEAVED
+                                 | SNDRV_PCM_INFO_BLOCK_TRANSFER
+                                 | SNDRV_PCM_INFO_RESUME
+                                 | SNDRV_PCM_INFO_PAUSE),
+       .formats                = (SNDRV_PCM_FMTBIT_S16_BE),
+       .rates                  = (SNDRV_PCM_RATE_KNOT),
+       .rate_min               = RATE_MIN,
+       .rate_max               = RATE_MAX,
+       .channels_min           = 2,
+       .channels_max           = 2,
+       .buffer_bytes_max       = 64 * 4096,
+       .period_bytes_min       = 4096,
+       .period_bytes_max       = 4096,
+       .periods_min            = 4,
+       .periods_max            = 64,
+};
+
+static int atmel_abdac_open(struct snd_pcm_substream *substream)
+{
+       struct atmel_abdac *dac = snd_pcm_substream_chip(substream);
+
+       dac->substream = substream;
+       atmel_abdac_hw.rate_max = dac->rates[dac->rates_num - 1];
+       atmel_abdac_hw.rate_min = dac->rates[0];
+       substream->runtime->hw = atmel_abdac_hw;
+
+       return snd_pcm_hw_constraint_list(substream->runtime, 0,
+                       SNDRV_PCM_HW_PARAM_RATE, &dac->constraints_rates);
+}
+
+static int atmel_abdac_close(struct snd_pcm_substream *substream)
+{
+       struct atmel_abdac *dac = snd_pcm_substream_chip(substream);
+       dac->substream = NULL;
+       return 0;
+}
+
+static int atmel_abdac_hw_params(struct snd_pcm_substream *substream,
+               struct snd_pcm_hw_params *hw_params)
+{
+       struct atmel_abdac *dac = snd_pcm_substream_chip(substream);
+       int retval;
+
+       retval = snd_pcm_lib_malloc_pages(substream,
+                       params_buffer_bytes(hw_params));
+       if (retval < 0)
+               return retval;
+       /* snd_pcm_lib_malloc_pages returns 1 if buffer is changed. */
+       if (retval == 1)
+               if (test_and_clear_bit(DMA_READY, &dac->flags))
+                       dw_dma_cyclic_free(dac->dma.chan);
+
+       return retval;
+}
+
+static int atmel_abdac_hw_free(struct snd_pcm_substream *substream)
+{
+       struct atmel_abdac *dac = snd_pcm_substream_chip(substream);
+       if (test_and_clear_bit(DMA_READY, &dac->flags))
+               dw_dma_cyclic_free(dac->dma.chan);
+       return snd_pcm_lib_free_pages(substream);
+}
+
+static int atmel_abdac_prepare(struct snd_pcm_substream *substream)
+{
+       struct atmel_abdac *dac = snd_pcm_substream_chip(substream);
+       int retval;
+
+       retval = clk_set_rate(dac->sample_clk, 256 * substream->runtime->rate);
+       if (retval)
+               return retval;
+
+       if (!test_bit(DMA_READY, &dac->flags))
+               retval = atmel_abdac_prepare_dma(dac, substream, DMA_TO_DEVICE);
+
+       return retval;
+}
+
+static int atmel_abdac_trigger(struct snd_pcm_substream *substream, int cmd)
+{
+       struct atmel_abdac *dac = snd_pcm_substream_chip(substream);
+       int retval = 0;
+
+       switch (cmd) {
+       case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: /* fall through */
+       case SNDRV_PCM_TRIGGER_RESUME: /* fall through */
+       case SNDRV_PCM_TRIGGER_START:
+               clk_enable(dac->sample_clk);
+               retval = dw_dma_cyclic_start(dac->dma.chan);
+               if (retval)
+                       goto out;
+               dac_writel(dac, CTRL, DAC_BIT(EN));
+               break;
+       case SNDRV_PCM_TRIGGER_PAUSE_PUSH: /* fall through */
+       case SNDRV_PCM_TRIGGER_SUSPEND: /* fall through */
+       case SNDRV_PCM_TRIGGER_STOP:
+               dw_dma_cyclic_stop(dac->dma.chan);
+               dac_writel(dac, DATA, 0);
+               dac_writel(dac, CTRL, 0);
+               clk_disable(dac->sample_clk);
+               break;
+       default:
+               retval = -EINVAL;
+               break;
+       }
+out:
+       return retval;
+}
+
+static snd_pcm_uframes_t
+atmel_abdac_pointer(struct snd_pcm_substream *substream)
+{
+       struct atmel_abdac      *dac = snd_pcm_substream_chip(substream);
+       struct snd_pcm_runtime  *runtime = substream->runtime;
+       snd_pcm_uframes_t       frames;
+       unsigned long           bytes;
+
+       bytes = dw_dma_get_src_addr(dac->dma.chan);
+       bytes -= runtime->dma_addr;
+
+       frames = bytes_to_frames(runtime, bytes);
+       if (frames >= runtime->buffer_size)
+               frames -= runtime->buffer_size;
+
+       return frames;
+}
+
+static irqreturn_t abdac_interrupt(int irq, void *dev_id)
+{
+       struct atmel_abdac *dac = dev_id;
+       u32 status;
+
+       status = dac_readl(dac, INT_STATUS);
+       if (status & DAC_BIT(UNDERRUN)) {
+               dev_err(&dac->pdev->dev, "underrun detected\n");
+               dac_writel(dac, INT_CLR, DAC_BIT(UNDERRUN));
+       } else {
+               dev_err(&dac->pdev->dev, "spurious interrupt (status=0x%x)\n",
+                       status);
+               dac_writel(dac, INT_CLR, status);
+       }
+
+       return IRQ_HANDLED;
+}
+
+static struct snd_pcm_ops atmel_abdac_ops = {
+       .open           = atmel_abdac_open,
+       .close          = atmel_abdac_close,
+       .ioctl          = snd_pcm_lib_ioctl,
+       .hw_params      = atmel_abdac_hw_params,
+       .hw_free        = atmel_abdac_hw_free,
+       .prepare        = atmel_abdac_prepare,
+       .trigger        = atmel_abdac_trigger,
+       .pointer        = atmel_abdac_pointer,
+};
+
+static int __devinit atmel_abdac_pcm_new(struct atmel_abdac *dac)
+{
+       struct snd_pcm_hardware hw = atmel_abdac_hw;
+       struct snd_pcm *pcm;
+       int retval;
+
+       retval = snd_pcm_new(dac->card, dac->card->shortname,
+                       dac->pdev->id, 1, 0, &pcm);
+       if (retval)
+               return retval;
+
+       strcpy(pcm->name, dac->card->shortname);
+       pcm->private_data = dac;
+       pcm->info_flags = 0;
+       dac->pcm = pcm;
+
+       snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &atmel_abdac_ops);
+
+       retval = snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
+                       &dac->pdev->dev, hw.periods_min * hw.period_bytes_min,
+                       hw.buffer_bytes_max);
+
+       return retval;
+}
+
+static bool filter(struct dma_chan *chan, void *slave)
+{
+       struct dw_dma_slave *dws = slave;
+
+       if (dws->dma_dev == chan->device->dev) {
+               chan->private = dws;
+               return true;
+       } else
+               return false;
+}
+
+static int set_sample_rates(struct atmel_abdac *dac)
+{
+       long new_rate = RATE_MAX;
+       int retval = -EINVAL;
+       int index = 0;
+
+       /* we start at 192 kHz and work our way down to 5112 Hz */
+       while (new_rate >= RATE_MIN && index < (MAX_NUM_RATES + 1)) {
+               new_rate = clk_round_rate(dac->sample_clk, 256 * new_rate);
+               if (new_rate < 0)
+                       break;
+               /* make sure we are below the ABDAC clock */
+               if (new_rate <= clk_get_rate(dac->pclk)) {
+                       dac->rates[index] = new_rate / 256;
+                       index++;
+               }
+               /* divide by 256 and then by two to get next rate */
+               new_rate /= 256 * 2;
+       }
+
+       if (index) {
+               int i;
+
+               /* reverse array, smallest go first */
+               for (i = 0; i < (index / 2); i++) {
+                       unsigned int tmp = dac->rates[index - 1 - i];
+                       dac->rates[index - 1 - i] = dac->rates[i];
+                       dac->rates[i] = tmp;
+               }
+
+               dac->constraints_rates.count = index;
+               dac->constraints_rates.list = dac->rates;
+               dac->constraints_rates.mask = 0;
+               dac->rates_num = index;
+
+               retval = 0;
+       }
+
+       return retval;
+}
+
+static int __devinit atmel_abdac_probe(struct platform_device *pdev)
+{
+       struct snd_card         *card;
+       struct atmel_abdac      *dac;
+       struct resource         *regs;
+       struct atmel_abdac_pdata        *pdata;
+       struct clk              *pclk;
+       struct clk              *sample_clk;
+       int                     retval;
+       int                     irq;
+
+       regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       if (!regs) {
+               dev_dbg(&pdev->dev, "no memory resource\n");
+               return -ENXIO;
+       }
+
+       irq = platform_get_irq(pdev, 0);
+       if (irq < 0) {
+               dev_dbg(&pdev->dev, "could not get IRQ number\n");
+               return irq;
+       }
+
+       pdata = pdev->dev.platform_data;
+       if (!pdata) {
+               dev_dbg(&pdev->dev, "no platform data\n");
+               return -ENXIO;
+       }
+
+       pclk = clk_get(&pdev->dev, "pclk");
+       if (IS_ERR(pclk)) {
+               dev_dbg(&pdev->dev, "no peripheral clock\n");
+               return PTR_ERR(pclk);
+       }
+       sample_clk = clk_get(&pdev->dev, "sample_clk");
+       if (IS_ERR(pclk)) {
+               dev_dbg(&pdev->dev, "no sample clock\n");
+               retval = PTR_ERR(pclk);
+               goto out_put_pclk;
+       }
+       clk_enable(pclk);
+
+       retval = snd_card_create(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
+                       THIS_MODULE, sizeof(struct atmel_abdac), &card);
+       if (retval) {
+               dev_dbg(&pdev->dev, "could not create sound card device\n");
+               goto out_put_sample_clk;
+       }
+
+       dac = get_dac(card);
+
+       dac->irq = irq;
+       dac->card = card;
+       dac->pclk = pclk;
+       dac->sample_clk = sample_clk;
+       dac->pdev = pdev;
+
+       retval = set_sample_rates(dac);
+       if (retval < 0) {
+               dev_dbg(&pdev->dev, "could not set supported rates\n");
+               goto out_free_card;
+       }
+
+       dac->regs = ioremap(regs->start, regs->end - regs->start + 1);
+       if (!dac->regs) {
+               dev_dbg(&pdev->dev, "could not remap register memory\n");
+               goto out_free_card;
+       }
+
+       /* make sure the DAC is silent and disabled */
+       dac_writel(dac, DATA, 0);
+       dac_writel(dac, CTRL, 0);
+
+       retval = request_irq(irq, abdac_interrupt, 0, "abdac", dac);
+       if (retval) {
+               dev_dbg(&pdev->dev, "could not request irq\n");
+               goto out_unmap_regs;
+       }
+
+       snd_card_set_dev(card, &pdev->dev);
+
+       if (pdata->dws.dma_dev) {
+               struct dw_dma_slave *dws = &pdata->dws;
+               dma_cap_mask_t mask;
+
+               dws->tx_reg = regs->start + DAC_DATA;
+
+               dma_cap_zero(mask);
+               dma_cap_set(DMA_SLAVE, mask);
+
+               dac->dma.chan = dma_request_channel(mask, filter, dws);
+       }
+       if (!pdata->dws.dma_dev || !dac->dma.chan) {
+               dev_dbg(&pdev->dev, "DMA not available\n");
+               retval = -ENODEV;
+               goto out_unset_card_dev;
+       }
+
+       strcpy(card->driver, "Atmel ABDAC");
+       strcpy(card->shortname, "Atmel ABDAC");
+       sprintf(card->longname, "Atmel Audio Bitstream DAC");
+
+       retval = atmel_abdac_pcm_new(dac);
+       if (retval) {
+               dev_dbg(&pdev->dev, "could not register ABDAC pcm device\n");
+               goto out_release_dma;
+       }
+
+       retval = snd_card_register(card);
+       if (retval) {
+               dev_dbg(&pdev->dev, "could not register sound card\n");
+               goto out_release_dma;
+       }
+
+       platform_set_drvdata(pdev, card);
+
+       dev_info(&pdev->dev, "Atmel ABDAC at 0x%p using %s\n",
+                       dac->regs, dac->dma.chan->dev->device.bus_id);
+
+       return retval;
+
+out_release_dma:
+       dma_release_channel(dac->dma.chan);
+       dac->dma.chan = NULL;
+out_unset_card_dev:
+       snd_card_set_dev(card, NULL);
+       free_irq(irq, dac);
+out_unmap_regs:
+       iounmap(dac->regs);
+out_free_card:
+       snd_card_free(card);
+out_put_sample_clk:
+       clk_put(sample_clk);
+       clk_disable(pclk);
+out_put_pclk:
+       clk_put(pclk);
+       return retval;
+}
+
+#ifdef CONFIG_PM
+static int atmel_abdac_suspend(struct platform_device *pdev, pm_message_t msg)
+{
+       struct snd_card *card = platform_get_drvdata(pdev);
+       struct atmel_abdac *dac = card->private_data;
+
+       dw_dma_cyclic_stop(dac->dma.chan);
+       clk_disable(dac->sample_clk);
+       clk_disable(dac->pclk);
+
+       return 0;
+}
+
+static int atmel_abdac_resume(struct platform_device *pdev)
+{
+       struct snd_card *card = platform_get_drvdata(pdev);
+       struct atmel_abdac *dac = card->private_data;
+
+       clk_enable(dac->pclk);
+       clk_enable(dac->sample_clk);
+       if (test_bit(DMA_READY, &dac->flags))
+               dw_dma_cyclic_start(dac->dma.chan);
+
+       return 0;
+}
+#else
+#define atmel_abdac_suspend NULL
+#define atmel_abdac_resume NULL
+#endif
+
+static int __devexit atmel_abdac_remove(struct platform_device *pdev)
+{
+       struct snd_card *card = platform_get_drvdata(pdev);
+       struct atmel_abdac *dac = get_dac(card);
+
+       clk_put(dac->sample_clk);
+       clk_disable(dac->pclk);
+       clk_put(dac->pclk);
+
+       dma_release_channel(dac->dma.chan);
+       dac->dma.chan = NULL;
+       snd_card_set_dev(card, NULL);
+       iounmap(dac->regs);
+       free_irq(dac->irq, dac);
+       snd_card_free(card);
+
+       platform_set_drvdata(pdev, NULL);
+
+       return 0;
+}
+
+static struct platform_driver atmel_abdac_driver = {
+       .remove         = __devexit_p(atmel_abdac_remove),
+       .driver         = {
+               .name   = "atmel_abdac",
+       },
+       .suspend        = atmel_abdac_suspend,
+       .resume         = atmel_abdac_resume,
+};
+
+static int __init atmel_abdac_init(void)
+{
+       return platform_driver_probe(&atmel_abdac_driver,
+                       atmel_abdac_probe);
+}
+module_init(atmel_abdac_init);
+
+static void __exit atmel_abdac_exit(void)
+{
+       platform_driver_unregister(&atmel_abdac_driver);
+}
+module_exit(atmel_abdac_exit);
+
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("Driver for Atmel Audio Bitstream DAC (ABDAC)");
+MODULE_AUTHOR("Hans-Christian Egtvedt <hans-christian.egtvedt@atmel.com>");
diff --git a/sound/atmel/ac97c.c b/sound/atmel/ac97c.c
new file mode 100644 (file)
index 0000000..dd72e00
--- /dev/null
@@ -0,0 +1,932 @@
+/*
+ * Driver for the Atmel AC97C controller
+ *
+ * Copyright (C) 2005-2009 Atmel Corporation
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published by
+ * the Free Software Foundation.
+ */
+#include <linux/clk.h>
+#include <linux/delay.h>
+#include <linux/bitmap.h>
+#include <linux/dmaengine.h>
+#include <linux/dma-mapping.h>
+#include <linux/init.h>
+#include <linux/interrupt.h>
+#include <linux/module.h>
+#include <linux/platform_device.h>
+#include <linux/mutex.h>
+#include <linux/gpio.h>
+#include <linux/io.h>
+
+#include <sound/core.h>
+#include <sound/initval.h>
+#include <sound/pcm.h>
+#include <sound/pcm_params.h>
+#include <sound/ac97_codec.h>
+#include <sound/atmel-ac97c.h>
+#include <sound/memalloc.h>
+
+#include <linux/dw_dmac.h>
+
+#include "ac97c.h"
+
+enum {
+       DMA_TX_READY = 0,
+       DMA_RX_READY,
+       DMA_TX_CHAN_PRESENT,
+       DMA_RX_CHAN_PRESENT,
+};
+
+/* Serialize access to opened variable */
+static DEFINE_MUTEX(opened_mutex);
+
+struct atmel_ac97c_dma {
+       struct dma_chan                 *rx_chan;
+       struct dma_chan                 *tx_chan;
+};
+
+struct atmel_ac97c {
+       struct clk                      *pclk;
+       struct platform_device          *pdev;
+       struct atmel_ac97c_dma          dma;
+
+       struct snd_pcm_substream        *playback_substream;
+       struct snd_pcm_substream        *capture_substream;
+       struct snd_card                 *card;
+       struct snd_pcm                  *pcm;
+       struct snd_ac97                 *ac97;
+       struct snd_ac97_bus             *ac97_bus;
+
+       u64                             cur_format;
+       unsigned int                    cur_rate;
+       unsigned long                   flags;
+       /* Serialize access to opened variable */
+       spinlock_t                      lock;
+       void __iomem                    *regs;
+       int                             opened;
+       int                             reset_pin;
+};
+
+#define get_chip(card) ((struct atmel_ac97c *)(card)->private_data)
+
+#define ac97c_writel(chip, reg, val)                   \
+       __raw_writel((val), (chip)->regs + AC97C_##reg)
+#define ac97c_readl(chip, reg)                         \
+       __raw_readl((chip)->regs + AC97C_##reg)
+
+/* This function is called by the DMA driver. */
+static void atmel_ac97c_dma_playback_period_done(void *arg)
+{
+       struct atmel_ac97c *chip = arg;
+       snd_pcm_period_elapsed(chip->playback_substream);
+}
+
+static void atmel_ac97c_dma_capture_period_done(void *arg)
+{
+       struct atmel_ac97c *chip = arg;
+       snd_pcm_period_elapsed(chip->capture_substream);
+}
+
+static int atmel_ac97c_prepare_dma(struct atmel_ac97c *chip,
+               struct snd_pcm_substream *substream,
+               enum dma_data_direction direction)
+{
+       struct dma_chan                 *chan;
+       struct dw_cyclic_desc           *cdesc;
+       struct snd_pcm_runtime          *runtime = substream->runtime;
+       unsigned long                   buffer_len, period_len;
+
+       /*
+        * We don't do DMA on "complex" transfers, i.e. with
+        * non-halfword-aligned buffers or lengths.
+        */
+       if (runtime->dma_addr & 1 || runtime->buffer_size & 1) {
+               dev_dbg(&chip->pdev->dev, "too complex transfer\n");
+               return -EINVAL;
+       }
+
+       if (direction == DMA_TO_DEVICE)
+               chan = chip->dma.tx_chan;
+       else
+               chan = chip->dma.rx_chan;
+
+       buffer_len = frames_to_bytes(runtime, runtime->buffer_size);
+       period_len = frames_to_bytes(runtime, runtime->period_size);
+
+       cdesc = dw_dma_cyclic_prep(chan, runtime->dma_addr, buffer_len,
+                       period_len, direction);
+       if (IS_ERR(cdesc)) {
+               dev_dbg(&chip->pdev->dev, "could not prepare cyclic DMA\n");
+               return PTR_ERR(cdesc);
+       }
+
+       if (direction == DMA_TO_DEVICE) {
+               cdesc->period_callback = atmel_ac97c_dma_playback_period_done;
+               set_bit(DMA_TX_READY, &chip->flags);
+       } else {
+               cdesc->period_callback = atmel_ac97c_dma_capture_period_done;
+               set_bit(DMA_RX_READY, &chip->flags);
+       }
+
+       cdesc->period_callback_param = chip;
+
+       return 0;
+}
+
+static struct snd_pcm_hardware atmel_ac97c_hw = {
+       .info                   = (SNDRV_PCM_INFO_MMAP
+                                 | SNDRV_PCM_INFO_MMAP_VALID
+                                 | SNDRV_PCM_INFO_INTERLEAVED
+                                 | SNDRV_PCM_INFO_BLOCK_TRANSFER
+                                 | SNDRV_PCM_INFO_JOINT_DUPLEX
+                                 | SNDRV_PCM_INFO_RESUME
+                                 | SNDRV_PCM_INFO_PAUSE),
+       .formats                = (SNDRV_PCM_FMTBIT_S16_BE
+                                 | SNDRV_PCM_FMTBIT_S16_LE),
+       .rates                  = (SNDRV_PCM_RATE_CONTINUOUS),
+       .rate_min               = 4000,
+       .rate_max               = 48000,
+       .channels_min           = 1,
+       .channels_max           = 2,
+       .buffer_bytes_max       = 64 * 4096,
+       .period_bytes_min       = 4096,
+       .period_bytes_max       = 4096,
+       .periods_min            = 4,
+       .periods_max            = 64,
+};
+
+static int atmel_ac97c_playback_open(struct snd_pcm_substream *substream)
+{
+       struct atmel_ac97c *chip = snd_pcm_substream_chip(substream);
+       struct snd_pcm_runtime *runtime = substream->runtime;
+
+       mutex_lock(&opened_mutex);
+       chip->opened++;
+       runtime->hw = atmel_ac97c_hw;
+       if (chip->cur_rate) {
+               runtime->hw.rate_min = chip->cur_rate;
+               runtime->hw.rate_max = chip->cur_rate;
+       }
+       if (chip->cur_format)
+               runtime->hw.formats = (1ULL << chip->cur_format);
+       mutex_unlock(&opened_mutex);
+       chip->playback_substream = substream;
+       return 0;
+}
+
+static int atmel_ac97c_capture_open(struct snd_pcm_substream *substream)
+{
+       struct atmel_ac97c *chip = snd_pcm_substream_chip(substream);
+       struct snd_pcm_runtime *runtime = substream->runtime;
+
+       mutex_lock(&opened_mutex);
+       chip->opened++;
+       runtime->hw = atmel_ac97c_hw;
+       if (chip->cur_rate) {
+               runtime->hw.rate_min = chip->cur_rate;
+               runtime->hw.rate_max = chip->cur_rate;
+       }
+       if (chip->cur_format)
+               runtime->hw.formats = (1ULL << chip->cur_format);
+       mutex_unlock(&opened_mutex);
+       chip->capture_substream = substream;
+       return 0;
+}
+
+static int atmel_ac97c_playback_close(struct snd_pcm_substream *substream)
+{
+       struct atmel_ac97c *chip = snd_pcm_substream_chip(substream);
+
+       mutex_lock(&opened_mutex);
+       chip->opened--;
+       if (!chip->opened) {
+               chip->cur_rate = 0;
+               chip->cur_format = 0;
+       }
+       mutex_unlock(&opened_mutex);
+
+       chip->playback_substream = NULL;
+
+       return 0;
+}
+
+static int atmel_ac97c_capture_close(struct snd_pcm_substream *substream)
+{
+       struct atmel_ac97c *chip = snd_pcm_substream_chip(substream);
+
+       mutex_lock(&opened_mutex);
+       chip->opened--;
+       if (!chip->opened) {
+               chip->cur_rate = 0;
+               chip->cur_format = 0;
+       }
+       mutex_unlock(&opened_mutex);
+
+       chip->capture_substream = NULL;
+
+       return 0;
+}
+
+static int atmel_ac97c_playback_hw_params(struct snd_pcm_substream *substream,
+               struct snd_pcm_hw_params *hw_params)
+{
+       struct atmel_ac97c *chip = snd_pcm_substream_chip(substream);
+       int retval;
+
+       retval = snd_pcm_lib_malloc_pages(substream,
+                                       params_buffer_bytes(hw_params));
+       if (retval < 0)
+               return retval;
+       /* snd_pcm_lib_malloc_pages returns 1 if buffer is changed. */
+       if (retval == 1)
+               if (test_and_clear_bit(DMA_TX_READY, &chip->flags))
+                       dw_dma_cyclic_free(chip->dma.tx_chan);
+
+       /* Set restrictions to params. */
+       mutex_lock(&opened_mutex);
+       chip->cur_rate = params_rate(hw_params);
+       chip->cur_format = params_format(hw_params);
+       mutex_unlock(&opened_mutex);
+
+       return retval;
+}
+
+static int atmel_ac97c_capture_hw_params(struct snd_pcm_substream *substream,
+               struct snd_pcm_hw_params *hw_params)
+{
+       struct atmel_ac97c *chip = snd_pcm_substream_chip(substream);
+       int retval;
+
+       retval = snd_pcm_lib_malloc_pages(substream,
+                                       params_buffer_bytes(hw_params));
+       if (retval < 0)
+               return retval;
+       /* snd_pcm_lib_malloc_pages returns 1 if buffer is changed. */
+       if (retval == 1)
+               if (test_and_clear_bit(DMA_RX_READY, &chip->flags))
+                       dw_dma_cyclic_free(chip->dma.rx_chan);
+
+       /* Set restrictions to params. */
+       mutex_lock(&opened_mutex);
+       chip->cur_rate = params_rate(hw_params);
+       chip->cur_format = params_format(hw_params);
+       mutex_unlock(&opened_mutex);
+
+       return retval;
+}
+
+static int atmel_ac97c_playback_hw_free(struct snd_pcm_substream *substream)
+{
+       struct atmel_ac97c *chip = snd_pcm_substream_chip(substream);
+       if (test_and_clear_bit(DMA_TX_READY, &chip->flags))
+               dw_dma_cyclic_free(chip->dma.tx_chan);
+       return snd_pcm_lib_free_pages(substream);
+}
+
+static int atmel_ac97c_capture_hw_free(struct snd_pcm_substream *substream)
+{
+       struct atmel_ac97c *chip = snd_pcm_substream_chip(substream);
+       if (test_and_clear_bit(DMA_RX_READY, &chip->flags))
+               dw_dma_cyclic_free(chip->dma.rx_chan);
+       return snd_pcm_lib_free_pages(substream);
+}
+
+static int atmel_ac97c_playback_prepare(struct snd_pcm_substream *substream)
+{
+       struct atmel_ac97c *chip = snd_pcm_substream_chip(substream);
+       struct snd_pcm_runtime *runtime = substream->runtime;
+       unsigned long word = 0;
+       int retval;
+
+       /* assign channels to AC97C channel A */
+       switch (runtime->channels) {
+       case 1:
+               word |= AC97C_CH_ASSIGN(PCM_LEFT, A);
+               break;
+       case 2:
+               word |= AC97C_CH_ASSIGN(PCM_LEFT, A)
+                       | AC97C_CH_ASSIGN(PCM_RIGHT, A);
+               break;
+       default:
+               /* TODO: support more than two channels */
+               return -EINVAL;
+               break;
+       }
+       ac97c_writel(chip, OCA, word);
+
+       /* configure sample format and size */
+       word = AC97C_CMR_DMAEN | AC97C_CMR_SIZE_16;
+
+       switch (runtime->format) {
+       case SNDRV_PCM_FORMAT_S16_LE:
+               word |= AC97C_CMR_CEM_LITTLE;
+               break;
+       case SNDRV_PCM_FORMAT_S16_BE: /* fall through */
+       default:
+               word &= ~(AC97C_CMR_CEM_LITTLE);
+               break;
+       }
+
+       ac97c_writel(chip, CAMR, word);
+
+       /* set variable rate if needed */
+       if (runtime->rate != 48000) {
+               word = ac97c_readl(chip, MR);
+               word |= AC97C_MR_VRA;
+               ac97c_writel(chip, MR, word);
+       } else {
+               word = ac97c_readl(chip, MR);
+               word &= ~(AC97C_MR_VRA);
+               ac97c_writel(chip, MR, word);
+       }
+
+       retval = snd_ac97_set_rate(chip->ac97, AC97_PCM_FRONT_DAC_RATE,
+                       runtime->rate);
+       if (retval)
+               dev_dbg(&chip->pdev->dev, "could not set rate %d Hz\n",
+                               runtime->rate);
+
+       if (!test_bit(DMA_TX_READY, &chip->flags))
+               retval = atmel_ac97c_prepare_dma(chip, substream,
+                               DMA_TO_DEVICE);
+
+       return retval;
+}
+
+static int atmel_ac97c_capture_prepare(struct snd_pcm_substream *substream)
+{
+       struct atmel_ac97c *chip = snd_pcm_substream_chip(substream);
+       struct snd_pcm_runtime *runtime = substream->runtime;
+       unsigned long word = 0;
+       int retval;
+
+       /* assign channels to AC97C channel A */
+       switch (runtime->channels) {
+       case 1:
+               word |= AC97C_CH_ASSIGN(PCM_LEFT, A);
+               break;
+       case 2:
+               word |= AC97C_CH_ASSIGN(PCM_LEFT, A)
+                       | AC97C_CH_ASSIGN(PCM_RIGHT, A);
+               break;
+       default:
+               /* TODO: support more than two channels */
+               return -EINVAL;
+               break;
+       }
+       ac97c_writel(chip, ICA, word);
+
+       /* configure sample format and size */
+       word = AC97C_CMR_DMAEN | AC97C_CMR_SIZE_16;
+
+       switch (runtime->format) {
+       case SNDRV_PCM_FORMAT_S16_LE:
+               word |= AC97C_CMR_CEM_LITTLE;
+               break;
+       case SNDRV_PCM_FORMAT_S16_BE: /* fall through */
+       default:
+               word &= ~(AC97C_CMR_CEM_LITTLE);
+               break;
+       }
+
+       ac97c_writel(chip, CAMR, word);
+
+       /* set variable rate if needed */
+       if (runtime->rate != 48000) {
+               word = ac97c_readl(chip, MR);
+               word |= AC97C_MR_VRA;
+               ac97c_writel(chip, MR, word);
+       } else {
+               word = ac97c_readl(chip, MR);
+               word &= ~(AC97C_MR_VRA);
+               ac97c_writel(chip, MR, word);
+       }
+
+       retval = snd_ac97_set_rate(chip->ac97, AC97_PCM_LR_ADC_RATE,
+                       runtime->rate);
+       if (retval)
+               dev_dbg(&chip->pdev->dev, "could not set rate %d Hz\n",
+                               runtime->rate);
+
+       if (!test_bit(DMA_RX_READY, &chip->flags))
+               retval = atmel_ac97c_prepare_dma(chip, substream,
+                               DMA_FROM_DEVICE);
+
+       return retval;
+}
+
+static int
+atmel_ac97c_playback_trigger(struct snd_pcm_substream *substream, int cmd)
+{
+       struct atmel_ac97c *chip = snd_pcm_substream_chip(substream);
+       unsigned long camr;
+       int retval = 0;
+
+       camr = ac97c_readl(chip, CAMR);
+
+       switch (cmd) {
+       case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: /* fall through */
+       case SNDRV_PCM_TRIGGER_RESUME: /* fall through */
+       case SNDRV_PCM_TRIGGER_START:
+               retval = dw_dma_cyclic_start(chip->dma.tx_chan);
+               if (retval)
+                       goto out;
+               camr |= AC97C_CMR_CENA;
+               break;
+       case SNDRV_PCM_TRIGGER_PAUSE_PUSH: /* fall through */
+       case SNDRV_PCM_TRIGGER_SUSPEND: /* fall through */
+       case SNDRV_PCM_TRIGGER_STOP:
+               dw_dma_cyclic_stop(chip->dma.tx_chan);
+               if (chip->opened <= 1)
+                       camr &= ~AC97C_CMR_CENA;
+               break;
+       default:
+               retval = -EINVAL;
+               goto out;
+       }
+
+       ac97c_writel(chip, CAMR, camr);
+out:
+       return retval;
+}
+
+static int
+atmel_ac97c_capture_trigger(struct snd_pcm_substream *substream, int cmd)
+{
+       struct atmel_ac97c *chip = snd_pcm_substream_chip(substream);
+       unsigned long camr;
+       int retval = 0;
+
+       camr = ac97c_readl(chip, CAMR);
+
+       switch (cmd) {
+       case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: /* fall through */
+       case SNDRV_PCM_TRIGGER_RESUME: /* fall through */
+       case SNDRV_PCM_TRIGGER_START:
+               retval = dw_dma_cyclic_start(chip->dma.rx_chan);
+               if (retval)
+                       goto out;
+               camr |= AC97C_CMR_CENA;
+               break;
+       case SNDRV_PCM_TRIGGER_PAUSE_PUSH: /* fall through */
+       case SNDRV_PCM_TRIGGER_SUSPEND: /* fall through */
+       case SNDRV_PCM_TRIGGER_STOP:
+               dw_dma_cyclic_stop(chip->dma.rx_chan);
+               if (chip->opened <= 1)
+                       camr &= ~AC97C_CMR_CENA;
+               break;
+       default:
+               retval = -EINVAL;
+               break;
+       }
+
+       ac97c_writel(chip, CAMR, camr);
+out:
+       return retval;
+}
+
+static snd_pcm_uframes_t
+atmel_ac97c_playback_pointer(struct snd_pcm_substream *substream)
+{
+       struct atmel_ac97c      *chip = snd_pcm_substream_chip(substream);
+       struct snd_pcm_runtime  *runtime = substream->runtime;
+       snd_pcm_uframes_t       frames;
+       unsigned long           bytes;
+
+       bytes = dw_dma_get_src_addr(chip->dma.tx_chan);
+       bytes -= runtime->dma_addr;
+
+       frames = bytes_to_frames(runtime, bytes);
+       if (frames >= runtime->buffer_size)
+               frames -= runtime->buffer_size;
+       return frames;
+}
+
+static snd_pcm_uframes_t
+atmel_ac97c_capture_pointer(struct snd_pcm_substream *substream)
+{
+       struct atmel_ac97c      *chip = snd_pcm_substream_chip(substream);
+       struct snd_pcm_runtime  *runtime = substream->runtime;
+       snd_pcm_uframes_t       frames;
+       unsigned long           bytes;
+
+       bytes = dw_dma_get_dst_addr(chip->dma.rx_chan);
+       bytes -= runtime->dma_addr;
+
+       frames = bytes_to_frames(runtime, bytes);
+       if (frames >= runtime->buffer_size)
+               frames -= runtime->buffer_size;
+       return frames;
+}
+
+static struct snd_pcm_ops atmel_ac97_playback_ops = {
+       .open           = atmel_ac97c_playback_open,
+       .close          = atmel_ac97c_playback_close,
+       .ioctl          = snd_pcm_lib_ioctl,
+       .hw_params      = atmel_ac97c_playback_hw_params,
+       .hw_free        = atmel_ac97c_playback_hw_free,
+       .prepare        = atmel_ac97c_playback_prepare,
+       .trigger        = atmel_ac97c_playback_trigger,
+       .pointer        = atmel_ac97c_playback_pointer,
+};
+
+static struct snd_pcm_ops atmel_ac97_capture_ops = {
+       .open           = atmel_ac97c_capture_open,
+       .close          = atmel_ac97c_capture_close,
+       .ioctl          = snd_pcm_lib_ioctl,
+       .hw_params      = atmel_ac97c_capture_hw_params,
+       .hw_free        = atmel_ac97c_capture_hw_free,
+       .prepare        = atmel_ac97c_capture_prepare,
+       .trigger        = atmel_ac97c_capture_trigger,
+       .pointer        = atmel_ac97c_capture_pointer,
+};
+
+static int __devinit atmel_ac97c_pcm_new(struct atmel_ac97c *chip)
+{
+       struct snd_pcm          *pcm;
+       struct snd_pcm_hardware hw = atmel_ac97c_hw;
+       int                     capture, playback, retval;
+
+       capture = test_bit(DMA_RX_CHAN_PRESENT, &chip->flags);
+       playback = test_bit(DMA_TX_CHAN_PRESENT, &chip->flags);
+
+       retval = snd_pcm_new(chip->card, chip->card->shortname,
+                       chip->pdev->id, playback, capture, &pcm);
+       if (retval)
+               return retval;
+
+       if (capture)
+               snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE,
+                               &atmel_ac97_capture_ops);
+       if (playback)
+               snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK,
+                               &atmel_ac97_playback_ops);
+
+       retval = snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
+                       &chip->pdev->dev, hw.periods_min * hw.period_bytes_min,
+                       hw.buffer_bytes_max);
+       if (retval)
+               return retval;
+
+       pcm->private_data = chip;
+       pcm->info_flags = 0;
+       strcpy(pcm->name, chip->card->shortname);
+       chip->pcm = pcm;
+
+       return 0;
+}
+
+static int atmel_ac97c_mixer_new(struct atmel_ac97c *chip)
+{
+       struct snd_ac97_template template;
+       memset(&template, 0, sizeof(template));
+       template.private_data = chip;
+       return snd_ac97_mixer(chip->ac97_bus, &template, &chip->ac97);
+}
+
+static void atmel_ac97c_write(struct snd_ac97 *ac97, unsigned short reg,
+               unsigned short val)
+{
+       struct atmel_ac97c *chip = get_chip(ac97);
+       unsigned long word;
+       int timeout = 40;
+
+       word = (reg & 0x7f) << 16 | val;
+
+       do {
+               if (ac97c_readl(chip, COSR) & AC97C_CSR_TXRDY) {
+                       ac97c_writel(chip, COTHR, word);
+                       return;
+               }
+               udelay(1);
+       } while (--timeout);
+
+       dev_dbg(&chip->pdev->dev, "codec write timeout\n");
+}
+
+static unsigned short atmel_ac97c_read(struct snd_ac97 *ac97,
+               unsigned short reg)
+{
+       struct atmel_ac97c *chip = get_chip(ac97);
+       unsigned long word;
+       int timeout = 40;
+       int write = 10;
+
+       word = (0x80 | (reg & 0x7f)) << 16;
+
+       if ((ac97c_readl(chip, COSR) & AC97C_CSR_RXRDY) != 0)
+               ac97c_readl(chip, CORHR);
+
+retry_write:
+       timeout = 40;
+
+       do {
+               if ((ac97c_readl(chip, COSR) & AC97C_CSR_TXRDY) != 0) {
+                       ac97c_writel(chip, COTHR, word);
+                       goto read_reg;
+               }
+               udelay(10);
+       } while (--timeout);
+
+       if (!--write)
+               goto timed_out;
+       goto retry_write;
+
+read_reg:
+       do {
+               if ((ac97c_readl(chip, COSR) & AC97C_CSR_RXRDY) != 0) {
+                       unsigned short val = ac97c_readl(chip, CORHR);
+                       return val;
+               }
+               udelay(10);
+       } while (--timeout);
+
+       if (!--write)
+               goto timed_out;
+       goto retry_write;
+
+timed_out:
+       dev_dbg(&chip->pdev->dev, "codec read timeout\n");
+       return 0xffff;
+}
+
+static bool filter(struct dma_chan *chan, void *slave)
+{
+       struct dw_dma_slave *dws = slave;
+
+       if (dws->dma_dev == chan->device->dev) {
+               chan->private = dws;
+               return true;
+       } else
+               return false;
+}
+
+static void atmel_ac97c_reset(struct atmel_ac97c *chip)
+{
+       ac97c_writel(chip, MR, AC97C_MR_WRST);
+
+       if (gpio_is_valid(chip->reset_pin)) {
+               gpio_set_value(chip->reset_pin, 0);
+               /* AC97 v2.2 specifications says minimum 1 us. */
+               udelay(10);
+               gpio_set_value(chip->reset_pin, 1);
+       }
+
+       udelay(1);
+       ac97c_writel(chip, MR, AC97C_MR_ENA);
+}
+
+static int __devinit atmel_ac97c_probe(struct platform_device *pdev)
+{
+       struct snd_card                 *card;
+       struct atmel_ac97c              *chip;
+       struct resource                 *regs;
+       struct ac97c_platform_data      *pdata;
+       struct clk                      *pclk;
+       static struct snd_ac97_bus_ops  ops = {
+               .write  = atmel_ac97c_write,
+               .read   = atmel_ac97c_read,
+       };
+       int                             retval;
+
+       regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       if (!regs) {
+               dev_dbg(&pdev->dev, "no memory resource\n");
+               return -ENXIO;
+       }
+
+       pdata = pdev->dev.platform_data;
+       if (!pdata) {
+               dev_dbg(&pdev->dev, "no platform data\n");
+               return -ENXIO;
+       }
+
+       pclk = clk_get(&pdev->dev, "pclk");
+       if (IS_ERR(pclk)) {
+               dev_dbg(&pdev->dev, "no peripheral clock\n");
+               return PTR_ERR(pclk);
+       }
+       clk_enable(pclk);
+
+       retval = snd_card_create(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
+                       THIS_MODULE, sizeof(struct atmel_ac97c), &card);
+       if (retval) {
+               dev_dbg(&pdev->dev, "could not create sound card device\n");
+               goto err_snd_card_new;
+       }
+
+       chip = get_chip(card);
+
+       spin_lock_init(&chip->lock);
+
+       strcpy(card->driver, "Atmel AC97C");
+       strcpy(card->shortname, "Atmel AC97C");
+       sprintf(card->longname, "Atmel AC97 controller");
+
+       chip->card = card;
+       chip->pclk = pclk;
+       chip->pdev = pdev;
+       chip->regs = ioremap(regs->start, regs->end - regs->start + 1);
+
+       if (!chip->regs) {
+               dev_dbg(&pdev->dev, "could not remap register memory\n");
+               goto err_ioremap;
+       }
+
+       if (gpio_is_valid(pdata->reset_pin)) {
+               if (gpio_request(pdata->reset_pin, "reset_pin")) {
+                       dev_dbg(&pdev->dev, "reset pin not available\n");
+                       chip->reset_pin = -ENODEV;
+               } else {
+                       gpio_direction_output(pdata->reset_pin, 1);
+                       chip->reset_pin = pdata->reset_pin;
+               }
+       }
+
+       snd_card_set_dev(card, &pdev->dev);
+
+       retval = snd_ac97_bus(card, 0, &ops, chip, &chip->ac97_bus);
+       if (retval) {
+               dev_dbg(&pdev->dev, "could not register on ac97 bus\n");
+               goto err_ac97_bus;
+       }
+
+       atmel_ac97c_reset(chip);
+
+       retval = atmel_ac97c_mixer_new(chip);
+       if (retval) {
+               dev_dbg(&pdev->dev, "could not register ac97 mixer\n");
+               goto err_ac97_bus;
+       }
+
+       if (pdata->rx_dws.dma_dev) {
+               struct dw_dma_slave *dws = &pdata->rx_dws;
+               dma_cap_mask_t mask;
+
+               dws->rx_reg = regs->start + AC97C_CARHR + 2;
+
+               dma_cap_zero(mask);
+               dma_cap_set(DMA_SLAVE, mask);
+
+               chip->dma.rx_chan = dma_request_channel(mask, filter, dws);
+
+               dev_info(&chip->pdev->dev, "using %s for DMA RX\n",
+                                       chip->dma.rx_chan->dev->device.bus_id);
+               set_bit(DMA_RX_CHAN_PRESENT, &chip->flags);
+       }
+
+       if (pdata->tx_dws.dma_dev) {
+               struct dw_dma_slave *dws = &pdata->tx_dws;
+               dma_cap_mask_t mask;
+
+               dws->tx_reg = regs->start + AC97C_CATHR + 2;
+
+               dma_cap_zero(mask);
+               dma_cap_set(DMA_SLAVE, mask);
+
+               chip->dma.tx_chan = dma_request_channel(mask, filter, dws);
+
+               dev_info(&chip->pdev->dev, "using %s for DMA TX\n",
+                                       chip->dma.tx_chan->dev->device.bus_id);
+               set_bit(DMA_TX_CHAN_PRESENT, &chip->flags);
+       }
+
+       if (!test_bit(DMA_RX_CHAN_PRESENT, &chip->flags) &&
+                       !test_bit(DMA_TX_CHAN_PRESENT, &chip->flags)) {
+               dev_dbg(&pdev->dev, "DMA not available\n");
+               retval = -ENODEV;
+               goto err_dma;
+       }
+
+       retval = atmel_ac97c_pcm_new(chip);
+       if (retval) {
+               dev_dbg(&pdev->dev, "could not register ac97 pcm device\n");
+               goto err_dma;
+       }
+
+       retval = snd_card_register(card);
+       if (retval) {
+               dev_dbg(&pdev->dev, "could not register sound card\n");
+               goto err_ac97_bus;
+       }
+
+       platform_set_drvdata(pdev, card);
+
+       dev_info(&pdev->dev, "Atmel AC97 controller at 0x%p\n",
+                       chip->regs);
+
+       return 0;
+
+err_dma:
+       if (test_bit(DMA_RX_CHAN_PRESENT, &chip->flags))
+               dma_release_channel(chip->dma.rx_chan);
+       if (test_bit(DMA_TX_CHAN_PRESENT, &chip->flags))
+               dma_release_channel(chip->dma.tx_chan);
+       clear_bit(DMA_RX_CHAN_PRESENT, &chip->flags);
+       clear_bit(DMA_TX_CHAN_PRESENT, &chip->flags);
+       chip->dma.rx_chan = NULL;
+       chip->dma.tx_chan = NULL;
+err_ac97_bus:
+       snd_card_set_dev(card, NULL);
+
+       if (gpio_is_valid(chip->reset_pin))
+               gpio_free(chip->reset_pin);
+
+       iounmap(chip->regs);
+err_ioremap:
+       snd_card_free(card);
+err_snd_card_new:
+       clk_disable(pclk);
+       clk_put(pclk);
+       return retval;
+}
+
+#ifdef CONFIG_PM
+static int atmel_ac97c_suspend(struct platform_device *pdev, pm_message_t msg)
+{
+       struct snd_card *card = platform_get_drvdata(pdev);
+       struct atmel_ac97c *chip = card->private_data;
+
+       if (test_bit(DMA_RX_READY, &chip->flags))
+               dw_dma_cyclic_stop(chip->dma.rx_chan);
+       if (test_bit(DMA_TX_READY, &chip->flags))
+               dw_dma_cyclic_stop(chip->dma.tx_chan);
+       clk_disable(chip->pclk);
+
+       return 0;
+}
+
+static int atmel_ac97c_resume(struct platform_device *pdev)
+{
+       struct snd_card *card = platform_get_drvdata(pdev);
+       struct atmel_ac97c *chip = card->private_data;
+
+       clk_enable(chip->pclk);
+       if (test_bit(DMA_RX_READY, &chip->flags))
+               dw_dma_cyclic_start(chip->dma.rx_chan);
+       if (test_bit(DMA_TX_READY, &chip->flags))
+               dw_dma_cyclic_start(chip->dma.tx_chan);
+
+       return 0;
+}
+#else
+#define atmel_ac97c_suspend NULL
+#define atmel_ac97c_resume NULL
+#endif
+
+static int __devexit atmel_ac97c_remove(struct platform_device *pdev)
+{
+       struct snd_card *card = platform_get_drvdata(pdev);
+       struct atmel_ac97c *chip = get_chip(card);
+
+       if (gpio_is_valid(chip->reset_pin))
+               gpio_free(chip->reset_pin);
+
+       clk_disable(chip->pclk);
+       clk_put(chip->pclk);
+       iounmap(chip->regs);
+
+       if (test_bit(DMA_RX_CHAN_PRESENT, &chip->flags))
+               dma_release_channel(chip->dma.rx_chan);
+       if (test_bit(DMA_TX_CHAN_PRESENT, &chip->flags))
+               dma_release_channel(chip->dma.tx_chan);
+       clear_bit(DMA_RX_CHAN_PRESENT, &chip->flags);
+       clear_bit(DMA_TX_CHAN_PRESENT, &chip->flags);
+       chip->dma.rx_chan = NULL;
+       chip->dma.tx_chan = NULL;
+
+       snd_card_set_dev(card, NULL);
+       snd_card_free(card);
+
+       platform_set_drvdata(pdev, NULL);
+
+       return 0;
+}
+
+static struct platform_driver atmel_ac97c_driver = {
+       .remove         = __devexit_p(atmel_ac97c_remove),
+       .driver         = {
+               .name   = "atmel_ac97c",
+       },
+       .suspend        = atmel_ac97c_suspend,
+       .resume         = atmel_ac97c_resume,
+};
+
+static int __init atmel_ac97c_init(void)
+{
+       return platform_driver_probe(&atmel_ac97c_driver,
+                       atmel_ac97c_probe);
+}
+module_init(atmel_ac97c_init);
+
+static void __exit atmel_ac97c_exit(void)
+{
+       platform_driver_unregister(&atmel_ac97c_driver);
+}
+module_exit(atmel_ac97c_exit);
+
+MODULE_LICENSE("GPL");
+MODULE_DESCRIPTION("Driver for Atmel AC97 controller");
+MODULE_AUTHOR("Hans-Christian Egtvedt <hans-christian.egtvedt@atmel.com>");
diff --git a/sound/atmel/ac97c.h b/sound/atmel/ac97c.h
new file mode 100644 (file)
index 0000000..c17bd58
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * Register definitions for the Atmel AC97C controller
+ *
+ * Copyright (C) 2005-2009 Atmel Corporation
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ */
+#ifndef __SOUND_ATMEL_AC97C_H
+#define __SOUND_ATMEL_AC97C_H
+
+#define AC97C_MR               0x08
+#define AC97C_ICA              0x10
+#define AC97C_OCA              0x14
+#define AC97C_CARHR            0x20
+#define AC97C_CATHR            0x24
+#define AC97C_CASR             0x28
+#define AC97C_CAMR             0x2c
+#define AC97C_CBRHR            0x30
+#define AC97C_CBTHR            0x34
+#define AC97C_CBSR             0x38
+#define AC97C_CBMR             0x3c
+#define AC97C_CORHR            0x40
+#define AC97C_COTHR            0x44
+#define AC97C_COSR             0x48
+#define AC97C_COMR             0x4c
+#define AC97C_SR               0x50
+#define AC97C_IER              0x54
+#define AC97C_IDR              0x58
+#define AC97C_IMR              0x5c
+#define AC97C_VERSION          0xfc
+
+#define AC97C_CATPR            PDC_TPR
+#define AC97C_CATCR            PDC_TCR
+#define AC97C_CATNPR           PDC_TNPR
+#define AC97C_CATNCR           PDC_TNCR
+#define AC97C_CARPR            PDC_RPR
+#define AC97C_CARCR            PDC_RCR
+#define AC97C_CARNPR           PDC_RNPR
+#define AC97C_CARNCR           PDC_RNCR
+#define AC97C_PTCR             PDC_PTCR
+
+#define AC97C_MR_ENA           (1 << 0)
+#define AC97C_MR_WRST          (1 << 1)
+#define AC97C_MR_VRA           (1 << 2)
+
+#define AC97C_CSR_TXRDY                (1 << 0)
+#define AC97C_CSR_UNRUN                (1 << 2)
+#define AC97C_CSR_RXRDY                (1 << 4)
+#define AC97C_CSR_ENDTX                (1 << 10)
+#define AC97C_CSR_ENDRX                (1 << 14)
+
+#define AC97C_CMR_SIZE_20      (0 << 16)
+#define AC97C_CMR_SIZE_18      (1 << 16)
+#define AC97C_CMR_SIZE_16      (2 << 16)
+#define AC97C_CMR_SIZE_10      (3 << 16)
+#define AC97C_CMR_CEM_LITTLE   (1 << 18)
+#define AC97C_CMR_CEM_BIG      (0 << 18)
+#define AC97C_CMR_CENA         (1 << 21)
+#define AC97C_CMR_DMAEN                (1 << 22)
+
+#define AC97C_SR_CAEVT         (1 << 3)
+
+#define AC97C_CH_ASSIGN(slot, channel)                                 \
+       (AC97C_CHANNEL_##channel << (3 * (AC97_SLOT_##slot - 3)))
+#define AC97C_CHANNEL_NONE     0x0
+#define AC97C_CHANNEL_A                0x1
+#define AC97C_CHANNEL_B                0x2
+
+#endif /* __SOUND_ATMEL_AC97C_H */
index 195cafc5a55342df53e01a4ecb361a37db178dbd..a70ee7f1ed9832ed3ef3b4463376786dd2500234 100644 (file)
@@ -99,9 +99,6 @@ static int snd_hwdep_open(struct inode *inode, struct file * file)
        if (hw == NULL)
                return -ENODEV;
 
-       if (!hw->ops.open)
-               return -ENXIO;
-
        if (!try_module_get(hw->card->module))
                return -EFAULT;
 
@@ -113,6 +110,10 @@ static int snd_hwdep_open(struct inode *inode, struct file * file)
                        err = -EBUSY;
                        break;
                }
+               if (!hw->ops.open) {
+                       err = 0;
+                       break;
+               }
                err = hw->ops.open(hw, file);
                if (err >= 0)
                        break;
@@ -151,7 +152,7 @@ static int snd_hwdep_open(struct inode *inode, struct file * file)
 
 static int snd_hwdep_release(struct inode *inode, struct file * file)
 {
-       int err = -ENXIO;
+       int err = 0;
        struct snd_hwdep *hw = file->private_data;
        struct module *mod = hw->card->module;
 
index 0d5520c415d3ad77258221cc4ebbdc25f6799def..fd56afe846ed6321d71e328147a5659423e2bce2 100644 (file)
@@ -121,31 +121,44 @@ static inline int init_info_for_card(struct snd_card *card)
 #endif
 
 /**
- *  snd_card_new - create and initialize a soundcard structure
+ *  snd_card_create - create and initialize a soundcard structure
  *  @idx: card index (address) [0 ... (SNDRV_CARDS-1)]
  *  @xid: card identification (ASCII string)
  *  @module: top level module for locking
  *  @extra_size: allocate this extra size after the main soundcard structure
+ *  @card_ret: the pointer to store the created card instance
  *
  *  Creates and initializes a soundcard structure.
  *
- *  Returns kmallocated snd_card structure. Creates the ALSA control interface
- *  (which is blocked until snd_card_register function is called).
+ *  The function allocates snd_card instance via kzalloc with the given
+ *  space for the driver to use freely.  The allocated struct is stored
+ *  in the given card_ret pointer.
+ *
+ *  Returns zero if successful or a negative error code.
  */
-struct snd_card *snd_card_new(int idx, const char *xid,
-                        struct module *module, int extra_size)
+int snd_card_create(int idx, const char *xid,
+                   struct module *module, int extra_size,
+                   struct snd_card **card_ret)
 {
        struct snd_card *card;
        int err, idx2;
 
+       if (snd_BUG_ON(!card_ret))
+               return -EINVAL;
+       *card_ret = NULL;
+
        if (extra_size < 0)
                extra_size = 0;
        card = kzalloc(sizeof(*card) + extra_size, GFP_KERNEL);
-       if (card == NULL)
-               return NULL;
+       if (!card)
+               return -ENOMEM;
        if (xid) {
-               if (!snd_info_check_reserved_words(xid))
+               if (!snd_info_check_reserved_words(xid)) {
+                       snd_printk(KERN_ERR
+                                  "given id string '%s' is reserved.\n", xid);
+                       err = -EBUSY;
                        goto __error;
+               }
                strlcpy(card->id, xid, sizeof(card->id));
        }
        err = 0;
@@ -195,6 +208,7 @@ struct snd_card *snd_card_new(int idx, const char *xid,
        INIT_LIST_HEAD(&card->controls);
        INIT_LIST_HEAD(&card->ctl_files);
        spin_lock_init(&card->files_lock);
+       INIT_LIST_HEAD(&card->files_list);
        init_waitqueue_head(&card->shutdown_sleep);
 #ifdef CONFIG_PM
        mutex_init(&card->power_lock);
@@ -202,26 +216,28 @@ struct snd_card *snd_card_new(int idx, const char *xid,
 #endif
        /* the control interface cannot be accessed from the user space until */
        /* snd_cards_bitmask and snd_cards are set with snd_card_register */
-       if ((err = snd_ctl_create(card)) < 0) {
-               snd_printd("unable to register control minors\n");
+       err = snd_ctl_create(card);
+       if (err < 0) {
+               snd_printk(KERN_ERR "unable to register control minors\n");
                goto __error;
        }
-       if ((err = snd_info_card_create(card)) < 0) {
-               snd_printd("unable to create card info\n");
+       err = snd_info_card_create(card);
+       if (err < 0) {
+               snd_printk(KERN_ERR "unable to create card info\n");
                goto __error_ctl;
        }
        if (extra_size > 0)
                card->private_data = (char *)card + sizeof(struct snd_card);
-       return card;
+       *card_ret = card;
+       return 0;
 
       __error_ctl:
        snd_device_free_all(card, SNDRV_DEV_CMD_PRE);
       __error:
        kfree(card);
-       return NULL;
+       return err;
 }
-
-EXPORT_SYMBOL(snd_card_new);
+EXPORT_SYMBOL(snd_card_create);
 
 /* return non-zero if a card is already locked */
 int snd_card_locked(int card)
@@ -259,6 +275,7 @@ static int snd_disconnect_release(struct inode *inode, struct file *file)
        list_for_each_entry(_df, &shutdown_files, shutdown_list) {
                if (_df->file == file) {
                        df = _df;
+                       list_del_init(&df->shutdown_list);
                        break;
                }
        }
@@ -347,8 +364,7 @@ int snd_card_disconnect(struct snd_card *card)
        /* phase 2: replace file->f_op with special dummy operations */
        
        spin_lock(&card->files_lock);
-       mfile = card->files;
-       while (mfile) {
+       list_for_each_entry(mfile, &card->files_list, list) {
                file = mfile->file;
 
                /* it's critical part, use endless loop */
@@ -361,8 +377,6 @@ int snd_card_disconnect(struct snd_card *card)
 
                mfile->file->f_op = &snd_shutdown_f_ops;
                fops_get(mfile->file->f_op);
-               
-               mfile = mfile->next;
        }
        spin_unlock(&card->files_lock); 
 
@@ -442,7 +456,7 @@ int snd_card_free_when_closed(struct snd_card *card)
                return ret;
 
        spin_lock(&card->files_lock);
-       if (card->files == NULL)
+       if (list_empty(&card->files_list))
                free_now = 1;
        else
                card->free_on_last_close = 1;
@@ -462,7 +476,7 @@ int snd_card_free(struct snd_card *card)
                return ret;
 
        /* wait, until all devices are ready for the free operation */
-       wait_event(card->shutdown_sleep, card->files == NULL);
+       wait_event(card->shutdown_sleep, list_empty(&card->files_list));
        snd_card_do_free(card);
        return 0;
 }
@@ -809,15 +823,13 @@ int snd_card_file_add(struct snd_card *card, struct file *file)
                return -ENOMEM;
        mfile->file = file;
        mfile->disconnected_f_op = NULL;
-       mfile->next = NULL;
        spin_lock(&card->files_lock);
        if (card->shutdown) {
                spin_unlock(&card->files_lock);
                kfree(mfile);
                return -ENODEV;
        }
-       mfile->next = card->files;
-       card->files = mfile;
+       list_add(&mfile->list, &card->files_list);
        spin_unlock(&card->files_lock);
        return 0;
 }
@@ -839,29 +851,20 @@ EXPORT_SYMBOL(snd_card_file_add);
  */
 int snd_card_file_remove(struct snd_card *card, struct file *file)
 {
-       struct snd_monitor_file *mfile, *pfile = NULL;
+       struct snd_monitor_file *mfile, *found = NULL;
        int last_close = 0;
 
        spin_lock(&card->files_lock);
-       mfile = card->files;
-       while (mfile) {
+       list_for_each_entry(mfile, &card->files_list, list) {
                if (mfile->file == file) {
-                       if (pfile)
-                               pfile->next = mfile->next;
-                       else
-                               card->files = mfile->next;
+                       list_del(&mfile->list);
+                       if (mfile->disconnected_f_op)
+                               fops_put(mfile->disconnected_f_op);
+                       found = mfile;
                        break;
                }
-               pfile = mfile;
-               mfile = mfile->next;
-       }
-       if (mfile && mfile->disconnected_f_op) {
-               fops_put(mfile->disconnected_f_op);
-               spin_lock(&shutdown_lock);
-               list_del(&mfile->shutdown_list);
-               spin_unlock(&shutdown_lock);
        }
-       if (card->files == NULL)
+       if (list_empty(&card->files_list))
                last_close = 1;
        spin_unlock(&card->files_lock);
        if (last_close) {
@@ -869,11 +872,11 @@ int snd_card_file_remove(struct snd_card *card, struct file *file)
                if (card->free_on_last_close)
                        snd_card_do_free(card);
        }
-       if (!mfile) {
+       if (!found) {
                snd_printk(KERN_ERR "ALSA card file remove problem (%p)\n", file);
                return -ENOENT;
        }
-       kfree(mfile);
+       kfree(found);
        return 0;
 }
 
index 077a85262c1c2592c8323b6f249fc645aaf5ecc7..c8254c667c6247cef5e402161b0b1ef076782a5e 100644 (file)
 #include <sound/jack.h>
 #include <sound/core.h>
 
+static int jack_types[] = {
+       SW_HEADPHONE_INSERT,
+       SW_MICROPHONE_INSERT,
+       SW_LINEOUT_INSERT,
+       SW_JACK_PHYSICAL_INSERT,
+       SW_VIDEOOUT_INSERT,
+};
+
 static int snd_jack_dev_free(struct snd_device *device)
 {
        struct snd_jack *jack = device->device_data;
@@ -79,6 +87,7 @@ int snd_jack_new(struct snd_card *card, const char *id, int type,
 {
        struct snd_jack *jack;
        int err;
+       int i;
        static struct snd_device_ops ops = {
                .dev_free = snd_jack_dev_free,
                .dev_register = snd_jack_dev_register,
@@ -100,18 +109,10 @@ int snd_jack_new(struct snd_card *card, const char *id, int type,
 
        jack->type = type;
 
-       if (type & SND_JACK_HEADPHONE)
-               input_set_capability(jack->input_dev, EV_SW,
-                                    SW_HEADPHONE_INSERT);
-       if (type & SND_JACK_LINEOUT)
-               input_set_capability(jack->input_dev, EV_SW,
-                                    SW_LINEOUT_INSERT);
-       if (type & SND_JACK_MICROPHONE)
-               input_set_capability(jack->input_dev, EV_SW,
-                                    SW_MICROPHONE_INSERT);
-       if (type & SND_JACK_MECHANICAL)
-               input_set_capability(jack->input_dev, EV_SW,
-                                    SW_JACK_PHYSICAL_INSERT);
+       for (i = 0; i < ARRAY_SIZE(jack_types); i++)
+               if (type & (1 << i))
+                       input_set_capability(jack->input_dev, EV_SW,
+                                            jack_types[i]);
 
        err = snd_device_new(card, SNDRV_DEV_JACK, jack, &ops);
        if (err < 0)
@@ -154,21 +155,17 @@ EXPORT_SYMBOL(snd_jack_set_parent);
  */
 void snd_jack_report(struct snd_jack *jack, int status)
 {
+       int i;
+
        if (!jack)
                return;
 
-       if (jack->type & SND_JACK_HEADPHONE)
-               input_report_switch(jack->input_dev, SW_HEADPHONE_INSERT,
-                                   status & SND_JACK_HEADPHONE);
-       if (jack->type & SND_JACK_LINEOUT)
-               input_report_switch(jack->input_dev, SW_LINEOUT_INSERT,
-                                   status & SND_JACK_LINEOUT);
-       if (jack->type & SND_JACK_MICROPHONE)
-               input_report_switch(jack->input_dev, SW_MICROPHONE_INSERT,
-                                   status & SND_JACK_MICROPHONE);
-       if (jack->type & SND_JACK_MECHANICAL)
-               input_report_switch(jack->input_dev, SW_JACK_PHYSICAL_INSERT,
-                                   status & SND_JACK_MECHANICAL);
+       for (i = 0; i < ARRAY_SIZE(jack_types); i++) {
+               int testbit = 1 << i;
+               if (jack->type & testbit)
+                       input_report_switch(jack->input_dev, jack_types[i],
+                                           status & testbit);
+       }
 
        input_sync(jack->input_dev);
 }
index 38524f615d9428fc5f8614e9e6b5752eb430fc14..a9710e0c97afe74e800660fe1697c9d100c18539 100644 (file)
@@ -95,12 +95,14 @@ snd_pci_quirk_lookup(struct pci_dev *pci, const struct snd_pci_quirk *list)
 {
        const struct snd_pci_quirk *q;
 
-       for (q = list; q->subvendor; q++)
-               if (q->subvendor == pci->subsystem_vendor &&
-                   (!q->subdevice || q->subdevice == pci->