[PATCH 4/4] soc-camera: tw9910: Add V4L2_FIELD_INTERLACED_TB/BT support

Kuninori Morimoto <[email protected]>
Newsgroups gmane.comp.video.video4linux
Message-ID <u8wfx9hub.wl%[email protected]>
Signed-off-by: Kuninori Morimoto <[email protected]>
---
 drivers/media/video/tw9910.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/media/video/tw9910.c b/drivers/media/video/tw9910.c
index 8e3d9e0..d15f816 100644
--- a/drivers/media/video/tw9910.c
+++ b/drivers/media/video/tw9910.c
@@ -830,10 +830,16 @@ static int tw9910_try_fmt(struct v4l2_subdev *sd, struct v4l2_format *f)
 	struct soc_camera_device *icd = client->dev.platform_data;
 	struct v4l2_pix_format *pix = &f->fmt.pix;
 	const struct tw9910_scale_ctrl *scale;
+	enum v4l2_field field;
 
-	if (V4L2_FIELD_ANY == pix->field) {
-		pix->field = V4L2_FIELD_INTERLACED;
-	} else if (V4L2_FIELD_INTERLACED != pix->field) {
+	field = i2c_smbus_read_byte_data(client, STATUS1) & 0x10 ?
+		V4L2_FIELD_INTERLACED_TB : V4L2_FIELD_INTERLACED_BT;
+
+	if ((V4L2_FIELD_ANY           == pix->field) ||
+	    (V4L2_FIELD_INTERLACED_TB == pix->field) ||
+	    (V4L2_FIELD_INTERLACED_BT == pix->field)) {
+		pix->field = field;
+	} else if (field != pix->field) {
 		dev_err(&client->dev, "Field type invalid.\n");
 		return -EINVAL;
 	}
-- 
1.6.0.4

--
video4linux-list mailing list
Unsubscribe mailto:[email protected]?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/video4linux-list
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.