From: s.nawrocki@samsung.com (Sylwester Nawrocki)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 06/16] ASoC: samsung: i2s: Move clk enable to the platform driver probe()
Date: Wed, 14 Jan 2015 12:56:24 +0100 [thread overview]
Message-ID: <54B65968.8040404@samsung.com> (raw)
In-Reply-To: <20150106180619.GN2634@sirena.org.uk>
On 06/01/15 19:06, Mark Brown wrote:
> On Fri, Dec 19, 2014 at 02:55:26PM +0100, Sylwester Nawrocki wrote:
>> Gating the I2S bus clock in the driver's runtime PM callbacks has
>> currently really no effect since the clock is being enabled
>> in the DAI's probe() and thus is permanently turned on. Now we just
>> move the enable to the platform driver's probe(), which doesn't
>> change the situation much. It will allow us to register a clock
>> provider already in samsung_i2s_probe() function.
>
> That doesn't sound quite right - the normal idiom for this stuff is to
> enable on probe, mark the device as active then if runtime PM is enabled
> it can idle the device and turn off the clock. That way if runtime PM
> is disabled things continue to run. I've not checked to see if this is
> actually happening correctly all the way through but that's what's
> supposed to happen and means that enabling in the probe should still
> result in working clock management.
>
> It will as things currently stand be broken for the dual DAI case so
> this is a fix for that (the dual DAI case will double enable if both
> links are in use) but the analysis isn't quite correct.
I agree that the device should be additionally marked as active, however
things will stop working unless we also do other changes to ensure
the BUSCLK is enabled when required.
AFAIU the clock will not be double enabled when both links are used,
since the clk_get/clk_prepare_enable part in DAI probe() is done only
for the primary DAI. I actually checked it with single and both links
and the clk_enable_count is always 1 after system initialization:
# grep . /sys/kernel/debug/clk/*i2s*/clk_enable_count
/sys/kernel/debug/clk/dout_i2s/clk_enable_count:0
/sys/kernel/debug/clk/i2s0/clk_enable_count:0
/sys/kernel/debug/clk/i2s1/clk_enable_count:0
/sys/kernel/debug/clk/i2s2/clk_enable_count:0
/sys/kernel/debug/clk/i2s_bus/clk_enable_count:1
/sys/kernel/debug/clk/mout_i2s/clk_enable_count:0
/sys/kernel/debug/clk/sclk_i2s/clk_enable_count:0
/sys/kernel/debug/clk/sclk_i2s1/clk_enable_count:0
/sys/kernel/debug/clk/sclk_i2s2/clk_enable_count:0
I'm going to rephrase the changelog to something like:
"The clk_prepare_enable() call on the "iis" clock is moved to happen
earlier in the DAI platform device driver's probe() callback, so the
I2S registers can be safely accessed through the clk API, after the clk
supplier is registered in the platform device probe().
After this patch the "iis" clock is kept enabled since the (primary)
I2S platform device probe() and until the platform device driver remove()
call. This is similar to gating the clock in the snd_soc_dai probe() and
remove() callbacks.
Normally, in addition to that we should mark the device as PM runtime
active, so if runtime PM is enabled it can idle the device by turning off
the clock. Correcting this issue is left for a separate patch series,
as we need to ensure the BUSCLK clock is always enabled when required."
next prev parent reply other threads:[~2015-01-14 11:56 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-12-19 13:55 [PATCH v2 00/16] ASoC: samsung: Add clk provider for I2S internal clocks Sylwester Nawrocki
2014-12-19 13:55 ` [PATCH v2 01/16] ASoC: samsung: i2s: Remove unused gpios field from struct i2s Sylwester Nawrocki
2015-01-06 18:13 ` Mark Brown
2014-12-19 13:55 ` [PATCH v2 02/16] ASoC: samsung: i2s: samsung_i2s_get_driver_data() cleanup Sylwester Nawrocki
2015-01-06 18:14 ` Mark Brown
2015-01-14 11:52 ` Sylwester Nawrocki
2014-12-19 13:55 ` [PATCH v2 03/16] ASoC: samsung: i2s: Add return value checks in probe() Sylwester Nawrocki
2014-12-19 13:55 ` [PATCH v2 04/16] ASoC: samsung: i2s: Request memory region in driver probe() Sylwester Nawrocki
2014-12-19 13:55 ` [PATCH v2 05/16] ASoC: samsung: i2s: Move clk_get() to platform " Sylwester Nawrocki
2014-12-19 13:55 ` [PATCH v2 06/16] ASoC: samsung: i2s: Move clk enable to the " Sylwester Nawrocki
2015-01-06 18:06 ` Mark Brown
2015-01-14 11:56 ` Sylwester Nawrocki [this message]
2014-12-19 13:55 ` [PATCH v2 07/16] ASoC: samsung: i2s: Add get_other_dai helper function Sylwester Nawrocki
2014-12-19 13:55 ` [PATCH v2 08/16] ASoC: samsung: i2s: Remove an unneeded goto usage Sylwester Nawrocki
2014-12-19 13:55 ` [PATCH v2 09/16] ASoC: samsung: i2s: Add spinlock in place of local_irq_* calls Sylwester Nawrocki
2014-12-19 13:55 ` [PATCH v2 10/16] ASoC: samsung: i2s: Protect more registers with a spinlock Sylwester Nawrocki
2014-12-19 13:55 ` [PATCH v2 11/16] ASoC: samsung: odroidx2: Handle I2S CDCLK clock conditionally Sylwester Nawrocki
2014-12-19 13:55 ` [PATCH v2 12/16] ASoC: samsung: i2s: Add clk provider DT binding documentation Sylwester Nawrocki
2014-12-19 13:55 ` [PATCH v2 13/16] ASoC: samsung: i2s: Add clock provider for the I2S internal clocks Sylwester Nawrocki
2014-12-19 13:55 ` [PATCH v2 14/16] ARM: dts: Exynos4 and Odroid X2/U3 sound device nodes update Sylwester Nawrocki
2014-12-19 13:55 ` [PATCH v2 15/16] ARM: dts: Switch Odroid X2/U2 to simple-audio-card Sylwester Nawrocki
2014-12-19 13:55 ` [PATCH v2 16/16] ARM: dts: Fix I2S1, I2S2 compatible for exynos4 SoCs Sylwester Nawrocki
2015-01-06 18:15 ` Mark Brown
2015-01-14 11:57 ` Sylwester Nawrocki
2015-01-06 18:17 ` [PATCH v2 00/16] ASoC: samsung: Add clk provider for I2S internal clocks Mark Brown
2015-01-24 1:53 ` Tobias Jakobi
2015-01-27 10:59 ` Sylwester Nawrocki
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=54B65968.8040404@samsung.com \
--to=s.nawrocki@samsung.com \
--cc=linux-arm-kernel@lists.infradead.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).