drivers/soc/qcom/pmic_glink_altmode.c

Source file repositories/reference/linux-study-clean/drivers/soc/qcom/pmic_glink_altmode.c

File Facts

System
Linux kernel
Corpus path
drivers/soc/qcom/pmic_glink_altmode.c
Extension
.c
Size
19656 bytes
Lines
718
Domain
Driver Families
Bucket
drivers/soc
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.

Dependency Surface

Detected Declarations

Annotated Snippet

struct usbc_write_req {
	struct pmic_glink_hdr   hdr;
	__le32 cmd;
	__le32 arg;
	__le32 reserved;
};

struct usbc_sc8280x_dp_data {
	u8 pin_assignment : 6;
	u8 hpd_state : 1;
	u8 hpd_irq : 1;
	u8 res[7];
};

/* Used for both TBT and USB4 notifications */
struct usbc_sc8280x_tbt_data {
	u8 usb_speed : 3;
	u8 cable_type : 3;
	/* This field is NOP on USB4, all cables support rounded rates by spec */
	u8 rounded_cable : 1;
	u8 power_limited : 1;
	u8 res[11];
};

struct usbc_notify {
	struct pmic_glink_hdr hdr;
	u8 port_idx;
	u8 orientation;
	u8 mux_ctrl;
#define MUX_CTRL_STATE_NO_CONN			0
#define MUX_CTRL_STATE_USB3_ONLY		1
#define MUX_CTRL_STATE_DP4LN			2
#define MUX_CTRL_STATE_USB3_DP			3
#define MUX_CTRL_STATE_TUNNELING		4

	u8 res;
	__le16 vid;
	__le16 svid;
	union usbc_sc8280x_extended_data {
		struct usbc_sc8280x_dp_data dp;
		struct usbc_sc8280x_tbt_data tbt;
	} extended_data;
};

struct usbc_sc8180x_notify {
	struct pmic_glink_hdr hdr;
	__le32 notification;
	__le32 reserved[2];
};

enum pmic_glink_altmode_pin_assignment {
	DPAM_HPD_OUT,
	DPAM_HPD_A,
	DPAM_HPD_B,
	DPAM_HPD_C,
	DPAM_HPD_D,
	DPAM_HPD_E,
	DPAM_HPD_F,
};

struct pmic_glink_altmode;

#define work_to_altmode_port(w) container_of((w), struct pmic_glink_altmode_port, work)

struct pmic_glink_altmode_port {
	struct pmic_glink_altmode *altmode;
	unsigned int index;

	struct typec_switch *typec_switch;
	struct typec_mux *typec_mux;
	struct typec_mux_state state;
	struct typec_retimer *typec_retimer;
	struct typec_retimer_state retimer_state;
	struct typec_altmode dp_alt;
	struct typec_altmode tbt_alt;

	struct work_struct work;

	struct auxiliary_device *bridge;

	enum typec_orientation orientation;
	u16 svid;
	struct usbc_sc8280x_tbt_data tbt_data;
	u8 dp_data;
	u8 mode;
	u8 hpd_state;
	u8 hpd_irq;
	u8 mux_ctrl;
};

Annotation

Implementation Notes