sound/soc/codecs/aw87390.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/aw87390.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/aw87390.c- Extension
.c- Size
- 16861 bytes
- Lines
- 620
- 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/i2c.hlinux/firmware.hlinux/regmap.hsound/soc.haw87390.haw88395/aw88395_data_type.haw88395/aw88395_device.h
Detected Declarations
function aw87390_dev_reg_updatefunction aw87390_dev_get_prof_namefunction aw87390_dev_get_prof_datafunction aw87390_dev_fw_updatefunction aw87390_power_offfunction aw87390_power_onfunction aw87390_dev_set_profile_indexfunction aw87390_profile_infofunction aw87390_profile_getfunction aw87390_profile_setfunction aw87390_request_firmware_filefunction aw87390_drv_eventfunction aw87391_rgds_drv_eventfunction aw87390_codec_probefunction aw87391_rgds_codec_initfunction aw87391_rgds_codec_probefunction aw87390_parse_channel_dtfunction aw87390_initfunction aw87390_i2c_probe
Annotated Snippet
if (data[i] == AW87390_DELAY_REG_ADDR) {
usleep_range(data[i + 1] * AW87390_REG_DELAY_TIME,
data[i + 1] * AW87390_REG_DELAY_TIME + 10);
continue;
}
ret = regmap_write(aw_dev->regmap, data[i], data[i + 1]);
if (ret)
return ret;
}
return 0;
}
static int aw87390_dev_get_prof_name(struct aw_device *aw_dev, int index, char **prof_name)
{
struct aw_prof_info *prof_info = &aw_dev->prof_info;
struct aw_prof_desc *prof_desc;
if ((index >= aw_dev->prof_info.count) || (index < 0)) {
dev_err(aw_dev->dev, "index[%d] overflow count[%d]\n",
index, aw_dev->prof_info.count);
return -EINVAL;
}
prof_desc = &aw_dev->prof_info.prof_desc[index];
*prof_name = prof_info->prof_name_list[prof_desc->id];
return 0;
}
static int aw87390_dev_get_prof_data(struct aw_device *aw_dev, int index,
struct aw_prof_desc **prof_desc)
{
if ((index >= aw_dev->prof_info.count) || (index < 0)) {
dev_err(aw_dev->dev, "%s: index[%d] overflow count[%d]\n",
__func__, index, aw_dev->prof_info.count);
return -EINVAL;
}
*prof_desc = &aw_dev->prof_info.prof_desc[index];
return 0;
}
static int aw87390_dev_fw_update(struct aw_device *aw_dev)
{
struct aw_prof_desc *prof_index_desc;
struct aw_sec_data_desc *sec_desc;
char *prof_name;
int ret;
ret = aw87390_dev_get_prof_name(aw_dev, aw_dev->prof_index, &prof_name);
if (ret) {
dev_err(aw_dev->dev, "get prof name failed\n");
return -EINVAL;
}
dev_dbg(aw_dev->dev, "start update %s", prof_name);
ret = aw87390_dev_get_prof_data(aw_dev, aw_dev->prof_index, &prof_index_desc);
if (ret) {
dev_err(aw_dev->dev, "aw87390_dev_get_prof_data failed\n");
return ret;
}
/* update reg */
sec_desc = prof_index_desc->sec_desc;
ret = aw87390_dev_reg_update(aw_dev, sec_desc[AW88395_DATA_TYPE_REG].data,
sec_desc[AW88395_DATA_TYPE_REG].len);
if (ret) {
dev_err(aw_dev->dev, "update reg failed\n");
return ret;
}
aw_dev->prof_cur = aw_dev->prof_index;
return 0;
}
static int aw87390_power_off(struct aw_device *aw_dev)
{
int ret;
if (aw_dev->status == AW87390_DEV_PW_OFF) {
dev_dbg(aw_dev->dev, "already power off\n");
return 0;
}
ret = regmap_write(aw_dev->regmap, AW87390_SYSCTRL_REG, AW87390_POWER_DOWN_VALUE);
Annotation
- Immediate include surface: `linux/i2c.h`, `linux/firmware.h`, `linux/regmap.h`, `sound/soc.h`, `aw87390.h`, `aw88395/aw88395_data_type.h`, `aw88395/aw88395_device.h`.
- Detected declarations: `function aw87390_dev_reg_update`, `function aw87390_dev_get_prof_name`, `function aw87390_dev_get_prof_data`, `function aw87390_dev_fw_update`, `function aw87390_power_off`, `function aw87390_power_on`, `function aw87390_dev_set_profile_index`, `function aw87390_profile_info`, `function aw87390_profile_get`, `function aw87390_profile_set`.
- 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.