asoc: codecs: wm8753: allow to change the dai mode even when codec is busy
Nikesh Oswal [Tue, 24 Jan 2012 06:50:22 +0000 (11:50 +0530)]
In Voice Call when ringtone stream is opened the codec is busy and the
call mode needs to be set before closing the ringtone stream hence we
put the logic in codec driver to enable dai mode change even when codec
is busy

Bug: 919350

Reviewed-on: http://git-master/r/76954

Change-Id: Iaf7176b3a7f72709140e29c2c6071ab4101ec418
Signed-off-by: Nikesh Oswal <noswal@nvidia.com>
Signed-off-by: Varun Wadekar <vwadekar@nvidia.com>
Reviewed-on: http://git-master/r/77732
Reviewed-by: Automatic_Commit_Validation_User

Rebase-Id: R6de6624eb26e30c2b9df7c86449557072217a0cc

sound/soc/codecs/wm8753.c

index 88062ea..8cfe7c0 100644 (file)
@@ -197,7 +197,8 @@ static int wm8753_set_dai(struct snd_kcontrol *kcontrol,
                return 0;
 
        if (codec->active)
-               return -EBUSY;
+               printk(KERN_WARNING
+                       "Trying to Change the Dai Mode when codec is active\n");
 
        ioctl = snd_soc_read(codec, WM8753_IOCTL);
 
@@ -900,6 +901,10 @@ static int wm8753_pcm_hw_params(struct snd_pcm_substream *substream,
        /* sample rate */
        if (params_rate(params) * 384 == wm8753->pcmclk)
                srate |= 0x80;
+
+       /* ADC and V-DAC at same sample rate */
+       srate |= 1<<8;
+
        snd_soc_write(codec, WM8753_SRATE1, srate);
 
        snd_soc_write(codec, WM8753_PCM, voice);
@@ -1119,6 +1124,10 @@ static int wm8753_i2s_hw_params(struct snd_pcm_substream *substream,
                printk(KERN_ERR "wm8753 invalid MCLK or rate\n");
                return coeff;
        }
+
+       /* ADC and HiFi-DAC at same sample rate */
+       srate &= ~(1<<8);
+
        snd_soc_write(codec, WM8753_SRATE1, srate | (coeff_div[coeff].sr << 1) |
                coeff_div[coeff].usb);