Re: [PATCH v12 06/16] leds: lp50xx: Add the LP50XX family of the RGB LED driver
From: Jacek Anaszewski
Date: Fri Oct 11 2019 - 16:04:51 EST
Dan,
On 10/11/19 3:06 PM, Dan Murphy wrote:
> Introduce 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
> LP5009 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.
>
> Signed-off-by: Dan Murphy <dmurphy@xxxxxx>
> ---
> drivers/leds/Kconfig | 11 +
> drivers/leds/Makefile | 1 +
> drivers/leds/leds-lp50xx.c | 799 +++++++++++++++++++++++++++++++++++++
> 3 files changed, 811 insertions(+)
> create mode 100644 drivers/leds/leds-lp50xx.c
>
> diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
> index a1ede89afc9e..fb614a6b9afa 100644
> --- a/drivers/leds/Kconfig
> +++ b/drivers/leds/Kconfig
> @@ -363,6 +363,17 @@ 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/12/9 LED driver chip"
> + depends on LEDS_CLASS && REGMAP_I2C
> + depends on LEDS_CLASS_MULTI_COLOR
> + help
> + If you say yes here you get support for the Texas Instruments
> + LP5036, LP5030, LP5024, LP5018, LP5012 and LP5009 LED driver.
> +
> + To compile this driver as a module, choose M here: the
> + module will be called leds-lp50xx.
> +
> 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
> diff --git a/drivers/leds/Makefile b/drivers/leds/Makefile
> index 841038cfe35b..7a208a0f7b84 100644
> --- a/drivers/leds/Makefile
> +++ b/drivers/leds/Makefile
> @@ -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
> diff --git a/drivers/leds/leds-lp50xx.c b/drivers/leds/leds-lp50xx.c
[...]
> + fwnode_for_each_child_node(child, led_node) {
> + ret = fwnode_property_read_u32(led_node, "color",
> + &color_id);
> + if (ret)
> + dev_err(&priv->client->dev,
> + "Cannot read color\n");
> +
> + set_bit(color_id, &led->mc_cdev.available_colors);
> + num_colors++;
> +
> + }
> +
> + led->priv = priv;
> + led->mc_cdev.num_leds = num_colors;
> + led->mc_cdev.led_cdev = &led->led_dev;
> + led->led_dev.brightness_set_blocking = lp50xx_brightness_set;
> + led->led_dev.brightness_get = lp50xx_brightness_get;
> + ret = led_classdev_multicolor_register_ext(&priv->client->dev,
> + &led->mc_cdev,
> + &init_data);
s/led_classdev/devm_led_classdev/
> + if (ret) {
> + dev_err(&priv->client->dev, "led register err: %d\n",
> + ret);
> + fwnode_handle_put(child);
> + goto child_out;
> + }
> + i++;
> + }
> +
> +child_out:
> + return ret;
> +}
> +
--
Best regards,
Jacek Anaszewski