media: atomisp: report colorspace information

While different sensors could have different colorspaces, the
colorspace V4L2 support didn't exist by the time atomisp driver
was written. So, the sensors won't have any data about that.

So, let's report what Asus T101HA uses (ov2680 sensor).

It may require further changes, if other sensors used on this
driver have different colorspaces.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
This commit is contained in:
Mauro Carvalho Chehab 2021-10-30 12:01:30 +01:00
parent 6c84a35d78
commit 2b806251a5
2 changed files with 23 additions and 0 deletions

View File

@ -4916,6 +4916,13 @@ int atomisp_try_fmt(struct video_device *vdev, struct v4l2_pix_format *f,
}
f->pixelformat = fmt->pixelformat;
/*
* FIXME: do we need to setup this differently, depending on the
* sensor or the pipeline?
*/
f->colorspace = V4L2_COLORSPACE_REC709;
f->ycbcr_enc = V4L2_YCBCR_ENC_709;
f->xfer_func = V4L2_XFER_FUNC_709;
/*
* If the format is jpeg or custom RAW, then the width and height will
@ -6027,6 +6034,14 @@ int atomisp_set_fmt(struct video_device *vdev, struct v4l2_format *f)
pipe->pix.width = f->fmt.pix.width;
pipe->pix.height = f->fmt.pix.height;
pipe->pix.pixelformat = f->fmt.pix.pixelformat;
/*
* FIXME: do we need to setup this differently, depending on the
* sensor or the pipeline?
*/
pipe->pix.colorspace = V4L2_COLORSPACE_REC709;
pipe->pix.ycbcr_enc = V4L2_YCBCR_ENC_709;
pipe->pix.xfer_func = V4L2_XFER_FUNC_709;
if (format_bridge->planar) {
pipe->pix.bytesperline = output_info.padded_width;
pipe->pix.sizeimage = PAGE_ALIGN(f->fmt.pix.height *

View File

@ -884,6 +884,14 @@ static int atomisp_g_fmt_cap(struct file *file, void *fh,
f->fmt.pix.bytesperline = (f->fmt.pix.width * depth) >> 3;
f->fmt.pix.sizeimage = f->fmt.pix.height * f->fmt.pix.bytesperline;
/*
* FIXME: do we need to setup this differently, depending on the
* sensor or the pipeline?
*/
f->fmt.pix.colorspace = V4L2_COLORSPACE_REC709;
f->fmt.pix.ycbcr_enc = V4L2_YCBCR_ENC_709;
f->fmt.pix.xfer_func = V4L2_XFER_FUNC_709;
return 0;
}