OSDN Git Service

usb: typec: Add number of altmodes partner attr
authorPrashant Malani <pmalani@chromium.org>
Mon, 16 Nov 2020 20:11:40 +0000 (12:11 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 18 Nov 2020 11:55:46 +0000 (12:55 +0100)
commita0ccdc4a77a1b36b682ae60361879eca0a0f88d6
tree87efac4589cad63f175e81b86171b315b9f7756b
parent8a5ca78f603977d6b9b2d7dcb3b1b6ef601d3cc7
usb: typec: Add number of altmodes partner attr

Add a user-visible attribute for the number of alternate modes available
in a partner. This allows userspace to determine whether there are any
remaining alternate modes left to be registered by the kernel driver. It
can begin executing any policy state machine after all available
alternate modes have been registered with the connector class framework.

This value is set to "-1" initially, signifying that a valid number of
alternate modes haven't been set for the partner.

Also add a sysfs file which exposes this attribute. The file remains
hidden as long as the attribute value is -1.

Cc: Benson Leung <bleung@chromium.org>
Cc: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Prashant Malani <pmalani@chromium.org>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20201116201150.2919178-3-pmalani@chromium.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Documentation/ABI/testing/sysfs-class-typec
drivers/usb/typec/class.c
include/linux/usb/typec.h