diff mbox series

[v6,2/4] usb: Link the ports to the connectors they are attached to

Message ID 20210407065555.88110-3-heikki.krogerus@linux.intel.com (mailing list archive)
State Accepted
Commit 63cd78617350dae99cc5fbd8f643b83ee819fe33
Headers show
Series usb: Linking ports to their Type-C connectors | expand

Commit Message

Heikki Krogerus April 7, 2021, 6:55 a.m. UTC
Creating link to the USB Type-C connector for every new port
that is added when possible.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
---
 Documentation/ABI/testing/sysfs-bus-usb | 9 +++++++++
 drivers/usb/core/port.c                 | 3 +++
 2 files changed, 12 insertions(+)

Comments

Prashant Malani Oct. 13, 2021, 8:28 p.m. UTC | #1
Hi,

On Wed, Apr 07, 2021 at 09:55:53AM +0300, Heikki Krogerus wrote:
> Creating link to the USB Type-C connector for every new port
> that is added when possible.
> 
> Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>

Did this patch eventually get merged?
I somehow don't see it in the "master" kernel branch [1], although I do
see the commit in that repo [2].

[1]:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/log/drivers/usb/core/port.c

[2]:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=63cd78617350dae99cc5fbd8f643b83ee819fe33&head=master

Best regards,

-Prashant
Guenter Roeck Oct. 13, 2021, 8:57 p.m. UTC | #2
On 10/13/21 1:28 PM, Prashant Malani wrote:
> Hi,
> 
> On Wed, Apr 07, 2021 at 09:55:53AM +0300, Heikki Krogerus wrote:
>> Creating link to the USB Type-C connector for every new port
>> that is added when possible.
>>
>> Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> 
> Did this patch eventually get merged?
> I somehow don't see it in the "master" kernel branch [1], although I do
> see the commit in that repo [2].
> 

It was applied but later reverted with commit 5bdb080f9603 because
it created a module dependency cycle.

Guenter
Prashant Malani Oct. 13, 2021, 9:16 p.m. UTC | #3
On Wed, Oct 13, 2021 at 1:57 PM Guenter Roeck <linux@roeck-us.net> wrote:
>
> On 10/13/21 1:28 PM, Prashant Malani wrote:
> > Hi,
> >
> > On Wed, Apr 07, 2021 at 09:55:53AM +0300, Heikki Krogerus wrote:
> >> Creating link to the USB Type-C connector for every new port
> >> that is added when possible.
> >>
> >> Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> >
> > Did this patch eventually get merged?
> > I somehow don't see it in the "master" kernel branch [1], although I do
> > see the commit in that repo [2].
> >
>
> It was applied but later reverted with commit 5bdb080f9603 because
> it created a module dependency cycle.
>

Ah I see. Thanks Guenter.
Hi Heikki, I was interested in knowing if relanding this is on your radar.

Best regards,

-Prashant
Heikki Krogerus Oct. 15, 2021, 7:44 a.m. UTC | #4
On Wed, Oct 13, 2021 at 02:16:38PM -0700, Prashant Malani wrote:
> On Wed, Oct 13, 2021 at 1:57 PM Guenter Roeck <linux@roeck-us.net> wrote:
> >
> > On 10/13/21 1:28 PM, Prashant Malani wrote:
> > > Hi,
> > >
> > > On Wed, Apr 07, 2021 at 09:55:53AM +0300, Heikki Krogerus wrote:
> > >> Creating link to the USB Type-C connector for every new port
> > >> that is added when possible.
> > >>
> > >> Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> > >
> > > Did this patch eventually get merged?
> > > I somehow don't see it in the "master" kernel branch [1], although I do
> > > see the commit in that repo [2].
> > >
> >
> > It was applied but later reverted with commit 5bdb080f9603 because
> > it created a module dependency cycle.
> >
> 
> Ah I see. Thanks Guenter.
> Hi Heikki, I was interested in knowing if relanding this is on your radar.

Ah, I'm sorry guys, I forgot about this patch. I'll put it back to my
task list. If you are interested in fixing this, and have time to do
that, go right ahead. Let me know.


thanks,
diff mbox series

Patch

diff --git a/Documentation/ABI/testing/sysfs-bus-usb b/Documentation/ABI/testing/sysfs-bus-usb
index bf2c1968525f0..8b4303a0ff51d 100644
--- a/Documentation/ABI/testing/sysfs-bus-usb
+++ b/Documentation/ABI/testing/sysfs-bus-usb
@@ -255,6 +255,15 @@  Description:
 		is permitted, "u2" if only u2 is permitted, "u1_u2" if both u1 and
 		u2 are permitted.
 
+What:		/sys/bus/usb/devices/.../(hub interface)/portX/connector
+Date:		April 2021
+Contact:	Heikki Krogerus <heikki.krogerus@linux.intel.com>
+Description:
+		Link to the USB Type-C connector when available. This link is
+		only created when USB Type-C Connector Class is enabled, and
+		only if the system firmware is capable of describing the
+		connection between a port and its connector.
+
 What:		/sys/bus/usb/devices/.../power/usb2_lpm_l1_timeout
 Date:		May 2013
 Contact:	Mathias Nyman <mathias.nyman@linux.intel.com>
diff --git a/drivers/usb/core/port.c b/drivers/usb/core/port.c
index dfcca9c876c73..3c382a4b648ec 100644
--- a/drivers/usb/core/port.c
+++ b/drivers/usb/core/port.c
@@ -9,6 +9,7 @@ 
 
 #include <linux/slab.h>
 #include <linux/pm_qos.h>
+#include <linux/usb/typec.h>
 
 #include "hub.h"
 
@@ -576,6 +577,7 @@  int usb_hub_create_port_device(struct usb_hub *hub, int port1)
 	}
 
 	find_and_link_peer(hub, port1);
+	typec_link_port(&port_dev->dev);
 
 	/*
 	 * Enable runtime pm and hold a refernce that hub_configure()
@@ -619,5 +621,6 @@  void usb_hub_remove_port_device(struct usb_hub *hub, int port1)
 	peer = port_dev->peer;
 	if (peer)
 		unlink_peers(port_dev, peer);
+	typec_unlink_port(&port_dev->dev);
 	device_unregister(&port_dev->dev);
 }