* [PATCH 3/3] ASoC: pxa-ssp: Don't use SSCR0_SerClkDiv and SSCR0_SCR
@ 2009-03-19 8:34 Philipp Zabel
2009-03-19 11:48 ` Mark Brown
0 siblings, 1 reply; 4+ messages in thread
From: Philipp Zabel @ 2009-03-19 8:34 UTC (permalink / raw)
To: alsa-devel; +Cc: eric miao, Liam Girdwood
Those macros are just screwed as soon as CONFIG_PXA25x is enabled.
Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
---
sound/soc/pxa/pxa-ssp.c | 30 ++++++++++++++++++++++++++----
1 files changed, 26 insertions(+), 4 deletions(-)
diff --git a/sound/soc/pxa/pxa-ssp.c b/sound/soc/pxa/pxa-ssp.c
index c7c1996..cc8dbd4 100644
--- a/sound/soc/pxa/pxa-ssp.c
+++ b/sound/soc/pxa/pxa-ssp.c
@@ -283,9 +283,32 @@ static int pxa_ssp_resume(struct snd_soc_dai *cpu_dai)
static void ssp_set_scr(struct ssp_dev *dev, u32 div)
{
struct ssp_device *ssp = dev->ssp;
- u32 sscr0 = ssp_read_reg(dev->ssp, SSCR0) & ~SSCR0_SCR;
+ u32 sscr0 = ssp_read_reg(ssp, SSCR0);
+
+ if (cpu_is_pxa25x() && ssp->type == PXA25x_SSP) {
+ sscr0 &= ~0x0000ff00;
+ sscr0 |= ((div - 2)/2) << 8; /* 2..512 */
+ } else {
+ sscr0 &= ~0x000fff00;
+ sscr0 |= (div - 1) << 8; /* 1..4096 */
+ }
+ ssp_write_reg(ssp, SSCR0, sscr0);
+}
- ssp_write_reg(ssp, SSCR0, (sscr0 | SSCR0_SerClkDiv(div)));
+/**
+ * ssp_get_clkdiv - get SSP clock divider
+ */
+static u32 ssp_get_scr(struct ssp_dev *dev)
+{
+ struct ssp_device *ssp = dev->ssp;
+ u32 sscr0 = ssp_read_reg(ssp, SSCR0);
+ u32 div;
+
+ if (cpu_is_pxa25x() && ssp->type == PXA25x_SSP)
+ div = ((sscr0 >> 8) & 0xff) * 2 + 2;
+ else
+ div = ((sscr0 >> 8) & 0xfff) + 1;
+ return div;
}
/*
@@ -674,8 +697,7 @@ static int pxa_ssp_hw_params(struct snd_pcm_substream *substream,
case SND_SOC_DAIFMT_I2S:
sspsp = ssp_read_reg(ssp, SSPSP);
- if (((sscr0 & SSCR0_SCR) == SSCR0_SerClkDiv(4)) &&
- (width == 16)) {
+ if ((ssp_get_scr(ssp) == 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.
--
1.6.2
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 3/3] ASoC: pxa-ssp: Don't use SSCR0_SerClkDiv and SSCR0_SCR
2009-03-19 8:34 [PATCH 3/3] ASoC: pxa-ssp: Don't use SSCR0_SerClkDiv and SSCR0_SCR Philipp Zabel
@ 2009-03-19 11:48 ` Mark Brown
2009-03-19 12:04 ` pHilipp Zabel
0 siblings, 1 reply; 4+ messages in thread
From: Mark Brown @ 2009-03-19 11:48 UTC (permalink / raw)
To: Philipp Zabel; +Cc: alsa-devel, eric miao, Liam Girdwood
On Thu, Mar 19, 2009 at 09:34:52AM +0100, Philipp Zabel wrote:
> +static u32 ssp_get_scr(struct ssp_dev *dev)
...
> + if ((ssp_get_scr(ssp) == 4) && (width == 16)) {
but here ssp is a ssp_device, not a ssp_dev (the compiler warns about
this).
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 3/3] ASoC: pxa-ssp: Don't use SSCR0_SerClkDiv and SSCR0_SCR
2009-03-19 11:48 ` Mark Brown
@ 2009-03-19 12:04 ` pHilipp Zabel
2009-03-19 12:57 ` Mark Brown
0 siblings, 1 reply; 4+ messages in thread
From: pHilipp Zabel @ 2009-03-19 12:04 UTC (permalink / raw)
To: Mark Brown; +Cc: alsa-devel, eric miao, Liam Girdwood
On Thu, Mar 19, 2009 at 12:48 PM, Mark Brown <broonie@sirena.org.uk> wrote:
> On Thu, Mar 19, 2009 at 09:34:52AM +0100, Philipp Zabel wrote:
>
>> +static u32 ssp_get_scr(struct ssp_dev *dev)
>
> ...
>
>> + if ((ssp_get_scr(ssp) == 4) && (width == 16)) {
>
> but here ssp is a ssp_device, not a ssp_dev (the compiler warns about
> this).
Oh crap.
Please ignore patch 3, then. I'll fix and resend that one when I have
time to think properly about what I'm doing, but I fear the 2.6.29
release will be first.
The patches had a test-run on the magician, but it doesn't use I2S mode.
regards
Philipp
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 3/3] ASoC: pxa-ssp: Don't use SSCR0_SerClkDiv and SSCR0_SCR
2009-03-19 12:04 ` pHilipp Zabel
@ 2009-03-19 12:57 ` Mark Brown
0 siblings, 0 replies; 4+ messages in thread
From: Mark Brown @ 2009-03-19 12:57 UTC (permalink / raw)
To: pHilipp Zabel; +Cc: alsa-devel, eric miao, Liam Girdwood
On Thu, Mar 19, 2009 at 01:04:16PM +0100, pHilipp Zabel wrote:
> Please ignore patch 3, then. I'll fix and resend that one when I have
> time to think properly about what I'm doing, but I fear the 2.6.29
> release will be first.
This should be OK for fixing in an early -rc given that multi-CPU
configs are supposed to be supported it's a bug fix.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2009-03-19 12:57 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-19 8:34 [PATCH 3/3] ASoC: pxa-ssp: Don't use SSCR0_SerClkDiv and SSCR0_SCR Philipp Zabel
2009-03-19 11:48 ` Mark Brown
2009-03-19 12:04 ` pHilipp Zabel
2009-03-19 12:57 ` Mark Brown
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.