media: rcar-vin: Add support for MEDIA_BUS_FMT_SRGGB8_1X8 format
Add support for MEDIA_BUS_FMT_SRGGB8_1X8 format in rcar-vin by setting format type to RAW8 in VNMC register and appropriately setting the bpp and bytesperline to enable V4L2_PIX_FMT_SRGGB8. Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
Родитель
fd22e8eb41
Коммит
e87c1a81f1
|
@ -85,6 +85,7 @@
|
||||||
#define VNMC_INF_YUV8_BT601 (1 << 16)
|
#define VNMC_INF_YUV8_BT601 (1 << 16)
|
||||||
#define VNMC_INF_YUV10_BT656 (2 << 16)
|
#define VNMC_INF_YUV10_BT656 (2 << 16)
|
||||||
#define VNMC_INF_YUV10_BT601 (3 << 16)
|
#define VNMC_INF_YUV10_BT601 (3 << 16)
|
||||||
|
#define VNMC_INF_RAW8 (4 << 16)
|
||||||
#define VNMC_INF_YUV16 (5 << 16)
|
#define VNMC_INF_YUV16 (5 << 16)
|
||||||
#define VNMC_INF_RGB888 (6 << 16)
|
#define VNMC_INF_RGB888 (6 << 16)
|
||||||
#define VNMC_VUP (1 << 10)
|
#define VNMC_VUP (1 << 10)
|
||||||
|
@ -587,13 +588,19 @@ void rvin_crop_scale_comp(struct rvin_dev *vin)
|
||||||
rvin_write(vin, vin->crop.top, VNSLPRC_REG);
|
rvin_write(vin, vin->crop.top, VNSLPRC_REG);
|
||||||
rvin_write(vin, vin->crop.top + vin->crop.height - 1, VNELPRC_REG);
|
rvin_write(vin, vin->crop.top + vin->crop.height - 1, VNELPRC_REG);
|
||||||
|
|
||||||
|
|
||||||
/* TODO: Add support for the UDS scaler. */
|
/* TODO: Add support for the UDS scaler. */
|
||||||
if (vin->info->model != RCAR_GEN3)
|
if (vin->info->model != RCAR_GEN3)
|
||||||
rvin_crop_scale_comp_gen2(vin);
|
rvin_crop_scale_comp_gen2(vin);
|
||||||
|
|
||||||
fmt = rvin_format_from_pixel(vin, vin->format.pixelformat);
|
fmt = rvin_format_from_pixel(vin, vin->format.pixelformat);
|
||||||
stride = vin->format.bytesperline / fmt->bpp;
|
stride = vin->format.bytesperline / fmt->bpp;
|
||||||
|
|
||||||
|
/* For RAW8 format bpp is 1, but the hardware process RAW8
|
||||||
|
* format in 2 pixel unit hence configure VNIS_REG as stride / 2.
|
||||||
|
*/
|
||||||
|
if (vin->format.pixelformat == V4L2_PIX_FMT_SRGGB8)
|
||||||
|
stride /= 2;
|
||||||
|
|
||||||
rvin_write(vin, stride, VNIS_REG);
|
rvin_write(vin, stride, VNIS_REG);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -676,6 +683,9 @@ static int rvin_setup(struct rvin_dev *vin)
|
||||||
|
|
||||||
input_is_yuv = true;
|
input_is_yuv = true;
|
||||||
break;
|
break;
|
||||||
|
case MEDIA_BUS_FMT_SRGGB8_1X8:
|
||||||
|
vnmc |= VNMC_INF_RAW8;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -737,6 +747,9 @@ static int rvin_setup(struct rvin_dev *vin)
|
||||||
case V4L2_PIX_FMT_ABGR32:
|
case V4L2_PIX_FMT_ABGR32:
|
||||||
dmr = VNDMR_A8BIT(vin->alpha) | VNDMR_EXRGB | VNDMR_DTMD_ARGB;
|
dmr = VNDMR_A8BIT(vin->alpha) | VNDMR_EXRGB | VNDMR_DTMD_ARGB;
|
||||||
break;
|
break;
|
||||||
|
case V4L2_PIX_FMT_SRGGB8:
|
||||||
|
dmr = 0;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
vin_err(vin, "Invalid pixelformat (0x%x)\n",
|
vin_err(vin, "Invalid pixelformat (0x%x)\n",
|
||||||
vin->format.pixelformat);
|
vin->format.pixelformat);
|
||||||
|
|
|
@ -66,6 +66,10 @@ static const struct rvin_video_format rvin_formats[] = {
|
||||||
.fourcc = V4L2_PIX_FMT_ABGR32,
|
.fourcc = V4L2_PIX_FMT_ABGR32,
|
||||||
.bpp = 4,
|
.bpp = 4,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
.fourcc = V4L2_PIX_FMT_SRGGB8,
|
||||||
|
.bpp = 1,
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
const struct rvin_video_format *rvin_format_from_pixel(struct rvin_dev *vin,
|
const struct rvin_video_format *rvin_format_from_pixel(struct rvin_dev *vin,
|
||||||
|
|
Загрузка…
Ссылка в новой задаче