From: Sebastian Witt Date: Wed, 13 Apr 2005 20:25:39 +0000 (+0200) Subject: [PATCH] I2C: i2c-vid.h: Support for VID to reg conversion X-Git-Tag: MMI-PSA29.97-13-9~56759^2~160^2~55 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=3886246a257e828248ce1e72ced00408a3557f0d;p=GitHub%2FMotorolaMobilityLLC%2Fkernel-slsi.git [PATCH] 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 --- diff --git a/include/linux/i2c-vid.h b/include/linux/i2c-vid.h index 974835e3530f..41d0635e0ba9 100644 --- a/include/linux/i2c-vid.h +++ b/include/linux/i2c-vid.h @@ -97,3 +97,15 @@ static inline int vid_from_reg(int val, int vrm) 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; + } +}