Introducing struct typec_operations which has the same callbacks as struct typec_capability. The old callbacks are kept for now, but after all users have been converted, they will be removed.
Showing the changes to include/linux (1 of 2 files). Show all
Unified · Split
| @@ -168,6 +168,23 @@ struct typec_partner_desc { · 167 unmodified lines | ||
| 168 | 168 | struct usb_pd_identity *identity; |
| 169 | 169 | }; |
| 170 | 170 | |
| 171 | +/** | |
| 172 | + * struct typec_operations - USB Type-C Port Operations | |
| 173 | + * @try_role: Set data role preference for DRP port | |
| 174 | + * @dr_set: Set Data Role | |
| 175 | + * @pr_set: Set Power Role | |
| 176 | + * @vconn_set: Source VCONN | |
| 177 | + * @port_type_set: Set port type | |
| 178 | + */ | |
| 179 | +struct typec_operations { | |
| 180 | + int (*try_role)(struct typec_port *port, int role); | |
| 181 | + int (*dr_set)(struct typec_port *port, enum typec_data_role role); | |
| 182 | + int (*pr_set)(struct typec_port *port, enum typec_role role); | |
| 183 | + int (*vconn_set)(struct typec_port *port, enum typec_role role); | |
| 184 | + int (*port_type_set)(struct typec_port *port, | |
| 185 | + enum typec_port_type type); | |
| 186 | +}; | |
| 187 | + | |
| 171 | 188 | /* |
| 172 | 189 | * struct typec_capability - USB Type-C Port Capabilities |
| 173 | 190 | * @type: Supported power role of the port |
| @@ -180,6 +197,7 @@ struct typec_partner_desc { · 6 unmodified lines | ||
| 180 | 197 | * @mux: Multiplexer switch for Alternate/Accessory Modes |
| 181 | 198 | * @fwnode: Optional fwnode of the port |
| 182 | 199 | * @driver_data: Private pointer for driver specific info |
| 200 | + * @ops: Port operations vector | |
| 183 | 201 | * @try_role: Set data role preference for DRP port |
| 184 | 202 | * @dr_set: Set Data Role |
| 185 | 203 | * @pr_set: Set Power Role |
| @@ -201,6 +219,8 @@ struct typec_capability { · 15 unmodified lines | ||
| 201 | 219 | struct fwnode_handle *fwnode; |
| 202 | 220 | void *driver_data; |
| 203 | 221 | |
| 222 | + const struct typec_operations *ops; | |
| 223 | + | |
| 204 | 224 | int (*try_role)(const struct typec_capability *, |
| 205 | 225 | int role); |
| 206 | 226 | |