drm/radeon/kms: accept slightly overclocked power modes
authorRafał Miłecki <zajec5@gmail.com>
Thu, 11 Feb 2010 22:16:36 +0000 (22:16 +0000)
committerDave Airlie <airlied@redhat.com>
Thu, 18 Feb 2010 04:25:08 +0000 (14:25 +1000)
Fixes fdo bug #26329

Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
Tested-by: Tobias Jakobi <liquid.acid@gmx.net>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/radeon/radeon.h
drivers/gpu/drm/radeon/radeon_atombios.c
drivers/gpu/drm/radeon/radeon_combios.c

index 9f35beed13e8918809e6f2040af48f9c3edcd545..350ae71953e9ac907161d04df257827c3f4f53e4 100644 (file)
@@ -662,6 +662,11 @@ struct radeon_power_state {
        bool voltage_drop_active;
 };
 
+/*
+ * Some modes are overclocked by very low value, accept them
+ */
+#define RADEON_MODE_OVERCLOCK_MARGIN 500 /* 5 MHz */
+
 struct radeon_pm {
        struct mutex            mutex;
        struct delayed_work     idle_work;
index 4f7dbce9883a4bce41754c59a5facfa86edbf7b6..731210bef744fd8c0b7d561c5d4438a484c0611c 100644 (file)
@@ -1463,9 +1463,9 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev)
                                                continue;
                                        /* skip overclock modes for now */
                                        if ((rdev->pm.power_state[state_index].clock_info[0].mclk >
-                                            rdev->clock.default_mclk) ||
+                                            rdev->clock.default_mclk + RADEON_MODE_OVERCLOCK_MARGIN) ||
                                            (rdev->pm.power_state[state_index].clock_info[0].sclk >
-                                            rdev->clock.default_sclk))
+                                            rdev->clock.default_sclk + RADEON_MODE_OVERCLOCK_MARGIN))
                                                continue;
                                        rdev->pm.power_state[state_index].non_clock_info.pcie_lanes =
                                                power_info->info.asPowerPlayInfo[i].ucNumPciELanes;
@@ -1528,9 +1528,9 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev)
                                                continue;
                                        /* skip overclock modes for now */
                                        if ((rdev->pm.power_state[state_index].clock_info[0].mclk >
-                                            rdev->clock.default_mclk) ||
+                                            rdev->clock.default_mclk + RADEON_MODE_OVERCLOCK_MARGIN) ||
                                            (rdev->pm.power_state[state_index].clock_info[0].sclk >
-                                            rdev->clock.default_sclk))
+                                            rdev->clock.default_sclk + RADEON_MODE_OVERCLOCK_MARGIN))
                                                continue;
                                        rdev->pm.power_state[state_index].non_clock_info.pcie_lanes =
                                                power_info->info_2.asPowerPlayInfo[i].ucNumPciELanes;
@@ -1597,9 +1597,9 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev)
                                                continue;
                                        /* skip overclock modes for now */
                                        if ((rdev->pm.power_state[state_index].clock_info[0].mclk >
-                                            rdev->clock.default_mclk) ||
+                                            rdev->clock.default_mclk + RADEON_MODE_OVERCLOCK_MARGIN) ||
                                            (rdev->pm.power_state[state_index].clock_info[0].sclk >
-                                            rdev->clock.default_sclk))
+                                            rdev->clock.default_sclk + RADEON_MODE_OVERCLOCK_MARGIN))
                                                continue;
                                        rdev->pm.power_state[state_index].non_clock_info.pcie_lanes =
                                                power_info->info_3.asPowerPlayInfo[i].ucNumPciELanes;
@@ -1693,7 +1693,7 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev)
                                                        continue;
                                                /* skip overclock modes for now */
                                                if (rdev->pm.power_state[state_index].clock_info[mode_index].sclk >
-                                                   rdev->clock.default_sclk)
+                                                   rdev->clock.default_sclk + RADEON_MODE_OVERCLOCK_MARGIN)
                                                        continue;
                                                rdev->pm.power_state[state_index].clock_info[mode_index].voltage.type =
                                                        VOLTAGE_SW;
@@ -1720,9 +1720,9 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev)
                                                        continue;
                                                /* skip overclock modes for now */
                                                if ((rdev->pm.power_state[state_index].clock_info[mode_index].mclk >
-                                                    rdev->clock.default_mclk) ||
+                                                    rdev->clock.default_mclk + RADEON_MODE_OVERCLOCK_MARGIN) ||
                                                    (rdev->pm.power_state[state_index].clock_info[mode_index].sclk >
-                                                    rdev->clock.default_sclk))
+                                                    rdev->clock.default_sclk + RADEON_MODE_OVERCLOCK_MARGIN))
                                                        continue;
                                                rdev->pm.power_state[state_index].clock_info[mode_index].voltage.type =
                                                        VOLTAGE_SW;
index 9989d22a4d8f8acbd53495b9b9f99d1058fb92b0..5ef791be5036a93d24ccc3cd76c48aa9045cad1d 100644 (file)
@@ -2374,9 +2374,9 @@ void radeon_combios_get_power_modes(struct radeon_device *rdev)
                                goto default_mode;
                        /* skip overclock modes for now */
                        if ((rdev->pm.power_state[state_index].clock_info[0].mclk >
-                            rdev->clock.default_mclk) ||
+                            rdev->clock.default_mclk + RADEON_MODE_OVERCLOCK_MARGIN) ||
                            (rdev->pm.power_state[state_index].clock_info[0].sclk >
-                            rdev->clock.default_sclk))
+                            rdev->clock.default_sclk + RADEON_MODE_OVERCLOCK_MARGIN))
                                goto default_mode;
                        rdev->pm.power_state[state_index].type =
                                POWER_STATE_TYPE_BATTERY;