diff --git a/drivers/input/touchscreen/ucb1400_ts.c b/drivers/input/touchscreen/ucb1400_ts.c index 28be8139475418b5030436f4e32d4c131de924a2..064cf4f93b0315bf57aca67dd34a22e8055042bd 100644 --- a/drivers/input/touchscreen/ucb1400_ts.c +++ b/drivers/input/touchscreen/ucb1400_ts.c @@ -211,7 +211,7 @@ static void ucb1400_poll_touch(struct ucb1400_ts *ucb, struct touch_data *data) int hys_down = SECO_INF_DOWN_HYSTERESIS; - unsigned next_sleep = 0; + unsigned next_sleep = 0, timestamp = jiffies_to_msecs(jiffies); /* Start with a small delay before checking pendown state */ msleep(UCB1400_TS_POLL_PERIOD); @@ -234,6 +234,7 @@ static void ucb1400_poll_touch(struct ucb1400_ts *ucb, struct touch_data *data) if (!penup) { is_pendown = true; + is_penup = false; ucb1400_adc_enable(ucb->ac97); data->x = ucb1400_ts_read_xpos(ucb); @@ -244,8 +245,15 @@ static void ucb1400_poll_touch(struct ucb1400_ts *ucb, struct touch_data *data) if ((SECO_INVALID_VALUE == data->x) || (SECO_INVALID_VALUE == data->y) || (SECO_INVALID_VALUE == data->p)) { + ++ucb->read_error_count; + dev_dbg(&ucb->ts_idev->dev, "Invalid value (%u)", + ucb->read_error_count); retry = true; } + } else if (is_pendown && !is_penup) { + is_penup = true; + dev_dbg(&ucb->ts_idev->dev, "Up: %u ms", + jiffies_to_msecs(jiffies)-timestamp); } /* @@ -285,6 +293,10 @@ static void ucb1400_poll_touch(struct ucb1400_ts *ucb, struct touch_data *data) hys_down--; next_sleep = UCB1400_TS_SHORT_POLL_PERIOD; continue; + } else if (!report_pendown) { + report_pendown = true; + dev_dbg(&ucb->ts_idev->dev, "Down: %u ms", + jiffies_to_msecs(jiffies)-timestamp); } ucb1400_ts_report_event(ucb->ts_idev, data); @@ -402,6 +414,8 @@ static void ucb1400_ts_start(struct ucb1400_ts *ucb) "Failed to create workqueue"); } } + + ucb->read_error_count = 0; } static int ucb1400_ts_open(struct input_dev *idev) diff --git a/include/linux/ucb1400.h b/include/linux/ucb1400.h index 27f4ad21c82687081ffa4738bba7a548aa6a3abb..d63918362391ce0b7263166f071297435a2afae5 100644 --- a/include/linux/ucb1400.h +++ b/include/linux/ucb1400.h @@ -115,6 +115,7 @@ struct ucb1400_ts { struct seco_filter_data filter_data; struct delayed_work ts_reader; struct workqueue_struct *ts_workq; + unsigned read_error_count; }; struct ucb1400 {