Commit b50b77e6 authored by Niklas Söderlund's avatar Niklas Söderlund Committed by Mauro Carvalho Chehab

[media] rcar-vin: move media bus information to struct rvin_graph_entity

The primary reason for this change is to prepare for Gen3 support where
there will be more then one possible video source. Each source will have
its own media bus format and code, so it needs to be moved from the per
device structure to a structure used to represent an individual
connection to a video source.
Signed-off-by: default avatarNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 83fba2c0
...@@ -31,9 +31,9 @@ ...@@ -31,9 +31,9 @@
#define notifier_to_vin(n) container_of(n, struct rvin_dev, notifier) #define notifier_to_vin(n) container_of(n, struct rvin_dev, notifier)
static bool rvin_mbus_supported(struct rvin_dev *vin) static bool rvin_mbus_supported(struct rvin_graph_entity *entity)
{ {
struct v4l2_subdev *sd = vin->digital.subdev; struct v4l2_subdev *sd = entity->subdev;
struct v4l2_subdev_mbus_code_enum code = { struct v4l2_subdev_mbus_code_enum code = {
.which = V4L2_SUBDEV_FORMAT_ACTIVE, .which = V4L2_SUBDEV_FORMAT_ACTIVE,
}; };
...@@ -46,7 +46,7 @@ static bool rvin_mbus_supported(struct rvin_dev *vin) ...@@ -46,7 +46,7 @@ static bool rvin_mbus_supported(struct rvin_dev *vin)
case MEDIA_BUS_FMT_YUYV8_2X8: case MEDIA_BUS_FMT_YUYV8_2X8:
case MEDIA_BUS_FMT_YUYV10_2X10: case MEDIA_BUS_FMT_YUYV10_2X10:
case MEDIA_BUS_FMT_RGB888_1X24: case MEDIA_BUS_FMT_RGB888_1X24:
vin->source.code = code.code; entity->code = code.code;
return true; return true;
default: default:
break; break;
...@@ -62,14 +62,14 @@ static int rvin_digital_notify_complete(struct v4l2_async_notifier *notifier) ...@@ -62,14 +62,14 @@ static int rvin_digital_notify_complete(struct v4l2_async_notifier *notifier)
int ret; int ret;
/* Verify subdevices mbus format */ /* Verify subdevices mbus format */
if (!rvin_mbus_supported(vin)) { if (!rvin_mbus_supported(&vin->digital)) {
vin_err(vin, "Unsupported media bus format for %s\n", vin_err(vin, "Unsupported media bus format for %s\n",
vin->digital.subdev->name); vin->digital.subdev->name);
return -EINVAL; return -EINVAL;
} }
vin_dbg(vin, "Found media bus format for %s: %d\n", vin_dbg(vin, "Found media bus format for %s: %d\n",
vin->digital.subdev->name, vin->source.code); vin->digital.subdev->name, vin->digital.code);
ret = v4l2_device_register_subdev_nodes(&vin->v4l2_dev); ret = v4l2_device_register_subdev_nodes(&vin->v4l2_dev);
if (ret < 0) { if (ret < 0) {
...@@ -170,7 +170,7 @@ static int rvin_digital_graph_parse(struct rvin_dev *vin) ...@@ -170,7 +170,7 @@ static int rvin_digital_graph_parse(struct rvin_dev *vin)
} }
of_node_put(np); of_node_put(np);
ret = rvin_digitial_parse_v4l2(vin, ep, &vin->mbus_cfg); ret = rvin_digitial_parse_v4l2(vin, ep, &vin->digital.mbus_cfg);
of_node_put(ep); of_node_put(ep);
if (ret) if (ret)
return ret; return ret;
......
...@@ -163,7 +163,7 @@ static int rvin_setup(struct rvin_dev *vin) ...@@ -163,7 +163,7 @@ static int rvin_setup(struct rvin_dev *vin)
/* /*
* Input interface * Input interface
*/ */
switch (vin->source.code) { switch (vin->digital.code) {
case MEDIA_BUS_FMT_YUYV8_1X16: case MEDIA_BUS_FMT_YUYV8_1X16:
/* BT.601/BT.1358 16bit YCbCr422 */ /* BT.601/BT.1358 16bit YCbCr422 */
vnmc |= VNMC_INF_YUV16; vnmc |= VNMC_INF_YUV16;
...@@ -171,7 +171,7 @@ static int rvin_setup(struct rvin_dev *vin) ...@@ -171,7 +171,7 @@ static int rvin_setup(struct rvin_dev *vin)
break; break;
case MEDIA_BUS_FMT_YUYV8_2X8: case MEDIA_BUS_FMT_YUYV8_2X8:
/* BT.656 8bit YCbCr422 or BT.601 8bit YCbCr422 */ /* BT.656 8bit YCbCr422 or BT.601 8bit YCbCr422 */
vnmc |= vin->mbus_cfg.type == V4L2_MBUS_BT656 ? vnmc |= vin->digital.mbus_cfg.type == V4L2_MBUS_BT656 ?
VNMC_INF_YUV8_BT656 : VNMC_INF_YUV8_BT601; VNMC_INF_YUV8_BT656 : VNMC_INF_YUV8_BT601;
input_is_yuv = true; input_is_yuv = true;
break; break;
...@@ -180,7 +180,7 @@ static int rvin_setup(struct rvin_dev *vin) ...@@ -180,7 +180,7 @@ static int rvin_setup(struct rvin_dev *vin)
break; break;
case MEDIA_BUS_FMT_YUYV10_2X10: case MEDIA_BUS_FMT_YUYV10_2X10:
/* BT.656 10bit YCbCr422 or BT.601 10bit YCbCr422 */ /* BT.656 10bit YCbCr422 or BT.601 10bit YCbCr422 */
vnmc |= vin->mbus_cfg.type == V4L2_MBUS_BT656 ? vnmc |= vin->digital.mbus_cfg.type == V4L2_MBUS_BT656 ?
VNMC_INF_YUV10_BT656 : VNMC_INF_YUV10_BT601; VNMC_INF_YUV10_BT656 : VNMC_INF_YUV10_BT601;
input_is_yuv = true; input_is_yuv = true;
break; break;
...@@ -192,11 +192,11 @@ static int rvin_setup(struct rvin_dev *vin) ...@@ -192,11 +192,11 @@ static int rvin_setup(struct rvin_dev *vin)
dmr2 = VNDMR2_FTEV | VNDMR2_VLV(1); dmr2 = VNDMR2_FTEV | VNDMR2_VLV(1);
/* Hsync Signal Polarity Select */ /* Hsync Signal Polarity Select */
if (!(vin->mbus_cfg.flags & V4L2_MBUS_HSYNC_ACTIVE_LOW)) if (!(vin->digital.mbus_cfg.flags & V4L2_MBUS_HSYNC_ACTIVE_LOW))
dmr2 |= VNDMR2_HPS; dmr2 |= VNDMR2_HPS;
/* Vsync Signal Polarity Select */ /* Vsync Signal Polarity Select */
if (!(vin->mbus_cfg.flags & V4L2_MBUS_VSYNC_ACTIVE_LOW)) if (!(vin->digital.mbus_cfg.flags & V4L2_MBUS_VSYNC_ACTIVE_LOW))
dmr2 |= VNDMR2_VPS; dmr2 |= VNDMR2_VPS;
/* /*
......
...@@ -106,7 +106,7 @@ static int __rvin_try_format_source(struct rvin_dev *vin, ...@@ -106,7 +106,7 @@ static int __rvin_try_format_source(struct rvin_dev *vin,
sd = vin_to_source(vin); sd = vin_to_source(vin);
v4l2_fill_mbus_format(&format.format, pix, vin->source.code); v4l2_fill_mbus_format(&format.format, pix, vin->digital.code);
pad_cfg = v4l2_subdev_alloc_pad_config(sd); pad_cfg = v4l2_subdev_alloc_pad_config(sd);
if (pad_cfg == NULL) if (pad_cfg == NULL)
......
...@@ -50,12 +50,10 @@ enum rvin_dma_state { ...@@ -50,12 +50,10 @@ enum rvin_dma_state {
/** /**
* struct rvin_source_fmt - Source information * struct rvin_source_fmt - Source information
* @code: Media bus format from source
* @width: Width from source * @width: Width from source
* @height: Height from source * @height: Height from source
*/ */
struct rvin_source_fmt { struct rvin_source_fmt {
u32 code;
u32 width; u32 width;
u32 height; u32 height;
}; };
...@@ -74,10 +72,15 @@ struct rvin_video_format { ...@@ -74,10 +72,15 @@ struct rvin_video_format {
* struct rvin_graph_entity - Video endpoint from async framework * struct rvin_graph_entity - Video endpoint from async framework
* @asd: sub-device descriptor for async framework * @asd: sub-device descriptor for async framework
* @subdev: subdevice matched using async framework * @subdev: subdevice matched using async framework
* @code: Media bus format from source
* @mbus_cfg: Media bus format from DT
*/ */
struct rvin_graph_entity { struct rvin_graph_entity {
struct v4l2_async_subdev asd; struct v4l2_async_subdev asd;
struct v4l2_subdev *subdev; struct v4l2_subdev *subdev;
u32 code;
struct v4l2_mbus_config mbus_cfg;
}; };
/** /**
...@@ -85,7 +88,6 @@ struct rvin_graph_entity { ...@@ -85,7 +88,6 @@ struct rvin_graph_entity {
* @dev: (OF) device * @dev: (OF) device
* @base: device I/O register space remapped to virtual memory * @base: device I/O register space remapped to virtual memory
* @chip: type of VIN chip * @chip: type of VIN chip
* @mbus_cfg media bus configuration
* *
* @vdev: V4L2 video device associated with VIN * @vdev: V4L2 video device associated with VIN
* @v4l2_dev: V4L2 device * @v4l2_dev: V4L2 device
...@@ -115,7 +117,6 @@ struct rvin_dev { ...@@ -115,7 +117,6 @@ struct rvin_dev {
struct device *dev; struct device *dev;
void __iomem *base; void __iomem *base;
enum chip_id chip; enum chip_id chip;
struct v4l2_mbus_config mbus_cfg;
struct video_device vdev; struct video_device vdev;
struct v4l2_device v4l2_dev; struct v4l2_device v4l2_dev;
......
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