Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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/

authored by

Dmitry Baryshkov and committed by
Chanwoo Choi
447c4e83 6146a0f1

+37 -39
+1 -1
drivers/devfreq/devfreq.c
··· 20 20 #include <linux/stat.h> 21 21 #include <linux/pm_opp.h> 22 22 #include <linux/devfreq.h> 23 + #include <linux/devfreq-governor.h> 23 24 #include <linux/workqueue.h> 24 25 #include <linux/platform_device.h> 25 26 #include <linux/list.h> ··· 29 28 #include <linux/of.h> 30 29 #include <linux/pm_qos.h> 31 30 #include <linux/units.h> 32 - #include "governor.h" 33 31 34 32 #define CREATE_TRACE_POINTS 35 33 #include <trace/events/devfreq.h>
+4 -29
drivers/devfreq/governor.h include/linux/devfreq-governor.h
··· 5 5 * Copyright (C) 2011 Samsung Electronics 6 6 * MyungJoo Ham <myungjoo.ham@samsung.com> 7 7 * 8 - * This header is for devfreq governors in drivers/devfreq/ 8 + * This header is for devfreq governors 9 9 */ 10 10 11 - #ifndef _GOVERNOR_H 12 - #define _GOVERNOR_H 11 + #ifndef __LINUX_DEVFREQ_DEVFREQ_H__ 12 + #define __LINUX_DEVFREQ_DEVFREQ_H__ 13 13 14 14 #include <linux/devfreq.h> 15 15 ··· 46 46 */ 47 47 #define DEVFREQ_GOV_ATTR_POLLING_INTERVAL BIT(0) 48 48 #define DEVFREQ_GOV_ATTR_TIMER BIT(1) 49 - 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 49 75 50 /** 76 51 * struct devfreq_governor - Devfreq policy governor ··· 99 124 100 125 return df->profile->get_dev_status(df->dev.parent, &df->last_status); 101 126 } 102 - #endif /* _GOVERNOR_H */ 127 + #endif /* __LINUX_DEVFREQ_DEVFREQ_H__ */
+26 -1
drivers/devfreq/governor_passive.c
··· 14 14 #include <linux/slab.h> 15 15 #include <linux/device.h> 16 16 #include <linux/devfreq.h> 17 + #include <linux/devfreq-governor.h> 17 18 #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 + }; 19 44 20 45 static struct devfreq_cpu_data * 21 46 get_parent_cpu_data(struct devfreq_passive_data *p_data,
+1 -1
drivers/devfreq/governor_performance.c
··· 7 7 */ 8 8 9 9 #include <linux/devfreq.h> 10 + #include <linux/devfreq-governor.h> 10 11 #include <linux/module.h> 11 - #include "governor.h" 12 12 13 13 static int devfreq_performance_func(struct devfreq *df, 14 14 unsigned long *freq)
+1 -1
drivers/devfreq/governor_powersave.c
··· 7 7 */ 8 8 9 9 #include <linux/devfreq.h> 10 + #include <linux/devfreq-governor.h> 10 11 #include <linux/module.h> 11 - #include "governor.h" 12 12 13 13 static int devfreq_powersave_func(struct devfreq *df, 14 14 unsigned long *freq)
+1 -1
drivers/devfreq/governor_simpleondemand.c
··· 9 9 #include <linux/errno.h> 10 10 #include <linux/module.h> 11 11 #include <linux/devfreq.h> 12 + #include <linux/devfreq-governor.h> 12 13 #include <linux/math64.h> 13 - #include "governor.h" 14 14 15 15 /* Default constants for DevFreq-Simple-Ondemand (DFSO) */ 16 16 #define DFSO_UPTHRESHOLD (90)
+1 -1
drivers/devfreq/governor_userspace.c
··· 9 9 #include <linux/slab.h> 10 10 #include <linux/device.h> 11 11 #include <linux/devfreq.h> 12 + #include <linux/devfreq-governor.h> 12 13 #include <linux/kstrtox.h> 13 14 #include <linux/pm.h> 14 15 #include <linux/mutex.h> 15 16 #include <linux/module.h> 16 - #include "governor.h" 17 17 18 18 struct userspace_data { 19 19 unsigned long user_frequency;
+1 -2
drivers/devfreq/hisi_uncore_freq.c
··· 9 9 #include <linux/bits.h> 10 10 #include <linux/cleanup.h> 11 11 #include <linux/devfreq.h> 12 + #include <linux/devfreq-governor.h> 12 13 #include <linux/device.h> 13 14 #include <linux/dev_printk.h> 14 15 #include <linux/errno.h> ··· 26 25 #include <linux/topology.h> 27 26 #include <linux/units.h> 28 27 #include <acpi/pcc.h> 29 - 30 - #include "governor.h" 31 28 32 29 struct hisi_uncore_pcc_data { 33 30 u16 status;
+1 -2
drivers/devfreq/tegra30-devfreq.c
··· 9 9 #include <linux/clk.h> 10 10 #include <linux/cpufreq.h> 11 11 #include <linux/devfreq.h> 12 + #include <linux/devfreq-governor.h> 12 13 #include <linux/interrupt.h> 13 14 #include <linux/io.h> 14 15 #include <linux/irq.h> ··· 21 20 #include <linux/workqueue.h> 22 21 23 22 #include <soc/tegra/fuse.h> 24 - 25 - #include "governor.h" 26 23 27 24 #define ACTMON_GLB_STATUS 0x0 28 25 #define ACTMON_GLB_PERIOD_CTRL 0x4