sound/i2c/tea6330t.c
Source file repositories/reference/linux-study-clean/sound/i2c/tea6330t.c
File Facts
- System
- Linux kernel
- Corpus path
sound/i2c/tea6330t.c- Extension
.c- Size
- 11350 bytes
- Lines
- 398
- Domain
- Driver Families
- Bucket
- sound/i2c
- 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.
- 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/init.hlinux/slab.hlinux/module.hsound/core.hsound/control.hsound/tea6330t.h
Detected Declarations
struct tea6330tfunction snd_tea6330t_detectfunction snd_tea6330t_setfunction snd_tea6330t_info_master_volumefunction snd_tea6330t_get_master_volumefunction snd_tea6330t_put_master_volumefunction snd_tea6330t_get_master_switchfunction snd_tea6330t_put_master_switchfunction snd_tea6330t_info_bassfunction snd_tea6330t_get_bassfunction snd_tea6330t_put_bassfunction snd_tea6330t_info_treblefunction snd_tea6330t_get_treblefunction snd_tea6330t_put_treblefunction snd_tea6330_freefunction snd_tea6330t_update_mixerfunction snd_tea6330t_restore_mixerexport snd_tea6330t_detectexport snd_tea6330t_update_mixerexport snd_tea6330t_restore_mixer
Annotated Snippet
struct tea6330t {
struct snd_i2c_device *device;
struct snd_i2c_bus *bus;
int equalizer;
int fader;
unsigned char regs[8];
unsigned char mleft, mright;
unsigned char bass, treble;
unsigned char max_bass, max_treble;
};
int snd_tea6330t_detect(struct snd_i2c_bus *bus, int equalizer)
{
int res;
snd_i2c_lock(bus);
res = snd_i2c_probeaddr(bus, TEA6330T_ADDR);
snd_i2c_unlock(bus);
return res;
}
EXPORT_SYMBOL(snd_tea6330t_detect);
#if 0
static void snd_tea6330t_set(struct tea6330t *tea,
unsigned char addr, unsigned char value)
{
snd_i2c_write(tea->bus, TEA6330T_ADDR, addr, value, 1);
}
#endif
#define TEA6330T_MASTER_VOLUME(xname, xindex) \
{ .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \
.info = snd_tea6330t_info_master_volume, \
.get = snd_tea6330t_get_master_volume, .put = snd_tea6330t_put_master_volume }
static int snd_tea6330t_info_master_volume(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo)
{
uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
uinfo->count = 2;
uinfo->value.integer.min = 0;
uinfo->value.integer.max = 43;
return 0;
}
static int snd_tea6330t_get_master_volume(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct tea6330t *tea = snd_kcontrol_chip(kcontrol);
snd_i2c_lock(tea->bus);
ucontrol->value.integer.value[0] = tea->mleft - 0x14;
ucontrol->value.integer.value[1] = tea->mright - 0x14;
snd_i2c_unlock(tea->bus);
return 0;
}
static int snd_tea6330t_put_master_volume(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct tea6330t *tea = snd_kcontrol_chip(kcontrol);
int change, count, err;
unsigned char bytes[3];
unsigned char val1, val2;
val1 = (ucontrol->value.integer.value[0] % 44) + 0x14;
val2 = (ucontrol->value.integer.value[1] % 44) + 0x14;
snd_i2c_lock(tea->bus);
change = val1 != tea->mleft || val2 != tea->mright;
tea->mleft = val1;
tea->mright = val2;
count = 0;
if (tea->regs[TEA6330T_SADDR_VOLUME_LEFT] != 0) {
bytes[count++] = TEA6330T_SADDR_VOLUME_LEFT;
bytes[count++] = tea->regs[TEA6330T_SADDR_VOLUME_LEFT] = tea->mleft;
}
if (tea->regs[TEA6330T_SADDR_VOLUME_RIGHT] != 0) {
if (count == 0)
bytes[count++] = TEA6330T_SADDR_VOLUME_RIGHT;
bytes[count++] = tea->regs[TEA6330T_SADDR_VOLUME_RIGHT] = tea->mright;
}
if (count > 0) {
err = snd_i2c_sendbytes(tea->device, bytes, count);
if (err < 0)
change = err;
}
snd_i2c_unlock(tea->bus);
return change;
}
Annotation
- Immediate include surface: `linux/init.h`, `linux/slab.h`, `linux/module.h`, `sound/core.h`, `sound/control.h`, `sound/tea6330t.h`.
- Detected declarations: `struct tea6330t`, `function snd_tea6330t_detect`, `function snd_tea6330t_set`, `function snd_tea6330t_info_master_volume`, `function snd_tea6330t_get_master_volume`, `function snd_tea6330t_put_master_volume`, `function snd_tea6330t_get_master_switch`, `function snd_tea6330t_put_master_switch`, `function snd_tea6330t_info_bass`, `function snd_tea6330t_get_bass`.
- Atlas domain: Driver Families / sound/i2c.
- 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.