From: Daniel Mack <daniel@caiaq.de>
To: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: alsa-devel@alsa-project.org, pHilipp Zabel <philipp.zabel@gmail.com>
Subject: Re: [PATCH 3/3][RFC] ASoC: pxa-ssp: Don't use SSCR0_SerClkDiv and SSCR0_SCR
Date: Thu, 12 Mar 2009 11:27:49 +0100 [thread overview]
Message-ID: <20090312102749.GA14526@buzzloop.caiaq.de> (raw)
In-Reply-To: <20090312102355.GB4038@rakim.wolfsonmicro.main>
On Thu, Mar 12, 2009 at 10:23:56AM +0000, Mark Brown wrote:
> On Thu, Mar 12, 2009 at 01:46:39AM +0100, Daniel Mack wrote:
>
> > (Just for the reference - this one needs to be applied on top of my last
> > 'network vs psp mode' patch, otherwise the second hunk won't apply).
>
> Could you please resubmit the most current versions of your outstanding
> patches? There's too many versions of patches floating around in the
> middle of threads and I want to make sure I'm looking at the most
> current versions.
Sorry. See below. There's only one left now and this one shrunk a lot.
Daniel
>From ad8734e93eed130a55482b0e937729578e6d93c8 Mon Sep 17 00:00:00 2001
From: Daniel Mack <daniel@caiaq.de>
Date: Wed, 11 Mar 2009 19:38:15 +0100
Subject: [PATCH] pxa-ssp: switch from network mode to PSP
This switches the pxa ssp port usage from network mode to PSP mode.
Removed some comments and checks for configured TDM channels.
A special case is added to support configuration where BCLK = 64fs. We
need to do some black magic in this case which doesn't look nice but
there is unfortunately no other option than that.
Signed-off-by: Daniel Mack <daniel@caiaq.de>
---
sound/soc/pxa/pxa-ssp.c | 44 +++++++++++++++++++++++++++++++++-----------
1 files changed, 33 insertions(+), 11 deletions(-)
diff --git a/sound/soc/pxa/pxa-ssp.c b/sound/soc/pxa/pxa-ssp.c
index 52d97c4..3cde686 100644
--- a/sound/soc/pxa/pxa-ssp.c
+++ b/sound/soc/pxa/pxa-ssp.c
@@ -558,18 +558,17 @@ 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:
- sscr0 |= SSCR0_MOD | SSCR0_PSP;
+ sscr0 |= SSCR0_PSP;
sscr1 |= SSCR1_RWOT | SSCR1_TRAIL;
switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
case SND_SOC_DAIFMT_NB_NF:
- sspsp |= SSPSP_FSRT;
break;
case SND_SOC_DAIFMT_NB_IF:
- sspsp |= SSPSP_SFRMP | SSPSP_FSRT;
+ sspsp |= SSPSP_SFRMP;
break;
case SND_SOC_DAIFMT_IB_IF:
- sspsp |= SSPSP_SFRMP;
+ sspsp |= SSPSP_SFRMP | SSPSP_SCMODE(3);
break;
default:
return -EINVAL;
@@ -655,33 +654,56 @@ static int pxa_ssp_hw_params(struct snd_pcm_substream *substream,
sscr0 |= SSCR0_FPCKE;
#endif
sscr0 |= SSCR0_DataSize(16);
- /* use network mode (2 slots) for 16 bit stereo */
break;
case SNDRV_PCM_FORMAT_S24_LE:
sscr0 |= (SSCR0_EDSS | SSCR0_DataSize(8));
- /* we must be in network mode (2 slots) for 24 bit stereo */
break;
case SNDRV_PCM_FORMAT_S32_LE:
sscr0 |= (SSCR0_EDSS | SSCR0_DataSize(16));
- /* we must be in network mode (2 slots) for 32 bit stereo */
break;
}
ssp_write_reg(ssp, SSCR0, sscr0);
switch (priv->dai_fmt & SND_SOC_DAIFMT_FORMAT_MASK) {
case SND_SOC_DAIFMT_I2S:
- /* Cleared when the DAI format is set */
- sspsp = ssp_read_reg(ssp, SSPSP) | SSPSP_SFRMWDTH(width);
+ sspsp = ssp_read_reg(ssp, SSPSP);
+
+ if (((sscr0 & SSCR0_SCR) == SSCR0_SerClkDiv(4)) &&
+ (width == 16)) {
+ /* This is a special case where the bitclk is 64fs
+ * and we're not dealing with 2*32 bits of audio
+ * samples.
+ *
+ * The SSP values used for that are all found out by
+ * trying and failing a lot; some of the registers
+ * needed for that mode are only available on PXA3xx.
+ */
+
+#ifdef CONFIG_PXA3xx
+ if (!cpu_is_pxa3xx())
+ return -EINVAL;
+
+ sspsp |= SSPSP_SFRMWDTH(width * 2);
+ sspsp |= SSPSP_SFRMDLY(width * 4);
+ sspsp |= SSPSP_EDMYSTOP(3);
+ sspsp |= SSPSP_DMYSTOP(3);
+ sspsp |= SSPSP_DMYSTRT(1);
+#else
+ return -EINVAL;
+#endif
+ } else
+ sspsp |= SSPSP_SFRMWDTH(width);
+
ssp_write_reg(ssp, SSPSP, sspsp);
break;
default:
break;
}
- /* We always use a network mode so we always require TDM slots
+ /* When we use a network mode, we always require TDM slots
* - complain loudly and fail if they've not been set up yet.
*/
- if (!(ssp_read_reg(ssp, SSTSA) & 0xf)) {
+ if ((sscr0 & SSCR0_MOD) && !(ssp_read_reg(ssp, SSTSA) & 0xf)) {
dev_err(&ssp->pdev->dev, "No TDM timeslot configured\n");
return -EINVAL;
}
--
1.6.2
next prev parent reply other threads:[~2009-03-12 10:27 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-03-11 18:16 [PATCH 1/3][RFC] ASoC: pxa-ssp: Use 16-bit DMA for magician stereo Philipp Zabel
2009-03-11 18:16 ` [PATCH 2/3][RFC] ASoC: Add Magician machine support Philipp Zabel
2009-03-11 19:02 ` Liam Girdwood
2009-03-11 21:03 ` pHilipp Zabel
2009-03-11 22:25 ` Mark Brown
2009-03-11 22:38 ` Liam Girdwood
2009-03-11 22:44 ` Mark Brown
2009-03-12 10:07 ` [PATCH 3/5] ASoC: Replace remaining uses of snd_soc_cnew with snd_soc_add_controls Philipp Zabel
2009-03-12 10:11 ` Mark Brown
2009-03-12 10:06 ` [PATCH] ASoC: Add Magician machine support Philipp Zabel
2009-03-12 15:58 ` Mark Brown
2009-03-11 18:17 ` [PATCH 3/3][RFC] ASoC: pxa-ssp: Don't use SSCR0_SerClkDiv and SSCR0_SCR Philipp Zabel
2009-03-11 18:44 ` Daniel Mack
2009-03-11 21:10 ` pHilipp Zabel
2009-03-12 0:46 ` Daniel Mack
2009-03-12 10:23 ` Mark Brown
2009-03-12 10:27 ` Daniel Mack [this message]
2009-03-12 10:29 ` Mark Brown
2009-03-12 10:36 ` Daniel Mack
2009-03-12 19:09 ` pHilipp Zabel
2009-03-12 19:18 ` Mark Brown
2009-03-12 23:46 ` Daniel Mack
2009-03-11 22:27 ` Mark Brown
2009-03-11 22:29 ` Mark Brown
2009-03-12 15:57 ` [PATCH 1/3][RFC] ASoC: pxa-ssp: Use 16-bit DMA for magician stereo Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090312102749.GA14526@buzzloop.caiaq.de \
--to=daniel@caiaq.de \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=philipp.zabel@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox