drivers/usb/typec/class.h
Source file repositories/reference/linux-study-clean/drivers/usb/typec/class.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/usb/typec/class.h- Extension
.h- Size
- 3311 bytes
- Lines
- 116
- Domain
- Driver Families
- Bucket
- drivers/usb
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/device.hlinux/usb/typec.h
Detected Declarations
struct typec_muxstruct typec_switchstruct usb_devicestruct mode_selectionstruct typec_plugstruct typec_cablestruct typec_partnerstruct typec_portfunction typec_link_portsfunction typec_unlink_ports
Annotated Snippet
struct typec_plug {
struct device dev;
enum typec_plug_index index;
struct ida mode_ids;
int num_altmodes;
};
struct typec_cable {
struct device dev;
enum typec_plug_type type;
struct usb_pd_identity *identity;
unsigned int active:1;
u16 pd_revision; /* 0300H = "3.0" */
enum usb_pd_svdm_ver svdm_version;
};
struct typec_partner {
struct device dev;
unsigned int usb_pd:1;
struct usb_pd_identity *identity;
enum typec_accessory accessory;
struct ida mode_ids;
int num_altmodes;
u16 pd_revision; /* 0300H = "3.0" */
enum usb_pd_svdm_ver svdm_version;
enum usb_mode usb_mode;
u8 usb_capability;
struct usb_power_delivery *pd;
struct mode_selection *sel;
void (*attach)(struct typec_partner *partner, struct device *dev);
void (*deattach)(struct typec_partner *partner, struct device *dev);
};
struct typec_port {
unsigned int id;
struct device dev;
struct ida mode_ids;
struct usb_power_delivery *pd;
int prefer_role;
enum typec_data_role data_role;
enum typec_role pwr_role;
enum typec_role vconn_role;
enum typec_pwr_opmode pwr_opmode;
enum typec_port_type port_type;
enum usb_mode usb_mode;
struct mutex port_type_lock;
struct mutex partner_link_lock;
enum typec_orientation orientation;
bool mode_control;
struct typec_switch *sw;
struct typec_mux *mux;
struct typec_retimer *retimer;
const struct typec_capability *cap;
const struct typec_operations *ops;
struct typec_connector con;
/*
* REVISIT: Only USB devices for now. If there are others, these need to
* be converted into a list.
*
* NOTE: These may be registered first before the typec_partner, so they
* will always have to be kept here instead of struct typec_partner.
*/
struct device *usb2_dev;
struct device *usb3_dev;
};
#define to_typec_port(_dev_) container_of(_dev_, struct typec_port, dev)
#define to_typec_plug(_dev_) container_of(_dev_, struct typec_plug, dev)
#define to_typec_cable(_dev_) container_of(_dev_, struct typec_cable, dev)
#define to_typec_partner(_dev_) container_of(_dev_, struct typec_partner, dev)
extern const struct device_type typec_partner_dev_type;
extern const struct device_type typec_cable_dev_type;
extern const struct device_type typec_plug_dev_type;
extern const struct device_type typec_port_dev_type;
#define is_typec_partner(dev) ((dev)->type == &typec_partner_dev_type)
#define is_typec_cable(dev) ((dev)->type == &typec_cable_dev_type)
#define is_typec_plug(dev) ((dev)->type == &typec_plug_dev_type)
#define is_typec_port(dev) ((dev)->type == &typec_port_dev_type)
extern const struct class typec_mux_class;
Annotation
- Immediate include surface: `linux/device.h`, `linux/usb/typec.h`.
- Detected declarations: `struct typec_mux`, `struct typec_switch`, `struct usb_device`, `struct mode_selection`, `struct typec_plug`, `struct typec_cable`, `struct typec_partner`, `struct typec_port`, `function typec_link_ports`, `function typec_unlink_ports`.
- Atlas domain: Driver Families / drivers/usb.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.