From patchwork Fri May 31 08:22:31 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans Verkuil X-Patchwork-Id: 2640751 Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 2A9563FD4E for ; Fri, 31 May 2013 08:31:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754117Ab3EaIbE (ORCPT ); Fri, 31 May 2013 04:31:04 -0400 Received: from smtp-vbr8.xs4all.nl ([194.109.24.28]:1115 "EHLO smtp-vbr8.xs4all.nl" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754101Ab3EaIbD (ORCPT ); Fri, 31 May 2013 04:31:03 -0400 X-Greylist: delayed 488 seconds by postgrey-1.27 at vger.kernel.org; Fri, 31 May 2013 04:31:02 EDT Received: from alastor.dyndns.org (166.80-203-20.nextgentel.com [80.203.20.166] (may be forged)) (authenticated bits=0) by smtp-vbr8.xs4all.nl (8.13.8/8.13.8) with ESMTP id r4V8MWpP071860 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=FAIL); Fri, 31 May 2013 10:22:34 +0200 (CEST) (envelope-from hverkuil@xs4all.nl) Received: from tschai.localnet (tschai.lan [192.168.1.10]) (Authenticated sender: hans) by alastor.dyndns.org (Postfix) with ESMTPSA id 17D5535E0028; Fri, 31 May 2013 10:22:31 +0200 (CEST) From: Hans Verkuil To: Sergei Shtylyov Subject: Re: [PATCH v6] V4L2: I2C: ML86V7667 video decoder driver Date: Fri, 31 May 2013 10:22:31 +0200 User-Agent: KMail/1.13.7 (Linux/3.10.0-rc1-tschai; KDE/4.8.4; x86_64; ; ) Cc: mchehab@redhat.com, linux-media@vger.kernel.org, matsu@igel.co.jp, linux-sh@vger.kernel.org, vladimir.barinov@cogentembedded.com References: <201305292252.29007.sergei.shtylyov@cogentembedded.com> In-Reply-To: <201305292252.29007.sergei.shtylyov@cogentembedded.com> MIME-Version: 1.0 Message-Id: <201305311022.31321.hverkuil@xs4all.nl> X-Virus-Scanned: by XS4ALL Virus Scanner Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org Hi! On Wed May 29 2013 20:52:28 Sergei Shtylyov wrote: > From: Vladimir Barinov > > 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 --- drivers/media/i2c/ml86v7667.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) 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; }