>From 34c26895c2cfb2bcc1a1d7994ad695e26b8eaeef Mon Sep 17 00:00:00 2001 From: Imre Deak Date: Wed, 27 Dec 2006 16:07:32 +0200 Subject: [PATCH] Input: ads7846: call input layer functions directly This reverts an earlier abstraction of these calls, which only obfuscated the code. Signed-off-by: Imre Deak --- drivers/input/touchscreen/ads7846.c | 56 +++++++++++----------------------- 1 files changed, 18 insertions(+), 38 deletions(-) diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c index a47c95e..d6251ef 100644 --- a/drivers/input/touchscreen/ads7846.c +++ b/drivers/input/touchscreen/ads7846.c @@ -375,39 +375,6 @@ static DEVICE_ATTR(disable, 0664, ads7846_disable_show, ads7846_disable_store); /*--------------------------------------------------------------------------*/ -static void ads7846_report_pen_state(struct ads7846 *ts, int down) -{ - struct input_dev *input_dev = ts->input; - - input_report_key(input_dev, BTN_TOUCH, down); - if (!down) - input_report_abs(input_dev, ABS_PRESSURE, 0); -#ifdef VERBOSE - pr_debug("%s: %s\n", ts->spi->dev.bus_id, down ? "DOWN" : "UP"); -#endif -} - -static void ads7846_report_pen_position(struct ads7846 *ts, int x, int y, - int pressure) -{ - struct input_dev *input_dev = ts->input; - - input_report_abs(input_dev, ABS_X, x); - input_report_abs(input_dev, ABS_Y, y); - input_report_abs(input_dev, ABS_PRESSURE, pressure); - -#ifdef VERBOSE - pr_debug("%s: %d/%d/%d\n", ts->spi->dev.bus_id, x, y, pressure); -#endif -} - -static void ads7846_sync_events(struct ads7846 *ts) -{ - struct input_dev *input_dev = ts->input; - - input_sync(input_dev); -} - /* * PENIRQ only kicks the timer. The timer only reissues the SPI transfer, * to retrieve touchscreen status. @@ -466,11 +433,20 @@ static void ads7846_rx(void *ads) */ if (Rt) { if (!ts->pendown) { - ads7846_report_pen_state(ts, 1); + input_report_key(ts->input, BTN_TOUCH, 1); ts->pendown = 1; +#ifdef VERBOSE + dev_dbg(&ts->spi->dev, "DOWN\n"); +#endif } - ads7846_report_pen_position(ts, x, y, Rt); - ads7846_sync_events(ts); + input_report_abs(ts->input, ABS_X, x); + input_report_abs(ts->input, ABS_Y, y); + input_report_abs(ts->input, ABS_PRESSURE, Rt); + + input_sync(ts->input); +#ifdef VERBOSE + dev_dbg(&ts->spi->dev, "%4d/%4d/%4d\n", x, y, Rt); +#endif } hrtimer_start(&ts->timer, ktime_set(0, TS_POLL_PERIOD), HRTIMER_REL); @@ -568,9 +544,13 @@ static int ads7846_timer(struct hrtimer *handle) if (unlikely(!ts->get_pendown_state() || device_suspended(&ts->spi->dev))) { if (ts->pendown) { - ads7846_report_pen_state(ts, 0); - ads7846_sync_events(ts); + input_report_key(ts->input, BTN_TOUCH, 0); + input_report_abs(ts->input, ABS_PRESSURE, 0); + input_sync(ts->input); ts->pendown = 0; +#ifdef VERBOSE + dev_dbg(&ts->spi->dev, "UP\n"); +#endif } /* measurment cycle ended */ -- 1.4.4.2