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

ASoC: rt1308-sdw: update the preset settings

This patch updates the pad control and checks the
hardware version to set the different preset settings.

Signed-off-by: Shuming Fan <shumingf@realtek.com>
Link: https://lore.kernel.org/r/20221019095731.31101-1-shumingf@realtek.com
Signed-off-by: Mark Brown <broonie@kernel.org>

authored by

Shuming Fan and committed by
Mark Brown
00aaf8bf af6514f2

+20 -3
+14 -3
sound/soc/codecs/rt1308-sdw.c
··· 50 50 case 0x3008: 51 51 case 0x300a: 52 52 case 0xc000: 53 + case 0xc710: 53 54 case 0xc860 ... 0xc863: 54 55 case 0xc870 ... 0xc873: 55 56 return true; ··· 201 200 { 202 201 struct rt1308_sdw_priv *rt1308 = dev_get_drvdata(dev); 203 202 int ret = 0; 203 + unsigned int tmp; 204 204 205 205 if (rt1308->hw_init) 206 206 return 0; ··· 233 231 /* sw reset */ 234 232 regmap_write(rt1308->regmap, RT1308_SDW_RESET, 0); 235 233 234 + regmap_read(rt1308->regmap, 0xc710, &tmp); 235 + rt1308->hw_ver = tmp; 236 + dev_dbg(dev, "%s, hw_ver=0x%x\n", __func__, rt1308->hw_ver); 237 + 236 238 /* initial settings */ 237 239 regmap_write(rt1308->regmap, 0xc103, 0xc0); 238 240 regmap_write(rt1308->regmap, 0xc030, 0x17); ··· 252 246 regmap_write(rt1308->regmap, 0xc062, 0x05); 253 247 regmap_write(rt1308->regmap, 0xc171, 0x07); 254 248 regmap_write(rt1308->regmap, 0xc173, 0x0d); 255 - regmap_write(rt1308->regmap, 0xc311, 0x7f); 256 - regmap_write(rt1308->regmap, 0xc900, 0x90); 249 + if (rt1308->hw_ver == RT1308_VER_C) { 250 + regmap_write(rt1308->regmap, 0xc311, 0x7f); 251 + regmap_write(rt1308->regmap, 0xc300, 0x09); 252 + } else { 253 + regmap_write(rt1308->regmap, 0xc311, 0x4f); 254 + regmap_write(rt1308->regmap, 0xc300, 0x0b); 255 + } 256 + regmap_write(rt1308->regmap, 0xc900, 0x5a); 257 257 regmap_write(rt1308->regmap, 0xc1a0, 0x84); 258 258 regmap_write(rt1308->regmap, 0xc1a1, 0x01); 259 259 regmap_write(rt1308->regmap, 0xc360, 0x78); ··· 269 257 regmap_write(rt1308->regmap, 0xc070, 0x00); 270 258 regmap_write(rt1308->regmap, 0xc100, 0xd7); 271 259 regmap_write(rt1308->regmap, 0xc101, 0xd7); 272 - regmap_write(rt1308->regmap, 0xc300, 0x09); 273 260 274 261 if (rt1308->first_hw_init) { 275 262 regcache_cache_bypass(rt1308->regmap, false);
+1
sound/soc/codecs/rt1308-sdw.h
··· 163 163 bool first_hw_init; 164 164 int rx_mask; 165 165 int slots; 166 + int hw_ver; 166 167 }; 167 168 168 169 struct sdw_stream_data {
+5
sound/soc/codecs/rt1308.h
··· 286 286 RT1308_AIFS 287 287 }; 288 288 289 + enum rt1308_hw_ver { 290 + RT1308_VER_C = 2, 291 + RT1308_VER_D 292 + }; 293 + 289 294 #endif /* end of _RT1308_H_ */