Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PM: domains: Add dev_get_performance_state() callback
Add optional dev_get_performance_state() callback that retrieves and initializes performance state of a device attached to a power domain. The new callback should return performance and suspend states of the attached device, which should be read out from hardware. GENPD core assumes that initially performance state of all devices is zero and consumer device driver is responsible for management of the performance state. GENPD core now drops and restores performance state across RPM suspend/resume of consumer devices, which allowed to move part of the boilerplate performance management code into GENPD core. The part that hasn't been moved to GENPD core yet is the initialization of the performance state. Hardware may be preprogrammed to a specific performance state which isn't zero initially, hence the PD's performance state is inconsistent with hardware. This requires each consumer driver to sync the state explicitly. For some platforms this is a boilerplate code replicated by each driver. The new callback moves out initialization of the performance state from consumer drivers into GENPD core, allowing to remove the remaining boilerplate code from the drivers. Now, when consumer device is resumed for the first time, the GENPD core will set up performance state in accordance to the hardware state. Still, consumer drivers are free to override the initial performance state configured by GENPD, if necessary. Signed-off-by: Dmitry Osipenko <digetx@gmail.com>