From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Hans Verkuil <hansverk@cisco.com>
Cc: Sakari Ailus <sakari.ailus@iki.fi>,
Hans Verkuil <hverkuil@xs4all.nl>,
linux-media@vger.kernel.org,
Hans Verkuil <hans.verkuil@cisco.com>
Subject: Re: [PATCHv2 06/15] v4l2-subdev: implement VIDIOC_DBG_G_CHIP_INFO ioctl
Date: Fri, 09 Feb 2018 15:04:52 +0200 [thread overview]
Message-ID: <2001099.VTHt2F8In2@avalon> (raw)
In-Reply-To: <e56fae29-52ba-29c4-bc2e-c328d433db8f@cisco.com>
Hi Hans,
On Friday, 9 February 2018 15:00:53 EET Hans Verkuil wrote:
> On 02/09/18 13:44, Sakari Ailus wrote:
> > On Fri, Feb 09, 2018 at 01:18:18PM +0100, Hans Verkuil wrote:
> >> On 02/09/18 13:01, Sakari Ailus wrote:
> >>> On Thu, Feb 08, 2018 at 09:36:46AM +0100, Hans Verkuil wrote:
> >>>> The VIDIOC_DBG_G/S_REGISTER ioctls imply that VIDIOC_DBG_G_CHIP_INFO is
> >>>> also present, since without that you cannot use v4l2-dbg.
> >>>>
> >>>> Just like the implementation in v4l2-ioctl.c this can be implemented in
> >>>> the
> >>>> core and no drivers need to be modified.
> >>>>
> >>>> It also makes it possible for v4l2-compliance to properly test the
> >>>> VIDIOC_DBG_G/S_REGISTER ioctls.
> >>>>
> >>>> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com>
> >>>> ---
> >>>>
> >>>> drivers/media/v4l2-core/v4l2-subdev.c | 13 +++++++++++++
> >>>> 1 file changed, 13 insertions(+)
> >>>>
> >>>> diff --git a/drivers/media/v4l2-core/v4l2-subdev.c
> >>>> b/drivers/media/v4l2-core/v4l2-subdev.c index
> >>>> 6cabfa32d2ed..2a5b5a3fa7a3 100644
> >>>> --- a/drivers/media/v4l2-core/v4l2-subdev.c
> >>>> +++ b/drivers/media/v4l2-core/v4l2-subdev.c
> >>>> @@ -255,6 +255,19 @@ static long subdev_do_ioctl(struct file *file,
> >>>> unsigned int cmd, void *arg)>>>>
> >>>> return -EPERM;
> >>>>
> >>>> return v4l2_subdev_call(sd, core, s_register, p);
> >>>>
> >>>> }
> >>>>
> >>>> + case VIDIOC_DBG_G_CHIP_INFO:
> >>>> + {
> >>>> + struct v4l2_dbg_chip_info *p = arg;
> >>>> +
> >>>> + if (p->match.type != V4L2_CHIP_MATCH_SUBDEV || p->match.addr)
> >>>> + return -EINVAL;
> >>>> + if (sd->ops->core && sd->ops->core->s_register)
> >>>> + p->flags |= V4L2_CHIP_FL_WRITABLE;
> >>>> + if (sd->ops->core && sd->ops->core->g_register)
> >>>> + p->flags |= V4L2_CHIP_FL_READABLE;
> >>>> + strlcpy(p->name, sd->name, sizeof(p->name));
> >>>> + return 0;
> >>>> + }
> >>>
> >>> This is effectively doing the same as debugfs except that it's specific
> >>> to V4L2. I don't think we should endorse its use, and especially not
> >>> without a real use case.
> >>
> >> We (Cisco) use it all the time. Furthermore, this works for any bus, not
> >> just i2c. Also spi, internal register busses, etc.
> >>
> >> It's been in use for many years. More importantly, there is no excuse to
> >> have only half the API implemented.
> >>
> >> It's all fine to talk about debugfs, but are you going to make that? This
> >> API works, it's supported by v4l2-dbg, it's in use. Now, let's at least
> >> make it pass v4l2-compliance.
> >>
> >> I agree, if we would redesign it, we would use debugfs. But I think it
> >> didn't even exist when this was made. So this API is here to stay and
> >> all it takes is this ioctl of code to add the missing piece for subdevs.
> >>
> >> Nobody is going to make a replacement for this using debugfs. Why spend
> >> effort on it if we already have an API for this?
> >
> > It's not the first case when a more generic API replaces a subsystem
> > specific one. We have another conversion to make, switching from
> > implementing s_power() callback in drivers to runtime PM for instance.
> >
> > I simply want to point out that this patch is endorsing something which is
> > obsolete and not needed: no-one has complained about the lack of this for
> > sub-devices, haven't they?
> >
> > I'd just remove the check from v4l-compliance or make it optional. New
> > drivers should use debugfs instead if something like that is needed.
>
> You are correct in one respect: we use this API, but with video devices.
> So subdevices support the g/s_register ops, and they are called via
> /dev/videoX.
>
> We can remove the ioctl support from v4l2-subdev.c (not the g/s_register
> ops!). Without VIDIOC_DBG_G_CHIP_INFO I don't think v4l2-dbg is usable.
> Although it is always possible to call the ioctl directly, of course.
>
> So if Mauro would agree to this, the DBG ioctl support in v4l2-subdev can be
> removed.
That would be my preferred option.
> But either remove them, or add this ioctl. Don't leave it in a zombie state.
>
> Personally I see no harm whatsoever in just adding VIDIOC_DBG_G_CHIP_INFO.
> If someone ever makes a patch to switch over to debugfs then these ioctls
> can be removed.
>
> BTW, how would new drivers use debugfs for this? Does regmap provide such
> access?
Before attempting to provide an answer, as I've never used those ioctls
myself, could you please give us a bit more information about the use cases
you have at Cisco for this ?
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2018-02-09 13:04 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-02-08 8:36 [PATCHv2 00/15] Media Controller compliance fixes Hans Verkuil
2018-02-08 8:36 ` [PATCHv2 01/15] vimc: fix control event handling Hans Verkuil
2018-02-08 8:36 ` [PATCHv2 02/15] vimc: use correct subdev functions Hans Verkuil
2018-02-08 8:36 ` [PATCHv2 03/15] v4l2-ioctl.c: fix VIDIOC_DV_TIMINGS_CAP: don't clear pad Hans Verkuil
2018-02-08 8:36 ` [PATCHv2 04/15] v4l2-subdev: without controls return -ENOTTY Hans Verkuil
2018-02-09 11:46 ` Sakari Ailus
2018-02-09 11:56 ` Hans Verkuil
2018-02-09 12:38 ` Sakari Ailus
2018-02-09 12:48 ` Hans Verkuil
2018-02-09 13:09 ` Sakari Ailus
2018-02-09 13:14 ` Hans Verkuil
2018-02-08 8:36 ` [PATCHv2 05/15] v4l2-subdev: clear reserved fields Hans Verkuil
2018-02-08 8:36 ` [PATCHv2 06/15] v4l2-subdev: implement VIDIOC_DBG_G_CHIP_INFO ioctl Hans Verkuil
2018-02-09 12:01 ` Sakari Ailus
2018-02-09 12:18 ` Hans Verkuil
2018-02-09 12:44 ` Sakari Ailus
2018-02-09 12:58 ` Laurent Pinchart
2018-02-09 13:00 ` Hans Verkuil
2018-02-09 13:04 ` Laurent Pinchart [this message]
2018-02-09 13:13 ` Hans Verkuil
2018-02-09 13:21 ` Laurent Pinchart
2018-02-09 13:36 ` Hans Verkuil
2018-02-08 8:36 ` [PATCHv2 07/15] subdev-formats.rst: fix incorrect types Hans Verkuil
2018-02-08 8:36 ` [PATCHv2 08/15] media-ioc-g-topology.rst: fix interface-to-entity link description Hans Verkuil
2018-02-08 8:36 ` [PATCHv2 09/15] media-types.rst: fix type, small improvements Hans Verkuil
2018-02-08 8:36 ` [PATCHv2 10/15] media: media-types.rst: fix typo Hans Verkuil
2018-02-08 8:36 ` [PATCHv2 11/15] media-device.c: zero reserved field Hans Verkuil
2018-02-09 12:17 ` Sakari Ailus
2018-02-09 12:20 ` Hans Verkuil
2018-02-09 12:46 ` Sakari Ailus
2018-02-09 12:52 ` Hans Verkuil
2018-02-09 13:04 ` Sakari Ailus
2018-02-09 13:27 ` Hans Verkuil
2018-02-08 8:36 ` [PATCHv2 12/15] media.h: fix confusing typo in comment Hans Verkuil
2018-02-08 8:36 ` [PATCHv2 13/15] media: document and zero reservedX fields in media_v2_topology Hans Verkuil
2018-02-09 12:21 ` Sakari Ailus
2018-02-08 8:36 ` [PATCHv2 14/15] media-ioc-enum-entities/links.rst: document reserved fields Hans Verkuil
2018-02-08 8:36 ` [PATCHv2 15/15] media.h: reorganize header to make it easier to understand Hans Verkuil
2018-02-09 12:48 ` [PATCHv2 00/15] Media Controller compliance fixes Sakari Ailus
2018-02-09 12:49 ` Sakari Ailus
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=2001099.VTHt2F8In2@avalon \
--to=laurent.pinchart@ideasonboard.com \
--cc=hans.verkuil@cisco.com \
--cc=hansverk@cisco.com \
--cc=hverkuil@xs4all.nl \
--cc=linux-media@vger.kernel.org \
--cc=sakari.ailus@iki.fi \
/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