From 8536fee6a9b3d291bf94dec261e3b5c6ae5d757a Mon Sep 17 00:00:00 2001 From: pharra <940530348@qq.com> Date: Sun, 11 Mar 2018 14:03:32 +0800 Subject: [PATCH] merge && update PKGBUILD to 4.15.8 --- build/PKGBUILD | 10 +-- build/keyboards_and_covers.patch | 6 +- build/surfaceacpi.patch | 125 ++++++++++++++++++++++++++----- 3 files changed, 114 insertions(+), 27 deletions(-) diff --git a/build/PKGBUILD b/build/PKGBUILD index a34be025396d..b3380623bda0 100644 --- a/build/PKGBUILD +++ b/build/PKGBUILD @@ -5,8 +5,8 @@ #pkgbase=linux # Build stock -ARCH kernel pkgbase=linux-surface4 # Build kernel with a different name -_srcname=linux-4.15.7 -pkgver=4.15.7 +_srcname=linux-4.15.8 +pkgver=4.15.8 pkgrel=1 arch=('x86_64') url="https://www.kernel.org/" @@ -38,12 +38,12 @@ validpgpkeys=( sha256sums=('4ae8db7dc5d5e7a689d11d432218fe30d315df8aa758bfadb51df151c4270100' 'ee28626aa83b288f3e02bc4bfc49fcca969cbb258da5bdb82da1fdd66aa306bd' '0bed4921cdc68844b30fb1f53013ac5f049f0a898e15b2224d2487a1f7835d7b' - '8af33d10b75c86b9600b0e1b7840068e5586f2fe3a0485d7516fb7d02824fed0' + '0126184f0d838695261f2e9a6aed6bd68ccea3cdb8091e8c17f7a28b688c2a82' 'bddae8572686ffe1d3b2f09786a710fc45287952d0e14a17602f128219a0f2fc' - '2f36484caa93a143f8c797f7a1fdaa379b37fa548c36f960f174ba7cddf5afb3' + '26c32b36e19c8d8f308f11146d3dc21de66e92f12524600f4089770b8674b894' '55d40252020d888b5154b9fe05a95084f045e8393b113e96253b7a198d57bb8b' '82d0fa48947aff93cbbc9a0f0f3020bf95e860d604549b20f7ef8e1634798bd8' - 'cd44df4b23a3e0edc14be63df95d768b9600b31c35be05fb89f93226907fc8c6' + '8ac071c4f7cd6d7673a6d98c3c58d138db1d0b2dc56f0b3c427e53ee9f99605a' 'SKIP' '6d4c92e9c6c2f495598daf48ce881553ff751c7e64334dbeffae13f4440111a5' 'ae2e95db94ef7176207c690224169594d49445e04249d2499e9d2fbc117a0b21' diff --git a/build/keyboards_and_covers.patch b/build/keyboards_and_covers.patch index 9a41d2643b71..a3a1f773900d 100644 --- a/build/keyboards_and_covers.patch +++ b/build/keyboards_and_covers.patch @@ -25,7 +25,7 @@ index a0baa5b..3e03ced8 100644 +#define USB_DEVICE_ID_MS_SURFACE_BOOK 0x07cd +#define USB_DEVICE_ID_MS_SURFACE_BOOK_2 0x0922 +#define USB_DEVICE_ID_MS_SURFACE_LAPTOP 0xf001 -+#define HID_DEVICE_ID_MS_SURFACE_LAPTOP 0x0064 ++#define HID_DEVICE_ID_MS_SURFACE_LAPTOP 0xf001 +#define USB_DEVICE_ID_MS_POWER_COVER 0x07da #define USB_VENDOR_ID_MOJO 0x8282 @@ -81,8 +81,8 @@ index 65ea23b..00ce3be 100644 + + /* Microsoft Surface Laptop */ + { .driver_data = MT_CLS_EXPORT_ALL_INPUTS, -+ HID_DEVICE(BUS_I2C, HID_GROUP_ANY, -+ USB_DEVICE_ID_MS_SURFACE_LAPTOP, ++ HID_DEVICE(HID_BUS_ANY, HID_GROUP_ANY, ++ USB_VENDOR_ID_MICROSOFT, + HID_DEVICE_ID_MS_SURFACE_LAPTOP) }, + + /* Microsoft Power Cover */ diff --git a/build/surfaceacpi.patch b/build/surfaceacpi.patch index 7bb009c4a2b6..0042e6cdbec8 100644 --- a/build/surfaceacpi.patch +++ b/build/surfaceacpi.patch @@ -32,10 +32,10 @@ index c32b34a..6b04d7f 100644 obj-$(CONFIG_INTEL_TELEMETRY) += intel_telemetry_core.o \ diff --git a/drivers/platform/x86/surface_acpi.c b/drivers/platform/x86/surface_acpi.c new file mode 100644 -index 0000000..f9666d9 +index 0000000..4989d67 --- /dev/null +++ b/drivers/platform/x86/surface_acpi.c -@@ -0,0 +1,345 @@ +@@ -0,0 +1,432 @@ +/* + * surface_acpi.c - Microsoft Surface ACPI Notify + * @@ -54,7 +54,6 @@ index 0000000..f9666d9 + */ + +#define SURFACE_ACPI_VERSION "0.1" -+#define SURFACE_EVENT_GUID "93b666c5-70c6-469f-a215-3d487c91ab3c" +#define SURFACE_GEN_VERSION 0x08 +#define PROC_SURFACE "surface" + @@ -75,6 +74,7 @@ index 0000000..f9666d9 + +#define SUR_METHOD_DSM "_DSM" +#define SUR_METHOD_REG "_REG" ++#define SUR_METHOD_STA "_STA" + +#define SUR_QUERY_DEVICE 0x00 +#define SUR_SET_DVER 0x01 @@ -90,7 +90,15 @@ index 0000000..f9666d9 +#define REG_AVAILABLE 0x01 +#define REG_INIT 0x09 + ++static char SURFACE_EVENT_GUID[] = "93b666c5-70c6-469f-a215-3d487c91ab3c"; ++static char SUR_SAN_RQST[] = "\\_SB._SAN.RQST"; ++static char SUR_SAN_RQSX[] = "\\_SB._SAN.RQSX"; ++ +struct surface_acpi_dev { ++ acpi_handle handle; ++ acpi_handle rqst_handle; ++ acpi_handle rqsx_handle; ++ + struct acpi_device *acpi_dev; + struct acpi_device *bat1_dev; + struct acpi_device *bat2_dev; @@ -105,7 +113,28 @@ index 0000000..f9666d9 + +static struct proc_dir_entry *surface_proc_dir; + -+static int surface_acpi_reg(void) ++static acpi_status surface_acpi_check_status(void) ++{ ++ unsigned long long value; ++ acpi_status status; ++ ++ if (acpi_has_method(surface_acpi->handle, SUR_METHOD_STA)) { ++ status = acpi_evaluate_integer(surface_acpi->handle, ++ SUR_METHOD_STA, NULL, &value); ++ ++ if (ACPI_FAILURE(status)) { ++ pr_err("surface_acpi: ACPI event failure status %s\n", ++ acpi_format_exception(status)); ++ return AE_ERROR; ++ } ++ } ++ else ++ return AE_NOT_FOUND; ++ ++ return AE_OK; ++} ++ ++static acpi_status surface_acpi_reg(void) +{ + union acpi_object in_objs[2], out_objs[1]; + struct acpi_object_list params; @@ -121,8 +150,8 @@ index 0000000..f9666d9 + results.length = sizeof(out_objs); + results.pointer = out_objs; + -+ if (acpi_has_method(surface_acpi->acpi_dev->handle, SUR_METHOD_REG)) { -+ status = acpi_evaluate_object(surface_acpi->acpi_dev->handle, ++ if (acpi_has_method(surface_acpi->handle, SUR_METHOD_REG)) { ++ status = acpi_evaluate_object(surface_acpi->handle, + SUR_METHOD_REG, ¶ms, &results); + + if (ACPI_FAILURE(status)) { @@ -137,7 +166,7 @@ index 0000000..f9666d9 + return AE_OK; +} + -+static int surface_acpi_event_handler(u32 event) ++static acpi_status surface_acpi_event_handler(u32 event) +{ + union acpi_object in_objs[4], out_objs[5]; + struct acpi_object_list params; @@ -146,19 +175,21 @@ index 0000000..f9666d9 + + params.count = ARRAY_SIZE(in_objs); + params.pointer = in_objs; -+ in_objs[0].type = ACPI_TYPE_STRING; -+ in_objs[0].string.pointer = SURFACE_EVENT_GUID; ++ in_objs[0].type = ACPI_TYPE_BUFFER; ++ in_objs[0].buffer.length = sizeof(SURFACE_EVENT_GUID); ++ in_objs[0].buffer.pointer = SURFACE_EVENT_GUID; + in_objs[1].type = ACPI_TYPE_INTEGER; + in_objs[1].integer.value = SUR_QUERY_DEVICE; + in_objs[2].type = ACPI_TYPE_INTEGER; + in_objs[2].integer.value = event; -+ in_objs[3].type = ACPI_TYPE_INTEGER; -+ in_objs[3].integer.value = SURFACE_GEN_VERSION; ++ in_objs[3].type = ACPI_TYPE_PACKAGE; ++ in_objs[3].package.count = 0; ++ in_objs[3].package.elements = SURFACE_GEN_VERSION; + results.length = sizeof(out_objs); + results.pointer = out_objs; + -+ if (acpi_has_method(surface_acpi->acpi_dev->handle, SUR_METHOD_DSM)) { -+ status = acpi_evaluate_object(surface_acpi->acpi_dev->handle, ++ if (acpi_has_method(surface_acpi->handle, SUR_METHOD_DSM)) { ++ status = acpi_evaluate_object(surface_acpi->handle, + SUR_METHOD_DSM, ¶ms, &results); + + if (ACPI_FAILURE(status)) { @@ -175,7 +206,7 @@ index 0000000..f9666d9 + +static void surface_acpi_load(void) +{ -+ int ret; ++ acpi_status ret; + + ret = surface_acpi_event_handler(SUR_SET_DVER); + if (ACPI_FAILURE(ret)) @@ -300,6 +331,59 @@ index 0000000..f9666d9 + remove_proc_entry("version", surface_proc_dir); +} + ++static void surface_acpi_notify(struct acpi_device *dev, u32 event) ++{ ++ pr_info("surface_acpi: Event received %x\n", event); ++} ++ ++static void surface_acpi_register_rqst_handler(void) ++{ ++ acpi_status status; ++ ++ status = acpi_get_handle(NULL, SUR_SAN_RQST, &surface_acpi->rqst_handle); ++ if (ACPI_FAILURE(status)) { ++ pr_err("surface_acpi: ACPI event failure status %s\n", ++ acpi_format_exception(status)); ++ } ++} ++ ++static void surface_acpi_register_rqsx_handler(void) ++{ ++ acpi_status status; ++ ++ status = acpi_get_handle(NULL, SUR_SAN_RQSX, &surface_acpi->rqsx_handle); ++ if (ACPI_FAILURE(status)) { ++ pr_err("surface_acpi: ACPI event failure status %s\n", ++ acpi_format_exception(status)); ++ } ++} ++ ++static acpi_status surface_acpi_walk_callback(acpi_handle handle, u32 level, ++ void *context, void **return_value) ++{ ++ struct acpi_device_info *info; ++ ++ if (ACPI_SUCCESS(acpi_get_object_info(handle, &info))) { ++ pr_warn("method: name: %4.4s, args %X\n", ++ (char *)&info->name, info->param_count); ++ ++ kfree(info); ++ } ++ ++ return AE_OK; ++} ++ ++static void surface_acpi_walk_namespace(void) ++{ ++ acpi_status status; ++ ++ status = acpi_walk_namespace(ACPI_TYPE_METHOD, ++ surface_acpi->handle, 1, surface_acpi_walk_callback, ++ NULL, NULL, NULL); ++ if (ACPI_FAILURE(status)) ++ pr_warn("surface_acpi: Unable to walk acpi resources\n"); ++} ++ +static int surface_acpi_add(struct acpi_device *acpi_dev) +{ + if (surface_acpi) @@ -313,6 +397,14 @@ index 0000000..f9666d9 + return AE_NO_MEMORY; + + surface_acpi->acpi_dev = acpi_dev; ++ surface_acpi->handle = acpi_dev->handle; ++ ++ surface_acpi_register_rqst_handler(); ++ surface_acpi_register_rqsx_handler(); ++ ++ surface_acpi_check_status(); ++ ++ surface_acpi_walk_namespace(); + + surface_acpi_reg(); + @@ -330,11 +422,6 @@ index 0000000..f9666d9 + return AE_OK; +} + -+static void surface_acpi_notify(struct acpi_device *dev, u32 event) -+{ -+ pr_info("surface_acpi: Event received %x\n", event); -+} -+ +static const struct acpi_device_id surface_device_ids[] = { + {"MSHW0091", 0}, + {"", 0},