Skip to content

Commit 539ad00

Browse files
ChiaYuShihgroeck
authored andcommitted
hwmon: (nct7904) Fix the incorrect value of vsen_mask in nct7904_data struct
Voltage sensors overlap with external temperature sensors. Detect the multi-function of voltage, thermal diode and thermistor from register VT_ADC_MD_REG to set value of vsen_mask in nct7904_data struct. Signed-off-by: amy.shih <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Guenter Roeck <[email protected]>
1 parent 54ecb8f commit 539ad00

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

drivers/hwmon/nct7904.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -915,12 +915,15 @@ static int nct7904_probe(struct i2c_client *client,
915915

916916
data->temp_mode = 0;
917917
for (i = 0; i < 4; i++) {
918-
val = (ret & (0x03 << i)) >> (i * 2);
918+
val = (ret >> (i * 2)) & 0x03;
919919
bit = (1 << i);
920-
if (val == 0)
920+
if (val == 0) {
921921
data->tcpu_mask &= ~bit;
922-
else if (val == 0x1 || val == 0x2)
923-
data->temp_mode |= bit;
922+
} else {
923+
if (val == 0x1 || val == 0x2)
924+
data->temp_mode |= bit;
925+
data->vsen_mask &= ~(0x06 << (i * 2));
926+
}
924927
}
925928

926929
/* PECI */

0 commit comments

Comments
 (0)