Commit 79daedc9 authored by Alex Deucher's avatar Alex Deucher Committed by Dave Airlie

drm/radeon/kms: minor pm cleanups

- remove non_clock_info struct
- track power state misc flags
Signed-off-by: default avatarAlex Deucher <alexdeucher@gmail.com>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent d91eeb78
...@@ -137,7 +137,7 @@ void r100_get_power_state(struct radeon_device *rdev, ...@@ -137,7 +137,7 @@ void r100_get_power_state(struct radeon_device *rdev,
rdev->pm.power_state[rdev->pm.requested_power_state_index]. rdev->pm.power_state[rdev->pm.requested_power_state_index].
clock_info[rdev->pm.requested_clock_mode_index].mclk, clock_info[rdev->pm.requested_clock_mode_index].mclk,
rdev->pm.power_state[rdev->pm.requested_power_state_index]. rdev->pm.power_state[rdev->pm.requested_power_state_index].
non_clock_info.pcie_lanes); pcie_lanes);
} }
void r100_set_power_state(struct radeon_device *rdev) void r100_set_power_state(struct radeon_device *rdev)
......
...@@ -234,7 +234,7 @@ void r600_get_power_state(struct radeon_device *rdev, ...@@ -234,7 +234,7 @@ void r600_get_power_state(struct radeon_device *rdev,
rdev->pm.power_state[rdev->pm.requested_power_state_index]. rdev->pm.power_state[rdev->pm.requested_power_state_index].
clock_info[rdev->pm.requested_clock_mode_index].mclk, clock_info[rdev->pm.requested_clock_mode_index].mclk,
rdev->pm.power_state[rdev->pm.requested_power_state_index]. rdev->pm.power_state[rdev->pm.requested_power_state_index].
non_clock_info.pcie_lanes); pcie_lanes);
} }
void r600_set_power_state(struct radeon_device *rdev) void r600_set_power_state(struct radeon_device *rdev)
......
...@@ -654,13 +654,6 @@ struct radeon_voltage { ...@@ -654,13 +654,6 @@ struct radeon_voltage {
u32 voltage; u32 voltage;
}; };
struct radeon_pm_non_clock_info {
/* pcie lanes */
int pcie_lanes;
/* standardized non-clock flags */
u32 flags;
};
struct radeon_pm_clock_info { struct radeon_pm_clock_info {
/* memory clock */ /* memory clock */
u32 mclk; u32 mclk;
...@@ -682,11 +675,11 @@ struct radeon_power_state { ...@@ -682,11 +675,11 @@ struct radeon_power_state {
/* number of valid clock modes in this power state */ /* number of valid clock modes in this power state */
int num_clock_modes; int num_clock_modes;
struct radeon_pm_clock_info *default_clock_mode; struct radeon_pm_clock_info *default_clock_mode;
/* non clock info about this state */
struct radeon_pm_non_clock_info non_clock_info;
bool voltage_drop_active;
/* standardized state flags */ /* standardized state flags */
u32 flags; u32 flags;
u32 misc; /* vbios specific flags */
u32 misc2; /* vbios specific flags */
int pcie_lanes; /* pcie lanes */
}; };
/* /*
......
...@@ -1528,7 +1528,7 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev) ...@@ -1528,7 +1528,7 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev)
if ((rdev->pm.power_state[state_index].clock_info[0].mclk == 0) || if ((rdev->pm.power_state[state_index].clock_info[0].mclk == 0) ||
(rdev->pm.power_state[state_index].clock_info[0].sclk == 0)) (rdev->pm.power_state[state_index].clock_info[0].sclk == 0))
continue; continue;
rdev->pm.power_state[state_index].non_clock_info.pcie_lanes = rdev->pm.power_state[state_index].pcie_lanes =
power_info->info.asPowerPlayInfo[i].ucNumPciELanes; power_info->info.asPowerPlayInfo[i].ucNumPciELanes;
misc = le32_to_cpu(power_info->info.asPowerPlayInfo[i].ulMiscInfo); misc = le32_to_cpu(power_info->info.asPowerPlayInfo[i].ulMiscInfo);
if (misc & ATOM_PM_MISCINFO_VOLTAGE_DROP_SUPPORT) { if (misc & ATOM_PM_MISCINFO_VOLTAGE_DROP_SUPPORT) {
...@@ -1550,6 +1550,7 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev) ...@@ -1550,6 +1550,7 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev)
power_info->info.asPowerPlayInfo[i].ucVoltageDropIndex; power_info->info.asPowerPlayInfo[i].ucVoltageDropIndex;
} }
rdev->pm.power_state[state_index].flags = RADEON_PM_SINGLE_DISPLAY_ONLY; rdev->pm.power_state[state_index].flags = RADEON_PM_SINGLE_DISPLAY_ONLY;
rdev->pm.power_state[state_index].misc = misc;
/* order matters! */ /* order matters! */
if (misc & ATOM_PM_MISCINFO_POWER_SAVING_MODE) if (misc & ATOM_PM_MISCINFO_POWER_SAVING_MODE)
rdev->pm.power_state[state_index].type = rdev->pm.power_state[state_index].type =
...@@ -1590,7 +1591,7 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev) ...@@ -1590,7 +1591,7 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev)
if ((rdev->pm.power_state[state_index].clock_info[0].mclk == 0) || if ((rdev->pm.power_state[state_index].clock_info[0].mclk == 0) ||
(rdev->pm.power_state[state_index].clock_info[0].sclk == 0)) (rdev->pm.power_state[state_index].clock_info[0].sclk == 0))
continue; continue;
rdev->pm.power_state[state_index].non_clock_info.pcie_lanes = rdev->pm.power_state[state_index].pcie_lanes =
power_info->info_2.asPowerPlayInfo[i].ucNumPciELanes; power_info->info_2.asPowerPlayInfo[i].ucNumPciELanes;
misc = le32_to_cpu(power_info->info_2.asPowerPlayInfo[i].ulMiscInfo); misc = le32_to_cpu(power_info->info_2.asPowerPlayInfo[i].ulMiscInfo);
misc2 = le32_to_cpu(power_info->info_2.asPowerPlayInfo[i].ulMiscInfo2); misc2 = le32_to_cpu(power_info->info_2.asPowerPlayInfo[i].ulMiscInfo2);
...@@ -1613,6 +1614,8 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev) ...@@ -1613,6 +1614,8 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev)
power_info->info_2.asPowerPlayInfo[i].ucVoltageDropIndex; power_info->info_2.asPowerPlayInfo[i].ucVoltageDropIndex;
} }
rdev->pm.power_state[state_index].flags = RADEON_PM_SINGLE_DISPLAY_ONLY; rdev->pm.power_state[state_index].flags = RADEON_PM_SINGLE_DISPLAY_ONLY;
rdev->pm.power_state[state_index].misc = misc;
rdev->pm.power_state[state_index].misc2 = misc2;
/* order matters! */ /* order matters! */
if (misc & ATOM_PM_MISCINFO_POWER_SAVING_MODE) if (misc & ATOM_PM_MISCINFO_POWER_SAVING_MODE)
rdev->pm.power_state[state_index].type = rdev->pm.power_state[state_index].type =
...@@ -1659,7 +1662,7 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev) ...@@ -1659,7 +1662,7 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev)
if ((rdev->pm.power_state[state_index].clock_info[0].mclk == 0) || if ((rdev->pm.power_state[state_index].clock_info[0].mclk == 0) ||
(rdev->pm.power_state[state_index].clock_info[0].sclk == 0)) (rdev->pm.power_state[state_index].clock_info[0].sclk == 0))
continue; continue;
rdev->pm.power_state[state_index].non_clock_info.pcie_lanes = rdev->pm.power_state[state_index].pcie_lanes =
power_info->info_3.asPowerPlayInfo[i].ucNumPciELanes; power_info->info_3.asPowerPlayInfo[i].ucNumPciELanes;
misc = le32_to_cpu(power_info->info_3.asPowerPlayInfo[i].ulMiscInfo); misc = le32_to_cpu(power_info->info_3.asPowerPlayInfo[i].ulMiscInfo);
misc2 = le32_to_cpu(power_info->info_3.asPowerPlayInfo[i].ulMiscInfo2); misc2 = le32_to_cpu(power_info->info_3.asPowerPlayInfo[i].ulMiscInfo2);
...@@ -1688,6 +1691,8 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev) ...@@ -1688,6 +1691,8 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev)
} }
} }
rdev->pm.power_state[state_index].flags = RADEON_PM_SINGLE_DISPLAY_ONLY; rdev->pm.power_state[state_index].flags = RADEON_PM_SINGLE_DISPLAY_ONLY;
rdev->pm.power_state[state_index].misc = misc;
rdev->pm.power_state[state_index].misc2 = misc2;
/* order matters! */ /* order matters! */
if (misc & ATOM_PM_MISCINFO_POWER_SAVING_MODE) if (misc & ATOM_PM_MISCINFO_POWER_SAVING_MODE)
rdev->pm.power_state[state_index].type = rdev->pm.power_state[state_index].type =
...@@ -1730,6 +1735,8 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev) ...@@ -1730,6 +1735,8 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev)
&rdev->pm.power_state[state_index - 1].clock_info[0]; &rdev->pm.power_state[state_index - 1].clock_info[0];
rdev->pm.power_state[state_index].flags &= rdev->pm.power_state[state_index].flags &=
~RADEON_PM_SINGLE_DISPLAY_ONLY; ~RADEON_PM_SINGLE_DISPLAY_ONLY;
rdev->pm.power_state[state_index].misc = 0;
rdev->pm.power_state[state_index].misc2 = 0;
} }
} else { } else {
/* add the i2c bus for thermal/fan chip */ /* add the i2c bus for thermal/fan chip */
...@@ -1852,7 +1859,9 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev) ...@@ -1852,7 +1859,9 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev)
if (mode_index) { if (mode_index) {
misc = le32_to_cpu(non_clock_info->ulCapsAndSettings); misc = le32_to_cpu(non_clock_info->ulCapsAndSettings);
misc2 = le16_to_cpu(non_clock_info->usClassification); misc2 = le16_to_cpu(non_clock_info->usClassification);
rdev->pm.power_state[state_index].non_clock_info.pcie_lanes = rdev->pm.power_state[state_index].misc = misc;
rdev->pm.power_state[state_index].misc2 = misc2;
rdev->pm.power_state[state_index].pcie_lanes =
((misc & ATOM_PPLIB_PCIE_LINK_WIDTH_MASK) >> ((misc & ATOM_PPLIB_PCIE_LINK_WIDTH_MASK) >>
ATOM_PPLIB_PCIE_LINK_WIDTH_SHIFT) + 1; ATOM_PPLIB_PCIE_LINK_WIDTH_SHIFT) + 1;
switch (misc2 & ATOM_PPLIB_CLASSIFICATION_UI_MASK) { switch (misc2 & ATOM_PPLIB_CLASSIFICATION_UI_MASK) {
...@@ -1902,10 +1911,7 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev) ...@@ -1902,10 +1911,7 @@ void radeon_atombios_get_power_modes(struct radeon_device *rdev)
rdev->pm.power_state[state_index].default_clock_mode = rdev->pm.power_state[state_index].default_clock_mode =
&rdev->pm.power_state[state_index].clock_info[0]; &rdev->pm.power_state[state_index].clock_info[0];
rdev->pm.power_state[state_index].clock_info[0].voltage.type = VOLTAGE_NONE; rdev->pm.power_state[state_index].clock_info[0].voltage.type = VOLTAGE_NONE;
if (rdev->asic->get_pcie_lanes) rdev->pm.power_state[state_index].pcie_lanes = 16;
rdev->pm.power_state[state_index].non_clock_info.pcie_lanes = radeon_get_pcie_lanes(rdev);
else
rdev->pm.power_state[state_index].non_clock_info.pcie_lanes = 16;
rdev->pm.default_power_state_index = state_index; rdev->pm.default_power_state_index = state_index;
rdev->pm.power_state[state_index].flags = 0; rdev->pm.power_state[state_index].flags = 0;
state_index++; state_index++;
......
...@@ -2382,17 +2382,13 @@ void radeon_combios_get_power_modes(struct radeon_device *rdev) ...@@ -2382,17 +2382,13 @@ void radeon_combios_get_power_modes(struct radeon_device *rdev)
if ((rdev->pm.power_state[state_index].clock_info[0].mclk == 0) || if ((rdev->pm.power_state[state_index].clock_info[0].mclk == 0) ||
(rdev->pm.power_state[state_index].clock_info[0].sclk == 0)) (rdev->pm.power_state[state_index].clock_info[0].sclk == 0))
goto default_mode; goto default_mode;
/* skip overclock modes for now */
if ((rdev->pm.power_state[state_index].clock_info[0].mclk >
rdev->clock.default_mclk + RADEON_MODE_OVERCLOCK_MARGIN) ||
(rdev->pm.power_state[state_index].clock_info[0].sclk >
rdev->clock.default_sclk + RADEON_MODE_OVERCLOCK_MARGIN))
goto default_mode;
rdev->pm.power_state[state_index].type = rdev->pm.power_state[state_index].type =
POWER_STATE_TYPE_BATTERY; POWER_STATE_TYPE_BATTERY;
misc = RBIOS16(offset + 0x5 + 0x0); misc = RBIOS16(offset + 0x5 + 0x0);
if (rev > 4) if (rev > 4)
misc2 = RBIOS16(offset + 0x5 + 0xe); misc2 = RBIOS16(offset + 0x5 + 0xe);
rdev->pm.power_state[state_index].misc = misc;
rdev->pm.power_state[state_index].misc2 = misc2;
if (misc & 0x4) { if (misc & 0x4) {
rdev->pm.power_state[state_index].clock_info[0].voltage.type = VOLTAGE_GPIO; rdev->pm.power_state[state_index].clock_info[0].voltage.type = VOLTAGE_GPIO;
if (misc & 0x8) if (misc & 0x8)
...@@ -2439,7 +2435,7 @@ void radeon_combios_get_power_modes(struct radeon_device *rdev) ...@@ -2439,7 +2435,7 @@ void radeon_combios_get_power_modes(struct radeon_device *rdev)
} else } else
rdev->pm.power_state[state_index].clock_info[0].voltage.type = VOLTAGE_NONE; rdev->pm.power_state[state_index].clock_info[0].voltage.type = VOLTAGE_NONE;
if (rev > 6) if (rev > 6)
rdev->pm.power_state[state_index].non_clock_info.pcie_lanes = rdev->pm.power_state[state_index].pcie_lanes =
RBIOS8(offset + 0x5 + 0x10); RBIOS8(offset + 0x5 + 0x10);
rdev->pm.power_state[state_index].flags = RADEON_PM_SINGLE_DISPLAY_ONLY; rdev->pm.power_state[state_index].flags = RADEON_PM_SINGLE_DISPLAY_ONLY;
state_index++; state_index++;
...@@ -2459,10 +2455,7 @@ void radeon_combios_get_power_modes(struct radeon_device *rdev) ...@@ -2459,10 +2455,7 @@ void radeon_combios_get_power_modes(struct radeon_device *rdev)
rdev->pm.power_state[state_index].clock_info[0].sclk = rdev->clock.default_sclk; rdev->pm.power_state[state_index].clock_info[0].sclk = rdev->clock.default_sclk;
rdev->pm.power_state[state_index].default_clock_mode = &rdev->pm.power_state[state_index].clock_info[0]; rdev->pm.power_state[state_index].default_clock_mode = &rdev->pm.power_state[state_index].clock_info[0];
rdev->pm.power_state[state_index].clock_info[0].voltage.type = VOLTAGE_NONE; rdev->pm.power_state[state_index].clock_info[0].voltage.type = VOLTAGE_NONE;
if (rdev->asic->get_pcie_lanes) rdev->pm.power_state[state_index].pcie_lanes = 16;
rdev->pm.power_state[state_index].non_clock_info.pcie_lanes = radeon_get_pcie_lanes(rdev);
else
rdev->pm.power_state[state_index].non_clock_info.pcie_lanes = 16;
rdev->pm.power_state[state_index].flags = 0; rdev->pm.power_state[state_index].flags = 0;
rdev->pm.default_power_state_index = state_index; rdev->pm.default_power_state_index = state_index;
rdev->pm.num_power_states = state_index + 1; rdev->pm.num_power_states = state_index + 1;
......
...@@ -64,7 +64,7 @@ static void radeon_print_power_mode_info(struct radeon_device *rdev) ...@@ -64,7 +64,7 @@ static void radeon_print_power_mode_info(struct radeon_device *rdev)
pm_state_types[rdev->pm.power_state[i].type], pm_state_types[rdev->pm.power_state[i].type],
is_default ? "(default)" : ""); is_default ? "(default)" : "");
if ((rdev->flags & RADEON_IS_PCIE) && !(rdev->flags & RADEON_IS_IGP)) if ((rdev->flags & RADEON_IS_PCIE) && !(rdev->flags & RADEON_IS_IGP))
DRM_INFO("\t%d PCIE Lanes\n", rdev->pm.power_state[i].non_clock_info.pcie_lanes); DRM_INFO("\t%d PCIE Lanes\n", rdev->pm.power_state[i].pcie_lanes);
if (rdev->pm.power_state[i].flags & RADEON_PM_SINGLE_DISPLAY_ONLY) if (rdev->pm.power_state[i].flags & RADEON_PM_SINGLE_DISPLAY_ONLY)
DRM_INFO("\tSingle display only\n"); DRM_INFO("\tSingle display only\n");
DRM_INFO("\t%d Clock Mode(s)\n", rdev->pm.power_state[i].num_clock_modes); DRM_INFO("\t%d Clock Mode(s)\n", rdev->pm.power_state[i].num_clock_modes);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment