drivers/media/dvb-frontends/drx39xyj/drxj.c
Source file repositories/reference/linux-study-clean/drivers/media/dvb-frontends/drx39xyj/drxj.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/dvb-frontends/drx39xyj/drxj.c- Extension
.c- Size
- 357806 bytes
- Lines
- 12392
- 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/module.hlinux/firmware.hlinux/init.hlinux/string.hlinux/slab.hasm/div64.hmedia/dvb_frontend.hdrx39xxj.hdrxj.hdrxj_map.hdrx_driver_version.hstdio.h
Detected Declarations
struct drxj_hi_cmdstruct drxu_code_block_hdrfunction frac28function log1_times100function frac_times1e6function is_handled_by_aud_tr_iffunction drxbsp_i2c_write_readfunction drxdap_fasi_read_blockfunction drxdap_fasi_read_reg16function drxdap_fasi_read_reg32function drxdap_fasi_write_blockfunction drxdap_fasi_write_reg16function drxdap_fasi_read_modify_write_reg16function drxdap_fasi_write_reg32function drxj_dap_rm_write_reg16shortfunction drxj_dap_read_modify_write_reg16function drxj_dap_read_aud_reg16function drxj_dap_read_reg16function drxj_dap_write_aud_reg16function drxj_dap_write_reg16function drxj_dap_atomic_read_write_blockfunction drxj_dap_atomic_read_reg32function functionfunction hi_commandfunction Psysfunction get_device_capabilitiesfunction power_up_devicefunction ctrl_set_cfg_mpeg_outputfunction set_mpegtei_handlingfunction bit_reverse_mpeg_outputfunction set_mpeg_start_widthfunction ctrl_set_uio_cfgfunction ctrl_uio_writefunction ctrl_i2c_bridgefunction smart_ant_initfunction scu_commandfunction drxj_dap_scu_atomic_read_write_blockfunction drxj_dap_scu_atomic_read_reg16function drxj_dap_scu_atomic_write_reg16function adc_sync_measurementfunction adc_synchronizationfunction init_agcfunction set_frequencyfunction get_acc_pkt_errfunction set_agc_rffunction DRXJ_ISQAMSTDfunction set_agc_iffunction DRXJ_ISQAMSTD
Annotated Snippet
struct drxj_hi_cmd {
u16 cmd;
u16 param1;
u16 param2;
u16 param3;
u16 param4;
u16 param5;
u16 param6;
};
/*============================================================================*/
/*=== MICROCODE RELATED STRUCTURES ===========================================*/
/*============================================================================*/
/*
* struct drxu_code_block_hdr - Structure of the microcode block headers
*
* @addr: Destination address of the data in this block
* @size: Size of the block data following this header counted in
* 16 bits words
* @CRC: CRC value of the data block, only valid if CRC flag is
* set.
*/
struct drxu_code_block_hdr {
u32 addr;
u16 size;
u16 flags;
u16 CRC;
};
/*-----------------------------------------------------------------------------
FUNCTIONS
----------------------------------------------------------------------------*/
/* Some prototypes */
static int
hi_command(struct i2c_device_addr *dev_addr,
const struct drxj_hi_cmd *cmd, u16 *result);
static int
ctrl_lock_status(struct drx_demod_instance *demod, enum drx_lock_status *lock_stat);
static int
ctrl_power_mode(struct drx_demod_instance *demod, enum drx_power_mode *mode);
static int power_down_aud(struct drx_demod_instance *demod);
static int
ctrl_set_cfg_pre_saw(struct drx_demod_instance *demod, struct drxj_cfg_pre_saw *pre_saw);
static int
ctrl_set_cfg_afe_gain(struct drx_demod_instance *demod, struct drxj_cfg_afe_gain *afe_gain);
/*============================================================================*/
/*============================================================================*/
/*== HELPER FUNCTIONS ==*/
/*============================================================================*/
/*============================================================================*/
/*============================================================================*/
/*
* \fn u32 frac28(u32 N, u32 D)
* \brief Compute: (1<<28)*N/D
* \param N 32 bits
* \param D 32 bits
* \return (1<<28)*N/D
* This function is used to avoid floating-point calculations as they may
* not be present on the target platform.
* frac28 performs an unsigned 28/28 bits division to 32-bit fixed point
* fraction used for setting the Frequency Shifter registers.
* N and D can hold numbers up to width: 28-bits.
* The 4 bits integer part and the 28 bits fractional part are calculated.
* Usage condition: ((1<<28)*n)/d < ((1<<32)-1) => (n/d) < 15.999
* N: 0...(1<<28)-1 = 268435454
* D: 0...(1<<28)-1
* Q: 0...(1<<32)-1
*/
static u32 frac28(u32 N, u32 D)
{
int i = 0;
u32 Q1 = 0;
u32 R0 = 0;
R0 = (N % D) << 4; /* 32-28 == 4 shifts possible at max */
Q1 = N / D; /* integer part, only the 4 least significant bits
will be visible in the result */
Annotation
- Immediate include surface: `linux/module.h`, `linux/firmware.h`, `linux/init.h`, `linux/string.h`, `linux/slab.h`, `asm/div64.h`, `media/dvb_frontend.h`, `drx39xxj.h`.
- Detected declarations: `struct drxj_hi_cmd`, `struct drxu_code_block_hdr`, `function frac28`, `function log1_times100`, `function frac_times1e6`, `function is_handled_by_aud_tr_if`, `function drxbsp_i2c_write_read`, `function drxdap_fasi_read_block`, `function drxdap_fasi_read_reg16`, `function drxdap_fasi_read_reg32`.
- 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.