diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-11-13 14:09:55 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-11-13 14:09:55 -0500 |
commit | 52e4c2a05256cb83cda12f3c2137ab1533344edb (patch) | |
tree | 91969f8c2c0c9dc0585cd264f5d5b441af70676a /drivers | |
parent | 3439a8da16bcad6b0982ece938c9f8299bb53584 (diff) | |
parent | a7c36fd8c5ee6dcca584137cb81aeefd785a0721 (diff) |
Merge branch 'drm-fixes' of git://people.freedesktop.org/~airlied/linux
* 'drm-fixes' of git://people.freedesktop.org/~airlied/linux:
drm/radeon/kms/combios: fix dynamic allocation of PM clock modes
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_combios.c | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c index 8bf83c4b4147..81fc100be7e1 100644 --- a/drivers/gpu/drm/radeon/radeon_combios.c +++ b/drivers/gpu/drm/radeon/radeon_combios.c | |||
@@ -2563,14 +2563,17 @@ void radeon_combios_get_power_modes(struct radeon_device *rdev) | |||
2563 | 2563 | ||
2564 | /* allocate 2 power states */ | 2564 | /* allocate 2 power states */ |
2565 | rdev->pm.power_state = kzalloc(sizeof(struct radeon_power_state) * 2, GFP_KERNEL); | 2565 | rdev->pm.power_state = kzalloc(sizeof(struct radeon_power_state) * 2, GFP_KERNEL); |
2566 | if (!rdev->pm.power_state) { | 2566 | if (rdev->pm.power_state) { |
2567 | rdev->pm.default_power_state_index = state_index; | 2567 | /* allocate 1 clock mode per state */ |
2568 | rdev->pm.num_power_states = 0; | 2568 | rdev->pm.power_state[0].clock_info = |
2569 | 2569 | kzalloc(sizeof(struct radeon_pm_clock_info) * 1, GFP_KERNEL); | |
2570 | rdev->pm.current_power_state_index = rdev->pm.default_power_state_index; | 2570 | rdev->pm.power_state[1].clock_info = |
2571 | rdev->pm.current_clock_mode_index = 0; | 2571 | kzalloc(sizeof(struct radeon_pm_clock_info) * 1, GFP_KERNEL); |
2572 | return; | 2572 | if (!rdev->pm.power_state[0].clock_info || |
2573 | } | 2573 | !rdev->pm.power_state[1].clock_info) |
2574 | goto pm_failed; | ||
2575 | } else | ||
2576 | goto pm_failed; | ||
2574 | 2577 | ||
2575 | /* check for a thermal chip */ | 2578 | /* check for a thermal chip */ |
2576 | offset = combios_get_table_offset(dev, COMBIOS_OVERDRIVE_INFO_TABLE); | 2579 | offset = combios_get_table_offset(dev, COMBIOS_OVERDRIVE_INFO_TABLE); |
@@ -2735,6 +2738,14 @@ default_mode: | |||
2735 | 2738 | ||
2736 | rdev->pm.current_power_state_index = rdev->pm.default_power_state_index; | 2739 | rdev->pm.current_power_state_index = rdev->pm.default_power_state_index; |
2737 | rdev->pm.current_clock_mode_index = 0; | 2740 | rdev->pm.current_clock_mode_index = 0; |
2741 | return; | ||
2742 | |||
2743 | pm_failed: | ||
2744 | rdev->pm.default_power_state_index = state_index; | ||
2745 | rdev->pm.num_power_states = 0; | ||
2746 | |||
2747 | rdev->pm.current_power_state_index = rdev->pm.default_power_state_index; | ||
2748 | rdev->pm.current_clock_mode_index = 0; | ||
2738 | } | 2749 | } |
2739 | 2750 | ||
2740 | void radeon_external_tmds_setup(struct drm_encoder *encoder) | 2751 | void radeon_external_tmds_setup(struct drm_encoder *encoder) |