drivers/media/dvb-frontends/stb6100.c
Source file repositories/reference/linux-study-clean/drivers/media/dvb-frontends/stb6100.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/dvb-frontends/stb6100.c- Extension
.c- Size
- 15196 bytes
- Lines
- 566
- 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/init.hlinux/kernel.hlinux/module.hlinux/slab.hlinux/string.hmedia/dvb_frontend.hstb6100.h
Detected Declarations
struct stb6100_lkupstruct stb6100_regmaskfunction stb6100_normalise_regsfunction stb6100_read_regsfunction stb6100_read_regfunction stb6100_write_reg_rangefunction stb6100_write_regfunction stb6100_get_statusfunction stb6100_get_bandwidthfunction stb6100_set_bandwidthfunction stb6100_get_frequencyfunction stb6100_set_frequencyfunction stb6100_sleepfunction stb6100_initfunction stb6100_set_paramsfunction stb6100_releaseexport stb6100_attach
Annotated Snippet
struct stb6100_lkup {
u32 val_low;
u32 val_high;
u8 reg;
};
static void stb6100_release(struct dvb_frontend *fe);
static const struct stb6100_lkup lkup[] = {
{ 0, 950000, 0x0a },
{ 950000, 1000000, 0x0a },
{ 1000000, 1075000, 0x0c },
{ 1075000, 1200000, 0x00 },
{ 1200000, 1300000, 0x01 },
{ 1300000, 1370000, 0x02 },
{ 1370000, 1470000, 0x04 },
{ 1470000, 1530000, 0x05 },
{ 1530000, 1650000, 0x06 },
{ 1650000, 1800000, 0x08 },
{ 1800000, 1950000, 0x0a },
{ 1950000, 2150000, 0x0c },
{ 2150000, 9999999, 0x0c },
{ 0, 0, 0x00 }
};
/* Register names for easy debugging. */
static const char *stb6100_regnames[] = {
[STB6100_LD] = "LD",
[STB6100_VCO] = "VCO",
[STB6100_NI] = "NI",
[STB6100_NF_LSB] = "NF",
[STB6100_K] = "K",
[STB6100_G] = "G",
[STB6100_F] = "F",
[STB6100_DLB] = "DLB",
[STB6100_TEST1] = "TEST1",
[STB6100_FCCK] = "FCCK",
[STB6100_LPEN] = "LPEN",
[STB6100_TEST3] = "TEST3",
};
/* Template for normalisation, i.e. setting unused or undocumented
* bits as required according to the documentation.
*/
struct stb6100_regmask {
u8 mask;
u8 set;
};
static const struct stb6100_regmask stb6100_template[] = {
[STB6100_LD] = { 0xff, 0x00 },
[STB6100_VCO] = { 0xff, 0x00 },
[STB6100_NI] = { 0xff, 0x00 },
[STB6100_NF_LSB] = { 0xff, 0x00 },
[STB6100_K] = { 0xc7, 0x38 },
[STB6100_G] = { 0xef, 0x10 },
[STB6100_F] = { 0x1f, 0xc0 },
[STB6100_DLB] = { 0x38, 0xc4 },
[STB6100_TEST1] = { 0x00, 0x8f },
[STB6100_FCCK] = { 0x40, 0x0d },
[STB6100_LPEN] = { 0xf0, 0x0b },
[STB6100_TEST3] = { 0x00, 0xde },
};
/*
* Currently unused. Some boards might need it in the future
*/
static __always_unused inline void stb6100_normalise_regs(u8 regs[])
{
int i;
for (i = 0; i < STB6100_NUMREGS; i++)
regs[i] = (regs[i] & stb6100_template[i].mask) | stb6100_template[i].set;
}
static int stb6100_read_regs(struct stb6100_state *state, u8 regs[])
{
int rc;
struct i2c_msg msg = {
.addr = state->config->tuner_address,
.flags = I2C_M_RD,
.buf = regs,
.len = STB6100_NUMREGS
};
rc = i2c_transfer(state->i2c, &msg, 1);
if (unlikely(rc != 1)) {
dprintk(verbose, FE_ERROR, 1, "Read (0x%x) err, rc=[%d]",
state->config->tuner_address, rc);
Annotation
- Immediate include surface: `linux/init.h`, `linux/kernel.h`, `linux/module.h`, `linux/slab.h`, `linux/string.h`, `media/dvb_frontend.h`, `stb6100.h`.
- Detected declarations: `struct stb6100_lkup`, `struct stb6100_regmask`, `function stb6100_normalise_regs`, `function stb6100_read_regs`, `function stb6100_read_reg`, `function stb6100_write_reg_range`, `function stb6100_write_reg`, `function stb6100_get_status`, `function stb6100_get_bandwidth`, `function stb6100_set_bandwidth`.
- 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.