From 1f292258d5b73526c80ad5aee80760580d366491 Mon Sep 17 00:00:00 2001 From: Christoffer Sandberg Date: Wed, 19 May 2021 18:21:36 +0200 Subject: [PATCH] Add cl perf profile set ioctl --- src/clevo_interfaces.h | 5 ++++- src/tuxedo_io/tuxedo_io.c | 9 ++++++++- src/tuxedo_io/tuxedo_io_ioctl.h | 3 ++- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/clevo_interfaces.h b/src/clevo_interfaces.h index bb7944e..f2fe0f1 100644 --- a/src/clevo_interfaces.h +++ b/src/clevo_interfaces.h @@ -1,5 +1,5 @@ /*! - * Copyright (c) 2020 TUXEDO Computers GmbH + * Copyright (c) 2020-2021 TUXEDO Computers GmbH * * This file is part of tuxedo-keyboard. * @@ -45,6 +45,9 @@ #define CLEVO_CMD_SET_FLIGHTMODE_SW 0x20 #define CLEVO_CMD_SET_TOUCHPAD_SW 0x2a +#define CLEVO_CMD_OPT 0x79 +#define CLEVO_OPT_SUBCMD_SET_PERF_PROF 0x19 + int clevo_keyboard_init(void); struct clevo_interface_t { diff --git a/src/tuxedo_io/tuxedo_io.c b/src/tuxedo_io/tuxedo_io.c index 4fbd794..a9d9ed4 100644 --- a/src/tuxedo_io/tuxedo_io.c +++ b/src/tuxedo_io/tuxedo_io.c @@ -1,5 +1,5 @@ /*! - * Copyright (c) 2019-2020 TUXEDO Computers GmbH + * Copyright (c) 2019-2021 TUXEDO Computers GmbH * * This file is part of tuxedo-io. * @@ -66,6 +66,8 @@ static long clevo_ioctl_interface(struct file *file, unsigned int cmd, unsigned u32 copy_result; u32 argument = (u32) arg; + u32 clevo_arg; + const char str_no_if[] = ""; char *str_clevo_if; @@ -139,6 +141,11 @@ static long clevo_ioctl_interface(struct file *file, unsigned int cmd, unsigned copy_result = copy_from_user(&argument, (int32_t *) arg, sizeof(argument)); clevo_evaluate_method(CLEVO_CMD_SET_TOUCHPAD_SW, argument, &result); break; + case W_CL_PERF_PROFILE: + copy_result = copy_from_user(&argument, (int32_t *) arg, sizeof(argument)); + clevo_arg = (CLEVO_OPT_SUBCMD_SET_PERF_PROF << 0x18) | (argument & 0xff); + clevo_evaluate_method(CLEVO_CMD_OPT, clevo_arg, &result); + break; } return 0; diff --git a/src/tuxedo_io/tuxedo_io_ioctl.h b/src/tuxedo_io/tuxedo_io_ioctl.h index c86edc3..8a6a22c 100644 --- a/src/tuxedo_io/tuxedo_io_ioctl.h +++ b/src/tuxedo_io/tuxedo_io_ioctl.h @@ -1,5 +1,5 @@ /*! - * Copyright (c) 2019-2020 TUXEDO Computers GmbH + * Copyright (c) 2019-2021 TUXEDO Computers GmbH * * This file is part of tuxedo-io. * @@ -60,6 +60,7 @@ #define W_CL_WEBCAM_SW _IOW(MAGIC_WRITE_CL, 0x12, int32_t*) #define W_CL_FLIGHTMODE_SW _IOW(MAGIC_WRITE_CL, 0x13, int32_t*) #define W_CL_TOUCHPAD_SW _IOW(MAGIC_WRITE_CL, 0x14, int32_t*) +#define W_CL_PERF_PROFILE _IOW(MAGIC_WRITE_CL, 0x15, int32_t*) #ifdef DEBUG #define W_TF_BC _IOW(MAGIC_WRITE_CL, 0x91, uint32_t*)