123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143 |
- /*
- * pt_mta.c
- * Parade TrueTouch(TM) Standard Product Multi-Touch Protocol A Module.
- * For use with Parade touchscreen controllers.
- * Supported parts include:
- * TMA5XX
- * TMA448
- * TMA445A
- * TT21XXX
- * TT31XXX
- * TT4XXXX
- * TT7XXX
- * TC3XXX
- *
- * Copyright (C) 2015-2020 Parade Technologies
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * version 2, and only version 2, as published by the
- * Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * Contact Parade Technologies at www.paradetech.com <[email protected]>
- */
- #include "pt_regs.h"
- /*******************************************************************************
- * FUNCTION: pt_final_sync
- *
- * SUMMARY: Function to create SYN_REPORT
- *
- * PARAMETERS:
- * *input - pointer to input device structure
- * max_slots - max support touch number
- * mt_sync_count - current valid touch number
- * ids - bit map value
- ******************************************************************************/
- static void pt_final_sync(struct input_dev *input, int max_slots,
- int mt_sync_count, unsigned long *ids)
- {
- if (mt_sync_count)
- input_sync(input);
- }
- /*******************************************************************************
- * FUNCTION: pt_input_sync
- *
- * SUMMARY: Function to create SYN_MT_REPORT
- *
- * PARAMETERS:
- * *input - pointer to input device structure
- ******************************************************************************/
- static void pt_input_sync(struct input_dev *input)
- {
- input_mt_sync(input);
- }
- /*******************************************************************************
- * FUNCTION: pt_input_report
- *
- * SUMMARY: Function to report coordinate information of touch point
- * protocol
- *
- * PARAMETERS:
- * *input - pointer to input device structure
- * sig - track id to allow tracking of a touch
- * t - event id to indicate an event associated with touch instance
- * type - indicate the touch object
- ******************************************************************************/
- static void pt_input_report(struct input_dev *input, int sig,
- int t, int type)
- {
- if (type == PT_OBJ_STANDARD_FINGER || type == PT_OBJ_GLOVE) {
- input_report_key(input, BTN_TOOL_FINGER, PT_BTN_PRESSED);
- input_report_key(input, BTN_TOOL_PEN, PT_BTN_RELEASED);
- } else if (type == PT_OBJ_STYLUS) {
- input_report_key(input, BTN_TOOL_PEN, PT_BTN_PRESSED);
- input_report_key(input, BTN_TOOL_FINGER, PT_BTN_RELEASED);
- }
- input_report_key(input, BTN_TOUCH, PT_BTN_PRESSED);
- input_report_abs(input, sig, t);
- }
- /*******************************************************************************
- * FUNCTION: pt_report_slot_liftoff
- *
- * SUMMARY: Function to report all touches are lifted
- * protocol
- *
- * PARAMETERS:
- * *md - pointer to input device structure
- * max_slots - indicate max number of touch id
- ******************************************************************************/
- static void pt_report_slot_liftoff(struct pt_mt_data *md,
- int max_slots)
- {
- input_report_key(md->input, BTN_TOUCH, PT_BTN_RELEASED);
- input_report_key(md->input, BTN_TOOL_FINGER, PT_BTN_RELEASED);
- input_report_key(md->input, BTN_TOOL_PEN, PT_BTN_RELEASED);
- }
- /*******************************************************************************
- * FUNCTION: pt_input_register_device
- *
- * SUMMARY: Function to register input device
- * protocol
- *
- * PARAMETERS:
- * *input - pointer to input device structure
- * max_slots - indicate max number of touch id
- ******************************************************************************/
- static int pt_input_register_device(struct input_dev *input, int max_slots)
- {
- __set_bit(BTN_TOUCH, input->keybit);
- __set_bit(BTN_TOOL_FINGER, input->keybit);
- __set_bit(BTN_TOOL_PEN, input->keybit);
- return input_register_device(input);
- }
- /*******************************************************************************
- * FUNCTION: pt_init_function_ptrs
- *
- * SUMMARY: Function to init function pointer
- *
- * PARAMETERS:
- * *md - pointer to touch data structure
- ******************************************************************************/
- void pt_init_function_ptrs(struct pt_mt_data *md)
- {
- md->mt_function.report_slot_liftoff = pt_report_slot_liftoff;
- md->mt_function.final_sync = pt_final_sync;
- md->mt_function.input_sync = pt_input_sync;
- md->mt_function.input_report = pt_input_report;
- md->mt_function.input_register_device = pt_input_register_device;
- }
|