All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] OMAP: McBSP: Do not enable SRG in slave mode
@ 2010-08-31  8:11 Peter Ujfalusi
  2010-08-31 10:36 ` Jarkko Nikula
  2010-09-23 18:08 ` [APPLIED] " Tony Lindgren
  0 siblings, 2 replies; 3+ messages in thread
From: Peter Ujfalusi @ 2010-08-31  8:11 UTC (permalink / raw)
  To: linux-omap; +Cc: tony, jhnikula

McBSP SRG (Sample Rate Generator) and FSG (Frame Sync
Generator) is only needed to be enabled, when McBSP
is master.
In McBSP slave mode, the SRG, and FSG can be kept disabled,
which might save some power at the end in this configuration.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
---

Hello Jarkko,

I have tested this on OMAP3, but I think this should be
applicable for other OMAP versions as well.
When McBSP was slave the audio worked fine, when I left
the SRG, and FSG disabled.

 arch/arm/plat-omap/mcbsp.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c
index e31496e..ecbfe39 100644
--- a/arch/arm/plat-omap/mcbsp.c
+++ b/arch/arm/plat-omap/mcbsp.c
@@ -878,7 +878,7 @@ EXPORT_SYMBOL(omap_mcbsp_free);
 void omap_mcbsp_start(unsigned int id, int tx, int rx)
 {
 	struct omap_mcbsp *mcbsp;
-	int idle;
+	int enable_srg = 0;
 	u16 w;
 
 	if (!omap_mcbsp_check_valid_id(id)) {
@@ -893,10 +893,13 @@ void omap_mcbsp_start(unsigned int id, int tx, int rx)
 	mcbsp->rx_word_length = (MCBSP_READ_CACHE(mcbsp, RCR1) >> 5) & 0x7;
 	mcbsp->tx_word_length = (MCBSP_READ_CACHE(mcbsp, XCR1) >> 5) & 0x7;
 
-	idle = !((MCBSP_READ_CACHE(mcbsp, SPCR2) |
-			MCBSP_READ_CACHE(mcbsp, SPCR1)) & 1);
+	/* Only enable SRG, if McBSP is master */
+	w = MCBSP_READ_CACHE(mcbsp, PCR0);
+	if (w & (FSXM | FSRM | CLKXM | CLKRM))
+		enable_srg = !((MCBSP_READ_CACHE(mcbsp, SPCR2) |
+				MCBSP_READ_CACHE(mcbsp, SPCR1)) & 1);
 
-	if (idle) {
+	if (enable_srg) {
 		/* Start the sample generator */
 		w = MCBSP_READ_CACHE(mcbsp, SPCR2);
 		MCBSP_WRITE(mcbsp, SPCR2, w | (1 << 6));
@@ -919,7 +922,7 @@ void omap_mcbsp_start(unsigned int id, int tx, int rx)
 	 */
 	udelay(500);
 
-	if (idle) {
+	if (enable_srg) {
 		/* Start frame sync */
 		w = MCBSP_READ_CACHE(mcbsp, SPCR2);
 		MCBSP_WRITE(mcbsp, SPCR2, w | (1 << 7));
-- 
1.7.2.2


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

* Re: [PATCH] OMAP: McBSP: Do not enable SRG in slave mode
  2010-08-31  8:11 [PATCH] OMAP: McBSP: Do not enable SRG in slave mode Peter Ujfalusi
@ 2010-08-31 10:36 ` Jarkko Nikula
  2010-09-23 18:08 ` [APPLIED] " Tony Lindgren
  1 sibling, 0 replies; 3+ messages in thread
From: Jarkko Nikula @ 2010-08-31 10:36 UTC (permalink / raw)
  To: Peter Ujfalusi; +Cc: linux-omap, tony

On Tue, 31 Aug 2010 11:11:44 +0300
Peter Ujfalusi <peter.ujfalusi@nokia.com> wrote:

> McBSP SRG (Sample Rate Generator) and FSG (Frame Sync
> Generator) is only needed to be enabled, when McBSP
> is master.
> In McBSP slave mode, the SRG, and FSG can be kept disabled,
> which might save some power at the end in this configuration.
> 
> Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
> ---
> 
> Hello Jarkko,
> 
> I have tested this on OMAP3, but I think this should be
> applicable for other OMAP versions as well.
> When McBSP was slave the audio worked fine, when I left
> the SRG, and FSG disabled.
> 
Sounds logical if there is no need to keep SRG and FSG active when
McBSP is slave. I tested this on N810.

Acked-by: Jarkko Nikula <jhnikula@gmail.com>

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

* [APPLIED] [PATCH] OMAP: McBSP: Do not enable SRG in slave mode
  2010-08-31  8:11 [PATCH] OMAP: McBSP: Do not enable SRG in slave mode Peter Ujfalusi
  2010-08-31 10:36 ` Jarkko Nikula
@ 2010-09-23 18:08 ` Tony Lindgren
  1 sibling, 0 replies; 3+ messages in thread
From: Tony Lindgren @ 2010-09-23 18:08 UTC (permalink / raw)
  To: linux-omap

This patch has been applied to the linux-omap
by youw fwiendly patch wobot.

Branch in linux-omap: devel-omap-misc

Initial commit ID (Likely to change): d0db27786b9fabeac6cb330ccf127451c249af73

PatchWorks
http://patchwork.kernel.org/patch/144621/

Git (Likely to change, and takes a while to get mirrored)
http://git.kernel.org/?p=linux/kernel/git/tmlind/linux-omap-2.6.git;a=commit;h=d0db27786b9fabeac6cb330ccf127451c249af73



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

end of thread, other threads:[~2010-09-23 18:08 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-08-31  8:11 [PATCH] OMAP: McBSP: Do not enable SRG in slave mode Peter Ujfalusi
2010-08-31 10:36 ` Jarkko Nikula
2010-09-23 18:08 ` [APPLIED] " Tony Lindgren

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.