Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

ASoC: es83xx: add ACPI DSM helper module

Most of the ES83xx codec configuration is exposed in the DSDT table
and accessible via a _DSM method. Start adding basic definitions and
helpers to dump the information.

Reviewed-by: Mauro Carvalho Chehab <mchehab@kernel.org>
Co-developed-by: David Yang <yangxiaohua@everest-semi.com>
Signed-off-by: David Yang <yangxiaohua@everest-semi.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20231202123946.54347-2-hdegoede@redhat.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Pierre-Louis Bossart and committed by
Mark Brown
9c8bec3b 4978d3f8

+488
+4
sound/soc/codecs/Kconfig
··· 1076 1076 config SND_SOC_ES7241 1077 1077 tristate "Everest Semi ES7241 CODEC" 1078 1078 1079 + config SND_SOC_ES83XX_DSM_COMMON 1080 + depends on ACPI 1081 + tristate 1082 + 1079 1083 config SND_SOC_ES8316 1080 1084 tristate "Everest Semi ES8316 CODEC" 1081 1085 depends on I2C
+2
sound/soc/codecs/Makefile
··· 116 116 snd-soc-dmic-objs := dmic.o 117 117 snd-soc-es7134-objs := es7134.o 118 118 snd-soc-es7241-objs := es7241.o 119 + snd-soc-es83xx-dsm-common-objs := es83xx-dsm-common.o 119 120 snd-soc-es8316-objs := es8316.o 120 121 snd-soc-es8326-objs := es8326.o 121 122 snd-soc-es8328-objs := es8328.o ··· 506 505 obj-$(CONFIG_SND_SOC_DMIC) += snd-soc-dmic.o 507 506 obj-$(CONFIG_SND_SOC_ES7134) += snd-soc-es7134.o 508 507 obj-$(CONFIG_SND_SOC_ES7241) += snd-soc-es7241.o 508 + obj-$(CONFIG_SND_SOC_ES83XX_DSM_COMMON) += snd-soc-es83xx-dsm-common.o 509 509 obj-$(CONFIG_SND_SOC_ES8316) += snd-soc-es8316.o 510 510 obj-$(CONFIG_SND_SOC_ES8326) += snd-soc-es8326.o 511 511 obj-$(CONFIG_SND_SOC_ES8328) += snd-soc-es8328.o
+89
sound/soc/codecs/es83xx-dsm-common.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-only 2 + // 3 + // Copyright (c) Intel Corporation, 2022 4 + // Copyright Everest Semiconductor Co.,Ltd 5 + 6 + #include <linux/module.h> 7 + #include <linux/acpi.h> 8 + #include "es83xx-dsm-common.h" 9 + 10 + /* UUID ("a9800c04-e016-343e-41f4-6bcce70f4332") */ 11 + static const guid_t es83xx_dsm_guid = 12 + GUID_INIT(0xa9800c04, 0xe016, 0x343e, 13 + 0x41, 0xf4, 0x6b, 0xcc, 0xe7, 0x0f, 0x43, 0x32); 14 + 15 + #define ES83xx_DSM_REVID 1 16 + 17 + int es83xx_dsm(struct device *dev, int arg, int *value) 18 + { 19 + acpi_handle dhandle; 20 + union acpi_object *obj; 21 + int ret = 0; 22 + 23 + dhandle = ACPI_HANDLE(dev); 24 + if (!dhandle) 25 + return -ENOENT; 26 + 27 + obj = acpi_evaluate_dsm(dhandle, &es83xx_dsm_guid, ES83xx_DSM_REVID, 28 + arg, NULL); 29 + if (!obj) { 30 + dev_err(dev, "%s: acpi_evaluate_dsm() failed\n", __func__); 31 + ret = -EINVAL; 32 + goto out; 33 + } 34 + 35 + if (obj->type != ACPI_TYPE_INTEGER) { 36 + dev_err(dev, "%s: object is not ACPI_TYPE_INTEGER\n", __func__); 37 + ret = -EINVAL; 38 + goto err; 39 + } 40 + 41 + *value = obj->integer.value; 42 + err: 43 + ACPI_FREE(obj); 44 + out: 45 + return ret; 46 + } 47 + EXPORT_SYMBOL_GPL(es83xx_dsm); 48 + 49 + int es83xx_dsm_dump(struct device *dev) 50 + { 51 + int value; 52 + int ret; 53 + 54 + ret = es83xx_dsm(dev, PLATFORM_MAINMIC_TYPE_ARG, &value); 55 + if (ret < 0) 56 + return ret; 57 + dev_info(dev, "PLATFORM_MAINMIC_TYPE %#x\n", value); 58 + 59 + ret = es83xx_dsm(dev, PLATFORM_HPMIC_TYPE_ARG, &value); 60 + if (ret < 0) 61 + return ret; 62 + dev_info(dev, "PLATFORM_HPMIC_TYPE %#x\n", value); 63 + 64 + ret = es83xx_dsm(dev, PLATFORM_SPK_TYPE_ARG, &value); 65 + if (ret < 0) 66 + return ret; 67 + dev_info(dev, "PLATFORM_SPK_TYPE %#x\n", value); 68 + 69 + ret = es83xx_dsm(dev, PLATFORM_HPDET_INV_ARG, &value); 70 + if (ret < 0) 71 + return ret; 72 + dev_info(dev, "PLATFORM_HPDET_INV %#x\n", value); 73 + 74 + ret = es83xx_dsm(dev, PLATFORM_PCM_TYPE_ARG, &value); 75 + if (ret < 0) 76 + return ret; 77 + dev_info(dev, "PLATFORM_PCM_TYPE %#x\n", value); 78 + 79 + ret = es83xx_dsm(dev, PLATFORM_MIC_DE_POP_ARG, &value); 80 + if (ret < 0) 81 + return ret; 82 + dev_info(dev, "PLATFORM_MIC_DE_POP %#x\n", value); 83 + 84 + return 0; 85 + } 86 + EXPORT_SYMBOL_GPL(es83xx_dsm_dump); 87 + 88 + MODULE_DESCRIPTION("Everest Semi ES83xx DSM helpers"); 89 + MODULE_LICENSE("GPL");
+393
sound/soc/codecs/es83xx-dsm-common.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0-only */ 2 + /* 3 + * Copyright (c) Intel Corporation, 2022 4 + * Copyright Everest Semiconductor Co.,Ltd 5 + */ 6 + 7 + /* Definitions extracted from ASL file provided at 8 + * https://github.com/thesofproject/linux/files/9398723/ESSX8326.zip 9 + */ 10 + 11 + #ifndef _ES83XX_DSM_COMMON_H 12 + #define _ES83XX_DSM_COMMON_H 13 + 14 + /*************************************************** 15 + * DSM arguments * 16 + ***************************************************/ 17 + 18 + #define PLATFORM_MAINMIC_TYPE_ARG 0x00 19 + #define PLATFORM_HPMIC_TYPE_ARG 0x01 20 + #define PLATFORM_SPK_TYPE_ARG 0x02 21 + #define PLATFORM_HPDET_INV_ARG 0x03 22 + #define PLATFORM_PCM_TYPE_ARG 0x04 23 + 24 + #define PLATFORM_MIC_DE_POP_ARG 0x06 25 + #define PLATFORM_CODEC_TYPE_ARG 0x0E 26 + #define PLATFORM_BUS_SLOT_ARG 0x0F 27 + 28 + #define HP_CODEC_LINEIN_PGA_GAIN_ARG 0x10 29 + #define MAIN_CODEC_LINEIN_PGA_GAIN_ARG 0x20 30 + 31 + #define HP_CODEC_D2SEPGA_GAIN_ARG 0x11 32 + #define MAIN_CODEC_D2SEPGA_GAIN_ARG 0x21 33 + 34 + #define HP_CODEC_ADC_VOLUME_ARG 0x12 35 + #define MAIN_CODEC_ADC_VOLUME_ARG 0x22 36 + 37 + #define HP_CODEC_ADC_ALC_ENABLE_ARG 0x13 38 + #define MAIN_CODEC_ADC_ALC_ENABLE_ARG 0x23 39 + 40 + #define HP_CODEC_ADC_ALC_TARGET_LEVEL_ARG 0x14 41 + #define MAIN_CODEC_ADC_ALC_TARGET_LEVEL_ARG 0x24 42 + 43 + #define HP_CODEC_ADC_ALC_MAXGAIN_ARG 0x15 44 + #define MAIN_CODEC_ADC_ALC_MAXGAIN_ARG 0x25 45 + 46 + #define HP_CODEC_ADC_ALC_MINGAIN_ARG 0x16 47 + #define MAIN_CODEC_ADC_ALC_MINGAIN_ARG 0x26 48 + 49 + #define HP_CODEC_ADC_ALC_HLDTIME_ARG 0x17 50 + #define MAIN_CODEC_ADC_ALC_HLDTIME_ARG 0x27 51 + 52 + #define HP_CODEC_ADC_ALC_DCYTIME_ARG 0x18 53 + #define MAIN_CODEC_ADC_ALC_DCYTIME_ARG 0x28 54 + 55 + #define HP_CODEC_ADC_ALC_ATKTIME_ARG 0x19 56 + #define MAIN_CODEC_ADC_ALC_ATKTIME_ARG 0x29 57 + 58 + #define HP_CODEC_ADC_ALC_NGTYPE_ARG 0x1a 59 + #define MAIN_CODEC_ADC_ALC_NGTYPE_ARG 0x2a 60 + 61 + #define HP_CODEC_ADC_ALC_NGTHLD_ARG 0x1b 62 + #define MAIN_CODEC_ADC_ALC_NGTHLD_ARG 0x2b 63 + 64 + #define MAIN_CODEC_ADC_GUI_STEP_ARG 0x2c 65 + #define MAIN_CODEC_ADC_GUI_GAIN_RANGE_ARG 0x2c 66 + 67 + #define HEADPHONE_DUMMY_REMOVE_ENABLE_ARG 0x2e 68 + 69 + #define HP_CODEC_DAC_HPMIX_HIGAIN_ARG 0x40 70 + #define SPK_CODEC_DAC_HPMIX_HIGAIN_ARG 0x50 71 + 72 + #define HP_CODEC_DAC_HPMIX_VOLUME_ARG 0x41 73 + #define SPK_CODEC_DAC_HPMIX_VOLUME_ARG 0x51 74 + 75 + #define HP_CODEC_DAC_HPOUT_VOLUME_ARG 0x42 76 + #define SPK_CODEC_DAC_HPOUT_VOLUME_ARG 0x52 77 + 78 + #define HP_CODEC_LDAC_VOLUME_ARG 0x44 79 + #define HP_CODEC_RDAC_VOLUME_ARG 0x54 80 + 81 + #define SPK_CODEC_LDAC_VOLUME_ARG 0x45 82 + #define SPK_CODEC_RDAC_VOLUME_ARG 0x55 83 + 84 + #define HP_CODEC_DAC_AUTOMUTE_ARG 0x46 85 + #define SPK_CODEC_DAC_AUTOMUTE_ARG 0x56 86 + 87 + #define HP_CODEC_DAC_MONO_ARG 0x4A 88 + #define SPK_CODEC_DAC_MONO_ARG 0x5A 89 + 90 + #define HP_CTL_IO_LEVEL_ARG 0x4B 91 + #define SPK_CTL_IO_LEVEL_ARG 0x5B 92 + 93 + #define CODEC_GPIO0_FUNC_ARG 0x80 94 + #define CODEC_GPIO1_FUNC_ARG 0x81 95 + #define CODEC_GPIO2_FUNC_ARG 0x82 96 + #define CODEC_GPIO3_FUNC_ARG 0x83 97 + #define CODEC_GPIO4_FUNC_ARG 0x84 98 + 99 + #define PLATFORM_MCLK_LRCK_FREQ_ARG 0x85 100 + 101 + /*************************************************** 102 + * Values for arguments * 103 + ***************************************************/ 104 + 105 + /* Main and HP Mic */ 106 + #define PLATFORM_MIC_DMIC_HIGH_LEVEL 0xAA 107 + #define PLATFORM_MIC_DMIC_LOW_LEVEL 0x55 108 + #define PLATFORM_MIC_AMIC_LIN1RIN1 0xBB 109 + #define PLATFORM_MIC_AMIC_LIN2RIN2 0xCC 110 + 111 + /* Speaker */ 112 + #define PLATFORM_SPK_NONE 0x00 113 + #define PLATFORM_SPK_MONO 0x01 114 + #define PLATFORM_SPK_STEREO 0x02 115 + 116 + /* Jack Detection */ 117 + #define PLATFORM_HPDET_NORMAL 0x00 118 + #define PLATFORM_HPDET_INVERTED 0x01 119 + 120 + /* PCM type (Port number + protocol) */ 121 + /* 122 + * RETURNED VALUE = 0x00, PCM PORT0, I2S 123 + * 0x01, PCM PORT0, LJ 124 + * 0x02, PCM PORT0, RJ 125 + * 0x03, PCM PORT0, DSP-A 126 + * 0x04, PCM PORT0, DSP-B 127 + * 0x10, PCM PORT1, I2S 128 + * 0x11, PCM PORT1, LJ 129 + * 0x12, PCM PORT1, RJ 130 + * 0x13, PCM PORT1, DSP-A 131 + * 0x14, PCM PORT1, DSP-B 132 + * 0xFF, Use default 133 + * 134 + * This is not used in Linux (defined by topology) and in 135 + * Windows it's always DSP-A 136 + */ 137 + 138 + /* Depop */ 139 + #define PLATFORM_MIC_DE_POP_OFF 0x00 140 + #define PLATFORM_MIC_DE_POP_ON 0x01 141 + 142 + /* Codec type */ 143 + #define PLATFORM_CODEC_8316 16 144 + #define PLATFORM_CODEC_8326 26 145 + #define PLATFORM_CODEC_8336 36 146 + #define PLATFORM_CODEC_8395 95 147 + #define PLATFORM_CODEC_8396 96 148 + 149 + /* Bus slot (on the host) */ 150 + /* BIT[3:0] FOR BUS NUMBER, BIT[7:4] FOR SLOT NUMBER 151 + * BIT[3:0] 0 for I2S0, 1 for IS21, 2 for I2S2. 152 + * 153 + * On Intel platforms this refers to SSP0..2. This information 154 + * is not really useful for Linux, the information is already 155 + * inferred from NHLT but can be used to double-check NHLT 156 + */ 157 + 158 + /* Volume - Gain */ 159 + #define LINEIN_GAIN_0db 0x00 /* gain = 0db */ 160 + #define LINEIN_GAIN_3db 0x01 /* gain = +3db */ 161 + #define LINEIN_GAIN_6db 0x02 /* gain = +6db */ 162 + #define LINEIN_GAIN_9db 0x03 /* gain = +9db */ 163 + #define LINEIN_GAIN_12db 0x04 /* gain = +12db */ 164 + #define LINEIN_GAIN_15db 0x05 /* gain = +15db */ 165 + #define LINEIN_GAIN_18db 0x06 /* gain = +18db */ 166 + #define LINEIN_GAIN_21db 0x07 /* gain = +21db */ 167 + #define LINEIN_GAIN_24db 0x08 /* gain = +24db */ 168 + #define LINEIN_GAIN_27db 0x09 /* gain = +27db */ 169 + #define LINEIN_GAIN_30db 0x0a /* gain = +30db */ 170 + 171 + #define ADC_GUI_STEP_3db 0x03 /* gain = +3db */ 172 + #define ADC_GUI_STEP_6db 0x06 /* gain = +6db */ 173 + #define ADC_GUI_STEP_10db 0x0a /* gain = +10db */ 174 + 175 + #define D2SEPGA_GAIN_0db 0x00 /* gain = 0db */ 176 + #define D2SEPGA_GAIN_15db 0x01 /* gain = +15db */ 177 + 178 + /* ADC volume: base = 0db, -0.5db/setp, 0xc0 <-> -96db */ 179 + 180 + #define ADC_ALC_DISABLE 0x00 181 + #define ADC_ALC_ENABLE 0x01 182 + 183 + #define ADC_ALC_TARGET_LEVEL_m16_5db 0x00 /* gain = -16.5db */ 184 + #define ADC_ALC_TARGET_LEVEL_m15db 0x01 /* gain = -15db */ 185 + #define ADC_ALC_TARGET_LEVEL_m13_5db 0x02 /* gain = -13.5db */ 186 + #define ADC_ALC_TARGET_LEVEL_m12db 0x03 /* gain = -12db */ 187 + #define ADC_ALC_TARGET_LEVEL_m10_5db 0x04 /* gain = -10.5db */ 188 + #define ADC_ALC_TARGET_LEVEL_m9db 0x05 /* gain = -9db */ 189 + #define ADC_ALC_TARGET_LEVEL_m7_5db 0x06 /* gain = -7.5db */ 190 + #define ADC_ALC_TARGET_LEVEL_m6db 0x07 /* gain = -6db */ 191 + #define ADC_ALC_TARGET_LEVEL_m4_5db 0x08 /* gain = -4.5db */ 192 + #define ADC_ALC_TARGET_LEVEL_m_3db 0x09 /* gain = -3db */ 193 + #define ADC_ALC_TARGET_LEVEL_m1_5db 0x0a /* gain = -1.5db */ 194 + 195 + #define ADC_ALC_MAXGAIN_m6_5db 0x00 /* gain = -6.5db */ 196 + #define ADC_ALC_MAXGAIN_m5db 0x01 /* gain = -5db */ 197 + #define ADC_ALC_MAXGAIN_m3_5db 0x02 /* gain = -3.5db */ 198 + #define ADC_ALC_MAXGAIN_m2db 0x03 /* gain = -2db */ 199 + #define ADC_ALC_MAXGAIN_m0_5db 0x04 /* gain = -0.5db */ 200 + #define ADC_ALC_MAXGAIN_1db 0x05 /* gain = +1db */ 201 + #define ADC_ALC_MAXGAIN_2_5db 0x06 /* gain = +2.5db */ 202 + #define ADC_ALC_MAXGAIN_4db 0x07 /* gain = +4db */ 203 + #define ADC_ALC_MAXGAIN_5_5db 0x08 /* gain = +5.5db */ 204 + #define ADC_ALC_MAXGAIN_7db 0x09 /* gain = +7db */ 205 + #define ADC_ALC_MAXGAIN_8_5db 0x0a /* gain = +8.5db */ 206 + #define ADC_ALC_MAXGAIN_10db 0x0b /* gain = +10db */ 207 + #define ADC_ALC_MAXGAIN_11_5db 0x0c /* gain = +11.5db */ 208 + #define ADC_ALC_MAXGAIN_13db 0x0d /* gain = +13db */ 209 + #define ADC_ALC_MAXGAIN_14_5db 0x0e /* gain = +14.5db */ 210 + #define ADC_ALC_MAXGAIN_16db 0x0f /* gain = +16db */ 211 + #define ADC_ALC_MAXGAIN_17_5db 0x10 /* gain = +17.5db */ 212 + #define ADC_ALC_MAXGAIN_19db 0x11 /* gain = +19db */ 213 + #define ADC_ALC_MAXGAIN_20_5db 0x12 /* gain = +20.5db */ 214 + #define ADC_ALC_MAXGAIN_22db 0x13 /* gain = +22db */ 215 + #define ADC_ALC_MAXGAIN_23_5db 0x14 /* gain = +23.5db */ 216 + #define ADC_ALC_MAXGAIN_25db 0x15 /* gain = +25db */ 217 + #define ADC_ALC_MAXGAIN_26_5db 0x16 /* gain = +26.5db */ 218 + #define ADC_ALC_MAXGAIN_28db 0x17 /* gain = +28db */ 219 + #define ADC_ALC_MAXGAIN_29_5db 0x18 /* gain = +29.5db */ 220 + #define ADC_ALC_MAXGAIN_31db 0x19 /* gain = +31db */ 221 + #define ADC_ALC_MAXGAIN_32_5db 0x1a /* gain = +32.5db */ 222 + #define ADC_ALC_MAXGAIN_34db 0x1b /* gain = +34db */ 223 + #define ADC_ALC_MAXGAIN_35_5db 0x1c /* gain = +35.5db */ 224 + 225 + #define ADC_ALC_MINGAIN_m12db 0x00 /* gain = -12db */ 226 + #define ADC_ALC_MINGAIN_m10_5db 0x01 /* gain = -10.5db */ 227 + #define ADC_ALC_MINGAIN_m9db 0x02 /* gain = -9db */ 228 + #define ADC_ALC_MINGAIN_m7_5db 0x03 /* gain = -7.5db */ 229 + #define ADC_ALC_MINGAIN_m6db 0x04 /* gain = -6db */ 230 + #define ADC_ALC_MINGAIN_m4_51db 0x05 /* gain = -4.51db */ 231 + #define ADC_ALC_MINGAIN_m3db 0x06 /* gain = -3db */ 232 + #define ADC_ALC_MINGAIN_m1_5db 0x07 /* gain = -1.5db */ 233 + #define ADC_ALC_MINGAIN_0db 0x08 /* gain = 0db */ 234 + #define ADC_ALC_MINGAIN_1_5db 0x09 /* gain = +1.5db */ 235 + #define ADC_ALC_MINGAIN_3db 0x0a /* gain = +3db */ 236 + #define ADC_ALC_MINGAIN_4_5db 0x0b /* gain = +4.5db */ 237 + #define ADC_ALC_MINGAIN_6db 0x0c /* gain = +6db */ 238 + #define ADC_ALC_MINGAIN_7_5db 0x0d /* gain = +7.5db */ 239 + #define ADC_ALC_MINGAIN_9db 0x0e /* gain = +9db */ 240 + #define ADC_ALC_MINGAIN_10_5db 0x0f /* gain = +10.5db */ 241 + #define ADC_ALC_MINGAIN_12db 0x10 /* gain = +12db */ 242 + #define ADC_ALC_MINGAIN_13_5db 0x11 /* gain = +13.5db */ 243 + #define ADC_ALC_MINGAIN_15db 0x12 /* gain = +15db */ 244 + #define ADC_ALC_MINGAIN_16_5db 0x13 /* gain = +16.5db */ 245 + #define ADC_ALC_MINGAIN_18db 0x14 /* gain = +18db */ 246 + #define ADC_ALC_MINGAIN_19_5db 0x15 /* gain = +19.5db */ 247 + #define ADC_ALC_MINGAIN_21db 0x16 /* gain = +21db */ 248 + #define ADC_ALC_MINGAIN_22_5db 0x17 /* gain = +22.5db */ 249 + #define ADC_ALC_MINGAIN_24db 0x18 /* gain = +24db */ 250 + #define ADC_ALC_MINGAIN_25_5db 0x19 /* gain = +25.5db */ 251 + #define ADC_ALC_MINGAIN_27db 0x1a /* gain = +27db */ 252 + #define ADC_ALC_MINGAIN_28_5db 0x1b /* gain = +28.5db */ 253 + #define ADC_ALC_MINGAIN_30db 0x1c /* gain = +30db */ 254 + 255 + /* ADC volume: step 1dB */ 256 + 257 + /* ALC Hold, Decay, Attack */ 258 + #define ADC_ALC_HLDTIME_0_US 0x00 259 + #define ADC_ALC_HLDTIME_0000266_US 0x01 //time = 2.67ms 260 + #define ADC_ALC_HLDTIME_0000533_US 0x02 //time = 5.33ms 261 + #define ADC_ALC_HLDTIME_0001066_US 0x03 //time = 10.66ms 262 + #define ADC_ALC_HLDTIME_0002132_US 0x04 //time = 21.32ms 263 + #define ADC_ALC_HLDTIME_0004264_US 0x05 //time = 42.64ms 264 + #define ADC_ALC_HLDTIME_0008538_US 0x06 //time = 85.38ms 265 + #define ADC_ALC_HLDTIME_0017076_US 0x07 //time = 170.76ms 266 + #define ADC_ALC_HLDTIME_0034152_US 0x08 //time = 341.52ms 267 + #define ADC_ALC_HLDTIME_0680000_US 0x09 //time = 0.68s 268 + #define ADC_ALC_HLDTIME_1360000_US 0x0a //time = 1.36s 269 + 270 + #define ADC_ALC_DCYTIME_000410_US 0x00 //time = 410us 271 + #define ADC_ALC_DCYTIME_000820_US 0x01 //time = 820us 272 + #define ADC_ALC_DCYTIME_001640_US 0x02 //time = 1.64ms 273 + #define ADC_ALC_DCYTIME_003280_US 0x03 //time = 3.28ms 274 + #define ADC_ALC_DCYTIME_006560_US 0x04 //time = 6.56ms 275 + #define ADC_ALC_DCYTIME_013120_US 0x05 //time = 13.12ms 276 + #define ADC_ALC_DCYTIME_026240_US 0x06 //time = 26.24ms 277 + #define ADC_ALC_DCYTIME_058480_US 0x07 //time = 52.48ms 278 + #define ADC_ALC_DCYTIME_104960_US 0x08 //time = 104.96ms 279 + #define ADC_ALC_DCYTIME_209920_US 0x09 //time = 209.92ms 280 + #define ADC_ALC_DCYTIME_420000_US 0x0a //time = 420ms 281 + 282 + #define ADC_ALC_ATKTIME_000104_US 0x00 //time = 104us 283 + #define ADC_ALC_ATKTIME_000208_US 0x01 //time = 208us 284 + #define ADC_ALC_ATKTIME_000416_US 0x02 //time = 416ms 285 + #define ADC_ALC_ATKTIME_003832_US 0x03 //time = 832ms 286 + #define ADC_ALC_ATKTIME_001664_US 0x04 //time = 1.664ms 287 + #define ADC_ALC_ATKTIME_003328_US 0x05 //time = 3.328ms 288 + #define ADC_ALC_ATKTIME_006656_US 0x06 //time = 6.656ms 289 + #define ADC_ALC_ATKTIME_013312_US 0x07 //time = 13.312ms 290 + #define ADC_ALC_ATKTIME_026624_US 0x08 //time = 26.624ms 291 + #define ADC_ALC_ATKTIME_053248_US 0x09 //time = 53.248ms 292 + #define ADC_ALC_ATKTIME_106496_US 0x0a //time = 106.496ms 293 + 294 + /* ALC Noise Gate */ 295 + #define ADC_ALC_NGTYPE_DISABLE 0x00 //noise gate disable 296 + #define ADC_ALC_NGTYPE_ENABLE_HOLD 0x01 //noise gate enable, hold gain type 297 + #define ADC_ALC_NGTYPE_ENABLE_MUTE 0x03 //noise gate enable, mute type 298 + 299 + #define ADC_ALC_NGTHLD_m76_5db 0x00 /* Threshold = -76.5db */ 300 + #define ADC_ALC_NGTHLD_m75db 0x01 /* Threshold = -75db */ 301 + #define ADC_ALC_NGTHLD_m73_5db 0x02 /* Threshold = -73.5db */ 302 + #define ADC_ALC_NGTHLD_m72db 0x03 /* Threshold = -72db */ 303 + #define ADC_ALC_NGTHLD_m70_5db 0x04 /* Threshold = -70.5db */ 304 + #define ADC_ALC_NGTHLD_m69db 0x05 /* Threshold = -69db */ 305 + #define ADC_ALC_NGTHLD_m67_5db 0x06 /* Threshold = -67.5db */ 306 + #define ADC_ALC_NGTHLD_m66db 0x07 /* Threshold = -66db */ 307 + #define ADC_ALC_NGTHLD_m64_5db 0x08 /* Threshold = -64.5db */ 308 + #define ADC_ALC_NGTHLD_m63db 0x09 /* Threshold = -63db */ 309 + #define ADC_ALC_NGTHLD_m61_5db 0x0a /* Threshold = -61.5db */ 310 + #define ADC_ALC_NGTHLD_m60db 0x0b /* Threshold = -60db */ 311 + #define ADC_ALC_NGTHLD_m58_5db 0x0c /* Threshold = -58.5db */ 312 + #define ADC_ALC_NGTHLD_m57db 0x0d /* Threshold = -57db */ 313 + #define ADC_ALC_NGTHLD_m55_5db 0x0e /* Threshold = -55.5db */ 314 + #define ADC_ALC_NGTHLD_m54db 0x0f /* Threshold = -54db */ 315 + #define ADC_ALC_NGTHLD_m52_5db 0x10 /* Threshold = -52.5db */ 316 + #define ADC_ALC_NGTHLD_m51db 0x11 /* Threshold = -51db */ 317 + #define ADC_ALC_NGTHLD_m49_5db 0x12 /* Threshold = -49.5db */ 318 + #define ADC_ALC_NGTHLD_m48db 0x13 /* Threshold = -48db */ 319 + #define ADC_ALC_NGTHLD_m46_5db 0x14 /* Threshold = -46.5db */ 320 + #define ADC_ALC_NGTHLD_m45db 0x15 /* Threshold = -45db */ 321 + #define ADC_ALC_NGTHLD_m43_5db 0x16 /* Threshold = -43.5db */ 322 + #define ADC_ALC_NGTHLD_m42db 0x17 /* Threshold = -42db */ 323 + #define ADC_ALC_NGTHLD_m40_5db 0x18 /* Threshold = -40.5db */ 324 + #define ADC_ALC_NGTHLD_m39db 0x19 /* Threshold = -39db */ 325 + #define ADC_ALC_NGTHLD_m37_5db 0x1a /* Threshold = -37.5db */ 326 + #define ADC_ALC_NGTHLD_m36db 0x1b /* Threshold = -36db */ 327 + #define ADC_ALC_NGTHLD_m34_5db 0x1c /* Threshold = -34.5db */ 328 + #define ADC_ALC_NGTHLD_m33db 0x1d /* Threshold = -33db */ 329 + #define ADC_ALC_NGTHLD_m31_5db 0x1e /* Threshold = -31.5db */ 330 + #define ADC_ALC_NGTHLD_m30db 0x1f /* Threshold = -30db */ 331 + 332 + /* Headphone dummy - Windows Specific flag, not needed for Linux */ 333 + 334 + /* HPMIX HIGAIN and VOLUME */ 335 + #define DAC_HPMIX_HIGAIN_0db 0x00 /* gain = 0db */ 336 + #define DAC_HPMIX_HIGAIN_m6db 0x88 /* gain = -6db */ 337 + 338 + #define DAC_HPMIX_VOLUME_m12db 0x00 /* volume = -12db */ 339 + #define DAC_HPMIX_VOLUME_m10_5db 0x11 /* volume = -10.5db */ 340 + #define DAC_HPMIX_VOLUME_m9db 0x22 /* volume = -9db */ 341 + #define DAC_HPMIX_VOLUME_m7_5db 0x33 /* volume = -7.5db */ 342 + #define DAC_HPMIX_VOLUME_m6db 0x44 /* volume = -6db */ 343 + #define DAC_HPMIX_VOLUME_m4_5db 0x88 /* volume = -4.5db */ 344 + #define DAC_HPMIX_VOLUME_m3db 0x99 /* volume = -3db */ 345 + #define DAC_HPMIX_VOLUME_m1_5db 0xaa /* volume = -1.5db */ 346 + #define DAC_HPMIX_VOLUME_0db 0xbb /* volume = 0db */ 347 + 348 + /* HPOUT VOLUME */ 349 + #define DAC_HPOUT_VOLUME_0db 0x00 /* volume = 0db */ 350 + #define DAC_HPOUT_VOLUME_m12db 0x11 /* volume = -12db */ 351 + #define DAC_HPOUT_VOLUME_m24db 0x22 /* volume = -24db */ 352 + #define DAC_HPOUT_VOLUME_m48db 0x33 /* volume = -48db */ 353 + 354 + /* LDAC/RDAC volume = 0db, -0.5db/setp, 0xc0 <-> -96db */ 355 + 356 + /* Automute */ 357 + #define DAC_AUTOMUTE_NONE 0x00 /* no automute */ 358 + #define DAC_AUTOMUTE_DIGITAL 0x01 /* digital mute */ 359 + #define DAC_AUTOMUTE_ANALOG 0x02 /* analog mute */ 360 + 361 + /* Mono - Windows specific, on Linux the information comes from DAI/topology */ 362 + #define HEADPHONE_MONO 0x01 /* on channel */ 363 + #define HEADPHONE_STEREO 0x00 /* stereo */ 364 + 365 + /* Speaker and headphone GPIO control */ 366 + #define GPIO_CTL_IO_LEVEL_LOW 0x00 /* low level enable */ 367 + #define GPIO_CTL_IO_LEVEL_HIGH 0x01 /* high level enable */ 368 + 369 + /* GPIO */ 370 + /* FIXME: for ES8396, no need to use */ 371 + 372 + /* Platform clocks */ 373 + /* 374 + * BCLK AND MCLK FREQ 375 + * BIT[7:4] MCLK FREQ 376 + * 0 - 19.2MHz 377 + * 1 - 24MHz 378 + * 2 - 12.288MHz 379 + * F - Default for 19.2MHz 380 + * 381 + * BIT[3:0] BCLK FREQ 382 + * 0 - 4.8MHz 383 + * 1 - 2.4MHz 384 + * 2 - 2.304MHz 385 + * 3 - 3.072MHz 386 + * 4 - 4.096MHz 387 + * F - Default for 4.8MHz 388 + */ 389 + 390 + int es83xx_dsm(struct device *dev, int arg, int *value); 391 + int es83xx_dsm_dump(struct device *dev); 392 + 393 + #endif