drivers/media/usb/dvb-usb/cinergyT2-fe.c
Source file repositories/reference/linux-study-clean/drivers/media/usb/dvb-usb/cinergyT2-fe.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/usb/dvb-usb/cinergyT2-fe.c- Extension
.c- Size
- 7002 bytes
- Lines
- 317
- 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.
- 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
cinergyT2.h
Detected Declarations
struct cinergyt2_fe_statefunction Copyrightfunction cinergyt2_fe_read_statusfunction cinergyt2_fe_read_berfunction cinergyt2_fe_read_unc_blocksfunction cinergyt2_fe_read_signal_strengthfunction cinergyt2_fe_read_snrfunction cinergyt2_fe_initfunction cinergyt2_fe_sleepfunction cinergyt2_fe_get_tune_settingsfunction cinergyt2_fe_set_frontendfunction cinergyt2_fe_release
Annotated Snippet
struct cinergyt2_fe_state {
struct dvb_frontend fe;
struct dvb_usb_device *d;
unsigned char data[64];
struct mutex data_mutex;
struct dvbt_get_status_msg status;
};
static int cinergyt2_fe_read_status(struct dvb_frontend *fe,
enum fe_status *status)
{
struct cinergyt2_fe_state *state = fe->demodulator_priv;
int ret;
mutex_lock(&state->data_mutex);
state->data[0] = CINERGYT2_EP1_GET_TUNER_STATUS;
ret = dvb_usb_generic_rw(state->d, state->data, 1,
state->data, sizeof(state->status), 0);
if (!ret)
memcpy(&state->status, state->data, sizeof(state->status));
mutex_unlock(&state->data_mutex);
if (ret < 0)
return ret;
*status = 0;
if (0xffff - le16_to_cpu(state->status.gain) > 30)
*status |= FE_HAS_SIGNAL;
if (state->status.lock_bits & (1 << 6))
*status |= FE_HAS_LOCK;
if (state->status.lock_bits & (1 << 5))
*status |= FE_HAS_SYNC;
if (state->status.lock_bits & (1 << 4))
*status |= FE_HAS_CARRIER;
if (state->status.lock_bits & (1 << 1))
*status |= FE_HAS_VITERBI;
if ((*status & (FE_HAS_CARRIER | FE_HAS_VITERBI | FE_HAS_SYNC)) !=
(FE_HAS_CARRIER | FE_HAS_VITERBI | FE_HAS_SYNC))
*status &= ~FE_HAS_LOCK;
return 0;
}
static int cinergyt2_fe_read_ber(struct dvb_frontend *fe, u32 *ber)
{
struct cinergyt2_fe_state *state = fe->demodulator_priv;
*ber = le32_to_cpu(state->status.viterbi_error_rate);
return 0;
}
static int cinergyt2_fe_read_unc_blocks(struct dvb_frontend *fe, u32 *unc)
{
struct cinergyt2_fe_state *state = fe->demodulator_priv;
*unc = le32_to_cpu(state->status.uncorrected_block_count);
return 0;
}
static int cinergyt2_fe_read_signal_strength(struct dvb_frontend *fe,
u16 *strength)
{
struct cinergyt2_fe_state *state = fe->demodulator_priv;
*strength = (0xffff - le16_to_cpu(state->status.gain));
return 0;
}
static int cinergyt2_fe_read_snr(struct dvb_frontend *fe, u16 *snr)
{
struct cinergyt2_fe_state *state = fe->demodulator_priv;
*snr = (state->status.snr << 8) | state->status.snr;
return 0;
}
static int cinergyt2_fe_init(struct dvb_frontend *fe)
{
return 0;
}
static int cinergyt2_fe_sleep(struct dvb_frontend *fe)
{
deb_info("cinergyt2_fe_sleep() Called\n");
return 0;
Annotation
- Immediate include surface: `cinergyT2.h`.
- Detected declarations: `struct cinergyt2_fe_state`, `function Copyright`, `function cinergyt2_fe_read_status`, `function cinergyt2_fe_read_ber`, `function cinergyt2_fe_read_unc_blocks`, `function cinergyt2_fe_read_signal_strength`, `function cinergyt2_fe_read_snr`, `function cinergyt2_fe_init`, `function cinergyt2_fe_sleep`, `function cinergyt2_fe_get_tune_settings`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: source 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.