public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: Janusz Krzysztofik <jkrzyszt@tis.icnet.pl>
To: Jarkko Nikula <jhnikula@gmail.com>
Cc: linux-omap@vger.kernel.org, alsa-devel@vger.kernel.org
Subject: Re: Please help in adding ams-delta support to ASoC
Date: Tue, 09 Jun 2009 17:00:49 +0200	[thread overview]
Message-ID: <4A2E7921.7090200@tis.icnet.pl> (raw)
In-Reply-To: <20090608094028.415e6ec3.jhnikula@gmail.com>

Jarkko Nikula wrote:
> On Sat, 6 Jun 2009 00:28:00 +0200
> Janusz Krzysztofik <jkrzyszt@tis.icnet.pl> wrote:
>> My last idea was to create a generic test driver that would not use
>> any external clocks, ie configured with OMAP_MCBSP_SYSCLK_CLK and
>> SND_SOC_DAIFMT_CBS_CFS, right? That way, it should just work without
>> any hardware support except for mcbsp and maybe we could then
>> definitelly verify if current mcbsp and dma code works on omap1510 or
>> not.
>>
> This could be a bit risky and can damage your HW since both OMAP and
> codec are then driving the bit-clock and FS signals but you could try
> to configure McBSP as a master and use the internal clock source as its
> input.

I found that in OMAP5910, CLKR and FSR signals are not connected to any 
pins, so I can safely set them as output. To make use of this feature, I 
have modified sound/soc/omap/omap-mcbsp.c slightly:

diff -Npru linux-2.6.29/sound/soc/omap/omap-msbsp.c.orig 
linux-2.6.29/sound/soc/omap/omap-mcbsp.c
--- linux-2.6.29/sound/soc/omap/omap-mcbsp.c.orig       2009-06-09 
02:16:32.000000000 +0200
+++ linux-2.6.29/sound/soc/omap/omap-mcbsp.c    2009-06-09 
02:25:50.000000000 +0200
@@ -341,8 +341,8 @@ static int omap_mcbsp_dai_set_dai_fmt(st
         switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
         case SND_SOC_DAIFMT_CBS_CFS:
                 /* McBSP master. Set FS and bit clocks as outputs */
-               regs->pcr0      |= FSXM | FSRM |
-                                  CLKXM | CLKRM;
+               regs->pcr0      |= FSRM |
+                                  CLKRM;
                 /* Sample rate generator drives the FS */
                 regs->srgr2     |= FSGM;
                 break;

> Basically it goes with current driver by passing SND_SOC_DAIFMT_CBS_CFS
> to snd_soc_dai_set_fmt(cpu_dai, ...) and by setting SRG source clock
> and divider:
> 
> snd_soc_dai_set_sysclk(cpu_dai, OMAP_MCBSP_SYSCLK_CLK, ...);
> snd_soc_dai_set_clkdiv(cpu_dai, OMAP_MCBSP_CLKGDV, divider);

So I restored all that 12MHz mclk stuff that I had already removed as 
redundant, then set up the following in oder to get internally generated 
~256kHz CLKR and ~8kHz FSR:

+       /* Set cpu DAI configuration */
+       err = snd_soc_dai_set_fmt(cpu_dai,
+                                 SND_SOC_DAIFMT_I2S |
+                                 SND_SOC_DAIFMT_IB_IF |
+                                 SND_SOC_DAIFMT_CBS_CFS);
+       if (err < 0) {
+               printk(KERN_ERR "can't set cpu DAI configuration\n");
+               return err;
+       }
+
+       /* Set cpu DAI master clock source */
+       err =
+           snd_soc_dai_set_sysclk(cpu_dai, OMAP_MCBSP_SYSCLK_CLK,
+                                       0, SND_SOC_CLOCK_IN);
+
+       if (err < 0) {
+               printk(KERN_ERR "can't set cpu DAI clock source\n");
+               return err;
+       }
+
+       /* Set cpu DAI master clock divisor */
+       err =
+           snd_soc_dai_set_clkdiv(cpu_dai, OMAP_MCBSP_CLKGDV, 47);
+
+       if (err < 0) {
+               printk(KERN_ERR "can't set cpu DAI clock divisor\n");
+               return err;
+       }

Tried with both arecord and </dev/dsp, it looks like the problem still 
persists, even with mcbsp internally generated clocking. I have also 
tested a similiar mcbsp configuration with old driver for reference - it 
works.

Importand or not, I have to fine down my provious reports on what works 
and what does not:

- original patch applied with other ams-delta related patches
   on linux-omap-2.6.16, as it was designed for:
   - playback: works, with both aplay and >/dev/dsp,
   - capture: works with </dev/dsp, gives null output with arecord

- original patch ported to the last l-o commit supporting omap-alsa:
   - playback: works as before,
   - capture: both </dev/dsp and arecord give null output,
     but DMA interrupts still work.

- new driver on l-o: total hangup

- new driver on mainline 2.6.30-rc5: no DMA interrupts.

Thanks,
Janusz

  reply	other threads:[~2009-06-09 15:00 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-05-26 13:17 Please help in adding ams-delta support to ASoC Janusz Krzysztofik
2009-05-27  5:57 ` Peter Ujfalusi
2009-05-27 13:07   ` Janusz Krzysztofik
2009-06-02  5:47     ` Peter Ujfalusi
2009-06-02 11:38       ` Janusz Krzysztofik
2009-05-27  6:59 ` Jarkko Nikula
2009-05-27 14:33   ` Janusz Krzysztofik
2009-05-27 15:19     ` Jarkko Nikula
2009-05-27 18:58   ` Janusz Krzysztofik
2009-06-01 12:41     ` Janusz Krzysztofik
2009-06-01 18:04       ` Jarkko Nikula
2009-06-02  6:08         ` Peter Ujfalusi
2009-06-02  6:22         ` Jarkko Nikula
2009-06-02 13:35           ` Janusz Krzysztofik
2009-06-02 17:32             ` Jarkko Nikula
2009-06-03  7:24               ` Janusz Krzysztofik
2009-06-05 13:55                 ` Jarkko Nikula
2009-06-05 22:28                   ` Janusz Krzysztofik
2009-06-05 22:45                     ` [alsa-devel] " Mark Brown
2009-06-06 17:42                       ` Janusz Krzysztofik
2009-06-07  9:40                         ` Mark Brown
2009-06-09  7:12                         ` Peter Ujfalusi
2009-06-09 15:17                           ` [alsa-devel] " Janusz Krzysztofik
2009-06-10  8:12                             ` Peter Ujfalusi
2009-06-10 10:27                               ` [alsa-devel] " Janusz Krzysztofik
2009-06-10 10:53                                 ` Peter Ujfalusi
2009-06-10 12:20                                   ` Janusz Krzysztofik
2009-06-10 18:05                                   ` Janusz Krzysztofik
2009-06-10 14:20                             ` Janusz Krzysztofik
2009-06-08  6:40                     ` Jarkko Nikula
2009-06-09 15:00                       ` Janusz Krzysztofik [this message]
2009-06-15 13:22                         ` Janusz Krzysztofik
2009-06-15 15:16                           ` Jarkko Nikula
2009-06-16 14:43                             ` Janusz Krzysztofik
2009-06-17 14:12                               ` Progress in adding ams-delta support to ASoC? Janusz Krzysztofik
2009-06-18  9:02                                 ` Peter Ujfalusi
2009-06-18  7:58                                   ` Tony Lindgren
2009-06-18 11:51                                     ` Janusz Krzysztofik
2009-06-18 10:21                                       ` Tony Lindgren
2009-06-18  6:07                               ` Please help in adding ams-delta support to ASoC Jarkko Nikula
2009-06-18 11:40                                 ` Janusz Krzysztofik
2009-06-19  3:50                                   ` Arun K S
2009-06-19 11:20                                     ` Janusz Krzysztofik
2009-06-19 18:55                                       ` Arun K S
2009-06-22 11:47                                   ` Jarkko Nikula
2009-06-23 11:58                                     ` Janusz Krzysztofik
2009-06-02 10:50         ` *SPAM* " Janusz Krzysztofik
2009-06-03  5:28           ` Peter Ujfalusi
2009-06-03  8:28             ` Janusz Krzysztofik
     [not found] ` <20090527104711.GA1970@sirena.org.uk>
2009-06-02  7:24   ` Janusz Krzysztofik
2009-06-02  9:37     ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A2E7921.7090200@tis.icnet.pl \
    --to=jkrzyszt@tis.icnet.pl \
    --cc=alsa-devel@vger.kernel.org \
    --cc=jhnikula@gmail.com \
    --cc=linux-omap@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox