diff options
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/usb/typec.h | 14 | ||||
| -rw-r--r-- | include/linux/usb/typec_mux.h | 55 |
2 files changed, 69 insertions, 0 deletions
diff --git a/include/linux/usb/typec.h b/include/linux/usb/typec.h index 0d44ce6af08f..2408e5c2ed91 100644 --- a/include/linux/usb/typec.h +++ b/include/linux/usb/typec.h | |||
| @@ -60,6 +60,12 @@ enum typec_accessory { | |||
| 60 | 60 | ||
| 61 | #define TYPEC_MAX_ACCESSORY 3 | 61 | #define TYPEC_MAX_ACCESSORY 3 |
| 62 | 62 | ||
| 63 | enum typec_orientation { | ||
| 64 | TYPEC_ORIENTATION_NONE, | ||
| 65 | TYPEC_ORIENTATION_NORMAL, | ||
| 66 | TYPEC_ORIENTATION_REVERSE, | ||
| 67 | }; | ||
| 68 | |||
| 63 | /* | 69 | /* |
| 64 | * struct usb_pd_identity - USB Power Delivery identity data | 70 | * struct usb_pd_identity - USB Power Delivery identity data |
| 65 | * @id_header: ID Header VDO | 71 | * @id_header: ID Header VDO |
| @@ -185,6 +191,8 @@ struct typec_partner_desc { | |||
| 185 | * @pd_revision: USB Power Delivery Specification revision if supported | 191 | * @pd_revision: USB Power Delivery Specification revision if supported |
| 186 | * @prefer_role: Initial role preference | 192 | * @prefer_role: Initial role preference |
| 187 | * @accessory: Supported Accessory Modes | 193 | * @accessory: Supported Accessory Modes |
| 194 | * @sw: Cable plug orientation switch | ||
| 195 | * @mux: Multiplexer switch for Alternate/Accessory Modes | ||
| 188 | * @fwnode: Optional fwnode of the port | 196 | * @fwnode: Optional fwnode of the port |
| 189 | * @try_role: Set data role preference for DRP port | 197 | * @try_role: Set data role preference for DRP port |
| 190 | * @dr_set: Set Data Role | 198 | * @dr_set: Set Data Role |
| @@ -202,6 +210,8 @@ struct typec_capability { | |||
| 202 | int prefer_role; | 210 | int prefer_role; |
| 203 | enum typec_accessory accessory[TYPEC_MAX_ACCESSORY]; | 211 | enum typec_accessory accessory[TYPEC_MAX_ACCESSORY]; |
| 204 | 212 | ||
| 213 | struct typec_switch *sw; | ||
| 214 | struct typec_mux *mux; | ||
| 205 | struct fwnode_handle *fwnode; | 215 | struct fwnode_handle *fwnode; |
| 206 | 216 | ||
| 207 | int (*try_role)(const struct typec_capability *, | 217 | int (*try_role)(const struct typec_capability *, |
| @@ -245,4 +255,8 @@ void typec_set_pwr_role(struct typec_port *port, enum typec_role role); | |||
| 245 | void typec_set_vconn_role(struct typec_port *port, enum typec_role role); | 255 | void typec_set_vconn_role(struct typec_port *port, enum typec_role role); |
| 246 | void typec_set_pwr_opmode(struct typec_port *port, enum typec_pwr_opmode mode); | 256 | void typec_set_pwr_opmode(struct typec_port *port, enum typec_pwr_opmode mode); |
| 247 | 257 | ||
| 258 | int typec_set_orientation(struct typec_port *port, | ||
| 259 | enum typec_orientation orientation); | ||
| 260 | int typec_set_mode(struct typec_port *port, int mode); | ||
| 261 | |||
| 248 | #endif /* __LINUX_USB_TYPEC_H */ | 262 | #endif /* __LINUX_USB_TYPEC_H */ |
diff --git a/include/linux/usb/typec_mux.h b/include/linux/usb/typec_mux.h new file mode 100644 index 000000000000..12c1b057834b --- /dev/null +++ b/include/linux/usb/typec_mux.h | |||
| @@ -0,0 +1,55 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-2.0 | ||
| 2 | |||
| 3 | #ifndef __USB_TYPEC_MUX | ||
| 4 | #define __USB_TYPEC_MUX | ||
| 5 | |||
| 6 | #include <linux/list.h> | ||
| 7 | #include <linux/usb/typec.h> | ||
| 8 | |||
| 9 | struct device; | ||
| 10 | |||
| 11 | /** | ||
| 12 | * struct typec_switch - USB Type-C cable orientation switch | ||
| 13 | * @dev: Switch device | ||
| 14 | * @entry: List entry | ||
| 15 | * @set: Callback to the driver for setting the orientation | ||
| 16 | * | ||
| 17 | * USB Type-C pin flipper switch routing the correct data pairs from the | ||
| 18 | * connector to the USB controller depending on the orientation of the cable | ||
| 19 | * plug. | ||
| 20 | */ | ||
| 21 | struct typec_switch { | ||
| 22 | struct device *dev; | ||
| 23 | struct list_head entry; | ||
| 24 | |||
| 25 | int (*set)(struct typec_switch *sw, enum typec_orientation orientation); | ||
| 26 | }; | ||
| 27 | |||
| 28 | /** | ||
| 29 | * struct typec_switch - USB Type-C connector pin mux | ||
| 30 | * @dev: Mux device | ||
| 31 | * @entry: List entry | ||
| 32 | * @set: Callback to the driver for setting the state of the mux | ||
| 33 | * | ||
| 34 | * Pin Multiplexer/DeMultiplexer switch routing the USB Type-C connector pins to | ||
| 35 | * different components depending on the requested mode of operation. Used with | ||
| 36 | * Accessory/Alternate modes. | ||
| 37 | */ | ||
| 38 | struct typec_mux { | ||
| 39 | struct device *dev; | ||
| 40 | struct list_head entry; | ||
| 41 | |||
| 42 | int (*set)(struct typec_mux *mux, int state); | ||
| 43 | }; | ||
| 44 | |||
| 45 | struct typec_switch *typec_switch_get(struct device *dev); | ||
| 46 | void typec_switch_put(struct typec_switch *sw); | ||
| 47 | int typec_switch_register(struct typec_switch *sw); | ||
| 48 | void typec_switch_unregister(struct typec_switch *sw); | ||
| 49 | |||
| 50 | struct typec_mux *typec_mux_get(struct device *dev); | ||
| 51 | void typec_mux_put(struct typec_mux *mux); | ||
| 52 | int typec_mux_register(struct typec_mux *mux); | ||
| 53 | void typec_mux_unregister(struct typec_mux *mux); | ||
| 54 | |||
| 55 | #endif /* __USB_TYPEC_MUX */ | ||
