From: Marek Szyprowski Date: Fri, 25 Jan 2019 13:49:53 +0000 (+0100) Subject: devfreq: Suspend all devices on system shutdown X-Git-Tag: submit/tizen/20190329.020226~73 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2c5198b5deb9d32049e848cfb60c4c5949bbcdfb;p=platform%2Fkernel%2Flinux-exynos.git devfreq: Suspend all devices on system shutdown This way devfreq core ensures that all its devices will be set to safe operation points before reboot operation. There are board on which some aggressive power saving operation points are behind the capabilities of the bootloader to properly reset the hardware and boot the board. This way one can avoid board crash early after reboot. Similar pattern is used in CPUfreq subsystem. Reported-by: Markus Reichl Signed-off-by: Marek Szyprowski Change-Id: I45467c8e02f7fedf90d1dfd5080e6143a8cb69f7 --- diff --git a/drivers/devfreq/devfreq.c b/drivers/devfreq/devfreq.c index 5db7249b89d9..2a08edca35ad 100644 --- a/drivers/devfreq/devfreq.c +++ b/drivers/devfreq/devfreq.c @@ -23,6 +23,7 @@ #include #include #include +#include #include #include #include @@ -1421,6 +1422,10 @@ static struct attribute *devfreq_attrs[] = { }; ATTRIBUTE_GROUPS(devfreq); +static struct syscore_ops devfreq_syscore_ops = { + .shutdown = devfreq_suspend, +}; + static int __init devfreq_init(void) { devfreq_class = class_create(THIS_MODULE, "devfreq"); @@ -1437,6 +1442,8 @@ static int __init devfreq_init(void) } devfreq_class->dev_groups = devfreq_groups; + register_syscore_ops(&devfreq_syscore_ops); + return 0; } subsys_initcall(devfreq_init);