sound/pci/ice1712/wtm.c
Source file repositories/reference/linux-study-clean/sound/pci/ice1712/wtm.c
File Facts
- System
- Linux kernel
- Corpus path
sound/pci/ice1712/wtm.c- Extension
.c- Size
- 15582 bytes
- Lines
- 631
- 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.
- 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.
- 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
linux/delay.hlinux/interrupt.hlinux/init.hsound/core.hsound/tlv.hlinux/slab.hice1712.henvy24ht.hwtm.hstac946x.h
Detected Declarations
struct wtm_specfunction stac9460_putfunction stac9460_getfunction stac9460_2_putfunction stac9460_2_getfunction stac9460_dac_mute_allfunction stac9460_dac_mute_getfunction stac9460_dac_mute_putfunction stac9460_dac_vol_infofunction stac9460_dac_vol_getfunction stac9460_dac_vol_putfunction stac9460_adc_mute_getfunction stac9460_adc_mute_putfunction stac9460_adc_vol_infofunction stac9460_adc_vol_getfunction stac9460_adc_vol_putfunction stac9460_mic_sw_infofunction stac9460_mic_sw_getfunction stac9460_mic_sw_putfunction stac9460_set_rate_valfunction wtm_add_controlsfunction wtm_init
Annotated Snippet
struct wtm_spec {
/* rate change needs atomic mute/unmute of all dacs*/
struct mutex mute_mutex;
};
/*
* 2*ADC 6*DAC no1 ringbuffer r/w on i2c bus
*/
static inline void stac9460_put(struct snd_ice1712 *ice, int reg,
unsigned char val)
{
snd_vt1724_write_i2c(ice, STAC9460_I2C_ADDR, reg, val);
}
static inline unsigned char stac9460_get(struct snd_ice1712 *ice, int reg)
{
return snd_vt1724_read_i2c(ice, STAC9460_I2C_ADDR, reg);
}
/*
* 2*ADC 2*DAC no2 ringbuffer r/w on i2c bus
*/
static inline void stac9460_2_put(struct snd_ice1712 *ice, int reg,
unsigned char val)
{
snd_vt1724_write_i2c(ice, STAC9460_2_I2C_ADDR, reg, val);
}
static inline unsigned char stac9460_2_get(struct snd_ice1712 *ice, int reg)
{
return snd_vt1724_read_i2c(ice, STAC9460_2_I2C_ADDR, reg);
}
/*
* DAC mute control
*/
static void stac9460_dac_mute_all(struct snd_ice1712 *ice, unsigned char mute,
unsigned short int *change_mask)
{
unsigned char new, old;
int id, idx, change;
/*stac9460 1*/
for (id = 0; id < 7; id++) {
if (*change_mask & (0x01 << id)) {
if (id == 0)
idx = STAC946X_MASTER_VOLUME;
else
idx = STAC946X_LF_VOLUME - 1 + id;
old = stac9460_get(ice, idx);
new = (~mute << 7 & 0x80) | (old & ~0x80);
change = (new != old);
if (change) {
stac9460_put(ice, idx, new);
*change_mask = *change_mask | (0x01 << id);
} else {
*change_mask = *change_mask & ~(0x01 << id);
}
}
}
/*stac9460 2*/
for (id = 0; id < 3; id++) {
if (*change_mask & (0x01 << (id + 7))) {
if (id == 0)
idx = STAC946X_MASTER_VOLUME;
else
idx = STAC946X_LF_VOLUME - 1 + id;
old = stac9460_2_get(ice, idx);
new = (~mute << 7 & 0x80) | (old & ~0x80);
change = (new != old);
if (change) {
stac9460_2_put(ice, idx, new);
*change_mask = *change_mask | (0x01 << id);
} else {
*change_mask = *change_mask & ~(0x01 << id);
}
}
}
}
#define stac9460_dac_mute_info snd_ctl_boolean_mono_info
static int stac9460_dac_mute_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
Annotation
- Immediate include surface: `linux/delay.h`, `linux/interrupt.h`, `linux/init.h`, `sound/core.h`, `sound/tlv.h`, `linux/slab.h`, `ice1712.h`, `envy24ht.h`.
- Detected declarations: `struct wtm_spec`, `function stac9460_put`, `function stac9460_get`, `function stac9460_2_put`, `function stac9460_2_get`, `function stac9460_dac_mute_all`, `function stac9460_dac_mute_get`, `function stac9460_dac_mute_put`, `function stac9460_dac_vol_info`, `function stac9460_dac_vol_get`.
- Atlas domain: Driver Families / sound/pci.
- 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.