All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] ASoC: omap-mcbsp: Prepare for init time DAI format setting
@ 2011-09-30 13:07 Jarkko Nikula
  2011-09-30 13:07 ` [PATCH 2/3] ASoC: omap: Convert bunch of machine drivers to use init time DAI format Jarkko Nikula
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Jarkko Nikula @ 2011-09-30 13:07 UTC (permalink / raw)
  To: alsa-devel; +Cc: Peter Ujfalusi, Mark Brown, Liam Girdwood, Jarkko Nikula

Before commit 75d9ac4 ("ASoC: Allow DAI formats to be specified in the
dai_link") expectation for omap-mcbsp was that snd_soc_dai_set_fmt is to be
called first in machine hw_params callback before other CPU DAI functions.
Thus it was enough that only omap_mcbsp_dai_set_dai_fmt cleared the
mcbsp->regs structure.

Now this doesn't hold anymore since machine drivers can set the DAI format
only once on init time and thus mcbsp->regs may get out of sync when other
CPU DAI functions are modifying them dynamically with different values
between the calls. Therefore clear the accessed mcbsp->regs bits and
bitfields in other functions too.

Signed-off-by: Jarkko Nikula <jarkko.nikula@bitmer.com>
Cc: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
 sound/soc/omap/omap-mcbsp.c |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)

diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c
index 894f2f3..7f70061 100644
--- a/sound/soc/omap/omap-mcbsp.c
+++ b/sound/soc/omap/omap-mcbsp.c
@@ -317,6 +317,10 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream,
 		return 0;
 	}
 
+	regs->rcr2	&= ~(RPHASE | RFRLEN2(0x7f) | RWDLEN2(7));
+	regs->xcr2	&= ~(RPHASE | XFRLEN2(0x7f) | XWDLEN2(7));
+	regs->rcr1	&= ~(RFRLEN1(0x7f) | RWDLEN1(7));
+	regs->xcr1	&= ~(XFRLEN1(0x7f) | XWDLEN1(7));
 	format = mcbsp_data->fmt & SND_SOC_DAIFMT_FORMAT_MASK;
 	wpf = channels = params_channels(params);
 	if (channels == 2 && (format == SND_SOC_DAIFMT_I2S ||
@@ -369,6 +373,8 @@ static int omap_mcbsp_dai_hw_params(struct snd_pcm_substream *substream,
 		framesize = wlen * channels;
 
 	/* Set FS period and length in terms of bit clock periods */
+	regs->srgr2	&= ~FPER(0xfff);
+	regs->srgr1	&= ~FWID(0xff);
 	switch (format) {
 	case SND_SOC_DAIFMT_I2S:
 	case SND_SOC_DAIFMT_LEFT_J:
@@ -505,6 +511,7 @@ static int omap_mcbsp_dai_set_clkdiv(struct snd_soc_dai *cpu_dai,
 		return -ENODEV;
 
 	mcbsp_data->clk_div = div;
+	regs->srgr1	&= ~CLKGDV(0xff);
 	regs->srgr1	|= CLKGDV(div - 1);
 
 	return 0;
@@ -534,6 +541,8 @@ static int omap_mcbsp_dai_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
 			return -EINVAL;
 
 	mcbsp_data->in_freq = freq;
+	regs->srgr2	&= ~CLKSM;
+	regs->pcr0	&= ~SCLKME;
 
 	switch (clk_id) {
 	case OMAP_MCBSP_SYSCLK_CLK:
-- 
1.7.6.3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-10-02 18:51 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-30 13:07 [PATCH 1/3] ASoC: omap-mcbsp: Prepare for init time DAI format setting Jarkko Nikula
2011-09-30 13:07 ` [PATCH 2/3] ASoC: omap: Convert bunch of machine drivers to use init time DAI format Jarkko Nikula
2011-09-30 13:07 ` [PATCH 3/3] ASoC: omap: Use single hw_params callback in sdp3430 and zoom2 Jarkko Nikula
2011-09-30 14:00 ` [PATCH 1/3] ASoC: omap-mcbsp: Prepare for init time DAI format setting Mark Brown
2011-10-02 18:51 ` 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.