From: Pavel Machek <pavel@ucw.cz>
To: "Rafał Miłecki" <zajec5@gmail.com>
Cc: "Rob Herring" <robh+dt@kernel.org>,
linux-leds@vger.kernel.org, devicetree@vger.kernel.org,
"Florian Fainelli" <f.fainelli@gmail.com>,
linux-arm-kernel@lists.infradead.org,
bcm-kernel-feedback-list@broadcom.com,
"Rafał Miłecki" <rafal@milecki.pl>
Subject: Re: [PATCH V2 2/2] leds: bcm63xxx: add support for BCM63138 controller
Date: Wed, 15 Dec 2021 21:26:16 +0100 [thread overview]
Message-ID: <20211215202616.GB28336@duo.ucw.cz> (raw)
In-Reply-To: <20211124111952.22419-2-zajec5@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1733 bytes --]
Hi!
> It's a new controller first introduced in BCM63138 SoC. Later it was
> also used in BCM4908, some BCM68xx and some BCM63xxx SoCs.
>
> diff --git a/drivers/leds/Kconfig b/drivers/leds/Kconfig
> index ed800f5da7d8..3bde795f0951 100644
> --- a/drivers/leds/Kconfig
Lets put it into drivers/leds/blink/, please.
> --- /dev/null
> +++ b/drivers/leds/leds-bcm63138.c
> @@ -0,0 +1,314 @@
> +#define BCM63138_LED_BITS 4 /* how many bits control a single LED */
> +#define BCM63138_LED_MASK ((1 << BCM63138_LED_BITS) - 1) /* 0xf */
> +#define BCM63138_LEDS_PER_REG (32 / BCM63138_LED_BITS) /* 8 */
I'm not sure these kinds of defines are useful.
> +static void bcm63138_leds_create_led(struct bcm63138_leds *leds,
> + struct device_node *np)
> +{
> + struct led_init_data init_data = {
> + .fwnode = of_fwnode_handle(np),
> + };
> + struct device *dev = leds->dev;
> + struct bcm63138_led *led;
> + struct pinctrl *pinctrl;
> + const char *state;
> + u32 bit;
> + int err;
> +
> + led = devm_kzalloc(dev, sizeof(*led), GFP_KERNEL);
> + if (!led)
> + return;
At least warn. User wants to know why his leds don't work.
> + if (!of_property_read_string(np, "default-state", &state)) {
> + if (!strcmp(state, "on"))
> + led->cdev.brightness = LED_FULL;
> + else
> + led->cdev.brightness = LED_OFF;
> + } else {
> + led->cdev.brightness = LED_OFF;
> + }
Do you actually need default-state support? Just remove it if not.
You support 4 bit brightness. You should set max_brightness to
15. LED_FULL is mistake (or very old API) in your case.
Otherwise looks quite sane.
Thank you,
Pavel
--
http://www.livejournal.com/~pavelmachek
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 195 bytes --]
next prev parent reply other threads:[~2021-12-15 20:26 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-24 11:19 [PATCH V2 1/2] dt-bindings: leds: add Broadcom's BCM63138 controller Rafał Miłecki
2021-11-24 11:19 ` [PATCH V2 2/2] leds: bcm63xxx: add support for " Rafał Miłecki
2021-12-14 3:41 ` Florian Fainelli
2021-12-15 20:26 ` Pavel Machek [this message]
2021-12-15 20:36 ` Rafał Miłecki
2021-11-30 22:40 ` [PATCH V2 1/2] dt-bindings: leds: add Broadcom's " Rob Herring
2021-12-14 3:41 ` Florian Fainelli
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=20211215202616.GB28336@duo.ucw.cz \
--to=pavel@ucw.cz \
--cc=bcm-kernel-feedback-list@broadcom.com \
--cc=devicetree@vger.kernel.org \
--cc=f.fainelli@gmail.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-leds@vger.kernel.org \
--cc=rafal@milecki.pl \
--cc=robh+dt@kernel.org \
--cc=zajec5@gmail.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;
as well as URLs for NNTP newsgroup(s).