Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0-or-later */
0002 /*
0003     hwmon-vid.h - VID/VRM/VRD voltage conversions
0004 
0005     Originally part of lm_sensors
0006     Copyright (c) 2002 Mark D. Studebaker <mdsxyz123@yahoo.com>
0007     With assistance from Trent Piepho <xyzzy@speakeasy.org>
0008 
0009 */
0010 
0011 #ifndef _LINUX_HWMON_VID_H
0012 #define _LINUX_HWMON_VID_H
0013 
0014 int vid_from_reg(int val, u8 vrm);
0015 u8 vid_which_vrm(void);
0016 
0017 /* vrm is the VRM/VRD document version multiplied by 10.
0018    val is in mV to avoid floating point in the kernel.
0019    Returned value is the 4-, 5- or 6-bit VID code.
0020    Note that only VRM 9.x is supported for now. */
0021 static inline int vid_to_reg(int val, u8 vrm)
0022 {
0023     switch (vrm) {
0024     case 91:        /* VRM 9.1 */
0025     case 90:        /* VRM 9.0 */
0026         return ((val >= 1100) && (val <= 1850) ?
0027             ((18499 - val * 10) / 25 + 5) / 10 : -1);
0028     default:
0029         return -EINVAL;
0030     }
0031 }
0032 
0033 #endif /* _LINUX_HWMON_VID_H */