diff options
author | Dave Airlie <airlied@redhat.com> | 2015-04-07 21:19:24 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2015-04-07 21:19:24 -0400 |
commit | 5c7f0c27956a9884e29dbe5f83e56609fa00290f (patch) | |
tree | 6288c615392f617f00520442672a4ed5181df9b5 /drivers/gpu | |
parent | fa37a8c8237613d525437c4f9ec8add41749b314 (diff) | |
parent | 8f361b279f76b1e9548c9b3e59da63d3dec11bea (diff) |
Merge tag 'imx-drm-fixes-2015-03-31' of git://git.pengutronix.de/git/pza/linux into drm-next
imx-drm limit fixes
Fix IPU IC downscaler to its hardware limitation of 4:1 and the
IPU DI pixel clock divider integer part to 8-bit.
* tag 'imx-drm-fixes-2015-03-31' of git://git.pengutronix.de/git/pza/linux:
gpu: ipu-v3: turns out the IPU can only downsize 4:1
gpu: ipu-v3: limit pixel clock divider to 8-bits
drm/radeon: programm the VCE fw BAR as well
drm/radeon: always dump the ring content if it's available
radeon: Do not directly dereference pointers to BIOS area.
drm/radeon/dpm: fix 120hz handling harder
Diffstat (limited to 'drivers/gpu')
-rw-r--r-- | drivers/gpu/drm/radeon/cikd.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_bios.c | 10 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_pm.c | 22 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_ring.c | 2 | ||||
-rw-r--r-- | drivers/gpu/drm/radeon/vce_v2_0.c | 3 | ||||
-rw-r--r-- | drivers/gpu/ipu-v3/ipu-di.c | 9 | ||||
-rw-r--r-- | drivers/gpu/ipu-v3/ipu-ic.c | 4 |
8 files changed, 35 insertions, 17 deletions
diff --git a/drivers/gpu/drm/radeon/cikd.h b/drivers/gpu/drm/radeon/cikd.h index 4870df898230..0089d837a8e3 100644 --- a/drivers/gpu/drm/radeon/cikd.h +++ b/drivers/gpu/drm/radeon/cikd.h | |||
@@ -2131,6 +2131,7 @@ | |||
2131 | #define VCE_UENC_REG_CLOCK_GATING 0x207c0 | 2131 | #define VCE_UENC_REG_CLOCK_GATING 0x207c0 |
2132 | #define VCE_SYS_INT_EN 0x21300 | 2132 | #define VCE_SYS_INT_EN 0x21300 |
2133 | # define VCE_SYS_INT_TRAP_INTERRUPT_EN (1 << 3) | 2133 | # define VCE_SYS_INT_TRAP_INTERRUPT_EN (1 << 3) |
2134 | #define VCE_LMI_VCPU_CACHE_40BIT_BAR 0x2145c | ||
2134 | #define VCE_LMI_CTRL2 0x21474 | 2135 | #define VCE_LMI_CTRL2 0x21474 |
2135 | #define VCE_LMI_CTRL 0x21498 | 2136 | #define VCE_LMI_CTRL 0x21498 |
2136 | #define VCE_LMI_VM_CTRL 0x214a0 | 2137 | #define VCE_LMI_VM_CTRL 0x214a0 |
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h index 35ab65d53cc1..73a6432da1a5 100644 --- a/drivers/gpu/drm/radeon/radeon.h +++ b/drivers/gpu/drm/radeon/radeon.h | |||
@@ -1567,6 +1567,7 @@ struct radeon_dpm { | |||
1567 | int new_active_crtc_count; | 1567 | int new_active_crtc_count; |
1568 | u32 current_active_crtcs; | 1568 | u32 current_active_crtcs; |
1569 | int current_active_crtc_count; | 1569 | int current_active_crtc_count; |
1570 | bool single_display; | ||
1570 | struct radeon_dpm_dynamic_state dyn_state; | 1571 | struct radeon_dpm_dynamic_state dyn_state; |
1571 | struct radeon_dpm_fan fan; | 1572 | struct radeon_dpm_fan fan; |
1572 | u32 tdp_limit; | 1573 | u32 tdp_limit; |
diff --git a/drivers/gpu/drm/radeon/radeon_bios.c b/drivers/gpu/drm/radeon/radeon_bios.c index 63ccb8fa799c..d27e4ccb848c 100644 --- a/drivers/gpu/drm/radeon/radeon_bios.c +++ b/drivers/gpu/drm/radeon/radeon_bios.c | |||
@@ -76,7 +76,7 @@ static bool igp_read_bios_from_vram(struct radeon_device *rdev) | |||
76 | 76 | ||
77 | static bool radeon_read_bios(struct radeon_device *rdev) | 77 | static bool radeon_read_bios(struct radeon_device *rdev) |
78 | { | 78 | { |
79 | uint8_t __iomem *bios; | 79 | uint8_t __iomem *bios, val1, val2; |
80 | size_t size; | 80 | size_t size; |
81 | 81 | ||
82 | rdev->bios = NULL; | 82 | rdev->bios = NULL; |
@@ -86,15 +86,19 @@ static bool radeon_read_bios(struct radeon_device *rdev) | |||
86 | return false; | 86 | return false; |
87 | } | 87 | } |
88 | 88 | ||
89 | if (size == 0 || bios[0] != 0x55 || bios[1] != 0xaa) { | 89 | val1 = readb(&bios[0]); |
90 | val2 = readb(&bios[1]); | ||
91 | |||
92 | if (size == 0 || val1 != 0x55 || val2 != 0xaa) { | ||
90 | pci_unmap_rom(rdev->pdev, bios); | 93 | pci_unmap_rom(rdev->pdev, bios); |
91 | return false; | 94 | return false; |
92 | } | 95 | } |
93 | rdev->bios = kmemdup(bios, size, GFP_KERNEL); | 96 | rdev->bios = kzalloc(size, GFP_KERNEL); |
94 | if (rdev->bios == NULL) { | 97 | if (rdev->bios == NULL) { |
95 | pci_unmap_rom(rdev->pdev, bios); | 98 | pci_unmap_rom(rdev->pdev, bios); |
96 | return false; | 99 | return false; |
97 | } | 100 | } |
101 | memcpy_fromio(rdev->bios, bios, size); | ||
98 | pci_unmap_rom(rdev->pdev, bios); | 102 | pci_unmap_rom(rdev->pdev, bios); |
99 | return true; | 103 | return true; |
100 | } | 104 | } |
diff --git a/drivers/gpu/drm/radeon/radeon_pm.c b/drivers/gpu/drm/radeon/radeon_pm.c index 33cf4108386d..c1ba83a8dd8c 100644 --- a/drivers/gpu/drm/radeon/radeon_pm.c +++ b/drivers/gpu/drm/radeon/radeon_pm.c | |||
@@ -837,12 +837,8 @@ static void radeon_dpm_thermal_work_handler(struct work_struct *work) | |||
837 | radeon_pm_compute_clocks(rdev); | 837 | radeon_pm_compute_clocks(rdev); |
838 | } | 838 | } |
839 | 839 | ||
840 | static struct radeon_ps *radeon_dpm_pick_power_state(struct radeon_device *rdev, | 840 | static bool radeon_dpm_single_display(struct radeon_device *rdev) |
841 | enum radeon_pm_state_type dpm_state) | ||
842 | { | 841 | { |
843 | int i; | ||
844 | struct radeon_ps *ps; | ||
845 | u32 ui_class; | ||
846 | bool single_display = (rdev->pm.dpm.new_active_crtc_count < 2) ? | 842 | bool single_display = (rdev->pm.dpm.new_active_crtc_count < 2) ? |
847 | true : false; | 843 | true : false; |
848 | 844 | ||
@@ -858,6 +854,17 @@ static struct radeon_ps *radeon_dpm_pick_power_state(struct radeon_device *rdev, | |||
858 | if (single_display && (r600_dpm_get_vrefresh(rdev) >= 120)) | 854 | if (single_display && (r600_dpm_get_vrefresh(rdev) >= 120)) |
859 | single_display = false; | 855 | single_display = false; |
860 | 856 | ||
857 | return single_display; | ||
858 | } | ||
859 | |||
860 | static struct radeon_ps *radeon_dpm_pick_power_state(struct radeon_device *rdev, | ||
861 | enum radeon_pm_state_type dpm_state) | ||
862 | { | ||
863 | int i; | ||
864 | struct radeon_ps *ps; | ||
865 | u32 ui_class; | ||
866 | bool single_display = radeon_dpm_single_display(rdev); | ||
867 | |||
861 | /* certain older asics have a separare 3D performance state, | 868 | /* certain older asics have a separare 3D performance state, |
862 | * so try that first if the user selected performance | 869 | * so try that first if the user selected performance |
863 | */ | 870 | */ |
@@ -983,6 +990,7 @@ static void radeon_dpm_change_power_state_locked(struct radeon_device *rdev) | |||
983 | struct radeon_ps *ps; | 990 | struct radeon_ps *ps; |
984 | enum radeon_pm_state_type dpm_state; | 991 | enum radeon_pm_state_type dpm_state; |
985 | int ret; | 992 | int ret; |
993 | bool single_display = radeon_dpm_single_display(rdev); | ||
986 | 994 | ||
987 | /* if dpm init failed */ | 995 | /* if dpm init failed */ |
988 | if (!rdev->pm.dpm_enabled) | 996 | if (!rdev->pm.dpm_enabled) |
@@ -1007,6 +1015,9 @@ static void radeon_dpm_change_power_state_locked(struct radeon_device *rdev) | |||
1007 | /* vce just modifies an existing state so force a change */ | 1015 | /* vce just modifies an existing state so force a change */ |
1008 | if (ps->vce_active != rdev->pm.dpm.vce_active) | 1016 | if (ps->vce_active != rdev->pm.dpm.vce_active) |
1009 | goto force; | 1017 | goto force; |
1018 | /* user has made a display change (such as timing) */ | ||
1019 | if (rdev->pm.dpm.single_display != single_display) | ||
1020 | goto force; | ||
1010 | if ((rdev->family < CHIP_BARTS) || (rdev->flags & RADEON_IS_IGP)) { | 1021 | if ((rdev->family < CHIP_BARTS) || (rdev->flags & RADEON_IS_IGP)) { |
1011 | /* for pre-BTC and APUs if the num crtcs changed but state is the same, | 1022 | /* for pre-BTC and APUs if the num crtcs changed but state is the same, |
1012 | * all we need to do is update the display configuration. | 1023 | * all we need to do is update the display configuration. |
@@ -1069,6 +1080,7 @@ force: | |||
1069 | 1080 | ||
1070 | rdev->pm.dpm.current_active_crtcs = rdev->pm.dpm.new_active_crtcs; | 1081 | rdev->pm.dpm.current_active_crtcs = rdev->pm.dpm.new_active_crtcs; |
1071 | rdev->pm.dpm.current_active_crtc_count = rdev->pm.dpm.new_active_crtc_count; | 1082 | rdev->pm.dpm.current_active_crtc_count = rdev->pm.dpm.new_active_crtc_count; |
1083 | rdev->pm.dpm.single_display = single_display; | ||
1072 | 1084 | ||
1073 | /* wait for the rings to drain */ | 1085 | /* wait for the rings to drain */ |
1074 | for (i = 0; i < RADEON_NUM_RINGS; i++) { | 1086 | for (i = 0; i < RADEON_NUM_RINGS; i++) { |
diff --git a/drivers/gpu/drm/radeon/radeon_ring.c b/drivers/gpu/drm/radeon/radeon_ring.c index 2456f69efd23..8c7872339c2a 100644 --- a/drivers/gpu/drm/radeon/radeon_ring.c +++ b/drivers/gpu/drm/radeon/radeon_ring.c | |||
@@ -495,7 +495,7 @@ static int radeon_debugfs_ring_info(struct seq_file *m, void *data) | |||
495 | seq_printf(m, "%u free dwords in ring\n", ring->ring_free_dw); | 495 | seq_printf(m, "%u free dwords in ring\n", ring->ring_free_dw); |
496 | seq_printf(m, "%u dwords in ring\n", count); | 496 | seq_printf(m, "%u dwords in ring\n", count); |
497 | 497 | ||
498 | if (!ring->ready) | 498 | if (!ring->ring) |
499 | return 0; | 499 | return 0; |
500 | 500 | ||
501 | /* print 8 dw before current rptr as often it's the last executed | 501 | /* print 8 dw before current rptr as often it's the last executed |
diff --git a/drivers/gpu/drm/radeon/vce_v2_0.c b/drivers/gpu/drm/radeon/vce_v2_0.c index 1ac7bb825a1b..fbbe78fbd087 100644 --- a/drivers/gpu/drm/radeon/vce_v2_0.c +++ b/drivers/gpu/drm/radeon/vce_v2_0.c | |||
@@ -156,6 +156,9 @@ int vce_v2_0_resume(struct radeon_device *rdev) | |||
156 | WREG32(VCE_LMI_SWAP_CNTL1, 0); | 156 | WREG32(VCE_LMI_SWAP_CNTL1, 0); |
157 | WREG32(VCE_LMI_VM_CTRL, 0); | 157 | WREG32(VCE_LMI_VM_CTRL, 0); |
158 | 158 | ||
159 | WREG32(VCE_LMI_VCPU_CACHE_40BIT_BAR, addr >> 8); | ||
160 | |||
161 | addr &= 0xff; | ||
159 | size = RADEON_GPU_PAGE_ALIGN(rdev->vce_fw->size); | 162 | size = RADEON_GPU_PAGE_ALIGN(rdev->vce_fw->size); |
160 | WREG32(VCE_VCPU_CACHE_OFFSET0, addr & 0x7fffffff); | 163 | WREG32(VCE_VCPU_CACHE_OFFSET0, addr & 0x7fffffff); |
161 | WREG32(VCE_VCPU_CACHE_SIZE0, size); | 164 | WREG32(VCE_VCPU_CACHE_SIZE0, size); |
diff --git a/drivers/gpu/ipu-v3/ipu-di.c b/drivers/gpu/ipu-v3/ipu-di.c index 3ddfb3d0b64d..2970c6bb668c 100644 --- a/drivers/gpu/ipu-v3/ipu-di.c +++ b/drivers/gpu/ipu-v3/ipu-di.c | |||
@@ -441,8 +441,7 @@ static void ipu_di_config_clock(struct ipu_di *di, | |||
441 | 441 | ||
442 | in_rate = clk_get_rate(clk); | 442 | in_rate = clk_get_rate(clk); |
443 | div = DIV_ROUND_CLOSEST(in_rate, sig->mode.pixelclock); | 443 | div = DIV_ROUND_CLOSEST(in_rate, sig->mode.pixelclock); |
444 | if (div == 0) | 444 | div = clamp(div, 1U, 255U); |
445 | div = 1; | ||
446 | 445 | ||
447 | clkgen0 = div << 4; | 446 | clkgen0 = div << 4; |
448 | } | 447 | } |
@@ -459,8 +458,7 @@ static void ipu_di_config_clock(struct ipu_di *di, | |||
459 | 458 | ||
460 | clkrate = clk_get_rate(di->clk_ipu); | 459 | clkrate = clk_get_rate(di->clk_ipu); |
461 | div = DIV_ROUND_CLOSEST(clkrate, sig->mode.pixelclock); | 460 | div = DIV_ROUND_CLOSEST(clkrate, sig->mode.pixelclock); |
462 | if (div == 0) | 461 | div = clamp(div, 1U, 255U); |
463 | div = 1; | ||
464 | rate = clkrate / div; | 462 | rate = clkrate / div; |
465 | 463 | ||
466 | error = rate / (sig->mode.pixelclock / 1000); | 464 | error = rate / (sig->mode.pixelclock / 1000); |
@@ -483,8 +481,7 @@ static void ipu_di_config_clock(struct ipu_di *di, | |||
483 | 481 | ||
484 | in_rate = clk_get_rate(clk); | 482 | in_rate = clk_get_rate(clk); |
485 | div = DIV_ROUND_CLOSEST(in_rate, sig->mode.pixelclock); | 483 | div = DIV_ROUND_CLOSEST(in_rate, sig->mode.pixelclock); |
486 | if (div == 0) | 484 | div = clamp(div, 1U, 255U); |
487 | div = 1; | ||
488 | 485 | ||
489 | clkgen0 = div << 4; | 486 | clkgen0 = div << 4; |
490 | } | 487 | } |
diff --git a/drivers/gpu/ipu-v3/ipu-ic.c b/drivers/gpu/ipu-v3/ipu-ic.c index ad75588e1629..1dcb96ccda66 100644 --- a/drivers/gpu/ipu-v3/ipu-ic.c +++ b/drivers/gpu/ipu-v3/ipu-ic.c | |||
@@ -297,8 +297,8 @@ static int calc_resize_coeffs(struct ipu_ic *ic, | |||
297 | return -EINVAL; | 297 | return -EINVAL; |
298 | } | 298 | } |
299 | 299 | ||
300 | /* Cannot downsize more than 8:1 */ | 300 | /* Cannot downsize more than 4:1 */ |
301 | if ((out_size << 3) < in_size) { | 301 | if ((out_size << 2) < in_size) { |
302 | dev_err(ipu->dev, "Unsupported downsize\n"); | 302 | dev_err(ipu->dev, "Unsupported downsize\n"); |
303 | return -EINVAL; | 303 | return -EINVAL; |
304 | } | 304 | } |