PM / devfreq: Use PM QoS for sysfs min/max_freq
authorLeonard Crestez <leonard.crestez@nxp.com>
Thu, 5 Dec 2019 10:05:07 +0000 (12:05 +0200)
committerChanwoo Choi <cw00.choi@samsung.com>
Mon, 9 Dec 2019 03:19:16 +0000 (12:19 +0900)
commit27dbc542f651ed09de910f274b32634904103774
treea74b9e5196e4c460a8d5ddc130011d84e9d9bae4
parent05d7ae15cfb18f9ce55eef85bb6bcd62d31acc57
PM / devfreq: Use PM QoS for sysfs min/max_freq

Switch the handling of min_freq and max_freq from sysfs to use the
dev_pm_qos_request interface.

Since PM QoS handles frequencies as kHz this change reduces the
precision of min_freq and max_freq. This shouldn't introduce problems
because frequencies which are not an integer number of kHz are likely
not an integer number of Hz either.

Try to ensure compatibility by rounding min values down and rounding
max values up.

Signed-off-by: Leonard Crestez <leonard.crestez@nxp.com>
Acked-by: Chanwoo Choi <cw00.choi@samsung.com>
Reviewed-by: Matthias Kaehlcke <mka@chromium.org>
Tested-by: Matthias Kaehlcke <mka@chromium.org>
[cw00.choi: Return -EAGAIN instead of -EINVAL if dev_pm_qos is inactive]
Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
drivers/devfreq/devfreq.c
include/linux/devfreq.h