include/sound/cs35l41.h

Source file repositories/reference/linux-study-clean/include/sound/cs35l41.h

File Facts

System
Linux kernel
Corpus path
include/sound/cs35l41.h
Extension
.h
Size
35635 bytes
Lines
929
Domain
Driver Families
Bucket
include/sound
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 cs35l41_gpio_cfg {
	bool valid;
	bool pol_inv;
	bool out_en;
	unsigned int func;
};

struct cs35l41_hw_cfg {
	bool valid;
	int bst_ind;
	int bst_ipk;
	int bst_cap;
	int dout_hiz;
	struct cs35l41_gpio_cfg gpio1;
	struct cs35l41_gpio_cfg gpio2;
	unsigned int spk_pos;

	enum cs35l41_boost_type bst_type;
};

struct cs35l41_otp_packed_element_t {
	u32 reg;
	u8 shift;
	u8 size;
};

struct cs35l41_otp_map_element_t {
	u32 id;
	u32 num_elements;
	const struct cs35l41_otp_packed_element_t *map;
	u32 bit_offset;
	u32 word_offset;
};

enum cs35l41_cspl_mbox_status {
	CSPL_MBOX_STS_ERROR = U32_MAX,
	CSPL_MBOX_STS_ERROR2 = 0x00ffffff, // firmware not always sign-extending 24-bit value
	CSPL_MBOX_STS_RUNNING = 0,
	CSPL_MBOX_STS_PAUSED = 1,
	CSPL_MBOX_STS_RDY_FOR_REINIT = 2,
};

enum cs35l41_cspl_mbox_cmd {
	CSPL_MBOX_CMD_NONE = 0,
	CSPL_MBOX_CMD_PAUSE = 1,
	CSPL_MBOX_CMD_RESUME = 2,
	CSPL_MBOX_CMD_REINIT = 3,
	CSPL_MBOX_CMD_STOP_PRE_REINIT = 4,
	CSPL_MBOX_CMD_HIBERNATE = 5,
	CSPL_MBOX_CMD_OUT_OF_HIBERNATE = 6,
	CSPL_MBOX_CMD_SPK_OUT_ENABLE = 7,
	CSPL_MBOX_CMD_UNKNOWN_CMD = -1,
	CSPL_MBOX_CMD_INVALID_SEQUENCE = -2,
};

/*
 * IRQs
 */
#define CS35L41_IRQ(_irq, _name, _hand)		\
	{					\
		.irq = CS35L41_ ## _irq ## _IRQ,\
		.name = _name,			\
		.handler = _hand,		\
	}

struct cs35l41_irq {
	int irq;
	const char *name;
	irqreturn_t (*handler)(int irq, void *data);
};

#define CS35L41_REG_IRQ(_reg, _irq)					\
	[CS35L41_ ## _irq ## _IRQ] = {					\
		.reg_offset = (CS35L41_ ## _reg) - CS35L41_IRQ1_STATUS1,\
		.mask = CS35L41_ ## _irq ## _MASK			\
	}

/* (0x0000E010) CS35L41_IRQ1_STATUS1 */
#define CS35L41_BST_OVP_ERR_SHIFT		6
#define CS35L41_BST_OVP_ERR_MASK		BIT(CS35L41_BST_OVP_ERR_SHIFT)
#define CS35L41_BST_DCM_UVP_ERR_SHIFT		7
#define CS35L41_BST_DCM_UVP_ERR_MASK		BIT(CS35L41_BST_DCM_UVP_ERR_SHIFT)
#define CS35L41_BST_SHORT_ERR_SHIFT		8
#define CS35L41_BST_SHORT_ERR_MASK		BIT(CS35L41_BST_SHORT_ERR_SHIFT)
#define CS35L41_TEMP_WARN_SHIFT			15
#define CS35L41_TEMP_WARN_MASK			BIT(CS35L41_TEMP_WARN_SHIFT)
#define CS35L41_TEMP_ERR_SHIFT			17
#define CS35L41_TEMP_ERR_MASK			BIT(CS35L41_TEMP_ERR_SHIFT)
#define CS35L41_AMP_SHORT_ERR_SHIFT		31
#define CS35L41_AMP_SHORT_ERR_MASK		BIT(CS35L41_AMP_SHORT_ERR_SHIFT)

Annotation

Implementation Notes