drivers/media/dvb-frontends/m88ds3103.c
Source file repositories/reference/linux-study-clean/drivers/media/dvb-frontends/m88ds3103.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/dvb-frontends/m88ds3103.c- Extension
.c- Size
- 51441 bytes
- Lines
- 2250
- Domain
- Driver Families
- Bucket
- drivers/media
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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
m88ds3103_priv.h
Detected Declarations
function m88ds3103_update_bitsfunction m88ds3103_wr_reg_val_tabfunction m88ds3103b_dt_writefunction m88ds3103b_dt_readfunction m88ds3103_get_agc_pwmfunction m88ds3103_read_statusfunction m88ds3103b_select_mclkfunction m88ds3103b_set_mclkfunction mt_fe_dmd_ds3103c_set_ts_out_modefunction m88ds3103_set_frontendfunction m88ds3103_initfunction m88ds3103_sleepfunction m88ds3103_get_frontendfunction m88ds3103_read_snrfunction m88ds3103_read_berfunction m88ds3103_set_tonefunction m88ds3103_set_voltagefunction m88ds3103_diseqc_send_master_cmdfunction m88ds3103_diseqc_send_burstfunction m88ds3103_get_tune_settingsfunction m88ds3103_releasefunction m88ds3103_selectfunction m88ds3103_probefunction m88ds3103_removeexport m88ds3103_get_agc_pwmexport m88ds3103_attach
Annotated Snippet
if (dev->chiptype == M88DS3103_CHIPTYPE_3103C) {
ret = regmap_read(dev->regmap, 0x0d, &utmp);
if (ret)
goto err;
if ((utmp & 0xf7) == 0xf7)
*status = FE_HAS_SIGNAL | FE_HAS_CARRIER |
FE_HAS_VITERBI | FE_HAS_SYNC |
FE_HAS_LOCK;
} else {
ret = regmap_read(dev->regmap, 0xd1, &utmp);
if (ret)
goto err;
if ((utmp & 0x07) == 0x07)
*status = FE_HAS_SIGNAL | FE_HAS_CARRIER |
FE_HAS_VITERBI | FE_HAS_SYNC |
FE_HAS_LOCK;
}
break;
case SYS_DVBS2:
ret = regmap_read(dev->regmap, 0x0d, &utmp);
if (ret)
goto err;
if ((utmp & 0x8f) == 0x8f)
*status = FE_HAS_SIGNAL | FE_HAS_CARRIER |
FE_HAS_VITERBI | FE_HAS_SYNC |
FE_HAS_LOCK;
break;
default:
dev_dbg(&client->dev, "invalid delivery_system\n");
ret = -EINVAL;
goto err;
}
dev->fe_status = *status;
dev_dbg(&client->dev, "lock=%02x status=%02x\n", utmp, *status);
/* CNR */
if (dev->fe_status & FE_HAS_VITERBI) {
unsigned int cnr, noise, signal, noise_tot, signal_tot;
cnr = 0;
/* more iterations for more accurate estimation */
#define M88DS3103_SNR_ITERATIONS 3
switch (c->delivery_system) {
case SYS_DVBS:
itmp = 0;
for (i = 0; i < M88DS3103_SNR_ITERATIONS; i++) {
ret = regmap_read(dev->regmap, 0xff, &utmp);
if (ret)
goto err;
itmp += utmp;
}
/* use of single register limits max value to 15 dB */
/* SNR(X) dB = 10 * ln(X) / ln(10) dB */
itmp = DIV_ROUND_CLOSEST(itmp, 8 * M88DS3103_SNR_ITERATIONS);
if (itmp)
cnr = div_u64((u64) 10000 * intlog2(itmp), intlog2(10));
break;
case SYS_DVBS2:
noise_tot = 0;
signal_tot = 0;
for (i = 0; i < M88DS3103_SNR_ITERATIONS; i++) {
ret = regmap_bulk_read(dev->regmap, 0x8c, buf, 3);
if (ret)
goto err;
noise = buf[1] << 6; /* [13:6] */
noise |= buf[0] & 0x3f; /* [5:0] */
noise >>= 2;
signal = buf[2] * buf[2];
signal >>= 1;
noise_tot += noise;
signal_tot += signal;
}
noise = noise_tot / M88DS3103_SNR_ITERATIONS;
signal = signal_tot / M88DS3103_SNR_ITERATIONS;
/* SNR(X) dB = 10 * log10(X) dB */
if (signal > noise) {
itmp = signal / noise;
Annotation
- Immediate include surface: `m88ds3103_priv.h`.
- Detected declarations: `function m88ds3103_update_bits`, `function m88ds3103_wr_reg_val_tab`, `function m88ds3103b_dt_write`, `function m88ds3103b_dt_read`, `function m88ds3103_get_agc_pwm`, `function m88ds3103_read_status`, `function m88ds3103b_select_mclk`, `function m88ds3103b_set_mclk`, `function mt_fe_dmd_ds3103c_set_ts_out_mode`, `function m88ds3103_set_frontend`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: integration 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.