All of lore.kernel.org
 help / color / mirror / Atom feed
* Audio capture not working with AIC23/McBSP1 on OMAP3517
@ 2009-08-26 13:00 Aggarwal, Anuj
  2009-08-26 13:03 ` [alsa-devel] " Mark Brown
  0 siblings, 1 reply; 13+ messages in thread
From: Aggarwal, Anuj @ 2009-08-26 13:00 UTC (permalink / raw)
  To: linux-omap; +Cc: alsa-devel

Hi,

I am trying to capture audio through LineIn on my OMAP3517 EVM, using 
AIC23 codec and McBSP1, and getting the following error:

arecord: pcm_read:1529: read error: Input/output error

Playback is working fine using the same combination. 

I have tried using another instance of AIC23 codec which uses McBSP2 
and both playback & capture works fine there.

Has anyone faced this issue before? Any suggestions?

Regards,
Anuj Aggarwal

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

* Re: [alsa-devel] Audio capture not working with AIC23/McBSP1 on OMAP3517
  2009-08-26 13:00 Audio capture not working with AIC23/McBSP1 on OMAP3517 Aggarwal, Anuj
@ 2009-08-26 13:03 ` Mark Brown
  2009-08-26 13:19   ` Aggarwal, Anuj
  2009-08-26 13:42   ` Jarkko Nikula
  0 siblings, 2 replies; 13+ messages in thread
From: Mark Brown @ 2009-08-26 13:03 UTC (permalink / raw)
  To: Aggarwal, Anuj; +Cc: linux-omap, alsa-devel

On Wed, Aug 26, 2009 at 06:30:52PM +0530, Aggarwal, Anuj wrote:

> I am trying to capture audio through LineIn on my OMAP3517 EVM, using 
> AIC23 codec and McBSP1, and getting the following error:

> arecord: pcm_read:1529: read error: Input/output error

That suggests that DMA isn't happening - might be worth checking to see
that clocks are being generated properly.

> Playback is working fine using the same combination. 

> I have tried using another instance of AIC23 codec which uses McBSP2 
> and both playback & capture works fine there.

> Has anyone faced this issue before? Any suggestions?

Which kernel are you using?  There are rather a lot of McBSP changes
queued up for 2.6.32.  If this ever worked in the past a git bisect
might be interesting.

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

* Re: Audio capture not working with AIC23/McBSP1 on OMAP3517
  2009-08-26 13:03 ` [alsa-devel] " Mark Brown
@ 2009-08-26 13:19   ` Aggarwal, Anuj
  2009-08-26 14:06     ` [alsa-devel] " Graeme Gregory
  2009-08-26 13:42   ` Jarkko Nikula
  1 sibling, 1 reply; 13+ messages in thread
From: Aggarwal, Anuj @ 2009-08-26 13:19 UTC (permalink / raw)
  To: Mark Brown; +Cc: alsa-devel, linux-omap

> -----Original Message-----
> From: Mark Brown [mailto:broonie@opensource.wolfsonmicro.com]
> Sent: Wednesday, August 26, 2009 6:34 PM
> To: Aggarwal, Anuj
> Cc: linux-omap@vger.kernel.org; alsa-devel@alsa-project.org
> Subject: Re: [alsa-devel] Audio capture not working with AIC23/McBSP1 on
> OMAP3517
> 
> On Wed, Aug 26, 2009 at 06:30:52PM +0530, Aggarwal, Anuj wrote:
> 
> > I am trying to capture audio through LineIn on my OMAP3517 EVM, using
> > AIC23 codec and McBSP1, and getting the following error:
> 
> > arecord: pcm_read:1529: read error: Input/output error
> 
> That suggests that DMA isn't happening - might be worth checking to see
> that clocks are being generated properly.
I am able to see the bit clock and frame sync coming properly.
>
> 
> > Playback is working fine using the same combination.
> 
> > I have tried using another instance of AIC23 codec which uses McBSP2
> > and both playback & capture works fine there.
> 
> > Has anyone faced this issue before? Any suggestions?
> 
> Which kernel are you using?  There are rather a lot of McBSP changes
> queued up for 2.6.32.  If this ever worked in the past a git bisect
> might be interesting.
I am on 2.6.31-rc5. I have to check whether the new patches fix 
anything related to this.

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

* Re: Audio capture not working with AIC23/McBSP1 on OMAP3517
  2009-08-26 13:03 ` [alsa-devel] " Mark Brown
  2009-08-26 13:19   ` Aggarwal, Anuj
@ 2009-08-26 13:42   ` Jarkko Nikula
  2009-08-26 15:01     ` Jarkko Nikula
  1 sibling, 1 reply; 13+ messages in thread
From: Jarkko Nikula @ 2009-08-26 13:42 UTC (permalink / raw)
  To: Mark Brown; +Cc: Aggarwal, Anuj, alsa-devel, linux-omap

On Wed, 26 Aug 2009 14:03:56 +0100
Mark Brown <broonie@opensource.wolfsonmicro.com> wrote:

> On Wed, Aug 26, 2009 at 06:30:52PM +0530, Aggarwal, Anuj wrote:
> 
> > I am trying to capture audio through LineIn on my OMAP3517 EVM, using 
> > AIC23 codec and McBSP1, and getting the following error:
> 
> > arecord: pcm_read:1529: read error: Input/output error
> 
> That suggests that DMA isn't happening - might be worth checking to see
> that clocks are being generated properly.
> 
> > Playback is working fine using the same combination. 
> 
What is exactly your configuration: Is the AIC23 master or slave, how
is the McBSP1 is connected (it has additional FSR and CLKR pins
compared to other ports) and is the pin muxing correct?

I think I have tested the McBSP1 on Beagle but definitely only OMAP as a
master since my codec was oscilloscope.

> Which kernel are you using?  There are rather a lot of McBSP changes
> queued up for 2.6.32.  If this ever worked in the past a git bisect
> might be interesting.

Those recent patches should not any effect into this since they are
mostly playing with the McBSP and DMA interfacing. What comes to my
mind if muxing is correct and if codec is master, this might be related
to those McBSP1 FSR and CLKR setup.


-- 
Jarkko

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

* Re: [alsa-devel] Audio capture not working with AIC23/McBSP1 on OMAP3517
  2009-08-26 13:19   ` Aggarwal, Anuj
@ 2009-08-26 14:06     ` Graeme Gregory
  0 siblings, 0 replies; 13+ messages in thread
From: Graeme Gregory @ 2009-08-26 14:06 UTC (permalink / raw)
  To: Aggarwal, Anuj; +Cc: Mark Brown, linux-omap, alsa-devel

Aggarwal, Anuj wrote:
>> -----Original Message-----
>> From: Mark Brown [mailto:broonie@opensource.wolfsonmicro.com]
>> Sent: Wednesday, August 26, 2009 6:34 PM
>> To: Aggarwal, Anuj
>> Cc: linux-omap@vger.kernel.org; alsa-devel@alsa-project.org
>> Subject: Re: [alsa-devel] Audio capture not working with AIC23/McBSP1 on
>> OMAP3517
>>
>> On Wed, Aug 26, 2009 at 06:30:52PM +0530, Aggarwal, Anuj wrote:
>>
>>     
>>> I am trying to capture audio through LineIn on my OMAP3517 EVM, using
>>> AIC23 codec and McBSP1, and getting the following error:
>>>       
>>> arecord: pcm_read:1529: read error: Input/output error
>>>       
>> That suggests that DMA isn't happening - might be worth checking to see
>> that clocks are being generated properly.
>>     
> I am able to see the bit clock and frame sync coming properly.
>   
>>     
>>> Playback is working fine using the same combination.
>>>       
>>> I have tried using another instance of AIC23 codec which uses McBSP2
>>> and both playback & capture works fine there.
>>>       
>>> Has anyone faced this issue before? Any suggestions?
>>>       
>> Which kernel are you using?  There are rather a lot of McBSP changes
>> queued up for 2.6.32.  If this ever worked in the past a git bisect
>> might be interesting.
>>     
> I am on 2.6.31-rc5. I have to check whether the new patches fix 
> anything related to this.
>   
Not having the corect pinmux settings will also cause this issue as I 
found trying to get McBSP3 working.

Graeme


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

* Re: Audio capture not working with AIC23/McBSP1 on OMAP3517
  2009-08-26 13:42   ` Jarkko Nikula
@ 2009-08-26 15:01     ` Jarkko Nikula
  2009-08-27  9:37       ` Aggarwal, Anuj
  0 siblings, 1 reply; 13+ messages in thread
From: Jarkko Nikula @ 2009-08-26 15:01 UTC (permalink / raw)
  To: Aggarwal, Anuj; +Cc: alsa-devel, Mark Brown, linux-omap

On Wed, 26 Aug 2009 16:42:39 +0300
Jarkko Nikula <jhnikula@gmail.com> wrote:

> Those recent patches should not any effect into this since they are
> mostly playing with the McBSP and DMA interfacing. What comes to my
> mind if muxing is correct and if codec is master, this might be related
> to those McBSP1 FSR and CLKR setup.
> 
Anuj: I think the issue is here that by default McBSP1 receiver is
using the CLKR and FSR pins and if those are not connected, then the
capture doesn't work. Can you try a patch below and add following lines
into your machine driver?

snd_soc_dai_set_sysclk(cpu_dai, OMAP_MCBSP_CLKR_SRC_CLKX, 0,
SND_SOC_CLOCK_IN);
snd_soc_dai_set_sysclk(cpu_dai, OMAP_MCBSP_FSR_SRC_FSX, 0,
SND_SOC_CLOCK_IN);

Patch is compile tested only, generated against mainline 2.6.31-rc7 but should
apply to ALSA tree as well.


-- 
Jarkko

==================== CUT HERE ====================
From: Jarkko Nikula <jhnikula@gmail.com>
Subject: [PATCH] ASoC: OMAP: Add functionality to set CLKR and FSR sources in McBSP DAI

The McBSP1 port in OMAP3 processors (I believe OMAP2 too but I don't have
specifications to check it) have additional CLKR and FSR pins for McBSP1
receiver. Reset default is that receiver is using bit clock and frame
sync signal from those pins but it is possible to configure to use
also CLKX and FSX pins as well. In fact, other McBSP ports are doing that
internally that transmitter and receiver share the CLKX and FSX.

Add functionaly that machine drivers can set the CLKR and FSR sources by
using the snd_soc_dai_set_sysclk.

Thanks to "Aggarwal, Anuj" <anuj.aggarwal@ti.com> for reporting the issue.

Signed-off-by: Jarkko Nikula <jhnikula@gmail.com>
---
 sound/soc/omap/omap-mcbsp.c |   41 +++++++++++++++++++++++++++++++++++++++++
 sound/soc/omap/omap-mcbsp.h |    4 ++++
 2 files changed, 45 insertions(+), 0 deletions(-)

diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c
index a5d46a7..2ea2136 100644
--- a/sound/soc/omap/omap-mcbsp.c
+++ b/sound/soc/omap/omap-mcbsp.c
@@ -462,6 +462,40 @@ static int omap_mcbsp_dai_set_clks_src(struct omap_mcbsp_data *mcbsp_data,
 	return 0;
 }
 
+static int omap_mcbsp_dai_set_rcvr_src(struct omap_mcbsp_data *mcbsp_data,
+				       int clk_id)
+{
+	int sel_bit, set = 0;
+	u16 reg = OMAP2_CONTROL_DEVCONF0;
+
+	if (cpu_class_is_omap1())
+		return -EINVAL; /* TODO: Can this be implemented for OMAP1? */
+	if (mcbsp_data->bus_id != 0)
+		return -EINVAL;
+
+	switch (clk_id) {
+	case OMAP_MCBSP_CLKR_SRC_CLKX:
+		set = 1;
+	case OMAP_MCBSP_CLKR_SRC_CLKR:
+		sel_bit = 3;
+		break;
+	case OMAP_MCBSP_FSR_SRC_FSX:
+		set = 1;
+	case OMAP_MCBSP_FSR_SRC_FSR:
+		sel_bit = 4;
+		break;
+	default:
+		return -EINVAL;
+	}
+
+	if (set)
+		omap_ctrl_writel(omap_ctrl_readl(reg) | (1 << sel_bit), reg);
+	else
+		omap_ctrl_writel(omap_ctrl_readl(reg) & ~(1 << sel_bit), reg);
+
+	return 0;
+}
+
 static int omap_mcbsp_dai_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
 					 int clk_id, unsigned int freq,
 					 int dir)
@@ -484,6 +518,13 @@ static int omap_mcbsp_dai_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
 	case OMAP_MCBSP_SYSCLK_CLKR_EXT:
 		regs->pcr0	|= SCLKME;
 		break;
+
+	case OMAP_MCBSP_CLKR_SRC_CLKR:
+	case OMAP_MCBSP_CLKR_SRC_CLKX:
+	case OMAP_MCBSP_FSR_SRC_FSR:
+	case OMAP_MCBSP_FSR_SRC_FSX:
+		err = omap_mcbsp_dai_set_rcvr_src(mcbsp_data, clk_id);
+		break;
 	default:
 		err = -ENODEV;
 	}
diff --git a/sound/soc/omap/omap-mcbsp.h b/sound/soc/omap/omap-mcbsp.h
index c8147aa..647d2f9 100644
--- a/sound/soc/omap/omap-mcbsp.h
+++ b/sound/soc/omap/omap-mcbsp.h
@@ -32,6 +32,10 @@ enum omap_mcbsp_clksrg_clk {
 	OMAP_MCBSP_SYSCLK_CLK,		/* Internal ICLK */
 	OMAP_MCBSP_SYSCLK_CLKX_EXT,	/* External CLKX pin */
 	OMAP_MCBSP_SYSCLK_CLKR_EXT,	/* External CLKR pin */
+	OMAP_MCBSP_CLKR_SRC_CLKR,	/* CLKR from CLKR pin */
+	OMAP_MCBSP_CLKR_SRC_CLKX,	/* CLKR from CLKX pin */
+	OMAP_MCBSP_FSR_SRC_FSR,		/* FSR from FSR pin */
+	OMAP_MCBSP_FSR_SRC_FSX,		/* FSR from FSX pin */
 };
 
 /* McBSP dividers */
-- 
1.6.3.3

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

* Re: Audio capture not working with AIC23/McBSP1 on OMAP3517
  2009-08-26 15:01     ` Jarkko Nikula
@ 2009-08-27  9:37       ` Aggarwal, Anuj
  2009-08-27 11:12         ` Jarkko Nikula
  0 siblings, 1 reply; 13+ messages in thread
From: Aggarwal, Anuj @ 2009-08-27  9:37 UTC (permalink / raw)
  To: Jarkko Nikula; +Cc: alsa-devel, Mark Brown, linux-omap

Thanks Jarkko, the patch works for me.

I will be submitting my ASoC omap*.c file soon after making all 
the necessary changes.

Regards,
Anuj Aggarwal


> -----Original Message-----
> From: Jarkko Nikula [mailto:jhnikula@gmail.com]
> Sent: Wednesday, August 26, 2009 8:32 PM
> To: Aggarwal, Anuj
> Cc: Mark Brown; alsa-devel@alsa-project.org; linux-omap@vger.kernel.org
> Subject: Re: [alsa-devel] Audio capture not working with AIC23/McBSP1 on
> OMAP3517
> 
> On Wed, 26 Aug 2009 16:42:39 +0300
> Jarkko Nikula <jhnikula@gmail.com> wrote:
> 
> > Those recent patches should not any effect into this since they are
> > mostly playing with the McBSP and DMA interfacing. What comes to my
> > mind if muxing is correct and if codec is master, this might be related
> > to those McBSP1 FSR and CLKR setup.
> >
> Anuj: I think the issue is here that by default McBSP1 receiver is
> using the CLKR and FSR pins and if those are not connected, then the
> capture doesn't work. Can you try a patch below and add following lines
> into your machine driver?
> 
> snd_soc_dai_set_sysclk(cpu_dai, OMAP_MCBSP_CLKR_SRC_CLKX, 0,
> SND_SOC_CLOCK_IN);
> snd_soc_dai_set_sysclk(cpu_dai, OMAP_MCBSP_FSR_SRC_FSX, 0,
> SND_SOC_CLOCK_IN);
> 
> Patch is compile tested only, generated against mainline 2.6.31-rc7 but
> should
> apply to ALSA tree as well.
> 
> 
> --
> Jarkko
> 
> ==================== CUT HERE ====================
> From: Jarkko Nikula <jhnikula@gmail.com>
> Subject: [PATCH] ASoC: OMAP: Add functionality to set CLKR and FSR sources
> in McBSP DAI
> 
> The McBSP1 port in OMAP3 processors (I believe OMAP2 too but I don't have
> specifications to check it) have additional CLKR and FSR pins for McBSP1
> receiver. Reset default is that receiver is using bit clock and frame
> sync signal from those pins but it is possible to configure to use
> also CLKX and FSX pins as well. In fact, other McBSP ports are doing that
> internally that transmitter and receiver share the CLKX and FSX.
> 
> Add functionaly that machine drivers can set the CLKR and FSR sources by
> using the snd_soc_dai_set_sysclk.
> 
> Thanks to "Aggarwal, Anuj" <anuj.aggarwal@ti.com> for reporting the issue.
> 
> Signed-off-by: Jarkko Nikula <jhnikula@gmail.com>
> ---
>  sound/soc/omap/omap-mcbsp.c |   41
> +++++++++++++++++++++++++++++++++++++++++
>  sound/soc/omap/omap-mcbsp.h |    4 ++++
>  2 files changed, 45 insertions(+), 0 deletions(-)
> 
> diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c
> index a5d46a7..2ea2136 100644
> --- a/sound/soc/omap/omap-mcbsp.c
> +++ b/sound/soc/omap/omap-mcbsp.c
> @@ -462,6 +462,40 @@ static int omap_mcbsp_dai_set_clks_src(struct
> omap_mcbsp_data *mcbsp_data,
>  	return 0;
>  }
> 
> +static int omap_mcbsp_dai_set_rcvr_src(struct omap_mcbsp_data
> *mcbsp_data,
> +				       int clk_id)
> +{
> +	int sel_bit, set = 0;
> +	u16 reg = OMAP2_CONTROL_DEVCONF0;
> +
> +	if (cpu_class_is_omap1())
> +		return -EINVAL; /* TODO: Can this be implemented for OMAP1? */
> +	if (mcbsp_data->bus_id != 0)
> +		return -EINVAL;
> +
> +	switch (clk_id) {
> +	case OMAP_MCBSP_CLKR_SRC_CLKX:
> +		set = 1;
> +	case OMAP_MCBSP_CLKR_SRC_CLKR:
> +		sel_bit = 3;
> +		break;
> +	case OMAP_MCBSP_FSR_SRC_FSX:
> +		set = 1;
> +	case OMAP_MCBSP_FSR_SRC_FSR:
> +		sel_bit = 4;
> +		break;
> +	default:
> +		return -EINVAL;
> +	}
> +
> +	if (set)
> +		omap_ctrl_writel(omap_ctrl_readl(reg) | (1 << sel_bit), reg);
> +	else
> +		omap_ctrl_writel(omap_ctrl_readl(reg) & ~(1 << sel_bit), reg);
> +
> +	return 0;
> +}
> +
>  static int omap_mcbsp_dai_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
>  					 int clk_id, unsigned int freq,
>  					 int dir)
> @@ -484,6 +518,13 @@ static int omap_mcbsp_dai_set_dai_sysclk(struct
> snd_soc_dai *cpu_dai,
>  	case OMAP_MCBSP_SYSCLK_CLKR_EXT:
>  		regs->pcr0	|= SCLKME;
>  		break;
> +
> +	case OMAP_MCBSP_CLKR_SRC_CLKR:
> +	case OMAP_MCBSP_CLKR_SRC_CLKX:
> +	case OMAP_MCBSP_FSR_SRC_FSR:
> +	case OMAP_MCBSP_FSR_SRC_FSX:
> +		err = omap_mcbsp_dai_set_rcvr_src(mcbsp_data, clk_id);
> +		break;
>  	default:
>  		err = -ENODEV;
>  	}
> diff --git a/sound/soc/omap/omap-mcbsp.h b/sound/soc/omap/omap-mcbsp.h
> index c8147aa..647d2f9 100644
> --- a/sound/soc/omap/omap-mcbsp.h
> +++ b/sound/soc/omap/omap-mcbsp.h
> @@ -32,6 +32,10 @@ enum omap_mcbsp_clksrg_clk {
>  	OMAP_MCBSP_SYSCLK_CLK,		/* Internal ICLK */
>  	OMAP_MCBSP_SYSCLK_CLKX_EXT,	/* External CLKX pin */
>  	OMAP_MCBSP_SYSCLK_CLKR_EXT,	/* External CLKR pin */
> +	OMAP_MCBSP_CLKR_SRC_CLKR,	/* CLKR from CLKR pin */
> +	OMAP_MCBSP_CLKR_SRC_CLKX,	/* CLKR from CLKX pin */
> +	OMAP_MCBSP_FSR_SRC_FSR,		/* FSR from FSR pin */
> +	OMAP_MCBSP_FSR_SRC_FSX,		/* FSR from FSX pin */
>  };
> 
>  /* McBSP dividers */
> --
> 1.6.3.3
> 

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

* Re: Audio capture not working with AIC23/McBSP1 on OMAP3517
  2009-08-27  9:37       ` Aggarwal, Anuj
@ 2009-08-27 11:12         ` Jarkko Nikula
  2009-08-28  6:55           ` Peter Ujfalusi
  0 siblings, 1 reply; 13+ messages in thread
From: Jarkko Nikula @ 2009-08-27 11:12 UTC (permalink / raw)
  To: Aggarwal, Anuj; +Cc: alsa-devel, Mark Brown, Peter Ujfalusi, linux-omap

On Thu, 27 Aug 2009 15:07:32 +0530
"Aggarwal, Anuj" <anuj.aggarwal@ti.com> wrote:

> Thanks Jarkko, the patch works for me.
> 
This is nice to hear.

Can you, Peter or who has access to 2420 and 2430 TRMs to verify is the
DEVCONF0 bits 3 and 4 selecting there also the McBSP1 CLKR and FSR
sources like my patch is now assuming for all OMAP2-3.


-- 
Jarkko

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

* Re: Audio capture not working with AIC23/McBSP1 on OMAP3517
  2009-08-27 11:12         ` Jarkko Nikula
@ 2009-08-28  6:55           ` Peter Ujfalusi
  2009-08-28 10:51             ` Jarkko Nikula
  0 siblings, 1 reply; 13+ messages in thread
From: Peter Ujfalusi @ 2009-08-28  6:55 UTC (permalink / raw)
  To: ext Jarkko Nikula; +Cc: Aggarwal, Anuj, alsa-devel, Mark Brown, linux-omap

On Thursday 27 August 2009 14:12:53 ext Jarkko Nikula wrote:
> On Thu, 27 Aug 2009 15:07:32 +0530
>
> "Aggarwal, Anuj" <anuj.aggarwal@ti.com> wrote:
> > Thanks Jarkko, the patch works for me.
>
> This is nice to hear.
>
> Can you, Peter or who has access to 2420 and 2430 TRMs to verify is the
> DEVCONF0 bits 3 and 4 selecting there also the McBSP1 CLKR and FSR
> sources like my patch is now assuming for all OMAP2-3.

On OMAP2:
DEVCONF:3 MCBSP1_CLKR
DEVCONF:4 MCBSP1_FSR

So it is correct for  both OMAP2 and OMAP3.

-- 
Péter

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

* Re: Audio capture not working with AIC23/McBSP1 on OMAP3517
  2009-08-28  6:55           ` Peter Ujfalusi
@ 2009-08-28 10:51             ` Jarkko Nikula
  2009-08-28 12:05               ` [alsa-devel] " Mark Brown
  0 siblings, 1 reply; 13+ messages in thread
From: Jarkko Nikula @ 2009-08-28 10:51 UTC (permalink / raw)
  To: Peter Ujfalusi; +Cc: Aggarwal, Anuj, alsa-devel, Mark Brown, linux-omap

On Fri, 28 Aug 2009 09:55:01 +0300
Peter Ujfalusi <peter.ujfalusi@nokia.com> wrote:

> > Can you, Peter or who has access to 2420 and 2430 TRMs to verify is the
> > DEVCONF0 bits 3 and 4 selecting there also the McBSP1 CLKR and FSR
> > sources like my patch is now assuming for all OMAP2-3.
> 
> On OMAP2:
> DEVCONF:3 MCBSP1_CLKR
> DEVCONF:4 MCBSP1_FSR
> 
> So it is correct for  both OMAP2 and OMAP3.
> 
Good :-)

Are you Mark fine with the patch [] where the snd_soc_dai_set_sysclk
is used to specify source pin for CLKR and FSR?


-- 
Jarkko

1.
http://mailman.alsa-project.org/pipermail/alsa-devel/2009-August/020771.html

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

* Re: [alsa-devel] Audio capture not working with AIC23/McBSP1 on OMAP3517
  2009-08-28 10:51             ` Jarkko Nikula
@ 2009-08-28 12:05               ` Mark Brown
  2009-08-28 12:35                 ` [PATCH] ASoC: OMAP: Add functionality to set CLKR and FSR sources in McBSP DAI Jarkko Nikula
  0 siblings, 1 reply; 13+ messages in thread
From: Mark Brown @ 2009-08-28 12:05 UTC (permalink / raw)
  To: Jarkko Nikula; +Cc: Peter Ujfalusi, Aggarwal, Anuj, alsa-devel, linux-omap

On Fri, Aug 28, 2009 at 01:51:03PM +0300, Jarkko Nikula wrote:

> Are you Mark fine with the patch [] where the snd_soc_dai_set_sysclk
> is used to specify source pin for CLKR and FSR?

Yes, that's OK.  Could you re-send the patch, I don't think I've got a
local copy any more?

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

* [PATCH] ASoC: OMAP: Add functionality to set CLKR and FSR sources in McBSP DAI
  2009-08-28 12:05               ` [alsa-devel] " Mark Brown
@ 2009-08-28 12:35                 ` Jarkko Nikula
  2009-08-28 17:41                   ` Mark Brown
  0 siblings, 1 reply; 13+ messages in thread
From: Jarkko Nikula @ 2009-08-28 12:35 UTC (permalink / raw)
  To: alsa-devel; +Cc: Mark Brown

The McBSP1 port in OMAP3 processors (I believe OMAP2 too but I don't have
specifications to check it) have additional CLKR and FSR pins for McBSP1
receiver. Reset default is that receiver is using bit clock and frame
sync signal from those pins but it is possible to configure to use
also CLKX and FSX pins as well. In fact, other McBSP ports are doing that
internally that transmitter and receiver share the CLKX and FSX.

Add functionaly that machine drivers can set the CLKR and FSR sources by
using the snd_soc_dai_set_sysclk.

Thanks to "Aggarwal, Anuj" <anuj.aggarwal@ti.com> for reporting the issue.

Signed-off-by: Jarkko Nikula <jhnikula@gmail.com>
---
 sound/soc/omap/omap-mcbsp.c |   41 +++++++++++++++++++++++++++++++++++++++++
 sound/soc/omap/omap-mcbsp.h |    4 ++++
 2 files changed, 45 insertions(+), 0 deletions(-)

diff --git a/sound/soc/omap/omap-mcbsp.c b/sound/soc/omap/omap-mcbsp.c
index 0e173e7..3341f49 100644
--- a/sound/soc/omap/omap-mcbsp.c
+++ b/sound/soc/omap/omap-mcbsp.c
@@ -512,6 +512,40 @@ static int omap_mcbsp_dai_set_clks_src(struct omap_mcbsp_data *mcbsp_data,
 	return 0;
 }
 
+static int omap_mcbsp_dai_set_rcvr_src(struct omap_mcbsp_data *mcbsp_data,
+				       int clk_id)
+{
+	int sel_bit, set = 0;
+	u16 reg = OMAP2_CONTROL_DEVCONF0;
+
+	if (cpu_class_is_omap1())
+		return -EINVAL; /* TODO: Can this be implemented for OMAP1? */
+	if (mcbsp_data->bus_id != 0)
+		return -EINVAL;
+
+	switch (clk_id) {
+	case OMAP_MCBSP_CLKR_SRC_CLKX:
+		set = 1;
+	case OMAP_MCBSP_CLKR_SRC_CLKR:
+		sel_bit = 3;
+		break;
+	case OMAP_MCBSP_FSR_SRC_FSX:
+		set = 1;
+	case OMAP_MCBSP_FSR_SRC_FSR:
+		sel_bit = 4;
+		break;
+	default:
+		return -EINVAL;
+	}
+
+	if (set)
+		omap_ctrl_writel(omap_ctrl_readl(reg) | (1 << sel_bit), reg);
+	else
+		omap_ctrl_writel(omap_ctrl_readl(reg) & ~(1 << sel_bit), reg);
+
+	return 0;
+}
+
 static int omap_mcbsp_dai_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
 					 int clk_id, unsigned int freq,
 					 int dir)
@@ -534,6 +568,13 @@ static int omap_mcbsp_dai_set_dai_sysclk(struct snd_soc_dai *cpu_dai,
 	case OMAP_MCBSP_SYSCLK_CLKR_EXT:
 		regs->pcr0	|= SCLKME;
 		break;
+
+	case OMAP_MCBSP_CLKR_SRC_CLKR:
+	case OMAP_MCBSP_CLKR_SRC_CLKX:
+	case OMAP_MCBSP_FSR_SRC_FSR:
+	case OMAP_MCBSP_FSR_SRC_FSX:
+		err = omap_mcbsp_dai_set_rcvr_src(mcbsp_data, clk_id);
+		break;
 	default:
 		err = -ENODEV;
 	}
diff --git a/sound/soc/omap/omap-mcbsp.h b/sound/soc/omap/omap-mcbsp.h
index c8147aa..647d2f9 100644
--- a/sound/soc/omap/omap-mcbsp.h
+++ b/sound/soc/omap/omap-mcbsp.h
@@ -32,6 +32,10 @@ enum omap_mcbsp_clksrg_clk {
 	OMAP_MCBSP_SYSCLK_CLK,		/* Internal ICLK */
 	OMAP_MCBSP_SYSCLK_CLKX_EXT,	/* External CLKX pin */
 	OMAP_MCBSP_SYSCLK_CLKR_EXT,	/* External CLKR pin */
+	OMAP_MCBSP_CLKR_SRC_CLKR,	/* CLKR from CLKR pin */
+	OMAP_MCBSP_CLKR_SRC_CLKX,	/* CLKR from CLKX pin */
+	OMAP_MCBSP_FSR_SRC_FSR,		/* FSR from FSR pin */
+	OMAP_MCBSP_FSR_SRC_FSX,		/* FSR from FSX pin */
 };
 
 /* McBSP dividers */
-- 
1.6.3.3

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

* Re: [PATCH] ASoC: OMAP: Add functionality to set CLKR and FSR sources in McBSP DAI
  2009-08-28 12:35                 ` [PATCH] ASoC: OMAP: Add functionality to set CLKR and FSR sources in McBSP DAI Jarkko Nikula
@ 2009-08-28 17:41                   ` Mark Brown
  0 siblings, 0 replies; 13+ messages in thread
From: Mark Brown @ 2009-08-28 17:41 UTC (permalink / raw)
  To: Jarkko Nikula; +Cc: alsa-devel

On Fri, Aug 28, 2009 at 03:35:35PM +0300, Jarkko Nikula wrote:

> Add functionaly that machine drivers can set the CLKR and FSR sources by
> using the snd_soc_dai_set_sysclk.

Applied, thanks.

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

end of thread, other threads:[~2009-08-28 17:42 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-08-26 13:00 Audio capture not working with AIC23/McBSP1 on OMAP3517 Aggarwal, Anuj
2009-08-26 13:03 ` [alsa-devel] " Mark Brown
2009-08-26 13:19   ` Aggarwal, Anuj
2009-08-26 14:06     ` [alsa-devel] " Graeme Gregory
2009-08-26 13:42   ` Jarkko Nikula
2009-08-26 15:01     ` Jarkko Nikula
2009-08-27  9:37       ` Aggarwal, Anuj
2009-08-27 11:12         ` Jarkko Nikula
2009-08-28  6:55           ` Peter Ujfalusi
2009-08-28 10:51             ` Jarkko Nikula
2009-08-28 12:05               ` [alsa-devel] " Mark Brown
2009-08-28 12:35                 ` [PATCH] ASoC: OMAP: Add functionality to set CLKR and FSR sources in McBSP DAI Jarkko Nikula
2009-08-28 17:41                   ` 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.