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