From: Pavel Machek <pavel@ucw.cz>
To: Vadim Pasternak <vadimp@mellanox.com>
Cc: j.anaszewski@samsung.com, rpurdie@rpsys.net,
linux-leds@vger.kernel.org, lee.jones@linaro.org,
robh+dt@kernel.org, jiri@resnulli.us,
=jacek.anaszewski@gmail.com
Subject: Re: [patch v3 1/1] leds: add driver for support Mellanox regmap LEDs for BMC
Date: Wed, 2 Aug 2017 10:38:58 +0200 [thread overview]
Message-ID: <20170802083858.GA754@amd> (raw)
In-Reply-To: <1501518091-100730-2-git-send-email-vadimp@mellanox.com>
[-- Attachment #1: Type: text/plain, Size: 2278 bytes --]
Hi!
> Driver obtains LED devices according to system configuration and creates
> devices in form: "devicename:color:function", like
> The full path is to be:
> /sys/class/leds/mlxreg\:status\:amber/brightness
> After timer trigger activation:
> echo timer > /sys/class/leds/mlxreg\:status\:amber/trigger
> Attributes for LED blinking will appaer in sysfs infrastructure:
> /sys/class/leds/mlxreg\:status\:amber/delay_off
> /sys/class/leds/mlxreg\:status\:amber/delay_on
>
> LED setting is controlled through the on-board programmable devices,
> which exports its register map. This device could be attached to any
> bus type, for which register mapping is supported.
>
> Signed-off-by: Vadim Pasternak <vadimp@mellanox.com>
...
> +/* Codes for LEDs. */
> +#define MLXREG_LED_OFFSET_HALF 0x01 /* Offset from solid: 3Hz blink */
> +#define MLXREG_LED_OFFSET_FULL 0x02 /* Offset from solid: 6Hz
Can it do half brightness?
> + ret = regmap_read(pdata->regmap, led_pdata->led->reg, ®val);
> + if (ret < 0) {
> + dev_warn(led_pdata->led_cdev.dev, "Failed to get current brightness, error: %d\n",
> + ret);
> + /* Assume the LED is OFF */
> + ret = LED_OFF;
> + goto access_error;
Just "return LED_OFF;".
> + if (regval >= led_pdata->base_color &&
> + regval <= (led_pdata->base_color + MLXREG_LED_OFFSET_FULL))
> + ret = LED_FULL;
> + else
> + ret = LED_OFF;
Because it does not seem so here.
> + for (i = 0; i < pdata->counter; i++, data++) {
> + led_data = &pdata->data[i];
> + led_cdev = &led_data->led_cdev;
> + led_data->data_parent = priv;
> + if (strstr(data->label, "red")) {
> + brightness = LED_OFF;
> + led_data->base_color = MLXREG_LED_RED_SOLID;
> + } else if (strstr(data->label, "amber")) {
> + brightness = LED_OFF;
> + led_data->base_color = MLXREG_LED_AMBER_SOLID;
> + } else {
> + brightness = LED_OFF;
> + led_data->base_color = MLXREG_LED_GREEN_SOLID;
> + }
i don't know about the future, but you may check for "green"
substring, too? (Besides the fact that substring search is
"interesting"...)
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
next prev parent reply other threads:[~2017-08-02 8:39 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-07-31 16:21 [patch v3 0/1] Introduce support for mlxreg LED driver Vadim Pasternak
2017-07-31 16:21 ` [patch v3 1/1] leds: add driver for support Mellanox regmap LEDs for BMC Vadim Pasternak
2017-08-02 8:38 ` Pavel Machek [this message]
2017-08-02 9:16 ` Vadim Pasternak
2017-08-02 11:11 ` Pavel Machek
2017-08-02 18:13 ` Jacek Anaszewski
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=20170802083858.GA754@amd \
--to=pavel@ucw.cz \
--cc==jacek.anaszewski@gmail.com \
--cc=j.anaszewski@samsung.com \
--cc=jiri@resnulli.us \
--cc=lee.jones@linaro.org \
--cc=linux-leds@vger.kernel.org \
--cc=robh+dt@kernel.org \
--cc=rpurdie@rpsys.net \
--cc=vadimp@mellanox.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