From 3581f923166b044058cef06941d1b20133772a6f Mon Sep 17 00:00:00 2001 From: Ryan Murray Date: Sun, 1 Nov 2026 11:47:32 +1100 Subject: [PATCH] iio: aop_als: report colour temperature as IIO_COLORTEMP The Redbird colour temperature was exported as an IIO_CCT channel, in_cct_input. No other driver uses that type and the IIO ABI does not document it, so userspace looking for an ambient colour temperature (for example an ambient white point policy) reads in_colortemp_*, the documented channel that hid-sensor-als also provides. Report the same firmware-computed Kelvin value as a processed IIO_COLORTEMP channel, in_colortemp_input. Lux, the report decoding and the CT720 and CT817 parts are unchanged. Update the driver ABI note, the driver documentation and the J616s parity collector to the new name. Assisted-by: LLM Signed-off-by: Ryan Murray --- Documentation/ABI/testing/sysfs-driver-aop-als | 5 +++-- Documentation/iio/apple-aop-als.rst | 5 +++-- drivers/iio/common/aop_sensors/aop_als.rs | 2 +- rust/bindings/bindings_helper.h | 2 +- tools/testing/selftests/drivers/apple/j616s-parity.py | 2 +- 5 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Documentation/ABI/testing/sysfs-driver-aop-als b/Documentation/ABI/testing/sysfs-driver-aop-als index c5b6acd796242..410b9d2f1341a 100644 --- a/Documentation/ABI/testing/sysfs-driver-aop-als +++ b/Documentation/ABI/testing/sysfs-driver-aop-als @@ -1,8 +1,9 @@ -What: /sys/bus/iio/devices/iio:deviceX/in_cct_input +What: /sys/bus/iio/devices/iio:deviceX/in_colortemp_input Date: October 2026 Contact: linux-iio@vger.kernel.org Description: - Firmware-computed correlated colour temperature in Kelvin on + Firmware-computed light colour temperature (correlated colour + temperature) in Kelvin, processed, on aop-sensors-als devices with a Redbird (VD6286) sensor. Fractional Kelvin are reported with micro resolution. There is no raw photodiode-to-CCT conversion in the host driver. diff --git a/Documentation/iio/apple-aop-als.rst b/Documentation/iio/apple-aop-als.rst index a19625a84be75..bf96aaebec858 100644 --- a/Documentation/iio/apple-aop-als.rst +++ b/Documentation/iio/apple-aop-als.rst @@ -17,7 +17,8 @@ must not be distributed with test fixtures. The `public Redbird report description `_ identifies a 122-byte report carrying a firmware-computed CCT float at byte -0x45. The driver exports that layout as ``in_cct_input``, in Kelvin, without +0x45. The driver exports that value as the standard IIO colour temperature +channel, ``in_colortemp_input``, processed and in Kelvin, without recalculating colour temperature from raw channels. Other lengths do not supply a CCT reading. This layout must be verified on each firmware family before its CCT readings are used for display policy. The existing CT720 and @@ -29,7 +30,7 @@ device number:: for d in /sys/bus/iio/devices/iio:device*; do [ "$(cat "$d/name" 2>/dev/null)" = aop-sensors-als ] || continue cat "$d/in_illuminance_input" - [ ! -e "$d/in_cct_input" ] || cat "$d/in_cct_input" + [ ! -e "$d/in_colortemp_input" ] || cat "$d/in_colortemp_input" done These attributes contain the last valid reading, not a sample counter. Polling diff --git a/drivers/iio/common/aop_sensors/aop_als.rs b/drivers/iio/common/aop_sensors/aop_als.rs index 5e6c5001ad2b8..e64f7ff26a6e0 100644 --- a/drivers/iio/common/aop_sensors/aop_als.rs +++ b/drivers/iio/common/aop_sensors/aop_als.rs @@ -268,7 +268,7 @@ impl platform::Driver for IIOAopAlsDriver { &adata, service, offset, - [ty, bindings::BINDINGS_IIO_CCT], + [ty, bindings::BINDINGS_IIO_COLORTEMP], )?; ( listener, diff --git a/rust/bindings/bindings_helper.h b/rust/bindings/bindings_helper.h index 145711b2ccf00..4062a9f1bc0d8 100644 --- a/rust/bindings/bindings_helper.h +++ b/rust/bindings/bindings_helper.h @@ -169,7 +169,7 @@ const u32 BINDINGS_IIO_CHAN_INFO_PROCESSED = IIO_CHAN_INFO_PROCESSED; const u32 BINDINGS_IIO_CHAN_INFO_SCALE = IIO_CHAN_INFO_SCALE; const u32 BINDINGS_IIO_ANGL = IIO_ANGL; const u32 BINDINGS_IIO_LIGHT = IIO_LIGHT; -const u32 BINDINGS_IIO_CCT = IIO_CCT; +const u32 BINDINGS_IIO_COLORTEMP = IIO_COLORTEMP; const u32 BINDINGS_IIO_ACCEL = IIO_ACCEL; const u32 BINDINGS_IIO_ANGL_VEL = IIO_ANGL_VEL; const u32 BINDINGS_IIO_TIMESTAMP = IIO_TIMESTAMP; diff --git a/tools/testing/selftests/drivers/apple/j616s-parity.py b/tools/testing/selftests/drivers/apple/j616s-parity.py index d8835771f36c8..78b1594d5cb60 100644 --- a/tools/testing/selftests/drivers/apple/j616s-parity.py +++ b/tools/testing/selftests/drivers/apple/j616s-parity.py @@ -30,7 +30,7 @@ for device in pathlib.Path('/sys/bus/iio/devices').glob('iio:device*'): try: if (device / 'name').read_text().strip() == 'aop-sensors-als': - als += [device / 'in_illuminance_input', device / 'in_cct_input'] + als += [device / 'in_illuminance_input', device / 'in_colortemp_input'] except OSError: pass paths += als