include/linux/usb/typec_altmode.h
Source file repositories/reference/linux-study-clean/include/linux/usb/typec_altmode.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/usb/typec_altmode.h- Extension
.h- Size
- 10659 bytes
- Lines
- 288
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: operation-table or driver-model contract
- Status
- pattern implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/mod_devicetable.hlinux/usb/typec.hlinux/device.h
Detected Declarations
struct typec_altmode_opsstruct typec_altmodestruct typec_altmode_opsstruct typec_cable_opsstruct typec_altmode_driverfunction typec_altmode_set_drvdatafunction typec_altmode_get_cable_svdm_versionfunction typec_altmode_get_orientationfunction typec_altmode_get_svdm_versionfunction typec_altmode_get_data_role
Annotated Snippet
struct device_driver driver;
};
#define to_altmode_driver(d) container_of(d, struct typec_altmode_driver, \
driver)
/**
* typec_altmode_register_driver - registers a USB Type-C alternate mode
* device driver
* @drv: pointer to struct typec_altmode_driver
*
* These drivers will be bind to the partner alternate mode devices. They will
* handle all SVID specific communication.
*/
#define typec_altmode_register_driver(drv) \
__typec_altmode_register_driver(drv, THIS_MODULE)
int __typec_altmode_register_driver(struct typec_altmode_driver *drv,
struct module *module);
/**
* typec_altmode_unregister_driver - unregisters a USB Type-C alternate mode
* device driver
* @drv: pointer to struct typec_altmode_driver
*
* These drivers will be bind to the partner alternate mode devices. They will
* handle all SVID specific communication.
*/
void typec_altmode_unregister_driver(struct typec_altmode_driver *drv);
#define module_typec_altmode_driver(__typec_altmode_driver) \
module_driver(__typec_altmode_driver, typec_altmode_register_driver, \
typec_altmode_unregister_driver)
/**
* typec_mode_selection_start - Start an alternate mode selection process
* @partner: Handle to the Type-C partner device
* @delay: Delay between mode entry/exit attempts, ms
* @timeout: Timeout for a mode entry attempt, ms
*
* This function initiates the process of attempting to enter an Alternate Mode
* supported by the connected Type-C partner.
* Returns 0 on success, or a negative error code on failure.
*/
int typec_mode_selection_start(struct typec_partner *partner,
const unsigned int delay, const unsigned int timeout);
/**
* typec_altmode_state_update - Report the current status of an Alternate Mode
* negotiation
* @partner: Handle to the Type-C partner device
* @svid: Standard or Vendor ID of the Alternate Mode. A value of 0 should be
* passed if no mode is currently active
* @result: Result of the entry operation. This should be 0 on success, or a
* negative error code if the negotiation failed
*
* This function should be called by an Alternate Mode driver to report the
* result of an asynchronous alternate mode entry request. It signals what the
* current active SVID is (or 0 if none) and the success or failure status of
* the last attempt.
*/
void typec_altmode_state_update(struct typec_partner *partner, const u16 svid,
const int result);
/**
* typec_mode_selection_delete - Delete an alternate mode selection instance
* @partner: Handle to the Type-C partner device.
*
* This function cancels a pending alternate mode selection request that was
* previously started with typec_mode_selection_start().
* This is typically called when the partner disconnects.
*/
void typec_mode_selection_delete(struct typec_partner *partner);
#endif /* __USB_TYPEC_ALTMODE_H */
Annotation
- Immediate include surface: `linux/mod_devicetable.h`, `linux/usb/typec.h`, `linux/device.h`.
- Detected declarations: `struct typec_altmode_ops`, `struct typec_altmode`, `struct typec_altmode_ops`, `struct typec_cable_ops`, `struct typec_altmode_driver`, `function typec_altmode_set_drvdata`, `function typec_altmode_get_cable_svdm_version`, `function typec_altmode_get_orientation`, `function typec_altmode_get_svdm_version`, `function typec_altmode_get_data_role`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: pattern 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.