drivers/nfc/fdp/fdp.c
Source file repositories/reference/linux-study-clean/drivers/nfc/fdp/fdp.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/nfc/fdp/fdp.c- Extension
.c- Size
- 18209 bytes
- Lines
- 768
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/nfc.hlinux/i2c.hlinux/delay.hlinux/firmware.hnet/nfc/nci_core.hfdp.h
Detected Declarations
struct fdp_nci_infostruct nci_core_get_config_rspfunction fdp_nci_create_connfunction fdp_nci_get_versionsfunction fdp_nci_patch_cmdfunction fdp_nci_set_production_datafunction fdp_nci_set_clockfunction fdp_nci_send_patch_cbfunction fdp_nci_set_data_pkt_counterfunction fdp_nci_send_patchfunction fdp_nci_openfunction fdp_nci_closefunction fdp_nci_sendfunction fdp_nci_request_firmwarefunction fdp_nci_release_firmwarefunction fdp_nci_patch_otpfunction fdp_nci_patch_ramfunction fdp_nci_setupfunction fdp_nci_post_setupfunction fdp_nci_core_reset_ntf_packetfunction fdp_nci_prop_patch_ntf_packetfunction fdp_nci_prop_patch_rsp_packetfunction fdp_nci_prop_set_production_data_rsp_packetfunction fdp_nci_core_get_config_rsp_packetfunction fdp_nci_probefunction fdp_nci_removeexport fdp_nci_probeexport fdp_nci_remove
Annotated Snippet
struct fdp_nci_info {
const struct nfc_phy_ops *phy_ops;
struct fdp_i2c_phy *phy;
struct nci_dev *ndev;
const struct firmware *otp_patch;
const struct firmware *ram_patch;
u32 otp_patch_version;
u32 ram_patch_version;
u32 otp_version;
u32 ram_version;
u32 limited_otp_version;
u8 key_index;
const u8 *fw_vsc_cfg;
u8 clock_type;
u32 clock_freq;
atomic_t data_pkt_counter;
void (*data_pkt_counter_cb)(struct nci_dev *ndev);
u8 setup_patch_sent;
u8 setup_patch_ntf;
u8 setup_patch_status;
u8 setup_reset_ntf;
wait_queue_head_t setup_wq;
};
static const u8 nci_core_get_config_otp_ram_version[5] = {
0x04,
NCI_PARAM_ID_FW_RAM_VERSION,
NCI_PARAM_ID_FW_OTP_VERSION,
NCI_PARAM_ID_OTP_LIMITED_VERSION,
NCI_PARAM_ID_KEY_INDEX_ID
};
struct nci_core_get_config_rsp {
u8 status;
u8 count;
u8 data[];
};
static int fdp_nci_create_conn(struct nci_dev *ndev)
{
struct fdp_nci_info *info = nci_get_drvdata(ndev);
struct core_conn_create_dest_spec_params param;
int r;
/* proprietary destination specific paramerer without value */
param.type = FDP_PATCH_CONN_PARAM_TYPE;
param.length = 0x00;
r = nci_core_conn_create(info->ndev, FDP_PATCH_CONN_DEST, 1,
sizeof(param), ¶m);
if (r)
return r;
return nci_get_conn_info_by_dest_type_params(ndev,
FDP_PATCH_CONN_DEST, NULL);
}
static inline int fdp_nci_get_versions(struct nci_dev *ndev)
{
return nci_core_cmd(ndev, NCI_OP_CORE_GET_CONFIG_CMD,
sizeof(nci_core_get_config_otp_ram_version),
(__u8 *) &nci_core_get_config_otp_ram_version);
}
static inline int fdp_nci_patch_cmd(struct nci_dev *ndev, u8 type)
{
return nci_prop_cmd(ndev, NCI_OP_PROP_PATCH_OID, sizeof(type), &type);
}
static inline int fdp_nci_set_production_data(struct nci_dev *ndev, u8 len,
const char *data)
{
return nci_prop_cmd(ndev, NCI_OP_PROP_SET_PDATA_OID, len, data);
}
static int fdp_nci_set_clock(struct nci_dev *ndev, u8 clock_type,
u32 clock_freq)
{
u32 fc = 13560;
u32 nd, num, delta;
char data[9];
nd = (24 * fc) / clock_freq;
delta = 24 * fc - nd * clock_freq;
num = (32768 * delta) / clock_freq;
Annotation
- Immediate include surface: `linux/module.h`, `linux/nfc.h`, `linux/i2c.h`, `linux/delay.h`, `linux/firmware.h`, `net/nfc/nci_core.h`, `fdp.h`.
- Detected declarations: `struct fdp_nci_info`, `struct nci_core_get_config_rsp`, `function fdp_nci_create_conn`, `function fdp_nci_get_versions`, `function fdp_nci_patch_cmd`, `function fdp_nci_set_production_data`, `function fdp_nci_set_clock`, `function fdp_nci_send_patch_cb`, `function fdp_nci_set_data_pkt_counter`, `function fdp_nci_send_patch`.
- Atlas domain: Driver Families / drivers/nfc.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.