media: rockchip: isp: support raw14 format

Change-Id: I46569179161e2fc136654ab8ecbdff74ad228c4d
Signed-off-by: Cai YiWei <cyw@rock-chips.com>
This commit is contained in:
Cai YiWei
2025-08-26 15:35:01 +08:00
committed by Tao Huang
parent f97148ab59
commit 6a5a34e360
4 changed files with 112 additions and 3 deletions

View File

@@ -644,6 +644,8 @@ int rkisp_csi_config_patch(struct rkisp_device *dev, bool is_pre_cfg)
} else {
rkisp_unite_write(dev, CSI2RX_CTRL0,
SW_IBUF_OP_MODE(dev->hdr.op_mode), false);
rkisp_unite_write(dev, CSI2RX_DATA_IDS_1,
dev->isp_sdev.in_fmt.mipi_dt, false);
}
/* hdr merge */
switch (dev->hdr.op_mode) {

View File

@@ -196,6 +196,26 @@ static const struct capture_fmt rawrd_fmts[] = {
.fmt_type = FMT_YUV,
.bpp = { 16 },
.mplanes = 1,
}, {
.fourcc = V4L2_PIX_FMT_SRGGB14,
.fmt_type = FMT_BAYER,
.bpp = { 14 },
.mplanes = 1,
}, {
.fourcc = V4L2_PIX_FMT_SGRBG14,
.fmt_type = FMT_BAYER,
.bpp = { 14 },
.mplanes = 1,
}, {
.fourcc = V4L2_PIX_FMT_SGBRG14,
.fmt_type = FMT_BAYER,
.bpp = { 14 },
.mplanes = 1,
}, {
.fourcc = V4L2_PIX_FMT_SBGGR14,
.fmt_type = FMT_BAYER,
.bpp = { 14 },
.mplanes = 1,
}, {
.fourcc = V4L2_PIX_FMT_SRGGB16,
.fmt_type = FMT_BAYER,
@@ -216,6 +236,11 @@ static const struct capture_fmt rawrd_fmts[] = {
.fmt_type = FMT_BAYER,
.bpp = { 16 },
.mplanes = 1,
}, {
.fourcc = V4L2_PIX_FMT_Y14,
.fmt_type = FMT_BAYER,
.bpp = { 14 },
.mplanes = 1,
}, {
.fourcc = V4L2_PIX_FMT_Y16,
.fmt_type = FMT_BAYER,
@@ -367,6 +392,13 @@ static int rawrd_config_mi(struct rkisp_stream *stream)
case V4L2_PIX_FMT_VYUY:
val |= CIF_CSI2_DT_YUV422_8b;
break;
case V4L2_PIX_FMT_SRGGB14:
case V4L2_PIX_FMT_SBGGR14:
case V4L2_PIX_FMT_SGRBG14:
case V4L2_PIX_FMT_SGBRG14:
case V4L2_PIX_FMT_Y14:
val |= CIF_CSI2_DT_RAW14;
break;
case V4L2_PIX_FMT_SRGGB16:
case V4L2_PIX_FMT_SBGGR16:
case V4L2_PIX_FMT_SGRBG16:
@@ -816,6 +848,26 @@ static int rkisp_set_fmt(struct rkisp_stream *stream,
u32 xsubs = 1, ysubs = 1;
unsigned int i;
if (stream->ispdev->isp_ver < ISP_V35 &&
(pixm->pixelformat == V4L2_PIX_FMT_SBGGR14 ||
pixm->pixelformat == V4L2_PIX_FMT_SGBRG14 ||
pixm->pixelformat == V4L2_PIX_FMT_SGRBG14 ||
pixm->pixelformat == V4L2_PIX_FMT_SRGGB14 ||
pixm->pixelformat == V4L2_PIX_FMT_Y14)) {
if (pixm->pixelformat == V4L2_PIX_FMT_SBGGR14)
pixm->pixelformat = V4L2_PIX_FMT_SBGGR12;
else if (pixm->pixelformat == V4L2_PIX_FMT_SGBRG14)
pixm->pixelformat = V4L2_PIX_FMT_SGBRG12;
else if (pixm->pixelformat == V4L2_PIX_FMT_SGRBG14)
pixm->pixelformat = V4L2_PIX_FMT_SGRBG12;
else if (pixm->pixelformat == V4L2_PIX_FMT_SRGGB14)
pixm->pixelformat = V4L2_PIX_FMT_SRGGB12;
else
pixm->pixelformat = V4L2_PIX_FMT_Y12;
v4l2_warn(&stream->ispdev->v4l2_dev,
"no support raw14, rawrd format force to raw12\n");
}
fmt = find_fmt(stream, pixm->pixelformat);
if (!fmt) {
v4l2_err(&stream->ispdev->v4l2_dev,

View File

@@ -406,6 +406,7 @@
#define CIF_CSI2_DT_RAW8 0x2A
#define CIF_CSI2_DT_RAW10 0x2B
#define CIF_CSI2_DT_RAW12 0x2C
#define CIF_CSI2_DT_RAW14 0x2D
#define CIF_CSI2_DT_RAW16 0x2e
#define CIF_CSI2_DT_SPD 0x2F

View File

@@ -2787,6 +2787,41 @@ static const struct ispsd_in_fmt rkisp_isp_input_formats[] = {
.mipi_dt = CIF_CSI2_DT_RAW12,
.yuv_seq = CIF_ISP_ACQ_PROP_YCBYCR,
.bus_width = 12,
}, {
.name = "Y14_1X14",
.mbus_code = MEDIA_BUS_FMT_Y14_1X14,
.fmt_type = FMT_BAYER,
.mipi_dt = CIF_CSI2_DT_RAW14,
.yuv_seq = CIF_ISP_ACQ_PROP_YCBYCR,
.bus_width = 14,
}, {
.name = "SRGGB14_1X14",
.mbus_code = MEDIA_BUS_FMT_SRGGB14_1X14,
.fmt_type = FMT_BAYER,
.mipi_dt = CIF_CSI2_DT_RAW14,
.bayer_pat = RAW_RGGB,
.bus_width = 14,
}, {
.name = "SBGGR14_1X14",
.mbus_code = MEDIA_BUS_FMT_SBGGR14_1X14,
.fmt_type = FMT_BAYER,
.mipi_dt = CIF_CSI2_DT_RAW14,
.bayer_pat = RAW_BGGR,
.bus_width = 14,
}, {
.name = "SGBRG14_1X14",
.mbus_code = MEDIA_BUS_FMT_SGBRG14_1X14,
.fmt_type = FMT_BAYER,
.mipi_dt = CIF_CSI2_DT_RAW14,
.bayer_pat = RAW_GBRG,
.bus_width = 14,
}, {
.name = "SGRBG14_1X14",
.mbus_code = MEDIA_BUS_FMT_SGRBG14_1X14,
.fmt_type = FMT_BAYER,
.mipi_dt = CIF_CSI2_DT_RAW14,
.bayer_pat = RAW_GRBG,
.bus_width = 14,
}, {
.name = "SRGGB16_1X16",
.mbus_code = MEDIA_BUS_FMT_SRGGB16_1X16,
@@ -2795,21 +2830,21 @@ static const struct ispsd_in_fmt rkisp_isp_input_formats[] = {
.bayer_pat = RAW_RGGB,
.bus_width = 16,
}, {
.name = "SBGGR12_1X16",
.name = "SBGGR16_1X16",
.mbus_code = MEDIA_BUS_FMT_SBGGR16_1X16,
.fmt_type = FMT_BAYER,
.mipi_dt = CIF_CSI2_DT_RAW16,
.bayer_pat = RAW_BGGR,
.bus_width = 16,
}, {
.name = "SGBRG12_1X16",
.name = "SGBRG16_1X16",
.mbus_code = MEDIA_BUS_FMT_SGBRG16_1X16,
.fmt_type = FMT_BAYER,
.mipi_dt = CIF_CSI2_DT_RAW16,
.bayer_pat = RAW_GBRG,
.bus_width = 16,
}, {
.name = "SGRBG12_1X16",
.name = "SGRBG16_1X16",
.mbus_code = MEDIA_BUS_FMT_SGRBG16_1X16,
.fmt_type = FMT_BAYER,
.mipi_dt = CIF_CSI2_DT_RAW16,
@@ -2974,6 +3009,25 @@ static int rkisp_isp_sd_set_fmt(struct v4l2_subdev *sd,
struct v4l2_pix_format_mplane pixm = { 0 };
const struct ispsd_in_fmt *in_fmt;
if (isp_dev->isp_ver < ISP_V35 &&
(mf->code == MEDIA_BUS_FMT_SGRBG14_1X14 ||
mf->code == MEDIA_BUS_FMT_SGBRG14_1X14 ||
mf->code == MEDIA_BUS_FMT_SBGGR14_1X14 ||
mf->code == MEDIA_BUS_FMT_SRGGB14_1X14 ||
mf->code == MEDIA_BUS_FMT_Y14_1X14)) {
if (mf->code == MEDIA_BUS_FMT_SGRBG14_1X14)
mf->code = MEDIA_BUS_FMT_SGRBG12_1X12;
else if (mf->code == MEDIA_BUS_FMT_SGBRG14_1X14)
mf->code = MEDIA_BUS_FMT_SGBRG12_1X12;
else if (mf->code == MEDIA_BUS_FMT_SBGGR12_1X12)
mf->code = MEDIA_BUS_FMT_SBGGR12_1X12;
else if (mf->code == MEDIA_BUS_FMT_SRGGB14_1X14)
mf->code = MEDIA_BUS_FMT_SRGGB12_1X12;
else
mf->code = MEDIA_BUS_FMT_Y12_1X12;
v4l2_warn(&isp_dev->v4l2_dev,
"no support raw14, isp format force to raw12\n");
}
in_fmt = find_in_fmt(mf->code);
if (!in_fmt ||
mf->width < CIF_ISP_INPUT_W_MIN ||