root/sound/soc/codecs/da7213.h

/* [<][>][^][v][top][bottom][index][help] */

INCLUDED FROM


   1 /* SPDX-License-Identifier: GPL-2.0-only */
   2 /*
   3  * da7213.h - DA7213 ASoC Codec Driver
   4  *
   5  * Copyright (c) 2013 Dialog Semiconductor
   6  *
   7  * Author: Adam Thomson <Adam.Thomson.Opensource@diasemi.com>
   8  */
   9 
  10 #ifndef _DA7213_H
  11 #define _DA7213_H
  12 
  13 #include <linux/clk.h>
  14 #include <linux/regmap.h>
  15 #include <sound/da7213.h>
  16 
  17 /*
  18  * Registers
  19  */
  20 
  21 /* Status Registers */
  22 #define DA7213_STATUS1                  0x02
  23 #define DA7213_PLL_STATUS               0x03
  24 #define DA7213_AUX_L_GAIN_STATUS        0x04
  25 #define DA7213_AUX_R_GAIN_STATUS        0x05
  26 #define DA7213_MIC_1_GAIN_STATUS        0x06
  27 #define DA7213_MIC_2_GAIN_STATUS        0x07
  28 #define DA7213_MIXIN_L_GAIN_STATUS      0x08
  29 #define DA7213_MIXIN_R_GAIN_STATUS      0x09
  30 #define DA7213_ADC_L_GAIN_STATUS        0x0A
  31 #define DA7213_ADC_R_GAIN_STATUS        0x0B
  32 #define DA7213_DAC_L_GAIN_STATUS        0x0C
  33 #define DA7213_DAC_R_GAIN_STATUS        0x0D
  34 #define DA7213_HP_L_GAIN_STATUS         0x0E
  35 #define DA7213_HP_R_GAIN_STATUS         0x0F
  36 #define DA7213_LINE_GAIN_STATUS         0x10
  37 
  38 /* System Initialisation Registers */
  39 #define DA7213_DIG_ROUTING_DAI          0x21
  40 #define DA7213_SR                       0x22
  41 #define DA7213_REFERENCES               0x23
  42 #define DA7213_PLL_FRAC_TOP             0x24
  43 #define DA7213_PLL_FRAC_BOT             0x25
  44 #define DA7213_PLL_INTEGER              0x26
  45 #define DA7213_PLL_CTRL                 0x27
  46 #define DA7213_DAI_CLK_MODE             0x28
  47 #define DA7213_DAI_CTRL                 0x29
  48 #define DA7213_DIG_ROUTING_DAC          0x2A
  49 #define DA7213_ALC_CTRL1                0x2B
  50 
  51 /* Input - Gain, Select and Filter Registers */
  52 #define DA7213_AUX_L_GAIN               0x30
  53 #define DA7213_AUX_R_GAIN               0x31
  54 #define DA7213_MIXIN_L_SELECT           0x32
  55 #define DA7213_MIXIN_R_SELECT           0x33
  56 #define DA7213_MIXIN_L_GAIN             0x34
  57 #define DA7213_MIXIN_R_GAIN             0x35
  58 #define DA7213_ADC_L_GAIN               0x36
  59 #define DA7213_ADC_R_GAIN               0x37
  60 #define DA7213_ADC_FILTERS1             0x38
  61 #define DA7213_MIC_1_GAIN               0x39
  62 #define DA7213_MIC_2_GAIN               0x3A
  63 
  64 /* Output - Gain, Select and Filter Registers */
  65 #define DA7213_DAC_FILTERS5             0x40
  66 #define DA7213_DAC_FILTERS2             0x41
  67 #define DA7213_DAC_FILTERS3             0x42
  68 #define DA7213_DAC_FILTERS4             0x43
  69 #define DA7213_DAC_FILTERS1             0x44
  70 #define DA7213_DAC_L_GAIN               0x45
  71 #define DA7213_DAC_R_GAIN               0x46
  72 #define DA7213_CP_CTRL                  0x47
  73 #define DA7213_HP_L_GAIN                0x48
  74 #define DA7213_HP_R_GAIN                0x49
  75 #define DA7213_LINE_GAIN                0x4A
  76 #define DA7213_MIXOUT_L_SELECT          0x4B
  77 #define DA7213_MIXOUT_R_SELECT          0x4C
  78 
  79 /* System Controller Registers */
  80 #define DA7213_SYSTEM_MODES_INPUT       0x50
  81 #define DA7213_SYSTEM_MODES_OUTPUT      0x51
  82 
  83 /* Control Registers */
  84 #define DA7213_AUX_L_CTRL               0x60
  85 #define DA7213_AUX_R_CTRL               0x61
  86 #define DA7213_MICBIAS_CTRL             0x62
  87 #define DA7213_MIC_1_CTRL               0x63
  88 #define DA7213_MIC_2_CTRL               0x64
  89 #define DA7213_MIXIN_L_CTRL             0x65
  90 #define DA7213_MIXIN_R_CTRL             0x66
  91 #define DA7213_ADC_L_CTRL               0x67
  92 #define DA7213_ADC_R_CTRL               0x68
  93 #define DA7213_DAC_L_CTRL               0x69
  94 #define DA7213_DAC_R_CTRL               0x6A
  95 #define DA7213_HP_L_CTRL                0x6B
  96 #define DA7213_HP_R_CTRL                0x6C
  97 #define DA7213_LINE_CTRL                0x6D
  98 #define DA7213_MIXOUT_L_CTRL            0x6E
  99 #define DA7213_MIXOUT_R_CTRL            0x6F
 100 
 101 /* Configuration Registers */
 102 #define DA7213_LDO_CTRL                 0x90
 103 #define DA7213_IO_CTRL                  0x91
 104 #define DA7213_GAIN_RAMP_CTRL           0x92
 105 #define DA7213_MIC_CONFIG               0x93
 106 #define DA7213_PC_COUNT                 0x94
 107 #define DA7213_CP_VOL_THRESHOLD1        0x95
 108 #define DA7213_CP_DELAY                 0x96
 109 #define DA7213_CP_DETECTOR              0x97
 110 #define DA7213_DAI_OFFSET               0x98
 111 #define DA7213_DIG_CTRL                 0x99
 112 #define DA7213_ALC_CTRL2                0x9A
 113 #define DA7213_ALC_CTRL3                0x9B
 114 #define DA7213_ALC_NOISE                0x9C
 115 #define DA7213_ALC_TARGET_MIN           0x9D
 116 #define DA7213_ALC_TARGET_MAX           0x9E
 117 #define DA7213_ALC_GAIN_LIMITS          0x9F
 118 #define DA7213_ALC_ANA_GAIN_LIMITS      0xA0
 119 #define DA7213_ALC_ANTICLIP_CTRL        0xA1
 120 #define DA7213_ALC_ANTICLIP_LEVEL       0xA2
 121 
 122 #define DA7213_ALC_OFFSET_AUTO_M_L      0xA3
 123 #define DA7213_ALC_OFFSET_AUTO_U_L      0xA4
 124 #define DA7213_ALC_OFFSET_MAN_M_L       0xA6
 125 #define DA7213_ALC_OFFSET_MAN_U_L       0xA7
 126 #define DA7213_ALC_OFFSET_AUTO_M_R      0xA8
 127 #define DA7213_ALC_OFFSET_AUTO_U_R      0xA9
 128 #define DA7213_ALC_OFFSET_MAN_M_R       0xAB
 129 #define DA7213_ALC_OFFSET_MAN_U_R       0xAC
 130 #define DA7213_ALC_CIC_OP_LVL_CTRL      0xAD
 131 #define DA7213_ALC_CIC_OP_LVL_DATA      0xAE
 132 #define DA7213_DAC_NG_SETUP_TIME        0xAF
 133 #define DA7213_DAC_NG_OFF_THRESHOLD     0xB0
 134 #define DA7213_DAC_NG_ON_THRESHOLD      0xB1
 135 #define DA7213_DAC_NG_CTRL              0xB2
 136 
 137 
 138 /*
 139  * Bit fields
 140  */
 141 
 142 /* DA7213_PLL_STATUS = 0x03 */
 143 #define DA7219_PLL_SRM_LOCK                                     (0x1 << 1)
 144 
 145 /* DA7213_SR = 0x22 */
 146 #define DA7213_SR_8000                                          (0x1 << 0)
 147 #define DA7213_SR_11025                                         (0x2 << 0)
 148 #define DA7213_SR_12000                                         (0x3 << 0)
 149 #define DA7213_SR_16000                                         (0x5 << 0)
 150 #define DA7213_SR_22050                                         (0x6 << 0)
 151 #define DA7213_SR_24000                                         (0x7 << 0)
 152 #define DA7213_SR_32000                                         (0x9 << 0)
 153 #define DA7213_SR_44100                                         (0xA << 0)
 154 #define DA7213_SR_48000                                         (0xB << 0)
 155 #define DA7213_SR_88200                                         (0xE << 0)
 156 #define DA7213_SR_96000                                         (0xF << 0)
 157 
 158 /* DA7213_REFERENCES = 0x23 */
 159 #define DA7213_BIAS_EN                                          (0x1 << 3)
 160 #define DA7213_VMID_EN                                          (0x1 << 7)
 161 
 162 /* DA7213_PLL_CTRL = 0x27 */
 163 #define DA7213_PLL_INDIV_5_TO_9_MHZ                             (0x0 << 2)
 164 #define DA7213_PLL_INDIV_9_TO_18_MHZ                            (0x1 << 2)
 165 #define DA7213_PLL_INDIV_18_TO_36_MHZ                           (0x2 << 2)
 166 #define DA7213_PLL_INDIV_36_TO_54_MHZ                           (0x3 << 2)
 167 #define DA7213_PLL_INDIV_MASK                                   (0x3 << 2)
 168 #define DA7213_PLL_MCLK_SQR_EN                                  (0x1 << 4)
 169 #define DA7213_PLL_32K_MODE                                     (0x1 << 5)
 170 #define DA7213_PLL_SRM_EN                                       (0x1 << 6)
 171 #define DA7213_PLL_EN                                           (0x1 << 7)
 172 #define DA7213_PLL_MODE_MASK                                    (0x7 << 5)
 173 
 174 /* DA7213_DAI_CLK_MODE = 0x28 */
 175 #define DA7213_DAI_BCLKS_PER_WCLK_32                            (0x0 << 0)
 176 #define DA7213_DAI_BCLKS_PER_WCLK_64                            (0x1 << 0)
 177 #define DA7213_DAI_BCLKS_PER_WCLK_128                           (0x2 << 0)
 178 #define DA7213_DAI_BCLKS_PER_WCLK_256                           (0x3 << 0)
 179 #define DA7213_DAI_BCLKS_PER_WCLK_MASK                          (0x3 << 0)
 180 #define DA7213_DAI_CLK_POL_INV                                  (0x1 << 2)
 181 #define DA7213_DAI_CLK_POL_MASK                                 (0x1 << 2)
 182 #define DA7213_DAI_WCLK_POL_INV                                 (0x1 << 3)
 183 #define DA7213_DAI_WCLK_POL_MASK                                (0x1 << 3)
 184 #define DA7213_DAI_CLK_EN_MASK                                  (0x1 << 7)
 185 
 186 /* DA7213_DAI_CTRL = 0x29 */
 187 #define DA7213_DAI_FORMAT_I2S_MODE                              (0x0 << 0)
 188 #define DA7213_DAI_FORMAT_LEFT_J                                (0x1 << 0)
 189 #define DA7213_DAI_FORMAT_RIGHT_J                               (0x2 << 0)
 190 #define DA7213_DAI_FORMAT_DSP                                   (0x3 << 0)
 191 #define DA7213_DAI_FORMAT_MASK                                  (0x3 << 0)
 192 #define DA7213_DAI_WORD_LENGTH_S16_LE                           (0x0 << 2)
 193 #define DA7213_DAI_WORD_LENGTH_S20_LE                           (0x1 << 2)
 194 #define DA7213_DAI_WORD_LENGTH_S24_LE                           (0x2 << 2)
 195 #define DA7213_DAI_WORD_LENGTH_S32_LE                           (0x3 << 2)
 196 #define DA7213_DAI_WORD_LENGTH_MASK                             (0x3 << 2)
 197 #define DA7213_DAI_EN_SHIFT                                     7
 198 
 199 /* DA7213_DIG_ROUTING_DAI = 0x21 */
 200 #define DA7213_DAI_L_SRC_SHIFT                                  0
 201 #define DA7213_DAI_R_SRC_SHIFT                                  4
 202 #define DA7213_DAI_SRC_MAX                                      4
 203 
 204 /* DA7213_DIG_ROUTING_DAC = 0x2A */
 205 #define DA7213_DAC_L_SRC_SHIFT                                  0
 206 #define DA7213_DAC_L_MONO_SHIFT                                 3
 207 #define DA7213_DAC_R_SRC_SHIFT                                  4
 208 #define DA7213_DAC_R_MONO_SHIFT                                 7
 209 #define DA7213_DAC_SRC_MAX                                      4
 210 #define DA7213_DAC_MONO_MAX                                     0x1
 211 
 212 /* DA7213_ALC_CTRL1 = 0x2B */
 213 #define DA7213_ALC_OFFSET_EN_SHIFT                              0
 214 #define DA7213_ALC_OFFSET_EN_MAX                                0x1
 215 #define DA7213_ALC_OFFSET_EN                                    (0x1 << 0)
 216 #define DA7213_ALC_SYNC_MODE                                    (0x1 << 1)
 217 #define DA7213_ALC_CALIB_MODE_MAN                               (0x1 << 2)
 218 #define DA7213_ALC_L_EN_SHIFT                                   3
 219 #define DA7213_ALC_AUTO_CALIB_EN                                (0x1 << 4)
 220 #define DA7213_ALC_CALIB_OVERFLOW                               (0x1 << 5)
 221 #define DA7213_ALC_R_EN_SHIFT                                   7
 222 #define DA7213_ALC_EN_MAX                                       0x1
 223 
 224 /* DA7213_AUX_L/R_GAIN = 0x30/0x31 */
 225 #define DA7213_AUX_AMP_GAIN_SHIFT                               0
 226 #define DA7213_AUX_AMP_GAIN_MAX                                 0x3F
 227 
 228 /* DA7213_MIXIN_L/R_SELECT = 0x32/0x33 */
 229 #define DA7213_DMIC_EN_SHIFT                                    7
 230 #define DA7213_DMIC_EN_MAX                                      0x1
 231 
 232 /* DA7213_MIXIN_L_SELECT = 0x32 */
 233 #define DA7213_MIXIN_L_MIX_SELECT_AUX_L_SHIFT                   0
 234 #define DA7213_MIXIN_L_MIX_SELECT_MIC_1_SHIFT                   1
 235 #define DA7213_MIXIN_L_MIX_SELECT_MIC_1                         (0x1 << 1)
 236 #define DA7213_MIXIN_L_MIX_SELECT_MIC_2_SHIFT                   2
 237 #define DA7213_MIXIN_L_MIX_SELECT_MIC_2                         (0x1 << 2)
 238 #define DA7213_MIXIN_L_MIX_SELECT_MIXIN_R_SHIFT                 3
 239 #define DA7213_MIXIN_L_MIX_SELECT_MAX                           0x1
 240 
 241 /* DA7213_MIXIN_R_SELECT =  0x33 */
 242 #define DA7213_MIXIN_R_MIX_SELECT_AUX_R_SHIFT                   0
 243 #define DA7213_MIXIN_R_MIX_SELECT_MIC_2_SHIFT                   1
 244 #define DA7213_MIXIN_R_MIX_SELECT_MIC_2                         (0x1 << 1)
 245 #define DA7213_MIXIN_R_MIX_SELECT_MIC_1_SHIFT                   2
 246 #define DA7213_MIXIN_R_MIX_SELECT_MIC_1                         (0x1 << 2)
 247 #define DA7213_MIXIN_R_MIX_SELECT_MIXIN_L_SHIFT                 3
 248 #define DA7213_MIXIN_R_MIX_SELECT_MAX                           0x1
 249 #define DA7213_MIC_BIAS_OUTPUT_SELECT_2                         (0x1 << 6)
 250 
 251 /* DA7213_MIXIN_L/R_GAIN = 0x34/0x35 */
 252 #define DA7213_MIXIN_AMP_GAIN_SHIFT                             0
 253 #define DA7213_MIXIN_AMP_GAIN_MAX                               0xF
 254 
 255 /* DA7213_ADC_L/R_GAIN = 0x36/0x37 */
 256 #define DA7213_ADC_AMP_GAIN_SHIFT                               0
 257 #define DA7213_ADC_AMP_GAIN_MAX                                 0x7F
 258 
 259 /* DA7213_ADC/DAC_FILTERS1 = 0x38/0x44 */
 260 #define DA7213_VOICE_HPF_CORNER_SHIFT                           0
 261 #define DA7213_VOICE_HPF_CORNER_MAX                             8
 262 #define DA7213_VOICE_EN_SHIFT                                   3
 263 #define DA7213_VOICE_EN_MAX                                     0x1
 264 #define DA7213_AUDIO_HPF_CORNER_SHIFT                           4
 265 #define DA7213_AUDIO_HPF_CORNER_MAX                             4
 266 #define DA7213_HPF_EN_SHIFT                                     7
 267 #define DA7213_HPF_EN_MAX                                       0x1
 268 
 269 /* DA7213_MIC_1/2_GAIN = 0x39/0x3A */
 270 #define DA7213_MIC_AMP_GAIN_SHIFT                               0
 271 #define DA7213_MIC_AMP_GAIN_MAX                                 0x7
 272 
 273 /* DA7213_DAC_FILTERS5 = 0x40 */
 274 #define DA7213_DAC_SOFTMUTE_EN_SHIFT                            7
 275 #define DA7213_DAC_SOFTMUTE_EN_MAX                              0x1
 276 #define DA7213_DAC_SOFTMUTE_RATE_SHIFT                          4
 277 #define DA7213_DAC_SOFTMUTE_RATE_MAX                            7
 278 
 279 /* DA7213_DAC_FILTERS2/3/4 = 0x41/0x42/0x43 */
 280 #define DA7213_DAC_EQ_BAND_MAX                                  0xF
 281 
 282 /* DA7213_DAC_FILTERS2 = 0x41 */
 283 #define DA7213_DAC_EQ_BAND1_SHIFT                               0
 284 #define DA7213_DAC_EQ_BAND2_SHIFT                               4
 285 
 286 /* DA7213_DAC_FILTERS2 = 0x42 */
 287 #define DA7213_DAC_EQ_BAND3_SHIFT                               0
 288 #define DA7213_DAC_EQ_BAND4_SHIFT                               4
 289 
 290 /* DA7213_DAC_FILTERS4 = 0x43 */
 291 #define DA7213_DAC_EQ_BAND5_SHIFT                               0
 292 #define DA7213_DAC_EQ_EN_SHIFT                                  7
 293 #define DA7213_DAC_EQ_EN_MAX                                    0x1
 294 
 295 /* DA7213_DAC_L/R_GAIN = 0x45/0x46 */
 296 #define DA7213_DAC_AMP_GAIN_SHIFT                               0
 297 #define DA7213_DAC_AMP_GAIN_MAX                                 0x7F
 298 
 299 /* DA7213_HP_L/R_GAIN = 0x45/0x46 */
 300 #define DA7213_HP_AMP_GAIN_SHIFT                                0
 301 #define DA7213_HP_AMP_GAIN_MAX                                  0x3F
 302 
 303 /* DA7213_CP_CTRL = 0x47 */
 304 #define DA7213_CP_EN_SHIFT                                      7
 305 
 306 /* DA7213_LINE_GAIN = 0x4A */
 307 #define DA7213_LINE_AMP_GAIN_SHIFT                              0
 308 #define DA7213_LINE_AMP_GAIN_MAX                                0x3F
 309 
 310 /* DA7213_MIXOUT_L_SELECT = 0x4B */
 311 #define DA7213_MIXOUT_L_MIX_SELECT_AUX_L_SHIFT                  0
 312 #define DA7213_MIXOUT_L_MIX_SELECT_MIXIN_L_SHIFT                1
 313 #define DA7213_MIXOUT_L_MIX_SELECT_MIXIN_R_SHIFT                2
 314 #define DA7213_MIXOUT_L_MIX_SELECT_DAC_L_SHIFT                  3
 315 #define DA7213_MIXOUT_L_MIX_SELECT_AUX_L_INVERTED_SHIFT         4
 316 #define DA7213_MIXOUT_L_MIX_SELECT_MIXIN_L_INVERTED_SHIFT       5
 317 #define DA7213_MIXOUT_L_MIX_SELECT_MIXIN_R_INVERTED_SHIFT       6
 318 #define DA7213_MIXOUT_L_MIX_SELECT_MAX                          0x1
 319 
 320 /* DA7213_MIXOUT_R_SELECT = 0x4C */
 321 #define DA7213_MIXOUT_R_MIX_SELECT_AUX_R_SHIFT                  0
 322 #define DA7213_MIXOUT_R_MIX_SELECT_MIXIN_R_SHIFT                1
 323 #define DA7213_MIXOUT_R_MIX_SELECT_MIXIN_L_SHIFT                2
 324 #define DA7213_MIXOUT_R_MIX_SELECT_DAC_R_SHIFT                  3
 325 #define DA7213_MIXOUT_R_MIX_SELECT_AUX_R_INVERTED_SHIFT         4
 326 #define DA7213_MIXOUT_R_MIX_SELECT_MIXIN_R_INVERTED_SHIFT       5
 327 #define DA7213_MIXOUT_R_MIX_SELECT_MIXIN_L_INVERTED_SHIFT       6
 328 #define DA7213_MIXOUT_R_MIX_SELECT_MAX                          0x1
 329 
 330 /*
 331  * DA7213_AUX_L/R_CTRL = 0x60/0x61,
 332  * DA7213_MIC_1/2_CTRL = 0x63/0x64,
 333  * DA7213_MIXIN_L/R_CTRL = 0x65/0x66,
 334  * DA7213_ADC_L/R_CTRL = 0x65/0x66,
 335  * DA7213_DAC_L/R_CTRL = 0x69/0x6A,
 336  * DA7213_HP_L/R_CTRL = 0x6B/0x6C,
 337  * DA7213_LINE_CTRL = 0x6D
 338  */
 339 #define DA7213_MUTE_EN_SHIFT                                    6
 340 #define DA7213_MUTE_EN_MAX                                      0x1
 341 #define DA7213_MUTE_EN                                          (0x1 << 6)
 342 
 343 /*
 344  * DA7213_AUX_L/R_CTRL = 0x60/0x61,
 345  * DA7213_MIXIN_L/R_CTRL = 0x65/0x66,
 346  * DA7213_ADC_L/R_CTRL = 0x65/0x66,
 347  * DA7213_DAC_L/R_CTRL = 0x69/0x6A,
 348  * DA7213_HP_L/R_CTRL = 0x6B/0x6C,
 349  * DA7213_LINE_CTRL = 0x6D
 350  */
 351 #define DA7213_GAIN_RAMP_EN_SHIFT                               5
 352 #define DA7213_GAIN_RAMP_EN_MAX                                 0x1
 353 #define DA7213_GAIN_RAMP_EN                                     (0x1 << 5)
 354 
 355 /*
 356  * DA7213_AUX_L/R_CTRL = 0x60/0x61,
 357  * DA7213_MIXIN_L/R_CTRL = 0x65/0x66,
 358  * DA7213_HP_L/R_CTRL = 0x6B/0x6C,
 359  * DA7213_LINE_CTRL = 0x6D
 360  */
 361 #define DA7213_ZC_EN_SHIFT                                      4
 362 #define DA7213_ZC_EN_MAX                                        0x1
 363 
 364 /*
 365  * DA7213_AUX_L/R_CTRL = 0x60/0x61,
 366  * DA7213_MIC_1/2_CTRL = 0x63/0x64,
 367  * DA7213_MIXIN_L/R_CTRL = 0x65/0x66,
 368  * DA7213_HP_L/R_CTRL = 0x6B/0x6C,
 369  * DA7213_MIXOUT_L/R_CTRL = 0x6E/0x6F,
 370  * DA7213_LINE_CTRL = 0x6D
 371  */
 372 #define DA7213_AMP_EN_SHIFT                                     7
 373 
 374 /* DA7213_MIC_1/2_CTRL = 0x63/0x64 */
 375 #define DA7213_MIC_AMP_IN_SEL_SHIFT                             2
 376 #define DA7213_MIC_AMP_IN_SEL_MAX                               3
 377 
 378 /* DA7213_MICBIAS_CTRL = 0x62 */
 379 #define DA7213_MICBIAS1_LEVEL_SHIFT                             0
 380 #define DA7213_MICBIAS1_LEVEL_MASK                              (0x3 << 0)
 381 #define DA7213_MICBIAS1_EN_SHIFT                                3
 382 #define DA7213_MICBIAS2_LEVEL_SHIFT                             4
 383 #define DA7213_MICBIAS2_LEVEL_MASK                              (0x3 << 4)
 384 #define DA7213_MICBIAS2_EN_SHIFT                                7
 385 
 386 /* DA7213_MIXIN_L/R_CTRL = 0x65/0x66 */
 387 #define DA7213_MIXIN_MIX_EN                                     (0x1 << 3)
 388 
 389 /* DA7213_ADC_L/R_CTRL = 0x67/0x68 */
 390 #define DA7213_ADC_EN_SHIFT                                     7
 391 #define DA7213_ADC_EN                                           (0x1 << 7)
 392 
 393 /* DA7213_DAC_L/R_CTRL =  0x69/0x6A*/
 394 #define DA7213_DAC_EN_SHIFT                                     7
 395 
 396 /* DA7213_HP_L/R_CTRL = 0x6B/0x6C */
 397 #define DA7213_HP_AMP_OE                                        (0x1 << 3)
 398 
 399 /* DA7213_LINE_CTRL = 0x6D */
 400 #define DA7213_LINE_AMP_OE                                      (0x1 << 3)
 401 
 402 /* DA7213_MIXOUT_L/R_CTRL = 0x6E/0x6F */
 403 #define DA7213_MIXOUT_MIX_EN                                    (0x1 << 3)
 404 
 405 /* DA7213_GAIN_RAMP_CTRL = 0x92 */
 406 #define DA7213_GAIN_RAMP_RATE_SHIFT                             0
 407 #define DA7213_GAIN_RAMP_RATE_MAX                               4
 408 
 409 /* DA7213_MIC_CONFIG = 0x93 */
 410 #define DA7213_DMIC_DATA_SEL_SHIFT                              0
 411 #define DA7213_DMIC_DATA_SEL_MASK                               (0x1 << 0)
 412 #define DA7213_DMIC_SAMPLEPHASE_SHIFT                           1
 413 #define DA7213_DMIC_SAMPLEPHASE_MASK                            (0x1 << 1)
 414 #define DA7213_DMIC_CLK_RATE_SHIFT                              2
 415 #define DA7213_DMIC_CLK_RATE_MASK                               (0x1 << 2)
 416 
 417 /* DA7213_PC_COUNT = 0x94 */
 418 #define DA7213_PC_FREERUN_MASK                                  (0x1 << 0)
 419 
 420 /* DA7213_DIG_CTRL = 0x99 */
 421 #define DA7213_DAC_L_INV_SHIFT                                  3
 422 #define DA7213_DAC_R_INV_SHIFT                                  7
 423 #define DA7213_DAC_INV_MAX                                      0x1
 424 
 425 /* DA7213_ALC_CTRL2 = 0x9A */
 426 #define DA7213_ALC_ATTACK_SHIFT                                 0
 427 #define DA7213_ALC_ATTACK_MAX                                   13
 428 #define DA7213_ALC_RELEASE_SHIFT                                4
 429 #define DA7213_ALC_RELEASE_MAX                                  11
 430 
 431 /* DA7213_ALC_CTRL3 = 0x9B */
 432 #define DA7213_ALC_HOLD_SHIFT                                   0
 433 #define DA7213_ALC_HOLD_MAX                                     16
 434 #define DA7213_ALC_INTEG_ATTACK_SHIFT                           4
 435 #define DA7213_ALC_INTEG_RELEASE_SHIFT                          6
 436 #define DA7213_ALC_INTEG_MAX                                    4
 437 
 438 /*
 439  * DA7213_ALC_NOISE = 0x9C,
 440  * DA7213_ALC_TARGET_MIN/MAX = 0x9D/0x9E
 441  */
 442 #define DA7213_ALC_THRESHOLD_SHIFT                              0
 443 #define DA7213_ALC_THRESHOLD_MAX                                0x3F
 444 
 445 /* DA7213_ALC_GAIN_LIMITS = 0x9F */
 446 #define DA7213_ALC_ATTEN_MAX_SHIFT                              0
 447 #define DA7213_ALC_GAIN_MAX_SHIFT                               4
 448 #define DA7213_ALC_ATTEN_GAIN_MAX_MAX                           0xF
 449 
 450 /* DA7213_ALC_ANA_GAIN_LIMITS = 0xA0 */
 451 #define DA7213_ALC_ANA_GAIN_MIN_SHIFT                           0
 452 #define DA7213_ALC_ANA_GAIN_MAX_SHIFT                           4
 453 #define DA7213_ALC_ANA_GAIN_MAX                                 0x7
 454 
 455 /* DA7213_ALC_ANTICLIP_CTRL = 0xA1 */
 456 #define DA7213_ALC_ANTICLIP_EN_SHIFT                            7
 457 #define DA7213_ALC_ANTICLIP_EN_MAX                              0x1
 458 
 459 /* DA7213_ALC_ANTICLIP_LEVEL = 0xA2 */
 460 #define DA7213_ALC_ANTICLIP_LEVEL_SHIFT                         0
 461 #define DA7213_ALC_ANTICLIP_LEVEL_MAX                           0x7F
 462 
 463 /* DA7213_ALC_CIC_OP_LVL_CTRL = 0xAD */
 464 #define DA7213_ALC_DATA_MIDDLE                                  (0x2 << 0)
 465 #define DA7213_ALC_DATA_TOP                                     (0x3 << 0)
 466 #define DA7213_ALC_CIC_OP_CHANNEL_LEFT                          (0x0 << 7)
 467 #define DA7213_ALC_CIC_OP_CHANNEL_RIGHT                         (0x1 << 7)
 468 
 469 /* DA7213_DAC_NG_SETUP_TIME = 0xAF */
 470 #define DA7213_DAC_NG_SETUP_TIME_SHIFT                          0
 471 #define DA7213_DAC_NG_SETUP_TIME_MAX                            4
 472 #define DA7213_DAC_NG_RAMPUP_RATE_SHIFT                         2
 473 #define DA7213_DAC_NG_RAMPDN_RATE_SHIFT                         3
 474 #define DA7213_DAC_NG_RAMP_RATE_MAX                             2
 475 
 476 /* DA7213_DAC_NG_OFF/ON_THRESH = 0xB0/0xB1 */
 477 #define DA7213_DAC_NG_THRESHOLD_SHIFT                           0
 478 #define DA7213_DAC_NG_THRESHOLD_MAX                             0x7
 479 
 480 /* DA7213_DAC_NG_CTRL = 0xB2 */
 481 #define DA7213_DAC_NG_EN_SHIFT                                  7
 482 #define DA7213_DAC_NG_EN_MAX                                    0x1
 483 
 484 
 485 /*
 486  * General defines
 487  */
 488 
 489 /* Register inversion */
 490 #define DA7213_NO_INVERT                0
 491 #define DA7213_INVERT                   1
 492 
 493 /* Byte related defines */
 494 #define DA7213_BYTE_SHIFT               8
 495 #define DA7213_BYTE_MASK                0xFF
 496 
 497 /* ALC related */
 498 #define DA7213_ALC_OFFSET_15_8          0x00FF00
 499 #define DA7213_ALC_OFFSET_19_16         0x0F0000
 500 #define DA7213_ALC_AVG_ITERATIONS       5
 501 
 502 /* PLL related */
 503 #define DA7213_PLL_FREQ_OUT_90316800            90316800
 504 #define DA7213_PLL_FREQ_OUT_98304000            98304000
 505 #define DA7213_PLL_FREQ_OUT_94310400            94310400
 506 #define DA7213_PLL_INDIV_5_TO_9_MHZ_VAL         2
 507 #define DA7213_PLL_INDIV_9_TO_18_MHZ_VAL        4
 508 #define DA7213_PLL_INDIV_18_TO_36_MHZ_VAL       8
 509 #define DA7213_PLL_INDIV_36_TO_54_MHZ_VAL       16
 510 #define DA7213_SRM_CHECK_RETRIES                8
 511 
 512 enum da7213_clk_src {
 513         DA7213_CLKSRC_MCLK = 0,
 514         DA7213_CLKSRC_MCLK_SQR,
 515 };
 516 
 517 enum da7213_sys_clk {
 518         DA7213_SYSCLK_MCLK = 0,
 519         DA7213_SYSCLK_PLL,
 520         DA7213_SYSCLK_PLL_SRM,
 521         DA7213_SYSCLK_PLL_32KHZ
 522 };
 523 
 524 /* Codec private data */
 525 struct da7213_priv {
 526         struct regmap *regmap;
 527         struct clk *mclk;
 528         unsigned int mclk_rate;
 529         int clk_src;
 530         bool master;
 531         bool alc_calib_auto;
 532         bool alc_en;
 533         struct da7213_platform_data *pdata;
 534 };
 535 
 536 #endif /* _DA7213_H */

/* [<][>][^][v][top][bottom][index][help] */