ARM: 7409/1: Do not call flush_cache_user_range with mmap_sem held
[linux/fpc-iii.git] / drivers / hid / hid-roccat-koneplus.h
blobc57a376ab8aed31cea2580bafd47ef4fe4f9749c
1 #ifndef __HID_ROCCAT_KONEPLUS_H
2 #define __HID_ROCCAT_KONEPLUS_H
4 /*
5 * Copyright (c) 2010 Stefan Achatz <erazor_de@users.sourceforge.net>
6 */
8 /*
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the Free
11 * Software Foundation; either version 2 of the License, or (at your option)
12 * any later version.
15 #include <linux/types.h>
18 * case 1: writes request 80 and reads value 1
21 struct koneplus_control {
22 uint8_t command; /* KONEPLUS_COMMAND_CONTROL */
24 * value is profile number in range 0-4 for requesting settings and buttons
25 * 1 if status ok for requesting status
27 uint8_t value;
28 uint8_t request;
29 } __attribute__ ((__packed__));
31 enum koneplus_control_requests {
32 KONEPLUS_CONTROL_REQUEST_STATUS = 0x00,
33 KONEPLUS_CONTROL_REQUEST_PROFILE_SETTINGS = 0x80,
34 KONEPLUS_CONTROL_REQUEST_PROFILE_BUTTONS = 0x90,
37 enum koneplus_control_values {
38 KONEPLUS_CONTROL_REQUEST_STATUS_OVERLOAD = 0,
39 KONEPLUS_CONTROL_REQUEST_STATUS_OK = 1,
40 KONEPLUS_CONTROL_REQUEST_STATUS_WAIT = 3,
43 struct koneplus_actual_profile {
44 uint8_t command; /* KONEPLUS_COMMAND_ACTUAL_PROFILE */
45 uint8_t size; /* always 3 */
46 uint8_t actual_profile; /* Range 0-4! */
47 } __attribute__ ((__packed__));
49 struct koneplus_profile_settings {
50 uint8_t command; /* KONEPLUS_COMMAND_PROFILE_SETTINGS */
51 uint8_t size; /* always 43 */
52 uint8_t number; /* range 0-4 */
53 uint8_t advanced_sensitivity;
54 uint8_t sensitivity_x;
55 uint8_t sensitivity_y;
56 uint8_t cpi_levels_enabled;
57 uint8_t cpi_levels_x[5];
58 uint8_t cpi_startup_level; /* range 0-4 */
59 uint8_t cpi_levels_y[5]; /* range 1-60 means 100-6000 cpi */
60 uint8_t unknown1;
61 uint8_t polling_rate;
62 uint8_t lights_enabled;
63 uint8_t light_effect_mode;
64 uint8_t color_flow_effect;
65 uint8_t light_effect_type;
66 uint8_t light_effect_speed;
67 uint8_t lights[16];
68 uint16_t checksum;
69 } __attribute__ ((__packed__));
71 struct koneplus_profile_buttons {
72 uint8_t command; /* KONEPLUS_COMMAND_PROFILE_BUTTONS */
73 uint8_t size; /* always 77 */
74 uint8_t number; /* range 0-4 */
75 uint8_t data[72];
76 uint16_t checksum;
77 } __attribute__ ((__packed__));
79 struct koneplus_macro {
80 uint8_t command; /* KONEPLUS_COMMAND_MACRO */
81 uint16_t size; /* always 0x822 little endian */
82 uint8_t profile; /* range 0-4 */
83 uint8_t button; /* range 0-23 */
84 uint8_t data[2075];
85 uint16_t checksum;
86 } __attribute__ ((__packed__));
88 struct koneplus_info {
89 uint8_t command; /* KONEPLUS_COMMAND_INFO */
90 uint8_t size; /* always 6 */
91 uint8_t firmware_version;
92 uint8_t unknown[3];
93 } __attribute__ ((__packed__));
95 struct koneplus_e {
96 uint8_t command; /* KONEPLUS_COMMAND_E */
97 uint8_t size; /* always 3 */
98 uint8_t unknown; /* TODO 1; 0 before firmware update */
99 } __attribute__ ((__packed__));
101 struct koneplus_sensor {
102 uint8_t command; /* KONEPLUS_COMMAND_SENSOR */
103 uint8_t size; /* always 6 */
104 uint8_t data[4];
105 } __attribute__ ((__packed__));
107 struct koneplus_firmware_write {
108 uint8_t command; /* KONEPLUS_COMMAND_FIRMWARE_WRITE */
109 uint8_t unknown[1025];
110 } __attribute__ ((__packed__));
112 struct koneplus_firmware_write_control {
113 uint8_t command; /* KONEPLUS_COMMAND_FIRMWARE_WRITE_CONTROL */
115 * value is 1 on success
116 * 3 means "not finished yet"
118 uint8_t value;
119 uint8_t unknown; /* always 0x75 */
120 } __attribute__ ((__packed__));
122 struct koneplus_tcu {
123 uint16_t usb_command; /* KONEPLUS_USB_COMMAND_TCU */
124 uint8_t data[2];
125 } __attribute__ ((__packed__));
127 struct koneplus_tcu_image {
128 uint16_t usb_command; /* KONEPLUS_USB_COMMAND_TCU */
129 uint8_t data[1024];
130 uint16_t checksum;
131 } __attribute__ ((__packed__));
133 enum koneplus_commands {
134 KONEPLUS_COMMAND_CONTROL = 0x4,
135 KONEPLUS_COMMAND_ACTUAL_PROFILE = 0x5,
136 KONEPLUS_COMMAND_PROFILE_SETTINGS = 0x6,
137 KONEPLUS_COMMAND_PROFILE_BUTTONS = 0x7,
138 KONEPLUS_COMMAND_MACRO = 0x8,
139 KONEPLUS_COMMAND_INFO = 0x9,
140 KONEPLUS_COMMAND_E = 0xe,
141 KONEPLUS_COMMAND_SENSOR = 0xf,
142 KONEPLUS_COMMAND_FIRMWARE_WRITE = 0x1b,
143 KONEPLUS_COMMAND_FIRMWARE_WRITE_CONTROL = 0x1c,
146 enum koneplus_usb_commands {
147 KONEPLUS_USB_COMMAND_CONTROL = 0x304,
148 KONEPLUS_USB_COMMAND_ACTUAL_PROFILE = 0x305,
149 KONEPLUS_USB_COMMAND_PROFILE_SETTINGS = 0x306,
150 KONEPLUS_USB_COMMAND_PROFILE_BUTTONS = 0x307,
151 KONEPLUS_USB_COMMAND_MACRO = 0x308,
152 KONEPLUS_USB_COMMAND_INFO = 0x309,
153 KONEPLUS_USB_COMMAND_TCU = 0x30c,
154 KONEPLUS_USB_COMMAND_E = 0x30e,
155 KONEPLUS_USB_COMMAND_SENSOR = 0x30f,
156 KONEPLUS_USB_COMMAND_FIRMWARE_WRITE = 0x31b,
157 KONEPLUS_USB_COMMAND_FIRMWARE_WRITE_CONTROL = 0x31c,
160 enum koneplus_mouse_report_numbers {
161 KONEPLUS_MOUSE_REPORT_NUMBER_HID = 1,
162 KONEPLUS_MOUSE_REPORT_NUMBER_AUDIO = 2,
163 KONEPLUS_MOUSE_REPORT_NUMBER_BUTTON = 3,
166 struct koneplus_mouse_report_button {
167 uint8_t report_number; /* always KONEPLUS_MOUSE_REPORT_NUMBER_BUTTON */
168 uint8_t zero1;
169 uint8_t type;
170 uint8_t data1;
171 uint8_t data2;
172 uint8_t zero2;
173 uint8_t unknown[2];
174 } __attribute__ ((__packed__));
176 enum koneplus_mouse_report_button_types {
177 /* data1 = new profile range 1-5 */
178 KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_PROFILE = 0x20,
180 /* data1 = button number range 1-24; data2 = action */
181 KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_QUICKLAUNCH = 0x60,
183 /* data1 = button number range 1-24; data2 = action */
184 KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_TIMER = 0x80,
186 /* data1 = setting number range 1-5 */
187 KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_CPI = 0xb0,
189 /* data1 and data2 = range 0x1-0xb */
190 KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_SENSITIVITY = 0xc0,
192 /* data1 = 22 = next track...
193 * data2 = action
195 KONEPLUS_MOUSE_REPORT_BUTTON_TYPE_MULTIMEDIA = 0xf0,
198 enum koneplus_mouse_report_button_action {
199 KONEPLUS_MOUSE_REPORT_BUTTON_ACTION_PRESS = 0,
200 KONEPLUS_MOUSE_REPORT_BUTTON_ACTION_RELEASE = 1,
203 struct koneplus_roccat_report {
204 uint8_t type;
205 uint8_t data1;
206 uint8_t data2;
207 uint8_t profile;
208 } __attribute__ ((__packed__));
210 struct koneplus_device {
211 int actual_profile;
213 int roccat_claimed;
214 int chrdev_minor;
216 struct mutex koneplus_lock;
218 struct koneplus_info info;
219 struct koneplus_profile_settings profile_settings[5];
220 struct koneplus_profile_buttons profile_buttons[5];
223 #endif