Skip to content

Commit 4d408ea

Browse files
wenliangwubroonie
authored andcommitted
ASoC: mediatek: mt8195: support reserved memory assignment
For security purpose, restrict the memory assess region of AFE memif. The specified memory region should be assigned from DTS. Signed-off-by: Trevor Wu <trevor.wu@mediatek.com> Link: https://lore.kernel.org/r/20211130053905.28470-2-trevor.wu@mediatek.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent 0695ad9 commit 4d408ea

1 file changed

Lines changed: 7 additions & 0 deletions

File tree

sound/soc/mediatek/mt8195/mt8195-afe-pcm.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
#include <linux/of.h>
1515
#include <linux/of_address.h>
1616
#include <linux/of_platform.h>
17+
#include <linux/of_reserved_mem.h>
1718
#include <linux/pm_runtime.h>
1819
#include "mt8195-afe-common.h"
1920
#include "mt8195-afe-clk.h"
@@ -3061,6 +3062,12 @@ static int mt8195_afe_pcm_dev_probe(struct platform_device *pdev)
30613062
int i, irq_id, ret;
30623063
struct snd_soc_component *component;
30633064

3065+
ret = of_reserved_mem_device_init(dev);
3066+
if (ret) {
3067+
dev_err(dev, "failed to assign memory region: %d\n", ret);
3068+
return ret;
3069+
}
3070+
30643071
ret = dma_set_mask_and_coherent(dev, DMA_BIT_MASK(33));
30653072
if (ret)
30663073
return ret;

0 commit comments

Comments
 (0)