linux-clk.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] clk: cs2000: Fix the setting of saved_rate during the resume process
@ 2017-04-19 17:46 Yoshihiro Kaneko
  2017-04-19 23:57 ` Kuninori Morimoto
  2017-04-22  2:10 ` Stephen Boyd
  0 siblings, 2 replies; 5+ messages in thread
From: Yoshihiro Kaneko @ 2017-04-19 17:46 UTC (permalink / raw)
  To: linux-clk
  Cc: Michael Turquette, Stephen Boyd, Geert Uytterhoeven, Simon Horman,
	Magnus Damm, linux-renesas-soc

From: Gaku Inami <gaku.inami.xw@bp.renesas.com>

In the resume process, there is the case that other drivers call
cs2000_enable before cs2000_resume is called. Since the order of
resume process is not guaranteed, it is needed to reset the clk
rate in any cases before cs2000 is used.

Also, the current cs2000 driver is using resume_early function.
The using .resume_early is bad idea because the dependency with
other drivers is to be complicated.

This patch adds to reset the clk rate in cs2000_enable and
changes to use from .resume_early to .resume.

Signed-off-by: Gaku Inami <gaku.inami.xw@bp.renesas.com>
Signed-off-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>
---
This patch is based on the clk-next branch of linux-clk tree.

 drivers/clk/clk-cs2000-cp.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/clk-cs2000-cp.c b/drivers/clk/clk-cs2000-cp.c
index 5b3516d..de6e8c6 100644
--- a/drivers/clk/clk-cs2000-cp.c
+++ b/drivers/clk/clk-cs2000-cp.c
@@ -338,6 +338,10 @@ static int cs2000_enable(struct clk_hw *hw)
 	struct cs2000_priv *priv = hw_to_priv(hw);
 	int ret;
 
+	ret = cs2000_set_saved_rate(priv);
+	if (ret < 0)
+		return ret;
+
 	ret = cs2000_enable_dev_config(priv, true);
 	if (ret < 0)
 		return ret;
@@ -530,7 +534,7 @@ static int cs2000_resume(struct device *dev)
 }
 
 static const struct dev_pm_ops cs2000_pm_ops = {
-	.resume_early	= cs2000_resume,
+	.resume		= cs2000_resume,
 };
 
 static struct i2c_driver cs2000_driver = {
-- 
1.9.1

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

* Re: [PATCH] clk: cs2000: Fix the setting of saved_rate during the resume process
  2017-04-19 17:46 [PATCH] clk: cs2000: Fix the setting of saved_rate during the resume process Yoshihiro Kaneko
@ 2017-04-19 23:57 ` Kuninori Morimoto
  2017-04-22  2:10 ` Stephen Boyd
  1 sibling, 0 replies; 5+ messages in thread
From: Kuninori Morimoto @ 2017-04-19 23:57 UTC (permalink / raw)
  To: Yoshihiro Kaneko
  Cc: linux-clk, Michael Turquette, Stephen Boyd, Geert Uytterhoeven,
	Simon Horman, Magnus Damm, linux-renesas-soc


Hi

> From: Gaku Inami <gaku.inami.xw@bp.renesas.com>
> 
> In the resume process, there is the case that other drivers call
> cs2000_enable before cs2000_resume is called. Since the order of
> resume process is not guaranteed, it is needed to reset the clk
> rate in any cases before cs2000 is used.
> 
> Also, the current cs2000 driver is using resume_early function.
> The using .resume_early is bad idea because the dependency with
> other drivers is to be complicated.
> 
> This patch adds to reset the clk rate in cs2000_enable and
> changes to use from .resume_early to .resume.
> 
> Signed-off-by: Gaku Inami <gaku.inami.xw@bp.renesas.com>
> Signed-off-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
> Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>
> ---

Acked-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

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

* Re: [PATCH] clk: cs2000: Fix the setting of saved_rate during the resume process
  2017-04-19 17:46 [PATCH] clk: cs2000: Fix the setting of saved_rate during the resume process Yoshihiro Kaneko
  2017-04-19 23:57 ` Kuninori Morimoto
@ 2017-04-22  2:10 ` Stephen Boyd
  2017-04-23 20:16   ` Geert Uytterhoeven
  1 sibling, 1 reply; 5+ messages in thread
From: Stephen Boyd @ 2017-04-22  2:10 UTC (permalink / raw)
  To: Yoshihiro Kaneko
  Cc: linux-clk, Michael Turquette, Geert Uytterhoeven, Simon Horman,
	Magnus Damm, linux-renesas-soc

On 04/20, Yoshihiro Kaneko wrote:
> From: Gaku Inami <gaku.inami.xw@bp.renesas.com>
> 
> In the resume process, there is the case that other drivers call
> cs2000_enable before cs2000_resume is called. Since the order of
> resume process is not guaranteed, it is needed to reset the clk
> rate in any cases before cs2000 is used.
> 
> Also, the current cs2000 driver is using resume_early function.
> The using .resume_early is bad idea because the dependency with
> other drivers is to be complicated.
> 
> This patch adds to reset the clk rate in cs2000_enable and
> changes to use from .resume_early to .resume.
> 
> Signed-off-by: Gaku Inami <gaku.inami.xw@bp.renesas.com>
> Signed-off-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
> Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>
> ---

Was this supposed to be sent as a series? This is the second
patch in the series? 

In what situation does a driver call clk_prepare() on the clocks
in here before the device's resume callback is called? I would
think that any devices that use the clks provided by this driver
would be probe defered until the clks are registered, so they
would be later in the suspend/resume list than this clk driver?

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

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

* Re: [PATCH] clk: cs2000: Fix the setting of saved_rate during the resume process
  2017-04-22  2:10 ` Stephen Boyd
@ 2017-04-23 20:16   ` Geert Uytterhoeven
  2017-04-24 17:53     ` Stephen Boyd
  0 siblings, 1 reply; 5+ messages in thread
From: Geert Uytterhoeven @ 2017-04-23 20:16 UTC (permalink / raw)
  To: Stephen Boyd
  Cc: Yoshihiro Kaneko, linux-clk, Michael Turquette,
	Geert Uytterhoeven, Simon Horman, Magnus Damm, Linux-Renesas

Hi Stephen,

On Sat, Apr 22, 2017 at 4:10 AM, Stephen Boyd <sboyd@codeaurora.org> wrote:
> On 04/20, Yoshihiro Kaneko wrote:
>> From: Gaku Inami <gaku.inami.xw@bp.renesas.com>
>>
>> In the resume process, there is the case that other drivers call
>> cs2000_enable before cs2000_resume is called. Since the order of
>> resume process is not guaranteed, it is needed to reset the clk
>> rate in any cases before cs2000 is used.
>>
>> Also, the current cs2000 driver is using resume_early function.
>> The using .resume_early is bad idea because the dependency with
>> other drivers is to be complicated.
>>
>> This patch adds to reset the clk rate in cs2000_enable and
>> changes to use from .resume_early to .resume.
>>
>> Signed-off-by: Gaku Inami <gaku.inami.xw@bp.renesas.com>
>> Signed-off-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
>> Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>
>> ---
>
> Was this supposed to be sent as a series? This is the second
> patch in the series?
>
> In what situation does a driver call clk_prepare() on the clocks
> in here before the device's resume callback is called? I would
> think that any devices that use the clks provided by this driver
> would be probe defered until the clks are registered, so they
> would be later in the suspend/resume list than this clk driver?

Deferred probing is used during driver initialization only.
This patch is about clock users calling into the clock API during the resume
procedure, before the clock provider has been resumed.

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH] clk: cs2000: Fix the setting of saved_rate during the resume process
  2017-04-23 20:16   ` Geert Uytterhoeven
@ 2017-04-24 17:53     ` Stephen Boyd
  0 siblings, 0 replies; 5+ messages in thread
From: Stephen Boyd @ 2017-04-24 17:53 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Yoshihiro Kaneko, linux-clk, Michael Turquette,
	Geert Uytterhoeven, Simon Horman, Magnus Damm, Linux-Renesas

On 04/23, Geert Uytterhoeven wrote:
> Hi Stephen,
> 
> On Sat, Apr 22, 2017 at 4:10 AM, Stephen Boyd <sboyd@codeaurora.org> wrote:
> > On 04/20, Yoshihiro Kaneko wrote:
> >> From: Gaku Inami <gaku.inami.xw@bp.renesas.com>
> >>
> >> In the resume process, there is the case that other drivers call
> >> cs2000_enable before cs2000_resume is called. Since the order of
> >> resume process is not guaranteed, it is needed to reset the clk
> >> rate in any cases before cs2000 is used.
> >>
> >> Also, the current cs2000 driver is using resume_early function.
> >> The using .resume_early is bad idea because the dependency with
> >> other drivers is to be complicated.
> >>
> >> This patch adds to reset the clk rate in cs2000_enable and
> >> changes to use from .resume_early to .resume.
> >>
> >> Signed-off-by: Gaku Inami <gaku.inami.xw@bp.renesas.com>
> >> Signed-off-by: Hiroyuki Yokoyama <hiroyuki.yokoyama.vx@renesas.com>
> >> Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>
> >> ---
> >
> > Was this supposed to be sent as a series? This is the second
> > patch in the series?
> >
> > In what situation does a driver call clk_prepare() on the clocks
> > in here before the device's resume callback is called? I would
> > think that any devices that use the clks provided by this driver
> > would be probe defered until the clks are registered, so they
> > would be later in the suspend/resume list than this clk driver?
> 
> Deferred probing is used during driver initialization only.
> This patch is about clock users calling into the clock API during the resume
> procedure, before the clock provider has been resumed.
> 

Right, and which driver is calling into the clk API in their
resume function before the clk provider is resume? Presumably the
clk provider had probed "first", or at least was ordered in the
dpm_list before the consumer drivers so that this problem
wouldn't happen.

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

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

end of thread, other threads:[~2017-04-24 17:53 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-19 17:46 [PATCH] clk: cs2000: Fix the setting of saved_rate during the resume process Yoshihiro Kaneko
2017-04-19 23:57 ` Kuninori Morimoto
2017-04-22  2:10 ` Stephen Boyd
2017-04-23 20:16   ` Geert Uytterhoeven
2017-04-24 17:53     ` 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).