sound/drivers/vx/vx_mixer.c
Source file repositories/reference/linux-study-clean/sound/drivers/vx/vx_mixer.c
File Facts
- System
- Linux kernel
- Corpus path
sound/drivers/vx/vx_mixer.c- Extension
.c- Size
- 27424 bytes
- Lines
- 983
- Domain
- Driver Families
- Bucket
- sound/drivers
- 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
sound/core.hsound/control.hsound/tlv.hsound/vx_core.hvx_cmd.h
Detected Declarations
struct wstruct bstruct wstruct bstruct vx_audio_levelstruct vx_vu_meterfunction Copyrightfunction vx_set_codec_regfunction vx_set_analog_output_levelfunction vx_toggle_dac_mutefunction vx_reset_codecfunction vx_change_audio_sourcefunction vx_sync_audio_sourcefunction vx_adjust_audio_levelfunction vx_read_audio_levelfunction vx_set_monitor_levelfunction vx_set_audio_switchfunction vx_set_audio_gainfunction vx_reset_audio_levelsfunction vx_get_audio_vu_meterfunction vx_output_level_infofunction vx_output_level_getfunction vx_output_level_putfunction vx_audio_src_infofunction vx_audio_src_getfunction vx_audio_src_putfunction vx_clock_mode_infofunction vx_clock_mode_getfunction vx_clock_mode_putfunction vx_audio_gain_infofunction vx_audio_gain_getfunction vx_audio_gain_putfunction vx_audio_monitor_getfunction vx_audio_monitor_putfunction vx_audio_sw_getfunction vx_audio_sw_putfunction vx_monitor_sw_getfunction vx_monitor_sw_putfunction vx_iec958_infofunction vx_iec958_getfunction vx_iec958_mask_getfunction vx_iec958_putfunction vx_vu_meter_infofunction vx_vu_meter_getfunction vx_peak_meter_getfunction vx_saturation_getfunction snd_vx_mixer_new
Annotated Snippet
struct w {
u16 h;
u16 l;
} w;
struct b {
u8 hh;
u8 mh;
u8 ml;
u8 ll;
} b;
#else /* LITTLE_ENDIAN */
struct w {
u16 l;
u16 h;
} w;
struct b {
u8 ll;
u8 ml;
u8 mh;
u8 hh;
} b;
#endif
};
#define SET_CDC_DATA_SEL(di,s) ((di).b.mh = (u8) (s))
#define SET_CDC_DATA_REG(di,r) ((di).b.ml = (u8) (r))
#define SET_CDC_DATA_VAL(di,d) ((di).b.ll = (u8) (d))
#define SET_CDC_DATA_INIT(di) ((di).l = 0L, SET_CDC_DATA_SEL(di,XX_CODEC_SELECTOR))
/*
* set up codec register and write the value
* @codec: the codec id, 0 or 1
* @reg: register index
* @val: data value
*/
static void vx_set_codec_reg(struct vx_core *chip, int codec, int reg, int val)
{
union vx_codec_data data;
/* DAC control register */
SET_CDC_DATA_INIT(data);
SET_CDC_DATA_REG(data, reg);
SET_CDC_DATA_VAL(data, val);
vx_write_codec_reg(chip, codec, data.l);
}
/*
* vx_set_analog_output_level - set the output attenuation level
* @codec: the output codec, 0 or 1. (1 for VXP440 only)
* @left: left output level, 0 = mute
* @right: right output level
*/
static void vx_set_analog_output_level(struct vx_core *chip, int codec, int left, int right)
{
left = chip->hw->output_level_max - left;
right = chip->hw->output_level_max - right;
if (chip->ops->akm_write) {
chip->ops->akm_write(chip, XX_CODEC_LEVEL_LEFT_REGISTER, left);
chip->ops->akm_write(chip, XX_CODEC_LEVEL_RIGHT_REGISTER, right);
} else {
/* convert to attenuation level: 0 = 0dB (max), 0xe3 = -113.5 dB (min) */
vx_set_codec_reg(chip, codec, XX_CODEC_LEVEL_LEFT_REGISTER, left);
vx_set_codec_reg(chip, codec, XX_CODEC_LEVEL_RIGHT_REGISTER, right);
}
}
/*
* vx_toggle_dac_mute - mute/unmute DAC
* @mute: 0 = unmute, 1 = mute
*/
#define DAC_ATTEN_MIN 0x08
#define DAC_ATTEN_MAX 0x38
void vx_toggle_dac_mute(struct vx_core *chip, int mute)
{
unsigned int i;
for (i = 0; i < chip->hw->num_codecs; i++) {
if (chip->ops->akm_write)
chip->ops->akm_write(chip, XX_CODEC_DAC_CONTROL_REGISTER, mute); /* XXX */
else
vx_set_codec_reg(chip, i, XX_CODEC_DAC_CONTROL_REGISTER,
mute ? DAC_ATTEN_MAX : DAC_ATTEN_MIN);
}
}
/*
* vx_reset_codec - reset and initialize the codecs
Annotation
- Immediate include surface: `sound/core.h`, `sound/control.h`, `sound/tlv.h`, `sound/vx_core.h`, `vx_cmd.h`.
- Detected declarations: `struct w`, `struct b`, `struct w`, `struct b`, `struct vx_audio_level`, `struct vx_vu_meter`, `function Copyright`, `function vx_set_codec_reg`, `function vx_set_analog_output_level`, `function vx_toggle_dac_mute`.
- Atlas domain: Driver Families / sound/drivers.
- 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.