devfreq: add use_ab tunnable

In some usecases AB votes may not be needed but governor
cannot suppress the AB measured on HW.
Provide use_ab tunable for userspace to drop AB vote.

Change-Id: Ib7734e06fa00f86eb536b63526c16212012b614d
Signed-off-by: Santosh Mardi <gsantosh@codeaurora.org>
This commit is contained in:
Santosh Mardi 2020-09-29 14:41:35 +05:30
parent 1a6f8ce5e2
commit 703ff88bd3

View File

@ -40,6 +40,7 @@ struct hwmon_node {
unsigned int hyst_trigger_count;
unsigned int hyst_length;
unsigned int idle_mbps;
unsigned int use_ab;
unsigned int mbps_zones[NUM_MBPS_ZONES];
unsigned long prev_ab;
@ -448,8 +449,10 @@ static unsigned long get_bw_and_set_irq(struct hwmon_node *node,
}
node->prev_ab = new_bw;
if (ab)
if (ab && node->use_ab)
*ab = roundup(new_bw, node->bw_step);
else if (ab)
*ab = 0;
*freq = (new_bw * 100) / io_percent;
trace_bw_hwmon_update(dev_name(node->hw->df->dev.parent),
@ -822,6 +825,9 @@ static DEVICE_ATTR_RW(hyst_length);
show_attr(idle_mbps);
store_attr(idle_mbps, 0U, 2000U);
static DEVICE_ATTR_RW(idle_mbps);
show_attr(use_ab);
store_attr(use_ab, 0U, 1U);
static DEVICE_ATTR_RW(use_ab);
show_list_attr(mbps_zones, NUM_MBPS_ZONES);
store_list_attr(mbps_zones, NUM_MBPS_ZONES, 0U, UINT_MAX);
static DEVICE_ATTR_RW(mbps_zones);
@ -840,6 +846,7 @@ static struct attribute *dev_attr[] = {
&dev_attr_hyst_trigger_count.attr,
&dev_attr_hyst_length.attr,
&dev_attr_idle_mbps.attr,
&dev_attr_use_ab.attr,
&dev_attr_mbps_zones.attr,
&dev_attr_throttle_adj.attr,
NULL,
@ -987,6 +994,7 @@ int register_bw_hwmon(struct device *dev, struct bw_hwmon *hwmon)
node->hyst_trigger_count = 3;
node->hyst_length = 0;
node->idle_mbps = 400;
node->use_ab = 1;
node->mbps_zones[0] = 0;
node->hw = hwmon;