devfreq_devbw: Add support for voting for AB based on IB
Some generic devfreq governors might not provide AB values since that's a devbw device specific attribute. In such cases, we might want to make an average bandwidth (AB) vote that's a percentage of the IB vote to make sure device BW requirement are not grossly misrepresented. This patch adds support for that. Change-Id: I76fbb8d688742058980f0d7568f2e7140023917e Signed-off-by: Taniya Das <tdas@codeaurora.org>
This commit is contained in:
parent
924da379e0
commit
308ce83a38
2 changed files with 24 additions and 1 deletions
|
@ -20,6 +20,9 @@ Optional properties:
|
|||
enforced only when the CPU subsystem is active.
|
||||
- governor: Initial governor to use for the device.
|
||||
Default: "performance"
|
||||
- qcom,ab-percent: Indicates a value in percent of instantaneous
|
||||
bandwidth which will be used to calculate the
|
||||
absolute/average bandwidth.
|
||||
|
||||
Example:
|
||||
|
||||
|
|
|
@ -45,6 +45,7 @@ struct dev_data {
|
|||
int cur_ab;
|
||||
int cur_ib;
|
||||
long gov_ab;
|
||||
unsigned int ab_percent;
|
||||
struct devfreq *df;
|
||||
struct devfreq_dev_profile dp;
|
||||
};
|
||||
|
@ -78,6 +79,11 @@ static int set_bw(struct device *dev, int new_ib, int new_ab)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static unsigned int find_ab(struct dev_data *d, unsigned long *freq)
|
||||
{
|
||||
return (d->ab_percent * (*freq)) / 100;
|
||||
}
|
||||
|
||||
static void find_freq(struct devfreq_dev_profile *p, unsigned long *freq,
|
||||
u32 flags)
|
||||
{
|
||||
|
@ -105,7 +111,11 @@ static int devbw_target(struct device *dev, unsigned long *freq, u32 flags)
|
|||
struct dev_data *d = dev_get_drvdata(dev);
|
||||
|
||||
find_freq(&d->dp, freq, flags);
|
||||
return set_bw(dev, *freq, d->gov_ab);
|
||||
|
||||
if (!d->gov_ab)
|
||||
return set_bw(dev, *freq, find_ab(d, freq));
|
||||
else
|
||||
return set_bw(dev, *freq, d->gov_ab);
|
||||
}
|
||||
|
||||
static int devbw_get_dev_status(struct device *dev,
|
||||
|
@ -119,6 +129,7 @@ static int devbw_get_dev_status(struct device *dev,
|
|||
|
||||
#define PROP_PORTS "qcom,src-dst-ports"
|
||||
#define PROP_TBL "qcom,bw-tbl"
|
||||
#define PROP_AB_PER "qcom,ab-percent"
|
||||
#define PROP_ACTIVE "qcom,active-only"
|
||||
|
||||
int devfreq_add_devbw(struct device *dev)
|
||||
|
@ -196,6 +207,15 @@ int devfreq_add_devbw(struct device *dev)
|
|||
p->max_state = len;
|
||||
}
|
||||
|
||||
if (of_find_property(dev->of_node, PROP_AB_PER, &len)) {
|
||||
ret = of_property_read_u32(dev->of_node, PROP_AB_PER,
|
||||
&d->ab_percent);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
dev_dbg(dev, "ab-percent used %u\n", d->ab_percent);
|
||||
}
|
||||
|
||||
d->bus_client = msm_bus_scale_register_client(&d->bw_data);
|
||||
if (!d->bus_client) {
|
||||
dev_err(dev, "Unable to register bus client\n");
|
||||
|
|
Loading…
Add table
Reference in a new issue