drivers/net/ieee802154/adf7242.c
Source file repositories/reference/linux-study-clean/drivers/net/ieee802154/adf7242.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ieee802154/adf7242.c- Extension
.c- Size
- 36722 bytes
- Lines
- 1354
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/kernel.hlinux/module.hlinux/interrupt.hlinux/delay.hlinux/mutex.hlinux/workqueue.hlinux/spinlock.hlinux/firmware.hlinux/spi/spi.hlinux/skbuff.hlinux/of.hlinux/irq.hlinux/debugfs.hlinux/bitops.hlinux/ieee802154.hnet/mac802154.hnet/cfg802154.h
Detected Declarations
struct adf7242_localfunction adf7242_statusfunction adf7242_wait_statusfunction adf7242_wait_rc_readyfunction adf7242_wait_spi_readyfunction adf7242_write_fbuffunction adf7242_read_fbuffunction adf7242_read_regfunction adf7242_write_regfunction adf7242_cmdfunction adf7242_upload_firmwarefunction adf7242_verify_firmwarefunction adf7242_clear_irqstatfunction adf7242_cmd_rxfunction adf7242_rx_cal_workfunction receiverfunction adf7242_set_txpowerfunction adf7242_set_csma_paramsfunction adf7242_set_frame_retriesfunction adf7242_edfunction adf7242_startfunction adf7242_stopfunction adf7242_channelfunction adf7242_set_hw_addr_filtfunction adf7242_set_promiscuous_modefunction adf7242_set_cca_ed_levelfunction adf7242_xmitfunction adf7242_rxfunction adf7242_debugfunction adf7242_isrfunction adf7242_soft_resetfunction adf7242_hw_initfunction adf7242_stats_showfunction adf7242_debugfs_initfunction adf7242_probefunction adf7242_remove
Annotated Snippet
struct adf7242_local {
struct spi_device *spi;
struct completion tx_complete;
struct ieee802154_hw *hw;
struct mutex bmux; /* protect SPI messages */
struct spi_message stat_msg;
struct spi_transfer stat_xfer;
struct dentry *debugfs_root;
struct delayed_work work;
struct workqueue_struct *wqueue;
unsigned long flags;
int tx_stat;
bool promiscuous;
s8 rssi;
u8 max_frame_retries;
u8 max_cca_retries;
u8 max_be;
u8 min_be;
/* DMA (thus cache coherency maintenance) requires the
* transfer buffers to live in their own cache lines.
*/
u8 buf[3] ____cacheline_aligned;
u8 buf_reg_tx[3];
u8 buf_read_tx[4];
u8 buf_read_rx[4];
u8 buf_stat_rx;
u8 buf_stat_tx;
u8 buf_cmd;
};
static int adf7242_soft_reset(struct adf7242_local *lp, int line);
static int adf7242_status(struct adf7242_local *lp, u8 *stat)
{
int status;
mutex_lock(&lp->bmux);
status = spi_sync(lp->spi, &lp->stat_msg);
*stat = lp->buf_stat_rx;
mutex_unlock(&lp->bmux);
return status;
}
static int adf7242_wait_status(struct adf7242_local *lp, unsigned int status,
unsigned int mask, int line)
{
int cnt = 0, ret = 0;
u8 stat;
do {
adf7242_status(lp, &stat);
cnt++;
} while (((stat & mask) != status) && (cnt < MAX_POLL_LOOPS));
if (cnt >= MAX_POLL_LOOPS) {
ret = -ETIMEDOUT;
if (!(stat & STAT_RC_READY)) {
adf7242_soft_reset(lp, line);
adf7242_status(lp, &stat);
if ((stat & mask) == status)
ret = 0;
}
if (ret < 0)
dev_warn(&lp->spi->dev,
"%s:line %d Timeout status 0x%x (%d)\n",
__func__, line, stat, cnt);
}
dev_vdbg(&lp->spi->dev, "%s : loops=%d line %d\n", __func__, cnt, line);
return ret;
}
static int adf7242_wait_rc_ready(struct adf7242_local *lp, int line)
{
return adf7242_wait_status(lp, STAT_RC_READY | STAT_SPI_READY,
STAT_RC_READY | STAT_SPI_READY, line);
}
static int adf7242_wait_spi_ready(struct adf7242_local *lp, int line)
{
return adf7242_wait_status(lp, STAT_SPI_READY,
STAT_SPI_READY, line);
}
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/module.h`, `linux/interrupt.h`, `linux/delay.h`, `linux/mutex.h`, `linux/workqueue.h`, `linux/spinlock.h`, `linux/firmware.h`.
- Detected declarations: `struct adf7242_local`, `function adf7242_status`, `function adf7242_wait_status`, `function adf7242_wait_rc_ready`, `function adf7242_wait_spi_ready`, `function adf7242_write_fbuf`, `function adf7242_read_fbuf`, `function adf7242_read_reg`, `function adf7242_write_reg`, `function adf7242_cmd`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.