sound/soc/codecs/tas571x.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/tas571x.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/tas571x.c- Extension
.c- Size
- 32653 bytes
- Lines
- 1092
- 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.
- 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/clk.hlinux/delay.hlinux/device.hlinux/gpio/consumer.hlinux/i2c.hlinux/init.hlinux/kernel.hlinux/module.hlinux/of.hlinux/regmap.hlinux/regulator/consumer.hlinux/stddef.hsound/pcm_params.hsound/soc.hsound/tlv.hlinux/unaligned.htas571x.h
Detected Declarations
struct tas571x_chipstruct tas571x_privatefunction tas571x_register_sizefunction tas571x_reg_writefunction tas571x_reg_readfunction tas571x_reg_write_multiwordfunction tas571x_reg_read_multiwordfunction tas571x_coefficient_infofunction tas571x_coefficient_getfunction tas571x_coefficient_putfunction tas571x_set_dai_fmtfunction tas571x_hw_paramsfunction tas571x_mutefunction tas571x_set_bias_levelfunction tas571x_i2c_probefunction tas571x_i2c_remove
Annotated Snippet
struct tas571x_chip {
const char *const *supply_names;
int num_supply_names;
const struct snd_kcontrol_new *controls;
int num_controls;
const struct regmap_config *regmap_config;
int vol_reg_size;
};
struct tas571x_private {
const struct tas571x_chip *chip;
struct regmap *regmap;
struct regulator_bulk_data supplies[TAS571X_MAX_SUPPLIES];
struct clk *mclk;
unsigned int format;
struct gpio_desc *reset_gpio;
struct gpio_desc *pdn_gpio;
struct snd_soc_component_driver component_driver;
};
static int tas571x_register_size(struct tas571x_private *priv, unsigned int reg)
{
switch (reg) {
case TAS571X_MVOL_REG:
case TAS571X_CH1_VOL_REG:
case TAS571X_CH2_VOL_REG:
return priv->chip->vol_reg_size;
case TAS571X_INPUT_MUX_REG:
case TAS571X_CH4_SRC_SELECT_REG:
case TAS571X_PWM_MUX_REG:
case TAS5717_CH1_RIGHT_CH_MIX_REG:
case TAS5717_CH1_LEFT_CH_MIX_REG:
case TAS5717_CH2_LEFT_CH_MIX_REG:
case TAS5717_CH2_RIGHT_CH_MIX_REG:
return 4;
default:
return 1;
}
}
static int tas571x_reg_write(void *context, unsigned int reg,
unsigned int value)
{
struct i2c_client *client = context;
struct tas571x_private *priv = i2c_get_clientdata(client);
unsigned int i, size;
uint8_t buf[5];
int ret;
size = tas571x_register_size(priv, reg);
buf[0] = reg;
for (i = size; i >= 1; --i) {
buf[i] = value;
value >>= 8;
}
ret = i2c_master_send(client, buf, size + 1);
if (ret == size + 1)
return 0;
else if (ret < 0)
return ret;
else
return -EIO;
}
static int tas571x_reg_read(void *context, unsigned int reg,
unsigned int *value)
{
struct i2c_client *client = context;
struct tas571x_private *priv = i2c_get_clientdata(client);
uint8_t send_buf, recv_buf[4];
struct i2c_msg msgs[2];
unsigned int size;
unsigned int i;
int ret;
size = tas571x_register_size(priv, reg);
send_buf = reg;
msgs[0].addr = client->addr;
msgs[0].len = sizeof(send_buf);
msgs[0].buf = &send_buf;
msgs[0].flags = 0;
msgs[1].addr = client->addr;
msgs[1].len = size;
msgs[1].buf = recv_buf;
msgs[1].flags = I2C_M_RD;
Annotation
- Immediate include surface: `linux/clk.h`, `linux/delay.h`, `linux/device.h`, `linux/gpio/consumer.h`, `linux/i2c.h`, `linux/init.h`, `linux/kernel.h`, `linux/module.h`.
- Detected declarations: `struct tas571x_chip`, `struct tas571x_private`, `function tas571x_register_size`, `function tas571x_reg_write`, `function tas571x_reg_read`, `function tas571x_reg_write_multiword`, `function tas571x_reg_read_multiword`, `function tas571x_coefficient_info`, `function tas571x_coefficient_get`, `function tas571x_coefficient_put`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: source 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.