sound/ppc/tumbler.c
Source file repositories/reference/linux-study-clean/sound/ppc/tumbler.c
File Facts
- System
- Linux kernel
- Corpus path
sound/ppc/tumbler.c- Extension
.c- Size
- 38551 bytes
- Lines
- 1498
- Domain
- Driver Families
- Bucket
- sound/ppc
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/delay.hlinux/i2c.hlinux/kmod.hlinux/slab.hlinux/interrupt.hlinux/string.hlinux/of_irq.hlinux/io.hsound/core.hasm/irq.hasm/machdep.hasm/pmac_feature.hpmac.htumbler_volume.h
Detected Declarations
struct pmac_gpiostruct pmac_tumblerstruct tumbler_mono_volfunction send_init_clientfunction tumbler_init_clientfunction snapper_init_clientfunction write_audio_gpiofunction check_audio_gpiofunction read_audio_gpiofunction tumbler_set_master_volumefunction tumbler_info_master_volumefunction tumbler_get_master_volumefunction tumbler_put_master_volumefunction tumbler_get_master_switchfunction tumbler_put_master_switchfunction tumbler_set_drcfunction snapper_set_drcfunction tumbler_info_drc_valuefunction tumbler_get_drc_valuefunction tumbler_put_drc_valuefunction tumbler_get_drc_switchfunction tumbler_put_drc_switchfunction tumbler_set_mono_volumefunction tumbler_info_monofunction tumbler_get_monofunction tumbler_put_monofunction snapper_set_mix_vol1function snapper_set_mix_volfunction snapper_info_mixfunction snapper_get_mixfunction snapper_put_mixfunction tumbler_get_mute_switchfunction tumbler_put_mute_switchfunction snapper_set_capture_sourcefunction snapper_info_capture_sourcefunction snapper_get_capture_sourcefunction snapper_put_capture_sourcefunction tumbler_detect_headphonefunction tumbler_detect_lineoutfunction check_mutefunction device_change_handlerfunction tumbler_update_automutefunction headphone_intrfunction for_each_child_of_nodefunction for_each_child_of_nodefunction tumbler_find_devicefunction tumbler_reset_audiofunction tumbler_suspend
Annotated Snippet
struct pmac_gpio {
unsigned int addr;
u8 active_val;
u8 inactive_val;
u8 active_state;
};
struct pmac_tumbler {
struct pmac_keywest i2c;
struct pmac_gpio audio_reset;
struct pmac_gpio amp_mute;
struct pmac_gpio line_mute;
struct pmac_gpio line_detect;
struct pmac_gpio hp_mute;
struct pmac_gpio hp_detect;
int headphone_irq;
int lineout_irq;
unsigned int save_master_vol[2];
unsigned int master_vol[2];
unsigned int save_master_switch[2];
unsigned int master_switch[2];
unsigned int mono_vol[VOL_IDX_LAST_MONO];
unsigned int mix_vol[VOL_IDX_LAST_MIX][2]; /* stereo volumes for tas3004 */
int drc_range;
int drc_enable;
int capture_source;
int anded_reset;
int auto_mute_notify;
int reset_on_sleep;
u8 acs;
};
/*
*/
static int send_init_client(struct pmac_keywest *i2c, const unsigned int *regs)
{
while (*regs > 0) {
int err, count = 10;
do {
err = i2c_smbus_write_byte_data(i2c->client,
regs[0], regs[1]);
if (err >= 0)
break;
DBG("(W) i2c error %d\n", err);
mdelay(10);
} while (count--);
if (err < 0)
return -ENXIO;
regs += 2;
}
return 0;
}
static int tumbler_init_client(struct pmac_keywest *i2c)
{
static const unsigned int regs[] = {
/* normal operation, SCLK=64fps, i2s output, i2s input, 16bit width */
TAS_REG_MCS, (1<<6)|(2<<4)|(2<<2)|0,
0, /* terminator */
};
DBG("(I) tumbler init client\n");
return send_init_client(i2c, regs);
}
static int snapper_init_client(struct pmac_keywest *i2c)
{
static const unsigned int regs[] = {
/* normal operation, SCLK=64fps, i2s output, 16bit width */
TAS_REG_MCS, (1<<6)|(2<<4)|0,
/* normal operation, all-pass mode */
TAS_REG_MCS2, (1<<1),
/* normal output, no deemphasis, A input, power-up, line-in */
TAS_REG_ACS, 0,
0, /* terminator */
};
DBG("(I) snapper init client\n");
return send_init_client(i2c, regs);
}
/*
* gpio access
*/
#define do_gpio_write(gp, val) \
pmac_call_feature(PMAC_FTR_WRITE_GPIO, NULL, (gp)->addr, val)
#define do_gpio_read(gp) \
pmac_call_feature(PMAC_FTR_READ_GPIO, NULL, (gp)->addr, 0)
#define tumbler_gpio_free(gp) /* NOP */
Annotation
- Immediate include surface: `linux/init.h`, `linux/delay.h`, `linux/i2c.h`, `linux/kmod.h`, `linux/slab.h`, `linux/interrupt.h`, `linux/string.h`, `linux/of_irq.h`.
- Detected declarations: `struct pmac_gpio`, `struct pmac_tumbler`, `struct tumbler_mono_vol`, `function send_init_client`, `function tumbler_init_client`, `function snapper_init_client`, `function write_audio_gpio`, `function check_audio_gpio`, `function read_audio_gpio`, `function tumbler_set_master_volume`.
- Atlas domain: Driver Families / sound/ppc.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.