Lines Matching +full:full +full:- +full:hd

1 // SPDX-License-Identifier: GPL-2.0-only
16 * that none of the code has been re-used, it's a complete
17 * re-implementation
21 * controls with a tiny difference. The control-ids of hard-drive-fan
22 * and cpu-fan is swapped.
34 * offset : -19563152
38 * offset : -15650652
41 * HD Fan control correction.
44 * offset : -15650652
48 * offset : -19563152
54 * offset : -25431900
58 * offset : -15650652
61 * Target rubber-banding :
74 * control : cpu-fan
75 * ref : optical-drive-fan
76 * offset : -15650652
80 * control : optical-drive-fan
81 * ref : hard-drive-fan
82 * offset : -32768000
86 * dependencies, we must trigger HD loop before OD loop before CPU
91 * HD Fan control loop.
94 * control : hard-drive-fan
95 * sensor : hard-drive-temp
104 * control : hard-drive-fan
105 * sensor : hard-drive-temp
116 * control : optical-drive-fan
117 * sensor : optical-drive-temp
126 * control : optical-drive-fan
127 * sensor : optical-drive-temp
138 * control : hard-drive-fan
139 * sensor : gpu-temp
148 * control : cpu-fan
149 * sensor : gpu-temp
160 * control : optical-drive-fan
161 * sensor : north-bridge-temp
170 * control : hard-drive-fan
171 * sensor : north-bridge-temp
181 * control : cpu-fan
182 * sensors : cpu-temp, cpu-power
187 * control : cpufreq-clamp
188 * sensor : cpu-temp
247 /* All sys loops. Note the HD before the OD loop in order to have it
250 LOOP_GPU, /* control = hd or cpu, but luckily,
252 LOOP_HD, /* control = hd */
253 LOOP_KODIAK, /* control = hd or od */
260 "HD",
281 { .offset = -19563152,
285 { .offset = -15650652,
292 { .offset = -15650652,
296 { .offset = -19563152,
303 { .offset = -25431900,
307 { .offset = -15650652,
324 { .offset = -32768000,
331 { .offset = -32768000,
351 /* purely informative since we use mach_model-2 as index */
375 /* HD Fan control loop */
462 /* correction the value using the output-low-bound correction algo */
469 correction = &corrections[control_id][pm121_mach_model - 2]; in pm121_correct()
471 new_min = (average_power * correction->slope) >> 16; in pm121_correct()
472 new_min += correction->offset; in pm121_correct()
482 if (pm121_connection->control_id == control_id) { in pm121_connect()
483 controls[control_id]->ops->get_value(controls[control_id], in pm121_connect()
485 new_min = value * pm121_connection->correction.slope; in pm121_connect()
486 new_min += pm121_connection->correction.offset; in pm121_connect()
492 controls[control_id]->name, in pm121_connect()
493 controls[pm121_connection->ref_id]->name, in pm121_connect()
530 control = controls[param->control_id]; in pm121_create_sys_fans()
539 pm121_sys_state[loop_id]->ticks = 1; in pm121_create_sys_fans()
543 pid_param.gp = param->gp; in pm121_create_sys_fans()
547 pid_param.itarget = param->itarget; in pm121_create_sys_fans()
550 pid_param.min = control->ops->get_min(control); in pm121_create_sys_fans()
551 pid_param.max = control->ops->get_max(control); in pm121_create_sys_fans()
561 wf_pid_init(&pm121_sys_state[loop_id]->pid, &pid_param); in pm121_create_sys_fans()
574 loop_names[loop_id], control ? control->name : "uninitialized value"); in pm121_create_sys_fans()
589 param = &(pm121_sys_all_params[loop_id][pm121_mach_model-2]); in pm121_sys_fans_tick()
591 sensor = *(param->sensor); in pm121_sys_fans_tick()
592 control = controls[param->control_id]; in pm121_sys_fans_tick()
594 if (--st->ticks != 0) { in pm121_sys_fans_tick()
599 st->ticks = PM121_SYS_INTERVAL; in pm121_sys_fans_tick()
601 rc = sensor->ops->get_value(sensor, &temp); in pm121_sys_fans_tick()
604 sensor->name, rc); in pm121_sys_fans_tick()
610 loop_names[loop_id], sensor->name, in pm121_sys_fans_tick()
613 new_setpoint = wf_pid_run(&st->pid, temp); in pm121_sys_fans_tick()
617 param->control_id, in pm121_sys_fans_tick()
618 st->pid.param.min); in pm121_sys_fans_tick()
620 new_setpoint = pm121_connect(param->control_id, new_setpoint); in pm121_sys_fans_tick()
622 if (new_setpoint == st->setpoint) in pm121_sys_fans_tick()
624 st->setpoint = new_setpoint; in pm121_sys_fans_tick()
626 control->name, (int)new_setpoint); in pm121_sys_fans_tick()
629 rc = control->ops->set_value(control, st->setpoint); in pm121_sys_fans_tick()
632 control->name, rc); in pm121_sys_fans_tick()
665 tmax = ((s32)fvt->maxtemp) << 16; in pm121_create_cpu_fans()
674 pm121_cpu_state->ticks = 1; in pm121_create_cpu_fans()
678 pid_param.history_len = piddata->history_len; in pm121_create_cpu_fans()
681 "CPU control loop (%d)\n", piddata->history_len); in pm121_create_cpu_fans()
684 pid_param.gd = piddata->gd; in pm121_create_cpu_fans()
685 pid_param.gp = piddata->gp; in pm121_create_cpu_fans()
686 pid_param.gr = piddata->gr / pid_param.history_len; in pm121_create_cpu_fans()
688 tdelta = ((s32)piddata->target_temp_delta) << 16; in pm121_create_cpu_fans()
689 maxpow = ((s32)piddata->max_power) << 16; in pm121_create_cpu_fans()
690 powadj = ((s32)piddata->power_adj) << 16; in pm121_create_cpu_fans()
693 pid_param.ttarget = tmax - tdelta; in pm121_create_cpu_fans()
694 pid_param.pmaxadj = maxpow - powadj; in pm121_create_cpu_fans()
696 pid_param.min = fan_cpu->ops->get_min(fan_cpu); in pm121_create_cpu_fans()
697 pid_param.max = fan_cpu->ops->get_max(fan_cpu); in pm121_create_cpu_fans()
699 wf_cpu_pid_init(&pm121_cpu_state->pid, &pid_param); in pm121_create_cpu_fans()
724 if (--st->ticks != 0) { in pm121_cpu_fans_tick()
729 st->ticks = PM121_CPU_INTERVAL; in pm121_cpu_fans_tick()
733 rc = sensor_cpu_temp->ops->get_value(sensor_cpu_temp, &temp); in pm121_cpu_fans_tick()
741 rc = sensor_cpu_power->ops->get_value(sensor_cpu_power, &power); in pm121_cpu_fans_tick()
752 if (temp > st->pid.param.tmax) in pm121_cpu_fans_tick()
755 new_setpoint = wf_cpu_pid_run(&st->pid, power, temp); in pm121_cpu_fans_tick()
760 st->pid.param.min); in pm121_cpu_fans_tick()
765 if (st->setpoint == new_setpoint) in pm121_cpu_fans_tick()
767 st->setpoint = new_setpoint; in pm121_cpu_fans_tick()
772 rc = fan_cpu->ops->set_value(fan_cpu, st->setpoint); in pm121_cpu_fans_tick()
775 fan_cpu->name, rc); in pm121_cpu_fans_tick()
803 if (pm121_skipping && --pm121_skipping) in pm121_tick()
808 for (i = 0; i < pm121_cpu_state->pid.param.history_len; i++) in pm121_tick()
809 total_power += pm121_cpu_state->pid.powers[i]; in pm121_tick()
811 average_power = total_power / pm121_cpu_state->pid.param.history_len; in pm121_tick()
827 * fans to full speed. in pm121_tick()
871 if (controls[id] == NULL && !strcmp(ct->name, match)) { in pm121_register_control()
885 all = pm121_register_control(ct, "optical-drive-fan", FAN_OD) && all; in pm121_new_control()
886 all = pm121_register_control(ct, "hard-drive-fan", FAN_HD) && all; in pm121_new_control()
887 all = pm121_register_control(ct, "cpu-fan", FAN_CPU) && all; in pm121_new_control()
888 all = pm121_register_control(ct, "cpufreq-clamp", CPUFREQ) && all; in pm121_new_control()
901 if (*var == NULL && !strcmp(sensor->name, match)) { in pm121_register_sensor()
915 all = pm121_register_sensor(sr, "cpu-temp", in pm121_new_sensor()
917 all = pm121_register_sensor(sr, "cpu-current", in pm121_new_sensor()
919 all = pm121_register_sensor(sr, "cpu-voltage", in pm121_new_sensor()
921 all = pm121_register_sensor(sr, "cpu-power", in pm121_new_sensor()
923 all = pm121_register_sensor(sr, "hard-drive-temp", in pm121_new_sensor()
925 all = pm121_register_sensor(sr, "optical-drive-temp", in pm121_new_sensor()
927 all = pm121_register_sensor(sr, "incoming-air-temp", in pm121_new_sensor()
929 all = pm121_register_sensor(sr, "north-bridge-temp", in pm121_new_sensor()
931 all = pm121_register_sensor(sr, "gpu-temp", in pm121_new_sensor()
946 ((struct wf_control *)data)->name); in pm121_notify()
951 ((struct wf_sensor *)data)->name); in pm121_notify()
975 pm121_mach_model = st->model_id; in pm121_init_pm()
978 pm121_connection = &pm121_connections[pm121_mach_model - 2]; in pm121_init_pm()
1012 int rc = -ENODEV; in pm121_init()