acpi: Update keyboard backlight functions

Existing FDAT values remain unchanged in their functionality.
New functionality is added to fill unused FDAT values.

FDAT values correspond to the following functionality:

- 0: Set brightness
- 1: Get brightness
- 2: Get backlight type (new)
- 3: Set color
- 4: Get color (new)
- 5: <unused>
- 6: Set brightness (duplicate)

Signed-off-by: Tim Crawford <tcrawford@system76.com>
This commit is contained in:
Tim Crawford
2023-05-19 17:05:39 -06:00
committed by Jeremy Soller
parent 598aef8c4a
commit bfbbfe43e6

View File

@ -28,16 +28,20 @@ void fcommand(void) {
// Keyboard backlight
case 0xCA:
switch (fdat) {
// Set white LED brightness
case 0x00:
// Set brightness
case 0:
kbled_set(fbuf[0]);
break;
// Get white LED brightness
case 0x01:
// Get brightness
case 1:
fbuf[0] = kbled_get();
break;
// Set LED color
case 0x03:
// Get type
case 2:
fbuf[0] = kbled_kind;
break;
// Set color
case 3:
// clang-format off
kbled_set_color(
((uint32_t)fbuf[0]) |
@ -46,8 +50,17 @@ void fcommand(void) {
);
// clang-format on
break;
// Set LED brightness
case 0x06:
// Get color
case 4:
{
uint32_t color = kbled_get_color();
fbuf[0] = color & 0xFF;
fbuf[1] = (color >> 16) & 0xFF;
fbuf[2] = (color >> 8) & 0xFF;
}
break;
// DUPLICATE: Set brightness
case 6:
kbled_set(fbuf[0]);
break;
}