linux-clk.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* warnings with clk_disable_unprepare()
@ 2016-12-06  0:02 Pierre-Louis Bossart
  2016-12-08 21:18 ` Stephen Boyd
  0 siblings, 1 reply; 2+ messages in thread
From: Pierre-Louis Bossart @ 2016-12-06  0:02 UTC (permalink / raw)
  To: alsa-devel@alsa-project.org, linux-clk

Hi,
In the modified cht-bsw_rt5645 machine driver for Asus X205TA and 
T100HA, I disable the audio mclk with a call to clk_disable_unprepare() 
when I see a SND_SOC_DAPM_EVENT_OFF event in the platform_clock_control 
hook.

For some reason I seem to get multiple SND_SOC_DAPM_EVENT_OFF events and 
the clock framework complains with dmesg warnings that the refcount is 
already zero (which has no functional side effect).

WARNING: CPU: 0 PID: 2002 at drivers/clk/clk.c:476 clk_unprepare+0x1a/0x21

WARNING: CPU: 2 PID: 2095 at drivers/clk/clk.c:594 
clk_core_disable_lock+0x12/0x1b

I could fix this in three different ways:
- remove multiple SND_SOC_DAPM_EVENT_OFF events (not sure what the root 
cause is, maybe issues with jack detection?)
- call a clk_is_enabled() or clk_refcount() function before calling 
clk_disable_unprepare() (but they don't seem to exist in 
include/linux/clk.h)
- count the references myself (which does exactly the same as what the 
clk framework already does so it's not terribly elegant)

Any suggestions on what the least-bad solution might be?
Thanks
-Pierre

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: warnings with clk_disable_unprepare()
  2016-12-06  0:02 warnings with clk_disable_unprepare() Pierre-Louis Bossart
@ 2016-12-08 21:18 ` Stephen Boyd
  0 siblings, 0 replies; 2+ messages in thread
From: Stephen Boyd @ 2016-12-08 21:18 UTC (permalink / raw)
  To: Pierre-Louis Bossart; +Cc: alsa-devel@alsa-project.org, linux-clk

On 12/05, Pierre-Louis Bossart wrote:
> Hi,
> In the modified cht-bsw_rt5645 machine driver for Asus X205TA and
> T100HA, I disable the audio mclk with a call to
> clk_disable_unprepare() when I see a SND_SOC_DAPM_EVENT_OFF event in
> the platform_clock_control hook.
> 
> For some reason I seem to get multiple SND_SOC_DAPM_EVENT_OFF events
> and the clock framework complains with dmesg warnings that the
> refcount is already zero (which has no functional side effect).
> 
> WARNING: CPU: 0 PID: 2002 at drivers/clk/clk.c:476 clk_unprepare+0x1a/0x21
> 
> WARNING: CPU: 2 PID: 2095 at drivers/clk/clk.c:594
> clk_core_disable_lock+0x12/0x1b
> 
> I could fix this in three different ways:
> - remove multiple SND_SOC_DAPM_EVENT_OFF events (not sure what the
> root cause is, maybe issues with jack detection?)

It would be good to know what the root cause is here before
thinking about doing anything else.

> - call a clk_is_enabled() or clk_refcount() function before calling
> clk_disable_unprepare() (but they don't seem to exist in
> include/linux/clk.h)
> - count the references myself (which does exactly the same as what
> the clk framework already does so it's not terribly elegant)
> 

Both of these sound like hacks around the problem of unbalanced
off event calls.

-- 
Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum,
a Linux Foundation Collaborative Project

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-12-08 21:18 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-12-06  0:02 warnings with clk_disable_unprepare() Pierre-Louis Bossart
2016-12-08 21:18 ` Stephen Boyd

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).