diff options
author | Heikki Krogerus <heikki.krogerus@linux.intel.com> | 2018-06-27 18:19:49 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-07-02 17:42:36 +0200 |
commit | 4ab8c18d4d67321cc7b660559de17511d4fc0237 (patch) | |
tree | 3c5a50ee6a0d85aa2d18012a8bd01351d98780dd /include | |
parent | 93dd2112c7b2fa5512cc4aff2c449420487fcb68 (diff) | |
download | linux-4ab8c18d4d67321cc7b660559de17511d4fc0237.tar.gz linux-4ab8c18d4d67321cc7b660559de17511d4fc0237.tar.bz2 linux-4ab8c18d4d67321cc7b660559de17511d4fc0237.zip |
usb: typec: Register a device for every mode
Before a device was created for every discovered SVID, but
this will create a device for every discovered mode of every
SVID. The idea is to make it easier to create mode specific
drivers once a bus for the alternate mode is added.
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Tested-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/usb/typec.h | 37 |
1 files changed, 9 insertions, 28 deletions
diff --git a/include/linux/usb/typec.h b/include/linux/usb/typec.h index 6c33b53d1162..2dcb1683075f 100644 --- a/include/linux/usb/typec.h +++ b/include/linux/usb/typec.h @@ -93,41 +93,23 @@ int typec_partner_set_identity(struct typec_partner *partner); int typec_cable_set_identity(struct typec_cable *cable); /* - * struct typec_mode_desc - Individual Mode of an Alternate Mode - * @index: Index of the Mode within the SVID + * struct typec_altmode_desc - USB Type-C Alternate Mode Descriptor + * @svid: Standard or Vendor ID + * @mode: Index of the Mode * @vdo: VDO returned by Discover Modes USB PD command - * @desc: Optional human readable description of the mode * @roles: Only for ports. DRP if the mode is available in both roles * - * Description of a mode of an Alternate Mode which a connector, cable plug or - * partner supports. Every mode will have it's own sysfs group. The details are - * the VDO returned by discover modes command, description for the mode and - * active flag telling has the mode being entered or not. + * Description of an Alternate Mode which a connector, cable plug or partner + * supports. */ -struct typec_mode_desc { - int index; +struct typec_altmode_desc { + u16 svid; + u8 mode; u32 vdo; - char *desc; /* Only used with ports */ enum typec_port_type roles; }; -/* - * struct typec_altmode_desc - USB Type-C Alternate Mode Descriptor - * @svid: Standard or Vendor ID - * @n_modes: Number of modes - * @modes: Array of modes supported by the Alternate Mode - * - * Representation of an Alternate Mode that has SVID assigned by USB-IF. The - * array of modes will list the modes of a particular SVID that are supported by - * a connector, partner of a cable plug. - */ -struct typec_altmode_desc { - u16 svid; - int n_modes; - struct typec_mode_desc modes[ALTMODE_MAX_MODES]; -}; - struct typec_altmode *typec_partner_register_altmode(struct typec_partner *partner, const struct typec_altmode_desc *desc); @@ -141,8 +123,7 @@ void typec_unregister_altmode(struct typec_altmode *altmode); struct typec_port *typec_altmode2port(struct typec_altmode *alt); -void typec_altmode_update_active(struct typec_altmode *alt, int mode, - bool active); +void typec_altmode_update_active(struct typec_altmode *alt, bool active); enum typec_plug_index { TYPEC_PLUG_SOP_P, |