dt-bindings: iio: Add AMS TCS3430 color sensor bindings
Subsystems (2)
PATCH 1/2 dt-bindings: iio: Add AMS TCS3430 color sensor bindings
The AMS TCS3430 is a XYZ tristimulus color sensor.
It requires a VDD power supply and can optionally support an interrupt.
--- .../bindings/iio/light/ams,tcs3430.yaml | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/light/ams,tcs3430.yaml
Documentation/devicetree/bindings/iio/light/ams,tcs3430.yaml new file +51 -0
@@ -0,0 +1,51 @@ +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/iio/light/ams,tcs3430.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: AMS TCS3430 XYZ tristimulus color sensor + +maintainers: + - Paul Kocialkowski <[email protected]> + +description: | + The device supports both interrupt-driven and interrupt-less operation, + depending on whether an interrupt property is present in the device-tree. + +properties: + compatible: + const: ams,tcs3430 + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + description: The interrupt is detected on a low level. + + vdd-supply: true + +additionalProperties: false + +required: + - compatible + - reg + - vdd-supply + +examples: + - | + #include <dt-bindings/interrupt-controller/irq.h> + i2c { + #address-cells = <1>; + #size-cells = <0>; + + light-sensor@39 { + compatible = "ams,tcs3430"; + reg = <0x39>; + interrupt-parent = <&pio>; + interrupts = <0 8 IRQ_TYPE_EDGE_FALLING>; + vdd-supply = <®_vcc_io>; + }; + }; +...
Signature · 1 line
2.47.0
PATCH 2/2 iio: light: Add support for the AMS TCS3430 color sensor
The AMS TCS3430 is a XYZ tristimulus color sensor, with an additional infrared channel.
This driver implements support for all channels, with configurable integration time and gain. Both direct reading and triggered-buffer modes are supported.
The device's interrupt can be used to sample all channels at the end of conversion and is optional.
A thereshold mechanism is available in hardware but only applies to the Z channel. As a result it is of very low interest and was not implemented.
--- drivers/iio/light/Kconfig | 10 + drivers/iio/light/Makefile | 1 + drivers/iio/light/tcs3430.c | 997 ++++++++++++++++++++++++++++++++++++ 3 files changed, 1008 insertions(+) create mode 100644 drivers/iio/light/tcs3430.c
drivers/iio/light/Kconfig +10 -0
@@ -585,6 +585,16 @@ config TCS3414 This driver can also be built as a module. If so, the module will be called tcs3414. +config TCS3430 + tristate "AMS TCS3430 XYZ tristimulus color sensor driver" + depends on I2C && PM + select IIO_BUFFER + select IIO_TRIGGERED_BUFFER + help + Support for the AMS TCS3430 XYZ tristimulus color sensor. + + This driver can be built-in or built as a module, called tcs3430. + config TCS3472 tristate "TAOS TCS3472 color light-to-digital converter" depends on I2C
drivers/iio/light/Makefile +1 -0
@@ -54,6 +54,7 @@ obj-$(CONFIG_ST_UVIS25) += st_uvis25_core.o obj-$(CONFIG_ST_UVIS25_I2C) += st_uvis25_i2c.o obj-$(CONFIG_ST_UVIS25_SPI) += st_uvis25_spi.o obj-$(CONFIG_TCS3414) += tcs3414.o +obj-$(CONFIG_TCS3430) += tcs3430.o obj-$(CONFIG_TCS3472) += tcs3472.o obj-$(CONFIG_SENSORS_TSL2563) += tsl2563.o obj-$(CONFIG_TSL2583) += tsl2583.o
drivers/iio/light/tcs3430.c new file +997 -0
997 lines not on this page · raw message
Signature · 1 line
2.47.0
kernel test robot
build botRe: [PATCH 2/2] iio: light: Add support for the AMS TCS3430 color sensor
kernel test robot noticed the following build warnings:
Hi Paul,
kernel test robot noticed the following build warnings:
[auto build test WARNING on jic23-iio/togreg]
[also build test WARNING on linus/master v6.12 next-20241128] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Paul-Kocialkowski/iio-light-Add-support-for-the-AMS-TCS3430-color-sensor/20241201-014517 base: https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg patch link: https://lore.kernel.org/r/20241130174239.3298414-2-paulk%40sys-base.io patch subject: [PATCH 2/2] iio: light: Add support for the AMS TCS3430 color sensor config: um-allmodconfig (https://download.01.org/0day-ci/archive/20241201/[email protected]/config) compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project 592c0fe55f6d9a811028b5f3507be91458ab2713) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241201/[email protected]/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <[email protected]>
| Closes: https://lore.kernel.org/oe-kbuild-all/[email protected]/
All warnings (new ones prefixed by >>):
In file included from drivers/iio/light/tcs3430.c:7:
In file included from include/linux/i2c.h:19:
In file included from include/linux/regulator/consumer.h:35:
In file included from include/linux/suspend.h:5:
In file included from include/linux/swap.h:9:
In file included from include/linux/memcontrol.h:13:
In file included from include/linux/cgroup.h:26:
In file included from include/linux/kernel_stat.h:8:
In file included from include/linux/interrupt.h:11:
In file included from include/linux/hardirq.h:11:
In file included from arch/um/include/asm/hardirq.h:5:
In file included from include/asm-generic/hardirq.h:17:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:14:
In file included from arch/um/include/asm/io.h:24:
include/asm-generic/io.h:548:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
548 | val = __raw_readb(PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:561:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
561 | val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
| ~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu'
37 | #define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
| ^
In file included from drivers/iio/light/tcs3430.c:7:
In file included from include/linux/i2c.h:19:
In file included from include/linux/regulator/consumer.h:35:
In file included from include/linux/suspend.h:5:
In file included from include/linux/swap.h:9:
In file included from include/linux/memcontrol.h:13:
In file included from include/linux/cgroup.h:26:
In file included from include/linux/kernel_stat.h:8:
In file included from include/linux/interrupt.h:11:
In file included from include/linux/hardirq.h:11:
In file included from arch/um/include/asm/hardirq.h:5:
In file included from include/asm-generic/hardirq.h:17:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:14:
In file included from arch/um/include/asm/io.h:24:
include/asm-generic/io.h:574:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
574 | val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
| ~~~~~~~~~~ ^
include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu'
35 | #define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
| ^
In file included from drivers/iio/light/tcs3430.c:7:
In file included from include/linux/i2c.h:19:
In file included from include/linux/regulator/consumer.h:35:
In file included from include/linux/suspend.h:5:
In file included from include/linux/swap.h:9:
In file included from include/linux/memcontrol.h:13:
In file included from include/linux/cgroup.h:26:
In file included from include/linux/kernel_stat.h:8:
In file included from include/linux/interrupt.h:11:
In file included from include/linux/hardirq.h:11:
In file included from arch/um/include/asm/hardirq.h:5:
In file included from include/asm-generic/hardirq.h:17:
In file included from include/linux/irq.h:20:
In file included from include/linux/io.h:14:
In file included from arch/um/include/asm/io.h:24:
include/asm-generic/io.h:585:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
585 | __raw_writeb(value, PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:595:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
595 | __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:605:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
605 | __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:693:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
693 | readsb(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:701:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
701 | readsw(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:709:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
709 | readsl(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:718:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
718 | writesb(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:727:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
727 | writesw(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
include/asm-generic/io.h:736:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
736 | writesl(PCI_IOBASE + addr, buffer, count);
| ~~~~~~~~~~ ^
In file included from drivers/iio/light/tcs3430.c:7:
In file included from include/linux/i2c.h:19:
In file included from include/linux/regulator/consumer.h:35:
In file included from include/linux/suspend.h:5:
In file included from include/linux/swap.h:9:
In file included from include/linux/memcontrol.h:21:
In file included from include/linux/mm.h:2213:
include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
518 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
| ~~~~~~~~~~~ ^ ~~~
>> drivers/iio/light/tcs3430.c:134:27: warning: variable 'index' is uninitialized when used here [-Wuninitialized]
134 | sensor->atime_available[index] = atime_us / USEC_PER_SEC;
| ^~~~~
drivers/iio/light/tcs3430.c:128:20: note: initialize the variable 'index' to silence this warning
128 | unsigned int index;
| ^
| = 0
>> drivers/iio/light/tcs3430.c:565:3: warning: label followed by a declaration is a C23 extension [-Wc23-extensions]
565 | unsigned int scan_index;
| ^
drivers/iio/light/tcs3430.c:600:3: warning: label followed by a declaration is a C23 extension [-Wc23-extensions]
600 | unsigned int atime_us = state->atime_cycles *
| ^
drivers/iio/light/tcs3430.c:654:3: warning: label followed by a declaration is a C23 extension [-Wc23-extensions]
654 | unsigned int atime_us = value_first * USEC_PER_SEC +
| ^
drivers/iio/light/tcs3430.c:674:3: warning: label followed by a declaration is a C23 extension [-Wc23-extensions]
674 | unsigned int i;
| ^18 warnings generated.
vim +/index +134 drivers/iio/light/tcs3430.c
124
125 static void tcs3430_atime_available_setup(struct tcs3430_sensor *sensor)
126 {
127 unsigned int atime_us;
128 unsigned int index;
129 unsigned int i;
130
131 for (i = 0; i < TCS3430_ATIME_CYCLES_MAX; i++) {
132 atime_us = (i + 1) * TCS3430_ATIME_CYCLE_TIME_US;
133
> 134 sensor->atime_available[index] = atime_us / USEC_PER_SEC;
135 index++;
136 sensor->atime_available[index] = atime_us % USEC_PER_SEC;
137 index++;
138 }
139 }
140
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
Jonathan Cameron
maintainerRe: [PATCH 2/2] iio: light: Add support for the AMS TCS3430 color sensor
In reply to Paul KocialkowskiQuoted 7 lines · On Sat, 30 Nov 2024 18:42:39 +0100 Paul Kocialkowski <[email protected]> wrote:
The AMS TCS3430 is a XYZ tristimulus color sensor, with an additional infrared channel.
This driver implements support for all channels, with configurable integration time and gain. Both direct reading and triggered-buffer modes are supported.
Quoted 8 lines
The device's interrupt can be used to sample all channels at the end of conversion and is optional.
A thereshold mechanism is available in hardware but only applies to the Z channel. As a result it is of very low interest and was not implemented.
Signed-off-by Paul Kocialkowski <[email protected]>
Hi Paul
As at least some of the feedback I gave on your other driver applies here as well, I'm not going to review this version separately.
I'd generally advise against sending multiple similar drivers for review at the same time as it is less efficient. Sad truth is that reviewer time is generally a bigger bottleneck for kernel code than the time of driver authors. Any time you can put in to help with that will generally also accelerate the rate at which we get to your code!
Absolutely fine to overlap your submissions though. When the first driver is getting close to being merged, feel free to send the second one to get review started.
Thanks,
Jonathan
Re: [PATCH 2/2] iio: light: Add support for the AMS TCS3430 color sensor
Hi,
Quoted 30 lines · Jonathan Cameron
Quoted 7 lines · On Sat, 30 Nov 2024 18:42:39 +0100 Paul Kocialkowski <[email protected]> wrote:
The AMS TCS3430 is a XYZ tristimulus color sensor, with an additional infrared channel.
This driver implements support for all channels, with configurable integration time and gain. Both direct reading and triggered-buffer modes are supported.
Quoted 8 lines
The device's interrupt can be used to sample all channels at the end of conversion and is optional.
A thereshold mechanism is available in hardware but only applies to the Z channel. As a result it is of very low interest and was not implemented.
Signed-off-by Paul Kocialkowski <[email protected]>Hi Paul
As at least some of the feedback I gave on your other driver applies here as well, I'm not going to review this version separately.
I'd generally advise against sending multiple similar drivers for review at the same time as it is less efficient. Sad truth is that reviewer time is generally a bigger bottleneck for kernel code than the time of driver authors. Any time you can put in to help with that will generally also accelerate the rate at which we get to your code!
Quoted 3 lines
Absolutely fine to overlap your submissions though. When the first driver is getting close to being merged, feel free to send the second one to get review started.
That makes sense yes! Let's focus on the first driver for now and I'll apply corresponding changes to this one when the first one is ready.
Thanks!
Paul
Signature · 6 lines
Paul Kocialkowski, Independent contractor - sys-base - https://www.sys-base.io/ Free software developer - https://www.paulk.fr/ Expert in multimedia, graphics and embedded hardware support with Linux.
Quoted 6 lines · Paul Kocialkowski
The AMS TCS3430 is a XYZ tristimulus color sensor.
It requires a VDD power supply and can optionally support an interrupt.
Signed-off-by Paul Kocialkowski <[email protected]>---
Same comments as with other patchset.
Best regards,
Krzysztof