sound/soc/codecs/cs35l33.c

Source file repositories/reference/linux-study-clean/sound/soc/codecs/cs35l33.c

File Facts

System
Linux kernel
Corpus path
sound/soc/codecs/cs35l33.c
Extension
.c
Size
35244 bytes
Lines
1288
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 cs35l33_private {
	struct snd_soc_component *component;
	struct cs35l33_pdata pdata;
	struct regmap *regmap;
	struct gpio_desc *reset_gpio;
	bool amp_cal;
	int mclk_int;
	struct regulator_bulk_data core_supplies[2];
	int num_core_supplies;
	bool is_tdm_mode;
	bool enable_soft_ramp;
};

static const struct reg_default cs35l33_reg[] = {
	{CS35L33_PWRCTL1, 0x85},
	{CS35L33_PWRCTL2, 0xFE},
	{CS35L33_CLK_CTL, 0x0C},
	{CS35L33_BST_PEAK_CTL, 0x90},
	{CS35L33_PROTECT_CTL, 0x55},
	{CS35L33_BST_CTL1, 0x00},
	{CS35L33_BST_CTL2, 0x01},
	{CS35L33_ADSP_CTL, 0x00},
	{CS35L33_ADC_CTL, 0xC8},
	{CS35L33_DAC_CTL, 0x14},
	{CS35L33_DIG_VOL_CTL, 0x00},
	{CS35L33_CLASSD_CTL, 0x04},
	{CS35L33_AMP_CTL, 0x90},
	{CS35L33_INT_MASK_1, 0xFF},
	{CS35L33_INT_MASK_2, 0xFF},
	{CS35L33_DIAG_LOCK, 0x00},
	{CS35L33_DIAG_CTRL_1, 0x40},
	{CS35L33_DIAG_CTRL_2, 0x00},
	{CS35L33_HG_MEMLDO_CTL, 0x62},
	{CS35L33_HG_REL_RATE, 0x03},
	{CS35L33_LDO_DEL, 0x12},
	{CS35L33_HG_HEAD, 0x0A},
	{CS35L33_HG_EN, 0x05},
	{CS35L33_TX_VMON, 0x00},
	{CS35L33_TX_IMON, 0x03},
	{CS35L33_TX_VPMON, 0x02},
	{CS35L33_TX_VBSTMON, 0x05},
	{CS35L33_TX_FLAG, 0x06},
	{CS35L33_TX_EN1, 0x00},
	{CS35L33_TX_EN2, 0x00},
	{CS35L33_TX_EN3, 0x00},
	{CS35L33_TX_EN4, 0x00},
	{CS35L33_RX_AUD, 0x40},
	{CS35L33_RX_SPLY, 0x03},
	{CS35L33_RX_ALIVE, 0x04},
	{CS35L33_BST_CTL4, 0x63},
};

static const struct reg_sequence cs35l33_patch[] = {
	{ 0x00,  0x99, 0 },
	{ 0x59,  0x02, 0 },
	{ 0x52,  0x30, 0 },
	{ 0x39,  0x45, 0 },
	{ 0x57,  0x30, 0 },
	{ 0x2C,  0x68, 0 },
	{ 0x00,  0x00, 0 },
};

static bool cs35l33_volatile_register(struct device *dev, unsigned int reg)
{
	switch (reg) {
	case CS35L33_DEVID_AB:
	case CS35L33_DEVID_CD:
	case CS35L33_DEVID_E:
	case CS35L33_REV_ID:
	case CS35L33_INT_STATUS_1:
	case CS35L33_INT_STATUS_2:
	case CS35L33_HG_STATUS:
		return true;
	default:
		return false;
	}
}

static bool cs35l33_writeable_register(struct device *dev, unsigned int reg)
{
	switch (reg) {
	/* these are read only registers */
	case CS35L33_DEVID_AB:
	case CS35L33_DEVID_CD:
	case CS35L33_DEVID_E:
	case CS35L33_REV_ID:
	case CS35L33_INT_STATUS_1:
	case CS35L33_INT_STATUS_2:
	case CS35L33_HG_STATUS:
		return false;

Annotation

Implementation Notes