All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/2] drm/amd/pp: Convert voltage unit in mV*4 to mV on CZ/ST
@ 2018-07-25  5:03 Rex Zhu
       [not found] ` <1532494993-23009-1-git-send-email-rex.zhu-5C7GfCeVMHo@public.gmane.org>
  0 siblings, 1 reply; 5+ messages in thread
From: Rex Zhu @ 2018-07-25  5:03 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Rex Zhu

the voltage showed in debugfs and hwmon should be in mV

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
---
 drivers/gpu/drm/amd/powerplay/hwmgr/smu8_hwmgr.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu8_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu8_hwmgr.c
index cafa822..b863704 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu8_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu8_hwmgr.c
@@ -244,6 +244,7 @@ static int smu8_initialize_dpm_defaults(struct pp_hwmgr *hwmgr)
 	return 0;
 }
 
+/* convert form 8bit vid to real voltage in mV*4 */
 static uint32_t smu8_convert_8Bit_index_to_voltage(
 			struct pp_hwmgr *hwmgr, uint16_t voltage)
 {
@@ -1707,13 +1708,13 @@ static int smu8_read_sensor(struct pp_hwmgr *hwmgr, int idx,
 	case AMDGPU_PP_SENSOR_VDDNB:
 		tmp = (cgs_read_ind_register(hwmgr->device, CGS_IND_REG__SMC, ixSMUSVI_NB_CURRENTVID) &
 			CURRENT_NB_VID_MASK) >> CURRENT_NB_VID__SHIFT;
-		vddnb = smu8_convert_8Bit_index_to_voltage(hwmgr, tmp);
+		vddnb = smu8_convert_8Bit_index_to_voltage(hwmgr, tmp) / 4;
 		*((uint32_t *)value) = vddnb;
 		return 0;
 	case AMDGPU_PP_SENSOR_VDDGFX:
 		tmp = (cgs_read_ind_register(hwmgr->device, CGS_IND_REG__SMC, ixSMUSVI_GFX_CURRENTVID) &
 			CURRENT_GFX_VID_MASK) >> CURRENT_GFX_VID__SHIFT;
-		vddgfx = smu8_convert_8Bit_index_to_voltage(hwmgr, (u16)tmp);
+		vddgfx = smu8_convert_8Bit_index_to_voltage(hwmgr, (u16)tmp) / 4;
 		*((uint32_t *)value) = vddgfx;
 		return 0;
 	case AMDGPU_PP_SENSOR_UVD_VCLK:
-- 
1.9.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] drm/amdgpu: fix a reversed condition
       [not found] ` <1532494993-23009-1-git-send-email-rex.zhu-5C7GfCeVMHo@public.gmane.org>
@ 2018-07-25  5:03   ` Rex Zhu
       [not found]     ` <1532494993-23009-2-git-send-email-rex.zhu-5C7GfCeVMHo@public.gmane.org>
  2018-07-25 14:45   ` [PATCH 1/2] drm/amd/pp: Convert voltage unit in mV*4 to mV on CZ/ST Deucher, Alexander
  1 sibling, 1 reply; 5+ messages in thread
From: Rex Zhu @ 2018-07-25  5:03 UTC (permalink / raw)
  To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Rex Zhu

This test was reversed so it would end up leading to vddnb value
can't be read on APU.

Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
index 15a1192..23fc1d3 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
@@ -1185,7 +1185,7 @@ static ssize_t amdgpu_hwmon_show_vddnb(struct device *dev,
 	int r, size = sizeof(vddnb);
 
 	/* only APUs have vddnb */
-	if  (adev->flags & AMD_IS_APU)
+	if  (!(adev->flags & AMD_IS_APU))
 		return -EINVAL;
 
 	/* Can't get voltage when the card is off */
-- 
1.9.1

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] drm/amdgpu: fix a reversed condition
       [not found]     ` <1532494993-23009-2-git-send-email-rex.zhu-5C7GfCeVMHo@public.gmane.org>
@ 2018-07-25 10:13       ` Quan, Evan
  2018-07-25 14:58       ` Alex Deucher
  1 sibling, 0 replies; 5+ messages in thread
From: Quan, Evan @ 2018-07-25 10:13 UTC (permalink / raw)
  To: Zhu, Rex, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW


[-- Attachment #1.1: Type: text/plain, Size: 1442 bytes --]

Series is Reviewed-by: Evan Quan <evan.quan-5C7GfCeVMHo@public.gmane.org>

________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> on behalf of Rex Zhu <rex.zhu-5C7GfCeVMHo@public.gmane.org>
Sent: Wednesday, July 25, 2018 1:03:13 PM
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: Zhu, Rex
Subject: [PATCH 2/2] drm/amdgpu: fix a reversed condition

This test was reversed so it would end up leading to vddnb value
can't be read on APU.

Signed-off-by: Rex Zhu <Rex.Zhu-5C7GfCeVMHo@public.gmane.org>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
index 15a1192..23fc1d3 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
@@ -1185,7 +1185,7 @@ static ssize_t amdgpu_hwmon_show_vddnb(struct device *dev,
         int r, size = sizeof(vddnb);

         /* only APUs have vddnb */
-       if  (adev->flags & AMD_IS_APU)
+       if  (!(adev->flags & AMD_IS_APU))
                 return -EINVAL;

         /* Can't get voltage when the card is off */
--
1.9.1

_______________________________________________
amd-gfx mailing list
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

[-- Attachment #1.2: Type: text/html, Size: 2742 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] drm/amd/pp: Convert voltage unit in mV*4 to mV on CZ/ST
       [not found] ` <1532494993-23009-1-git-send-email-rex.zhu-5C7GfCeVMHo@public.gmane.org>
  2018-07-25  5:03   ` [PATCH 2/2] drm/amdgpu: fix a reversed condition Rex Zhu
@ 2018-07-25 14:45   ` Deucher, Alexander
  1 sibling, 0 replies; 5+ messages in thread
From: Deucher, Alexander @ 2018-07-25 14:45 UTC (permalink / raw)
  To: Zhu, Rex, amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW


[-- Attachment #1.1: Type: text/plain, Size: 2472 bytes --]

Acked-by: Alex Deucher <alexander.deucher-5C7GfCeVMHo@public.gmane.org>

________________________________
From: amd-gfx <amd-gfx-bounces-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org> on behalf of Rex Zhu <rex.zhu-5C7GfCeVMHo@public.gmane.org>
Sent: Wednesday, July 25, 2018 1:03:12 AM
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
Cc: Zhu, Rex
Subject: [PATCH 1/2] drm/amd/pp: Convert voltage unit in mV*4 to mV on CZ/ST

the voltage showed in debugfs and hwmon should be in mV

Signed-off-by: Rex Zhu <Rex.Zhu-5C7GfCeVMHo@public.gmane.org>
---
 drivers/gpu/drm/amd/powerplay/hwmgr/smu8_hwmgr.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu8_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu8_hwmgr.c
index cafa822..b863704 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu8_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu8_hwmgr.c
@@ -244,6 +244,7 @@ static int smu8_initialize_dpm_defaults(struct pp_hwmgr *hwmgr)
         return 0;
 }

+/* convert form 8bit vid to real voltage in mV*4 */
 static uint32_t smu8_convert_8Bit_index_to_voltage(
                         struct pp_hwmgr *hwmgr, uint16_t voltage)
 {
@@ -1707,13 +1708,13 @@ static int smu8_read_sensor(struct pp_hwmgr *hwmgr, int idx,
         case AMDGPU_PP_SENSOR_VDDNB:
                 tmp = (cgs_read_ind_register(hwmgr->device, CGS_IND_REG__SMC, ixSMUSVI_NB_CURRENTVID) &
                         CURRENT_NB_VID_MASK) >> CURRENT_NB_VID__SHIFT;
-               vddnb = smu8_convert_8Bit_index_to_voltage(hwmgr, tmp);
+               vddnb = smu8_convert_8Bit_index_to_voltage(hwmgr, tmp) / 4;
                 *((uint32_t *)value) = vddnb;
                 return 0;
         case AMDGPU_PP_SENSOR_VDDGFX:
                 tmp = (cgs_read_ind_register(hwmgr->device, CGS_IND_REG__SMC, ixSMUSVI_GFX_CURRENTVID) &
                         CURRENT_GFX_VID_MASK) >> CURRENT_GFX_VID__SHIFT;
-               vddgfx = smu8_convert_8Bit_index_to_voltage(hwmgr, (u16)tmp);
+               vddgfx = smu8_convert_8Bit_index_to_voltage(hwmgr, (u16)tmp) / 4;
                 *((uint32_t *)value) = vddgfx;
                 return 0;
         case AMDGPU_PP_SENSOR_UVD_VCLK:
--
1.9.1

_______________________________________________
amd-gfx mailing list
amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW@public.gmane.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

[-- Attachment #1.2: Type: text/html, Size: 4867 bytes --]

[-- Attachment #2: Type: text/plain, Size: 154 bytes --]

_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] drm/amdgpu: fix a reversed condition
       [not found]     ` <1532494993-23009-2-git-send-email-rex.zhu-5C7GfCeVMHo@public.gmane.org>
  2018-07-25 10:13       ` Quan, Evan
@ 2018-07-25 14:58       ` Alex Deucher
  1 sibling, 0 replies; 5+ messages in thread
From: Alex Deucher @ 2018-07-25 14:58 UTC (permalink / raw)
  To: Rex Zhu; +Cc: amd-gfx list

On Wed, Jul 25, 2018 at 1:03 AM, Rex Zhu <rex.zhu@amd.com> wrote:
> This test was reversed so it would end up leading to vddnb value
> can't be read on APU.
>
> Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
> index 15a1192..23fc1d3 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
> @@ -1185,7 +1185,7 @@ static ssize_t amdgpu_hwmon_show_vddnb(struct device *dev,
>         int r, size = sizeof(vddnb);
>
>         /* only APUs have vddnb */
> -       if  (adev->flags & AMD_IS_APU)
> +       if  (!(adev->flags & AMD_IS_APU))
>                 return -EINVAL;
>
>         /* Can't get voltage when the card is off */
> --
> 1.9.1
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx
_______________________________________________
amd-gfx mailing list
amd-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2018-07-25 14:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-25  5:03 [PATCH 1/2] drm/amd/pp: Convert voltage unit in mV*4 to mV on CZ/ST Rex Zhu
     [not found] ` <1532494993-23009-1-git-send-email-rex.zhu-5C7GfCeVMHo@public.gmane.org>
2018-07-25  5:03   ` [PATCH 2/2] drm/amdgpu: fix a reversed condition Rex Zhu
     [not found]     ` <1532494993-23009-2-git-send-email-rex.zhu-5C7GfCeVMHo@public.gmane.org>
2018-07-25 10:13       ` Quan, Evan
2018-07-25 14:58       ` Alex Deucher
2018-07-25 14:45   ` [PATCH 1/2] drm/amd/pp: Convert voltage unit in mV*4 to mV on CZ/ST Deucher, Alexander

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.