Merge tag 'sound-fix-3.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai...
authorLinus Torvalds <torvalds@linux-foundation.org>
Thu, 10 Apr 2014 16:19:44 +0000 (09:19 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 10 Apr 2014 16:19:44 +0000 (09:19 -0700)
Pull sound fixes from Takashi Iwai:
 "Here is a bunch of small fixes that have been collected since the
  previous pull request.  In addition to various misc fixes, the
  following are included:

   - HD-audio quirks for Dell, HP, Chromebook, and ALC28x codecs
   - HD-audio AMD HDMI regression fix
   - Continued PM support/fixes for ice1712 driver
   - Multiplatform fixes for ASoC samsung drivers
   - Addition of device id tables to a few ASoC drivers
   - Bit clock polarity config and error flag fixes in ASoC fsl_sai"

* tag 'sound-fix-3.15-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (32 commits)
  ALSA: usb-audio: Suppress repetitive debug messages from retire_playback_urb()
  ALSA: hda - Make full_reset boolean
  ALSA: hda - add headset mic detect quirk for a Dell laptop
  sound: dmasound: use module_platform_driver_probe()
  ALSA: au1x00: use module_platform_driver()
  ALSA: hda - Use runtime helper to check active state.
  ALSA: ice1712: Fix boundary checks in PCM pointer ops
  ASoC: davinci-mcasp: Fix bit clock polarity settings
  ASoC: samsung: Fix build on multiplatform
  ASoC: fsl_sai: Fix Bit Clock Polarity configurations
  ALSA: hda - Do not assign streams in reverse order
  ALSA: hda/realtek - Add eapd shutup to ALC283
  ALSA: hda/realtek - Change model name alias for ChromeOS
  ASoC: da732x: Print correct major id
  ALSA: hda/realtek - Improve HP depop when system change power state on Chromebook
  ASoC: cs42l52: Fix mask for REVID
  sound/oss: Remove uncompilable DBG macro use
  ALSA: ice1712: Save/restore routing and rate registers
  ALSA: ice1712: restore AK4xxx volumes on resume
  ASoC: alc56(23|32): fix undefined return value of probing code
  ...

41 files changed:
Documentation/devicetree/bindings/sound/fsl,ssi.txt
include/sound/cs8427.h
sound/i2c/cs8427.c
sound/mips/au1x00.c
sound/oss/ad1848.c
sound/oss/dmasound/dmasound_paula.c
sound/oss/opl3.c
sound/oss/pas2_mixer.c
sound/oss/pas2_pcm.c
sound/oss/sb_common.c
sound/oss/sb_ess.c
sound/oss/sequencer.c
sound/oss/sound_config.h
sound/oss/soundcard.c
sound/oss/uart401.c
sound/pci/hda/hda_controller.c
sound/pci/hda/hda_controller.h
sound/pci/hda/hda_intel.c
sound/pci/hda/patch_realtek.c
sound/pci/ice1712/delta.c
sound/pci/ice1712/ice1712.c
sound/soc/codecs/alc5623.c
sound/soc/codecs/alc5632.c
sound/soc/codecs/cs42l52.c
sound/soc/codecs/cs42l52.h
sound/soc/codecs/cs42xx8.c
sound/soc/codecs/da732x.c
sound/soc/codecs/max98090.c
sound/soc/codecs/rt5640.c
sound/soc/codecs/tlv320aic23-i2c.c
sound/soc/davinci/davinci-mcasp.c
sound/soc/fsl/fsl_sai.c
sound/soc/fsl/fsl_sai.h
sound/soc/samsung/ac97.c
sound/soc/samsung/dma.h
sound/soc/samsung/i2s.c
sound/soc/samsung/pcm.c
sound/soc/samsung/s3c2412-i2s.c
sound/soc/samsung/s3c24xx-i2s.c
sound/soc/samsung/spdif.c
sound/usb/pcm.c

index b93e9a91e30e2a5fc35e28dba0c5282d2e2c7a0e..3aa4a8f528f486b1b647e3720adbfef6068bbf6c 100644 (file)
@@ -20,15 +20,6 @@ Required properties:
                     have.
 - interrupt-parent: The phandle for the interrupt controller that
                     services interrupts for this device.
-- fsl,mode:         The operating mode for the SSI interface.
-                    "i2s-slave" - I2S mode, SSI is clock slave
-                    "i2s-master" - I2S mode, SSI is clock master
-                    "lj-slave" - left-justified mode, SSI is clock slave
-                    "lj-master" - l.j. mode, SSI is clock master
-                    "rj-slave" - right-justified mode, SSI is clock slave
-                    "rj-master" - r.j., SSI is clock master
-                    "ac97-slave" - AC97 mode, SSI is clock slave
-                    "ac97-master" - AC97 mode, SSI is clock master
 - fsl,playback-dma: Phandle to a node for the DMA channel to use for
                     playback of audio.  This is typically dictated by SOC
                     design.  See the notes below.
@@ -47,6 +38,9 @@ Required properties:
                     be connected together, and SRFS and STFS be connected
                     together.  This would still allow different sample sizes,
                     but not different sample rates.
+ - clocks:          "ipg" - Required clock for the SSI unit
+                    "baud" - Required clock for SSI master mode. Otherwise this
+                     clock is not used
 
 Required are also ac97 link bindings if ac97 is used. See
 Documentation/devicetree/bindings/sound/soc-ac97link.txt for the necessary
@@ -64,6 +58,15 @@ Optional properties:
                    Documentation/devicetree/bindings/dma/dma.txt.
 - dma-names:       Two dmas have to be defined, "tx" and "rx", if fsl,imx-fiq
                    is not defined.
+- fsl,mode:         The operating mode for the SSI interface.
+                    "i2s-slave" - I2S mode, SSI is clock slave
+                    "i2s-master" - I2S mode, SSI is clock master
+                    "lj-slave" - left-justified mode, SSI is clock slave
+                    "lj-master" - l.j. mode, SSI is clock master
+                    "rj-slave" - right-justified mode, SSI is clock slave
+                    "rj-master" - r.j., SSI is clock master
+                    "ac97-slave" - AC97 mode, SSI is clock slave
+                    "ac97-master" - AC97 mode, SSI is clock master
 
 Child 'codec' node required properties:
 - compatible:       Compatible list, contains the name of the codec
index f862cfff5f6a618daa1057836d30c9a73e0b5653..0b6a1876639ba3a9cfe5d656659a2b92279c80bb 100644 (file)
 
 struct snd_pcm_substream;
 
+int snd_cs8427_init(struct snd_i2c_bus *bus, struct snd_i2c_device *device);
 int snd_cs8427_create(struct snd_i2c_bus *bus, unsigned char addr,
                      unsigned int reset_timeout, struct snd_i2c_device **r_cs8427);
 int snd_cs8427_reg_write(struct snd_i2c_device *device, unsigned char reg,
index 6c2dc3863ac00c65b327ee58a0a7d281fb464740..7e21621e492a4b2c83e9f296d9f472a581eb97b2 100644 (file)
@@ -150,10 +150,8 @@ static void snd_cs8427_free(struct snd_i2c_device *device)
        kfree(device->private_data);
 }
 
-int snd_cs8427_create(struct snd_i2c_bus *bus,
-                     unsigned char addr,
-                     unsigned int reset_timeout,
-                     struct snd_i2c_device **r_cs8427)
+int snd_cs8427_init(struct snd_i2c_bus *bus,
+                   struct snd_i2c_device *device)
 {
        static unsigned char initvals1[] = {
          CS8427_REG_CONTROL1 | CS8427_REG_AUTOINC,
@@ -200,22 +198,10 @@ int snd_cs8427_create(struct snd_i2c_bus *bus,
             Inhibit E->F transfers. */
          CS8427_UD | CS8427_EFTUI | CS8427_DETUI,
        };
+       struct cs8427 *chip = device->private_data;
        int err;
-       struct cs8427 *chip;
-       struct snd_i2c_device *device;
        unsigned char buf[24];
 
-       if ((err = snd_i2c_device_create(bus, "CS8427",
-                                        CS8427_ADDR | (addr & 7),
-                                        &device)) < 0)
-               return err;
-       chip = device->private_data = kzalloc(sizeof(*chip), GFP_KERNEL);
-       if (chip == NULL) {
-               snd_i2c_device_free(device);
-               return -ENOMEM;
-       }
-       device->private_free = snd_cs8427_free;
-       
        snd_i2c_lock(bus);
        err = snd_cs8427_reg_read(device, CS8427_REG_ID_AND_VER);
        if (err != CS8427_VER8427A) {
@@ -264,10 +250,44 @@ int snd_cs8427_create(struct snd_i2c_bus *bus,
        snd_i2c_unlock(bus);
 
        /* turn on run bit and rock'n'roll */
+       snd_cs8427_reset(device);
+
+       return 0;
+
+__fail:
+       snd_i2c_unlock(bus);
+
+       return err;
+}
+EXPORT_SYMBOL(snd_cs8427_init);
+
+int snd_cs8427_create(struct snd_i2c_bus *bus,
+                     unsigned char addr,
+                     unsigned int reset_timeout,
+                     struct snd_i2c_device **r_cs8427)
+{
+       int err;
+       struct cs8427 *chip;
+       struct snd_i2c_device *device;
+
+       err = snd_i2c_device_create(bus, "CS8427", CS8427_ADDR | (addr & 7),
+                                   &device);
+       if (err < 0)
+               return err;
+       chip = device->private_data = kzalloc(sizeof(*chip), GFP_KERNEL);
+       if (chip == NULL) {
+               snd_i2c_device_free(device);
+               return -ENOMEM;
+       }
+       device->private_free = snd_cs8427_free;
+
        if (reset_timeout < 1)
                reset_timeout = 1;
        chip->reset_timeout = reset_timeout;
-       snd_cs8427_reset(device);
+
+       err = snd_cs8427_init(bus, device);
+       if (err)
+               goto __fail;
 
 #if 0  // it's nice for read tests
        {
@@ -286,7 +306,6 @@ int snd_cs8427_create(struct snd_i2c_bus *bus,
        return 0;
 
       __fail:
-       snd_i2c_unlock(bus);
        snd_i2c_device_free(device);
        return err < 0 ? err : -EIO;
 }
index a7cc49e960685d97f223accb9916f478a1e22e43..d10ef7675268c53e7b8276004d2b87bd857d9233 100644 (file)
@@ -725,15 +725,4 @@ struct platform_driver au1000_ac97c_driver = {
        .remove         = au1000_ac97_remove,
 };
 
-static int __init au1000_ac97_load(void)
-{
-       return platform_driver_register(&au1000_ac97c_driver);
-}
-
-static void __exit au1000_ac97_unload(void)
-{
-       platform_driver_unregister(&au1000_ac97c_driver);
-}
-
-module_init(au1000_ac97_load);
-module_exit(au1000_ac97_unload);
+module_platform_driver(au1000_ac97c_driver);
index 4918b7145b736ef16982bd72131f2b773c23dd79..ec1ee07df59d2ecd27dab0c2cfb204c1119389f6 100644 (file)
@@ -50,8 +50,6 @@
 #include <linux/pnp.h>
 #include <linux/spinlock.h>
 
-#define DEB(x)
-#define DEB1(x)
 #include "sound_config.h"
 
 #include "ad1848.h"
@@ -1016,8 +1014,6 @@ static void ad1848_close(int dev)
        ad1848_info    *devc = (ad1848_info *) audio_devs[dev]->devc;
        ad1848_port_info *portc = (ad1848_port_info *) audio_devs[dev]->portc;
 
-       DEB(printk("ad1848_close(void)\n"));
-
        devc->intr_active = 0;
        ad1848_halt(dev);
 
index 87910e9921332d770e5cd07d60434dd670b891fa..c2d45a5848bc92d0450ddb04e731636235aac8a0 100644 (file)
@@ -733,19 +733,7 @@ static struct platform_driver amiga_audio_driver = {
        },
 };
 
-static int __init amiga_audio_init(void)
-{
-       return platform_driver_probe(&amiga_audio_driver, amiga_audio_probe);
-}
-
-module_init(amiga_audio_init);
-
-static void __exit amiga_audio_exit(void)
-{
-       platform_driver_unregister(&amiga_audio_driver);
-}
-
-module_exit(amiga_audio_exit);
+module_platform_driver_probe(amiga_audio_driver, amiga_audio_probe);
 
 MODULE_LICENSE("GPL");
 MODULE_ALIAS("platform:amiga-audio");
index c5c24409ceb065b49d8f7bb05d010085e4588d47..4709e592e2ccccf854d8edc2b43304662573fbfa 100644 (file)
@@ -275,7 +275,6 @@ static int opl3_kill_note  (int devno, int voice, int note, int velocity)
         devc->v_alloc->map[voice] = 0;
 
         map = &pv_map[devc->lv_map[voice]];
-        DEB(printk("Kill note %d\n", voice));
 
         if (map->voice_mode == 0)
                 return 0;
@@ -873,8 +872,6 @@ static void opl3_aftertouch(int dev, int voice, int pressure)
 
        map = &pv_map[devc->lv_map[voice]];
 
-       DEB(printk("Aftertouch %d\n", voice));
-
        if (map->voice_mode == 0)
                return;
 
index a0bcb85c39046a8c4878b6367e6bd2cc938e2140..50b5bd5012479a8cf43e0a905649fefaf7562f23 100644 (file)
 
 #include "pas2.h"
 
-#ifndef DEB
-#define DEB(what)              /* (what) */
-#endif
-
 extern int      pas_translate_code;
 extern char     pas_model;
 extern int     *pas_osp;
@@ -120,8 +116,6 @@ pas_mixer_set(int whichDev, unsigned int level)
 {
        int             left, right, devmask, changed, i, mixer = 0;
 
-       DEB(printk("static int pas_mixer_set(int whichDev = %d, unsigned int level = %X)\n", whichDev, level));
-
        left = level & 0x7f;
        right = (level & 0x7f00) >> 8;
 
@@ -207,8 +201,6 @@ pas_mixer_reset(void)
 {
        int             foo;
 
-       DEB(printk("pas2_mixer.c: void pas_mixer_reset(void)\n"));
-
        for (foo = 0; foo < SOUND_MIXER_NRDEVICES; foo++)
                pas_mixer_set(foo, levels[foo]);
 
@@ -220,7 +212,6 @@ static int pas_mixer_ioctl(int dev, unsigned int cmd, void __user *arg)
        int level,v ;
        int __user *p = (int __user *)arg;
 
-       DEB(printk("pas2_mixer.c: int pas_mixer_ioctl(unsigned int cmd = %X, unsigned int arg = %X)\n", cmd, arg));
        if (cmd == SOUND_MIXER_PRIVATE1) { /* Set loudness bit */
                if (get_user(level, p))
                        return -EFAULT;
index 6f13ab4afc6bcf60537adb93936af23ff107db51..474803b52f7d2d932d97d44fd79327e227b9f4c0 100644 (file)
 
 #include "pas2.h"
 
-#ifndef DEB
-#define DEB(WHAT)
-#endif
-
 #define PAS_PCM_INTRBITS (0x08)
 /*
  * Sample buffer timer interrupt enable
@@ -156,8 +152,6 @@ static int pas_audio_ioctl(int dev, unsigned int cmd, void __user *arg)
        int val, ret;
        int __user *p = arg;
 
-       DEB(printk("pas2_pcm.c: static int pas_audio_ioctl(unsigned int cmd = %X, unsigned int arg = %X)\n", cmd, arg));
-
        switch (cmd) 
        {
        case SOUND_PCM_WRITE_RATE:
@@ -204,8 +198,6 @@ static int pas_audio_ioctl(int dev, unsigned int cmd, void __user *arg)
 
 static void pas_audio_reset(int dev)
 {
-       DEB(printk("pas2_pcm.c: static void pas_audio_reset(void)\n"));
-
        pas_write(pas_read(0xF8A) & ~0x40, 0xF8A);      /* Disable PCM */
 }
 
@@ -214,8 +206,6 @@ static int pas_audio_open(int dev, int mode)
        int             err;
        unsigned long   flags;
 
-       DEB(printk("pas2_pcm.c: static int pas_audio_open(int mode = %X)\n", mode));
-
        spin_lock_irqsave(&pas_lock, flags);
        if (pcm_busy)
        {
@@ -239,8 +229,6 @@ static void pas_audio_close(int dev)
 {
        unsigned long   flags;
 
-       DEB(printk("pas2_pcm.c: static void pas_audio_close(void)\n"));
-
        spin_lock_irqsave(&pas_lock, flags);
 
        pas_audio_reset(dev);
@@ -256,8 +244,6 @@ static void pas_audio_output_block(int dev, unsigned long buf, int count,
 {
        unsigned long   flags, cnt;
 
-       DEB(printk("pas2_pcm.c: static void pas_audio_output_block(char *buf = %P, int count = %X)\n", buf, count));
-
        cnt = count;
        if (audio_devs[dev]->dmap_out->dma > 3)
                cnt >>= 1;
@@ -303,8 +289,6 @@ static void pas_audio_start_input(int dev, unsigned long buf, int count,
        unsigned long   flags;
        int             cnt;
 
-       DEB(printk("pas2_pcm.c: static void pas_audio_start_input(char *buf = %P, int count = %X)\n", buf, count));
-
        cnt = count;
        if (audio_devs[dev]->dmap_out->dma > 3)
                cnt >>= 1;
@@ -388,8 +372,6 @@ static struct audio_driver pas_audio_driver =
 
 void __init pas_pcm_init(struct address_info *hw_config)
 {
-       DEB(printk("pas2_pcm.c: long pas_pcm_init()\n"));
-
        pcm_bitsok = 8;
        if (pas_read(0xEF8B) & 0x08)
                pcm_bitsok |= 16;
index 851a1da46be11f63140a8992bd423dc11df06990..3d50fb4236edfa158d15328168f13826db243504 100644 (file)
@@ -226,8 +226,6 @@ int sb_dsp_reset(sb_devc * devc)
 {
        int loopc;
 
-       DEB(printk("Entered sb_dsp_reset()\n"));
-
        if (devc->model == MDL_ESS) return ess_dsp_reset (devc);
 
        /* This is only for non-ESS chips */
@@ -246,8 +244,6 @@ int sb_dsp_reset(sb_devc * devc)
                return 0;       /* Sorry */
        }
 
-       DEB(printk("sb_dsp_reset() OK\n"));
-
        return 1;
 }
 
index 0e7254bde4c271cb9591724c2c8da0210c0d4426..b47a69026f1b08eee5744bd4649702d87594b3c1 100644 (file)
@@ -865,8 +865,6 @@ printk(KERN_INFO "FKS: ess_dsp_reset 1\n");
 ess_show_mixerregs (devc);
 #endif
 
-       DEB(printk("Entered ess_dsp_reset()\n"));
-
        outb(3, DSP_RESET); /* Reset FIFO too */
 
        udelay(10);
@@ -881,8 +879,6 @@ ess_show_mixerregs (devc);
        }
        ess_extended (devc);
 
-       DEB(printk("sb_dsp_reset() OK\n"));
-
 #ifdef FKS_LOGGING
 printk(KERN_INFO "FKS: dsp_reset 2\n");
 ess_show_mixerregs (devc);
index 9b9f7d385134253f3e5ceac1e10caa2f21fe06a7..c0eea1dfe90ff5448cf1c6c43be2ebddbf4edf8d 100644 (file)
@@ -216,8 +216,6 @@ int sequencer_write(int dev, struct file *file, const char __user *buf, int coun
 
        dev = dev >> 4;
 
-       DEB(printk("sequencer_write(dev=%d, count=%d)\n", dev, count));
-
        if (mode == OPEN_READ)
                return -EIO;
 
@@ -959,8 +957,6 @@ int sequencer_open(int dev, struct file *file)
        dev = dev >> 4;
        mode = translate_mode(file);
 
-       DEB(printk("sequencer_open(dev=%d)\n", dev));
-
        if (!sequencer_ok)
        {
 /*             printk("Sound card: sequencer not initialized\n");*/
@@ -1133,8 +1129,6 @@ void sequencer_release(int dev, struct file *file)
 
        dev = dev >> 4;
 
-       DEB(printk("sequencer_release(dev=%d)\n", dev));
-
        /*
         * Wait until the queue is empty (if we don't have nonblock)
         */
index 9d35c4c65b9b0f0f4eb8f1026f89344ae8528415..f2554ab78f5e5df8d3f12902be648c65ae3d85df 100644 (file)
@@ -123,10 +123,6 @@ static inline int translate_mode(struct file *file)
 #include "sound_calls.h"
 #include "dev_table.h"
 
-#ifndef DEB
-#define DEB(x)
-#endif
-
 #ifndef DDB
 #define DDB(x) do {} while (0)
 #endif
index e7780349cc55bec87b6fc3de603b3e29e2c27a54..b70c7c8f9c5d366dc41fce47e47c78339b8b1fd1 100644 (file)
@@ -154,7 +154,6 @@ static ssize_t sound_read(struct file *file, char __user *buf, size_t count, lof
         
        mutex_lock(&soundcard_mutex);
        
-       DEB(printk("sound_read(dev=%d, count=%d)\n", dev, count));
        switch (dev & 0x0f) {
        case SND_DEV_DSP:
        case SND_DEV_DSP16:
@@ -180,7 +179,6 @@ static ssize_t sound_write(struct file *file, const char __user *buf, size_t cou
        int ret = -EINVAL;
        
        mutex_lock(&soundcard_mutex);
-       DEB(printk("sound_write(dev=%d, count=%d)\n", dev, count));
        switch (dev & 0x0f) {
        case SND_DEV_SEQ:
        case SND_DEV_SEQ2:
@@ -206,7 +204,6 @@ static int sound_open(struct inode *inode, struct file *file)
        int dev = iminor(inode);
        int retval;
 
-       DEB(printk("sound_open(dev=%d)\n", dev));
        if ((dev >= SND_NDEVS) || (dev < 0)) {
                printk(KERN_ERR "Invalid minor device %d\n", dev);
                return -ENXIO;
@@ -257,7 +254,6 @@ static int sound_release(struct inode *inode, struct file *file)
        int dev = iminor(inode);
 
        mutex_lock(&soundcard_mutex);
-       DEB(printk("sound_release(dev=%d)\n", dev));
        switch (dev & 0x0f) {
        case SND_DEV_CTL:
                module_put(mixer_devs[dev >> 4]->owner);
@@ -351,7 +347,6 @@ static long sound_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
                        if (!access_ok(VERIFY_WRITE, p, len))
                                return -EFAULT;
        }
-       DEB(printk("sound_ioctl(dev=%d, cmd=0x%x, arg=0x%x)\n", dev, cmd, arg));
        if (cmd == OSS_GETVERSION)
                return __put_user(SOUND_VERSION, (int __user *)p);
        
@@ -409,7 +404,6 @@ static unsigned int sound_poll(struct file *file, poll_table * wait)
        struct inode *inode = file_inode(file);
        int dev = iminor(inode);
 
-       DEB(printk("sound_poll(dev=%d)\n", dev));
        switch (dev & 0x0f) {
        case SND_DEV_SEQ:
        case SND_DEV_SEQ2:
index 5433c6f5eca23cdcba47a6b8031767adaf586ac6..62b8869f5a4c43737dc3e89e9cc408c535676ed2 100644 (file)
@@ -274,19 +274,12 @@ static int reset_uart401(uart401_devc * devc)
                }
        }
 
-
+       /* Flush input before enabling interrupts */
        if (ok)
-       {
-               DEB(printk("Reset UART401 OK\n"));
-       }
+               uart401_input_loop(devc);
        else
                DDB(printk("Reset UART401 failed - No hardware detected.\n"));
 
-       if (ok)
-               uart401_input_loop(devc);       /*
-                                                * Flush input before enabling interrupts
-                                                */
-
        return ok;
 }
 
index 97993e17f46a76d5470269795c5b34998c563246..248b90abb8825a62e9530a0629cbf432898898d3 100644 (file)
@@ -187,13 +187,14 @@ azx_assign_device(struct azx *chip, struct snd_pcm_substream *substream)
                struct azx_dev *azx_dev = &chip->azx_dev[dev];
                dsp_lock(azx_dev);
                if (!azx_dev->opened && !dsp_is_locked(azx_dev)) {
-                       res = azx_dev;
-                       if (res->assigned_key == key) {
-                               res->opened = 1;
-                               res->assigned_key = key;
+                       if (azx_dev->assigned_key == key) {
+                               azx_dev->opened = 1;
+                               azx_dev->assigned_key = key;
                                dsp_unlock(azx_dev);
                                return azx_dev;
                        }
+                       if (!res)
+                               res = azx_dev;
                }
                dsp_unlock(azx_dev);
        }
@@ -1604,7 +1605,7 @@ static void azx_exit_link_reset(struct azx *chip)
 }
 
 /* reset codec link */
-static int azx_reset(struct azx *chip, int full_reset)
+static int azx_reset(struct azx *chip, bool full_reset)
 {
        if (!full_reset)
                goto __skip;
@@ -1701,7 +1702,7 @@ static void azx_int_clear(struct azx *chip)
 /*
  * reset and start the controller registers
  */
-void azx_init_chip(struct azx *chip, int full_reset)
+void azx_init_chip(struct azx *chip, bool full_reset)
 {
        if (chip->initialized)
                return;
@@ -1758,7 +1759,7 @@ irqreturn_t azx_interrupt(int irq, void *dev_id)
 
 #ifdef CONFIG_PM_RUNTIME
        if (chip->driver_caps & AZX_DCAPS_PM_RUNTIME)
-               if (chip->card->dev->power.runtime_status != RPM_ACTIVE)
+               if (!pm_runtime_active(chip->card->dev))
                        return IRQ_NONE;
 #endif
 
@@ -1841,7 +1842,7 @@ static void azx_bus_reset(struct hda_bus *bus)
 
        bus->in_reset = 1;
        azx_stop_chip(chip);
-       azx_init_chip(chip, 1);
+       azx_init_chip(chip, true);
 #ifdef CONFIG_PM
        if (chip->initialized) {
                struct azx_pcm *p;
@@ -1948,7 +1949,7 @@ int azx_codec_create(struct azx *chip, const char *model,
                                 * get back to the sanity state.
                                 */
                                azx_stop_chip(chip);
-                               azx_init_chip(chip, 1);
+                               azx_init_chip(chip, true);
                        }
                }
        }
index 1d2e3be2bae6c32149f8ac256d1086b73e036af2..baf0e77330afc47bc54a3ff1bc5e0006f878d9c2 100644 (file)
@@ -37,7 +37,7 @@ int azx_alloc_stream_pages(struct azx *chip);
 void azx_free_stream_pages(struct azx *chip);
 
 /* Low level azx interface */
-void azx_init_chip(struct azx *chip, int full_reset);
+void azx_init_chip(struct azx *chip, bool full_reset);
 void azx_stop_chip(struct azx *chip);
 void azx_enter_link_reset(struct azx *chip);
 irqreturn_t azx_interrupt(int irq, void *dev_id);
index 77ca894f82845964192cdc20476002f3cdec63a0..d6bca62ef387b92b499dcf5954d5c783543055d1 100644 (file)
@@ -636,7 +636,7 @@ static int azx_resume(struct device *dev)
                return -EIO;
        azx_init_pci(chip);
 
-       azx_init_chip(chip, 1);
+       azx_init_chip(chip, true);
 
        snd_hda_resume(chip->bus);
        snd_power_change_state(card, SNDRV_CTL_POWER_D0);
@@ -689,7 +689,7 @@ static int azx_runtime_resume(struct device *dev)
        status = azx_readw(chip, STATESTS);
 
        azx_init_pci(chip);
-       azx_init_chip(chip, 1);
+       azx_init_chip(chip, true);
 
        bus = chip->bus;
        if (status && bus) {
index ea2351d119f0a0ff5f10b722995eb0e7b4774688..14ae979a92eac7a68185a1ed08882eedf6af735e 100644 (file)
@@ -3026,6 +3026,11 @@ static void alc283_init(struct hda_codec *codec)
        bool hp_pin_sense;
        int val;
 
+       if (!spec->gen.autocfg.hp_outs) {
+               if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
+                       hp_pin = spec->gen.autocfg.line_out_pins[0];
+       }
+
        alc283_restore_default_value(codec);
 
        if (!hp_pin)
@@ -3062,6 +3067,11 @@ static void alc283_shutup(struct hda_codec *codec)
        bool hp_pin_sense;
        int val;
 
+       if (!spec->gen.autocfg.hp_outs) {
+               if (spec->gen.autocfg.line_out_type == AC_JACK_HP_OUT)
+                       hp_pin = spec->gen.autocfg.line_out_pins[0];
+       }
+
        if (!hp_pin) {
                alc269_shutup(codec);
                return;
@@ -3085,6 +3095,7 @@ static void alc283_shutup(struct hda_codec *codec)
 
        if (hp_pin_sense)
                msleep(100);
+       alc_auto_setup_eapd(codec, false);
        snd_hda_shutup_pins(codec);
        alc_write_coef_idx(codec, 0x43, 0x9614);
 }
@@ -3361,8 +3372,9 @@ static void alc269_fixup_mic_mute_hook(void *private_data, int enabled)
 
        if (spec->mute_led_polarity)
                enabled = !enabled;
-       pinval = AC_PINCTL_IN_EN |
-               (enabled ? AC_PINCTL_VREF_HIZ : AC_PINCTL_VREF_80);
+       pinval = snd_hda_codec_get_pin_target(codec, spec->mute_led_nid);
+       pinval &= ~AC_PINCTL_VREFEN;
+       pinval |= enabled ? AC_PINCTL_VREF_HIZ : AC_PINCTL_VREF_80;
        if (spec->mute_led_nid)
                snd_hda_set_pin_ctl_cache(codec, spec->mute_led_nid, pinval);
 }
@@ -3994,6 +4006,10 @@ static void alc283_fixup_chromebook(struct hda_codec *codec,
                spec->gen.mixer_nid = 0;
                break;
        case HDA_FIXUP_ACT_INIT:
+               /* MIC2-VREF control */
+               /* Set to manual mode */
+               val = alc_read_coef_idx(codec, 0x06);
+               alc_write_coef_idx(codec, 0x06, val & ~0x000c);
                /* Enable Line1 input control by verb */
                val = alc_read_coef_idx(codec, 0x1a);
                alc_write_coef_idx(codec, 0x1a, val | (1 << 4));
@@ -4602,6 +4618,7 @@ static const struct snd_pci_quirk alc269_fixup_tbl[] = {
        SND_PCI_QUIRK(0x1028, 0x0658, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
        SND_PCI_QUIRK(0x1028, 0x065f, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
        SND_PCI_QUIRK(0x1028, 0x0662, "Dell", ALC255_FIXUP_DELL1_MIC_NO_PRESENCE),
+       SND_PCI_QUIRK(0x1028, 0x0667, "Dell", ALC269_FIXUP_DELL1_MIC_NO_PRESENCE),
        SND_PCI_QUIRK(0x1028, 0x0668, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE),
        SND_PCI_QUIRK(0x1028, 0x0669, "Dell", ALC255_FIXUP_DELL2_MIC_NO_PRESENCE),
        SND_PCI_QUIRK(0x1028, 0x15cc, "Dell X5 Precision", ALC269_FIXUP_DELL2_MIC_NO_PRESENCE),
@@ -4768,7 +4785,7 @@ static const struct hda_model_fixup alc269_fixup_models[] = {
        {.id = ALC269_FIXUP_HP_GPIO_LED, .name = "hp-gpio-led"},
        {.id = ALC269_FIXUP_DELL1_MIC_NO_PRESENCE, .name = "dell-headset-multi"},
        {.id = ALC269_FIXUP_DELL2_MIC_NO_PRESENCE, .name = "dell-headset-dock"},
-       {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-chrome"},
+       {.id = ALC283_FIXUP_CHROME_BOOK, .name = "alc283-dac-wcaps"},
        {.id = ALC283_FIXUP_SENSE_COMBO_JACK, .name = "alc283-sense-combo"},
        {}
 };
index ed2144eee38ac872d80e263953733639630169b2..496dbd0ad5dbb3247c7845b21de7a37b2fd11d3d 100644 (file)
@@ -579,12 +579,37 @@ static struct snd_ak4xxx_private akm_vx442_priv = {
 #ifdef CONFIG_PM_SLEEP
 static int snd_ice1712_delta_resume(struct snd_ice1712 *ice)
 {
-       unsigned char akm_backup[AK4XXX_IMAGE_SIZE];
+       unsigned char akm_img_bak[AK4XXX_IMAGE_SIZE];
+       unsigned char akm_vol_bak[AK4XXX_IMAGE_SIZE];
+
+       /* init spdif */
+       switch (ice->eeprom.subvendor) {
+       case ICE1712_SUBDEVICE_AUDIOPHILE:
+       case ICE1712_SUBDEVICE_DELTA410:
+       case ICE1712_SUBDEVICE_DELTA1010E:
+       case ICE1712_SUBDEVICE_DELTA1010LT:
+       case ICE1712_SUBDEVICE_VX442:
+       case ICE1712_SUBDEVICE_DELTA66E:
+               snd_cs8427_init(ice->i2c, ice->cs8427);
+               break;
+       case ICE1712_SUBDEVICE_DELTA1010:
+       case ICE1712_SUBDEVICE_MEDIASTATION:
+               /* nothing */
+               break;
+       case ICE1712_SUBDEVICE_DELTADIO2496:
+       case ICE1712_SUBDEVICE_DELTA66:
+               /* Set spdif defaults */
+               snd_ice1712_delta_cs8403_spdif_write(ice, ice->spdif.cs8403_bits);
+               break;
+       }
+
        /* init codec and restore registers */
        if (ice->akm_codecs) {
-               memcpy(akm_backup, ice->akm->images, sizeof(akm_backup));
+               memcpy(akm_img_bak, ice->akm->images, sizeof(akm_img_bak));
+               memcpy(akm_vol_bak, ice->akm->volumes, sizeof(akm_vol_bak));
                snd_akm4xxx_init(ice->akm);
-               memcpy(ice->akm->images, akm_backup, sizeof(akm_backup));
+               memcpy(ice->akm->images, akm_img_bak, sizeof(akm_img_bak));
+               memcpy(ice->akm->volumes, akm_vol_bak, sizeof(akm_vol_bak));
                snd_akm4xxx_reset(ice->akm, 0);
        }
 
index 291672fc4a99f2428c171c9a57955280776df209..d9b9e4595f1717a97e2f19127c0c21057b5d209c 100644 (file)
@@ -685,9 +685,10 @@ static snd_pcm_uframes_t snd_ice1712_playback_pointer(struct snd_pcm_substream *
        if (!(snd_ice1712_read(ice, ICE1712_IREG_PBK_CTRL) & 1))
                return 0;
        ptr = runtime->buffer_size - inw(ice->ddma_port + 4);
+       ptr = bytes_to_frames(substream->runtime, ptr);
        if (ptr == runtime->buffer_size)
                ptr = 0;
-       return bytes_to_frames(substream->runtime, ptr);
+       return ptr;
 }
 
 static snd_pcm_uframes_t snd_ice1712_playback_ds_pointer(struct snd_pcm_substream *substream)
@@ -704,9 +705,10 @@ static snd_pcm_uframes_t snd_ice1712_playback_ds_pointer(struct snd_pcm_substrea
                addr = ICE1712_DSC_ADDR0;
        ptr = snd_ice1712_ds_read(ice, substream->number * 2, addr) -
                ice->playback_con_virt_addr[substream->number];
+       ptr = bytes_to_frames(substream->runtime, ptr);
        if (ptr == substream->runtime->buffer_size)
                ptr = 0;
-       return bytes_to_frames(substream->runtime, ptr);
+       return ptr;
 }
 
 static snd_pcm_uframes_t snd_ice1712_capture_pointer(struct snd_pcm_substream *substream)
@@ -717,9 +719,10 @@ static snd_pcm_uframes_t snd_ice1712_capture_pointer(struct snd_pcm_substream *s
        if (!(snd_ice1712_read(ice, ICE1712_IREG_CAP_CTRL) & 1))
                return 0;
        ptr = inl(ICEREG(ice, CONCAP_ADDR)) - ice->capture_con_virt_addr;
+       ptr = bytes_to_frames(substream->runtime, ptr);
        if (ptr == substream->runtime->buffer_size)
                ptr = 0;
-       return bytes_to_frames(substream->runtime, ptr);
+       return ptr;
 }
 
 static const struct snd_pcm_hardware snd_ice1712_playback = {
@@ -1048,6 +1051,8 @@ __out:
        old = inb(ICEMT(ice, RATE));
        if (!force && old == val)
                goto __out;
+
+       ice->cur_rate = rate;
        outb(val, ICEMT(ice, RATE));
        spin_unlock_irqrestore(&ice->reg_lock, flags);
 
@@ -1114,9 +1119,10 @@ static snd_pcm_uframes_t snd_ice1712_playback_pro_pointer(struct snd_pcm_substre
        if (!(inl(ICEMT(ice, PLAYBACK_CONTROL)) & ICE1712_PLAYBACK_START))
                return 0;
        ptr = ice->playback_pro_size - (inw(ICEMT(ice, PLAYBACK_SIZE)) << 2);
+       ptr = bytes_to_frames(substream->runtime, ptr);
        if (ptr == substream->runtime->buffer_size)
                ptr = 0;
-       return bytes_to_frames(substream->runtime, ptr);
+       return ptr;
 }
 
 static snd_pcm_uframes_t snd_ice1712_capture_pro_pointer(struct snd_pcm_substream *substream)
@@ -1127,9 +1133,10 @@ static snd_pcm_uframes_t snd_ice1712_capture_pro_pointer(struct snd_pcm_substrea
        if (!(inl(ICEMT(ice, PLAYBACK_CONTROL)) & ICE1712_CAPTURE_START_SHADOW))
                return 0;
        ptr = ice->capture_pro_size - (inw(ICEMT(ice, CAPTURE_SIZE)) << 2);
+       ptr = bytes_to_frames(substream->runtime, ptr);
        if (ptr == substream->runtime->buffer_size)
                ptr = 0;
-       return bytes_to_frames(substream->runtime, ptr);
+       return ptr;
 }
 
 static const struct snd_pcm_hardware snd_ice1712_playback_pro = {
@@ -2832,6 +2839,12 @@ static int snd_ice1712_suspend(struct device *dev)
        snd_pcm_suspend_all(ice->pcm_ds);
        snd_ac97_suspend(ice->ac97);
 
+       spin_lock_irq(&ice->reg_lock);
+       ice->pm_saved_is_spdif_master = is_spdif_master(ice);
+       ice->pm_saved_spdif_ctrl = inw(ICEMT(ice, ROUTE_SPDOUT));
+       ice->pm_saved_route = inw(ICEMT(ice, ROUTE_PSDOUT03));
+       spin_unlock_irq(&ice->reg_lock);
+
        if (ice->pm_suspend)
                ice->pm_suspend(ice);
 
@@ -2846,6 +2859,7 @@ static int snd_ice1712_resume(struct device *dev)
        struct pci_dev *pci = to_pci_dev(dev);
        struct snd_card *card = dev_get_drvdata(dev);
        struct snd_ice1712 *ice = card->private_data;
+       int rate;
 
        if (!ice->pm_suspend_enabled)
                return 0;
@@ -2860,14 +2874,37 @@ static int snd_ice1712_resume(struct device *dev)
 
        pci_set_master(pci);
 
+       if (ice->cur_rate)
+               rate = ice->cur_rate;
+       else
+               rate = PRO_RATE_DEFAULT;
+
        if (snd_ice1712_chip_init(ice) < 0) {
                snd_card_disconnect(card);
                return -EIO;
        }
 
+       ice->cur_rate = rate;
+
        if (ice->pm_resume)
                ice->pm_resume(ice);
 
+       if (ice->pm_saved_is_spdif_master) {
+               /* switching to external clock via SPDIF */
+               spin_lock_irq(&ice->reg_lock);
+               outb(inb(ICEMT(ice, RATE)) | ICE1712_SPDIF_MASTER,
+                       ICEMT(ice, RATE));
+               spin_unlock_irq(&ice->reg_lock);
+               snd_ice1712_set_input_clock_source(ice, 1);
+       } else {
+               /* internal on-card clock */
+               snd_ice1712_set_pro_rate(ice, rate, 1);
+               snd_ice1712_set_input_clock_source(ice, 0);
+       }
+
+       outw(ice->pm_saved_spdif_ctrl, ICEMT(ice, ROUTE_SPDOUT));
+       outw(ice->pm_saved_route, ICEMT(ice, ROUTE_PSDOUT03));
+
        if (ice->ac97)
                snd_ac97_resume(ice->ac97);
 
index 09f7e773bafb8721619843c187be4c24b06af73e..f500905e9373510d2bcfdb583b0569cec5994708 100644 (file)
@@ -902,7 +902,6 @@ static int alc5623_probe(struct snd_soc_codec *codec)
 {
        struct alc5623_priv *alc5623 = snd_soc_codec_get_drvdata(codec);
        struct snd_soc_dapm_context *dapm = &codec->dapm;
-       int ret;
 
        alc5623_reset(codec);
 
@@ -961,7 +960,7 @@ static int alc5623_probe(struct snd_soc_codec *codec)
                return -EINVAL;
        }
 
-       return ret;
+       return 0;
 }
 
 /* power down chip */
index ec071a6306ef567fb37b8c97981b64d1b3390f9e..85942ca36cbfaf9df6fcc2007e719e2c89b0551c 100644 (file)
@@ -1061,7 +1061,6 @@ static int alc5632_resume(struct snd_soc_codec *codec)
 static int alc5632_probe(struct snd_soc_codec *codec)
 {
        struct alc5632_priv *alc5632 = snd_soc_codec_get_drvdata(codec);
-       int ret;
 
        /* power on device  */
        alc5632_set_bias_level(codec, SND_SOC_BIAS_STANDBY);
@@ -1075,7 +1074,7 @@ static int alc5632_probe(struct snd_soc_codec *codec)
                return -EINVAL;
        }
 
-       return ret;
+       return 0;
 }
 
 /* power down chip */
@@ -1191,11 +1190,18 @@ static const struct i2c_device_id alc5632_i2c_table[] = {
 };
 MODULE_DEVICE_TABLE(i2c, alc5632_i2c_table);
 
+static const struct of_device_id alc5632_of_match[] = {
+       { .compatible = "realtek,alc5632", },
+       { }
+};
+MODULE_DEVICE_TABLE(of, alc5632_of_match);
+
 /* i2c codec control layer */
 static struct i2c_driver alc5632_i2c_driver = {
        .driver = {
                .name = "alc5632",
                .owner = THIS_MODULE,
+               .of_match_table = of_match_ptr(alc5632_of_match),
        },
        .probe = alc5632_i2c_probe,
        .remove =  alc5632_i2c_remove,
index f0ca6bee677159e0bb9a6af0a660bb937b815b7d..460d35547a683d226521591333ce06fe1c5de634 100644 (file)
@@ -1259,7 +1259,7 @@ static int cs42l52_i2c_probe(struct i2c_client *i2c_client,
        }
 
        dev_info(&i2c_client->dev, "Cirrus Logic CS42L52, Revision: %02X\n",
-                       reg & 0xFF);
+                reg & CS42L52_CHIP_REV_MASK);
 
        /* Set Platform Data */
        if (cs42l52->pdata.mica_diff_cfg)
index 6fb8f00f4191a7ad890f387c40dc4711dbbfddab..ac445993e6bf98a090b6489fc2e4bd3c3d715366 100644 (file)
@@ -37,7 +37,7 @@
 #define CS42L52_CHIP_REV_A0                    0x00
 #define CS42L52_CHIP_REV_A1                    0x01
 #define CS42L52_CHIP_REV_B0                    0x02
-#define CS42L52_CHIP_REV_MASK                  0x03
+#define CS42L52_CHIP_REV_MASK                  0x07
 
 #define CS42L52_PWRCTL1                                0x02
 #define CS42L52_PWRCTL1_PDN_ALL                        0x9F
index 082299a4e2faccd9f28db0d60b30f8849eff47b6..85020322eee7590ad8ae132f24fc133ea6e6340b 100644 (file)
@@ -495,17 +495,16 @@ int cs42xx8_probe(struct device *dev, struct regmap *regmap)
        regcache_cache_bypass(cs42xx8->regmap, true);
 
        /* Validate the chip ID */
-       regmap_read(cs42xx8->regmap, CS42XX8_CHIPID, &val);
-       if (val < 0) {
-               dev_err(dev, "failed to get device ID: %x", val);
-               ret = -EINVAL;
+       ret = regmap_read(cs42xx8->regmap, CS42XX8_CHIPID, &val);
+       if (ret < 0) {
+               dev_err(dev, "failed to get device ID, ret = %d", ret);
                goto err_enable;
        }
 
        /* The top four bits of the chip ID should be 0000 */
-       if ((val & CS42XX8_CHIPID_CHIP_ID_MASK) != 0x00) {
+       if (((val & CS42XX8_CHIPID_CHIP_ID_MASK) >> 4) != 0x00) {
                dev_err(dev, "unmatched chip ID: %d\n",
-                               val & CS42XX8_CHIPID_CHIP_ID_MASK);
+                       (val & CS42XX8_CHIPID_CHIP_ID_MASK) >> 4);
                ret = -EINVAL;
                goto err_enable;
        }
index 7d168ec71cd70409095ee82fb95ec8a929601f98..48f3fef6848451cecb80c586a742d4ccaa619dbd 100644 (file)
@@ -1571,7 +1571,8 @@ static int da732x_i2c_probe(struct i2c_client *i2c,
        }
 
        dev_info(&i2c->dev, "Revision: %d.%d\n",
-                (reg & DA732X_ID_MAJOR_MASK), (reg & DA732X_ID_MINOR_MASK));
+                (reg & DA732X_ID_MAJOR_MASK) >> 4,
+                (reg & DA732X_ID_MINOR_MASK));
 
        ret = snd_soc_register_codec(&i2c->dev, &soc_codec_dev_da732x,
                                     da732x_dai, ARRAY_SIZE(da732x_dai));
index 98c6e104357cbe59416f8d602a24ec63e1b68696..f7b0b37aa85827e7cd45a8afda039078c7079f0e 100644 (file)
@@ -2399,11 +2399,18 @@ static const struct i2c_device_id max98090_i2c_id[] = {
 };
 MODULE_DEVICE_TABLE(i2c, max98090_i2c_id);
 
+static const struct of_device_id max98090_of_match[] = {
+       { .compatible = "maxim,max98090", },
+       { }
+};
+MODULE_DEVICE_TABLE(of, max98090_of_match);
+
 static struct i2c_driver max98090_i2c_driver = {
        .driver = {
                .name = "max98090",
                .owner = THIS_MODULE,
                .pm = &max98090_pm,
+               .of_match_table = of_match_ptr(max98090_of_match),
        },
        .probe  = max98090_i2c_probe,
        .remove = max98090_i2c_remove,
index 0061ae6b671673e43615bcd9ebfeef001df487b2..68b4dd622b879364bc0ae26035695a8b7604d9fa 100644 (file)
@@ -2074,6 +2074,14 @@ static const struct i2c_device_id rt5640_i2c_id[] = {
 };
 MODULE_DEVICE_TABLE(i2c, rt5640_i2c_id);
 
+#if defined(CONFIG_OF)
+static const struct of_device_id rt5640_of_match[] = {
+       { .compatible = "realtek,rt5640", },
+       {},
+};
+MODULE_DEVICE_TABLE(of, rt5640_of_match);
+#endif
+
 #ifdef CONFIG_ACPI
 static struct acpi_device_id rt5640_acpi_match[] = {
        { "INT33CA", 0 },
@@ -2203,6 +2211,7 @@ static struct i2c_driver rt5640_i2c_driver = {
                .name = "rt5640",
                .owner = THIS_MODULE,
                .acpi_match_table = ACPI_PTR(rt5640_acpi_match),
+               .of_match_table = of_match_ptr(rt5640_of_match),
        },
        .probe = rt5640_i2c_probe,
        .remove   = rt5640_i2c_remove,
index 20fc46092c2c4a396791ea4c46ddf95def3ebfdd..b73c94ebcc2a0de02710b5e9f69c2cbbfdd8b814 100644 (file)
@@ -43,9 +43,16 @@ static const struct i2c_device_id tlv320aic23_id[] = {
 
 MODULE_DEVICE_TABLE(i2c, tlv320aic23_id);
 
+static const struct of_device_id tlv320aic23_of_match[] = {
+       { .compatible = "ti,tlv320aic23", },
+       { }
+};
+MODULE_DEVICE_TABLE(of, tlv320aic23_of_match);
+
 static struct i2c_driver tlv320aic23_i2c_driver = {
        .driver = {
                   .name = "tlv320aic23-codec",
+                  .of_match_table = of_match_ptr(tlv320aic23_of_match),
                   },
        .probe = tlv320aic23_i2c_probe,
        .remove = __exit_p(tlv320aic23_i2c_remove),
index a01ae97c90aae4aba50ccf21184adb1a519f7dcc..4f75cac462d1578eed311a0952b305302b369b95 100644 (file)
@@ -336,7 +336,7 @@ static int davinci_mcasp_set_dai_fmt(struct snd_soc_dai *cpu_dai,
                mcasp_clr_bits(mcasp, DAVINCI_MCASP_ACLKXCTL_REG, ACLKXPOL);
                mcasp_clr_bits(mcasp, DAVINCI_MCASP_TXFMCTL_REG, FSXPOL);
 
-               mcasp_set_bits(mcasp, DAVINCI_MCASP_ACLKRCTL_REG, ACLKRPOL);
+               mcasp_clr_bits(mcasp, DAVINCI_MCASP_ACLKRCTL_REG, ACLKRPOL);
                mcasp_clr_bits(mcasp, DAVINCI_MCASP_RXFMCTL_REG, FSRPOL);
                break;
 
@@ -344,7 +344,7 @@ static int davinci_mcasp_set_dai_fmt(struct snd_soc_dai *cpu_dai,
                mcasp_set_bits(mcasp, DAVINCI_MCASP_ACLKXCTL_REG, ACLKXPOL);
                mcasp_set_bits(mcasp, DAVINCI_MCASP_TXFMCTL_REG, FSXPOL);
 
-               mcasp_clr_bits(mcasp, DAVINCI_MCASP_ACLKRCTL_REG, ACLKRPOL);
+               mcasp_set_bits(mcasp, DAVINCI_MCASP_ACLKRCTL_REG, ACLKRPOL);
                mcasp_set_bits(mcasp, DAVINCI_MCASP_RXFMCTL_REG, FSRPOL);
                break;
 
@@ -352,7 +352,7 @@ static int davinci_mcasp_set_dai_fmt(struct snd_soc_dai *cpu_dai,
                mcasp_clr_bits(mcasp, DAVINCI_MCASP_ACLKXCTL_REG, ACLKXPOL);
                mcasp_set_bits(mcasp, DAVINCI_MCASP_TXFMCTL_REG, FSXPOL);
 
-               mcasp_set_bits(mcasp, DAVINCI_MCASP_ACLKRCTL_REG, ACLKRPOL);
+               mcasp_clr_bits(mcasp, DAVINCI_MCASP_ACLKRCTL_REG, ACLKRPOL);
                mcasp_set_bits(mcasp, DAVINCI_MCASP_RXFMCTL_REG, FSRPOL);
                break;
 
index c4a42311167371446cfd5e24b2c23c418e796627..56da8c8c5960bd0ef99b405560081580a2bd0571 100644 (file)
 
 #include "fsl_sai.h"
 
+#define FSL_SAI_FLAGS (FSL_SAI_CSR_SEIE |\
+                      FSL_SAI_CSR_FEIE)
+
+static irqreturn_t fsl_sai_isr(int irq, void *devid)
+{
+       struct fsl_sai *sai = (struct fsl_sai *)devid;
+       struct device *dev = &sai->pdev->dev;
+       u32 xcsr, mask;
+
+       /* Only handle those what we enabled */
+       mask = (FSL_SAI_FLAGS >> FSL_SAI_CSR_xIE_SHIFT) << FSL_SAI_CSR_xF_SHIFT;
+
+       /* Tx IRQ */
+       regmap_read(sai->regmap, FSL_SAI_TCSR, &xcsr);
+       xcsr &= mask;
+
+       if (xcsr & FSL_SAI_CSR_WSF)
+               dev_dbg(dev, "isr: Start of Tx word detected\n");
+
+       if (xcsr & FSL_SAI_CSR_SEF)
+               dev_warn(dev, "isr: Tx Frame sync error detected\n");
+
+       if (xcsr & FSL_SAI_CSR_FEF) {
+               dev_warn(dev, "isr: Transmit underrun detected\n");
+               /* FIFO reset for safety */
+               xcsr |= FSL_SAI_CSR_FR;
+       }
+
+       if (xcsr & FSL_SAI_CSR_FWF)
+               dev_dbg(dev, "isr: Enabled transmit FIFO is empty\n");
+
+       if (xcsr & FSL_SAI_CSR_FRF)
+               dev_dbg(dev, "isr: Transmit FIFO watermark has been reached\n");
+
+       regmap_update_bits(sai->regmap, FSL_SAI_TCSR,
+                          FSL_SAI_CSR_xF_W_MASK | FSL_SAI_CSR_FR, xcsr);
+
+       /* Rx IRQ */
+       regmap_read(sai->regmap, FSL_SAI_RCSR, &xcsr);
+       xcsr &= mask;
+
+       if (xcsr & FSL_SAI_CSR_WSF)
+               dev_dbg(dev, "isr: Start of Rx word detected\n");
+
+       if (xcsr & FSL_SAI_CSR_SEF)
+               dev_warn(dev, "isr: Rx Frame sync error detected\n");
+
+       if (xcsr & FSL_SAI_CSR_FEF) {
+               dev_warn(dev, "isr: Receive overflow detected\n");
+               /* FIFO reset for safety */
+               xcsr |= FSL_SAI_CSR_FR;
+       }
+
+       if (xcsr & FSL_SAI_CSR_FWF)
+               dev_dbg(dev, "isr: Enabled receive FIFO is full\n");
+
+       if (xcsr & FSL_SAI_CSR_FRF)
+               dev_dbg(dev, "isr: Receive FIFO watermark has been reached\n");
+
+       regmap_update_bits(sai->regmap, FSL_SAI_RCSR,
+                          FSL_SAI_CSR_xF_W_MASK | FSL_SAI_CSR_FR, xcsr);
+
+       return IRQ_HANDLED;
+}
+
 static int fsl_sai_set_dai_sysclk_tr(struct snd_soc_dai *cpu_dai,
                int clk_id, unsigned int freq, int fsl_dir)
 {
@@ -114,7 +179,7 @@ static int fsl_sai_set_dai_fmt_tr(struct snd_soc_dai *cpu_dai,
                 * that is, together with the last bit of the previous
                 * data word.
                 */
-               val_cr2 &= ~FSL_SAI_CR2_BCP;
+               val_cr2 |= FSL_SAI_CR2_BCP;
                val_cr4 |= FSL_SAI_CR4_FSE | FSL_SAI_CR4_FSP;
                break;
        case SND_SOC_DAIFMT_LEFT_J:
@@ -122,7 +187,7 @@ static int fsl_sai_set_dai_fmt_tr(struct snd_soc_dai *cpu_dai,
                 * Frame high, one word length for frame sync,
                 * frame sync asserts with the first bit of the frame.
                 */
-               val_cr2 &= ~FSL_SAI_CR2_BCP;
+               val_cr2 |= FSL_SAI_CR2_BCP;
                val_cr4 &= ~(FSL_SAI_CR4_FSE | FSL_SAI_CR4_FSP);
                break;
        case SND_SOC_DAIFMT_DSP_A:
@@ -132,7 +197,7 @@ static int fsl_sai_set_dai_fmt_tr(struct snd_soc_dai *cpu_dai,
                 * that is, together with the last bit of the previous
                 * data word.
                 */
-               val_cr2 &= ~FSL_SAI_CR2_BCP;
+               val_cr2 |= FSL_SAI_CR2_BCP;
                val_cr4 &= ~FSL_SAI_CR4_FSP;
                val_cr4 |= FSL_SAI_CR4_FSE;
                sai->is_dsp_mode = true;
@@ -142,7 +207,7 @@ static int fsl_sai_set_dai_fmt_tr(struct snd_soc_dai *cpu_dai,
                 * Frame high, one bit for frame sync,
                 * frame sync asserts with the first bit of the frame.
                 */
-               val_cr2 &= ~FSL_SAI_CR2_BCP;
+               val_cr2 |= FSL_SAI_CR2_BCP;
                val_cr4 &= ~(FSL_SAI_CR4_FSE | FSL_SAI_CR4_FSP);
                sai->is_dsp_mode = true;
                break;
@@ -373,8 +438,8 @@ static int fsl_sai_dai_probe(struct snd_soc_dai *cpu_dai)
 {
        struct fsl_sai *sai = dev_get_drvdata(cpu_dai->dev);
 
-       regmap_update_bits(sai->regmap, FSL_SAI_TCSR, 0xffffffff, 0x0);
-       regmap_update_bits(sai->regmap, FSL_SAI_RCSR, 0xffffffff, 0x0);
+       regmap_update_bits(sai->regmap, FSL_SAI_TCSR, 0xffffffff, FSL_SAI_FLAGS);
+       regmap_update_bits(sai->regmap, FSL_SAI_RCSR, 0xffffffff, FSL_SAI_FLAGS);
        regmap_update_bits(sai->regmap, FSL_SAI_TCR1, FSL_SAI_CR1_RFW_MASK,
                           FSL_SAI_MAXBURST_TX * 2);
        regmap_update_bits(sai->regmap, FSL_SAI_RCR1, FSL_SAI_CR1_RFW_MASK,
@@ -490,12 +555,14 @@ static int fsl_sai_probe(struct platform_device *pdev)
        struct fsl_sai *sai;
        struct resource *res;
        void __iomem *base;
-       int ret;
+       int irq, ret;
 
        sai = devm_kzalloc(&pdev->dev, sizeof(*sai), GFP_KERNEL);
        if (!sai)
                return -ENOMEM;
 
+       sai->pdev = pdev;
+
        sai->big_endian_regs = of_property_read_bool(np, "big-endian-regs");
        if (sai->big_endian_regs)
                fsl_sai_regmap_config.val_format_endian = REGMAP_ENDIAN_BIG;
@@ -514,6 +581,18 @@ static int fsl_sai_probe(struct platform_device *pdev)
                return PTR_ERR(sai->regmap);
        }
 
+       irq = platform_get_irq(pdev, 0);
+       if (irq < 0) {
+               dev_err(&pdev->dev, "no irq for node %s\n", np->full_name);
+               return irq;
+       }
+
+       ret = devm_request_irq(&pdev->dev, irq, fsl_sai_isr, 0, np->name, sai);
+       if (ret) {
+               dev_err(&pdev->dev, "failed to claim irq %u\n", irq);
+               return ret;
+       }
+
        sai->dma_params_rx.addr = res->start + FSL_SAI_RDR;
        sai->dma_params_tx.addr = res->start + FSL_SAI_TDR;
        sai->dma_params_rx.maxburst = FSL_SAI_MAXBURST_RX;
index e432260be598ed2cabebbdadcbb60730d96166ed..a264185c7138508451b602e7ece7d89d354b2ff1 100644 (file)
 
 /* SAI Transmit/Recieve Control Register */
 #define FSL_SAI_CSR_TERE       BIT(31)
+#define FSL_SAI_CSR_FR         BIT(25)
+#define FSL_SAI_CSR_xF_SHIFT   16
+#define FSL_SAI_CSR_xF_W_SHIFT 18
+#define FSL_SAI_CSR_xF_MASK    (0x1f << FSL_SAI_CSR_xF_SHIFT)
+#define FSL_SAI_CSR_xF_W_MASK  (0x7 << FSL_SAI_CSR_xF_W_SHIFT)
+#define FSL_SAI_CSR_WSF                BIT(20)
+#define FSL_SAI_CSR_SEF                BIT(19)
+#define FSL_SAI_CSR_FEF                BIT(18)
 #define FSL_SAI_CSR_FWF                BIT(17)
+#define FSL_SAI_CSR_FRF                BIT(16)
+#define FSL_SAI_CSR_xIE_SHIFT  8
+#define FSL_SAI_CSR_WSIE       BIT(12)
+#define FSL_SAI_CSR_SEIE       BIT(11)
+#define FSL_SAI_CSR_FEIE       BIT(10)
+#define FSL_SAI_CSR_FWIE       BIT(9)
 #define FSL_SAI_CSR_FRIE       BIT(8)
 #define FSL_SAI_CSR_FRDE       BIT(0)
 
 #define FSL_SAI_MAXBURST_RX 6
 
 struct fsl_sai {
+       struct platform_device *pdev;
        struct regmap *regmap;
 
        bool big_endian_regs;
index 4a88e36c82ec1c827d7cd8658e0223991a3b621f..76b072bd4ba25eb9ba926d56cefc3702c45e5a17 100644 (file)
@@ -39,15 +39,15 @@ struct s3c_ac97_info {
 };
 static struct s3c_ac97_info s3c_ac97;
 
-static struct s3c2410_dma_client s3c_dma_client_out = {
+static struct s3c_dma_client s3c_dma_client_out = {
        .name = "AC97 PCMOut"
 };
 
-static struct s3c2410_dma_client s3c_dma_client_in = {
+static struct s3c_dma_client s3c_dma_client_in = {
        .name = "AC97 PCMIn"
 };
 
-static struct s3c2410_dma_client s3c_dma_client_micin = {
+static struct s3c_dma_client s3c_dma_client_micin = {
        .name = "AC97 MicIn"
 };
 
index 225e5378014eca4395d4481c77ddf2c1632b31a3..ad7c0f04f00d59529163e292146b3c6641d391d7 100644 (file)
 
 #include <sound/dmaengine_pcm.h>
 
+struct s3c_dma_client {
+       char *name;
+};
+
 struct s3c_dma_params {
-       struct s3c2410_dma_client *client;      /* stream identifier */
+       struct s3c_dma_client *client;  /* stream identifier */
        int channel;                            /* Channel ID */
        dma_addr_t dma_addr;
        int dma_size;                   /* Size of the DMA transfer */
index 0a9b44c940cee4c962942d23ecccd85466cc56b8..048ead96719984f85b2b1bc048e2c81b30cc9fb3 100644 (file)
@@ -1211,10 +1211,10 @@ static int samsung_i2s_probe(struct platform_device *pdev)
        pri_dai->dma_playback.dma_addr = regs_base + I2STXD;
        pri_dai->dma_capture.dma_addr = regs_base + I2SRXD;
        pri_dai->dma_playback.client =
-               (struct s3c2410_dma_client *)&pri_dai->dma_playback;
+               (struct s3c_dma_client *)&pri_dai->dma_playback;
        pri_dai->dma_playback.ch_name = "tx";
        pri_dai->dma_capture.client =
-               (struct s3c2410_dma_client *)&pri_dai->dma_capture;
+               (struct s3c_dma_client *)&pri_dai->dma_capture;
        pri_dai->dma_capture.ch_name = "rx";
        pri_dai->dma_playback.dma_size = 4;
        pri_dai->dma_capture.dma_size = 4;
@@ -1233,7 +1233,7 @@ static int samsung_i2s_probe(struct platform_device *pdev)
                }
                sec_dai->dma_playback.dma_addr = regs_base + I2STXDS;
                sec_dai->dma_playback.client =
-                       (struct s3c2410_dma_client *)&sec_dai->dma_playback;
+                       (struct s3c_dma_client *)&sec_dai->dma_playback;
                sec_dai->dma_playback.ch_name = "tx-sec";
 
                if (!np) {
index 6a5e4bf6ac96efaa1b3b3dba063390165eee724e..ab54e297957c105ee60e050a259323b453738fff 100644 (file)
@@ -20,7 +20,6 @@
 #include <sound/pcm_params.h>
 
 #include <linux/platform_data/asoc-s3c.h>
-#include <mach/dma.h>
 
 #include "dma.h"
 #include "pcm.h"
@@ -132,11 +131,11 @@ struct s3c_pcm_info {
        struct s3c_dma_params   *dma_capture;
 };
 
-static struct s3c2410_dma_client s3c_pcm_dma_client_out = {
+static struct s3c_dma_client s3c_pcm_dma_client_out = {
        .name           = "PCM Stereo out"
 };
 
-static struct s3c2410_dma_client s3c_pcm_dma_client_in = {
+static struct s3c_dma_client s3c_pcm_dma_client_in = {
        .name           = "PCM Stereo in"
 };
 
index d0794458963a6ad8de279eaae568a3bd95a32836..e9bb5d7a71ee5409ad6c92419d1f8010201a132b 100644 (file)
 #include "regs-i2s-v2.h"
 #include "s3c2412-i2s.h"
 
-static struct s3c2410_dma_client s3c2412_dma_client_out = {
+static struct s3c_dma_client s3c2412_dma_client_out = {
        .name           = "I2S PCM Stereo out"
 };
 
-static struct s3c2410_dma_client s3c2412_dma_client_in = {
+static struct s3c_dma_client s3c2412_dma_client_in = {
        .name           = "I2S PCM Stereo in"
 };
 
index f31e916dd8c4f78d394efc387f7f6f8ade83fdfd..d7b8457b565046692db8ad1e25b9376ae412d4b9 100644 (file)
 #include "dma.h"
 #include "s3c24xx-i2s.h"
 
-static struct s3c2410_dma_client s3c24xx_dma_client_out = {
+static struct s3c_dma_client s3c24xx_dma_client_out = {
        .name = "I2S PCM Stereo out"
 };
 
-static struct s3c2410_dma_client s3c24xx_dma_client_in = {
+static struct s3c_dma_client s3c24xx_dma_client_in = {
        .name = "I2S PCM Stereo in"
 };
 
index 28487dcc4538b939bd86a82395bb7299c2a5d243..cfe63b7bcc9f6b9a6779b9a88db93612b9e6a420 100644 (file)
@@ -18,7 +18,6 @@
 #include <sound/pcm_params.h>
 
 #include <linux/platform_data/asoc-s3c.h>
-#include <mach/dma.h>
 
 #include "dma.h"
 #include "spdif.h"
@@ -94,7 +93,7 @@ struct samsung_spdif_info {
        struct s3c_dma_params   *dma_playback;
 };
 
-static struct s3c2410_dma_client spdif_dma_client_out = {
+static struct s3c_dma_client spdif_dma_client_out = {
        .name           = "S/PDIF Stereo out",
 };
 
index 49de5c1284f6c7d4df3cecaa227316fa8dbd830a..131336d40492786b2283df01577a1957b0556a66 100644 (file)
@@ -1501,7 +1501,8 @@ static void retire_playback_urb(struct snd_usb_substream *subs,
         * The error should be lower than 2ms since the estimate relies
         * on two reads of a counter updated every ms.
         */
-       if (abs(est_delay - subs->last_delay) * 1000 > runtime->rate * 2)
+       if (printk_ratelimit() &&
+           abs(est_delay - subs->last_delay) * 1000 > runtime->rate * 2)
                dev_dbg(&subs->dev->dev,
                        "delay: estimated %d, actual %d\n",
                        est_delay, subs->last_delay);