sound/soc/codecs/aw88399.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/aw88399.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/aw88399.c- Extension
.c- Size
- 56334 bytes
- Lines
- 2174
- 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/gpio/consumer.hlinux/i2c.hlinux/firmware.hlinux/minmax.hlinux/regmap.hlinux/sort.hsound/soc.haw88399.haw88395/aw88395_device.h
Detected Declarations
function 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 aw88399_dev_get_icalkfunction aw88399_dev_get_vcalkfunction aw88399_dev_get_internal_vcalkfunction aw_dev_set_vcalbfunction 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 aw88399_dev_mutefunction aw88399_dev_set_ditherfunction aw88399_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_get_cur_mode_stfunction aw_dev_update_reg_containerfunction aw_dev_reg_updatefunction aw88399_dev_get_prof_namefunction aw88399_dev_get_prof_datafunction aw88399_dev_fw_updatefunction aw88399_start_pafunction aw88399_startup_workfunction aw88399_startfunction aw_dev_check_sysintfunction aw88399_stopfunction aw_cali_svc_run_mutefunction aw_cali_svc_get_cali_cfgfunction aw_cali_svc_set_cali_cfgfunction aw_cali_svc_cali_en
Annotated Snippet
if (ret) {
dev_err(aw_dev->dev, "mode1 iis signal check error");
usleep_range(AW88399_2000_US, AW88399_2000_US + 10);
} else {
return 0;
}
}
return -EPERM;
}
static int aw_dev_check_mode2_pll(struct aw_device *aw_dev)
{
unsigned int reg_val;
int ret, i;
ret = regmap_read(aw_dev->regmap, AW88399_PLLCTRL2_REG, ®_val);
if (ret)
return ret;
reg_val &= (~AW88399_CCO_MUX_MASK);
if (reg_val == AW88399_CCO_MUX_DIVIDED_VALUE) {
dev_dbg(aw_dev->dev, "CCO_MUX is already divider");
return -EPERM;
}
/* change mode2 */
ret = regmap_update_bits(aw_dev->regmap, AW88399_PLLCTRL2_REG,
~AW88399_CCO_MUX_MASK, AW88399_CCO_MUX_DIVIDED_VALUE);
if (ret)
return ret;
for (i = 0; i < AW88399_DEV_SYSST_CHECK_MAX; i++) {
ret = aw_dev_get_iis_status(aw_dev);
if (ret) {
dev_err(aw_dev->dev, "mode2 iis signal check error");
usleep_range(AW88399_2000_US, AW88399_2000_US + 10);
} else {
break;
}
}
/* change mode1 */
regmap_update_bits(aw_dev->regmap, AW88399_PLLCTRL2_REG,
~AW88399_CCO_MUX_MASK, AW88399_CCO_MUX_BYPASS_VALUE);
if (ret == 0) {
usleep_range(AW88399_2000_US, AW88399_2000_US + 10);
for (i = 0; i < AW88399_DEV_SYSST_CHECK_MAX; i++) {
ret = aw_dev_get_iis_status(aw_dev);
if (ret) {
dev_err(aw_dev->dev, "mode2 switch to mode1, iis signal check error");
usleep_range(AW88399_2000_US, AW88399_2000_US + 10);
} else {
break;
}
}
}
return ret;
}
static int aw_dev_check_syspll(struct aw_device *aw_dev)
{
int ret;
ret = aw_dev_check_mode1_pll(aw_dev);
if (ret) {
dev_dbg(aw_dev->dev, "mode1 check iis failed try switch to mode2 check");
ret = aw_dev_check_mode2_pll(aw_dev);
if (ret) {
dev_err(aw_dev->dev, "mode2 check iis failed");
return ret;
}
}
return 0;
}
static int aw_dev_check_sysst(struct aw_device *aw_dev)
{
unsigned int check_val;
unsigned int reg_val;
int ret, i;
ret = regmap_read(aw_dev->regmap, AW88399_PWMCTRL3_REG, ®_val);
if (ret)
return ret;
if (reg_val & (~AW88399_NOISE_GATE_EN_MASK))
check_val = AW88399_BIT_SYSST_NOSWS_CHECK;
Annotation
- Immediate include surface: `linux/crc32.h`, `linux/gpio/consumer.h`, `linux/i2c.h`, `linux/firmware.h`, `linux/minmax.h`, `linux/regmap.h`, `linux/sort.h`, `sound/soc.h`.
- Detected declarations: `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`, `function aw_dev_dsp_enable`.
- 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.