diff mbox

drm/radeon/atom: powergating fixes for DCE6

Message ID 1346099141-17610-1-git-send-email-alexdeucher@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Alex Deucher Aug. 27, 2012, 8:25 p.m. UTC
From: Alex Deucher <alexander.deucher@amd.com>

Power gating is per crtc pair, but the powergating registers
should be called individually.  The hw handles power up/down
properly.  The pair is powered up if either crtc in the pair
is powered up and the pair is not powered down until both
crtcs in the pair are powered down.  This simplifies
programming and should save power additional power.

Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
Cc: stable@vger.kernel.org
---
 drivers/gpu/drm/radeon/atombios_crtc.c |   22 ++--------------------
 1 files changed, 2 insertions(+), 20 deletions(-)

Comments

Michel Dänzer Aug. 28, 2012, 6:28 a.m. UTC | #1
On Mon, 2012-08-27 at 16:25 -0400, alexdeucher@gmail.com wrote: 
> From: Alex Deucher <alexander.deucher@amd.com>
> 
> Power gating is per crtc pair, but the powergating registers
> should be called individually.  The hw handles power up/down
> properly.  The pair is powered up if either crtc in the pair
> is powered up and the pair is not powered down until both
> crtcs in the pair are powered down.  This simplifies
> programming and should save power additional power.

Extraneous 'power' in the last sentence.

> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
Paul Menzel Aug. 28, 2012, 7:03 a.m. UTC | #2
Dear Alex,


Am Montag, den 27.08.2012, 16:25 -0400 schrieb alexdeucher@gmail.com:
> From: Alex Deucher <alexander.deucher@amd.com>
> 
> Power gating is per crtc pair, but the powergating registers
> should be called individually.  The hw handles power up/down
> properly.  The pair is powered up if either crtc in the pair
> is powered up and the pair is not powered down until both
> crtcs in the pair are powered down.  This simplifies
> programming and should save power additional power.

it would be nice, if you could provide some numbers if the last
statement is true.

> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
> Cc: stable@vger.kernel.org
>
> ---
>  drivers/gpu/drm/radeon/atombios_crtc.c |   22 ++--------------------
>  1 files changed, 2 insertions(+), 20 deletions(-)

[…]

Acked-by: Paul Menzel <paulepanter@users.sourceforge.net>


Thanks,

Paul
Alex Deucher Aug. 28, 2012, 2:14 p.m. UTC | #3
On Tue, Aug 28, 2012 at 2:28 AM, Michel Dänzer <michel@daenzer.net> wrote:
> On Mon, 2012-08-27 at 16:25 -0400, alexdeucher@gmail.com wrote:
>> From: Alex Deucher <alexander.deucher@amd.com>
>>
>> Power gating is per crtc pair, but the powergating registers
>> should be called individually.  The hw handles power up/down
>> properly.  The pair is powered up if either crtc in the pair
>> is powered up and the pair is not powered down until both
>> crtcs in the pair are powered down.  This simplifies
>> programming and should save power additional power.
>
> Extraneous 'power' in the last sentence.
>

I'll fix that.  thanks!

>> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
>
> Reviewed-by: Michel Dänzer <michel.daenzer@amd.com>
>
>
> --
> Earthling Michel Dänzer           |                   http://www.amd.com
> Libre software enthusiast         |          Debian, X and DRI developer
Alex Deucher Aug. 28, 2012, 2:16 p.m. UTC | #4
On Tue, Aug 28, 2012 at 3:03 AM, Paul Menzel
<paulepanter@users.sourceforge.net> wrote:
> Dear Alex,
>
>
> Am Montag, den 27.08.2012, 16:25 -0400 schrieb alexdeucher@gmail.com:
>> From: Alex Deucher <alexander.deucher@amd.com>
>>
>> Power gating is per crtc pair, but the powergating registers
>> should be called individually.  The hw handles power up/down
>> properly.  The pair is powered up if either crtc in the pair
>> is powered up and the pair is not powered down until both
>> crtcs in the pair are powered down.  This simplifies
>> programming and should save power additional power.
>
> it would be nice, if you could provide some numbers if the last
> statement is true.

I haven't checked to see how much it saves but the way the previous
code worked the pair never actually got power gated.

Alex

>
>> Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
>> Cc: stable@vger.kernel.org
>>
>> ---
>>  drivers/gpu/drm/radeon/atombios_crtc.c |   22 ++--------------------
>>  1 files changed, 2 insertions(+), 20 deletions(-)
>
> […]
>
> Acked-by: Paul Menzel <paulepanter@users.sourceforge.net>
>
>
> Thanks,
>
> Paul
diff mbox

Patch

diff --git a/drivers/gpu/drm/radeon/atombios_crtc.c b/drivers/gpu/drm/radeon/atombios_crtc.c
index 961d366..2817101 100644
--- a/drivers/gpu/drm/radeon/atombios_crtc.c
+++ b/drivers/gpu/drm/radeon/atombios_crtc.c
@@ -258,7 +258,6 @@  void atombios_crtc_dpms(struct drm_crtc *crtc, int mode)
 		radeon_crtc->enabled = true;
 		/* adjust pm to dpms changes BEFORE enabling crtcs */
 		radeon_pm_compute_clocks(rdev);
-		/* disable crtc pair power gating before programming */
 		if (ASIC_IS_DCE6(rdev) && !radeon_crtc->in_mode_set)
 			atombios_powergate_crtc(crtc, ATOM_DISABLE);
 		atombios_enable_crtc(crtc, ATOM_ENABLE);
@@ -278,25 +277,8 @@  void atombios_crtc_dpms(struct drm_crtc *crtc, int mode)
 			atombios_enable_crtc_memreq(crtc, ATOM_DISABLE);
 		atombios_enable_crtc(crtc, ATOM_DISABLE);
 		radeon_crtc->enabled = false;
-		/* power gating is per-pair */
-		if (ASIC_IS_DCE6(rdev) && !radeon_crtc->in_mode_set) {
-			struct drm_crtc *other_crtc;
-			struct radeon_crtc *other_radeon_crtc;
-			list_for_each_entry(other_crtc, &rdev->ddev->mode_config.crtc_list, head) {
-				other_radeon_crtc = to_radeon_crtc(other_crtc);
-				if (((radeon_crtc->crtc_id == 0) && (other_radeon_crtc->crtc_id == 1)) ||
-				    ((radeon_crtc->crtc_id == 1) && (other_radeon_crtc->crtc_id == 0)) ||
-				    ((radeon_crtc->crtc_id == 2) && (other_radeon_crtc->crtc_id == 3)) ||
-				    ((radeon_crtc->crtc_id == 3) && (other_radeon_crtc->crtc_id == 2)) ||
-				    ((radeon_crtc->crtc_id == 4) && (other_radeon_crtc->crtc_id == 5)) ||
-				    ((radeon_crtc->crtc_id == 5) && (other_radeon_crtc->crtc_id == 4))) {
-					/* if both crtcs in the pair are off, enable power gating */
-					if (other_radeon_crtc->enabled == false)
-						atombios_powergate_crtc(crtc, ATOM_ENABLE);
-					break;
-				}
-			}
-		}
+		if (ASIC_IS_DCE6(rdev) && !radeon_crtc->in_mode_set)
+			atombios_powergate_crtc(crtc, ATOM_ENABLE);
 		/* adjust pm to dpms changes AFTER disabling crtcs */
 		radeon_pm_compute_clocks(rdev);
 		break;