linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] rcar_vin: propagate querystd() error upstream
@ 2015-09-01 22:29 Sergei Shtylyov
  0 siblings, 0 replies; only message in thread
From: Sergei Shtylyov @ 2015-09-01 22:29 UTC (permalink / raw)
  To: g.liakhovetski, mchehab, linux-media; +Cc: linux-sh

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 except  when the querystd() method
is not implemented,  in which case  we'll have  to set the 'field' variable  to
V4L2_FIELD_NONE.

Note that doing this would prevent video capture on at least Renesas Henninger/
Porter boards where I2C seems particularly buggy.

Signed-off-by: Sergei Shtylyov <sergei.shtylyov@cogentembedded.com>

---
The patch is against the 'media_tree.git' repo's 'fixes' branch.

Changes in version 2:
- filter out -ENOIOCTLCMD error code and default 'field' to V4L2_FIELD_NONE in
  that case.

 drivers/media/platform/soc_camera/rcar_vin.c |   14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

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
@@ -1591,11 +1591,15 @@ static int rcar_vin_set_fmt(struct soc_c
 	case V4L2_FIELD_INTERLACED:
 		/* 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;
-
-		field = std & V4L2_STD_625_50 ? V4L2_FIELD_INTERLACED_TB :
-						V4L2_FIELD_INTERLACED_BT;
+		if (ret == -ENOIOCTLCMD) {
+			field = V4L2_FIELD_NONE;
+		} else if (ret < 0) {
+			return ret;
+		} else {
+			field = std & V4L2_STD_625_50 ?
+				V4L2_FIELD_INTERLACED_TB :
+				V4L2_FIELD_INTERLACED_BT;
+		}
 		break;
 	}
 


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2015-09-01 22:29 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-01 22:29 [PATCH v2] rcar_vin: propagate querystd() error upstream Sergei Shtylyov

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).