aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c')
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c24
1 files changed, 19 insertions, 5 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c
index 7a4b101e10c6..6043dc7c3a94 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c
@@ -816,10 +816,13 @@ static int amdgpu_cgs_get_active_displays_info(void *cgs_device,
816 struct drm_device *ddev = adev->ddev; 816 struct drm_device *ddev = adev->ddev;
817 struct drm_crtc *crtc; 817 struct drm_crtc *crtc;
818 uint32_t line_time_us, vblank_lines; 818 uint32_t line_time_us, vblank_lines;
819 struct cgs_mode_info *mode_info;
819 820
820 if (info == NULL) 821 if (info == NULL)
821 return -EINVAL; 822 return -EINVAL;
822 823
824 mode_info = info->mode_info;
825
823 if (adev->mode_info.num_crtc && adev->mode_info.mode_config_initialized) { 826 if (adev->mode_info.num_crtc && adev->mode_info.mode_config_initialized) {
824 list_for_each_entry(crtc, 827 list_for_each_entry(crtc,
825 &ddev->mode_config.crtc_list, head) { 828 &ddev->mode_config.crtc_list, head) {
@@ -828,7 +831,7 @@ static int amdgpu_cgs_get_active_displays_info(void *cgs_device,
828 info->active_display_mask |= (1 << amdgpu_crtc->crtc_id); 831 info->active_display_mask |= (1 << amdgpu_crtc->crtc_id);
829 info->display_count++; 832 info->display_count++;
830 } 833 }
831 if (info->mode_info != NULL && 834 if (mode_info != NULL &&
832 crtc->enabled && amdgpu_crtc->enabled && 835 crtc->enabled && amdgpu_crtc->enabled &&
833 amdgpu_crtc->hw_mode.clock) { 836 amdgpu_crtc->hw_mode.clock) {
834 line_time_us = (amdgpu_crtc->hw_mode.crtc_htotal * 1000) / 837 line_time_us = (amdgpu_crtc->hw_mode.crtc_htotal * 1000) /
@@ -836,10 +839,10 @@ static int amdgpu_cgs_get_active_displays_info(void *cgs_device,
836 vblank_lines = amdgpu_crtc->hw_mode.crtc_vblank_end - 839 vblank_lines = amdgpu_crtc->hw_mode.crtc_vblank_end -
837 amdgpu_crtc->hw_mode.crtc_vdisplay + 840 amdgpu_crtc->hw_mode.crtc_vdisplay +
838 (amdgpu_crtc->v_border * 2); 841 (amdgpu_crtc->v_border * 2);
839 info->mode_info->vblank_time_us = vblank_lines * line_time_us; 842 mode_info->vblank_time_us = vblank_lines * line_time_us;
840 info->mode_info->refresh_rate = drm_mode_vrefresh(&amdgpu_crtc->hw_mode); 843 mode_info->refresh_rate = drm_mode_vrefresh(&amdgpu_crtc->hw_mode);
841 info->mode_info->ref_clock = adev->clock.spll.reference_freq; 844 mode_info->ref_clock = adev->clock.spll.reference_freq;
842 info->mode_info++; 845 mode_info = NULL;
843 } 846 }
844 } 847 }
845 } 848 }
@@ -847,6 +850,16 @@ static int amdgpu_cgs_get_active_displays_info(void *cgs_device,
847 return 0; 850 return 0;
848} 851}
849 852
853
854static int amdgpu_cgs_notify_dpm_enabled(void *cgs_device, bool enabled)
855{
856 CGS_FUNC_ADEV;
857
858 adev->pm.dpm_enabled = enabled;
859
860 return 0;
861}
862
850/** \brief evaluate acpi namespace object, handle or pathname must be valid 863/** \brief evaluate acpi namespace object, handle or pathname must be valid
851 * \param cgs_device 864 * \param cgs_device
852 * \param info input/output arguments for the control method 865 * \param info input/output arguments for the control method
@@ -1097,6 +1110,7 @@ static const struct cgs_ops amdgpu_cgs_ops = {
1097 amdgpu_cgs_set_powergating_state, 1110 amdgpu_cgs_set_powergating_state,
1098 amdgpu_cgs_set_clockgating_state, 1111 amdgpu_cgs_set_clockgating_state,
1099 amdgpu_cgs_get_active_displays_info, 1112 amdgpu_cgs_get_active_displays_info,
1113 amdgpu_cgs_notify_dpm_enabled,
1100 amdgpu_cgs_call_acpi_method, 1114 amdgpu_cgs_call_acpi_method,
1101 amdgpu_cgs_query_system_info, 1115 amdgpu_cgs_query_system_info,
1102}; 1116};