mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-06 10:58:48 +09:00
UPSTREAM: usb: typec: Standardize PD Revision format with Type-C Revision
The Type-C Revision was in a specific BCD format "0120H" for 1.2.
USB PD revision numbers follow a similar pattern with "0300H" for 3.0.
Standardizes the sysfs format for usb_power_delivery_revision
to align with the BCD format used for usb_typec_revision.
Example values:
- "2.0": USB Power Delivery Release 2.0
- "3.0": USB Power Delivery Release 3.0
- "3.1": USB Power Delivery Release 3.1
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Benson Leung <bleung@chromium.org>
Link: https://lore.kernel.org/r/20210129061406.2680146-2-bleung@chromium.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 1ed8459d8f
https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-linus)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: Ieb5ad9b305d007b286f6d3d4196b0453b46cec9a
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
610253401e
commit
4e0450b1cd
@@ -105,7 +105,12 @@ Date: April 2017
|
||||
Contact: Heikki Krogerus <heikki.krogerus@linux.intel.com>
|
||||
Description:
|
||||
Revision number of the supported USB Power Delivery
|
||||
specification, or 0 when USB Power Delivery is not supported.
|
||||
specification, or 0.0 when USB Power Delivery is not supported.
|
||||
|
||||
Example values:
|
||||
- "2.0": USB Power Delivery Release 2.0
|
||||
- "3.0": USB Power Delivery Release 3.0
|
||||
- "3.1": USB Power Delivery Release 3.1
|
||||
|
||||
What: /sys/class/typec/<port>/usb_typec_revision
|
||||
Date: April 2017
|
||||
|
||||
@@ -1498,8 +1498,9 @@ static ssize_t usb_power_delivery_revision_show(struct device *dev,
|
||||
char *buf)
|
||||
{
|
||||
struct typec_port *p = to_typec_port(dev);
|
||||
u16 rev = p->cap->pd_revision;
|
||||
|
||||
return sprintf(buf, "%d\n", (p->cap->pd_revision >> 8) & 0xff);
|
||||
return sprintf(buf, "%d.%d\n", (rev >> 8) & 0xff, (rev >> 4) & 0xf);
|
||||
}
|
||||
static DEVICE_ATTR_RO(usb_power_delivery_revision);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user