GNU Linux-libre 4.4.289-gnu1
[releases.git] / drivers / hid / hid-roccat-isku.h
1 #ifndef __HID_ROCCAT_ISKU_H
2 #define __HID_ROCCAT_ISKU_H
3
4 /*
5  * Copyright (c) 2011 Stefan Achatz <erazor_de@users.sourceforge.net>
6  */
7
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.
13  */
14
15 #include <linux/types.h>
16
17 enum {
18         ISKU_SIZE_CONTROL = 0x03,
19         ISKU_SIZE_INFO = 0x06,
20         ISKU_SIZE_KEY_MASK = 0x06,
21         ISKU_SIZE_KEYS_FUNCTION = 0x29,
22         ISKU_SIZE_KEYS_EASYZONE = 0x41,
23         ISKU_SIZE_KEYS_MEDIA = 0x1d,
24         ISKU_SIZE_KEYS_THUMBSTER = 0x17,
25         ISKU_SIZE_KEYS_MACRO = 0x23,
26         ISKU_SIZE_KEYS_CAPSLOCK = 0x06,
27         ISKU_SIZE_LAST_SET = 0x14,
28         ISKU_SIZE_LIGHT = 0x10,
29         ISKU_SIZE_MACRO = 0x823,
30         ISKU_SIZE_RESET = 0x03,
31         ISKU_SIZE_TALK = 0x10,
32         ISKU_SIZE_TALKFX = 0x10,
33 };
34
35 enum {
36         ISKU_PROFILE_NUM = 5,
37         ISKU_USB_INTERFACE_PROTOCOL = 0,
38 };
39
40 struct isku_actual_profile {
41         uint8_t command; /* ISKU_COMMAND_ACTUAL_PROFILE */
42         uint8_t size; /* always 3 */
43         uint8_t actual_profile;
44 } __packed;
45
46 enum isku_commands {
47         ISKU_COMMAND_CONTROL = 0x4,
48         ISKU_COMMAND_ACTUAL_PROFILE = 0x5,
49         ISKU_COMMAND_KEY_MASK = 0x7,
50         ISKU_COMMAND_KEYS_FUNCTION = 0x8,
51         ISKU_COMMAND_KEYS_EASYZONE = 0x9,
52         ISKU_COMMAND_KEYS_MEDIA = 0xa,
53         ISKU_COMMAND_KEYS_THUMBSTER = 0xb,
54         ISKU_COMMAND_KEYS_MACRO = 0xd,
55         ISKU_COMMAND_MACRO = 0xe,
56         ISKU_COMMAND_INFO = 0xf,
57         ISKU_COMMAND_LIGHT = 0x10,
58         ISKU_COMMAND_RESET = 0x11,
59         ISKU_COMMAND_KEYS_CAPSLOCK = 0x13,
60         ISKU_COMMAND_LAST_SET = 0x14,
61         ISKU_COMMAND_15 = 0x15,
62         ISKU_COMMAND_TALK = 0x16,
63         ISKU_COMMAND_TALKFX = 0x17,
64         ISKU_COMMAND_FIRMWARE_WRITE = 0x1b,
65         ISKU_COMMAND_FIRMWARE_WRITE_CONTROL = 0x1c,
66 };
67
68 struct isku_report_button {
69         uint8_t number; /* ISKU_REPORT_NUMBER_BUTTON */
70         uint8_t zero;
71         uint8_t event;
72         uint8_t data1;
73         uint8_t data2;
74 };
75
76 enum isku_report_numbers {
77         ISKU_REPORT_NUMBER_BUTTON = 3,
78 };
79
80 enum isku_report_button_events {
81         ISKU_REPORT_BUTTON_EVENT_PROFILE = 0x2,
82 };
83
84 struct isku_roccat_report {
85         uint8_t event;
86         uint8_t data1;
87         uint8_t data2;
88         uint8_t profile;
89 } __packed;
90
91 struct isku_device {
92         int roccat_claimed;
93         int chrdev_minor;
94
95         struct mutex isku_lock;
96
97         int actual_profile;
98 };
99
100 #endif