drivers/net/pse-pd/pd692x0.c
Source file repositories/reference/linux-study-clean/drivers/net/pse-pd/pd692x0.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/pse-pd/pd692x0.c- Extension
.c- Size
- 46825 bytes
- Lines
- 1890
- Domain
- Driver Families
- Bucket
- drivers/net
- 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.
- 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/delay.hlinux/firmware.hlinux/gpio/consumer.hlinux/i2c.hlinux/module.hlinux/of.hlinux/platform_device.hlinux/pse-pd/pse.hlinux/regulator/driver.hlinux/regulator/machine.h
Detected Declarations
struct pd692x0_msgstruct pd692x0_msg_verstruct pd692x0_matrixstruct pd692x0_privstruct pd692x0_pse_ext_state_mappingstruct pd692x0_class_pwstruct pd692x0_managerenum pd692x0_fw_statefunction pd692x0_build_msgfunction pd692x0_send_msgfunction pd692x0_resetfunction pd692x0_try_recv_msgfunction pd692x0_recv_msgfunction pd692x0_sendrecv_msgfunction pd692x0_fw_unavailablefunction pd692x0_pi_enablefunction pd692x0_pi_disablefunction pd692x0_pi_get_ext_statefunction pd692x0_pi_get_pw_from_tablefunction pd692x0_pi_set_pw_from_tablefunction pd692x0_pi_get_pw_limit_rangesfunction pd692x0_pi_get_admin_statefunction pd692x0_pi_get_pw_statusfunction pd692x0_pi_get_pw_classfunction pd692x0_pi_get_actual_pwfunction pd692x0_pi_get_priofunction pd692x0_get_sw_versionfunction pd692x0_of_get_ports_managerfunction pd692x0_of_get_managersfunction for_each_child_of_nodefunction pd692x0_register_manager_regulatorfunction pd692x0_register_managers_regulatorfunction pd692x0_conf_manager_power_budgetfunction pd692x0_req_managers_pw_budgetfunction pd692x0_configure_managersfunction pd692x0_set_port_matrixfunction pd692x0_set_ports_matrixfunction pd692x0_write_ports_matrixfunction pd692x0_hw_conf_initfunction pd692x0_of_put_managersfunction pd692x0_managers_free_pw_budgetfunction pd692x0_save_user_bytefunction pd692x0_setup_pi_matrixfunction pd692x0_pi_get_voltagefunction pd692x0_pi_get_pw_limitfunction pd692x0_pi_set_pw_limitfunction pd692x0_pi_set_priofunction pd692x0_fw_get_next_line
Annotated Snippet
struct pd692x0_msg {
u8 key;
u8 echo;
u8 sub[3];
u8 data[8];
__be16 chksum;
} __packed;
struct pd692x0_msg_ver {
u8 prod;
u8 maj_sw_ver;
u8 min_sw_ver;
u8 pa_sw_ver;
u8 param;
u8 build;
};
enum {
PD692X0_KEY_CMD,
PD692X0_KEY_PRG,
PD692X0_KEY_REQ,
PD692X0_KEY_TLM,
PD692X0_KEY_TEST,
PD692X0_KEY_REPORT = 0x52
};
enum {
PD692X0_MSG_RESET,
PD692X0_MSG_GET_SYS_STATUS,
PD692X0_MSG_GET_SW_VER,
PD692X0_MSG_SET_TMP_PORT_MATRIX,
PD692X0_MSG_PRG_PORT_MATRIX,
PD692X0_MSG_SET_PORT_PARAM,
PD692X0_MSG_GET_PORT_STATUS,
PD692X0_MSG_DOWNLOAD_CMD,
PD692X0_MSG_GET_PORT_CLASS,
PD692X0_MSG_GET_PORT_MEAS,
PD692X0_MSG_GET_PORT_PARAM,
PD692X0_MSG_GET_POWER_BANK,
PD692X0_MSG_SET_POWER_BANK,
PD692X0_MSG_SET_USER_BYTE,
/* add new message above here */
PD692X0_MSG_CNT
};
struct pd692x0_matrix {
u8 hw_port_a;
u8 hw_port_b;
};
struct pd692x0_priv {
struct i2c_client *client;
struct pse_controller_dev pcdev;
struct device_node *np;
enum pd692x0_fw_state fw_state;
struct fw_upload *fwl;
bool cancel_request;
u8 msg_id;
bool last_cmd_key;
unsigned long last_cmd_key_time;
bool cfg_saved;
enum ethtool_c33_pse_admin_state admin_state[PD692X0_MAX_PIS];
struct regulator_dev *manager_reg[PD692X0_MAX_MANAGERS];
int manager_pw_budget[PD692X0_MAX_MANAGERS];
int nmanagers;
struct pd692x0_matrix *port_matrix;
};
/* Template list of communication messages. The non-null bytes defined here
* constitute the fixed portion of the messages. The remaining bytes will
* be configured later within the functions. Refer to the "PD692x0 BT Serial
* Communication Protocol User Guide" for comprehensive details on messages
* content.
*/
static const struct pd692x0_msg pd692x0_msg_template_list[PD692X0_MSG_CNT] = {
[PD692X0_MSG_RESET] = {
.key = PD692X0_KEY_CMD,
.sub = {0x07, 0x55, 0x00},
.data = {0x55, 0x00, 0x55, 0x4e,
0x4e, 0x4e, 0x4e, 0x4e},
},
[PD692X0_MSG_GET_SYS_STATUS] = {
.key = PD692X0_KEY_REQ,
.sub = {0x07, 0xd0, 0x4e},
.data = {0x4e, 0x4e, 0x4e, 0x4e,
0x4e, 0x4e, 0x4e, 0x4e},
Annotation
- Immediate include surface: `linux/delay.h`, `linux/firmware.h`, `linux/gpio/consumer.h`, `linux/i2c.h`, `linux/module.h`, `linux/of.h`, `linux/platform_device.h`, `linux/pse-pd/pse.h`.
- Detected declarations: `struct pd692x0_msg`, `struct pd692x0_msg_ver`, `struct pd692x0_matrix`, `struct pd692x0_priv`, `struct pd692x0_pse_ext_state_mapping`, `struct pd692x0_class_pw`, `struct pd692x0_manager`, `enum pd692x0_fw_state`, `function pd692x0_build_msg`, `function pd692x0_send_msg`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
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.