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

Configure Feed

Select the types of activity you want to include in your feed.

ASoC: rt5682: Support the ALC5682I-VE codec

The ALC5682I-VD and ALC5682I-VE use the same I2C
codec driver with different calibration settings.
This patch aims to handle their differences.

Signed-off-by: Derek Fang <derek.fang@realtek.com>

Link: https://patch.msgid.link/20241225094307.3678837-1-derek.fang@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Derek Fang and committed by
Mark Brown
5d085b25 fffe003f

+18 -2
+6
sound/soc/codecs/rt5682-i2c.c
··· 186 186 return -ENODEV; 187 187 } 188 188 189 + regmap_read(rt5682->regmap, RT5682_INT_DEVICE_ID, &val); 190 + if (val == 0x6956) { 191 + dev_dbg(&i2c->dev, "ALC5682I-VE device\n"); 192 + rt5682->ve_ic = true; 193 + } 194 + 189 195 mutex_init(&rt5682->calibrate_mutex); 190 196 rt5682_calibrate(rt5682); 191 197
+10 -2
sound/soc/codecs/rt5682.c
··· 395 395 case RT5682_4BTN_IL_CMD_1: 396 396 case RT5682_AJD1_CTRL: 397 397 case RT5682_HP_CALIB_CTRL_1: 398 + case RT5682_INT_DEVICE_ID: 398 399 case RT5682_DEVICE_ID: 399 400 case RT5682_I2C_MODE: 400 401 case RT5682_HP_CALIB_CTRL_10: ··· 420 419 { 421 420 switch (reg) { 422 421 case RT5682_RESET: 422 + case RT5682_INT_DEVICE_ID: 423 423 case RT5682_VERSION_ID: 424 424 case RT5682_VENDOR_ID: 425 425 case RT5682_DEVICE_ID: ··· 3141 3139 regmap_write(rt5682->regmap, RT5682_PWR_DIG_1, 0x0100); 3142 3140 regmap_write(rt5682->regmap, RT5682_HP_IMP_SENS_CTRL_19, 0x3800); 3143 3141 regmap_write(rt5682->regmap, RT5682_CHOP_DAC, 0x3000); 3144 - regmap_write(rt5682->regmap, RT5682_CALIB_ADC_CTRL, 0x7005); 3142 + if (rt5682->ve_ic) 3143 + regmap_write(rt5682->regmap, RT5682_CHOP_ADC, 0x7005); 3144 + else 3145 + regmap_write(rt5682->regmap, RT5682_CALIB_ADC_CTRL, 0x7005); 3145 3146 regmap_write(rt5682->regmap, RT5682_STO1_ADC_MIXER, 0x686c); 3146 3147 regmap_write(rt5682->regmap, RT5682_CAL_REC, 0x0d0d); 3147 3148 regmap_write(rt5682->regmap, RT5682_HP_CALIB_CTRL_2, 0x0321); ··· 3173 3168 regmap_write(rt5682->regmap, RT5682_GLB_CLK, 0x0000); 3174 3169 regmap_write(rt5682->regmap, RT5682_PWR_DIG_1, 0x0000); 3175 3170 regmap_write(rt5682->regmap, RT5682_CHOP_DAC, 0x2000); 3176 - regmap_write(rt5682->regmap, RT5682_CALIB_ADC_CTRL, 0x2005); 3171 + if (rt5682->ve_ic) 3172 + regmap_write(rt5682->regmap, RT5682_CHOP_ADC, 0x2005); 3173 + else 3174 + regmap_write(rt5682->regmap, RT5682_CALIB_ADC_CTRL, 0x2005); 3177 3175 regmap_write(rt5682->regmap, RT5682_STO1_ADC_MIXER, 0xc0c4); 3178 3176 regmap_write(rt5682->regmap, RT5682_CAL_REC, 0x0c0c); 3179 3177
+2
sound/soc/codecs/rt5682.h
··· 22 22 23 23 /* Info */ 24 24 #define RT5682_RESET 0x0000 25 + #define RT5682_INT_DEVICE_ID 0x00f9 25 26 #define RT5682_VERSION_ID 0x00fd 26 27 #define RT5682_VENDOR_ID 0x00fe 27 28 #define RT5682_DEVICE_ID 0x00ff ··· 1447 1446 bool hw_init; 1448 1447 bool first_hw_init; 1449 1448 bool is_sdw; 1449 + bool ve_ic; 1450 1450 1451 1451 #ifdef CONFIG_COMMON_CLK 1452 1452 struct clk_hw dai_clks_hw[RT5682_DAI_NUM_CLKS];