Re: [PATCH 2/4] usb: typec: Add typec_port_register_altmodes_from_fwnode()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

> > > +void typec_port_register_altmodes_from_fwnode(struct typec_port *port,
> > > +	const struct typec_altmode_ops *ops, void *drvdata,
> > > +	struct typec_altmode **altmodes, size_t n,
> > > +	struct fwnode_handle *fwnode)
> > > +{
> > > +	struct fwnode_handle *altmodes_node, *child;
> > > +	struct typec_altmode_desc desc;
> > > +	struct typec_altmode *alt;
> > > +	size_t index = 0;
> > > +	u32 svid, vdo;
> > > +	int ret;
> > > +
> > > +	altmodes_node = fwnode_get_named_child_node(fwnode, "altmodes");
> > > +	if (!altmodes_node)
> > > +		return;
> > 
> > Do we need that? Why not just make the sub-nodes describing the
> > alternate modes direct children of the connector node instead of
> > grouping them under a special sub-node?
> 
> If you envision how this will look in e.g. DTS sources then I think
> you will see that this grouping keeps the DTS source code more
> readable. Grouping things together like this is somewhat normal in
> devicetree files. E.g. PMIC's or other regulator providers typical
> have a "regulators" node grouping all their regulators; and also the OF
> graph bindings which are used in the USB-connector node start with a
> "ports" parent / grouping node.
> 
> > If the child node of the connector has device properties "svid" and
> > "vdo" then it is an alt mode that the connector supports, and it can't
> > be anything else, no?
> 
> If you want to get rid of the altmodes parent/grouping node, then the
> usual way to do this would be to add a compatible string to the nodes,
> rather then check for the existence of some properties.

I'm looking at this from ACPI PoW. We do not have compatible string in
ACPI (and in case you are wondering, the _HID PRP0001 is not a
reliable solution for that).

If you wish to group the altmodes under a subnode, then that's fine, but
the "altmodes" node will need to be optional, just like the "ports"
OF-graph node is optional. So we need to be able to support systems
where the alternate mode subnodes are directly under the connector as
well.

thanks,

-- 
heikki



[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux