diff --git a/arch/arm/include/cxd56xx/pm.h b/arch/arm/include/cxd56xx/pm.h index 824a0a3054..fe3ab71699 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 489216a867..00acf5ff08 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);