Commit 00250ec9 authored by Andre Przywara's avatar Andre Przywara Committed by Guenter Roeck
Browse files

hwmon: fam15h_power: fix bogus values with current BIOSes

Newer BKDG[1] versions recommend a different initialization value for
the running average range register in the northbridge. This improves
the power reading by avoiding counter saturations resulting in bogus
values for anything below about 80% of TDP power consumption.
Updated BIOSes will have this new value set up from the beginning,
but meanwhile we correct this value ourselves.
This needs to be done on all northbridges, even on those where the
driver itself does not register at.

This fixes the driver on all current machines to provide proper
values for idle load.


Chapter 3.8: D18F5xE0 Processor TDP Running Average (p. 452)
Signed-off-by: default avatarAndre Przywara <>
Acked-by: default avatarJean Delvare <>
[ Removed unnecessary return statement]
Signed-off-by: default avatarGuenter Roeck <>
Cc: # 3.0+
parent e816b57a
......@@ -122,6 +122,38 @@ static bool __devinit fam15h_power_is_internal_node0(struct pci_dev *f4)
return true;
* Newer BKDG versions have an updated recommendation on how to properly
* initialize the running average range (was: 0xE, now: 0x9). This avoids
* counter saturations resulting in bogus power readings.
* We correct this value ourselves to cope with older BIOSes.
static void __devinit tweak_runavg_range(struct pci_dev *pdev)
u32 val;
const struct pci_device_id affected_device = {
* let this quirk apply only to the current version of the
* northbridge, since future versions may change the behavior
if (!pci_match_id(&affected_device, pdev))
PCI_DEVFN(PCI_SLOT(pdev->devfn), 5),
if ((val & 0xf) != 0xe)
val &= ~0xf;
val |= 0x9;
PCI_DEVFN(PCI_SLOT(pdev->devfn), 5),
static void __devinit fam15h_power_init_data(struct pci_dev *f4,
struct fam15h_power_data *data)
......@@ -155,6 +187,13 @@ static int __devinit fam15h_power_probe(struct pci_dev *pdev,
struct device *dev;
int err;
* though we ignore every other northbridge, we still have to
* do the tweaking on _each_ node in MCM processors as the counters
* are working hand-in-hand
if (!fam15h_power_is_internal_node0(pdev)) {
err = -ENODEV;
goto exit;
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