From patchwork Tue Sep 1 22:29:01 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sergei Shtylyov X-Patchwork-Id: 7107141 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 93B739F1CD for ; Tue, 1 Sep 2015 22:29:12 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B7E95205B8 for ; Tue, 1 Sep 2015 22:29:11 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 34B3C205C2 for ; Tue, 1 Sep 2015 22:29:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751685AbbIAW3H (ORCPT ); Tue, 1 Sep 2015 18:29:07 -0400 Received: from mail-lb0-f179.google.com ([209.85.217.179]:35238 "EHLO mail-lb0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751412AbbIAW3G (ORCPT ); Tue, 1 Sep 2015 18:29:06 -0400 Received: by lbpo4 with SMTP id o4so8016503lbp.2 for ; Tue, 01 Sep 2015 15:29:03 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:organization :user-agent:mime-version:content-transfer-encoding:content-type; bh=TLQ42IkzJjuZ02XyjModpud4TrebuLYL0Ya0Amtc8DM=; b=NkkWJbu0UmBFJMx8OIrvjQUXaNyq7uzsWltJZkD2DuqIKkjKJdYcJOjDBUnpb9kLXa YWaetxmY4SukKwf561k5itXzP0hVxdhbj5/ddgWRPs2AzVKb1vYs2fJ3K/AbLNWgkMxf IXV5/j947q5pAthgOEWv68AfRiM59RbTa0vRctrBA33wGkUJYYE4rn6R5SJikrWU9wXf nzvDdvT4GhKOxNXfmpIwWXlDiBhkWasHbHarhnTItL8f+TpLkKpZeWFSCcHQVYQVbHLz h4ax+WqzIG2DBzQqj4wc4kp2oHt15E4NNcl5PlMcr2ZrOCF0CY7gblrtSyrYlTonN84H Rrng== X-Gm-Message-State: ALoCoQmXEprr5M98CVTYHX6/Cf/a79RgdaToL7SFHJ6uikRCq1tfpACfdtdBr2cPJdZfUebiB7ap X-Received: by 10.112.201.36 with SMTP id jx4mr14471001lbc.9.1441146543780; Tue, 01 Sep 2015 15:29:03 -0700 (PDT) Received: from wasted.cogentembedded.com (ppp28-45.pppoe.mtu-net.ru. [81.195.28.45]) by smtp.gmail.com with ESMTPSA id tv6sm5078141lbb.31.2015.09.01.15.29.02 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Sep 2015 15:29:02 -0700 (PDT) From: Sergei Shtylyov To: g.liakhovetski@gmx.de, mchehab@osg.samsung.com, linux-media@vger.kernel.org Cc: linux-sh@vger.kernel.org Subject: [PATCH v2] rcar_vin: propagate querystd() error upstream Date: Wed, 02 Sep 2015 01:29:01 +0300 Message-ID: <2328024.JIhFUGC0u1@wasted.cogentembedded.com> Organization: Cogent Embedded Inc. User-Agent: KMail/4.14.9 (Linux/4.1.5-100.fc21.x86_64; KDE/4.14.9; x86_64; ; ) MIME-Version: 1.0 Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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(-) -- To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html 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; }