mirror of
https://github.com/apache/nuttx.git
synced 2026-05-21 04:52:02 +08:00
video/gc0308: report V4L2_PIX_FMT_RGB565X for 8-bit DVP output
GC0308 register 0x24 bits[3:0] = 0x06 selects RGB565 output per datasheet. On an 8-bit DVP bus the high byte is clocked out first, so the pixel data arrives in memory in big-endian order (RGB565X). Report V4L2_PIX_FMT_RGB565X so that userspace can detect this and byte-swap if needed for a little-endian display path. Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
This commit is contained in:
+10
-7
@@ -461,8 +461,8 @@ static const struct v4l2_fmtdesc g_gc0308_fmtdescs[] =
|
||||
.description = "YUV 4:2:2 (YUYV)",
|
||||
},
|
||||
{
|
||||
.pixelformat = V4L2_PIX_FMT_RGB565,
|
||||
.description = "RGB565",
|
||||
.pixelformat = V4L2_PIX_FMT_RGB565X,
|
||||
.description = "RGB565X (BE)",
|
||||
},
|
||||
};
|
||||
|
||||
@@ -653,7 +653,10 @@ static int gc0308_init(struct imgsensor_s *sensor)
|
||||
|
||||
up_mdelay(80);
|
||||
|
||||
/* Set default RGB565 output format: reg 0x24 bits[3:0] = 6 */
|
||||
/* Set RGB565 output: reg 0x24 bits[3:0] = 0x06 per datasheet.
|
||||
* On 8-bit DVP bus the high byte is clocked out first, so the
|
||||
* resulting memory layout is big-endian (RGB565X).
|
||||
*/
|
||||
|
||||
ret = gc0308_putreg(priv->i2c, GC0308_REG_RESET, 0x00);
|
||||
if (ret < 0)
|
||||
@@ -662,7 +665,7 @@ static int gc0308_init(struct imgsensor_s *sensor)
|
||||
}
|
||||
|
||||
ret = gc0308_modreg(priv->i2c, GC0308_REG_OUTPUT_FMT, 0x0f, 0x06);
|
||||
priv->pixelformat = IMGSENSOR_PIX_FMT_RGB565;
|
||||
priv->pixelformat = IMGSENSOR_PIX_FMT_RGB565X;
|
||||
if (ret < 0)
|
||||
{
|
||||
return ret;
|
||||
@@ -760,7 +763,7 @@ static int gc0308_validate_frame_setting(struct imgsensor_s *sensor,
|
||||
if (datafmts[IMGSENSOR_FMT_MAIN].pixelformat !=
|
||||
IMGSENSOR_PIX_FMT_YUYV &&
|
||||
datafmts[IMGSENSOR_FMT_MAIN].pixelformat !=
|
||||
IMGSENSOR_PIX_FMT_RGB565)
|
||||
IMGSENSOR_PIX_FMT_RGB565X)
|
||||
{
|
||||
return -EINVAL;
|
||||
}
|
||||
@@ -795,9 +798,9 @@ static int gc0308_start_capture(struct imgsensor_s *sensor,
|
||||
|
||||
/* Configure output format register based on requested pixel format */
|
||||
|
||||
if (datafmts[IMGSENSOR_FMT_MAIN].pixelformat == IMGSENSOR_PIX_FMT_RGB565)
|
||||
if (datafmts[IMGSENSOR_FMT_MAIN].pixelformat == IMGSENSOR_PIX_FMT_RGB565X)
|
||||
{
|
||||
fmtval = 0x06; /* RGB565 */
|
||||
fmtval = 0x06; /* Reg 0x24 = RGB565; BE in memory due to 8-bit DVP */
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user