Loading drivers/devfreq/governor_gpubw_mon.c +69 −5 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2014-2019, The Linux Foundation. All rights reserved. * Copyright (c) 2014-2020, The Linux Foundation. All rights reserved. */ #include <linux/devfreq.h> Loading Loading @@ -45,6 +45,61 @@ static inline int devfreq_get_freq_level(struct devfreq *devfreq, return -EINVAL; } static ssize_t cur_ab_show(struct device *dev, struct device_attribute *attr, char *buf) { struct devfreq *df = to_devfreq(dev); struct msm_busmon_extended_profile *bus_profile = container_of( (df->profile), struct msm_busmon_extended_profile, profile); return scnprintf(buf, PAGE_SIZE, "%llu\n", bus_profile->ab_mbytes); } static ssize_t sampling_interval_show(struct device *dev, struct device_attribute *attr, char *buf) { struct devfreq *df = to_devfreq(dev); struct msm_busmon_extended_profile *bus_profile = container_of( (df->profile), struct msm_busmon_extended_profile, profile); return scnprintf(buf, PAGE_SIZE, "%d\n", bus_profile->sampling_ms); } static ssize_t sampling_interval_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct devfreq *df = to_devfreq(dev); struct msm_busmon_extended_profile *bus_profile = container_of( (df->profile), struct msm_busmon_extended_profile, profile); u32 value; int ret; ret = kstrtou32(buf, 0, &value); if (ret) return ret; bus_profile->sampling_ms = value; return count; } static DEVICE_ATTR_RW(sampling_interval); static DEVICE_ATTR_RO(cur_ab); static const struct device_attribute *gpubw_attr_list[] = { &dev_attr_sampling_interval, &dev_attr_cur_ab, NULL }; static int devfreq_gpubw_get_target(struct devfreq *df, unsigned long *freq) { Loading Loading @@ -87,7 +142,7 @@ static int devfreq_gpubw_get_target(struct devfreq *df, level = devfreq_get_freq_level(df, stats->current_frequency); if (priv->bus.total_time < LONG_FLOOR) if (priv->bus.total_time < bus_profile->sampling_ms) return result; norm_max_cycles = (unsigned int)(priv->bus.ram_time) / Loading Loading @@ -187,12 +242,21 @@ static int gpubw_start(struct devfreq *devfreq) priv->bus.p_up[priv->bus.num - 1] = 100; _update_cutoff(priv, priv->bus.max); bus_profile->sampling_ms = LONG_FLOOR; for (i = 0; gpubw_attr_list[i] != NULL; i++) device_create_file(&devfreq->dev, gpubw_attr_list[i]); return 0; } static int gpubw_stop(struct devfreq *devfreq) { struct devfreq_msm_adreno_tz_data *priv = devfreq->data; int i; for (i = 0; gpubw_attr_list[i] != NULL; i++) device_remove_file(&devfreq->dev, gpubw_attr_list[i]); if (priv) { kfree(priv->bus.up); Loading include/linux/msm_adreno_devfreq.h +2 −1 Original line number Diff line number Diff line /* SPDX-License-Identifier: GPL-2.0 */ /* * Copyright (c) 2016-2019, The Linux Foundation. All rights reserved. * Copyright (c) 2016-2020, The Linux Foundation. All rights reserved. */ #ifndef MSM_ADRENO_DEVFREQ_H Loading Loading @@ -77,6 +77,7 @@ struct msm_adreno_extended_profile { struct msm_busmon_extended_profile { u32 flag; u32 sampling_ms; unsigned long percent_ab; unsigned long ab_mbytes; struct devfreq_msm_adreno_tz_data *private_data; Loading Loading
drivers/devfreq/governor_gpubw_mon.c +69 −5 Original line number Diff line number Diff line // SPDX-License-Identifier: GPL-2.0-only /* * Copyright (c) 2014-2019, The Linux Foundation. All rights reserved. * Copyright (c) 2014-2020, The Linux Foundation. All rights reserved. */ #include <linux/devfreq.h> Loading Loading @@ -45,6 +45,61 @@ static inline int devfreq_get_freq_level(struct devfreq *devfreq, return -EINVAL; } static ssize_t cur_ab_show(struct device *dev, struct device_attribute *attr, char *buf) { struct devfreq *df = to_devfreq(dev); struct msm_busmon_extended_profile *bus_profile = container_of( (df->profile), struct msm_busmon_extended_profile, profile); return scnprintf(buf, PAGE_SIZE, "%llu\n", bus_profile->ab_mbytes); } static ssize_t sampling_interval_show(struct device *dev, struct device_attribute *attr, char *buf) { struct devfreq *df = to_devfreq(dev); struct msm_busmon_extended_profile *bus_profile = container_of( (df->profile), struct msm_busmon_extended_profile, profile); return scnprintf(buf, PAGE_SIZE, "%d\n", bus_profile->sampling_ms); } static ssize_t sampling_interval_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { struct devfreq *df = to_devfreq(dev); struct msm_busmon_extended_profile *bus_profile = container_of( (df->profile), struct msm_busmon_extended_profile, profile); u32 value; int ret; ret = kstrtou32(buf, 0, &value); if (ret) return ret; bus_profile->sampling_ms = value; return count; } static DEVICE_ATTR_RW(sampling_interval); static DEVICE_ATTR_RO(cur_ab); static const struct device_attribute *gpubw_attr_list[] = { &dev_attr_sampling_interval, &dev_attr_cur_ab, NULL }; static int devfreq_gpubw_get_target(struct devfreq *df, unsigned long *freq) { Loading Loading @@ -87,7 +142,7 @@ static int devfreq_gpubw_get_target(struct devfreq *df, level = devfreq_get_freq_level(df, stats->current_frequency); if (priv->bus.total_time < LONG_FLOOR) if (priv->bus.total_time < bus_profile->sampling_ms) return result; norm_max_cycles = (unsigned int)(priv->bus.ram_time) / Loading Loading @@ -187,12 +242,21 @@ static int gpubw_start(struct devfreq *devfreq) priv->bus.p_up[priv->bus.num - 1] = 100; _update_cutoff(priv, priv->bus.max); bus_profile->sampling_ms = LONG_FLOOR; for (i = 0; gpubw_attr_list[i] != NULL; i++) device_create_file(&devfreq->dev, gpubw_attr_list[i]); return 0; } static int gpubw_stop(struct devfreq *devfreq) { struct devfreq_msm_adreno_tz_data *priv = devfreq->data; int i; for (i = 0; gpubw_attr_list[i] != NULL; i++) device_remove_file(&devfreq->dev, gpubw_attr_list[i]); if (priv) { kfree(priv->bus.up); Loading
include/linux/msm_adreno_devfreq.h +2 −1 Original line number Diff line number Diff line /* SPDX-License-Identifier: GPL-2.0 */ /* * Copyright (c) 2016-2019, The Linux Foundation. All rights reserved. * Copyright (c) 2016-2020, The Linux Foundation. All rights reserved. */ #ifndef MSM_ADRENO_DEVFREQ_H Loading Loading @@ -77,6 +77,7 @@ struct msm_adreno_extended_profile { struct msm_busmon_extended_profile { u32 flag; u32 sampling_ms; unsigned long percent_ab; unsigned long ab_mbytes; struct devfreq_msm_adreno_tz_data *private_data; Loading