drivers/media/dvb-frontends/nxt6000.c
Source file repositories/reference/linux-study-clean/drivers/media/dvb-frontends/nxt6000.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/dvb-frontends/nxt6000.c- Extension
.c- Size
- 14949 bytes
- Lines
- 625
- 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/string.hlinux/slab.hmedia/dvb_frontend.hnxt6000_priv.hnxt6000.h
Detected Declarations
struct nxt6000_statefunction nxt6000_writeregfunction nxt6000_readregfunction nxt6000_resetfunction nxt6000_set_bandwidthfunction nxt6000_set_guard_intervalfunction nxt6000_set_inversionfunction nxt6000_set_transmission_modefunction nxt6000_setupfunction nxt6000_dump_statusfunction nxt6000_read_statusfunction nxt6000_initfunction nxt6000_set_frontendfunction nxt6000_releasefunction nxt6000_read_snrfunction nxt6000_read_berfunction nxt6000_read_signal_strengthfunction nxt6000_fe_get_tune_settingsfunction nxt6000_i2c_gate_ctrlfunction nxt6000_attachexport nxt6000_attach
Annotated Snippet
struct nxt6000_state {
struct i2c_adapter* i2c;
/* configuration settings */
const struct nxt6000_config* config;
struct dvb_frontend frontend;
};
static int debug;
#define dprintk(fmt, arg...) do { \
if (debug) \
printk(KERN_DEBUG pr_fmt("%s: " fmt), \
__func__, ##arg); \
} while (0)
static int nxt6000_writereg(struct nxt6000_state* state, u8 reg, u8 data)
{
u8 buf[] = { reg, data };
struct i2c_msg msg = {.addr = state->config->demod_address,.flags = 0,.buf = buf,.len = 2 };
int ret;
if ((ret = i2c_transfer(state->i2c, &msg, 1)) != 1)
dprintk("nxt6000: nxt6000_write error (reg: 0x%02X, data: 0x%02X, ret: %d)\n", reg, data, ret);
return (ret != 1) ? -EIO : 0;
}
static u8 nxt6000_readreg(struct nxt6000_state* state, u8 reg)
{
int ret;
u8 b0[] = { reg };
u8 b1[] = { 0 };
struct i2c_msg msgs[] = {
{.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, msgs, 2);
if (ret != 2)
dprintk("nxt6000: nxt6000_read error (reg: 0x%02X, ret: %d)\n", reg, ret);
return b1[0];
}
static void nxt6000_reset(struct nxt6000_state* state)
{
u8 val;
val = nxt6000_readreg(state, OFDM_COR_CTL);
nxt6000_writereg(state, OFDM_COR_CTL, val & ~COREACT);
nxt6000_writereg(state, OFDM_COR_CTL, val | COREACT);
}
static int nxt6000_set_bandwidth(struct nxt6000_state *state, u32 bandwidth)
{
u16 nominal_rate;
int result;
switch (bandwidth) {
case 6000000:
nominal_rate = 0x55B7;
break;
case 7000000:
nominal_rate = 0x6400;
break;
case 8000000:
nominal_rate = 0x7249;
break;
default:
return -EINVAL;
}
if ((result = nxt6000_writereg(state, OFDM_TRL_NOMINALRATE_1, nominal_rate & 0xFF)) < 0)
return result;
return nxt6000_writereg(state, OFDM_TRL_NOMINALRATE_2, (nominal_rate >> 8) & 0xFF);
}
static int nxt6000_set_guard_interval(struct nxt6000_state *state,
enum fe_guard_interval guard_interval)
{
switch (guard_interval) {
case GUARD_INTERVAL_1_32:
return nxt6000_writereg(state, OFDM_COR_MODEGUARD, 0x00 | (nxt6000_readreg(state, OFDM_COR_MODEGUARD) & ~0x03));
Annotation
- Immediate include surface: `linux/init.h`, `linux/kernel.h`, `linux/module.h`, `linux/string.h`, `linux/slab.h`, `media/dvb_frontend.h`, `nxt6000_priv.h`, `nxt6000.h`.
- Detected declarations: `struct nxt6000_state`, `function nxt6000_writereg`, `function nxt6000_readreg`, `function nxt6000_reset`, `function nxt6000_set_bandwidth`, `function nxt6000_set_guard_interval`, `function nxt6000_set_inversion`, `function nxt6000_set_transmission_mode`, `function nxt6000_setup`, `function nxt6000_dump_status`.
- 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.