warpme / miniarch

ArchLinux ARM SD card images for quick start with ArchLinux on ARM SBC & TV Boxes
GNU General Public License v2.0
85 stars 7 forks source link

Andowl Q96x (H313; AIP1618 VFD controller) openvfd module loads and it's listed in lsmod but... #16

Closed mercs759 closed 1 year ago

mercs759 commented 1 year ago

(my system described in previous issue)

Im trying to enable my VFD (display in front of the box)

my VFD structure : 2 icons ; 88:88 ; other 2 icons my VFD controller-chip is AIP1628

AIP1628 is a clone of : FD628 | TM1628 | CS1628 | HT1628| LK1628 | SM1628 and needs a 3 wires connection.

The de-facto standard for linux VFD controllers drivers is https://github.com/arthur-liberman/ I found there my VFD display and my controller

I tried to compile and install openvfd by myself, but during install openvfd driver asked to reinstall linux-headers. "Missing" xxx "kernel headers for module openvfd/1.4.2"

And this can't be done in miniarch without breaking something else.

What should I do?

warpme commented 1 year ago

Well,

No need to compile vfd kernel driver as miniarch already has it: https://github.com/warpme/minimyth2/blob/master/script/kernel/linux-6.3/files/0105-drivers-led-add-openvfd-1.4.2.patch

What you need is user space daemon. To test yours led display you may use vfd user space script i'm including in MiniMyth2: https://raw.githubusercontent.com/warpme/minimyth2/master/script/utils/openvfd-service/files/openvfd and attached daemon: OpenVFDService.zip

To test vfd device tree config for your device - you may try MiniMyth2 image. If led display appears then you have correct vfd config in yours box device tree - so no any custom vfd.conf is required.

If led display will not work with MiniMyth2 image - you need to develop vfd.conf for your device. For this pls look at vfd documentation & exemplary conf files...

good luck

btw: i understand this discussion is not about miniarch bug....

mercs759 commented 1 year ago

Well , yes, it doesen't seem a bug. Maybe U can close the issue.

i tried the script

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

I don't know what's missing.

So, I created my device tree file using dtc and filesystem for input.

In it I can't see any reference to either "openvfd" or "vfd" or similar.

The only node which could have something to do (see later) with openvfd is this : pinctrl@300b000 {

gpio-cells = <0x03>;

                    #interrupt-cells = <0x03>;
                    clock-names = "apb\0hosc\0losc";
                    clocks = <0x02 0x1a 0x0e 0x0f 0x00>;
                    compatible = "allwinner,sun50i-h616-pinctrl";
                    gpio-controller;
                    interrupt-controller;
                    interrupts = <0x00 0x33 0x04 0x00 0x34 0x04 0x00 0x35 0x04 0x00 0x2b 0x04 0x00 0x36 0x04 0x00 0x37 0x04 0x00>
                    phandle = <0x15>;
                    reg = <0x300b000 0x400>;

Should I add, search for something?

I also tried to create a vdf.conf file , but i'm unsure about the pins to use i started from here : https://github.com/arthur-liberman/vfd-configurations/tree/master Among those examples there is nothing specific for H313/H616 SoCs. But there are 2 .conf for Alwinner H6 boxes. both contain this line: "vfd_gpio_chip_name='300b000.pinctrl"

I modified one of those .conf to include my vfd-controller model etc, but nothing Is there some other "repository" for .conf?

update:

$ 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: $

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>; };

mercs759 commented 1 year ago

I think I'm using the correct values, they come from my working android device tree and from /sys/kernel/debug/gpio :

Only difference is that in miniArch gpiochip1 becomes gpiochip0

so, clk 0,230 , dat=0,231 and stb=0,233 ; display type 03 , display controller 0 (FD628 compatible)

[root@alarm alarm]# modprobe -r openvfd [root@alarm alarm]# /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 reports that openvfd.ko is loaded

But I have no way of understanding if openvfd.ko is taking those values or not. gpioinfo says nothing changes on pins 230,231,233. They remain "unused, input, active-high" (Is there some way for tracing modprobe?)

and when I give

[root@alarm alarm]# /usr/bin/OpenVFDService ${clock_12h_format:+-12h} Open device failed. : No such file or directory

What is OpenVFDService looking for?

mercs759 commented 1 year ago

now I can see errors on journalctl.
I can't believe I didn't see those before.

One of the last things I did before this was adding openvfd node to device tree, I don't know if this helped. Another thing was deleting a node which used one of the pins (233) I needed. It was a red "disk activity led" . If someone uses sun50i-h313-x96-q.dtb as a "compatible" dtb ...keep in mind this.

I fixed the errors and openvfd driver correctly loads (and adds /etc/openvfd character device). Service now works.

note :