linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jacopo Mondi <jacopo@jmondi.org>
To: Dave Stevenson <dave.stevenson@raspberrypi.com>
Cc: paul.j.murphy@intel.com, daniele.alessandrelli@intel.com,
	linux-media@vger.kernel.org,
	Hans Verkuil <hverkuil-cisco@xs4all.nl>
Subject: Re: [PATCH 16/16] media: i2c: ov9282: Support event handlers
Date: Fri, 7 Oct 2022 14:57:49 +0200	[thread overview]
Message-ID: <20221007125749.rvvmfe4wklxt2mmv@uno.localdomain> (raw)
In-Reply-To: <CAPY8ntCg0nM84qsauexXHSAdCKc0K9fco6wDjZ-KzfOdqMyrFQ@mail.gmail.com>


On Fri, Oct 07, 2022 at 11:22:23AM +0100, Dave Stevenson wrote:
> Hi Jacopo
>
> + Hans for comment on compliance / controls framework
>
> On Thu, 6 Oct 2022 at 10:59, Jacopo Mondi <jacopo@jmondi.org> wrote:
> >
> > Hi Dave
> >
> > On Wed, Oct 05, 2022 at 04:28:09PM +0100, Dave Stevenson wrote:
> > > As noted in the headers for V4L2_SUBDEV_FL_HAS_EVENTS,
> > > "controls can send events, thus drivers exposing controls
> > > should set this flag".
> > >
> >
> > I was expecting this to only apply to drivers that actually generate
> > events...
> >
> > Not sure I can give a tag here as my understanding of this part is
> > limited, let's wait for other opinions :)
>
> I had to rack my memory on this one.
>
> It fixes a v4l2-compliance failure:
> fail: v4l2-test-controls.cpp(835): subscribe event for control 'User
> Controls' failed
> test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: FAIL
> (v4l-utils built at ToT from today, so fd544473800 "support INTEGER
> and INTEGER64 control arrays")
>
> So either it is required by all drivers that expose controls, or it's
> an issue in v4l2-compliance.
> I believe it's the former as all controls can create a V4L2_EVENT_CTRL
> event should the value or range change (very common for things like
> HBLANK and VBLANK in image sensor drivers).
>

It seems only 19 sensor drivers in total implement a .subscribe_event
function... let's say there's room for improvements :)

> Thanks
>   Dave
>
> > > This driver exposes controls, but didn't reflect that it
> > > could generate events. Correct this, and add the default
> > > event handler functions.
> > >
> > > Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
> > > ---
> > >  drivers/media/i2c/ov9282.c | 10 +++++++++-
> > >  1 file changed, 9 insertions(+), 1 deletion(-)
> > >
> > > diff --git a/drivers/media/i2c/ov9282.c b/drivers/media/i2c/ov9282.c
> > > index bc429455421e..416c9656e3ac 100644
> > > --- a/drivers/media/i2c/ov9282.c
> > > +++ b/drivers/media/i2c/ov9282.c
> > > @@ -14,6 +14,7 @@
> > >  #include <linux/regulator/consumer.h>
> > >
> > >  #include <media/v4l2-ctrls.h>
> > > +#include <media/v4l2-event.h>
> > >  #include <media/v4l2-fwnode.h>
> > >  #include <media/v4l2-subdev.h>
> > >
> > > @@ -1189,6 +1190,11 @@ static int ov9282_parse_hw_config(struct ov9282 *ov9282)
> > >  }
> > >
> > >  /* V4l2 subdevice ops */
> > > +static const struct v4l2_subdev_core_ops ov9282_core_ops = {
> > > +     .subscribe_event = v4l2_ctrl_subdev_subscribe_event,
> > > +     .unsubscribe_event = v4l2_event_subdev_unsubscribe,
> > > +};
> > > +
> > >  static const struct v4l2_subdev_video_ops ov9282_video_ops = {
> > >       .s_stream = ov9282_set_stream,
> > >  };
> > > @@ -1203,6 +1209,7 @@ static const struct v4l2_subdev_pad_ops ov9282_pad_ops = {
> > >  };
> > >
> > >  static const struct v4l2_subdev_ops ov9282_subdev_ops = {
> > > +     .core = &ov9282_core_ops,
> > >       .video = &ov9282_video_ops,
> > >       .pad = &ov9282_pad_ops,
> > >  };
> > > @@ -1419,7 +1426,8 @@ static int ov9282_probe(struct i2c_client *client)
> > >       }
> > >
> > >       /* Initialize subdev */
> > > -     ov9282->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE;
> > > +     ov9282->sd.flags |= V4L2_SUBDEV_FL_HAS_DEVNODE |
> > > +                         V4L2_SUBDEV_FL_HAS_EVENTS;
> > >       ov9282->sd.entity.function = MEDIA_ENT_F_CAM_SENSOR;
> > >
> > >       /* Initialize source pad */
> > > --
> > > 2.34.1
> > >

      reply	other threads:[~2022-10-07 12:57 UTC|newest]

Thread overview: 52+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-05 15:27 [PATCH 00/16] Updates to ov9282 sensor driver Dave Stevenson
2022-10-05 15:27 ` [PATCH 01/16] media: i2c: ov9282: Remove duplication of registers Dave Stevenson
2022-10-06  9:14   ` Jacopo Mondi
2022-10-05 15:27 ` [PATCH 02/16] media: i2c: ov9282: Split registers into common and mode specific Dave Stevenson
2022-10-06  9:15   ` Jacopo Mondi
2022-10-05 15:27 ` [PATCH 03/16] media: i2c: ov9282: Remove format code from the mode Dave Stevenson
2022-10-06  9:15   ` Jacopo Mondi
2022-10-05 15:27 ` [PATCH 04/16] media: i2c: ov9282: Remove pixel rate from mode definition Dave Stevenson
2022-10-06  9:17   ` Jacopo Mondi
2022-10-06 11:51     ` Dave Stevenson
2022-10-05 15:27 ` [PATCH 05/16] media: i2c: ov9281: Support more than 1 mode Dave Stevenson
2022-10-06  9:18   ` Jacopo Mondi
2022-10-26  7:22   ` Sakari Ailus
2022-10-05 15:27 ` [PATCH 06/16] media: i2c: ov9282: Correct HTS register for configured pixel rate Dave Stevenson
2022-10-06  9:23   ` Jacopo Mondi
2022-10-06 13:01     ` Dave Stevenson
2022-10-05 15:28 ` [PATCH 07/16] media: i2c: ov9282: Reduce vblank_min values based on testing Dave Stevenson
2022-10-06 11:56   ` Jacopo Mondi
2022-10-06 13:02     ` Dave Stevenson
2022-10-05 15:28 ` [PATCH 08/16] media: i2c: ov9282: Add selection for CSI2 clock mode Dave Stevenson
2022-10-06  9:24   ` Jacopo Mondi
2022-10-26  7:21   ` Sakari Ailus
2022-10-28 12:57     ` Dave Stevenson
2022-10-28 14:30       ` Sakari Ailus
2022-10-28 15:03         ` Dave Stevenson
2022-10-31 13:06           ` Sakari Ailus
2022-10-05 15:28 ` [PATCH 09/16] media: i2c: ov9282: Add the properties from fwnode Dave Stevenson
2022-10-06 11:57   ` Jacopo Mondi
2022-10-05 15:28 ` [PATCH 10/16] media: i2c: ov9282: Action CID_VBLANK when set Dave Stevenson
2022-10-06  9:29   ` Jacopo Mondi
2022-10-06 13:21     ` Dave Stevenson
2022-10-05 15:28 ` [PATCH 11/16] media: i2c: ov9282: Add HFLIP and VFLIP support Dave Stevenson
2022-10-06  9:38   ` Jacopo Mondi
2022-10-06 14:21     ` Dave Stevenson
2022-10-05 15:28 ` [PATCH 12/16] media: i2c: ov9282: Make V4L2_CID_HBLANK r/w Dave Stevenson
2022-10-06  9:41   ` Jacopo Mondi
2022-10-06 11:33     ` Dave Stevenson
2022-10-06 11:53       ` Jacopo Mondi
2022-10-05 15:28 ` [PATCH 13/16] media: i2c: ov9282: Add selection API calls for cropping info Dave Stevenson
2022-10-06  9:43   ` Jacopo Mondi
2022-10-06 11:39     ` Dave Stevenson
2022-10-06 11:54       ` Jacopo Mondi
2022-10-05 15:28 ` [PATCH 14/16] media: i2c: ov9282: Add support for 1280x800 and 640x400 modes Dave Stevenson
2022-10-06  9:48   ` Jacopo Mondi
2022-10-06 11:46     ` Dave Stevenson
2022-10-05 15:28 ` [PATCH 15/16] media: i2c: ov9282: Add support for 8bit readout Dave Stevenson
2022-10-06  9:57   ` Jacopo Mondi
2022-10-06 12:20     ` Dave Stevenson
2022-10-05 15:28 ` [PATCH 16/16] media: i2c: ov9282: Support event handlers Dave Stevenson
2022-10-06  9:59   ` Jacopo Mondi
2022-10-07 10:22     ` Dave Stevenson
2022-10-07 12:57       ` Jacopo Mondi [this message]

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=20221007125749.rvvmfe4wklxt2mmv@uno.localdomain \
    --to=jacopo@jmondi.org \
    --cc=daniele.alessandrelli@intel.com \
    --cc=dave.stevenson@raspberrypi.com \
    --cc=hverkuil-cisco@xs4all.nl \
    --cc=linux-media@vger.kernel.org \
    --cc=paul.j.murphy@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 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).