diff mbox

[Oneiric,SRU,3/4] hwmon: fam15h_power: fix bogus values with current BIOSes

Message ID 1339684979-11086-3-git-send-email-tim.gardner@canonical.com
State New
Headers show

Commit Message

Tim Gardner June 14, 2012, 2:42 p.m. UTC
From: Andre Przywara <andre.przywara@amd.com>

BugLink: http://bugs.launchpad.net/bugs/1009086

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.

[1]
http://support.amd.com/us/Processor_TechDocs/42301_15h_Mod_00h-0Fh_BKDG.pdf
Chapter 3.8: D18F5xE0 Processor TDP Running Average (p. 452)

Signed-off-by: Andre Przywara <andre.przywara@amd.com>
Acked-by: Jean Delvare <khali@linux-fr.org>
[guenter.roeck@ericsson.com: Removed unnecessary return statement]
Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Cc: stable@vger.kernel.org # 3.0+
(back ported from commit 00250ec90963b7ef6678438888f3244985ecde14)

Conflicts:

	drivers/hwmon/fam15h_power.c
---
 drivers/hwmon/fam15h_power.c |    9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
diff mbox

Patch

diff --git a/drivers/hwmon/fam15h_power.c b/drivers/hwmon/fam15h_power.c
index e8e18ca..37a8fc9 100644
--- a/drivers/hwmon/fam15h_power.c
+++ b/drivers/hwmon/fam15h_power.c
@@ -128,20 +128,17 @@  static bool __devinit fam15h_power_is_internal_node0(struct pci_dev *f4)
  * counter saturations resulting in bogus power readings.
  * We correct this value ourselves to cope with older BIOSes.
  */
-static DEFINE_PCI_DEVICE_TABLE(affected_device) = {
-	{ PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_NB_F4) },
-	{ 0 }
-};
-
 static void __devinit tweak_runavg_range(struct pci_dev *pdev)
 {
 	u32 val;
+	const struct pci_device_id affected_device = {
+		PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_NB_F4) };
 
 	/*
 	 * 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))
+	if (!pci_match_id(&affected_device, pdev))
 		return;
 
 	pci_bus_read_config_dword(pdev->bus,