2019-06-04 11:11:33 +03:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2015-09-04 11:17:26 +03:00
|
|
|
/*
|
|
|
|
* Generic OPP Interface
|
|
|
|
*
|
|
|
|
* Copyright (C) 2009-2010 Texas Instruments Incorporated.
|
|
|
|
* Nishanth Menon
|
|
|
|
* Romit Dasgupta
|
|
|
|
* Kevin Hilman
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __DRIVER_OPP_H__
|
|
|
|
#define __DRIVER_OPP_H__
|
|
|
|
|
|
|
|
#include <linux/device.h>
|
|
|
|
#include <linux/kernel.h>
|
2017-01-23 07:41:46 +03:00
|
|
|
#include <linux/kref.h>
|
2015-09-04 11:17:26 +03:00
|
|
|
#include <linux/list.h>
|
2015-11-11 05:29:01 +03:00
|
|
|
#include <linux/limits.h>
|
2015-09-04 11:17:26 +03:00
|
|
|
#include <linux/pm_opp.h>
|
2017-01-23 07:41:49 +03:00
|
|
|
#include <linux/notifier.h>
|
2015-09-04 11:17:26 +03:00
|
|
|
|
2016-02-09 08:00:38 +03:00
|
|
|
struct clk;
|
2016-02-09 08:00:33 +03:00
|
|
|
struct regulator;
|
|
|
|
|
PM / OPP: Protect updates to list_dev with mutex
dev_opp_list_lock is used everywhere to protect device and OPP lists,
but dev_pm_opp_set_sharing_cpus() is missed somehow. And instead we used
rcu-lock, which wouldn't help here as we are adding a new list_dev.
This also fixes a problem where we have called kzalloc(..., GFP_KERNEL)
from within rcu-lock, which isn't allowed as kzalloc can sleep when
called with GFP_KERNEL.
With CONFIG_DEBUG_ATOMIC_SLEEP set, we get following lockdep-splat:
include/linux/rcupdate.h:578 Illegal context switch in RCU read-side critical section!
other info that might help us debug this:
rcu_scheduler_active = 1, debug_locks = 0
5 locks held by swapper/0/1:
#0: (&dev->mutex){......}, at: [<c02f68f4>] __driver_attach+0x48/0x98
#1: (&dev->mutex){......}, at: [<c02f6904>] __driver_attach+0x58/0x98
#2: (cpu_hotplug.lock){++++++}, at: [<c00249d0>] get_online_cpus+0x40/0xb0
#3: (subsys mutex#5){+.+.+.}, at: [<c02f4f8c>] subsys_interface_register+0x44/0xdc
#4: (rcu_read_lock){......}, at: [<c0305c80>] dev_pm_opp_set_sharing_cpus+0x0/0x1e4
stack backtrace:
CPU: 1 PID: 1 Comm: swapper/0 Tainted: G W 4.3.0-rc7-00047-g81f5932958a8 #59
Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
[<c0016874>] (unwind_backtrace) from [<c001355c>] (show_stack+0x10/0x14)
[<c001355c>] (show_stack) from [<c022553c>] (dump_stack+0x94/0xbc)
[<c022553c>] (dump_stack) from [<c004904c>] (___might_sleep+0x24c/0x298)
[<c004904c>] (___might_sleep) from [<c00f07e4>] (kmem_cache_alloc+0xe8/0x164)
[<c00f07e4>] (kmem_cache_alloc) from [<c0305354>] (_add_list_dev+0x30/0x58)
[<c0305354>] (_add_list_dev) from [<c0305d50>] (dev_pm_opp_set_sharing_cpus+0xd0/0x1e4)
[<c0305d50>] (dev_pm_opp_set_sharing_cpus) from [<c040eda4>] (cpufreq_init+0x4cc/0x62c)
[<c040eda4>] (cpufreq_init) from [<c040a964>] (cpufreq_online+0xbc/0x73c)
[<c040a964>] (cpufreq_online) from [<c02f4fe0>] (subsys_interface_register+0x98/0xdc)
[<c02f4fe0>] (subsys_interface_register) from [<c040a640>] (cpufreq_register_driver+0x110/0x17c)
[<c040a640>] (cpufreq_register_driver) from [<c040ef64>] (dt_cpufreq_probe+0x60/0x8c)
[<c040ef64>] (dt_cpufreq_probe) from [<c02f8084>] (platform_drv_probe+0x44/0xa4)
[<c02f8084>] (platform_drv_probe) from [<c02f67c0>] (driver_probe_device+0x208/0x2f4)
[<c02f67c0>] (driver_probe_device) from [<c02f6940>] (__driver_attach+0x94/0x98)
[<c02f6940>] (__driver_attach) from [<c02f4c1c>] (bus_for_each_dev+0x68/0x9c)
Reported-by: Michael Turquette <mturquette@baylibre.com>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Cc: 4.3 <stable@vger.kernel.org> # 4.3
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-11-05 11:51:19 +03:00
|
|
|
/* Lock to allow exclusive modification to the device and opp lists */
|
2016-02-16 11:47:53 +03:00
|
|
|
extern struct mutex opp_table_lock;
|
PM / OPP: Protect updates to list_dev with mutex
dev_opp_list_lock is used everywhere to protect device and OPP lists,
but dev_pm_opp_set_sharing_cpus() is missed somehow. And instead we used
rcu-lock, which wouldn't help here as we are adding a new list_dev.
This also fixes a problem where we have called kzalloc(..., GFP_KERNEL)
from within rcu-lock, which isn't allowed as kzalloc can sleep when
called with GFP_KERNEL.
With CONFIG_DEBUG_ATOMIC_SLEEP set, we get following lockdep-splat:
include/linux/rcupdate.h:578 Illegal context switch in RCU read-side critical section!
other info that might help us debug this:
rcu_scheduler_active = 1, debug_locks = 0
5 locks held by swapper/0/1:
#0: (&dev->mutex){......}, at: [<c02f68f4>] __driver_attach+0x48/0x98
#1: (&dev->mutex){......}, at: [<c02f6904>] __driver_attach+0x58/0x98
#2: (cpu_hotplug.lock){++++++}, at: [<c00249d0>] get_online_cpus+0x40/0xb0
#3: (subsys mutex#5){+.+.+.}, at: [<c02f4f8c>] subsys_interface_register+0x44/0xdc
#4: (rcu_read_lock){......}, at: [<c0305c80>] dev_pm_opp_set_sharing_cpus+0x0/0x1e4
stack backtrace:
CPU: 1 PID: 1 Comm: swapper/0 Tainted: G W 4.3.0-rc7-00047-g81f5932958a8 #59
Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
[<c0016874>] (unwind_backtrace) from [<c001355c>] (show_stack+0x10/0x14)
[<c001355c>] (show_stack) from [<c022553c>] (dump_stack+0x94/0xbc)
[<c022553c>] (dump_stack) from [<c004904c>] (___might_sleep+0x24c/0x298)
[<c004904c>] (___might_sleep) from [<c00f07e4>] (kmem_cache_alloc+0xe8/0x164)
[<c00f07e4>] (kmem_cache_alloc) from [<c0305354>] (_add_list_dev+0x30/0x58)
[<c0305354>] (_add_list_dev) from [<c0305d50>] (dev_pm_opp_set_sharing_cpus+0xd0/0x1e4)
[<c0305d50>] (dev_pm_opp_set_sharing_cpus) from [<c040eda4>] (cpufreq_init+0x4cc/0x62c)
[<c040eda4>] (cpufreq_init) from [<c040a964>] (cpufreq_online+0xbc/0x73c)
[<c040a964>] (cpufreq_online) from [<c02f4fe0>] (subsys_interface_register+0x98/0xdc)
[<c02f4fe0>] (subsys_interface_register) from [<c040a640>] (cpufreq_register_driver+0x110/0x17c)
[<c040a640>] (cpufreq_register_driver) from [<c040ef64>] (dt_cpufreq_probe+0x60/0x8c)
[<c040ef64>] (dt_cpufreq_probe) from [<c02f8084>] (platform_drv_probe+0x44/0xa4)
[<c02f8084>] (platform_drv_probe) from [<c02f67c0>] (driver_probe_device+0x208/0x2f4)
[<c02f67c0>] (driver_probe_device) from [<c02f6940>] (__driver_attach+0x94/0x98)
[<c02f6940>] (__driver_attach) from [<c02f4c1c>] (bus_for_each_dev+0x68/0x9c)
Reported-by: Michael Turquette <mturquette@baylibre.com>
Reviewed-by: Stephen Boyd <sboyd@codeaurora.org>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Cc: 4.3 <stable@vger.kernel.org> # 4.3
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2015-11-05 11:51:19 +03:00
|
|
|
|
2016-05-05 13:50:33 +03:00
|
|
|
extern struct list_head opp_tables;
|
|
|
|
|
2015-09-04 11:17:26 +03:00
|
|
|
/*
|
|
|
|
* Internal data structure organization with the OPP layer library is as
|
|
|
|
* follows:
|
2016-02-16 11:47:53 +03:00
|
|
|
* opp_tables (root)
|
2015-09-04 11:17:26 +03:00
|
|
|
* |- device 1 (represents voltage domain 1)
|
|
|
|
* | |- opp 1 (availability, freq, voltage)
|
|
|
|
* | |- opp 2 ..
|
|
|
|
* ... ...
|
|
|
|
* | `- opp n ..
|
|
|
|
* |- device 2 (represents the next voltage domain)
|
|
|
|
* ...
|
|
|
|
* `- device m (represents mth voltage domain)
|
2016-02-16 11:47:53 +03:00
|
|
|
* device 1, 2.. are represented by opp_table structure while each opp
|
2015-09-04 11:17:26 +03:00
|
|
|
* is represented by the opp structure.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* struct dev_pm_opp - Generic OPP description structure
|
2016-02-16 11:47:53 +03:00
|
|
|
* @node: opp table node. The nodes are maintained throughout the lifetime
|
2015-09-04 11:17:26 +03:00
|
|
|
* of boot. It is expected only an optimal set of OPPs are
|
|
|
|
* added to the library by the SoC framework.
|
|
|
|
* IMPORTANT: the opp nodes should be maintained in increasing
|
|
|
|
* order.
|
2017-01-23 07:41:46 +03:00
|
|
|
* @kref: for reference count of the OPP.
|
2015-09-04 11:17:26 +03:00
|
|
|
* @available: true/false - marks if this OPP as available or not
|
2015-11-19 06:43:56 +03:00
|
|
|
* @dynamic: not-created from static DT entries.
|
2015-09-04 11:17:26 +03:00
|
|
|
* @turbo: true if turbo (boost) OPP
|
2015-11-11 05:29:01 +03:00
|
|
|
* @suspend: true if suspend OPP
|
2017-10-11 10:24:14 +03:00
|
|
|
* @pstate: Device's power domain's performance state.
|
2015-09-04 11:17:26 +03:00
|
|
|
* @rate: Frequency in hertz
|
2019-01-10 07:02:02 +03:00
|
|
|
* @level: Performance level
|
2016-12-01 13:58:19 +03:00
|
|
|
* @supplies: Power supplies voltage/current values
|
2015-09-04 11:17:26 +03:00
|
|
|
* @clock_latency_ns: Latency (in nanoseconds) of switching to this OPP's
|
|
|
|
* frequency from any other OPP's frequency.
|
2018-06-07 12:20:43 +03:00
|
|
|
* @required_opps: List of OPPs that are required by this OPP.
|
2016-02-16 11:47:53 +03:00
|
|
|
* @opp_table: points back to the opp_table struct this opp belongs to
|
2015-09-04 11:17:26 +03:00
|
|
|
* @np: OPP's device node.
|
2015-11-11 05:29:01 +03:00
|
|
|
* @dentry: debugfs dentry pointer (per opp)
|
2015-09-04 11:17:26 +03:00
|
|
|
*
|
|
|
|
* This structure stores the OPP information for a given device.
|
|
|
|
*/
|
|
|
|
struct dev_pm_opp {
|
|
|
|
struct list_head node;
|
2017-01-23 07:41:46 +03:00
|
|
|
struct kref kref;
|
2015-09-04 11:17:26 +03:00
|
|
|
|
|
|
|
bool available;
|
|
|
|
bool dynamic;
|
|
|
|
bool turbo;
|
2015-11-11 05:29:01 +03:00
|
|
|
bool suspend;
|
2017-10-11 10:24:14 +03:00
|
|
|
unsigned int pstate;
|
2015-09-04 11:17:26 +03:00
|
|
|
unsigned long rate;
|
2019-01-10 07:02:02 +03:00
|
|
|
unsigned int level;
|
2015-09-04 11:17:26 +03:00
|
|
|
|
2016-12-01 13:58:19 +03:00
|
|
|
struct dev_pm_opp_supply *supplies;
|
2016-12-01 13:58:17 +03:00
|
|
|
|
2015-09-04 11:17:26 +03:00
|
|
|
unsigned long clock_latency_ns;
|
|
|
|
|
2018-06-07 12:20:43 +03:00
|
|
|
struct dev_pm_opp **required_opps;
|
2016-02-16 11:47:53 +03:00
|
|
|
struct opp_table *opp_table;
|
2015-09-04 11:17:26 +03:00
|
|
|
|
|
|
|
struct device_node *np;
|
2015-11-11 05:29:01 +03:00
|
|
|
|
|
|
|
#ifdef CONFIG_DEBUG_FS
|
|
|
|
struct dentry *dentry;
|
|
|
|
#endif
|
2015-09-04 11:17:26 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2016-02-16 11:47:53 +03:00
|
|
|
* struct opp_device - devices managed by 'struct opp_table'
|
2015-09-04 11:17:26 +03:00
|
|
|
* @node: list node
|
|
|
|
* @dev: device to which the struct object belongs
|
2015-11-11 05:29:01 +03:00
|
|
|
* @dentry: debugfs dentry pointer (per device)
|
2015-09-04 11:17:26 +03:00
|
|
|
*
|
2016-02-16 11:47:53 +03:00
|
|
|
* This is an internal data structure maintaining the devices that are managed
|
|
|
|
* by 'struct opp_table'.
|
2015-09-04 11:17:26 +03:00
|
|
|
*/
|
2016-02-16 11:47:53 +03:00
|
|
|
struct opp_device {
|
2015-09-04 11:17:26 +03:00
|
|
|
struct list_head node;
|
|
|
|
const struct device *dev;
|
2015-11-11 05:29:01 +03:00
|
|
|
|
|
|
|
#ifdef CONFIG_DEBUG_FS
|
|
|
|
struct dentry *dentry;
|
|
|
|
#endif
|
2015-09-04 11:17:26 +03:00
|
|
|
};
|
|
|
|
|
2016-06-16 16:33:11 +03:00
|
|
|
enum opp_table_access {
|
|
|
|
OPP_TABLE_ACCESS_UNKNOWN = 0,
|
|
|
|
OPP_TABLE_ACCESS_EXCLUSIVE = 1,
|
|
|
|
OPP_TABLE_ACCESS_SHARED = 2,
|
|
|
|
};
|
|
|
|
|
2015-09-04 11:17:26 +03:00
|
|
|
/**
|
2016-02-16 11:47:53 +03:00
|
|
|
* struct opp_table - Device opp structure
|
|
|
|
* @node: table node - contains the devices with OPPs that
|
2015-09-04 11:17:26 +03:00
|
|
|
* have been registered. Nodes once added are not modified in this
|
2016-02-16 11:47:53 +03:00
|
|
|
* table.
|
2017-01-23 07:41:49 +03:00
|
|
|
* @head: notifier head to notify the OPP availability changes.
|
2015-09-04 11:17:26 +03:00
|
|
|
* @dev_list: list of devices that share these OPPs
|
2016-02-16 11:47:53 +03:00
|
|
|
* @opp_list: table of opps
|
2017-01-23 07:41:42 +03:00
|
|
|
* @kref: for reference count of the table.
|
2018-09-11 08:44:11 +03:00
|
|
|
* @list_kref: for reference count of the OPP list.
|
2018-08-03 04:35:21 +03:00
|
|
|
* @lock: mutex protecting the opp_list and dev_list.
|
2015-09-04 11:17:26 +03:00
|
|
|
* @np: struct device_node pointer for opp's DT node.
|
2015-11-19 06:43:56 +03:00
|
|
|
* @clock_latency_ns_max: Max clock latency in nanoseconds.
|
2018-06-14 09:34:43 +03:00
|
|
|
* @parsed_static_opps: True if OPPs are initialized from DT.
|
2015-09-04 11:17:26 +03:00
|
|
|
* @shared_opp: OPP is shared between multiple devices.
|
2015-11-19 06:43:56 +03:00
|
|
|
* @suspend_opp: Pointer to OPP to be used during device suspend.
|
2018-06-26 13:59:34 +03:00
|
|
|
* @genpd_virt_dev_lock: Mutex protecting the genpd virtual device pointers.
|
|
|
|
* @genpd_virt_devs: List of virtual devices for multiple genpd support.
|
2018-06-07 12:20:43 +03:00
|
|
|
* @required_opp_tables: List of device OPP tables that are required by OPPs in
|
|
|
|
* this table.
|
|
|
|
* @required_opp_count: Number of required devices.
|
2015-12-09 05:31:46 +03:00
|
|
|
* @supported_hw: Array of version number to support.
|
|
|
|
* @supported_hw_count: Number of elements in supported_hw array.
|
2015-12-09 05:31:47 +03:00
|
|
|
* @prop_name: A name to postfix to many DT properties, while parsing them.
|
2016-02-09 08:00:38 +03:00
|
|
|
* @clk: Device's clock handle
|
2016-12-01 13:58:19 +03:00
|
|
|
* @regulators: Supply regulators
|
2018-12-11 14:09:36 +03:00
|
|
|
* @regulator_count: Number of power supply regulators. Its value can be -1
|
|
|
|
* (uninitialized), 0 (no opp-microvolt property) or > 0 (has opp-microvolt
|
|
|
|
* property).
|
2017-10-11 10:24:14 +03:00
|
|
|
* @genpd_performance_state: Device's power domain support performance state.
|
2018-06-13 13:30:11 +03:00
|
|
|
* @is_genpd: Marks if the OPP table belongs to a genpd.
|
2016-12-01 13:58:21 +03:00
|
|
|
* @set_opp: Platform specific set_opp callback
|
2016-12-01 13:58:20 +03:00
|
|
|
* @set_opp_data: Data to be passed to set_opp callback
|
2015-11-11 05:29:01 +03:00
|
|
|
* @dentry: debugfs dentry pointer of the real device directory (not links).
|
|
|
|
* @dentry_name: Name of the real dentry.
|
2015-09-04 11:17:26 +03:00
|
|
|
*
|
2016-02-09 08:00:37 +03:00
|
|
|
* @voltage_tolerance_v1: In percentage, for v1 bindings only.
|
|
|
|
*
|
2015-09-04 11:17:26 +03:00
|
|
|
* This is an internal data structure maintaining the link to opps attached to
|
|
|
|
* a device. This structure is not meant to be shared to users as it is
|
|
|
|
* meant for book keeping and private to OPP library.
|
|
|
|
*/
|
2016-02-16 11:47:53 +03:00
|
|
|
struct opp_table {
|
2015-09-04 11:17:26 +03:00
|
|
|
struct list_head node;
|
|
|
|
|
2017-01-23 07:41:49 +03:00
|
|
|
struct blocking_notifier_head head;
|
2015-09-04 11:17:26 +03:00
|
|
|
struct list_head dev_list;
|
|
|
|
struct list_head opp_list;
|
2017-01-23 07:41:42 +03:00
|
|
|
struct kref kref;
|
2018-09-11 08:44:11 +03:00
|
|
|
struct kref list_kref;
|
2017-01-23 07:41:41 +03:00
|
|
|
struct mutex lock;
|
2015-09-04 11:17:26 +03:00
|
|
|
|
|
|
|
struct device_node *np;
|
|
|
|
unsigned long clock_latency_ns_max;
|
2016-02-09 08:00:37 +03:00
|
|
|
|
|
|
|
/* For backward compatibility with v1 bindings */
|
|
|
|
unsigned int voltage_tolerance_v1;
|
|
|
|
|
2018-06-14 09:34:43 +03:00
|
|
|
bool parsed_static_opps;
|
2016-06-16 16:33:11 +03:00
|
|
|
enum opp_table_access shared_opp;
|
2015-09-04 11:17:26 +03:00
|
|
|
struct dev_pm_opp *suspend_opp;
|
2015-11-11 05:29:01 +03:00
|
|
|
|
2018-06-26 13:59:34 +03:00
|
|
|
struct mutex genpd_virt_dev_lock;
|
|
|
|
struct device **genpd_virt_devs;
|
2018-06-07 12:20:43 +03:00
|
|
|
struct opp_table **required_opp_tables;
|
|
|
|
unsigned int required_opp_count;
|
|
|
|
|
2015-12-09 05:31:46 +03:00
|
|
|
unsigned int *supported_hw;
|
|
|
|
unsigned int supported_hw_count;
|
2015-12-09 05:31:47 +03:00
|
|
|
const char *prop_name;
|
2016-02-09 08:00:38 +03:00
|
|
|
struct clk *clk;
|
2016-12-01 13:58:19 +03:00
|
|
|
struct regulator **regulators;
|
2018-12-11 14:09:36 +03:00
|
|
|
int regulator_count;
|
2017-10-11 10:24:14 +03:00
|
|
|
bool genpd_performance_state;
|
2018-06-13 13:30:11 +03:00
|
|
|
bool is_genpd;
|
2015-12-09 05:31:46 +03:00
|
|
|
|
2016-12-01 13:58:21 +03:00
|
|
|
int (*set_opp)(struct dev_pm_set_opp_data *data);
|
2016-12-01 13:58:20 +03:00
|
|
|
struct dev_pm_set_opp_data *set_opp_data;
|
|
|
|
|
2015-11-11 05:29:01 +03:00
|
|
|
#ifdef CONFIG_DEBUG_FS
|
|
|
|
struct dentry *dentry;
|
|
|
|
char dentry_name[NAME_MAX];
|
|
|
|
#endif
|
2015-09-04 11:17:26 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Routines internal to opp core */
|
2017-11-29 12:48:36 +03:00
|
|
|
void dev_pm_opp_get(struct dev_pm_opp *opp);
|
2018-09-12 10:05:19 +03:00
|
|
|
void _opp_remove_all_static(struct opp_table *opp_table);
|
2017-01-23 07:41:42 +03:00
|
|
|
void _get_opp_table_kref(struct opp_table *opp_table);
|
2018-04-06 12:05:45 +03:00
|
|
|
int _get_opp_count(struct opp_table *opp_table);
|
2016-02-16 11:47:53 +03:00
|
|
|
struct opp_table *_find_opp_table(struct device *dev);
|
|
|
|
struct opp_device *_add_opp_dev(const struct device *dev, struct opp_table *opp_table);
|
2018-09-13 10:44:36 +03:00
|
|
|
void _dev_pm_opp_find_and_remove_table(struct device *dev);
|
2017-01-02 12:11:01 +03:00
|
|
|
struct dev_pm_opp *_opp_allocate(struct opp_table *opp_table);
|
|
|
|
void _opp_free(struct dev_pm_opp *opp);
|
2018-04-06 12:05:45 +03:00
|
|
|
int _opp_add(struct device *dev, struct dev_pm_opp *new_opp, struct opp_table *opp_table, bool rate_not_available);
|
2017-01-02 12:11:01 +03:00
|
|
|
int _opp_add_v1(struct opp_table *opp_table, struct device *dev, unsigned long freq, long u_volt, bool dynamic);
|
2018-09-13 10:44:36 +03:00
|
|
|
void _dev_pm_opp_cpumask_remove_table(const struct cpumask *cpumask, int last_cpu);
|
2017-01-02 12:11:01 +03:00
|
|
|
struct opp_table *_add_opp_table(struct device *dev);
|
2018-09-11 08:44:11 +03:00
|
|
|
void _put_opp_list_kref(struct opp_table *opp_table);
|
2016-05-05 13:50:33 +03:00
|
|
|
|
|
|
|
#ifdef CONFIG_OF
|
2018-09-05 13:47:14 +03:00
|
|
|
void _of_init_opp_table(struct opp_table *opp_table, struct device *dev, int index);
|
2018-06-07 12:20:43 +03:00
|
|
|
void _of_clear_opp_table(struct opp_table *opp_table);
|
2018-09-07 06:31:54 +03:00
|
|
|
struct opp_table *_managed_opp(struct device *dev, int index);
|
2018-06-07 12:20:43 +03:00
|
|
|
void _of_opp_free_required_opps(struct opp_table *opp_table,
|
|
|
|
struct dev_pm_opp *opp);
|
2016-05-05 13:50:33 +03:00
|
|
|
#else
|
2018-09-05 13:47:14 +03:00
|
|
|
static inline void _of_init_opp_table(struct opp_table *opp_table, struct device *dev, int index) {}
|
2018-06-07 12:20:43 +03:00
|
|
|
static inline void _of_clear_opp_table(struct opp_table *opp_table) {}
|
2018-09-07 06:31:54 +03:00
|
|
|
static inline struct opp_table *_managed_opp(struct device *dev, int index) { return NULL; }
|
2018-06-07 12:20:43 +03:00
|
|
|
static inline void _of_opp_free_required_opps(struct opp_table *opp_table,
|
|
|
|
struct dev_pm_opp *opp) {}
|
2016-05-05 13:50:33 +03:00
|
|
|
#endif
|
2015-09-04 11:17:26 +03:00
|
|
|
|
2015-11-11 05:29:01 +03:00
|
|
|
#ifdef CONFIG_DEBUG_FS
|
|
|
|
void opp_debug_remove_one(struct dev_pm_opp *opp);
|
2019-01-22 18:21:17 +03:00
|
|
|
void opp_debug_create_one(struct dev_pm_opp *opp, struct opp_table *opp_table);
|
|
|
|
void opp_debug_register(struct opp_device *opp_dev, struct opp_table *opp_table);
|
2016-02-16 11:47:53 +03:00
|
|
|
void opp_debug_unregister(struct opp_device *opp_dev, struct opp_table *opp_table);
|
2015-11-11 05:29:01 +03:00
|
|
|
#else
|
|
|
|
static inline void opp_debug_remove_one(struct dev_pm_opp *opp) {}
|
|
|
|
|
2019-01-22 18:21:17 +03:00
|
|
|
static inline void opp_debug_create_one(struct dev_pm_opp *opp,
|
|
|
|
struct opp_table *opp_table) { }
|
|
|
|
|
|
|
|
static inline void opp_debug_register(struct opp_device *opp_dev,
|
|
|
|
struct opp_table *opp_table) { }
|
2015-11-11 05:29:01 +03:00
|
|
|
|
2016-02-16 11:47:53 +03:00
|
|
|
static inline void opp_debug_unregister(struct opp_device *opp_dev,
|
|
|
|
struct opp_table *opp_table)
|
2015-11-11 05:29:01 +03:00
|
|
|
{ }
|
|
|
|
#endif /* DEBUG_FS */
|
|
|
|
|
2015-09-04 11:17:26 +03:00
|
|
|
#endif /* __DRIVER_OPP_H__ */
|