This is an automated email from the ASF dual-hosted git repository.

pkarashchenko pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/nuttx.git

commit 6611bf99c46b4af08c031b7336457b2fc14927e1
Author: SPRESENSE <[email protected]>
AuthorDate: Tue Jun 27 18:46:04 2023 +0900

    drivers: video: isx012: Fix system clock to HV mode
    
    ISX012 doesn't work if CONFIG_CPUFREQ_RELEASE_LOCK is enabled
    without this changes.
---
 boards/arm/cxd56xx/common/src/cxd56_isx012.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/boards/arm/cxd56xx/common/src/cxd56_isx012.c 
b/boards/arm/cxd56xx/common/src/cxd56_isx012.c
index 4178d960c9..697a8ef380 100644
--- a/boards/arm/cxd56xx/common/src/cxd56_isx012.c
+++ b/boards/arm/cxd56xx/common/src/cxd56_isx012.c
@@ -37,6 +37,7 @@
 #include "cxd56_i2c.h"
 
 #include <arch/board/board.h>
+#include <arch/chip/pm.h>
 
 /****************************************************************************
  * Pre-processor Definitions
@@ -59,6 +60,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
  ****************************************************************************/
@@ -163,6 +172,10 @@ struct i2c_master_s *board_isx012_initialize(void)
 {
   _info("Initializing ISX012...\n");
 
+  /* Fix system clock to HV mode */
+
+  up_pm_acquire_freqlock(&g_hv_lock);
+
 #ifdef IMAGER_ALERT
   cxd56_gpio_config(IMAGER_ALERT, true);
 #endif
@@ -184,6 +197,10 @@ int board_isx012_uninitialize(struct i2c_master_s *i2c)
 
   _info("Uninitializing ISX012...\n");
 
+  /* Release system clock */
+
+  up_pm_release_freqlock(&g_hv_lock);
+
   /* Initialize i2c device */
 
   ret = isx012_uninitialize();

Reply via email to