* [PATCH] drm/amd/pp: Skip fan attributes if fan not present
@ 2018-04-27 5:52 Rex Zhu
[not found] ` <1524808367-5307-1-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org>
0 siblings, 1 reply; 2+ messages in thread
From: Rex Zhu @ 2018-04-27 5:52 UTC (permalink / raw)
To: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW; +Cc: Rex Zhu
With powerplay enabled, also need to skip fan attributes
if no fan present.
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 21 ++++++++-------------
drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c | 3 +++
2 files changed, 11 insertions(+), 13 deletions(-)
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
index d9802d9..2c82126 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
@@ -1364,19 +1364,14 @@ static umode_t hwmon_attributes_visible(struct kobject *kobj,
struct amdgpu_device *adev = dev_get_drvdata(dev);
umode_t effective_mode = attr->mode;
- /* handle non-powerplay limitations */
- if (!adev->powerplay.pp_handle) {
- /* Skip fan attributes if fan is not present */
- if (adev->pm.no_fan &&
- (attr == &sensor_dev_attr_pwm1.dev_attr.attr ||
- attr == &sensor_dev_attr_pwm1_enable.dev_attr.attr ||
- attr == &sensor_dev_attr_pwm1_max.dev_attr.attr ||
- attr == &sensor_dev_attr_pwm1_min.dev_attr.attr))
- return 0;
- /* requires powerplay */
- if (attr == &sensor_dev_attr_fan1_input.dev_attr.attr)
- return 0;
- }
+
+ /* Skip fan attributes if fan is not present */
+ if (adev->pm.no_fan && (attr == &sensor_dev_attr_pwm1.dev_attr.attr ||
+ attr == &sensor_dev_attr_pwm1_enable.dev_attr.attr ||
+ attr == &sensor_dev_attr_pwm1_max.dev_attr.attr ||
+ attr == &sensor_dev_attr_pwm1_min.dev_attr.attr ||
+ attr == &sensor_dev_attr_fan1_input.dev_attr.attr))
+ return 0;
/* Skip limit attributes if DPM is not enabled */
if (!adev->pm.dpm_enabled &&
diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
index d1052b5..43f0ea8 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
@@ -223,6 +223,9 @@ int hwmgr_hw_init(struct pp_hwmgr *hwmgr)
if (ret)
goto err;
+ ((struct amdgpu_device *)hwmgr->adev)->pm.no_fan =
+ hwmgr->thermal_controller.fanInfo.bNoFan;
+
ret = hwmgr->hwmgr_func->backend_init(hwmgr);
if (ret)
goto err1;
--
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] 2+ messages in thread
* Re: [PATCH] drm/amd/pp: Skip fan attributes if fan not present
[not found] ` <1524808367-5307-1-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org>
@ 2018-04-27 7:59 ` Huang Rui
0 siblings, 0 replies; 2+ messages in thread
From: Huang Rui @ 2018-04-27 7:59 UTC (permalink / raw)
To: Rex Zhu; +Cc: amd-gfx-PD4FTy7X32lNgt0PjOBp9y5qC8QIuHrW
On Fri, Apr 27, 2018 at 01:52:47PM +0800, Rex Zhu wrote:
> With powerplay enabled, also need to skip fan attributes
> if no fan present.
>
> Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
> ---
> drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c | 21 ++++++++-------------
> drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c | 3 +++
> 2 files changed, 11 insertions(+), 13 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
> index d9802d9..2c82126 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_pm.c
> @@ -1364,19 +1364,14 @@ static umode_t hwmon_attributes_visible(struct kobject *kobj,
> struct amdgpu_device *adev = dev_get_drvdata(dev);
> umode_t effective_mode = attr->mode;
>
> - /* handle non-powerplay limitations */
> - if (!adev->powerplay.pp_handle) {
> - /* Skip fan attributes if fan is not present */
> - if (adev->pm.no_fan &&
> - (attr == &sensor_dev_attr_pwm1.dev_attr.attr ||
> - attr == &sensor_dev_attr_pwm1_enable.dev_attr.attr ||
> - attr == &sensor_dev_attr_pwm1_max.dev_attr.attr ||
> - attr == &sensor_dev_attr_pwm1_min.dev_attr.attr))
> - return 0;
> - /* requires powerplay */
> - if (attr == &sensor_dev_attr_fan1_input.dev_attr.attr)
> - return 0;
> - }
> +
> + /* Skip fan attributes if fan is not present */
> + if (adev->pm.no_fan && (attr == &sensor_dev_attr_pwm1.dev_attr.attr ||
> + attr == &sensor_dev_attr_pwm1_enable.dev_attr.attr ||
> + attr == &sensor_dev_attr_pwm1_max.dev_attr.attr ||
> + attr == &sensor_dev_attr_pwm1_min.dev_attr.attr ||
> + attr == &sensor_dev_attr_fan1_input.dev_attr.attr))
> + return 0;
>
> /* Skip limit attributes if DPM is not enabled */
> if (!adev->pm.dpm_enabled &&
> diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
> index d1052b5..43f0ea8 100644
> --- a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
> +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
> @@ -223,6 +223,9 @@ int hwmgr_hw_init(struct pp_hwmgr *hwmgr)
> if (ret)
> goto err;
>
> + ((struct amdgpu_device *)hwmgr->adev)->pm.no_fan =
> + hwmgr->thermal_controller.fanInfo.bNoFan;
> +
> ret = hwmgr->hwmgr_func->backend_init(hwmgr);
> if (ret)
> goto err1;
> --
> 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] 2+ messages in thread
end of thread, other threads:[~2018-04-27 7:59 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-27 5:52 [PATCH] drm/amd/pp: Skip fan attributes if fan not present Rex Zhu
[not found] ` <1524808367-5307-1-git-send-email-Rex.Zhu-5C7GfCeVMHo@public.gmane.org>
2018-04-27 7:59 ` Huang Rui
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.