linux-leds.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Sicelo <absicsz@gmail.com>
To: linux-leds@vger.kernel.org
Cc: Pavel Machek <pavel@ucw.cz>
Subject: lp5523/lp5xx-common : Keyboard and RGB LEDs Not Working on Nokia N900
Date: Tue, 13 Apr 2021 19:02:26 +0200	[thread overview]
Message-ID: <YHXOotfNMEdG9oXQ@tp440p.steeds.sam> (raw)

Hi

For some time now, the keyboard LEDs on Nokia N900 have not been
working. In dmesg is the error:
  
    lp5523x probe of 2-0032 failed with error -22

and consequently they do not get populated under /sys/class/leds.

I have finally had time to look into this, and found that the N900 dts
falls short of the current lp55xx binding specs. I have updated it and
will be submitting a separate patch. However, this was not enough to
make them work, and a new error appeared:

    [11363.247375] lp5523x 2-0032: GPIO lookup for consumer enable
    [11363.254394] lp5523x 2-0032: using device tree for GPIO lookup
    [11363.254455] of_get_named_gpiod_flags: can't parse 'enable-gpios' property of node '/ocp@68000000/i2c@48072000/lp5523@32[0]'
    [11363.254547] of_get_named_gpiod_flags: parsed 'enable-gpio' property of node '/ocp@68000000/i2c@48072000/lp5523@32[0]' - status (0)
    [11363.254638] gpio gpiochip1: Persistence not supported for GPIO 9
    [11363.254669] gpio-41 (enable): no flags found for enable
    [11363.295959] lp5523x 2-0032: device detection err: -121
    [11363.303710] lp5523x: probe of 2-0032 failed with error -121


This is because the chip does not get enabled even though dts contains:

    enable-gpios = <&gpio2 9 GPIO_ACTIVE_HIGH>; /* 41 */

which is correct for this board.


I came up with this patch (against 5.12-rc6), which makes it work again.


diff --git a/drivers/leds/leds-lp55xx-common.c b/drivers/leds/leds-lp55xx-common.c
index 81de1346bf5d..9af84fc335b3 100644
--- a/drivers/leds/leds-lp55xx-common.c
+++ b/drivers/leds/leds-lp55xx-common.c
@@ -694,7 +694,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_ASIS);
+                                                     GPIOD_OUT_HIGH);
        if (IS_ERR(pdata->enable_gpiod))
                return ERR_CAST(pdata->enable_gpiod);


However, I am not sure if this is a proper way to fix the issue, or if
it is a dirty hack. It looks like all the chips handled by this driver
(lp5521, lp5523, lp5562, and lp8501) get enabled by pulling their ENable
pin high, so I suppose it is fine, but would like to get some feedback
before submitting a cleaned up patch. It is also possible that this
should be defined via dts elsewhere, although at this point I am not
sure how.

Looking forward to your help.

Sincerely
Sicelo

             reply	other threads:[~2021-04-13 17:02 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-13 17:02 Sicelo [this message]
2021-04-25 13:59 ` lp5523/lp5xx-common : Keyboard and RGB LEDs Not Working on Nokia N900 Sicelo
2021-08-04 15:59   ` Pavel Machek

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=YHXOotfNMEdG9oXQ@tp440p.steeds.sam \
    --to=absicsz@gmail.com \
    --cc=linux-leds@vger.kernel.org \
    --cc=pavel@ucw.cz \
    /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;
as well as URLs for NNTP newsgroup(s).