mirror of
https://github.com/wessel-novacustom/clevo-keyboard.git
synced 2024-11-15 03:34:01 +01:00
Finish implementation of notify hw changed for Clevo
This commit is contained in:
parent
7ea3a0ac13
commit
0845466b0b
|
@ -180,7 +180,8 @@ static struct led_classdev clevo_led_cdev = {
|
|||
.name = "white:" LED_FUNCTION_KBD_BACKLIGHT,
|
||||
.max_brightness = CLEVO_KBD_BRIGHTNESS_WHITE_MAX,
|
||||
.brightness_set = &clevo_leds_set_brightness,
|
||||
.brightness = CLEVO_KBD_BRIGHTNESS_WHITE_DEFAULT
|
||||
.brightness = CLEVO_KBD_BRIGHTNESS_WHITE_DEFAULT,
|
||||
.flags = LED_BRIGHT_HW_CHANGED
|
||||
};
|
||||
|
||||
static struct mc_subled clevo_mcled_cdevs_subleds[3][3] = {
|
||||
|
@ -400,6 +401,8 @@ enum clevo_kb_backlight_types clevo_leds_get_backlight_type(void) {
|
|||
}
|
||||
EXPORT_SYMBOL(clevo_leds_get_backlight_type);
|
||||
|
||||
// TODO Don't reuse brightness_set as it is writing back the same brightness which could lead to race conditions.
|
||||
// Reimplement brightness_set instead without writing back brightness value like in uniwill_leds.h.
|
||||
void clevo_leds_restore_state_extern(void) {
|
||||
if (clevo_kb_backlight_type == CLEVO_KB_BACKLIGHT_TYPE_FIXED_COLOR) {
|
||||
clevo_led_cdev.brightness_set(&clevo_led_cdev, clevo_led_cdev.brightness);
|
||||
|
@ -416,12 +419,20 @@ void clevo_leds_restore_state_extern(void) {
|
|||
EXPORT_SYMBOL(clevo_leds_restore_state_extern);
|
||||
|
||||
void clevo_leds_notify_brightness_change_extern(void) {
|
||||
int status;
|
||||
u32 result;
|
||||
|
||||
if (clevo_kb_backlight_type == CLEVO_KB_BACKLIGHT_TYPE_FIXED_COLOR) {
|
||||
// TODO
|
||||
status = clevo_evaluate_method(CLEVO_CMD_GET_KB_WHITE_LEDS, 0, &result);
|
||||
pr_debug("Firmware set brightness: %u\n", result);
|
||||
clevo_led_cdev.brightness = result;
|
||||
led_classdev_notify_brightness_hw_changed(&clevo_led_cdev, result);
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL(clevo_leds_notify_brightness_change_extern);
|
||||
|
||||
// TODO Not used externaly, but only on init. Should not be exposed because it would require a correct
|
||||
// led_classdev_notify_brightness_hw_changed implementation when used outside of init.
|
||||
void clevo_leds_set_brightness_extern(enum led_brightness brightness) {
|
||||
if (clevo_kb_backlight_type == CLEVO_KB_BACKLIGHT_TYPE_FIXED_COLOR) {
|
||||
clevo_led_cdev.brightness_set(&clevo_led_cdev, brightness);
|
||||
|
@ -437,6 +448,8 @@ void clevo_leds_set_brightness_extern(enum led_brightness brightness) {
|
|||
}
|
||||
EXPORT_SYMBOL(clevo_leds_set_brightness_extern);
|
||||
|
||||
// TODO Not used externaly, but only on init. Should not be exposed because it would require a correct
|
||||
// led_classdev_notify_brightness_hw_changed equivalent for color implementation when used outside of init.
|
||||
void clevo_leds_set_color_extern(u32 color) {
|
||||
if (clevo_kb_backlight_type == CLEVO_KB_BACKLIGHT_TYPE_1_ZONE_RGB) {
|
||||
clevo_mcled_cdevs[0].subled_info[0].intensity = (color >> 16) & 0xff;
|
||||
|
|
Loading…
Reference in a new issue