Linux LED subsystem development
 help / color / mirror / Atom feed
From: Merlijn Wajer <merlijn@wizzup.org>
To: merlijn@wizzup.org
Cc: Ivaylo Dimitrov <ivo.g.dimitrov.75@gmail.com>,
	Dev Null <devnull@uvos.xyz>, Tony Lindgren <tony@atomide.com>,
	Sebastian Reichel <sre@kernel.org>, Pavel Machek <pavel@ucw.cz>,
	Doug Zobel <dougdev334@gmail.com>,
	Jacek Anaszewski <jacek.anaszewski@gmail.com>,
	Dan Murphy <dmurphy@ti.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/2] leds: lp55xx: initialise output direction from dts
Date: Sun, 12 Dec 2021 23:40:07 +0100	[thread overview]
Message-ID: <20211212224007.10293-3-merlijn@wizzup.org> (raw)
In-Reply-To: <20211212224007.10293-1-merlijn@wizzup.org>

Commit a5d3d1adc95f ("leds: lp55xx: Initialize enable GPIO direction to
output") attempts to fix this, but the fix did not work since at least
for the Nokia N900 the value needs to be set to HIGH, per the device
tree. So rather than hardcoding the value to a potentially invalid value
for some devices, let's set direction in lp55xx_init_device.

Fixes: a5d3d1adc95f ("leds: lp55xx: Initialize enable GPIO direction to output")
Fixes: 92a81562e695 ("leds: lp55xx: Add multicolor framework support to lp55xx")
Fixes: ac219bf3c9bd ("leds: lp55xx: Convert to use GPIO descriptors")
Signed-off-by: Merlijn Wajer <merlijn@wizzup.org>
---
 drivers/leds/leds-lp55xx-common.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/leds/leds-lp55xx-common.c b/drivers/leds/leds-lp55xx-common.c
index d1657c46ee2f..9fdfc1b9a1a0 100644
--- a/drivers/leds/leds-lp55xx-common.c
+++ b/drivers/leds/leds-lp55xx-common.c
@@ -439,6 +439,8 @@ int lp55xx_init_device(struct lp55xx_chip *chip)
 		return -EINVAL;
 
 	if (pdata->enable_gpiod) {
+		gpiod_direction_output(pdata->enable_gpiod, 0);
+
 		gpiod_set_consumer_name(pdata->enable_gpiod, "LP55xx enable");
 		gpiod_set_value(pdata->enable_gpiod, 0);
 		usleep_range(1000, 2000); /* Keep enable down at least 1ms */
@@ -694,7 +696,7 @@ struct lp55xx_platform_data *lp55xx_of_populate_pdata(struct device *dev,
 	of_property_read_u8(np, "clock-mode", &pdata->clock_mode);
 
 	pdata->enable_gpiod = devm_gpiod_get_optional(dev, "enable",
-						      GPIOD_OUT_LOW);
+						      GPIOD_ASIS);
 	if (IS_ERR(pdata->enable_gpiod))
 		return ERR_CAST(pdata->enable_gpiod);
 
-- 
2.32.0


  reply	other threads:[~2021-12-12 23:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-12-12 22:40 [PATCH 0/2] Fix RGB status LED and keyboard backlight LEDs on Nokia N900 Merlijn Wajer
2021-12-12 22:40 ` Merlijn Wajer [this message]
2021-12-12 23:59   ` [PATCH 2/2] leds: lp55xx: initialise output direction from dts Linus Walleij
2021-12-15 20:32 ` [PATCH 0/2] Fix RGB status LED and keyboard backlight LEDs on Nokia N900 Pavel Machek
2021-12-16 11:51   ` Merlijn Wajer

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=20211212224007.10293-3-merlijn@wizzup.org \
    --to=merlijn@wizzup.org \
    --cc=devnull@uvos.xyz \
    --cc=dmurphy@ti.com \
    --cc=dougdev334@gmail.com \
    --cc=ivo.g.dimitrov.75@gmail.com \
    --cc=jacek.anaszewski@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-leds@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=sre@kernel.org \
    --cc=tony@atomide.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: link
Be 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