Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problems configuring X96 Air Q1000 VFD display #8

Closed
danboid opened this issue Jun 15, 2021 · 43 comments
Closed

Problems configuring X96 Air Q1000 VFD display #8

danboid opened this issue Jun 15, 2021 · 43 comments

Comments

@danboid
Copy link

danboid commented Jun 15, 2021

Hi Arthur

Thanks for writing openvfd! I built your repo yesterday with Linux 5.12 under Manjaro ARM and I'm in the process of configuring it now.

There doesn't seem to be any docs for openvfd in your repo but I would presume that most if not all of what can be read in the README at https://github.com/LibreELEC/linux_openvfd also applies to your upstream code?

I tried to report a bug to the LE fork yesterday but I was told by one of the LE devs that their fork is dead so I think it would be a good idea to borrow and update (if required) their docs for your repo.

@danboid
Copy link
Author

danboid commented Jun 15, 2021

The first major hurdle I've encountered in trying to configure my X96 Air LED display is setting openvfd_display_type. Looking at openvfd_drv.h, there seems to 11 different options so ideally the openvfd documentation would include pictures that represent the layout used by each one of the 11 different display types, to save people the hassle of manually trying each one to work out which matches theirs, if any. I have struggled to find photos of the LED displays of the various models supported.

Could you please help me configure my display for use with openvfd? Android's dmesg output tells me it is a sm1628/TM1623. I have decompiled the dtb and the relevant dts code is:

meson-vfd {
		compatible = "amlogic,aml_vfd";
		dev_name = "meson-vfd";
		vfd_data_gpio = <0x18 0x40 0x00>;
		vfd_clock_gpio = <0x18 0x41 0x00>;
		vfd_stb_gpio = <0x6b 0x0a 0x00>;
		status = "okay";
	};

Here is a photo of my X96 Air Q1000's LED:

X96-Air-Q1000-LED

I'm only actually bothered about using the 7-segment display bit. I don't need to the other bits to work. It would be cool to get the IR to work too, if that is supported by this driver?

Thanks Arthur!

@danboid
Copy link
Author

danboid commented Jun 15, 2021

I see the TM1618 controller is supported but openvfd doesn't yet seem to support the sm1628 or TM1623. Might I be able to use one of the existing controller types?

I can open a separate ticket for sm1628/TM1623 support if you want? This is no longer just about docs.

@danboid
Copy link
Author

danboid commented Jun 15, 2021

IMG_20210615_122353

@danboid
Copy link
Author

danboid commented Jun 15, 2021

Based upon a closed issue, it seems I need to add something like this to my dts:

/dts-v1/;
/plugin/;
/ {
   fragment@0 {
      target-path = "/";
      __overlay__ {
         openvfd {
            compatible = "open,vfd";
            dev_name = "openvfd";
            openvfd_gpio_clk = <&gpio2 0x13 0x00>;
            openvfd_gpio_dat = <&gpio2 0x16 0x00>;
            openvfd_gpio_stb = <&gpio2 0x12 0x00>;
            openvfd_chars = [04 00 01 02 03];
            openvfd_dot_bits = [00 01 03 02 04 05 06];
            openvfd_display_type = <0x02>;
            status = "okay";
         };
      };
   };
};

This is another thing I'd like to see added to the docs that is also missing from the LE docs.

In this example, the user has used gpio refs for the first values of the three gpio variables, whereas in my Android dts I have three hex values. How do I convert between the two, or how do I discover the correct gpio values?

@danboid danboid changed the title Borrow/update Libreelec fork docs Problems configuring X96 Air Q1000 VFD display Jun 17, 2021
@danboid
Copy link
Author

danboid commented Jun 17, 2021

You can ignore my request re copying the LE docs as I have found the same docs in this repo, they were just in a different dir to the LE fork for some reason so I thought they were missing.

After looking through the available config files in the vfd-configurations, my guess would be that the t95-max-plus config would be the most likely to work:

https://github.com/arthur-liberman/vfd-configurations/blob/master/t95-max-plus-s905x3-vfd.conf

So I added these lines into my .dts:

openvfd {
            compatible = "open,vfd";
            dev_name = "openvfd";
            openvfd_gpio_clk = <0 24 0>;
            openvfd_gpio_dat = <0 23 0>;
            openvfd_gpio_stb = <0 0 0xFF>;
            openvfd_chars = [00 01 02 03 04];
            openvfd_dot_bits = [00 01 02 03 04 05 06];
            openvfd_display_type = <0x01 0x00 0x00 0x06>;
            status = "okay";
    };

Unfortunately this config, like all the others I've tried so far (such as the X96 Max config), always results in these errors appearing in dmesg:

OpenVFD: can't request gpio of gpio_clk
openvfd: probe of openvfd failed with error -22

I got the same error when using the gpio values from my Android dts.

@arthur-liberman
Copy link
Owner

What is the full error message?
Post a link to the full dmesg.

@danboid
Copy link
Author

danboid commented Jun 17, 2021

Hi @arthur-liberman !

My latest hacky attempt in the dts looks like this, a mish mash of configs so unlikely to work:

openvfd {
            compatible = "open,vfd";
            dev_name = "openvfd";
            openvfd_gpio_clk = <0x18 0x41 0x00>;
            openvfd_gpio_dat = <0x18 0x40 0x00>;
            openvfd_gpio_stb = <0x6b 0x0a 0x00>;
            openvfd_chars = [00 01 02 03 04];
            openvfd_dot_bits = [00 01 02 03 04 05 06];
            openvfd_display_type = <0x02 0x00 0x01 0x00>;
            status = "okay";
    };

dmesg:

[   69.281357] OpenVFD: Version: V1.3.0
[   69.281390] OpenVFD: vfd_gpio_clk:		Empty.
[   69.281394] OpenVFD: vfd_gpio_dat:		Empty.
[   69.281396] OpenVFD: vfd_gpio_stb:		Empty.
[   69.281403] OpenVFD: vfd_gpio0:		#0 = 0x00; #1 = 0x00; #2 = 0xFF; 
[   69.281407] OpenVFD: vfd_gpio1:		#0 = 0x00; #1 = 0x00; #2 = 0xFF; 
[   69.281411] OpenVFD: vfd_gpio2:		#0 = 0x00; #1 = 0x00; #2 = 0xFF; 
[   69.281415] OpenVFD: vfd_gpio3:		#0 = 0x00; #1 = 0x00; #2 = 0xFF; 
[   69.281418] OpenVFD: vfd_gpio_protocol:	#0 = 0x00; #1 = 0x00; 
[   69.281421] OpenVFD: vfd_chars:		Empty.
[   69.281423] OpenVFD: vfd_dot_bits:		Empty.
[   69.281425] OpenVFD: vfd_display_type:	Empty.
[   69.281433] OpenVFD: Detected gpio chips:	aobus-banks, periphs-banks.
[   69.281435] OpenVFD: Failed to verify VFD configuration file, attempt using device tree as fallback.
[   69.284934] OF: /openvfd: could not get #gpio-cells for /soc/bus@ff600000/bus@34400/pinctrl@40/pdm-dclk-z
[   69.294563] OpenVFD: openvfd_gpio_clk: pin = -22, flags = 0x00
[   69.294596] OF: /openvfd: could not get #gpio-cells for /soc/bus@ff600000/bus@34400/pinctrl@40/pdm-dclk-z
[   69.304028] OpenVFD: openvfd_gpio_dat: pin = -22, flags = 0x00
[   69.304214] OF: /openvfd: could not find phandle 107
[   69.308897] OpenVFD: openvfd_gpio_stb: pin = -22, flags = 0x00
[   69.308934] OpenVFD: openvfd_gpio0 pin entry not found
[   69.308938] OpenVFD: openvfd_gpio1 pin entry not found
[   69.308941] OpenVFD: openvfd_gpio2 pin entry not found
[   69.308944] OpenVFD: openvfd_gpio3 pin entry not found
[   69.308947] OpenVFD: chars_prop = 00000000c2ebad81
[   69.308953] OpenVFD: chars_prop->length = 5
[   69.308955] OpenVFD: char #0: 0
[   69.308958] OpenVFD: char #1: 1
[   69.308960] OpenVFD: char #2: 2
[   69.308962] OpenVFD: char #3: 3
[   69.308965] OpenVFD: char #4: 4
[   69.308969] OpenVFD: dot_bits_prop = 000000000b586c63
[   69.308971] OpenVFD: dot_bits_prop->length = 7
[   69.308973] OpenVFD: dot_bit #0: 0
[   69.308976] OpenVFD: dot_bit #1: 1
[   69.309000] OpenVFD: dot_bit #2: 2
[   69.309014] OpenVFD: dot_bit #3: 3
[   69.309017] OpenVFD: dot_bit #4: 4
[   69.309019] OpenVFD: dot_bit #5: 5
[   69.309021] OpenVFD: dot_bit #6: 6
[   69.309026] OpenVFD: display.type = 2, display.controller = 0, pdata->dev->dtb_active.display.flags = 0x00
[   69.309056] OpenVFD: can't request gpio of gpio_clk
[   69.309084] openvfd: probe of openvfd failed with error -22

@danboid
Copy link
Author

danboid commented Jun 17, 2021

The rest of my dts:

https://github.com/danboid/meson-sm1-sei610-qca9377-bt

@arthur-liberman
Copy link
Owner

You cannot use the same phandle values you have in the original Android DTB. You need to find what the handle addresses are for the aobus-banks and periphs-banks, and use them in your overlay. You may or may not have to adjust the pin numbers as well, depending on the base addresses for the IO pins.
You can run cat /sys/kernel/debug/gpio to get some more info on the gpio pins, including their numeric address ranges.

@danboid
Copy link
Author

danboid commented Jun 17, 2021

$ sudo cat /sys/kernel/debug/gpio
[sudo] password for dan: 
gpiochip1: GPIOs 412-426, parent: platform/ff800000.sys-ctrl:pinctrl@14, aobus-banks:
 gpio-414 (                    |C                   ) in  lo ACTIVE LOW

gpiochip0: GPIOs 427-511, parent: platform/ff634400.bus:pinctrl@40, periphs-banks:
 gpio-442 (                    |PHY reset           ) out hi ACTIVE LOW
 gpio-449 (                    |A                   ) in  lo ACTIVE LOW
 gpio-450 (                    |B                   ) in  lo ACTIVE LOW
 gpio-451 (                    |regulator-vddao_3v3_) out lo ACTIVE LOW
 gpio-464 (                    |reset               ) out hi ACTIVE LOW
 gpio-474 (                    |cd                  ) in  hi ACTIVE LOW
 gpio-475 (                    |sei610:blue:bt      ) out lo ACTIVE LOW
 gpio-498 (                    |reset               ) out hi ACTIVE LOW
 gpio-500 (                    |sdmode              ) out lo 
 gpio-509 (                    |enable              ) out lo

@arthur-liberman
Copy link
Owner

Try

openvfd {
            compatible = "open,vfd";
            dev_name = "openvfd";
            openvfd_gpio_clk = <0x10 0x41 0x00>;
            openvfd_gpio_dat = <0x10 0x40 0x00>;
            openvfd_gpio_stb = <0x19 0x0a 0x00>;
            openvfd_chars = [00 01 02 03 04];
            openvfd_dot_bits = [00 01 02 03 04 05 06];
            openvfd_display_type = <0x02 0x00 0x01 0x00>;
            status = "okay";
    };

@danboid
Copy link
Author

danboid commented Jun 17, 2021

Using that config gives:

[   75.853600] OpenVFD: Version: V1.3.0
[   75.853620] OpenVFD: vfd_gpio_clk:		Empty.
[   75.853623] OpenVFD: vfd_gpio_dat:		Empty.
[   75.853626] OpenVFD: vfd_gpio_stb:		Empty.
[   75.853631] OpenVFD: vfd_gpio0:		#0 = 0x00; #1 = 0x00; #2 = 0xFF; 
[   75.853635] OpenVFD: vfd_gpio1:		#0 = 0x00; #1 = 0x00; #2 = 0xFF; 
[   75.853639] OpenVFD: vfd_gpio2:		#0 = 0x00; #1 = 0x00; #2 = 0xFF; 
[   75.853642] OpenVFD: vfd_gpio3:		#0 = 0x00; #1 = 0x00; #2 = 0xFF; 
[   75.853646] OpenVFD: vfd_gpio_protocol:	#0 = 0x00; #1 = 0x00; 
[   75.853648] OpenVFD: vfd_chars:		Empty.
[   75.853651] OpenVFD: vfd_dot_bits:		Empty.
[   75.853653] OpenVFD: vfd_display_type:	Empty.
[   75.853659] OpenVFD: Detected gpio chips:	aobus-banks, periphs-banks.
[   75.853661] OpenVFD: Failed to verify VFD configuration file, attempt using device tree as fallback.
[   75.857230] OF: /openvfd: could not get #gpio-cells for /soc/bus@ff600000/bus@34400/pinctrl@40
[   75.865734] OpenVFD: openvfd_gpio_clk: pin = -22, flags = 0x00
[   75.865785] OF: /openvfd: could not get #gpio-cells for /soc/bus@ff600000/bus@34400/pinctrl@40
[   75.874282] OpenVFD: openvfd_gpio_dat: pin = -22, flags = 0x00
[   75.874311] OF: /openvfd: could not get #gpio-cells for /soc/bus@ff800000/sys-ctrl@0/pinctrl@14
[   75.882907] OpenVFD: openvfd_gpio_stb: pin = -22, flags = 0x00
[   75.882941] OpenVFD: openvfd_gpio0 pin entry not found
[   75.882946] OpenVFD: openvfd_gpio1 pin entry not found
[   75.882949] OpenVFD: openvfd_gpio2 pin entry not found
[   75.882952] OpenVFD: openvfd_gpio3 pin entry not found
[   75.882955] OpenVFD: chars_prop = 00000000bb178c0a
[   75.882960] OpenVFD: chars_prop->length = 5
[   75.882963] OpenVFD: char #0: 0
[   75.882965] OpenVFD: char #1: 1
[   75.882967] OpenVFD: char #2: 2
[   75.882969] OpenVFD: char #3: 3
[   75.882972] OpenVFD: char #4: 4
[   75.882975] OpenVFD: dot_bits_prop = 000000003fd84376
[   75.882978] OpenVFD: dot_bits_prop->length = 7
[   75.882980] OpenVFD: dot_bit #0: 0
[   75.882982] OpenVFD: dot_bit #1: 1
[   75.882985] OpenVFD: dot_bit #2: 2
[   75.882987] OpenVFD: dot_bit #3: 3
[   75.882989] OpenVFD: dot_bit #4: 4
[   75.882991] OpenVFD: dot_bit #5: 5
[   75.882993] OpenVFD: dot_bit #6: 6
[   75.882996] OpenVFD: display.type = 2, display.controller = 0, pdata->dev->dtb_active.display.flags = 0x00
[   75.883000] OpenVFD: can't request gpio of gpio_clk
[   75.883033] openvfd: probe of openvfd failed with error -22

@arthur-liberman
Copy link
Owner

I'm not sure, maybe

openvfd {
            compatible = "open,vfd";
            dev_name = "openvfd";
            openvfd_gpio_clk = <0x2a 0x41 0x00>;
            openvfd_gpio_dat = <0x2a 0x40 0x00>;
            openvfd_gpio_stb = <0x3f 0x0a 0x00>;
            openvfd_chars = [00 01 02 03 04];
            openvfd_dot_bits = [00 01 02 03 04 05 06];
            openvfd_display_type = <0x02 0x00 0x01 0x00>;
            status = "okay";
    };

will work. If it doesn't, then it's something about the DTB, I'm no expert on that.

@danboid
Copy link
Author

danboid commented Jun 17, 2021

dmesg is looking happier now using your latest suggested config although after loading the kernel module and running OpenVFDService -t I'm still not getting any of the display lighting up so maybe its not quite right yet? Is that the best command to run to test it?

[   74.266196] OpenVFD: Version: V1.3.0
[   74.266217] OpenVFD: vfd_gpio_clk:		Empty.
[   74.266220] OpenVFD: vfd_gpio_dat:		Empty.
[   74.266223] OpenVFD: vfd_gpio_stb:		Empty.
[   74.266229] OpenVFD: vfd_gpio0:		#0 = 0x00; #1 = 0x00; #2 = 0xFF; 
[   74.266232] OpenVFD: vfd_gpio1:		#0 = 0x00; #1 = 0x00; #2 = 0xFF; 
[   74.266236] OpenVFD: vfd_gpio2:		#0 = 0x00; #1 = 0x00; #2 = 0xFF; 
[   74.266240] OpenVFD: vfd_gpio3:		#0 = 0x00; #1 = 0x00; #2 = 0xFF; 
[   74.266244] OpenVFD: vfd_gpio_protocol:	#0 = 0x00; #1 = 0x00; 
[   74.266246] OpenVFD: vfd_chars:		Empty.
[   74.266248] OpenVFD: vfd_dot_bits:		Empty.
[   74.266251] OpenVFD: vfd_display_type:	Empty.
[   74.266256] OpenVFD: Detected gpio chips:	aobus-banks, periphs-banks.
[   74.266258] OpenVFD: Failed to verify VFD configuration file, attempt using device tree as fallback.
[   74.269828] OpenVFD: openvfd_gpio_clk: pin = 492, flags = 0x00
[   74.269844] OpenVFD: openvfd_gpio_dat: pin = 491, flags = 0x00
[   74.269856] OpenVFD: openvfd_gpio_stb: pin = 422, flags = 0x00
[   74.269861] OpenVFD: openvfd_gpio0 pin entry not found
[   74.269864] OpenVFD: openvfd_gpio1 pin entry not found
[   74.269867] OpenVFD: openvfd_gpio2 pin entry not found
[   74.269869] OpenVFD: openvfd_gpio3 pin entry not found
[   74.269872] OpenVFD: chars_prop = 00000000a456d983
[   74.269877] OpenVFD: chars_prop->length = 5
[   74.269880] OpenVFD: char #0: 0
[   74.269882] OpenVFD: char #1: 1
[   74.269885] OpenVFD: char #2: 2
[   74.269887] OpenVFD: char #3: 3
[   74.269889] OpenVFD: char #4: 4
[   74.269892] OpenVFD: dot_bits_prop = 000000004d60054e
[   74.269894] OpenVFD: dot_bits_prop->length = 7
[   74.269897] OpenVFD: dot_bit #0: 0
[   74.269899] OpenVFD: dot_bit #1: 1
[   74.269901] OpenVFD: dot_bit #2: 2
[   74.269903] OpenVFD: dot_bit #3: 3
[   74.269905] OpenVFD: dot_bit #4: 4
[   74.269908] OpenVFD: dot_bit #5: 5
[   74.269910] OpenVFD: dot_bit #6: 6
[   74.269913] OpenVFD: display.type = 2, display.controller = 0, pdata->dev->dtb_active.display.flags = 0x00
[   74.270334] OpenVFD: Select FD628 controller
[   74.270380] OpenVFD: SW SPI 3-wire interface intialized (LSB mode)
[  251.292372] OpenVFD: Select FD628 controller
[  251.292413] OpenVFD: openvfd_dev_write: count = 14, sizeof(data) = 660
[  259.763456] OpenVFD: openvfd_dev_write: count = 14, sizeof(data) = 660
[  260.823440] OpenVFD: openvfd_dev_write: count = 10, sizeof(data) = 660
[  261.353933] OpenVFD: openvfd_dev_write: count = 10, sizeof(data) = 660

@danboid
Copy link
Author

danboid commented Jun 18, 2021

I tried turning on and off various leds with commands like:

echo hdmi > /sys/class/leds/openvfd/led_on

but nothing lit up.

So now that dmesg isn't complaining about GPIO configs is it safe to say we have found the correct GPIO settings and that the controller is supported and I just need to work out the correct display config or is it possible that the controller isn't actually supported despite dmesg not complaining?

@arthur-liberman
Copy link
Owner

Did you check what chip you have on your board? SM1628 may not be the same as a TM1623.
I did look at a TM1623 datasheet, and I think that it should be compatible with FD628 command set, so it should at the very least do something. I'm not sure why it's not working.

@danboid
Copy link
Author

danboid commented Jun 18, 2021

I'm pretty sure it is a TM1623. Here are some screenshots of the relevant bits of my Android's dmesg:

IMG_20210618_105654
IMG_20210618_105504

If that doesn't tell you what we need to know, might there be any commands I could run under Android to tell us more?

Good to hear the TM1623 should be compatible with the FD628 command set, I do have a chance of getting this to work with the existing code then.

@arthur-liberman
Copy link
Owner

That sort of output doesn't necessarily mean that you have a TM1623 or SM1628 controller. The only way to tell is to take the board out of the case and look.

@danboid
Copy link
Author

danboid commented Jun 18, 2021

I've already posted a pic of my box with the case removed. Does it not show what you want?

@arthur-liberman
Copy link
Owner

No, the chip must be on the other side of the board. It should be close to the display, with traces going between them.

@danboid
Copy link
Author

danboid commented Jun 18, 2021

IMG_20210618_114029

Looks like it uses a TM1628A

@arthur-liberman
Copy link
Owner

TM1628A uses the same commands as FD628, so it should work. I'm pretty sure that I don't even have a datasheet for a FD628, only for a TM1628, and the code is based on it.
So I don't know what the deal with it is. Maybe you can try this, it should lower the transmit frequency, maybe it'll fix it (and maybe not).

openvfd {
            compatible = "open,vfd";
            dev_name = "openvfd";
            openvfd_gpio_clk = <0x2a 0x41 0x00>;
            openvfd_gpio_dat = <0x2a 0x40 0x00>;
            openvfd_gpio_stb = <0x3f 0x0a 0x00>;
            openvfd_chars = [00 01 02 03 04];
            openvfd_dot_bits = [00 01 02 03 04 05 06];
            openvfd_display_type = <0x02 0x00 0x41 0x00>;
            status = "okay";
    };

@danboid
Copy link
Author

danboid commented Jun 18, 2021

That config isn't working for me unfortunately, despite no openvfd related errors in dmesg.

@arthur-liberman
Copy link
Owner

arthur-liberman commented Jun 18, 2021

Try it with CoreELEC and x96-max-1gbit-vfd.conf

@danboid
Copy link
Author

danboid commented Jun 18, 2021

I tried to boot CoreELEC a few days ago specifically to see if it supported my LED with no success. I've just tried again with no luck. Apparently you need to copy the correct dtb to the root dir as dtb.img but neither sm1_s905x3_4g_1gbit.dtb , sm1_s905x3_4g.dtb (both included with coreelec) nor my own dtb make it boot. LibreELEC does boot but they don't support openvfd any more.

@arthur-liberman
Copy link
Owner

You may have a "fake RAM" device. Try sm1_s905x3_2g.dtb or sm1_s905x3_2g_1gbit.dtb.
If it still doesn't boot, post on the forum, someone will help you figure it out.

@danboid
Copy link
Author

danboid commented Jun 18, 2021

I have got coreelec to boot and the VFD is working using x96-max-1gbit-vfd.conf

@danboid
Copy link
Author

danboid commented Jun 18, 2021

I've not checked (via SSH) but I think CE is using Linux 4.9 whilst I'm trying to use openvfd with Linux 5.12 under Manjaro.

Have you heard of people using openvfd successfully with recent mainline kernels such as 5.12? Have you tested openvfd on a recent kernel?

@arthur-liberman
Copy link
Owner

I have not tested it, personally. But I'm pretty sure some people used it and it worked for them.

@danboid
Copy link
Author

danboid commented Jun 18, 2021

My LED works under CE 19.2-Matrix_rc2, in fact it looks like all my hardware is working under CE (ethernet, wifi and BT) which is nice. CE 19.2 is using kernel 4.9.113.

@danboid
Copy link
Author

danboid commented Jun 18, 2021

There is an annoying issue with my TV box and CE. After booting CE once, I can no longer boot any other OS via USB nor SD card so I have to reflash Android to restore my bootloader so I can boot Manjaro again. I am still able to boot Android on the eMMC. This is what happened last time I tried CE.

@arthur-liberman
Copy link
Owner

You can post about it on the CE forum, but I don't think there's much we can do about it.
I don't know enough about the booting mechanism to help, and it's also way out of scope for this repo.

@danboid
Copy link
Author

danboid commented Jun 18, 2021

I know, I'm just mentioning that for completeness sake, for those following along from home etc.

@danboid
Copy link
Author

danboid commented Jun 19, 2021

Now we know that openvfd works with my hardware using the x96-max-1gbit-vfd.conf under the CE Linux 4.9.113 kernel, I adapted my dts code to supposedly be exactly like x96-max-1gbit-vfd.conf:

openvfd {
            compatible = "open,vfd";
            dev_name = "openvfd";
            openvfd_gpio_clk = <0x2a 0x41 0x00>;
            openvfd_gpio_dat = <0x2a 0x40 0x00>;
            openvfd_gpio_stb = <0x3f 0x0a 0x00>;
            openvfd_chars = [04 00 01 02 03];
            openvfd_dot_bits = [00 01 02 03 04 05 06];
            openvfd_display_type = <0x02 0x00 0x01 0x00>;
            status = "okay";
    };

but my display still fails to show anything when I've loaded the openvfd kernel module and run OpenVFDService under Manjaro with Linux 5.12.

If others have got openvfd to work under recent kernels then I can only presume there is something not quite right with my kernel config. What kernel features does openvfd depend upon? Might any of them not be enabled (as a module) by default?

https://github.com/danboid/linux-aml-vfd

My current dmesg using the above config:

[    7.185748] OpenVFD: Version: V1.3.0
[    7.185767] OpenVFD: vfd_gpio_clk:		Empty.
[    7.185770] OpenVFD: vfd_gpio_dat:		Empty.
[    7.185773] OpenVFD: vfd_gpio_stb:		Empty.
[    7.185779] OpenVFD: vfd_gpio0:		#0 = 0x00; #1 = 0x00; #2 = 0xFF; 
[    7.185782] OpenVFD: vfd_gpio1:		#0 = 0x00; #1 = 0x00; #2 = 0xFF; 
[    7.185786] OpenVFD: vfd_gpio2:		#0 = 0x00; #1 = 0x00; #2 = 0xFF; 
[    7.185790] OpenVFD: vfd_gpio3:		#0 = 0x00; #1 = 0x00; #2 = 0xFF; 
[    7.185793] OpenVFD: vfd_gpio_protocol:	#0 = 0x00; #1 = 0x00; 
[    7.185796] OpenVFD: vfd_chars:		Empty.
[    7.185798] OpenVFD: vfd_dot_bits:		Empty.
[    7.185800] OpenVFD: vfd_display_type:	Empty.
[    7.185806] OpenVFD: Detected gpio chips:	aobus-banks, periphs-banks.
[    7.185808] OpenVFD: Failed to verify VFD configuration file, attempt using device tree as fallback.
[    7.186946] systemd[1]: Mounting FUSE Control File System...
[    7.189409] OpenVFD: openvfd_gpio_clk: pin = 492, flags = 0x00
[    7.189430] OpenVFD: openvfd_gpio_dat: pin = 491, flags = 0x00
[    7.189442] OpenVFD: openvfd_gpio_stb: pin = 422, flags = 0x00
[    7.189447] OpenVFD: openvfd_gpio0 pin entry not found
[    7.189450] OpenVFD: openvfd_gpio1 pin entry not found
[    7.189452] OpenVFD: openvfd_gpio2 pin entry not found
[    7.189454] OpenVFD: openvfd_gpio3 pin entry not found
[    7.189458] OpenVFD: chars_prop = (____ptrval____)
[    7.189463] OpenVFD: chars_prop->length = 5
[    7.189465] OpenVFD: char #0: 4
[    7.189468] OpenVFD: char #1: 0
[    7.189470] OpenVFD: char #2: 1
[    7.189472] OpenVFD: char #3: 2
[    7.189475] OpenVFD: char #4: 3
[    7.189478] OpenVFD: dot_bits_prop = (____ptrval____)
[    7.189480] OpenVFD: dot_bits_prop->length = 7
[    7.189482] OpenVFD: dot_bit #0: 0
[    7.189485] OpenVFD: dot_bit #1: 1
[    7.189487] OpenVFD: dot_bit #2: 2
[    7.189489] OpenVFD: dot_bit #3: 3
[    7.189491] OpenVFD: dot_bit #4: 4
[    7.189493] OpenVFD: dot_bit #5: 5
[    7.189495] OpenVFD: dot_bit #6: 6
[    7.189498] OpenVFD: display.type = 2, display.controller = 0, pdata->dev->dtb_active.display.flags = 0x00
[    7.189888] OpenVFD: Select FD628 controller
[    7.189929] OpenVFD: SW SPI 3-wire interface intialized (LSB mode)

@danboid
Copy link
Author

danboid commented Jun 19, 2021

aaaaand here's the money shot ie what it looks like on CE when working:

[   19.183035@3] OpenVFD: Version: V1.3.0
[   19.183045@3] OpenVFD: vfd_gpio_clk:		#0 = 0x00; #1 = 0x41; #2 = 0x00; 
[   19.183048@3] OpenVFD: vfd_gpio_dat:		#0 = 0x00; #1 = 0x40; #2 = 0x00; 
[   19.183051@3] OpenVFD: vfd_gpio_stb:		#0 = 0x01; #1 = 0x0A; #2 = 0x00; 
[   19.183054@3] OpenVFD: vfd_gpio0:		#0 = 0x00; #1 = 0x00; #2 = 0xFF; 
[   19.183056@3] OpenVFD: vfd_gpio1:		#0 = 0x00; #1 = 0x00; #2 = 0xFF; 
[   19.183059@3] OpenVFD: vfd_gpio2:		#0 = 0x00; #1 = 0x00; #2 = 0xFF; 
[   19.183062@3] OpenVFD: vfd_gpio3:		#0 = 0x00; #1 = 0x00; #2 = 0xFF; 
[   19.183064@3] OpenVFD: vfd_gpio_protocol:	#0 = 0x00; #1 = 0x00; 
[   19.183068@3] OpenVFD: vfd_chars:		#0 = 0x04; #1 = 0x00; #2 = 0x01; #3 = 0x02; #4 = 0x03; 
[   19.183072@3] OpenVFD: vfd_dot_bits:		#0 = 0x00; #1 = 0x01; #2 = 0x02; #3 = 0x03; #4 = 0x04; #5 = 0x05; #6 = 0x06; 
[   19.183075@3] OpenVFD: vfd_display_type:	#0 = 0x02; #1 = 0x00; #2 = 0x01; #3 = 0x00; 
[   19.183080@3] OpenVFD: Detected gpio chips:	periphs-banks, aobus-banks.
[   19.183083@3] OpenVFD: "periphs-banks" chip found.	base = 410, pin count = 86, pin = 65, offset = 475
[   19.183085@3] OpenVFD: "periphs-banks" chip found.	base = 410, pin count = 86, pin = 64, offset = 474
[   19.183088@3] OpenVFD: "aobus-banks" chip found.	base = 496, pin count = 16, pin = 10, offset = 506
[   19.183089@3] OpenVFD: Skipping vfd_gpio0 evaluation (0xFF)
[   19.183090@3] OpenVFD: Skipping vfd_gpio1 evaluation (0xFF)
[   19.183091@3] OpenVFD: Skipping vfd_gpio2 evaluation (0xFF)
[   19.183092@3] OpenVFD: Skipping vfd_gpio3 evaluation (0xFF)
[   19.185656@3] OpenVFD: Select FD628 controller
[   19.185694@3] OpenVFD: SW SPI 3-wire interface intialized (LSB mode)

@danboid
Copy link
Author

danboid commented Jun 19, 2021

After inspecting the two dmesg's, what stands out to me is that under CE dmesg prints:

[   19.183083@3] OpenVFD: "periphs-banks" chip found.	base = 410, pin count = 86, pin = 65, offset = 475
[   19.183085@3] OpenVFD: "periphs-banks" chip found.	base = 410, pin count = 86, pin = 64, offset = 474
[   19.183088@3] OpenVFD: "aobus-banks" chip found.	base = 496, pin count = 16, pin = 10, offset = 506

Whereas under Linux 5.12 we only see:

[    7.185806] OpenVFD: Detected gpio chips:	aobus-banks, periphs-banks.

and there is no info regarding periphs-banks and aobus-banks following that message as under the CE kernel.

@arthur-liberman
Copy link
Owner

Both dmesg outputs indicate that OpenVFD: Detected gpio chips: aobus-banks, periphs-banks. so it's not that.
The outputs are different, because CoreELEC configures the driver using the vfd conf, with parameters when loading the driver. If parameters are not found, the driver has a fallback to extract the data it needs from the dtb.
I really can't tell you why it's not working for you, I have no real way to check. Both dmesg outputs look normal and comparable, but I can't say why it still doesn't work in 5.12.

You may want to try and change #if 0 to #if 1 in openvfd_drv.h#12. It should then print out more verbose logs to dmesg, maybe there will be more clues pointing to a problem.

@danboid
Copy link
Author

danboid commented Jun 19, 2021

I'd prefer to use the dts to configure openvfd like all my other hardware but if it only works via a separate config file then so be it.

If I put my openvfd config file under /storage/.config/vfd.conf, should the openvfd module load it at boot?

It would be good if openvfd also looked under /etc/openvfd/vfd.conf or something more conventional for Linux.

@danboid
Copy link
Author

danboid commented Jun 19, 2021

As for kernel options, maybe openvfd depends upon some GPIO kernel option that I'm not building? I presume you must enable GPIO support in the kernel to use openvfd. Would it error if the kernel was missing GPIO support when starting?

My kernel has the generic GPIO support/lib enabled but there are several GPIO kernel config options.

@tritu
Copy link

tritu commented Jun 23, 2021

I'm on the same situation with failure trying to port openvfd to kernel 5.12 while CoreElec conf is confirmed working perfectly.
The mainline dts is different from Amlogic vendor one especially for the pinctrl part. So I'm guessing if that's the root cause or not.
Since TM1618 only needs three wires SPI and 5V VCC and GND, I can't image there're other things blocking other than GPIO part.

@arthur-liberman
Copy link
Owner

arthur-liberman commented Aug 5, 2021

Well, according to #12, the pin mappings in the mainline kernel is not the same as in the amlogic vendor kernel.
So it's very likely that all you really need to do is adjust the pin numbers in the DTB to map to the same physical pins on the SoC.

@chbgdn
Copy link

chbgdn commented Oct 16, 2021

@arthur-liberman @danboid @tritu
GPIO pin mapping on vendor kernel start with virtual pin

/* Second GPIO chip */
#define GPIOV_0		0  /* virtual pin for G12A Rev.B */
#define GPIOZ_0		1
#define GPIOZ_1		2
#define GPIOZ_2		3

But mainline has no virtual pin

/* Second GPIO chip */
#define GPIOZ_0		0
#define GPIOZ_1		1
#define GPIOZ_2		2

So to get working linux_openvfd on mainline kernel you need 'vfd_gpio_clk' and 'vfd_gpio_dat' decrease by 1, 'vfd_gpio_stb' leave unchanged.
Device tree node can be like this

openvfd {
    compatible = "open,vfd";
    dev_name = "openvfd";
    status = "okay";
};

Example for X96 Max+

root@Amlogic:~/linux_openvfd/driver# cat x96-max-plus-vfd.conf
vfd_gpio_clk='0,64,0'
vfd_gpio_dat='0,63,0'
vfd_gpio_stb='1,10,0'
vfd_chars='4,0,1,2,3'
vfd_dot_bits='0,1,2,3,4,5,6'
vfd_display_type='0x02,0x00,0x01,0x00'
root@Amlogic:~/linux_openvfd/driver# source x96-max-plus-vfd.conf
root@Amlogic:~/linux_openvfd/driver# insmod openvfd.ko vfd_gpio_clk=${vfd_gpio_clk} \
                         vfd_gpio_dat=${vfd_gpio_dat} \
                         vfd_gpio_stb=${vfd_gpio_stb:-0,0,0xFF} \
                         vfd_gpio0=${vfd_gpio0:-0,0,0xFF} \
                         vfd_gpio1=${vfd_gpio1:-0,0,0xFF} \
                         vfd_gpio2=${vfd_gpio2:-0,0,0xFF} \
                         vfd_gpio3=${vfd_gpio3:-0,0,0xFF} \
                         vfd_gpio_protocol=${vfd_gpio_protocol:-0,0} \
                         vfd_chars=${vfd_chars} vfd_dot_bits=${vfd_dot_bits} \
                         vfd_display_type=${vfd_display_type}
root@Amlogic:~/linux_openvfd/driver# ../OpenVFDService &

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants