drivers/media/dvb-frontends/tda10071.c
Source file repositories/reference/linux-study-clean/drivers/media/dvb-frontends/tda10071.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/dvb-frontends/tda10071.c- Extension
.c- Size
- 27823 bytes
- Lines
- 1254
- 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
tda10071_priv.h
Detected Declarations
function tda10071_wr_reg_maskfunction tda10071_cmd_executefunction tda10071_set_tonefunction tda10071_set_voltagefunction tda10071_diseqc_send_master_cmdfunction tda10071_diseqc_recv_slave_replyfunction tda10071_diseqc_send_burstfunction tda10071_read_statusfunction tda10071_read_snrfunction tda10071_read_signal_strengthfunction tda10071_read_berfunction tda10071_read_ucblocksfunction tda10071_set_frontendfunction tda10071_get_frontendfunction tda10071_initfunction tda10071_sleepfunction tda10071_get_tune_settingsfunction tda10071_probefunction tda10071_remove
Annotated Snippet
switch (dev->delivery_system) {
case SYS_DVBS:
reg = 0x4c;
len = 8;
delivery_system = 1;
break;
case SYS_DVBS2:
reg = 0x4d;
len = 4;
delivery_system = 0;
break;
default:
ret = -EINVAL;
goto error;
}
ret = regmap_read(dev->regmap, reg, &uitmp);
if (ret)
goto error;
if (dev->meas_count == uitmp) {
dev_dbg(&client->dev, "meas not ready=%02x\n", uitmp);
ret = 0;
goto error;
} else {
dev->meas_count = uitmp;
}
cmd.args[0] = CMD_BER_UPDATE_COUNTERS;
cmd.args[1] = 0;
cmd.args[2] = delivery_system;
cmd.len = 3;
ret = tda10071_cmd_execute(dev, &cmd);
if (ret)
goto error;
ret = regmap_bulk_read(dev->regmap, cmd.len, buf, len);
if (ret)
goto error;
if (dev->delivery_system == SYS_DVBS) {
u32 bit_error = buf[0] << 24 | buf[1] << 16 |
buf[2] << 8 | buf[3] << 0;
dev->dvbv3_ber = bit_error;
dev->post_bit_error += bit_error;
c->post_bit_error.stat[0].scale = FE_SCALE_COUNTER;
c->post_bit_error.stat[0].uvalue = dev->post_bit_error;
dev->block_error += buf[4] << 8 | buf[5] << 0;
c->block_error.stat[0].scale = FE_SCALE_COUNTER;
c->block_error.stat[0].uvalue = dev->block_error;
} else {
dev->dvbv3_ber = buf[0] << 8 | buf[1] << 0;
dev->post_bit_error += buf[0] << 8 | buf[1] << 0;
c->post_bit_error.stat[0].scale = FE_SCALE_COUNTER;
c->post_bit_error.stat[0].uvalue = dev->post_bit_error;
c->block_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
}
} else {
c->post_bit_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
c->block_error.stat[0].scale = FE_SCALE_NOT_AVAILABLE;
}
return ret;
error:
dev_dbg(&client->dev, "failed=%d\n", ret);
return ret;
}
static int tda10071_read_snr(struct dvb_frontend *fe, u16 *snr)
{
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
if (c->cnr.stat[0].scale == FE_SCALE_DECIBEL)
*snr = div_s64(c->cnr.stat[0].svalue, 100);
else
*snr = 0;
return 0;
}
static int tda10071_read_signal_strength(struct dvb_frontend *fe, u16 *strength)
{
struct dtv_frontend_properties *c = &fe->dtv_property_cache;
unsigned int uitmp;
if (c->strength.stat[0].scale == FE_SCALE_DECIBEL) {
uitmp = div_s64(c->strength.stat[0].svalue, 1000) + 256;
uitmp = clamp(uitmp, 181U, 236U); /* -75dBm - -20dBm */
/* scale value to 0x0000-0xffff */
*strength = (uitmp-181) * 0xffff / (236-181);
Annotation
- Immediate include surface: `tda10071_priv.h`.
- Detected declarations: `function tda10071_wr_reg_mask`, `function tda10071_cmd_execute`, `function tda10071_set_tone`, `function tda10071_set_voltage`, `function tda10071_diseqc_send_master_cmd`, `function tda10071_diseqc_recv_slave_reply`, `function tda10071_diseqc_send_burst`, `function tda10071_read_status`, `function tda10071_read_snr`, `function tda10071_read_signal_strength`.
- 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.