forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-11 072de836f53be56a70cecf70b43ae43b7ce17376
kernel/sound/soc/codecs/rk817_codec.c
....@@ -286,10 +286,10 @@
286286 {RK817_CODEC_AREF_RTCFG1, 0x40},
287287 {RK817_CODEC_DDAC_POPD_DACST, 0x02},
288288 /* APLL */
289
- {RK817_CODEC_APLL_CFG0, 0x04},
289
+ /* {RK817_CODEC_APLL_CFG0, 0x04}, */
290290 {RK817_CODEC_APLL_CFG1, 0x58},
291291 {RK817_CODEC_APLL_CFG2, 0x2d},
292
- {RK817_CODEC_APLL_CFG4, 0xa5},
292
+ /* {RK817_CODEC_APLL_CFG4, 0xa5}, */
293293 {RK817_CODEC_APLL_CFG5, 0x00},
294294
295295 {RK817_CODEC_DI2S_RXCMD_TSD, 0x00},
....@@ -324,10 +324,10 @@
324324 {RK817_CODEC_AREF_RTCFG1, 0x40},
325325 {RK817_CODEC_DADC_SR_ACL0, 0x02},
326326 /* {RK817_CODEC_DTOP_DIGEN_CLKE, 0xff}, */
327
- {RK817_CODEC_APLL_CFG0, 0x04},
327
+ /* {RK817_CODEC_APLL_CFG0, 0x04}, */
328328 {RK817_CODEC_APLL_CFG1, 0x58},
329329 {RK817_CODEC_APLL_CFG2, 0x2d},
330
- {RK817_CODEC_APLL_CFG4, 0xa5},
330
+ /* {RK817_CODEC_APLL_CFG4, 0xa5}, */
331331 {RK817_CODEC_APLL_CFG5, 0x00},
332332
333333 /*{RK817_CODEC_DI2S_RXCMD_TSD, 0x00},*/
....@@ -378,12 +378,16 @@
378378 playback_power_up_list[i].value);
379379 }
380380
381
- /* Re-configure APLL CFG0/4 if (chip_ver <= 0x4) */
381
+ /* configure APLL CFG0/4 */
382382 if (rk817->chip_ver <= 0x4) {
383383 DBG("%s (%d): SMIC TudorAG and previous versions\n",
384384 __func__, __LINE__);
385385 snd_soc_component_write(component, RK817_CODEC_APLL_CFG0, 0x0c);
386386 snd_soc_component_write(component, RK817_CODEC_APLL_CFG4, 0x95);
387
+ } else {
388
+ DBG("%s: SMIC TudorAG version later\n", __func__);
389
+ snd_soc_component_write(component, RK817_CODEC_APLL_CFG0, 0x04);
390
+ snd_soc_component_write(component, RK817_CODEC_APLL_CFG4, 0xa5);
387391 }
388392
389393 snd_soc_component_update_bits(component, RK817_CODEC_DTOP_DIGEN_CLKE,
....@@ -405,12 +409,16 @@
405409 capture_power_up_list[i].value);
406410 }
407411
408
- /* Re-configure APLL CFG0/4 if (chip_ver <= 0x4) */
412
+ /* configure APLL CFG0/4 */
409413 if (rk817->chip_ver <= 0x4) {
410414 DBG("%s (%d): SMIC TudorAG and previous versions\n",
411415 __func__, __LINE__);
412416 snd_soc_component_write(component, RK817_CODEC_APLL_CFG0, 0x0c);
413417 snd_soc_component_write(component, RK817_CODEC_APLL_CFG4, 0x95);
418
+ } else {
419
+ DBG("%s: SMIC TudorAG version later\n", __func__);
420
+ snd_soc_component_write(component, RK817_CODEC_APLL_CFG0, 0x04);
421
+ snd_soc_component_write(component, RK817_CODEC_APLL_CFG4, 0xa5);
414422 }
415423
416424 snd_soc_component_update_bits(component, RK817_CODEC_DTOP_DIGEN_CLKE,
....@@ -1026,7 +1034,7 @@
10261034 return 0;
10271035 }
10281036
1029
-static int rk817_digital_mute(struct snd_soc_dai *dai, int mute)
1037
+static int rk817_digital_mute(struct snd_soc_dai *dai, int mute, int stream)
10301038 {
10311039 struct snd_soc_component *component = dai->component;
10321040 struct rk817_codec_priv *rk817 = snd_soc_component_get_drvdata(component);
....@@ -1140,8 +1148,9 @@
11401148 .hw_params = rk817_hw_params,
11411149 .set_fmt = rk817_set_dai_fmt,
11421150 .set_sysclk = rk817_set_dai_sysclk,
1143
- .digital_mute = rk817_digital_mute,
1151
+ .mute_stream = rk817_digital_mute,
11441152 .shutdown = rk817_codec_shutdown,
1153
+ .no_capture_mute = 1,
11451154 };
11461155
11471156 static struct snd_soc_dai_driver rk817_dai[] = {
....@@ -1224,14 +1233,14 @@
12241233 rk817->playback_path = OFF;
12251234 rk817->capture_path = MIC_OFF;
12261235
1227
- chip_name = snd_soc_component_read32(component, RK817_PMIC_CHIP_NAME);
1228
- chip_ver = snd_soc_component_read32(component, RK817_PMIC_CHIP_VER);
1236
+ chip_name = snd_soc_component_read(component, RK817_PMIC_CHIP_NAME);
1237
+ chip_ver = snd_soc_component_read(component, RK817_PMIC_CHIP_VER);
12291238 rk817->chip_ver = (chip_ver & 0x0f);
12301239 dev_info(component->dev, "%s: chip_name:0x%x, chip_ver:0x%x\n", __func__, chip_name, chip_ver);
12311240
1241
+ /* always enable mclk, and will disable mclk in rk817_remove */
12321242 clk_prepare_enable(rk817->mclk);
12331243 rk817_reset(component);
1234
- clk_disable_unprepare(rk817->mclk);
12351244 mutex_init(&rk817->clk_lock);
12361245 rk817->clk_capture = 0;
12371246 rk817->clk_playback = 0;
....@@ -1256,6 +1265,7 @@
12561265 rk817_codec_power_down(component, RK817_CODEC_ALL);
12571266 snd_soc_component_exit_regmap(component);
12581267 mutex_destroy(&rk817->clk_lock);
1268
+ clk_disable_unprepare(rk817->mclk);
12591269 mdelay(10);
12601270
12611271 }