drivers/net/ieee802154/ca8210.c
Source file repositories/reference/linux-study-clean/drivers/net/ieee802154/ca8210.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/ieee802154/ca8210.c- Extension
.c- Size
- 84282 bytes
- Lines
- 3163
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- 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/cdev.hlinux/clk-provider.hlinux/debugfs.hlinux/delay.hlinux/gpio/consumer.hlinux/ieee802154.hlinux/io.hlinux/kfifo.hlinux/of.hlinux/module.hlinux/mutex.hlinux/poll.hlinux/skbuff.hlinux/slab.hlinux/spi/spi.hlinux/spinlock.hlinux/string.hlinux/workqueue.hlinux/interrupt.hnet/ieee802154_netdev.hnet/mac802154.h
Detected Declarations
struct cas_controlstruct ca8210_teststruct ca8210_privstruct work_priv_containerstruct ca8210_platform_datastruct fulladdrstruct secspecstruct mcps_data_request_psetstruct mlme_set_request_psetstruct hwme_set_request_psetstruct hwme_get_request_psetstruct tdme_setsfr_request_psetstruct hwme_set_confirm_psetstruct hwme_get_confirm_psetstruct tdme_setsfr_confirm_psetstruct mac_messagestruct preamble_cfg_sfrfunction link_to_linux_errfunction ca8210_test_int_driver_writefunction ca8210_reset_sendfunction ca8210_mlme_reset_workerfunction ca8210_rx_donefunction ca8210_spi_transfer_completefunction ca8210_spi_transferfunction ca8210_spi_exchangefunction ca8210_interrupt_handlerfunction tdme_setsfr_request_syncfunction tdme_chipinitfunction tdme_channelinitfunction tdme_checkpibattributefunction tdme_settxpowerfunction mcps_data_requestfunction mlme_reset_request_syncfunction mlme_set_request_syncfunction hwme_set_request_syncfunction hwme_get_request_syncfunction ca8210_async_xmit_completefunction ca8210_skb_rxfunction ca8210_net_rxfunction ca8210_skb_txfunction ca8210_startfunction ca8210_stopfunction ca8210_get_edfunction ca8210_set_channelfunction ca8210_set_hw_addr_filtfunction ca8210_set_tx_powerfunction ca8210_set_cca_modefunction ca8210_set_cca_ed_level
Annotated Snippet
static const struct file_operations test_int_fops = {
.read = ca8210_test_int_user_read,
.write = ca8210_test_int_user_write,
.open = ca8210_test_int_open,
.release = NULL,
.unlocked_ioctl = ca8210_test_int_ioctl,
.poll = ca8210_test_int_poll
};
/* Init/Deinit */
/**
* ca8210_get_platform_data() - Populate a ca8210_platform_data object
* @spi_device: Pointer to ca8210 spi device object to get data for
* @pdata: Pointer to ca8210_platform_data object to populate
*
* Return: 0 or linux error code
*/
static int ca8210_get_platform_data(
struct spi_device *spi_device,
struct ca8210_platform_data *pdata
)
{
int ret = 0;
if (!spi_device->dev.of_node)
return -EINVAL;
pdata->extclockenable = of_property_read_bool(
spi_device->dev.of_node,
"extclock-enable"
);
if (pdata->extclockenable) {
ret = of_property_read_u32(
spi_device->dev.of_node,
"extclock-freq",
&pdata->extclockfreq
);
if (ret < 0)
return ret;
ret = of_property_read_u32(
spi_device->dev.of_node,
"extclock-gpio",
&pdata->extclockgpio
);
}
return ret;
}
/**
* ca8210_config_extern_clk() - Configure the external clock provided by the
* ca8210
* @pdata: Pointer to ca8210_platform_data containing clock parameters
* @spi: Pointer to target ca8210 spi device
* @on: True to turn the clock on, false to turn off
*
* The external clock is configured with a frequency and output pin taken from
* the platform data.
*
* Return: 0 or linux error code
*/
static int ca8210_config_extern_clk(
struct ca8210_platform_data *pdata,
struct spi_device *spi,
bool on
)
{
u8 clkparam[2];
if (on) {
dev_info(&spi->dev, "Switching external clock on\n");
switch (pdata->extclockfreq) {
case SIXTEEN_MHZ:
clkparam[0] = 1;
break;
case EIGHT_MHZ:
clkparam[0] = 2;
break;
case FOUR_MHZ:
clkparam[0] = 3;
break;
case TWO_MHZ:
clkparam[0] = 4;
break;
case ONE_MHZ:
clkparam[0] = 5;
break;
default:
Annotation
- Immediate include surface: `linux/cdev.h`, `linux/clk-provider.h`, `linux/debugfs.h`, `linux/delay.h`, `linux/gpio/consumer.h`, `linux/ieee802154.h`, `linux/io.h`, `linux/kfifo.h`.
- Detected declarations: `struct cas_control`, `struct ca8210_test`, `struct ca8210_priv`, `struct work_priv_container`, `struct ca8210_platform_data`, `struct fulladdr`, `struct secspec`, `struct mcps_data_request_pset`, `struct mlme_set_request_pset`, `struct hwme_set_request_pset`.
- Atlas domain: Driver Families / drivers/net.
- Implementation status: pattern implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- 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.