sound/soc/codecs/cs35l56.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/cs35l56.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/cs35l56.c- Extension
.c- Size
- 62993 bytes
- Lines
- 2160
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
kunit/static_stub.hkunit/visibility.hlinux/acpi.hlinux/array_size.hlinux/completion.hlinux/debugfs.hlinux/delay.hlinux/device.hlinux/err.hlinux/gpio/consumer.hlinux/interrupt.hlinux/math.hlinux/module.hlinux/pm.hlinux/pm_runtime.hlinux/property.hlinux/regmap.hlinux/regulator/consumer.hlinux/slab.hlinux/soundwire/sdw.hlinux/types.hlinux/workqueue.hsound/cs-amp-lib.hsound/pcm.hsound/pcm_params.hsound/soc.hsound/soc-dapm.hsound/tlv.hwm_adsp.hcs35l56.h
Detected Declarations
function cs35l56_mask_soundwire_interruptsfunction cs35l56_unmask_soundwire_interruptsfunction cs35l56_disable_sdw_interruptsfunction cs35l56_enable_sdw_interruptsfunction cs35l56_wait_dsp_readyfunction cs35l56_dspwait_get_volswfunction cs35l56_dspwait_put_volswfunction cs35l56_cal_set_status_ctl_getfunction cs35l56_play_eventfunction CS35L56_SRC_ROUTEfunction cs35l56_dsp_eventfunction cs35l56_asp_dai_probefunction cs35l56_asp_dai_set_fmtfunction cs35l56_make_tdm_config_wordfunction cs35l56_asp_dai_set_tdm_slotfunction cs35l56_asp_dai_hw_paramsfunction cs35l56_asp_dai_set_sysclkfunction cs35l56_sdw_dai_shutdownfunction cs35l56_sdw_dai_set_tdm_slotfunction cs35l56_sdw_dai_hw_paramsfunction cs35l56_sdw_dai_hw_freefunction cs35l56_sdw_dai_set_streamfunction cs35l56_write_calfunction cs35l56_dsp_download_and_power_upfunction cs35l56_reinit_patchfunction cs35l56_patchfunction cs35l56_dsp_workfunction cs35l56_power_down_after_calfunction cs35l56_debugfs_calibrate_writefunction cs35l56_debugfs_cal_temperature_writefunction cs35l56_debugfs_cal_data_readfunction cs35l56_new_cal_data_applyfunction cs35l56_debugfs_cal_data_writefunction cs35l56_cal_data_rb_ctl_getfunction cs35l56_cal_data_ctl_getfunction cs35l56_cal_data_ctl_setfunction cs35l56_cal_ambient_ctl_getfunction cs35l56_cal_ambient_ctl_setfunction cs35l56_calibrate_ctl_getfunction cs35l56_calibrate_ctl_setfunction cs35l56_set_fw_suffixfunction cs35l56_set_fw_namefunction _cs35l56_component_probefunction cs35l56_component_removefunction cs35l56_component_probefunction cs35l56_set_bias_levelfunction cs35l56_runtime_suspend_i2c_spifunction cs35l56_runtime_resume_i2c_spi
Annotated Snippet
if (slots == 0) {
slots = params_channels(params);
/* I2S always has an even number of slots */
if (!cs35l56->tdm_mode)
slots = round_up(slots, 2);
}
bclk_freq = asp_width * slots * rate;
freq_id = cs35l56_get_bclk_freq_id(bclk_freq);
if (freq_id < 0) {
dev_err(cs35l56->base.dev, "%s: Invalid BCLK %u\n", __func__, bclk_freq);
return -EINVAL;
}
regmap_update_bits(cs35l56->base.regmap, CS35L56_ASP1_CONTROL1,
CS35L56_ASP_BCLK_FREQ_MASK,
freq_id << CS35L56_ASP_BCLK_FREQ_SHIFT);
}
if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK) {
regmap_update_bits(cs35l56->base.regmap, CS35L56_ASP1_CONTROL2,
CS35L56_ASP_RX_WIDTH_MASK, asp_width <<
CS35L56_ASP_RX_WIDTH_SHIFT);
regmap_update_bits(cs35l56->base.regmap, CS35L56_ASP1_DATA_CONTROL5,
CS35L56_ASP_RX_WL_MASK, asp_wl);
} else {
regmap_update_bits(cs35l56->base.regmap, CS35L56_ASP1_CONTROL2,
CS35L56_ASP_TX_WIDTH_MASK, asp_width <<
CS35L56_ASP_TX_WIDTH_SHIFT);
regmap_update_bits(cs35l56->base.regmap, CS35L56_ASP1_DATA_CONTROL1,
CS35L56_ASP_TX_WL_MASK, asp_wl);
}
return 0;
}
static int cs35l56_asp_dai_set_sysclk(struct snd_soc_dai *dai,
int clk_id, unsigned int freq, int dir)
{
struct cs35l56_private *cs35l56 = snd_soc_component_get_drvdata(dai->component);
int freq_id;
if (freq == 0) {
cs35l56->sysclk_set = false;
return 0;
}
freq_id = cs35l56_get_bclk_freq_id(freq);
if (freq_id < 0)
return freq_id;
regmap_update_bits(cs35l56->base.regmap, CS35L56_ASP1_CONTROL1,
CS35L56_ASP_BCLK_FREQ_MASK,
freq_id << CS35L56_ASP_BCLK_FREQ_SHIFT);
cs35l56->sysclk_set = true;
return 0;
}
static const struct snd_soc_dai_ops cs35l56_ops = {
.probe = cs35l56_asp_dai_probe,
.set_fmt = cs35l56_asp_dai_set_fmt,
.set_tdm_slot = cs35l56_asp_dai_set_tdm_slot,
.hw_params = cs35l56_asp_dai_hw_params,
.set_sysclk = cs35l56_asp_dai_set_sysclk,
};
static void cs35l56_sdw_dai_shutdown(struct snd_pcm_substream *substream,
struct snd_soc_dai *dai)
{
snd_soc_dai_set_dma_data(dai, substream, NULL);
}
static int cs35l56_sdw_dai_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
unsigned int rx_mask, int slots, int slot_width)
{
struct cs35l56_private *cs35l56 = snd_soc_component_get_drvdata(dai->component);
/* rx/tx are from point of view of the CPU end so opposite to our rx/tx */
cs35l56->rx_mask = tx_mask;
cs35l56->tx_mask = rx_mask;
return 0;
}
static int cs35l56_sdw_dai_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params,
struct snd_soc_dai *dai)
{
Annotation
- Immediate include surface: `kunit/static_stub.h`, `kunit/visibility.h`, `linux/acpi.h`, `linux/array_size.h`, `linux/completion.h`, `linux/debugfs.h`, `linux/delay.h`, `linux/device.h`.
- Detected declarations: `function cs35l56_mask_soundwire_interrupts`, `function cs35l56_unmask_soundwire_interrupts`, `function cs35l56_disable_sdw_interrupts`, `function cs35l56_enable_sdw_interrupts`, `function cs35l56_wait_dsp_ready`, `function cs35l56_dspwait_get_volsw`, `function cs35l56_dspwait_put_volsw`, `function cs35l56_cal_set_status_ctl_get`, `function cs35l56_play_event`, `function CS35L56_SRC_ROUTE`.
- 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.
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.