iio: accel: kxcjk-1013: Add support for KX023-1025
authorStephan Gerhold <stephan@gerhold.net>
Tue, 11 May 2021 14:24:02 +0000 (16:24 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Mon, 17 May 2021 12:54:25 +0000 (13:54 +0100)
commitc630c1768522d5728e51470ea4f292a35919bb6d
tree256b45bc2e80da543887a18538dca040634c18ab
parentae4467f6884ea16f6338295e9951eae3544aac87
iio: accel: kxcjk-1013: Add support for KX023-1025

The KX023-1025 accelerometer [1] seems to be some mixture of
KXCJK and KXTF9. It has the motion interrupt functionality from KXCJK
but also the tap detection from KXTF9, and a lot more functionality.

The configuration register map seems fairly different at first,
but actually all register bits used by the kxcjk-1013 driver are
available at the same bit positions on KX023-1025. It's just quite
misleading because:

  1. The registers have entirely different names and are at different
     addresses, but the bits are mostly named the same (and mean the same).
  2. There are many more registers and bits used that are reserved on KXCJK
     to enable additional functionality.

Ignoring all additionally available functionality for now, the KX023
works just fine after setting up the struct with the correct register
addresses. The only difference that needs to be handled additionally
is that the KX023 supports two configurable interrupt lines (INT1/2).

For now only INT1 is supported so we route all interrupts used by
the driver there.

[1]: https://kionixfs.azureedge.net/en/datasheet/KX023-1025%20Specifications%20Rev%2012.0.pdf

Cc: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/accel/kxcjk-1013.c