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 | struct usb_pd_identity *identity; | 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 | * struct typec_capability - USB Type-C Port Capabilities | 189 | * struct typec_capability - USB Type-C Port Capabilities |
| 173 | * @type: Supported power role of the port | 190 | * @type: Supported power role of the port |
| @@ -180,6 +197,7 @@ struct typec_partner_desc { · 6 unmodified lines | |||
| 180 | * @mux: Multiplexer switch for Alternate/Accessory Modes | 197 | * @mux: Multiplexer switch for Alternate/Accessory Modes |
| 181 | * @fwnode: Optional fwnode of the port | 198 | * @fwnode: Optional fwnode of the port |
| 182 | * @driver_data: Private pointer for driver specific info | 199 | * @driver_data: Private pointer for driver specific info |
| 200 | * @ops: Port operations vector | ||
| 183 | * @try_role: Set data role preference for DRP port | 201 | * @try_role: Set data role preference for DRP port |
| 184 | * @dr_set: Set Data Role | 202 | * @dr_set: Set Data Role |
| 185 | * @pr_set: Set Power Role | 203 | * @pr_set: Set Power Role |
| @@ -201,6 +219,8 @@ struct typec_capability { · 15 unmodified lines | |||
| 201 | struct fwnode_handle *fwnode; | 219 | struct fwnode_handle *fwnode; |
| 202 | void *driver_data; | 220 | void *driver_data; |
| 203 | 221 | ||
| 222 | const struct typec_operations *ops; | ||
| 223 | |||
| 204 | int (*try_role)(const struct typec_capability *, | 224 | int (*try_role)(const struct typec_capability *, |
| 205 | int role); | 225 | int role); |
| 206 | 226 | ||