Skip to content

Commit 447c4e8

Browse files
lumagchanwoochoi
authored andcommitted
PM / devfreq: Move governor.h to a public header location
Some device drivers (and out-of-tree modules) might want to define device-specific device governors. Rather than restricting all of them to be a part of drivers/devfreq/ (which is not possible for out-of-tree drivers anyway) move governor.h to include/linux/devfreq-governor.h and update all drivers to use it. The devfreq_cpu_data is only used internally, by the passive governor, so it is moved to the driver source rather than being a part of the public interface. Reported-by: Robie Basak <robibasa@qti.qualcomm.com> Acked-by: Jon Hunter <jonathanh@nvidia.com> Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com> Reviewed-by: Bjorn Andersson <andersson@kernel.org> Acked-by: MyungJoo Ham <myungjoo.ham@samsung.com> Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com> Link: https://patchwork.kernel.org/project/linux-pm/patch/20251030-governor-public-v2-1-432a11a9975a@oss.qualcomm.com/
1 parent 6146a0f commit 447c4e8

9 files changed

Lines changed: 37 additions & 39 deletions

drivers/devfreq/devfreq.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
#include <linux/stat.h>
2121
#include <linux/pm_opp.h>
2222
#include <linux/devfreq.h>
23+
#include <linux/devfreq-governor.h>
2324
#include <linux/workqueue.h>
2425
#include <linux/platform_device.h>
2526
#include <linux/list.h>
@@ -28,7 +29,6 @@
2829
#include <linux/of.h>
2930
#include <linux/pm_qos.h>
3031
#include <linux/units.h>
31-
#include "governor.h"
3232

3333
#define CREATE_TRACE_POINTS
3434
#include <trace/events/devfreq.h>

drivers/devfreq/governor_passive.c

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,33 @@
1414
#include <linux/slab.h>
1515
#include <linux/device.h>
1616
#include <linux/devfreq.h>
17+
#include <linux/devfreq-governor.h>
1718
#include <linux/units.h>
18-
#include "governor.h"
19+
20+
/**
21+
* struct devfreq_cpu_data - Hold the per-cpu data
22+
* @node: list node
23+
* @dev: reference to cpu device.
24+
* @first_cpu: the cpumask of the first cpu of a policy.
25+
* @opp_table: reference to cpu opp table.
26+
* @cur_freq: the current frequency of the cpu.
27+
* @min_freq: the min frequency of the cpu.
28+
* @max_freq: the max frequency of the cpu.
29+
*
30+
* This structure stores the required cpu_data of a cpu.
31+
* This is auto-populated by the governor.
32+
*/
33+
struct devfreq_cpu_data {
34+
struct list_head node;
35+
36+
struct device *dev;
37+
unsigned int first_cpu;
38+
39+
struct opp_table *opp_table;
40+
unsigned int cur_freq;
41+
unsigned int min_freq;
42+
unsigned int max_freq;
43+
};
1944

2045
static struct devfreq_cpu_data *
2146
get_parent_cpu_data(struct devfreq_passive_data *p_data,

drivers/devfreq/governor_performance.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
*/
88

99
#include <linux/devfreq.h>
10+
#include <linux/devfreq-governor.h>
1011
#include <linux/module.h>
11-
#include "governor.h"
1212

1313
static int devfreq_performance_func(struct devfreq *df,
1414
unsigned long *freq)

drivers/devfreq/governor_powersave.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
*/
88

99
#include <linux/devfreq.h>
10+
#include <linux/devfreq-governor.h>
1011
#include <linux/module.h>
11-
#include "governor.h"
1212

1313
static int devfreq_powersave_func(struct devfreq *df,
1414
unsigned long *freq)

drivers/devfreq/governor_simpleondemand.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@
99
#include <linux/errno.h>
1010
#include <linux/module.h>
1111
#include <linux/devfreq.h>
12+
#include <linux/devfreq-governor.h>
1213
#include <linux/math64.h>
13-
#include "governor.h"
1414

1515
/* Default constants for DevFreq-Simple-Ondemand (DFSO) */
1616
#define DFSO_UPTHRESHOLD (90)

drivers/devfreq/governor_userspace.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
#include <linux/slab.h>
1010
#include <linux/device.h>
1111
#include <linux/devfreq.h>
12+
#include <linux/devfreq-governor.h>
1213
#include <linux/kstrtox.h>
1314
#include <linux/pm.h>
1415
#include <linux/mutex.h>
1516
#include <linux/module.h>
16-
#include "governor.h"
1717

1818
struct userspace_data {
1919
unsigned long user_frequency;

drivers/devfreq/hisi_uncore_freq.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <linux/bits.h>
1010
#include <linux/cleanup.h>
1111
#include <linux/devfreq.h>
12+
#include <linux/devfreq-governor.h>
1213
#include <linux/device.h>
1314
#include <linux/dev_printk.h>
1415
#include <linux/errno.h>
@@ -26,8 +27,6 @@
2627
#include <linux/units.h>
2728
#include <acpi/pcc.h>
2829

29-
#include "governor.h"
30-
3130
struct hisi_uncore_pcc_data {
3231
u16 status;
3332
u16 resv;

drivers/devfreq/tegra30-devfreq.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
#include <linux/clk.h>
1010
#include <linux/cpufreq.h>
1111
#include <linux/devfreq.h>
12+
#include <linux/devfreq-governor.h>
1213
#include <linux/interrupt.h>
1314
#include <linux/io.h>
1415
#include <linux/irq.h>
@@ -21,8 +22,6 @@
2122

2223
#include <soc/tegra/fuse.h>
2324

24-
#include "governor.h"
25-
2625
#define ACTMON_GLB_STATUS 0x0
2726
#define ACTMON_GLB_PERIOD_CTRL 0x4
2827

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
* Copyright (C) 2011 Samsung Electronics
66
* MyungJoo Ham <myungjoo.ham@samsung.com>
77
*
8-
* This header is for devfreq governors in drivers/devfreq/
8+
* This header is for devfreq governors
99
*/
1010

11-
#ifndef _GOVERNOR_H
12-
#define _GOVERNOR_H
11+
#ifndef __LINUX_DEVFREQ_DEVFREQ_H__
12+
#define __LINUX_DEVFREQ_DEVFREQ_H__
1313

1414
#include <linux/devfreq.h>
1515

@@ -47,31 +47,6 @@
4747
#define DEVFREQ_GOV_ATTR_POLLING_INTERVAL BIT(0)
4848
#define DEVFREQ_GOV_ATTR_TIMER BIT(1)
4949

50-
/**
51-
* struct devfreq_cpu_data - Hold the per-cpu data
52-
* @node: list node
53-
* @dev: reference to cpu device.
54-
* @first_cpu: the cpumask of the first cpu of a policy.
55-
* @opp_table: reference to cpu opp table.
56-
* @cur_freq: the current frequency of the cpu.
57-
* @min_freq: the min frequency of the cpu.
58-
* @max_freq: the max frequency of the cpu.
59-
*
60-
* This structure stores the required cpu_data of a cpu.
61-
* This is auto-populated by the governor.
62-
*/
63-
struct devfreq_cpu_data {
64-
struct list_head node;
65-
66-
struct device *dev;
67-
unsigned int first_cpu;
68-
69-
struct opp_table *opp_table;
70-
unsigned int cur_freq;
71-
unsigned int min_freq;
72-
unsigned int max_freq;
73-
};
74-
7550
/**
7651
* struct devfreq_governor - Devfreq policy governor
7752
* @node: list node - contains registered devfreq governors
@@ -124,4 +99,4 @@ static inline int devfreq_update_stats(struct devfreq *df)
12499

125100
return df->profile->get_dev_status(df->dev.parent, &df->last_status);
126101
}
127-
#endif /* _GOVERNOR_H */
102+
#endif /* __LINUX_DEVFREQ_DEVFREQ_H__ */

0 commit comments

Comments
 (0)