diff options
author | Dominik Sliwa <dominik.sliwa@toradex.com> | 2017-01-18 15:39:34 +0100 |
---|---|---|
committer | Marcel Ziswiler <marcel.ziswiler@toradex.com> | 2017-04-04 13:38:13 +0200 |
commit | 2e060ce4b8d4f669ef3ffa7a26e0763098cc2bb4 (patch) | |
tree | 5c7d2efc663a368570289ee102a7030b74452d16 /drivers/input/touchscreen/apalis-tk1-k20_ts.c | |
parent | 19722d4d90e711d7826ec7f6461216aa61f2f937 (diff) |
apalis-tk1: mfd touch screen fixes and improvements
Signed-off-by: Dominik Sliwa <dominik.sliwa@toradex.com>
Acked-by: Marcel Ziswiler <marcel.ziswiler@toradex.com>
Diffstat (limited to 'drivers/input/touchscreen/apalis-tk1-k20_ts.c')
-rw-r--r-- | drivers/input/touchscreen/apalis-tk1-k20_ts.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/input/touchscreen/apalis-tk1-k20_ts.c b/drivers/input/touchscreen/apalis-tk1-k20_ts.c index f1fd11e87468..43cb25fa8fc9 100644 --- a/drivers/input/touchscreen/apalis-tk1-k20_ts.c +++ b/drivers/input/touchscreen/apalis-tk1-k20_ts.c @@ -48,7 +48,7 @@ static void apalis_tk1_k20_ts_report_sample(struct apalis_tk1_k20_ts *priv) { struct input_dev *idev = priv->idev; int xp, xm, yp, ym; - int x, y, press; + int x, y, press, btn; xp = priv->sample[1]; xm = priv->sample[0]; @@ -59,18 +59,21 @@ static void apalis_tk1_k20_ts_report_sample(struct apalis_tk1_k20_ts *priv) y = (yp + ym) / 2; press = (abs(yp - ym) + abs(xp - xm)) / 2; - if (press) { + if ((yp != 0) && ( xp != 0 )) { + btn = 1; input_report_abs(idev, ABS_X, x); input_report_abs(idev, ABS_Y, y); dev_dbg(&idev->dev, "report (%d, %d, %d)\n", x, y, press); - queue_delayed_work(priv->workq, &priv->work, HZ / 50); - } else + queue_delayed_work(priv->workq, &priv->work, HZ / 25); + } else { dev_dbg(&idev->dev, "report release\n"); + btn = 0; + } input_report_abs(idev, ABS_PRESSURE, press); - input_report_key(idev, BTN_TOUCH, press); + input_report_key(idev, BTN_TOUCH, btn); input_sync(idev); } @@ -91,8 +94,8 @@ static void apalis_tk1_k20_ts_work(struct work_struct *work) apalis_tk1_k20_unlock(priv->apalis_tk1_k20); - for (i = 0; i < 7; i++) - priv->sample[(int)i/2] = (buf[i+1] << 8) + buf[i]; + for (i = 0; i < 4; i++) + priv->sample[i] = (buf[(2 * i) + 1] << 8) + buf[2 * i]; apalis_tk1_k20_ts_report_sample(priv); } |