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

Q: How to compile? #5

Closed
lucky62 opened this issue May 16, 2021 · 20 comments
Closed

Q: How to compile? #5

lucky62 opened this issue May 16, 2021 · 20 comments

Comments

@lucky62
Copy link

@lucky62 lucky62 commented May 16, 2021

Hello, I would like to compile this driver for my RK3318 based TV box running Armbian.

I already have the armbian source downloaded from here and compiled.

How to include this driver into kernel tree correctly and compile as module?

Here is the similar driver and I read:

To use this driver, copy the subdirectory vfd into AMLogic kernel tree, into the directory drivers/amlogic/input/.

So should I copy the driver directory somewhere into Rockchip kernel tree? Where exactly?
How to compile the service?

Sorry for the newbie questions...

@arthur-liberman
Copy link
Owner

@arthur-liberman arthur-liberman commented May 16, 2021

This driver was originally intended for CoreELEC, but I think it should work for any other ARM based Linux build.
This is the package file: https://github.com/CoreELEC/CoreELEC/blob/coreelec-19/projects/Amlogic-ce/packages/linux-drivers/openvfd-driver/package.mk
Basically:
make ARCH=$TARGET_KERNEL_ARCH CROSS_COMPILE=$TARGET_KERNEL_PREFIX -C "$(kernel_path)" M="$(package_path)/driver"

@lucky62
Copy link
Author

@lucky62 lucky62 commented May 16, 2021

Thanks for the quick answer. Still not fully clear to me what to do...
Need I to download package (complete directory?) and execute the command in the driver directory?
From where will be the parameters obtained? What should be the values?...

@arthur-liberman
Copy link
Owner

@arthur-liberman arthur-liberman commented May 16, 2021

ARCH should be aarch64 if your kernel is arm64 or arm if it's 32bit.
CROSS_COMPILE is only relevant in case you are building on x86 for example, and depends on your buildtools.

@lucky62
Copy link
Author

@lucky62 lucky62 commented May 16, 2021

Yes, I am building on x86 (my Linux Mint). In the kernel build directory I have these:

armbian_source/cache/toolchain:
gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu
gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf
gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu
gcc-arm-9.2-2019.12-x86_64-arm-none-linux-gnueabihf
gcc-linaro-aarch64-none-elf-4.8-2013.11_linux
gcc-linaro-arm-linux-gnueabihf-4.8-2014.04_linux
gcc-linaro-arm-none-eabi-4.8-2014.04_linux
gcc-linaro-7.4.1-2019.02-x86_64_aarch64-linux-gnu
gcc-linaro-7.4.1-2019.02-x86_64_arm-linux-gnueabi

Tools were downloaded by armbian build tool.
Which one I need to use and what will be the CROSS_COMPILE parameter?

@arthur-liberman
Copy link
Owner

@arthur-liberman arthur-liberman commented May 16, 2021

In CoreELEC it's:
ARCH - arm64
CROSS_COMPILE - gcc-arm-aarch64-none-linux-gnu/bin/aarch64-none-linux-gnu-
So I guess that in your case it should be gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu

@lucky62
Copy link
Author

@lucky62 lucky62 commented May 17, 2021

Thanks for helping.
One more question - Are the DTB settings mandatory or can driver work only with config file?

Note: In the DTB from original firmware (Android) was this:

skykirin_led {
compatible = "skykirin-ht1628";
spi_clk = <0x8a 0x13 0x00>;
spi_cs = <0x8a 0x12 0x00>;
spi_data = <0x8a 0x16 0x00>;
status = "okay";
};

@arthur-liberman
Copy link
Owner

@arthur-liberman arthur-liberman commented May 17, 2021

You must have an openvfd entry in the dtb.
See here:
https://github.com/CoreELEC/linux-amlogic/blob/amlogic-4.9-19/arch/arm64/boot/dts/amlogic/coreelec_common.dtsi#L149
You can place the pin settings in the DTB or provide them as a configuration parameter when loading the driver.

@lucky62
Copy link
Author

@lucky62 lucky62 commented May 19, 2021

Hello, good news.
Today I successfully compiled the driver for the armbian an found the proper config for my TV box.
It is a cheap X88 Pro 10 model based on Rockchip RK3318. It has a HT1628 controller. LED display has 4 digits (clock) + Power, LAN, WiFi-Lo and Wifi-Hi indicators.

Thanks for valuable help.

This is my config in Device Tree Overlay:

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

Just the indicators have the wrong names. When I tried to switch the leds by command:

echo LedName > /sys/class/leds/openvfd/led_on (or off)

then I found this mapping:

LED Name  ->  Real Indicator
----------------------------
     usb  ->  LAN
      sd  ->  Power
    hdmi  ->  WiFi-Hi
    cvbs  ->  WiFi-Lo

Probably I should use the different display type...?

X88Pro10_LED_Display

@arthur-liberman
Copy link
Owner

@arthur-liberman arthur-liberman commented May 19, 2021

Display type should be 0x03

DISPLAY_TYPE_5D_7S_ABOX,

dev->status_led_mask = state ? (dev->status_led_mask | dtb->led_dots[LED_DOT3_WIFIHI] | dtb->led_dots[LED_DOT3_WIFILO]) : (dev->status_led_mask & ~(dtb->led_dots[LED_DOT3_WIFIHI] | dtb->led_dots[LED_DOT3_WIFILO]));

@lucky62
Copy link
Author

@lucky62 lucky62 commented May 20, 2021

Display type should be 0x03

Thanks. That's the right type.
I also reverted back the dot bits.

            openvfd_dot_bits = [00 01 02 03 04 05 06];
            openvfd_display_type = <0x03>;

@arthur-liberman
Copy link
Owner

@arthur-liberman arthur-liberman commented May 21, 2021

Since you have managed to get everything working correctly, I will close this.

@huafu
Copy link

@huafu huafu commented May 25, 2021

Sorry to post here, but I don't see a fork of this or armbian @lucky62 on your profile. I do have the same box of you, I've managed to install armbian buster on it with linux 5.x. Wifi is working but I'm trying to get latest kodi (so HW acceleration) and having also this driver working would be great.

Can you share your work, or at least drop some directions on how you did, also share your progress on that box? Also I see on the picture that you have added a fan, is it plugged on an external power?

Thanks in advance, and sorry again for posting here.

@lucky62
Copy link
Author

@lucky62 lucky62 commented May 25, 2021

@huafu, we are discussing: here, post your questions to that forum, I will respond.

@huafu
Copy link

@huafu huafu commented May 25, 2021

Thanks a lot, I found the thread like an hour ago. After reading from the begining, I subscribed and posted there, tho since it's my first post it needs to be validated by a moderator so you won't see it until then.

@danboid
Copy link

@danboid danboid commented Jun 17, 2021

Hi @lucky62

I'm trying to configure openvfd to my X96 Air. I wondering how you found the correct gpio values, if you didn't use exactly the same ones copy/pasted from your boxes Android dts?

For my X96 Air, the Android vfd dts code looks like:

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

Will I need to replace the first GPIO values with values similar to yours?

Also, do you have any tips on selecting the correct display type? Did you have to just try them all to find the best fit?

#8

Thanks for your help!

@lucky62
Copy link
Author

@lucky62 lucky62 commented Jun 17, 2021

Hi @danboid, I am not the expert...
But I am 100% sure that guys from armbian forum will help you. Link to forum is few posts above...

About the display type, post the photo of display here...

@danboid
Copy link

@danboid danboid commented Jun 17, 2021

I shall try asking on the Armbian forum but Armbian doesn't support Amlogic TV boxes any more. I could try on the Manjaro forum too but I know that the Manjaro amlogic dev doesn't own any TV boxes with a vfd display.

This is my display:

https://user-images.githubusercontent.com/1429783/122049855-cc5acf00-cdda-11eb-9fc1-972c9bb1294f.jpg

@lucky62
Copy link
Author

@lucky62 lucky62 commented Jun 17, 2021

sorry, my mistake, I thought that you have a Rockchip...
you can try the LibreElec forum also...

@lucky62
Copy link
Author

@lucky62 lucky62 commented Jun 17, 2021

This may be helpful:

# Display Type 2 usually has APPS, USB, SETUP, CARD, Col, HDMI, CVBS dots
# APPS = 0, USB = 1, SETUP = 2, CARD = 3, Col = 4, HDMI = 5, CVBS = 6

from here: https://github.com/arthur-liberman/vfd-configurations

@danboid
Copy link

@danboid danboid commented Jun 17, 2021

Yes that is helpful but I can't see that info on the page you linked to?

Thanks!

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

Successfully merging a pull request may close this issue.

None yet
4 participants