All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2 RESEND] ASoC: OMAP: mcbsp: ensure that CLKX and CLKR are not used as ouput pins when they are used as input clock for the SRG.
@ 2015-02-21 17:11 Thomas Niederprüm
  2015-02-26  2:52 ` Mark Brown
  0 siblings, 1 reply; 2+ messages in thread
From: Thomas Niederprüm @ 2015-02-21 17:11 UTC (permalink / raw)
  To: broonie, peter.ujfalusi, jarkko.nikula
  Cc: alsa-devel, linux-omap, Thomas Niederprüm

This patch fixes faulty behaviour in a setup where the input clock for the
SRG is fed through the CLKR/CLKX pin but the McBSP is configured to be
master (SND_SOC_DAIFMT_CBS_CFS). In that case of course CLKR/CLKX must
not be configured as output pin. Otherwise the input clock is messed up
horribly.

This patch makes it possible to use the CLKR/CLKX pin rather than CLKS to
inject a reference clock in setups where McBSP is master and not both
rx and tx are used. However for this to work it has to be ensured that
set_dai_sysclk() is called after set_dai_fmt().

This was tested on a beagleboard-xm using McBSP1 to drive a i2s DAC through
the tx lines (CLKX,FSX,DX). Using this patch the CLKR pin is used to inject
an external reference clock.

Signed-off-by: Thomas Niederprüm <niederp@physik.uni-kl.de>
Acked-by: Peter Ujfalusi <peter.ujfalusi@ti.com>
---
changes since v1:
- added comments explaining the bit masking to disable output on CLKR/CLKX

 sound/soc/omap/omap-mcbsp.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c
index bd3ef2a..662269c 100644
--- a/sound/soc/omap/omap-mcbsp.c
+++ b/sound/soc/omap/omap-mcbsp.c
@@ -530,8 +530,19 @@ static int omap_mcbsp_dai_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
 
 	case OMAP_MCBSP_SYSCLK_CLKX_EXT:
 		regs->srgr2	|= CLKSM;
+		regs->pcr0	|= SCLKME;
+		/*
+		 * If McBSP is master but yet the CLKX/CLKR pin drives the SRG,
+		 * disable output on those pins. This enables to inject the
+		 * reference clock through CLKX/CLKR. For this to work
+		 * set_dai_sysclk() _needs_ to be called after set_dai_fmt().
+		 */
+		regs->pcr0	&= ~CLKXM;
+		break;
 	case OMAP_MCBSP_SYSCLK_CLKR_EXT:
 		regs->pcr0	|= SCLKME;
+		/* Disable ouput on CLKR pin in master mode */
+		regs->pcr0	&= ~CLKRM;
 		break;
 	default:
 		err = -ENODEV;
-- 
2.1.1

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

* Re: [PATCH v2 RESEND] ASoC: OMAP: mcbsp: ensure that CLKX and CLKR are not used as ouput pins when they are used as input clock for the SRG.
  2015-02-21 17:11 [PATCH v2 RESEND] ASoC: OMAP: mcbsp: ensure that CLKX and CLKR are not used as ouput pins when they are used as input clock for the SRG Thomas Niederprüm
@ 2015-02-26  2:52 ` Mark Brown
  0 siblings, 0 replies; 2+ messages in thread
From: Mark Brown @ 2015-02-26  2:52 UTC (permalink / raw)
  To: Thomas Niederprüm
  Cc: peter.ujfalusi, jarkko.nikula, alsa-devel, linux-omap

[-- Attachment #1: Type: text/plain, Size: 787 bytes --]

On Sat, Feb 21, 2015 at 06:11:29PM +0100, Thomas Niederprüm wrote:
> This patch fixes faulty behaviour in a setup where the input clock for the
> SRG is fed through the CLKR/CLKX pin but the McBSP is configured to be
> master (SND_SOC_DAIFMT_CBS_CFS). In that case of course CLKR/CLKX must
> not be configured as output pin. Otherwise the input clock is messed up
> horribly.

Applied, but please as covered in SubmittingPatches word wrap your
changelog entries to less than 80 columns - this is especially important
for the subject line.  Please also remember to CC maintainers on
patches, the reason you've had to resend this patch is that you didn't
originally send it to me (which means the RESEND tag both makes the
subject line even longer and makes me a bit grumpy).

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 473 bytes --]

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

end of thread, other threads:[~2015-02-26  2:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-02-21 17:11 [PATCH v2 RESEND] ASoC: OMAP: mcbsp: ensure that CLKX and CLKR are not used as ouput pins when they are used as input clock for the SRG Thomas Niederprüm
2015-02-26  2:52 ` 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.