usb: typec: tcpm: add support to set tcpc connector orientatition
authorMarco Felsch <m.felsch@pengutronix.de>
Thu, 22 Feb 2024 21:09:02 +0000 (22:09 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 5 Mar 2024 13:29:30 +0000 (13:29 +0000)
This adds the support to set the connector orientation value
accordingly. This is part of the optional CONFIG_STANDARD_OUTPUT
register 0x18, specified within the USB port controller spsicification
rev. 2.0 [1].

[1] https://www.usb.org/sites/default/files/documents/usb-port_controller_specification_rev2.0_v1.0_0.pdf

Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20240222210903.208901-4-m.felsch@pengutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/typec/tcpm/tcpm.c
include/linux/usb/tcpm.h

index b6d7131228f981eb4681cdae1e60900fc8dbddf2..3d505614bff1ea12bd9c95028d671cf58c904ac4 100644 (file)
@@ -1167,6 +1167,12 @@ static int tcpm_set_roles(struct tcpm_port *port, bool attached,
        if (ret < 0)
                return ret;
 
+       if (port->tcpc->set_orientation) {
+               ret = port->tcpc->set_orientation(port->tcpc, orientation);
+               if (ret < 0)
+                       return ret;
+       }
+
        port->pwr_role = role;
        port->data_role = data;
        typec_set_data_role(port->typec_port, data);
index 6671427f7eebb451599443069f71ea803ce6bb9e..061da9546a813137645bfef5e6c024017d35a989 100644 (file)
@@ -144,6 +144,8 @@ struct tcpc_dev {
                      enum typec_cc_status *cc2);
        int (*set_polarity)(struct tcpc_dev *dev,
                            enum typec_cc_polarity polarity);
+       int (*set_orientation)(struct tcpc_dev *dev,
+                              enum typec_orientation orientation);
        int (*set_vconn)(struct tcpc_dev *dev, bool on);
        int (*set_vbus)(struct tcpc_dev *dev, bool on, bool charge);
        int (*set_current_limit)(struct tcpc_dev *dev, u32 max_ma, u32 mv);