aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/gpu/drm/amd/amdgpu/dce_v10_0.c42
-rw-r--r--drivers/gpu/drm/amd/amdgpu/dce_v10_0.h2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/dce_v11_0.c53
-rw-r--r--drivers/gpu/drm/amd/amdgpu/dce_v11_0.h2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/dce_v8_0.c51
-rw-r--r--drivers/gpu/drm/amd/amdgpu/dce_v8_0.h2
-rw-r--r--drivers/gpu/drm/amd/amdgpu/dce_virtual.c32
7 files changed, 173 insertions, 11 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
index 7f642b57223e..b888d7223e8e 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.c
@@ -712,6 +712,45 @@ static void dce_v10_0_set_vga_render_state(struct amdgpu_device *adev,
712 WREG32(mmVGA_RENDER_CONTROL, tmp); 712 WREG32(mmVGA_RENDER_CONTROL, tmp);
713} 713}
714 714
715static int dce_v10_0_get_num_crtc(struct amdgpu_device *adev)
716{
717 int num_crtc = 0;
718
719 switch (adev->asic_type) {
720 case CHIP_FIJI:
721 case CHIP_TONGA:
722 num_crtc = 6;
723 break;
724 default:
725 num_crtc = 0;
726 }
727 return num_crtc;
728}
729
730void dce_v10_0_disable_dce(struct amdgpu_device *adev)
731{
732 /*Disable VGA render and enabled crtc, if has DCE engine*/
733 if (amdgpu_atombios_has_dce_engine_info(adev)) {
734 u32 tmp;
735 int crtc_enabled, i;
736
737 dce_v10_0_set_vga_render_state(adev, false);
738
739 /*Disable crtc*/
740 for (i = 0; i < dce_v10_0_get_num_crtc(adev); i++) {
741 crtc_enabled = REG_GET_FIELD(RREG32(mmCRTC_CONTROL + crtc_offsets[i]),
742 CRTC_CONTROL, CRTC_MASTER_EN);
743 if (crtc_enabled) {
744 WREG32(mmCRTC_UPDATE_LOCK + crtc_offsets[i], 1);
745 tmp = RREG32(mmCRTC_CONTROL + crtc_offsets[i]);
746 tmp = REG_SET_FIELD(tmp, CRTC_CONTROL, CRTC_MASTER_EN, 0);
747 WREG32(mmCRTC_CONTROL + crtc_offsets[i], tmp);
748 WREG32(mmCRTC_UPDATE_LOCK + crtc_offsets[i], 0);
749 }
750 }
751 }
752}
753
715static void dce_v10_0_program_fmt(struct drm_encoder *encoder) 754static void dce_v10_0_program_fmt(struct drm_encoder *encoder)
716{ 755{
717 struct drm_device *dev = encoder->dev; 756 struct drm_device *dev = encoder->dev;
@@ -2962,10 +3001,11 @@ static int dce_v10_0_early_init(void *handle)
2962 dce_v10_0_set_display_funcs(adev); 3001 dce_v10_0_set_display_funcs(adev);
2963 dce_v10_0_set_irq_funcs(adev); 3002 dce_v10_0_set_irq_funcs(adev);
2964 3003
3004 adev->mode_info.num_crtc = dce_v10_0_get_num_crtc(adev);
3005
2965 switch (adev->asic_type) { 3006 switch (adev->asic_type) {
2966 case CHIP_FIJI: 3007 case CHIP_FIJI:
2967 case CHIP_TONGA: 3008 case CHIP_TONGA:
2968 adev->mode_info.num_crtc = 6; /* XXX 7??? */
2969 adev->mode_info.num_hpd = 6; 3009 adev->mode_info.num_hpd = 6;
2970 adev->mode_info.num_dig = 7; 3010 adev->mode_info.num_dig = 7;
2971 break; 3011 break;
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.h b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.h
index 1bfa48ddd8a6..e3dc04d293e4 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v10_0.h
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v10_0.h
@@ -26,4 +26,6 @@
26 26
27extern const struct amd_ip_funcs dce_v10_0_ip_funcs; 27extern const struct amd_ip_funcs dce_v10_0_ip_funcs;
28 28
29void dce_v10_0_disable_dce(struct amdgpu_device *adev);
30
29#endif 31#endif
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
index d4bf133908b1..cfadd79d2580 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.c
@@ -673,6 +673,53 @@ static void dce_v11_0_set_vga_render_state(struct amdgpu_device *adev,
673 WREG32(mmVGA_RENDER_CONTROL, tmp); 673 WREG32(mmVGA_RENDER_CONTROL, tmp);
674} 674}
675 675
676static int dce_v11_0_get_num_crtc (struct amdgpu_device *adev)
677{
678 int num_crtc = 0;
679
680 switch (adev->asic_type) {
681 case CHIP_CARRIZO:
682 num_crtc = 3;
683 break;
684 case CHIP_STONEY:
685 num_crtc = 2;
686 break;
687 case CHIP_POLARIS10:
688 num_crtc = 6;
689 break;
690 case CHIP_POLARIS11:
691 num_crtc = 5;
692 break;
693 default:
694 num_crtc = 0;
695 }
696 return num_crtc;
697}
698
699void dce_v11_0_disable_dce(struct amdgpu_device *adev)
700{
701 /*Disable VGA render and enabled crtc, if has DCE engine*/
702 if (amdgpu_atombios_has_dce_engine_info(adev)) {
703 u32 tmp;
704 int crtc_enabled, i;
705
706 dce_v11_0_set_vga_render_state(adev, false);
707
708 /*Disable crtc*/
709 for (i = 0; i < dce_v11_0_get_num_crtc(adev); i++) {
710 crtc_enabled = REG_GET_FIELD(RREG32(mmCRTC_CONTROL + crtc_offsets[i]),
711 CRTC_CONTROL, CRTC_MASTER_EN);
712 if (crtc_enabled) {
713 WREG32(mmCRTC_UPDATE_LOCK + crtc_offsets[i], 1);
714 tmp = RREG32(mmCRTC_CONTROL + crtc_offsets[i]);
715 tmp = REG_SET_FIELD(tmp, CRTC_CONTROL, CRTC_MASTER_EN, 0);
716 WREG32(mmCRTC_CONTROL + crtc_offsets[i], tmp);
717 WREG32(mmCRTC_UPDATE_LOCK + crtc_offsets[i], 0);
718 }
719 }
720 }
721}
722
676static void dce_v11_0_program_fmt(struct drm_encoder *encoder) 723static void dce_v11_0_program_fmt(struct drm_encoder *encoder)
677{ 724{
678 struct drm_device *dev = encoder->dev; 725 struct drm_device *dev = encoder->dev;
@@ -2999,24 +3046,22 @@ static int dce_v11_0_early_init(void *handle)
2999 dce_v11_0_set_display_funcs(adev); 3046 dce_v11_0_set_display_funcs(adev);
3000 dce_v11_0_set_irq_funcs(adev); 3047 dce_v11_0_set_irq_funcs(adev);
3001 3048
3049 adev->mode_info.num_crtc = dce_v11_0_get_num_crtc(adev);
3050
3002 switch (adev->asic_type) { 3051 switch (adev->asic_type) {
3003 case CHIP_CARRIZO: 3052 case CHIP_CARRIZO:
3004 adev->mode_info.num_crtc = 3;
3005 adev->mode_info.num_hpd = 6; 3053 adev->mode_info.num_hpd = 6;
3006 adev->mode_info.num_dig = 9; 3054 adev->mode_info.num_dig = 9;
3007 break; 3055 break;
3008 case CHIP_STONEY: 3056 case CHIP_STONEY:
3009 adev->mode_info.num_crtc = 2;
3010 adev->mode_info.num_hpd = 6; 3057 adev->mode_info.num_hpd = 6;
3011 adev->mode_info.num_dig = 9; 3058 adev->mode_info.num_dig = 9;
3012 break; 3059 break;
3013 case CHIP_POLARIS10: 3060 case CHIP_POLARIS10:
3014 adev->mode_info.num_crtc = 6;
3015 adev->mode_info.num_hpd = 6; 3061 adev->mode_info.num_hpd = 6;
3016 adev->mode_info.num_dig = 6; 3062 adev->mode_info.num_dig = 6;
3017 break; 3063 break;
3018 case CHIP_POLARIS11: 3064 case CHIP_POLARIS11:
3019 adev->mode_info.num_crtc = 5;
3020 adev->mode_info.num_hpd = 5; 3065 adev->mode_info.num_hpd = 5;
3021 adev->mode_info.num_dig = 5; 3066 adev->mode_info.num_dig = 5;
3022 break; 3067 break;
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.h b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.h
index 84e4618f5253..1f58a65ba2ef 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v11_0.h
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v11_0.h
@@ -26,4 +26,6 @@
26 26
27extern const struct amd_ip_funcs dce_v11_0_ip_funcs; 27extern const struct amd_ip_funcs dce_v11_0_ip_funcs;
28 28
29void dce_v11_0_disable_dce(struct amdgpu_device *adev);
30
29#endif 31#endif
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
index 4fdfab1e9200..e4467b8ff40c 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.c
@@ -604,6 +604,52 @@ static void dce_v8_0_set_vga_render_state(struct amdgpu_device *adev,
604 WREG32(mmVGA_RENDER_CONTROL, tmp); 604 WREG32(mmVGA_RENDER_CONTROL, tmp);
605} 605}
606 606
607static int dce_v8_0_get_num_crtc(struct amdgpu_device *adev)
608{
609 int num_crtc = 0;
610
611 switch (adev->asic_type) {
612 case CHIP_BONAIRE:
613 case CHIP_HAWAII:
614 num_crtc = 6;
615 break;
616 case CHIP_KAVERI:
617 num_crtc = 4;
618 break;
619 case CHIP_KABINI:
620 case CHIP_MULLINS:
621 num_crtc = 2;
622 break;
623 default:
624 num_crtc = 0;
625 }
626 return num_crtc;
627}
628
629void dce_v8_0_disable_dce(struct amdgpu_device *adev)
630{
631 /*Disable VGA render and enabled crtc, if has DCE engine*/
632 if (amdgpu_atombios_has_dce_engine_info(adev)) {
633 u32 tmp;
634 int crtc_enabled, i;
635
636 dce_v8_0_set_vga_render_state(adev, false);
637
638 /*Disable crtc*/
639 for (i = 0; i < dce_v8_0_get_num_crtc(adev); i++) {
640 crtc_enabled = REG_GET_FIELD(RREG32(mmCRTC_CONTROL + crtc_offsets[i]),
641 CRTC_CONTROL, CRTC_MASTER_EN);
642 if (crtc_enabled) {
643 WREG32(mmCRTC_UPDATE_LOCK + crtc_offsets[i], 1);
644 tmp = RREG32(mmCRTC_CONTROL + crtc_offsets[i]);
645 tmp = REG_SET_FIELD(tmp, CRTC_CONTROL, CRTC_MASTER_EN, 0);
646 WREG32(mmCRTC_CONTROL + crtc_offsets[i], tmp);
647 WREG32(mmCRTC_UPDATE_LOCK + crtc_offsets[i], 0);
648 }
649 }
650 }
651}
652
607static void dce_v8_0_program_fmt(struct drm_encoder *encoder) 653static void dce_v8_0_program_fmt(struct drm_encoder *encoder)
608{ 654{
609 struct drm_device *dev = encoder->dev; 655 struct drm_device *dev = encoder->dev;
@@ -2803,21 +2849,20 @@ static int dce_v8_0_early_init(void *handle)
2803 dce_v8_0_set_display_funcs(adev); 2849 dce_v8_0_set_display_funcs(adev);
2804 dce_v8_0_set_irq_funcs(adev); 2850 dce_v8_0_set_irq_funcs(adev);
2805 2851
2852 adev->mode_info.num_crtc = dce_v8_0_get_num_crtc(adev);
2853
2806 switch (adev->asic_type) { 2854 switch (adev->asic_type) {
2807 case CHIP_BONAIRE: 2855 case CHIP_BONAIRE:
2808 case CHIP_HAWAII: 2856 case CHIP_HAWAII:
2809 adev->mode_info.num_crtc = 6;
2810 adev->mode_info.num_hpd = 6; 2857 adev->mode_info.num_hpd = 6;
2811 adev->mode_info.num_dig = 6; 2858 adev->mode_info.num_dig = 6;
2812 break; 2859 break;
2813 case CHIP_KAVERI: 2860 case CHIP_KAVERI:
2814 adev->mode_info.num_crtc = 4;
2815 adev->mode_info.num_hpd = 6; 2861 adev->mode_info.num_hpd = 6;
2816 adev->mode_info.num_dig = 7; 2862 adev->mode_info.num_dig = 7;
2817 break; 2863 break;
2818 case CHIP_KABINI: 2864 case CHIP_KABINI:
2819 case CHIP_MULLINS: 2865 case CHIP_MULLINS:
2820 adev->mode_info.num_crtc = 2;
2821 adev->mode_info.num_hpd = 6; 2866 adev->mode_info.num_hpd = 6;
2822 adev->mode_info.num_dig = 6; /* ? */ 2867 adev->mode_info.num_dig = 6; /* ? */
2823 break; 2868 break;
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.h b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.h
index 77016852b252..7d0770c3a49b 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_v8_0.h
+++ b/drivers/gpu/drm/amd/amdgpu/dce_v8_0.h
@@ -26,4 +26,6 @@
26 26
27extern const struct amd_ip_funcs dce_v8_0_ip_funcs; 27extern const struct amd_ip_funcs dce_v8_0_ip_funcs;
28 28
29void dce_v8_0_disable_dce(struct amdgpu_device *adev);
30
29#endif 31#endif
diff --git a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
index d6802be0ea39..c7da45c2c8fe 100644
--- a/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
+++ b/drivers/gpu/drm/amd/amdgpu/dce_virtual.c
@@ -25,11 +25,13 @@
25#include "amdgpu_pm.h" 25#include "amdgpu_pm.h"
26#include "amdgpu_i2c.h" 26#include "amdgpu_i2c.h"
27#include "atom.h" 27#include "atom.h"
28#include "amdgpu_atombios.h"
29#include "atombios_crtc.h"
30#include "atombios_encoders.h"
31#include "amdgpu_pll.h" 28#include "amdgpu_pll.h"
32#include "amdgpu_connectors.h" 29#include "amdgpu_connectors.h"
30#ifdef CONFIG_DRM_AMDGPU_CIK
31#include "dce_v8_0.h"
32#endif
33#include "dce_v10_0.h"
34#include "dce_v11_0.h"
33 35
34static void dce_virtual_set_display_funcs(struct amdgpu_device *adev); 36static void dce_virtual_set_display_funcs(struct amdgpu_device *adev);
35static void dce_virtual_set_irq_funcs(struct amdgpu_device *adev); 37static void dce_virtual_set_irq_funcs(struct amdgpu_device *adev);
@@ -98,6 +100,30 @@ static bool dce_virtual_is_display_hung(struct amdgpu_device *adev)
98void dce_virtual_stop_mc_access(struct amdgpu_device *adev, 100void dce_virtual_stop_mc_access(struct amdgpu_device *adev,
99 struct amdgpu_mode_mc_save *save) 101 struct amdgpu_mode_mc_save *save)
100{ 102{
103 switch (adev->asic_type) {
104 case CHIP_BONAIRE:
105 case CHIP_HAWAII:
106 case CHIP_KAVERI:
107 case CHIP_KABINI:
108 case CHIP_MULLINS:
109#ifdef CONFIG_DRM_AMDGPU_CIK
110 dce_v8_0_disable_dce(adev);
111#endif
112 break;
113 case CHIP_FIJI:
114 case CHIP_TONGA:
115 dce_v10_0_disable_dce(adev);
116 break;
117 case CHIP_CARRIZO:
118 case CHIP_STONEY:
119 case CHIP_POLARIS11:
120 case CHIP_POLARIS10:
121 dce_v11_0_disable_dce(adev);
122 break;
123 default:
124 DRM_ERROR("Usupported ASIC type: 0x%X\n", adev->asic_type);
125 }
126
101 return; 127 return;
102} 128}
103void dce_virtual_resume_mc_access(struct amdgpu_device *adev, 129void dce_virtual_resume_mc_access(struct amdgpu_device *adev,