linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Hans Verkuil <hverkuil@xs4all.nl>
Cc: Guennadi Liakhovetski <g.liakhovetski@gmx.de>,
	Sylwester Nawrocki <s.nawrocki@samsung.com>,
	Sylwester Nawrocki <sylvester.nawrocki@gmail.com>,
	linux-media@vger.kernel.org, devicetree-discuss@lists.ozlabs.org,
	Magnus Damm <magnus.damm@gmail.com>,
	linux-sh@vger.kernel.org,
	Mark Brown <broonie@opensource.wolfsonmicro.com>,
	Stephen Warren <swarren@wwwdotorg.org>,
	Arnd Bergmann <arnd@arndb.de>,
	Grant Likely <grant.likely@secretlab.ca>
Subject: Re: [PATCH 05/14] media: add a V4L2 OF parser
Date: Wed, 10 Oct 2012 15:22:12 +0200	[thread overview]
Message-ID: <4911109.4UeH6qZopn@avalon> (raw)
In-Reply-To: <201210081741.43546.hverkuil@xs4all.nl>

Hi Hans,

On Monday 08 October 2012 17:41:43 Hans Verkuil wrote:
> On Mon October 8 2012 17:15:53 Guennadi Liakhovetski wrote:
> > On Mon, 8 Oct 2012, Hans Verkuil wrote:
> > > On Mon October 8 2012 16:30:53 Guennadi Liakhovetski wrote:
> > > > On Mon, 8 Oct 2012, Hans Verkuil wrote:

[snip]

> > > > > I wonder, don't we have the necessary code already? V4L2 subdev
> > > > > drivers can have internal_ops with register/unregister ops. These
> > > > > are called by v4l2_device_register_subdev. This happens during the
> > > > > bridge driver's probe.
> > > > > 
> > > > > Suppose the subdev's probe does not actually access the i2c device,
> > > > > but instead defers that to the register callback? The bridge driver
> > > > > will turn on the clock before calling v4l2_device_register_subdev to
> > > > > ensure that the register callback can access the i2c registers. The
> > > > > register callback will do any initialization and can return an
> > > > > error. In case of an error the i2c client is automatically
> > > > > unregistered as well.
> > > > 
> > > > Yes, if v4l2_i2c_new_subdev_board() is used. This has been discussed
> > > > several times before and always what I didn't like in this is, that
> > > > I2C device probe() in this case succeeds without even trying to access
> > > > the hardware. And think about DT. In this case we don't instantiate
> > > > the I2C device, OF code does it for us. What do you do then? If you
> > > > let probe() succeed, then you will have to somehow remember the
> > > > subdevice to later match it against bridges...
> > > 
> > > Yes, but you need that information anyway. The bridge still needs to
> > > call v4l2_device_register_subdev so it needs to know which subdevs are
> > > loaded.
> > 
> > But how do you get the subdev pointer? With the notifier I get it from
> > i2c_get_clientdata(client) and what do you do without it? How do you get
> > to the client?
> > 
> > > And can't it get that from DT as well?
> > 
> > No, I don't think there is a way to get a device pointer from a DT node.
> 
> Not a device pointer, but the i2c bus and i2c address. With that information
> you can get the i2c_client, and with that you can get the subdev pointer.

That could work as well, but it might be easier to keep a mapping from the DT 
node to struct device or struct v4l2_subdev instead. I have no strong opinion 
on this at the moment.

> If there is no way to get that information from the proposed V4L2 DT, then
> it needs to be modified since a bridge driver really needs to know which
> subdevs it has to register with the v4l2_device struct. That information is
> also board specific so it should be part of the DT.
> 
> > > In my view you cannot do a proper initialization unless you have both
> > > the bridge driver and all subdev drivers loaded and instantiated. They
> > > need one another. So I am perfectly fine with letting the probe function
> > > do next to nothing and postponing that until register() is called. I2C
> > > and actual probing to check if it's the right device is a bad idea in
> > > general since you have no idea what a hardware access to an unknown i2c
> > > device will do. There are still some corner cases where that is needed,
> > > but I do not think that that is an issue here.
> > > 
> > > It would simplify things a lot IMHO. Also note that the register() op
> > > will work with any device, not just i2c. That may be a useful property
> > > as well.
> > 
> > And what if the subdevice device is not yet instantiated by OF by the time
> > your bridge driver probes?
> 
> That is where you still need to have a bus notifier mechanism. You have to
> be able to wait until all dependent drivers are loaded/instantiated, or
> alternatively you have to be able to load them explicitly. But this should
> be relatively easy to implement in a generic manner.
> 
> I still think this sucks (excuse my language), but I see no way around it as
> long as there is no explicit probe order one can rely on.

-- 
Regards,

Laurent Pinchart


  parent reply	other threads:[~2012-10-10 13:21 UTC|newest]

Thread overview: 80+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1348754853-28619-1-git-send-email-g.liakhovetski@gmx.de>
2012-10-05 12:32 ` [PATCH 00/14] V4L2 DT support Sylwester Nawrocki
2012-10-05 14:41   ` Guennadi Liakhovetski
     [not found] ` <1348754853-28619-11-git-send-email-g.liakhovetski@gmx.de>
2012-10-05 19:11   ` [PATCH 10/14] media: soc-camera: support OF cameras Sylwester Nawrocki
2012-10-08  8:37     ` Guennadi Liakhovetski
2012-10-08  9:28       ` Sylwester Nawrocki
2013-04-08  9:19   ` Barry Song
2013-04-08 11:21     ` Guennadi Liakhovetski
2013-04-08 11:49       ` Barry Song
     [not found] ` <1348754853-28619-6-git-send-email-g.liakhovetski@gmx.de>
2012-10-01 21:37   ` [PATCH 05/14] media: add a V4L2 OF parser Sylwester Nawrocki
2012-10-02  9:49     ` Guennadi Liakhovetski
2012-10-02 10:13       ` Sylwester Nawrocki
2012-10-02 11:04         ` Guennadi Liakhovetski
2012-10-05 10:41         ` Hans Verkuil
2012-10-05 10:58           ` Guennadi Liakhovetski
2012-10-05 11:23             ` Hans Verkuil
2012-10-05 11:35               ` Guennadi Liakhovetski
2012-10-08 12:23               ` Guennadi Liakhovetski
2012-10-08 13:48                 ` Hans Verkuil
2012-10-08 14:30                   ` Guennadi Liakhovetski
2012-10-08 14:53                     ` Hans Verkuil
2012-10-08 15:15                       ` Guennadi Liakhovetski
2012-10-08 15:41                         ` Hans Verkuil
2012-10-08 15:53                           ` Guennadi Liakhovetski
2012-10-08 16:00                             ` Guennadi Liakhovetski
2012-10-10 13:22                           ` Laurent Pinchart [this message]
2012-10-10 13:18                         ` Laurent Pinchart
2012-10-10 16:50                           ` Stephen Warren
2012-10-10 22:51                             ` Laurent Pinchart
2012-10-11 16:15                               ` Stephen Warren
2012-10-10 13:12                       ` Laurent Pinchart
2012-10-10 12:54                 ` Laurent Pinchart
2012-10-10 13:45                   ` Mauro Carvalho Chehab
2012-10-10 14:48                     ` Laurent Pinchart
2012-10-10 14:57                       ` Mauro Carvalho Chehab
2012-10-10 15:15                         ` Laurent Pinchart
2012-10-11 19:48                 ` Sakari Ailus
2012-10-13  0:16                   ` Guennadi Liakhovetski
2012-10-05 18:30             ` Sylwester Nawrocki
2012-10-05 18:45               ` Mark Brown
2012-10-08  9:40               ` Guennadi Liakhovetski
2012-10-09 10:34                 ` Sylwester Nawrocki
2012-10-09 11:00                   ` Hans Verkuil
2012-10-10 13:25                     ` Laurent Pinchart
2012-10-10 20:23                       ` Sylwester Nawrocki
2012-10-10 20:32                         ` Guennadi Liakhovetski
2012-10-10 21:12                           ` Sylwester Nawrocki
2012-10-10 23:05                           ` Laurent Pinchart
2012-10-10 22:58                         ` Laurent Pinchart
2012-10-08 21:30             ` Laurent Pinchart
2012-10-08 10:03   ` Sylwester Nawrocki
     [not found] ` <1348754853-28619-5-git-send-email-g.liakhovetski@gmx.de>
2012-10-01 20:45   ` [PATCH 04/14] media: add V4L2 DT binding documentation Sylwester Nawrocki
2012-10-02 14:15   ` Rob Herring
2012-10-02 14:33     ` Guennadi Liakhovetski
2012-10-03 20:54       ` Rob Herring
2012-10-05  9:43         ` Guennadi Liakhovetski
2012-10-05 11:31           ` Hans Verkuil
2012-10-05 11:37             ` Guennadi Liakhovetski
2012-10-08 20:00       ` Stephen Warren
2012-10-08 21:00         ` Laurent Pinchart
2012-10-08 21:14           ` Guennadi Liakhovetski
2012-10-09  9:21             ` Hans Verkuil
2012-10-09  9:29               ` Guennadi Liakhovetski
2012-10-05 15:10   ` Sascha Hauer
2012-10-05 15:41     ` Guennadi Liakhovetski
2012-10-05 16:02       ` Sascha Hauer
2012-10-08  7:58         ` Guennadi Liakhovetski
2012-10-10  8:40           ` Sascha Hauer
2012-10-10  8:51             ` Mark Brown
2012-10-10  9:21               ` Sascha Hauer
2012-10-10 10:46                 ` Mark Brown
2012-10-08 20:12   ` Stephen Warren
     [not found] ` <1348754853-28619-8-git-send-email-g.liakhovetski@gmx.de>
2013-04-10 10:38   ` [PATCH 07/14] media: soc-camera: support deferred probing of clients Barry Song
2013-04-10 12:06     ` Guennadi Liakhovetski
2013-04-10 13:53       ` Barry Song
2013-04-10 13:56         ` Mark Brown
2013-04-10 14:00           ` Barry Song
2013-04-10 14:03         ` Guennadi Liakhovetski
2013-04-10 14:30           ` Barry Song
2013-04-10 14:43             ` Guennadi Liakhovetski
2013-04-10 15:02               ` Barry Song

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=4911109.4UeH6qZopn@avalon \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=arnd@arndb.de \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=devicetree-discuss@lists.ozlabs.org \
    --cc=g.liakhovetski@gmx.de \
    --cc=grant.likely@secretlab.ca \
    --cc=hverkuil@xs4all.nl \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-sh@vger.kernel.org \
    --cc=magnus.damm@gmail.com \
    --cc=s.nawrocki@samsung.com \
    --cc=swarren@wwwdotorg.org \
    --cc=sylvester.nawrocki@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 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).