Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-only */
0002 /*
0003 * alc5632.h  --  ALC5632 ALSA SoC Audio Codec
0004 *
0005 * Copyright (C) 2011 The AC100 Kernel Team <ac100@lists.lauchpad.net>
0006 *
0007 * Authors:  Leon Romanovsky <leon@leon.nu>
0008 *           Andrey Danin <danindrey@mail.ru>
0009 *           Ilya Petrov <ilya.muromec@gmail.com>
0010 *           Marc Dietrich <marvin24@gmx.de>
0011 *
0012 * Based on alc5623.h by Arnaud Patard
0013 */
0014 
0015 #ifndef _ALC5632_H
0016 #define _ALC5632_H
0017 
0018 #define ALC5632_RESET               0x00
0019 /* speaker output vol          2    2           */
0020 /* line output vol                      4    2      */
0021 /* HP output vol           4    0    4      */
0022 #define ALC5632_SPK_OUT_VOL         0x02 /* spe out vol */
0023 #define ALC5632_SPK_OUT_VOL_STEP        1.5
0024 #define ALC5632_HP_OUT_VOL          0x04 /* hp out vol */
0025 #define ALC5632_AUX_OUT_VOL         0x06 /* aux out vol */
0026 #define ALC5632_PHONE_IN_VOL            0x08 /* phone in vol */
0027 #define ALC5632_LINE_IN_VOL         0x0A /* line in vol */
0028 #define ALC5632_STEREO_DAC_IN_VOL       0x0C /* stereo dac in vol */
0029 #define ALC5632_MIC_VOL             0x0E /* mic in vol */
0030 /* stero dac/mic routing */
0031 #define ALC5632_MIC_ROUTING_CTRL        0x10
0032 #define ALC5632_MIC_ROUTE_MONOMIX       (1 << 0)
0033 #define ALC5632_MIC_ROUTE_SPK           (1 << 1)
0034 #define ALC5632_MIC_ROUTE_HP            (1 << 2)
0035 
0036 #define ALC5632_ADC_REC_GAIN            0x12 /* rec gain */
0037 #define ALC5632_ADC_REC_GAIN_RANGE      0x1F1F
0038 #define ALC5632_ADC_REC_GAIN_BASE       (-16.5)
0039 #define ALC5632_ADC_REC_GAIN_STEP       1.5
0040 
0041 #define ALC5632_ADC_REC_MIXER           0x14 /* mixer control */
0042 #define ALC5632_ADC_REC_MIC1            (1 << 6)
0043 #define ALC5632_ADC_REC_MIC2            (1 << 5)
0044 #define ALC5632_ADC_REC_LINE_IN         (1 << 4)
0045 #define ALC5632_ADC_REC_AUX         (1 << 3)
0046 #define ALC5632_ADC_REC_HP          (1 << 2)
0047 #define ALC5632_ADC_REC_SPK         (1 << 1)
0048 #define ALC5632_ADC_REC_MONOMIX         (1 << 0)
0049 
0050 #define ALC5632_VOICE_DAC_VOL           0x18 /* voice dac vol */
0051 #define ALC5632_I2S_OUT_CTL             0x1A /* undocumented reg. found in path scheme */
0052 /* ALC5632_OUTPUT_MIXER_CTRL :          */
0053 /* same remark as for reg 2 line vs speaker */
0054 #define ALC5632_OUTPUT_MIXER_CTRL       0x1C /* out mix ctrl */
0055 #define ALC5632_OUTPUT_MIXER_RP         (1 << 14)
0056 #define ALC5632_OUTPUT_MIXER_WEEK       (1 << 12)
0057 #define ALC5632_OUTPUT_MIXER_HP         (1 << 10)
0058 #define ALC5632_OUTPUT_MIXER_AUX_SPK        (2 <<  6)
0059 #define ALC5632_OUTPUT_MIXER_AUX_HP_LR          (1 << 6)
0060 #define ALC5632_OUTPUT_MIXER_HP_R               (1 << 8)
0061 #define ALC5632_OUTPUT_MIXER_HP_L               (1 << 9)
0062 
0063 #define ALC5632_MIC_CTRL            0x22 /* mic phone ctrl */
0064 #define ALC5632_MIC_BOOST_BYPASS        0
0065 #define ALC5632_MIC_BOOST_20DB          1
0066 #define ALC5632_MIC_BOOST_30DB          2
0067 #define ALC5632_MIC_BOOST_40DB          3
0068 
0069 #define ALC5632_DIGI_BOOST_CTRL         0x24 /* digi mic / bost ctl */
0070 #define ALC5632_MIC_BOOST_RANGE         7
0071 #define ALC5632_MIC_BOOST_STEP          6
0072 #define ALC5632_PWR_DOWN_CTRL_STATUS        0x26
0073 #define ALC5632_PWR_DOWN_CTRL_STATUS_MASK   0xEF00
0074 #define ALC5632_PWR_VREF_PR3            (1 << 11)
0075 #define ALC5632_PWR_VREF_PR2            (1 << 10)
0076 #define ALC5632_PWR_VREF_STATUS         (1 << 3)
0077 #define ALC5632_PWR_AMIX_STATUS         (1 << 2)
0078 #define ALC5632_PWR_DAC_STATUS          (1 << 1)
0079 #define ALC5632_PWR_ADC_STATUS          (1 << 0)
0080 /* stereo/voice DAC / stereo adc func ctrl */
0081 #define ALC5632_DAC_FUNC_SELECT         0x2E
0082 
0083 /* Main serial data port ctrl (i2s) */
0084 #define ALC5632_DAI_CONTROL         0x34
0085 
0086 #define ALC5632_DAI_SDP_MASTER_MODE     (0 << 15)
0087 #define ALC5632_DAI_SDP_SLAVE_MODE      (1 << 15)
0088 #define ALC5632_DAI_SADLRCK_MODE        (1 << 14)
0089 /* 0:voice, 1:main */
0090 #define ALC5632_DAI_MAIN_I2S_SYSCLK_SEL     (1 <<  8)
0091 #define ALC5632_DAI_MAIN_I2S_BCLK_POL_CTRL  (1 <<  7)
0092 /* 0:normal, 1:invert */
0093 #define ALC5632_DAI_MAIN_I2S_LRCK_INV       (1 <<  6)
0094 #define ALC5632_DAI_I2S_DL_MASK         (3 <<  2)
0095 #define ALC5632_DAI_I2S_DL_8            (3 <<  2)
0096 #define ALC5632_DAI_I2S_DL_24           (2 <<  2)
0097 #define ALC5632_DAI_I2S_DL_20           (1 <<  2)
0098 #define ALC5632_DAI_I2S_DL_16           (0 <<  2)
0099 #define ALC5632_DAI_I2S_DF_MASK         (3 <<  0)
0100 #define ALC5632_DAI_I2S_DF_PCM_B        (3 <<  0)
0101 #define ALC5632_DAI_I2S_DF_PCM_A        (2 <<  0)
0102 #define ALC5632_DAI_I2S_DF_LEFT         (1 <<  0)
0103 #define ALC5632_DAI_I2S_DF_I2S          (0 <<  0)
0104 /* extend serial data port control (VoDAC_i2c/pcm) */
0105 #define ALC5632_DAI_CONTROL2            0x36
0106 /* 0:gpio func, 1:voice pcm */
0107 #define ALC5632_DAI_VOICE_PCM_ENABLE        (1 << 15)
0108 /* 0:master, 1:slave */
0109 #define ALC5632_DAI_VOICE_MODE_SEL      (1 << 14)
0110 /* 0:disable, 1:enable */
0111 #define ALC5632_DAI_HPF_CLK_CTRL        (1 << 13)
0112 /* 0:main, 1:voice */
0113 #define ALC5632_DAI_VOICE_I2S_SYSCLK_SEL    (1 <<  8)
0114 /* 0:normal, 1:invert */
0115 #define ALC5632_DAI_VOICE_VBCLK_SYSCLK_SEL  (1 <<  7)
0116 /* 0:normal, 1:invert */
0117 #define ALC5632_DAI_VOICE_I2S_LR_INV        (1 <<  6)
0118 #define ALC5632_DAI_VOICE_DL_MASK       (3 <<  2)
0119 #define ALC5632_DAI_VOICE_DL_16         (0 <<  2)
0120 #define ALC5632_DAI_VOICE_DL_20         (1 <<  2)
0121 #define ALC5632_DAI_VOICE_DL_24         (2 <<  2)
0122 #define ALC5632_DAI_VOICE_DL_8          (3 <<  2)
0123 #define ALC5632_DAI_VOICE_DF_MASK       (3 <<  0)
0124 #define ALC5632_DAI_VOICE_DF_I2S        (0 <<  0)
0125 #define ALC5632_DAI_VOICE_DF_LEFT       (1 <<  0)
0126 #define ALC5632_DAI_VOICE_DF_PCM_A      (2 <<  0)
0127 #define ALC5632_DAI_VOICE_DF_PCM_B      (3 <<  0)
0128 
0129 #define ALC5632_PWR_MANAG_ADD1          0x3A
0130 #define ALC5632_PWR_MANAG_ADD1_MASK     0xEFFF
0131 #define ALC5632_PWR_ADD1_DAC_L_EN       (1 << 15)
0132 #define ALC5632_PWR_ADD1_DAC_R_EN       (1 << 14)
0133 #define ALC5632_PWR_ADD1_ZERO_CROSS     (1 << 13)
0134 #define ALC5632_PWR_ADD1_MAIN_I2S_EN        (1 << 11)
0135 #define ALC5632_PWR_ADD1_SPK_AMP_EN     (1 << 10)
0136 #define ALC5632_PWR_ADD1_HP_OUT_AMP     (1 <<  9)
0137 #define ALC5632_PWR_ADD1_HP_OUT_ENH_AMP     (1 <<  8)
0138 #define ALC5632_PWR_ADD1_VOICE_DAC_MIX      (1 <<  7)
0139 #define ALC5632_PWR_ADD1_SOFTGEN_EN     (1 <<  6)
0140 #define ALC5632_PWR_ADD1_MIC1_SHORT_CURR    (1 <<  5)
0141 #define ALC5632_PWR_ADD1_MIC2_SHORT_CURR    (1 <<  4)
0142 #define ALC5632_PWR_ADD1_MIC1_EN        (1 <<  3)
0143 #define ALC5632_PWR_ADD1_MIC2_EN        (1 <<  2)
0144 #define ALC5632_PWR_ADD1_MAIN_BIAS      (1 <<  1)
0145 #define ALC5632_PWR_ADD1_DAC_REF        (1 <<  0)
0146 
0147 #define ALC5632_PWR_MANAG_ADD2          0x3C
0148 #define ALC5632_PWR_MANAG_ADD2_MASK     0x7FFF
0149 #define ALC5632_PWR_ADD2_PLL1           (1 << 15)
0150 #define ALC5632_PWR_ADD2_PLL2           (1 << 14)
0151 #define ALC5632_PWR_ADD2_VREF           (1 << 13)
0152 #define ALC5632_PWR_ADD2_OVT_DET        (1 << 12)
0153 #define ALC5632_PWR_ADD2_VOICE_DAC      (1 << 10)
0154 #define ALC5632_PWR_ADD2_L_DAC_CLK      (1 <<  9)
0155 #define ALC5632_PWR_ADD2_R_DAC_CLK      (1 <<  8)
0156 #define ALC5632_PWR_ADD2_L_ADC_CLK_GAIN     (1 <<  7)
0157 #define ALC5632_PWR_ADD2_R_ADC_CLK_GAIN     (1 <<  6)
0158 #define ALC5632_PWR_ADD2_L_HP_MIXER     (1 <<  5)
0159 #define ALC5632_PWR_ADD2_R_HP_MIXER     (1 <<  4)
0160 #define ALC5632_PWR_ADD2_SPK_MIXER      (1 <<  3)
0161 #define ALC5632_PWR_ADD2_MONO_MIXER     (1 <<  2)
0162 #define ALC5632_PWR_ADD2_L_ADC_REC_MIXER    (1 <<  1)
0163 #define ALC5632_PWR_ADD2_R_ADC_REC_MIXER    (1 <<  0)
0164 
0165 #define ALC5632_PWR_MANAG_ADD3          0x3E
0166 #define ALC5632_PWR_MANAG_ADD3_MASK     0x7CFF
0167 #define ALC5632_PWR_ADD3_AUXOUT_VOL     (1 << 14)
0168 #define ALC5632_PWR_ADD3_SPK_L_OUT      (1 << 13)
0169 #define ALC5632_PWR_ADD3_SPK_R_OUT      (1 << 12)
0170 #define ALC5632_PWR_ADD3_HP_L_OUT_VOL       (1 << 11)
0171 #define ALC5632_PWR_ADD3_HP_R_OUT_VOL       (1 << 10)
0172 #define ALC5632_PWR_ADD3_LINEIN_L_VOL       (1 <<  7)
0173 #define ALC5632_PWR_ADD3_LINEIN_R_VOL       (1 <<  6)
0174 #define ALC5632_PWR_ADD3_AUXIN_VOL      (1 <<  5)
0175 #define ALC5632_PWR_ADD3_AUXIN_MIX      (1 <<  4)
0176 #define ALC5632_PWR_ADD3_MIC1_VOL       (1 <<  3)
0177 #define ALC5632_PWR_ADD3_MIC2_VOL       (1 <<  2)
0178 #define ALC5632_PWR_ADD3_MIC1_BOOST_AD      (1 <<  1)
0179 #define ALC5632_PWR_ADD3_MIC2_BOOST_AD      (1 <<  0)
0180 
0181 #define ALC5632_GPCR1               0x40
0182 #define ALC5632_GPCR1_CLK_SYS_SRC_SEL_PLL1  (1 << 15)
0183 #define ALC5632_GPCR1_CLK_SYS_SRC_SEL_MCLK  (0 << 15)
0184 #define ALC5632_GPCR1_DAC_HI_FLT_EN     (1 << 10)
0185 #define ALC5632_GPCR1_SPK_AMP_CTRL      (7 <<  1)
0186 #define ALC5632_GPCR1_VDD_100           (5 <<  1)
0187 #define ALC5632_GPCR1_VDD_125           (4 <<  1)
0188 #define ALC5632_GPCR1_VDD_150           (3 <<  1)
0189 #define ALC5632_GPCR1_VDD_175           (2 <<  1)
0190 #define ALC5632_GPCR1_VDD_200           (1 <<  1)
0191 #define ALC5632_GPCR1_VDD_225           (0 <<  1)
0192 
0193 #define ALC5632_GPCR2               0x42
0194 #define ALC5632_GPCR2_PLL1_SOUR_SEL     (3 << 12)
0195 #define ALC5632_PLL_FR_MCLK         (0 << 12)
0196 #define ALC5632_PLL_FR_BCLK         (2 << 12)
0197 #define ALC5632_PLL_FR_VBCLK            (3 << 12)
0198 #define ALC5632_GPCR2_CLK_PLL_PRE_DIV1      (0 <<  0)
0199 
0200 #define ALC5632_PLL1_CTRL           0x44
0201 #define ALC5632_PLL1_CTRL_N_VAL(n)      (((n) & 0x0f) << 8)
0202 #define ALC5632_PLL1_M_BYPASS           (1 <<  7)
0203 #define ALC5632_PLL1_CTRL_K_VAL(k)      (((k) & 0x07) << 4)
0204 #define ALC5632_PLL1_CTRL_M_VAL(m)      (((m) & 0x0f) << 0)
0205 
0206 #define ALC5632_PLL2_CTRL           0x46
0207 #define ALC5632_PLL2_EN             (1 << 15)
0208 #define ALC5632_PLL2_RATIO          (0 << 15)
0209 
0210 #define ALC5632_GPIO_PIN_CONFIG         0x4C
0211 #define ALC5632_GPIO_PIN_POLARITY       0x4E
0212 #define ALC5632_GPIO_PIN_STICKY         0x50
0213 #define ALC5632_GPIO_PIN_WAKEUP         0x52
0214 #define ALC5632_GPIO_PIN_STATUS         0x54
0215 #define ALC5632_GPIO_PIN_SHARING        0x56
0216 #define ALC5632_OVER_CURR_STATUS        0x58
0217 #define ALC5632_SOFTVOL_CTRL            0x5A
0218 #define ALC5632_GPIO_OUPUT_PIN_CTRL     0x5C
0219 
0220 #define ALC5632_MISC_CTRL           0x5E
0221 #define ALC5632_MISC_DISABLE_FAST_VREG      (1 << 15)
0222 #define ALC5632_MISC_AVC_TRGT_SEL       (3 << 12)
0223 #define ALC5632_MISC_AVC_TRGT_RIGHT     (1 << 12)
0224 #define ALC5632_MISC_AVC_TRGT_LEFT      (2 << 12)
0225 #define ALC5632_MISC_AVC_TRGT_BOTH      (3 << 12)
0226 #define ALC5632_MISC_HP_DEPOP_MODE1_EN      (1 <<  9)
0227 #define ALC5632_MISC_HP_DEPOP_MODE2_EN      (1 <<  8)
0228 #define ALC5632_MISC_HP_DEPOP_MUTE_L        (1 <<  7)
0229 #define ALC5632_MISC_HP_DEPOP_MUTE_R        (1 <<  6)
0230 #define ALC5632_MISC_HP_DEPOP_MUTE      (1 <<  5)
0231 #define ALC5632_MISC_GPIO_WAKEUP_CTRL       (1 <<  1)
0232 #define ALC5632_MISC_IRQOUT_INV_CTRL        (1 <<  0)
0233 
0234 #define ALC5632_DAC_CLK_CTRL1           0x60
0235 #define ALC5632_DAC_CLK_CTRL2           0x62
0236 #define ALC5632_DAC_CLK_CTRL2_DIV1_2        (1 << 0)
0237 #define ALC5632_VOICE_DAC_PCM_CLK_CTRL1     0x64
0238 #define ALC5632_PSEUDO_SPATIAL_CTRL     0x68
0239 #define ALC5632_HID_CTRL_INDEX          0x6A
0240 #define ALC5632_HID_CTRL_DATA           0x6C
0241 #define ALC5632_EQ_CTRL             0x6E
0242 
0243 /* undocumented */
0244 #define ALC5632_VENDOR_ID1          0x7C
0245 #define ALC5632_VENDOR_ID2          0x7E
0246 
0247 #define ALC5632_MAX_REGISTER        0x7E
0248 
0249 #endif