Re: [PATCH] platform/chrome: Add Wilco EC keyboard backlight LEDs support

From: Nick Crews
Date: Tue Mar 12 2019 - 12:05:56 EST


> > > 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.
> >
> > It would be even better if we did not register platform device if EC
> > does not support backlight.

Good point Dmitry. I would imagine this would entail exposing the
keyboard_leds_exist() function. What is the best practice for doing that?
I could either imagine EXPORT_SYMBOL_GPL()ing that function, but
that would require making the core driver dependent upon this keyboard
backlight driver in a circular dependency, so there would have to be some
refactoring. The other option I see would be to add this entire driver to
the core module.

Just so I learn something, I don't see performance or stability
concerns with adding one unused platform device, is your rationale
that it would just be cleaner code?

> >
> > > + data->led.brightness_set = keyboard_led_set_brightness;
> > > + data->led.brightness_get = keyboard_led_get_brightness;
> >
> > wilco_ec_mailbox() may sleep, so you need to assign it to
> > led.brightness_set_blocking.

Yes, thanks for the catch.

>
> Hmm. Seeing get method there... can the EC change the brightness
> without command from kernel?

No, the EC will never do that, good point. Therefore it looks like
I can just remove the get_brightness() function and the core
library will do the right thing.

Thanks,
Nick