sound/isa/gus/gus_volume.c
Source file repositories/reference/linux-study-clean/sound/isa/gus/gus_volume.c
File Facts
- System
- Linux kernel
- Corpus path
sound/isa/gus/gus_volume.c- Extension
.c- Size
- 4960 bytes
- Lines
- 206
- Domain
- Driver Families
- Bucket
- sound/isa
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/time.hlinux/export.hsound/core.hsound/gus.hgus_tables.h
Detected Declarations
function snd_gf1_lvol_to_gvol_rawfunction snd_gf1_gvol_to_lvol_rawfunction snd_gf1_calc_ramp_ratefunction snd_gf1_translate_freqfunction snd_gf1_compute_vibratofunction snd_gf1_compute_pitchbendfunction snd_gf1_compute_freqexport snd_gf1_atten_table
Annotated Snippet
while (tmp > 255) {
tmp >>= 1;
e++;
}
}
m = vol - (1 << e);
if (m > 0) {
if (e > 8)
m >>= e - 8;
else if (e < 8)
m <<= 8 - e;
m &= 255;
}
return (e << 8) | m;
}
#if 0
unsigned int snd_gf1_gvol_to_lvol_raw(unsigned short gf1_vol)
{
unsigned int rvol;
unsigned short e, m;
if (!gf1_vol)
return 0;
e = gf1_vol >> 8;
m = (unsigned char) gf1_vol;
rvol = 1 << e;
if (e > 8)
return rvol | (m << (e - 8));
return rvol | (m >> (8 - e));
}
unsigned int snd_gf1_calc_ramp_rate(struct snd_gus_card * gus,
unsigned short start,
unsigned short end,
unsigned int us)
{
static const unsigned char vol_rates[19] =
{
23, 24, 26, 28, 29, 31, 32, 34,
36, 37, 39, 40, 42, 44, 45, 47,
49, 50, 52
};
unsigned short range, increment, value, i;
start >>= 4;
end >>= 4;
if (start < end)
us /= end - start;
else
us /= start - end;
range = 4;
value = gus->gf1.enh_mode ?
vol_rates[0] :
vol_rates[gus->gf1.active_voices - 14];
for (i = 0; i < 3; i++) {
if (us < value) {
range = i;
break;
} else
value <<= 3;
}
if (range == 4) {
range = 3;
increment = 1;
} else
increment = (value + (value >> 1)) / us;
return (range << 6) | (increment & 0x3f);
}
#endif /* 0 */
unsigned short snd_gf1_translate_freq(struct snd_gus_card * gus, unsigned int freq16)
{
freq16 >>= 3;
if (freq16 < 50)
freq16 = 50;
if (freq16 & 0xf8000000) {
freq16 = ~0xf8000000;
dev_err(gus->card->dev, "%s: overflow - freq = 0x%x\n",
__func__, freq16);
}
return ((freq16 << 9) + (gus->gf1.playback_freq >> 1)) / gus->gf1.playback_freq;
}
#if 0
short snd_gf1_compute_vibrato(short cents, unsigned short fc_register)
{
Annotation
- Immediate include surface: `linux/time.h`, `linux/export.h`, `sound/core.h`, `sound/gus.h`, `gus_tables.h`.
- Detected declarations: `function snd_gf1_lvol_to_gvol_raw`, `function snd_gf1_gvol_to_lvol_raw`, `function snd_gf1_calc_ramp_rate`, `function snd_gf1_translate_freq`, `function snd_gf1_compute_vibrato`, `function snd_gf1_compute_pitchbend`, `function snd_gf1_compute_freq`, `export snd_gf1_atten_table`.
- Atlas domain: Driver Families / sound/isa.
- 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.