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

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

#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 tasdevice {};

struct tasdevice_irqinfo {};

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 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__ */