drivers/usb/typec/anx7411.c
Source file repositories/reference/linux-study-clean/drivers/usb/typec/anx7411.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/usb/typec/anx7411.c- Extension
.c- Size
- 39203 bytes
- Lines
- 1610
- 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/bitfield.hlinux/gpio/consumer.hlinux/i2c.hlinux/interrupt.hlinux/iopoll.hlinux/kernel.hlinux/module.hlinux/mutex.hlinux/of_graph.hlinux/of_platform.hlinux/pm_runtime.hlinux/regulator/consumer.hlinux/slab.hlinux/types.hlinux/usb/pd.hlinux/usb/role.hlinux/usb/tcpci.hlinux/usb/typec.hlinux/usb/typec_dp.hlinux/usb/typec_mux.hlinux/workqueue.hlinux/power_supply.h
Detected Declarations
struct anx7411_i2c_selectstruct typec_paramsstruct fw_msgstruct anx7411_dataenum anx7411_typec_message_typeenum anx7411_psy_statefunction anx7411_reg_readfunction anx7411_reg_block_readfunction anx7411_reg_writefunction anx7411_reg_block_writefunction anx7411_detect_power_modefunction anx7411_register_partnerfunction anx7411_detect_cc_orientationfunction anx7411_set_muxfunction anx7411_set_usb_rolefunction anx7411_data_role_detectfunction anx7411_power_role_detectfunction anx7411_cc_status_detectfunction anx7411_partner_unregister_altmodefunction anx7411_typec_register_altmodefunction anx7411_unregister_partnerfunction anx7411_update_altmodefunction anx7411_register_altmodefunction anx7411_parse_cmdfunction checksumfunction anx7411_read_msg_ctrl_statusfunction anx7411_wait_msg_emptyfunction anx7411_send_msgfunction anx7411_process_cmdfunction anx7411_translate_payloadfunction anx7411_configfunction anx7411_chip_standbyfunction anx7411_work_funcfunction anx7411_intr_isrfunction anx7411_register_i2c_dummy_clientsfunction anx7411_port_unregister_altmodesfunction anx7411_port_unregisterfunction anx7411_usb_mux_setfunction anx7411_usb_set_orientationfunction anx7411_register_switchfunction anx7411_register_muxfunction anx7411_unregister_muxfunction anx7411_unregister_switchfunction anx7411_typec_switch_probefunction anx7411_typec_port_probefunction anx7411_typec_check_connectionfunction anx7411_runtime_pm_suspendfunction anx7411_runtime_pm_resume
Annotated Snippet
struct anx7411_i2c_select {
u8 tcpc_address;
u8 spi_address;
};
#define VID_ANALOGIX 0x1F29
#define PID_ANALOGIX 0x7411
/* TCPC register define */
#define ANALOG_CTRL_10 0xAA
#define STATUS_LEN 2
#define ALERT_0 0xCB
#define RECEIVED_MSG BIT(7)
#define SOFTWARE_INT BIT(6)
#define MSG_LEN 32
#define HEADER_LEN 2
#define MSG_HEADER 0x00
#define MSG_TYPE 0x01
#define MSG_RAWDATA 0x02
#define MSG_LEN_MASK 0x1F
#define ALERT_1 0xCC
#define INTP_POW_ON BIT(7)
#define INTP_POW_OFF BIT(6)
#define VBUS_THRESHOLD_H 0xDD
#define VBUS_THRESHOLD_L 0xDE
#define FW_CTRL_0 0xF0
#define UNSTRUCT_VDM_EN BIT(0)
#define DELAY_200MS BIT(1)
#define VSAFE0 0
#define VSAFE1 BIT(2)
#define VSAFE2 BIT(3)
#define VSAFE3 (BIT(2) | BIT(3))
#define FRS_EN BIT(7)
#define FW_PARAM 0xF1
#define DONGLE_IOP BIT(0)
#define FW_CTRL_2 0xF7
#define SINK_CTRL_DIS_FLAG BIT(5)
/* SPI register define */
#define OCM_CTRL_0 0x6E
#define OCM_RESET BIT(6)
#define MAX_VOLTAGE 0xAC
#define MAX_POWER 0xAD
#define MIN_POWER 0xAE
#define REQUEST_VOLTAGE 0xAF
#define VOLTAGE_UNIT 100 /* mV per unit */
#define REQUEST_CURRENT 0xB1
#define CURRENT_UNIT 50 /* mA per unit */
#define CMD_SEND_BUF 0xC0
#define CMD_RECV_BUF 0xE0
#define REQ_VOL_20V_IN_100MV 0xC8
#define REQ_CUR_2_25A_IN_50MA 0x2D
#define REQ_CUR_3_25A_IN_50MA 0x41
#define DEF_5V 5000
#define DEF_1_5A 1500
#define LOBYTE(w) ((u8)((w) & 0xFF))
#define HIBYTE(w) ((u8)(((u16)(w) >> 8) & 0xFF))
enum anx7411_typec_message_type {
TYPE_SRC_CAP = 0x00,
TYPE_SNK_CAP = 0x01,
TYPE_SNK_IDENTITY = 0x02,
TYPE_SVID = 0x03,
TYPE_SET_SNK_DP_CAP = 0x08,
TYPE_PSWAP_REQ = 0x10,
TYPE_DSWAP_REQ = 0x11,
TYPE_VDM = 0x14,
TYPE_OBJ_REQ = 0x16,
TYPE_DP_ALT_ENTER = 0x19,
TYPE_DP_DISCOVER_MODES_INFO = 0x27,
TYPE_GET_DP_CONFIG = 0x29,
TYPE_DP_CONFIGURE = 0x2A,
TYPE_GET_DP_DISCOVER_MODES_INFO = 0x2E,
TYPE_GET_DP_ALT_ENTER = 0x2F,
};
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/gpio/consumer.h`, `linux/i2c.h`, `linux/interrupt.h`, `linux/iopoll.h`, `linux/kernel.h`, `linux/module.h`, `linux/mutex.h`.
- Detected declarations: `struct anx7411_i2c_select`, `struct typec_params`, `struct fw_msg`, `struct anx7411_data`, `enum anx7411_typec_message_type`, `enum anx7411_psy_state`, `function anx7411_reg_read`, `function anx7411_reg_block_read`, `function anx7411_reg_write`, `function anx7411_reg_block_write`.
- 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.