Multicolor Framework updates
Subsystems (3)
v7 cover Multicolor Framework updates
Hello
This is the v7 of the multicolor framework.
Updated the code and documentation for v7:
* Removed monochrome LED color directories.
* Added <led_color>_intensity and <led_color>_max_intensity files to the colors directory.
Dan Murphy (9):
leds: multicolor: Add sysfs interface definition
documention: leds: Add multicolor class documentation
dt: bindings: Add multicolor class dt bindings documention
dt-bindings: leds: Add multicolor ID to the color ID list
leds: Add multicolor ID to the color ID list
leds: multicolor: Introduce a multicolor class definition
dt: bindings: lp50xx: Introduce the lp50xx family of RGB drivers
leds: lp50xx: Add the LP50XX family of the RGB LED driver
leds: Update the lp55xx to use the multi color framework
.../ABI/testing/sysfs-class-led-multicolor | 43 + .../bindings/leds/leds-class-multicolor.txt | 95 +++ .../devicetree/bindings/leds/leds-lp50xx.txt | 148 ++++ Documentation/leds/index.rst | 1 + Documentation/leds/leds-class-multicolor.rst | 91 ++ drivers/leds/Kconfig | 17 + drivers/leds/Makefile | 2 + drivers/leds/led-class-multicolor.c | 326 +++++++ drivers/leds/led-core.c | 1 + drivers/leds/leds-lp50xx.c | 807 ++++++++++++++++++ drivers/leds/leds-lp5523.c | 13 + drivers/leds/leds-lp55xx-common.c | 131 ++- drivers/leds/leds-lp55xx-common.h | 9 + include/dt-bindings/leds/common.h | 3 +- include/linux/led-class-multicolor.h | 84 ++ include/linux/platform_data/leds-lp55xx.h | 6 + 16 files changed, 1754 insertions(+), 23 deletions(-) create mode 100644 Documentation/ABI/testing/sysfs-class-led-multicolor create mode 100644 Documentation/devicetree/bindings/leds/leds-class-multicolor.txt create mode 100644 Documentation/devicetree/bindings/leds/leds-lp50xx.txt create mode 100644 Documentation/leds/leds-class-multicolor.rst create mode 100644 drivers/leds/led-class-multicolor.c create mode 100644 drivers/leds/leds-lp50xx.c create mode 100644 include/linux/led-class-multicolor.h
Signature · 1 line
2.22.0.214.g8dca754b1e
PATCH v7 1/9 leds: multicolor: Add sysfs interface definition
Add a documentation of LED Multicolor LED class specific sysfs attributes.
--- .../ABI/testing/sysfs-class-led-multicolor | 43 +++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 Documentation/ABI/testing/sysfs-class-led-multicolor
Documentation/ABI/testing/sysfs-class-led-multicolor new file +43 -0
@@ -0,0 +1,43 @@ +What: /sys/class/leds/<led>/brightness +Date: Sept 2019 +KernelVersion: 5.5 +Contact: Dan Murphy <[email protected]> +Description: read/write + Writing to this file will update all LEDs within the group to a + calculated percentage of what each color LED intensity is set + to. The percentage is calculated via the equation below: + + led_brightness = requested_value * led_color_intensity/led_color_max_intensity + + For additional details please refer to + Documentation/leds/leds-class-multicolor.rst. + + The value of the color is from 0 to + /sys/class/leds/<led>/max_brightness. + +What: /sys/class/leds/<led>/colors/<led_color>_intensity +Date: Sept 2019 +KernelVersion: 5.5 +Contact: Dan Murphy <[email protected]> +Description: read/write + The led_color directory is dynamically created based on the + colors defined by the registrar of the class. + The value for the led_color is defined in the + include/dt-bindings/leds/common.h. There is one directory per + color presented. The intensity file is created under each + led_color directory and controls the individual LED color + setting. + + The value of the color is from 0 to + /sys/class/leds/<led>/colors/<led_color>_max_intensity. + +What: /sys/class/leds/<led>/colors/<led_color>_max_intensity +Date: Sept 2019 +KernelVersion: 5.5 +Contact: Dan Murphy <[email protected]> +Description: read only + Maximum intensity level for the LED color, default is + 255 (LED_FULL). + + If the LED does not support different intensity levels, this + should be 1.
Signature · 1 line
2.22.0.214.g8dca754b1e
PATCH v7 2/9 documention: leds: Add multicolor class documentation
In reply to Dan MurphyAdd the support documentation on the multicolor LED framework. This document defines the directores and file generated by the multicolor framework. It also documents usage.
--- Documentation/leds/index.rst | 1 + Documentation/leds/leds-class-multicolor.rst | 91 ++++++++++++++++++++ 2 files changed, 92 insertions(+) create mode 100644 Documentation/leds/leds-class-multicolor.rst
Documentation/leds/index.rst +1 -0
@@ -9,6 +9,7 @@ LEDs leds-class leds-class-flash + leds-class-multicolor ledtrig-oneshot ledtrig-transient ledtrig-usbport
Documentation/leds/leds-class-multicolor.rst new file +91 -0
91 lines not on this page · raw message
Signature · 1 line
2.22.0.214.g8dca754b1e
PATCH v7 3/9 dt: bindings: Add multicolor class dt bindings documention
In reply to Dan MurphyAdd DT bindings for the LEDs multicolor class framework.
--- .../bindings/leds/leds-class-multicolor.txt | 95 +++++++++++++++++++ 1 file changed, 95 insertions(+) create mode 100644 Documentation/devicetree/bindings/leds/leds-class-multicolor.txt
Documentation/devicetree/bindings/leds/leds-class-multicolor.txt new file +95 -0
@@ -0,0 +1,95 @@ +* Multicolor LED properties + +Monochrome LEDs can grouped into LED clusters. These clusters can provide a +visible output that have a wide range of colors and intensities. + +The nodes and properties defined in this document are unique to the multicolor +LED class. Common LED nodes and properties are inherited from the common.txt +within this documentation directory. + +Required LED Child properties: + - color : For multicolor LED support this property should be defined as + LED_COLOR_ID_MULTI and further definition can be found in + include/linux/leds/common.h. + +led-controller@30 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "ti,lp5024"; + reg = <0x29>; + + multi-led@1 { + #address-cells = <1>; + #size-cells = <0>; + reg = <1>; + color = <LED_COLOR_ID_MULTI>; + function = LED_FUNCTION_STATUS; + + + led@3 { + reg = <3>; + color = <LED_COLOR_ID_RED>; + }; + + led@4 { + reg = <4>; + color = <LED_COLOR_ID_GREEN>; + }; + + led@5 { + reg = <5>; + color = <LED_COLOR_ID_BLUE>; + }; + }; + + multi-led@2 { + #address-cells = <1>; + #size-cells = <0>; + color = <LED_COLOR_ID_MULTI>; + function = LED_FUNCTION_ACTIVITY; + reg = <2>; + ti,led-bank = <2 3 5>; + + led@6 { + reg = <0x6>; + color = <LED_COLOR_ID_RED>; + led-sources = <6 9 15>; + }; + + led@7 { + reg = <0x7>; + color = <LED_COLOR_ID_GREEN>; + led-sources = <7 10 16>; + }; + + led@8 { + reg = <0x8>; + color = <LED_COLOR_ID_BLUE>; + led-sources = <8 11 17>; + }; + }; + + multi-led@4 { + #address-cells = <1>; + #size-cells = <0>; + reg = <4>; + color = <LED_COLOR_ID_MULTI>; + function = LED_FUNCTION_ACTIVITY; + + led@12 { + reg = <12>; + color = <LED_COLOR_ID_RED>; + }; + + led@13 { + reg = <13>; + color = <LED_COLOR_ID_GREEN>; + }; + + led@14 { + reg = <14>; + color = <LED_COLOR_ID_BLUE>; + }; + }; + +};
Signature · 1 line
2.22.0.214.g8dca754b1e
PATCH v7 4/9 dt-bindings: leds: Add multicolor ID to the color ID list
In reply to Dan MurphyAdd a new color ID that is declared as MULTICOLOR as with the multicolor framework declaring a definitive color is not accurate as the node can contain multiple colors.
--- include/dt-bindings/leds/common.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
include/dt-bindings/leds/common.h +2 -1
@@ -29,7 +29,8 @@#define LED_COLOR_ID_VIOLET 5#define LED_COLOR_ID_YELLOW 6#define LED_COLOR_ID_IR 7 -#define LED_COLOR_ID_MAX 8 +#define LED_COLOR_ID_MULTI 8 +#define LED_COLOR_ID_MAX 9/* Standard LED functions */ #define LED_FUNCTION_ACTIVITY "activity"
Signature · 1 line
2.22.0.214.g8dca754b1e
PATCH v7 5/9 leds: Add multicolor ID to the color ID list
In reply to Dan MurphyAdd a new color ID that is declared as MULTICOLOR as with the multicolor framework declaring a definitive color is not accurate as the node can contain multiple colors.
--- drivers/leds/led-core.c | 1 + 1 file changed, 1 insertion(+)
drivers/leds/led-core.c +1 -0
@@ -34,6 +34,7 @@ const char * const led_colors[LED_COLOR_ID_MAX] = { [LED_COLOR_ID_VIOLET] = "violet", [LED_COLOR_ID_YELLOW] = "yellow", [LED_COLOR_ID_IR] = "ir", + [LED_COLOR_ID_MULTI ] ="multicolor" , };EXPORT_SYMBOL_GPL (led_colors);
Signature · 1 line
2.22.0.214.g8dca754b1e
PATCH v7 6/9 leds: multicolor: Introduce a multicolor class definition
In reply to Dan MurphyIntroduce a multicolor class that groups colored LEDs within a LED node.
The framework allows for dynamically setting individual LEDs or setting brightness levels of LEDs and updating them virtually simultaneously.
--- drivers/leds/Kconfig | 10 + drivers/leds/Makefile | 1 + drivers/leds/led-class-multicolor.c | 326 +++++++++++++++++++++++++++ include/linux/led-class-multicolor.h | 84 +++++++ 4 files changed, 421 insertions(+) create mode 100644 drivers/leds/led-class-multicolor.c create mode 100644 include/linux/led-class-multicolor.h
drivers/leds/Kconfig +10 -0
@@ -30,6 +30,16 @@ config LEDS_CLASS_FLASH for the flash related features of a LED device. It can be built as a module. +config LEDS_CLASS_MULTI_COLOR + tristate "LED Mulit Color LED Class Support" + depends on LEDS_CLASS + help + This option enables the multicolor LED sysfs class in /sys/class/leds. + It wraps LED class and adds multicolor LED specific sysfs attributes + and kernel internal API to it. You'll need this to provide support + for multicolor LEDs that are grouped together. This class is not + intended for single color LEDs. It can be built as a module. + config LEDS_BRIGHTNESS_HW_CHANGED bool "LED Class brightness_hw_changed attribute support" depends on LEDS_CLASS
drivers/leds/Makefile +1 -0
@@ -4,6 +4,7 @@ obj-$(CONFIG_NEW_LEDS) += led-core.o obj-$(CONFIG_LEDS_CLASS) += led-class.o obj-$(CONFIG_LEDS_CLASS_FLASH) += led-class-flash.o +obj-$(CONFIG_LEDS_CLASS_MULTI_COLOR) += led-class-multicolor.o obj-$(CONFIG_LEDS_TRIGGERS) += led-triggers.o # LED Platform Drivers
drivers/leds/led-class-multicolor.c new file +326 -0
326 lines not on this page · raw message
include/linux/led-class-multicolor.h new file +84 -0
84 lines not on this page · raw message
Signature · 1 line
2.22.0.214.g8dca754b1e
PATCH v7 7/9 dt: bindings: lp50xx: Introduce the lp50xx family of RGB drivers
In reply to Dan MurphyIntroduce the bindings for the Texas Instruments LP5036, LP5030, LP5024, LP5018, LP5012 and LP5009 RGB LED device driver. The LP5036/30/24/18/12/9 can control RGB LEDs individually or as part of a control bank group. These devices have the ability to adjust the mixing control for the RGB LEDs to obtain different colors independent of the overall brightness of the LED grouping.
Datasheet:
http://www.ti.com/lit/ds/symlink/lp5012.pdf
http://www.ti.com/lit/ds/symlink/lp5024.pdf
http://www.ti.com/lit/ds/symlink/lp5036.pdf
--- .../devicetree/bindings/leds/leds-lp50xx.txt | 148 ++++++++++++++++++ 1 file changed, 148 insertions(+) create mode 100644 Documentation/devicetree/bindings/leds/leds-lp50xx.txt
Documentation/devicetree/bindings/leds/leds-lp50xx.txt new file +148 -0
@@ -0,0 +1,148 @@ +* Texas Instruments - LP5009/12/18/24/30/36 RGB LED driver + +The LP50XX is multi-channel, I2C RGB LED Drivers that can group RGB LEDs into +a LED group or control them individually. + +The difference in these RGB LED drivers is the number of supported RGB modules. + +Required parent properties: + - compatible: + "ti,lp5009" + "ti,lp5012" + "ti,lp5018" + "ti,lp5024" + "ti,lp5030" + "ti,lp5036" + - reg : I2C slave address + lp5009/12 - 0x28 + lp5018/24 - 0x28 + lp5030/36 - 0x30 + - #address-cells : 1 + - #size-cells : 0 + +Optional parent properties: + - enable-gpios : gpio pin to enable/disable the device. + - vled-supply : LED supply + +Required child properties: + - #address-cells : 1 + - #size-cells : 0 + - reg : This is the LED module number. + - color : see Documentation/devicetree/bindings/leds/common.txt + - function : see Documentation/devicetree/bindings/leds/common.txt + +Required child properties only is LED modules will be banked: + - ti,led-bank : This property denotes the LED module numbers that will + be controlled as a single RGB cluster. Each LED module + number will be controlled by a single LED class instance. + There can only be one instance of the ti,led-bank + property for each device node. + +Required grandchildren properties: + - reg : A single entry denoting the LED module that controls + the RGB cluster. + - color : see Documentation/devicetree/bindings/leds/leds-multicolor.txt + - led-sources : see Documentation/devicetree/bindings/leds/common.txt + +The LED outputs associated with the LED modules are defined in Table 1 of the +corresponding data sheets. + +LP5009 - 2 Total RGB cluster LED outputs 0-1 +LP5012 - 4 Total RGB cluster LED outputs 0-3 +LP5018 - 6 Total RGB cluster LED outputs 0-5 +LP5024 - 8 Total RGB cluster LED outputs 0-7 +LP5030 - 10 Total RGB cluster LED outputs 0-9 +LP5036 - 12 Total RGB cluster LED outputs 0-11 + +Optional child properties: + - label : see Documentation/devicetree/bindings/leds/common.txt + - linux,default-trigger : + see Documentation/devicetree/bindings/leds/common.txt + +Examples: +led-controller@29 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "ti,lp5024"; + reg = <0x29>; + enable-gpios = <&gpio1 28 GPIO_ACTIVE_HIGH>; + vled-supply = <&vmmcsd_fixed>; + + multi-led@1 { + #address-cells = <1>; + #size-cells = <0>; + reg = <1>; + color = <LED_COLOR_ID_MULTI>; + function = LED_FUNCTION_STATUS; + + led@3 { + reg = <3>; + color = <LED_COLOR_ID_RED>; + }; + + led@4 { + reg = <4>; + color = <LED_COLOR_ID_GREEN>; + }; + + led@5 { + reg = <5>; + color = <LED_COLOR_ID_BLUE>; + }; + }; + + multi-led@2 { + #address-cells = <1>; + #size-cells = <0>; + reg = <2>; + color = <LED_COLOR_ID_MULTI>; + function = LED_FUNCTION_STANDBY; + ti,led-bank = <2 3 5>; + + led@6 { + reg = <0x6>; + color = <LED_COLOR_ID_RED>; + led-sources = <6 9 15>; + }; + + led@7 { + reg = <0x7>; + color = <LED_COLOR_ID_GREEN>; + led-sources = <7 10 16>; + }; + + led@8 { + reg = <0x8>; + color = <LED_COLOR_ID_BLUE>; + led-sources = <8 11 17>; + }; + }; + + multi-led@4 { + #address-cells = <1>; + #size-cells = <0>; + reg = <4>; + color = <LED_COLOR_ID_MULTI>; + function = LED_FUNCTION_ACTIVITY; + + led@12 { + reg = <12>; + color = <LED_COLOR_ID_RED>; + }; + + led@13 { + reg = <13>; + color = <LED_COLOR_ID_GREEN>; + }; + + led@14 { + reg = <14>; + color = <LED_COLOR_ID_BLUE>; + }; + }; +}; + +For more product information please see the link below: +http://www.ti.com/lit/ds/symlink/lp5012.pdf +http://www.ti.com/lit/ds/symlink/lp5024.pdf +http://www.ti.com/lit/ds/symlink/lp5036.pdf
Signature · 1 line
2.22.0.214.g8dca754b1e
PATCH v7 8/9 leds: lp50xx: Add the LP50XX family of the RGB LED driver
In reply to Dan MurphyIntroduce the LP5036/30/24/18/12/9 RGB LED driver. The difference in these parts are the number of LED outputs where the:
LP5036 can control 36 LEDs
LP5030 can control 30 LEDs
LP5024 can control 24 LEDs
LP5018 can control 18 LEDs
LP5012 can control 12 LEDs
LP509 can control 9 LEDs
The device has the ability to group LED output into control banks so that multiple LED banks can be controlled with the same mixing and brightness. Inversely the LEDs can also be controlled independently.
--- drivers/leds/Kconfig | 7 + drivers/leds/Makefile | 1 + drivers/leds/leds-lp50xx.c | 807 +++++++++++++++++++++++++++++++++++++ 3 files changed, 815 insertions(+) create mode 100644 drivers/leds/leds-lp50xx.c
drivers/leds/Kconfig +7 -0
@@ -350,6 +350,13 @@ config LEDS_LP3952 To compile this driver as a module, choose M here: the module will be called leds-lp3952. +config LEDS_LP50XX + tristate "LED Support for TI LP5036/30/24/18 LED driver chip" + depends on LEDS_CLASS && REGMAP_I2C + help + If you say yes here you get support for the Texas Instruments + LP5036, LP5030, LP5024 and LP5018 LED driver. + config LEDS_LP55XX_COMMON tristate "Common Driver for TI/National LP5521/5523/55231/5562/8501" depends on LEDS_LP5521 || LEDS_LP5523 || LEDS_LP5562 || LEDS_LP8501
drivers/leds/Makefile +1 -0
@@ -34,6 +34,7 @@ obj-$(CONFIG_LEDS_GPIO_REGISTER) += leds-gpio-register.o obj-$(CONFIG_LEDS_GPIO) += leds-gpio.o obj-$(CONFIG_LEDS_LP3944) += leds-lp3944.o obj-$(CONFIG_LEDS_LP3952) += leds-lp3952.o +obj-$(CONFIG_LEDS_LP50XX) += leds-lp50xx.o obj-$(CONFIG_LEDS_LP55XX_COMMON) += leds-lp55xx-common.o obj-$(CONFIG_LEDS_LP5521) += leds-lp5521.o obj-$(CONFIG_LEDS_LP5523) += leds-lp5523.o
drivers/leds/leds-lp50xx.c new file +807 -0
807 lines not on this page · raw message
Signature · 1 line
2.22.0.214.g8dca754b1e
kbuild test robot
build botRe: [PATCH v7 8/9] leds: lp50xx: Add the LP50XX family of the RGB LED driver
I love your patch! Yet something to improve:
Hi Dan,
I love your patch! Yet something to improve:
[auto build test ERROR on linus/master]
[cannot apply to v5.3 next-20190919]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Dan-Murphy/Multicolor-Framework-updates/20190920-023813
config: x86_64-allyesconfig (attached as .config)
compiler: gcc-7 (Debian 7.4.0-13) 7.4.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
:::::: branch date: 10 hours ago
:::::: commit date: 10 hours agoIf you fix the issue, kindly add following tag
All errors (new ones prefixed by >>):
>> drivers/leds/leds-lp50xx.c:383:27: error: initializer element is not constant
.lp50xx_regmap_config = lp5012_regmap_config,
^~~~~~~~~~~~~~~~~~~~
drivers/leds/leds-lp50xx.c:383:27: note: (near initialization for 'lp50xx_chip_info_tbl[0].lp50xx_regmap_config')
drivers/leds/leds-lp50xx.c:392:27: error: initializer element is not constant
.lp50xx_regmap_config = lp5012_regmap_config,
^~~~~~~~~~~~~~~~~~~~
drivers/leds/leds-lp50xx.c:392:27: note: (near initialization for 'lp50xx_chip_info_tbl[1].lp50xx_regmap_config')
drivers/leds/leds-lp50xx.c:401:27: error: initializer element is not constant
.lp50xx_regmap_config = lp5024_regmap_config,
^~~~~~~~~~~~~~~~~~~~
drivers/leds/leds-lp50xx.c:401:27: note: (near initialization for 'lp50xx_chip_info_tbl[2].lp50xx_regmap_config')
drivers/leds/leds-lp50xx.c:410:27: error: initializer element is not constant
.lp50xx_regmap_config = lp5024_regmap_config,
^~~~~~~~~~~~~~~~~~~~
drivers/leds/leds-lp50xx.c:410:27: note: (near initialization for 'lp50xx_chip_info_tbl[3].lp50xx_regmap_config')
drivers/leds/leds-lp50xx.c:419:27: error: initializer element is not constant
.lp50xx_regmap_config = lp5036_regmap_config,
^~~~~~~~~~~~~~~~~~~~
drivers/leds/leds-lp50xx.c:419:27: note: (near initialization for 'lp50xx_chip_info_tbl[4].lp50xx_regmap_config')
drivers/leds/leds-lp50xx.c:428:27: error: initializer element is not constant
.lp50xx_regmap_config = lp5036_regmap_config,
^~~~~~~~~~~~~~~~~~~~ drivers/leds/leds-lp50xx.c:428:27: note: (near initialization for 'lp50xx_chip_info_tbl[5].lp50xx_regmap_config')
# https://github.com/0day-ci/linux/commit/20af6fb696d0e121b6d3cdcb1aabece15fd070ec
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout 20af6fb696d0e121b6d3cdcb1aabece15fd070ec
vim +383 drivers/leds/leds-lp50xx.c
20af6fb696d0e1 Dan Murphy 2019-09-19 374
20af6fb696d0e1 Dan Murphy 2019-09-19 375 static const struct lp50xx_chip_info lp50xx_chip_info_tbl[] = {
20af6fb696d0e1 Dan Murphy 2019-09-19 376 [LP5009] = {
20af6fb696d0e1 Dan Murphy 2019-09-19 377 .num_leds = LP5009_MAX_LED_MODULES,
20af6fb696d0e1 Dan Murphy 2019-09-19 378 .led_brightness0_reg = LP5012_LED0_BRT,
20af6fb696d0e1 Dan Murphy 2019-09-19 379 .mix_out0_reg = LP5012_OUT0_CLR,
20af6fb696d0e1 Dan Murphy 2019-09-19 380 .bank_brt_reg = LP5012_BNK_BRT,
20af6fb696d0e1 Dan Murphy 2019-09-19 381 .bank_mix_reg = LP5012_BNKA_CLR,
20af6fb696d0e1 Dan Murphy 2019-09-19 382 .reset_reg = LP5012_RESET,
20af6fb696d0e1 Dan Murphy 2019-09-19 @383 .lp50xx_regmap_config = lp5012_regmap_config,
20af6fb696d0e1 Dan Murphy 2019-09-19 384 },
20af6fb696d0e1 Dan Murphy 2019-09-19 385 [LP5012] = {
20af6fb696d0e1 Dan Murphy 2019-09-19 386 .num_leds = LP5012_MAX_LED_MODULES,
20af6fb696d0e1 Dan Murphy 2019-09-19 387 .led_brightness0_reg = LP5012_LED0_BRT,
20af6fb696d0e1 Dan Murphy 2019-09-19 388 .mix_out0_reg = LP5012_OUT0_CLR,
20af6fb696d0e1 Dan Murphy 2019-09-19 389 .bank_brt_reg = LP5012_BNK_BRT,
20af6fb696d0e1 Dan Murphy 2019-09-19 390 .bank_mix_reg = LP5012_BNKA_CLR,
20af6fb696d0e1 Dan Murphy 2019-09-19 391 .reset_reg = LP5012_RESET,
20af6fb696d0e1 Dan Murphy 2019-09-19 392 .lp50xx_regmap_config = lp5012_regmap_config,
20af6fb696d0e1 Dan Murphy 2019-09-19 393 },
20af6fb696d0e1 Dan Murphy 2019-09-19 394 [LP5018] = {
20af6fb696d0e1 Dan Murphy 2019-09-19 395 .num_leds = LP5018_MAX_LED_MODULES,
20af6fb696d0e1 Dan Murphy 2019-09-19 396 .led_brightness0_reg = LP5024_LED0_BRT,
20af6fb696d0e1 Dan Murphy 2019-09-19 397 .mix_out0_reg = LP5024_OUT0_CLR,
20af6fb696d0e1 Dan Murphy 2019-09-19 398 .bank_brt_reg = LP5024_BNK_BRT,
20af6fb696d0e1 Dan Murphy 2019-09-19 399 .bank_mix_reg = LP5024_BNKA_CLR,
20af6fb696d0e1 Dan Murphy 2019-09-19 400 .reset_reg = LP5024_RESET,
20af6fb696d0e1 Dan Murphy 2019-09-19 401 .lp50xx_regmap_config = lp5024_regmap_config,
20af6fb696d0e1 Dan Murphy 2019-09-19 402 },
20af6fb696d0e1 Dan Murphy 2019-09-19 403 [LP5024] = {
20af6fb696d0e1 Dan Murphy 2019-09-19 404 .num_leds = LP5024_MAX_LED_MODULES,
20af6fb696d0e1 Dan Murphy 2019-09-19 405 .led_brightness0_reg = LP5024_LED0_BRT,
20af6fb696d0e1 Dan Murphy 2019-09-19 406 .mix_out0_reg = LP5024_OUT0_CLR,
20af6fb696d0e1 Dan Murphy 2019-09-19 407 .bank_brt_reg = LP5024_BNK_BRT,
20af6fb696d0e1 Dan Murphy 2019-09-19 408 .bank_mix_reg = LP5024_BNKA_CLR,
20af6fb696d0e1 Dan Murphy 2019-09-19 409 .reset_reg = LP5024_RESET,
20af6fb696d0e1 Dan Murphy 2019-09-19 410 .lp50xx_regmap_config = lp5024_regmap_config,
20af6fb696d0e1 Dan Murphy 2019-09-19 411 },
20af6fb696d0e1 Dan Murphy 2019-09-19 412 [LP5030] = {
20af6fb696d0e1 Dan Murphy 2019-09-19 413 .num_leds = LP5030_MAX_LED_MODULES,
20af6fb696d0e1 Dan Murphy 2019-09-19 414 .led_brightness0_reg = LP5036_LED0_BRT,
20af6fb696d0e1 Dan Murphy 2019-09-19 415 .mix_out0_reg = LP5036_OUT0_CLR,
20af6fb696d0e1 Dan Murphy 2019-09-19 416 .bank_brt_reg = LP5036_BNK_BRT,
20af6fb696d0e1 Dan Murphy 2019-09-19 417 .bank_mix_reg = LP5036_BNKA_CLR,
20af6fb696d0e1 Dan Murphy 2019-09-19 418 .reset_reg = LP5036_RESET,
20af6fb696d0e1 Dan Murphy 2019-09-19 419 .lp50xx_regmap_config = lp5036_regmap_config,
20af6fb696d0e1 Dan Murphy 2019-09-19 420 },
20af6fb696d0e1 Dan Murphy 2019-09-19 421 [LP5036] = {
20af6fb696d0e1 Dan Murphy 2019-09-19 422 .num_leds = LP5036_MAX_LED_MODULES,
20af6fb696d0e1 Dan Murphy 2019-09-19 423 .led_brightness0_reg = LP5036_LED0_BRT,
20af6fb696d0e1 Dan Murphy 2019-09-19 424 .mix_out0_reg = LP5036_OUT0_CLR,
20af6fb696d0e1 Dan Murphy 2019-09-19 425 .bank_brt_reg = LP5036_BNK_BRT,
20af6fb696d0e1 Dan Murphy 2019-09-19 426 .bank_mix_reg = LP5036_BNKA_CLR,
20af6fb696d0e1 Dan Murphy 2019-09-19 427 .reset_reg = LP5036_RESET,
20af6fb696d0e1 Dan Murphy 2019-09-19 428 .lp50xx_regmap_config = lp5036_regmap_config,
20af6fb696d0e1 Dan Murphy 2019-09-19 429 },
20af6fb696d0e1 Dan Murphy 2019-09-19 430 };20af6fb696d0e1 Dan Murphy 2019-09-19 431
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
PATCH v7 9/9 leds: Update the lp55xx to use the multi color framework
In reply to Dan MurphyUpdate the lp5523 to use the multi color framework.
--- drivers/leds/leds-lp5523.c | 13 +++ drivers/leds/leds-lp55xx-common.c | 131 ++++++++++++++++++---- drivers/leds/leds-lp55xx-common.h | 9 ++ include/linux/platform_data/leds-lp55xx.h | 6 + 4 files changed, 137 insertions(+), 22 deletions(-)
drivers/leds/leds-lp5523.c +13 -0
@@ -791,6 +791,18 @@ static ssize_t store_master_fader_leds(struct device *dev,return ret; } +static int lp5523_led_intensity (struct lp55xx_led *led,int chan_num) +{ +struct lp55xx_chip *chip = led->chip; +int ret; + +mutex_lock (&chip->lock); + ret =lp55xx_write (chip,LP5523_REG_LED_PWM_BASE + chan_num, + led->brightness); +mutex_unlock (&chip->lock); +return ret; +} +static int lp5523_led_brightness (struct lp55xx_led *led) {struct lp55xx_chip *chip = led->chip;
@@ -857,6 +869,7 @@ static struct lp55xx_device_config lp5523_cfg = { .max_channel = LP5523_MAX_LEDS, .post_init_device = lp5523_post_init_device, .brightness_fn = lp5523_led_brightness, + .color_intensity_fn = lp5523_led_intensity, .set_led_current = lp5523_set_led_current, .firmware_cb = lp5523_firmware_loaded, .run_engine = lp5523_run_engine,
drivers/leds/leds-lp55xx-common.c +109 -22
188 lines not on this page · raw message
drivers/leds/leds-lp55xx-common.h +9 -0
@@ -12,6 +12,8 @@#ifndef _LEDS_LP55XX_COMMON_H#define _LEDS_LP55XX_COMMON_H +#include <linux/led-class-multicolor.h> +enum lp55xx_engine_index {LP55XX_ENGINE_INVALID , LP55XX_ENGINE_1,
@@ -109,6 +111,9 @@ struct lp55xx_device_config {/* access brightness register */ int (*brightness_fn)(struct lp55xx_led *led); +/* access specific brightness register */ +int (*color_intensity_fn)(struct lp55xx_led *led,int chan_num); +/* current setting function */ void (*set_led_current) (struct lp55xx_led *led,u8 led_current);
@@ -159,6 +164,7 @@ struct lp55xx_chip {* struct lp55xx_led * @chan_nr : Channel number * @cdev : LED class device +* @mc_cdev : Multi color class device * @led_current : Current setting at each led channel * @max_current : Maximun current at each led channel * @brightness : Brightness value
@@ -167,9 +173,12 @@ struct lp55xx_chip {struct lp55xx_led {int chan_nr;struct led_classdev cdev; +struct led_classdev_mc mc_cdev;u8 led_current;u8 max_current;u8 brightness; +int channel_color[LED_COLOR_ID_MAX ]; +int grouped_channels[LED_COLOR_ID_MAX ];struct lp55xx_chip *chip; };
include/linux/platform_data/leds-lp55xx.h +6 -0
@@ -12,6 +12,8 @@#ifndef _LEDS_LP55XX_H#define _LEDS_LP55XX_H +#include <linux/led-class-multicolor.h> +/* Clock configuration */ #define LP55XX_CLOCK_AUTO 0#define LP55XX_CLOCK_INT 1
@@ -23,6 +25,10 @@ struct lp55xx_led_config {u8 chan_nr;u8 led_current;/* mA x10, 0 if led is not connected */ u8 max_current; +int num_colors; +unsigned long available_colors; +u32 channel_color[LED_COLOR_ID_MAX ]; +int grouped_channels[LED_COLOR_ID_MAX ]; };struct lp55xx_predef_pattern {
Signature · 1 line
2.22.0.214.g8dca754b1e
lkp
build botRe: [PATCH v7 9/9] leds: Update the lp55xx to use the multi color framework
I love your patch! Yet something to improve:
Hi Dan,
I love your patch! Yet something to improve:
[auto build test ERROR on linus/master]
[cannot apply to v5.3 next-20190919]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Dan-Murphy/Multicolor-Framework-updates/20190920-023813
config: i386-randconfig-b002-201937 (attached as .config)
compiler: gcc-7 (Debian 7.4.0-13) 7.4.0 reproduce:
# save the attached .config to linux build tree
make ARCH=i386
:::::: branch date: 3 hours ago
:::::: commit date: 3 hours agoIf you fix the issue, kindly add following tag
All errors (new ones prefixed by >>):
>> ERROR: "led_classdev_multicolor_register_ext" [drivers/leds/leds-lp55xx-common.ko] undefined! >> ERROR: "led_mc_calc_brightness" [drivers/leds/leds-lp55xx-common.ko] undefined!
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
kbuild test robot
build botRe: [PATCH v7 9/9] leds: Update the lp55xx to use the multi color framework
In reply to Dan MurphyI love your patch! Yet something to improve:
Hi Dan,
I love your patch! Yet something to improve:
[auto build test ERROR on linus/master]
[cannot apply to v5.3 next-20190919]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system. BTW, we also suggest to use '--base' option to specify the base tree in git format-patch, please see https://stackoverflow.com/a/37406982]
url: https://github.com/0day-ci/linux/commits/Dan-Murphy/Multicolor-Framework-updates/20190920-023813
config: i386-randconfig-b003-201937 (attached as .config)
compiler: gcc-7 (Debian 7.4.0-13) 7.4.0 reproduce:
# save the attached .config to linux build tree
make ARCH=i386
:::::: branch date: 4 hours ago
:::::: commit date: 4 hours agoIf you fix the issue, kindly add following tag
All errors (new ones prefixed by >>):
ld: drivers/leds/leds-lp55xx-common.o: in function `lp55xx_set_brightness':
>> drivers/leds/leds-lp55xx-common.c:144: undefined reference to `led_mc_calc_brightness' ld: drivers/leds/leds-lp55xx-common.o: in function `lp55xx_init_led': >> drivers/leds/leds-lp55xx-common.c:216: undefined reference to `led_classdev_multicolor_register_ext'
# https://github.com/0day-ci/linux/commit/d907bc23f70b4ca46747f42ec24a2066fa4602b0
git remote add linux-review https://github.com/0day-ci/linux
git remote update linux-review
git checkout d907bc23f70b4ca46747f42ec24a2066fa4602b0
vim +144 drivers/leds/leds-lp55xx-common.c
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 133)
95b2af637e283e Andrew Lunn 2015-08-20 134 static int lp55xx_set_brightness(struct led_classdev *cdev,
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 135) enum led_brightness brightness)
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 136) {
a6e4679a09a0a2 Milo(Woogyom Kim 2013-02-05 137) struct lp55xx_led *led = cdev_to_lp55xx_led(cdev);
95b2af637e283e Andrew Lunn 2015-08-20 138 struct lp55xx_device_config *cfg = led->chip->cfg;
d907bc23f70b4c Dan Murphy 2019-09-19 139 int adj_value[LED_COLOR_ID_MAX];
d907bc23f70b4c Dan Murphy 2019-09-19 140 int ret;
d907bc23f70b4c Dan Murphy 2019-09-19 141 int i;
a6e4679a09a0a2 Milo(Woogyom Kim 2013-02-05 142)
d907bc23f70b4c Dan Murphy 2019-09-19 143 if (led->mc_cdev.num_leds > 1) {
d907bc23f70b4c Dan Murphy 2019-09-19 @144 led_mc_calc_brightness(&led->mc_cdev,
d907bc23f70b4c Dan Murphy 2019-09-19 145 brightness, adj_value);
d907bc23f70b4c Dan Murphy 2019-09-19 146 for (i = 0; i < led->mc_cdev.num_leds; i++) {
d907bc23f70b4c Dan Murphy 2019-09-19 147 led->brightness = adj_value[i];
d907bc23f70b4c Dan Murphy 2019-09-19 148 ret = cfg->color_intensity_fn(led,
d907bc23f70b4c Dan Murphy 2019-09-19 149 led->grouped_channels[i]);
d907bc23f70b4c Dan Murphy 2019-09-19 150 if (ret)
d907bc23f70b4c Dan Murphy 2019-09-19 151 break;
d907bc23f70b4c Dan Murphy 2019-09-19 152 }
d907bc23f70b4c Dan Murphy 2019-09-19 153 } else {
a6e4679a09a0a2 Milo(Woogyom Kim 2013-02-05 154) led->brightness = (u8)brightness;
d907bc23f70b4c Dan Murphy 2019-09-19 155 ret = cfg->brightness_fn(led);
d907bc23f70b4c Dan Murphy 2019-09-19 156 }
d907bc23f70b4c Dan Murphy 2019-09-19 157
d907bc23f70b4c Dan Murphy 2019-09-19 158 return ret;
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 159) }
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 160)
9e9b3db1b2f725 Milo(Woogyom Kim 2013-02-05 161) static int lp55xx_init_led(struct lp55xx_led *led,
9e9b3db1b2f725 Milo(Woogyom Kim 2013-02-05 162) struct lp55xx_chip *chip, int chan)
9e9b3db1b2f725 Milo(Woogyom Kim 2013-02-05 163) {
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 164) struct lp55xx_platform_data *pdata = chip->pdata;
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 165) struct lp55xx_device_config *cfg = chip->cfg;
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 166) struct device *dev = &chip->cl->dev;
d907bc23f70b4c Dan Murphy 2019-09-19 167 int max_channel = cfg->max_channel;
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 168) char name[32];
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 169) int ret;
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 170)
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 171) if (chan >= max_channel) {
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 172) dev_err(dev, "invalid channel: %d / %d\n", chan, max_channel);
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 173) return -EINVAL;
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 174) }
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 175)
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 176) if (pdata->led_config[chan].led_current == 0)
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 177) return 0;
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 178)
d907bc23f70b4c Dan Murphy 2019-09-19 179 if (pdata->led_config[chan].name) {
d907bc23f70b4c Dan Murphy 2019-09-19 180 led->cdev.name = pdata->led_config[chan].name;
d907bc23f70b4c Dan Murphy 2019-09-19 181 } else {
d907bc23f70b4c Dan Murphy 2019-09-19 182 snprintf(name, sizeof(name), "%s:channel%d",
d907bc23f70b4c Dan Murphy 2019-09-19 183 pdata->label ? : chip->cl->name, chan);
d907bc23f70b4c Dan Murphy 2019-09-19 184 led->cdev.name = name;
d907bc23f70b4c Dan Murphy 2019-09-19 185 }
d907bc23f70b4c Dan Murphy 2019-09-19 186
d907bc23f70b4c Dan Murphy 2019-09-19 187 if (pdata->led_config[chan].num_colors > 1) {
d907bc23f70b4c Dan Murphy 2019-09-19 188 led->mc_cdev.led_cdev = &led->cdev;
d907bc23f70b4c Dan Murphy 2019-09-19 189 led->cdev.brightness_set_blocking = lp55xx_set_brightness;
d907bc23f70b4c Dan Murphy 2019-09-19 190 led->cdev.groups = lp55xx_led_groups;
d907bc23f70b4c Dan Murphy 2019-09-19 191 led->mc_cdev.num_leds = pdata->led_config[chan].num_colors;
d907bc23f70b4c Dan Murphy 2019-09-19 192 led->mc_cdev.available_colors = pdata->led_config[chan].available_colors;
d907bc23f70b4c Dan Murphy 2019-09-19 193 memcpy(led->channel_color,
d907bc23f70b4c Dan Murphy 2019-09-19 194 pdata->led_config[chan].channel_color,
d907bc23f70b4c Dan Murphy 2019-09-19 195 sizeof(led->channel_color));
d907bc23f70b4c Dan Murphy 2019-09-19 196 memcpy(led->grouped_channels,
d907bc23f70b4c Dan Murphy 2019-09-19 197 pdata->led_config[chan].grouped_channels,
d907bc23f70b4c Dan Murphy 2019-09-19 198 sizeof(led->grouped_channels));
d907bc23f70b4c Dan Murphy 2019-09-19 199 } else {
d907bc23f70b4c Dan Murphy 2019-09-19 200
d907bc23f70b4c Dan Murphy 2019-09-19 201 led->cdev.default_trigger = pdata->led_config[chan].default_trigger;
d907bc23f70b4c Dan Murphy 2019-09-19 202 led->cdev.brightness_set_blocking = lp55xx_set_brightness;
d907bc23f70b4c Dan Murphy 2019-09-19 203 } led->cdev.groups = lp55xx_led_groups;
d907bc23f70b4c Dan Murphy 2019-09-19 204
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 205) led->led_current = pdata->led_config[chan].led_current;
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 206) led->max_current = pdata->led_config[chan].max_current;
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 207) led->chan_nr = pdata->led_config[chan].chan_nr;
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 208)
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 209) if (led->chan_nr >= max_channel) {
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 210) dev_err(dev, "Use channel numbers between 0 and %d\n",
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 211) max_channel - 1);
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 212) return -EINVAL;
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 213) }
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 214)
d907bc23f70b4c Dan Murphy 2019-09-19 215 if (pdata->led_config[chan].num_colors > 1)
d907bc23f70b4c Dan Murphy 2019-09-19 @216 ret = led_classdev_multicolor_register(dev, &led->mc_cdev);
d907bc23f70b4c Dan Murphy 2019-09-19 217 else
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 218) ret = led_classdev_register(dev, &led->cdev);
d907bc23f70b4c Dan Murphy 2019-09-19 219
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 220) if (ret) {
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 221) dev_err(dev, "led register err: %d\n", ret);
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 222) return ret;
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 223) }
0e2023463a3c94 Milo(Woogyom Kim 2013-02-05 224)
9e9b3db1b2f725 Milo(Woogyom Kim 2013-02-05 225) return 0;
9e9b3db1b2f725 Milo(Woogyom Kim 2013-02-05 226) }
9e9b3db1b2f725 Milo(Woogyom Kim 2013-02-05 227) ---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation