USB: serial: option: reimplement interface masking
[linux/fpc-iii.git] / arch / arm / mach-omap2 / omap-pm.h
blob5ba5df47f91b95272fbb99afae8e62da3f289a90
1 /* SPDX-License-Identifier: GPL-2.0 */
2 /*
3 * omap-pm.h - OMAP power management interface
5 * Copyright (C) 2008-2010 Texas Instruments, Inc.
6 * Copyright (C) 2008-2010 Nokia Corporation
7 * Paul Walmsley
9 * Interface developed by (in alphabetical order): Karthik Dasu, Jouni
10 * Högander, Tony Lindgren, Rajendra Nayak, Sakari Poussa,
11 * Veeramanikandan Raju, Anand Sawant, Igor Stoppa, Paul Walmsley,
12 * Richard Woodruff
15 #ifndef ASM_ARM_ARCH_OMAP_OMAP_PM_H
16 #define ASM_ARM_ARCH_OMAP_OMAP_PM_H
18 #include <linux/device.h>
19 #include <linux/cpufreq.h>
20 #include <linux/clk.h>
21 #include <linux/pm_opp.h>
24 * agent_id values for use with omap_pm_set_min_bus_tput():
26 * OCP_INITIATOR_AGENT is only valid for devices that can act as
27 * initiators -- it represents the device's L3 interconnect
28 * connection. OCP_TARGET_AGENT represents the device's L4
29 * interconnect connection.
31 #define OCP_TARGET_AGENT 1
32 #define OCP_INITIATOR_AGENT 2
34 /**
35 * omap_pm_if_early_init - OMAP PM init code called before clock fw init
36 * @mpu_opp_table: array ptr to struct omap_opp for MPU
37 * @dsp_opp_table: array ptr to struct omap_opp for DSP
38 * @l3_opp_table : array ptr to struct omap_opp for CORE
40 * Initialize anything that must be configured before the clock
41 * framework starts. The "_if_" is to avoid name collisions with the
42 * PM idle-loop code.
44 int __init omap_pm_if_early_init(void);
46 /**
47 * omap_pm_if_init - OMAP PM init code called after clock fw init
49 * The main initialization code. OPP tables are passed in here. The
50 * "_if_" is to avoid name collisions with the PM idle-loop code.
52 int __init omap_pm_if_init(void);
55 * Device-driver-originated constraints (via board-*.c files, platform_data)
59 /**
60 * omap_pm_set_max_mpu_wakeup_lat - set the maximum MPU wakeup latency
61 * @dev: struct device * requesting the constraint
62 * @t: maximum MPU wakeup latency in microseconds
64 * Request that the maximum interrupt latency for the MPU to be no
65 * greater than @t microseconds. "Interrupt latency" in this case is
66 * defined as the elapsed time from the occurrence of a hardware or
67 * timer interrupt to the time when the device driver's interrupt
68 * service routine has been entered by the MPU.
70 * It is intended that underlying PM code will use this information to
71 * determine what power state to put the MPU powerdomain into, and
72 * possibly the CORE powerdomain as well, since interrupt handling
73 * code currently runs from SDRAM. Advanced PM or board*.c code may
74 * also configure interrupt controller priorities, OCP bus priorities,
75 * CPU speed(s), etc.
77 * This function will not affect device wakeup latency, e.g., time
78 * elapsed from when a device driver enables a hardware device with
79 * clk_enable(), to when the device is ready for register access or
80 * other use. To control this device wakeup latency, use
81 * omap_pm_set_max_dev_wakeup_lat()
83 * Multiple calls to omap_pm_set_max_mpu_wakeup_lat() will replace the
84 * previous t value. To remove the latency target for the MPU, call
85 * with t = -1.
87 * XXX This constraint will be deprecated soon in favor of the more
88 * general omap_pm_set_max_dev_wakeup_lat()
90 * Returns -EINVAL for an invalid argument, -ERANGE if the constraint
91 * is not satisfiable, or 0 upon success.
93 int omap_pm_set_max_mpu_wakeup_lat(struct device *dev, long t);
96 /**
97 * omap_pm_set_min_bus_tput - set minimum bus throughput needed by device
98 * @dev: struct device * requesting the constraint
99 * @tbus_id: interconnect to operate on (OCP_{INITIATOR,TARGET}_AGENT)
100 * @r: minimum throughput (in KiB/s)
102 * Request that the minimum data throughput on the OCP interconnect
103 * attached to device @dev interconnect agent @tbus_id be no less
104 * than @r KiB/s.
106 * It is expected that the OMAP PM or bus code will use this
107 * information to set the interconnect clock to run at the lowest
108 * possible speed that satisfies all current system users. The PM or
109 * bus code will adjust the estimate based on its model of the bus, so
110 * device driver authors should attempt to specify an accurate
111 * quantity for their device use case, and let the PM or bus code
112 * overestimate the numbers as necessary to handle request/response
113 * latency, other competing users on the system, etc. On OMAP2/3, if
114 * a driver requests a minimum L4 interconnect speed constraint, the
115 * code will also need to add an minimum L3 interconnect speed
116 * constraint,
118 * Multiple calls to omap_pm_set_min_bus_tput() will replace the
119 * previous rate value for this device. To remove the interconnect
120 * throughput restriction for this device, call with r = 0.
122 * Returns -EINVAL for an invalid argument, -ERANGE if the constraint
123 * is not satisfiable, or 0 upon success.
125 int omap_pm_set_min_bus_tput(struct device *dev, u8 agent_id, unsigned long r);
129 * CPUFreq-originated constraint
131 * In the future, this should be handled by custom OPP clocktype
132 * functions.
137 * Device context loss tracking
141 * omap_pm_get_dev_context_loss_count - return count of times dev has lost ctx
142 * @dev: struct device *
144 * This function returns the number of times that the device @dev has
145 * lost its internal context. This generally occurs on a powerdomain
146 * transition to OFF. Drivers use this as an optimization to avoid restoring
147 * context if the device hasn't lost it. To use, drivers should initially
148 * call this in their context save functions and store the result. Early in
149 * the driver's context restore function, the driver should call this function
150 * again, and compare the result to the stored counter. If they differ, the
151 * driver must restore device context. If the number of context losses
152 * exceeds the maximum positive integer, the function will wrap to 0 and
153 * continue counting. Returns the number of context losses for this device,
154 * or negative value upon error.
156 int omap_pm_get_dev_context_loss_count(struct device *dev);
158 void omap_pm_enable_off_mode(void);
159 void omap_pm_disable_off_mode(void);
161 #endif