diff --git a/drm/nouveau/nvkm/subdev/therm/nv40.c b/drm/nouveau/nvkm/subdev/therm/nv40.c index 6326fdc..fed243d 100644 --- a/drm/nouveau/nvkm/subdev/therm/nv40.c +++ b/drm/nouveau/nvkm/subdev/therm/nv40.c @@ -76,6 +76,7 @@ nv40_temp_get(struct nvkm_therm *therm) struct nvbios_therm_sensor *sensor = &therm->bios_sensor; enum nv40_sensor_style style = nv40_sensor_style(therm); int core_temp; + int slope_mul_f, slope_div_f, offset_num_f, offset_den_f; if (style == NEW_STYLE) { nvkm_wr32(device, 0x15b0, 0x80003fff); @@ -88,13 +89,35 @@ nv40_temp_get(struct nvkm_therm *therm) /* if the slope or the offset is unset, do no use the sensor */ if (!sensor->slope_div || !sensor->slope_mult || - !sensor->offset_num || !sensor->offset_den) - return -ENODEV; + !sensor->offset_num || !sensor->offset_den) { + switch (therm->subdev.device->chipset) { + case 0x43: + slope_mul_f = 792; + slope_div_f = 1000; + offset_num_f = 32060; + offset_den_f = 1000; + break; + case 0x44: + case 0x47: + slope_mul_f = 700; + slope_div_f = 1000; + offset_num_f = 27839; + offset_den_f = 1000; + break; + default: + return -ENODEV; + } + core_temp = core_temp * slope_mul_f / slope_div_f; + core_temp = core_temp + offset_num_f / offset_den_f; + core_temp = core_temp + sensor->offset_constant - 8; + } + else + { core_temp = core_temp * sensor->slope_mult / sensor->slope_div; core_temp = core_temp + sensor->offset_num / sensor->offset_den; core_temp = core_temp + sensor->offset_constant - 8; - + } /* reserve negative temperatures for errors */ if (core_temp < 0) core_temp = 0;