drm/radeon/kms: rv6xx+ thermal sensor fixes
Some fixes to the thermal sensor code: - handle negative numbers - properly handle temp calculation on different asics Signed-off-by: Alex Deucher <alexdeucher@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
parent
e98ce0d7cf
commit
20d391d725
@ -97,26 +97,29 @@ u32 evergreen_page_flip(struct radeon_device *rdev, int crtc_id, u64 crtc_base)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* get temperature in millidegrees */
|
/* get temperature in millidegrees */
|
||||||
u32 evergreen_get_temp(struct radeon_device *rdev)
|
int evergreen_get_temp(struct radeon_device *rdev)
|
||||||
{
|
{
|
||||||
u32 temp = (RREG32(CG_MULT_THERMAL_STATUS) & ASIC_T_MASK) >>
|
u32 temp = (RREG32(CG_MULT_THERMAL_STATUS) & ASIC_T_MASK) >>
|
||||||
ASIC_T_SHIFT;
|
ASIC_T_SHIFT;
|
||||||
u32 actual_temp = 0;
|
u32 actual_temp = 0;
|
||||||
|
|
||||||
if ((temp >> 10) & 1)
|
if (temp & 0x400)
|
||||||
actual_temp = 0;
|
actual_temp = -256;
|
||||||
else if ((temp >> 9) & 1)
|
else if (temp & 0x200)
|
||||||
actual_temp = 255;
|
actual_temp = 255;
|
||||||
else
|
else if (temp & 0x100) {
|
||||||
actual_temp = (temp >> 1) & 0xff;
|
actual_temp = temp & 0x1ff;
|
||||||
|
actual_temp |= ~0x1ff;
|
||||||
|
} else
|
||||||
|
actual_temp = temp & 0xff;
|
||||||
|
|
||||||
return actual_temp * 1000;
|
return (actual_temp * 1000) / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
u32 sumo_get_temp(struct radeon_device *rdev)
|
int sumo_get_temp(struct radeon_device *rdev)
|
||||||
{
|
{
|
||||||
u32 temp = RREG32(CG_THERMAL_STATUS) & 0xff;
|
u32 temp = RREG32(CG_THERMAL_STATUS) & 0xff;
|
||||||
u32 actual_temp = (temp >> 1) & 0xff;
|
int actual_temp = temp - 49;
|
||||||
|
|
||||||
return actual_temp * 1000;
|
return actual_temp * 1000;
|
||||||
}
|
}
|
||||||
|
@ -97,12 +97,16 @@ void r600_irq_disable(struct radeon_device *rdev);
|
|||||||
static void r600_pcie_gen2_enable(struct radeon_device *rdev);
|
static void r600_pcie_gen2_enable(struct radeon_device *rdev);
|
||||||
|
|
||||||
/* get temperature in millidegrees */
|
/* get temperature in millidegrees */
|
||||||
u32 rv6xx_get_temp(struct radeon_device *rdev)
|
int rv6xx_get_temp(struct radeon_device *rdev)
|
||||||
{
|
{
|
||||||
u32 temp = (RREG32(CG_THERMAL_STATUS) & ASIC_T_MASK) >>
|
u32 temp = (RREG32(CG_THERMAL_STATUS) & ASIC_T_MASK) >>
|
||||||
ASIC_T_SHIFT;
|
ASIC_T_SHIFT;
|
||||||
|
int actual_temp = temp & 0xff;
|
||||||
|
|
||||||
return temp * 1000;
|
if (temp & 0x100)
|
||||||
|
actual_temp -= 256;
|
||||||
|
|
||||||
|
return actual_temp * 1000;
|
||||||
}
|
}
|
||||||
|
|
||||||
void r600_pm_get_dynpm_state(struct radeon_device *rdev)
|
void r600_pm_get_dynpm_state(struct radeon_device *rdev)
|
||||||
|
@ -179,10 +179,10 @@ void radeon_combios_get_power_modes(struct radeon_device *rdev);
|
|||||||
void radeon_atombios_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 level);
|
||||||
void rs690_pm_info(struct radeon_device *rdev);
|
void rs690_pm_info(struct radeon_device *rdev);
|
||||||
extern u32 rv6xx_get_temp(struct radeon_device *rdev);
|
extern int rv6xx_get_temp(struct radeon_device *rdev);
|
||||||
extern u32 rv770_get_temp(struct radeon_device *rdev);
|
extern int rv770_get_temp(struct radeon_device *rdev);
|
||||||
extern u32 evergreen_get_temp(struct radeon_device *rdev);
|
extern int evergreen_get_temp(struct radeon_device *rdev);
|
||||||
extern u32 sumo_get_temp(struct radeon_device *rdev);
|
extern int sumo_get_temp(struct radeon_device *rdev);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Fences.
|
* Fences.
|
||||||
|
@ -430,7 +430,7 @@ static ssize_t radeon_hwmon_show_temp(struct device *dev,
|
|||||||
{
|
{
|
||||||
struct drm_device *ddev = pci_get_drvdata(to_pci_dev(dev));
|
struct drm_device *ddev = pci_get_drvdata(to_pci_dev(dev));
|
||||||
struct radeon_device *rdev = ddev->dev_private;
|
struct radeon_device *rdev = ddev->dev_private;
|
||||||
u32 temp;
|
int temp;
|
||||||
|
|
||||||
switch (rdev->pm.int_thermal_type) {
|
switch (rdev->pm.int_thermal_type) {
|
||||||
case THERMAL_TYPE_RV6XX:
|
case THERMAL_TYPE_RV6XX:
|
||||||
|
@ -78,18 +78,23 @@ u32 rv770_page_flip(struct radeon_device *rdev, int crtc_id, u64 crtc_base)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* get temperature in millidegrees */
|
/* get temperature in millidegrees */
|
||||||
u32 rv770_get_temp(struct radeon_device *rdev)
|
int rv770_get_temp(struct radeon_device *rdev)
|
||||||
{
|
{
|
||||||
u32 temp = (RREG32(CG_MULT_THERMAL_STATUS) & ASIC_T_MASK) >>
|
u32 temp = (RREG32(CG_MULT_THERMAL_STATUS) & ASIC_T_MASK) >>
|
||||||
ASIC_T_SHIFT;
|
ASIC_T_SHIFT;
|
||||||
u32 actual_temp = 0;
|
int actual_temp;
|
||||||
|
|
||||||
if ((temp >> 9) & 1)
|
if (temp & 0x400)
|
||||||
actual_temp = 0;
|
actual_temp = -256;
|
||||||
else
|
else if (temp & 0x200)
|
||||||
actual_temp = (temp >> 1) & 0xff;
|
actual_temp = 255;
|
||||||
|
else if (temp & 0x100) {
|
||||||
|
actual_temp = temp & 0x1ff;
|
||||||
|
actual_temp |= ~0x1ff;
|
||||||
|
} else
|
||||||
|
actual_temp = temp & 0xff;
|
||||||
|
|
||||||
return actual_temp * 1000;
|
return (actual_temp * 1000) / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
void rv770_pm_misc(struct radeon_device *rdev)
|
void rv770_pm_misc(struct radeon_device *rdev)
|
||||||
|
Loading…
Reference in New Issue
Block a user