sound/soc/codecs/wsa883x.c
Source file repositories/reference/linux-study-clean/sound/soc/codecs/wsa883x.c
File Facts
- System
- Linux kernel
- Corpus path
sound/soc/codecs/wsa883x.c- Extension
.c- Size
- 65611 bytes
- Lines
- 1732
- 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/bitops.hlinux/device.hlinux/gpio/consumer.hlinux/hwmon.hlinux/init.hlinux/kernel.hlinux/module.hlinux/pm_runtime.hlinux/printk.hlinux/regmap.hlinux/regulator/consumer.hlinux/reset.hlinux/slab.hlinux/soundwire/sdw.hlinux/soundwire/sdw_registers.hlinux/soundwire/sdw_type.hsound/pcm.hsound/pcm_params.hsound/soc-dapm.hsound/soc.hsound/tlv.h
Detected Declarations
struct wsa883x_privenum wsa_port_idsfunction wsa883x_readonly_registerfunction wsa883x_writeable_registerfunction wsa883x_volatile_registerfunction wsa883x_initfunction wsa883x_update_statusfunction wsa883x_port_prepfunction wsa_dev_mode_getfunction wsa_dev_mode_putfunction wsa883x_get_swr_portfunction wsa883x_set_swr_portfunction wsa883x_get_comp_offsetfunction wsa883x_set_comp_offsetfunction wsa883x_codec_probefunction wsa883x_spkr_eventfunction wsa883x_hw_paramsfunction wsa883x_hw_freefunction wsa883x_set_sdw_streamfunction wsa883x_digital_mutefunction wsa883x_get_tempfunction wsa883x_hwmon_is_visiblefunction wsa883x_hwmon_readfunction wsa883x_reset_assertfunction wsa883x_reset_deassertfunction wsa883x_get_resetfunction wsa883x_probefunction wsa883x_runtime_suspendfunction wsa883x_runtime_resume
Annotated Snippet
struct wsa883x_priv {
struct regmap *regmap;
struct device *dev;
struct regulator *vdd;
struct sdw_slave *slave;
struct sdw_stream_config sconfig;
struct sdw_stream_runtime *sruntime;
struct sdw_port_config port_config[WSA883X_MAX_SWR_PORTS];
struct gpio_desc *sd_n;
struct reset_control *sd_reset;
bool port_prepared[WSA883X_MAX_SWR_PORTS];
bool port_enable[WSA883X_MAX_SWR_PORTS];
int active_ports;
int dev_mode;
int comp_offset;
bool hw_init;
/*
* Protects temperature reading code (related to speaker protection) and
* fields: temperature and pa_on.
*/
struct mutex sp_lock;
unsigned int temperature;
bool pa_on;
};
enum {
WSA8830 = 0,
WSA8835,
WSA8832,
WSA8835_V2 = 5,
};
enum {
COMP_OFFSET0,
COMP_OFFSET1,
COMP_OFFSET2,
COMP_OFFSET3,
COMP_OFFSET4,
};
enum wsa_port_ids {
WSA883X_PORT_DAC,
WSA883X_PORT_COMP,
WSA883X_PORT_BOOST,
WSA883X_PORT_VISENSE,
};
static const char * const wsa_dev_mode_text[] = {
"Speaker", "Receiver", "Ultrasound"
};
enum {
SPEAKER,
RECEIVER,
ULTRASOUND,
};
static const struct soc_enum wsa_dev_mode_enum =
SOC_ENUM_SINGLE_EXT(ARRAY_SIZE(wsa_dev_mode_text), wsa_dev_mode_text);
/* 4 ports */
static struct sdw_dpn_prop wsa_sink_dpn_prop[WSA883X_MAX_SWR_PORTS] = {
[WSA883X_PORT_DAC] = {
.num = WSA883X_PORT_DAC + 1,
.type = SDW_DPN_SIMPLE,
.min_ch = 1,
.max_ch = 1,
.simple_ch_prep_sm = true,
.read_only_wordlength = true,
},
[WSA883X_PORT_COMP] = {
.num = WSA883X_PORT_COMP + 1,
.type = SDW_DPN_SIMPLE,
.min_ch = 1,
.max_ch = 1,
.simple_ch_prep_sm = true,
.read_only_wordlength = true,
},
[WSA883X_PORT_BOOST] = {
.num = WSA883X_PORT_BOOST + 1,
.type = SDW_DPN_SIMPLE,
.min_ch = 1,
.max_ch = 1,
.simple_ch_prep_sm = true,
.read_only_wordlength = true,
},
[WSA883X_PORT_VISENSE] = {
.num = WSA883X_PORT_VISENSE + 1,
.type = SDW_DPN_SIMPLE,
.min_ch = 1,
Annotation
- Immediate include surface: `linux/bitops.h`, `linux/device.h`, `linux/gpio/consumer.h`, `linux/hwmon.h`, `linux/init.h`, `linux/kernel.h`, `linux/module.h`, `linux/pm_runtime.h`.
- Detected declarations: `struct wsa883x_priv`, `enum wsa_port_ids`, `function wsa883x_readonly_register`, `function wsa883x_writeable_register`, `function wsa883x_volatile_register`, `function wsa883x_init`, `function wsa883x_update_status`, `function wsa883x_port_prep`, `function wsa_dev_mode_get`, `function wsa_dev_mode_put`.
- 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.