Lines Matching +full:temp +full:- +full:sensor
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
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
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
282 { .offset = -19563152,
286 { .offset = -15650652,
293 { .offset = -15650652,
297 { .offset = -19563152,
304 { .offset = -25431900,
308 { .offset = -15650652,
325 { .offset = -32768000,
332 { .offset = -32768000,
352 /* purely informative since we use mach_model-2 as index */
354 struct wf_sensor **sensor; /* use sensor_id instead ? */ member
364 .sensor = &sensor_gpu_temp,
370 .sensor = &sensor_gpu_temp,
379 .sensor = &sensor_hard_drive_temp,
385 .sensor = &sensor_hard_drive_temp,
394 .sensor = &sensor_north_bridge_temp,
400 .sensor = &sensor_north_bridge_temp,
409 .sensor = &sensor_optical_drive_temp,
415 .sensor = &sensor_optical_drive_temp,
463 /* correction the value using the output-low-bound correction algo */
470 correction = &corrections[control_id][pm121_mach_model - 2]; in pm121_correct()
472 new_min = (average_power * correction->slope) >> 16; in pm121_correct()
473 new_min += correction->offset; in pm121_correct()
483 if (pm121_connection->control_id == control_id) { in pm121_connect()
484 controls[control_id]->ops->get_value(controls[control_id], in pm121_connect()
486 new_min = value * pm121_connection->correction.slope; in pm121_connect()
487 new_min += pm121_connection->correction.offset; in pm121_connect()
493 controls[control_id]->name, in pm121_connect()
494 controls[pm121_connection->ref_id]->name, in pm121_connect()
531 control = controls[param->control_id]; in pm121_create_sys_fans()
540 pm121_sys_state[loop_id]->ticks = 1; in pm121_create_sys_fans()
544 pid_param.gp = param->gp; in pm121_create_sys_fans()
548 pid_param.itarget = param->itarget; in pm121_create_sys_fans()
551 pid_param.min = control->ops->get_min(control); in pm121_create_sys_fans()
552 pid_param.max = control->ops->get_max(control); in pm121_create_sys_fans()
562 wf_pid_init(&pm121_sys_state[loop_id]->pid, &pid_param); in pm121_create_sys_fans()
575 loop_names[loop_id], control ? control->name : "uninitialized value"); in pm121_create_sys_fans()
585 struct wf_sensor *sensor; in pm121_sys_fans_tick() local
587 s32 temp, new_setpoint; in pm121_sys_fans_tick() local
590 param = &(pm121_sys_all_params[loop_id][pm121_mach_model-2]); in pm121_sys_fans_tick()
592 sensor = *(param->sensor); in pm121_sys_fans_tick()
593 control = controls[param->control_id]; in pm121_sys_fans_tick()
595 if (--st->ticks != 0) { in pm121_sys_fans_tick()
600 st->ticks = PM121_SYS_INTERVAL; in pm121_sys_fans_tick()
602 rc = sensor->ops->get_value(sensor, &temp); in pm121_sys_fans_tick()
604 printk(KERN_WARNING "windfarm: %s sensor error %d\n", in pm121_sys_fans_tick()
605 sensor->name, rc); in pm121_sys_fans_tick()
611 loop_names[loop_id], sensor->name, in pm121_sys_fans_tick()
612 FIX32TOPRINT(temp)); in pm121_sys_fans_tick()
614 new_setpoint = wf_pid_run(&st->pid, temp); in pm121_sys_fans_tick()
618 param->control_id, in pm121_sys_fans_tick()
619 st->pid.param.min); in pm121_sys_fans_tick()
621 new_setpoint = pm121_connect(param->control_id, new_setpoint); in pm121_sys_fans_tick()
623 if (new_setpoint == st->setpoint) in pm121_sys_fans_tick()
625 st->setpoint = new_setpoint; in pm121_sys_fans_tick()
627 control->name, (int)new_setpoint); in pm121_sys_fans_tick()
630 rc = control->ops->set_value(control, st->setpoint); in pm121_sys_fans_tick()
633 control->name, rc); in pm121_sys_fans_tick()
666 tmax = ((s32)fvt->maxtemp) << 16; in pm121_create_cpu_fans()
675 pm121_cpu_state->ticks = 1; in pm121_create_cpu_fans()
679 pid_param.history_len = piddata->history_len; in pm121_create_cpu_fans()
682 "CPU control loop (%d)\n", piddata->history_len); in pm121_create_cpu_fans()
685 pid_param.gd = piddata->gd; in pm121_create_cpu_fans()
686 pid_param.gp = piddata->gp; in pm121_create_cpu_fans()
687 pid_param.gr = piddata->gr / pid_param.history_len; in pm121_create_cpu_fans()
689 tdelta = ((s32)piddata->target_temp_delta) << 16; in pm121_create_cpu_fans()
690 maxpow = ((s32)piddata->max_power) << 16; in pm121_create_cpu_fans()
691 powadj = ((s32)piddata->power_adj) << 16; in pm121_create_cpu_fans()
694 pid_param.ttarget = tmax - tdelta; in pm121_create_cpu_fans()
695 pid_param.pmaxadj = maxpow - powadj; in pm121_create_cpu_fans()
697 pid_param.min = fan_cpu->ops->get_min(fan_cpu); in pm121_create_cpu_fans()
698 pid_param.max = fan_cpu->ops->get_max(fan_cpu); in pm121_create_cpu_fans()
700 wf_cpu_pid_init(&pm121_cpu_state->pid, &pid_param); in pm121_create_cpu_fans()
721 s32 new_setpoint, temp, power; in pm121_cpu_fans_tick() local
725 if (--st->ticks != 0) { in pm121_cpu_fans_tick()
730 st->ticks = PM121_CPU_INTERVAL; in pm121_cpu_fans_tick()
734 rc = sensor_cpu_temp->ops->get_value(sensor_cpu_temp, &temp); in pm121_cpu_fans_tick()
736 printk(KERN_WARNING "pm121: CPU temp sensor error %d\n", in pm121_cpu_fans_tick()
742 rc = sensor_cpu_power->ops->get_value(sensor_cpu_power, &power); in pm121_cpu_fans_tick()
744 printk(KERN_WARNING "pm121: CPU power sensor error %d\n", in pm121_cpu_fans_tick()
750 pr_debug("pm121: CPU Fans tick ! CPU temp: %d.%03d°C, power: %d.%03d\n", in pm121_cpu_fans_tick()
751 FIX32TOPRINT(temp), FIX32TOPRINT(power)); in pm121_cpu_fans_tick()
753 if (temp > st->pid.param.tmax) in pm121_cpu_fans_tick()
756 new_setpoint = wf_cpu_pid_run(&st->pid, power, temp); in pm121_cpu_fans_tick()
761 st->pid.param.min); in pm121_cpu_fans_tick()
766 if (st->setpoint == new_setpoint) in pm121_cpu_fans_tick()
768 st->setpoint = new_setpoint; in pm121_cpu_fans_tick()
773 rc = fan_cpu->ops->set_value(fan_cpu, st->setpoint); in pm121_cpu_fans_tick()
776 fan_cpu->name, rc); in pm121_cpu_fans_tick()
804 if (pm121_skipping && --pm121_skipping) in pm121_tick()
809 for (i = 0; i < pm121_cpu_state->pid.param.history_len; i++) in pm121_tick()
810 total_power += pm121_cpu_state->pid.powers[i]; in pm121_tick()
812 average_power = total_power / pm121_cpu_state->pid.param.history_len; in pm121_tick()
856 * _and_ no other failure is present. Since a sensor error will in pm121_tick()
872 if (controls[id] == NULL && !strcmp(ct->name, match)) { in pm121_register_control()
886 all = pm121_register_control(ct, "optical-drive-fan", FAN_OD) && all; in pm121_new_control()
887 all = pm121_register_control(ct, "hard-drive-fan", FAN_HD) && all; in pm121_new_control()
888 all = pm121_register_control(ct, "cpu-fan", FAN_CPU) && all; in pm121_new_control()
889 all = pm121_register_control(ct, "cpufreq-clamp", CPUFREQ) && all; in pm121_new_control()
898 static struct wf_sensor* pm121_register_sensor(struct wf_sensor *sensor, in pm121_register_sensor() argument
902 if (*var == NULL && !strcmp(sensor->name, match)) { in pm121_register_sensor()
903 if (wf_get_sensor(sensor) == 0) in pm121_register_sensor()
904 *var = sensor; in pm121_register_sensor()
916 all = pm121_register_sensor(sr, "cpu-temp", in pm121_new_sensor()
918 all = pm121_register_sensor(sr, "cpu-current", in pm121_new_sensor()
920 all = pm121_register_sensor(sr, "cpu-voltage", in pm121_new_sensor()
922 all = pm121_register_sensor(sr, "cpu-power", in pm121_new_sensor()
924 all = pm121_register_sensor(sr, "hard-drive-temp", in pm121_new_sensor()
926 all = pm121_register_sensor(sr, "optical-drive-temp", in pm121_new_sensor()
928 all = pm121_register_sensor(sr, "incoming-air-temp", in pm121_new_sensor()
930 all = pm121_register_sensor(sr, "north-bridge-temp", in pm121_new_sensor()
932 all = pm121_register_sensor(sr, "gpu-temp", in pm121_new_sensor()
947 ((struct wf_control *)data)->name); in pm121_notify()
951 pr_debug("pm121: new sensor %s detected\n", in pm121_notify()
952 ((struct wf_sensor *)data)->name); in pm121_notify()
976 pm121_mach_model = st->model_id; in pm121_init_pm()
979 pm121_connection = &pm121_connections[pm121_mach_model - 2]; in pm121_init_pm()
1012 int rc = -ENODEV; in pm121_init()