aboutsummaryrefslogtreecommitdiff
path: root/drivers/staging/media/sunxi/cedar/README.md
blob: de0a1e3470a5cf6c8ae937598ab151ae20782b54 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
# Allwinner CedarX Driver for Mainline Linux 5.4
### VideoEngine driver based on Allwinner H6 Homlet BSP
### Ion driver based on Google Android Ion

## Install

### Put all file in "drivers/staging/media/sunxi/cedar"

### Add source to "drivers/staging/media/sunxi/Kconfig"
```
source "drivers/staging/media/sunxi/cedar/Kconfig"
```
Demo
```
# SPDX-License-Identifier: GPL-2.0
config VIDEO_SUNXI
    bool "Allwinner sunXi family Video Devices"
    depends on ARCH_SUNXI || COMPILE_TEST
    help
      If you have an Allwinner SoC based on the sunXi family, say Y.

      Note that this option doesn't include new drivers in the
      kernel: saying N will just cause Kconfig to skip all the
      questions about Allwinner media devices.

if VIDEO_SUNXI

source "drivers/staging/media/sunxi/cedrus/Kconfig"
source "drivers/staging/media/sunxi/cedar/Kconfig"

endif
```

### Add obj to "drivers/staging/media/sunxi/Makefile"
```
obj-y += cedar/
```
Demo
```
# SPDX-License-Identifier: GPL-2.0
obj-$(CONFIG_VIDEO_SUNXI_CEDRUS)        += cedrus/
obj-y += cedar/
```

## DeviceTree
### Demo for Allwinner V3 / V3s / S3L / S3
```
syscon: syscon@1c00000 {
    compatible = "allwinner,sun8i-v3s-system-controller", "allwinner,sun8i-h3-system-control", "syscon";
    reg = <0x01c00000 0xd0>;
    #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-v3s-sram-c", "allwinner,sun4i-a10-sram-c1";
            reg = <0x000000 0x80000>;
        };
    };
};

cedarx: video-codec@1c0e000 {
    compatible = "allwinner,sun8i-v3-cedar";
    reg = <0x01c0e000 0x1000>;
    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>;
    status = "disabled";
};
        
ion: ion {
    compatible = "allwinner,sunxi-ion";
    status = "disabled";
    heap_cma@0{
        compatible = "allwinner,cma";
        heap-name  = "cma";
        heap-id    = <0x4>;
        heap-base  = <0x0>;
        heap-size  = <0x0>;
        heap-type  = "ion_cma";
    };
};
```
### Demo for Allwinner F1C100s / F1C200s

In drivers/clk/sunxi-ng/ccu-suniv-f1c100s.c

Change

    static SUNXI_CCU_GATE(ve_clk, "ve", "pll-audio", 0x13c, BIT(31), 0);

To

    static SUNXI_CCU_GATE(ve_clk, "ve", "pll-ve", 0x13c, BIT(31), 0);

```
sram-controller@1c00000 {
    compatible = "allwinner,suniv-f1c100s-system-control",
             "allwinner,sun4i-a10-system-control";
    reg = <0x01c00000 0x30>;
    #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,suniv-f1c100s-sram-c", "allwinner,sun4i-a10-sram-c1";
            reg = <0x000000 0x80000>;
        };
    };
};

cedarx: video-codec@1c0e000 {
    compatible = "allwinner,suniv-f1c100s-cedar";
    reg = <0x01c0e000 0x1000>;
    clocks = <&ccu CLK_BUS_VE>, <&ccu CLK_VE>, <&ccu CLK_DRAM_VE>;
    clock-names = "ahb", "mod", "ram";
    resets = <&ccu RST_BUS_VE>;
    interrupts = <34>;
    allwinner,sram = <&ve_sram 1>;
    status = "disabled";
};

ion: ion {
    compatible = "allwinner,sunxi-ion";
    status = "disabled";
    heap_cma@0{
        compatible = "allwinner,cma";
        heap-name  = "cma";
        heap-id    = <0x4>;
        heap-base  = <0x0>;
        heap-size  = <0x0>;
        heap-type  = "ion_cma";
    };
};
```
## Compile
### Enable Driver in 
```
> Device Drivers > Staging drivers > Media staging drivers
[*]   Allwinner sunXi family Video Devices
<*>     Allwinner CedarX Video Engine Driver
<*>     Allwinner CedarX Ion Driver 
```
### Config "DMA Contiguous Memory Allocator"
```
> Library routines
-*- DMA Contiguous Memory Allocator
*** Default contiguous memory area size: ***
(32)  Size in Mega Bytes
Selected region size (Use mega bytes value only)  --->
```
... and here we go.

## Debug
### ION_IOC_ALLOC error / memory alloc fail
Increase
```
CMA_AREAS
CMA_SIZE_MBYTES
```
### Default
Report in issue.

## Userspace library
https://github.com/aodzip/libcedarc