cpufreq: Allow light-weight tear down and bring up of CPUs 82/199782/2
authorViresh Kumar <viresh.kumar@linaro.org>
Tue, 12 Feb 2019 07:06:46 +0000 (12:36 +0530)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Mon, 18 Feb 2019 04:54:32 +0000 (04:54 +0000)
commit499b3a512e1493ebdd056c92c24ac06c1010de88
treeb97e45ab19505d2a7803153b3ffe03ef4f16646e
parent2c5198b5deb9d32049e848cfb60c4c5949bbcdfb
cpufreq: Allow light-weight tear down and bring up of CPUs

The cpufreq core doesn't remove the cpufreq policy anymore on CPU
offline operation, rather that happens when the CPU device gets
unregistered from the kernel. This allows faster recovery when the CPU
comes back online. This is also very useful during system wide
suspend/resume where we offline all non-boot CPUs during suspend and
then bring them back on resume.

This commit takes the same idea a step ahead to allow drivers to do
light weight tear-down and bring-up during CPU offline and online
operations.

A new set of callbacks is introduced, online/offline(). online() gets
called when the first CPU of an inactive policy is brought up and
offline() gets called when all the CPUs of a policy are offlined.

The existing init/exit() callback get called on policy
creation/destruction. They also get called instead of online/offline()
callbacks if the online/offline() callbacks aren't provided.

This also moves around some code to get executed only for the new-policy
case going forward.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
[pending patch for mainline]
Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
Change-Id: I27bd475cac802ffae345308fc145490966eda456
drivers/cpufreq/cpufreq.c
include/linux/cpufreq.h