platform/chrome: Add Wilco EC keyboard backlight LEDs support
Subsystems (2)
PATCH 1/1 platform/chrome: Add Wilco EC keyboard backlight LEDs support
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
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.
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.
--- drivers/platform/chrome/wilco_ec/Kconfig | 9 + drivers/platform/chrome/wilco_ec/Makefile | 2 + drivers/platform/chrome/wilco_ec/core.c | 14 ++ .../chrome/wilco_ec/kbd_led_backlight.c | 191 ++++++++++++++++++ include/linux/platform_data/wilco-ec.h | 2 + 5 files changed, 218 insertions(+) create mode 100644 drivers/platform/chrome/wilco_ec/kbd_led_backlight.c
drivers/platform/chrome/wilco_ec/Kconfig +9 -0
@@ -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" + depends on WILCO_EC + help + If you say Y here, you get support to set the keyboard backlight led + brightness. This happens via a standard LED driver that uses the + Wilco EC mailbox interface. A standard led class device will + appear under /sys/class/leds/wilco::kbd_backlight
drivers/platform/chrome/wilco_ec/Makefile +2 -0
@@ -4,3 +4,5 @@ wilco_ec-objs := core.o mailbox.o obj-$(CONFIG_WILCO_EC) += wilco_ec.o wilco_ec_debugfs-objs := debugfs.o obj-$(CONFIG_WILCO_EC_DEBUGFS) += wilco_ec_debugfs.o +wilco_kbd_backlight-objs := kbd_led_backlight.o +obj-$(CONFIG_WILCO_EC_KBD_BACKLIGHT) += wilco_kbd_backlight.o
drivers/platform/chrome/wilco_ec/core.c +14 -0
@@ -89,8 +89,21 @@ static int wilco_ec_probe(struct platform_device *pdev) goto unregister_debugfs; } +/* Register child dev to be found by the keyboard backlight driver. */ + ec->kbbl_pdev =platform_device_register_data (dev, +"wilco-kbd-backlight" , +PLATFORM_DEVID_AUTO , +NULL ,0 ); +if (IS_ERR (ec->kbbl_pdev)) { +dev_err (dev,"Failed to create keyboard backlight pdev\n" ); + ret =PTR_ERR (ec->kbbl_pdev); + goto unregister_rtc; + } +return 0 ; +unregister_rtc: +platform_device_unregister (ec->rtc_pdev); unregister_debugfs:if (ec->debugfs_pdev)platform_device_unregister (ec->debugfs_pdev);
@@ -102,6 +115,7 @@ static int wilco_ec_remove(struct platform_device *pdev) {struct wilco_ec_device *ec =platform_get_drvdata (pdev); +platform_device_unregister (ec->kbbl_pdev);platform_device_unregister (ec->rtc_pdev);if (ec->debugfs_pdev)platform_device_unregister (ec->debugfs_pdev);
drivers/platform/chrome/wilco_ec/kbd_led_backlight.c new file +191 -0
191 lines not on this page · raw message
include/linux/platform_data/wilco-ec.h +2 -0
@@ -36,6 +36,7 @@* @data_size: Size of the data buffer used for EC communication. * @debugfs_pdev: The child platform_device used by the debugfs sub-driver. * @rtc_pdev: The child platform_device used by the RTC sub-driver. +* @kbbl_pdev: The child pdev used by the keyboard backlight sub-driver. */ struct wilco_ec_device {struct device *dev;
@@ -47,6 +48,7 @@ struct wilco_ec_device {size_t data_size;struct platform_device *debugfs_pdev;struct platform_device *rtc_pdev; +struct platform_device *kbbl_pdev; };/**
Signature · 1 line
2.20.1
Quoted 9 lines · Nick Crews
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.
Quoted 3 lines
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.
Quoted 5 lines
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?
drivers/platform/chrome/wilco_ec/Kconfig config WILCO_EC_DEBUGFS · line 23
Quoted 10 lines
index
e09e4cebe9b4..15b56f5ce090100644drivers/platform/chrome/wilco_ec/Kconfig +3
-0@@ -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".
drivers/platform/chrome/wilco_ec/Kconfig config WILCO_EC_DEBUGFS · line 26
Quoted 3 lines
drivers/platform/chrome/wilco_ec/Kconfig +3
-0+ depends on WILCO_EC + help + If you say Y here, you get support to set the keyboard backlight led
Same here.
drivers/platform/chrome/wilco_ec/Kconfig config WILCO_EC_DEBUGFS
Quoted 11 lines
drivers/platform/chrome/wilco_ec/Kconfig +11
-0+#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
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Thanks for looking this over. I will fix most of your concerns, but have one question.
Quoted 6 lines · Pavel Machek
Quoted 4 lines · Nick Crews
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.
Quoted 8 lines
Quoted 5 lines
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.cCan 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?
Quoted 7 lines
Quoted 4 lines
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.
Quoted 7 lines
Quoted 5 lines
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.
Quoted 34 lines
drivers/platform/chrome/wilco_ec/Kconfig config WILCO_EC_DEBUGFS · line 23
Quoted 11 lines
index
e09e4cebe9b4..15b56f5ce090100644drivers/platform/chrome/wilco_ec/Kconfig +3
-0@@ -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".
drivers/platform/chrome/wilco_ec/Kconfig config WILCO_EC_DEBUGFS · line 26
Quoted 3 lines
drivers/platform/chrome/wilco_ec/Kconfig +3
-0+ depends on WILCO_EC + help + If you say Y here, you get support to set the keyboard backlight ledSame here.
drivers/platform/chrome/wilco_ec/Kconfig config WILCO_EC_DEBUGFS
Quoted 11 lines
drivers/platform/chrome/wilco_ec/Kconfig +11
-0+#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.
Quoted 2 lines
Best regards,
Pavel
Cheers,
Nick
Quoted 16 lines · Nick Crews
Thanks for looking this over. I will fix most of your concerns, but have one question.
Quoted 12 lines · Pavel Machek
Quoted 9 lines · Nick Crews
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
Quoted 8 lines
Quoted 2 lines
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.cis "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?
Yeah, well, we not let the cros_kbd_led_backlight.c use chromeos:: in the first place. But it happened. We want all backlights for the system keyboard to use common name, and "chromeos" is not really suitable for that. "platform" is.
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 27 lines · Pavel Machek
Quoted 16 lines · Nick Crews
Thanks for looking this over. I will fix most of your concerns, but have one question.
Quoted 12 lines · Pavel Machek
Quoted 9 lines · Nick Crews
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.cQuoted 8 lines
Quoted 2 lines
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.cis "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?
Quoted 6 lines
Yeah, well, we not let the
cros_kbd_led_backlight.cuse chromeos:: in the first place. But it happened. We want all backlights for the system keyboard to use common name, and "chromeos" is not really suitable for that. "platform" is.Pavel
That reasoning makes sense Pavel. I don't think we care that much about what the prefix actually is. The userspace daemon only looks for something that matches "*:kbd_backlight". Therefore, I think we should change both of these to use "platform::kbd_backlight". Enric agrees with me here, any other concerns? If I don't hear anything I'll add that change to this patch as well and re-send it.
Thanks,
Nick
Quoted 27 lines · Pavel Machek
Quoted 16 lines · Nick Crews
Thanks for looking this over. I will fix most of your concerns, but have one question.
Quoted 12 lines · Pavel Machek
Quoted 9 lines · Nick Crews
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.cQuoted 8 lines
Quoted 2 lines
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.cis "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?
Quoted 4 lines
Yeah, well, we not let the
cros_kbd_led_backlight.cuse chromeos:: in the first place. But it happened. We want all backlights for the system keyboard to use common name, and "chromeos" is not really suitable for that. "platform" is.
Pavel, who exactly wants this and why? Looking at today's -next I see:
dtor@dtor-ws:~/kernel/linux-next ((next-20190404))$ git grep "::kbd_backlight" | wc -l
18
dtor@dtor-ws:~/kernel/linux-next ((next-20190404))$ git grep "platform::kbd_backlight" | wc -l
0
so there isn't a single instance of "platform::kbd_backlight" and we definitely not changing existing names.
Thanks.
Signature · 1 line
Dmitry
Quoted 42 lines · Dmitry Torokhov
Quoted 27 lines · Pavel Machek
Quoted 16 lines · Nick Crews
Thanks for looking this over. I will fix most of your concerns, but have one question.
Quoted 12 lines · Pavel Machek
Quoted 9 lines · Nick Crews
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.cQuoted 8 lines
Quoted 2 lines
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.cis "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?Quoted 4 lines
Yeah, well, we not let the
cros_kbd_led_backlight.cuse chromeos:: in the first place. But it happened. We want all backlights for the system keyboard to use common name, and "chromeos" is not really suitable for that. "platform" is.Pavel, who exactly wants this and why? Looking at today's -next I see:
dtor@dtor-ws:~/kernel/linux-next ((next-20190404))$ git grep "::kbd_backlight" | wc -l
18
dtor@dtor-ws:~/kernel/linux-next ((next-20190404))$ git grep "platform::kbd_backlight" | wc -l
0
Quoted 2 lines
so there isn't a single instance of "
platform::kbd_backlight" and we definitely not changing existing names.
Yeah, we made mistakes in the past. We _don't_ want userspace to have ever growing list of names for userspace to follow.
Backlight of internal keyboard is pretty common concept and there should be one name for it.
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 44 lines · Pavel Machek
Quoted 42 lines · Dmitry Torokhov
Quoted 27 lines · Pavel Machek
Quoted 16 lines · Nick Crews
Thanks for looking this over. I will fix most of your concerns, but have one question.
Quoted 12 lines · Pavel Machek
Quoted 9 lines · Nick Crews
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.cQuoted 8 lines
Quoted 2 lines
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.cis "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?Quoted 4 lines
Yeah, well, we not let the
cros_kbd_led_backlight.cuse chromeos:: in the first place. But it happened. We want all backlights for the system keyboard to use common name, and "chromeos" is not really suitable for that. "platform" is.Pavel, who exactly wants this and why? Looking at today's -next I see:
dtor@dtor-ws:~/kernel/linux-next ((next-20190404))$ git grep "::kbd_backlight" | wc -l
18
dtor@dtor-ws:~/kernel/linux-next ((next-20190404))$ git grep "platform::kbd_backlight" | wc -l
0
Quoted 8 lines
Quoted 2 lines
so there isn't a single instance of "
platform::kbd_backlight" and we definitely not changing existing names.Yeah, we made mistakes in the past. We _don't_ want userspace to have ever growing list of names for userspace to follow.
Backlight of internal keyboard is pretty common concept and there should be one name for it.
It is the *function* that is interesting to userspace, not full name, and we have proper standardization there.
I think before you demand changes in the drivers you need to get you naming scheme get accepted into mainline (Documentation/leds/leds-class.txt).
Thanks.
Signature · 1 line
Dmitry
Hi!
Quoted 17 lines
Quoted 17 lines
Quoted 16 lines
Quoted 4 lines
Yeah, well, we not let the
cros_kbd_led_backlight.cuse chromeos:: in the first place. But it happened. We want all backlights for the system keyboard to use common name, and "chromeos" is not really suitable for that. "platform" is.Pavel, who exactly wants this and why? Looking at today's -next I see:
dtor@dtor-ws:~/kernel/linux-next ((next-20190404))$ git grep "::kbd_backlight" | wc -l
18
dtor@dtor-ws:~/kernel/linux-next ((next-20190404))$ git grep "platform::kbd_backlight" | wc -l
0so there isn't a single instance of "
platform::kbd_backlight" and we definitely not changing existing names.
Quoted 8 lines
Quoted 5 lines
Yeah, we made mistakes in the past. We _don't_ want userspace to have ever growing list of names for userspace to follow.
Backlight of internal keyboard is pretty common concept and there should be one name for it.
It is the *function* that is interesting to userspace, not full name, and we have proper standardization there.
Well, if full name is not interesting, as you argue, why do we have this discussion?
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 23 lines · Pavel Machek
Hi!
Quoted 20 lines
Quoted 20 lines
Quoted 14 lines
Quoted 4 lines
Yeah, well, we not let the
cros_kbd_led_backlight.cuse chromeos:: in the first place. But it happened. We want all backlights for the system keyboard to use common name, and "chromeos" is not really suitable for that. "platform" is.Pavel, who exactly wants this and why? Looking at today's -next I see:
dtor@dtor-ws:~/kernel/linux-next ((next-20190404))$ git grep "::kbd_backlight" | wc -l
18
dtor@dtor-ws:~/kernel/linux-next ((next-20190404))$ git grep "platform::kbd_backlight" | wc -l
0Quoted 2 lines
so there isn't a single instance of "
platform::kbd_backlight" and we definitely not changing existing names.Yeah, we made mistakes in the past. We _don't_ want userspace to have ever growing list of names for userspace to follow.
Quoted 8 lines
Quoted 5 lines
Quoted 2 lines
Backlight of internal keyboard is pretty common concept and there should be one name for it.
It is the *function* that is interesting to userspace, not full name, and we have proper standardization there.
Well, if full name is not interesting, as you argue, why do we have this discussion?
Because I need to understand why you believe that device name for kbd_backlight matters, and having wilco::kbd_backlight is a bad idea, but, for example, having max77650::kbd_backlight is perfectly fine if somebody decided to wire it in this way.
Thanks.
Signature · 1 line
Dmitry
Quoted 30 lines · Dmitry Torokhov
Quoted 29 lines · Pavel Machek
Hi!
Quoted 25 lines
Quoted 14 lines
Quoted 14 lines
Quoted 4 lines
Yeah, well, we not let the
cros_kbd_led_backlight.cuse chromeos:: in the first place. But it happened. We want all backlights for the system keyboard to use common name, and "chromeos" is not really suitable for that. "platform" is.Pavel, who exactly wants this and why? Looking at today's -next I see:
dtor@dtor-ws:~/kernel/linux-next ((next-20190404))$ git grep "::kbd_backlight" | wc -l
18
dtor@dtor-ws:~/kernel/linux-next ((next-20190404))$ git grep "platform::kbd_backlight" | wc -l
0Quoted 8 lines
Quoted 2 lines
so there isn't a single instance of "
platform::kbd_backlight" and we definitely not changing existing names.Yeah, we made mistakes in the past. We _don't_ want userspace to have ever growing list of names for userspace to follow.
Backlight of internal keyboard is pretty common concept and there should be one name for it.
It is the *function* that is interesting to userspace, not full name, and we have proper standardization there.
Quoted 7 lines
Quoted 2 lines
Well, if full name is not interesting, as you argue, why do we have this discussion?
Because I need to understand why you believe that device name for
kbd_backlightmatters, and havingwilco::kbd_backlightis a bad idea, but, for example, havingmax77650::kbd_backlightis perfectly fine if somebody decided to wire it in this way.
max77650::kbd_backlight is not fine and we'll try to prevent that in future.
We want one name for internal keyboard backlight. What exactly that name is is not _that_ important, but platform::kbd_backlight seems like reasonable choice.
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 35 lines · Pavel Machek
Quoted 33 lines · Dmitry Torokhov
Quoted 31 lines · Pavel Machek
Hi!
Quoted 17 lines
Quoted 17 lines
Quoted 16 lines
Quoted 4 lines
Yeah, well, we not let the
cros_kbd_led_backlight.cuse chromeos:: in the first place. But it happened. We want all backlights for the system keyboard to use common name, and "chromeos" is not really suitable for that. "platform" is.Pavel, who exactly wants this and why? Looking at today's -next I see:
dtor@dtor-ws:~/kernel/linux-next ((next-20190404))$ git grep "::kbd_backlight" | wc -l
18
dtor@dtor-ws:~/kernel/linux-next ((next-20190404))$ git grep "platform::kbd_backlight" | wc -l
0so there isn't a single instance of "
platform::kbd_backlight" and we definitely not changing existing names.Quoted 8 lines
Quoted 5 lines
Yeah, we made mistakes in the past. We _don't_ want userspace to have ever growing list of names for userspace to follow.
Backlight of internal keyboard is pretty common concept and there should be one name for it.
It is the *function* that is interesting to userspace, not full name, and we have proper standardization there.
Well, if full name is not interesting, as you argue, why do we have this discussion?
Quoted 7 lines
Quoted 4 lines
Because I need to understand why you believe that device name for
kbd_backlightmatters, and havingwilco::kbd_backlightis a bad idea, but, for example, havingmax77650::kbd_backlightis perfectly fine if somebody decided to wire it in this way.
max77650::kbd_backlightis not fine and we'll try to prevent that in future.
You do not control DTS for systems though.
Quoted 4 lines
We want one name for internal keyboard backlight. What exactly that name is is not _that_ important, but
platform::kbd_backlightseems like reasonable choice.
And I am trying to show that depending on device and product (as in entire computing device) the same driver could be used in multitude of ways and expecting that all devices that can be internal will always have "platform::" prefix is not realistic. It will also fail if you have multiples of devices, as you need unique names, and that is what <device> component in name provides you with.
You need smarter userspace to implement policy that is best suited for your product. Maybe you can help it by adding additional properties to LED devices, like we have connection_type in USB ports, to tell whether device is internal or not, but I'd leave the naming alone.
Thanks.
Signature · 1 line
Dmitry
Hi!
Quoted 9 lines
Quoted 7 lines
Quoted 4 lines
Because I need to understand why you believe that device name for
kbd_backlightmatters, and havingwilco::kbd_backlightis a bad idea, but, for example, havingmax77650::kbd_backlightis perfectly fine if somebody decided to wire it in this way.
max77650::kbd_backlightis not fine and we'll try to prevent that in future.You do not control DTS for systems though.
Actually we usually do. [And the name can still be fixed up in the driver.]
Quoted 10 lines
Quoted 3 lines
We want one name for internal keyboard backlight. What exactly that name is is not _that_ important, but
platform::kbd_backlightseems like reasonable choice.And I am trying to show that depending on device and product (as in entire computing device) the same driver could be used in multitude of ways and expecting that all devices that can be internal will always have "platform::" prefix is not realistic. It will also fail if you have multiples of devices, as you need unique names, and that is what <device> component in name provides you with.
I don't see what you are saying.
We know that wilco::kbd_backlight is always internal keyboard backlight, so we name it platform::kbd_backlight. We do the same for similar drivers in future. I don't see any downsides.
Quoted 4 lines
You need smarter userspace to implement policy that is best suited for your product. Maybe you can help it by adding additional properties to LED devices, like we have
connection_typein USB ports, to tell whether device is internal or not, but I'd leave the naming alone.
We may need smarter userspace, but it does not mean naming needs to make it harder than it already is.
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 11 lines · Nick Crews
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
Quoted 3 lines
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.
drivers/platform/chrome/wilco_ec/kbd_led_backlight.c line 171
Quoted 2 lines
drivers/platform/chrome/wilco_ec/kbd_led_backlight.c new file +2
-0+ 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.
Thanks,
Dmitry
Hi!
Quoted 14 lines
Quoted 10 lines
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.cQuoted 3 lines
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.
Quoted 8 lines
It would be even better if we did not register platform device if EC does not support backlight.
drivers/platform/chrome/wilco_ec/kbd_led_backlight.c line 171
Quoted 2 lines
drivers/platform/chrome/wilco_ec/kbd_led_backlight.c new file +2
-0+ 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.
Hmm. Seeing get method there... can the EC change the brightness without command from kernel?
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
A message that is not in the archive (sent off-list or not yet received): CAHX4x84pgHeseVphBUq0HLJ70KU-Fz1TQtaq1=iz=mFCDZuJkw@mail.gmail.com
Quoted 18 lines · Nick Crews
Quoted 17 lines · Pavel Machek
Hi!
Quoted 14 lines
Quoted 13 lines
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.cSome 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.
Quoted 9 lines
Quoted 2 lines
Quoted 2 lines
It would be even better if we did not register platform device if EC does not support backlight.
Good point Dmitry. That would require making the core driver dependent upon this keyboard backlight driver, though. Do you think that added complexity is worth it? I don't see performance concerns with adding one unused platform device, so is your rationale that it would just be cleaner code?
You probably wanted to mail dmitry. You should have probably cc-ed Dmitry and the lists.
Quoted 6 lines
Quoted 6 lines
Quoted 5 lines
drivers/platform/chrome/wilco_ec/kbd_led_backlight.c line 171
Quoted 2 lines
drivers/platform/chrome/wilco_ec/kbd_led_backlight.c new file +2
-0+ 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.
Quoted 7 lines
Quoted 2 lines
Hmm. Seeing get method there... can the EC change the brightness without command from kernel?
No, the EC won't change the brightness without getting told to by the kernel. Do you think that means that we could get away with just caching the brightness from the previous
set_brightness(), and not actually sending a mailbox) command to the EC onget_brightness()?
Something like that. Even better ... don't implement brightness_get at all, and check that core does the right thing checking it.
Pavel
Signature · 2 lines
(english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
Quoted 6 lines
Quoted 6 lines
Quoted 3 lines
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?
Quoted 6 lines
Quoted 6 lines
drivers/platform/chrome/wilco_ec/kbd_led_backlight.c line 171
Quoted 3 lines
drivers/platform/chrome/wilco_ec/kbd_led_backlight.c new file +2
-0+ 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.
Quoted 3 lines
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