* [PATCH v5 0/2] iio: light: Add support for Capella cm36686 and cm36672p sensors
@ 2026-02-17 12:13 Erikas Bitovtas
2026-02-17 12:13 ` [PATCH v5 1/2] dt-bindings: iio: light: vcnl4000: add Capella CM36686 and CM36672P Erikas Bitovtas
` (2 more replies)
0 siblings, 3 replies; 5+ messages in thread
From: Erikas Bitovtas @ 2026-02-17 12:13 UTC (permalink / raw)
To: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Peter Meerwald
Cc: linux-iio, devicetree, linux-kernel, ~postmarketos/upstreaming,
phone-devel, Erikas Bitovtas, Andy Shevchenko
This patch series adds support for Capella cm36686 and cm36672p ambient
light and proximity sensors.
Capella cm36686 is a combined ambient light and proximity sensor with
adjustable integration time, interrupt and hysteresis support. It has
the slave address of 0x60. cm36672p is partially compatible with
cm36686, in that it is a proximity-only sensor that shares the same
proximity register field interface with cm36686.
Unfortunately, datasheets for these sensors are not publicly
available. Initially, this patch series introduced a new driver, which
had code based on Android downstream kernels for devices which did use
these sensors and a previous submission for cm36672p to mailing lists:
https://github.com/LineageOS/android_kernel_xiaomi_msm8992/blob/cm-14.1/drivers/iio/light/cm36686.c
https://github.com/shakalaca/ASUS_ZenFone_ZD551KL/blob/android-6.0/kernel/drivers/input/misc/cm36283.c
https://lore.kernel.org/linux-iio/1465462845-1571-1-git-send-email-capellamicro@gmail.com/
The following code has been tested on Asus ZenFone 2 Laser/Selfie, which
uses cm36686 as its ambient light and proximity sensor.
Changes since v4:
- CM36672P is only partially compatible with CM36686, reword patch
series commits to reflect that.
- Add comment explaining why we use VCNL4040 device ID for CM36686.
- Link to v4:
https://lore.kernel.org/linux-iio/20260212-cm36686-v4-0-8f587d4a72bf@gmail.com/
Changes since v3 (misversioned as v1):
- Move Capella enum IDs up so device IDs are sorted by string literal.
- Move device tree table entries up so they are sorted by string
literal.
- Add a trailing comma to the cm36672p_channels proximity channel entry.
- Link to v3:
https://lore.kernel.org/linux-iio/20260210-cm36686-v1-0-aef68dd46ad4@gmail.com/
Changes since v2:
- Remove the previous unnecessary proposed driver and bindings.
- Add a fallback compatible for cm36686 of vcnl4040.
- Add a new compatible for cm36672p.
- Add channel info for cm36672p.
- Remove redundant information in the dt-bindings commit message.
- Link to v2:
https://lore.kernel.org/linux-iio/20260209-cm36686-v2-0-a48126d2b124@gmail.com/
Changes since v1:
- Add copyright information.
- Sort includes in alphabetical order.
- Add trailing commas.
- Remove blank spaces where unnecessary.
- Add a fallback for capella,cm36686 compatible.
- Make power supplies required.
- Add '-microamp' suffix for capella,proximity-led-current.
- Replace local caching and i2c_smbus calls with regmap API.
- Make interrupt optional.
- Add action or reset only after setup is done.
- Replace mutex_[un]lock calls with guard(mutex)
- Add comments on where mutex is used.
- Add comments on proximity register defaults.
- Remove default proximity sensor duty ratio and integration time. Those
were taken from the testing device and had no real reason to be there.
- Replace dev_err_probe on device's part ID with a warning.
- Replace chip->supplies property with a single
devm_regulator_bulk_get_enable call.
- Use individual structs instead of array-style device info
- Remove enums which are no longer used.
- Link to v1:
https://lore.kernel.org/linux-iio/20260201-cm36686-v1-0-4949a2a9ba63@gmail.com/
Signed-off-by: Erikas Bitovtas <xerikasxx@gmail.com>
---
Erikas Bitovtas (2):
dt-bindings: iio: light: vcnl4000: add Capella CM36686 and CM36672P
iio: light: vcnl4000: add support for Capella CM36686 and CM36672P
.../bindings/iio/light/vishay,vcnl4000.yaml | 17 +++++----
drivers/iio/light/vcnl4000.c | 41 ++++++++++++++++++++++
2 files changed, 52 insertions(+), 6 deletions(-)
---
base-commit: 350adaf7fde9fdbd9aeed6d442a9ae90c6a3ab97
change-id: 20260201-cm36686-fc7a8385f1cd
Best regards,
--
Erikas Bitovtas <xerikasxx@gmail.com>
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v5 1/2] dt-bindings: iio: light: vcnl4000: add Capella CM36686 and CM36672P
2026-02-17 12:13 [PATCH v5 0/2] iio: light: Add support for Capella cm36686 and cm36672p sensors Erikas Bitovtas
@ 2026-02-17 12:13 ` Erikas Bitovtas
2026-02-17 17:57 ` Conor Dooley
2026-02-17 12:13 ` [PATCH v5 2/2] iio: light: vcnl4000: add support for " Erikas Bitovtas
2026-02-18 19:39 ` [PATCH v5 0/2] iio: light: Add support for Capella cm36686 and cm36672p sensors Jonathan Cameron
2 siblings, 1 reply; 5+ messages in thread
From: Erikas Bitovtas @ 2026-02-17 12:13 UTC (permalink / raw)
To: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Peter Meerwald
Cc: linux-iio, devicetree, linux-kernel, ~postmarketos/upstreaming,
phone-devel, Erikas Bitovtas
Capella CM36686 is an ambient light and proximity sensor developed by
Capella Microsystems, now a subsidiary of Vishay Intertechnology Inc. It
has an I2C address of 0x60 and is fully compatible with an existing
driver for VCNL4040. Capella CM36672P is a proximity-only sensor that
is partially compatible with CM36686 - they share the same register
fields for proximity sensing, but ambient light sensor register fields
in CM36672P are reserved. Add compatibles for cm36672p and cm36686,
with a fallback for cm36686 of vcnl4040.
Signed-off-by: Erikas Bitovtas <xerikasxx@gmail.com>
---
.../devicetree/bindings/iio/light/vishay,vcnl4000.yaml | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
diff --git a/Documentation/devicetree/bindings/iio/light/vishay,vcnl4000.yaml b/Documentation/devicetree/bindings/iio/light/vishay,vcnl4000.yaml
index 4d1a225e8868..2ba4d5de4ec4 100644
--- a/Documentation/devicetree/bindings/iio/light/vishay,vcnl4000.yaml
+++ b/Documentation/devicetree/bindings/iio/light/vishay,vcnl4000.yaml
@@ -18,12 +18,17 @@ allOf:
properties:
compatible:
- enum:
- - vishay,vcnl4000
- - vishay,vcnl4010
- - vishay,vcnl4020
- - vishay,vcnl4040
- - vishay,vcnl4200
+ oneOf:
+ - enum:
+ - capella,cm36672p
+ - vishay,vcnl4000
+ - vishay,vcnl4010
+ - vishay,vcnl4020
+ - vishay,vcnl4040
+ - vishay,vcnl4200
+ - items:
+ - const: capella,cm36686
+ - const: vishay,vcnl4040
interrupts:
maxItems: 1
--
2.53.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v5 2/2] iio: light: vcnl4000: add support for Capella CM36686 and CM36672P
2026-02-17 12:13 [PATCH v5 0/2] iio: light: Add support for Capella cm36686 and cm36672p sensors Erikas Bitovtas
2026-02-17 12:13 ` [PATCH v5 1/2] dt-bindings: iio: light: vcnl4000: add Capella CM36686 and CM36672P Erikas Bitovtas
@ 2026-02-17 12:13 ` Erikas Bitovtas
2026-02-18 19:39 ` [PATCH v5 0/2] iio: light: Add support for Capella cm36686 and cm36672p sensors Jonathan Cameron
2 siblings, 0 replies; 5+ messages in thread
From: Erikas Bitovtas @ 2026-02-17 12:13 UTC (permalink / raw)
To: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Peter Meerwald
Cc: linux-iio, devicetree, linux-kernel, ~postmarketos/upstreaming,
phone-devel, Erikas Bitovtas, Andy Shevchenko
Add support for Capella's CM36686 and CM36672P sensors. Capella
CM36686 is an ambient light and proximity sensor that is fully
compatible with VCNL4040 and can be used as is.
CM36672P is partially compatible with VCNL4040 - it uses the same
register fields for proximity sensing, but the ambient light registers
are reserved. For CM36672P, we reuse vcnl4040_channels, but remove the
IIO_LIGHT channel and ambient light integration time.
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Erikas Bitovtas <xerikasxx@gmail.com>
---
drivers/iio/light/vcnl4000.c | 41 +++++++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
diff --git a/drivers/iio/light/vcnl4000.c b/drivers/iio/light/vcnl4000.c
index a36c23813679..5e03c3d8874b 100644
--- a/drivers/iio/light/vcnl4000.c
+++ b/drivers/iio/light/vcnl4000.c
@@ -185,6 +185,7 @@ static const int vcnl4040_ps_oversampling_ratio[] = {1, 2, 4, 8};
#define VCNL4000_SLEEP_DELAY_MS 2000 /* before we enter pm_runtime_suspend */
enum vcnl4000_device_ids {
+ CM36672P,
VCNL4000,
VCNL4010,
VCNL4040,
@@ -235,6 +236,8 @@ struct vcnl4000_chip_spec {
};
static const struct i2c_device_id vcnl4000_id[] = {
+ { "cm36672p", CM36672P },
+ { "cm36686", VCNL4040 },
{ "vcnl4000", VCNL4000 },
{ "vcnl4010", VCNL4010 },
{ "vcnl4020", VCNL4010 },
@@ -1842,6 +1845,22 @@ static const struct iio_chan_spec vcnl4040_channels[] = {
}
};
+static const struct iio_chan_spec cm36672p_channels[] = {
+ {
+ .type = IIO_PROXIMITY,
+ .info_mask_separate = BIT(IIO_CHAN_INFO_RAW) |
+ BIT(IIO_CHAN_INFO_INT_TIME) |
+ BIT(IIO_CHAN_INFO_OVERSAMPLING_RATIO) |
+ BIT(IIO_CHAN_INFO_CALIBBIAS),
+ .info_mask_separate_available = BIT(IIO_CHAN_INFO_INT_TIME) |
+ BIT(IIO_CHAN_INFO_OVERSAMPLING_RATIO) |
+ BIT(IIO_CHAN_INFO_CALIBBIAS),
+ .ext_info = vcnl4000_ext_info,
+ .event_spec = vcnl4040_event_spec,
+ .num_event_specs = ARRAY_SIZE(vcnl4040_event_spec),
+ },
+};
+
static const struct iio_info vcnl4000_info = {
.read_raw = vcnl4000_read_raw,
};
@@ -1867,6 +1886,19 @@ static const struct iio_info vcnl4040_info = {
};
static const struct vcnl4000_chip_spec vcnl4000_chip_spec_cfg[] = {
+ [CM36672P] = {
+ .prod = "CM36672P",
+ .init = vcnl4200_init,
+ .measure_proximity = vcnl4200_measure_proximity,
+ .set_power_state = vcnl4200_set_power_state,
+ .channels = cm36672p_channels,
+ .num_channels = ARRAY_SIZE(cm36672p_channels),
+ .info = &vcnl4040_info,
+ .irq_thread = vcnl4040_irq_thread,
+ .int_reg = VCNL4040_INT_FLAGS,
+ .ps_it_times = &vcnl4040_ps_it_times,
+ .num_ps_it_times = ARRAY_SIZE(vcnl4040_ps_it_times),
+ },
[VCNL4000] = {
.prod = "VCNL4000",
.init = vcnl4000_init,
@@ -2033,6 +2065,15 @@ static int vcnl4000_probe(struct i2c_client *client)
}
static const struct of_device_id vcnl_4000_of_match[] = {
+ {
+ .compatible = "capella,cm36672p",
+ .data = (void *)CM36672P,
+ },
+ /* Capella CM36686 is fully compatible with Vishay VCNL4040 */
+ {
+ .compatible = "capella,cm36686",
+ .data = (void *)VCNL4040,
+ },
{
.compatible = "vishay,vcnl4000",
.data = (void *)VCNL4000,
--
2.53.0
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v5 1/2] dt-bindings: iio: light: vcnl4000: add Capella CM36686 and CM36672P
2026-02-17 12:13 ` [PATCH v5 1/2] dt-bindings: iio: light: vcnl4000: add Capella CM36686 and CM36672P Erikas Bitovtas
@ 2026-02-17 17:57 ` Conor Dooley
0 siblings, 0 replies; 5+ messages in thread
From: Conor Dooley @ 2026-02-17 17:57 UTC (permalink / raw)
To: Erikas Bitovtas
Cc: Jonathan Cameron, David Lechner, Nuno Sá, Andy Shevchenko,
Rob Herring, Krzysztof Kozlowski, Conor Dooley, Peter Meerwald,
linux-iio, devicetree, linux-kernel, ~postmarketos/upstreaming,
phone-devel
[-- Attachment #1: Type: text/plain, Size: 758 bytes --]
On Tue, Feb 17, 2026 at 02:13:15PM +0200, Erikas Bitovtas wrote:
> Capella CM36686 is an ambient light and proximity sensor developed by
> Capella Microsystems, now a subsidiary of Vishay Intertechnology Inc. It
> has an I2C address of 0x60 and is fully compatible with an existing
> driver for VCNL4040. Capella CM36672P is a proximity-only sensor that
> is partially compatible with CM36686 - they share the same register
> fields for proximity sensing, but ambient light sensor register fields
> in CM36672P are reserved. Add compatibles for cm36672p and cm36686,
> with a fallback for cm36686 of vcnl4040.
>
> Signed-off-by: Erikas Bitovtas <xerikasxx@gmail.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
pw-bot: not-applicable
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH v5 0/2] iio: light: Add support for Capella cm36686 and cm36672p sensors
2026-02-17 12:13 [PATCH v5 0/2] iio: light: Add support for Capella cm36686 and cm36672p sensors Erikas Bitovtas
2026-02-17 12:13 ` [PATCH v5 1/2] dt-bindings: iio: light: vcnl4000: add Capella CM36686 and CM36672P Erikas Bitovtas
2026-02-17 12:13 ` [PATCH v5 2/2] iio: light: vcnl4000: add support for " Erikas Bitovtas
@ 2026-02-18 19:39 ` Jonathan Cameron
2 siblings, 0 replies; 5+ messages in thread
From: Jonathan Cameron @ 2026-02-18 19:39 UTC (permalink / raw)
To: Erikas Bitovtas
Cc: David Lechner, Nuno Sá, Andy Shevchenko, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Peter Meerwald, linux-iio,
devicetree, linux-kernel, ~postmarketos/upstreaming, phone-devel,
Andy Shevchenko
On Tue, 17 Feb 2026 14:13:14 +0200
Erikas Bitovtas <xerikasxx@gmail.com> wrote:
> This patch series adds support for Capella cm36686 and cm36672p ambient
> light and proximity sensors.
>
Series applied to the testing branch of iio.git.
I'll be rebasing on rc1 after the weekend and then pushing out as togreg for
linux-next to pick up.
Thanks,
Jonathan
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-02-18 19:39 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-02-17 12:13 [PATCH v5 0/2] iio: light: Add support for Capella cm36686 and cm36672p sensors Erikas Bitovtas
2026-02-17 12:13 ` [PATCH v5 1/2] dt-bindings: iio: light: vcnl4000: add Capella CM36686 and CM36672P Erikas Bitovtas
2026-02-17 17:57 ` Conor Dooley
2026-02-17 12:13 ` [PATCH v5 2/2] iio: light: vcnl4000: add support for " Erikas Bitovtas
2026-02-18 19:39 ` [PATCH v5 0/2] iio: light: Add support for Capella cm36686 and cm36672p sensors Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox