Update surface-acpi for v4.19
This should fix the remaining issues in #473.
This commit is contained in:
parent
b74befa0ca
commit
7f460186ff
|
@ -1,6 +1,6 @@
|
||||||
From 8f120efa25f58bc8b842cdacb1358f7c7d9ecc18 Mon Sep 17 00:00:00 2001
|
From 5f8ba221472e112b432fa9922f8ae572de5d3399 Mon Sep 17 00:00:00 2001
|
||||||
From: Maximilian Luz <luzmaximilian@gmail.com>
|
From: Maximilian Luz <luzmaximilian@gmail.com>
|
||||||
Date: Fri, 26 Jul 2019 03:40:41 +0200
|
Date: Wed, 25 Sep 2019 23:20:42 +0200
|
||||||
Subject: [PATCH 01/12] surface-acpi
|
Subject: [PATCH 01/12] surface-acpi
|
||||||
|
|
||||||
---
|
---
|
||||||
|
@ -8,9 +8,9 @@ Subject: [PATCH 01/12] surface-acpi
|
||||||
drivers/acpi/acpica/exfield.c | 26 +-
|
drivers/acpi/acpica/exfield.c | 26 +-
|
||||||
drivers/platform/x86/Kconfig | 97 +
|
drivers/platform/x86/Kconfig | 97 +
|
||||||
drivers/platform/x86/Makefile | 1 +
|
drivers/platform/x86/Makefile | 1 +
|
||||||
drivers/platform/x86/surface_acpi.c | 3913 +++++++++++++++++++++++++++
|
drivers/platform/x86/surface_acpi.c | 4000 +++++++++++++++++++++++++++
|
||||||
drivers/tty/serdev/core.c | 87 +
|
drivers/tty/serdev/core.c | 111 +-
|
||||||
6 files changed, 4109 insertions(+), 17 deletions(-)
|
6 files changed, 4208 insertions(+), 29 deletions(-)
|
||||||
create mode 100644 drivers/platform/x86/surface_acpi.c
|
create mode 100644 drivers/platform/x86/surface_acpi.c
|
||||||
|
|
||||||
diff --git a/drivers/acpi/acpica/dsopcode.c b/drivers/acpi/acpica/dsopcode.c
|
diff --git a/drivers/acpi/acpica/dsopcode.c b/drivers/acpi/acpica/dsopcode.c
|
||||||
|
@ -201,10 +201,10 @@ index dc29af4d8e2f..2250a32a5527 100644
|
||||||
obj-$(CONFIG_FUJITSU_TABLET) += fujitsu-tablet.o
|
obj-$(CONFIG_FUJITSU_TABLET) += fujitsu-tablet.o
|
||||||
diff --git a/drivers/platform/x86/surface_acpi.c b/drivers/platform/x86/surface_acpi.c
|
diff --git a/drivers/platform/x86/surface_acpi.c b/drivers/platform/x86/surface_acpi.c
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 000000000000..f62aecb0df69
|
index 000000000000..54cf6806daaf
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/drivers/platform/x86/surface_acpi.c
|
+++ b/drivers/platform/x86/surface_acpi.c
|
||||||
@@ -0,0 +1,3913 @@
|
@@ -0,0 +1,4000 @@
|
||||||
+#include <asm/unaligned.h>
|
+#include <asm/unaligned.h>
|
||||||
+#include <linux/acpi.h>
|
+#include <linux/acpi.h>
|
||||||
+#include <linux/completion.h>
|
+#include <linux/completion.h>
|
||||||
|
@ -212,6 +212,7 @@ index 000000000000..f62aecb0df69
|
||||||
+#include <linux/delay.h>
|
+#include <linux/delay.h>
|
||||||
+#include <linux/device.h>
|
+#include <linux/device.h>
|
||||||
+#include <linux/dmaengine.h>
|
+#include <linux/dmaengine.h>
|
||||||
|
+#include <linux/dmi.h>
|
||||||
+#include <linux/fs.h>
|
+#include <linux/fs.h>
|
||||||
+#include <linux/hid.h>
|
+#include <linux/hid.h>
|
||||||
+#include <linux/input.h>
|
+#include <linux/input.h>
|
||||||
|
@ -3682,6 +3683,120 @@ index 000000000000..f62aecb0df69
|
||||||
+};
|
+};
|
||||||
+
|
+
|
||||||
+
|
+
|
||||||
|
+static const struct si_lid_device lid_device_l17 = {
|
||||||
|
+ .acpi_path = "\\_SB.LID0",
|
||||||
|
+ .gpe_number = 0x17,
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+static const struct si_lid_device lid_device_l57 = {
|
||||||
|
+ .acpi_path = "\\_SB.LID0",
|
||||||
|
+ .gpe_number = 0x57,
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+static const struct si_lid_device lid_device_l4F = {
|
||||||
|
+ .acpi_path = "\\_SB.LID0",
|
||||||
|
+ .gpe_number = 0x57,
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+static const struct si_device_info si_device_pro_4 = {
|
||||||
|
+ .has_perf_mode = false,
|
||||||
|
+ .lid_device = &lid_device_l17,
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+static const struct si_device_info si_device_pro_5 = {
|
||||||
|
+ .has_perf_mode = false,
|
||||||
|
+ .lid_device = &lid_device_l4F,
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+static const struct si_device_info si_device_pro_6 = {
|
||||||
|
+ .has_perf_mode = false,
|
||||||
|
+ .lid_device = &lid_device_l4F,
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+static const struct si_device_info si_device_book_1 = {
|
||||||
|
+ .has_perf_mode = false,
|
||||||
|
+ .lid_device = &lid_device_l17,
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+static const struct si_device_info si_device_book_2 = {
|
||||||
|
+ .has_perf_mode = true,
|
||||||
|
+ .lid_device = &lid_device_l17,
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+static const struct si_device_info si_device_laptop_1 = {
|
||||||
|
+ .has_perf_mode = false,
|
||||||
|
+ .lid_device = &lid_device_l57,
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+static const struct si_device_info si_device_laptop_2 = {
|
||||||
|
+ .has_perf_mode = false,
|
||||||
|
+ .lid_device = &lid_device_l57,
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+static const struct dmi_system_id dmi_lid_device_table[] = {
|
||||||
|
+ {
|
||||||
|
+ .ident = "Surface Pro 4",
|
||||||
|
+ .matches = {
|
||||||
|
+ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
|
||||||
|
+ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Surface Pro 4"),
|
||||||
|
+ },
|
||||||
|
+ .driver_data = (void *)&si_device_pro_4,
|
||||||
|
+ },
|
||||||
|
+ {
|
||||||
|
+ .ident = "Surface Pro 5",
|
||||||
|
+ .matches = {
|
||||||
|
+ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
|
||||||
|
+ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Surface Pro 2017"),
|
||||||
|
+ },
|
||||||
|
+ .driver_data = (void *)&si_device_pro_5,
|
||||||
|
+ },
|
||||||
|
+ {
|
||||||
|
+ .ident = "Surface Pro 6",
|
||||||
|
+ .matches = {
|
||||||
|
+ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
|
||||||
|
+ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Surface Pro 6"),
|
||||||
|
+ },
|
||||||
|
+ .driver_data = (void *)&si_device_pro_6,
|
||||||
|
+ },
|
||||||
|
+ {
|
||||||
|
+ .ident = "Surface Book 1",
|
||||||
|
+ .matches = {
|
||||||
|
+ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
|
||||||
|
+ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Surface Book"),
|
||||||
|
+ },
|
||||||
|
+ .driver_data = (void *)&si_device_book_1,
|
||||||
|
+ },
|
||||||
|
+ {
|
||||||
|
+ .ident = "Surface Book 2",
|
||||||
|
+ .matches = {
|
||||||
|
+ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
|
||||||
|
+ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Surface Book 2"),
|
||||||
|
+ },
|
||||||
|
+ .driver_data = (void *)&si_device_book_2,
|
||||||
|
+ },
|
||||||
|
+ {
|
||||||
|
+ .ident = "Surface Laptop 1",
|
||||||
|
+ .matches = {
|
||||||
|
+ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
|
||||||
|
+ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Surface Laptop"),
|
||||||
|
+ },
|
||||||
|
+ .driver_data = (void *)&si_device_laptop_1,
|
||||||
|
+ },
|
||||||
|
+ {
|
||||||
|
+ .ident = "Surface Laptop 2",
|
||||||
|
+ .matches = {
|
||||||
|
+ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
|
||||||
|
+ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Surface Laptop 2"),
|
||||||
|
+ },
|
||||||
|
+ .driver_data = (void *)&si_device_laptop_2,
|
||||||
|
+ },
|
||||||
|
+ { }
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+#define SG5_PARAM_PERM (S_IRUGO | S_IWUSR)
|
||||||
|
+
|
||||||
+enum sg5_perf_mode {
|
+enum sg5_perf_mode {
|
||||||
+ SG5_PERF_MODE_NORMAL = 1,
|
+ SG5_PERF_MODE_NORMAL = 1,
|
||||||
+ SG5_PERF_MODE_BATTERY = 2,
|
+ SG5_PERF_MODE_BATTERY = 2,
|
||||||
|
@ -3789,7 +3904,6 @@ index 000000000000..f62aecb0df69
|
||||||
+MODULE_PARM_DESC(perf_mode_init, "Performance-mode to be set on module initialization");
|
+MODULE_PARM_DESC(perf_mode_init, "Performance-mode to be set on module initialization");
|
||||||
+MODULE_PARM_DESC(perf_mode_exit, "Performance-mode to be set on module exit");
|
+MODULE_PARM_DESC(perf_mode_exit, "Performance-mode to be set on module exit");
|
||||||
+
|
+
|
||||||
+
|
|
||||||
+static ssize_t perf_mode_show(struct device *dev, struct device_attribute *attr, char *data)
|
+static ssize_t perf_mode_show(struct device *dev, struct device_attribute *attr, char *data)
|
||||||
+{
|
+{
|
||||||
+ int perf_mode;
|
+ int perf_mode;
|
||||||
|
@ -3837,7 +3951,6 @@ index 000000000000..f62aecb0df69
|
||||||
+
|
+
|
||||||
+const static DEVICE_ATTR_RW(perf_mode);
|
+const static DEVICE_ATTR_RW(perf_mode);
|
||||||
+
|
+
|
||||||
+
|
|
||||||
+static int sid_perf_mode_setup(struct platform_device *pdev, const struct si_device_info *info)
|
+static int sid_perf_mode_setup(struct platform_device *pdev, const struct si_device_info *info)
|
||||||
+{
|
+{
|
||||||
+ int status;
|
+ int status;
|
||||||
|
@ -3900,7 +4013,7 @@ index 000000000000..f62aecb0df69
|
||||||
+ return 0;
|
+ return 0;
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static int sid_lid_device_setup(struct platform_device *pdev, const struct si_device_info *info)
|
+static int sid_lid_device_setup(const struct si_device_info *info)
|
||||||
+{
|
+{
|
||||||
+ acpi_handle lid_handle;
|
+ acpi_handle lid_handle;
|
||||||
+ int status;
|
+ int status;
|
||||||
|
@ -3920,11 +4033,12 @@ index 000000000000..f62aecb0df69
|
||||||
+ if (status)
|
+ if (status)
|
||||||
+ return -EFAULT;
|
+ return -EFAULT;
|
||||||
+
|
+
|
||||||
+ return sid_lid_enable_wakeup(info, true);
|
+ return sid_lid_enable_wakeup(info, false);
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static void sid_lid_device_remove(struct platform_device *pdev, const struct si_device_info *info)
|
+static void sid_lid_device_remove(const struct si_device_info *info)
|
||||||
+{
|
+{
|
||||||
|
+ /* restore default behavior without this module */
|
||||||
+ sid_lid_enable_wakeup(info, false);
|
+ sid_lid_enable_wakeup(info, false);
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
|
@ -3946,19 +4060,23 @@ index 000000000000..f62aecb0df69
|
||||||
+
|
+
|
||||||
+static int surfacegen5_acpi_sid_probe(struct platform_device *pdev)
|
+static int surfacegen5_acpi_sid_probe(struct platform_device *pdev)
|
||||||
+{
|
+{
|
||||||
+ const struct si_device_info *info;
|
+ const struct dmi_system_id *dmi_match;
|
||||||
|
+ struct si_device_info *info;
|
||||||
+ int status;
|
+ int status;
|
||||||
+
|
+
|
||||||
+ info = acpi_device_get_match_data(&pdev->dev);
|
+ dmi_match = dmi_first_match(dmi_lid_device_table);
|
||||||
+ if (!info)
|
+ if (!dmi_match)
|
||||||
+ return -ENODEV;
|
+ return -ENODEV;
|
||||||
+ platform_set_drvdata(pdev, (void *)info);
|
+
|
||||||
|
+ info = dmi_match->driver_data;
|
||||||
|
+
|
||||||
|
+ platform_set_drvdata(pdev, info);
|
||||||
+
|
+
|
||||||
+ status = sid_perf_mode_setup(pdev, info);
|
+ status = sid_perf_mode_setup(pdev, info);
|
||||||
+ if (status)
|
+ if (status)
|
||||||
+ goto err_perf_mode;
|
+ goto err_perf_mode;
|
||||||
+
|
+
|
||||||
+ status = sid_lid_device_setup(pdev, info);
|
+ status = sid_lid_device_setup(info);
|
||||||
+ if (status)
|
+ if (status)
|
||||||
+ goto err_lid;
|
+ goto err_lid;
|
||||||
+
|
+
|
||||||
|
@ -3975,48 +4093,18 @@ index 000000000000..f62aecb0df69
|
||||||
+ const struct si_device_info *info = platform_get_drvdata(pdev);
|
+ const struct si_device_info *info = platform_get_drvdata(pdev);
|
||||||
+
|
+
|
||||||
+ sid_perf_mode_remove(pdev, info);
|
+ sid_perf_mode_remove(pdev, info);
|
||||||
+ sid_lid_device_remove(pdev, info);
|
+ sid_lid_device_remove(info);
|
||||||
+
|
+
|
||||||
|
+ platform_set_drvdata(pdev, NULL);
|
||||||
+ return 0;
|
+ return 0;
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+
|
|
||||||
+static const struct si_lid_device lid_device_l17 = {
|
|
||||||
+ .acpi_path = "\\_SB.LID0",
|
|
||||||
+ .gpe_number = 0x17,
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+static const struct si_lid_device lid_device_l57 = {
|
|
||||||
+ .acpi_path = "\\_SB.LID0",
|
|
||||||
+ .gpe_number = 0x57,
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+static const struct si_device_info si_device_pro = {
|
|
||||||
+ .has_perf_mode = false,
|
|
||||||
+ .lid_device = &lid_device_l17,
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+static const struct si_device_info si_device_book_1 = {
|
|
||||||
+ .has_perf_mode = false,
|
|
||||||
+ .lid_device = &lid_device_l17,
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+static const struct si_device_info si_device_book_2 = {
|
|
||||||
+ .has_perf_mode = true,
|
|
||||||
+ .lid_device = &lid_device_l17,
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+static const struct si_device_info si_device_laptop = {
|
|
||||||
+ .has_perf_mode = false,
|
|
||||||
+ .lid_device = &lid_device_l57,
|
|
||||||
+};
|
|
||||||
+
|
|
||||||
+static const struct acpi_device_id surfacegen5_acpi_sid_match[] = {
|
+static const struct acpi_device_id surfacegen5_acpi_sid_match[] = {
|
||||||
+ { "MSHW0081", (unsigned long)&si_device_pro }, /* Surface Pro 4 and 5 */
|
+ { "MSHW0081", }, /* Surface Pro 4, 5, and 6 */
|
||||||
+ { "MSHW0080", (unsigned long)&si_device_book_1 }, /* Surface Book 1 */
|
+ { "MSHW0080", }, /* Surface Book 1 */
|
||||||
+ { "MSHW0107", (unsigned long)&si_device_book_2 }, /* Surface Book 2 */
|
+ { "MSHW0107", }, /* Surface Book 2 */
|
||||||
+ { "MSHW0086", (unsigned long)&si_device_laptop }, /* Surface Laptop 1 */
|
+ { "MSHW0086", }, /* Surface Laptop 1 */
|
||||||
+ { "MSHW0112", (unsigned long)&si_device_laptop }, /* Surface Laptop 2 */
|
+ { "MSHW0112", }, /* Surface Laptop 2 */
|
||||||
+ { },
|
+ { },
|
||||||
+};
|
+};
|
||||||
+MODULE_DEVICE_TABLE(acpi, surfacegen5_acpi_sid_match);
|
+MODULE_DEVICE_TABLE(acpi, surfacegen5_acpi_sid_match);
|
||||||
|
@ -4031,7 +4119,6 @@ index 000000000000..f62aecb0df69
|
||||||
+ },
|
+ },
|
||||||
+};
|
+};
|
||||||
+
|
+
|
||||||
+
|
|
||||||
+inline int surfacegen5_acpi_sid_register(void)
|
+inline int surfacegen5_acpi_sid_register(void)
|
||||||
+{
|
+{
|
||||||
+ return platform_driver_register(&surfacegen5_acpi_sid);
|
+ return platform_driver_register(&surfacegen5_acpi_sid);
|
||||||
|
@ -4119,117 +4206,156 @@ index 000000000000..f62aecb0df69
|
||||||
+MODULE_DESCRIPTION("ACPI/Platform Drivers for Microsoft Surface Devices");
|
+MODULE_DESCRIPTION("ACPI/Platform Drivers for Microsoft Surface Devices");
|
||||||
+MODULE_LICENSE("GPL v2");
|
+MODULE_LICENSE("GPL v2");
|
||||||
diff --git a/drivers/tty/serdev/core.c b/drivers/tty/serdev/core.c
|
diff --git a/drivers/tty/serdev/core.c b/drivers/tty/serdev/core.c
|
||||||
index 9db93f500b4e..9cfb5ffc034f 100644
|
index 9db93f500b4e..42d1dae34b21 100644
|
||||||
--- a/drivers/tty/serdev/core.c
|
--- a/drivers/tty/serdev/core.c
|
||||||
+++ b/drivers/tty/serdev/core.c
|
+++ b/drivers/tty/serdev/core.c
|
||||||
@@ -526,6 +526,81 @@ static acpi_status acpi_serdev_register_device(struct serdev_controller *ctrl,
|
@@ -496,16 +496,97 @@ static int of_serdev_register_devices(struct serdev_controller *ctrl)
|
||||||
return AE_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
+struct acpi_serdev_add_device_from_resource_ctx {
|
#ifdef CONFIG_ACPI
|
||||||
+ acpi_handle ctrl_handle;
|
+
|
||||||
|
+#define SERDEV_ACPI_MAX_SCAN_DEPTH 32
|
||||||
|
+
|
||||||
|
+struct acpi_serdev_lookup {
|
||||||
+ acpi_handle device_handle;
|
+ acpi_handle device_handle;
|
||||||
+ struct serdev_controller *ctrl;
|
+ acpi_handle controller_handle;
|
||||||
+ struct acpi_device *device;
|
+ int n;
|
||||||
|
+ int index;
|
||||||
+};
|
+};
|
||||||
+
|
+
|
||||||
+static acpi_status
|
+static int acpi_serdev_parse_resource(struct acpi_resource *ares, void *data)
|
||||||
+acpi_serdev_add_device_from_resource(struct acpi_resource *resource, void *data)
|
|
||||||
+{
|
+{
|
||||||
+ struct acpi_serdev_add_device_from_resource_ctx* ctx = data;
|
+ struct acpi_serdev_lookup *lookup = data;
|
||||||
+ struct acpi_resource_source *ctrl_name;
|
+ struct acpi_resource_uart_serialbus *sb;
|
||||||
+ acpi_handle ctrl_handle;
|
|
||||||
+ acpi_status status;
|
+ acpi_status status;
|
||||||
+
|
+
|
||||||
+ if (resource->type != ACPI_RESOURCE_TYPE_SERIAL_BUS)
|
+ if (ares->type != ACPI_RESOURCE_TYPE_SERIAL_BUS)
|
||||||
+ return AE_OK;
|
+ return 1;
|
||||||
+
|
+
|
||||||
+ if (resource->data.common_serial_bus.type != ACPI_RESOURCE_SERIAL_TYPE_UART)
|
+ if (ares->data.common_serial_bus.type != ACPI_RESOURCE_SERIAL_TYPE_UART)
|
||||||
+ return AE_OK;
|
+ return 1;
|
||||||
+
|
+
|
||||||
+ ctrl_name = &resource->data.common_serial_bus.resource_source;
|
+ if (lookup->index != -1 && lookup->n++ != lookup->index)
|
||||||
+ if (ctrl_name->string_length == 0 || !ctrl_name->string_ptr) {
|
+ return 1;
|
||||||
+ return AE_OK;
|
+
|
||||||
|
+ sb = &ares->data.uart_serial_bus;
|
||||||
|
+
|
||||||
|
+ status = acpi_get_handle(lookup->device_handle,
|
||||||
|
+ sb->resource_source.string_ptr,
|
||||||
|
+ &lookup->controller_handle);
|
||||||
|
+ if (ACPI_FAILURE(status))
|
||||||
|
+ return 1;
|
||||||
|
+
|
||||||
|
+ /*
|
||||||
|
+ * NOTE: Ideally, we would also want to retreive other properties here,
|
||||||
|
+ * once setting them before opening the device is supported by serdev.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+ return 1;
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+ status = acpi_get_handle(ctx->device_handle, ctrl_name->string_ptr,
|
+static int acpi_serdev_do_lookup(struct acpi_device *adev,
|
||||||
+ &ctrl_handle);
|
+ struct acpi_serdev_lookup *lookup)
|
||||||
+ if (ACPI_FAILURE(status)) {
|
|
||||||
+ return AE_OK;
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if (ctrl_handle == ctx->ctrl_handle) {
|
|
||||||
+ return acpi_serdev_register_device(ctx->ctrl, ctx->device);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ return AE_OK;
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+static acpi_status
|
|
||||||
+acpi_serdev_add_devices_from_resources(acpi_handle handle, u32 level,
|
|
||||||
+ void *data, void **return_value)
|
|
||||||
+{
|
+{
|
||||||
+ struct acpi_serdev_add_device_from_resource_ctx *ctx = data;
|
+ struct list_head resource_list;
|
||||||
+ acpi_status status;
|
+ int ret;
|
||||||
+
|
+
|
||||||
+ ctx->device_handle = handle;
|
+ lookup->device_handle = acpi_device_handle(adev);
|
||||||
|
+ lookup->controller_handle = NULL;
|
||||||
|
+ lookup->n = 0;
|
||||||
+
|
+
|
||||||
+ status = acpi_bus_get_device(handle, &ctx->device);
|
+ INIT_LIST_HEAD(&resource_list);
|
||||||
+ if (status) return AE_OK;
|
+ ret = acpi_dev_get_resources(adev, &resource_list,
|
||||||
|
+ acpi_serdev_parse_resource, lookup);
|
||||||
|
+ acpi_dev_free_resource_list(&resource_list);
|
||||||
+
|
+
|
||||||
+ status = acpi_walk_resources(handle, METHOD_NAME__CRS,
|
+ if (ret < 0)
|
||||||
+ acpi_serdev_add_device_from_resource,
|
+ return -EINVAL;
|
||||||
+ ctx);
|
|
||||||
+
|
+
|
||||||
+ if (status == AE_NOT_FOUND)
|
+ return 0;
|
||||||
+ return AE_OK; // not finding _CRS is not an error
|
|
||||||
+ else
|
|
||||||
+ return status;
|
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static int
|
+static int acpi_serdev_check_resources(struct serdev_controller *ctrl,
|
||||||
+acpi_serdev_register_devices_from_resources(acpi_handle handle,
|
+ struct acpi_device *adev)
|
||||||
+ struct serdev_controller *ctrl)
|
|
||||||
+{
|
+{
|
||||||
+ struct acpi_serdev_add_device_from_resource_ctx ctx = {
|
+ struct acpi_serdev_lookup lookup;
|
||||||
+ .ctrl = ctrl,
|
+ int ret;
|
||||||
+ .ctrl_handle = handle,
|
|
||||||
+ };
|
|
||||||
+
|
+
|
||||||
+ return acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT, 128,
|
+ if (acpi_bus_get_status(adev) || !adev->status.present)
|
||||||
+ acpi_serdev_add_devices_from_resources,
|
+ return -EINVAL;
|
||||||
+ NULL, &ctx, NULL);
|
+
|
||||||
|
+ /* Look for UARTSerialBusV2 resource */
|
||||||
|
+ lookup.index = -1; // we only care for the last device
|
||||||
|
+
|
||||||
|
+ ret = acpi_serdev_do_lookup(adev, &lookup);
|
||||||
|
+ if (ret)
|
||||||
|
+ return ret;
|
||||||
|
+
|
||||||
|
+ /* Make sure controller and ResourceSource handle match */
|
||||||
|
+ if (ACPI_HANDLE(ctrl->dev.parent) != lookup.controller_handle)
|
||||||
|
+ return -ENODEV;
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
static acpi_status acpi_serdev_add_device(acpi_handle handle, u32 level,
|
static acpi_status acpi_serdev_register_device(struct serdev_controller *ctrl,
|
||||||
void *data, void **return_value)
|
- struct acpi_device *adev)
|
||||||
|
+ struct acpi_device *adev)
|
||||||
{
|
{
|
||||||
@@ -535,6 +610,9 @@ static acpi_status acpi_serdev_add_device(acpi_handle handle, u32 level,
|
- struct serdev_device *serdev = NULL;
|
||||||
|
+ struct serdev_device *serdev;
|
||||||
|
int err;
|
||||||
|
|
||||||
|
- if (acpi_bus_get_status(adev) || !adev->status.present ||
|
||||||
|
- acpi_device_enumerated(adev))
|
||||||
|
- return AE_OK;
|
||||||
|
-
|
||||||
|
serdev = serdev_device_alloc(ctrl);
|
||||||
|
if (!serdev) {
|
||||||
|
dev_err(&ctrl->dev, "failed to allocate serdev device for %s\n",
|
||||||
|
@@ -527,7 +608,7 @@ static acpi_status acpi_serdev_register_device(struct serdev_controller *ctrl,
|
||||||
|
}
|
||||||
|
|
||||||
|
static acpi_status acpi_serdev_add_device(acpi_handle handle, u32 level,
|
||||||
|
- void *data, void **return_value)
|
||||||
|
+ void *data, void **return_value)
|
||||||
|
{
|
||||||
|
struct serdev_controller *ctrl = data;
|
||||||
|
struct acpi_device *adev;
|
||||||
|
@@ -535,22 +616,28 @@ static acpi_status acpi_serdev_add_device(acpi_handle handle, u32 level,
|
||||||
if (acpi_bus_get_device(handle, &adev))
|
if (acpi_bus_get_device(handle, &adev))
|
||||||
return AE_OK;
|
return AE_OK;
|
||||||
|
|
||||||
+ if (acpi_device_enumerated(adev))
|
+ if (acpi_device_enumerated(adev))
|
||||||
+ return AE_OK;
|
+ return AE_OK;
|
||||||
|
+
|
||||||
|
+ if (acpi_serdev_check_resources(ctrl, adev))
|
||||||
|
+ return AE_OK;
|
||||||
+
|
+
|
||||||
return acpi_serdev_register_device(ctrl, adev);
|
return acpi_serdev_register_device(ctrl, adev);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -552,6 +630,15 @@ static int acpi_serdev_register_devices(struct serdev_controller *ctrl)
|
|
||||||
if (ACPI_FAILURE(status))
|
|
||||||
dev_dbg(&ctrl->dev, "failed to enumerate serdev slaves\n");
|
|
||||||
|
|
||||||
+ if (!ctrl->serdev) {
|
|
||||||
+ status = acpi_serdev_register_devices_from_resources(handle, ctrl);
|
|
||||||
+ if (ACPI_FAILURE(status)) {
|
|
||||||
+ dev_dbg(&ctrl->dev,
|
|
||||||
+ "failed to register serdev slaves from resources: %x\n",
|
|
||||||
+ status);
|
|
||||||
+ }
|
|
||||||
+ }
|
|
||||||
+
|
+
|
||||||
if (!ctrl->serdev)
|
static int acpi_serdev_register_devices(struct serdev_controller *ctrl)
|
||||||
|
{
|
||||||
|
acpi_status status;
|
||||||
|
- acpi_handle handle;
|
||||||
|
|
||||||
|
- handle = ACPI_HANDLE(ctrl->dev.parent);
|
||||||
|
- if (!handle)
|
||||||
|
+ if (!has_acpi_companion(ctrl->dev.parent))
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
||||||
|
- status = acpi_walk_namespace(ACPI_TYPE_DEVICE, handle, 1,
|
||||||
|
+ status = acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
|
||||||
|
+ SERDEV_ACPI_MAX_SCAN_DEPTH,
|
||||||
|
acpi_serdev_add_device, NULL, ctrl, NULL);
|
||||||
|
if (ACPI_FAILURE(status))
|
||||||
|
- dev_dbg(&ctrl->dev, "failed to enumerate serdev slaves\n");
|
||||||
|
+ dev_warn(&ctrl->dev, "failed to enumerate serdev slaves\n");
|
||||||
|
|
||||||
|
if (!ctrl->serdev)
|
||||||
|
return -ENODEV;
|
||||||
--
|
--
|
||||||
2.23.0
|
2.23.0
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
From c6a20eb579cd118678600940712e0bd7a9ec15f4 Mon Sep 17 00:00:00 2001
|
From 923a99d54f1ff3c9d2855fed9bcf8e362c2b844a Mon Sep 17 00:00:00 2001
|
||||||
From: kitakar5525 <34676735+kitakar5525@users.noreply.github.com>
|
From: kitakar5525 <34676735+kitakar5525@users.noreply.github.com>
|
||||||
Date: Fri, 20 Sep 2019 01:03:29 +0900
|
Date: Fri, 20 Sep 2019 01:03:29 +0900
|
||||||
Subject: [PATCH 02/12] suspend
|
Subject: [PATCH 02/12] suspend
|
||||||
|
@ -14,7 +14,7 @@ Subject: [PATCH 02/12] suspend
|
||||||
7 files changed, 182 insertions(+), 6 deletions(-)
|
7 files changed, 182 insertions(+), 6 deletions(-)
|
||||||
|
|
||||||
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
|
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
|
||||||
index ae0b01059..d3bcfead9 100644
|
index ae0b01059fc6..d3bcfead964e 100644
|
||||||
--- a/drivers/nvme/host/core.c
|
--- a/drivers/nvme/host/core.c
|
||||||
+++ b/drivers/nvme/host/core.c
|
+++ b/drivers/nvme/host/core.c
|
||||||
@@ -1028,15 +1028,15 @@ static struct nvme_id_ns *nvme_identify_ns(struct nvme_ctrl *ctrl,
|
@@ -1028,15 +1028,15 @@ static struct nvme_id_ns *nvme_identify_ns(struct nvme_ctrl *ctrl,
|
||||||
|
@ -81,7 +81,7 @@ index ae0b01059..d3bcfead9 100644
|
||||||
* Initialize a NVMe controller structures. This needs to be called during
|
* Initialize a NVMe controller structures. This needs to be called during
|
||||||
* earliest initialization so that we have the initialized structured around
|
* earliest initialization so that we have the initialized structured around
|
||||||
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
|
diff --git a/drivers/nvme/host/nvme.h b/drivers/nvme/host/nvme.h
|
||||||
index 2653e1f41..3bcd14a28 100644
|
index 2653e1f4196d..3bcd14a28e32 100644
|
||||||
--- a/drivers/nvme/host/nvme.h
|
--- a/drivers/nvme/host/nvme.h
|
||||||
+++ b/drivers/nvme/host/nvme.h
|
+++ b/drivers/nvme/host/nvme.h
|
||||||
@@ -433,6 +433,7 @@ void nvme_complete_async_event(struct nvme_ctrl *ctrl, __le16 status,
|
@@ -433,6 +433,7 @@ void nvme_complete_async_event(struct nvme_ctrl *ctrl, __le16 status,
|
||||||
|
@ -106,7 +106,7 @@ index 2653e1f41..3bcd14a28 100644
|
||||||
void nvme_stop_keep_alive(struct nvme_ctrl *ctrl);
|
void nvme_stop_keep_alive(struct nvme_ctrl *ctrl);
|
||||||
int nvme_reset_ctrl(struct nvme_ctrl *ctrl);
|
int nvme_reset_ctrl(struct nvme_ctrl *ctrl);
|
||||||
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
|
diff --git a/drivers/nvme/host/pci.c b/drivers/nvme/host/pci.c
|
||||||
index a64a8bca0..8ab9abfd6 100644
|
index a64a8bca0d5b..8ab9abfd68b0 100644
|
||||||
--- a/drivers/nvme/host/pci.c
|
--- a/drivers/nvme/host/pci.c
|
||||||
+++ b/drivers/nvme/host/pci.c
|
+++ b/drivers/nvme/host/pci.c
|
||||||
@@ -26,6 +26,7 @@
|
@@ -26,6 +26,7 @@
|
||||||
|
@ -268,7 +268,7 @@ index a64a8bca0..8ab9abfd6 100644
|
||||||
.err_handler = &nvme_err_handler,
|
.err_handler = &nvme_err_handler,
|
||||||
};
|
};
|
||||||
diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
|
diff --git a/drivers/pci/pcie/aspm.c b/drivers/pci/pcie/aspm.c
|
||||||
index 1117b25fb..5d7d30f72 100644
|
index 1117b25fbe0b..5d7d30f72ea8 100644
|
||||||
--- a/drivers/pci/pcie/aspm.c
|
--- a/drivers/pci/pcie/aspm.c
|
||||||
+++ b/drivers/pci/pcie/aspm.c
|
+++ b/drivers/pci/pcie/aspm.c
|
||||||
@@ -1176,6 +1176,26 @@ static int pcie_aspm_get_policy(char *buffer, const struct kernel_param *kp)
|
@@ -1176,6 +1176,26 @@ static int pcie_aspm_get_policy(char *buffer, const struct kernel_param *kp)
|
||||||
|
@ -299,7 +299,7 @@ index 1117b25fb..5d7d30f72 100644
|
||||||
static ssize_t link_state_show(struct device *dev,
|
static ssize_t link_state_show(struct device *dev,
|
||||||
struct device_attribute *attr,
|
struct device_attribute *attr,
|
||||||
diff --git a/include/linux/pci.h b/include/linux/pci.h
|
diff --git a/include/linux/pci.h b/include/linux/pci.h
|
||||||
index b1f297f4b..94ab2fc80 100644
|
index b1f297f4b7b0..94ab2fc800d3 100644
|
||||||
--- a/include/linux/pci.h
|
--- a/include/linux/pci.h
|
||||||
+++ b/include/linux/pci.h
|
+++ b/include/linux/pci.h
|
||||||
@@ -1486,8 +1486,10 @@ extern bool pcie_ports_native;
|
@@ -1486,8 +1486,10 @@ extern bool pcie_ports_native;
|
||||||
|
@ -314,7 +314,7 @@ index b1f297f4b..94ab2fc80 100644
|
||||||
|
|
||||||
#ifdef CONFIG_PCIEAER
|
#ifdef CONFIG_PCIEAER
|
||||||
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
|
diff --git a/kernel/power/suspend.c b/kernel/power/suspend.c
|
||||||
index 0bd595a0b..a8385e889 100644
|
index 0bd595a0b610..a8385e8894a5 100644
|
||||||
--- a/kernel/power/suspend.c
|
--- a/kernel/power/suspend.c
|
||||||
+++ b/kernel/power/suspend.c
|
+++ b/kernel/power/suspend.c
|
||||||
@@ -526,6 +526,8 @@ int suspend_devices_and_enter(suspend_state_t state)
|
@@ -526,6 +526,8 @@ int suspend_devices_and_enter(suspend_state_t state)
|
||||||
|
@ -343,7 +343,7 @@ index 0bd595a0b..a8385e889 100644
|
||||||
pm_notifier_call_chain(PM_POST_SUSPEND);
|
pm_notifier_call_chain(PM_POST_SUSPEND);
|
||||||
pm_restore_console();
|
pm_restore_console();
|
||||||
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
|
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
|
||||||
index f8576509c..a5fa80e72 100644
|
index f8576509c7be..a5fa80e72aba 100644
|
||||||
--- a/kernel/sysctl.c
|
--- a/kernel/sysctl.c
|
||||||
+++ b/kernel/sysctl.c
|
+++ b/kernel/sysctl.c
|
||||||
@@ -313,7 +313,16 @@ static int min_extfrag_threshold;
|
@@ -313,7 +313,16 @@ static int min_extfrag_threshold;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
From 55d520718530c27a92b8ccd347944a819a35573d Mon Sep 17 00:00:00 2001
|
From a947d578c2157f9716c210f0e68b9faf702cee95 Mon Sep 17 00:00:00 2001
|
||||||
From: Maximilian Luz <luzmaximilian@gmail.com>
|
From: Maximilian Luz <luzmaximilian@gmail.com>
|
||||||
Date: Fri, 26 Jul 2019 03:42:15 +0200
|
Date: Fri, 26 Jul 2019 03:42:15 +0200
|
||||||
Subject: [PATCH 03/12] buttons
|
Subject: [PATCH 03/12] buttons
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
From c54f6acd2d773d40cc4661626cf46600236d664e Mon Sep 17 00:00:00 2001
|
From 5836c0ea417498e1df63060c47491b7c0241c19c Mon Sep 17 00:00:00 2001
|
||||||
From: Maximilian Luz <luzmaximilian@gmail.com>
|
From: Maximilian Luz <luzmaximilian@gmail.com>
|
||||||
Date: Fri, 26 Jul 2019 03:42:25 +0200
|
Date: Fri, 26 Jul 2019 03:42:25 +0200
|
||||||
Subject: [PATCH 04/12] cameras
|
Subject: [PATCH 04/12] cameras
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
From 694cb53bc941b057ead3a4bbaee31f6c0ffb652e Mon Sep 17 00:00:00 2001
|
From cc665f35444ce0cab5ba0f9da5e989ea517bcc3d Mon Sep 17 00:00:00 2001
|
||||||
From: kitakar5525 <34676735+kitakar5525@users.noreply.github.com>
|
From: kitakar5525 <34676735+kitakar5525@users.noreply.github.com>
|
||||||
Date: Tue, 10 Sep 2019 21:52:46 +0900
|
Date: Tue, 10 Sep 2019 21:52:46 +0900
|
||||||
Subject: [PATCH 05/12] ipts
|
Subject: [PATCH 05/12] ipts
|
||||||
|
@ -6830,5 +6830,5 @@ index 000000000000..bad44fb4f233
|
||||||
+
|
+
|
||||||
+#endif // INTEL_IPTS_IF_H
|
+#endif // INTEL_IPTS_IF_H
|
||||||
--
|
--
|
||||||
2.21.0
|
2.23.0
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
From ca73cbce514e2cd502e31ec6fad9e1b25944adea Mon Sep 17 00:00:00 2001
|
From e1b717f5ba34c91652ac4ace6dd3a052f22fe8fa Mon Sep 17 00:00:00 2001
|
||||||
From: Maximilian Luz <luzmaximilian@gmail.com>
|
From: Maximilian Luz <luzmaximilian@gmail.com>
|
||||||
Date: Fri, 26 Jul 2019 03:42:50 +0200
|
Date: Fri, 26 Jul 2019 03:42:50 +0200
|
||||||
Subject: [PATCH 06/12] hid
|
Subject: [PATCH 06/12] hid
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
From 100972e56970a25b066cc645b53804973533b078 Mon Sep 17 00:00:00 2001
|
From f7e830e9921af9f5c41c9072228b5fd350b9dbe0 Mon Sep 17 00:00:00 2001
|
||||||
From: Maximilian Luz <luzmaximilian@gmail.com>
|
From: Maximilian Luz <luzmaximilian@gmail.com>
|
||||||
Date: Fri, 26 Jul 2019 03:43:03 +0200
|
Date: Fri, 26 Jul 2019 03:43:03 +0200
|
||||||
Subject: [PATCH 07/12] sdcard-reader
|
Subject: [PATCH 07/12] sdcard-reader
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
From b28a98e8f7dd0f722b489994c698f9cce67f1c3f Mon Sep 17 00:00:00 2001
|
From 864b502d2d415f172f740ae94c45b5761d6d75d7 Mon Sep 17 00:00:00 2001
|
||||||
From: Maximilian Luz <luzmaximilian@gmail.com>
|
From: Maximilian Luz <luzmaximilian@gmail.com>
|
||||||
Date: Fri, 26 Jul 2019 03:43:14 +0200
|
Date: Fri, 26 Jul 2019 03:43:14 +0200
|
||||||
Subject: [PATCH 08/12] wifi
|
Subject: [PATCH 08/12] wifi
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
From c0b0a5889cd97946e8e8f91f03620e69c7adf812 Mon Sep 17 00:00:00 2001
|
From fef9c9b2ab0c5ce0293d55fca60af3c533236277 Mon Sep 17 00:00:00 2001
|
||||||
From: Maximilian Luz <luzmaximilian@gmail.com>
|
From: Maximilian Luz <luzmaximilian@gmail.com>
|
||||||
Date: Fri, 26 Jul 2019 03:43:27 +0200
|
Date: Fri, 26 Jul 2019 03:43:27 +0200
|
||||||
Subject: [PATCH 09/12] surface3-power
|
Subject: [PATCH 09/12] surface3-power
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
From f5710257f7bc180b95e79ad5577d6f1dca0399f7 Mon Sep 17 00:00:00 2001
|
From e7ef557dbd9377d0bb9f13105aea5fdfc9504938 Mon Sep 17 00:00:00 2001
|
||||||
From: Maximilian Luz <luzmaximilian@gmail.com>
|
From: Maximilian Luz <luzmaximilian@gmail.com>
|
||||||
Date: Fri, 26 Jul 2019 03:43:45 +0200
|
Date: Fri, 26 Jul 2019 03:43:45 +0200
|
||||||
Subject: [PATCH 10/12] mwlwifi
|
Subject: [PATCH 10/12] mwlwifi
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
From ca60cf39c24994a633314b5c243b02cc2e415e9d Mon Sep 17 00:00:00 2001
|
From d33e91a8cda210baca6be95c4a9bad6ce0b6d6a0 Mon Sep 17 00:00:00 2001
|
||||||
From: Maximilian Luz <luzmaximilian@gmail.com>
|
From: Maximilian Luz <luzmaximilian@gmail.com>
|
||||||
Date: Fri, 26 Jul 2019 03:43:57 +0200
|
Date: Fri, 26 Jul 2019 03:43:57 +0200
|
||||||
Subject: [PATCH 11/12] surface-lte
|
Subject: [PATCH 11/12] surface-lte
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
From 18e4ba6b37b44e0756a74ef32b9ba57b85ec3f8c Mon Sep 17 00:00:00 2001
|
From 17ee2f0c452d83790d80157fa34703b80ffe6d64 Mon Sep 17 00:00:00 2001
|
||||||
From: Maximilian Luz <luzmaximilian@gmail.com>
|
From: Maximilian Luz <luzmaximilian@gmail.com>
|
||||||
Date: Fri, 26 Jul 2019 03:44:10 +0200
|
Date: Fri, 26 Jul 2019 03:44:10 +0200
|
||||||
Subject: [PATCH 12/12] surfacebook2-dgpu
|
Subject: [PATCH 12/12] surfacebook2-dgpu
|
||||||
|
|
Loading…
Reference in a new issue