From f9f6eb03029bf7c9158c719c5d6b6be99c528b8e Mon Sep 17 00:00:00 2001 From: "Kwabena W. Agyeman" Date: Sat, 5 Jul 2025 12:09:18 -0700 Subject: [PATCH] drivers/sensors: Remove OV5640 REV_Y special case. --- boards/ARDUINO_PORTENTA_H7/omv_boardconfig.h | 4 ---- boards/OPENMV4/omv_boardconfig.h | 3 --- boards/OPENMV4P/omv_boardconfig.h | 3 --- boards/OPENMVPT/omv_boardconfig.h | 3 --- boards/OPENMV_N6/omv_boardconfig.h | 3 --- boards/OPENMV_RT1060/omv_boardconfig.h | 3 --- common/omv_csi.c | 7 ------- drivers/sensors/ov5640.c | 14 -------------- drivers/sensors/sensor_config.h | 3 --- 9 files changed, 43 deletions(-) diff --git a/boards/ARDUINO_PORTENTA_H7/omv_boardconfig.h b/boards/ARDUINO_PORTENTA_H7/omv_boardconfig.h index 1b0c6f476..df6b6dce6 100644 --- a/boards/ARDUINO_PORTENTA_H7/omv_boardconfig.h +++ b/boards/ARDUINO_PORTENTA_H7/omv_boardconfig.h @@ -48,10 +48,6 @@ #define OMV_OV5640_CLK_FREQ (12500000) #define OMV_OV5640_PLL_CTRL2 (0x7E) #define OMV_OV5640_PLL_CTRL3 (0x13) -#define OMV_OV5640_REV_Y_CHECK (0) -#define OMV_OV5640_REV_Y_FREQ (12500000) -#define OMV_OV5640_REV_Y_CTRL2 (0x7E) -#define OMV_OV5640_REV_Y_CTRL3 (0x13) #define OMV_HM01B0_ENABLE (1) #define OMV_HM0360_ENABLE (1) diff --git a/boards/OPENMV4/omv_boardconfig.h b/boards/OPENMV4/omv_boardconfig.h index c35f103fa..969d1f297 100644 --- a/boards/OPENMV4/omv_boardconfig.h +++ b/boards/OPENMV4/omv_boardconfig.h @@ -48,9 +48,6 @@ #define OMV_OV5640_AF_ENABLE (1) #define OMV_OV5640_PLL_CTRL2 (0x64) #define OMV_OV5640_PLL_CTRL3 (0x13) -#define OMV_OV5640_REV_Y_CHECK (1) -#define OMV_OV5640_REV_Y_CTRL2 (0x54) -#define OMV_OV5640_REV_Y_CTRL3 (0x13) #define OMV_OV7725_ENABLE (1) #define OMV_OV7725_PLL_CONFIG (0x41) // x4 diff --git a/boards/OPENMV4P/omv_boardconfig.h b/boards/OPENMV4P/omv_boardconfig.h index e6acb55c3..c72532a3d 100644 --- a/boards/OPENMV4P/omv_boardconfig.h +++ b/boards/OPENMV4P/omv_boardconfig.h @@ -34,9 +34,6 @@ #define OMV_OV5640_AF_ENABLE (1) #define OMV_OV5640_PLL_CTRL2 (0x64) #define OMV_OV5640_PLL_CTRL3 (0x13) -#define OMV_OV5640_REV_Y_CHECK (1) -#define OMV_OV5640_REV_Y_CTRL2 (0x54) -#define OMV_OV5640_REV_Y_CTRL3 (0x13) #define OMV_OV7725_ENABLE (1) #define OMV_OV7725_PLL_CONFIG (0x41) // x4 diff --git a/boards/OPENMVPT/omv_boardconfig.h b/boards/OPENMVPT/omv_boardconfig.h index d1f5f1b82..7e2d769c6 100644 --- a/boards/OPENMVPT/omv_boardconfig.h +++ b/boards/OPENMVPT/omv_boardconfig.h @@ -32,9 +32,6 @@ #define OMV_OV5640_AF_ENABLE (1) #define OMV_OV5640_PLL_CTRL2 (0x64) #define OMV_OV5640_PLL_CTRL3 (0x13) -#define OMV_OV5640_REV_Y_CHECK (1) -#define OMV_OV5640_REV_Y_CTRL2 (0x54) -#define OMV_OV5640_REV_Y_CTRL3 (0x13) // FIR drivers configuration. #define OMV_FIR_MLX90621_ENABLE (1) diff --git a/boards/OPENMV_N6/omv_boardconfig.h b/boards/OPENMV_N6/omv_boardconfig.h index 9a8d06fb8..3abd66363 100644 --- a/boards/OPENMV_N6/omv_boardconfig.h +++ b/boards/OPENMV_N6/omv_boardconfig.h @@ -42,9 +42,6 @@ #define OMV_OV5640_AF_ENABLE (1) #define OMV_OV5640_PLL_CTRL2 (0x64) #define OMV_OV5640_PLL_CTRL3 (0x13) -#define OMV_OV5640_REV_Y_CHECK (1) -#define OMV_OV5640_REV_Y_CTRL2 (0x54) -#define OMV_OV5640_REV_Y_CTRL3 (0x13) #define OMV_MT9V0XX_ENABLE (1) #define OMV_LEPTON_ENABLE (1) diff --git a/boards/OPENMV_RT1060/omv_boardconfig.h b/boards/OPENMV_RT1060/omv_boardconfig.h index 87baa7d64..44b69f16b 100644 --- a/boards/OPENMV_RT1060/omv_boardconfig.h +++ b/boards/OPENMV_RT1060/omv_boardconfig.h @@ -29,9 +29,6 @@ #define OMV_OV5640_AF_ENABLE (1) #define OMV_OV5640_PLL_CTRL2 (0x64) #define OMV_OV5640_PLL_CTRL3 (0x13) -#define OMV_OV5640_REV_Y_CHECK (0) -#define OMV_OV5640_REV_Y_CTRL2 (0x54) -#define OMV_OV5640_REV_Y_CTRL3 (0x13) #define OMV_OV7725_ENABLE (1) #define OMV_OV7725_PLL_CONFIG (0x41) // x4 diff --git a/common/omv_csi.c b/common/omv_csi.c index fa1745879..f48593402 100644 --- a/common/omv_csi.c +++ b/common/omv_csi.c @@ -543,13 +543,6 @@ int omv_csi_probe(omv_i2c_t *i2c) { return OMV_CSI_ERROR_ISC_INIT_FAILED; } - // Special case for OV5640. - #if (OMV_OV5640_REV_Y_CHECK == 1) - if (csi->chip_id == OV5640_ID && HAL_GetREVID() < 0x2003) { - csi->clk_hz = OMV_OV5640_REV_Y_FREQ; - } - #endif - // Sensors can change the clock's frequency or disable it // (with clk_hz=0). This is allowed only if the clock is // not shared (dev_count == 1) or if this is a main sensor. diff --git a/drivers/sensors/ov5640.c b/drivers/sensors/ov5640.c index 3df7839f4..1abf5ca78 100644 --- a/drivers/sensors/ov5640.c +++ b/drivers/sensors/ov5640.c @@ -678,20 +678,6 @@ static int reset(omv_csi_t *csi) { int addr = (default_regs[i][0] << 8) | (default_regs[i][1] << 0); int data = default_regs[i][2]; - #if (OMV_OV5640_REV_Y_CHECK == 1) - // Rev V (480 MHz / 20) -> 24 MHz PCLK / 3 * 100 = 800 MHz / 10 = 80 MHz PCLK. - // Rev Y (400 MHz / 16) -> 25 MHz PCLK / 3 * 84 = 700 MHz / 10 = 70 MHz PCLK. - if (HAL_GetREVID() < 0x2003) { - // Is this REV Y? - if (addr == SC_PLL_CONTRL2) { - data = OMV_OV5640_REV_Y_CTRL2; - } - if (addr == SC_PLL_CONTRL3) { - data = OMV_OV5640_REV_Y_CTRL3; - } - } - #endif - ret |= omv_i2c_writeb2(csi->i2c, csi->slv_addr, addr, data); } diff --git a/drivers/sensors/sensor_config.h b/drivers/sensors/sensor_config.h index b89c560c2..1b2e31361 100644 --- a/drivers/sensors/sensor_config.h +++ b/drivers/sensors/sensor_config.h @@ -22,9 +22,6 @@ extern int ov2640_init(omv_csi_t *csi); #ifndef OMV_OV5640_CLK_FREQ #define OMV_OV5640_CLK_FREQ (24000000) #endif -#ifndef OMV_OV5640_REV_Y_FREQ -#define OMV_OV5640_REV_Y_FREQ (25000000) -#endif extern int ov5640_init(omv_csi_t *csi); #ifndef OMV_OV7670_CLK_FREQ