1 // SPDX-License-Identifier: GPL-2.0-or-later
3 * Copyright (c) 2016 Masaki Ota <masaki.ota@jp.alps.com>
6 #include <linux/kernel.h>
8 #include <linux/input.h>
9 #include <linux/input/mt.h>
10 #include <linux/module.h>
11 #include <asm/unaligned.h>
14 /* ALPS Device Product ID */
15 #define HID_PRODUCT_ID_T3_BTNLESS 0xD0C0
16 #define HID_PRODUCT_ID_COSMO 0x1202
17 #define HID_PRODUCT_ID_U1_PTP_1 0x1207
18 #define HID_PRODUCT_ID_U1 0x1209
19 #define HID_PRODUCT_ID_U1_PTP_2 0x120A
20 #define HID_PRODUCT_ID_U1_DUAL 0x120B
21 #define HID_PRODUCT_ID_T4_BTNLESS 0x120C
23 #define DEV_SINGLEPOINT 0x01
24 #define DEV_DUALPOINT 0x02
26 #define U1_MOUSE_REPORT_ID 0x01 /* Mouse data ReportID */
27 #define U1_ABSOLUTE_REPORT_ID 0x03 /* Absolute data ReportID */
28 #define U1_ABSOLUTE_REPORT_ID_SECD 0x02 /* FW-PTP Absolute data ReportID */
29 #define U1_FEATURE_REPORT_ID 0x05 /* Feature ReportID */
30 #define U1_SP_ABSOLUTE_REPORT_ID 0x06 /* Feature ReportID */
32 #define U1_FEATURE_REPORT_LEN 0x08 /* Feature Report Length */
33 #define U1_FEATURE_REPORT_LEN_ALL 0x0A
34 #define U1_CMD_REGISTER_READ 0xD1
35 #define U1_CMD_REGISTER_WRITE 0xD2
37 #define U1_DEVTYPE_SP_SUPPORT 0x10 /* SP Support */
38 #define U1_DISABLE_DEV 0x01
39 #define U1_TP_ABS_MODE 0x02
40 #define U1_SP_ABS_MODE 0x80
42 #define ADDRESS_U1_DEV_CTRL_1 0x00800040
43 #define ADDRESS_U1_DEVICE_TYP 0x00800043
44 #define ADDRESS_U1_NUM_SENS_X 0x00800047
45 #define ADDRESS_U1_NUM_SENS_Y 0x00800048
46 #define ADDRESS_U1_PITCH_SENS_X 0x00800049
47 #define ADDRESS_U1_PITCH_SENS_Y 0x0080004A
48 #define ADDRESS_U1_RESO_DWN_ABS 0x0080004E
49 #define ADDRESS_U1_PAD_BTN 0x00800052
50 #define ADDRESS_U1_SP_BTN 0x0080009F
52 #define T4_INPUT_REPORT_LEN sizeof(struct t4_input_report)
53 #define T4_FEATURE_REPORT_LEN T4_INPUT_REPORT_LEN
54 #define T4_FEATURE_REPORT_ID 7
55 #define T4_CMD_REGISTER_READ 0x08
56 #define T4_CMD_REGISTER_WRITE 0x07
58 #define T4_ADDRESS_BASE 0xC2C0
59 #define PRM_SYS_CONFIG_1 (T4_ADDRESS_BASE + 0x0002)
60 #define T4_PRM_FEED_CONFIG_1 (T4_ADDRESS_BASE + 0x0004)
61 #define T4_PRM_FEED_CONFIG_4 (T4_ADDRESS_BASE + 0x001A)
62 #define T4_PRM_ID_CONFIG_3 (T4_ADDRESS_BASE + 0x00B0)
65 #define T4_FEEDCFG4_ADVANCED_ABS_ENABLE 0x01
66 #define T4_I2C_ABS 0x78
68 #define T4_COUNT_PER_ELECTRODE 256
79 * @input: pointer to the kernel input device
80 * @input2: pointer to the kernel input2 device
81 * @hdev: pointer to the struct hid_device
83 * @dev_type: device type
84 * @max_fingers: total number of fingers
85 * @has_sp: boolean of sp existense
86 * @sp_btn_info: button information
87 * @x_active_len_mm: active area length of X (mm)
88 * @y_active_len_mm: active area length of Y (mm)
89 * @x_max: maximum x coordinate value
90 * @y_max: maximum y coordinate value
91 * @x_min: minimum x coordinate value
92 * @y_min: minimum y coordinate value
93 * @btn_cnt: number of buttons
94 * @sp_btn_cnt: number of stick buttons
97 struct input_dev
*input
;
98 struct input_dev
*input2
;
99 struct hid_device
*hdev
;
101 enum dev_num dev_type
;
115 struct t4_contact_data
{
123 struct t4_input_report
{
126 struct t4_contact_data contact
[5];
135 static u16
t4_calc_check_sum(u8
*buffer
,
136 unsigned long offset
, unsigned long length
)
138 u16 sum1
= 0xFF, sum2
= 0xFF;
141 if (offset
+ length
>= 50)
145 u32 tlen
= length
> 20 ? 20 : length
;
150 sum1
+= buffer
[offset
+ i
];
153 } while (--tlen
> 0);
155 sum1
= (sum1
& 0xFF) + (sum1
>> 8);
156 sum2
= (sum2
& 0xFF) + (sum2
>> 8);
159 sum1
= (sum1
& 0xFF) + (sum1
>> 8);
160 sum2
= (sum2
& 0xFF) + (sum2
>> 8);
162 return(sum2
<< 8 | sum1
);
165 static int t4_read_write_register(struct hid_device
*hdev
, u32 address
,
166 u8
*read_val
, u8 write_val
, bool read_flag
)
173 input
= kzalloc(T4_FEATURE_REPORT_LEN
, GFP_KERNEL
);
177 input
[0] = T4_FEATURE_REPORT_ID
;
179 input
[1] = T4_CMD_REGISTER_READ
;
182 input
[1] = T4_CMD_REGISTER_WRITE
;
183 input
[8] = write_val
;
185 put_unaligned_le32(address
, input
+ 2);
189 /* Calculate the checksum */
190 check_sum
= t4_calc_check_sum(input
, 1, 8);
191 input
[9] = (u8
)check_sum
;
192 input
[10] = (u8
)(check_sum
>> 8);
195 ret
= hid_hw_raw_request(hdev
, T4_FEATURE_REPORT_ID
, input
,
196 T4_FEATURE_REPORT_LEN
,
197 HID_FEATURE_REPORT
, HID_REQ_SET_REPORT
);
200 dev_err(&hdev
->dev
, "failed to read command (%d)\n", ret
);
205 readbuf
= kzalloc(T4_FEATURE_REPORT_LEN
, GFP_KERNEL
);
211 ret
= hid_hw_raw_request(hdev
, T4_FEATURE_REPORT_ID
, readbuf
,
212 T4_FEATURE_REPORT_LEN
,
213 HID_FEATURE_REPORT
, HID_REQ_GET_REPORT
);
215 dev_err(&hdev
->dev
, "failed read register (%d)\n", ret
);
221 if (*(u32
*)&readbuf
[6] != address
) {
222 dev_err(&hdev
->dev
, "read register address error (%x,%x)\n",
223 *(u32
*)&readbuf
[6], address
);
227 if (*(u16
*)&readbuf
[10] != 1) {
228 dev_err(&hdev
->dev
, "read register size error (%x)\n",
229 *(u16
*)&readbuf
[10]);
233 check_sum
= t4_calc_check_sum(readbuf
, 6, 7);
234 if (*(u16
*)&readbuf
[13] != check_sum
) {
235 dev_err(&hdev
->dev
, "read register checksum error (%x,%x)\n",
236 *(u16
*)&readbuf
[13], check_sum
);
240 *read_val
= readbuf
[12];
252 static int u1_read_write_register(struct hid_device
*hdev
, u32 address
,
253 u8
*read_val
, u8 write_val
, bool read_flag
)
260 input
= kzalloc(U1_FEATURE_REPORT_LEN
, GFP_KERNEL
);
264 input
[0] = U1_FEATURE_REPORT_ID
;
266 input
[1] = U1_CMD_REGISTER_READ
;
269 input
[1] = U1_CMD_REGISTER_WRITE
;
270 input
[6] = write_val
;
273 put_unaligned_le32(address
, input
+ 2);
275 /* Calculate the checksum */
276 check_sum
= U1_FEATURE_REPORT_LEN_ALL
;
277 for (i
= 0; i
< U1_FEATURE_REPORT_LEN
- 1; i
++)
278 check_sum
+= input
[i
];
280 input
[7] = check_sum
;
281 ret
= hid_hw_raw_request(hdev
, U1_FEATURE_REPORT_ID
, input
,
282 U1_FEATURE_REPORT_LEN
,
283 HID_FEATURE_REPORT
, HID_REQ_SET_REPORT
);
286 dev_err(&hdev
->dev
, "failed to read command (%d)\n", ret
);
291 readbuf
= kzalloc(U1_FEATURE_REPORT_LEN
, GFP_KERNEL
);
297 ret
= hid_hw_raw_request(hdev
, U1_FEATURE_REPORT_ID
, readbuf
,
298 U1_FEATURE_REPORT_LEN
,
299 HID_FEATURE_REPORT
, HID_REQ_GET_REPORT
);
302 dev_err(&hdev
->dev
, "failed read register (%d)\n", ret
);
307 *read_val
= readbuf
[6];
319 static int t4_raw_event(struct alps_dev
*hdata
, u8
*data
, int size
)
321 unsigned int x
, y
, z
;
323 struct t4_input_report
*p_report
= (struct t4_input_report
*)data
;
327 for (i
= 0; i
< hdata
->max_fingers
; i
++) {
328 x
= p_report
->contact
[i
].x_hi
<< 8 | p_report
->contact
[i
].x_lo
;
329 y
= p_report
->contact
[i
].y_hi
<< 8 | p_report
->contact
[i
].y_lo
;
330 y
= hdata
->y_max
- y
+ hdata
->y_min
;
331 z
= (p_report
->contact
[i
].palm
< 0x80 &&
332 p_report
->contact
[i
].palm
> 0) * 62;
338 input_mt_slot(hdata
->input
, i
);
340 input_mt_report_slot_state(hdata
->input
,
341 MT_TOOL_FINGER
, z
!= 0);
346 input_report_abs(hdata
->input
, ABS_MT_POSITION_X
, x
);
347 input_report_abs(hdata
->input
, ABS_MT_POSITION_Y
, y
);
348 input_report_abs(hdata
->input
, ABS_MT_PRESSURE
, z
);
350 input_mt_sync_frame(hdata
->input
);
352 input_report_key(hdata
->input
, BTN_LEFT
, p_report
->button
);
354 input_sync(hdata
->input
);
358 static int u1_raw_event(struct alps_dev
*hdata
, u8
*data
, int size
)
360 unsigned int x
, y
, z
;
367 case U1_MOUSE_REPORT_ID
:
369 case U1_FEATURE_REPORT_ID
:
371 case U1_ABSOLUTE_REPORT_ID
:
372 case U1_ABSOLUTE_REPORT_ID_SECD
:
373 for (i
= 0; i
< hdata
->max_fingers
; i
++) {
374 u8
*contact
= &data
[i
* 5];
376 x
= get_unaligned_le16(contact
+ 3);
377 y
= get_unaligned_le16(contact
+ 5);
378 z
= contact
[7] & 0x7F;
380 input_mt_slot(hdata
->input
, i
);
383 input_mt_report_slot_state(hdata
->input
,
385 input_report_abs(hdata
->input
,
386 ABS_MT_POSITION_X
, x
);
387 input_report_abs(hdata
->input
,
388 ABS_MT_POSITION_Y
, y
);
389 input_report_abs(hdata
->input
,
392 input_mt_report_slot_state(hdata
->input
,
397 input_mt_sync_frame(hdata
->input
);
399 input_report_key(hdata
->input
, BTN_LEFT
,
401 input_report_key(hdata
->input
, BTN_RIGHT
,
403 input_report_key(hdata
->input
, BTN_MIDDLE
,
406 input_sync(hdata
->input
);
410 case U1_SP_ABSOLUTE_REPORT_ID
:
411 sp_x
= get_unaligned_le16(data
+2);
412 sp_y
= get_unaligned_le16(data
+4);
417 input_report_rel(hdata
->input2
, REL_X
, sp_x
);
418 input_report_rel(hdata
->input2
, REL_Y
, sp_y
);
420 input_report_key(hdata
->input2
, BTN_LEFT
,
422 input_report_key(hdata
->input2
, BTN_RIGHT
,
424 input_report_key(hdata
->input2
, BTN_MIDDLE
,
427 input_sync(hdata
->input2
);
435 static int alps_raw_event(struct hid_device
*hdev
,
436 struct hid_report
*report
, u8
*data
, int size
)
439 struct alps_dev
*hdata
= hid_get_drvdata(hdev
);
441 switch (hdev
->product
) {
442 case HID_PRODUCT_ID_T4_BTNLESS
:
443 ret
= t4_raw_event(hdata
, data
, size
);
446 ret
= u1_raw_event(hdata
, data
, size
);
452 static int __maybe_unused
alps_post_reset(struct hid_device
*hdev
)
455 struct alps_dev
*data
= hid_get_drvdata(hdev
);
457 switch (data
->dev_type
) {
459 ret
= t4_read_write_register(hdev
, T4_PRM_FEED_CONFIG_1
,
460 NULL
, T4_I2C_ABS
, false);
462 dev_err(&hdev
->dev
, "failed T4_PRM_FEED_CONFIG_1 (%d)\n",
467 ret
= t4_read_write_register(hdev
, T4_PRM_FEED_CONFIG_4
,
468 NULL
, T4_FEEDCFG4_ADVANCED_ABS_ENABLE
, false);
470 dev_err(&hdev
->dev
, "failed T4_PRM_FEED_CONFIG_4 (%d)\n",
476 ret
= u1_read_write_register(hdev
,
477 ADDRESS_U1_DEV_CTRL_1
, NULL
,
478 U1_TP_ABS_MODE
| U1_SP_ABS_MODE
, false);
480 dev_err(&hdev
->dev
, "failed to change TP mode (%d)\n",
493 static int __maybe_unused
alps_post_resume(struct hid_device
*hdev
)
495 return alps_post_reset(hdev
);
498 static int u1_init(struct hid_device
*hdev
, struct alps_dev
*pri_data
)
501 u8 tmp
, dev_ctrl
, sen_line_num_x
, sen_line_num_y
;
502 u8 pitch_x
, pitch_y
, resolution
;
504 /* Device initialization */
505 ret
= u1_read_write_register(hdev
, ADDRESS_U1_DEV_CTRL_1
,
508 dev_err(&hdev
->dev
, "failed U1_DEV_CTRL_1 (%d)\n", ret
);
512 dev_ctrl
&= ~U1_DISABLE_DEV
;
513 dev_ctrl
|= U1_TP_ABS_MODE
;
514 ret
= u1_read_write_register(hdev
, ADDRESS_U1_DEV_CTRL_1
,
515 NULL
, dev_ctrl
, false);
517 dev_err(&hdev
->dev
, "failed to change TP mode (%d)\n", ret
);
521 ret
= u1_read_write_register(hdev
, ADDRESS_U1_NUM_SENS_X
,
522 &sen_line_num_x
, 0, true);
524 dev_err(&hdev
->dev
, "failed U1_NUM_SENS_X (%d)\n", ret
);
528 ret
= u1_read_write_register(hdev
, ADDRESS_U1_NUM_SENS_Y
,
529 &sen_line_num_y
, 0, true);
531 dev_err(&hdev
->dev
, "failed U1_NUM_SENS_Y (%d)\n", ret
);
535 ret
= u1_read_write_register(hdev
, ADDRESS_U1_PITCH_SENS_X
,
538 dev_err(&hdev
->dev
, "failed U1_PITCH_SENS_X (%d)\n", ret
);
542 ret
= u1_read_write_register(hdev
, ADDRESS_U1_PITCH_SENS_Y
,
545 dev_err(&hdev
->dev
, "failed U1_PITCH_SENS_Y (%d)\n", ret
);
549 ret
= u1_read_write_register(hdev
, ADDRESS_U1_RESO_DWN_ABS
,
550 &resolution
, 0, true);
552 dev_err(&hdev
->dev
, "failed U1_RESO_DWN_ABS (%d)\n", ret
);
555 pri_data
->x_active_len_mm
=
556 (pitch_x
* (sen_line_num_x
- 1)) / 10;
557 pri_data
->y_active_len_mm
=
558 (pitch_y
* (sen_line_num_y
- 1)) / 10;
561 (resolution
<< 2) * (sen_line_num_x
- 1);
564 (resolution
<< 2) * (sen_line_num_y
- 1);
567 ret
= u1_read_write_register(hdev
, ADDRESS_U1_PAD_BTN
,
570 dev_err(&hdev
->dev
, "failed U1_PAD_BTN (%d)\n", ret
);
573 if ((tmp
& 0x0F) == (tmp
& 0xF0) >> 4) {
574 pri_data
->btn_cnt
= (tmp
& 0x0F);
577 pri_data
->btn_cnt
= 1;
580 pri_data
->has_sp
= 0;
581 /* Check StickPointer device */
582 ret
= u1_read_write_register(hdev
, ADDRESS_U1_DEVICE_TYP
,
585 dev_err(&hdev
->dev
, "failed U1_DEVICE_TYP (%d)\n", ret
);
588 if (tmp
& U1_DEVTYPE_SP_SUPPORT
) {
589 dev_ctrl
|= U1_SP_ABS_MODE
;
590 ret
= u1_read_write_register(hdev
, ADDRESS_U1_DEV_CTRL_1
,
591 NULL
, dev_ctrl
, false);
593 dev_err(&hdev
->dev
, "failed SP mode (%d)\n", ret
);
597 ret
= u1_read_write_register(hdev
, ADDRESS_U1_SP_BTN
,
598 &pri_data
->sp_btn_info
, 0, true);
600 dev_err(&hdev
->dev
, "failed U1_SP_BTN (%d)\n", ret
);
603 pri_data
->has_sp
= 1;
605 pri_data
->max_fingers
= 5;
610 static int T4_init(struct hid_device
*hdev
, struct alps_dev
*pri_data
)
613 u8 tmp
, sen_line_num_x
, sen_line_num_y
;
615 ret
= t4_read_write_register(hdev
, T4_PRM_ID_CONFIG_3
, &tmp
, 0, true);
617 dev_err(&hdev
->dev
, "failed T4_PRM_ID_CONFIG_3 (%d)\n", ret
);
620 sen_line_num_x
= 16 + ((tmp
& 0x0F) | (tmp
& 0x08 ? 0xF0 : 0));
621 sen_line_num_y
= 12 + (((tmp
& 0xF0) >> 4) | (tmp
& 0x80 ? 0xF0 : 0));
623 pri_data
->x_max
= sen_line_num_x
* T4_COUNT_PER_ELECTRODE
;
624 pri_data
->x_min
= T4_COUNT_PER_ELECTRODE
;
625 pri_data
->y_max
= sen_line_num_y
* T4_COUNT_PER_ELECTRODE
;
626 pri_data
->y_min
= T4_COUNT_PER_ELECTRODE
;
627 pri_data
->x_active_len_mm
= pri_data
->y_active_len_mm
= 0;
628 pri_data
->btn_cnt
= 1;
630 ret
= t4_read_write_register(hdev
, PRM_SYS_CONFIG_1
, &tmp
, 0, true);
632 dev_err(&hdev
->dev
, "failed PRM_SYS_CONFIG_1 (%d)\n", ret
);
636 ret
= t4_read_write_register(hdev
, PRM_SYS_CONFIG_1
, NULL
, tmp
, false);
638 dev_err(&hdev
->dev
, "failed PRM_SYS_CONFIG_1 (%d)\n", ret
);
642 ret
= t4_read_write_register(hdev
, T4_PRM_FEED_CONFIG_1
,
643 NULL
, T4_I2C_ABS
, false);
645 dev_err(&hdev
->dev
, "failed T4_PRM_FEED_CONFIG_1 (%d)\n", ret
);
649 ret
= t4_read_write_register(hdev
, T4_PRM_FEED_CONFIG_4
, NULL
,
650 T4_FEEDCFG4_ADVANCED_ABS_ENABLE
, false);
652 dev_err(&hdev
->dev
, "failed T4_PRM_FEED_CONFIG_4 (%d)\n", ret
);
655 pri_data
->max_fingers
= 5;
656 pri_data
->has_sp
= 0;
661 static int alps_sp_open(struct input_dev
*dev
)
663 struct hid_device
*hid
= input_get_drvdata(dev
);
665 return hid_hw_open(hid
);
668 static void alps_sp_close(struct input_dev
*dev
)
670 struct hid_device
*hid
= input_get_drvdata(dev
);
675 static int alps_input_configured(struct hid_device
*hdev
, struct hid_input
*hi
)
677 struct alps_dev
*data
= hid_get_drvdata(hdev
);
678 struct input_dev
*input
= hi
->input
, *input2
;
684 hid_dbg(hdev
, "Opening low level driver\n");
685 ret
= hid_hw_open(hdev
);
689 /* Allow incoming hid reports */
690 hid_device_io_start(hdev
);
691 switch (data
->dev_type
) {
693 ret
= T4_init(hdev
, data
);
696 ret
= u1_init(hdev
, data
);
705 __set_bit(EV_ABS
, input
->evbit
);
706 input_set_abs_params(input
, ABS_MT_POSITION_X
,
707 data
->x_min
, data
->x_max
, 0, 0);
708 input_set_abs_params(input
, ABS_MT_POSITION_Y
,
709 data
->y_min
, data
->y_max
, 0, 0);
711 if (data
->x_active_len_mm
&& data
->y_active_len_mm
) {
712 res_x
= (data
->x_max
- 1) / data
->x_active_len_mm
;
713 res_y
= (data
->y_max
- 1) / data
->y_active_len_mm
;
715 input_abs_set_res(input
, ABS_MT_POSITION_X
, res_x
);
716 input_abs_set_res(input
, ABS_MT_POSITION_Y
, res_y
);
719 input_set_abs_params(input
, ABS_MT_PRESSURE
, 0, 64, 0, 0);
721 input_mt_init_slots(input
, data
->max_fingers
, INPUT_MT_POINTER
);
723 __set_bit(EV_KEY
, input
->evbit
);
725 if (data
->btn_cnt
== 1)
726 __set_bit(INPUT_PROP_BUTTONPAD
, input
->propbit
);
728 for (i
= 0; i
< data
->btn_cnt
; i
++)
729 __set_bit(BTN_LEFT
+ i
, input
->keybit
);
731 /* Stick device initialization */
733 input2
= input_allocate_device();
739 data
->input2
= input2
;
740 input2
->phys
= input
->phys
;
741 input2
->name
= "DualPoint Stick";
742 input2
->id
.bustype
= BUS_I2C
;
743 input2
->id
.vendor
= input
->id
.vendor
;
744 input2
->id
.product
= input
->id
.product
;
745 input2
->id
.version
= input
->id
.version
;
746 input2
->dev
.parent
= input
->dev
.parent
;
748 input_set_drvdata(input2
, hdev
);
749 input2
->open
= alps_sp_open
;
750 input2
->close
= alps_sp_close
;
752 __set_bit(EV_KEY
, input2
->evbit
);
753 data
->sp_btn_cnt
= (data
->sp_btn_info
& 0x0F);
754 for (i
= 0; i
< data
->sp_btn_cnt
; i
++)
755 __set_bit(BTN_LEFT
+ i
, input2
->keybit
);
757 __set_bit(EV_REL
, input2
->evbit
);
758 __set_bit(REL_X
, input2
->relbit
);
759 __set_bit(REL_Y
, input2
->relbit
);
760 __set_bit(INPUT_PROP_POINTER
, input2
->propbit
);
761 __set_bit(INPUT_PROP_POINTING_STICK
, input2
->propbit
);
763 if (input_register_device(data
->input2
)) {
764 input_free_device(input2
);
770 hid_device_io_stop(hdev
);
775 static int alps_input_mapping(struct hid_device
*hdev
,
776 struct hid_input
*hi
, struct hid_field
*field
,
777 struct hid_usage
*usage
, unsigned long **bit
, int *max
)
782 static int alps_probe(struct hid_device
*hdev
, const struct hid_device_id
*id
)
784 struct alps_dev
*data
= NULL
;
786 data
= devm_kzalloc(&hdev
->dev
, sizeof(struct alps_dev
), GFP_KERNEL
);
791 hid_set_drvdata(hdev
, data
);
793 hdev
->quirks
|= HID_QUIRK_NO_INIT_REPORTS
;
795 ret
= hid_parse(hdev
);
797 hid_err(hdev
, "parse failed\n");
801 switch (hdev
->product
) {
802 case HID_DEVICE_ID_ALPS_T4_BTNLESS
:
805 case HID_DEVICE_ID_ALPS_U1_DUAL
:
806 case HID_DEVICE_ID_ALPS_U1
:
807 case HID_DEVICE_ID_ALPS_U1_UNICORN_LEGACY
:
811 data
->dev_type
= UNKNOWN
;
814 ret
= hid_hw_start(hdev
, HID_CONNECT_DEFAULT
);
816 hid_err(hdev
, "hw start failed\n");
823 static void alps_remove(struct hid_device
*hdev
)
828 static const struct hid_device_id alps_id
[] = {
829 { HID_DEVICE(HID_BUS_ANY
, HID_GROUP_ANY
,
830 USB_VENDOR_ID_ALPS_JP
, HID_DEVICE_ID_ALPS_U1_DUAL
) },
831 { HID_DEVICE(HID_BUS_ANY
, HID_GROUP_ANY
,
832 USB_VENDOR_ID_ALPS_JP
, HID_DEVICE_ID_ALPS_U1
) },
833 { HID_DEVICE(HID_BUS_ANY
, HID_GROUP_ANY
,
834 USB_VENDOR_ID_ALPS_JP
, HID_DEVICE_ID_ALPS_T4_BTNLESS
) },
837 MODULE_DEVICE_TABLE(hid
, alps_id
);
839 static struct hid_driver alps_driver
= {
843 .remove
= alps_remove
,
844 .raw_event
= alps_raw_event
,
845 .input_mapping
= alps_input_mapping
,
846 .input_configured
= alps_input_configured
,
848 .resume
= alps_post_resume
,
849 .reset_resume
= alps_post_reset
,
853 module_hid_driver(alps_driver
);
855 MODULE_AUTHOR("Masaki Ota <masaki.ota@jp.alps.com>");
856 MODULE_DESCRIPTION("ALPS HID driver");
857 MODULE_LICENSE("GPL");