[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20140225023219.GA7229@MrMyself>
Date: Tue, 25 Feb 2014 10:32:21 +0800
From: Nicolin Chen <Guangyu.Chen@...escale.com>
To: "Austin, Brian" <Brian.Austin@...rus.com>
CC: Mark Brown <broonie@...nel.org>,
"Handrigan, Paul" <Paul.Handrigan@...rus.com>,
"robh+dt@...nel.org" <robh+dt@...nel.org>,
"pawel.moll@....com" <pawel.moll@....com>,
"mark.rutland@....com" <mark.rutland@....com>,
"ijc+devicetree@...lion.org.uk" <ijc+devicetree@...lion.org.uk>,
"galak@...eaurora.org" <galak@...eaurora.org>,
"rob@...dley.net" <rob@...dley.net>,
Liam Girdwood <lgirdwood@...il.com>,
"grant.likely@...aro.org" <grant.likely@...aro.org>,
"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
"linux-doc@...r.kernel.org" <linux-doc@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"alsa-devel@...a-project.org" <alsa-devel@...a-project.org>
Subject: Re: [PATCH] ASoC: cs42888: Add codec driver support
On Mon, Feb 24, 2014 at 04:32:06PM +0000, Austin, Brian wrote:
>
> On Feb 24, 2014, at 10:06 AM, Nicolin Chen <Guangyu.Chen@...escale.com> wrote:
>
> > On Mon, Feb 24, 2014 at 03:52:24PM +0000, Austin, Brian wrote:
> >>>> + if (!IS_ERR(cs42888->clk))
> >>>> + clk_disable_unprepare(cs42888->clk);
> >>>
> >>> Does the device work without MCLK?
> >> Yes, MCLK is required. If you can’t get the clock you should error out.
> >
> > Wait...Regarding this clock part, I just forgot the reason I put the code:
> >
> > 385 cs42888->clk = devm_clk_get(&i2c->dev, "mclk");
> > 386 if (IS_ERR(cs42888->clk))
> > 387 dev_warn(&i2c->dev, "failed to get the clock: %ld\n",
> > 388 PTR_ERR(cs42888->clk));
> >
> > was because the MCLK might be provided from SoC (DAI master) so it could
> > be totally controlled by CPU DAI driver, ESAI for example has its own
> > dividers to derive the HCKT clock (MCLK for Tx) from ahb clock in SoC
> > clock tree, in which case we might not easily pass a valid clock phandle
> > via DT. (RFC to this thought.)
> OK, It’s an external MCLK source, so why not just handle that in the machine driver?
> Usually you would want the clock enabled/disabled in the machine driver so if you don’t get it, you can bail out there.
> At least that is how I do our MCLK’s. Since you are only using the freq of the clock to derive modes, just put the clock initialization outside and just pass in the freq like you do in set_sysclk
Letting codec handle the clock here is trying to en/disable it only when using
it -- pm_runtime_resume/suspend() so that we can save power during idle states,
while putting it into machine driver, quite common in lots of machine drivers
though, would need us to enable it in the probe(), otherwise machine driver
can't finish the clock enabling before codec driver's pm_runtime_resume() as
pm_runtime_get_sync(codec_dai->dev) is almost the head of soc_pcm_open().
At first place, I did let this codec driver be totally exempt from this clock
handling. And it's quite fair and neat to do that in the machine driver till
this second thought came to me....
Thank you,
Nicolin Chen
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists