drivers/media/dvb-frontends/bcm3510.c
Source file repositories/reference/linux-study-clean/drivers/media/dvb-frontends/bcm3510.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/dvb-frontends/bcm3510.c- Extension
.c- Size
- 22216 bytes
- Lines
- 870
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/firmware.hlinux/jiffies.hlinux/string.hlinux/slab.hlinux/mutex.hmedia/dvb_frontend.hbcm3510.hbcm3510_priv.h
Detected Declarations
struct bcm3510_statefunction bcm3510_writebytesfunction bcm3510_readbytesfunction bcm3510_writeBfunction bcm3510_readBfunction bcm3510_hab_get_responsefunction bcm3510_hab_send_requestfunction bcm3510_do_hab_cmdfunction bcm3510_is_ap_readyfunction bcm3510_bert_resetfunction bcm3510_refresh_statefunction bcm3510_read_statusfunction bcm3510_read_berfunction bcm3510_read_uncfunction bcm3510_read_signal_strengthfunction bcm3510_read_snrfunction bcm3510_tuner_cmdfunction bcm3510_set_freqfunction bcm3510_set_frontendfunction bcm3510_sleepfunction bcm3510_get_tune_settingsfunction bcm3510_releasefunction bcm3510_write_ramfunction bcm3510_download_firmwarefunction bcm3510_check_firmware_versionfunction bcm3510_resetfunction bcm3510_clear_resetfunction bcm3510_init_coldfunction bcm3510_initfunction bcm3510_attachexport bcm3510_attach
Annotated Snippet
struct bcm3510_state {
struct i2c_adapter* i2c;
const struct bcm3510_config* config;
struct dvb_frontend frontend;
/* demodulator private data */
struct mutex hab_mutex;
u8 firmware_loaded:1;
unsigned long next_status_check;
unsigned long status_check_interval;
struct bcm3510_hab_cmd_status1 status1;
struct bcm3510_hab_cmd_status2 status2;
};
static int debug;
module_param(debug, int, 0644);
MODULE_PARM_DESC(debug, "set debugging level (1=info,2=i2c (|-able)).");
#define dprintk(level,x...) if (level & debug) printk(x)
#define dbufout(b,l,m) {\
int i; \
for (i = 0; i < l; i++) \
m("%02x ",b[i]); \
}
#define deb_info(args...) dprintk(0x01,args)
#define deb_i2c(args...) dprintk(0x02,args)
#define deb_hab(args...) dprintk(0x04,args)
/* transfer functions */
static int bcm3510_writebytes (struct bcm3510_state *state, u8 reg, u8 *buf, u8 len)
{
u8 b[256];
int err;
struct i2c_msg msg = { .addr = state->config->demod_address, .flags = 0, .buf = b, .len = len + 1 };
b[0] = reg;
memcpy(&b[1],buf,len);
deb_i2c("i2c wr %02x: ",reg);
dbufout(buf,len,deb_i2c);
deb_i2c("\n");
if ((err = i2c_transfer (state->i2c, &msg, 1)) != 1) {
deb_info("%s: i2c write error (addr %02x, reg %02x, err == %i)\n",
__func__, state->config->demod_address, reg, err);
return -EREMOTEIO;
}
return 0;
}
static int bcm3510_readbytes (struct bcm3510_state *state, u8 reg, u8 *buf, u8 len)
{
struct i2c_msg msg[] = {
{ .addr = state->config->demod_address, .flags = 0, .buf = ®, .len = 1 },
{ .addr = state->config->demod_address, .flags = I2C_M_RD, .buf = buf, .len = len }
};
int err;
memset(buf,0,len);
if ((err = i2c_transfer (state->i2c, msg, 2)) != 2) {
deb_info("%s: i2c read error (addr %02x, reg %02x, err == %i)\n",
__func__, state->config->demod_address, reg, err);
return -EREMOTEIO;
}
deb_i2c("i2c rd %02x: ",reg);
dbufout(buf,len,deb_i2c);
deb_i2c("\n");
return 0;
}
static int bcm3510_writeB(struct bcm3510_state *state, u8 reg, bcm3510_register_value v)
{
return bcm3510_writebytes(state,reg,&v.raw,1);
}
static int bcm3510_readB(struct bcm3510_state *state, u8 reg, bcm3510_register_value *v)
{
return bcm3510_readbytes(state,reg,&v->raw,1);
}
/* Host Access Buffer transfers */
static int bcm3510_hab_get_response(struct bcm3510_state *st, u8 *buf, int len)
{
bcm3510_register_value v;
Annotation
- Immediate include surface: `linux/init.h`, `linux/module.h`, `linux/device.h`, `linux/firmware.h`, `linux/jiffies.h`, `linux/string.h`, `linux/slab.h`, `linux/mutex.h`.
- Detected declarations: `struct bcm3510_state`, `function bcm3510_writebytes`, `function bcm3510_readbytes`, `function bcm3510_writeB`, `function bcm3510_readB`, `function bcm3510_hab_get_response`, `function bcm3510_hab_send_request`, `function bcm3510_do_hab_cmd`, `function bcm3510_is_ap_ready`, `function bcm3510_bert_reset`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.