mirror of
https://github.com/wessel-novacustom/clevo-keyboard.git
synced 2024-11-15 03:34:01 +01:00
Merge branch 'set_full_fan_mode_less_intrusive' into 'master'
Set full fan mode less intrusive See merge request tuxedocomputers/development/packages/tuxedo-keyboard!18
This commit is contained in:
commit
2e8e9d9195
3
.gitignore
vendored
3
.gitignore
vendored
|
@ -18,9 +18,10 @@ Mkfile.old
|
|||
*.mk
|
||||
|
||||
.vscode/
|
||||
*.kdev4
|
||||
|
||||
# Packaging
|
||||
rpm
|
||||
deb/tuxedo-keyboard-*
|
||||
*.deb
|
||||
*.rpm
|
||||
*.rpm
|
||||
|
|
|
@ -16,6 +16,9 @@
|
|||
* You should have received a copy of the GNU General Public License
|
||||
* along with this software. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef TONGFANG_WMI_H
|
||||
#define TONGFANG_WMI_H
|
||||
|
||||
#include <linux/acpi.h>
|
||||
#include <linux/wmi.h>
|
||||
#include <linux/mutex.h>
|
||||
|
@ -274,6 +277,10 @@ static u32 uniwill_identify(void)
|
|||
static void uniwill_init(void)
|
||||
{
|
||||
union uw_ec_write_return reg_write_return;
|
||||
|
||||
// FIXME Hard set balanced profile until we have implemented a way to
|
||||
// switch it while tuxedo_io is loaded
|
||||
uw_ec_write_addr(0x51, 0x07, 0x00, 0x00, ®_write_return);
|
||||
|
||||
// Enable manual mode
|
||||
uw_ec_write_addr(0x41, 0x07, 0x01, 0x00, ®_write_return);
|
||||
|
@ -308,9 +315,9 @@ static u32 uw_set_fan(u32 fan_index, u8 fan_speed)
|
|||
|
||||
// Check current mode
|
||||
uw_ec_read_addr(0x51, 0x07, ®_read_return);
|
||||
if (reg_read_return.bytes.data_low != 0x40) {
|
||||
// If not "full fan mode" (ie. 0x40) switch to it (required for fancontrol)
|
||||
uw_ec_write_addr(0x51, 0x07, 0x40, 0x00, ®_write_return);
|
||||
if (!(reg_read_return.bytes.data_low & 0x40)) {
|
||||
// If not "full fan mode" (i.e. 0x40 bit set) switch to it (required for fancontrol)
|
||||
uw_ec_write_addr(0x51, 0x07, reg_read_return.bytes.data_low | 0x40, 0x00, ®_write_return);
|
||||
// Attempt to write both fans as quick as possible before complete ramp-up
|
||||
pr_debug("prevent ramp-up start\n");
|
||||
for (i = 0; i < 10; ++i) {
|
||||
|
@ -326,3 +333,18 @@ static u32 uw_set_fan(u32 fan_index, u8 fan_speed)
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static u32 uw_set_fan_auto(void)
|
||||
{
|
||||
union uw_ec_read_return reg_read_return;
|
||||
union uw_ec_write_return reg_write_return;
|
||||
|
||||
// Get current mode
|
||||
uw_ec_read_addr(0x51, 0x07, ®_read_return);
|
||||
// Switch off "full fan mode" (i.e. unset 0x40 bit)
|
||||
uw_ec_write_addr(0x51, 0x07, reg_read_return.bytes.data_low & 0xbf, 0x00, ®_write_return);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
MODULE_DESCRIPTION("Hardware interface for TUXEDO laptops");
|
||||
MODULE_AUTHOR("TUXEDO Computers GmbH <tux@tuxedocomputers.com>");
|
||||
MODULE_VERSION("0.2.1");
|
||||
MODULE_VERSION("0.2.2");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
||||
MODULE_ALIAS_CLEVO_INTERFACES();
|
||||
|
@ -229,6 +229,9 @@ static long uniwill_ioctl_interface(struct file *file, unsigned int cmd, unsigne
|
|||
uw_ec_write_addr(0x41, 0x07, argument & 0x01, 0x00, ®_write_return);
|
||||
*/
|
||||
break;
|
||||
case W_UW_FANAUTO:
|
||||
uw_set_fan_auto();
|
||||
break;
|
||||
#ifdef DEBUG
|
||||
case W_TF_BC:
|
||||
copy_result = copy_from_user(&uw_arg, (void *) arg, sizeof(uw_arg));
|
||||
|
|
|
@ -83,5 +83,6 @@
|
|||
#define W_UW_FANSPEED2 _IOW(MAGIC_WRITE_UW, 0x11, int32_t*)
|
||||
#define W_UW_MODE _IOW(MAGIC_WRITE_UW, 0x12, int32_t*)
|
||||
#define W_UW_MODE_ENABLE _IOW(MAGIC_WRITE_UW, 0x13, int32_t*)
|
||||
#define W_UW_FANAUTO _IO(MAGIC_WRITE_UW, 0x14) // undo all previous calls of W_UW_FANSPEED and W_UW_FANSPEED2
|
||||
|
||||
#endif
|
||||
|
|
Loading…
Reference in a new issue