Skip to contentSkip to conversation

i2c-vid.h: Support for VID to reg conversion

PATCH New Greg KH 3 participants 5 messages May 19, 2005

lore
Share & tools
lore

Greg KH

author
#0 lore raw

PATCH 1/1 i2c-vid.h: Support for VID to reg conversion

Quoted 5 lines · Sebastian Witt

Adds conversion from VID (mV) to register value. Used by the atxp1 I2C module.

Your email client just ate all of the tabs for lunch, and spit out the remainder as a linewrapped mess :(

Care to try this again?

thanks,

greg k-h

#1 lore raw

PATCH 1/1 i2c-vid.h: Support for VID to reg conversion

Adds conversion from VID (mV) to register value. Used by the atxp1 I2C module.

diff -ruN linux-2.6.12-rc2-mm3-orig/include/linux/i2c-vid.h linux-2.6.12-rc2-mm3/include/linux/i2c-vid.h
--- linux-2.6.12-rc2-mm3-orig/include/linux/i2c-vid.h 2005-03-02
08:37:31.000000000 +0100
+++ linux-2.6.12-rc2-mm3/include/linux/i2c-vid.h 2005-04-12
18:22:23.000000000 +0200
@@ -97,3 +97,22 @@

                               2050 - (val) * 50);
      }

}
+
+static inline int vid_to_reg(int val, int vrm)
+{
+
+ switch (vrm) {
+
+ case 0:
+ return -1;
+

+        case 91:                /* VRM 9.1 */
+        case 90:                /* VRM 9.0 */

+ return ((val >= 1100) && (val <= 1850) ?
+ ((18500 - val * 10) / 25 + 5) / 10 : -1);
+
+ default:
+ return -1;
+
+ }
+}

#2 lore raw

PATCH 1/1 i2c-vid.h: Support for VID to reg conversion

In reply to Greg KH

Hi Sebastian,

Review

Quoted 7 lines
(quoted diff) +7 -0
+static inline int vid_to_reg(int val, int vrm)
+{
+
+        switch (vrm) {
+
+        case  0:
+                return -1;

This one doesn't make much sense to me, as the default case will catch it with the exact same effect anyway.

Review

Quoted 11 lines
(quoted diff) +11 -0
+
+        case 91:                /* VRM 9.1 */
+        case 90:                /* VRM 9.0 */
+                return ((val >= 1100) && (val <= 1850) ?
+                        ((18500 - val * 10) / 25 + 5) / 10 : -1);
+
+        default:
+                return -1;
+
+        }
+}

Thanks,

Signature · 1 line
Jean Delvare
#3 lore raw

PATCH 1/1 i2c-vid.h: Support for VID to reg conversion 2

In reply to Greg KH

Adds conversion from VID (mV) to register value. Used by the atxp1 I2C module. Removed uneeded switch case.

-------------- next part --------------

include/linux/i2c-vid.h 2005-04-12 18:22:23.000000000 +0200 renamed from include/linux/i2c-vid.h 2005-03-02 08:37:31.000000000 +0100 +16 -0
diff -ruN linux-2.6.12-rc2-mm3-orig/include/linux/i2c-vid.h linux-2.6.12-rc2-mm3/include/linux/i2c-vid.h
@@ -97,3 +97,22 @@
                                     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;
+
+        }
+}
author
#4 lore raw

PATCH 1/1 i2c-vid.h: Support for VID to reg conversion 2

In reply to Greg KH
Quoted 6 lines · Sebastian Witt

Adds conversion from VID (mV) to register value. Used by the atxp1 I2C module.
Removed uneeded switch case.

Wow, that's a messed up patch. I fixed it up by hand and applied it.

thanks,

greg k-h