2 * omap-pm-noop.c - OMAP power management interface - dummy version
4 * This code implements the OMAP power management interface to
5 * drivers, CPUIdle, CPUFreq, and DSP Bridge. It is strictly for
6 * debug/demonstration use, as it does nothing but printk() whenever a
7 * function is called (when DEBUG is defined, below)
9 * Copyright (C) 2008-2009 Texas Instruments, Inc.
10 * Copyright (C) 2008-2009 Nokia Corporation
13 * Interface developed by (in alphabetical order):
14 * Karthik Dasu, Tony Lindgren, Rajendra Nayak, Sakari Poussa, Veeramanikandan
15 * Raju, Anand Sawant, Igor Stoppa, Paul Walmsley, Richard Woodruff
20 #include <linux/init.h>
21 #include <linux/cpufreq.h>
22 #include <linux/device.h>
23 #include <linux/platform_device.h>
25 #include "omap_device.h"
28 static bool off_mode_enabled
;
29 static int dummy_context_loss_counter
;
32 * Device-driver-originated constraints (via board-*.c files)
35 int omap_pm_set_max_mpu_wakeup_lat(struct device
*dev
, long t
)
38 WARN(1, "OMAP PM: %s: invalid parameter(s)", __func__
);
43 pr_debug("OMAP PM: remove max MPU wakeup latency constraint: dev %s\n",
46 pr_debug("OMAP PM: add max MPU wakeup latency constraint: dev %s, t = %ld usec\n",
50 * For current Linux, this needs to map the MPU to a
51 * powerdomain, then go through the list of current max lat
52 * constraints on the MPU and find the smallest. If
53 * the latency constraint has changed, the code should
54 * recompute the state to enter for the next powerdomain
57 * TI CDP code can call constraint_set here.
63 int omap_pm_set_min_bus_tput(struct device
*dev
, u8 agent_id
, unsigned long r
)
65 if (!dev
|| (agent_id
!= OCP_INITIATOR_AGENT
&&
66 agent_id
!= OCP_TARGET_AGENT
)) {
67 WARN(1, "OMAP PM: %s: invalid parameter(s)", __func__
);
72 pr_debug("OMAP PM: remove min bus tput constraint: dev %s for agent_id %d\n",
73 dev_name(dev
), agent_id
);
75 pr_debug("OMAP PM: add min bus tput constraint: dev %s for agent_id %d: rate %ld KiB\n",
76 dev_name(dev
), agent_id
, r
);
79 * This code should model the interconnect and compute the
80 * required clock frequency, convert that to a VDD2 OPP ID, then
81 * set the VDD2 OPP appropriately.
83 * TI CDP code can call constraint_set here on the VDD2 OPP.
90 * DSP Bridge-specific constraints
95 * omap_pm_enable_off_mode - notify OMAP PM that off-mode is enabled
97 * Intended for use only by OMAP PM core code to notify this layer
98 * that off mode has been enabled.
100 void omap_pm_enable_off_mode(void)
102 off_mode_enabled
= true;
106 * omap_pm_disable_off_mode - notify OMAP PM that off-mode is disabled
108 * Intended for use only by OMAP PM core code to notify this layer
109 * that off mode has been disabled.
111 void omap_pm_disable_off_mode(void)
113 off_mode_enabled
= false;
117 * Device context loss tracking
120 #ifdef CONFIG_ARCH_OMAP2PLUS
122 int omap_pm_get_dev_context_loss_count(struct device
*dev
)
124 struct platform_device
*pdev
= to_platform_device(dev
);
130 if (dev
->pm_domain
== &omap_device_pm_domain
) {
131 count
= omap_device_get_context_loss_count(pdev
);
133 WARN_ONCE(off_mode_enabled
, "omap_pm: using dummy context loss counter; device %s should be converted to omap_device",
136 count
= dummy_context_loss_counter
;
138 if (off_mode_enabled
) {
141 * Context loss count has to be a non-negative value.
142 * Clear the sign bit to get a value range from 0 to
146 dummy_context_loss_counter
= count
;
150 pr_debug("OMAP PM: context loss count for dev %s = %d\n",
151 dev_name(dev
), count
);
158 int omap_pm_get_dev_context_loss_count(struct device
*dev
)
160 return dummy_context_loss_counter
;
165 /* Should be called before clk framework init */
166 int __init
omap_pm_if_early_init(void)
171 /* Must be called after clock framework is initialized */
172 int __init
omap_pm_if_init(void)