int ret = 1;
mutex_lock(&wm8994->route_lock);
- switch(wm8994_current_mode)
- {
- case wm8994_AP_to_headset:
- case wm8994_recorder_and_AP_to_headset:
- case wm8994_handsetMIC_to_baseband_to_headset:
- case wm8994_handsetMIC_to_baseband_to_headset_and_record:
- case null:
- ret = 1;
- break;
- default:
- ret = -1;
- break;
- }
if(wm8994->work_type == SNDRV_PCM_TRIGGER_SUSPEND)
ret = -2;
+
mutex_unlock(&wm8994->route_lock);
return ret;
}
wm8994_write(0x03, 0x3330);
wm8994_write(0x01, 0x3303);
msleep(50);
- wm8994_write(0x01, 0x3323);
+ wm8994_write(0x01, 0x3333);
}
void recorder_and_AP_to_headset(void)
wm8994_write(0x05, 0x0303);
wm8994_write(0x01, 0x0303);
msleep(50);
- wm8994_write(0x01, 0x0323);
+ wm8994_write(0x01, 0x0333);
wm8994_set_level_volume();
}
void mainMIC_to_baseband_to_headset(void)
-{
+{//
struct wm8994_priv *wm8994 = wm8994_codec->private_data;
DBG("%s::%d\n",__FUNCTION__,__LINE__);
if(wm8994_current_mode == wm8994_mainMIC_to_baseband_to_headset)return;
-
wm8994_current_mode = wm8994_mainMIC_to_baseband_to_headset;
wm8994_reset();
msleep(WM8994_DELAY);
- wm8994_write(0x700, 0xA101);
wm8994_write(0x01, 0x0023);
wm8994_write(0x200, 0x0000);
mdelay(WM8994_DELAY);
-
- wm8994_write(0x220, 0x0000);
- wm8994_write(0x221, 0x0700);
- wm8994_write(0x222, 0x3126);
- wm8994_write(0x223, 0x0100);
-
- wm8994_write(0x220, 0x0004);
- msleep(10);
- wm8994_write(0x220, 0x0005);
- msleep(5);
-
- wm8994_write(0x200, 0x0010);
- wm8994_write(0x208, 0x0008); //DSP_FS1CLK_ENA=1, DSP_FSINTCLK_ENA=1
- wm8994_write(0x208, 0x000A); //DSP_FS1CLK_ENA=1, DSP_FSINTCLK_ENA=1
- wm8994_write(0x210, 0x0083); // SR=48KHz
-#ifdef CONFIG_SND_RK29_CODEC_SOC_MASTER
- wm8994_write(0x302, 0x3000); // AIF1_MSTR=1
- wm8994_write(0x302, 0x7000); // AIF1_MSTR=1
- wm8994_write(0x303, 0x0040); // AIF1 BCLK DIV--------AIF1CLK/4
- wm8994_write(0x304, 0x0040); // AIF1 ADCLRCK DIV-----BCLK/64
- wm8994_write(0x305, 0x0040); // AIF1 DACLRCK DIV-----BCLK/64
- wm8994_write(0x300, 0xC010); // i2s 16 bits
-#endif
- wm8994_write(0x200, 0x0011); // sysclk = fll (bit4 =1) 0x0011
-
- wm8994_write(0x39, 0x006C);
- wm8994_write(0x01, 0x0023);
- mdelay(WM8994_DELAY);
- wm8994_write(0xFF, 0x0000);
- mdelay(5);
- wm8994_write(0x4C, 0x9F25);
- mdelay(5);
- wm8994_write(0x01, 0x0323);
- wm8994_write(0x60, 0x0022);
- wm8994_write(0x60, 0x00EE);
- mdelay(5);
- wm8994_write(0x54, 0x0033);
-
- wm8994_write(0x610, 0x0100); //DAC1 Left Volume bit0~7
- wm8994_write(0x611, 0x0100); //DAC1 Right Volume bit0~7
-
- wm8994_set_volume(wm8994_current_mode,wm8994->call_vol,call_maxvol);
- wm8994_set_channel_vol();
- msleep(50);
+//clk
+ wm8994_sysclk_config();
+ wm8994_write(0x300, 0xC010); // i2s 16 bits
+//path
wm8994_write(0x22, 0x0000);
wm8994_write(0x23, 0x0100);
-
wm8994_write(0x02, 0x6210);
- wm8994_write(0x28, 0x0003); //IN1LN_TO_IN1L IN1LP_TO_IN1L
-#ifdef CONFIG_SND_BB_DIFFERENTIAL_INPUT
- wm8994_write(0x2D, 0x0041); //bit 1 MIXINL_TO_MIXOUTL bit 12 DAC1L_TO_HPOUT1L 0x0102
- wm8994_write(0x2E, 0x0081); //bit 1 MIXINL_TO_MIXOUTR bit 12 DAC1R_TO_HPOUT1R 0x0102
-#endif
-#ifdef CONFIG_SND_BB_NORMAL_INPUT
+ wm8994_write(0x28, 0x0003); //IN1RN_TO_IN1R IN1RP_TO_IN1R
wm8994_write(0x2D, 0x0003); //bit 1 IN2LP_TO_MIXOUTL bit 12 DAC1L_TO_HPOUT1L 0x0102
wm8994_write(0x2E, 0x0003); //bit 1 IN2RP_TO_MIXOUTR bit 12 DAC1R_TO_HPOUT1R 0x0102
-#endif
- wm8994_write(0x34, 0x0004); //IN1L_TO_LINEOUT1P
+ wm8994_write(0x34, 0x0004); //IN1R_TO_LINEOUT1P
wm8994_write(0x36, 0x0003);
-
- wm8994_write(0x4C, 0x9F25);
- mdelay(5);
- wm8994_write(0x01, 0x0303);
- mdelay(50);
wm8994_write(0x60, 0x0022);
wm8994_write(0x60, 0x00EE);
-
- wm8994_write(0x03, 0x3030);
- wm8994_write(0x04, 0x0300); // AIF1ADC1L_ENA=1, AIF1ADC1R_ENA=1
- wm8994_write(0x05, 0x0303);
wm8994_write(0x420, 0x0000);
-
- wm8994_write(0x01, 0x0333);
-
wm8994_write(0x601, 0x0001);
wm8994_write(0x602, 0x0001);
-
+//volume
wm8994_write(0x610, 0x01A0); //DAC1 Left Volume bit0~7
wm8994_write(0x611, 0x01A0); //DAC1 Right Volume bit0~7
+ wm8994_set_channel_vol();
+//other
+ wm8994_write(0x4C, 0x9F25);
+//power
+ wm8994_write(0x03, 0x3030);
+ wm8994_write(0x04, 0x0300); // AIF1ADC1L_ENA=1, AIF1ADC1R_ENA=1
+ wm8994_write(0x05, 0x0303);
+ wm8994_write(0x01, 0x0303);
+ msleep(50);
+ wm8994_write(0x01, 0x0333);
+
+ wm8994_set_level_volume();
}
void handsetMIC_to_baseband_to_headset_and_record(void)
wm8994_write(0x60, 0x00EE);
msleep(5);
//power
- wm8994_write(0x01, 0x3023);
+ wm8994_write(0x01, 0x3033);
wm8994_write(0x02, 0x63A0);
wm8994_write(0x03, 0x33F0);
wm8994_write(0x04, 0x3303);
recorder_and_AP_to_headset();
break;
case HEADSET_INCALL: //AP-> 8994Codec -> Headset
- handsetMIC_to_baseband_to_headset();
+ if(Headset_isMic())
+ handsetMIC_to_baseband_to_headset();
+ else
+ mainMIC_to_baseband_to_headset();
break;
case EARPIECE_INCALL: //BB-> 8994Codec -> EARPIECE
mainMIC_to_baseband_to_earpiece();
msleep(50);
wm8994_write(0,0);
msleep(50);
- wm8994_write(0x01, 0x0023);
+ wm8994_write(0x01, 0x0033);
wm8994_current_mode = null;//Automatically re-set the wake-up time
mutex_unlock(&wm8994->route_lock);
break;