DRIVER INTERFACE
Kernel drivers offering hardware-specific CPU frequency control export their individual settings through the cpufreq driver interface. This involves implementing these methods: cpufreq_drv_settings, cpufreq_drv_type, cpufreq_drv_set, and cpufreq_drv_get. Additionally, the driver must attach a device as a child of a CPU device so that these methods can be called by the cpufreq framework. The cpufreq_drv_settings method returns an array of currently available settings, each of type
.Vt "struct cf_setting" . The driver should set unknown or irrelevant values to CPUFREQ_VAL_UNKNOWN. All the following elements for each setting should be returned:
struct cf_setting {
intfreq; /* CPU clock in Mhz or 100ths of a percent. */
intvolts; /* Voltage in mV. */
intpower; /* Power consumed in mW. */
intlat; /* Transition latency in us. */
device_t dev; /* Driver providing this setting. */
};
On entry to this method, count contains the number of settings that can be returned. On successful completion, the driver sets it to the actual number of settings returned. If the driver offers more settings than count will allow, it should return E2BIG.
The cpufreq_drv_type method indicates the type of settings it offers, either CPUFREQ_TYPE_ABSOLUTE or CPUFREQ_TYPE_RELATIVE. Additionally, the driver may set the CPUFREQ_FLAG_INFO_ONLY flag if the settings it provides are information for other drivers only and cannot be passed to cpufreq_drv_set to activate them.
The cpufreq_drv_set method takes a driver setting and makes it active. If the setting is invalid or not currently available, it should return EINVAL.
The cpufreq_drv_get method returns the currently-active driver setting. The
.Vt "struct cf_setting" returned must be valid for passing to cpufreq_drv_set, including all elements being filled out correctly. If the driver cannot infer the current setting (even by estimating it with cpu_est_clockrate) then it should set all elements to CPUFREQ_VAL_UNKNOWN.
SEE ALSO
acpi(4), sysctl(8)
AUTHORS
BUGS
longrun(4).