drivers/usb/typec/tipd/core.c
Source file repositories/reference/linux-study-clean/drivers/usb/typec/tipd/core.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/usb/typec/tipd/core.c- Extension
.c- Size
- 51353 bytes
- Lines
- 2051
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/i2c.hlinux/acpi.hlinux/gpio/consumer.hlinux/module.hlinux/of.hlinux/power_supply.hlinux/regmap.hlinux/interrupt.hlinux/usb/typec.hlinux/usb/typec_altmode.hlinux/usb/typec_dp.hlinux/usb/typec_mux.hlinux/usb/typec_tbt.hlinux/usb/role.hlinux/workqueue.hlinux/firmware.htps6598x.htrace.h
Detected Declarations
struct tps6598x_rx_identity_regstruct tps6598x_usb4_status_regstruct tps6598x_dp_sid_status_regstruct tps6598x_intel_vid_status_regstruct tps6598xstruct tipd_datastruct tps6598xstruct cd321x_statusstruct cd321xfunction tps6598x_block_readfunction tps6598x_block_writefunction tps6598x_read8function tps6598x_read16function tps6598x_read32function tps6598x_read64function tps6598x_write8function tps6598x_write64function tps6598x_write_4ccfunction tps6598x_read_partner_identityfunction tps6598x_set_data_rolefunction tps6598x_connectfunction tps6598x_disconnectfunction tps6598x_exec_cmd_tmofunction tps6598x_exec_cmdfunction tps6598x_dr_setfunction tps6598x_pr_setfunction tps6598x_read_statusfunction tps6598x_read_data_statusfunction cd321x_read_data_statusfunction tps6598x_read_power_statusfunction tps6598x_handle_plug_eventfunction cd321x_typec_update_modefunction cd321x_update_workfunction cd321x_queue_statusfunction cd321x_connectfunction cd321x_interruptfunction tps6598x_has_role_changedfunction tps25750_interruptfunction tps6598x_interruptfunction tps6598x_poll_workfunction tps6598x_check_modefunction tps6598x_psy_get_onlinefunction tps6598x_psy_get_propfunction cd321x_switch_power_statefunction devm_tps6598_psy_registerfunction tps6598x_register_portfunction cd321x_register_port_altmodesfunction cd321x_register_port
Annotated Snippet
struct tps6598x_rx_identity_reg {
u8 status;
struct usb_pd_identity identity;
} __packed;
/* TPS_REG_USB4_STATUS */
struct tps6598x_usb4_status_reg {
u8 mode_status;
__le32 eudo;
__le32 unknown;
} __packed;
/* TPS_REG_DP_SID_STATUS */
struct tps6598x_dp_sid_status_reg {
u8 mode_status;
__le32 status_tx;
__le32 status_rx;
__le32 configure;
__le32 mode_data;
} __packed;
/* TPS_REG_INTEL_VID_STATUS */
struct tps6598x_intel_vid_status_reg {
u8 mode_status;
__le32 attention_vdo;
__le16 enter_vdo;
__le16 device_mode;
__le16 cable_mode;
} __packed;
/* Standard Task return codes */
#define TPS_TASK_TIMEOUT 1
#define TPS_TASK_REJECTED 3
/* Debounce delay for mode changes, in milliseconds */
#define CD321X_DEBOUNCE_DELAY_MS 500
enum {
TPS_MODE_APP,
TPS_MODE_BOOT,
TPS_MODE_BIST,
TPS_MODE_DISC,
TPS_MODE_PTCH,
};
static const char *const modes[] = {
[TPS_MODE_APP] = "APP ",
[TPS_MODE_BOOT] = "BOOT",
[TPS_MODE_BIST] = "BIST",
[TPS_MODE_DISC] = "DISC",
[TPS_MODE_PTCH] = "PTCH",
};
/* Unrecognized commands will be replaced with "!CMD" */
#define INVALID_CMD(_cmd_) (_cmd_ == 0x444d4321)
struct tps6598x;
struct tipd_data {
irq_handler_t irq_handler;
u64 irq_mask1;
size_t tps_struct_size;
void (*remove)(struct tps6598x *tps);
int (*register_port)(struct tps6598x *tps, struct fwnode_handle *node);
void (*unregister_port)(struct tps6598x *tps);
void (*trace_data_status)(u32 status);
void (*trace_power_status)(u16 status);
void (*trace_status)(u32 status);
int (*apply_patch)(struct tps6598x *tps);
int (*init)(struct tps6598x *tps);
int (*switch_power_state)(struct tps6598x *tps, u8 target_state);
bool (*read_data_status)(struct tps6598x *tps);
int (*reset)(struct tps6598x *tps);
int (*connect)(struct tps6598x *tps, u32 status);
};
struct tps6598x {
struct device *dev;
struct regmap *regmap;
struct mutex lock; /* device lock */
u8 i2c_protocol:1;
struct gpio_desc *reset;
struct typec_port *port;
struct typec_partner *partner;
struct usb_pd_identity partner_identity;
struct usb_role_switch *role_sw;
struct typec_capability typec_cap;
struct power_supply *psy;
Annotation
- Immediate include surface: `linux/i2c.h`, `linux/acpi.h`, `linux/gpio/consumer.h`, `linux/module.h`, `linux/of.h`, `linux/power_supply.h`, `linux/regmap.h`, `linux/interrupt.h`.
- Detected declarations: `struct tps6598x_rx_identity_reg`, `struct tps6598x_usb4_status_reg`, `struct tps6598x_dp_sid_status_reg`, `struct tps6598x_intel_vid_status_reg`, `struct tps6598x`, `struct tipd_data`, `struct tps6598x`, `struct cd321x_status`, `struct cd321x`, `function tps6598x_block_read`.
- Atlas domain: Driver Families / drivers/usb.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.