cachepc-linux

Fork of AMDESE/linux with modifications for CachePC side-channel attack
git clone https://git.sinitax.com/sinitax/cachepc-linux
Log | Files | Refs | README | LICENSE | sfeed.txt

hwmon-vid.h (862B)


      1/* SPDX-License-Identifier: GPL-2.0-or-later */
      2/*
      3    hwmon-vid.h - VID/VRM/VRD voltage conversions
      4
      5    Originally part of lm_sensors
      6    Copyright (c) 2002 Mark D. Studebaker <mdsxyz123@yahoo.com>
      7    With assistance from Trent Piepho <xyzzy@speakeasy.org>
      8
      9*/
     10
     11#ifndef _LINUX_HWMON_VID_H
     12#define _LINUX_HWMON_VID_H
     13
     14int vid_from_reg(int val, u8 vrm);
     15u8 vid_which_vrm(void);
     16
     17/* vrm is the VRM/VRD document version multiplied by 10.
     18   val is in mV to avoid floating point in the kernel.
     19   Returned value is the 4-, 5- or 6-bit VID code.
     20   Note that only VRM 9.x is supported for now. */
     21static inline int vid_to_reg(int val, u8 vrm)
     22{
     23	switch (vrm) {
     24	case 91:		/* VRM 9.1 */
     25	case 90:		/* VRM 9.0 */
     26		return ((val >= 1100) && (val <= 1850) ?
     27			((18499 - val * 10) / 25 + 5) / 10 : -1);
     28	default:
     29		return -EINVAL;
     30	}
     31}
     32
     33#endif /* _LINUX_HWMON_VID_H */