drivers/media/dvb-frontends/drxk_hard.c
Source file repositories/reference/linux-study-clean/drivers/media/dvb-frontends/drxk_hard.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/dvb-frontends/drxk_hard.c- Extension
.c- Size
- 179740 bytes
- Lines
- 6821
- 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/kernel.hlinux/module.hlinux/moduleparam.hlinux/init.hlinux/delay.hlinux/firmware.hlinux/i2c.hlinux/hardirq.hasm/div64.hmedia/dvb_frontend.hdrxk.hdrxk_hard.hlinux/int_log.hdrxk_filters.h
Detected Declarations
function is_dvbtfunction is_qamfunction Frac28afunction log10times100function drxk_i2c_lockfunction drxk_i2c_unlockfunction drxk_i2c_transferfunction i2c_read1function i2c_writefunction i2c_readfunction read16_flagsfunction read16function read32_flagsfunction read32function write16_flagsfunction write16function write32_flagsfunction write32function write_blockfunction power_up_devicefunction init_statefunction drxx_openfunction get_device_capabilitiesfunction hi_commandfunction hi_cfg_commandfunction init_hifunction mpegts_configure_pinsfunction mpegts_disablefunction bl_chain_cmdfunction download_microcodefunction dvbt_enable_ofdm_token_ringfunction mpegts_stopfunction scu_commandfunction set_iqm_affunction ctrl_power_modefunction power_down_dvbtfunction setoperation_modefunction startfunction shut_downfunction get_lock_statusfunction mpegts_startfunction mpegts_dto_initfunction mpegts_dto_setupfunction mpegts_configure_polarityfunction set_agc_rffunction set_agc_iffunction get_qam_signal_to_noisefunction get_dvbt_signal_to_noise
Annotated Snippet
if (DRXDAP_FASI_LONG_FORMAT(address) || (flags != 0)) {
adr_buf[0] = (((address << 1) & 0xFF) | 0x01);
adr_buf[1] = ((address >> 16) & 0xFF);
adr_buf[2] = ((address >> 24) & 0xFF);
adr_buf[3] = ((address >> 7) & 0xFF);
adr_buf[2] |= flags;
adr_length = 4;
if (chunk == state->m_chunk_size)
chunk -= 2;
} else {
adr_buf[0] = ((address << 1) & 0xFF);
adr_buf[1] = (((address >> 16) & 0x0F) |
((address >> 18) & 0xF0));
adr_length = 2;
}
memcpy(&state->chunk[adr_length], p_block, chunk);
dprintk(2, "(0x%08x, 0x%02x)\n", address, flags);
if (p_block)
dprintk(2, "%*ph\n", chunk, p_block);
status = i2c_write(state, state->demod_address,
&state->chunk[0], chunk + adr_length);
if (status < 0) {
pr_err("%s: i2c write error at addr 0x%02x\n",
__func__, address);
break;
}
p_block += chunk;
address += (chunk >> 1);
blk_size -= chunk;
}
return status;
}
#ifndef DRXK_MAX_RETRIES_POWERUP
#define DRXK_MAX_RETRIES_POWERUP 20
#endif
static int power_up_device(struct drxk_state *state)
{
int status;
u8 data = 0;
u16 retry_count = 0;
dprintk(1, "\n");
status = i2c_read1(state, state->demod_address, &data);
if (status < 0) {
do {
data = 0;
status = i2c_write(state, state->demod_address,
&data, 1);
usleep_range(10000, 11000);
retry_count++;
if (status < 0)
continue;
status = i2c_read1(state, state->demod_address,
&data);
} while (status < 0 &&
(retry_count < DRXK_MAX_RETRIES_POWERUP));
if (status < 0 && retry_count >= DRXK_MAX_RETRIES_POWERUP)
goto error;
}
/* Make sure all clk domains are active */
status = write16(state, SIO_CC_PWD_MODE__A, SIO_CC_PWD_MODE_LEVEL_NONE);
if (status < 0)
goto error;
status = write16(state, SIO_CC_UPDATE__A, SIO_CC_UPDATE_KEY);
if (status < 0)
goto error;
/* Enable pll lock tests */
status = write16(state, SIO_CC_PLL_LOCK__A, 1);
if (status < 0)
goto error;
state->m_current_power_mode = DRX_POWER_UP;
error:
if (status < 0)
pr_err("Error %d on %s\n", status, __func__);
return status;
}
static int init_state(struct drxk_state *state)
{
/*
* FIXME: most (all?) of the values below should be moved into
* struct drxk_config, as they are probably board-specific
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/module.h`, `linux/moduleparam.h`, `linux/init.h`, `linux/delay.h`, `linux/firmware.h`, `linux/i2c.h`, `linux/hardirq.h`.
- Detected declarations: `function is_dvbt`, `function is_qam`, `function Frac28a`, `function log10times100`, `function drxk_i2c_lock`, `function drxk_i2c_unlock`, `function drxk_i2c_transfer`, `function i2c_read1`, `function i2c_write`, `function i2c_read`.
- 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.