This patch introduces helper functions for Device Voltage and Frequency
Scaling (DVFS).
Data structures added:
1. omap_dev_user_list: This structure maintains list of frequency requests per
device basis. When a device needs to be scaled to a particular frequency,
This list is searched to find the maximum request for a given device.
If noone has placed any request, device frequency is obtained from device
opp table.
2. omap_vdd_dev_list: This strcucture stores device list per vdd basis.
Whenever a device is registered with a vdd, it is added to this list.
3. omap_vdd_user_list: User list of devices associated with each voltage domain
instance. The user list is implemented using plist structure with priority
node populated with the voltage values.
4. omap_vdd_dvfs_info: This structure is used to abstract DVFS related
information per VDD basis. It holds pointer to corresponding vdd's
voltagedomain instance and pointer to user list.
Following helper functions have been added to operate on above data structures:
1. omap_dvfs_add_vdd_user - function to add a user into omap_vdd_user_list
2. omap_vdd_user_list - function to remove a user from omap_vdd_user_list
3. omap_dvfs_register_device - function to register a device with vdd
4. omap_dvfs_add_freq_request - function to add a frequency request into
omap_dev_user_list
5. omap_dvfs_remove_freq_request - function to remove a frequency request from
omap_dev_user_list
6. omap_dvfs_find_voltage - function to find the opp corresponding to given
voltage
7. omap_device_scale - this is the function that is to be used for scaling
a specific domain. This is exported for drivers such as syslink, dspbridge
to use it while being a module.
DVFS layer is initialized and basic data structures are allocated and
initialized as part of this.
This patch is based on Vishwa and Thara's previous DVFS implementation, but with
major rework.
note: generates "warning: 'omap_dvfs_remove_vdd_user' defined but not used"
this function will be used in future patches
[nm@ti.com: misc cleanups including use voltage files from mach-omap2 dir]
[axelhaslam@ti.com: fixed issue with ondemand - required mutex unlock]
[toddpoynor@google.com: Add spinlocking of plists, GFP_ATOMIC]
Signed-off-by: Nishanth Menon
Signed-off-by: Axel Haslam
Signed-off-by: Todd Poynor
Signed-off-by: Vishwanath BS
Cc: Thara Gopinath
[vaibhav.bedia@ti.com: Pull in for AM33xx]
Signed-off-by: Vaibhav Bedia
[afzal@ti.com: fix warning]
Signed-off-by: Afzal Mohammed