[PATCH 2/2] RFC time: add syscore suspend ops to s2idle

From: Ruifeng Zhang
Date: Thu Feb 04 2021 - 00:29:56 EST


Some vendors need do more things when s2idle.

The required GKI does not allow modification of the
kernel source code, so provide the syscore operation
interface.

Signed-off-by: Ruifeng Zhang <ruifeng.zhang1@xxxxxxxxxx>
---
kernel/time/tick-common.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c
index 9d3a22510bab..8c4509250456 100644
--- a/kernel/time/tick-common.c
+++ b/kernel/time/tick-common.c
@@ -11,6 +11,7 @@
#include <linux/err.h>
#include <linux/hrtimer.h>
#include <linux/interrupt.h>
+#include <linux/list.h>
#include <linux/nmi.h>
#include <linux/percpu.h>
#include <linux/profile.h>
@@ -528,6 +529,7 @@ void tick_freeze(void)
trace_suspend_resume(TPS("timekeeping_freeze"),
smp_processor_id(), true);
system_state =3D SYSTEM_SUSPEND;
+ syscore_suspend(SUSPEND_S2IDLE);
sched_clock_suspend();
timekeeping_suspend();
} else {
@@ -553,6 +555,7 @@ void tick_unfreeze(void)
if (tick_freeze_depth =3D=3D num_online_cpus()) {
timekeeping_resume();
sched_clock_resume();
+ syscore_resume(SUSPEND_S2IDLE);
system_state =3D SYSTEM_RUNNING;
trace_suspend_resume(TPS("timekeeping_freeze"),
smp_processor_id(), false);
--
2.17.1

Greg KH <gregkh@xxxxxxxxxxxxxxxxxxx> =E4=BA=8E2021=E5=B9=B41=E6=9C=8829=E6=
=97=A5=E5=91=A8=E4=BA=94 =E4=B8=8B=E5=8D=884:53=E5=86=99=E9=81=93=EF=BC=9A
>
> On Fri, Jan 29, 2021 at 04:27:26PM +0800, Ruifeng Zhang wrote:
> > From: Ruifeng Zhang <ruifeng.zhang1@xxxxxxxxxx>
> >
> > Suspend type contains s2ram and s2idle, but syscore is only
> > available for S2RAM.
>
> Who else needs this?
>
> > S2idle requires a similar feature, so a new parameter
> > "enum suspend_type" is added to distinguish it.
>
> Who requires this export?
>
> I don't see a user of this new code/api in this patch, so why would it
> be accepted?
>
> Also, you are doing many different things in the same patch, please
> break this up into a patch series where you only do one logical change
> at a time.
>
> thanks,
>
> greg k-h