diff options
author | Timur Tabi <timur@freescale.com> | 2009-02-05 18:56:02 -0500 |
---|---|---|
committer | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2009-02-06 07:08:15 -0500 |
commit | 85ef2375ef2ebbb2bf660ad3a27c644d0ebf1b1a (patch) | |
tree | bc4b8904b3d74437f03744ecc37bb0a79828b027 /sound/soc/fsl/fsl_ssi.c | |
parent | 8836c273e4d44d088157b7ccbd2c108cefe70565 (diff) |
ASoC: optimize init sequence of Freescale MPC8610 sound drivers
In the Freescale MPC8610 sound drivers, relocate all code from the _prepare
functions into the corresponding _hw_params functions. These drivers assumed
that the sample size is known in the _prepare function and not in the
_hw_params function, but this is not true.
Move the code in fsl_dma_prepare() into fsl_dma_hw_param(). Create
fsl_ssi_hw_params() and move the code from fsl_ssi_prepare() into it.
Turn off snooping for DMA operations to/from I/O registers, since that's not
necessary.
Signed-off-by: Timur Tabi <timur@freescale.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/fsl/fsl_ssi.c')
-rw-r--r-- | sound/soc/fsl/fsl_ssi.c | 19 |
1 files changed, 9 insertions, 10 deletions
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c index c6d6eb71dc1d..6844009833db 100644 --- a/sound/soc/fsl/fsl_ssi.c +++ b/sound/soc/fsl/fsl_ssi.c | |||
@@ -400,7 +400,7 @@ static int fsl_ssi_startup(struct snd_pcm_substream *substream, | |||
400 | } | 400 | } |
401 | 401 | ||
402 | /** | 402 | /** |
403 | * fsl_ssi_prepare: prepare the SSI. | 403 | * fsl_ssi_hw_params - program the sample size |
404 | * | 404 | * |
405 | * Most of the SSI registers have been programmed in the startup function, | 405 | * Most of the SSI registers have been programmed in the startup function, |
406 | * but the word length must be programmed here. Unfortunately, programming | 406 | * but the word length must be programmed here. Unfortunately, programming |
@@ -412,20 +412,19 @@ static int fsl_ssi_startup(struct snd_pcm_substream *substream, | |||
412 | * Note: The SxCCR.DC and SxCCR.PM bits are only used if the SSI is the | 412 | * Note: The SxCCR.DC and SxCCR.PM bits are only used if the SSI is the |
413 | * clock master. | 413 | * clock master. |
414 | */ | 414 | */ |
415 | static int fsl_ssi_prepare(struct snd_pcm_substream *substream, | 415 | static int fsl_ssi_hw_params(struct snd_pcm_substream *substream, |
416 | struct snd_soc_dai *dai) | 416 | struct snd_pcm_hw_params *hw_params, struct snd_soc_dai *cpu_dai) |
417 | { | 417 | { |
418 | struct snd_pcm_runtime *runtime = substream->runtime; | 418 | struct fsl_ssi_private *ssi_private = cpu_dai->private_data; |
419 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
420 | struct fsl_ssi_private *ssi_private = rtd->dai->cpu_dai->private_data; | ||
421 | |||
422 | struct ccsr_ssi __iomem *ssi = ssi_private->ssi; | ||
423 | 419 | ||
424 | if (substream == ssi_private->first_stream) { | 420 | if (substream == ssi_private->first_stream) { |
421 | struct ccsr_ssi __iomem *ssi = ssi_private->ssi; | ||
422 | unsigned int sample_size = | ||
423 | snd_pcm_format_width(params_format(hw_params)); | ||
425 | u32 wl; | 424 | u32 wl; |
426 | 425 | ||
427 | /* The SSI should always be disabled at this points (SSIEN=0) */ | 426 | /* The SSI should always be disabled at this points (SSIEN=0) */ |
428 | wl = CCSR_SSI_SxCCR_WL(snd_pcm_format_width(runtime->format)); | 427 | wl = CCSR_SSI_SxCCR_WL(sample_size); |
429 | 428 | ||
430 | /* In synchronous mode, the SSI uses STCCR for capture */ | 429 | /* In synchronous mode, the SSI uses STCCR for capture */ |
431 | clrsetbits_be32(&ssi->stccr, CCSR_SSI_SxCCR_WL_MASK, wl); | 430 | clrsetbits_be32(&ssi->stccr, CCSR_SSI_SxCCR_WL_MASK, wl); |
@@ -579,7 +578,7 @@ static struct snd_soc_dai fsl_ssi_dai_template = { | |||
579 | }, | 578 | }, |
580 | .ops = { | 579 | .ops = { |
581 | .startup = fsl_ssi_startup, | 580 | .startup = fsl_ssi_startup, |
582 | .prepare = fsl_ssi_prepare, | 581 | .hw_params = fsl_ssi_hw_params, |
583 | .shutdown = fsl_ssi_shutdown, | 582 | .shutdown = fsl_ssi_shutdown, |
584 | .trigger = fsl_ssi_trigger, | 583 | .trigger = fsl_ssi_trigger, |
585 | .set_sysclk = fsl_ssi_set_sysclk, | 584 | .set_sysclk = fsl_ssi_set_sysclk, |