Skip to content

Commit 42fae99

Browse files
Evan Quanalexdeucher
authored andcommitted
drm/amd/powerplay/vega20: tell the correct gfx voltage V2
Export the correct gfx voltage by hwmon interface. V2: update the register naming for consistency Signed-off-by: Evan Quan <[email protected]> Reviewed-by: Rex Zhu <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent 3546916 commit 42fae99

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

drivers/gpu/drm/amd/include/asic_reg/smuio/smuio_9_0_offset.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,4 +175,7 @@
175175
#define mmSMUSVI0_PLANE0_CURRENTVID_BASE_IDX 0
176176
#define mmSMUSVI0_PLANE0_CURRENTVID 0x0013
177177

178+
#define mmSMUSVI0_TEL_PLANE0_BASE_IDX 0
179+
#define mmSMUSVI0_TEL_PLANE0 0x0004
180+
178181
#endif

drivers/gpu/drm/amd/include/asic_reg/smuio/smuio_9_0_sh_mask.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,4 +258,7 @@
258258
#define SMUSVI0_PLANE0_CURRENTVID__CURRENT_SVI0_PLANE0_VID__SHIFT 0x18
259259
#define SMUSVI0_PLANE0_CURRENTVID__CURRENT_SVI0_PLANE0_VID_MASK 0xFF000000L
260260

261+
#define SMUSVI0_TEL_PLANE0__SVI0_PLANE0_VDDCOR__SHIFT 0x10
262+
#define SMUSVI0_TEL_PLANE0__SVI0_PLANE0_VDDCOR_MASK 0x01FF0000L
263+
261264
#endif

drivers/gpu/drm/amd/powerplay/hwmgr/vega20_hwmgr.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@
4646
#include "ppinterrupt.h"
4747
#include "pp_overdriver.h"
4848
#include "pp_thermal.h"
49+
#include "soc15_common.h"
50+
#include "smuio/smuio_9_0_offset.h"
51+
#include "smuio/smuio_9_0_sh_mask.h"
4952

5053
static void vega20_set_default_registry_data(struct pp_hwmgr *hwmgr)
5154
{
@@ -1915,6 +1918,8 @@ static int vega20_read_sensor(struct pp_hwmgr *hwmgr, int idx,
19151918
void *value, int *size)
19161919
{
19171920
struct vega20_hwmgr *data = (struct vega20_hwmgr *)(hwmgr->backend);
1921+
struct amdgpu_device *adev = hwmgr->adev;
1922+
uint32_t val_vid;
19181923
int ret = 0;
19191924

19201925
switch (idx) {
@@ -1949,6 +1954,13 @@ static int vega20_read_sensor(struct pp_hwmgr *hwmgr, int idx,
19491954
*size = 16;
19501955
ret = vega20_get_gpu_power(hwmgr, (uint32_t *)value);
19511956
break;
1957+
case AMDGPU_PP_SENSOR_VDDGFX:
1958+
val_vid = (RREG32_SOC15(SMUIO, 0, mmSMUSVI0_TEL_PLANE0) &
1959+
SMUSVI0_TEL_PLANE0__SVI0_PLANE0_VDDCOR_MASK) >>
1960+
SMUSVI0_TEL_PLANE0__SVI0_PLANE0_VDDCOR__SHIFT;
1961+
*((uint32_t *)value) =
1962+
(uint32_t)convert_to_vddc((uint8_t)val_vid);
1963+
break;
19521964
case AMDGPU_PP_SENSOR_ENABLED_SMC_FEATURES_MASK:
19531965
ret = vega20_get_enabled_smc_features(hwmgr, (uint64_t *)value);
19541966
if (!ret)

0 commit comments

Comments
 (0)