.../bindings/iio/light/capella,cm36686.yaml | 97 +++ drivers/iio/light/Kconfig | 11 + drivers/iio/light/Makefile | 1 + drivers/iio/light/cm36686.c | 940 +++++++++++++++++++++ 4 files changed, 1049 insertions(+)
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 fully compatible with cm36686,
except that it is a proximity-only sensor.
Unfortunately, datasheets for these sensors are not publicly
available. This code is 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.
This is my first driver on Linux, so I appreciate all the feedback and
patience I receive.
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.
Signed-off-by: Erikas Bitovtas <xerikasxx@gmail.com>
---
Erikas Bitovtas (2):
dt-bindings: Add binding document for cm36686
iio: light: Add support for Capella cm36686 and cm36672p sensors
.../bindings/iio/light/capella,cm36686.yaml | 97 +++
drivers/iio/light/Kconfig | 11 +
drivers/iio/light/Makefile | 1 +
drivers/iio/light/cm36686.c | 940 +++++++++++++++++++++
4 files changed, 1049 insertions(+)
---
base-commit: 9845cf73f7db6094c0d8419d6adb848028f4a921
change-id: 20260201-cm36686-fc7a8385f1cd
Best regards,
--
Erikas Bitovtas <xerikasxx@gmail.com>
On Mon, Feb 09, 2026 at 04:23:40PM +0200, Erikas Bitovtas wrote: > 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 fully compatible with cm36686, > except that it is a proximity-only sensor. So, can we share the code (assuming there is a driver and it already uses or may be converted to regmap APIs)? -- With Best Regards, Andy Shevchenko
On Mon, Feb 09, 2026 at 05:48:22PM +0200, Andy Shevchenko wrote: > On Mon, Feb 09, 2026 at 04:23:40PM +0200, Erikas Bitovtas wrote: > > 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 fully compatible with cm36686, > > except that it is a proximity-only sensor. > > So, can we share the code (assuming there is a driver and it already > uses or may be converted to regmap APIs)? Ah, it's being added with the same driver... So, have you checked if there is any similar HW with the available driver in upstream? -- With Best Regards, Andy Shevchenko
On 2/9/26 5:49 PM, Andy Shevchenko wrote: > On Mon, Feb 09, 2026 at 05:48:22PM +0200, Andy Shevchenko wrote: >> On Mon, Feb 09, 2026 at 04:23:40PM +0200, Erikas Bitovtas wrote: >>> 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 fully compatible with cm36686, >>> except that it is a proximity-only sensor. >> >> So, can we share the code (assuming there is a driver and it already >> uses or may be converted to regmap APIs)? > > Ah, it's being added with the same driver... So, have you checked if there is > any similar HW with the available driver in upstream? > I checked only for other Capella sensors, I forgot that Vishay acquired Capella Microsystems. Now that I checked, vcnl4040 uses the same registers and regfields as cm36686 and can be used instead... I am sorry for wasting your time. Should I add a fallback to vcnl4040's devicetree schema and add cm36672p support by excluding the light channels instead?
On Mon, 9 Feb 2026 20:20:07 +0200 Erikas Bitovtas <xerikasxx@gmail.com> wrote: > On 2/9/26 5:49 PM, Andy Shevchenko wrote: > > On Mon, Feb 09, 2026 at 05:48:22PM +0200, Andy Shevchenko wrote: > >> On Mon, Feb 09, 2026 at 04:23:40PM +0200, Erikas Bitovtas wrote: > >>> 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 fully compatible with cm36686, > >>> except that it is a proximity-only sensor. > >> > >> So, can we share the code (assuming there is a driver and it already > >> uses or may be converted to regmap APIs)? > > > > Ah, it's being added with the same driver... So, have you checked if there is > > any similar HW with the available driver in upstream? > > > > I checked only for other Capella sensors, I forgot that Vishay acquired Capella > Microsystems. Now that I checked, vcnl4040 uses the same registers and regfields > as cm36686 and can be used instead... > I am sorry for wasting your time. Should I add a fallback to vcnl4040's > devicetree schema and add cm36672p support by excluding the light channels instead? > Sounds good to me. Jonathan >
© 2016 - 2026 Red Hat, Inc.