aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorAlex Deucher <alexdeucher@gmail.com>2010-04-22 13:25:06 -0400
committerDave Airlie <airlied@redhat.com>2010-05-18 04:20:52 -0400
commit02b17cc05372ab58e9638008d0206f1c1ee0cf5c (patch)
tree1a8e1c4f209fa432e3841ad4a028f90e4270481f /drivers/gpu/drm
parentef6e6cf56aca91c0b0db8de6e79e0874595fd260 (diff)
drm/radeon/kms/atom/pm: rework power mode parsing
On pre-r6xx, the power mode array is usually ordered: low ... high default On r6xx+: default low ... high Signed-off-by: Alex Deucher <alexdeucher@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/radeon/radeon_atombios.c23
1 files changed, 19 insertions, 4 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c
index 031a96ceb0f5..aa0a973a8af2 100644
--- a/drivers/gpu/drm/radeon/radeon_atombios.c
+++ b/drivers/gpu/drm/radeon/radeon_atombios.c
@@ -1506,6 +1506,7 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev)
1506 num_modes = power_info->info.ucNumOfPowerModeEntries; 1506 num_modes = power_info->info.ucNumOfPowerModeEntries;
1507 if (num_modes > ATOM_MAX_NUMBEROF_POWER_BLOCK) 1507 if (num_modes > ATOM_MAX_NUMBEROF_POWER_BLOCK)
1508 num_modes = ATOM_MAX_NUMBEROF_POWER_BLOCK; 1508 num_modes = ATOM_MAX_NUMBEROF_POWER_BLOCK;
1509 /* last mode is usually default, array is low to high */
1509 for (i = 0; i < num_modes; i++) { 1510 for (i = 0; i < num_modes; i++) {
1510 rdev->pm.power_state[state_index].clock_info[0].voltage.type = VOLTAGE_NONE; 1511 rdev->pm.power_state[state_index].clock_info[0].voltage.type = VOLTAGE_NONE;
1511 switch (frev) { 1512 switch (frev) {
@@ -1711,6 +1712,14 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev)
1711 break; 1712 break;
1712 } 1713 }
1713 } 1714 }
1715 /* last mode is usually default */
1716 if (!rdev->pm.default_power_state) {
1717 rdev->pm.power_state[state_index - 1].type =
1718 POWER_STATE_TYPE_DEFAULT;
1719 rdev->pm.default_power_state = &rdev->pm.power_state[state_index - 1];
1720 rdev->pm.power_state[state_index - 1].default_clock_mode =
1721 &rdev->pm.power_state[state_index - 1].clock_info[0];
1722 }
1714 } else { 1723 } else {
1715 /* add the i2c bus for thermal/fan chip */ 1724 /* add the i2c bus for thermal/fan chip */
1716 /* no support for internal controller yet */ 1725 /* no support for internal controller yet */
@@ -1736,6 +1745,7 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev)
1736 rdev->pm.i2c_bus = radeon_i2c_create(rdev->ddev, &i2c_bus, "Thermal"); 1745 rdev->pm.i2c_bus = radeon_i2c_create(rdev->ddev, &i2c_bus, "Thermal");
1737 } 1746 }
1738 } 1747 }
1748 /* first mode is usually default, followed by low to high */
1739 for (i = 0; i < power_info->info_4.ucNumStates; i++) { 1749 for (i = 0; i < power_info->info_4.ucNumStates; i++) {
1740 mode_index = 0; 1750 mode_index = 0;
1741 power_state = (struct _ATOM_PPLIB_STATE *) 1751 power_state = (struct _ATOM_PPLIB_STATE *)
@@ -1865,12 +1875,16 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev)
1865 state_index++; 1875 state_index++;
1866 } 1876 }
1867 } 1877 }
1878 /* first mode is usually default */
1879 if (!rdev->pm.default_power_state) {
1880 rdev->pm.power_state[0].type =
1881 POWER_STATE_TYPE_DEFAULT;
1882 rdev->pm.default_power_state = &rdev->pm.power_state[0];
1883 rdev->pm.power_state[0].default_clock_mode =
1884 &rdev->pm.power_state[0].clock_info[0];
1885 }
1868 } 1886 }
1869 } else { 1887 } else {
1870 /* XXX figure out some good default low power mode for cards w/out power tables */
1871 }
1872
1873 if (rdev->pm.default_power_state == NULL) {
1874 /* add the default mode */ 1888 /* add the default mode */
1875 rdev->pm.power_state[state_index].type = 1889 rdev->pm.power_state[state_index].type =
1876 POWER_STATE_TYPE_DEFAULT; 1890 POWER_STATE_TYPE_DEFAULT;
@@ -1887,6 +1901,7 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev)
1887 rdev->pm.default_power_state = &rdev->pm.power_state[state_index]; 1901 rdev->pm.default_power_state = &rdev->pm.power_state[state_index];
1888 state_index++; 1902 state_index++;
1889 } 1903 }
1904
1890 rdev->pm.num_power_states = state_index; 1905 rdev->pm.num_power_states = state_index;
1891 1906
1892 rdev->pm.current_power_state = rdev->pm.default_power_state; 1907 rdev->pm.current_power_state = rdev->pm.default_power_state;