sound/soc/codecs/tas675x.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/tas675x.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/tas675x.c- Extension
.c- Size
- 71197 bytes
- Lines
- 2195
- 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.
- 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/bitfield.hlinux/module.hlinux/mutex.hlinux/i2c.hlinux/regmap.hlinux/gpio/consumer.hlinux/regulator/consumer.hlinux/delay.hlinux/property.hlinux/interrupt.hlinux/workqueue.hlinux/pm_runtime.hlinux/iopoll.hsound/soc.hsound/tlv.hsound/pcm_params.htas675x.h
Detected Declarations
struct tas675x_reg_paramstruct tas675x_privstruct tas675x_fault_regenum tas675x_typefunction tas675x_set_state_allfunction tas675x_select_bookfunction __tas675x_select_bookfunction tas675x_dsp_mem_writefunction tas675x_dsp_mem_readfunction tas675x_gpio_func_parsefunction tas675x_config_gpio_pinfunction tas675x_rtldg_thresh_infofunction tas675x_set_rtldg_threshfunction tas675x_get_rtldg_threshfunction tas675x_set_dcldg_triggerfunction tas675x_set_acldg_triggerfunction tas675x_rtldg_impedance_infofunction tas675x_get_rtldg_impedancefunction tas675x_dc_resistance_infofunction tas675x_get_dc_resistancefunction tas675x_program_slot_offsetsfunction tas675x_hw_paramsfunction tas675x_set_fmtfunction tas675x_set_tdm_slotfunction tas675x_mute_streamfunction tas675x_hw_enablefunction tas675x_hw_disablefunction tas675x_hw_enablefunction tas675x_power_offfunction tas675x_power_onfunction tas675x_runtime_suspendfunction tas675x_runtime_resumefunction tas675x_system_suspendfunction tas675x_system_resumefunction tas675x_check_faultsfunction tas675x_fault_check_workfunction tas675x_irq_handlerfunction tas675x_is_readable_registerfunction tas675x_is_volatile_registerfunction tas675x_regmap_lockfunction tas675x_regmap_unlockfunction tas675x_i2c_probefunction tas675x_i2c_remove
Annotated Snippet
struct tas675x_reg_param {
u8 page;
u8 reg;
u32 val;
};
struct tas675x_priv {
struct device *dev;
struct regmap *regmap;
enum tas675x_type dev_type;
/* Custom regmap lock; protects writes across books */
struct mutex io_lock;
struct gpio_desc *pd_gpio;
struct gpio_desc *stby_gpio;
struct regulator_bulk_data supplies[2];
struct regulator *vbat;
bool fast_boot;
int audio_slot;
int llp_slot;
int vpredict_slot;
int isense_slot;
int bclk_offset;
int slot_width;
unsigned int tx_mask;
int gpio1_func;
int gpio2_func;
unsigned long active_playback_dais;
unsigned long active_capture_dais;
unsigned int rate;
unsigned int saved_rtldg_en;
#define TAS675X_DSP_PARAM_NUM 2
struct tas675x_reg_param dsp_params[TAS675X_DSP_PARAM_NUM];
/* Fault monitor, disabled when Fault IRQ is used */
struct delayed_work fault_check_work;
#define TAS675X_FAULT_REGS_NUM 9
unsigned int last_status[TAS675X_FAULT_REGS_NUM];
};
static const char * const tas675x_supply_names[] = {
"dvdd", /* Digital power supply */
"pvdd", /* Output powerstage supply */
};
/* Page 1 setup initialization defaults */
static const struct reg_sequence tas675x_page1_init[] = {
REG_SEQ0(TAS675X_PAGE_REG(1, 0xC8), 0x20), /* Charge pump clock */
REG_SEQ0(TAS675X_PAGE_REG(1, 0x2F), 0x90), /* VBAT idle */
REG_SEQ0(TAS675X_PAGE_REG(1, 0x29), 0x40), /* OC/CBC threshold */
REG_SEQ0(TAS675X_PAGE_REG(1, 0x2E), 0x0C), /* OC/CBC config */
REG_SEQ0(TAS675X_PAGE_REG(1, 0xC5), 0x02), /* OC/CBC config */
REG_SEQ0(TAS675X_PAGE_REG(1, 0xC6), 0x10), /* OC/CBC config */
REG_SEQ0(TAS675X_PAGE_REG(1, 0x1F), 0x20), /* OC/CBC config */
REG_SEQ0(TAS675X_PAGE_REG(1, 0x16), 0x01), /* OC/CBC config */
REG_SEQ0(TAS675X_PAGE_REG(1, 0x1E), 0x04), /* OC/CBC config */
REG_SEQ0(TAS675X_PAGE_REG(1, 0xC1), 0x00), /* CH1 DC fault */
REG_SEQ0(TAS675X_PAGE_REG(1, 0xC2), 0x04), /* CH2 DC fault */
REG_SEQ0(TAS675X_PAGE_REG(1, 0xC3), 0x00), /* CH3 DC fault */
REG_SEQ0(TAS675X_PAGE_REG(1, 0xC4), 0x00), /* CH4 DC fault */
};
static inline const char *tas675x_state_name(unsigned int state)
{
switch (state & 0x0F) {
case TAS675X_STATE_DEEPSLEEP: return "DEEPSLEEP";
case TAS675X_STATE_LOAD_DIAG: return "LOAD_DIAG";
case TAS675X_STATE_SLEEP: return "SLEEP";
case TAS675X_STATE_HIZ: return "HIZ";
case TAS675X_STATE_PLAY: return "PLAY";
case TAS675X_STATE_FAULT: return "FAULT";
case TAS675X_STATE_AUTOREC: return "AUTOREC";
default: return "UNKNOWN";
}
}
static inline int tas675x_set_state_all(struct tas675x_priv *tas, u8 state)
{
const struct reg_sequence seq[] = {
REG_SEQ0(TAS675X_STATE_CTRL_CH1_CH2_REG, state),
REG_SEQ0(TAS675X_STATE_CTRL_CH3_CH4_REG, state),
};
return regmap_multi_reg_write(tas->regmap, seq, ARRAY_SIZE(seq));
}
static inline int tas675x_select_book(struct regmap *regmap, u8 book)
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/module.h`, `linux/mutex.h`, `linux/i2c.h`, `linux/regmap.h`, `linux/gpio/consumer.h`, `linux/regulator/consumer.h`, `linux/delay.h`.
- Detected declarations: `struct tas675x_reg_param`, `struct tas675x_priv`, `struct tas675x_fault_reg`, `enum tas675x_type`, `function tas675x_set_state_all`, `function tas675x_select_book`, `function __tas675x_select_book`, `function tas675x_dsp_mem_write`, `function tas675x_dsp_mem_read`, `function tas675x_gpio_func_parse`.
- 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.
- 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.