Skip to content

GPIO for AS67XXT (Lockerstor 4 Gen 2) #2

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

Closed
hkdd opened this issue Aug 12, 2022 · 35 comments
Closed

GPIO for AS67XXT (Lockerstor 4 Gen 2) #2

hkdd opened this issue Aug 12, 2022 · 35 comments

Comments

@hkdd
Copy link

hkdd commented Aug 12, 2022

sudo dmidecode -s system-manufacturer
Intel Corporation
sudo dmidecode -s system-product-name
Jasper Lake Client Platform
sudo dmidecode -s bios-vendor
Phoenix Technologies Ltd
sudo dmidecode -s bios-version
V1.14
sudo dmidecode -s bios-release-date
12/02/2021
sudo dmidecode -s bios-revision
0.0

sudo gpinfo returns nothing (cant find any gpio related driver).

dmesg attached
as6704t_dmesg.txt

@hkdd
Copy link
Author

hkdd commented Aug 23, 2022

Booting to a newer kernel (5.19) gave me gpioinfo output (yay!):

gpiochip0 - 340 lines:
line 0: unnamed unused input active-high
line 1: unnamed unused input active-high
line 2: unnamed unused input active-high
line 3: unnamed unused input active-high
line 4: unnamed unused input active-high
[...]
line 335: unnamed unused input active-high
line 336: unnamed unused input active-high
line 337: unnamed unused input active-high
line 338: unnamed unused input active-high
line 339: unnamed unused input active-high

I obviously truncated the output here, but more of the same, except for a little over 200 of the lines being output.

@hkdd
Copy link
Author

hkdd commented Aug 23, 2022

$ lsmod | grep gpio
leds_gpio 16384 0
gpio_ich 16384 0

I have to manually modprobe it87 to get it to load for this device (uses IT8625). modprobing for asustor kernel module gives me:

modprobe: ERROR: could not insert 'asustor': No such device

@odeBuXTeR
Copy link

Hi,

@hkdd I'm interested too by your question.
I'm able to run PVE 7.3 using an other git (https://gist.github.com/johndavisnz/bae122274fc6f0e006fdf0bc92fe6237) and have my fan control working properly. You can take a look on that, it's working pretty fine.

@mafredri Now I'm searching my front panel LEDs to work but I don't find the way to do that.
So, can you make a doc / todo / howto use your findings to act the leds properly ?

Or just explain here what to do.

Thanking you by advance.

@hkdd
Copy link
Author

hkdd commented Dec 31, 2022

@odeBuXTeR Thanks, I'll save that link just in case. Somehow with EL8 fan control worked for me, I think out of the box. It's totally quiet and I've never had any thermal issues.

I'm thinking for the front panel LED my best bet would be to mount the eMMC from linux and poke around in there. I've done it before, it's busybox iirc (been a while). But I didn't really invest enough time in it.

Also, for the sake of anyone searching from Google, this includes models: AS6702T, AS6704T and AS6706T

@mafredri
Copy link
Owner

mafredri commented Jan 1, 2023

Thanks for providing the information @hkdd, I haven't had much time to dedicate to this project lately, unfortunately. When I get some time I'll try to look into adding support (full or partial) for your device.

(If you could include the full output of gpioinfo for both gpio-ich and gpio-it87 as text document attachments or similar, that'd be great.)

@odeBuXTeR @hkdd: This project has a separate branch, containing a module for it87 https://github.com/mafredri/asustor-platform-driver/tree/it87, this branch features DKMS support so it should be able to automatically build for kernel upgrades.

Many guides suggests to use fix_pwm_polarity, but this often has the unwanted side-effect of reversing the polarity (high is low, low is high). With the it87 module in this project no custom fan control scripts should be required.

@odeBuXTeR Front panel LEDs are usually controlled via gpio-it87, so make sure you have that kernel module loaded or build it if it's missing. As for figuring out which pins do what, the options are to 1) try if the same ones for other platforms work (blue/red/green)

GPIO_LOOKUP_IDX(GPIO_IT87, 56, NULL, 0, GPIO_ACTIVE_LOW),
GPIO_LOOKUP_IDX(GPIO_IT87, 8, NULL, 1, GPIO_ACTIVE_LOW),
GPIO_LOOKUP_IDX(GPIO_IT87, 31, NULL, 2, GPIO_ACTIVE_LOW),

The red status indicator (green/red) is often hooked up to CPU GPIOs (e.g. gpio-ich) so that it can be triggered in the event of system failure/panic

GPIO_LOOKUP_IDX(GPIO_AS6100, 21, NULL, 3, GPIO_ACTIVE_HIGH),

Option 2) is to reverse engineer ADM binaries to figure out which pin does what or 3) to experiment by turning pins on/off without knowing what they do (but this can be dangerous/break stuff).

@mafredri
Copy link
Owner

mafredri commented Jan 1, 2023

@odeBuXTeR for verification/experimentation, this document may be helpful: https://github.com/mafredri/asustor-platform-driver/blob/e8b2a5064b99baabf0331d7f1bb8cf3f4cfd617b/research/as6204_it87_gpio_firmware_configuration.md

If you run the following command, you'll see the base address of your GPIOs, e.g. for it87:

for gpio in /sys/class/gpio/gpiochip*; do echo $(cat $gpio/{label,ngpio,base}); done
gpio_it87 64 676

The base is 676, as we can see (with a total of 64 pins).

If we look at blue power led (from the document), for instance.

echo $(($(</sys/class/gpio/gpiochip676/base) + 56)) > /sys/class/gpio/export
echo out > /sys/class/gpio/it87_gp80/direction
echo 0 > /sys/class/gpio/it87_gp80/value
# Did something happen?
echo 1 > /sys/class/gpio/it87_gp80/value
# Did something happen?

The above would verify if your blue led is controlled by the same pin as on the AS62XXT/AS6XXT.

@odeBuXTeR
Copy link

odeBuXTeR commented Jan 1, 2023

I've got the Intel SuperIO mapping, not the it87 ...

# for gpio in /sys/class/gpio/gpiochip*; do echo $(cat $gpio/{label,ngpio,base}); done
INT34C8:00 340 684

The "modprobe gpio-it87" do nothing, even if the verbose command :/

@mafredri
Copy link
Owner

mafredri commented Jan 1, 2023

@odeBuXTeR is that a different NAS model than mentioned here? If yes, it would be great if you could open a new issue and provide the information listed in the readme.

@odeBuXTeR
Copy link

Just a thing, i'm on pve distrib (Proxmox), with an edge Kernel. Is there a link with the matters ?

@odeBuXTeR
Copy link

@odeBuXTeR is that a different NAS model than mentioned here? If yes, it would be great if you could open a new issue and provide the information listed in the readme.

The model of my NAS is realy the AS6702T

@mafredri
Copy link
Owner

mafredri commented Jan 1, 2023

Just a thing, i'm on pve distrib (Proxmox), with an edge Kernel. Is there a link with the matters ?

Nah, that’s not the problem. Most likely your IT87 chip isn’t supported by the in-kernel gpio-it87 driver.

The gpio driver is less popular than the IT87 hwmon driver, so doesn’t look like there are many people developing it. I’ll try to look around if I can find something or if it’d be way to patch in.

@odeBuXTeR
Copy link

The chip is an IT8625E if it could help

it8625-isa-0a30
Adapter: ISA adapter
in0: 1.52 V (min = +0.00 V, max = +2.76 V)
in1: 1.49 V (min = +2.73 V, max = +0.40 V) ALARM
in2: 2.04 V (min = +2.37 V, max = +1.87 V) ALARM
in3: 2.02 V (min = +2.35 V, max = +1.69 V) ALARM
in4: 1.93 V (min = +2.57 V, max = +1.29 V) ALARM
in5: 1.84 V (min = +0.99 V, max = +0.60 V) ALARM
in6: 1.75 V (min = +1.75 V, max = +1.46 V) ALARM
3VSB: 3.32 V (min = +1.10 V, max = +0.22 V) ALARM
Vbat: 3.12 V
+3.3V: 3.32 V
fan1: 2884 RPM (min = 12 RPM)
fan2: 0 RPM (min = 89 RPM) ALARM
fan3: 0 RPM (min = 12 RPM) ALARM
temp1: -128.0°C (low = -51.0°C, high = -82.0°C)
temp2: -128.0°C (low = -12.0°C, high = -65.0°C)
temp3: -128.0°C (low = +119.0°C, high = -35.0°C)
intrusion0: ALARM

@hkdd
Copy link
Author

hkdd commented Jan 1, 2023

@odeBuXTeR I have a similar model to you (Lockerstor 4 Gen 2) running kernel 5.19.1 and my gpio device is:

/sys/bus/gpio/devices/gpiochip0 which is a symlink to /sys/devices/platform/INT34C8:00

This appears to be: Intel(R) Serial IO GPIO Host Controller - INT34C8

modalias tells me its acpi:INT34C8 which appears to be associated with the following kernel module for my kernel
$ lsmod | grep int3
int340x_thermal_zone 20480 1 processor_thermal_device

Or at least a gpio device, anyway. This is the only gpio device that show up for me.

@hkdd
Copy link
Author

hkdd commented Jan 1, 2023

In case this is helpful at all:

$ pwd
/sys/devices/platform/INT34C8:00
$ tree
.
├── driver -> ../../../bus/platform/drivers/jasperlake-pinctrl
├── driver_override
├── firmware_node -> ../../LNXSYSTM:00/LNXSYBUS:00/INT34C8:00
├── gpiochip0
│   ├── dev
│   ├── firmware_node -> ../../../LNXSYSTM:00/LNXSYBUS:00/INT34C8:00
│   ├── power
│   │   ├── autosuspend_delay_ms
│   │   ├── control
│   │   ├── runtime_active_time
│   │   ├── runtime_status
│   │   └── runtime_suspended_time
│   ├── subsystem -> ../../../../bus/gpio
│   ├── uevent
│   └── waiting_for_supplier
├── modalias
├── power
│   ├── autosuspend_delay_ms
│   ├── control
│   ├── runtime_active_time
│   ├── runtime_status
│   └── runtime_suspended_time
├── subsystem -> ../../../bus/platform
└── uevent

@odeBuXTeR
Copy link

That's right, the Intel SuperIO give me all the thermal informations that I need, it's not what I'm searching for, I just want to use the front panel's leds in order to prevent me of an an eventual crash or so, and stop this awful continuous green blinking led !!! :-)

Package id 0: +72.0°C (high = +105.0°C, crit = +105.0°C)
Core 0: +72.0°C (high = +105.0°C, crit = +105.0°C)
Core 1: +72.0°C (high = +105.0°C, crit = +105.0°C)
Core 2: +72.0°C (high = +105.0°C, crit = +105.0°C)
Core 3: +72.0°C (high = +105.0°C, crit = +105.0°C)

@hkdd
Copy link
Author

hkdd commented Jan 1, 2023

Yeah same. Luckily I don't have to stare at the NAS but the green blinking definitely bugs me when I see it. Plus I'd love to do fun stuff with it.

@mafredri
Copy link
Owner

mafredri commented Jan 1, 2023

That's right, the Intel SuperIO give me all the thermal informations that I need, it's not what I'm searching for, I just want to use the front panel's leds in order to prevent me of an an eventual crash or so, and stop this awful continuous green blinking led !!! :-)

@odeBuXTeR That LED is controlled via IT8625E GPIOs. The only way to get change it is to re-configure the GPIO, e.g. via the gpio-it87 driver. However, since your chip isn't supported, it won't show up as a gpiochip.

We could try something like modifying https://github.com/torvalds/linux/blob/e4cf7c25bae5c3b5089a3c23a897f450149caef2/drivers/gpio/gpio-it87.c#L300-L301 and add the chip ID, but we'd be guessing as to how the chip should be configured. There's unfortunately no official datasheet available for IT8625E so experimentation is the only way forward (or asking for help from someone with access to the datasheet).

@odeBuXTeR
Copy link

odeBuXTeR commented Jan 4, 2023

20191124192423738
20191125234314280
20191127002902710
2e75a5597bb6dab64c89ea52c4467f00
40c64503be7450ec0d59a02da486ba5a
83c81b7150355c9f3669ef36d8b9966d
b224f2d43779aa2f264be2af14170ad5

I found this documents.

The truth is in the mmc drive at all, I'll mount the drive and check what I can find there.

@phjz
Copy link

phjz commented Mar 18, 2023

I'm totally missed this conversation until now, sorry. All the LED GPIOs found ( except the blinking green status led and LAN leds), the FAN, the buttons and display working well from about a month on my machine. The only thing I done: modified mafredri's project to contain the IT8625E and determine the GPIO# for each led ( and wrote a small node.js program to drive the display). Additionally for me using kernel 5.15 was necessary to disable the original it87.ko driver which loaded and partially worked. Now on kernel 5.19 with DKMS the three kernel module also working well. Detailed information and the code on the https://github.com/phjz/AS6704T page. Once again: the majority of the code originated from mafredri, thanks! Regarding the Status GPIO: for me the above info about the BREATH LED theoretically can solve the problem, just need to clarify how to reach the registers from kernel and must play with the settings...

@hendrics
Copy link

@phjz the link in your post is missing a 4 as in https://github.com/phjz/AS6704T

@phjz
Copy link

phjz commented Jul 22, 2023

@hendrics: thank you, corrected....

@DanielGibson
Copy link
Contributor

I got the green LED to switch off in my branch: https://github.com/DanielGibson/asustor-platform-driver/tree/it87-jasperlake

(with my patched asustor_it87 kernel module, echo 0 | sudo tee /sys/class/hwmon/hwmon3/gpled1_blink disables blinking; echo 47 | sudo tee /sys/class/hwmon/hwmon3/gpled1_blink enables it again for the status LED, because it is it_gp47. Haven't figured out yet how to make it light up continuously.)

@odeBuXTeR
Copy link

That's a realy good news ! I'll test that ASAP ! 👍 But how did you find that ? You finally got the datasheets ?

@DanielGibson
Copy link
Contributor

DanielGibson commented Oct 22, 2023

A combination of the stuff you posted, a (google-translated) chinese blogpost and the datasheets for the IT8720F, see links at top of https://github.com/DanielGibson/asustor-platform-driver/blob/it87-jasperlake/research/LED-Blinking.txt

(well, and a certain amount of stubbornness, of course)

@DanielGibson
Copy link
Contributor

@odeBuXTeR have you been able to test this yet?

@odeBuXTeR
Copy link

Sorry, I was waiting to update my kernel before testing, I just did it now for the occasion ! And test your driver ...
That's all folks, goodby awful blinking !! It's working yes !
Thank you 👍

I just lost my processor frequencies in my home assistant panel, but upgrading a kernel and install a new driver ... Who do that at the same time ??? But that's not the priority :)

@DanielGibson
Copy link
Contributor

DanielGibson commented Oct 30, 2023

Great, thanks for testing! :)
So this is known to work on AS6702T (tested by you) and AS5402T (tested by me) - I hope that AS660xT (and maybe even FS6706T) will also be tested eventually

@mafredri
Copy link
Owner

Closing this thanks to @DanielGibson awesome work in #6. 🎉 Also thanks to you @hkdd and @odeBuXTeR for all the information you contributed.

@odeBuXTeR
Copy link

odeBuXTeR commented Dec 17, 2023 via email

@DanielGibson
Copy link
Contributor

DanielGibson commented Dec 13, 2024

Hi, I need the output of sudo lspci -nn for the AS6702T and AS6704T,
because it turned out to be really hard to tell AS67xx and the NVME-only FS67xx apart, see #27.

@odeBuXTeR could you provide the output for the AS6702T?
@hkdd @phjz could one of you (or ideally both) provide the output for the AS6704T?

Thank you very much in advance!

@odeBuXTeR
Copy link

odeBuXTeR commented Dec 14, 2024 via email

@phjz
Copy link

phjz commented Dec 14, 2024

as requested: AS6704T
00:00.0 Host bridge [0600]: Intel Corporation Device [8086:4e24]
00:02.0 VGA compatible controller [0300]: Intel Corporation JasperLake [UHD Graphics] [8086:4e61] (rev 01)
00:04.0 Signal processing controller [1180]: Intel Corporation Dynamic Tuning service [8086:4e03]
00:05.0 Multimedia controller [0480]: Intel Corporation JasperLake IPU [8086:4e19]
00:08.0 System peripheral [0880]: Intel Corporation Device [8086:4e11]
00:14.0 USB controller [0c03]: Intel Corporation Device [8086:4ded] (rev 01)
00:14.2 RAM memory [0500]: Intel Corporation Device [8086:4def] (rev 01)
00:15.0 Serial bus controller [0c80]: Intel Corporation Serial IO I2C Host Controller [8086:4de8] (rev 01)
00:15.2 Serial bus controller [0c80]: Intel Corporation Device [8086:4dea] (rev 01)
00:16.0 Communication controller [0780]: Intel Corporation Management Engine Interface [8086:4de0] (rev 01)
00:19.0 Serial bus controller [0c80]: Intel Corporation Device [8086:4dc5] (rev 01)
00:19.1 Serial bus controller [0c80]: Intel Corporation Device [8086:4dc6] (rev 01)
00:1a.0 SD Host controller [0805]: Intel Corporation Device [8086:4dc4] (rev 01)
00:1c.0 PCI bridge [0604]: Intel Corporation Device [8086:4db8] (rev 01)
00:1c.2 PCI bridge [0604]: Intel Corporation Device [8086:4dba] (rev 01)
00:1c.3 PCI bridge [0604]: Intel Corporation Device [8086:4dbb] (rev 01)
00:1c.4 PCI bridge [0604]: Intel Corporation Device [8086:4dbc] (rev 01)
00:1c.5 PCI bridge [0604]: Intel Corporation Device [8086:4dbd] (rev 01)
00:1e.0 Communication controller [0780]: Intel Corporation Device [8086:4da8] (rev 01)
00:1e.3 Serial bus controller [0c80]: Intel Corporation Device [8086:4dab] (rev 01)
00:1f.0 ISA bridge [0601]: Intel Corporation Device [8086:4d87] (rev 01)
00:1f.3 Audio device [0403]: Intel Corporation Device [8086:4dc8] (rev 01)
00:1f.4 SMBus [0c05]: Intel Corporation JaserLake SMBus [8086:4da3] (rev 01)
00:1f.5 Serial bus controller [0c80]: Intel Corporation JaserLake SPI (flash) Controller [8086:4da4] (rev 01)
01:00.0 SATA controller [0106]: ASMedia Technology Inc. Device [1b21:1164] (rev 02)
02:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL8125 2.5GbE Controller [10ec:8125] (rev 05)
03:00.0 Ethernet controller [0200]: Realtek Semiconductor Co., Ltd. RTL8125 2.5GbE Controller [10ec:8125] (rev 05)
04:00.0 Non-Volatile memory controller [0108]: Kingston Technology Company, Inc. Device [2646:501c] (rev 01)
05:00.0 Non-Volatile memory controller [0108]: Kingston Technology Company, Inc. Device [2646:5017] (rev 03)

@DanielGibson
Copy link
Contributor

Thank you very much!

To support the FS6706T and FS6712X Flashtor devices (that have different LEDs than the AS67xx devices, but also identify as "Intel Corporation" - "Jasper Lake Client Platform"), I had to do lots of changes to the device detection logic.
It would be great if you could test them to make sure all the AS67xx devices are still detected correctly, see #27 (comment)

@odeBuXTeR
Copy link

odeBuXTeR commented Dec 14, 2024 via email

@DanielGibson
Copy link
Contributor

Thank you!
It indeed uses the same Intel SATA Controller as my AS5402T, so my new detection logic should work - though of course I'd feel even more confident about it if it got some more testing ;)

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

6 participants