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

[media] rcar-vin: fix how pads are handled for v4l2 subdevice operations

The rcar-vin driver only uses one pad, pad number 0.

- All v4l2 operations that did not check that the requested operation
  was for pad 0 have been updated with a check to enforce this.

- All v4l2 operations that stored (and later restored) the requested pad
  before substituting it for the subdevice pad number have been updated
  to not store the incoming pad and simply restore it to 0 after the
  subdevice operation is complete.
Signed-off-by: default avatarNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent b655741f
...@@ -550,14 +550,16 @@ static int rvin_enum_dv_timings(struct file *file, void *priv_fh, ...@@ -550,14 +550,16 @@ static int rvin_enum_dv_timings(struct file *file, void *priv_fh,
{ {
struct rvin_dev *vin = video_drvdata(file); struct rvin_dev *vin = video_drvdata(file);
struct v4l2_subdev *sd = vin_to_source(vin); struct v4l2_subdev *sd = vin_to_source(vin);
int pad, ret; int ret;
if (timings->pad)
return -EINVAL;
pad = timings->pad;
timings->pad = vin->sink_pad_idx; timings->pad = vin->sink_pad_idx;
ret = v4l2_subdev_call(sd, pad, enum_dv_timings, timings); ret = v4l2_subdev_call(sd, pad, enum_dv_timings, timings);
timings->pad = pad; timings->pad = 0;
return ret; return ret;
} }
...@@ -600,14 +602,16 @@ static int rvin_dv_timings_cap(struct file *file, void *priv_fh, ...@@ -600,14 +602,16 @@ static int rvin_dv_timings_cap(struct file *file, void *priv_fh,
{ {
struct rvin_dev *vin = video_drvdata(file); struct rvin_dev *vin = video_drvdata(file);
struct v4l2_subdev *sd = vin_to_source(vin); struct v4l2_subdev *sd = vin_to_source(vin);
int pad, ret; int ret;
if (cap->pad)
return -EINVAL;
pad = cap->pad;
cap->pad = vin->sink_pad_idx; cap->pad = vin->sink_pad_idx;
ret = v4l2_subdev_call(sd, pad, dv_timings_cap, cap); ret = v4l2_subdev_call(sd, pad, dv_timings_cap, cap);
cap->pad = pad; cap->pad = 0;
return ret; return ret;
} }
...@@ -616,17 +620,16 @@ static int rvin_g_edid(struct file *file, void *fh, struct v4l2_edid *edid) ...@@ -616,17 +620,16 @@ static int rvin_g_edid(struct file *file, void *fh, struct v4l2_edid *edid)
{ {
struct rvin_dev *vin = video_drvdata(file); struct rvin_dev *vin = video_drvdata(file);
struct v4l2_subdev *sd = vin_to_source(vin); struct v4l2_subdev *sd = vin_to_source(vin);
int input, ret; int ret;
if (edid->pad) if (edid->pad)
return -EINVAL; return -EINVAL;
input = edid->pad;
edid->pad = vin->sink_pad_idx; edid->pad = vin->sink_pad_idx;
ret = v4l2_subdev_call(sd, pad, get_edid, edid); ret = v4l2_subdev_call(sd, pad, get_edid, edid);
edid->pad = input; edid->pad = 0;
return ret; return ret;
} }
...@@ -635,17 +638,16 @@ static int rvin_s_edid(struct file *file, void *fh, struct v4l2_edid *edid) ...@@ -635,17 +638,16 @@ static int rvin_s_edid(struct file *file, void *fh, struct v4l2_edid *edid)
{ {
struct rvin_dev *vin = video_drvdata(file); struct rvin_dev *vin = video_drvdata(file);
struct v4l2_subdev *sd = vin_to_source(vin); struct v4l2_subdev *sd = vin_to_source(vin);
int input, ret; int ret;
if (edid->pad) if (edid->pad)
return -EINVAL; return -EINVAL;
input = edid->pad;
edid->pad = vin->sink_pad_idx; edid->pad = vin->sink_pad_idx;
ret = v4l2_subdev_call(sd, pad, set_edid, edid); ret = v4l2_subdev_call(sd, pad, set_edid, edid);
edid->pad = input; edid->pad = 0;
return ret; return ret;
} }
......
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