]> git.ipfire.org Git - thirdparty/kernel/stable-queue.git/commitdiff
5.15-stable patches
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 12 Jun 2024 18:53:01 +0000 (20:53 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 12 Jun 2024 18:53:01 +0000 (20:53 +0200)
added patches:
arm64-dts-hi3798cv200-fix-the-size-of-gicr.patch
drm-amdgpu-atomfirmware-add-intergrated-info-v2.3-table.patch
fbdev-savage-handle-err-return-when-savagefb_check_var-failed.patch
media-mc-mark-the-media-devnode-as-registered-from-the-start.patch
media-mxl5xx-move-xpt-structures-off-stack.patch
media-v4l2-core-hold-videodev_lock-until-dev-reg-finishes.patch
mmc-core-add-mmc_gpiod_set_cd_config-function.patch
mmc-sdhci-acpi-disable-write-protect-detection-on-toshiba-wt10-a.patch
mmc-sdhci-acpi-fix-lenovo-yoga-tablet-2-pro-1380-sdcard-slot-not-working.patch
mmc-sdhci-acpi-sort-dmi-quirks-alphabetically.patch
wifi-rtl8xxxu-fix-the-tx-power-of-rtl8192cu-rtl8723au.patch
wifi-rtlwifi-rtl8192de-fix-endianness-issue-in-rx-path.patch
wifi-rtlwifi-rtl8192de-fix-low-speed-with-wpa3-sae.patch

14 files changed:
queue-5.15/arm64-dts-hi3798cv200-fix-the-size-of-gicr.patch [new file with mode: 0644]
queue-5.15/drm-amdgpu-atomfirmware-add-intergrated-info-v2.3-table.patch [new file with mode: 0644]
queue-5.15/fbdev-savage-handle-err-return-when-savagefb_check_var-failed.patch [new file with mode: 0644]
queue-5.15/media-mc-mark-the-media-devnode-as-registered-from-the-start.patch [new file with mode: 0644]
queue-5.15/media-mxl5xx-move-xpt-structures-off-stack.patch [new file with mode: 0644]
queue-5.15/media-v4l2-core-hold-videodev_lock-until-dev-reg-finishes.patch [new file with mode: 0644]
queue-5.15/mmc-core-add-mmc_gpiod_set_cd_config-function.patch [new file with mode: 0644]
queue-5.15/mmc-sdhci-acpi-disable-write-protect-detection-on-toshiba-wt10-a.patch [new file with mode: 0644]
queue-5.15/mmc-sdhci-acpi-fix-lenovo-yoga-tablet-2-pro-1380-sdcard-slot-not-working.patch [new file with mode: 0644]
queue-5.15/mmc-sdhci-acpi-sort-dmi-quirks-alphabetically.patch [new file with mode: 0644]
queue-5.15/series
queue-5.15/wifi-rtl8xxxu-fix-the-tx-power-of-rtl8192cu-rtl8723au.patch [new file with mode: 0644]
queue-5.15/wifi-rtlwifi-rtl8192de-fix-endianness-issue-in-rx-path.patch [new file with mode: 0644]
queue-5.15/wifi-rtlwifi-rtl8192de-fix-low-speed-with-wpa3-sae.patch [new file with mode: 0644]

diff --git a/queue-5.15/arm64-dts-hi3798cv200-fix-the-size-of-gicr.patch b/queue-5.15/arm64-dts-hi3798cv200-fix-the-size-of-gicr.patch
new file mode 100644 (file)
index 0000000..298c790
--- /dev/null
@@ -0,0 +1,43 @@
+From 428a575dc9038846ad259466d5ba109858c0a023 Mon Sep 17 00:00:00 2001
+From: Yang Xiwen <forbidden405@outlook.com>
+Date: Mon, 19 Feb 2024 23:05:26 +0800
+Subject: arm64: dts: hi3798cv200: fix the size of GICR
+
+From: Yang Xiwen <forbidden405@outlook.com>
+
+commit 428a575dc9038846ad259466d5ba109858c0a023 upstream.
+
+During boot, Linux kernel complains:
+
+[    0.000000] GIC: GICv2 detected, but range too small and irqchip.gicv2_force_probe not set
+
+This SoC is using a regular GIC-400 and the GICR space size should be
+8KB rather than 256B.
+
+With this patch:
+
+[    0.000000] GIC: Using split EOI/Deactivate mode
+
+So this should be the correct fix.
+
+Fixes: 2f20182ed670 ("arm64: dts: hisilicon: add dts files for hi3798cv200-poplar board")
+Signed-off-by: Yang Xiwen <forbidden405@outlook.com>
+Cc: stable@vger.kernel.org
+Link: https://lore.kernel.org/r/20240219-cache-v3-1-a33c57534ae9@outlook.com
+Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ arch/arm64/boot/dts/hisilicon/hi3798cv200.dtsi |    2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+--- a/arch/arm64/boot/dts/hisilicon/hi3798cv200.dtsi
++++ b/arch/arm64/boot/dts/hisilicon/hi3798cv200.dtsi
+@@ -58,7 +58,7 @@
+       gic: interrupt-controller@f1001000 {
+               compatible = "arm,gic-400";
+               reg = <0x0 0xf1001000 0x0 0x1000>,  /* GICD */
+-                    <0x0 0xf1002000 0x0 0x100>;   /* GICC */
++                    <0x0 0xf1002000 0x0 0x2000>;  /* GICC */
+               #address-cells = <0>;
+               #interrupt-cells = <3>;
+               interrupt-controller;
diff --git a/queue-5.15/drm-amdgpu-atomfirmware-add-intergrated-info-v2.3-table.patch b/queue-5.15/drm-amdgpu-atomfirmware-add-intergrated-info-v2.3-table.patch
new file mode 100644 (file)
index 0000000..f2a05da
--- /dev/null
@@ -0,0 +1,111 @@
+From e64e8f7c178e5228e0b2dbb504b9dc75953a319f Mon Sep 17 00:00:00 2001
+From: Li Ma <li.ma@amd.com>
+Date: Mon, 20 May 2024 18:43:55 +0800
+Subject: drm/amdgpu/atomfirmware: add intergrated info v2.3 table
+
+From: Li Ma <li.ma@amd.com>
+
+commit e64e8f7c178e5228e0b2dbb504b9dc75953a319f upstream.
+
+[Why]
+The vram width value is 0.
+Because the integratedsysteminfo table in VBIOS has updated to 2.3.
+
+[How]
+Driver needs a new intergrated info v2.3 table too.
+Then the vram width value will be correct.
+
+Signed-off-by: Li Ma <li.ma@amd.com>
+Reviewed-by: Yifan Zhang <yifan1.zhang@amd.com>
+Acked-by: Alex Deucher <alexander.deucher@amd.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+Cc: stable@vger.kernel.org
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c |   15 ++++++++
+ drivers/gpu/drm/amd/include/atomfirmware.h       |   43 +++++++++++++++++++++++
+ 2 files changed, 58 insertions(+)
+
+--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c
++++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c
+@@ -149,6 +149,7 @@ union igp_info {
+       struct atom_integrated_system_info_v1_11 v11;
+       struct atom_integrated_system_info_v1_12 v12;
+       struct atom_integrated_system_info_v2_1 v21;
++      struct atom_integrated_system_info_v2_3 v23;
+ };
+ union umc_info {
+@@ -283,6 +284,20 @@ amdgpu_atomfirmware_get_vram_info(struct
+                                       if (vram_type)
+                                               *vram_type = convert_atom_mem_type_to_vram_type(adev, mem_type);
+                                       break;
++                              case 3:
++                                      mem_channel_number = igp_info->v23.umachannelnumber;
++                                      if (!mem_channel_number)
++                                              mem_channel_number = 1;
++                                      mem_type = igp_info->v23.memorytype;
++                                      if (mem_type == LpDdr5MemType)
++                                              mem_channel_width = 32;
++                                      else
++                                              mem_channel_width = 64;
++                                      if (vram_width)
++                                              *vram_width = mem_channel_number * mem_channel_width;
++                                      if (vram_type)
++                                              *vram_type = convert_atom_mem_type_to_vram_type(adev, mem_type);
++                                      break;
+                               default:
+                                       return -EINVAL;
+                               }
+--- a/drivers/gpu/drm/amd/include/atomfirmware.h
++++ b/drivers/gpu/drm/amd/include/atomfirmware.h
+@@ -1467,6 +1467,49 @@ struct atom_integrated_system_info_v2_2
+       uint32_t  reserved4[189];
+ };
++struct uma_carveout_option {
++  char       optionName[29];        //max length of string is 28chars + '\0'. Current design is for "minimum", "Medium", "High". This makes entire struct size 64bits
++  uint8_t    memoryCarvedGb;        //memory carved out with setting
++  uint8_t    memoryRemainingGb;     //memory remaining on system
++  union {
++    struct _flags {
++      uint8_t Auto     : 1;
++      uint8_t Custom   : 1;
++      uint8_t Reserved : 6;
++    } flags;
++    uint8_t all8;
++  } uma_carveout_option_flags;
++};
++
++struct atom_integrated_system_info_v2_3 {
++  struct  atom_common_table_header table_header;
++  uint32_t  vbios_misc; // enum of atom_system_vbiosmisc_def
++  uint32_t  gpucapinfo; // enum of atom_system_gpucapinf_def
++  uint32_t  system_config;
++  uint32_t  cpucapinfo;
++  uint16_t  gpuclk_ss_percentage; // unit of 0.001%,   1000 mean 1%
++  uint16_t  gpuclk_ss_type;
++  uint16_t  dpphy_override;  // bit vector, enum of atom_sysinfo_dpphy_override_def
++  uint8_t memorytype;       // enum of atom_dmi_t17_mem_type_def, APU memory type indication.
++  uint8_t umachannelnumber; // number of memory channels
++  uint8_t htc_hyst_limit;
++  uint8_t htc_tmp_limit;
++  uint8_t reserved1; // dp_ss_control
++  uint8_t gpu_package_id;
++  struct  edp_info_table  edp1_info;
++  struct  edp_info_table  edp2_info;
++  uint32_t  reserved2[8];
++  struct  atom_external_display_connection_info extdispconninfo;
++  uint8_t UMACarveoutVersion;
++  uint8_t UMACarveoutIndexMax;
++  uint8_t UMACarveoutTypeDefault;
++  uint8_t UMACarveoutIndexDefault;
++  uint8_t UMACarveoutType;           //Auto or Custom
++  uint8_t UMACarveoutIndex;
++  struct  uma_carveout_option UMASizeControlOption[20];
++  uint8_t reserved3[110];
++};
++
+ // system_config
+ enum atom_system_vbiosmisc_def{
+   INTEGRATED_SYSTEM_INFO__GET_EDID_CALLBACK_FUNC_SUPPORT = 0x01,
diff --git a/queue-5.15/fbdev-savage-handle-err-return-when-savagefb_check_var-failed.patch b/queue-5.15/fbdev-savage-handle-err-return-when-savagefb_check_var-failed.patch
new file mode 100644 (file)
index 0000000..78a180a
--- /dev/null
@@ -0,0 +1,37 @@
+From 6ad959b6703e2c4c5d7af03b4cfd5ff608036339 Mon Sep 17 00:00:00 2001
+From: Cai Xinchen <caixinchen1@huawei.com>
+Date: Tue, 16 Apr 2024 06:51:37 +0000
+Subject: fbdev: savage: Handle err return when savagefb_check_var failed
+
+From: Cai Xinchen <caixinchen1@huawei.com>
+
+commit 6ad959b6703e2c4c5d7af03b4cfd5ff608036339 upstream.
+
+The commit 04e5eac8f3ab("fbdev: savage: Error out if pixclock equals zero")
+checks the value of pixclock to avoid divide-by-zero error. However
+the function savagefb_probe doesn't handle the error return of
+savagefb_check_var. When pixclock is 0, it will cause divide-by-zero error.
+
+Fixes: 04e5eac8f3ab ("fbdev: savage: Error out if pixclock equals zero")
+Signed-off-by: Cai Xinchen <caixinchen1@huawei.com>
+Cc: stable@vger.kernel.org
+Signed-off-by: Helge Deller <deller@gmx.de>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/video/fbdev/savage/savagefb_driver.c |    5 ++++-
+ 1 file changed, 4 insertions(+), 1 deletion(-)
+
+--- a/drivers/video/fbdev/savage/savagefb_driver.c
++++ b/drivers/video/fbdev/savage/savagefb_driver.c
+@@ -2271,7 +2271,10 @@ static int savagefb_probe(struct pci_dev
+       if (info->var.xres_virtual > 0x1000)
+               info->var.xres_virtual = 0x1000;
+ #endif
+-      savagefb_check_var(&info->var, info);
++      err = savagefb_check_var(&info->var, info);
++      if (err)
++              goto failed;
++
+       savagefb_set_fix(info);
+       /*
diff --git a/queue-5.15/media-mc-mark-the-media-devnode-as-registered-from-the-start.patch b/queue-5.15/media-mc-mark-the-media-devnode-as-registered-from-the-start.patch
new file mode 100644 (file)
index 0000000..189e373
--- /dev/null
@@ -0,0 +1,48 @@
+From 4bc60736154bc9e0e39d3b88918f5d3762ebe5e0 Mon Sep 17 00:00:00 2001
+From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Date: Fri, 23 Feb 2024 09:46:19 +0100
+Subject: media: mc: mark the media devnode as registered from the, start
+
+From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+
+commit 4bc60736154bc9e0e39d3b88918f5d3762ebe5e0 upstream.
+
+First the media device node was created, and if successful it was
+marked as 'registered'. This leaves a small race condition where
+an application can open the device node and get an error back
+because the 'registered' flag was not yet set.
+
+Change the order: first set the 'registered' flag, then actually
+register the media device node. If that fails, then clear the flag.
+
+Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>
+Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
+Fixes: cf4b9211b568 ("[media] media: Media device node support")
+Cc: stable@vger.kernel.org
+Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/media/mc/mc-devnode.c |    5 ++---
+ 1 file changed, 2 insertions(+), 3 deletions(-)
+
+--- a/drivers/media/mc/mc-devnode.c
++++ b/drivers/media/mc/mc-devnode.c
+@@ -246,15 +246,14 @@ int __must_check media_devnode_register(
+       kobject_set_name(&devnode->cdev.kobj, "media%d", devnode->minor);
+       /* Part 3: Add the media and char device */
++      set_bit(MEDIA_FLAG_REGISTERED, &devnode->flags);
+       ret = cdev_device_add(&devnode->cdev, &devnode->dev);
+       if (ret < 0) {
++              clear_bit(MEDIA_FLAG_REGISTERED, &devnode->flags);
+               pr_err("%s: cdev_device_add failed\n", __func__);
+               goto cdev_add_error;
+       }
+-      /* Part 4: Activate this minor. The char device can now be used. */
+-      set_bit(MEDIA_FLAG_REGISTERED, &devnode->flags);
+-
+       return 0;
+ cdev_add_error:
diff --git a/queue-5.15/media-mxl5xx-move-xpt-structures-off-stack.patch b/queue-5.15/media-mxl5xx-move-xpt-structures-off-stack.patch
new file mode 100644 (file)
index 0000000..f5dfcc8
--- /dev/null
@@ -0,0 +1,115 @@
+From 526f4527545b2d4ce0733733929fac7b6da09ac6 Mon Sep 17 00:00:00 2001
+From: Nathan Chancellor <nathan@kernel.org>
+Date: Fri, 12 Jan 2024 00:40:36 +0000
+Subject: media: mxl5xx: Move xpt structures off stack
+
+From: Nathan Chancellor <nathan@kernel.org>
+
+commit 526f4527545b2d4ce0733733929fac7b6da09ac6 upstream.
+
+When building for LoongArch with clang 18.0.0, the stack usage of
+probe() is larger than the allowed 2048 bytes:
+
+  drivers/media/dvb-frontends/mxl5xx.c:1698:12: warning: stack frame size (2368) exceeds limit (2048) in 'probe' [-Wframe-larger-than]
+   1698 | static int probe(struct mxl *state, struct mxl5xx_cfg *cfg)
+        |            ^
+  1 warning generated.
+
+This is the result of the linked LLVM commit, which changes how the
+arrays of structures in config_ts() get handled with
+CONFIG_INIT_STACK_ZERO and CONFIG_INIT_STACK_PATTERN, which causes the
+above warning in combination with inlining, as config_ts() gets inlined
+into probe().
+
+This warning can be easily fixed by moving the array of structures off
+of the stackvia 'static const', which is a better location for these
+variables anyways because they are static data that is only ever read
+from, never modified, so allocating the stack space is wasteful.
+
+This drops the stack usage from 2368 bytes to 256 bytes with the same
+compiler and configuration.
+
+Link: https://lore.kernel.org/linux-media/20240111-dvb-mxl5xx-move-structs-off-stack-v1-1-ca4230e67c11@kernel.org
+Cc: stable@vger.kernel.org
+Closes: https://github.com/ClangBuiltLinux/linux/issues/1977
+Link: https://github.com/llvm/llvm-project/commit/afe8b93ffdfef5d8879e1894b9d7dda40dee2b8d
+Signed-off-by: Nathan Chancellor <nathan@kernel.org>
+Reviewed-by: Miguel Ojeda <ojeda@kernel.org>
+Tested-by: Miguel Ojeda <ojeda@kernel.org>
+Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/media/dvb-frontends/mxl5xx.c |   22 +++++++++++-----------
+ 1 file changed, 11 insertions(+), 11 deletions(-)
+
+--- a/drivers/media/dvb-frontends/mxl5xx.c
++++ b/drivers/media/dvb-frontends/mxl5xx.c
+@@ -1390,57 +1390,57 @@ static int config_ts(struct mxl *state,
+       u32 nco_count_min = 0;
+       u32 clk_type = 0;
+-      struct MXL_REG_FIELD_T xpt_sync_polarity[MXL_HYDRA_DEMOD_MAX] = {
++      static const struct MXL_REG_FIELD_T xpt_sync_polarity[MXL_HYDRA_DEMOD_MAX] = {
+               {0x90700010, 8, 1}, {0x90700010, 9, 1},
+               {0x90700010, 10, 1}, {0x90700010, 11, 1},
+               {0x90700010, 12, 1}, {0x90700010, 13, 1},
+               {0x90700010, 14, 1}, {0x90700010, 15, 1} };
+-      struct MXL_REG_FIELD_T xpt_clock_polarity[MXL_HYDRA_DEMOD_MAX] = {
++      static const struct MXL_REG_FIELD_T xpt_clock_polarity[MXL_HYDRA_DEMOD_MAX] = {
+               {0x90700010, 16, 1}, {0x90700010, 17, 1},
+               {0x90700010, 18, 1}, {0x90700010, 19, 1},
+               {0x90700010, 20, 1}, {0x90700010, 21, 1},
+               {0x90700010, 22, 1}, {0x90700010, 23, 1} };
+-      struct MXL_REG_FIELD_T xpt_valid_polarity[MXL_HYDRA_DEMOD_MAX] = {
++      static const struct MXL_REG_FIELD_T xpt_valid_polarity[MXL_HYDRA_DEMOD_MAX] = {
+               {0x90700014, 0, 1}, {0x90700014, 1, 1},
+               {0x90700014, 2, 1}, {0x90700014, 3, 1},
+               {0x90700014, 4, 1}, {0x90700014, 5, 1},
+               {0x90700014, 6, 1}, {0x90700014, 7, 1} };
+-      struct MXL_REG_FIELD_T xpt_ts_clock_phase[MXL_HYDRA_DEMOD_MAX] = {
++      static const struct MXL_REG_FIELD_T xpt_ts_clock_phase[MXL_HYDRA_DEMOD_MAX] = {
+               {0x90700018, 0, 3}, {0x90700018, 4, 3},
+               {0x90700018, 8, 3}, {0x90700018, 12, 3},
+               {0x90700018, 16, 3}, {0x90700018, 20, 3},
+               {0x90700018, 24, 3}, {0x90700018, 28, 3} };
+-      struct MXL_REG_FIELD_T xpt_lsb_first[MXL_HYDRA_DEMOD_MAX] = {
++      static const struct MXL_REG_FIELD_T xpt_lsb_first[MXL_HYDRA_DEMOD_MAX] = {
+               {0x9070000C, 16, 1}, {0x9070000C, 17, 1},
+               {0x9070000C, 18, 1}, {0x9070000C, 19, 1},
+               {0x9070000C, 20, 1}, {0x9070000C, 21, 1},
+               {0x9070000C, 22, 1}, {0x9070000C, 23, 1} };
+-      struct MXL_REG_FIELD_T xpt_sync_byte[MXL_HYDRA_DEMOD_MAX] = {
++      static const struct MXL_REG_FIELD_T xpt_sync_byte[MXL_HYDRA_DEMOD_MAX] = {
+               {0x90700010, 0, 1}, {0x90700010, 1, 1},
+               {0x90700010, 2, 1}, {0x90700010, 3, 1},
+               {0x90700010, 4, 1}, {0x90700010, 5, 1},
+               {0x90700010, 6, 1}, {0x90700010, 7, 1} };
+-      struct MXL_REG_FIELD_T xpt_enable_output[MXL_HYDRA_DEMOD_MAX] = {
++      static const struct MXL_REG_FIELD_T xpt_enable_output[MXL_HYDRA_DEMOD_MAX] = {
+               {0x9070000C, 0, 1}, {0x9070000C, 1, 1},
+               {0x9070000C, 2, 1}, {0x9070000C, 3, 1},
+               {0x9070000C, 4, 1}, {0x9070000C, 5, 1},
+               {0x9070000C, 6, 1}, {0x9070000C, 7, 1} };
+-      struct MXL_REG_FIELD_T xpt_err_replace_sync[MXL_HYDRA_DEMOD_MAX] = {
++      static const struct MXL_REG_FIELD_T xpt_err_replace_sync[MXL_HYDRA_DEMOD_MAX] = {
+               {0x9070000C, 24, 1}, {0x9070000C, 25, 1},
+               {0x9070000C, 26, 1}, {0x9070000C, 27, 1},
+               {0x9070000C, 28, 1}, {0x9070000C, 29, 1},
+               {0x9070000C, 30, 1}, {0x9070000C, 31, 1} };
+-      struct MXL_REG_FIELD_T xpt_err_replace_valid[MXL_HYDRA_DEMOD_MAX] = {
++      static const struct MXL_REG_FIELD_T xpt_err_replace_valid[MXL_HYDRA_DEMOD_MAX] = {
+               {0x90700014, 8, 1}, {0x90700014, 9, 1},
+               {0x90700014, 10, 1}, {0x90700014, 11, 1},
+               {0x90700014, 12, 1}, {0x90700014, 13, 1},
+               {0x90700014, 14, 1}, {0x90700014, 15, 1} };
+-      struct MXL_REG_FIELD_T xpt_continuous_clock[MXL_HYDRA_DEMOD_MAX] = {
++      static const struct MXL_REG_FIELD_T xpt_continuous_clock[MXL_HYDRA_DEMOD_MAX] = {
+               {0x907001D4, 0, 1}, {0x907001D4, 1, 1},
+               {0x907001D4, 2, 1}, {0x907001D4, 3, 1},
+               {0x907001D4, 4, 1}, {0x907001D4, 5, 1},
+               {0x907001D4, 6, 1}, {0x907001D4, 7, 1} };
+-      struct MXL_REG_FIELD_T xpt_nco_clock_rate[MXL_HYDRA_DEMOD_MAX] = {
++      static const struct MXL_REG_FIELD_T xpt_nco_clock_rate[MXL_HYDRA_DEMOD_MAX] = {
+               {0x90700044, 16, 80}, {0x90700044, 16, 81},
+               {0x90700044, 16, 82}, {0x90700044, 16, 83},
+               {0x90700044, 16, 84}, {0x90700044, 16, 85},
diff --git a/queue-5.15/media-v4l2-core-hold-videodev_lock-until-dev-reg-finishes.patch b/queue-5.15/media-v4l2-core-hold-videodev_lock-until-dev-reg-finishes.patch
new file mode 100644 (file)
index 0000000..c61a6ca
--- /dev/null
@@ -0,0 +1,50 @@
+From 1ed4477f2ea4743e7c5e1f9f3722152d14e6eeb1 Mon Sep 17 00:00:00 2001
+From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Date: Fri, 23 Feb 2024 09:45:36 +0100
+Subject: media: v4l2-core: hold videodev_lock until dev reg, finishes
+
+From: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+
+commit 1ed4477f2ea4743e7c5e1f9f3722152d14e6eeb1 upstream.
+
+After the new V4L2 device node was registered, some additional
+initialization was done before the device node was marked as
+'registered'. During the time between creating the device node
+and marking it as 'registered' it was possible to open the
+device node, which would return -ENODEV since the 'registered'
+flag was not yet set.
+
+Hold the videodev_lock mutex from just before the device node
+is registered until the 'registered' flag is set. Since v4l2_open
+will take the same lock, it will wait until this registration
+process is finished. This resolves this race condition.
+
+Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
+Reviewed-by: Sakari Ailus <sakari.ailus@linux.intel.com>
+Cc: <stable@vger.kernel.org>      # for vi4.18 and up
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/media/v4l2-core/v4l2-dev.c |    3 +++
+ 1 file changed, 3 insertions(+)
+
+--- a/drivers/media/v4l2-core/v4l2-dev.c
++++ b/drivers/media/v4l2-core/v4l2-dev.c
+@@ -1033,8 +1033,10 @@ int __video_register_device(struct video
+       vdev->dev.devt = MKDEV(VIDEO_MAJOR, vdev->minor);
+       vdev->dev.parent = vdev->dev_parent;
+       dev_set_name(&vdev->dev, "%s%d", name_base, vdev->num);
++      mutex_lock(&videodev_lock);
+       ret = device_register(&vdev->dev);
+       if (ret < 0) {
++              mutex_unlock(&videodev_lock);
+               pr_err("%s: device_register failed\n", __func__);
+               goto cleanup;
+       }
+@@ -1054,6 +1056,7 @@ int __video_register_device(struct video
+       /* Part 6: Activate this minor. The char device can now be used. */
+       set_bit(V4L2_FL_REGISTERED, &vdev->flags);
++      mutex_unlock(&videodev_lock);
+       return 0;
diff --git a/queue-5.15/mmc-core-add-mmc_gpiod_set_cd_config-function.patch b/queue-5.15/mmc-core-add-mmc_gpiod_set_cd_config-function.patch
new file mode 100644 (file)
index 0000000..b274141
--- /dev/null
@@ -0,0 +1,71 @@
+From 63a7cd660246aa36af263b85c33ecc6601bf04be Mon Sep 17 00:00:00 2001
+From: Hans de Goede <hdegoede@redhat.com>
+Date: Wed, 10 Apr 2024 21:16:34 +0200
+Subject: mmc: core: Add mmc_gpiod_set_cd_config() function
+
+From: Hans de Goede <hdegoede@redhat.com>
+
+commit 63a7cd660246aa36af263b85c33ecc6601bf04be upstream.
+
+Some mmc host drivers may need to fixup a card-detection GPIO's config
+to e.g. enable the GPIO controllers builtin pull-up resistor on devices
+where the firmware description of the GPIO is broken (e.g. GpioInt with
+PullNone instead of PullUp in ACPI DSDT).
+
+Since this is the exception rather then the rule adding a config
+parameter to mmc_gpiod_request_cd() seems undesirable, so instead
+add a new mmc_gpiod_set_cd_config() function. This is simply a wrapper
+to call gpiod_set_config() on the card-detect GPIO acquired through
+mmc_gpiod_request_cd().
+
+Reviewed-by: Andy Shevchenko <andy@kernel.org>
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Acked-by: Adrian Hunter <adrian.hunter@intel.com>
+Cc: stable@vger.kernel.org
+Link: https://lore.kernel.org/r/20240410191639.526324-2-hdegoede@redhat.com
+Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/mmc/core/slot-gpio.c  |   20 ++++++++++++++++++++
+ include/linux/mmc/slot-gpio.h |    1 +
+ 2 files changed, 21 insertions(+)
+
+--- a/drivers/mmc/core/slot-gpio.c
++++ b/drivers/mmc/core/slot-gpio.c
+@@ -202,6 +202,26 @@ int mmc_gpiod_request_cd(struct mmc_host
+ }
+ EXPORT_SYMBOL(mmc_gpiod_request_cd);
++/**
++ * mmc_gpiod_set_cd_config - set config for card-detection GPIO
++ * @host: mmc host
++ * @config: Generic pinconf config (from pinconf_to_config_packed())
++ *
++ * This can be used by mmc host drivers to fixup a card-detection GPIO's config
++ * (e.g. set PIN_CONFIG_BIAS_PULL_UP) after acquiring the GPIO descriptor
++ * through mmc_gpiod_request_cd().
++ *
++ * Returns:
++ * 0 on success, or a negative errno value on error.
++ */
++int mmc_gpiod_set_cd_config(struct mmc_host *host, unsigned long config)
++{
++      struct mmc_gpio *ctx = host->slot.handler_priv;
++
++      return gpiod_set_config(ctx->cd_gpio, config);
++}
++EXPORT_SYMBOL(mmc_gpiod_set_cd_config);
++
+ bool mmc_can_gpio_cd(struct mmc_host *host)
+ {
+       struct mmc_gpio *ctx = host->slot.handler_priv;
+--- a/include/linux/mmc/slot-gpio.h
++++ b/include/linux/mmc/slot-gpio.h
+@@ -20,6 +20,7 @@ int mmc_gpiod_request_cd(struct mmc_host
+                        unsigned int debounce);
+ int mmc_gpiod_request_ro(struct mmc_host *host, const char *con_id,
+                        unsigned int idx, unsigned int debounce);
++int mmc_gpiod_set_cd_config(struct mmc_host *host, unsigned long config);
+ void mmc_gpio_set_cd_isr(struct mmc_host *host,
+                        irqreturn_t (*isr)(int irq, void *dev_id));
+ int mmc_gpio_set_cd_wake(struct mmc_host *host, bool on);
diff --git a/queue-5.15/mmc-sdhci-acpi-disable-write-protect-detection-on-toshiba-wt10-a.patch b/queue-5.15/mmc-sdhci-acpi-disable-write-protect-detection-on-toshiba-wt10-a.patch
new file mode 100644 (file)
index 0000000..30b75f8
--- /dev/null
@@ -0,0 +1,45 @@
+From ef3eab75e17191e5665f52e64e85bc29d5705a7b Mon Sep 17 00:00:00 2001
+From: Hans de Goede <hdegoede@redhat.com>
+Date: Wed, 10 Apr 2024 21:16:38 +0200
+Subject: mmc: sdhci-acpi: Disable write protect detection on Toshiba WT10-A
+
+From: Hans de Goede <hdegoede@redhat.com>
+
+commit ef3eab75e17191e5665f52e64e85bc29d5705a7b upstream.
+
+On the Toshiba WT10-A the microSD slot always reports the card being
+write-protected, just like on the Toshiba WT8-B.
+
+Add a DMI quirk to work around this.
+
+Reviewed-by: Andy Shevchenko <andy@kernel.org>
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Acked-by: Adrian Hunter <adrian.hunter@intel.com>
+Cc: stable@vger.kernel.org
+Link: https://lore.kernel.org/r/20240410191639.526324-6-hdegoede@redhat.com
+Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/mmc/host/sdhci-acpi.c |   11 +++++++++++
+ 1 file changed, 11 insertions(+)
+
+--- a/drivers/mmc/host/sdhci-acpi.c
++++ b/drivers/mmc/host/sdhci-acpi.c
+@@ -855,6 +855,17 @@ static const struct dmi_system_id sdhci_
+               },
+               .driver_data = (void *)DMI_QUIRK_SD_NO_WRITE_PROTECT,
+       },
++      {
++              /*
++               * The Toshiba WT10-A's microSD slot always reports the card being
++               * write-protected.
++               */
++              .matches = {
++                      DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
++                      DMI_MATCH(DMI_PRODUCT_NAME, "TOSHIBA WT10-A"),
++              },
++              .driver_data = (void *)DMI_QUIRK_SD_NO_WRITE_PROTECT,
++      },
+       {} /* Terminating entry */
+ };
diff --git a/queue-5.15/mmc-sdhci-acpi-fix-lenovo-yoga-tablet-2-pro-1380-sdcard-slot-not-working.patch b/queue-5.15/mmc-sdhci-acpi-fix-lenovo-yoga-tablet-2-pro-1380-sdcard-slot-not-working.patch
new file mode 100644 (file)
index 0000000..0284931
--- /dev/null
@@ -0,0 +1,72 @@
+From f3521d7cbaefff19cc656325787ed797e5f6a955 Mon Sep 17 00:00:00 2001
+From: Hans de Goede <hdegoede@redhat.com>
+Date: Wed, 10 Apr 2024 21:16:37 +0200
+Subject: mmc: sdhci-acpi: Fix Lenovo Yoga Tablet 2 Pro 1380 sdcard slot not working
+
+From: Hans de Goede <hdegoede@redhat.com>
+
+commit f3521d7cbaefff19cc656325787ed797e5f6a955 upstream.
+
+The Lenovo Yoga Tablet 2 Pro 1380 sdcard slot has an active high cd pin
+and a broken wp pin which always reports the card being write-protected.
+
+Add a DMI quirk to address both issues.
+
+Reviewed-by: Andy Shevchenko <andy@kernel.org>
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Acked-by: Adrian Hunter <adrian.hunter@intel.com>
+Cc: stable@vger.kernel.org
+Link: https://lore.kernel.org/r/20240410191639.526324-5-hdegoede@redhat.com
+Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/mmc/host/sdhci-acpi.c |   24 ++++++++++++++++++++++++
+ 1 file changed, 24 insertions(+)
+
+--- a/drivers/mmc/host/sdhci-acpi.c
++++ b/drivers/mmc/host/sdhci-acpi.c
+@@ -82,6 +82,7 @@ struct sdhci_acpi_host {
+ enum {
+       DMI_QUIRK_RESET_SD_SIGNAL_VOLT_ON_SUSP                  = BIT(0),
+       DMI_QUIRK_SD_NO_WRITE_PROTECT                           = BIT(1),
++      DMI_QUIRK_SD_CD_ACTIVE_HIGH                             = BIT(2),
+ };
+ static inline void *sdhci_acpi_priv(struct sdhci_acpi_host *c)
+@@ -825,6 +826,26 @@ static const struct dmi_system_id sdhci_
+       },
+       {
+               /*
++               * Lenovo Yoga Tablet 2 Pro 1380F/L (13" Android version) this
++               * has broken WP reporting and an inverted CD signal.
++               * Note this has more or less the same BIOS as the Lenovo Yoga
++               * Tablet 2 830F/L or 1050F/L (8" and 10" Android), but unlike
++               * the 830 / 1050 models which share the same mainboard this
++               * model has a different mainboard and the inverted CD and
++               * broken WP are unique to this board.
++               */
++              .matches = {
++                      DMI_MATCH(DMI_SYS_VENDOR, "Intel Corp."),
++                      DMI_MATCH(DMI_PRODUCT_NAME, "VALLEYVIEW C0 PLATFORM"),
++                      DMI_MATCH(DMI_BOARD_NAME, "BYT-T FFD8"),
++                      /* Full match so as to NOT match the 830/1050 BIOS */
++                      DMI_MATCH(DMI_BIOS_VERSION, "BLADE_21.X64.0005.R00.1504101516"),
++              },
++              .driver_data = (void *)(DMI_QUIRK_SD_NO_WRITE_PROTECT |
++                                      DMI_QUIRK_SD_CD_ACTIVE_HIGH),
++      },
++      {
++              /*
+                * The Toshiba WT8-B's microSD slot always reports the card being
+                * write-protected.
+                */
+@@ -948,6 +969,9 @@ static int sdhci_acpi_probe(struct platf
+       if (sdhci_acpi_flag(c, SDHCI_ACPI_SD_CD)) {
+               bool v = sdhci_acpi_flag(c, SDHCI_ACPI_SD_CD_OVERRIDE_LEVEL);
++              if (quirks & DMI_QUIRK_SD_CD_ACTIVE_HIGH)
++                      host->mmc->caps2 |= MMC_CAP2_CD_ACTIVE_HIGH;
++
+               err = mmc_gpiod_request_cd(host->mmc, NULL, 0, v, 0);
+               if (err) {
+                       if (err == -EPROBE_DEFER)
diff --git a/queue-5.15/mmc-sdhci-acpi-sort-dmi-quirks-alphabetically.patch b/queue-5.15/mmc-sdhci-acpi-sort-dmi-quirks-alphabetically.patch
new file mode 100644 (file)
index 0000000..fe40d2a
--- /dev/null
@@ -0,0 +1,66 @@
+From a92a73b1d9249d155412d8ac237142fa716803ea Mon Sep 17 00:00:00 2001
+From: Hans de Goede <hdegoede@redhat.com>
+Date: Wed, 10 Apr 2024 21:16:36 +0200
+Subject: mmc: sdhci-acpi: Sort DMI quirks alphabetically
+
+From: Hans de Goede <hdegoede@redhat.com>
+
+commit a92a73b1d9249d155412d8ac237142fa716803ea upstream.
+
+Sort the DMI quirks alphabetically.
+
+Reviewed-by: Andy Shevchenko <andy@kernel.org>
+Signed-off-by: Hans de Goede <hdegoede@redhat.com>
+Acked-by: Adrian Hunter <adrian.hunter@intel.com>
+Cc: stable@vger.kernel.org
+Link: https://lore.kernel.org/r/20240410191639.526324-4-hdegoede@redhat.com
+Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/mmc/host/sdhci-acpi.c |   25 +++++++++++++------------
+ 1 file changed, 13 insertions(+), 12 deletions(-)
+
+--- a/drivers/mmc/host/sdhci-acpi.c
++++ b/drivers/mmc/host/sdhci-acpi.c
+@@ -795,9 +795,22 @@ static const struct acpi_device_id sdhci
+ };
+ MODULE_DEVICE_TABLE(acpi, sdhci_acpi_ids);
++/* Please keep this list sorted alphabetically */
+ static const struct dmi_system_id sdhci_acpi_quirks[] = {
+       {
+               /*
++               * The Acer Aspire Switch 10 (SW5-012) microSD slot always
++               * reports the card being write-protected even though microSD
++               * cards do not have a write-protect switch at all.
++               */
++              .matches = {
++                      DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
++                      DMI_MATCH(DMI_PRODUCT_NAME, "Aspire SW5-012"),
++              },
++              .driver_data = (void *)DMI_QUIRK_SD_NO_WRITE_PROTECT,
++      },
++      {
++              /*
+                * The Lenovo Miix 320-10ICR has a bug in the _PS0 method of
+                * the SHC1 ACPI device, this bug causes it to reprogram the
+                * wrong LDO (DLDO3) to 1.8V if 1.8V modes are used and the
+@@ -812,18 +825,6 @@ static const struct dmi_system_id sdhci_
+       },
+       {
+               /*
+-               * The Acer Aspire Switch 10 (SW5-012) microSD slot always
+-               * reports the card being write-protected even though microSD
+-               * cards do not have a write-protect switch at all.
+-               */
+-              .matches = {
+-                      DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
+-                      DMI_MATCH(DMI_PRODUCT_NAME, "Aspire SW5-012"),
+-              },
+-              .driver_data = (void *)DMI_QUIRK_SD_NO_WRITE_PROTECT,
+-      },
+-      {
+-              /*
+                * The Toshiba WT8-B's microSD slot always reports the card being
+                * write-protected.
+                */
index f4b88a5aaa34279a37d347abba17101039b30d1e..123533f00b9d68c3eecc50092c5e3331eea57112 100644 (file)
@@ -360,3 +360,16 @@ acpi-resource-do-irq-override-on-tongfang-gxxhrxx-and-gmxhgxx.patch
 arm64-tegra-correct-tegra132-i2c-alias.patch
 arm64-dts-qcom-qcs404-fix-bluetooth-device-address.patch
 md-raid5-fix-deadlock-that-raid5d-wait-for-itself-to-clear-md_sb_change_pending.patch
+wifi-rtl8xxxu-fix-the-tx-power-of-rtl8192cu-rtl8723au.patch
+wifi-rtlwifi-rtl8192de-fix-low-speed-with-wpa3-sae.patch
+wifi-rtlwifi-rtl8192de-fix-endianness-issue-in-rx-path.patch
+arm64-dts-hi3798cv200-fix-the-size-of-gicr.patch
+media-mc-mark-the-media-devnode-as-registered-from-the-start.patch
+media-mxl5xx-move-xpt-structures-off-stack.patch
+media-v4l2-core-hold-videodev_lock-until-dev-reg-finishes.patch
+mmc-core-add-mmc_gpiod_set_cd_config-function.patch
+mmc-sdhci-acpi-sort-dmi-quirks-alphabetically.patch
+mmc-sdhci-acpi-fix-lenovo-yoga-tablet-2-pro-1380-sdcard-slot-not-working.patch
+mmc-sdhci-acpi-disable-write-protect-detection-on-toshiba-wt10-a.patch
+fbdev-savage-handle-err-return-when-savagefb_check_var-failed.patch
+drm-amdgpu-atomfirmware-add-intergrated-info-v2.3-table.patch
diff --git a/queue-5.15/wifi-rtl8xxxu-fix-the-tx-power-of-rtl8192cu-rtl8723au.patch b/queue-5.15/wifi-rtl8xxxu-fix-the-tx-power-of-rtl8192cu-rtl8723au.patch
new file mode 100644 (file)
index 0000000..bd78e52
--- /dev/null
@@ -0,0 +1,98 @@
+From 08b5d052d17a89bb8706b2888277d0b682dc1610 Mon Sep 17 00:00:00 2001
+From: Bitterblue Smith <rtl8821cerfe2@gmail.com>
+Date: Mon, 15 Apr 2024 23:59:05 +0300
+Subject: wifi: rtl8xxxu: Fix the TX power of RTL8192CU, RTL8723AU
+
+From: Bitterblue Smith <rtl8821cerfe2@gmail.com>
+
+commit 08b5d052d17a89bb8706b2888277d0b682dc1610 upstream.
+
+Don't subtract 1 from the power index. This was added in commit
+2fc0b8e5a17d ("rtl8xxxu: Add TX power base values for gen1 parts")
+for unknown reasons. The vendor drivers don't do this.
+
+Also correct the calculations of values written to
+REG_OFDM0_X{C,D}_TX_IQ_IMBALANCE. According to the vendor driver,
+these are used for TX power training.
+
+With these changes rtl8xxxu sets the TX power of RTL8192CU the same
+as the vendor driver.
+
+None of this appears to have any effect on my RTL8192CU device.
+
+Cc: stable@vger.kernel.org
+Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
+Reviewed-by: Ping-Ke Shih <pkshih@realtek.com>
+Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
+Link: https://msgid.link/6ae5945b-644e-45e4-a78f-4c7d9c987910@gmail.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c |   26 +++++++-----------
+ 1 file changed, 11 insertions(+), 15 deletions(-)
+
+--- a/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
++++ b/drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c
+@@ -28,6 +28,7 @@
+ #include <linux/wireless.h>
+ #include <linux/firmware.h>
+ #include <linux/moduleparam.h>
++#include <linux/bitfield.h>
+ #include <net/mac80211.h>
+ #include "rtl8xxxu.h"
+ #include "rtl8xxxu_regs.h"
+@@ -1389,13 +1390,13 @@ rtl8xxxu_gen1_set_tx_power(struct rtl8xx
+       u8 cck[RTL8723A_MAX_RF_PATHS], ofdm[RTL8723A_MAX_RF_PATHS];
+       u8 ofdmbase[RTL8723A_MAX_RF_PATHS], mcsbase[RTL8723A_MAX_RF_PATHS];
+       u32 val32, ofdm_a, ofdm_b, mcs_a, mcs_b;
+-      u8 val8;
++      u8 val8, base;
+       int group, i;
+       group = rtl8xxxu_gen1_channel_to_group(channel);
+-      cck[0] = priv->cck_tx_power_index_A[group] - 1;
+-      cck[1] = priv->cck_tx_power_index_B[group] - 1;
++      cck[0] = priv->cck_tx_power_index_A[group];
++      cck[1] = priv->cck_tx_power_index_B[group];
+       if (priv->hi_pa) {
+               if (cck[0] > 0x20)
+@@ -1406,10 +1407,6 @@ rtl8xxxu_gen1_set_tx_power(struct rtl8xx
+       ofdm[0] = priv->ht40_1s_tx_power_index_A[group];
+       ofdm[1] = priv->ht40_1s_tx_power_index_B[group];
+-      if (ofdm[0])
+-              ofdm[0] -= 1;
+-      if (ofdm[1])
+-              ofdm[1] -= 1;
+       ofdmbase[0] = ofdm[0] + priv->ofdm_tx_power_index_diff[group].a;
+       ofdmbase[1] = ofdm[1] + priv->ofdm_tx_power_index_diff[group].b;
+@@ -1498,20 +1495,19 @@ rtl8xxxu_gen1_set_tx_power(struct rtl8xx
+       rtl8xxxu_write32(priv, REG_TX_AGC_A_MCS15_MCS12,
+                        mcs_a + power_base->reg_0e1c);
++      val8 = u32_get_bits(mcs_a + power_base->reg_0e1c, 0xff000000);
+       for (i = 0; i < 3; i++) {
+-              if (i != 2)
+-                      val8 = (mcsbase[0] > 8) ? (mcsbase[0] - 8) : 0;
+-              else
+-                      val8 = (mcsbase[0] > 6) ? (mcsbase[0] - 6) : 0;
++              base = i != 2 ? 8 : 6;
++              val8 = max_t(int, val8 - base, 0);
+               rtl8xxxu_write8(priv, REG_OFDM0_XC_TX_IQ_IMBALANCE + i, val8);
+       }
++
+       rtl8xxxu_write32(priv, REG_TX_AGC_B_MCS15_MCS12,
+                        mcs_b + power_base->reg_0868);
++      val8 = u32_get_bits(mcs_b + power_base->reg_0868, 0xff000000);
+       for (i = 0; i < 3; i++) {
+-              if (i != 2)
+-                      val8 = (mcsbase[1] > 8) ? (mcsbase[1] - 8) : 0;
+-              else
+-                      val8 = (mcsbase[1] > 6) ? (mcsbase[1] - 6) : 0;
++              base = i != 2 ? 8 : 6;
++              val8 = max_t(int, val8 - base, 0);
+               rtl8xxxu_write8(priv, REG_OFDM0_XD_TX_IQ_IMBALANCE + i, val8);
+       }
+ }
diff --git a/queue-5.15/wifi-rtlwifi-rtl8192de-fix-endianness-issue-in-rx-path.patch b/queue-5.15/wifi-rtlwifi-rtl8192de-fix-endianness-issue-in-rx-path.patch
new file mode 100644 (file)
index 0000000..cfe5403
--- /dev/null
@@ -0,0 +1,171 @@
+From 2f228d364da95ab58f63a3fedc00d5b2b7db16ab Mon Sep 17 00:00:00 2001
+From: Bitterblue Smith <rtl8821cerfe2@gmail.com>
+Date: Thu, 25 Apr 2024 21:13:12 +0300
+Subject: wifi: rtlwifi: rtl8192de: Fix endianness issue in RX path
+
+From: Bitterblue Smith <rtl8821cerfe2@gmail.com>
+
+commit 2f228d364da95ab58f63a3fedc00d5b2b7db16ab upstream.
+
+Structs rx_desc_92d and rx_fwinfo_92d will not work for big endian
+systems.
+
+Delete rx_desc_92d because it's big and barely used, and instead use
+the get_rx_desc_rxmcs and get_rx_desc_rxht functions, which work on big
+endian systems too.
+
+Fix rx_fwinfo_92d by duplicating four of its members in the correct
+order.
+
+Tested only with RTL8192DU, which will use the same code.
+Tested only on a little endian system.
+
+Cc: stable@vger.kernel.org
+Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
+Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
+Link: https://msgid.link/698463da-5ef1-40c7-b744-fa51ad847caf@gmail.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.c |   16 ++--
+ drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.h |   65 ++-----------------
+ 2 files changed, 15 insertions(+), 66 deletions(-)
+
+--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.c
++++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.c
+@@ -35,7 +35,7 @@ static long _rtl92de_translate_todbm(str
+ static void _rtl92de_query_rxphystatus(struct ieee80211_hw *hw,
+                                      struct rtl_stats *pstats,
+-                                     struct rx_desc_92d *pdesc,
++                                     __le32 *pdesc,
+                                      struct rx_fwinfo_92d *p_drvinfo,
+                                      bool packet_match_bssid,
+                                      bool packet_toself,
+@@ -49,8 +49,10 @@ static void _rtl92de_query_rxphystatus(s
+       u8 i, max_spatial_stream;
+       u32 rssi, total_rssi = 0;
+       bool is_cck_rate;
++      u8 rxmcs;
+-      is_cck_rate = RX_HAL_IS_CCK_RATE(pdesc->rxmcs);
++      rxmcs = get_rx_desc_rxmcs(pdesc);
++      is_cck_rate = rxmcs <= DESC_RATE11M;
+       pstats->packet_matchbssid = packet_match_bssid;
+       pstats->packet_toself = packet_toself;
+       pstats->packet_beacon = packet_beacon;
+@@ -158,8 +160,8 @@ static void _rtl92de_query_rxphystatus(s
+               pstats->rx_pwdb_all = pwdb_all;
+               pstats->rxpower = rx_pwr_all;
+               pstats->recvsignalpower = rx_pwr_all;
+-              if (pdesc->rxht && pdesc->rxmcs >= DESC_RATEMCS8 &&
+-                  pdesc->rxmcs <= DESC_RATEMCS15)
++              if (get_rx_desc_rxht(pdesc) && rxmcs >= DESC_RATEMCS8 &&
++                  rxmcs <= DESC_RATEMCS15)
+                       max_spatial_stream = 2;
+               else
+                       max_spatial_stream = 1;
+@@ -365,7 +367,7 @@ static void _rtl92de_process_phyinfo(str
+ static void _rtl92de_translate_rx_signal_stuff(struct ieee80211_hw *hw,
+                                              struct sk_buff *skb,
+                                              struct rtl_stats *pstats,
+-                                             struct rx_desc_92d *pdesc,
++                                             __le32 *pdesc,
+                                              struct rx_fwinfo_92d *p_drvinfo)
+ {
+       struct rtl_mac *mac = rtl_mac(rtl_priv(hw));
+@@ -441,9 +443,7 @@ bool rtl92de_rx_query_desc(struct ieee80
+       if (phystatus) {
+               p_drvinfo = (struct rx_fwinfo_92d *)(skb->data +
+                                                    stats->rx_bufshift);
+-              _rtl92de_translate_rx_signal_stuff(hw,
+-                                                 skb, stats,
+-                                                 (struct rx_desc_92d *)pdesc,
++              _rtl92de_translate_rx_signal_stuff(hw, skb, stats, pdesc,
+                                                  p_drvinfo);
+       }
+       /*rx_status->qual = stats->signal; */
+--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.h
++++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.h
+@@ -394,10 +394,17 @@ struct rx_fwinfo_92d {
+       u8 csi_target[2];
+       u8 sigevm;
+       u8 max_ex_pwr;
++#ifdef __LITTLE_ENDIAN
+       u8 ex_intf_flag:1;
+       u8 sgi_en:1;
+       u8 rxsc:2;
+       u8 reserve:4;
++#else
++      u8 reserve:4;
++      u8 rxsc:2;
++      u8 sgi_en:1;
++      u8 ex_intf_flag:1;
++#endif
+ } __packed;
+ struct tx_desc_92d {
+@@ -502,64 +509,6 @@ struct tx_desc_92d {
+       u32 reserve_pass_pcie_mm_limit[4];
+ } __packed;
+-struct rx_desc_92d {
+-      u32 length:14;
+-      u32 crc32:1;
+-      u32 icverror:1;
+-      u32 drv_infosize:4;
+-      u32 security:3;
+-      u32 qos:1;
+-      u32 shift:2;
+-      u32 phystatus:1;
+-      u32 swdec:1;
+-      u32 lastseg:1;
+-      u32 firstseg:1;
+-      u32 eor:1;
+-      u32 own:1;
+-
+-      u32 macid:5;
+-      u32 tid:4;
+-      u32 hwrsvd:5;
+-      u32 paggr:1;
+-      u32 faggr:1;
+-      u32 a1_fit:4;
+-      u32 a2_fit:4;
+-      u32 pam:1;
+-      u32 pwr:1;
+-      u32 moredata:1;
+-      u32 morefrag:1;
+-      u32 type:2;
+-      u32 mc:1;
+-      u32 bc:1;
+-
+-      u32 seq:12;
+-      u32 frag:4;
+-      u32 nextpktlen:14;
+-      u32 nextind:1;
+-      u32 rsvd:1;
+-
+-      u32 rxmcs:6;
+-      u32 rxht:1;
+-      u32 amsdu:1;
+-      u32 splcp:1;
+-      u32 bandwidth:1;
+-      u32 htc:1;
+-      u32 tcpchk_rpt:1;
+-      u32 ipcchk_rpt:1;
+-      u32 tcpchk_valid:1;
+-      u32 hwpcerr:1;
+-      u32 hwpcind:1;
+-      u32 iv0:16;
+-
+-      u32 iv1;
+-
+-      u32 tsfl;
+-
+-      u32 bufferaddress;
+-      u32 bufferaddress64;
+-
+-} __packed;
+-
+ void rtl92de_tx_fill_desc(struct ieee80211_hw *hw,
+                         struct ieee80211_hdr *hdr, u8 *pdesc,
+                         u8 *pbd_desc_tx, struct ieee80211_tx_info *info,
diff --git a/queue-5.15/wifi-rtlwifi-rtl8192de-fix-low-speed-with-wpa3-sae.patch b/queue-5.15/wifi-rtlwifi-rtl8192de-fix-low-speed-with-wpa3-sae.patch
new file mode 100644 (file)
index 0000000..123391d
--- /dev/null
@@ -0,0 +1,80 @@
+From a7c0f48410f546772ac94a0f7b7291a15c4fc173 Mon Sep 17 00:00:00 2001
+From: Bitterblue Smith <rtl8821cerfe2@gmail.com>
+Date: Thu, 25 Apr 2024 21:12:38 +0300
+Subject: wifi: rtlwifi: rtl8192de: Fix low speed with WPA3-SAE
+
+From: Bitterblue Smith <rtl8821cerfe2@gmail.com>
+
+commit a7c0f48410f546772ac94a0f7b7291a15c4fc173 upstream.
+
+Some (all?) management frames are incorrectly reported to mac80211 as
+decrypted when actually the hardware did not decrypt them. This results
+in speeds 3-5 times lower than expected, 20-30 Mbps instead of 100
+Mbps.
+
+Fix this by checking the encryption type field of the RX descriptor.
+rtw88 does the same thing.
+
+This fix was tested only with rtl8192du, which will use the same code.
+
+Cc: stable@vger.kernel.org
+Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com>
+Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
+Link: https://msgid.link/4d600435-f0ea-46b0-bdb4-e60f173da8dd@gmail.com
+Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
+---
+ drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.c |    5 ++---
+ drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.h |   14 ++++++++++++++
+ 2 files changed, 16 insertions(+), 3 deletions(-)
+
+--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.c
++++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.c
+@@ -414,7 +414,8 @@ bool rtl92de_rx_query_desc(struct ieee80
+       stats->icv = (u16)get_rx_desc_icv(pdesc);
+       stats->crc = (u16)get_rx_desc_crc32(pdesc);
+       stats->hwerror = (stats->crc | stats->icv);
+-      stats->decrypted = !get_rx_desc_swdec(pdesc);
++      stats->decrypted = !get_rx_desc_swdec(pdesc) &&
++                         get_rx_desc_enc_type(pdesc) != RX_DESC_ENC_NONE;
+       stats->rate = (u8)get_rx_desc_rxmcs(pdesc);
+       stats->shortpreamble = (u16)get_rx_desc_splcp(pdesc);
+       stats->isampdu = (bool)(get_rx_desc_paggr(pdesc) == 1);
+@@ -427,8 +428,6 @@ bool rtl92de_rx_query_desc(struct ieee80
+       rx_status->band = hw->conf.chandef.chan->band;
+       if (get_rx_desc_crc32(pdesc))
+               rx_status->flag |= RX_FLAG_FAILED_FCS_CRC;
+-      if (!get_rx_desc_swdec(pdesc))
+-              rx_status->flag |= RX_FLAG_DECRYPTED;
+       if (get_rx_desc_bw(pdesc))
+               rx_status->bw = RATE_INFO_BW_40;
+       if (get_rx_desc_rxht(pdesc))
+--- a/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.h
++++ b/drivers/net/wireless/realtek/rtlwifi/rtl8192de/trx.h
+@@ -14,6 +14,15 @@
+ #define USB_HWDESC_HEADER_LEN                 32
+ #define CRCLENGTH                             4
++enum rtl92d_rx_desc_enc {
++      RX_DESC_ENC_NONE        = 0,
++      RX_DESC_ENC_WEP40       = 1,
++      RX_DESC_ENC_TKIP_WO_MIC = 2,
++      RX_DESC_ENC_TKIP_MIC    = 3,
++      RX_DESC_ENC_AES         = 4,
++      RX_DESC_ENC_WEP104      = 5,
++};
++
+ /* macros to read/write various fields in RX or TX descriptors */
+ static inline void set_tx_desc_pkt_size(__le32 *__pdesc, u32 __val)
+@@ -246,6 +255,11 @@ static inline u32 get_rx_desc_drv_info_s
+       return le32_get_bits(*__pdesc, GENMASK(19, 16));
+ }
++static inline u32 get_rx_desc_enc_type(__le32 *__pdesc)
++{
++      return le32_get_bits(*__pdesc, GENMASK(22, 20));
++}
++
+ static inline u32 get_rx_desc_shift(__le32 *__pdesc)
+ {
+       return le32_get_bits(*__pdesc, GENMASK(25, 24));