diff options
author | Sebastian Witt <se.witt@gmx.net> | 2005-04-13 22:25:39 +0200 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2005-06-21 21:51:49 -0700 |
commit | 3886246a257e828248ce1e72ced00408a3557f0d (patch) | |
tree | ef1a71bf68f653b277de964d5c3156c90f21cd2f /include/linux | |
parent | 792f156d61d327671f58829dc04ad5609152e393 (diff) |
[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 <se.witt@gmx.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/i2c-vid.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/i2c-vid.h b/include/linux/i2c-vid.h index 974835e3530..41d0635e0ba 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; + } +} |