PM: Add domain to all PM interfaces. Internal PM data structures now handle multiple PM domains.

This commit is contained in:
Gregory Nutt 2016-03-27 13:02:21 -06:00
parent 0e8ff50d18
commit 76c4b11a6b
9 changed files with 39 additions and 19 deletions

View File

@ -119,7 +119,7 @@ static void up_idlepm(void)
/* Decide, which power saving level can be obtained */
newstate = pm_checkstate();
newstate = pm_checkstate(PM_IDLE_DOMAIN);
/* Check for state changes */

View File

@ -760,6 +760,24 @@ CONFIG_LCD_RPORTRAIT=y
# CONFIG_EEPROM is not set
# CONFIG_PIPES is not set
CONFIG_PM=y
CONFIG_PM_SLICEMS=100
CONFIG_PM_NDOMAINS=1
CONFIG_PM_MEMORY=2
CONFIG_PM_COEFN=1
CONFIG_PM_COEF1=1
CONFIG_PM_COEF2=1
CONFIG_PM_COEF3=1
CONFIG_PM_COEF4=1
CONFIG_PM_COEF5=1
CONFIG_PM_IDLEENTER_THRESH=1
CONFIG_PM_IDLEEXIT_THRESH=2
CONFIG_PM_IDLEENTER_COUNT=30
CONFIG_PM_STANDBYENTER_THRESH=1
CONFIG_PM_STANDBYEXIT_THRESH=2
CONFIG_PM_STANDBYENTER_COUNT=50
CONFIG_PM_SLEEPENTER_THRESH=1
CONFIG_PM_SLEEPEXIT_THRESH=2
CONFIG_PM_SLEEPENTER_COUNT=70
# CONFIG_POWER is not set
# CONFIG_SENSORS is not set
# CONFIG_SERCOMM_CONSOLE is not set

View File

@ -49,10 +49,6 @@
#ifdef CONFIG_ARCH_BUTTONS
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
/****************************************************************************
* Private Data
****************************************************************************/

View File

@ -283,7 +283,7 @@ static void stm32_idlepm(void)
{
/* Let the PM system decide, which power saving level can be obtained */
newstate = pm_checkstate();
newstate = pm_checkstate(PM_IDLE_DOMAIN);
}
/* Check for state changes */

View File

@ -1,7 +1,7 @@
/****************************************************************************
* configs/stm3210e-eval/src/stm32_pmbuttons.c
*
* Copyright (C) 2012, 2015 Gregory Nutt. All rights reserved.
* Copyright (C) 2012, 2015-2016 Gregory Nutt. All rights reserved.
* Authors: Gregory Nutt <gnutt@nuttx.org>
* Diego Sanchez <dsanchez@nx-engineering.com>
*
@ -111,6 +111,8 @@
# define CONFIG_PM_BUTTON_ACTIVITY 10
#endif
#define PM_IDLE_DOMAIN 0 /* Revisit */
/* Miscellaneous Definitions ************************************************/
#ifndef MIN
@ -221,7 +223,7 @@ static void button_handler(int id, int irq)
* special happened.
*/
pm_activity(CONFIG_PM_BUTTON_ACTIVITY);
pm_activity(PM_IDLE_DOMAIN, CONFIG_PM_BUTTON_ACTIVITY);
}
#if MIN_BUTTON < 1

View File

@ -119,7 +119,7 @@ static void stm32_idlepm(void)
/* Decide, which power saving level can be obtained */
newstate = pm_checkstate();
newstate = pm_checkstate(PM_IDLE_DOMAIN);
/* Check for state changes */

View File

@ -116,7 +116,7 @@ static void stm32_idlepm(void)
/* Decide, which power saving level can be obtained */
newstate = pm_checkstate();
newstate = pm_checkstate(PM_IDLE_DOMAIN);
/* Check for state changes */
@ -133,7 +133,7 @@ static void stm32_idlepm(void)
{
/* The new state change failed, revert to the preceding state */
(void)pm_changestatePM_IDLE_DOMAIN, oldstate);
(void)pm_changestate(PM_IDLE_DOMAIN, oldstate);
/* No state change... */

View File

@ -1,7 +1,7 @@
/****************************************************************************
* configs/stm32f4discovery/src/stm32_pm_buttons.c
*
* Copyright (C) 2012, 2015 Gregory Nutt. All rights reserved.
* Copyright (C) 2012, 2015-2016 Gregory Nutt. All rights reserved.
* Authors: Gregory Nutt <gnutt@nuttx.org>
* Diego Sanchez <dsanchez@nx-engineering.com>
*
@ -73,6 +73,8 @@
# define CONFIG_PM_BUTTON_ACTIVITY 10
#endif
#define PM_IDLE_DOMAIN 0 /* Revisit */
/****************************************************************************
* Private Types
****************************************************************************/
@ -111,7 +113,7 @@ static int button_handler(int irq, FAR void *context)
* special happened.
*/
pm_activity(CONFIG_PM_BUTTON_ACTIVITY);
pm_activity(PM_IDLE_DOMAIN, CONFIG_PM_BUTTON_ACTIVITY);
return OK;
}
#endif /* CONFIG_ARCH_IRQBUTTONS */

View File

@ -54,10 +54,12 @@
* Pre-processor Definitions
****************************************************************************/
#ifndef CONFIG_PM_BUTTON_ACTIVITY
#ifndef CONFIG_PM_BUTTON_ACTIVITY
# define CONFIG_PM_BUTTON_ACTIVITY 10
#endif
#define PM_IDLE_DOMAIN 0 /* Revisit */
/****************************************************************************
* Private Function Prototypes
****************************************************************************/
@ -176,6 +178,7 @@ static void button_pm_notify(struct pm_callback_s *cb, int domain,
#ifdef CONFIG_ARCH_IRQBUTTONS
static int button_handler(int irq, FAR void *context)
{
#ifdef CONFIG_PM
/* At this point the MCU should have already awakened. The state
* change will be handled in the IDLE loop when the system is re-awakened
* The button interrupt handler should be totally ignorant of the PM
@ -183,8 +186,7 @@ static int button_handler(int irq, FAR void *context)
* special happened.
*/
#ifdef CONFIG_PM
pm_activity(CONFIG_PM_BUTTON_ACTIVITY);
pm_activity(PM_IDLE_DOMAIN, CONFIG_PM_BUTTON_ACTIVITY);
#endif
return OK;
}
@ -285,14 +287,14 @@ uint8_t board_buttons(void)
}
}
#ifdef CONFIG_PM
/* if the user pressed any buttons, notify power management system we are
* active
*/
#ifdef CONFIG_PM
if ( 0 != ret )
if (0 != ret)
{
pm_activity(CONFIG_PM_BUTTON_ACTIVITY);
pm_activity(PM_IDLE_DOMAIN, CONFIG_PM_BUTTON_ACTIVITY);
}
#endif