From 786faa8a73922edf86d26f371b67404ec4f28132 Mon Sep 17 00:00:00 2001 From: Tobias Poganiuch <tobias.poganiuch@seco.com> Date: Tue, 26 Sep 2023 14:26:52 +0200 Subject: [PATCH] driver:ucb1400: Add debug messages --- drivers/input/touchscreen/ucb1400_ts.c | 16 +++++++++++++++- include/linux/ucb1400.h | 1 + 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/input/touchscreen/ucb1400_ts.c b/drivers/input/touchscreen/ucb1400_ts.c index 28be813947541..064cf4f93b031 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 27f4ad21c8268..d63918362391c 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 { -- GitLab