Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003  * max98095.h -- MAX98095 ALSA SoC Audio driver
0004  *
0005  * Copyright 2011 Maxim Integrated Products
0006  */
0007 
0008 #ifndef _MAX98095_H
0009 #define _MAX98095_H
0010 
0011 /*
0012  * MAX98095 Registers Definition
0013  */
0014 
0015 #define M98095_000_HOST_DATA                0x00
0016 #define M98095_001_HOST_INT_STS             0x01
0017 #define M98095_002_HOST_RSP_STS             0x02
0018 #define M98095_003_HOST_CMD_STS             0x03
0019 #define M98095_004_CODEC_STS                0x04
0020 #define M98095_005_DAI1_ALC_STS             0x05
0021 #define M98095_006_DAI2_ALC_STS             0x06
0022 #define M98095_007_JACK_AUTO_STS            0x07
0023 #define M98095_008_JACK_MANUAL_STS          0x08
0024 #define M98095_009_JACK_VBAT_STS            0x09
0025 #define M98095_00A_ACC_ADC_STS              0x0A
0026 #define M98095_00B_MIC_NG_AGC_STS           0x0B
0027 #define M98095_00C_SPK_L_VOLT_STS           0x0C
0028 #define M98095_00D_SPK_R_VOLT_STS           0x0D
0029 #define M98095_00E_TEMP_SENSOR_STS          0x0E
0030 #define M98095_00F_HOST_CFG                 0x0F
0031 #define M98095_010_HOST_INT_CFG             0x10
0032 #define M98095_011_HOST_INT_EN              0x11
0033 #define M98095_012_CODEC_INT_EN             0x12
0034 #define M98095_013_JACK_INT_EN              0x13
0035 #define M98095_014_JACK_INT_EN              0x14
0036 #define M98095_015_DEC                      0x15
0037 #define M98095_016_RESERVED                 0x16
0038 #define M98095_017_RESERVED                 0x17
0039 #define M98095_018_KEYCODE3                 0x18
0040 #define M98095_019_KEYCODE2                 0x19
0041 #define M98095_01A_KEYCODE1                 0x1A
0042 #define M98095_01B_KEYCODE0                 0x1B
0043 #define M98095_01C_OEMCODE1                 0x1C
0044 #define M98095_01D_OEMCODE0                 0x1D
0045 #define M98095_01E_XCFG1                    0x1E
0046 #define M98095_01F_XCFG2                    0x1F
0047 #define M98095_020_XCFG3                    0x20
0048 #define M98095_021_XCFG4                    0x21
0049 #define M98095_022_XCFG5                    0x22
0050 #define M98095_023_XCFG6                    0x23
0051 #define M98095_024_XGPIO                    0x24
0052 #define M98095_025_XCLKCFG                  0x25
0053 #define M98095_026_SYS_CLK                  0x26
0054 #define M98095_027_DAI1_CLKMODE             0x27
0055 #define M98095_028_DAI1_CLKCFG_HI           0x28
0056 #define M98095_029_DAI1_CLKCFG_LO           0x29
0057 #define M98095_02A_DAI1_FORMAT              0x2A
0058 #define M98095_02B_DAI1_CLOCK               0x2B
0059 #define M98095_02C_DAI1_IOCFG               0x2C
0060 #define M98095_02D_DAI1_TDM                 0x2D
0061 #define M98095_02E_DAI1_FILTERS             0x2E
0062 #define M98095_02F_DAI1_LVL1                0x2F
0063 #define M98095_030_DAI1_LVL2                0x30
0064 #define M98095_031_DAI2_CLKMODE             0x31
0065 #define M98095_032_DAI2_CLKCFG_HI           0x32
0066 #define M98095_033_DAI2_CLKCFG_LO           0x33
0067 #define M98095_034_DAI2_FORMAT              0x34
0068 #define M98095_035_DAI2_CLOCK               0x35
0069 #define M98095_036_DAI2_IOCFG               0x36
0070 #define M98095_037_DAI2_TDM                 0x37
0071 #define M98095_038_DAI2_FILTERS             0x38
0072 #define M98095_039_DAI2_LVL1                0x39
0073 #define M98095_03A_DAI2_LVL2                0x3A
0074 #define M98095_03B_DAI3_CLKMODE             0x3B
0075 #define M98095_03C_DAI3_CLKCFG_HI           0x3C
0076 #define M98095_03D_DAI3_CLKCFG_LO           0x3D
0077 #define M98095_03E_DAI3_FORMAT              0x3E
0078 #define M98095_03F_DAI3_CLOCK               0x3F
0079 #define M98095_040_DAI3_IOCFG               0x40
0080 #define M98095_041_DAI3_TDM                 0x41
0081 #define M98095_042_DAI3_FILTERS             0x42
0082 #define M98095_043_DAI3_LVL1                0x43
0083 #define M98095_044_DAI3_LVL2                0x44
0084 #define M98095_045_CFG_DSP                  0x45
0085 #define M98095_046_DAC_CTRL1                0x46
0086 #define M98095_047_DAC_CTRL2                0x47
0087 #define M98095_048_MIX_DAC_LR               0x48
0088 #define M98095_049_MIX_DAC_M                0x49
0089 #define M98095_04A_MIX_ADC_LEFT             0x4A
0090 #define M98095_04B_MIX_ADC_RIGHT            0x4B
0091 #define M98095_04C_MIX_HP_LEFT              0x4C
0092 #define M98095_04D_MIX_HP_RIGHT             0x4D
0093 #define M98095_04E_CFG_HP                   0x4E
0094 #define M98095_04F_MIX_RCV                  0x4F
0095 #define M98095_050_MIX_SPK_LEFT             0x50
0096 #define M98095_051_MIX_SPK_RIGHT            0x51
0097 #define M98095_052_MIX_SPK_CFG              0x52
0098 #define M98095_053_MIX_LINEOUT1             0x53
0099 #define M98095_054_MIX_LINEOUT2             0x54
0100 #define M98095_055_MIX_LINEOUT_CFG          0x55
0101 #define M98095_056_LVL_SIDETONE_DAI12       0x56
0102 #define M98095_057_LVL_SIDETONE_DAI3        0x57
0103 #define M98095_058_LVL_DAI1_PLAY            0x58
0104 #define M98095_059_LVL_DAI1_EQ              0x59
0105 #define M98095_05A_LVL_DAI2_PLAY            0x5A
0106 #define M98095_05B_LVL_DAI2_EQ              0x5B
0107 #define M98095_05C_LVL_DAI3_PLAY            0x5C
0108 #define M98095_05D_LVL_ADC_L                0x5D
0109 #define M98095_05E_LVL_ADC_R                0x5E
0110 #define M98095_05F_LVL_MIC1                 0x5F
0111 #define M98095_060_LVL_MIC2                 0x60
0112 #define M98095_061_LVL_LINEIN               0x61
0113 #define M98095_062_LVL_LINEOUT1             0x62
0114 #define M98095_063_LVL_LINEOUT2             0x63
0115 #define M98095_064_LVL_HP_L                 0x64
0116 #define M98095_065_LVL_HP_R                 0x65
0117 #define M98095_066_LVL_RCV                  0x66
0118 #define M98095_067_LVL_SPK_L                0x67
0119 #define M98095_068_LVL_SPK_R                0x68
0120 #define M98095_069_MICAGC_CFG               0x69
0121 #define M98095_06A_MICAGC_THRESH            0x6A
0122 #define M98095_06B_SPK_NOISEGATE            0x6B
0123 #define M98095_06C_DAI1_ALC1_TIME           0x6C
0124 #define M98095_06D_DAI1_ALC1_COMP           0x6D
0125 #define M98095_06E_DAI1_ALC1_EXPN           0x6E
0126 #define M98095_06F_DAI1_ALC1_GAIN           0x6F
0127 #define M98095_070_DAI1_ALC2_TIME           0x70
0128 #define M98095_071_DAI1_ALC2_COMP           0x71
0129 #define M98095_072_DAI1_ALC2_EXPN           0x72
0130 #define M98095_073_DAI1_ALC2_GAIN           0x73
0131 #define M98095_074_DAI1_ALC3_TIME           0x74
0132 #define M98095_075_DAI1_ALC3_COMP           0x75
0133 #define M98095_076_DAI1_ALC3_EXPN           0x76
0134 #define M98095_077_DAI1_ALC3_GAIN           0x77
0135 #define M98095_078_DAI2_ALC1_TIME           0x78
0136 #define M98095_079_DAI2_ALC1_COMP           0x79
0137 #define M98095_07A_DAI2_ALC1_EXPN           0x7A
0138 #define M98095_07B_DAI2_ALC1_GAIN           0x7B
0139 #define M98095_07C_DAI2_ALC2_TIME           0x7C
0140 #define M98095_07D_DAI2_ALC2_COMP           0x7D
0141 #define M98095_07E_DAI2_ALC2_EXPN           0x7E
0142 #define M98095_07F_DAI2_ALC2_GAIN           0x7F
0143 #define M98095_080_DAI2_ALC3_TIME           0x80
0144 #define M98095_081_DAI2_ALC3_COMP           0x81
0145 #define M98095_082_DAI2_ALC3_EXPN           0x82
0146 #define M98095_083_DAI2_ALC3_GAIN           0x83
0147 #define M98095_084_HP_NOISE_GATE            0x84
0148 #define M98095_085_AUX_ADC                  0x85
0149 #define M98095_086_CFG_LINE                 0x86
0150 #define M98095_087_CFG_MIC                  0x87
0151 #define M98095_088_CFG_LEVEL                0x88
0152 #define M98095_089_JACK_DET_AUTO            0x89
0153 #define M98095_08A_JACK_DET_MANUAL          0x8A
0154 #define M98095_08B_JACK_KEYSCAN_DBC         0x8B
0155 #define M98095_08C_JACK_KEYSCAN_DLY         0x8C
0156 #define M98095_08D_JACK_KEY_THRESH          0x8D
0157 #define M98095_08E_JACK_DC_SLEW             0x8E
0158 #define M98095_08F_JACK_TEST_CFG            0x8F
0159 #define M98095_090_PWR_EN_IN                0x90
0160 #define M98095_091_PWR_EN_OUT               0x91
0161 #define M98095_092_PWR_EN_OUT               0x92
0162 #define M98095_093_BIAS_CTRL                0x93
0163 #define M98095_094_PWR_DAC_21               0x94
0164 #define M98095_095_PWR_DAC_03               0x95
0165 #define M98095_096_PWR_DAC_CK               0x96
0166 #define M98095_097_PWR_SYS                  0x97
0167 
0168 #define M98095_0FF_REV_ID                   0xFF
0169 
0170 #define M98095_REG_CNT                      (0xFF+1)
0171 #define M98095_REG_MAX_CACHED               0X97
0172 
0173 /* MAX98095 Registers Bit Fields */
0174 
0175 /* M98095_007_JACK_AUTO_STS */
0176     #define M98095_MIC_IN           (1<<3)
0177     #define M98095_LO_IN            (1<<5)
0178     #define M98095_HP_IN            (1<<6)
0179     #define M98095_DDONE            (1<<7)
0180 
0181 /* M98095_00F_HOST_CFG */
0182     #define M98095_SEG                      (1<<0)
0183     #define M98095_XTEN                     (1<<1)
0184     #define M98095_MDLLEN                   (1<<2)
0185 
0186 /* M98095_013_JACK_INT_EN */
0187     #define M98095_IMIC_IN          (1<<3)
0188     #define M98095_ILO_IN           (1<<5)
0189     #define M98095_IHP_IN           (1<<6)
0190     #define M98095_IDDONE           (1<<7)
0191 
0192 /* M98095_027_DAI1_CLKMODE, M98095_031_DAI2_CLKMODE, M98095_03B_DAI3_CLKMODE */
0193     #define M98095_CLKMODE_MASK             0xFF
0194 
0195 /* M98095_02A_DAI1_FORMAT, M98095_034_DAI2_FORMAT, M98095_03E_DAI3_FORMAT */
0196     #define M98095_DAI_MAS                  (1<<7)
0197     #define M98095_DAI_WCI                  (1<<6)
0198     #define M98095_DAI_BCI                  (1<<5)
0199     #define M98095_DAI_DLY                  (1<<4)
0200     #define M98095_DAI_TDM                  (1<<2)
0201     #define M98095_DAI_FSW                  (1<<1)
0202     #define M98095_DAI_WS                   (1<<0)
0203 
0204 /* M98095_02B_DAI1_CLOCK, M98095_035_DAI2_CLOCK, M98095_03F_DAI3_CLOCK */
0205     #define M98095_DAI_BSEL64               (1<<0)
0206     #define M98095_DAI_DOSR_DIV2            (0<<5)
0207     #define M98095_DAI_DOSR_DIV4            (1<<5)
0208 
0209 /* M98095_02C_DAI1_IOCFG, M98095_036_DAI2_IOCFG, M98095_040_DAI3_IOCFG */
0210     #define M98095_S1NORMAL                 (1<<6)
0211     #define M98095_S2NORMAL                 (2<<6)
0212     #define M98095_S3NORMAL                 (3<<6)
0213     #define M98095_SDATA                    (3<<0)
0214 
0215 /* M98095_02E_DAI1_FILTERS, M98095_038_DAI2_FILTERS, M98095_042_DAI3_FILTERS */
0216     #define M98095_DAI_DHF                  (1<<3)
0217 
0218 /* M98095_045_DSP_CFG */
0219     #define M98095_DSPNORMAL                (5<<4)
0220 
0221 /* M98095_048_MIX_DAC_LR */
0222     #define M98095_DAI1L_TO_DACR            (1<<7)
0223     #define M98095_DAI1R_TO_DACR            (1<<6)
0224     #define M98095_DAI2M_TO_DACR            (1<<5)
0225     #define M98095_DAI1L_TO_DACL            (1<<3)
0226     #define M98095_DAI1R_TO_DACL            (1<<2)
0227     #define M98095_DAI2M_TO_DACL            (1<<1)
0228     #define M98095_DAI3M_TO_DACL            (1<<0)
0229 
0230 /* M98095_049_MIX_DAC_M */
0231     #define M98095_DAI1L_TO_DACM            (1<<3)
0232     #define M98095_DAI1R_TO_DACM            (1<<2)
0233     #define M98095_DAI2M_TO_DACM            (1<<1)
0234     #define M98095_DAI3M_TO_DACM            (1<<0)
0235 
0236 /* M98095_04E_MIX_HP_CFG */
0237     #define M98095_HPNORMAL                 (3<<4)
0238 
0239 /* M98095_05F_LVL_MIC1, M98095_060_LVL_MIC2 */
0240     #define M98095_MICPRE_MASK              (3<<5)
0241     #define M98095_MICPRE_SHIFT             5
0242 
0243 /* M98095_064_LVL_HP_L, M98095_065_LVL_HP_R */
0244     #define M98095_HP_MUTE                  (1<<7)
0245 
0246 /* M98095_066_LVL_RCV */
0247     #define M98095_REC_MUTE                 (1<<7)
0248 
0249 /* M98095_067_LVL_SPK_L, M98095_068_LVL_SPK_R */
0250     #define M98095_SP_MUTE                  (1<<7)
0251 
0252 /* M98095_087_CFG_MIC */
0253     #define M98095_MICSEL_MASK              (3<<0)
0254     #define M98095_DIGMIC_L                 (1<<2)
0255     #define M98095_DIGMIC_R                 (1<<3)
0256     #define M98095_DIGMIC2L                 (1<<4)
0257     #define M98095_DIGMIC2R                 (1<<5)
0258 
0259 /* M98095_088_CFG_LEVEL */
0260     #define M98095_VSEN                     (1<<6)
0261     #define M98095_ZDEN                     (1<<5)
0262     #define M98095_BQ2EN                    (1<<3)
0263     #define M98095_BQ1EN                    (1<<2)
0264     #define M98095_EQ2EN                    (1<<1)
0265     #define M98095_EQ1EN                    (1<<0)
0266 
0267 /* M98095_089_JACK_DET_AUTO */
0268     #define M98095_PIN5EN           (1<<2)
0269     #define M98095_JDEN         (1<<7)
0270 
0271 /* M98095_090_PWR_EN_IN */
0272     #define M98095_INEN                     (1<<7)
0273     #define M98095_MB2EN                    (1<<3)
0274     #define M98095_MB1EN                    (1<<2)
0275     #define M98095_MBEN                     (3<<2)
0276     #define M98095_ADREN                    (1<<1)
0277     #define M98095_ADLEN                    (1<<0)
0278 
0279 /* M98095_091_PWR_EN_OUT */
0280     #define M98095_HPLEN                    (1<<7)
0281     #define M98095_HPREN                    (1<<6)
0282     #define M98095_SPLEN                    (1<<5)
0283     #define M98095_SPREN                    (1<<4)
0284     #define M98095_RECEN                    (1<<3)
0285     #define M98095_DALEN                    (1<<1)
0286     #define M98095_DAREN                    (1<<0)
0287 
0288 /* M98095_092_PWR_EN_OUT */
0289     #define M98095_SPK_FIXEDSPECTRUM        (0<<4)
0290     #define M98095_SPK_SPREADSPECTRUM       (1<<4)
0291 
0292 /* M98095_097_PWR_SYS */
0293     #define M98095_SHDNRUN                  (1<<7)
0294     #define M98095_PERFMODE                 (1<<3)
0295     #define M98095_HPPLYBACK                (1<<2)
0296     #define M98095_PWRSV8K                  (1<<1)
0297     #define M98095_PWRSV                    (1<<0)
0298 
0299 #define M98095_COEFS_PER_BAND            5
0300 
0301 #define M98095_BYTE1(w) ((w >> 8) & 0xff)
0302 #define M98095_BYTE0(w) (w & 0xff)
0303 
0304 /* Equalizer filter coefficients */
0305 #define M98095_110_DAI1_EQ_BASE             0x10
0306 #define M98095_142_DAI2_EQ_BASE             0x42
0307 
0308 /* Biquad filter coefficients */
0309 #define M98095_174_DAI1_BQ_BASE             0x74
0310 #define M98095_17E_DAI2_BQ_BASE             0x7E
0311 
0312 /* Default Delay used in Slew Rate Calculation for Jack detection */
0313 #define M98095_DEFAULT_SLEW_DELAY       0x18
0314 
0315 extern int max98095_jack_detect(struct snd_soc_component *component,
0316     struct snd_soc_jack *hp_jack, struct snd_soc_jack *mic_jack);
0317 
0318 #endif