Linux IIO development
 help / color / mirror / Atom feed
* [PATCH] iio: accel: kxcjk-1013: Add support for KX022-1020
@ 2026-12-02  7:00 Jakkapong Saksrisuwan
  2026-12-03 14:50 ` Joshua Crofts
  0 siblings, 1 reply; 2+ messages in thread
From: Jakkapong Saksrisuwan @ 2026-12-02  7:00 UTC (permalink / raw)
  To: jic23; +Cc: dlechner, nuno.sa, andy, rayyan, linux-iio, 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
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.

Link: https://fscdn.rohm.com/kionix/en/datasheet/KX022-1020%20Specifications%20Rev%2012.0.pdf
Link: https://fscdn.rohm.com/kionix/en/datasheet/KX023-1025%20Specifications%20Rev%2012.0.pdf
Signed-off-by: Jakkapong Saksrisuwan <me@jakkapong.dev>
---

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(+)

diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c
index a76a2742c9c5..0f49f5a2bd78 100644
--- a/drivers/iio/accel/kxcjk-1013.c
+++ b/drivers/iio/accel/kxcjk-1013.c
@@ -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
-- 
2.47.3


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] iio: accel: kxcjk-1013: Add support for KX022-1020
  2026-12-02  7:00 [PATCH] iio: accel: kxcjk-1013: Add support for KX022-1020 Jakkapong Saksrisuwan
@ 2026-12-03 14:50 ` Joshua Crofts
  0 siblings, 0 replies; 2+ messages in thread
From: Joshua Crofts @ 2026-12-03 14:50 UTC (permalink / raw)
  To: Jakkapong Saksrisuwan, jic23; +Cc: dlechner, nuno.sa, andy, rayyan, linux-iio

On 02-Dec-26 8:00, Jakkapong Saksrisuwan wrote:
> 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.
> 
> Link: https://fscdn.rohm.com/kionix/en/datasheet/KX022-1020%20Specifications%20Rev%2012.0.pdf
> Link: https://fscdn.rohm.com/kionix/en/datasheet/KX023-1025%20Specifications%20Rev%2012.0.pdf
I'd make these Datasheet tags, but perhaps this could be amended whilst applying.

Reviewed-by: Joshua Crofts <crofts@kernel.org>

-- 
Kind regards,
Joshua Crofts


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-12-03 14:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-12-02  7:00 [PATCH] iio: accel: kxcjk-1013: Add support for KX022-1020 Jakkapong Saksrisuwan
2026-12-03 14:50 ` Joshua Crofts

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox