drivers/media/pci/cx88/cx88-tvaudio.c
Source file repositories/reference/linux-study-clean/drivers/media/pci/cx88/cx88-tvaudio.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/pci/cx88/cx88-tvaudio.c- Extension
.c- Size
- 28349 bytes
- Lines
- 1047
- 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
cx88.hlinux/module.hlinux/errno.hlinux/freezer.hlinux/kernel.hlinux/mm.hlinux/poll.hlinux/signal.hlinux/ioport.hlinux/types.hlinux/interrupt.hlinux/vmalloc.hlinux/init.hlinux/delay.hlinux/kthread.h
Detected Declarations
struct rlistfunction set_audio_registersfunction set_audio_startfunction set_audio_finishfunction set_audio_standard_BTSCfunction set_audio_standard_NICAMfunction set_audio_standard_A2function set_audio_standard_EIAJfunction set_audio_standard_FMfunction cx88_detect_nicamfunction cx88_set_tvaudiofunction cx88_newstationfunction cx88_get_stereofunction cx88_set_stereofunction cx88_audio_threadexport cx88_set_tvaudioexport cx88_newstationexport cx88_get_stereoexport cx88_set_stereoexport cx88_audio_thread
Annotated Snippet
struct rlist {
u32 reg;
u32 val;
};
static void set_audio_registers(struct cx88_core *core, const struct rlist *l)
{
int i;
for (i = 0; l[i].reg; i++) {
switch (l[i].reg) {
case AUD_PDF_DDS_CNST_BYTE2:
case AUD_PDF_DDS_CNST_BYTE1:
case AUD_PDF_DDS_CNST_BYTE0:
case AUD_QAM_MODE:
case AUD_PHACC_FREQ_8MSB:
case AUD_PHACC_FREQ_8LSB:
cx_writeb(l[i].reg, l[i].val);
break;
default:
cx_write(l[i].reg, l[i].val);
break;
}
}
}
static void set_audio_start(struct cx88_core *core, u32 mode)
{
/* mute */
cx_write(AUD_VOL_CTL, (1 << 6));
/* start programming */
cx_write(AUD_INIT, mode);
cx_write(AUD_INIT_LD, 0x0001);
cx_write(AUD_SOFT_RESET, 0x0001);
}
static void set_audio_finish(struct cx88_core *core, u32 ctl)
{
u32 volume;
/* restart dma; This avoids buzz in NICAM and is good in others */
cx88_stop_audio_dma(core);
cx_write(AUD_RATE_THRES_DMD, 0x000000C0);
cx88_start_audio_dma(core);
if (core->board.mpeg & CX88_MPEG_BLACKBIRD) {
cx_write(AUD_I2SINPUTCNTL, 4);
cx_write(AUD_BAUDRATE, 1);
/*
* 'pass-thru mode': this enables the i2s
* output to the mpeg encoder
*/
cx_set(AUD_CTL, EN_I2SOUT_ENABLE);
cx_write(AUD_I2SOUTPUTCNTL, 1);
cx_write(AUD_I2SCNTL, 0);
/* cx_write(AUD_APB_IN_RATE_ADJ, 0); */
}
if ((always_analog) || (!(core->board.mpeg & CX88_MPEG_BLACKBIRD))) {
ctl |= EN_DAC_ENABLE;
cx_write(AUD_CTL, ctl);
}
/* finish programming */
cx_write(AUD_SOFT_RESET, 0x0000);
/* unmute */
volume = cx_sread(SHADOW_AUD_VOL_CTL);
cx_swrite(SHADOW_AUD_VOL_CTL, AUD_VOL_CTL, volume);
core->last_change = jiffies;
}
/* ----------------------------------------------------------- */
static void set_audio_standard_BTSC(struct cx88_core *core, unsigned int sap,
u32 mode)
{
static const struct rlist btsc[] = {
{AUD_AFE_12DB_EN, 0x00000001},
{AUD_OUT1_SEL, 0x00000013},
{AUD_OUT1_SHIFT, 0x00000000},
{AUD_POLY0_DDS_CONSTANT, 0x0012010c},
{AUD_DMD_RA_DDS, 0x00c3e7aa},
{AUD_DBX_IN_GAIN, 0x00004734},
{AUD_DBX_WBE_GAIN, 0x00004640},
{AUD_DBX_SE_GAIN, 0x00008d31},
{AUD_DCOC_0_SRC, 0x0000001a},
{AUD_IIR1_4_SEL, 0x00000021},
{AUD_DCOC_PASS_IN, 0x00000003},
Annotation
- Immediate include surface: `cx88.h`, `linux/module.h`, `linux/errno.h`, `linux/freezer.h`, `linux/kernel.h`, `linux/mm.h`, `linux/poll.h`, `linux/signal.h`.
- Detected declarations: `struct rlist`, `function set_audio_registers`, `function set_audio_start`, `function set_audio_finish`, `function set_audio_standard_BTSC`, `function set_audio_standard_NICAM`, `function set_audio_standard_A2`, `function set_audio_standard_EIAJ`, `function set_audio_standard_FM`, `function cx88_detect_nicam`.
- 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.