include/linux/usb/pd.h

Source file repositories/reference/linux-study-clean/include/linux/usb/pd.h

File Facts

System
Linux kernel
Corpus path
include/linux/usb/pd.h
Extension
.h
Size
22343 bytes
Lines
728
Domain
Core OS
Bucket
Core Kernel Interface
Inferred role
Core OS: implementation source
Status
source implementation candidate

Why This File Exists

Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.

Dependency Surface

Detected Declarations

Annotated Snippet

struct pd_chunked_ext_message_data {
	__le16 header;
	u8 data[PD_EXT_MAX_CHUNK_DATA];
} __packed;

/**
  * struct pd_message - PD message as seen on wire
  * @header:    PD message header
  * @payload:   PD message payload
  * @ext_msg:   PD message chunked extended message data
  */
struct pd_message {
	__le16 header;
	union {
		__le32 payload[PD_MAX_PAYLOAD];
		struct pd_chunked_ext_message_data ext_msg;
	};
} __packed;

/*
 * count_chunked_data_objs - Helper to calculate number of Data Objects on a 4
 *   byte boundary.
 * @size: Size of data block for extended message. Should *not* include extended
 *   header size.
 */
static inline u8 count_chunked_data_objs(u32 size)
{
	size += offsetof(struct pd_chunked_ext_message_data, data);
	return ((size / 4) + (size % 4 ? 1 : 0));
}

/* Sink Caps Extended Data Block Version */
#define SKEDB_VER_1_0				1

/* Sink Caps Extended Sink Modes */
#define SINK_MODE_PPS		BIT(0)
#define SINK_MODE_VBUS		BIT(1)
#define SINK_MODE_AC_SUPPLY	BIT(2)
#define SINK_MODE_BATT		BIT(3)
#define SINK_MODE_BATT_UL	BIT(4) /* Unlimited battery power supply */
#define SINK_MODE_AVS		BIT(5)

/**
 * struct sink_caps_ext_msg - Sink extended capability PD message
 * @vid: Vendor ID
 * @pid: Product ID
 * @xid: Value assigned by USB-IF for product
 * @fw: Firmware version
 * @hw: Hardware version
 * @skedb_ver: Sink Caps Extended Data Block (SKEDB) Version
 * @load_step: Indicates the load step slew rate.
 * @load_char: Sink overload characteristics
 * @compliance: Types of sources the sink has been tested & certified on
 * @touch_temp: Indicates the IEC standard to which the touch temperature
 *              conforms to (if applicable).
 * @batt_info: Indicates number batteries and hot swappable ports
 * @modes: Charging caps & power sources supported
 * @spr_min_pdp: Sink Minimum PDP for SPR mode
 * @spr_op_pdp: Sink Operational PDP for SPR mode
 * @spr_max_pdp: Sink Maximum PDP for SPR mode
 * @epr_min_pdp: Sink Minimum PDP for EPR mode
 * @epr_op_pdp: Sink Operational PDP for EPR mode
 * @epr_max_pdp: Sink Maximum PDP for EPR mode
 */
struct sink_caps_ext_msg {
	__le16 vid;
	__le16 pid;
	__le32 xid;
	u8 fw;
	u8 hw;
	u8 skedb_ver;
	u8 load_step;
	__le16 load_char;
	u8 compliance;
	u8 touch_temp;
	u8 batt_info;
	u8 modes;
	u8 spr_min_pdp;
	u8 spr_op_pdp;
	u8 spr_max_pdp;
	u8 epr_min_pdp;
	u8 epr_op_pdp;
	u8 epr_max_pdp;
} __packed;

/* PDO: Power Data Object */
#define PDO_MAX_OBJECTS		7

enum pd_pdo_type {
	PDO_TYPE_FIXED = 0,

Annotation

Implementation Notes