Thread (28 messages) 28 messages, 5 authors, 2021-12-10

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

From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Date: 2020-08-11 14:38:39
Also in: linux-devicetree

Hi,
quoted
quoted
+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.
quoted
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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help