From 32acc35c88e80114f8bfaf54ba3284599e278188 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sun, 27 Mar 2016 11:18:54 -0600 Subject: [PATCH] PM: Add activity domain to all PM callbacks --- arch/arm/src/efm32/efm32_idle.c | 8 +++++--- arch/arm/src/kl/kl_idle.c | 8 +++++--- arch/arm/src/lpc43xx/lpc43_idle.c | 10 ++++------ arch/arm/src/nuc1xx/nuc_idle.c | 10 ++++------ arch/arm/src/samdl/sam_idle.c | 10 ++++------ arch/arm/src/stm32/stm32_idle.c | 10 ++++------ arch/arm/src/stm32/stm32_serial.c | 14 +++++++++----- arch/arm/src/stm32f7/stm32_serial.c | 14 +++++++++----- arch/arm/src/stm32l4/stm32l4_idle.c | 10 ++++------ arch/arm/src/stm32l4/stm32l4_serial.c | 14 +++++++++----- arch/sim/src/up_idle.c | 8 +++++++- 11 files changed, 64 insertions(+), 52 deletions(-) diff --git a/arch/arm/src/efm32/efm32_idle.c b/arch/arm/src/efm32/efm32_idle.c index 5c3d6270bcf..4caad013742 100644 --- a/arch/arm/src/efm32/efm32_idle.c +++ b/arch/arm/src/efm32/efm32_idle.c @@ -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 * * 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 { diff --git a/arch/arm/src/kl/kl_idle.c b/arch/arm/src/kl/kl_idle.c index 380291611d2..b650057c6de 100644 --- a/arch/arm/src/kl/kl_idle.c +++ b/arch/arm/src/kl/kl_idle.c @@ -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 * * 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 { diff --git a/arch/arm/src/lpc43xx/lpc43_idle.c b/arch/arm/src/lpc43xx/lpc43_idle.c index cd59d9d1ab4..edd53852e44 100644 --- a/arch/arm/src/lpc43xx/lpc43_idle.c +++ b/arch/arm/src/lpc43xx/lpc43_idle.c @@ -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 * * 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 { diff --git a/arch/arm/src/nuc1xx/nuc_idle.c b/arch/arm/src/nuc1xx/nuc_idle.c index db4c46e796a..7bd396f145f 100644 --- a/arch/arm/src/nuc1xx/nuc_idle.c +++ b/arch/arm/src/nuc1xx/nuc_idle.c @@ -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 * * 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 { diff --git a/arch/arm/src/samdl/sam_idle.c b/arch/arm/src/samdl/sam_idle.c index 97326e342d7..5f8593c5e02 100644 --- a/arch/arm/src/samdl/sam_idle.c +++ b/arch/arm/src/samdl/sam_idle.c @@ -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 * * 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 { diff --git a/arch/arm/src/stm32/stm32_idle.c b/arch/arm/src/stm32/stm32_idle.c index 54553e974dd..c26ea8b4946 100644 --- a/arch/arm/src/stm32/stm32_idle.c +++ b/arch/arm/src/stm32/stm32_idle.c @@ -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 * * 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 { diff --git a/arch/arm/src/stm32/stm32_serial.c b/arch/arm/src/stm32/stm32_serial.c index 25927cad732..c7cef9debfc 100644 --- a/arch/arm/src/stm32/stm32_serial.c +++ b/arch/arm/src/stm32/stm32_serial.c @@ -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 * * 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. */ diff --git a/arch/arm/src/stm32f7/stm32_serial.c b/arch/arm/src/stm32f7/stm32_serial.c index bdc3717ed42..497781889dc 100644 --- a/arch/arm/src/stm32f7/stm32_serial.c +++ b/arch/arm/src/stm32f7/stm32_serial.c @@ -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 * * 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. */ diff --git a/arch/arm/src/stm32l4/stm32l4_idle.c b/arch/arm/src/stm32l4/stm32l4_idle.c index c1046508e90..e8ee411cdc7 100644 --- a/arch/arm/src/stm32l4/stm32l4_idle.c +++ b/arch/arm/src/stm32l4/stm32l4_idle.c @@ -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 * * 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 { diff --git a/arch/arm/src/stm32l4/stm32l4_serial.c b/arch/arm/src/stm32l4/stm32l4_serial.c index 734ea211d9e..5918ff1a2fd 100644 --- a/arch/arm/src/stm32l4/stm32l4_serial.c +++ b/arch/arm/src/stm32l4/stm32l4_serial.c @@ -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 * * 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. */ diff --git a/arch/sim/src/up_idle.c b/arch/sim/src/up_idle.c index 1459845c15c..2e80a26562c 100644 --- a/arch/sim/src/up_idle.c +++ b/arch/sim/src/up_idle.c @@ -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; }