Browse Source

Modify Venc module driver

soft_3rdpart/wave521/code/vdi/linux/driver/venc.c: Optimize the driver and avoid errors due to device tree changes.

Signed-off-by: Xingyu Wu <xingyu.wu@starfivetech.com>
xingyu.wu 2 years ago
parent
commit
b5cc0d5037
1 changed files with 14 additions and 0 deletions
  1. 14 0
      soft_3rdpart/wave521/code/vdi/linux/driver/venc.c

+ 14 - 0
soft_3rdpart/wave521/code/vdi/linux/driver/venc.c

@@ -25,6 +25,7 @@
 #include "venc-starfive.h"
 
 #include <linux/of_device.h>
+#include <linux/of_irq.h>
 
 #define starfive_flush_dcache(start, len) \
 	sifive_l2_flush64_range(start, len)
@@ -1288,6 +1289,19 @@ static int vpu_probe(struct platform_device *pdev)
 	}
 
 #ifdef VPU_SUPPORT_CLOCK_CONTROL	
+	vpu_dev->of_node = of_find_node_by_name(NULL, "vpu_enc");
+	if (!(vpu_dev->of_node))
+		printk("The node of vpu_enc is not found in device tree.\n");
+
+	err = of_address_to_resource(vpu_dev->of_node, 0, &venc_resource[0]);
+	if (err) {
+		printk(KERN_ERR "could not find venc register address\n");
+		goto ERROR_PROVE_DEVICE;
+	}
+
+	venc_resource[1].start = irq_of_parse_and_map(vpu_dev->of_node, 0);
+	venc_resource[1].end = venc_resource[1].start;
+	
 	err = platform_device_add_resources(pdev, venc_resource, 2);
 	if (err) {
 		printk(KERN_ERR "could not add venc resource\n");