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.

Dependency Surface

Detected Declarations

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

Implementation Notes