* [PATCH v3 1/8] media: ipu3-cio2 Check num_planes and sizes in queue_setup
2021-10-01 11:25 [PATCH v3 0/8] media: ipu3 + i2c: Fix v4l2-compliance issues Ricardo Ribalda
@ 2021-10-01 11:25 ` Ricardo Ribalda
2021-10-06 21:56 ` Sakari Ailus
2021-10-01 11:25 ` [PATCH v3 2/8] media: ipu3-imgu: Refactor bytesperpixel calculation Ricardo Ribalda
` (6 subsequent siblings)
7 siblings, 1 reply; 12+ messages in thread
From: Ricardo Ribalda @ 2021-10-01 11:25 UTC (permalink / raw)
To: Mauro Carvalho Chehab, Yong Zhi, Bingbu Cao, linux-media,
linux-kernel, Chiranjeevi Rapolu, Sakari Ailus
Cc: Ricardo Ribalda
If num_planes is different than zero num_planes and sizes must be
checked to support the format.
Fix the following v4l2-compliance error:
Buffer ioctls (Input 0):
fail: v4l2-test-buffers.cpp(717): q.create_bufs(node, 1, &fmt) != EINVAL
test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: FAIL
Reviewed-by: Bingbu Cao <bingbu.cao@intel.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/pci/intel/ipu3/ipu3-cio2-main.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/media/pci/intel/ipu3/ipu3-cio2-main.c b/drivers/media/pci/intel/ipu3/ipu3-cio2-main.c
index 47db0ee0fcbfa..36099e95d29f2 100644
--- a/drivers/media/pci/intel/ipu3/ipu3-cio2-main.c
+++ b/drivers/media/pci/intel/ipu3/ipu3-cio2-main.c
@@ -798,13 +798,17 @@ static int cio2_vb2_queue_setup(struct vb2_queue *vq,
struct cio2_queue *q = vb2q_to_cio2_queue(vq);
unsigned int i;
- *num_planes = q->format.num_planes;
+ if (*num_planes && *num_planes < q->format.num_planes)
+ return -EINVAL;
- for (i = 0; i < *num_planes; ++i) {
+ for (i = 0; i < q->format.num_planes; ++i) {
+ if (*num_planes && sizes[i] < q->format.plane_fmt[i].sizeimage)
+ return -EINVAL;
sizes[i] = q->format.plane_fmt[i].sizeimage;
alloc_devs[i] = &cio2->pci_dev->dev;
}
+ *num_planes = q->format.num_planes;
*num_buffers = clamp_val(*num_buffers, 1, CIO2_MAX_BUFFERS);
/* Initialize buffer queue */
--
2.33.0.800.g4c38ced690-goog
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v3 1/8] media: ipu3-cio2 Check num_planes and sizes in queue_setup
2021-10-01 11:25 ` [PATCH v3 1/8] media: ipu3-cio2 Check num_planes and sizes in queue_setup Ricardo Ribalda
@ 2021-10-06 21:56 ` Sakari Ailus
2021-10-06 22:27 ` Ricardo Ribalda
0 siblings, 1 reply; 12+ messages in thread
From: Sakari Ailus @ 2021-10-06 21:56 UTC (permalink / raw)
To: Ricardo Ribalda
Cc: Mauro Carvalho Chehab, Yong Zhi, Bingbu Cao, linux-media,
linux-kernel, Chiranjeevi Rapolu
Hi Ricardo,
On Fri, Oct 01, 2021 at 11:25:15AM +0000, Ricardo Ribalda wrote:
> If num_planes is different than zero num_planes and sizes must be
> checked to support the format.
>
> Fix the following v4l2-compliance error:
>
> Buffer ioctls (Input 0):
> fail: v4l2-test-buffers.cpp(717): q.create_bufs(node, 1, &fmt) != EINVAL
> test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: FAIL
>
> Reviewed-by: Bingbu Cao <bingbu.cao@intel.com>
> Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
I attempted to apply the set to my tree but it doesn't seem to.
Do you happen to have extra patches in your tree?
I just pushed mine to the master branch here:
https://git.linuxtv.org/sailus/media_tree.git/
--
Sakari Ailus
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH v3 1/8] media: ipu3-cio2 Check num_planes and sizes in queue_setup
2021-10-06 21:56 ` Sakari Ailus
@ 2021-10-06 22:27 ` Ricardo Ribalda
0 siblings, 0 replies; 12+ messages in thread
From: Ricardo Ribalda @ 2021-10-06 22:27 UTC (permalink / raw)
To: Sakari Ailus
Cc: Mauro Carvalho Chehab, Yong Zhi, Bingbu Cao, linux-media,
linux-kernel, Chiranjeevi Rapolu
Hi Sakari
Thanks for your review :)
On Wed, 6 Oct 2021 at 23:56, Sakari Ailus <sakari.ailus@linux.intel.com> wrote:
>
> Hi Ricardo,
>
> On Fri, Oct 01, 2021 at 11:25:15AM +0000, Ricardo Ribalda wrote:
> > If num_planes is different than zero num_planes and sizes must be
> > checked to support the format.
> >
> > Fix the following v4l2-compliance error:
> >
> > Buffer ioctls (Input 0):
> > fail: v4l2-test-buffers.cpp(717): q.create_bufs(node, 1, &fmt) != EINVAL
> > test VIDIOC_REQBUFS/CREATE_BUFS/QUERYBUF: FAIL
> >
> > Reviewed-by: Bingbu Cao <bingbu.cao@intel.com>
> > Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
>
> I attempted to apply the set to my tree but it doesn't seem to.
>
> Do you happen to have extra patches in your tree?
I think that I was on top of Linus.
I just rebased it on top of yours and resend it as v4
Thanks!
>
> I just pushed mine to the master branch here:
>
> https://git.linuxtv.org/sailus/media_tree.git/
>
> --
> Sakari Ailus
--
Ricardo Ribalda
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v3 2/8] media: ipu3-imgu: Refactor bytesperpixel calculation
2021-10-01 11:25 [PATCH v3 0/8] media: ipu3 + i2c: Fix v4l2-compliance issues Ricardo Ribalda
2021-10-01 11:25 ` [PATCH v3 1/8] media: ipu3-cio2 Check num_planes and sizes in queue_setup Ricardo Ribalda
@ 2021-10-01 11:25 ` Ricardo Ribalda
2021-10-01 11:25 ` [PATCH v3 3/8] media: ipu3-imgu: Set valid initial format Ricardo Ribalda
` (5 subsequent siblings)
7 siblings, 0 replies; 12+ messages in thread
From: Ricardo Ribalda @ 2021-10-01 11:25 UTC (permalink / raw)
To: Mauro Carvalho Chehab, Yong Zhi, Bingbu Cao, linux-media,
linux-kernel, Chiranjeevi Rapolu, Sakari Ailus
Cc: Ricardo Ribalda
Move the calculation to an inline function, to it can be used by other
parts of the driver.
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/staging/media/ipu3/ipu3-css.c | 19 +++----------------
drivers/staging/media/ipu3/ipu3-css.h | 1 -
drivers/staging/media/ipu3/ipu3.h | 12 ++++++++++++
3 files changed, 15 insertions(+), 17 deletions(-)
diff --git a/drivers/staging/media/ipu3/ipu3-css.c b/drivers/staging/media/ipu3/ipu3-css.c
index 608dcacf12b2c..8c70497d744c9 100644
--- a/drivers/staging/media/ipu3/ipu3-css.c
+++ b/drivers/staging/media/ipu3/ipu3-css.c
@@ -5,6 +5,7 @@
#include <linux/iopoll.h>
#include <linux/slab.h>
+#include "ipu3.h"
#include "ipu3-css.h"
#include "ipu3-css-fw.h"
#include "ipu3-css-params.h"
@@ -53,7 +54,6 @@ static const struct imgu_css_format imgu_css_formats[] = {
.frame_format = IMGU_ABI_FRAME_FORMAT_NV12,
.osys_format = IMGU_ABI_OSYS_FORMAT_NV12,
.osys_tiling = IMGU_ABI_OSYS_TILING_NONE,
- .bytesperpixel_num = 1 * IPU3_CSS_FORMAT_BPP_DEN,
.chroma_decim = 4,
.width_align = IPU3_UAPI_ISP_VEC_ELEMS,
.flags = IPU3_CSS_FORMAT_FL_OUT | IPU3_CSS_FORMAT_FL_VF,
@@ -64,7 +64,6 @@ static const struct imgu_css_format imgu_css_formats[] = {
.frame_format = IMGU_ABI_FRAME_FORMAT_RAW_PACKED,
.bayer_order = IMGU_ABI_BAYER_ORDER_BGGR,
.bit_depth = 10,
- .bytesperpixel_num = 64,
.width_align = 2 * IPU3_UAPI_ISP_VEC_ELEMS,
.flags = IPU3_CSS_FORMAT_FL_IN,
}, {
@@ -73,7 +72,6 @@ static const struct imgu_css_format imgu_css_formats[] = {
.frame_format = IMGU_ABI_FRAME_FORMAT_RAW_PACKED,
.bayer_order = IMGU_ABI_BAYER_ORDER_GBRG,
.bit_depth = 10,
- .bytesperpixel_num = 64,
.width_align = 2 * IPU3_UAPI_ISP_VEC_ELEMS,
.flags = IPU3_CSS_FORMAT_FL_IN,
}, {
@@ -82,7 +80,6 @@ static const struct imgu_css_format imgu_css_formats[] = {
.frame_format = IMGU_ABI_FRAME_FORMAT_RAW_PACKED,
.bayer_order = IMGU_ABI_BAYER_ORDER_GRBG,
.bit_depth = 10,
- .bytesperpixel_num = 64,
.width_align = 2 * IPU3_UAPI_ISP_VEC_ELEMS,
.flags = IPU3_CSS_FORMAT_FL_IN,
}, {
@@ -91,7 +88,6 @@ static const struct imgu_css_format imgu_css_formats[] = {
.frame_format = IMGU_ABI_FRAME_FORMAT_RAW_PACKED,
.bayer_order = IMGU_ABI_BAYER_ORDER_RGGB,
.bit_depth = 10,
- .bytesperpixel_num = 64,
.width_align = 2 * IPU3_UAPI_ISP_VEC_ELEMS,
.flags = IPU3_CSS_FORMAT_FL_IN,
},
@@ -150,17 +146,8 @@ static int imgu_css_queue_init(struct imgu_css_queue *queue,
f->height = ALIGN(clamp_t(u32, f->height,
IPU3_CSS_MIN_RES, IPU3_CSS_MAX_H), 2);
queue->width_pad = ALIGN(f->width, queue->css_fmt->width_align);
- if (queue->css_fmt->frame_format != IMGU_ABI_FRAME_FORMAT_RAW_PACKED)
- f->plane_fmt[0].bytesperline = DIV_ROUND_UP(queue->width_pad *
- queue->css_fmt->bytesperpixel_num,
- IPU3_CSS_FORMAT_BPP_DEN);
- else
- /* For packed raw, alignment for bpl is by 50 to the width */
- f->plane_fmt[0].bytesperline =
- DIV_ROUND_UP(f->width,
- IPU3_CSS_FORMAT_BPP_DEN) *
- queue->css_fmt->bytesperpixel_num;
-
+ f->plane_fmt[0].bytesperline =
+ imgu_bytesperline(f->width, queue->css_fmt->frame_format);
sizeimage = f->height * f->plane_fmt[0].bytesperline;
if (queue->css_fmt->chroma_decim)
sizeimage += 2 * sizeimage / queue->css_fmt->chroma_decim;
diff --git a/drivers/staging/media/ipu3/ipu3-css.h b/drivers/staging/media/ipu3/ipu3-css.h
index 6108a068b228f..ab64e95212032 100644
--- a/drivers/staging/media/ipu3/ipu3-css.h
+++ b/drivers/staging/media/ipu3/ipu3-css.h
@@ -82,7 +82,6 @@ struct imgu_css_format {
enum imgu_abi_bayer_order bayer_order;
enum imgu_abi_osys_format osys_format;
enum imgu_abi_osys_tiling osys_tiling;
- u32 bytesperpixel_num; /* Bytes per pixel in first plane * 50 */
u8 bit_depth; /* Effective bits per pixel */
u8 chroma_decim; /* Chroma plane decimation, 0=no chroma plane */
u8 width_align; /* Alignment requirement for width_pad */
diff --git a/drivers/staging/media/ipu3/ipu3.h b/drivers/staging/media/ipu3/ipu3.h
index eb46b527dd233..d2ad0a95c5aab 100644
--- a/drivers/staging/media/ipu3/ipu3.h
+++ b/drivers/staging/media/ipu3/ipu3.h
@@ -164,4 +164,16 @@ void imgu_v4l2_buffer_done(struct vb2_buffer *vb, enum vb2_buffer_state state);
int imgu_s_stream(struct imgu_device *imgu, int enable);
+static inline u32 imgu_bytesperline(const unsigned int width,
+ enum imgu_abi_frame_format frame_format)
+{
+ if (frame_format == IMGU_ABI_FRAME_FORMAT_NV12)
+ return ALIGN(width, IPU3_UAPI_ISP_VEC_ELEMS);
+ /*
+ * 64 bytes for every 50 pixels, the line length
+ * in bytes is multiple of 64 (line end alignment).
+ */
+ return DIV_ROUND_UP(width, 50) * 64;
+}
+
#endif
--
2.33.0.800.g4c38ced690-goog
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v3 3/8] media: ipu3-imgu: Set valid initial format
2021-10-01 11:25 [PATCH v3 0/8] media: ipu3 + i2c: Fix v4l2-compliance issues Ricardo Ribalda
2021-10-01 11:25 ` [PATCH v3 1/8] media: ipu3-cio2 Check num_planes and sizes in queue_setup Ricardo Ribalda
2021-10-01 11:25 ` [PATCH v3 2/8] media: ipu3-imgu: Refactor bytesperpixel calculation Ricardo Ribalda
@ 2021-10-01 11:25 ` Ricardo Ribalda
2021-10-06 21:50 ` Sakari Ailus
2021-10-01 11:25 ` [PATCH v3 4/8] media: ipu3-imgu: imgu_fmt: Handle properly try Ricardo Ribalda
` (4 subsequent siblings)
7 siblings, 1 reply; 12+ messages in thread
From: Ricardo Ribalda @ 2021-10-01 11:25 UTC (permalink / raw)
To: Mauro Carvalho Chehab, Yong Zhi, Bingbu Cao, linux-media,
linux-kernel, Chiranjeevi Rapolu, Sakari Ailus
Cc: Ricardo Ribalda
The initial format did not have a valid size.
Fixes v4l2-compliance:
fail: v4l2-test-formats.cpp(723): Video Output Multiplanar:
TRY_FMT(G_FMT) != G_FMT
test VIDIOC_TRY_FMT: FAIL
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/staging/media/ipu3/ipu3-v4l2.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/staging/media/ipu3/ipu3-v4l2.c b/drivers/staging/media/ipu3/ipu3-v4l2.c
index 38a2407645096..1813bb29e362b 100644
--- a/drivers/staging/media/ipu3/ipu3-v4l2.c
+++ b/drivers/staging/media/ipu3/ipu3-v4l2.c
@@ -1136,7 +1136,9 @@ static int imgu_v4l2_node_setup(struct imgu_device *imgu, unsigned int pipe,
def_pix_fmt.height = def_bus_fmt.height;
def_pix_fmt.field = def_bus_fmt.field;
def_pix_fmt.num_planes = 1;
- def_pix_fmt.plane_fmt[0].bytesperline = def_pix_fmt.width * 2;
+ def_pix_fmt.plane_fmt[0].bytesperline =
+ imgu_bytesperline(def_pix_fmt.width,
+ IMGU_ABI_FRAME_FORMAT_RAW_PACKED);
def_pix_fmt.plane_fmt[0].sizeimage =
def_pix_fmt.height * def_pix_fmt.plane_fmt[0].bytesperline;
def_pix_fmt.flags = 0;
--
2.33.0.800.g4c38ced690-goog
^ permalink raw reply related [flat|nested] 12+ messages in thread
* Re: [PATCH v3 3/8] media: ipu3-imgu: Set valid initial format
2021-10-01 11:25 ` [PATCH v3 3/8] media: ipu3-imgu: Set valid initial format Ricardo Ribalda
@ 2021-10-06 21:50 ` Sakari Ailus
0 siblings, 0 replies; 12+ messages in thread
From: Sakari Ailus @ 2021-10-06 21:50 UTC (permalink / raw)
To: Ricardo Ribalda
Cc: Mauro Carvalho Chehab, Yong Zhi, Bingbu Cao, linux-media,
linux-kernel, Chiranjeevi Rapolu
Hi Ricardo,
On Fri, Oct 01, 2021 at 11:25:17AM +0000, Ricardo Ribalda wrote:
> The initial format did not have a valid size.
>
> Fixes v4l2-compliance:
>
> fail: v4l2-test-formats.cpp(723): Video Output Multiplanar:
> TRY_FMT(G_FMT) != G_FMT
> test VIDIOC_TRY_FMT: FAIL
>
> Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
> ---
> drivers/staging/media/ipu3/ipu3-v4l2.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/staging/media/ipu3/ipu3-v4l2.c b/drivers/staging/media/ipu3/ipu3-v4l2.c
> index 38a2407645096..1813bb29e362b 100644
> --- a/drivers/staging/media/ipu3/ipu3-v4l2.c
> +++ b/drivers/staging/media/ipu3/ipu3-v4l2.c
> @@ -1136,7 +1136,9 @@ static int imgu_v4l2_node_setup(struct imgu_device *imgu, unsigned int pipe,
> def_pix_fmt.height = def_bus_fmt.height;
> def_pix_fmt.field = def_bus_fmt.field;
> def_pix_fmt.num_planes = 1;
> - def_pix_fmt.plane_fmt[0].bytesperline = def_pix_fmt.width * 2;
> + def_pix_fmt.plane_fmt[0].bytesperline =
> + imgu_bytesperline(def_pix_fmt.width,
> + IMGU_ABI_FRAME_FORMAT_RAW_PACKED);
I thought this was for the CIO2 driver when reviewing it, because of the
subject at the time. ;-) The 2nd patch is very nice, thanks!
--
Sakari Ailus
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH v3 4/8] media: ipu3-imgu: imgu_fmt: Handle properly try
2021-10-01 11:25 [PATCH v3 0/8] media: ipu3 + i2c: Fix v4l2-compliance issues Ricardo Ribalda
` (2 preceding siblings ...)
2021-10-01 11:25 ` [PATCH v3 3/8] media: ipu3-imgu: Set valid initial format Ricardo Ribalda
@ 2021-10-01 11:25 ` Ricardo Ribalda
2021-10-01 11:25 ` [PATCH v3 5/8] media: ipu3-imgu: VIDIOC_QUERYCAP: Fix bus_info Ricardo Ribalda
` (3 subsequent siblings)
7 siblings, 0 replies; 12+ messages in thread
From: Ricardo Ribalda @ 2021-10-01 11:25 UTC (permalink / raw)
To: Mauro Carvalho Chehab, Yong Zhi, Bingbu Cao, linux-media,
linux-kernel, Chiranjeevi Rapolu, Sakari Ailus
Cc: Ricardo Ribalda
For a try_fmt call, the node noes not need to be enabled.
Fixes v4l2-compliance
fail: v4l2-test-formats.cpp(717): Video Output Multiplanar is valid, but
no TRY_FMT was implemented
test VIDIOC_TRY_FMT: FAIL
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/staging/media/ipu3/ipu3-v4l2.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/media/ipu3/ipu3-v4l2.c b/drivers/staging/media/ipu3/ipu3-v4l2.c
index 1813bb29e362b..bf3cd1d576280 100644
--- a/drivers/staging/media/ipu3/ipu3-v4l2.c
+++ b/drivers/staging/media/ipu3/ipu3-v4l2.c
@@ -696,7 +696,7 @@ static int imgu_fmt(struct imgu_device *imgu, unsigned int pipe, int node,
/* CSS expects some format on OUT queue */
if (i != IPU3_CSS_QUEUE_OUT &&
- !imgu_pipe->nodes[inode].enabled) {
+ !imgu_pipe->nodes[inode].enabled && !try) {
fmts[i] = NULL;
continue;
}
--
2.33.0.800.g4c38ced690-goog
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v3 5/8] media: ipu3-imgu: VIDIOC_QUERYCAP: Fix bus_info
2021-10-01 11:25 [PATCH v3 0/8] media: ipu3 + i2c: Fix v4l2-compliance issues Ricardo Ribalda
` (3 preceding siblings ...)
2021-10-01 11:25 ` [PATCH v3 4/8] media: ipu3-imgu: imgu_fmt: Handle properly try Ricardo Ribalda
@ 2021-10-01 11:25 ` Ricardo Ribalda
2021-10-01 11:25 ` [PATCH v3 6/8] media: dw9714: Add implementation for events Ricardo Ribalda
` (2 subsequent siblings)
7 siblings, 0 replies; 12+ messages in thread
From: Ricardo Ribalda @ 2021-10-01 11:25 UTC (permalink / raw)
To: Mauro Carvalho Chehab, Yong Zhi, Bingbu Cao, linux-media,
linux-kernel, Chiranjeevi Rapolu, Sakari Ailus
Cc: Ricardo Ribalda
bus_info field had a different value for the media entity and the video
device.
Fixes v4l2-compliance:
v4l2-compliance.cpp(637): media bus_info 'PCI:0000:00:05.0' differs from
V4L2 bus_info 'PCI:viewfinder'
Reviewed-by: Bingbu Cao <bingbu.cao@intel.com>
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/staging/media/ipu3/ipu3-v4l2.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/media/ipu3/ipu3-v4l2.c b/drivers/staging/media/ipu3/ipu3-v4l2.c
index bf3cd1d576280..a2164b6708236 100644
--- a/drivers/staging/media/ipu3/ipu3-v4l2.c
+++ b/drivers/staging/media/ipu3/ipu3-v4l2.c
@@ -592,11 +592,12 @@ static const struct imgu_fmt *find_format(struct v4l2_format *f, u32 type)
static int imgu_vidioc_querycap(struct file *file, void *fh,
struct v4l2_capability *cap)
{
- struct imgu_video_device *node = file_to_intel_imgu_node(file);
+ struct imgu_device *imgu = video_drvdata(file);
strscpy(cap->driver, IMGU_NAME, sizeof(cap->driver));
strscpy(cap->card, IMGU_NAME, sizeof(cap->card));
- snprintf(cap->bus_info, sizeof(cap->bus_info), "PCI:%s", node->name);
+ snprintf(cap->bus_info, sizeof(cap->bus_info), "PCI:%s",
+ pci_name(imgu->pci_dev));
return 0;
}
--
2.33.0.800.g4c38ced690-goog
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v3 6/8] media: dw9714: Add implementation for events
2021-10-01 11:25 [PATCH v3 0/8] media: ipu3 + i2c: Fix v4l2-compliance issues Ricardo Ribalda
` (4 preceding siblings ...)
2021-10-01 11:25 ` [PATCH v3 5/8] media: ipu3-imgu: VIDIOC_QUERYCAP: Fix bus_info Ricardo Ribalda
@ 2021-10-01 11:25 ` Ricardo Ribalda
2021-10-01 11:25 ` [PATCH v3 7/8] media: ov13858: " Ricardo Ribalda
2021-10-01 11:25 ` [PATCH v3 8/8] media: ov5670: " Ricardo Ribalda
7 siblings, 0 replies; 12+ messages in thread
From: Ricardo Ribalda @ 2021-10-01 11:25 UTC (permalink / raw)
To: Mauro Carvalho Chehab, Yong Zhi, Bingbu Cao, linux-media,
linux-kernel, Chiranjeevi Rapolu, Sakari Ailus
Cc: Ricardo Ribalda
Use v4l2 control API helpers to support the events.
Fixes v4l2-compliance:
test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: FAIL
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/i2c/dw9714.c | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/drivers/media/i2c/dw9714.c b/drivers/media/i2c/dw9714.c
index c8b4292512dca..3863dfeb82934 100644
--- a/drivers/media/i2c/dw9714.c
+++ b/drivers/media/i2c/dw9714.c
@@ -7,6 +7,7 @@
#include <linux/pm_runtime.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-device.h>
+#include <media/v4l2-event.h>
#define DW9714_NAME "dw9714"
#define DW9714_MAX_FOCUS_POS 1023
@@ -100,7 +101,15 @@ static const struct v4l2_subdev_internal_ops dw9714_int_ops = {
.close = dw9714_close,
};
-static const struct v4l2_subdev_ops dw9714_ops = { };
+static const struct v4l2_subdev_core_ops dw9714_core_ops = {
+ .log_status = v4l2_ctrl_subdev_log_status,
+ .subscribe_event = v4l2_ctrl_subdev_subscribe_event,
+ .unsubscribe_event = v4l2_event_subdev_unsubscribe,
+};
+
+static const struct v4l2_subdev_ops dw9714_ops = {
+ .core = &dw9714_core_ops,
+};
static void dw9714_subdev_cleanup(struct dw9714_device *dw9714_dev)
{
@@ -137,7 +146,8 @@ static int dw9714_probe(struct i2c_client *client)
return -ENOMEM;
v4l2_i2c_subdev_init(&dw9714_dev->sd, client, &dw9714_ops);
- dw9714_dev->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
+ dw9714_dev->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE |
+ V4L2_SUBDEV_FL_HAS_EVENTS;
dw9714_dev->sd.internal_ops = &dw9714_int_ops;
rval = dw9714_init_controls(dw9714_dev);
--
2.33.0.800.g4c38ced690-goog
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v3 7/8] media: ov13858: Add implementation for events
2021-10-01 11:25 [PATCH v3 0/8] media: ipu3 + i2c: Fix v4l2-compliance issues Ricardo Ribalda
` (5 preceding siblings ...)
2021-10-01 11:25 ` [PATCH v3 6/8] media: dw9714: Add implementation for events Ricardo Ribalda
@ 2021-10-01 11:25 ` Ricardo Ribalda
2021-10-01 11:25 ` [PATCH v3 8/8] media: ov5670: " Ricardo Ribalda
7 siblings, 0 replies; 12+ messages in thread
From: Ricardo Ribalda @ 2021-10-01 11:25 UTC (permalink / raw)
To: Mauro Carvalho Chehab, Yong Zhi, Bingbu Cao, linux-media,
linux-kernel, Chiranjeevi Rapolu, Sakari Ailus
Cc: Ricardo Ribalda
Use v4l2 control API helpers to support the events.
Fixes v4l2-compliance:
test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: FAIL
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/i2c/ov13858.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/media/i2c/ov13858.c b/drivers/media/i2c/ov13858.c
index 7fc70af53e45d..b4d22f5d99337 100644
--- a/drivers/media/i2c/ov13858.c
+++ b/drivers/media/i2c/ov13858.c
@@ -7,6 +7,7 @@
#include <linux/pm_runtime.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-device.h>
+#include <media/v4l2-event.h>
#include <media/v4l2-fwnode.h>
#define OV13858_REG_VALUE_08BIT 1
@@ -1553,6 +1554,12 @@ static int ov13858_identify_module(struct ov13858 *ov13858)
return 0;
}
+static const struct v4l2_subdev_core_ops ov13858_core_ops = {
+ .log_status = v4l2_ctrl_subdev_log_status,
+ .subscribe_event = v4l2_ctrl_subdev_subscribe_event,
+ .unsubscribe_event = v4l2_event_subdev_unsubscribe,
+};
+
static const struct v4l2_subdev_video_ops ov13858_video_ops = {
.s_stream = ov13858_set_stream,
};
@@ -1569,6 +1576,7 @@ static const struct v4l2_subdev_sensor_ops ov13858_sensor_ops = {
};
static const struct v4l2_subdev_ops ov13858_subdev_ops = {
+ .core = &ov13858_core_ops,
.video = &ov13858_video_ops,
.pad = &ov13858_pad_ops,
.sensor = &ov13858_sensor_ops,
@@ -1724,7 +1732,8 @@ static int ov13858_probe(struct i2c_client *client,
/* Initialize subdev */
ov13858->sd.internal_ops = &ov13858_internal_ops;
- ov13858->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
+ ov13858->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE |
+ V4L2_SUBDEV_FL_HAS_EVENTS;
ov13858->sd.entity.ops = &ov13858_subdev_entity_ops;
ov13858->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR;
--
2.33.0.800.g4c38ced690-goog
^ permalink raw reply related [flat|nested] 12+ messages in thread
* [PATCH v3 8/8] media: ov5670: Add implementation for events
2021-10-01 11:25 [PATCH v3 0/8] media: ipu3 + i2c: Fix v4l2-compliance issues Ricardo Ribalda
` (6 preceding siblings ...)
2021-10-01 11:25 ` [PATCH v3 7/8] media: ov13858: " Ricardo Ribalda
@ 2021-10-01 11:25 ` Ricardo Ribalda
7 siblings, 0 replies; 12+ messages in thread
From: Ricardo Ribalda @ 2021-10-01 11:25 UTC (permalink / raw)
To: Mauro Carvalho Chehab, Yong Zhi, Bingbu Cao, linux-media,
linux-kernel, Chiranjeevi Rapolu, Sakari Ailus
Cc: Ricardo Ribalda
Use v4l2 control API helpers to support the events.
Fixes v4l2-compliance:
test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: FAIL
Signed-off-by: Ricardo Ribalda <ribalda@chromium.org>
---
drivers/media/i2c/ov5670.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/drivers/media/i2c/ov5670.c b/drivers/media/i2c/ov5670.c
index 49189926afd67..251f459ab484a 100644
--- a/drivers/media/i2c/ov5670.c
+++ b/drivers/media/i2c/ov5670.c
@@ -7,6 +7,7 @@
#include <linux/pm_runtime.h>
#include <media/v4l2-ctrls.h>
#include <media/v4l2-device.h>
+#include <media/v4l2-event.h>
#include <media/v4l2-fwnode.h>
#define OV5670_REG_CHIP_ID 0x300a
@@ -2420,6 +2421,12 @@ static int ov5670_identify_module(struct ov5670 *ov5670)
return 0;
}
+static const struct v4l2_subdev_core_ops ov5670_core_ops = {
+ .log_status = v4l2_ctrl_subdev_log_status,
+ .subscribe_event = v4l2_ctrl_subdev_subscribe_event,
+ .unsubscribe_event = v4l2_event_subdev_unsubscribe,
+};
+
static const struct v4l2_subdev_video_ops ov5670_video_ops = {
.s_stream = ov5670_set_stream,
};
@@ -2436,6 +2443,7 @@ static const struct v4l2_subdev_sensor_ops ov5670_sensor_ops = {
};
static const struct v4l2_subdev_ops ov5670_subdev_ops = {
+ .core = &ov5670_core_ops,
.video = &ov5670_video_ops,
.pad = &ov5670_pad_ops,
.sensor = &ov5670_sensor_ops,
@@ -2489,7 +2497,8 @@ static int ov5670_probe(struct i2c_client *client)
}
ov5670->sd.internal_ops = &ov5670_internal_ops;
- ov5670->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
+ ov5670->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE |
+ V4L2_SUBDEV_FL_HAS_EVENTS;
ov5670->sd.entity.ops = &ov5670_subdev_entity_ops;
ov5670->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR;
--
2.33.0.800.g4c38ced690-goog
^ permalink raw reply related [flat|nested] 12+ messages in thread