Enter Mode Command may contain one VDO.
Unified · Split
| @@ -188,7 +188,7 @@ static void dp_altmode_work(struct work_struct *work) · 187 unmodified lines | ||
| 188 | 188 | |
| 189 | 189 | switch (dp->state) { |
| 190 | 190 | case DP_STATE_ENTER: |
| 191 | − ret = typec_altmode_enter(dp->alt); | |
| 191 | + ret = typec_altmode_enter(dp->alt, NULL); | |
| 192 | 192 | if (ret) |
| 193 | 193 | dev_err(&dp->alt->dev, "failed to enter mode\n"); |
| 194 | 194 | break; |
| @@ -306,7 +306,8 @@ err_unlock: · 111 unmodified lines | ||
| 306 | 306 | |
| 307 | 307 | static int dp_altmode_activate(struct typec_altmode *alt, int activate) |
| 308 | 308 | { |
| 309 | − return activate ? typec_altmode_enter(alt) : typec_altmode_exit(alt); | |
| 309 | + return activate ? typec_altmode_enter(alt, NULL) : | |
| 310 | + typec_altmode_exit(alt); | |
| 310 | 311 | } |
| 311 | 312 | |
| 312 | 313 | static const struct typec_altmode_ops dp_altmode_ops = { |
| @@ -84,12 +84,14 @@ EXPORT_SYMBOL_GPL(typec_altmode_notify); · 83 unmodified lines | ||
| 84 | 84 | /** |
| 85 | 85 | * typec_altmode_enter - Enter Mode |
| 86 | 86 | * @adev: The alternate mode |
| 87 | + * @vdo: VDO for the Enter Mode command | |
| 87 | 88 | * |
| 88 | 89 | * The alternate mode drivers use this function to enter mode. The port drivers |
| 89 | 90 | * use this to inform the alternate mode drivers that the partner has initiated |
| 90 | − * Enter Mode command. | |
| 91 | + * Enter Mode command. If the alternate mode does not require VDO, @vdo must be | |
| 92 | + * NULL. | |
| 91 | 93 | */ |
| 92 | −int typec_altmode_enter(struct typec_altmode *adev) | |
| 94 | +int typec_altmode_enter(struct typec_altmode *adev, u32 *vdo) | |
| 93 | 95 | { |
| 94 | 96 | struct altmode *partner = to_altmode(adev)->partner; |
| 95 | 97 | struct typec_altmode *pdev = &partner->adev; |
| @@ -110,7 +112,7 @@ int typec_altmode_enter(struct typec_altmode *adev) · 14 unmodified lines | ||
| 110 | 112 | return ret; |
| 111 | 113 | |
| 112 | 114 | /* Enter Mode */ |
| 113 | − return pdev->ops->enter(pdev); | |
| 115 | + return pdev->ops->enter(pdev, vdo); | |
| 114 | 116 | } |
| 115 | 117 | EXPORT_SYMBOL_GPL(typec_altmode_enter); |
| 116 | 118 | |
| @@ -1475,16 +1475,16 @@ static int tcpm_validate_caps(struct tcpm_port *port, const u32 *pdo, · 1474 unmodified lines | ||
| 1475 | 1475 | return 0; |
| 1476 | 1476 | } |
| 1477 | 1477 | |
| 1478 | −static int tcpm_altmode_enter(struct typec_altmode *altmode) | |
| 1478 | +static int tcpm_altmode_enter(struct typec_altmode *altmode, u32 *vdo) | |
| 1479 | 1479 | { |
| 1480 | 1480 | struct tcpm_port *port = typec_altmode_get_drvdata(altmode); |
| 1481 | 1481 | u32 header; |
| 1482 | 1482 | |
| 1483 | 1483 | mutex_lock(&port->lock); |
| 1484 | − header = VDO(altmode->svid, 1, CMD_ENTER_MODE); | |
| 1484 | + header = VDO(altmode->svid, vdo ? 2 : 1, CMD_ENTER_MODE); | |
| 1485 | 1485 | header |= VDO_OPOS(altmode->mode); |
| 1486 | 1486 | |
| 1487 | − tcpm_queue_vdm(port, header, NULL, 0); | |
| 1487 | + tcpm_queue_vdm(port, header, vdo, vdo ? 1 : 0); | |
| 1488 | 1488 | mod_delayed_work(port->wq, &port->vdm_state_machine, 0); |
| 1489 | 1489 | mutex_unlock(&port->lock); |
| 1490 | 1490 | |
| @@ -45,7 +45,7 @@ struct ucsi_dp { · 44 unmodified lines | ||
| 45 | 45 | * -EOPNOTSUPP. |
| 46 | 46 | */ |
| 47 | 47 | |
| 48 | −static int ucsi_displayport_enter(struct typec_altmode *alt) | |
| 48 | +static int ucsi_displayport_enter(struct typec_altmode *alt, u32 *vdo) | |
| 49 | 49 | { |
| 50 | 50 | struct ucsi_dp *dp = typec_altmode_get_drvdata(alt); |
| 51 | 51 | struct ucsi *ucsi = dp->con->ucsi; |
| @@ -55,7 +55,7 @@ static inline void *typec_altmode_get_drvdata(struct typec_altmode *altmode) · 54 unmodified lines | ||
| 55 | 55 | * @activate: User callback for Enter/Exit Mode |
| 56 | 56 | */ |
| 57 | 57 | struct typec_altmode_ops { |
| 58 | − int (*enter)(struct typec_altmode *altmode); | |
| 58 | + int (*enter)(struct typec_altmode *altmode, u32 *vdo); | |
| 59 | 59 | int (*exit)(struct typec_altmode *altmode); |
| 60 | 60 | void (*attention)(struct typec_altmode *altmode, u32 vdo); |
| 61 | 61 | int (*vdm)(struct typec_altmode *altmode, const u32 hdr, |
| @@ -65,7 +65,7 @@ struct typec_altmode_ops { · 3 unmodified lines | ||
| 65 | 65 | int (*activate)(struct typec_altmode *altmode, int activate); |
| 66 | 66 | }; |
| 67 | 67 | |
| 68 | −int typec_altmode_enter(struct typec_altmode *altmode); | |
| 68 | +int typec_altmode_enter(struct typec_altmode *altmode, u32 *vdo); | |
| 69 | 69 | int typec_altmode_exit(struct typec_altmode *altmode); |
| 70 | 70 | void typec_altmode_attention(struct typec_altmode *altmode, u32 vdo); |
| 71 | 71 | int typec_altmode_vdm(struct typec_altmode *altmode, |