linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Shah, Nehal-bakulchandra" <nehal-bakulchandra.shah@amd.com>
To: Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	"Deucher, Alexander" <Alexander.Deucher@amd.com>
Cc: Felipe Balbi <balbi@kernel.org>,
	"gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
	"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"Liu, Kun" <Kun.Liu2@amd.com>
Subject: Re: [RESEND PATCH 2/2] usb: dwc3: pci add property to allow user space role switch
Date: Thu, 2 Sep 2021 18:15:55 +0530	[thread overview]
Message-ID: <a06b1b50-771c-312d-c91e-b6707c4b9401@amd.com> (raw)
In-Reply-To: <YSef0Iyr3oDWv6Kt@kuha.fi.intel.com>

Hi Heikki,
On 8/26/2021 7:36 PM, Heikki Krogerus wrote:
> Hi Alexander,
> 
> On Wed, Aug 25, 2021 at 01:50:48PM +0000, Deucher, Alexander wrote:
>> I'm not a USB expert, but I think the idea was to pop up a message asking the
>> user what role they wanted when they plugged in USB cable?  Then based on
>> their input, the role could be changed.
> 
> What exactly is the ACPI/EC interrupt in this case?
> 
> Note, that simply selecting one role will only work if the partner
> device happens to be in the opposite role at the same time (actually,
> even that may not be enough). So for example by selecting host role
> will only work if the partner happens to be in device role. If the
> parter is also in host role, nothing happens, or both ends just fail
> to enumerate each other.
> 
> So you always have to negotiate the role with the partner one way or
> the other. Now we need to understand how that negotiation is handled
> (or is expected to be handled) on this platform.
> 
> Which type of connector are we talking about here? Is it USB Type-C,
> or is it something else?
> 
> thanks,
> 
Sorry for the delayed response due to few designed changes. Now we have 
more clarity for the customer platform with respect to usage of DWC3 
controller driver. So it is type C controller which will be using ACPI 
based UCSI driver. As UCSI driver has already role switch support we may 
not need this patch. However we need your input to understand this,

con->usb_role_sw = fwnode_usb_role_switch_get(cap->fwnode);

For this to work, how should be ACPI entry to be defined. Do you have 
sample code, we had discussion on similar point in past but still need 
some clarity if we have sample ACPI ASL Code. I remember something on 
this line from previous discussion with following sample code.

/*
  * 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 here is the another question , if we can not achieve this in BIOS , 
Can we register the software node with quirk in DWC3 controller 
something like this

static const struct software_node amd_dwc3_node[] = {
	{ "amd-dwc3-usb-sw", NULL, amd_dwc3_props },
	{},
};

if (dwc->use_sw_node_quirk) {
		ret = software_node_register_nodes(amd_dwc3_node);
		if (ret)
			return ret;
		dwc3_role_switch.fwnode = software_node_fwnode(&amd_dwc3_node[0]);
	} else {
		dwc3_role_switch.fwnode = dev_fwnode(dwc->dev);
	}
	

And in UCSI driver again with quirk,

swnode = software_node_find_by_name(NULL, "amd-dwc3-usb-sw");

fwnode = software_node_fwnode(swnode);

con->usb_role_sw = usb_role_switch_find_by_fwnode(fwnode);


Please provide your input that will help us .

Regards
Nehal


  reply	other threads:[~2021-09-02 12:46 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-24 19:23 [RESEND PATCH 2/2] usb: dwc3: pci add property to allow user space role switch Nehal Bakulchandra Shah
2021-08-25  5:55 ` Felipe Balbi
2021-08-25  7:01   ` Heikki Krogerus
2021-08-25  7:26     ` Heikki Krogerus
2021-08-25 13:50       ` Deucher, Alexander
2021-08-26 14:06         ` Heikki Krogerus
2021-09-02 12:45           ` Shah, Nehal-bakulchandra [this message]
2021-09-09 12:55             ` Heikki Krogerus
2021-08-25  7:43     ` Felipe Balbi
2021-08-26 11:13 ` Greg KH

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=a06b1b50-771c-312d-c91e-b6707c4b9401@amd.com \
    --to=nehal-bakulchandra.shah@amd.com \
    --cc=Alexander.Deucher@amd.com \
    --cc=Kun.Liu2@amd.com \
    --cc=balbi@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).