PM: Introduce devfreq: generic DVFS framework with device-specific OPPs
With OPPs, a device may have multiple operable frequency and voltage
sets. However, there can be multiple possible operable sets and a system
will need to choose one from them. In order to reduce the power
consumption (by reducing frequency and voltage) without affecting the
performance too much, a Dynamic Voltage and Frequency Scaling (DVFS)
scheme may be used.
This patch introduces the DVFS capability to non-CPU devices with OPPs.
DVFS is a techique whereby the frequency and supplied voltage of a
device is adjusted on-the-fly. DVFS usually sets the frequency as low
as possible with given conditions (such as QoS assurance) and adjusts
voltage according to the chosen frequency in order to reduce power
consumption and heat dissipation.
The generic DVFS for devices, devfreq, may appear quite similar with
/drivers/cpufreq. However, cpufreq does not allow to have multiple
devices registered and is not suitable to have multiple heterogenous
devices with different (but simple) governors.
Normally, DVFS mechanism controls frequency based on the demand for
the device, and then, chooses voltage based on the chosen frequency.
devfreq also controls the frequency based on the governor's frequency
recommendation and let OPP pick up the pair of frequency and voltage
based on the recommended frequency. Then, the chosen OPP is passed to
device driver's "target" callback.
When PM QoS is going to be used with the devfreq device, the device
driver should enable OPPs that are appropriate with the current PM QoS
requests. In order to do so, the device driver may call opp_enable and
opp_disable at the notifier callback of PM QoS so that PM QoS's
update_target() call enables the appropriate OPPs. Note that at least
one of OPPs should be enabled at any time; be careful when there is a
transition.
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Reviewed-by: Mike Turquette <mturquette@ti.com>
Acked-by: Kevin Hilman <khilman@ti.com>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
2011-10-01 16:19:15 -06:00
|
|
|
/*
|
|
|
|
* governor.h - internal header for devfreq governors.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2011 Samsung Electronics
|
|
|
|
* MyungJoo Ham <myungjoo.ham@samsung.com>
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
|
|
* published by the Free Software Foundation.
|
|
|
|
*
|
|
|
|
* This header is for devfreq governors in drivers/devfreq/
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _GOVERNOR_H
|
|
|
|
#define _GOVERNOR_H
|
|
|
|
|
|
|
|
#include <linux/devfreq.h>
|
|
|
|
|
|
|
|
#define to_devfreq(DEV) container_of((DEV), struct devfreq, dev)
|
|
|
|
|
2012-10-25 17:50:09 -06:00
|
|
|
/* Devfreq events */
|
|
|
|
#define DEVFREQ_GOV_START 0x1
|
|
|
|
#define DEVFREQ_GOV_STOP 0x2
|
|
|
|
#define DEVFREQ_GOV_INTERVAL 0x3
|
2012-10-25 17:50:18 -06:00
|
|
|
#define DEVFREQ_GOV_SUSPEND 0x4
|
|
|
|
#define DEVFREQ_GOV_RESUME 0x5
|
2012-10-25 17:50:09 -06:00
|
|
|
|
2017-04-05 22:19:35 -06:00
|
|
|
/**
|
|
|
|
* struct devfreq_governor - Devfreq policy governor
|
|
|
|
* @node: list node - contains registered devfreq governors
|
|
|
|
* @name: Governor's name
|
|
|
|
* @immutable: Immutable flag for governor. If the value is 1,
|
|
|
|
* this govenror is never changeable to other governor.
|
|
|
|
* @get_target_freq: Returns desired operating frequency for the device.
|
|
|
|
* Basically, get_target_freq will run
|
|
|
|
* devfreq_dev_profile.get_dev_status() to get the
|
|
|
|
* status of the device (load = busy_time / total_time).
|
|
|
|
* If no_central_polling is set, this callback is called
|
|
|
|
* only with update_devfreq() notified by OPP.
|
|
|
|
* @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 of per device devfreq during device idle.
|
|
|
|
*
|
|
|
|
* Note that the callbacks are called with devfreq->lock locked by devfreq.
|
|
|
|
*/
|
|
|
|
struct devfreq_governor {
|
|
|
|
struct list_head node;
|
|
|
|
|
|
|
|
const char name[DEVFREQ_NAME_LEN];
|
|
|
|
const unsigned int immutable;
|
|
|
|
int (*get_target_freq)(struct devfreq *this, unsigned long *freq);
|
|
|
|
int (*event_handler)(struct devfreq *devfreq,
|
|
|
|
unsigned int event, void *data);
|
|
|
|
};
|
|
|
|
|
PM: Introduce devfreq: generic DVFS framework with device-specific OPPs
With OPPs, a device may have multiple operable frequency and voltage
sets. However, there can be multiple possible operable sets and a system
will need to choose one from them. In order to reduce the power
consumption (by reducing frequency and voltage) without affecting the
performance too much, a Dynamic Voltage and Frequency Scaling (DVFS)
scheme may be used.
This patch introduces the DVFS capability to non-CPU devices with OPPs.
DVFS is a techique whereby the frequency and supplied voltage of a
device is adjusted on-the-fly. DVFS usually sets the frequency as low
as possible with given conditions (such as QoS assurance) and adjusts
voltage according to the chosen frequency in order to reduce power
consumption and heat dissipation.
The generic DVFS for devices, devfreq, may appear quite similar with
/drivers/cpufreq. However, cpufreq does not allow to have multiple
devices registered and is not suitable to have multiple heterogenous
devices with different (but simple) governors.
Normally, DVFS mechanism controls frequency based on the demand for
the device, and then, chooses voltage based on the chosen frequency.
devfreq also controls the frequency based on the governor's frequency
recommendation and let OPP pick up the pair of frequency and voltage
based on the recommended frequency. Then, the chosen OPP is passed to
device driver's "target" callback.
When PM QoS is going to be used with the devfreq device, the device
driver should enable OPPs that are appropriate with the current PM QoS
requests. In order to do so, the device driver may call opp_enable and
opp_disable at the notifier callback of PM QoS so that PM QoS's
update_target() call enables the appropriate OPPs. Note that at least
one of OPPs should be enabled at any time; be careful when there is a
transition.
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Reviewed-by: Mike Turquette <mturquette@ti.com>
Acked-by: Kevin Hilman <khilman@ti.com>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
2011-10-01 16:19:15 -06:00
|
|
|
/* Caution: devfreq->lock must be locked before calling update_devfreq */
|
|
|
|
extern int update_devfreq(struct devfreq *devfreq);
|
|
|
|
|
2012-10-25 17:50:09 -06:00
|
|
|
extern void devfreq_monitor_start(struct devfreq *devfreq);
|
|
|
|
extern void devfreq_monitor_stop(struct devfreq *devfreq);
|
|
|
|
extern void devfreq_monitor_suspend(struct devfreq *devfreq);
|
|
|
|
extern void devfreq_monitor_resume(struct devfreq *devfreq);
|
|
|
|
extern void devfreq_interval_update(struct devfreq *devfreq,
|
|
|
|
unsigned int *delay);
|
2012-10-29 14:01:43 -06:00
|
|
|
|
|
|
|
extern int devfreq_add_governor(struct devfreq_governor *governor);
|
|
|
|
extern int devfreq_remove_governor(struct devfreq_governor *governor);
|
|
|
|
|
2017-01-30 23:38:17 -07:00
|
|
|
extern int devfreq_update_status(struct devfreq *devfreq, unsigned long freq);
|
|
|
|
|
PM: Introduce devfreq: generic DVFS framework with device-specific OPPs
With OPPs, a device may have multiple operable frequency and voltage
sets. However, there can be multiple possible operable sets and a system
will need to choose one from them. In order to reduce the power
consumption (by reducing frequency and voltage) without affecting the
performance too much, a Dynamic Voltage and Frequency Scaling (DVFS)
scheme may be used.
This patch introduces the DVFS capability to non-CPU devices with OPPs.
DVFS is a techique whereby the frequency and supplied voltage of a
device is adjusted on-the-fly. DVFS usually sets the frequency as low
as possible with given conditions (such as QoS assurance) and adjusts
voltage according to the chosen frequency in order to reduce power
consumption and heat dissipation.
The generic DVFS for devices, devfreq, may appear quite similar with
/drivers/cpufreq. However, cpufreq does not allow to have multiple
devices registered and is not suitable to have multiple heterogenous
devices with different (but simple) governors.
Normally, DVFS mechanism controls frequency based on the demand for
the device, and then, chooses voltage based on the chosen frequency.
devfreq also controls the frequency based on the governor's frequency
recommendation and let OPP pick up the pair of frequency and voltage
based on the recommended frequency. Then, the chosen OPP is passed to
device driver's "target" callback.
When PM QoS is going to be used with the devfreq device, the device
driver should enable OPPs that are appropriate with the current PM QoS
requests. In order to do so, the device driver may call opp_enable and
opp_disable at the notifier callback of PM QoS so that PM QoS's
update_target() call enables the appropriate OPPs. Note that at least
one of OPPs should be enabled at any time; be careful when there is a
transition.
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Reviewed-by: Mike Turquette <mturquette@ti.com>
Acked-by: Kevin Hilman <khilman@ti.com>
Signed-off-by: Rafael J. Wysocki <rjw@sisk.pl>
2011-10-01 16:19:15 -06:00
|
|
|
#endif /* _GOVERNOR_H */
|