From: Daniel Thompson <daniel.thompson@linaro.org> To: Jean-Jacques Hiblot <jjhiblot@ti.com> Cc: mark.rutland@arm.com, jingoohan1@gmail.com, tomi.valkeinen@ti.com, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, robh+dt@kernel.org, jacek.anaszewski@gmail.com, pavel@ucw.cz, lee.jones@linaro.org, linux-leds@vger.kernel.org, dmurphy@ti.com Subject: Re: [PATCH v2 4/4] backlight: add led-backlight driver Date: Tue, 9 Jul 2019 10:31:35 +0100 [thread overview] Message-ID: <20190709093135.ceuj5tszmuri52w2@holly.lan> (raw) In-Reply-To: <20190708102700.23138-5-jjhiblot@ti.com> On Mon, Jul 08, 2019 at 12:27:00PM +0200, Jean-Jacques Hiblot wrote: > From: Tomi Valkeinen <tomi.valkeinen@ti.com> > > This patch adds a led-backlight driver (led_bl), which is similar to > pwm_bl except the driver uses a LED class driver to adjust the > brightness in the HW. Multiple LEDs can be used for a single backlight. > > Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com> > Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com> > --- > drivers/video/backlight/Kconfig | 7 + > drivers/video/backlight/Makefile | 1 + > drivers/video/backlight/led_bl.c | 235 +++++++++++++++++++++++++++++++ > 3 files changed, 243 insertions(+) > create mode 100644 drivers/video/backlight/led_bl.c > diff --git a/drivers/video/backlight/led_bl.c b/drivers/video/backlight/led_bl.c > new file mode 100644 > index 000000000000..7644277cfdbb > --- /dev/null > +++ b/drivers/video/backlight/led_bl.c > @@ -0,0 +1,235 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * Copyright (C) 2015-2019 Texas Instruments Incorporated - http://www.ti.com/ > + * Author: Tomi Valkeinen <tomi.valkeinen@ti.com> > + * > + * Based on pwm_bl.c > + */ > + > +#include <linux/backlight.h> > +#include <linux/gpio/consumer.h> Header should no longer be needed. > +static int led_bl_probe(struct platform_device *pdev) > +{ > + struct backlight_properties props; > + struct led_bl_data *priv; > + int ret; > + int i; > + > + priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); > + if (!priv) > + return -ENOMEM; > + > + platform_set_drvdata(pdev, priv); > + > + priv->dev = &pdev->dev; > + > + ret = led_bl_parse_dt(&pdev->dev, priv); > + if (ret < 0) { > + dev_err(&pdev->dev, "failed to parse DT data\n"); > + return ret; > + } > + priv->leds = devm_kzalloc(&pdev->dev, > + sizeof(struct led_classdev *) * priv->nb_leds, > + GFP_KERNEL); > + if (!priv->leds) > + return -ENOMEM; > + > + for (i = 0; i < priv->nb_leds; i++) { > + priv->leds[i] = devm_led_get(&pdev->dev, i); > + if (IS_ERR(priv->leds[i])) > + return PTR_ERR(priv->leds[i]); > + } > + > + memset(&props, 0, sizeof(struct backlight_properties)); > + props.type = BACKLIGHT_RAW; > + props.max_brightness = priv->max_brightness; > + priv->bl_dev = backlight_device_register(dev_name(&pdev->dev), > + &pdev->dev, priv, &led_bl_ops, &props); > + if (IS_ERR(priv->bl_dev)) { > + dev_err(&pdev->dev, "failed to register backlight\n"); > + ret = PTR_ERR(priv->bl_dev); > + goto err; goto is pointless for a pure-devm function. > + } > + > + priv->bl_dev->props.brightness = priv->default_brightness; > + backlight_update_status(priv->bl_dev); This will light up the backlight during backlight probe. Can you take a look at pwm_backlight_initial_power_state() and decide how much of it applies to an LED based backlight (the phandle stuff certainly does). Daniel. _______________________________________________ dri-devel mailing list dri-devel@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/dri-devel
WARNING: multiple messages have this Message-ID (diff)
From: Daniel Thompson <daniel.thompson@linaro.org> To: Jean-Jacques Hiblot <jjhiblot@ti.com> Cc: jacek.anaszewski@gmail.com, pavel@ucw.cz, robh+dt@kernel.org, mark.rutland@arm.com, lee.jones@linaro.org, jingoohan1@gmail.com, dmurphy@ti.com, linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, tomi.valkeinen@ti.com Subject: Re: [PATCH v2 4/4] backlight: add led-backlight driver Date: Tue, 9 Jul 2019 10:31:35 +0100 [thread overview] Message-ID: <20190709093135.ceuj5tszmuri52w2@holly.lan> (raw) Message-ID: <20190709093135.jaR0JoSQ2o9dbvw1xDhTgxNFx2RWjlbv4BVUDSJnIGM@z> (raw) In-Reply-To: <20190708102700.23138-5-jjhiblot@ti.com> On Mon, Jul 08, 2019 at 12:27:00PM +0200, Jean-Jacques Hiblot wrote: > From: Tomi Valkeinen <tomi.valkeinen@ti.com> > > This patch adds a led-backlight driver (led_bl), which is similar to > pwm_bl except the driver uses a LED class driver to adjust the > brightness in the HW. Multiple LEDs can be used for a single backlight. > > Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com> > Signed-off-by: Jean-Jacques Hiblot <jjhiblot@ti.com> > --- > drivers/video/backlight/Kconfig | 7 + > drivers/video/backlight/Makefile | 1 + > drivers/video/backlight/led_bl.c | 235 +++++++++++++++++++++++++++++++ > 3 files changed, 243 insertions(+) > create mode 100644 drivers/video/backlight/led_bl.c > diff --git a/drivers/video/backlight/led_bl.c b/drivers/video/backlight/led_bl.c > new file mode 100644 > index 000000000000..7644277cfdbb > --- /dev/null > +++ b/drivers/video/backlight/led_bl.c > @@ -0,0 +1,235 @@ > +// SPDX-License-Identifier: GPL-2.0 > +/* > + * Copyright (C) 2015-2019 Texas Instruments Incorporated - http://www.ti.com/ > + * Author: Tomi Valkeinen <tomi.valkeinen@ti.com> > + * > + * Based on pwm_bl.c > + */ > + > +#include <linux/backlight.h> > +#include <linux/gpio/consumer.h> Header should no longer be needed. > +static int led_bl_probe(struct platform_device *pdev) > +{ > + struct backlight_properties props; > + struct led_bl_data *priv; > + int ret; > + int i; > + > + priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); > + if (!priv) > + return -ENOMEM; > + > + platform_set_drvdata(pdev, priv); > + > + priv->dev = &pdev->dev; > + > + ret = led_bl_parse_dt(&pdev->dev, priv); > + if (ret < 0) { > + dev_err(&pdev->dev, "failed to parse DT data\n"); > + return ret; > + } > + priv->leds = devm_kzalloc(&pdev->dev, > + sizeof(struct led_classdev *) * priv->nb_leds, > + GFP_KERNEL); > + if (!priv->leds) > + return -ENOMEM; > + > + for (i = 0; i < priv->nb_leds; i++) { > + priv->leds[i] = devm_led_get(&pdev->dev, i); > + if (IS_ERR(priv->leds[i])) > + return PTR_ERR(priv->leds[i]); > + } > + > + memset(&props, 0, sizeof(struct backlight_properties)); > + props.type = BACKLIGHT_RAW; > + props.max_brightness = priv->max_brightness; > + priv->bl_dev = backlight_device_register(dev_name(&pdev->dev), > + &pdev->dev, priv, &led_bl_ops, &props); > + if (IS_ERR(priv->bl_dev)) { > + dev_err(&pdev->dev, "failed to register backlight\n"); > + ret = PTR_ERR(priv->bl_dev); > + goto err; goto is pointless for a pure-devm function. > + } > + > + priv->bl_dev->props.brightness = priv->default_brightness; > + backlight_update_status(priv->bl_dev); This will light up the backlight during backlight probe. Can you take a look at pwm_backlight_initial_power_state() and decide how much of it applies to an LED based backlight (the phandle stuff certainly does). Daniel.
next prev parent reply other threads:[~2019-07-09 9:31 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-07-08 10:26 [PATCH v2 0/4] Add a generic driver for LED-based backlight Jean-Jacques Hiblot 2019-07-08 10:26 ` Jean-Jacques Hiblot 2019-07-08 10:26 ` [PATCH v2 1/4] leds: Add of_led_get() and led_put() Jean-Jacques Hiblot 2019-07-08 10:26 ` Jean-Jacques Hiblot 2019-07-08 10:26 ` [PATCH v2 2/4] leds: Add managed API to get a LED from a device driver Jean-Jacques Hiblot 2019-07-08 10:26 ` Jean-Jacques Hiblot 2019-07-08 10:26 ` [PATCH v2 3/4] dt-bindings: backlight: Add led-backlight binding Jean-Jacques Hiblot 2019-07-08 10:26 ` Jean-Jacques Hiblot 2019-07-08 10:50 ` Daniel Thompson 2019-07-08 10:50 ` Daniel Thompson 2019-07-08 10:27 ` [PATCH v2 4/4] backlight: add led-backlight driver Jean-Jacques Hiblot 2019-07-08 10:27 ` Jean-Jacques Hiblot 2019-07-09 9:31 ` Daniel Thompson [this message] 2019-07-09 9:31 ` Daniel Thompson
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20190709093135.ceuj5tszmuri52w2@holly.lan \ --to=daniel.thompson@linaro.org \ --cc=dmurphy@ti.com \ --cc=dri-devel@lists.freedesktop.org \ --cc=jacek.anaszewski@gmail.com \ --cc=jingoohan1@gmail.com \ --cc=jjhiblot@ti.com \ --cc=lee.jones@linaro.org \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-leds@vger.kernel.org \ --cc=mark.rutland@arm.com \ --cc=pavel@ucw.cz \ --cc=robh+dt@kernel.org \ --cc=tomi.valkeinen@ti.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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).