media: rcar-vin: Extend RAW8 support to all RGB layouts

Extend the list of supported formats to include all RGB layouts of RAW8.

Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: Ulrich Hecht <uli+renesas@fpond.eu>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
Niklas Söderlund 2020-09-16 01:01:40 +02:00 коммит произвёл Mauro Carvalho Chehab
Родитель d9cb346055
Коммит 8c3e0f67df
2 изменённых файлов: 54 добавлений и 1 удалений

Просмотреть файл

@ -599,8 +599,16 @@ void rvin_crop_scale_comp(struct rvin_dev *vin)
/* 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)
switch (vin->format.pixelformat) {
case MEDIA_BUS_FMT_SBGGR8_1X8:
case MEDIA_BUS_FMT_SGBRG8_1X8:
case MEDIA_BUS_FMT_SGRBG8_1X8:
case MEDIA_BUS_FMT_SRGGB8_1X8:
stride /= 2;
break;
default:
break;
}
rvin_write(vin, stride, VNIS_REG);
}
@ -684,6 +692,9 @@ static int rvin_setup(struct rvin_dev *vin)
input_is_yuv = true;
break;
case MEDIA_BUS_FMT_SBGGR8_1X8:
case MEDIA_BUS_FMT_SGBRG8_1X8:
case MEDIA_BUS_FMT_SGRBG8_1X8:
case MEDIA_BUS_FMT_SRGGB8_1X8:
vnmc |= VNMC_INF_RAW8;
break;
@ -758,6 +769,9 @@ static int rvin_setup(struct rvin_dev *vin)
case V4L2_PIX_FMT_ABGR32:
dmr = VNDMR_A8BIT(vin->alpha) | VNDMR_EXRGB | VNDMR_DTMD_ARGB;
break;
case V4L2_PIX_FMT_SBGGR8:
case V4L2_PIX_FMT_SGBRG8:
case V4L2_PIX_FMT_SGRBG8:
case V4L2_PIX_FMT_SRGGB8:
dmr = 0;
break;
@ -1135,6 +1149,18 @@ static int rvin_mc_validate_format(struct rvin_dev *vin, struct v4l2_subdev *sd,
case MEDIA_BUS_FMT_UYVY10_2X10:
case MEDIA_BUS_FMT_RGB888_1X24:
break;
case MEDIA_BUS_FMT_SBGGR8_1X8:
if (vin->format.pixelformat != V4L2_PIX_FMT_SBGGR8)
return -EPIPE;
break;
case MEDIA_BUS_FMT_SGBRG8_1X8:
if (vin->format.pixelformat != V4L2_PIX_FMT_SGBRG8)
return -EPIPE;
break;
case MEDIA_BUS_FMT_SGRBG8_1X8:
if (vin->format.pixelformat != V4L2_PIX_FMT_SGRBG8)
return -EPIPE;
break;
case MEDIA_BUS_FMT_SRGGB8_1X8:
if (vin->format.pixelformat != V4L2_PIX_FMT_SRGGB8)
return -EPIPE;

Просмотреть файл

@ -66,6 +66,18 @@ static const struct rvin_video_format rvin_formats[] = {
.fourcc = V4L2_PIX_FMT_ABGR32,
.bpp = 4,
},
{
.fourcc = V4L2_PIX_FMT_SBGGR8,
.bpp = 1,
},
{
.fourcc = V4L2_PIX_FMT_SGBRG8,
.bpp = 1,
},
{
.fourcc = V4L2_PIX_FMT_SGRBG8,
.bpp = 1,
},
{
.fourcc = V4L2_PIX_FMT_SRGGB8,
.bpp = 1,
@ -366,6 +378,21 @@ static int rvin_enum_fmt_vid_cap(struct file *file, void *priv,
case MEDIA_BUS_FMT_UYVY10_2X10:
case MEDIA_BUS_FMT_RGB888_1X24:
break;
case MEDIA_BUS_FMT_SBGGR8_1X8:
if (f->index)
return -EINVAL;
f->pixelformat = V4L2_PIX_FMT_SBGGR8;
return 0;
case MEDIA_BUS_FMT_SGBRG8_1X8:
if (f->index)
return -EINVAL;
f->pixelformat = V4L2_PIX_FMT_SGBRG8;
return 0;
case MEDIA_BUS_FMT_SGRBG8_1X8:
if (f->index)
return -EINVAL;
f->pixelformat = V4L2_PIX_FMT_SGRBG8;
return 0;
case MEDIA_BUS_FMT_SRGGB8_1X8:
if (f->index)
return -EINVAL;