I2C: automatic VRM detection part1
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 4 lines · Linux Kernel
diff -Nru
a/drivers/i2c/i2c-sensor-vid.cb/drivers/i2c/i2c-sensor-vid.cdrivers/i2c/i2c-sensor-vid.c new file +0
-0@@ -0,0 +1,99 @@
....
drivers/i2c/i2c-sensor-vid.c
Quoted 4 lines
drivers/i2c/i2c-sensor-vid.c new file +4
-0+#ifdef CONFIG_X86 + +static struct vrm_model vrm_models[] = { + {X86_VENDOR_AMD, 0x6, ANY, 90}, /* Athlon Duron etc */
This is insufficient afaics. Mobile Athlon's/Durons will have a different VRM to the desktop parts.
drivers/i2c/i2c-sensor-vid.c
Quoted 1 line
drivers/i2c/i2c-sensor-vid.c new file +1
-0+ {X86_VENDOR_AMD, 0xF, 0x4, 90}, /* Athlon 64 */
possible the same here.
drivers/i2c/i2c-sensor-vid.c
Quoted 1 line
drivers/i2c/i2c-sensor-vid.c new file +1
-0+ {X86_VENDOR_INTEL, 0x6, 0xB, 85}, /* 0xB Tualatin */
again, mobile parts may match this.
drivers/i2c/i2c-sensor-vid.c
Quoted 1 line
drivers/i2c/i2c-sensor-vid.c new file +1
-0+ {X86_VENDOR_INTEL, 0x6, ANY, 82}, /* any P6 */
definitly here.
drivers/i2c/i2c-sensor-vid.c
Quoted 1 line
drivers/i2c/i2c-sensor-vid.c new file +1
-0+ {X86_VENDOR_INTEL, 0x7, ANY, 0}, /* Itanium */
huh? Under ifdef CONFIG_X86 ?
drivers/i2c/i2c-sensor-vid.c
Quoted 1 line
drivers/i2c/i2c-sensor-vid.c new file +1
-0+ {X86_VENDOR_INTEL, 0x10,ANY, 0}, /* Itanium 2 */
ditto.
drivers/i2c/i2c-sensor-vid.c
Quoted 10 lines
drivers/i2c/i2c-sensor-vid.c new file +10
-0+ +int i2c_which_vrm (void ) +{ +struct cpuinfo_x86 *c = cpu_data; +u32 eax; +u8 eff_family, eff_model; +int vrm_ret; + +if (c->x86 <6 )return 0 ;/* any CPU with familly lower than 6 +dont have VID and/or CPUID */
1. CodingStyle dictates
if (c->x86 < 6) return 0;
2. Typo in 'familly'
drivers/i2c/i2c-sensor-vid.c
Quoted 7 lines
drivers/i2c/i2c-sensor-vid.c new file +7
-0+ eax =cpuid_eax (1 ); + eff_family = ((eax &0x00000F00 )>>8 ); + eff_model = ((eax &0x000000F0 )>>4 ); +if (eff_family ==0xF ) {/* use extended model & family */ + eff_family += ((eax &0x00F00000 )>>20 ); + eff_model += ((eax &0x000F0000 )>>16 )<<4 ; + }
Is this guaranteed safe on all vendors ?
drivers/i2c/i2c-sensor-vid.c
Quoted 8 lines
drivers/i2c/i2c-sensor-vid.c new file +8
-0+/* and now something completely different for Non-x86 world*/ +#else +int i2c_which_vrm (void ) +{ +printk (KERN_INFO "i2c-sensor.o: Unknown VRM version of your CPU\n" ); +return 0 ; +} +#endif
why build this at all on non-x86 if its useless ?
Dave