aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorSebastian Witt <se.witt@gmx.net>2005-04-13 22:25:39 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2005-06-21 21:51:49 -0700
commit3886246a257e828248ce1e72ced00408a3557f0d (patch)
treeef1a71bf68f653b277de964d5c3156c90f21cd2f /include
parent[PATCH] I2C: rtc8564.c remove duplicate include (diff)
downloadlinux-dev-3886246a257e828248ce1e72ced00408a3557f0d.tar.xz
linux-dev-3886246a257e828248ce1e72ced00408a3557f0d.zip
[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')
-rw-r--r--include/linux/i2c-vid.h12
1 files changed, 12 insertions, 0 deletions
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;
+ }
+}