hc
2023-12-11 6778948f9de86c3cfaf36725a7c87dcff9ba247f
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,
....@@ -1230,9 +1238,9 @@
12301238 rk817->chip_ver = (chip_ver & 0x0f);
12311239 dev_info(component->dev, "%s: chip_name:0x%x, chip_ver:0x%x\n", __func__, chip_name, chip_ver);
12321240
1241
+ /* always enable mclk, and will disable mclk in rk817_remove */
12331242 clk_prepare_enable(rk817->mclk);
12341243 rk817_reset(component);
1235
- clk_disable_unprepare(rk817->mclk);
12361244 mutex_init(&rk817->clk_lock);
12371245 rk817->clk_capture = 0;
12381246 rk817->clk_playback = 0;
....@@ -1257,6 +1265,7 @@
12571265 rk817_codec_power_down(component, RK817_CODEC_ALL);
12581266 snd_soc_component_exit_regmap(component);
12591267 mutex_destroy(&rk817->clk_lock);
1268
+ clk_disable_unprepare(rk817->mclk);
12601269 mdelay(10);
12611270
12621271 }