mirror of
https://github.com/wessel-novacustom/clevo-keyboard.git
synced 2024-11-15 03:34:01 +01:00
Add retry when no keyboard backlight is recognized as this is probably wrong
This commit is contained in:
parent
08502a6904
commit
3784ff5eb2
|
@ -46,6 +46,7 @@ void clevo_leds_set_color_extern(u32 color);
|
||||||
#include "clevo_interfaces.h"
|
#include "clevo_interfaces.h"
|
||||||
|
|
||||||
#include <linux/led-class-multicolor.h>
|
#include <linux/led-class-multicolor.h>
|
||||||
|
#include <linux/delay.h>
|
||||||
|
|
||||||
#define CLEVO_KBD_BRIGHTNESS_MAX 0xff
|
#define CLEVO_KBD_BRIGHTNESS_MAX 0xff
|
||||||
#define CLEVO_KBD_BRIGHTNESS_DEFAULT 0x00
|
#define CLEVO_KBD_BRIGHTNESS_DEFAULT 0x00
|
||||||
|
@ -274,25 +275,33 @@ static struct led_classdev_mc clevo_mcled_cdevs[3] = {
|
||||||
|
|
||||||
int clevo_leds_init(struct platform_device *dev)
|
int clevo_leds_init(struct platform_device *dev)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret, i;
|
||||||
u32 status;
|
u32 status;
|
||||||
union acpi_object *result;
|
union acpi_object *result;
|
||||||
u32 result_fallback;
|
u32 result_fallback;
|
||||||
|
|
||||||
status = clevo_evaluate_method2(CLEVO_CMD_GET_SPECS, 0, &result);
|
for (i = 0; i < 3; ++i) {
|
||||||
if (!status) {
|
status = clevo_evaluate_method2(CLEVO_CMD_GET_SPECS, 0, &result);
|
||||||
if (result->type == ACPI_TYPE_BUFFER) {
|
if (!status) {
|
||||||
pr_debug("CLEVO_CMD_GET_SPECS result->buffer.pointer[0x0f]: 0x%02x\n", result->buffer.pointer[0x0f]);
|
if (result->type == ACPI_TYPE_BUFFER) {
|
||||||
clevo_kb_backlight_type = result->buffer.pointer[0x0f];
|
pr_debug("CLEVO_CMD_GET_SPECS result->buffer.pointer[0x0f]: 0x%02x\n", result->buffer.pointer[0x0f]);
|
||||||
|
clevo_kb_backlight_type = result->buffer.pointer[0x0f];
|
||||||
|
if (clevo_kb_backlight_type)
|
||||||
|
break;
|
||||||
|
else {
|
||||||
|
pr_debug("clevo_kb_backlight_type 0x00 probably wrong, retrying...\n");
|
||||||
|
msleep(50);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
pr_err("CLEVO_CMD_GET_SPECS does not exist on this device or return value has wrong type, trying CLEVO_CMD_GET_BIOS_FEATURES\n");
|
||||||
|
status = -EINVAL;
|
||||||
|
}
|
||||||
|
ACPI_FREE(result);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
pr_err("CLEVO_CMD_GET_SPECS does not exist on this device or return value has wrong type, trying CLEVO_CMD_GET_BIOS_FEATURES\n");
|
pr_notice("CLEVO_CMD_GET_SPECS does not exist on this device or failed, trying CLEVO_CMD_GET_BIOS_FEATURES_1\n");
|
||||||
status = -EINVAL;
|
|
||||||
}
|
}
|
||||||
ACPI_FREE(result);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
pr_notice("CLEVO_CMD_GET_SPECS does not exist on this device or failed, trying CLEVO_CMD_GET_BIOS_FEATURES_1\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status || clevo_kb_backlight_type == CLEVO_KB_BACKLIGHT_TYPE_NONE) {
|
if (status || clevo_kb_backlight_type == CLEVO_KB_BACKLIGHT_TYPE_NONE) {
|
||||||
|
|
Loading…
Reference in a new issue