Skip to content

Commit

Permalink
ASoC: sirf: usp: Add bitclock inversion support
Browse files Browse the repository at this point in the history
Signed-off-by: Rongjun Ying <rongjun.ying@csr.com>
Signed-off-by: Mark Brown <broonie@linaro.org>
  • Loading branch information
Rongjun Ying authored and Mark Brown committed Aug 16, 2014
1 parent 7d1311b commit 0d985b1
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion sound/soc/sirf/sirf-usp.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,16 @@ static int sirf_usp_pcm_set_dai_fmt(struct snd_soc_dai *dai,
return -EINVAL;
}

switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
case SND_SOC_DAIFMT_NB_NF:
break;
case SND_SOC_DAIFMT_IB_NF:
usp->daifmt_format |= (fmt & SND_SOC_DAIFMT_INV_MASK);
break;
default:
return -EINVAL;
}

return 0;
}

Expand Down Expand Up @@ -177,7 +187,7 @@ static int sirf_usp_pcm_hw_params(struct snd_pcm_substream *substream,

shifter_len = data_len;

switch (usp->daifmt_format) {
switch (usp->daifmt_format & SND_SOC_DAIFMT_FORMAT_MASK) {
case SND_SOC_DAIFMT_I2S:
regmap_update_bits(usp->regmap, USP_RX_FRAME_CTRL,
USP_I2S_SYNC_CHG, USP_I2S_SYNC_CHG);
Expand All @@ -193,6 +203,18 @@ static int sirf_usp_pcm_hw_params(struct snd_pcm_substream *substream,
return -EINVAL;
}

switch (usp->daifmt_format & SND_SOC_DAIFMT_INV_MASK) {
case SND_SOC_DAIFMT_NB_NF:
break;
case SND_SOC_DAIFMT_IB_NF:
regmap_update_bits(usp->regmap, USP_MODE1,
USP_RXD_ACT_EDGE_FALLING | USP_TXD_ACT_EDGE_FALLING,
USP_RXD_ACT_EDGE_FALLING);
break;
default:
return -EINVAL;
}

if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
regmap_update_bits(usp->regmap, USP_TX_FRAME_CTRL,
USP_TXC_DATA_LEN_MASK | USP_TXC_FRAME_LEN_MASK
Expand Down

0 comments on commit 0d985b1

Please sign in to comment.