From: Nick Crews <ncrews@chromium.org>
To: Pavel Machek <pavel@ucw.cz>
Cc: Enric Balletbo i Serra <enric.balletbo@collabora.com>,
Benson Leung <bleung@chromium.org>,
linux-leds@vger.kernel.org, jacek.anaszewski@gmail.com,
linux-kernel <linux-kernel@vger.kernel.org>,
Duncan Laurie <dlaurie@chromium.org>,
Daniel Erat <derat@google.com>, Guenter Roeck <groeck@google.com>,
Dmitry Torokhov <dtor@google.com>
Subject: Re: [PATCH] platform/chrome: Add Wilco EC keyboard backlight LEDs support
Date: Mon, 11 Mar 2019 09:29:06 -0600 [thread overview]
Message-ID: <CAHX4x85=_76=Kyepf3Nw++4yVKOZujhLsonzaicZOnY5fi-Pfw@mail.gmail.com> (raw)
In-Reply-To: <20190308210843.GA16125@amd>
Thanks for looking this over. I will fix most of your concerns, but
have one question.
On Fri, Mar 8, 2019 at 2:08 PM Pavel Machek <pavel@ucw.cz> wrote:
>
> On Fri 2019-03-08 13:38:02, Nick Crews wrote:
> > This patch is meant to be applied on top of the for-next
> > branch of the platform/chrome repository, as it uses some of
> > the code staged there.
> >
> > The EC is in charge of controlling the keyboard backlight on
> > the Wilco platform. We expose a standard LED class device at
> > /sys/class/leds/wilco::kbd_backlight. This driver is modeled
> > after the standard Chrome OS keyboard backlight driver at
> > drivers/platform/chrome/cros_kbd_led_backlight.c
>
> Can you make it "platform::kbd_backlight"? We want some consistency
> there.
The analogous name in the standard driver
drivers/platform/chrome/cros_kbd_led_backlight.c is
"chromeos::kbd_backlight", and I thought "wilco" was a better
substitute for "chromeos" than "platform" would be. What other thing
are you saying "platform" would be consistent with?
>
> > Some Wilco devices do not support a keyboard backlight. This
> > is checked in probe(), and in this case the sysfs entry will
> > not appear, and everything will behave normally.
>
> Good.
>
> > When the EC is reset (loses all AC and battery power), it will
> > restart in some unpredictable state. The brightness on the
> > keyboard could be anything, and reading the brightness
> > from the EC is undefined behavior. Therefore, at startup the
> > brightness should be set, and then everything will work.
>
> Really? Undefined behavior?
By undefined I guess I meant "not conforming with the schema
that Chrome OS normally uses." The EC begins in non-PWM mode,
so while it may behave consistently, it doesn't behave as the rest of
Chrome OS expects. I think the solution is going to be to hard-code in
setting the brightness to 0 at probe(), and then everything should be
in a consistent state.
>
> > index e09e4cebe9b4..15b56f5ce090 100644
> > --- a/drivers/platform/chrome/wilco_ec/Kconfig
> > +++ b/drivers/platform/chrome/wilco_ec/Kconfig
> > @@ -18,3 +18,12 @@ config WILCO_EC_DEBUGFS
> > manipulation and allow for testing arbitrary commands. This
> > interface is intended for debug only and will not be present
> > on production devices.
> > +
> > +config WILCO_EC_KBD_BACKLIGHT
> > + tristate "Enable keyboard led backlight control"
>
> Delete "led" or make it "LED".
>
> > + depends on WILCO_EC
> > + help
> > + If you say Y here, you get support to set the keyboard backlight led
>
> Same here.
>
> > +#define DRV_NAME "wilco-kbd-backlight"
> > +
> > +#define EC_COMMAND_KB_BKLIGHT 0x75
> > +#define KBBL_MSG_SIZE 16
> > +/* The EC can set the backlight brightness in several different modes.
> > +The mode we care about is PWM mode, where we separately supply a
> > +literal percentage to set the brightness to. We need to set the proper
> > +KBBL_PWM_MODE flag in the KBBL_MODE_INDEX-th byte in the message, and
> > +then supply the percentage within the KBBL_BRIGHTNESS_INDEX-th byte
> > +within the message. When we read the brightness, the percentage is
> > +returned in this same byte location. */
>
> Please use comment style specified in CodingStyle.
>
> Best regards,
> Pavel
Cheers,
Nick
next prev parent reply other threads:[~2019-03-11 15:29 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-08 20:38 [PATCH] platform/chrome: Add Wilco EC keyboard backlight LEDs support Nick Crews
2019-03-08 21:08 ` Pavel Machek
2019-03-11 15:29 ` Nick Crews [this message]
2019-04-04 11:24 ` Pavel Machek
2019-04-04 14:11 ` Nick Crews
2019-04-04 16:13 ` Dmitry Torokhov
2019-04-04 19:03 ` Pavel Machek
2019-04-04 19:09 ` Dmitry Torokhov
2019-04-04 19:23 ` Pavel Machek
2019-04-04 20:07 ` Dmitry Torokhov
2019-04-04 20:11 ` Pavel Machek
2019-04-04 20:22 ` Dmitry Torokhov
2019-04-04 20:34 ` Pavel Machek
2019-03-08 22:01 ` Dmitry Torokhov
2019-03-08 22:13 ` Pavel Machek
2019-03-12 16:05 ` Nick Crews
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='CAHX4x85=_76=Kyepf3Nw++4yVKOZujhLsonzaicZOnY5fi-Pfw@mail.gmail.com' \
--to=ncrews@chromium.org \
--cc=bleung@chromium.org \
--cc=derat@google.com \
--cc=dlaurie@chromium.org \
--cc=dtor@google.com \
--cc=enric.balletbo@collabora.com \
--cc=groeck@google.com \
--cc=jacek.anaszewski@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--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).