* [PATCH] iio: light: cm32181: add support for the CM32183
@ 2026-10-11 8:48 Zixin Wang
2026-10-11 16:48 ` Joshua Crofts
0 siblings, 1 reply; 3+ messages in thread
From: Zixin Wang @ 2026-10-11 8:48 UTC (permalink / raw)
To: Kevin Tsai, Jonathan Cameron
Cc: linux-iio, David Lechner, Nuno Sá, Andy Shevchenko
The CM32183 is another member of the Capella CM3218x ambient light
sensor family. Its device ID register (0x07) returns 0x83 in the low
byte, following the same scheme as the already supported parts:
CM3218 -> 0x18
CM32181 -> 0x81
CM32182 -> 0x82
CM32183 -> 0x83
The driver falls through to the default branch of the ID switch and
returns -ENODEV, so probe() fails even though the device is present and
functional:
cm32181 i2c-CPLM3218:00: cm32181_probe: register init failed
This was observed on an H3C MegaBook 14 (Intel Core Ultra 5 226V, Lunar
Lake). Its DSDT declares the sensor as:
Device (LSRD) {
Name (_HID, "CPLM3218")
Name (_CID, "CPLM3218")
Name (_UID, 1)
}
on I2C at address 0x29, and additionally provides the vendor
initialisation and calibration objects that this driver already parses.
CPM0[0] reports a device-id of 32183, and CPM1 provides lux_per_bit =
2200 and calibscale = 265859.
Treat the CM32183 like the CM32181.
Measurements on the above machine confirm the register layout matches:
the power-on value of the CMD register (0x0001) has bit 0 set, which is
CM32181_CMD_ALS_DISABLE, and register 0x04 is the ALS data register.
With this change the driver binds, the ACPI-provided initialisation
values are written and the CPM1 calibration is taken into account
(in_illuminance_calibscale reads back 265859). The reported illuminance
tracks ambient light without saturating.
Signed-off-by: Zixin Wang <ywp1023456@foxmail.com>
---
Please Cc me on replies, I am not subscribed to linux-iio.
drivers/iio/light/cm32181.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/iio/light/cm32181.c b/drivers/iio/light/cm32181.c
index 2590fc8..97882e4 100644
--- a/drivers/iio/light/cm32181.c
+++ b/drivers/iio/light/cm32181.c
@@ -54,7 +54,10 @@
#define SMBUS_ALERT_RESPONSE_ADDRESS 0x0c
-/* CPM0 Index 0: device-id (3218 or 32181), 1: Unknown, 2: init_regs_bitmap */
+/*
+ * CPM0 Index 0: device-id (3218, 32181 or 32183), 1: Unknown,
+ * 2: init_regs_bitmap
+ */
#define CPM0_REGS_BITMAP 2
#define CPM0_HEADER_SIZE 3
@@ -200,6 +203,7 @@ static int cm32181_reg_init(struct cm32181_chip *cm32181)
break;
case 0x81: /* CM32181 */
case 0x82: /* CM32182, fully compat. with CM32181 */
+ case 0x83: /* CM32183 */
cm32181->num_als_it = ARRAY_SIZE(cm32181_als_it_bits);
cm32181->als_it_bits = cm32181_als_it_bits;
cm32181->als_it_values = cm32181_als_it_values;
--
2.39.5
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] iio: light: cm32181: add support for the CM32183
2026-10-11 8:48 [PATCH] iio: light: cm32181: add support for the CM32183 Zixin Wang
@ 2026-10-11 16:48 ` Joshua Crofts
2026-10-13 13:19 ` Andy Shevchenko
0 siblings, 1 reply; 3+ messages in thread
From: Joshua Crofts @ 2026-10-11 16:48 UTC (permalink / raw)
To: Zixin Wang
Cc: Kevin Tsai, Jonathan Cameron, linux-iio, David Lechner,
Nuno Sá, Andy Shevchenko
On Sun, 11 Oct 2026 08:48:56 +0000 (UTC)
Zixin Wang <ywp1023456@foxmail.com> wrote:
> The CM32183 is another member of the Capella CM3218x ambient light
> sensor family. Its device ID register (0x07) returns 0x83 in the low
> byte, following the same scheme as the already supported parts:
>
> CM3218 -> 0x18
> CM32181 -> 0x81
> CM32182 -> 0x82
> CM32183 -> 0x83
>
> The driver falls through to the default branch of the ID switch and
> returns -ENODEV, so probe() fails even though the device is present and
> functional:
>
> cm32181 i2c-CPLM3218:00: cm32181_probe: register init failed
>
> This was observed on an H3C MegaBook 14 (Intel Core Ultra 5 226V, Lunar
> Lake). Its DSDT declares the sensor as:
>
> Device (LSRD) {
> Name (_HID, "CPLM3218")
> Name (_CID, "CPLM3218")
> Name (_UID, 1)
> }
>
> on I2C at address 0x29, and additionally provides the vendor
> initialisation and calibration objects that this driver already parses.
> CPM0[0] reports a device-id of 32183, and CPM1 provides lux_per_bit =
> 2200 and calibscale = 265859.
>
> Treat the CM32183 like the CM32181.
>
> Measurements on the above machine confirm the register layout matches:
> the power-on value of the CMD register (0x0001) has bit 0 set, which is
> CM32181_CMD_ALS_DISABLE, and register 0x04 is the ALS data register.
> With this change the driver binds, the ACPI-provided initialisation
> values are written and the CPM1 calibration is taken into account
> (in_illuminance_calibscale reads back 265859). The reported illuminance
> tracks ambient light without saturating.
>
Code is good, but no need for the above to go into the commit message.
I'd have a commit message like:
Add the device ID for the CM32183. The device has the same register
layout as the CM32181.
What you wrote should IMO go under the ---.
--
Kind regards,
Joshua Crofts
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] iio: light: cm32181: add support for the CM32183
2026-10-11 16:48 ` Joshua Crofts
@ 2026-10-13 13:19 ` Andy Shevchenko
0 siblings, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2026-10-13 13:19 UTC (permalink / raw)
To: Joshua Crofts
Cc: Zixin Wang, Kevin Tsai, Jonathan Cameron, linux-iio,
David Lechner, Nuno Sá, Andy Shevchenko
On Sun, Oct 11, 2026 at 06:48:39PM +0200, Joshua Crofts wrote:
> On Sun, 11 Oct 2026 08:48:56 +0000 (UTC)
> Zixin Wang <ywp1023456@foxmail.com> wrote:
>
> > The CM32183 is another member of the Capella CM3218x ambient light
> > sensor family. Its device ID register (0x07) returns 0x83 in the low
> > byte, following the same scheme as the already supported parts:
> >
> > CM3218 -> 0x18
> > CM32181 -> 0x81
> > CM32182 -> 0x82
> > CM32183 -> 0x83
> >
> > The driver falls through to the default branch of the ID switch and
> > returns -ENODEV, so probe() fails even though the device is present and
> > functional:
> >
> > cm32181 i2c-CPLM3218:00: cm32181_probe: register init failed
> >
> > This was observed on an H3C MegaBook 14 (Intel Core Ultra 5 226V, Lunar
> > Lake). Its DSDT declares the sensor as:
> >
> > Device (LSRD) {
> > Name (_HID, "CPLM3218")
> > Name (_CID, "CPLM3218")
> > Name (_UID, 1)
> > }
> >
> > on I2C at address 0x29, and additionally provides the vendor
> > initialisation and calibration objects that this driver already parses.
> > CPM0[0] reports a device-id of 32183, and CPM1 provides lux_per_bit =
> > 2200 and calibscale = 265859.
> >
> > Treat the CM32183 like the CM32181.
> >
> > Measurements on the above machine confirm the register layout matches:
> > the power-on value of the CMD register (0x0001) has bit 0 set, which is
> > CM32181_CMD_ALS_DISABLE, and register 0x04 is the ALS data register.
> > With this change the driver binds, the ACPI-provided initialisation
> > values are written and the CPM1 calibration is taken into account
> > (in_illuminance_calibscale reads back 265859). The reported illuminance
> > tracks ambient light without saturating.
>
> Code is good, but no need for the above to go into the commit message.
> I'd have a commit message like:
>
> Add the device ID for the CM32183. The device has the same register
> layout as the CM32181.
>
> What you wrote should IMO go under the ---.
Most of it, yes, I agree, but it would be nice to have a product name
in the commit message to have better pointer in the future (yes, the
comment will be collected on lore.kernel.org anyway, but it is harder
to get).
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-10-13 13:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-11 8:48 [PATCH] iio: light: cm32181: add support for the CM32183 Zixin Wang
2026-10-11 16:48 ` Joshua Crofts
2026-10-13 13:19 ` Andy Shevchenko
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.