From: Vadim Pasternak <vadimp@mellanox.com>
To: Pavel Machek <pavel@ucw.cz>
Cc: "j.anaszewski@samsung.com" <j.anaszewski@samsung.com>,
"rpurdie@rpsys.net" <rpurdie@rpsys.net>,
"linux-leds@vger.kernel.org" <linux-leds@vger.kernel.org>,
"lee.jones@linaro.org" <lee.jones@linaro.org>,
"robh+dt@kernel.org" <robh+dt@kernel.org>,
"jiri@resnulli.us" <jiri@resnulli.us>,
"=jacek.anaszewski@gmail.com" <=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 09:16:57 +0000 [thread overview]
Message-ID: <AM4PR05MB33304B09E2DACFBA55BABD1FA2B00@AM4PR05MB3330.eurprd05.prod.outlook.com> (raw)
In-Reply-To: <20170802083858.GA754@amd>
> -----Original Message-----
> From: Pavel Machek [mailto:pavel@ucw.cz]
> Sent: Wednesday, August 02, 2017 11:39 AM
> 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
>
> Hi!
Hi Pavel,
Thank you for review.
Would it be possible to review alos [patch v2 1/2] mfd: Add Mellanox regmap core driver , which is after applying you comments for v1?
>
> > 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?
This is about blinking frequency. Hardware support 6 hz blinking mode and 3hz blinking mode.
If solid orange f.e. has bit mask 1100, setting 1101 or 1110 will blink orange with 3 or 6 KHz.
>
> > + 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;".
ACK
>
> > + 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"...)
OK
>
> Pavel
> --
> (english) http://www.livejournal.com/~pavelmachek
> (cesky, pictures)
> http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
next prev parent reply other threads:[~2017-08-02 9:17 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
2017-08-02 9:16 ` Vadim Pasternak [this message]
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=AM4PR05MB33304B09E2DACFBA55BABD1FA2B00@AM4PR05MB3330.eurprd05.prod.outlook.com \
--to=vadimp@mellanox.com \
--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=pavel@ucw.cz \
--cc=robh+dt@kernel.org \
--cc=rpurdie@rpsys.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.