提交 7ee4ce6e 编写于 作者: H Heikki Krogerus 提交者: Greg Kroah-Hartman

usb: typec: update partner power delivery support with opmode

If USB PD contract is established after creation of the
partner, the power delivery support attribute of the partner
needs to be updated separately. This can be done in
typec_set_pwr_opmode() by checking if the port has already
partner and updating the value if it does.
Signed-off-by: NHeikki Krogerus <heikki.krogerus@linux.intel.com>
Reviewed-by: NGuenter Roeck <linux@roeck-us.net>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 e6b20121
...@@ -1124,6 +1124,11 @@ void typec_set_vconn_role(struct typec_port *port, enum typec_role role) ...@@ -1124,6 +1124,11 @@ void typec_set_vconn_role(struct typec_port *port, enum typec_role role)
} }
EXPORT_SYMBOL_GPL(typec_set_vconn_role); EXPORT_SYMBOL_GPL(typec_set_vconn_role);
static int partner_match(struct device *dev, void *data)
{
return is_typec_partner(dev);
}
/** /**
* typec_set_pwr_opmode - Report changed power operation mode * typec_set_pwr_opmode - Report changed power operation mode
* @port: The USB Type-C Port where the mode was changed * @port: The USB Type-C Port where the mode was changed
...@@ -1137,12 +1142,26 @@ EXPORT_SYMBOL_GPL(typec_set_vconn_role); ...@@ -1137,12 +1142,26 @@ EXPORT_SYMBOL_GPL(typec_set_vconn_role);
void typec_set_pwr_opmode(struct typec_port *port, void typec_set_pwr_opmode(struct typec_port *port,
enum typec_pwr_opmode opmode) enum typec_pwr_opmode opmode)
{ {
struct device *partner_dev;
if (port->pwr_opmode == opmode) if (port->pwr_opmode == opmode)
return; return;
port->pwr_opmode = opmode; port->pwr_opmode = opmode;
sysfs_notify(&port->dev.kobj, NULL, "power_operation_mode"); sysfs_notify(&port->dev.kobj, NULL, "power_operation_mode");
kobject_uevent(&port->dev.kobj, KOBJ_CHANGE); kobject_uevent(&port->dev.kobj, KOBJ_CHANGE);
partner_dev = device_find_child(&port->dev, NULL, partner_match);
if (partner_dev) {
struct typec_partner *partner = to_typec_partner(partner_dev);
if (opmode == TYPEC_PWR_MODE_PD && !partner->usb_pd) {
partner->usb_pd = 1;
sysfs_notify(&partner_dev->kobj, NULL,
"supports_usb_power_delivery");
}
put_device(partner_dev);
}
} }
EXPORT_SYMBOL_GPL(typec_set_pwr_opmode); EXPORT_SYMBOL_GPL(typec_set_pwr_opmode);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册