diff options
author | Andreas Herrmann <andreas.herrmann3@amd.com> | 2012-09-23 14:27:32 -0400 |
---|---|---|
committer | Jean Delvare <khali@endymion.delvare> | 2012-09-23 14:54:09 -0400 |
commit | 5f0ecb907deb1e6f28071ee3bd568903b9da1be4 (patch) | |
tree | 06251f66f4c721aea692c6f69591bf877c590cba /drivers/hwmon/fam15h_power.c | |
parent | 641f14560035bbb86500ea4b3a27ad27f034725b (diff) |
hwmon: (fam15h_power) Tweak runavg_range on resume
The quirk introduced with commit
00250ec90963b7ef6678438888f3244985ecde14 (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: Andreas Herrmann <andreas.herrmann3@amd.com>
Tested-by: Andreas Hartmann <andihartmann@01019freenet.de>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: stable@vger.kernel.org # 3.0+
Diffstat (limited to 'drivers/hwmon/fam15h_power.c')
-rw-r--r-- | drivers/hwmon/fam15h_power.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/hwmon/fam15h_power.c b/drivers/hwmon/fam15h_power.c index 2764b78a784b..af69073b3fe8 100644 --- a/drivers/hwmon/fam15h_power.c +++ b/drivers/hwmon/fam15h_power.c | |||
@@ -129,12 +129,12 @@ static bool __devinit fam15h_power_is_internal_node0(struct pci_dev *f4) | |||
129 | * counter saturations resulting in bogus power readings. | 129 | * counter saturations resulting in bogus power readings. |
130 | * We correct this value ourselves to cope with older BIOSes. | 130 | * We correct this value ourselves to cope with older BIOSes. |
131 | */ | 131 | */ |
132 | static DEFINE_PCI_DEVICE_TABLE(affected_device) = { | 132 | static const struct pci_device_id affected_device[] = { |
133 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_NB_F4) }, | 133 | { PCI_VDEVICE(AMD, PCI_DEVICE_ID_AMD_15H_NB_F4) }, |
134 | { 0 } | 134 | { 0 } |
135 | }; | 135 | }; |
136 | 136 | ||
137 | static void __devinit tweak_runavg_range(struct pci_dev *pdev) | 137 | static void tweak_runavg_range(struct pci_dev *pdev) |
138 | { | 138 | { |
139 | u32 val; | 139 | u32 val; |
140 | 140 | ||
@@ -158,6 +158,16 @@ static void __devinit tweak_runavg_range(struct pci_dev *pdev) | |||
158 | REG_TDP_RUNNING_AVERAGE, val); | 158 | REG_TDP_RUNNING_AVERAGE, val); |
159 | } | 159 | } |
160 | 160 | ||
161 | #ifdef CONFIG_PM | ||
162 | static int fam15h_power_resume(struct pci_dev *pdev) | ||
163 | { | ||
164 | tweak_runavg_range(pdev); | ||
165 | return 0; | ||
166 | } | ||
167 | #else | ||
168 | #define fam15h_power_resume NULL | ||
169 | #endif | ||
170 | |||
161 | static void __devinit fam15h_power_init_data(struct pci_dev *f4, | 171 | static void __devinit fam15h_power_init_data(struct pci_dev *f4, |
162 | struct fam15h_power_data *data) | 172 | struct fam15h_power_data *data) |
163 | { | 173 | { |
@@ -256,6 +266,7 @@ static struct pci_driver fam15h_power_driver = { | |||
256 | .id_table = fam15h_power_id_table, | 266 | .id_table = fam15h_power_id_table, |
257 | .probe = fam15h_power_probe, | 267 | .probe = fam15h_power_probe, |
258 | .remove = __devexit_p(fam15h_power_remove), | 268 | .remove = __devexit_p(fam15h_power_remove), |
269 | .resume = fam15h_power_resume, | ||
259 | }; | 270 | }; |
260 | 271 | ||
261 | module_pci_driver(fam15h_power_driver); | 272 | module_pci_driver(fam15h_power_driver); |