Skip to contentSkip to conversation

iio: accel: kxcjk-1013: Add support for KX022-1020

PATCH New Jakkapong Saksrisuwan 1 participant 1 message Dec 4 IIO

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 iio: accel: kxcjk-1013: Add support for KX022-1020

The KX022-1020 is documented in the binding and is used by the Microsoft msm8226 devices (qcom-msm8226-microsoft-common.dtsi), but the driver has no entry for it, so the accelerometer is never probed on those boards.

Support was added once before in
commit d5cbe1502043 ("iio: accel: kxcjk-1013: Add support for KX022-1020") and reverted in
commit b01b559682f3 ("iio: accel: kxcjk-1013: Revert "Add support for KX022-1020"") because adding the chip to enum kx_chipset broke the ODR start-up times of the KX023-1025. The driver now describes each chip with a
struct kx_chipset_info, so that problem no longer exists.

The Rev 12.0 datasheets of the KX022-1020 and the KX023-1025 have the same register map, the same CNTL1, ODCNTL (ODR encoding), INC4, WUFC, INT_REL and CNTL3 descriptions, and the same start-up time table. They differ in WHO_AM_I (0x14 vs 0x15), which the driver does not check. So let the KX022-1020 use kx0231025_info, which keeps the INT1 routing in kxcjk1013_chip_init() working.

Datasheet: https://fscdn.rohm.com/kionix/en/datasheet/KX022-1020%20Specifications%20Rev%2012.0.pdf
Datasheet: https://fscdn.rohm.com/kionix/en/datasheet/KX023-1025%20Specifications%20Rev%2012.0.pdf

---

Notes:
Changes in v2:
- use Datasheet: tags instead of Link: (Andy, Joshua)
- collect Reviewed-by (Joshua)

v1: https://lore.kernel.org/r/[email protected]

This is based on the datasheets only. I do not have a KX022-1020, so it is untested on hardware. Rayyan added the DTS node for the msm8226 Microsoft boards, so could you or someone with one of them test it?

AI assistance: I used an AI assistant (Claude) to extract text from the two datasheets, compare their register descriptions and draft this message. I have double checked all registers used by kx0231025_regs against both datasheets.
Build-tested (W=1, C=1) and checked with checkpatch.pl --strict; not tested on hardware.

 drivers/iio/accel/kxcjk-1013.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/iio/accel/kxcjk-1013.c +2 -0
index a76a2742c9c5..0f49f5a2bd78 100644
@@ -1633,6 +1633,7 @@ static const struct i2c_device_id kxcjk1013_id[] = {
 	{ .name = "kxcj91008", .driver_data = (kernel_ulong_t)&kxcj91008_info },
 	{ .name = "kxtj21009", .driver_data = (kernel_ulong_t)&kxtj21009_info },
 	{ .name = "kxtf9", .driver_data = (kernel_ulong_t)&kxtf9_info },
+	{ .name = "kx022-1020", .driver_data = (kernel_ulong_t)&kx0231025_info },
 	{ .name = "kx023-1025", .driver_data = (kernel_ulong_t)&kx0231025_info },
 	{ }
 };
@@ -1643,6 +1644,7 @@ static const struct of_device_id kxcjk1013_of_match[] = {
 	{ .compatible = "kionix,kxcj91008", &kxcj91008_info },
 	{ .compatible = "kionix,kxtj21009", &kxtj21009_info },
 	{ .compatible = "kionix,kxtf9", &kxtf9_info },
+	{ .compatible = "kionix,kx022-1020", &kx0231025_info },
 	{ .compatible = "kionix,kx023-1025", &kx0231025_info },
 	{ }
 };

base-commit: fba506008a5b548ad2708bc2765a039cb00a47ab

Signature · 1 line
2.47.3