ASoC: mt8188: add memory-region support
Subsystems (4)
cover ASoC: mt8188: add memory-region support
This series introduces support for memory-region, allowing afe memif to utilize the region specified in dts.
Trevor Wu (2):
ASoC: mediatek: mt8188: add memory-region support
ASoC: dt-bindings: mediatek,mt8188-afe: add memory-region
.../devicetree/bindings/sound/mediatek,mt8188-afe.yaml | 7 +++++++ sound/soc/mediatek/mt8188/mt8188-afe-pcm.c | 8 ++++++-- 2 files changed, 13 insertions(+), 2 deletions(-)
Signature · 1 line
2.18.0
PATCH RESEND 1/2 ASoC: mediatek: mt8188: add memory-region support
In certain projects, it is necessary to utilize the reserved memory region for audio dma. The patch takes into account the dts property 'memory-region', allowing for the specification of memory for afe memif through device tree.
--- sound/soc/mediatek/mt8188/mt8188-afe-pcm.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
sound/soc/mediatek/mt8188/mt8188-afe-pcm.c +6 -2
@@ -16,6 +16,7 @@#include <linux/of.h> #include <linux/of_address.h> #include <linux/of_platform.h> +#include <linux/of_reserved_mem.h> #include <linux/pm_runtime.h> #include <linux/soc/mediatek/infracfg.h> #include <linux/reset.h>
@@ -3193,11 +3194,15 @@ static int mt8188_afe_pcm_dev_probe(struct platform_device *pdev) {struct mtk_base_afe *afe;struct mt8188_afe_private *afe_priv; -struct device *dev; +struct device *dev = &pdev->dev;struct reset_control *rstc;struct regmap *infra_ao;int i, irq_id, ret; + ret =of_reserved_mem_device_init (dev); +if (ret) +dev_dbg (dev,"failed to assign memory region: %d\n" , ret); + ret =dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (33 ));if (ret)return ret;
@@ -3213,7 +3218,6 @@ static int mt8188_afe_pcm_dev_probe(struct platform_device *pdev) afe_priv = afe->platform_priv; afe->dev = &pdev->dev; - dev = afe->dev; afe->base_addr =devm_platform_ioremap_resource (pdev,0 );if (IS_ERR (afe->base_addr))
Signature · 1 line
2.18.0
Re: [RESEND 1/2] ASoC: mediatek: mt8188: add memory-region support
Quoted 23 lines · Trevor Wu
In certain projects, it is necessary to utilize the reserved memory region for audio dma. The patch takes into account the dts property 'memory-region', allowing for the specification of memory for afe memif through device tree.
Signed-off-by Trevor Wu <[email protected]>--- sound/soc/mediatek/mt8188/mt8188-afe-pcm.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)sound/soc/mediatek/mt8188/mt8188-afe-pcm.c +1
-0@@ -16,6 +16,7 @@#include <linux/of.h> #include <linux/of_address.h> #include <linux/of_platform.h> +#include <linux/of_reserved_mem.h> #include <linux/pm_runtime.h> #include <linux/soc/mediatek/infracfg.h> #include <linux/reset.h>
sound/soc/mediatek/mt8188/mt8188-afe-pcm.c static int mt8188_afe_pcm_dev_probe(struct platform_device *pdev) · line 3197
Quoted 5 lines
sound/soc/mediatek/mt8188/mt8188-afe-pcm.c +1
-1@@ -3193,11 +3194,15 @@ static int mt8188_afe_pcm_dev_probe(struct platform_device *pdev) {struct mtk_base_afe *afe;struct mt8188_afe_private *afe_priv; -struct device *dev; +struct device *dev = &pdev->dev;
I think that make sense to replace all "&pdev->dev" by "dev" in the next called functions:
- dma_set_mask_and_coherent
- devm_kzalloc
- devm_kzalloc
Quoted 19 lines
sound/soc/mediatek/mt8188/mt8188-afe-pcm.c +4
-1struct reset_control *rstc;struct regmap *infra_ao;int i, irq_id, ret; + ret =of_reserved_mem_device_init (dev); +if (ret) +dev_dbg (dev,"failed to assign memory region: %d\n" , ret); + ret =dma_set_mask_and_coherent (&pdev->dev,DMA_BIT_MASK (33 ));if (ret)return ret;@@ -3213,7 +3218,6 @@ static int mt8188_afe_pcm_dev_probe(struct platform_device *pdev) afe_priv = afe->platform_priv; afe->dev = &pdev->dev; - dev = afe->dev; afe->base_addr =devm_platform_ioremap_resource (pdev,0 );if (IS_ERR (afe->base_addr))
Signature · 2 lines
Regards, Alexandre
PATCH RESEND 2/2 ASoC: dt-bindings: mediatek,mt8188-afe: add memory-region
In reply to Trevor WuAdd memory-region property to utilize the reserved memory region.
--- .../devicetree/bindings/sound/mediatek,mt8188-afe.yaml | 7 +++++++ 1 file changed, 7 insertions(+)
Documentation/devicetree/bindings/sound/mediatek,mt8188-afe.yaml +7 -0
@@ -25,6 +25,12 @@ properties: reset-names: const: audiosys + memory-region: + maxItems: 1 + description: | + Shared memory region for AFE memif. A "shared-dma-pool". + See ../reserved-memory/reserved-memory.yaml for details. + mediatek,topckgen: $ref: /schemas/types.yaml#/definitions/phandle description: The phandle of the mediatek topckgen controller
@@ -176,6 +182,7 @@ examples: interrupts = <GIC_SPI 822 IRQ_TYPE_LEVEL_HIGH 0>; resets = <&watchdog 14>; reset-names = "audiosys"; + memory-region = <&snd_dma_mem_reserved>; mediatek,topckgen = <&topckgen>; mediatek,infracfg = <&infracfg_ao>; power-domains = <&spm 13>; //MT8188_POWER_DOMAIN_AUDIO
Signature · 1 line
2.18.0
Re: [RESEND 2/2] ASoC: dt-bindings: mediatek,mt8188-afe: add memory-region
Quoted 1 line · Trevor Wu
Add memory-region property to utilize the reserved memory region.
Signature · 2 lines
Regards, Alexandre