pmaports/device/testing/linux-valve-jupiter/0009-mfd-steamdeck-Expose-controller-board-power-in-sysfs.patch
Clayton Craft 478a4261ca
linux-valve-jupiter: upgrade to 6.9-rc5 (MR 5058)
[ci:skip-build]: already built successfully in CI
2024-04-23 14:07:46 +02:00

53 lines
1.6 KiB
Diff

From 424d56857067fec8944f562b75028dd3c1a8d9bd Mon Sep 17 00:00:00 2001
From: Andrey Smirnov <andrew.smirnov@gmail.com>
Date: Sun, 24 Sep 2023 15:02:33 -0700
Subject: [PATCH 09/21] mfd: steamdeck: Expose controller board power in sysfs
As of version 118 Deck's BIOS implements "SCBP" method that allows
gating power of the controller board (VBUS). Add a basic WO method to
our root MFD device to allow toggling that.
Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
(cherry picked from commit f97f32718acc10cbb51fef925842392e80904d74)
Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com>
---
drivers/mfd/steamdeck.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/drivers/mfd/steamdeck.c b/drivers/mfd/steamdeck.c
index 0e504b3c2796..a60fa7db9141 100644
--- a/drivers/mfd/steamdeck.c
+++ b/drivers/mfd/steamdeck.c
@@ -41,9 +41,29 @@ struct steamdeck {
STEAMDECK_ATTR_RO(firmware_version, "PDFW");
STEAMDECK_ATTR_RO(board_id, "BOID");
+static ssize_t controller_board_power_store(struct device *dev,
+ struct device_attribute *attr,
+ const char *buf, size_t count)
+{
+ struct steamdeck *sd = dev_get_drvdata(dev);
+ bool enabled;
+ ssize_t ret = kstrtobool(buf, &enabled);
+
+ if (ret)
+ return ret;
+
+ if (ACPI_FAILURE(acpi_execute_simple_method(sd->adev->handle,
+ "SCBP", enabled)))
+ return -EIO;
+
+ return count;
+}
+static DEVICE_ATTR_WO(controller_board_power);
+
static struct attribute *steamdeck_attrs[] = {
&dev_attr_firmware_version.attr,
&dev_attr_board_id.attr,
+ &dev_attr_controller_board_power.attr,
NULL
};
--
2.44.0