From: "Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Hans Verkuil <hverkuil@xs4all.nl>
Cc: linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
tomoharu.fukawa.eb@renesas.com,
"Wolfram Sang" <wsa@the-dreams.de>,
"Niklas Söderlund" <niklas.soderlund+renesas@ragnatech.se>
Subject: [PATCH 06/11] media: rcar-vin: move subdev source and sink pad index to rvin_graph_entity
Date: Tue, 31 Jan 2017 16:40:11 +0100 [thread overview]
Message-ID: <20170131154016.15526-7-niklas.soderlund+renesas@ragnatech.se> (raw)
In-Reply-To: <20170131154016.15526-1-niklas.soderlund+renesas@ragnatech.se>
It makes more sens to store the sink and source pad index in struct
rvin_graph_entity since that contains other subdevice related
information. Add complete documentation for struct rvin_graph_entity
while we are at it.
Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
---
drivers/media/platform/rcar-vin/rcar-v4l2.c | 45 ++++++++++++++++++++++-------
drivers/media/platform/rcar-vin/rcar-vin.h | 17 ++++++-----
2 files changed, 44 insertions(+), 18 deletions(-)
diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c
index 370bb184e5faace7..f8ff7c43944dd64a 100644
--- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
+++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
@@ -109,9 +109,14 @@ static int rvin_reset_format(struct rvin_dev *vin)
.which = V4L2_SUBDEV_FORMAT_ACTIVE,
};
struct v4l2_mbus_framefmt *mf = &fmt.format;
+ struct rvin_graph_entity *rent;
int ret;
- fmt.pad = vin->src_pad_idx;
+ rent = vin_to_entity(vin);
+ if (!rent)
+ return -ENODEV;
+
+ fmt.pad = rent->source_pad_idx;
ret = v4l2_subdev_call(vin_to_source(vin), pad, get_fmt, NULL, &fmt);
if (ret)
@@ -182,7 +187,7 @@ static int __rvin_try_format_source(struct rvin_dev *vin,
if (pad_cfg == NULL)
return -ENOMEM;
- format.pad = vin->src_pad_idx;
+ format.pad = rent->source_pad_idx;
field = pix->field;
@@ -560,12 +565,17 @@ static int rvin_enum_dv_timings(struct file *file, void *priv_fh,
{
struct rvin_dev *vin = video_drvdata(file);
struct v4l2_subdev *sd = vin_to_source(vin);
+ struct rvin_graph_entity *rent;
int ret;
+ rent = vin_to_entity(vin);
+ if (!rent)
+ return -ENODEV;
+
if (timings->pad)
return -EINVAL;
- timings->pad = vin->sink_pad_idx;
+ timings->pad = rent->sink_pad_idx;
ret = v4l2_subdev_call(sd, pad, enum_dv_timings, timings);
@@ -612,12 +622,17 @@ static int rvin_dv_timings_cap(struct file *file, void *priv_fh,
{
struct rvin_dev *vin = video_drvdata(file);
struct v4l2_subdev *sd = vin_to_source(vin);
+ struct rvin_graph_entity *rent;
int ret;
+ rent = vin_to_entity(vin);
+ if (!rent)
+ return -ENODEV;
+
if (cap->pad)
return -EINVAL;
- cap->pad = vin->sink_pad_idx;
+ cap->pad = rent->sink_pad_idx;
ret = v4l2_subdev_call(sd, pad, dv_timings_cap, cap);
@@ -630,12 +645,17 @@ static int rvin_g_edid(struct file *file, void *fh, struct v4l2_edid *edid)
{
struct rvin_dev *vin = video_drvdata(file);
struct v4l2_subdev *sd = vin_to_source(vin);
+ struct rvin_graph_entity *rent;
int ret;
+ rent = vin_to_entity(vin);
+ if (!rent)
+ return -ENODEV;
+
if (edid->pad)
return -EINVAL;
- edid->pad = vin->sink_pad_idx;
+ edid->pad = rent->sink_pad_idx;
ret = v4l2_subdev_call(sd, pad, get_edid, edid);
@@ -648,12 +668,17 @@ static int rvin_s_edid(struct file *file, void *fh, struct v4l2_edid *edid)
{
struct rvin_dev *vin = video_drvdata(file);
struct v4l2_subdev *sd = vin_to_source(vin);
+ struct rvin_graph_entity *rent;
int ret;
+ rent = vin_to_entity(vin);
+ if (!rent)
+ return -ENODEV;
+
if (edid->pad)
return -EINVAL;
- edid->pad = vin->sink_pad_idx;
+ edid->pad = rent->sink_pad_idx;
ret = v4l2_subdev_call(sd, pad, set_edid, edid);
@@ -926,19 +951,19 @@ int rvin_v4l2_probe(struct rvin_dev *vin)
vdev->device_caps = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING |
V4L2_CAP_READWRITE;
- vin->src_pad_idx = 0;
+ vin->digital.source_pad_idx = 0;
for (pad_idx = 0; pad_idx < sd->entity.num_pads; pad_idx++)
if (sd->entity.pads[pad_idx].flags == MEDIA_PAD_FL_SOURCE)
break;
if (pad_idx >= sd->entity.num_pads)
return -EINVAL;
- vin->src_pad_idx = pad_idx;
+ vin->digital.source_pad_idx = pad_idx;
- vin->sink_pad_idx = 0;
+ vin->digital.sink_pad_idx = 0;
for (pad_idx = 0; pad_idx < sd->entity.num_pads; pad_idx++)
if (sd->entity.pads[pad_idx].flags == MEDIA_PAD_FL_SINK) {
- vin->sink_pad_idx = pad_idx;
+ vin->digital.sink_pad_idx = pad_idx;
break;
}
diff --git a/drivers/media/platform/rcar-vin/rcar-vin.h b/drivers/media/platform/rcar-vin/rcar-vin.h
index daec26a38d896b21..d31212a992e15506 100644
--- a/drivers/media/platform/rcar-vin/rcar-vin.h
+++ b/drivers/media/platform/rcar-vin/rcar-vin.h
@@ -70,10 +70,12 @@ struct rvin_video_format {
/**
* struct rvin_graph_entity - Video endpoint from async framework
- * @asd: sub-device descriptor for async framework
- * @subdev: subdevice matched using async framework
- * @code: Media bus format from source
- * @mbus_cfg: Media bus format from DT
+ * @asd: sub-device descriptor for async framework
+ * @subdev: subdevice matched using async framework
+ * @code: Media bus format from source
+ * @mbus_cfg: Media bus format from DT
+ * @source_pad_idx: source pad index on remote device
+ * @sink_pad_idx: sink pad index on remote device
*/
struct rvin_graph_entity {
struct v4l2_async_subdev asd;
@@ -81,6 +83,9 @@ struct rvin_graph_entity {
u32 code;
struct v4l2_mbus_config mbus_cfg;
+
+ int source_pad_idx;
+ int sink_pad_idx;
};
/**
@@ -91,8 +96,6 @@ struct rvin_graph_entity {
*
* @vdev: V4L2 video device associated with VIN
* @v4l2_dev: V4L2 device
- * @src_pad_idx: source pad index for media controller drivers
- * @sink_pad_idx: sink pad index for media controller drivers
* @ctrl_handler: V4L2 control handler
* @notifier: V4L2 asynchronous subdevs notifier
* @digital: entity in the DT for local digital subdevice
@@ -121,8 +124,6 @@ struct rvin_dev {
struct video_device vdev;
struct v4l2_device v4l2_dev;
- int src_pad_idx;
- int sink_pad_idx;
struct v4l2_ctrl_handler ctrl_handler;
struct v4l2_async_notifier notifier;
struct rvin_graph_entity digital;
--
2.11.0
next prev parent reply other threads:[~2017-01-31 15:50 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-01-31 15:40 [PATCH 00/11] media: rcar-vin: fix OPS and format/pad index issues Niklas Söderlund
2017-01-31 15:40 ` [PATCH 01/11] media: rcar-vin: reset bytesperline and sizeimage when resetting format Niklas Söderlund
2017-01-31 15:40 ` [PATCH 02/11] media: rcar-vin: use rvin_reset_format() in S_DV_TIMINGS Niklas Söderlund
2017-01-31 15:40 ` [PATCH 03/11] media: rcar-vin: fix how pads are handled for v4l2 subdeivce operations Niklas Söderlund
2017-01-31 15:40 ` [PATCH 04/11] media: rcar-vin: fix standard in input enumeration Niklas Söderlund
2017-01-31 15:40 ` [PATCH 05/11] media: rcar-vin: add wrapper to get rvin_graph_entity Niklas Söderlund
2017-01-31 15:40 ` Niklas Söderlund [this message]
2017-01-31 15:40 ` [PATCH 07/11] media: rcar-vin: move pad index discovery to async complete handler Niklas Söderlund
2017-01-31 15:40 ` [PATCH 08/11] media: rcar-vin: refactor pad lookup code Niklas Söderlund
2017-01-31 15:40 ` [PATCH 09/11] media: rcar-vin: use pad information when verifying media bus format Niklas Söderlund
2017-01-31 15:40 ` [PATCH 10/11] media: rcar-vin: split rvin_s_fmt_vid_cap() Niklas Söderlund
2017-01-31 15:40 ` [PATCH 11/11] media: rcar-vin: register the video device early Niklas Söderlund
2017-02-07 11:20 ` [PATCH 00/11] media: rcar-vin: fix OPS and format/pad index issues Wolfram Sang
2017-02-13 14:19 ` Hans Verkuil
2017-02-13 15:31 ` Laurent Pinchart
2017-02-13 15:43 ` Hans Verkuil
2017-02-13 17:47 ` Niklas Söderlund
2017-02-13 20:57 ` Hans Verkuil
2017-02-14 6:40 ` Niklas Söderlund
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20170131154016.15526-7-niklas.soderlund+renesas@ragnatech.se \
--to=niklas.soderlund+renesas@ragnatech.se \
--cc=hverkuil@xs4all.nl \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=tomoharu.fukawa.eb@renesas.com \
--cc=wsa@the-dreams.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).