All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Rafael J. Wysocki" <rjw@rjwysocki.net>
To: Alexandre Belloni <alexandre.belloni@free-electrons.com>,
	Florian Fainelli <f.fainelli@gmail.com>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
	Ulf Hansson <ulf.hansson@linaro.org>,
	Daniel Lezcano <daniel.lezcano@linaro.org>,
	linux-pm <linux-pm@vger.kernel.org>,
	Thibaud Cornic <thibaud_cornic@sigmadesigns.com>,
	JB <jb_lescher@sigmadesigns.com>, Mason <slash.tmp@free.fr>,
	Kevin Hilman <khilman@kernel.org>, Pavel Machek <pavel@ucw.cz>,
	Linux ARM <linux-arm-kernel@lists.infradead.org>
Subject: Re: Drivers taking different actions depending on sleep state
Date: Thu, 22 Jun 2017 18:00:21 +0200	[thread overview]
Message-ID: <1791746.otcIQZBd7p@aspire.rjw.lan> (raw)
In-Reply-To: <20170622085102.mpk7vxodpgxtrlfd@piout.net>

On Thursday, June 22, 2017 10:51:02 AM Alexandre Belloni wrote:
> On 21/06/2017 at 16:55:04 -0700, Florian Fainelli wrote:
> > > That is conceivable, but again, the meaning of STANDBY and MEM is
> > > platform-specific.  Actions to be taken for, say, STANDBY, may differ
> > > from one platform to another.
> > 
> > True, though I would only expect drivers for that particular platform to
> > care about that information and these drivers would only make sense on
> > that particular platform so the meaning of STANDBY and MEM would be
> > clear for those drivers. The intent is really to keep the "distributed"
> > model where individual drivers manage their particular piece of HW,
> > while utilizing a global piece of information that is platform specific.
> > 
> > If this seems acceptable to you along with proper documentation to
> > illustrate the platform specific meaning of these states, I will got
> > ahead and cook a patch.
> 
> Well, that won't work for us. We need need two kind of information:
>  - whether main clock is switched from the master clock to the slow
>    clock
>  - whether VDDcore will be cut
> 
> for the first one, we already have an hackish callback:
> at91_suspend_entering_slow_clock() that will call from the platform
> specific drivers.
> 
> The main issue now is for the second one. We also need it for IPs that
> are shared with other SoCs. For example, the macb ethernet controller
> that is shared with the zynq and the m_can controller. In those cases,
> I don't think it is a good idea to add platform specific code in the
> drivers but at the same time, I don't think it is reasonable to
> unconditionally reinit the IP on resume as there is a significant
> latency hit. I don't think that the xilinx guys will like when suddenly
> their platform takes 500ms to resume.

We can add a ->target_state callback in struct platform_suspend_ops that
will return a value representing the the particular target state the platform
has chosen to go to.  Along with it, there can be a list of values for all
of the low-level sleep states defined by all of the different platforms
(in which case I'd like to reserve values 0-5 for the ACPI system states).

There can be a wrapper, say platform_suspend_target_state() around that,
so the driver will call it, compare the return value with what is known to it
about the different platforms it can run on and act accordingly.

Thanks,
Rafael

WARNING: multiple messages have this Message-ID (diff)
From: rjw@rjwysocki.net (Rafael J. Wysocki)
To: linux-arm-kernel@lists.infradead.org
Subject: Drivers taking different actions depending on sleep state
Date: Thu, 22 Jun 2017 18:00:21 +0200	[thread overview]
Message-ID: <1791746.otcIQZBd7p@aspire.rjw.lan> (raw)
In-Reply-To: <20170622085102.mpk7vxodpgxtrlfd@piout.net>

On Thursday, June 22, 2017 10:51:02 AM Alexandre Belloni wrote:
> On 21/06/2017 at 16:55:04 -0700, Florian Fainelli wrote:
> > > That is conceivable, but again, the meaning of STANDBY and MEM is
> > > platform-specific.  Actions to be taken for, say, STANDBY, may differ
> > > from one platform to another.
> > 
> > True, though I would only expect drivers for that particular platform to
> > care about that information and these drivers would only make sense on
> > that particular platform so the meaning of STANDBY and MEM would be
> > clear for those drivers. The intent is really to keep the "distributed"
> > model where individual drivers manage their particular piece of HW,
> > while utilizing a global piece of information that is platform specific.
> > 
> > If this seems acceptable to you along with proper documentation to
> > illustrate the platform specific meaning of these states, I will got
> > ahead and cook a patch.
> 
> Well, that won't work for us. We need need two kind of information:
>  - whether main clock is switched from the master clock to the slow
>    clock
>  - whether VDDcore will be cut
> 
> for the first one, we already have an hackish callback:
> at91_suspend_entering_slow_clock() that will call from the platform
> specific drivers.
> 
> The main issue now is for the second one. We also need it for IPs that
> are shared with other SoCs. For example, the macb ethernet controller
> that is shared with the zynq and the m_can controller. In those cases,
> I don't think it is a good idea to add platform specific code in the
> drivers but at the same time, I don't think it is reasonable to
> unconditionally reinit the IP on resume as there is a significant
> latency hit. I don't think that the xilinx guys will like when suddenly
> their platform takes 500ms to resume.

We can add a ->target_state callback in struct platform_suspend_ops that
will return a value representing the the particular target state the platform
has chosen to go to.  Along with it, there can be a list of values for all
of the low-level sleep states defined by all of the different platforms
(in which case I'd like to reserve values 0-5 for the ACPI system states).

There can be a wrapper, say platform_suspend_target_state() around that,
so the driver will call it, compare the return value with what is known to it
about the different platforms it can run on and act accordingly.

Thanks,
Rafael

  reply	other threads:[~2017-06-22 16:07 UTC|newest]

Thread overview: 118+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-06-09 15:20 Drivers taking different actions depending on sleep state Mason
2017-06-09 15:20 ` Mason
2017-06-09 16:27 ` Mason
2017-06-09 16:27   ` Mason
2017-06-09 21:30   ` Pavel Machek
2017-06-09 21:30     ` Pavel Machek
2017-06-10  9:16     ` Mason
2017-06-10  9:16       ` Mason
2017-06-09 22:05 ` Florian Fainelli
2017-06-09 22:05   ` Florian Fainelli
2017-06-09 22:53 ` Rafael J. Wysocki
2017-06-09 22:53   ` Rafael J. Wysocki
2017-06-21 21:16   ` Florian Fainelli
2017-06-21 21:16     ` Florian Fainelli
2017-06-21 21:59     ` Rafael J. Wysocki
2017-06-21 21:59       ` Rafael J. Wysocki
2017-06-21 22:48       ` Florian Fainelli
2017-06-21 22:48         ` Florian Fainelli
2017-06-21 22:57         ` Rafael J. Wysocki
2017-06-21 22:57           ` Rafael J. Wysocki
2017-06-21 23:55           ` Florian Fainelli
2017-06-21 23:55             ` Florian Fainelli
2017-06-22  0:03             ` Rafael J. Wysocki
2017-06-22  0:03               ` Rafael J. Wysocki
2017-06-22 15:18               ` Florian Fainelli
2017-06-22 15:18                 ` Florian Fainelli
2017-06-22 16:09                 ` Rafael J. Wysocki
2017-06-22 16:09                   ` Rafael J. Wysocki
2017-06-22  8:51             ` Alexandre Belloni
2017-06-22  8:51               ` Alexandre Belloni
2017-06-22 16:00               ` Rafael J. Wysocki [this message]
2017-06-22 16:00                 ` Rafael J. Wysocki
2017-06-23  1:08               ` [RFC 0/2] PM / suspend: Add platform_suspend_target_state() Florian Fainelli
2017-06-23  1:08                 ` Florian Fainelli
2017-06-23  1:08                 ` [RFC 1/2] " Florian Fainelli
2017-06-23  1:08                   ` Florian Fainelli
2017-06-29 23:00                   ` Rafael J. Wysocki
2017-06-29 23:00                     ` Rafael J. Wysocki
2017-07-12 18:08                     ` Florian Fainelli
2017-07-12 18:08                       ` Florian Fainelli
2017-07-14 22:16                       ` Rafael J. Wysocki
2017-07-14 22:16                         ` Rafael J. Wysocki
2017-07-15  6:28                         ` Pavel Machek
2017-07-15  6:28                           ` Pavel Machek
2017-07-15 12:17                           ` Rafael J. Wysocki
2017-07-15 12:17                             ` Rafael J. Wysocki
2017-07-15 16:46                             ` Pavel Machek
2017-07-15 16:46                               ` Pavel Machek
2017-07-15 17:20                               ` Florian Fainelli
2017-07-15 17:20                                 ` Florian Fainelli
2017-07-15 18:33                                 ` Alexandre Belloni
2017-07-15 18:33                                   ` Alexandre Belloni
2017-07-06  3:18                                   ` Pavel Machek
2017-07-06  3:18                                     ` Pavel Machek
2017-07-16 13:41                                     ` Alexandre Belloni
2017-07-16 13:41                                       ` Alexandre Belloni
2017-07-16 15:35                                       ` Florian Fainelli
2017-07-16 15:35                                         ` Florian Fainelli
2017-07-15 23:24                                 ` Rafael J. Wysocki
2017-07-15 23:24                                   ` Rafael J. Wysocki
2017-07-15 23:34                                   ` Mason
2017-07-15 23:34                                     ` Mason
2017-07-15 23:38                                     ` Rafael J. Wysocki
2017-07-15 23:38                                       ` Rafael J. Wysocki
2017-07-16  2:36                                       ` Florian Fainelli
2017-07-16  2:36                                         ` Florian Fainelli
2017-07-16 10:22                                         ` Rafael J. Wysocki
2017-07-16 10:22                                           ` Rafael J. Wysocki
2017-07-16 13:38                                           ` Alexandre Belloni
2017-07-16 13:38                                             ` Alexandre Belloni
2017-07-16 18:24                                             ` Pavel Machek
2017-07-16 18:24                                               ` Pavel Machek
2017-07-16 15:41                                           ` Florian Fainelli
2017-07-16 15:41                                             ` Florian Fainelli
2017-07-15 23:29                               ` Rafael J. Wysocki
2017-07-15 23:29                                 ` Rafael J. Wysocki
2017-07-06  3:17                                 ` Pavel Machek
2017-07-06  3:17                                   ` Pavel Machek
2017-07-16 10:28                                   ` Rafael J. Wysocki
2017-07-16 10:28                                     ` Rafael J. Wysocki
2017-07-16 18:22                                     ` Pavel Machek
2017-07-16 18:22                                       ` Pavel Machek
2017-06-23  1:08                 ` [RFC 2/2] soc: bcm: brcmstb: PM: Implement target_state callback Florian Fainelli
2017-06-23  1:08                   ` Florian Fainelli
2017-06-29 23:04                   ` Rafael J. Wysocki
2017-06-29 23:04                     ` Rafael J. Wysocki
2017-07-16  2:36                 ` [PATCH 0/2] PM / suspend: Add platform_suspend_target_state() Florian Fainelli
2017-07-16  2:36                   ` Florian Fainelli
2017-07-16  2:36                   ` [PATCH 1/2] " Florian Fainelli
2017-07-16  2:36                     ` Florian Fainelli
2017-07-06  3:18                     ` Pavel Machek
2017-07-06  3:18                       ` Pavel Machek
2017-07-16 15:41                       ` Florian Fainelli
2017-07-16 15:41                         ` Florian Fainelli
2017-07-16 10:30                     ` Rafael J. Wysocki
2017-07-16 10:30                       ` Rafael J. Wysocki
2017-07-16  2:36                   ` [PATCH 2/2] soc: bcm: brcmstb: PM: Implement target_state callback Florian Fainelli
2017-07-16  2:36                     ` Florian Fainelli
2017-07-17 20:06                   ` [PATCH v2] PM / suspend: Add suspend_target_state() Florian Fainelli
2017-07-17 20:06                     ` Florian Fainelli
2017-07-17 20:16                     ` Pavel Machek
2017-07-17 20:16                       ` Pavel Machek
2017-07-17 21:03                       ` Rafael J. Wysocki
2017-07-17 21:03                         ` Rafael J. Wysocki
2017-07-17 21:21                         ` Florian Fainelli
2017-07-17 21:21                           ` Florian Fainelli
2017-07-20  8:03                     ` Pavel Machek
2017-07-20  8:03                       ` Pavel Machek
2017-07-17 22:10                   ` [PATCH v3] PM / suspend: Export pm_suspend_target_state Florian Fainelli
2017-07-17 22:10                     ` Florian Fainelli
2017-07-17 23:24                     ` Rafael J. Wysocki
2017-07-17 23:24                       ` Rafael J. Wysocki
2017-07-18  0:19                     ` [PATCH v4] " Florian Fainelli
2017-07-18  0:19                       ` Florian Fainelli
2017-07-24 20:55                       ` Rafael J. Wysocki
2017-07-24 20:55                         ` Rafael J. Wysocki
2017-07-13 12:03               ` Drivers taking different actions depending on sleep state Pavel Machek
2017-07-13 12:03                 ` Pavel Machek

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=1791746.otcIQZBd7p@aspire.rjw.lan \
    --to=rjw@rjwysocki.net \
    --cc=alexandre.belloni@free-electrons.com \
    --cc=daniel.lezcano@linaro.org \
    --cc=f.fainelli@gmail.com \
    --cc=jb_lescher@sigmadesigns.com \
    --cc=khilman@kernel.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=rafael@kernel.org \
    --cc=slash.tmp@free.fr \
    --cc=thibaud_cornic@sigmadesigns.com \
    --cc=ulf.hansson@linaro.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.