diff options
author | Nicolin Chen <b42378@freescale.com> | 2013-11-08 03:38:43 -0500 |
---|---|---|
committer | Nitin Garg <nitin.garg@freescale.com> | 2014-04-16 09:47:11 -0400 |
commit | a566e6bcb46b34a34dd390f3a2f596c9e8270319 (patch) | |
tree | c01244a6d56bcf065f140c4cb05f18d1f0f6a36d | |
parent | 3459ac8ff75fd58270ea54d5a351e515a31048ae (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>
-rw-r--r-- | sound/soc/fsl/fsl_ssi.c | 21 |
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, | |||
461 | snd_pcm_format_width(params_format(hw_params)); | 461 | snd_pcm_format_width(params_format(hw_params)); |
462 | u32 wl = CCSR_SSI_SxCCR_WL(sample_size); | 462 | u32 wl = CCSR_SSI_SxCCR_WL(sample_size); |
463 | int enabled = read_ssi(&ssi->scr) & CCSR_SSI_SCR_SSIEN; | 463 | int enabled = read_ssi(&ssi->scr) & CCSR_SSI_SCR_SSIEN; |
464 | unsigned int channels = params_channels(hw_params); | ||
465 | static u8 i2s_mode; | ||
464 | int ret; | 466 | int ret; |
465 | 467 | ||
466 | /* | 468 | /* |
@@ -495,6 +497,20 @@ static int fsl_ssi_hw_params(struct snd_pcm_substream *substream, | |||
495 | else | 497 | else |
496 | write_ssi_mask(&ssi->srccr, CCSR_SSI_SxCCR_WL_MASK, wl); | 498 | write_ssi_mask(&ssi->srccr, CCSR_SSI_SxCCR_WL_MASK, wl); |
497 | 499 | ||
500 | /* Save i2s mode configuration so that we can restore it later */ | ||
501 | switch (read_ssi(&ssi->scr) & CCSR_SSI_SCR_I2S_MODE_MASK) { | ||
502 | case CCSR_SSI_SCR_I2S_MODE_SLAVE: | ||
503 | case CCSR_SSI_SCR_I2S_MODE_MASTER: | ||
504 | i2s_mode = read_ssi(&ssi->scr) & CCSR_SSI_SCR_I2S_MODE_MASK; | ||
505 | default: | ||
506 | break; | ||
507 | } | ||
508 | |||
509 | write_ssi_mask(&ssi->scr, CCSR_SSI_SCR_NET, | ||
510 | channels == 1 ? 0 : CCSR_SSI_SCR_NET); | ||
511 | write_ssi_mask(&ssi->scr, CCSR_SSI_SCR_I2S_MODE_MASK, | ||
512 | channels == 1 ? 0 : i2s_mode); | ||
513 | |||
498 | return 0; | 514 | return 0; |
499 | } | 515 | } |
500 | 516 | ||
@@ -820,14 +836,13 @@ static const struct snd_soc_dai_ops fsl_ssi_dai_ops = { | |||
820 | static struct snd_soc_dai_driver fsl_ssi_dai_template = { | 836 | static struct snd_soc_dai_driver fsl_ssi_dai_template = { |
821 | .probe = fsl_ssi_dai_probe, | 837 | .probe = fsl_ssi_dai_probe, |
822 | .playback = { | 838 | .playback = { |
823 | /* The SSI does not support monaural audio. */ | 839 | .channels_min = 1, |
824 | .channels_min = 2, | ||
825 | .channels_max = 2, | 840 | .channels_max = 2, |
826 | .rates = FSLSSI_I2S_RATES, | 841 | .rates = FSLSSI_I2S_RATES, |
827 | .formats = FSLSSI_I2S_FORMATS, | 842 | .formats = FSLSSI_I2S_FORMATS, |
828 | }, | 843 | }, |
829 | .capture = { | 844 | .capture = { |
830 | .channels_min = 2, | 845 | .channels_min = 1, |
831 | .channels_max = 2, | 846 | .channels_max = 2, |
832 | .rates = FSLSSI_I2S_RATES, | 847 | .rates = FSLSSI_I2S_RATES, |
833 | .formats = FSLSSI_I2S_FORMATS, | 848 | .formats = FSLSSI_I2S_FORMATS, |