iio: accel: kxcjk-1013: Add support for KX022-1020
PATCH 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.
---
Notes:
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
@@ -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
Quoted 19 lines · Jakkapong Saksrisuwan
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
commitd5cbe1502043("iio: accel: kxcjk-1013: Add support for KX022-1020") and reverted in
commitb01b559682f3("iio: accel: kxcjk-1013: Revert "Add support for KX022-1020"") because adding the chip to enumkx_chipsetbroke the ODR start-up times of the KX023-1025. The driver now describes each chip with a
structkx_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_RELand CNTL3 descriptions, and the same start-up time table. They differ inWHO_AM_I(0x14vs0x15), which the driver does not check. So let the KX022-1020 usekx0231025_info, which keeps the INT1 routing inkxcjk1013_chip_init()working.
Quoted 2 lines
I'd make these Datasheet tags, but perhaps this could be amended whilst applying.
Signature · 2 lines
Kind regards, Joshua Crofts
Quoted 19 lines · Jakkapong Saksrisuwan
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
commitd5cbe1502043("iio: accel: kxcjk-1013: Add support for KX022-1020") and reverted in
commitb01b559682f3("iio: accel: kxcjk-1013: Revert "Add support for KX022-1020"") because adding the chip to enumkx_chipsetbroke the ODR start-up times of the KX023-1025. The driver now describes each chip with a
structkx_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_RELand CNTL3 descriptions, and the same start-up time table. They differ inWHO_AM_I(0x14vs0x15), which the driver does not check. So let the KX022-1020 usekx0231025_info, which keeps the INT1 routing inkxcjk1013_chip_init()working.
Quoted 2 lines
Convert them to Datasheet tags.
Signature · 2 lines
With Best Regards, Andy Shevchenko