diff options
author | Heikki Krogerus <heikki.krogerus@linux.intel.com> | 2018-06-27 18:19:50 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2018-07-02 17:42:36 +0200 |
commit | 8a37d87d72f0c69f837229c04d2fcd7117ea57e7 (patch) | |
tree | 43cf3111a964678d08fe6638e4459e1c2db50b55 /drivers/usb/typec/bus.h | |
parent | 4ab8c18d4d67321cc7b660559de17511d4fc0237 (diff) | |
download | linux-8a37d87d72f0c69f837229c04d2fcd7117ea57e7.tar.bz2 |
usb: typec: Bus type for alternate modes
Introducing a simple bus for the alternate modes. Bus allows
binding drivers to the discovered alternate modes the
partners support.
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 'drivers/usb/typec/bus.h')
-rw-r--r-- | drivers/usb/typec/bus.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/drivers/usb/typec/bus.h b/drivers/usb/typec/bus.h new file mode 100644 index 000000000000..62aaf8b56bde --- /dev/null +++ b/drivers/usb/typec/bus.h @@ -0,0 +1,38 @@ +/* SPDX-License-Identifier: GPL-2.0 */ + +#ifndef __USB_TYPEC_ALTMODE_H__ +#define __USB_TYPEC_ALTMODE_H__ + +#include <linux/usb/typec_altmode.h> +#include <linux/usb/typec_mux.h> + +struct bus_type; + +struct altmode { + unsigned int id; + struct typec_altmode adev; + struct typec_mux *mux; + + enum typec_port_data roles; + + struct attribute *attrs[5]; + char group_name[6]; + struct attribute_group group; + const struct attribute_group *groups[2]; + + struct altmode *partner; + struct altmode *plug[2]; + + struct blocking_notifier_head nh; +}; + +#define to_altmode(d) container_of(d, struct altmode, adev) + +extern struct bus_type typec_bus; +extern const struct device_type typec_altmode_dev_type; +extern const struct device_type typec_port_dev_type; + +#define is_typec_altmode(_dev_) (_dev_->type == &typec_altmode_dev_type) +#define is_typec_port(_dev_) (_dev_->type == &typec_port_dev_type) + +#endif /* __USB_TYPEC_ALTMODE_H__ */ |