xref: /openbmc/linux/drivers/hid/hid-roccat-isku.h (revision 75bf465f0bc33e9b776a46d6a1b9b990f5fb7c37)
1*2874c5fdSThomas Gleixner /* SPDX-License-Identifier: GPL-2.0-or-later */
2d41c2a70SStefan Achatz #ifndef __HID_ROCCAT_ISKU_H
3d41c2a70SStefan Achatz #define __HID_ROCCAT_ISKU_H
4d41c2a70SStefan Achatz 
5d41c2a70SStefan Achatz /*
6d41c2a70SStefan Achatz  * Copyright (c) 2011 Stefan Achatz <erazor_de@users.sourceforge.net>
7d41c2a70SStefan Achatz  */
8d41c2a70SStefan Achatz 
9d41c2a70SStefan Achatz /*
10d41c2a70SStefan Achatz  */
11d41c2a70SStefan Achatz 
12d41c2a70SStefan Achatz #include <linux/types.h>
13d41c2a70SStefan Achatz 
14d41c2a70SStefan Achatz enum {
156e5920ddSStefan Achatz 	ISKU_SIZE_CONTROL = 0x03,
166e5920ddSStefan Achatz 	ISKU_SIZE_INFO = 0x06,
176e5920ddSStefan Achatz 	ISKU_SIZE_KEY_MASK = 0x06,
186e5920ddSStefan Achatz 	ISKU_SIZE_KEYS_FUNCTION = 0x29,
196e5920ddSStefan Achatz 	ISKU_SIZE_KEYS_EASYZONE = 0x41,
206e5920ddSStefan Achatz 	ISKU_SIZE_KEYS_MEDIA = 0x1d,
216e5920ddSStefan Achatz 	ISKU_SIZE_KEYS_THUMBSTER = 0x17,
226e5920ddSStefan Achatz 	ISKU_SIZE_KEYS_MACRO = 0x23,
236e5920ddSStefan Achatz 	ISKU_SIZE_KEYS_CAPSLOCK = 0x06,
246e5920ddSStefan Achatz 	ISKU_SIZE_LAST_SET = 0x14,
25ce716965SStefan Achatz 	ISKU_SIZE_LIGHT = 0x10,
266e5920ddSStefan Achatz 	ISKU_SIZE_MACRO = 0x823,
27f1da71e1SStefan Achatz 	ISKU_SIZE_RESET = 0x03,
286e5920ddSStefan Achatz 	ISKU_SIZE_TALK = 0x10,
29ce716965SStefan Achatz 	ISKU_SIZE_TALKFX = 0x10,
306e5920ddSStefan Achatz };
316e5920ddSStefan Achatz 
326e5920ddSStefan Achatz enum {
33d41c2a70SStefan Achatz 	ISKU_PROFILE_NUM = 5,
34d41c2a70SStefan Achatz 	ISKU_USB_INTERFACE_PROTOCOL = 0,
35d41c2a70SStefan Achatz };
36d41c2a70SStefan Achatz 
37d41c2a70SStefan Achatz struct isku_actual_profile {
38d41c2a70SStefan Achatz 	uint8_t command; /* ISKU_COMMAND_ACTUAL_PROFILE */
39d41c2a70SStefan Achatz 	uint8_t size; /* always 3 */
40d41c2a70SStefan Achatz 	uint8_t actual_profile;
41d41c2a70SStefan Achatz } __packed;
42d41c2a70SStefan Achatz 
43d41c2a70SStefan Achatz enum isku_commands {
44d41c2a70SStefan Achatz 	ISKU_COMMAND_CONTROL = 0x4,
45d41c2a70SStefan Achatz 	ISKU_COMMAND_ACTUAL_PROFILE = 0x5,
46d41c2a70SStefan Achatz 	ISKU_COMMAND_KEY_MASK = 0x7,
47d41c2a70SStefan Achatz 	ISKU_COMMAND_KEYS_FUNCTION = 0x8,
48d41c2a70SStefan Achatz 	ISKU_COMMAND_KEYS_EASYZONE = 0x9,
49d41c2a70SStefan Achatz 	ISKU_COMMAND_KEYS_MEDIA = 0xa,
50d41c2a70SStefan Achatz 	ISKU_COMMAND_KEYS_THUMBSTER = 0xb,
51d41c2a70SStefan Achatz 	ISKU_COMMAND_KEYS_MACRO = 0xd,
52d41c2a70SStefan Achatz 	ISKU_COMMAND_MACRO = 0xe,
53d41c2a70SStefan Achatz 	ISKU_COMMAND_INFO = 0xf,
54d41c2a70SStefan Achatz 	ISKU_COMMAND_LIGHT = 0x10,
55f1da71e1SStefan Achatz 	ISKU_COMMAND_RESET = 0x11,
56d41c2a70SStefan Achatz 	ISKU_COMMAND_KEYS_CAPSLOCK = 0x13,
57d41c2a70SStefan Achatz 	ISKU_COMMAND_LAST_SET = 0x14,
58d41c2a70SStefan Achatz 	ISKU_COMMAND_15 = 0x15,
59d41c2a70SStefan Achatz 	ISKU_COMMAND_TALK = 0x16,
60ce716965SStefan Achatz 	ISKU_COMMAND_TALKFX = 0x17,
61d41c2a70SStefan Achatz 	ISKU_COMMAND_FIRMWARE_WRITE = 0x1b,
62d41c2a70SStefan Achatz 	ISKU_COMMAND_FIRMWARE_WRITE_CONTROL = 0x1c,
63d41c2a70SStefan Achatz };
64d41c2a70SStefan Achatz 
65d41c2a70SStefan Achatz struct isku_report_button {
66d41c2a70SStefan Achatz 	uint8_t number; /* ISKU_REPORT_NUMBER_BUTTON */
67d41c2a70SStefan Achatz 	uint8_t zero;
68d41c2a70SStefan Achatz 	uint8_t event;
69d41c2a70SStefan Achatz 	uint8_t data1;
70d41c2a70SStefan Achatz 	uint8_t data2;
71d41c2a70SStefan Achatz };
72d41c2a70SStefan Achatz 
73d41c2a70SStefan Achatz enum isku_report_numbers {
74d41c2a70SStefan Achatz 	ISKU_REPORT_NUMBER_BUTTON = 3,
75d41c2a70SStefan Achatz };
76d41c2a70SStefan Achatz 
77d41c2a70SStefan Achatz enum isku_report_button_events {
78d41c2a70SStefan Achatz 	ISKU_REPORT_BUTTON_EVENT_PROFILE = 0x2,
79d41c2a70SStefan Achatz };
80d41c2a70SStefan Achatz 
81d41c2a70SStefan Achatz struct isku_roccat_report {
82d41c2a70SStefan Achatz 	uint8_t event;
83d41c2a70SStefan Achatz 	uint8_t data1;
84d41c2a70SStefan Achatz 	uint8_t data2;
85d41c2a70SStefan Achatz 	uint8_t profile;
86d41c2a70SStefan Achatz } __packed;
87d41c2a70SStefan Achatz 
88d41c2a70SStefan Achatz struct isku_device {
89d41c2a70SStefan Achatz 	int roccat_claimed;
90d41c2a70SStefan Achatz 	int chrdev_minor;
91d41c2a70SStefan Achatz 
92d41c2a70SStefan Achatz 	struct mutex isku_lock;
93d41c2a70SStefan Achatz 
94d41c2a70SStefan Achatz 	int actual_profile;
95d41c2a70SStefan Achatz };
96d41c2a70SStefan Achatz 
97d41c2a70SStefan Achatz #endif
98