ASoC: es7202: add es7202 pdm adc support

ES7202 is 2-ch ADC with PDM interface

Signed-off-by: Binyuan Lan <lby@rock-chips.com>
Change-Id: Id204f592ed91bbdddd71b6dda2e6e0bbae4bb9e8
This commit is contained in:
Binyuan Lan
2020-11-20 20:55:08 +08:00
committed by Tao Huang
parent 8dd999589d
commit 8b96ac442b
4 changed files with 1256 additions and 0 deletions

View File

@@ -83,6 +83,7 @@ config SND_SOC_ALL_CODECS
select SND_SOC_ES8328_I2C if I2C
select SND_SOC_ES8396 if I2C
select SND_SOC_ES7134
select SND_SOC_ES7202
select SND_SOC_ES7241
select SND_SOC_GTM601
select SND_SOC_HDAC_HDMI
@@ -602,6 +603,9 @@ config SND_SOC_HDMI_CODEC
config SND_SOC_ES7134
tristate "Everest Semi ES7134 CODEC"
config SND_SOC_ES7202
tristate "Everest Semi ES7202 PDM 2CH ADC"
config SND_SOC_ES7241
tristate "Everest Semi ES7241 CODEC"

View File

@@ -73,6 +73,7 @@ snd-soc-da9055-objs := da9055.o
snd-soc-dmic-objs := dmic.o
snd-soc-dummy-codec-objs := dummy-codec.o
snd-soc-es7134-objs := es7134.o
snd-soc-es7202-objs := es7202.o
snd-soc-es7241-objs := es7241.o
snd-soc-es8311-objs := es8311.o
snd-soc-es8316-objs := es8316.o
@@ -345,6 +346,7 @@ obj-$(CONFIG_SND_SOC_DA9055) += snd-soc-da9055.o
obj-$(CONFIG_SND_SOC_DMIC) += snd-soc-dmic.o
obj-$(CONFIG_SND_SOC_DUMMY_CODEC) += snd-soc-dummy-codec.o
obj-$(CONFIG_SND_SOC_ES7134) += snd-soc-es7134.o
obj-$(CONFIG_SND_SOC_ES7202) += snd-soc-es7202.o
obj-$(CONFIG_SND_SOC_ES7241) += snd-soc-es7241.o
obj-$(CONFIG_SND_SOC_ES8311) += snd-soc-es8311.o
obj-$(CONFIG_SND_SOC_ES8316) += snd-soc-es8316.o

1155
sound/soc/codecs/es7202.c Normal file

File diff suppressed because it is too large Load Diff

95
sound/soc/codecs/es7202.h Normal file
View File

@@ -0,0 +1,95 @@
/*
* ALSA SoC ES7202 pdm adc driver
*
* Author: David Yang, <yangxiaohua@everest-semi.com>
* Copyright: (C) 2020 Everest Semiconductor Co Ltd.,
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
*
*/
#ifndef _ES7202_H
#define _ES7202_H
/* ES7202 register space */
#define ES7202_RESET_REG00 0x00
#define ES7202_SOFT_MODE_REG01 0x01
#define ES7202_CLK_DIV_REG02 0x02
#define ES7202_CLK_EN_REG03 0x03
#define ES7202_T1_VMID_REG04 0x04
#define ES7202_T2_VMID_REG05 0x05
#define ES7202_CHIP_STA_REG06 0x06
#define ES7202_PDM_INF_CTL_REG07 0x07
#define ES7202_MISC_CTL_REG08 0x08
#define ES7202_ANALOG_EN_REG10 0x10
#define ES7202_BIAS_VMID_REG11 0x11
#define ES7202_PGA1_BIAS_REG12 0x12
#define ES7202_PGA2_BIAS_REG13 0x13
#define ES7202_MOD1_BIAS_REG14 0x14
#define ES7202_MOD2_BIAS_REG15 0x15
#define ES7202_VREFP_BIAS_REG16 0x16
#define ES7202_VMMOD_BIAS_REG17 0x17
#define ES7202_MODS_BIAS_REG18 0x18
#define ES7202_ANALOG_LP1_REG19 0x19
#define ES7202_ANALOG_LP2_REG1A 0x1A
#define ES7202_ANALOG_MISC1_REG1B 0x1B
#define ES7202_ANALOG_MISC2_REG1C 0x1C
#define ES7202_PGA1_REG1D 0x1D
#define ES7202_PGA2_REG1E 0x1E
/* ES7202 User Marco define */
#define VDD_1V8 0
#define VDD_3V3 1
#define ES7202_VDD_VOLTAGE VDD_3V3
/*
* Select Microphone channels for mic array
*/
#define MIC_CHN_16 16
#define MIC_CHN_14 14
#define MIC_CHN_12 12
#define MIC_CHN_10 10
#define MIC_CHN_8 8
#define MIC_CHN_6 6
#define MIC_CHN_4 4
#define MIC_CHN_2 2
#define ES7202_CHANNELS_MAX MIC_CHN_2
#if ES7202_CHANNELS_MAX == MIC_CHN_2
#define ADC_DEV_MAXNUM 1
#endif
#if ES7202_CHANNELS_MAX == MIC_CHN_4
#define ADC_DEV_MAXNUM 2
#endif
#if ES7202_CHANNELS_MAX == MIC_CHN_6
#define ADC_DEV_MAXNUM 3
#endif
#if ES7202_CHANNELS_MAX == MIC_CHN_8
#define ADC_DEV_MAXNUM 4
#endif
#if ES7202_CHANNELS_MAX == MIC_CHN_10
#define ADC_DEV_MAXNUM 5
#endif
#if ES7202_CHANNELS_MAX == MIC_CHN_12
#define ADC_DEV_MAXNUM 6
#endif
#if ES7202_CHANNELS_MAX == MIC_CHN_14
#define ADC_DEV_MAXNUM 7
#endif
#if ES7202_CHANNELS_MAX == MIC_CHN_16
#define ADC_DEV_MAXNUM 8
#endif
/* select I2C bus number for es7202 */
#define ES7202_I2C_BUS_NUM 1
/*
* select DTS or I2C Detect method for es7202
* 0: i2c_detect, 1:of_device_id
*/
#define ES7202_MATCH_DTS_EN 1
#endif