From: Guchun Chen Date: Thu, 14 Jul 2022 07:32:51 +0000 (+0800) Subject: drm/amdgpu: introduce runtime pm mode X-Git-Tag: v6.6.17~6802^2~3^2~118 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=50fe04d46aab77cf8fc3d48fbc38d872d181a849;p=platform%2Fkernel%2Flinux-rpi.git drm/amdgpu: introduce runtime pm mode It can benefit code consistency in future. Suggested-by: Lijo Lazar Signed-off-by: Guchun Chen Reviewed-by: Lijo Lazar Reviewed-by: Evan Quan Signed-off-by: Alex Deucher --- diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c index 6de63ea..fbbcdbd 100644 --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_kms.c @@ -161,10 +161,12 @@ int amdgpu_driver_load_kms(struct amdgpu_device *adev, unsigned long flags) if (amdgpu_device_supports_px(dev) && (amdgpu_runtime_pm != 0)) { /* enable runpm by default for atpx */ adev->runpm = true; + adev->pm.rpm_mode = AMDGPU_RUNPM_PX; dev_info(adev->dev, "Using ATPX for runtime pm\n"); } else if (amdgpu_device_supports_boco(dev) && (amdgpu_runtime_pm != 0)) { /* enable runpm by default for boco */ adev->runpm = true; + adev->pm.rpm_mode = AMDGPU_RUNPM_BOCO; dev_info(adev->dev, "Using BOCO for runtime pm\n"); } else if (amdgpu_device_supports_baco(dev) && (amdgpu_runtime_pm != 0)) { @@ -188,8 +190,10 @@ int amdgpu_driver_load_kms(struct amdgpu_device *adev, unsigned long flags) amdgpu_runtime_pm_quirk(adev); - if (adev->runpm) + if (adev->runpm) { + adev->pm.rpm_mode = AMDGPU_RUNPM_BACO; dev_info(adev->dev, "Using BACO for runtime pm\n"); + } } /* Call ACPI methods: require modeset init diff --git a/drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h b/drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h index 524fb09..65624d0 100644 --- a/drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h +++ b/drivers/gpu/drm/amd/pm/inc/amdgpu_dpm.h @@ -45,6 +45,13 @@ enum amdgpu_int_thermal_type { THERMAL_TYPE_KV, }; +enum amdgpu_runpm_mode { + AMDGPU_RUNPM_NONE, + AMDGPU_RUNPM_PX, + AMDGPU_RUNPM_BOCO, + AMDGPU_RUNPM_BACO, +}; + struct amdgpu_ps { u32 caps; /* vbios flags */ u32 class; /* vbios flags */ @@ -355,6 +362,8 @@ struct amdgpu_pm { struct amdgpu_ctx *stable_pstate_ctx; struct config_table_setting config_table; + /* runtime mode */ + enum amdgpu_runpm_mode rpm_mode; }; int amdgpu_dpm_read_sensor(struct amdgpu_device *adev, enum amd_pp_sensors sensor,