예제 #1
0
/*******************************************************
Function:
	Touch down report function.

Input:
	ts:private data.
	id:tracking id.
	x:input x.
	y:input y.
	w:input weight.
	
Output:
	None.
*******************************************************/
static void gtp_touch_down(struct goodix_ts_data* ts,s32 id,s32 x,s32 y,s32 w)
{
#if GTP_CHANGE_X2Y
    GTP_SWAP(x, y);
#endif

#if GTP_ICS_SLOT_REPORT
	
    input_mt_slot(ts->input_dev, id);
	input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, true);
	input_report_abs(ts->input_dev, ABS_MT_TOUCH_MAJOR, 1);
       //input_report_abs(ts->input_dev, ABS_MT_TRACKING_ID, id);
    input_report_abs(ts->input_dev, ABS_MT_POSITION_X, x);
    input_report_abs(ts->input_dev, ABS_MT_POSITION_Y, y);
    input_report_abs(ts->input_dev, ABS_MT_PRESSURE, w);
	
#else
	input_mt_slot(ts->input_dev, id);
	input_mt_report_slot_state(ts->input_dev, MT_TOOL_FINGER, true);
    //input_report_abs(ts->input_dev, ABS_MT_TRACKING_ID, id);
    input_report_abs(ts->input_dev, ABS_MT_POSITION_X, x);
    input_report_abs(ts->input_dev, ABS_MT_POSITION_Y, y);
    input_report_abs(ts->input_dev, ABS_MT_TOUCH_MAJOR, w);
    input_report_abs(ts->input_dev, ABS_MT_WIDTH_MAJOR, w);
    input_report_abs(ts->input_dev, ABS_MT_TRACKING_ID, id);
    //input_mt_sync(ts->input_dev);
#endif

    GTP_DEBUG("======ID:%d, X:%d, Y:%d, W:%d======", id, x, y, w);
}
예제 #2
0
/*******************************************************
Function:
	Touch down report function.

Input:
	ts:private data.
	id:tracking id.
	x:input x.
	y:input y.
	w:input weight.
	
Output:
	None.
*******************************************************/
static void gtp_touch_down(struct goodix_platform_data* ts,s32 id,s32 x,s32 y,s32 w)
{
#if GTP_CHANGE_X2Y
    GTP_SWAP(x, y);
#endif

#if GTP_ICS_SLOT_REPORT
    input_mt_slot(ts->input_dev, id);
    input_report_abs(ts->input_dev, ABS_MT_TRACKING_ID, id);
    input_report_abs(ts->input_dev, ABS_MT_POSITION_X, x);
    input_report_abs(ts->input_dev, ABS_MT_POSITION_Y, y);
    input_report_abs(ts->input_dev, ABS_MT_TOUCH_MAJOR, w);
    input_report_abs(ts->input_dev, ABS_MT_WIDTH_MAJOR, w);
#else
    input_report_abs(ts->input_dev, ABS_MT_POSITION_X, x);
    input_report_abs(ts->input_dev, ABS_MT_POSITION_Y, y);
    input_report_abs(ts->input_dev, ABS_MT_TOUCH_MAJOR, w);
    input_report_abs(ts->input_dev, ABS_MT_WIDTH_MAJOR, w);
    input_report_abs(ts->input_dev, ABS_MT_TRACKING_ID, id);
    input_mt_sync(ts->input_dev);
#endif

    GTP_DEBUG("ID:%d, X:%d, Y:%d, W:%d", id, x, y, w);
}
/*******************************************************
Function:
	Touch down report function.

Input:
	ts:private data.
	id:tracking id.
	x:input x.
	y:input y.
	w:input weight.

Output:
	None.
*******************************************************/
static void gtp_touch_down(struct goodix_ts_data* ts,s32 id,s32 x,s32 y,s32 w)
{
    if (goodix_pdata->xpol)
        x = ts->abs_x_max - x;
    if (goodix_pdata->ypol)
        y = ts->abs_y_max - y;

#if MAL_EDGE_CAL_PERCENT
    u8 i, j;
    u16 max_res, cal_range, cal_max_offset, cal_offset;
    u16 * curr_res;

    for (i = 0; i < 2; i++)
    {
        max_res = (i == 0) ? ts->abs_x_max : ts->abs_y_max;
        curr_res = (i == 0) ? &x : &y;
        cal_range = max_res * MAL_EDGE_CAL_PERCENT / 100;

        cal_max_offset = cal_range / MAL_EDGE_CAL_OFFSET_RATE;

        for (j = 0; j < 2; j++)
        {
            if (j != 0)		// process right end
            {
                *curr_res = max_res - *curr_res;
            }
            if (*curr_res < cal_range)
            {
                if (*curr_res < cal_max_offset)
                {
                    if (*curr_res > 7)
                        *curr_res = (*curr_res * 8 - 40) / 3;
                }
                else
                {
                    cal_offset = cal_max_offset - *curr_res / MAL_EDGE_CAL_OFFSET_RATE;
                    *curr_res += cal_offset;
                }
            }
            if (j != 0)
            {
                *curr_res = max_res - *curr_res;
            }
        }
    }

    GTP_DEBUG("<YLM>, max_res:%d, curr_res:%d, cal_range:%d, cal_offset:%d.", max_res, *curr_res, cal_range, cal_offset);
#endif

#if MAL_FIX_EDGE_POINT
    if (x < MAL_FIX_EDGE_POINT)
        x = MAL_FIX_EDGE_POINT;
    if (x > ts->abs_x_max - MAL_FIX_EDGE_POINT)
        x = ts->abs_x_max - MAL_FIX_EDGE_POINT;
    if (y < MAL_FIX_EDGE_POINT)
        y = MAL_FIX_EDGE_POINT;
    if (y > ts->abs_y_max - MAL_FIX_EDGE_POINT)
        y = ts->abs_y_max - MAL_FIX_EDGE_POINT;
#endif

#if GTP_CHANGE_X2Y
    GTP_SWAP(x, y);
#else
    if (goodix_pdata->swap_xy)
        GTP_SWAP(x, y);
#endif

#if GTP_ICS_SLOT_REPORT
    input_mt_slot(ts->input_dev, id);
    input_report_abs(ts->input_dev, ABS_MT_TRACKING_ID, id);
    input_report_abs(ts->input_dev, ABS_MT_POSITION_X, x);
    input_report_abs(ts->input_dev, ABS_MT_POSITION_Y, y);
    input_report_abs(ts->input_dev, ABS_MT_PRESSURE, w);
#else
    input_report_abs(ts->input_dev, ABS_MT_POSITION_X, x);
    input_report_abs(ts->input_dev, ABS_MT_POSITION_Y, y);
    input_report_abs(ts->input_dev, ABS_MT_TOUCH_MAJOR, w);
    input_report_abs(ts->input_dev, ABS_MT_WIDTH_MAJOR, w);
    input_report_abs(ts->input_dev, ABS_MT_TRACKING_ID, id);
    input_mt_sync(ts->input_dev);
#endif
    GTP_DEBUG("ID:%d, X:%d, Y:%d, W:%d", id, x, y, w);
}