include/sound/cs35l56.h

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

File Facts

System
Linux kernel
Corpus path
include/sound/cs35l56.h
Extension
.h
Size
16476 bytes
Lines
461
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 cs35l56_spi_payload {
	__be32	addr;
	__be16	pad;
	__be32	value;
} __packed;
static_assert(sizeof(struct cs35l56_spi_payload) == 10);

struct cs35l56_fw_reg {
	unsigned int fw_ver;
	unsigned int halo_state;
	unsigned int pm_cur_stat;
	unsigned int prot_sts;
	unsigned int transducer_actual_ps;
	unsigned int user_mute;
	unsigned int user_volume;
	unsigned int posture_number;
};

struct cs35l56_cal_debugfs_fops {
	const struct debugfs_short_fops calibrate;
	const struct debugfs_short_fops cal_temperature;
	const struct debugfs_short_fops cal_data;
};

struct cs35l56_base {
	struct device *dev;
	struct regmap *regmap;
	struct cs_dsp *dsp;
	int irq;
	struct mutex irq_lock;
	u8 type;
	u8 rev;
	bool init_done;
	bool fw_patched;
	bool secured;
	bool can_hibernate;
	bool cal_data_valid;
	s8 cal_index;
	u8 num_amps;
	struct cirrus_amp_cal_data cal_data;
	struct gpio_desc *reset_gpio;
	struct cs35l56_spi_payload *spi_payload_buf;
	const struct cs35l56_fw_reg *fw_reg;
	const struct cirrus_amp_cal_controls *calibration_controls;
	struct dentry *debugfs;
	u64 silicon_uid;
	u8 onchip_spkid_gpios[5];
	u8 num_onchip_spkid_gpios;
	u8 onchip_spkid_pulls[5];
	u8 num_onchip_spkid_pulls;
};

static inline bool cs35l56_is_otp_register(unsigned int reg)
{
	return (reg >> 16) == 3;
}

static inline int cs35l56_init_config_for_spi(struct cs35l56_base *cs35l56,
					      struct spi_device *spi)
{
	cs35l56->spi_payload_buf = devm_kzalloc(&spi->dev,
						sizeof(*cs35l56->spi_payload_buf),
						GFP_KERNEL | GFP_DMA);
	if (!cs35l56->spi_payload_buf)
		return -ENOMEM;

	return 0;
}

static inline bool cs35l56_is_spi(struct cs35l56_base *cs35l56)
{
	return IS_ENABLED(CONFIG_SPI_MASTER) && !!cs35l56->spi_payload_buf;
}

extern const struct regmap_config cs35l56_regmap_i2c;
extern const struct regmap_config cs35l56_regmap_spi;
extern const struct regmap_config cs35l56_regmap_sdw;
extern const struct regmap_config cs35l63_regmap_i2c;
extern const struct regmap_config cs35l63_regmap_sdw;

extern const struct cirrus_amp_cal_controls cs35l56_calibration_controls;
extern const char * const cs35l56_cal_set_status_text[3];

extern const char * const cs35l56_tx_input_texts[CS35L56_NUM_INPUT_SRC];
extern const unsigned int cs35l56_tx_input_values[CS35L56_NUM_INPUT_SRC];

int cs35l56_set_asp_patch(struct cs35l56_base *cs35l56_base);
int cs35l56_set_patch(struct cs35l56_base *cs35l56_base);
int cs35l56_mbox_send(struct cs35l56_base *cs35l56_base, unsigned int command);
int cs35l56_firmware_shutdown(struct cs35l56_base *cs35l56_base);

Annotation

Implementation Notes