From patchwork Wed Jul 20 00:03:37 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Steve Longerbeam X-Patchwork-Id: 9238535 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 0D472602F0 for ; Wed, 20 Jul 2016 00:05:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F265726E81 for ; Wed, 20 Jul 2016 00:05:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E757E2793B; Wed, 20 Jul 2016 00:05:27 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8941B26E81 for ; Wed, 20 Jul 2016 00:05:27 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752737AbcGTAEK (ORCPT ); Tue, 19 Jul 2016 20:04:10 -0400 Received: from mail-pf0-f193.google.com ([209.85.192.193]:33287 "EHLO mail-pf0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752725AbcGTAEH (ORCPT ); Tue, 19 Jul 2016 20:04:07 -0400 Received: by mail-pf0-f193.google.com with SMTP id i6so2254651pfe.0; Tue, 19 Jul 2016 17:04:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Z70KIWzzK7ZZCKpz2ECcDMzuNUpAECa/ZlgWRIjnFg8=; b=iag9IXswM5AT0kl2Yih4EL9wyRYoIvIMxu0C8/JUt5wnV7UOxiPD6jD/SXtjNuErXa ydw3olP/knOrTayePyGk17D/IMyexO/TBAbvI23jveKVbcf+W3G4XOvZH+bz+Sy1awdG 3Tdh9hA3hqh6X7ZlizPHqX0Y8rqmK9/MCMRIdlcW9B0k5IehlRMdfgyIcyopNBW0XnmD 6wZKKKAiuFc+qf091WQzHd2jEeurS4DLPLpributL+3eOMYhLGaFebMpP0mcIQau7Zi/ 1AC3oO3uuUBf5CVkk93tJjCOczKdgnVXfGHB0CCkdActPMCISemWmx/nZVTKYq73N74l UP0A== 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:in-reply-to :references; bh=Z70KIWzzK7ZZCKpz2ECcDMzuNUpAECa/ZlgWRIjnFg8=; b=ep4eH4X5BizDqDu5X0A160d/1CNcmrfuMEUqkufKqMOfk87KfFHhFQj71W+6ZGvGZS AfrHKN2fJdNP5sAuvALvRTCqE/woPP/9W9w8wddJTZrDSh1tfK0AzbeIqvBTHONkFxde x9zX7KnKjKqoP0/TFu2o13R1mKc9aVwH2h0BB23YQ61s9B8eiwVX29Bfigh+YNG++SSz AtSTRlMoNMbqhH52zE0NlDrPkbUWZzc3bUix83C+HlzSNanX91lnXo4sXpL9YXGcM8RE NPC1ZOOQ7iFSXZz5RSPJrd2+3okNnKzlFxVQzvS70d1lLj2M/ArPYdUbbFvTokzRSE+a GbiA== X-Gm-Message-State: ALyK8tLyoey+bakO496aScyAteGkDV6m/wusEH3CeILMwYS1oiSmXxBNLb/rCqz4a1qL7A== X-Received: by 10.98.196.77 with SMTP id y74mr48455005pff.97.1468973046932; Tue, 19 Jul 2016 17:04:06 -0700 (PDT) Received: from mothership.sklembedded.com (c-73-241-2-21.hsd1.ca.comcast.net. [73.241.2.21]) by smtp.googlemail.com with ESMTPSA id ty6sm7107742pac.18.2016.07.19.17.04.06 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 19 Jul 2016 17:04:06 -0700 (PDT) From: Steve Longerbeam X-Google-Original-From: Steve Longerbeam To: lars@metafoo.de Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Steve Longerbeam Subject: [PATCH v2 10/10] media: adv7180: fix field type Date: Tue, 19 Jul 2016 17:03:37 -0700 Message-Id: <1468973017-17647-11-git-send-email-steve_longerbeam@mentor.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1468973017-17647-1-git-send-email-steve_longerbeam@mentor.com> References: <1467846004-12731-1-git-send-email-steve_longerbeam@mentor.com> <1468973017-17647-1-git-send-email-steve_longerbeam@mentor.com> Sender: linux-media-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The ADV7180 and ADV7182 transmit whole fields, bottom field followed by top (or vice-versa, depending on detected video standard). So for chips that do not have support for explicitly setting the field mode, set the field mode to SEQ_BT for PAL, and SEQ_TB for NTSC (there seems to be conflicting info on field order of PAL vs NTSC, so follow what is in adv7183.c). Signed-off-by: Steve Longerbeam --- v2: - the init of state->curr_norm in probe needs to be moved up, ahead of the init of state->field. --- drivers/media/i2c/adv7180.c | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/drivers/media/i2c/adv7180.c b/drivers/media/i2c/adv7180.c index 61f2140..58e1f53 100644 --- a/drivers/media/i2c/adv7180.c +++ b/drivers/media/i2c/adv7180.c @@ -718,10 +718,17 @@ static int adv7180_set_pad_format(struct v4l2_subdev *sd, switch (format->format.field) { case V4L2_FIELD_NONE: if (!(state->chip_info->flags & ADV7180_FLAG_I2P)) - format->format.field = V4L2_FIELD_INTERLACED; + format->format.field = + (state->curr_norm & V4L2_STD_525_60) ? + V4L2_FIELD_SEQ_TB : V4L2_FIELD_SEQ_BT; break; default: - format->format.field = V4L2_FIELD_INTERLACED; + if (state->chip_info->flags & ADV7180_FLAG_I2P) + format->format.field = V4L2_FIELD_INTERLACED; + else + format->format.field = + (state->curr_norm & V4L2_STD_525_60) ? + V4L2_FIELD_SEQ_TB : V4L2_FIELD_SEQ_BT; break; } @@ -1366,8 +1373,14 @@ static int adv7180_probe(struct i2c_client *client, return -ENOMEM; state->client = client; - state->field = V4L2_FIELD_INTERLACED; state->chip_info = (struct adv7180_chip_info *)id->driver_data; + state->curr_norm = V4L2_STD_NTSC; + + if (state->chip_info->flags & ADV7180_FLAG_I2P) + state->field = V4L2_FIELD_INTERLACED; + else + state->field = (state->curr_norm & V4L2_STD_525_60) ? + V4L2_FIELD_SEQ_TB : V4L2_FIELD_SEQ_BT; adv7180_of_parse(state); @@ -1397,7 +1410,6 @@ static int adv7180_probe(struct i2c_client *client, state->irq = client->irq; mutex_init(&state->mutex); - state->curr_norm = V4L2_STD_NTSC; if (state->chip_info->flags & ADV7180_FLAG_RESET_POWERED) state->powered = true; else