From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: "Richard Röjfors" <richard.rojfors.ext@mocean-labs.com>
Cc: linux-input@vger.kernel.org,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
kwangwoo.lee@gmail.com,
Thierry Reding <thierry.reding@avionic-design.de>,
Trilok Soni <soni.trilok@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH 2/2] tsc2007: make platform callbacks optional
Date: Mon, 13 Jul 2009 21:17:59 -0700 [thread overview]
Message-ID: <20090714041759.GA2822@dtor-d630.eng.vmware.com> (raw)
In-Reply-To: <4A40C28E.1070109@mocean-labs.com>
Hi Richard,
On Tue, Jun 23, 2009 at 01:54:54PM +0200, Richard Röjfors wrote:
> The platform callbacks are only called if supplied. Makes the driver
> to fallback on only pressure calculation to decide when the pen is up.
>
> Signed-off-by: Richard Röjfors <richard.rojfors.ext@mocean-labs.com>
> ---
> Index: linux-2.6.30/drivers/input/touchscreen/tsc2007.c
> ===================================================================
> --- linux-2.6.30/drivers/input/touchscreen/tsc2007.c (revision 943)
> +++ linux-2.6.30/drivers/input/touchscreen/tsc2007.c (revision 945)
> @@ -59,6 +59,10 @@
> #define READ_X (ADC_ON_12BIT | TSC2007_MEASURE_X)
> #define PWRDOWN (TSC2007_12BIT | TSC2007_POWER_OFF_IRQ_EN)
>
> +#define PEN_STATE_UP 0x00
> +#define PEN_STATE_DOWN 0x01
> +#define PEN_STATE_IRQ 0x01
Why the last 2 are the same?
> +
> struct ts_event {
> u16 x;
> u16 y;
> @@ -76,7 +80,7 @@
> u16 model;
> u16 x_plate_ohms;
>
> - unsigned pendown;
> + unsigned penstate;
> int irq;
>
> int (*get_pendown_state)(void);
> @@ -149,15 +153,18 @@
> *
> * The only safe way to check for the pen up condition is in the
> * work function by reading the pen signal state (it's a GPIO and IRQ).
> + *
> + * But sadly we don't always have the possibility to use such callback
> + * in that case rely on the pressure anyway
> */
> if (rt) {
> struct input_dev *input = ts->input;
>
> - if (!ts->pendown) {
> + if (ts->penstate != PEN_STATE_DOWN) {
> dev_dbg(&ts->client->dev, "DOWN\n");
>
> input_report_key(input, BTN_TOUCH, 1);
> - ts->pendown = 1;
> + ts->penstate = PEN_STATE_DOWN;
> }
>
> input_report_abs(input, ABS_X, x);
> @@ -168,7 +175,9 @@
>
> dev_dbg(&ts->client->dev, "point(%4d,%4d), pressure (%4u)\n",
> x, y, rt);
> - }
> + } else if (!ts->get_pendown_state)
> + /* no callback to check pendown state, use pressure */
> + ts->penstate = PEN_STATE_UP;
>
Since we are not going to re-check pen state why don't we report "pen
up" event here right away and forego rescheduling the work?
> schedule_delayed_work(&ts->work, TS_POLL_PERIOD);
> }
Thanks.
--
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
WARNING: multiple messages have this Message-ID (diff)
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: "Richard Röjfors" <richard.rojfors.ext@mocean-labs.com>
Cc: linux-input@vger.kernel.org,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
kwangwoo.lee@gmail.com,
Thierry Reding <thierry.reding@avionic-design.de>,
Trilok Soni <soni.trilok@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>
Subject: Re: [PATCH 2/2] tsc2007: make platform callbacks optional
Date: Mon, 13 Jul 2009 21:17:59 -0700 [thread overview]
Message-ID: <20090714041759.GA2822@dtor-d630.eng.vmware.com> (raw)
In-Reply-To: <4A40C28E.1070109@mocean-labs.com>
Hi Richard,
On Tue, Jun 23, 2009 at 01:54:54PM +0200, Richard Röjfors wrote:
> The platform callbacks are only called if supplied. Makes the driver
> to fallback on only pressure calculation to decide when the pen is up.
>
> Signed-off-by: Richard Röjfors <richard.rojfors.ext@mocean-labs.com>
> ---
> Index: linux-2.6.30/drivers/input/touchscreen/tsc2007.c
> ===================================================================
> --- linux-2.6.30/drivers/input/touchscreen/tsc2007.c (revision 943)
> +++ linux-2.6.30/drivers/input/touchscreen/tsc2007.c (revision 945)
> @@ -59,6 +59,10 @@
> #define READ_X (ADC_ON_12BIT | TSC2007_MEASURE_X)
> #define PWRDOWN (TSC2007_12BIT | TSC2007_POWER_OFF_IRQ_EN)
>
> +#define PEN_STATE_UP 0x00
> +#define PEN_STATE_DOWN 0x01
> +#define PEN_STATE_IRQ 0x01
Why the last 2 are the same?
> +
> struct ts_event {
> u16 x;
> u16 y;
> @@ -76,7 +80,7 @@
> u16 model;
> u16 x_plate_ohms;
>
> - unsigned pendown;
> + unsigned penstate;
> int irq;
>
> int (*get_pendown_state)(void);
> @@ -149,15 +153,18 @@
> *
> * The only safe way to check for the pen up condition is in the
> * work function by reading the pen signal state (it's a GPIO and IRQ).
> + *
> + * But sadly we don't always have the possibility to use such callback
> + * in that case rely on the pressure anyway
> */
> if (rt) {
> struct input_dev *input = ts->input;
>
> - if (!ts->pendown) {
> + if (ts->penstate != PEN_STATE_DOWN) {
> dev_dbg(&ts->client->dev, "DOWN\n");
>
> input_report_key(input, BTN_TOUCH, 1);
> - ts->pendown = 1;
> + ts->penstate = PEN_STATE_DOWN;
> }
>
> input_report_abs(input, ABS_X, x);
> @@ -168,7 +175,9 @@
>
> dev_dbg(&ts->client->dev, "point(%4d,%4d), pressure (%4u)\n",
> x, y, rt);
> - }
> + } else if (!ts->get_pendown_state)
> + /* no callback to check pendown state, use pressure */
> + ts->penstate = PEN_STATE_UP;
>
Since we are not going to re-check pen state why don't we report "pen
up" event here right away and forego rescheduling the work?
> schedule_delayed_work(&ts->work, TS_POLL_PERIOD);
> }
Thanks.
--
Dmitry
next prev parent reply other threads:[~2009-07-14 4:18 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-23 11:54 [PATCH 2/2] tsc2007: make platform callbacks optional Richard Röjfors
2009-06-25 21:23 ` Andrew Morton
2009-07-09 16:03 ` Richard Röjfors
2009-07-14 4:17 ` Dmitry Torokhov [this message]
2009-07-14 4:17 ` Dmitry Torokhov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090714041759.GA2822@dtor-d630.eng.vmware.com \
--to=dmitry.torokhov@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=kwangwoo.lee@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=richard.rojfors.ext@mocean-labs.com \
--cc=soni.trilok@gmail.com \
--cc=thierry.reding@avionic-design.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.