Commit c93beb52 authored by Vladimir Barinov's avatar Vladimir Barinov Committed by Mauro Carvalho Chehab

media: rcar-vin: add GREY format

This adds support for MEDIA_BUS_FMT_Y8_1X8 input and V4L2_PIX_FMT_GREY
output format.
Signed-off-by: default avatarVladimir Barinov <vladimir.barinov@cogentembedded.com>
Signed-off-by: default avatarNikita Yushchenko <nikita.yoush@cogentembedded.com>
Reviewed-by: default avatarNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+huawei@kernel.org>
parent 2d080eb6
...@@ -114,6 +114,7 @@ ...@@ -114,6 +114,7 @@
/* Video n Data Mode Register bits */ /* Video n Data Mode Register bits */
#define VNDMR_A8BIT(n) (((n) & 0xff) << 24) #define VNDMR_A8BIT(n) (((n) & 0xff) << 24)
#define VNDMR_A8BIT_MASK (0xff << 24) #define VNDMR_A8BIT_MASK (0xff << 24)
#define VNDMR_YMODE_Y8 (1 << 12)
#define VNDMR_EXRGB (1 << 8) #define VNDMR_EXRGB (1 << 8)
#define VNDMR_BPSM (1 << 4) #define VNDMR_BPSM (1 << 4)
#define VNDMR_ABIT (1 << 2) #define VNDMR_ABIT (1 << 2)
...@@ -603,6 +604,7 @@ void rvin_crop_scale_comp(struct rvin_dev *vin) ...@@ -603,6 +604,7 @@ void rvin_crop_scale_comp(struct rvin_dev *vin)
case V4L2_PIX_FMT_SGBRG8: case V4L2_PIX_FMT_SGBRG8:
case V4L2_PIX_FMT_SGRBG8: case V4L2_PIX_FMT_SGRBG8:
case V4L2_PIX_FMT_SRGGB8: case V4L2_PIX_FMT_SRGGB8:
case V4L2_PIX_FMT_GREY:
stride /= 2; stride /= 2;
break; break;
default: default:
...@@ -695,6 +697,7 @@ static int rvin_setup(struct rvin_dev *vin) ...@@ -695,6 +697,7 @@ static int rvin_setup(struct rvin_dev *vin)
case MEDIA_BUS_FMT_SGBRG8_1X8: case MEDIA_BUS_FMT_SGBRG8_1X8:
case MEDIA_BUS_FMT_SGRBG8_1X8: case MEDIA_BUS_FMT_SGRBG8_1X8:
case MEDIA_BUS_FMT_SRGGB8_1X8: case MEDIA_BUS_FMT_SRGGB8_1X8:
case MEDIA_BUS_FMT_Y8_1X8:
vnmc |= VNMC_INF_RAW8; vnmc |= VNMC_INF_RAW8;
break; break;
default: default:
...@@ -774,6 +777,14 @@ static int rvin_setup(struct rvin_dev *vin) ...@@ -774,6 +777,14 @@ static int rvin_setup(struct rvin_dev *vin)
case V4L2_PIX_FMT_SRGGB8: case V4L2_PIX_FMT_SRGGB8:
dmr = 0; dmr = 0;
break; break;
case V4L2_PIX_FMT_GREY:
if (input_is_yuv) {
dmr = VNDMR_DTMD_YCSEP | VNDMR_YMODE_Y8;
output_is_yuv = true;
} else {
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);
...@@ -1148,6 +1159,10 @@ static int rvin_mc_validate_format(struct rvin_dev *vin, struct v4l2_subdev *sd, ...@@ -1148,6 +1159,10 @@ static int rvin_mc_validate_format(struct rvin_dev *vin, struct v4l2_subdev *sd,
if (vin->format.pixelformat != V4L2_PIX_FMT_SRGGB8) if (vin->format.pixelformat != V4L2_PIX_FMT_SRGGB8)
return -EPIPE; return -EPIPE;
break; break;
case MEDIA_BUS_FMT_Y8_1X8:
if (vin->format.pixelformat != V4L2_PIX_FMT_GREY)
return -EPIPE;
break;
default: default:
return -EPIPE; return -EPIPE;
} }
......
...@@ -82,6 +82,10 @@ static const struct rvin_video_format rvin_formats[] = { ...@@ -82,6 +82,10 @@ static const struct rvin_video_format rvin_formats[] = {
.fourcc = V4L2_PIX_FMT_SRGGB8, .fourcc = V4L2_PIX_FMT_SRGGB8,
.bpp = 1, .bpp = 1,
}, },
{
.fourcc = V4L2_PIX_FMT_GREY,
.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,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment