[alsa-devel] [RFC/PATCH] asoc: pxa-ssp.c -> enchance the I2S enchancement :)

Daniel Ribeiro drwyrm at gmail.com
Sat Jun 6 20:38:37 CEST 2009


Hi, this patch is what i need to use Paul's pxa-ssp.c I2S enchancements
on my board.

Basically, it doesn't enforce the "fake" network mode, as i dont need
it. And i need _real_ network mode, so i prefer to set SSCR0_MOD only
when really using network mode.

And it uses PXA_SSP_FRM_??FS to actually set SSCR0_DataSize() too. This
allows me to use 32bit frames for 16 bit stereo audio. (No, I don't want
to fake network mode for this, and SSCR0_MOD doesn't work as expected
when PXA is slave).

This patch is incremental to the recent patch from Paul Shen.

Signed-off-by: Daniel Ribeiro <drwyrm at gmail.com>

diff --git a/sound/soc/pxa/pxa-ssp.c b/sound/soc/pxa/pxa-ssp.c
index ed0906e..762cb93 100644
--- a/sound/soc/pxa/pxa-ssp.c
+++ b/sound/soc/pxa/pxa-ssp.c
@@ -579,7 +579,7 @@ static int pxa_ssp_set_dai_fmt(struct snd_soc_dai
*cpu_dai,
 	switch (fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
 	case SND_SOC_DAIFMT_I2S:
 	case SND_SOC_DAIFMT_LEFT_J:
-		sscr0 |= SSCR0_PSP | SSCR0_MOD;
+		sscr0 |= SSCR0_PSP;
 		sscr1 |= SSCR1_RWOT | SSCR1_TRAIL;
 
 		/* See hw_params() */
@@ -655,7 +655,7 @@ static int pxa_ssp_hw_params(struct
snd_pcm_substream *substream,
 	int dma = 0, chn = params_channels(params);
 	u32 sscr0;
 	u32 sspsp;
-	int frame_width;
+	int frame_width = 0;
 	int width = snd_pcm_format_physical_width(params_format(params));
 	int ttsa = ssp_read_reg(ssp, SSTSA) & 0xf;
 
@@ -698,7 +698,6 @@ static int pxa_ssp_hw_params(struct
snd_pcm_substream *substream,
 		sscr0 |= (SSCR0_EDSS | SSCR0_DataSize(16));
 		break;
 	}
-	ssp_write_reg(ssp, SSCR0, sscr0);
 
 	switch (priv->dai_fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
 	case SND_SOC_DAIFMT_I2S:
@@ -742,6 +741,15 @@ static int pxa_ssp_hw_params(struct
snd_pcm_substream *substream,
 		break;
 	}
 
+	if (frame_width) {
+		sscr0 &= ~(SSCR0_EDSS | SSCR0_DataSize(16));
+		if (frame_width % 48 == 0)
+			sscr0 |= SSCR0_EDSS | SSCR0_DataSize(8);
+		else
+			sscr0 |= SSCR0_EDSS | SSCR0_DataSize(16);
+	}
+	ssp_write_reg(ssp, SSCR0, sscr0);
+
 	/* When we use a network mode, we always require TDM slots
 	 * - complain loudly and fail if they've not been set up yet.
 	 */


-- 
Daniel Ribeiro
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Esta =?ISO-8859-1?Q?=E9?= uma parte de mensagem
 assinada digitalmente
Url : http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20090606/354663dd/attachment.sig 


More information about the Alsa-devel mailing list