linux/sound/soc/codecs/tas2781-fmwlib.c

// SPDX-License-Identifier: GPL-2.0
//
// tas2781-fmwlib.c -- TASDEVICE firmware support
//
// Copyright 2023 - 2024 Texas Instruments, Inc.
//
// Author: Shenghao Ding <[email protected]>

#include <linux/crc8.h>
#include <linux/firmware.h>
#include <linux/i2c.h>
#include <linux/init.h>
#include <linux/interrupt.h>
#include <linux/module.h>
#include <linux/of.h>
#include <linux/of_gpio.h>
#include <linux/of_irq.h>
#include <linux/regmap.h>
#include <linux/slab.h>
#include <sound/pcm_params.h>
#include <sound/soc.h>
#include <sound/tlv.h>
#include <sound/tas2781.h>
#include <asm/unaligned.h>

#define ERROR_PRAM_CRCCHK
#define ERROR_YRAM_CRCCHK
#define PPC_DRIVER_CRCCHK

#define TAS2781_SA_COEFF_SWAP_REG
#define TAS2781_YRAM_BOOK1
#define TAS2781_YRAM1_PAGE
#define TAS2781_YRAM1_START_REG

#define TAS2781_YRAM2_START_PAGE
#define TAS2781_YRAM2_END_PAGE
#define TAS2781_YRAM2_START_REG
#define TAS2781_YRAM2_END_REG

#define TAS2781_YRAM3_PAGE
#define TAS2781_YRAM3_START_REG
#define TAS2781_YRAM3_END_REG

/*should not include B0_P53_R44-R47 */
#define TAS2781_YRAM_BOOK2
#define TAS2781_YRAM4_START_PAGE
#define TAS2781_YRAM4_END_PAGE

#define TAS2781_YRAM5_PAGE
#define TAS2781_YRAM5_START_REG
#define TAS2781_YRAM5_END_REG

#define TASDEVICE_MAXPROGRAM_NUM_KERNEL
#define TASDEVICE_MAXCONFIG_NUM_KERNEL_MULTIPLE_AMPS
#define TASDEVICE_MAXCONFIG_NUM_KERNEL
#define MAIN_ALL_DEVICES_1X
#define MAIN_DEVICE_A_1X
#define MAIN_DEVICE_B_1X
#define MAIN_DEVICE_C_1X
#define MAIN_DEVICE_D_1X
#define COEFF_DEVICE_A_1X
#define COEFF_DEVICE_B_1X
#define COEFF_DEVICE_C_1X
#define COEFF_DEVICE_D_1X
#define PRE_DEVICE_A_1X
#define PRE_DEVICE_B_1X
#define PRE_DEVICE_C_1X
#define PRE_DEVICE_D_1X
#define PRE_SOFTWARE_RESET_DEVICE_A
#define PRE_SOFTWARE_RESET_DEVICE_B
#define PRE_SOFTWARE_RESET_DEVICE_C
#define PRE_SOFTWARE_RESET_DEVICE_D
#define POST_SOFTWARE_RESET_DEVICE_A
#define POST_SOFTWARE_RESET_DEVICE_B
#define POST_SOFTWARE_RESET_DEVICE_C
#define POST_SOFTWARE_RESET_DEVICE_D

struct tas_crc {};

struct blktyp_devidx_map {};

static const char deviceNumber[TASDEVICE_DSP_TAS_MAX_DEVICE] =;

/* fixed m68k compiling issue: mapping table can save code field */
static const struct blktyp_devidx_map ppc3_tas2781_mapping_table[] =;

static const struct blktyp_devidx_map ppc3_mapping_table[] =;

static const struct blktyp_devidx_map non_ppc3_mapping_table[] =;

static struct tasdevice_config_info *tasdevice_add_config(
	struct tasdevice_priv *tas_priv, unsigned char *config_data,
	unsigned int config_size, int *status)
{}

int tasdevice_rca_parser(void *context, const struct firmware *fmw)
{}
EXPORT_SYMBOL_NS_GPL();

/* fixed m68k compiling issue: mapping table can save code field */
static unsigned char map_dev_idx(struct tasdevice_fw *tas_fmw,
	struct tasdev_blk *block)
{}

static int fw_parse_block_data_kernel(struct tasdevice_fw *tas_fmw,
	struct tasdev_blk *block, const struct firmware *fmw, int offset)
{}

static int fw_parse_data_kernel(struct tasdevice_fw *tas_fmw,
	struct tasdevice_data *img_data, const struct firmware *fmw,
	int offset)
{}

static int fw_parse_program_data_kernel(
	struct tasdevice_priv *tas_priv, struct tasdevice_fw *tas_fmw,
	const struct firmware *fmw, int offset)
{}

static int fw_parse_configuration_data_kernel(
	struct tasdevice_priv *tas_priv,
	struct tasdevice_fw *tas_fmw, const struct firmware *fmw, int offset)
{}

static int fw_parse_variable_header_kernel(
	struct tasdevice_priv *tas_priv, const struct firmware *fmw,
	int offset)
{}

static int tasdevice_process_block(void *context, unsigned char *data,
	unsigned char dev_idx, int sublocksize)
{}

void tasdevice_select_cfg_blk(void *pContext, int conf_no,
	unsigned char block_type)
{}
EXPORT_SYMBOL_NS_GPL();

static int tasdevice_load_block_kernel(
	struct tasdevice_priv *tasdevice, struct tasdev_blk *block)
{}

static int fw_parse_variable_hdr(struct tasdevice_priv
	*tas_priv, struct tasdevice_dspfw_hdr *fw_hdr,
	const struct firmware *fmw, int offset)
{}

static int fw_parse_variable_header_git(struct tasdevice_priv
	*tas_priv, const struct firmware *fmw, int offset)
{}

static int fw_parse_block_data(struct tasdevice_fw *tas_fmw,
	struct tasdev_blk *block, const struct firmware *fmw, int offset)
{}

/* When parsing error occurs, all the memory resource will be released
 * in the end of tasdevice_rca_ready.
 */
static int fw_parse_data(struct tasdevice_fw *tas_fmw,
	struct tasdevice_data *img_data, const struct firmware *fmw,
	int offset)
{}

/* When parsing error occurs, all the memory resource will be released
 * in the end of tasdevice_rca_ready.
 */
static int fw_parse_program_data(struct tasdevice_priv *tas_priv,
	struct tasdevice_fw *tas_fmw, const struct firmware *fmw, int offset)
{}

/* When parsing error occurs, all the memory resource will be released
 * in the end of tasdevice_rca_ready.
 */
static int fw_parse_configuration_data(
	struct tasdevice_priv *tas_priv,
	struct tasdevice_fw *tas_fmw,
	const struct firmware *fmw, int offset)
{}

static bool check_inpage_yram_rg(struct tas_crc *cd,
	unsigned char reg, unsigned char len)
{}

static bool check_inpage_yram_bk1(struct tas_crc *cd,
	unsigned char page, unsigned char reg, unsigned char len)
{}

/* Return Code:
 * true -- the registers are in the inpage yram
 * false -- the registers are NOT in the inpage yram
 */
static bool check_inpage_yram(struct tas_crc *cd, unsigned char book,
	unsigned char page, unsigned char reg, unsigned char len)
{}

static bool check_inblock_yram_bk(struct tas_crc *cd,
	unsigned char page, unsigned char reg, unsigned char len)
{}

/* Return Code:
 * true -- the registers are in the inblock yram
 * false -- the registers are NOT in the inblock yram
 */
static bool check_inblock_yram(struct tas_crc *cd, unsigned char book,
	unsigned char page, unsigned char reg, unsigned char len)
{}

static bool check_yram(struct tas_crc *cd, unsigned char book,
	unsigned char page, unsigned char reg, unsigned char len)
{}

static int tasdev_multibytes_chksum(struct tasdevice_priv *tasdevice,
	unsigned short chn, unsigned char book, unsigned char page,
	unsigned char reg, unsigned int len)
{}

static int do_singlereg_checksum(struct tasdevice_priv *tasdevice,
	unsigned short chl, unsigned char book, unsigned char page,
	unsigned char reg, unsigned char val)
{}

static void set_err_prg_cfg(unsigned int type, struct tasdevice *dev)
{}

static int tasdev_bytes_chksum(struct tasdevice_priv *tas_priv,
	struct tasdev_blk *block, int chn, unsigned char book,
	unsigned char page, unsigned char reg, unsigned int len,
	unsigned char val, unsigned char *crc_chksum)
{}

static int tasdev_multibytes_wr(struct tasdevice_priv *tas_priv,
	struct tasdev_blk *block, int chn, unsigned char book,
	unsigned char page, unsigned char reg, unsigned char *data,
	unsigned int len, unsigned int *nr_cmds,
	unsigned char *crc_chksum)
{}

static int tasdev_block_chksum(struct tasdevice_priv *tas_priv,
	struct tasdev_blk *block, int chn)
{}

static int tasdev_load_blk(struct tasdevice_priv *tas_priv,
	struct tasdev_blk *block, int chn)
{}

static int tasdevice_load_block(struct tasdevice_priv *tas_priv,
	struct tasdev_blk *block)
{}

static int dspfw_default_callback(struct tasdevice_priv *tas_priv,
	unsigned int drv_ver, unsigned int ppcver)
{}

static int load_calib_data(struct tasdevice_priv *tas_priv,
	struct tasdevice_data *dev_data)
{}

static int fw_parse_header(struct tasdevice_priv *tas_priv,
	struct tasdevice_fw *tas_fmw, const struct firmware *fmw, int offset)
{}

static int fw_parse_variable_hdr_cal(struct tasdevice_priv *tas_priv,
	struct tasdevice_fw *tas_fmw, const struct firmware *fmw, int offset)
{}

/* When calibrated data parsing error occurs, DSP can still work with default
 * calibrated data, memory resource related to calibrated data will be
 * released in the tasdevice_codec_remove.
 */
static int fw_parse_calibration_data(struct tasdevice_priv *tas_priv,
	struct tasdevice_fw *tas_fmw, const struct firmware *fmw, int offset)
{}

int tas2781_load_calibration(void *context, char *file_name,
	unsigned short i)
{}
EXPORT_SYMBOL_NS_GPL();

static int tasdevice_dspfw_ready(const struct firmware *fmw,
	void *context)
{}

int tasdevice_dsp_parser(void *context)
{}
EXPORT_SYMBOL_NS_GPL();

static void tas2781_clear_calfirmware(struct tasdevice_fw *tas_fmw)
{}

void tasdevice_calbin_remove(void *context)
{}
EXPORT_SYMBOL_NS_GPL();

void tasdevice_config_info_remove(void *context)
{}
EXPORT_SYMBOL_NS_GPL();

static int tasdevice_load_data(struct tasdevice_priv *tas_priv,
	struct tasdevice_data *dev_data)
{}

static void tasdev_load_calibrated_data(struct tasdevice_priv *priv, int i)
{}

int tasdevice_select_tuningprm_cfg(void *context, int prm_no,
	int cfg_no, int rca_conf_no)
{}
EXPORT_SYMBOL_NS_GPL();

int tasdevice_prmg_load(void *context, int prm_no)
{}
EXPORT_SYMBOL_NS_GPL();

void tasdevice_tuning_switch(void *context, int state)
{}
EXPORT_SYMBOL_NS_GPL();

MODULE_DESCRIPTION();
MODULE_AUTHOR();
MODULE_LICENSE();