linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [3/3] usb: typec: ucsi: Fix for incorrect status data issue
@ 2018-06-21 13:43 Heikki Krogerus
  0 siblings, 0 replies; 5+ messages in thread
From: Heikki Krogerus @ 2018-06-21 13:43 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Rafael J. Wysocki, Paul Menzel, Mario Limonciello, linux-usb,
	linux-acpi

According to UCSI Specification, Connector Change Event only
means a change in the Connector Status and Operation Mode
fields of the STATUS data structure. So any other change
should create another event.

Unfortunately on some platforms the firmware acting as PPM
(platform policy manager - usually embedded controller
firmware) still does not report any other status changes if
there is a connector change event. So if the connector power
or data role was changed when a device was plugged to the
connector, the driver does not get any indication about
that. The port will show wrong roles if that happens.

To fix the issue, always checking the data and power role
together with a connector change event.

Fixes: c1b0bc2dabfa ("usb: typec: Add support for UCSI interface")
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
---
 drivers/usb/typec/ucsi/ucsi.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c
index bd5cca5632b3..8d0a6fe748bd 100644
--- a/drivers/usb/typec/ucsi/ucsi.c
+++ b/drivers/usb/typec/ucsi/ucsi.c
@@ -350,6 +350,19 @@ static void ucsi_connector_change(struct work_struct *work)
 	}
 
 	if (con->status.change & UCSI_CONSTAT_CONNECT_CHANGE) {
+		typec_set_pwr_role(con->port, con->status.pwr_dir);
+
+		switch (con->status.partner_type) {
+		case UCSI_CONSTAT_PARTNER_TYPE_UFP:
+			typec_set_data_role(con->port, TYPEC_HOST);
+			break;
+		case UCSI_CONSTAT_PARTNER_TYPE_DFP:
+			typec_set_data_role(con->port, TYPEC_DEVICE);
+			break;
+		default:
+			break;
+		}
+
 		if (con->status.connected)
 			ucsi_register_partner(con);
 		else

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [3/3] usb: typec: ucsi: Fix for incorrect status data issue
@ 2018-06-25 12:37 Greg Kroah-Hartman
  0 siblings, 0 replies; 5+ messages in thread
From: Greg Kroah-Hartman @ 2018-06-25 12:37 UTC (permalink / raw)
  To: Heikki Krogerus
  Cc: Rafael J. Wysocki, Paul Menzel, Mario Limonciello, linux-usb,
	linux-acpi

On Thu, Jun 21, 2018 at 04:43:19PM +0300, Heikki Krogerus wrote:
> According to UCSI Specification, Connector Change Event only
> means a change in the Connector Status and Operation Mode
> fields of the STATUS data structure. So any other change
> should create another event.
> 
> Unfortunately on some platforms the firmware acting as PPM
> (platform policy manager - usually embedded controller
> firmware) still does not report any other status changes if
> there is a connector change event. So if the connector power
> or data role was changed when a device was plugged to the
> connector, the driver does not get any indication about
> that. The port will show wrong roles if that happens.
> 
> To fix the issue, always checking the data and power role
> together with a connector change event.
> 
> Fixes: c1b0bc2dabfa ("usb: typec: Add support for UCSI interface")
> Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> ---

No stable kernel marking for this? odd...

greg k-h
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [3/3] usb: typec: ucsi: Fix for incorrect status data issue
@ 2018-06-25 14:48 Heikki Krogerus
  0 siblings, 0 replies; 5+ messages in thread
From: Heikki Krogerus @ 2018-06-25 14:48 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Rafael J. Wysocki, Paul Menzel, Mario Limonciello, linux-usb,
	linux-acpi

On Mon, Jun 25, 2018 at 08:37:25PM +0800, Greg Kroah-Hartman wrote:
> On Thu, Jun 21, 2018 at 04:43:19PM +0300, Heikki Krogerus wrote:
> > According to UCSI Specification, Connector Change Event only
> > means a change in the Connector Status and Operation Mode
> > fields of the STATUS data structure. So any other change
> > should create another event.
> > 
> > Unfortunately on some platforms the firmware acting as PPM
> > (platform policy manager - usually embedded controller
> > firmware) still does not report any other status changes if
> > there is a connector change event. So if the connector power
> > or data role was changed when a device was plugged to the
> > connector, the driver does not get any indication about
> > that. The port will show wrong roles if that happens.
> > 
> > To fix the issue, always checking the data and power role
> > together with a connector change event.
> > 
> > Fixes: c1b0bc2dabfa ("usb: typec: Add support for UCSI interface")
> > Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> > ---
> 
> No stable kernel marking for this? odd...

I forgot to put it there. Sorry.

I noticed you picked this patch already, but can I still resend it?


Thanks,

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [3/3] usb: typec: ucsi: Fix for incorrect status data issue
@ 2018-06-25 14:54 Greg Kroah-Hartman
  0 siblings, 0 replies; 5+ messages in thread
From: Greg Kroah-Hartman @ 2018-06-25 14:54 UTC (permalink / raw)
  To: Heikki Krogerus
  Cc: Rafael J. Wysocki, Paul Menzel, Mario Limonciello, linux-usb,
	linux-acpi

On Mon, Jun 25, 2018 at 05:48:05PM +0300, Heikki Krogerus wrote:
> On Mon, Jun 25, 2018 at 08:37:25PM +0800, Greg Kroah-Hartman wrote:
> > On Thu, Jun 21, 2018 at 04:43:19PM +0300, Heikki Krogerus wrote:
> > > According to UCSI Specification, Connector Change Event only
> > > means a change in the Connector Status and Operation Mode
> > > fields of the STATUS data structure. So any other change
> > > should create another event.
> > > 
> > > Unfortunately on some platforms the firmware acting as PPM
> > > (platform policy manager - usually embedded controller
> > > firmware) still does not report any other status changes if
> > > there is a connector change event. So if the connector power
> > > or data role was changed when a device was plugged to the
> > > connector, the driver does not get any indication about
> > > that. The port will show wrong roles if that happens.
> > > 
> > > To fix the issue, always checking the data and power role
> > > together with a connector change event.
> > > 
> > > Fixes: c1b0bc2dabfa ("usb: typec: Add support for UCSI interface")
> > > Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> > > ---
> > 
> > No stable kernel marking for this? odd...
> 
> I forgot to put it there. Sorry.
> 
> I noticed you picked this patch already, but can I still resend it?

I already added that tag :)
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [3/3] usb: typec: ucsi: Fix for incorrect status data issue
@ 2018-06-26  8:09 Heikki Krogerus
  0 siblings, 0 replies; 5+ messages in thread
From: Heikki Krogerus @ 2018-06-26  8:09 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Rafael J. Wysocki, Paul Menzel, Mario Limonciello, linux-usb,
	linux-acpi

On Mon, Jun 25, 2018 at 10:54:27PM +0800, Greg Kroah-Hartman wrote:
> On Mon, Jun 25, 2018 at 05:48:05PM +0300, Heikki Krogerus wrote:
> > On Mon, Jun 25, 2018 at 08:37:25PM +0800, Greg Kroah-Hartman wrote:
> > > On Thu, Jun 21, 2018 at 04:43:19PM +0300, Heikki Krogerus wrote:
> > > > According to UCSI Specification, Connector Change Event only
> > > > means a change in the Connector Status and Operation Mode
> > > > fields of the STATUS data structure. So any other change
> > > > should create another event.
> > > > 
> > > > Unfortunately on some platforms the firmware acting as PPM
> > > > (platform policy manager - usually embedded controller
> > > > firmware) still does not report any other status changes if
> > > > there is a connector change event. So if the connector power
> > > > or data role was changed when a device was plugged to the
> > > > connector, the driver does not get any indication about
> > > > that. The port will show wrong roles if that happens.
> > > > 
> > > > To fix the issue, always checking the data and power role
> > > > together with a connector change event.
> > > > 
> > > > Fixes: c1b0bc2dabfa ("usb: typec: Add support for UCSI interface")
> > > > Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> > > > ---
> > > 
> > > No stable kernel marking for this? odd...
> > 
> > I forgot to put it there. Sorry.
> > 
> > I noticed you picked this patch already, but can I still resend it?
> 
> I already added that tag :)

OK :-). Thanks Greg!

Br,

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-06-26  8:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-06-26  8:09 [3/3] usb: typec: ucsi: Fix for incorrect status data issue Heikki Krogerus
  -- strict thread matches above, loose matches on Subject: below --
2018-06-25 14:54 Greg Kroah-Hartman
2018-06-25 14:48 Heikki Krogerus
2018-06-25 12:37 Greg Kroah-Hartman
2018-06-21 13:43 Heikki Krogerus

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).