From patchwork Wed Oct 24 20:25:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tim Harvey X-Patchwork-Id: 10655023 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A387B13A4 for ; Wed, 24 Oct 2018 20:26:51 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8E96F29DDD for ; Wed, 24 Oct 2018 20:26:51 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7DA582B29A; Wed, 24 Oct 2018 20:26:51 +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=-7.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI autolearn=ham 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 E783129DDD for ; Wed, 24 Oct 2018 20:26:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726448AbeJYE4V (ORCPT ); Thu, 25 Oct 2018 00:56:21 -0400 Received: from mail-pg1-f196.google.com ([209.85.215.196]:45297 "EHLO mail-pg1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725821AbeJYE4V (ORCPT ); Thu, 25 Oct 2018 00:56:21 -0400 Received: by mail-pg1-f196.google.com with SMTP id s3-v6so2852249pga.12 for ; Wed, 24 Oct 2018 13:26:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gateworks-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id; bh=2w1forjVD8ExZOwBch5bvJ+jNrmrd09BesOJfb/jNcY=; b=kVI7sLMbrz42C5Ha+dkt+W2Nl9BqwS9PehJ3V2h2gAxCUimd95NsWZ2MdRIJtDDCUU Ar9D5XlH/1V6z0uj50Coqw9WUKLhNIqBrRMqP8gP1z+I30KUPSc7PkXnxR6963jxL4Vk q2mvVUgBPpvKq406s5L4xVfNf9ph/BY1BEZEM/micmIPf75ez5jKEwdV6FUSpGK7MAWg U+FHCaoutKCsE5rCyRSBOVwKlmJ7kN5GDL7c6lYgbXBsMwtpVudaLQSlvkc4nSf3Ng+p zSy0fcHMdbSWymd1dS9sB2qXMkx+S53a7okNtjuQgK1SlJNmWDpYEkkRjlQZXoLWFAqK UXKg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=2w1forjVD8ExZOwBch5bvJ+jNrmrd09BesOJfb/jNcY=; b=FgVfnYwl73pxPNF4WZCthJEEkTJVmeXqesVg2mxrndd/YcL1vCIOvnXs2zWAephJ3p vhtlZ91VIFXujecKHGjGUZbP6kBp4AHXC6R/182tHj4zmcbJtTfwujRMussuU/I0Baw3 u1Z4IlU/doaYM97kJdJnovpMa6Bcv9GutPdE4SkPi51lQhGUR/j7gmE+bhD1v3Rz3rha XYIqPDW7bf6MAb6s74ZcSj910aIxQgRKVelAxkV4yXsg1Hf1iZmb7HX9PjY5b0TmYoIJ JyHumgc2X7yf5creKJsxS9/zUTZNEe7isXLrQTk3RooCc9yJZ4SRwBHIbZSBB/Xx3koi wd+A== X-Gm-Message-State: AGRZ1gIbLced/TfqjyeAPHRZVcfuIXE3msitHpkQ5Uubk7l/ovQ6ECrn mHOfo1OXNkPaCw9hCKa7w0XwXg== X-Google-Smtp-Source: AJdET5dQOkuKKhrKJzo/lLdrzu38Zz+4CSGLj5R7y0BpFXRsGMwdGwqkeM/FolrxwlwsK1OjNqU+uQ== X-Received: by 2002:a63:6848:: with SMTP id d69-v6mr3927481pgc.113.1540412809049; Wed, 24 Oct 2018 13:26:49 -0700 (PDT) Received: from tharvey.pdc.gateworks.com (68-189-91-139.static.snlo.ca.charter.com. [68.189.91.139]) by smtp.gmail.com with ESMTPSA id d18-v6sm6088533pgd.86.2018.10.24.13.26.45 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 24 Oct 2018 13:26:46 -0700 (PDT) From: Tim Harvey To: Lars-Peter Clausen , Steve Longerbeam , Hans Verkuil , =?utf-8?q?Niklas_S=C3=B6derlund?= Cc: linux-media@vger.kernel.org Subject: [PATCH] media: adv7180: add g_skip_frames support Date: Wed, 24 Oct 2018 13:25:51 -0700 Message-Id: <1540412751-19194-1-git-send-email-tharvey@gateworks.com> X-Mailer: git-send-email 2.7.4 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 produces 1 to 2 frames of garbage before proper sync is established. This allows V4L2 drivers and apps to skip those. Signed-off-by: Tim Harvey --- drivers/media/i2c/adv7180.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/media/i2c/adv7180.c b/drivers/media/i2c/adv7180.c index 99697ba..6f3dc88 100644 --- a/drivers/media/i2c/adv7180.c +++ b/drivers/media/i2c/adv7180.c @@ -180,6 +180,9 @@ #define V4L2_CID_ADV_FAST_SWITCH (V4L2_CID_USER_ADV7180_BASE + 0x00) +/* Initial number of frames to skip to avoid possible garbage */ +#define ADV7180_NUM_OF_SKIP_FRAMES 2 + struct adv7180_state; #define ADV7180_FLAG_RESET_POWERED BIT(0) @@ -769,6 +772,13 @@ static int adv7180_g_mbus_config(struct v4l2_subdev *sd, return 0; } +static int adv7180_get_skip_frames(struct v4l2_subdev *sd, u32 *frames) +{ + *frames = ADV7180_NUM_OF_SKIP_FRAMES; + + return 0; +} + static int adv7180_g_pixelaspect(struct v4l2_subdev *sd, struct v4l2_fract *aspect) { struct adv7180_state *state = to_state(sd); @@ -849,10 +859,15 @@ static const struct v4l2_subdev_pad_ops adv7180_pad_ops = { .get_fmt = adv7180_get_pad_format, }; +static const struct v4l2_subdev_sensor_ops adv7180_sensor_ops = { + .g_skip_frames = adv7180_get_skip_frames, +}; + static const struct v4l2_subdev_ops adv7180_ops = { .core = &adv7180_core_ops, .video = &adv7180_video_ops, .pad = &adv7180_pad_ops, + .sensor = &adv7180_sensor_ops, }; static irqreturn_t adv7180_irq(int irq, void *devid)