Quellcode durchsuchen

Update surface-acpi and button patches

qzed vor 6 Jahren
Ursprung
Commit
002a33b6f0

+ 65 - 132
patches/4.19/0001-surface-acpi.patch

@@ -1,6 +1,6 @@
-From 7f076647666f2fb8a04f573ab46b17ddd674590b Mon Sep 17 00:00:00 2001
-From: Jake Day <jake@ninebysix.com>
-Date: Wed, 26 Jun 2019 20:42:34 -0400
+From e9f55e5da497d27e0908cbffd3ecd0e8f1369ddb Mon Sep 17 00:00:00 2001
+From: Maximilian Luz <luzmaximilian@gmail.com>
+Date: Tue, 2 Jul 2019 23:43:58 +0200
 Subject: [PATCH 01/11] surface-acpi
 
 ---
@@ -8,9 +8,9 @@ Subject: [PATCH 01/11] surface-acpi
  drivers/acpi/acpica/exfield.c       |   26 +-
  drivers/platform/x86/Kconfig        |   97 +
  drivers/platform/x86/Makefile       |    1 +
- drivers/platform/x86/surface_acpi.c | 3828 +++++++++++++++++++++++++++
+ drivers/platform/x86/surface_acpi.c | 3761 +++++++++++++++++++++++++++
  drivers/tty/serdev/core.c           |   90 +-
- 6 files changed, 4025 insertions(+), 19 deletions(-)
+ 6 files changed, 3958 insertions(+), 19 deletions(-)
  create mode 100644 drivers/platform/x86/surface_acpi.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
 diff --git a/drivers/platform/x86/surface_acpi.c b/drivers/platform/x86/surface_acpi.c
 new file mode 100644
-index 000000000000..b57ab7111e90
+index 000000000000..2874cc85213a
 --- /dev/null
 +++ b/drivers/platform/x86/surface_acpi.c
-@@ -0,0 +1,3828 @@
+@@ -0,0 +1,3761 @@
 +#include <asm/unaligned.h>
 +#include <linux/acpi.h>
 +#include <linux/completion.h>
@@ -293,8 +293,7 @@ index 000000000000..b57ab7111e90
 +typedef int (*surfacegen5_ec_event_handler_fn)(struct surfacegen5_event *event, void *data);
 +typedef unsigned long (*surfacegen5_ec_event_handler_delay)(struct surfacegen5_event *event, void *data);
 +
-+struct device_link *surfacegen5_ec_consumer_add(struct device *consumer, u32 flags);
-+int surfacegen5_ec_consumer_remove(struct device_link *link);
++int surfacegen5_ec_consumer_register(struct device *consumer);
 +
 +int surfacegen5_ec_rqst(const struct surfacegen5_rqst *rqst, struct surfacegen5_buf *result);
 +
@@ -555,31 +554,22 @@ index 000000000000..b57ab7111e90
 +	return ec;
 +}
 +
-+struct device_link *surfacegen5_ec_consumer_add(struct device *consumer, u32 flags)
++int surfacegen5_ec_consumer_register(struct device *consumer)
 +{
++	u32 flags = DL_FLAG_PM_RUNTIME | DL_FLAG_AUTOREMOVE_CONSUMER;
 +	struct surfacegen5_ec *ec;
 +	struct device_link *link;
 +
 +	ec = surfacegen5_ec_acquire_init();
 +	if (!ec) {
-+		return ERR_PTR(-ENXIO);
++		return -ENXIO;
 +	}
 +
 +	link = device_link_add(consumer, &ec->serdev->dev, flags);
-+
-+	surfacegen5_ec_release(ec);
-+	return link;
-+}
-+
-+int surfacegen5_ec_consumer_remove(struct device_link *link)
-+{
-+	struct surfacegen5_ec *ec = surfacegen5_ec_acquire_init();
-+	if (!ec) {
-+		return -ENXIO;
++	if (!link) {
++		return -EFAULT;
 +	}
 +
-+	device_link_del(link);
-+
 +	surfacegen5_ec_release(ec);
 +	return 0;
 +}
@@ -2078,15 +2068,19 @@ index 000000000000..b57ab7111e90
 +	struct device *dev;
 +};
 +
++struct surfacegen5_san_consumer_link {
++	const struct surfacegen5_san_acpi_consumer *properties;
++	struct device_link                         *link;
++};
++
 +struct surfacegen5_san_consumers {
-+	u32                  num;
-+	struct device_link **links;
++	u32                                   num;
++	struct surfacegen5_san_consumer_link *links;
 +};
 +
 +struct surfacegen5_san_drvdata {
 +	struct surfacegen5_san_opreg_context opreg_ctx;
 +	struct surfacegen5_san_consumers     consumers;
-+	struct device_link                  *ec_link;
 +};
 +
 +struct gsb_data_in {
@@ -2535,7 +2529,7 @@ index 000000000000..b57ab7111e90
 +                                          struct surfacegen5_san_consumers *out)
 +{
 +	const struct surfacegen5_san_acpi_consumer *con;
-+	struct device_link **links, **link;
++	struct surfacegen5_san_consumer_link *links, *link;
 +	struct acpi_device *adev;
 +	acpi_handle handle;
 +	u32 max_links = 0;
@@ -2551,7 +2545,7 @@ index 000000000000..b57ab7111e90
 +	}
 +
 +	// allocate
-+	links = kzalloc(max_links * sizeof(struct device_link *), GFP_KERNEL);
++	links = kzalloc(max_links * sizeof(struct surfacegen5_san_consumer_link), GFP_KERNEL);
 +	link = &links[0];
 +
 +	if (!links) {
@@ -2575,11 +2569,12 @@ index 000000000000..b57ab7111e90
 +			goto consumers_link_cleanup;
 +		}
 +
-+		*link = device_link_add(&adev->dev, &pdev->dev, con->flags);
-+		if (!(*link)) {
++		link->link = device_link_add(&adev->dev, &pdev->dev, con->flags);
++		if (!(link->link)) {
 +			status = -EFAULT;
 +			goto consumers_link_cleanup;
 +		}
++		link->properties = con;
 +
 +		link += 1;
 +	}
@@ -2591,7 +2586,9 @@ index 000000000000..b57ab7111e90
 +
 +consumers_link_cleanup:
 +	for (link = link - 1; link >= links; --link) {
-+		device_link_del(*link);
++		if (link->properties->flags & DL_FLAG_STATELESS) {
++			device_link_del(link->link);
++		}
 +	}
 +
 +	return status;
@@ -2605,7 +2602,9 @@ index 000000000000..b57ab7111e90
 +	}
 +
 +	for (i = 0; i < consumers->num; ++i) {
-+		device_link_del(consumers->links[i]);
++		if (consumers->links[i].properties->flags & DL_FLAG_STATELESS) {
++			device_link_del(consumers->links[i].link);
++		}
 +	}
 +
 +	kfree(consumers->links);
@@ -2618,33 +2617,25 @@ index 000000000000..b57ab7111e90
 +{
 +	const struct surfacegen5_san_acpi_consumer *cons;
 +	struct surfacegen5_san_drvdata *drvdata;
-+	struct device_link *ec_link;
 +	acpi_handle san = ACPI_HANDLE(&pdev->dev);	// _SAN device node
 +	int status;
 +
-+	drvdata = kzalloc(sizeof(struct surfacegen5_san_drvdata), GFP_KERNEL);
-+	if (!drvdata) {
-+		return -ENOMEM;
-+	}
-+
 +	/*
 +	 * Defer probe if the _SSH driver has not set up the controller yet. This
 +	 * makes sure we do not fail any initial requests (e.g. _STA request without
 +	 * which the battery does not get set up correctly). Otherwise register as
 +	 * consumer to set up a device_link.
 +	 */
-+	ec_link = surfacegen5_ec_consumer_add(&pdev->dev, DL_FLAG_PM_RUNTIME);
-+	if (IS_ERR_OR_NULL(ec_link)) {
-+		if (PTR_ERR(ec_link) == -ENXIO) {
-+			status = -EPROBE_DEFER;
-+		} else {
-+			status = -EFAULT;
-+		}
++	status = surfacegen5_ec_consumer_register(&pdev->dev);
++	if (status) {
++		return status == -ENXIO ? -EPROBE_DEFER : status;
++	}
 +
-+		goto err_probe_ec_link;
++	drvdata = kzalloc(sizeof(struct surfacegen5_san_drvdata), GFP_KERNEL);
++	if (!drvdata) {
++		return -ENOMEM;
 +	}
 +
-+	drvdata->ec_link = ec_link;
 +	drvdata->opreg_ctx.dev = &pdev->dev;
 +
 +	cons = acpi_device_get_match_data(&pdev->dev);
@@ -2679,8 +2670,6 @@ index 000000000000..b57ab7111e90
 +	platform_set_drvdata(san, NULL);
 +	surfacegen5_san_consumers_unlink(&drvdata->consumers);
 +err_probe_consumers:
-+	surfacegen5_ec_consumer_remove(drvdata->ec_link);
-+err_probe_ec_link:
 +	kfree(drvdata);
 +	return status;
 +}
@@ -2695,7 +2684,6 @@ index 000000000000..b57ab7111e90
 +	surfacegen5_san_disable_events();
 +
 +	surfacegen5_san_consumers_unlink(&drvdata->consumers);
-+	surfacegen5_ec_consumer_remove(drvdata->ec_link);
 +	kfree(drvdata);
 +
 +	platform_set_drvdata(pdev, NULL);
@@ -2763,7 +2751,8 @@ index 000000000000..b57ab7111e90
 + * Request ID for VHF events. This value is based on the output of the Surface
 + * EC and should not be changed.
 + */
-+#define SG5_VHF_RQID			0x0001
++#define SG5_EVENT_VHF_RQID	0x0001
++#define SG5_EVENT_VHF_TC	0x08
 +
 +
 +struct surfacegen5_vhf_evtctx {
@@ -2772,7 +2761,6 @@ index 000000000000..b57ab7111e90
 +};
 +
 +struct surfacegen5_vhf_drvdata {
-+	struct device_link           *ec_link;
 +	struct surfacegen5_vhf_evtctx event_ctx;
 +};
 +
@@ -2936,27 +2924,20 @@ index 000000000000..b57ab7111e90
 +static int surfacegen5_acpi_vhf_probe(struct platform_device *pdev)
 +{
 +	struct surfacegen5_vhf_drvdata *drvdata;
-+	struct device_link *ec_link;
 +	struct hid_device *hid;
 +	int status;
 +
++	// add device link to EC
++	status = surfacegen5_ec_consumer_register(&pdev->dev);
++	if (status) {
++		return status == -ENXIO ? -EPROBE_DEFER : status;
++	}
++
 +	drvdata = kzalloc(sizeof(struct surfacegen5_vhf_drvdata), GFP_KERNEL);
 +	if (!drvdata) {
 +		return -ENOMEM;
 +	}
 +
-+	// add device link to EC
-+	ec_link = surfacegen5_ec_consumer_add(&pdev->dev, DL_FLAG_PM_RUNTIME);
-+	if (IS_ERR_OR_NULL(ec_link)) {
-+		if (PTR_ERR(ec_link) == -ENXIO) {
-+			status = -EPROBE_DEFER;
-+		} else {
-+			status = -EFAULT;
-+		}
-+
-+		goto err_probe_ec_link;
-+	}
-+
 +	hid = surfacegen5_vhf_create_hid_device(pdev);
 +	if (IS_ERR(hid)) {
 +		status = PTR_ERR(hid);
@@ -2968,7 +2949,6 @@ index 000000000000..b57ab7111e90
 +		goto err_add_hid;
 +	}
 +
-+	drvdata->ec_link = ec_link;
 +	drvdata->event_ctx.dev = &pdev->dev;
 +	drvdata->event_ctx.hid = hid;
 +
@@ -2979,7 +2959,7 @@ index 000000000000..b57ab7111e90
 +         * default, thus there should be no need to explicitly enable them.
 +	 */
 +	status = surfacegen5_ec_set_delayed_event_handler(
-+			SG5_VHF_RQID,
++			SG5_EVENT_VHF_RQID,
 +	                surfacegen5_vhf_event_handler,
 +	                surfacegen5_vhf_event_delay,
 +			&drvdata->event_ctx);
@@ -2987,14 +2967,19 @@ index 000000000000..b57ab7111e90
 +		goto err_add_hid;
 +	}
 +
++	status = surfacegen5_ec_enable_event_source(SG5_EVENT_VHF_TC, 0x01, SG5_EVENT_VHF_RQID);
++	if (status) {
++		goto err_event_source;
++	}
++
 +	return 0;
 +
++err_event_source:
++	surfacegen5_ec_remove_event_handler(SG5_EVENT_VHF_RQID);
 +err_add_hid:
 +	hid_destroy_device(hid);
 +	platform_set_drvdata(pdev, NULL);
 +err_probe_hid:
-+	surfacegen5_ec_consumer_remove(drvdata->ec_link);
-+err_probe_ec_link:
 +	kfree(drvdata);
 +	return status;
 +}
@@ -3003,10 +2988,10 @@ index 000000000000..b57ab7111e90
 +{
 +	struct surfacegen5_vhf_drvdata *drvdata = platform_get_drvdata(pdev);
 +
-+	surfacegen5_ec_remove_event_handler(SG5_VHF_RQID);
++	surfacegen5_ec_disable_event_source(SG5_EVENT_VHF_TC, 0x01, SG5_EVENT_VHF_RQID);
++	surfacegen5_ec_remove_event_handler(SG5_EVENT_VHF_RQID);
 +
 +	hid_destroy_device(drvdata->event_ctx.hid);
-+	surfacegen5_ec_consumer_remove(drvdata->ec_link);
 +	kfree(drvdata);
 +
 +	platform_set_drvdata(pdev, NULL);
@@ -3112,7 +3097,6 @@ index 000000000000..b57ab7111e90
 +	struct list_head client_list;
 +	struct mutex mutex;
 +	bool active;
-+	struct device_link *ec_link;
 +	spinlock_t input_lock;
 +	struct input_dev *input_dev;
 +};
@@ -3552,27 +3536,18 @@ index 000000000000..b57ab7111e90
 +static int surfacegen5_acpi_dtx_probe(struct platform_device *pdev)
 +{
 +	struct surface_dtx_dev *ddev = &surface_dtx_dev;
-+	struct device_link *ec_link;
 +	struct input_dev *input_dev;
 +	int status;
 +
 +	// link to ec
-+	ec_link = surfacegen5_ec_consumer_add(&pdev->dev, DL_FLAG_PM_RUNTIME);
-+	if (IS_ERR_OR_NULL(ec_link)) {
-+		if (PTR_ERR(ec_link) == -ENXIO) {
-+			// Defer probe if the _SSH driver has not set up the controller yet.
-+			status = -EPROBE_DEFER;
-+		} else {
-+			status = -EFAULT;
-+		}
-+
-+		goto err_probe_ec_link;
++	status = surfacegen5_ec_consumer_register(&pdev->dev);
++	if (status) {
++		return status == -ENXIO ? -EPROBE_DEFER : status;
 +	}
 +
 +	input_dev = surface_dtx_register_inputdev(pdev);
 +	if (IS_ERR(input_dev)) {
-+		status = PTR_ERR(input_dev);
-+		goto err_input_dev;
++		return PTR_ERR(input_dev);
 +	}
 +
 +	// initialize device
@@ -3586,7 +3561,6 @@ index 000000000000..b57ab7111e90
 +	INIT_LIST_HEAD(&ddev->client_list);
 +	init_waitqueue_head(&ddev->waitq);
 +	ddev->active = true;
-+	ddev->ec_link = ec_link;
 +	ddev->input_dev = input_dev;
 +	mutex_unlock(&ddev->mutex);
 +
@@ -3607,9 +3581,6 @@ index 000000000000..b57ab7111e90
 +	misc_deregister(&ddev->mdev);
 +err_register:
 +	input_unregister_device(ddev->input_dev);
-+err_input_dev:
-+	surfacegen5_ec_consumer_remove(ec_link);
-+err_probe_ec_link:
 +	return status;
 +}
 +
@@ -3644,9 +3615,6 @@ index 000000000000..b57ab7111e90
 +	input_unregister_device(ddev->input_dev);
 +	misc_deregister(&ddev->mdev);
 +
-+	// unlink
-+	surfacegen5_ec_consumer_remove(ddev->ec_link);
-+
 +	return 0;
 +}
 +
@@ -3718,10 +3686,6 @@ index 000000000000..b57ab7111e90
 +	__SG5_PARAM_PERF_MODE__END   = 4,
 +};
 +
-+struct surface_sid_drvdata {
-+	struct device_link *ec_link;
-+};
-+
 +
 +static int sg5_ec_perf_mode_get(void)
 +{
@@ -3859,37 +3823,19 @@ index 000000000000..b57ab7111e90
 +
 +static int surfacegen5_acpi_sid_probe(struct platform_device *pdev)
 +{
-+	struct surface_sid_drvdata *drvdata;
-+	struct device_link *ec_link;
 +	int status;
 +
 +	// link to ec
-+	ec_link = surfacegen5_ec_consumer_add(&pdev->dev, DL_FLAG_PM_RUNTIME);
-+	if (IS_ERR_OR_NULL(ec_link)) {
-+		if (PTR_ERR(ec_link) == -ENXIO) {
-+			// Defer probe if the _SSH driver has not set up the controller yet.
-+			status = -EPROBE_DEFER;
-+		} else {
-+			status = -EFAULT;
-+		}
-+
-+		goto err_probe_ec_link;
++	status = surfacegen5_ec_consumer_register(&pdev->dev);
++	if (status) {
++		return status == -ENXIO ? -EPROBE_DEFER : status;
 +	}
 +
-+	// set up driver data
-+	drvdata = kzalloc(sizeof(struct surface_sid_drvdata), GFP_KERNEL);
-+	if (!drvdata) {
-+		status = -ENOMEM;
-+		goto err_drvdata;
-+	}
-+	drvdata->ec_link = ec_link;
-+	platform_set_drvdata(pdev, drvdata);
-+
 +	// set initial perf_mode
 +	if (param_perf_mode_init != SG5_PARAM_PERF_MODE_AS_IS) {
 +		status = sg5_ec_perf_mode_set(param_perf_mode_init);
 +		if (status) {
-+			goto err_set_perf;
++			return status;
 +		}
 +	}
 +
@@ -3903,30 +3849,17 @@ index 000000000000..b57ab7111e90
 +
 +err_sysfs:
 +	sg5_ec_perf_mode_set(param_perf_mode_exit);
-+err_set_perf:
-+	platform_set_drvdata(pdev, NULL);
-+	kfree(drvdata);
-+err_drvdata:
-+	surfacegen5_ec_consumer_remove(ec_link);
-+err_probe_ec_link:
 +	return status;
 +}
 +
 +static int surfacegen5_acpi_sid_remove(struct platform_device *pdev)
 +{
-+	struct surface_sid_drvdata *drvdata = platform_get_drvdata(pdev);
-+
 +	// remove perf_mode attribute
 +	sysfs_remove_file(&pdev->dev.kobj, &dev_attr_perf_mode.attr);
 +
 +	// set exit perf_mode
 +	sg5_ec_perf_mode_set(param_perf_mode_exit);
 +
-+	// remove consumer and clean up
-+	surfacegen5_ec_consumer_remove(drvdata->ec_link);
-+	platform_set_drvdata(pdev, NULL);
-+	kfree(drvdata);
-+
 +	return 0;
 +}
 +
@@ -4156,5 +4089,5 @@ index 9db93f500b4e..2290d4f86ca4 100644
  		return -ENODEV;
  
 -- 
-2.19.1
+2.22.0
 

+ 4 - 4
patches/4.19/0002-suspend.patch

@@ -1,6 +1,6 @@
-From 812641ec018f67e99a6d1daffff9a340a45a917c Mon Sep 17 00:00:00 2001
-From: Jake Day <jake@ninebysix.com>
-Date: Wed, 26 Jun 2019 20:42:46 -0400
+From e851005607738247775e43e9ac4336edd4c09516 Mon Sep 17 00:00:00 2001
+From: Maximilian Luz <luzmaximilian@gmail.com>
+Date: Tue, 2 Jul 2019 23:45:42 +0200
 Subject: [PATCH 02/11] suspend
 
 ---
@@ -141,5 +141,5 @@ index f8576509c7be..a5fa80e72aba 100644
  		.procname	= "sched_child_runs_first",
  		.data		= &sysctl_sched_child_runs_first,
 -- 
-2.19.1
+2.22.0
 

+ 26 - 14
patches/4.19/0003-buttons.patch

@@ -1,15 +1,15 @@
-From 8de0f7cda746d317469159d0bc9956a92e7bd8c1 Mon Sep 17 00:00:00 2001
-From: Jake Day <jake@ninebysix.com>
-Date: Wed, 26 Jun 2019 20:42:57 -0400
+From ba453a89148ea2289e71741225273a02ae2db768 Mon Sep 17 00:00:00 2001
+From: Maximilian Luz <luzmaximilian@gmail.com>
+Date: Tue, 2 Jul 2019 23:49:56 +0200
 Subject: [PATCH 03/11] buttons
 
 ---
- drivers/input/misc/soc_button_array.c     | 133 ++++++++++++++++++++--
- drivers/platform/x86/surfacepro3_button.c |  38 +++++++
- 2 files changed, 159 insertions(+), 12 deletions(-)
+ drivers/input/misc/soc_button_array.c     | 145 ++++++++++++++++++++--
+ drivers/platform/x86/surfacepro3_button.c |  38 ++++++
+ 2 files changed, 171 insertions(+), 12 deletions(-)
 
 diff --git a/drivers/input/misc/soc_button_array.c b/drivers/input/misc/soc_button_array.c
-index 55cd6e0b409c..ad4d591cf179 100644
+index 55cd6e0b409c..bd8a8601cf0c 100644
 --- a/drivers/input/misc/soc_button_array.c
 +++ b/drivers/input/misc/soc_button_array.c
 @@ -29,6 +29,17 @@ struct soc_button_info {
@@ -38,7 +38,7 @@ index 55cd6e0b409c..ad4d591cf179 100644
  	struct soc_button_info *button_info;
  	struct soc_button_data *priv;
  	struct platform_device *pd;
-@@ -320,18 +332,19 @@ static int soc_button_probe(struct platform_device *pdev)
+@@ -320,18 +332,20 @@ static int soc_button_probe(struct platform_device *pdev)
  	if (!id)
  		return -ENODEV;
  
@@ -51,7 +51,8 @@ index 55cd6e0b409c..ad4d591cf179 100644
 +	}
 +
 +	if (device_data && device_data->button_info) {
-+		button_info = (struct soc_button_info *)device_data->button_info;
++		button_info = (struct soc_button_info *)
++				device_data->button_info;
 +	} else {
  		button_info = soc_button_get_button_info(dev);
  		if (IS_ERR(button_info))
@@ -67,7 +68,7 @@ index 55cd6e0b409c..ad4d591cf179 100644
  	}
  
  	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
-@@ -357,12 +370,32 @@ static int soc_button_probe(struct platform_device *pdev)
+@@ -357,12 +371,32 @@ static int soc_button_probe(struct platform_device *pdev)
  	if (!priv->children[0] && !priv->children[1])
  		return -ENODEV;
  
@@ -101,7 +102,7 @@ index 55cd6e0b409c..ad4d591cf179 100644
  /*
   * Definition of buttons on the tablet. The ACPI index of each button
   * is defined in section 2.8.7.2 of "Windows ACPI Design Guide for SoC
-@@ -377,9 +410,85 @@ static struct soc_button_info soc_button_PNP0C40[] = {
+@@ -377,9 +411,96 @@ static struct soc_button_info soc_button_PNP0C40[] = {
  	{ }
  };
  
@@ -123,7 +124,9 @@ index 55cd6e0b409c..ad4d591cf179 100644
 +#define MSHW0040_DSM_GET_OMPR		0x02	// get OEM Platform Revision
 +static const guid_t MSHW0040_DSM_UUID =
 +	GUID_INIT(0x6fd05c69, 0xcde3, 0x49f4, 0x95, 0xed, 0xab, 0x16, 0x65,
-+	          0x49, 0x80, 0x35);
++		  0x49, 0x80, 0x35);
++
++#ifdef CONFIG_ACPI
 +
 +static int soc_device_check_MSHW0040(struct device *dev)
 +{
@@ -135,7 +138,7 @@ index 55cd6e0b409c..ad4d591cf179 100644
 +	// get OEM platform revision
 +	result = acpi_evaluate_dsm_typed(handle, &MSHW0040_DSM_UUID,
 +					 MSHW0040_DSM_REVISION,
-+	                                 MSHW0040_DSM_GET_OMPR, NULL,
++					 MSHW0040_DSM_GET_OMPR, NULL,
 +					 ACPI_TYPE_INTEGER);
 +
 +	if (result) {
@@ -160,6 +163,15 @@ index 55cd6e0b409c..ad4d591cf179 100644
 +	return 0;
 +}
 +
++#else   /* CONFIG_ACPI */
++
++static int soc_device_check_MSHW0040(struct device *dev)
++{
++    return -ENODEV;
++}
++
++#endif  /* CONFIG_ACPI */
++
 +/*
 + * Button infos for Microsoft Surface Book 2 and Surface Pro (2017).
 + * Obtained from DSDT/testing.
@@ -253,5 +265,5 @@ index 1b491690ce07..eaec30380b11 100644
  	if (!button)
  		return -ENOMEM;
 -- 
-2.19.1
+2.22.0
 

+ 4 - 4
patches/4.19/0004-cameras.patch

@@ -1,6 +1,6 @@
-From 5130bbee4a7aa9e7ebf84e14c2198f5e33ee412d Mon Sep 17 00:00:00 2001
-From: Jake Day <jake@ninebysix.com>
-Date: Wed, 26 Jun 2019 20:43:10 -0400
+From 4f79924d2848c13e9a0830c0c575421768f8d58a Mon Sep 17 00:00:00 2001
+From: Maximilian Luz <luzmaximilian@gmail.com>
+Date: Tue, 2 Jul 2019 23:50:29 +0200
 Subject: [PATCH 04/11] cameras
 
 ---
@@ -2749,5 +2749,5 @@ index 000000000000..79aef69666e8
 +};
 +#endif
 -- 
-2.19.1
+2.22.0
 

+ 4 - 4
patches/4.19/0005-ipts.patch

@@ -1,6 +1,6 @@
-From cb4ccf8470366106d240cad5afc4a8fc5d1c577b Mon Sep 17 00:00:00 2001
-From: Jake Day <jake@ninebysix.com>
-Date: Wed, 26 Jun 2019 20:43:20 -0400
+From aa2ce90ff8ee8ad90a5e84004b748e709167bd0f Mon Sep 17 00:00:00 2001
+From: Maximilian Luz <luzmaximilian@gmail.com>
+Date: Tue, 2 Jul 2019 23:50:47 +0200
 Subject: [PATCH 05/11] ipts
 
 ---
@@ -6170,5 +6170,5 @@ index 000000000000..f329bbfb8079
 +
 +#endif // INTEL_IPTS_IF_H
 -- 
-2.19.1
+2.22.0
 

+ 4 - 4
patches/4.19/0006-hid.patch

@@ -1,6 +1,6 @@
-From 693c407a2712a11cdd7e10ecc7b02667da264834 Mon Sep 17 00:00:00 2001
-From: Jake Day <jake@ninebysix.com>
-Date: Wed, 26 Jun 2019 20:43:34 -0400
+From 3895e7b026d525d70fdc0f4a6dd59b08c9f44022 Mon Sep 17 00:00:00 2001
+From: Maximilian Luz <luzmaximilian@gmail.com>
+Date: Tue, 2 Jul 2019 23:51:26 +0200
 Subject: [PATCH 06/11] hid
 
 ---
@@ -147,5 +147,5 @@ index e24790c988c0..70f75d60c8c9 100644
  	{ HID_USB_DEVICE(USB_VENDOR_ID_MSI, USB_DEVICE_ID_MSI_GT683R_LED_PANEL), HID_QUIRK_NO_INIT_REPORTS },
  	{ HID_USB_DEVICE(USB_VENDOR_ID_MULTIPLE_1781, USB_DEVICE_ID_RAPHNET_4NES4SNES_OLD), HID_QUIRK_MULTI_INPUT },
 -- 
-2.19.1
+2.22.0
 

+ 4 - 4
patches/4.19/0007-sdcard-reader.patch

@@ -1,6 +1,6 @@
-From 778152035f0ec13b86ab7a724b49c324b9701c2b Mon Sep 17 00:00:00 2001
-From: Jake Day <jake@ninebysix.com>
-Date: Wed, 26 Jun 2019 20:43:50 -0400
+From 4cbc99c208e1938349aec603aee10b202a54f54a Mon Sep 17 00:00:00 2001
+From: Maximilian Luz <luzmaximilian@gmail.com>
+Date: Tue, 2 Jul 2019 23:51:55 +0200
 Subject: [PATCH 07/11] sdcard-reader
 
 ---
@@ -22,5 +22,5 @@ index eb24ec0e160d..8327ac3880c8 100644
  
  	udev->lpm_disable_count--;
 -- 
-2.19.1
+2.22.0
 

+ 4 - 4
patches/4.19/0008-wifi.patch

@@ -1,6 +1,6 @@
-From f8f86cdab344912d26db511c6800842c03a1836e Mon Sep 17 00:00:00 2001
-From: Jake Day <jake@ninebysix.com>
-Date: Wed, 26 Jun 2019 20:44:04 -0400
+From 52cb41ede0999511587b9a2523771238c12f8033 Mon Sep 17 00:00:00 2001
+From: Maximilian Luz <luzmaximilian@gmail.com>
+Date: Tue, 2 Jul 2019 23:52:12 +0200
 Subject: [PATCH 08/11] wifi
 
 ---
@@ -266,5 +266,5 @@ diff --git a/scripts/leaking_addresses.pl b/scripts/leaking_addresses.pl
 old mode 100755
 new mode 100644
 -- 
-2.19.1
+2.22.0
 

+ 4 - 4
patches/4.19/0009-surface3-power.patch

@@ -1,6 +1,6 @@
-From 3a112a8ad95d0aaf746b334d545ca92770e03331 Mon Sep 17 00:00:00 2001
-From: Jake Day <jake@ninebysix.com>
-Date: Wed, 26 Jun 2019 20:44:18 -0400
+From 09ddddeb396321184eb2591c20e681d48623c34d Mon Sep 17 00:00:00 2001
+From: Maximilian Luz <luzmaximilian@gmail.com>
+Date: Tue, 2 Jul 2019 23:52:29 +0200
 Subject: [PATCH 09/11] surface3-power
 
 ---
@@ -651,5 +651,5 @@ index 000000000000..e0af01a60302
 +MODULE_DESCRIPTION("mshw0011 driver");
 +MODULE_LICENSE("GPL v2");
 -- 
-2.19.1
+2.22.0
 

+ 4 - 4
patches/4.19/0010-mwlwifi.patch

@@ -1,6 +1,6 @@
-From 160f5c45ad9028b29cec81111d2c371aa2d79e4d Mon Sep 17 00:00:00 2001
-From: Jake Day <jake@ninebysix.com>
-Date: Wed, 26 Jun 2019 20:44:34 -0400
+From d27de602a55f146e79c125287e6dbc3aa70ded38 Mon Sep 17 00:00:00 2001
+From: Maximilian Luz <luzmaximilian@gmail.com>
+Date: Tue, 2 Jul 2019 23:52:52 +0200
 Subject: [PATCH 10/11] mwlwifi
 
 ---
@@ -19751,5 +19751,5 @@ index 000000000000..b6fdf70c22fb
 +
 +#endif /* _VENDOR_CMD_H_ */
 -- 
-2.19.1
+2.22.0
 

+ 4 - 4
patches/4.19/0011-surface-lte.patch

@@ -1,6 +1,6 @@
-From b89e51a2a0d9a3fa30a7e3bc39bce6c280837239 Mon Sep 17 00:00:00 2001
-From: Jake Day <jake@ninebysix.com>
-Date: Wed, 26 Jun 2019 20:44:48 -0400
+From 4b31faa2ddaffa6e6963c54ff6574178de94918e Mon Sep 17 00:00:00 2001
+From: Maximilian Luz <luzmaximilian@gmail.com>
+Date: Tue, 2 Jul 2019 23:53:15 +0200
 Subject: [PATCH 11/11] surface-lte
 
 ---
@@ -20,5 +20,5 @@ index 613f91add03d..e1428222dd73 100644
  	/* Huawei devices */
  	{DEVICE_HWI(0x03f0, 0x581d)},	/* HP lt4112 LTE/HSPA+ Gobi 4G Modem (Huawei me906e) */
 -- 
-2.19.1
+2.22.0
 

+ 65 - 132
patches/5.1/0001-surface-acpi.patch

@@ -1,6 +1,6 @@
-From 5dc48251358d2e583e077fdd86460a703a8a526b Mon Sep 17 00:00:00 2001
-From: Jake Day <jake@ninebysix.com>
-Date: Thu, 27 Jun 2019 11:59:15 -0400
+From d4d2fa3647f86b84ed6d38c8180cb020eb88627d Mon Sep 17 00:00:00 2001
+From: Maximilian Luz <luzmaximilian@gmail.com>
+Date: Wed, 3 Jul 2019 00:22:49 +0200
 Subject: [PATCH 01/11] surface-acpi
 
 ---
@@ -8,9 +8,9 @@ Subject: [PATCH 01/11] surface-acpi
  drivers/acpi/acpica/exfield.c       |   12 +-
  drivers/platform/x86/Kconfig        |   97 +
  drivers/platform/x86/Makefile       |    1 +
- drivers/platform/x86/surface_acpi.c | 3828 +++++++++++++++++++++++++++
+ drivers/platform/x86/surface_acpi.c | 3761 +++++++++++++++++++++++++++
  drivers/tty/serdev/core.c           |   90 +-
- 6 files changed, 4024 insertions(+), 6 deletions(-)
+ 6 files changed, 3957 insertions(+), 6 deletions(-)
  create mode 100644 drivers/platform/x86/surface_acpi.c
 
 diff --git a/drivers/acpi/acpica/dsopcode.c b/drivers/acpi/acpica/dsopcode.c
@@ -180,10 +180,10 @@ index 86cb76677bc8..be1ce92a365d 100644
  obj-$(CONFIG_FUJITSU_TABLET)	+= fujitsu-tablet.o
 diff --git a/drivers/platform/x86/surface_acpi.c b/drivers/platform/x86/surface_acpi.c
 new file mode 100644
-index 000000000000..b57ab7111e90
+index 000000000000..2874cc85213a
 --- /dev/null
 +++ b/drivers/platform/x86/surface_acpi.c
-@@ -0,0 +1,3828 @@
+@@ -0,0 +1,3761 @@
 +#include <asm/unaligned.h>
 +#include <linux/acpi.h>
 +#include <linux/completion.h>
@@ -272,8 +272,7 @@ index 000000000000..b57ab7111e90
 +typedef int (*surfacegen5_ec_event_handler_fn)(struct surfacegen5_event *event, void *data);
 +typedef unsigned long (*surfacegen5_ec_event_handler_delay)(struct surfacegen5_event *event, void *data);
 +
-+struct device_link *surfacegen5_ec_consumer_add(struct device *consumer, u32 flags);
-+int surfacegen5_ec_consumer_remove(struct device_link *link);
++int surfacegen5_ec_consumer_register(struct device *consumer);
 +
 +int surfacegen5_ec_rqst(const struct surfacegen5_rqst *rqst, struct surfacegen5_buf *result);
 +
@@ -534,31 +533,22 @@ index 000000000000..b57ab7111e90
 +	return ec;
 +}
 +
-+struct device_link *surfacegen5_ec_consumer_add(struct device *consumer, u32 flags)
++int surfacegen5_ec_consumer_register(struct device *consumer)
 +{
++	u32 flags = DL_FLAG_PM_RUNTIME | DL_FLAG_AUTOREMOVE_CONSUMER;
 +	struct surfacegen5_ec *ec;
 +	struct device_link *link;
 +
 +	ec = surfacegen5_ec_acquire_init();
 +	if (!ec) {
-+		return ERR_PTR(-ENXIO);
++		return -ENXIO;
 +	}
 +
 +	link = device_link_add(consumer, &ec->serdev->dev, flags);
-+
-+	surfacegen5_ec_release(ec);
-+	return link;
-+}
-+
-+int surfacegen5_ec_consumer_remove(struct device_link *link)
-+{
-+	struct surfacegen5_ec *ec = surfacegen5_ec_acquire_init();
-+	if (!ec) {
-+		return -ENXIO;
++	if (!link) {
++		return -EFAULT;
 +	}
 +
-+	device_link_del(link);
-+
 +	surfacegen5_ec_release(ec);
 +	return 0;
 +}
@@ -2057,15 +2047,19 @@ index 000000000000..b57ab7111e90
 +	struct device *dev;
 +};
 +
++struct surfacegen5_san_consumer_link {
++	const struct surfacegen5_san_acpi_consumer *properties;
++	struct device_link                         *link;
++};
++
 +struct surfacegen5_san_consumers {
-+	u32                  num;
-+	struct device_link **links;
++	u32                                   num;
++	struct surfacegen5_san_consumer_link *links;
 +};
 +
 +struct surfacegen5_san_drvdata {
 +	struct surfacegen5_san_opreg_context opreg_ctx;
 +	struct surfacegen5_san_consumers     consumers;
-+	struct device_link                  *ec_link;
 +};
 +
 +struct gsb_data_in {
@@ -2514,7 +2508,7 @@ index 000000000000..b57ab7111e90
 +                                          struct surfacegen5_san_consumers *out)
 +{
 +	const struct surfacegen5_san_acpi_consumer *con;
-+	struct device_link **links, **link;
++	struct surfacegen5_san_consumer_link *links, *link;
 +	struct acpi_device *adev;
 +	acpi_handle handle;
 +	u32 max_links = 0;
@@ -2530,7 +2524,7 @@ index 000000000000..b57ab7111e90
 +	}
 +
 +	// allocate
-+	links = kzalloc(max_links * sizeof(struct device_link *), GFP_KERNEL);
++	links = kzalloc(max_links * sizeof(struct surfacegen5_san_consumer_link), GFP_KERNEL);
 +	link = &links[0];
 +
 +	if (!links) {
@@ -2554,11 +2548,12 @@ index 000000000000..b57ab7111e90
 +			goto consumers_link_cleanup;
 +		}
 +
-+		*link = device_link_add(&adev->dev, &pdev->dev, con->flags);
-+		if (!(*link)) {
++		link->link = device_link_add(&adev->dev, &pdev->dev, con->flags);
++		if (!(link->link)) {
 +			status = -EFAULT;
 +			goto consumers_link_cleanup;
 +		}
++		link->properties = con;
 +
 +		link += 1;
 +	}
@@ -2570,7 +2565,9 @@ index 000000000000..b57ab7111e90
 +
 +consumers_link_cleanup:
 +	for (link = link - 1; link >= links; --link) {
-+		device_link_del(*link);
++		if (link->properties->flags & DL_FLAG_STATELESS) {
++			device_link_del(link->link);
++		}
 +	}
 +
 +	return status;
@@ -2584,7 +2581,9 @@ index 000000000000..b57ab7111e90
 +	}
 +
 +	for (i = 0; i < consumers->num; ++i) {
-+		device_link_del(consumers->links[i]);
++		if (consumers->links[i].properties->flags & DL_FLAG_STATELESS) {
++			device_link_del(consumers->links[i].link);
++		}
 +	}
 +
 +	kfree(consumers->links);
@@ -2597,33 +2596,25 @@ index 000000000000..b57ab7111e90
 +{
 +	const struct surfacegen5_san_acpi_consumer *cons;
 +	struct surfacegen5_san_drvdata *drvdata;
-+	struct device_link *ec_link;
 +	acpi_handle san = ACPI_HANDLE(&pdev->dev);	// _SAN device node
 +	int status;
 +
-+	drvdata = kzalloc(sizeof(struct surfacegen5_san_drvdata), GFP_KERNEL);
-+	if (!drvdata) {
-+		return -ENOMEM;
-+	}
-+
 +	/*
 +	 * Defer probe if the _SSH driver has not set up the controller yet. This
 +	 * makes sure we do not fail any initial requests (e.g. _STA request without
 +	 * which the battery does not get set up correctly). Otherwise register as
 +	 * consumer to set up a device_link.
 +	 */
-+	ec_link = surfacegen5_ec_consumer_add(&pdev->dev, DL_FLAG_PM_RUNTIME);
-+	if (IS_ERR_OR_NULL(ec_link)) {
-+		if (PTR_ERR(ec_link) == -ENXIO) {
-+			status = -EPROBE_DEFER;
-+		} else {
-+			status = -EFAULT;
-+		}
++	status = surfacegen5_ec_consumer_register(&pdev->dev);
++	if (status) {
++		return status == -ENXIO ? -EPROBE_DEFER : status;
++	}
 +
-+		goto err_probe_ec_link;
++	drvdata = kzalloc(sizeof(struct surfacegen5_san_drvdata), GFP_KERNEL);
++	if (!drvdata) {
++		return -ENOMEM;
 +	}
 +
-+	drvdata->ec_link = ec_link;
 +	drvdata->opreg_ctx.dev = &pdev->dev;
 +
 +	cons = acpi_device_get_match_data(&pdev->dev);
@@ -2658,8 +2649,6 @@ index 000000000000..b57ab7111e90
 +	platform_set_drvdata(san, NULL);
 +	surfacegen5_san_consumers_unlink(&drvdata->consumers);
 +err_probe_consumers:
-+	surfacegen5_ec_consumer_remove(drvdata->ec_link);
-+err_probe_ec_link:
 +	kfree(drvdata);
 +	return status;
 +}
@@ -2674,7 +2663,6 @@ index 000000000000..b57ab7111e90
 +	surfacegen5_san_disable_events();
 +
 +	surfacegen5_san_consumers_unlink(&drvdata->consumers);
-+	surfacegen5_ec_consumer_remove(drvdata->ec_link);
 +	kfree(drvdata);
 +
 +	platform_set_drvdata(pdev, NULL);
@@ -2742,7 +2730,8 @@ index 000000000000..b57ab7111e90
 + * Request ID for VHF events. This value is based on the output of the Surface
 + * EC and should not be changed.
 + */
-+#define SG5_VHF_RQID			0x0001
++#define SG5_EVENT_VHF_RQID	0x0001
++#define SG5_EVENT_VHF_TC	0x08
 +
 +
 +struct surfacegen5_vhf_evtctx {
@@ -2751,7 +2740,6 @@ index 000000000000..b57ab7111e90
 +};
 +
 +struct surfacegen5_vhf_drvdata {
-+	struct device_link           *ec_link;
 +	struct surfacegen5_vhf_evtctx event_ctx;
 +};
 +
@@ -2915,27 +2903,20 @@ index 000000000000..b57ab7111e90
 +static int surfacegen5_acpi_vhf_probe(struct platform_device *pdev)
 +{
 +	struct surfacegen5_vhf_drvdata *drvdata;
-+	struct device_link *ec_link;
 +	struct hid_device *hid;
 +	int status;
 +
++	// add device link to EC
++	status = surfacegen5_ec_consumer_register(&pdev->dev);
++	if (status) {
++		return status == -ENXIO ? -EPROBE_DEFER : status;
++	}
++
 +	drvdata = kzalloc(sizeof(struct surfacegen5_vhf_drvdata), GFP_KERNEL);
 +	if (!drvdata) {
 +		return -ENOMEM;
 +	}
 +
-+	// add device link to EC
-+	ec_link = surfacegen5_ec_consumer_add(&pdev->dev, DL_FLAG_PM_RUNTIME);
-+	if (IS_ERR_OR_NULL(ec_link)) {
-+		if (PTR_ERR(ec_link) == -ENXIO) {
-+			status = -EPROBE_DEFER;
-+		} else {
-+			status = -EFAULT;
-+		}
-+
-+		goto err_probe_ec_link;
-+	}
-+
 +	hid = surfacegen5_vhf_create_hid_device(pdev);
 +	if (IS_ERR(hid)) {
 +		status = PTR_ERR(hid);
@@ -2947,7 +2928,6 @@ index 000000000000..b57ab7111e90
 +		goto err_add_hid;
 +	}
 +
-+	drvdata->ec_link = ec_link;
 +	drvdata->event_ctx.dev = &pdev->dev;
 +	drvdata->event_ctx.hid = hid;
 +
@@ -2958,7 +2938,7 @@ index 000000000000..b57ab7111e90
 +         * default, thus there should be no need to explicitly enable them.
 +	 */
 +	status = surfacegen5_ec_set_delayed_event_handler(
-+			SG5_VHF_RQID,
++			SG5_EVENT_VHF_RQID,
 +	                surfacegen5_vhf_event_handler,
 +	                surfacegen5_vhf_event_delay,
 +			&drvdata->event_ctx);
@@ -2966,14 +2946,19 @@ index 000000000000..b57ab7111e90
 +		goto err_add_hid;
 +	}
 +
++	status = surfacegen5_ec_enable_event_source(SG5_EVENT_VHF_TC, 0x01, SG5_EVENT_VHF_RQID);
++	if (status) {
++		goto err_event_source;
++	}
++
 +	return 0;
 +
++err_event_source:
++	surfacegen5_ec_remove_event_handler(SG5_EVENT_VHF_RQID);
 +err_add_hid:
 +	hid_destroy_device(hid);
 +	platform_set_drvdata(pdev, NULL);
 +err_probe_hid:
-+	surfacegen5_ec_consumer_remove(drvdata->ec_link);
-+err_probe_ec_link:
 +	kfree(drvdata);
 +	return status;
 +}
@@ -2982,10 +2967,10 @@ index 000000000000..b57ab7111e90
 +{
 +	struct surfacegen5_vhf_drvdata *drvdata = platform_get_drvdata(pdev);
 +
-+	surfacegen5_ec_remove_event_handler(SG5_VHF_RQID);
++	surfacegen5_ec_disable_event_source(SG5_EVENT_VHF_TC, 0x01, SG5_EVENT_VHF_RQID);
++	surfacegen5_ec_remove_event_handler(SG5_EVENT_VHF_RQID);
 +
 +	hid_destroy_device(drvdata->event_ctx.hid);
-+	surfacegen5_ec_consumer_remove(drvdata->ec_link);
 +	kfree(drvdata);
 +
 +	platform_set_drvdata(pdev, NULL);
@@ -3091,7 +3076,6 @@ index 000000000000..b57ab7111e90
 +	struct list_head client_list;
 +	struct mutex mutex;
 +	bool active;
-+	struct device_link *ec_link;
 +	spinlock_t input_lock;
 +	struct input_dev *input_dev;
 +};
@@ -3531,27 +3515,18 @@ index 000000000000..b57ab7111e90
 +static int surfacegen5_acpi_dtx_probe(struct platform_device *pdev)
 +{
 +	struct surface_dtx_dev *ddev = &surface_dtx_dev;
-+	struct device_link *ec_link;
 +	struct input_dev *input_dev;
 +	int status;
 +
 +	// link to ec
-+	ec_link = surfacegen5_ec_consumer_add(&pdev->dev, DL_FLAG_PM_RUNTIME);
-+	if (IS_ERR_OR_NULL(ec_link)) {
-+		if (PTR_ERR(ec_link) == -ENXIO) {
-+			// Defer probe if the _SSH driver has not set up the controller yet.
-+			status = -EPROBE_DEFER;
-+		} else {
-+			status = -EFAULT;
-+		}
-+
-+		goto err_probe_ec_link;
++	status = surfacegen5_ec_consumer_register(&pdev->dev);
++	if (status) {
++		return status == -ENXIO ? -EPROBE_DEFER : status;
 +	}
 +
 +	input_dev = surface_dtx_register_inputdev(pdev);
 +	if (IS_ERR(input_dev)) {
-+		status = PTR_ERR(input_dev);
-+		goto err_input_dev;
++		return PTR_ERR(input_dev);
 +	}
 +
 +	// initialize device
@@ -3565,7 +3540,6 @@ index 000000000000..b57ab7111e90
 +	INIT_LIST_HEAD(&ddev->client_list);
 +	init_waitqueue_head(&ddev->waitq);
 +	ddev->active = true;
-+	ddev->ec_link = ec_link;
 +	ddev->input_dev = input_dev;
 +	mutex_unlock(&ddev->mutex);
 +
@@ -3586,9 +3560,6 @@ index 000000000000..b57ab7111e90
 +	misc_deregister(&ddev->mdev);
 +err_register:
 +	input_unregister_device(ddev->input_dev);
-+err_input_dev:
-+	surfacegen5_ec_consumer_remove(ec_link);
-+err_probe_ec_link:
 +	return status;
 +}
 +
@@ -3623,9 +3594,6 @@ index 000000000000..b57ab7111e90
 +	input_unregister_device(ddev->input_dev);
 +	misc_deregister(&ddev->mdev);
 +
-+	// unlink
-+	surfacegen5_ec_consumer_remove(ddev->ec_link);
-+
 +	return 0;
 +}
 +
@@ -3697,10 +3665,6 @@ index 000000000000..b57ab7111e90
 +	__SG5_PARAM_PERF_MODE__END   = 4,
 +};
 +
-+struct surface_sid_drvdata {
-+	struct device_link *ec_link;
-+};
-+
 +
 +static int sg5_ec_perf_mode_get(void)
 +{
@@ -3838,37 +3802,19 @@ index 000000000000..b57ab7111e90
 +
 +static int surfacegen5_acpi_sid_probe(struct platform_device *pdev)
 +{
-+	struct surface_sid_drvdata *drvdata;
-+	struct device_link *ec_link;
 +	int status;
 +
 +	// link to ec
-+	ec_link = surfacegen5_ec_consumer_add(&pdev->dev, DL_FLAG_PM_RUNTIME);
-+	if (IS_ERR_OR_NULL(ec_link)) {
-+		if (PTR_ERR(ec_link) == -ENXIO) {
-+			// Defer probe if the _SSH driver has not set up the controller yet.
-+			status = -EPROBE_DEFER;
-+		} else {
-+			status = -EFAULT;
-+		}
-+
-+		goto err_probe_ec_link;
++	status = surfacegen5_ec_consumer_register(&pdev->dev);
++	if (status) {
++		return status == -ENXIO ? -EPROBE_DEFER : status;
 +	}
 +
-+	// set up driver data
-+	drvdata = kzalloc(sizeof(struct surface_sid_drvdata), GFP_KERNEL);
-+	if (!drvdata) {
-+		status = -ENOMEM;
-+		goto err_drvdata;
-+	}
-+	drvdata->ec_link = ec_link;
-+	platform_set_drvdata(pdev, drvdata);
-+
 +	// set initial perf_mode
 +	if (param_perf_mode_init != SG5_PARAM_PERF_MODE_AS_IS) {
 +		status = sg5_ec_perf_mode_set(param_perf_mode_init);
 +		if (status) {
-+			goto err_set_perf;
++			return status;
 +		}
 +	}
 +
@@ -3882,30 +3828,17 @@ index 000000000000..b57ab7111e90
 +
 +err_sysfs:
 +	sg5_ec_perf_mode_set(param_perf_mode_exit);
-+err_set_perf:
-+	platform_set_drvdata(pdev, NULL);
-+	kfree(drvdata);
-+err_drvdata:
-+	surfacegen5_ec_consumer_remove(ec_link);
-+err_probe_ec_link:
 +	return status;
 +}
 +
 +static int surfacegen5_acpi_sid_remove(struct platform_device *pdev)
 +{
-+	struct surface_sid_drvdata *drvdata = platform_get_drvdata(pdev);
-+
 +	// remove perf_mode attribute
 +	sysfs_remove_file(&pdev->dev.kobj, &dev_attr_perf_mode.attr);
 +
 +	// set exit perf_mode
 +	sg5_ec_perf_mode_set(param_perf_mode_exit);
 +
-+	// remove consumer and clean up
-+	surfacegen5_ec_consumer_remove(drvdata->ec_link);
-+	platform_set_drvdata(pdev, NULL);
-+	kfree(drvdata);
-+
 +	return 0;
 +}
 +
@@ -4135,5 +4068,5 @@ index a0ac16ee6575..0dd242ff24d1 100644
  		return -ENODEV;
  
 -- 
-2.19.1
+2.22.0
 

+ 4 - 4
patches/5.1/0002-suspend.patch

@@ -1,6 +1,6 @@
-From c9f9ff8e3ee6e7b2ddfbc79d8b8c2d4de099a12f Mon Sep 17 00:00:00 2001
-From: Jake Day <jake@ninebysix.com>
-Date: Thu, 27 Jun 2019 11:59:26 -0400
+From c2ae9c80d630190f67b102303f794277cd916d9f Mon Sep 17 00:00:00 2001
+From: Maximilian Luz <luzmaximilian@gmail.com>
+Date: Wed, 3 Jul 2019 00:24:31 +0200
 Subject: [PATCH 02/11] suspend
 
 ---
@@ -141,5 +141,5 @@ index 387efbaf464a..f2762f5989a8 100644
  		.procname	= "sched_child_runs_first",
  		.data		= &sysctl_sched_child_runs_first,
 -- 
-2.19.1
+2.22.0
 

+ 26 - 14
patches/5.1/0003-buttons.patch

@@ -1,15 +1,15 @@
-From f1592214e7b2d2f04c0ac6940aca265342fb9f5a Mon Sep 17 00:00:00 2001
-From: Jake Day <jake@ninebysix.com>
-Date: Thu, 27 Jun 2019 11:59:37 -0400
+From 8b583fd83792f28f23461186b0c44d9c1554204e Mon Sep 17 00:00:00 2001
+From: Maximilian Luz <luzmaximilian@gmail.com>
+Date: Wed, 3 Jul 2019 00:25:27 +0200
 Subject: [PATCH 03/11] buttons
 
 ---
- drivers/input/misc/soc_button_array.c     | 133 ++++++++++++++++++++--
- drivers/platform/x86/surfacepro3_button.c |  38 +++++++
- 2 files changed, 159 insertions(+), 12 deletions(-)
+ drivers/input/misc/soc_button_array.c     | 145 ++++++++++++++++++++--
+ drivers/platform/x86/surfacepro3_button.c |  38 ++++++
+ 2 files changed, 171 insertions(+), 12 deletions(-)
 
 diff --git a/drivers/input/misc/soc_button_array.c b/drivers/input/misc/soc_button_array.c
-index bb458beecb43..e35580655cd0 100644
+index bb458beecb43..497fca2a9250 100644
 --- a/drivers/input/misc/soc_button_array.c
 +++ b/drivers/input/misc/soc_button_array.c
 @@ -29,6 +29,17 @@ struct soc_button_info {
@@ -38,7 +38,7 @@ index bb458beecb43..e35580655cd0 100644
  	struct soc_button_info *button_info;
  	struct soc_button_data *priv;
  	struct platform_device *pd;
-@@ -324,18 +336,19 @@ static int soc_button_probe(struct platform_device *pdev)
+@@ -324,18 +336,20 @@ static int soc_button_probe(struct platform_device *pdev)
  	if (!id)
  		return -ENODEV;
  
@@ -51,7 +51,8 @@ index bb458beecb43..e35580655cd0 100644
 +	}
 +
 +	if (device_data && device_data->button_info) {
-+		button_info = (struct soc_button_info *)device_data->button_info;
++		button_info = (struct soc_button_info *)
++				device_data->button_info;
 +	} else {
  		button_info = soc_button_get_button_info(dev);
  		if (IS_ERR(button_info))
@@ -67,7 +68,7 @@ index bb458beecb43..e35580655cd0 100644
  	}
  
  	priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
-@@ -361,12 +374,32 @@ static int soc_button_probe(struct platform_device *pdev)
+@@ -361,12 +375,32 @@ static int soc_button_probe(struct platform_device *pdev)
  	if (!priv->children[0] && !priv->children[1])
  		return -ENODEV;
  
@@ -101,7 +102,7 @@ index bb458beecb43..e35580655cd0 100644
  /*
   * Definition of buttons on the tablet. The ACPI index of each button
   * is defined in section 2.8.7.2 of "Windows ACPI Design Guide for SoC
-@@ -381,9 +414,85 @@ static struct soc_button_info soc_button_PNP0C40[] = {
+@@ -381,9 +415,96 @@ static struct soc_button_info soc_button_PNP0C40[] = {
  	{ }
  };
  
@@ -123,7 +124,9 @@ index bb458beecb43..e35580655cd0 100644
 +#define MSHW0040_DSM_GET_OMPR		0x02	// get OEM Platform Revision
 +static const guid_t MSHW0040_DSM_UUID =
 +	GUID_INIT(0x6fd05c69, 0xcde3, 0x49f4, 0x95, 0xed, 0xab, 0x16, 0x65,
-+	          0x49, 0x80, 0x35);
++		  0x49, 0x80, 0x35);
++
++#ifdef CONFIG_ACPI
 +
 +static int soc_device_check_MSHW0040(struct device *dev)
 +{
@@ -135,7 +138,7 @@ index bb458beecb43..e35580655cd0 100644
 +	// get OEM platform revision
 +	result = acpi_evaluate_dsm_typed(handle, &MSHW0040_DSM_UUID,
 +					 MSHW0040_DSM_REVISION,
-+	                                 MSHW0040_DSM_GET_OMPR, NULL,
++					 MSHW0040_DSM_GET_OMPR, NULL,
 +					 ACPI_TYPE_INTEGER);
 +
 +	if (result) {
@@ -160,6 +163,15 @@ index bb458beecb43..e35580655cd0 100644
 +	return 0;
 +}
 +
++#else   /* CONFIG_ACPI */
++
++static int soc_device_check_MSHW0040(struct device *dev)
++{
++    return -ENODEV;
++}
++
++#endif  /* CONFIG_ACPI */
++
 +/*
 + * Button infos for Microsoft Surface Book 2 and Surface Pro (2017).
 + * Obtained from DSDT/testing.
@@ -253,5 +265,5 @@ index 1b491690ce07..eaec30380b11 100644
  	if (!button)
  		return -ENOMEM;
 -- 
-2.19.1
+2.22.0
 

+ 4 - 4
patches/5.1/0004-cameras.patch

@@ -1,6 +1,6 @@
-From 147cefea68fbb517c8d3b28e9ae5b68f5436163b Mon Sep 17 00:00:00 2001
-From: Jake Day <jake@ninebysix.com>
-Date: Thu, 27 Jun 2019 11:59:48 -0400
+From ee99ccaced33d4db9d807b5452507c2b4257f595 Mon Sep 17 00:00:00 2001
+From: Maximilian Luz <luzmaximilian@gmail.com>
+Date: Wed, 3 Jul 2019 00:27:27 +0200
 Subject: [PATCH 04/11] cameras
 
 ---
@@ -2749,5 +2749,5 @@ index 000000000000..79aef69666e8
 +};
 +#endif
 -- 
-2.19.1
+2.22.0
 

+ 4 - 4
patches/5.1/0005-ipts.patch

@@ -1,6 +1,6 @@
-From 152bbfc2bbe63934a98c8834064c0ff4c32edb09 Mon Sep 17 00:00:00 2001
-From: Jake Day <jake@ninebysix.com>
-Date: Thu, 27 Jun 2019 11:59:59 -0400
+From fa6be7e31d29959edc738986507fed1e1a877e2e Mon Sep 17 00:00:00 2001
+From: Maximilian Luz <luzmaximilian@gmail.com>
+Date: Wed, 3 Jul 2019 00:28:10 +0200
 Subject: [PATCH 05/11] ipts
 
 ---
@@ -6174,5 +6174,5 @@ index 000000000000..f329bbfb8079
 +
 +#endif // INTEL_IPTS_IF_H
 -- 
-2.19.1
+2.22.0
 

+ 4 - 4
patches/5.1/0006-hid.patch

@@ -1,6 +1,6 @@
-From 5f5e0059862b39694a8da3dbcb6739e7321db48a Mon Sep 17 00:00:00 2001
-From: Jake Day <jake@ninebysix.com>
-Date: Thu, 27 Jun 2019 12:00:08 -0400
+From d784fa6928c75c033a240d6db839c3aacd9edd33 Mon Sep 17 00:00:00 2001
+From: Maximilian Luz <luzmaximilian@gmail.com>
+Date: Wed, 3 Jul 2019 00:28:41 +0200
 Subject: [PATCH 06/11] hid
 
 ---
@@ -147,5 +147,5 @@ index 77ffba48cc73..517143d5b305 100644
  	{ HID_USB_DEVICE(USB_VENDOR_ID_MSI, USB_DEVICE_ID_MSI_GT683R_LED_PANEL), HID_QUIRK_NO_INIT_REPORTS },
  	{ HID_USB_DEVICE(USB_VENDOR_ID_MULTIPLE_1781, USB_DEVICE_ID_RAPHNET_4NES4SNES_OLD), HID_QUIRK_MULTI_INPUT },
 -- 
-2.19.1
+2.22.0
 

+ 4 - 4
patches/5.1/0007-sdcard-reader.patch

@@ -1,6 +1,6 @@
-From 3e9683e6d76e89b99e77af2e6279255bfbeba176 Mon Sep 17 00:00:00 2001
-From: Jake Day <jake@ninebysix.com>
-Date: Thu, 27 Jun 2019 12:00:20 -0400
+From 1b434e8d2943d1c6a3fb9eb7936f8ecc5c1551e3 Mon Sep 17 00:00:00 2001
+From: Maximilian Luz <luzmaximilian@gmail.com>
+Date: Wed, 3 Jul 2019 00:29:19 +0200
 Subject: [PATCH 07/11] sdcard-reader
 
 ---
@@ -22,5 +22,5 @@ index 310eef451db8..a896e86ca0d7 100644
  
  	udev->lpm_disable_count--;
 -- 
-2.19.1
+2.22.0
 

+ 4 - 4
patches/5.1/0008-wifi.patch

@@ -1,6 +1,6 @@
-From 4f605a61290465fd640994cf139b41c290b24b01 Mon Sep 17 00:00:00 2001
-From: Jake Day <jake@ninebysix.com>
-Date: Thu, 27 Jun 2019 12:00:30 -0400
+From 8f2bb111745b57988030776899049153dadf2e3d Mon Sep 17 00:00:00 2001
+From: Maximilian Luz <luzmaximilian@gmail.com>
+Date: Wed, 3 Jul 2019 00:30:18 +0200
 Subject: [PATCH 08/11] wifi
 
 ---
@@ -266,5 +266,5 @@ diff --git a/scripts/leaking_addresses.pl b/scripts/leaking_addresses.pl
 old mode 100755
 new mode 100644
 -- 
-2.19.1
+2.22.0
 

+ 4 - 4
patches/5.1/0009-surface3-power.patch

@@ -1,6 +1,6 @@
-From 0b3563fe32169e8d1a0bc5107366a8b0955c598b Mon Sep 17 00:00:00 2001
-From: Jake Day <jake@ninebysix.com>
-Date: Thu, 27 Jun 2019 12:00:43 -0400
+From facb57708454c1424e5dffe2be999356fc88984a Mon Sep 17 00:00:00 2001
+From: Maximilian Luz <luzmaximilian@gmail.com>
+Date: Wed, 3 Jul 2019 00:30:44 +0200
 Subject: [PATCH 09/11] surface3-power
 
 ---
@@ -651,5 +651,5 @@ index 000000000000..e0af01a60302
 +MODULE_DESCRIPTION("mshw0011 driver");
 +MODULE_LICENSE("GPL v2");
 -- 
-2.19.1
+2.22.0
 

+ 4 - 4
patches/5.1/0010-mwlwifi.patch

@@ -1,6 +1,6 @@
-From e4c7aef46e170a5a553a6643e96bd70d33666487 Mon Sep 17 00:00:00 2001
-From: Jake Day <jake@ninebysix.com>
-Date: Thu, 27 Jun 2019 12:00:56 -0400
+From 74d3a35c573f41861590ee786400067220c300b6 Mon Sep 17 00:00:00 2001
+From: Maximilian Luz <luzmaximilian@gmail.com>
+Date: Wed, 3 Jul 2019 00:31:18 +0200
 Subject: [PATCH 10/11] mwlwifi
 
 ---
@@ -19751,5 +19751,5 @@ index 000000000000..b6fdf70c22fb
 +
 +#endif /* _VENDOR_CMD_H_ */
 -- 
-2.19.1
+2.22.0
 

+ 4 - 4
patches/5.1/0011-surface-lte.patch

@@ -1,6 +1,6 @@
-From cc3f36fa68ea5edf37e10f8dbb1c45002d6e0c14 Mon Sep 17 00:00:00 2001
-From: Jake Day <jake@ninebysix.com>
-Date: Thu, 27 Jun 2019 12:01:07 -0400
+From ba5ab6c097f826ef6ec92379383f8b9963b8f48c Mon Sep 17 00:00:00 2001
+From: Maximilian Luz <luzmaximilian@gmail.com>
+Date: Wed, 3 Jul 2019 00:32:00 +0200
 Subject: [PATCH 11/11] surface-lte
 
 ---
@@ -20,5 +20,5 @@ index 613f91add03d..e1428222dd73 100644
  	/* Huawei devices */
  	{DEVICE_HWI(0x03f0, 0x581d)},	/* HP lt4112 LTE/HSPA+ Gobi 4G Modem (Huawei me906e) */
 -- 
-2.19.1
+2.22.0