diff options
author | Thorsten Leemhuis <fedora@leemhuis.info> | 2018-11-21 09:46:59 +0100 |
---|---|---|
committer | Thorsten Leemhuis <fedora@leemhuis.info> | 2018-11-21 09:46:59 +0100 |
commit | 2553ec8da9c4b4d936e8af8f1e46f339a0be8627 (patch) | |
tree | 8c030e368490e0c87ef2bffebbdc330ef382345b | |
parent | e29eed6e49546fa25e917c82b54a8d74751f962a (diff) | |
parent | eecf80b4af10b6dc69998b40f2e9a3a5f792a831 (diff) | |
download | kernel-2553ec8da9c4b4d936e8af8f1e46f339a0be8627.tar.gz kernel-2553ec8da9c4b4d936e8af8f1e46f339a0be8627.tar.xz kernel-2553ec8da9c4b4d936e8af8f1e46f339a0be8627.zip |
merge origin
-rw-r--r-- | 0001-ACPI-platform-Add-SMB0001-HID-to-forbidden_id_list.patch | 104 | ||||
-rw-r--r-- | 0001-HID-i2c-hid-override-HID-descriptors-for-certain-dev.patch | 564 | ||||
-rw-r--r-- | brcmfmac-Remove-firmware-loading-code-duplication.patch | 603 | ||||
-rw-r--r-- | cherrytrail-pwm-lpss-fixes.patch | 525 | ||||
-rw-r--r-- | configs/fedora/generic/x86/CONFIG_PINCTRL_GEMINILAKE | 2 | ||||
-rw-r--r-- | hwmon-rpi-Fix-initial-notify.patch | 112 | ||||
-rw-r--r-- | iio-accel-kxcjk1013-Add-more-hardware-ids.patch | 63 | ||||
-rw-r--r-- | kernel-i686-debug.config | 2 | ||||
-rw-r--r-- | kernel-i686.config | 2 | ||||
-rw-r--r-- | kernel-x86_64-debug.config | 2 | ||||
-rw-r--r-- | kernel-x86_64.config | 2 | ||||
-rw-r--r-- | kernel.spec | 35 | ||||
-rw-r--r-- | raspberrypi-Fix-firmware-calls-with-large-buffers.patch | 245 |
13 files changed, 1747 insertions, 514 deletions
diff --git a/0001-ACPI-platform-Add-SMB0001-HID-to-forbidden_id_list.patch b/0001-ACPI-platform-Add-SMB0001-HID-to-forbidden_id_list.patch new file mode 100644 index 000000000..822e497af --- /dev/null +++ b/0001-ACPI-platform-Add-SMB0001-HID-to-forbidden_id_list.patch @@ -0,0 +1,104 @@ +From 5afcaee5ee71ba730fde8f66da7e320fb7e674d2 Mon Sep 17 00:00:00 2001 +From: Hans de Goede <hdegoede@redhat.com> +Date: Mon, 19 Nov 2018 17:38:59 +0100 +Subject: [PATCH 4.20 regression fix] ACPI / platform: Add SMB0001 HID to + forbidden_id_list + +Many HP AMD based laptops contain an SMB0001 device like this: + +Device (SMBD) +{ + Name (_HID, "SMB0001") // _HID: Hardware ID + Name (_CRS, ResourceTemplate () // _CRS: Current Resource Settings + { + IO (Decode16, + 0x0B20, // Range Minimum + 0x0B20, // Range Maximum + 0x20, // Alignment + 0x20, // Length + ) + IRQ (Level, ActiveLow, Shared, ) + {7} + }) +} + +The legacy style IRQ resource here causes acpi_dev_get_irqresource() to +be called with legacy=true and this message to show in dmesg: +ACPI: IRQ 7 override to edge, high + +This causes issues when later on the AMD0030 GPIO device gets enumerated: + +Device (GPIO) +{ + Name (_HID, "AMDI0030") // _HID: Hardware ID + Name (_CID, "AMDI0030") // _CID: Compatible ID + Name (_UID, Zero) // _UID: Unique ID + Method (_CRS, 0, NotSerialized) // _CRS: Current Resource Settings + { + Name (RBUF, ResourceTemplate () + { + Interrupt (ResourceConsumer, Level, ActiveLow, Shared, ,, ) + { + 0x00000007, + } + Memory32Fixed (ReadWrite, + 0xFED81500, // Address Base + 0x00000400, // Address Length + ) + }) + Return (RBUF) /* \_SB_.GPIO._CRS.RBUF */ + } +} + +Now acpi_dev_get_irqresource() gets called with legacy=false, but because +of the earlier override of the trigger-type acpi_register_gsi() returns +-EBUSY (because we try to register the same interrupt with a different +trigger-type) and we end up setting IORESOURCE_DISABLED in the flags. + +The setting of IORESOURCE_DISABLED causes platform_get_irq() to call +acpi_irq_get() which is not implemented on x86 and returns -EINVAL. +resulting in the following in dmesg: + +amd_gpio AMDI0030:00: Failed to get gpio IRQ: -22 +amd_gpio: probe of AMDI0030:00 failed with error -22 + +The SMB0001 is a "virtual" device in the sense that the only way the OS +interacts with it is through calling a couple of methods to do SMBus +transfers. As such it is weird that it has IO and IRQ resources at all, +because the driver for it is not expected to ever access the hardware +directly. + +The Linux driver for the SMB0001 device directly binds to the acpi_device +through the acpi_bus, so we do not need to instantiate a platform_device +for this ACPI device. This commit adds the SMB0001 HID to the +forbidden_id_list, avoiding the instantiating of a platform_device for it. +Not instantiating a platform_device means we will no longer call +acpi_dev_get_irqresource() for the legacy IRQ resource fixing the probe of +the AMDI0030 device failing. + +BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1644013 +BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=198715 +BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=199523 +Reported-by: Lukas Kahnert <openproggerfreak@gmail.com> +Tested-by: Marc <suaefar@googlemail.com> +Cc: stable@vger.kernel.org +Signed-off-by: Hans de Goede <hdegoede@redhat.com> +--- + drivers/acpi/acpi_platform.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/acpi/acpi_platform.c b/drivers/acpi/acpi_platform.c +index eaa60c94205a..1f32caa87686 100644 +--- a/drivers/acpi/acpi_platform.c ++++ b/drivers/acpi/acpi_platform.c +@@ -30,6 +30,7 @@ static const struct acpi_device_id forbidden_id_list[] = { + {"PNP0200", 0}, /* AT DMA Controller */ + {"ACPI0009", 0}, /* IOxAPIC */ + {"ACPI000A", 0}, /* IOAPIC */ ++ {"SMB0001", 0}, /* ACPI SMBUS virtual device */ + {"", 0}, + }; + +-- +2.19.1 + diff --git a/0001-HID-i2c-hid-override-HID-descriptors-for-certain-dev.patch b/0001-HID-i2c-hid-override-HID-descriptors-for-certain-dev.patch new file mode 100644 index 000000000..68801ccec --- /dev/null +++ b/0001-HID-i2c-hid-override-HID-descriptors-for-certain-dev.patch @@ -0,0 +1,564 @@ +From 9ee3e06610fdb8a601cde59c92089fb6c1deb4aa Mon Sep 17 00:00:00 2001 +From: Julian Sax <jsbc@gmx.de> +Date: Wed, 19 Sep 2018 11:46:23 +0200 +Subject: [PATCH] HID: i2c-hid: override HID descriptors for certain devices + +A particular touchpad (SIPODEV SP1064) refuses to supply the HID +descriptors. This patch provides the framework for overriding these +descriptors based on DMI data. It also includes the descriptors for +said touchpad, which were extracted by listening to the traffic of the +windows filter driver, as well as the DMI data for the laptops known +to use this device. + +Relevant Bug: https://bugzilla.redhat.com/show_bug.cgi?id=1526312 + +Cc: Hans de Goede <hdegoede@redhat.com> +Reported-and-tested-by: ahormann@gmx.net +Reported-and-tested-by: Bruno Jesus <bruno.fl.jesus@gmail.com> +Reported-and-tested-by: Dietrich <enaut.w@googlemail.com> +Reported-and-tested-by: kloxdami@yahoo.com +Signed-off-by: Julian Sax <jsbc@gmx.de> +Reviewed-by: Benjamin Tissoires <benjamin.tissoires@redhat.com> +Signed-off-by: Jiri Kosina <jkosina@suse.cz> +--- + drivers/hid/i2c-hid/Makefile | 3 + + .../hid/i2c-hid/{i2c-hid.c => i2c-hid-core.c} | 60 ++- + drivers/hid/i2c-hid/i2c-hid-dmi-quirks.c | 376 ++++++++++++++++++ + drivers/hid/i2c-hid/i2c-hid.h | 20 + + 4 files changed, 439 insertions(+), 20 deletions(-) + rename drivers/hid/i2c-hid/{i2c-hid.c => i2c-hid-core.c} (96%) + create mode 100644 drivers/hid/i2c-hid/i2c-hid-dmi-quirks.c + create mode 100644 drivers/hid/i2c-hid/i2c-hid.h + +diff --git a/drivers/hid/i2c-hid/Makefile b/drivers/hid/i2c-hid/Makefile +index 832d8f9aaba2..099e1ce2f234 100644 +--- a/drivers/hid/i2c-hid/Makefile ++++ b/drivers/hid/i2c-hid/Makefile +@@ -3,3 +3,6 @@ + # + + obj-$(CONFIG_I2C_HID) += i2c-hid.o ++ ++i2c-hid-objs = i2c-hid-core.o ++i2c-hid-$(CONFIG_DMI) += i2c-hid-dmi-quirks.o +diff --git a/drivers/hid/i2c-hid/i2c-hid.c b/drivers/hid/i2c-hid/i2c-hid-core.c +similarity index 96% +rename from drivers/hid/i2c-hid/i2c-hid.c +rename to drivers/hid/i2c-hid/i2c-hid-core.c +index f3076659361a..823c63ad08b1 100644 +--- a/drivers/hid/i2c-hid/i2c-hid.c ++++ b/drivers/hid/i2c-hid/i2c-hid-core.c +@@ -43,6 +43,7 @@ + #include <linux/platform_data/i2c-hid.h> + + #include "../hid-ids.h" ++#include "i2c-hid.h" + + /* quirks to control the device */ + #define I2C_HID_QUIRK_SET_PWR_WAKEUP_DEV BIT(0) +@@ -669,6 +670,7 @@ static int i2c_hid_parse(struct hid_device *hid) + char *rdesc; + int ret; + int tries = 3; ++ char *use_override; + + i2c_hid_dbg(ihid, "entering %s\n", __func__); + +@@ -687,26 +689,37 @@ static int i2c_hid_parse(struct hid_device *hid) + if (ret) + return ret; + +- rdesc = kzalloc(rsize, GFP_KERNEL); ++ use_override = i2c_hid_get_dmi_hid_report_desc_override(client->name, ++ &rsize); + +- if (!rdesc) { +- dbg_hid("couldn't allocate rdesc memory\n"); +- return -ENOMEM; +- } +- +- i2c_hid_dbg(ihid, "asking HID report descriptor\n"); +- +- ret = i2c_hid_command(client, &hid_report_descr_cmd, rdesc, rsize); +- if (ret) { +- hid_err(hid, "reading report descriptor failed\n"); +- kfree(rdesc); +- return -EIO; ++ if (use_override) { ++ rdesc = use_override; ++ i2c_hid_dbg(ihid, "Using a HID report descriptor override\n"); ++ } else { ++ rdesc = kzalloc(rsize, GFP_KERNEL); ++ ++ if (!rdesc) { ++ dbg_hid("couldn't allocate rdesc memory\n"); ++ return -ENOMEM; ++ } ++ ++ i2c_hid_dbg(ihid, "asking HID report descriptor\n"); ++ ++ ret = i2c_hid_command(client, &hid_report_descr_cmd, ++ rdesc, rsize); ++ if (ret) { ++ hid_err(hid, "reading report descriptor failed\n"); ++ kfree(rdesc); ++ return -EIO; ++ } + } + + i2c_hid_dbg(ihid, "Report Descriptor: %*ph\n", rsize, rdesc); + + ret = hid_parse_report(hid, rdesc, rsize); +- kfree(rdesc); ++ if (!use_override) ++ kfree(rdesc); ++ + if (ret) { + dbg_hid("parsing report descriptor failed\n"); + return ret; +@@ -833,12 +846,19 @@ static int i2c_hid_fetch_hid_descriptor(struct i2c_hid *ihid) + int ret; + + /* i2c hid fetch using a fixed descriptor size (30 bytes) */ +- i2c_hid_dbg(ihid, "Fetching the HID descriptor\n"); +- ret = i2c_hid_command(client, &hid_descr_cmd, ihid->hdesc_buffer, +- sizeof(struct i2c_hid_desc)); +- if (ret) { +- dev_err(&client->dev, "hid_descr_cmd failed\n"); +- return -ENODEV; ++ if (i2c_hid_get_dmi_i2c_hid_desc_override(client->name)) { ++ i2c_hid_dbg(ihid, "Using a HID descriptor override\n"); ++ ihid->hdesc = ++ *i2c_hid_get_dmi_i2c_hid_desc_override(client->name); ++ } else { ++ i2c_hid_dbg(ihid, "Fetching the HID descriptor\n"); ++ ret = i2c_hid_command(client, &hid_descr_cmd, ++ ihid->hdesc_buffer, ++ sizeof(struct i2c_hid_desc)); ++ if (ret) { ++ dev_err(&client->dev, "hid_descr_cmd failed\n"); ++ return -ENODEV; ++ } + } + + /* Validate the length of HID descriptor, the 4 first bytes: +diff --git a/drivers/hid/i2c-hid/i2c-hid-dmi-quirks.c b/drivers/hid/i2c-hid/i2c-hid-dmi-quirks.c +new file mode 100644 +index 000000000000..1d645c9ab417 +--- /dev/null ++++ b/drivers/hid/i2c-hid/i2c-hid-dmi-quirks.c +@@ -0,0 +1,385 @@ ++// SPDX-License-Identifier: GPL-2.0+ ++ ++/* ++ * Quirks for I2C-HID devices that do not supply proper descriptors ++ * ++ * Copyright (c) 2018 Julian Sax <jsbc@gmx.de> ++ * ++ */ ++ ++#include <linux/types.h> ++#include <linux/dmi.h> ++#include <linux/mod_devicetable.h> ++ ++#include "i2c-hid.h" ++ ++ ++struct i2c_hid_desc_override { ++ union { ++ struct i2c_hid_desc *i2c_hid_desc; ++ uint8_t *i2c_hid_desc_buffer; ++ }; ++ uint8_t *hid_report_desc; ++ unsigned int hid_report_desc_size; ++ uint8_t *i2c_name; ++}; ++ ++ ++/* ++ * descriptors for the SIPODEV SP1064 touchpad ++ * ++ * This device does not supply any descriptors and on windows a filter ++ * driver operates between the i2c-hid layer and the device and injects ++ * these descriptors when the device is prompted. The descriptors were ++ * extracted by listening to the i2c-hid traffic that occurs between the ++ * windows filter driver and the windows i2c-hid driver. ++ */ ++ ++static const struct i2c_hid_desc_override sipodev_desc = { ++ .i2c_hid_desc_buffer = (uint8_t []) ++ {0x1e, 0x00, /* Length of descriptor */ ++ 0x00, 0x01, /* Version of descriptor */ ++ 0xdb, 0x01, /* Length of report descriptor */ ++ 0x21, 0x00, /* Location of report descriptor */ ++ 0x24, 0x00, /* Location of input report */ ++ 0x1b, 0x00, /* Max input report length */ ++ 0x25, 0x00, /* Location of output report */ ++ 0x11, 0x00, /* Max output report length */ ++ 0x22, 0x00, /* Location of command register */ ++ 0x23, 0x00, /* Location of data register */ ++ 0x11, 0x09, /* Vendor ID */ ++ 0x88, 0x52, /* Product ID */ ++ 0x06, 0x00, /* Version ID */ ++ 0x00, 0x00, 0x00, 0x00 /* Reserved */ ++ }, ++ ++ .hid_report_desc = (uint8_t []) ++ {0x05, 0x01, /* Usage Page (Desktop), */ ++ 0x09, 0x02, /* Usage (Mouse), */ ++ 0xA1, 0x01, /* Collection (Application), */ ++ 0x85, 0x01, /* Report ID (1), */ ++ 0x09, 0x01, /* Usage (Pointer), */ ++ 0xA1, 0x00, /* Collection (Physical), */ ++ 0x05, 0x09, /* Usage Page (Button), */ ++ 0x19, 0x01, /* Usage Minimum (01h), */ ++ 0x29, 0x02, /* Usage Maximum (02h), */ ++ 0x25, 0x01, /* Logical Maximum (1), */ ++ 0x75, 0x01, /* Report Size (1), */ ++ 0x95, 0x02, /* Report Count (2), */ ++ 0x81, 0x02, /* Input (Variable), */ ++ 0x95, 0x06, /* Report Count (6), */ ++ 0x81, 0x01, /* Input (Constant), */ ++ 0x05, 0x01, /* Usage Page (Desktop), */ ++ 0x09, 0x30, /* Usage (X), */ ++ 0x09, 0x31, /* Usage (Y), */ ++ 0x15, 0x81, /* Logical Minimum (-127), */ ++ 0x25, 0x7F, /* Logical Maximum (127), */ ++ 0x75, 0x08, /* Report Size (8), */ ++ 0x95, 0x02, /* Report Count (2), */ ++ 0x81, 0x06, /* Input (Variable, Relative), */ ++ 0xC0, /* End Collection, */ ++ 0xC0, /* End Collection, */ ++ 0x05, 0x0D, /* Usage Page (Digitizer), */ ++ 0x09, 0x05, /* Usage (Touchpad), */ ++ 0xA1, 0x01, /* Collection (Application), */ ++ 0x85, 0x04, /* Report ID (4), */ ++ 0x05, 0x0D, /* Usage Page (Digitizer), */ ++ 0x09, 0x22, /* Usage (Finger), */ ++ 0xA1, 0x02, /* Collection (Logical), */ ++ 0x15, 0x00, /* Logical Minimum (0), */ ++ 0x25, 0x01, /* Logical Maximum (1), */ ++ 0x09, 0x47, /* Usage (Touch Valid), */ ++ 0x09, 0x42, /* Usage (Tip Switch), */ ++ 0x95, 0x02, /* Report Count (2), */ ++ 0x75, 0x01, /* Report Size (1), */ ++ 0x81, 0x02, /* Input (Variable), */ ++ 0x95, 0x01, /* Report Count (1), */ ++ 0x75, 0x03, /* Report Size (3), */ ++ 0x25, 0x05, /* Logical Maximum (5), */ ++ 0x09, 0x51, /* Usage (Contact Identifier), */ ++ 0x81, 0x02, /* Input (Variable), */ ++ 0x75, 0x01, /* Report Size (1), */ ++ 0x95, 0x03, /* Report Count (3), */ ++ 0x81, 0x03, /* Input (Constant, Variable), */ ++ 0x05, 0x01, /* Usage Page (Desktop), */ ++ 0x26, 0x44, 0x0A, /* Logical Maximum (2628), */ ++ 0x75, 0x10, /* Report Size (16), */ ++ 0x55, 0x0E, /* Unit Exponent (14), */ ++ 0x65, 0x11, /* Unit (Centimeter), */ ++ 0x09, 0x30, /* Usage (X), */ ++ 0x46, 0x1A, 0x04, /* Physical Maximum (1050), */ ++ 0x95, 0x01, /* Report Count (1), */ ++ 0x81, 0x02, /* Input (Variable), */ ++ 0x46, 0xBC, 0x02, /* Physical Maximum (700), */ ++ 0x26, 0x34, 0x05, /* Logical Maximum (1332), */ ++ 0x09, 0x31, /* Usage (Y), */ ++ 0x81, 0x02, /* Input (Variable), */ ++ 0xC0, /* End Collection, */ ++ 0x05, 0x0D, /* Usage Page (Digitizer), */ ++ 0x09, 0x22, /* Usage (Finger), */ ++ 0xA1, 0x02, /* Collection (Logical), */ ++ 0x25, 0x01, /* Logical Maximum (1), */ ++ 0x09, 0x47, /* Usage (Touch Valid), */ ++ 0x09, 0x42, /* Usage (Tip Switch), */ ++ 0x95, 0x02, /* Report Count (2), */ ++ 0x75, 0x01, /* Report Size (1), */ ++ 0x81, 0x02, /* Input (Variable), */ ++ 0x95, 0x01, /* Report Count (1), */ ++ 0x75, 0x03, /* Report Size (3), */ ++ 0x25, 0x05, /* Logical Maximum (5), */ ++ 0x09, 0x51, /* Usage (Contact Identifier), */ ++ 0x81, 0x02, /* Input (Variable), */ ++ 0x75, 0x01, /* Report Size (1), */ ++ 0x95, 0x03, /* Report Count (3), */ ++ 0x81, 0x03, /* Input (Constant, Variable), */ ++ 0x05, 0x01, /* Usage Page (Desktop), */ ++ 0x26, 0x44, 0x0A, /* Logical Maximum (2628), */ ++ 0x75, 0x10, /* Report Size (16), */ ++ 0x09, 0x30, /* Usage (X), */ ++ 0x46, 0x1A, 0x04, /* Physical Maximum (1050), */ ++ 0x95, 0x01, /* Report Count (1), */ ++ 0x81, 0x02, /* Input (Variable), */ ++ 0x46, 0xBC, 0x02, /* Physical Maximum (700), */ ++ 0x26, 0x34, 0x05, /* Logical Maximum (1332), */ ++ 0x09, 0x31, /* Usage (Y), */ ++ 0x81, 0x02, /* Input (Variable), */ ++ 0xC0, /* End Collection, */ ++ 0x05, 0x0D, /* Usage Page (Digitizer), */ ++ 0x09, 0x22, /* Usage (Finger), */ ++ 0xA1, 0x02, /* Collection (Logical), */ ++ 0x25, 0x01, /* Logical Maximum (1), */ ++ 0x09, 0x47, /* Usage (Touch Valid), */ ++ 0x09, 0x42, /* Usage (Tip Switch), */ ++ 0x95, 0x02, /* Report Count (2), */ ++ 0x75, 0x01, /* Report Size (1), */ ++ 0x81, 0x02, /* Input (Variable), */ ++ 0x95, 0x01, /* Report Count (1), */ ++ 0x75, 0x03, /* Report Size (3), */ ++ 0x25, 0x05, /* Logical Maximum (5), */ ++ 0x09, 0x51, /* Usage (Contact Identifier), */ ++ 0x81, 0x02, /* Input (Variable), */ ++ 0x75, 0x01, /* Report Size (1), */ ++ 0x95, 0x03, /* Report Count (3), */ ++ 0x81, 0x03, /* Input (Constant, Variable), */ ++ 0x05, 0x01, /* Usage Page (Desktop), */ ++ 0x26, 0x44, 0x0A, /* Logical Maximum (2628), */ ++ 0x75, 0x10, /* Report Size (16), */ ++ 0x09, 0x30, /* Usage (X), */ ++ 0x46, 0x1A, 0x04, /* Physical Maximum (1050), */ ++ 0x95, 0x01, /* Report Count (1), */ ++ 0x81, 0x02, /* Input (Variable), */ ++ 0x46, 0xBC, 0x02, /* Physical Maximum (700), */ ++ 0x26, 0x34, 0x05, /* Logical Maximum (1332), */ ++ 0x09, 0x31, /* Usage (Y), */ ++ 0x81, 0x02, /* Input (Variable), */ ++ 0xC0, /* End Collection, */ ++ 0x05, 0x0D, /* Usage Page (Digitizer), */ ++ 0x09, 0x22, /* Usage (Finger), */ ++ 0xA1, 0x02, /* Collection (Logical), */ ++ 0x25, 0x01, /* Logical Maximum (1), */ ++ 0x09, 0x47, /* Usage (Touch Valid), */ ++ 0x09, 0x42, /* Usage (Tip Switch), */ ++ 0x95, 0x02, /* Report Count (2), */ ++ 0x75, 0x01, /* Report Size (1), */ ++ 0x81, 0x02, /* Input (Variable), */ ++ 0x95, 0x01, /* Report Count (1), */ ++ 0x75, 0x03, /* Report Size (3), */ ++ 0x25, 0x05, /* Logical Maximum (5), */ ++ 0x09, 0x51, /* Usage (Contact Identifier), */ ++ 0x81, 0x02, /* Input (Variable), */ ++ 0x75, 0x01, /* Report Size (1), */ ++ 0x95, 0x03, /* Report Count (3), */ ++ 0x81, 0x03, /* Input (Constant, Variable), */ ++ 0x05, 0x01, /* Usage Page (Desktop), */ ++ 0x26, 0x44, 0x0A, /* Logical Maximum (2628), */ ++ 0x75, 0x10, /* Report Size (16), */ ++ 0x09, 0x30, /* Usage (X), */ ++ 0x46, 0x1A, 0x04, /* Physical Maximum (1050), */ ++ 0x95, 0x01, /* Report Count (1), */ ++ 0x81, 0x02, /* Input (Variable), */ ++ 0x46, 0xBC, 0x02, /* Physical Maximum (700), */ ++ 0x26, 0x34, 0x05, /* Logical Maximum (1332), */ ++ 0x09, 0x31, /* Usage (Y), */ ++ 0x81, 0x02, /* Input (Variable), */ ++ 0xC0, /* End Collection, */ ++ 0x05, 0x0D, /* Usage Page (Digitizer), */ ++ 0x55, 0x0C, /* Unit Exponent (12), */ ++ 0x66, 0x01, 0x10, /* Unit (Seconds), */ ++ 0x47, 0xFF, 0xFF, 0x00, 0x00,/* Physical Maximum (65535), */ ++ 0x27, 0xFF, 0xFF, 0x00, 0x00,/* Logical Maximum (65535), */ ++ 0x75, 0x10, /* Report Size (16), */ ++ 0x95, 0x01, /* Report Count (1), */ ++ 0x09, 0x56, /* Usage (Scan Time), */ ++ 0x81, 0x02, /* Input (Variable), */ ++ 0x09, 0x54, /* Usage (Contact Count), */ ++ 0x25, 0x7F, /* Logical Maximum (127), */ ++ 0x75, 0x08, /* Report Size (8), */ ++ 0x81, 0x02, /* Input (Variable), */ ++ 0x05, 0x09, /* Usage Page (Button), */ ++ 0x09, 0x01, /* Usage (01h), */ ++ 0x25, 0x01, /* Logical Maximum (1), */ ++ 0x75, 0x01, /* Report Size (1), */ ++ 0x95, 0x01, /* Report Count (1), */ ++ 0x81, 0x02, /* Input (Variable), */ ++ 0x95, 0x07, /* Report Count (7), */ ++ 0x81, 0x03, /* Input (Constant, Variable), */ ++ 0x05, 0x0D, /* Usage Page (Digitizer), */ ++ 0x85, 0x02, /* Report ID (2), */ ++ 0x09, 0x55, /* Usage (Contact Count Maximum), */ ++ 0x09, 0x59, /* Usage (59h), */ ++ 0x75, 0x04, /* Report Size (4), */ ++ 0x95, 0x02, /* Report Count (2), */ ++ 0x25, 0x0F, /* Logical Maximum (15), */ ++ 0xB1, 0x02, /* Feature (Variable), */ ++ 0x05, 0x0D, /* Usage Page (Digitizer), */ ++ 0x85, 0x07, /* Report ID (7), */ ++ 0x09, 0x60, /* Usage (60h), */ ++ 0x75, 0x01, /* Report Size (1), */ ++ 0x95, 0x01, /* Report Count (1), */ ++ 0x25, 0x01, /* Logical Maximum (1), */ ++ 0xB1, 0x02, /* Feature (Variable), */ ++ 0x95, 0x07, /* Report Count (7), */ ++ 0xB1, 0x03, /* Feature (Constant, Variable), */ ++ 0x85, 0x06, /* Report ID (6), */ ++ 0x06, 0x00, 0xFF, /* Usage Page (FF00h), */ ++ 0x09, 0xC5, /* Usage (C5h), */ ++ 0x26, 0xFF, 0x00, /* Logical Maximum (255), */ ++ 0x75, 0x08, /* Report Size (8), */ ++ 0x96, 0x00, 0x01, /* Report Count (256), */ ++ 0xB1, 0x02, /* Feature (Variable), */ ++ 0xC0, /* End Collection, */ ++ 0x06, 0x00, 0xFF, /* Usage Page (FF00h), */ ++ 0x09, 0x01, /* Usage (01h), */ ++ 0xA1, 0x01, /* Collection (Application), */ ++ 0x85, 0x0D, /* Report ID (13), */ ++ 0x26, 0xFF, 0x00, /* Logical Maximum (255), */ ++ 0x19, 0x01, /* Usage Minimum (01h), */ ++ 0x29, 0x02, /* Usage Maximum (02h), */ ++ 0x75, 0x08, /* Report Size (8), */ ++ 0x95, 0x02, /* Report Count (2), */ ++ 0xB1, 0x02, /* Feature (Variable), */ ++ 0xC0, /* End Collection, */ ++ 0x05, 0x0D, /* Usage Page (Digitizer), */ ++ 0x09, 0x0E, /* Usage (Configuration), */ ++ 0xA1, 0x01, /* Collection (Application), */ ++ 0x85, 0x03, /* Report ID (3), */ ++ 0x09, 0x22, /* Usage (Finger), */ ++ 0xA1, 0x02, /* Collection (Logical), */ ++ 0x09, 0x52, /* Usage (Device Mode), */ ++ 0x25, 0x0A, /* Logical Maximum (10), */ ++ 0x95, 0x01, /* Report Count (1), */ ++ 0xB1, 0x02, /* Feature (Variable), */ ++ 0xC0, /* End Collection, */ ++ 0x09, 0x22, /* Usage (Finger), */ ++ 0xA1, 0x00, /* Collection (Physical), */ ++ 0x85, 0x05, /* Report ID (5), */ ++ 0x09, 0x57, /* Usage (57h), */ ++ 0x09, 0x58, /* Usage (58h), */ ++ 0x75, 0x01, /* Report Size (1), */ ++ 0x95, 0x02, /* Report Count (2), */ ++ 0x25, 0x01, /* Logical Maximum (1), */ ++ 0xB1, 0x02, /* Feature (Variable), */ ++ 0x95, 0x06, /* Report Count (6), */ ++ 0xB1, 0x03, /* Feature (Constant, Variable),*/ ++ 0xC0, /* End Collection, */ ++ 0xC0 /* End Collection */ ++ }, ++ .hid_report_desc_size = 475, ++ .i2c_name = "SYNA3602:00" ++}; ++ ++ ++static const struct dmi_system_id i2c_hid_dmi_desc_override_table[] = { ++ { ++ .ident = "Teclast F6 Pro", ++ .matches = { ++ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "TECLAST"), ++ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "F6 Pro"), ++ }, ++ .driver_data = (void *)&sipodev_desc ++ }, ++ { ++ .ident = "Teclast F7", ++ .matches = { ++ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "TECLAST"), ++ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "F7"), ++ }, ++ .driver_data = (void *)&sipodev_desc ++ }, ++ { ++ .ident = "Trekstor Primebook C13", ++ .matches = { ++ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "TREKSTOR"), ++ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Primebook C13"), ++ }, ++ .driver_data = (void *)&sipodev_desc ++ }, ++ { ++ .ident = "Trekstor Primebook C11", ++ .matches = { ++ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "TREKSTOR"), ++ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "Primebook C11"), ++ }, ++ .driver_data = (void *)&sipodev_desc ++ }, ++ { ++ .ident = "Direkt-Tek DTLAPY116-2", ++ .matches = { ++ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Direkt-Tek"), ++ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "DTLAPY116-2"), ++ }, ++ .driver_data = (void *)&sipodev_desc ++ }, ++ { ++ .ident = "Direkt-Tek DTLAPY133-1", ++ .matches = { ++ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Direkt-Tek"), ++ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "DTLAPY133-1"), ++ }, ++ .driver_data = (void *)&sipodev_desc ++ }, ++ { ++ .ident = "Mediacom Flexbook Edge 11", ++ .matches = { ++ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "MEDIACOM"), ++ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "FlexBook edge11 - M-FBE11"), ++ }, ++ .driver_data = (void *)&sipodev_desc ++ }, ++ { } /* Terminate list */ ++}; ++ ++ ++struct i2c_hid_desc *i2c_hid_get_dmi_i2c_hid_desc_override(uint8_t *i2c_name) ++{ ++ struct i2c_hid_desc_override *override; ++ const struct dmi_system_id *system_id; ++ ++ system_id = dmi_first_match(i2c_hid_dmi_desc_override_table); ++ if (!system_id) ++ return NULL; ++ ++ override = system_id->driver_data; ++ if (strcmp(override->i2c_name, i2c_name)) ++ return NULL; ++ ++ return override->i2c_hid_desc; ++} ++ ++char *i2c_hid_get_dmi_hid_report_desc_override(uint8_t *i2c_name, ++ unsigned int *size) ++{ ++ struct i2c_hid_desc_override *override; ++ const struct dmi_system_id *system_id; ++ ++ system_id = dmi_first_match(i2c_hid_dmi_desc_override_table); ++ if (!system_id) ++ return NULL; ++ ++ override = system_id->driver_data; ++ if (strcmp(override->i2c_name, i2c_name)) ++ return NULL; ++ ++ *size = override->hid_report_desc_size; ++ return override->hid_report_desc; ++} +diff --git a/drivers/hid/i2c-hid/i2c-hid.h b/drivers/hid/i2c-hid/i2c-hid.h +new file mode 100644 +index 000000000000..a8c19aef5824 +--- /dev/null ++++ b/drivers/hid/i2c-hid/i2c-hid.h +@@ -0,0 +1,20 @@ ++/* SPDX-License-Identifier: GPL-2.0+ */ ++ ++#ifndef I2C_HID_H ++#define I2C_HID_H ++ ++ ++#ifdef CONFIG_DMI ++struct i2c_hid_desc *i2c_hid_get_dmi_i2c_hid_desc_override(uint8_t *i2c_name); ++char *i2c_hid_get_dmi_hid_report_desc_override(uint8_t *i2c_name, ++ unsigned int *size); ++#else ++static inline struct i2c_hid_desc ++ *i2c_hid_get_dmi_i2c_hid_desc_override(uint8_t *i2c_name) ++{ return NULL; } ++static inline char *i2c_hid_get_dmi_hid_report_desc_override(uint8_t *i2c_name, ++ unsigned int *size) ++{ return NULL; } ++#endif ++ ++#endif +-- +2.19.1 + diff --git a/brcmfmac-Remove-firmware-loading-code-duplication.patch b/brcmfmac-Remove-firmware-loading-code-duplication.patch index 724ad1699..eb7903eee 100644 --- a/brcmfmac-Remove-firmware-loading-code-duplication.patch +++ b/brcmfmac-Remove-firmware-loading-code-duplication.patch @@ -1,71 +1,7 @@ -From patchwork Wed Oct 10 11:00:58 2018 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Hans de Goede <hdegoede@redhat.com> -X-Patchwork-Id: 10634355 -X-Patchwork-Delegate: kvalo@adurom.com -Return-Path: <linux-wireless-owner@kernel.org> -Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org - [172.30.200.125]) - by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 176D8679F - for <patchwork-linux-wireless@patchwork.kernel.org>; - Wed, 10 Oct 2018 11:01:11 +0000 (UTC) -Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) - by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 130EB29A62 - for <patchwork-linux-wireless@patchwork.kernel.org>; - Wed, 10 Oct 2018 11:01:10 +0000 (UTC) -Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) - id 05F4129AD0; Wed, 10 Oct 2018 11:01:10 +0000 (UTC) -X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on - pdx-wl-mail.web.codeaurora.org -X-Spam-Level: -X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, - RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 -Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) - by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6244B29A5D - for <patchwork-linux-wireless@patchwork.kernel.org>; - Wed, 10 Oct 2018 11:01:09 +0000 (UTC) -Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand - id S1726568AbeJJSWo (ORCPT - <rfc822;patchwork-linux-wireless@patchwork.kernel.org>); - Wed, 10 Oct 2018 14:22:44 -0400 -Received: from mx1.redhat.com ([209.132.183.28]:41994 "EHLO mx1.redhat.com" - rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP - id S1726022AbeJJSWo (ORCPT <rfc822;linux-wireless@vger.kernel.org>); - Wed, 10 Oct 2018 14:22:44 -0400 -Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com - [10.5.11.23]) - (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) - (No client certificate requested) - by mx1.redhat.com (Postfix) with ESMTPS id 66FEBA4D29; - Wed, 10 Oct 2018 11:01:07 +0000 (UTC) -Received: from shalem.localdomain.com (ovpn-116-109.ams2.redhat.com - [10.36.116.109]) - by smtp.corp.redhat.com (Postfix) with ESMTP id 8A0D658772; - Wed, 10 Oct 2018 11:01:05 +0000 (UTC) +From 76202e874f06ab641fbe1caaddd4cfcf7158f174 Mon Sep 17 00:00:00 2001 From: Hans de Goede <hdegoede@redhat.com> -To: Arend van Spriel <arend.vanspriel@broadcom.com>, - Franky Lin <franky.lin@broadcom.com>, - Hante Meuleman <hante.meuleman@broadcom.com>, - Kalle Valo <kvalo@codeaurora.org>, - Chi-Hsien Lin <chi-hsien.lin@cypress.com>, - Wright Feng <wright.feng@cypress.com> -Cc: Hans de Goede <hdegoede@redhat.com>, - linux-wireless@vger.kernel.org, brcm80211-dev-list.pdl@broadcom.com -Subject: [PATCH v2 1/6] brcmfmac: Remove firmware-loading code duplication Date: Wed, 10 Oct 2018 13:00:58 +0200 -Message-Id: <20181010110103.21857-1-hdegoede@redhat.com> -MIME-Version: 1.0 -X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 -X-Greylist: Sender IP whitelisted, - not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); - Wed, 10 Oct 2018 11:01:07 +0000 (UTC) -Sender: linux-wireless-owner@vger.kernel.org -Precedence: bulk -List-ID: <linux-wireless.vger.kernel.org> -X-Mailing-List: linux-wireless@vger.kernel.org -X-Virus-Scanned: ClamAV using ClamSMTP +Subject: [PATCH 1/5] brcmfmac: Remove firmware-loading code duplication brcmf_fw_request_next_item and brcmf_fw_request_done both have identical code to complete the fw-request depending on the item-type. @@ -165,78 +101,14 @@ index 9095b830ae4d..784c84f0e9e7 100644 goto fail; do { +-- +2.19.1 -From patchwork Wed Oct 10 11:00:59 2018 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Hans de Goede <hdegoede@redhat.com> -X-Patchwork-Id: 10634357 -X-Patchwork-Delegate: kvalo@adurom.com -Return-Path: <linux-wireless-owner@kernel.org> -Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org - [172.30.200.125]) - by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id AA07F933 - for <patchwork-linux-wireless@patchwork.kernel.org>; - Wed, 10 Oct 2018 11:01:14 +0000 (UTC) -Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) - by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9109229A3C - for <patchwork-linux-wireless@patchwork.kernel.org>; - Wed, 10 Oct 2018 11:01:14 +0000 (UTC) -Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) - id 851B229A62; Wed, 10 Oct 2018 11:01:14 +0000 (UTC) -X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on - pdx-wl-mail.web.codeaurora.org -X-Spam-Level: -X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, - RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 -Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) - by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1D41829A3C - for <patchwork-linux-wireless@patchwork.kernel.org>; - Wed, 10 Oct 2018 11:01:14 +0000 (UTC) -Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand - id S1726617AbeJJSWt (ORCPT - <rfc822;patchwork-linux-wireless@patchwork.kernel.org>); - Wed, 10 Oct 2018 14:22:49 -0400 -Received: from mx1.redhat.com ([209.132.183.28]:46618 "EHLO mx1.redhat.com" - rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP - id S1726022AbeJJSWt (ORCPT <rfc822;linux-wireless@vger.kernel.org>); - Wed, 10 Oct 2018 14:22:49 -0400 -Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com - [10.5.11.23]) - (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) - (No client certificate requested) - by mx1.redhat.com (Postfix) with ESMTPS id B5295307D912; - Wed, 10 Oct 2018 11:01:12 +0000 (UTC) -Received: from shalem.localdomain.com (ovpn-116-109.ams2.redhat.com - [10.36.116.109]) - by smtp.corp.redhat.com (Postfix) with ESMTP id A3EDA44FBF; - Wed, 10 Oct 2018 11:01:07 +0000 (UTC) +From a3c4b522bff976360fb21c9205fcb37a121d4074 Mon Sep 17 00:00:00 2001 From: Hans de Goede <hdegoede@redhat.com> -To: Arend van Spriel <arend.vanspriel@broadcom.com>, - Franky Lin <franky.lin@broadcom.com>, - Hante Meuleman <hante.meuleman@broadcom.com>, - Kalle Valo <kvalo@codeaurora.org>, - Chi-Hsien Lin <chi-hsien.lin@cypress.com>, - Wright Feng <wright.feng@cypress.com> -Cc: Hans de Goede <hdegoede@redhat.com>, - linux-wireless@vger.kernel.org, brcm80211-dev-list.pdl@broadcom.com -Subject: [PATCH v2 2/6] brcmfmac: Remove recursion from firmware load error - handling Date: Wed, 10 Oct 2018 13:00:59 +0200 -Message-Id: <20181010110103.21857-2-hdegoede@redhat.com> -In-Reply-To: <20181010110103.21857-1-hdegoede@redhat.com> -References: <20181010110103.21857-1-hdegoede@redhat.com> -MIME-Version: 1.0 -X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 -X-Greylist: Sender IP whitelisted, - not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.48]); - Wed, 10 Oct 2018 11:01:13 +0000 (UTC) -Sender: linux-wireless-owner@vger.kernel.org -Precedence: bulk -List-ID: <linux-wireless.vger.kernel.org> -X-Mailing-List: linux-wireless@vger.kernel.org -X-Virus-Scanned: ClamAV using ClamSMTP +Subject: [PATCH 2/5] brcmfmac: Remove recursion from firmware load error + handling Before this commit brcmf_fw_request_done would call brcmf_fw_request_next_item to load the next item, which on an error would @@ -360,78 +232,14 @@ index 784c84f0e9e7..08aaf99fee34 100644 return 0; } +-- +2.19.1 -From patchwork Wed Oct 10 11:01:00 2018 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Hans de Goede <hdegoede@redhat.com> -X-Patchwork-Id: 10634359 -X-Patchwork-Delegate: kvalo@adurom.com -Return-Path: <linux-wireless-owner@kernel.org> -Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org - [172.30.200.125]) - by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 25C2D69B4 - for <patchwork-linux-wireless@patchwork.kernel.org>; - Wed, 10 Oct 2018 11:01:17 +0000 (UTC) -Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) - by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1A0EE29A3C - for <patchwork-linux-wireless@patchwork.kernel.org>; - Wed, 10 Oct 2018 11:01:17 +0000 (UTC) -Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) - id 0E72C29A62; Wed, 10 Oct 2018 11:01:17 +0000 (UTC) -X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on - pdx-wl-mail.web.codeaurora.org -X-Spam-Level: -X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, - RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 -Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) - by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A6B3D29A3C - for <patchwork-linux-wireless@patchwork.kernel.org>; - Wed, 10 Oct 2018 11:01:16 +0000 (UTC) -Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand - id S1726647AbeJJSWw (ORCPT - <rfc822;patchwork-linux-wireless@patchwork.kernel.org>); - Wed, 10 Oct 2018 14:22:52 -0400 -Received: from mx1.redhat.com ([209.132.183.28]:35014 "EHLO mx1.redhat.com" - rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP - id S1726479AbeJJSWw (ORCPT <rfc822;linux-wireless@vger.kernel.org>); - Wed, 10 Oct 2018 14:22:52 -0400 -Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com - [10.5.11.23]) - (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) - (No client certificate requested) - by mx1.redhat.com (Postfix) with ESMTPS id C2E0030820D3; - Wed, 10 Oct 2018 11:01:14 +0000 (UTC) -Received: from shalem.localdomain.com (ovpn-116-109.ams2.redhat.com - [10.36.116.109]) - by smtp.corp.redhat.com (Postfix) with ESMTP id 0495169608; - Wed, 10 Oct 2018 11:01:12 +0000 (UTC) +From c2c41d3f837ed492369607940af950ef554b8685 Mon Sep 17 00:00:00 2001 From: Hans de Goede <hdegoede@redhat.com> -To: Arend van Spriel <arend.vanspriel@broadcom.com>, - Franky Lin <franky.lin@broadcom.com>, - Hante Meuleman <hante.meuleman@broadcom.com>, - Kalle Valo <kvalo@codeaurora.org>, - Chi-Hsien Lin <chi-hsien.lin@cypress.com>, - Wright Feng <wright.feng@cypress.com> -Cc: Hans de Goede <hdegoede@redhat.com>, - linux-wireless@vger.kernel.org, brcm80211-dev-list.pdl@broadcom.com -Subject: [PATCH v2 3/6] brcmfmac: Add support for first trying to get a board - specific nvram file Date: Wed, 10 Oct 2018 13:01:00 +0200 -Message-Id: <20181010110103.21857-3-hdegoede@redhat.com> -In-Reply-To: <20181010110103.21857-1-hdegoede@redhat.com> -References: <20181010110103.21857-1-hdegoede@redhat.com> -MIME-Version: 1.0 -X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 -X-Greylist: Sender IP whitelisted, - not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); - Wed, 10 Oct 2018 11:01:15 +0000 (UTC) -Sender: linux-wireless-owner@vger.kernel.org -Precedence: bulk -List-ID: <linux-wireless.vger.kernel.org> -X-Mailing-List: linux-wireless@vger.kernel.org -X-Virus-Scanned: ClamAV using ClamSMTP +Subject: [PATCH 3/5] brcmfmac: Add support for first trying to get a board + specific nvram file The nvram files which some brcmfmac chips need are board-specific. To be able to distribute these as part of linux-firmware, so that devices with @@ -507,78 +315,14 @@ index 2893e56910f0..a0834be8864e 100644 struct brcmf_fw_item items[0]; }; +-- +2.19.1 -From patchwork Wed Oct 10 11:01:01 2018 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Hans de Goede <hdegoede@redhat.com> -X-Patchwork-Id: 10634361 -X-Patchwork-Delegate: kvalo@adurom.com -Return-Path: <linux-wireless-owner@kernel.org> -Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org - [172.30.200.125]) - by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id EE2A514DB - for <patchwork-linux-wireless@patchwork.kernel.org>; - Wed, 10 Oct 2018 11:01:18 +0000 (UTC) -Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) - by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E298329A3C - for <patchwork-linux-wireless@patchwork.kernel.org>; - Wed, 10 Oct 2018 11:01:18 +0000 (UTC) -Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) - id D5CD929A62; Wed, 10 Oct 2018 11:01:18 +0000 (UTC) -X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on - pdx-wl-mail.web.codeaurora.org -X-Spam-Level: -X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, - RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 -Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) - by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6E6F329A3C - for <patchwork-linux-wireless@patchwork.kernel.org>; - Wed, 10 Oct 2018 11:01:18 +0000 (UTC) -Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand - id S1726689AbeJJSWy (ORCPT - <rfc822;patchwork-linux-wireless@patchwork.kernel.org>); - Wed, 10 Oct 2018 14:22:54 -0400 -Received: from mx1.redhat.com ([209.132.183.28]:32633 "EHLO mx1.redhat.com" - rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP - id S1726479AbeJJSWy (ORCPT <rfc822;linux-wireless@vger.kernel.org>); - Wed, 10 Oct 2018 14:22:54 -0400 -Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com - [10.5.11.23]) - (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) - (No client certificate requested) - by mx1.redhat.com (Postfix) with ESMTPS id D2E7630DF6F1; - Wed, 10 Oct 2018 11:01:16 +0000 (UTC) -Received: from shalem.localdomain.com (ovpn-116-109.ams2.redhat.com - [10.36.116.109]) - by smtp.corp.redhat.com (Postfix) with ESMTP id 0DBC544FBF; - Wed, 10 Oct 2018 11:01:14 +0000 (UTC) -From: Hans de Goede <hdegoede@redhat.com> -To: Arend van Spriel <arend.vanspriel@broadcom.com>, - Franky Lin <franky.lin@broadcom.com>, - Hante Meuleman <hante.meuleman@broadcom.com>, - Kalle Valo <kvalo@codeaurora.org>, - Chi-Hsien Lin <chi-hsien.lin@cypress.com>, - Wright Feng <wright.feng@cypress.com> -Cc: Hans de Goede <hdegoede@redhat.com>, - linux-wireless@vger.kernel.org, brcm80211-dev-list.pdl@broadcom.com -Subject: [PATCH v2 4/6] brcmfmac: Set board_type used for nvram file selection - to machine-compatible -Date: Wed, 10 Oct 2018 13:01:01 +0200 -Message-Id: <20181010110103.21857-4-hdegoede@redhat.com> -In-Reply-To: <20181010110103.21857-1-hdegoede@redhat.com> -References: <20181010110103.21857-1-hdegoede@redhat.com> -MIME-Version: 1.0 -X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 -X-Greylist: Sender IP whitelisted, - not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.49]); - Wed, 10 Oct 2018 11:01:17 +0000 (UTC) -Sender: linux-wireless-owner@vger.kernel.org -Precedence: bulk -List-ID: <linux-wireless.vger.kernel.org> -X-Mailing-List: linux-wireless@vger.kernel.org -X-Virus-Scanned: ClamAV using ClamSMTP +From 282477a8e4034ee2ea906d2eb234ce9c86f5685f Mon Sep 17 00:00:00 2001 +From: Peter Robinson <pbrobinson@gmail.com> +Date: Sat, 17 Nov 2018 15:18:35 +0000 +Subject: [PATCH 4/5] brcmfmac: Set board_type used for nvram file selection to + machine-compatible For of/devicetree using machines, set the board_type used for nvram file selection to the first string listed in the top-level's node compatible @@ -589,169 +333,16 @@ a board-specific name so that we can ship files for each supported board in linux-firmware. Signed-off-by: Hans de Goede <hdegoede@redhat.com> ---- - .../net/wireless/broadcom/brcm80211/brcmfmac/common.h | 1 + - drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c | 11 ++++++++++- - .../net/wireless/broadcom/brcm80211/brcmfmac/pcie.c | 1 + - .../net/wireless/broadcom/brcm80211/brcmfmac/sdio.c | 1 + - 4 files changed, 13 insertions(+), 1 deletion(-) - -diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h -index a34642cb4d2f..e63a273642e9 100644 ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h -@@ -59,6 +59,7 @@ struct brcmf_mp_device { - bool iapp; - bool ignore_probe_fail; - struct brcmfmac_pd_cc *country_codes; -+ const char *board_type; - union { - struct brcmfmac_sdio_pd sdio; - } bus; -diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c -index aee6e5937c41..84e3373289eb 100644 ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c -@@ -27,11 +27,20 @@ void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type, - struct brcmf_mp_device *settings) - { - struct brcmfmac_sdio_pd *sdio = &settings->bus.sdio; -- struct device_node *np = dev->of_node; -+ struct device_node *root, *np = dev->of_node; -+ struct property *prop; - int irq; - u32 irqf; - u32 val; - -+ /* Set board-type to the first string of the machine compatible prop */ -+ root = of_find_node_by_path("/"); -+ if (root) { -+ prop = of_find_property(root, "compatible", NULL); -+ settings->board_type = of_prop_next_string(prop, NULL); -+ of_node_put(root); -+ } -+ - if (!np || bus_type != BRCMF_BUSTYPE_SDIO || - !of_device_is_compatible(np, "brcm,bcm4329-fmac")) - return; -diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c -index 4fffa6988087..b12f3e0ee69c 100644 ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c -@@ -1785,6 +1785,7 @@ brcmf_pcie_prepare_fw_request(struct brcmf_pciedev_info *devinfo) - fwreq->items[BRCMF_PCIE_FW_CODE].type = BRCMF_FW_TYPE_BINARY; - fwreq->items[BRCMF_PCIE_FW_NVRAM].type = BRCMF_FW_TYPE_NVRAM; - fwreq->items[BRCMF_PCIE_FW_NVRAM].flags = BRCMF_FW_REQF_OPTIONAL; -+ fwreq->board_type = devinfo->settings->board_type; - /* NVRAM reserves PCI domain 0 for Broadcom's SDK faked bus */ - fwreq->domain_nr = pci_domain_nr(devinfo->pdev->bus) + 1; - fwreq->bus_nr = devinfo->pdev->bus->number; -diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -index a907d7b065fa..3dbbbb117563 100644 ---- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -+++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c -@@ -4177,6 +4177,7 @@ brcmf_sdio_prepare_fw_request(struct brcmf_sdio *bus) - - fwreq->items[BRCMF_SDIO_FW_CODE].type = BRCMF_FW_TYPE_BINARY; - fwreq->items[BRCMF_SDIO_FW_NVRAM].type = BRCMF_FW_TYPE_NVRAM; -+ fwreq->board_type = bus->sdiodev->settings->board_type; - - return fwreq; - } - -From patchwork Wed Oct 10 11:01:02 2018 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Hans de Goede <hdegoede@redhat.com> -X-Patchwork-Id: 10634363 -X-Patchwork-Delegate: kvalo@adurom.com -Return-Path: <linux-wireless-owner@kernel.org> -Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org - [172.30.200.125]) - by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1CCB3679F - for <patchwork-linux-wireless@patchwork.kernel.org>; - Wed, 10 Oct 2018 11:01:21 +0000 (UTC) -Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) - by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0CFFD29A3C - for <patchwork-linux-wireless@patchwork.kernel.org>; - Wed, 10 Oct 2018 11:01:21 +0000 (UTC) -Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) - id 0058529A62; Wed, 10 Oct 2018 11:01:20 +0000 (UTC) -X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on - pdx-wl-mail.web.codeaurora.org -X-Spam-Level: -X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, - RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 -Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) - by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5CC2D29A3C - for <patchwork-linux-wireless@patchwork.kernel.org>; - Wed, 10 Oct 2018 11:01:20 +0000 (UTC) -Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand - id S1726712AbeJJSW4 (ORCPT - <rfc822;patchwork-linux-wireless@patchwork.kernel.org>); - Wed, 10 Oct 2018 14:22:56 -0400 -Received: from mx1.redhat.com ([209.132.183.28]:25991 "EHLO mx1.redhat.com" - rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP - id S1726479AbeJJSW4 (ORCPT <rfc822;linux-wireless@vger.kernel.org>); - Wed, 10 Oct 2018 14:22:56 -0400 -Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com - [10.5.11.23]) - (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) - (No client certificate requested) - by mx1.redhat.com (Postfix) with ESMTPS id DCA9130821FF; - Wed, 10 Oct 2018 11:01:18 +0000 (UTC) -Received: from shalem.localdomain.com (ovpn-116-109.ams2.redhat.com - [10.36.116.109]) - by smtp.corp.redhat.com (Postfix) with ESMTP id 1EAEF2E03B; - Wed, 10 Oct 2018 11:01:16 +0000 (UTC) -From: Hans de Goede <hdegoede@redhat.com> -To: Arend van Spriel <arend.vanspriel@broadcom.com>, - Franky Lin <franky.lin@broadcom.com>, - Hante Meuleman <hante.meuleman@broadcom.com>, - Kalle Valo <kvalo@codeaurora.org>, - Chi-Hsien Lin <chi-hsien.lin@cypress.com>, - Wright Feng <wright.feng@cypress.com> -Cc: Hans de Goede <hdegoede@redhat.com>, - linux-wireless@vger.kernel.org, brcm80211-dev-list.pdl@broadcom.com -Subject: [PATCH v2 5/6] brcmfmac: Set board_type from DMI on x86 based - machines -Date: Wed, 10 Oct 2018 13:01:02 +0200 -Message-Id: <20181010110103.21857-5-hdegoede@redhat.com> -In-Reply-To: <20181010110103.21857-1-hdegoede@redhat.com> -References: <20181010110103.21857-1-hdegoede@redhat.com> -MIME-Version: 1.0 -X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 -X-Greylist: Sender IP whitelisted, - not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.47]); - Wed, 10 Oct 2018 11:01:19 +0000 (UTC) -Sender: linux-wireless-owner@vger.kernel.org -Precedence: bulk -List-ID: <linux-wireless.vger.kernel.org> -X-Mailing-List: linux-wireless@vger.kernel.org -X-Virus-Scanned: ClamAV using ClamSMTP - -For x86 based machines, set the board_type used for nvram file selection -based on the DMI sys-vendor and product-name strings. - -Since on some models these strings are too generic, this commit also adds -a quirk table overriding the strings for models listed in that table. - -The board_type setting is used to load the board-specific nvram file with -a board-specific name so that we can ship files for each supported board -in linux-firmware. - -Signed-off-by: Hans de Goede <hdegoede@redhat.com> ---- -Changes in v2: --Use full ISC text for now instead of SPDX tag, because the ISC is not - yet listed under LICENSES +Signed-off-by: Peter Robinson <pbrobinson@gmail.com> --- .../broadcom/brcm80211/brcmfmac/Makefile | 2 + .../broadcom/brcm80211/brcmfmac/common.c | 3 +- - .../broadcom/brcm80211/brcmfmac/common.h | 7 ++ + .../broadcom/brcm80211/brcmfmac/common.h | 8 ++ .../broadcom/brcm80211/brcmfmac/dmi.c | 116 ++++++++++++++++++ - 4 files changed, 127 insertions(+), 1 deletion(-) + .../wireless/broadcom/brcm80211/brcmfmac/of.c | 11 +- + .../broadcom/brcm80211/brcmfmac/pcie.c | 1 + + .../broadcom/brcm80211/brcmfmac/sdio.c | 1 + + 7 files changed, 140 insertions(+), 2 deletions(-) create mode 100644 drivers/net/wireless/broadcom/brcm80211/brcmfmac/dmi.c diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/Makefile b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/Makefile @@ -765,25 +356,32 @@ index 1f5a9b948abf..22fd95a736a8 100644 +brcmfmac-$(CONFIG_DMI) += \ + dmi.o diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c -index cd3651069d0c..a4bcbd1a57ac 100644 +index cd3651069d0c..b93b1e797333 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.c -@@ -450,8 +450,9 @@ struct brcmf_mp_device *brcmf_get_module_param(struct device *dev, +@@ -450,7 +450,8 @@ struct brcmf_mp_device *brcmf_get_module_param(struct device *dev, } } if (!found) { - /* No platform data for this device, try OF (Open Firwmare) */ + /* No platform data for this device, try OF and DMI data */ - brcmf_of_probe(dev, bus_type, settings); + brcmf_dmi_probe(settings, chip, chiprev); + brcmf_of_probe(dev, bus_type, settings); } return settings; - } diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h -index e63a273642e9..4ce56be90b74 100644 +index a34642cb4d2f..4ce56be90b74 100644 --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/common.h -@@ -75,4 +75,11 @@ void brcmf_release_module_param(struct brcmf_mp_device *module_param); +@@ -59,6 +59,7 @@ struct brcmf_mp_device { + bool iapp; + bool ignore_probe_fail; + struct brcmfmac_pd_cc *country_codes; ++ const char *board_type; + union { + struct brcmfmac_sdio_pd sdio; + } bus; +@@ -74,4 +75,11 @@ void brcmf_release_module_param(struct brcmf_mp_device *module_param); /* Sets dongle media info (drv_version, mac address). */ int brcmf_c_preinit_dcmds(struct brcmf_if *ifp); @@ -917,77 +515,63 @@ index 000000000000..51d76ac45075 + settings->board_type = dmi_board_type; + } +} +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c +index aee6e5937c41..84e3373289eb 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/of.c +@@ -27,11 +27,20 @@ void brcmf_of_probe(struct device *dev, enum brcmf_bus_type bus_type, + struct brcmf_mp_device *settings) + { + struct brcmfmac_sdio_pd *sdio = &settings->bus.sdio; +- struct device_node *np = dev->of_node; ++ struct device_node *root, *np = dev->of_node; ++ struct property *prop; + int irq; + u32 irqf; + u32 val; + ++ /* Set board-type to the first string of the machine compatible prop */ ++ root = of_find_node_by_path("/"); ++ if (root) { ++ prop = of_find_property(root, "compatible", NULL); ++ settings->board_type = of_prop_next_string(prop, NULL); ++ of_node_put(root); ++ } ++ + if (!np || bus_type != BRCMF_BUSTYPE_SDIO || + !of_device_is_compatible(np, "brcm,bcm4329-fmac")) + return; +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +index 4fffa6988087..b12f3e0ee69c 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/pcie.c +@@ -1785,6 +1785,7 @@ brcmf_pcie_prepare_fw_request(struct brcmf_pciedev_info *devinfo) + fwreq->items[BRCMF_PCIE_FW_CODE].type = BRCMF_FW_TYPE_BINARY; + fwreq->items[BRCMF_PCIE_FW_NVRAM].type = BRCMF_FW_TYPE_NVRAM; + fwreq->items[BRCMF_PCIE_FW_NVRAM].flags = BRCMF_FW_REQF_OPTIONAL; ++ fwreq->board_type = devinfo->settings->board_type; + /* NVRAM reserves PCI domain 0 for Broadcom's SDK faked bus */ + fwreq->domain_nr = pci_domain_nr(devinfo->pdev->bus) + 1; + fwreq->bus_nr = devinfo->pdev->bus->number; +diff --git a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +index a907d7b065fa..3dbbbb117563 100644 +--- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c ++++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c +@@ -4177,6 +4177,7 @@ brcmf_sdio_prepare_fw_request(struct brcmf_sdio *bus) + + fwreq->items[BRCMF_SDIO_FW_CODE].type = BRCMF_FW_TYPE_BINARY; + fwreq->items[BRCMF_SDIO_FW_NVRAM].type = BRCMF_FW_TYPE_NVRAM; ++ fwreq->board_type = bus->sdiodev->settings->board_type; + + return fwreq; + } +-- +2.19.1 -From patchwork Wed Oct 10 11:01:03 2018 -Content-Type: text/plain; charset="utf-8" -MIME-Version: 1.0 -Content-Transfer-Encoding: 7bit -X-Patchwork-Submitter: Hans de Goede <hdegoede@redhat.com> -X-Patchwork-Id: 10634365 -X-Patchwork-Delegate: kvalo@adurom.com -Return-Path: <linux-wireless-owner@kernel.org> -Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org - [172.30.200.125]) - by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9513614DB - for <patchwork-linux-wireless@patchwork.kernel.org>; - Wed, 10 Oct 2018 11:01:22 +0000 (UTC) -Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) - by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 873E929A3C - for <patchwork-linux-wireless@patchwork.kernel.org>; - Wed, 10 Oct 2018 11:01:22 +0000 (UTC) -Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) - id 7B56829A62; Wed, 10 Oct 2018 11:01:22 +0000 (UTC) -X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on - pdx-wl-mail.web.codeaurora.org -X-Spam-Level: -X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, - RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 -Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) - by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 312D329A3C - for <patchwork-linux-wireless@patchwork.kernel.org>; - Wed, 10 Oct 2018 11:01:22 +0000 (UTC) -Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand - id S1726721AbeJJSW6 (ORCPT - <rfc822;patchwork-linux-wireless@patchwork.kernel.org>); - Wed, 10 Oct 2018 14:22:58 -0400 -Received: from mx1.redhat.com ([209.132.183.28]:50166 "EHLO mx1.redhat.com" - rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP - id S1726479AbeJJSW6 (ORCPT <rfc822;linux-wireless@vger.kernel.org>); - Wed, 10 Oct 2018 14:22:58 -0400 -Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.phx2.redhat.com - [10.5.11.23]) - (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) - (No client certificate requested) - by mx1.redhat.com (Postfix) with ESMTPS id E53875F793; - Wed, 10 Oct 2018 11:01:20 +0000 (UTC) -Received: from shalem.localdomain.com (ovpn-116-109.ams2.redhat.com - [10.36.116.109]) - by smtp.corp.redhat.com (Postfix) with ESMTP id 274442E199; - Wed, 10 Oct 2018 11:01:19 +0000 (UTC) +From 6351ca678eb1391129cf5afccab518f376d57596 Mon Sep 17 00:00:00 2001 From: Hans de Goede <hdegoede@redhat.com> -To: Arend van Spriel <arend.vanspriel@broadcom.com>, - Franky Lin <franky.lin@broadcom.com>, - Hante Meuleman <hante.meuleman@broadcom.com>, - Kalle Valo <kvalo@codeaurora.org>, - Chi-Hsien Lin <chi-hsien.lin@cypress.com>, - Wright Feng <wright.feng@cypress.com> -Cc: Hans de Goede <hdegoede@redhat.com>, - linux-wireless@vger.kernel.org, brcm80211-dev-list.pdl@broadcom.com -Subject: [PATCH v2 6/6] brcmfmac: Cleanup brcmf_fw_request_done() Date: Wed, 10 Oct 2018 13:01:03 +0200 -Message-Id: <20181010110103.21857-6-hdegoede@redhat.com> -In-Reply-To: <20181010110103.21857-1-hdegoede@redhat.com> -References: <20181010110103.21857-1-hdegoede@redhat.com> -MIME-Version: 1.0 -X-Scanned-By: MIMEDefang 2.84 on 10.5.11.23 -X-Greylist: Sender IP whitelisted, - not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); - Wed, 10 Oct 2018 11:01:21 +0000 (UTC) -Sender: linux-wireless-owner@vger.kernel.org -Precedence: bulk -List-ID: <linux-wireless.vger.kernel.org> -X-Mailing-List: linux-wireless@vger.kernel.org -X-Virus-Scanned: ClamAV using ClamSMTP +Subject: [PATCH 5/5] brcmfmac: Cleanup brcmf_fw_request_done() The "cur" variable is now only used for a debug print and we already print the same info from brcmf_fw_complete_request(), so the debug print @@ -1026,3 +610,6 @@ index 6755b2388fbc..b38c4b40b235 100644 brcmf_fw_free_request(fwctx->req); fwctx->req = NULL; } +-- +2.19.1 + diff --git a/cherrytrail-pwm-lpss-fixes.patch b/cherrytrail-pwm-lpss-fixes.patch new file mode 100644 index 000000000..958dd7e74 --- /dev/null +++ b/cherrytrail-pwm-lpss-fixes.patch @@ -0,0 +1,525 @@ +From 9e2ef73d9d72ab312bef34ba318fdcb77facb1f0 Mon Sep 17 00:00:00 2001 +From: Hans de Goede <hdegoede@redhat.com> +Date: Mon, 27 Aug 2018 09:47:42 +0200 +Subject: [PATCH 1/7] pwm: lpss: Add ACPI HID for second PWM controller on + Cherry Trail devices + +The second PWM controller on Cherry Trail devices uses a separate ACPI +HID: "80862289", add this so that the driver will properly bind to the +second PWM controller. + +The second PWM controller is usually not used, the main thing gained by +this is properly putting the PWM controller in D3 on suspend. + +Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> +Signed-off-by: Hans de Goede <hdegoede@redhat.com> +--- + drivers/pwm/pwm-lpss-platform.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/pwm/pwm-lpss-platform.c b/drivers/pwm/pwm-lpss-platform.c +index 5561b9e190f8..7304f36ee715 100644 +--- a/drivers/pwm/pwm-lpss-platform.c ++++ b/drivers/pwm/pwm-lpss-platform.c +@@ -81,6 +81,7 @@ static SIMPLE_DEV_PM_OPS(pwm_lpss_platform_pm_ops, + static const struct acpi_device_id pwm_lpss_acpi_match[] = { + { "80860F09", (unsigned long)&pwm_lpss_byt_info }, + { "80862288", (unsigned long)&pwm_lpss_bsw_info }, ++ { "80862289", (unsigned long)&pwm_lpss_bsw_info }, + { "80865AC8", (unsigned long)&pwm_lpss_bxt_info }, + { }, + }; +-- +2.19.1 + +From f215ee5bd62ab40ee34c318df1af61991dead98d Mon Sep 17 00:00:00 2001 +From: Hans de Goede <hdegoede@redhat.com> +Date: Tue, 11 Sep 2018 16:07:41 +0200 +Subject: [PATCH 2/7] pwm: lpss: Move struct pwm_lpss_chip definition to the + header file + +Move struct pwm_lpss_chip definition from pwm-lpss.c to pwm-lpss.h, +so that the pci/platform drivers can access the info member +(struct pwm_lpss_boardinfo *). + +This is a preparation patch for adding platform specific quirks, which +the drivers need access to, to pwm_lpss_boardinfo. + +Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> +Signed-off-by: Hans de Goede <hdegoede@redhat.com> +--- +Changes in v4: +-No changes in v4 of this patch-set + +Changes in v3: +-There was no v3, but I accidentally put v3 in the Subject of the v2 + patches, so lets skip v3 + +Changes in v2: +-No changes in v2 of this patch-set +--- + drivers/pwm/pwm-lpss.c | 9 --------- + drivers/pwm/pwm-lpss.h | 9 ++++++++- + 2 files changed, 8 insertions(+), 10 deletions(-) + +diff --git a/drivers/pwm/pwm-lpss.c b/drivers/pwm/pwm-lpss.c +index 4721a264bac2..e602835fd6de 100644 +--- a/drivers/pwm/pwm-lpss.c ++++ b/drivers/pwm/pwm-lpss.c +@@ -32,15 +32,6 @@ + /* Size of each PWM register space if multiple */ + #define PWM_SIZE 0x400 + +-#define MAX_PWMS 4 +- +-struct pwm_lpss_chip { +- struct pwm_chip chip; +- void __iomem *regs; +- const struct pwm_lpss_boardinfo *info; +- u32 saved_ctrl[MAX_PWMS]; +-}; +- + static inline struct pwm_lpss_chip *to_lpwm(struct pwm_chip *chip) + { + return container_of(chip, struct pwm_lpss_chip, chip); +diff --git a/drivers/pwm/pwm-lpss.h b/drivers/pwm/pwm-lpss.h +index 7a4238ad1fcb..8f029ed263af 100644 +--- a/drivers/pwm/pwm-lpss.h ++++ b/drivers/pwm/pwm-lpss.h +@@ -16,7 +16,14 @@ + #include <linux/device.h> + #include <linux/pwm.h> + +-struct pwm_lpss_chip; ++#define MAX_PWMS 4 ++ ++struct pwm_lpss_chip { ++ struct pwm_chip chip; ++ void __iomem *regs; ++ const struct pwm_lpss_boardinfo *info; ++ u32 saved_ctrl[MAX_PWMS]; ++}; + + struct pwm_lpss_boardinfo { + unsigned long clk_rate; +-- +2.19.1 + +From eb73756876f92ad0da4259400bce50881cb332b7 Mon Sep 17 00:00:00 2001 +From: Hans de Goede <hdegoede@redhat.com> +Date: Mon, 10 Sep 2018 15:30:58 +0200 +Subject: [PATCH 3/7] pwm: lpss: Check PWM powerstate after resume on Cherry + Trail devices + +The _PS0 method for the integrated graphics on some Cherry Trail devices +(observed on a HP Pavilion X2 10-p0XX) turns on the PWM chip (puts it in +D0), causing an inconsistency between the state the pm-core thinks it is +in (left runtime suspended as it was before the suspend/resume) and the +state it actually is in. + +Interestingly enough this is done on a device where the pwm controller is +not used for the backlight at all, since it uses an eDP panel. On devices +where the PWM is used this is not a problem since we will resume it +ourselves anyways. + +This inconsistency causes us to never suspend the pwm controller again, +which causes the device to not be able to reach S0ix states when suspended. + +This commit adds a resume-complete handler, which when we think the device +is still run-time suspended checks the actual power-state and if necessary +updates the rpm-core's internal state. + +This fixes the Pavilion X2 10-p0XX not reaching S0ix states when suspended. + +Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> +Signed-off-by: Hans de Goede <hdegoede@redhat.com> +--- +Changes in v4: +-Use acpi_device_get_power() instead of manually calling _PSC + +Changes in v3: +-There was no v3, but I accidentally put v3 in the Subject of the v2 + patches, so lets skip v3 + +Changes in v2: +-Do the pm_runtime_en/disable before/after checking the power-state +--- + drivers/pwm/pwm-lpss-platform.c | 25 ++++++++++++++++++++++--- + drivers/pwm/pwm-lpss.h | 2 ++ + 2 files changed, 24 insertions(+), 3 deletions(-) + +diff --git a/drivers/pwm/pwm-lpss-platform.c b/drivers/pwm/pwm-lpss-platform.c +index 7304f36ee715..b6edf8af26cc 100644 +--- a/drivers/pwm/pwm-lpss-platform.c ++++ b/drivers/pwm/pwm-lpss-platform.c +@@ -30,6 +30,7 @@ static const struct pwm_lpss_boardinfo pwm_lpss_bsw_info = { + .clk_rate = 19200000, + .npwm = 1, + .base_unit_bits = 16, ++ .check_power_on_resume = true, + }; + + /* Broxton */ +@@ -74,9 +75,27 @@ static int pwm_lpss_remove_platform(struct platform_device *pdev) + return pwm_lpss_remove(lpwm); + } + +-static SIMPLE_DEV_PM_OPS(pwm_lpss_platform_pm_ops, +- pwm_lpss_suspend, +- pwm_lpss_resume); ++static void pwm_lpss_complete(struct device *dev) ++{ ++ struct pwm_lpss_chip *lpwm = dev_get_drvdata(dev); ++ int ret, state; ++ ++ /* The PWM may be turned on by AML code, update our state to match */ ++ if (pm_runtime_suspended(dev) && lpwm->info->check_power_on_resume) { ++ pm_runtime_disable(dev); ++ ++ ret = acpi_device_get_power(ACPI_COMPANION(dev), &state); ++ if (ret == 0 && state == ACPI_STATE_D0) ++ pm_runtime_set_active(dev); ++ ++ pm_runtime_enable(dev); ++ } ++} ++ ++static const struct dev_pm_ops pwm_lpss_platform_pm_ops = { ++ .complete = pwm_lpss_complete, ++ SET_SYSTEM_SLEEP_PM_OPS(pwm_lpss_suspend, pwm_lpss_resume) ++}; + + static const struct acpi_device_id pwm_lpss_acpi_match[] = { + { "80860F09", (unsigned long)&pwm_lpss_byt_info }, +diff --git a/drivers/pwm/pwm-lpss.h b/drivers/pwm/pwm-lpss.h +index 8f029ed263af..1a2575d25bea 100644 +--- a/drivers/pwm/pwm-lpss.h ++++ b/drivers/pwm/pwm-lpss.h +@@ -30,6 +30,8 @@ struct pwm_lpss_boardinfo { + unsigned int npwm; + unsigned long base_unit_bits; + bool bypass; ++ /* Some devices have AML code messing with the state underneath us */ ++ bool check_power_on_resume; + }; + + struct pwm_lpss_chip *pwm_lpss_probe(struct device *dev, struct resource *r, +-- +2.19.1 + +From 0a2e85765305e9fc376d0153aa9747b5d58cc804 Mon Sep 17 00:00:00 2001 +From: Hans de Goede <hdegoede@redhat.com> +Date: Mon, 24 Sep 2018 20:57:43 +0200 +Subject: [PATCH 4/7] pwm: lpss: Release runtime-pm reference from the driver's + remove callback + +For each pwm output which gets enabled through pwm_lpss_apply(), we do a +pm_runtime_get_sync(). + +This commit adds pm_runtime_put() calls to pwm_lpss_remove() to balance +these when the driver gets removed with some of the outputs still enabled. + +Fixes: f080be27d7d9 ("pwm: lpss: Add support for runtime PM") +Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> +Signed-off-by: Hans de Goede <hdegoede@redhat.com> +--- +Changes in v2: +-New patch in v2 of this patch-set replacing "pwm: lpss: Add + pwm_lpss_get_put_runtime_pm helper function" +--- + drivers/pwm/pwm-lpss.c | 6 ++++++ + 1 file changed, 6 insertions(+) + +diff --git a/drivers/pwm/pwm-lpss.c b/drivers/pwm/pwm-lpss.c +index e602835fd6de..723ca9de8325 100644 +--- a/drivers/pwm/pwm-lpss.c ++++ b/drivers/pwm/pwm-lpss.c +@@ -205,6 +205,12 @@ EXPORT_SYMBOL_GPL(pwm_lpss_probe); + + int pwm_lpss_remove(struct pwm_lpss_chip *lpwm) + { ++ int i; ++ ++ for (i = 0; i < lpwm->info->npwm; i++) { ++ if (pwm_is_enabled(&lpwm->chip.pwms[i])) ++ pm_runtime_put(lpwm->chip.dev); ++ } + return pwmchip_remove(&lpwm->chip); + } + EXPORT_SYMBOL_GPL(pwm_lpss_remove); +-- +2.19.1 + +From c3ffc28eeb4f9974380c4a85abfbb387d6d1cd8d Mon Sep 17 00:00:00 2001 +From: Hans de Goede <hdegoede@redhat.com> +Date: Fri, 25 Nov 2016 09:45:19 +0100 +Subject: [PATCH 5/7] pwm: lpss: Add get_state callback + +Add a get_state callback so that the initial state correctly reflects +the actual hardware state. + +Cc: Andy Shevchenko <andriy.shevchenko@linux.intel.com> +Acked-by: Jani Nikula <jani.nikula@intel.com> +Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> +Signed-off-by: Hans de Goede <hdegoede@redhat.com> +--- +Changes in v2: +-Stop using the dropped pwm_lpss_get_put_runtime_pm() helper +--- + drivers/pwm/pwm-lpss.c | 34 ++++++++++++++++++++++++++++++++++ + 1 file changed, 34 insertions(+) + +diff --git a/drivers/pwm/pwm-lpss.c b/drivers/pwm/pwm-lpss.c +index 723ca9de8325..ea93ef9f3672 100644 +--- a/drivers/pwm/pwm-lpss.c ++++ b/drivers/pwm/pwm-lpss.c +@@ -159,8 +159,42 @@ static int pwm_lpss_apply(struct pwm_chip *chip, struct pwm_device *pwm, + return 0; + } + ++/* This function gets called once from pwmchip_add to get the initial state */ ++static void pwm_lpss_get_state(struct pwm_chip *chip, struct pwm_device *pwm, ++ struct pwm_state *state) ++{ ++ struct pwm_lpss_chip *lpwm = to_lpwm(chip); ++ unsigned long base_unit_range; ++ unsigned long long base_unit, freq, on_time_div; ++ u32 ctrl; ++ ++ base_unit_range = BIT(lpwm->info->base_unit_bits); ++ ++ ctrl = pwm_lpss_read(pwm); ++ on_time_div = 255 - (ctrl & PWM_ON_TIME_DIV_MASK); ++ base_unit = (ctrl >> PWM_BASE_UNIT_SHIFT) & (base_unit_range - 1); ++ ++ freq = base_unit * lpwm->info->clk_rate; ++ do_div(freq, base_unit_range); ++ if (freq == 0) ++ state->period = NSEC_PER_SEC; ++ else ++ state->period = NSEC_PER_SEC / (unsigned long)freq; ++ ++ on_time_div *= state->period; ++ do_div(on_time_div, 255); ++ state->duty_cycle = on_time_div; ++ ++ state->polarity = PWM_POLARITY_NORMAL; ++ state->enabled = !!(ctrl & PWM_ENABLE); ++ ++ if (state->enabled) ++ pm_runtime_get(chip->dev); ++} ++ + static const struct pwm_ops pwm_lpss_ops = { + .apply = pwm_lpss_apply, ++ .get_state = pwm_lpss_get_state, + .owner = THIS_MODULE, + }; + +-- +2.19.1 + +From e96509f196d1229cf66b19ad9f3d7cd43a86bc9d Mon Sep 17 00:00:00 2001 +From: Hans de Goede <hdegoede@redhat.com> +Date: Sat, 13 Oct 2018 00:04:12 +0200 +Subject: [PATCH 6/7] pwm: lpss: Force runtime-resume on suspend on Cherry + Trail + +On Cherry Trail devices under Windows the PWM controller used for the +backlight is considered part of the GPU even though it is part of the LPSS +block and thus is an entirely different independent hardware unit. + +Because of this on Cherry Trail the GPU's (GFX0 ACPI node) _PS3 and _PS0 +methods save and restore the PWM controller registers. + +If userspace blanks the screen before suspending, such as e.g. GNOME +does, then the PWM controller will be runtime-suspended when the suspend +starts. This causes the GFX0 _PS? methods to save a value of 0xffffffff +for the PWM control register and to restore this value on resume. + +0xffffffff is not a valid value for the register and writing this causes +problems such as e.g. a flickering backlight. + +This commit adds a prepare method to the dev_pm_ops and makes it return 0 +on Cherry Trail devices forcing a runtime-resume before other device's +suspend methods run. This fixes the reading and writing back of 0xffffffff. + +Since we now always runtime-resume the device on suspend, it will be +resumed on resume too and we no longer need to check for the GFX0 _PS0 +method having resumed it underneath us, so this commit removes the now no +longer necessary complete dev_pm_op. + +Signed-off-by: Hans de Goede <hdegoede@redhat.com> +--- + drivers/pwm/pwm-lpss-platform.c | 24 +++++++++++------------- + drivers/pwm/pwm-lpss.h | 7 +++++-- + 2 files changed, 16 insertions(+), 15 deletions(-) + +diff --git a/drivers/pwm/pwm-lpss-platform.c b/drivers/pwm/pwm-lpss-platform.c +index b6edf8af26cc..757230e1f575 100644 +--- a/drivers/pwm/pwm-lpss-platform.c ++++ b/drivers/pwm/pwm-lpss-platform.c +@@ -30,7 +30,7 @@ static const struct pwm_lpss_boardinfo pwm_lpss_bsw_info = { + .clk_rate = 19200000, + .npwm = 1, + .base_unit_bits = 16, +- .check_power_on_resume = true, ++ .other_devices_aml_touches_pwm_regs = true, + }; + + /* Broxton */ +@@ -61,6 +61,7 @@ static int pwm_lpss_probe_platform(struct platform_device *pdev) + + platform_set_drvdata(pdev, lpwm); + ++ dev_pm_set_driver_flags(&pdev->dev, DPM_FLAG_SMART_PREPARE); + pm_runtime_set_active(&pdev->dev); + pm_runtime_enable(&pdev->dev); + +@@ -75,25 +76,22 @@ static int pwm_lpss_remove_platform(struct platform_device *pdev) + return pwm_lpss_remove(lpwm); + } + +-static void pwm_lpss_complete(struct device *dev) ++static int pwm_lpss_prepare(struct device *dev) + { + struct pwm_lpss_chip *lpwm = dev_get_drvdata(dev); +- int ret, state; + +- /* The PWM may be turned on by AML code, update our state to match */ +- if (pm_runtime_suspended(dev) && lpwm->info->check_power_on_resume) { +- pm_runtime_disable(dev); ++ /* ++ * If other device's AML code touches the PWM regs on suspend/resume ++ * force runtime-resume the PWM controller to allow this. ++ */ ++ if (lpwm->info->other_devices_aml_touches_pwm_regs) ++ return 0; /* Force runtime-resume */ + +- ret = acpi_device_get_power(ACPI_COMPANION(dev), &state); +- if (ret == 0 && state == ACPI_STATE_D0) +- pm_runtime_set_active(dev); +- +- pm_runtime_enable(dev); +- } ++ return 1; /* If runtime-suspended leave as is */ + } + + static const struct dev_pm_ops pwm_lpss_platform_pm_ops = { +- .complete = pwm_lpss_complete, ++ .prepare = pwm_lpss_prepare, + SET_SYSTEM_SLEEP_PM_OPS(pwm_lpss_suspend, pwm_lpss_resume) + }; + +diff --git a/drivers/pwm/pwm-lpss.h b/drivers/pwm/pwm-lpss.h +index 1a2575d25bea..3236be835bd9 100644 +--- a/drivers/pwm/pwm-lpss.h ++++ b/drivers/pwm/pwm-lpss.h +@@ -30,8 +30,11 @@ struct pwm_lpss_boardinfo { + unsigned int npwm; + unsigned long base_unit_bits; + bool bypass; +- /* Some devices have AML code messing with the state underneath us */ +- bool check_power_on_resume; ++ /* ++ * On some devices the _PS0/_PS3 AML code of the GPU (GFX0) device ++ * messes with the PWM0 controllers state, ++ */ ++ bool other_devices_aml_touches_pwm_regs; + }; + + struct pwm_lpss_chip *pwm_lpss_probe(struct device *dev, struct resource *r, +-- +2.19.1 + +From f249418a3a4f123a37c389378f289a7baea95332 Mon Sep 17 00:00:00 2001 +From: Hans de Goede <hdegoede@redhat.com> +Date: Fri, 12 Oct 2018 21:39:53 +0200 +Subject: [PATCH 7/7] pwm: lpss: Only set update bit if we are actually + changing the settings + +According to the datasheet the update bit must be set if the on-time-div +or the base-unit changes. + +Now that we properly order device resume on Cherry Trail so that the GFX0 +_PS0 method no longer exits with an error, we end up with a sequence of +events where we are writing the same values twice in a row. + +First the _PS0 method restores the duty cycle of 0% the GPU driver set +on suspend and then the GPU driver first updates just the enabled bit in +the pwm_state from 0 to 1, causing us to write the same values again, +before restoring the pre-suspend duty-cycle in a separate pwm_apply call. + +When writing the update bit the second time, without changing any of +the values the update bit clears immediately / instantly, instead of +staying 1 for a while as usual. After this the next setting of the update +bit seems to be ignored, causing the restoring of the pre-suspend +duty-cycle to not get applied. This makes the backlight come up with +a 0% dutycycle after suspend/resume. + +Any further brightness changes after this do work. + +This commit moves the setting of the update bit into pwm_lpss_prepare() +and only sets the bit if we have actually changed any of the values. + +This avoids the setting of the update bit the second time we configure +the PWM to 0% dutycycle, this fixes the backlight coming up with 0% +duty-cycle after a suspend/resume. + +Signed-off-by: Hans de Goede <hdegoede@redhat.com> +--- + drivers/pwm/pwm-lpss.c | 12 +++++++----- + 1 file changed, 7 insertions(+), 5 deletions(-) + +diff --git a/drivers/pwm/pwm-lpss.c b/drivers/pwm/pwm-lpss.c +index ea93ef9f3672..2ac3a2aa9e53 100644 +--- a/drivers/pwm/pwm-lpss.c ++++ b/drivers/pwm/pwm-lpss.c +@@ -88,7 +88,7 @@ static void pwm_lpss_prepare(struct pwm_lpss_chip *lpwm, struct pwm_device *pwm, + unsigned long long on_time_div; + unsigned long c = lpwm->info->clk_rate, base_unit_range; + unsigned long long base_unit, freq = NSEC_PER_SEC; +- u32 ctrl; ++ u32 orig_ctrl, ctrl; + + do_div(freq, period_ns); + +@@ -105,13 +105,17 @@ static void pwm_lpss_prepare(struct pwm_lpss_chip *lpwm, struct pwm_device *pwm, + do_div(on_time_div, period_ns); + on_time_div = 255ULL - on_time_div; + +- ctrl = pwm_lpss_read(pwm); ++ orig_ctrl = ctrl = pwm_lpss_read(pwm); + ctrl &= ~PWM_ON_TIME_DIV_MASK; + ctrl &= ~(base_unit_range << PWM_BASE_UNIT_SHIFT); + base_unit &= base_unit_range; + ctrl |= (u32) base_unit << PWM_BASE_UNIT_SHIFT; + ctrl |= on_time_div; +- pwm_lpss_write(pwm, ctrl); ++ ++ if (orig_ctrl != ctrl) { ++ pwm_lpss_write(pwm, ctrl); ++ pwm_lpss_write(pwm, ctrl | PWM_SW_UPDATE); ++ } + } + + static inline void pwm_lpss_cond_enable(struct pwm_device *pwm, bool cond) +@@ -135,7 +139,6 @@ static int pwm_lpss_apply(struct pwm_chip *chip, struct pwm_device *pwm, + return ret; + } + pwm_lpss_prepare(lpwm, pwm, state->duty_cycle, state->period); +- pwm_lpss_write(pwm, pwm_lpss_read(pwm) | PWM_SW_UPDATE); + pwm_lpss_cond_enable(pwm, lpwm->info->bypass == false); + ret = pwm_lpss_wait_for_update(pwm); + if (ret) { +@@ -148,7 +151,6 @@ static int pwm_lpss_apply(struct pwm_chip *chip, struct pwm_device *pwm, + if (ret) + return ret; + pwm_lpss_prepare(lpwm, pwm, state->duty_cycle, state->period); +- pwm_lpss_write(pwm, pwm_lpss_read(pwm) | PWM_SW_UPDATE); + return pwm_lpss_wait_for_update(pwm); + } + } else if (pwm_is_enabled(pwm)) { +-- +2.19.1 + diff --git a/configs/fedora/generic/x86/CONFIG_PINCTRL_GEMINILAKE b/configs/fedora/generic/x86/CONFIG_PINCTRL_GEMINILAKE index deb3b301d..fca1ee23a 100644 --- a/configs/fedora/generic/x86/CONFIG_PINCTRL_GEMINILAKE +++ b/configs/fedora/generic/x86/CONFIG_PINCTRL_GEMINILAKE @@ -1 +1 @@ -# CONFIG_PINCTRL_GEMINILAKE is not set +CONFIG_PINCTRL_GEMINILAKE=m diff --git a/hwmon-rpi-Fix-initial-notify.patch b/hwmon-rpi-Fix-initial-notify.patch new file mode 100644 index 000000000..eb6ad7c78 --- /dev/null +++ b/hwmon-rpi-Fix-initial-notify.patch @@ -0,0 +1,112 @@ +From patchwork Sun Nov 11 12:01:11 2018 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 8bit +X-Patchwork-Submitter: Stefan Wahren <stefan.wahren@i2se.com> +X-Patchwork-Id: 10677591 +Return-Path: <linux-hwmon-owner@kernel.org> +Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org + [172.30.200.125]) + by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1554014DB + for <patchwork-linux-hwmon@patchwork.kernel.org>; + Sun, 11 Nov 2018 12:02:21 +0000 (UTC) +Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) + by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EF81F2AAE1 + for <patchwork-linux-hwmon@patchwork.kernel.org>; + Sun, 11 Nov 2018 12:02:20 +0000 (UTC) +Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) + id DD04A2AAF4; Sun, 11 Nov 2018 12:02:20 +0000 (UTC) +X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on + pdx-wl-mail.web.codeaurora.org +X-Spam-Level: +X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, + RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 +Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) + by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4F86D2AAE1 + for <patchwork-linux-hwmon@patchwork.kernel.org>; + Sun, 11 Nov 2018 12:02:20 +0000 (UTC) +Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand + id S1727510AbeKKVum (ORCPT + <rfc822;patchwork-linux-hwmon@patchwork.kernel.org>); + Sun, 11 Nov 2018 16:50:42 -0500 +Received: from mout.kundenserver.de ([212.227.17.13]:56911 "EHLO + mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org + with ESMTP id S1727492AbeKKVum (ORCPT + <rfc822;linux-hwmon@vger.kernel.org>); + Sun, 11 Nov 2018 16:50:42 -0500 +Received: from localhost.localdomain ([37.4.249.153]) by + mrelayeu.kundenserver.de (mreue106 [212.227.15.183]) with ESMTPSA (Nemesis) + id 1N5W0q-1fPBCS2EFm-016xot; Sun, 11 Nov 2018 13:01:38 +0100 +From: Stefan Wahren <stefan.wahren@i2se.com> +To: Eric Anholt <eric@anholt.net>, + Florian Fainelli <f.fainelli@gmail.com>, + Jean Delvare <jdelvare@suse.com>, + Guenter Roeck <linux@roeck-us.net>, + Greg Kroah-Hartman <gregkh@linuxfoundation.org> +Cc: linux-rpi-kernel@lists.infradead.org, linux-hwmon@vger.kernel.org, + linux-kernel@vger.kernel.org, + Stefan Wahren <stefan.wahren@i2se.com> +Subject: [PATCH] hwmon: rpi: Fix initial notify +Date: Sun, 11 Nov 2018 13:01:11 +0100 +Message-Id: <1541937671-26385-1-git-send-email-stefan.wahren@i2se.com> +X-Mailer: git-send-email 2.7.4 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +X-Provags-ID: V03:K1:HEVIdEl0kizgBdNf0M5wstvyz7s6HdToU1mddQPsbGgHjkiBWSZ + SKazwNvgO6cbViYoUW17vGwM+wtH3UvfMleX6l3XXOJUwGoJIZP7C9iMFyqzOhl1AlaWRQ+ + nGjpMnsO6ZoiSjYhxMPB911ALciozsvmmLqnauqOofp2A/Y1/Tcfzfrv2IhQJICMhDSNaco + akAN1etmFdi29Cdupykhw== +X-UI-Out-Filterresults: notjunk:1;V01:K0:tzezqudV+18=:I+avf+CPQCA+RPEHvwv55R + iJN07WrrHGCkxDyTa1k+J8anYCg6oDlByPsB4O51GNXOi1XH2wPejZd6QJflDwV0IjWsd1mfU + xmQwbUh5YsPt6czgCadtNhv89tCiiHGxGyLiNjZpXICCRYxcY9szc+T27wAi6tAeQsahSk7Zc + P7+RqK/K3qtckuZiInGDWLzDvbMkItVWmxB/86m6NH4QbXCqJo/m0F6yZWCq1t/ocW/NmK9nH + 3sFSBLGNA+DGHqRLq1Tp+a+Xf1XuQlWwVYusgY3z9tNBdbTG9fQhBwac+oBJ+ZnF8S5WtdcSk + T31iv44dd2DkPTXqRuzSBWKnMQIZbabtWOYI9paJgywle7kdbJJlWx/kHONkEeKdjM7+MCUVn + 9iAWGJiu9tZ+i+FxYqUlLGOlZZW/sJiXzizD+WQYXdDiNh9lU2926j9Ydc+vF5fF1DzwaLsTf + 7cvqwTu8gBFVOffZhsHT5+loV6D5WvJjY3JUPmhraz4ioeagBG6+s34gN3LtPYnUYNJO/Cd3Z + CLnkDRAoKUNCeqhqsifSzcy49XV5h8YPrkSBWWBek7gAzU/DVI1mXLgcESMoe77NdlLeCqLUm + 0W+phul1X1/9/WPqPkr6j9E7MjgIbo7XcPtmy+treFmpnZWz5766NVHRJ+RPCN9RVFocCcILy + +n2ryGG9Llo5cGCbUU+eSWsigfVGTGmQzvatSRpt262UKg3EyZrqtedY+GLnKMMvAqra/GKvs + 0SObqg+2lnFLxgOSq/dM7hz7QuKk2JFmfuuXu0T+aMTpc9ZZx90sE6kMjBz8cF+hBFutqehUk + 10cHzngQFaS21pN/PQ2gpU1ZlGFfqQ3gEjQz8zF7KGhTS5FiYY= +Sender: linux-hwmon-owner@vger.kernel.org +Precedence: bulk +List-ID: <linux-hwmon.vger.kernel.org> +X-Mailing-List: linux-hwmon@vger.kernel.org +X-Virus-Scanned: ClamAV using ClamSMTP + +In case an under-voltage happens before probing the driver wont +write the critical warning into the kernel log. So don't init +of last_throttled during probe and fix this issue. + +Fixes: 74d1e007915f ("hwmon: Add support for RPi voltage sensor") +Reported-by: "Noralf Trønnes" <noralf@tronnes.org> +Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com> +--- + drivers/hwmon/raspberrypi-hwmon.c | 6 ------ + 1 file changed, 6 deletions(-) + +diff --git a/drivers/hwmon/raspberrypi-hwmon.c b/drivers/hwmon/raspberrypi-hwmon.c +index be5ba46..0d04572 100644 +--- a/drivers/hwmon/raspberrypi-hwmon.c ++++ b/drivers/hwmon/raspberrypi-hwmon.c +@@ -115,7 +115,6 @@ static int rpi_hwmon_probe(struct platform_device *pdev) + { + struct device *dev = &pdev->dev; + struct rpi_hwmon_data *data; +- int ret; + + data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); + if (!data) +@@ -124,11 +123,6 @@ static int rpi_hwmon_probe(struct platform_device *pdev) + /* Parent driver assure that firmware is correct */ + data->fw = dev_get_drvdata(dev->parent); + +- /* Init throttled */ +- ret = rpi_firmware_property(data->fw, RPI_FIRMWARE_GET_THROTTLED, +- &data->last_throttled, +- sizeof(data->last_throttled)); +- + data->hwmon_dev = devm_hwmon_device_register_with_info(dev, "rpi_volt", + data, + &rpi_chip_info, diff --git a/iio-accel-kxcjk1013-Add-more-hardware-ids.patch b/iio-accel-kxcjk1013-Add-more-hardware-ids.patch new file mode 100644 index 000000000..d3e5eef2f --- /dev/null +++ b/iio-accel-kxcjk1013-Add-more-hardware-ids.patch @@ -0,0 +1,63 @@ +From e90e897b3cac4038d49b38397ab044498c1d7adc Mon Sep 17 00:00:00 2001 +From: Hans de Goede <hdegoede@redhat.com> +Date: Tue, 2 Oct 2018 20:05:34 +0200 +Subject: [PATCH 4.20 regression fix] iio: accel: kxcjk1013: Add KIOX0009 ACPI + Hardware-ID + +Add KIOX0009 ACPI HID, this is used e.g. on the Acer One 10. + +Signed-off-by: Hans de Goede <hdegoede@redhat.com> +--- + drivers/iio/accel/kxcjk-1013.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c +index af53a1084ee5..8600e4be88ad 100644 +--- a/drivers/iio/accel/kxcjk-1013.c ++++ b/drivers/iio/accel/kxcjk-1013.c +@@ -1489,6 +1489,7 @@ static const struct acpi_device_id kx_acpi_match[] = { + {"KXCJ1013", KXCJK1013}, + {"KXCJ1008", KXCJ91008}, + {"KXCJ9000", KXCJ91008}, ++ {"KIOX0009", KXTJ21009}, + {"KIOX000A", KXCJ91008}, + {"KXTJ1009", KXTJ21009}, + {"SMO8500", KXCJ91008}, +-- +2.19.1 + +From e45a7af34a700c99f91f50e021c187f05552f2f4 Mon Sep 17 00:00:00 2001 +From: Hans de Goede <hdegoede@redhat.com> +Date: Tue, 20 Nov 2018 11:39:45 +0100 +Subject: [PATCH 4.20 regression fix] iio: accel: kxcjk1013: Add KIOX010A ACPI + Hardware-ID + +Various 2-in-1's use KIOX010A and KIOX020A as HIDs for 2 KXCJ91008 +accelerometers. The KIOX010A HID is for the one in the base and the +KIOX020A for the accelerometer in the keyboard. + +Since userspace does not have a way yet to deal with (or ignore) the +accelerometer in the keyboard, this commit just adds the KIOX010A HID +for now so that display rotation will work. + +Related: https://github.com/hadess/iio-sensor-proxy/issues/166 +Signed-off-by: Hans de Goede <hdegoede@redhat.com> +--- + drivers/iio/accel/kxcjk-1013.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/iio/accel/kxcjk-1013.c b/drivers/iio/accel/kxcjk-1013.c +index 8600e4be88ad..210742584041 100644 +--- a/drivers/iio/accel/kxcjk-1013.c ++++ b/drivers/iio/accel/kxcjk-1013.c +@@ -1491,6 +1491,7 @@ static const struct acpi_device_id kx_acpi_match[] = { + {"KXCJ9000", KXCJ91008}, + {"KIOX0009", KXTJ21009}, + {"KIOX000A", KXCJ91008}, ++ {"KIOX010A", KXCJ91008}, /* KXCJ91008 inside the display of a 2-in-1 */ + {"KXTJ1009", KXTJ21009}, + {"SMO8500", KXCJ91008}, + { }, +-- +2.19.1 + diff --git a/kernel-i686-debug.config b/kernel-i686-debug.config index 4fa097e0e..ad132772a 100644 --- a/kernel-i686-debug.config +++ b/kernel-i686-debug.config @@ -4283,7 +4283,7 @@ CONFIG_PINCTRL_CANNONLAKE=m CONFIG_PINCTRL_CEDARFORK=m CONFIG_PINCTRL_CHERRYVIEW=y CONFIG_PINCTRL_DENVERTON=m -# CONFIG_PINCTRL_GEMINILAKE is not set +CONFIG_PINCTRL_GEMINILAKE=m CONFIG_PINCTRL_ICELAKE=m # CONFIG_PINCTRL_IPQ8074 is not set CONFIG_PINCTRL_LEWISBURG=m diff --git a/kernel-i686.config b/kernel-i686.config index 874c0a04f..a207e1a82 100644 --- a/kernel-i686.config +++ b/kernel-i686.config @@ -4260,7 +4260,7 @@ CONFIG_PINCTRL_CANNONLAKE=m CONFIG_PINCTRL_CEDARFORK=m CONFIG_PINCTRL_CHERRYVIEW=y CONFIG_PINCTRL_DENVERTON=m -# CONFIG_PINCTRL_GEMINILAKE is not set +CONFIG_PINCTRL_GEMINILAKE=m CONFIG_PINCTRL_ICELAKE=m # CONFIG_PINCTRL_IPQ8074 is not set CONFIG_PINCTRL_LEWISBURG=m diff --git a/kernel-x86_64-debug.config b/kernel-x86_64-debug.config index 0a3373c84..b8d1b1e70 100644 --- a/kernel-x86_64-debug.config +++ b/kernel-x86_64-debug.config @@ -4326,7 +4326,7 @@ CONFIG_PINCTRL_CANNONLAKE=m CONFIG_PINCTRL_CEDARFORK=m CONFIG_PINCTRL_CHERRYVIEW=y CONFIG_PINCTRL_DENVERTON=m -# CONFIG_PINCTRL_GEMINILAKE is not set +CONFIG_PINCTRL_GEMINILAKE=m CONFIG_PINCTRL_ICELAKE=m # CONFIG_PINCTRL_IPQ8074 is not set CONFIG_PINCTRL_LEWISBURG=m diff --git a/kernel-x86_64.config b/kernel-x86_64.config index 6af699b16..d71013ddf 100644 --- a/kernel-x86_64.config +++ b/kernel-x86_64.config @@ -4303,7 +4303,7 @@ CONFIG_PINCTRL_CANNONLAKE=m CONFIG_PINCTRL_CEDARFORK=m CONFIG_PINCTRL_CHERRYVIEW=y CONFIG_PINCTRL_DENVERTON=m -# CONFIG_PINCTRL_GEMINILAKE is not set +CONFIG_PINCTRL_GEMINILAKE=m CONFIG_PINCTRL_ICELAKE=m # CONFIG_PINCTRL_IPQ8074 is not set CONFIG_PINCTRL_LEWISBURG=m diff --git a/kernel.spec b/kernel.spec index e1d3d021e..f12bd03c8 100644 --- a/kernel.spec +++ b/kernel.spec @@ -44,7 +44,7 @@ Summary: The Linux kernel # For non-released -rc kernels, this will be appended after the rcX and # gitX tags, so a 3 here would become part of release "0.rcX.gitX.3" # -%global baserelease 351 +%global baserelease 301 %global fedora_build %{baserelease} # base_sublevel is the kernel version we're starting with and patching @@ -608,6 +608,12 @@ Patch330: bcm2835-cpufreq-add-CPU-frequency-control-driver.patch Patch331: bcm283x-drm-vc4-set-is_yuv-to-false-when-num_planes-1.patch +# https://patchwork.kernel.org/patch/10686407/ +Patch332: raspberrypi-Fix-firmware-calls-with-large-buffers.patch + +# https://patchwork.kernel.org/patch/10677591/ +Patch333: hwmon-rpi-Fix-initial-notify.patch + # Patches enabling device specific brcm firmware nvram # https://www.spinics.net/lists/linux-wireless/msg178827.html Patch340: brcmfmac-Remove-firmware-loading-code-duplication.patch @@ -634,6 +640,18 @@ Patch505: CI-2-6-drm-i915-dp-Restrict-link-retrain-workaround-to-external-monito # CVE-2018-18710 rhbz 1645140 1648485 Patch506: cdrom-fix-improper-type-cast-which-can-leat-to-information-leak.patch +# rhbz 1526312, patch is in 4.20, can be dropped on rebase +Patch507: 0001-HID-i2c-hid-override-HID-descriptors-for-certain-dev.patch + +# Patches from 4.20 fixing black screen on CHT devices with i915.fastboot=1 +Patch508: cherrytrail-pwm-lpss-fixes.patch + +# rhbz 1644013, patch pending upstream +Patch509: 0001-ACPI-platform-Add-SMB0001-HID-to-forbidden_id_list.patch + +# rhbz 1526312 (accelerometer part of the bug), patches pending upstream +Patch510: iio-accel-kxcjk1013-Add-more-hardware-ids.patch + # END OF PATCH DEFINITIONS %endif @@ -1898,6 +1916,21 @@ fi # # %changelog +* Tue Nov 20 2018 Hans de Goede <hdegoede@redhat.com> +- Turn on CONFIG_PINCTRL_GEMINILAKE on x86_64 (rhbz#1639155) +- Add a patch fixing touchscreens on HP AMD based laptops (rhbz#1644013) +- Add a patch fixing KIOX010A accelerometers (rhbz#1526312) + +* Sat Nov 17 2018 Peter Robinson <pbrobinson@fedoraproject.org> 4.19.2-301 +- Fix WiFi on Raspberry Pi 3 on aarch64 (rhbz 1649344) +- Fixes for Raspberry Pi hwmon driver and firmware interface + +* Fri Nov 16 2018 Hans de Goede <hdegoede@redhat.com> +- Add patches from 4.20 fixing black screen on CHT devices with i915.fastboot=1 + +* Thu Nov 15 2018 Hans de Goede <hdegoede@redhat.com> +- Add patch fixing touchpads on some Apollo Lake devices not working (#1526312) + * Wed Nov 14 2018 Jeremy Cline <jcline@redhat.com> - 4.19.2-300 - Linux v4.19.2 - Fix CVE-2018-18710 (rhbz 1645140 1648485) diff --git a/raspberrypi-Fix-firmware-calls-with-large-buffers.patch b/raspberrypi-Fix-firmware-calls-with-large-buffers.patch new file mode 100644 index 000000000..79421d616 --- /dev/null +++ b/raspberrypi-Fix-firmware-calls-with-large-buffers.patch @@ -0,0 +1,245 @@ +From patchwork Fri Nov 16 14:39:07 2018 +Content-Type: text/plain; charset="utf-8" +MIME-Version: 1.0 +Content-Transfer-Encoding: 7bit +X-Patchwork-Submitter: James Hughes <james.hughes@raspberrypi.org> +X-Patchwork-Id: 10686407 +Return-Path: + <linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org> +Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org + [172.30.200.125]) + by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9BA9C3CF1 + for <patchwork-linux-arm@patchwork.kernel.org>; + Fri, 16 Nov 2018 14:40:20 +0000 (UTC) +Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) + by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 88C992D04D + for <patchwork-linux-arm@patchwork.kernel.org>; + Fri, 16 Nov 2018 14:40:20 +0000 (UTC) +Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) + id 7C6802D0B5; Fri, 16 Nov 2018 14:40:20 +0000 (UTC) +X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on + pdx-wl-mail.web.codeaurora.org +X-Spam-Level: +X-Spam-Status: No, score=-3.6 required=2.0 tests=BAYES_00,DKIM_SIGNED, + DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 +Received: from bombadil.infradead.org (bombadil.infradead.org + [198.137.202.133]) + (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) + (No client certificate requested) + by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 02F272D0B9 + for <patchwork-linux-arm@patchwork.kernel.org>; + Fri, 16 Nov 2018 14:40:19 +0000 (UTC) +DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; + d=lists.infradead.org; s=bombadil.20170209; h=Sender: + Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: + List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Message-Id:Date: + Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: + Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To: + References:List-Owner; bh=q+rr6CTCNe7Aj9DWt6k8ZBDJfuNlw6LK4NEqho/OsL8=; b=slV + BxeOcHW4UYDgm2VXfNMIZb+/8LPmzjGPpBpBe5IaMR/NthCsM9AL2A1aGdlPRKp8j/Oimcml9ytBG + vy3/u46ZlKFd5bAYEl5veGalWXzUg1KN7UhADmXD9fmMOzkFD4fMChA8+g2qK83F6SfqDM0VS3i14 + /ubAQ9CUdaFi4Vr7F4EZtPdbPmSm76Rm9H8sWxWe6seIEmsL6VMpLVzRLAA0zvX5nslXgUPvDLEZj + uk7BIzGfdWU1oB15xwTu8kyp24WrC2Xd/DNCrrIlvBJ6Vn4lvfdqwPT+Xg59IAaibUhoj/fq1HNet + QenokEPTxg7SS3FsAKl96cR5mWeudtg==; +Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) + by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) + id 1gNfI9-0007DF-JA; Fri, 16 Nov 2018 14:40:17 +0000 +Received: from casper.infradead.org ([2001:8b0:10b:1236::1]) + by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) + id 1gNfI4-00075P-2l + for linux-arm-kernel@bombadil.infradead.org; Fri, 16 Nov 2018 14:40:12 +0000 +DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; + d=infradead.org; s=casper.20170209; h=Message-Id:Date:Subject:Cc:To:From: + Sender:Reply-To:MIME-Version:Content-Type:Content-Transfer-Encoding: + Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender: + Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Id: + List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; + bh=0v+Gt0Sb75ntX3ncvTo0T5q/LQ9HrDko5y0UEkZ6WVk=; b=SCmdpUIYIRr3Gb8eXMDGHl/os + AVmLBMIQEbA1mUB4WPQJlUjz7NKtNXgtLQxSY+yiwIb+LrripAgbQ6yK1Vkn+4bmhtSkb97glmraT + bMOZKrRj/cPhxW5osOa0o2BJQRqWqignWxy8539dbxXbpAAKW+12jA+dOqrjOFUftFH7geD4Ttwis + y/j75BOi7ObkcK1mBDyJDNuSEt2CZutCNZ+A7v7/zqkxnhS3hS7Y9hUD81+J+cIu5x103POH6i7FC + 7JazaqnBZYtl66kXXPOs62v3HA96/QLz7CxmdsnNQvw28MNKsxLw5TKnXJUDJmDCybQ5FL6k6Xomg + T9PDZO9+g==; +Received: from mx08-00252a01.pphosted.com ([91.207.212.211]) + by casper.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) + id 1gNfHz-0006AE-RY + for linux-arm-kernel@lists.infradead.org; Fri, 16 Nov 2018 14:40:09 +0000 +Received: from pps.filterd (m0102629.ppops.net [127.0.0.1]) + by mx08-00252a01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id + wAGEcLBT000897 + for <linux-arm-kernel@lists.infradead.org>; Fri, 16 Nov 2018 14:39:55 GMT +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=raspberrypi.org; + h=from : to : cc : subject : date : message-id; s=pp; + bh=0v+Gt0Sb75ntX3ncvTo0T5q/LQ9HrDko5y0UEkZ6WVk=; + b=ynWh6Gt8VRIRTTbVy4Q9U7IsJWRMWYUNzTD1MYt8M2mcj01ElaCuktcZdGoRxGBJXjLU + CYJP75gWsuHHvbSWSSn2l+qpGuEHm+ddFXuMB4nxC5VmQokt/Z0KPScc4Na2IOOU1Ci/ + wUg2tPdhfupkGIPzTt32SXu3pQX4aAYqx0AEaeJ3ptU/223MOj2Z40HZui1SL0yHxdsT + 283+7DokK0bontWXs0j69cFVklLF+txi0untOXTxGuvtbzj0vu6uMErB9qhph6HVKlnH + kwaoGLPYrc0JnmZt1Kx7nmAQ+xxE3RaNA7E/IisHqX9m5C57JAMtN6WdWUTaLjWeIs8n 2Q== +Received: from mail-wm1-f70.google.com (mail-wm1-f70.google.com + [209.85.128.70]) + by mx08-00252a01.pphosted.com with ESMTP id 2nr7cnhbky-1 + (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=OK) + for <linux-arm-kernel@lists.infradead.org>; Fri, 16 Nov 2018 14:39:55 +0000 +Received: by mail-wm1-f70.google.com with SMTP id d26-v6so24770633wmb.4 + for <linux-arm-kernel@lists.infradead.org>; + Fri, 16 Nov 2018 06:39:55 -0800 (PST) +DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=raspberrypi.org; s=google; + h=from:to:cc:subject:date:message-id; + bh=0v+Gt0Sb75ntX3ncvTo0T5q/LQ9HrDko5y0UEkZ6WVk=; + b=TFhWj6OD0WYvVWhFc0RE+UyQKaAMuO0Da2ahzvPlkfTJj3d26Mf15Ai4ipbfJy4x9d + RLlgEH8Vj457x2kK3QmlXDC5Cy+kzp6FiZi2aFSBinKjY06Dmt4LElzlaye8szk/IuJ/ + f6HdjG3Rmt6Ys/Kx8fct+p87NyvHNe/yfCGnUj5k1nz7+m2eApkvTkGxzYe5SXn5s1Jp + nv/30o4+CcPFK3SqAWo+GkWgD/Uae+4gCP38KxLx6dsYxCS7/kqIF46ac9WmAx9k44Jz + Wt18Pe1A7rIj38vRwLv2JuwUkZrOlAhav52EyDM/03QbgRKzEM9En5DYV2GFAqR1Xc3w + qLzw== +X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; + d=1e100.net; s=20161025; + h=x-gm-message-state:from:to:cc:subject:date:message-id; + bh=0v+Gt0Sb75ntX3ncvTo0T5q/LQ9HrDko5y0UEkZ6WVk=; + b=gFrGygir8lioHrOeF0abzZ3xbTuyQEnk7F/vaRJmx5SyMuxe5SQqcM/PozflvPaB4w + wHeng0ewo0t6S/xfZo9EpTKB19L5L5XnrxLoseo+tagkZJkCH2Bcw7dsBzALR2upGwrT + SfHywXMeCKH9fRAu3/Hj0W934lZDwMG3xqmWWebQ/wqDBE41Nk/dl9iHnGKp9QN61uee + Qv0jpp3sglzprI5CIEQqkElIXAF/jjnPqbknf+5nUyH4xUoe+CzTaEldVeHFc4iTerOZ + b48uPgriPJVTq7Gr7L8qWJ5yLZWqenG4sAIpLbanD8Mkw8ogaybVfIZyzrSKoTbtBiSa + oOEg== +X-Gm-Message-State: AA+aEWaOCOYCkmegm7N2wWsL8XdrnmJenH+HXps2b21WEUnrWH3tCofP + O07nsIq/s30FFJwtMB9dMCaWwCmc2iSWxn7hnqFhagZMyuYFYcJ1Zs5caqAV/LcSS/BBriTI4M7 + 4RALk0oVU/TiJvemnTTRSwFul6+hCHLFRxRM= +X-Received: by 2002:a1c:1cc4:: with SMTP id + c187-v6mr2937585wmc.75.1542379194749; + Fri, 16 Nov 2018 06:39:54 -0800 (PST) +X-Google-Smtp-Source: + AFSGD/XjyVsHsmDi+oKxMsFZ/hLG36TQdg1uDC2wO1upiuvyI+72rZz3AeAffzu3LWvkW8xxAI1e0w== +X-Received: by 2002:a1c:1cc4:: with SMTP id + c187-v6mr2937565wmc.75.1542379194454; + Fri, 16 Nov 2018 06:39:54 -0800 (PST) +Received: from jamesh-VirtualBox.pitowers.org + ([2a00:2381:fdf7:14:4419:8784:6076:3820]) + by smtp.gmail.com with ESMTPSA id a7sm26247594wrx.26.2018.11.16.06.39.53 + (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); + Fri, 16 Nov 2018 06:39:53 -0800 (PST) +From: James Hughes <james.hughes@raspberrypi.org> +To: eric@anholt.net, stefan.wahren@i2se.com, + linux-rpi-kernel@lists.infradead.org, linux-arm-kernel@lists.infradead.org +Subject: [PATCH v3] firmware: raspberrypi: Fix firmware calls with large + buffers +Date: Fri, 16 Nov 2018 14:39:07 +0000 +Message-Id: <20181116143907.6149-1-james.hughes@raspberrypi.org> +X-Mailer: git-send-email 2.17.1 +X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , + definitions=2018-11-16_09:, , signatures=0 +X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 +X-CRM114-CacheID: sfid-20181116_144007_971248_9AC931E8 +X-CRM114-Status: GOOD ( 21.12 ) +X-BeenThere: linux-arm-kernel@lists.infradead.org +X-Mailman-Version: 2.1.21 +Precedence: list +List-Id: <linux-arm-kernel.lists.infradead.org> +List-Unsubscribe: + <http://lists.infradead.org/mailman/options/linux-arm-kernel>, + <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe> +List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/> +List-Post: <mailto:linux-arm-kernel@lists.infradead.org> +List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help> +List-Subscribe: + <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>, + <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe> +Cc: James Hughes <james.hughes@raspberrypi.org> +MIME-Version: 1.0 +Content-Type: text/plain; charset="us-ascii" +Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org> +Errors-To: + linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org +X-Virus-Scanned: ClamAV using ClamSMTP + +Commit a1547e0bca51 ("firmware: raspberrypi: Remove VLA usage") +moved away from VLA's to a fixed maximum size for mailbox data. +However, some mailbox calls use larger data buffers +than the maximum allowed in that change. This fix therefor +moves from using fixed buffers to kmalloc to ensure all sizes +are catered for. + +There is some documentation, which is somewhat out of date, +on the mailbox calls here : +https://github.com/raspberrypi/firmware/wiki/Mailbox-property-interface + +Fixes: a1547e0bca51 ("firmware: raspberrypi: Remove VLA usage") + +Signed-off-by: James Hughes <james.hughes@raspberrypi.org> +Reviewed-by: Eric Anholt <eric@anholt.net> +--- + drivers/firmware/raspberrypi.c | 35 +++++++++++++++++----------------- + 1 file changed, 18 insertions(+), 17 deletions(-) + +v2: Changes to commit message and format only. No code change. +v3: Moved declaration of header back to original position + +diff --git a/drivers/firmware/raspberrypi.c b/drivers/firmware/raspberrypi.c +index a200a2174611..44eb99807e33 100644 +--- a/drivers/firmware/raspberrypi.c ++++ b/drivers/firmware/raspberrypi.c +@@ -14,6 +14,7 @@ + #include <linux/module.h> + #include <linux/of_platform.h> + #include <linux/platform_device.h> ++#include <linux/slab.h> + #include <soc/bcm2835/raspberrypi-firmware.h> + + #define MBOX_MSG(chan, data28) (((data28) & ~0xf) | ((chan) & 0xf)) +@@ -21,8 +22,6 @@ + #define MBOX_DATA28(msg) ((msg) & ~0xf) + #define MBOX_CHAN_PROPERTY 8 + +-#define MAX_RPI_FW_PROP_BUF_SIZE 32 +- + static struct platform_device *rpi_hwmon; + + struct rpi_firmware { +@@ -144,28 +143,30 @@ EXPORT_SYMBOL_GPL(rpi_firmware_property_list); + int rpi_firmware_property(struct rpi_firmware *fw, + u32 tag, void *tag_data, size_t buf_size) + { +- /* Single tags are very small (generally 8 bytes), so the +- * stack should be safe. +- */ +- u8 data[sizeof(struct rpi_firmware_property_tag_header) + +- MAX_RPI_FW_PROP_BUF_SIZE]; +- struct rpi_firmware_property_tag_header *header = +- (struct rpi_firmware_property_tag_header *)data; ++ struct rpi_firmware_property_tag_header *header; + int ret; + +- if (WARN_ON(buf_size > sizeof(data) - sizeof(*header))) +- return -EINVAL; ++ /* Some mailboxes can use over 1k bytes. Rather than checking ++ * size and using stack or kmalloc depending on requirements, ++ * just use kmalloc. Mailboxes don't get called enough to worry ++ * too much about the time taken in the allocation. ++ */ ++ void *data = kmalloc(sizeof(*header) + buf_size, GFP_KERNEL); + ++ if (!data) ++ return -ENOMEM; ++ ++ header = data; + header->tag = tag; + header->buf_size = buf_size; + header->req_resp_size = 0; +- memcpy(data + sizeof(struct rpi_firmware_property_tag_header), +- tag_data, buf_size); ++ memcpy(data + sizeof(*header), tag_data, buf_size); ++ ++ ret = rpi_firmware_property_list(fw, data, buf_size + sizeof(*header)); ++ ++ memcpy(tag_data, data + sizeof(*header), buf_size); + +- ret = rpi_firmware_property_list(fw, &data, buf_size + sizeof(*header)); +- memcpy(tag_data, +- data + sizeof(struct rpi_firmware_property_tag_header), +- buf_size); ++ kfree(data); + + return ret; + } |