linux/include/sound/tas2781.h

/* SPDX-License-Identifier: GPL-2.0 */
//
// ALSA SoC Texas Instruments TAS2563/TAS2781 Audio Smart Amplifier
//
// Copyright (C) 2022 - 2024 Texas Instruments Incorporated
// https://www.ti.com
//
// The TAS2563/TAS2781 driver implements a flexible and configurable
// algo coefficient setting for one, two, or even multiple
// TAS2563/TAS2781 chips.
//
// Author: Shenghao Ding <[email protected]>
// Author: Kevin Lu <[email protected]>
//

#ifndef __TAS2781_H__
#define __TAS2781_H__

#include "tas2781-dsp.h"

/* version number */
#define TAS2781_DRV_VER
#define SMARTAMP_MODULE_NAME
#define TAS2781_GLOBAL_ADDR
#define TAS2563_GLOBAL_ADDR
#define TASDEVICE_RATES

#define TASDEVICE_FORMATS

/*PAGE Control Register (available in page0 of each book) */
#define TASDEVICE_PAGE_SELECT
#define TASDEVICE_BOOKCTL_PAGE
#define TASDEVICE_BOOKCTL_REG
#define TASDEVICE_BOOK_ID(reg)
#define TASDEVICE_PAGE_ID(reg)
#define TASDEVICE_PAGE_REG(reg)
#define TASDEVICE_PGRG(reg)
#define TASDEVICE_REG(book, page, reg)

/*Software Reset */
#define TASDEVICE_REG_SWRESET
#define TASDEVICE_REG_SWRESET_RESET

/*I2C Checksum */
#define TASDEVICE_I2CChecksum

/* XM_340 */
#define TASDEVICE_XM_A1_REG
/* XM_341 */
#define TASDEVICE_XM_A2_REG

/* Volume control */
#define TAS2563_DVC_LVL
#define TAS2781_DVC_LVL
#define TAS2781_AMP_LEVEL
#define TAS2781_AMP_LEVEL_MASK

#define TAS2563_IDLE
#define TAS2563_PRM_R0_REG

#define TAS2563_RUNTIME_RE_REG_TF
#define TAS2563_RUNTIME_RE_REG

#define TAS2563_PRM_ENFF_REG
#define TAS2563_PRM_DISTCK_REG
#define TAS2563_PRM_TE_SCTHR_REG
#define TAS2563_PRM_PLT_FLAG_REG
#define TAS2563_PRM_SINEGAIN_REG
/* prm_Int_B0 */
#define TAS2563_TE_TA1_REG
/* prm_Int_A1 */
#define TAS2563_TE_TA1_AT_REG
/* prm_TE_Beta */
#define TAS2563_TE_TA2_REG
/* prm_TE_Beta1 */
#define TAS2563_TE_AT_REG
/* prm_TE_1_Beta1 */
#define TAS2563_TE_DT_REG

#define TAS2781_PRM_INT_MASK_REG
#define TAS2781_PRM_CLK_CFG_REG
#define TAS2781_PRM_RSVD_REG
#define TAS2781_PRM_TEST_57_REG
#define TAS2781_PRM_TEST_62_REG
#define TAS2781_PRM_PVDD_UVLO_REG
#define TAS2781_PRM_CHNL_0_REG
#define TAS2781_PRM_NG_CFG0_REG
#define TAS2781_PRM_IDLE_CH_DET_REG
#define TAS2781_PRM_PLT_FLAG_REG
#define TAS2781_PRM_SINEGAIN_REG
#define TAS2781_PRM_SINEGAIN2_REG

#define TAS2781_TEST_UNLOCK_REG
#define TAS2781_TEST_PAGE_UNLOCK

#define TAS2781_RUNTIME_LATCH_RE_REG
#define TAS2781_RUNTIME_RE_REG_TF
#define TAS2781_RUNTIME_RE_REG

#define TASDEVICE_CMD_SING_W
#define TASDEVICE_CMD_BURST
#define TASDEVICE_CMD_DELAY
#define TASDEVICE_CMD_FIELD_W

enum audio_device {};

enum device_catlog_id {};

struct bulk_reg_val {};

struct tasdevice {};

struct cali_reg {};

struct calidata {};

struct tasdevice_priv {};

void tasdevice_reset(struct tasdevice_priv *tas_dev);
int tascodec_init(struct tasdevice_priv *tas_priv, void *codec,
	struct module *module,
	void (*cont)(const struct firmware *fw, void *context));
struct tasdevice_priv *tasdevice_kzalloc(struct i2c_client *i2c);
int tasdevice_init(struct tasdevice_priv *tas_priv);
void tasdevice_remove(struct tasdevice_priv *tas_priv);
int tasdevice_save_calibration(struct tasdevice_priv *tas_priv);
void tasdevice_apply_calibration(struct tasdevice_priv *tas_priv);
int tasdev_chn_switch(struct tasdevice_priv *tas_priv,
	unsigned short chn);
int tasdevice_dev_read(struct tasdevice_priv *tas_priv,
	unsigned short chn, unsigned int reg, unsigned int *value);
int tasdevice_dev_write(struct tasdevice_priv *tas_priv,
	unsigned short chn, unsigned int reg, unsigned int value);
int tasdevice_dev_bulk_write(
	struct tasdevice_priv *tas_priv, unsigned short chn,
	unsigned int reg, unsigned char *p_data, unsigned int n_length);
int tasdevice_dev_bulk_read(struct tasdevice_priv *tas_priv,
	unsigned short chn, unsigned int reg, unsigned char *p_data,
	unsigned int n_length);
int tasdevice_dev_update_bits(
	struct tasdevice_priv *tasdevice, unsigned short chn,
	unsigned int reg, unsigned int mask, unsigned int value);
int tasdevice_amp_putvol(struct tasdevice_priv *tas_priv,
	struct snd_ctl_elem_value *ucontrol, struct soc_mixer_control *mc);
int tasdevice_amp_getvol(struct tasdevice_priv *tas_priv,
	struct snd_ctl_elem_value *ucontrol, struct soc_mixer_control *mc);
int tasdevice_digital_putvol(struct tasdevice_priv *tas_priv,
	struct snd_ctl_elem_value *ucontrol, struct soc_mixer_control *mc);
int tasdevice_digital_getvol(struct tasdevice_priv *tas_priv,
	struct snd_ctl_elem_value *ucontrol, struct soc_mixer_control *mc);

#endif /* __TAS2781_H__ */