12-14-2021, 06:01 AM
I've managed to install the driver.
But there are several things to consider and I'm not sure that resolved them correctly.
First, the shared memory pool required by the driver cedar_ve.ko is hardcoded to 80 Megabytes. We cannot spend so much RAM because there is about 128 onboard. So I've decreased hardcoded value to 16M and rebuilt the driver.
I've also updated the device tree that way:
...
Don't even ask about why I've done it that way, I know literally nothing about that device trees, I've just compiled several examples from Orange PI giving a heuristics about how little RAM we have
dmesg output:
....
and now I have
But... so what, how do we utilize this module to encode camera stream to video files then?
But there are several things to consider and I'm not sure that resolved them correctly.
First, the shared memory pool required by the driver cedar_ve.ko is hardcoded to 80 Megabytes. We cannot spend so much RAM because there is about 128 onboard. So I've decreased hardcoded value to 16M and rebuilt the driver.
Code:
#if !defined(USE_ION)
cedar_devp->ve_size = 16 * SZ_1M; // was 80
I've also updated the device tree that way:
Code:
reserved-memory {
#address-cells = <1>;
#size-cells = <1>;
ranges;
/* Address must be kept in the lower 256 MiBs of DRAM for VE. */
cma_pool: linux,cma {
compatible = "shared-dma-pool";
size = <0x2000000>;
alignment = <0x2000>;
/*alloc-ranges = <0x4a000000 0x6000000>;*/
reusable;
linux,cma-default;
};
};
...
Code:
syscon: system-control@1c00000 {
compatible = "allwinner,sun8i-v3s-system-control","allwinner,sun8i-h3-system-control","syscon";
reg = <0x01c00000 0x1000>;
#address-cells = <1>;
#size-cells = <1>;
ranges;
sram_c: sram@1d00000 {
compatible = "mmio-sram";
reg = <0x01d00000 0x80000>;
#address-cells = <1>;
#size-cells = <1>;
ranges = <0 0x01d00000 0x80000>;
ve_sram: sram-section@0 {
compatible = "allwinner,sun8i-h3-sram-c1",
"allwinner,sun4i-a10-sram-c1";
reg = <0x000000 0x80000>;
};
};
};
ve: video-engine@01c0e000 {
compatible = "allwinner,sunxi-cedar-ve";
reg = <0x01c0e000 0x1000>,
<0x01c00000 0x10>,
<0x01c20000 0x800>;
memory-region = <&cma_pool>;
syscon = <&syscon>;
clocks = <&ccu CLK_BUS_VE>, <&ccu CLK_VE>,
<&ccu CLK_DRAM_VE>;
clock-names = "ahb", "mod", "ram";
resets = <&ccu RST_BUS_VE>;
interrupts = <GIC_SPI 58 IRQ_TYPE_LEVEL_HIGH>;
allwinner,sram = <&ve_sram 1>;
};
Don't even ask about why I've done it that way, I know literally nothing about that device trees, I've just compiled several examples from Orange PI giving a heuristics about how little RAM we have
dmesg output:
Code:
[ 0.000000] Memory policy: Data cache writealloc
[ 0.000000] Reserved memory: created CMA memory pool at 0x45c00000, size 32 MiB
[ 0.000000] OF: reserved mem: initialized node linux,cma, compatible id shared-dma-pool
....
Code:
[ 8.063755] sunxi cedar version 0.1
[ 8.063952] [cedar]: install start!!!
[ 8.064021] cedar_ve: cedar-ve the get irq is 30
[ 8.064046] sunxi-cedar 1c0e000.video-engine: assigned reserved memory node linux,cma
[ 8.064345] [cedar]: Success claim SRAM
[ 8.070282] systemd[1]: Finished Load Kernel Module configfs.
[ 8.085820] [cedar]: memory allocated at address PA: 45D00000, VA: C5D00000
[ 8.085835] [cedar]: install end!!!
and now I have
Code:
root@pinecube:/dev# ls -l
total 0
crw-r--r-- 1 root root 10, 235 Dec 14 08:13 autofs
drwxr-xr-x 2 root root 380 Dec 14 08:13 block
crw-rw---- 1 root disk 10, 234 Dec 14 08:13 btrfs-control
drwxr-xr-x 3 root root 60 Jan 1 1970 bus
crw-rw---- 1 root video 150, 0 Dec 14 08:13 cedar_dev <----------
drwxr-xr-x 2 root root 2660 Dec 14 08:13 char
crw------- 1 root root 5, 1 Dec 14 08:14 console
crw------- 1 root root 10, 61 Dec 14 08:13 cpu_dma_latency
But... so what, how do we utilize this module to encode camera stream to video files then?