Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp3071280ybi; Sun, 26 May 2019 13:56:20 -0700 (PDT) X-Google-Smtp-Source: APXvYqyqC1Nq/yvtzW0MsE7cw5zC9Ns5+JWKR2WxUndtknfChtTpKF8yFW+txAUtEl6abF1Q4Y8G X-Received: by 2002:aa7:81ca:: with SMTP id c10mr12262316pfn.163.1558904180312; Sun, 26 May 2019 13:56:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558904180; cv=none; d=google.com; s=arc-20160816; b=HMNnWNV8bB/Md1luk37g3iAgB1dAexlAyj935VX61RWD1tBkBs17dJY3N9HtbkFfxv Ut7C2ttNHdge9Km+F4D3iBhXWIGYAas5fE8yAiea3yUrd5QVn5y+oDC5lNOrF+bUOeim 81kz7PMnMsEpsjD+fMQAHRuoiStsgcps5nNdTaes+RideFj2SSHUfQpaY/g+tei5Y2sq IlUw6ObV3ZypjdXzpN85yvzn57l88n1PRxGJzRlpOagsXigxLM6/D4afm911032r6e4v em5+9ZfjmrGjoPPHg+d2d021uzBTFCQ3i7iEy2QsOm9l6z+PKvNQq0Si8STG48bWJoja YlfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=+x6WG6WqbSoE6WUEpqF/4MvaYXvmZDdI8YQeSR6pdD8=; b=rz1EXv01MIxS4t/fi6IjMLC20j7x/ub7dL5SvkussDU2pJV/FccdHslykNwULkHsFz 2vQJzrkiTwh/Kbs74lJKxOVfyMplGBIhptHhqQ8EwSfXHAP+FZmAvKf9Jc02SmoZZyb9 yjmyMRhzi3Z4tWjUJ1Hyyk+nesp6HJWLJeFbdxrgghG1IVHAqoEppTL7q3UZOp5dlsZh RAaCBlZoVtv1yIOkoHb84zVjEKJM+MRtF5F1XbLbNtqMzt2oiOkQWP/3lKnXxUwBdqUc 5KRwEjpwlVlEVxPVs+SwYzwNcg+GTJ7rZd+t1UpUyynBlwNifm0Z/q8oToSedZIhL3Bn Cn8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=FJZ3qf3E; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f13si15590770pgh.393.2019.05.26.13.56.04; Sun, 26 May 2019 13:56:20 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=FJZ3qf3E; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726186AbfEZUsX (ORCPT + 99 others); Sun, 26 May 2019 16:48:23 -0400 Received: from mail-lf1-f68.google.com ([209.85.167.68]:38187 "EHLO mail-lf1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725788AbfEZUsT (ORCPT ); Sun, 26 May 2019 16:48:19 -0400 Received: by mail-lf1-f68.google.com with SMTP id b11so4172950lfa.5; Sun, 26 May 2019 13:48:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=+x6WG6WqbSoE6WUEpqF/4MvaYXvmZDdI8YQeSR6pdD8=; b=FJZ3qf3EdxoSTq8Zw6mow2R8CM8rKNPwCia7dpfuJr79mWc3Y+l7Yd3oBMtj9rZYJY EGSE8r5UI81ttNQpJaIUxQtFAh+mI1onGNQKJv93No1Tdv8I9NwJQOOVnpbCVcq84fcw tbkEDyYx0xRfMs7EUkVSYcoR8Co+J6CxYIGlyUOw4pQLT6/BlWA8gMd73HYkxzwNCDiF ryy4Tp77LPg1LrdUdteoodZ9kmogF/Ttp2Iodgp9ifY635nu0dxg4kdQKCEjZeTQxNVp 8ZnB/J1DBuIuR0zGAlHs9yZJ1gAVwwLpY9+PmXtwHGTSRx5UiDhd6OgfZUPFQbYSyIsR PjpA== 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=+x6WG6WqbSoE6WUEpqF/4MvaYXvmZDdI8YQeSR6pdD8=; b=o7m3nWoF1iDR6unuRMj71Rdxf4brEOp7QqjYwvJs4jJsjrnDdOBttacTBnJQotr2tl 6Q1D93B1ocWVWtQ7yhaXW01s7YPItr+Wdvp+NeINv5Vvua8nqIx+p59rcTFJGbrFv3+U W28eFSg7FhJCw8QFl7z6BvICtNEZBRKOGnoT2zQA7sPYSfhrbvaMcdkkiIW1saCPu4hn IllwGAsMIxGxUX+ylhIOVfYmgD3Z2gzydrw0i6FUwByPI3PQrF+QTgD7hBPesQtRWbHV JkDOBz4YwpKBPtlK0230RXMyIF9+J3XzjNwbE9ylml62uO+JEQK1zSotjF59mgcsy6mq a+rQ== X-Gm-Message-State: APjAAAV1lFN1POVvVaFplSH7Uq6u8H0dJoa7dsnFw5cJO+bMErW9qbwi DQWgEw9zPDu8wPTveZ+0cxE= X-Received: by 2002:a19:2247:: with SMTP id i68mr719938lfi.174.1558903697319; Sun, 26 May 2019 13:48:17 -0700 (PDT) Received: from z50.gdansk-morena.vectranet.pl (109241207190.gdansk.vectranet.pl. [109.241.207.190]) by smtp.gmail.com with ESMTPSA id i187sm1859475lfe.64.2019.05.26.13.48.16 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 26 May 2019 13:48:16 -0700 (PDT) From: Janusz Krzysztofik To: Mauro Carvalho Chehab Cc: Sakari Ailus , Hans Verkuil , linux-media@vger.kernel.org, linux-kernel@vger.kernel.org, Janusz Krzysztofik Subject: [RFC PATCH 5/5] media: ov6650: Add .init_cfg() pad operation callback Date: Sun, 26 May 2019 22:47:58 +0200 Message-Id: <20190526204758.1904-6-jmkrzyszt@gmail.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190526204758.1904-1-jmkrzyszt@gmail.com> References: <20190526204758.1904-1-jmkrzyszt@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The driver now supports V4L2_SUBDEV_FORMAT_TRY operation mode only in .get/set_fmt() pad operation callbacks. That means only .try_format member of pad config is maintained. As a consequence, active crop rectangle is used as a referece while V4L2_SUBDEV_FORMAT_TRY requests are processed. In order to fix that, a method for initialization of .try_crop pad config member is needed. Implement .init_cfg() pad operation callback which initializes the pad config from current active format and selection settings. From now on, and before the driver V4L2_SUBDEV_FORMAT_TRY support is further modified, host interface drivers should call .init_cfg() on a pad config before passing it to V4L2_SUBDEV_FORMAT_TRY operations. Signed-off-by: Janusz Krzysztofik --- drivers/media/i2c/ov6650.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/drivers/media/i2c/ov6650.c b/drivers/media/i2c/ov6650.c index cc70d8952999..c3d4c1f598b2 100644 --- a/drivers/media/i2c/ov6650.c +++ b/drivers/media/i2c/ov6650.c @@ -447,6 +447,26 @@ static int ov6650_s_power(struct v4l2_subdev *sd, int on) return ret; } +static int ov6650_init_cfg(struct v4l2_subdev *sd, + struct v4l2_subdev_pad_config *cfg) +{ + struct i2c_client *client = v4l2_get_subdevdata(sd); + struct ov6650 *priv = to_ov6650(client); + struct v4l2_mbus_framefmt *mf; + struct v4l2_rect *rect; + + mf = &cfg->try_fmt; + *mf = ov6650_def_fmt; + mf->width = priv->rect.width >> priv->half_scale; + mf->height = priv->rect.height >> priv->half_scale; + mf->code = priv->code; + + rect = &cfg->try_crop; + *rect = priv->rect; + + return 0; +} + static int ov6650_get_selection(struct v4l2_subdev *sd, struct v4l2_subdev_pad_config *cfg, struct v4l2_subdev_selection *sel) @@ -959,6 +979,7 @@ static const struct v4l2_subdev_video_ops ov6650_video_ops = { }; static const struct v4l2_subdev_pad_ops ov6650_pad_ops = { + .init_cfg = ov6650_init_cfg, .enum_mbus_code = ov6650_enum_mbus_code, .get_selection = ov6650_get_selection, .set_selection = ov6650_set_selection, -- 2.21.0