All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: ksummit-discuss@lists.linuxfoundation.org,
	Mauro Carvalho Chehab <mchehab@osg.samsung.com>,
	"vegard.nossum@gmail.com" <vegard.nossum@gmail.com>,
	"rafael.j.wysocki" <rafael.j.wysocki@intel.com>,
	Marek Szyprowski <m.szyprowski@samsung.com>,
	Valentin Rothberg <valentinrothberg@gmail.com>
Subject: Re: [Ksummit-discuss] [TECH TOPIC] Addressing complex dependencies and semantics (v2)
Date: Mon, 01 Aug 2016 20:15:56 +0300	[thread overview]
Message-ID: <2222413.KK3dIKDdIg@avalon> (raw)
In-Reply-To: <7d7f1387-f8a2-220d-97d8-6394ac029639@xs4all.nl>

Hi Hans,

On Monday 01 Aug 2016 15:51:03 Hans Verkuil wrote:
> On 08/01/2016 03:38 PM, Laurent Pinchart wrote:
> > On Monday 01 Aug 2016 15:35:31 Hans Verkuil wrote:
> >> On 08/01/2016 03:26 PM, Laurent Pinchart wrote:
> >>> On Monday 01 Aug 2016 15:21:49 Hans Verkuil wrote:
> >>>> On 08/01/2016 03:09 PM, Laurent Pinchart wrote:
> >>>>> On Friday 29 Jul 2016 12:13:03 Mark Brown wrote:
> >>>>>> On Fri, Jul 29, 2016 at 09:45:55AM +0200, Hans Verkuil wrote:
> >>>>>>> My main problem is not so much with deferred probe (esp. for cyclic
> >>>>>>> dependencies it is a simple method of solving this, and simple is
> >>>>>>> good). My main problem is that you can't tell the system that driver
> >>>>>>> A needs to be probed after drivers B, C and D are probed first.
> >>>>>>> 
> >>>>>>> That would allow us to get rid of v4l2-async.c which is a horrible
> >>>>>>> hack.
> >>>>>>> 
> >>>>>>> That code allows a bridge driver to wait until all dependent drivers
> >>>>>>> are probed. This really should be core functionality.
> >>>>>>> 
> >>>>>>> Do other subsystems do something similar like
> >>>>>>> drivers/media/v4l2-core/v4l2-async.c? Does anyone know?
> >>>>>> 
> >>>>>> ASoC does, it has an explicit card driver to join things together and
> >>>>>> that just defers probe until everything it needs is present.  This
> >>>>>> was originally open coded in ASoC but once deferred probe was
> >>>>>> implemented we converted to that.
> >>>>> 
> >>>>> Asynchronous bindings of components, as done in ASoC, DRM and V4L2, is
> >>>>> a problem largely solved (or rather hacked around), but I'm curious to
> >>>>> know how ASoC handles device unbinding (due to device removal or
> >>>>> manual unbinding through sysfs). With asynchronous binding we can more
> >>>>> or less easily wait for all components to be present before creating
> >>>>> circular dependencies, but breaking them to implement unbinding is an
> >>>>> unsolved problem at least in V4L2.
> >>>> 
> >>>> We need to prevent subdevice drivers from being unbound. It's easy
> >>>> enough to do that (set suppress_bind_attrs to true), we just never did
> >>>> that. It's been on my TODO list for ages to make a patch adding that
> >>>> flag...
> >>>> 
> >>>> You can only unbind bridge drivers. Unbinding subdevs is pointless in
> >>>> general and should be prohibited. Perhaps in the future with
> >>>> dynamically reconfigurable video pipelines (FPGA) you want that, but
> >>>> then you need to do a lot of additional work. For everything we have
> >>>> today we should just set suppress_bind_attrs to true.
> >>> 
> >>> If wish reality was so simple :-) In Project Ara our camera modules are
> >>> hot-pluggable, and connect to a CSI-2 receiver on the SoC side.
> >> 
> >> I assume that when a camera module is unplugged the CSI driver is
> >> informed and it will then unregister the camera subdev. So this is
> >> controlled by the CSI-2 driver. What you don't want is someone unbinding
> >> the camera driver without the CSI-2 driver's knowledge. To prevent that
> >> you need to set that flag in the subdev driver.
> > 
> > The CSI-2 receiver is unaware of the modular nature of the system. The
> > camera module unplug event is delivered by the Greybus [0] core directly
> > to the camera module subdev driver.
> 
> 1) Wouldn't it make more sense to inform the CSI-2 receiver about this?

The CSI-2 receiver has no knowledge about modularity, it's a standard SoC 
CSI-2 receiver. A particular Ara device will use a particular SoC, but 
different devices can be based on different SoCs, with different CSI-2 
receivers. One of the design goals was to not have to teach every CSI-2 
receiver about Ara.

> 2) If it goes to the subdev driver anyway, then shouldn't that call the
> parent CSI-2 receiver driver and inform it that the device has been
> unplugged?

So far V4L2 has always assumed that the driver handling the CSI-2 receiver is 
the master/bridge/host driver (I still don't like the name bridge in that 
context, but that's a separate story). This assumption isn't true with Ara 
anymore, the CSI-2 receiver (and the other video blocks downstream, if any) 
are resources the same way that the sensor is a resource. There is a driver 
that can act as a master in the design, but it's not the CSI-2 receiver 
driver.

> It really should be the bridge driver that unbinds any hardware that
> disappeared, and the subdev shouldn't just disappear. The same happens with
> USB devices that are unplugged: the USB bridge driver gets the disconnect
> and there it knows what it should do to gracefully release everything.

It's easier in that case as the driver that receives the disconnection even is 
also the one that has complete view over the device.

> > [0] https://lwn.net/Articles/648400/ (slightly outdated, but the overall
> > architecture is there)

-- 
Regards,

Laurent Pinchart

  reply	other threads:[~2016-08-01 17:15 UTC|newest]

Thread overview: 111+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-27 16:50 [Ksummit-discuss] [TECH TOPIC] Addressing complex dependencies and semantics (v2) Luis R. Rodriguez
2016-07-27 17:26 ` Mark Brown
2016-07-27 17:58   ` Luis R. Rodriguez
2016-07-27 18:03     ` Mark Brown
2016-07-27 19:20       ` Luis R. Rodriguez
2016-07-28  0:54         ` Rafael J. Wysocki
2016-07-28 10:41           ` Laurent Pinchart
2016-07-28 10:54             ` Hans Verkuil
2016-07-28 11:03               ` Laurent Pinchart
2016-07-28 11:46                 ` Jan Kara
2016-07-28 15:16                   ` Mark Brown
2016-07-28 16:00                   ` Laurent Pinchart
2016-08-02  8:32                     ` Jan Kara
2016-08-03 14:17                     ` Alexandre Belloni
2016-07-30  1:59                   ` Steven Rostedt
2016-08-01 13:12                     ` Laurent Pinchart
2016-07-28 20:12                 ` Lars-Peter Clausen
2016-07-28 20:38                   ` Mark Brown
2016-08-01 13:15                   ` Laurent Pinchart
2016-07-28 14:36               ` Rafael J. Wysocki
2016-07-29  7:33             ` Hans Verkuil
2016-08-01 13:03               ` Laurent Pinchart
2016-08-01 13:17                 ` Hans Verkuil
2016-08-04  8:22             ` Jani Nikula
2016-08-04  9:50               ` Greg KH
2016-08-04 10:20                 ` Mark Brown
2016-08-04 10:27                   ` Jani Nikula
2016-08-05  2:59                   ` Rob Herring
2016-08-05  9:01                     ` Arnd Bergmann
2016-08-05 10:54                       ` Greg KH
2016-08-05 11:31                         ` Andrzej Hajda
2016-08-05 11:58                           ` Mark Brown
2016-08-05 13:43                           ` Greg KH
2016-08-05 19:27                         ` Rob Herring
2016-08-09  8:08                 ` Daniel Vetter
2016-08-09  8:17                   ` Greg KH
2016-08-09 12:04                     ` Daniel Vetter
2016-08-04 12:37       ` Geert Uytterhoeven
2016-08-04 15:53         ` Mark Brown
2016-07-28 21:49     ` Lars-Peter Clausen
2016-07-29  3:50       ` Greg KH
2016-07-29  7:45       ` Hans Verkuil
2016-07-29  7:55         ` Lars-Peter Clausen
2016-08-01 13:06           ` Laurent Pinchart
2016-07-29 11:13         ` Mark Brown
2016-08-01 13:09           ` Laurent Pinchart
2016-08-01 13:14             ` Lars-Peter Clausen
2016-08-01 13:19               ` Laurent Pinchart
2016-08-01 13:21             ` Hans Verkuil
2016-08-01 13:26               ` Laurent Pinchart
2016-08-01 13:35                 ` Hans Verkuil
2016-08-01 13:38                   ` Laurent Pinchart
2016-08-01 13:51                     ` Hans Verkuil
2016-08-01 17:15                       ` Laurent Pinchart [this message]
2016-08-01 13:33               ` Lars-Peter Clausen
2016-08-01 13:55                 ` Mauro Carvalho Chehab
2016-08-01 14:41                   ` Lars-Peter Clausen
2016-08-01 14:44                   ` Andrzej Hajda
2016-08-01 14:54                     ` Lars-Peter Clausen
2016-08-01 15:20                       ` Mark Brown
2016-08-01 15:34                       ` Andrzej Hajda
2016-08-01 15:43                         ` Lars-Peter Clausen
2016-08-01 16:18                           ` Andrzej Hajda
2016-08-01 17:06                             ` Mark Brown
2016-08-01 18:21                               ` Lars-Peter Clausen
2016-08-02 11:45                                 ` Andrzej Hajda
2016-08-01 18:33                               ` Andrzej Hajda
2016-08-01 18:48                                 ` Mark Brown
2016-08-01 19:42                                   ` Andrzej Hajda
2016-08-01 20:05                                     ` Lars-Peter Clausen
2016-08-02  8:57                                       ` Takashi Iwai
2016-08-01 17:40                       ` Laurent Pinchart
2016-08-02  7:38                     ` Greg KH
2016-08-01 19:03           ` Luis R. Rodriguez
2016-08-02  0:01             ` Rafael J. Wysocki
2016-08-02  0:56               ` Luis R. Rodriguez
2016-08-02  1:03                 ` Dmitry Torokhov
2016-08-02  8:30                   ` Jiri Kosina
2016-08-02  9:41                 ` Hannes Reinecke
2016-08-02  9:48                   ` Jiri Kosina
2016-08-02 11:50                     ` Takashi Iwai
2016-08-09  9:57             ` Jörg Rödel
2016-08-09 16:08               ` James Bottomley
2016-08-09 16:11                 ` James Bottomley
2016-08-09 16:51                   ` Luis R. Rodriguez
2016-08-09 17:05                     ` David Woodhouse
2016-08-09 17:12                     ` James Bottomley
2016-08-09 16:53                   ` Jörg Rödel
2016-08-09 18:06               ` Luis R. Rodriguez
2016-08-10 15:21                 ` Jörg Rödel
2016-08-10 16:42                   ` Luis R. Rodriguez
2016-08-10 21:37                     ` Jörg Rödel
2016-08-12  7:33               ` Linus Walleij
2016-07-27 18:50 ` Dmitry Torokhov
2016-07-28 10:43 ` Marc Zyngier
2016-07-28 10:51 ` Laurent Pinchart
2016-07-28 23:43   ` Luis R. Rodriguez
2016-08-01 12:44     ` Laurent Pinchart
2016-07-28 11:18 ` Mauro Carvalho Chehab
2016-07-28 11:24   ` Laurent Pinchart
2016-07-28 12:25     ` Mauro Carvalho Chehab
2016-07-28 16:04       ` Laurent Pinchart
2016-07-29  0:00         ` Luis R. Rodriguez
2016-08-01 12:50           ` Laurent Pinchart
2016-08-01 20:32             ` Luis R. Rodriguez
2016-07-29 13:57 ` Andrzej Hajda
2016-09-07 16:40   ` Kevin Hilman
2016-08-01 14:03 ` Marek Szyprowski
2016-11-03 18:43   ` Laurent Pinchart
2016-11-04  6:53     ` Marek Szyprowski
2016-09-08 21:03 ` Frank Rowand

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=2222413.KK3dIKDdIg@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=hverkuil@xs4all.nl \
    --cc=ksummit-discuss@lists.linuxfoundation.org \
    --cc=m.szyprowski@samsung.com \
    --cc=mchehab@osg.samsung.com \
    --cc=rafael.j.wysocki@intel.com \
    --cc=valentinrothberg@gmail.com \
    --cc=vegard.nossum@gmail.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.