sound/pci/ca0106/ca0106_mixer.c

Source file repositories/reference/linux-study-clean/sound/pci/ca0106/ca0106_mixer.c

File Facts

System
Linux kernel
Corpus path
sound/pci/ca0106/ca0106_mixer.c
Extension
.c
Size
26716 bytes
Lines
903
Domain
Driver Families
Bucket
sound/pci
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.

Dependency Surface

Detected Declarations

Annotated Snippet

struct ca0106_vol_tbl {
	unsigned int channel_id;
	unsigned int reg;
};

static const struct ca0106_vol_tbl saved_volumes[NUM_SAVED_VOLUMES] = {
	{ CONTROL_FRONT_CHANNEL, PLAYBACK_VOLUME2 },
	{ CONTROL_REAR_CHANNEL, PLAYBACK_VOLUME2 },
	{ CONTROL_CENTER_LFE_CHANNEL, PLAYBACK_VOLUME2 },
	{ CONTROL_UNKNOWN_CHANNEL, PLAYBACK_VOLUME2 },
	{ CONTROL_FRONT_CHANNEL, PLAYBACK_VOLUME1 },
	{ CONTROL_REAR_CHANNEL, PLAYBACK_VOLUME1 },
	{ CONTROL_CENTER_LFE_CHANNEL, PLAYBACK_VOLUME1 },
	{ CONTROL_UNKNOWN_CHANNEL, PLAYBACK_VOLUME1 },
	{ 1, CAPTURE_CONTROL },
};

void snd_ca0106_mixer_suspend(struct snd_ca0106 *chip)
{
	int i;

	/* save volumes */
	for (i = 0; i < NUM_SAVED_VOLUMES; i++)
		chip->saved_vol[i] =
			snd_ca0106_ptr_read(chip, saved_volumes[i].reg,
					    saved_volumes[i].channel_id);
}

void snd_ca0106_mixer_resume(struct snd_ca0106  *chip)
{
	int i;

	for (i = 0; i < NUM_SAVED_VOLUMES; i++)
		snd_ca0106_ptr_write(chip, saved_volumes[i].reg,
				     saved_volumes[i].channel_id,
				     chip->saved_vol[i]);

	ca0106_spdif_enable(chip);
	ca0106_set_capture_source(chip);
	ca0106_set_i2c_capture_source(chip, chip->i2c_capture_source, 1);
	for (i = 0; i < 4; i++)
		ca0106_set_spdif_bits(chip, i);
	if (chip->details->i2c_adc)
		ca0106_set_capture_mic_line_in(chip);
}
#endif /* CONFIG_PM_SLEEP */

Annotation

Implementation Notes