drivers/nfc/mei_phy.c
Source file repositories/reference/linux-study-clean/drivers/nfc/mei_phy.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/nfc/mei_phy.c- Extension
.c- Size
- 8488 bytes
- Lines
- 397
- Domain
- Driver Families
- Bucket
- drivers/nfc
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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/module.hlinux/slab.hlinux/nfc.hmei_phy.h
Detected Declarations
struct mei_nfc_hdrstruct mei_nfc_cmdstruct mei_nfc_replystruct mei_nfc_if_versionstruct mei_nfc_connectstruct mei_nfc_connect_respfunction mei_nfc_if_versionfunction mei_nfc_connectfunction mei_nfc_sendfunction nfc_mei_phy_writefunction mei_nfc_recvfunction nfc_mei_rx_cbfunction nfc_mei_phy_enablefunction nfc_mei_phy_disablefunction nfc_mei_phy_freeexport mei_phy_opsexport nfc_mei_phy_allocexport nfc_mei_phy_free
Annotated Snippet
struct mei_nfc_hdr {
u8 cmd;
u8 status;
u16 req_id;
u32 reserved;
u16 data_size;
} __packed;
struct mei_nfc_cmd {
struct mei_nfc_hdr hdr;
u8 sub_command;
u8 data[];
} __packed;
struct mei_nfc_reply {
struct mei_nfc_hdr hdr;
u8 sub_command;
u8 reply_status;
u8 data[];
} __packed;
struct mei_nfc_if_version {
u8 radio_version_sw[3];
u8 reserved[3];
u8 radio_version_hw[3];
u8 i2c_addr;
u8 fw_ivn;
u8 vendor_id;
u8 radio_type;
} __packed;
struct mei_nfc_connect {
u8 fw_ivn;
u8 vendor_id;
} __packed;
struct mei_nfc_connect_resp {
u8 fw_ivn;
u8 vendor_id;
u16 me_major;
u16 me_minor;
u16 me_hotfix;
u16 me_build;
} __packed;
#define MEI_NFC_CMD_MAINTENANCE 0x00
#define MEI_NFC_CMD_HCI_SEND 0x01
#define MEI_NFC_CMD_HCI_RECV 0x02
#define MEI_NFC_SUBCMD_CONNECT 0x00
#define MEI_NFC_SUBCMD_IF_VERSION 0x01
#define MEI_NFC_MAX_READ (MEI_NFC_HEADER_SIZE + MEI_NFC_MAX_HCI_PAYLOAD)
#define MEI_DUMP_SKB_IN(info, skb) \
do { \
pr_debug("%s:\n", info); \
print_hex_dump_debug("mei in : ", DUMP_PREFIX_OFFSET, \
16, 1, (skb)->data, (skb)->len, false); \
} while (0)
#define MEI_DUMP_SKB_OUT(info, skb) \
do { \
pr_debug("%s:\n", info); \
print_hex_dump_debug("mei out: ", DUMP_PREFIX_OFFSET, \
16, 1, (skb)->data, (skb)->len, false); \
} while (0)
#define MEI_DUMP_NFC_HDR(info, _hdr) \
do { \
pr_debug("%s:\n", info); \
pr_debug("cmd=%02d status=%d req_id=%d rsvd=%d size=%d\n", \
(_hdr)->cmd, (_hdr)->status, (_hdr)->req_id, \
(_hdr)->reserved, (_hdr)->data_size); \
} while (0)
static int mei_nfc_if_version(struct nfc_mei_phy *phy)
{
struct mei_nfc_cmd cmd;
struct mei_nfc_reply *reply = NULL;
struct mei_nfc_if_version *version;
size_t if_version_length;
int bytes_recv, r;
memset(&cmd, 0, sizeof(struct mei_nfc_cmd));
cmd.hdr.cmd = MEI_NFC_CMD_MAINTENANCE;
cmd.hdr.data_size = 1;
cmd.sub_command = MEI_NFC_SUBCMD_IF_VERSION;
Annotation
- Immediate include surface: `linux/module.h`, `linux/slab.h`, `linux/nfc.h`, `mei_phy.h`.
- Detected declarations: `struct mei_nfc_hdr`, `struct mei_nfc_cmd`, `struct mei_nfc_reply`, `struct mei_nfc_if_version`, `struct mei_nfc_connect`, `struct mei_nfc_connect_resp`, `function mei_nfc_if_version`, `function mei_nfc_connect`, `function mei_nfc_send`, `function nfc_mei_phy_write`.
- Atlas domain: Driver Families / drivers/nfc.
- Implementation status: integration 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.