Adam Thomson | 6d817c0 | 2015-09-29 16:44:01 +0100 | [diff] [blame] | 1 | /* |
| 2 | * da7219.h - DA7219 ALSA SoC Codec Driver |
| 3 | * |
| 4 | * Copyright (c) 2015 Dialog Semiconductor |
| 5 | * |
| 6 | * Author: Adam Thomson <Adam.Thomson.Opensource@diasemi.com> |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify it |
| 9 | * under the terms of the GNU General Public License as published by the |
| 10 | * Free Software Foundation; either version 2 of the License, or (at your |
| 11 | * option) any later version. |
| 12 | */ |
| 13 | |
| 14 | #ifndef __DA7219_H |
| 15 | #define __DA7219_H |
| 16 | |
| 17 | #include <linux/regmap.h> |
| 18 | #include <linux/regulator/consumer.h> |
| 19 | #include <sound/da7219.h> |
| 20 | |
| 21 | /* |
| 22 | * Registers |
| 23 | */ |
| 24 | |
| 25 | #define DA7219_MIC_1_GAIN_STATUS 0x6 |
| 26 | #define DA7219_MIXIN_L_GAIN_STATUS 0x8 |
| 27 | #define DA7219_ADC_L_GAIN_STATUS 0xA |
| 28 | #define DA7219_DAC_L_GAIN_STATUS 0xC |
| 29 | #define DA7219_DAC_R_GAIN_STATUS 0xD |
| 30 | #define DA7219_HP_L_GAIN_STATUS 0xE |
| 31 | #define DA7219_HP_R_GAIN_STATUS 0xF |
| 32 | #define DA7219_MIC_1_SELECT 0x10 |
| 33 | #define DA7219_CIF_TIMEOUT_CTRL 0x12 |
| 34 | #define DA7219_CIF_CTRL 0x13 |
| 35 | #define DA7219_SR_24_48 0x16 |
| 36 | #define DA7219_SR 0x17 |
| 37 | #define DA7219_CIF_I2C_ADDR_CFG 0x1B |
| 38 | #define DA7219_PLL_CTRL 0x20 |
| 39 | #define DA7219_PLL_FRAC_TOP 0x22 |
| 40 | #define DA7219_PLL_FRAC_BOT 0x23 |
| 41 | #define DA7219_PLL_INTEGER 0x24 |
| 42 | #define DA7219_PLL_SRM_STS 0x25 |
| 43 | #define DA7219_DIG_ROUTING_DAI 0x2A |
| 44 | #define DA7219_DAI_CLK_MODE 0x2B |
| 45 | #define DA7219_DAI_CTRL 0x2C |
| 46 | #define DA7219_DAI_TDM_CTRL 0x2D |
| 47 | #define DA7219_DIG_ROUTING_DAC 0x2E |
| 48 | #define DA7219_ALC_CTRL1 0x2F |
| 49 | #define DA7219_DAI_OFFSET_LOWER 0x30 |
| 50 | #define DA7219_DAI_OFFSET_UPPER 0x31 |
| 51 | #define DA7219_REFERENCES 0x32 |
| 52 | #define DA7219_MIXIN_L_SELECT 0x33 |
| 53 | #define DA7219_MIXIN_L_GAIN 0x34 |
| 54 | #define DA7219_ADC_L_GAIN 0x36 |
| 55 | #define DA7219_ADC_FILTERS1 0x38 |
| 56 | #define DA7219_MIC_1_GAIN 0x39 |
| 57 | #define DA7219_SIDETONE_CTRL 0x3A |
| 58 | #define DA7219_SIDETONE_GAIN 0x3B |
| 59 | #define DA7219_DROUTING_ST_OUTFILT_1L 0x3C |
| 60 | #define DA7219_DROUTING_ST_OUTFILT_1R 0x3D |
| 61 | #define DA7219_DAC_FILTERS5 0x40 |
| 62 | #define DA7219_DAC_FILTERS2 0x41 |
| 63 | #define DA7219_DAC_FILTERS3 0x42 |
| 64 | #define DA7219_DAC_FILTERS4 0x43 |
| 65 | #define DA7219_DAC_FILTERS1 0x44 |
| 66 | #define DA7219_DAC_L_GAIN 0x45 |
| 67 | #define DA7219_DAC_R_GAIN 0x46 |
| 68 | #define DA7219_CP_CTRL 0x47 |
| 69 | #define DA7219_HP_L_GAIN 0x48 |
| 70 | #define DA7219_HP_R_GAIN 0x49 |
| 71 | #define DA7219_MIXOUT_L_SELECT 0x4B |
| 72 | #define DA7219_MIXOUT_R_SELECT 0x4C |
| 73 | #define DA7219_SYSTEM_MODES_INPUT 0x50 |
| 74 | #define DA7219_SYSTEM_MODES_OUTPUT 0x51 |
| 75 | #define DA7219_MICBIAS_CTRL 0x62 |
| 76 | #define DA7219_MIC_1_CTRL 0x63 |
| 77 | #define DA7219_MIXIN_L_CTRL 0x65 |
| 78 | #define DA7219_ADC_L_CTRL 0x67 |
| 79 | #define DA7219_DAC_L_CTRL 0x69 |
| 80 | #define DA7219_DAC_R_CTRL 0x6A |
| 81 | #define DA7219_HP_L_CTRL 0x6B |
| 82 | #define DA7219_HP_R_CTRL 0x6C |
| 83 | #define DA7219_MIXOUT_L_CTRL 0x6E |
| 84 | #define DA7219_MIXOUT_R_CTRL 0x6F |
| 85 | #define DA7219_CHIP_ID1 0x81 |
| 86 | #define DA7219_CHIP_ID2 0x82 |
| 87 | #define DA7219_CHIP_REVISION 0x83 |
Adam Thomson | 6d817c0 | 2015-09-29 16:44:01 +0100 | [diff] [blame] | 88 | #define DA7219_IO_CTRL 0x91 |
| 89 | #define DA7219_GAIN_RAMP_CTRL 0x92 |
| 90 | #define DA7219_PC_COUNT 0x94 |
| 91 | #define DA7219_CP_VOL_THRESHOLD1 0x95 |
| 92 | #define DA7219_CP_DELAY 0x96 |
| 93 | #define DA7219_DIG_CTRL 0x99 |
| 94 | #define DA7219_ALC_CTRL2 0x9A |
| 95 | #define DA7219_ALC_CTRL3 0x9B |
| 96 | #define DA7219_ALC_NOISE 0x9C |
| 97 | #define DA7219_ALC_TARGET_MIN 0x9D |
| 98 | #define DA7219_ALC_TARGET_MAX 0x9E |
| 99 | #define DA7219_ALC_GAIN_LIMITS 0x9F |
| 100 | #define DA7219_ALC_ANA_GAIN_LIMITS 0xA0 |
| 101 | #define DA7219_ALC_ANTICLIP_CTRL 0xA1 |
| 102 | #define DA7219_ALC_ANTICLIP_LEVEL 0xA2 |
| 103 | #define DA7219_ALC_OFFSET_AUTO_M_L 0xA3 |
| 104 | #define DA7219_ALC_OFFSET_AUTO_U_L 0xA4 |
| 105 | #define DA7219_DAC_NG_SETUP_TIME 0xAF |
| 106 | #define DA7219_DAC_NG_OFF_THRESH 0xB0 |
| 107 | #define DA7219_DAC_NG_ON_THRESH 0xB1 |
| 108 | #define DA7219_DAC_NG_CTRL 0xB2 |
| 109 | #define DA7219_TONE_GEN_CFG1 0xB4 |
| 110 | #define DA7219_TONE_GEN_CFG2 0xB5 |
| 111 | #define DA7219_TONE_GEN_CYCLES 0xB6 |
| 112 | #define DA7219_TONE_GEN_FREQ1_L 0xB7 |
| 113 | #define DA7219_TONE_GEN_FREQ1_U 0xB8 |
| 114 | #define DA7219_TONE_GEN_FREQ2_L 0xB9 |
| 115 | #define DA7219_TONE_GEN_FREQ2_U 0xBA |
| 116 | #define DA7219_TONE_GEN_ON_PER 0xBB |
| 117 | #define DA7219_TONE_GEN_OFF_PER 0xBC |
| 118 | #define DA7219_SYSTEM_STATUS 0xE0 |
| 119 | #define DA7219_SYSTEM_ACTIVE 0xFD |
| 120 | |
| 121 | |
| 122 | /* |
| 123 | * Bit Fields |
| 124 | */ |
| 125 | |
| 126 | #define DA7219_SWITCH_EN_MAX 0x1 |
| 127 | |
| 128 | /* DA7219_MIC_1_GAIN_STATUS = 0x6 */ |
| 129 | #define DA7219_MIC_1_AMP_GAIN_STATUS_SHIFT 0 |
| 130 | #define DA7219_MIC_1_AMP_GAIN_STATUS_MASK (0x7 << 0) |
| 131 | #define DA7219_MIC_1_AMP_GAIN_MAX 0x7 |
| 132 | |
| 133 | /* DA7219_MIXIN_L_GAIN_STATUS = 0x8 */ |
| 134 | #define DA7219_MIXIN_L_AMP_GAIN_STATUS_SHIFT 0 |
| 135 | #define DA7219_MIXIN_L_AMP_GAIN_STATUS_MASK (0xF << 0) |
| 136 | |
| 137 | /* DA7219_ADC_L_GAIN_STATUS = 0xA */ |
| 138 | #define DA7219_ADC_L_DIGITAL_GAIN_STATUS_SHIFT 0 |
| 139 | #define DA7219_ADC_L_DIGITAL_GAIN_STATUS_MASK (0x7F << 0) |
| 140 | |
| 141 | /* DA7219_DAC_L_GAIN_STATUS = 0xC */ |
| 142 | #define DA7219_DAC_L_DIGITAL_GAIN_STATUS_SHIFT 0 |
| 143 | #define DA7219_DAC_L_DIGITAL_GAIN_STATUS_MASK (0x7F << 0) |
| 144 | |
| 145 | /* DA7219_DAC_R_GAIN_STATUS = 0xD */ |
| 146 | #define DA7219_DAC_R_DIGITAL_GAIN_STATUS_SHIFT 0 |
| 147 | #define DA7219_DAC_R_DIGITAL_GAIN_STATUS_MASK (0x7F << 0) |
| 148 | |
| 149 | /* DA7219_HP_L_GAIN_STATUS = 0xE */ |
| 150 | #define DA7219_HP_L_AMP_GAIN_STATUS_SHIFT 0 |
| 151 | #define DA7219_HP_L_AMP_GAIN_STATUS_MASK (0x3F << 0) |
| 152 | |
| 153 | /* DA7219_HP_R_GAIN_STATUS = 0xF */ |
| 154 | #define DA7219_HP_R_AMP_GAIN_STATUS_SHIFT 0 |
| 155 | #define DA7219_HP_R_AMP_GAIN_STATUS_MASK (0x3F << 0) |
| 156 | |
| 157 | /* DA7219_MIC_1_SELECT = 0x10 */ |
| 158 | #define DA7219_MIC_1_AMP_IN_SEL_SHIFT 0 |
| 159 | #define DA7219_MIC_1_AMP_IN_SEL_MASK (0x3 << 0) |
| 160 | |
| 161 | /* DA7219_CIF_TIMEOUT_CTRL = 0x12 */ |
| 162 | #define DA7219_I2C_TIMEOUT_EN_SHIFT 0 |
| 163 | #define DA7219_I2C_TIMEOUT_EN_MASK (0x1 << 0) |
| 164 | |
| 165 | /* DA7219_CIF_CTRL = 0x13 */ |
| 166 | #define DA7219_CIF_I2C_WRITE_MODE_SHIFT 0 |
| 167 | #define DA7219_CIF_I2C_WRITE_MODE_MASK (0x1 << 0) |
| 168 | #define DA7219_CIF_REG_SOFT_RESET_SHIFT 7 |
| 169 | #define DA7219_CIF_REG_SOFT_RESET_MASK (0x1 << 7) |
| 170 | |
| 171 | /* DA7219_SR_24_48 = 0x16 */ |
| 172 | #define DA7219_SR_24_48_SHIFT 0 |
| 173 | #define DA7219_SR_24_48_MASK (0x1 << 0) |
| 174 | |
| 175 | /* DA7219_SR = 0x17 */ |
| 176 | #define DA7219_SR_SHIFT 0 |
| 177 | #define DA7219_SR_MASK (0xF << 0) |
| 178 | #define DA7219_SR_8000 (0x01 << 0) |
| 179 | #define DA7219_SR_11025 (0x02 << 0) |
| 180 | #define DA7219_SR_12000 (0x03 << 0) |
| 181 | #define DA7219_SR_16000 (0x05 << 0) |
| 182 | #define DA7219_SR_22050 (0x06 << 0) |
| 183 | #define DA7219_SR_24000 (0x07 << 0) |
| 184 | #define DA7219_SR_32000 (0x09 << 0) |
| 185 | #define DA7219_SR_44100 (0x0A << 0) |
| 186 | #define DA7219_SR_48000 (0x0B << 0) |
| 187 | #define DA7219_SR_88200 (0x0E << 0) |
| 188 | #define DA7219_SR_96000 (0x0F << 0) |
| 189 | |
| 190 | /* DA7219_CIF_I2C_ADDR_CFG = 0x1B */ |
| 191 | #define DA7219_CIF_I2C_ADDR_CFG_SHIFT 0 |
| 192 | #define DA7219_CIF_I2C_ADDR_CFG_MASK (0x3 << 0) |
| 193 | |
| 194 | /* DA7219_PLL_CTRL = 0x20 */ |
| 195 | #define DA7219_PLL_INDIV_SHIFT 2 |
| 196 | #define DA7219_PLL_INDIV_MASK (0x7 << 2) |
Adam Thomson | 63a450a | 2016-04-19 15:19:02 +0100 | [diff] [blame] | 197 | #define DA7219_PLL_INDIV_2_TO_4_5_MHZ (0x0 << 2) |
| 198 | #define DA7219_PLL_INDIV_4_5_TO_9_MHZ (0x1 << 2) |
| 199 | #define DA7219_PLL_INDIV_9_TO_18_MHZ (0x2 << 2) |
| 200 | #define DA7219_PLL_INDIV_18_TO_36_MHZ (0x3 << 2) |
| 201 | #define DA7219_PLL_INDIV_36_TO_54_MHZ (0x4 << 2) |
Adam Thomson | 6d817c0 | 2015-09-29 16:44:01 +0100 | [diff] [blame] | 202 | #define DA7219_PLL_MCLK_SQR_EN_SHIFT 5 |
| 203 | #define DA7219_PLL_MCLK_SQR_EN_MASK (0x1 << 5) |
| 204 | #define DA7219_PLL_MODE_SHIFT 6 |
| 205 | #define DA7219_PLL_MODE_MASK (0x3 << 6) |
| 206 | #define DA7219_PLL_MODE_BYPASS (0x0 << 6) |
| 207 | #define DA7219_PLL_MODE_NORMAL (0x1 << 6) |
| 208 | #define DA7219_PLL_MODE_SRM (0x2 << 6) |
Adam Thomson | 6d817c0 | 2015-09-29 16:44:01 +0100 | [diff] [blame] | 209 | |
| 210 | /* DA7219_PLL_FRAC_TOP = 0x22 */ |
| 211 | #define DA7219_PLL_FBDIV_FRAC_TOP_SHIFT 0 |
| 212 | #define DA7219_PLL_FBDIV_FRAC_TOP_MASK (0x1F << 0) |
| 213 | |
| 214 | /* DA7219_PLL_FRAC_BOT = 0x23 */ |
| 215 | #define DA7219_PLL_FBDIV_FRAC_BOT_SHIFT 0 |
| 216 | #define DA7219_PLL_FBDIV_FRAC_BOT_MASK (0xFF << 0) |
| 217 | |
| 218 | /* DA7219_PLL_INTEGER = 0x24 */ |
| 219 | #define DA7219_PLL_FBDIV_INTEGER_SHIFT 0 |
| 220 | #define DA7219_PLL_FBDIV_INTEGER_MASK (0x7F << 0) |
| 221 | |
| 222 | /* DA7219_PLL_SRM_STS = 0x25 */ |
| 223 | #define DA7219_PLL_SRM_STATE_SHIFT 0 |
| 224 | #define DA7219_PLL_SRM_STATE_MASK (0xF << 0) |
| 225 | #define DA7219_PLL_SRM_STATUS_SHIFT 4 |
| 226 | #define DA7219_PLL_SRM_STATUS_MASK (0xF << 4) |
Adam Thomson | 6a0b87c | 2016-09-12 16:46:50 +0100 | [diff] [blame^] | 227 | #define DA7219_PLL_SRM_STS_MCLK (0x1 << 4) |
Adam Thomson | 6d817c0 | 2015-09-29 16:44:01 +0100 | [diff] [blame] | 228 | #define DA7219_PLL_SRM_STS_SRM_LOCK (0x1 << 7) |
| 229 | |
| 230 | /* DA7219_DIG_ROUTING_DAI = 0x2A */ |
| 231 | #define DA7219_DAI_L_SRC_SHIFT 0 |
| 232 | #define DA7219_DAI_L_SRC_MASK (0x3 << 0) |
| 233 | #define DA7219_DAI_R_SRC_SHIFT 4 |
| 234 | #define DA7219_DAI_R_SRC_MASK (0x3 << 4) |
| 235 | #define DA7219_OUT_SRC_MAX 4 |
| 236 | |
| 237 | /* DA7219_DAI_CLK_MODE = 0x2B */ |
| 238 | #define DA7219_DAI_BCLKS_PER_WCLK_SHIFT 0 |
| 239 | #define DA7219_DAI_BCLKS_PER_WCLK_MASK (0x3 << 0) |
| 240 | #define DA7219_DAI_BCLKS_PER_WCLK_32 (0x0 << 0) |
| 241 | #define DA7219_DAI_BCLKS_PER_WCLK_64 (0x1 << 0) |
| 242 | #define DA7219_DAI_BCLKS_PER_WCLK_128 (0x2 << 0) |
| 243 | #define DA7219_DAI_BCLKS_PER_WCLK_256 (0x3 << 0) |
| 244 | #define DA7219_DAI_CLK_POL_SHIFT 2 |
| 245 | #define DA7219_DAI_CLK_POL_MASK (0x1 << 2) |
| 246 | #define DA7219_DAI_CLK_POL_INV (0x1 << 2) |
| 247 | #define DA7219_DAI_WCLK_POL_SHIFT 3 |
| 248 | #define DA7219_DAI_WCLK_POL_MASK (0x1 << 3) |
| 249 | #define DA7219_DAI_WCLK_POL_INV (0x1 << 3) |
| 250 | #define DA7219_DAI_WCLK_TRI_STATE_SHIFT 4 |
| 251 | #define DA7219_DAI_WCLK_TRI_STATE_MASK (0x1 << 4) |
| 252 | #define DA7219_DAI_CLK_EN_SHIFT 7 |
| 253 | #define DA7219_DAI_CLK_EN_MASK (0x1 << 7) |
| 254 | |
| 255 | /* DA7219_DAI_CTRL = 0x2C */ |
| 256 | #define DA7219_DAI_FORMAT_SHIFT 0 |
| 257 | #define DA7219_DAI_FORMAT_MASK (0x3 << 0) |
| 258 | #define DA7219_DAI_FORMAT_I2S (0x0 << 0) |
| 259 | #define DA7219_DAI_FORMAT_LEFT_J (0x1 << 0) |
| 260 | #define DA7219_DAI_FORMAT_RIGHT_J (0x2 << 0) |
| 261 | #define DA7219_DAI_FORMAT_DSP (0x3 << 0) |
| 262 | #define DA7219_DAI_WORD_LENGTH_SHIFT 2 |
| 263 | #define DA7219_DAI_WORD_LENGTH_MASK (0x3 << 2) |
| 264 | #define DA7219_DAI_WORD_LENGTH_S16_LE (0x0 << 2) |
| 265 | #define DA7219_DAI_WORD_LENGTH_S20_LE (0x1 << 2) |
| 266 | #define DA7219_DAI_WORD_LENGTH_S24_LE (0x2 << 2) |
| 267 | #define DA7219_DAI_WORD_LENGTH_S32_LE (0x3 << 2) |
| 268 | #define DA7219_DAI_CH_NUM_SHIFT 4 |
| 269 | #define DA7219_DAI_CH_NUM_MASK (0x3 << 4) |
| 270 | #define DA7219_DAI_CH_NUM_MAX 2 |
| 271 | #define DA7219_DAI_EN_SHIFT 7 |
| 272 | #define DA7219_DAI_EN_MASK (0x1 << 7) |
| 273 | |
| 274 | /* DA7219_DAI_TDM_CTRL = 0x2D */ |
| 275 | #define DA7219_DAI_TDM_CH_EN_SHIFT 0 |
| 276 | #define DA7219_DAI_TDM_CH_EN_MASK (0x3 << 0) |
| 277 | #define DA7219_DAI_OE_SHIFT 6 |
| 278 | #define DA7219_DAI_OE_MASK (0x1 << 6) |
| 279 | #define DA7219_DAI_TDM_MODE_EN_SHIFT 7 |
| 280 | #define DA7219_DAI_TDM_MODE_EN_MASK (0x1 << 7) |
| 281 | #define DA7219_DAI_TDM_MAX_SLOTS 2 |
| 282 | |
| 283 | /* DA7219_DIG_ROUTING_DAC = 0x2E */ |
| 284 | #define DA7219_DAC_L_SRC_SHIFT 0 |
| 285 | #define DA7219_DAC_L_SRC_MASK (0x3 << 0) |
| 286 | #define DA7219_DAC_L_SRC_TONEGEN (0x1 << 0) |
| 287 | #define DA7219_DAC_L_MONO_SHIFT 3 |
| 288 | #define DA7219_DAC_L_MONO_MASK (0x1 << 3) |
| 289 | #define DA7219_DAC_R_SRC_SHIFT 4 |
| 290 | #define DA7219_DAC_R_SRC_MASK (0x3 << 4) |
| 291 | #define DA7219_DAC_R_SRC_TONEGEN (0x1 << 4) |
| 292 | #define DA7219_DAC_R_MONO_SHIFT 7 |
| 293 | #define DA7219_DAC_R_MONO_MASK (0x1 << 7) |
| 294 | |
| 295 | /* DA7219_ALC_CTRL1 = 0x2F */ |
| 296 | #define DA7219_ALC_OFFSET_EN_SHIFT 0 |
| 297 | #define DA7219_ALC_OFFSET_EN_MASK (0x1 << 0) |
| 298 | #define DA7219_ALC_SYNC_MODE_SHIFT 1 |
| 299 | #define DA7219_ALC_SYNC_MODE_MASK (0x1 << 1) |
| 300 | #define DA7219_ALC_EN_SHIFT 3 |
| 301 | #define DA7219_ALC_EN_MASK (0x1 << 3) |
| 302 | #define DA7219_ALC_AUTO_CALIB_EN_SHIFT 4 |
| 303 | #define DA7219_ALC_AUTO_CALIB_EN_MASK (0x1 << 4) |
| 304 | #define DA7219_ALC_CALIB_OVERFLOW_SHIFT 5 |
| 305 | #define DA7219_ALC_CALIB_OVERFLOW_MASK (0x1 << 5) |
| 306 | |
| 307 | /* DA7219_DAI_OFFSET_LOWER = 0x30 */ |
| 308 | #define DA7219_DAI_OFFSET_LOWER_SHIFT 0 |
| 309 | #define DA7219_DAI_OFFSET_LOWER_MASK (0xFF << 0) |
| 310 | |
| 311 | /* DA7219_DAI_OFFSET_UPPER = 0x31 */ |
| 312 | #define DA7219_DAI_OFFSET_UPPER_SHIFT 0 |
| 313 | #define DA7219_DAI_OFFSET_UPPER_MASK (0x7 << 0) |
| 314 | #define DA7219_DAI_OFFSET_MAX 0x2FF |
| 315 | |
| 316 | /* DA7219_REFERENCES = 0x32 */ |
| 317 | #define DA7219_BIAS_EN_SHIFT 3 |
| 318 | #define DA7219_BIAS_EN_MASK (0x1 << 3) |
| 319 | #define DA7219_VMID_FAST_CHARGE_SHIFT 4 |
| 320 | #define DA7219_VMID_FAST_CHARGE_MASK (0x1 << 4) |
| 321 | |
| 322 | /* DA7219_MIXIN_L_SELECT = 0x33 */ |
| 323 | #define DA7219_MIXIN_L_MIX_SELECT_SHIFT 0 |
| 324 | #define DA7219_MIXIN_L_MIX_SELECT_MASK (0x1 << 0) |
| 325 | |
| 326 | /* DA7219_MIXIN_L_GAIN = 0x34 */ |
| 327 | #define DA7219_MIXIN_L_AMP_GAIN_SHIFT 0 |
| 328 | #define DA7219_MIXIN_L_AMP_GAIN_MASK (0xF << 0) |
| 329 | #define DA7219_MIXIN_L_AMP_GAIN_MAX 0xF |
| 330 | |
| 331 | /* DA7219_ADC_L_GAIN = 0x36 */ |
| 332 | #define DA7219_ADC_L_DIGITAL_GAIN_SHIFT 0 |
| 333 | #define DA7219_ADC_L_DIGITAL_GAIN_MASK (0x7F << 0) |
| 334 | #define DA7219_ADC_L_DIGITAL_GAIN_MAX 0x7F |
| 335 | |
| 336 | /* DA7219_ADC_FILTERS1 = 0x38 */ |
| 337 | #define DA7219_ADC_VOICE_HPF_CORNER_SHIFT 0 |
| 338 | #define DA7219_ADC_VOICE_HPF_CORNER_MASK (0x7 << 0) |
| 339 | #define DA7219_VOICE_HPF_CORNER_MAX 8 |
| 340 | #define DA7219_ADC_VOICE_EN_SHIFT 3 |
| 341 | #define DA7219_ADC_VOICE_EN_MASK (0x1 << 3) |
| 342 | #define DA7219_ADC_AUDIO_HPF_CORNER_SHIFT 4 |
| 343 | #define DA7219_ADC_AUDIO_HPF_CORNER_MASK (0x3 << 4) |
| 344 | #define DA7219_AUDIO_HPF_CORNER_MAX 4 |
| 345 | #define DA7219_ADC_HPF_EN_SHIFT 7 |
| 346 | #define DA7219_ADC_HPF_EN_MASK (0x1 << 7) |
| 347 | #define DA7219_HPF_MODE_SHIFT 0 |
| 348 | #define DA7219_HPF_DISABLED ((0x0 << 3) | (0x0 << 7)) |
| 349 | #define DA7219_HPF_AUDIO_EN ((0x0 << 3) | (0x1 << 7)) |
| 350 | #define DA7219_HPF_VOICE_EN ((0x1 << 3) | (0x1 << 7)) |
| 351 | #define DA7219_HPF_MODE_MASK ((0x1 << 3) | (0x1 << 7)) |
| 352 | #define DA7219_HPF_MODE_MAX 3 |
| 353 | |
| 354 | /* DA7219_MIC_1_GAIN = 0x39 */ |
| 355 | #define DA7219_MIC_1_AMP_GAIN_SHIFT 0 |
| 356 | #define DA7219_MIC_1_AMP_GAIN_MASK (0x7 << 0) |
| 357 | |
| 358 | /* DA7219_SIDETONE_CTRL = 0x3A */ |
| 359 | #define DA7219_SIDETONE_MUTE_EN_SHIFT 6 |
| 360 | #define DA7219_SIDETONE_MUTE_EN_MASK (0x1 << 6) |
| 361 | #define DA7219_SIDETONE_EN_SHIFT 7 |
| 362 | #define DA7219_SIDETONE_EN_MASK (0x1 << 7) |
| 363 | |
| 364 | /* DA7219_SIDETONE_GAIN = 0x3B */ |
| 365 | #define DA7219_SIDETONE_GAIN_SHIFT 0 |
| 366 | #define DA7219_SIDETONE_GAIN_MASK (0xF << 0) |
| 367 | #define DA7219_SIDETONE_GAIN_MAX 0xE |
| 368 | |
| 369 | /* DA7219_DROUTING_ST_OUTFILT_1L = 0x3C */ |
| 370 | #define DA7219_OUTFILT_ST_1L_SRC_SHIFT 0 |
| 371 | #define DA7219_OUTFILT_ST_1L_SRC_MASK (0x7 << 0) |
| 372 | #define DA7219_DMIX_ST_SRC_OUTFILT1L_SHIFT 0 |
| 373 | #define DA7219_DMIX_ST_SRC_OUTFILT1R_SHIFT 1 |
| 374 | #define DA7219_DMIX_ST_SRC_SIDETONE_SHIFT 2 |
| 375 | #define DA7219_DMIX_ST_SRC_OUTFILT1L (0x1 << 0) |
| 376 | #define DA7219_DMIX_ST_SRC_OUTFILT1R (0x1 << 1) |
| 377 | |
| 378 | /* DA7219_DROUTING_ST_OUTFILT_1R = 0x3D */ |
| 379 | #define DA7219_OUTFILT_ST_1R_SRC_SHIFT 0 |
| 380 | #define DA7219_OUTFILT_ST_1R_SRC_MASK (0x7 << 0) |
| 381 | |
| 382 | /* DA7219_DAC_FILTERS5 = 0x40 */ |
| 383 | #define DA7219_DAC_SOFTMUTE_RATE_SHIFT 4 |
| 384 | #define DA7219_DAC_SOFTMUTE_RATE_MASK (0x7 << 4) |
| 385 | #define DA7219_DAC_SOFTMUTE_RATE_MAX 7 |
| 386 | #define DA7219_DAC_SOFTMUTE_EN_SHIFT 7 |
| 387 | #define DA7219_DAC_SOFTMUTE_EN_MASK (0x1 << 7) |
| 388 | |
| 389 | /* DA7219_DAC_FILTERS2 = 0x41 */ |
| 390 | #define DA7219_DAC_EQ_BAND1_SHIFT 0 |
| 391 | #define DA7219_DAC_EQ_BAND1_MASK (0xF << 0) |
| 392 | #define DA7219_DAC_EQ_BAND2_SHIFT 4 |
| 393 | #define DA7219_DAC_EQ_BAND2_MASK (0xF << 4) |
| 394 | #define DA7219_DAC_EQ_BAND_MAX 0xF |
| 395 | |
| 396 | /* DA7219_DAC_FILTERS3 = 0x42 */ |
| 397 | #define DA7219_DAC_EQ_BAND3_SHIFT 0 |
| 398 | #define DA7219_DAC_EQ_BAND3_MASK (0xF << 0) |
| 399 | #define DA7219_DAC_EQ_BAND4_SHIFT 4 |
| 400 | #define DA7219_DAC_EQ_BAND4_MASK (0xF << 4) |
| 401 | |
| 402 | /* DA7219_DAC_FILTERS4 = 0x43 */ |
| 403 | #define DA7219_DAC_EQ_BAND5_SHIFT 0 |
| 404 | #define DA7219_DAC_EQ_BAND5_MASK (0xF << 0) |
| 405 | #define DA7219_DAC_EQ_EN_SHIFT 7 |
| 406 | #define DA7219_DAC_EQ_EN_MASK (0x1 << 7) |
| 407 | |
| 408 | /* DA7219_DAC_FILTERS1 = 0x44 */ |
| 409 | #define DA7219_DAC_VOICE_HPF_CORNER_SHIFT 0 |
| 410 | #define DA7219_DAC_VOICE_HPF_CORNER_MASK (0x7 << 0) |
| 411 | #define DA7219_DAC_VOICE_EN_SHIFT 3 |
| 412 | #define DA7219_DAC_VOICE_EN_MASK (0x1 << 3) |
| 413 | #define DA7219_DAC_AUDIO_HPF_CORNER_SHIFT 4 |
| 414 | #define DA7219_DAC_AUDIO_HPF_CORNER_MASK (0x3 << 4) |
| 415 | #define DA7219_DAC_HPF_EN_SHIFT 7 |
| 416 | #define DA7219_DAC_HPF_EN_MASK (0x1 << 7) |
| 417 | |
| 418 | /* DA7219_DAC_L_GAIN = 0x45 */ |
| 419 | #define DA7219_DAC_L_DIGITAL_GAIN_SHIFT 0 |
| 420 | #define DA7219_DAC_L_DIGITAL_GAIN_MASK (0x7F << 0) |
| 421 | #define DA7219_DAC_DIGITAL_GAIN_MAX 0x7F |
| 422 | #define DA7219_DAC_DIGITAL_GAIN_0DB (0x6F << 0) |
| 423 | |
| 424 | /* DA7219_DAC_R_GAIN = 0x46 */ |
| 425 | #define DA7219_DAC_R_DIGITAL_GAIN_SHIFT 0 |
| 426 | #define DA7219_DAC_R_DIGITAL_GAIN_MASK (0x7F << 0) |
| 427 | |
| 428 | /* DA7219_CP_CTRL = 0x47 */ |
| 429 | #define DA7219_CP_MCHANGE_SHIFT 4 |
| 430 | #define DA7219_CP_MCHANGE_MASK (0x3 << 4) |
| 431 | #define DA7219_CP_MCHANGE_REL_MASK 0x3 |
| 432 | #define DA7219_CP_MCHANGE_MAX 3 |
| 433 | #define DA7219_CP_MCHANGE_LARGEST_VOL 0x1 |
| 434 | #define DA7219_CP_MCHANGE_DAC_VOL 0x2 |
| 435 | #define DA7219_CP_MCHANGE_SIG_MAG 0x3 |
| 436 | #define DA7219_CP_EN_SHIFT 7 |
| 437 | #define DA7219_CP_EN_MASK (0x1 << 7) |
| 438 | |
| 439 | /* DA7219_HP_L_GAIN = 0x48 */ |
| 440 | #define DA7219_HP_L_AMP_GAIN_SHIFT 0 |
| 441 | #define DA7219_HP_L_AMP_GAIN_MASK (0x3F << 0) |
| 442 | #define DA7219_HP_AMP_GAIN_MAX 0x3F |
| 443 | #define DA7219_HP_AMP_GAIN_0DB (0x39 << 0) |
| 444 | |
| 445 | /* DA7219_HP_R_GAIN = 0x49 */ |
| 446 | #define DA7219_HP_R_AMP_GAIN_SHIFT 0 |
| 447 | #define DA7219_HP_R_AMP_GAIN_MASK (0x3F << 0) |
| 448 | |
| 449 | /* DA7219_MIXOUT_L_SELECT = 0x4B */ |
| 450 | #define DA7219_MIXOUT_L_MIX_SELECT_SHIFT 0 |
| 451 | #define DA7219_MIXOUT_L_MIX_SELECT_MASK (0x1 << 0) |
| 452 | |
| 453 | /* DA7219_MIXOUT_R_SELECT = 0x4C */ |
| 454 | #define DA7219_MIXOUT_R_MIX_SELECT_SHIFT 0 |
| 455 | #define DA7219_MIXOUT_R_MIX_SELECT_MASK (0x1 << 0) |
| 456 | |
| 457 | /* DA7219_SYSTEM_MODES_INPUT = 0x50 */ |
| 458 | #define DA7219_MODE_SUBMIT_SHIFT 0 |
| 459 | #define DA7219_MODE_SUBMIT_MASK (0x1 << 0) |
| 460 | #define DA7219_ADC_MODE_SHIFT 1 |
| 461 | #define DA7219_ADC_MODE_MASK (0x7F << 1) |
| 462 | |
| 463 | /* DA7219_SYSTEM_MODES_OUTPUT = 0x51 */ |
| 464 | #define DA7219_MODE_SUBMIT_SHIFT 0 |
| 465 | #define DA7219_MODE_SUBMIT_MASK (0x1 << 0) |
| 466 | #define DA7219_DAC_MODE_SHIFT 1 |
| 467 | #define DA7219_DAC_MODE_MASK (0x7F << 1) |
| 468 | |
| 469 | /* DA7219_MICBIAS_CTRL = 0x62 */ |
| 470 | #define DA7219_MICBIAS1_LEVEL_SHIFT 0 |
| 471 | #define DA7219_MICBIAS1_LEVEL_MASK (0x7 << 0) |
| 472 | #define DA7219_MICBIAS1_EN_SHIFT 3 |
| 473 | #define DA7219_MICBIAS1_EN_MASK (0x1 << 3) |
| 474 | |
| 475 | /* DA7219_MIC_1_CTRL = 0x63 */ |
| 476 | #define DA7219_MIC_1_AMP_RAMP_EN_SHIFT 5 |
| 477 | #define DA7219_MIC_1_AMP_RAMP_EN_MASK (0x1 << 5) |
| 478 | #define DA7219_MIC_1_AMP_MUTE_EN_SHIFT 6 |
| 479 | #define DA7219_MIC_1_AMP_MUTE_EN_MASK (0x1 << 6) |
| 480 | #define DA7219_MIC_1_AMP_EN_SHIFT 7 |
| 481 | #define DA7219_MIC_1_AMP_EN_MASK (0x1 << 7) |
| 482 | |
| 483 | /* DA7219_MIXIN_L_CTRL = 0x65 */ |
| 484 | #define DA7219_MIXIN_L_MIX_EN_SHIFT 3 |
| 485 | #define DA7219_MIXIN_L_MIX_EN_MASK (0x1 << 3) |
| 486 | #define DA7219_MIXIN_L_AMP_ZC_EN_SHIFT 4 |
| 487 | #define DA7219_MIXIN_L_AMP_ZC_EN_MASK (0x1 << 4) |
| 488 | #define DA7219_MIXIN_L_AMP_RAMP_EN_SHIFT 5 |
| 489 | #define DA7219_MIXIN_L_AMP_RAMP_EN_MASK (0x1 << 5) |
| 490 | #define DA7219_MIXIN_L_AMP_MUTE_EN_SHIFT 6 |
| 491 | #define DA7219_MIXIN_L_AMP_MUTE_EN_MASK (0x1 << 6) |
| 492 | #define DA7219_MIXIN_L_AMP_EN_SHIFT 7 |
| 493 | #define DA7219_MIXIN_L_AMP_EN_MASK (0x1 << 7) |
| 494 | |
| 495 | /* DA7219_ADC_L_CTRL = 0x67 */ |
| 496 | #define DA7219_ADC_L_BIAS_SHIFT 0 |
| 497 | #define DA7219_ADC_L_BIAS_MASK (0x3 << 0) |
| 498 | #define DA7219_ADC_L_RAMP_EN_SHIFT 5 |
| 499 | #define DA7219_ADC_L_RAMP_EN_MASK (0x1 << 5) |
| 500 | #define DA7219_ADC_L_MUTE_EN_SHIFT 6 |
| 501 | #define DA7219_ADC_L_MUTE_EN_MASK (0x1 << 6) |
| 502 | #define DA7219_ADC_L_EN_SHIFT 7 |
| 503 | #define DA7219_ADC_L_EN_MASK (0x1 << 7) |
| 504 | |
| 505 | /* DA7219_DAC_L_CTRL = 0x69 */ |
| 506 | #define DA7219_DAC_L_RAMP_EN_SHIFT 5 |
| 507 | #define DA7219_DAC_L_RAMP_EN_MASK (0x1 << 5) |
| 508 | #define DA7219_DAC_L_MUTE_EN_SHIFT 6 |
| 509 | #define DA7219_DAC_L_MUTE_EN_MASK (0x1 << 6) |
| 510 | #define DA7219_DAC_L_EN_SHIFT 7 |
| 511 | #define DA7219_DAC_L_EN_MASK (0x1 << 7) |
| 512 | |
| 513 | /* DA7219_DAC_R_CTRL = 0x6A */ |
| 514 | #define DA7219_DAC_R_RAMP_EN_SHIFT 5 |
| 515 | #define DA7219_DAC_R_RAMP_EN_MASK (0x1 << 5) |
| 516 | #define DA7219_DAC_R_MUTE_EN_SHIFT 6 |
| 517 | #define DA7219_DAC_R_MUTE_EN_MASK (0x1 << 6) |
| 518 | #define DA7219_DAC_R_EN_SHIFT 7 |
| 519 | #define DA7219_DAC_R_EN_MASK (0x1 << 7) |
| 520 | |
| 521 | /* DA7219_HP_L_CTRL = 0x6B */ |
| 522 | #define DA7219_HP_L_AMP_MIN_GAIN_EN_SHIFT 2 |
| 523 | #define DA7219_HP_L_AMP_MIN_GAIN_EN_MASK (0x1 << 2) |
| 524 | #define DA7219_HP_L_AMP_OE_SHIFT 3 |
| 525 | #define DA7219_HP_L_AMP_OE_MASK (0x1 << 3) |
| 526 | #define DA7219_HP_L_AMP_ZC_EN_SHIFT 4 |
| 527 | #define DA7219_HP_L_AMP_ZC_EN_MASK (0x1 << 4) |
| 528 | #define DA7219_HP_L_AMP_RAMP_EN_SHIFT 5 |
| 529 | #define DA7219_HP_L_AMP_RAMP_EN_MASK (0x1 << 5) |
| 530 | #define DA7219_HP_L_AMP_MUTE_EN_SHIFT 6 |
| 531 | #define DA7219_HP_L_AMP_MUTE_EN_MASK (0x1 << 6) |
| 532 | #define DA7219_HP_L_AMP_EN_SHIFT 7 |
| 533 | #define DA7219_HP_L_AMP_EN_MASK (0x1 << 7) |
| 534 | |
| 535 | /* DA7219_HP_R_CTRL = 0x6C */ |
| 536 | #define DA7219_HP_R_AMP_MIN_GAIN_EN_SHIFT 2 |
| 537 | #define DA7219_HP_R_AMP_MIN_GAIN_EN_MASK (0x1 << 2) |
| 538 | #define DA7219_HP_R_AMP_OE_SHIFT 3 |
| 539 | #define DA7219_HP_R_AMP_OE_MASK (0x1 << 3) |
| 540 | #define DA7219_HP_R_AMP_ZC_EN_SHIFT 4 |
| 541 | #define DA7219_HP_R_AMP_ZC_EN_MASK (0x1 << 4) |
| 542 | #define DA7219_HP_R_AMP_RAMP_EN_SHIFT 5 |
| 543 | #define DA7219_HP_R_AMP_RAMP_EN_MASK (0x1 << 5) |
| 544 | #define DA7219_HP_R_AMP_MUTE_EN_SHIFT 6 |
| 545 | #define DA7219_HP_R_AMP_MUTE_EN_MASK (0x1 << 6) |
| 546 | #define DA7219_HP_R_AMP_EN_SHIFT 7 |
| 547 | #define DA7219_HP_R_AMP_EN_MASK (0x1 << 7) |
| 548 | |
| 549 | /* DA7219_MIXOUT_L_CTRL = 0x6E */ |
| 550 | #define DA7219_MIXOUT_L_AMP_EN_SHIFT 7 |
| 551 | #define DA7219_MIXOUT_L_AMP_EN_MASK (0x1 << 7) |
| 552 | |
| 553 | /* DA7219_MIXOUT_R_CTRL = 0x6F */ |
| 554 | #define DA7219_MIXOUT_R_AMP_EN_SHIFT 7 |
| 555 | #define DA7219_MIXOUT_R_AMP_EN_MASK (0x1 << 7) |
| 556 | |
| 557 | /* DA7219_CHIP_ID1 = 0x81 */ |
| 558 | #define DA7219_CHIP_ID1_SHIFT 0 |
| 559 | #define DA7219_CHIP_ID1_MASK (0xFF << 0) |
| 560 | |
| 561 | /* DA7219_CHIP_ID2 = 0x82 */ |
| 562 | #define DA7219_CHIP_ID2_SHIFT 0 |
| 563 | #define DA7219_CHIP_ID2_MASK (0xFF << 0) |
| 564 | |
| 565 | /* DA7219_CHIP_REVISION = 0x83 */ |
| 566 | #define DA7219_CHIP_MINOR_SHIFT 0 |
| 567 | #define DA7219_CHIP_MINOR_MASK (0xF << 0) |
| 568 | #define DA7219_CHIP_MAJOR_SHIFT 4 |
| 569 | #define DA7219_CHIP_MAJOR_MASK (0xF << 4) |
| 570 | |
Adam Thomson | 6d817c0 | 2015-09-29 16:44:01 +0100 | [diff] [blame] | 571 | /* DA7219_IO_CTRL = 0x91 */ |
| 572 | #define DA7219_IO_VOLTAGE_LEVEL_SHIFT 0 |
| 573 | #define DA7219_IO_VOLTAGE_LEVEL_MASK (0x1 << 0) |
| 574 | #define DA7219_IO_VOLTAGE_LEVEL_2_5V_3_6V 0 |
| 575 | #define DA7219_IO_VOLTAGE_LEVEL_1_2V_2_8V 1 |
| 576 | |
| 577 | /* DA7219_GAIN_RAMP_CTRL = 0x92 */ |
| 578 | #define DA7219_GAIN_RAMP_RATE_SHIFT 0 |
| 579 | #define DA7219_GAIN_RAMP_RATE_MASK (0x3 << 0) |
Adam Thomson | 6a0b87c | 2016-09-12 16:46:50 +0100 | [diff] [blame^] | 580 | #define DA7219_GAIN_RAMP_RATE_X8 (0x0 << 0) |
Adam Thomson | 6d817c0 | 2015-09-29 16:44:01 +0100 | [diff] [blame] | 581 | #define DA7219_GAIN_RAMP_RATE_MAX 4 |
| 582 | |
| 583 | /* DA7219_PC_COUNT = 0x94 */ |
| 584 | #define DA7219_PC_FREERUN_SHIFT 0 |
| 585 | #define DA7219_PC_FREERUN_MASK (0x1 << 0) |
| 586 | #define DA7219_PC_RESYNC_AUTO_SHIFT 1 |
| 587 | #define DA7219_PC_RESYNC_AUTO_MASK (0x1 << 1) |
| 588 | |
| 589 | /* DA7219_CP_VOL_THRESHOLD1 = 0x95 */ |
| 590 | #define DA7219_CP_THRESH_VDD2_SHIFT 0 |
| 591 | #define DA7219_CP_THRESH_VDD2_MASK (0x3F << 0) |
| 592 | #define DA7219_CP_THRESH_VDD2_MAX 0x3F |
| 593 | |
| 594 | /* DA7219_DIG_CTRL = 0x99 */ |
| 595 | #define DA7219_DAC_L_INV_SHIFT 3 |
| 596 | #define DA7219_DAC_L_INV_MASK (0x1 << 3) |
| 597 | #define DA7219_DAC_R_INV_SHIFT 7 |
| 598 | #define DA7219_DAC_R_INV_MASK (0x1 << 7) |
| 599 | |
| 600 | /* DA7219_ALC_CTRL2 = 0x9A */ |
| 601 | #define DA7219_ALC_ATTACK_SHIFT 0 |
| 602 | #define DA7219_ALC_ATTACK_MASK (0xF << 0) |
| 603 | #define DA7219_ALC_ATTACK_MAX 13 |
| 604 | #define DA7219_ALC_RELEASE_SHIFT 4 |
| 605 | #define DA7219_ALC_RELEASE_MASK (0xF << 4) |
| 606 | #define DA7219_ALC_RELEASE_MAX 11 |
| 607 | |
| 608 | /* DA7219_ALC_CTRL3 = 0x9B */ |
| 609 | #define DA7219_ALC_HOLD_SHIFT 0 |
| 610 | #define DA7219_ALC_HOLD_MASK (0xF << 0) |
| 611 | #define DA7219_ALC_HOLD_MAX 16 |
| 612 | #define DA7219_ALC_INTEG_ATTACK_SHIFT 4 |
| 613 | #define DA7219_ALC_INTEG_ATTACK_MASK (0x3 << 4) |
| 614 | #define DA7219_ALC_INTEG_RELEASE_SHIFT 6 |
| 615 | #define DA7219_ALC_INTEG_RELEASE_MASK (0x3 << 6) |
| 616 | #define DA7219_ALC_INTEG_MAX 4 |
| 617 | |
| 618 | /* DA7219_ALC_NOISE = 0x9C */ |
| 619 | #define DA7219_ALC_NOISE_SHIFT 0 |
| 620 | #define DA7219_ALC_NOISE_MASK (0x3F << 0) |
| 621 | #define DA7219_ALC_THRESHOLD_MAX 0x3F |
| 622 | |
| 623 | /* DA7219_ALC_TARGET_MIN = 0x9D */ |
| 624 | #define DA7219_ALC_THRESHOLD_MIN_SHIFT 0 |
| 625 | #define DA7219_ALC_THRESHOLD_MIN_MASK (0x3F << 0) |
| 626 | |
| 627 | /* DA7219_ALC_TARGET_MAX = 0x9E */ |
| 628 | #define DA7219_ALC_THRESHOLD_MAX_SHIFT 0 |
| 629 | #define DA7219_ALC_THRESHOLD_MAX_MASK (0x3F << 0) |
| 630 | |
| 631 | /* DA7219_ALC_GAIN_LIMITS = 0x9F */ |
| 632 | #define DA7219_ALC_ATTEN_MAX_SHIFT 0 |
| 633 | #define DA7219_ALC_ATTEN_MAX_MASK (0xF << 0) |
| 634 | #define DA7219_ALC_GAIN_MAX_SHIFT 4 |
| 635 | #define DA7219_ALC_GAIN_MAX_MASK (0xF << 4) |
| 636 | #define DA7219_ALC_ATTEN_GAIN_MAX 0xF |
| 637 | |
| 638 | /* DA7219_ALC_ANA_GAIN_LIMITS = 0xA0 */ |
| 639 | #define DA7219_ALC_ANA_GAIN_MIN_SHIFT 0 |
| 640 | #define DA7219_ALC_ANA_GAIN_MIN_MASK (0x7 << 0) |
| 641 | #define DA7219_ALC_ANA_GAIN_MIN 0x1 |
| 642 | #define DA7219_ALC_ANA_GAIN_MAX_SHIFT 4 |
| 643 | #define DA7219_ALC_ANA_GAIN_MAX_MASK (0x7 << 4) |
| 644 | #define DA7219_ALC_ANA_GAIN_MAX 0x7 |
| 645 | |
| 646 | /* DA7219_ALC_ANTICLIP_CTRL = 0xA1 */ |
| 647 | #define DA7219_ALC_ANTICLIP_STEP_SHIFT 0 |
| 648 | #define DA7219_ALC_ANTICLIP_STEP_MASK (0x3 << 0) |
| 649 | #define DA7219_ALC_ANTICLIP_STEP_MAX 4 |
| 650 | #define DA7219_ALC_ANTIPCLIP_EN_SHIFT 7 |
| 651 | #define DA7219_ALC_ANTIPCLIP_EN_MASK (0x1 << 7) |
| 652 | |
| 653 | /* DA7219_ALC_ANTICLIP_LEVEL = 0xA2 */ |
| 654 | #define DA7219_ALC_ANTICLIP_LEVEL_SHIFT 0 |
| 655 | #define DA7219_ALC_ANTICLIP_LEVEL_MASK (0x7F << 0) |
| 656 | |
| 657 | /* DA7219_ALC_OFFSET_AUTO_M_L = 0xA3 */ |
| 658 | #define DA7219_ALC_OFFSET_AUTO_M_L_SHIFT 0 |
| 659 | #define DA7219_ALC_OFFSET_AUTO_M_L_MASK (0xFF << 0) |
| 660 | |
| 661 | /* DA7219_ALC_OFFSET_AUTO_U_L = 0xA4 */ |
| 662 | #define DA7219_ALC_OFFSET_AUTO_U_L_SHIFT 0 |
| 663 | #define DA7219_ALC_OFFSET_AUTO_U_L_MASK (0xF << 0) |
| 664 | |
| 665 | /* DA7219_DAC_NG_SETUP_TIME = 0xAF */ |
| 666 | #define DA7219_DAC_NG_SETUP_TIME_SHIFT 0 |
| 667 | #define DA7219_DAC_NG_SETUP_TIME_MASK (0x3 << 0) |
| 668 | #define DA7219_DAC_NG_SETUP_TIME_MAX 4 |
| 669 | #define DA7219_DAC_NG_RAMPUP_RATE_SHIFT 2 |
| 670 | #define DA7219_DAC_NG_RAMPUP_RATE_MASK (0x1 << 2) |
| 671 | #define DA7219_DAC_NG_RAMPDN_RATE_SHIFT 3 |
| 672 | #define DA7219_DAC_NG_RAMPDN_RATE_MASK (0x1 << 3) |
| 673 | #define DA7219_DAC_NG_RAMP_RATE_MAX 2 |
| 674 | |
| 675 | /* DA7219_DAC_NG_OFF_THRESH = 0xB0 */ |
| 676 | #define DA7219_DAC_NG_OFF_THRESHOLD_SHIFT 0 |
| 677 | #define DA7219_DAC_NG_OFF_THRESHOLD_MASK (0x7 << 0) |
| 678 | #define DA7219_DAC_NG_THRESHOLD_MAX 0x7 |
| 679 | |
| 680 | /* DA7219_DAC_NG_ON_THRESH = 0xB1 */ |
| 681 | #define DA7219_DAC_NG_ON_THRESHOLD_SHIFT 0 |
| 682 | #define DA7219_DAC_NG_ON_THRESHOLD_MASK (0x7 << 0) |
| 683 | |
| 684 | /* DA7219_DAC_NG_CTRL = 0xB2 */ |
| 685 | #define DA7219_DAC_NG_EN_SHIFT 7 |
| 686 | #define DA7219_DAC_NG_EN_MASK (0x1 << 7) |
| 687 | |
| 688 | /* DA7219_TONE_GEN_CFG1 = 0xB4 */ |
| 689 | #define DA7219_DTMF_REG_SHIFT 0 |
| 690 | #define DA7219_DTMF_REG_MASK (0xF << 0) |
| 691 | #define DA7219_DTMF_REG_MAX 16 |
| 692 | #define DA7219_DTMF_EN_SHIFT 4 |
| 693 | #define DA7219_DTMF_EN_MASK (0x1 << 4) |
| 694 | #define DA7219_START_STOPN_SHIFT 7 |
| 695 | #define DA7219_START_STOPN_MASK (0x1 << 7) |
| 696 | |
| 697 | /* DA7219_TONE_GEN_CFG2 = 0xB5 */ |
| 698 | #define DA7219_SWG_SEL_SHIFT 0 |
| 699 | #define DA7219_SWG_SEL_MASK (0x3 << 0) |
| 700 | #define DA7219_SWG_SEL_MAX 4 |
| 701 | #define DA7219_SWG_SEL_SRAMP (0x3 << 0) |
| 702 | #define DA7219_TONE_GEN_GAIN_SHIFT 4 |
| 703 | #define DA7219_TONE_GEN_GAIN_MASK (0xF << 4) |
| 704 | #define DA7219_TONE_GEN_GAIN_MAX 0xF |
| 705 | #define DA7219_TONE_GEN_GAIN_MINUS_9DB (0x3 << 4) |
| 706 | #define DA7219_TONE_GEN_GAIN_MINUS_15DB (0x5 << 4) |
| 707 | |
| 708 | /* DA7219_TONE_GEN_CYCLES = 0xB6 */ |
| 709 | #define DA7219_BEEP_CYCLES_SHIFT 0 |
| 710 | #define DA7219_BEEP_CYCLES_MASK (0x7 << 0) |
| 711 | |
| 712 | /* DA7219_TONE_GEN_FREQ1_L = 0xB7 */ |
| 713 | #define DA7219_FREQ1_L_SHIFT 0 |
| 714 | #define DA7219_FREQ1_L_MASK (0xFF << 0) |
| 715 | #define DA7219_FREQ_MAX 0xFFFF |
| 716 | |
| 717 | /* DA7219_TONE_GEN_FREQ1_U = 0xB8 */ |
| 718 | #define DA7219_FREQ1_U_SHIFT 0 |
| 719 | #define DA7219_FREQ1_U_MASK (0xFF << 0) |
| 720 | |
| 721 | /* DA7219_TONE_GEN_FREQ2_L = 0xB9 */ |
| 722 | #define DA7219_FREQ2_L_SHIFT 0 |
| 723 | #define DA7219_FREQ2_L_MASK (0xFF << 0) |
| 724 | |
| 725 | /* DA7219_TONE_GEN_FREQ2_U = 0xBA */ |
| 726 | #define DA7219_FREQ2_U_SHIFT 0 |
| 727 | #define DA7219_FREQ2_U_MASK (0xFF << 0) |
| 728 | |
| 729 | /* DA7219_TONE_GEN_ON_PER = 0xBB */ |
| 730 | #define DA7219_BEEP_ON_PER_SHIFT 0 |
| 731 | #define DA7219_BEEP_ON_PER_MASK (0x3F << 0) |
| 732 | #define DA7219_BEEP_ON_OFF_MAX 0x3F |
| 733 | |
| 734 | /* DA7219_TONE_GEN_OFF_PER = 0xBC */ |
| 735 | #define DA7219_BEEP_OFF_PER_SHIFT 0 |
| 736 | #define DA7219_BEEP_OFF_PER_MASK (0x3F << 0) |
| 737 | |
| 738 | /* DA7219_SYSTEM_STATUS = 0xE0 */ |
| 739 | #define DA7219_SC1_BUSY_SHIFT 0 |
| 740 | #define DA7219_SC1_BUSY_MASK (0x1 << 0) |
| 741 | #define DA7219_SC2_BUSY_SHIFT 1 |
| 742 | #define DA7219_SC2_BUSY_MASK (0x1 << 1) |
| 743 | |
| 744 | /* DA7219_SYSTEM_ACTIVE = 0xFD */ |
| 745 | #define DA7219_SYSTEM_ACTIVE_SHIFT 0 |
| 746 | #define DA7219_SYSTEM_ACTIVE_MASK (0x1 << 0) |
| 747 | |
| 748 | |
| 749 | /* |
| 750 | * General defines & data |
| 751 | */ |
| 752 | |
| 753 | /* Register inversion */ |
| 754 | #define DA7219_NO_INVERT 0 |
| 755 | #define DA7219_INVERT 1 |
| 756 | |
| 757 | /* Byte related defines */ |
| 758 | #define DA7219_BYTE_SHIFT 8 |
| 759 | #define DA7219_BYTE_MASK 0xFF |
| 760 | |
| 761 | /* PLL Output Frequencies */ |
| 762 | #define DA7219_PLL_FREQ_OUT_90316 90316800 |
| 763 | #define DA7219_PLL_FREQ_OUT_98304 98304000 |
| 764 | |
| 765 | /* PLL Frequency Dividers */ |
Adam Thomson | 63a450a | 2016-04-19 15:19:02 +0100 | [diff] [blame] | 766 | #define DA7219_PLL_INDIV_2_TO_4_5_MHZ_VAL 1 |
| 767 | #define DA7219_PLL_INDIV_4_5_TO_9_MHZ_VAL 2 |
| 768 | #define DA7219_PLL_INDIV_9_TO_18_MHZ_VAL 4 |
| 769 | #define DA7219_PLL_INDIV_18_TO_36_MHZ_VAL 8 |
| 770 | #define DA7219_PLL_INDIV_36_TO_54_MHZ_VAL 16 |
Adam Thomson | 6d817c0 | 2015-09-29 16:44:01 +0100 | [diff] [blame] | 771 | |
| 772 | /* SRM */ |
| 773 | #define DA7219_SRM_CHECK_RETRIES 8 |
| 774 | |
| 775 | enum da7219_clk_src { |
| 776 | DA7219_CLKSRC_MCLK = 0, |
| 777 | DA7219_CLKSRC_MCLK_SQR, |
| 778 | }; |
| 779 | |
| 780 | enum da7219_sys_clk { |
| 781 | DA7219_SYSCLK_MCLK = 0, |
| 782 | DA7219_SYSCLK_PLL, |
| 783 | DA7219_SYSCLK_PLL_SRM, |
Adam Thomson | 6d817c0 | 2015-09-29 16:44:01 +0100 | [diff] [blame] | 784 | }; |
| 785 | |
| 786 | /* Regulators */ |
| 787 | enum da7219_supplies { |
| 788 | DA7219_SUPPLY_VDD = 0, |
| 789 | DA7219_SUPPLY_VDDMIC, |
| 790 | DA7219_SUPPLY_VDDIO, |
| 791 | DA7219_NUM_SUPPLIES, |
| 792 | }; |
| 793 | |
| 794 | struct da7219_aad_priv; |
| 795 | |
| 796 | /* Private data */ |
| 797 | struct da7219_priv { |
| 798 | struct da7219_aad_priv *aad; |
| 799 | struct da7219_pdata *pdata; |
| 800 | |
| 801 | struct regulator_bulk_data supplies[DA7219_NUM_SUPPLIES]; |
| 802 | struct regmap *regmap; |
| 803 | struct mutex lock; |
| 804 | |
| 805 | struct clk *mclk; |
| 806 | unsigned int mclk_rate; |
| 807 | int clk_src; |
| 808 | |
| 809 | bool master; |
| 810 | bool alc_en; |
| 811 | }; |
| 812 | |
| 813 | #endif /* __DA7219_H */ |