Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

usb: dwc3: drd: Add support for DR detection through extcon

Allow extcon device, found by name, to provide DR status for USB.
This is needed, for example, in case of Intel Merrifield platform,
where the Intel Basin Cove PMIC provides an extcon device to communicate
the detected role.

Note, that the "linux,extcon-name" property name is only for kernel
internal use by X86/ACPI platform code and as such is not documented
in the device tree bindings.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>

authored by

Andy Shevchenko and committed by
Felipe Balbi
268784ba 85383756

+10
+10
drivers/usb/dwc3/drd.c
··· 446 446 struct device *dev = dwc->dev; 447 447 struct device_node *np_phy, *np_conn; 448 448 struct extcon_dev *edev; 449 + const char *name; 449 450 450 451 if (device_property_read_bool(dev, "extcon")) 451 452 return extcon_get_edev_by_phandle(dev, 0); 453 + 454 + /* 455 + * Device tree platforms should get extcon via phandle. 456 + * On ACPI platforms, we get the name from a device property. 457 + * This device property is for kernel internal use only and 458 + * is expected to be set by the glue code. 459 + */ 460 + if (device_property_read_string(dev, "linux,extcon-name", &name) == 0) 461 + return extcon_get_extcon_dev(name); 452 462 453 463 np_phy = of_parse_phandle(dev->of_node, "phys", 0); 454 464 np_conn = of_graph_get_remote_node(np_phy, -1, -1);