.. | .. |
---|
139 | 139 | static int mt6797_memif_fs(struct snd_pcm_substream *substream, |
---|
140 | 140 | unsigned int rate) |
---|
141 | 141 | { |
---|
142 | | - struct snd_soc_pcm_runtime *rtd = substream->private_data; |
---|
| 142 | + struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); |
---|
143 | 143 | struct snd_soc_component *component = |
---|
144 | 144 | snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME); |
---|
145 | 145 | 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; |
---|
147 | 147 | |
---|
148 | 148 | return mt6797_rate_transform(afe->dev, rate, id); |
---|
149 | 149 | } |
---|
150 | 150 | |
---|
151 | 151 | static int mt6797_irq_fs(struct snd_pcm_substream *substream, unsigned int rate) |
---|
152 | 152 | { |
---|
153 | | - struct snd_soc_pcm_runtime *rtd = substream->private_data; |
---|
| 153 | + struct snd_soc_pcm_runtime *rtd = asoc_substream_to_rtd(substream); |
---|
154 | 154 | struct snd_soc_component *component = |
---|
155 | 155 | snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME); |
---|
156 | 156 | struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component); |
---|
.. | .. |
---|
401 | 401 | .hd_reg = AFE_MEMIF_HD_MODE, |
---|
402 | 402 | .hd_shift = DL1_HD_SFT, |
---|
403 | 403 | .agent_disable_reg = -1, |
---|
404 | | - .agent_disable_shift = -1, |
---|
405 | 404 | .msb_reg = -1, |
---|
406 | | - .msb_shift = -1, |
---|
407 | 405 | }, |
---|
408 | 406 | [MT6797_MEMIF_DL2] = { |
---|
409 | 407 | .name = "DL2", |
---|
.. | .. |
---|
420 | 418 | .hd_reg = AFE_MEMIF_HD_MODE, |
---|
421 | 419 | .hd_shift = DL2_HD_SFT, |
---|
422 | 420 | .agent_disable_reg = -1, |
---|
423 | | - .agent_disable_shift = -1, |
---|
424 | 421 | .msb_reg = -1, |
---|
425 | | - .msb_shift = -1, |
---|
426 | 422 | }, |
---|
427 | 423 | [MT6797_MEMIF_DL3] = { |
---|
428 | 424 | .name = "DL3", |
---|
.. | .. |
---|
439 | 435 | .hd_reg = AFE_MEMIF_HD_MODE, |
---|
440 | 436 | .hd_shift = DL3_HD_SFT, |
---|
441 | 437 | .agent_disable_reg = -1, |
---|
442 | | - .agent_disable_shift = -1, |
---|
443 | 438 | .msb_reg = -1, |
---|
444 | | - .msb_shift = -1, |
---|
445 | 439 | }, |
---|
446 | 440 | [MT6797_MEMIF_VUL] = { |
---|
447 | 441 | .name = "VUL", |
---|
.. | .. |
---|
458 | 452 | .hd_reg = AFE_MEMIF_HD_MODE, |
---|
459 | 453 | .hd_shift = VUL_HD_SFT, |
---|
460 | 454 | .agent_disable_reg = -1, |
---|
461 | | - .agent_disable_shift = -1, |
---|
462 | 455 | .msb_reg = -1, |
---|
463 | | - .msb_shift = -1, |
---|
464 | 456 | }, |
---|
465 | 457 | [MT6797_MEMIF_AWB] = { |
---|
466 | 458 | .name = "AWB", |
---|
.. | .. |
---|
477 | 469 | .hd_reg = AFE_MEMIF_HD_MODE, |
---|
478 | 470 | .hd_shift = AWB_HD_SFT, |
---|
479 | 471 | .agent_disable_reg = -1, |
---|
480 | | - .agent_disable_shift = -1, |
---|
481 | 472 | .msb_reg = -1, |
---|
482 | | - .msb_shift = -1, |
---|
483 | 473 | }, |
---|
484 | 474 | [MT6797_MEMIF_VUL12] = { |
---|
485 | 475 | .name = "VUL12", |
---|
.. | .. |
---|
496 | 486 | .hd_reg = AFE_MEMIF_HD_MODE, |
---|
497 | 487 | .hd_shift = VUL_DATA2_HD_SFT, |
---|
498 | 488 | .agent_disable_reg = -1, |
---|
499 | | - .agent_disable_shift = -1, |
---|
500 | 489 | .msb_reg = -1, |
---|
501 | | - .msb_shift = -1, |
---|
502 | 490 | }, |
---|
503 | 491 | [MT6797_MEMIF_DAI] = { |
---|
504 | 492 | .name = "DAI", |
---|
.. | .. |
---|
515 | 503 | .hd_reg = AFE_MEMIF_HD_MODE, |
---|
516 | 504 | .hd_shift = DAI_HD_SFT, |
---|
517 | 505 | .agent_disable_reg = -1, |
---|
518 | | - .agent_disable_shift = -1, |
---|
519 | 506 | .msb_reg = -1, |
---|
520 | | - .msb_shift = -1, |
---|
521 | 507 | }, |
---|
522 | 508 | [MT6797_MEMIF_MOD_DAI] = { |
---|
523 | 509 | .name = "MOD_DAI", |
---|
.. | .. |
---|
534 | 520 | .hd_reg = AFE_MEMIF_HD_MODE, |
---|
535 | 521 | .hd_shift = MOD_DAI_HD_SFT, |
---|
536 | 522 | .agent_disable_reg = -1, |
---|
537 | | - .agent_disable_shift = -1, |
---|
538 | 523 | .msb_reg = -1, |
---|
539 | | - .msb_shift = -1, |
---|
540 | 524 | }, |
---|
541 | 525 | }; |
---|
542 | 526 | |
---|
.. | .. |
---|
726 | 710 | } |
---|
727 | 711 | |
---|
728 | 712 | 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, |
---|
734 | 717 | }; |
---|
735 | 718 | |
---|
736 | 719 | static int mt6797_dai_memif_register(struct mtk_base_afe *afe) |
---|
.. | .. |
---|
765 | 748 | { |
---|
766 | 749 | struct mtk_base_afe *afe; |
---|
767 | 750 | struct mt6797_afe_private *afe_priv; |
---|
768 | | - struct resource *res; |
---|
769 | 751 | struct device *dev; |
---|
770 | 752 | int i, irq_id, ret; |
---|
771 | 753 | |
---|
.. | .. |
---|
790 | 772 | } |
---|
791 | 773 | |
---|
792 | 774 | /* 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); |
---|
796 | 776 | if (IS_ERR(afe->base_addr)) |
---|
797 | 777 | return PTR_ERR(afe->base_addr); |
---|
798 | 778 | |
---|
.. | .. |
---|
827 | 807 | |
---|
828 | 808 | /* request irq */ |
---|
829 | 809 | 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 | + |
---|
834 | 813 | ret = devm_request_irq(dev, irq_id, mt6797_afe_irq_handler, |
---|
835 | 814 | IRQF_TRIGGER_NONE, "asys-isr", (void *)afe); |
---|
836 | 815 | if (ret) { |
---|