diff mbox

[v6] V4L2: I2C: ML86V7667 video decoder driver

Message ID 201305311022.31321.hverkuil@xs4all.nl (mailing list archive)
State New, archived
Headers show

Commit Message

Hans Verkuil May 31, 2013, 8:22 a.m. UTC
Hi!

On Wed May 29 2013 20:52:28 Sergei Shtylyov wrote:
> From: Vladimir Barinov <vladimir.barinov@cogentembedded.com>
> 
> Add OKI Semiconductor ML86V7667 video decoder driver.
> 

I've accepted this patch, but I've added a patch to fix this function:

> +static int ml86v7667_querystd(struct v4l2_subdev *sd, v4l2_std_id *std)
> +{
> +	struct i2c_client *client = v4l2_get_subdevdata(sd);
> +	int status;
> +
> +	status = i2c_smbus_read_byte_data(client, STATUS_REG);
> +	if (status < 0)
> +		return status;
> +
> +	if (!(status & STATUS_HLOCK_DETECT))
> +		return V4L2_STD_UNKNOWN;
> +
> +	*std = status & STATUS_NTSCPAL ? V4L2_STD_625_50 : V4L2_STD_525_60;
> +
> +	return 0;
> +}
> +

[PATCH] ml86v7667: fix the querystd implementation

The *std should be set to V4L2_STD_UNKNOWN, not the function's return code.

Also, *std should be ANDed with 525_60 or 625_50.

Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
---
 drivers/media/i2c/ml86v7667.c |    8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff mbox

Patch

diff --git a/drivers/media/i2c/ml86v7667.c b/drivers/media/i2c/ml86v7667.c
index 0f256d3..cd9f86e 100644
--- a/drivers/media/i2c/ml86v7667.c
+++ b/drivers/media/i2c/ml86v7667.c
@@ -169,10 +169,10 @@  static int ml86v7667_querystd(struct v4l2_subdev *sd, v4l2_std_id *std)
 	if (status < 0)
 		return status;
 
-	if (!(status & STATUS_HLOCK_DETECT))
-		return V4L2_STD_UNKNOWN;
-
-	*std = status & STATUS_NTSCPAL ? V4L2_STD_625_50 : V4L2_STD_525_60;
+	if (status & STATUS_HLOCK_DETECT)
+		*std &= status & STATUS_NTSCPAL ? V4L2_STD_625_50 : V4L2_STD_525_60;
+	else
+		*std = V4L2_STD_UNKNOWN;
 
 	return 0;
 }