/* SPDX-License-Identifier: (GPL-2.0 OR BSD-3-Clause) */
/*
 * mtk_amp_fs2105.h  --  Foursemi AMP FS2105 header
 *
 * Copyright (c) 2022 MediaTek Inc.
 *
 */

#ifndef _AMP_FS2105_HEADER
#define _AMP_FS2105_HEADER

/* Register Address Map */
#define FS21XX_STATUS		(0x00)
#define FS21XX_DEVID		(0x03)
#define FS21XX_REVID		(0x04)
#define FS21XX_ACCKEY		(0x0B)
#define FS21XX_CHIPINI		(0x0E)
#define FS21XX_PWRCTRL		(0x10)
#define FS21XX_SYSCTRL		(0x11)
#define FS21XX_I2SCTRL		(0x17)
#define FS21XX_DACCTRL		(0x30)
#define FS21XX_DSPCTRL		(0x41)
#define FS21XX_DACEQWL		(0x42)
#define FS21XX_DACEQWH		(0x43)
#define FS21XX_DACEQRL		(0x44)
#define FS21XX_DACEQRH		(0x45)
#define FS21XX_DACEQA		(0x46)
#define FS21XX_PLLCTRL1		(0xA1)
#define FS21XX_PLLCTRL2		(0xA2)
#define FS21XX_PLLCTRL3		(0xA3)
#define FS21XX_LVOLCTRL		(0x39)
#define FS21XX_RVOLCTRL		(0x3A)

#define FS21XX_DEV_ID		(0x2019)
#define FS2105_FAULT_REG	0x4F


#define FSM_I2C_RETRY		(5)

#define FS21XX_RAM_TAB_LENGTH_LCH	0x0134
#define FS21XX_RAM_TAB_LENGTH_RCH	0x0134
#define FS21XX_RAM_TAB_LENGTH_WCH	0x0026

struct reg_params {
	unsigned char reg_add;
	unsigned short reg_val;
};

struct ram_params {
	unsigned short ram_val_hight_16bit;
	unsigned short ram_val_low_16bit;
};

#ifndef ARRAY_SIZE
#define ARRAY_SIZE(x)	(sizeof(x) / sizeof((x)[0]))
#endif

struct amp_fs2105_priv {
	struct device	*dev;
	struct i2c_client *client;
	struct snd_soc_component *component;
	struct gpio_desc *amp_powerdown;
	struct regmap *regmap;
	bool suspended;
	const char *mtk_ini;
	u8 *init_table;
	bool initialized;
	int type;
	bool no_extini;
};

#endif /* _AMP_FS2105_HEADER */
