arthur-liberman / vfd-configurations

vfd.config - A collection of configuration files for linux devices with a front facing display.
GNU General Public License v3.0
36 stars 39 forks source link

"Andowl Q96X" tv box (Allwinner H313; DDR3; Board X88PROA H313 D4 V1.0 ; eMMC; AIP1628 VFD controller) #14

Closed mercs759 closed 1 year ago

mercs759 commented 1 year ago

Hello, I'm trying to make openvfd work with my hardware under linux arch aarch64. VFD is ID 3 (A display like on the A95X R2) so, from first column on the left , from up to down i have : "0/1", "LAN" ; 88:88 ; WIFI strong signal ; WIFI low signal

(please add descriptions of icons in the readme... I went crazy searching for all images ;D )

I still have a working stock android 10 (rooted) on eMMC , so I did a cat while VFD was on

$ cat /sys/kernel//debug/gpio gpiochip1: GPIOs 0-287, parent: platform/pio, pio: gpio 166 ( |cd )in lo gpio 207 ( |wlan_hostwake )in lo gpio 210 ( |wlan_regon )out hi gpio 211 ( |bt_rst )out lo gpio 226 ( |? )out hi gpio 227 ( |? )out lo gpio 229 ( |? )out hi gpio 230 ( |leds_clk )out hi gpio 231 ( |leds_dat )out hi gpio 232 ( |? )out hi gpio 233 ( |leds_stb )out lo gpiochip0: GPIOs 352-383, parent: platform/r_pio, r_pio: $

I'm also looking in my android file System for boot.img, to extract a dtb from there, but still no luck.

Could you help me? :)

arthur-liberman commented 1 year ago

It looks like the A95X vfds should be using the same layout, so you can base your config on those. leds_* are your GPIO pins, labeled the same as in my vfds. You can use the numbers directly as you see them in the output you posted since that starting index is 0.

mercs759 commented 1 year ago

I'm trying to manually load openvfd.ko with /sbin/modprobe openvfd vfd_gpio_clk=0,230,0 vfd_gpio_dat=0,231,0 vfd_gpio_stb=0,233,0 vfd_gpio_chip_name=300b000.pinctrl vfd_chars=2,4,3,2,1 vfd_dot_bits=0,1,2,3,4,5,6 vfd_display_type=0x03,0x00,0x00,0x00

lsmod says openvfd is loaded, but that's the only thing I can see.

gpioinfo still report pins 230,231 and 233 as "unnamed, unused, input, active-high" no errors in dmesg or journalctl

if I type /usr/bin/OpenVFDService

starting OpenVFDService daemon OpenVFDService daemon started. Exiting with rc=0 [root@alarm alarm]# Open device failed. : No such file or directory

in my working Android10 I 've this in device tree dts file (file created using dtc in Termux, using filesystem as input. I'm only including nodes related with leds, or pins 230,232,233 or vfd controller)

/dts-v1/;

/ { compatible = "allwinner,h616\0arm,sun50iw9p1"; interrupt-parent = <0x01>;

address-cells = <0x02>;

#size-cells = <0x02>;

sram_a1 {
    compatible = "allwinner,sram_a1";
    reg = <0x00 0x20000 0x00 0x8000>;
};

gpu@0x01800000 { (...)

clocks { (...about 1000 of clocks)

(...)

soc@03000000 {
    compatible = "simple-bus";
    device_type = "soc";
    ranges;
    #address-cells = <0x02>;
    #size-cells = <0x02>;
    phandle = <0x100>;
    linux,phandle = <0x100>;

    tv0@01c94000 {

    sound@0 {

    ac200 { (...)

    pinctrl@0300b000 {
        compatible = "allwinner,sun50iw9p1-pinctrl";
        clocks = <0x1d 0x1e 0x09>;
        device_type = "pio";
        gpio-controller;
        #interrupt-cells = <0x03>;
        input-debounce = <0x00 0x00 0x00 0x00 0x00 0x00 0x00>;
        interrupts = <0x00 0x33 0x04 0x00 0x34 0x04 0x00 0x35 0x04 0x00 0x2b 0x04 0x00 0x36 0x04 0x00 0x37 0x04 0x00 0x38 0x04 0x00 0x39 0x04>;
        #size-cells = <0x00>;
        phandle = <0x53>;
        reg = <0x00 0x300b000 0x00 0x400>;
        #gpio-cells = <0x06>;
        linux,phandle = <0x53>;
        interrupt-controller;

        (...)

        (...)
        spi1@0 {

        lvds0@1 {
        (...)
        (...)
    };

    (...)
    pinctrl@07022000 {                      // the other pin controller
        compatible = "allwinner,sun50iw9p1-r-pinctrl";
        clocks = <0x1c>;
        device_type = "r_pio";
        gpio-controller;
        #interrupt-cells = <0x03>;
        #size-cells = <0x00>;
        phandle = <0x101>;
        reg = <0x00 0x7022000 0x00 0x400>;
        #gpio-cells = <0x06>;
        linux,phandle = <0x101>;
        interrupt-controller;

        s_twi0@0 { (...)

        s_twi0@1 { (...)

        s_rsb0@0 {  (...)
    };  

    gpio_para {  // I think this node only controls a red standby led //
        compatible = "allwinner,sunxi-init-gpio";
        device_type = "gpio_para";
        gpio_pin_1 = <0x53 0x07 0x05 0x01 0xffffffff 0xffffffff 0x01>; 
        gpio_pin_2 = <0x53 0x07 0x02 0x01 0xffffffff 0xffffffff 0x00>;
        gpio_pin_3 = <0x53 0x07 0x03 0x01 0xffffffff 0xffffffff 0x01>;
        gpio_pin_4 = <0x53 0x07 0x05 0x01 0xffffffff 0xffffffff 0x00>; 

        normal_led = "gpio_pin_1";      // when android is working led is OFF
        network_led = "gpio_pin_2";
        link_led = "gpio_pin_3";
        standby_led = "gpio_pin_4";     //when android is off (standby) this is ON

        normal_led_light = <0x01>;
        network_led_light = <0x01>;
        link_led_light = <0x01>;
        standby_led_light = <0x01>;
        status = "okay";
        gpio_num = <0x04>;
        easy_light_used = <0x01>;

    };

    vind@0 {

    platform {

    (...)
    (...)
    product {
        version = "100";
        device_type = "product";
        machine = "evb";

    leds_para {
        compatible = "amlogic,tm1628a_dev";
        leds_clk = <0x53 0x07 0x06 0x01 0xffffffff 0xffffffff 0x01>;
        leds_stb = <0x53 0x07 0x09 0x01 0xffffffff 0xffffffff 0x01>;
        device_type = "leds_para";
        leds_used = <0x01>;
        leds_dat = <0x53 0x07 0x07 0x01 0xffffffff 0xffffffff 0x01>;
    (...)
    (...)
    };

};

sunxi-chipid@03006200 {
}; (...)

https://datasheet.lcsc.com/lcsc/2201121900_TM-Shenzhen-Titan-Micro-Elec-TM1628A_C2943005.pdf
arthur-liberman commented 1 year ago

You need to make sure that your dtb includes an openvfd section. Like here: https://github.com/CoreELEC/linux-amlogic/blob/56dc8cdf855bf628c425eeeb4996788edf23d7cd/arch/arm64/boot/dts/amlogic/coreelec_common.dtsi#L53 You can also run dmesg | grep OpenVFD to see what the status is.

mercs759 commented 1 year ago

It seems that adding openvfd node did some magic. now i can see error messages in journalctl... I can't believe I didn't see those errors before.

One of the pins needed was used from another node in my compatibile.dtb file. Decompiled the dtb to dtf, deleted the bad node, recompiled the dtf to dtb, put the new dtb in /boot/dtb

Now It works. I've lost 6 days on this thing xD

please , add in readme file "if you are using a compatibile.dtb file for running linux on your android TvBox , you will need your original stock android rom. In other words : to know what pins are used by your vfd controller you need an EXACTLY_YOUR_BOX.dtb OR a working STOCK android". ;)

mercs759 commented 1 year ago

problem is that leds and VFDisplays often don't work with compatibile.dtb. You need and exact-for-your-box.dtb

same thing for "similarbox_vfd.conf", they will not work because of different pins and/or vfdcontroller and/or vfd.

I think It would be useful putting online generic configs. Names could be like : H313-H616-H6_FD628-TM1628-TM1628a-AIP1628.conf Having a config like this, with only few (correct) values inside, and blank parts to be filled by user, would be a better starting point than a similarbox.conf with wrong values inside. ;D