rk29_phone:
author邱建斌 <qjb@rock-chips.com>
Tue, 23 Aug 2011 17:44:32 +0000 (01:44 +0800)
committer邱建斌 <qjb@rock-chips.com>
Tue, 23 Aug 2011 17:44:32 +0000 (01:44 +0800)
      1.fix headset drive timecallback a bug
      2.wm8994 add single and  differential Choose

arch/arm/mach-rk29/board-rk29-a22.c
arch/arm/mach-rk29/board-rk29-phonesdk.c
drivers/headset_observe/rk_headset.c
sound/soc/codecs/wm8994.c [changed mode: 0644->0755]
sound/soc/codecs/wm8994.h

index 6c656d0d9dada200c78a28510f711111b2b1ed6c..0bf00da5fdff2eeb6ca350b8a5d642976ba9cb9e 100755 (executable)
@@ -1435,7 +1435,8 @@ struct platform_device rk29_device_gps = {
  * author: qjb@rock-chips.com
  *****************************************************************************************/
 struct wm8994_pdata wm8994_platdata = {        
-       
+       .BB_input_diff = 0,
+       .phone_pad = 0, 
        .PA_control_pin = RK29_PIN6_PD3,        
        .Power_EN_Pin = RK29_PIN5_PA1,
        
index 9ef1e20c798503fb32be933b9538d85404998e5f..c3a27e27b7923e764316e8189b6852ae13b37a7b 100755 (executable)
@@ -1513,6 +1513,8 @@ struct platform_device rk29_device_gps = {
  * author: qjb@rock-chips.com
  *****************************************************************************************/
 struct wm8994_pdata wm8994_platdata = {        
+       .BB_input_diff = 0,
+       .phone_pad = 0,
 
        .PA_control_pin = 0,    
        .Power_EN_Pin = RK29_PIN5_PA1,
index f71aac53ff44928cf3432ca3597c3acb892dd308..22f2222a451b1d020634fb82f923044b63523aba 100755 (executable)
@@ -229,7 +229,6 @@ static void headsetobserve_work(struct work_struct *work)
                        }                               
                        headset_info->cur_headset_status = ~(BIT_HEADSET|BIT_HEADSET_NO_MIC);
                        headset_change_irqtype(HEADSET,IRQF_TRIGGER_FALLING);//
-                       disable_irq(headset_info->irq[HOOK]);
                }
                break;                  
        default:
old mode 100644 (file)
new mode 100755 (executable)
index afa63c8..b74e224
@@ -129,6 +129,7 @@ unsigned short BT_vol_table[16]             ={0x01DB,0x01DC,0x01DD,0x01DE,0x01DF,0x01E0,
 struct wm8994_priv {
        struct mutex io_lock;
        struct mutex route_lock;
+       int route_status;//Because the time callback cannot use mutex
        int sysclk;
        int mclk;
        int fmt;//master or salve
@@ -199,12 +200,10 @@ int wm8994_set_status(void)
 {
        struct wm8994_priv *wm8994 = wm8994_codec->private_data;        
        int ret = 1;
-       mutex_lock(&wm8994->route_lock);
-       
-       if(wm8994->work_type == SNDRV_PCM_TRIGGER_SUSPEND)
-               ret = -2;
        
-       mutex_unlock(&wm8994->route_lock);      
+       if(wm8994->route_status != IDLE)
+               ret = -BUSY;
+               
        return ret;
 }
 EXPORT_SYMBOL_GPL(wm8994_set_status);
@@ -1687,7 +1686,7 @@ int snd_soc_put_route(struct snd_kcontrol *kcontrol,
        wake_lock(&wm8994->wm8994_on_wake);
        mutex_lock(&wm8994->route_lock);
        wm8994->kcontrol.private_value = route;//save rount
-
+       wm8994->route_status = BUSY;
        //before set the route -- disable PA
        switch(route)
        {
@@ -1697,7 +1696,6 @@ int snd_soc_put_route(struct snd_kcontrol *kcontrol,
                        PA_ctrl(GPIO_LOW);
                        break;
        }
-       printk("%s,route=%d\n",__FUNCTION__,route);
        //set rount
        switch(route)
        {
@@ -1776,7 +1774,7 @@ int snd_soc_put_route(struct snd_kcontrol *kcontrol,
        }
        
        if(wm8994->RW_status == ERROR)
-       {//Failure to read or write, will re-power on wm8994
+       {//Failure to read or write, will reset wm8994
                cancel_delayed_work_sync(&wm8994->wm8994_delayed_work);
                wm8994->work_type = SNDRV_PCM_TRIGGER_PAUSE_PUSH;
                schedule_delayed_work(&wm8994->wm8994_delayed_work, msecs_to_jiffies(10));
@@ -1793,7 +1791,7 @@ int snd_soc_put_route(struct snd_kcontrol *kcontrol,
                case SPEAKER_RINGTONE:
                case SPEAKER_INCALL:                    
                case EARPIECE_RINGTONE: 
-               case HEADSET_RINGTONE:
+               case HEADSET_RINGTONE:          
                        msleep(50);
                        PA_ctrl(GPIO_HIGH);                             
                        break;
@@ -1808,6 +1806,7 @@ int snd_soc_put_route(struct snd_kcontrol *kcontrol,
                        break;
        }
 out:   
+       wm8994->route_status = IDLE;
        mutex_unlock(&wm8994->route_lock);      
        wake_unlock(&wm8994->wm8994_on_wake);   
        return 0;
@@ -2044,12 +2043,14 @@ static void wm8994_work_fun(struct work_struct *work)
                        return; 
        //      DBG("wm8994 shutdown\n");
                mutex_lock(&wm8994->route_lock);
+               wm8994->route_status = BUSY;
                PA_ctrl(GPIO_LOW);
                msleep(50);
                wm8994_write(0,0);
                msleep(50);
                wm8994_write(0x01, 0x0033);     
                wm8994_current_mode = null;//Automatically re-set the wake-up time      
+               wm8994->route_status = IDLE;
                mutex_unlock(&wm8994->route_lock);      
                break;
        case SNDRV_PCM_TRIGGER_START:
@@ -2135,7 +2136,7 @@ static int wm8994_suspend(struct platform_device *pdev, pm_message_t state)
                return 0;               
        DBG("%s----%d\n",__FUNCTION__,__LINE__);
        
-       wm8994->work_type = SNDRV_PCM_TRIGGER_SUSPEND;
+       wm8994->route_status = SUSPEND;
        PA_ctrl(GPIO_LOW);
        wm8994_write(0x00, 0x00);
        
@@ -2553,6 +2554,7 @@ static int wm8994_i2c_probe(struct i2c_client *i2c,
        wm8994->playback_active = 0;
        wm8994->call_vol = call_maxvol;
        wm8994->BT_call_vol = BT_call_maxvol;
+       wm8994->route_status = POWER_ON;
        INIT_DELAYED_WORK(&wm8994->wm8994_delayed_work, wm8994_work_fun);
        mutex_init(&wm8994->io_lock);   
        mutex_init(&wm8994->route_lock);
index ebf3a6115b5d3936d294188b4cf443795e244a18..f0f3922d3bb4f2c828559fde0e86dafff99c21de 100755 (executable)
@@ -43,4 +43,8 @@ extern int Headset_isMic(void);
 #define ERROR 1
 #define TRUE 0
 
+#define SUSPEND 3
+#define POWER_ON 2
+#define BUSY 1
+#define IDLE 0
 #endif