From se.witt@gmx.net Wed Apr 13 13:20:47 2005 Date: Wed, 13 Apr 2005 22:25:39 +0200 From: Sebastian Witt To: greg@kroah.com Subject: I2C: i2c-vid.h: Support for VID to reg conversion Adds conversion from VID (mV) to register value. Used by the atxp1 I2C module. Removed uneeded switch case. Signed-off-by: Sebastian Witt Signed-off-by: Greg Kroah-Hartman --- --- gregkh-2.6.orig/include/linux/i2c-vid.h 2005-05-02 14:02:34.000000000 -0700 +++ gregkh-2.6/include/linux/i2c-vid.h 2005-05-02 14:04:41.000000000 -0700 @@ -97,3 +97,15 @@ 2050 - (val) * 50); } } + +static inline int vid_to_reg(int val, int vrm) +{ + switch (vrm) { + case 91: /* VRM 9.1 */ + case 90: /* VRM 9.0 */ + return ((val >= 1100) && (val <= 1850) ? + ((18499 - val * 10) / 25 + 5) / 10 : -1); + default: + return -1; + } +}