* Re: [ANN] Meeting minutes of the Cambourne meeting
[not found] ` <201108081750.07000.laurent.pinchart@ideasonboard.com>
@ 2011-08-28 11:28 ` Sylwester Nawrocki
2011-08-29 13:08 ` Laurent Pinchart
0 siblings, 1 reply; 19+ messages in thread
From: Sylwester Nawrocki @ 2011-08-28 11:28 UTC (permalink / raw)
To: Laurent Pinchart
Cc: linux-media, Hans Verkuil, Sakari Ailus, Tuukka Toivonen,
Sylwester Nawrocki, Tomasz Stanislawski, Marek Szyprowski,
devicetree-discuss, Mauro Carvalho Chehab
Hi Laurent,
On 08/08/2011 05:50 PM, Laurent Pinchart wrote:
> Subdevs hierachy, Linux device model
> ------------------------------------
>
> Preliminary conclusions:
>
> - With the move to device tree on ARM (and other platforms), I2C, SPI and
> platform subdevs should be created from board code, not from bridge/host
> drivers.
> - Bus notifiers should be used by bridge/host drivers to wait for all
> required subdevs. V4L2 core should provide helper functions.
> - struct clk should be used to handle clocks provided by hosts to subdevs.
I have been investigating recently possible ways to correct the external clock
handling in Samsung FIMC driver and this led me up to the device tree stuff.
I.e. in order to be able to register any I2C client device there is a need
to enable its master clock at the v4l2 host/bridge driver.
There is an issue that the v4l2_device (host)/v4l2_subdev hierarchy is not
reflected by the linux device tree model, e.g. the host might be a platform
device while the client an I2C client device. Thus a proper device/driver
registration order is not assured by the device driver core from v4l2 POV.
I thought about embedding some API in a struct v4l2_device for the subdevs
to be able to get their master clock(s) as they need it. But this would work
only when a v4l2_device and v4l2_subdev are matched (registered) before I2C
client's probe(), or alternatively subdev_internal_ops::registered() callback,
is called.
Currently such requirement is satisfied when the I2C client/v4l2 subdev
devices are registered from within a v4l2 bridge/host driver initialization
routine. But we may need to stop doing this to adhere to the DT rules.
I guess above you didn't really mean to create subdevs from board code?
The I2C client registration is now done at the I2C bus drivers, using the OF
helpers to retrieve the child devices list from fdt.
I guess we could try to create some sort of replacement for
v4l2_i2c_new_subdev_board() function in linux/drivers/of/* (of_i2c.c ?),
similar to of_i2c_register_devices().
But first we would have somehow to make sure the host drivers are registered
and initialized first. I'm not sure how to do it.
Plus such a new subdev registration method would have to obtain a relevant
struct v4l2_device object reference during the process; which is getting
a bit cumbersome..
Also, if we used a 'struct clk' to handle clocks provided by hosts to subdevs,
could we use any subdev operation callback to pass a reference to such object
from host to subdev? I doubt since the clock may be needed in the subdev before
it is allocated and fully initialized, (i.e. available in the host).
If we have embedded a 'struct clk' pointer into struct v4l2_device, it would
have probably to be an array of clocks and the subdev would have to be able to
find out which clock applies to it.
So I thought about doing something like:
diff --git a/include/media/v4l2-device.h b/include/media/v4l2-device.h
index d61febf..9888f7d 100644
--- a/include/media/v4l2-device.h
+++ b/include/media/v4l2-device.h
@@ -54,6 +54,7 @@ struct v4l2_device {
/* notify callback called by some sub-devices. */
void (*notify)(struct v4l2_subdev *sd,
unsigned int notification, void *arg);
+ const struct clk * (*clock_get)(struct v4l2_subdev *sd);
/* The control handler. May be NULL. */
struct v4l2_ctrl_handler *ctrl_handler;
/* Device's priority state */
This would allow the host to return proper clock for a subdev.
But it won't work unless the initialization order is assured..
>
> Actions:
>
> - Work on a proof-of-concept implementation of the new subdevs registration
> mechanism and send an RFC (whoever needs it first).
> - Work on a proof-of-concept clock handling using struct clk with the OMAP3
> ISP driver (Laurent).
---
Regards,
Sylwester
^ permalink raw reply related [flat|nested] 19+ messages in thread
* Re: [ANN] Meeting minutes of the Cambourne meeting
2011-08-28 11:28 ` [ANN] Meeting minutes of the Cambourne meeting Sylwester Nawrocki
@ 2011-08-29 13:08 ` Laurent Pinchart
2011-08-29 22:20 ` Guennadi Liakhovetski
0 siblings, 1 reply; 19+ messages in thread
From: Laurent Pinchart @ 2011-08-29 13:08 UTC (permalink / raw)
To: Sylwester Nawrocki
Cc: linux-media, Hans Verkuil, Sakari Ailus, Tuukka Toivonen,
Sylwester Nawrocki, Tomasz Stanislawski, Marek Szyprowski,
devicetree-discuss, Mauro Carvalho Chehab
Hi Sylwester,
On Sunday 28 August 2011 13:28:23 Sylwester Nawrocki wrote:
> On 08/08/2011 05:50 PM, Laurent Pinchart wrote:
> > Subdevs hierachy, Linux device model
> > ------------------------------------
> >
> > Preliminary conclusions:
> >
> > - With the move to device tree on ARM (and other platforms), I2C, SPI
> > and
> >
> > platform subdevs should be created from board code, not from
> > bridge/host drivers.
> >
> > - Bus notifiers should be used by bridge/host drivers to wait for all
> >
> > required subdevs. V4L2 core should provide helper functions.
> >
> > - struct clk should be used to handle clocks provided by hosts to
> > subdevs.
>
> I have been investigating recently possible ways to correct the external
> clock handling in Samsung FIMC driver and this led me up to the device
> tree stuff. I.e. in order to be able to register any I2C client device
> there is a need to enable its master clock at the v4l2 host/bridge driver.
To be completely generic, the subdev master clock can come from anywhere, not
only from the V4L2 host/bridge (although that's the usual case).
> There is an issue that the v4l2_device (host)/v4l2_subdev hierarchy is not
> reflected by the linux device tree model, e.g. the host might be a platform
> device while the client an I2C client device. Thus a proper device/driver
> registration order is not assured by the device driver core from v4l2 POV.
>
> I thought about embedding some API in a struct v4l2_device for the subdevs
> to be able to get their master clock(s) as they need it. But this would
> work only when a v4l2_device and v4l2_subdev are matched (registered)
> before I2C client's probe(), or alternatively
> subdev_internal_ops::registered() callback, is called.
>
> Currently such requirement is satisfied when the I2C client/v4l2 subdev
> devices are registered from within a v4l2 bridge/host driver initialization
> routine. But we may need to stop doing this to adhere to the DT rules.
Right, that's my understanding as well.
> I guess above you didn't really mean to create subdevs from board code?
> The I2C client registration is now done at the I2C bus drivers, using the
> OF helpers to retrieve the child devices list from fdt.
I meant registering the I2C board information from board code (for non-DT
platforms) or from the device tree (for DT platforms) instead of V4L2
host/bridge drivers.
> I guess we could try to create some sort of replacement for
> v4l2_i2c_new_subdev_board() function in linux/drivers/of/* (of_i2c.c ?),
> similar to of_i2c_register_devices().
>
> But first we would have somehow to make sure the host drivers are registered
> and initialized first. I'm not sure how to do it.
> Plus such a new subdev registration method would have to obtain a relevant
> struct v4l2_device object reference during the process; which is getting
> a bit cumbersome..
>
> Also, if we used a 'struct clk' to handle clocks provided by hosts to
> subdevs, could we use any subdev operation callback to pass a reference to
> such object from host to subdev? I doubt since the clock may be needed in
> the subdev before it is allocated and fully initialized, (i.e. available
> in the host).
>
> If we have embedded a 'struct clk' pointer into struct v4l2_device, it
> would have probably to be an array of clocks and the subdev would have to
> be able to find out which clock applies to it.
>
> So I thought about doing something like:
>
> diff --git a/include/media/v4l2-device.h b/include/media/v4l2-device.h
> index d61febf..9888f7d 100644
> --- a/include/media/v4l2-device.h
> +++ b/include/media/v4l2-device.h
> @@ -54,6 +54,7 @@ struct v4l2_device {
> /* notify callback called by some sub-devices. */
> void (*notify)(struct v4l2_subdev *sd,
> unsigned int notification, void *arg);
> + const struct clk * (*clock_get)(struct v4l2_subdev *sd);
> /* The control handler. May be NULL. */
> struct v4l2_ctrl_handler *ctrl_handler;
> /* Device's priority state */
>
> This would allow the host to return proper clock for a subdev.
> But it won't work unless the initialization order is assured..
My idea was to let the kernel register all devices based on the DT or board
code. When the V4L2 host/bridge driver gets registered, it will then call a
V4L2 core function with a list of subdevs it needs. The V4L2 core would store
that information and react to bus notifier events to notify the V4L2
host/bridge driver when all subdevs are present. At that point the host/bridge
driver will get hold of all the subdevs and call (probably through the V4L2
core) their .registered operation. That's where the subdevs will get access to
their clock using clk_get().
This is really a rough idea, we will probably run into unexpected issues. I'm
not even sure if this can work out in the end, but I don't really see another
clean solution for now.
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [ANN] Meeting minutes of the Cambourne meeting
2011-08-29 13:08 ` Laurent Pinchart
@ 2011-08-29 22:20 ` Guennadi Liakhovetski
2011-08-29 22:26 ` Laurent Pinchart
[not found] ` <Pine.LNX.4.64.1108300018490.5065-0199iw4Nj15frtckUFj5Ag@public.gmane.org>
0 siblings, 2 replies; 19+ messages in thread
From: Guennadi Liakhovetski @ 2011-08-29 22:20 UTC (permalink / raw)
To: Laurent Pinchart
Cc: Sylwester Nawrocki, linux-media, Hans Verkuil, Sakari Ailus,
Tuukka Toivonen, Sylwester Nawrocki, Tomasz Stanislawski,
Marek Szyprowski, devicetree-discuss, Mauro Carvalho Chehab
On Mon, 29 Aug 2011, Laurent Pinchart wrote:
[snip]
> My idea was to let the kernel register all devices based on the DT or board
> code. When the V4L2 host/bridge driver gets registered, it will then call a
> V4L2 core function with a list of subdevs it needs. The V4L2 core would store
> that information and react to bus notifier events to notify the V4L2
> host/bridge driver when all subdevs are present. At that point the host/bridge
> driver will get hold of all the subdevs and call (probably through the V4L2
> core) their .registered operation. That's where the subdevs will get access to
> their clock using clk_get().
Correct me, if I'm wrong, but this seems to be the case of sensor (and
other i2c-client) drivers having to succeed their probe() methods without
being able to actually access the hardware?
Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [ANN] Meeting minutes of the Cambourne meeting
2011-08-29 22:20 ` Guennadi Liakhovetski
@ 2011-08-29 22:26 ` Laurent Pinchart
[not found] ` <201108300026.05489.laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
[not found] ` <Pine.LNX.4.64.1108300018490.5065-0199iw4Nj15frtckUFj5Ag@public.gmane.org>
1 sibling, 1 reply; 19+ messages in thread
From: Laurent Pinchart @ 2011-08-29 22:26 UTC (permalink / raw)
To: Guennadi Liakhovetski
Cc: Sylwester Nawrocki, linux-media, Hans Verkuil, Sakari Ailus,
Tuukka Toivonen, Sylwester Nawrocki, Tomasz Stanislawski,
Marek Szyprowski, devicetree-discuss, Mauro Carvalho Chehab
Hi Guennadi,
On Tuesday 30 August 2011 00:20:09 Guennadi Liakhovetski wrote:
> On Mon, 29 Aug 2011, Laurent Pinchart wrote:
>
> [snip]
>
> > My idea was to let the kernel register all devices based on the DT or
> > board code. When the V4L2 host/bridge driver gets registered, it will
> > then call a V4L2 core function with a list of subdevs it needs. The V4L2
> > core would store that information and react to bus notifier events to
> > notify the V4L2 host/bridge driver when all subdevs are present. At that
> > point the host/bridge driver will get hold of all the subdevs and call
> > (probably through the V4L2 core) their .registered operation. That's
> > where the subdevs will get access to their clock using clk_get().
>
> Correct me, if I'm wrong, but this seems to be the case of sensor (and
> other i2c-client) drivers having to succeed their probe() methods without
> being able to actually access the hardware?
That's right. I'd love to find a better way :-) Note that this is already the
case for many subdev drivers that probe the hardware in the .registered()
operation instead of the probe() method.
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [ANN] Meeting minutes of the Cambourne meeting
[not found] ` <201108300026.05489.laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
@ 2011-08-29 22:38 ` Guennadi Liakhovetski
0 siblings, 0 replies; 19+ messages in thread
From: Guennadi Liakhovetski @ 2011-08-29 22:38 UTC (permalink / raw)
To: Laurent Pinchart
Cc: Tomasz Stanislawski, Hans Verkuil, Sakari Ailus,
Mauro Carvalho Chehab, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
Sylwester Nawrocki, Tuukka Toivonen, Sylwester Nawrocki,
Marek Szyprowski, linux-media
On Tue, 30 Aug 2011, Laurent Pinchart wrote:
> Hi Guennadi,
>
> On Tuesday 30 August 2011 00:20:09 Guennadi Liakhovetski wrote:
> > On Mon, 29 Aug 2011, Laurent Pinchart wrote:
> >
> > [snip]
> >
> > > My idea was to let the kernel register all devices based on the DT or
> > > board code. When the V4L2 host/bridge driver gets registered, it will
> > > then call a V4L2 core function with a list of subdevs it needs. The V4L2
> > > core would store that information and react to bus notifier events to
> > > notify the V4L2 host/bridge driver when all subdevs are present. At that
> > > point the host/bridge driver will get hold of all the subdevs and call
> > > (probably through the V4L2 core) their .registered operation. That's
> > > where the subdevs will get access to their clock using clk_get().
> >
> > Correct me, if I'm wrong, but this seems to be the case of sensor (and
> > other i2c-client) drivers having to succeed their probe() methods without
> > being able to actually access the hardware?
>
> That's right. I'd love to find a better way :-) Note that this is already the
> case for many subdev drivers that probe the hardware in the .registered()
> operation instead of the probe() method.
Then why do you think it is better, than adding devices from bridge
drivers? Think about hotpluggable devices - drivers create devices all the
time - USB etc. Why cannot we do the same? As a historic reference:
soc-camera used to do this too before - probe without hardware access and
"really-probe" after the host turns on the clock. Then we switched to
registering devices later. I like the present approach better.
Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [ANN] Meeting minutes of the Cambourne meeting
[not found] ` <Pine.LNX.4.64.1108300018490.5065-0199iw4Nj15frtckUFj5Ag@public.gmane.org>
@ 2011-08-30 13:41 ` Mark Brown
2011-08-30 13:56 ` Grant Likely
0 siblings, 1 reply; 19+ messages in thread
From: Mark Brown @ 2011-08-30 13:41 UTC (permalink / raw)
To: Guennadi Liakhovetski
Cc: Tomasz Stanislawski, Sylwester Nawrocki, Sakari Ailus,
Mauro Carvalho Chehab, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
linux-media, Hans Verkuil, Laurent Pinchart, Sylwester Nawrocki,
Marek Szyprowski, Tuukka Toivonen
On Tue, Aug 30, 2011 at 12:20:09AM +0200, Guennadi Liakhovetski wrote:
> On Mon, 29 Aug 2011, Laurent Pinchart wrote:
> > My idea was to let the kernel register all devices based on the DT or board
> > code. When the V4L2 host/bridge driver gets registered, it will then call a
> > V4L2 core function with a list of subdevs it needs. The V4L2 core would store
> > that information and react to bus notifier events to notify the V4L2
> > host/bridge driver when all subdevs are present. At that point the host/bridge
> > driver will get hold of all the subdevs and call (probably through the V4L2
> > core) their .registered operation. That's where the subdevs will get access to
> > their clock using clk_get().
> Correct me, if I'm wrong, but this seems to be the case of sensor (and
> other i2c-client) drivers having to succeed their probe() methods without
> being able to actually access the hardware?
The events should only be generated after the probe() has succeeded so
if the driver talks to the hardware then it can fail probe() if need be.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [ANN] Meeting minutes of the Cambourne meeting
2011-08-30 13:41 ` Mark Brown
@ 2011-08-30 13:56 ` Grant Likely
2011-08-30 14:00 ` Mark Brown
2011-08-30 14:03 ` Guennadi Liakhovetski
0 siblings, 2 replies; 19+ messages in thread
From: Grant Likely @ 2011-08-30 13:56 UTC (permalink / raw)
To: Mark Brown
Cc: Guennadi Liakhovetski, Tomasz Stanislawski, Sylwester Nawrocki,
Sakari Ailus, Mauro Carvalho Chehab, devicetree-discuss,
linux-media, Hans Verkuil, Laurent Pinchart, Sylwester Nawrocki,
Marek Szyprowski, Tuukka Toivonen
On Tue, Aug 30, 2011 at 02:41:48PM +0100, Mark Brown wrote:
> On Tue, Aug 30, 2011 at 12:20:09AM +0200, Guennadi Liakhovetski wrote:
> > On Mon, 29 Aug 2011, Laurent Pinchart wrote:
>
> > > My idea was to let the kernel register all devices based on the DT or board
> > > code. When the V4L2 host/bridge driver gets registered, it will then call a
> > > V4L2 core function with a list of subdevs it needs. The V4L2 core would store
> > > that information and react to bus notifier events to notify the V4L2
> > > host/bridge driver when all subdevs are present. At that point the host/bridge
Sounds a lot like what ASoC is currently doing.
> > > driver will get hold of all the subdevs and call (probably through the V4L2
> > > core) their .registered operation. That's where the subdevs will get access to
> > > their clock using clk_get().
>
> > Correct me, if I'm wrong, but this seems to be the case of sensor (and
> > other i2c-client) drivers having to succeed their probe() methods without
> > being able to actually access the hardware?
It indeed sounds like that, which also concerns me. ASoC and other
subsystems have exactly the same problem where the 'device' is
actually an aggregate of multiple devices attached to different
busses. My personal opinion is that the best way to handle this is to
support deferred probing so that a driver can fail with -EAGAIN if all
the resources that it requires are not available immediately, and have
the driver core retry the probe after other devices have successfully
probed.
I've got prototype code for this, but it needs some more work before
being mainlined.
> The events should only be generated after the probe() has succeeded so
> if the driver talks to the hardware then it can fail probe() if need be.
I'm a bit confused here. Which events are you referring to, and which
.probe call? (the i2c/spi/whatever probe, or the aggregate v4l2 probe?)
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [ANN] Meeting minutes of the Cambourne meeting
2011-08-30 13:56 ` Grant Likely
@ 2011-08-30 14:00 ` Mark Brown
2011-08-30 14:03 ` Guennadi Liakhovetski
1 sibling, 0 replies; 19+ messages in thread
From: Mark Brown @ 2011-08-30 14:00 UTC (permalink / raw)
To: Grant Likely
Cc: Guennadi Liakhovetski, Tomasz Stanislawski, Sylwester Nawrocki,
Sakari Ailus, Mauro Carvalho Chehab, devicetree-discuss,
linux-media, Hans Verkuil, Laurent Pinchart, Sylwester Nawrocki,
Marek Szyprowski, Tuukka Toivonen
On Tue, Aug 30, 2011 at 07:56:09AM -0600, Grant Likely wrote:
> On Tue, Aug 30, 2011 at 02:41:48PM +0100, Mark Brown wrote:
> > The events should only be generated after the probe() has succeeded so
> > if the driver talks to the hardware then it can fail probe() if need be.
> I'm a bit confused here. Which events are you referring to, and which
> .probe call? (the i2c/spi/whatever probe, or the aggregate v4l2 probe?)
There's some driver model core level notifiers that are generated when
things manage to bind (postdating all the ASoC stuff for this IIRC, and
not covering the suspend/resume ordering issues). Actually, thinking
about it they may be per bus.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [ANN] Meeting minutes of the Cambourne meeting
2011-08-30 13:56 ` Grant Likely
2011-08-30 14:00 ` Mark Brown
@ 2011-08-30 14:03 ` Guennadi Liakhovetski
2011-08-30 15:18 ` Grant Likely
1 sibling, 1 reply; 19+ messages in thread
From: Guennadi Liakhovetski @ 2011-08-30 14:03 UTC (permalink / raw)
To: Grant Likely
Cc: Mark Brown, Tomasz Stanislawski, Sylwester Nawrocki, Sakari Ailus,
Mauro Carvalho Chehab, devicetree-discuss, linux-media,
Hans Verkuil, Laurent Pinchart, Sylwester Nawrocki,
Marek Szyprowski, Tuukka Toivonen
Hi Grant
On Tue, 30 Aug 2011, Grant Likely wrote:
> On Tue, Aug 30, 2011 at 02:41:48PM +0100, Mark Brown wrote:
> > On Tue, Aug 30, 2011 at 12:20:09AM +0200, Guennadi Liakhovetski wrote:
> > > On Mon, 29 Aug 2011, Laurent Pinchart wrote:
> >
> > > > My idea was to let the kernel register all devices based on the DT or board
> > > > code. When the V4L2 host/bridge driver gets registered, it will then call a
> > > > V4L2 core function with a list of subdevs it needs. The V4L2 core would store
> > > > that information and react to bus notifier events to notify the V4L2
> > > > host/bridge driver when all subdevs are present. At that point the host/bridge
>
> Sounds a lot like what ASoC is currently doing.
>
> > > > driver will get hold of all the subdevs and call (probably through the V4L2
> > > > core) their .registered operation. That's where the subdevs will get access to
> > > > their clock using clk_get().
> >
> > > Correct me, if I'm wrong, but this seems to be the case of sensor (and
> > > other i2c-client) drivers having to succeed their probe() methods without
> > > being able to actually access the hardware?
>
> It indeed sounds like that, which also concerns me. ASoC and other
> subsystems have exactly the same problem where the 'device' is
> actually an aggregate of multiple devices attached to different
> busses. My personal opinion is that the best way to handle this is to
> support deferred probing
Yes, that's also what I think should be done. But I was thinking about a
slightly different approach - a dependency-based probing. I.e., you should
be able to register a device, depending on another one (parent?), and only
after the latter one has successfully probed, the driver core should be
allowed to probe the child. Of course, devices can depend on multiple
other devices, so, a single parent might not be enough.
Thanks
Guennadi
> so that a driver can fail with -EAGAIN if all
> the resources that it requires are not available immediately, and have
> the driver core retry the probe after other devices have successfully
> probed.
>
> I've got prototype code for this, but it needs some more work before
> being mainlined.
>
> > The events should only be generated after the probe() has succeeded so
> > if the driver talks to the hardware then it can fail probe() if need be.
>
> I'm a bit confused here. Which events are you referring to, and which
> .probe call? (the i2c/spi/whatever probe, or the aggregate v4l2 probe?)
>
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [ANN] Meeting minutes of the Cambourne meeting
2011-08-30 14:03 ` Guennadi Liakhovetski
@ 2011-08-30 15:18 ` Grant Likely
2011-08-30 15:42 ` Laurent Pinchart
0 siblings, 1 reply; 19+ messages in thread
From: Grant Likely @ 2011-08-30 15:18 UTC (permalink / raw)
To: Guennadi Liakhovetski
Cc: Mark Brown, Tomasz Stanislawski, Sylwester Nawrocki, Sakari Ailus,
Mauro Carvalho Chehab, devicetree-discuss, linux-media,
Hans Verkuil, Laurent Pinchart, Sylwester Nawrocki,
Marek Szyprowski, Tuukka Toivonen
On Tue, Aug 30, 2011 at 8:03 AM, Guennadi Liakhovetski
<g.liakhovetski@gmx.de> wrote:
> Hi Grant
>
> On Tue, 30 Aug 2011, Grant Likely wrote:
>
>> On Tue, Aug 30, 2011 at 02:41:48PM +0100, Mark Brown wrote:
>> > On Tue, Aug 30, 2011 at 12:20:09AM +0200, Guennadi Liakhovetski wrote:
>> > > On Mon, 29 Aug 2011, Laurent Pinchart wrote:
>> >
>> > > > My idea was to let the kernel register all devices based on the DT or board
>> > > > code. When the V4L2 host/bridge driver gets registered, it will then call a
>> > > > V4L2 core function with a list of subdevs it needs. The V4L2 core would store
>> > > > that information and react to bus notifier events to notify the V4L2
>> > > > host/bridge driver when all subdevs are present. At that point the host/bridge
>>
>> Sounds a lot like what ASoC is currently doing.
>>
>> > > > driver will get hold of all the subdevs and call (probably through the V4L2
>> > > > core) their .registered operation. That's where the subdevs will get access to
>> > > > their clock using clk_get().
>> >
>> > > Correct me, if I'm wrong, but this seems to be the case of sensor (and
>> > > other i2c-client) drivers having to succeed their probe() methods without
>> > > being able to actually access the hardware?
>>
>> It indeed sounds like that, which also concerns me. ASoC and other
>> subsystems have exactly the same problem where the 'device' is
>> actually an aggregate of multiple devices attached to different
>> busses. My personal opinion is that the best way to handle this is to
>> support deferred probing
>
> Yes, that's also what I think should be done. But I was thinking about a
> slightly different approach - a dependency-based probing. I.e., you should
> be able to register a device, depending on another one (parent?), and only
> after the latter one has successfully probed, the driver core should be
> allowed to probe the child. Of course, devices can depend on multiple
> other devices, so, a single parent might not be enough.
Yes, a dependency system would be lovely... but it gets really complex
in a hurry, especially when faced with heterogeneous device
registrations. A deferral system ends up being really simple to
implement and probably work just as well.
g.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [ANN] Meeting minutes of the Cambourne meeting
2011-08-30 15:18 ` Grant Likely
@ 2011-08-30 15:42 ` Laurent Pinchart
2011-08-30 15:46 ` Mark Brown
2011-08-30 15:59 ` Guennadi Liakhovetski
0 siblings, 2 replies; 19+ messages in thread
From: Laurent Pinchart @ 2011-08-30 15:42 UTC (permalink / raw)
To: Grant Likely
Cc: Guennadi Liakhovetski, Mark Brown, Tomasz Stanislawski,
Sylwester Nawrocki, Sakari Ailus, Mauro Carvalho Chehab,
devicetree-discuss, linux-media, Hans Verkuil, Sylwester Nawrocki,
Marek Szyprowski, Tuukka Toivonen
On Tuesday 30 August 2011 17:18:31 Grant Likely wrote:
> On Tue, Aug 30, 2011 at 8:03 AM, Guennadi Liakhovetski
>
> <g.liakhovetski@gmx.de> wrote:
> > Hi Grant
> >
> > On Tue, 30 Aug 2011, Grant Likely wrote:
> >> On Tue, Aug 30, 2011 at 02:41:48PM +0100, Mark Brown wrote:
> >> > On Tue, Aug 30, 2011 at 12:20:09AM +0200, Guennadi Liakhovetski wrote:
> >> > > On Mon, 29 Aug 2011, Laurent Pinchart wrote:
> >> > > > My idea was to let the kernel register all devices based on the DT
> >> > > > or board code. When the V4L2 host/bridge driver gets registered,
> >> > > > it will then call a V4L2 core function with a list of subdevs it
> >> > > > needs. The V4L2 core would store that information and react to
> >> > > > bus notifier events to notify the V4L2 host/bridge driver when
> >> > > > all subdevs are present. At that point the host/bridge
> >>
> >> Sounds a lot like what ASoC is currently doing.
> >>
> >> > > > driver will get hold of all the subdevs and call (probably through
> >> > > > the V4L2 core) their .registered operation. That's where the
> >> > > > subdevs will get access to their clock using clk_get().
> >> > >
> >> > > Correct me, if I'm wrong, but this seems to be the case of sensor
> >> > > (and other i2c-client) drivers having to succeed their probe()
> >> > > methods without being able to actually access the hardware?
> >>
> >> It indeed sounds like that, which also concerns me. ASoC and other
> >> subsystems have exactly the same problem where the 'device' is
> >> actually an aggregate of multiple devices attached to different
> >> busses. My personal opinion is that the best way to handle this is to
> >> support deferred probing
> >
> > Yes, that's also what I think should be done. But I was thinking about a
> > slightly different approach - a dependency-based probing. I.e., you
> > should be able to register a device, depending on another one (parent?),
> > and only after the latter one has successfully probed, the driver core
> > should be allowed to probe the child. Of course, devices can depend on
> > multiple other devices, so, a single parent might not be enough.
>
> Yes, a dependency system would be lovely... but it gets really complex
> in a hurry, especially when faced with heterogeneous device
> registrations. A deferral system ends up being really simple to
> implement and probably work just as well.
The core issue is that physical device trees, clock trees, power trees and
logical device tress are not always aligned. Instanciating devices based on
the parent-child device relationships will always lead to situations where a
device probe() method will be called with clocks or power sources not
available yet.
A dependency system is tempting but will be very complex to implement
properly, especially when faced with cyclic dependencies. For instance the
OMAP3 ISP driver requires the camera sensor device to be present to proceed,
and the camera sensor requires a clock provided by the OMAP3 ISP. To solve
this we need to probe the OMAP3 ISP first, have it register its clock devices,
and then wait until all sensors become available.
A probe deferral system is probably simpler, but it will have its share of
problems as well. In the above example, if the sensor is probed first, the
driver can return -EAGAIN in the probe() method as the clock isn't available
yet (I'm not sure how to differentiate between "not available yet" and "not
present in the system" though). However, if the OMAP3 ISP is probed first,
returning -EAGAIN in its probe() method won't really help, as we need to
register the clock before waiting for the sensor.
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [ANN] Meeting minutes of the Cambourne meeting
2011-08-30 15:42 ` Laurent Pinchart
@ 2011-08-30 15:46 ` Mark Brown
2011-08-30 20:12 ` Laurent Pinchart
2011-08-30 15:59 ` Guennadi Liakhovetski
1 sibling, 1 reply; 19+ messages in thread
From: Mark Brown @ 2011-08-30 15:46 UTC (permalink / raw)
To: Laurent Pinchart
Cc: Grant Likely, Guennadi Liakhovetski, Tomasz Stanislawski,
Sylwester Nawrocki, Sakari Ailus, Mauro Carvalho Chehab,
devicetree-discuss, linux-media, Hans Verkuil, Sylwester Nawrocki,
Marek Szyprowski, Tuukka Toivonen
On Tue, Aug 30, 2011 at 05:42:55PM +0200, Laurent Pinchart wrote:
> A dependency system is tempting but will be very complex to implement
> properly, especially when faced with cyclic dependencies. For instance the
> OMAP3 ISP driver requires the camera sensor device to be present to proceed,
> and the camera sensor requires a clock provided by the OMAP3 ISP. To solve
> this we need to probe the OMAP3 ISP first, have it register its clock devices,
> and then wait until all sensors become available.
With composite devices like that where the borad has sufficient
interesting stuff on it representing the board itself as a device (this
is what ASoC does).
> A probe deferral system is probably simpler, but it will have its share of
> problems as well. In the above example, if the sensor is probed first, the
> driver can return -EAGAIN in the probe() method as the clock isn't available
> yet (I'm not sure how to differentiate between "not available yet" and "not
> present in the system" though). However, if the OMAP3 ISP is probed first,
> returning -EAGAIN in its probe() method won't really help, as we need to
> register the clock before waiting for the sensor.
Having a device for the camera subsystem as a whole breaks this loop as
the probe of that device triggers the overall system probe.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [ANN] Meeting minutes of the Cambourne meeting
2011-08-30 15:42 ` Laurent Pinchart
2011-08-30 15:46 ` Mark Brown
@ 2011-08-30 15:59 ` Guennadi Liakhovetski
1 sibling, 0 replies; 19+ messages in thread
From: Guennadi Liakhovetski @ 2011-08-30 15:59 UTC (permalink / raw)
To: Laurent Pinchart
Cc: Grant Likely, Mark Brown, Tomasz Stanislawski, Sylwester Nawrocki,
Sakari Ailus, Mauro Carvalho Chehab, devicetree-discuss,
linux-media, Hans Verkuil, Sylwester Nawrocki, Marek Szyprowski,
Tuukka Toivonen
On Tue, 30 Aug 2011, Laurent Pinchart wrote:
> A dependency system is tempting but will be very complex to implement
> properly, especially when faced with cyclic dependencies. For instance the
> OMAP3 ISP driver requires the camera sensor device to be present to proceed,
Switching to a notifier instead of waiting in probe() might be a good idea
(TM).
> and the camera sensor requires a clock provided by the OMAP3 ISP. To solve
> this we need to probe the OMAP3 ISP first, have it register its clock devices,
> and then wait until all sensors become available.
Thanks
Guennadi
---
Guennadi Liakhovetski, Ph.D.
Freelance Open-Source Software Developer
http://www.open-technology.de/
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [ANN] Meeting minutes of the Cambourne meeting
2011-08-30 15:46 ` Mark Brown
@ 2011-08-30 20:12 ` Laurent Pinchart
2011-08-30 20:19 ` Mark Brown
0 siblings, 1 reply; 19+ messages in thread
From: Laurent Pinchart @ 2011-08-30 20:12 UTC (permalink / raw)
To: Mark Brown
Cc: Grant Likely, Guennadi Liakhovetski, Tomasz Stanislawski,
Sylwester Nawrocki, Sakari Ailus, Mauro Carvalho Chehab,
devicetree-discuss, linux-media, Hans Verkuil, Sylwester Nawrocki,
Marek Szyprowski, Tuukka Toivonen
Hi Mark,
On Tuesday 30 August 2011 17:46:42 Mark Brown wrote:
> On Tue, Aug 30, 2011 at 05:42:55PM +0200, Laurent Pinchart wrote:
> > A dependency system is tempting but will be very complex to implement
> > properly, especially when faced with cyclic dependencies. For instance
> > the OMAP3 ISP driver requires the camera sensor device to be present to
> > proceed, and the camera sensor requires a clock provided by the OMAP3
> > ISP. To solve this we need to probe the OMAP3 ISP first, have it
> > register its clock devices, and then wait until all sensors become
> > available.
>
> With composite devices like that where the borad has sufficient
> interesting stuff on it representing the board itself as a device (this
> is what ASoC does).
>
> > A probe deferral system is probably simpler, but it will have its share
> > of problems as well. In the above example, if the sensor is probed
> > first, the driver can return -EAGAIN in the probe() method as the clock
> > isn't available yet (I'm not sure how to differentiate between "not
> > available yet" and "not present in the system" though). However, if the
> > OMAP3 ISP is probed first, returning -EAGAIN in its probe() method won't
> > really help, as we need to register the clock before waiting for the
> > sensor.
>
> Having a device for the camera subsystem as a whole breaks this loop as
> the probe of that device triggers the overall system probe.
The exact same idea crossed my mind after hitting the "Send" button :-)
Would such a device be included in the DT ? My understanding is that the DT
should only describe the hardware.
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [ANN] Meeting minutes of the Cambourne meeting
2011-08-30 20:12 ` Laurent Pinchart
@ 2011-08-30 20:19 ` Mark Brown
[not found] ` <20110830201929.GS2061-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
0 siblings, 1 reply; 19+ messages in thread
From: Mark Brown @ 2011-08-30 20:19 UTC (permalink / raw)
To: Laurent Pinchart
Cc: Grant Likely, Guennadi Liakhovetski, Tomasz Stanislawski,
Sylwester Nawrocki, Sakari Ailus, Mauro Carvalho Chehab,
devicetree-discuss, linux-media, Hans Verkuil, Sylwester Nawrocki,
Marek Szyprowski, Tuukka Toivonen
On Tue, Aug 30, 2011 at 10:12:30PM +0200, Laurent Pinchart wrote:
> Would such a device be included in the DT ? My understanding is that the DT
> should only describe the hardware.
For ASoC they will be, the view is that the schematic for the board is
sufficiently interesting to count as hardware.
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [ANN] Meeting minutes of the Cambourne meeting
[not found] ` <20110830201929.GS2061-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
@ 2011-08-30 20:35 ` Grant Likely
[not found] ` <CACxGe6v0Tm8oz5+vcrdjzk3x0DdvBoyeqEv=aZv=XEA=Ev7WpQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-08-30 20:37 ` Laurent Pinchart
0 siblings, 2 replies; 19+ messages in thread
From: Grant Likely @ 2011-08-30 20:35 UTC (permalink / raw)
To: Mark Brown
Cc: Tomasz Stanislawski, Hans Verkuil, Sakari Ailus,
Mauro Carvalho Chehab, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
Laurent Pinchart, Sylwester Nawrocki, Tuukka Toivonen,
Sylwester Nawrocki, linux-media, Guennadi Liakhovetski,
Marek Szyprowski
[-- Attachment #1.1: Type: text/plain, Size: 550 bytes --]
On Aug 30, 2011 2:19 PM, "Mark Brown" <broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
wrote:
>
> On Tue, Aug 30, 2011 at 10:12:30PM +0200, Laurent Pinchart wrote:
>
> > Would such a device be included in the DT ? My understanding is that the
DT
> > should only describe the hardware.
>
> For ASoC they will be, the view is that the schematic for the board is
> sufficiently interesting to count as hardware.
Yes. Aggregate devices are sufficiently complex that there is a strong
argument for using a node to describe one.
g.
[-- Attachment #1.2: Type: text/html, Size: 747 bytes --]
[-- Attachment #2: Type: text/plain, Size: 192 bytes --]
_______________________________________________
devicetree-discuss mailing list
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
https://lists.ozlabs.org/listinfo/devicetree-discuss
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [ANN] Meeting minutes of the Cambourne meeting
[not found] ` <CACxGe6v0Tm8oz5+vcrdjzk3x0DdvBoyeqEv=aZv=XEA=Ev7WpQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2011-08-30 20:37 ` Grant Likely
0 siblings, 0 replies; 19+ messages in thread
From: Grant Likely @ 2011-08-30 20:37 UTC (permalink / raw)
To: Mark Brown
Cc: Tomasz Stanislawski, Hans Verkuil, Sakari Ailus,
Mauro Carvalho Chehab, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ,
linux-media, Sylwester Nawrocki, Laurent Pinchart,
Sylwester Nawrocki, Marek Szyprowski, Guennadi Liakhovetski,
Tuukka Toivonen
[-- Attachment #1.1: Type: text/plain, Size: 724 bytes --]
On Aug 30, 2011 2:36 PM, "Grant Likely" <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org> wrote:
>
>
> On Aug 30, 2011 2:19 PM, "Mark Brown" <broonie-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
wrote:
> >
> > On Tue, Aug 30, 2011 at 10:12:30PM +0200, Laurent Pinchart wrote:
> >
> > > Would such a device be included in the DT ? My understanding is that
the DT
> > > should only describe the hardware.
> >
> > For ASoC they will be, the view is that the schematic for the board is
> > sufficiently interesting to count as hardware.
>
> Yes. Aggregate devices are sufficiently complex that there is a strong
argument for using a node to describe one.
...and it would still be describing hardware.
g.
[-- Attachment #1.2: Type: text/html, Size: 1070 bytes --]
[-- Attachment #2: Type: text/plain, Size: 192 bytes --]
_______________________________________________
devicetree-discuss mailing list
devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
https://lists.ozlabs.org/listinfo/devicetree-discuss
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [ANN] Meeting minutes of the Cambourne meeting
2011-08-30 20:35 ` Grant Likely
[not found] ` <CACxGe6v0Tm8oz5+vcrdjzk3x0DdvBoyeqEv=aZv=XEA=Ev7WpQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
@ 2011-08-30 20:37 ` Laurent Pinchart
2011-08-30 20:39 ` Mark Brown
1 sibling, 1 reply; 19+ messages in thread
From: Laurent Pinchart @ 2011-08-30 20:37 UTC (permalink / raw)
To: Grant Likely
Cc: Mark Brown, Tuukka Toivonen, Tomasz Stanislawski,
Sylwester Nawrocki, Sakari Ailus, Marek Szyprowski,
Mauro Carvalho Chehab, Sylwester Nawrocki, linux-media,
Guennadi Liakhovetski, Hans Verkuil, devicetree-discuss
On Tuesday 30 August 2011 22:35:59 Grant Likely wrote:
> On Aug 30, 2011 2:19 PM, "Mark Brown" wrote:
> > On Tue, Aug 30, 2011 at 10:12:30PM +0200, Laurent Pinchart wrote:
> > > Would such a device be included in the DT ? My understanding is that
> > > the DT should only describe the hardware.
> >
> > For ASoC they will be, the view is that the schematic for the board is
> > sufficiently interesting to count as hardware.
>
> Yes. Aggregate devices are sufficiently complex that there is a strong
> argument for using a node to describe one.
Is there any document or sample implementation ?
--
Regards,
Laurent Pinchart
^ permalink raw reply [flat|nested] 19+ messages in thread
* Re: [ANN] Meeting minutes of the Cambourne meeting
2011-08-30 20:37 ` Laurent Pinchart
@ 2011-08-30 20:39 ` Mark Brown
0 siblings, 0 replies; 19+ messages in thread
From: Mark Brown @ 2011-08-30 20:39 UTC (permalink / raw)
To: Laurent Pinchart
Cc: Grant Likely, Tomasz Stanislawski, Hans Verkuil, Sakari Ailus,
Mauro Carvalho Chehab, devicetree-discuss, Sylwester Nawrocki,
Tuukka Toivonen, Sylwester Nawrocki, linux-media,
Guennadi Liakhovetski, Marek Szyprowski
On Tue, Aug 30, 2011 at 10:37:21PM +0200, Laurent Pinchart wrote:
> On Tuesday 30 August 2011 22:35:59 Grant Likely wrote:
> > Yes. Aggregate devices are sufficiently complex that there is a strong
> > argument for using a node to describe one.
> Is there any document or sample implementation ?
ASoC. Unfortunately there are several rather annoying problems in the
Linux device model which make this substantially less straightforward
than it might otherwise be, the main ones being waiting for everything
to probe and making sure everything suspends and resumes in the correct
order.
^ permalink raw reply [flat|nested] 19+ messages in thread
end of thread, other threads:[~2011-08-30 20:39 UTC | newest]
Thread overview: 19+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <201107261647.19235.laurent.pinchart@ideasonboard.com>
[not found] ` <201108081750.07000.laurent.pinchart@ideasonboard.com>
2011-08-28 11:28 ` [ANN] Meeting minutes of the Cambourne meeting Sylwester Nawrocki
2011-08-29 13:08 ` Laurent Pinchart
2011-08-29 22:20 ` Guennadi Liakhovetski
2011-08-29 22:26 ` Laurent Pinchart
[not found] ` <201108300026.05489.laurent.pinchart-ryLnwIuWjnjg/C1BVhZhaw@public.gmane.org>
2011-08-29 22:38 ` Guennadi Liakhovetski
[not found] ` <Pine.LNX.4.64.1108300018490.5065-0199iw4Nj15frtckUFj5Ag@public.gmane.org>
2011-08-30 13:41 ` Mark Brown
2011-08-30 13:56 ` Grant Likely
2011-08-30 14:00 ` Mark Brown
2011-08-30 14:03 ` Guennadi Liakhovetski
2011-08-30 15:18 ` Grant Likely
2011-08-30 15:42 ` Laurent Pinchart
2011-08-30 15:46 ` Mark Brown
2011-08-30 20:12 ` Laurent Pinchart
2011-08-30 20:19 ` Mark Brown
[not found] ` <20110830201929.GS2061-yzvPICuk2AATkU/dhu1WVueM+bqZidxxQQ4Iyu8u01E@public.gmane.org>
2011-08-30 20:35 ` Grant Likely
[not found] ` <CACxGe6v0Tm8oz5+vcrdjzk3x0DdvBoyeqEv=aZv=XEA=Ev7WpQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2011-08-30 20:37 ` Grant Likely
2011-08-30 20:37 ` Laurent Pinchart
2011-08-30 20:39 ` Mark Brown
2011-08-30 15:59 ` Guennadi Liakhovetski
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox