diff mbox

[v2,3/3] soc: renesas: rcar-sysc: Keep wakeup sources active during system suspend

Message ID 1510234022-29442-4-git-send-email-geert+renesas@glider.be (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Geert Uytterhoeven Nov. 9, 2017, 1:27 p.m. UTC
If an R-Car SYSC slave device is part of the CPG/MSTP or CPG/MSSR Clock
Domain and to be used as a wakeup source, it must be kept active during
system suspend.

Currently this is handled in device-specific drivers by explicitly
increasing the use count of the module clock when the device is
configured as a wakeup source.  However, the proper way to prevent the
device from being stopped is to inform this requirement to the genpd
core, by setting the GENPD_FLAG_ACTIVE_WAKEUP flag.

Note that this will only affect devices configured as wakeup sources.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
v2:
  - Integrate "soc: renesas: rcar-sysc: Use GENPD_FLAG_ACTIVE_WAKEUP",
---
 drivers/soc/renesas/rcar-sysc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ulf Hansson Dec. 14, 2017, 2:11 p.m. UTC | #1
On 9 November 2017 at 14:27, Geert Uytterhoeven <geert+renesas@glider.be> wrote:
> If an R-Car SYSC slave device is part of the CPG/MSTP or CPG/MSSR Clock
> Domain and to be used as a wakeup source, it must be kept active during
> system suspend.
>
> Currently this is handled in device-specific drivers by explicitly
> increasing the use count of the module clock when the device is
> configured as a wakeup source.  However, the proper way to prevent the
> device from being stopped is to inform this requirement to the genpd
> core, by setting the GENPD_FLAG_ACTIVE_WAKEUP flag.
>
> Note that this will only affect devices configured as wakeup sources.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>

Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>

Kind regards
Uffe

> ---
> v2:
>   - Integrate "soc: renesas: rcar-sysc: Use GENPD_FLAG_ACTIVE_WAKEUP",
> ---
>  drivers/soc/renesas/rcar-sysc.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/soc/renesas/rcar-sysc.c b/drivers/soc/renesas/rcar-sysc.c
> index c8406e81640f6560..ac4df1c43b2fbdbe 100644
> --- a/drivers/soc/renesas/rcar-sysc.c
> +++ b/drivers/soc/renesas/rcar-sysc.c
> @@ -224,7 +224,7 @@ static void __init rcar_sysc_pd_setup(struct rcar_sysc_pd *pd)
>
>         if (!(pd->flags & (PD_CPU | PD_SCU))) {
>                 /* Enable Clock Domain for I/O devices */
> -               genpd->flags |= GENPD_FLAG_PM_CLK;
> +               genpd->flags |= GENPD_FLAG_PM_CLK | GENPD_FLAG_ACTIVE_WAKEUP;
>                 if (has_cpg_mstp) {
>                         genpd->attach_dev = cpg_mstp_attach_dev;
>                         genpd->detach_dev = cpg_mstp_detach_dev;
> --
> 2.7.4
>
--
To unsubscribe from this list: send the line "unsubscribe linux-clk" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Geert Uytterhoeven Dec. 18, 2017, 11:22 a.m. UTC | #2
On Thu, Dec 14, 2017 at 3:11 PM, Ulf Hansson <ulf.hansson@linaro.org> wrote:
> On 9 November 2017 at 14:27, Geert Uytterhoeven <geert+renesas@glider.be> wrote:
>> If an R-Car SYSC slave device is part of the CPG/MSTP or CPG/MSSR Clock
>> Domain and to be used as a wakeup source, it must be kept active during
>> system suspend.
>>
>> Currently this is handled in device-specific drivers by explicitly
>> increasing the use count of the module clock when the device is
>> configured as a wakeup source.  However, the proper way to prevent the
>> device from being stopped is to inform this requirement to the genpd
>> core, by setting the GENPD_FLAG_ACTIVE_WAKEUP flag.
>>
>> Note that this will only affect devices configured as wakeup sources.
>>
>> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
>
> Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>

Thank you!

Simon: can you please queue this up for v4.16?
I have queued the other 2 clock patches in clk-renesas-for-v4.16, and sent
a PR for it.
Thanks!

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
--
To unsubscribe from this list: send the line "unsubscribe linux-clk" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Simon Horman Dec. 20, 2017, 10:23 a.m. UTC | #3
On Mon, Dec 18, 2017 at 12:22:17PM +0100, Geert Uytterhoeven wrote:
> On Thu, Dec 14, 2017 at 3:11 PM, Ulf Hansson <ulf.hansson@linaro.org> wrote:
> > On 9 November 2017 at 14:27, Geert Uytterhoeven <geert+renesas@glider.be> wrote:
> >> If an R-Car SYSC slave device is part of the CPG/MSTP or CPG/MSSR Clock
> >> Domain and to be used as a wakeup source, it must be kept active during
> >> system suspend.
> >>
> >> Currently this is handled in device-specific drivers by explicitly
> >> increasing the use count of the module clock when the device is
> >> configured as a wakeup source.  However, the proper way to prevent the
> >> device from being stopped is to inform this requirement to the genpd
> >> core, by setting the GENPD_FLAG_ACTIVE_WAKEUP flag.
> >>
> >> Note that this will only affect devices configured as wakeup sources.
> >>
> >> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> >
> > Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
> 
> Thank you!
> 
> Simon: can you please queue this up for v4.16?
> I have queued the other 2 clock patches in clk-renesas-for-v4.16, and sent
> a PR for it.

Thanks, I have applied this patch to the soc-for-v4.16 branch.
It is currently not based v4.15-rc1. Let me know if it should
be rebased on top of your pull request for clk-renesas-for-v4.16.
--
To unsubscribe from this list: send the line "unsubscribe linux-clk" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Geert Uytterhoeven Dec. 20, 2017, 10:28 a.m. UTC | #4
Hi Simon,

On Wed, Dec 20, 2017 at 11:23 AM, Simon Horman <horms@verge.net.au> wrote:
> On Mon, Dec 18, 2017 at 12:22:17PM +0100, Geert Uytterhoeven wrote:
>> On Thu, Dec 14, 2017 at 3:11 PM, Ulf Hansson <ulf.hansson@linaro.org> wrote:
>> > On 9 November 2017 at 14:27, Geert Uytterhoeven <geert+renesas@glider.be> wrote:
>> >> If an R-Car SYSC slave device is part of the CPG/MSTP or CPG/MSSR Clock
>> >> Domain and to be used as a wakeup source, it must be kept active during
>> >> system suspend.
>> >>
>> >> Currently this is handled in device-specific drivers by explicitly
>> >> increasing the use count of the module clock when the device is
>> >> configured as a wakeup source.  However, the proper way to prevent the
>> >> device from being stopped is to inform this requirement to the genpd
>> >> core, by setting the GENPD_FLAG_ACTIVE_WAKEUP flag.
>> >>
>> >> Note that this will only affect devices configured as wakeup sources.
>> >>
>> >> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
>> >
>> > Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
>>
>> Thank you!
>>
>> Simon: can you please queue this up for v4.16?
>> I have queued the other 2 clock patches in clk-renesas-for-v4.16, and sent
>> a PR for it.
>
> Thanks, I have applied this patch to the soc-for-v4.16 branch.
> It is currently not based v4.15-rc1. Let me know if it should
> be rebased on top of your pull request for clk-renesas-for-v4.16.

If the base is not v4.15-rc1, what is it? GENPD_FLAG_ACTIVE_WAKEUP was
introduced in v4.15-rc1, so it won't compile based on v4.14.

There's no dependency on the clock drivers, so no need to base on
top of clk-renesas-for-v4.16.

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
--
To unsubscribe from this list: send the line "unsubscribe linux-clk" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Simon Horman Dec. 20, 2017, 11:46 a.m. UTC | #5
On Wed, Dec 20, 2017 at 11:28:43AM +0100, Geert Uytterhoeven wrote:
> Hi Simon,
> 
> On Wed, Dec 20, 2017 at 11:23 AM, Simon Horman <horms@verge.net.au> wrote:
> > On Mon, Dec 18, 2017 at 12:22:17PM +0100, Geert Uytterhoeven wrote:
> >> On Thu, Dec 14, 2017 at 3:11 PM, Ulf Hansson <ulf.hansson@linaro.org> wrote:
> >> > On 9 November 2017 at 14:27, Geert Uytterhoeven <geert+renesas@glider.be> wrote:
> >> >> If an R-Car SYSC slave device is part of the CPG/MSTP or CPG/MSSR Clock
> >> >> Domain and to be used as a wakeup source, it must be kept active during
> >> >> system suspend.
> >> >>
> >> >> Currently this is handled in device-specific drivers by explicitly
> >> >> increasing the use count of the module clock when the device is
> >> >> configured as a wakeup source.  However, the proper way to prevent the
> >> >> device from being stopped is to inform this requirement to the genpd
> >> >> core, by setting the GENPD_FLAG_ACTIVE_WAKEUP flag.
> >> >>
> >> >> Note that this will only affect devices configured as wakeup sources.
> >> >>
> >> >> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> >> >
> >> > Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
> >>
> >> Thank you!
> >>
> >> Simon: can you please queue this up for v4.16?
> >> I have queued the other 2 clock patches in clk-renesas-for-v4.16, and sent
> >> a PR for it.
> >
> > Thanks, I have applied this patch to the soc-for-v4.16 branch.
> > It is currently not based v4.15-rc1. Let me know if it should
> > be rebased on top of your pull request for clk-renesas-for-v4.16.
> 
> If the base is not v4.15-rc1, what is it? GENPD_FLAG_ACTIVE_WAKEUP was
> introduced in v4.15-rc1, so it won't compile based on v4.14.

Sorry, I typed my message incorrectly. The base _is_ v4.15-rc1.

> There's no dependency on the clock drivers, so no need to base on
> top of clk-renesas-for-v4.16.

Thanks, got it.
--
To unsubscribe from this list: send the line "unsubscribe linux-clk" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/soc/renesas/rcar-sysc.c b/drivers/soc/renesas/rcar-sysc.c
index c8406e81640f6560..ac4df1c43b2fbdbe 100644
--- a/drivers/soc/renesas/rcar-sysc.c
+++ b/drivers/soc/renesas/rcar-sysc.c
@@ -224,7 +224,7 @@  static void __init rcar_sysc_pd_setup(struct rcar_sysc_pd *pd)
 
 	if (!(pd->flags & (PD_CPU | PD_SCU))) {
 		/* Enable Clock Domain for I/O devices */
-		genpd->flags |= GENPD_FLAG_PM_CLK;
+		genpd->flags |= GENPD_FLAG_PM_CLK | GENPD_FLAG_ACTIVE_WAKEUP;
 		if (has_cpg_mstp) {
 			genpd->attach_dev = cpg_mstp_attach_dev;
 			genpd->detach_dev = cpg_mstp_detach_dev;