sound/soc/codecs/lpass-wsa-macro.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/lpass-wsa-macro.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/lpass-wsa-macro.c- Extension
.c- Size
- 96028 bytes
- Lines
- 2938
- 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.
- 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/cleanup.hlinux/module.hlinux/init.hlinux/io.hlinux/of.hlinux/platform_device.hlinux/clk.hlinux/of_clk.hlinux/clk-provider.hsound/soc.hsound/soc-dapm.hlinux/pm_runtime.hlinux/of_platform.hsound/tlv.hlpass-macro-common.hlpass-wsa-macro.h
Detected Declarations
struct interp_sample_ratestruct wsa_reg_layoutstruct wsa_macrofunction wsa_is_wronly_registerfunction wsa_is_rw_register_v2_1function wsa_is_rw_register_v2_5function wsa_is_rw_registerfunction wsa_is_writeable_registerfunction wsa_is_readable_register_v2_1function wsa_is_readable_register_v2_5function wsa_is_readable_registerfunction wsa_is_volatile_register_v2_1function wsa_is_volatile_register_v2_5function wsa_is_volatile_registerfunction wsa_macro_set_spkr_modefunction wsa_macro_set_prim_interpolator_ratefunction for_each_set_bitfunction wsa_macro_set_mix_interpolator_ratefunction for_each_set_bitfunction wsa_macro_set_interpolator_ratefunction wsa_macro_hw_paramsfunction wsa_macro_get_channel_mapfunction for_each_set_bitfunction wsa_macro_mclk_enablefunction wsa_macro_enable_disable_vi_sensefunction wsa_macro_enable_disable_vi_feedbackfunction wsa_macro_mclk_eventfunction wsa_macro_enable_vi_feedbackfunction wsa_macro_hd2_controlfunction wsa_macro_config_companderfunction wsa_macro_enable_softclip_clkfunction wsa_macro_config_softclipfunction wsa_macro_interp_get_primary_regfunction wsa_macro_enable_prim_interpolatorfunction wsa_macro_config_ear_spkr_gainfunction wsa_macro_enable_interpolatorfunction wsa_macro_spk_boost_eventfunction wsa_macro_enable_echofunction wsa_macro_get_ec_hqfunction wsa_macro_set_ec_hqfunction wsa_macro_get_companderfunction wsa_macro_set_companderfunction wsa_macro_ear_spkr_pa_gain_getfunction wsa_macro_ear_spkr_pa_gain_putfunction wsa_macro_rx_mux_getfunction wsa_macro_rx_mux_putfunction wsa_macro_soft_clip_enable_getfunction wsa_macro_soft_clip_enable_put
Annotated Snippet
struct interp_sample_rate {
int sample_rate;
int rate_val;
};
static struct interp_sample_rate int_prim_sample_rate_val[] = {
{8000, 0x0}, /* 8K */
{16000, 0x1}, /* 16K */
{24000, -EINVAL},/* 24K */
{32000, 0x3}, /* 32K */
{48000, 0x4}, /* 48K */
{96000, 0x5}, /* 96K */
{192000, 0x6}, /* 192K */
{384000, 0x7}, /* 384K */
{44100, 0x8}, /* 44.1K */
};
static struct interp_sample_rate int_mix_sample_rate_val[] = {
{48000, 0x4}, /* 48K */
{96000, 0x5}, /* 96K */
{192000, 0x6}, /* 192K */
};
/* Matches also rx_mux_text */
enum {
WSA_MACRO_AIF1_PB,
WSA_MACRO_AIF_MIX1_PB,
WSA_MACRO_AIF_VI,
WSA_MACRO_AIF_ECHO,
WSA_MACRO_MAX_DAIS,
};
/**
* struct wsa_reg_layout - Register layout differences
* @rx_intx_1_mix_inp0_sel_mask: register mask for RX_INTX_1_MIX_INP0_SEL_MASK
* @rx_intx_1_mix_inp1_sel_mask: register mask for RX_INTX_1_MIX_INP1_SEL_MASK
* @rx_intx_1_mix_inp2_sel_mask: register mask for RX_INTX_1_MIX_INP2_SEL_MASK
* @rx_intx_2_sel_mask: register mask for RX_INTX_2_SEL_MASK
* @compander1_reg_offset: offset between compander registers (compander1 - compander0)
* @softclip0_reg_base: base address of softclip0 register
* @softclip1_reg_offset: offset between compander registers (softclip1 - softclip0)
*/
struct wsa_reg_layout {
unsigned int rx_intx_1_mix_inp0_sel_mask;
unsigned int rx_intx_1_mix_inp1_sel_mask;
unsigned int rx_intx_1_mix_inp2_sel_mask;
unsigned int rx_intx_2_sel_mask;
unsigned int compander1_reg_offset;
unsigned int softclip0_reg_base;
unsigned int softclip1_reg_offset;
};
struct wsa_macro {
struct device *dev;
int comp_enabled[WSA_MACRO_COMP_MAX];
int ec_hq[WSA_MACRO_RX1 + 1];
u16 prim_int_users[WSA_MACRO_RX1 + 1];
u16 wsa_mclk_users;
enum lpass_codec_version codec_version;
const struct wsa_reg_layout *reg_layout;
unsigned long active_ch_mask[WSA_MACRO_MAX_DAIS];
unsigned long active_ch_cnt[WSA_MACRO_MAX_DAIS];
int rx_port_value[WSA_MACRO_RX_MAX];
int ear_spkr_gain;
int spkr_gain_offset;
int spkr_mode;
u32 pcm_rate_vi;
int is_softclip_on[WSA_MACRO_SOFTCLIP_MAX];
int softclip_clk_users[WSA_MACRO_SOFTCLIP_MAX];
struct regmap *regmap;
struct clk *mclk;
struct clk *npl;
struct clk *macro;
struct clk *dcodec;
struct clk *fsgen;
struct clk_hw hw;
};
#define to_wsa_macro(_hw) container_of(_hw, struct wsa_macro, hw)
static const struct wsa_reg_layout wsa_codec_v2_1 = {
.rx_intx_1_mix_inp0_sel_mask = GENMASK(2, 0),
.rx_intx_1_mix_inp1_sel_mask = GENMASK(5, 3),
.rx_intx_1_mix_inp2_sel_mask = GENMASK(5, 3),
.rx_intx_2_sel_mask = GENMASK(2, 0),
.compander1_reg_offset = 0x40,
.softclip0_reg_base = 0x600,
.softclip1_reg_offset = 0x40,
};
static const struct wsa_reg_layout wsa_codec_v2_5 = {
Annotation
- Immediate include surface: `linux/cleanup.h`, `linux/module.h`, `linux/init.h`, `linux/io.h`, `linux/of.h`, `linux/platform_device.h`, `linux/clk.h`, `linux/of_clk.h`.
- Detected declarations: `struct interp_sample_rate`, `struct wsa_reg_layout`, `struct wsa_macro`, `function wsa_is_wronly_register`, `function wsa_is_rw_register_v2_1`, `function wsa_is_rw_register_v2_5`, `function wsa_is_rw_register`, `function wsa_is_writeable_register`, `function wsa_is_readable_register_v2_1`, `function wsa_is_readable_register_v2_5`.
- Atlas domain: Driver Families / sound/soc.
- Implementation status: integration implementation candidate.
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.