mirror of
https://github.com/wessel-novacustom/clevo-keyboard.git
synced 2024-11-15 03:34:01 +01:00
Merge remote-tracking branch 'origin/master' into fix_debug_message
This commit is contained in:
commit
d289adea61
|
@ -64,6 +64,17 @@ void clevo_leds_set_color_extern(u32 color);
|
|||
static enum clevo_kb_backlight_types clevo_kb_backlight_type = CLEVO_KB_BACKLIGHT_TYPE_NONE;
|
||||
static bool leds_initialized = false;
|
||||
|
||||
/**
|
||||
* Color scaling quirk list
|
||||
*/
|
||||
static void color_scaling(enum clevo_kb_backlight_types *type, u8 *red, u8 *green, u8 *blue)
|
||||
{
|
||||
if (*type == CLEVO_KB_BACKLIGHT_TYPE_1_ZONE_RGB) {
|
||||
*red = (180 * *red) / 255;
|
||||
*blue = (200 * *blue) / 255;
|
||||
}
|
||||
}
|
||||
|
||||
static int clevo_evaluate_set_white_brightness(u8 brightness)
|
||||
{
|
||||
pr_debug("Set white brightness to %d\n", brightness);
|
||||
|
@ -134,6 +145,7 @@ static struct led_classdev_mc clevo_mcled_cdevs[3]; // forward declaration
|
|||
static void clevo_leds_set_brightness_mc(struct led_classdev *led_cdev, enum led_brightness brightness) {
|
||||
int ret;
|
||||
u32 zone, color;
|
||||
u8 red, green, blue;
|
||||
struct led_classdev_mc *mcled_cdev = lcdev_to_mccdev(led_cdev);
|
||||
|
||||
ret = clevo_evaluate_set_rgb_brightness(brightness);
|
||||
|
@ -147,9 +159,15 @@ static void clevo_leds_set_brightness_mc(struct led_classdev *led_cdev, enum led
|
|||
|
||||
zone = mcled_cdev->subled_info[0].channel;
|
||||
|
||||
color = (mcled_cdev->subled_info[0].intensity << 16) +
|
||||
(mcled_cdev->subled_info[1].intensity << 8) +
|
||||
mcled_cdev->subled_info[2].intensity;
|
||||
red = mcled_cdev->subled_info[0].intensity;
|
||||
green = mcled_cdev->subled_info[1].intensity;
|
||||
blue = mcled_cdev->subled_info[2].intensity;
|
||||
|
||||
color_scaling(&clevo_kb_backlight_type, &red, &green, &blue);
|
||||
|
||||
color = (red << 16) +
|
||||
(green << 8) +
|
||||
blue;
|
||||
|
||||
ret = clevo_evaluate_set_rgb_color(zone, color);
|
||||
if (ret) {
|
||||
|
|
|
@ -82,6 +82,9 @@ static int tdp_max_ph4tqx[] = { 0x32, 0x32, 0x00 };
|
|||
static int tdp_min_ph4axx[] = { 0x05, 0x05, 0x00 };
|
||||
static int tdp_max_ph4axx[] = { 0x2d, 0x3c, 0x00 };
|
||||
|
||||
static int tdp_min_phxpxx[] = { 0x05, 0x05, 0x05 };
|
||||
static int tdp_max_phxpxx[] = { 0x2a, 0x32, 0x5a };
|
||||
|
||||
static int tdp_min_pfxluxg[] = { 0x05, 0x05, 0x05 };
|
||||
static int tdp_max_pfxluxg[] = { 0x23, 0x23, 0x28 };
|
||||
|
||||
|
@ -124,6 +127,9 @@ void uw_id_tdp(void)
|
|||
tdp_min_defs = tdp_min_ph4axx;
|
||||
tdp_max_defs = tdp_max_ph4axx;
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 18, 0)
|
||||
} else if (dmi_match(DMI_PRODUCT_SKU, "IBP1XI08MK1")) {
|
||||
tdp_min_defs = tdp_min_phxpxx;
|
||||
tdp_max_defs = tdp_max_phxpxx;
|
||||
} else if (dmi_match(DMI_PRODUCT_SKU, "PULSE1502")) {
|
||||
tdp_min_defs = tdp_min_pfxluxg;
|
||||
tdp_max_defs = tdp_max_pfxluxg;
|
||||
|
|
|
@ -64,6 +64,7 @@ typedef void (uniwill_event_callb_t)(u32);
|
|||
#define UW_EC_REG_BAREBONE_ID_VALUE_PH6TRX1 0x15
|
||||
#define UW_EC_REG_BAREBONE_ID_VALUE_PH6TQxx 0x16
|
||||
#define UW_EC_REG_BAREBONE_ID_VALUE_PH4Axxx 0x17
|
||||
#define UW_EC_REG_BAREBONE_ID_VALUE_PH4Pxxx 0x18
|
||||
|
||||
#define UW_EC_REG_FEATURES_0 0x0765
|
||||
#define UW_EC_REG_FEATURES_1 0x0766
|
||||
|
|
|
@ -179,6 +179,7 @@ int uniwill_leds_init_early(struct platform_device *dev)
|
|||
pr_err("Reading barebone ID failed.\n");
|
||||
return ret;
|
||||
}
|
||||
pr_debug("EC Barebone ID: %#04x\n", data);
|
||||
|
||||
if (data == UW_EC_REG_BAREBONE_ID_VALUE_PFxxxxx ||
|
||||
data == UW_EC_REG_BAREBONE_ID_VALUE_PFxMxxx ||
|
||||
|
@ -187,7 +188,8 @@ int uniwill_leds_init_early(struct platform_device *dev)
|
|||
data == UW_EC_REG_BAREBONE_ID_VALUE_PH4TQx1 ||
|
||||
data == UW_EC_REG_BAREBONE_ID_VALUE_PH6TRX1 ||
|
||||
data == UW_EC_REG_BAREBONE_ID_VALUE_PH6TQxx ||
|
||||
data == UW_EC_REG_BAREBONE_ID_VALUE_PH4Axxx) {
|
||||
data == UW_EC_REG_BAREBONE_ID_VALUE_PH4Axxx ||
|
||||
data == UW_EC_REG_BAREBONE_ID_VALUE_PH4Pxxx) {
|
||||
ret = uniwill_read_ec_ram(UW_EC_REG_KBD_BL_STATUS, &data);
|
||||
if (ret) {
|
||||
pr_err("Reading keyboard backlight status failed.\n");
|
||||
|
|
Loading…
Reference in a new issue