Add patches for v5.5
This commit is contained in:
parent
dac297bf1f
commit
2fb7e9ae91
655
patches/5.5/0001-surface3-power.patch
Normal file
655
patches/5.5/0001-surface3-power.patch
Normal file
|
@ -0,0 +1,655 @@
|
||||||
|
From a5d5a3b6e0eec527c9ce83b62450161e88232c5a Mon Sep 17 00:00:00 2001
|
||||||
|
From: qzed <qzed@users.noreply.github.com>
|
||||||
|
Date: Tue, 17 Sep 2019 17:17:56 +0200
|
||||||
|
Subject: [PATCH 1/7] surface3-power
|
||||||
|
|
||||||
|
---
|
||||||
|
drivers/platform/x86/Kconfig | 7 +
|
||||||
|
drivers/platform/x86/Makefile | 1 +
|
||||||
|
drivers/platform/x86/surface3_power.c | 604 ++++++++++++++++++++++++++
|
||||||
|
3 files changed, 612 insertions(+)
|
||||||
|
create mode 100644 drivers/platform/x86/surface3_power.c
|
||||||
|
|
||||||
|
diff --git a/drivers/platform/x86/Kconfig b/drivers/platform/x86/Kconfig
|
||||||
|
index 27d5b40fb717..0e389c2e2101 100644
|
||||||
|
--- a/drivers/platform/x86/Kconfig
|
||||||
|
+++ b/drivers/platform/x86/Kconfig
|
||||||
|
@@ -1212,6 +1212,13 @@ config SURFACE_3_BUTTON
|
||||||
|
---help---
|
||||||
|
This driver handles the power/home/volume buttons on the Microsoft Surface 3 tablet.
|
||||||
|
|
||||||
|
+config SURFACE_3_POWER_OPREGION
|
||||||
|
+ tristate "Surface 3 battery platform operation region support"
|
||||||
|
+ depends on ACPI && I2C
|
||||||
|
+ help
|
||||||
|
+ Select this option to enable support for ACPI operation
|
||||||
|
+ region of the Surface 3 battery platform driver.
|
||||||
|
+
|
||||||
|
config INTEL_PUNIT_IPC
|
||||||
|
tristate "Intel P-Unit IPC Driver"
|
||||||
|
---help---
|
||||||
|
diff --git a/drivers/platform/x86/Makefile b/drivers/platform/x86/Makefile
|
||||||
|
index 42d85a00be4e..d707a8edd738 100644
|
||||||
|
--- a/drivers/platform/x86/Makefile
|
||||||
|
+++ b/drivers/platform/x86/Makefile
|
||||||
|
@@ -89,6 +89,7 @@ obj-$(CONFIG_INTEL_PMC_IPC) += intel_pmc_ipc.o
|
||||||
|
obj-$(CONFIG_TOUCHSCREEN_DMI) += touchscreen_dmi.o
|
||||||
|
obj-$(CONFIG_SURFACE_PRO3_BUTTON) += surfacepro3_button.o
|
||||||
|
obj-$(CONFIG_SURFACE_3_BUTTON) += surface3_button.o
|
||||||
|
+obj-$(CONFIG_SURFACE_3_POWER_OPREGION) += surface3_power.o
|
||||||
|
obj-$(CONFIG_INTEL_PUNIT_IPC) += intel_punit_ipc.o
|
||||||
|
obj-$(CONFIG_INTEL_BXTWC_PMIC_TMU) += intel_bxtwc_tmu.o
|
||||||
|
obj-$(CONFIG_INTEL_TELEMETRY) += intel_telemetry_core.o \
|
||||||
|
diff --git a/drivers/platform/x86/surface3_power.c b/drivers/platform/x86/surface3_power.c
|
||||||
|
new file mode 100644
|
||||||
|
index 000000000000..e0af01a60302
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/drivers/platform/x86/surface3_power.c
|
||||||
|
@@ -0,0 +1,604 @@
|
||||||
|
+// SPDX-License-Identifier: GPL-2.0+
|
||||||
|
+
|
||||||
|
+/*
|
||||||
|
+ * Supports for the power IC on the Surface 3 tablet.
|
||||||
|
+ *
|
||||||
|
+ * (C) Copyright 2016-2018 Red Hat, Inc
|
||||||
|
+ * (C) Copyright 2016-2018 Benjamin Tissoires <benjamin.tissoires@gmail.com>
|
||||||
|
+ * (C) Copyright 2016 Stephen Just <stephenjust@gmail.com>
|
||||||
|
+ *
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+/*
|
||||||
|
+ * This driver has been reverse-engineered by parsing the DSDT of the Surface 3
|
||||||
|
+ * and looking at the registers of the chips.
|
||||||
|
+ *
|
||||||
|
+ * The DSDT allowed to find out that:
|
||||||
|
+ * - the driver is required for the ACPI BAT0 device to communicate to the chip
|
||||||
|
+ * through an operation region.
|
||||||
|
+ * - the various defines for the operation region functions to communicate with
|
||||||
|
+ * this driver
|
||||||
|
+ * - the DSM 3f99e367-6220-4955-8b0f-06ef2ae79412 allows to trigger ACPI
|
||||||
|
+ * events to BAT0 (the code is all available in the DSDT).
|
||||||
|
+ *
|
||||||
|
+ * Further findings regarding the 2 chips declared in the MSHW0011 are:
|
||||||
|
+ * - there are 2 chips declared:
|
||||||
|
+ * . 0x22 seems to control the ADP1 line status (and probably the charger)
|
||||||
|
+ * . 0x55 controls the battery directly
|
||||||
|
+ * - the battery chip uses a SMBus protocol (using plain SMBus allows non
|
||||||
|
+ * destructive commands):
|
||||||
|
+ * . the commands/registers used are in the range 0x00..0x7F
|
||||||
|
+ * . if bit 8 (0x80) is set in the SMBus command, the returned value is the
|
||||||
|
+ * same as when it is not set. There is a high chance this bit is the
|
||||||
|
+ * read/write
|
||||||
|
+ * . the various registers semantic as been deduced by observing the register
|
||||||
|
+ * dumps.
|
||||||
|
+ */
|
||||||
|
+
|
||||||
|
+#include <asm/unaligned.h>
|
||||||
|
+#include <linux/acpi.h>
|
||||||
|
+#include <linux/freezer.h>
|
||||||
|
+#include <linux/i2c.h>
|
||||||
|
+#include <linux/kernel.h>
|
||||||
|
+#include <linux/kthread.h>
|
||||||
|
+#include <linux/slab.h>
|
||||||
|
+#include <linux/uuid.h>
|
||||||
|
+
|
||||||
|
+#define POLL_INTERVAL (2 * HZ)
|
||||||
|
+
|
||||||
|
+struct mshw0011_data {
|
||||||
|
+ struct i2c_client *adp1;
|
||||||
|
+ struct i2c_client *bat0;
|
||||||
|
+ unsigned short notify_mask;
|
||||||
|
+ struct task_struct *poll_task;
|
||||||
|
+ bool kthread_running;
|
||||||
|
+
|
||||||
|
+ bool charging;
|
||||||
|
+ bool bat_charging;
|
||||||
|
+ u8 trip_point;
|
||||||
|
+ s32 full_capacity;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct mshw0011_lookup {
|
||||||
|
+ struct mshw0011_data *cdata;
|
||||||
|
+ unsigned int n;
|
||||||
|
+ unsigned int index;
|
||||||
|
+ int addr;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct mshw0011_handler_data {
|
||||||
|
+ struct acpi_connection_info info;
|
||||||
|
+ struct i2c_client *client;
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+struct bix {
|
||||||
|
+ u32 revision;
|
||||||
|
+ u32 power_unit;
|
||||||
|
+ u32 design_capacity;
|
||||||
|
+ u32 last_full_charg_capacity;
|
||||||
|
+ u32 battery_technology;
|
||||||
|
+ u32 design_voltage;
|
||||||
|
+ u32 design_capacity_of_warning;
|
||||||
|
+ u32 design_capacity_of_low;
|
||||||
|
+ u32 cycle_count;
|
||||||
|
+ u32 measurement_accuracy;
|
||||||
|
+ u32 max_sampling_time;
|
||||||
|
+ u32 min_sampling_time;
|
||||||
|
+ u32 max_average_interval;
|
||||||
|
+ u32 min_average_interval;
|
||||||
|
+ u32 battery_capacity_granularity_1;
|
||||||
|
+ u32 battery_capacity_granularity_2;
|
||||||
|
+ char model[10];
|
||||||
|
+ char serial[10];
|
||||||
|
+ char type[10];
|
||||||
|
+ char OEM[10];
|
||||||
|
+} __packed;
|
||||||
|
+
|
||||||
|
+struct bst {
|
||||||
|
+ u32 battery_state;
|
||||||
|
+ s32 battery_present_rate;
|
||||||
|
+ u32 battery_remaining_capacity;
|
||||||
|
+ u32 battery_present_voltage;
|
||||||
|
+} __packed;
|
||||||
|
+
|
||||||
|
+struct gsb_command {
|
||||||
|
+ u8 arg0;
|
||||||
|
+ u8 arg1;
|
||||||
|
+ u8 arg2;
|
||||||
|
+} __packed;
|
||||||
|
+
|
||||||
|
+struct gsb_buffer {
|
||||||
|
+ u8 status;
|
||||||
|
+ u8 len;
|
||||||
|
+ u8 ret;
|
||||||
|
+ union {
|
||||||
|
+ struct gsb_command cmd;
|
||||||
|
+ struct bst bst;
|
||||||
|
+ struct bix bix;
|
||||||
|
+ } __packed;
|
||||||
|
+} __packed;
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+#define ACPI_BATTERY_STATE_DISCHARGING BIT(0)
|
||||||
|
+#define ACPI_BATTERY_STATE_CHARGING BIT(1)
|
||||||
|
+#define ACPI_BATTERY_STATE_CRITICAL BIT(2)
|
||||||
|
+
|
||||||
|
+#define MSHW0011_CMD_DEST_BAT0 0x01
|
||||||
|
+#define MSHW0011_CMD_DEST_ADP1 0x03
|
||||||
|
+
|
||||||
|
+#define MSHW0011_CMD_BAT0_STA 0x01
|
||||||
|
+#define MSHW0011_CMD_BAT0_BIX 0x02
|
||||||
|
+#define MSHW0011_CMD_BAT0_BCT 0x03
|
||||||
|
+#define MSHW0011_CMD_BAT0_BTM 0x04
|
||||||
|
+#define MSHW0011_CMD_BAT0_BST 0x05
|
||||||
|
+#define MSHW0011_CMD_BAT0_BTP 0x06
|
||||||
|
+#define MSHW0011_CMD_ADP1_PSR 0x07
|
||||||
|
+#define MSHW0011_CMD_BAT0_PSOC 0x09
|
||||||
|
+#define MSHW0011_CMD_BAT0_PMAX 0x0a
|
||||||
|
+#define MSHW0011_CMD_BAT0_PSRC 0x0b
|
||||||
|
+#define MSHW0011_CMD_BAT0_CHGI 0x0c
|
||||||
|
+#define MSHW0011_CMD_BAT0_ARTG 0x0d
|
||||||
|
+
|
||||||
|
+#define MSHW0011_NOTIFY_GET_VERSION 0x00
|
||||||
|
+#define MSHW0011_NOTIFY_ADP1 0x01
|
||||||
|
+#define MSHW0011_NOTIFY_BAT0_BST 0x02
|
||||||
|
+#define MSHW0011_NOTIFY_BAT0_BIX 0x05
|
||||||
|
+
|
||||||
|
+#define MSHW0011_ADP1_REG_PSR 0x04
|
||||||
|
+
|
||||||
|
+#define MSHW0011_BAT0_REG_CAPACITY 0x0c
|
||||||
|
+#define MSHW0011_BAT0_REG_FULL_CHG_CAPACITY 0x0e
|
||||||
|
+#define MSHW0011_BAT0_REG_DESIGN_CAPACITY 0x40
|
||||||
|
+#define MSHW0011_BAT0_REG_VOLTAGE 0x08
|
||||||
|
+#define MSHW0011_BAT0_REG_RATE 0x14
|
||||||
|
+#define MSHW0011_BAT0_REG_OEM 0x45
|
||||||
|
+#define MSHW0011_BAT0_REG_TYPE 0x4e
|
||||||
|
+#define MSHW0011_BAT0_REG_SERIAL_NO 0x56
|
||||||
|
+#define MSHW0011_BAT0_REG_CYCLE_CNT 0x6e
|
||||||
|
+
|
||||||
|
+#define MSHW0011_EV_2_5 0x1ff
|
||||||
|
+
|
||||||
|
+static int
|
||||||
|
+mshw0011_notify(struct mshw0011_data *cdata, u8 arg1, u8 arg2,
|
||||||
|
+ unsigned int *ret_value)
|
||||||
|
+{
|
||||||
|
+ static const guid_t mshw0011_guid =
|
||||||
|
+ GUID_INIT(0x3F99E367, 0x6220, 0x4955,
|
||||||
|
+ 0x8B, 0x0F, 0x06, 0xEF, 0x2A, 0xE7, 0x94, 0x12);
|
||||||
|
+ union acpi_object *obj;
|
||||||
|
+ struct acpi_device *adev;
|
||||||
|
+ acpi_handle handle;
|
||||||
|
+ unsigned int i;
|
||||||
|
+
|
||||||
|
+ handle = ACPI_HANDLE(&cdata->adp1->dev);
|
||||||
|
+ if (!handle || acpi_bus_get_device(handle, &adev))
|
||||||
|
+ return -ENODEV;
|
||||||
|
+
|
||||||
|
+ obj = acpi_evaluate_dsm_typed(handle, &mshw0011_guid, arg1, arg2, NULL,
|
||||||
|
+ ACPI_TYPE_BUFFER);
|
||||||
|
+ if (!obj) {
|
||||||
|
+ dev_err(&cdata->adp1->dev, "device _DSM execution failed\n");
|
||||||
|
+ return -ENODEV;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ *ret_value = 0;
|
||||||
|
+ for (i = 0; i < obj->buffer.length; i++)
|
||||||
|
+ *ret_value |= obj->buffer.pointer[i] << (i * 8);
|
||||||
|
+
|
||||||
|
+ ACPI_FREE(obj);
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static const struct bix default_bix = {
|
||||||
|
+ .revision = 0x00,
|
||||||
|
+ .power_unit = 0x01,
|
||||||
|
+ .design_capacity = 0x1dca,
|
||||||
|
+ .last_full_charg_capacity = 0x1dca,
|
||||||
|
+ .battery_technology = 0x01,
|
||||||
|
+ .design_voltage = 0x10df,
|
||||||
|
+ .design_capacity_of_warning = 0x8f,
|
||||||
|
+ .design_capacity_of_low = 0x47,
|
||||||
|
+ .cycle_count = 0xffffffff,
|
||||||
|
+ .measurement_accuracy = 0x00015f90,
|
||||||
|
+ .max_sampling_time = 0x03e8,
|
||||||
|
+ .min_sampling_time = 0x03e8,
|
||||||
|
+ .max_average_interval = 0x03e8,
|
||||||
|
+ .min_average_interval = 0x03e8,
|
||||||
|
+ .battery_capacity_granularity_1 = 0x45,
|
||||||
|
+ .battery_capacity_granularity_2 = 0x11,
|
||||||
|
+ .model = "P11G8M",
|
||||||
|
+ .serial = "",
|
||||||
|
+ .type = "LION",
|
||||||
|
+ .OEM = "",
|
||||||
|
+};
|
||||||
|
+
|
||||||
|
+static int mshw0011_bix(struct mshw0011_data *cdata, struct bix *bix)
|
||||||
|
+{
|
||||||
|
+ struct i2c_client *client = cdata->bat0;
|
||||||
|
+ char buf[10];
|
||||||
|
+ int ret;
|
||||||
|
+
|
||||||
|
+ *bix = default_bix;
|
||||||
|
+
|
||||||
|
+ /* get design capacity */
|
||||||
|
+ ret = i2c_smbus_read_word_data(client,
|
||||||
|
+ MSHW0011_BAT0_REG_DESIGN_CAPACITY);
|
||||||
|
+ if (ret < 0) {
|
||||||
|
+ dev_err(&client->dev, "Error reading design capacity: %d\n",
|
||||||
|
+ ret);
|
||||||
|
+ return ret;
|
||||||
|
+ }
|
||||||
|
+ bix->design_capacity = ret;
|
||||||
|
+
|
||||||
|
+ /* get last full charge capacity */
|
||||||
|
+ ret = i2c_smbus_read_word_data(client,
|
||||||
|
+ MSHW0011_BAT0_REG_FULL_CHG_CAPACITY);
|
||||||
|
+ if (ret < 0) {
|
||||||
|
+ dev_err(&client->dev,
|
||||||
|
+ "Error reading last full charge capacity: %d\n", ret);
|
||||||
|
+ return ret;
|
||||||
|
+ }
|
||||||
|
+ bix->last_full_charg_capacity = ret;
|
||||||
|
+
|
||||||
|
+ /* get serial number */
|
||||||
|
+ ret = i2c_smbus_read_i2c_block_data(client, MSHW0011_BAT0_REG_SERIAL_NO,
|
||||||
|
+ 10, buf);
|
||||||
|
+ if (ret != 10) {
|
||||||
|
+ dev_err(&client->dev, "Error reading serial no: %d\n", ret);
|
||||||
|
+ return ret;
|
||||||
|
+ }
|
||||||
|
+ snprintf(bix->serial, ARRAY_SIZE(bix->serial),
|
||||||
|
+ "%*pE%*pE", 3, buf + 7, 6, buf);
|
||||||
|
+
|
||||||
|
+ /* get cycle count */
|
||||||
|
+ ret = i2c_smbus_read_word_data(client, MSHW0011_BAT0_REG_CYCLE_CNT);
|
||||||
|
+ if (ret < 0) {
|
||||||
|
+ dev_err(&client->dev, "Error reading cycle count: %d\n", ret);
|
||||||
|
+ return ret;
|
||||||
|
+ }
|
||||||
|
+ bix->cycle_count = ret;
|
||||||
|
+
|
||||||
|
+ /* get OEM name */
|
||||||
|
+ ret = i2c_smbus_read_i2c_block_data(client, MSHW0011_BAT0_REG_OEM,
|
||||||
|
+ 4, buf);
|
||||||
|
+ if (ret != 4) {
|
||||||
|
+ dev_err(&client->dev, "Error reading cycle count: %d\n", ret);
|
||||||
|
+ return ret;
|
||||||
|
+ }
|
||||||
|
+ snprintf(bix->OEM, ARRAY_SIZE(bix->OEM), "%*pE", 3, buf);
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int mshw0011_bst(struct mshw0011_data *cdata, struct bst *bst)
|
||||||
|
+{
|
||||||
|
+ struct i2c_client *client = cdata->bat0;
|
||||||
|
+ int rate, capacity, voltage, state;
|
||||||
|
+ s16 tmp;
|
||||||
|
+
|
||||||
|
+ rate = i2c_smbus_read_word_data(client, MSHW0011_BAT0_REG_RATE);
|
||||||
|
+ if (rate < 0)
|
||||||
|
+ return rate;
|
||||||
|
+
|
||||||
|
+ capacity = i2c_smbus_read_word_data(client, MSHW0011_BAT0_REG_CAPACITY);
|
||||||
|
+ if (capacity < 0)
|
||||||
|
+ return capacity;
|
||||||
|
+
|
||||||
|
+ voltage = i2c_smbus_read_word_data(client, MSHW0011_BAT0_REG_VOLTAGE);
|
||||||
|
+ if (voltage < 0)
|
||||||
|
+ return voltage;
|
||||||
|
+
|
||||||
|
+ tmp = rate;
|
||||||
|
+ bst->battery_present_rate = abs((s32)tmp);
|
||||||
|
+
|
||||||
|
+ state = 0;
|
||||||
|
+ if ((s32) tmp > 0)
|
||||||
|
+ state |= ACPI_BATTERY_STATE_CHARGING;
|
||||||
|
+ else if ((s32) tmp < 0)
|
||||||
|
+ state |= ACPI_BATTERY_STATE_DISCHARGING;
|
||||||
|
+ bst->battery_state = state;
|
||||||
|
+
|
||||||
|
+ bst->battery_remaining_capacity = capacity;
|
||||||
|
+ bst->battery_present_voltage = voltage;
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int mshw0011_adp_psr(struct mshw0011_data *cdata)
|
||||||
|
+{
|
||||||
|
+ struct i2c_client *client = cdata->adp1;
|
||||||
|
+ int ret;
|
||||||
|
+
|
||||||
|
+ ret = i2c_smbus_read_byte_data(client, MSHW0011_ADP1_REG_PSR);
|
||||||
|
+ if (ret < 0)
|
||||||
|
+ return ret;
|
||||||
|
+
|
||||||
|
+ return ret;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int mshw0011_isr(struct mshw0011_data *cdata)
|
||||||
|
+{
|
||||||
|
+ struct bst bst;
|
||||||
|
+ struct bix bix;
|
||||||
|
+ int ret;
|
||||||
|
+ bool status, bat_status;
|
||||||
|
+
|
||||||
|
+ ret = mshw0011_adp_psr(cdata);
|
||||||
|
+ if (ret < 0)
|
||||||
|
+ return ret;
|
||||||
|
+
|
||||||
|
+ status = ret;
|
||||||
|
+
|
||||||
|
+ if (status != cdata->charging)
|
||||||
|
+ mshw0011_notify(cdata, cdata->notify_mask,
|
||||||
|
+ MSHW0011_NOTIFY_ADP1, &ret);
|
||||||
|
+
|
||||||
|
+ cdata->charging = status;
|
||||||
|
+
|
||||||
|
+ ret = mshw0011_bst(cdata, &bst);
|
||||||
|
+ if (ret < 0)
|
||||||
|
+ return ret;
|
||||||
|
+
|
||||||
|
+ bat_status = bst.battery_state;
|
||||||
|
+
|
||||||
|
+ if (bat_status != cdata->bat_charging)
|
||||||
|
+ mshw0011_notify(cdata, cdata->notify_mask,
|
||||||
|
+ MSHW0011_NOTIFY_BAT0_BST, &ret);
|
||||||
|
+
|
||||||
|
+ cdata->bat_charging = bat_status;
|
||||||
|
+
|
||||||
|
+ ret = mshw0011_bix(cdata, &bix);
|
||||||
|
+ if (ret < 0)
|
||||||
|
+ return ret;
|
||||||
|
+ if (bix.last_full_charg_capacity != cdata->full_capacity)
|
||||||
|
+ mshw0011_notify(cdata, cdata->notify_mask,
|
||||||
|
+ MSHW0011_NOTIFY_BAT0_BIX, &ret);
|
||||||
|
+
|
||||||
|
+ cdata->full_capacity = bix.last_full_charg_capacity;
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int mshw0011_poll_task(void *data)
|
||||||
|
+{
|
||||||
|
+ struct mshw0011_data *cdata = data;
|
||||||
|
+ int ret = 0;
|
||||||
|
+
|
||||||
|
+ cdata->kthread_running = true;
|
||||||
|
+
|
||||||
|
+ set_freezable();
|
||||||
|
+
|
||||||
|
+ while (!kthread_should_stop()) {
|
||||||
|
+ schedule_timeout_interruptible(POLL_INTERVAL);
|
||||||
|
+ try_to_freeze();
|
||||||
|
+ ret = mshw0011_isr(data);
|
||||||
|
+ if (ret)
|
||||||
|
+ break;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ cdata->kthread_running = false;
|
||||||
|
+ return ret;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static acpi_status
|
||||||
|
+mshw0011_space_handler(u32 function, acpi_physical_address command,
|
||||||
|
+ u32 bits, u64 *value64,
|
||||||
|
+ void *handler_context, void *region_context)
|
||||||
|
+{
|
||||||
|
+ struct gsb_buffer *gsb = (struct gsb_buffer *)value64;
|
||||||
|
+ struct mshw0011_handler_data *data = handler_context;
|
||||||
|
+ struct acpi_connection_info *info = &data->info;
|
||||||
|
+ struct acpi_resource_i2c_serialbus *sb;
|
||||||
|
+ struct i2c_client *client = data->client;
|
||||||
|
+ struct mshw0011_data *cdata = i2c_get_clientdata(client);
|
||||||
|
+ struct acpi_resource *ares;
|
||||||
|
+ u32 accessor_type = function >> 16;
|
||||||
|
+ acpi_status ret;
|
||||||
|
+ int status = 1;
|
||||||
|
+
|
||||||
|
+ ret = acpi_buffer_to_resource(info->connection, info->length, &ares);
|
||||||
|
+ if (ACPI_FAILURE(ret))
|
||||||
|
+ return ret;
|
||||||
|
+
|
||||||
|
+ if (!value64 || ares->type != ACPI_RESOURCE_TYPE_SERIAL_BUS) {
|
||||||
|
+ ret = AE_BAD_PARAMETER;
|
||||||
|
+ goto err;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ sb = &ares->data.i2c_serial_bus;
|
||||||
|
+ if (sb->type != ACPI_RESOURCE_SERIAL_TYPE_I2C) {
|
||||||
|
+ ret = AE_BAD_PARAMETER;
|
||||||
|
+ goto err;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (accessor_type != ACPI_GSB_ACCESS_ATTRIB_RAW_PROCESS) {
|
||||||
|
+ ret = AE_BAD_PARAMETER;
|
||||||
|
+ goto err;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (gsb->cmd.arg0 == MSHW0011_CMD_DEST_ADP1 &&
|
||||||
|
+ gsb->cmd.arg1 == MSHW0011_CMD_ADP1_PSR) {
|
||||||
|
+ ret = mshw0011_adp_psr(cdata);
|
||||||
|
+ if (ret >= 0) {
|
||||||
|
+ status = ret;
|
||||||
|
+ ret = 0;
|
||||||
|
+ }
|
||||||
|
+ goto out;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (gsb->cmd.arg0 != MSHW0011_CMD_DEST_BAT0) {
|
||||||
|
+ ret = AE_BAD_PARAMETER;
|
||||||
|
+ goto err;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ switch (gsb->cmd.arg1) {
|
||||||
|
+ case MSHW0011_CMD_BAT0_STA:
|
||||||
|
+ break;
|
||||||
|
+ case MSHW0011_CMD_BAT0_BIX:
|
||||||
|
+ ret = mshw0011_bix(cdata, &gsb->bix);
|
||||||
|
+ break;
|
||||||
|
+ case MSHW0011_CMD_BAT0_BTP:
|
||||||
|
+ cdata->trip_point = gsb->cmd.arg2;
|
||||||
|
+ break;
|
||||||
|
+ case MSHW0011_CMD_BAT0_BST:
|
||||||
|
+ ret = mshw0011_bst(cdata, &gsb->bst);
|
||||||
|
+ break;
|
||||||
|
+ default:
|
||||||
|
+ pr_info("command(0x%02x) is not supported.\n", gsb->cmd.arg1);
|
||||||
|
+ ret = AE_BAD_PARAMETER;
|
||||||
|
+ goto err;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ out:
|
||||||
|
+ gsb->ret = status;
|
||||||
|
+ gsb->status = 0;
|
||||||
|
+
|
||||||
|
+ err:
|
||||||
|
+ ACPI_FREE(ares);
|
||||||
|
+ return ret;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int mshw0011_install_space_handler(struct i2c_client *client)
|
||||||
|
+{
|
||||||
|
+ acpi_handle handle;
|
||||||
|
+ struct mshw0011_handler_data *data;
|
||||||
|
+ acpi_status status;
|
||||||
|
+
|
||||||
|
+ handle = ACPI_HANDLE(&client->dev);
|
||||||
|
+
|
||||||
|
+ if (!handle)
|
||||||
|
+ return -ENODEV;
|
||||||
|
+
|
||||||
|
+ data = kzalloc(sizeof(struct mshw0011_handler_data),
|
||||||
|
+ GFP_KERNEL);
|
||||||
|
+ if (!data)
|
||||||
|
+ return -ENOMEM;
|
||||||
|
+
|
||||||
|
+ data->client = client;
|
||||||
|
+ status = acpi_bus_attach_private_data(handle, (void *)data);
|
||||||
|
+ if (ACPI_FAILURE(status)) {
|
||||||
|
+ kfree(data);
|
||||||
|
+ return -ENOMEM;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ status = acpi_install_address_space_handler(handle,
|
||||||
|
+ ACPI_ADR_SPACE_GSBUS,
|
||||||
|
+ &mshw0011_space_handler,
|
||||||
|
+ NULL,
|
||||||
|
+ data);
|
||||||
|
+ if (ACPI_FAILURE(status)) {
|
||||||
|
+ dev_err(&client->dev, "Error installing i2c space handler\n");
|
||||||
|
+ acpi_bus_detach_private_data(handle);
|
||||||
|
+ kfree(data);
|
||||||
|
+ return -ENOMEM;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ acpi_walk_dep_device_list(handle);
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static void mshw0011_remove_space_handler(struct i2c_client *client)
|
||||||
|
+{
|
||||||
|
+ acpi_handle handle = ACPI_HANDLE(&client->dev);
|
||||||
|
+ struct mshw0011_handler_data *data;
|
||||||
|
+ acpi_status status;
|
||||||
|
+
|
||||||
|
+ if (!handle)
|
||||||
|
+ return;
|
||||||
|
+
|
||||||
|
+ acpi_remove_address_space_handler(handle,
|
||||||
|
+ ACPI_ADR_SPACE_GSBUS,
|
||||||
|
+ &mshw0011_space_handler);
|
||||||
|
+
|
||||||
|
+ status = acpi_bus_get_private_data(handle, (void **)&data);
|
||||||
|
+ if (ACPI_SUCCESS(status))
|
||||||
|
+ kfree(data);
|
||||||
|
+
|
||||||
|
+ acpi_bus_detach_private_data(handle);
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int mshw0011_probe(struct i2c_client *client)
|
||||||
|
+{
|
||||||
|
+ struct i2c_board_info board_info;
|
||||||
|
+ struct device *dev = &client->dev;
|
||||||
|
+ struct i2c_client *bat0;
|
||||||
|
+
|
||||||
|
+ struct mshw0011_data *data;
|
||||||
|
+ int error, mask;
|
||||||
|
+
|
||||||
|
+ data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL);
|
||||||
|
+ if (!data)
|
||||||
|
+ return -ENOMEM;
|
||||||
|
+
|
||||||
|
+ data->adp1 = client;
|
||||||
|
+ i2c_set_clientdata(client, data);
|
||||||
|
+
|
||||||
|
+ memset(&board_info, 0, sizeof(board_info));
|
||||||
|
+ strlcpy(board_info.type, "MSHW0011-bat0", I2C_NAME_SIZE);
|
||||||
|
+
|
||||||
|
+ bat0 = i2c_acpi_new_device(dev, 1, &board_info);
|
||||||
|
+ if (!bat0)
|
||||||
|
+ return -ENOMEM;
|
||||||
|
+
|
||||||
|
+ data->bat0 = bat0;
|
||||||
|
+ i2c_set_clientdata(bat0, data);
|
||||||
|
+
|
||||||
|
+ error = mshw0011_notify(data, 1, MSHW0011_NOTIFY_GET_VERSION, &mask);
|
||||||
|
+ if (error)
|
||||||
|
+ goto out_err;
|
||||||
|
+
|
||||||
|
+ data->notify_mask = mask == MSHW0011_EV_2_5;
|
||||||
|
+
|
||||||
|
+ data->poll_task = kthread_run(mshw0011_poll_task, data, "mshw0011_adp");
|
||||||
|
+ if (IS_ERR(data->poll_task)) {
|
||||||
|
+ error = PTR_ERR(data->poll_task);
|
||||||
|
+ dev_err(&client->dev, "Unable to run kthread err %d\n", error);
|
||||||
|
+ goto out_err;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ error = mshw0011_install_space_handler(client);
|
||||||
|
+ if (error)
|
||||||
|
+ goto out_err;
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+
|
||||||
|
+out_err:
|
||||||
|
+ if (data->kthread_running)
|
||||||
|
+ kthread_stop(data->poll_task);
|
||||||
|
+ i2c_unregister_device(data->bat0);
|
||||||
|
+ return error;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static int mshw0011_remove(struct i2c_client *client)
|
||||||
|
+{
|
||||||
|
+ struct mshw0011_data *cdata = i2c_get_clientdata(client);
|
||||||
|
+
|
||||||
|
+ mshw0011_remove_space_handler(client);
|
||||||
|
+
|
||||||
|
+ if (cdata->kthread_running)
|
||||||
|
+ kthread_stop(cdata->poll_task);
|
||||||
|
+
|
||||||
|
+ i2c_unregister_device(cdata->bat0);
|
||||||
|
+
|
||||||
|
+ return 0;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+static const struct acpi_device_id mshw0011_acpi_match[] = {
|
||||||
|
+ { "MSHW0011", 0 },
|
||||||
|
+ { }
|
||||||
|
+};
|
||||||
|
+MODULE_DEVICE_TABLE(acpi, mshw0011_acpi_match);
|
||||||
|
+
|
||||||
|
+static struct i2c_driver mshw0011_driver = {
|
||||||
|
+ .probe_new = mshw0011_probe,
|
||||||
|
+ .remove = mshw0011_remove,
|
||||||
|
+ .driver = {
|
||||||
|
+ .name = "mshw0011",
|
||||||
|
+ .acpi_match_table = ACPI_PTR(mshw0011_acpi_match),
|
||||||
|
+ },
|
||||||
|
+};
|
||||||
|
+module_i2c_driver(mshw0011_driver);
|
||||||
|
+
|
||||||
|
+MODULE_AUTHOR("Benjamin Tissoires <benjamin.tissoires@gmail.com>");
|
||||||
|
+MODULE_DESCRIPTION("mshw0011 driver");
|
||||||
|
+MODULE_LICENSE("GPL v2");
|
||||||
|
--
|
||||||
|
2.25.0
|
||||||
|
|
63
patches/5.5/0002-surface3-spi.patch
Normal file
63
patches/5.5/0002-surface3-spi.patch
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
From fc5a0e4525516353e76a8a3ef348dcd84d935fc4 Mon Sep 17 00:00:00 2001
|
||||||
|
From: kitakar5525 <34676735+kitakar5525@users.noreply.github.com>
|
||||||
|
Date: Fri, 6 Dec 2019 23:10:30 +0900
|
||||||
|
Subject: [PATCH 2/7] surface3-spi
|
||||||
|
|
||||||
|
---
|
||||||
|
drivers/input/touchscreen/surface3_spi.c | 26 ++++++++++++++++++++++++
|
||||||
|
1 file changed, 26 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/drivers/input/touchscreen/surface3_spi.c b/drivers/input/touchscreen/surface3_spi.c
|
||||||
|
index ce4828b1415a..63b0b8ddf090 100644
|
||||||
|
--- a/drivers/input/touchscreen/surface3_spi.c
|
||||||
|
+++ b/drivers/input/touchscreen/surface3_spi.c
|
||||||
|
@@ -25,6 +25,12 @@
|
||||||
|
#define SURFACE3_REPORT_TOUCH 0xd2
|
||||||
|
#define SURFACE3_REPORT_PEN 0x16
|
||||||
|
|
||||||
|
+bool use_dma = false;
|
||||||
|
+module_param(use_dma, bool, 0644);
|
||||||
|
+MODULE_PARM_DESC(use_dma,
|
||||||
|
+ "Disable DMA mode if you encounter touch input crash. "
|
||||||
|
+ "(default: false, disabled to avoid crash)");
|
||||||
|
+
|
||||||
|
struct surface3_ts_data {
|
||||||
|
struct spi_device *spi;
|
||||||
|
struct gpio_desc *gpiod_rst[2];
|
||||||
|
@@ -326,6 +332,13 @@ static int surface3_spi_create_pen_input(struct surface3_ts_data *data)
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
+static bool surface3_spi_can_dma(struct spi_controller *ctlr,
|
||||||
|
+ struct spi_device *spi,
|
||||||
|
+ struct spi_transfer *tfr)
|
||||||
|
+{
|
||||||
|
+ return use_dma;
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
static int surface3_spi_probe(struct spi_device *spi)
|
||||||
|
{
|
||||||
|
struct surface3_ts_data *data;
|
||||||
|
@@ -368,6 +381,19 @@ static int surface3_spi_probe(struct spi_device *spi)
|
||||||
|
if (error)
|
||||||
|
return error;
|
||||||
|
|
||||||
|
+ /*
|
||||||
|
+ * Set up DMA
|
||||||
|
+ *
|
||||||
|
+ * TODO: Currently, touch input with DMA seems to be broken.
|
||||||
|
+ * On 4.19 LTS, touch input will crash after suspend.
|
||||||
|
+ * On recent stable kernel (at least after 5.1), touch input will crash after
|
||||||
|
+ * the first touch. No problem with PIO on those kernels.
|
||||||
|
+ * Maybe we need to configure DMA here.
|
||||||
|
+ *
|
||||||
|
+ * Link to issue: https://github.com/jakeday/linux-surface/issues/596
|
||||||
|
+ */
|
||||||
|
+ spi->controller->can_dma = surface3_spi_can_dma;
|
||||||
|
+
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
--
|
||||||
|
2.25.0
|
||||||
|
|
69
patches/5.5/0003-surface3-oemb.patch
Normal file
69
patches/5.5/0003-surface3-oemb.patch
Normal file
|
@ -0,0 +1,69 @@
|
||||||
|
From 857c3a83a3a85f1594e05aee5a27a563bda1d6c2 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Chih-Wei Huang <cwhuang@linux.org.tw>
|
||||||
|
Date: Tue, 18 Sep 2018 11:01:37 +0800
|
||||||
|
Subject: [PATCH 3/7] surface3-oemb
|
||||||
|
|
||||||
|
---
|
||||||
|
drivers/platform/x86/surface3-wmi.c | 7 +++++++
|
||||||
|
sound/soc/codecs/rt5645.c | 9 +++++++++
|
||||||
|
sound/soc/intel/common/soc-acpi-intel-cht-match.c | 6 ++++++
|
||||||
|
3 files changed, 22 insertions(+)
|
||||||
|
|
||||||
|
diff --git a/drivers/platform/x86/surface3-wmi.c b/drivers/platform/x86/surface3-wmi.c
|
||||||
|
index 130b6f52a600..801083aa56d6 100644
|
||||||
|
--- a/drivers/platform/x86/surface3-wmi.c
|
||||||
|
+++ b/drivers/platform/x86/surface3-wmi.c
|
||||||
|
@@ -37,6 +37,13 @@ static const struct dmi_system_id surface3_dmi_table[] = {
|
||||||
|
DMI_MATCH(DMI_PRODUCT_NAME, "Surface 3"),
|
||||||
|
},
|
||||||
|
},
|
||||||
|
+ {
|
||||||
|
+ .matches = {
|
||||||
|
+ DMI_MATCH(DMI_BIOS_VENDOR, "American Megatrends Inc."),
|
||||||
|
+ DMI_MATCH(DMI_SYS_VENDOR, "OEMB"),
|
||||||
|
+ DMI_MATCH(DMI_PRODUCT_NAME, "OEMB"),
|
||||||
|
+ },
|
||||||
|
+ },
|
||||||
|
#endif
|
||||||
|
{ }
|
||||||
|
};
|
||||||
|
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c
|
||||||
|
index 92d67010aeed..cdfd75acd1a5 100644
|
||||||
|
--- a/sound/soc/codecs/rt5645.c
|
||||||
|
+++ b/sound/soc/codecs/rt5645.c
|
||||||
|
@@ -3681,6 +3681,15 @@ static const struct dmi_system_id dmi_platform_data[] = {
|
||||||
|
},
|
||||||
|
.driver_data = (void *)&intel_braswell_platform_data,
|
||||||
|
},
|
||||||
|
+ {
|
||||||
|
+ .ident = "Microsoft Surface 3",
|
||||||
|
+ .matches = {
|
||||||
|
+ DMI_MATCH(DMI_BIOS_VENDOR, "American Megatrends Inc."),
|
||||||
|
+ DMI_MATCH(DMI_SYS_VENDOR, "OEMB"),
|
||||||
|
+ DMI_MATCH(DMI_PRODUCT_NAME, "OEMB"),
|
||||||
|
+ },
|
||||||
|
+ .driver_data = (void *)&intel_braswell_platform_data,
|
||||||
|
+ },
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* Match for the GPDwin which unfortunately uses somewhat
|
||||||
|
diff --git a/sound/soc/intel/common/soc-acpi-intel-cht-match.c b/sound/soc/intel/common/soc-acpi-intel-cht-match.c
|
||||||
|
index d0fb43c2b9f6..de2583918afd 100644
|
||||||
|
--- a/sound/soc/intel/common/soc-acpi-intel-cht-match.c
|
||||||
|
+++ b/sound/soc/intel/common/soc-acpi-intel-cht-match.c
|
||||||
|
@@ -26,6 +26,12 @@ static const struct dmi_system_id cht_table[] = {
|
||||||
|
DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
|
||||||
|
DMI_MATCH(DMI_PRODUCT_NAME, "Surface 3"),
|
||||||
|
},
|
||||||
|
+ .callback = cht_surface_quirk_cb,
|
||||||
|
+ .matches = {
|
||||||
|
+ DMI_MATCH(DMI_BIOS_VENDOR, "American Megatrends Inc."),
|
||||||
|
+ DMI_MATCH(DMI_SYS_VENDOR, "OEMB"),
|
||||||
|
+ DMI_MATCH(DMI_PRODUCT_NAME, "OEMB"),
|
||||||
|
+ },
|
||||||
|
},
|
||||||
|
{ }
|
||||||
|
};
|
||||||
|
--
|
||||||
|
2.25.0
|
||||||
|
|
7435
patches/5.5/0004-surface-sam.patch
Normal file
7435
patches/5.5/0004-surface-sam.patch
Normal file
File diff suppressed because it is too large
Load diff
24
patches/5.5/0005-surface-lte.patch
Normal file
24
patches/5.5/0005-surface-lte.patch
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
From 0ee693298b617d670267684fdfa918aec482e46c Mon Sep 17 00:00:00 2001
|
||||||
|
From: qzed <qzed@users.noreply.github.com>
|
||||||
|
Date: Tue, 17 Sep 2019 17:21:43 +0200
|
||||||
|
Subject: [PATCH 5/7] surface-lte
|
||||||
|
|
||||||
|
---
|
||||||
|
drivers/usb/serial/qcserial.c | 1 +
|
||||||
|
1 file changed, 1 insertion(+)
|
||||||
|
|
||||||
|
diff --git a/drivers/usb/serial/qcserial.c b/drivers/usb/serial/qcserial.c
|
||||||
|
index 613f91add03d..e1428222dd73 100644
|
||||||
|
--- a/drivers/usb/serial/qcserial.c
|
||||||
|
+++ b/drivers/usb/serial/qcserial.c
|
||||||
|
@@ -177,6 +177,7 @@ static const struct usb_device_id id_table[] = {
|
||||||
|
{DEVICE_SWI(0x413c, 0x81d0)}, /* Dell Wireless 5819 */
|
||||||
|
{DEVICE_SWI(0x413c, 0x81d1)}, /* Dell Wireless 5818 */
|
||||||
|
{DEVICE_SWI(0x413c, 0x81d2)}, /* Dell Wireless 5818 */
|
||||||
|
+ {DEVICE_SWI(0x045e, 0x096e)}, /* Microsoft Surface Go LTE */
|
||||||
|
|
||||||
|
/* Huawei devices */
|
||||||
|
{DEVICE_HWI(0x03f0, 0x581d)}, /* HP lt4112 LTE/HSPA+ Gobi 4G Modem (Huawei me906e) */
|
||||||
|
--
|
||||||
|
2.25.0
|
||||||
|
|
168
patches/5.5/0006-wifi.patch
Normal file
168
patches/5.5/0006-wifi.patch
Normal file
|
@ -0,0 +1,168 @@
|
||||||
|
From cdab476c49e26bfef7c1f8fab8f272406700fd7b Mon Sep 17 00:00:00 2001
|
||||||
|
From: sebanc <22224731+sebanc@users.noreply.github.com>
|
||||||
|
Date: Mon, 4 Nov 2019 09:30:57 +0100
|
||||||
|
Subject: [PATCH 6/7] wifi
|
||||||
|
|
||||||
|
---
|
||||||
|
drivers/net/wireless/marvell/mwifiex/pcie.c | 74 ++++++++++---------
|
||||||
|
.../net/wireless/marvell/mwifiex/sta_cmd.c | 15 +---
|
||||||
|
2 files changed, 41 insertions(+), 48 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c
|
||||||
|
index fc1706d0647d..b3380ed75431 100644
|
||||||
|
--- a/drivers/net/wireless/marvell/mwifiex/pcie.c
|
||||||
|
+++ b/drivers/net/wireless/marvell/mwifiex/pcie.c
|
||||||
|
@@ -149,35 +149,38 @@ static bool mwifiex_pcie_ok_to_access_hw(struct mwifiex_adapter *adapter)
|
||||||
|
*/
|
||||||
|
static int mwifiex_pcie_suspend(struct device *dev)
|
||||||
|
{
|
||||||
|
+ struct pci_dev *pdev = to_pci_dev(dev);
|
||||||
|
+ struct pcie_service_card *card = pci_get_drvdata(pdev);
|
||||||
|
struct mwifiex_adapter *adapter;
|
||||||
|
- struct pcie_service_card *card = dev_get_drvdata(dev);
|
||||||
|
-
|
||||||
|
+ struct mwifiex_private *priv;
|
||||||
|
+ const struct mwifiex_pcie_card_reg *reg;
|
||||||
|
+ u32 fw_status;
|
||||||
|
+ int ret;
|
||||||
|
|
||||||
|
/* Might still be loading firmware */
|
||||||
|
wait_for_completion(&card->fw_done);
|
||||||
|
|
||||||
|
adapter = card->adapter;
|
||||||
|
- if (!adapter) {
|
||||||
|
- dev_err(dev, "adapter is not valid\n");
|
||||||
|
+ if (!adapter || !adapter->priv_num)
|
||||||
|
return 0;
|
||||||
|
- }
|
||||||
|
|
||||||
|
- mwifiex_enable_wake(adapter);
|
||||||
|
+ reg = card->pcie.reg;
|
||||||
|
+ if (reg)
|
||||||
|
+ ret = mwifiex_read_reg(adapter, reg->fw_status, &fw_status);
|
||||||
|
+ else
|
||||||
|
+ fw_status = -1;
|
||||||
|
+
|
||||||
|
+ if (fw_status == FIRMWARE_READY_PCIE && !adapter->mfg_mode) {
|
||||||
|
+ mwifiex_deauthenticate_all(adapter);
|
||||||
|
|
||||||
|
- /* Enable the Host Sleep */
|
||||||
|
- if (!mwifiex_enable_hs(adapter)) {
|
||||||
|
- mwifiex_dbg(adapter, ERROR,
|
||||||
|
- "cmd: failed to suspend\n");
|
||||||
|
- clear_bit(MWIFIEX_IS_HS_ENABLING, &adapter->work_flags);
|
||||||
|
- mwifiex_disable_wake(adapter);
|
||||||
|
- return -EFAULT;
|
||||||
|
- }
|
||||||
|
+ priv = mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_ANY);
|
||||||
|
|
||||||
|
- flush_workqueue(adapter->workqueue);
|
||||||
|
+ mwifiex_disable_auto_ds(priv);
|
||||||
|
|
||||||
|
- /* Indicate device suspended */
|
||||||
|
- set_bit(MWIFIEX_IS_SUSPENDED, &adapter->work_flags);
|
||||||
|
- clear_bit(MWIFIEX_IS_HS_ENABLING, &adapter->work_flags);
|
||||||
|
+ mwifiex_init_shutdown_fw(priv, MWIFIEX_FUNC_SHUTDOWN);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ mwifiex_remove_card(adapter);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
@@ -192,28 +195,29 @@ static int mwifiex_pcie_suspend(struct device *dev)
|
||||||
|
*/
|
||||||
|
static int mwifiex_pcie_resume(struct device *dev)
|
||||||
|
{
|
||||||
|
- struct mwifiex_adapter *adapter;
|
||||||
|
- struct pcie_service_card *card = dev_get_drvdata(dev);
|
||||||
|
+ struct pci_dev *pdev = to_pci_dev(dev);
|
||||||
|
+ struct pcie_service_card *card = pci_get_drvdata(pdev);
|
||||||
|
+ int ret;
|
||||||
|
|
||||||
|
+ pr_debug("info: vendor=0x%4.04X device=0x%4.04X rev=%d\n",
|
||||||
|
+ pdev->vendor, pdev->device, pdev->revision);
|
||||||
|
|
||||||
|
- if (!card->adapter) {
|
||||||
|
- dev_err(dev, "adapter structure is not valid\n");
|
||||||
|
- return 0;
|
||||||
|
- }
|
||||||
|
+ init_completion(&card->fw_done);
|
||||||
|
|
||||||
|
- adapter = card->adapter;
|
||||||
|
+ card->dev = pdev;
|
||||||
|
|
||||||
|
- if (!test_bit(MWIFIEX_IS_SUSPENDED, &adapter->work_flags)) {
|
||||||
|
- mwifiex_dbg(adapter, WARN,
|
||||||
|
- "Device already resumed\n");
|
||||||
|
- return 0;
|
||||||
|
+ /* device tree node parsing and platform specific configuration */
|
||||||
|
+ if (pdev->dev.of_node) {
|
||||||
|
+ ret = mwifiex_pcie_probe_of(&pdev->dev);
|
||||||
|
+ if (ret)
|
||||||
|
+ return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
- clear_bit(MWIFIEX_IS_SUSPENDED, &adapter->work_flags);
|
||||||
|
-
|
||||||
|
- mwifiex_cancel_hs(mwifiex_get_priv(adapter, MWIFIEX_BSS_ROLE_STA),
|
||||||
|
- MWIFIEX_ASYNC_CMD);
|
||||||
|
- mwifiex_disable_wake(adapter);
|
||||||
|
+ if (mwifiex_add_card(card, &card->fw_done, &pcie_ops,
|
||||||
|
+ MWIFIEX_PCIE, &pdev->dev)) {
|
||||||
|
+ pr_err("%s failed\n", __func__);
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
@@ -267,6 +271,8 @@ static int mwifiex_pcie_probe(struct pci_dev *pdev,
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
+ pdev->bus->self->bridge_d3 = false;
|
||||||
|
+
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
diff --git a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c b/drivers/net/wireless/marvell/mwifiex/sta_cmd.c
|
||||||
|
index 4ed10cf82f9a..013db4386c39 100644
|
||||||
|
--- a/drivers/net/wireless/marvell/mwifiex/sta_cmd.c
|
||||||
|
+++ b/drivers/net/wireless/marvell/mwifiex/sta_cmd.c
|
||||||
|
@@ -2265,14 +2265,13 @@ int mwifiex_sta_prepare_cmd(struct mwifiex_private *priv, uint16_t cmd_no,
|
||||||
|
int mwifiex_sta_init_cmd(struct mwifiex_private *priv, u8 first_sta, bool init)
|
||||||
|
{
|
||||||
|
struct mwifiex_adapter *adapter = priv->adapter;
|
||||||
|
- int ret;
|
||||||
|
struct mwifiex_ds_11n_amsdu_aggr_ctrl amsdu_aggr_ctrl;
|
||||||
|
- struct mwifiex_ds_auto_ds auto_ds;
|
||||||
|
enum state_11d_t state_11d;
|
||||||
|
struct mwifiex_ds_11n_tx_cfg tx_cfg;
|
||||||
|
u8 sdio_sp_rx_aggr_enable;
|
||||||
|
u16 packet_aggr_enable;
|
||||||
|
int data;
|
||||||
|
+ int ret;
|
||||||
|
|
||||||
|
if (first_sta) {
|
||||||
|
if (priv->adapter->iface_type == MWIFIEX_PCIE) {
|
||||||
|
@@ -2395,18 +2394,6 @@ int mwifiex_sta_init_cmd(struct mwifiex_private *priv, u8 first_sta, bool init)
|
||||||
|
if (ret)
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
- if (!disable_auto_ds && first_sta &&
|
||||||
|
- priv->bss_type != MWIFIEX_BSS_TYPE_UAP) {
|
||||||
|
- /* Enable auto deep sleep */
|
||||||
|
- auto_ds.auto_ds = DEEP_SLEEP_ON;
|
||||||
|
- auto_ds.idle_time = DEEP_SLEEP_IDLE_TIME;
|
||||||
|
- ret = mwifiex_send_cmd(priv, HostCmd_CMD_802_11_PS_MODE_ENH,
|
||||||
|
- EN_AUTO_PS, BITMAP_AUTO_DS,
|
||||||
|
- &auto_ds, true);
|
||||||
|
- if (ret)
|
||||||
|
- return -1;
|
||||||
|
- }
|
||||||
|
-
|
||||||
|
if (priv->bss_type != MWIFIEX_BSS_TYPE_UAP) {
|
||||||
|
/* Send cmd to FW to enable/disable 11D function */
|
||||||
|
state_11d = ENABLE_11D;
|
||||||
|
--
|
||||||
|
2.25.0
|
||||||
|
|
1890
patches/5.5/0007-ipts.patch
Normal file
1890
patches/5.5/0007-ipts.patch
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue