1 // SPDX-License-Identifier: MIT
3 * Copyright © 2020 Intel Corporation
11 bool librapl_supported(const struct drm_i915_private *i915)
13 /* Discrete cards require hwmon integration */
17 return librapl_energy_uJ();
20 u64 librapl_energy_uJ(void)
22 unsigned long long power;
25 if (rdmsrl_safe(MSR_RAPL_POWER_UNIT, &power))
28 units = (power & 0x1f00) >> 8;
30 if (rdmsrl_safe(MSR_PP1_ENERGY_STATUS, &power))
33 return (1000000 * power) >> units; /* convert to uJ */