在我们的cloud39平台,播放mp3格式的音频,有时会出现深意忽大忽小,甚至没有声音了,或有很大杂音。尤其在播放不一样的采样率的音频的时候。
原因:在我们底层驱动里面,音频open的时候,在播放不一样的采样率音频时,需要复位一下采样率相关的操作。
具体修改:
将:
void ak39_codec_dac_open(void)
{
int reg_value;
int i;
struct ak_codec_dai *dai = g_pdai;
struct ak39_codec *codec = to_ak39_codec(dai);
if(codec->dac_state)
return;
codec->dac_state = 1;
REG32(codec->analog_ctrl_base + SOFT_RST_CTRL_REG) &= ~(1<<4);
REG32(codec->analog_ctrl_base + CLOCK_GATE_CTRL_REG) &= ~(1<<4);
REG32(codec->adda_cfg_base + DAC_CONFIG_REG) |= MUTE;
REG32(codec->adda_cfg_base + DAC_CONFIG_REG) &= ~DAC_CTRL_EN;
REG32(codec->analog_ctrl_base + CLOCK_CTRL_REG) &= ~DAC_CLK_EN;
REG32(codec->analog_ctrl_base + CLOCK_CTRL_REG) |= DAC_DIV_VLD;
i = 0;
while(REG32(codec->analog_ctrl_base + CLOCK_CTRL_REG) & (DAC_DIV_VLD))
{
++i;
if(i > 100000)
{
printk("set da clk reg fail\n");
return ;
}
}
改成:
void ak39_codec_dac_open(void)
{
int reg_value;
int i;
struct ak_codec_dai *dai = g_pdai;
struct ak39_codec *codec = to_ak39_codec(dai);
if(codec->dac_state)
;//return;
codec->dac_state = 1;
REG32(codec->analog_ctrl_base + SOFT_RST_CTRL_REG) |= (1<<4);
REG32(codec->analog_ctrl_base + CLOCK_GATE_CTRL_REG) |= (1<<4);
REG32(codec->analog_ctrl_base + SOFT_RST_CTRL_REG) &= ~(1<<4);
REG32(codec->analog_ctrl_base + CLOCK_GATE_CTRL_REG) &= ~(1<<4);
REG32(codec->adda_cfg_base + DAC_CONFIG_REG) |= MUTE;
REG32(codec->adda_cfg_base + DAC_CONFIG_REG) &= ~DAC_CTRL_EN;
REG32(codec->analog_ctrl_base + CLOCK_CTRL_REG) &= ~DAC_CLK_EN;
REG32(codec->analog_ctrl_base + CLOCK_CTRL_REG) |= DAC_DIV_VLD;
i = 0;
while(REG32(codec->analog_ctrl_base + CLOCK_CTRL_REG) & (DAC_DIV_VLD))
{
++i;
if(i > 100000)
{
printk("set da clk reg fail\n");
return ;
}
}
阅读(1954) | 评论(0) | 转发(0) |