PM: Add activity domain to all PM callbacks

This commit is contained in:
Gregory Nutt 2016-03-27 11:18:54 -06:00
parent a52f638d7e
commit 32acc35c88
11 changed files with 64 additions and 52 deletions

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/arm/src/efm32/efm32_idle.c
*
* Copyright (C) 2014-2015 Gregory Nutt. All rights reserved.
* Copyright (C) 2014-2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -68,6 +68,8 @@
# define END_IDLE()
#endif
#define PM_IDLE_DOMAIN 0 /* Revisit */
/****************************************************************************
* Private Data
****************************************************************************/
@ -112,12 +114,12 @@ static void up_idlepm(void)
/* Then force the global state change */
ret = pm_changestate(newstate);
ret = pm_changestate(PM_IDLE_DOMAIN, newstate);
if (ret < 0)
{
/* The new state change failed, revert to the preceding state */
(void)pm_changestate(oldstate);
(void)pm_changestate(PM_IDLE_DOMAIN, oldstate);
}
else
{

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/arm/src/kl/kl_idle.c
*
* Copyright (C) 2013, 2015 Gregory Nutt. All rights reserved.
* Copyright (C) 2013, 2015-2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -65,6 +65,8 @@
# define END_IDLE()
#endif
#define PM_IDLE_DOMAIN 0 /* Revisit */
/****************************************************************************
* Private Data
****************************************************************************/
@ -105,12 +107,12 @@ static void up_idlepm(void)
/* Then force the global state change */
ret = pm_changestate(newstate);
ret = pm_changestate(PM_IDLE_DOMAIN, newstate);
if (ret < 0)
{
/* The new state change failed, revert to the preceding state */
(void)pm_changestate(oldstate);
(void)pm_changestate(PM_IDLE_DOMAIN, oldstate);
}
else
{

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/arm/src/lpc43/lpc43_idle.c
*
* Copyright (C) 2012, 2015 Gregory Nutt. All rights reserved.
* Copyright (C) 2012, 2015-2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -64,9 +64,7 @@
# define END_IDLE()
#endif
/****************************************************************************
* Private Data
****************************************************************************/
#define PM_IDLE_DOMAIN 0 /* Revisit */
/****************************************************************************
* Private Functions
@ -104,12 +102,12 @@ static void up_idlepm(void)
/* Then force the global state change */
ret = pm_changestate(newstate);
ret = pm_changestate(PM_IDLE_DOMAIN, newstate);
if (ret < 0)
{
/* The new state change failed, revert to the preceding state */
(void)pm_changestate(oldstate);
(void)pm_changestate(PM_IDLE_DOMAIN, oldstate);
}
else
{

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/arm/src/nuc1xx/nuc_idle.c
*
* Copyright (C) 2013, 2015 Gregory Nutt. All rights reserved.
* Copyright (C) 2013, 2015-2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -65,9 +65,7 @@
# define END_IDLE()
#endif
/****************************************************************************
* Private Data
****************************************************************************/
#define PM_IDLE_DOMAIN 0 /* Revisit */
/****************************************************************************
* Private Functions
@ -105,12 +103,12 @@ static void up_idlepm(void)
/* Then force the global state change */
ret = pm_changestate(newstate);
ret = pm_changestate(PM_IDLE_DOMAIN, newstate);
if (ret < 0)
{
/* The new state change failed, revert to the preceding state */
(void)pm_changestate(oldstate);
(void)pm_changestate(PM_IDLE_DOMAIN, oldstate);
}
else
{

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/arm/src/samdl/sam_idle.c
*
* Copyright (C) 2014, 2015 Gregory Nutt. All rights reserved.
* Copyright (C) 2014, 2015-2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -65,9 +65,7 @@
# define END_IDLE()
#endif
/****************************************************************************
* Private Data
****************************************************************************/
#define PM_IDLE_DOMAIN 0 /* Revisit */
/****************************************************************************
* Private Functions
@ -105,12 +103,12 @@ static void up_idlepm(void)
/* Then force the global state change */
ret = pm_changestate(newstate);
ret = pm_changestate(PM_IDLE_DOMAIN, newstate);
if (ret < 0)
{
/* The new state change failed, revert to the preceding state */
(void)pm_changestate(oldstate);
(void)pm_changestate(PM_IDLE_DOMAIN, oldstate);
}
else
{

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/arm/src/stm32/stm32_idle.c
*
* Copyright (C) 2011-2012, 2015 Gregory Nutt. All rights reserved.
* Copyright (C) 2011-2012, 2015-2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -67,9 +67,7 @@
# define END_IDLE()
#endif
/****************************************************************************
* Private Data
****************************************************************************/
#define PM_IDLE_DOMAIN 0 /* Revisit */
/****************************************************************************
* Private Functions
@ -107,12 +105,12 @@ static void up_idlepm(void)
/* Then force the global state change */
ret = pm_changestate(newstate);
ret = pm_changestate(PM_IDLE_DOMAIN, newstate);
if (ret < 0)
{
/* The new state change failed, revert to the preceding state */
(void)pm_changestate(oldstate);
(void)pm_changestate(PM_IDLE_DOMAIN, oldstate);
}
else
{

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/arm/src/stm32/stm32_serial.c
*
* Copyright (C) 2009-2014 Gregory Nutt. All rights reserved.
* Copyright (C) 2009-2014, 2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -363,8 +363,10 @@ static void up_dma_rxcallback(DMA_HANDLE handle, uint8_t status, void *arg);
#endif
#ifdef CONFIG_PM
static void up_pm_notify(struct pm_callback_s *cb, enum pm_state_e pmstate);
static int up_pm_prepare(struct pm_callback_s *cb, enum pm_state_e pmstate);
static void up_pm_notify(struct pm_callback_s *cb, int dowmin,
enum pm_state_e pmstate);
static int up_pm_prepare(struct pm_callback_s *cb, int domain,
enum pm_state_e pmstate);
#endif
#ifdef CONFIG_STM32_USART1
@ -2613,7 +2615,8 @@ static void up_dma_rxcallback(DMA_HANDLE handle, uint8_t status, void *arg)
****************************************************************************/
#ifdef CONFIG_PM
static void up_pm_notify(struct pm_callback_s *cb, enum pm_state_e pmstate)
static void up_pm_notify(struct pm_callback_s *cb, int domain,
enum pm_state_e pmstate)
{
switch (pmstate)
{
@ -2686,7 +2689,8 @@ static void up_pm_notify(struct pm_callback_s *cb, enum pm_state_e pmstate)
****************************************************************************/
#ifdef CONFIG_PM
static int up_pm_prepare(struct pm_callback_s *cb, enum pm_state_e pmstate)
static int up_pm_prepare(struct pm_callback_s *cb, int domain,
enum pm_state_e pmstate)
{
/* Logic to prepare for a reduced power state goes here. */

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/arm/src/stm32f7/stm32_serial.c
*
* Copyright (C) 2015 Gregory Nutt. All rights reserved.
* Copyright (C) 2015-2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -317,8 +317,10 @@ static void up_dma_rxcallback(DMA_HANDLE handle, uint8_t status, void *arg);
#endif
#ifdef CONFIG_PM
static void up_pm_notify(struct pm_callback_s *cb, enum pm_state_e pmstate);
static int up_pm_prepare(struct pm_callback_s *cb, enum pm_state_e pmstate);
static void up_pm_notify(struct pm_callback_s *cb, int domain,
enum pm_state_e pmstate);
static int up_pm_prepare(struct pm_callback_s *cb, int domain,
enum pm_state_e pmstate);
#endif
#ifdef CONFIG_STM32F7_USART1
@ -2543,7 +2545,8 @@ static void up_dma_rxcallback(DMA_HANDLE handle, uint8_t status, void *arg)
****************************************************************************/
#ifdef CONFIG_PM
static void up_pm_notify(struct pm_callback_s *cb, enum pm_state_e pmstate)
static void up_pm_notify(struct pm_callback_s *cb, int domain,
enum pm_state_e pmstate)
{
switch (pmstate)
{
@ -2616,7 +2619,8 @@ static void up_pm_notify(struct pm_callback_s *cb, enum pm_state_e pmstate)
****************************************************************************/
#ifdef CONFIG_PM
static int up_pm_prepare(struct pm_callback_s *cb, enum pm_state_e pmstate)
static int up_pm_prepare(struct pm_callback_s *cb, int domain,
enum pm_state_e pmstate)
{
/* Logic to prepare for a reduced power state goes here. */

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/arm/src/stm32l4/stm32l4_idle.c
*
* Copyright (C) 2011-2012, 2015 Gregory Nutt. All rights reserved.
* Copyright (C) 2011-2012, 2015-2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -67,9 +67,7 @@
# define END_IDLE()
#endif
/****************************************************************************
* Private Data
****************************************************************************/
#define PM_IDLE_DOMAIN 0 /* Revisit */
/****************************************************************************
* Private Functions
@ -107,12 +105,12 @@ static void up_idlepm(void)
/* Then force the global state change */
ret = pm_changestate(newstate);
ret = pm_changestate(PM_IDLE_DOMAIN, newstate);
if (ret < 0)
{
/* The new state change failed, revert to the preceding state */
(void)pm_changestate(oldstate);
(void)pm_changestate(PM_IDLE_DOMAIN, oldstate);
}
else
{

View File

@ -1,7 +1,7 @@
/****************************************************************************
* arch/arm/src/stm32l4/stm32l4_serial.c
*
* Copyright (C) 2009-2014 Gregory Nutt. All rights reserved.
* Copyright (C) 2009-2014, 2016 Gregory Nutt. All rights reserved.
* Author: Gregory Nutt <gnutt@nuttx.org>
*
* Redistribution and use in source and binary forms, with or without
@ -316,8 +316,10 @@ static void up_dma_rxcallback(DMA_HANDLE handle, uint8_t status, void *arg);
#endif
#ifdef CONFIG_PM
static void up_pm_notify(struct pm_callback_s *cb, enum pm_state_e pmstate);
static int up_pm_prepare(struct pm_callback_s *cb, enum pm_state_e pmstate);
static void up_pm_notify(struct pm_callback_s *cb, int domain,
enum pm_state_e pmstate);
static int up_pm_prepare(struct pm_callback_s *cb, int domain,
enum pm_state_e pmstate);
#endif
#ifdef CONFIG_STM32L4_USART1
@ -2255,7 +2257,8 @@ static void up_dma_rxcallback(DMA_HANDLE handle, uint8_t status, void *arg)
****************************************************************************/
#ifdef CONFIG_PM
static void up_pm_notify(struct pm_callback_s *cb, enum pm_state_e pmstate)
static void up_pm_notify(struct pm_callback_s *cb, int domain,
enum pm_state_e pmstate)
{
switch (pmstate)
{
@ -2328,7 +2331,8 @@ static void up_pm_notify(struct pm_callback_s *cb, enum pm_state_e pmstate)
****************************************************************************/
#ifdef CONFIG_PM
static int up_pm_prepare(struct pm_callback_s *cb, enum pm_state_e pmstate)
static int up_pm_prepare(struct pm_callback_s *cb, int domain,
enum pm_state_e pmstate)
{
/* Logic to prepare for a reduced power state goes here. */

View File

@ -54,6 +54,12 @@
#include "up_internal.h"
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
#define PM_IDLE_DOMAIN 0 /* Revisit */
/****************************************************************************
* Private Data
****************************************************************************/
@ -152,7 +158,7 @@ void up_idle(void)
newstate = pm_checkstate();
if (newstate != state)
{
if (pm_changestate(newstate) == OK)
if (pm_changestate(PM_IDLE_DOMAIN, newstate) == OK)
{
state = newstate;
}