sound/soc/codecs/aw88166.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/aw88166.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/aw88166.c- Extension
.c- Size
- 47293 bytes
- Lines
- 1820
- 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/crc32.hlinux/firmware.hlinux/gpio/consumer.hlinux/i2c.hlinux/minmax.hlinux/regmap.hsound/soc.haw88166.haw88395/aw88395_device.h
Detected Declarations
struct aw88166function aw_dev_pwdfunction aw_dev_get_int_statusfunction aw_dev_clear_int_statusfunction aw_dev_get_iis_statusfunction aw_dev_check_mode1_pllfunction aw_dev_check_mode2_pllfunction aw_dev_check_syspllfunction aw_dev_check_sysstfunction aw_dev_amppdfunction aw_dev_dsp_enablefunction aw88166_dev_get_icalkfunction aw88166_dev_get_vcalkfunction aw88166_dev_set_vcalbfunction aw_dev_init_vcalb_updatefunction aw_dev_init_re_updatefunction aw_dev_backup_sec_recordfunction aw_dev_backup_sec_recoveryfunction aw_dev_update_cali_refunction aw_dev_fw_crc_checkfunction aw_dev_cfg_crc_checkfunction aw_dev_hw_crc_checkfunction aw_dev_i2s_tx_enablefunction aw_dev_get_dsp_statusfunction aw_dev_dsp_checkfunction aw_dev_set_volumefunction aw_dev_fade_infunction aw_dev_fade_outfunction aw88166_dev_mutefunction aw88166_dev_set_ditherfunction aw88166_dev_startfunction aw_dev_dsp_update_containerfunction aw_dev_get_rafunction aw_dev_dsp_update_cfgfunction aw_dev_dsp_update_fwfunction aw_dev_check_sramfunction aw_dev_select_memclkfunction aw_dev_update_reg_containerfunction aw_dev_reg_updatefunction aw88166_dev_get_prof_namefunction aw88166_dev_get_prof_datafunction aw88166_dev_fw_updatefunction aw88166_start_pafunction aw88166_startup_workfunction aw88166_startfunction aw_dev_check_sysintfunction aw88166_stopfunction aw88166_get_fade_in_time
Annotated Snippet
struct aw88166 {
struct aw_device *aw_pa;
struct mutex lock;
struct gpio_desc *reset_gpio;
struct delayed_work start_work;
struct regmap *regmap;
struct aw_container *aw_cfg;
unsigned int check_val;
unsigned int crc_init_val;
unsigned int vcalb_init_val;
unsigned int re_init_val;
unsigned int dither_st;
bool phase_sync;
};
static const struct regmap_config aw88166_remap_config = {
.val_bits = 16,
.reg_bits = 8,
.max_register = AW88166_REG_MAX,
.reg_format_endian = REGMAP_ENDIAN_LITTLE,
.val_format_endian = REGMAP_ENDIAN_BIG,
};
static void aw_dev_pwd(struct aw_device *aw_dev, bool pwd)
{
int ret;
if (pwd)
ret = regmap_update_bits(aw_dev->regmap, AW88166_SYSCTRL_REG,
~AW88166_PWDN_MASK, AW88166_PWDN_POWER_DOWN_VALUE);
else
ret = regmap_update_bits(aw_dev->regmap, AW88166_SYSCTRL_REG,
~AW88166_PWDN_MASK, AW88166_PWDN_WORKING_VALUE);
if (ret)
dev_dbg(aw_dev->dev, "%s failed", __func__);
}
static void aw_dev_get_int_status(struct aw_device *aw_dev, unsigned short *int_status)
{
unsigned int reg_val;
int ret;
ret = regmap_read(aw_dev->regmap, AW88166_SYSINT_REG, ®_val);
if (ret)
dev_err(aw_dev->dev, "read interrupt reg fail, ret=%d", ret);
else
*int_status = reg_val;
dev_dbg(aw_dev->dev, "read interrupt reg=0x%04x", *int_status);
}
static void aw_dev_clear_int_status(struct aw_device *aw_dev)
{
u16 int_status;
/* read int status and clear */
aw_dev_get_int_status(aw_dev, &int_status);
/* make sure int status is clear */
aw_dev_get_int_status(aw_dev, &int_status);
if (int_status)
dev_dbg(aw_dev->dev, "int status(%d) is not cleaned.\n", int_status);
}
static int aw_dev_get_iis_status(struct aw_device *aw_dev)
{
unsigned int reg_val;
int ret;
ret = regmap_read(aw_dev->regmap, AW88166_SYSST_REG, ®_val);
if (ret)
return ret;
if ((reg_val & AW88166_BIT_PLL_CHECK) != AW88166_BIT_PLL_CHECK) {
dev_err(aw_dev->dev, "check pll lock fail, reg_val:0x%04x", reg_val);
return -EINVAL;
}
return 0;
}
static int aw_dev_check_mode1_pll(struct aw_device *aw_dev)
{
int ret, i;
for (i = 0; i < AW88166_DEV_SYSST_CHECK_MAX; i++) {
ret = aw_dev_get_iis_status(aw_dev);
if (ret) {
dev_err(aw_dev->dev, "mode1 iis signal check error");
usleep_range(AW88166_2000_US, AW88166_2000_US + 10);
Annotation
- Immediate include surface: `linux/crc32.h`, `linux/firmware.h`, `linux/gpio/consumer.h`, `linux/i2c.h`, `linux/minmax.h`, `linux/regmap.h`, `sound/soc.h`, `aw88166.h`.
- Detected declarations: `struct aw88166`, `function aw_dev_pwd`, `function aw_dev_get_int_status`, `function aw_dev_clear_int_status`, `function aw_dev_get_iis_status`, `function aw_dev_check_mode1_pll`, `function aw_dev_check_mode2_pll`, `function aw_dev_check_syspll`, `function aw_dev_check_sysst`, `function aw_dev_amppd`.
- 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.