rcar_vin: propagate querystd() error upstream
Subsystems (2)
PATCH 1/1 rcar_vin: propagate querystd() error upstream
rcar_vin_set_fmt() defaults to PAL when the subdevice's querystd() method call fails (e.g. due to I2C error). This doesn't work very well when a camera being used outputs NTSC which has different order of fields and resolution. Let us stop pretending and return the actual error (which would prevent video capture on at least Renesas Henninger/Porter board where I2C seems particularly buggy).
---
The patch is against the 'media_tree.git' repo's 'fixes' branch.
drivers/media/platform/soc_camera/rcar_vin.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Index: media_tree/drivers/media/platform/soc_camera/rcar_vin.c =================================--- media_tree.orig/drivers/media/platform/soc_camera/rcar_vin.c +++ media_tree/drivers/media/platform/soc_camera/rcar_vin.c
@@ -1592,7 +1592,7 @@ static int rcar_vin_set_fmt(struct soc_c
/* Query for standard if not explicitly mentioned _TB/_BT */
ret = v4l2_subdev_call(sd, video, querystd, &std);
if (ret < 0)
- std = V4L2_STD_625_50;
+ return ret;
field = std & V4L2_STD_625_50 ? V4L2_FIELD_INTERLACED_TB :
V4L2_FIELD_INTERLACED_BT;
Hi Sergei,
Thank you for the patch.
Quoted 19 lines · On Thursday 20 August 2015 00:02:17 Sergei Shtylyov wrote:
rcar_vin_set_fmt()defaults to PAL when the subdevice'squerystd()method call fails (e.g. due to I2C error). This doesn't work very well when a camera being used outputs NTSC which has different order of fields and resolution. Let us stop pretending and return the actual error (which would prevent video capture on at least Renesas Henninger/Porter board where I2C seems particularly buggy).Signed-off-by Sergei Shtylyov <[email protected]>---
The patch is against the 'media_tree.git' repo's 'fixes' branch.drivers/media/platform/soc_camera/rcar_vin.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Index:
media_tree/drivers/media/platform/soc_camera/rcar_vin.c=================================> ---media_tree.orig/drivers/media/platform/soc_camera/rcar_vin.c+++media_tree/drivers/media/platform/soc_camera/rcar_vin.c
Review static int rcar_vin_set_fmt(struct soc_c · line 1595
Quoted 5 lines
(quoted diff) +1
-1@@ -1592,7 +1592,7 @@ static int rcar_vin_set_fmt(struct soc_c /* Query for standard if not explicitly mentioned _TB/_BT */ ret = v4l2_subdev_call(sd, video, querystd, &std); if (ret < 0) - std = V4L2_STD_625_50; + return ret;
What if the subdev doesn't implement querystd ? That's the case of camera sensors for instance. In that case we should default to V4L2_FIELD_NONE.
Quoted 2 lines
(quoted diff) +0
-0field = std & V4L2_STD_625_50 ? V4L2_FIELD_INTERLACED_TB : V4L2_FIELD_INTERLACED_BT;
Signature · 3 lines
Regards, Laurent Pinchart
hello.
Quoted 15 lines · Laurent Pinchart
Quoted 15 lines
rcar_vin_set_fmt()defaults to PAL when the subdevice'squerystd()method call fails (e.g. due to I2C error). This doesn't work very well when a camera being used outputs NTSC which has different order of fields and resolution. Let us stop pretending and return the actual error (which would prevent video capture on at least Renesas Henninger/Porter board where I2C seems particularly buggy).Signed-off-by Sergei Shtylyov <[email protected]>---
The patch is against the 'media_tree.git' repo's 'fixes' branch.drivers/media/platform/soc_camera/rcar_vin.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 12 lines
Review static int rcar_vin_set_fmt(struct soc_c · line 1595
Quoted 9 lines
Index:
media_tree/drivers/media/platform/soc_camera/rcar_vin.c=================================>> ---media_tree.orig/drivers/media/platform/soc_camera/rcar_vin.c+++media_tree/drivers/media/platform/soc_camera/rcar_vin.c(quoted diff) +1
-1@@ -1592,7 +1592,7 @@ static int rcar_vin_set_fmt(struct soc_c /* Query for standard if not explicitly mentioned _TB/_BT */ ret = v4l2_subdev_call(sd, video, querystd, &std); if (ret < 0) - std = V4L2_STD_625_50; + return ret;What if the subdev doesn't implement querystd ? That's the case of camera sensors for instance.
Indeed.
Quoted 1 line
In that case we should default to
V4L2_FIELD_NONE.
Hmm, even if the set_fmt() method is called with V4L2_FIELD_INTERLACED
already, like in this case?
Quoted 2 lines
Review static int rcar_vin_set_fmt(struct soc_c · line 1597
Quoted 2 lines
(quoted diff) +0
-0field = std & V4L2_STD_625_50 ? V4L2_FIELD_INTERLACED_TB : V4L2_FIELD_INTERLACED_BT;
MBR, Sergei
Quoted 18 lines · Sergei Shtylyov
rcar_vin_set_fmt()defaults to PAL when the subdevice'squerystd()method call fails (e.g. due to I2C error). This doesn't work very well when a camera being used outputs NTSC which has different order of fields and resolution. Let us stop pretending and return the actual error (which would prevent video capture on at least Renesas Henninger/Porter board where I2C seems particularly buggy).Signed-off-by Sergei Shtylyov <[email protected]>---
The patch is against the 'media_tree.git' repo's 'fixes' branch.drivers/media/platform/soc_camera/rcar_vin.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Index:
media_tree/drivers/media/platform/soc_camera/rcar_vin.c=================================> ---media_tree.orig/drivers/media/platform/soc_camera/rcar_vin.c+++media_tree/drivers/media/platform/soc_camera/rcar_vin.c
Review static int rcar_vin_set_fmt(struct soc_c · line 1593
Quoted 2 lines
(quoted diff) +0
-0@@ -1592,7 +1592,7 @@ static int rcar_vin_set_fmt(struct soc_c /* Query for standard if not explicitly mentioned _TB/_BT */ ret = v4l2_subdev_call(sd, video, querystd, &std);
Ouch, this should never be done like this.
Instead the decision should be made using the last set std, never by querying. So querystd should be replaced by g_std in the v4l2_subdev_call above.
The only place querystd can be called is in the QUERYSTD ioctl, all other ioctls should use the last set standard.
Regards,
Hans
Quoted 12 lines
(quoted diff) +1
-2if (ret < 0) - std = V4L2_STD_625_50; + return ret; field = std & V4L2_STD_625_50 ? V4L2_FIELD_INTERLACED_TB : V4L2_FIELD_INTERLACED_BT; --To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Hi Sergei,
Quoted 30 lines · On Tuesday 25 August 2015 00:58:07 Sergei Shtylyov wrote:
Quoted 20 lines · Laurent Pinchart
Quoted 20 lines
rcar_vin_set_fmt()defaults to PAL when the subdevice'squerystd()method call fails (e.g. due to I2C error). This doesn't work very well when a camera being used outputs NTSC which has different order of fields and resolution. Let us stop pretending and return the actual error (which would prevent video capture on at least Renesas Henninger/Porter board where I2C seems particularly buggy).Signed-off-by Sergei Shtylyov <[email protected]>---
The patch is against the 'media_tree.git' repo's 'fixes' branch.drivers/media/platform/soc_camera/rcar_vin.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)Index:
media_tree/drivers/media/platform/soc_camera/rcar_vin.c=================================> >> ---media_tree.orig/drivers/media/platform/soc_camera/rcar_vin.c+++media_tree/drivers/media/platform/soc_camera/rcar_vin.c(quoted diff) +0
-0@@ -1592,7 +1592,7 @@ static int rcar_vin_set_fmt(struct soc_cQuoted 8 lines
Review static int rcar_vin_set_fmt(struct soc_c · line 1596
Quoted 5 lines
(quoted diff) +1
-1/* Query for standard if not explicitly mentioned _TB/_BT */ ret = v4l2_subdev_call(sd, video, querystd, &std); if (ret < 0) - std = V4L2_STD_625_50; + return ret;What if the subdev doesn't implement querystd ? That's the case of camera sensors for instance.
Quoted 6 lines
Indeed.
Quoted 1 line
In that case we should default to
V4L2_FIELD_NONE.Hmm, even if the
set_fmt()method is called withV4L2_FIELD_INTERLACEDalready, like in this case?
Yes. If the device doesn't support interlacing then the field passed to set_fmt() should be set to V4L2_FIELD_NONE. The V4L2 API requires drivers to fix unsupported parameters passed to the VIDIOC_S_FMT ioctl instead of returning an error like commonly done in such situation.
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
(quoted diff) +0
-0field = std & V4L2_STD_625_50 ? V4L2_FIELD_INTERLACED_TB : V4L2_FIELD_INTERLACED_BT;
Signature · 3 lines
Regards, Laurent Pinchart
Hello.
Quoted 14 lines · Hans Verkuil
Quoted 14 lines
rcar_vin_set_fmt()defaults to PAL when the subdevice'squerystd()method call fails (e.g. due to I2C error). This doesn't work very well when a camera being used outputs NTSC which has different order of fields and resolution. Let us stop pretending and return the actual error (which would prevent video capture on at least Renesas Henninger/Porter board where I2C seems particularly buggy).Signed-off-by Sergei Shtylyov <[email protected]>---
The patch is against the 'media_tree.git' repo's 'fixes' branch.drivers/media/platform/soc_camera/rcar_vin.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 8 lines
Review static int rcar_vin_set_fmt(struct soc_c · line 1593
Quoted 6 lines
Index:
media_tree/drivers/media/platform/soc_camera/rcar_vin.c=================================>> ---media_tree.orig/drivers/media/platform/soc_camera/rcar_vin.c+++media_tree/drivers/media/platform/soc_camera/rcar_vin.c(quoted diff) +0
-0@@ -1592,7 +1592,7 @@ static int rcar_vin_set_fmt(struct soc_c /* Query for standard if not explicitly mentioned _TB/_BT */ ret = v4l2_subdev_call(sd, video, querystd, &std);Ouch, this should never be done like this.
Too late. :-)
Quoted 2 lines
Instead the decision should be made using the last set std, never by querying. So querystd should be replaced by
g_stdin thev4l2_subdev_callabove.
Hm, then this code will stop working, as adv7180.c and ml86v7667.c we use
don't support the g_std() method yet...
Quoted 2 lines
The only place querystd can be called is in the QUERYSTD ioctl, all other ioctls should use the last set standard.
OK, I'll have to fix all the drivers involved...
Quoted 2 lines
Regards,
Hans
MBR, Sergei