Adds conversion from VID (mV) to register value. Used by the atxp1 I2C module. Signed-off-by: Sebastian Witt <se.witt at gmx.net> diff -ruN linux-2.6.12-rc2-mm3-orig/include/linux/i2c-vid.h linux-2.6.12-rc2-mm3/include/linux/i2c-vid.h --- linux-2.6.12-rc2-mm3-orig/include/linux/i2c-vid.h 2005-03-02 08:37:31.000000000 +0100 +++ linux-2.6.12-rc2-mm3/include/linux/i2c-vid.h 2005-04-12 18:22:23.000000000 +0200 @@ -97,3 +97,22 @@ 2050 - (val) * 50); } } + +static inline int vid_to_reg(int val, int vrm) +{ + + switch (vrm) { + + case 0: + return -1; + + case 91: /* VRM 9.1 */ + case 90: /* VRM 9.0 */ + return ((val >= 1100) && (val <= 1850) ? + ((18500 - val * 10) / 25 + 5) / 10 : -1); + + default: + return -1; + + } +}