rk616 codec:add reset in fun shutdown

This commit is contained in:
陈金泉
2013-06-04 11:23:07 +08:00
parent 61203afacb
commit b1bdb9886f
2 changed files with 31 additions and 30 deletions

View File

@@ -698,25 +698,11 @@ static struct rk610_ctl_platform_data rk610_ctl_pdata = {
#if defined(CONFIG_MFD_RK616)
#define RK616_RST_PIN RK30_PIN3_PB2
#define RK616_PWREN_PIN RK30_PIN0_PC5
#define RK616_SPK_CTL2 RK30_PIN0_PD5
#define RK616_SCL_RATE (80*1000) //i2c scl rate
static int rk616_power_on_init(void)
{
int ret;
#if 1
if(RK616_SPK_CTL2 != INVALID_GPIO)
{
ret = gpio_request(RK616_SPK_CTL2, "rk616 spk ctl2");
if (ret)
{
printk(KERN_ERR "rk616 spk_ctl2 gpio request fail\n");
}
else
{
gpio_direction_output(RK616_SPK_CTL2,GPIO_HIGH);
}
}
#endif
if(RK616_PWREN_PIN != INVALID_GPIO)
{
ret = gpio_request(RK616_PWREN_PIN, "rk616 pwren");

View File

@@ -1533,7 +1533,7 @@ static int rk616_hw_params(struct snd_pcm_substream *substream,
return -EINVAL;
}
switch (params_channels(params)) {
/*switch (params_channels(params)) {
case RK616_MONO:
adc_aif1 |= RK616_ADC_TYPE_MONO;
break;
@@ -1542,7 +1542,10 @@ static int rk616_hw_params(struct snd_pcm_substream *substream,
break;
default:
return -EINVAL;
}
}*/
//MIC1N/P and MIC2N/P can only line to ADCL, so set mono type.
adc_aif1 |= RK616_ADC_TYPE_MONO;
adc_aif1 |= RK616_ADC_SWAP_DIS;
adc_aif2 |= RK616_ADC_RST_DIS;
@@ -2075,6 +2078,19 @@ static int rk616_remove(struct snd_soc_codec *codec)
{
DBG("%s\n", __func__);
if (!rk616_priv) {
printk("%s : rk616_priv is NULL\n", __func__);
return 0;
}
if (rk616_priv->spk_ctl_gpio != INVALID_GPIO)
gpio_set_value(rk616_priv->spk_ctl_gpio, GPIO_LOW);
if (rk616_priv->hp_ctl_gpio != INVALID_GPIO)
gpio_set_value(rk616_priv->hp_ctl_gpio, GPIO_LOW);
mdelay(10);
if (rk616_for_mid)
{
cancel_delayed_work_sync(&capture_delayed_work);
@@ -2082,16 +2098,13 @@ static int rk616_remove(struct snd_soc_codec *codec)
if (rk616_codec_work_capture_type != RK616_CODEC_WORK_NULL) {
rk616_codec_work_capture_type = RK616_CODEC_WORK_NULL;
}
rk616_codec_power_down(RK616_CODEC_ALL);
}
else
{
snd_soc_write(codec, RK616_RESET, 0xfc);
mdelay(10);
snd_soc_write(codec, RK616_RESET, 0x3);
mdelay(10);
}
snd_soc_write(codec, RK616_RESET, 0xfc);
mdelay(10);
snd_soc_write(codec, RK616_RESET, 0x3);
mdelay(10);
if (rk616_priv)
kfree(rk616_priv);
@@ -2163,12 +2176,14 @@ void rk616_platform_shutdown(struct platform_device *pdev)
if (rk616_codec_work_capture_type != RK616_CODEC_WORK_NULL) {
rk616_codec_work_capture_type = RK616_CODEC_WORK_NULL;
}
rk616_codec_power_down(RK616_CODEC_ALL);
} else {
snd_soc_write(rk616_priv->codec, RK616_RESET, 0xfc);
mdelay(10);
snd_soc_write(rk616_priv->codec, RK616_RESET, 0x3);
}
snd_soc_write(rk616_priv->codec, RK616_RESET, 0xfc);
mdelay(10);
snd_soc_write(rk616_priv->codec, RK616_RESET, 0x3);
if (rk616_priv)
kfree(rk616_priv);
}
static struct platform_driver rk616_codec_driver = {