* [PATCH v2 0/3] media: ov2640: fix two problems
@ 2018-12-09 5:20 Akinobu Mita
2018-12-09 5:20 ` [PATCH v2 1/3] media: ov2640: set default window and format code at probe time Akinobu Mita
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Akinobu Mita @ 2018-12-09 5:20 UTC (permalink / raw)
To: linux-media; +Cc: Akinobu Mita, Sakari Ailus, Mauro Carvalho Chehab
This patch series contains two bugfixes and a preparatory change for
ov2640 driver.
* v2
- fix build error when CONFIG_VIDEO_V4L2_SUBDEV_API is not defined,
reported by kbuild test robot.
Akinobu Mita (3):
media: ov2640: set default window and format code at probe time
media: ov2640: make VIDIOC_SUBDEV_G_FMT ioctl work with
V4L2_SUBDEV_FORMAT_TRY
media: ov2640: set all mbus format field when G_FMT and S_FMT ioctls
drivers/media/i2c/ov2640.c | 45 +++++++++++++++++++++++++++++++++++++++------
1 file changed, 39 insertions(+), 6 deletions(-)
Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
--
2.7.4
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH v2 1/3] media: ov2640: set default window and format code at probe time
2018-12-09 5:20 [PATCH v2 0/3] media: ov2640: fix two problems Akinobu Mita
@ 2018-12-09 5:20 ` Akinobu Mita
2018-12-09 5:20 ` [PATCH v2 2/3] media: ov2640: make VIDIOC_SUBDEV_G_FMT ioctl work with V4L2_SUBDEV_FORMAT_TRY Akinobu Mita
2018-12-09 5:20 ` [PATCH v2 3/3] media: ov2640: set all mbus format field when G_FMT and S_FMT ioctls Akinobu Mita
2 siblings, 0 replies; 4+ messages in thread
From: Akinobu Mita @ 2018-12-09 5:20 UTC (permalink / raw)
To: linux-media; +Cc: Akinobu Mita, Sakari Ailus, Mauro Carvalho Chehab
Set default window and format code at probe time instead of always checking
if they have not been set yet when VIDIOC_SUBDEV_G_FMT ioctl is called.
This change simplifies the next patch (make VIDIOC_SUBDEV_G_FMT ioctl work
with V4L2_SUBDEV_FORMAT_TRY).
Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
---
drivers/media/i2c/ov2640.c | 10 +++-------
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/drivers/media/i2c/ov2640.c b/drivers/media/i2c/ov2640.c
index d8e91bc..a07e6f2 100644
--- a/drivers/media/i2c/ov2640.c
+++ b/drivers/media/i2c/ov2640.c
@@ -842,9 +842,6 @@ static int ov2640_set_params(struct i2c_client *client,
u8 val;
int ret;
- if (!win)
- return -EINVAL;
-
switch (code) {
case MEDIA_BUS_FMT_RGB565_2X8_BE:
dev_dbg(&client->dev, "%s: Selected cfmt RGB565 BE", __func__);
@@ -929,10 +926,6 @@ static int ov2640_get_fmt(struct v4l2_subdev *sd,
if (format->pad)
return -EINVAL;
- if (!priv->win) {
- priv->win = ov2640_select_win(SVGA_WIDTH, SVGA_HEIGHT);
- priv->cfmt_code = MEDIA_BUS_FMT_UYVY8_2X8;
- }
mf->width = priv->win->width;
mf->height = priv->win->height;
@@ -1193,6 +1186,9 @@ static int ov2640_probe(struct i2c_client *client,
if (ret)
goto err_clk;
+ priv->win = ov2640_select_win(SVGA_WIDTH, SVGA_HEIGHT);
+ priv->cfmt_code = MEDIA_BUS_FMT_UYVY8_2X8;
+
v4l2_i2c_subdev_init(&priv->subdev, client, &ov2640_subdev_ops);
priv->subdev.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE |
V4L2_SUBDEV_FL_HAS_EVENTS;
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2 2/3] media: ov2640: make VIDIOC_SUBDEV_G_FMT ioctl work with V4L2_SUBDEV_FORMAT_TRY
2018-12-09 5:20 [PATCH v2 0/3] media: ov2640: fix two problems Akinobu Mita
2018-12-09 5:20 ` [PATCH v2 1/3] media: ov2640: set default window and format code at probe time Akinobu Mita
@ 2018-12-09 5:20 ` Akinobu Mita
2018-12-09 5:20 ` [PATCH v2 3/3] media: ov2640: set all mbus format field when G_FMT and S_FMT ioctls Akinobu Mita
2 siblings, 0 replies; 4+ messages in thread
From: Akinobu Mita @ 2018-12-09 5:20 UTC (permalink / raw)
To: linux-media; +Cc: Akinobu Mita, Sakari Ailus, Mauro Carvalho Chehab
The VIDIOC_SUBDEV_G_FMT ioctl for this driver doesn't recognize
V4L2_SUBDEV_FORMAT_TRY and always works as if V4L2_SUBDEV_FORMAT_ACTIVE
is specified.
Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
---
* v2
- fix build error when CONFIG_VIDEO_V4L2_SUBDEV_API is not defined,
reported by kbuild test robot.
drivers/media/i2c/ov2640.c | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/drivers/media/i2c/ov2640.c b/drivers/media/i2c/ov2640.c
index a07e6f2..84b1b15 100644
--- a/drivers/media/i2c/ov2640.c
+++ b/drivers/media/i2c/ov2640.c
@@ -926,6 +926,15 @@ static int ov2640_get_fmt(struct v4l2_subdev *sd,
if (format->pad)
return -EINVAL;
+ if (format->which == V4L2_SUBDEV_FORMAT_TRY) {
+#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API
+ mf = v4l2_subdev_get_try_format(sd, cfg, 0);
+ format->format = *mf;
+ return 0;
+#else
+ return -ENOTTY;
+#endif
+ }
mf->width = priv->win->width;
mf->height = priv->win->height;
@@ -992,6 +1001,27 @@ static int ov2640_set_fmt(struct v4l2_subdev *sd,
return ret;
}
+static int ov2640_init_cfg(struct v4l2_subdev *sd,
+ struct v4l2_subdev_pad_config *cfg)
+{
+#ifdef CONFIG_VIDEO_V4L2_SUBDEV_API
+ struct i2c_client *client = v4l2_get_subdevdata(sd);
+ struct ov2640_priv *priv = to_ov2640(client);
+ struct v4l2_mbus_framefmt *try_fmt =
+ v4l2_subdev_get_try_format(sd, cfg, 0);
+
+ try_fmt->width = priv->win->width;
+ try_fmt->height = priv->win->height;
+ try_fmt->code = priv->cfmt_code;
+ try_fmt->colorspace = V4L2_COLORSPACE_SRGB;
+ try_fmt->field = V4L2_FIELD_NONE;
+ try_fmt->ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT;
+ try_fmt->quantization = V4L2_QUANTIZATION_DEFAULT;
+ try_fmt->xfer_func = V4L2_XFER_FUNC_DEFAULT;
+#endif
+ return 0;
+}
+
static int ov2640_enum_mbus_code(struct v4l2_subdev *sd,
struct v4l2_subdev_pad_config *cfg,
struct v4l2_subdev_mbus_code_enum *code)
@@ -1101,6 +1131,7 @@ static const struct v4l2_subdev_core_ops ov2640_subdev_core_ops = {
};
static const struct v4l2_subdev_pad_ops ov2640_subdev_pad_ops = {
+ .init_cfg = ov2640_init_cfg,
.enum_mbus_code = ov2640_enum_mbus_code,
.get_selection = ov2640_get_selection,
.get_fmt = ov2640_get_fmt,
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH v2 3/3] media: ov2640: set all mbus format field when G_FMT and S_FMT ioctls
2018-12-09 5:20 [PATCH v2 0/3] media: ov2640: fix two problems Akinobu Mita
2018-12-09 5:20 ` [PATCH v2 1/3] media: ov2640: set default window and format code at probe time Akinobu Mita
2018-12-09 5:20 ` [PATCH v2 2/3] media: ov2640: make VIDIOC_SUBDEV_G_FMT ioctl work with V4L2_SUBDEV_FORMAT_TRY Akinobu Mita
@ 2018-12-09 5:20 ` Akinobu Mita
2 siblings, 0 replies; 4+ messages in thread
From: Akinobu Mita @ 2018-12-09 5:20 UTC (permalink / raw)
To: linux-media; +Cc: Akinobu Mita, Sakari Ailus, Mauro Carvalho Chehab
This driver doesn't set all members of mbus format field when the
VIDIOC_SUBDEV_{S,G}_FMT ioctls are called.
This is detected by v4l2-compliance.
Cc: Sakari Ailus <sakari.ailus@linux.intel.com>
Cc: Mauro Carvalho Chehab <mchehab@kernel.org>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
---
drivers/media/i2c/ov2640.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/media/i2c/ov2640.c b/drivers/media/i2c/ov2640.c
index 84b1b15..09325da 100644
--- a/drivers/media/i2c/ov2640.c
+++ b/drivers/media/i2c/ov2640.c
@@ -941,6 +941,9 @@ static int ov2640_get_fmt(struct v4l2_subdev *sd,
mf->code = priv->cfmt_code;
mf->colorspace = V4L2_COLORSPACE_SRGB;
mf->field = V4L2_FIELD_NONE;
+ mf->ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT;
+ mf->quantization = V4L2_QUANTIZATION_DEFAULT;
+ mf->xfer_func = V4L2_XFER_FUNC_DEFAULT;
return 0;
}
@@ -967,6 +970,9 @@ static int ov2640_set_fmt(struct v4l2_subdev *sd,
mf->field = V4L2_FIELD_NONE;
mf->colorspace = V4L2_COLORSPACE_SRGB;
+ mf->ycbcr_enc = V4L2_YCBCR_ENC_DEFAULT;
+ mf->quantization = V4L2_QUANTIZATION_DEFAULT;
+ mf->xfer_func = V4L2_XFER_FUNC_DEFAULT;
switch (mf->code) {
case MEDIA_BUS_FMT_RGB565_2X8_BE:
--
2.7.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2018-12-09 5:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-09 5:20 [PATCH v2 0/3] media: ov2640: fix two problems Akinobu Mita
2018-12-09 5:20 ` [PATCH v2 1/3] media: ov2640: set default window and format code at probe time Akinobu Mita
2018-12-09 5:20 ` [PATCH v2 2/3] media: ov2640: make VIDIOC_SUBDEV_G_FMT ioctl work with V4L2_SUBDEV_FORMAT_TRY Akinobu Mita
2018-12-09 5:20 ` [PATCH v2 3/3] media: ov2640: set all mbus format field when G_FMT and S_FMT ioctls Akinobu Mita
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).