aboutsummaryrefslogtreecommitdiff
path: root/SOURCES/steam-deck.patch
diff options
context:
space:
mode:
Diffstat (limited to 'SOURCES/steam-deck.patch')
-rw-r--r--SOURCES/steam-deck.patch84
1 files changed, 84 insertions, 0 deletions
diff --git a/SOURCES/steam-deck.patch b/SOURCES/steam-deck.patch
index b118c46..25a3e52 100644
--- a/SOURCES/steam-deck.patch
+++ b/SOURCES/steam-deck.patch
@@ -976,5 +976,89 @@ index 0e504b3c2796..a60fa7db9141 100644
NULL
};
+From: Matthew Schwartz <njtransit215@gmail.com> Mon Sep 17 00:00:00 2001
+From: Andrey Smirnov <andrew.smirnov@gmail.com>
+Date: Mon, 20 Nov 2023 05:42:03 -0800
+Subject: [PATCH] leds-steamdeck: Add support for LED birghtness multiplier
+
+Add support for LED birghtness multiplier exposed via custom sysfs
+attribute (led_brightness_multiplier).
+
+Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
+(cherry picked from commit c4ea057992e189ec8821cde3a65e2cc0529a5088)
+(cherry picked from commit e90fb9bec45c15c0c541ce60b994bab3922ddadf)
+Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
+---
+ drivers/leds/leds-steamdeck.c | 49 +++++++++++++++++++++++++++++++++++
+ 1 file changed, 49 insertions(+)
+
+diff --git a/drivers/leds/leds-steamdeck.c b/drivers/leds/leds-steamdeck.c
+index 686500b8de736..ada9fffc0a420 100644
+--- a/drivers/leds/leds-steamdeck.c
++++ b/drivers/leds/leds-steamdeck.c
+@@ -16,6 +16,54 @@ struct steamdeck_led {
+ struct led_classdev cdev;
+ };
+
++static ssize_t led_brightness_multiplier_show(struct device *dev,
++ struct device_attribute *attr,
++ char *buf)
++{
++ struct led_classdev *cdev = dev_get_drvdata(dev);
++ struct steamdeck_led *sd = container_of(cdev, struct steamdeck_led,
++ cdev);
++ unsigned long long led_brightness_multiplier;
++
++ if (ACPI_FAILURE(acpi_evaluate_integer(sd->adev->handle,
++ "GLDM",
++ NULL,
++ &led_brightness_multiplier)))
++ return -EIO;
++
++
++ return sprintf(buf, "%llu", led_brightness_multiplier);
++}
++
++static ssize_t led_brightness_multiplier_store(struct device *dev,
++ struct device_attribute *attr,
++ const char *buf, size_t count)
++{
++ struct led_classdev *cdev = dev_get_drvdata(dev);
++ struct steamdeck_led *sd = container_of(cdev, struct steamdeck_led,
++ cdev);
++ unsigned long value;
++
++ if (kstrtoul(buf, 10, &value) || value > 100)
++ return -EINVAL;
++
++
++ if (ACPI_FAILURE(acpi_execute_simple_method(sd->adev->handle,
++ "SLDM", value)))
++ return -EIO;
++
++
++ return count;
++}
++
++static DEVICE_ATTR_RW(led_brightness_multiplier);
++
++static struct attribute *steamdeck_led_attrs[] = {
++ &dev_attr_led_brightness_multiplier.attr,
++ NULL
++};
++ATTRIBUTE_GROUPS(steamdeck_led);
++
+ static int steamdeck_leds_brightness_set(struct led_classdev *cdev,
+ enum led_brightness value)
+ {
+@@ -44,6 +92,7 @@ static int steamdeck_leds_probe(struct platform_device *pdev)
+ sd->cdev.name = "status:white";
+ sd->cdev.brightness_set_blocking = steamdeck_leds_brightness_set;
+ sd->cdev.max_brightness = 100;
++ sd->cdev.groups = steamdeck_led_groups;
+
+ ret = devm_led_classdev_register(dev, &sd->cdev);
+ if (ret) {
+
--
2.41.0