提交 68816e16 编写于 作者: H Heikki Krogerus 提交者: Greg Kroah-Hartman

usb: typec: ucsi: Fix for incorrect status data issue

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: c1b0bc2d ("usb: typec: Add support for UCSI interface")
Signed-off-by: NHeikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: stable <stable@vger.kernel.org>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 1f9f9d16
...@@ -350,6 +350,19 @@ static void ucsi_connector_change(struct work_struct *work) ...@@ -350,6 +350,19 @@ static void ucsi_connector_change(struct work_struct *work)
} }
if (con->status.change & UCSI_CONSTAT_CONNECT_CHANGE) { 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) if (con->status.connected)
ucsi_register_partner(con); ucsi_register_partner(con);
else else
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册