diff options
author | Alex Deucher <alexdeucher@gmail.com> | 2010-05-27 19:25:54 -0400 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2010-06-02 23:13:24 -0400 |
commit | 7ac9aa5a1f1b87adb69bcbec2b89e228f074103a (patch) | |
tree | ecd3af25454c7d0b9c84bc5a143ef1bc526e62f9 /drivers/gpu/drm/radeon/radeon_atombios.c | |
parent | cb5fcbd540b438a5d311bd15dc910841d01ed140 (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/gpu/drm/radeon/radeon_atombios.c')
-rw-r--r-- | drivers/gpu/drm/radeon/radeon_atombios.c | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c index 24ea683f7cf5..24ebb4ea7984 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 | ||
2001 | union set_voltage { | ||
2002 | struct _SET_VOLTAGE_PS_ALLOCATION alloc; | ||
2003 | struct _SET_VOLTAGE_PARAMETERS v1; | ||
2004 | struct _SET_VOLTAGE_PARAMETERS_V2 v2; | ||
2005 | }; | ||
2006 | |||
2007 | void 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 | |||
2001 | void radeon_atom_initialize_bios_scratch_regs(struct drm_device *dev) | 2037 | void 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; |