4949/*I2C Checksum */
5050#define TASDEVICE_I2CChecksum TASDEVICE_REG(0x0, 0x0, 0x7E)
5151
52+ /* XM_340 */
53+ #define TASDEVICE_XM_A1_REG TASDEVICE_REG(0x64, 0x63, 0x3c)
54+ /* XM_341 */
55+ #define TASDEVICE_XM_A2_REG TASDEVICE_REG(0x64, 0x63, 0x38)
56+
5257/* Volume control */
5358#define TAS2563_DVC_LVL TASDEVICE_REG(0x00, 0x02, 0x0C)
5459#define TAS2781_DVC_LVL TASDEVICE_REG(0x0, 0x0, 0x1A)
5560#define TAS2781_AMP_LEVEL TASDEVICE_REG(0x0, 0x0, 0x03)
5661#define TAS2781_AMP_LEVEL_MASK GENMASK(5, 1)
5762
63+ #define TAS2563_IDLE TASDEVICE_REG(0x00, 0x00, 0x3e)
64+ #define TAS2563_PRM_R0_REG TASDEVICE_REG(0x00, 0x0f, 0x34)
65+
66+ #define TAS2563_RUNTIME_RE_REG_TF TASDEVICE_REG(0x64, 0x02, 0x70)
67+ #define TAS2563_RUNTIME_RE_REG TASDEVICE_REG(0x64, 0x02, 0x48)
68+
69+ #define TAS2563_PRM_ENFF_REG TASDEVICE_REG(0x00, 0x0d, 0x54)
70+ #define TAS2563_PRM_DISTCK_REG TASDEVICE_REG(0x00, 0x0d, 0x58)
71+ #define TAS2563_PRM_TE_SCTHR_REG TASDEVICE_REG(0x00, 0x0f, 0x60)
72+ #define TAS2563_PRM_PLT_FLAG_REG TASDEVICE_REG(0x00, 0x0d, 0x74)
73+ #define TAS2563_PRM_SINEGAIN_REG TASDEVICE_REG(0x00, 0x0d, 0x7c)
74+ /* prm_Int_B0 */
75+ #define TAS2563_TE_TA1_REG TASDEVICE_REG(0x00, 0x10, 0x0c)
76+ /* prm_Int_A1 */
77+ #define TAS2563_TE_TA1_AT_REG TASDEVICE_REG(0x00, 0x10, 0x10)
78+ /* prm_TE_Beta */
79+ #define TAS2563_TE_TA2_REG TASDEVICE_REG(0x00, 0x0f, 0x64)
80+ /* prm_TE_Beta1 */
81+ #define TAS2563_TE_AT_REG TASDEVICE_REG(0x00, 0x0f, 0x68)
82+ /* prm_TE_1_Beta1 */
83+ #define TAS2563_TE_DT_REG TASDEVICE_REG(0x00, 0x0f, 0x70)
84+
85+ #define TAS2781_PRM_INT_MASK_REG TASDEVICE_REG(0x00, 0x00, 0x3b)
86+ #define TAS2781_PRM_CLK_CFG_REG TASDEVICE_REG(0x00, 0x00, 0x5c)
87+ #define TAS2781_PRM_RSVD_REG TASDEVICE_REG(0x00, 0x01, 0x19)
88+ #define TAS2781_PRM_TEST_57_REG TASDEVICE_REG(0x00, 0xfd, 0x39)
89+ #define TAS2781_PRM_TEST_62_REG TASDEVICE_REG(0x00, 0xfd, 0x3e)
90+ #define TAS2781_PRM_PVDD_UVLO_REG TASDEVICE_REG(0x00, 0x00, 0x71)
91+ #define TAS2781_PRM_CHNL_0_REG TASDEVICE_REG(0x00, 0x00, 0x03)
92+ #define TAS2781_PRM_NG_CFG0_REG TASDEVICE_REG(0x00, 0x00, 0x35)
93+ #define TAS2781_PRM_IDLE_CH_DET_REG TASDEVICE_REG(0x00, 0x00, 0x66)
94+ #define TAS2781_PRM_PLT_FLAG_REG TASDEVICE_REG(0x00, 0x14, 0x38)
95+ #define TAS2781_PRM_SINEGAIN_REG TASDEVICE_REG(0x00, 0x14, 0x40)
96+ #define TAS2781_PRM_SINEGAIN2_REG TASDEVICE_REG(0x00, 0x14, 0x44)
97+
98+ #define TAS2781_TEST_UNLOCK_REG TASDEVICE_REG(0x00, 0xFD, 0x0D)
99+ #define TAS2781_TEST_PAGE_UNLOCK 0x0D
100+
101+ #define TAS2781_RUNTIME_LATCH_RE_REG TASDEVICE_REG(0x00, 0x00, 0x49)
102+ #define TAS2781_RUNTIME_RE_REG_TF TASDEVICE_REG(0x64, 0x62, 0x48)
103+ #define TAS2781_RUNTIME_RE_REG TASDEVICE_REG(0x64, 0x63, 0x44)
104+
58105#define TASDEVICE_CMD_SING_W 0x1
59106#define TASDEVICE_CMD_BURST 0x2
60107#define TASDEVICE_CMD_DELAY 0x3
@@ -70,7 +117,15 @@ enum device_catlog_id {
70117 OTHERS
71118};
72119
120+ struct bulk_reg_val {
121+ int reg ;
122+ unsigned char val [4 ];
123+ unsigned char val_len ;
124+ bool is_locked ;
125+ };
126+
73127struct tasdevice {
128+ struct bulk_reg_val * cali_data_backup ;
74129 struct tasdevice_fw * cali_data_fmw ;
75130 unsigned int dev_addr ;
76131 unsigned int err_code ;
@@ -81,9 +136,19 @@ struct tasdevice {
81136 bool is_loaderr ;
82137};
83138
139+ struct cali_reg {
140+ unsigned int r0_reg ;
141+ unsigned int r0_low_reg ;
142+ unsigned int invr0_reg ;
143+ unsigned int pow_reg ;
144+ unsigned int tlimit_reg ;
145+ };
146+
84147struct calidata {
85148 unsigned char * data ;
86149 unsigned long total_sz ;
150+ struct cali_reg cali_reg_array ;
151+ unsigned int cali_dat_sz_per_dev ;
87152};
88153
89154struct tasdevice_priv {
@@ -119,6 +184,7 @@ struct tasdevice_priv {
119184 bool force_fwload_status ;
120185 bool playback_started ;
121186 bool isacpi ;
187+ bool is_user_space_calidata ;
122188 unsigned int global_addr ;
123189
124190 int (* fw_parse_variable_header )(struct tasdevice_priv * tas_priv ,
@@ -145,6 +211,8 @@ int tasdevice_init(struct tasdevice_priv *tas_priv);
145211void tasdevice_remove (struct tasdevice_priv * tas_priv );
146212int tasdevice_save_calibration (struct tasdevice_priv * tas_priv );
147213void tasdevice_apply_calibration (struct tasdevice_priv * tas_priv );
214+ int tasdev_chn_switch (struct tasdevice_priv * tas_priv ,
215+ unsigned short chn );
148216int tasdevice_dev_read (struct tasdevice_priv * tas_priv ,
149217 unsigned short chn , unsigned int reg , unsigned int * value );
150218int tasdevice_dev_write (struct tasdevice_priv * tas_priv ,
0 commit comments