Skip to content

Commit

Permalink
[PATCH] I2C: i2c-vid.h: Support for VID to reg conversion
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Sebastian Witt authored and Greg Kroah-Hartman committed Jun 22, 2005
1 parent 792f156 commit 3886246
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions include/linux/i2c-vid.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}

0 comments on commit 3886246

Please sign in to comment.