[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20161108124312.GC7191@yu-desktop-1.sh.intel.com>
Date: Tue, 8 Nov 2016 20:43:12 +0800
From: Chen Yu <yu.c.chen@...el.com>
To: x86@...nel.org
Cc: Pavel Machek <pavel@....cz>, linux-pm@...r.kernel.org,
linux-kernel@...r.kernel.org,
"Rafael J. Wysocki" <rjw@...ysocki.net>,
Thomas Gleixner <tglx@...utronix.de>,
Len Brown <lenb@...nel.org>,
John Stultz <john.stultz@...aro.org>,
Xunlei Pang <xlpang@...hat.com>
Subject: Re: [PATCH 2/2][RFC v6] PM / sleep: save/restore RTC time after
resumed if pm_trace enabled
Hi all,
On Tue, Nov 08, 2016 at 05:02:14PM +0800, Chen Yu wrote:
> Previously the bogus CMOS RTC sleep time has been ignored if pm_trace
> is enabled, however once the system successfully resumed back,
> any further read to CMOS RTC would return an error. Actually it is
> more user-friendly to bring the system back to normal after resumed.
>
> This patch has registered an pm notifier to restore the RTC to the
> value before been overwitten by pm_trace.
>
> Cc: "Rafael J. Wysocki" <rjw@...ysocki.net>
> Cc: Thomas Gleixner <tglx@...utronix.de>
> Cc: Len Brown <lenb@...nel.org>
> Cc: John Stultz <john.stultz@...aro.org>
> Cc: Xunlei Pang <xlpang@...hat.com>
> Signed-off-by: Chen Yu <yu.c.chen@...el.com>
> ---
Please ignore this version for now,
the atomic variable below is unnecessary since
pm_trace has disabled the async suspend.
And in order to allow the users to adjust rtc after resume,
we can clear the pm_trace_rtc_abused directly and warn users of
the broken rtc. (Without save/restore).
> drivers/base/power/trace.c | 29 +++++++++++++++++++++++++++++
> 1 file changed, 29 insertions(+)
>
> diff --git a/drivers/base/power/trace.c b/drivers/base/power/trace.c
> index aa9109a..1e6c611 100644
> --- a/drivers/base/power/trace.c
> +++ b/drivers/base/power/trace.c
> @@ -10,6 +10,7 @@
> #include <linux/pm-trace.h>
> #include <linux/export.h>
> #include <linux/rtc.h>
> +#include <linux/suspend.h>
>
> #include <linux/mc146818rtc.h>
>
> @@ -76,6 +77,11 @@
>
> bool pm_trace_rtc_abused __read_mostly;
> static unsigned int dev_hash_value;
> +struct rtc_time_save {
> + struct rtc_time time;
> + atomic_t saved;
> +};
>
Powered by blists - more mailing lists