Lines Matching +full:min +full:- +full:rpm
1 // SPDX-License-Identifier: GPL-2.0-only
11 * that none of the code has been re-used, it's a complete re-implementation
24 * - the linked control (second control) gets the target value as-is
26 * - the main control (first control) gets the target value scaled with
28 * - the value of the target of the CPU Fan control loop is retrieved,
33 * controls : system-fan, drive-bay-fan
34 * sensors : hd-temp
41 * linear-factors : offset = 0xff38 scale = 0x0ccd
45 * controls : system-fan, drive-bay-fan
46 * sensors : hd-temp
53 * linear-factors : offset = 0xff38 scale = 0x0ccd
57 * controls : system-fan
58 * sensors : hd-temp
65 * linear-factors : offset = 0x0000 scale = 0x1000
74 * controls : cpu-fan
75 * sensors : cpu-temp cpu-power
77 * linear-factors : offset = 0xfb50 scale = 0x1000
293 wf_smu_sys_fans->ticks = 1; in wf_smu_create_sys_fans()
294 wf_smu_sys_fans->scale0 = param->scale0; in wf_smu_create_sys_fans()
295 wf_smu_sys_fans->offset0 = param->offset0; in wf_smu_create_sys_fans()
296 wf_smu_sys_fans->scale1 = param->scale1; in wf_smu_create_sys_fans()
297 wf_smu_sys_fans->offset1 = param->offset1; in wf_smu_create_sys_fans()
300 pid_param.gd = param->gd; in wf_smu_create_sys_fans()
301 pid_param.gp = param->gp; in wf_smu_create_sys_fans()
302 pid_param.gr = param->gr; in wf_smu_create_sys_fans()
305 pid_param.itarget = param->itarget; in wf_smu_create_sys_fans()
306 pid_param.min = wf_control_get_min(fan_system); in wf_smu_create_sys_fans()
309 pid_param.min = in wf_smu_create_sys_fans()
310 max(pid_param.min, wf_control_get_min(fan_hd)); in wf_smu_create_sys_fans()
312 min(pid_param.max, wf_control_get_max(fan_hd)); in wf_smu_create_sys_fans()
314 wf_pid_init(&wf_smu_sys_fans->pid, &pid_param); in wf_smu_create_sys_fans()
317 DBG(" itarged=%d.%03d, min=%d RPM, max=%d RPM\n", in wf_smu_create_sys_fans()
318 FIX32TOPRINT(pid_param.itarget), pid_param.min, pid_param.max); in wf_smu_create_sys_fans()
334 if (--st->ticks != 0) { in wf_smu_sys_fans_tick()
339 st->ticks = WF_SMU_SYS_FANS_INTERVAL; in wf_smu_sys_fans_tick()
352 if (temp > (st->pid.param.itarget + 0x50000)) in wf_smu_sys_fans_tick()
355 new_setpoint = wf_pid_run(&st->pid, temp); in wf_smu_sys_fans_tick()
357 DBG("wf_smu: new_setpoint: %d RPM\n", (int)new_setpoint); in wf_smu_sys_fans_tick()
359 scaled = ((((s64)new_setpoint) * (s64)st->scale0) >> 12) + st->offset0; in wf_smu_sys_fans_tick()
361 DBG("wf_smu: scaled setpoint: %d RPM\n", (int)scaled); in wf_smu_sys_fans_tick()
363 cputarget = wf_smu_cpu_fans ? wf_smu_cpu_fans->pid.target : 0; in wf_smu_sys_fans_tick()
364 cputarget = ((((s64)cputarget) * (s64)st->scale1) >> 12) + st->offset1; in wf_smu_sys_fans_tick()
366 scaled = max(scaled, st->pid.param.min); in wf_smu_sys_fans_tick()
367 scaled = min(scaled, st->pid.param.max); in wf_smu_sys_fans_tick()
369 DBG("wf_smu: adjusted setpoint: %d RPM\n", (int)scaled); in wf_smu_sys_fans_tick()
371 if (st->sys_setpoint == scaled && new_setpoint == st->hd_setpoint) in wf_smu_sys_fans_tick()
373 st->sys_setpoint = scaled; in wf_smu_sys_fans_tick()
374 st->hd_setpoint = new_setpoint; in wf_smu_sys_fans_tick()
377 rc = wf_control_set(fan_system, st->sys_setpoint); in wf_smu_sys_fans_tick()
385 rc = wf_control_set(fan_hd, st->hd_setpoint); in wf_smu_sys_fans_tick()
417 tmax = ((s32)fvt->maxtemp) << 16; in wf_smu_create_cpu_fans()
426 wf_smu_cpu_fans->ticks = 1; in wf_smu_create_cpu_fans()
428 wf_smu_cpu_fans->scale = WF_SMU_CPU_FANS_SIBLING_SCALE; in wf_smu_create_cpu_fans()
429 wf_smu_cpu_fans->offset = WF_SMU_CPU_FANS_SIBLING_OFFSET; in wf_smu_create_cpu_fans()
433 pid_param.history_len = piddata->history_len; in wf_smu_create_cpu_fans()
436 "CPU control loop (%d)\n", piddata->history_len); in wf_smu_create_cpu_fans()
439 pid_param.gd = piddata->gd; in wf_smu_create_cpu_fans()
440 pid_param.gp = piddata->gp; in wf_smu_create_cpu_fans()
441 pid_param.gr = piddata->gr / pid_param.history_len; in wf_smu_create_cpu_fans()
443 tdelta = ((s32)piddata->target_temp_delta) << 16; in wf_smu_create_cpu_fans()
444 maxpow = ((s32)piddata->max_power) << 16; in wf_smu_create_cpu_fans()
445 powadj = ((s32)piddata->power_adj) << 16; in wf_smu_create_cpu_fans()
448 pid_param.ttarget = tmax - tdelta; in wf_smu_create_cpu_fans()
449 pid_param.pmaxadj = maxpow - powadj; in wf_smu_create_cpu_fans()
451 pid_param.min = wf_control_get_min(fan_cpu_main); in wf_smu_create_cpu_fans()
454 wf_cpu_pid_init(&wf_smu_cpu_fans->pid, &pid_param); in wf_smu_create_cpu_fans()
457 DBG(" ttarget=%d.%03d, tmax=%d.%03d, min=%d RPM, max=%d RPM\n", in wf_smu_create_cpu_fans()
459 pid_param.min, pid_param.max); in wf_smu_create_cpu_fans()
478 if (--st->ticks != 0) { in wf_smu_cpu_fans_tick()
483 st->ticks = WF_SMU_CPU_FANS_INTERVAL; in wf_smu_cpu_fans_tick()
508 if (temp > st->pid.param.tmax) in wf_smu_cpu_fans_tick()
511 new_setpoint = wf_cpu_pid_run(&st->pid, power, temp); in wf_smu_cpu_fans_tick()
513 DBG("wf_smu: new_setpoint: %d RPM\n", (int)new_setpoint); in wf_smu_cpu_fans_tick()
515 systarget = wf_smu_sys_fans ? wf_smu_sys_fans->pid.target : 0; in wf_smu_cpu_fans_tick()
516 systarget = ((((s64)systarget) * (s64)st->scale) >> 12) in wf_smu_cpu_fans_tick()
517 + st->offset; in wf_smu_cpu_fans_tick()
519 new_setpoint = max(new_setpoint, st->pid.param.min); in wf_smu_cpu_fans_tick()
520 new_setpoint = min(new_setpoint, st->pid.param.max); in wf_smu_cpu_fans_tick()
522 DBG("wf_smu: adjusted setpoint: %d RPM\n", (int)new_setpoint); in wf_smu_cpu_fans_tick()
524 if (st->cpu_setpoint == new_setpoint) in wf_smu_cpu_fans_tick()
526 st->cpu_setpoint = new_setpoint; in wf_smu_cpu_fans_tick()
529 rc = wf_control_set(fan_cpu_main, st->cpu_setpoint); in wf_smu_cpu_fans_tick()
556 if (wf_smu_skipping && --wf_smu_skipping) in wf_smu_tick()
617 if (fan_cpu_main == NULL && !strcmp(ct->name, "cpu-fan")) { in wf_smu_new_control()
622 if (fan_system == NULL && !strcmp(ct->name, "system-fan")) { in wf_smu_new_control()
627 if (cpufreq_clamp == NULL && !strcmp(ct->name, "cpufreq-clamp")) { in wf_smu_new_control()
642 if (fan_hd == NULL && !strcmp(ct->name, "drive-bay-fan")) { in wf_smu_new_control()
656 if (sensor_cpu_power == NULL && !strcmp(sr->name, "cpu-power")) { in wf_smu_new_sensor()
661 if (sensor_cpu_temp == NULL && !strcmp(sr->name, "cpu-temp")) { in wf_smu_new_sensor()
666 if (sensor_hd_temp == NULL && !strcmp(sr->name, "hd-temp")) { in wf_smu_new_sensor()
682 ((struct wf_control *)data)->name); in wf_smu_notify()
688 ((struct wf_sensor *)data)->name); in wf_smu_notify()
711 wf_smu_mach_model = st->model_id; in wf_init_pm()
777 int rc = -ENODEV; in wf_smu_init()