Browse Source

Linux_SDK_V1.1.2

thead_admin 1 year ago
parent
commit
2ed30c5ba9
2 changed files with 19 additions and 12 deletions
  1. 14 8
      linux/subsys_driver/hantro_dec.c
  2. 5 4
      linux/subsys_driver/hantro_mmu.c

+ 14 - 8
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];

+ 5 - 4
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,