Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1688499

Re: [PATCH 1/2] PM / suspend: Add platform_suspend_target_state()

From Florian Fainelli <f.fainelli@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH 1/2] PM / suspend: Add platform_suspend_target_state()
Date 2017-07-16 17:50 +0200
Message-ID <u3TXY-W2-7@gated-at.bofh.it> (permalink)
References <tVlgK-3S1-5@gated-at.bofh.it> <u3HDr-1cr-3@gated-at.bofh.it> <u3HDr-1cr-7@gated-at.bofh.it> <u3MjM-4aC-3@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw



On 07/05/2017 08:18 PM, Pavel Machek wrote:
> Hi!
> 
>> Although this callback is optional and documented as such, it requires
>> a platform_suspend_ops::begin callback to be implemented in order to
>> provide an accurate suspend/resume state within the driver that
>> implements this platform_suspend_ops.
>>
>> An enumeration: platform_target_state is defined which currently defines
>> the standard ACPI_S[1-4] states and can be extended with platform
>> specific suspend states.
>>
>> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
>> ---
>>  include/linux/suspend.h | 25 +++++++++++++++++++++++++
>>  kernel/power/suspend.c  | 15 +++++++++++++++
>>  2 files changed, 40 insertions(+)
>>
>> diff --git a/include/linux/suspend.h b/include/linux/suspend.h
>> index 0b1cf32edfd7..6e6cc0778816 100644
>> --- a/include/linux/suspend.h
>> +++ b/include/linux/suspend.h
>> @@ -50,6 +50,16 @@ enum suspend_stat_step {
>>  	SUSPEND_RESUME
>>  };
>>  
>> +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_ACPI_S4,
>> +	/* Add platform specific states here */
>> +};
>> +
> 
> As I tried to explain in the email thread, having list with all the possible platform
> states is no-go. We have about 1000 platforms supported...

FYI, the recent (relatively recent) CPU hotplug conversion from
notifiers to a state machine has a similar pattern whereby pieces of
code needing to hook into the CPU hotplug state machine add their own
enum values as they need. So far it's been working for them, and there
were tons of CPU hotplug notifiers in the kernel.

Anyhow, let me implement Rafael's suggestions and we can see how we move
from there.
-- 
Florian

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH 0/2] PM / suspend: Add platform_suspend_target_state() Florian Fainelli <f.fainelli@gmail.com> - 2017-07-16 04:40 +0200
  [PATCH 1/2] PM / suspend: Add platform_suspend_target_state() Florian Fainelli <f.fainelli@gmail.com> - 2017-07-16 04:40 +0200
    Re: [PATCH 1/2] PM / suspend: Add platform_suspend_target_state() Pavel Machek <pavel@ucw.cz> - 2017-07-16 09:40 +0200
      Re: [PATCH 1/2] PM / suspend: Add platform_suspend_target_state() Florian Fainelli <f.fainelli@gmail.com> - 2017-07-16 17:50 +0200
    Re: [PATCH 1/2] PM / suspend: Add platform_suspend_target_state() "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2017-07-16 12:40 +0200
  [PATCH v2] PM / suspend: Add suspend_target_state() Florian Fainelli <f.fainelli@gmail.com> - 2017-07-17 22:10 +0200
    Re: [PATCH v2] PM / suspend: Add suspend_target_state() Pavel Machek <pavel@ucw.cz> - 2017-07-17 22:20 +0200
      Re: [PATCH v2] PM / suspend: Add suspend_target_state() "Rafael J. Wysocki" <rafael@kernel.org> - 2017-07-17 23:10 +0200
        Re: [PATCH v2] PM / suspend: Add suspend_target_state() Florian Fainelli <f.fainelli@gmail.com> - 2017-07-17 23:30 +0200
  [PATCH v3] PM / suspend: Export pm_suspend_target_state Florian Fainelli <f.fainelli@gmail.com> - 2017-07-18 00:20 +0200
    Re: [PATCH v3] PM / suspend: Export pm_suspend_target_state "Rafael J. Wysocki" <rjw@rjwysocki.net> - 2017-07-18 01:40 +0200
    [PATCH v4] PM / suspend: Export pm_suspend_target_state Florian Fainelli <f.fainelli@gmail.com> - 2017-07-18 02:20 +0200

csiph-web