Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1688019
| From | "Rafael J. Wysocki" <rjw@rjwysocki.net> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [RFC 1/2] PM / suspend: Add platform_suspend_target_state() |
| Date | 2017-07-16 01:40 +0200 |
| Message-ID | <u3EPf-7PE-7@gated-at.bofh.it> (permalink) |
| References | <tVlgK-3S1-3@gated-at.bofh.it> <u3yqt-3OB-5@gated-at.bofh.it> <u3z3b-4id-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Saturday, July 15, 2017 10:20:27 AM Florian Fainelli wrote:
>
> On 07/15/2017 09:46 AM, Pavel Machek wrote:
> > Hi!
> >
> >>>> I had an idea of using an enum type encompassing all of the power states
> >>>> defined for various platforms and serving both as a registry (to ensure the
> >>>> uniqueness of the values assigned to the states) and a common ground
> >>>> between platforms and drivers.
> >>>>
> >>>> Something like:
> >>>>
> >>>> enum platform_target_state {
> >>>> PLATFORM_STATE_UNKNOWN = -1,
> >>>> PLATFORM_STATE_WORKING = 0,
> >>>> PLATFORM_STATE_ACPI_S1,
> >>>> PLATFORM_STATE_ACPI_S2,
> >>>> PLATFORM_STATE_ACPI_S3,
> >>>> PLATFORM_STATE_MY_BOARD_1_GATE_CLOCKS,
> >>>> PLATFORM_STATE_MY_BOARD_1_GATE_POWER,
> >>>> PLATFORM_STATE_ANOTHER_BOARD_DO_CRAZY_STUFF,
> >>>> ...
> >>>> };
> >>>>
> >>>> and define ->target_state to return a value of this type.
> >>>>
> >>>> Then, if a driver sees one of these and recognizes that value, it should
> >>>> know exactly what to do.
> >>>
> >>> Remind me why this is good idea?
> >>
> >> Because there are drivers that need to do specific things during
> >> suspend on a specific board when it goes into a specific state as a
> >> whole.
> >
> > We have seen driver that cares about voltage to his device being
> > lost. That's reasonable.
> >
> > Inquiring what the platform target state is... is not.
> >
> >>> If board wants to know if certain regulator stays online during
> >>> suspend, it should invent an API for _that_.
> >>
> >> Ideally, yes. However, that may be problematic for multiplatform kernels,
> >> because they would need to have all of those APIs built in and the driver
> >> code to figure out which API to use would be rather nasty.
> >
> > Lets do it the right way. Big enum is wrong.
>
> The enum offers the advantage of centralizing how many different states
> exist for all the platforms we know about in the kernel, it's easy to
> define common values for platforms that have the same semantics, just
> like it's simple to add new values for platform specific details.
Well, you seem to be liking this, so why don't you just implement it?
Thanks,
Rafael
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
Re: [RFC 1/2] PM / suspend: Add platform_suspend_target_state() Florian Fainelli <f.fainelli@gmail.com> - 2017-07-12 20:10 +0200
Re: [RFC 1/2] PM / suspend: Add platform_suspend_target_state() "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2017-07-15 00:30 +0200
Re: [RFC 1/2] PM / suspend: Add platform_suspend_target_state() Pavel Machek <pavel@ucw.cz> - 2017-07-15 08:30 +0200
Re: [RFC 1/2] PM / suspend: Add platform_suspend_target_state() "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2017-07-15 14:30 +0200
Re: [RFC 1/2] PM / suspend: Add platform_suspend_target_state() Pavel Machek <pavel@ucw.cz> - 2017-07-15 18:50 +0200
Re: [RFC 1/2] PM / suspend: Add platform_suspend_target_state() Florian Fainelli <f.fainelli@gmail.com> - 2017-07-15 19:30 +0200
Re: [RFC 1/2] PM / suspend: Add platform_suspend_target_state() Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2017-07-15 20:40 +0200
Re: [RFC 1/2] PM / suspend: Add platform_suspend_target_state() Pavel Machek <pavel@ucw.cz> - 2017-07-16 09:40 +0200
Re: [RFC 1/2] PM / suspend: Add platform_suspend_target_state() Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2017-07-16 15:50 +0200
Re: [RFC 1/2] PM / suspend: Add platform_suspend_target_state() Florian Fainelli <f.fainelli@gmail.com> - 2017-07-16 17:40 +0200
Re: [RFC 1/2] PM / suspend: Add platform_suspend_target_state() Mason <slash.tmp@free.fr> - 2017-07-16 01:40 +0200
Re: [RFC 1/2] PM / suspend: Add platform_suspend_target_state() "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2017-07-16 01:50 +0200
Re: [RFC 1/2] PM / suspend: Add platform_suspend_target_state() Florian Fainelli <f.fainelli@gmail.com> - 2017-07-16 04:40 +0200
Re: [RFC 1/2] PM / suspend: Add platform_suspend_target_state() "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2017-07-16 12:40 +0200
Re: [RFC 1/2] PM / suspend: Add platform_suspend_target_state() Alexandre Belloni <alexandre.belloni@free-electrons.com> - 2017-07-16 15:40 +0200
Re: [RFC 1/2] PM / suspend: Add platform_suspend_target_state() Pavel Machek <pavel@ucw.cz> - 2017-07-16 20:30 +0200
Re: [RFC 1/2] PM / suspend: Add platform_suspend_target_state() Florian Fainelli <f.fainelli@gmail.com> - 2017-07-16 17:50 +0200
Re: [RFC 1/2] PM / suspend: Add platform_suspend_target_state() "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2017-07-16 01:40 +0200
Re: [RFC 1/2] PM / suspend: Add platform_suspend_target_state() "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2017-07-16 01:40 +0200
Re: [RFC 1/2] PM / suspend: Add platform_suspend_target_state() Pavel Machek <pavel@ucw.cz> - 2017-07-16 09:40 +0200
Re: [RFC 1/2] PM / suspend: Add platform_suspend_target_state() "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2017-07-16 12:40 +0200
Re: [RFC 1/2] PM / suspend: Add platform_suspend_target_state() Pavel Machek <pavel@ucw.cz> - 2017-07-16 20:30 +0200
csiph-web