All of lore.kernel.org
 help / color / mirror / Atom feed
From: Janusz Krzysztofik <jmkrzyszt@gmail.com>
To: Mauro Carvalho Chehab <mchehab@kernel.org>
Cc: Sakari Ailus <sakari.ailus@linux.intel.com>,
	Hans Verkuil <hverkuil-cisco@xs4all.nl>,
	linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
	Janusz Krzysztofik <jmkrzyszt@gmail.com>
Subject: [RFC PATCH 5/5] media: ov6650: Add .init_cfg() pad operation callback
Date: Sun, 26 May 2019 22:47:58 +0200	[thread overview]
Message-ID: <20190526204758.1904-6-jmkrzyszt@gmail.com> (raw)
In-Reply-To: <20190526204758.1904-1-jmkrzyszt@gmail.com>

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 <jmkrzyszt@gmail.com>
---
 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


  parent reply	other threads:[~2019-05-26 20:48 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-05-26 20:47 [RFC PATCH 0/5] media: ov6650: V4L2 subdev compliance fixes Janusz Krzysztofik
2019-05-26 20:47 ` [RFC PATCH 1/5] media: ov6650: Fix V4L2_SEL_FLAG_KEEP_CONFIG handling Janusz Krzysztofik
2019-05-26 20:47 ` [RFC PATCH 2/5] media: ov6650: Refactor ov6650_s_fmt() helper Janusz Krzysztofik
2019-05-26 20:47 ` [RFC PATCH 3/5] media: ov6650: Fix active crop rectangle affected by .set_fmt() Janusz Krzysztofik
2019-05-26 20:47 ` [RFC PATCH 4/5] media: ov6650: Fix frame scaling not reset on crop Janusz Krzysztofik
2019-05-31 11:42   ` Sakari Ailus
2019-05-31 17:56     ` Janusz Krzysztofik
2019-06-01 22:37       ` Sakari Ailus
2019-06-02  9:58         ` Janusz Krzysztofik
2019-06-02 20:36           ` Sakari Ailus
2019-05-26 20:47 ` Janusz Krzysztofik [this message]
2019-06-01 22:29   ` [RFC PATCH 5/5] media: ov6650: Add .init_cfg() pad operation callback Sakari Ailus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190526204758.1904-6-jmkrzyszt@gmail.com \
    --to=jmkrzyszt@gmail.com \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=sakari.ailus@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.