drivers/media/dvb-frontends/ves1820.c
Source file repositories/reference/linux-study-clean/drivers/media/dvb-frontends/ves1820.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/dvb-frontends/ves1820.c- Extension
.c- Size
- 10864 bytes
- Lines
- 438
- 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
linux/delay.hlinux/errno.hlinux/init.hlinux/kernel.hlinux/module.hlinux/string.hlinux/slab.hasm/div64.hmedia/dvb_frontend.hves1820.h
Detected Declarations
struct ves1820_statefunction ves1820_writeregfunction ves1820_readregfunction ves1820_setup_reg0function ves1820_set_symbolratefunction ves1820_initfunction ves1820_set_parametersfunction ves1820_read_statusfunction ves1820_read_berfunction ves1820_read_signal_strengthfunction ves1820_read_snrfunction ves1820_read_ucblocksfunction ves1820_get_frontendfunction ves1820_sleepfunction ves1820_get_tune_settingsfunction ves1820_releasefunction ves1820_attachexport ves1820_attach
Annotated Snippet
struct ves1820_state {
struct i2c_adapter* i2c;
/* configuration settings */
const struct ves1820_config* config;
struct dvb_frontend frontend;
/* private demodulator data */
u8 reg0;
u8 pwm;
};
static int verbose;
static u8 ves1820_inittab[] = {
0x69, 0x6A, 0x93, 0x1A, 0x12, 0x46, 0x26, 0x1A,
0x43, 0x6A, 0xAA, 0xAA, 0x1E, 0x85, 0x43, 0x20,
0xE0, 0x00, 0xA1, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00,
0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x40
};
static int ves1820_writereg(struct ves1820_state *state, u8 reg, u8 data)
{
u8 buf[] = { 0x00, reg, data };
struct i2c_msg msg = {.addr = state->config->demod_address,.flags = 0,.buf = buf,.len = 3 };
int ret;
ret = i2c_transfer(state->i2c, &msg, 1);
if (ret != 1)
printk("ves1820: %s(): writereg error (reg == 0x%02x, val == 0x%02x, ret == %i)\n",
__func__, reg, data, ret);
return (ret != 1) ? -EREMOTEIO : 0;
}
static u8 ves1820_readreg(struct ves1820_state *state, u8 reg)
{
u8 b0[] = { 0x00, reg };
u8 b1[] = { 0 };
struct i2c_msg msg[] = {
{.addr = state->config->demod_address,.flags = 0,.buf = b0,.len = 2},
{.addr = state->config->demod_address,.flags = I2C_M_RD,.buf = b1,.len = 1}
};
int ret;
ret = i2c_transfer(state->i2c, msg, 2);
if (ret != 2)
printk("ves1820: %s(): readreg error (reg == 0x%02x, ret == %i)\n",
__func__, reg, ret);
return b1[0];
}
static int ves1820_setup_reg0(struct ves1820_state *state,
u8 reg0, enum fe_spectral_inversion inversion)
{
reg0 |= state->reg0 & 0x62;
if (INVERSION_ON == inversion) {
if (!state->config->invert) reg0 |= 0x20;
else reg0 &= ~0x20;
} else if (INVERSION_OFF == inversion) {
if (!state->config->invert) reg0 &= ~0x20;
else reg0 |= 0x20;
}
ves1820_writereg(state, 0x00, reg0 & 0xfe);
ves1820_writereg(state, 0x00, reg0 | 0x01);
state->reg0 = reg0;
return 0;
}
static int ves1820_set_symbolrate(struct ves1820_state *state, u32 symbolrate)
{
s32 BDR;
s32 BDRI;
s16 SFIL = 0;
u16 NDEC = 0;
u32 ratio;
u32 fin;
u32 tmp;
u64 fptmp;
u64 fpxin;
Annotation
- Immediate include surface: `linux/delay.h`, `linux/errno.h`, `linux/init.h`, `linux/kernel.h`, `linux/module.h`, `linux/string.h`, `linux/slab.h`, `asm/div64.h`.
- Detected declarations: `struct ves1820_state`, `function ves1820_writereg`, `function ves1820_readreg`, `function ves1820_setup_reg0`, `function ves1820_set_symbolrate`, `function ves1820_init`, `function ves1820_set_parameters`, `function ves1820_read_status`, `function ves1820_read_ber`, `function ves1820_read_signal_strength`.
- 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.