cpufreq: add cpufreq_driver_resolve_freq()
authorSteve Muckle <steve.muckle@linaro.org>
Wed, 13 Jul 2016 20:25:25 +0000 (13:25 -0700)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Thu, 21 Jul 2016 12:46:08 +0000 (14:46 +0200)
commite3c06236087051d5c62d60d0668588c370fda887
tree87bf8e5a9b77cb24d416851136451aaf43f27fd1
parentda7de91c3e237f3ace1aa29b82c69702dc0176c5
cpufreq: add cpufreq_driver_resolve_freq()

Cpufreq governors may need to know what a particular target frequency
maps to in the driver without necessarily wanting to set the frequency.
Support this operation via a new cpufreq API,
cpufreq_driver_resolve_freq(). This API returns the lowest driver
frequency equal or greater than the target frequency
(CPUFREQ_RELATION_L), subject to any policy (min/max) or driver
limitations. The mapping is also cached in the policy so that a
subsequent fast_switch operation can avoid repeating the same lookup.

The API will call a new cpufreq driver callback, resolve_freq(), if it
has been registered by the driver. Otherwise the frequency is resolved
via cpufreq_frequency_table_target(). Rather than require ->target()
style drivers to provide a resolve_freq() callback it is left to the
caller to ensure that the driver implements this callback if necessary
to use cpufreq_driver_resolve_freq().

Suggested-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Steve Muckle <smuckle@linaro.org>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/cpufreq/cpufreq.c
include/linux/cpufreq.h