int nouveau_therm_sensor_ctor(struct nouveau_therm *therm) { struct nouveau_therm_priv *priv = (void *)therm; struct nouveau_bios *bios = nouveau_bios(therm); nouveau_alarm_init(&priv->sensor.therm_poll_alarm, alarm_timer_callback); nouveau_therm_temp_set_defaults(therm); if (nvbios_therm_sensor_parse(bios, NVBIOS_THERM_DOMAIN_CORE, &priv->bios_sensor)) nv_error(therm, "nvbios_therm_sensor_parse failed\n"); nouveau_therm_temp_safety_checks(therm); return 0; }
void nouveau_therm_init(struct nouveau_device *device) { nouveau_pm_temp_sensor_constants *sensor = &device->sensor_constants; nvbios_therm_sensor bios_sensor; /* store some safe defaults */ sensor->offset_constant = 0; sensor->offset_num = 0; sensor->offset_den = 1; sensor->slope_mult = 1; sensor->slope_div = 1; if (!nvbios_therm_sensor_parse(device, &bios_sensor)) { sensor->slope_mult = bios_sensor.slope_mult; sensor->slope_div = bios_sensor.slope_div; sensor->offset_num = bios_sensor.offset_num; sensor->offset_den = bios_sensor.offset_den; sensor->offset_constant = bios_sensor.offset_constant; } }