From: Janusz Krzysztofik <jmkrzyszt@gmail.com>
To: Jacopo Mondi <jacopo@jmondi.org>
Cc: mchehab@kernel.org, hverkuil-cisco@xs4all.nl,
sakari.ailus@linux.intel.com, laurent.pinchart@ideasonboard.com,
Jacopo Mondi <jacopo+renesas@jmondi.org>,
niklas.soderlund+renesas@ragnatech.se,
kieran.bingham@ideasonboard.com, dave.stevenson@raspberrypi.com,
hyun.kwon@xilinx.com, robert.jarzmik@free.fr,
linux-media@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
Janusz Krzysztofik <jmkrzyszt@gmail.com>
Subject: Re: [PATCH v7 01/10] media: v4l2-subdev: Introduce [get|set]_mbus_config pad ops
Date: Sat, 18 Jul 2020 01:23:24 +0200 [thread overview]
Message-ID: <22470298.ouqheUzb2q@z50> (raw)
In-Reply-To: <20200717072018.crgmvfrm44kgmvcb@uno.localdomain>
Hi Jacopo,
On Friday, July 17, 2020 9:20:18 A.M. CEST Jacopo Mondi wrote:
> Hi Janusz,
> thanks for review
>
> On Fri, Jul 17, 2020 at 12:15:27AM +0200, Janusz Krzysztofik wrote:
> > Hi Jacopo,
> >
> > On Thursday, July 16, 2020 4:27:04 P.M. CEST Jacopo Mondi wrote:
> > > Introduce two new pad operations to allow retrieving and configuring the
> > > media bus parameters on a subdevice pad.
> > >
> > > The newly introduced operations aims to replace the s/g_mbus_config video
> > > operations, which have been on their way for deprecation since a long
> > > time.
> > >
> > > Signed-off-by: Jacopo Mondi <jacopo+renesas@jmondi.org>
> > > ---
> > > include/media/v4l2-subdev.h | 27 +++++++++++++++++++++++++++
> > > 1 file changed, 27 insertions(+)
> > >
> > > diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
> > > index f7fe78a6f65a..d8b9d5735307 100644
> > > --- a/include/media/v4l2-subdev.h
> > > +++ b/include/media/v4l2-subdev.h
> > > @@ -670,6 +670,29 @@ struct v4l2_subdev_pad_config {
> > > *
> > > * @set_frame_desc: set the low level media bus frame parameters, @fd array
> > > * may be adjusted by the subdev driver to device capabilities.
> > > + *
> > > + * @get_mbus_config: get the media bus configuration of a remote sub-device.
> > > + * The media bus configuration is usually retrieved from the
> > > + * firmware interface at sub-device probe time, immediately
> > > + * applied to the hardware and eventually adjusted by the
> > > + * driver. Remote sub-devices (usually video receivers) shall
> > > + * use this operation to query the transmitting end bus
> > > + * configuration in order to adjust their own one accordingly.
> > > + * Callers should make sure they get the most up-to-date as
> > > + * possible configuration from the remote end, likely calling
> > > + * this operation as close as possible to stream on time. The
> > > + * operation shall fail if the pad index it has been called on
> > > + * is not valid.
> > > + *
> > > + * @set_mbus_config: set the media bus configuration of a remote sub-device.
> > > + * This operations is intended to allow, in combination with
> > > + * the get_mbus_config operation, the negotiation of media bus
> > > + * configuration parameters between media sub-devices. The
> > > + * operation shall not fail if the requested configuration is
> > > + * not supported, but the driver shall update the content of
> > > + * the %config argument to reflect what has been actually
> > > + * applied to the hardware. The operation shall fail if the
> > > + * pad index it has been called on is not valid.
>
> First of all, Hans sent a pull request for this series yesterday. Are
> you ok with that and with sending patches on top, or do you think the
> inclusion of the series should be post-poned ? (you can imagine what
> my preference is :)
>
> >
> > Could this description also clarify what results are expected in case of
> > hardware errors? The ov6650 implementation you propose may suggest such
> > errors may be expected to be ignored silently as long as current configuration
> > can be successfully obtained from hardware and passed back to the caller.
>
> I guess "it depends"(tm)
> I know this doesn't sound like a good answer :)
>
> A failure in applying or reading register likely means the driver is
> trying to access the hardware while it is in low power state. In this
> case I would consider this a driver bug, as it should try to be smart
> and cache settings and apply them at the proper time and return the
> current configuration, which should be cached as well.
>
> Of course things could go wrong for several reasons, and in the case
> if any unexpected error occurs I think an error is expected to be
> reported. Please note that this v7 of ov6650 does that by returning
> the return value of ov6650_get_mbus_config() at the end of
> ov6650_set_mbus_config.
Current configuration is not cached in your implementation proposed for ov6650.
If it was, would ov6650_set_mbus_config() always succeed, just passing it back
updated with successful writes and ignoring write errors? In other words,
is this the expected behavior of .set_mbus_config() to always treat
unsuccessful writes as recoverable errors and never report them to the caller
as long as there is a current configuration available that can passed back?
Thanks,
Janusz
>
> I guess this is pretty regular behaviour, although I missed it in the
> previous version, so it might be worth adding an additional line to
> the documentation.
>
> >
> > Moreover, since validity of the pad argument is expected to be verified, I
> > think this should be handled by the media infrastructure layer with the
> > drivers/media/v4l2-core/v4l2-subdev.c:check_pad() helper called from a
> > .set_mbus_config() wrapper added to v4l2_subdev_call_pad_wrappers, freeing
> > drivers from reimplementing it.
> >
>
> Good point, and indeed my bad as I thought v4l2_subdev_call() would
> already do that by default, but looking at the actual implementation a
> wrapper might be a good idea indeed.
>
> Patches on top ?
>
> Thanks
> j
>
> > Thanks,
> > Janusz
> >
> > > */
> > > struct v4l2_subdev_pad_ops {
> > > int (*init_cfg)(struct v4l2_subdev *sd,
> > > @@ -710,6 +733,10 @@ struct v4l2_subdev_pad_ops {
> > > struct v4l2_mbus_frame_desc *fd);
> > > int (*set_frame_desc)(struct v4l2_subdev *sd, unsigned int pad,
> > > struct v4l2_mbus_frame_desc *fd);
> > > + int (*get_mbus_config)(struct v4l2_subdev *sd, unsigned int pad,
> > > + struct v4l2_mbus_config *config);
> > > + int (*set_mbus_config)(struct v4l2_subdev *sd, unsigned int pad,
> > > + struct v4l2_mbus_config *config);
> > > };
> > >
> > > /**
> > >
> >
> >
> >
> >
>
next prev parent reply other threads:[~2020-07-17 23:23 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-16 14:27 [PATCH v7 00/10] v4l2-subdev: Introduce [g|s]et_mbus_format pad op Jacopo Mondi
2020-07-16 14:27 ` [PATCH v7 01/10] media: v4l2-subdev: Introduce [get|set]_mbus_config pad ops Jacopo Mondi
2020-07-16 22:15 ` Janusz Krzysztofik
2020-07-17 7:20 ` Jacopo Mondi
2020-07-17 7:57 ` Hans Verkuil
2020-07-17 23:23 ` Janusz Krzysztofik [this message]
2020-07-20 15:56 ` Jacopo Mondi
2020-07-20 19:04 ` Janusz Krzysztofik
2020-07-21 7:27 ` Jacopo Mondi
2020-07-21 7:28 ` Hans Verkuil
2020-07-16 14:27 ` [PATCH v7 02/10] media: i2c: Use the new get_mbus_config pad op Jacopo Mondi
2020-07-16 14:27 ` [PATCH v7 03/10] media: i2c: ov6650: Use new [get|set]_mbus_config ops Jacopo Mondi
2020-07-16 14:27 ` [PATCH v7 04/10] media: pxa_camera: Use the new set_mbus_config op Jacopo Mondi
2020-07-16 14:27 ` [PATCH v7 05/10] media: v4l2-subdev: Remove [s|g]_mbus_config video ops Jacopo Mondi
2020-07-16 14:27 ` [PATCH v7 06/10] media: v4l2- mediabus: Add usage note for V4L2_MBUS_* Jacopo Mondi
2020-07-16 14:27 ` [PATCH v7 07/10] staging: media: imx: Update TODO entry Jacopo Mondi
2020-07-16 14:27 ` [PATCH v7 08/10] media: i2c: adv748x: Adjust TXA data lanes number Jacopo Mondi
2020-07-16 14:27 ` [PATCH v7 09/10] media: i2c: adv748x: Implement get_mbus_config Jacopo Mondi
2020-07-16 14:27 ` [PATCH v7 10/10] media: rcar-csi2: Negotiate data lanes number Jacopo Mondi
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=22470298.ouqheUzb2q@z50 \
--to=jmkrzyszt@gmail.com \
--cc=dave.stevenson@raspberrypi.com \
--cc=hverkuil-cisco@xs4all.nl \
--cc=hyun.kwon@xilinx.com \
--cc=jacopo+renesas@jmondi.org \
--cc=jacopo@jmondi.org \
--cc=kieran.bingham@ideasonboard.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-media@vger.kernel.org \
--cc=linux-renesas-soc@vger.kernel.org \
--cc=mchehab@kernel.org \
--cc=niklas.soderlund+renesas@ragnatech.se \
--cc=robert.jarzmik@free.fr \
--cc=sakari.ailus@linux.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 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.