Jump to content

musicPi

Members
  • Posts

    13
  • Joined

  • Last visited

Reputation Activity

  1. Like
    musicPi got a reaction from Werner in sun4i-drm and LCD-Panels   
    Hello,
    I got I finally working. There are some changes to be done in the device tree to make sun4i-drm and lima work with LCD-Panels on BananaPi / BananaPro.
    Short version: create a panel in device tree and connect it to the correct driver.
    Here's what I did:
    1. Start compilation with
    ./compile.sh CREATE_PATCHES=yes BOARD=bananapipro INSTALL_HEADERS=yes 2. If asked to apply changes modify u-boot-config:
    nano /build/cache/sources/v2020.04/configs/Bananapro_defconfig add
    #5" RGB LCD CONFIG_VIDEO_LCD_MODE="x:800,y:480,depth:24,pclk_khz:30000,le:40,ri:40,up:29,lo:13,hs:48,vs:3,sync:3,vmode:0" CONFIG_VIDEO_LCD_POWER="PH12" CONFIG_VIDEO_LCD_BL_EN="PH8" CONFIG_VIDEO_LCD_BL_PWM="PB2" 3. modify sun7i-a20 device tree
    nano build/cache/sources/v2020.04/arch/arm/dts/sun7i-a20.dtsi add the tcon0_out_lcd section to tcon0:
    tcon0: lcd-controller@1c0c000 { //..... ports { //..... tcon0_out: port@1 { #address-cells = <1>; #size-cells = <0>; reg = <1>; tcon0_out_lcd: endpoint@0 { reg = <0>; remote-endpoint = <&lcd_in_tcon0>; }; tcon0_out_hdmi: endpoint@1 { reg = <1>; remote-endpoint = <&hdmi_in_tcon0>; }; }; }; }; I don't know if it works for tcon1 too but feel free to try. Then add the same lines to tcon1 and replace each "tcon0" with "tcon1".
    Then add a panel section:
    panel: panel { #address-cells = <1>; #size-cells = <0>; port { #address-cells = <1>; #size-cells = <0>; lcd_in_tcon0: endpoint { remote-endpoint = <&tcon0_out_lcd>; }; }; }; If you also want to use tcon1 add lcd_in_tcon1 section .
    My Lemaker 5"LCD-Display uses RGB-Mode so this has to be added to pio section
    pio: pinctrl@1c20800 { compatible = "allwinner,sun7i-a20-pinctrl"; //..... lcd0_rgb888_pins: lcd0-rgb888 { pins = "PD0", "PD1", "PD2", "PD3", "PD4", "PD5", "PD6", "PD7", "PD8", "PD9", "PD10", "PD11", "PD12", "PD13", "PD14", "PD15", "PD16", "PD17", "PD18", "PD19", "PD20", "PD21", "PD22", "PD23", "PD24", "PD25", "PD26", "PD27"; function = "lcd0"; }; //..... }; 4. modify bananapro device tree
    nano build/cache/sources/v2020.04/arch/arm/dts/sun7i-a20-bananapro.dts Add backlight and power management for the panel
    #include <dt-bindings/pwm/pwm.h> / { model = "LeMaker Banana Pro"; compatible = "lemaker,bananapro", "allwinner,sun7i-a20"; //..... backlight: backlight { compatible = "pwm-backlight"; pwms = <&pwm 0 50000 0>; brightness-levels = < 0 1 1 1 1 2 2 2 2 3 3 3 3 4 4 4 5 5 5 6 6 6 7 7 8 8 8 9 9 9 10 10 10 11 11 12 12 12 13 13 14 14 14 15 15 16 16 17 17 17 18 18 19 19 20 20 21 21 21 22 22 23 23 24 24 25 25 26 26 27 27 28 28 29 30 30 31 31 32 32 33 33 34 35 35 36 36 37 38 38 39 39 40 41 41 42 43 43 44 44 45 46 47 47 48 49 49 50 51 51 52 53 54 54 55 56 57 57 58 59 60 61 61 62 63 64 65 65 66 67 68 69 70 71 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 101 102 103 104 105 106 108 109 110 111 112 114 115 116 117 119 120 121 123 124 125 127 128 129 131 132 133 135 136 138 139 141 142 144 145 147 148 150 151 153 154 156 157 159 161 162 164 166 167 169 171 173 174 176 178 180 181 183 185 187 189 191 192 194 196 198 200 202 204 206 208 210 212 214 216 219 221 223 225 227 229 232 234 236 238 241 242 244 246 248 250 253 255>; default-brightness-level = <128>; enable-gpios = <&pio 7 8 GPIO_ACTIVE_HIGH>; /* PH8 */ }; panel_power: panel_power { compatible = "regulator-fixed"; regulator-name = "panel-power"; regulator-min-microvolt = <10400000>; regulator-max-microvolt = <10400000>; gpio = <&pio 7 12 GPIO_ACTIVE_HIGH>; /* PH12 */ enable-active-high; regulator-boot-on; }; }; Configure tcon to use our panel and enable display engine
    &de { status = "okay"; }; &tcon0 { pinctrl-names = "default"; pinctrl-0 = <&lcd0_rgb888_pins>; status = "okay"; }; &panel { compatible = "lemaker,bl050-rgb-002"; power-supply = <&panel_power>; backlight = <&backlight>; }; Add touch driver for edt-ft5x06:
    &i2c3 { status = "okay"; pinctrl-names = "default"; pinctrl-0 = <&i2c3_pins>; edt: edt-ft5x06@38 { compatible = "edt,edt-ft5x06", "edt,edt-ft5306"; reg = <0x38>; interrupt-parent = <&pio>; interrupts = <7 9 IRQ_TYPE_EDGE_FALLING>; // wake-gpios = <7 7 GPIO_ACTIVE_LOW>; pinctrl-names = "default"; pinctrl-0 = <&edt_ft5x06_pins_a &edt_ft5x06_pins_b>; touchscreen-size-x = <800>; touchscreen-size-y = <480>; //touchscreen-inverted-x; //touchscreen-inverted-y; //touchscreen-swapped-x-y; }; };  Add edt_ft5x06 and backlight pins:
    &pio { edt_ft5x06_pins_a: ft5@0 { // interrupt pins = "PH9"; function = "irq"; drive-strength = <20>; bias-pull-up; }; edt_ft5x06_pins_b: ft5@1 { // reset-gpios pins = "PH7"; function = "gpio_out"; drive-strength = <20>; bias-pull-up; output-high; }; }; &pwm { pinctrl-names = "default"; pinctrl-0 = <&pwm0_pin>, <&pwm1_pin>; status = "okay"; }; Hit <Enter>
     
    If asked the nexttime to press enter:
     
    5. Make sure your panel driver available in kernel drivers. Mine was not. So I had to add it to the simple panel driver which already contains the Lemeker 3,5"LCD-Display.
     
    nano build/cache/sources/linux-mainline/orange-pi-5.4/drivers/gpu/drm/panel/panel-simple.c add this right after lemaker_bl035_rgb_002
    static const struct panel_desc lemaker_bl050_rgb_002 = { .modes = &lemaker_bl050_rgb_002_mode, .num_modes = 1, .size = { .width = 108, .height = 64, }, .bus_format = MEDIA_BUS_FMT_RGB888_1X24, .bus_flags = DRM_BUS_FLAG_DE_HIGH, }; static const struct drm_display_mode lg_lb070wv8_mode = { .clock = 33246, .hdisplay = 800, .hsync_start = 800 + 88, .hsync_end = 800 + 88 + 80, .htotal = 800 + 88 + 80 + 88, .vdisplay = 480, .vsync_start = 480 + 10, .vsync_end = 480 + 10 + 25, .vtotal = 480 + 10 + 25 + 10, .vrefresh = 60, }; and this right after lemaker,bl035-rgb-002
    static const struct of_device_id platform_of_match[] = { { //..... }, { .compatible = "lemaker,bl050-rgb-002", .data = &lemaker_bl050_rgb_002, }, { //..... } } Do steps 3 and 4 to
    build/cache/sources/linux-mainline/orange-pi-5.4/arch/arm/boot/dts/sun7i-a20.dtsi
    and
    build/cache/sources/linux-mainline/orange-pi-5.4/arch/arm/boot/dts/sun7i-a20-bananapro.dts
    and hit <Enter> and proceed build
     
     
    Have a look at this page for other display configurations:
    http://linux-sunxi.org/LCD#Mainline_Linux_.28simple-panel.29
     
    Thanks a lot to sgei and his tutorial!
    Many thanks to authors of another hunderd websites which also helped but I can't even list.
    Please let me know if this works for BananaPi too.
×
×
  • Create New...

Important Information

Terms of Use - Privacy Policy - Guidelines