You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by pk...@apache.org on 2023/07/04 09:34:20 UTC

[nuttx] 01/02: drivers: video: isx019: Fix system clock to HV mode

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 d0d787c1b03c5396f169f34a3527661701c2d09f
Author: SPRESENSE <41...@users.noreply.github.com>
AuthorDate: Wed Apr 19 15:11:57 2023 +0900

    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-...@advaly.co.jp>
---
 boards/arm/cxd56xx/common/src/cxd56_isx019.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/boards/arm/cxd56xx/common/src/cxd56_isx019.c b/boards/arm/cxd56xx/common/src/cxd56_isx019.c
index b8aed7043a..e71a3bde03 100644
--- a/boards/arm/cxd56xx/common/src/cxd56_isx019.c
+++ b/boards/arm/cxd56xx/common/src/cxd56_isx019.c
@@ -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();