From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: Mark Brown <broonie@kernel.org>, Vinod Koul <vinod.koul@intel.com>
Cc: mark.rutland@arm.com, oder_chiou@realtek.com,
alsa-devel@alsa-project.org, devicetree@vger.kernel.org,
Darren Hart <dvhart@linux.intel.com>,
lgirdwood@gmail.com, linux-kernel@vger.kernel.org,
Nicolin Chen <nicoleotsuka@gmail.com>,
robh+dt@kernel.org, bardliao@realtek.com
Subject: Re: [PATCH] ASoC: rt5659: Add mclk controls
Date: Wed, 10 Aug 2016 08:57:28 -0500 [thread overview]
Message-ID: <c649c3fe-b111-56a8-275e-d967a961dd41@linux.intel.com> (raw)
In-Reply-To: <20160729163933.GJ10376@sirena.org.uk>
On 7/29/16 11:39 AM, Mark Brown wrote:
> On Fri, Jul 29, 2016 at 09:45:21PM +0530, Vinod Koul wrote:
>
>> Yeah I am not aware of any plan to have clks on x86. For audio we are not
>> going to use much. ACPI and controller w/ firmware does the job.
>
>> I have added Darren, he oversee platform things so might know if clocks
>> would be there in future..
>
> Not having controllable clocks is fine but as we've discussed before
> you're going to need to represent the clocks that are there with fixed
> clocks instantiated through whatever you use to enumerate boards. We
> don't want to have to special case x86 all the time in CODEC drivers.
Without going into a debate on x86 v. the clock API or the merits of a
patch that has already been applied, I am pretty confused on who's
supposed to manage the mclk between the machine and codec driver.
If you go back to this specific patch for the rt5659 audio codec, the
simplified code reads as:
static int rt5659_set_bias_level()
[snip]
case SND_SOC_BIAS_STANDBY:
if (dapm->bias_level == SND_SOC_BIAS_OFF) {
ret = clk_prepare_enable(rt5659->mclk);
So on a DAPM transition the clock is enabled. Fine.
What's not clear here is that the codec driver doesn't know what rates
are supported by the SOC/chipset. The machine driver is typically the
one doing calls such as
ret = snd_soc_dai_set_pll(codec_dai, 0,
RT5640_PLL1_S_MCLK,
19200000,
params_rate(params) * 512);
it's as if this patch assumes the mclk is a single rate? if this was a
generic solution then the codec driver would need to set the rates as
well and its internal PLL/divider settings.
In addition, the machine driver can implement a platform clock control
with things like
static const struct snd_soc_dapm_route byt_rt5640_audio_map[] = {
{"Headphone", NULL, "Platform Clock"},
{"Headset Mic", NULL, "Platform Clock"},
{"Internal Mic", NULL, "Platform Clock"},
{"Speaker", NULL, "Platform Clock"},
static int platform_clock_control(struct snd_soc_dapm_widget *w,
struct snd_kcontrol *k, int event)
if (SND_SOC_DAPM_EVENT_ON(event)) {
ret = clk_prepare_enable(priv->mclk);
ret = snd_soc_dai_set_sysclk(codec_dai,
RT5640_SCLK_S_PLL1,
48000 * 512,
SND_SOC_CLOCK_IN);
} else {
/*
* Set codec clock source to internal clock before
* turning off the platform clock. Codec needs clock
* for Jack detection and button press
*/
ret = snd_soc_dai_set_sysclk(codec_dai,
RT5640_SCLK_S_RCCLK,
0,
SND_SOC_CLOCK_IN);
clk_disable_unprepare(priv->mclk);
so the summary is that we have two ways of doing the same thing -
turning the mclk on when it's needed - and I wonder if doing this in the
codec is really the right solution? Again this is not a question on the
merits of the clk API/framework but whether we can have a single point
of control instead of two pieces of code doing the same thing in two
drivers.
If I am missing something I am all ears.
next prev parent reply other threads:[~2016-08-10 13:57 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-07-27 23:02 [PATCH] ASoC: rt5659: Add mclk controls Nicolin Chen
[not found] ` <1469660568-3511-1-git-send-email-nicoleotsuka-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2016-07-28 15:57 ` Mark Brown
[not found] ` <20160728155732.GG11806-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2016-07-28 18:14 ` Nicolin Chen
2016-07-28 18:55 ` Mark Brown
2016-07-28 19:03 ` Nicolin Chen
2016-07-29 16:15 ` Vinod Koul
2016-07-29 16:39 ` Mark Brown
[not found] ` <20160729163933.GJ10376-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2016-07-29 16:55 ` [alsa-devel] " Vinod Koul
2016-08-10 13:57 ` Pierre-Louis Bossart [this message]
2016-08-10 17:06 ` Mark Brown
2016-08-10 17:31 ` Pierre-Louis Bossart
2016-08-10 17:52 ` Mark Brown
2016-08-10 21:59 ` [alsa-devel] " Pierre-Louis Bossart
[not found] ` <ff13c01a-a3f5-b11f-c342-926e98f64be3-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2016-08-11 11:34 ` Mark Brown
2016-07-28 20:40 ` Lars-Peter Clausen
[not found] ` <579A6DCC.6060401-Qo5EllUWu/uELgA04lAiVw@public.gmane.org>
2016-07-28 20:51 ` Nicolin Chen
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=c649c3fe-b111-56a8-275e-d967a961dd41@linux.intel.com \
--to=pierre-louis.bossart@linux.intel.com \
--cc=alsa-devel@alsa-project.org \
--cc=bardliao@realtek.com \
--cc=broonie@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dvhart@linux.intel.com \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=nicoleotsuka@gmail.com \
--cc=oder_chiou@realtek.com \
--cc=robh+dt@kernel.org \
--cc=vinod.koul@intel.com \
/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).