Closed SergeyMy closed 8 months ago
NCT6683 and NCT6687
//0-7bit=pwm0-pwm7, 0 - normal 1 - bypass_mode
#define NCT6687_REG_FAN_CTRL_MODE 0xA00
#define NCT6687_REG_FAN_PWM_COMMAND 0xA01
#define NCT6687_FAN_CFG_REQ 0x80
#define NCT6687_FAN_CFG_DONE 0x40
nct6687_write(data, NCT6687_REG_FAN_PWM_COMMAND, NCT6687_FAN_CFG_REQ);
msleep(50);
nct6687_write(data, NCT6687_REG_PWM_WRITE(index), val);
nct6687_write(data, NCT6687_REG_FAN_PWM_COMMAND, NCT6687_FAN_CFG_DONE);
NCT6687 -Ok NCT6683 -Fail
nct6687_write(data, NCT6687_REG_FAN_PWM_COMMAND, NCT6687_FAN_CFG_REQ);
msleep(50);
nct6687_write(data, NCT6687_REG_PWM_WRITE(index), val);
// nct6687_write(data, NCT6687_REG_FAN_PWM_COMMAND, NCT6687_FAN_CFG_DONE); //return to auto-mode (clear 0xA00, clear 0xA28-0xA2F)
nct6687_write(data, NCT6687_REG_FAN_PWM_COMMAND, 0x00); //manual mode
NCT6683D-OK! (NCT6683D EC firmware version 1.0 build 08/21/17) NCT6687D-OK! (NCT6687D EC firmware version 1.0 build 05/07/20) NCT6686D who would check.
based on above...functions save_fan_control restore_fan_control not only do not make sense ( REG_FAN_CTRL_MODE REG_FAN_PWM_COMMAND REG_PWM_WRITE can be changed both by NCT66* itself and externally using the same ACPI mechanism) but can also be harmful (dangerous)
ps disabled these save_fan_control restore_fan_control functions and removed the control functionality from store_pwm and added SENSOR_TEMPLATE(pwm_bypass, "pwm%d_bypass", S_IRUGO, show_pwm_bypass, store_pwm_bypass, 0);
I think it turned out great
//tested on nct6687 0xb00-0xc00 PLF (piecewise linear function)
#define NCT6683_REG_PLF(x) (0xb00 + (x) * 24)
NCT6683_REG_PLF(x)+Y = pwm(x+1)_auto_point(Y+1)_temp NCT6683_REG_PLF(x)+8+**Y*2 = pwm(x+1)_auto_point(Y+1**)_pwm
example: My BIOS only controls 5 PWM... 22-24 bytes mean something, but I'm not sure what I know yet :)
RW area but protected
#define NCT6683_REG_FAN_CFG_CTRL 0xa01
#define NCT6683_FAN_CFG_REQ 0x80
#define NCT6683_FAN_CFG_DONE 0x00 //! tested on 6683 6687
...
mutex_lock(&data->update_lock);
nct6683_write(data, NCT6683_REG_FAN_CFG_CTRL, NCT6683_FAN_CFG_REQ);
usleep_range(2000, 5000);
nct6683_write(data, 0xb00, 0x27); //<<----protected recording
nct6683_write(data, NCT6683_REG_FAN_CFG_CTRL, NCT6683_FAN_CFG_DONE);
mutex_unlock(&data->update_lock);
@Fred78290 Should I continue or have you closed your eyes to this project?
@SergeyMy
I don't closed my eyes on this project :)
A little busy and submerged by email to be notified :)
//tested on nct6687 nct6683 linear function, overlaps all others
RW area but protected (NCT6683_FAN_CFG_REQ -> NCT6683_FAN_CFG_DONE)
VALUE CRITICAL
1 2 3 4 5 ....
0x9a0: 60 65 65 65 65 00 00 00 00 00 00 00 00 00 00 00 MAX 101C (0x65) = alarm(C) for pwm max
0x9d0: 03 03 03 03 03 00 00 00 00 00 00 00 00 00 00 00 3C =hysteresis
#define NCT6683_REG_CRITICAL_TEMP(x) (0x9a0 + (x)) /* 8 bit celsium*/
...
sprintf(buf + len,"Crit:%3dC ", nct6683_read(data, NCT6683_REG_CRITICAL_TEMP(numplf-1)) );
//tested on nct6687, nct6683 was not confirmed //RO? I was unable to change this block, where there should be an unlock ctrl :( PWM DC/PWM (pwm[]_mode) 1=DC 0=PWM 0x2f4.0 PWM1 0x2f4.1 PWM2 0x2f4.2 PWM3 ... 0x2f4.7 PWM8
//tested on nct6687 nct6683 pwm source select (pwm[1-*]_auto_channels_temp) 20 - (temp6) PCIE 01 - (temp1) CPUcore (CPU) 02 - (temp2) System (CPU_sock) ... 0x917 PWM2 0x91B PWM3 ...
//tested on nct6687 nct6683 source PV (PrimaryValue for PLF) (celsium) //result source selec ((pwm[1-*]_auto_channels_temp)
0xca0 PLF1 0xca1 PLF2 ...
@Fred78290 How do you feel about reverse engineering? I didn’t find documentation for 6687 and I think you don’t have it either, but there are some nuances :)