mirror of
https://github.com/torvalds/linux.git
synced 2026-11-06 21:58:01 +01:00
platform/x86: uniwill-laptop: Fix breathing animation on Intel QC
Intel NUC 9 Extreme (Queens County) devices have a separate bit inside the EC_ADDR_LIGHTBAR_AC_CTRL register for enabling the breathing animation in s2idle mode. Add support for this additional setting. Signed-off-by: Armin Wolf <W_Armin@gmx.de> Link: https://patch.msgid.link/20261007144101.323289-4-W_Armin@gmx.de Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com> Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
This commit is contained in:
parent
d1c0c89969
commit
1a1ecc9aa0
|
|
@ -35,8 +35,8 @@ KernelVersion: 6.19
|
|||
Contact: Armin Wolf <W_Armin@gmx.de>
|
||||
Description:
|
||||
Causes the integrated lightbar to display a breathing animation when the machine
|
||||
has been suspended and is running on AC power. Writing "1"/"0" into this file
|
||||
enables/disables this functionality.
|
||||
has been suspended, is running on AC power and the lightbar brightness not zero.
|
||||
Writing "1"/"0" into this file enables/disables this functionality.
|
||||
|
||||
Reading this file returns the current status of the breathing animation
|
||||
functionality.
|
||||
|
|
|
|||
|
|
@ -165,9 +165,10 @@
|
|||
#define EC_ADDR_LIGHTBAR_AC_CTRL 0x0748
|
||||
#define LIGHTBAR_APP_EXISTS BIT(0)
|
||||
#define LIGHTBAR_POWER_SAVE BIT(1)
|
||||
#define LIGHTBAR_S0_OFF BIT(2)
|
||||
#define LIGHTBAR_S3_OFF BIT(3) // Breathing animation when suspended
|
||||
#define LIGHTBAR_WELCOME BIT(7) // Rainbow animation
|
||||
#define LIGHTBAR_S0_OFF BIT(2) /* Also disables animations */
|
||||
#define LIGHTBAR_S3_OFF BIT(3) /* No breathing animation when in s2ram */
|
||||
#define LIGHTBAR_MODERN_STANDBY_ON BIT(6) /* Breathing animation when in s2idle */
|
||||
#define LIGHTBAR_WELCOME BIT(7) /* Rainbow animation */
|
||||
|
||||
#define EC_ADDR_LIGHTBAR_AC_RED 0x0749
|
||||
|
||||
|
|
@ -306,7 +307,7 @@
|
|||
#define EC_ADDR_USB_C_POWER_PRIORITY 0x07CC
|
||||
#define USB_C_POWER_PRIORITY BIT(7)
|
||||
|
||||
/* Same bits as EC_ADDR_LIGHTBAR_AC_CTRL except LIGHTBAR_S3_OFF */
|
||||
/* Same bits as EC_ADDR_LIGHTBAR_AC_CTRL except LIGHTBAR_S3_OFF and LIGHTBAR_MODERN_STANDBY_ON */
|
||||
#define EC_ADDR_LIGHTBAR_BAT_CTRL 0x07E2
|
||||
|
||||
#define EC_ADDR_LIGHTBAR_BAT_RED 0x07E3
|
||||
|
|
@ -916,12 +917,13 @@ static ssize_t breathing_in_suspend_store(struct device *dev, struct device_attr
|
|||
return ret;
|
||||
|
||||
if (enable)
|
||||
value = 0;
|
||||
value = LIGHTBAR_MODERN_STANDBY_ON;
|
||||
else
|
||||
value = LIGHTBAR_S3_OFF;
|
||||
|
||||
/* We only access a single register here, so we do not need to use data->led_lock */
|
||||
ret = regmap_update_bits(data->regmap, EC_ADDR_LIGHTBAR_AC_CTRL, LIGHTBAR_S3_OFF, value);
|
||||
ret = regmap_update_bits(data->regmap, EC_ADDR_LIGHTBAR_AC_CTRL,
|
||||
LIGHTBAR_S3_OFF | LIGHTBAR_MODERN_STANDBY_ON, value);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
|
|
@ -939,6 +941,10 @@ static ssize_t breathing_in_suspend_show(struct device *dev, struct device_attri
|
|||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/*
|
||||
* We only test LIGHTBAR_S3_OFF here, because LIGHTBAR_MODERN_STANDBY_ON
|
||||
* should have the exact opposite value.
|
||||
*/
|
||||
return sysfs_emit(buf, "%d\n", !(value & LIGHTBAR_S3_OFF));
|
||||
}
|
||||
|
||||
|
|
@ -1546,7 +1552,8 @@ static struct led_trigger uniwill_lightbar_trigger = {
|
|||
.trigger_type = &uniwill_lightbar_trigger_type,
|
||||
};
|
||||
|
||||
#define LIGHTBAR_MASK (LIGHTBAR_APP_EXISTS | LIGHTBAR_S0_OFF | LIGHTBAR_S3_OFF | LIGHTBAR_WELCOME)
|
||||
#define LIGHTBAR_MASK (LIGHTBAR_APP_EXISTS | LIGHTBAR_S0_OFF | LIGHTBAR_S3_OFF | \
|
||||
LIGHTBAR_MODERN_STANDBY_ON | LIGHTBAR_WELCOME)
|
||||
|
||||
static int uniwill_led_init(struct uniwill_data *data)
|
||||
{
|
||||
|
|
@ -1579,6 +1586,11 @@ static int uniwill_led_init(struct uniwill_data *data)
|
|||
return ret;
|
||||
|
||||
value |= LIGHTBAR_APP_EXISTS;
|
||||
if (value & LIGHTBAR_S3_OFF)
|
||||
value &= ~LIGHTBAR_MODERN_STANDBY_ON;
|
||||
else
|
||||
value |= LIGHTBAR_MODERN_STANDBY_ON;
|
||||
|
||||
ret = regmap_write(data->regmap, EC_ADDR_LIGHTBAR_AC_CTRL, value);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
|
@ -1588,6 +1600,7 @@ static int uniwill_led_init(struct uniwill_data *data)
|
|||
* running on battery power.
|
||||
*/
|
||||
value |= LIGHTBAR_S3_OFF;
|
||||
value &= ~LIGHTBAR_MODERN_STANDBY_ON;
|
||||
ret = regmap_update_bits(data->regmap, EC_ADDR_LIGHTBAR_BAT_CTRL, LIGHTBAR_MASK, value);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user