Orange Pi5 kernel

Deprecated Linux kernel 5.10.110 for OrangePi 5/5B/5+ boards

3 Commits   0 Branches   0 Tags
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   1) /* SPDX-License-Identifier: GPL-2.0-only */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   2) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   3)  * Generic OPP Interface
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   4)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   5)  * Copyright (C) 2009-2010 Texas Instruments Incorporated.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   6)  *	Nishanth Menon
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   7)  *	Romit Dasgupta
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   8)  *	Kevin Hilman
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300   9)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  10) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  11) #ifndef __DRIVER_OPP_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  12) #define __DRIVER_OPP_H__
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  13) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  14) #include <linux/device.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  15) #include <linux/interconnect.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  16) #include <linux/kernel.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  17) #include <linux/kref.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  18) #include <linux/list.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  19) #include <linux/limits.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  20) #include <linux/pm_opp.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  21) #include <linux/notifier.h>
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  22) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  23) struct clk;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  24) struct regulator;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  25) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  26) /* Lock to allow exclusive modification to the device and opp lists */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  27) extern struct mutex opp_table_lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  28) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  29) extern struct list_head opp_tables;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  30) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  31) /*
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  32)  * Internal data structure organization with the OPP layer library is as
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  33)  * follows:
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  34)  * opp_tables (root)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  35)  *	|- device 1 (represents voltage domain 1)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  36)  *	|	|- opp 1 (availability, freq, voltage)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  37)  *	|	|- opp 2 ..
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  38)  *	...	...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  39)  *	|	`- opp n ..
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  40)  *	|- device 2 (represents the next voltage domain)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  41)  *	...
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  42)  *	`- device m (represents mth voltage domain)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  43)  * device 1, 2.. are represented by opp_table structure while each opp
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  44)  * is represented by the opp structure.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  45)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  46) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  47) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  48)  * struct dev_pm_opp - Generic OPP description structure
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  49)  * @node:	opp table node. The nodes are maintained throughout the lifetime
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  50)  *		of boot. It is expected only an optimal set of OPPs are
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  51)  *		added to the library by the SoC framework.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  52)  *		IMPORTANT: the opp nodes should be maintained in increasing
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  53)  *		order.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  54)  * @kref:	for reference count of the OPP.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  55)  * @available:	true/false - marks if this OPP as available or not
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  56)  * @dynamic:	not-created from static DT entries.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  57)  * @turbo:	true if turbo (boost) OPP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  58)  * @suspend:	true if suspend OPP
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  59)  * @pstate: Device's power domain's performance state.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  60)  * @rate:	Frequency in hertz
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  61)  * @level:	Performance level
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  62)  * @supplies:	Power supplies voltage/current values
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  63)  * @bandwidth:	Interconnect bandwidth values
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  64)  * @clock_latency_ns: Latency (in nanoseconds) of switching to this OPP's
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  65)  *		frequency from any other OPP's frequency.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  66)  * @required_opps: List of OPPs that are required by this OPP.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  67)  * @opp_table:	points back to the opp_table struct this opp belongs to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  68)  * @np:		OPP's device node.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  69)  * @dentry:	debugfs dentry pointer (per opp)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  70)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  71)  * This structure stores the OPP information for a given device.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  72)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  73) struct dev_pm_opp {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  74) 	struct list_head node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  75) 	struct kref kref;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  76) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  77) 	bool available;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  78) 	bool dynamic;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  79) 	bool turbo;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  80) 	bool suspend;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  81) 	unsigned int pstate;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  82) 	unsigned long rate;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  83) 	unsigned int level;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  84) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  85) 	struct dev_pm_opp_supply *supplies;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  86) 	struct dev_pm_opp_icc_bw *bandwidth;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  87) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  88) 	unsigned long clock_latency_ns;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  89) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  90) 	struct dev_pm_opp **required_opps;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  91) 	struct opp_table *opp_table;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  92) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  93) 	struct device_node *np;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  94) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  95) #ifdef CONFIG_DEBUG_FS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  96) 	struct dentry *dentry;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  97) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  98) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300  99) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 100) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 101)  * struct opp_device - devices managed by 'struct opp_table'
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 102)  * @node:	list node
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 103)  * @dev:	device to which the struct object belongs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 104)  * @dentry:	debugfs dentry pointer (per device)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 105)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 106)  * This is an internal data structure maintaining the devices that are managed
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 107)  * by 'struct opp_table'.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 108)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 109) struct opp_device {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 110) 	struct list_head node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 111) 	const struct device *dev;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 112) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 113) #ifdef CONFIG_DEBUG_FS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 114) 	struct dentry *dentry;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 115) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 116) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 117) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 118) enum opp_table_access {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 119) 	OPP_TABLE_ACCESS_UNKNOWN = 0,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 120) 	OPP_TABLE_ACCESS_EXCLUSIVE = 1,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 121) 	OPP_TABLE_ACCESS_SHARED = 2,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 122) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 123) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 124) /**
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 125)  * struct opp_table - Device opp structure
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 126)  * @node:	table node - contains the devices with OPPs that
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 127)  *		have been registered. Nodes once added are not modified in this
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 128)  *		table.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 129)  * @head:	notifier head to notify the OPP availability changes.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 130)  * @dev_list:	list of devices that share these OPPs
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 131)  * @opp_list:	table of opps
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 132)  * @kref:	for reference count of the table.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 133)  * @lock:	mutex protecting the opp_list and dev_list.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 134)  * @np:		struct device_node pointer for opp's DT node.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 135)  * @clock_latency_ns_max: Max clock latency in nanoseconds.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 136)  * @parsed_static_opps: Count of devices for which OPPs are initialized from DT.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 137)  * @shared_opp: OPP is shared between multiple devices.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 138)  * @suspend_opp: Pointer to OPP to be used during device suspend.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 139)  * @genpd_virt_dev_lock: Mutex protecting the genpd virtual device pointers.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 140)  * @genpd_virt_devs: List of virtual devices for multiple genpd support.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 141)  * @required_opp_tables: List of device OPP tables that are required by OPPs in
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 142)  *		this table.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 143)  * @required_opp_count: Number of required devices.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 144)  * @supported_hw: Array of version number to support.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 145)  * @supported_hw_count: Number of elements in supported_hw array.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 146)  * @prop_name: A name to postfix to many DT properties, while parsing them.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 147)  * @clk: Device's clock handle
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 148)  * @regulators: Supply regulators
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 149)  * @regulator_count: Number of power supply regulators. Its value can be -1
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 150)  * (uninitialized), 0 (no opp-microvolt property) or > 0 (has opp-microvolt
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 151)  * property).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 152)  * @paths: Interconnect path handles
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 153)  * @path_count: Number of interconnect paths
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 154)  * @enabled: Set to true if the device's resources are enabled/configured.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 155)  * @genpd_performance_state: Device's power domain support performance state.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 156)  * @is_genpd: Marks if the OPP table belongs to a genpd.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 157)  * @set_opp: Platform specific set_opp callback
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 158)  * @set_opp_data: Data to be passed to set_opp callback
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 159)  * @dentry:	debugfs dentry pointer of the real device directory (not links).
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 160)  * @dentry_name: Name of the real dentry.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 161)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 162)  * @voltage_tolerance_v1: In percentage, for v1 bindings only.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 163)  *
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 164)  * This is an internal data structure maintaining the link to opps attached to
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 165)  * a device. This structure is not meant to be shared to users as it is
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 166)  * meant for book keeping and private to OPP library.
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 167)  */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 168) struct opp_table {
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 169) 	struct list_head node;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 170) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 171) 	struct blocking_notifier_head head;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 172) 	struct list_head dev_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 173) 	struct list_head opp_list;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 174) 	struct kref kref;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 175) 	struct mutex lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 176) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 177) 	struct device_node *np;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 178) 	unsigned long clock_latency_ns_max;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 179) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 180) 	/* For backward compatibility with v1 bindings */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 181) 	unsigned int voltage_tolerance_v1;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 182) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 183) 	unsigned int parsed_static_opps;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 184) 	enum opp_table_access shared_opp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 185) 	struct dev_pm_opp *suspend_opp;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 186) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 187) 	struct mutex genpd_virt_dev_lock;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 188) 	struct device **genpd_virt_devs;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 189) 	struct opp_table **required_opp_tables;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 190) 	unsigned int required_opp_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 191) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 192) 	unsigned int *supported_hw;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 193) 	unsigned int supported_hw_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 194) 	const char *prop_name;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 195) 	struct clk *clk;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 196) 	struct regulator **regulators;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 197) 	int regulator_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 198) 	struct icc_path **paths;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 199) 	unsigned int path_count;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 200) 	bool enabled;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 201) 	bool genpd_performance_state;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 202) 	bool is_genpd;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 203) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 204) 	int (*set_opp)(struct dev_pm_set_opp_data *data);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 205) 	struct dev_pm_set_opp_data *set_opp_data;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 206) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 207) #ifdef CONFIG_DEBUG_FS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 208) 	struct dentry *dentry;
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 209) 	char dentry_name[NAME_MAX];
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 210) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 211) };
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 212) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 213) /* Routines internal to opp core */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 214) void dev_pm_opp_get(struct dev_pm_opp *opp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 215) bool _opp_remove_all_static(struct opp_table *opp_table);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 216) void _get_opp_table_kref(struct opp_table *opp_table);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 217) int _get_opp_count(struct opp_table *opp_table);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 218) struct opp_table *_find_opp_table(struct device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 219) struct opp_device *_add_opp_dev(const struct device *dev, struct opp_table *opp_table);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 220) struct dev_pm_opp *_opp_allocate(struct opp_table *opp_table);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 221) void _opp_free(struct dev_pm_opp *opp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 222) int _opp_compare_key(struct dev_pm_opp *opp1, struct dev_pm_opp *opp2);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 223) int _opp_add(struct device *dev, struct dev_pm_opp *new_opp, struct opp_table *opp_table, bool rate_not_available);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 224) int _opp_add_v1(struct opp_table *opp_table, struct device *dev, unsigned long freq, long u_volt, bool dynamic);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 225) void _dev_pm_opp_cpumask_remove_table(const struct cpumask *cpumask, int last_cpu);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 226) struct opp_table *_add_opp_table(struct device *dev);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 227) void _put_opp_list_kref(struct opp_table *opp_table);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 228) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 229) #ifdef CONFIG_OF
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 230) void _of_init_opp_table(struct opp_table *opp_table, struct device *dev, int index);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 231) void _of_clear_opp_table(struct opp_table *opp_table);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 232) struct opp_table *_managed_opp(struct device *dev, int index);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 233) void _of_opp_free_required_opps(struct opp_table *opp_table,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 234) 				struct dev_pm_opp *opp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 235) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 236) static inline void _of_init_opp_table(struct opp_table *opp_table, struct device *dev, int index) {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 237) static inline void _of_clear_opp_table(struct opp_table *opp_table) {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 238) static inline struct opp_table *_managed_opp(struct device *dev, int index) { return NULL; }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 239) static inline void _of_opp_free_required_opps(struct opp_table *opp_table,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 240) 					      struct dev_pm_opp *opp) {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 241) #endif
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 242) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 243) #ifdef CONFIG_DEBUG_FS
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 244) void opp_debug_remove_one(struct dev_pm_opp *opp);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 245) void opp_debug_create_one(struct dev_pm_opp *opp, struct opp_table *opp_table);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 246) void opp_debug_register(struct opp_device *opp_dev, struct opp_table *opp_table);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 247) void opp_debug_unregister(struct opp_device *opp_dev, struct opp_table *opp_table);
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 248) #else
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 249) static inline void opp_debug_remove_one(struct dev_pm_opp *opp) {}
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 250) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 251) static inline void opp_debug_create_one(struct dev_pm_opp *opp,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 252) 					struct opp_table *opp_table) { }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 253) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 254) static inline void opp_debug_register(struct opp_device *opp_dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 255) 				      struct opp_table *opp_table) { }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 256) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 257) static inline void opp_debug_unregister(struct opp_device *opp_dev,
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 258) 					struct opp_table *opp_table)
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 259) { }
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 260) #endif		/* DEBUG_FS */
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 261) 
^8f3ce5b39 (kx 2023-10-28 12:00:06 +0300 262) #endif		/* __DRIVER_OPP_H__ */