rk29_phone:

1.fix bug Because headphones can not sleep
2.wm8994 add a wake_lock
3.turn up the speaker sound
This commit is contained in:
邱建斌
2011-07-08 14:43:07 +08:00
parent 87f27eece5
commit 1436e24549
3 changed files with 39 additions and 7 deletions

View File

@@ -1537,7 +1537,7 @@ struct wm8994_pdata wm8994_platdata = {
.speaker_incall_vol = 0,
.speaker_incall_mic_vol = -9,
.speaker_normal_vol = -26,
.speaker_normal_vol = -10,
.earpiece_incall_vol = 0,
.headset_incall_vol = 6,
.headset_incall_mic_vol = -6,

View File

@@ -37,6 +37,8 @@
#include <asm/mach-types.h>
#include "rk_headset.h"
#include <linux/earlysuspend.h>
#include <linux/gpio.h>
#include <mach/board.h>
/* Debug */
#if 1
@@ -229,7 +231,7 @@ static void headsetobserve_work(struct work_struct *work)
DBG("---- ERROR: on headset headset_in_type error -----\n");
break;
}
rk28_send_wakeup_key();
switch_set_state(&headset_info->sdev, headset_info->cur_headset_status);
DBG("headset_info->cur_headset_status = %d\n",headset_info->cur_headset_status);
RE_ERROR:
@@ -240,7 +242,7 @@ static void Hook_work(struct work_struct *work)
{
int i,level = 0;
struct rk_headset_pdata *pdata = headset_info->pdata;
static unsigned int old_status = 0;
static unsigned int old_status = HOOK_UP;
// DBG("---Hook_work---\n");
mutex_lock(&headset_info->mutex_lock[HOOK]);
@@ -252,7 +254,7 @@ static void Hook_work(struct work_struct *work)
#ifdef CONFIG_SND_SOC_WM8994
if(wm8994_set_status() < 0)
{
DBG("wm8994 is not set on heatset channel\n");
DBG("wm8994 is not set on heatset channel or suspend\n");
goto RE_ERROR;
}
#endif
@@ -438,6 +440,7 @@ static int rockchip_headsetobserve_probe(struct platform_device *pdev)
ret = request_irq(headset->irq[HEADSET], headset_interrupt, headset->irq_type[HEADSET], NULL, NULL);
if (ret)
goto failed_free;
enable_irq_wake(headset->irq[HEADSET]);
//------------------------------------------------------------------
ret = gpio_request(pdata->Hook_gpio , NULL);
if (ret)
@@ -508,8 +511,28 @@ failed_free:
return ret;
}
static int rockchip_headsetobserve_suspend(struct platform_device *pdev, pm_message_t state)
{
DBG("%s----%d\n",__FUNCTION__,__LINE__);
disable_irq(headset_info->irq[HEADSET]);
disable_irq(headset_info->irq[HOOK]);
return 0;
}
static int rockchip_headsetobserve_resume(struct platform_device *pdev)
{
DBG("%s----%d\n",__FUNCTION__,__LINE__);
enable_irq(headset_info->irq[HEADSET]);
enable_irq(headset_info->irq[HOOK]);
return 0;
}
static struct platform_driver rockchip_headsetobserve_driver = {
.probe = rockchip_headsetobserve_probe,
// .resume = rockchip_headsetobserve_resume,
// .suspend = rockchip_headsetobserve_suspend,
.driver = {
.name = "rk_headsetdet",
.owner = THIS_MODULE,

View File

@@ -26,6 +26,8 @@
#include <sound/soc.h>
#include <sound/soc-dapm.h>
#include <sound/initval.h>
#include <linux/wakelock.h>
#include <linux/earlysuspend.h>
#include <mach/iomux.h>
#include <mach/gpio.h>
@@ -154,6 +156,8 @@ struct wm8994_priv {
/* call_vol: save all kinds of system volume value. */
unsigned char call_vol;
unsigned char BT_call_vol;
struct wake_lock wm8994_on_wake;
};
int reg_send_data(struct i2c_client *client, unsigned short *reg, unsigned short *data, u32 scl_rate)
@@ -213,13 +217,15 @@ int wm8994_set_status(void)
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;
}
@@ -2692,6 +2698,7 @@ int snd_soc_put_route(struct snd_kcontrol *kcontrol,
{
struct wm8994_priv *wm8994 = wm8994_codec->private_data;
char route = kcontrol->private_value & 0xff;
wake_lock(&wm8994->wm8994_on_wake);
mutex_lock(&wm8994->route_lock);
wm8994->kcontrol = kcontrol;//save rount
@@ -2795,6 +2802,7 @@ int snd_soc_put_route(struct snd_kcontrol *kcontrol,
}
out:
mutex_unlock(&wm8994->route_lock);
wake_unlock(&wm8994->wm8994_on_wake);
return 0;
}
@@ -3067,7 +3075,6 @@ static void wm8994_work_fun(struct work_struct *work)
default:
break;
}
}
#define WM8994_RATES SNDRV_PCM_RATE_8000_48000
@@ -3118,7 +3125,8 @@ static int wm8994_suspend(struct platform_device *pdev, pm_message_t state)
wm8994_current_mode< null )//incall status,wm8994 not suspend
return 0;
DBG("%s----%d\n",__FUNCTION__,__LINE__);
wm8994->work_type = SNDRV_PCM_TRIGGER_SUSPEND;
PA_ctrl(GPIO_LOW);
wm8994_write(0x00, 0x00);
@@ -3528,6 +3536,7 @@ static int wm8994_i2c_probe(struct i2c_client *i2c,
INIT_DELAYED_WORK(&wm8994->wm8994_delayed_work, wm8994_work_fun);
mutex_init(&wm8994->io_lock);
mutex_init(&wm8994->route_lock);
wake_lock_init(&wm8994->wm8994_on_wake, WAKE_LOCK_SUSPEND, "wm8994_on_wake");
return wm8994_register(wm8994, SND_SOC_I2C);
}