diff mbox

PM / Domains: Add perf_state attribute to genpd debugfs

Message ID 20180530094517.24765-1-rnayak@codeaurora.org (mailing list archive)
State Not Applicable, archived
Headers show

Commit Message

Rajendra Nayak May 30, 2018, 9:45 a.m. UTC
Now that genpd supports performance states, add this additional
attribute as part of the power domains debugfs entry, to display
the current performance state for the Power domain.

Suggested-by: David Collins <collinsd@codeaurora.org>
Signed-off-by: Rajendra Nayak <rnayak@codeaurora.org>
---
 drivers/base/power/domain.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

Comments

Viresh Kumar May 30, 2018, 9:49 a.m. UTC | #1
On 30-05-18, 15:15, Rajendra Nayak wrote:
> Now that genpd supports performance states, add this additional
> attribute as part of the power domains debugfs entry, to display
> the current performance state for the Power domain.
> 
> Suggested-by: David Collins <collinsd@codeaurora.org>
> Signed-off-by: Rajendra Nayak <rnayak@codeaurora.org>
> ---
>  drivers/base/power/domain.c | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)

Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Ulf Hansson May 30, 2018, 11:35 a.m. UTC | #2
On 30 May 2018 at 11:45, Rajendra Nayak <rnayak@codeaurora.org> wrote:
> Now that genpd supports performance states, add this additional
> attribute as part of the power domains debugfs entry, to display
> the current performance state for the Power domain.
>
> Suggested-by: David Collins <collinsd@codeaurora.org>
> Signed-off-by: Rajendra Nayak <rnayak@codeaurora.org>

Acked-by: Ulf Hansson <ulf.hansson@linaro.org>

Kind regards
Uffe

> ---
>  drivers/base/power/domain.c | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
>
> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
> index ffeb6ea8d6eb..a02d793c8275 100644
> --- a/drivers/base/power/domain.c
> +++ b/drivers/base/power/domain.c
> @@ -2802,6 +2802,19 @@ static int genpd_devices_show(struct seq_file *s, void *data)
>         return ret;
>  }
>
> +static int genpd_perf_state_show(struct seq_file *s, void *data)
> +{
> +       struct generic_pm_domain *genpd = s->private;
> +
> +       if (genpd_lock_interruptible(genpd))
> +               return -ERESTARTSYS;
> +
> +       seq_printf(s, "%u\n", genpd->performance_state);
> +
> +       genpd_unlock(genpd);
> +       return 0;
> +}
> +
>  #define define_genpd_open_function(name) \
>  static int genpd_##name##_open(struct inode *inode, struct file *file) \
>  { \
> @@ -2815,6 +2828,7 @@ define_genpd_open_function(idle_states);
>  define_genpd_open_function(active_time);
>  define_genpd_open_function(total_idle_time);
>  define_genpd_open_function(devices);
> +define_genpd_open_function(perf_state);
>
>  #define define_genpd_debugfs_fops(name) \
>  static const struct file_operations genpd_##name##_fops = { \
> @@ -2831,6 +2845,7 @@ define_genpd_debugfs_fops(idle_states);
>  define_genpd_debugfs_fops(active_time);
>  define_genpd_debugfs_fops(total_idle_time);
>  define_genpd_debugfs_fops(devices);
> +define_genpd_debugfs_fops(perf_state);
>
>  static int __init genpd_debug_init(void)
>  {
> @@ -2864,6 +2879,9 @@ static int __init genpd_debug_init(void)
>                                 d, genpd, &genpd_total_idle_time_fops);
>                 debugfs_create_file("devices", 0444,
>                                 d, genpd, &genpd_devices_fops);
> +               if (genpd->set_performance_state)
> +                       debugfs_create_file("perf_state", 0444,
> +                                           d, genpd, &genpd_perf_state_fops);
>         }
>
>         return 0;
> --
> QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
> of Code Aurora Forum, hosted by The Linux Foundation
>
--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
index ffeb6ea8d6eb..a02d793c8275 100644
--- a/drivers/base/power/domain.c
+++ b/drivers/base/power/domain.c
@@ -2802,6 +2802,19 @@  static int genpd_devices_show(struct seq_file *s, void *data)
 	return ret;
 }
 
+static int genpd_perf_state_show(struct seq_file *s, void *data)
+{
+	struct generic_pm_domain *genpd = s->private;
+
+	if (genpd_lock_interruptible(genpd))
+		return -ERESTARTSYS;
+
+	seq_printf(s, "%u\n", genpd->performance_state);
+
+	genpd_unlock(genpd);
+	return 0;
+}
+
 #define define_genpd_open_function(name) \
 static int genpd_##name##_open(struct inode *inode, struct file *file) \
 { \
@@ -2815,6 +2828,7 @@  define_genpd_open_function(idle_states);
 define_genpd_open_function(active_time);
 define_genpd_open_function(total_idle_time);
 define_genpd_open_function(devices);
+define_genpd_open_function(perf_state);
 
 #define define_genpd_debugfs_fops(name) \
 static const struct file_operations genpd_##name##_fops = { \
@@ -2831,6 +2845,7 @@  define_genpd_debugfs_fops(idle_states);
 define_genpd_debugfs_fops(active_time);
 define_genpd_debugfs_fops(total_idle_time);
 define_genpd_debugfs_fops(devices);
+define_genpd_debugfs_fops(perf_state);
 
 static int __init genpd_debug_init(void)
 {
@@ -2864,6 +2879,9 @@  static int __init genpd_debug_init(void)
 				d, genpd, &genpd_total_idle_time_fops);
 		debugfs_create_file("devices", 0444,
 				d, genpd, &genpd_devices_fops);
+		if (genpd->set_performance_state)
+			debugfs_create_file("perf_state", 0444,
+					    d, genpd, &genpd_perf_state_fops);
 	}
 
 	return 0;