Commit 436cad2a authored by Jean Delvare's avatar Jean Delvare

hwmon: (it87) Fix in7 on IT8720F

The IT8720F has no VIN7 pin, so VCCH should always be routed
internally to VIN7 with an internal divider. Curiously, there still
is a configuration bit to control this, which means it can be set
incorrectly. And even more curiously, many boards out there are
improperly configured, even though the IT8720F datasheet claims that
the internal routing of VCCH to VIN7 is the default setting. So we
force the internal routing in this case.

It turns out that all boards with the wrong setting are from Gigabyte,
so I suspect a BIOS bug. But it's easy enough to workaround in the
driver, so let's do it.
Signed-off-by: default avatarJean Delvare <khali@linux-fr.org>
Cc: Jean-Marc Spaggiari <jean-marc@spaggiari.org>
Cc: stable@kernel.org
parent d535bad9
...@@ -80,6 +80,13 @@ superio_inb(int reg) ...@@ -80,6 +80,13 @@ superio_inb(int reg)
return inb(VAL); return inb(VAL);
} }
static inline void
superio_outb(int reg, int val)
{
outb(reg, REG);
outb(val, VAL);
}
static int superio_inw(int reg) static int superio_inw(int reg)
{ {
int val; int val;
...@@ -1517,6 +1524,21 @@ static int __init it87_find(unsigned short *address, ...@@ -1517,6 +1524,21 @@ static int __init it87_find(unsigned short *address,
sio_data->vid_value = superio_inb(IT87_SIO_VID_REG); sio_data->vid_value = superio_inb(IT87_SIO_VID_REG);
reg = superio_inb(IT87_SIO_PINX2_REG); reg = superio_inb(IT87_SIO_PINX2_REG);
/*
* The IT8720F has no VIN7 pin, so VCCH should always be
* routed internally to VIN7 with an internal divider.
* Curiously, there still is a configuration bit to control
* this, which means it can be set incorrectly. And even
* more curiously, many boards out there are improperly
* configured, even though the IT8720F datasheet claims
* that the internal routing of VCCH to VIN7 is the default
* setting. So we force the internal routing in this case.
*/
if (sio_data->type == it8720 && !(reg & (1 << 1))) {
reg |= (1 << 1);
superio_outb(IT87_SIO_PINX2_REG, reg);
pr_notice("it87: Routing internal VCCH to in7\n");
}
if (reg & (1 << 0)) if (reg & (1 << 0))
pr_info("it87: in3 is VCC (+5V)\n"); pr_info("it87: in3 is VCC (+5V)\n");
if (reg & (1 << 1)) if (reg & (1 << 1))
......
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