11 Apr
2011
11 Apr
'11
5:45 p.m.
On Mon, Apr 11, 2011 at 01:30:00PM +0800, Rajeev Kumar wrote:
+static int sta529_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,struct snd_soc_dai *dai)+{
struct snd_soc_pcm_runtime *rtd = substream->private_data;struct snd_soc_codec *codec = rtd->codec;int pdata = 0;switch (params_format(params)) {case SNDRV_PCM_FORMAT_S16_LE:pdata = 1;break;case SNDRV_PCM_FORMAT_S24_LE:pdata = 2;break;case SNDRV_PCM_FORMAT_S32_LE:pdata = 3;break;}if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)snd_soc_update_bits(codec, STA529_S2PCFG1, 0xB0, pdata);elsesnd_soc_update_bits(codec, STA529_P2SCFG1, 0xB0, pdata);
Hi,
Reading the spec, the bit 7 and bit 6 of these two registers are related to the length of data.
While from your code, you're masking bit 10110000, which is weird. Shouldn't it be 0xC0?
Besides, the value to snd_soc_update_bits should be shifted accordingly. So the improved one should be something like this: snd_soc_update_bits(codec, STA529_P2SCFG1, 0xC0, (pdata << 6));
--
guanqun