All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 0/3] v4l2 api changes for imx378 driver
@ 2020-04-14 20:01 Daniel Gomez
  2020-04-14 20:01 ` [RFC PATCH 1/3] media: v4l2-subdev.h: Add min and max enum Daniel Gomez
                   ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: Daniel Gomez @ 2020-04-14 20:01 UTC (permalink / raw)
  To: mchehab, hverkuil-cisco, linux-media; +Cc: linux-kernel, Daniel Gomez

Hi all,

I would like to discuss with you guys the next two following topics:

* VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL:

I'm working on a driver for the imx378 sensor but the current v4l2-subdev API 
(VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL) doesn't allow you to set up a range of frame
intervals. However, this is supported in the v4l2 device API level. My idea is
to follow the same approach as the VIDIOC_SUBDEV_ENUM_FRAME_SIZE by setting a
min and max intervals in the VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL to solve this
missing support.

This is the current output of VIDIOC_ENUM_FRAMEINTERVALS in continous mode:

v4l2-ctl --list-frameintervals width=1920,height=1080,pixelformat=pRAA \
-d /dev/video0
ioctl: VIDIOC_ENUM_FRAMEINTERVALS
Interval: Continuous 0.029s - 0.607s (1.648-34.797 fps)

This is the current output of VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL:

v4l2-ctl --list-subdev-frameintervals code=0x300f,width=1920,height=1080 \
-d /dev/v4l-subdev19
ioctl: VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL (pad=0)
Interval: 0.029s (34.797 fps)

So, the idea would be to return the interval range from the v4l2-subdev level
to the device level. Besides that, it would also be necessary to adapt the
v4l-utils tools (compliance and ctl).

What do you think guys?
Please, follow the RFC patch series to see my suggestion.

* V4L2_CID_TEMPERATURE:

In addition to this, the driver is able to report as a v4l2 control the
temperature of the sensor. Since is quite 'general' control I also included the
v4l2 temperature control as part of the common v4l2 control list.

Would it be also possible?

In the RFC patch series you will find the the modified code for the
VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL and V4L2_CID_TEMPERATURE topics as well as
the imx378 driver using the above.

Daniel Gomez (3):
  media: v4l2-subdev.h: Add min and max enum
  media: v4l2: Add v4l2 control IDs for temperature
  media: imx378: Add imx378 camera sensor driver

 drivers/media/i2c/Kconfig            |   11 +
 drivers/media/i2c/Makefile           |    1 +
 drivers/media/i2c/imx378.c           | 1829 ++++++++++++++++++++++++++
 drivers/media/v4l2-core/v4l2-ctrls.c |    5 +
 include/uapi/linux/v4l2-controls.h   |    4 +-
 include/uapi/linux/v4l2-subdev.h     |    6 +-
 6 files changed, 1854 insertions(+), 2 deletions(-)
 create mode 100644 drivers/media/i2c/imx378.c

--
2.25.1


^ permalink raw reply	[flat|nested] 16+ messages in thread
* Re: [RFC PATCH 3/3] media: imx378: Add imx378 camera sensor driver
@ 2020-04-15  7:26 kbuild test robot
  0 siblings, 0 replies; 16+ messages in thread
From: kbuild test robot @ 2020-04-15  7:26 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 6194 bytes --]

CC: kbuild-all(a)lists.01.org
In-Reply-To: <20200414200151.80089-4-daniel@qtec.com>
References: <20200414200151.80089-4-daniel@qtec.com>
TO: Daniel Gomez <daniel@qtec.com>

Hi Daniel,

[FYI, it's a private test report for your RFC patch.]
[auto build test WARNING on linuxtv-media/master]
[also build test WARNING on v5.7-rc1 next-20200414]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Daniel-Gomez/v4l2-api-changes-for-imx378-driver/20200415-053427
base:   git://linuxtv.org/media_tree.git master
:::::: branch date: 10 hours ago
:::::: commit date: 10 hours ago

If you fix the issue, kindly add following tag as appropriate
Reported-by: kbuild test robot <lkp@intel.com>
Reported-by: Julia Lawall <julia.lawall@lip6.fr>


coccinelle warnings: (new ones prefixed by >>)

>> drivers/media/i2c/imx378.c:978:2-8: preceding lock on line 975

# https://github.com/0day-ci/linux/commit/f64d4e1406bfb5507f25b050f49c07d89711772d
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout f64d4e1406bfb5507f25b050f49c07d89711772d
vim +978 drivers/media/i2c/imx378.c

f64d4e1406bfb5 Daniel Gomez 2020-04-14   965  
f64d4e1406bfb5 Daniel Gomez 2020-04-14   966  static int imx378_set_fmt(struct v4l2_subdev *sd,
f64d4e1406bfb5 Daniel Gomez 2020-04-14   967  			  struct v4l2_subdev_pad_config *cfg,
f64d4e1406bfb5 Daniel Gomez 2020-04-14   968  			  struct v4l2_subdev_format *fmt)
f64d4e1406bfb5 Daniel Gomez 2020-04-14   969  {
f64d4e1406bfb5 Daniel Gomez 2020-04-14   970  	struct imx378 *imx378 = to_imx378(sd);
f64d4e1406bfb5 Daniel Gomez 2020-04-14   971  	struct v4l2_mbus_framefmt *__fmt;
f64d4e1406bfb5 Daniel Gomez 2020-04-14   972  	struct v4l2_rect *__crop;
f64d4e1406bfb5 Daniel Gomez 2020-04-14   973  	struct v4l2_subdev_frame_interval fival = { };
f64d4e1406bfb5 Daniel Gomez 2020-04-14   974  
f64d4e1406bfb5 Daniel Gomez 2020-04-14  @975  	mutex_lock(&imx378->mutex);
f64d4e1406bfb5 Daniel Gomez 2020-04-14   976  
f64d4e1406bfb5 Daniel Gomez 2020-04-14   977  	if (imx378->streaming && fmt->which != V4L2_SUBDEV_FORMAT_TRY)
f64d4e1406bfb5 Daniel Gomez 2020-04-14  @978  		return -EBUSY;
f64d4e1406bfb5 Daniel Gomez 2020-04-14   979  
f64d4e1406bfb5 Daniel Gomez 2020-04-14   980  	__crop = __imx378_get_pad_crop(imx378, cfg, fmt->pad, fmt->which);
f64d4e1406bfb5 Daniel Gomez 2020-04-14   981  
f64d4e1406bfb5 Daniel Gomez 2020-04-14   982  	v4l_bound_align_image(&fmt->format.width, IMX378_MIN_WIDTH,
f64d4e1406bfb5 Daniel Gomez 2020-04-14   983  			      IMX378_MAX_BOUNDS_WIDTH, ilog2(4),
f64d4e1406bfb5 Daniel Gomez 2020-04-14   984  			      &fmt->format.height, IMX378_MIN_HEIGHT,
f64d4e1406bfb5 Daniel Gomez 2020-04-14   985  			      IMX378_MAX_BOUNDS_HEIGHT, ilog2(8), 0);
f64d4e1406bfb5 Daniel Gomez 2020-04-14   986  
f64d4e1406bfb5 Daniel Gomez 2020-04-14   987  	__crop->width = fmt->format.width;
f64d4e1406bfb5 Daniel Gomez 2020-04-14   988  	__crop->height = fmt->format.height;
f64d4e1406bfb5 Daniel Gomez 2020-04-14   989  
f64d4e1406bfb5 Daniel Gomez 2020-04-14   990  	v4l_bound_align_image(&__crop->left, 0,
f64d4e1406bfb5 Daniel Gomez 2020-04-14   991  			      IMX378_MAX_BOUNDS_WIDTH - __crop->width, ilog2(4),
f64d4e1406bfb5 Daniel Gomez 2020-04-14   992  			      &__crop->top, 0,
f64d4e1406bfb5 Daniel Gomez 2020-04-14   993  			      IMX378_MAX_BOUNDS_HEIGHT - __crop->height,
f64d4e1406bfb5 Daniel Gomez 2020-04-14   994  			      ilog2(8), 0);
f64d4e1406bfb5 Daniel Gomez 2020-04-14   995  
f64d4e1406bfb5 Daniel Gomez 2020-04-14   996  	__fmt = __imx378_get_pad_format(imx378, cfg, fmt->pad, fmt->which);
f64d4e1406bfb5 Daniel Gomez 2020-04-14   997  
f64d4e1406bfb5 Daniel Gomez 2020-04-14   998  	__fmt->width = __crop->width;
f64d4e1406bfb5 Daniel Gomez 2020-04-14   999  	__fmt->height = __crop->height;
f64d4e1406bfb5 Daniel Gomez 2020-04-14  1000  
f64d4e1406bfb5 Daniel Gomez 2020-04-14  1001  	if (fmt->format.code && fmt->which != V4L2_SUBDEV_FORMAT_TRY)
f64d4e1406bfb5 Daniel Gomez 2020-04-14  1002  		imx378_set_flip_mode(imx378, fmt->format.code);
f64d4e1406bfb5 Daniel Gomez 2020-04-14  1003  
f64d4e1406bfb5 Daniel Gomez 2020-04-14  1004  	__fmt->code = imx378_get_format_code(imx378);
f64d4e1406bfb5 Daniel Gomez 2020-04-14  1005  
f64d4e1406bfb5 Daniel Gomez 2020-04-14  1006  	__fmt->field = V4L2_FIELD_NONE;
f64d4e1406bfb5 Daniel Gomez 2020-04-14  1007  	__fmt->colorspace = V4L2_COLORSPACE_SRGB;
f64d4e1406bfb5 Daniel Gomez 2020-04-14  1008  	__fmt->ycbcr_enc = V4L2_MAP_YCBCR_ENC_DEFAULT(fmt->format.colorspace);
f64d4e1406bfb5 Daniel Gomez 2020-04-14  1009  	__fmt->quantization = V4L2_MAP_QUANTIZATION_DEFAULT(true,
f64d4e1406bfb5 Daniel Gomez 2020-04-14  1010  			      __fmt->colorspace, __fmt->ycbcr_enc);
f64d4e1406bfb5 Daniel Gomez 2020-04-14  1011  	__fmt->xfer_func = V4L2_MAP_XFER_FUNC_DEFAULT(__fmt->colorspace);
f64d4e1406bfb5 Daniel Gomez 2020-04-14  1012  
f64d4e1406bfb5 Daniel Gomez 2020-04-14  1013  	fmt->format = *__fmt;
f64d4e1406bfb5 Daniel Gomez 2020-04-14  1014  
f64d4e1406bfb5 Daniel Gomez 2020-04-14  1015  	/* Frame interval depends on the format so, update it accordingly */
f64d4e1406bfb5 Daniel Gomez 2020-04-14  1016  	if (fmt->which != V4L2_SUBDEV_FORMAT_TRY) {
f64d4e1406bfb5 Daniel Gomez 2020-04-14  1017  		fival.interval = imx378->fival;
f64d4e1406bfb5 Daniel Gomez 2020-04-14  1018  		imx378_s_frame_interval(sd, &fival);
f64d4e1406bfb5 Daniel Gomez 2020-04-14  1019  	}
f64d4e1406bfb5 Daniel Gomez 2020-04-14  1020  
f64d4e1406bfb5 Daniel Gomez 2020-04-14  1021  	mutex_unlock(&imx378->mutex);
f64d4e1406bfb5 Daniel Gomez 2020-04-14  1022  
f64d4e1406bfb5 Daniel Gomez 2020-04-14  1023  	return 0;
f64d4e1406bfb5 Daniel Gomez 2020-04-14  1024  }
f64d4e1406bfb5 Daniel Gomez 2020-04-14  1025  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2020-04-30 14:20 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-04-14 20:01 [RFC PATCH 0/3] v4l2 api changes for imx378 driver Daniel Gomez
2020-04-14 20:01 ` [RFC PATCH 1/3] media: v4l2-subdev.h: Add min and max enum Daniel Gomez
2020-04-30  9:42   ` Sakari Ailus
2020-04-30 11:10     ` Laurent Pinchart
2020-04-30 13:31       ` Sakari Ailus
2020-04-30 13:59         ` Laurent Pinchart
2020-04-30 14:15           ` Sakari Ailus
2020-04-30 14:17             ` Laurent Pinchart
2020-04-30 14:18               ` Sakari Ailus
2020-04-30 14:20                 ` Laurent Pinchart
2020-04-14 20:01 ` [RFC PATCH 2/3] media: v4l2: Add v4l2 control IDs for temperature Daniel Gomez
2020-04-28 20:15   ` Sakari Ailus
2020-04-14 20:01 ` [RFC PATCH 3/3] media: imx378: Add imx378 camera sensor driver Daniel Gomez
2020-04-15  0:37   ` kbuild test robot
2020-04-28 21:02   ` Sakari Ailus
2020-04-15  7:26 kbuild test robot

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.