2024-12-10 00:17:37 +03:00
|
|
|
From 2f8a2543aa33103cf237853d5f2ca8999261dd0d Mon Sep 17 00:00:00 2001
|
2024-10-29 05:12:06 +03:00
|
|
|
From: Andrey Smirnov <andrew.smirnov@gmail.com>
|
|
|
|
Date: Sun, 24 Sep 2023 15:02:33 -0700
|
|
|
|
Subject: [PATCH 6/6] 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>
|
|
|
|
Signed-off-by: Alexandre Frade <kernel@xanmod.org>
|
|
|
|
---
|
|
|
|
drivers/mfd/steamdeck.c | 20 ++++++++++++++++++++
|
|
|
|
1 file changed, 20 insertions(+)
|
|
|
|
|
|
|
|
--- 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
|
|
|
|
};
|
|
|
|
|