[PATCH] drm/amd/powerplay: use hardware fan control if no powerplay fan table

Alex Deucher alexdeucher at gmail.com
Fri Jun 28 13:52:16 UTC 2019


On Thu, Jun 27, 2019 at 11:15 PM Evan Quan <evan.quan at amd.com> wrote:
>
> Use SMC default fan table if no external powerplay fan table.

Maybe add a line saying you may get errors if the table is empty and
you try and use it.  With that,
Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

>
> Change-Id: Icd7467a7fc5287a92945ba0fcc19699192b1683a
> Signed-off-by: Evan Quan <evan.quan at amd.com>
> ---
>  drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c | 4 +++-
>  drivers/gpu/drm/amd/powerplay/inc/hwmgr.h                   | 1 +
>  drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c     | 4 ++++
>  3 files changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c b/drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c
> index ae64ff7153d6..1cd5a8b5cdc1 100644
> --- a/drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c
> +++ b/drivers/gpu/drm/amd/powerplay/hwmgr/process_pptables_v1_0.c
> @@ -916,8 +916,10 @@ static int init_thermal_controller(
>                         PHM_PlatformCaps_ThermalController
>                   );
>
> -       if (0 == powerplay_table->usFanTableOffset)
> +       if (0 == powerplay_table->usFanTableOffset) {
> +               hwmgr->thermal_controller.use_hw_fan_control = 1;
>                 return 0;
> +       }
>
>         fan_table = (const PPTable_Generic_SubTable_Header *)
>                 (((unsigned long)powerplay_table) +
> diff --git a/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h b/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h
> index 2f186fcbdfc5..ec53bf24396e 100644
> --- a/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h
> +++ b/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h
> @@ -697,6 +697,7 @@ struct pp_thermal_controller_info {
>         uint8_t ucType;
>         uint8_t ucI2cLine;
>         uint8_t ucI2cAddress;
> +       uint8_t use_hw_fan_control;
>         struct pp_fan_info fanInfo;
>         struct pp_advance_fan_control_parameters advanceFanControlParameters;
>  };
> diff --git a/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c b/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c
> index fbac2d3326b5..a1a9f6196009 100644
> --- a/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c
> +++ b/drivers/gpu/drm/amd/powerplay/smumgr/polaris10_smumgr.c
> @@ -2092,6 +2092,10 @@ static int polaris10_thermal_setup_fan_table(struct pp_hwmgr *hwmgr)
>                 return 0;
>         }
>
> +       /* use hardware fan control */
> +       if (hwmgr->thermal_controller.use_hw_fan_control)
> +               return 0;
> +
>         tmp64 = hwmgr->thermal_controller.advanceFanControlParameters.
>                         usPWMMin * duty100;
>         do_div(tmp64, 10000);
> --
> 2.21.0
>
> _______________________________________________
> amd-gfx mailing list
> amd-gfx at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/amd-gfx


More information about the amd-gfx mailing list