sound/hda/codecs/side-codecs/cs35l56_hda.c
Source file repositories/reference/linux-study-clean/sound/hda/codecs/side-codecs/cs35l56_hda.c
File Facts
- System
- Linux kernel
- Corpus path
sound/hda/codecs/side-codecs/cs35l56_hda.c- Extension
.c- Size
- 35887 bytes
- Lines
- 1287
- Domain
- Driver Families
- Bucket
- sound/hda
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/acpi.hlinux/debugfs.hlinux/gpio/consumer.hlinux/module.hlinux/pm_runtime.hlinux/regmap.hlinux/slab.hsound/core.hsound/cs-amp-lib.hsound/hda_codec.hsound/tlv.hcirrus_scodec.hcs35l56_hda.hhda_component.h../generic.h
Detected Declarations
function cs35l56_hda_wait_dsp_readyfunction cs35l56_hda_playfunction cs35l56_hda_pausefunction cs35l56_hda_playback_hookfunction cs35l56_hda_runtime_suspendfunction cs35l56_hda_runtime_resumefunction cs35l56_hda_mixer_infofunction cs35l56_hda_mixer_getfunction cs35l56_hda_mixer_putfunction cs35l56_hda_posture_infofunction cs35l56_hda_posture_getfunction cs35l56_hda_posture_putfunction cs35l56_hda_vol_infofunction cs35l56_hda_vol_getfunction cs35l56_hda_vol_putfunction cs35l56_hda_create_controlsfunction cs35l56_hda_remove_controlsfunction cs35l56_hda_request_firmware_filefunction cs35l56_hda_request_firmware_filesfunction cs35l56_hda_release_firmware_filesfunction cs35l56_hda_apply_calibrationfunction cs35l56_hda_fw_loadfunction cs35l56_hda_dsp_workfunction cs35l56_hda_debugfs_calibrate_writefunction cs35l56_hda_debugfs_cal_temperature_writefunction cs35l56_hda_debugfs_cal_data_readfunction cs35l56_hda_debugfs_cal_data_writefunction cs35l56_hda_bindfunction cs35l56_hda_unbindfunction cs35l56_hda_system_suspendfunction cs35l56_hda_system_suspend_latefunction suspendfunction cs35l56_hda_system_suspend_no_irqfunction cs35l56_hda_system_resume_no_irqfunction cs35l56_hda_system_resume_earlyfunction cs35l56_hda_system_resumefunction cs35l56_hda_fixup_yoga9function cs35l56_hda_apply_platform_fixupsfunction cs35l56_hda_read_acpifunction cs35l56_hda_common_probefunction cs35l56_hda_remove
Annotated Snippet
if (cs35l56->suspended) {
cs35l56->playing = true;
break;
}
cs35l56_hda_play(cs35l56);
break;
case HDA_GEN_PCM_ACT_CLEANUP:
if (!cs35l56->playing)
break;
cs35l56_hda_pause(cs35l56);
break;
default:
break;
}
}
static int cs35l56_hda_runtime_suspend(struct device *dev)
{
struct cs35l56_hda *cs35l56 = dev_get_drvdata(dev);
if (cs35l56->cs_dsp.booted)
cs_dsp_stop(&cs35l56->cs_dsp);
return cs35l56_runtime_suspend_common(&cs35l56->base);
}
static int cs35l56_hda_runtime_resume(struct device *dev)
{
struct cs35l56_hda *cs35l56 = dev_get_drvdata(dev);
int ret;
ret = cs35l56_runtime_resume_common(&cs35l56->base, false);
if (ret < 0)
return ret;
if (cs35l56->cs_dsp.booted) {
ret = cs_dsp_run(&cs35l56->cs_dsp);
if (ret) {
dev_dbg(cs35l56->base.dev, "%s: cs_dsp_run ret %d\n", __func__, ret);
goto err;
}
}
return 0;
err:
cs35l56_mbox_send(&cs35l56->base, CS35L56_MBOX_CMD_ALLOW_AUTO_HIBERNATE);
regmap_write(cs35l56->base.regmap, CS35L56_DSP_VIRTUAL1_MBOX_1,
CS35L56_MBOX_CMD_HIBERNATE_NOW);
regcache_cache_only(cs35l56->base.regmap, true);
return ret;
}
static int cs35l56_hda_mixer_info(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_info *uinfo)
{
uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
uinfo->count = 1;
uinfo->value.enumerated.items = CS35L56_NUM_INPUT_SRC;
if (uinfo->value.enumerated.item >= CS35L56_NUM_INPUT_SRC)
uinfo->value.enumerated.item = CS35L56_NUM_INPUT_SRC - 1;
strscpy(uinfo->value.enumerated.name, cs35l56_tx_input_texts[uinfo->value.enumerated.item],
sizeof(uinfo->value.enumerated.name));
return 0;
}
static int cs35l56_hda_mixer_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct cs35l56_hda *cs35l56 = snd_kcontrol_chip(kcontrol);
unsigned int reg_val;
int i, ret;
cs35l56_hda_wait_dsp_ready(cs35l56);
ret = regmap_read(cs35l56->base.regmap, kcontrol->private_value,
®_val);
if (ret)
return ret;
reg_val &= CS35L56_ASP_TXn_SRC_MASK;
for (i = 0; i < CS35L56_NUM_INPUT_SRC; ++i) {
if (cs35l56_tx_input_values[i] == reg_val) {
ucontrol->value.enumerated.item[0] = i;
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/debugfs.h`, `linux/gpio/consumer.h`, `linux/module.h`, `linux/pm_runtime.h`, `linux/regmap.h`, `linux/slab.h`, `sound/core.h`.
- Detected declarations: `function cs35l56_hda_wait_dsp_ready`, `function cs35l56_hda_play`, `function cs35l56_hda_pause`, `function cs35l56_hda_playback_hook`, `function cs35l56_hda_runtime_suspend`, `function cs35l56_hda_runtime_resume`, `function cs35l56_hda_mixer_info`, `function cs35l56_hda_mixer_get`, `function cs35l56_hda_mixer_put`, `function cs35l56_hda_posture_info`.
- Atlas domain: Driver Families / sound/hda.
- Implementation status: integration 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.