1 /* 2 * ALSA SoC ES7202 pdm adc driver 3 * 4 * Author: David Yang, <yangxiaohua@everest-semi.com> 5 * Copyright: (C) 2020 Everest Semiconductor Co Ltd., 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License version 2 as 9 * published by the Free Software Foundation. 10 * 11 */ 12 13 #ifndef _ES7202_H 14 #define _ES7202_H 15 16 /* ES7202 register space */ 17 #define ES7202_RESET_REG00 0x00 18 #define ES7202_SOFT_MODE_REG01 0x01 19 #define ES7202_CLK_DIV_REG02 0x02 20 #define ES7202_CLK_EN_REG03 0x03 21 #define ES7202_T1_VMID_REG04 0x04 22 #define ES7202_T2_VMID_REG05 0x05 23 #define ES7202_CHIP_STA_REG06 0x06 24 #define ES7202_PDM_INF_CTL_REG07 0x07 25 #define ES7202_MISC_CTL_REG08 0x08 26 #define ES7202_ANALOG_EN_REG10 0x10 27 #define ES7202_BIAS_VMID_REG11 0x11 28 #define ES7202_PGA1_BIAS_REG12 0x12 29 #define ES7202_PGA2_BIAS_REG13 0x13 30 #define ES7202_MOD1_BIAS_REG14 0x14 31 #define ES7202_MOD2_BIAS_REG15 0x15 32 #define ES7202_VREFP_BIAS_REG16 0x16 33 #define ES7202_VMMOD_BIAS_REG17 0x17 34 #define ES7202_MODS_BIAS_REG18 0x18 35 #define ES7202_ANALOG_LP1_REG19 0x19 36 #define ES7202_ANALOG_LP2_REG1A 0x1A 37 #define ES7202_ANALOG_MISC1_REG1B 0x1B 38 #define ES7202_ANALOG_MISC2_REG1C 0x1C 39 #define ES7202_PGA1_REG1D 0x1D 40 #define ES7202_PGA2_REG1E 0x1E 41 42 /* ES7202 User Marco define */ 43 #define VDD_1V8 0 44 #define VDD_3V3 1 45 #define MAX_VOLTAGE_1_8 1980000 46 47 /* 48 * Select Microphone channels for mic array 49 */ 50 #define MIC_CHN_16 16 51 #define MIC_CHN_14 14 52 #define MIC_CHN_12 12 53 #define MIC_CHN_10 10 54 #define MIC_CHN_8 8 55 #define MIC_CHN_6 6 56 #define MIC_CHN_4 4 57 #define MIC_CHN_2 2 58 59 #define ES7202_CHANNELS_MAX CONFIG_SND_SOC_ES7202_MIC_MAX_CHANNELS 60 61 #if ES7202_CHANNELS_MAX == MIC_CHN_2 62 #define ADC_DEV_MAXNUM 1 63 #endif 64 #if ES7202_CHANNELS_MAX == MIC_CHN_4 65 #define ADC_DEV_MAXNUM 2 66 #endif 67 #if ES7202_CHANNELS_MAX == MIC_CHN_6 68 #define ADC_DEV_MAXNUM 3 69 #endif 70 #if ES7202_CHANNELS_MAX == MIC_CHN_8 71 #define ADC_DEV_MAXNUM 4 72 #endif 73 #if ES7202_CHANNELS_MAX == MIC_CHN_10 74 #define ADC_DEV_MAXNUM 5 75 #endif 76 #if ES7202_CHANNELS_MAX == MIC_CHN_12 77 #define ADC_DEV_MAXNUM 6 78 #endif 79 #if ES7202_CHANNELS_MAX == MIC_CHN_14 80 #define ADC_DEV_MAXNUM 7 81 #endif 82 #if ES7202_CHANNELS_MAX == MIC_CHN_16 83 #define ADC_DEV_MAXNUM 8 84 #endif 85 86 /* select I2C bus number for es7202 */ 87 #define ES7202_I2C_BUS_NUM CONFIG_SND_SOC_ES7202_I2C_BUS 88 89 /* 90 * select DTS or I2C Detect method for es7202 91 * 0: i2c_detect, 1:of_device_id 92 */ 93 #define ES7202_MATCH_DTS_EN 1 94 95 #endif 96