Input: iqs269a - do not poll during ATI
authorJeff LaBundy <jeff@labundy.com>
Tue, 3 Jan 2023 17:59:35 +0000 (11:59 -0600)
committerDmitry Torokhov <dmitry.torokhov@gmail.com>
Wed, 11 Jan 2023 01:00:25 +0000 (17:00 -0800)
commitb08134eb254db56e9ce8170d9b82f0d7a616b6f8
tree171b836891cf131cfe988bb0540786cc3c7a983d
parent18ab69c8ca5678324efbeed874b707ce7b2feae1
Input: iqs269a - do not poll during ATI

After initial start-up, the driver triggers ATI (calibration) with
the newly loaded register configuration in place. Next, the driver
polls a register field to ensure ATI completed in a timely fashion
and that the device is ready to sense.

However, communicating with the device over I2C while ATI is under-
way may induce noise in the device and cause ATI to fail. As such,
the vendor recommends not to poll the device during ATI.

To solve this problem, let the device naturally signal to the host
that ATI is complete by way of an interrupt. A completion prevents
the device from successfully probing until this happens.

As an added benefit, initial switch states are now reported in the
interrupt handler at the same time ATI status is checked. As such,
duplicate code that reports initial switch states has been removed
from iqs269_input_init().

The former logic that scaled ATI timeout and filter settling delay
is not carried forward with the new implementation, as it produces
overly conservative delays at the lower clock rate.

Rather, a single timeout that covers both clock rates is used. The
filter settling delay does not happen to be necessary and has been
removed as well.

Fixes: 04e49867fad1 ("Input: add support for Azoteq IQS269A")
Signed-off-by: Jeff LaBundy <jeff@labundy.com>
Reviewed-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Link: https://lore.kernel.org/r/Y7RtB2T7AF9rYMjK@nixie71
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
drivers/input/misc/iqs269a.c