mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-27 03:10:12 +00:00
e17ba7f202
hungarian notation will be removed from the elements inside structures, the next varibles will be renamed: Original: Replacement: pfn_brd_set_state brd_set_state pfn_brd_start brd_start pfn_brd_status brd_status pfn_brd_stop brd_stop pfn_brd_write brd_write pfn_chnl_add_io_req chnl_add_io_req pfn_chnl_cancel_io chnl_cancel_io pfn_chnl_close chnl_close pfn_chnl_create chnl_create pfn_chnl_destroy chnl_destroy pfn_chnl_flush_io chnl_flush_io pfn_chnl_get_info chnl_get_info pfn_chnl_get_ioc chnl_get_ioc pfn_chnl_get_mgr_info chnl_get_mgr_info pfn_chnl_idle chnl_idle pfn_chnl_open chnl_open pfn_chnl_register_notify chnl_register_notify pfn_create create pfn_delete delete pfn_dev_cntrl dev_cntrl Signed-off-by: Rene Sapiens <rene.sapiens@ti.com> Signed-off-by: Armando Uribe <x0095078@ti.com> Signed-off-by: Omar Ramirez Luna <omar.ramirez@ti.com>
176 lines
4.6 KiB
C
176 lines
4.6 KiB
C
/*
|
|
* pwr.c
|
|
*
|
|
* DSP-BIOS Bridge driver support functions for TI OMAP processors.
|
|
*
|
|
* PWR API for controlling DSP power states.
|
|
*
|
|
* Copyright (C) 2005-2006 Texas Instruments, Inc.
|
|
*
|
|
* This package is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
* published by the Free Software Foundation.
|
|
*
|
|
* THIS PACKAGE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR
|
|
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
|
|
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
|
|
*/
|
|
|
|
/* ----------------------------------- Host OS */
|
|
#include <dspbridge/host_os.h>
|
|
|
|
/* ----------------------------------- This */
|
|
#include <dspbridge/pwr.h>
|
|
|
|
/* ----------------------------------- Resource Manager */
|
|
#include <dspbridge/devdefs.h>
|
|
#include <dspbridge/drv.h>
|
|
|
|
/* ----------------------------------- Platform Manager */
|
|
#include <dspbridge/dev.h>
|
|
|
|
/* ----------------------------------- Link Driver */
|
|
#include <dspbridge/dspioctl.h>
|
|
|
|
/*
|
|
* ======== pwr_sleep_dsp ========
|
|
* Send command to DSP to enter sleep state.
|
|
*/
|
|
int pwr_sleep_dsp(const u32 sleep_code, const u32 timeout)
|
|
{
|
|
struct bridge_drv_interface *intf_fxns;
|
|
struct bridge_dev_context *dw_context;
|
|
int status = -EPERM;
|
|
struct dev_object *hdev_obj = NULL;
|
|
u32 ioctlcode = 0;
|
|
u32 arg = timeout;
|
|
|
|
for (hdev_obj = (struct dev_object *)drv_get_first_dev_object();
|
|
hdev_obj != NULL;
|
|
hdev_obj =
|
|
(struct dev_object *)drv_get_next_dev_object((u32) hdev_obj)) {
|
|
if (dev_get_bridge_context(hdev_obj,
|
|
(struct bridge_dev_context **)
|
|
&dw_context)) {
|
|
continue;
|
|
}
|
|
if (dev_get_intf_fxns(hdev_obj,
|
|
(struct bridge_drv_interface **)
|
|
&intf_fxns)) {
|
|
continue;
|
|
}
|
|
if (sleep_code == PWR_DEEPSLEEP)
|
|
ioctlcode = BRDIOCTL_DEEPSLEEP;
|
|
else if (sleep_code == PWR_EMERGENCYDEEPSLEEP)
|
|
ioctlcode = BRDIOCTL_EMERGENCYSLEEP;
|
|
else
|
|
status = -EINVAL;
|
|
|
|
if (status != -EINVAL) {
|
|
status = (*intf_fxns->dev_cntrl) (dw_context,
|
|
ioctlcode,
|
|
(void *)&arg);
|
|
}
|
|
}
|
|
return status;
|
|
}
|
|
|
|
/*
|
|
* ======== pwr_wake_dsp ========
|
|
* Send command to DSP to wake it from sleep.
|
|
*/
|
|
int pwr_wake_dsp(const u32 timeout)
|
|
{
|
|
struct bridge_drv_interface *intf_fxns;
|
|
struct bridge_dev_context *dw_context;
|
|
int status = -EPERM;
|
|
struct dev_object *hdev_obj = NULL;
|
|
u32 arg = timeout;
|
|
|
|
for (hdev_obj = (struct dev_object *)drv_get_first_dev_object();
|
|
hdev_obj != NULL;
|
|
hdev_obj = (struct dev_object *)drv_get_next_dev_object
|
|
((u32) hdev_obj)) {
|
|
if (!(dev_get_bridge_context(hdev_obj,
|
|
(struct bridge_dev_context
|
|
**)&dw_context))) {
|
|
if (!(dev_get_intf_fxns(hdev_obj,
|
|
(struct bridge_drv_interface **)&intf_fxns))) {
|
|
status =
|
|
(*intf_fxns->dev_cntrl) (dw_context,
|
|
BRDIOCTL_WAKEUP,
|
|
(void *)&arg);
|
|
}
|
|
}
|
|
}
|
|
return status;
|
|
}
|
|
|
|
/*
|
|
* ======== pwr_pm_pre_scale========
|
|
* Sends pre-notification message to DSP.
|
|
*/
|
|
int pwr_pm_pre_scale(u16 voltage_domain, u32 level)
|
|
{
|
|
struct bridge_drv_interface *intf_fxns;
|
|
struct bridge_dev_context *dw_context;
|
|
int status = -EPERM;
|
|
struct dev_object *hdev_obj = NULL;
|
|
u32 arg[2];
|
|
|
|
arg[0] = voltage_domain;
|
|
arg[1] = level;
|
|
|
|
for (hdev_obj = (struct dev_object *)drv_get_first_dev_object();
|
|
hdev_obj != NULL;
|
|
hdev_obj = (struct dev_object *)drv_get_next_dev_object
|
|
((u32) hdev_obj)) {
|
|
if (!(dev_get_bridge_context(hdev_obj,
|
|
(struct bridge_dev_context
|
|
**)&dw_context))) {
|
|
if (!(dev_get_intf_fxns(hdev_obj,
|
|
(struct bridge_drv_interface **)&intf_fxns))) {
|
|
status =
|
|
(*intf_fxns->dev_cntrl) (dw_context,
|
|
BRDIOCTL_PRESCALE_NOTIFY,
|
|
(void *)&arg);
|
|
}
|
|
}
|
|
}
|
|
return status;
|
|
}
|
|
|
|
/*
|
|
* ======== pwr_pm_post_scale========
|
|
* Sends post-notification message to DSP.
|
|
*/
|
|
int pwr_pm_post_scale(u16 voltage_domain, u32 level)
|
|
{
|
|
struct bridge_drv_interface *intf_fxns;
|
|
struct bridge_dev_context *dw_context;
|
|
int status = -EPERM;
|
|
struct dev_object *hdev_obj = NULL;
|
|
u32 arg[2];
|
|
|
|
arg[0] = voltage_domain;
|
|
arg[1] = level;
|
|
|
|
for (hdev_obj = (struct dev_object *)drv_get_first_dev_object();
|
|
hdev_obj != NULL;
|
|
hdev_obj = (struct dev_object *)drv_get_next_dev_object
|
|
((u32) hdev_obj)) {
|
|
if (!(dev_get_bridge_context(hdev_obj,
|
|
(struct bridge_dev_context
|
|
**)&dw_context))) {
|
|
if (!(dev_get_intf_fxns(hdev_obj,
|
|
(struct bridge_drv_interface **)&intf_fxns))) {
|
|
status =
|
|
(*intf_fxns->dev_cntrl) (dw_context,
|
|
BRDIOCTL_POSTSCALE_NOTIFY,
|
|
(void *)&arg);
|
|
}
|
|
}
|
|
}
|
|
return status;
|
|
|
|
}
|