Message ID | 20160915173324.24539-2-ulrich.hecht+renesas@gmail.com (mailing list archive) |
---|---|
State | Accepted |
Delegated to: | Geert Uytterhoeven |
Headers | show |
Hi Ulrich, Thank you for the patch. On Thursday 15 Sep 2016 19:33:23 Ulrich Hecht wrote: > Adds G_EDID and S_EDID. > > Signed-off-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com> > Acked-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > --- > drivers/media/platform/rcar-vin/rcar-v4l2.c | 48 ++++++++++++++++++++++++++ > drivers/media/platform/rcar-vin/rcar-vin.h | 2 ++ > 2 files changed, 50 insertions(+) > > diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c > b/drivers/media/platform/rcar-vin/rcar-v4l2.c index 61e9b59..f35005c 100644 > --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c > +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c > @@ -613,6 +613,44 @@ static int rvin_dv_timings_cap(struct file *file, void > *priv_fh, return ret; > } > > +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); > + int input, ret; > + > + if (edid->pad) > + return -EINVAL; > + > + input = edid->pad; > + edid->pad = vin->sink_pad_idx; > + > + ret = v4l2_subdev_call(sd, pad, get_edid, edid); > + > + edid->pad = input; > + > + return ret; > +} > + > +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); > + int input, ret; > + > + if (edid->pad) > + return -EINVAL; > + > + input = edid->pad; > + edid->pad = vin->sink_pad_idx; > + > + ret = v4l2_subdev_call(sd, pad, set_edid, edid); > + > + edid->pad = input; > + > + return ret; > +} > + > static const struct v4l2_ioctl_ops rvin_ioctl_ops = { > .vidioc_querycap = rvin_querycap, > .vidioc_try_fmt_vid_cap = rvin_try_fmt_vid_cap, > @@ -635,6 +673,9 @@ static const struct v4l2_ioctl_ops rvin_ioctl_ops = { > .vidioc_s_dv_timings = rvin_s_dv_timings, > .vidioc_query_dv_timings = rvin_query_dv_timings, > > + .vidioc_g_edid = rvin_g_edid, > + .vidioc_s_edid = rvin_s_edid, > + > .vidioc_querystd = rvin_querystd, > .vidioc_g_std = rvin_g_std, > .vidioc_s_std = rvin_s_std, > @@ -883,6 +924,13 @@ int rvin_v4l2_probe(struct rvin_dev *vin) > > vin->src_pad_idx = pad_idx; > > + vin->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; > + break; > + } > + > vin->format.pixelformat = RVIN_DEFAULT_FORMAT; > rvin_reset_format(vin); > > diff --git a/drivers/media/platform/rcar-vin/rcar-vin.h > b/drivers/media/platform/rcar-vin/rcar-vin.h index 793184d..727e215 100644 > --- a/drivers/media/platform/rcar-vin/rcar-vin.h > +++ b/drivers/media/platform/rcar-vin/rcar-vin.h > @@ -92,6 +92,7 @@ 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,6 +122,7 @@ 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;
diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c index 61e9b59..f35005c 100644 --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c @@ -613,6 +613,44 @@ static int rvin_dv_timings_cap(struct file *file, void *priv_fh, return ret; } +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); + int input, ret; + + if (edid->pad) + return -EINVAL; + + input = edid->pad; + edid->pad = vin->sink_pad_idx; + + ret = v4l2_subdev_call(sd, pad, get_edid, edid); + + edid->pad = input; + + return ret; +} + +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); + int input, ret; + + if (edid->pad) + return -EINVAL; + + input = edid->pad; + edid->pad = vin->sink_pad_idx; + + ret = v4l2_subdev_call(sd, pad, set_edid, edid); + + edid->pad = input; + + return ret; +} + static const struct v4l2_ioctl_ops rvin_ioctl_ops = { .vidioc_querycap = rvin_querycap, .vidioc_try_fmt_vid_cap = rvin_try_fmt_vid_cap, @@ -635,6 +673,9 @@ static const struct v4l2_ioctl_ops rvin_ioctl_ops = { .vidioc_s_dv_timings = rvin_s_dv_timings, .vidioc_query_dv_timings = rvin_query_dv_timings, + .vidioc_g_edid = rvin_g_edid, + .vidioc_s_edid = rvin_s_edid, + .vidioc_querystd = rvin_querystd, .vidioc_g_std = rvin_g_std, .vidioc_s_std = rvin_s_std, @@ -883,6 +924,13 @@ int rvin_v4l2_probe(struct rvin_dev *vin) vin->src_pad_idx = pad_idx; + vin->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; + break; + } + vin->format.pixelformat = RVIN_DEFAULT_FORMAT; rvin_reset_format(vin); diff --git a/drivers/media/platform/rcar-vin/rcar-vin.h b/drivers/media/platform/rcar-vin/rcar-vin.h index 793184d..727e215 100644 --- a/drivers/media/platform/rcar-vin/rcar-vin.h +++ b/drivers/media/platform/rcar-vin/rcar-vin.h @@ -92,6 +92,7 @@ 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,6 +122,7 @@ 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;