diff options
author | Heikki Krogerus <heikki.krogerus@linux.intel.com> | 2019-12-30 17:25:58 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-01-09 10:48:19 +0100 |
commit | 8face9aa57c8335b2d698a70bcfaaaa46dd36b93 (patch) | |
tree | dc9b717609e93240e54b297e9dc2d8b4e2477e90 /drivers/usb | |
parent | cf2f58fb88d9494ceff4516ad4bddc54bf56f426 (diff) |
usb: typec: Add parameter for the VDO to typec_altmode_enter()
Enter Mode Command may contain one VDO.
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20191230142611.24921-3-heikki.krogerus@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/typec/altmodes/displayport.c | 5 | ||||
-rw-r--r-- | drivers/usb/typec/bus.c | 8 | ||||
-rw-r--r-- | drivers/usb/typec/tcpm/tcpm.c | 6 | ||||
-rw-r--r-- | drivers/usb/typec/ucsi/displayport.c | 2 |
4 files changed, 12 insertions, 9 deletions
diff --git a/drivers/usb/typec/altmodes/displayport.c b/drivers/usb/typec/altmodes/displayport.c index 4092248a5936..0edfb89e04a8 100644 --- a/drivers/usb/typec/altmodes/displayport.c +++ b/drivers/usb/typec/altmodes/displayport.c @@ -188,7 +188,7 @@ static void dp_altmode_work(struct work_struct *work) switch (dp->state) { case DP_STATE_ENTER: - ret = typec_altmode_enter(dp->alt); + ret = typec_altmode_enter(dp->alt, NULL); if (ret) dev_err(&dp->alt->dev, "failed to enter mode\n"); break; @@ -306,7 +306,8 @@ err_unlock: static int dp_altmode_activate(struct typec_altmode *alt, int activate) { - return activate ? typec_altmode_enter(alt) : typec_altmode_exit(alt); + return activate ? typec_altmode_enter(alt, NULL) : + typec_altmode_exit(alt); } static const struct typec_altmode_ops dp_altmode_ops = { diff --git a/drivers/usb/typec/bus.c b/drivers/usb/typec/bus.c index 8f6d8933d72e..e78c8a68c745 100644 --- a/drivers/usb/typec/bus.c +++ b/drivers/usb/typec/bus.c @@ -84,12 +84,14 @@ EXPORT_SYMBOL_GPL(typec_altmode_notify); /** * typec_altmode_enter - Enter Mode * @adev: The alternate mode + * @vdo: VDO for the Enter Mode command * * The alternate mode drivers use this function to enter mode. The port drivers * use this to inform the alternate mode drivers that the partner has initiated - * Enter Mode command. + * Enter Mode command. If the alternate mode does not require VDO, @vdo must be + * NULL. */ -int typec_altmode_enter(struct typec_altmode *adev) +int typec_altmode_enter(struct typec_altmode *adev, u32 *vdo) { struct altmode *partner = to_altmode(adev)->partner; struct typec_altmode *pdev = &partner->adev; @@ -110,7 +112,7 @@ int typec_altmode_enter(struct typec_altmode *adev) return ret; /* Enter Mode */ - return pdev->ops->enter(pdev); + return pdev->ops->enter(pdev, vdo); } EXPORT_SYMBOL_GPL(typec_altmode_enter); diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c index 56fc356bc55c..f3087ef8265c 100644 --- a/drivers/usb/typec/tcpm/tcpm.c +++ b/drivers/usb/typec/tcpm/tcpm.c @@ -1475,16 +1475,16 @@ static int tcpm_validate_caps(struct tcpm_port *port, const u32 *pdo, return 0; } -static int tcpm_altmode_enter(struct typec_altmode *altmode) +static int tcpm_altmode_enter(struct typec_altmode *altmode, u32 *vdo) { struct tcpm_port *port = typec_altmode_get_drvdata(altmode); u32 header; mutex_lock(&port->lock); - header = VDO(altmode->svid, 1, CMD_ENTER_MODE); + header = VDO(altmode->svid, vdo ? 2 : 1, CMD_ENTER_MODE); header |= VDO_OPOS(altmode->mode); - tcpm_queue_vdm(port, header, NULL, 0); + tcpm_queue_vdm(port, header, vdo, vdo ? 1 : 0); mod_delayed_work(port->wq, &port->vdm_state_machine, 0); mutex_unlock(&port->lock); diff --git a/drivers/usb/typec/ucsi/displayport.c b/drivers/usb/typec/ucsi/displayport.c index d4d5189edfb8..0f1273ae086c 100644 --- a/drivers/usb/typec/ucsi/displayport.c +++ b/drivers/usb/typec/ucsi/displayport.c @@ -45,7 +45,7 @@ struct ucsi_dp { * -EOPNOTSUPP. */ -static int ucsi_displayport_enter(struct typec_altmode *alt) +static int ucsi_displayport_enter(struct typec_altmode *alt, u32 *vdo) { struct ucsi_dp *dp = typec_altmode_get_drvdata(alt); struct ucsi *ucsi = dp->con->ucsi; |