sound/isa/cs423x/cs4236_lib.c
Source file repositories/reference/linux-study-clean/sound/isa/cs423x/cs4236_lib.c
File Facts
- System
- Linux kernel
- Corpus path
sound/isa/cs423x/cs4236_lib.c- Extension
.c- Size
- 36354 bytes
- Lines
- 1040
- Domain
- Driver Families
- Bucket
- sound/isa
- Inferred role
- Driver Families: implementation source
- Status
- source 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/io.hlinux/delay.hlinux/init.hlinux/time.hlinux/wait.hsound/core.hsound/wss.hsound/asoundef.hsound/initval.hsound/tlv.h
Detected Declarations
function snd_cs4236_ctrl_outfunction snd_cs4236_ctrl_infunction snd_cs4236_xratefunction divisor_to_rate_registerfunction snd_cs4236_playback_formatfunction snd_cs4236_capture_formatfunction snd_cs4236_suspendfunction snd_cs4236_resumefunction snd_wss_createfunction snd_cs4236_pcmfunction snd_cs4236_info_singlefunction snd_cs4236_get_singlefunction snd_cs4236_put_singlefunction snd_cs4236_get_singlecfunction snd_cs4236_put_singlecfunction snd_cs4236_info_doublefunction snd_cs4236_get_doublefunction snd_cs4236_put_doublefunction snd_cs4236_get_double1function snd_cs4236_put_double1function snd_cs4236_mixer_master_digital_invert_volumefunction snd_cs4236_get_master_digitalfunction snd_cs4236_put_master_digitalfunction snd_cs4235_mixer_output_accu_get_volumefunction snd_cs4235_mixer_output_accu_set_volumefunction snd_cs4235_get_output_accufunction snd_cs4235_put_output_accufunction snd_cs4236_get_iec958_switchfunction snd_cs4236_put_iec958_switchfunction snd_cs4236_mixer
Annotated Snippet
if (divisor < 21 || divisor > 192) {
snd_BUG();
return 192;
}
return divisor;
}
}
static void snd_cs4236_playback_format(struct snd_wss *chip,
struct snd_pcm_hw_params *params,
unsigned char pdfr)
{
unsigned char rate = divisor_to_rate_register(params->rate_den);
guard(spinlock_irqsave)(&chip->reg_lock);
/* set fast playback format change and clean playback FIFO */
snd_wss_out(chip, CS4231_ALT_FEATURE_1,
chip->image[CS4231_ALT_FEATURE_1] | 0x10);
snd_wss_out(chip, CS4231_PLAYBK_FORMAT, pdfr & 0xf0);
snd_wss_out(chip, CS4231_ALT_FEATURE_1,
chip->image[CS4231_ALT_FEATURE_1] & ~0x10);
snd_cs4236_ext_out(chip, CS4236_DAC_RATE, rate);
}
static void snd_cs4236_capture_format(struct snd_wss *chip,
struct snd_pcm_hw_params *params,
unsigned char cdfr)
{
unsigned char rate = divisor_to_rate_register(params->rate_den);
guard(spinlock_irqsave)(&chip->reg_lock);
/* set fast capture format change and clean capture FIFO */
snd_wss_out(chip, CS4231_ALT_FEATURE_1,
chip->image[CS4231_ALT_FEATURE_1] | 0x20);
snd_wss_out(chip, CS4231_REC_FORMAT, cdfr & 0xf0);
snd_wss_out(chip, CS4231_ALT_FEATURE_1,
chip->image[CS4231_ALT_FEATURE_1] & ~0x20);
snd_cs4236_ext_out(chip, CS4236_ADC_RATE, rate);
}
#ifdef CONFIG_PM
static void snd_cs4236_suspend(struct snd_wss *chip)
{
int reg;
guard(spinlock_irqsave)(&chip->reg_lock);
for (reg = 0; reg < 32; reg++)
chip->image[reg] = snd_wss_in(chip, reg);
for (reg = 0; reg < 18; reg++)
chip->eimage[reg] = snd_cs4236_ext_in(chip, CS4236_I23VAL(reg));
for (reg = 2; reg < 9; reg++)
chip->cimage[reg] = snd_cs4236_ctrl_in(chip, reg);
}
static void snd_cs4236_resume(struct snd_wss *chip)
{
int reg;
snd_wss_mce_up(chip);
scoped_guard(spinlock_irqsave, &chip->reg_lock) {
for (reg = 0; reg < 32; reg++) {
switch (reg) {
case CS4236_EXT_REG:
case CS4231_VERSION:
case 27: /* why? CS4235 - master left */
case 29: /* why? CS4235 - master right */
break;
default:
snd_wss_out(chip, reg, chip->image[reg]);
break;
}
}
for (reg = 0; reg < 18; reg++)
snd_cs4236_ext_out(chip, CS4236_I23VAL(reg), chip->eimage[reg]);
for (reg = 2; reg < 9; reg++) {
switch (reg) {
case 7:
break;
default:
snd_cs4236_ctrl_out(chip, reg, chip->cimage[reg]);
}
}
}
snd_wss_mce_down(chip);
}
#endif /* CONFIG_PM */
/*
* This function does no fail if the chip is not CS4236B or compatible.
Annotation
- Immediate include surface: `linux/io.h`, `linux/delay.h`, `linux/init.h`, `linux/time.h`, `linux/wait.h`, `sound/core.h`, `sound/wss.h`, `sound/asoundef.h`.
- Detected declarations: `function snd_cs4236_ctrl_out`, `function snd_cs4236_ctrl_in`, `function snd_cs4236_xrate`, `function divisor_to_rate_register`, `function snd_cs4236_playback_format`, `function snd_cs4236_capture_format`, `function snd_cs4236_suspend`, `function snd_cs4236_resume`, `function snd_wss_create`, `function snd_cs4236_pcm`.
- Atlas domain: Driver Families / sound/isa.
- Implementation status: source 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.