Skip to content

Commit 0ebd4a4

Browse files
committed
Merge branch 'tf_0_is_1_behaviour' into 'master'
Reenable fan-off on all TF devices See merge request tuxedocomputers/development/packages/tuxedo-keyboard!31
2 parents e8dc238 + 493541f commit 0ebd4a4

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

src/tuxedo_io/tuxedo_io.c

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,16 @@ static u32 uw_set_fan(u32 fan_index, u8 fan_speed)
360360
else
361361
return -EINVAL;
362362

363+
if (fan_speed == 0) {
364+
// Avoid hard coded EC behaviour: Setting fan speed = 0x00 spins the fan up
365+
// to 0x3c (30%) for 3 minutes before going to 0x00. Setting fan speed = 1
366+
// also causes the fan to stop since on 2020 or later TF devices the
367+
// microcontroller in the fan itself is intelligent enough to not try to
368+
// start up the motor when the speed is to slow. Older devices don't use
369+
// this fan controll anyway, but the else case below.
370+
fan_speed = 1;
371+
}
372+
363373
uniwill_write_ec_ram(addr_for_fan, fan_speed & 0xff);
364374
}
365375
else { // old workaround using full fan mode
@@ -576,23 +586,25 @@ static long uniwill_ioctl_interface(struct file *file, unsigned int cmd, unsigne
576586
copy_result = copy_to_user((void *) arg, &result, sizeof(result));
577587
break;
578588
case R_UW_FANS_OFF_AVAILABLE:
579-
result = has_universal_ec_fan_control();
589+
/*result = has_universal_ec_fan_control();
580590
if (result == 1) {
581591
result = 0;
582592
}
583593
else if (result == 0) {
584594
result = 1;
585-
}
595+
}*/
596+
result = 1;
586597
copy_result = copy_to_user((void *) arg, &result, sizeof(result));
587598
break;
588599
case R_UW_FANS_MIN_SPEED:
589-
result = has_universal_ec_fan_control();
600+
/*result = has_universal_ec_fan_control();
590601
if (result == 1) {
591602
result = 20;
592603
}
593604
else if (result == 0) {
594605
result = 0;
595-
}
606+
}*/
607+
result = 20;
596608
copy_result = copy_to_user((void *) arg, &result, sizeof(result));
597609
break;
598610
case R_UW_TDP0:

0 commit comments

Comments
 (0)