forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-31 f70575805708cabdedea7498aaa3f710fde4d920
kernel/sound/soc/mediatek/mt6797/mt6797-afe-pcm.c
....@@ -139,18 +139,18 @@
139139 static int mt6797_memif_fs(struct snd_pcm_substream *substream,
140140 unsigned int rate)
141141 {
142
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
142
+ struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
143143 struct snd_soc_component *component =
144144 snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME);
145145 struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component);
146
- int id = rtd->cpu_dai->id;
146
+ int id = asoc_rtd_to_cpu(rtd, 0)->id;
147147
148148 return mt6797_rate_transform(afe->dev, rate, id);
149149 }
150150
151151 static int mt6797_irq_fs(struct snd_pcm_substream *substream, unsigned int rate)
152152 {
153
- struct snd_soc_pcm_runtime *rtd = substream->private_data;
153
+ struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream);
154154 struct snd_soc_component *component =
155155 snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME);
156156 struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component);
....@@ -401,9 +401,7 @@
401401 .hd_reg = AFE_MEMIF_HD_MODE,
402402 .hd_shift = DL1_HD_SFT,
403403 .agent_disable_reg = -1,
404
- .agent_disable_shift = -1,
405404 .msb_reg = -1,
406
- .msb_shift = -1,
407405 },
408406 [MT6797_MEMIF_DL2] = {
409407 .name = "DL2",
....@@ -420,9 +418,7 @@
420418 .hd_reg = AFE_MEMIF_HD_MODE,
421419 .hd_shift = DL2_HD_SFT,
422420 .agent_disable_reg = -1,
423
- .agent_disable_shift = -1,
424421 .msb_reg = -1,
425
- .msb_shift = -1,
426422 },
427423 [MT6797_MEMIF_DL3] = {
428424 .name = "DL3",
....@@ -439,9 +435,7 @@
439435 .hd_reg = AFE_MEMIF_HD_MODE,
440436 .hd_shift = DL3_HD_SFT,
441437 .agent_disable_reg = -1,
442
- .agent_disable_shift = -1,
443438 .msb_reg = -1,
444
- .msb_shift = -1,
445439 },
446440 [MT6797_MEMIF_VUL] = {
447441 .name = "VUL",
....@@ -458,9 +452,7 @@
458452 .hd_reg = AFE_MEMIF_HD_MODE,
459453 .hd_shift = VUL_HD_SFT,
460454 .agent_disable_reg = -1,
461
- .agent_disable_shift = -1,
462455 .msb_reg = -1,
463
- .msb_shift = -1,
464456 },
465457 [MT6797_MEMIF_AWB] = {
466458 .name = "AWB",
....@@ -477,9 +469,7 @@
477469 .hd_reg = AFE_MEMIF_HD_MODE,
478470 .hd_shift = AWB_HD_SFT,
479471 .agent_disable_reg = -1,
480
- .agent_disable_shift = -1,
481472 .msb_reg = -1,
482
- .msb_shift = -1,
483473 },
484474 [MT6797_MEMIF_VUL12] = {
485475 .name = "VUL12",
....@@ -496,9 +486,7 @@
496486 .hd_reg = AFE_MEMIF_HD_MODE,
497487 .hd_shift = VUL_DATA2_HD_SFT,
498488 .agent_disable_reg = -1,
499
- .agent_disable_shift = -1,
500489 .msb_reg = -1,
501
- .msb_shift = -1,
502490 },
503491 [MT6797_MEMIF_DAI] = {
504492 .name = "DAI",
....@@ -515,9 +503,7 @@
515503 .hd_reg = AFE_MEMIF_HD_MODE,
516504 .hd_shift = DAI_HD_SFT,
517505 .agent_disable_reg = -1,
518
- .agent_disable_shift = -1,
519506 .msb_reg = -1,
520
- .msb_shift = -1,
521507 },
522508 [MT6797_MEMIF_MOD_DAI] = {
523509 .name = "MOD_DAI",
....@@ -534,9 +520,7 @@
534520 .hd_reg = AFE_MEMIF_HD_MODE,
535521 .hd_shift = MOD_DAI_HD_SFT,
536522 .agent_disable_reg = -1,
537
- .agent_disable_shift = -1,
538523 .msb_reg = -1,
539
- .msb_shift = -1,
540524 },
541525 };
542526
....@@ -726,11 +710,10 @@
726710 }
727711
728712 static const struct snd_soc_component_driver mt6797_afe_component = {
729
- .name = AFE_PCM_NAME,
730
- .ops = &mtk_afe_pcm_ops,
731
- .pcm_new = mtk_afe_pcm_new,
732
- .pcm_free = mtk_afe_pcm_free,
733
- .probe = mt6797_afe_component_probe,
713
+ .name = AFE_PCM_NAME,
714
+ .probe = mt6797_afe_component_probe,
715
+ .pointer = mtk_afe_pcm_pointer,
716
+ .pcm_construct = mtk_afe_pcm_new,
734717 };
735718
736719 static int mt6797_dai_memif_register(struct mtk_base_afe *afe)
....@@ -765,7 +748,6 @@
765748 {
766749 struct mtk_base_afe *afe;
767750 struct mt6797_afe_private *afe_priv;
768
- struct resource *res;
769751 struct device *dev;
770752 int i, irq_id, ret;
771753
....@@ -790,9 +772,7 @@
790772 }
791773
792774 /* regmap init */
793
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
794
-
795
- afe->base_addr = devm_ioremap_resource(&pdev->dev, res);
775
+ afe->base_addr = devm_platform_ioremap_resource(pdev, 0);
796776 if (IS_ERR(afe->base_addr))
797777 return PTR_ERR(afe->base_addr);
798778
....@@ -827,10 +807,9 @@
827807
828808 /* request irq */
829809 irq_id = platform_get_irq(pdev, 0);
830
- if (!irq_id) {
831
- dev_err(dev, "%s no irq found\n", dev->of_node->name);
832
- return -ENXIO;
833
- }
810
+ if (irq_id < 0)
811
+ return irq_id;
812
+
834813 ret = devm_request_irq(dev, irq_id, mt6797_afe_irq_handler,
835814 IRQF_TRIGGER_NONE, "asys-isr", (void *)afe);
836815 if (ret) {