From: Grant Likely <grant.likely@linaro.org>
To: Philipp Zabel <philipp.zabel@gmail.com>
Cc: Philipp Zabel <p.zabel@pengutronix.de>,
Russell King - ARM Linux <linux@arm.linux.org.uk>,
Mauro Carvalho Chehab <m.chehab@samsung.com>,
Rob Herring <robh+dt@kernel.org>,
Sylwester Nawrocki <s.nawrocki@samsung.com>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Tomi Valkeinen <tomi.valkeinen@ti.com>,
Kyungmin Park <kyungmin.park@samsung.com>,
LKML <linux-kernel@vger.kernel.org>,
linux-media@vger.kernel.org, devicetree@vger.kernel.org,
Guennadi Liakhovetski <g.liakhovetski@gmx.de>
Subject: Re: [PATCH v4 1/3] [media] of: move graph helpers from drivers/media/v4l2-core to drivers/of
Date: Thu, 20 Mar 2014 22:33:02 +0000 [thread overview]
Message-ID: <20140320223302.490D6C412EA@trevor.secretlab.ca> (raw)
In-Reply-To: <CA+gwMcfgKre8S4KHPvTVuAuz672aehGrN1UfFpwKAueTAcrMZQ@mail.gmail.com>
On Sat, 8 Mar 2014 13:07:23 +0100, Philipp Zabel <philipp.zabel@gmail.com> wrote:
> Hi Grant,
>
> On Fri, Mar 7, 2014 at 6:18 PM, Grant Likely <grant.likely@linaro.org> wrote:
> > On Wed, 26 Feb 2014 16:24:57 +0100, Philipp Zabel <p.zabel@pengutronix.de> wrote:
> >> The 'ports' node is optional. It is only needed if the parent node has
> >> its own #address-cells and #size-cells properties. If the ports are
> >> direct children of the device node, there might be other nodes than
> >> ports:
> >>
> >> device {
> >> #address-cells = <1>;
> >> #size-cells = <0>;
> >>
> >> port@0 {
> >> endpoint { ... };
> >> };
> >> port@1 {
> >> endpoint { ... };
> >> };
> >>
> >> some-other-child { ... };
> >> };
> >>
> >> device {
> >> #address-cells = <x>;
> >> #size-cells = <y>;
> >>
> >> ports {
> >> #address-cells = <1>;
> >> #size-cells = <0>;
> >>
> >> port@0 {
> >> endpoint { ... };
> >> };
> >> port@1 {
> >> endpoint { ... };
> >> };
> >> };
> >>
> >> some-other-child { ... };
> >> };
> >
> > From a pattern perspective I have no problem with that.... From an
> > individual driver binding perspective that is just dumb! It's fine for
> > the ports node to be optional, but an individual driver using the
> > binding should be explicit about which it will accept. Please use either
> > a flag or a separate wrapper so that the driver can select the
> > behaviour.
>
> If the generic binding exists in both forms, most drivers should be
> able to cope with both. Maybe it should be mentioned in the bindings
> that the short form without ports node should be used where possible
> (i.e. for devices that don't already have #address,size-cells != 1,0).
I would rephrase that: (ie. for devices that have other child nodes that
aren't ports.) It isn't about the #address/size-cells values. It is
about how the driver interprets child nodes.
>
> Having a separate wrapper to enforce the ports node for devices that
> need it might be useful.
Or the other way around. Make the core function only handle an explicit
location and use a v4l2 wrapper to preserve the current behaviour. That
will encourage stricter usage.
> >> The helper should find the two endpoints in both cases.
> >> Tomi suggests an even more compact form for devices with just one port:
> >>
> >> device {
> >> endpoint { ... };
> >>
> >> some-other-child { ... };
> >> };
> >
> > That's fine. In that case the driver would specifically require the
> > endpoint to be that one node.... although the above looks a little weird
> > to me. I would recommend that if there are other non-port child nodes
> > then the ports should still be encapsulated by a ports node. The device
> > binding should not be ambiguous about which nodes are ports.
>
> Sylwester suggested as an alternative, if I understood correctly, to
> drop the endpoint node and instead keep the port:
>
> device-a {
> implicit_output_ep: port {
> remote-endpoint = <&explicit_input_ep>;
> };
> };
>
> device-b {
> port {
> explicit_input_ep: endpoint {
> remote-endpoint = <&implicit_output_ep>;
> };
> };
> };
>
> This would have the advantage to reduce verbosity for devices with multiple
> ports that are only connected via one endport each, and you'd always have
> the connected ports in the device tree as 'port' nodes.
It sounds like that is a closer description of the hardware, so I agree.
>
> >> > It seems that this function is merely a helper to get all grandchildren
> >> > of a node (with some very minor constraints). That could be generalized
> >> > and simplified. If the function takes the "ports" node as an argument
> >> > instead of the parent, then there is a greater likelyhood that other
> >> > code can make use of it...
> >> >
> >> > Thinking further. I think the semantics of this whole feature basically
> >> > boil down to this:
> >> >
> >> > #define for_each_grandchild_of_node(parent, child, grandchild) \
> >> > for_each_child_of_node(parent, child) \
> >> > for_each_child_of_node(child, grandchild)
> >> >
> >> > Correct? Or in this specific case:
> >> >
> >> > parent = of_get_child_by_name(np, "ports")
> >> > for_each_grandchild_of_node(parent, child, grandchild) {
> >> > ...
> >> > }
> >>
> >> Hmm, that would indeed be a bit more generic, but it doesn't handle the
> >> optional 'ports' subnode and doesn't allow for other child nodes in the
> >> device node.
> >
> > See above. The no-ports-node version could be the
> > for_each_grandchild_of_node() block, and the yes-ports-node version
> > could be a wrapper around that.
>
> For the yes-ports-node version I see no problem, but without the ports node,
> for_each_grandchild_of_node would also collect the children of non-port
> child nodes.
> The port and endpoint nodes in this binding are identified by their name,
> so maybe adding of_get_next_child_by_name() /
> for_each_named_child_of_node() could be helpful here.
Generally I would avoid mixing child nodes of different purposes. If you
are in that situation, the recommendation should be to use a ports node.
If there are any current users for which that doesn't work, only then
would I do the child_by_name approach.
g.
next prev parent reply other threads:[~2014-03-20 22:33 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-02-25 14:58 [PATCH v4 0/3] Move device tree graph parsing helpers " Philipp Zabel
[not found] ` < 1393340304-19005-4-git-send-email-p.zabel@pengutronix.de>
[not found] ` < 20140226113729.A9D5AC40A89@trevor.secretlab.ca>
[not found] ` < 1393428297.3248.92.camel@paszta.hi.pengutronix.de>
[not found] ` <20140307171804. EF245C40A32@trevor.secretlab.ca>
[not found] ` < 1393340304-19005-2-git-send-email-p.zabel@pengutronix.de>
[not found] ` <20140226113729. A9D5AC40A89@trevor.secretlab.ca>
2014-02-25 14:58 ` [PATCH v4 1/3] [media] of: move graph helpers from drivers/media/v4l2-core " Philipp Zabel
2014-02-26 11:37 ` Grant Likely
2014-02-26 15:24 ` Philipp Zabel
2014-03-07 17:18 ` Grant Likely
2014-03-08 10:46 ` Tomi Valkeinen
2014-03-08 12:23 ` Grant Likely
2014-03-08 15:50 ` Laurent Pinchart
2014-03-20 22:23 ` Grant Likely
2014-03-20 22:32 ` Laurent Pinchart
2014-03-21 13:37 ` Tomi Valkeinen
2014-03-21 14:10 ` Sylwester Nawrocki
2014-03-21 14:13 ` Laurent Pinchart
2014-03-21 14:22 ` Tomi Valkeinen
2014-03-21 14:30 ` Laurent Pinchart
2014-03-10 6:34 ` Tomi Valkeinen
2014-03-20 22:26 ` Grant Likely
2014-03-08 12:07 ` Philipp Zabel
2014-03-08 15:54 ` Laurent Pinchart
2014-03-10 6:00 ` Tomi Valkeinen
2014-03-10 13:57 ` Laurent Pinchart
2014-03-10 8:58 ` Andrzej Hajda
2014-03-10 9:29 ` Tomi Valkeinen
2014-03-10 11:42 ` Laurent Pinchart
2014-03-11 13:55 ` Andrzej Hajda
2014-03-20 22:33 ` Grant Likely [this message]
2014-02-25 14:58 ` [PATCH v4 2/3] [media] of: move common endpoint parsing " Philipp Zabel
2014-02-25 14:58 ` [PATCH v4 3/3] Documentation: of: Document graph bindings Philipp Zabel
2014-02-26 13:14 ` Tomi Valkeinen
2014-02-26 14:57 ` Philipp Zabel
2014-02-26 14:50 ` Tomi Valkeinen
2014-02-26 15:47 ` Philipp Zabel
2014-02-27 8:08 ` Tomi Valkeinen
2014-02-27 10:52 ` Philipp Zabel
2014-02-27 10:41 ` Tomi Valkeinen
2014-03-07 18:11 ` Grant Likely
2014-03-08 9:35 ` Tomi Valkeinen
2014-03-08 12:25 ` Grant Likely
2014-03-08 15:43 ` Laurent Pinchart
2014-03-10 6:53 ` Tomi Valkeinen
2014-03-11 13:47 ` Sylwester Nawrocki
2014-03-07 17:20 ` Grant Likely
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=20140320223302.490D6C412EA@trevor.secretlab.ca \
--to=grant.likely@linaro.org \
--cc=devicetree@vger.kernel.org \
--cc=g.liakhovetski@gmx.de \
--cc=kyungmin.park@samsung.com \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linux@arm.linux.org.uk \
--cc=m.chehab@samsung.com \
--cc=p.zabel@pengutronix.de \
--cc=philipp.zabel@gmail.com \
--cc=robh+dt@kernel.org \
--cc=s.nawrocki@samsung.com \
--cc=tomi.valkeinen@ti.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
all inboxes | Powered by JetHome®