[PATCH 05/14] media: add a V4L2 OF parser

Laurent Pinchart laurent.pinchart at ideasonboard.com
Thu Oct 11 09:51:09 EST 2012


On Wednesday 10 October 2012 10:50:20 Stephen Warren wrote:
> On 10/10/2012 07:18 AM, Laurent Pinchart wrote:
> > On Monday 08 October 2012 17:15:53 Guennadi Liakhovetski wrote:
> ...
> 
> >> 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.
> 
> I don't believe there's a generic API for this (although perhaps there
> could be), but it can be implemented quite easily.
>
> For example, on Tegra, the SMMU needs to flip a bit in the AHB register
> space in order to enable itself. The SMMU DT node contains a phandle
> that points at the AHB DT node. The SMMU driver parses the phandle and
> passes the DT node pointer to the AHB driver. The AHB driver looks up
> the struct device that was instantiated for that node. See
> drivers/amba/tegra-ahb.c:tegra_ahb_enable_smmu(). There are a few other
> cases of similar code in the kernel, although I can't remember the others!

That's a very naive approach, but what about storing the struct device in 
struct device_node when the device is instantiated ? It's so simple that 
there's probably a good reason why that hasn't been implemented though.

-- 
Regards,

Laurent Pinchart



More information about the devicetree-discuss mailing list