Lines Matching refs:nd
177 struct ntrig_data *nd = hid_get_drvdata(hdev); in show_phys_width() local
179 return sprintf(buf, "%d\n", nd->sensor_physical_width); in show_phys_width()
189 struct ntrig_data *nd = hid_get_drvdata(hdev); in show_phys_height() local
191 return sprintf(buf, "%d\n", nd->sensor_physical_height); in show_phys_height()
201 struct ntrig_data *nd = hid_get_drvdata(hdev); in show_log_width() local
203 return sprintf(buf, "%d\n", nd->sensor_logical_width); in show_log_width()
213 struct ntrig_data *nd = hid_get_drvdata(hdev); in show_log_height() local
215 return sprintf(buf, "%d\n", nd->sensor_logical_height); in show_log_height()
225 struct ntrig_data *nd = hid_get_drvdata(hdev); in show_min_width() local
227 return sprintf(buf, "%d\n", nd->min_width * in show_min_width()
228 nd->sensor_physical_width / in show_min_width()
229 nd->sensor_logical_width); in show_min_width()
237 struct ntrig_data *nd = hid_get_drvdata(hdev); in set_min_width() local
244 if (val > nd->sensor_physical_width) in set_min_width()
247 nd->min_width = val * nd->sensor_logical_width / in set_min_width()
248 nd->sensor_physical_width; in set_min_width()
260 struct ntrig_data *nd = hid_get_drvdata(hdev); in show_min_height() local
262 return sprintf(buf, "%d\n", nd->min_height * in show_min_height()
263 nd->sensor_physical_height / in show_min_height()
264 nd->sensor_logical_height); in show_min_height()
272 struct ntrig_data *nd = hid_get_drvdata(hdev); in set_min_height() local
279 if (val > nd->sensor_physical_height) in set_min_height()
282 nd->min_height = val * nd->sensor_logical_height / in set_min_height()
283 nd->sensor_physical_height; in set_min_height()
296 struct ntrig_data *nd = hid_get_drvdata(hdev); in show_activate_slack() local
298 return sprintf(buf, "%d\n", nd->activate_slack); in show_activate_slack()
306 struct ntrig_data *nd = hid_get_drvdata(hdev); in set_activate_slack() local
316 nd->activate_slack = val; in set_activate_slack()
329 struct ntrig_data *nd = hid_get_drvdata(hdev); in show_activation_width() local
331 return sprintf(buf, "%d\n", nd->activation_width * in show_activation_width()
332 nd->sensor_physical_width / in show_activation_width()
333 nd->sensor_logical_width); in show_activation_width()
341 struct ntrig_data *nd = hid_get_drvdata(hdev); in set_activation_width() local
348 if (val > nd->sensor_physical_width) in set_activation_width()
351 nd->activation_width = val * nd->sensor_logical_width / in set_activation_width()
352 nd->sensor_physical_width; in set_activation_width()
365 struct ntrig_data *nd = hid_get_drvdata(hdev); in show_activation_height() local
367 return sprintf(buf, "%d\n", nd->activation_height * in show_activation_height()
368 nd->sensor_physical_height / in show_activation_height()
369 nd->sensor_logical_height); in show_activation_height()
377 struct ntrig_data *nd = hid_get_drvdata(hdev); in set_activation_height() local
384 if (val > nd->sensor_physical_height) in set_activation_height()
387 nd->activation_height = val * nd->sensor_logical_height / in set_activation_height()
388 nd->sensor_physical_height; in set_activation_height()
401 struct ntrig_data *nd = hid_get_drvdata(hdev); in show_deactivate_slack() local
403 return sprintf(buf, "%d\n", -nd->deactivate_slack); in show_deactivate_slack()
411 struct ntrig_data *nd = hid_get_drvdata(hdev); in set_deactivate_slack() local
426 nd->deactivate_slack = -val; in set_deactivate_slack()
462 struct ntrig_data *nd = hid_get_drvdata(hdev); in ntrig_input_mapping() local
478 if (!nd->sensor_logical_width) { in ntrig_input_mapping()
479 nd->sensor_logical_width = in ntrig_input_mapping()
482 nd->sensor_physical_width = in ntrig_input_mapping()
485 nd->activation_width = activation_width * in ntrig_input_mapping()
486 nd->sensor_logical_width / in ntrig_input_mapping()
487 nd->sensor_physical_width; in ntrig_input_mapping()
488 nd->min_width = min_width * in ntrig_input_mapping()
489 nd->sensor_logical_width / in ntrig_input_mapping()
490 nd->sensor_physical_width; in ntrig_input_mapping()
500 if (!nd->sensor_logical_height) { in ntrig_input_mapping()
501 nd->sensor_logical_height = in ntrig_input_mapping()
504 nd->sensor_physical_height = in ntrig_input_mapping()
507 nd->activation_height = activation_height * in ntrig_input_mapping()
508 nd->sensor_logical_height / in ntrig_input_mapping()
509 nd->sensor_physical_height; in ntrig_input_mapping()
510 nd->min_height = min_height * in ntrig_input_mapping()
511 nd->sensor_logical_height / in ntrig_input_mapping()
512 nd->sensor_physical_height; in ntrig_input_mapping()
573 struct ntrig_data *nd = hid_get_drvdata(hid); in ntrig_event() local
594 nd->reading_mt = 1; in ntrig_event()
595 nd->first_contact_touch = 0; in ntrig_event()
598 nd->tipswitch = value; in ntrig_event()
602 nd->confidence = value; in ntrig_event()
605 nd->x = value; in ntrig_event()
607 nd->mt_foot_count = 0; in ntrig_event()
610 nd->y = value; in ntrig_event()
613 nd->id = value; in ntrig_event()
616 nd->w = value; in ntrig_event()
619 nd->h = value; in ntrig_event()
625 if (!nd->reading_mt) { in ntrig_event()
631 nd->tipswitch); in ntrig_event()
633 nd->tipswitch); in ntrig_event()
634 input_event(input, EV_ABS, ABS_X, nd->x); in ntrig_event()
635 input_event(input, EV_ABS, ABS_Y, nd->y); in ntrig_event()
647 if (nd->mt_foot_count >= 4) in ntrig_event()
650 nd->mt_footer[nd->mt_foot_count++] = value; in ntrig_event()
653 if (nd->mt_foot_count != 4) in ntrig_event()
657 if (nd->mt_footer[2]) { in ntrig_event()
665 nd->act_state = deactivate_slack - 1; in ntrig_event()
666 nd->confidence = 0; in ntrig_event()
674 if (nd->mt_footer[0]) { in ntrig_event()
680 if (nd->w < nd->min_width || in ntrig_event()
681 nd->h < nd->min_height) in ntrig_event()
682 nd->confidence = 0; in ntrig_event()
686 if (nd->act_state > 0) { in ntrig_event()
690 if (nd->w >= nd->activation_width && in ntrig_event()
691 nd->h >= nd->activation_height) { in ntrig_event()
692 if (nd->id) in ntrig_event()
696 nd->act_state = 0; in ntrig_event()
703 nd->act_state = 1; in ntrig_event()
715 if (!nd->confidence) in ntrig_event()
719 if (nd->id == 0) { in ntrig_event()
726 nd->first_contact_touch = nd->confidence; in ntrig_event()
727 input_event(input, EV_ABS, ABS_X, nd->x); in ntrig_event()
728 input_event(input, EV_ABS, ABS_Y, nd->y); in ntrig_event()
732 input_event(input, EV_ABS, ABS_MT_POSITION_X, nd->x); in ntrig_event()
733 input_event(input, EV_ABS, ABS_MT_POSITION_Y, nd->y); in ntrig_event()
739 if (nd->w > nd->h) { in ntrig_event()
743 ABS_MT_TOUCH_MAJOR, nd->w); in ntrig_event()
745 ABS_MT_TOUCH_MINOR, nd->h); in ntrig_event()
750 ABS_MT_TOUCH_MAJOR, nd->h); in ntrig_event()
752 ABS_MT_TOUCH_MINOR, nd->w); in ntrig_event()
758 if (!nd->reading_mt) /* Just to be sure */ in ntrig_event()
761 nd->reading_mt = 0; in ntrig_event()
785 if (nd->act_state > 0) { /* Currently inactive */ in ntrig_event()
791 nd->act_state = (nd->act_state > value) in ntrig_event()
792 ? nd->act_state - value in ntrig_event()
799 nd->act_state = nd->activate_slack; in ntrig_event()
808 if (value && nd->act_state >= in ntrig_event()
809 nd->deactivate_slack) in ntrig_event()
814 nd->act_state = 0; in ntrig_event()
815 else if (nd->act_state <= nd->deactivate_slack) in ntrig_event()
820 nd->act_state = in ntrig_event()
821 nd->activate_slack; in ntrig_event()
823 nd->act_state--; in ntrig_event()
828 if (nd->first_contact_touch && nd->act_state <= 0) { in ntrig_event()
900 struct ntrig_data *nd; in ntrig_probe() local
907 nd = kmalloc(sizeof(struct ntrig_data), GFP_KERNEL); in ntrig_probe()
908 if (!nd) { in ntrig_probe()
913 nd->reading_mt = 0; in ntrig_probe()
914 nd->min_width = 0; in ntrig_probe()
915 nd->min_height = 0; in ntrig_probe()
916 nd->activate_slack = activate_slack; in ntrig_probe()
917 nd->act_state = activate_slack; in ntrig_probe()
918 nd->deactivate_slack = -deactivate_slack; in ntrig_probe()
919 nd->sensor_logical_width = 1; in ntrig_probe()
920 nd->sensor_logical_height = 1; in ntrig_probe()
921 nd->sensor_physical_width = 1; in ntrig_probe()
922 nd->sensor_physical_height = 1; in ntrig_probe()
924 hid_set_drvdata(hdev, nd); in ntrig_probe()
961 kfree(nd); in ntrig_probe()