From: laurent.pinchart@ideasonboard.com (Laurent Pinchart)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH RFC 26/46] drivers/base: provide an infrastructure for componentised subsystems
Date: Wed, 19 Mar 2014 18:22:14 +0100 [thread overview]
Message-ID: <2098368.XZDkvYocrm@avalon> (raw)
In-Reply-To: <16403654.Dg5ZqMop7H@avalon>
Hi Russell,
(CC'ing Philipp Zabel who might be able to provide feedback as a user of the
component framework)
Could you please have a look at the questions below and provide an answer when
you'll have time ? I'd like to bridge the gap between the component and the
V4L2 asynchronous registration implementations.
On Friday 07 March 2014 00:24:33 Laurent Pinchart wrote:
> On Wednesday 26 February 2014 22:19:39 Russell King - ARM Linux wrote:
> > On Wed, Feb 26, 2014 at 10:00:25PM +0100, Guennadi Liakhovetski wrote:
> > > Hi Russell
> > >
> > > (I suspect this my email will be rejected by ALKML too like other my
> > > recent emails, but at least other MLs will pick it up and individual CCs
> > > too, so, if replying, maybe it would be good to keep my entire reply,
> > > all the more that it's going to be very short)
> > >
> > > On Thu, 2 Jan 2014, Russell King wrote:
> > > > Subsystems such as ALSA, DRM and others require a single card-level
> > > > device structure to represent a subsystem. However, firmware tends to
> > > > describe the individual devices and the connections between them.
> > > >
> > > > Therefore, we need a way to gather up the individual component devices
> > > > together, and indicate when we have all the component devices.
> > > >
> > > > We do this in DT by providing a "superdevice" node which specifies
> > > >
> > > > the components, eg:
> > > > imx-drm {
> > > > compatible = "fsl,drm";
> > > > crtcs = <&ipu1>;
> > > > connectors = <&hdmi>;
> > > > };
> > >
> > > It is a pity linux-media wasn't CC'ed and apparently V4L developers
> > > didn't notice this and other related patches in a "clean up" series, and
> > > now this patch is already in the mainline. But at least I'd like to ask
> > > whether the bindings, defined in
> > > Documentation/devicetree/bindings/media/video-interfaces.txt and
> > > implemented in drivers/media/v4l2-core/v4l2-of.c have been considered
> > > for this job, and - if so - why have they been found unsuitable?
> > > Wouldn't it have been better to use and - if needed - extend them to
> > > cover any deficiencies? Even though the implementation is currently
> > > located under drivers/media/v4l2-code/ it's pretty generic and should be
> > > easily transferable to a more generic location.
> >
> > The component helpers have nothing to do with DT apart from solving
> > the problem of how to deal with subsystems which expect a single device,
> > but we have a group of devices and their individual drivers to cope with.
> > Subsystems like DRM and ALSA.
>
> (and V4L2)
>
> Point duly taken. First of all I want to mention that your proposal is
> greatly appreciated. This is a problem that crosses subsystem boundaries,
> and should thus be addressed centrally.
>
> However, we (as in the V4L2 community, and me personally) would have
> appreciated to be CC'ed on the proposal. As you might know we already had a
> solution for this problem, albeit V4L2-specific, in drivers/media/v4l2-
> core/v4l2-async.c. Whether or not this solution should have been made
> generic instead of coming up with a new separate implementation would of
> course have been debatable, but the most important point would have been to
> make sure that v4l2-async could easily be implemented on top of the common
> component architecture.
>
> The topic is particularly hot given that a similar solution was also
> proposed as part of the now defunct (or at least hibernating) common
> display framework. If I had replied to this mail thread without sleeping on
> it first I might not have known better and have got half-paranoid,
> wondereding whether there had been a deliberate attempt to fast-track this
> API before the V4L2 developers noticed. To be perfectly clear, there is
> *NO* implicit or explicit such accusation here, as I know better.
>
> Let's all take this as a positive opportunity to cooperate more closely,
> media devices still need a huge effort to be cleanly supported on modern
> hardware, and we'll need all the development power we can get.
>
> Accordingly, I would like to comment on the component API, despite the fact
> that it has been merged in mainline already. The first thing that I believe
> is missing is documentation. Do you have any pending patch for that, either
> as kerneldoc or as a text file for Documentation/ ? As I've read the code
> to understand it I might have missed so design goals, so please bear with
> the stupid questions that may follow.
>
> I'll first provide a brief comparison of the two models to make the rest of
> the comments easier to understand.
>
> v4l2-async calls the component master object v4l2_async_notifier. The base
> component child object is a v4l2_subdev instance instead of being a plain
> device. v4l2_subdev instances are stored in v4l2-async lists similarly to
> how the component framework stores objects, except that the list head is
> directly embedded inside the v4l2_subdev structure instead of being part of
> a separate structure allocated by the framework.
>
> The notifier has three callback functions, bound, complete and unbind. The
> bound function is called when one component has been bound to the master.
> Similarly the unbind function is called when one component is about to be
> unbound from the master. The complete function is called when all components
> have been bound, and is thus equivalent to the bind function of the
> component framework.
>
> Notifiers are registered along with a list of match entries. A match entry
> is roughly equivalent to the compare function passed to
> component_master_add_child, except that it includes built-in support for
> matching on an OF node, dev_name or I2C bus number and child address.
>
> Whenever a subdev (component child) is registered with
> v4l2_async_register_subdev (equivalent to component_add), the list of
> notifiers (masters) is walked and their match entries are processed. If a
> matching entry is found the subdev is bound to the notifier immediately,
> otherwise it is added to a list of unbound subdevices (component_list).
> Whenever a notifier (component master) is registered with
> v4l2_async_notifier_register (component_master_add) the list of unbound
> subdevs is walked and every match entry of the notifier is tested. If a
> matching entry is found the subdev is bound to the notifier.
>
> I've seen a couple of core differences in concept between your component
> model and the v4l2-async model:
>
> - The component framework uses private master and component structures.
> Wouldn't it simplify the code from a memory management point of view to
> expose the master structure (which would then be embedded in
> driver-specific structures) and the component structure (which would be
> embedded in struct device) ? The latter would be slightly more intrusive
> from a struct device point of view, so I don't have a strong opinion there
> yet, exposing the master structure only might be better.
>
> - The component framework requires the master to provide an add_components
> operation that will call the component_master_add_child function for every
> component it needs, with a compare function. The add child function is
> called when the master is registered, and then for every component added to
> the system. I'm not sure to understand the design decisions behind this,
> but these two levels of indirection appear pretty complex and confusing.
> Wouldn't it be simpler to pass an array of match entries to the master
> registration function instead and remove the add_components operation ? A
> match entry would basically be a structure with a compare function and a
> compare_data pointer.
>
> We could also extend the match entry with explicit support for OF node and
> I2C bus number + address matching as those are the most common cases, or at
> least provide a couple of standard compare functions for those cases.
>
> - The component framework doesn't provide partial bind support. Children are
> bound to the master only when all children are available. This makes it
> impossible in practice to implement v4l2-async on top of the component
> framework. What would you think about adding optional partial bind support
> ? The master operations would then have partial bind, complete bind,
> partial unbind and complete unbind functions. Drivers that only need full
> bind support could set the partial bind and unbind functions to NULL.
>
> > It is completely agnostic to whether you're using platform data, DT or
> > even ACPI - this code could *not* care less. None of that comes anywhere
> > near what this patch does. It merely provides a way to collect up
> > individual devices from co-operating drivers, and control their binding
> > such that a subsystem like DRM or ALSA can be presented with a "card"
> > level view of the hardware rather than a multi-device medusa with all
> > the buggy, racy, crap fsckage that people come up to make that kind of
> > thing work.
> >
> > Now, as for the binding above, first, what does "eg" mean... and
> > secondly, how would a binding which refers to crtcs and connectors
> > have anything to do with ALSA? Clearly this isn't an example of a
> > binding for an ALSA use, which was talked about in the very first
> > line of the above commit commentry. So it's quite clear that what is
> > given there is an example of how it /could/ be used.
> >
> > I suppose I could have instead turned imx-drm into a completely unusable
> > mess by not coming up with some kind of binding, and instead submitted
> > a whole pile of completely untested code. Alternatively, I could've
> > used the OF binding as you're suggesting, but that would mean radically
> > changing the /existing/ bindings for the IPU as a whole - something
> > which others are better suited at as they have a /much/ better
> > understanding of the complexities of this hardware than I.
> >
> > So, what I have done is implemented - for a driver in staging which is
> > still subject to ongoing development and non-stable DT bindings -
> > something which allows forward progress with a *minimum* of disruption
> > to the existing DT bindings for everyone, while still allowing forward
> > progress.
> >
> > Better bindings for imx-drm are currently being worked on. Philipp
> > Zabel of Pengutronix is currently looking at it, and has posted many
> > RFC patches on this very subject, including moving the V4L2 OF helpers
> > to a more suitable location. OF people have been involved in that
> > discussion over the preceding weeks, and there's a working implementation
> > of imx-drm using these helpers from v4l2.
> >
> > I'm finding people who are working in the same area and trying to get
> > everyone talking to each other so that we /do/ end up with a set of
> > bindings for the display stuff which are suitable for everyone. Tomi
> > from TI has already expressed his input to this ongoing discussion.
> >
> > You're welcome to get involved in those discussions too.
> >
> > I hope this makes it clear, and clears up the confusion.
> >
> > Thanks.
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2014-03-19 17:22 UTC|newest]
Thread overview: 105+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-01-02 21:25 [PATCH RFC 00/46] Preview of imx-drm cleanup series Russell King - ARM Linux
2014-01-02 21:25 ` [PATCH RFC 01/46] imx-drm: imx-drm-core: use the crtc drm device for vblank Russell King
2014-01-02 21:25 ` [PATCH RFC 02/46] imx-drm: imx-drm-core: avoid going the long route round for drm_device Russell King
2014-01-02 21:26 ` [PATCH RFC 03/46] imx-drm: imx-drm-core: merge imx_drm_crtc_register() into imx_drm_add_crtc() Russell King
2014-01-02 21:26 ` [PATCH RFC 04/46] imx-drm: ipu-v3: more inteligent DI clock selection Russell King
2014-01-02 21:26 ` [PATCH RFC 05/46] imx-drm: ipu-v3: don't use clk_round_rate() before clk_set_rate() Russell King
2014-01-02 21:26 ` [PATCH RFC 06/46] imx-drm: ipu-v3: more clocking fixes Russell King
2014-01-02 21:26 ` [PATCH RFC 08/46] imx-drm: add imx6 DT configuration for HDMI Russell King
2014-01-02 21:26 ` [PATCH RFC 09/46] imx-drm: update and fix imx6 DT descriptions for v3 HDMI driver Russell King
2014-01-02 21:26 ` [PATCH RFC 10/46] imx-drm: imx-hdmi: fix PLL lock wait Russell King
2014-01-02 21:26 ` [PATCH RFC 11/46] imx-drm: imx-hdmi: fix pixel clock Russell King
2014-01-02 21:26 ` [PATCH RFC 12/46] imx-drm: imx-hdmi: fix wrong comment Russell King
2014-01-02 21:26 ` [PATCH RFC 13/46] imx-drm: imx-hdmi: get rid of pointless fb_reg Russell King
2014-01-02 21:26 ` [PATCH RFC 14/46] imx-drm: imx-hdmi: get rid of clk manipulations in imx_hdmi_fb_registered() Russell King
2014-01-02 21:27 ` [PATCH RFC 15/46] imx-drm: imx-hdmi: minor cleanups Russell King
2014-01-02 21:27 ` [PATCH RFC 16/46] imx-drm: imx-hdmi: convert HDMI clock settings to tabular form Russell King
2014-01-02 21:27 ` [PATCH RFC 17/46] imx-drm: imx-hdmi: clean up setting CSC registers Russell King
2014-01-02 21:27 ` [PATCH RFC 18/46] imx-drm: imx-hdmi: provide register modification function Russell King
2014-01-02 21:27 ` [PATCH RFC 19/46] imx-drm: imx-hdmi: clean up setting of vp_conf Russell King
2014-01-02 21:27 ` [PATCH RFC 20/46] imx-drm: imx-hdmi: fix CTS/N setup at init time Russell King
2014-01-02 21:27 ` [PATCH RFC 21/46] drm: provide a helper for the encoder possible_crtcs mask Russell King
2014-01-03 16:05 ` David Herrmann
2014-01-03 16:13 ` Russell King - ARM Linux
2014-01-03 16:26 ` David Herrmann
2014-01-03 16:29 ` Russell King - ARM Linux
2014-01-02 21:27 ` [PATCH RFC 22/46] imx-drm: imx-drm-core: sanitise imx_drm_encoder_get_mux_id() Russell King
2014-01-02 21:27 ` [PATCH RFC 23/46] imx-drm: imx-drm-core: use array instead of list for CRTCs Russell King
2014-01-02 21:27 ` [PATCH RFC 24/46] imx-drm: provide common connector mode validation function Russell King
2014-01-07 6:38 ` Shawn Guo
2014-01-08 21:25 ` Russell King - ARM Linux
2014-01-02 21:27 ` [PATCH RFC 25/46] imx-drm: simplify setup of panel format Russell King
2014-01-02 21:27 ` [PATCH RFC 26/46] drivers/base: provide an infrastructure for componentised subsystems Russell King
2014-01-03 3:10 ` Greg Kroah-Hartman
2014-01-03 11:00 ` Russell King - ARM Linux
2014-01-03 11:58 ` Rafael J. Wysocki
2014-01-03 12:18 ` Russell King - ARM Linux
2014-01-03 13:24 ` Rafael J. Wysocki
2014-01-03 14:14 ` Russell King - ARM Linux
2014-01-10 14:54 ` Russell King - ARM Linux
2014-01-10 15:07 ` Greg Kroah-Hartman
2014-01-10 15:11 ` Russell King - ARM Linux
2014-01-10 15:35 ` Greg Kroah-Hartman
2014-01-10 16:04 ` Russell King - ARM Linux
2014-01-10 18:30 ` Robert Schwebel
2014-01-10 20:42 ` Greg Kroah-Hartman
2014-01-10 23:23 ` Russell King - ARM Linux
2014-01-11 11:31 ` Robert Schwebel
2014-01-11 11:40 ` Russell King - ARM Linux
2014-01-13 8:34 ` Philipp Zabel
2014-01-07 20:18 ` Sean Paul
2014-01-08 21:36 ` Russell King - ARM Linux
2014-01-08 22:39 ` Sean Paul
2014-01-09 7:40 ` Sascha Hauer
2014-02-07 9:04 ` Daniel Vetter
2014-02-07 9:46 ` Russell King - ARM Linux
2014-02-07 11:57 ` Jean-Francois Moine
2014-02-07 12:28 ` Russell King - ARM Linux
2014-02-26 21:00 ` Guennadi Liakhovetski
2014-02-26 22:19 ` Russell King - ARM Linux
2014-03-06 11:46 ` Guennadi Liakhovetski
2014-03-06 23:24 ` Laurent Pinchart
2014-03-19 17:22 ` Laurent Pinchart [this message]
2014-03-19 17:27 ` Russell King - ARM Linux
2014-03-21 12:34 ` Russell King - ARM Linux
2014-01-02 21:28 ` [PATCH RFC 27/46] imx-drm: convert to componentised device support Russell King
2014-01-03 16:48 ` Philipp Zabel
2014-01-03 17:07 ` Russell King - ARM Linux
2014-01-03 17:26 ` Philipp Zabel
2014-01-03 17:38 ` Russell King - ARM Linux
2014-01-03 19:14 ` Eric Nelson
2014-01-06 17:41 ` Philipp Zabel
2014-01-06 17:46 ` Russell King - ARM Linux
2014-01-07 2:31 ` Eric Nelson
2014-01-07 11:29 ` Philipp Zabel
2014-01-07 15:30 ` Eric Nelson
2014-01-07 16:29 ` Philipp Zabel
2014-01-08 21:40 ` Russell King - ARM Linux
2014-01-07 8:59 ` Shawn Guo
2014-01-08 21:32 ` Russell King - ARM Linux
2014-01-09 15:25 ` Shawn Guo
2014-01-09 15:33 ` Russell King - ARM Linux
2014-01-02 21:28 ` [PATCH RFC 28/46] imx-drm: imx-hdmi: convert to a component device Russell King
2014-01-02 21:28 ` [PATCH RFC 29/46] imx-drm: delay publishing sysfs connector entries Russell King
2014-01-02 21:28 ` [PATCH RFC 30/46] imx-drm: remove separate imx-fbdev Russell King
2014-01-07 6:49 ` Shawn Guo
2014-01-08 21:27 ` Russell King - ARM Linux
2014-01-02 21:28 ` [PATCH RFC 31/46] imx-drm: remove imx-fb.c Russell King
2014-01-02 21:28 ` [PATCH RFC 32/46] imx-drm: use supplied drm_device where possible Russell King
2014-01-02 21:28 ` [PATCH RFC 33/46] imx-drm: imx-drm-core: provide helper function to parse possible crtcs Russell King
2014-01-02 21:28 ` [PATCH RFC 34/46] imx-drm: imx-drm-core: provide common connector and encoder cleanup functions Russell King
2014-01-02 21:28 ` [PATCH RFC 35/46] imx-drm: parallel-display,imx-tve,imx-ldb: initialise drm components directly Russell King
2014-01-02 21:28 ` [PATCH RFC 36/46] imx-drm: imx-hdmi: " Russell King
2014-01-02 21:28 ` [PATCH RFC 37/46] imx-drm: imx-drm-core: remove imx_drm_connector and imx_drm_encoder code Russell King
2014-01-02 21:29 ` [PATCH RFC 38/46] imx-drm: imx-drm-core: get rid of drm_mode_group_init_legacy_group() Russell King
2014-01-02 21:29 ` [PATCH RFC 39/46] imx-drm: imx-drm-core: kill off mutex Russell King
2014-01-02 21:29 ` [PATCH RFC 40/46] imx-drm: imx-drm-core: move allocation of imxdrm device to driver load function Russell King
2014-01-02 21:29 ` [PATCH RFC 41/46] imx-drm: imx-drm-core: various cleanups Russell King
2014-01-02 21:29 ` [PATCH RFC 42/46] imx-drm: imx-drm-core: add core hotplug connector support Russell King
2014-01-02 21:29 ` [PATCH RFC 43/46] imx-drm: imx-hdmi: add hotplug support to HDMI component Russell King
2014-01-02 21:29 ` [PATCH RFC 44/46] imx-drm: dw-hdmi-audio: add audio driver Russell King
2014-01-02 21:29 ` [PATCH RFC 45/46] imx-drm: dw-hdmi-audio: parse ELD from HDMI driver Russell King
2014-01-02 21:29 ` [PATCH RFC 46/46] imx-drm: pass an IPU ID to crtc and core (needs work) Russell King
2014-01-02 21:34 ` [PATCH RFC 07/46] imx-drm: Add mx6 hdmi transmitter support Russell King
2014-01-07 6:33 ` [PATCH RFC 00/46] Preview of imx-drm cleanup series Shawn Guo
2014-01-09 13:17 ` Russell King - ARM Linux
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=2098368.XZDkvYocrm@avalon \
--to=laurent.pinchart@ideasonboard.com \
--cc=linux-arm-kernel@lists.infradead.org \
/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).