From: Sasha Levin Date: Wed, 10 Mar 2021 12:07:00 +0000 (-0500) Subject: Fixes for 4.19 X-Git-Tag: v4.4.261~3^2~3 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=f9f0fd8d61f30d3581a11b7d8f4306eeb1a30942;p=thirdparty%2Fkernel%2Fstable-queue.git Fixes for 4.19 Signed-off-by: Sasha Levin --- diff --git a/queue-4.19/asoc-intel-bytcr_rt5640-add-quirk-for-archos-cesium-.patch b/queue-4.19/asoc-intel-bytcr_rt5640-add-quirk-for-archos-cesium-.patch new file mode 100644 index 00000000000..9eb3e02957e --- /dev/null +++ b/queue-4.19/asoc-intel-bytcr_rt5640-add-quirk-for-archos-cesium-.patch @@ -0,0 +1,51 @@ +From cd248aa96c4f40395476b0644f31bce4923863e7 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 8 Dec 2020 14:04:14 +0800 +Subject: ASoC: Intel: bytcr_rt5640: Add quirk for ARCHOS Cesium 140 + +From: Chris Chiu + +[ Upstream commit 1bea2256aa96a2d7b1b576eb74e29d79edc9bea8 ] + +Tha ARCHOS Cesium 140 tablet has problem with the jack-sensing, +thus the heaset functions are not working. + +Add quirk for this model to select the correct input map, jack-detect +options and channel map to enable jack sensing and headset microphone. +This device uses IN1 for its internal MIC and JD2 for jack-detect. + +Signed-off-by: Chris Chiu +Acked-by: Pierre-Louis Bossart +Link: https://lore.kernel.org/r/20201208060414.27646-1-chiu@endlessos.org +Signed-off-by: Mark Brown +Signed-off-by: Sasha Levin +--- + sound/soc/intel/boards/bytcr_rt5640.c | 12 ++++++++++++ + 1 file changed, 12 insertions(+) + +diff --git a/sound/soc/intel/boards/bytcr_rt5640.c b/sound/soc/intel/boards/bytcr_rt5640.c +index 8a943de1e5b5..d63d99776384 100644 +--- a/sound/soc/intel/boards/bytcr_rt5640.c ++++ b/sound/soc/intel/boards/bytcr_rt5640.c +@@ -444,6 +444,18 @@ static const struct dmi_system_id byt_rt5640_quirk_table[] = { + BYT_RT5640_SSP0_AIF1 | + BYT_RT5640_MCLK_EN), + }, ++ { ++ .matches = { ++ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ARCHOS"), ++ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "ARCHOS 140 CESIUM"), ++ }, ++ .driver_data = (void *)(BYT_RT5640_IN1_MAP | ++ BYT_RT5640_JD_SRC_JD2_IN4N | ++ BYT_RT5640_OVCD_TH_2000UA | ++ BYT_RT5640_OVCD_SF_0P75 | ++ BYT_RT5640_SSP0_AIF1 | ++ BYT_RT5640_MCLK_EN), ++ }, + { + .matches = { + DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), +-- +2.30.1 + diff --git a/queue-4.19/drm-msm-a5xx-remove-overwriting-a5xx_pc_dbg_eco_cntl.patch b/queue-4.19/drm-msm-a5xx-remove-overwriting-a5xx_pc_dbg_eco_cntl.patch new file mode 100644 index 00000000000..d7b0caa8ebd --- /dev/null +++ b/queue-4.19/drm-msm-a5xx-remove-overwriting-a5xx_pc_dbg_eco_cntl.patch @@ -0,0 +1,46 @@ +From 8de658bc076bf331798b383aa3d00ae3834f78c0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 13 Jan 2021 19:33:33 +0100 +Subject: drm/msm/a5xx: Remove overwriting A5XX_PC_DBG_ECO_CNTL register + +From: AngeloGioacchino Del Regno + +[ Upstream commit 8f03c30cb814213e36032084a01f49a9e604a3e3 ] + +The PC_DBG_ECO_CNTL register on the Adreno A5xx family gets +programmed to some different values on a per-model basis. +At least, this is what we intend to do here; + +Unfortunately, though, this register is being overwritten with a +static magic number, right after applying the GPU-specific +configuration (including the GPU-specific quirks) and that is +effectively nullifying the efforts. + +Let's remove the redundant and wrong write to the PC_DBG_ECO_CNTL +register in order to retain the wanted configuration for the +target GPU. + +Signed-off-by: AngeloGioacchino Del Regno +Reviewed-by: Jordan Crouse +Signed-off-by: Rob Clark +Signed-off-by: Sasha Levin +--- + drivers/gpu/drm/msm/adreno/a5xx_gpu.c | 2 -- + 1 file changed, 2 deletions(-) + +diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c +index d29a58bd2f7a..776bbe9775e9 100644 +--- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c ++++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c +@@ -681,8 +681,6 @@ static int a5xx_hw_init(struct msm_gpu *gpu) + if (adreno_gpu->info->quirks & ADRENO_QUIRK_TWO_PASS_USE_WFI) + gpu_rmw(gpu, REG_A5XX_PC_DBG_ECO_CNTL, 0, (1 << 8)); + +- gpu_write(gpu, REG_A5XX_PC_DBG_ECO_CNTL, 0xc0200100); +- + /* Enable USE_RETENTION_FLOPS */ + gpu_write(gpu, REG_A5XX_CP_CHICKEN_DBG, 0x02000000); + +-- +2.30.1 + diff --git a/queue-4.19/hid-mf-add-support-for-0079-1846-mayflash-dragonrise.patch b/queue-4.19/hid-mf-add-support-for-0079-1846-mayflash-dragonrise.patch new file mode 100644 index 00000000000..e3ece0fe4fc --- /dev/null +++ b/queue-4.19/hid-mf-add-support-for-0079-1846-mayflash-dragonrise.patch @@ -0,0 +1,76 @@ +From 20f6d744cabbb156e2fb0965e52dd6fe1e9e2281 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 17 Nov 2020 09:48:00 +0100 +Subject: HID: mf: add support for 0079:1846 Mayflash/Dragonrise USB Gamecube + Adapter + +From: Ethan Warth + +[ Upstream commit 1008230f2abeb624f6d71b2e1c424fa4eeebbf84 ] + +Mayflash/Dragonrise seems to have yet another device ID for one of their +Gamecube controller adapters. Previous to this commit, the adapter +registered only one /dev/input/js* device, and all controller inputs (from +any controller) were mapped to this device. This patch defines the 1846 +USB device ID and enables the HID_QUIRK_MULTI_INPUT quirk for it, which +fixes that (with the patch, four /dev/input/js* devices are created, one +for each of the four controller ports). + +Signed-off-by: Ethan Warth +Tested-by: Wladimir J. van der Laan +Signed-off-by: Jiri Kosina +Signed-off-by: Sasha Levin +--- + drivers/hid/hid-ids.h | 1 + + drivers/hid/hid-mf.c | 2 ++ + drivers/hid/hid-quirks.c | 2 ++ + 3 files changed, 5 insertions(+) + +diff --git a/drivers/hid/hid-ids.h b/drivers/hid/hid-ids.h +index ab2be7a115d8..2f1516b32837 100644 +--- a/drivers/hid/hid-ids.h ++++ b/drivers/hid/hid-ids.h +@@ -358,6 +358,7 @@ + #define USB_DEVICE_ID_DRAGONRISE_DOLPHINBAR 0x1803 + #define USB_DEVICE_ID_DRAGONRISE_GAMECUBE1 0x1843 + #define USB_DEVICE_ID_DRAGONRISE_GAMECUBE2 0x1844 ++#define USB_DEVICE_ID_DRAGONRISE_GAMECUBE3 0x1846 + + #define USB_VENDOR_ID_DWAV 0x0eef + #define USB_DEVICE_ID_EGALAX_TOUCHCONTROLLER 0x0001 +diff --git a/drivers/hid/hid-mf.c b/drivers/hid/hid-mf.c +index 03f10516131d..a41202d38509 100644 +--- a/drivers/hid/hid-mf.c ++++ b/drivers/hid/hid-mf.c +@@ -161,6 +161,8 @@ static const struct hid_device_id mf_devices[] = { + .driver_data = HID_QUIRK_MULTI_INPUT }, + { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_GAMECUBE2), + .driver_data = 0 }, /* No quirk required */ ++ { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_GAMECUBE3), ++ .driver_data = HID_QUIRK_MULTI_INPUT }, + { } + }; + MODULE_DEVICE_TABLE(hid, mf_devices); +diff --git a/drivers/hid/hid-quirks.c b/drivers/hid/hid-quirks.c +index 10cb42a00fe8..8fbe7b9cd84a 100644 +--- a/drivers/hid/hid-quirks.c ++++ b/drivers/hid/hid-quirks.c +@@ -74,6 +74,7 @@ static const struct hid_device_id hid_quirks[] = { + { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_REDRAGON_SEYMUR2), HID_QUIRK_INCREMENT_USAGE_ON_DUPLICATE }, + { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_DOLPHINBAR), HID_QUIRK_MULTI_INPUT }, + { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_GAMECUBE1), HID_QUIRK_MULTI_INPUT }, ++ { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_GAMECUBE3), HID_QUIRK_MULTI_INPUT }, + { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_PS3), HID_QUIRK_MULTI_INPUT }, + { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_WIIU), HID_QUIRK_MULTI_INPUT }, + { HID_USB_DEVICE(USB_VENDOR_ID_DWAV, USB_DEVICE_ID_EGALAX_TOUCHCONTROLLER), HID_QUIRK_MULTI_INPUT | HID_QUIRK_NOGET }, +@@ -498,6 +499,7 @@ static const struct hid_device_id hid_have_special_driver[] = { + { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_DOLPHINBAR) }, + { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_GAMECUBE1) }, + { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_GAMECUBE2) }, ++ { HID_USB_DEVICE(USB_VENDOR_ID_DRAGONRISE, USB_DEVICE_ID_DRAGONRISE_GAMECUBE3) }, + #endif + #if IS_ENABLED(CONFIG_HID_MICROSOFT) + { HID_USB_DEVICE(USB_VENDOR_ID_MICROSOFT, USB_DEVICE_ID_MS_COMFORT_MOUSE_4500) }, +-- +2.30.1 + diff --git a/queue-4.19/media-cx23885-add-more-quirks-for-reset-dma-on-some-.patch b/queue-4.19/media-cx23885-add-more-quirks-for-reset-dma-on-some-.patch new file mode 100644 index 00000000000..7245e3c14a3 --- /dev/null +++ b/queue-4.19/media-cx23885-add-more-quirks-for-reset-dma-on-some-.patch @@ -0,0 +1,46 @@ +From 57b7beb4f40cb4486fb5609a482b0b0684607421 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 30 Sep 2020 05:36:35 +0200 +Subject: media: cx23885: add more quirks for reset DMA on some AMD IOMMU + +From: Daniel Lee Kruse + +[ Upstream commit dbf0b3a7b719eb3f72cb53c2ce7d34a012a9c261 ] + +On AMD Family 15h (Models 30h-3fh), I/O Memory Management Unit +RiSC engine sometimes stalls, requiring a reset. + +As result, MythTV and w-scan won't scan channels on the AMD Kaveri +APU with the Hauppauge QuadHD TV tuner card. + +For the solution I added the Input/Output Memory Management Unit's PCI +Identity of 0x1423 to the broken_dev_id[] array, which is used by +a quirks logic meant to fix similar problems with other AMD +chipsets. + +Signed-off-by: Daniel Lee Kruse +Signed-off-by: Hans Verkuil +Signed-off-by: Mauro Carvalho Chehab +Signed-off-by: Sasha Levin +--- + drivers/media/pci/cx23885/cx23885-core.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/drivers/media/pci/cx23885/cx23885-core.c b/drivers/media/pci/cx23885/cx23885-core.c +index fd5c52b21436..a1d738969d7b 100644 +--- a/drivers/media/pci/cx23885/cx23885-core.c ++++ b/drivers/media/pci/cx23885/cx23885-core.c +@@ -2084,6 +2084,10 @@ static struct { + * 0x1451 is PCI ID for the IOMMU found on Ryzen + */ + { PCI_VENDOR_ID_AMD, 0x1451 }, ++ /* According to sudo lspci -nn, ++ * 0x1423 is the PCI ID for the IOMMU found on Kaveri ++ */ ++ { PCI_VENDOR_ID_AMD, 0x1423 }, + }; + + static bool cx23885_does_need_dma_reset(void) +-- +2.30.1 + diff --git a/queue-4.19/misc-eeprom_93xx46-add-quirk-to-support-microchip-93.patch b/queue-4.19/misc-eeprom_93xx46-add-quirk-to-support-microchip-93.patch new file mode 100644 index 00000000000..1dd7d8f05ee --- /dev/null +++ b/queue-4.19/misc-eeprom_93xx46-add-quirk-to-support-microchip-93.patch @@ -0,0 +1,91 @@ +From 6425d82bd743db9d3aff349c6b7ff682f5141316 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 5 Jan 2021 16:28:12 +0530 +Subject: misc: eeprom_93xx46: Add quirk to support Microchip 93LC46B eeprom + +From: Aswath Govindraju + +[ Upstream commit f6f1f8e6e3eea25f539105d48166e91f0ab46dd1 ] + +A dummy zero bit is sent preceding the data during a read transfer by the +Microchip 93LC46B eeprom (section 2.7 of[1]). This results in right shift +of data during a read. In order to ignore this bit a quirk can be added to +send an extra zero bit after the read address. + +Add a quirk to ignore the zero bit sent before data by adding a zero bit +after the read address. + +[1] - https://www.mouser.com/datasheet/2/268/20001749K-277859.pdf + +Signed-off-by: Aswath Govindraju +Link: https://lore.kernel.org/r/20210105105817.17644-3-a-govindraju@ti.com +Signed-off-by: Greg Kroah-Hartman +Signed-off-by: Sasha Levin +--- + drivers/misc/eeprom/eeprom_93xx46.c | 15 +++++++++++++++ + include/linux/eeprom_93xx46.h | 2 ++ + 2 files changed, 17 insertions(+) + +diff --git a/drivers/misc/eeprom/eeprom_93xx46.c b/drivers/misc/eeprom/eeprom_93xx46.c +index a3248ebd28c6..182feab6da25 100644 +--- a/drivers/misc/eeprom/eeprom_93xx46.c ++++ b/drivers/misc/eeprom/eeprom_93xx46.c +@@ -38,6 +38,10 @@ static const struct eeprom_93xx46_devtype_data atmel_at93c46d_data = { + EEPROM_93XX46_QUIRK_INSTRUCTION_LENGTH, + }; + ++static const struct eeprom_93xx46_devtype_data microchip_93lc46b_data = { ++ .quirks = EEPROM_93XX46_QUIRK_EXTRA_READ_CYCLE, ++}; ++ + struct eeprom_93xx46_dev { + struct spi_device *spi; + struct eeprom_93xx46_platform_data *pdata; +@@ -58,6 +62,11 @@ static inline bool has_quirk_instruction_length(struct eeprom_93xx46_dev *edev) + return edev->pdata->quirks & EEPROM_93XX46_QUIRK_INSTRUCTION_LENGTH; + } + ++static inline bool has_quirk_extra_read_cycle(struct eeprom_93xx46_dev *edev) ++{ ++ return edev->pdata->quirks & EEPROM_93XX46_QUIRK_EXTRA_READ_CYCLE; ++} ++ + static int eeprom_93xx46_read(void *priv, unsigned int off, + void *val, size_t count) + { +@@ -99,6 +108,11 @@ static int eeprom_93xx46_read(void *priv, unsigned int off, + dev_dbg(&edev->spi->dev, "read cmd 0x%x, %d Hz\n", + cmd_addr, edev->spi->max_speed_hz); + ++ if (has_quirk_extra_read_cycle(edev)) { ++ cmd_addr <<= 1; ++ bits += 1; ++ } ++ + spi_message_init(&m); + + t[0].tx_buf = (char *)&cmd_addr; +@@ -366,6 +380,7 @@ static void select_deassert(void *context) + static const struct of_device_id eeprom_93xx46_of_table[] = { + { .compatible = "eeprom-93xx46", }, + { .compatible = "atmel,at93c46d", .data = &atmel_at93c46d_data, }, ++ { .compatible = "microchip,93lc46b", .data = µchip_93lc46b_data, }, + {} + }; + MODULE_DEVICE_TABLE(of, eeprom_93xx46_of_table); +diff --git a/include/linux/eeprom_93xx46.h b/include/linux/eeprom_93xx46.h +index eec7928ff8fe..99580c22f91a 100644 +--- a/include/linux/eeprom_93xx46.h ++++ b/include/linux/eeprom_93xx46.h +@@ -16,6 +16,8 @@ struct eeprom_93xx46_platform_data { + #define EEPROM_93XX46_QUIRK_SINGLE_WORD_READ (1 << 0) + /* Instructions such as EWEN are (addrlen + 2) in length. */ + #define EEPROM_93XX46_QUIRK_INSTRUCTION_LENGTH (1 << 1) ++/* Add extra cycle after address during a read */ ++#define EEPROM_93XX46_QUIRK_EXTRA_READ_CYCLE BIT(2) + + /* + * optional hooks to control additional logic +-- +2.30.1 + diff --git a/queue-4.19/mmc-sdhci-of-dwcmshc-set-sdhci_quirk2_preset_value_b.patch b/queue-4.19/mmc-sdhci-of-dwcmshc-set-sdhci_quirk2_preset_value_b.patch new file mode 100644 index 00000000000..d77346f17cb --- /dev/null +++ b/queue-4.19/mmc-sdhci-of-dwcmshc-set-sdhci_quirk2_preset_value_b.patch @@ -0,0 +1,35 @@ +From 183216e70d97ea6982e7d15e45868a5b51dca9e9 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Thu, 10 Dec 2020 16:55:10 +0800 +Subject: mmc: sdhci-of-dwcmshc: set SDHCI_QUIRK2_PRESET_VALUE_BROKEN + +From: Jisheng Zhang + +[ Upstream commit 5f7dfda4f2cec580c135fd81d96a05006651c128 ] + +The SDHCI_PRESET_FOR_* registers are not set(all read as zeros), so +set the quirk. + +Signed-off-by: Jisheng Zhang +Link: https://lore.kernel.org/r/20201210165510.76b917e5@xhacker.debian +Signed-off-by: Ulf Hansson +Signed-off-by: Sasha Levin +--- + drivers/mmc/host/sdhci-of-dwcmshc.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/drivers/mmc/host/sdhci-of-dwcmshc.c b/drivers/mmc/host/sdhci-of-dwcmshc.c +index 1b7cd144fb01..a34b17b284a5 100644 +--- a/drivers/mmc/host/sdhci-of-dwcmshc.c ++++ b/drivers/mmc/host/sdhci-of-dwcmshc.c +@@ -28,6 +28,7 @@ static const struct sdhci_ops sdhci_dwcmshc_ops = { + static const struct sdhci_pltfm_data sdhci_dwcmshc_pdata = { + .ops = &sdhci_dwcmshc_ops, + .quirks = SDHCI_QUIRK_CAP_CLOCK_BASE_BROKEN, ++ .quirks2 = SDHCI_QUIRK2_PRESET_VALUE_BROKEN, + }; + + static int dwcmshc_probe(struct platform_device *pdev) +-- +2.30.1 + diff --git a/queue-4.19/mwifiex-pcie-skip-cancel_work_sync-on-reset-failure-.patch b/queue-4.19/mwifiex-pcie-skip-cancel_work_sync-on-reset-failure-.patch new file mode 100644 index 00000000000..352f333e0be --- /dev/null +++ b/queue-4.19/mwifiex-pcie-skip-cancel_work_sync-on-reset-failure-.patch @@ -0,0 +1,170 @@ +From ab0413bacb15d76d34b3ac80a79e3ad331a8e1dd Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Wed, 28 Oct 2020 23:23:46 +0900 +Subject: mwifiex: pcie: skip cancel_work_sync() on reset failure path + +From: Tsuchiya Yuto + +[ Upstream commit 4add4d988f95f47493500a7a19c623827061589b ] + +If a reset is performed, but even the reset fails for some reasons (e.g., +on Surface devices, the fw reset requires another quirks), +cancel_work_sync() hangs in mwifiex_cleanup_pcie(). + + # firmware went into a bad state + [...] + [ 1608.281690] mwifiex_pcie 0000:03:00.0: info: shutdown mwifiex... + [ 1608.282724] mwifiex_pcie 0000:03:00.0: rx_pending=0, tx_pending=1, cmd_pending=0 + [ 1608.292400] mwifiex_pcie 0000:03:00.0: PREP_CMD: card is removed + [ 1608.292405] mwifiex_pcie 0000:03:00.0: PREP_CMD: card is removed + # reset performed after firmware went into a bad state + [ 1609.394320] mwifiex_pcie 0000:03:00.0: WLAN FW already running! Skip FW dnld + [ 1609.394335] mwifiex_pcie 0000:03:00.0: WLAN FW is active + # but even the reset failed + [ 1619.499049] mwifiex_pcie 0000:03:00.0: mwifiex_cmd_timeout_func: Timeout cmd id = 0xfa, act = 0xe000 + [ 1619.499094] mwifiex_pcie 0000:03:00.0: num_data_h2c_failure = 0 + [ 1619.499103] mwifiex_pcie 0000:03:00.0: num_cmd_h2c_failure = 0 + [ 1619.499110] mwifiex_pcie 0000:03:00.0: is_cmd_timedout = 1 + [ 1619.499117] mwifiex_pcie 0000:03:00.0: num_tx_timeout = 0 + [ 1619.499124] mwifiex_pcie 0000:03:00.0: last_cmd_index = 0 + [ 1619.499133] mwifiex_pcie 0000:03:00.0: last_cmd_id: fa 00 07 01 07 01 07 01 07 01 + [ 1619.499140] mwifiex_pcie 0000:03:00.0: last_cmd_act: 00 e0 00 00 00 00 00 00 00 00 + [ 1619.499147] mwifiex_pcie 0000:03:00.0: last_cmd_resp_index = 3 + [ 1619.499155] mwifiex_pcie 0000:03:00.0: last_cmd_resp_id: 07 81 07 81 07 81 07 81 07 81 + [ 1619.499162] mwifiex_pcie 0000:03:00.0: last_event_index = 2 + [ 1619.499169] mwifiex_pcie 0000:03:00.0: last_event: 58 00 58 00 58 00 58 00 58 00 + [ 1619.499177] mwifiex_pcie 0000:03:00.0: data_sent=0 cmd_sent=1 + [ 1619.499185] mwifiex_pcie 0000:03:00.0: ps_mode=0 ps_state=0 + [ 1619.499215] mwifiex_pcie 0000:03:00.0: info: _mwifiex_fw_dpc: unregister device + # mwifiex_pcie_work hang happening + [ 1823.233923] INFO: task kworker/3:1:44 blocked for more than 122 seconds. + [ 1823.233932] Tainted: G WC OE 5.10.0-rc1-1-mainline #1 + [ 1823.233935] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. + [ 1823.233940] task:kworker/3:1 state:D stack: 0 pid: 44 ppid: 2 flags:0x00004000 + [ 1823.233960] Workqueue: events mwifiex_pcie_work [mwifiex_pcie] + [ 1823.233965] Call Trace: + [ 1823.233981] __schedule+0x292/0x820 + [ 1823.233990] schedule+0x45/0xe0 + [ 1823.233995] schedule_timeout+0x11c/0x160 + [ 1823.234003] wait_for_completion+0x9e/0x100 + [ 1823.234012] __flush_work.isra.0+0x156/0x210 + [ 1823.234018] ? flush_workqueue_prep_pwqs+0x130/0x130 + [ 1823.234026] __cancel_work_timer+0x11e/0x1a0 + [ 1823.234035] mwifiex_cleanup_pcie+0x28/0xd0 [mwifiex_pcie] + [ 1823.234049] mwifiex_free_adapter+0x24/0xe0 [mwifiex] + [ 1823.234060] _mwifiex_fw_dpc+0x294/0x560 [mwifiex] + [ 1823.234074] mwifiex_reinit_sw+0x15d/0x300 [mwifiex] + [ 1823.234080] mwifiex_pcie_reset_done+0x50/0x80 [mwifiex_pcie] + [ 1823.234087] pci_try_reset_function+0x5c/0x90 + [ 1823.234094] process_one_work+0x1d6/0x3a0 + [ 1823.234100] worker_thread+0x4d/0x3d0 + [ 1823.234107] ? rescuer_thread+0x410/0x410 + [ 1823.234112] kthread+0x142/0x160 + [ 1823.234117] ? __kthread_bind_mask+0x60/0x60 + [ 1823.234124] ret_from_fork+0x22/0x30 + [...] + +This is a deadlock caused by calling cancel_work_sync() in +mwifiex_cleanup_pcie(): + +- Device resets are done via mwifiex_pcie_card_reset() +- which schedules card->work to call mwifiex_pcie_card_reset_work() +- which calls pci_try_reset_function(). +- This leads to mwifiex_pcie_reset_done() be called on the same workqueue, + which in turn calls +- mwifiex_reinit_sw() and that calls +- _mwifiex_fw_dpc(). + +The problem is now that _mwifiex_fw_dpc() calls mwifiex_free_adapter() +in case firmware initialization fails. That ends up calling +mwifiex_cleanup_pcie(). + +Note that all those calls are still running on the workqueue. So when +mwifiex_cleanup_pcie() now calls cancel_work_sync(), it's really waiting +on itself to complete, causing a deadlock. + +This commit fixes the deadlock by skipping cancel_work_sync() on a reset +failure path. + +After this commit, when reset fails, the following output is +expected to be shown: + + kernel: mwifiex_pcie 0000:03:00.0: info: _mwifiex_fw_dpc: unregister device + kernel: mwifiex: Failed to bring up adapter: -5 + kernel: mwifiex_pcie 0000:03:00.0: reinit failed: -5 + +To reproduce this issue, for example, try putting the root port of wifi +into D3 (replace "00:1d.3" with your setup). + + # put into D3 (root port) + sudo setpci -v -s 00:1d.3 CAP_PM+4.b=0b + +Cc: Maximilian Luz +Signed-off-by: Tsuchiya Yuto +Signed-off-by: Kalle Valo +Link: https://lore.kernel.org/r/20201028142346.18355-1-kitakar@gmail.com +Signed-off-by: Sasha Levin +--- + drivers/net/wireless/marvell/mwifiex/pcie.c | 18 +++++++++++++++++- + drivers/net/wireless/marvell/mwifiex/pcie.h | 2 ++ + 2 files changed, 19 insertions(+), 1 deletion(-) + +diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.c b/drivers/net/wireless/marvell/mwifiex/pcie.c +index 991b9cc18000..5907b34037c2 100644 +--- a/drivers/net/wireless/marvell/mwifiex/pcie.c ++++ b/drivers/net/wireless/marvell/mwifiex/pcie.c +@@ -381,6 +381,8 @@ static void mwifiex_pcie_reset_prepare(struct pci_dev *pdev) + clear_bit(MWIFIEX_IFACE_WORK_DEVICE_DUMP, &card->work_flags); + clear_bit(MWIFIEX_IFACE_WORK_CARD_RESET, &card->work_flags); + mwifiex_dbg(adapter, INFO, "%s, successful\n", __func__); ++ ++ card->pci_reset_ongoing = true; + } + + /* +@@ -409,6 +411,8 @@ static void mwifiex_pcie_reset_done(struct pci_dev *pdev) + dev_err(&pdev->dev, "reinit failed: %d\n", ret); + else + mwifiex_dbg(adapter, INFO, "%s, successful\n", __func__); ++ ++ card->pci_reset_ongoing = false; + } + + static const struct pci_error_handlers mwifiex_pcie_err_handler = { +@@ -3000,7 +3004,19 @@ static void mwifiex_cleanup_pcie(struct mwifiex_adapter *adapter) + int ret; + u32 fw_status; + +- cancel_work_sync(&card->work); ++ /* Perform the cancel_work_sync() only when we're not resetting ++ * the card. It's because that function never returns if we're ++ * in reset path. If we're here when resetting the card, it means ++ * that we failed to reset the card (reset failure path). ++ */ ++ if (!card->pci_reset_ongoing) { ++ mwifiex_dbg(adapter, MSG, "performing cancel_work_sync()...\n"); ++ cancel_work_sync(&card->work); ++ mwifiex_dbg(adapter, MSG, "cancel_work_sync() done\n"); ++ } else { ++ mwifiex_dbg(adapter, MSG, ++ "skipped cancel_work_sync() because we're in card reset failure path\n"); ++ } + + ret = mwifiex_read_reg(adapter, reg->fw_status, &fw_status); + if (fw_status == FIRMWARE_READY_PCIE) { +diff --git a/drivers/net/wireless/marvell/mwifiex/pcie.h b/drivers/net/wireless/marvell/mwifiex/pcie.h +index f7ce9b6db6b4..72d0c01ff359 100644 +--- a/drivers/net/wireless/marvell/mwifiex/pcie.h ++++ b/drivers/net/wireless/marvell/mwifiex/pcie.h +@@ -391,6 +391,8 @@ struct pcie_service_card { + struct mwifiex_msix_context share_irq_ctx; + struct work_struct work; + unsigned long work_flags; ++ ++ bool pci_reset_ongoing; + }; + + static inline int +-- +2.30.1 + diff --git a/queue-4.19/pci-add-function-1-dma-alias-quirk-for-marvell-9215-.patch b/queue-4.19/pci-add-function-1-dma-alias-quirk-for-marvell-9215-.patch new file mode 100644 index 00000000000..0e5466fb369 --- /dev/null +++ b/queue-4.19/pci-add-function-1-dma-alias-quirk-for-marvell-9215-.patch @@ -0,0 +1,37 @@ +From 18f1982283e7f0ffa510f21bb6e1e35d499bcef3 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Tue, 10 Nov 2020 16:00:57 -0600 +Subject: PCI: Add function 1 DMA alias quirk for Marvell 9215 SATA controller + +From: Bjorn Helgaas + +[ Upstream commit 059983790a4c963d92943e55a61fca55be427d55 ] + +Add function 1 DMA alias quirk for Marvell 88SS9215 PCIe SSD Controller. + +Link: https://bugzilla.kernel.org/show_bug.cgi?id=42679#c135 +Link: https://lore.kernel.org/r/20201110220516.697934-1-helgaas@kernel.org +Reported-by: John Smith +Signed-off-by: Bjorn Helgaas +Signed-off-by: Sasha Levin +--- + drivers/pci/quirks.c | 3 +++ + 1 file changed, 3 insertions(+) + +diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c +index af2149632102..70f05595da60 100644 +--- a/drivers/pci/quirks.c ++++ b/drivers/pci/quirks.c +@@ -3961,6 +3961,9 @@ DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9183, + /* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c46 */ + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x91a0, + quirk_dma_func1_alias); ++/* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c135 */ ++DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9215, ++ quirk_dma_func1_alias); + /* https://bugzilla.kernel.org/show_bug.cgi?id=42679#c127 */ + DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MARVELL_EXT, 0x9220, + quirk_dma_func1_alias); +-- +2.30.1 + diff --git a/queue-4.19/platform-x86-acer-wmi-add-acer_cap_kbd_dock-quirk-fo.patch b/queue-4.19/platform-x86-acer-wmi-add-acer_cap_kbd_dock-quirk-fo.patch new file mode 100644 index 00000000000..7c5d94244b4 --- /dev/null +++ b/queue-4.19/platform-x86-acer-wmi-add-acer_cap_kbd_dock-quirk-fo.patch @@ -0,0 +1,43 @@ +From 83e37a2b51d0fcda93eba9e3e9ec8c2aa5b28fd0 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 23 Nov 2020 16:16:25 +0100 +Subject: platform/x86: acer-wmi: Add ACER_CAP_KBD_DOCK quirk for the Aspire + Switch 10E SW3-016 + +From: Hans de Goede + +[ Upstream commit bf753400280d1384abb783efc0b42c491d6deec3 ] + +Add the Acer Aspire Switch 10E SW3-016 to the list of models which use the +Acer Switch WMI interface for reporting SW_TABLET_MODE. + +Signed-off-by: Hans de Goede +Link: https://lore.kernel.org/r/20201123151625.5530-1-hdegoede@redhat.com +Signed-off-by: Sasha Levin +--- + drivers/platform/x86/acer-wmi.c | 9 +++++++++ + 1 file changed, 9 insertions(+) + +diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c +index b22df329e97b..bd25c8a156d2 100644 +--- a/drivers/platform/x86/acer-wmi.c ++++ b/drivers/platform/x86/acer-wmi.c +@@ -525,6 +525,15 @@ static const struct dmi_system_id acer_quirks[] __initconst = { + }, + .driver_data = &quirk_acer_travelmate_2490, + }, ++ { ++ .callback = set_force_caps, ++ .ident = "Acer Aspire Switch 10E SW3-016", ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "Acer"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "Aspire SW3-016"), ++ }, ++ .driver_data = (void *)ACER_CAP_KBD_DOCK, ++ }, + { + .callback = set_force_caps, + .ident = "Acer Aspire Switch 10 SW5-012", +-- +2.30.1 + diff --git a/queue-4.19/platform-x86-acer-wmi-add-acer_cap_set_function_mode.patch b/queue-4.19/platform-x86-acer-wmi-add-acer_cap_set_function_mode.patch new file mode 100644 index 00000000000..43ef2b43014 --- /dev/null +++ b/queue-4.19/platform-x86-acer-wmi-add-acer_cap_set_function_mode.patch @@ -0,0 +1,58 @@ +From c08e4000efdf7c1b497a403439bc43ec7aa0bfec Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 19 Oct 2020 20:56:27 +0200 +Subject: platform/x86: acer-wmi: Add ACER_CAP_SET_FUNCTION_MODE capability + flag + +From: Hans de Goede + +[ Upstream commit 82cb8a5c395ea5be20e0fe31a8fe84380a502ca5 ] + +Not all devices supporting WMID_GUID3 support the wmid3_set_function_mode() +call, leading to errors like these: + +[ 60.138358] acer_wmi: Enabling RF Button failed: 0x1 - 0xff +[ 60.140036] acer_wmi: Enabling Launch Manager failed: 0x1 - 0xff + +Add an ACER_CAP_SET_FUNCTION_MODE capability flag, so that these calls +can be disabled through the new force_caps mechanism. + +Reviewed-by: Andy Shevchenko +Signed-off-by: Hans de Goede +Link: https://lore.kernel.org/r/20201019185628.264473-5-hdegoede@redhat.com +Signed-off-by: Sasha Levin +--- + drivers/platform/x86/acer-wmi.c | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c +index 2e77ac458bab..657fd8c49597 100644 +--- a/drivers/platform/x86/acer-wmi.c ++++ b/drivers/platform/x86/acer-wmi.c +@@ -224,6 +224,7 @@ struct hotkey_function_type_aa { + #define ACER_CAP_BLUETOOTH BIT(2) + #define ACER_CAP_BRIGHTNESS BIT(3) + #define ACER_CAP_THREEG BIT(4) ++#define ACER_CAP_SET_FUNCTION_MODE BIT(5) + + /* + * Interface type flags +@@ -2261,10 +2262,14 @@ static int __init acer_wmi_init(void) + if (acpi_video_get_backlight_type() != acpi_backlight_vendor) + interface->capability &= ~ACER_CAP_BRIGHTNESS; + ++ if (wmi_has_guid(WMID_GUID3)) ++ interface->capability |= ACER_CAP_SET_FUNCTION_MODE; ++ + if (force_caps != -1) + interface->capability = force_caps; + +- if (wmi_has_guid(WMID_GUID3)) { ++ if (wmi_has_guid(WMID_GUID3) && ++ (interface->capability & ACER_CAP_SET_FUNCTION_MODE)) { + if (ACPI_FAILURE(acer_wmi_enable_rf_button())) + pr_warn("Cannot enable RF Button Driver\n"); + +-- +2.30.1 + diff --git a/queue-4.19/platform-x86-acer-wmi-add-new-force_caps-module-para.patch b/queue-4.19/platform-x86-acer-wmi-add-new-force_caps-module-para.patch new file mode 100644 index 00000000000..9d6ecdfa003 --- /dev/null +++ b/queue-4.19/platform-x86-acer-wmi-add-new-force_caps-module-para.patch @@ -0,0 +1,78 @@ +From 0576c266372550b3551d28f798028e6f54691cfb Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 19 Oct 2020 20:56:26 +0200 +Subject: platform/x86: acer-wmi: Add new force_caps module parameter + +From: Hans de Goede + +[ Upstream commit 39aa009bb66f9d5fbd1e58ca4aa03d6e6f2c9915 ] + +Add a new force_caps module parameter to allow overriding the drivers +builtin capability detection mechanism. + +This can be used to for example: +-Disable rfkill functionality on devices where there is an AA OEM DMI + record advertising non functional rfkill switches +-Force loading of the driver on devices with a missing AA OEM DMI record + +Note that force_caps is -1 when unset, this allows forcing the +capability field to 0, which results in acer-wmi only providing WMI +hotkey handling while disabling all other (led, rfkill, backlight) +functionality. + +Reviewed-by: Andy Shevchenko +Signed-off-by: Hans de Goede +Link: https://lore.kernel.org/r/20201019185628.264473-4-hdegoede@redhat.com +Signed-off-by: Sasha Levin +--- + drivers/platform/x86/acer-wmi.c | 8 +++++++- + 1 file changed, 7 insertions(+), 1 deletion(-) + +diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c +index b95dce2475ab..2e77ac458bab 100644 +--- a/drivers/platform/x86/acer-wmi.c ++++ b/drivers/platform/x86/acer-wmi.c +@@ -246,6 +246,7 @@ static int mailled = -1; + static int brightness = -1; + static int threeg = -1; + static int force_series; ++static int force_caps = -1; + static bool ec_raw_mode; + static bool has_type_aa; + static u16 commun_func_bitmap; +@@ -255,11 +256,13 @@ module_param(mailled, int, 0444); + module_param(brightness, int, 0444); + module_param(threeg, int, 0444); + module_param(force_series, int, 0444); ++module_param(force_caps, int, 0444); + module_param(ec_raw_mode, bool, 0444); + MODULE_PARM_DESC(mailled, "Set initial state of Mail LED"); + MODULE_PARM_DESC(brightness, "Set initial LCD backlight brightness"); + MODULE_PARM_DESC(threeg, "Set initial state of 3G hardware"); + MODULE_PARM_DESC(force_series, "Force a different laptop series"); ++MODULE_PARM_DESC(force_caps, "Force the capability bitmask to this value"); + MODULE_PARM_DESC(ec_raw_mode, "Enable EC raw mode"); + + struct acer_data { +@@ -2228,7 +2231,7 @@ static int __init acer_wmi_init(void) + } + /* WMID always provides brightness methods */ + interface->capability |= ACER_CAP_BRIGHTNESS; +- } else if (!wmi_has_guid(WMID_GUID2) && interface && !has_type_aa) { ++ } else if (!wmi_has_guid(WMID_GUID2) && interface && !has_type_aa && force_caps == -1) { + pr_err("No WMID device detection method found\n"); + return -ENODEV; + } +@@ -2258,6 +2261,9 @@ static int __init acer_wmi_init(void) + if (acpi_video_get_backlight_type() != acpi_backlight_vendor) + interface->capability &= ~ACER_CAP_BRIGHTNESS; + ++ if (force_caps != -1) ++ interface->capability = force_caps; ++ + if (wmi_has_guid(WMID_GUID3)) { + if (ACPI_FAILURE(acer_wmi_enable_rf_button())) + pr_warn("Cannot enable RF Button Driver\n"); +-- +2.30.1 + diff --git a/queue-4.19/platform-x86-acer-wmi-add-support-for-sw_tablet_mode.patch b/queue-4.19/platform-x86-acer-wmi-add-support-for-sw_tablet_mode.patch new file mode 100644 index 00000000000..e7a5f3e4325 --- /dev/null +++ b/queue-4.19/platform-x86-acer-wmi-add-support-for-sw_tablet_mode.patch @@ -0,0 +1,216 @@ +From 0ac2251c13326cde6d54f4142d661aba9b03a82c Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 19 Oct 2020 20:56:28 +0200 +Subject: platform/x86: acer-wmi: Add support for SW_TABLET_MODE on Switch + devices + +From: Hans de Goede + +[ Upstream commit 5c54cb6c627e8f50f490e6b5656051a5ac29eab4 ] + +Add support for SW_TABLET_MODE on the Acer Switch 10 (SW5-012) and the +acer Switch 10 (S1003) models. + +There is no way to detect if this is supported, so this uses DMI based +quirks setting force_caps to ACER_CAP_KBD_DOCK (these devices have no +other acer-wmi based functionality). + +The new SW_TABLET_MODE functionality can be tested on devices which +are not in the DMI table by passing acer_wmi.force_caps=0x40 on the +kernel commandline. + +Reviewed-by: Andy Shevchenko +Signed-off-by: Hans de Goede +Link: https://lore.kernel.org/r/20201019185628.264473-6-hdegoede@redhat.com +Signed-off-by: Sasha Levin +--- + drivers/platform/x86/acer-wmi.c | 109 +++++++++++++++++++++++++++++++- + 1 file changed, 106 insertions(+), 3 deletions(-) + +diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c +index 657fd8c49597..b22df329e97b 100644 +--- a/drivers/platform/x86/acer-wmi.c ++++ b/drivers/platform/x86/acer-wmi.c +@@ -43,6 +43,7 @@ + #include + #include + ++ACPI_MODULE_NAME(KBUILD_MODNAME); + MODULE_AUTHOR("Carlos Corbacho"); + MODULE_DESCRIPTION("Acer Laptop WMI Extras Driver"); + MODULE_LICENSE("GPL"); +@@ -93,7 +94,7 @@ MODULE_ALIAS("wmi:676AA15E-6A47-4D9F-A2CC-1E6D18D14026"); + + enum acer_wmi_event_ids { + WMID_HOTKEY_EVENT = 0x1, +- WMID_ACCEL_EVENT = 0x5, ++ WMID_ACCEL_OR_KBD_DOCK_EVENT = 0x5, + }; + + static const struct key_entry acer_wmi_keymap[] __initconst = { +@@ -141,7 +142,9 @@ struct event_return_value { + u8 function; + u8 key_num; + u16 device_state; +- u32 reserved; ++ u16 reserved1; ++ u8 kbd_dock_state; ++ u8 reserved2; + } __attribute__((packed)); + + /* +@@ -225,6 +228,7 @@ struct hotkey_function_type_aa { + #define ACER_CAP_BRIGHTNESS BIT(3) + #define ACER_CAP_THREEG BIT(4) + #define ACER_CAP_SET_FUNCTION_MODE BIT(5) ++#define ACER_CAP_KBD_DOCK BIT(6) + + /* + * Interface type flags +@@ -334,6 +338,15 @@ static int __init dmi_matched(const struct dmi_system_id *dmi) + return 1; + } + ++static int __init set_force_caps(const struct dmi_system_id *dmi) ++{ ++ if (force_caps == -1) { ++ force_caps = (uintptr_t)dmi->driver_data; ++ pr_info("Found %s, set force_caps to 0x%x\n", dmi->ident, force_caps); ++ } ++ return 1; ++} ++ + static struct quirk_entry quirk_unknown = { + }; + +@@ -512,6 +525,24 @@ static const struct dmi_system_id acer_quirks[] __initconst = { + }, + .driver_data = &quirk_acer_travelmate_2490, + }, ++ { ++ .callback = set_force_caps, ++ .ident = "Acer Aspire Switch 10 SW5-012", ++ .matches = { ++ DMI_MATCH(DMI_SYS_VENDOR, "Acer"), ++ DMI_MATCH(DMI_PRODUCT_NAME, "Aspire SW5-012"), ++ }, ++ .driver_data = (void *)ACER_CAP_KBD_DOCK, ++ }, ++ { ++ .callback = set_force_caps, ++ .ident = "Acer One 10 (S1003)", ++ .matches = { ++ DMI_EXACT_MATCH(DMI_SYS_VENDOR, "Acer"), ++ DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "One S1003"), ++ }, ++ .driver_data = (void *)ACER_CAP_KBD_DOCK, ++ }, + {} + }; + +@@ -1552,6 +1583,71 @@ static int acer_gsensor_event(void) + return 0; + } + ++/* ++ * Switch series keyboard dock status ++ */ ++static int acer_kbd_dock_state_to_sw_tablet_mode(u8 kbd_dock_state) ++{ ++ switch (kbd_dock_state) { ++ case 0x01: /* Docked, traditional clamshell laptop mode */ ++ return 0; ++ case 0x04: /* Stand-alone tablet */ ++ case 0x40: /* Docked, tent mode, keyboard not usable */ ++ return 1; ++ default: ++ pr_warn("Unknown kbd_dock_state 0x%02x\n", kbd_dock_state); ++ } ++ ++ return 0; ++} ++ ++static void acer_kbd_dock_get_initial_state(void) ++{ ++ u8 *output, input[8] = { 0x05, 0x00, }; ++ struct acpi_buffer input_buf = { sizeof(input), input }; ++ struct acpi_buffer output_buf = { ACPI_ALLOCATE_BUFFER, NULL }; ++ union acpi_object *obj; ++ acpi_status status; ++ int sw_tablet_mode; ++ ++ status = wmi_evaluate_method(WMID_GUID3, 0, 0x2, &input_buf, &output_buf); ++ if (ACPI_FAILURE(status)) { ++ ACPI_EXCEPTION((AE_INFO, status, "Error getting keyboard-dock initial status")); ++ return; ++ } ++ ++ obj = output_buf.pointer; ++ if (!obj || obj->type != ACPI_TYPE_BUFFER || obj->buffer.length != 8) { ++ pr_err("Unexpected output format getting keyboard-dock initial status\n"); ++ goto out_free_obj; ++ } ++ ++ output = obj->buffer.pointer; ++ if (output[0] != 0x00 || (output[3] != 0x05 && output[3] != 0x45)) { ++ pr_err("Unexpected output [0]=0x%02x [3]=0x%02x getting keyboard-dock initial status\n", ++ output[0], output[3]); ++ goto out_free_obj; ++ } ++ ++ sw_tablet_mode = acer_kbd_dock_state_to_sw_tablet_mode(output[4]); ++ input_report_switch(acer_wmi_input_dev, SW_TABLET_MODE, sw_tablet_mode); ++ ++out_free_obj: ++ kfree(obj); ++} ++ ++static void acer_kbd_dock_event(const struct event_return_value *event) ++{ ++ int sw_tablet_mode; ++ ++ if (!has_cap(ACER_CAP_KBD_DOCK)) ++ return; ++ ++ sw_tablet_mode = acer_kbd_dock_state_to_sw_tablet_mode(event->kbd_dock_state); ++ input_report_switch(acer_wmi_input_dev, SW_TABLET_MODE, sw_tablet_mode); ++ input_sync(acer_wmi_input_dev); ++} ++ + /* + * Rfkill devices + */ +@@ -1779,8 +1875,9 @@ static void acer_wmi_notify(u32 value, void *context) + sparse_keymap_report_event(acer_wmi_input_dev, scancode, 1, true); + } + break; +- case WMID_ACCEL_EVENT: ++ case WMID_ACCEL_OR_KBD_DOCK_EVENT: + acer_gsensor_event(); ++ acer_kbd_dock_event(&return_value); + break; + default: + pr_warn("Unknown function number - %d - %d\n", +@@ -1980,6 +2077,9 @@ static int __init acer_wmi_input_setup(void) + if (err) + goto err_free_dev; + ++ if (has_cap(ACER_CAP_KBD_DOCK)) ++ input_set_capability(acer_wmi_input_dev, EV_SW, SW_TABLET_MODE); ++ + status = wmi_install_notify_handler(ACERWMID_EVENT_GUID, + acer_wmi_notify, NULL); + if (ACPI_FAILURE(status)) { +@@ -1987,6 +2087,9 @@ static int __init acer_wmi_input_setup(void) + goto err_free_dev; + } + ++ if (has_cap(ACER_CAP_KBD_DOCK)) ++ acer_kbd_dock_get_initial_state(); ++ + err = input_register_device(acer_wmi_input_dev); + if (err) + goto err_uninstall_notifier; +-- +2.30.1 + diff --git a/queue-4.19/platform-x86-acer-wmi-cleanup-accelerometer-device-h.patch b/queue-4.19/platform-x86-acer-wmi-cleanup-accelerometer-device-h.patch new file mode 100644 index 00000000000..d95251106c6 --- /dev/null +++ b/queue-4.19/platform-x86-acer-wmi-cleanup-accelerometer-device-h.patch @@ -0,0 +1,100 @@ +From ad198ce912aef544ba9feb05597b15a88ebee9a2 Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 19 Oct 2020 20:56:25 +0200 +Subject: platform/x86: acer-wmi: Cleanup accelerometer device handling + +From: Hans de Goede + +[ Upstream commit 9feb0763e4985ccfae632de3bb2f029cc8389842 ] + +Cleanup accelerometer device handling: +-Drop acer_wmi_accel_destroy instead directly call input_unregister_device. +-The information tracked by the CAP_ACCEL flag mirrors acer_wmi_accel_dev + being NULL. Drop the CAP flag, this is a preparation change for allowing + users to override the capability flags. Dropping the flag stops users + from causing a NULL pointer dereference by forcing the capability. + +Reviewed-by: Andy Shevchenko +Signed-off-by: Hans de Goede +Link: https://lore.kernel.org/r/20201019185628.264473-3-hdegoede@redhat.com +Signed-off-by: Sasha Levin +--- + drivers/platform/x86/acer-wmi.c | 20 ++++++-------------- + 1 file changed, 6 insertions(+), 14 deletions(-) + +diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c +index 8d06454f5915..b95dce2475ab 100644 +--- a/drivers/platform/x86/acer-wmi.c ++++ b/drivers/platform/x86/acer-wmi.c +@@ -224,7 +224,6 @@ struct hotkey_function_type_aa { + #define ACER_CAP_BLUETOOTH BIT(2) + #define ACER_CAP_BRIGHTNESS BIT(3) + #define ACER_CAP_THREEG BIT(4) +-#define ACER_CAP_ACCEL BIT(5) + + /* + * Interface type flags +@@ -1526,7 +1525,7 @@ static int acer_gsensor_event(void) + struct acpi_buffer output; + union acpi_object out_obj[5]; + +- if (!has_cap(ACER_CAP_ACCEL)) ++ if (!acer_wmi_accel_dev) + return -1; + + output.length = sizeof(out_obj); +@@ -1935,8 +1934,6 @@ static int __init acer_wmi_accel_setup(void) + if (err) + return err; + +- interface->capability |= ACER_CAP_ACCEL; +- + acer_wmi_accel_dev = input_allocate_device(); + if (!acer_wmi_accel_dev) + return -ENOMEM; +@@ -1962,11 +1959,6 @@ err_free_dev: + return err; + } + +-static void acer_wmi_accel_destroy(void) +-{ +- input_unregister_device(acer_wmi_accel_dev); +-} +- + static int __init acer_wmi_input_setup(void) + { + acpi_status status; +@@ -2121,7 +2113,7 @@ static int acer_resume(struct device *dev) + if (has_cap(ACER_CAP_BRIGHTNESS)) + set_u32(data->brightness, ACER_CAP_BRIGHTNESS); + +- if (has_cap(ACER_CAP_ACCEL)) ++ if (acer_wmi_accel_dev) + acer_gsensor_init(); + + return 0; +@@ -2329,8 +2321,8 @@ error_device_alloc: + error_platform_register: + if (wmi_has_guid(ACERWMID_EVENT_GUID)) + acer_wmi_input_destroy(); +- if (has_cap(ACER_CAP_ACCEL)) +- acer_wmi_accel_destroy(); ++ if (acer_wmi_accel_dev) ++ input_unregister_device(acer_wmi_accel_dev); + + return err; + } +@@ -2340,8 +2332,8 @@ static void __exit acer_wmi_exit(void) + if (wmi_has_guid(ACERWMID_EVENT_GUID)) + acer_wmi_input_destroy(); + +- if (has_cap(ACER_CAP_ACCEL)) +- acer_wmi_accel_destroy(); ++ if (acer_wmi_accel_dev) ++ input_unregister_device(acer_wmi_accel_dev); + + remove_debugfs(); + platform_device_unregister(acer_platform_device); +-- +2.30.1 + diff --git a/queue-4.19/platform-x86-acer-wmi-cleanup-acer_cap_foo-defines.patch b/queue-4.19/platform-x86-acer-wmi-cleanup-acer_cap_foo-defines.patch new file mode 100644 index 00000000000..b4a6c4303bf --- /dev/null +++ b/queue-4.19/platform-x86-acer-wmi-cleanup-acer_cap_foo-defines.patch @@ -0,0 +1,62 @@ +From b1f4a029335bd02165931bb66cc4d0e468bea5df Mon Sep 17 00:00:00 2001 +From: Sasha Levin +Date: Mon, 19 Oct 2020 20:56:24 +0200 +Subject: platform/x86: acer-wmi: Cleanup ACER_CAP_FOO defines + +From: Hans de Goede + +[ Upstream commit 7c936d8d26afbc74deac0651d613dead2f76e81c ] + +Cleanup the ACER_CAP_FOO defines: +-Switch to using BIT() macro. +-The ACER_CAP_RFBTN flag is set, but it is never checked anywhere, drop it. +-Drop the unused ACER_CAP_ANY define. + +Reviewed-by: Andy Shevchenko +Signed-off-by: Hans de Goede +Link: https://lore.kernel.org/r/20201019185628.264473-2-hdegoede@redhat.com +Signed-off-by: Sasha Levin +--- + drivers/platform/x86/acer-wmi.c | 18 +++++++----------- + 1 file changed, 7 insertions(+), 11 deletions(-) + +diff --git a/drivers/platform/x86/acer-wmi.c b/drivers/platform/x86/acer-wmi.c +index 92400abe3552..8d06454f5915 100644 +--- a/drivers/platform/x86/acer-wmi.c ++++ b/drivers/platform/x86/acer-wmi.c +@@ -219,14 +219,12 @@ struct hotkey_function_type_aa { + /* + * Interface capability flags + */ +-#define ACER_CAP_MAILLED (1<<0) +-#define ACER_CAP_WIRELESS (1<<1) +-#define ACER_CAP_BLUETOOTH (1<<2) +-#define ACER_CAP_BRIGHTNESS (1<<3) +-#define ACER_CAP_THREEG (1<<4) +-#define ACER_CAP_ACCEL (1<<5) +-#define ACER_CAP_RFBTN (1<<6) +-#define ACER_CAP_ANY (0xFFFFFFFF) ++#define ACER_CAP_MAILLED BIT(0) ++#define ACER_CAP_WIRELESS BIT(1) ++#define ACER_CAP_BLUETOOTH BIT(2) ++#define ACER_CAP_BRIGHTNESS BIT(3) ++#define ACER_CAP_THREEG BIT(4) ++#define ACER_CAP_ACCEL BIT(5) + + /* + * Interface type flags +@@ -1266,10 +1264,8 @@ static void __init type_aa_dmi_decode(const struct dmi_header *header, void *d) + interface->capability |= ACER_CAP_THREEG; + if (type_aa->commun_func_bitmap & ACER_WMID3_GDS_BLUETOOTH) + interface->capability |= ACER_CAP_BLUETOOTH; +- if (type_aa->commun_func_bitmap & ACER_WMID3_GDS_RFBTN) { +- interface->capability |= ACER_CAP_RFBTN; ++ if (type_aa->commun_func_bitmap & ACER_WMID3_GDS_RFBTN) + commun_func_bitmap &= ~ACER_WMID3_GDS_RFBTN; +- } + + commun_fn_key_number = type_aa->commun_fn_key_number; + } +-- +2.30.1 + diff --git a/queue-4.19/series b/queue-4.19/series index 56d9b96b9a7..cb65ca32f8f 100644 --- a/queue-4.19/series +++ b/queue-4.19/series @@ -19,3 +19,17 @@ rsxx-return-efault-if-copy_to_user-fails.patch dm-verity-fix-fec-for-rs-roots-unaligned-to-block-size.patch r8169-fix-resuming-from-suspend-on-rtl8105e-if-machine-runs-on-battery.patch net-dsa-add-gro-support-via-gro_cells.patch +mwifiex-pcie-skip-cancel_work_sync-on-reset-failure-.patch +platform-x86-acer-wmi-cleanup-acer_cap_foo-defines.patch +platform-x86-acer-wmi-cleanup-accelerometer-device-h.patch +platform-x86-acer-wmi-add-new-force_caps-module-para.patch +platform-x86-acer-wmi-add-acer_cap_set_function_mode.patch +platform-x86-acer-wmi-add-support-for-sw_tablet_mode.patch +platform-x86-acer-wmi-add-acer_cap_kbd_dock-quirk-fo.patch +hid-mf-add-support-for-0079-1846-mayflash-dragonrise.patch +media-cx23885-add-more-quirks-for-reset-dma-on-some-.patch +asoc-intel-bytcr_rt5640-add-quirk-for-archos-cesium-.patch +pci-add-function-1-dma-alias-quirk-for-marvell-9215-.patch +misc-eeprom_93xx46-add-quirk-to-support-microchip-93.patch +drm-msm-a5xx-remove-overwriting-a5xx_pc_dbg_eco_cntl.patch +mmc-sdhci-of-dwcmshc-set-sdhci_quirk2_preset_value_b.patch