Re: ucsi and DRD controller interaction

Heikki Krogerus
2020-04-29T12:43:25Z

On Mon, Apr 27, 2020 at 07:45:07PM +0530, Shah, Nehal-bakulchandra wrote:
> Hi Heikki,
>
> On 4/27/2020 5:30 PM, Heikki Krogerus wrote:
> > On Wed, Apr 22, 2020 at 08:23:54PM +0530, Shah, Nehal-bakulchandra wrote:
> >>> Can you still influence what goes to your ACPI tables, or are we
> >>> talking about products that are already on the market?
> >> Yes still it is in development phase so i can work out with BIOS team for the same. When you say description of connection ,something like this should be part of _DSD method right? (i.e from below dts
> >> to _DSD of ACPI)
> >>
> >>  usb_con: connector {
> >> compatible = "usb-c-connector";
> >>  label = "USB-C";
> >>  data-role = "dual";
> >>  power-role = "dual";
> >>  try-power-role = "sink";
> >>  source-pdos = <PDO_FIXED(5000, 500, PDO_FIXED_USB_COMM)>;
> >>  sink-pdos = <PDO_FIXED(5000, 500, PDO_FIXED_USB_COMM)
> >>  PDO_VAR(5000, 5000, 1000)>;
> >>  op-sink-microwatt = <10000000>;
> >>  };
> > Here's how the ASL for the _DSD should look like. I don't know how
> > are all these components placed on your platform, so I'm just assuming
> > that your I2C host is under PCI0, as well as your DWC3 controller.
> > It's just an example, but hopefully you get the point from it:
> >
> > /*
> > * I2C1 is the I2C host, and PDC1 is the USB PD Controller (I2C slave device).
> > */
> > Scope (\_SB.PCI0.I2C1.PDC1)
> > {
> > /* Each connector should have its own ACPI device entry (node). */
> > Device (CON0)
> > {
> > Name (_ADR, 0)
> >
> > Name (_DSD, Package () {
> > ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
> > Package() {
> > Package () {"usb-role-switch", \_SB.PCI0.DWC3},
> > }
> > })
> > }
> > }
> >
> > So that property "usb-role-switch" has reference to the DWC3 node as
> > its value. That's what we are after here. If you have that property,
> > the subsystem will find the USB controller for you.
> >
> > If you need for example the properties for the roles, then the _DSD
> > would look like this:
> >
> > Name (_DSD, Package () {
> > ToUUID("daffd814-6eba-4d8c-8a91-bc9bbf4aa301"),
> > Package() {
> > Package () {"usb-role-switch", \_SB.PCI0.DWC3},
> > Package () {"power-role", "dual"},
> > Package () {"data-role", "dual"},
> > }
> > })
> >
> > and so on...
> >
> >
> > Thanks,
>
> Thanks for the details so this will enable the role switch  for drd controller. Now for UCSI driver to call the role make functions it needs the reference of the same switch reference,
>
> so for that do i have to use device_get_named_child_node(dev,"CON0"), in UCSI Driver?

No. If you use the ucsi driver, and if your connector child nodes are
in correct order, then ucsi_find_fwnode() takes care of assigning the
node for you.

But you do need to use the USB role class API to get a handle to the
switch (dwc3) in the typec driver.

UCSI is really meant to be a status interface. The specification
states that the USB Type-C connectors should function autonomously
without any OS involvement. So by relying on the driver to configure
the muxes, you are actually corrupting that part of the specification.

I would still strongly recommend that you use TI's own host interface.

Cheers,

--
heikki