S32K1xx: Fixed PM bug for clockconfig

This commit is contained in:
Cis van Mierlo 2022-08-19 11:05:45 +02:00 committed by David Sidrane
parent 27e8d058e7
commit 2c42b93962
3 changed files with 46 additions and 7 deletions

View File

@ -2546,13 +2546,6 @@ int s32k1xx_clockconfig(const struct clock_configuration_s *clkcfg)
DEBUGASSERT(clkcfg != NULL);
#ifdef CONFIG_PM
/* Register to receive power management callbacks */
ret = pm_register(&g_clock_pmcb);
DEBUGASSERT(ret == OK);
#endif
/* Set SCG configuration */
ret = s32k1xx_scg_config(&clkcfg->scg);
@ -2578,6 +2571,29 @@ int s32k1xx_clockconfig(const struct clock_configuration_s *clkcfg)
return ret;
}
/****************************************************************************
* Name: s32k1xx_clock_pm_register
*
* Description:
* This function is called after OS and PM init in order to register to
* receive power management event callbacks.
*
* Input Parameters:
* None
*
* Returned Values:
* None
*
****************************************************************************/
#ifdef CONFIG_PM
void s32k1xx_clock_pm_register(void)
{
/* Register to receive power management callbacks */
pm_register(&g_clock_pmcb);
}
#endif
/****************************************************************************
* Name: s32k1xx_get_coreclk
*

View File

@ -525,6 +525,24 @@ enum scg_system_clock_mode_e s32k1xx_set_runmode(enum scg_system_clock_mode_e
int s32k1xx_clockconfig(const struct clock_configuration_s *clkcfg);
/****************************************************************************
* Name: s32k1xx_clock_pm_register
*
* Description:
* This function is called after OS and PM init in order to register to
* receive power management event callbacks.
*
* Input Parameters:
* None
*
* Returned Values:
* None
*
****************************************************************************/
#ifdef CONFIG_PM
void s32k1xx_clock_pm_register(void);
#endif
/****************************************************************************
* Name: s32k1xx_get_coreclk
*

View File

@ -25,6 +25,7 @@
#include <nuttx/config.h>
#include <nuttx/power/pm.h>
#include "s32k1xx_clockconfig.h"
#include "arm_internal.h"
#ifdef CONFIG_PM
@ -56,6 +57,10 @@ void arm_pminitialize(void)
/* Initialize the NuttX power management subsystem proper */
pm_initialize();
/* Register clockconfig first to receive power management callbacks */
s32k1xx_clock_pm_register();
}
#endif /* CONFIG_PM */