All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dong Aisheng <dongas86@gmail.com>
To: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: alsa-devel@alsa-project.org, Dong Aisheng <b29396@freescale.com>,
	s.hauer@pengutronix.de, linux-arm-kernel@lists.infradead.org,
	lrg@ti.com
Subject: Re: [PATCH 02/10] ASoc: mxs: add mxs-saif driver
Date: Sun, 10 Jul 2011 16:58:10 +0800	[thread overview]
Message-ID: <CAA+hA=SBP3Qv0x-9KQMR+iT9nT1E6_HamyM7zeNd1p8rfE6V0g@mail.gmail.com> (raw)
In-Reply-To: <20110710083359.GB23199@opensource.wolfsonmicro.com>

2011/7/10 Mark Brown <broonie@opensource.wolfsonmicro.com>:
> On Sun, Jul 10, 2011 at 04:17:13PM +0800, Dong Aisheng wrote:
>> 2011/7/9 Mark Brown <broonie@opensource.wolfsonmicro.com>:
>> > On Fri, Jul 08, 2011 at 11:59:42PM +0800, Dong Aisheng wrote:
>
>> >> +     switch (clk_id) {
>> >> +     case MXS_SAIF_SYS_CLK:
>> >> +             clk_set_rate(saif->clk, freq);
>> >> +             clk_enable(saif->clk);
>
>> > How would one turn this clock off?
>
>> Currenty simply enable clock always.
>
> If that's what you're doing you should enable the clock when the device
> is probed and disable it when the device is removed.  These repeated
> enables will mean that you're constantly leaking references.
Yes, i noticed this issue.

>> The problem is that the codec may use the MCLK supplied by SAIF as its
>> system clock for normal operations such as i2c r/w.
>
> That may be true for your particular system but it is not going to be
> true in general - most devices can handle having their MCLK removed.
Yes, if i cover that, that may make driver a little complicated.
Should i do that now or as the next work?
Also i still do not have such type of codecs integrated on hand.

>> If we disable it after playback or capture. The automatic dapm
>> operations of codec may fail on i2c r/w. Will check if dapm has any
>> machnism to avoid this.
>> Can you share your experience ont this issue?
>
> You should ideally let the machine driver or other system integration
> code control if the clock is constantly enabled, or at the very least
> control it from the probe and remove.
Thanks for the suggestions.
I will try them.

>> >> +static irqreturn_t mxs_saif_irq(int irq, void *dev_id)
>> >> +{
>> >> +     struct mxs_saif *saif = dev_id;
>> >> +
>> >> +     if (saif->fifo_err_counter++ % 100 == 0)
>> >
>> > The rate limit looks awfully suspicious...
>> Originally it's just for printing less error messages when the issue happens.
>> I could remove the rate limit.
>
> Please do so.
Got it.

>> >> +     clk_set_rate(saif->clk, 12000000);
>> >> +     clk_enable(saif->clk);
>
>> > How did you pick this clock rate and why does it need to be set?  It's
>> > not an obvious audio rate...
>
>> It's initial clock rate for normal operations of codecs based on MCLK.
>> We found the default MCLK ouput(only about 7.3Khz) can not work for codecs like
>> sgtl5000 for its initialization since its clock range is 8Mhz~27Mhz.
>> So we set a common working clock 12Mhz here.
>> Maybe i should try to set it elsewhere or just set it via platform data.
>
> This is the same issue as the above one with repeated enables?  You
> should delegate the rate selection and ideally also the enable control
> to the machine driver, it can set something in its probe() function.
Not the same one. The repeated enables is a bug.(Will fix)
Here we just need set a init proper clock rate of MCLK for codec firstly.
(Codec's initialization(i2c r/w) in probe function may need it).
I would try your suggestion to let machine driver to set it.

WARNING: multiple messages have this Message-ID (diff)
From: dongas86@gmail.com (Dong Aisheng)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 02/10] ASoc: mxs: add mxs-saif driver
Date: Sun, 10 Jul 2011 16:58:10 +0800	[thread overview]
Message-ID: <CAA+hA=SBP3Qv0x-9KQMR+iT9nT1E6_HamyM7zeNd1p8rfE6V0g@mail.gmail.com> (raw)
In-Reply-To: <20110710083359.GB23199@opensource.wolfsonmicro.com>

2011/7/10 Mark Brown <broonie@opensource.wolfsonmicro.com>:
> On Sun, Jul 10, 2011 at 04:17:13PM +0800, Dong Aisheng wrote:
>> 2011/7/9 Mark Brown <broonie@opensource.wolfsonmicro.com>:
>> > On Fri, Jul 08, 2011 at 11:59:42PM +0800, Dong Aisheng wrote:
>
>> >> + ? ? switch (clk_id) {
>> >> + ? ? case MXS_SAIF_SYS_CLK:
>> >> + ? ? ? ? ? ? clk_set_rate(saif->clk, freq);
>> >> + ? ? ? ? ? ? clk_enable(saif->clk);
>
>> > How would one turn this clock off?
>
>> Currenty simply enable clock always.
>
> If that's what you're doing you should enable the clock when the device
> is probed and disable it when the device is removed. ?These repeated
> enables will mean that you're constantly leaking references.
Yes, i noticed this issue.

>> The problem is that the codec may use the MCLK supplied by SAIF as its
>> system clock for normal operations such as i2c r/w.
>
> That may be true for your particular system but it is not going to be
> true in general - most devices can handle having their MCLK removed.
Yes, if i cover that, that may make driver a little complicated.
Should i do that now or as the next work?
Also i still do not have such type of codecs integrated on hand.

>> If we disable it after playback or capture. The automatic dapm
>> operations of codec may fail on i2c r/w. Will check if dapm has any
>> machnism to avoid this.
>> Can you share your experience ont this issue?
>
> You should ideally let the machine driver or other system integration
> code control if the clock is constantly enabled, or at the very least
> control it from the probe and remove.
Thanks for the suggestions.
I will try them.

>> >> +static irqreturn_t mxs_saif_irq(int irq, void *dev_id)
>> >> +{
>> >> + ? ? struct mxs_saif *saif = dev_id;
>> >> +
>> >> + ? ? if (saif->fifo_err_counter++ % 100 == 0)
>> >
>> > The rate limit looks awfully suspicious...
>> Originally it's just for printing less error messages when the issue happens.
>> I could remove the rate limit.
>
> Please do so.
Got it.

>> >> + ? ? clk_set_rate(saif->clk, 12000000);
>> >> + ? ? clk_enable(saif->clk);
>
>> > How did you pick this clock rate and why does it need to be set? ?It's
>> > not an obvious audio rate...
>
>> It's initial clock rate for normal operations of codecs based on MCLK.
>> We found the default MCLK ouput(only about 7.3Khz) can not work for codecs like
>> sgtl5000 for its initialization since its clock range is 8Mhz~27Mhz.
>> So we set a common working clock 12Mhz here.
>> Maybe i should try to set it elsewhere or just set it via platform data.
>
> This is the same issue as the above one with repeated enables? ?You
> should delegate the rate selection and ideally also the enable control
> to the machine driver, it can set something in its probe() function.
Not the same one. The repeated enables is a bug.(Will fix)
Here we just need set a init proper clock rate of MCLK for codec firstly.
(Codec's initialization(i2c r/w) in probe function may need it).
I would try your suggestion to let machine driver to set it.

  reply	other threads:[~2011-07-10  8:58 UTC|newest]

Thread overview: 60+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-08 15:59 [PATCH 00/10] ARM: mxs: add audio support Dong Aisheng
2011-07-08 15:59 ` Dong Aisheng
2011-07-08 15:59 ` [PATCH 01/10] ASoc: mxs: add mxs-pcm driver Dong Aisheng
2011-07-08 15:59   ` Dong Aisheng
2011-07-09  2:33   ` Mark Brown
2011-07-09  2:33     ` Mark Brown
2011-07-10  6:28     ` Dong Aisheng
2011-07-10  6:28       ` Dong Aisheng
2011-07-10  8:21       ` Mark Brown
2011-07-10  8:21         ` Mark Brown
2011-07-08 15:59 ` [PATCH 02/10] ASoc: mxs: add mxs-saif driver Dong Aisheng
2011-07-08 15:59   ` Dong Aisheng
2011-07-08 16:19   ` Sascha Hauer
2011-07-08 16:19     ` Sascha Hauer
2011-07-08 17:10     ` Wolfram Sang
2011-07-08 17:10       ` Wolfram Sang
2011-07-08 18:35     ` Dong Aisheng
2011-07-08 18:35       ` Dong Aisheng
2011-07-09  2:52   ` Mark Brown
2011-07-09  2:52     ` Mark Brown
2011-07-10  8:17     ` Dong Aisheng
2011-07-10  8:17       ` Dong Aisheng
2011-07-10  8:34       ` Mark Brown
2011-07-10  8:34         ` Mark Brown
2011-07-10  8:58         ` Dong Aisheng [this message]
2011-07-10  8:58           ` Dong Aisheng
2011-07-10  9:26           ` Mark Brown
2011-07-10  9:26             ` Mark Brown
2011-07-10 11:59             ` Dong Aisheng
2011-07-10 11:59               ` Dong Aisheng
2011-07-11 10:00             ` Wolfram Sang
2011-07-11 10:00               ` Wolfram Sang
2011-07-13  3:28               ` Dong Aisheng-B29396
2011-07-13  3:28                 ` Dong Aisheng-B29396
2011-07-08 15:59 ` [PATCH 03/10] ASoc: mxs: add mxs-sgtl5000 machine driver Dong Aisheng
2011-07-08 15:59   ` Dong Aisheng
2011-07-09  3:00   ` Mark Brown
2011-07-09  3:00     ` Mark Brown
2011-07-10  8:36     ` Dong Aisheng
2011-07-10  8:36       ` Dong Aisheng
2011-07-10  8:40       ` Mark Brown
2011-07-10  8:40         ` Mark Brown
2011-07-08 15:59 ` [PATCH 04/10] ASoc: mxs: add asoc configuration files Dong Aisheng
2011-07-08 15:59   ` Dong Aisheng
2011-07-09  3:01   ` Mark Brown
2011-07-09  3:01     ` Mark Brown
2011-07-10  8:37     ` Dong Aisheng
2011-07-10  8:37       ` Dong Aisheng
2011-07-08 15:59 ` [PATCH 05/10] ARM: mxs: add saif clock Dong Aisheng
2011-07-08 15:59   ` Dong Aisheng
2011-07-08 15:59 ` [PATCH 06/10] ARM: mxs: add saif device Dong Aisheng
2011-07-08 15:59   ` Dong Aisheng
2011-07-08 15:59 ` [PATCH 07/10] ARM: mxs: add sgtl5000 i2c device Dong Aisheng
2011-07-08 15:59   ` Dong Aisheng
2011-07-08 15:59 ` [PATCH 08/10] ARM: mxs: add mxs-sgtl5000 device Dong Aisheng
2011-07-08 15:59   ` Dong Aisheng
2011-07-08 15:59 ` [PATCH 09/10] ARM: mxs: correct the using of frac div for saif Dong Aisheng
2011-07-08 15:59   ` Dong Aisheng
2011-07-08 15:59 ` [PATCH 10/10] ARM: mxs-dma: include <linux/dmaengine.h> Dong Aisheng
2011-07-08 15:59   ` Dong Aisheng

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='CAA+hA=SBP3Qv0x-9KQMR+iT9nT1E6_HamyM7zeNd1p8rfE6V0g@mail.gmail.com' \
    --to=dongas86@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=b29396@freescale.com \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=lrg@ti.com \
    --cc=s.hauer@pengutronix.de \
    /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 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.