Skip to contentSkip to conversation

drm/amdgpu/pm/smu11: fix static fan speed readback

PATCH In review Alex Deucher 5 participants 8 messages Jan 26, 2021 – Jan 27, 2021

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm/amdgpu/pm/smu11: fix static fan speed readback

The xclk needs to be divided by 4.

Fixes acab02c1af43d3 ("drm/amdgpu/pm/smu11: Fix fan set speed bug")
---
 drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +5 -1
index 147efe12973c..36dac106ed4b 100644
@@ -1245,7 +1245,11 @@ int smu_v11_0_get_fan_speed_rpm(struct smu_context *smu,
 	if (!tach_period)
 		return -EINVAL;
 
-	crystal_clock_freq = amdgpu_asic_get_xclk(adev);
+	/*
+	 * crystal_clock_freq div by 4 is required since the fan control
+	 * module refers to 25MHz
+	 */
+	crystal_clock_freq = amdgpu_asic_get_xclk(adev) / 4;
 
 	tmp64 = (uint64_t)crystal_clock_freq * 60 * 10000;
 	do_div(tmp64, (tach_period * 8));
Signature · 6 lines
2.29.2

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
#1 lore raw

[AMD Official Use Only - Internal Distribution Only]

Actually after switching to retrieve fan speed from metrics table always, this API is not used any more. Maybe we can just drop it. Either way the patch is reviewed-by: Evan Quan <[email protected]>

BR
Evan
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: Wednesday, January 27, 2021 2:17 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: [PATCH] drm/amdgpu/pm/smu11: fix static fan speed readback

The xclk needs to be divided by 4.

Fixes acab02c1af43d3 ("drm/amdgpu/pm/smu11: Fix fan set speed bug")
---
 drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +5 -1
index 147efe12973c..36dac106ed4b 100644
@@ -1245,7 +1245,11 @@ int smu_v11_0_get_fan_speed_rpm(struct smu_context *smu,
 if (!tach_period)
 return -EINVAL;
 
-crystal_clock_freq = amdgpu_asic_get_xclk(adev);
+/*
+ * crystal_clock_freq div by 4 is required since the fan control
+ * module refers to 25MHz
+ */
+crystal_clock_freq = amdgpu_asic_get_xclk(adev) / 4;
 
 tmp64 = (uint64_t)crystal_clock_freq * 60 * 10000;
 do_div(tmp64, (tach_period * 8));

--
2.29.2

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7Cevan.quan%40amd.com%7C4f685f8c77d040728b3608d8c226a209%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637472818479610219%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=Ri7h4UWgkSGOtQNa982bK9vAhUuvyOkhLOADurh3YYg%3D&amp;reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#2 lore raw

[AMD Public Use]

As crystal clock is not guaranteed to be 100M always, it's better to hardcode to 25M.

Thanks,
Lijo

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Quan, Evan
Sent: Wednesday, January 27, 2021 9:16 AM
To: Alex Deucher <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: RE: [PATCH] drm/amdgpu/pm/smu11: fix static fan speed readback

[AMD Official Use Only - Internal Distribution Only]

[AMD Official Use Only - Internal Distribution Only]

Actually after switching to retrieve fan speed from metrics table always, this API is not used any more. Maybe we can just drop it. Either way the patch is reviewed-by: Evan Quan <[email protected]>

BR
Evan
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: Wednesday, January 27, 2021 2:17 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: [PATCH] drm/amdgpu/pm/smu11: fix static fan speed readback

The xclk needs to be divided by 4.

Fixes acab02c1af43d3 ("drm/amdgpu/pm/smu11: Fix fan set speed bug")
---
 drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +5 -2
index 147efe12973c..36dac106ed4b 100644
@@ -1245,7 +1245,11 @@ int smu_v11_0_get_fan_speed_rpm(struct smu_context *smu,  if (!tach_period)  return -EINVAL;
 
-crystal_clock_freq = amdgpu_asic_get_xclk(adev);
+/*
+ * crystal_clock_freq div by 4 is required since the fan control
+ * module refers to 25MHz
+ */
+crystal_clock_freq = amdgpu_asic_get_xclk(adev) / 4;
 
 tmp64 = (uint64_t)crystal_clock_freq * 60 * 10000;  do_div(tmp64, (tach_period * 8));
--

2.29.2

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7Clijo.lazar%40amd.com%7Ccacc23400e334530b87208d8c2760341%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637473159427515107%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=7xQ9%2BLQ8O%2FiLSkGngF%2BYHqleC6WKAJ2aLHe3Vts%2BTts%3D&amp;reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7Clijo.lazar%40amd.com%7Ccacc23400e334530b87208d8c2760341%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637473159427515107%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=7xQ9%2BLQ8O%2FiLSkGngF%2BYHqleC6WKAJ2aLHe3Vts%2BTts%3D&amp;reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#3 lore raw
In reply to Quan, Evan

[AMD Public Use]

In soc15_get_xclk, we have independent handling for CHIP_RAVEN case.

If (adev->asic_type == CHIP_RAVEN)

	return reference_clock / 4;

I am not sure if it's better to squash the patch into the asic specific function? Then we have one unified place to handle it.

Regards,
Guchun

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Quan, Evan
Sent: Wednesday, January 27, 2021 11:46 AM
To: Alex Deucher <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: RE: [PATCH] drm/amdgpu/pm/smu11: fix static fan speed readback

[AMD Official Use Only - Internal Distribution Only]

[AMD Official Use Only - Internal Distribution Only]

Actually after switching to retrieve fan speed from metrics table always, this API is not used any more. Maybe we can just drop it. Either way the patch is reviewed-by: Evan Quan <[email protected]>

BR
Evan
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: Wednesday, January 27, 2021 2:17 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: [PATCH] drm/amdgpu/pm/smu11: fix static fan speed readback

The xclk needs to be divided by 4.

Fixes acab02c1af43d3 ("drm/amdgpu/pm/smu11: Fix fan set speed bug")
---
 drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +5 -2
index 147efe12973c..36dac106ed4b 100644
@@ -1245,7 +1245,11 @@ int smu_v11_0_get_fan_speed_rpm(struct smu_context *smu,  if (!tach_period)  return -EINVAL;
 
-crystal_clock_freq = amdgpu_asic_get_xclk(adev);
+/*
+ * crystal_clock_freq div by 4 is required since the fan control
+ * module refers to 25MHz
+ */
+crystal_clock_freq = amdgpu_asic_get_xclk(adev) / 4;
 
 tmp64 = (uint64_t)crystal_clock_freq * 60 * 10000;  do_div(tmp64, (tach_period * 8));
--

2.29.2

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7Cguchun.chen%40amd.com%7Ccacc23400e334530b87208d8c2760341%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637473159431451098%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=e%2BzrZgRQDkOb4ElNJNiLWP%2FHBM0cIQl4GwKFuYfvsP8%3D&amp;reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7Cguchun.chen%40amd.com%7Ccacc23400e334530b87208d8c2760341%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637473159431461091%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=lp9Gu3pJ7GdDbF1BJNlIQr4Z0TCY%2BTVDGtDWzZ2bR2Q%3D&amp;reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#4 lore raw

[AMD Public Use]

Is the xclk really 25 Mhz or is there some divider for the fan stuff? Changing the xclk value will affect other places where this is used.

Alex

________________________________
From: Chen, Guchun <[email protected]>
Sent: Tuesday, January 26, 2021 11:33 PM
To: Quan, Evan <[email protected]>; Alex Deucher <[email protected]>; [email protected] <[email protected]>
Cc: Deucher, Alexander <[email protected]>
Subject: RE: [PATCH] drm/amdgpu/pm/smu11: fix static fan speed readback

[AMD Public Use]

In soc15_get_xclk, we have independent handling for CHIP_RAVEN case.

If (adev->asic_type == CHIP_RAVEN)

        return reference_clock / 4;

I am not sure if it's better to squash the patch into the asic specific function? Then we have one unified place to handle it.

Regards,
Guchun

-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Quan, Evan
Sent: Wednesday, January 27, 2021 11:46 AM
To: Alex Deucher <[email protected]>; [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: RE: [PATCH] drm/amdgpu/pm/smu11: fix static fan speed readback

[AMD Official Use Only - Internal Distribution Only]

[AMD Official Use Only - Internal Distribution Only]

Actually after switching to retrieve fan speed from metrics table always, this API is not used any more. Maybe we can just drop it. Either way the patch is reviewed-by: Evan Quan <[email protected]>

BR
Evan
-----Original Message-----
From: amd-gfx <[email protected]> On Behalf Of Alex Deucher
Sent: Wednesday, January 27, 2021 2:17 AM
To: [email protected]
Cc: Deucher, Alexander <[email protected]>
Subject: [PATCH] drm/amdgpu/pm/smu11: fix static fan speed readback

The xclk needs to be divided by 4.

Fixes acab02c1af43d3 ("drm/amdgpu/pm/smu11: Fix fan set speed bug")
---
 drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +5 -2
index 147efe12973c..36dac106ed4b 100644
@@ -1245,7 +1245,11 @@ int smu_v11_0_get_fan_speed_rpm(struct smu_context *smu,  if (!tach_period)  return -EINVAL;
 
-crystal_clock_freq = amdgpu_asic_get_xclk(adev);
+/*
+ * crystal_clock_freq div by 4 is required since the fan control
+ * module refers to 25MHz
+ */
+crystal_clock_freq = amdgpu_asic_get_xclk(adev) / 4;
 
 tmp64 = (uint64_t)crystal_clock_freq * 60 * 10000;  do_div(tmp64, (tach_period * 8));
--

2.29.2

_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7Cguchun.chen%40amd.com%7Ccacc23400e334530b87208d8c2760341%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637473159431451098%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=e%2BzrZgRQDkOb4ElNJNiLWP%2FHBM0cIQl4GwKFuYfvsP8%3D&amp;reserved=0
_______________________________________________
amd-gfx mailing list
[email protected]
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7Cguchun.chen%40amd.com%7Ccacc23400e334530b87208d8c2760341%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637473159431461091%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=lp9Gu3pJ7GdDbF1BJNlIQr4Z0TCY%2BTVDGtDWzZ2bR2Q%3D&amp;reserved=0

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#5 lore raw

[AMD Public Use]

As far as I know, refclk is fixed at 25M for TACH; no need to consider ASIC refclk.

Thanks,
Lijo

From: amd-gfx <[email protected]> On Behalf Of Deucher, Alexander
Sent: Wednesday, January 27, 2021 10:05 AM
To: Chen, Guchun <[email protected]>; Quan, Evan <[email protected]>; Alex Deucher <[email protected]>; [email protected]
Subject: Re: [PATCH] drm/amdgpu/pm/smu11: fix static fan speed readback

[AMD Public Use]

[AMD Public Use]

Is the xclk really 25 Mhz or is there some divider for the fan stuff? Changing the xclk value will affect other places where this is used.

Alex

________________________________
From: Chen, Guchun <[email protected]<mailto:[email protected]>>
Sent: Tuesday, January 26, 2021 11:33 PM
To: Quan, Evan <[email protected]<mailto:[email protected]>>; Alex Deucher <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>
Cc: Deucher, Alexander <[email protected]<mailto:[email protected]>>
Subject: RE: [PATCH] drm/amdgpu/pm/smu11: fix static fan speed readback

[AMD Public Use]

In soc15_get_xclk, we have independent handling for CHIP_RAVEN case.

If (adev->asic_type == CHIP_RAVEN)

        return reference_clock / 4;

I am not sure if it's better to squash the patch into the asic specific function? Then we have one unified place to handle it.

Regards,
Guchun

-----Original Message-----
From: amd-gfx <[email protected]<mailto:[email protected]>> On Behalf Of Quan, Evan
Sent: Wednesday, January 27, 2021 11:46 AM
To: Alex Deucher <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>
Cc: Deucher, Alexander <[email protected]<mailto:[email protected]>>
Subject: RE: [PATCH] drm/amdgpu/pm/smu11: fix static fan speed readback

[AMD Official Use Only - Internal Distribution Only]

[AMD Official Use Only - Internal Distribution Only]

Actually after switching to retrieve fan speed from metrics table always, this API is not used any more. Maybe we can just drop it. Either way the patch is reviewed-by: Evan Quan <[email protected]<mailto:[email protected]>>

BR
Evan
-----Original Message-----
From: amd-gfx <[email protected]<mailto:[email protected]>> On Behalf Of Alex Deucher
Sent: Wednesday, January 27, 2021 2:17 AM
To: [email protected]<mailto:[email protected]>
Cc: Deucher, Alexander <[email protected]<mailto:[email protected]>>
Subject: [PATCH] drm/amdgpu/pm/smu11: fix static fan speed readback

The xclk needs to be divided by 4.

Fixes acab02c1af43d3 ("drm/amdgpu/pm/smu11: Fix fan set speed bug")
---
 drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +5 -2
index 147efe12973c..36dac106ed4b 100644
@@ -1245,7 +1245,11 @@ int smu_v11_0_get_fan_speed_rpm(struct smu_context *smu,  if (!tach_period)  return -EINVAL;
 
-crystal_clock_freq = amdgpu_asic_get_xclk(adev);
+/*
+ * crystal_clock_freq div by 4 is required since the fan control
+ * module refers to 25MHz
+ */
+crystal_clock_freq = amdgpu_asic_get_xclk(adev) / 4;
 
 tmp64 = (uint64_t)crystal_clock_freq * 60 * 10000;  do_div(tmp64, (tach_period * 8));
--

2.29.2

_______________________________________________
amd-gfx mailing list [email protected]<mailto:[email protected]>
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7Cguchun.chen%40amd.com%7Ccacc23400e334530b87208d8c2760341%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637473159431451098%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=e%2BzrZgRQDkOb4ElNJNiLWP%2FHBM0cIQl4GwKFuYfvsP8%3D&amp;reserved=0<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7Clijo.lazar%40amd.com%7C8cdef44e170e4198c00e08d8c27ce642%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637473189035661354%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=pfK0LTxZUBVlvvX3zs3DQjmtYyOJkNdFIBUGkTCyopg%3D&reserved=0>
_______________________________________________
amd-gfx mailing list [email protected]<mailto:[email protected]>
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7Cguchun.chen%40amd.com%7Ccacc23400e334530b87208d8c2760341%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637473159431461091%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=lp9Gu3pJ7GdDbF1BJNlIQr4Z0TCY%2BTVDGtDWzZ2bR2Q%3D&amp;reserved=0<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7Clijo.lazar%40amd.com%7C8cdef44e170e4198c00e08d8c27ce642%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637473189035671303%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=a%2BTTK%2BJ0YjbNe9irLE9GRgK0koyGYKfrtcMUR0wkvxs%3D&reserved=0>

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#6 lore raw

[AMD Public Use]

As Evan said, this code is unused anyway and I have a patch in the works to drop all of this anyway. The manual manual rpm interface seems to not work on some boards at all. I guess the pwm interface is a better bet for manual fan control. See:
https://gitlab.freedesktop.org/agd5f/linux/-/commit/892cba31627b019c26a9c56016e6ebd442166678

Alex
________________________________
From: Lazar, Lijo <[email protected]>
Sent: Tuesday, January 26, 2021 11:37 PM
To: Deucher, Alexander <[email protected]>; Chen, Guchun <[email protected]>; Quan, Evan <[email protected]>; Alex Deucher <[email protected]>; [email protected] <[email protected]>
Subject: RE: [PATCH] drm/amdgpu/pm/smu11: fix static fan speed readback

[AMD Public Use]

As far as I know, refclk is fixed at 25M for TACH; no need to consider ASIC refclk.

Thanks,

Lijo

From: amd-gfx <[email protected]> On Behalf Of Deucher, Alexander
Sent: Wednesday, January 27, 2021 10:05 AM
To: Chen, Guchun <[email protected]>; Quan, Evan <[email protected]>; Alex Deucher <[email protected]>; [email protected]
Subject: Re: [PATCH] drm/amdgpu/pm/smu11: fix static fan speed readback

[AMD Public Use]

[AMD Public Use]

Is the xclk really 25 Mhz or is there some divider for the fan stuff? Changing the xclk value will affect other places where this is used.

Alex

________________________________

From: Chen, Guchun <[email protected]<mailto:[email protected]>>
Sent: Tuesday, January 26, 2021 11:33 PM
To: Quan, Evan <[email protected]<mailto:[email protected]>>; Alex Deucher <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>
Cc: Deucher, Alexander <[email protected]<mailto:[email protected]>>
Subject: RE: [PATCH] drm/amdgpu/pm/smu11: fix static fan speed readback

[AMD Public Use]

In soc15_get_xclk, we have independent handling for CHIP_RAVEN case.

If (adev->asic_type == CHIP_RAVEN)

        return reference_clock / 4;

I am not sure if it's better to squash the patch into the asic specific function? Then we have one unified place to handle it.

Regards,
Guchun

-----Original Message-----
From: amd-gfx <[email protected]<mailto:[email protected]>> On Behalf Of Quan, Evan
Sent: Wednesday, January 27, 2021 11:46 AM
To: Alex Deucher <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>
Cc: Deucher, Alexander <[email protected]<mailto:[email protected]>>
Subject: RE: [PATCH] drm/amdgpu/pm/smu11: fix static fan speed readback

[AMD Official Use Only - Internal Distribution Only]

[AMD Official Use Only - Internal Distribution Only]

Actually after switching to retrieve fan speed from metrics table always, this API is not used any more. Maybe we can just drop it. Either way the patch is reviewed-by: Evan Quan <[email protected]<mailto:[email protected]>>

BR
Evan
-----Original Message-----
From: amd-gfx <[email protected]<mailto:[email protected]>> On Behalf Of Alex Deucher
Sent: Wednesday, January 27, 2021 2:17 AM
To: [email protected]<mailto:[email protected]>
Cc: Deucher, Alexander <[email protected]<mailto:[email protected]>>
Subject: [PATCH] drm/amdgpu/pm/smu11: fix static fan speed readback

The xclk needs to be divided by 4.

Fixes acab02c1af43d3 ("drm/amdgpu/pm/smu11: Fix fan set speed bug")
---
 drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +5 -2
index 147efe12973c..36dac106ed4b 100644
@@ -1245,7 +1245,11 @@ int smu_v11_0_get_fan_speed_rpm(struct smu_context *smu,  if (!tach_period)  return -EINVAL;
 
-crystal_clock_freq = amdgpu_asic_get_xclk(adev);
+/*
+ * crystal_clock_freq div by 4 is required since the fan control
+ * module refers to 25MHz
+ */
+crystal_clock_freq = amdgpu_asic_get_xclk(adev) / 4;
 
 tmp64 = (uint64_t)crystal_clock_freq * 60 * 10000;  do_div(tmp64, (tach_period * 8));
--

2.29.2

_______________________________________________
amd-gfx mailing list [email protected]<mailto:[email protected]>
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7Cguchun.chen%40amd.com%7Ccacc23400e334530b87208d8c2760341%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637473159431451098%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=e%2BzrZgRQDkOb4ElNJNiLWP%2FHBM0cIQl4GwKFuYfvsP8%3D&amp;reserved=0<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7Clijo.lazar%40amd.com%7C8cdef44e170e4198c00e08d8c27ce642%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637473189035661354%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=pfK0LTxZUBVlvvX3zs3DQjmtYyOJkNdFIBUGkTCyopg%3D&reserved=0>
_______________________________________________
amd-gfx mailing list [email protected]<mailto:[email protected]>
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7Cguchun.chen%40amd.com%7Ccacc23400e334530b87208d8c2760341%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637473159431461091%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=lp9Gu3pJ7GdDbF1BJNlIQr4Z0TCY%2BTVDGtDWzZ2bR2Q%3D&amp;reserved=0<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7Clijo.lazar%40amd.com%7C8cdef44e170e4198c00e08d8c27ce642%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637473189035671303%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=a%2BTTK%2BJ0YjbNe9irLE9GRgK0koyGYKfrtcMUR0wkvxs%3D&reserved=0>

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

#7 lore raw

[AMD Public Use]

Agree and the patch looks good so far.

Thanks,
Lijo

From: Deucher, Alexander <[email protected]>
Sent: Wednesday, January 27, 2021 10:13 AM
To: Lazar, Lijo <[email protected]>; Chen, Guchun <[email protected]>; Quan, Evan <[email protected]>; Alex Deucher <[email protected]>; [email protected]
Subject: Re: [PATCH] drm/amdgpu/pm/smu11: fix static fan speed readback

[AMD Public Use]

As Evan said, this code is unused anyway and I have a patch in the works to drop all of this anyway. The manual manual rpm interface seems to not work on some boards at all. I guess the pwm interface is a better bet for manual fan control. See:
https://gitlab.freedesktop.org/agd5f/linux/-/commit/892cba31627b019c26a9c56016e6ebd442166678

Alex
________________________________
From: Lazar, Lijo <[email protected]<mailto:[email protected]>>
Sent: Tuesday, January 26, 2021 11:37 PM
To: Deucher, Alexander <[email protected]<mailto:[email protected]>>; Chen, Guchun <[email protected]<mailto:[email protected]>>; Quan, Evan <[email protected]<mailto:[email protected]>>; Alex Deucher <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>
Subject: RE: [PATCH] drm/amdgpu/pm/smu11: fix static fan speed readback

[AMD Public Use]

As far as I know, refclk is fixed at 25M for TACH; no need to consider ASIC refclk.

Thanks,

Lijo

From: amd-gfx <[email protected]<mailto:[email protected]>> On Behalf Of Deucher, Alexander
Sent: Wednesday, January 27, 2021 10:05 AM
To: Chen, Guchun <[email protected]<mailto:[email protected]>>; Quan, Evan <[email protected]<mailto:[email protected]>>; Alex Deucher <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>
Subject: Re: [PATCH] drm/amdgpu/pm/smu11: fix static fan speed readback

[AMD Public Use]

[AMD Public Use]

Is the xclk really 25 Mhz or is there some divider for the fan stuff? Changing the xclk value will affect other places where this is used.

Alex

________________________________

From: Chen, Guchun <[email protected]<mailto:[email protected]>>
Sent: Tuesday, January 26, 2021 11:33 PM
To: Quan, Evan <[email protected]<mailto:[email protected]>>; Alex Deucher <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]> <[email protected]<mailto:[email protected]>>
Cc: Deucher, Alexander <[email protected]<mailto:[email protected]>>
Subject: RE: [PATCH] drm/amdgpu/pm/smu11: fix static fan speed readback

[AMD Public Use]

In soc15_get_xclk, we have independent handling for CHIP_RAVEN case.

If (adev->asic_type == CHIP_RAVEN)

        return reference_clock / 4;

I am not sure if it's better to squash the patch into the asic specific function? Then we have one unified place to handle it.

Regards,
Guchun

-----Original Message-----
From: amd-gfx <[email protected]<mailto:[email protected]>> On Behalf Of Quan, Evan
Sent: Wednesday, January 27, 2021 11:46 AM
To: Alex Deucher <[email protected]<mailto:[email protected]>>; [email protected]<mailto:[email protected]>
Cc: Deucher, Alexander <[email protected]<mailto:[email protected]>>
Subject: RE: [PATCH] drm/amdgpu/pm/smu11: fix static fan speed readback

[AMD Official Use Only - Internal Distribution Only]

[AMD Official Use Only - Internal Distribution Only]

Actually after switching to retrieve fan speed from metrics table always, this API is not used any more. Maybe we can just drop it. Either way the patch is reviewed-by: Evan Quan <[email protected]<mailto:[email protected]>>

BR
Evan
-----Original Message-----
From: amd-gfx <[email protected]<mailto:[email protected]>> On Behalf Of Alex Deucher
Sent: Wednesday, January 27, 2021 2:17 AM
To: [email protected]<mailto:[email protected]>
Cc: Deucher, Alexander <[email protected]<mailto:[email protected]>>
Subject: [PATCH] drm/amdgpu/pm/smu11: fix static fan speed readback

The xclk needs to be divided by 4.

Fixes acab02c1af43d3 ("drm/amdgpu/pm/smu11: Fix fan set speed bug")
---
 drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/amd/pm/swsmu/smu11/smu_v11_0.c +5 -2
index 147efe12973c..36dac106ed4b 100644
@@ -1245,7 +1245,11 @@ int smu_v11_0_get_fan_speed_rpm(struct smu_context *smu,  if (!tach_period)  return -EINVAL;
 
-crystal_clock_freq = amdgpu_asic_get_xclk(adev);
+/*
+ * crystal_clock_freq div by 4 is required since the fan control
+ * module refers to 25MHz
+ */
+crystal_clock_freq = amdgpu_asic_get_xclk(adev) / 4;
 
 tmp64 = (uint64_t)crystal_clock_freq * 60 * 10000;  do_div(tmp64, (tach_period * 8));
--

2.29.2

_______________________________________________
amd-gfx mailing list [email protected]<mailto:[email protected]>
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7Cguchun.chen%40amd.com%7Ccacc23400e334530b87208d8c2760341%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637473159431451098%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=e%2BzrZgRQDkOb4ElNJNiLWP%2FHBM0cIQl4GwKFuYfvsP8%3D&amp;reserved=0<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7Clijo.lazar%40amd.com%7C8cdef44e170e4198c00e08d8c27ce642%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637473189035661354%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=pfK0LTxZUBVlvvX3zs3DQjmtYyOJkNdFIBUGkTCyopg%3D&reserved=0>
_______________________________________________
amd-gfx mailing list [email protected]<mailto:[email protected]>
https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&amp;data=04%7C01%7Cguchun.chen%40amd.com%7Ccacc23400e334530b87208d8c2760341%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637473159431461091%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=lp9Gu3pJ7GdDbF1BJNlIQr4Z0TCY%2BTVDGtDWzZ2bR2Q%3D&amp;reserved=0<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.freedesktop.org%2Fmailman%2Flistinfo%2Famd-gfx&data=04%7C01%7Clijo.lazar%40amd.com%7C8cdef44e170e4198c00e08d8c27ce642%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637473189035671303%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=a%2BTTK%2BJ0YjbNe9irLE9GRgK0koyGYKfrtcMUR0wkvxs%3D&reserved=0>

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx