leds: Add a driver for the BD2606MVV
Subsystems (2)
v2 cover leds: Add a driver for the BD2606MVV
Add the binding description and the corresponding driver for the BD2606.
Changes in V2:
- Add Datasheet link
- use fwnode api
- remove childnode count check, that will bail out anyways later.
- add enable-gpios to binding but not to driver due to lack of testing ability
Andreas Kemnade (2):
dt-bindings: leds: ROHM BD2606MVV LED driver
leds: bd2606mvv: Driver for the Rohm 6 Channel i2c LED driver
.../bindings/leds/rohm,bd2606mvv.yaml | 83 ++++++++++ drivers/leds/Kconfig | 11 ++ drivers/leds/Makefile | 1 + drivers/leds/leds-bd2606mvv.c | 143 ++++++++++++++++++ 4 files changed, 238 insertions(+) create mode 100644 Documentation/devicetree/bindings/leds/rohm,bd2606mvv.yaml create mode 100644 drivers/leds/leds-bd2606mvv.c
Signature · 1 line
2.39.2
PATCH v2 1/2 dt-bindings: leds: ROHM BD2606MVV LED driver
Document ROHM BD2606MVV LED driver devicetree bindings.
--- .../bindings/leds/rohm,bd2606mvv.yaml | 83 +++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 Documentation/devicetree/bindings/leds/rohm,bd2606mvv.yaml
Documentation/devicetree/bindings/leds/rohm,bd2606mvv.yaml new file +83 -0
@@ -0,0 +1,83 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/leds/rohm,bd2606mvv.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: BD2606MVV LED controller + +maintainers: + - Andreas Kemnade <[email protected]> + +description: + The BD2606 MVV is a programmable LED controller connected via I2C that can + drive 6 separate lines. Each of them can be individually switched on and off + but the brightness setting is shared between two of them. + + Datasheet is available at + https://fscdn.rohm.com/en/products/databook/datasheet/ic/power/led_driver/bd2606mvv_1-e.pdf + +properties: + compatible: + const: rohm,bd2606mvv + + reg: + description: I2C slave address of the controller. + maxItems: 1 + + "#address-cells": + const: 1 + + "#size-cells": + const: 0 + + enable-gpios: + maxItems: 1 + description: GPIO pin to enable/disable the device. + +patternProperties: + "^led@[0-6]$": + type: object + $ref: common.yaml# + unevaluatedProperties: false + + properties: + reg: + minimum: 0 + maximum: 6 + + required: + - reg + +additionalProperties: false + +examples: + - | + + #include <dt-bindings/leds/common.h> + + i2c0 { + #address-cells = <1>; + #size-cells = <0>; + + led-controller@66 { + compatible = "rohm,bd2606mvv"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x66>; + + led@0 { + color = <LED_COLOR_ID_RED>; + function = LED_FUNCTION_POWER; + reg = <0x0>; + }; + + led@2 { + color = <LED_COLOR_ID_WHITE>; + function = LED_FUNCTION_STATUS; + reg = <0x2>; + }; + }; + }; + +...
Signature · 1 line
2.39.2
Re: [PATCH v2 1/2] dt-bindings: leds: ROHM BD2606MVV LED driver
Quoted 3 lines · Andreas Kemnade
Document ROHM BD2606MVV LED driver devicetree bindings.
Signed-off-by Andreas Kemnade <[email protected]>
FWIW:
Yours,
-- Matti
Signature · 5 lines
Matti Vaittinen Linux kernel developer at ROHM Semiconductors Oulu Finland ~~ When things go utterly wrong vim users can always type :help! ~~
Re: [PATCH v2 1/2] dt-bindings: leds: ROHM BD2606MVV LED driver
In reply to Andreas KemnadeQuoted 1 line · Andreas Kemnade
Document ROHM BD2606MVV LED driver devicetree bindings.
Subject: maybe drop "driver" (suggests it is for Linux drivers, although maybe it matches the actual hardware here?) and add missing verb, e.g. "Add ROHM ..."
Quoted 13 lines
Signed-off-by Andreas Kemnade <[email protected]>--- .../bindings/leds/rohm,bd2606mvv.yaml | 83 +++++++++++++++++++ 1 file changed, 83 insertions(+) create mode 100644 Documentation/devicetree/bindings/leds/rohm,bd2606mvv.yamlDocumentation/devicetree/bindings/leds/rohm,bd2606mvv.yaml new file +0
-0
Documentation/devicetree/bindings/leds/rohm,bd2606mvv.yaml line 7
Quoted 7 lines
Documentation/devicetree/bindings/leds/rohm,bd2606mvv.yaml new file +7
-0@@ -0,0 +1,83 @@ +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/leds/rohm,bd2606mvv.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: BD2606MVV LED controller
ROHM BD....
Quoted 8 lines
Documentation/devicetree/bindings/leds/rohm,bd2606mvv.yaml new file +8
-0+ +maintainers: + - Andreas Kemnade <[email protected]> + +description: + The BD2606 MVV is a programmable LED controller connected via I2C that can + drive 6 separate lines. Each of them can be individually switched on and off + but the brightness setting is shared between two of them.
Documentation/devicetree/bindings/leds/rohm,bd2606mvv.yaml line 25
Quoted 10 lines
Documentation/devicetree/bindings/leds/rohm,bd2606mvv.yaml new file +10
-0+ + Datasheet is available at + https://fscdn.rohm.com/en/products/databook/datasheet/ic/power/led_driver/bd2606mvv_1-e.pdf + +properties: + compatible: + const: rohm,bd2606mvv + + reg: + description: I2C slave address of the controller.
Drop description, it's obvious.
Quoted 21 lines
Documentation/devicetree/bindings/leds/rohm,bd2606mvv.yaml new file +21
-0+ maxItems: 1 + + "#address-cells": + const: 1 + + "#size-cells": + const: 0 + + enable-gpios: + maxItems: 1 + description: GPIO pin to enable/disable the device. + +patternProperties: + "^led@[0-6]$": + type: object + $ref: common.yaml# + unevaluatedProperties: false + + properties: + reg: + minimum: 0
Documentation/devicetree/bindings/leds/rohm,bd2606mvv.yaml line 56
Quoted 10 lines
Documentation/devicetree/bindings/leds/rohm,bd2606mvv.yaml new file +10
-0+ maximum: 6 + + required: + - reg + +additionalProperties: false + +examples: + - | +
Drop blank line
Documentation/devicetree/bindings/leds/rohm,bd2606mvv.yaml line 59
Quoted 3 lines
Documentation/devicetree/bindings/leds/rohm,bd2606mvv.yaml new file +3
-0+ #include <dt-bindings/leds/common.h> + + i2c0 {
i2c {
Documentation/devicetree/bindings/leds/rohm,bd2606mvv.yaml line 67
Quoted 8 lines
Documentation/devicetree/bindings/leds/rohm,bd2606mvv.yaml new file +8
-0+ #address-cells = <1>; + #size-cells = <0>; + + led-controller@66 { + compatible = "rohm,bd2606mvv"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x66>;
reg is always second property in DTS.
Documentation/devicetree/bindings/leds/rohm,bd2606mvv.yaml line 72
Quoted 5 lines
Documentation/devicetree/bindings/leds/rohm,bd2606mvv.yaml new file +5
-0+ + led@0 { + color = <LED_COLOR_ID_RED>; + function = LED_FUNCTION_POWER; + reg = <0x0>;
Ditto
Best regards,
Krzysztof
Re: [PATCH v2 1/2] dt-bindings: leds: ROHM BD2606MVV LED driver
On Mon, 10 Apr 2023 17:34:00 +0200
Krzysztof Kozlowski <[email protected]> wrote:
[...]
Quoted 8 lines
Documentation/devicetree/bindings/leds/rohm,bd2606mvv.yaml line 67
Quoted 5 lines
Documentation/devicetree/bindings/leds/rohm,bd2606mvv.yaml new file +5
-0+ led-controller@66 { + compatible = "rohm,bd2606mvv"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x66>;reg is always second property in DTS.
Quoted 8 lines
Documentation/devicetree/bindings/leds/rohm,bd2606mvv.yaml line 72
Quoted 5 lines
Documentation/devicetree/bindings/leds/rohm,bd2606mvv.yaml new file +5
-0+ + led@0 { + color = <LED_COLOR_ID_RED>; + function = LED_FUNCTION_POWER; + reg = <0x0>;Ditto
hmm, reg also second if no compatible first? I see it usually first in such cases.
Regards,
Andreas
Re: [PATCH v2 1/2] dt-bindings: leds: ROHM BD2606MVV LED driver
Quoted 18 lines · Andreas Kemnade
On Mon, 10 Apr 2023 17:34:00 +0200
Krzysztof Kozlowski <[email protected]> wrote:[...]
Quoted 14 lines
Documentation/devicetree/bindings/leds/rohm,bd2606mvv.yaml line 67
Quoted 5 lines
Documentation/devicetree/bindings/leds/rohm,bd2606mvv.yaml new file +5
-0+ led-controller@66 { + compatible = "rohm,bd2606mvv"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x66>;reg is always second property in DTS.
Quoted 5 lines
Documentation/devicetree/bindings/leds/rohm,bd2606mvv.yaml new file +5
-0+ + led@0 { + color = <LED_COLOR_ID_RED>; + function = LED_FUNCTION_POWER; + reg = <0x0>;
Quoted 4 lines
Quoted 2 lines
Ditto
hmm, reg also second if no compatible first? I see it usually first in such cases.
Right, then reg is first.
Best regards,
Krzysztof
PATCH v2 2/2 leds: bd2606mvv: Driver for the Rohm 6 Channel i2c LED driver
In reply to Andreas KemnadeThe device provides 6 channels which can be individually turned off and on but groups of two channels share a common brightness register.
Limitation: The GPIO to enable the device is not used yet.
--- drivers/leds/Kconfig | 11 +++ drivers/leds/Makefile | 1 + drivers/leds/leds-bd2606mvv.c | 143 ++++++++++++++++++++++++++++++++++ 3 files changed, 155 insertions(+) create mode 100644 drivers/leds/leds-bd2606mvv.c
drivers/leds/Kconfig +11 -0
@@ -551,6 +551,17 @@ config LEDS_REGULATOR help This option enables support for regulator driven LEDs. +config LEDS_BD2606MVV + tristate "LED driver for BD2606MVV" + depends on LEDS_CLASS + depends on I2C + select REGMAP_I2C + help + This option enables support for BD2606MVV LED driver chips + accessed via the I2C bus. It supports setting brightness, with + the limitiation that there are groups of two channels sharing + a brightness setting, but not the on/off setting. + config LEDS_BD2802 tristate "LED driver for BD2802 RGB LED" depends on LEDS_CLASS
drivers/leds/Makefile +1 -0
@@ -17,6 +17,7 @@ obj-$(CONFIG_LEDS_ARIEL) += leds-ariel.o obj-$(CONFIG_LEDS_AW2013) += leds-aw2013.o obj-$(CONFIG_LEDS_BCM6328) += leds-bcm6328.o obj-$(CONFIG_LEDS_BCM6358) += leds-bcm6358.o +obj-$(CONFIG_LEDS_BD2606MVV) += leds-bd2606mvv.o obj-$(CONFIG_LEDS_BD2802) += leds-bd2802.o obj-$(CONFIG_LEDS_BLINKM) += leds-blinkm.o obj-$(CONFIG_LEDS_CLEVO_MAIL) += leds-clevo-mail.o
drivers/leds/leds-bd2606mvv.c new file +143 -0
143 lines not on this page · raw message
Signature · 1 line
2.39.2
Re: [PATCH v2 2/2] leds: bd2606mvv: Driver for the Rohm 6 Channel i2c LED driver
Quoted 67 lines · Andreas Kemnade
The device provides 6 channels which can be individually turned off and on but groups of two channels share a common brightness register.
Limitation: The GPIO to enable the device is not used yet.
Signed-off-by Andreas Kemnade <[email protected]>--- drivers/leds/Kconfig | 11 +++ drivers/leds/Makefile | 1 + drivers/leds/leds-bd2606mvv.c | 143 ++++++++++++++++++++++++++++++++++ 3 files changed, 155 insertions(+)create mode 100644
drivers/leds/leds-bd2606mvv.cdrivers/leds/Kconfig +11
-0@@ -551,6 +551,17 @@ config LEDS_REGULATOR help This option enables support for regulator driven LEDs. +config LEDS_BD2606MVV + tristate "LED driver for BD2606MVV" + depends on LEDS_CLASS + depends on I2C + select REGMAP_I2C + help + This option enables support for BD2606MVV LED driver chips + accessed via the I2C bus. It supports setting brightness, with + the limitiation that there are groups of two channels sharing + a brightness setting, but not the on/off setting. + config LEDS_BD2802 tristate "LED driver for BD2802 RGB LED" depends on LEDS_CLASSdrivers/leds/Makefile +1
-0@@ -17,6 +17,7 @@ obj-$(CONFIG_LEDS_ARIEL) += leds-ariel.o obj-$(CONFIG_LEDS_AW2013) += leds-aw2013.o obj-$(CONFIG_LEDS_BCM6328) += leds-bcm6328.o obj-$(CONFIG_LEDS_BCM6358) += leds-bcm6358.o +obj-$(CONFIG_LEDS_BD2606MVV) += leds-bd2606mvv.o obj-$(CONFIG_LEDS_BD2802) += leds-bd2802.o obj-$(CONFIG_LEDS_BLINKM) += leds-blinkm.o obj-$(CONFIG_LEDS_CLEVO_MAIL) += leds-clevo-mail.odrivers/leds/leds-bd2606mvv.c new file +13
-0@@ -0,0 +1,143 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* +* Copyright (C) 2023 Andreas Kemnade +* +* Datasheet: +* https://fscdn.rohm.com/en/products/databook/datasheet/ic/power/led_driver/bd2606mvv_1-e.pdf +*/ + +#include <linux/i2c.h> +#include <linux/leds.h> +#include <linux/module.h> +#include <linux/mod_devicetable.h> +#include <linux/property.h>
drivers/leds/leds-bd2606mvv.c line 23
Quoted 10 lines
drivers/leds/leds-bd2606mvv.c new file +10
-0+#include <linux/regmap.h> +#include <linux/slab.h> + +#define BD2606_MAX_LEDS 6 +#define BD2606_MAX_BRIGHTNESS 63 +#define BD2606_REG_PWRCNT 3 +#define ldev_to_led (c) container_of(c, struct bd2606mvv_led, ldev) + +struct bd2606mvv_led { +bool active;
I still think having this 'active' here for the whole lifetime of the driver is a bit misleading. This, however, is a minor thing. With or without the 'active' removed from the private data:
Yours,
-- Matti
Signature · 5 lines
Matti Vaittinen Linux kernel developer at ROHM Semiconductors Oulu Finland ~~ When things go utterly wrong vim users can always type :help! ~~