* [PATCH 1/2] dt-bindings: leds: Document rohm,bd65b60 bindings
@ 2023-03-08 20:14 Bogdan Ionescu
2023-03-08 20:14 ` [PATCH 2/2] leds: Add support for rohm,bd65b60 led driver Bogdan Ionescu
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Bogdan Ionescu @ 2023-03-08 20:14 UTC (permalink / raw)
To: Pavel Machek, Lee Jones, Rob Herring
Cc: Krzysztof Kozlowski, linux-leds, devicetree, linux-kernel,
Bogdan Ionescu
Hi all,
This is my first patch to the kernel, so I expect to have made
some mistakes. I did my best to follow the documentation and
submitting patches guidelines, but if I missed something, please
let me know.
I wasn't sure if I had to add myself to the MAINTAINERS file for such a
small patch, so I didn't.
Patch begins here:
Added devicetree bindings documentation for the rohm,bd65b60
led driver.
Signed-off-by: Bogdan Ionescu <bogdan.ionescu.work@gmail.com>
---
.../bindings/leds/rohm,bd65b60-leds.yaml | 77 +++++++++++++++++++
include/dt-bindings/leds/leds-bd65b60.h | 20 +++++
2 files changed, 97 insertions(+)
create mode 100644 Documentation/devicetree/bindings/leds/rohm,bd65b60-leds.yaml
create mode 100644 include/dt-bindings/leds/leds-bd65b60.h
diff --git a/Documentation/devicetree/bindings/leds/rohm,bd65b60-leds.yaml b/Documentation/devicetree/bindings/leds/rohm,bd65b60-leds.yaml
new file mode 100644
index 000000000000..f69d7acd39c8
--- /dev/null
+++ b/Documentation/devicetree/bindings/leds/rohm,bd65b60-leds.yaml
@@ -0,0 +1,77 @@
+# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/leds/rohm,bd65b60-leds.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: ROHM BD65B60 device tree bindings
+
+maintainers:
+ - Bogdan Ionescu <bogdan.ionescu.work+kernel@gmail.com>
+
+description: |
+ BD65B60 is a white LED driver IC that integrates PWM
+ step-up DC/DC converter with boost-capability of up to
+ maximum 28.5V and current driver with drive capability of up
+ to 25mA(Typ.) maximum setting. Precise brightness can be
+ controlled at wide ranges through the external PWM pulse
+ input.
+
+properties:
+ compatible:
+ const: rohm,bd65b60
+
+ reg:
+ maxItems: 1
+
+ led:
+ type: object
+ $ref: common.yaml#
+ unevaluatedProperties: false
+
+ properties:
+ rohm,enable-outputs:
+ description:
+ Select which leds are being controlled.
+ Values defined in <dt-bindings/leds/leds-bd65b60.h>
+ $ref: "/schemas/types.yaml#/definitions/uint32"
+ enum: [ 0, 1, 4, 5 ]
+
+ rohm,ovp:
+ description:
+ Select Over-Voltage-Portection level.
+ Values defined in <dt-bindings/leds/leds-bd65b60.h>
+ $ref: "/schemas/types.yaml#/definitions/uint32"
+ enum: [ 0, 8, 16 ]
+ default: 16
+
+ required:
+ - rohm,enable-outputs
+
+required:
+ - compatible
+ - reg
+additionalProperties: false
+
+examples:
+ - |
+ #include <dt-bindings/leds/common.h>
+ #include <dt-bindings/leds/leds-bd65b60.h>
+
+ i2c {
+
+ led_controler@64 {
+ compatible = "rohm,bd65b60";
+ reg = <0x64>;
+
+ backlight_led: led {
+ function = LED_FUNCTION_BACKLIGHT;
+ color = <LED_COLOR_ID_WHITE>;
+ rohm,enable-outputs = <BD65B60_ENABLE_LED1>;
+ default-state = "keep";
+ linux,default-trigger = "backlight";
+ };
+ };
+ };
+
+...
diff --git a/include/dt-bindings/leds/leds-bd65b60.h b/include/dt-bindings/leds/leds-bd65b60.h
new file mode 100644
index 000000000000..8634faae58f4
--- /dev/null
+++ b/include/dt-bindings/leds/leds-bd65b60.h
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
+/*
+ * This header provides macros for the ROHM BD65B60 device tree bindings.
+ *
+ * Copyright (C) 2023 Bogdan Ionescu <bogdan.ionescu.work+kernel@gmail.com>
+ */
+
+#ifndef _DT_BINDINGS_LEDS_BD65B60_H
+#define _DT_BINDINGS_LEDS_BD65B60_H
+
+#define BD65B60_ENABLE_NONE 0
+#define BD65B60_ENABLE_LED1 1
+#define BD65B60_ENABLE_LED2 4
+#define BD65B60_ENABLE_BOTH (BD65B60_ENABLE_LED1 | BD65B60_ENABLE_LED2)
+
+#define BD65B60_OVP_25V 0
+#define BD65B60_OVP_30V 0x08
+#define BD65B60_OVP_35V 0x10
+
+#endif /* _DT_BINDINGS_LEDS_BD65B60_H */
--
2.39.2
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH 2/2] leds: Add support for rohm,bd65b60 led driver 2023-03-08 20:14 [PATCH 1/2] dt-bindings: leds: Document rohm,bd65b60 bindings Bogdan Ionescu @ 2023-03-08 20:14 ` Bogdan Ionescu 2023-03-09 9:06 ` Krzysztof Kozlowski 2023-03-18 4:54 ` kernel test robot 2023-03-08 23:16 ` [PATCH 1/2] dt-bindings: leds: Document rohm,bd65b60 bindings Rob Herring 2023-03-09 9:03 ` Krzysztof Kozlowski 2 siblings, 2 replies; 9+ messages in thread From: Bogdan Ionescu @ 2023-03-08 20:14 UTC (permalink / raw) To: Pavel Machek, Lee Jones, Rob Herring Cc: Krzysztof Kozlowski, linux-leds, devicetree, linux-kernel, Bogdan Ionescu This commit adds support for ROHM BD65B60 led driver. The chip supports 2 outpus sharing the same current setting and is controlled over I2C. Signed-off-by: Bogdan Ionescu <bogdan.ionescu.work@gmail.com> --- drivers/leds/Kconfig | 11 ++ drivers/leds/Makefile | 1 + drivers/leds/leds-bd65b60.c | 287 ++++++++++++++++++++++++++++++++++++ 3 files changed, 299 insertions(+) create mode 100644 drivers/leds/leds-bd65b60.c diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig index aaa9140bc351..8c5090ac5cba 100644 --- a/drivers/leds/Kconfig +++ b/drivers/leds/Kconfig @@ -717,6 +717,17 @@ config LEDS_BLINKM This option enables support for the BlinkM RGB LED connected through I2C. Say Y to enable support for the BlinkM LED. +config LEDS_BD65B60 + tristate "LED Driver for BD65B60" + depends on LEDS_CLASS + depends on I2C + help + If you have a LCD backlight connected to the ROHM BD65B60, + say Y here to enable this driver. + + To compile this driver as a module, choose M here: the module will + be called leds-bd65b60. + config LEDS_POWERNV tristate "LED support for PowerNV Platform" depends on LEDS_CLASS diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile index d30395d11fd8..9f85642a2c79 100644 --- a/drivers/leds/Makefile +++ b/drivers/leds/Makefile @@ -18,6 +18,7 @@ obj-$(CONFIG_LEDS_AW2013) += leds-aw2013.o obj-$(CONFIG_LEDS_BCM6328) += leds-bcm6328.o obj-$(CONFIG_LEDS_BCM6358) += leds-bcm6358.o obj-$(CONFIG_LEDS_BD2802) += leds-bd2802.o +obj-$(CONFIG_LEDS_BD65B60) += leds-bd65b60.o obj-$(CONFIG_LEDS_BLINKM) += leds-blinkm.o obj-$(CONFIG_LEDS_CLEVO_MAIL) += leds-clevo-mail.o obj-$(CONFIG_LEDS_COBALT_QUBE) += leds-cobalt-qube.o diff --git a/drivers/leds/leds-bd65b60.c b/drivers/leds/leds-bd65b60.c new file mode 100644 index 000000000000..9843e20369d3 --- /dev/null +++ b/drivers/leds/leds-bd65b60.c @@ -0,0 +1,287 @@ +// SPDX-License-Identifier: GPL-2.0-or-later +/* + * Simple driver for ROHM Semiconductor BD65B60GWL Backlight driver chip + * + * Copyright (C) 2014 ROHM Semiconductor.com + * Copyright (C) 2014 MMI + * Copyright (C) 2023 Bogdan Ionescu <bogdan.ionescu.work+kernel@gmail.com> + */ + +#include <linux/i2c.h> +#include <linux/leds.h> +#include <linux/module.h> +#include <linux/mutex.h> +#include <linux/regmap.h> +#include <linux/slab.h> + +#define BD65B60_MAX_BRIGHTNESS 255 +#define BD65B60_DEFAULT_BRIGHTNESS 255 +#define BD65B60_DEFAULT_TRIGGER "bkl-trigger" +#define BD65B60_DEFAULT_NAME "white" +#define BD65B60_DEFAULT_OVP_VAL BD65B60_35V_OVP + +#define INT_DEBOUNCE_MSEC 10 + +#define PWMEN_MASK 0x20 +#define OVP_MASK 0x18 +#define LEDSEL_MASK 0x05 + +enum bd65b60_regs { + REG_SFTRST = 0x00, + REG_COMSET1 = 0x01, + REG_COMSET2 = 0x02, + REG_LEDSEL = 0x03, + REG_ILED = 0x05, + REG_CTRLSET = 0x07, + REG_SLEWSET = 0x08, + REG_PON = 0x0E, + REG_MAX = REG_PON, +}; + +enum bd65b60_ovp { + BD65B60_25V_OVP = 0x00, + BD65B60_30V_OVP = 0x08, + BD65B60_35V_OVP = 0x10, +}; + +enum bd65b60_ledsel { + BD65B60_DISABLE = 0x00, + BD65B60_LED1SEL = 0x01, + BD65B60_LED2SEL = 0x04, + BD65B60_LED12SEL = 0x05, +}; + +enum bd65b60_pwm_ctrl { + BD65B60_PWM_DISABLE = 0x00, + BD65B60_PWM_ENABLE = 0x20, +}; + +enum bd65b60_state { + BD65B60_OFF = 0, + BD65B60_ON = 1, + BD65B60_KEEP = 2, +}; + +struct bd65b60_led { + struct led_classdev cdev; + struct i2c_client *client; + struct regmap *regmap; + struct mutex lock; /* Held when writing to registers */ + enum bd65b60_ledsel enable; + enum bd65b60_state state; + enum bd65b60_ovp ovp; +}; + +static const struct regmap_config bd65b60_regmap_config = { + .reg_bits = 8, + .val_bits = 8, + .max_register = REG_MAX, +}; + +static void bd65b60_brightness_set(struct led_classdev *cdev, + enum led_brightness brightness) +{ + int ret; + enum bd65b60_state new_state; + struct bd65b60_led *led = container_of(cdev, struct bd65b60_led, cdev); + + mutex_lock(&led->lock); + + ret = regmap_write(led->regmap, REG_ILED, brightness); + + new_state = (brightness) ? BD65B60_ON : BD65B60_OFF; + + if (new_state != led->state) { + ret |= regmap_write(led->regmap, REG_PON, new_state); + led->state = new_state; + } + + mutex_unlock(&led->lock); + + if (ret) + dev_err(&led->client->dev, "Failed to set brightness: %d", ret); +} + +static int bd65b60_init(struct bd65b60_led *led) +{ + int ret; + + mutex_lock(&led->lock); + + if (led->state != BD65B60_KEEP) { + /* Reset the chip */ + ret = regmap_write(led->regmap, REG_SFTRST, 0x01); + } + + ret |= regmap_update_bits(led->regmap, REG_COMSET1, OVP_MASK, led->ovp); + ret |= regmap_update_bits(led->regmap, REG_LEDSEL, LEDSEL_MASK, + led->enable); + ret |= regmap_update_bits(led->regmap, REG_CTRLSET, PWMEN_MASK, + BD65B60_PWM_ENABLE); + ret |= regmap_write(led->regmap, REG_PON, + led->state ? BD65B60_ON : BD65B60_OFF); + + mutex_unlock(&led->lock); + + return ret; +} + +static int bd65b60_parse_dt(struct bd65b60_led *led, + struct fwnode_handle **fwnode) +{ + struct device *dev = &led->client->dev; + struct fwnode_handle *child = NULL; + char default_state[] = "keep"; + int ret; + + child = device_get_next_child_node(dev, child); + if (!child) { + dev_err(dev, "No led child node found"); + return -ENODEV; + } + + /* Check required properties */ + if (!fwnode_property_present(child, "rohm,enable-outputs")) { + dev_err(dev, "No rohm,enable-outputs property found"); + return -ENOENT; + } + + ret = fwnode_property_read_u32(child, "rohm,enable-outputs", &led->enable); + if (ret || (led->enable & LEDSEL_MASK) != led->enable) { + dev_err(dev, "Failed to read rohm,enable-outputs property"); + return ret; + } + + /* Check optional properties */ + led->state = BD65B60_OFF; + if (!fwnode_property_present(child, "default-state")) { + ret = fwnode_property_read_string(child, "default-state", + (const char **)&default_state); + if (ret) { + dev_err(dev, "Failed to read default-state property"); + return ret; + } + + if (strcmp(default_state, "keep") == 0) { + led->state = BD65B60_KEEP; + } else if (strcmp(default_state, "on") == 0) { + led->state = BD65B60_ON; + } else if (strcmp(default_state, "off") == 0) { + led->state = BD65B60_OFF; + } else { + dev_err(dev, "Invalid default-state property"); + return -EINVAL; + } + } + + led->ovp = BD65B60_DEFAULT_OVP_VAL; + if (fwnode_property_present(child, "rohm,ovp")) { + ret = fwnode_property_read_u32(child, "rohm,ovp", &led->ovp); + + if (ret || (led->ovp & OVP_MASK) != led->ovp) { + dev_err(dev, "Failed to read rohm,ovp property"); + return ret; + } + } + + *fwnode = child; + + return 0; +} + +static int bd65b60_probe(struct i2c_client *client) +{ + struct bd65b60_led *led; + struct led_init_data init_data = {}; + struct fwnode_handle *fwnode = NULL; + int ret; + + led = devm_kzalloc(&client->dev, sizeof(*led), GFP_KERNEL); + if (!led) + return -ENOMEM; + + led->client = client; + i2c_set_clientdata(client, led); + + ret = bd65b60_parse_dt(led, &fwnode); + if (ret) + return ret; + + led->cdev.name = BD65B60_DEFAULT_NAME; + led->cdev.brightness_set = bd65b60_brightness_set; + led->cdev.brightness = BD65B60_DEFAULT_BRIGHTNESS; + led->cdev.max_brightness = BD65B60_MAX_BRIGHTNESS; + led->cdev.default_trigger = BD65B60_DEFAULT_TRIGGER; + led->client = client; + + led->regmap = devm_regmap_init_i2c(client, &bd65b60_regmap_config); + if (IS_ERR(led->regmap)) { + ret = PTR_ERR(led->regmap); + dev_err(&client->dev, "Failed to allocate register map: %d", + ret); + return ret; + } + + mutex_init(&led->lock); + + ret = bd65b60_init(led); + if (ret) { + dev_err(&client->dev, "Failed to initialize led: %d", ret); + mutex_destroy(&led->lock); + return ret; + } + + init_data.fwnode = fwnode; + init_data.devicename = led->client->name; + init_data.default_label = ":"; + ret = devm_led_classdev_register_ext(&client->dev, &led->cdev, + &init_data); + if (ret) { + dev_err(&client->dev, "Failed to register led: %d", ret); + mutex_destroy(&led->lock); + return ret; + } + + return 0; +} + +static void bd65b60_remove(struct i2c_client *client) +{ + int ret; + struct bd65b60_led *led = i2c_get_clientdata(client); + + ret = regmap_write(led->regmap, REG_PON, BD65B60_OFF); + if (ret) + dev_err(&client->dev, "Failed to turn off led: %d", ret); + + mutex_destroy(&led->lock); +} + +static const struct i2c_device_id bd65b60_id[] = { + { "bd65b60", 0 }, + {}, +}; +MODULE_DEVICE_TABLE(i2c, bd65b60_id); + +static const struct of_device_id of_bd65b60_leds_match[] = { + { .compatible = "rohm,bd65b60" }, + {}, +}; +MODULE_DEVICE_TABLE(of, of_bd65b60_leds_match); + +static struct i2c_driver bd65b60_i2c_driver = { + .driver = { + .name = "bd65b60", + .owner = THIS_MODULE, + .of_match_table = of_match_ptr(of_bd65b60_leds_match), + }, + .probe_new = bd65b60_probe, + .remove = bd65b60_remove, + .id_table = bd65b60_id, +}; + +module_i2c_driver(bd65b60_i2c_driver); + +MODULE_AUTHOR("Bogdan Ionescu <bogdan.ionescu.work+kernel@gmail.com>"); +MODULE_DESCRIPTION("ROHM Semiconductor led driver for bd65b60"); +MODULE_LICENSE("GPL"); -- 2.39.2 ^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] leds: Add support for rohm,bd65b60 led driver 2023-03-08 20:14 ` [PATCH 2/2] leds: Add support for rohm,bd65b60 led driver Bogdan Ionescu @ 2023-03-09 9:06 ` Krzysztof Kozlowski [not found] ` <CALfPHoVFVpnLVEjzccbyMvmNR_=3vjJ+Ub8tkriJOvvV0cLzsA@mail.gmail.com> 2023-03-18 4:54 ` kernel test robot 1 sibling, 1 reply; 9+ messages in thread From: Krzysztof Kozlowski @ 2023-03-09 9:06 UTC (permalink / raw) To: Bogdan Ionescu, Pavel Machek, Lee Jones, Rob Herring Cc: Krzysztof Kozlowski, linux-leds, devicetree, linux-kernel On 08/03/2023 21:14, Bogdan Ionescu wrote: > This commit adds support for ROHM BD65B60 led driver. Do not use "This commit/patch". https://elixir.bootlin.com/linux/v5.17.1/source/Documentation/process/submitting-patches.rst#L95 > The chip supports 2 outpus sharing the same current setting > and is controlled over I2C. > > Signed-off-by: Bogdan Ionescu <bogdan.ionescu.work@gmail.com> > --- Thank you for your patch. There is something to discuss/improve. > + > + /* Check required properties */ > + if (!fwnode_property_present(child, "rohm,enable-outputs")) { > + dev_err(dev, "No rohm,enable-outputs property found"); > + return -ENOENT; The property is not required by your binding, so you cannot bail here. > + } > + > + ret = fwnode_property_read_u32(child, "rohm,enable-outputs", &led->enable); > + if (ret || (led->enable & LEDSEL_MASK) != led->enable) { > + dev_err(dev, "Failed to read rohm,enable-outputs property"); No need to check for properties twice... > + return ret; > + } > + > + /* Check optional properties */ > + led->state = BD65B60_OFF; > + if (!fwnode_property_present(child, "default-state")) { > + ret = fwnode_property_read_string(child, "default-state", > + (const char **)&default_state); > + if (ret) { > + dev_err(dev, "Failed to read default-state property"); > + return ret; > + } > + > + if (strcmp(default_state, "keep") == 0) { > + led->state = BD65B60_KEEP; > + } else if (strcmp(default_state, "on") == 0) { > + led->state = BD65B60_ON; > + } else if (strcmp(default_state, "off") == 0) { > + led->state = BD65B60_OFF; > + } else { > + dev_err(dev, "Invalid default-state property"); > + return -EINVAL; > + } > + } > + > + led->ovp = BD65B60_DEFAULT_OVP_VAL; > + if (fwnode_property_present(child, "rohm,ovp")) { > + ret = fwnode_property_read_u32(child, "rohm,ovp", &led->ovp); > + > + if (ret || (led->ovp & OVP_MASK) != led->ovp) { > + dev_err(dev, "Failed to read rohm,ovp property"); > + return ret; > + } > + } > + > + *fwnode = child; > + > + return 0; > +} > + > +static int bd65b60_probe(struct i2c_client *client) > +{ > + struct bd65b60_led *led; > + struct led_init_data init_data = {}; > + struct fwnode_handle *fwnode = NULL; > + int ret; > + > + led = devm_kzalloc(&client->dev, sizeof(*led), GFP_KERNEL); > + if (!led) > + return -ENOMEM; > + > + led->client = client; > + i2c_set_clientdata(client, led); > + > + ret = bd65b60_parse_dt(led, &fwnode); > + if (ret) > + return ret; > + > + led->cdev.name = BD65B60_DEFAULT_NAME; > + led->cdev.brightness_set = bd65b60_brightness_set; > + led->cdev.brightness = BD65B60_DEFAULT_BRIGHTNESS; > + led->cdev.max_brightness = BD65B60_MAX_BRIGHTNESS; > + led->cdev.default_trigger = BD65B60_DEFAULT_TRIGGER; > + led->client = client; > + > + led->regmap = devm_regmap_init_i2c(client, &bd65b60_regmap_config); > + if (IS_ERR(led->regmap)) { > + ret = PTR_ERR(led->regmap); > + dev_err(&client->dev, "Failed to allocate register map: %d", > + ret); return dev_err_probe > + return ret; > + } > + > + mutex_init(&led->lock); > + > + ret = bd65b60_init(led); > + if (ret) { > + dev_err(&client->dev, "Failed to initialize led: %d", ret); return dev_err_probe > + mutex_destroy(&led->lock); or ret = dev_err_probe and goto to common cleanup part > + return ret; > + } > + > + init_data.fwnode = fwnode; > + init_data.devicename = led->client->name; > + init_data.default_label = ":"; > + ret = devm_led_classdev_register_ext(&client->dev, &led->cdev, > + &init_data); > + if (ret) { > + dev_err(&client->dev, "Failed to register led: %d", ret); return dev_err_probe > + mutex_destroy(&led->lock); > + return ret; > + } > + > + return 0; > +} > + > +static void bd65b60_remove(struct i2c_client *client) > +{ > + int ret; > + struct bd65b60_led *led = i2c_get_clientdata(client); > + > + ret = regmap_write(led->regmap, REG_PON, BD65B60_OFF); > + if (ret) > + dev_err(&client->dev, "Failed to turn off led: %d", ret); > + > + mutex_destroy(&led->lock); > +} > + > +static const struct i2c_device_id bd65b60_id[] = { > + { "bd65b60", 0 }, > + {}, > +}; > +MODULE_DEVICE_TABLE(i2c, bd65b60_id); > + > +static const struct of_device_id of_bd65b60_leds_match[] = { > + { .compatible = "rohm,bd65b60" }, > + {}, > +}; > +MODULE_DEVICE_TABLE(of, of_bd65b60_leds_match); > + > +static struct i2c_driver bd65b60_i2c_driver = { > + .driver = { > + .name = "bd65b60", > + .owner = THIS_MODULE, > + .of_match_table = of_match_ptr(of_bd65b60_leds_match), Drop of_match_ptr. It requires maybe_unused which you do not have, so this will cause warnings. Best regards, Krzysztof ^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <CALfPHoVFVpnLVEjzccbyMvmNR_=3vjJ+Ub8tkriJOvvV0cLzsA@mail.gmail.com>]
* Re: [PATCH 2/2] leds: Add support for rohm,bd65b60 led driver [not found] ` <CALfPHoVFVpnLVEjzccbyMvmNR_=3vjJ+Ub8tkriJOvvV0cLzsA@mail.gmail.com> @ 2023-03-10 10:48 ` Krzysztof Kozlowski 0 siblings, 0 replies; 9+ messages in thread From: Krzysztof Kozlowski @ 2023-03-10 10:48 UTC (permalink / raw) To: Bogdan Ionescu Cc: Pavel Machek, Lee Jones, Rob Herring, Krzysztof Kozlowski, linux-leds, devicetree, linux-kernel On 10/03/2023 11:44, Bogdan Ionescu wrote: >>> + /* Check required properties */ >>> + if (!fwnode_property_present(child, "rohm,enable-outputs")) { >>> + dev_err(dev, "No rohm,enable-outputs property found"); >>> + return -ENOENT; >>> + } >>> + >>> + ret = fwnode_property_read_u32(child, "rohm,enable-outputs", > &led->enable); >>> + if (ret || (led->enable & LEDSEL_MASK) != led->enable) { >>> + dev_err(dev, "Failed to read rohm,enable-outputs property"); >> >> No need to check for properties twice... > > I understand that you can just check the return value, but what is then > the point of the fwnode_property_present() function? Where is it otherwise > supposed to be used? > > I am happy to remove the first check, but I would like to understand the > reasoning behind it. I found value in separating a value not found error > from an incorrect value error. ENOENT is not valid code - No such file or directory. Thus you cannot return different codes. The code should be simple and printing error on fwnode_property_read_u32() is enough to report it to the developer. Best regards, Krzysztof ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] leds: Add support for rohm,bd65b60 led driver 2023-03-08 20:14 ` [PATCH 2/2] leds: Add support for rohm,bd65b60 led driver Bogdan Ionescu 2023-03-09 9:06 ` Krzysztof Kozlowski @ 2023-03-18 4:54 ` kernel test robot 1 sibling, 0 replies; 9+ messages in thread From: kernel test robot @ 2023-03-18 4:54 UTC (permalink / raw) To: Bogdan Ionescu, Pavel Machek, Lee Jones, Rob Herring Cc: llvm, oe-kbuild-all, Krzysztof Kozlowski, linux-leds, devicetree, linux-kernel, Bogdan Ionescu Hi Bogdan, Thank you for the patch! Perhaps something to improve: [auto build test WARNING on lee-leds/for-leds-next] [also build test WARNING on robh/for-next pavel-leds/for-next linus/master v6.3-rc2 next-20230317] [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/Bogdan-Ionescu/leds-Add-support-for-rohm-bd65b60-led-driver/20230309-041730 base: https://git.kernel.org/pub/scm/linux/kernel/git/lee/leds.git for-leds-next patch link: https://lore.kernel.org/r/20230308201451.11629-2-bogdan.ionescu.work%40gmail.com patch subject: [PATCH 2/2] leds: Add support for rohm,bd65b60 led driver config: s390-randconfig-r003-20230318 (https://download.01.org/0day-ci/archive/20230318/202303181228.ZP7Ig92k-lkp@intel.com/config) compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project 67409911353323ca5edf2049ef0df54132fa1ca7) reproduce (this is a W=1 build): wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # install s390 cross compiling tool for clang build # apt-get install binutils-s390x-linux-gnu # https://github.com/intel-lab-lkp/linux/commit/72417c0228f115628b1ad307be9d8e53532de6a6 git remote add linux-review https://github.com/intel-lab-lkp/linux git fetch --no-tags linux-review Bogdan-Ionescu/leds-Add-support-for-rohm-bd65b60-led-driver/20230309-041730 git checkout 72417c0228f115628b1ad307be9d8e53532de6a6 # save the config file mkdir build_dir && cp config build_dir/.config COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=s390 olddefconfig COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=s390 SHELL=/bin/bash drivers/leds/ drivers/net/usb/ If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> | Link: https://lore.kernel.org/oe-kbuild-all/202303181228.ZP7Ig92k-lkp@intel.com/ All warnings (new ones prefixed by >>): In file included from drivers/leds/leds-bd65b60.c:14: In file included from include/linux/regmap.h:20: In file included from include/linux/iopoll.h:14: In file included from include/linux/io.h:13: In file included from arch/s390/include/asm/io.h:75: include/asm-generic/io.h:547: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:560: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/big_endian.h:37:59: note: expanded from macro '__le16_to_cpu' #define __le16_to_cpu(x) __swab16((__force __u16)(__le16)(x)) ^ include/uapi/linux/swab.h:102:54: note: expanded from macro '__swab16' #define __swab16(x) (__u16)__builtin_bswap16((__u16)(x)) ^ In file included from drivers/leds/leds-bd65b60.c:14: In file included from include/linux/regmap.h:20: In file included from include/linux/iopoll.h:14: In file included from include/linux/io.h:13: In file included from arch/s390/include/asm/io.h:75: include/asm-generic/io.h:573: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/big_endian.h:35:59: note: expanded from macro '__le32_to_cpu' #define __le32_to_cpu(x) __swab32((__force __u32)(__le32)(x)) ^ include/uapi/linux/swab.h:115:54: note: expanded from macro '__swab32' #define __swab32(x) (__u32)__builtin_bswap32((__u32)(x)) ^ In file included from drivers/leds/leds-bd65b60.c:14: In file included from include/linux/regmap.h:20: In file included from include/linux/iopoll.h:14: In file included from include/linux/io.h:13: In file included from arch/s390/include/asm/io.h:75: include/asm-generic/io.h:584: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:594: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:604: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:692: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:700: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:708: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:717: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:726: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:735:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] writesl(PCI_IOBASE + addr, buffer, count); ~~~~~~~~~~ ^ drivers/leds/leds-bd65b60.c:111:6: warning: variable 'ret' is used uninitialized whenever 'if' condition is false [-Wsometimes-uninitialized] if (led->state != BD65B60_KEEP) { ^~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/leds/leds-bd65b60.c:116:2: note: uninitialized use occurs here ret |= regmap_update_bits(led->regmap, REG_COMSET1, OVP_MASK, led->ovp); ^~~ drivers/leds/leds-bd65b60.c:111:2: note: remove the 'if' if its condition is always true if (led->state != BD65B60_KEEP) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ drivers/leds/leds-bd65b60.c:107:9: note: initialize the variable 'ret' to silence this warning int ret; ^ = 0 >> drivers/leds/leds-bd65b60.c:266:34: warning: unused variable 'of_bd65b60_leds_match' [-Wunused-const-variable] static const struct of_device_id of_bd65b60_leds_match[] = { ^ 14 warnings generated. vim +/of_bd65b60_leds_match +266 drivers/leds/leds-bd65b60.c 265 > 266 static const struct of_device_id of_bd65b60_leds_match[] = { 267 { .compatible = "rohm,bd65b60" }, 268 {}, 269 }; 270 MODULE_DEVICE_TABLE(of, of_bd65b60_leds_match); 271 -- 0-DAY CI Kernel Test Service https://github.com/intel/lkp-tests ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] dt-bindings: leds: Document rohm,bd65b60 bindings 2023-03-08 20:14 [PATCH 1/2] dt-bindings: leds: Document rohm,bd65b60 bindings Bogdan Ionescu 2023-03-08 20:14 ` [PATCH 2/2] leds: Add support for rohm,bd65b60 led driver Bogdan Ionescu @ 2023-03-08 23:16 ` Rob Herring 2023-03-09 9:03 ` Krzysztof Kozlowski 2 siblings, 0 replies; 9+ messages in thread From: Rob Herring @ 2023-03-08 23:16 UTC (permalink / raw) To: Bogdan Ionescu Cc: Pavel Machek, Lee Jones, linux-kernel, linux-leds, devicetree, Krzysztof Kozlowski, Rob Herring On Wed, 08 Mar 2023 20:14:50 +0000, Bogdan Ionescu wrote: > Hi all, > > This is my first patch to the kernel, so I expect to have made > some mistakes. I did my best to follow the documentation and > submitting patches guidelines, but if I missed something, please > let me know. > > I wasn't sure if I had to add myself to the MAINTAINERS file for such a > small patch, so I didn't. > > Patch begins here: > > Added devicetree bindings documentation for the rohm,bd65b60 > led driver. > > Signed-off-by: Bogdan Ionescu <bogdan.ionescu.work@gmail.com> > --- > .../bindings/leds/rohm,bd65b60-leds.yaml | 77 +++++++++++++++++++ > include/dt-bindings/leds/leds-bd65b60.h | 20 +++++ > 2 files changed, 97 insertions(+) > create mode 100644 Documentation/devicetree/bindings/leds/rohm,bd65b60-leds.yaml > create mode 100644 include/dt-bindings/leds/leds-bd65b60.h > My bot found errors running 'make DT_CHECKER_FLAGS=-m dt_binding_check' on your patch (DT_CHECKER_FLAGS is new in v5.13): yamllint warnings/errors: dtschema/dtc warnings/errors: Documentation/devicetree/bindings/leds/rohm,bd65b60-leds.example.dts:25.17-30: Warning (reg_format): /example-0/i2c/led_controler@64:reg: property has invalid length (4 bytes) (#address-cells == 2, #size-cells == 1) Documentation/devicetree/bindings/leds/rohm,bd65b60-leds.example.dtb: Warning (pci_device_reg): Failed prerequisite 'reg_format' Documentation/devicetree/bindings/leds/rohm,bd65b60-leds.example.dtb: Warning (pci_device_bus_num): Failed prerequisite 'reg_format' Documentation/devicetree/bindings/leds/rohm,bd65b60-leds.example.dtb: Warning (simple_bus_reg): Failed prerequisite 'reg_format' Documentation/devicetree/bindings/leds/rohm,bd65b60-leds.example.dts:21.13-35.11: Warning (i2c_bus_bridge): /example-0/i2c: incorrect #address-cells for I2C bus Documentation/devicetree/bindings/leds/rohm,bd65b60-leds.example.dts:21.13-35.11: Warning (i2c_bus_bridge): /example-0/i2c: incorrect #size-cells for I2C bus Documentation/devicetree/bindings/leds/rohm,bd65b60-leds.example.dtb: Warning (i2c_bus_reg): Failed prerequisite 'reg_format' Documentation/devicetree/bindings/leds/rohm,bd65b60-leds.example.dtb: Warning (i2c_bus_reg): Failed prerequisite 'i2c_bus_bridge' Documentation/devicetree/bindings/leds/rohm,bd65b60-leds.example.dtb: Warning (spi_bus_reg): Failed prerequisite 'reg_format' Documentation/devicetree/bindings/leds/rohm,bd65b60-leds.example.dts:23.30-34.15: Warning (avoid_default_addr_size): /example-0/i2c/led_controler@64: Relying on default #address-cells value Documentation/devicetree/bindings/leds/rohm,bd65b60-leds.example.dts:23.30-34.15: Warning (avoid_default_addr_size): /example-0/i2c/led_controler@64: Relying on default #size-cells value Documentation/devicetree/bindings/leds/rohm,bd65b60-leds.example.dtb: Warning (unique_unit_address_if_enabled): Failed prerequisite 'avoid_default_addr_size' doc reference errors (make refcheckdocs): See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20230308201451.11629-1-bogdan.ionescu.work@gmail.com The base for the series is generally the latest rc1. A different dependency should be noted in *this* patch. If you already ran 'make dt_binding_check' and didn't see the above error(s), then make sure 'yamllint' is installed and dt-schema is up to date: pip3 install dtschema --upgrade Please check and re-submit after running the above command yourself. Note that DT_SCHEMA_FILES can be set to your schema file to speed up checking your schema. However, it must be unset to test all examples with your schema. ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 1/2] dt-bindings: leds: Document rohm,bd65b60 bindings 2023-03-08 20:14 [PATCH 1/2] dt-bindings: leds: Document rohm,bd65b60 bindings Bogdan Ionescu 2023-03-08 20:14 ` [PATCH 2/2] leds: Add support for rohm,bd65b60 led driver Bogdan Ionescu 2023-03-08 23:16 ` [PATCH 1/2] dt-bindings: leds: Document rohm,bd65b60 bindings Rob Herring @ 2023-03-09 9:03 ` Krzysztof Kozlowski [not found] ` <CALfPHoVT007ifyTepr_p-saDQtv5Sk7iYXM4qSMXyaCLL3iE2A@mail.gmail.com> 2 siblings, 1 reply; 9+ messages in thread From: Krzysztof Kozlowski @ 2023-03-09 9:03 UTC (permalink / raw) To: Bogdan Ionescu, Pavel Machek, Lee Jones, Rob Herring Cc: Krzysztof Kozlowski, linux-leds, devicetree, linux-kernel On 08/03/2023 21:14, Bogdan Ionescu wrote: > Hi all, > > This is my first patch to the kernel, so I expect to have made > some mistakes. I did my best to follow the documentation and > submitting patches guidelines, but if I missed something, please > let me know. > > I wasn't sure if I had to add myself to the MAINTAINERS file for such a > small patch, so I didn't. > > Patch begins here: This all goes to cover letter. Patch begins with first line. `git am` this patch so you will see the issues. > > Added devicetree bindings documentation for the rohm,bd65b60 > led driver. > > Signed-off-by: Bogdan Ionescu <bogdan.ionescu.work@gmail.com> Subject: drop second/last, redundant "bindings". The "dt-bindings" prefix is already stating that these are bindings. > --- > .../bindings/leds/rohm,bd65b60-leds.yaml | 77 +++++++++++++++++++ > include/dt-bindings/leds/leds-bd65b60.h | 20 +++++ > 2 files changed, 97 insertions(+) > create mode 100644 Documentation/devicetree/bindings/leds/rohm,bd65b60-leds.yaml > create mode 100644 include/dt-bindings/leds/leds-bd65b60.h > > diff --git a/Documentation/devicetree/bindings/leds/rohm,bd65b60-leds.yaml b/Documentation/devicetree/bindings/leds/rohm,bd65b60-leds.yaml > new file mode 100644 > index 000000000000..f69d7acd39c8 > --- /dev/null > +++ b/Documentation/devicetree/bindings/leds/rohm,bd65b60-leds.yaml Drop "-leds". This should match compatible. > @@ -0,0 +1,77 @@ > +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause > +%YAML 1.2 > +--- > +$id: http://devicetree.org/schemas/leds/rohm,bd65b60-leds.yaml# > +$schema: http://devicetree.org/meta-schemas/core.yaml# > + > +title: ROHM BD65B60 device tree bindings Drop "device tree bindings" > + > +maintainers: > + - Bogdan Ionescu <bogdan.ionescu.work+kernel@gmail.com> > + > +description: | > + BD65B60 is a white LED driver IC that integrates PWM > + step-up DC/DC converter with boost-capability of up to > + maximum 28.5V and current driver with drive capability of up > + to 25mA(Typ.) maximum setting. Precise brightness can be > + controlled at wide ranges through the external PWM pulse > + input. > + > +properties: > + compatible: > + const: rohm,bd65b60 > + > + reg: > + maxItems: 1 > + > + led: Drop led object. There is no real need for it, is it? > + type: object > + $ref: common.yaml# > + unevaluatedProperties: false > + > + properties: > + rohm,enable-outputs: > + description: > + Select which leds are being controlled. > + Values defined in <dt-bindings/leds/leds-bd65b60.h> I don't understand why do you need this property. You should use generic/existing properties, if possible. > + $ref: "/schemas/types.yaml#/definitions/uint32" Drop quotes > + enum: [ 0, 1, 4, 5 ] > + > + rohm,ovp: > + description: > + Select Over-Voltage-Portection level. > + Values defined in <dt-bindings/leds/leds-bd65b60.h> > + $ref: "/schemas/types.yaml#/definitions/uint32" Drop quotes > + enum: [ 0, 8, 16 ] > + default: 16 What are the units? percent? Volts? Then use unit suffix in property name. Your other file suggests volts so make it microvolts. https://github.com/devicetree-org/dt-schema/blob/main/dtschema/schemas/property-units.yaml > + > + required: > + - rohm,enable-outputs > + > +required: > + - compatible > + - reg > +additionalProperties: false > + > +examples: > + - | > + #include <dt-bindings/leds/common.h> > + #include <dt-bindings/leds/leds-bd65b60.h> > + > + i2c { > + Drop blank line Does not look like you tested the bindings. Please run `make dt_binding_check` (see Documentation/devicetree/bindings/writing-schema.rst for instructions). > + led_controler@64 { No underscores in node names > + compatible = "rohm,bd65b60"; > + reg = <0x64>; > + > + backlight_led: led { > + function = LED_FUNCTION_BACKLIGHT; > + color = <LED_COLOR_ID_WHITE>; > + rohm,enable-outputs = <BD65B60_ENABLE_LED1>; > + default-state = "keep"; > + linux,default-trigger = "backlight"; > + }; > + }; > + }; > + > +... > diff --git a/include/dt-bindings/leds/leds-bd65b60.h b/include/dt-bindings/leds/leds-bd65b60.h > new file mode 100644 > index 000000000000..8634faae58f4 > --- /dev/null > +++ b/include/dt-bindings/leds/leds-bd65b60.h Filename matching binding, but I think entire file will be gone. > @@ -0,0 +1,20 @@ > +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */ > +/* > + * This header provides macros for the ROHM BD65B60 device tree bindings. > + * > + * Copyright (C) 2023 Bogdan Ionescu <bogdan.ionescu.work+kernel@gmail.com> > + */ > + > +#ifndef _DT_BINDINGS_LEDS_BD65B60_H > +#define _DT_BINDINGS_LEDS_BD65B60_H > + > +#define BD65B60_ENABLE_NONE 0 > +#define BD65B60_ENABLE_LED1 1 > +#define BD65B60_ENABLE_LED2 4 > +#define BD65B60_ENABLE_BOTH (BD65B60_ENABLE_LED1 | BD65B60_ENABLE_LED2) I don't understand this. > + > +#define BD65B60_OVP_25V 0 > +#define BD65B60_OVP_30V 0x08 > +#define BD65B60_OVP_35V 0x10 Drop, register values are not bindings. > + > +#endif /* _DT_BINDINGS_LEDS_BD65B60_H */ Best regards, Krzysztof ^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <CALfPHoVT007ifyTepr_p-saDQtv5Sk7iYXM4qSMXyaCLL3iE2A@mail.gmail.com>]
* Re: [PATCH 1/2] dt-bindings: leds: Document rohm,bd65b60 bindings [not found] ` <CALfPHoVT007ifyTepr_p-saDQtv5Sk7iYXM4qSMXyaCLL3iE2A@mail.gmail.com> @ 2023-03-11 9:06 ` Krzysztof Kozlowski [not found] ` <CALfPHoVR=kmHmbhNzQg-bW-bV6P8e_sE+vEebQXOfL-nEWg5TQ@mail.gmail.com> 0 siblings, 1 reply; 9+ messages in thread From: Krzysztof Kozlowski @ 2023-03-11 9:06 UTC (permalink / raw) To: Bogdan Ionescu Cc: Pavel Machek, Lee Jones, Rob Herring, Krzysztof Kozlowski, linux-leds, devicetree, linux-kernel On 10/03/2023 11:41, Bogdan Ionescu wrote: > Thanks for the feedback, I am working on addressing the issues you have > raised. If I haven't mentioned something, please assume I am implementing > your suggestion. > >>> + properties: >>> + rohm,enable-outputs: >> >> I don't understand why do you need this property. You should use >> generic/existing properties, if possible. > >> Drop led object. There is no real need for it, is it? > > Would this structure be more appropriate: > > + led-controler@64 { > + compatible = "rohm,bd65b60"; > + reg = <0x64>; > + default-state = "keep"; > + linux,default-trigger = "backlight"; > + > + led@1 { > + reg = <1>; > + function = LED_FUNCTION_BACKLIGHT; > + color = <LED_COLOR_ID_WHITE>; > + }; > + > + led@2 { > + reg = <2>; > + function = LED_FUNCTION_BACKLIGHT; > + color = <LED_COLOR_ID_WHITE>; > + }; > + }; > > Can I have 2 led nodes if they share the same brightness? I think yes, but what about LED on/off? Is it also shared or separate? Because if it is shared, then basically it is just one LED... > >>> + enum: [ 0, 8, 16 ] >>> + default: 16 >> >> What are the units? percent? Volts? Then use unit suffix in property >> name. Your other file suggests volts so make it microvolts. > > The chip has 3 possible values 25V, 30V and 35V. How should the driver > handle a value that is not exactly that? > Should it round down for safety or return an error? Then use -microvolt and real units https://github.com/devicetree-org/dt-schema/blob/main/dtschema/schemas/property-units.yaml > > This was the reason for creating the bindings header file. > Is it possible to reference defines from the bindings header file? > > + enum: > + - BD65B60_OVP_25V > + - BD65B60_OVP_30V > + - BD65B60_OVP_35V > + default: BD65B60_OVP_35V > > I would prefer it if I didn't have to expose the weird bitmasks that ROHM > have decided to use and instead use the actual values. > > Apologies for the long email, but I wanted to make sure I was clear. Best regards, Krzysztof ^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <CALfPHoVR=kmHmbhNzQg-bW-bV6P8e_sE+vEebQXOfL-nEWg5TQ@mail.gmail.com>]
* Re: [PATCH 1/2] dt-bindings: leds: Document rohm,bd65b60 bindings [not found] ` <CALfPHoVR=kmHmbhNzQg-bW-bV6P8e_sE+vEebQXOfL-nEWg5TQ@mail.gmail.com> @ 2023-03-12 20:42 ` Krzysztof Kozlowski 0 siblings, 0 replies; 9+ messages in thread From: Krzysztof Kozlowski @ 2023-03-12 20:42 UTC (permalink / raw) To: Bogdan Ionescu Cc: Pavel Machek, Lee Jones, Rob Herring, Krzysztof Kozlowski, linux-leds, devicetree, linux-kernel On 12/03/2023 21:34, Bogdan Ionescu wrote: >> I think yes, but what about LED on/off? Is it also shared or separate? >> Because if it is shared, then basically it is just one LED... > No, the outputs can be enabled independently, but I don't see any > function in the led_classdev to do that. > The led-sources property looks like the right thing to use for this. > If I have effectively only one led per device, do I still need an led > child node or is this sufficient: > > + #include <dt-bindings/leds/common.h> > + i2c { > + backlight@64 { First of all, backlight is something a bit different/more specific - see Documentation/devicetree/bindings/leds/backlight/ Anyway for led-sources and everything in one node, I think you do not need any children. But this will allow you only one function and one color... > + compatible = "rohm,bd65b60"; > + reg = <0x64>; > + > + led-sources = <1>, <2>; > + function = LED_FUNCTION_BACKLIGHT; > + color = <LED_COLOR_ID_WHITE>; > + > + rohm,ovp = <30000000>; > + }; > + }; > > Best regards, > Bogdan Ionescu > Best regards, Krzysztof ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2023-03-18 4:55 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-03-08 20:14 [PATCH 1/2] dt-bindings: leds: Document rohm,bd65b60 bindings Bogdan Ionescu
2023-03-08 20:14 ` [PATCH 2/2] leds: Add support for rohm,bd65b60 led driver Bogdan Ionescu
2023-03-09 9:06 ` Krzysztof Kozlowski
[not found] ` <CALfPHoVFVpnLVEjzccbyMvmNR_=3vjJ+Ub8tkriJOvvV0cLzsA@mail.gmail.com>
2023-03-10 10:48 ` Krzysztof Kozlowski
2023-03-18 4:54 ` kernel test robot
2023-03-08 23:16 ` [PATCH 1/2] dt-bindings: leds: Document rohm,bd65b60 bindings Rob Herring
2023-03-09 9:03 ` Krzysztof Kozlowski
[not found] ` <CALfPHoVT007ifyTepr_p-saDQtv5Sk7iYXM4qSMXyaCLL3iE2A@mail.gmail.com>
2023-03-11 9:06 ` Krzysztof Kozlowski
[not found] ` <CALfPHoVR=kmHmbhNzQg-bW-bV6P8e_sE+vEebQXOfL-nEWg5TQ@mail.gmail.com>
2023-03-12 20:42 ` Krzysztof Kozlowski
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).