Commit 2d99925a authored by Guenter Roeck's avatar Guenter Roeck

hwmon: (nct6775) Separate fan/pwm configuration detection for NCT6793D

While detecting the configuration for multiple chips in one go reduces
code size, it also increases code complexity. Separate chip detection
to improve code readability. As first step, separate detection for
NCT6793D.

No functional change.
Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent 7dcdbdeb
...@@ -3530,6 +3530,17 @@ nct6775_check_fan_inputs(struct nct6775_data *data) ...@@ -3530,6 +3530,17 @@ nct6775_check_fan_inputs(struct nct6775_data *data)
pwm6pin = !dsw_en && (cr2d & BIT(0)); pwm6pin = !dsw_en && (cr2d & BIT(0));
break; break;
case nct6793: case nct6793:
fan5pin |= cr1b & BIT(5);
fan5pin |= creb & BIT(5);
fan6pin = creb & BIT(3);
pwm5pin |= cr2d & BIT(7);
pwm5pin |= (creb & BIT(4)) && !(cr2a & BIT(0));
pwm6pin = !dsw_en && (cr2d & BIT(0));
pwm6pin |= creb & BIT(2);
break;
case nct6795: case nct6795:
case nct6796: case nct6796:
pwm5pin |= cr2d & BIT(7); pwm5pin |= cr2d & BIT(7);
...@@ -3546,11 +3557,9 @@ nct6775_check_fan_inputs(struct nct6775_data *data) ...@@ -3546,11 +3557,9 @@ nct6775_check_fan_inputs(struct nct6775_data *data)
pwm6pin |= creb & BIT(2); pwm6pin |= creb & BIT(2);
} }
if (data->kind == nct6795 || data->kind == nct6796) {
fan6pin |= (cr2a & BIT(4)) && fan6pin |= (cr2a & BIT(4)) &&
(!dsw_en || (cred & BIT(4))); (!dsw_en || (cred & BIT(4)));
pwm6pin |= (cr2a & BIT(3)) && (cred & BIT(2)); pwm6pin |= (cr2a & BIT(3)) && (cred & BIT(2));
}
if (data->kind == nct6796) { if (data->kind == nct6796) {
fan7pin = !(cr2b & BIT(2)); fan7pin = !(cr2b & BIT(2));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment