From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: Marek Vasut <marex@denx.de>
Cc: linux-input@vger.kernel.org, Joe Hung <joe_hung@ilitek.com>,
Luca Hsu <luca_hsu@ilitek.com>
Subject: Re: [PATCH] Input: ili210x - Improve polled sample spacing
Date: Tue, 9 Nov 2021 22:27:53 -0800 [thread overview]
Message-ID: <YYtmaXa/gmA3DJ0A@google.com> (raw)
In-Reply-To: <b541d4b7-0b3e-6ccd-abbb-8448c1c57c22@denx.de>
On Mon, Nov 08, 2021 at 12:04:30PM +0100, Marek Vasut wrote:
> On 11/8/21 4:37 AM, Dmitry Torokhov wrote:
> > Hi Marek,
>
> Hi,
>
> [...]
>
> > > diff --git a/drivers/input/touchscreen/ili210x.c b/drivers/input/touchscreen/ili210x.c
> > > index a3b71a9511eb3..b2d9fe1e1c707 100644
> > > --- a/drivers/input/touchscreen/ili210x.c
> > > +++ b/drivers/input/touchscreen/ili210x.c
> > > @@ -328,10 +328,13 @@ static irqreturn_t ili210x_irq(int irq, void *irq_data)
> > > const struct ili2xxx_chip *chip = priv->chip;
> > > u8 touchdata[ILI210X_DATA_SIZE] = { 0 };
> > > bool keep_polling;
> > > + ktime_t time_next;
> > > + s64 time_delta;
> > > bool touch;
> > > int error;
> > > do {
> > > + time_next = ktime_add_ms(ktime_get(), ILI2XXX_POLL_PERIOD);
> > > error = chip->get_touch_data(client, touchdata);
> > > if (error) {
> > > dev_err(&client->dev,
> > > @@ -341,8 +344,11 @@ static irqreturn_t ili210x_irq(int irq, void *irq_data)
> > > touch = ili210x_report_events(priv, touchdata);
> > > keep_polling = chip->continue_polling(touchdata, touch);
> > > - if (keep_polling)
> > > - msleep(ILI2XXX_POLL_PERIOD);
> > > + if (keep_polling) {
> > > + time_delta = ktime_us_delta(time_next, ktime_get());
> >
> > Do we really need to use exact time, or ktime_get_coarse() is good
> > enough, as it is cheaper?
>
> ktime_get_coarse() introduces multi-millisecond jitter into the samples if
> you have low HZ setting, which isn't really nice. That's also why I use
> ktime and not jiffies here, jiffies has the same problem.
Applied, thank you.
--
Dmitry
prev parent reply other threads:[~2021-11-10 6:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-08 0:52 [PATCH] Input: ili210x - Improve polled sample spacing Marek Vasut
2021-11-08 3:37 ` Dmitry Torokhov
2021-11-08 11:04 ` Marek Vasut
2021-11-10 6:27 ` Dmitry Torokhov [this message]
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=YYtmaXa/gmA3DJ0A@google.com \
--to=dmitry.torokhov@gmail.com \
--cc=joe_hung@ilitek.com \
--cc=linux-input@vger.kernel.org \
--cc=luca_hsu@ilitek.com \
--cc=marex@denx.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).