xref: /OK3568_Linux_fs/kernel/drivers/hid/hid-roccat-kovaplus.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: GPL-2.0-or-later */
2*4882a593Smuzhiyun #ifndef __HID_ROCCAT_KOVAPLUS_H
3*4882a593Smuzhiyun #define __HID_ROCCAT_KOVAPLUS_H
4*4882a593Smuzhiyun 
5*4882a593Smuzhiyun /*
6*4882a593Smuzhiyun  * Copyright (c) 2010 Stefan Achatz <erazor_de@users.sourceforge.net>
7*4882a593Smuzhiyun  */
8*4882a593Smuzhiyun 
9*4882a593Smuzhiyun /*
10*4882a593Smuzhiyun  */
11*4882a593Smuzhiyun 
12*4882a593Smuzhiyun #include <linux/types.h>
13*4882a593Smuzhiyun 
14*4882a593Smuzhiyun enum {
15*4882a593Smuzhiyun 	KOVAPLUS_SIZE_CONTROL = 0x03,
16*4882a593Smuzhiyun 	KOVAPLUS_SIZE_INFO = 0x06,
17*4882a593Smuzhiyun 	KOVAPLUS_SIZE_PROFILE_SETTINGS = 0x10,
18*4882a593Smuzhiyun 	KOVAPLUS_SIZE_PROFILE_BUTTONS = 0x17,
19*4882a593Smuzhiyun };
20*4882a593Smuzhiyun 
21*4882a593Smuzhiyun enum kovaplus_control_requests {
22*4882a593Smuzhiyun 	/* write; value = profile number range 0-4 */
23*4882a593Smuzhiyun 	KOVAPLUS_CONTROL_REQUEST_PROFILE_SETTINGS = 0x10,
24*4882a593Smuzhiyun 	/* write; value = profile number range 0-4 */
25*4882a593Smuzhiyun 	KOVAPLUS_CONTROL_REQUEST_PROFILE_BUTTONS = 0x20,
26*4882a593Smuzhiyun };
27*4882a593Smuzhiyun 
28*4882a593Smuzhiyun struct kovaplus_actual_profile {
29*4882a593Smuzhiyun 	uint8_t command; /* KOVAPLUS_COMMAND_ACTUAL_PROFILE */
30*4882a593Smuzhiyun 	uint8_t size; /* always 3 */
31*4882a593Smuzhiyun 	uint8_t actual_profile; /* Range 0-4! */
32*4882a593Smuzhiyun } __packed;
33*4882a593Smuzhiyun 
34*4882a593Smuzhiyun struct kovaplus_profile_settings {
35*4882a593Smuzhiyun 	uint8_t command; /* KOVAPLUS_COMMAND_PROFILE_SETTINGS */
36*4882a593Smuzhiyun 	uint8_t size; /* 16 */
37*4882a593Smuzhiyun 	uint8_t profile_index; /* range 0-4 */
38*4882a593Smuzhiyun 	uint8_t unknown1;
39*4882a593Smuzhiyun 	uint8_t sensitivity_x; /* range 1-10 */
40*4882a593Smuzhiyun 	uint8_t sensitivity_y; /* range 1-10 */
41*4882a593Smuzhiyun 	uint8_t cpi_levels_enabled;
42*4882a593Smuzhiyun 	uint8_t cpi_startup_level; /* range 1-4 */
43*4882a593Smuzhiyun 	uint8_t data[8];
44*4882a593Smuzhiyun } __packed;
45*4882a593Smuzhiyun 
46*4882a593Smuzhiyun struct kovaplus_profile_buttons {
47*4882a593Smuzhiyun 	uint8_t command; /* KOVAPLUS_COMMAND_PROFILE_BUTTONS */
48*4882a593Smuzhiyun 	uint8_t size; /* 23 */
49*4882a593Smuzhiyun 	uint8_t profile_index; /* range 0-4 */
50*4882a593Smuzhiyun 	uint8_t data[20];
51*4882a593Smuzhiyun } __packed;
52*4882a593Smuzhiyun 
53*4882a593Smuzhiyun struct kovaplus_info {
54*4882a593Smuzhiyun 	uint8_t command; /* KOVAPLUS_COMMAND_INFO */
55*4882a593Smuzhiyun 	uint8_t size; /* 6 */
56*4882a593Smuzhiyun 	uint8_t firmware_version;
57*4882a593Smuzhiyun 	uint8_t unknown[3];
58*4882a593Smuzhiyun } __packed;
59*4882a593Smuzhiyun 
60*4882a593Smuzhiyun enum kovaplus_commands {
61*4882a593Smuzhiyun 	KOVAPLUS_COMMAND_ACTUAL_PROFILE = 0x5,
62*4882a593Smuzhiyun 	KOVAPLUS_COMMAND_CONTROL = 0x4,
63*4882a593Smuzhiyun 	KOVAPLUS_COMMAND_PROFILE_SETTINGS = 0x6,
64*4882a593Smuzhiyun 	KOVAPLUS_COMMAND_PROFILE_BUTTONS = 0x7,
65*4882a593Smuzhiyun 	KOVAPLUS_COMMAND_INFO = 0x9,
66*4882a593Smuzhiyun 	KOVAPLUS_COMMAND_A = 0xa,
67*4882a593Smuzhiyun };
68*4882a593Smuzhiyun 
69*4882a593Smuzhiyun enum kovaplus_mouse_report_numbers {
70*4882a593Smuzhiyun 	KOVAPLUS_MOUSE_REPORT_NUMBER_MOUSE = 1,
71*4882a593Smuzhiyun 	KOVAPLUS_MOUSE_REPORT_NUMBER_AUDIO = 2,
72*4882a593Smuzhiyun 	KOVAPLUS_MOUSE_REPORT_NUMBER_BUTTON = 3,
73*4882a593Smuzhiyun 	KOVAPLUS_MOUSE_REPORT_NUMBER_KBD = 4,
74*4882a593Smuzhiyun };
75*4882a593Smuzhiyun 
76*4882a593Smuzhiyun struct kovaplus_mouse_report_button {
77*4882a593Smuzhiyun 	uint8_t report_number; /* KOVAPLUS_MOUSE_REPORT_NUMBER_BUTTON */
78*4882a593Smuzhiyun 	uint8_t unknown1;
79*4882a593Smuzhiyun 	uint8_t type;
80*4882a593Smuzhiyun 	uint8_t data1;
81*4882a593Smuzhiyun 	uint8_t data2;
82*4882a593Smuzhiyun } __packed;
83*4882a593Smuzhiyun 
84*4882a593Smuzhiyun enum kovaplus_mouse_report_button_types {
85*4882a593Smuzhiyun 	/* data1 = profile_number range 1-5; no release event */
86*4882a593Smuzhiyun 	KOVAPLUS_MOUSE_REPORT_BUTTON_TYPE_PROFILE_1 = 0x20,
87*4882a593Smuzhiyun 	/* data1 = profile_number range 1-5; no release event */
88*4882a593Smuzhiyun 	KOVAPLUS_MOUSE_REPORT_BUTTON_TYPE_PROFILE_2 = 0x30,
89*4882a593Smuzhiyun 	/* data1 = button_number range 1-18; data2 = action */
90*4882a593Smuzhiyun 	KOVAPLUS_MOUSE_REPORT_BUTTON_TYPE_MACRO = 0x40,
91*4882a593Smuzhiyun 	/* data1 = button_number range 1-18; data2 = action */
92*4882a593Smuzhiyun 	KOVAPLUS_MOUSE_REPORT_BUTTON_TYPE_SHORTCUT = 0x50,
93*4882a593Smuzhiyun 	/* data1 = button_number range 1-18; data2 = action */
94*4882a593Smuzhiyun 	KOVAPLUS_MOUSE_REPORT_BUTTON_TYPE_QUICKLAUNCH = 0x60,
95*4882a593Smuzhiyun 	/* data1 = button_number range 1-18; data2 = action */
96*4882a593Smuzhiyun 	KOVAPLUS_MOUSE_REPORT_BUTTON_TYPE_TIMER = 0x80,
97*4882a593Smuzhiyun 	/* data1 = 1 = 400, 2 = 800, 4 = 1600, 7 = 3200; no release event */
98*4882a593Smuzhiyun 	KOVAPLUS_MOUSE_REPORT_BUTTON_TYPE_CPI = 0xb0,
99*4882a593Smuzhiyun 	/* data1 + data2 = sense range 1-10; no release event */
100*4882a593Smuzhiyun 	KOVAPLUS_MOUSE_REPORT_BUTTON_TYPE_SENSITIVITY = 0xc0,
101*4882a593Smuzhiyun 	/* data1 = type as in profile_buttons; data2 = action */
102*4882a593Smuzhiyun 	KOVAPLUS_MOUSE_REPORT_BUTTON_TYPE_MULTIMEDIA = 0xf0,
103*4882a593Smuzhiyun };
104*4882a593Smuzhiyun 
105*4882a593Smuzhiyun enum kovaplus_mouse_report_button_actions {
106*4882a593Smuzhiyun 	KOVAPLUS_MOUSE_REPORT_BUTTON_ACTION_PRESS = 0,
107*4882a593Smuzhiyun 	KOVAPLUS_MOUSE_REPORT_BUTTON_ACTION_RELEASE = 1,
108*4882a593Smuzhiyun };
109*4882a593Smuzhiyun 
110*4882a593Smuzhiyun struct kovaplus_roccat_report {
111*4882a593Smuzhiyun 	uint8_t type;
112*4882a593Smuzhiyun 	uint8_t profile;
113*4882a593Smuzhiyun 	uint8_t button;
114*4882a593Smuzhiyun 	uint8_t data1;
115*4882a593Smuzhiyun 	uint8_t data2;
116*4882a593Smuzhiyun } __packed;
117*4882a593Smuzhiyun 
118*4882a593Smuzhiyun struct kovaplus_device {
119*4882a593Smuzhiyun 	int actual_profile;
120*4882a593Smuzhiyun 	int actual_cpi;
121*4882a593Smuzhiyun 	int actual_x_sensitivity;
122*4882a593Smuzhiyun 	int actual_y_sensitivity;
123*4882a593Smuzhiyun 	int roccat_claimed;
124*4882a593Smuzhiyun 	int chrdev_minor;
125*4882a593Smuzhiyun 	struct mutex kovaplus_lock;
126*4882a593Smuzhiyun 	struct kovaplus_profile_settings profile_settings[5];
127*4882a593Smuzhiyun 	struct kovaplus_profile_buttons profile_buttons[5];
128*4882a593Smuzhiyun };
129*4882a593Smuzhiyun 
130*4882a593Smuzhiyun #endif
131