drivers/usb/typec/tcpm/tcpm.c
Source file repositories/reference/linux-study-clean/drivers/usb/typec/tcpm/tcpm.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/usb/typec/tcpm/tcpm.c- Extension
.c- Size
- 242755 bytes
- Lines
- 8651
- Domain
- Driver Families
- Bucket
- drivers/usb
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/completion.hlinux/debugfs.hlinux/device.hlinux/hrtimer.hlinux/jiffies.hlinux/kernel.hlinux/kthread.hlinux/minmax.hlinux/module.hlinux/mutex.hlinux/power_supply.hlinux/proc_fs.hlinux/property.hlinux/sched/clock.hlinux/seq_file.hlinux/slab.hlinux/spinlock.hlinux/string_choices.hlinux/usb.hlinux/usb/pd.hlinux/usb/pd_ado.hlinux/usb/pd_bdo.hlinux/usb/pd_ext_sdb.hlinux/usb/pd_vdo.hlinux/usb/role.hlinux/usb/tcpm.hlinux/usb/typec_altmode.huapi/linux/sched/types.h
Detected Declarations
struct pd_mode_datastruct pd_pps_datastruct pd_spr_avs_datastruct pd_datastruct pd_revision_infostruct pd_timingsstruct pd_identifierstruct sink_caps_ext_datastruct tcpm_portstruct pd_rx_eventstruct altmode_vdm_eventenum tcpm_stateenum tcpm_amsenum vdm_statesenum pd_msg_requestenum adev_actionsenum frs_typec_currentenum spr_avs_statusenum aug_req_typeenum pdo_errenum tcpm_psy_online_statesfunction tcpm_default_statefunction tcpm_port_is_disconnectedfunction tcpm_log_fullfunction _tcpm_logfunction tcpm_logfunction tcpm_log_forcefunction tcpm_log_source_capsfunction tcpm_debug_showfunction tcpm_debugfs_initfunction tcpm_debugfs_exitfunction tcpm_logfunction tcpm_enable_auto_vbus_dischargefunction tcpm_apply_rcfunction tcpm_rp_ccfunction tcpm_ams_finishfunction tcpm_pd_transmitfunction tcpm_pd_transmit_completefunction tcpm_mux_setfunction tcpm_set_polarityfunction tcpm_set_vconnfunction tcpm_get_current_limitfunction tcpm_set_current_limitfunction tcpm_set_attached_statefunction tcpm_set_rolesfunction tcpm_set_pwr_rolefunction tcpm_forge_legacy_pdofunction tcpm_pd_send_revision
Annotated Snippet
struct pd_mode_data {
int svid_index; /* current SVID index */
int nsvids;
u16 svids[SVID_DISCOVERY_MAX];
int altmodes; /* number of alternate modes */
struct typec_altmode_desc altmode_desc[ALTMODE_DISCOVERY_MAX];
};
/*
* @min_volt: Actual min voltage at the local port
* @req_min_volt: Requested min voltage to the port partner
* @max_volt: Actual max voltage at the local port
* @req_max_volt: Requested max voltage to the port partner
* @max_curr: Actual max current at the local port
* @req_max_curr: Requested max current of the port partner
* @req_out_volt: Requested output voltage to the port partner
* @req_op_curr: Requested operating current to the port partner
* @supported: Parter has at least one APDO hence supports PPS
* @active: PPS mode is active
*/
struct pd_pps_data {
u32 min_volt;
u32 req_min_volt;
u32 max_volt;
u32 req_max_volt;
u32 max_curr;
u32 req_max_curr;
u32 req_out_volt;
u32 req_op_curr;
bool supported;
bool active;
};
enum spr_avs_status {
SPR_AVS_UNKNOWN,
SPR_AVS_NOT_SUPPORTED,
SPR_AVS_SUPPORTED
};
static const char * const spr_avs_status_strings[] = {
[SPR_AVS_UNKNOWN] = "Unknown",
[SPR_AVS_SUPPORTED] = "Supported",
[SPR_AVS_NOT_SUPPORTED] = "Not Supported",
};
/*
* Standard Power Range Adjustable Voltage Supply (SPR - AVS) data
* @max_current_ma_9v_to_15v: Max current for 9V to 15V range derived from
* source cap & sink cap
* @max_current_ma_15v_to_20v: Max current for 15V to 20V range derived from
* source cap & sink cap
* @req_op_curr_ma: Requested operating current to the port partner acting as source
* @req_out_volt_mv: Requested output voltage to the port partner acting as source
* @max_out_volt_mv: Max SPR voltage supported by the port and the port partner
* @max_current_ma; MAX SPR current supported by the port and the port partner
* @port_partner_src_status: SPR AVS status of port partner acting as source
* @port_partner_src_pdo_index: PDO index of SPR AVS cap of the port partner
* acting as source. Valid only when
* port_partner_src_status is SPR_AVS_SUPPORTED.
* @port_snk_status: SPR AVS status of the local port acting as sink.
* @port_snk_pdo_index: PDO index of SPR AVS cap of local port acting as sink
* @active: True when the local port acting as the sink has negotiated SPR AVS
* with the partner acting as source.
*/
struct pd_spr_avs_data {
u32 max_current_ma_9v_to_15v;
u32 max_current_ma_15v_to_20v;
u32 req_op_curr_ma;
u32 req_out_volt_mv;
u32 max_out_volt_mv;
u32 max_current_ma;
enum spr_avs_status port_partner_src_status;
unsigned int port_partner_src_pdo_index;
enum spr_avs_status port_snk_status;
unsigned int port_snk_pdo_index;
bool active;
};
struct pd_data {
struct usb_power_delivery *pd;
struct usb_power_delivery_capabilities *source_cap;
struct usb_power_delivery_capabilities_desc source_desc;
struct usb_power_delivery_capabilities *sink_cap;
struct usb_power_delivery_capabilities_desc sink_desc;
unsigned int operating_snk_mw;
};
#define PD_CAP_REV10 0x1
#define PD_CAP_REV20 0x2
#define PD_CAP_REV30 0x3
Annotation
- Immediate include surface: `linux/completion.h`, `linux/debugfs.h`, `linux/device.h`, `linux/hrtimer.h`, `linux/jiffies.h`, `linux/kernel.h`, `linux/kthread.h`, `linux/minmax.h`.
- Detected declarations: `struct pd_mode_data`, `struct pd_pps_data`, `struct pd_spr_avs_data`, `struct pd_data`, `struct pd_revision_info`, `struct pd_timings`, `struct pd_identifier`, `struct sink_caps_ext_data`, `struct tcpm_port`, `struct pd_rx_event`.
- Atlas domain: Driver Families / drivers/usb.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.