Linux Audio

Check our new training course

Loading...
Note: File does not exist in v3.1.
  1/*
  2 * omap-pm.h - OMAP power management interface
  3 *
  4 * Copyright (C) 2008-2010 Texas Instruments, Inc.
  5 * Copyright (C) 2008-2010 Nokia Corporation
  6 * Paul Walmsley
  7 *
  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
 12 */
 13
 14#ifndef ASM_ARM_ARCH_OMAP_OMAP_PM_H
 15#define ASM_ARM_ARCH_OMAP_OMAP_PM_H
 16
 17#include <linux/device.h>
 18#include <linux/cpufreq.h>
 19#include <linux/clk.h>
 20#include <linux/pm_opp.h>
 21
 22/*
 23 * agent_id values for use with omap_pm_set_min_bus_tput():
 24 *
 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.
 29 */
 30#define OCP_TARGET_AGENT		1
 31#define OCP_INITIATOR_AGENT		2
 32
 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
 38 *
 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.
 42 */
 43int __init omap_pm_if_early_init(void);
 44
 45/**
 46 * omap_pm_if_init - OMAP PM init code called after clock fw init
 47 *
 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.
 50 */
 51int __init omap_pm_if_init(void);
 52
 53/*
 54 * Device-driver-originated constraints (via board-*.c files, platform_data)
 55 */
 56
 57
 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
 62 *
 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.
 68 *
 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.
 75 *
 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()
 81 *
 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.
 85 *
 86 * XXX This constraint will be deprecated soon in favor of the more
 87 * general omap_pm_set_max_dev_wakeup_lat()
 88 *
 89 * Returns -EINVAL for an invalid argument, -ERANGE if the constraint
 90 * is not satisfiable, or 0 upon success.
 91 */
 92int omap_pm_set_max_mpu_wakeup_lat(struct device *dev, long t);
 93
 94
 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)
100 *
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.
104 *
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,
116 *
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.
120 *
121 * Returns -EINVAL for an invalid argument, -ERANGE if the constraint
122 * is not satisfiable, or 0 upon success.
123 */
124int omap_pm_set_min_bus_tput(struct device *dev, u8 agent_id, unsigned long r);
125
126
127/*
128 * CPUFreq-originated constraint
129 *
130 * In the future, this should be handled by custom OPP clocktype
131 * functions.
132 */
133
134
135/*
136 * Device context loss tracking
137 */
138
139/**
140 * omap_pm_get_dev_context_loss_count - return count of times dev has lost ctx
141 * @dev: struct device *
142 *
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.
154 */
155int omap_pm_get_dev_context_loss_count(struct device *dev);
156
157void omap_pm_enable_off_mode(void);
158void omap_pm_disable_off_mode(void);
159
160#endif