Commit 3f1ccf16 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

[media] v4l2-subdev: support new 'which' field in enum_mbus_code

Support the new 'which' field in the enum_mbus_code ops. Most drivers do not
need to be changed since they always return the same enumeration regardless
of the 'which' field.
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Acked-by: default avatarLad, Prabhakar <prabhakar.csengg@gmail.com>
Acked-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@osg.samsung.com>
parent 20058f90
...@@ -2327,6 +2327,7 @@ vpfe_async_bound(struct v4l2_async_notifier *notifier, ...@@ -2327,6 +2327,7 @@ vpfe_async_bound(struct v4l2_async_notifier *notifier,
memset(&mbus_code, 0, sizeof(mbus_code)); memset(&mbus_code, 0, sizeof(mbus_code));
mbus_code.index = j; mbus_code.index = j;
mbus_code.which = V4L2_SUBDEV_FORMAT_ACTIVE;
ret = v4l2_subdev_call(subdev, pad, enum_mbus_code, ret = v4l2_subdev_call(subdev, pad, enum_mbus_code,
NULL, &mbus_code); NULL, &mbus_code);
if (ret) if (ret)
......
...@@ -2133,7 +2133,7 @@ static int ccdc_enum_mbus_code(struct v4l2_subdev *sd, ...@@ -2133,7 +2133,7 @@ static int ccdc_enum_mbus_code(struct v4l2_subdev *sd,
case CCDC_PAD_SOURCE_OF: case CCDC_PAD_SOURCE_OF:
format = __ccdc_get_format(ccdc, cfg, code->pad, format = __ccdc_get_format(ccdc, cfg, code->pad,
V4L2_SUBDEV_FORMAT_TRY); code->which);
if (format->code == MEDIA_BUS_FMT_YUYV8_2X8 || if (format->code == MEDIA_BUS_FMT_YUYV8_2X8 ||
format->code == MEDIA_BUS_FMT_UYVY8_2X8) { format->code == MEDIA_BUS_FMT_UYVY8_2X8) {
...@@ -2164,7 +2164,7 @@ static int ccdc_enum_mbus_code(struct v4l2_subdev *sd, ...@@ -2164,7 +2164,7 @@ static int ccdc_enum_mbus_code(struct v4l2_subdev *sd,
return -EINVAL; return -EINVAL;
format = __ccdc_get_format(ccdc, cfg, code->pad, format = __ccdc_get_format(ccdc, cfg, code->pad,
V4L2_SUBDEV_FORMAT_TRY); code->which);
/* A pixel code equal to 0 means that the video port doesn't /* A pixel code equal to 0 means that the video port doesn't
* support the input format. Don't enumerate any pixel code. * support the input format. Don't enumerate any pixel code.
......
...@@ -703,7 +703,7 @@ static int ccp2_enum_mbus_code(struct v4l2_subdev *sd, ...@@ -703,7 +703,7 @@ static int ccp2_enum_mbus_code(struct v4l2_subdev *sd,
return -EINVAL; return -EINVAL;
format = __ccp2_get_format(ccp2, cfg, CCP2_PAD_SINK, format = __ccp2_get_format(ccp2, cfg, CCP2_PAD_SINK,
V4L2_SUBDEV_FORMAT_TRY); code->which);
code->code = format->code; code->code = format->code;
} }
......
...@@ -909,7 +909,7 @@ static int csi2_enum_mbus_code(struct v4l2_subdev *sd, ...@@ -909,7 +909,7 @@ static int csi2_enum_mbus_code(struct v4l2_subdev *sd,
code->code = csi2_input_fmts[code->index]; code->code = csi2_input_fmts[code->index];
} else { } else {
format = __csi2_get_format(csi2, cfg, CSI2_PAD_SINK, format = __csi2_get_format(csi2, cfg, CSI2_PAD_SINK,
V4L2_SUBDEV_FORMAT_TRY); code->which);
switch (code->index) { switch (code->index) {
case 0: case 0:
/* Passthrough sink pad code */ /* Passthrough sink pad code */
......
...@@ -1431,7 +1431,7 @@ static int resizer_enum_mbus_code(struct v4l2_subdev *sd, ...@@ -1431,7 +1431,7 @@ static int resizer_enum_mbus_code(struct v4l2_subdev *sd,
return -EINVAL; return -EINVAL;
format = __resizer_get_format(res, cfg, RESZ_PAD_SINK, format = __resizer_get_format(res, cfg, RESZ_PAD_SINK,
V4L2_SUBDEV_FORMAT_TRY); code->which);
code->code = format->code; code->code = format->code;
} }
......
...@@ -190,6 +190,7 @@ static int bru_enum_mbus_code(struct v4l2_subdev *subdev, ...@@ -190,6 +190,7 @@ static int bru_enum_mbus_code(struct v4l2_subdev *subdev,
MEDIA_BUS_FMT_ARGB8888_1X32, MEDIA_BUS_FMT_ARGB8888_1X32,
MEDIA_BUS_FMT_AYUV8_1X32, MEDIA_BUS_FMT_AYUV8_1X32,
}; };
struct vsp1_bru *bru = to_bru(subdev);
struct v4l2_mbus_framefmt *format; struct v4l2_mbus_framefmt *format;
if (code->pad == BRU_PAD_SINK(0)) { if (code->pad == BRU_PAD_SINK(0)) {
...@@ -201,7 +202,8 @@ static int bru_enum_mbus_code(struct v4l2_subdev *subdev, ...@@ -201,7 +202,8 @@ static int bru_enum_mbus_code(struct v4l2_subdev *subdev,
if (code->index) if (code->index)
return -EINVAL; return -EINVAL;
format = v4l2_subdev_get_try_format(subdev, cfg, BRU_PAD_SINK(0)); format = vsp1_entity_get_pad_format(&bru->entity, cfg,
BRU_PAD_SINK(0), code->which);
code->code = format->code; code->code = format->code;
} }
......
...@@ -81,6 +81,7 @@ static int lif_enum_mbus_code(struct v4l2_subdev *subdev, ...@@ -81,6 +81,7 @@ static int lif_enum_mbus_code(struct v4l2_subdev *subdev,
MEDIA_BUS_FMT_ARGB8888_1X32, MEDIA_BUS_FMT_ARGB8888_1X32,
MEDIA_BUS_FMT_AYUV8_1X32, MEDIA_BUS_FMT_AYUV8_1X32,
}; };
struct vsp1_lif *lif = to_lif(subdev);
if (code->pad == LIF_PAD_SINK) { if (code->pad == LIF_PAD_SINK) {
if (code->index >= ARRAY_SIZE(codes)) if (code->index >= ARRAY_SIZE(codes))
...@@ -96,7 +97,8 @@ static int lif_enum_mbus_code(struct v4l2_subdev *subdev, ...@@ -96,7 +97,8 @@ static int lif_enum_mbus_code(struct v4l2_subdev *subdev,
if (code->index) if (code->index)
return -EINVAL; return -EINVAL;
format = v4l2_subdev_get_try_format(subdev, cfg, LIF_PAD_SINK); format = vsp1_entity_get_pad_format(&lif->entity, cfg,
LIF_PAD_SINK, code->which);
code->code = format->code; code->code = format->code;
} }
......
...@@ -90,6 +90,7 @@ static int lut_enum_mbus_code(struct v4l2_subdev *subdev, ...@@ -90,6 +90,7 @@ static int lut_enum_mbus_code(struct v4l2_subdev *subdev,
MEDIA_BUS_FMT_AHSV8888_1X32, MEDIA_BUS_FMT_AHSV8888_1X32,
MEDIA_BUS_FMT_AYUV8_1X32, MEDIA_BUS_FMT_AYUV8_1X32,
}; };
struct vsp1_lut *lut = to_lut(subdev);
struct v4l2_mbus_framefmt *format; struct v4l2_mbus_framefmt *format;
if (code->pad == LUT_PAD_SINK) { if (code->pad == LUT_PAD_SINK) {
...@@ -104,7 +105,8 @@ static int lut_enum_mbus_code(struct v4l2_subdev *subdev, ...@@ -104,7 +105,8 @@ static int lut_enum_mbus_code(struct v4l2_subdev *subdev,
if (code->index) if (code->index)
return -EINVAL; return -EINVAL;
format = v4l2_subdev_get_try_format(subdev, cfg, LUT_PAD_SINK); format = vsp1_entity_get_pad_format(&lut->entity, cfg,
LUT_PAD_SINK, code->which);
code->code = format->code; code->code = format->code;
} }
......
...@@ -173,6 +173,7 @@ static int sru_enum_mbus_code(struct v4l2_subdev *subdev, ...@@ -173,6 +173,7 @@ static int sru_enum_mbus_code(struct v4l2_subdev *subdev,
MEDIA_BUS_FMT_ARGB8888_1X32, MEDIA_BUS_FMT_ARGB8888_1X32,
MEDIA_BUS_FMT_AYUV8_1X32, MEDIA_BUS_FMT_AYUV8_1X32,
}; };
struct vsp1_sru *sru = to_sru(subdev);
struct v4l2_mbus_framefmt *format; struct v4l2_mbus_framefmt *format;
if (code->pad == SRU_PAD_SINK) { if (code->pad == SRU_PAD_SINK) {
...@@ -187,7 +188,8 @@ static int sru_enum_mbus_code(struct v4l2_subdev *subdev, ...@@ -187,7 +188,8 @@ static int sru_enum_mbus_code(struct v4l2_subdev *subdev,
if (code->index) if (code->index)
return -EINVAL; return -EINVAL;
format = v4l2_subdev_get_try_format(subdev, cfg, SRU_PAD_SINK); format = vsp1_entity_get_pad_format(&sru->entity, cfg,
SRU_PAD_SINK, code->which);
code->code = format->code; code->code = format->code;
} }
......
...@@ -176,6 +176,7 @@ static int uds_enum_mbus_code(struct v4l2_subdev *subdev, ...@@ -176,6 +176,7 @@ static int uds_enum_mbus_code(struct v4l2_subdev *subdev,
MEDIA_BUS_FMT_ARGB8888_1X32, MEDIA_BUS_FMT_ARGB8888_1X32,
MEDIA_BUS_FMT_AYUV8_1X32, MEDIA_BUS_FMT_AYUV8_1X32,
}; };
struct vsp1_uds *uds = to_uds(subdev);
if (code->pad == UDS_PAD_SINK) { if (code->pad == UDS_PAD_SINK) {
if (code->index >= ARRAY_SIZE(codes)) if (code->index >= ARRAY_SIZE(codes))
...@@ -191,7 +192,8 @@ static int uds_enum_mbus_code(struct v4l2_subdev *subdev, ...@@ -191,7 +192,8 @@ static int uds_enum_mbus_code(struct v4l2_subdev *subdev,
if (code->index) if (code->index)
return -EINVAL; return -EINVAL;
format = v4l2_subdev_get_try_format(subdev, cfg, UDS_PAD_SINK); format = vsp1_entity_get_pad_format(&uds->entity, cfg,
UDS_PAD_SINK, code->which);
code->code = format->code; code->code = format->code;
} }
......
...@@ -908,7 +908,7 @@ static int csi2_enum_mbus_code(struct v4l2_subdev *sd, ...@@ -908,7 +908,7 @@ static int csi2_enum_mbus_code(struct v4l2_subdev *sd,
code->code = csi2_input_fmts[code->index]; code->code = csi2_input_fmts[code->index];
} else { } else {
format = __csi2_get_format(csi2, cfg, CSI2_PAD_SINK, format = __csi2_get_format(csi2, cfg, CSI2_PAD_SINK,
V4L2_SUBDEV_FORMAT_TRY); code->which);
switch (code->index) { switch (code->index) {
case 0: case 0:
/* Passthrough sink pad code */ /* Passthrough sink pad code */
......
...@@ -467,7 +467,7 @@ static int ipipeif_enum_mbus_code(struct v4l2_subdev *sd, ...@@ -467,7 +467,7 @@ static int ipipeif_enum_mbus_code(struct v4l2_subdev *sd,
return -EINVAL; return -EINVAL;
format = __ipipeif_get_format(ipipeif, cfg, IPIPEIF_PAD_SINK, format = __ipipeif_get_format(ipipeif, cfg, IPIPEIF_PAD_SINK,
V4L2_SUBDEV_FORMAT_TRY); code->which);
code->code = format->code; code->code = format->code;
break; break;
......
...@@ -513,7 +513,7 @@ static int resizer_enum_mbus_code(struct v4l2_subdev *sd, ...@@ -513,7 +513,7 @@ static int resizer_enum_mbus_code(struct v4l2_subdev *sd,
case RESIZER_PAD_SOURCE_MEM: case RESIZER_PAD_SOURCE_MEM:
format = __resizer_get_format(resizer, cfg, RESIZER_PAD_SINK, format = __resizer_get_format(resizer, cfg, RESIZER_PAD_SINK,
V4L2_SUBDEV_FORMAT_TRY); code->which);
if (code->index == 0) { if (code->index == 0) {
code->code = format->code; code->code = format->code;
......
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