~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/sound/tas2781.h

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /include/sound/tas2781.h (Version linux-6.12-rc7) and /include/sound/tas2781.h (Version linux-6.10.14)


  1 /* SPDX-License-Identifier: GPL-2.0 */              1 /* SPDX-License-Identifier: GPL-2.0 */
  2 //                                                  2 //
  3 // ALSA SoC Texas Instruments TAS2563/TAS2781       3 // ALSA SoC Texas Instruments TAS2563/TAS2781 Audio Smart Amplifier
  4 //                                                  4 //
  5 // Copyright (C) 2022 - 2024 Texas Instruments !!   5 // Copyright (C) 2022 - 2023 Texas Instruments Incorporated
  6 // https://www.ti.com                               6 // https://www.ti.com
  7 //                                                  7 //
  8 // The TAS2563/TAS2781 driver implements a fle      8 // The TAS2563/TAS2781 driver implements a flexible and configurable
  9 // algo coefficient setting for one, two, or e      9 // algo coefficient setting for one, two, or even multiple
 10 // TAS2563/TAS2781 chips.                          10 // TAS2563/TAS2781 chips.
 11 //                                                 11 //
 12 // Author: Shenghao Ding <shenghao-ding@ti.com     12 // Author: Shenghao Ding <shenghao-ding@ti.com>
 13 // Author: Kevin Lu <kevin-lu@ti.com>              13 // Author: Kevin Lu <kevin-lu@ti.com>
 14 //                                                 14 //
 15                                                    15 
 16 #ifndef __TAS2781_H__                              16 #ifndef __TAS2781_H__
 17 #define __TAS2781_H__                              17 #define __TAS2781_H__
 18                                                    18 
 19 #include "tas2781-dsp.h"                           19 #include "tas2781-dsp.h"
 20                                                    20 
 21 /* version number */                               21 /* version number */
 22 #define TAS2781_DRV_VER                 1          22 #define TAS2781_DRV_VER                 1
 23 #define SMARTAMP_MODULE_NAME            "tas27     23 #define SMARTAMP_MODULE_NAME            "tas2781"
 24 #define TAS2781_GLOBAL_ADDR     0x40               24 #define TAS2781_GLOBAL_ADDR     0x40
 25 #define TAS2563_GLOBAL_ADDR     0x48               25 #define TAS2563_GLOBAL_ADDR     0x48
 26 #define TASDEVICE_RATES                 (SNDRV     26 #define TASDEVICE_RATES                 (SNDRV_PCM_RATE_44100 |\
 27         SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_     27         SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_96000 |\
 28         SNDRV_PCM_RATE_88200)                      28         SNDRV_PCM_RATE_88200)
 29                                                    29 
 30 #define TASDEVICE_FORMATS               (SNDRV     30 #define TASDEVICE_FORMATS               (SNDRV_PCM_FMTBIT_S16_LE | \
 31         SNDRV_PCM_FMTBIT_S24_LE | \                31         SNDRV_PCM_FMTBIT_S24_LE | \
 32         SNDRV_PCM_FMTBIT_S32_LE)                   32         SNDRV_PCM_FMTBIT_S32_LE)
 33                                                    33 
 34 /*PAGE Control Register (available in page0 of     34 /*PAGE Control Register (available in page0 of each book) */
 35 #define TASDEVICE_PAGE_SELECT           0x00       35 #define TASDEVICE_PAGE_SELECT           0x00
 36 #define TASDEVICE_BOOKCTL_PAGE          0x00       36 #define TASDEVICE_BOOKCTL_PAGE          0x00
 37 #define TASDEVICE_BOOKCTL_REG           127        37 #define TASDEVICE_BOOKCTL_REG           127
 38 #define TASDEVICE_BOOK_ID(reg)          (reg /     38 #define TASDEVICE_BOOK_ID(reg)          (reg / (256 * 128))
 39 #define TASDEVICE_PAGE_ID(reg)          ((reg      39 #define TASDEVICE_PAGE_ID(reg)          ((reg % (256 * 128)) / 128)
 40 #define TASDEVICE_PAGE_REG(reg)         ((reg      40 #define TASDEVICE_PAGE_REG(reg)         ((reg % (256 * 128)) % 128)
 41 #define TASDEVICE_PGRG(reg)             (reg %     41 #define TASDEVICE_PGRG(reg)             (reg % (256 * 128))
 42 #define TASDEVICE_REG(book, page, reg)  (((boo     42 #define TASDEVICE_REG(book, page, reg)  (((book * 256 * 128) + \
 43                                         (page      43                                         (page * 128)) + reg)
 44                                                    44 
 45 /*Software Reset */                                45 /*Software Reset */
 46 #define TASDEVICE_REG_SWRESET           TASDEV !!  46 #define TAS2781_REG_SWRESET             TASDEVICE_REG(0x0, 0X0, 0x01)
 47 #define TASDEVICE_REG_SWRESET_RESET     BIT(0) !!  47 #define TAS2781_REG_SWRESET_RESET       BIT(0)
 48                                                    48 
 49 /*I2C Checksum */                                  49 /*I2C Checksum */
 50 #define TASDEVICE_I2CChecksum           TASDEV     50 #define TASDEVICE_I2CChecksum           TASDEVICE_REG(0x0, 0x0, 0x7E)
 51                                                    51 
 52 /* XM_340 */                                   << 
 53 #define TASDEVICE_XM_A1_REG     TASDEVICE_REG( << 
 54 /* XM_341 */                                   << 
 55 #define TASDEVICE_XM_A2_REG     TASDEVICE_REG( << 
 56                                                << 
 57 /* Volume control */                               52 /* Volume control */
 58 #define TAS2563_DVC_LVL                 TASDEV << 
 59 #define TAS2781_DVC_LVL                 TASDEV     53 #define TAS2781_DVC_LVL                 TASDEVICE_REG(0x0, 0x0, 0x1A)
 60 #define TAS2781_AMP_LEVEL               TASDEV     54 #define TAS2781_AMP_LEVEL               TASDEVICE_REG(0x0, 0x0, 0x03)
 61 #define TAS2781_AMP_LEVEL_MASK          GENMAS     55 #define TAS2781_AMP_LEVEL_MASK          GENMASK(5, 1)
 62                                                    56 
 63 #define TAS2563_IDLE            TASDEVICE_REG( << 
 64 #define TAS2563_PRM_R0_REG              TASDEV << 
 65                                                << 
 66 #define TAS2563_RUNTIME_RE_REG_TF       TASDEV << 
 67 #define TAS2563_RUNTIME_RE_REG          TASDEV << 
 68                                                << 
 69 #define TAS2563_PRM_ENFF_REG            TASDEV << 
 70 #define TAS2563_PRM_DISTCK_REG          TASDEV << 
 71 #define TAS2563_PRM_TE_SCTHR_REG        TASDEV << 
 72 #define TAS2563_PRM_PLT_FLAG_REG        TASDEV << 
 73 #define TAS2563_PRM_SINEGAIN_REG        TASDEV << 
 74 /* prm_Int_B0 */                               << 
 75 #define TAS2563_TE_TA1_REG              TASDEV << 
 76 /* prm_Int_A1 */                               << 
 77 #define TAS2563_TE_TA1_AT_REG           TASDEV << 
 78 /* prm_TE_Beta */                              << 
 79 #define TAS2563_TE_TA2_REG              TASDEV << 
 80 /* prm_TE_Beta1 */                             << 
 81 #define TAS2563_TE_AT_REG               TASDEV << 
 82 /* prm_TE_1_Beta1 */                           << 
 83 #define TAS2563_TE_DT_REG               TASDEV << 
 84                                                << 
 85 #define TAS2781_PRM_INT_MASK_REG        TASDEV << 
 86 #define TAS2781_PRM_CLK_CFG_REG         TASDEV << 
 87 #define TAS2781_PRM_RSVD_REG            TASDEV << 
 88 #define TAS2781_PRM_TEST_57_REG         TASDEV << 
 89 #define TAS2781_PRM_TEST_62_REG         TASDEV << 
 90 #define TAS2781_PRM_PVDD_UVLO_REG       TASDEV << 
 91 #define TAS2781_PRM_CHNL_0_REG          TASDEV << 
 92 #define TAS2781_PRM_NG_CFG0_REG         TASDEV << 
 93 #define TAS2781_PRM_IDLE_CH_DET_REG     TASDEV << 
 94 #define TAS2781_PRM_PLT_FLAG_REG        TASDEV << 
 95 #define TAS2781_PRM_SINEGAIN_REG        TASDEV << 
 96 #define TAS2781_PRM_SINEGAIN2_REG       TASDEV << 
 97                                                << 
 98 #define TAS2781_TEST_UNLOCK_REG         TASDEV << 
 99 #define TAS2781_TEST_PAGE_UNLOCK        0x0D   << 
100                                                << 
101 #define TAS2781_RUNTIME_LATCH_RE_REG    TASDEV << 
102 #define TAS2781_RUNTIME_RE_REG_TF       TASDEV << 
103 #define TAS2781_RUNTIME_RE_REG          TASDEV << 
104                                                << 
105 #define TASDEVICE_CMD_SING_W            0x1        57 #define TASDEVICE_CMD_SING_W            0x1
106 #define TASDEVICE_CMD_BURST             0x2        58 #define TASDEVICE_CMD_BURST             0x2
107 #define TASDEVICE_CMD_DELAY             0x3        59 #define TASDEVICE_CMD_DELAY             0x3
108 #define TASDEVICE_CMD_FIELD_W           0x4        60 #define TASDEVICE_CMD_FIELD_W           0x4
109                                                    61 
110 enum audio_device {                                62 enum audio_device {
111         TAS2563,                                   63         TAS2563,
112         TAS2781,                                   64         TAS2781,
113 };                                                 65 };
114                                                    66 
115 enum device_catlog_id {                            67 enum device_catlog_id {
116         LENOVO = 0,                                68         LENOVO = 0,
117         OTHERS                                     69         OTHERS
118 };                                                 70 };
119                                                    71 
120 struct bulk_reg_val {                          << 
121         int reg;                               << 
122         unsigned char val[4];                  << 
123         unsigned char val_len;                 << 
124         bool is_locked;                        << 
125 };                                             << 
126                                                << 
127 struct tasdevice {                                 72 struct tasdevice {
128         struct bulk_reg_val *cali_data_backup; << 
129         struct tasdevice_fw *cali_data_fmw;        73         struct tasdevice_fw *cali_data_fmw;
130         unsigned int dev_addr;                     74         unsigned int dev_addr;
131         unsigned int err_code;                     75         unsigned int err_code;
132         unsigned char cur_book;                    76         unsigned char cur_book;
133         short cur_prog;                            77         short cur_prog;
134         short cur_conf;                            78         short cur_conf;
135         bool is_loading;                           79         bool is_loading;
136         bool is_loaderr;                           80         bool is_loaderr;
137 };                                                 81 };
138                                                    82 
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                                                << 
147 struct calidata {                                  83 struct calidata {
148         unsigned char *data;                       84         unsigned char *data;
149         unsigned long total_sz;                    85         unsigned long total_sz;
150         struct cali_reg cali_reg_array;        << 
151         unsigned int cali_dat_sz_per_dev;      << 
152 };                                                 86 };
153                                                    87 
154 struct tasdevice_priv {                            88 struct tasdevice_priv {
155         struct tasdevice tasdevice[TASDEVICE_M     89         struct tasdevice tasdevice[TASDEVICE_MAX_CHANNELS];
156         struct tasdevice_rca rcabin;               90         struct tasdevice_rca rcabin;
157         struct calidata cali_data;                 91         struct calidata cali_data;
158         struct tasdevice_fw *fmw;                  92         struct tasdevice_fw *fmw;
159         struct gpio_desc *reset;                   93         struct gpio_desc *reset;
160         struct mutex codec_lock;                   94         struct mutex codec_lock;
161         struct regmap *regmap;                     95         struct regmap *regmap;
162         struct device *dev;                        96         struct device *dev;
163         struct tm tm;                              97         struct tm tm;
164                                                    98 
165         enum device_catlog_id catlog_id;           99         enum device_catlog_id catlog_id;
166         unsigned char cal_binaryname[TASDEVICE    100         unsigned char cal_binaryname[TASDEVICE_MAX_CHANNELS][64];
167         unsigned char crc8_lkp_tbl[CRC8_TABLE_    101         unsigned char crc8_lkp_tbl[CRC8_TABLE_SIZE];
168         unsigned char coef_binaryname[64];        102         unsigned char coef_binaryname[64];
169         unsigned char rca_binaryname[64];         103         unsigned char rca_binaryname[64];
170         unsigned char dev_name[32];               104         unsigned char dev_name[32];
171         const char *name_prefix;               << 
172         unsigned char ndev;                       105         unsigned char ndev;
173         unsigned int magic_num;                   106         unsigned int magic_num;
174         unsigned int chip_id;                     107         unsigned int chip_id;
175         unsigned int sysclk;                      108         unsigned int sysclk;
176                                                   109 
177         int irq;                                  110         int irq;
178         int cur_prog;                             111         int cur_prog;
179         int cur_conf;                             112         int cur_conf;
180         int fw_state;                             113         int fw_state;
181         int index;                                114         int index;
182         void *client;                             115         void *client;
183         void *codec;                              116         void *codec;
184         bool force_fwload_status;                 117         bool force_fwload_status;
185         bool playback_started;                    118         bool playback_started;
186         bool isacpi;                              119         bool isacpi;
187         bool is_user_space_calidata;           << 
188         unsigned int global_addr;                 120         unsigned int global_addr;
189                                                   121 
190         int (*fw_parse_variable_header)(struct    122         int (*fw_parse_variable_header)(struct tasdevice_priv *tas_priv,
191                 const struct firmware *fmw, in    123                 const struct firmware *fmw, int offset);
192         int (*fw_parse_program_data)(struct ta    124         int (*fw_parse_program_data)(struct tasdevice_priv *tas_priv,
193                 struct tasdevice_fw *tas_fmw,     125                 struct tasdevice_fw *tas_fmw,
194                 const struct firmware *fmw, in    126                 const struct firmware *fmw, int offset);
195         int (*fw_parse_configuration_data)(str    127         int (*fw_parse_configuration_data)(struct tasdevice_priv *tas_priv,
196                 struct tasdevice_fw *tas_fmw,     128                 struct tasdevice_fw *tas_fmw,
197                 const struct firmware *fmw, in    129                 const struct firmware *fmw, int offset);
198         int (*tasdevice_load_block)(struct tas    130         int (*tasdevice_load_block)(struct tasdevice_priv *tas_priv,
199                 struct tasdev_blk *block);        131                 struct tasdev_blk *block);
200                                                   132 
201         int (*save_calibration)(struct tasdevi    133         int (*save_calibration)(struct tasdevice_priv *tas_priv);
202         void (*apply_calibration)(struct tasde    134         void (*apply_calibration)(struct tasdevice_priv *tas_priv);
203 };                                                135 };
204                                                   136 
205 void tasdevice_reset(struct tasdevice_priv *ta !! 137 void tas2781_reset(struct tasdevice_priv *tas_dev);
206 int tascodec_init(struct tasdevice_priv *tas_p    138 int tascodec_init(struct tasdevice_priv *tas_priv, void *codec,
207         struct module *module,                    139         struct module *module,
208         void (*cont)(const struct firmware *fw    140         void (*cont)(const struct firmware *fw, void *context));
209 struct tasdevice_priv *tasdevice_kzalloc(struc    141 struct tasdevice_priv *tasdevice_kzalloc(struct i2c_client *i2c);
210 int tasdevice_init(struct tasdevice_priv *tas_    142 int tasdevice_init(struct tasdevice_priv *tas_priv);
211 void tasdevice_remove(struct tasdevice_priv *t    143 void tasdevice_remove(struct tasdevice_priv *tas_priv);
212 int tasdevice_save_calibration(struct tasdevic    144 int tasdevice_save_calibration(struct tasdevice_priv *tas_priv);
213 void tasdevice_apply_calibration(struct tasdev    145 void tasdevice_apply_calibration(struct tasdevice_priv *tas_priv);
214 int tasdev_chn_switch(struct tasdevice_priv *t << 
215         unsigned short chn);                   << 
216 int tasdevice_dev_read(struct tasdevice_priv *    146 int tasdevice_dev_read(struct tasdevice_priv *tas_priv,
217         unsigned short chn, unsigned int reg,     147         unsigned short chn, unsigned int reg, unsigned int *value);
218 int tasdevice_dev_write(struct tasdevice_priv     148 int tasdevice_dev_write(struct tasdevice_priv *tas_priv,
219         unsigned short chn, unsigned int reg,     149         unsigned short chn, unsigned int reg, unsigned int value);
220 int tasdevice_dev_bulk_write(                     150 int tasdevice_dev_bulk_write(
221         struct tasdevice_priv *tas_priv, unsig    151         struct tasdevice_priv *tas_priv, unsigned short chn,
222         unsigned int reg, unsigned char *p_dat    152         unsigned int reg, unsigned char *p_data, unsigned int n_length);
223 int tasdevice_dev_bulk_read(struct tasdevice_p    153 int tasdevice_dev_bulk_read(struct tasdevice_priv *tas_priv,
224         unsigned short chn, unsigned int reg,     154         unsigned short chn, unsigned int reg, unsigned char *p_data,
225         unsigned int n_length);                   155         unsigned int n_length);
226 int tasdevice_dev_update_bits(                    156 int tasdevice_dev_update_bits(
227         struct tasdevice_priv *tasdevice, unsi    157         struct tasdevice_priv *tasdevice, unsigned short chn,
228         unsigned int reg, unsigned int mask, u    158         unsigned int reg, unsigned int mask, unsigned int value);
229 int tasdevice_amp_putvol(struct tasdevice_priv    159 int tasdevice_amp_putvol(struct tasdevice_priv *tas_priv,
230         struct snd_ctl_elem_value *ucontrol, s    160         struct snd_ctl_elem_value *ucontrol, struct soc_mixer_control *mc);
231 int tasdevice_amp_getvol(struct tasdevice_priv    161 int tasdevice_amp_getvol(struct tasdevice_priv *tas_priv,
232         struct snd_ctl_elem_value *ucontrol, s    162         struct snd_ctl_elem_value *ucontrol, struct soc_mixer_control *mc);
233 int tasdevice_digital_putvol(struct tasdevice_    163 int tasdevice_digital_putvol(struct tasdevice_priv *tas_priv,
234         struct snd_ctl_elem_value *ucontrol, s    164         struct snd_ctl_elem_value *ucontrol, struct soc_mixer_control *mc);
235 int tasdevice_digital_getvol(struct tasdevice_    165 int tasdevice_digital_getvol(struct tasdevice_priv *tas_priv,
236         struct snd_ctl_elem_value *ucontrol, s    166         struct snd_ctl_elem_value *ucontrol, struct soc_mixer_control *mc);
237                                                   167 
238 #endif /* __TAS2781_H__ */                        168 #endif /* __TAS2781_H__ */
239                                                   169 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php