summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorNicolin Chen <b42378@freescale.com>2013-11-08 16:38:43 +0800
committerNicolin Chen <b42378@freescale.com>2013-11-13 10:25:18 +0800
commitd32c5e5592d0f100f85731ce98cd31757cda9fb0 (patch)
tree144852256b251ed3a16aa69d69d36e46e4c3a0d3 /sound
parent22f3feedd44f72f8b5d9d2e4f54d7f8be8e451fe (diff)
ENGR00286961-4 ASoC: fsl_ssi: add monaural audio support
We use SSI's normal mode to trick I2S signal by fetching data only from one side of time slot so that we can purely get or put the monaural audio data. Acked-by: Wang Shengjiu <b02247@freescale.com> Signed-off-by: Nicolin Chen <b42378@freescale.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/fsl/fsl_ssi.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index 6d7ea1f1c402..68d84f0af67e 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -461,6 +461,8 @@ static int fsl_ssi_hw_params(struct snd_pcm_substream *substream,
snd_pcm_format_width(params_format(hw_params));
u32 wl = CCSR_SSI_SxCCR_WL(sample_size);
int enabled = read_ssi(&ssi->scr) & CCSR_SSI_SCR_SSIEN;
+ unsigned int channels = params_channels(hw_params);
+ static u8 i2s_mode;
int ret;
/*
@@ -495,6 +497,20 @@ static int fsl_ssi_hw_params(struct snd_pcm_substream *substream,
else
write_ssi_mask(&ssi->srccr, CCSR_SSI_SxCCR_WL_MASK, wl);
+ /* Save i2s mode configuration so that we can restore it later */
+ switch (read_ssi(&ssi->scr) & CCSR_SSI_SCR_I2S_MODE_MASK) {
+ case CCSR_SSI_SCR_I2S_MODE_SLAVE:
+ case CCSR_SSI_SCR_I2S_MODE_MASTER:
+ i2s_mode = read_ssi(&ssi->scr) & CCSR_SSI_SCR_I2S_MODE_MASK;
+ default:
+ break;
+ }
+
+ write_ssi_mask(&ssi->scr, CCSR_SSI_SCR_NET,
+ channels == 1 ? 0 : CCSR_SSI_SCR_NET);
+ write_ssi_mask(&ssi->scr, CCSR_SSI_SCR_I2S_MODE_MASK,
+ channels == 1 ? 0 : i2s_mode);
+
return 0;
}
@@ -820,14 +836,13 @@ static const struct snd_soc_dai_ops fsl_ssi_dai_ops = {
static struct snd_soc_dai_driver fsl_ssi_dai_template = {
.probe = fsl_ssi_dai_probe,
.playback = {
- /* The SSI does not support monaural audio. */
- .channels_min = 2,
+ .channels_min = 1,
.channels_max = 2,
.rates = FSLSSI_I2S_RATES,
.formats = FSLSSI_I2S_FORMATS,
},
.capture = {
- .channels_min = 2,
+ .channels_min = 1,
.channels_max = 2,
.rates = FSLSSI_I2S_RATES,
.formats = FSLSSI_I2S_FORMATS,