Lines Matching +full:temp +full:- +full:sensor

1 // SPDX-License-Identifier: GPL-2.0-only
11 * that none of the code has been re-used, it's a complete re-implementation
20 * with one sensor and one fan. Slots area is a bit different as the Darwin
22 * involves the presence of an AGP sensor and an AGP fan (possibly on the
24 * access to those additional sensor/fans for now (though ultimately, it would
25 * be possible to add sensor objects for them) so I'm only implementing the
166 tmax = ((s32)fvt->maxtemp) << 16; in wf_smu_create_cpu_fans()
175 wf_smu_cpu_fans->ticks = 1; in wf_smu_create_cpu_fans()
179 pid_param.history_len = piddata->history_len; in wf_smu_create_cpu_fans()
182 "CPU control loop (%d)\n", piddata->history_len); in wf_smu_create_cpu_fans()
185 pid_param.gd = piddata->gd; in wf_smu_create_cpu_fans()
186 pid_param.gp = piddata->gp; in wf_smu_create_cpu_fans()
187 pid_param.gr = piddata->gr / pid_param.history_len; in wf_smu_create_cpu_fans()
189 tdelta = ((s32)piddata->target_temp_delta) << 16; in wf_smu_create_cpu_fans()
190 maxpow = ((s32)piddata->max_power) << 16; in wf_smu_create_cpu_fans()
191 powadj = ((s32)piddata->power_adj) << 16; in wf_smu_create_cpu_fans()
194 pid_param.ttarget = tmax - tdelta; in wf_smu_create_cpu_fans()
195 pid_param.pmaxadj = maxpow - powadj; in wf_smu_create_cpu_fans()
200 wf_cpu_pid_init(&wf_smu_cpu_fans->pid, &pid_param); in wf_smu_create_cpu_fans()
221 s32 new_setpoint, temp, power; in wf_smu_cpu_fans_tick() local
224 if (--st->ticks != 0) { in wf_smu_cpu_fans_tick()
229 st->ticks = WF_SMU_CPU_FANS_INTERVAL; in wf_smu_cpu_fans_tick()
231 rc = wf_sensor_get(sensor_cpu_temp, &temp); in wf_smu_cpu_fans_tick()
233 printk(KERN_WARNING "windfarm: CPU temp sensor error %d\n", in wf_smu_cpu_fans_tick()
241 printk(KERN_WARNING "windfarm: CPU power sensor error %d\n", in wf_smu_cpu_fans_tick()
247 DBG("wf_smu: CPU Fans tick ! CPU temp: %d.%03d, power: %d.%03d\n", in wf_smu_cpu_fans_tick()
248 FIX32TOPRINT(temp), FIX32TOPRINT(power)); in wf_smu_cpu_fans_tick()
251 if (temp > 0x4a0000) in wf_smu_cpu_fans_tick()
254 if (temp > st->pid.param.tmax) in wf_smu_cpu_fans_tick()
257 new_setpoint = wf_cpu_pid_run(&st->pid, power, temp); in wf_smu_cpu_fans_tick()
261 if (st->cpu_setpoint == new_setpoint) in wf_smu_cpu_fans_tick()
263 st->cpu_setpoint = new_setpoint; in wf_smu_cpu_fans_tick()
266 rc = wf_control_set(fan_cpu_main, st->cpu_setpoint); in wf_smu_cpu_fans_tick()
274 rc = wf_control_set(fan_cpu_second, st->cpu_setpoint); in wf_smu_cpu_fans_tick()
282 rc = wf_control_set(fan_cpu_third, st->cpu_setpoint); in wf_smu_cpu_fans_tick()
310 wf_smu_drive_fans->ticks = 1; in wf_smu_create_drive_fans()
313 param.additive = (fan_hd->type == WF_CONTROL_RPM_FAN); in wf_smu_create_drive_fans()
316 wf_pid_init(&wf_smu_drive_fans->pid, &param); in wf_smu_create_drive_fans()
330 s32 new_setpoint, temp; in wf_smu_drive_fans_tick() local
333 if (--st->ticks != 0) { in wf_smu_drive_fans_tick()
338 st->ticks = st->pid.param.interval; in wf_smu_drive_fans_tick()
340 rc = wf_sensor_get(sensor_hd_temp, &temp); in wf_smu_drive_fans_tick()
342 printk(KERN_WARNING "windfarm: HD temp sensor error %d\n", in wf_smu_drive_fans_tick()
348 DBG("wf_smu: Drive Fans tick ! HD temp: %d.%03d\n", in wf_smu_drive_fans_tick()
349 FIX32TOPRINT(temp)); in wf_smu_drive_fans_tick()
351 if (temp > (st->pid.param.itarget + 0x50000)) in wf_smu_drive_fans_tick()
354 new_setpoint = wf_pid_run(&st->pid, temp); in wf_smu_drive_fans_tick()
358 if (st->setpoint == new_setpoint) in wf_smu_drive_fans_tick()
360 st->setpoint = new_setpoint; in wf_smu_drive_fans_tick()
363 rc = wf_control_set(fan_hd, st->setpoint); in wf_smu_drive_fans_tick()
391 wf_smu_slots_fans->ticks = 1; in wf_smu_create_slots_fans()
394 param.additive = (fan_slots->type == WF_CONTROL_RPM_FAN); in wf_smu_create_slots_fans()
397 wf_pid_init(&wf_smu_slots_fans->pid, &param); in wf_smu_create_slots_fans()
414 if (--st->ticks != 0) { in wf_smu_slots_fans_tick()
419 st->ticks = st->pid.param.interval; in wf_smu_slots_fans_tick()
423 printk(KERN_WARNING "windfarm: Slots power sensor error %d\n", in wf_smu_slots_fans_tick()
433 if (power > (st->pid.param.itarget + 0x50000)) in wf_smu_slots_fans_tick()
437 new_setpoint = wf_pid_run(&st->pid, power); in wf_smu_slots_fans_tick()
441 if (st->setpoint == new_setpoint) in wf_smu_slots_fans_tick()
443 st->setpoint = new_setpoint; in wf_smu_slots_fans_tick()
446 rc = wf_control_set(fan_slots, st->setpoint); in wf_smu_slots_fans_tick()
475 if (wf_smu_skipping && --wf_smu_skipping) in wf_smu_tick()
526 * _and_ no other failure is present. Since a sensor error will in wf_smu_tick()
543 if (fan_cpu_main == NULL && !strcmp(ct->name, "cpu-rear-fan-0")) { in wf_smu_new_control()
548 if (fan_cpu_second == NULL && !strcmp(ct->name, "cpu-rear-fan-1")) { in wf_smu_new_control()
553 if (fan_cpu_third == NULL && !strcmp(ct->name, "cpu-front-fan-0")) { in wf_smu_new_control()
558 if (cpufreq_clamp == NULL && !strcmp(ct->name, "cpufreq-clamp")) { in wf_smu_new_control()
563 if (fan_hd == NULL && !strcmp(ct->name, "drive-bay-fan")) { in wf_smu_new_control()
568 if (fan_slots == NULL && !strcmp(ct->name, "slots-fan")) { in wf_smu_new_control()
583 if (sensor_cpu_power == NULL && !strcmp(sr->name, "cpu-power")) { in wf_smu_new_sensor()
588 if (sensor_cpu_temp == NULL && !strcmp(sr->name, "cpu-temp")) { in wf_smu_new_sensor()
593 if (sensor_hd_temp == NULL && !strcmp(sr->name, "hd-temp")) { in wf_smu_new_sensor()
598 if (sensor_slots_power == NULL && !strcmp(sr->name, "slots-power")) { in wf_smu_new_sensor()
615 ((struct wf_control *)data)->name); in wf_smu_notify()
620 DBG("wf: new sensor %s detected\n", in wf_smu_notify()
621 ((struct wf_sensor *)data)->name); in wf_smu_notify()
662 * that the attribute callback won't race with the sensor beeing in wf_smu_remove()
707 int rc = -ENODEV; in wf_smu_init()