hwmon-vid: Fix AMD K8 VID decoding
PATCH v2 1/1 hwmon-vid: Fix AMD K8 VID decoding
Not all AMD K8 / family 0Fh have 6 VID pins. Older models have only 5 VID pins, so we need two entries in the hwmon-vid table.
Signed-off-by Jean Delvare <[email protected]>
Cc Frank Myhr <[email protected]>
Cc Jean-Luc Coulon <[email protected]>
---
Patch updated... First version was incorrect.
drivers/hwmon/hwmon-vid.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
drivers/hwmon/hwmon-vid.c +13 -3
@@ -95,7 +95,10 @@ int vid_from_reg(int val, u8 vrm)return 0 ;return ((1600000 - (val -2 ) *6250 +500 ) /1000 ); -case 24 :/* AMD NPT 0Fh (Athlon64 & Opteron) */ +case 24 :/* Athlon64 & Opteron */ + val &=0x1f ; +/* fall through */ +case 25 :/* AMD NPT 0Fh */ val &=0x3f ;return (val <32 ) ?1550 -25 * val :775 - (25 * (val -31 )) /2 ;
@@ -157,11 +160,16 @@ struct vrm_model {#ifdef CONFIG_X86 -/* the stepping parameter is highest acceptable stepping for current line */ +/* +* The stepping parameter is highest acceptable stepping for current line. +* The model match must be exact for 4-bit values. For model values 0x10 +* and above (extended model), all models below the parameter will match. +*/ static struct vrm_model vrm_models[] = { {X86_VENDOR_AMD ,0x6 ,ANY ,ANY ,90 },/* Athlon Duron etc */ - {X86_VENDOR_AMD ,0xF ,ANY ,ANY ,24 },/* Athlon 64, Opteron and above VRM 24 */ + {X86_VENDOR_AMD ,0xF ,0x2F ,ANY ,24 },/* Athlon 64, Opteron */ + {X86_VENDOR_AMD ,0xF ,ANY ,ANY ,25 },/* NPT family 0Fh */ {X86_VENDOR_INTEL ,0x6 ,0x9 ,ANY ,13 },/* Pentium M (130 nm) */ {X86_VENDOR_INTEL ,0x6 ,0xB ,ANY ,85 },/* Tualatin */ {X86_VENDOR_INTEL, 0x6, 0xD, ANY, 13}, /* Pentium M (90 nm) */
@@ -189,6 +197,8 @@ static u8 find_vrm(u8 eff_family, u8 effif (vrm_models[i].vendor=vendor)if ((vrm_models[i].eff_family=eff_family) && ((vrm_models[i].eff_model=eff_model) || + (vrm_models[i].eff_model >=0x10 && + eff_model <= vrm_models[i].eff_model) || (vrm_models[i].eff_model=ANY )) && (eff_stepping <= vrm_models[i].eff_stepping))return vrm_models[i].vrm_type;
Signature · 6 lines
Jean Delvare _______________________________________________ lm-sensors mailing list [email protected] http://lists.lm-sensors.org/mailman/listinfo/lm-sensors