Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 724116ec authored by David Keitel's avatar David Keitel Committed by Rohit Gupta
Browse files

PM / devfreq: memlat: add device attribute to show core to device bw map



This adds the freq_map device attribute to the mem_latency governor in
order to display a given device's core frequency to device bandwidth.
The output should be printed in the formatted in the same way as the
example:

Core freq (MHz) Device BW
            300      1525
            480      3143
            900      4173
           1017      7759
           1296      9887
           1555     11863
           1804     13763

Change-Id: I6bef33a1239329f0687ee3983c2c02d84e984284
Signed-off-by: default avatarDavid Keitel <dkeitel@codeaurora.org>
parent af503815
Loading
Loading
Loading
Loading
+24 −0
Original line number Diff line number Diff line
@@ -81,6 +81,29 @@ show_attr(__attr) \
store_attr(__attr, min, max)		\
static DEVICE_ATTR(__attr, 0644, show_##__attr, store_##__attr)

static ssize_t show_map(struct device *dev, struct device_attribute *attr,
			char *buf)
{
	struct devfreq *df = to_devfreq(dev);
	struct memlat_node *n = df->data;
	struct core_dev_map *map = n->hw->freq_map;
	unsigned int cnt = 0;

	cnt += snprintf(buf, PAGE_SIZE, "Core freq (MHz)\tDevice BW\n");

	while (map->core_mhz && cnt < PAGE_SIZE) {
		cnt += snprintf(buf + cnt, PAGE_SIZE - cnt, "%15u\t%9u\n",
				map->core_mhz, map->target_freq);
		map++;
	}
	if (cnt < PAGE_SIZE)
		cnt += snprintf(buf + cnt, PAGE_SIZE - cnt, "\n");

	return cnt;
}

static DEVICE_ATTR(freq_map, 0444, show_map, NULL);

static unsigned long core_to_dev_freq(struct memlat_node *node,
		unsigned long coref)
{
@@ -246,6 +269,7 @@ gov_attr(ratio_ceil, 1U, 10000U);

static struct attribute *dev_attr[] = {
	&dev_attr_ratio_ceil.attr,
	&dev_attr_freq_map.attr,
	NULL,
};