mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Robert Ijtsma via B4 Relay <devnull+robertijtsma.gmail.com@kernel.org>
Cc: robertijtsma@gmail.com, "David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Rob Herring" <robh@kernel.org>,
	"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
	"Conor Dooley" <conor+dt@kernel.org>,
	"Matti Vaittinen" <mazziesaccount@gmail.com>,
	linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	"Krzysztof Kozlowski" <krzysztof.kozlowski@oss.qualcomm.com>,
	"Andy Shevchenko" <andriy.shevchenko@intel.com>
Subject: Re: [PATCH v4 0/2] iio: light: add support for ams OSRAM TCS3430
Date: Sat, 5 Dec 2026 00:21:36 +0000	[thread overview]
Message-ID: <20261205002136.065af4f5@jic23-hlaptop> (raw)
In-Reply-To: <20261128-iio-tcs3430-v4-0-14d03e411f8e@gmail.com>

On Sat, 28 Nov 2026 21:40:46 +0100
Robert Ijtsma via B4 Relay <devnull+robertijtsma.gmail.com@kernel.org> wrote:

> Add Devicetree binding documentation and an IIO driver for the ams OSRAM
> TCS3430 ambient light and CIE 1931 XYZ tristimulus color sensor.
> 
> Tested on Microsoft Surface Pro X SQ2 (SC8180X), where the sensor is
> connected on I2C at 0x39 and used for ambient light sensing.
> 
> Signed-off-by: Robert Ijtsma <robertijtsma@gmail.com>
> ---
> Changes in v4:
> - Expose IIO_CHAN_INFO_SCALE via info_mask_shared_by_all across both the
>   illuminance and intensity (X, Y, Z, IR1) channels since hardware gain
>   and integration time scale all channels together (Jonathan Cameron).

This wasn't quite this simple - I probably didn't add enough info so sorry
about that. The key bit is in

Documentation/ABI/testing/sysfs-bus-iio

What:		/sys/bus/iio/devices/iio:deviceX/in_intensity_x_raw
What:		/sys/bus/iio/devices/iio:deviceX/in_intensity_y_raw
What:		/sys/bus/iio/devices/iio:deviceX/in_intensity_z_raw
KernelVersion:	5.10
Contact:	linux-iio@vger.kernel.org
Description:
		Unscaled light intensity according to CIE 1931/DIN 5033 color space.
		Units after application of scale are nano nanowatts per square meter.

IR1 is fine because it is loosely defined and so follows normal 'whatever'
scaling for intensity channels. XYZ and are much better behaved though.

We do have some relative scaling in the datasheet figure 8 for a 2700K source.
With that in mind it seems that there should be some multipliers vs illuminance.
The ratios aren't quite what and LLM suggests we should have for a 2700K with
the Z channel apparently reading a bit low - so we may even need separate
X Y and Z scale values.  Maybe it is near enough though that we can have
same scaling for XYZ.

So I'd expect per channel handling to at least split illuminance from XYZ
That should be a fairly simple multiplier though and so be fairly easy
to support.  We need to sort this out before we end up stuck with an ABI
problem that would cause regressions later.

Other than this, the driver looks to be in a good shape to me.

Thanks,

Jonathan





> - Replace <linux/device.h> with <linux/dev_printk.h> and
>   <linux/device/devres.h>, and add blank lines before final return
>   statements (Jonathan Cameron).
> - Move devm_regulator_get_enable(dev, "vdd") after devm_iio_device_alloc()
>   in tcs3430_probe() so hardware power is not touched on allocation failure
>   (Andy Shevchenko).
> - Pick up Andy Shevchenko's Reviewed-by on patch 2/2.
> - Link to v3: https://patch.msgid.link/20261127-iio-tcs3430-v3-0-e191a40a4ae9@gmail.com
> 
> Changes in v3:
> - Import the IIO_GTS_HELPER module namespace via MODULE_IMPORT_NS("IIO_GTS_HELPER")
>   so modular builds (CONFIG_TCS3430=m) pass modpost.
> - Enable REGCACHE_MAPLE with a volatile register table (0x92..0x9b) and
>   regcache_cache_only()/regcache_mark_dirty()/regcache_sync() across
>   suspend/resume (Andy Shevchenko).
> - Align Kconfig tristate prompt, top driver comment, and MODULE_DESCRIPTION(),
>   and keep driver-separation rationale in the commit message rather than
>   Kconfig help (Andy Shevchenko).
> - Simplify tcs3430_set_scale() to drop the keep_time boolean, rename
>   in_range to gain_in_range in tcs3430_set_itime(), use local regmap
>   variables for readability, add blank lines after guard(mutex)(), and
>   keep dev_dbg()/DEFINE_SIMPLE_DEV_PM_OPS() on single lines (Andy Shevchenko).
> - Link to v2: https://lore.kernel.org/r/20261126-iio-tcs3430-v2-0-6c5329d20919@gmail.com
> 
> Changes in v2:
> - Replace hardwaregain control with standard IIO _scale and configurable
>   integration time using the IIO GTS helper (Jonathan Cameron).
> - Hold data->lock across the entire IIO_CHAN_INFO_SCALE path in
>   tcs3430_read_raw() (Jonathan Cameron).
> - Convert register I/O to regmap_i2c (Joshua Crofts).
> - Wrap guard(mutex) declarations in tcs3430_read_raw() switch cases in
>   enclosing blocks to fix Clang -Wjump-misses-init / cleanup scoping
>   (kernel test robot, Joshua Crofts).
> - Use switch(mask) in tcs3430_read_avail() and tcs3430_write_raw(), and
>   drop unused linux/mod_devicetable.h include (Joshua Crofts).
> - Drop redundant L: mailing-list line from MAINTAINERS (Joshua Crofts).
> - Pick up Krzysztof Kozlowski's Reviewed-by on dt-bindings.
> - Link to v1: https://patch.msgid.link/20261124-iio-tcs3430-v1-0-0f2a38a6a4c1@gmail.com
> 
> ---
> Robert Ijtsma (2):
>       dt-bindings: iio: light: add ams OSRAM TCS3430
>       iio: light: add ams OSRAM TCS3430 XYZ and ambient light sensor driver
> 
>  .../devicetree/bindings/iio/light/ams,tcs3430.yaml |  52 ++
>  MAINTAINERS                                        |   6 +
>  drivers/iio/light/Kconfig                          |  12 +
>  drivers/iio/light/Makefile                         |   1 +
>  drivers/iio/light/tcs3430.c                        | 529 +++++++++++++++++++++
>  5 files changed, 600 insertions(+)
> ---
> base-commit: 4843f6873f7c4835e62f2c73ba0fd538e57a2f22
> change-id: 20261124-iio-tcs3430-2f53879527ed
> 
> Best regards,
> --  
> Robert Ijtsma <robertijtsma@gmail.com>
> 
> 


      parent reply	other threads:[~2026-12-05  0:21 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-28 20:40 Robert Ijtsma via B4 Relay
2026-11-28 20:40 ` [PATCH v4 1/2] dt-bindings: iio: light: add " Robert Ijtsma via B4 Relay
2026-11-28 20:40 ` [PATCH v4 2/2] iio: light: add ams OSRAM TCS3430 XYZ and ambient light sensor driver Robert Ijtsma via B4 Relay
2026-12-05  0:21 ` Jonathan Cameron [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261205002136.065af4f5@jic23-hlaptop \
    --to=jic23@kernel.org \
    --cc=andriy.shevchenko@intel.com \
    --cc=andy@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=devnull+robertijtsma.gmail.com@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=krzk+dt@kernel.org \
    --cc=krzysztof.kozlowski@oss.qualcomm.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mazziesaccount@gmail.com \
    --cc=nuno.sa@analog.com \
    --cc=robertijtsma@gmail.com \
    --cc=robh@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®