Loading drivers/gpu/msm/governor_msm_adreno_tz.c +38 −0 Original line number Original line Diff line number Diff line Loading @@ -130,13 +130,42 @@ static ssize_t suspend_time_show(struct device *dev, return snprintf(buf, PAGE_SIZE, "%llu\n", time_diff); return snprintf(buf, PAGE_SIZE, "%llu\n", time_diff); } } static ssize_t mod_percent_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { int ret; unsigned int val; struct devfreq *devfreq = to_devfreq(dev); struct devfreq_msm_adreno_tz_data *priv = devfreq->data; ret = kstrtou32(buf, 0, &val); if (ret) return ret; priv->mod_percent = clamp_t(u32, val, 10, 1000); return count; } static ssize_t mod_percent_show(struct device *dev, struct device_attribute *attr, char *buf) { struct devfreq *devfreq = to_devfreq(dev); struct devfreq_msm_adreno_tz_data *priv = devfreq->data; return scnprintf(buf, PAGE_SIZE, "%u\n", priv->mod_percent); } static DEVICE_ATTR_RO(gpu_load); static DEVICE_ATTR_RO(gpu_load); static DEVICE_ATTR_RO(suspend_time); static DEVICE_ATTR_RO(suspend_time); static DEVICE_ATTR_RW(mod_percent); static const struct device_attribute *adreno_tz_attr_list[] = { static const struct device_attribute *adreno_tz_attr_list[] = { &dev_attr_gpu_load, &dev_attr_gpu_load, &dev_attr_suspend_time, &dev_attr_suspend_time, &dev_attr_mod_percent, NULL NULL }; }; Loading Loading @@ -327,6 +356,7 @@ static int tz_get_target_freq(struct devfreq *devfreq, unsigned long *freq) struct devfreq_dev_status *stats = &devfreq->last_status; struct devfreq_dev_status *stats = &devfreq->last_status; int val, level = 0; int val, level = 0; int context_count = 0; int context_count = 0; u64 busy_time; /* keeps stats.private_data == NULL */ /* keeps stats.private_data == NULL */ result = devfreq_update_stats(devfreq); result = devfreq_update_stats(devfreq); Loading @@ -337,6 +367,14 @@ static int tz_get_target_freq(struct devfreq *devfreq, unsigned long *freq) *freq = stats->current_frequency; *freq = stats->current_frequency; priv->bin.total_time += stats->total_time; priv->bin.total_time += stats->total_time; /* Update gpu busy time as per mod_percent */ busy_time = stats->busy_time * priv->mod_percent; do_div(busy_time, 100); /* busy_time should not go over total_time */ stats->busy_time = min_t(u64, busy_time, stats->total_time); priv->bin.busy_time += stats->busy_time; priv->bin.busy_time += stats->busy_time; if (stats->private_data) if (stats->private_data) Loading drivers/gpu/msm/kgsl_pwrscale.c +1 −0 Original line number Original line Diff line number Diff line Loading @@ -16,6 +16,7 @@ static struct devfreq_msm_adreno_tz_data adreno_tz_data = { .max = 350, .max = 350, .floating = true, .floating = true, }, }, .mod_percent = 100, }; }; /** /** Loading drivers/gpu/msm/msm_adreno_devfreq.h +3 −1 Original line number Original line Diff line number Diff line /* SPDX-License-Identifier: GPL-2.0-only */ /* SPDX-License-Identifier: GPL-2.0-only */ /* /* * 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 #ifndef MSM_ADRENO_DEVFREQ_H Loading Loading @@ -61,6 +61,8 @@ struct devfreq_msm_adreno_tz_data { bool is_64; bool is_64; bool disable_busy_time_burst; bool disable_busy_time_burst; bool ctxt_aware_enable; bool ctxt_aware_enable; /* Multiplier to change gpu busy status */ u32 mod_percent; }; }; struct msm_adreno_extended_profile { struct msm_adreno_extended_profile { Loading Loading
drivers/gpu/msm/governor_msm_adreno_tz.c +38 −0 Original line number Original line Diff line number Diff line Loading @@ -130,13 +130,42 @@ static ssize_t suspend_time_show(struct device *dev, return snprintf(buf, PAGE_SIZE, "%llu\n", time_diff); return snprintf(buf, PAGE_SIZE, "%llu\n", time_diff); } } static ssize_t mod_percent_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { int ret; unsigned int val; struct devfreq *devfreq = to_devfreq(dev); struct devfreq_msm_adreno_tz_data *priv = devfreq->data; ret = kstrtou32(buf, 0, &val); if (ret) return ret; priv->mod_percent = clamp_t(u32, val, 10, 1000); return count; } static ssize_t mod_percent_show(struct device *dev, struct device_attribute *attr, char *buf) { struct devfreq *devfreq = to_devfreq(dev); struct devfreq_msm_adreno_tz_data *priv = devfreq->data; return scnprintf(buf, PAGE_SIZE, "%u\n", priv->mod_percent); } static DEVICE_ATTR_RO(gpu_load); static DEVICE_ATTR_RO(gpu_load); static DEVICE_ATTR_RO(suspend_time); static DEVICE_ATTR_RO(suspend_time); static DEVICE_ATTR_RW(mod_percent); static const struct device_attribute *adreno_tz_attr_list[] = { static const struct device_attribute *adreno_tz_attr_list[] = { &dev_attr_gpu_load, &dev_attr_gpu_load, &dev_attr_suspend_time, &dev_attr_suspend_time, &dev_attr_mod_percent, NULL NULL }; }; Loading Loading @@ -327,6 +356,7 @@ static int tz_get_target_freq(struct devfreq *devfreq, unsigned long *freq) struct devfreq_dev_status *stats = &devfreq->last_status; struct devfreq_dev_status *stats = &devfreq->last_status; int val, level = 0; int val, level = 0; int context_count = 0; int context_count = 0; u64 busy_time; /* keeps stats.private_data == NULL */ /* keeps stats.private_data == NULL */ result = devfreq_update_stats(devfreq); result = devfreq_update_stats(devfreq); Loading @@ -337,6 +367,14 @@ static int tz_get_target_freq(struct devfreq *devfreq, unsigned long *freq) *freq = stats->current_frequency; *freq = stats->current_frequency; priv->bin.total_time += stats->total_time; priv->bin.total_time += stats->total_time; /* Update gpu busy time as per mod_percent */ busy_time = stats->busy_time * priv->mod_percent; do_div(busy_time, 100); /* busy_time should not go over total_time */ stats->busy_time = min_t(u64, busy_time, stats->total_time); priv->bin.busy_time += stats->busy_time; priv->bin.busy_time += stats->busy_time; if (stats->private_data) if (stats->private_data) Loading
drivers/gpu/msm/kgsl_pwrscale.c +1 −0 Original line number Original line Diff line number Diff line Loading @@ -16,6 +16,7 @@ static struct devfreq_msm_adreno_tz_data adreno_tz_data = { .max = 350, .max = 350, .floating = true, .floating = true, }, }, .mod_percent = 100, }; }; /** /** Loading
drivers/gpu/msm/msm_adreno_devfreq.h +3 −1 Original line number Original line Diff line number Diff line /* SPDX-License-Identifier: GPL-2.0-only */ /* SPDX-License-Identifier: GPL-2.0-only */ /* /* * 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 #ifndef MSM_ADRENO_DEVFREQ_H Loading Loading @@ -61,6 +61,8 @@ struct devfreq_msm_adreno_tz_data { bool is_64; bool is_64; bool disable_busy_time_burst; bool disable_busy_time_burst; bool ctxt_aware_enable; bool ctxt_aware_enable; /* Multiplier to change gpu busy status */ u32 mod_percent; }; }; struct msm_adreno_extended_profile { struct msm_adreno_extended_profile { Loading