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_FEATURE_REPORT_ID 0x05 /* Feature ReportID */
29 #define U1_SP_ABSOLUTE_REPORT_ID 0x06 /* Feature ReportID */
31 #define U1_FEATURE_REPORT_LEN 0x08 /* Feature Report Length */
32 #define U1_FEATURE_REPORT_LEN_ALL 0x0A
33 #define U1_CMD_REGISTER_READ 0xD1
34 #define U1_CMD_REGISTER_WRITE 0xD2
36 #define U1_DEVTYPE_SP_SUPPORT 0x10 /* SP Support */
37 #define U1_DISABLE_DEV 0x01
38 #define U1_TP_ABS_MODE 0x02
39 #define U1_SP_ABS_MODE 0x80
41 #define ADDRESS_U1_DEV_CTRL_1 0x00800040
42 #define ADDRESS_U1_DEVICE_TYP 0x00800043
43 #define ADDRESS_U1_NUM_SENS_X 0x00800047
44 #define ADDRESS_U1_NUM_SENS_Y 0x00800048
45 #define ADDRESS_U1_PITCH_SENS_X 0x00800049
46 #define ADDRESS_U1_PITCH_SENS_Y 0x0080004A
47 #define ADDRESS_U1_RESO_DWN_ABS 0x0080004E
48 #define ADDRESS_U1_PAD_BTN 0x00800052
49 #define ADDRESS_U1_SP_BTN 0x0080009F
51 #define T4_INPUT_REPORT_LEN sizeof(struct t4_input_report)
52 #define T4_FEATURE_REPORT_LEN T4_INPUT_REPORT_LEN
53 #define T4_FEATURE_REPORT_ID 7
54 #define T4_CMD_REGISTER_READ 0x08
55 #define T4_CMD_REGISTER_WRITE 0x07
57 #define T4_ADDRESS_BASE 0xC2C0
58 #define PRM_SYS_CONFIG_1 (T4_ADDRESS_BASE + 0x0002)
59 #define T4_PRM_FEED_CONFIG_1 (T4_ADDRESS_BASE + 0x0004)
60 #define T4_PRM_FEED_CONFIG_4 (T4_ADDRESS_BASE + 0x001A)
61 #define T4_PRM_ID_CONFIG_3 (T4_ADDRESS_BASE + 0x00B0)
64 #define T4_FEEDCFG4_ADVANCED_ABS_ENABLE 0x01
65 #define T4_I2C_ABS 0x78
67 #define T4_COUNT_PER_ELECTRODE 256
78 * @input: pointer to the kernel input device
79 * @input2: pointer to the kernel input2 device
80 * @hdev: pointer to the struct hid_device
82 * @dev_type: device type
83 * @max_fingers: total number of fingers
84 * @has_sp: boolean of sp existense
85 * @sp_btn_info: button information
86 * @x_active_len_mm: active area length of X (mm)
87 * @y_active_len_mm: active area length of Y (mm)
88 * @x_max: maximum x coordinate value
89 * @y_max: maximum y coordinate value
90 * @x_min: minimum x coordinate value
91 * @y_min: minimum y coordinate value
92 * @btn_cnt: number of buttons
93 * @sp_btn_cnt: number of stick buttons
96 struct input_dev
*input
;
97 struct input_dev
*input2
;
98 struct hid_device
*hdev
;
100 enum dev_num dev_type
;
114 struct t4_contact_data
{
122 struct t4_input_report
{
125 struct t4_contact_data contact
[5];
134 static u16
t4_calc_check_sum(u8
*buffer
,
135 unsigned long offset
, unsigned long length
)
137 u16 sum1
= 0xFF, sum2
= 0xFF;
140 if (offset
+ length
>= 50)
144 u32 tlen
= length
> 20 ? 20 : length
;
149 sum1
+= buffer
[offset
+ i
];
152 } while (--tlen
> 0);
154 sum1
= (sum1
& 0xFF) + (sum1
>> 8);
155 sum2
= (sum2
& 0xFF) + (sum2
>> 8);
158 sum1
= (sum1
& 0xFF) + (sum1
>> 8);
159 sum2
= (sum2
& 0xFF) + (sum2
>> 8);
161 return(sum2
<< 8 | sum1
);
164 static int t4_read_write_register(struct hid_device
*hdev
, u32 address
,
165 u8
*read_val
, u8 write_val
, bool read_flag
)
172 input
= kzalloc(T4_FEATURE_REPORT_LEN
, GFP_KERNEL
);
176 input
[0] = T4_FEATURE_REPORT_ID
;
178 input
[1] = T4_CMD_REGISTER_READ
;
181 input
[1] = T4_CMD_REGISTER_WRITE
;
182 input
[8] = write_val
;
184 put_unaligned_le32(address
, input
+ 2);
188 /* Calculate the checksum */
189 check_sum
= t4_calc_check_sum(input
, 1, 8);
190 input
[9] = (u8
)check_sum
;
191 input
[10] = (u8
)(check_sum
>> 8);
194 ret
= hid_hw_raw_request(hdev
, T4_FEATURE_REPORT_ID
, input
,
195 T4_FEATURE_REPORT_LEN
,
196 HID_FEATURE_REPORT
, HID_REQ_SET_REPORT
);
199 dev_err(&hdev
->dev
, "failed to read command (%d)\n", ret
);
204 readbuf
= kzalloc(T4_FEATURE_REPORT_LEN
, GFP_KERNEL
);
210 ret
= hid_hw_raw_request(hdev
, T4_FEATURE_REPORT_ID
, readbuf
,
211 T4_FEATURE_REPORT_LEN
,
212 HID_FEATURE_REPORT
, HID_REQ_GET_REPORT
);
214 dev_err(&hdev
->dev
, "failed read register (%d)\n", ret
);
220 if (*(u32
*)&readbuf
[6] != address
) {
221 dev_err(&hdev
->dev
, "read register address error (%x,%x)\n",
222 *(u32
*)&readbuf
[6], address
);
226 if (*(u16
*)&readbuf
[10] != 1) {
227 dev_err(&hdev
->dev
, "read register size error (%x)\n",
228 *(u16
*)&readbuf
[10]);
232 check_sum
= t4_calc_check_sum(readbuf
, 6, 7);
233 if (*(u16
*)&readbuf
[13] != check_sum
) {
234 dev_err(&hdev
->dev
, "read register checksum error (%x,%x)\n",
235 *(u16
*)&readbuf
[13], check_sum
);
239 *read_val
= readbuf
[12];
251 static int u1_read_write_register(struct hid_device
*hdev
, u32 address
,
252 u8
*read_val
, u8 write_val
, bool read_flag
)
259 input
= kzalloc(U1_FEATURE_REPORT_LEN
, GFP_KERNEL
);
263 input
[0] = U1_FEATURE_REPORT_ID
;
265 input
[1] = U1_CMD_REGISTER_READ
;
268 input
[1] = U1_CMD_REGISTER_WRITE
;
269 input
[6] = write_val
;
272 put_unaligned_le32(address
, input
+ 2);
274 /* Calculate the checksum */
275 check_sum
= U1_FEATURE_REPORT_LEN_ALL
;
276 for (i
= 0; i
< U1_FEATURE_REPORT_LEN
- 1; i
++)
277 check_sum
+= input
[i
];
279 input
[7] = check_sum
;
280 ret
= hid_hw_raw_request(hdev
, U1_FEATURE_REPORT_ID
, input
,
281 U1_FEATURE_REPORT_LEN
,
282 HID_FEATURE_REPORT
, HID_REQ_SET_REPORT
);
285 dev_err(&hdev
->dev
, "failed to read command (%d)\n", ret
);
290 readbuf
= kzalloc(U1_FEATURE_REPORT_LEN
, GFP_KERNEL
);
296 ret
= hid_hw_raw_request(hdev
, U1_FEATURE_REPORT_ID
, readbuf
,
297 U1_FEATURE_REPORT_LEN
,
298 HID_FEATURE_REPORT
, HID_REQ_GET_REPORT
);
301 dev_err(&hdev
->dev
, "failed read register (%d)\n", ret
);
306 *read_val
= readbuf
[6];
318 static int t4_raw_event(struct alps_dev
*hdata
, u8
*data
, int size
)
320 unsigned int x
, y
, z
;
322 struct t4_input_report
*p_report
= (struct t4_input_report
*)data
;
326 for (i
= 0; i
< hdata
->max_fingers
; i
++) {
327 x
= p_report
->contact
[i
].x_hi
<< 8 | p_report
->contact
[i
].x_lo
;
328 y
= p_report
->contact
[i
].y_hi
<< 8 | p_report
->contact
[i
].y_lo
;
329 y
= hdata
->y_max
- y
+ hdata
->y_min
;
330 z
= (p_report
->contact
[i
].palm
< 0x80 &&
331 p_report
->contact
[i
].palm
> 0) * 62;
337 input_mt_slot(hdata
->input
, i
);
339 input_mt_report_slot_state(hdata
->input
,
340 MT_TOOL_FINGER
, z
!= 0);
345 input_report_abs(hdata
->input
, ABS_MT_POSITION_X
, x
);
346 input_report_abs(hdata
->input
, ABS_MT_POSITION_Y
, y
);
347 input_report_abs(hdata
->input
, ABS_MT_PRESSURE
, z
);
349 input_mt_sync_frame(hdata
->input
);
351 input_report_key(hdata
->input
, BTN_LEFT
, p_report
->button
);
353 input_sync(hdata
->input
);
357 static int u1_raw_event(struct alps_dev
*hdata
, u8
*data
, int size
)
359 unsigned int x
, y
, z
;
366 case U1_MOUSE_REPORT_ID
:
368 case U1_FEATURE_REPORT_ID
:
370 case U1_ABSOLUTE_REPORT_ID
:
371 for (i
= 0; i
< hdata
->max_fingers
; i
++) {
372 u8
*contact
= &data
[i
* 5];
374 x
= get_unaligned_le16(contact
+ 3);
375 y
= get_unaligned_le16(contact
+ 5);
376 z
= contact
[7] & 0x7F;
378 input_mt_slot(hdata
->input
, i
);
381 input_mt_report_slot_state(hdata
->input
,
383 input_report_abs(hdata
->input
,
384 ABS_MT_POSITION_X
, x
);
385 input_report_abs(hdata
->input
,
386 ABS_MT_POSITION_Y
, y
);
387 input_report_abs(hdata
->input
,
390 input_mt_report_slot_inactive(hdata
->input
);
394 input_mt_sync_frame(hdata
->input
);
396 input_report_key(hdata
->input
, BTN_LEFT
,
398 input_report_key(hdata
->input
, BTN_RIGHT
,
400 input_report_key(hdata
->input
, BTN_MIDDLE
,
403 input_sync(hdata
->input
);
407 case U1_SP_ABSOLUTE_REPORT_ID
:
408 sp_x
= get_unaligned_le16(data
+2);
409 sp_y
= get_unaligned_le16(data
+4);
414 input_report_rel(hdata
->input2
, REL_X
, sp_x
);
415 input_report_rel(hdata
->input2
, REL_Y
, sp_y
);
417 input_report_key(hdata
->input2
, BTN_LEFT
,
419 input_report_key(hdata
->input2
, BTN_RIGHT
,
421 input_report_key(hdata
->input2
, BTN_MIDDLE
,
424 input_sync(hdata
->input2
);
432 static int alps_raw_event(struct hid_device
*hdev
,
433 struct hid_report
*report
, u8
*data
, int size
)
436 struct alps_dev
*hdata
= hid_get_drvdata(hdev
);
438 switch (hdev
->product
) {
439 case HID_PRODUCT_ID_T4_BTNLESS
:
440 ret
= t4_raw_event(hdata
, data
, size
);
443 ret
= u1_raw_event(hdata
, data
, size
);
449 static int __maybe_unused
alps_post_reset(struct hid_device
*hdev
)
452 struct alps_dev
*data
= hid_get_drvdata(hdev
);
454 switch (data
->dev_type
) {
456 ret
= t4_read_write_register(hdev
, T4_PRM_FEED_CONFIG_1
,
457 NULL
, T4_I2C_ABS
, false);
459 dev_err(&hdev
->dev
, "failed T4_PRM_FEED_CONFIG_1 (%d)\n",
464 ret
= t4_read_write_register(hdev
, T4_PRM_FEED_CONFIG_4
,
465 NULL
, T4_FEEDCFG4_ADVANCED_ABS_ENABLE
, false);
467 dev_err(&hdev
->dev
, "failed T4_PRM_FEED_CONFIG_4 (%d)\n",
473 ret
= u1_read_write_register(hdev
,
474 ADDRESS_U1_DEV_CTRL_1
, NULL
,
475 U1_TP_ABS_MODE
| U1_SP_ABS_MODE
, false);
477 dev_err(&hdev
->dev
, "failed to change TP mode (%d)\n",
490 static int __maybe_unused
alps_post_resume(struct hid_device
*hdev
)
492 return alps_post_reset(hdev
);
495 static int u1_init(struct hid_device
*hdev
, struct alps_dev
*pri_data
)
498 u8 tmp
, dev_ctrl
, sen_line_num_x
, sen_line_num_y
;
499 u8 pitch_x
, pitch_y
, resolution
;
501 /* Device initialization */
502 ret
= u1_read_write_register(hdev
, ADDRESS_U1_DEV_CTRL_1
,
505 dev_err(&hdev
->dev
, "failed U1_DEV_CTRL_1 (%d)\n", ret
);
509 dev_ctrl
&= ~U1_DISABLE_DEV
;
510 dev_ctrl
|= U1_TP_ABS_MODE
;
511 ret
= u1_read_write_register(hdev
, ADDRESS_U1_DEV_CTRL_1
,
512 NULL
, dev_ctrl
, false);
514 dev_err(&hdev
->dev
, "failed to change TP mode (%d)\n", ret
);
518 ret
= u1_read_write_register(hdev
, ADDRESS_U1_NUM_SENS_X
,
519 &sen_line_num_x
, 0, true);
521 dev_err(&hdev
->dev
, "failed U1_NUM_SENS_X (%d)\n", ret
);
525 ret
= u1_read_write_register(hdev
, ADDRESS_U1_NUM_SENS_Y
,
526 &sen_line_num_y
, 0, true);
528 dev_err(&hdev
->dev
, "failed U1_NUM_SENS_Y (%d)\n", ret
);
532 ret
= u1_read_write_register(hdev
, ADDRESS_U1_PITCH_SENS_X
,
535 dev_err(&hdev
->dev
, "failed U1_PITCH_SENS_X (%d)\n", ret
);
539 ret
= u1_read_write_register(hdev
, ADDRESS_U1_PITCH_SENS_Y
,
542 dev_err(&hdev
->dev
, "failed U1_PITCH_SENS_Y (%d)\n", ret
);
546 ret
= u1_read_write_register(hdev
, ADDRESS_U1_RESO_DWN_ABS
,
547 &resolution
, 0, true);
549 dev_err(&hdev
->dev
, "failed U1_RESO_DWN_ABS (%d)\n", ret
);
552 pri_data
->x_active_len_mm
=
553 (pitch_x
* (sen_line_num_x
- 1)) / 10;
554 pri_data
->y_active_len_mm
=
555 (pitch_y
* (sen_line_num_y
- 1)) / 10;
558 (resolution
<< 2) * (sen_line_num_x
- 1);
561 (resolution
<< 2) * (sen_line_num_y
- 1);
564 ret
= u1_read_write_register(hdev
, ADDRESS_U1_PAD_BTN
,
567 dev_err(&hdev
->dev
, "failed U1_PAD_BTN (%d)\n", ret
);
570 if ((tmp
& 0x0F) == (tmp
& 0xF0) >> 4) {
571 pri_data
->btn_cnt
= (tmp
& 0x0F);
574 pri_data
->btn_cnt
= 1;
577 pri_data
->has_sp
= 0;
578 /* Check StickPointer device */
579 ret
= u1_read_write_register(hdev
, ADDRESS_U1_DEVICE_TYP
,
582 dev_err(&hdev
->dev
, "failed U1_DEVICE_TYP (%d)\n", ret
);
585 if (tmp
& U1_DEVTYPE_SP_SUPPORT
) {
586 dev_ctrl
|= U1_SP_ABS_MODE
;
587 ret
= u1_read_write_register(hdev
, ADDRESS_U1_DEV_CTRL_1
,
588 NULL
, dev_ctrl
, false);
590 dev_err(&hdev
->dev
, "failed SP mode (%d)\n", ret
);
594 ret
= u1_read_write_register(hdev
, ADDRESS_U1_SP_BTN
,
595 &pri_data
->sp_btn_info
, 0, true);
597 dev_err(&hdev
->dev
, "failed U1_SP_BTN (%d)\n", ret
);
600 pri_data
->has_sp
= 1;
602 pri_data
->max_fingers
= 5;
607 static int T4_init(struct hid_device
*hdev
, struct alps_dev
*pri_data
)
610 u8 tmp
, sen_line_num_x
, sen_line_num_y
;
612 ret
= t4_read_write_register(hdev
, T4_PRM_ID_CONFIG_3
, &tmp
, 0, true);
614 dev_err(&hdev
->dev
, "failed T4_PRM_ID_CONFIG_3 (%d)\n", ret
);
617 sen_line_num_x
= 16 + ((tmp
& 0x0F) | (tmp
& 0x08 ? 0xF0 : 0));
618 sen_line_num_y
= 12 + (((tmp
& 0xF0) >> 4) | (tmp
& 0x80 ? 0xF0 : 0));
620 pri_data
->x_max
= sen_line_num_x
* T4_COUNT_PER_ELECTRODE
;
621 pri_data
->x_min
= T4_COUNT_PER_ELECTRODE
;
622 pri_data
->y_max
= sen_line_num_y
* T4_COUNT_PER_ELECTRODE
;
623 pri_data
->y_min
= T4_COUNT_PER_ELECTRODE
;
624 pri_data
->x_active_len_mm
= pri_data
->y_active_len_mm
= 0;
625 pri_data
->btn_cnt
= 1;
627 ret
= t4_read_write_register(hdev
, PRM_SYS_CONFIG_1
, &tmp
, 0, true);
629 dev_err(&hdev
->dev
, "failed PRM_SYS_CONFIG_1 (%d)\n", ret
);
633 ret
= t4_read_write_register(hdev
, PRM_SYS_CONFIG_1
, NULL
, tmp
, false);
635 dev_err(&hdev
->dev
, "failed PRM_SYS_CONFIG_1 (%d)\n", ret
);
639 ret
= t4_read_write_register(hdev
, T4_PRM_FEED_CONFIG_1
,
640 NULL
, T4_I2C_ABS
, false);
642 dev_err(&hdev
->dev
, "failed T4_PRM_FEED_CONFIG_1 (%d)\n", ret
);
646 ret
= t4_read_write_register(hdev
, T4_PRM_FEED_CONFIG_4
, NULL
,
647 T4_FEEDCFG4_ADVANCED_ABS_ENABLE
, false);
649 dev_err(&hdev
->dev
, "failed T4_PRM_FEED_CONFIG_4 (%d)\n", ret
);
652 pri_data
->max_fingers
= 5;
653 pri_data
->has_sp
= 0;
658 static int alps_sp_open(struct input_dev
*dev
)
660 struct hid_device
*hid
= input_get_drvdata(dev
);
662 return hid_hw_open(hid
);
665 static void alps_sp_close(struct input_dev
*dev
)
667 struct hid_device
*hid
= input_get_drvdata(dev
);
672 static int alps_input_configured(struct hid_device
*hdev
, struct hid_input
*hi
)
674 struct alps_dev
*data
= hid_get_drvdata(hdev
);
675 struct input_dev
*input
= hi
->input
, *input2
;
681 hid_dbg(hdev
, "Opening low level driver\n");
682 ret
= hid_hw_open(hdev
);
686 /* Allow incoming hid reports */
687 hid_device_io_start(hdev
);
688 switch (data
->dev_type
) {
690 ret
= T4_init(hdev
, data
);
693 ret
= u1_init(hdev
, data
);
702 __set_bit(EV_ABS
, input
->evbit
);
703 input_set_abs_params(input
, ABS_MT_POSITION_X
,
704 data
->x_min
, data
->x_max
, 0, 0);
705 input_set_abs_params(input
, ABS_MT_POSITION_Y
,
706 data
->y_min
, data
->y_max
, 0, 0);
708 if (data
->x_active_len_mm
&& data
->y_active_len_mm
) {
709 res_x
= (data
->x_max
- 1) / data
->x_active_len_mm
;
710 res_y
= (data
->y_max
- 1) / data
->y_active_len_mm
;
712 input_abs_set_res(input
, ABS_MT_POSITION_X
, res_x
);
713 input_abs_set_res(input
, ABS_MT_POSITION_Y
, res_y
);
716 input_set_abs_params(input
, ABS_MT_PRESSURE
, 0, 64, 0, 0);
718 input_mt_init_slots(input
, data
->max_fingers
, INPUT_MT_POINTER
);
720 __set_bit(EV_KEY
, input
->evbit
);
722 if (data
->btn_cnt
== 1)
723 __set_bit(INPUT_PROP_BUTTONPAD
, input
->propbit
);
725 for (i
= 0; i
< data
->btn_cnt
; i
++)
726 __set_bit(BTN_LEFT
+ i
, input
->keybit
);
728 /* Stick device initialization */
730 input2
= input_allocate_device();
736 data
->input2
= input2
;
737 input2
->phys
= input
->phys
;
738 input2
->name
= "DualPoint Stick";
739 input2
->id
.bustype
= BUS_I2C
;
740 input2
->id
.vendor
= input
->id
.vendor
;
741 input2
->id
.product
= input
->id
.product
;
742 input2
->id
.version
= input
->id
.version
;
743 input2
->dev
.parent
= input
->dev
.parent
;
745 input_set_drvdata(input2
, hdev
);
746 input2
->open
= alps_sp_open
;
747 input2
->close
= alps_sp_close
;
749 __set_bit(EV_KEY
, input2
->evbit
);
750 data
->sp_btn_cnt
= (data
->sp_btn_info
& 0x0F);
751 for (i
= 0; i
< data
->sp_btn_cnt
; i
++)
752 __set_bit(BTN_LEFT
+ i
, input2
->keybit
);
754 __set_bit(EV_REL
, input2
->evbit
);
755 __set_bit(REL_X
, input2
->relbit
);
756 __set_bit(REL_Y
, input2
->relbit
);
757 __set_bit(INPUT_PROP_POINTER
, input2
->propbit
);
758 __set_bit(INPUT_PROP_POINTING_STICK
, input2
->propbit
);
760 if (input_register_device(data
->input2
)) {
761 input_free_device(input2
);
767 hid_device_io_stop(hdev
);
772 static int alps_input_mapping(struct hid_device
*hdev
,
773 struct hid_input
*hi
, struct hid_field
*field
,
774 struct hid_usage
*usage
, unsigned long **bit
, int *max
)
779 static int alps_probe(struct hid_device
*hdev
, const struct hid_device_id
*id
)
781 struct alps_dev
*data
= NULL
;
783 data
= devm_kzalloc(&hdev
->dev
, sizeof(struct alps_dev
), GFP_KERNEL
);
788 hid_set_drvdata(hdev
, data
);
790 hdev
->quirks
|= HID_QUIRK_NO_INIT_REPORTS
;
792 ret
= hid_parse(hdev
);
794 hid_err(hdev
, "parse failed\n");
798 switch (hdev
->product
) {
799 case HID_DEVICE_ID_ALPS_T4_BTNLESS
:
802 case HID_DEVICE_ID_ALPS_U1_DUAL
:
803 case HID_DEVICE_ID_ALPS_U1
:
804 case HID_DEVICE_ID_ALPS_U1_UNICORN_LEGACY
:
808 data
->dev_type
= UNKNOWN
;
811 ret
= hid_hw_start(hdev
, HID_CONNECT_DEFAULT
);
813 hid_err(hdev
, "hw start failed\n");
820 static void alps_remove(struct hid_device
*hdev
)
825 static const struct hid_device_id alps_id
[] = {
826 { HID_DEVICE(HID_BUS_ANY
, HID_GROUP_ANY
,
827 USB_VENDOR_ID_ALPS_JP
, HID_DEVICE_ID_ALPS_U1_DUAL
) },
828 { HID_DEVICE(HID_BUS_ANY
, HID_GROUP_ANY
,
829 USB_VENDOR_ID_ALPS_JP
, HID_DEVICE_ID_ALPS_U1
) },
830 { HID_DEVICE(HID_BUS_ANY
, HID_GROUP_ANY
,
831 USB_VENDOR_ID_ALPS_JP
, HID_DEVICE_ID_ALPS_T4_BTNLESS
) },
834 MODULE_DEVICE_TABLE(hid
, alps_id
);
836 static struct hid_driver alps_driver
= {
840 .remove
= alps_remove
,
841 .raw_event
= alps_raw_event
,
842 .input_mapping
= alps_input_mapping
,
843 .input_configured
= alps_input_configured
,
845 .resume
= alps_post_resume
,
846 .reset_resume
= alps_post_reset
,
850 module_hid_driver(alps_driver
);
852 MODULE_AUTHOR("Masaki Ota <masaki.ota@jp.alps.com>");
853 MODULE_DESCRIPTION("ALPS HID driver");
854 MODULE_LICENSE("GPL");