drivers/media/dvb-frontends/m88rs2000.c
Source file repositories/reference/linux-study-clean/drivers/media/dvb-frontends/m88rs2000.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/dvb-frontends/m88rs2000.c- Extension
.c- Size
- 18409 bytes
- Lines
- 818
- 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/module.hlinux/device.hlinux/jiffies.hlinux/string.hlinux/slab.hlinux/types.hmedia/dvb_frontend.hm88rs2000.h
Detected Declarations
struct m88rs2000_statestruct inittabfunction m88rs2000_writeregfunction m88rs2000_readregfunction m88rs2000_get_mclkfunction m88rs2000_set_carrieroffsetfunction m88rs2000_set_symbolratefunction m88rs2000_send_diseqc_msgfunction m88rs2000_send_diseqc_burstfunction m88rs2000_set_tonefunction m88rs2000_tab_setfunction m88rs2000_set_voltagefunction m88rs2000_initfunction m88rs2000_sleepfunction m88rs2000_read_statusfunction m88rs2000_read_berfunction m88rs2000_read_signal_strengthfunction m88rs2000_read_snrfunction m88rs2000_read_ucblocksfunction m88rs2000_set_fecfunction m88rs2000_get_fecfunction m88rs2000_set_frontendfunction m88rs2000_get_frontendfunction m88rs2000_get_tune_settingsfunction m88rs2000_i2c_gate_ctrlfunction m88rs2000_releaseexport m88rs2000_attach
Annotated Snippet
struct m88rs2000_state {
struct i2c_adapter *i2c;
const struct m88rs2000_config *config;
struct dvb_frontend frontend;
u8 no_lock_count;
u32 tuner_frequency;
u32 symbol_rate;
enum fe_code_rate fec_inner;
u8 tuner_level;
int errmode;
};
static int m88rs2000_debug;
module_param_named(debug, m88rs2000_debug, int, 0644);
MODULE_PARM_DESC(debug, "set debugging level (1=info (or-able)).");
#define dprintk(level, args...) do { \
if (level & m88rs2000_debug) \
printk(KERN_DEBUG "m88rs2000-fe: " args); \
} while (0)
#define deb_info(args...) dprintk(0x01, args)
#define info(format, arg...) \
printk(KERN_INFO "m88rs2000-fe: " format "\n" , ## arg)
static int m88rs2000_writereg(struct m88rs2000_state *state,
u8 reg, u8 data)
{
int ret;
u8 buf[] = { reg, data };
struct i2c_msg msg = {
.addr = state->config->demod_addr,
.flags = 0,
.buf = buf,
.len = 2
};
ret = i2c_transfer(state->i2c, &msg, 1);
if (ret != 1)
deb_info("%s: writereg error (reg == 0x%02x, val == 0x%02x, ret == %i)\n",
__func__, reg, data, ret);
return (ret != 1) ? -EREMOTEIO : 0;
}
static u8 m88rs2000_readreg(struct m88rs2000_state *state, u8 reg)
{
int ret;
u8 b0[] = { reg };
u8 b1[] = { 0 };
struct i2c_msg msg[] = {
{
.addr = state->config->demod_addr,
.flags = 0,
.buf = b0,
.len = 1
}, {
.addr = state->config->demod_addr,
.flags = I2C_M_RD,
.buf = b1,
.len = 1
}
};
ret = i2c_transfer(state->i2c, msg, 2);
if (ret != 2)
deb_info("%s: readreg error (reg == 0x%02x, ret == %i)\n",
__func__, reg, ret);
return b1[0];
}
static u32 m88rs2000_get_mclk(struct dvb_frontend *fe)
{
struct m88rs2000_state *state = fe->demodulator_priv;
u32 mclk;
u8 reg;
/* Must not be 0x00 or 0xff */
reg = m88rs2000_readreg(state, 0x86);
if (!reg || reg == 0xff)
return 0;
reg /= 2;
reg += 1;
mclk = (u32)(reg * RS2000_FE_CRYSTAL_KHZ + 28 / 2) / 28;
Annotation
- Immediate include surface: `linux/init.h`, `linux/module.h`, `linux/device.h`, `linux/jiffies.h`, `linux/string.h`, `linux/slab.h`, `linux/types.h`, `media/dvb_frontend.h`.
- Detected declarations: `struct m88rs2000_state`, `struct inittab`, `function m88rs2000_writereg`, `function m88rs2000_readreg`, `function m88rs2000_get_mclk`, `function m88rs2000_set_carrieroffset`, `function m88rs2000_set_symbolrate`, `function m88rs2000_send_diseqc_msg`, `function m88rs2000_send_diseqc_burst`, `function m88rs2000_set_tone`.
- 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.