4 * DSP-BIOS Bridge driver support functions for TI OMAP processors.
6 * PWR API for controlling DSP power states.
8 * Copyright (C) 2005-2006 Texas Instruments, Inc.
10 * This package is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License version 2 as
12 * published by the Free Software Foundation.
14 * THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
15 * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
16 * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
19 /* ----------------------------------- Host OS */
20 #include <dspbridge/host_os.h>
22 /* ----------------------------------- This */
23 #include <dspbridge/pwr.h>
25 /* ----------------------------------- Resource Manager */
26 #include <dspbridge/devdefs.h>
27 #include <dspbridge/drv.h>
29 /* ----------------------------------- Platform Manager */
30 #include <dspbridge/dev.h>
32 /* ----------------------------------- Link Driver */
33 #include <dspbridge/dspioctl.h>
36 * ======== pwr_sleep_dsp ========
37 * Send command to DSP to enter sleep state.
39 int pwr_sleep_dsp(const u32 sleep_code, const u32 timeout)
41 struct bridge_drv_interface *intf_fxns;
42 struct bridge_dev_context *dw_context;
44 struct dev_object *hdev_obj = NULL;
48 for (hdev_obj = (struct dev_object *)drv_get_first_dev_object();
51 (struct dev_object *)drv_get_next_dev_object((u32) hdev_obj)) {
52 if (dev_get_bridge_context(hdev_obj,
53 (struct bridge_dev_context **)
57 if (dev_get_intf_fxns(hdev_obj,
58 (struct bridge_drv_interface **)
62 if (sleep_code == PWR_DEEPSLEEP)
63 ioctlcode = BRDIOCTL_DEEPSLEEP;
64 else if (sleep_code == PWR_EMERGENCYDEEPSLEEP)
65 ioctlcode = BRDIOCTL_EMERGENCYSLEEP;
69 if (status != -EINVAL) {
70 status = (*intf_fxns->dev_cntrl) (dw_context,
79 * ======== pwr_wake_dsp ========
80 * Send command to DSP to wake it from sleep.
82 int pwr_wake_dsp(const u32 timeout)
84 struct bridge_drv_interface *intf_fxns;
85 struct bridge_dev_context *dw_context;
87 struct dev_object *hdev_obj = NULL;
90 for (hdev_obj = (struct dev_object *)drv_get_first_dev_object();
92 hdev_obj = (struct dev_object *)drv_get_next_dev_object
94 if (!(dev_get_bridge_context(hdev_obj,
95 (struct bridge_dev_context
97 if (!(dev_get_intf_fxns(hdev_obj,
98 (struct bridge_drv_interface **)&intf_fxns))) {
100 (*intf_fxns->dev_cntrl) (dw_context,
110 * ======== pwr_pm_pre_scale========
111 * Sends pre-notification message to DSP.
113 int pwr_pm_pre_scale(u16 voltage_domain, u32 level)
115 struct bridge_drv_interface *intf_fxns;
116 struct bridge_dev_context *dw_context;
118 struct dev_object *hdev_obj = NULL;
121 arg[0] = voltage_domain;
124 for (hdev_obj = (struct dev_object *)drv_get_first_dev_object();
126 hdev_obj = (struct dev_object *)drv_get_next_dev_object
128 if (!(dev_get_bridge_context(hdev_obj,
129 (struct bridge_dev_context
131 if (!(dev_get_intf_fxns(hdev_obj,
132 (struct bridge_drv_interface **)&intf_fxns))) {
134 (*intf_fxns->dev_cntrl) (dw_context,
135 BRDIOCTL_PRESCALE_NOTIFY,
144 * ======== pwr_pm_post_scale========
145 * Sends post-notification message to DSP.
147 int pwr_pm_post_scale(u16 voltage_domain, u32 level)
149 struct bridge_drv_interface *intf_fxns;
150 struct bridge_dev_context *dw_context;
152 struct dev_object *hdev_obj = NULL;
155 arg[0] = voltage_domain;
158 for (hdev_obj = (struct dev_object *)drv_get_first_dev_object();
160 hdev_obj = (struct dev_object *)drv_get_next_dev_object
162 if (!(dev_get_bridge_context(hdev_obj,
163 (struct bridge_dev_context
165 if (!(dev_get_intf_fxns(hdev_obj,
166 (struct bridge_drv_interface **)&intf_fxns))) {
168 (*intf_fxns->dev_cntrl) (dw_context,
169 BRDIOCTL_POSTSCALE_NOTIFY,