devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Warren <swarren-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
To: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: Tushar Behera
	<tushar.behera-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org>,
	alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	tiwai-l3A5Bk7waGM@public.gmane.org,
	perex-/Fr2/VpizcU@public.gmane.org,
	dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org,
	jerry.wong-zxKO94PEStzToO697jQleEEOCMrvLtNR@public.gmane.org
Subject: Re: [PATCH 1/2] ASoC: max98090: Add master clock handling
Date: Thu, 22 May 2014 11:50:55 -0600	[thread overview]
Message-ID: <537E38FF.9000407@wwwdotorg.org> (raw)
In-Reply-To: <20140522173403.GL12304-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>

On 05/22/2014 11:34 AM, Mark Brown wrote:
> On Thu, May 22, 2014 at 09:51:38AM -0600, Stephen Warren wrote:
>> On 05/22/2014 03:17 AM, Tushar Behera wrote:
> 
>>> +	if (!IS_ERR(max98090->mclk)) {
>>> +		freq = clk_round_rate(max98090->mclk, freq);
>>> +		clk_set_rate(max98090->mclk, freq);
>>> +	}
> 
>> What are the intended semantics of set_sysclk()?
>> sound/soc/tegra/tegra_wm98090.c assumes that set_sysclk() is a
>> notification to the CODEC driver to tell it what rate the MCLK input is
>> set to (the rate is set before calling set_sysclk), whereas the code
>> above assumes that this function is to tell the CODEC to somehow
>> configure its input clock to be a particular rate. I have a feeling the
>> code above might fail on Tegra.
>
> It's a bit of both.  Since we've never had a generic clock API (and
> still don't really due to everything being a shambles) it's generally
> just a notification to the CODEC that it's at the specified rate,
> however if the CODEC knows about its dependencies it seems sensible for
> it to tell the clock API about what was asked.  Ideally we want to
> remove all the ASoC specific clock control and use the clock API.

I think we should nail down exactly what set_sysclk() means. Since it
takes an explicit MCLK clock rate (rather than e.g. sample rate) right
now, surely it's a notification of what the clock /is/, not a request
for the CODEC to set up its input clock. If we expect the CODEC to go to
the clock driver and request an MCLK for itself (e.g. based on sample
rate), surely that should happen from some function besides
set_sysclk(), with different semantics e.g. hw_params().

I'm not convinced that the CODEC can trigger its input clock changes in
general. In Tegra, there needs to be centralized clock management, e.g.
to prevent one audio stream using a 44.1KHz-based rate and another using
a 48KHz-based rate. That's because the main audio PLL can't generate
both sets of frequencies at once. This can't be done in individual CODEC
drivers, since they shouldn't know about the Tegra restrictions. Doing
it in the clock driver in response to the CODEC's request for a specific
input clock, might work, but then the CODEC would have to call into the
clk driver from e.g. hw_params() rather than set_sysclk(). If that's how
it's supposed to work, then this patch is adding code in the wrong
place. If set_sysclk() doesn't get removed from the CODEC API, then
doing all this clock setup logic in the machine driver, as the
tegra_wm89090.c machine driver does, seems to make the most sense for now.

> The Tegra driver will presumably succeed unless someone does the
> appropriate clock hookup in DT, at which point clk_set_rate() for the
> rate the clock is already at really ought to succeed so things should
> continue to work.

Ah yes, if we don't add the clock to DT, this code won't do anything, so
nothing will break.
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2014-05-22 17:50 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-22  9:17 [PATCH 0/2] ASoC: max98090/max98095: Add master clock handing Tushar Behera
2014-05-22  9:17 ` [PATCH 1/2] ASoC: max98090: Add master clock handling Tushar Behera
2014-05-22 10:30   ` Mark Brown
     [not found]     ` <20140522103039.GD12304-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2014-05-23  5:35       ` Tushar Behera
     [not found]         ` <CAHbNUh2QHv8n7Y19qfO7BagX5AWe0i17MjDvr7yOpHf6YNGW4A-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-05-23 11:14           ` Mark Brown
     [not found]             ` <20140523111446.GA12304-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2014-05-23 11:36               ` Tushar Behera
     [not found]                 ` <CAHbNUh152xgyVxcCHiv0M6PLw8DE7KZ990WG7uRWWFBc8sPWRQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-05-23 11:41                   ` Mark Brown
     [not found]                     ` <20140523114113.GE12304-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2014-05-23 12:02                       ` Tushar Behera
2014-05-22 15:51   ` Stephen Warren
     [not found]     ` <537E1D0A.6020303-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2014-05-22 17:34       ` Mark Brown
     [not found]         ` <20140522173403.GL12304-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2014-05-22 17:50           ` Stephen Warren [this message]
     [not found]             ` <537E38FF.9000407-3lzwWm7+Weoh9ZMKESR00Q@public.gmane.org>
2014-05-22 18:19               ` Mark Brown
2014-05-22 22:24                 ` Stephen Warren
2014-05-22 23:36                   ` Mark Brown
2014-05-22  9:17 ` [PATCH 2/2] ASoC: max98095: " Tushar Behera
2014-05-22 10:31   ` 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=537E38FF.9000407@wwwdotorg.org \
    --to=swarren-3lzwwm7+weoh9zmkesr00q@public.gmane.org \
    --cc=alsa-devel-K7yf7f+aM1XWsZ/bQMPhNw@public.gmane.org \
    --cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=dianders-F7+t8E8rja9g9hUCZPvPmw@public.gmane.org \
    --cc=jerry.wong-zxKO94PEStzToO697jQleEEOCMrvLtNR@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=perex-/Fr2/VpizcU@public.gmane.org \
    --cc=tiwai-l3A5Bk7waGM@public.gmane.org \
    --cc=tushar.behera-QSEj5FYQhm4dnm+yROfE0A@public.gmane.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;
as well as URLs for NNTP newsgroup(s).