drivers/media/test-drivers/vivid/vivid-radio-common.c
Source file repositories/reference/linux-study-clean/drivers/media/test-drivers/vivid/vivid-radio-common.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/test-drivers/vivid/vivid-radio-common.c- Extension
.c- Size
- 5196 bytes
- Lines
- 178
- Domain
- Driver Families
- Bucket
- drivers/media
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/errno.hlinux/kernel.hlinux/delay.hlinux/videodev2.hvivid-core.hvivid-ctrls.hvivid-radio-common.hvivid-rds-gen.h
Detected Declarations
function vivid_radio_rds_initfunction vivid_radio_calc_sig_qualfunction vivid_radio_g_frequencyfunction vivid_radio_s_frequency
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/*
* vivid-radio-common.c - common radio rx/tx support functions.
*
* Copyright 2014 Cisco Systems, Inc. and/or its affiliates. All rights reserved.
*/
#include <linux/errno.h>
#include <linux/kernel.h>
#include <linux/delay.h>
#include <linux/videodev2.h>
#include "vivid-core.h"
#include "vivid-ctrls.h"
#include "vivid-radio-common.h"
#include "vivid-rds-gen.h"
/*
* These functions are shared between the vivid receiver and transmitter
* since both use the same frequency bands.
*/
const struct v4l2_frequency_band vivid_radio_bands[TOT_BANDS] = {
/* Band FM */
{
.type = V4L2_TUNER_RADIO,
.index = 0,
.capability = V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO |
V4L2_TUNER_CAP_FREQ_BANDS,
.rangelow = FM_FREQ_RANGE_LOW,
.rangehigh = FM_FREQ_RANGE_HIGH,
.modulation = V4L2_BAND_MODULATION_FM,
},
/* Band AM */
{
.type = V4L2_TUNER_RADIO,
.index = 1,
.capability = V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_FREQ_BANDS,
.rangelow = AM_FREQ_RANGE_LOW,
.rangehigh = AM_FREQ_RANGE_HIGH,
.modulation = V4L2_BAND_MODULATION_AM,
},
/* Band SW */
{
.type = V4L2_TUNER_RADIO,
.index = 2,
.capability = V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_FREQ_BANDS,
.rangelow = SW_FREQ_RANGE_LOW,
.rangehigh = SW_FREQ_RANGE_HIGH,
.modulation = V4L2_BAND_MODULATION_AM,
},
};
/*
* Initialize the RDS generator. If we can loop, then the RDS generator
* is set up with the values from the RDS TX controls, otherwise it
* will fill in standard values using one of two alternates.
*/
void vivid_radio_rds_init(struct vivid_dev *dev)
{
struct vivid_rds_gen *rds = &dev->rds_gen;
bool alt = dev->radio_rx_rds_use_alternates;
/* Do nothing, blocks will be filled by the transmitter */
if (dev->radio_rds_loop && !dev->radio_tx_rds_controls)
return;
if (dev->radio_rds_loop) {
v4l2_ctrl_lock(dev->radio_tx_rds_pi);
rds->picode = dev->radio_tx_rds_pi->cur.val;
rds->pty = dev->radio_tx_rds_pty->cur.val;
rds->mono_stereo = dev->radio_tx_rds_mono_stereo->cur.val;
rds->art_head = dev->radio_tx_rds_art_head->cur.val;
rds->compressed = dev->radio_tx_rds_compressed->cur.val;
rds->dyn_pty = dev->radio_tx_rds_dyn_pty->cur.val;
rds->ta = dev->radio_tx_rds_ta->cur.val;
rds->tp = dev->radio_tx_rds_tp->cur.val;
rds->ms = dev->radio_tx_rds_ms->cur.val;
strscpy(rds->psname,
dev->radio_tx_rds_psname->p_cur.p_char,
sizeof(rds->psname));
strscpy(rds->radiotext,
dev->radio_tx_rds_radiotext->p_cur.p_char + alt * 64,
sizeof(rds->radiotext));
v4l2_ctrl_unlock(dev->radio_tx_rds_pi);
} else {
vivid_rds_gen_fill(rds, dev->radio_rx_freq, alt);
}
if (dev->radio_rx_rds_controls) {
v4l2_ctrl_s_ctrl(dev->radio_rx_rds_pty, rds->pty);
Annotation
- Immediate include surface: `linux/errno.h`, `linux/kernel.h`, `linux/delay.h`, `linux/videodev2.h`, `vivid-core.h`, `vivid-ctrls.h`, `vivid-radio-common.h`, `vivid-rds-gen.h`.
- Detected declarations: `function vivid_radio_rds_init`, `function vivid_radio_calc_sig_qual`, `function vivid_radio_g_frequency`, `function vivid_radio_s_frequency`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: source 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.