Commit 3b93f059 authored by Mark Brown's avatar Mark Brown

Merge remote-tracking branch 'asoc/topic/pcm1792a' into asoc-next

parents 08fa6545 e48c6d7f
...@@ -107,24 +107,35 @@ static int pcm1792a_hw_params(struct snd_pcm_substream *substream, ...@@ -107,24 +107,35 @@ static int pcm1792a_hw_params(struct snd_pcm_substream *substream,
struct snd_soc_codec *codec = dai->codec; struct snd_soc_codec *codec = dai->codec;
struct pcm1792a_private *priv = snd_soc_codec_get_drvdata(codec); struct pcm1792a_private *priv = snd_soc_codec_get_drvdata(codec);
int val = 0, ret; int val = 0, ret;
int pcm_format = params_format(params);
priv->rate = params_rate(params); priv->rate = params_rate(params);
switch (priv->format & SND_SOC_DAIFMT_FORMAT_MASK) { switch (priv->format & SND_SOC_DAIFMT_FORMAT_MASK) {
case SND_SOC_DAIFMT_RIGHT_J: case SND_SOC_DAIFMT_RIGHT_J:
if (pcm_format == SNDRV_PCM_FORMAT_S24_LE || switch (params_width(params)) {
pcm_format == SNDRV_PCM_FORMAT_S32_LE) case 24:
val = 0x02; case 32:
else if (pcm_format == SNDRV_PCM_FORMAT_S16_LE) val = 2;
val = 0x00; break;
case 16:
val = 0;
break;
default:
return -EINVAL;
}
break; break;
case SND_SOC_DAIFMT_I2S: case SND_SOC_DAIFMT_I2S:
if (pcm_format == SNDRV_PCM_FORMAT_S24_LE || switch (params_width(params)) {
pcm_format == SNDRV_PCM_FORMAT_S32_LE) case 24:
val = 0x05; case 32:
else if (pcm_format == SNDRV_PCM_FORMAT_S16_LE) val = 5;
val = 0x04; break;
case 16:
val = 4;
break;
default:
return -EINVAL;
}
break; break;
default: default:
dev_err(codec->dev, "Invalid DAI format\n"); dev_err(codec->dev, "Invalid DAI format\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment