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>,
stable@vger.kernel.org
Subject: [PATCH v2 6/9] media: ov6650: Fix .get_fmt() V4L2_SUBDEV_FORMAT_TRY support
Date: Tue, 21 May 2019 00:50:04 +0200 [thread overview]
Message-ID: <20190520225007.2308-7-jmkrzyszt@gmail.com> (raw)
In-Reply-To: <20190520225007.2308-1-jmkrzyszt@gmail.com>
Commit da298c6d98d5 ("[media] v4l2: replace video op g_mbus_fmt by pad
op get_fmt") converted a former ov6650_g_fmt() video operation callback
to an ov6650_get_fmt() pad operation callback. However, the converted
function disregards a format->which flag that pad operations should
obey and always returns active frame format settings.
That can be fixed by always responding to V4L2_SUBDEV_FORMAT_TRY with
-EINVAL, or providing the response from a pad config argument, likely
updated by a former user call to V4L2_SUBDEV_FORMAT_TRY .set_fmt().
Since implementation of the latter is trivial, go for it.
Fixes: da298c6d98d5 ("[media] v4l2: replace video op g_mbus_fmt by pad op get_fmt")
Signed-off-by: Janusz Krzysztofik <jmkrzyszt@gmail.com>
Cc: stable@vger.kernel.org
---
drivers/media/i2c/ov6650.c | 12 +++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)
diff --git a/drivers/media/i2c/ov6650.c b/drivers/media/i2c/ov6650.c
index 731b03bef7a5..1915a43bff87 100644
--- a/drivers/media/i2c/ov6650.c
+++ b/drivers/media/i2c/ov6650.c
@@ -528,10 +528,16 @@ static int ov6650_get_fmt(struct v4l2_subdev *sd,
*mf = ov6650_def_fmt;
/* update media bus format code and frame size */
- mf->width = priv->rect.width >> priv->half_scale;
- mf->height = priv->rect.height >> priv->half_scale;
- mf->code = priv->code;
+ if (format->which == V4L2_SUBDEV_FORMAT_TRY) {
+ mf->width = cfg->try_fmt.width;
+ mf->height = cfg->try_fmt.height;
+ mf->code = cfg->try_fmt.code;
+ } else {
+ mf->width = priv->rect.width >> priv->half_scale;
+ mf->height = priv->rect.height >> priv->half_scale;
+ mf->code = priv->code;
+ }
return 0;
}
--
2.21.0
next prev parent reply other threads:[~2019-05-20 22:51 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-20 22:49 [PATCH v2 0/9] media: ov6650: A collection of fixes Janusz Krzysztofik
2019-05-20 22:49 ` [PATCH v2 1/9] media: ov6650: Fix MODDULE_DESCRIPTION Janusz Krzysztofik
2019-05-21 5:15 ` Greg KH
2019-05-21 17:55 ` Janusz Krzysztofik
2019-05-20 22:50 ` [PATCH v2 2/9] media: ov6650: Fix control handler not freed on init error Janusz Krzysztofik
2019-05-20 22:50 ` [PATCH v2 3/9] media: ov6650: Fix crop rectangle alignment not passed back Janusz Krzysztofik
2019-05-20 22:50 ` [PATCH v2 4/9] media: ov6650: Fix incorrect use of JPEG colorspace Janusz Krzysztofik
2019-05-20 22:50 ` [PATCH v2 5/9] media: ov6650: Fix some format attributes not under control Janusz Krzysztofik
2019-05-20 22:50 ` Janusz Krzysztofik [this message]
2019-05-20 22:50 ` [PATCH v2 7/9] media: ov6650: Fix default format not applied on device probe Janusz Krzysztofik
2019-05-20 22:50 ` [PATCH v2 8/9] media: ov6650: Fix stored frame format not in sync with hardware Janusz Krzysztofik
2019-05-20 22:50 ` [PATCH v2 9/9] media: ov6650: Fix stored crop rectangle " Janusz Krzysztofik
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=20190520225007.2308-7-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 \
--cc=stable@vger.kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).