blob: 747861816f4f555fe251e615d43d8c615e89d123 [file] [log] [blame]
Thomas Gleixnerd2912cb2019-06-04 10:11:33 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Nishanth Menone1f60b22010-10-13 00:13:10 +02002/*
3 * Generic OPP Interface
4 *
5 * Copyright (C) 2009-2010 Texas Instruments Incorporated.
6 * Nishanth Menon
7 * Romit Dasgupta
8 * Kevin Hilman
Nishanth Menone1f60b22010-10-13 00:13:10 +02009 */
10
11#ifndef __LINUX_OPP_H__
12#define __LINUX_OPP_H__
13
14#include <linux/err.h>
MyungJoo Ham03ca3702011-09-30 22:35:12 +020015#include <linux/notifier.h>
Nishanth Menone1f60b22010-10-13 00:13:10 +020016
Viresh Kumar94735582016-12-01 16:28:20 +053017struct clk;
18struct regulator;
Nishanth Menon47d43ba2013-09-19 16:03:51 -050019struct dev_pm_opp;
Paul Gortmaker313162d2012-01-30 11:46:54 -050020struct device;
Stephen Boyd91291d92016-11-30 16:21:25 +053021struct opp_table;
Nishanth Menone1f60b22010-10-13 00:13:10 +020022
Nishanth Menon47d43ba2013-09-19 16:03:51 -050023enum dev_pm_opp_event {
Viresh Kumar129eec52014-11-27 08:54:06 +053024 OPP_EVENT_ADD, OPP_EVENT_REMOVE, OPP_EVENT_ENABLE, OPP_EVENT_DISABLE,
Stephen Boyd25cb20a2019-10-16 16:57:53 +020025 OPP_EVENT_ADJUST_VOLTAGE,
MyungJoo Ham03ca3702011-09-30 22:35:12 +020026};
27
Viresh Kumar0f0fe7e2016-12-01 16:28:17 +053028/**
29 * struct dev_pm_opp_supply - Power supply voltage/current values
30 * @u_volt: Target voltage in microvolts corresponding to this OPP
31 * @u_volt_min: Minimum voltage in microvolts corresponding to this OPP
32 * @u_volt_max: Maximum voltage in microvolts corresponding to this OPP
33 * @u_amp: Maximum current drawn by the device in microamperes
34 *
35 * This structure stores the voltage/current values for a single power supply.
36 */
37struct dev_pm_opp_supply {
38 unsigned long u_volt;
39 unsigned long u_volt_min;
40 unsigned long u_volt_max;
41 unsigned long u_amp;
42};
43
Viresh Kumar94735582016-12-01 16:28:20 +053044/**
45 * struct dev_pm_opp_info - OPP freq/voltage/current values
46 * @rate: Target clk rate in hz
47 * @supplies: Array of voltage/current values for all power supplies
48 *
49 * This structure stores the freq/voltage/current values for a single OPP.
50 */
51struct dev_pm_opp_info {
52 unsigned long rate;
53 struct dev_pm_opp_supply *supplies;
54};
55
56/**
57 * struct dev_pm_set_opp_data - Set OPP data
58 * @old_opp: Old OPP info
59 * @new_opp: New OPP info
60 * @regulators: Array of regulator pointers
61 * @regulator_count: Number of regulators
62 * @clk: Pointer to clk
63 * @dev: Pointer to the struct device
64 *
65 * This structure contains all information required for setting an OPP.
66 */
67struct dev_pm_set_opp_data {
68 struct dev_pm_opp_info old_opp;
69 struct dev_pm_opp_info new_opp;
70
71 struct regulator **regulators;
72 unsigned int regulator_count;
73 struct clk *clk;
74 struct device *dev;
75};
76
Nishanth Menone1f60b22010-10-13 00:13:10 +020077#if defined(CONFIG_PM_OPP)
78
Viresh Kumarf067a982017-01-23 10:11:42 +053079struct opp_table *dev_pm_opp_get_opp_table(struct device *dev);
Viresh Kumareb7c87432018-09-05 16:17:14 +053080struct opp_table *dev_pm_opp_get_opp_table_indexed(struct device *dev, int index);
Viresh Kumarf067a982017-01-23 10:11:42 +053081void dev_pm_opp_put_opp_table(struct opp_table *opp_table);
82
Nishanth Menon47d43ba2013-09-19 16:03:51 -050083unsigned long dev_pm_opp_get_voltage(struct dev_pm_opp *opp);
Nishanth Menone1f60b22010-10-13 00:13:10 +020084
Nishanth Menon47d43ba2013-09-19 16:03:51 -050085unsigned long dev_pm_opp_get_freq(struct dev_pm_opp *opp);
Nishanth Menone1f60b22010-10-13 00:13:10 +020086
Rajendra Nayak5b93ac52019-01-10 09:32:02 +053087unsigned int dev_pm_opp_get_level(struct dev_pm_opp *opp);
88
Bartlomiej Zolnierkiewicz19445b22015-07-09 17:43:35 +020089bool dev_pm_opp_is_turbo(struct dev_pm_opp *opp);
90
Nishanth Menon5d4879c2013-09-19 16:03:50 -050091int dev_pm_opp_get_opp_count(struct device *dev);
Viresh Kumar3ca9bb32015-07-29 16:23:03 +053092unsigned long dev_pm_opp_get_max_clock_latency(struct device *dev);
Viresh Kumar655c9df2016-02-09 10:30:35 +053093unsigned long dev_pm_opp_get_max_volt_latency(struct device *dev);
Viresh Kumar21743442016-02-09 10:30:36 +053094unsigned long dev_pm_opp_get_max_transition_latency(struct device *dev);
Viresh Kumar3aa26a32017-01-02 14:41:02 +053095unsigned long dev_pm_opp_get_suspend_opp_freq(struct device *dev);
Nishanth Menone1f60b22010-10-13 00:13:10 +020096
Nishanth Menon47d43ba2013-09-19 16:03:51 -050097struct dev_pm_opp *dev_pm_opp_find_freq_exact(struct device *dev,
98 unsigned long freq,
99 bool available);
Niklas Cassel71419d82019-07-25 12:41:29 +0200100struct dev_pm_opp *dev_pm_opp_find_level_exact(struct device *dev,
101 unsigned int level);
Nishanth Menone1f60b22010-10-13 00:13:10 +0200102
Nishanth Menon47d43ba2013-09-19 16:03:51 -0500103struct dev_pm_opp *dev_pm_opp_find_freq_floor(struct device *dev,
104 unsigned long *freq);
Andrew-sh.Cheng2f36bde2019-03-29 14:46:10 +0800105struct dev_pm_opp *dev_pm_opp_find_freq_ceil_by_volt(struct device *dev,
106 unsigned long u_volt);
Nishanth Menone1f60b22010-10-13 00:13:10 +0200107
Nishanth Menon47d43ba2013-09-19 16:03:51 -0500108struct dev_pm_opp *dev_pm_opp_find_freq_ceil(struct device *dev,
109 unsigned long *freq);
Viresh Kumar70347642017-01-23 10:11:46 +0530110void dev_pm_opp_put(struct dev_pm_opp *opp);
Nishanth Menone1f60b22010-10-13 00:13:10 +0200111
Nishanth Menon5d4879c2013-09-19 16:03:50 -0500112int dev_pm_opp_add(struct device *dev, unsigned long freq,
113 unsigned long u_volt);
Viresh Kumar129eec52014-11-27 08:54:06 +0530114void dev_pm_opp_remove(struct device *dev, unsigned long freq);
Viresh Kumar1690d8b2019-01-04 15:14:33 +0530115void dev_pm_opp_remove_all_dynamic(struct device *dev);
Nishanth Menone1f60b22010-10-13 00:13:10 +0200116
Stephen Boyd25cb20a2019-10-16 16:57:53 +0200117int dev_pm_opp_adjust_voltage(struct device *dev, unsigned long freq,
118 unsigned long u_volt, unsigned long u_volt_min,
119 unsigned long u_volt_max);
120
Nishanth Menon5d4879c2013-09-19 16:03:50 -0500121int dev_pm_opp_enable(struct device *dev, unsigned long freq);
Nishanth Menone1f60b22010-10-13 00:13:10 +0200122
Nishanth Menon5d4879c2013-09-19 16:03:50 -0500123int dev_pm_opp_disable(struct device *dev, unsigned long freq);
Nishanth Menone1f60b22010-10-13 00:13:10 +0200124
Viresh Kumardc2c9ad2017-01-02 14:41:03 +0530125int dev_pm_opp_register_notifier(struct device *dev, struct notifier_block *nb);
126int dev_pm_opp_unregister_notifier(struct device *dev, struct notifier_block *nb);
127
Viresh Kumarfa301842017-01-23 10:11:43 +0530128struct opp_table *dev_pm_opp_set_supported_hw(struct device *dev, const u32 *versions, unsigned int count);
129void dev_pm_opp_put_supported_hw(struct opp_table *opp_table);
130struct opp_table *dev_pm_opp_set_prop_name(struct device *dev, const char *name);
131void dev_pm_opp_put_prop_name(struct opp_table *opp_table);
Viresh Kumardfbe4672016-12-01 16:28:19 +0530132struct opp_table *dev_pm_opp_set_regulators(struct device *dev, const char * const names[], unsigned int count);
133void dev_pm_opp_put_regulators(struct opp_table *opp_table);
Viresh Kumar829a4e82017-06-21 10:29:13 +0530134struct opp_table *dev_pm_opp_set_clkname(struct device *dev, const char * name);
135void dev_pm_opp_put_clkname(struct opp_table *opp_table);
Viresh Kumarfa301842017-01-23 10:11:43 +0530136struct opp_table *dev_pm_opp_register_set_opp_helper(struct device *dev, int (*set_opp)(struct dev_pm_set_opp_data *data));
Viresh Kumar604a7ae2017-10-05 17:26:21 +0530137void dev_pm_opp_unregister_set_opp_helper(struct opp_table *opp_table);
Viresh Kumar17a8f862019-07-08 11:24:56 +0530138struct opp_table *dev_pm_opp_attach_genpd(struct device *dev, const char **names, struct device ***virt_devs);
Viresh Kumar6319aee2019-05-08 15:19:13 +0530139void dev_pm_opp_detach_genpd(struct opp_table *opp_table);
Viresh Kumarc8a59102018-11-02 14:36:42 +0530140int dev_pm_opp_xlate_performance_state(struct opp_table *src_table, struct opp_table *dst_table, unsigned int pstate);
Viresh Kumar6a0712f2016-02-09 10:30:39 +0530141int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq);
Arnd Bergmannddbb74b2016-04-30 13:33:29 +0200142int dev_pm_opp_set_sharing_cpus(struct device *cpu_dev, const struct cpumask *cpumask);
143int dev_pm_opp_get_sharing_cpus(struct device *cpu_dev, struct cpumask *cpumask);
Sudeep Holla411466c2016-05-03 15:05:04 +0100144void dev_pm_opp_remove_table(struct device *dev);
145void dev_pm_opp_cpumask_remove_table(const struct cpumask *cpumask);
Nishanth Menone1f60b22010-10-13 00:13:10 +0200146#else
Viresh Kumarf067a982017-01-23 10:11:42 +0530147static inline struct opp_table *dev_pm_opp_get_opp_table(struct device *dev)
148{
149 return ERR_PTR(-ENOTSUPP);
150}
151
Viresh Kumareb7c87432018-09-05 16:17:14 +0530152static inline struct opp_table *dev_pm_opp_get_opp_table_indexed(struct device *dev, int index)
153{
154 return ERR_PTR(-ENOTSUPP);
155}
156
Viresh Kumarf067a982017-01-23 10:11:42 +0530157static inline void dev_pm_opp_put_opp_table(struct opp_table *opp_table) {}
158
Nishanth Menon47d43ba2013-09-19 16:03:51 -0500159static inline unsigned long dev_pm_opp_get_voltage(struct dev_pm_opp *opp)
Nishanth Menone1f60b22010-10-13 00:13:10 +0200160{
161 return 0;
162}
163
Nishanth Menon47d43ba2013-09-19 16:03:51 -0500164static inline unsigned long dev_pm_opp_get_freq(struct dev_pm_opp *opp)
Nishanth Menone1f60b22010-10-13 00:13:10 +0200165{
166 return 0;
167}
168
Rajendra Nayak5b93ac52019-01-10 09:32:02 +0530169static inline unsigned int dev_pm_opp_get_level(struct dev_pm_opp *opp)
170{
171 return 0;
172}
173
Bartlomiej Zolnierkiewicz19445b22015-07-09 17:43:35 +0200174static inline bool dev_pm_opp_is_turbo(struct dev_pm_opp *opp)
175{
176 return false;
177}
178
Nishanth Menon5d4879c2013-09-19 16:03:50 -0500179static inline int dev_pm_opp_get_opp_count(struct device *dev)
Nishanth Menone1f60b22010-10-13 00:13:10 +0200180{
181 return 0;
182}
183
Viresh Kumar3ca9bb32015-07-29 16:23:03 +0530184static inline unsigned long dev_pm_opp_get_max_clock_latency(struct device *dev)
185{
186 return 0;
187}
188
Viresh Kumar655c9df2016-02-09 10:30:35 +0530189static inline unsigned long dev_pm_opp_get_max_volt_latency(struct device *dev)
190{
191 return 0;
192}
193
Viresh Kumar21743442016-02-09 10:30:36 +0530194static inline unsigned long dev_pm_opp_get_max_transition_latency(struct device *dev)
195{
196 return 0;
197}
198
Viresh Kumar3aa26a32017-01-02 14:41:02 +0530199static inline unsigned long dev_pm_opp_get_suspend_opp_freq(struct device *dev)
Bartlomiej Zolnierkiewicz4eafbd12015-09-08 18:41:01 +0200200{
Viresh Kumar3aa26a32017-01-02 14:41:02 +0530201 return 0;
Bartlomiej Zolnierkiewicz4eafbd12015-09-08 18:41:01 +0200202}
203
Nishanth Menon47d43ba2013-09-19 16:03:51 -0500204static inline struct dev_pm_opp *dev_pm_opp_find_freq_exact(struct device *dev,
Nishanth Menone1f60b22010-10-13 00:13:10 +0200205 unsigned long freq, bool available)
206{
Viresh Kumard708b3842016-04-27 08:52:21 +0530207 return ERR_PTR(-ENOTSUPP);
Nishanth Menone1f60b22010-10-13 00:13:10 +0200208}
209
Niklas Cassel71419d82019-07-25 12:41:29 +0200210static inline struct dev_pm_opp *dev_pm_opp_find_level_exact(struct device *dev,
211 unsigned int level)
212{
213 return ERR_PTR(-ENOTSUPP);
214}
215
Nishanth Menon47d43ba2013-09-19 16:03:51 -0500216static inline struct dev_pm_opp *dev_pm_opp_find_freq_floor(struct device *dev,
Nishanth Menone1f60b22010-10-13 00:13:10 +0200217 unsigned long *freq)
218{
Viresh Kumard708b3842016-04-27 08:52:21 +0530219 return ERR_PTR(-ENOTSUPP);
Nishanth Menone1f60b22010-10-13 00:13:10 +0200220}
221
Andrew-sh.Cheng2f36bde2019-03-29 14:46:10 +0800222static inline struct dev_pm_opp *dev_pm_opp_find_freq_ceil_by_volt(struct device *dev,
223 unsigned long u_volt)
224{
225 return ERR_PTR(-ENOTSUPP);
226}
227
Nishanth Menon47d43ba2013-09-19 16:03:51 -0500228static inline struct dev_pm_opp *dev_pm_opp_find_freq_ceil(struct device *dev,
Nishanth Menone1f60b22010-10-13 00:13:10 +0200229 unsigned long *freq)
230{
Viresh Kumard708b3842016-04-27 08:52:21 +0530231 return ERR_PTR(-ENOTSUPP);
Nishanth Menone1f60b22010-10-13 00:13:10 +0200232}
233
Viresh Kumar70347642017-01-23 10:11:46 +0530234static inline void dev_pm_opp_put(struct dev_pm_opp *opp) {}
235
Nishanth Menon5d4879c2013-09-19 16:03:50 -0500236static inline int dev_pm_opp_add(struct device *dev, unsigned long freq,
Nishanth Menone1f60b22010-10-13 00:13:10 +0200237 unsigned long u_volt)
238{
Viresh Kumard708b3842016-04-27 08:52:21 +0530239 return -ENOTSUPP;
Nishanth Menone1f60b22010-10-13 00:13:10 +0200240}
241
Viresh Kumar129eec52014-11-27 08:54:06 +0530242static inline void dev_pm_opp_remove(struct device *dev, unsigned long freq)
243{
244}
245
Viresh Kumar1690d8b2019-01-04 15:14:33 +0530246static inline void dev_pm_opp_remove_all_dynamic(struct device *dev)
247{
248}
249
Stephen Boyd25cb20a2019-10-16 16:57:53 +0200250static inline int
251dev_pm_opp_adjust_voltage(struct device *dev, unsigned long freq,
252 unsigned long u_volt, unsigned long u_volt_min,
253 unsigned long u_volt_max)
254{
255 return 0;
256}
257
Nishanth Menon5d4879c2013-09-19 16:03:50 -0500258static inline int dev_pm_opp_enable(struct device *dev, unsigned long freq)
Nishanth Menone1f60b22010-10-13 00:13:10 +0200259{
260 return 0;
261}
262
Nishanth Menon5d4879c2013-09-19 16:03:50 -0500263static inline int dev_pm_opp_disable(struct device *dev, unsigned long freq)
Nishanth Menone1f60b22010-10-13 00:13:10 +0200264{
265 return 0;
266}
MyungJoo Ham03ca3702011-09-30 22:35:12 +0200267
Viresh Kumardc2c9ad2017-01-02 14:41:03 +0530268static inline int dev_pm_opp_register_notifier(struct device *dev, struct notifier_block *nb)
MyungJoo Ham03ca3702011-09-30 22:35:12 +0200269{
Viresh Kumardc2c9ad2017-01-02 14:41:03 +0530270 return -ENOTSUPP;
271}
272
273static inline int dev_pm_opp_unregister_notifier(struct device *dev, struct notifier_block *nb)
274{
275 return -ENOTSUPP;
MyungJoo Ham03ca3702011-09-30 22:35:12 +0200276}
Viresh Kumar7de36b02015-12-09 08:01:46 +0530277
Viresh Kumarfa301842017-01-23 10:11:43 +0530278static inline struct opp_table *dev_pm_opp_set_supported_hw(struct device *dev,
279 const u32 *versions,
280 unsigned int count)
Viresh Kumar7de36b02015-12-09 08:01:46 +0530281{
Viresh Kumarfa301842017-01-23 10:11:43 +0530282 return ERR_PTR(-ENOTSUPP);
Viresh Kumar7de36b02015-12-09 08:01:46 +0530283}
284
Viresh Kumarfa301842017-01-23 10:11:43 +0530285static inline void dev_pm_opp_put_supported_hw(struct opp_table *opp_table) {}
Viresh Kumar7de36b02015-12-09 08:01:46 +0530286
Viresh Kumarfa301842017-01-23 10:11:43 +0530287static inline struct opp_table *dev_pm_opp_register_set_opp_helper(struct device *dev,
Viresh Kumar4dab1602016-12-01 16:28:21 +0530288 int (*set_opp)(struct dev_pm_set_opp_data *data))
289{
Viresh Kumarfa301842017-01-23 10:11:43 +0530290 return ERR_PTR(-ENOTSUPP);
Viresh Kumar4dab1602016-12-01 16:28:21 +0530291}
292
Viresh Kumar604a7ae2017-10-05 17:26:21 +0530293static inline void dev_pm_opp_unregister_set_opp_helper(struct opp_table *opp_table) {}
Viresh Kumar4dab1602016-12-01 16:28:21 +0530294
Viresh Kumarfa301842017-01-23 10:11:43 +0530295static inline struct opp_table *dev_pm_opp_set_prop_name(struct device *dev, const char *name)
Viresh Kumar01fb4d32015-12-09 08:01:47 +0530296{
Viresh Kumarfa301842017-01-23 10:11:43 +0530297 return ERR_PTR(-ENOTSUPP);
Viresh Kumar01fb4d32015-12-09 08:01:47 +0530298}
299
Viresh Kumarfa301842017-01-23 10:11:43 +0530300static inline void dev_pm_opp_put_prop_name(struct opp_table *opp_table) {}
Viresh Kumar01fb4d32015-12-09 08:01:47 +0530301
Viresh Kumardfbe4672016-12-01 16:28:19 +0530302static inline struct opp_table *dev_pm_opp_set_regulators(struct device *dev, const char * const names[], unsigned int count)
Viresh Kumar9f8ea962016-02-09 10:30:33 +0530303{
Stephen Boyd91291d92016-11-30 16:21:25 +0530304 return ERR_PTR(-ENOTSUPP);
Viresh Kumar9f8ea962016-02-09 10:30:33 +0530305}
306
Viresh Kumardfbe4672016-12-01 16:28:19 +0530307static inline void dev_pm_opp_put_regulators(struct opp_table *opp_table) {}
Viresh Kumar9f8ea962016-02-09 10:30:33 +0530308
Viresh Kumar829a4e82017-06-21 10:29:13 +0530309static inline struct opp_table *dev_pm_opp_set_clkname(struct device *dev, const char * name)
310{
311 return ERR_PTR(-ENOTSUPP);
312}
313
314static inline void dev_pm_opp_put_clkname(struct opp_table *opp_table) {}
315
Viresh Kumar17a8f862019-07-08 11:24:56 +0530316static inline struct opp_table *dev_pm_opp_attach_genpd(struct device *dev, const char **names, struct device ***virt_devs)
Viresh Kumar4f018bc2018-06-26 16:29:34 +0530317{
318 return ERR_PTR(-ENOTSUPP);
319}
320
Viresh Kumar6319aee2019-05-08 15:19:13 +0530321static inline void dev_pm_opp_detach_genpd(struct opp_table *opp_table) {}
Viresh Kumarc8a59102018-11-02 14:36:42 +0530322
323static inline int dev_pm_opp_xlate_performance_state(struct opp_table *src_table, struct opp_table *dst_table, unsigned int pstate)
324{
325 return -ENOTSUPP;
326}
327
Viresh Kumar6a0712f2016-02-09 10:30:39 +0530328static inline int dev_pm_opp_set_rate(struct device *dev, unsigned long target_freq)
329{
Viresh Kumard708b3842016-04-27 08:52:21 +0530330 return -ENOTSUPP;
Viresh Kumar6a0712f2016-02-09 10:30:39 +0530331}
332
Arnd Bergmannddbb74b2016-04-30 13:33:29 +0200333static inline int dev_pm_opp_set_sharing_cpus(struct device *cpu_dev, const struct cpumask *cpumask)
Viresh Kumar642aa8c2016-04-21 14:28:55 +0530334{
Viresh Kumard708b3842016-04-27 08:52:21 +0530335 return -ENOTSUPP;
Viresh Kumar642aa8c2016-04-21 14:28:55 +0530336}
337
Arnd Bergmannddbb74b2016-04-30 13:33:29 +0200338static inline int dev_pm_opp_get_sharing_cpus(struct device *cpu_dev, struct cpumask *cpumask)
Viresh Kumar6f707da2016-04-27 08:52:23 +0530339{
340 return -EINVAL;
341}
342
Sudeep Holla411466c2016-05-03 15:05:04 +0100343static inline void dev_pm_opp_remove_table(struct device *dev)
344{
345}
346
347static inline void dev_pm_opp_cpumask_remove_table(const struct cpumask *cpumask)
348{
349}
350
Tony Lindgrena96d69d2011-11-03 10:12:27 +0100351#endif /* CONFIG_PM_OPP */
Nishanth Menone1f60b22010-10-13 00:13:10 +0200352
Shawn Guod6561bb2013-02-21 11:04:45 +0000353#if defined(CONFIG_PM_OPP) && defined(CONFIG_OF)
Viresh Kumar8f8d37b2015-09-04 13:47:24 +0530354int dev_pm_opp_of_add_table(struct device *dev);
Viresh Kumarfa9b2742017-04-26 10:45:46 +0530355int dev_pm_opp_of_add_table_indexed(struct device *dev, int index);
Viresh Kumar8f8d37b2015-09-04 13:47:24 +0530356void dev_pm_opp_of_remove_table(struct device *dev);
Arnd Bergmannddbb74b2016-04-30 13:33:29 +0200357int dev_pm_opp_of_cpumask_add_table(const struct cpumask *cpumask);
358void dev_pm_opp_of_cpumask_remove_table(const struct cpumask *cpumask);
359int dev_pm_opp_of_get_sharing_cpus(struct device *cpu_dev, struct cpumask *cpumask);
Dave Gerlach0764c602017-02-03 11:29:26 -0600360struct device_node *dev_pm_opp_of_get_opp_desc_node(struct device *dev);
Viresh Kumare2f4b5f2018-01-12 10:03:45 +0530361struct device_node *dev_pm_opp_get_of_node(struct dev_pm_opp *opp);
Viresh Kumar2feb5a82018-12-14 15:20:56 +0530362int of_get_required_opp_performance_state(struct device_node *np, int index);
Quentin Perreta4f342b2019-02-04 11:09:48 +0000363void dev_pm_opp_of_register_em(struct cpumask *cpus);
Shawn Guod6561bb2013-02-21 11:04:45 +0000364#else
Viresh Kumar8f8d37b2015-09-04 13:47:24 +0530365static inline int dev_pm_opp_of_add_table(struct device *dev)
Shawn Guod6561bb2013-02-21 11:04:45 +0000366{
Viresh Kumard708b3842016-04-27 08:52:21 +0530367 return -ENOTSUPP;
Shawn Guod6561bb2013-02-21 11:04:45 +0000368}
Viresh Kumar129eec52014-11-27 08:54:06 +0530369
Viresh Kumarfa9b2742017-04-26 10:45:46 +0530370static inline int dev_pm_opp_of_add_table_indexed(struct device *dev, int index)
371{
372 return -ENOTSUPP;
373}
374
Viresh Kumar8f8d37b2015-09-04 13:47:24 +0530375static inline void dev_pm_opp_of_remove_table(struct device *dev)
Viresh Kumar129eec52014-11-27 08:54:06 +0530376{
377}
Viresh Kumar8d4d4e92015-06-12 17:10:38 +0530378
Arnd Bergmannddbb74b2016-04-30 13:33:29 +0200379static inline int dev_pm_opp_of_cpumask_add_table(const struct cpumask *cpumask)
Viresh Kumar8d4d4e92015-06-12 17:10:38 +0530380{
Viresh Kumard708b3842016-04-27 08:52:21 +0530381 return -ENOTSUPP;
Viresh Kumar8d4d4e92015-06-12 17:10:38 +0530382}
383
Arnd Bergmannddbb74b2016-04-30 13:33:29 +0200384static inline void dev_pm_opp_of_cpumask_remove_table(const struct cpumask *cpumask)
Viresh Kumar8d4d4e92015-06-12 17:10:38 +0530385{
386}
387
Arnd Bergmannddbb74b2016-04-30 13:33:29 +0200388static inline int dev_pm_opp_of_get_sharing_cpus(struct device *cpu_dev, struct cpumask *cpumask)
Viresh Kumar8d4d4e92015-06-12 17:10:38 +0530389{
Viresh Kumard708b3842016-04-27 08:52:21 +0530390 return -ENOTSUPP;
Viresh Kumar8d4d4e92015-06-12 17:10:38 +0530391}
Dave Gerlach0764c602017-02-03 11:29:26 -0600392
393static inline struct device_node *dev_pm_opp_of_get_opp_desc_node(struct device *dev)
394{
395 return NULL;
396}
Viresh Kumara88bd2a2017-11-29 15:18:36 +0530397
Viresh Kumare2f4b5f2018-01-12 10:03:45 +0530398static inline struct device_node *dev_pm_opp_get_of_node(struct dev_pm_opp *opp)
399{
400 return NULL;
401}
Quentin Perreta4f342b2019-02-04 11:09:48 +0000402
403static inline void dev_pm_opp_of_register_em(struct cpumask *cpus)
404{
405}
406
Viresh Kumar2feb5a82018-12-14 15:20:56 +0530407static inline int of_get_required_opp_performance_state(struct device_node *np, int index)
Viresh Kumar4c6a3432018-06-27 16:29:50 +0530408{
Viresh Kumar2feb5a82018-12-14 15:20:56 +0530409 return -ENOTSUPP;
Viresh Kumar4c6a3432018-06-27 16:29:50 +0530410}
Shawn Guod6561bb2013-02-21 11:04:45 +0000411#endif
412
Nishanth Menone1f60b22010-10-13 00:13:10 +0200413#endif /* __LINUX_OPP_H__ */