drivers/media/radio/radio-si476x.c
Source file repositories/reference/linux-study-clean/drivers/media/radio/radio-si476x.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/radio/radio-si476x.c- Extension
.c- Size
- 39786 bytes
- Lines
- 1524
- Domain
- Driver Families
- Bucket
- drivers/media
- 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.
- 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/delay.hlinux/interrupt.hlinux/slab.hlinux/atomic.hlinux/videodev2.hlinux/mutex.hlinux/debugfs.hmedia/v4l2-common.hmedia/v4l2-ioctl.hmedia/v4l2-ctrls.hmedia/v4l2-event.hmedia/v4l2-device.hmedia/drv-intf/si476x.hlinux/mfd/si476x-core.h
Detected Declarations
struct si476x_radiostruct si476x_radio_opsstruct si476x_radioenum si476x_freq_bandsenum phase_diversity_modes_idxenum si476x_ctrl_idxfunction si476x_radio_freq_is_inside_of_the_bandfunction si476x_radio_range_is_inside_of_the_bandfunction si476x_phase_diversity_mode_to_idxfunction si476x_phase_diversity_idx_to_modefunction v4l2_ctrl_handler_to_radiofunction si476x_radio_querycapfunction si476x_radio_enum_freq_bandsfunction si476x_radio_g_tunerfunction si476x_radio_s_tunerfunction si476x_radio_init_vtablefunction si476x_radio_pretunefunction si476x_radio_do_post_powerup_initfunction si476x_radio_change_funcfunction si476x_radio_g_frequencyfunction si476x_radio_s_frequencyfunction si476x_radio_s_hw_freq_seekfunction si476x_radio_range_is_inside_of_the_bandfunction si476x_radio_g_volatile_ctrlfunction si476x_radio_s_ctrlfunction si476x_radio_g_registerfunction si476x_radio_s_registerfunction si476x_radio_fops_openfunction si476x_radio_fops_releasefunction si476x_radio_fops_readfunction si476x_radio_fops_pollfunction si476x_radio_read_acf_blobfunction si476x_radio_read_rds_blckcnt_blobfunction si476x_radio_read_agc_blobfunction si476x_radio_read_rsq_blobfunction si476x_radio_read_rsq_primary_blobfunction si476x_radio_init_debugfsfunction si476x_radio_add_new_customfunction si476x_radio_probefunction si476x_radio_remove
Annotated Snippet
static const struct file_operations radio_acf_fops = {
.open = simple_open,
.llseek = default_llseek,
.read = si476x_radio_read_acf_blob,
};
static ssize_t si476x_radio_read_rds_blckcnt_blob(struct file *file,
char __user *user_buf,
size_t count, loff_t *ppos)
{
int err;
struct si476x_radio *radio = file->private_data;
struct si476x_rds_blockcount_report report;
si476x_core_lock(radio->core);
if (radio->ops->rds_blckcnt)
err = radio->ops->rds_blckcnt(radio->core, true,
&report);
else
err = -ENOENT;
si476x_core_unlock(radio->core);
if (err < 0)
return err;
return simple_read_from_buffer(user_buf, count, ppos, &report,
sizeof(report));
}
static const struct file_operations radio_rds_blckcnt_fops = {
.open = simple_open,
.llseek = default_llseek,
.read = si476x_radio_read_rds_blckcnt_blob,
};
static ssize_t si476x_radio_read_agc_blob(struct file *file,
char __user *user_buf,
size_t count, loff_t *ppos)
{
int err;
struct si476x_radio *radio = file->private_data;
struct si476x_agc_status_report report;
si476x_core_lock(radio->core);
if (radio->ops->rds_blckcnt)
err = radio->ops->agc_status(radio->core, &report);
else
err = -ENOENT;
si476x_core_unlock(radio->core);
if (err < 0)
return err;
return simple_read_from_buffer(user_buf, count, ppos, &report,
sizeof(report));
}
static const struct file_operations radio_agc_fops = {
.open = simple_open,
.llseek = default_llseek,
.read = si476x_radio_read_agc_blob,
};
static ssize_t si476x_radio_read_rsq_blob(struct file *file,
char __user *user_buf,
size_t count, loff_t *ppos)
{
int err;
struct si476x_radio *radio = file->private_data;
struct si476x_rsq_status_report report;
struct si476x_rsq_status_args args = {
.primary = false,
.rsqack = false,
.attune = false,
.cancel = false,
.stcack = false,
};
si476x_core_lock(radio->core);
if (radio->ops->rds_blckcnt)
err = radio->ops->rsq_status(radio->core, &args, &report);
else
err = -ENOENT;
si476x_core_unlock(radio->core);
if (err < 0)
return err;
return simple_read_from_buffer(user_buf, count, ppos, &report,
sizeof(report));
Annotation
- Immediate include surface: `linux/module.h`, `linux/delay.h`, `linux/interrupt.h`, `linux/slab.h`, `linux/atomic.h`, `linux/videodev2.h`, `linux/mutex.h`, `linux/debugfs.h`.
- Detected declarations: `struct si476x_radio`, `struct si476x_radio_ops`, `struct si476x_radio`, `enum si476x_freq_bands`, `enum phase_diversity_modes_idx`, `enum si476x_ctrl_idx`, `function si476x_radio_freq_is_inside_of_the_band`, `function si476x_radio_range_is_inside_of_the_band`, `function si476x_phase_diversity_mode_to_idx`, `function si476x_phase_diversity_idx_to_mode`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: pattern 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.