drm/radeon/kms: add voltage type to atom set voltage function
authorAlex Deucher <alexdeucher@gmail.com>
Tue, 12 Apr 2011 18:49:23 +0000 (14:49 -0400)
committerDave Airlie <airlied@redhat.com>
Tue, 12 Apr 2011 23:09:42 +0000 (09:09 +1000)
This is needed for setting voltages other than vddc.

Signed-off-by: Alex Deucher <alexdeucher@gmail.com>
Signed-off-by: Dave Airlie <airlied@redhat.com>
drivers/gpu/drm/radeon/evergreen.c
drivers/gpu/drm/radeon/r600.c
drivers/gpu/drm/radeon/radeon.h
drivers/gpu/drm/radeon/radeon_atombios.c
drivers/gpu/drm/radeon/radeon_pm.c
drivers/gpu/drm/radeon/rs600.c
drivers/gpu/drm/radeon/rv770.c

index cff7144..f244817 100644 (file)
@@ -122,7 +122,7 @@ void evergreen_pm_misc(struct radeon_device *rdev)
 
        if ((voltage->type == VOLTAGE_SW) && voltage->voltage) {
                if (voltage->voltage != rdev->pm.current_vddc) {
-                       radeon_atom_set_voltage(rdev, voltage->voltage);
+                       radeon_atom_set_voltage(rdev, voltage->voltage, SET_VOLTAGE_TYPE_ASIC_VDDC);
                        rdev->pm.current_vddc = voltage->voltage;
                        DRM_DEBUG("Setting: v: %d\n", voltage->voltage);
                }
index 304fc76..15d5829 100644 (file)
@@ -587,7 +587,7 @@ void r600_pm_misc(struct radeon_device *rdev)
 
        if ((voltage->type == VOLTAGE_SW) && voltage->voltage) {
                if (voltage->voltage != rdev->pm.current_vddc) {
-                       radeon_atom_set_voltage(rdev, voltage->voltage);
+                       radeon_atom_set_voltage(rdev, voltage->voltage, SET_VOLTAGE_TYPE_ASIC_VDDC);
                        rdev->pm.current_vddc = voltage->voltage;
                        DRM_DEBUG_DRIVER("Setting: v: %d\n", voltage->voltage);
                }
index 93f5365..9955740 100644 (file)
@@ -177,7 +177,7 @@ void radeon_pm_suspend(struct radeon_device *rdev);
 void radeon_pm_resume(struct radeon_device *rdev);
 void radeon_combios_get_power_modes(struct radeon_device *rdev);
 void radeon_atombios_get_power_modes(struct radeon_device *rdev);
-void radeon_atom_set_voltage(struct radeon_device *rdev, u16 level);
+void radeon_atom_set_voltage(struct radeon_device *rdev, u16 voltage_level, u8 voltage_type);
 void rs690_pm_info(struct radeon_device *rdev);
 extern int rv6xx_get_temp(struct radeon_device *rdev);
 extern int rv770_get_temp(struct radeon_device *rdev);
index 99768d9..330a5b5 100644 (file)
@@ -2577,25 +2577,25 @@ union set_voltage {
        struct _SET_VOLTAGE_PARAMETERS_V2 v2;
 };
 
-void radeon_atom_set_voltage(struct radeon_device *rdev, u16 level)
+void radeon_atom_set_voltage(struct radeon_device *rdev, u16 voltage_level, u8 voltage_type)
 {
        union set_voltage args;
        int index = GetIndexIntoMasterTable(COMMAND, SetVoltage);
-       u8 frev, crev, volt_index = level;
+       u8 frev, crev, volt_index = voltage_level;
 
        if (!atom_parse_cmd_header(rdev->mode_info.atom_context, index, &frev, &crev))
                return;
 
        switch (crev) {
        case 1:
-               args.v1.ucVoltageType = SET_VOLTAGE_TYPE_ASIC_VDDC;
+               args.v1.ucVoltageType = voltage_type;
                args.v1.ucVoltageMode = SET_ASIC_VOLTAGE_MODE_ALL_SOURCE;
                args.v1.ucVoltageIndex = volt_index;
                break;
        case 2:
-               args.v2.ucVoltageType = SET_VOLTAGE_TYPE_ASIC_VDDC;
+               args.v2.ucVoltageType = voltage_type;
                args.v2.ucVoltageMode = SET_ASIC_VOLTAGE_MODE_SET_VOLTAGE;
-               args.v2.usVoltageLevel = cpu_to_le16(level);
+               args.v2.usVoltageLevel = cpu_to_le16(voltage_level);
                break;
        default:
                DRM_ERROR("Unknown table version %d, %d\n", frev, crev);
index 08de669..4010571 100644 (file)
@@ -23,6 +23,7 @@
 #include "drmP.h"
 #include "radeon.h"
 #include "avivod.h"
+#include "atom.h"
 #ifdef CONFIG_ACPI
 #include <linux/acpi.h>
 #endif
@@ -535,7 +536,8 @@ void radeon_pm_resume(struct radeon_device *rdev)
        /* set up the default clocks if the MC ucode is loaded */
        if (ASIC_IS_DCE5(rdev) && rdev->mc_fw) {
                if (rdev->pm.default_vddc)
-                       radeon_atom_set_voltage(rdev, rdev->pm.default_vddc);
+                       radeon_atom_set_voltage(rdev, rdev->pm.default_vddc,
+                                               SET_VOLTAGE_TYPE_ASIC_VDDC);
                if (rdev->pm.default_sclk)
                        radeon_set_engine_clock(rdev, rdev->pm.default_sclk);
                if (rdev->pm.default_mclk)
@@ -585,7 +587,8 @@ int radeon_pm_init(struct radeon_device *rdev)
                /* set up the default clocks if the MC ucode is loaded */
                if (ASIC_IS_DCE5(rdev) && rdev->mc_fw) {
                        if (rdev->pm.default_vddc)
-                               radeon_atom_set_voltage(rdev, rdev->pm.default_vddc);
+                               radeon_atom_set_voltage(rdev, rdev->pm.default_vddc,
+                                                       SET_VOLTAGE_TYPE_ASIC_VDDC);
                        if (rdev->pm.default_sclk)
                                radeon_set_engine_clock(rdev, rdev->pm.default_sclk);
                        if (rdev->pm.default_mclk)
index 876cebc..6e3b11e 100644 (file)
@@ -114,7 +114,7 @@ void rs600_pm_misc(struct radeon_device *rdev)
                                udelay(voltage->delay);
                }
        } else if (voltage->type == VOLTAGE_VDDC)
-               radeon_atom_set_voltage(rdev, voltage->vddc_id);
+               radeon_atom_set_voltage(rdev, voltage->vddc_id, SET_VOLTAGE_TYPE_ASIC_VDDC);
 
        dyn_pwrmgt_sclk_length = RREG32_PLL(DYN_PWRMGT_SCLK_LENGTH);
        dyn_pwrmgt_sclk_length &= ~REDUCED_POWER_SCLK_HILEN(0xf);
index 4faa2e5..ef8a5ba 100644 (file)
@@ -106,7 +106,7 @@ void rv770_pm_misc(struct radeon_device *rdev)
 
        if ((voltage->type == VOLTAGE_SW) && voltage->voltage) {
                if (voltage->voltage != rdev->pm.current_vddc) {
-                       radeon_atom_set_voltage(rdev, voltage->voltage);
+                       radeon_atom_set_voltage(rdev, voltage->voltage, SET_VOLTAGE_TYPE_ASIC_VDDC);
                        rdev->pm.current_vddc = voltage->voltage;
                        DRM_DEBUG("Setting: v: %d\n", voltage->voltage);
                }