aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/codecs/da7210.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/soc/codecs/da7210.c')
-rw-r--r--sound/soc/codecs/da7210.c23
1 files changed, 22 insertions, 1 deletions
diff --git a/sound/soc/codecs/da7210.c b/sound/soc/codecs/da7210.c
index a9d9d39cfea9..ff682472c640 100644
--- a/sound/soc/codecs/da7210.c
+++ b/sound/soc/codecs/da7210.c
@@ -105,12 +105,17 @@
105 105
106/* DAI_CFG1 bit fields */ 106/* DAI_CFG1 bit fields */
107#define DA7210_DAI_WORD_S16_LE (0 << 0) 107#define DA7210_DAI_WORD_S16_LE (0 << 0)
108#define DA7210_DAI_WORD_S20_3LE (1 << 0)
108#define DA7210_DAI_WORD_S24_LE (2 << 0) 109#define DA7210_DAI_WORD_S24_LE (2 << 0)
110#define DA7210_DAI_WORD_S32_LE (3 << 0)
109#define DA7210_DAI_FLEN_64BIT (1 << 2) 111#define DA7210_DAI_FLEN_64BIT (1 << 2)
112#define DA7210_DAI_MODE_SLAVE (0 << 7)
110#define DA7210_DAI_MODE_MASTER (1 << 7) 113#define DA7210_DAI_MODE_MASTER (1 << 7)
111 114
112/* DAI_CFG3 bit fields */ 115/* DAI_CFG3 bit fields */
113#define DA7210_DAI_FORMAT_I2SMODE (0 << 0) 116#define DA7210_DAI_FORMAT_I2SMODE (0 << 0)
117#define DA7210_DAI_FORMAT_LEFT_J (1 << 0)
118#define DA7210_DAI_FORMAT_RIGHT_J (2 << 0)
114#define DA7210_DAI_OE (1 << 3) 119#define DA7210_DAI_OE (1 << 3)
115#define DA7210_DAI_EN (1 << 7) 120#define DA7210_DAI_EN (1 << 7)
116 121
@@ -247,9 +252,15 @@ static int da7210_hw_params(struct snd_pcm_substream *substream,
247 case SNDRV_PCM_FORMAT_S16_LE: 252 case SNDRV_PCM_FORMAT_S16_LE:
248 dai_cfg1 |= DA7210_DAI_WORD_S16_LE; 253 dai_cfg1 |= DA7210_DAI_WORD_S16_LE;
249 break; 254 break;
255 case SNDRV_PCM_FORMAT_S20_3LE:
256 dai_cfg1 |= DA7210_DAI_WORD_S20_3LE;
257 break;
250 case SNDRV_PCM_FORMAT_S24_LE: 258 case SNDRV_PCM_FORMAT_S24_LE:
251 dai_cfg1 |= DA7210_DAI_WORD_S24_LE; 259 dai_cfg1 |= DA7210_DAI_WORD_S24_LE;
252 break; 260 break;
261 case SNDRV_PCM_FORMAT_S32_LE:
262 dai_cfg1 |= DA7210_DAI_WORD_S32_LE;
263 break;
253 default: 264 default:
254 return -EINVAL; 265 return -EINVAL;
255 } 266 }
@@ -354,6 +365,9 @@ static int da7210_set_dai_fmt(struct snd_soc_dai *codec_dai, u32 fmt)
354 case SND_SOC_DAIFMT_CBM_CFM: 365 case SND_SOC_DAIFMT_CBM_CFM:
355 dai_cfg1 |= DA7210_DAI_MODE_MASTER; 366 dai_cfg1 |= DA7210_DAI_MODE_MASTER;
356 break; 367 break;
368 case SND_SOC_DAIFMT_CBS_CFS:
369 dai_cfg1 |= DA7210_DAI_MODE_SLAVE;
370 break;
357 default: 371 default:
358 return -EINVAL; 372 return -EINVAL;
359 } 373 }
@@ -366,6 +380,12 @@ static int da7210_set_dai_fmt(struct snd_soc_dai *codec_dai, u32 fmt)
366 case SND_SOC_DAIFMT_I2S: 380 case SND_SOC_DAIFMT_I2S:
367 dai_cfg3 |= DA7210_DAI_FORMAT_I2SMODE; 381 dai_cfg3 |= DA7210_DAI_FORMAT_I2SMODE;
368 break; 382 break;
383 case SND_SOC_DAIFMT_LEFT_J:
384 dai_cfg3 |= DA7210_DAI_FORMAT_LEFT_J;
385 break;
386 case SND_SOC_DAIFMT_RIGHT_J:
387 dai_cfg3 |= DA7210_DAI_FORMAT_RIGHT_J;
388 break;
369 default: 389 default:
370 return -EINVAL; 390 return -EINVAL;
371 } 391 }
@@ -382,7 +402,8 @@ static int da7210_set_dai_fmt(struct snd_soc_dai *codec_dai, u32 fmt)
382 return 0; 402 return 0;
383} 403}
384 404
385#define DA7210_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S24_LE) 405#define DA7210_FORMATS (SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S20_3LE |\
406 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S32_LE)
386 407
387/* DAI operations */ 408/* DAI operations */
388static struct snd_soc_dai_ops da7210_dai_ops = { 409static struct snd_soc_dai_ops da7210_dai_ops = {