diff options
author | Badhri Jagan Sridharan <badhri@google.com> | 2022-12-11 22:37:55 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2023-01-06 18:36:03 +0300 |
commit | 001b0c780eac328bc48b70b8437f202a4ed785e4 (patch) | |
tree | 0e8db22b2b529ed4e964c7a849dda5d18731f6de /drivers/usb/typec/altmodes | |
parent | 1b929c02afd37871d5afb9d498426f83432e71c2 (diff) | |
download | linux-001b0c780eac328bc48b70b8437f202a4ed785e4.tar.xz |
usb: typec: altmodes/displayport: Add hpd sysfs attribute
Exporsing HotPlugDetect(HPD) helps userspace to infer HPD
state as defined by VESA DisplayPort Alt Mode on USB Type-C Standard.
This allows userspace to notify users for self help, for instance,
to hint user that the display port cable is probably detached (or)
the display port sink (viz., monitors ect.,) is un-powered.
Also helps to debug issues reported from field.
This change adds an additional attribute "hpd" to the existing
"displayport" attributes.
VESA DisplayPort Alt Mode on USB Type-C Standard defines how
HotPlugDetect(HPD) shall be supported on the USB-C connector
when operating in DisplayPort Alt Mode. This is a read only
node which reflects the current state of HPD.
Valid values:
- 1 when HPD’s logical state is high (HPD_High)
- 0 when HPD’s logical state is low (HPD_Low)
Signed-off-by: Badhri Jagan Sridharan <badhri@google.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20221211193755.1392128-1-badhri@google.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/typec/altmodes')
-rw-r--r-- | drivers/usb/typec/altmodes/displayport.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/drivers/usb/typec/altmodes/displayport.c b/drivers/usb/typec/altmodes/displayport.c index de66a2949e33..06fb4732f8cd 100644 --- a/drivers/usb/typec/altmodes/displayport.c +++ b/drivers/usb/typec/altmodes/displayport.c @@ -146,6 +146,7 @@ static int dp_altmode_status_update(struct dp_altmode *dp) if (dp->hpd != hpd) { drm_connector_oob_hotplug_event(dp->connector_fwnode); dp->hpd = hpd; + sysfs_notify(&dp->alt->dev.kobj, "displayport", "hpd"); } } @@ -508,9 +509,18 @@ static ssize_t pin_assignment_show(struct device *dev, } static DEVICE_ATTR_RW(pin_assignment); +static ssize_t hpd_show(struct device *dev, struct device_attribute *attr, char *buf) +{ + struct dp_altmode *dp = dev_get_drvdata(dev); + + return sysfs_emit(buf, "%d\n", dp->hpd); +} +static DEVICE_ATTR_RO(hpd); + static struct attribute *dp_altmode_attrs[] = { &dev_attr_configuration.attr, &dev_attr_pin_assignment.attr, + &dev_attr_hpd.attr, NULL }; |