leds: Add LED1202 I2C driver
PATCH 2/2 leds: Add LED1202 I2C driver
The LED1202 is a 12-channel low quiescent current LED driver. The output current can be adjusted separately for each channel by 8-bit analog (current sink input) and 12-bit digital (PWM) dimming control.
The LED1202 implements 12 low-side current generators with independent dimming control. Internal volatile memory allows the user to store up to 8 different patterns, each pattern is a particular output configuration in terms of PWM duty-cycle (on 4096 steps). Analog dimming (on 256 steps) is
per channel but common to all patterns.
Each active=1 device tree LED node will have a corresponding entry in /sys/class/leds with the label name.
The brightness property corresponds to the per channel analog dimming, while the patterns[1-8] to the PWM dimming control.
--- drivers/leds/Kconfig | 10 + drivers/leds/Makefile | 1 + drivers/leds/leds-led1202.c | 617 ++++++++++++++++++++++++++++++++++++ 3 files changed, 628 insertions(+) create mode 100644 drivers/leds/leds-led1202.c
drivers/leds/Kconfig +10 -0
@@ -899,6 +899,16 @@ config LEDS_LM36274 Say Y to enable the LM36274 LED driver for TI LMU devices. This supports the LED device LM36274. +config LEDS_LED1202 + tristate "LED Support for LED1202 I2C chips" + depends on LEDS_CLASS + depends on I2C + depends on OF + help + Say Y to enable support for LEDs connected to LED1202 + LED driver chips accessed via the I2C bus. + Supported devices include LED1202. + config LEDS_TPS6105X tristate "LED support for TI TPS6105X" depends on LEDS_CLASS
drivers/leds/Makefile +1 -0
@@ -36,6 +36,7 @@ obj-$(CONFIG_LEDS_IP30) += leds-ip30.o obj-$(CONFIG_LEDS_IPAQ_MICRO) += leds-ipaq-micro.o obj-$(CONFIG_LEDS_IS31FL319X) += leds-is31fl319x.o obj-$(CONFIG_LEDS_IS31FL32XX) += leds-is31fl32xx.o +obj-$(CONFIG_LEDS_LED1202) += leds-led1202.o obj-$(CONFIG_LEDS_LM3530) += leds-lm3530.o obj-$(CONFIG_LEDS_LM3532) += leds-lm3532.o obj-$(CONFIG_LEDS_LM3533) += leds-lm3533.o
drivers/leds/leds-led1202.c new file +617 -0
617 lines not on this page · raw message
Signature · 1 line
2.25.1
kernel test robot
build botkernel test robot noticed the following build errors:
Hi Vicentiu,
kernel test robot noticed the following build errors:
[auto build test ERROR on lee-leds/for-leds-next]
[also build test ERROR on robh/for-next linus/master v6.10-rc4 next-20240617] [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/Vicentiu-Galanopulo/leds-Add-LED1202-I2C-driver/20240618-052035 base: https://git.kernel.org/pub/scm/linux/kernel/git/lee/leds.git for-leds-next patch link: https://lore.kernel.org/r/ZnCoBAG2TNiIz1xE%40admins-Air patch subject: [PATCH v1 2/2] leds: Add LED1202 I2C driver config: openrisc-allyesconfig (https://download.01.org/0day-ci/archive/20240618/[email protected]/config) compiler: or1k-linux-gcc (GCC) 13.2.0 reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240618/[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 include/linux/container_of.h:5,
from include/linux/list.h:5,
from include/linux/module.h:12,
from drivers/leds/leds-led1202.c:7:
>> include/linux/build_bug.h:16:51: error: negative width in bit-field '<anonymous>'
16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
| ^
include/linux/kernel.h:396:10: note: in expansion of macro 'BUILD_BUG_ON_ZERO'
396 | BUILD_BUG_ON_ZERO((perms) > 0777) + \
| ^~~~~~~~~~~~~~~~~
include/linux/sysfs.h:221:26: note: in expansion of macro 'VERIFY_OCTAL_PERMISSIONS'
221 | .mode = VERIFY_OCTAL_PERMISSIONS(_mode) }, \
| ^~~~~~~~~~~~~~~~~~~~~~~~
include/linux/device.h:158:52: note: in expansion of macro '__ATTR'
158 | struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
| ^~~~~~
drivers/leds/leds-led1202.c:373:8: note: in expansion of macro 'DEVICE_ATTR'
373 | static DEVICE_ATTR(led_device_regsdump, 0x00444, ll1202_show_all_registers,
| ^~~~~~~~~~~
>> include/linux/build_bug.h:16:51: error: negative width in bit-field '<anonymous>'
16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
| ^
include/linux/kernel.h:399:10: note: in expansion of macro 'BUILD_BUG_ON_ZERO'
399 | BUILD_BUG_ON_ZERO((((perms) >> 3) & 4) < ((perms) & 4)) + \
| ^~~~~~~~~~~~~~~~~
include/linux/sysfs.h:221:26: note: in expansion of macro 'VERIFY_OCTAL_PERMISSIONS'
221 | .mode = VERIFY_OCTAL_PERMISSIONS(_mode) }, \
| ^~~~~~~~~~~~~~~~~~~~~~~~
include/linux/device.h:158:52: note: in expansion of macro '__ATTR'
158 | struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
| ^~~~~~
drivers/leds/leds-led1202.c:373:8: note: in expansion of macro 'DEVICE_ATTR'
373 | static DEVICE_ATTR(led_device_regsdump, 0x00444, ll1202_show_all_registers,
| ^~~~~~~~~~~
>> include/linux/build_bug.h:16:51: error: negative width in bit-field '<anonymous>'
16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
| ^
include/linux/kernel.h:396:10: note: in expansion of macro 'BUILD_BUG_ON_ZERO'
396 | BUILD_BUG_ON_ZERO((perms) > 0777) + \
| ^~~~~~~~~~~~~~~~~
include/linux/sysfs.h:221:26: note: in expansion of macro 'VERIFY_OCTAL_PERMISSIONS'
221 | .mode = VERIFY_OCTAL_PERMISSIONS(_mode) }, \
| ^~~~~~~~~~~~~~~~~~~~~~~~
include/linux/device.h:158:52: note: in expansion of macro '__ATTR'
158 | struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
| ^~~~~~
drivers/leds/leds-led1202.c:375:8: note: in expansion of macro 'DEVICE_ATTR'
375 | static DEVICE_ATTR(patt_sequence_repetition, 0x00444 | 0x00200,
| ^~~~~~~~~~~
>> include/linux/build_bug.h:16:51: error: negative width in bit-field '<anonymous>'
16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
| ^
include/linux/kernel.h:399:10: note: in expansion of macro 'BUILD_BUG_ON_ZERO'
399 | BUILD_BUG_ON_ZERO((((perms) >> 3) & 4) < ((perms) & 4)) + \
| ^~~~~~~~~~~~~~~~~
include/linux/sysfs.h:221:26: note: in expansion of macro 'VERIFY_OCTAL_PERMISSIONS'
221 | .mode = VERIFY_OCTAL_PERMISSIONS(_mode) }, \
| ^~~~~~~~~~~~~~~~~~~~~~~~
include/linux/device.h:158:52: note: in expansion of macro '__ATTR'
158 | struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
| ^~~~~~
drivers/leds/leds-led1202.c:375:8: note: in expansion of macro 'DEVICE_ATTR'
375 | static DEVICE_ATTR(patt_sequence_repetition, 0x00444 | 0x00200,
| ^~~~~~~~~~~
>> include/linux/build_bug.h:16:51: error: negative width in bit-field '<anonymous>'
16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
| ^
include/linux/kernel.h:396:10: note: in expansion of macro 'BUILD_BUG_ON_ZERO'
396 | BUILD_BUG_ON_ZERO((perms) > 0777) + \
| ^~~~~~~~~~~~~~~~~
include/linux/sysfs.h:221:26: note: in expansion of macro 'VERIFY_OCTAL_PERMISSIONS'
221 | .mode = VERIFY_OCTAL_PERMISSIONS(_mode) }, \
| ^~~~~~~~~~~~~~~~~~~~~~~~
include/linux/device.h:158:52: note: in expansion of macro '__ATTR'
158 | struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
| ^~~~~~
drivers/leds/leds-led1202.c:378:8: note: in expansion of macro 'DEVICE_ATTR'
378 | static DEVICE_ATTR(current_mA, 0x00444, ll1202_show_channel_mA_current, NULL);
| ^~~~~~~~~~~
>> include/linux/build_bug.h:16:51: error: negative width in bit-field '<anonymous>'
16 | #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
| ^
include/linux/kernel.h:399:10: note: in expansion of macro 'BUILD_BUG_ON_ZERO'
399 | BUILD_BUG_ON_ZERO((((perms) >> 3) & 4) < ((perms) & 4)) + \
| ^~~~~~~~~~~~~~~~~
include/linux/sysfs.h:221:26: note: in expansion of macro 'VERIFY_OCTAL_PERMISSIONS'
221 | .mode = VERIFY_OCTAL_PERMISSIONS(_mode) }, \
| ^~~~~~~~~~~~~~~~~~~~~~~~
include/linux/device.h:158:52: note: in expansion of macro '__ATTR'
158 | struct device_attribute dev_attr_##_name = __ATTR(_name, _mode, _show, _store)
| ^~~~~~
drivers/leds/leds-led1202.c:378:8: note: in expansion of macro 'DEVICE_ATTR'
378 | static DEVICE_ATTR(current_mA, 0x00444, ll1202_show_channel_mA_current, NULL);
| ^~~~~~~~~~~vim +16 include/linux/build_bug.h
bc6245e5efd70c Ian Abbott 2017-07-10 6
bc6245e5efd70c Ian Abbott 2017-07-10 7 #ifdef __CHECKER__
bc6245e5efd70c Ian Abbott 2017-07-10 8 #define BUILD_BUG_ON_ZERO(e) (0)
bc6245e5efd70c Ian Abbott 2017-07-10 9 #else /* __CHECKER__ */
bc6245e5efd70c Ian Abbott 2017-07-10 10 /*
bc6245e5efd70c Ian Abbott 2017-07-10 11 * Force a compilation error if condition is true, but also produce a
8788994376d84d Rikard Falkeborn 2019-12-04 12 * result (of value 0 and type int), so the expression can be used
bc6245e5efd70c Ian Abbott 2017-07-10 13 * e.g. in a structure initializer (or where-ever else comma expressions
bc6245e5efd70c Ian Abbott 2017-07-10 14 * aren't permitted).
bc6245e5efd70c Ian Abbott 2017-07-10 15 */
8788994376d84d Rikard Falkeborn 2019-12-04 @16 #define BUILD_BUG_ON_ZERO(e) ((int)(sizeof(struct { int:(-!!(e)); })))
527edbc18a70e7 Masahiro Yamada 2019-01-03 17 #endif /* __CHECKER__ */
527edbc18a70e7 Masahiro Yamada 2019-01-03 18 Signature · 2 lines
0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests/wiki