--- /dev/null
+From 9b6eaaf3db5e5888df7bca7fed7752a90f7fd871 Mon Sep 17 00:00:00 2001
+From: Eugene Syromiatnikov <esyr@redhat.com>
+Date: Tue, 24 Mar 2020 05:22:13 +0100
+Subject: coresight: do not use the BIT() macro in the UAPI header
+
+From: Eugene Syromiatnikov <esyr@redhat.com>
+
+commit 9b6eaaf3db5e5888df7bca7fed7752a90f7fd871 upstream.
+
+The BIT() macro definition is not available for the UAPI headers
+(moreover, it can be defined differently in the user space); replace
+its usage with the _BITUL() macro that is defined in <linux/const.h>.
+
+Fixes: 237483aa5cf4 ("coresight: stm: adding driver for CoreSight STM component")
+Signed-off-by: Eugene Syromiatnikov <esyr@redhat.com>
+Cc: stable <stable@vger.kernel.org>
+Reviewed-by: Mathieu Poirier <mathieu.poirier@linaro.org>
+Link: https://lore.kernel.org/r/20200324042213.GA10452@asgard.redhat.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ include/uapi/linux/coresight-stm.h | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+--- a/include/uapi/linux/coresight-stm.h
++++ b/include/uapi/linux/coresight-stm.h
+@@ -2,8 +2,10 @@
+ #ifndef __UAPI_CORESIGHT_STM_H_
+ #define __UAPI_CORESIGHT_STM_H_
+
+-#define STM_FLAG_TIMESTAMPED BIT(3)
+-#define STM_FLAG_GUARANTEED BIT(7)
++#include <linux/const.h>
++
++#define STM_FLAG_TIMESTAMPED _BITUL(3)
++#define STM_FLAG_GUARANTEED _BITUL(7)
+
+ /*
+ * The CoreSight STM supports guaranteed and invariant timing
--- /dev/null
+From 9c94553099efb2ba873cbdddfd416a8a09d0e5f1 Mon Sep 17 00:00:00 2001
+From: Hans de Goede <hdegoede@redhat.com>
+Date: Mon, 23 Mar 2020 22:59:39 +0100
+Subject: extcon: axp288: Add wakeup support
+
+From: Hans de Goede <hdegoede@redhat.com>
+
+commit 9c94553099efb2ba873cbdddfd416a8a09d0e5f1 upstream.
+
+On devices with an AXP288, we need to wakeup from suspend when a charger
+is plugged in, so that we can do charger-type detection and so that the
+axp288-charger driver, which listens for our extcon events, can configure
+the input-current-limit accordingly.
+
+Cc: stable@vger.kernel.org
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Chanwoo Choi <cw00.choi@samsung.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/extcon/extcon-axp288.c | 32 ++++++++++++++++++++++++++++++++
+ 1 file changed, 32 insertions(+)
+
+--- a/drivers/extcon/extcon-axp288.c
++++ b/drivers/extcon/extcon-axp288.c
+@@ -443,9 +443,40 @@ static int axp288_extcon_probe(struct pl
+ /* Start charger cable type detection */
+ axp288_extcon_enable(info);
+
++ device_init_wakeup(dev, true);
++ platform_set_drvdata(pdev, info);
++
++ return 0;
++}
++
++static int __maybe_unused axp288_extcon_suspend(struct device *dev)
++{
++ struct axp288_extcon_info *info = dev_get_drvdata(dev);
++
++ if (device_may_wakeup(dev))
++ enable_irq_wake(info->irq[VBUS_RISING_IRQ]);
++
+ return 0;
+ }
+
++static int __maybe_unused axp288_extcon_resume(struct device *dev)
++{
++ struct axp288_extcon_info *info = dev_get_drvdata(dev);
++
++ /*
++ * Wakeup when a charger is connected to do charger-type
++ * connection and generate an extcon event which makes the
++ * axp288 charger driver set the input current limit.
++ */
++ if (device_may_wakeup(dev))
++ disable_irq_wake(info->irq[VBUS_RISING_IRQ]);
++
++ return 0;
++}
++
++static SIMPLE_DEV_PM_OPS(axp288_extcon_pm_ops, axp288_extcon_suspend,
++ axp288_extcon_resume);
++
+ static const struct platform_device_id axp288_extcon_table[] = {
+ { .name = "axp288_extcon" },
+ {},
+@@ -457,6 +488,7 @@ static struct platform_driver axp288_ext
+ .id_table = axp288_extcon_table,
+ .driver = {
+ .name = "axp288_extcon",
++ .pm = &axp288_extcon_pm_ops,
+ },
+ };
+
--- /dev/null
+From 99397d33b763dc554d118aaa38cc5abc6ce985de Mon Sep 17 00:00:00 2001
+From: Alexander Usyskin <alexander.usyskin@intel.com>
+Date: Tue, 24 Mar 2020 23:07:30 +0200
+Subject: mei: me: add cedar fork device ids
+
+From: Alexander Usyskin <alexander.usyskin@intel.com>
+
+commit 99397d33b763dc554d118aaa38cc5abc6ce985de upstream.
+
+Add Cedar Fork (CDF) device ids, those belongs to the cannon point family.
+
+Cc: <stable@vger.kernel.org>
+Signed-off-by: Alexander Usyskin <alexander.usyskin@intel.com>
+Signed-off-by: Tomas Winkler <tomas.winkler@intel.com>
+Link: https://lore.kernel.org/r/20200324210730.17672-1-tomas.winkler@intel.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/misc/mei/hw-me-regs.h | 2 ++
+ drivers/misc/mei/pci-me.c | 2 ++
+ 2 files changed, 4 insertions(+)
+
+--- a/drivers/misc/mei/hw-me-regs.h
++++ b/drivers/misc/mei/hw-me-regs.h
+@@ -87,6 +87,8 @@
+ #define MEI_DEV_ID_CMP_H 0x06e0 /* Comet Lake H */
+ #define MEI_DEV_ID_CMP_H_3 0x06e4 /* Comet Lake H 3 (iTouch) */
+
++#define MEI_DEV_ID_CDF 0x18D3 /* Cedar Fork */
++
+ #define MEI_DEV_ID_ICP_LP 0x34E0 /* Ice Lake Point LP */
+
+ #define MEI_DEV_ID_JSP_N 0x4DE0 /* Jasper Lake Point N */
+--- a/drivers/misc/mei/pci-me.c
++++ b/drivers/misc/mei/pci-me.c
+@@ -111,6 +111,8 @@ static const struct pci_device_id mei_me
+ {MEI_PCI_DEVICE(MEI_DEV_ID_MCC, MEI_ME_PCH15_CFG)},
+ {MEI_PCI_DEVICE(MEI_DEV_ID_MCC_4, MEI_ME_PCH8_CFG)},
+
++ {MEI_PCI_DEVICE(MEI_DEV_ID_CDF, MEI_ME_PCH8_CFG)},
++
+ /* required last entry */
+ {0, }
+ };
--- /dev/null
+From b2ba9225e0313b1de631a44b7b48c109032bffec Mon Sep 17 00:00:00 2001
+From: Kishon Vijay Abraham I <kishon@ti.com>
+Date: Tue, 17 Mar 2020 15:31:54 +0530
+Subject: misc: pci_endpoint_test: Avoid using module parameter to determine irqtype
+
+From: Kishon Vijay Abraham I <kishon@ti.com>
+
+commit b2ba9225e0313b1de631a44b7b48c109032bffec upstream.
+
+commit e03327122e2c ("pci_endpoint_test: Add 2 ioctl commands")
+uses module parameter 'irqtype' in pci_endpoint_test_set_irq()
+to check if IRQ vectors of a particular type (MSI or MSI-X or
+LEGACY) is already allocated. However with multi-function devices,
+'irqtype' will not correctly reflect the IRQ type of the PCI device.
+
+Fix it here by adding 'irqtype' for each PCI device to show the
+IRQ type of a particular PCI device.
+
+Fixes: e03327122e2c ("pci_endpoint_test: Add 2 ioctl commands")
+Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
+Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
+Cc: stable@vger.kernel.org # v4.19+
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/misc/pci_endpoint_test.c | 12 +++++++++---
+ 1 file changed, 9 insertions(+), 3 deletions(-)
+
+--- a/drivers/misc/pci_endpoint_test.c
++++ b/drivers/misc/pci_endpoint_test.c
+@@ -98,6 +98,7 @@ struct pci_endpoint_test {
+ struct completion irq_raised;
+ int last_irq;
+ int num_irqs;
++ int irq_type;
+ /* mutex to protect the ioctls */
+ struct mutex mutex;
+ struct miscdevice miscdev;
+@@ -157,6 +158,7 @@ static void pci_endpoint_test_free_irq_v
+ struct pci_dev *pdev = test->pdev;
+
+ pci_free_irq_vectors(pdev);
++ test->irq_type = IRQ_TYPE_UNDEFINED;
+ }
+
+ static bool pci_endpoint_test_alloc_irq_vectors(struct pci_endpoint_test *test,
+@@ -191,6 +193,8 @@ static bool pci_endpoint_test_alloc_irq_
+ irq = 0;
+ res = false;
+ }
++
++ test->irq_type = type;
+ test->num_irqs = irq;
+
+ return res;
+@@ -330,6 +334,7 @@ static bool pci_endpoint_test_copy(struc
+ dma_addr_t orig_dst_phys_addr;
+ size_t offset;
+ size_t alignment = test->alignment;
++ int irq_type = test->irq_type;
+ u32 src_crc32;
+ u32 dst_crc32;
+
+@@ -426,6 +431,7 @@ static bool pci_endpoint_test_write(stru
+ dma_addr_t orig_phys_addr;
+ size_t offset;
+ size_t alignment = test->alignment;
++ int irq_type = test->irq_type;
+ u32 crc32;
+
+ if (size > SIZE_MAX - alignment)
+@@ -494,6 +500,7 @@ static bool pci_endpoint_test_read(struc
+ dma_addr_t orig_phys_addr;
+ size_t offset;
+ size_t alignment = test->alignment;
++ int irq_type = test->irq_type;
+ u32 crc32;
+
+ if (size > SIZE_MAX - alignment)
+@@ -555,7 +562,7 @@ static bool pci_endpoint_test_set_irq(st
+ return false;
+ }
+
+- if (irq_type == req_irq_type)
++ if (test->irq_type == req_irq_type)
+ return true;
+
+ pci_endpoint_test_release_irq(test);
+@@ -567,12 +574,10 @@ static bool pci_endpoint_test_set_irq(st
+ if (!pci_endpoint_test_request_irq(test))
+ goto err;
+
+- irq_type = req_irq_type;
+ return true;
+
+ err:
+ pci_endpoint_test_free_irq_vectors(test);
+- irq_type = IRQ_TYPE_UNDEFINED;
+ return false;
+ }
+
+@@ -652,6 +657,7 @@ static int pci_endpoint_test_probe(struc
+ test->test_reg_bar = 0;
+ test->alignment = 0;
+ test->pdev = pdev;
++ test->irq_type = IRQ_TYPE_UNDEFINED;
+
+ if (no_msi)
+ irq_type = IRQ_TYPE_LEGACY;
--- /dev/null
+From 6b443e5c80b67a7b8a85b33d052d655ef9064e90 Mon Sep 17 00:00:00 2001
+From: Kishon Vijay Abraham I <kishon@ti.com>
+Date: Tue, 17 Mar 2020 15:31:57 +0530
+Subject: misc: pci_endpoint_test: Fix to support > 10 pci-endpoint-test devices
+
+From: Kishon Vijay Abraham I <kishon@ti.com>
+
+commit 6b443e5c80b67a7b8a85b33d052d655ef9064e90 upstream.
+
+Adding more than 10 pci-endpoint-test devices results in
+"kobject_add_internal failed for pci-endpoint-test.1 with -EEXIST, don't
+try to register things with the same name in the same directory". This
+is because commit 2c156ac71c6b ("misc: Add host side PCI driver for PCI
+test function device") limited the length of the "name" to 20 characters.
+Change the length of the name to 24 in order to support upto 10000
+pci-endpoint-test devices.
+
+Fixes: 2c156ac71c6b ("misc: Add host side PCI driver for PCI test function device")
+Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
+Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
+Cc: stable@vger.kernel.org # v4.14+
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/misc/pci_endpoint_test.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/misc/pci_endpoint_test.c
++++ b/drivers/misc/pci_endpoint_test.c
+@@ -633,7 +633,7 @@ static int pci_endpoint_test_probe(struc
+ {
+ int err;
+ int id;
+- char name[20];
++ char name[24];
+ enum pci_barno bar;
+ void __iomem *base;
+ struct device *dev = &pdev->dev;
--- /dev/null
+From 10cea23b6aae15e8324f4101d785687f2c514fe5 Mon Sep 17 00:00:00 2001
+From: YueHaibing <yuehaibing@huawei.com>
+Date: Thu, 26 Mar 2020 11:26:18 +0800
+Subject: misc: rtsx: set correct pcr_ops for rts522A
+
+From: YueHaibing <yuehaibing@huawei.com>
+
+commit 10cea23b6aae15e8324f4101d785687f2c514fe5 upstream.
+
+rts522a should use rts522a_pcr_ops, which is
+diffrent with rts5227 in phy/hw init setting.
+
+Fixes: ce6a5acc9387 ("mfd: rtsx: Add support for rts522A")
+Signed-off-by: YueHaibing <yuehaibing@huawei.com>
+Cc: stable <stable@vger.kernel.org>
+Link: https://lore.kernel.org/r/20200326032618.20472-1-yuehaibing@huawei.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/misc/cardreader/rts5227.c | 1 +
+ 1 file changed, 1 insertion(+)
+
+--- a/drivers/misc/cardreader/rts5227.c
++++ b/drivers/misc/cardreader/rts5227.c
+@@ -394,6 +394,7 @@ static const struct pcr_ops rts522a_pcr_
+ void rts522a_init_params(struct rtsx_pcr *pcr)
+ {
+ rts5227_init_params(pcr);
++ pcr->ops = &rts522a_pcr_ops;
+ pcr->tx_initial_phase = SET_CLOCK_PHASE(20, 20, 11);
+ pcr->reg_pm_ctrl3 = RTS522A_PM_CTRL3;
+
--- /dev/null
+From 3c91ef69a3e94f78546b246225ed573fbf1735b4 Mon Sep 17 00:00:00 2001
+From: Nicholas Johnson <nicholas.johnson-opensource@outlook.com.au>
+Date: Tue, 10 Mar 2020 13:22:52 +0000
+Subject: nvmem: check for NULL reg_read and reg_write before dereferencing
+
+From: Nicholas Johnson <nicholas.johnson-opensource@outlook.com.au>
+
+commit 3c91ef69a3e94f78546b246225ed573fbf1735b4 upstream.
+
+Return -EPERM if reg_read is NULL in bin_attr_nvmem_read() or if
+reg_write is NULL in bin_attr_nvmem_write().
+
+This prevents NULL dereferences such as the one described in
+03cd45d2e219 ("thunderbolt: Prevent crash if non-active NVMem file is
+read")
+
+Signed-off-by: Nicholas Johnson <nicholas.johnson-opensource@outlook.com.au>
+Cc: stable <stable@vger.kernel.org>
+Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
+Link: https://lore.kernel.org/r/20200310132257.23358-10-srinivas.kandagatla@linaro.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/nvmem/nvmem-sysfs.c | 6 ++++++
+ 1 file changed, 6 insertions(+)
+
+--- a/drivers/nvmem/nvmem-sysfs.c
++++ b/drivers/nvmem/nvmem-sysfs.c
+@@ -56,6 +56,9 @@ static ssize_t bin_attr_nvmem_read(struc
+
+ count = round_down(count, nvmem->word_size);
+
++ if (!nvmem->reg_read)
++ return -EPERM;
++
+ rc = nvmem->reg_read(nvmem->priv, pos, buf, count);
+
+ if (rc)
+@@ -90,6 +93,9 @@ static ssize_t bin_attr_nvmem_write(stru
+
+ count = round_down(count, nvmem->word_size);
+
++ if (!nvmem->reg_write)
++ return -EPERM;
++
+ rc = nvmem->reg_write(nvmem->priv, pos, buf, count);
+
+ if (rc)
--- /dev/null
+From c66ebde4d988b592e8f0008e04c47cc4950a49d3 Mon Sep 17 00:00:00 2001
+From: Freeman Liu <freeman.liu@unisoc.com>
+Date: Mon, 23 Mar 2020 15:00:03 +0000
+Subject: nvmem: sprd: Fix the block lock operation
+
+From: Freeman Liu <freeman.liu@unisoc.com>
+
+commit c66ebde4d988b592e8f0008e04c47cc4950a49d3 upstream.
+
+According to the Spreadtrum eFuse specification, we should write 0 to
+the block to trigger the lock operation.
+
+Fixes: 096030e7f449 ("nvmem: sprd: Add Spreadtrum SoCs eFuse support")
+Cc: stable <stable@vger.kernel.org>
+Signed-off-by: Freeman Liu <freeman.liu@unisoc.com>
+Signed-off-by: Baolin Wang <baolin.wang7@gmail.com>
+Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
+Link: https://lore.kernel.org/r/20200323150007.7487-2-srinivas.kandagatla@linaro.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/nvmem/sprd-efuse.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/drivers/nvmem/sprd-efuse.c
++++ b/drivers/nvmem/sprd-efuse.c
+@@ -239,7 +239,7 @@ static int sprd_efuse_raw_prog(struct sp
+ ret = -EBUSY;
+ } else {
+ sprd_efuse_set_prog_lock(efuse, lock);
+- writel(*data, efuse->base + SPRD_EFUSE_MEM(blk));
++ writel(0, efuse->base + SPRD_EFUSE_MEM(blk));
+ sprd_efuse_set_prog_lock(efuse, false);
+ }
+
--- /dev/null
+From bd641fd8303a371e789e924291086268256766b0 Mon Sep 17 00:00:00 2001
+From: Kelsey Skunberg <kelsey.skunberg@gmail.com>
+Date: Wed, 25 Mar 2020 09:17:08 -0600
+Subject: PCI: sysfs: Revert "rescan" file renames
+
+From: Kelsey Skunberg <kelsey.skunberg@gmail.com>
+
+commit bd641fd8303a371e789e924291086268256766b0 upstream.
+
+We changed these sysfs filenames:
+
+ .../pci_bus/<domain:bus>/rescan -> .../pci_bus/<domain:bus>/bus_rescan
+ .../<domain:bus:dev.fn>/rescan -> .../<domain:bus:dev.fn>/dev_rescan
+
+and Ruslan reported [1] that this broke a userspace application.
+
+Revert these name changes so both files are named "rescan" again.
+
+Note that we have to use __ATTR() to assign custom C symbols, i.e.,
+"struct device_attribute <symbol>".
+
+[1] https://lore.kernel.org/r/CAB=otbSYozS-ZfxB0nCiNnxcbqxwrHOSYxJJtDKa63KzXbXgpw@mail.gmail.com
+
+[bhelgaas: commit log, use __ATTR() both places so we don't have to rename
+the attributes]
+Fixes: 8bdfa145f582 ("PCI: sysfs: Define device attributes with DEVICE_ATTR*()")
+Fixes: 4e2b79436e4f ("PCI: sysfs: Change DEVICE_ATTR() to DEVICE_ATTR_WO()")
+Link: https://lore.kernel.org/r/20200325151708.32612-1-skunberg.kelsey@gmail.com
+Signed-off-by: Kelsey Skunberg <kelsey.skunberg@gmail.com>
+Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
+Reviewed-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+Cc: stable@vger.kernel.org # v5.4+
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/pci/pci-sysfs.c | 6 ++++--
+ 1 file changed, 4 insertions(+), 2 deletions(-)
+
+--- a/drivers/pci/pci-sysfs.c
++++ b/drivers/pci/pci-sysfs.c
+@@ -464,7 +464,8 @@ static ssize_t dev_rescan_store(struct d
+ }
+ return count;
+ }
+-static DEVICE_ATTR_WO(dev_rescan);
++static struct device_attribute dev_attr_dev_rescan = __ATTR(rescan, 0200, NULL,
++ dev_rescan_store);
+
+ static ssize_t remove_store(struct device *dev, struct device_attribute *attr,
+ const char *buf, size_t count)
+@@ -501,7 +502,8 @@ static ssize_t bus_rescan_store(struct d
+ }
+ return count;
+ }
+-static DEVICE_ATTR_WO(bus_rescan);
++static struct device_attribute dev_attr_bus_rescan = __ATTR(rescan, 0200, NULL,
++ bus_rescan_store);
+
+ #if defined(CONFIG_PM) && defined(CONFIG_ACPI)
+ static ssize_t d3cold_allowed_store(struct device *dev,
--- /dev/null
+From 9c80662a74cd2a5d1113f5c69d027face963a556 Mon Sep 17 00:00:00 2001
+From: Hans de Goede <hdegoede@redhat.com>
+Date: Sun, 23 Feb 2020 16:32:08 +0100
+Subject: power: supply: axp288_charger: Add special handling for HP Pavilion x2 10
+
+From: Hans de Goede <hdegoede@redhat.com>
+
+commit 9c80662a74cd2a5d1113f5c69d027face963a556 upstream.
+
+Some HP Pavilion x2 10 models use an AXP288 for charging and fuel-gauge.
+We use a native power_supply / PMIC driver in this case, because on most
+models with an AXP288 the ACPI AC / Battery code is either completely
+missing or relies on custom / proprietary ACPI OpRegions which Linux
+does not implement.
+
+The native drivers mostly work fine, but there are 2 problems:
+
+1. These model uses a Type-C connector for charging which the AXP288 does
+not support. As long as a Type-A charger (which uses the USB data pins for
+charger type detection) is used everything is fine. But if a Type-C
+charger is used (such as the charger shipped with the device) then the
+charger is not recognized.
+
+So we end up slowly discharging the device even though a charger is
+connected, because we are limiting the current from the charger to 500mA.
+To make things worse this happens with the device's official charger.
+
+Looking at the ACPI tables HP has "solved" the problem of the AXP288 not
+being able to recognize Type-C chargers by simply always programming the
+input-current-limit at 3000mA and relying on a Vhold setting of 4.7V
+(normally 4.4V) to limit the current intake if the charger cannot handle
+this.
+
+2. If no charger is connected when the machine boots then it boots with the
+vbus-path disabled. On other devices this is done when a 5V boost converter
+is active to avoid the PMIC trying to charge from the 5V boost output.
+This is done when an OTG host cable is inserted and the ID pin on the
+micro-B receptacle is pulled low, the ID pin has an ACPI event handler
+associated with it which re-enables the vbus-path when the ID pin is pulled
+high when the OTG cable is removed. The Type-C connector has no ID pin,
+there is no ID pin handler and there appears to be no 5V boost converter,
+so we end up not charging because the vbus-path is disabled, until we
+unplug the charger which automatically clears the vbus-path disable bit and
+then on the second plug-in of the adapter we start charging.
+
+The HP Pavilion x2 10 models with an AXP288 do have mostly working ACPI
+AC / Battery code which does not rely on custom / proprietary ACPI
+OpRegions. So one possible solution would be to blacklist the AXP288
+native power_supply drivers and add the HP Pavilion x2 10 with AXP288
+DMI ids to the list of devices which should use the ACPI AC / Battery
+code even though they have an AXP288 PMIC. This would require changes to
+4 files: drivers/acpi/ac.c, drivers/power/supply/axp288_charger.c,
+drivers/acpi/battery.c and drivers/power/supply/axp288_fuel_gauge.c.
+
+Beside needing adding the same DMI matches to 4 different files, this
+approach also triggers problem 2. from above, but then when suspended,
+during suspend the machine will not wakeup because the vbus path is
+disabled by the AML code when not charging, so the Vbus low-to-high
+IRQ is not triggered, the CPU never wakes up and the device does not
+charge even though the user likely things it is charging, esp. since
+the charge status LED is directly coupled to an adapter being plugged
+in and does not reflect actual charging.
+
+This could be worked by enabling vbus-path explicitly from say the
+axp288_charger driver's suspend handler.
+
+So neither situation is ideal, in both cased we need to explicitly enable
+the vbus-path to work around different variants of problem 2 above, this
+requires a quirk in the axp288_charger code.
+
+If we go the route of using the ACPI AC / Battery drivers then we need
+modifications to 3 other drivers; and we need to partially disable the
+axp288_charger code, while at the same time keeping it around to enable
+vbus-path on suspend.
+
+OTOH we can copy the hardcoding of 3A input-current-limit (we never touch
+Vhold, so that would stay at 4.7V) to the axp288_charger code, which needs
+changes regardless, then we concentrate all special handling of this
+interesting device model in the axp288_charger code. That is what this
+commit does.
+
+Cc: stable@vger.kernel.org
+BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1791098
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+
+---
+ drivers/power/supply/axp288_charger.c | 57 +++++++++++++++++++++++++++++++++-
+ 1 file changed, 56 insertions(+), 1 deletion(-)
+
+--- a/drivers/power/supply/axp288_charger.c
++++ b/drivers/power/supply/axp288_charger.c
+@@ -21,6 +21,7 @@
+ #include <linux/property.h>
+ #include <linux/mfd/axp20x.h>
+ #include <linux/extcon.h>
++#include <linux/dmi.h>
+
+ #define PS_STAT_VBUS_TRIGGER BIT(0)
+ #define PS_STAT_BAT_CHRG_DIR BIT(2)
+@@ -545,6 +546,49 @@ out:
+ return IRQ_HANDLED;
+ }
+
++/*
++ * The HP Pavilion x2 10 series comes in a number of variants:
++ * Bay Trail SoC + AXP288 PMIC, DMI_BOARD_NAME: "815D"
++ * Cherry Trail SoC + AXP288 PMIC, DMI_BOARD_NAME: "813E"
++ * Cherry Trail SoC + TI PMIC, DMI_BOARD_NAME: "827C" or "82F4"
++ *
++ * The variants with the AXP288 PMIC are all kinds of special:
++ *
++ * 1. All variants use a Type-C connector which the AXP288 does not support, so
++ * when using a Type-C charger it is not recognized. Unlike most AXP288 devices,
++ * this model actually has mostly working ACPI AC / Battery code, the ACPI code
++ * "solves" this by simply setting the input_current_limit to 3A.
++ * There are still some issues with the ACPI code, so we use this native driver,
++ * and to solve the charging not working (500mA is not enough) issue we hardcode
++ * the 3A input_current_limit like the ACPI code does.
++ *
++ * 2. If no charger is connected the machine boots with the vbus-path disabled.
++ * Normally this is done when a 5V boost converter is active to avoid the PMIC
++ * trying to charge from the 5V boost converter's output. This is done when
++ * an OTG host cable is inserted and the ID pin on the micro-B receptacle is
++ * pulled low and the ID pin has an ACPI event handler associated with it
++ * which re-enables the vbus-path when the ID pin is pulled high when the
++ * OTG host cable is removed. The Type-C connector has no ID pin, there is
++ * no ID pin handler and there appears to be no 5V boost converter, so we
++ * end up not charging because the vbus-path is disabled, until we unplug
++ * the charger which automatically clears the vbus-path disable bit and then
++ * on the second plug-in of the adapter we start charging. To solve the not
++ * charging on first charger plugin we unconditionally enable the vbus-path at
++ * probe on this model, which is safe since there is no 5V boost converter.
++ */
++static const struct dmi_system_id axp288_hp_x2_dmi_ids[] = {
++ {
++ /*
++ * Bay Trail model has "Hewlett-Packard" as sys_vendor, Cherry
++ * Trail model has "HP", so we only match on product_name.
++ */
++ .matches = {
++ DMI_MATCH(DMI_PRODUCT_NAME, "HP Pavilion x2 Detachable"),
++ },
++ },
++ {} /* Terminating entry */
++};
++
+ static void axp288_charger_extcon_evt_worker(struct work_struct *work)
+ {
+ struct axp288_chrg_info *info =
+@@ -568,7 +612,11 @@ static void axp288_charger_extcon_evt_wo
+ }
+
+ /* Determine cable/charger type */
+- if (extcon_get_state(edev, EXTCON_CHG_USB_SDP) > 0) {
++ if (dmi_check_system(axp288_hp_x2_dmi_ids)) {
++ /* See comment above axp288_hp_x2_dmi_ids declaration */
++ dev_dbg(&info->pdev->dev, "HP X2 with Type-C, setting inlmt to 3A\n");
++ current_limit = 3000000;
++ } else if (extcon_get_state(edev, EXTCON_CHG_USB_SDP) > 0) {
+ dev_dbg(&info->pdev->dev, "USB SDP charger is connected\n");
+ current_limit = 500000;
+ } else if (extcon_get_state(edev, EXTCON_CHG_USB_CDP) > 0) {
+@@ -685,6 +733,13 @@ static int charger_init_hw_regs(struct a
+ return ret;
+ }
+
++ if (dmi_check_system(axp288_hp_x2_dmi_ids)) {
++ /* See comment above axp288_hp_x2_dmi_ids declaration */
++ ret = axp288_charger_vbus_path_select(info, true);
++ if (ret < 0)
++ return ret;
++ }
++
+ /* Read current charge voltage and current limit */
+ ret = regmap_read(info->regmap, AXP20X_CHRG_CTRL1, &val);
+ if (ret < 0) {
brcmfmac-abort-and-release-host-after-error.patch
bpf-fix-tnum-constraints-for-32-bit-comparisons.patch
xarray-fix-xa_find_next-for-large-multi-index-entrie.patch
+misc-rtsx-set-correct-pcr_ops-for-rts522a.patch
+misc-pci_endpoint_test-fix-to-support-10-pci-endpoint-test-devices.patch
+misc-pci_endpoint_test-avoid-using-module-parameter-to-determine-irqtype.patch
+pci-sysfs-revert-rescan-file-renames.patch
+coresight-do-not-use-the-bit-macro-in-the-uapi-header.patch
+mei-me-add-cedar-fork-device-ids.patch
+nvmem-check-for-null-reg_read-and-reg_write-before-dereferencing.patch
+nvmem-sprd-fix-the-block-lock-operation.patch
+extcon-axp288-add-wakeup-support.patch
+power-supply-axp288_charger-add-special-handling-for-hp-pavilion-x2-10.patch