sound/soc/codecs/idt821034.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/idt821034.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/idt821034.c- Extension
.c- Size
- 33011 bytes
- Lines
- 1183
- Domain
- Driver Families
- Bucket
- sound/soc
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/bitrev.hlinux/gpio/driver.hlinux/module.hlinux/slab.hlinux/spi/spi.hsound/pcm_params.hsound/soc.hsound/tlv.h
Detected Declarations
struct idt821034_ampstruct idt821034function idt821034_8bit_writefunction idt821034_2x8bit_writefunction idt821034_8bit_readfunction idt821034_set_channel_powerfunction idt821034_get_channel_powerfunction idt821034_set_codec_conffunction idt821034_get_codec_conffunction idt821034_set_channel_tsfunction idt821034_set_slic_conffunction idt821034_get_slic_conffunction idt821034_write_slic_rawfunction idt821034_get_written_slic_rawfunction idt821034_read_slic_rawfunction idt821034_set_gain_channelfunction idt821034_kctrl_gain_getfunction idt821034_kctrl_gain_putfunction idt821034_kctrl_mute_getfunction idt821034_kctrl_mute_putfunction idt821034_power_eventfunction idt821034_dai_set_tdm_slotfunction idt821034_dai_set_fmtfunction idt821034_dai_hw_paramsfunction idt821034_dai_startupfunction idt821034_reset_audiofunction idt821034_component_probefunction idt821034_chip_gpio_setfunction idt821034_chip_gpio_getfunction idt821034_chip_get_directionfunction idt821034_chip_direction_inputfunction idt821034_chip_direction_outputfunction idt821034_reset_gpiofunction idt821034_gpio_initfunction idt821034_spi_probe
Annotated Snippet
struct idt821034_amp {
u16 gain;
bool is_muted;
};
struct idt821034 {
struct spi_device *spi;
struct mutex mutex;
u8 spi_tx_buf; /* Cannot use stack area for SPI (dma-safe memory) */
u8 spi_rx_buf; /* Cannot use stack area for SPI (dma-safe memory) */
struct {
u8 codec_conf;
struct {
u8 power;
u8 tx_slot;
u8 rx_slot;
u8 slic_conf;
u8 slic_control;
} ch[IDT821034_NB_CHANNEL];
} cache;
struct {
struct {
struct idt821034_amp amp_out;
struct idt821034_amp amp_in;
} ch[IDT821034_NB_CHANNEL];
} amps;
int max_ch_playback;
int max_ch_capture;
struct gpio_chip gpio_chip;
};
static int idt821034_8bit_write(struct idt821034 *idt821034, u8 val)
{
struct spi_transfer xfer[] = {
{
.tx_buf = &idt821034->spi_tx_buf,
.len = 1,
}, {
.cs_off = 1,
.tx_buf = &idt821034->spi_tx_buf,
.len = 1,
}
};
idt821034->spi_tx_buf = val;
dev_vdbg(&idt821034->spi->dev, "spi xfer wr 0x%x\n", val);
return spi_sync_transfer(idt821034->spi, xfer, 2);
}
static int idt821034_2x8bit_write(struct idt821034 *idt821034, u8 val1, u8 val2)
{
int ret;
ret = idt821034_8bit_write(idt821034, val1);
if (ret)
return ret;
return idt821034_8bit_write(idt821034, val2);
}
static int idt821034_8bit_read(struct idt821034 *idt821034, u8 valw, u8 *valr)
{
struct spi_transfer xfer[] = {
{
.tx_buf = &idt821034->spi_tx_buf,
.rx_buf = &idt821034->spi_rx_buf,
.len = 1,
}, {
.cs_off = 1,
.tx_buf = &idt821034->spi_tx_buf,
.len = 1,
}
};
int ret;
idt821034->spi_tx_buf = valw;
ret = spi_sync_transfer(idt821034->spi, xfer, 2);
if (ret)
return ret;
*valr = idt821034->spi_rx_buf;
dev_vdbg(&idt821034->spi->dev, "spi xfer wr 0x%x, rd 0x%x\n",
valw, *valr);
return 0;
}
Annotation
- Immediate include surface: `linux/bitrev.h`, `linux/gpio/driver.h`, `linux/module.h`, `linux/slab.h`, `linux/spi/spi.h`, `sound/pcm_params.h`, `sound/soc.h`, `sound/tlv.h`.
- Detected declarations: `struct idt821034_amp`, `struct idt821034`, `function idt821034_8bit_write`, `function idt821034_2x8bit_write`, `function idt821034_8bit_read`, `function idt821034_set_channel_power`, `function idt821034_get_channel_power`, `function idt821034_set_codec_conf`, `function idt821034_get_codec_conf`, `function idt821034_set_channel_ts`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.