summaryrefslogtreecommitdiffstats
path: root/drivers/usb/typec/ucsi/ucsi.c
diff options
context:
space:
mode:
authorHeikki Krogerus <heikki.krogerus@linux.intel.com>2019-11-04 17:24:34 +0300
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2019-11-04 21:53:14 +0100
commite716bb38edb44b6a7dd9b825f57450118b3066ae (patch)
treeac884f2abed1ad797cee0e6b4e3fc650fa10381f /drivers/usb/typec/ucsi/ucsi.c
parent3cf657f07918bc2d9295bf896a71bd31e407bb0c (diff)
downloadlinux-e716bb38edb44b6a7dd9b825f57450118b3066ae.tar.bz2
usb: typec: ucsi: New error codes
Adding new error codes to the driver that were introduced in UCSI specification v1.1. Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Tested-by: Ajay Gupta <ajayg@nvidia.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20191104142435.29960-18-heikki.krogerus@linux.intel.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/typec/ucsi/ucsi.c')
-rw-r--r--drivers/usb/typec/ucsi/ucsi.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c
index 6c6def96a55b..772f55c92ba3 100644
--- a/drivers/usb/typec/ucsi/ucsi.c
+++ b/drivers/usb/typec/ucsi/ucsi.c
@@ -86,18 +86,33 @@ static int ucsi_read_error(struct ucsi *ucsi)
case UCSI_ERROR_DEAD_BATTERY:
dev_warn(ucsi->dev, "Dead battery condition!\n");
return -EPERM;
- /* The following mean a bug in this driver */
case UCSI_ERROR_INVALID_CON_NUM:
case UCSI_ERROR_UNREGONIZED_CMD:
case UCSI_ERROR_INVALID_CMD_ARGUMENT:
- dev_err(ucsi->dev, "possible UCSI driver bug (0x%x)\n", error);
+ dev_err(ucsi->dev, "possible UCSI driver bug %u\n", error);
return -EINVAL;
+ case UCSI_ERROR_OVERCURRENT:
+ dev_warn(ucsi->dev, "Overcurrent condition\n");
+ break;
+ case UCSI_ERROR_PARTNER_REJECTED_SWAP:
+ dev_warn(ucsi->dev, "Partner rejected swap\n");
+ break;
+ case UCSI_ERROR_HARD_RESET:
+ dev_warn(ucsi->dev, "Hard reset occurred\n");
+ break;
+ case UCSI_ERROR_PPM_POLICY_CONFLICT:
+ dev_warn(ucsi->dev, "PPM Policy conflict\n");
+ break;
+ case UCSI_ERROR_SWAP_REJECTED:
+ dev_warn(ucsi->dev, "Swap rejected\n");
+ break;
+ case UCSI_ERROR_UNDEFINED:
default:
- dev_err(ucsi->dev, "%s: error without status\n", __func__);
- return -EIO;
+ dev_err(ucsi->dev, "unknown error %u\n", error);
+ break;
}
- return 0;
+ return -EIO;
}
static int ucsi_exec_command(struct ucsi *ucsi, u64 cmd)