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
ITE SuperIO fan control #72
Conversation
Any update on this ? I know it's not yet ready for merge, just looking for guidance on how I should expose the configuration and other things. |
Are you sure you add the SMC keys in ASCII sorted order? This is a documented requirement. I think x goes before d, thus adding keys in the wrong order corrupts VSMC. |
As for configuration, I think your best is injecting device properties into the EC device. Could you please outline the suggestions you have in mind, and I guess we can handle it. |
That worked thanks, finally fixed it and can restore system fan control.
Here is my suggestion.
Also FYI, LibreHardwareMonitor source shows that some recent Gigabyte motherboards have an additional controller that needs to be disabled https://github.com/LibreHardwareMonitor/LibreHardwareMonitor/blob/master/LibreHardwareMonitorLib/Hardware/Motherboard/Lpc/GigabyteController.cs , not planning on implementing this though |
That sounds about right, I am not sure whether this should be just |
Also fix memcpy overflow
Used to configure RPM->PWM curve
@vit9696 Hi I was able to successfully implement everything I said I'm just using linear interpolation for figuring out the PWM values, works good void computeCurve(uint8_t index) {
for (int i = 0; i <= 255; i++) {
if (_pwmCurve[index][i] == UINT16_MAX)
continue;
for (int j = i + 1; j <= 255; j++) {
if (_pwmCurve[index][j] == UINT16_MAX)
continue;
// No points in between
if (j == i + 1)
break;
// We have the 2 points now so lets interpolate in between them.
for (int k = i + 1; k <= j ; ++k) {
_pwmCurve[index][k] = lerp(_pwmCurve[index][i], _pwmCurve[index][j], (float)(k - i) / (float)(j - i));
}
i = j - 1;
break;
}
}
} You can probably see in my screenshot that PWM/RPM curve of the fan isn't exactly linear so the values are off, need to add more values to the Shouldn't some of this code be shared in |
A tool might make some sense I guess, yeah. I am not positive it is a good idea to put this to the driver itself. |
@vit9696 I plan on making it into an external tool like |
values seem to be a bit off, investigating it
I've added
Probably need to move the |
I was also considering adding voltage reading because it's easy to read raw voltages. But every motherboard uses different input resistance, reference resistance and reference voltage. LibreHardwareMonitor has a list of them for many motherboards though https://github.com/LibreHardwareMonitor/LibreHardwareMonitor/blob/master/LibreHardwareMonitorLib/Hardware/Motherboard/SuperIOHardware.cs It would probably be too much configuration to expose with DeviceProperties so instead would need to use a .plist "SuperIO layout" which could also contain fan hide/control layout. So I dropped that idea because it would be alot of effort to expose the configuration. And also unsure about the correct SMC keys to use for 3.3V/5V/12V/RTC battery because they seem to differ across models. So far what I found that exists on actual Macs. I couldn't find a MacPro7,1 dump tho
Can't find anything for RTC battery tho which sucks. I don't know of any other way it can be exposed |
For voltages we thought of going the tool way. I.e. we built a database here: https://github.com/CloverHackyColor/HWMonitorSMC2/tree/master/LPC |
HWMonitorSMC2 does work for me after making a configuration. But it seems like the project is dead as PRs are no longer being answered and last update is from 2020. |
That's a difficult question, perhaps somebody needs to take over. |
@xCuri0 can you make this work for Nuvoton chips as well? |
@Lorys89 If I do upgrade to a newer motherboard with Nuvoton chip yes. You should try looking at the LibreHardwareMonitor source it's not too hard to adapt it here. |
Working fan control for ITE SuperIOs
There are some issues however.
I can't figure out how to add the F#Md key without messing up all the SMC fan keys. For this reason it's commented out and it's not possible to restore automatic fan control by motherboard unless you reboot.Hardcoded RPM ranges.Control index doesn't always match the tachometer index which you can see in my screenshot (Fan Main uses control of Fan 2).So far it's only been tested on my Gigabyte B75M-D3H (IT8728F) but it should work on most ITE SuperIOs. I've used LibreHardwareMonitor's code to as a reference for the registers, etc.
I'm also looking for suggestions of how to expose configuration (rpm/pwm curve, correcting index, hiding fans, etc). Currently planning on doing something similar to how it's done for EC Device.Configurable through
fan#-hide
(hide fan),fan#-control
(set control index) andfan#-pwm
(pwm curve)