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