From 28ba7f4a1e65b792843a58f0fd12f4dc0a77da56 Mon Sep 17 00:00:00 2001 From: SPRESENSE <41312067+SPRESENSE@users.noreply.github.com> Date: Mon, 27 Jul 2020 13:54:26 +0900 Subject: [PATCH] boards: cxd56xx: Fix bugs about ON/OFF control of AWB and AE Fix the following three bugs about ON/OFF control of auto white balance and auto exposure: - The returned value of VIDIOC_G_CTRL with id = V4L2_CID_AUTO_WHITE_BALANCE is different from V4L2 specification. - Auto exposure is locked if auto white balance lock is requested. - Auto exposure and auto white balance are locked if auto exposure lock is requested. --- boards/arm/cxd56xx/drivers/camera/isx012.c | 11 ++++++++++- include/nuttx/video/isx012_reg.h | 4 ++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/boards/arm/cxd56xx/drivers/camera/isx012.c b/boards/arm/cxd56xx/drivers/camera/isx012.c index c5d10409886..352439ba5cb 100644 --- a/boards/arm/cxd56xx/drivers/camera/isx012.c +++ b/boards/arm/cxd56xx/drivers/camera/isx012.c @@ -2548,7 +2548,16 @@ static int isx012_get_ctrlval(uint16_t ctrl_class, ISX012_REG_AUTOWB, ISX012_SIZE_AUTOWB); - control->value = (~readvalue) & REGVAL_CPUEXT_BIT_AWBSTOP; + /* Convert to V4L2 value */ + + if (readvalue & REGVAL_CPUEXT_BIT_AWBSTOP) + { + control->value = false; + } + else + { + control->value = true; + } break; diff --git a/include/nuttx/video/isx012_reg.h b/include/nuttx/video/isx012_reg.h index 15bd1a0a215..121b17679cf 100644 --- a/include/nuttx/video/isx012_reg.h +++ b/include/nuttx/video/isx012_reg.h @@ -1335,8 +1335,8 @@ #define REGVAL_FPSTYPE_6FPS (6) #define REGVAL_FPSTYPE_5FPS (7) -#define REGVAL_CPUEXT_BIT_AESTOP (0x01) -#define REGVAL_CPUEXT_BIT_AWBSTOP (0x02) +#define REGVAL_CPUEXT_BIT_AESTOP (0x02) +#define REGVAL_CPUEXT_BIT_AWBSTOP (0x04) #define REGVAL_READVECT_BIT_V (0x01) #define REGVAL_READVECT_BIT_H (0x02)