drivers/media/usb/cx231xx/cx231xx-avcore.c
Source file repositories/reference/linux-study-clean/drivers/media/usb/cx231xx/cx231xx-avcore.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/usb/cx231xx/cx231xx-avcore.c- Extension
.c- Size
- 90942 bytes
- Lines
- 3068
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
cx231xx.hlinux/init.hlinux/list.hlinux/module.hlinux/kernel.hlinux/bitmap.hlinux/i2c.hlinux/mm.hlinux/mutex.hmedia/tuner.hmedia/v4l2-common.hmedia/v4l2-ioctl.hcx231xx-dif.h
Detected Declarations
function Copyrightfunction verve_read_bytefunction initGPIOfunction uninitGPIOfunction afe_write_bytefunction afe_read_bytefunction cx231xx_afe_init_super_blockfunction cx231xx_afe_init_channelsfunction cx231xx_afe_setup_AFE_for_basebandfunction cx231xx_afe_set_input_muxfunction cx231xx_afe_set_modefunction cx231xx_afe_update_power_controlfunction cx231xx_afe_adjust_ref_countfunction vid_blk_write_bytefunction vid_blk_read_bytefunction vid_blk_write_wordfunction vid_blk_read_wordfunction cx231xx_check_fwfunction cx231xx_set_video_input_muxfunction cx231xx_set_decoder_video_inputfunction cx231xx_enable656function cx231xx_disable656function cx231xx_do_mode_ctrl_overridesfunction cx231xx_unmute_audiofunction stopAudioFirmwarefunction restartAudioFirmwarefunction cx231xx_set_audio_inputfunction cx231xx_set_audio_decoder_inputfunction cx231xx_init_ctrl_pin_statusfunction cx231xx_set_agc_analog_digital_mux_selectfunction cx231xx_enable_i2c_port_3function update_HH_register_after_set_DIFfunction cx231xx_dump_SC_regfunction cx231xx_Setup_AFE_for_LowIFfunction cx231xx_set_Colibri_For_LowIFfunction cx231xx_Get_Colibri_CarrierOffsetfunction cx231xx_set_DIF_bandpassfunction cx231xx_dif_configure_C2HH_for_low_IFfunction cx231xx_dif_set_standardfunction cx231xx_tuner_pre_channel_changefunction cx231xx_tuner_post_channel_changefunction cx231xx_i2s_blk_initializefunction cx231xx_i2s_blk_update_power_controlfunction cx231xx_i2s_blk_set_audio_inputfunction cx231xx_set_power_modefunction cx231xx_start_streamfunction cx231xx_stop_streamfunction cx231xx_initialize_stream_xfer
Annotated Snippet
if (status < 0) {
dev_dbg(dev->dev,
"%s: Init Super Block failed in send cmd\n",
__func__);
break;
}
status = afe_read_byte(dev, SUP_BLK_PWRDN, &afe_power_status);
afe_power_status &= 0xff;
if (status < 0) {
dev_dbg(dev->dev,
"%s: Init Super Block failed in receive cmd\n",
__func__);
break;
}
i++;
if (i == 10) {
dev_dbg(dev->dev,
"%s: Init Super Block force break in loop !!!!\n",
__func__);
status = -1;
break;
}
}
if (status < 0)
return status;
/* start tuning filter */
status = afe_write_byte(dev, SUP_BLK_TUNE3, 0x40);
if (status < 0)
return status;
msleep(5);
/* exit tuning */
status = afe_write_byte(dev, SUP_BLK_TUNE3, 0x00);
return status;
}
int cx231xx_afe_init_channels(struct cx231xx *dev)
{
int status = 0;
/* power up all 3 channels, clear pd_buffer */
status = afe_write_byte(dev, ADC_PWRDN_CLAMP_CH1, 0x00);
status = afe_write_byte(dev, ADC_PWRDN_CLAMP_CH2, 0x00);
status = afe_write_byte(dev, ADC_PWRDN_CLAMP_CH3, 0x00);
/* Enable quantizer calibration */
status = afe_write_byte(dev, ADC_COM_QUANT, 0x02);
/* channel initialize, force modulator (fb) reset */
status = afe_write_byte(dev, ADC_FB_FRCRST_CH1, 0x17);
status = afe_write_byte(dev, ADC_FB_FRCRST_CH2, 0x17);
status = afe_write_byte(dev, ADC_FB_FRCRST_CH3, 0x17);
/* start quantilizer calibration */
status = afe_write_byte(dev, ADC_CAL_ATEST_CH1, 0x10);
status = afe_write_byte(dev, ADC_CAL_ATEST_CH2, 0x10);
status = afe_write_byte(dev, ADC_CAL_ATEST_CH3, 0x10);
msleep(5);
/* exit modulator (fb) reset */
status = afe_write_byte(dev, ADC_FB_FRCRST_CH1, 0x07);
status = afe_write_byte(dev, ADC_FB_FRCRST_CH2, 0x07);
status = afe_write_byte(dev, ADC_FB_FRCRST_CH3, 0x07);
/* enable the pre_clamp in each channel for single-ended input */
status = afe_write_byte(dev, ADC_NTF_PRECLMP_EN_CH1, 0xf0);
status = afe_write_byte(dev, ADC_NTF_PRECLMP_EN_CH2, 0xf0);
status = afe_write_byte(dev, ADC_NTF_PRECLMP_EN_CH3, 0xf0);
/* use diode instead of resistor, so set term_en to 0, res_en to 0 */
status = cx231xx_reg_mask_write(dev, AFE_DEVICE_ADDRESS, 8,
ADC_QGAIN_RES_TRM_CH1, 3, 7, 0x00);
status = cx231xx_reg_mask_write(dev, AFE_DEVICE_ADDRESS, 8,
ADC_QGAIN_RES_TRM_CH2, 3, 7, 0x00);
status = cx231xx_reg_mask_write(dev, AFE_DEVICE_ADDRESS, 8,
ADC_QGAIN_RES_TRM_CH3, 3, 7, 0x00);
/* dynamic element matching off */
status = afe_write_byte(dev, ADC_DCSERVO_DEM_CH1, 0x03);
status = afe_write_byte(dev, ADC_DCSERVO_DEM_CH2, 0x03);
status = afe_write_byte(dev, ADC_DCSERVO_DEM_CH3, 0x03);
return status;
}
Annotation
- Immediate include surface: `cx231xx.h`, `linux/init.h`, `linux/list.h`, `linux/module.h`, `linux/kernel.h`, `linux/bitmap.h`, `linux/i2c.h`, `linux/mm.h`.
- Detected declarations: `function Copyright`, `function verve_read_byte`, `function initGPIO`, `function uninitGPIO`, `function afe_write_byte`, `function afe_read_byte`, `function cx231xx_afe_init_super_block`, `function cx231xx_afe_init_channels`, `function cx231xx_afe_setup_AFE_for_baseband`, `function cx231xx_afe_set_input_mux`.
- 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.