drivers/media/dvb-frontends/mb86a16.c
Source file repositories/reference/linux-study-clean/drivers/media/dvb-frontends/mb86a16.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/dvb-frontends/mb86a16.c- Extension
.c- Size
- 46164 bytes
- Lines
- 1860
- 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/moduleparam.hlinux/slab.hmedia/dvb_frontend.hmb86a16.hmb86a16_priv.h
Detected Declarations
struct mb86a16_statestruct cnrfunction mb86a16_writefunction mb86a16_readfunction CNTM_setfunction smrt_setfunction srstfunction afcex_data_setfunction afcofs_data_setfunction stlp_setfunction Vi_setfunction initial_setfunction S01T_setfunction EN_setfunction AFCEXEN_setfunction DAGC_data_setfunction smrt_info_getfunction signal_detfunction rf_val_setfunction afcerr_chkfunction dagcm_val_getfunction mb86a16_read_statusfunction sync_chkfunction freqerr_chkfunction vco_dev_getfunction swp_info_getfunction swp_freq_calcuationfunction swp_info_get2function afcex_info_getfunction SEQ_setfunction iq_vt_setfunction FEC_srstfunction S2T_setfunction S45T_setfunction mb86a16_set_fefunction mb86a16_send_diseqc_msgfunction mb86a16_send_diseqc_burstfunction mb86a16_set_tonefunction mb86a16_searchfunction mb86a16_releasefunction mb86a16_initfunction mb86a16_sleepfunction mb86a16_read_berfunction mb86a16_read_signal_strengthfunction mb86a16_read_snrfunction mb86a16_read_ucblocksfunction mb86a16_frontend_algoexport mb86a16_attach
Annotated Snippet
struct mb86a16_state {
struct i2c_adapter *i2c_adap;
const struct mb86a16_config *config;
struct dvb_frontend frontend;
/* tuning parameters */
int frequency;
int srate;
/* Internal stuff */
int master_clk;
int deci;
int csel;
int rsel;
};
#define MB86A16_ERROR 0
#define MB86A16_NOTICE 1
#define MB86A16_INFO 2
#define MB86A16_DEBUG 3
#define dprintk(x, y, z, format, arg...) do { \
if (z) { \
if ((x > MB86A16_ERROR) && (x > y)) \
printk(KERN_ERR "%s: " format "\n", __func__, ##arg); \
else if ((x > MB86A16_NOTICE) && (x > y)) \
printk(KERN_NOTICE "%s: " format "\n", __func__, ##arg); \
else if ((x > MB86A16_INFO) && (x > y)) \
printk(KERN_INFO "%s: " format "\n", __func__, ##arg); \
else if ((x > MB86A16_DEBUG) && (x > y)) \
printk(KERN_DEBUG "%s: " format "\n", __func__, ##arg); \
} else { \
if (x > y) \
printk(format, ##arg); \
} \
} while (0)
#define TRACE_IN dprintk(verbose, MB86A16_DEBUG, 1, "-->()")
#define TRACE_OUT dprintk(verbose, MB86A16_DEBUG, 1, "()-->")
static int mb86a16_write(struct mb86a16_state *state, u8 reg, u8 val)
{
int ret;
u8 buf[] = { reg, val };
struct i2c_msg msg = {
.addr = state->config->demod_address,
.flags = 0,
.buf = buf,
.len = 2
};
dprintk(verbose, MB86A16_DEBUG, 1,
"writing to [0x%02x],Reg[0x%02x],Data[0x%02x]",
state->config->demod_address, buf[0], buf[1]);
ret = i2c_transfer(state->i2c_adap, &msg, 1);
return (ret != 1) ? -EREMOTEIO : 0;
}
static int mb86a16_read(struct mb86a16_state *state, u8 reg, u8 *val)
{
int ret;
u8 b0[] = { reg };
u8 b1[] = { 0 };
struct i2c_msg msg[] = {
{
.addr = state->config->demod_address,
.flags = 0,
.buf = b0,
.len = 1
}, {
.addr = state->config->demod_address,
.flags = I2C_M_RD,
.buf = b1,
.len = 1
}
};
ret = i2c_transfer(state->i2c_adap, msg, 2);
if (ret != 2) {
dprintk(verbose, MB86A16_ERROR, 1, "read error(reg=0x%02x, ret=%i)",
reg, ret);
if (ret < 0)
return ret;
return -EREMOTEIO;
}
*val = b1[0];
Annotation
- Immediate include surface: `linux/init.h`, `linux/kernel.h`, `linux/module.h`, `linux/moduleparam.h`, `linux/slab.h`, `media/dvb_frontend.h`, `mb86a16.h`, `mb86a16_priv.h`.
- Detected declarations: `struct mb86a16_state`, `struct cnr`, `function mb86a16_write`, `function mb86a16_read`, `function CNTM_set`, `function smrt_set`, `function srst`, `function afcex_data_set`, `function afcofs_data_set`, `function stlp_set`.
- 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.