[PATCH] I2C: i2c-vid.h: Support for VID to reg conversion

From: Greg KH
Date: Wed Jun 22 2005 - 01:19:22 EST


[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@xxxxxxx>
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxx>

---
commit 3886246a257e828248ce1e72ced00408a3557f0d
tree ef1a71bf68f653b277de964d5c3156c90f21cd2f
parent 792f156d61d327671f58829dc04ad5609152e393
author Sebastian Witt <se.witt@xxxxxxx> Wed, 13 Apr 2005 22:25:39 +0200
committer Greg Kroah-Hartman <gregkh@xxxxxxx> Tue, 21 Jun 2005 21:51:49 -0700

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
--- a/include/linux/i2c-vid.h
+++ b/include/linux/i2c-vid.h
@@ -97,3 +97,15 @@ static inline int vid_from_reg(int val,
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;
+ }
+}

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/