aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Witt <se.witt@gmx.net>2005-04-13 16:25:39 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2005-06-22 00:51:49 -0400
commit3886246a257e828248ce1e72ced00408a3557f0d (patch)
treeef1a71bf68f653b277de964d5c3156c90f21cd2f
parent792f156d61d327671f58829dc04ad5609152e393 (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>
-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)
97 2050 - (val) * 50); 97 2050 - (val) * 50);
98 } 98 }
99} 99}
100
101static inline int vid_to_reg(int val, int vrm)
102{
103 switch (vrm) {
104 case 91: /* VRM 9.1 */
105 case 90: /* VRM 9.0 */
106 return ((val >= 1100) && (val <= 1850) ?
107 ((18499 - val * 10) / 25 + 5) / 10 : -1);
108 default:
109 return -1;
110 }
111}