]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/commitdiff
[PATCH] I2C: i2c-vid.h: Support for VID to reg conversion
authorSebastian Witt <se.witt@gmx.net>
Wed, 13 Apr 2005 20:25:39 +0000 (22:25 +0200)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 22 Jun 2005 04:51:49 +0000 (21:51 -0700)
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>
include/linux/i2c-vid.h

index 974835e3530f44a845a7811ff0294ad2273143bd..41d0635e0ba94380a3311de7640833cfee57020a 100644 (file)
@@ -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;
+       }
+}