clevo-keyboard/src/uniwill_interfaces.h

83 lines
2.6 KiB
C
Raw Normal View History

/*!
* Copyright (c) 2021 TUXEDO Computers GmbH <tux@tuxedocomputers.com>
*
* This file is part of tuxedo-keyboard.
*
* tuxedo-keyboard is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This software is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this software. If not, see <https://www.gnu.org/licenses/>.
*/
2021-09-07 19:47:31 +02:00
#ifndef UNIWILL_INTERFACES_H
#define UNIWILL_INTERFACES_H
2021-09-07 21:44:00 +02:00
#include <linux/types.h>
2021-09-18 00:13:42 +02:00
#define UNIWILL_WMI_MGMT_GUID_BA "ABBC0F6D-8EA1-11D1-00A0-C90629100000"
#define UNIWILL_WMI_MGMT_GUID_BB "ABBC0F6E-8EA1-11D1-00A0-C90629100000"
#define UNIWILL_WMI_MGMT_GUID_BC "ABBC0F6F-8EA1-11D1-00A0-C90629100000"
2021-09-18 00:13:42 +02:00
#define UNIWILL_WMI_EVENT_GUID_0 "ABBC0F70-8EA1-11D1-00A0-C90629100000"
#define UNIWILL_WMI_EVENT_GUID_1 "ABBC0F71-8EA1-11D1-00A0-C90629100000"
#define UNIWILL_WMI_EVENT_GUID_2 "ABBC0F72-8EA1-11D1-00A0-C90629100000"
#define MODULE_ALIAS_UNIWILL_WMI() \
MODULE_ALIAS("wmi:" UNIWILL_WMI_EVENT_GUID_2); \
MODULE_ALIAS("wmi:" UNIWILL_WMI_MGMT_GUID_BC);
2021-09-07 19:47:31 +02:00
2021-09-07 21:44:00 +02:00
#define UNIWILL_INTERFACE_WMI_STRID "uniwill_wmi"
typedef int (uniwill_read_ec_ram_t)(u16, u8*);
typedef int (uniwill_write_ec_ram_t)(u16, u8);
2021-09-07 21:44:00 +02:00
typedef void (uniwill_event_callb_t)(u32);
2022-09-23 15:47:42 +02:00
#define UW_EC_REG_KBD_BL_STATUS 0x078c
#define UW_EC_REG_KBD_BL_STATUS_SUBCMD_RESET 0x10
#define UW_EC_REG_KBD_BL_MAX_BRIGHTNESS 0x1801
#define UW_EC_REG_KBD_BL_WHITE_BRIGHTNESS 0x1802
#define UW_EC_REG_KBD_BL_RGB_RED_BRIGHTNESS 0x1803
#define UW_EC_REG_KBD_BL_RGB_GREEN_BRIGHTNESS 0x1805
#define UW_EC_REG_KBD_BL_RGB_BLUE_BRIGHTNESS 0x1808
2021-09-07 21:44:00 +02:00
struct uniwill_interface_t {
char *string_id;
uniwill_event_callb_t *event_callb;
uniwill_read_ec_ram_t *read_ec_ram;
uniwill_write_ec_ram_t *write_ec_ram;
};
int uniwill_add_interface(struct uniwill_interface_t *new_interface);
int uniwill_remove_interface(struct uniwill_interface_t *interface);
2021-09-07 21:44:00 +02:00
uniwill_read_ec_ram_t uniwill_read_ec_ram;
uniwill_write_ec_ram_t uniwill_write_ec_ram;
int uniwill_get_active_interface_id(char **id_str);
2021-09-07 21:44:00 +02:00
union uw_ec_read_return {
u32 dword;
struct {
u8 data_low;
u8 data_high;
} bytes;
};
union uw_ec_write_return {
u32 dword;
struct {
u8 addr_low;
u8 addr_high;
u8 data_low;
u8 data_high;
} bytes;
};
2021-09-07 19:47:31 +02:00
#endif