PM: Add activity domain to all PM callbacks
This commit is contained in:
parent
8b21db7fc7
commit
dea4fe5d90
@ -11587,3 +11587,6 @@
|
||||
board. From Dave (2016-03-25).
|
||||
|
||||
7.16 2016-xx-xx Gregory Nutt <gnutt@nuttx.org>
|
||||
|
||||
* PM: Add activity domain to all PM driver callbacks (2016-03-27).
|
||||
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit ce8bd7e82a4418b24c6c04026f6019d8e0ffe849
|
||||
Subproject commit a15cb168507bf218b37a3325902df18085ede4a6
|
2
arch
2
arch
@ -1 +1 @@
|
||||
Subproject commit 9da37a0989a52853fe27bb4acadf52dc155e7440
|
||||
Subproject commit f4b99ebe1fd5ab77e9a6adda04611787b4a26205
|
2
configs
2
configs
@ -1 +1 @@
|
||||
Subproject commit ed6b75b8a0531a2d59629d0a128f01b89b5f32f6
|
||||
Subproject commit 07937231ef92ab88e2043dc9a17d2d677e26903c
|
@ -26,6 +26,15 @@ config PM_SLICEMS
|
||||
CONFIG_PM_SLICEMS provides the duration of that time slice in
|
||||
milliseconds. Default: 100 Milliseconds
|
||||
|
||||
config PM_NDOMAINS
|
||||
int "Number of PM activity domains"
|
||||
default 1
|
||||
---help---
|
||||
Defines the number of "domains" that activity may be monitored on.
|
||||
For example, you may want to separately manage the power from the
|
||||
Network domain, shutting down the network when it is not be used,
|
||||
from the UI domain, shutting down the UI when it is not in use.
|
||||
|
||||
config PM_MEMORY
|
||||
int "PM memory (msec)"
|
||||
default 2
|
||||
|
@ -1,7 +1,7 @@
|
||||
/****************************************************************************
|
||||
* drivers/power/pm_changestate.c
|
||||
*
|
||||
* Copyright (C) 2011-2012 Gregory Nutt. All rights reserved.
|
||||
* Copyright (C) 2011-2012, 2016 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <gnutt@nuttx.org>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
@ -77,6 +77,7 @@
|
||||
* Prepare every driver for the state change.
|
||||
*
|
||||
* Input Parameters:
|
||||
* domain - Identifies the domain of the new PM state
|
||||
* newstate - Identifies the new PM state
|
||||
*
|
||||
* Returned Value:
|
||||
@ -90,7 +91,7 @@
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static int pm_prepall(enum pm_state_e newstate)
|
||||
static int pm_prepall(int domain, enum pm_state_e newstate)
|
||||
{
|
||||
FAR sq_entry_t *entry;
|
||||
int ret = OK;
|
||||
@ -108,7 +109,7 @@ static int pm_prepall(enum pm_state_e newstate)
|
||||
{
|
||||
/* Yes.. prepare the driver */
|
||||
|
||||
ret = cb->prepare(cb, newstate);
|
||||
ret = cb->prepare(cb, domain, newstate);
|
||||
}
|
||||
}
|
||||
|
||||
@ -119,9 +120,11 @@ static int pm_prepall(enum pm_state_e newstate)
|
||||
* Name: pm_changeall
|
||||
*
|
||||
* Description:
|
||||
* domain - Identifies the domain of the new PM state
|
||||
* Inform all drivers of the state change.
|
||||
*
|
||||
* Input Parameters:
|
||||
* domain - Identifies the domain of the new PM state
|
||||
* newstate - Identifies the new PM state
|
||||
*
|
||||
* Returned Value:
|
||||
@ -132,7 +135,7 @@ static int pm_prepall(enum pm_state_e newstate)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
static inline void pm_changeall(enum pm_state_e newstate)
|
||||
static inline void pm_changeall(int domain, enum pm_state_e newstate)
|
||||
{
|
||||
FAR sq_entry_t *entry;
|
||||
|
||||
@ -147,7 +150,7 @@ static inline void pm_changeall(enum pm_state_e newstate)
|
||||
{
|
||||
/* Yes.. notify the driver */
|
||||
|
||||
cb->notify(cb, newstate);
|
||||
cb->notify(cb, domain, newstate);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -165,6 +168,7 @@ static inline void pm_changeall(enum pm_state_e newstate)
|
||||
* drivers that have registered for power management event callbacks.
|
||||
*
|
||||
* Input Parameters:
|
||||
* domain - Identifies the domain of the new PM state
|
||||
* newstate - Identifies the new PM state
|
||||
*
|
||||
* Returned Value:
|
||||
@ -183,11 +187,13 @@ static inline void pm_changeall(enum pm_state_e newstate)
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int pm_changestate(enum pm_state_e newstate)
|
||||
int pm_changestate(int domain, enum pm_state_e newstate)
|
||||
{
|
||||
irqstate_t flags;
|
||||
int ret;
|
||||
|
||||
DEBUGASSERT(domain >=0 && domain < CONFIG_PM_NDOMAINS);
|
||||
|
||||
/* Disable interrupts throught this operation... changing driver states
|
||||
* could cause additional driver activity that might interfere with the
|
||||
* state change. When the state change is complete, interrupts will be
|
||||
@ -200,7 +206,7 @@ int pm_changestate(enum pm_state_e newstate)
|
||||
* drivers may refuse the state state change.
|
||||
*/
|
||||
|
||||
ret = pm_prepall(newstate);
|
||||
ret = pm_prepall(domain, newstate);
|
||||
if (ret != OK)
|
||||
{
|
||||
/* One or more drivers is not ready for this state change. Revert to
|
||||
@ -208,14 +214,14 @@ int pm_changestate(enum pm_state_e newstate)
|
||||
*/
|
||||
|
||||
newstate = g_pmglobals.state;
|
||||
(void)pm_prepall(newstate);
|
||||
(void)pm_prepall(domain, newstate);
|
||||
}
|
||||
|
||||
/* All drivers have agreed to the state change (or, one or more have
|
||||
* disagreed and the state has been reverted). Set the new state.
|
||||
*/
|
||||
|
||||
pm_changeall(newstate);
|
||||
pm_changeall(domain, newstate);
|
||||
g_pmglobals.state = newstate;
|
||||
|
||||
/* Restore the interrupt state */
|
||||
|
@ -78,6 +78,20 @@
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
/* Configuration ************************************************************/
|
||||
/* CONFIG_PM_NDOMAINS. Defines the number of "domains" that activity may be
|
||||
* monitored on. For example, you may want to separately manage the power
|
||||
* from the Network domain, shutting down the network when it is not be used,
|
||||
* from the UI domain, shutting down the UI when it is not in use.
|
||||
*/
|
||||
|
||||
#ifndef CONFIG_PM_NDOMAINS
|
||||
# define CONFIG_PM_NDOMAINS 1
|
||||
#endif
|
||||
|
||||
#if CONFIG_PM_NDOMAINS < 1
|
||||
# error CONFIG_PM_NDOMAINS invalid
|
||||
#endif
|
||||
|
||||
/* CONFIG_IDLE_CUSTOM. Some architectures support this definition. This,
|
||||
* if defined, will allow you replace the default IDLE loop with your
|
||||
* own, custom idle loop to support board-specific IDLE time power management
|
||||
@ -278,6 +292,7 @@ struct pm_callback_s
|
||||
* cb - Returned to the driver. The driver version of the callback
|
||||
* structure may include additional, driver-specific state
|
||||
* data at the end of the structure.
|
||||
* domain - Identifies the activity domain of the state change
|
||||
* pmstate - Identifies the new PM state
|
||||
*
|
||||
* Returned Value:
|
||||
@ -292,7 +307,8 @@ struct pm_callback_s
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
int (*prepare)(FAR struct pm_callback_s *cb, enum pm_state_e pmstate);
|
||||
int (*prepare)(FAR struct pm_callback_s *cb, int domain,
|
||||
enum pm_state_e pmstate);
|
||||
|
||||
/**************************************************************************
|
||||
* Name: notify
|
||||
@ -306,6 +322,7 @@ struct pm_callback_s
|
||||
* cb - Returned to the driver. The driver version of the callback
|
||||
* structure may include additional, driver-specific state
|
||||
* data at the end of the structure.
|
||||
* domain - Identifies the activity domain of the state change
|
||||
* pmstate - Identifies the new PM state
|
||||
*
|
||||
* Returned Value:
|
||||
@ -316,7 +333,8 @@ struct pm_callback_s
|
||||
*
|
||||
**************************************************************************/
|
||||
|
||||
void (*notify)(FAR struct pm_callback_s *cb, enum pm_state_e pmstate);
|
||||
void (*notify)(FAR struct pm_callback_s *cb, int domain,
|
||||
enum pm_state_e pmstate);
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
@ -444,6 +462,7 @@ enum pm_state_e pm_checkstate(void);
|
||||
* drivers that have registered for power management event callbacks.
|
||||
*
|
||||
* Input Parameters:
|
||||
* domain - Identifies the domain of the new PM state
|
||||
* newstate - Identifies the new PM state
|
||||
*
|
||||
* Returned Value:
|
||||
@ -462,7 +481,7 @@ enum pm_state_e pm_checkstate(void);
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
int pm_changestate(enum pm_state_e newstate);
|
||||
int pm_changestate(int domain, enum pm_state_e newstate);
|
||||
|
||||
#undef EXTERN
|
||||
#ifdef __cplusplus
|
||||
|
Loading…
x
Reference in New Issue
Block a user