aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorAlex Deucher <alexdeucher@gmail.com>2010-05-27 19:25:54 -0400
committerDave Airlie <airlied@redhat.com>2010-06-02 23:13:24 -0400
commit7ac9aa5a1f1b87adb69bcbec2b89e228f074103a (patch)
treeecd3af25454c7d0b9c84bc5a143ef1bc526e62f9 /drivers
parentcb5fcbd540b438a5d311bd15dc910841d01ed140 (diff)
drm/radeon/kms/pm: add support for SetVoltage cmd table (V2)
- This enables voltage adjustment on r6xx+ and certain r5xx asics. - Voltage drop support is already available for most r1xx-r5xx asics. V2: endian fix for voltage table. Signed-off-by: Alex Deucher <alexdeucher@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/gpu/drm/radeon/r600.c6
-rw-r--r--drivers/gpu/drm/radeon/radeon.h1
-rw-r--r--drivers/gpu/drm/radeon/radeon_atombios.c36
-rw-r--r--drivers/gpu/drm/radeon/rs600.c3
4 files changed, 45 insertions, 1 deletions
diff --git a/drivers/gpu/drm/radeon/r600.c b/drivers/gpu/drm/radeon/r600.c
index 44e96a2ae25..e14f59748e6 100644
--- a/drivers/gpu/drm/radeon/r600.c
+++ b/drivers/gpu/drm/radeon/r600.c
@@ -475,6 +475,12 @@ void r600_pm_init_profile(struct radeon_device *rdev)
475 475
476void r600_pm_misc(struct radeon_device *rdev) 476void r600_pm_misc(struct radeon_device *rdev)
477{ 477{
478 int requested_index = rdev->pm.requested_power_state_index;
479 struct radeon_power_state *ps = &rdev->pm.power_state[requested_index];
480 struct radeon_voltage *voltage = &ps->clock_info[0].voltage;
481
482 if ((voltage->type == VOLTAGE_SW) && voltage->voltage)
483 radeon_atom_set_voltage(rdev, voltage->voltage);
478 484
479} 485}
480 486
diff --git a/drivers/gpu/drm/radeon/radeon.h b/drivers/gpu/drm/radeon/radeon.h
index 669feb689bf..5f96fe871b3 100644
--- a/drivers/gpu/drm/radeon/radeon.h
+++ b/drivers/gpu/drm/radeon/radeon.h
@@ -176,6 +176,7 @@ void radeon_pm_suspend(struct radeon_device *rdev);
176void radeon_pm_resume(struct radeon_device *rdev); 176void radeon_pm_resume(struct radeon_device *rdev);
177void radeon_combios_get_power_modes(struct radeon_device *rdev); 177void radeon_combios_get_power_modes(struct radeon_device *rdev);
178void radeon_atombios_get_power_modes(struct radeon_device *rdev); 178void radeon_atombios_get_power_modes(struct radeon_device *rdev);
179void radeon_atom_set_voltage(struct radeon_device *rdev, u16 level);
179 180
180/* 181/*
181 * Fences. 182 * Fences.
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c
index 24ea683f7cf..24ebb4ea798 100644
--- a/drivers/gpu/drm/radeon/radeon_atombios.c
+++ b/drivers/gpu/drm/radeon/radeon_atombios.c
@@ -1998,6 +1998,42 @@ void radeon_atom_set_memory_clock(struct radeon_device *rdev,
1998 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args); 1998 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args);
1999} 1999}
2000 2000
2001union set_voltage {
2002 struct _SET_VOLTAGE_PS_ALLOCATION alloc;
2003 struct _SET_VOLTAGE_PARAMETERS v1;
2004 struct _SET_VOLTAGE_PARAMETERS_V2 v2;
2005};
2006
2007void radeon_atom_set_voltage(struct radeon_device *rdev, u16 level)
2008{
2009 union set_voltage args;
2010 int index = GetIndexIntoMasterTable(COMMAND, SetVoltage);
2011 u8 frev, crev, volt_index = level;
2012
2013 if (!atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, &crev))
2014 return;
2015
2016 switch (crev) {
2017 case 1:
2018 args.v1.ucVoltageType = SET_VOLTAGE_TYPE_ASIC_VDDC;
2019 args.v1.ucVoltageMode = SET_ASIC_VOLTAGE_MODE_ALL_SOURCE;
2020 args.v1.ucVoltageIndex = volt_index;
2021 break;
2022 case 2:
2023 args.v2.ucVoltageType = SET_VOLTAGE_TYPE_ASIC_VDDC;
2024 args.v2.ucVoltageMode = SET_ASIC_VOLTAGE_MODE_SET_VOLTAGE;
2025 args.v2.usVoltageLevel = cpu_to_le16(level);
2026 break;
2027 default:
2028 DRM_ERROR("Unknown table version %d, %d\n", frev, crev);
2029 return;
2030 }
2031
2032 atom_execute_table(rdev->mode_info.atom_context, index, (uint32_t *)&args);
2033}
2034
2035
2036
2001void radeon_atom_initialize_bios_scratch_regs(struct drm_device *dev) 2037void radeon_atom_initialize_bios_scratch_regs(struct drm_device *dev)
2002{ 2038{
2003 struct radeon_device *rdev = dev->dev_private; 2039 struct radeon_device *rdev = dev->dev_private;
diff --git a/drivers/gpu/drm/radeon/rs600.c b/drivers/gpu/drm/radeon/rs600.c
index 79887cac5b5..7bb4c3e52f3 100644
--- a/drivers/gpu/drm/radeon/rs600.c
+++ b/drivers/gpu/drm/radeon/rs600.c
@@ -74,7 +74,8 @@ void rs600_pm_misc(struct radeon_device *rdev)
74 if (voltage->delay) 74 if (voltage->delay)
75 udelay(voltage->delay); 75 udelay(voltage->delay);
76 } 76 }
77 } 77 } else if (voltage->type == VOLTAGE_VDDC)
78 radeon_atom_set_voltage(rdev, voltage->vddc_id);
78 79
79 dyn_pwrmgt_sclk_length = RREG32_PLL(DYN_PWRMGT_SCLK_LENGTH); 80 dyn_pwrmgt_sclk_length = RREG32_PLL(DYN_PWRMGT_SCLK_LENGTH);
80 dyn_pwrmgt_sclk_length &= ~REDUCED_POWER_SCLK_HILEN(0xf); 81 dyn_pwrmgt_sclk_length &= ~REDUCED_POWER_SCLK_HILEN(0xf);