thermal: devfreq_cooling: use a copy of device status
authorLukasz Luba <lukasz.luba@arm.com>
Thu, 10 Dec 2020 14:30:11 +0000 (14:30 +0000)
committerDaniel Lezcano <daniel.lezcano@linaro.org>
Fri, 11 Dec 2020 13:10:44 +0000 (14:10 +0100)
commit229794eee27fddbedd03be5f8b20375a2637ff48
tree09cccc8a0ac9ad51671dbcd8f2fa3f415cbf04f2
parentb8643a529930802778b04a4fe3f5cd53d9d6057c
thermal: devfreq_cooling: use a copy of device status

Devfreq cooling needs to now the correct status of the device in order
to operate. Devfreq framework can change the device status in the
background. To mitigate issues make a copy of the status structure and use
it for internal calculations.

In addition this patch adds normalization function, which also makes sure
that whatever data comes from the device, the load will be in range from 1
to 1024.

Reviewed-by: Ionela Voinescu <ionela.voinescu@arm.com>
Signed-off-by: Lukasz Luba <lukasz.luba@arm.com>
Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org>
Link: https://lore.kernel.org/r/20201210143014.24685-3-lukasz.luba@arm.com
drivers/thermal/devfreq_cooling.c