Commit 5f0ecb90 authored by Andreas Herrmann's avatar Andreas Herrmann Committed by Jean Delvare

hwmon: (fam15h_power) Tweak runavg_range on resume

The quirk introduced with commit
00250ec9 (hwmon: fam15h_power: fix
bogus values with current BIOSes) is not only required during driver
load but also when system resumes from suspend. The BIOS might set the
previously recommended (but unsuitable) initilization value for the
running average range register during resume.
Signed-off-by: default avatarAndreas Herrmann <andreas.herrmann3@amd.com>
Tested-by: default avatarAndreas Hartmann <andihartmann@01019freenet.de>
Signed-off-by: default avatarJean Delvare <khali@linux-fr.org>
Cc: stable@vger.kernel.org # 3.0+
parent 641f1456
...@@ -129,12 +129,12 @@ static bool __devinit fam15h_power_is_internal_node0(struct pci_dev *f4) ...@@ -129,12 +129,12 @@ static bool __devinit fam15h_power_is_internal_node0(struct pci_dev *f4)
* counter saturations resulting in bogus power readings. * counter saturations resulting in bogus power readings.
* We correct this value ourselves to cope with older BIOSes. * We correct this value ourselves to cope with older BIOSes.
*/ */
static DEFINE_PCI_DEVICE_TABLE(affected_device) = { static const struct pci_device_id affected_device[] = {
{ PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_NB_F4) }, { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_NB_F4) },
{ 0 } { 0 }
}; };
static void __devinit tweak_runavg_range(struct pci_dev *pdev) static void tweak_runavg_range(struct pci_dev *pdev)
{ {
u32 val; u32 val;
...@@ -158,6 +158,16 @@ static void __devinit tweak_runavg_range(struct pci_dev *pdev) ...@@ -158,6 +158,16 @@ static void __devinit tweak_runavg_range(struct pci_dev *pdev)
REG_TDP_RUNNING_AVERAGE, val); REG_TDP_RUNNING_AVERAGE, val);
} }
#ifdef CONFIG_PM
static int fam15h_power_resume(struct pci_dev *pdev)
{
tweak_runavg_range(pdev);
return 0;
}
#else
#define fam15h_power_resume NULL
#endif
static void __devinit fam15h_power_init_data(struct pci_dev *f4, static void __devinit fam15h_power_init_data(struct pci_dev *f4,
struct fam15h_power_data *data) struct fam15h_power_data *data)
{ {
...@@ -256,6 +266,7 @@ static struct pci_driver fam15h_power_driver = { ...@@ -256,6 +266,7 @@ static struct pci_driver fam15h_power_driver = {
.id_table = fam15h_power_id_table, .id_table = fam15h_power_id_table,
.probe = fam15h_power_probe, .probe = fam15h_power_probe,
.remove = __devexit_p(fam15h_power_remove), .remove = __devexit_p(fam15h_power_remove),
.resume = fam15h_power_resume,
}; };
module_pci_driver(fam15h_power_driver); module_pci_driver(fam15h_power_driver);
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