Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>

authored by

Niklas Söderlund and committed by
Mauro Carvalho Chehab
b50b77e6 83fba2c0

+17 -16
+6 -6
drivers/media/platform/rcar-vin/rcar-core.c
··· 31 31 32 32 #define notifier_to_vin(n) container_of(n, struct rvin_dev, notifier) 33 33 34 - static bool rvin_mbus_supported(struct rvin_dev *vin) 34 + static bool rvin_mbus_supported(struct rvin_graph_entity *entity) 35 35 { 36 - struct v4l2_subdev *sd = vin->digital.subdev; 36 + struct v4l2_subdev *sd = entity->subdev; 37 37 struct v4l2_subdev_mbus_code_enum code = { 38 38 .which = V4L2_SUBDEV_FORMAT_ACTIVE, 39 39 }; ··· 46 46 case MEDIA_BUS_FMT_YUYV8_2X8: 47 47 case MEDIA_BUS_FMT_YUYV10_2X10: 48 48 case MEDIA_BUS_FMT_RGB888_1X24: 49 - vin->source.code = code.code; 49 + entity->code = code.code; 50 50 return true; 51 51 default: 52 52 break; ··· 62 62 int ret; 63 63 64 64 /* Verify subdevices mbus format */ 65 - if (!rvin_mbus_supported(vin)) { 65 + if (!rvin_mbus_supported(&vin->digital)) { 66 66 vin_err(vin, "Unsupported media bus format for %s\n", 67 67 vin->digital.subdev->name); 68 68 return -EINVAL; 69 69 } 70 70 71 71 vin_dbg(vin, "Found media bus format for %s: %d\n", 72 - vin->digital.subdev->name, vin->source.code); 72 + vin->digital.subdev->name, vin->digital.code); 73 73 74 74 ret = v4l2_device_register_subdev_nodes(&vin->v4l2_dev); 75 75 if (ret < 0) { ··· 170 170 } 171 171 of_node_put(np); 172 172 173 - ret = rvin_digitial_parse_v4l2(vin, ep, &vin->mbus_cfg); 173 + ret = rvin_digitial_parse_v4l2(vin, ep, &vin->digital.mbus_cfg); 174 174 of_node_put(ep); 175 175 if (ret) 176 176 return ret;
+5 -5
drivers/media/platform/rcar-vin/rcar-dma.c
··· 163 163 /* 164 164 * Input interface 165 165 */ 166 - switch (vin->source.code) { 166 + switch (vin->digital.code) { 167 167 case MEDIA_BUS_FMT_YUYV8_1X16: 168 168 /* BT.601/BT.1358 16bit YCbCr422 */ 169 169 vnmc |= VNMC_INF_YUV16; ··· 171 171 break; 172 172 case MEDIA_BUS_FMT_YUYV8_2X8: 173 173 /* BT.656 8bit YCbCr422 or BT.601 8bit YCbCr422 */ 174 - vnmc |= vin->mbus_cfg.type == V4L2_MBUS_BT656 ? 174 + vnmc |= vin->digital.mbus_cfg.type == V4L2_MBUS_BT656 ? 175 175 VNMC_INF_YUV8_BT656 : VNMC_INF_YUV8_BT601; 176 176 input_is_yuv = true; 177 177 break; ··· 180 180 break; 181 181 case MEDIA_BUS_FMT_YUYV10_2X10: 182 182 /* BT.656 10bit YCbCr422 or BT.601 10bit YCbCr422 */ 183 - vnmc |= vin->mbus_cfg.type == V4L2_MBUS_BT656 ? 183 + vnmc |= vin->digital.mbus_cfg.type == V4L2_MBUS_BT656 ? 184 184 VNMC_INF_YUV10_BT656 : VNMC_INF_YUV10_BT601; 185 185 input_is_yuv = true; 186 186 break; ··· 192 192 dmr2 = VNDMR2_FTEV | VNDMR2_VLV(1); 193 193 194 194 /* Hsync Signal Polarity Select */ 195 - if (!(vin->mbus_cfg.flags & V4L2_MBUS_HSYNC_ACTIVE_LOW)) 195 + if (!(vin->digital.mbus_cfg.flags & V4L2_MBUS_HSYNC_ACTIVE_LOW)) 196 196 dmr2 |= VNDMR2_HPS; 197 197 198 198 /* Vsync Signal Polarity Select */ 199 - if (!(vin->mbus_cfg.flags & V4L2_MBUS_VSYNC_ACTIVE_LOW)) 199 + if (!(vin->digital.mbus_cfg.flags & V4L2_MBUS_VSYNC_ACTIVE_LOW)) 200 200 dmr2 |= VNDMR2_VPS; 201 201 202 202 /*
+1 -1
drivers/media/platform/rcar-vin/rcar-v4l2.c
··· 106 106 107 107 sd = vin_to_source(vin); 108 108 109 - v4l2_fill_mbus_format(&format.format, pix, vin->source.code); 109 + v4l2_fill_mbus_format(&format.format, pix, vin->digital.code); 110 110 111 111 pad_cfg = v4l2_subdev_alloc_pad_config(sd); 112 112 if (pad_cfg == NULL)
+5 -4
drivers/media/platform/rcar-vin/rcar-vin.h
··· 50 50 51 51 /** 52 52 * struct rvin_source_fmt - Source information 53 - * @code: Media bus format from source 54 53 * @width: Width from source 55 54 * @height: Height from source 56 55 */ 57 56 struct rvin_source_fmt { 58 - u32 code; 59 57 u32 width; 60 58 u32 height; 61 59 }; ··· 72 74 * struct rvin_graph_entity - Video endpoint from async framework 73 75 * @asd: sub-device descriptor for async framework 74 76 * @subdev: subdevice matched using async framework 77 + * @code: Media bus format from source 78 + * @mbus_cfg: Media bus format from DT 75 79 */ 76 80 struct rvin_graph_entity { 77 81 struct v4l2_async_subdev asd; 78 82 struct v4l2_subdev *subdev; 83 + 84 + u32 code; 85 + struct v4l2_mbus_config mbus_cfg; 79 86 }; 80 87 81 88 /** ··· 88 85 * @dev: (OF) device 89 86 * @base: device I/O register space remapped to virtual memory 90 87 * @chip: type of VIN chip 91 - * @mbus_cfg media bus configuration 92 88 * 93 89 * @vdev: V4L2 video device associated with VIN 94 90 * @v4l2_dev: V4L2 device ··· 117 115 struct device *dev; 118 116 void __iomem *base; 119 117 enum chip_id chip; 120 - struct v4l2_mbus_config mbus_cfg; 121 118 122 119 struct video_device vdev; 123 120 struct v4l2_device v4l2_dev;