* [PATCH v2] ASoC: fsl_ssi: Add monaural audio support for non-ac97 interface
@ 2013-11-15 16:25 Nicolin Chen
2013-12-02 11:56 ` Mark Brown
0 siblings, 1 reply; 3+ messages in thread
From: Nicolin Chen @ 2013-11-15 16:25 UTC (permalink / raw)
To: timur, broonie, linux; +Cc: alsa-devel, linuxppc-dev, linux-kernel, lgirdwood
The normal mode of SSI allows it to send/receive data to/from the first
slot of each period. So we can use this normal mode to trick I2S signal
by puting/getting data to/from the first slot only (the left channel)
so as to support monaural audio playback and recording.
Signed-off-by: Nicolin Chen <b42378@freescale.com>
---
Changelog
v2:
* Moved i2s_mode to ssi_private so that we can save and retore it as needed
* And dropped the horrible static thing.
sound/soc/fsl/fsl_ssi.c | 19 ++++++++++++-------
1 file changed, 12 insertions(+), 7 deletions(-)
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index f43be6d..cba5c4d 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -144,6 +144,7 @@ struct fsl_ssi_private {
bool imx_ac97;
bool use_dma;
bool use_dual_fifo;
+ u8 i2s_mode;
struct clk *clk;
struct snd_dmaengine_dai_dma_data dma_params_tx;
struct snd_dmaengine_dai_dma_data dma_params_rx;
@@ -325,14 +326,13 @@ static irqreturn_t fsl_ssi_isr(int irq, void *dev_id)
static int fsl_ssi_setup(struct fsl_ssi_private *ssi_private)
{
struct ccsr_ssi __iomem *ssi = ssi_private->ssi;
- u8 i2s_mode;
u8 wm;
int synchronous = ssi_private->cpu_dai_drv.symmetric_rates;
if (ssi_private->imx_ac97)
- i2s_mode = CCSR_SSI_SCR_I2S_MODE_NORMAL | CCSR_SSI_SCR_NET;
+ ssi_private->i2s_mode = CCSR_SSI_SCR_I2S_MODE_NORMAL | CCSR_SSI_SCR_NET;
else
- i2s_mode = CCSR_SSI_SCR_I2S_MODE_SLAVE;
+ ssi_private->i2s_mode = CCSR_SSI_SCR_I2S_MODE_SLAVE;
/*
* Section 16.5 of the MPC8610 reference manual says that the SSI needs
@@ -349,7 +349,7 @@ static int fsl_ssi_setup(struct fsl_ssi_private *ssi_private)
write_ssi_mask(&ssi->scr,
CCSR_SSI_SCR_I2S_MODE_MASK | CCSR_SSI_SCR_SYN,
CCSR_SSI_SCR_TFR_CLK_DIS |
- i2s_mode |
+ ssi_private->i2s_mode |
(synchronous ? CCSR_SSI_SCR_SYN : 0));
write_ssi(CCSR_SSI_STCR_TXBIT0 | CCSR_SSI_STCR_TFEN0 |
@@ -517,6 +517,7 @@ static int fsl_ssi_hw_params(struct snd_pcm_substream *substream,
{
struct fsl_ssi_private *ssi_private = snd_soc_dai_get_drvdata(cpu_dai);
struct ccsr_ssi __iomem *ssi = ssi_private->ssi;
+ unsigned int channels = params_channels(hw_params);
unsigned int sample_size =
snd_pcm_format_width(params_format(hw_params));
u32 wl = CCSR_SSI_SxCCR_WL(sample_size);
@@ -546,6 +547,11 @@ static int fsl_ssi_hw_params(struct snd_pcm_substream *substream,
else
write_ssi_mask(&ssi->srccr, CCSR_SSI_SxCCR_WL_MASK, wl);
+ if (!ssi_private->imx_ac97)
+ write_ssi_mask(&ssi->scr,
+ CCSR_SSI_SCR_NET | CCSR_SSI_SCR_I2S_MODE_MASK,
+ channels == 1 ? 0 : ssi_private->i2s_mode);
+
return 0;
}
@@ -658,14 +664,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,
--
1.8.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH v2] ASoC: fsl_ssi: Add monaural audio support for non-ac97 interface
2013-11-15 16:25 [PATCH v2] ASoC: fsl_ssi: Add monaural audio support for non-ac97 interface Nicolin Chen
@ 2013-12-02 11:56 ` Mark Brown
2013-12-02 15:21 ` Nicolin Chen
0 siblings, 1 reply; 3+ messages in thread
From: Mark Brown @ 2013-12-02 11:56 UTC (permalink / raw)
To: Nicolin Chen
Cc: alsa-devel, linux, linux-kernel, lgirdwood, timur, linuxppc-dev
[-- Attachment #1: Type: text/plain, Size: 428 bytes --]
On Sat, Nov 16, 2013 at 12:25:29AM +0800, Nicolin Chen wrote:
> The normal mode of SSI allows it to send/receive data to/from the first
> slot of each period. So we can use this normal mode to trick I2S signal
> by puting/getting data to/from the first slot only (the left channel)
> so as to support monaural audio playback and recording.
This looks OK but doesn't apply against current code, can you please
check and resend?
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH v2] ASoC: fsl_ssi: Add monaural audio support for non-ac97 interface
2013-12-02 11:56 ` Mark Brown
@ 2013-12-02 15:21 ` Nicolin Chen
0 siblings, 0 replies; 3+ messages in thread
From: Nicolin Chen @ 2013-12-02 15:21 UTC (permalink / raw)
To: Mark Brown
Cc: alsa-devel, linux, linux-kernel, lgirdwood, timur, linuxppc-dev
On Mon, Dec 02, 2013 at 11:56:17AM +0000, Mark Brown wrote:
> On Sat, Nov 16, 2013 at 12:25:29AM +0800, Nicolin Chen wrote:
> > The normal mode of SSI allows it to send/receive data to/from the first
> > slot of each period. So we can use this normal mode to trick I2S signal
> > by puting/getting data to/from the first slot only (the left channel)
> > so as to support monaural audio playback and recording.
>
> This looks OK but doesn't apply against current code, can you please
> check and resend?
Ah, I rebased it on the dual-fifo set. Sorry I didn't make it clean.
I will resend it. Thank you.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2013-12-02 15:24 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-15 16:25 [PATCH v2] ASoC: fsl_ssi: Add monaural audio support for non-ac97 interface Nicolin Chen
2013-12-02 11:56 ` Mark Brown
2013-12-02 15:21 ` Nicolin Chen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).