Lines Matching +full:hi +full:- +full:z
1 // SPDX-License-Identifier: GPL-2.0-or-later
12 #include "hid-ids.h"
28 #define U1_ABSOLUTE_REPORT_ID_SECD 0x02 /* FW-PTP Absolute data ReportID */
147 length -= tlen; in t4_calc_check_sum()
153 } while (--tlen > 0); in t4_calc_check_sum()
175 return -ENOMEM; in t4_read_write_register()
200 dev_err(&hdev->dev, "failed to read command (%d)\n", ret); in t4_read_write_register()
207 ret = -ENOMEM; in t4_read_write_register()
215 dev_err(&hdev->dev, "failed read register (%d)\n", ret); in t4_read_write_register()
219 ret = -EINVAL; in t4_read_write_register()
222 dev_err(&hdev->dev, "read register address error (%x,%x)\n", in t4_read_write_register()
228 dev_err(&hdev->dev, "read register size error (%x)\n", in t4_read_write_register()
235 dev_err(&hdev->dev, "read register checksum error (%x,%x)\n", in t4_read_write_register()
262 return -ENOMEM; in u1_read_write_register()
277 for (i = 0; i < U1_FEATURE_REPORT_LEN - 1; i++) in u1_read_write_register()
286 dev_err(&hdev->dev, "failed to read command (%d)\n", ret); in u1_read_write_register()
293 ret = -ENOMEM; in u1_read_write_register()
302 dev_err(&hdev->dev, "failed read register (%d)\n", ret); in u1_read_write_register()
321 unsigned int x, y, z; in t4_raw_event() local
327 for (i = 0; i < hdata->max_fingers; i++) { in t4_raw_event()
328 x = p_report->contact[i].x_hi << 8 | p_report->contact[i].x_lo; in t4_raw_event()
329 y = p_report->contact[i].y_hi << 8 | p_report->contact[i].y_lo; in t4_raw_event()
330 y = hdata->y_max - y + hdata->y_min; in t4_raw_event()
331 z = (p_report->contact[i].palm < 0x80 && in t4_raw_event()
332 p_report->contact[i].palm > 0) * 62; in t4_raw_event()
336 z = 0; in t4_raw_event()
338 input_mt_slot(hdata->input, i); in t4_raw_event()
340 input_mt_report_slot_state(hdata->input, in t4_raw_event()
341 MT_TOOL_FINGER, z != 0); in t4_raw_event()
343 if (!z) in t4_raw_event()
346 input_report_abs(hdata->input, ABS_MT_POSITION_X, x); in t4_raw_event()
347 input_report_abs(hdata->input, ABS_MT_POSITION_Y, y); in t4_raw_event()
348 input_report_abs(hdata->input, ABS_MT_PRESSURE, z); in t4_raw_event()
350 input_mt_sync_frame(hdata->input); in t4_raw_event()
352 input_report_key(hdata->input, BTN_LEFT, p_report->button); in t4_raw_event()
354 input_sync(hdata->input); in t4_raw_event()
360 unsigned int x, y, z; in u1_raw_event() local
373 for (i = 0; i < hdata->max_fingers; i++) { in u1_raw_event()
378 z = contact[7] & 0x7F; in u1_raw_event()
380 input_mt_slot(hdata->input, i); in u1_raw_event()
382 if (z != 0) { in u1_raw_event()
383 input_mt_report_slot_state(hdata->input, in u1_raw_event()
385 input_report_abs(hdata->input, in u1_raw_event()
387 input_report_abs(hdata->input, in u1_raw_event()
389 input_report_abs(hdata->input, in u1_raw_event()
390 ABS_MT_PRESSURE, z); in u1_raw_event()
392 input_mt_report_slot_inactive(hdata->input); in u1_raw_event()
396 input_mt_sync_frame(hdata->input); in u1_raw_event()
398 input_report_key(hdata->input, BTN_LEFT, in u1_raw_event()
400 input_report_key(hdata->input, BTN_RIGHT, in u1_raw_event()
402 input_report_key(hdata->input, BTN_MIDDLE, in u1_raw_event()
405 input_sync(hdata->input); in u1_raw_event()
416 input_report_rel(hdata->input2, REL_X, sp_x); in u1_raw_event()
417 input_report_rel(hdata->input2, REL_Y, sp_y); in u1_raw_event()
419 input_report_key(hdata->input2, BTN_LEFT, in u1_raw_event()
421 input_report_key(hdata->input2, BTN_RIGHT, in u1_raw_event()
423 input_report_key(hdata->input2, BTN_MIDDLE, in u1_raw_event()
426 input_sync(hdata->input2); in u1_raw_event()
440 switch (hdev->product) { in alps_raw_event()
453 int ret = -1; in alps_post_reset()
456 switch (data->dev_type) { in alps_post_reset()
461 dev_err(&hdev->dev, "failed T4_PRM_FEED_CONFIG_1 (%d)\n", in alps_post_reset()
469 dev_err(&hdev->dev, "failed T4_PRM_FEED_CONFIG_4 (%d)\n", in alps_post_reset()
479 dev_err(&hdev->dev, "failed to change TP mode (%d)\n", in alps_post_reset()
507 dev_err(&hdev->dev, "failed U1_DEV_CTRL_1 (%d)\n", ret); in u1_init()
516 dev_err(&hdev->dev, "failed to change TP mode (%d)\n", ret); in u1_init()
523 dev_err(&hdev->dev, "failed U1_NUM_SENS_X (%d)\n", ret); in u1_init()
530 dev_err(&hdev->dev, "failed U1_NUM_SENS_Y (%d)\n", ret); in u1_init()
537 dev_err(&hdev->dev, "failed U1_PITCH_SENS_X (%d)\n", ret); in u1_init()
544 dev_err(&hdev->dev, "failed U1_PITCH_SENS_Y (%d)\n", ret); in u1_init()
551 dev_err(&hdev->dev, "failed U1_RESO_DWN_ABS (%d)\n", ret); in u1_init()
554 pri_data->x_active_len_mm = in u1_init()
555 (pitch_x * (sen_line_num_x - 1)) / 10; in u1_init()
556 pri_data->y_active_len_mm = in u1_init()
557 (pitch_y * (sen_line_num_y - 1)) / 10; in u1_init()
559 pri_data->x_max = in u1_init()
560 (resolution << 2) * (sen_line_num_x - 1); in u1_init()
561 pri_data->x_min = 1; in u1_init()
562 pri_data->y_max = in u1_init()
563 (resolution << 2) * (sen_line_num_y - 1); in u1_init()
564 pri_data->y_min = 1; in u1_init()
569 dev_err(&hdev->dev, "failed U1_PAD_BTN (%d)\n", ret); in u1_init()
573 pri_data->btn_cnt = (tmp & 0x0F); in u1_init()
576 pri_data->btn_cnt = 1; in u1_init()
579 pri_data->has_sp = 0; in u1_init()
584 dev_err(&hdev->dev, "failed U1_DEVICE_TYP (%d)\n", ret); in u1_init()
592 dev_err(&hdev->dev, "failed SP mode (%d)\n", ret); in u1_init()
597 &pri_data->sp_btn_info, 0, true); in u1_init()
599 dev_err(&hdev->dev, "failed U1_SP_BTN (%d)\n", ret); in u1_init()
602 pri_data->has_sp = 1; in u1_init()
604 pri_data->max_fingers = 5; in u1_init()
616 dev_err(&hdev->dev, "failed T4_PRM_ID_CONFIG_3 (%d)\n", ret); in T4_init()
622 pri_data->x_max = sen_line_num_x * T4_COUNT_PER_ELECTRODE; in T4_init()
623 pri_data->x_min = T4_COUNT_PER_ELECTRODE; in T4_init()
624 pri_data->y_max = sen_line_num_y * T4_COUNT_PER_ELECTRODE; in T4_init()
625 pri_data->y_min = T4_COUNT_PER_ELECTRODE; in T4_init()
626 pri_data->x_active_len_mm = pri_data->y_active_len_mm = 0; in T4_init()
627 pri_data->btn_cnt = 1; in T4_init()
631 dev_err(&hdev->dev, "failed PRM_SYS_CONFIG_1 (%d)\n", ret); in T4_init()
637 dev_err(&hdev->dev, "failed PRM_SYS_CONFIG_1 (%d)\n", ret); in T4_init()
644 dev_err(&hdev->dev, "failed T4_PRM_FEED_CONFIG_1 (%d)\n", ret); in T4_init()
651 dev_err(&hdev->dev, "failed T4_PRM_FEED_CONFIG_4 (%d)\n", ret); in T4_init()
654 pri_data->max_fingers = 5; in T4_init()
655 pri_data->has_sp = 0; in T4_init()
674 static int alps_input_configured(struct hid_device *hdev, struct hid_input *hi) in alps_input_configured() argument
677 struct input_dev *input = hi->input, *input2; in alps_input_configured()
681 data->input = input; in alps_input_configured()
690 switch (data->dev_type) { in alps_input_configured()
704 __set_bit(EV_ABS, input->evbit); in alps_input_configured()
706 data->x_min, data->x_max, 0, 0); in alps_input_configured()
708 data->y_min, data->y_max, 0, 0); in alps_input_configured()
710 if (data->x_active_len_mm && data->y_active_len_mm) { in alps_input_configured()
711 res_x = (data->x_max - 1) / data->x_active_len_mm; in alps_input_configured()
712 res_y = (data->y_max - 1) / data->y_active_len_mm; in alps_input_configured()
720 input_mt_init_slots(input, data->max_fingers, INPUT_MT_POINTER); in alps_input_configured()
722 __set_bit(EV_KEY, input->evbit); in alps_input_configured()
724 if (data->btn_cnt == 1) in alps_input_configured()
725 __set_bit(INPUT_PROP_BUTTONPAD, input->propbit); in alps_input_configured()
727 for (i = 0; i < data->btn_cnt; i++) in alps_input_configured()
728 __set_bit(BTN_LEFT + i, input->keybit); in alps_input_configured()
731 if (data->has_sp) { in alps_input_configured()
734 ret = -ENOMEM; in alps_input_configured()
738 data->input2 = input2; in alps_input_configured()
739 input2->phys = input->phys; in alps_input_configured()
740 input2->name = "DualPoint Stick"; in alps_input_configured()
741 input2->id.bustype = BUS_I2C; in alps_input_configured()
742 input2->id.vendor = input->id.vendor; in alps_input_configured()
743 input2->id.product = input->id.product; in alps_input_configured()
744 input2->id.version = input->id.version; in alps_input_configured()
745 input2->dev.parent = input->dev.parent; in alps_input_configured()
748 input2->open = alps_sp_open; in alps_input_configured()
749 input2->close = alps_sp_close; in alps_input_configured()
751 __set_bit(EV_KEY, input2->evbit); in alps_input_configured()
752 data->sp_btn_cnt = (data->sp_btn_info & 0x0F); in alps_input_configured()
753 for (i = 0; i < data->sp_btn_cnt; i++) in alps_input_configured()
754 __set_bit(BTN_LEFT + i, input2->keybit); in alps_input_configured()
756 __set_bit(EV_REL, input2->evbit); in alps_input_configured()
757 __set_bit(REL_X, input2->relbit); in alps_input_configured()
758 __set_bit(REL_Y, input2->relbit); in alps_input_configured()
759 __set_bit(INPUT_PROP_POINTER, input2->propbit); in alps_input_configured()
760 __set_bit(INPUT_PROP_POINTING_STICK, input2->propbit); in alps_input_configured()
762 if (input_register_device(data->input2)) { in alps_input_configured()
764 ret = -ENOENT; in alps_input_configured()
776 struct hid_input *hi, struct hid_field *field, in alps_input_mapping() argument
779 return -1; in alps_input_mapping()
786 data = devm_kzalloc(&hdev->dev, sizeof(struct alps_dev), GFP_KERNEL); in alps_probe()
788 return -ENOMEM; in alps_probe()
790 data->hdev = hdev; in alps_probe()
793 hdev->quirks |= HID_QUIRK_NO_INIT_REPORTS; in alps_probe()
801 switch (hdev->product) { in alps_probe()
803 data->dev_type = T4; in alps_probe()
808 data->dev_type = U1; in alps_probe()
811 data->dev_type = UNKNOWN; in alps_probe()
837 .name = "hid-alps",