// SPDX-License-Identifier: GPL-2.0 /* * Keyboard backlight LED driver for the Wilco Embedded Controller * * Copyright 2019 Google LLC * * Since the EC will never change the backlight level of its own accord, * we don't need to implement a brightness_get() method.
*/
/** * struct wilco_keyboard_leds_msg - Message to/from EC for keyboard LED control. * @command: Always WILCO_EC_COMMAND_KBBL. * @status: Set by EC to 0 on success, 0xFF on failure. * @subcmd: One of enum wilco_kbbl_subcommand. * @reserved3: Should be 0. * @mode: Bit flags for used mode, we want to use WILCO_KBBL_MODE_FLAG_PWM. * @reserved5to8: Should be 0. * @percent: Brightness in 0-100. Only meaningful in PWM mode. * @reserved10to15: Should be 0.
*/ struct wilco_keyboard_leds_msg {
u8 command;
u8 status;
u8 subcmd;
u8 reserved3;
u8 mode;
u8 reserved5to8[4];
u8 percent;
u8 reserved10to15[6];
} __packed;
/* Send a request, get a response, and check that the response is good. */ staticint send_kbbl_msg(struct wilco_ec_device *ec, struct wilco_keyboard_leds_msg *request, struct wilco_keyboard_leds_msg *response)
{ struct wilco_ec_message msg; int ret;
ret = send_kbbl_msg(ec, &request, &response); if (ret < 0) return ret;
*exists = response.status != 0xFF;
return 0;
}
/** * kbbl_init() - Initialize the state of the keyboard backlight. * @ec: EC device to talk to. * * Gets the current brightness, ensuring that the BIOS already initialized the * backlight to PWM mode. If not in PWM mode, then the current brightness is * meaningless, so set the brightness to WILCO_KBBL_DEFAULT_BRIGHTNESS. * * Return: Final brightness of the keyboard, or negative error code on failure.
*/ staticint kbbl_init(struct wilco_ec_device *ec)
{ struct wilco_keyboard_leds_msg request; struct wilco_keyboard_leds_msg response; int ret;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.