drivers: video: isx019: Fix system clock to HV mode

ISX019 doesn't work if CONFIG_CPUFREQ_RELEASE_LOCK
is enabled without this changes.

Signed-off-by: Takumi Ando <t-ando@advaly.co.jp>
This commit is contained in:
SPRESENSE 2023-04-19 15:11:57 +09:00 committed by Petro Karashchenko
parent b787e9ec3b
commit 7c9f572eae

View file

@ -38,6 +38,7 @@
#include "cxd56_clock.h"
#include <arch/board/board.h>
#include <arch/chip/pm.h>
/****************************************************************************
* Pre-processor Definitions
@ -54,6 +55,14 @@
#define POWER_CHECK_RETRY (10)
/****************************************************************************
* Private Data
****************************************************************************/
static struct pm_cpu_freqlock_s g_hv_lock =
PM_CPUFREQLOCK_INIT(PM_CPUFREQLOCK_TAG('I', 'S', 0),
PM_CPUFREQLOCK_FLAG_HV);
/****************************************************************************
* Public Functions
****************************************************************************/
@ -134,6 +143,10 @@ struct i2c_master_s *board_isx019_initialize(void)
_info("Initializing ISX019...\n");
/* Fix system clock to HV mode */
up_pm_acquire_freqlock(&g_hv_lock);
while (!g_rtc_enabled && 0 < retry--)
{
/* ISX019 requires stable RTC */
@ -171,6 +184,10 @@ int board_isx019_uninitialize(struct i2c_master_s *i2c)
cxd56_gpio_write_hiz(PIN_IS_DATA0);
cxd56_gpio_write_hiz(PIN_IS_DATA7);
/* Release system clock */
up_pm_release_freqlock(&g_hv_lock);
/* Uninitialize i2c device */
ret = isx019_uninitialize();