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.
This commit is contained in:
SPRESENSE 2021-05-19 17:03:49 +09:00 committed by Alin Jerpelea
parent 9b3a80cc37
commit db340a8941
2 changed files with 18 additions and 2 deletions

View File

@ -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 */

View File

@ -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);