sound/soc/codecs/tas2764.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/tas2764.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/tas2764.c- Extension
.c- Size
- 26646 bytes
- Lines
- 1066
- 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.
- 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/module.hlinux/moduleparam.hlinux/err.hlinux/init.hlinux/delay.hlinux/hwmon.hlinux/pm.hlinux/i2c.hlinux/gpio/consumer.hlinux/regulator/consumer.hlinux/regmap.hlinux/of.hlinux/of_device.hlinux/slab.hsound/soc.hsound/pcm.hsound/pcm_params.hsound/initval.hsound/tlv.htas2764.htas2764-quirks.h
Detected Declarations
struct tas2764_privenum tas2764_devidfunction tas2764_irqfunction tas2764_resetfunction tas2764_update_pwr_ctrlfunction tas2764_codec_suspendfunction tas2764_codec_resumefunction tas2764_mutefunction tas2764_set_bitwidthfunction tas2764_set_sampleratefunction tas2764_hw_paramsfunction tas2764_set_fmtfunction tas2764_set_dai_tdm_slotfunction tas2764_write_sdout_idle_maskfunction tas2764_set_dai_tdm_idlefunction tas2764_set_bclk_ratiofunction tas2764_apply_init_quirksfunction tas2764_read_die_tempfunction tas2764_hwmon_is_faultfunction tas2764_hwmon_is_visiblefunction tas2764_hwmon_readfunction tas2764_codec_probefunction tas2764_volatile_registerfunction tas2764_parse_dtfunction tas2764_i2c_probe
Annotated Snippet
struct tas2764_priv {
struct snd_soc_component *component;
struct gpio_desc *reset_gpio;
struct gpio_desc *sdz_gpio;
struct regmap *regmap;
struct device *dev;
int irq;
enum tas2764_devid devid;
int v_sense_slot;
int i_sense_slot;
bool dac_powered;
bool unmuted;
struct {
int tx_mode;
unsigned int tx_mask;
} idle_slot_config;
};
#include "tas2764-quirks.h"
static const char *tas2764_int_ltch0_msgs[8] = {
"fault: over temperature", /* INT_LTCH0 & BIT(0) */
"fault: over current",
"fault: bad TDM clock",
"limiter active",
"fault: PVDD below limiter inflection point",
"fault: limiter max attenuation",
"fault: BOP infinite hold",
"fault: BOP mute", /* INT_LTCH0 & BIT(7) */
};
static const unsigned int tas2764_int_readout_regs[6] = {
TAS2764_INT_LTCH0,
TAS2764_INT_LTCH1,
TAS2764_INT_LTCH1_0,
TAS2764_INT_LTCH2,
TAS2764_INT_LTCH3,
TAS2764_INT_LTCH4,
};
static irqreturn_t tas2764_irq(int irq, void *data)
{
struct tas2764_priv *tas2764 = data;
u8 latched[6] = {0, 0, 0, 0, 0, 0};
int ret = IRQ_NONE;
int i;
for (i = 0; i < ARRAY_SIZE(latched); i++)
latched[i] = snd_soc_component_read(tas2764->component,
tas2764_int_readout_regs[i]);
for (i = 0; i < 8; i++) {
if (latched[0] & BIT(i)) {
dev_crit_ratelimited(tas2764->dev, "%s\n",
tas2764_int_ltch0_msgs[i]);
ret = IRQ_HANDLED;
}
}
if (latched[0]) {
dev_err_ratelimited(tas2764->dev, "other context to the fault: %02x,%02x,%02x,%02x,%02x",
latched[1], latched[2], latched[3], latched[4], latched[5]);
snd_soc_component_update_bits(tas2764->component,
TAS2764_INT_CLK_CFG,
TAS2764_INT_CLK_CFG_IRQZ_CLR,
TAS2764_INT_CLK_CFG_IRQZ_CLR);
}
return ret;
}
static void tas2764_reset(struct tas2764_priv *tas2764)
{
if (tas2764->reset_gpio) {
gpiod_set_value_cansleep(tas2764->reset_gpio, 0);
msleep(20);
gpiod_set_value_cansleep(tas2764->reset_gpio, 1);
usleep_range(1000, 2000);
}
snd_soc_component_write(tas2764->component, TAS2764_SW_RST,
TAS2764_RST);
usleep_range(1000, 2000);
}
static int tas2764_update_pwr_ctrl(struct tas2764_priv *tas2764)
{
Annotation
- Immediate include surface: `linux/module.h`, `linux/moduleparam.h`, `linux/err.h`, `linux/init.h`, `linux/delay.h`, `linux/hwmon.h`, `linux/pm.h`, `linux/i2c.h`.
- Detected declarations: `struct tas2764_priv`, `enum tas2764_devid`, `function tas2764_irq`, `function tas2764_reset`, `function tas2764_update_pwr_ctrl`, `function tas2764_codec_suspend`, `function tas2764_codec_resume`, `function tas2764_mute`, `function tas2764_set_bitwidth`, `function tas2764_set_samplerate`.
- Atlas domain: Driver Families / sound/soc.
- 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.