sound/soc/codecs/cs35l56-shared.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/cs35l56-shared.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/cs35l56-shared.c- Extension
.c- Size
- 55438 bytes
- Lines
- 1940
- Domain
- Driver Families
- Bucket
- sound/soc
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
kunit/static_stub.hlinux/array_size.hlinux/bitfield.hlinux/cleanup.hlinux/debugfs.hlinux/firmware/cirrus/wmfw.hlinux/fs.hlinux/gpio/consumer.hlinux/kstrtox.hlinux/pm_runtime.hlinux/regmap.hlinux/regulator/consumer.hlinux/spi/spi.hlinux/stddef.hlinux/string.hlinux/string_choices.hlinux/types.hsound/cs-amp-lib.hcs35l56.h
Detected Declarations
struct cs35l56_ptefunction cs35l56_set_asp_patchfunction cs35l56_set_patchfunction cs35l56_is_dsp_memoryfunction cs35l56_readable_regfunction cs35l56_precious_regfunction cs35l56_common_volatile_regfunction cs35l56_volatile_regfunction cs35l63_volatile_regfunction cs35l56_set_fw_reg_tablefunction cs35l56_mbox_sendfunction cs35l56_firmware_shutdownfunction cs35l56_wait_for_firmware_bootfunction cs35l56_wait_control_port_readyfunction cs35l56_wait_min_reset_pulsefunction cs35l56_spi_issue_bus_locked_resetfunction cs35l56_spi_system_resetfunction cs35l56_system_resetfunction cs35l56_irq_requestfunction cs35l56_irqfunction cs35l56_is_fw_reload_neededfunction cs35l56_issue_wake_eventfunction cs35l56_wait_for_ps3function cs35l56_runtime_suspend_commonfunction cs35l56_runtime_resume_commonfunction cs35l56_init_cs_dspfunction cs35l56_read_silicon_uidfunction cs35l63_read_silicon_uidfunction cs35l56_get_calibrationfunction cs35l56_stash_calibrationfunction cs35l56_perform_calibrationfunction scoped_guardfunction cs35l56_calibrate_debugfs_writefunction cs35l56_factory_calibratefunction cs35l56_cal_ambient_debugfs_writefunction cs35l56_cal_data_debugfs_readfunction cs35l56_cal_data_debugfs_writefunction cs35l56_create_cal_debugfsfunction cs35l56_remove_cal_debugfsfunction cs35l56_cal_set_status_getfunction scoped_guardfunction cs35l56_read_prot_statusfunction cs35l56_warn_if_firmware_missingfunction cs35l56_log_tuningfunction scoped_guardfunction cs35l56_hw_initfunction cs35l56_get_speaker_idfunction cs35l56_check_and_save_onchip_spkid_gpios
Annotated Snippet
struct cs35l56_pte {
u8 x;
u8 wafer_id;
u8 pte[2];
u8 lot[3];
u8 y;
u8 unused[3];
u8 dvs;
} __packed;
static_assert((sizeof(struct cs35l56_pte) % sizeof(u32)) == 0);
static int cs35l56_read_silicon_uid(struct cs35l56_base *cs35l56_base)
{
struct cs35l56_pte pte;
u64 unique_id;
int ret;
ret = regmap_raw_read(cs35l56_base->regmap, CS35L56_OTP_MEM_53, &pte, sizeof(pte));
if (ret) {
dev_err(cs35l56_base->dev, "Failed to read OTP: %d\n", ret);
return ret;
}
unique_id = (u32)pte.lot[2] | ((u32)pte.lot[1] << 8) | ((u32)pte.lot[0] << 16);
unique_id <<= 32;
unique_id |= (u32)pte.x | ((u32)pte.y << 8) | ((u32)pte.wafer_id << 16) |
((u32)pte.dvs << 24);
cs35l56_base->silicon_uid = unique_id;
return 0;
}
static int cs35l63_read_silicon_uid(struct cs35l56_base *cs35l56_base)
{
u32 tmp[2];
u64 unique_id;
int ret;
ret = regmap_bulk_read(cs35l56_base->regmap, CS35L56_DIE_STS1, tmp, ARRAY_SIZE(tmp));
if (ret) {
dev_err(cs35l56_base->dev, "Cannot obtain CS35L56_DIE_STS: %d\n", ret);
return ret;
}
unique_id = tmp[1];
unique_id <<= 32;
unique_id |= tmp[0];
cs35l56_base->silicon_uid = unique_id;
return 0;
}
/* Firmware calibration controls */
const struct cirrus_amp_cal_controls cs35l56_calibration_controls = {
.alg_id = 0x9f210,
.mem_region = WMFW_ADSP2_YM,
.ambient = "CAL_AMBIENT",
.calr = "CAL_R",
.status = "CAL_STATUS",
.checksum = "CAL_CHECKSUM",
};
EXPORT_SYMBOL_NS_GPL(cs35l56_calibration_controls, "SND_SOC_CS35L56_SHARED");
static const struct cirrus_amp_cal_controls cs35l63_calibration_controls = {
.alg_id = 0xbf210,
.mem_region = WMFW_ADSP2_YM,
.ambient = "CAL_AMBIENT",
.calr = "CAL_R",
.status = "CAL_STATUS",
.checksum = "CAL_CHECKSUM",
};
int cs35l56_get_calibration(struct cs35l56_base *cs35l56_base)
{
int ret;
/* Driver can't apply calibration to a secured part, so skip */
if (cs35l56_base->secured)
return 0;
ret = cs_amp_get_efi_calibration_data(cs35l56_base->dev,
cs35l56_base->silicon_uid,
cs35l56_base->cal_index,
&cs35l56_base->cal_data);
/* Only return an error status if probe should be aborted */
if ((ret == -ENOENT) || (ret == -EOVERFLOW))
return 0;
Annotation
- Immediate include surface: `kunit/static_stub.h`, `linux/array_size.h`, `linux/bitfield.h`, `linux/cleanup.h`, `linux/debugfs.h`, `linux/firmware/cirrus/wmfw.h`, `linux/fs.h`, `linux/gpio/consumer.h`.
- Detected declarations: `struct cs35l56_pte`, `function cs35l56_set_asp_patch`, `function cs35l56_set_patch`, `function cs35l56_is_dsp_memory`, `function cs35l56_readable_reg`, `function cs35l56_precious_reg`, `function cs35l56_common_volatile_reg`, `function cs35l56_volatile_reg`, `function cs35l63_volatile_reg`, `function cs35l56_set_fw_reg_table`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.