diff options
-rw-r--r-- | Documentation/ABI/testing/sysfs-driver-hid-lenovo (renamed from Documentation/ABI/testing/sysfs-driver-hid-lenovo-tpkbd) | 0 | ||||
-rw-r--r-- | drivers/hid/Kconfig | 14 | ||||
-rw-r--r-- | drivers/hid/Makefile | 2 | ||||
-rw-r--r-- | drivers/hid/hid-core.c | 2 | ||||
-rw-r--r-- | drivers/hid/hid-lenovo.c (renamed from drivers/hid/hid-lenovo-tpkbd.c) | 185 |
5 files changed, 102 insertions, 101 deletions
diff --git a/Documentation/ABI/testing/sysfs-driver-hid-lenovo-tpkbd b/Documentation/ABI/testing/sysfs-driver-hid-lenovo index 57b92cbdceae..57b92cbdceae 100644 --- a/Documentation/ABI/testing/sysfs-driver-hid-lenovo-tpkbd +++ b/Documentation/ABI/testing/sysfs-driver-hid-lenovo | |||
diff --git a/drivers/hid/Kconfig b/drivers/hid/Kconfig index 5e79c6ad914f..687d7a1b6bed 100644 --- a/drivers/hid/Kconfig +++ b/drivers/hid/Kconfig | |||
@@ -331,18 +331,18 @@ config HID_LCPOWER | |||
331 | ---help--- | 331 | ---help--- |
332 | Support for LC-Power RC1000MCE RF remote control. | 332 | Support for LC-Power RC1000MCE RF remote control. |
333 | 333 | ||
334 | config HID_LENOVO_TPKBD | 334 | config HID_LENOVO |
335 | tristate "Lenovo ThinkPad USB Keyboard with TrackPoint" | 335 | tristate "Lenovo / Thinkpad devices" |
336 | depends on HID | 336 | depends on HID |
337 | select NEW_LEDS | 337 | select NEW_LEDS |
338 | select LEDS_CLASS | 338 | select LEDS_CLASS |
339 | ---help--- | 339 | ---help--- |
340 | Support for the Lenovo ThinkPad USB Keyboard with TrackPoint. | 340 | Support for Lenovo devices that are not fully compliant with HID standard. |
341 | 341 | ||
342 | Say Y here if you have a Lenovo ThinkPad USB Keyboard with TrackPoint | 342 | Say Y if you want support for the non-compliant features of the Lenovo |
343 | and would like to use device-specific features like changing the | 343 | Thinkpad standalone keyboards, e.g: |
344 | sensitivity of the trackpoint, using the microphone mute button or | 344 | - ThinkPad USB Keyboard with TrackPoint (supports extra LEDs and trackpoint |
345 | controlling the mute and microphone mute LEDs. | 345 | configuration) |
346 | 346 | ||
347 | config HID_LOGITECH | 347 | config HID_LOGITECH |
348 | tristate "Logitech devices" if EXPERT | 348 | tristate "Logitech devices" if EXPERT |
diff --git a/drivers/hid/Makefile b/drivers/hid/Makefile index a6fa6baf368e..5e96be3ab280 100644 --- a/drivers/hid/Makefile +++ b/drivers/hid/Makefile | |||
@@ -59,7 +59,7 @@ obj-$(CONFIG_HID_KENSINGTON) += hid-kensington.o | |||
59 | obj-$(CONFIG_HID_KEYTOUCH) += hid-keytouch.o | 59 | obj-$(CONFIG_HID_KEYTOUCH) += hid-keytouch.o |
60 | obj-$(CONFIG_HID_KYE) += hid-kye.o | 60 | obj-$(CONFIG_HID_KYE) += hid-kye.o |
61 | obj-$(CONFIG_HID_LCPOWER) += hid-lcpower.o | 61 | obj-$(CONFIG_HID_LCPOWER) += hid-lcpower.o |
62 | obj-$(CONFIG_HID_LENOVO_TPKBD) += hid-lenovo-tpkbd.o | 62 | obj-$(CONFIG_HID_LENOVO) += hid-lenovo.o |
63 | obj-$(CONFIG_HID_LOGITECH) += hid-logitech.o | 63 | obj-$(CONFIG_HID_LOGITECH) += hid-logitech.o |
64 | obj-$(CONFIG_HID_LOGITECH_DJ) += hid-logitech-dj.o | 64 | obj-$(CONFIG_HID_LOGITECH_DJ) += hid-logitech-dj.o |
65 | obj-$(CONFIG_HID_MAGICMOUSE) += hid-magicmouse.o | 65 | obj-$(CONFIG_HID_MAGICMOUSE) += hid-magicmouse.o |
diff --git a/drivers/hid/hid-core.c b/drivers/hid/hid-core.c index 8ed66fd1ea87..55841bd5b461 100644 --- a/drivers/hid/hid-core.c +++ b/drivers/hid/hid-core.c | |||
@@ -1796,7 +1796,7 @@ static const struct hid_device_id hid_have_special_driver[] = { | |||
1796 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_M610X) }, | 1796 | { HID_USB_DEVICE(USB_VENDOR_ID_KYE, USB_DEVICE_ID_KYE_EASYPEN_M610X) }, |
1797 | { HID_USB_DEVICE(USB_VENDOR_ID_LABTEC, USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD) }, | 1797 | { HID_USB_DEVICE(USB_VENDOR_ID_LABTEC, USB_DEVICE_ID_LABTEC_WIRELESS_KEYBOARD) }, |
1798 | { HID_USB_DEVICE(USB_VENDOR_ID_LCPOWER, USB_DEVICE_ID_LCPOWER_LC1000 ) }, | 1798 | { HID_USB_DEVICE(USB_VENDOR_ID_LCPOWER, USB_DEVICE_ID_LCPOWER_LC1000 ) }, |
1799 | #if IS_ENABLED(CONFIG_HID_LENOVO_TPKBD) | 1799 | #if IS_ENABLED(CONFIG_HID_LENOVO) |
1800 | { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_TPKBD) }, | 1800 | { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_TPKBD) }, |
1801 | #endif | 1801 | #endif |
1802 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_MX3000_RECEIVER) }, | 1802 | { HID_USB_DEVICE(USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_MX3000_RECEIVER) }, |
diff --git a/drivers/hid/hid-lenovo-tpkbd.c b/drivers/hid/hid-lenovo.c index 2d25b6cbbc05..0320b96ddf24 100644 --- a/drivers/hid/hid-lenovo-tpkbd.c +++ b/drivers/hid/hid-lenovo.c | |||
@@ -20,8 +20,7 @@ | |||
20 | 20 | ||
21 | #include "hid-ids.h" | 21 | #include "hid-ids.h" |
22 | 22 | ||
23 | /* This is only used for the trackpoint part of the driver, hence _tp */ | 23 | struct lenovo_drvdata_tpkbd { |
24 | struct tpkbd_data_pointer { | ||
25 | int led_state; | 24 | int led_state; |
26 | struct led_classdev led_mute; | 25 | struct led_classdev led_mute; |
27 | struct led_classdev led_micmute; | 26 | struct led_classdev led_micmute; |
@@ -35,7 +34,7 @@ struct tpkbd_data_pointer { | |||
35 | 34 | ||
36 | #define map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, EV_KEY, (c)) | 35 | #define map_key_clear(c) hid_map_usage_clear(hi, usage, bit, max, EV_KEY, (c)) |
37 | 36 | ||
38 | static int tpkbd_input_mapping(struct hid_device *hdev, | 37 | static int lenovo_input_mapping_tpkbd(struct hid_device *hdev, |
39 | struct hid_input *hi, struct hid_field *field, | 38 | struct hid_input *hi, struct hid_field *field, |
40 | struct hid_usage *usage, unsigned long **bit, int *max) | 39 | struct hid_usage *usage, unsigned long **bit, int *max) |
41 | { | 40 | { |
@@ -50,10 +49,10 @@ static int tpkbd_input_mapping(struct hid_device *hdev, | |||
50 | 49 | ||
51 | #undef map_key_clear | 50 | #undef map_key_clear |
52 | 51 | ||
53 | static int tpkbd_features_set(struct hid_device *hdev) | 52 | static int lenovo_features_set_tpkbd(struct hid_device *hdev) |
54 | { | 53 | { |
55 | struct hid_report *report; | 54 | struct hid_report *report; |
56 | struct tpkbd_data_pointer *data_pointer = hid_get_drvdata(hdev); | 55 | struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); |
57 | 56 | ||
58 | report = hdev->report_enum[HID_FEATURE_REPORT].report_id_hash[4]; | 57 | report = hdev->report_enum[HID_FEATURE_REPORT].report_id_hash[4]; |
59 | 58 | ||
@@ -69,23 +68,23 @@ static int tpkbd_features_set(struct hid_device *hdev) | |||
69 | return 0; | 68 | return 0; |
70 | } | 69 | } |
71 | 70 | ||
72 | static ssize_t pointer_press_to_select_show(struct device *dev, | 71 | static ssize_t attr_press_to_select_show_tpkbd(struct device *dev, |
73 | struct device_attribute *attr, | 72 | struct device_attribute *attr, |
74 | char *buf) | 73 | char *buf) |
75 | { | 74 | { |
76 | struct hid_device *hdev = container_of(dev, struct hid_device, dev); | 75 | struct hid_device *hdev = container_of(dev, struct hid_device, dev); |
77 | struct tpkbd_data_pointer *data_pointer = hid_get_drvdata(hdev); | 76 | struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); |
78 | 77 | ||
79 | return snprintf(buf, PAGE_SIZE, "%u\n", data_pointer->press_to_select); | 78 | return snprintf(buf, PAGE_SIZE, "%u\n", data_pointer->press_to_select); |
80 | } | 79 | } |
81 | 80 | ||
82 | static ssize_t pointer_press_to_select_store(struct device *dev, | 81 | static ssize_t attr_press_to_select_store_tpkbd(struct device *dev, |
83 | struct device_attribute *attr, | 82 | struct device_attribute *attr, |
84 | const char *buf, | 83 | const char *buf, |
85 | size_t count) | 84 | size_t count) |
86 | { | 85 | { |
87 | struct hid_device *hdev = container_of(dev, struct hid_device, dev); | 86 | struct hid_device *hdev = container_of(dev, struct hid_device, dev); |
88 | struct tpkbd_data_pointer *data_pointer = hid_get_drvdata(hdev); | 87 | struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); |
89 | int value; | 88 | int value; |
90 | 89 | ||
91 | if (kstrtoint(buf, 10, &value)) | 90 | if (kstrtoint(buf, 10, &value)) |
@@ -94,28 +93,28 @@ static ssize_t pointer_press_to_select_store(struct device *dev, | |||
94 | return -EINVAL; | 93 | return -EINVAL; |
95 | 94 | ||
96 | data_pointer->press_to_select = value; | 95 | data_pointer->press_to_select = value; |
97 | tpkbd_features_set(hdev); | 96 | lenovo_features_set_tpkbd(hdev); |
98 | 97 | ||
99 | return count; | 98 | return count; |
100 | } | 99 | } |
101 | 100 | ||
102 | static ssize_t pointer_dragging_show(struct device *dev, | 101 | static ssize_t attr_dragging_show_tpkbd(struct device *dev, |
103 | struct device_attribute *attr, | 102 | struct device_attribute *attr, |
104 | char *buf) | 103 | char *buf) |
105 | { | 104 | { |
106 | struct hid_device *hdev = container_of(dev, struct hid_device, dev); | 105 | struct hid_device *hdev = container_of(dev, struct hid_device, dev); |
107 | struct tpkbd_data_pointer *data_pointer = hid_get_drvdata(hdev); | 106 | struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); |
108 | 107 | ||
109 | return snprintf(buf, PAGE_SIZE, "%u\n", data_pointer->dragging); | 108 | return snprintf(buf, PAGE_SIZE, "%u\n", data_pointer->dragging); |
110 | } | 109 | } |
111 | 110 | ||
112 | static ssize_t pointer_dragging_store(struct device *dev, | 111 | static ssize_t attr_dragging_store_tpkbd(struct device *dev, |
113 | struct device_attribute *attr, | 112 | struct device_attribute *attr, |
114 | const char *buf, | 113 | const char *buf, |
115 | size_t count) | 114 | size_t count) |
116 | { | 115 | { |
117 | struct hid_device *hdev = container_of(dev, struct hid_device, dev); | 116 | struct hid_device *hdev = container_of(dev, struct hid_device, dev); |
118 | struct tpkbd_data_pointer *data_pointer = hid_get_drvdata(hdev); | 117 | struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); |
119 | int value; | 118 | int value; |
120 | 119 | ||
121 | if (kstrtoint(buf, 10, &value)) | 120 | if (kstrtoint(buf, 10, &value)) |
@@ -124,28 +123,28 @@ static ssize_t pointer_dragging_store(struct device *dev, | |||
124 | return -EINVAL; | 123 | return -EINVAL; |
125 | 124 | ||
126 | data_pointer->dragging = value; | 125 | data_pointer->dragging = value; |
127 | tpkbd_features_set(hdev); | 126 | lenovo_features_set_tpkbd(hdev); |
128 | 127 | ||
129 | return count; | 128 | return count; |
130 | } | 129 | } |
131 | 130 | ||
132 | static ssize_t pointer_release_to_select_show(struct device *dev, | 131 | static ssize_t attr_release_to_select_show_tpkbd(struct device *dev, |
133 | struct device_attribute *attr, | 132 | struct device_attribute *attr, |
134 | char *buf) | 133 | char *buf) |
135 | { | 134 | { |
136 | struct hid_device *hdev = container_of(dev, struct hid_device, dev); | 135 | struct hid_device *hdev = container_of(dev, struct hid_device, dev); |
137 | struct tpkbd_data_pointer *data_pointer = hid_get_drvdata(hdev); | 136 | struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); |
138 | 137 | ||
139 | return snprintf(buf, PAGE_SIZE, "%u\n", data_pointer->release_to_select); | 138 | return snprintf(buf, PAGE_SIZE, "%u\n", data_pointer->release_to_select); |
140 | } | 139 | } |
141 | 140 | ||
142 | static ssize_t pointer_release_to_select_store(struct device *dev, | 141 | static ssize_t attr_release_to_select_store_tpkbd(struct device *dev, |
143 | struct device_attribute *attr, | 142 | struct device_attribute *attr, |
144 | const char *buf, | 143 | const char *buf, |
145 | size_t count) | 144 | size_t count) |
146 | { | 145 | { |
147 | struct hid_device *hdev = container_of(dev, struct hid_device, dev); | 146 | struct hid_device *hdev = container_of(dev, struct hid_device, dev); |
148 | struct tpkbd_data_pointer *data_pointer = hid_get_drvdata(hdev); | 147 | struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); |
149 | int value; | 148 | int value; |
150 | 149 | ||
151 | if (kstrtoint(buf, 10, &value)) | 150 | if (kstrtoint(buf, 10, &value)) |
@@ -154,28 +153,28 @@ static ssize_t pointer_release_to_select_store(struct device *dev, | |||
154 | return -EINVAL; | 153 | return -EINVAL; |
155 | 154 | ||
156 | data_pointer->release_to_select = value; | 155 | data_pointer->release_to_select = value; |
157 | tpkbd_features_set(hdev); | 156 | lenovo_features_set_tpkbd(hdev); |
158 | 157 | ||
159 | return count; | 158 | return count; |
160 | } | 159 | } |
161 | 160 | ||
162 | static ssize_t pointer_select_right_show(struct device *dev, | 161 | static ssize_t attr_select_right_show_tpkbd(struct device *dev, |
163 | struct device_attribute *attr, | 162 | struct device_attribute *attr, |
164 | char *buf) | 163 | char *buf) |
165 | { | 164 | { |
166 | struct hid_device *hdev = container_of(dev, struct hid_device, dev); | 165 | struct hid_device *hdev = container_of(dev, struct hid_device, dev); |
167 | struct tpkbd_data_pointer *data_pointer = hid_get_drvdata(hdev); | 166 | struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); |
168 | 167 | ||
169 | return snprintf(buf, PAGE_SIZE, "%u\n", data_pointer->select_right); | 168 | return snprintf(buf, PAGE_SIZE, "%u\n", data_pointer->select_right); |
170 | } | 169 | } |
171 | 170 | ||
172 | static ssize_t pointer_select_right_store(struct device *dev, | 171 | static ssize_t attr_select_right_store_tpkbd(struct device *dev, |
173 | struct device_attribute *attr, | 172 | struct device_attribute *attr, |
174 | const char *buf, | 173 | const char *buf, |
175 | size_t count) | 174 | size_t count) |
176 | { | 175 | { |
177 | struct hid_device *hdev = container_of(dev, struct hid_device, dev); | 176 | struct hid_device *hdev = container_of(dev, struct hid_device, dev); |
178 | struct tpkbd_data_pointer *data_pointer = hid_get_drvdata(hdev); | 177 | struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); |
179 | int value; | 178 | int value; |
180 | 179 | ||
181 | if (kstrtoint(buf, 10, &value)) | 180 | if (kstrtoint(buf, 10, &value)) |
@@ -184,119 +183,119 @@ static ssize_t pointer_select_right_store(struct device *dev, | |||
184 | return -EINVAL; | 183 | return -EINVAL; |
185 | 184 | ||
186 | data_pointer->select_right = value; | 185 | data_pointer->select_right = value; |
187 | tpkbd_features_set(hdev); | 186 | lenovo_features_set_tpkbd(hdev); |
188 | 187 | ||
189 | return count; | 188 | return count; |
190 | } | 189 | } |
191 | 190 | ||
192 | static ssize_t pointer_sensitivity_show(struct device *dev, | 191 | static ssize_t attr_sensitivity_show_tpkbd(struct device *dev, |
193 | struct device_attribute *attr, | 192 | struct device_attribute *attr, |
194 | char *buf) | 193 | char *buf) |
195 | { | 194 | { |
196 | struct hid_device *hdev = container_of(dev, struct hid_device, dev); | 195 | struct hid_device *hdev = container_of(dev, struct hid_device, dev); |
197 | struct tpkbd_data_pointer *data_pointer = hid_get_drvdata(hdev); | 196 | struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); |
198 | 197 | ||
199 | return snprintf(buf, PAGE_SIZE, "%u\n", | 198 | return snprintf(buf, PAGE_SIZE, "%u\n", |
200 | data_pointer->sensitivity); | 199 | data_pointer->sensitivity); |
201 | } | 200 | } |
202 | 201 | ||
203 | static ssize_t pointer_sensitivity_store(struct device *dev, | 202 | static ssize_t attr_sensitivity_store_tpkbd(struct device *dev, |
204 | struct device_attribute *attr, | 203 | struct device_attribute *attr, |
205 | const char *buf, | 204 | const char *buf, |
206 | size_t count) | 205 | size_t count) |
207 | { | 206 | { |
208 | struct hid_device *hdev = container_of(dev, struct hid_device, dev); | 207 | struct hid_device *hdev = container_of(dev, struct hid_device, dev); |
209 | struct tpkbd_data_pointer *data_pointer = hid_get_drvdata(hdev); | 208 | struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); |
210 | int value; | 209 | int value; |
211 | 210 | ||
212 | if (kstrtoint(buf, 10, &value) || value < 1 || value > 255) | 211 | if (kstrtoint(buf, 10, &value) || value < 1 || value > 255) |
213 | return -EINVAL; | 212 | return -EINVAL; |
214 | 213 | ||
215 | data_pointer->sensitivity = value; | 214 | data_pointer->sensitivity = value; |
216 | tpkbd_features_set(hdev); | 215 | lenovo_features_set_tpkbd(hdev); |
217 | 216 | ||
218 | return count; | 217 | return count; |
219 | } | 218 | } |
220 | 219 | ||
221 | static ssize_t pointer_press_speed_show(struct device *dev, | 220 | static ssize_t attr_press_speed_show_tpkbd(struct device *dev, |
222 | struct device_attribute *attr, | 221 | struct device_attribute *attr, |
223 | char *buf) | 222 | char *buf) |
224 | { | 223 | { |
225 | struct hid_device *hdev = container_of(dev, struct hid_device, dev); | 224 | struct hid_device *hdev = container_of(dev, struct hid_device, dev); |
226 | struct tpkbd_data_pointer *data_pointer = hid_get_drvdata(hdev); | 225 | struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); |
227 | 226 | ||
228 | return snprintf(buf, PAGE_SIZE, "%u\n", | 227 | return snprintf(buf, PAGE_SIZE, "%u\n", |
229 | data_pointer->press_speed); | 228 | data_pointer->press_speed); |
230 | } | 229 | } |
231 | 230 | ||
232 | static ssize_t pointer_press_speed_store(struct device *dev, | 231 | static ssize_t attr_press_speed_store_tpkbd(struct device *dev, |
233 | struct device_attribute *attr, | 232 | struct device_attribute *attr, |
234 | const char *buf, | 233 | const char *buf, |
235 | size_t count) | 234 | size_t count) |
236 | { | 235 | { |
237 | struct hid_device *hdev = container_of(dev, struct hid_device, dev); | 236 | struct hid_device *hdev = container_of(dev, struct hid_device, dev); |
238 | struct tpkbd_data_pointer *data_pointer = hid_get_drvdata(hdev); | 237 | struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); |
239 | int value; | 238 | int value; |
240 | 239 | ||
241 | if (kstrtoint(buf, 10, &value) || value < 1 || value > 255) | 240 | if (kstrtoint(buf, 10, &value) || value < 1 || value > 255) |
242 | return -EINVAL; | 241 | return -EINVAL; |
243 | 242 | ||
244 | data_pointer->press_speed = value; | 243 | data_pointer->press_speed = value; |
245 | tpkbd_features_set(hdev); | 244 | lenovo_features_set_tpkbd(hdev); |
246 | 245 | ||
247 | return count; | 246 | return count; |
248 | } | 247 | } |
249 | 248 | ||
250 | static struct device_attribute dev_attr_pointer_press_to_select = | 249 | static struct device_attribute dev_attr_press_to_select_tpkbd = |
251 | __ATTR(press_to_select, S_IWUSR | S_IRUGO, | 250 | __ATTR(press_to_select, S_IWUSR | S_IRUGO, |
252 | pointer_press_to_select_show, | 251 | attr_press_to_select_show_tpkbd, |
253 | pointer_press_to_select_store); | 252 | attr_press_to_select_store_tpkbd); |
254 | 253 | ||
255 | static struct device_attribute dev_attr_pointer_dragging = | 254 | static struct device_attribute dev_attr_dragging_tpkbd = |
256 | __ATTR(dragging, S_IWUSR | S_IRUGO, | 255 | __ATTR(dragging, S_IWUSR | S_IRUGO, |
257 | pointer_dragging_show, | 256 | attr_dragging_show_tpkbd, |
258 | pointer_dragging_store); | 257 | attr_dragging_store_tpkbd); |
259 | 258 | ||
260 | static struct device_attribute dev_attr_pointer_release_to_select = | 259 | static struct device_attribute dev_attr_release_to_select_tpkbd = |
261 | __ATTR(release_to_select, S_IWUSR | S_IRUGO, | 260 | __ATTR(release_to_select, S_IWUSR | S_IRUGO, |
262 | pointer_release_to_select_show, | 261 | attr_release_to_select_show_tpkbd, |
263 | pointer_release_to_select_store); | 262 | attr_release_to_select_store_tpkbd); |
264 | 263 | ||
265 | static struct device_attribute dev_attr_pointer_select_right = | 264 | static struct device_attribute dev_attr_select_right_tpkbd = |
266 | __ATTR(select_right, S_IWUSR | S_IRUGO, | 265 | __ATTR(select_right, S_IWUSR | S_IRUGO, |
267 | pointer_select_right_show, | 266 | attr_select_right_show_tpkbd, |
268 | pointer_select_right_store); | 267 | attr_select_right_store_tpkbd); |
269 | 268 | ||
270 | static struct device_attribute dev_attr_pointer_sensitivity = | 269 | static struct device_attribute dev_attr_sensitivity_tpkbd = |
271 | __ATTR(sensitivity, S_IWUSR | S_IRUGO, | 270 | __ATTR(sensitivity, S_IWUSR | S_IRUGO, |
272 | pointer_sensitivity_show, | 271 | attr_sensitivity_show_tpkbd, |
273 | pointer_sensitivity_store); | 272 | attr_sensitivity_store_tpkbd); |
274 | 273 | ||
275 | static struct device_attribute dev_attr_pointer_press_speed = | 274 | static struct device_attribute dev_attr_press_speed_tpkbd = |
276 | __ATTR(press_speed, S_IWUSR | S_IRUGO, | 275 | __ATTR(press_speed, S_IWUSR | S_IRUGO, |
277 | pointer_press_speed_show, | 276 | attr_press_speed_show_tpkbd, |
278 | pointer_press_speed_store); | 277 | attr_press_speed_store_tpkbd); |
279 | 278 | ||
280 | static struct attribute *tpkbd_attributes_pointer[] = { | 279 | static struct attribute *lenovo_attributes_tpkbd[] = { |
281 | &dev_attr_pointer_press_to_select.attr, | 280 | &dev_attr_press_to_select_tpkbd.attr, |
282 | &dev_attr_pointer_dragging.attr, | 281 | &dev_attr_dragging_tpkbd.attr, |
283 | &dev_attr_pointer_release_to_select.attr, | 282 | &dev_attr_release_to_select_tpkbd.attr, |
284 | &dev_attr_pointer_select_right.attr, | 283 | &dev_attr_select_right_tpkbd.attr, |
285 | &dev_attr_pointer_sensitivity.attr, | 284 | &dev_attr_sensitivity_tpkbd.attr, |
286 | &dev_attr_pointer_press_speed.attr, | 285 | &dev_attr_press_speed_tpkbd.attr, |
287 | NULL | 286 | NULL |
288 | }; | 287 | }; |
289 | 288 | ||
290 | static const struct attribute_group tpkbd_attr_group_pointer = { | 289 | static const struct attribute_group lenovo_attr_group_tpkbd = { |
291 | .attrs = tpkbd_attributes_pointer, | 290 | .attrs = lenovo_attributes_tpkbd, |
292 | }; | 291 | }; |
293 | 292 | ||
294 | static enum led_brightness tpkbd_led_brightness_get( | 293 | static enum led_brightness lenovo_led_brightness_get_tpkbd( |
295 | struct led_classdev *led_cdev) | 294 | struct led_classdev *led_cdev) |
296 | { | 295 | { |
297 | struct device *dev = led_cdev->dev->parent; | 296 | struct device *dev = led_cdev->dev->parent; |
298 | struct hid_device *hdev = container_of(dev, struct hid_device, dev); | 297 | struct hid_device *hdev = container_of(dev, struct hid_device, dev); |
299 | struct tpkbd_data_pointer *data_pointer = hid_get_drvdata(hdev); | 298 | struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); |
300 | int led_nr = 0; | 299 | int led_nr = 0; |
301 | 300 | ||
302 | if (led_cdev == &data_pointer->led_micmute) | 301 | if (led_cdev == &data_pointer->led_micmute) |
@@ -307,12 +306,12 @@ static enum led_brightness tpkbd_led_brightness_get( | |||
307 | : LED_OFF; | 306 | : LED_OFF; |
308 | } | 307 | } |
309 | 308 | ||
310 | static void tpkbd_led_brightness_set(struct led_classdev *led_cdev, | 309 | static void lenovo_led_brightness_set_tpkbd(struct led_classdev *led_cdev, |
311 | enum led_brightness value) | 310 | enum led_brightness value) |
312 | { | 311 | { |
313 | struct device *dev = led_cdev->dev->parent; | 312 | struct device *dev = led_cdev->dev->parent; |
314 | struct hid_device *hdev = container_of(dev, struct hid_device, dev); | 313 | struct hid_device *hdev = container_of(dev, struct hid_device, dev); |
315 | struct tpkbd_data_pointer *data_pointer = hid_get_drvdata(hdev); | 314 | struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); |
316 | struct hid_report *report; | 315 | struct hid_report *report; |
317 | int led_nr = 0; | 316 | int led_nr = 0; |
318 | 317 | ||
@@ -330,10 +329,10 @@ static void tpkbd_led_brightness_set(struct led_classdev *led_cdev, | |||
330 | hid_hw_request(hdev, report, HID_REQ_SET_REPORT); | 329 | hid_hw_request(hdev, report, HID_REQ_SET_REPORT); |
331 | } | 330 | } |
332 | 331 | ||
333 | static int tpkbd_probe_tp(struct hid_device *hdev) | 332 | static int lenovo_probe_tpkbd(struct hid_device *hdev) |
334 | { | 333 | { |
335 | struct device *dev = &hdev->dev; | 334 | struct device *dev = &hdev->dev; |
336 | struct tpkbd_data_pointer *data_pointer; | 335 | struct lenovo_drvdata_tpkbd *data_pointer; |
337 | size_t name_sz = strlen(dev_name(dev)) + 16; | 336 | size_t name_sz = strlen(dev_name(dev)) + 16; |
338 | char *name_mute, *name_micmute; | 337 | char *name_mute, *name_micmute; |
339 | int i; | 338 | int i; |
@@ -347,12 +346,12 @@ static int tpkbd_probe_tp(struct hid_device *hdev) | |||
347 | return -ENODEV; | 346 | return -ENODEV; |
348 | 347 | ||
349 | if (sysfs_create_group(&hdev->dev.kobj, | 348 | if (sysfs_create_group(&hdev->dev.kobj, |
350 | &tpkbd_attr_group_pointer)) { | 349 | &lenovo_attr_group_tpkbd)) { |
351 | hid_warn(hdev, "Could not create sysfs group\n"); | 350 | hid_warn(hdev, "Could not create sysfs group\n"); |
352 | } | 351 | } |
353 | 352 | ||
354 | data_pointer = devm_kzalloc(&hdev->dev, | 353 | data_pointer = devm_kzalloc(&hdev->dev, |
355 | sizeof(struct tpkbd_data_pointer), | 354 | sizeof(struct lenovo_drvdata_tpkbd), |
356 | GFP_KERNEL); | 355 | GFP_KERNEL); |
357 | if (data_pointer == NULL) { | 356 | if (data_pointer == NULL) { |
358 | hid_err(hdev, "Could not allocate memory for driver data\n"); | 357 | hid_err(hdev, "Could not allocate memory for driver data\n"); |
@@ -375,23 +374,25 @@ static int tpkbd_probe_tp(struct hid_device *hdev) | |||
375 | hid_set_drvdata(hdev, data_pointer); | 374 | hid_set_drvdata(hdev, data_pointer); |
376 | 375 | ||
377 | data_pointer->led_mute.name = name_mute; | 376 | data_pointer->led_mute.name = name_mute; |
378 | data_pointer->led_mute.brightness_get = tpkbd_led_brightness_get; | 377 | data_pointer->led_mute.brightness_get = lenovo_led_brightness_get_tpkbd; |
379 | data_pointer->led_mute.brightness_set = tpkbd_led_brightness_set; | 378 | data_pointer->led_mute.brightness_set = lenovo_led_brightness_set_tpkbd; |
380 | data_pointer->led_mute.dev = dev; | 379 | data_pointer->led_mute.dev = dev; |
381 | led_classdev_register(dev, &data_pointer->led_mute); | 380 | led_classdev_register(dev, &data_pointer->led_mute); |
382 | 381 | ||
383 | data_pointer->led_micmute.name = name_micmute; | 382 | data_pointer->led_micmute.name = name_micmute; |
384 | data_pointer->led_micmute.brightness_get = tpkbd_led_brightness_get; | 383 | data_pointer->led_micmute.brightness_get = |
385 | data_pointer->led_micmute.brightness_set = tpkbd_led_brightness_set; | 384 | lenovo_led_brightness_get_tpkbd; |
385 | data_pointer->led_micmute.brightness_set = | ||
386 | lenovo_led_brightness_set_tpkbd; | ||
386 | data_pointer->led_micmute.dev = dev; | 387 | data_pointer->led_micmute.dev = dev; |
387 | led_classdev_register(dev, &data_pointer->led_micmute); | 388 | led_classdev_register(dev, &data_pointer->led_micmute); |
388 | 389 | ||
389 | tpkbd_features_set(hdev); | 390 | lenovo_features_set_tpkbd(hdev); |
390 | 391 | ||
391 | return 0; | 392 | return 0; |
392 | } | 393 | } |
393 | 394 | ||
394 | static int tpkbd_probe(struct hid_device *hdev, | 395 | static int lenovo_probe(struct hid_device *hdev, |
395 | const struct hid_device_id *id) | 396 | const struct hid_device_id *id) |
396 | { | 397 | { |
397 | int ret; | 398 | int ret; |
@@ -410,7 +411,7 @@ static int tpkbd_probe(struct hid_device *hdev, | |||
410 | 411 | ||
411 | if (hid_get_drvdata(hdev)) { | 412 | if (hid_get_drvdata(hdev)) { |
412 | hid_set_drvdata(hdev, NULL); | 413 | hid_set_drvdata(hdev, NULL); |
413 | ret = tpkbd_probe_tp(hdev); | 414 | ret = lenovo_probe_tpkbd(hdev); |
414 | if (ret) | 415 | if (ret) |
415 | goto err_hid; | 416 | goto err_hid; |
416 | } | 417 | } |
@@ -422,12 +423,12 @@ err: | |||
422 | return ret; | 423 | return ret; |
423 | } | 424 | } |
424 | 425 | ||
425 | static void tpkbd_remove_tp(struct hid_device *hdev) | 426 | static void lenovo_remove_tpkbd(struct hid_device *hdev) |
426 | { | 427 | { |
427 | struct tpkbd_data_pointer *data_pointer = hid_get_drvdata(hdev); | 428 | struct lenovo_drvdata_tpkbd *data_pointer = hid_get_drvdata(hdev); |
428 | 429 | ||
429 | sysfs_remove_group(&hdev->dev.kobj, | 430 | sysfs_remove_group(&hdev->dev.kobj, |
430 | &tpkbd_attr_group_pointer); | 431 | &lenovo_attr_group_tpkbd); |
431 | 432 | ||
432 | led_classdev_unregister(&data_pointer->led_micmute); | 433 | led_classdev_unregister(&data_pointer->led_micmute); |
433 | led_classdev_unregister(&data_pointer->led_mute); | 434 | led_classdev_unregister(&data_pointer->led_mute); |
@@ -435,28 +436,28 @@ static void tpkbd_remove_tp(struct hid_device *hdev) | |||
435 | hid_set_drvdata(hdev, NULL); | 436 | hid_set_drvdata(hdev, NULL); |
436 | } | 437 | } |
437 | 438 | ||
438 | static void tpkbd_remove(struct hid_device *hdev) | 439 | static void lenovo_remove(struct hid_device *hdev) |
439 | { | 440 | { |
440 | if (hid_get_drvdata(hdev)) | 441 | if (hid_get_drvdata(hdev)) |
441 | tpkbd_remove_tp(hdev); | 442 | lenovo_remove_tpkbd(hdev); |
442 | 443 | ||
443 | hid_hw_stop(hdev); | 444 | hid_hw_stop(hdev); |
444 | } | 445 | } |
445 | 446 | ||
446 | static const struct hid_device_id tpkbd_devices[] = { | 447 | static const struct hid_device_id lenovo_devices[] = { |
447 | { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_TPKBD) }, | 448 | { HID_USB_DEVICE(USB_VENDOR_ID_LENOVO, USB_DEVICE_ID_LENOVO_TPKBD) }, |
448 | { } | 449 | { } |
449 | }; | 450 | }; |
450 | 451 | ||
451 | MODULE_DEVICE_TABLE(hid, tpkbd_devices); | 452 | MODULE_DEVICE_TABLE(hid, lenovo_devices); |
452 | 453 | ||
453 | static struct hid_driver tpkbd_driver = { | 454 | static struct hid_driver lenovo_driver = { |
454 | .name = "lenovo_tpkbd", | 455 | .name = "lenovo", |
455 | .id_table = tpkbd_devices, | 456 | .id_table = lenovo_devices, |
456 | .input_mapping = tpkbd_input_mapping, | 457 | .input_mapping = lenovo_input_mapping_tpkbd, |
457 | .probe = tpkbd_probe, | 458 | .probe = lenovo_probe, |
458 | .remove = tpkbd_remove, | 459 | .remove = lenovo_remove, |
459 | }; | 460 | }; |
460 | module_hid_driver(tpkbd_driver); | 461 | module_hid_driver(lenovo_driver); |
461 | 462 | ||
462 | MODULE_LICENSE("GPL"); | 463 | MODULE_LICENSE("GPL"); |