alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* mx31 snd and mc13783 codec status
@ 2010-03-30 16:23 Valentin Longchamp
  2010-03-30 20:40 ` Mark Brown
  2010-03-31  8:34 ` Sascha Hauer
  0 siblings, 2 replies; 10+ messages in thread
From: Valentin Longchamp @ 2010-03-30 16:23 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: alsa-devel, linux-arm-kernel@lists.infradead.org

Hi Sascha,

For one of our experiments where our robots need to produce sound, I 
would need a sound driver for mx31moboard platform.

I have quickly hacked something based on what you had done for pcm037 
with the MC13783 codec in some of your first sound patches. I know that 
this is not ready for mainline and I'm still struggling to debug my 
code, but I would like to have results quite soon so that my colleague 
could see what sounds (especially regarding to the volume) our system is 
capable to produce.

I would like to know if by any chance you have some updates on this code 
? And do you know if your initial mc13783 codec support coupled with 
mx31 had some limitations ? Our setup is quite straightforward, we have 
direct connection from the mx31 to the mc13783 on a single SSI.

Thanks for your precisions.

Val

-- 
Valentin Longchamp, PhD Student, EPFL-STI-LSRO1
valentin.longchamp@epfl.ch, Phone: +41216937827
http://people.epfl.ch/valentin.longchamp
MEB3494, Station 9, CH-1015 Lausanne

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

* Re: mx31 snd and mc13783 codec status
  2010-03-30 16:23 mx31 snd and mc13783 codec status Valentin Longchamp
@ 2010-03-30 20:40 ` Mark Brown
  2010-03-31  8:38   ` Sascha Hauer
  2010-03-31  8:34 ` Sascha Hauer
  1 sibling, 1 reply; 10+ messages in thread
From: Mark Brown @ 2010-03-30 20:40 UTC (permalink / raw)
  To: Valentin Longchamp
  Cc: Sascha Hauer, alsa-devel, linux-arm-kernel@lists.infradead.org

On Tue, Mar 30, 2010 at 06:23:18PM +0200, Valentin Longchamp wrote:

> I have quickly hacked something based on what you had done for
> pcm037 with the MC13783 codec in some of your first sound patches. I
> know that this is not ready for mainline and I'm still struggling to
> debug my code, but I would like to have results quite soon so that
> my colleague could see what sounds (especially regarding to the
> volume) our system is capable to produce.

If you're struggling to find time to do full support for the CODEC a
good technique is often to get just very basic fixed function support
(say just DAC to headphone support) implemented and merged, then go back
and implement

I'd also suggest looking at the current Freescale BSPs - obviously this
device is used on a lot of Freescale reference boards and I believe
there's a reasonably mainlineish driver in the BSPs they have for
current devices.

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

* Re: mx31 snd and mc13783 codec status
  2010-03-30 16:23 mx31 snd and mc13783 codec status Valentin Longchamp
  2010-03-30 20:40 ` Mark Brown
@ 2010-03-31  8:34 ` Sascha Hauer
  2010-04-01 16:01   ` Valentin Longchamp
  1 sibling, 1 reply; 10+ messages in thread
From: Sascha Hauer @ 2010-03-31  8:34 UTC (permalink / raw)
  To: Valentin Longchamp; +Cc: alsa-devel, linux-arm-kernel@lists.infradead.org

Hi Valentin,

On Tue, Mar 30, 2010 at 06:23:18PM +0200, Valentin Longchamp wrote:
> Hi Sascha,
>
> For one of our experiments where our robots need to produce sound, I  
> would need a sound driver for mx31moboard platform.
>
> I have quickly hacked something based on what you had done for pcm037  
> with the MC13783 codec in some of your first sound patches. I know that  
> this is not ready for mainline and I'm still struggling to debug my  
> code, but I would like to have results quite soon so that my colleague  
> could see what sounds (especially regarding to the volume) our system is  
> capable to produce.
>
> I would like to know if by any chance you have some updates on this code  
> ?

Find the latest version of my code here:

The following changes since commit 01e77706cdde7c0b47e5ca1f4284a795504c7c40:
  Linus Torvalds (1):
        Merge branch 'for-linus' of git://gitorious.org/linux-omap-dss2/linux

are available in the git repository at:

  git://git.pengutronix.de/git/sha/linux-2.6.git mc13783

Sascha Hauer (3):
      add a mc13783 codec driver
      add phycore-mc13783 sound support
      pcm038: add sound support

 arch/arm/mach-mx2/mach-pcm038.c |   23 ++-
 sound/soc/codecs/Kconfig        |    4 +
 sound/soc/codecs/Makefile       |    2 +
 sound/soc/codecs/mc13783.c      |  727 +++++++++++++++++++++++++++++++++++++++
 sound/soc/codecs/mc13783.h      |   32 ++
 sound/soc/imx/Kconfig           |    9 +
 sound/soc/imx/Makefile          |    3 +
 sound/soc/imx/phycore-mc13783.c |  160 +++++++++
 8 files changed, 959 insertions(+), 1 deletions(-)
 create mode 100644 sound/soc/codecs/mc13783.c
 create mode 100644 sound/soc/codecs/mc13783.h
 create mode 100644 sound/soc/imx/phycore-mc13783.c

> And do you know if your initial mc13783 codec support coupled with  
> mx31 had some limitations ? Our setup is quite straightforward, we have  
> direct connection from the mx31 to the mc13783 on a single SSI.

Our board uses both SSI channels of the MC13783 which we then mux into
one channel in the DAM unit. I don't know how this affects you.

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

* Re: mx31 snd and mc13783 codec status
  2010-03-30 20:40 ` Mark Brown
@ 2010-03-31  8:38   ` Sascha Hauer
  0 siblings, 0 replies; 10+ messages in thread
From: Sascha Hauer @ 2010-03-31  8:38 UTC (permalink / raw)
  To: Mark Brown
  Cc: alsa-devel, linux-arm-kernel@lists.infradead.org,
	Valentin Longchamp

On Tue, Mar 30, 2010 at 09:40:21PM +0100, Mark Brown wrote:
> On Tue, Mar 30, 2010 at 06:23:18PM +0200, Valentin Longchamp wrote:
> 
> > I have quickly hacked something based on what you had done for
> > pcm037 with the MC13783 codec in some of your first sound patches. I
> > know that this is not ready for mainline and I'm still struggling to
> > debug my code, but I would like to have results quite soon so that
> > my colleague could see what sounds (especially regarding to the
> > volume) our system is capable to produce.
> 
> If you're struggling to find time to do full support for the CODEC a
> good technique is often to get just very basic fixed function support
> (say just DAC to headphone support) implemented and merged, then go back
> and implement
> 
> I'd also suggest looking at the current Freescale BSPs - obviously this
> device is used on a lot of Freescale reference boards and I believe
> there's a reasonably mainlineish driver in the BSPs they have for
> current devices.

I think they dropped support for the MC13783 in their BSPs. The MC13783
code is still contained in sound/arm/mxc-alsa-pmic.c and a 200k file
drivers/mxc/pmic/mc13783/pmic_audio.c. That's not exactly mainlineish...

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

* Re: mx31 snd and mc13783 codec status
  2010-03-31  8:34 ` Sascha Hauer
@ 2010-04-01 16:01   ` Valentin Longchamp
  2010-04-02  9:53     ` Sascha Hauer
  0 siblings, 1 reply; 10+ messages in thread
From: Valentin Longchamp @ 2010-04-01 16:01 UTC (permalink / raw)
  To: Sascha Hauer
  Cc: alsa-devel@alsa-project.org, linux-arm-kernel@lists.infradead.org

Hi Sascha,

Sascha Hauer wrote:
> 
> Find the latest version of my code here:
> 
> The following changes since commit 01e77706cdde7c0b47e5ca1f4284a795504c7c40:
>   Linus Torvalds (1):
>         Merge branch 'for-linus' of git://gitorious.org/linux-omap-dss2/linux
> 
> are available in the git repository at:
> 
>   git://git.pengutronix.de/git/sha/linux-2.6.git mc13783
> 
> Sascha Hauer (3):
>       add a mc13783 codec driver
>       add phycore-mc13783 sound support
>       pcm038: add sound support
> 
>  arch/arm/mach-mx2/mach-pcm038.c |   23 ++-
>  sound/soc/codecs/Kconfig        |    4 +
>  sound/soc/codecs/Makefile       |    2 +
>  sound/soc/codecs/mc13783.c      |  727 +++++++++++++++++++++++++++++++++++++++
>  sound/soc/codecs/mc13783.h      |   32 ++
>  sound/soc/imx/Kconfig           |    9 +
>  sound/soc/imx/Makefile          |    3 +
>  sound/soc/imx/phycore-mc13783.c |  160 +++++++++
>  8 files changed, 959 insertions(+), 1 deletions(-)
>  create mode 100644 sound/soc/codecs/mc13783.c
>  create mode 100644 sound/soc/codecs/mc13783.h
>  create mode 100644 sound/soc/imx/phycore-mc13783.c
> 
>> And do you know if your initial mc13783 codec support coupled with  
>> mx31 had some limitations ? Our setup is quite straightforward, we have  
>> direct connection from the mx31 to the mc13783 on a single SSI.
> 
> Our board uses both SSI channels of the MC13783 which we then mux into
> one channel in the DAM unit. I don't know how this affects you.
> 

I have struggled with the DAM unit (this thing is an awful bulk of 
wires) and now I get some sound on the loudspeaker.

The thing is that I get a less than a second sound loop (I use aplay to 
test, so userspace app should be ok), as if the buffer that the fiq asm 
interrupt (from ssi_fiq.S) copies to the SSI hardware never was updated.

If I have understood the fiq behaviour correctly, you have a asm fiq 
interrupt that does copy a larger tx buffer into the SSI hardware. 
Besides it, you have the imx_ssi_timer_callback that checks when the tx 
buffer was completely copied. If it is the case, then a new buffer tx 
buffer is "issued" with the snd_pcm_period_elapsed call (and then 
snd_pcm_update_hw_ptr0). Is this behaviour correct ?

If then it looks like on my system, I have a problem with the 
snd_pcm_update_hw_ptr0 call.

Thanks

Val

-- 
Valentin Longchamp, PhD Student, EPFL-STI-LSRO1
valentin.longchamp@epfl.ch, Phone: +41216937827
http://people.epfl.ch/valentin.longchamp
MEB3494, Station 9, CH-1015 Lausanne

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

* Re: mx31 snd and mc13783 codec status
  2010-04-01 16:01   ` Valentin Longchamp
@ 2010-04-02  9:53     ` Sascha Hauer
  2010-04-02 10:42       ` Mark Brown
  0 siblings, 1 reply; 10+ messages in thread
From: Sascha Hauer @ 2010-04-02  9:53 UTC (permalink / raw)
  To: Valentin Longchamp
  Cc: alsa-devel@alsa-project.org, linux-arm-kernel@lists.infradead.org

On Thu, Apr 01, 2010 at 06:01:38PM +0200, Valentin Longchamp wrote:
> Hi Sascha,
>
> Sascha Hauer wrote:
>>
>> Find the latest version of my code here:
>>
>> The following changes since commit 01e77706cdde7c0b47e5ca1f4284a795504c7c40:
>>   Linus Torvalds (1):
>>         Merge branch 'for-linus' of git://gitorious.org/linux-omap-dss2/linux
>>
>> are available in the git repository at:
>>
>>   git://git.pengutronix.de/git/sha/linux-2.6.git mc13783
>>
>> Sascha Hauer (3):
>>       add a mc13783 codec driver
>>       add phycore-mc13783 sound support
>>       pcm038: add sound support
>>
>>  arch/arm/mach-mx2/mach-pcm038.c |   23 ++-
>>  sound/soc/codecs/Kconfig        |    4 +
>>  sound/soc/codecs/Makefile       |    2 +
>>  sound/soc/codecs/mc13783.c      |  727 +++++++++++++++++++++++++++++++++++++++
>>  sound/soc/codecs/mc13783.h      |   32 ++
>>  sound/soc/imx/Kconfig           |    9 +
>>  sound/soc/imx/Makefile          |    3 +
>>  sound/soc/imx/phycore-mc13783.c |  160 +++++++++
>>  8 files changed, 959 insertions(+), 1 deletions(-)
>>  create mode 100644 sound/soc/codecs/mc13783.c
>>  create mode 100644 sound/soc/codecs/mc13783.h
>>  create mode 100644 sound/soc/imx/phycore-mc13783.c
>>
>>> And do you know if your initial mc13783 codec support coupled with   
>>> mx31 had some limitations ? Our setup is quite straightforward, we 
>>> have  direct connection from the mx31 to the mc13783 on a single SSI.
>>
>> Our board uses both SSI channels of the MC13783 which we then mux into
>> one channel in the DAM unit. I don't know how this affects you.
>>
>
> I have struggled with the DAM unit (this thing is an awful bulk of  
> wires) and now I get some sound on the loudspeaker.
>
> The thing is that I get a less than a second sound loop (I use aplay to  
> test, so userspace app should be ok), as if the buffer that the fiq asm  
> interrupt (from ssi_fiq.S) copies to the SSI hardware never was updated.
>
> If I have understood the fiq behaviour correctly, you have a asm fiq  
> interrupt that does copy a larger tx buffer into the SSI hardware.  
> Besides it, you have the imx_ssi_timer_callback that checks when the tx  
> buffer was completely copied. If it is the case, then a new buffer tx  
> buffer is "issued" with the snd_pcm_period_elapsed call (and then  
> snd_pcm_update_hw_ptr0). Is this behaviour correct ?

Yes.

>
> If then it looks like on my system, I have a problem with the  
> snd_pcm_update_hw_ptr0 call.

You could try reverting b4e82b5b785670b68136765059d1afc65c0ae023. Though
I have tested it on my boards it may have some implications.

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

* Re: mx31 snd and mc13783 codec status
  2010-04-02  9:53     ` Sascha Hauer
@ 2010-04-02 10:42       ` Mark Brown
  2010-04-06 16:00         ` Valentin Longchamp
  2010-04-07 11:03         ` Sascha Hauer
  0 siblings, 2 replies; 10+ messages in thread
From: Mark Brown @ 2010-04-02 10:42 UTC (permalink / raw)
  To: Sascha Hauer
  Cc: alsa-devel@alsa-project.org, linux-arm-kernel@lists.infradead.org,
	Valentin Longchamp

On Fri, Apr 02, 2010 at 11:53:58AM +0200, Sascha Hauer wrote:
> On Thu, Apr 01, 2010 at 06:01:38PM +0200, Valentin Longchamp wrote:

> > The thing is that I get a less than a second sound loop (I use aplay to  
> > test, so userspace app should be ok), as if the buffer that the fiq asm  
> > interrupt (from ssi_fiq.S) copies to the SSI hardware never was updated.

> > If I have understood the fiq behaviour correctly, you have a asm fiq  
> > interrupt that does copy a larger tx buffer into the SSI hardware.  
> > Besides it, you have the imx_ssi_timer_callback that checks when the tx  
> > buffer was completely copied. If it is the case, then a new buffer tx  
> > buffer is "issued" with the snd_pcm_period_elapsed call (and then  
> > snd_pcm_update_hw_ptr0). Is this behaviour correct ?

> Yes.

What sample rate are you trying to play and what buffer size?  In my
testing the FIQ was really struggling with most applications at sample
rates over ~16kHz since you need each audio period to be long enough to
at least fill the interval between timer polls but applications wanted
to select buffer sizes that were consumed faster than the timer tick.

Using an application like speaker-test which has minimal overhead and no
I/O to worry about helps too.

> > If then it looks like on my system, I have a problem with the  
> > snd_pcm_update_hw_ptr0 call.

> You could try reverting b4e82b5b785670b68136765059d1afc65c0ae023. Though
> I have tested it on my boards it may have some implications.

I was seeing similar behaviour before and after that patch too, the main
effect there was to improve the error handling when the FIQ and the
timer get out of sync with each other.

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

* Re: mx31 snd and mc13783 codec status
  2010-04-02 10:42       ` Mark Brown
@ 2010-04-06 16:00         ` Valentin Longchamp
  2010-04-07 11:03         ` Sascha Hauer
  1 sibling, 0 replies; 10+ messages in thread
From: Valentin Longchamp @ 2010-04-06 16:00 UTC (permalink / raw)
  To: Mark Brown
  Cc: Sascha Hauer, alsa-devel@alsa-project.org,
	linux-arm-kernel@lists.infradead.org

Mark Brown wrote:
> On Fri, Apr 02, 2010 at 11:53:58AM +0200, Sascha Hauer wrote:
>> On Thu, Apr 01, 2010 at 06:01:38PM +0200, Valentin Longchamp wrote:
> 
> What sample rate are you trying to play and what buffer size?  In my
> testing the FIQ was really struggling with most applications at sample
> rates over ~16kHz since you need each audio period to be long enough to
> at least fill the interval between timer polls but applications wanted
> to select buffer sizes that were consumed faster than the timer tick.
> 
> Using an application like speaker-test which has minimal overhead and no
> I/O to worry about helps too.

OK, I have done some tests with speaker-test and I experienced the same 
as you did: with rates over 16kHz, the FIQ starts to have some problems.

> 
>>> If then it looks like on my system, I have a problem with the  
>>> snd_pcm_update_hw_ptr0 call.
> 
>> You could try reverting b4e82b5b785670b68136765059d1afc65c0ae023. Though
>> I have tested it on my boards it may have some implications.
> 
> I was seeing similar behaviour before and after that patch too, the main
> effect there was to improve the error handling when the FIQ and the
> timer get out of sync with each other.

Mark is right, the behavior is similar with or without this patch, it 
does not improve the FIQ problems with rates over 16 kHz.

Val

-- 
Valentin Longchamp, PhD Student, EPFL-STI-LSRO1
valentin.longchamp@epfl.ch, Phone: +41216937827
http://people.epfl.ch/valentin.longchamp
MEB3494, Station 9, CH-1015 Lausanne

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

* Re: mx31 snd and mc13783 codec status
  2010-04-02 10:42       ` Mark Brown
  2010-04-06 16:00         ` Valentin Longchamp
@ 2010-04-07 11:03         ` Sascha Hauer
  2010-04-07 12:12           ` Mark Brown
  1 sibling, 1 reply; 10+ messages in thread
From: Sascha Hauer @ 2010-04-07 11:03 UTC (permalink / raw)
  To: Mark Brown
  Cc: alsa-devel@alsa-project.org, linux-arm-kernel@lists.infradead.org,
	Valentin Longchamp

On Fri, Apr 02, 2010 at 11:42:42AM +0100, Mark Brown wrote:
> On Fri, Apr 02, 2010 at 11:53:58AM +0200, Sascha Hauer wrote:
> > On Thu, Apr 01, 2010 at 06:01:38PM +0200, Valentin Longchamp wrote:
> 
> > > The thing is that I get a less than a second sound loop (I use aplay to  
> > > test, so userspace app should be ok), as if the buffer that the fiq asm  
> > > interrupt (from ssi_fiq.S) copies to the SSI hardware never was updated.
> 
> > > If I have understood the fiq behaviour correctly, you have a asm fiq  
> > > interrupt that does copy a larger tx buffer into the SSI hardware.  
> > > Besides it, you have the imx_ssi_timer_callback that checks when the tx  
> > > buffer was completely copied. If it is the case, then a new buffer tx  
> > > buffer is "issued" with the snd_pcm_period_elapsed call (and then  
> > > snd_pcm_update_hw_ptr0). Is this behaviour correct ?
> 
> > Yes.
> 
> What sample rate are you trying to play and what buffer size?  In my
> testing the FIQ was really struggling with most applications at sample
> rates over ~16kHz since you need each audio period to be long enough to
> at least fill the interval between timer polls but applications wanted
> to select buffer sizes that were consumed faster than the timer tick.

I just stumbled upon a board which had something in /etc/asound.conf
which decreased the buffer sizes. The result was choppy sound and a cpu
utilisation of ~40%.

After deleting the file I could play sounds (and record simultaniously)
with rates up to 44100kHz without visible cpu utilisation.

Looking at it I realised that poll_time is 0, so the timer gets reloaded
with the actual jiffies value which of course is a bad idea. We should
probably use a hrtimer here.

Sascha


-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

* Re: mx31 snd and mc13783 codec status
  2010-04-07 11:03         ` Sascha Hauer
@ 2010-04-07 12:12           ` Mark Brown
  0 siblings, 0 replies; 10+ messages in thread
From: Mark Brown @ 2010-04-07 12:12 UTC (permalink / raw)
  To: Sascha Hauer
  Cc: alsa-devel@alsa-project.org, linux-arm-kernel@lists.infradead.org,
	Valentin Longchamp

On Wed, Apr 07, 2010 at 01:03:50PM +0200, Sascha Hauer wrote:
> On Fri, Apr 02, 2010 at 11:42:42AM +0100, Mark Brown wrote:

> > What sample rate are you trying to play and what buffer size?  In my
> > testing the FIQ was really struggling with most applications at sample
> > rates over ~16kHz since you need each audio period to be long enough to
> > at least fill the interval between timer polls but applications wanted
> > to select buffer sizes that were consumed faster than the timer tick.

> After deleting the file I could play sounds (and record simultaniously)
> with rates up to 44100kHz without visible cpu utilisation.

Yes, if you tweak the buffer sizes (most of the ALSA test utilities
support this) then you can use higher sample rates - pulseaudio's high
latency modes should work great, for example.

> Looking at it I realised that poll_time is 0, so the timer gets reloaded
> with the actual jiffies value which of course is a bad idea. We should
> probably use a hrtimer here.

Yes, by default you're only going to be able to poll at 1ms intervals so
the poll time ends up going down to zero.  I did look at switching over
to a hrtimer when I was fixing up the sample rate slips but I wasn't
able to convince myself that there was a hrtimer offering sufficient
resolution available on i.MX.

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

end of thread, other threads:[~2010-04-07 12:12 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-30 16:23 mx31 snd and mc13783 codec status Valentin Longchamp
2010-03-30 20:40 ` Mark Brown
2010-03-31  8:38   ` Sascha Hauer
2010-03-31  8:34 ` Sascha Hauer
2010-04-01 16:01   ` Valentin Longchamp
2010-04-02  9:53     ` Sascha Hauer
2010-04-02 10:42       ` Mark Brown
2010-04-06 16:00         ` Valentin Longchamp
2010-04-07 11:03         ` Sascha Hauer
2010-04-07 12:12           ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).