From 2ed30c5ba9664827271ee2fff94bd368221af562 Mon Sep 17 00:00:00 2001 From: thead_admin Date: Sun, 5 Mar 2023 22:29:47 +0800 Subject: [PATCH] Linux_SDK_V1.1.2 --- linux/subsys_driver/hantro_dec.c | 22 ++++++++++++++-------- linux/subsys_driver/hantro_mmu.c | 9 +++++---- 2 files changed, 19 insertions(+), 12 deletions(-) diff --git a/linux/subsys_driver/hantro_dec.c b/linux/subsys_driver/hantro_dec.c index 664f86a..de52b4c 100644 --- a/linux/subsys_driver/hantro_dec.c +++ b/linux/subsys_driver/hantro_dec.c @@ -2496,14 +2496,20 @@ static int decoder_hantrodec_remove(struct platform_device *pdev) root_debugfs_dir = NULL; } pm_runtime_resume_and_get(&pdev->dev); - if(irq[0] > 0) - { - free_irq(irq[0],(void *) &hantrodec_data); - } - if(irq[1] > 0) - { - free_irq(irq[1],(void *) &hantrodec_data); - } + /* When vcmd is true, irq free in hantrovcmd_cleanup! + When vcmd is flase, it is not need because in line 2528 freed */ + #if 0 + if(!vcmd){ + if(irq[0] > 0) + { + free_irq(irq[0],(void *) &hantrodec_data); + } + if(irq[1] > 0) + { + free_irq(irq[1],(void *) &hantrodec_data); + } + } + #endif hantrodec_t *dev = &hantrodec_data; int i, n =0; volatile u8* mmu_hwregs[MAX_SUBSYS_NUM][2]; diff --git a/linux/subsys_driver/hantro_mmu.c b/linux/subsys_driver/hantro_mmu.c index 0ea338f..bef8968 100644 --- a/linux/subsys_driver/hantro_mmu.c +++ b/linux/subsys_driver/hantro_mmu.c @@ -1188,11 +1188,12 @@ enum MMUStatus MMUCleanup(volatile unsigned char *hwregs[MAX_SUBSYS_NUM][2]) { if (g_mmu->page_table_array) iounmap(g_mmu->page_table_array); } else { - if (g_mmu->stlb_virtual) - dma_free_coherent(&platformdev->dev, g_mmu->stlb_size, - g_mmu->stlb_virtual, (dma_addr_t)g_mmu->stlb_physical); + /* stlb_virtual is same alloc on alloc mtlb_virtual in func MMUEnable() + * so, should not free g_mmu->stlb_virtual.But free handle g_mmu->mtlb_physical + * size should be ( g_mmu->mtlb_size+g_mmu->stlb_size) + */ if (g_mmu->mtlb_virtual) - dma_free_coherent(&platformdev->dev, g_mmu->mtlb_size, + dma_free_coherent(&platformdev->dev, g_mmu->mtlb_size+g_mmu->stlb_size, g_mmu->mtlb_virtual, (dma_addr_t)g_mmu->mtlb_physical); if (g_mmu->page_table_array) dma_free_coherent(&platformdev->dev, g_mmu->page_table_array_size,