This is an automated email from the ASF dual-hosted git repository. jerpelea pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-nuttx.git
commit db340a8941769712bc5e2b93d0aae1ca48628243 Author: SPRESENSE <41312067+sprese...@users.noreply.github.com> AuthorDate: Wed May 19 17:03:49 2021 +0900 arch: cxd56xx: Support for suppresion of clock change Introduce PM_CPUFREQLOCK_FLAG_HOLD into the frequency lock mechanism in power manager, which is used to keep the current frequency without clock change, for example, during the transfer of a periphral. --- arch/arm/include/cxd56xx/pm.h | 5 +++-- arch/arm/src/cxd56xx/cxd56_powermgr.c | 15 +++++++++++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/arch/arm/include/cxd56xx/pm.h b/arch/arm/include/cxd56xx/pm.h index 824a0a3..fe3ab71 100644 --- a/arch/arm/include/cxd56xx/pm.h +++ b/arch/arm/include/cxd56xx/pm.h @@ -62,8 +62,9 @@ /* FrequencyLock request flag definitions */ -#define PM_CPUFREQLOCK_FLAG_HV (0x0001) /* request HV */ -#define PM_CPUFREQLOCK_FLAG_LV (0x4000) /* request LV */ +#define PM_CPUFREQLOCK_FLAG_HV (0x0001) /* request HV */ +#define PM_CPUFREQLOCK_FLAG_LV (0x4000) /* request LV */ +#define PM_CPUFREQLOCK_FLAG_HOLD (0x8000) /* hold the current frequency */ /* FrequencyLock identifier tag helper macro function */ diff --git a/arch/arm/src/cxd56xx/cxd56_powermgr.c b/arch/arm/src/cxd56xx/cxd56_powermgr.c index 489216a..00acf5f 100644 --- a/arch/arm/src/cxd56xx/cxd56_powermgr.c +++ b/arch/arm/src/cxd56xx/cxd56_powermgr.c @@ -577,6 +577,13 @@ void up_pm_acquire_freqlock(struct pm_cpu_freqlock_s *lock) cxd56_pm_semtake(&g_freqlock); + if (lock->flag == PM_CPUFREQLOCK_FLAG_HOLD) + { + /* Return with holding the current frequency */ + + return; + } + for (entry = sq_peek(&g_freqlockqueue); entry; entry = sq_next(entry)) { if (entry == (struct sq_entry_s *)lock) @@ -616,6 +623,13 @@ void up_pm_release_freqlock(struct pm_cpu_freqlock_s *lock) DEBUGASSERT(lock); + if (lock->flag == PM_CPUFREQLOCK_FLAG_HOLD) + { + /* Release holding the current frequency */ + + goto exit; + } + up_pm_acquire_wakelock(&g_wlock); cxd56_pm_semtake(&g_freqlock); @@ -634,6 +648,7 @@ void up_pm_release_freqlock(struct pm_cpu_freqlock_s *lock) } } +exit: nxsem_post(&g_freqlock); up_pm_release_wakelock(&g_wlock);