linux Devfreq framwork

  • Post author:
  • Post category:linux


drivers/devfreq/devfreq.c

devfreq_list

devfreq_list_lock

find_device_devfreq() – find devfreq struct using device pointer.

devfreq_get_freq_level() – Lookup freq_table for the frequency.

struct devfreq:

time_in_state: statistics for how many time spent on the specific state.

last_stat_updated: record in which time the state being updated.

total_trans: total number of devfreq transitions.

trans_table: it is more like a two-dimensional array, which record devfreq transitions of from which old state to which target state.

something like:

0…maxstate,0…maxstate … 0…maxstate

0         1              maxstate

min_freq:minimum frequency

max_freq:maximum frequency

work:the delayed work struct variable used for polling

stop_polling:devfreq polling status of a device, which will be used for function devfreq_monitor_suspend/resume function to indicate if the devfreq have been stop polling, if being suspend then stop_polling is true which means that polling have been stoped and if stop_polling is false which means that polling have been resumed and it can be stopped again. the default value should be false.

data: private data for governors

governor_name: the name of governor used with this devfreq

governor: method how to choose frequency based on the usage, which is the devfreq using governor.

profile: device-specific devfreq profile, which the devfreq using profile

node: used as a node in devfreq_list

lock: a mutex

dev: device register by devfreq class. dev.parent is the device using devfreq

previous_freq: previously configured frequency value, which is configure as the profile’ initial_freq defaultly.

nb: assign nb.notifier_call as devfreq_notifier_call

update_devfreq() – Reevaluate the device and configure frequency.

devfreq_governor:

get_target_freq: return desired operating frequency for the device.

event_handler: callback for devfreq core framework to notify events to governors. Events include per device governor init and exit, opp changes out of devfreq, suspend and resume.

devfreq_monitor() – Periodically poll devfreq objects.

devfreq_monitor_start() – Start load monitoring of devfreq instance.

devfreq_monitor_stop() – Stop load monitoring of a devfreq instance.

devfreq_monitor_suspend() – Suspend load monitoring of a devfreq instance

devfreq_monitor_resume() – Resume load monitoring of a devfreq instance

devfreq_interval_update() – Update device devfreq monitoring interval

devfreq_notifier_call() – Notify that the device frequency requirements

devfreq_notifier_call() – Notify that the device frequency requirements has been changed out of devfreq framework.

_remove_devfreq() – Remove devfreq from the list and release its resources.

devfreq_dev_release() – Callback for struct device to release the device.

devfreq_add_device() – Add devfreq feature to the device

struct devfreq *devfreq_add_device(struct device *dev, struct devfreq_dev_profile *profile, const char *governor_name, void *data)

devfreq_remove_device() – Remove devfreq feature from a device.

devm_devfreq_add_device() – Resource-managed devfreq_add_device()

devm_devfreq_remove_device() – Resource-managed devfreq_remove_device()

devfreq_suspend_device() – Suspend devfreq of a device.

devfreq_resume_device() – Resume devfreq of a device.

devfreq_add_governor() – Add devfreq governor

devfreq_remove_device() – Remove devfreq feature from a device.

governor_show/governor_store/available_governors_show/cur_freq_show/target_freq_show/polling_interval_show/polling_interval_store/min_freq_store/min_freq_show/

max_freq_show/max_freq_store/available_frequencies_show/trans_stat_show