Support for Texas Instruments OPT4060 RGBW Color sensor.
Subsystems (2)
v3 cover Support for Texas Instruments OPT4060 RGBW Color sensor.
This patch series adds support for Texas Instruments OPT4060 RGBW Color sensor using the i2c interface.
The driver exposes both raw adc values and sensor compensated values through sysfs. Integration time can be configured through sysfs as well. The OPT4060 sensor supports both rising and falling threshold interrupts. These interrupts are exposed as IIO events. The driver also implements an IIO triggered buffer with two triggers, one trigger for conversion ready interrupts and one trigger for threshold interrupts. The typical use case for this is to define a threshold and listen for the events, and at the same time enable the triggered buffer with the threshold trigger. Once the application gets the threshold event, the values from the time of the event will be available in the triggered buffer. This limits the number of interrupts between sensor and host and also the the usage of sysfs for reading values after events.
Changes in v3:
- Cover letter: Removed lux from description.
- OPT_4060_DRV_NAME define removed.
- Corrected alignment for struct opt4060_buffer.
- Added description of the CRC calculation.
- Cleaned variable declaration in several places.
- Added a path for the non-irq case in opt4060_read_chan_value(...).
- Added a description of processed values.
- Use of regmap_clear_bits in opt4060_power_down(...).
- Switched to IIO_INTENSITY instead of IIO_LIGHT.
- Correction of channel index in IIO_UNMOD_EVENT_CODE, found by test robot.
- Added iio_chan_spec for the non-irq case without events.
- Fixed braces in a few if-else statements.
- Refactoring with early returns in a few places to reduce indentation.
- Replaced for_each_set_bit with iio_for_each_active_channel.
- Removed various too obvious comments.
- Fixed various other code style problems.
- Link to V2: https://lore.kernel.org/lkml/[email protected]/
Changes in v2:
- dt-bindings: Removed incorrect allOf.
- dt-bindings: Changed to generic node name.
- Correction in opt4060_trigger_one_shot(...) for continuous mode.
- Correction in opt4060_power_down(...), wrong register was read.
- Corrected usage of active_scan_mask in opt4060_trigger_handler(...).
- Clean-up of various comments.
- Link to V1: https://lore.kernel.org/lkml/[email protected]/
Per-Daniel Olsson (2):
dt-bindings: iio: light: Document TI OPT4060 RGBW sensor
iio: light: Add support for TI OPT4060 color sensor
.../bindings/iio/light/ti,opt4060.yaml | 51 + drivers/iio/light/Kconfig | 13 + drivers/iio/light/Makefile | 1 + drivers/iio/light/opt4060.c | 1243 +++++++++++++++++ 4 files changed, 1308 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/light/ti,opt4060.yaml create mode 100644 drivers/iio/light/opt4060.c
base-commit: eca631b8fe808748d7585059c4307005ca5c5820 --
2.39.5
PATCH v3 1/2 dt-bindings: iio: light: Document TI OPT4060 RGBW sensor
Add devicetree bindings for the OPT4060 RGBW color sensor.
--- .../bindings/iio/light/ti,opt4060.yaml | 51 +++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 Documentation/devicetree/bindings/iio/light/ti,opt4060.yaml
Documentation/devicetree/bindings/iio/light/ti,opt4060.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/ti,opt4060.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Texas Instruments OPT4060 RGBW Color Sensor + +maintainers: + - Per-Daniel Olsson <[email protected]> + +description: + Texas Instrument RGBW high resolution color sensor over I2C. + https://www.ti.com/lit/gpn/opt4060 + +properties: + compatible: + enum: + - ti,opt4060 + + reg: + maxItems: 1 + + interrupts: + maxItems: 1 + + vdd-supply: + description: Regulator that provides power to the sensor. + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + #include <dt-bindings/interrupt-controller/irq.h> + i2c { + #address-cells = <1>; + #size-cells = <0>; + + light-sensor@44 { + compatible = "ti,opt4060"; + reg = <0x44>; + vdd-supply = <&vdd_reg>; + interrupt-parent = <&gpio5>; + interrupts = <13 IRQ_TYPE_EDGE_FALLING>; + }; + }; +...
Signature · 1 line
2.39.5
PATCH v3 2/2 iio: light: Add support for TI OPT4060 color sensor
In reply to Per-Daniel OlssonAdd support for Texas Instruments OPT4060 RGBW Color sensor.
--- drivers/iio/light/Kconfig | 13 + drivers/iio/light/Makefile | 1 + drivers/iio/light/opt4060.c | 1243 +++++++++++++++++++++++++++++++++++ 3 files changed, 1257 insertions(+) create mode 100644 drivers/iio/light/opt4060.c
drivers/iio/light/Kconfig +13 -0
@@ -490,6 +490,19 @@ config OPT4001 If built as a dynamically linked module, it will be called opt4001. +config OPT4060 + tristate "Texas Instruments OPT4060 RGBW Color Sensor" + depends on I2C + select REGMAP_I2C + select IIO_BUFFER + select IIO_TRIGGERED_BUFFER + help + If you say Y or M here, you get support for Texas Instruments + OPT4060 RGBW Color Sensor. + + If built as a dynamically linked module, it will be called + opt4060. + config PA12203001 tristate "TXC PA12203001 light and proximity sensor" depends on I2C
drivers/iio/light/Makefile +1 -0
@@ -42,6 +42,7 @@ obj-$(CONFIG_MAX44009) += max44009.o obj-$(CONFIG_NOA1305) += noa1305.o obj-$(CONFIG_OPT3001) += opt3001.o obj-$(CONFIG_OPT4001) += opt4001.o +obj-$(CONFIG_OPT4060) += opt4060.o obj-$(CONFIG_PA12203001) += pa12203001.o obj-$(CONFIG_ROHM_BU27008) += rohm-bu27008.o obj-$(CONFIG_ROHM_BU27034) += rohm-bu27034.o
drivers/iio/light/opt4060.c new file +1243 -0
1,243 lines not on this page · raw message
Signature · 1 line
2.39.5
kernel test robot
build botRe: [PATCH v3 2/2] iio: light: Add support for TI OPT4060 color sensor
kernel test robot noticed the following build warnings:
Hi Per-Daniel,
kernel test robot noticed the following build warnings:
[auto build test WARNING on eca631b8fe808748d7585059c4307005ca5c5820]
url: https://github.com/intel-lab-lkp/linux/commits/Per-Daniel-Olsson/dt-bindings-iio-light-Document-TI-OPT4060-RGBW-sensor/20241015-224128 base: eca631b8fe808748d7585059c4307005ca5c5820 patch link: https://lore.kernel.org/r/20241015143713.2017626-3-perdaniel.olsson%40axis.com patch subject: [PATCH v3 2/2] iio: light: Add support for TI OPT4060 color sensor config: hexagon-allmodconfig (https://download.01.org/0day-ci/archive/20241016/[email protected]/config) compiler: clang version 20.0.0git (https://github.com/llvm/llvm-project bfe84f7085d82d06d61c632a7bad1e692fd159e4) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241016/[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/opt4060.c:11:
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/hexagon/include/generated/asm/hardirq.h:1:
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/hexagon/include/asm/io.h:328:
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/opt4060.c:11:
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/hexagon/include/generated/asm/hardirq.h:1:
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/hexagon/include/asm/io.h:328:
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/opt4060.c:11:
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/hexagon/include/generated/asm/hardirq.h:1:
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/hexagon/include/asm/io.h:328:
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);
| ~~~~~~~~~~ ^
In file included from drivers/iio/light/opt4060.c:11:
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/opt4060.c:836:2: warning: label at end of compound statement is a C23 extension [-Wc23-extensions]
836 | }
| ^8 warnings generated.
Kconfig warnings: (for reference only)
WARNING: unmet direct dependencies detected for GET_FREE_REGION Depends on [n]: SPARSEMEM [=n]
Selected by [m]:
- RESOURCE_KUNIT_TEST [=m] && RUNTIME_TESTING_MENU [=y] && KUNIT [=m]
vim +836 drivers/iio/light/opt4060.c
807
808 static int opt4060_write_event(struct iio_dev *indio_dev,
809 const struct iio_chan_spec *chan,
810 enum iio_event_type type,
811 enum iio_event_direction dir,
812 enum iio_event_info info,
813 int val, int val2)
814 {
815 struct opt4060_chip *chip = iio_priv(indio_dev);
816
817 switch (info) {
818 case IIO_EV_INFO_VALUE:
819 if (chan->type == IIO_INTENSITY && type == IIO_EV_TYPE_THRESH) {
820 u32 th_lo, th_hi;
821
822 if (opt4060_get_thresholds(chip, &th_lo, &th_hi))
823 return -EFAULT;
824 if (dir == IIO_EV_DIR_FALLING)
825 th_lo = val;
826 else if (dir == IIO_EV_DIR_RISING)
827 th_hi = val;
828 if (opt4060_set_thresholds(chip, th_lo, th_hi))
829 return -EFAULT;
830 return 0;
831 }
832 break;
833 case IIO_EV_INFO_PERIOD:
834 return opt4060_write_ev_period(chip, val, val2);
835 default:
> 836 } 837 return -EINVAL;
838 }
839
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
kernel test robot
build botRe: [PATCH v3 2/2] iio: light: Add support for TI OPT4060 color sensor
In reply to Per-Daniel Olssonkernel test robot noticed the following build warnings:
Hi Per-Daniel,
kernel test robot noticed the following build warnings:
[auto build test WARNING on eca631b8fe808748d7585059c4307005ca5c5820]
url: https://github.com/intel-lab-lkp/linux/commits/Per-Daniel-Olsson/dt-bindings-iio-light-Document-TI-OPT4060-RGBW-sensor/20241015-224128 base: eca631b8fe808748d7585059c4307005ca5c5820 patch link: https://lore.kernel.org/r/20241015143713.2017626-3-perdaniel.olsson%40axis.com patch subject: [PATCH v3 2/2] iio: light: Add support for TI OPT4060 color sensor config: x86_64-randconfig-161-20241017 (https://download.01.org/0day-ci/archive/20241017/[email protected]/config) compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
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]/
smatch warnings:drivers/iio/light/opt4060.c:932 opt4060_volatile_reg() warn: always true condition '(reg >= 0) => (0-u32max >= 0)'
vim +932 drivers/iio/light/opt4060.c
929
930 static bool opt4060_volatile_reg(struct device *dev, unsigned int reg)
931 {
> 932 return (reg >= OPT4060_RED_MSB && reg <= OPT4060_CLEAR_LSB) ||
933 (reg == OPT4060_RES_CTRL);
934 }
935
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
kernel test robot
build botRe: [PATCH v3 2/2] iio: light: Add support for TI OPT4060 color sensor
In reply to Per-Daniel Olssonkernel test robot noticed the following build warnings:
Hi Per-Daniel,
kernel test robot noticed the following build warnings:
[auto build test WARNING on eca631b8fe808748d7585059c4307005ca5c5820]
url: https://github.com/intel-lab-lkp/linux/commits/Per-Daniel-Olsson/dt-bindings-iio-light-Document-TI-OPT4060-RGBW-sensor/20241015-224128 base: eca631b8fe808748d7585059c4307005ca5c5820 patch link: https://lore.kernel.org/r/20241015143713.2017626-3-perdaniel.olsson%40axis.com patch subject: [PATCH v3 2/2] iio: light: Add support for TI OPT4060 color sensor config: x86_64-randconfig-121-20241017 (https://download.01.org/0day-ci/archive/20241017/[email protected]/config) compiler: gcc-12 (Debian 12.2.0-14) 12.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241017/[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]/
sparse warnings: (new ones prefixed by >>)
>> drivers/iio/light/opt4060.c:836:9: sparse: sparse: statement expected after case label
vim +836 drivers/iio/light/opt4060.c
807
808 static int opt4060_write_event(struct iio_dev *indio_dev,
809 const struct iio_chan_spec *chan,
810 enum iio_event_type type,
811 enum iio_event_direction dir,
812 enum iio_event_info info,
813 int val, int val2)
814 {
815 struct opt4060_chip *chip = iio_priv(indio_dev);
816
817 switch (info) {
818 case IIO_EV_INFO_VALUE:
819 if (chan->type == IIO_INTENSITY && type == IIO_EV_TYPE_THRESH) {
820 u32 th_lo, th_hi;
821
822 if (opt4060_get_thresholds(chip, &th_lo, &th_hi))
823 return -EFAULT;
824 if (dir == IIO_EV_DIR_FALLING)
825 th_lo = val;
826 else if (dir == IIO_EV_DIR_RISING)
827 th_hi = val;
828 if (opt4060_set_thresholds(chip, th_lo, th_hi))
829 return -EFAULT;
830 return 0;
831 }
832 break;
833 case IIO_EV_INFO_PERIOD:
834 return opt4060_write_ev_period(chip, val, val2);
835 default:
> 836 } 837 return -EINVAL;
838 }
839
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
kernel test robot
build botRe: [PATCH v3 2/2] iio: light: Add support for TI OPT4060 color sensor
In reply to Per-Daniel Olssonkernel test robot noticed the following build warnings:
Hi Per-Daniel,
kernel test robot noticed the following build warnings:
[auto build test WARNING on eca631b8fe808748d7585059c4307005ca5c5820]
url: https://github.com/intel-lab-lkp/linux/commits/Per-Daniel-Olsson/dt-bindings-iio-light-Document-TI-OPT4060-RGBW-sensor/20241015-224128 base: eca631b8fe808748d7585059c4307005ca5c5820 patch link: https://lore.kernel.org/r/20241015143713.2017626-3-perdaniel.olsson%40axis.com patch subject: [PATCH v3 2/2] iio: light: Add support for TI OPT4060 color sensor config: powerpc64-randconfig-r063-20241017 (https://download.01.org/0day-ci/archive/20241017/[email protected]/config) compiler: clang version 17.0.6 (https://github.com/llvm/llvm-project 6009708b4367171ccdbf4b5905cb6a803753fe18) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241017/[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 >>):
>> drivers/iio/light/opt4060.c:836:2: warning: label at end of compound statement is a C2x extension [-Wc2x-extensions]
836 | }
| ^1 warning generated.
vim +836 drivers/iio/light/opt4060.c
807
808 static int opt4060_write_event(struct iio_dev *indio_dev,
809 const struct iio_chan_spec *chan,
810 enum iio_event_type type,
811 enum iio_event_direction dir,
812 enum iio_event_info info,
813 int val, int val2)
814 {
815 struct opt4060_chip *chip = iio_priv(indio_dev);
816
817 switch (info) {
818 case IIO_EV_INFO_VALUE:
819 if (chan->type == IIO_INTENSITY && type == IIO_EV_TYPE_THRESH) {
820 u32 th_lo, th_hi;
821
822 if (opt4060_get_thresholds(chip, &th_lo, &th_hi))
823 return -EFAULT;
824 if (dir == IIO_EV_DIR_FALLING)
825 th_lo = val;
826 else if (dir == IIO_EV_DIR_RISING)
827 th_hi = val;
828 if (opt4060_set_thresholds(chip, th_lo, th_hi))
829 return -EFAULT;
830 return 0;
831 }
832 break;
833 case IIO_EV_INFO_PERIOD:
834 return opt4060_write_ev_period(chip, val, val2);
835 default:
> 836 } 837 return -EINVAL;
838 }
839
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki
kernel test robot
build botRe: [PATCH v3 2/2] iio: light: Add support for TI OPT4060 color sensor
In reply to Per-Daniel Olssonkernel test robot noticed the following build errors:
Hi Per-Daniel,
kernel test robot noticed the following build errors:
[auto build test ERROR on eca631b8fe808748d7585059c4307005ca5c5820]
url: https://github.com/intel-lab-lkp/linux/commits/Per-Daniel-Olsson/dt-bindings-iio-light-Document-TI-OPT4060-RGBW-sensor/20241015-224128 base: eca631b8fe808748d7585059c4307005ca5c5820 patch link: https://lore.kernel.org/r/20241015143713.2017626-3-perdaniel.olsson%40axis.com patch subject: [PATCH v3 2/2] iio: light: Add support for TI OPT4060 color sensor config: um-randconfig-r113-20241017 (https://download.01.org/0day-ci/archive/20241018/[email protected]/config) compiler: clang version 15.0.7 (https://github.com/llvm/llvm-project 8dfdcc7b7bf66834a761bd8de445840ef68e4d1a) reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241018/[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 errors (new ones prefixed by >>):
In file included from drivers/iio/light/opt4060.c:11:
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]
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]
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'
#define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
^
In file included from drivers/iio/light/opt4060.c:11:
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]
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'
#define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
^
In file included from drivers/iio/light/opt4060.c:11:
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]
__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]
__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]
__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]
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]
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]
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]
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]
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]
writesl(PCI_IOBASE + addr, buffer, count);
~~~~~~~~~~ ^
>> drivers/iio/light/opt4060.c:835:10: error: label at end of compound statement: expected statement
default:
^
;12 warnings and 1 error generated.
vim +835 drivers/iio/light/opt4060.c
807
808 static int opt4060_write_event(struct iio_dev *indio_dev,
809 const struct iio_chan_spec *chan,
810 enum iio_event_type type,
811 enum iio_event_direction dir,
812 enum iio_event_info info,
813 int val, int val2)
814 {
815 struct opt4060_chip *chip = iio_priv(indio_dev);
816
817 switch (info) {
818 case IIO_EV_INFO_VALUE:
819 if (chan->type == IIO_INTENSITY && type == IIO_EV_TYPE_THRESH) {
820 u32 th_lo, th_hi;
821
822 if (opt4060_get_thresholds(chip, &th_lo, &th_hi))
823 return -EFAULT;
824 if (dir == IIO_EV_DIR_FALLING)
825 th_lo = val;
826 else if (dir == IIO_EV_DIR_RISING)
827 th_hi = val;
828 if (opt4060_set_thresholds(chip, th_lo, th_hi))
829 return -EFAULT;
830 return 0;
831 }
832 break;
833 case IIO_EV_INFO_PERIOD:
834 return opt4060_write_ev_period(chip, val, val2);
> 835 default: 836 }
837 return -EINVAL;
838 }
839
Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki