2019-06-04 16:11:33 +08:00
|
|
|
/* SPDX-License-Identifier: GPL-2.0-only */
|
2015-09-04 16:17:26 +08: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>
|
2020-05-12 20:53:21 +08:00
|
|
|
#include <linux/interconnect.h>
|
2015-09-04 16:17:26 +08:00
|
|
|
#include <linux/kernel.h>
|
2017-01-23 12:41:46 +08:00
|
|
|
#include <linux/kref.h>
|
2015-09-04 16:17:26 +08:00
|
|
|
#include <linux/list.h>
|
2015-11-11 10:29:01 +08:00
|
|
|
#include <linux/limits.h>
|
2015-09-04 16:17:26 +08:00
|
|
|
#include <linux/pm_opp.h>
|
2017-01-23 12:41:49 +08:00
|
|
|
#include <linux/notifier.h>
|
2015-09-04 16:17:26 +08:00
|
|
|
|
2016-02-09 13:00:38 +08:00
|
|
|
struct clk;
|
2016-02-09 13:00:33 +08: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 16:51:19 +08:00
|
|
|
/* Lock to allow exclusive modification to the device and opp lists */
|
2016-02-16 16:47:53 +08: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 16:51:19 +08:00
|
|
|
|
2019-11-25 16:27:58 +08:00
|
|
|
extern struct list_head opp_tables, lazy_opp_tables;
|
2016-05-05 18:50:33 +08:00
|
|
|
|
2015-09-04 16:17:26 +08:00
|
|
|
/*
|
|
|
|
* Internal data structure organization with the OPP layer library is as
|
|
|
|
* follows:
|
2016-02-16 16:47:53 +08:00
|
|
|
* opp_tables (root)
|
2015-09-04 16:17:26 +08: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 16:47:53 +08:00
|
|
|
* device 1, 2.. are represented by opp_table structure while each opp
|
2015-09-04 16:17:26 +08:00
|
|
|
* is represented by the opp structure.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/**
|
|
|
|
* struct dev_pm_opp - Generic OPP description structure
|
2016-02-16 16:47:53 +08:00
|
|
|
* @node: opp table node. The nodes are maintained throughout the lifetime
|
2015-09-04 16:17:26 +08: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 12:41:46 +08:00
|
|
|
* @kref: for reference count of the OPP.
|
2015-09-04 16:17:26 +08:00
|
|
|
* @available: true/false - marks if this OPP as available or not
|
2015-11-19 11:43:56 +08:00
|
|
|
* @dynamic: not-created from static DT entries.
|
2015-09-04 16:17:26 +08:00
|
|
|
* @turbo: true if turbo (boost) OPP
|
2015-11-11 10:29:01 +08:00
|
|
|
* @suspend: true if suspend OPP
|
2021-03-04 23:07:34 +08:00
|
|
|
* @removed: flag indicating that OPP's reference is dropped by OPP core.
|
2017-10-11 15:24:14 +08:00
|
|
|
* @pstate: Device's power domain's performance state.
|
2015-09-04 16:17:26 +08:00
|
|
|
* @rate: Frequency in hertz
|
2019-01-10 12:02:02 +08:00
|
|
|
* @level: Performance level
|
2016-12-01 18:58:19 +08:00
|
|
|
* @supplies: Power supplies voltage/current values
|
2020-05-12 20:53:21 +08:00
|
|
|
* @bandwidth: Interconnect bandwidth values
|
2015-09-04 16:17:26 +08:00
|
|
|
* @clock_latency_ns: Latency (in nanoseconds) of switching to this OPP's
|
|
|
|
* frequency from any other OPP's frequency.
|
2018-06-07 17:20:43 +08:00
|
|
|
* @required_opps: List of OPPs that are required by this OPP.
|
2016-02-16 16:47:53 +08:00
|
|
|
* @opp_table: points back to the opp_table struct this opp belongs to
|
2015-09-04 16:17:26 +08:00
|
|
|
* @np: OPP's device node.
|
2015-11-11 10:29:01 +08:00
|
|
|
* @dentry: debugfs dentry pointer (per opp)
|
2015-09-04 16:17:26 +08:00
|
|
|
*
|
|
|
|
* This structure stores the OPP information for a given device.
|
|
|
|
*/
|
|
|
|
struct dev_pm_opp {
|
|
|
|
struct list_head node;
|
2017-01-23 12:41:46 +08:00
|
|
|
struct kref kref;
|
2015-09-04 16:17:26 +08:00
|
|
|
|
|
|
|
bool available;
|
|
|
|
bool dynamic;
|
|
|
|
bool turbo;
|
2015-11-11 10:29:01 +08:00
|
|
|
bool suspend;
|
2021-03-04 23:07:34 +08:00
|
|
|
bool removed;
|
2017-10-11 15:24:14 +08:00
|
|
|
unsigned int pstate;
|
2015-09-04 16:17:26 +08:00
|
|
|
unsigned long rate;
|
2019-01-10 12:02:02 +08:00
|
|
|
unsigned int level;
|
2015-09-04 16:17:26 +08:00
|
|
|
|
2016-12-01 18:58:19 +08:00
|
|
|
struct dev_pm_opp_supply *supplies;
|
2020-05-12 20:53:21 +08:00
|
|
|
struct dev_pm_opp_icc_bw *bandwidth;
|
2016-12-01 18:58:17 +08:00
|
|
|
|
2015-09-04 16:17:26 +08:00
|
|
|
unsigned long clock_latency_ns;
|
|
|
|
|
2018-06-07 17:20:43 +08:00
|
|
|
struct dev_pm_opp **required_opps;
|
2016-02-16 16:47:53 +08:00
|
|
|
struct opp_table *opp_table;
|
2015-09-04 16:17:26 +08:00
|
|
|
|
|
|
|
struct device_node *np;
|
2015-11-11 10:29:01 +08:00
|
|
|
|
|
|
|
#ifdef CONFIG_DEBUG_FS
|
|
|
|
struct dentry *dentry;
|
2022-02-10 17:07:53 +08:00
|
|
|
const char *of_name;
|
2015-11-11 10:29:01 +08:00
|
|
|
#endif
|
2015-09-04 16:17:26 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/**
|
2016-02-16 16:47:53 +08:00
|
|
|
* struct opp_device - devices managed by 'struct opp_table'
|
2015-09-04 16:17:26 +08:00
|
|
|
* @node: list node
|
|
|
|
* @dev: device to which the struct object belongs
|
2015-11-11 10:29:01 +08:00
|
|
|
* @dentry: debugfs dentry pointer (per device)
|
2015-09-04 16:17:26 +08:00
|
|
|
*
|
2016-02-16 16:47:53 +08:00
|
|
|
* This is an internal data structure maintaining the devices that are managed
|
|
|
|
* by 'struct opp_table'.
|
2015-09-04 16:17:26 +08:00
|
|
|
*/
|
2016-02-16 16:47:53 +08:00
|
|
|
struct opp_device {
|
2015-09-04 16:17:26 +08:00
|
|
|
struct list_head node;
|
|
|
|
const struct device *dev;
|
2015-11-11 10:29:01 +08:00
|
|
|
|
|
|
|
#ifdef CONFIG_DEBUG_FS
|
|
|
|
struct dentry *dentry;
|
|
|
|
#endif
|
2015-09-04 16:17:26 +08:00
|
|
|
};
|
|
|
|
|
2016-06-16 21:33:11 +08:00
|
|
|
enum opp_table_access {
|
|
|
|
OPP_TABLE_ACCESS_UNKNOWN = 0,
|
|
|
|
OPP_TABLE_ACCESS_EXCLUSIVE = 1,
|
|
|
|
OPP_TABLE_ACCESS_SHARED = 2,
|
|
|
|
};
|
|
|
|
|
2015-09-04 16:17:26 +08:00
|
|
|
/**
|
2016-02-16 16:47:53 +08:00
|
|
|
* struct opp_table - Device opp structure
|
|
|
|
* @node: table node - contains the devices with OPPs that
|
2015-09-04 16:17:26 +08:00
|
|
|
* have been registered. Nodes once added are not modified in this
|
2016-02-16 16:47:53 +08:00
|
|
|
* table.
|
2017-01-23 12:41:49 +08:00
|
|
|
* @head: notifier head to notify the OPP availability changes.
|
2015-09-04 16:17:26 +08:00
|
|
|
* @dev_list: list of devices that share these OPPs
|
2016-02-16 16:47:53 +08:00
|
|
|
* @opp_list: table of opps
|
2017-01-23 12:41:42 +08:00
|
|
|
* @kref: for reference count of the table.
|
2018-08-03 09:35:21 +08:00
|
|
|
* @lock: mutex protecting the opp_list and dev_list.
|
2015-09-04 16:17:26 +08:00
|
|
|
* @np: struct device_node pointer for opp's DT node.
|
2015-11-19 11:43:56 +08:00
|
|
|
* @clock_latency_ns_max: Max clock latency in nanoseconds.
|
2019-11-11 19:05:03 +08:00
|
|
|
* @parsed_static_opps: Count of devices for which OPPs are initialized from DT.
|
2015-09-04 16:17:26 +08:00
|
|
|
* @shared_opp: OPP is shared between multiple devices.
|
2021-02-17 04:10:29 +08:00
|
|
|
* @current_rate: Currently configured frequency.
|
2021-01-20 18:46:48 +08:00
|
|
|
* @current_opp: Currently configured OPP for the table.
|
2015-11-19 11:43:56 +08:00
|
|
|
* @suspend_opp: Pointer to OPP to be used during device suspend.
|
2018-06-26 18:59:34 +08: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 17:20:43 +08: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 10:31:46 +08:00
|
|
|
* @supported_hw: Array of version number to support.
|
|
|
|
* @supported_hw_count: Number of elements in supported_hw array.
|
2015-12-09 10:31:47 +08:00
|
|
|
* @prop_name: A name to postfix to many DT properties, while parsing them.
|
2022-05-25 17:17:59 +08:00
|
|
|
* @clk_configured: Clock name is configured by the platform.
|
2016-02-09 13:00:38 +08:00
|
|
|
* @clk: Device's clock handle
|
2016-12-01 18:58:19 +08:00
|
|
|
* @regulators: Supply regulators
|
2018-12-11 19:09:36 +08: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).
|
2020-05-12 20:53:21 +08:00
|
|
|
* @paths: Interconnect path handles
|
|
|
|
* @path_count: Number of interconnect paths
|
2020-08-13 11:08:37 +08:00
|
|
|
* @enabled: Set to true if the device's resources are enabled/configured.
|
2017-10-11 15:24:14 +08:00
|
|
|
* @genpd_performance_state: Device's power domain support performance state.
|
2018-06-13 18:30:11 +08:00
|
|
|
* @is_genpd: Marks if the OPP table belongs to a genpd.
|
2016-12-01 18:58:21 +08:00
|
|
|
* @set_opp: Platform specific set_opp callback
|
2021-01-19 14:28:58 +08:00
|
|
|
* @sod_supplies: Set opp data supplies
|
2016-12-01 18:58:20 +08:00
|
|
|
* @set_opp_data: Data to be passed to set_opp callback
|
2015-11-11 10:29:01 +08:00
|
|
|
* @dentry: debugfs dentry pointer of the real device directory (not links).
|
|
|
|
* @dentry_name: Name of the real dentry.
|
2015-09-04 16:17:26 +08:00
|
|
|
*
|
2016-02-09 13:00:37 +08:00
|
|
|
* @voltage_tolerance_v1: In percentage, for v1 bindings only.
|
|
|
|
*
|
2015-09-04 16:17:26 +08: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 16:47:53 +08:00
|
|
|
struct opp_table {
|
2019-11-25 16:27:58 +08:00
|
|
|
struct list_head node, lazy;
|
2015-09-04 16:17:26 +08:00
|
|
|
|
2017-01-23 12:41:49 +08:00
|
|
|
struct blocking_notifier_head head;
|
2015-09-04 16:17:26 +08:00
|
|
|
struct list_head dev_list;
|
|
|
|
struct list_head opp_list;
|
2017-01-23 12:41:42 +08:00
|
|
|
struct kref kref;
|
2017-01-23 12:41:41 +08:00
|
|
|
struct mutex lock;
|
2015-09-04 16:17:26 +08:00
|
|
|
|
|
|
|
struct device_node *np;
|
|
|
|
unsigned long clock_latency_ns_max;
|
2016-02-09 13:00:37 +08:00
|
|
|
|
|
|
|
/* For backward compatibility with v1 bindings */
|
|
|
|
unsigned int voltage_tolerance_v1;
|
|
|
|
|
2019-11-11 19:05:03 +08:00
|
|
|
unsigned int parsed_static_opps;
|
2016-06-16 21:33:11 +08:00
|
|
|
enum opp_table_access shared_opp;
|
2021-02-17 04:10:29 +08:00
|
|
|
unsigned long current_rate;
|
2021-01-20 18:46:48 +08:00
|
|
|
struct dev_pm_opp *current_opp;
|
2015-09-04 16:17:26 +08:00
|
|
|
struct dev_pm_opp *suspend_opp;
|
2015-11-11 10:29:01 +08:00
|
|
|
|
2018-06-26 18:59:34 +08:00
|
|
|
struct mutex genpd_virt_dev_lock;
|
|
|
|
struct device **genpd_virt_devs;
|
2018-06-07 17:20:43 +08:00
|
|
|
struct opp_table **required_opp_tables;
|
|
|
|
unsigned int required_opp_count;
|
|
|
|
|
2015-12-09 10:31:46 +08:00
|
|
|
unsigned int *supported_hw;
|
|
|
|
unsigned int supported_hw_count;
|
2015-12-09 10:31:47 +08:00
|
|
|
const char *prop_name;
|
2022-05-25 17:17:59 +08:00
|
|
|
bool clk_configured;
|
2016-02-09 13:00:38 +08:00
|
|
|
struct clk *clk;
|
2016-12-01 18:58:19 +08:00
|
|
|
struct regulator **regulators;
|
2018-12-11 19:09:36 +08:00
|
|
|
int regulator_count;
|
2020-05-12 20:53:21 +08:00
|
|
|
struct icc_path **paths;
|
|
|
|
unsigned int path_count;
|
2020-08-13 11:08:37 +08:00
|
|
|
bool enabled;
|
2017-10-11 15:24:14 +08:00
|
|
|
bool genpd_performance_state;
|
2018-06-13 18:30:11 +08:00
|
|
|
bool is_genpd;
|
2015-12-09 10:31:46 +08:00
|
|
|
|
2016-12-01 18:58:21 +08:00
|
|
|
int (*set_opp)(struct dev_pm_set_opp_data *data);
|
2021-01-19 14:28:58 +08:00
|
|
|
struct dev_pm_opp_supply *sod_supplies;
|
2016-12-01 18:58:20 +08:00
|
|
|
struct dev_pm_set_opp_data *set_opp_data;
|
|
|
|
|
2015-11-11 10:29:01 +08:00
|
|
|
#ifdef CONFIG_DEBUG_FS
|
|
|
|
struct dentry *dentry;
|
|
|
|
char dentry_name[NAME_MAX];
|
|
|
|
#endif
|
2015-09-04 16:17:26 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
/* Routines internal to opp core */
|
2017-11-29 17:48:36 +08:00
|
|
|
void dev_pm_opp_get(struct dev_pm_opp *opp);
|
2020-08-31 15:33:06 +08:00
|
|
|
bool _opp_remove_all_static(struct opp_table *opp_table);
|
2017-01-23 12:41:42 +08:00
|
|
|
void _get_opp_table_kref(struct opp_table *opp_table);
|
2018-04-06 17:05:45 +08:00
|
|
|
int _get_opp_count(struct opp_table *opp_table);
|
2016-02-16 16:47:53 +08: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);
|
2017-01-02 17:11:01 +08:00
|
|
|
struct dev_pm_opp *_opp_allocate(struct opp_table *opp_table);
|
|
|
|
void _opp_free(struct dev_pm_opp *opp);
|
2020-05-12 20:53:19 +08:00
|
|
|
int _opp_compare_key(struct dev_pm_opp *opp1, struct dev_pm_opp *opp2);
|
2018-04-06 17:05:45 +08: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 17:11:01 +08:00
|
|
|
int _opp_add_v1(struct opp_table *opp_table, struct device *dev, unsigned long freq, long u_volt, bool dynamic);
|
2018-09-13 15:44:36 +08:00
|
|
|
void _dev_pm_opp_cpumask_remove_table(const struct cpumask *cpumask, int last_cpu);
|
2021-01-28 14:35:22 +08:00
|
|
|
struct opp_table *_add_opp_table_indexed(struct device *dev, int index, bool getclk);
|
2018-09-11 13:44:11 +08:00
|
|
|
void _put_opp_list_kref(struct opp_table *opp_table);
|
2019-11-25 16:27:58 +08:00
|
|
|
void _required_opps_available(struct dev_pm_opp *opp, int count);
|
|
|
|
|
|
|
|
static inline bool lazy_linking_pending(struct opp_table *opp_table)
|
|
|
|
{
|
|
|
|
return unlikely(!list_empty(&opp_table->lazy));
|
|
|
|
}
|
2016-05-05 18:50:33 +08:00
|
|
|
|
|
|
|
#ifdef CONFIG_OF
|
2018-09-05 18:47:14 +08:00
|
|
|
void _of_init_opp_table(struct opp_table *opp_table, struct device *dev, int index);
|
2018-06-07 17:20:43 +08:00
|
|
|
void _of_clear_opp_table(struct opp_table *opp_table);
|
2018-09-07 11:31:54 +08:00
|
|
|
struct opp_table *_managed_opp(struct device *dev, int index);
|
2018-06-07 17:20:43 +08:00
|
|
|
void _of_opp_free_required_opps(struct opp_table *opp_table,
|
|
|
|
struct dev_pm_opp *opp);
|
2016-05-05 18:50:33 +08:00
|
|
|
#else
|
2018-09-05 18:47:14 +08:00
|
|
|
static inline void _of_init_opp_table(struct opp_table *opp_table, struct device *dev, int index) {}
|
2018-06-07 17:20:43 +08:00
|
|
|
static inline void _of_clear_opp_table(struct opp_table *opp_table) {}
|
2018-09-07 11:31:54 +08:00
|
|
|
static inline struct opp_table *_managed_opp(struct device *dev, int index) { return NULL; }
|
2018-06-07 17:20:43 +08:00
|
|
|
static inline void _of_opp_free_required_opps(struct opp_table *opp_table,
|
|
|
|
struct dev_pm_opp *opp) {}
|
2016-05-05 18:50:33 +08:00
|
|
|
#endif
|
2015-09-04 16:17:26 +08:00
|
|
|
|
2015-11-11 10:29:01 +08:00
|
|
|
#ifdef CONFIG_DEBUG_FS
|
|
|
|
void opp_debug_remove_one(struct dev_pm_opp *opp);
|
2019-01-22 23:21:17 +08: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 16:47:53 +08:00
|
|
|
void opp_debug_unregister(struct opp_device *opp_dev, struct opp_table *opp_table);
|
2015-11-11 10:29:01 +08:00
|
|
|
#else
|
|
|
|
static inline void opp_debug_remove_one(struct dev_pm_opp *opp) {}
|
|
|
|
|
2019-01-22 23:21:17 +08: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 10:29:01 +08:00
|
|
|
|
2016-02-16 16:47:53 +08:00
|
|
|
static inline void opp_debug_unregister(struct opp_device *opp_dev,
|
|
|
|
struct opp_table *opp_table)
|
2015-11-11 10:29:01 +08:00
|
|
|
{ }
|
|
|
|
#endif /* DEBUG_FS */
|
|
|
|
|
2015-09-04 16:17:26 +08:00
|
|
|
#endif /* __DRIVER_OPP_H__ */
|