sunxi, media: Realtek rtl8723cs driver consolidation (step 2) (#4924)

* sunxi: remove rtl8723cs patches from sunxi-edge (6.2)
 * adjust minor pinephone patch
* media: remove rtl8723cs patches from media-edge
* media: remove rtl8723cs patches from media-current (6.1)
* sunxi: reinstate rtl8723cs patches for sunxi-6.1 and disable them
* sunxi: reinstate rtl8723cs patches for 6.2 and disable them
This commit is contained in:
Paolo
2023-03-10 19:15:10 +01:00
committed by GitHub
parent 17023a2336
commit fd022527f3
48 changed files with 449804 additions and 562 deletions

View File

@@ -0,0 +1,12 @@
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
index 53f4c1f66..1a5c51182 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
@@ -468,6 +468,7 @@ &cpu3 {
&csi {
pinctrl-0 = <&csi_pins>, <&csi_mclk_pin>;
status = "okay";
+ keep-power-in-suspend;
port {
#address-cells = <1>;

View File

@@ -0,0 +1,85 @@
From b54be0c0f44469b45d2580bd4b9e260a212e1932 Mon Sep 17 00:00:00 2001
From: Ondrej Jirman <megi@xff.cz>
Date: Thu, 18 Aug 2022 02:24:08 +0200
Subject: [PATCH 138/389] 8723cs: Adapt to API changes in stable (5.19.2) and
6.0
---
.../rtl8723cs/os_dep/linux/ioctl_cfg80211.c | 26 +++----------------
1 file changed, 4 insertions(+), 22 deletions(-)
diff --git a/drivers/staging/rtl8723cs/os_dep/linux/ioctl_cfg80211.c b/drivers/staging/rtl8723cs/os_dep/linux/ioctl_cfg80211.c
index ca999734af96..e84386a81bce 100644
--- a/drivers/staging/rtl8723cs/os_dep/linux/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723cs/os_dep/linux/ioctl_cfg80211.c
@@ -445,40 +445,21 @@ u8 rtw_cfg80211_ch_switch_notify(_adapter *adapter, u8 ch, u8 bw, u8 offset,
struct wiphy *wiphy = adapter_to_wiphy(adapter);
u8 ret = _SUCCESS;
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0))
struct cfg80211_chan_def chdef;
ret = rtw_chbw_to_cfg80211_chan_def(wiphy, &chdef, ch, bw, offset, ht);
if (ret != _SUCCESS)
goto exit;
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0))
if (started) {
cfg80211_ch_switch_started_notify(adapter->pnetdev, &chdef, 0, false);
goto exit;
}
-#endif
-
- if (!rtw_cfg80211_allow_ch_switch_notify(adapter))
- goto exit;
-
- cfg80211_ch_switch_notify(adapter->pnetdev, &chdef);
-
-#else
- int freq = rtw_ch2freq(ch);
- enum nl80211_channel_type ctype;
if (!rtw_cfg80211_allow_ch_switch_notify(adapter))
goto exit;
- if (!freq) {
- ret = _FAIL;
- goto exit;
- }
-
- ctype = rtw_chbw_to_nl80211_channel_type(ch, bw, offset, ht);
- cfg80211_ch_switch_notify(adapter->pnetdev, freq, ctype);
-#endif
+ cfg80211_ch_switch_notify(adapter->pnetdev, &chdef, 0);
exit:
return ret;
@@ -5348,7 +5329,7 @@ static int cfg80211_rtw_change_beacon(struct wiphy *wiphy, struct net_device *nd
return ret;
}
-static int cfg80211_rtw_stop_ap(struct wiphy *wiphy, struct net_device *ndev)
+static int cfg80211_rtw_stop_ap(struct wiphy *wiphy, struct net_device *ndev, unsigned int link_id)
{
_adapter *adapter = (_adapter *)rtw_netdev_priv(ndev);
@@ -6725,6 +6706,7 @@ static int cfg80211_rtw_del_virtual_intf(struct wiphy *wiphy,
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0))
static int cfg80211_rtw_get_channel(struct wiphy *wiphy,
struct wireless_dev *wdev,
+ unsigned int link_id,
struct cfg80211_chan_def *chandef)
{
_adapter *padapter = wiphy_to_adapter(wiphy);
@@ -10652,7 +10634,7 @@ void rtw_wdev_unregister(struct wireless_dev *wdev)
rtw_cfg80211_indicate_scan_done(adapter, _TRUE);
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)) || defined(COMPAT_KERNEL_RELEASE)
- if (wdev->current_bss) {
+ if (wdev->connected) {
RTW_INFO(FUNC_ADPT_FMT" clear current_bss by cfg80211_disconnected\n", FUNC_ADPT_ARG(adapter));
rtw_cfg80211_indicate_disconnect(adapter, 0, 1);
}
--
2.35.3

View File

@@ -0,0 +1,27 @@
From d3a862f7bdb4892e1da6a1e2fd8df48a72b0d6eb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= <megi@xff.cz>
Date: Thu, 6 Jan 2022 15:04:18 +0100
Subject: [PATCH 134/389] 8723cs: Clear wowlan_last_wake_reason prior to
suspend
Signed-off-by: Ondrej Jirman <megi@xff.cz>
---
drivers/staging/rtl8723cs/os_dep/linux/os_intfs.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/staging/rtl8723cs/os_dep/linux/os_intfs.c b/drivers/staging/rtl8723cs/os_dep/linux/os_intfs.c
index c982c2d0447b..86572d7c17da 100644
--- a/drivers/staging/rtl8723cs/os_dep/linux/os_intfs.c
+++ b/drivers/staging/rtl8723cs/os_dep/linux/os_intfs.c
@@ -4904,6 +4904,8 @@ int rtw_suspend_wow(_adapter *padapter)
#endif
if (pwrpriv->wowlan_mode == _TRUE) {
+ pwrpriv->wowlan_last_wake_reason = 0;
+
rtw_mi_netif_stop_queue(padapter);
#ifdef CONFIG_CONCURRENT_MODE
rtw_mi_buddy_netif_carrier_off(padapter);
--
2.35.3

View File

@@ -0,0 +1,28 @@
From 1a14d6f8e418a714fdc5a104c898245c1e18c9f0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= <megi@xff.cz>
Date: Sat, 28 Nov 2020 05:21:47 +0100
Subject: [PATCH 123/389] 8723cs: Disable CONFIG_CONCURRENT_MODE
Breaks assumptions of Linux userspace SW.
Signed-off-by: Ondrej Jirman <megi@xff.cz>
---
drivers/staging/rtl8723cs/Makefile | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/staging/rtl8723cs/Makefile b/drivers/staging/rtl8723cs/Makefile
index 39698340c279..5ef5557e58b7 100644
--- a/drivers/staging/rtl8723cs/Makefile
+++ b/drivers/staging/rtl8723cs/Makefile
@@ -1332,8 +1332,6 @@ endif
ifeq ($(CONFIG_PLATFORM_I386_PC), y)
EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
-EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE
-EXTRA_CFLAGS += -DCONFIG_RADIO_WORK
EXTRA_CFLAGS += -DCONFIG_RTW_80211R
SUBARCH := $(shell uname -m | sed -e s/i.86/i386/)
--
2.35.3

View File

@@ -0,0 +1,26 @@
From 54d55bfdfef5ef157d1169ab32b4023600068f07 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= <megi@xff.cz>
Date: Wed, 25 Nov 2020 14:22:12 +0100
Subject: [PATCH 119/389] 8723cs: Disable power saving
Signed-off-by: Ondrej Jirman <megi@xff.cz>
---
drivers/staging/rtl8723cs/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/rtl8723cs/Makefile b/drivers/staging/rtl8723cs/Makefile
index 9630ff30d313..5ffaa333f065 100644
--- a/drivers/staging/rtl8723cs/Makefile
+++ b/drivers/staging/rtl8723cs/Makefile
@@ -55,7 +55,7 @@ CONFIG_GSPI_HCI = n
CONFIG_AP_MODE = y
CONFIG_P2P = y
CONFIG_MP_INCLUDED = y
-CONFIG_POWER_SAVING = y
+CONFIG_POWER_SAVING = n
CONFIG_IPS_MODE = default
CONFIG_LPS_MODE = default
CONFIG_USB_AUTOSUSPEND = n
--
2.35.3

View File

@@ -0,0 +1,67 @@
From ac9a0c27c9f23deca32b99ef06b663c6010856fd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= <megi@xff.cz>
Date: Sat, 8 May 2021 19:10:06 +0200
Subject: [PATCH 130/389] 8723cs: Disable use of NAPI
It's useless anyway, since the driver doesn't disable interrupts,
and doesn't poll the HW directly either, but keeps RX interrupt
enabled and polls the queue that's filled from a HW interrupt.
Driver's NAPI implementation is borked anyway, and prevents
the NOHZ tick-stop for no reason:
sshd-179 [000] ...2 53.703997: net_dev_queue: dev=wlan0 skbaddr=00000000bc90a6f7 len=102
sshd-179 [000] ...4 53.704055: net_dev_start_xmit: dev=wlan0 queue_mapping=3 skbaddr=00000000bc90a6f7 vlan_tagged=0 vlan_proto=0x0000 vlan_tci=0x0000 protocol=0x0800 ip_summed=0 len=102 data_len=36 network_offset=14 transport_offset_valid=1 transport_offset=34 tx_flags=0 gso_size=0 gso_segs=1 gso_type=0x1
sshd-179 [000] ...4 53.704148: net_dev_xmit: dev=wlan0 skbaddr=00000000bc90a6f7 len=102 rc=0
<idle>-0 [003] d..3 53.715751: console: NOHZ tick-stop error: Non-RCU local softirq work is pending, handler #08!!!
<idle>-0 [003] d..3 53.729021: console: NOHZ tick-stop error: Non-RCU local softirq work is pending, handler #08!!!
<idle>-0 [003] ..s2 53.742200: napi_gro_receive_entry: dev=wlan0 napi_id=0x5 queue_mapping=0 skbaddr=0000000019168844 vlan_tagged=0 vlan_proto=0x0000 vlan_tci=0x0000 protocol=0x0800 ip_summed=0 hash=0x00000000 l4_hash=0 len=52 data_len=0 truesize=768 mac_header_valid=1 mac_header=-14 nr_frags=0 gso_size=0 gso_type=0x0
<idle>-0 [003] ..s2 53.742235: napi_gro_receive_exit: ret=3
<idle>-0 [003] ..s3 53.742246: netif_receive_skb: dev=wlan0 skbaddr=0000000019168844 len=52
RTW_RECV_THREAD-150 [003] d..2 53.776890: console: RTW: unknown vendor specific information element ignored (vendor OUI 00:0c:42 len=42)
RTW_RECV_THREAD-150 [003] d..2 53.791187: console: RTW: Unknown Broadcom information element ignored (type=52 len=26)
<idle>-0 [003] d..3 53.803880: console: NOHZ tick-stop error: Non-RCU local softirq work is pending, handler #08!!!
<idle>-0 [003] d..3 53.817165: console: NOHZ tick-stop error: Non-RCU local softirq work is pending, handler #08!!!
<idle>-0 [003] d..3 53.876772: console: NOHZ tick-stop error: Non-RCU local softirq work is pending, handler #08!!!
RTW_RECV_THREAD-150 [003] d..2 53.890125: console: RTW: unknown vendor specific information element ignored (vendor OUI 00:0c:42 len=42)
RTW_RECV_THREAD-150 [003] d..2 53.904219: console: RTW: Unknown Broadcom information element ignored (type=52 len=26)
<idle>-0 [003] d..3 53.916667: console: NOHZ tick-stop error: Non-RCU local softirq work is pending, handler #08!!!
<idle>-0 [003] d..3 53.929825: console: NOHZ tick-stop error: Non-RCU local softirq work is pending, handler #08!!!
RTW_RECV_THREAD-150 [003] d..2 53.981709: console: RTW: unknown vendor specific information element ignored (vendor OUI 00:0c:42 len=42)
RTW_RECV_THREAD-150 [003] d..2 53.995976: console: RTW: Unknown Broadcom information element ignored (type=52 len=26)
<idle>-0 [003] d..3 54.008419: console: NOHZ tick-stop error: Non-RCU local softirq work is pending, handler #08!!!
<idle>-0 [003] d..3 54.021585: console: NOHZ tick-stop error: Non-RCU local softirq work is pending, handler #08!!!
<idle>-0 [003] d..3 54.042131: console: NOHZ tick-stop error: Non-RCU local softirq work is pending, handler #08!!!
<idle>-0 [003] d..3 54.055198: console: NOHZ tick-stop error: Non-RCU local softirq work is pending, handler #08!!!
<idle>-0 [003] ..s2 54.068195: napi_gro_receive_entry: dev=wlan0 napi_id=0x5 queue_mapping=0 skbaddr=0000000019168844 vlan_tagged=0 vlan_proto=0x0000 vlan_tci=0x0000 protocol=0x0800 ip_summed=0 hash=0x00000000 l4_hash=0 len=88 data_len=0 truesize=1280 mac_header_valid=1 mac_header=-14 nr_frags=0 gso_size=0 gso_type=0x0
<idle>-0 [003] ..s2 54.068235: napi_gro_receive_exit: ret=3
<idle>-0 [003] ..s3 54.068248: netif_receive_skb: dev=wlan0 skbaddr=0000000019168844 len=88
sshd-179 [000] ...2 54.070127: net_dev_queue: dev=wlan0 skbaddr=00000000debb8826 len=118
sshd-179 [000] ...4 54.070194: net_dev_start_xmit: dev=wlan0 queue_mapping=3 skbaddr=00000000debb8826 vlan_tagged=0 vlan_proto=0x0000 vlan_tci=0x0000 protocol=0x0800 ip_summed=0 len=118 data_len=52 network_offset=14 transport_offset_valid=1 transport_offset=34 tx_flags=0 gso_size=0 gso_segs=1 gso_type=0x1
sshd-179 [000] ...4 54.070328: net_dev_xmit: dev=wlan0 skbaddr=00000000debb8826 len=118 rc=0
RTW_RECV_THREAD-150 [003] d..2 54.080901: console: RTW: unknown vendor specific information element ignored (vendor OUI 00:0c:42 len=42)
RTW_RECV_THREAD-150 [003] d..2 54.095095: console: RTW: Unknown Broadcom information element ignored (type=52 len=26)
Signed-off-by: Ondrej Jirman <megi@xff.cz>
---
drivers/staging/rtl8723cs/Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/rtl8723cs/Makefile b/drivers/staging/rtl8723cs/Makefile
index b428d679e83e..a709256357f9 100644
--- a/drivers/staging/rtl8723cs/Makefile
+++ b/drivers/staging/rtl8723cs/Makefile
@@ -81,8 +81,8 @@ CONFIG_TDLS = y
CONFIG_WIFI_MONITOR = y
CONFIG_MCC_MODE = n
CONFIG_APPEND_VENDOR_IE_ENABLE = n
-CONFIG_RTW_NAPI = y
-CONFIG_RTW_GRO = y
+CONFIG_RTW_NAPI = n
+CONFIG_RTW_GRO = n
CONFIG_RTW_NETIF_SG = y
CONFIG_RTW_IPCAM_APPLICATION = n
CONFIG_RTW_REPEATER_SON = n
--
2.35.3

View File

@@ -0,0 +1,63 @@
From d54377cc8fb8b924078a7be92ec16de46a7f28e2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= <megi@xff.cz>
Date: Wed, 25 Nov 2020 14:19:38 +0100
Subject: [PATCH 113/389] 8723cs: Enable OOB interrupt
Patch ported from Icenowy
Signed-off-by: Ondrej Jirman <megi@xff.cz>
---
.../staging/rtl8723cs/os_dep/linux/sdio_intf.c | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/rtl8723cs/os_dep/linux/sdio_intf.c b/drivers/staging/rtl8723cs/os_dep/linux/sdio_intf.c
index 23964c5c64ff..5a84037f3745 100644
--- a/drivers/staging/rtl8723cs/os_dep/linux/sdio_intf.c
+++ b/drivers/staging/rtl8723cs/os_dep/linux/sdio_intf.c
@@ -18,6 +18,9 @@
#include <hal_data.h>
#include <platform_ops.h>
+#include <linux/of.h>
+#include <linux/of_irq.h>
+
#ifndef CONFIG_SDIO_HCI
#error "CONFIG_SDIO_HCI shall be on!\n"
#endif
@@ -989,6 +992,9 @@ static int rtw_drv_init(
#endif
PADAPTER padapter = NULL;
struct dvobj_priv *dvobj;
+#ifdef CONFIG_OF
+ struct device_node *np;
+#endif
#ifdef CONFIG_PLATFORM_INTEL_BYT
@@ -996,7 +1002,6 @@ static int rtw_drv_init(
acpi_handle handle;
struct acpi_device *adev;
#endif
-
#if defined(CONFIG_ACPI) && defined(CONFIG_GPIO_WAKEUP)
handle = ACPI_HANDLE(&func->dev);
@@ -1024,7 +1029,14 @@ static int rtw_drv_init(
#endif
#endif /* CONFIG_PLATFORM_INTEL_BYT */
-
+#ifdef CONFIG_OF
+ np = func->dev.of_node;
+ if (np) {
+ /* make sure there are interrupts defined in the node */
+ if (of_find_property(np, "interrupts", NULL))
+ oob_irq = irq_of_parse_and_map(np, 0);
+ }
+#endif
dvobj = sdio_dvobj_init(func, id);
if (dvobj == NULL) {
--
2.35.3

View File

@@ -0,0 +1,27 @@
From 8f087bb9638d46020a1008b8e786ffad6737b89e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= <megi@xff.cz>
Date: Sat, 28 Nov 2020 05:21:11 +0100
Subject: [PATCH 122/389] 8723cs: Enable TDLS 802.11z support (direct sta<->sta
connection)
Signed-off-by: Ondrej Jirman <megi@xff.cz>
---
drivers/staging/rtl8723cs/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/rtl8723cs/Makefile b/drivers/staging/rtl8723cs/Makefile
index 84f094719d3e..39698340c279 100644
--- a/drivers/staging/rtl8723cs/Makefile
+++ b/drivers/staging/rtl8723cs/Makefile
@@ -77,7 +77,7 @@ CONFIG_SIGNAL_SCALE_MAPPING = n
CONFIG_80211W = y
CONFIG_REDUCE_TX_CPU_LOADING = n
CONFIG_BR_EXT = y
-CONFIG_TDLS = n
+CONFIG_TDLS = y
CONFIG_WIFI_MONITOR = y
CONFIG_MCC_MODE = n
CONFIG_APPEND_VENDOR_IE_ENABLE = n
--
2.35.3

View File

@@ -0,0 +1,89 @@
From 6c2561146da911ac6061714223d17f1907719178 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= <megi@xff.cz>
Date: Fri, 19 Feb 2021 12:15:51 +0100
Subject: [PATCH] 8723cs: Enable WoWLAN
On PinePhone:
iw dev # and write down mac address, eg. 02:ba:7c:9c:cc:78
echo clean > /proc/net/rtl8723cs/wlan0/wow_pattern_info
iw phy0 wowlan enable any
... suspend to ram ...
On other device:
wol -i pinephone_ip_address 02:ba:7c:9c:cc:78
... pinephone wakes up over wifi ... :)
Figured out with help from by #linux-sunxi/Peetz0r.
Signed-off-by: Ondrej Jirman <megi@xff.cz>
---
arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi | 1 +
drivers/staging/rtl8723cs/Makefile | 4 ++--
drivers/staging/rtl8723cs/os_dep/linux/sdio_intf.c | 6 ++----
3 files changed, 5 insertions(+), 6 deletions(-)
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
index 53f4c1f66..1a5c51182 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
@@ -468,6 +468,7 @@ &cpu3 {
&csi {
pinctrl-0 = <&csi_pins>, <&csi_mclk_pin>;
status = "okay";
+ keep-power-in-suspend;
port {
#address-cells = <1>;
diff --git a/drivers/staging/rtl8723cs/Makefile b/drivers/staging/rtl8723cs/Makefile
index 60c1c864d..b428d679e 100644
--- a/drivers/staging/rtl8723cs/Makefile
+++ b/drivers/staging/rtl8723cs/Makefile
@@ -108,7 +108,7 @@ CONFIG_RTW_LOG_LEVEL = 6
CONFIG_PROC_DEBUG = y
######################## Wake On Lan ##########################
-CONFIG_WOWLAN = n
+CONFIG_WOWLAN = y
#bit3: ARP enable, bit2: deauth, bit1: unicast, bit0: magic pkt.
CONFIG_WAKEUP_TYPE = 0xf
CONFIG_WOW_LPS_MODE = default
@@ -127,7 +127,7 @@ CONFIG_PNO_SUPPORT = n
CONFIG_PNO_SET_DEBUG = n
CONFIG_AP_WOWLAN = n
######### Notify SDIO Host Keep Power During Syspend ##########
-CONFIG_RTW_SDIO_PM_KEEP_POWER = n
+CONFIG_RTW_SDIO_PM_KEEP_POWER = y
###################### MP HW TX MODE FOR VHT #######################
CONFIG_MP_VHT_HW_TX_MODE = n
###################### ROAMING #####################################
diff --git a/drivers/staging/rtl8723cs/os_dep/linux/sdio_intf.c b/drivers/staging/rtl8723cs/os_dep/linux/sdio_intf.c
index c20c136d1..d6494bad9 100644
--- a/drivers/staging/rtl8723cs/os_dep/linux/sdio_intf.c
+++ b/drivers/staging/rtl8723cs/os_dep/linux/sdio_intf.c
@@ -269,9 +269,8 @@ static u8 gpio_hostwakeup_alloc_irq(PADAPTER padapter)
} else
RTW_INFO("allocate gpio irq %d ok\n", oob_irq);
-#ifndef CONFIG_PLATFORM_ARM_SUN8I
enable_irq_wake(oob_irq);
-#endif
+
return _SUCCESS;
}
@@ -282,9 +281,8 @@ static void gpio_hostwakeup_free_irq(PADAPTER padapter)
if (oob_irq == 0)
return;
-#ifndef CONFIG_PLATFORM_ARM_SUN8I
disable_irq_wake(oob_irq);
-#endif
+
free_irq(oob_irq, padapter);
}
#endif
--
2.35.3

View File

@@ -0,0 +1,26 @@
From 79e814dc8c326f8f6092b6396513d406554b6971 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= <megi@xff.cz>
Date: Wed, 25 Nov 2020 14:22:24 +0100
Subject: [PATCH 118/389] 8723cs: Enable monitor mode
Signed-off-by: Ondrej Jirman <megi@xff.cz>
---
drivers/staging/rtl8723cs/Makefile | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/rtl8723cs/Makefile b/drivers/staging/rtl8723cs/Makefile
index b66d4e63c888..9630ff30d313 100644
--- a/drivers/staging/rtl8723cs/Makefile
+++ b/drivers/staging/rtl8723cs/Makefile
@@ -78,7 +78,7 @@ CONFIG_80211W = y
CONFIG_REDUCE_TX_CPU_LOADING = n
CONFIG_BR_EXT = y
CONFIG_TDLS = n
-CONFIG_WIFI_MONITOR = n
+CONFIG_WIFI_MONITOR = y
CONFIG_MCC_MODE = n
CONFIG_APPEND_VENDOR_IE_ENABLE = n
CONFIG_RTW_NAPI = y
--
2.35.3

View File

@@ -0,0 +1,51 @@
From 3a743bdab4fb02a6ea326e8f2f4ff3580cd08aa2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= <megi@xff.cz>
Date: Wed, 25 Nov 2020 16:56:15 +0100
Subject: [PATCH 121/389] 8723cs: Enable wifi power saving mode
This saves 350mW in idle.
Signed-off-by: Ondrej Jirman <megi@xff.cz>
---
drivers/staging/rtl8723cs/Makefile | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/rtl8723cs/Makefile b/drivers/staging/rtl8723cs/Makefile
index 5ffaa333f065..84f094719d3e 100644
--- a/drivers/staging/rtl8723cs/Makefile
+++ b/drivers/staging/rtl8723cs/Makefile
@@ -54,10 +54,10 @@ CONFIG_GSPI_HCI = n
########################## Features ###########################
CONFIG_AP_MODE = y
CONFIG_P2P = y
-CONFIG_MP_INCLUDED = y
-CONFIG_POWER_SAVING = n
-CONFIG_IPS_MODE = default
-CONFIG_LPS_MODE = default
+CONFIG_MP_INCLUDED = n
+CONFIG_POWER_SAVING = y
+CONFIG_IPS_MODE = 0
+CONFIG_LPS_MODE = 1
CONFIG_USB_AUTOSUSPEND = n
CONFIG_HW_PWRP_DETECTION = n
CONFIG_BT_COEXIST = y
@@ -65,7 +65,7 @@ CONFIG_WAPI_SUPPORT = n
CONFIG_EFUSE_CONFIG_FILE = n
CONFIG_EXT_CLK = n
CONFIG_TRAFFIC_PROTECT = n
-CONFIG_LOAD_PHY_PARA_FROM_FILE = y
+CONFIG_LOAD_PHY_PARA_FROM_FILE = n
CONFIG_TXPWR_BY_RATE = y
CONFIG_TXPWR_BY_RATE_EN = y
CONFIG_TXPWR_LIMIT = y
@@ -1334,6 +1334,7 @@ EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE
EXTRA_CFLAGS += -DCONFIG_RADIO_WORK
+EXTRA_CFLAGS += -DCONFIG_RTW_80211R
SUBARCH := $(shell uname -m | sed -e s/i.86/i386/)
ARCH ?= $(SUBARCH)
--
2.35.3

View File

@@ -0,0 +1,63 @@
From 125b16b1e216d036865ccf71fe19b2f54102915b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= <megi@xff.cz>
Date: Mon, 13 Sep 2021 14:37:39 +0200
Subject: [PATCH 132/389] 8723cs: Fix compile warnings
Signed-off-by: Ondrej Jirman <megi@xff.cz>
---
drivers/staging/rtl8723cs/core/rtw_mlme_ext.c | 4 ++--
drivers/staging/rtl8723cs/hal/hal_intf.c | 2 +-
drivers/staging/rtl8723cs/os_dep/linux/ioctl_cfg80211.c | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/drivers/staging/rtl8723cs/core/rtw_mlme_ext.c b/drivers/staging/rtl8723cs/core/rtw_mlme_ext.c
index 07aab079179b..11da273bee38 100644
--- a/drivers/staging/rtl8723cs/core/rtw_mlme_ext.c
+++ b/drivers/staging/rtl8723cs/core/rtw_mlme_ext.c
@@ -298,7 +298,7 @@ void rtw_txpwr_init_regd(struct rf_ctl_t *rfctl)
);
if (rfctl->regd_name)
break;
- /* fall through */
+ fallthrough;
default:
rfctl->regd_name = regd_str(TXPWR_LMT_WW);
RTW_PRINT("assign %s for default case\n", regd_str(TXPWR_LMT_WW));
@@ -1665,7 +1665,7 @@ void mgt_dispatcher(_adapter *padapter, union recv_frame *precv_frame)
ptable->func = &OnAuth;
else
ptable->func = &OnAuthClient;
- /* fall through */
+ fallthrough;
case WIFI_ASSOCREQ:
case WIFI_REASSOCREQ:
_mgt_dispatcher(padapter, ptable, precv_frame);
diff --git a/drivers/staging/rtl8723cs/hal/hal_intf.c b/drivers/staging/rtl8723cs/hal/hal_intf.c
index 762d1ac08fcc..c39b37b773a7 100644
--- a/drivers/staging/rtl8723cs/hal/hal_intf.c
+++ b/drivers/staging/rtl8723cs/hal/hal_intf.c
@@ -1370,7 +1370,7 @@ s32 c2h_handler(_adapter *adapter, u8 id, u8 seq, u8 plen, u8 *payload)
case C2H_EXTEND:
sub_id = payload[0];
/* no handle, goto default */
- /* fall through */
+ fallthrough;
default:
if (phydm_c2H_content_parsing(adapter_to_phydm(adapter), id, plen, payload) != TRUE)
diff --git a/drivers/staging/rtl8723cs/os_dep/linux/ioctl_cfg80211.c b/drivers/staging/rtl8723cs/os_dep/linux/ioctl_cfg80211.c
index 54424a82ce19..ca999734af96 100644
--- a/drivers/staging/rtl8723cs/os_dep/linux/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723cs/os_dep/linux/ioctl_cfg80211.c
@@ -6767,7 +6767,7 @@ static void rtw_get_chbwoff_from_cfg80211_chan_def(
switch (chandef->width) {
case NL80211_CHAN_WIDTH_20_NOHT:
*ht = 0;
- /* fall through */
+ fallthrough;
case NL80211_CHAN_WIDTH_20:
*bw = CHANNEL_WIDTH_20;
*offset = HAL_PRIME_CHNL_OFFSET_DONT_CARE;
--
2.35.3

View File

@@ -0,0 +1,88 @@
From f538db9515a0caa2e0d3942023d1775abb561407 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= <megi@xff.cz>
Date: Sat, 8 May 2021 19:10:26 +0200
Subject: [PATCH 131/389] 8723cs: Fix indentation
It was confusing.
Signed-off-by: Ondrej Jirman <megi@xff.cz>
---
.../hal/rtl8703b/sdio/rtl8703bs_recv.c | 56 +++++++++----------
1 file changed, 28 insertions(+), 28 deletions(-)
diff --git a/drivers/staging/rtl8723cs/hal/rtl8703b/sdio/rtl8703bs_recv.c b/drivers/staging/rtl8723cs/hal/rtl8703b/sdio/rtl8703bs_recv.c
index 54ed0cfb1d1e..28f715679844 100644
--- a/drivers/staging/rtl8723cs/hal/rtl8703b/sdio/rtl8703bs_recv.c
+++ b/drivers/staging/rtl8723cs/hal/rtl8703b/sdio/rtl8703bs_recv.c
@@ -142,40 +142,40 @@ s32 rtl8703bs_recv_hdl(_adapter *padapter)
#ifdef CONFIG_RTW_NAPI
#ifdef CONFIG_RTW_NAPI_V2
- if (padapter->registrypriv.en_napi) {
- struct dvobj_priv *d;
- struct _ADAPTER *a;
- u8 i;
+ if (padapter->registrypriv.en_napi) {
+ struct dvobj_priv *d;
+ struct _ADAPTER *a;
+ u8 i;
+
+ d = adapter_to_dvobj(padapter);
+ for (i = 0; i < d->iface_nums; i++) {
+ a = d->padapters[i];
+ if (rtw_if_up(a) == _TRUE)
+ napi_schedule(&a->napi);
- d = adapter_to_dvobj(padapter);
- for (i = 0; i < d->iface_nums; i++) {
- a = d->padapters[i];
- if (rtw_if_up(a) == _TRUE)
- napi_schedule(&a->napi);
-
- }
}
+ }
#endif /* CONFIG_RTW_NAPI_V2 */
#endif /* CONFIG_RTW_NAPI */
-
- return _SUCCESS;
- }
- static void rtl8703bs_recv_tasklet(void *priv)
- {
- _adapter *adapter = (_adapter *)priv;
- s32 ret;
-
- ret = rtl8703bs_recv_hdl(adapter);
- if (ret == RTW_RFRAME_UNAVAIL
- || ret == RTW_RFRAME_PKT_UNAVAIL
- ) {
- /* schedule again and hope recvframe/packet is available next time. */
- #ifdef PLATFORM_LINUX
- tasklet_schedule(&adapter->recvpriv.recv_tasklet);
- #endif
- }
+ return _SUCCESS;
+}
+
+static void rtl8703bs_recv_tasklet(void *priv)
+{
+ _adapter *adapter = (_adapter *)priv;
+ s32 ret;
+
+ ret = rtl8703bs_recv_hdl(adapter);
+ if (ret == RTW_RFRAME_UNAVAIL
+ || ret == RTW_RFRAME_PKT_UNAVAIL
+ ) {
+ /* schedule again and hope recvframe/packet is available next time. */
+ #ifdef PLATFORM_LINUX
+ tasklet_schedule(&adapter->recvpriv.recv_tasklet);
+ #endif
}
+}
#else
static void rtl8703bs_recv_tasklet(void *priv)
{
--
2.35.3

View File

@@ -0,0 +1,34 @@
From e8a24106a9dd0a33d7eb6c01e93d8ce7127c5d26 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= <megi@xff.cz>
Date: Sat, 1 May 2021 14:00:42 +0200
Subject: [PATCH 129/389] 8723cs: Fix misleading indentation
---
drivers/staging/rtl8723cs/core/efuse/rtw_efuse.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/staging/rtl8723cs/core/efuse/rtw_efuse.c b/drivers/staging/rtl8723cs/core/efuse/rtw_efuse.c
index b503f68b55df..fe414c6766a7 100644
--- a/drivers/staging/rtl8723cs/core/efuse/rtw_efuse.c
+++ b/drivers/staging/rtl8723cs/core/efuse/rtw_efuse.c
@@ -940,11 +940,12 @@ void rtw_efuse_analyze(PADAPTER padapter, u8 Type, u8 Fake)
for (i = 0; i < mapLen; i++) {
if (i % 16 == 0)
RTW_PRINT_SEL(RTW_DBGDUMP, "0x%03x: ", i);
- _RTW_PRINT_SEL(RTW_DBGDUMP, "%02X%s"
- , pEfuseHal->fakeEfuseInitMap[i]
- , ((i + 1) % 16 == 0) ? "\n" : (((i + 1) % 8 == 0) ? " " : " ")
- );
- }
+
+ _RTW_PRINT_SEL(RTW_DBGDUMP, "%02X%s"
+ , pEfuseHal->fakeEfuseInitMap[i]
+ , ((i + 1) % 16 == 0) ? "\n" : (((i + 1) % 8 == 0) ? " " : " ")
+ );
+ }
_RTW_PRINT_SEL(RTW_DBGDUMP, "\n");
out_free_buffer:
--
2.35.3

View File

@@ -0,0 +1,70 @@
From ee3e1f4596e5b68675fdd5f3da827cac5e986243 Mon Sep 17 00:00:00 2001
From: Ondrej Jirman <megi@xff.cz>
Date: Sat, 16 Jul 2022 12:08:58 +0200
Subject: [PATCH 137/389] 8723cs: Fix some compilation warnings
Signed-off-by: Ondrej Jirman <megi@xff.cz>
---
drivers/staging/rtl8723cs/core/rtw_br_ext.c | 2 +-
drivers/staging/rtl8723cs/core/rtw_sta_mgt.c | 3 +--
drivers/staging/rtl8723cs/core/rtw_tdls.c | 17 +++++++----------
3 files changed, 9 insertions(+), 13 deletions(-)
diff --git a/drivers/staging/rtl8723cs/core/rtw_br_ext.c b/drivers/staging/rtl8723cs/core/rtw_br_ext.c
index 7b5934d38446..c32036a4d32a 100644
--- a/drivers/staging/rtl8723cs/core/rtw_br_ext.c
+++ b/drivers/staging/rtl8723cs/core/rtw_br_ext.c
@@ -110,7 +110,7 @@ static __inline__ int __nat25_add_pppoe_tag(struct sk_buff *skb, struct pppoe_ta
/* have a room for new tag */
memmove(((unsigned char *)ph->tag + data_len), (unsigned char *)ph->tag, ph_len);
ph->length = htons(ph_len + data_len);
- memcpy((unsigned char *)ph->tag, tag, data_len);
+ memcpy((unsigned char *)ph->tag, (void*)tag, data_len);
return data_len;
}
diff --git a/drivers/staging/rtl8723cs/core/rtw_sta_mgt.c b/drivers/staging/rtl8723cs/core/rtw_sta_mgt.c
index 28a76fd9749a..e773b58e0fb5 100644
--- a/drivers/staging/rtl8723cs/core/rtw_sta_mgt.c
+++ b/drivers/staging/rtl8723cs/core/rtw_sta_mgt.c
@@ -388,8 +388,7 @@ void rtw_mfree_stainfo(struct sta_info *psta);
void rtw_mfree_stainfo(struct sta_info *psta)
{
- if (&psta->lock != NULL)
- _rtw_spinlock_free(&psta->lock);
+ _rtw_spinlock_free(&psta->lock);
_rtw_free_sta_xmit_priv_lock(&psta->sta_xmitpriv);
_rtw_free_sta_recv_priv_lock(&psta->sta_recvpriv);
diff --git a/drivers/staging/rtl8723cs/core/rtw_tdls.c b/drivers/staging/rtl8723cs/core/rtw_tdls.c
index d557234109be..f05e4fbc59d4 100644
--- a/drivers/staging/rtl8723cs/core/rtw_tdls.c
+++ b/drivers/staging/rtl8723cs/core/rtw_tdls.c
@@ -1075,16 +1075,13 @@ u8 *rtw_tdls_set_wmm_params(_adapter *padapter, u8 *pframe, struct pkt_attrib *p
struct mlme_ext_info *pmlmeinfo = &(pmlmeext->mlmext_info);
u8 wmm_param_ele[24] = {0};
- if (&pmlmeinfo->WMM_param) {
- _rtw_memcpy(wmm_param_ele, WMM_PARA_OUI, 6);
- if (_rtw_memcmp(&pmlmeinfo->WMM_param, &wmm_param_ele[6], 18) == _TRUE)
- /* Use default WMM Param */
- _rtw_memcpy(wmm_param_ele + 6, (u8 *)&TDLS_WMM_PARAM_IE, sizeof(TDLS_WMM_PARAM_IE));
- else
- _rtw_memcpy(wmm_param_ele + 6, (u8 *)&pmlmeinfo->WMM_param, sizeof(pmlmeinfo->WMM_param));
- return rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, 24, wmm_param_ele, &(pattrib->pktlen));
- } else
- return pframe;
+ _rtw_memcpy(wmm_param_ele, WMM_PARA_OUI, 6);
+ if (_rtw_memcmp(&pmlmeinfo->WMM_param, &wmm_param_ele[6], 18) == _TRUE)
+ /* Use default WMM Param */
+ _rtw_memcpy(wmm_param_ele + 6, (u8 *)&TDLS_WMM_PARAM_IE, sizeof(TDLS_WMM_PARAM_IE));
+ else
+ _rtw_memcpy(wmm_param_ele + 6, (u8 *)&pmlmeinfo->WMM_param, sizeof(pmlmeinfo->WMM_param));
+ return rtw_set_ie(pframe, _VENDOR_SPECIFIC_IE_, 24, wmm_param_ele, &(pattrib->pktlen));
}
#ifdef CONFIG_WFD
--
2.35.3

View File

@@ -0,0 +1,176 @@
From 976a9b51bb7c00284d2505e160a7f1315bf8a538 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= <megi@xff.cz>
Date: Sun, 23 Jan 2022 20:17:17 +0100
Subject: [PATCH 135/389] 8723cs: Forward port to 5.17
Signed-off-by: Ondrej Jirman <megi@xff.cz>
---
.../hal/rtl8703b/sdio/rtl8703bs_recv.c | 6 ++---
.../staging/rtl8723cs/os_dep/linux/os_intfs.c | 6 +++--
.../staging/rtl8723cs/os_dep/linux/rtw_proc.c | 25 ++++++-------------
.../staging/rtl8723cs/os_dep/osdep_service.c | 2 +-
4 files changed, 16 insertions(+), 23 deletions(-)
diff --git a/drivers/staging/rtl8723cs/hal/rtl8703b/sdio/rtl8703bs_recv.c b/drivers/staging/rtl8723cs/hal/rtl8703b/sdio/rtl8703bs_recv.c
index 28f715679844..dda8a8a19488 100644
--- a/drivers/staging/rtl8723cs/hal/rtl8703b/sdio/rtl8703bs_recv.c
+++ b/drivers/staging/rtl8723cs/hal/rtl8703b/sdio/rtl8703bs_recv.c
@@ -161,7 +161,7 @@ s32 rtl8703bs_recv_hdl(_adapter *padapter)
return _SUCCESS;
}
-static void rtl8703bs_recv_tasklet(void *priv)
+static void rtl8703bs_recv_tasklet(unsigned long priv)
{
_adapter *adapter = (_adapter *)priv;
s32 ret;
@@ -177,7 +177,7 @@ static void rtl8703bs_recv_tasklet(void *priv)
}
}
#else
-static void rtl8703bs_recv_tasklet(void *priv)
+static void rtl8703bs_recv_tasklet(unsigned long priv)
{
PADAPTER padapter;
PHAL_DATA_TYPE pHalData;
@@ -403,7 +403,7 @@ s32 rtl8703bs_init_recv_priv(PADAPTER padapter)
/* 3 2. init tasklet */
#ifdef PLATFORM_LINUX
tasklet_init(&precvpriv->recv_tasklet,
- (void(*)(unsigned long))rtl8703bs_recv_tasklet,
+ rtl8703bs_recv_tasklet,
(unsigned long)padapter);
#endif
diff --git a/drivers/staging/rtl8723cs/os_dep/linux/os_intfs.c b/drivers/staging/rtl8723cs/os_dep/linux/os_intfs.c
index 86572d7c17da..7fbce22c0842 100644
--- a/drivers/staging/rtl8723cs/os_dep/linux/os_intfs.c
+++ b/drivers/staging/rtl8723cs/os_dep/linux/os_intfs.c
@@ -1615,7 +1615,8 @@ static int rtw_net_set_mac_address(struct net_device *pnetdev, void *addr)
}
_rtw_memcpy(adapter_mac_addr(padapter), sa->sa_data, ETH_ALEN); /* set mac addr to adapter */
- _rtw_memcpy(pnetdev->dev_addr, sa->sa_data, ETH_ALEN); /* set mac addr to net_device */
+ //_rtw_memcpy(pnetdev->dev_addr, sa->sa_data, ETH_ALEN); /* set mac addr to net_device */
+ dev_addr_set(pnetdev, sa->sa_data);
#if 0
if (rtw_is_hw_init_completed(padapter)) {
@@ -2151,7 +2152,8 @@ int rtw_os_ndev_register(_adapter *adapter, const char *name)
/* alloc netdev name */
rtw_init_netdev_name(ndev, name);
- _rtw_memcpy(ndev->dev_addr, adapter_mac_addr(adapter), ETH_ALEN);
+ //_rtw_memcpy(ndev->dev_addr, adapter_mac_addr(adapter), ETH_ALEN);
+ dev_addr_set(ndev, adapter_mac_addr(adapter));
/* Tell the network stack we exist */
diff --git a/drivers/staging/rtl8723cs/os_dep/linux/rtw_proc.c b/drivers/staging/rtl8723cs/os_dep/linux/rtw_proc.c
index bfe65dbbc4f9..482916f2eabb 100644
--- a/drivers/staging/rtl8723cs/os_dep/linux/rtw_proc.c
+++ b/drivers/staging/rtl8723cs/os_dep/linux/rtw_proc.c
@@ -30,15 +30,6 @@ inline struct proc_dir_entry *get_rtw_drv_proc(void)
#define RTW_PROC_NAME DRV_NAME
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 9, 0))
-#define file_inode(file) ((file)->f_dentry->d_inode)
-#endif
-
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 10, 0))
-#define PDE_DATA(inode) PDE((inode))->data
-#define proc_get_parent_data(inode) PDE((inode))->parent->data
-#endif
-
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 24))
#define get_proc_net proc_net
#else
@@ -247,7 +238,7 @@ const int drv_proc_hdls_num = sizeof(drv_proc_hdls) / sizeof(struct rtw_proc_hdl
static int rtw_drv_proc_open(struct inode *inode, struct file *file)
{
/* struct net_device *dev = proc_get_parent_data(inode); */
- ssize_t index = (ssize_t)PDE_DATA(inode);
+ ssize_t index = (ssize_t)pde_data(inode);
const struct rtw_proc_hdl *hdl = drv_proc_hdls + index;
void *private = NULL;
@@ -273,7 +264,7 @@ static int rtw_drv_proc_open(struct inode *inode, struct file *file)
static ssize_t rtw_drv_proc_write(struct file *file, const char __user *buffer, size_t count, loff_t *pos)
{
- ssize_t index = (ssize_t)PDE_DATA(file_inode(file));
+ ssize_t index = (ssize_t)pde_data(file_inode(file));
const struct rtw_proc_hdl *hdl = drv_proc_hdls + index;
ssize_t (*write)(struct file *, const char __user *, size_t, loff_t *, void *) = hdl->write;
@@ -5631,7 +5622,7 @@ const int adapter_proc_hdls_num = sizeof(adapter_proc_hdls) / sizeof(struct rtw_
static int rtw_adapter_proc_open(struct inode *inode, struct file *file)
{
- ssize_t index = (ssize_t)PDE_DATA(inode);
+ ssize_t index = (ssize_t)pde_data(inode);
const struct rtw_proc_hdl *hdl = adapter_proc_hdls + index;
void *private = proc_get_parent_data(inode);
@@ -5657,7 +5648,7 @@ static int rtw_adapter_proc_open(struct inode *inode, struct file *file)
static ssize_t rtw_adapter_proc_write(struct file *file, const char __user *buffer, size_t count, loff_t *pos)
{
- ssize_t index = (ssize_t)PDE_DATA(file_inode(file));
+ ssize_t index = (ssize_t)pde_data(file_inode(file));
const struct rtw_proc_hdl *hdl = adapter_proc_hdls + index;
ssize_t (*write)(struct file *, const char __user *, size_t, loff_t *, void *) = hdl->write;
@@ -5820,7 +5811,7 @@ const int odm_proc_hdls_num = sizeof(odm_proc_hdls) / sizeof(struct rtw_proc_hdl
static int rtw_odm_proc_open(struct inode *inode, struct file *file)
{
- ssize_t index = (ssize_t)PDE_DATA(inode);
+ ssize_t index = (ssize_t)pde_data(inode);
const struct rtw_proc_hdl *hdl = odm_proc_hdls + index;
void *private = proc_get_parent_data(inode);
@@ -5846,7 +5837,7 @@ static int rtw_odm_proc_open(struct inode *inode, struct file *file)
static ssize_t rtw_odm_proc_write(struct file *file, const char __user *buffer, size_t count, loff_t *pos)
{
- ssize_t index = (ssize_t)PDE_DATA(file_inode(file));
+ ssize_t index = (ssize_t)pde_data(file_inode(file));
const struct rtw_proc_hdl *hdl = odm_proc_hdls + index;
ssize_t (*write)(struct file *, const char __user *, size_t, loff_t *, void *) = hdl->write;
@@ -5985,7 +5976,7 @@ const int mcc_proc_hdls_num = sizeof(mcc_proc_hdls) / sizeof(struct rtw_proc_hdl
static int rtw_mcc_proc_open(struct inode *inode, struct file *file)
{
- ssize_t index = (ssize_t)PDE_DATA(inode);
+ ssize_t index = (ssize_t)pde_data(inode);
const struct rtw_proc_hdl *hdl = mcc_proc_hdls + index;
void *private = proc_get_parent_data(inode);
@@ -6011,7 +6002,7 @@ static int rtw_mcc_proc_open(struct inode *inode, struct file *file)
static ssize_t rtw_mcc_proc_write(struct file *file, const char __user *buffer, size_t count, loff_t *pos)
{
- ssize_t index = (ssize_t)PDE_DATA(file_inode(file));
+ ssize_t index = (ssize_t)pde_data(file_inode(file));
const struct rtw_proc_hdl *hdl = mcc_proc_hdls + index;
ssize_t (*write)(struct file *, const char __user *, size_t, loff_t *, void *) = hdl->write;
diff --git a/drivers/staging/rtl8723cs/os_dep/osdep_service.c b/drivers/staging/rtl8723cs/os_dep/osdep_service.c
index 82c887874d41..dd3fb044993c 100644
--- a/drivers/staging/rtl8723cs/os_dep/osdep_service.c
+++ b/drivers/staging/rtl8723cs/os_dep/osdep_service.c
@@ -1309,7 +1309,7 @@ u32 _rtw_down_sema(_sema *sema)
inline void thread_exit(_completion *comp)
{
#ifdef PLATFORM_LINUX
- complete_and_exit(comp, 0);
+ kthread_complete_and_exit(comp, 0);
#endif
#ifdef PLATFORM_FREEBSD
--
2.35.3

View File

@@ -0,0 +1,42 @@
From 1942dc6853d6c67e19f0f1221d7dfda9de3c9e92 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= <megi@xff.cz>
Date: Wed, 25 Nov 2020 14:20:34 +0100
Subject: [PATCH 115/389] 8723cs: Load the MAC address from local-mac-address
Signed-off-by: Ondrej Jirman <megi@xff.cz>
---
drivers/staging/rtl8723cs/os_dep/linux/sdio_intf.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/rtl8723cs/os_dep/linux/sdio_intf.c b/drivers/staging/rtl8723cs/os_dep/linux/sdio_intf.c
index 5a84037f3745..c20c136d111d 100644
--- a/drivers/staging/rtl8723cs/os_dep/linux/sdio_intf.c
+++ b/drivers/staging/rtl8723cs/os_dep/linux/sdio_intf.c
@@ -823,6 +823,10 @@ _adapter *rtw_sdio_primary_adapter_init(struct dvobj_priv *dvobj)
{
int status = _FAIL;
PADAPTER padapter = NULL;
+ PSDIO_DATA psdio = &dvobj->intf_data;
+ struct device_node *np = psdio->func->dev.of_node;
+ const unsigned char *addr;
+ int len;
padapter = (_adapter *)rtw_zvmalloc(sizeof(*padapter));
if (padapter == NULL)
@@ -883,8 +887,11 @@ _adapter *rtw_sdio_primary_adapter_init(struct dvobj_priv *dvobj)
}
/* 3 8. get WLan MAC address */
- /* set mac addr */
- rtw_macaddr_cfg(adapter_mac_addr(padapter), get_hal_mac_addr(padapter));
+ if (np && (addr = of_get_property(np, "local-mac-address", &len)) && len == ETH_ALEN) {
+ memcpy(adapter_mac_addr(padapter), addr, ETH_ALEN);
+ } else {
+ rtw_macaddr_cfg(adapter_mac_addr(padapter), get_hal_mac_addr(padapter));
+ }
#ifdef CONFIG_MI_WITH_MBSSID_CAM
rtw_mbid_camid_alloc(padapter, adapter_mac_addr(padapter));
--
2.35.3

View File

@@ -0,0 +1,256 @@
From 3bfe3630da7088b104c069437770b552b61f5925 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= <megi@xff.cz>
Date: Wed, 25 Nov 2020 07:10:35 +0100
Subject: [PATCH 111/389] 8723cs: Make the driver compile and probe, drop
rockchip platform code
Signed-off-by: Ondrej Jirman <megi@xff.cz>
---
drivers/staging/rtl8723cs/Kconfig | 7 ++-
drivers/staging/rtl8723cs/Makefile | 22 +++----
.../staging/rtl8723cs/core/rtw_ieee80211.c | 5 +-
drivers/staging/rtl8723cs/hal/phydm/phydm.mk | 4 +-
.../rtl8723cs/hal/phydm/sd4_phydm_2_kernel.mk | 2 +-
.../rtl8723cs/os_dep/linux/sdio_intf.c | 57 +------------------
.../staging/rtl8723cs/platform/platform_ops.c | 4 +-
7 files changed, 26 insertions(+), 75 deletions(-)
diff --git a/drivers/staging/rtl8723cs/Kconfig b/drivers/staging/rtl8723cs/Kconfig
index 78e5f124ca80..9b2e6ad9dbbc 100644
--- a/drivers/staging/rtl8723cs/Kconfig
+++ b/drivers/staging/rtl8723cs/Kconfig
@@ -1,5 +1,8 @@
# SPDX-License-Identifier: GPL-2.0
config RTL8723CS
- tristate "Realtek 8723C SDIO or SPI WiFi"
- ---help---
+ tristate "Realtek RTL8723CS SDIO or SPI WiFi driver (2020)"
+ depends on WLAN && MMC && CFG80211
+ select WIRELESS_EXT
+ select WEXT_PRIV
+ help
Help message of RTL8723CS
diff --git a/drivers/staging/rtl8723cs/Makefile b/drivers/staging/rtl8723cs/Makefile
index f6a05d0213a6..7105db9b41fe 100644
--- a/drivers/staging/rtl8723cs/Makefile
+++ b/drivers/staging/rtl8723cs/Makefile
@@ -21,7 +21,7 @@ ifeq ($(GCC_VER_49),1)
EXTRA_CFLAGS += -Wno-date-time # Fix compile error && warning on gcc 4.9 and later
endif
-EXTRA_CFLAGS += -I$(src)/include
+EXTRA_CFLAGS += -I$(srctree)/$(src)/include
EXTRA_LDFLAGS += --strip-debug
@@ -202,7 +202,7 @@ CONFIG_CUSTOMER_HUAWEI_GENERAL = n
CONFIG_DRVEXT_MODULE = n
-export TopDIR ?= $(src)
+export TopDIR ?= $(srctree)/$(src)
########### COMMON #################################
ifeq ($(CONFIG_GSPI_HCI), y)
@@ -268,10 +268,10 @@ _HAL_INTFS_FILES := hal/hal_intf.o \
hal/led/hal_$(HCI_NAME)_led.o
-EXTRA_CFLAGS += -I$(src)/platform
+EXTRA_CFLAGS += -I$(srctree)/$(src)/platform
_PLATFORM_FILES := platform/platform_ops.o
-EXTRA_CFLAGS += -I$(src)/hal/btc
+EXTRA_CFLAGS += -I$(srctree)/$(src)/hal/btc
########### HAL_RTL8188E #################################
ifeq ($(CONFIG_RTL8188E), y)
@@ -2331,31 +2331,31 @@ endif
ifneq ($(KERNELRELEASE),)
########### this part for *.mk ############################
-include $(src)/hal/phydm/phydm.mk
+include $(srctree)/$(src)/hal/phydm/phydm.mk
########### HAL_RTL8822B #################################
ifeq ($(CONFIG_RTL8822B), y)
-include $(src)/rtl8822b.mk
+include $(srctree)/$(src)/rtl8822b.mk
endif
########### HAL_RTL8821C #################################
ifeq ($(CONFIG_RTL8821C), y)
-include $(src)/rtl8821c.mk
+include $(srctree)/$(src)/rtl8821c.mk
endif
########### HAL_RTL8822C #################################
ifeq ($(CONFIG_RTL8822C), y)
-include $(src)/rtl8822c.mk
+include $(srctree)/$(src)/rtl8822c.mk
endif
########### HAL_RTL8814B #################################
ifeq ($(CONFIG_RTL8814B), y)
-include $(src)/rtl8814b.mk
+include $(srctree)/$(src)/rtl8814b.mk
endif
########### HAL_RTL8723F #################################
ifeq ($(CONFIG_RTL8723F), y)
-include $(src)/rtl8723f.mk
+include $(srctree)/$(src)/rtl8723f.mk
endif
rtk_core := core/rtw_cmd.o \
@@ -2405,7 +2405,7 @@ ifeq ($(CONFIG_SDIO_HCI), y)
rtk_core += core/rtw_sdio.o
endif
-EXTRA_CFLAGS += -I$(src)/core/crypto
+EXTRA_CFLAGS += -I$(srctree)/$(src)/core/crypto
rtk_core += \
core/crypto/aes-internal.o \
core/crypto/aes-internal-enc.o \
diff --git a/drivers/staging/rtl8723cs/core/rtw_ieee80211.c b/drivers/staging/rtl8723cs/core/rtw_ieee80211.c
index 26d4d4bcff71..d37273216a31 100644
--- a/drivers/staging/rtl8723cs/core/rtw_ieee80211.c
+++ b/drivers/staging/rtl8723cs/core/rtw_ieee80211.c
@@ -18,7 +18,7 @@
#include <linux/fs.h>
#endif
#include <drv_types.h>
-#include <linux/rfkill-wlan.h>
+#include <linux/rfkill.h>
u8 RTW_WPA_OUI_TYPE[] = { 0x00, 0x50, 0xf2, 1 };
u16 RTW_WPA_VERSION = 1;
@@ -1774,11 +1774,12 @@ void rtw_macaddr_cfg(u8 *out, const u8 *hw_mac_addr)
_rtw_memcpy(mac, hw_mac_addr, ETH_ALEN);
}
+ /*
if (!rockchip_wifi_mac_addr(mac)) {
printk("get mac address from flash=[%02x:%02x:%02x:%02x:%02x:%02x]\n", mac[0], mac[1],
mac[2], mac[3], mac[4], mac[5]);
}
-
+ */
err_chk:
if (rtw_check_invalid_mac_address(mac, _TRUE) == _TRUE) {
#if DEFAULT_RANDOM_MACADDR
diff --git a/drivers/staging/rtl8723cs/hal/phydm/phydm.mk b/drivers/staging/rtl8723cs/hal/phydm/phydm.mk
index 042db19d26ba..dcf919909781 100644
--- a/drivers/staging/rtl8723cs/hal/phydm/phydm.mk
+++ b/drivers/staging/rtl8723cs/hal/phydm/phydm.mk
@@ -1,4 +1,4 @@
-EXTRA_CFLAGS += -I$(src)/hal/phydm
+EXTRA_CFLAGS += -I$(srctree)/$(src)/hal/phydm
_PHYDM_FILES := hal/phydm/phydm_debug.o \
hal/phydm/phydm_antdiv.o\
@@ -245,4 +245,4 @@ _PHYDM_FILES += hal/phydm/$(RTL871X)/halhwimg8723f_bb.o\
hal/phydm/halrf/$(RTL871X)/halrf_dpk_8723f.o\
hal/phydm/halrf/$(RTL871X)/halrf_rfk_init_8723f.o\
hal/phydm/halrf/$(RTL871X)/halhwimg8723f_rf.o
-endif
\ No newline at end of file
+endif
diff --git a/drivers/staging/rtl8723cs/hal/phydm/sd4_phydm_2_kernel.mk b/drivers/staging/rtl8723cs/hal/phydm/sd4_phydm_2_kernel.mk
index f11c6ac90bf5..09898476eded 100644
--- a/drivers/staging/rtl8723cs/hal/phydm/sd4_phydm_2_kernel.mk
+++ b/drivers/staging/rtl8723cs/hal/phydm/sd4_phydm_2_kernel.mk
@@ -1,4 +1,4 @@
-EXTRA_CFLAGS += -I$(src)/hal/phydm
+EXTRA_CFLAGS += -I$(srctree)/$(src)/hal/phydm
_PHYDM_FILES := hal/phydm/phydm_debug.o \
hal/phydm/phydm_interface.o\
diff --git a/drivers/staging/rtl8723cs/os_dep/linux/sdio_intf.c b/drivers/staging/rtl8723cs/os_dep/linux/sdio_intf.c
index ac8ef8bce518..23964c5c64ff 100644
--- a/drivers/staging/rtl8723cs/os_dep/linux/sdio_intf.c
+++ b/drivers/staging/rtl8723cs/os_dep/linux/sdio_intf.c
@@ -1403,58 +1403,5 @@ int rtw_sdio_set_power(int on)
}
#endif /* CONFIG_PLATFORM_INTEL_BYT */
-#include <linux/rfkill-wlan.h>
-extern int get_wifi_chip_type(void);
-extern int rockchip_wifi_power(int on);
-extern int rockchip_wifi_set_carddetect(int val);
-
-int rockchip_wifi_init_module_rtkwifi(void)
-{
-#ifdef CONFIG_WIFI_LOAD_DRIVER_WHEN_KERNEL_BOOTUP
- int type = get_wifi_chip_type();
- if (type < WIFI_AP6XXX_SERIES || type == WIFI_ESP8089) return 0;
-#endif
- printk("\n");
- printk("=======================================================\n");
- printk("==== Launching Wi-Fi driver! (Powered by Rockchip) ====\n");
- printk("=======================================================\n");
- printk("Realtek 8723CS SDIO WiFi driver (Powered by Rockchip,Ver %s) init.\n", DRIVERVERSION);
-
- rockchip_wifi_power(1);
- rockchip_wifi_set_carddetect(1);
-
- return rtw_drv_entry();
-}
-
-void rockchip_wifi_exit_module_rtkwifi(void)
-{
-#ifdef CONFIG_WIFI_LOAD_DRIVER_WHEN_KERNEL_BOOTUP
- int type = get_wifi_chip_type();
- if (type < WIFI_AP6XXX_SERIES || type == WIFI_ESP8089) return;
-#endif
- printk("\n");
- printk("=======================================================\n");
- printk("==== Dislaunching Wi-Fi driver! (Powered by Rockchip) ====\n");
- printk("=======================================================\n");
- printk("Realtek 8723CS SDIO WiFi driver (Powered by Rockchip,Ver %s) init.\n", DRIVERVERSION);
-
- rtw_drv_halt();
-
- rockchip_wifi_set_carddetect(0);
- rockchip_wifi_power(0);
-}
-#ifdef CONFIG_WIFI_BUILD_MODULE
-module_init(rockchip_wifi_init_module_rtkwifi);
-module_exit(rockchip_wifi_exit_module_rtkwifi);
-#else
-#ifdef CONFIG_WIFI_LOAD_DRIVER_WHEN_KERNEL_BOOTUP
-late_initcall(rockchip_wifi_init_module_rtkwifi);
-module_exit(rockchip_wifi_exit_module_rtkwifi);
-#else
-EXPORT_SYMBOL(rockchip_wifi_init_module_rtkwifi);
-EXPORT_SYMBOL(rockchip_wifi_exit_module_rtkwifi);
-#endif
-#endif
-//module_init(rtw_drv_entry);
-//module_exit(rtw_drv_halt);
-
+module_init(rtw_drv_entry);
+module_exit(rtw_drv_halt);
diff --git a/drivers/staging/rtl8723cs/platform/platform_ops.c b/drivers/staging/rtl8723cs/platform/platform_ops.c
index c281dcb8f121..de08abc00759 100644
--- a/drivers/staging/rtl8723cs/platform/platform_ops.c
+++ b/drivers/staging/rtl8723cs/platform/platform_ops.c
@@ -18,13 +18,13 @@
* 0: power on successfully
* others: power on failed
*/
-#include <linux/rfkill-wlan.h>
+#include <linux/rfkill.h>
extern unsigned int oob_irq;
int platform_wifi_power_on(void)
{
int ret = 0;
- oob_irq = rockchip_wifi_get_oob_irq();
+ //oob_irq = rockchip_wifi_get_oob_irq();
return ret;
}
--
2.35.3

View File

@@ -0,0 +1,82 @@
From d17da7d0c791cb29967d5d0afcb4fcf222e40af8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= <megi@xff.cz>
Date: Wed, 25 Nov 2020 07:11:27 +0100
Subject: [PATCH 117/389] 8723cs: Modify makefile options to better suit
PinePhone/Allwinner
Signed-off-by: Ondrej Jirman <megi@xff.cz>
---
drivers/staging/rtl8723cs/Makefile | 16 +++++++++-------
1 file changed, 9 insertions(+), 7 deletions(-)
diff --git a/drivers/staging/rtl8723cs/Makefile b/drivers/staging/rtl8723cs/Makefile
index 7105db9b41fe..b66d4e63c888 100644
--- a/drivers/staging/rtl8723cs/Makefile
+++ b/drivers/staging/rtl8723cs/Makefile
@@ -1,6 +1,6 @@
# SPDX-License-Identifier: GPL-2.0
EXTRA_CFLAGS += $(USER_EXTRA_CFLAGS)
-EXTRA_CFLAGS += -O1
+EXTRA_CFLAGS += -O2
#EXTRA_CFLAGS += -O3
#EXTRA_CFLAGS += -Wall
#EXTRA_CFLAGS += -Wextra
@@ -62,7 +62,7 @@ CONFIG_USB_AUTOSUSPEND = n
CONFIG_HW_PWRP_DETECTION = n
CONFIG_BT_COEXIST = y
CONFIG_WAPI_SUPPORT = n
-CONFIG_EFUSE_CONFIG_FILE = y
+CONFIG_EFUSE_CONFIG_FILE = n
CONFIG_EXT_CLK = n
CONFIG_TRAFFIC_PROTECT = n
CONFIG_LOAD_PHY_PARA_FROM_FILE = y
@@ -93,16 +93,16 @@ CONFIG_RTW_UP_MAPPING_RULE = tos
CONFIG_RTW_MBO = n
########################## Android ###########################
# CONFIG_RTW_ANDROID - 0: no Android, 4/5/6/7/8/9/10 : Android version
-CONFIG_RTW_ANDROID = 10
+CONFIG_RTW_ANDROID = 0
ifeq ($(shell test $(CONFIG_RTW_ANDROID) -gt 0; echo $$?), 0)
EXTRA_CFLAGS += -DCONFIG_RTW_ANDROID=$(CONFIG_RTW_ANDROID)
endif
########################## Debug ###########################
-CONFIG_RTW_DEBUG = y
+CONFIG_RTW_DEBUG = n
# default log level is _DRV_INFO_ = 4,
# please refer to "How_to_set_driver_debug_log_level.doc" to set the available level.
-CONFIG_RTW_LOG_LEVEL = 2
+CONFIG_RTW_LOG_LEVEL = 6
# enable /proc/net/rtlxxxx/ debug interfaces
CONFIG_PROC_DEBUG = y
@@ -135,7 +135,7 @@ CONFIG_LAYER2_ROAMING = y
#bit0: ROAM_ON_EXPIRED, #bit1: ROAM_ON_RESUME, #bit2: ROAM_ACTIVE
CONFIG_ROAMING_FLAG = 0x3
###################### Platform Related #######################
-CONFIG_PLATFORM_I386_PC = n
+CONFIG_PLATFORM_I386_PC = y
CONFIG_PLATFORM_ANDROID_X86 = n
CONFIG_PLATFORM_ANDROID_INTEL_X86 = n
CONFIG_PLATFORM_JB_X86 = n
@@ -160,7 +160,7 @@ CONFIG_PLATFORM_ARM_TCC8920_JB42 = n
CONFIG_PLATFORM_ARM_TCC8930_JB42 = n
CONFIG_PLATFORM_ARM_RK2818 = n
CONFIG_PLATFORM_ARM_RK3066 = n
-CONFIG_PLATFORM_ARM_RK3188 = y
+CONFIG_PLATFORM_ARM_RK3188 = n
CONFIG_PLATFORM_ARM_URBETTER = n
CONFIG_PLATFORM_ARM_TI_PANDA = n
CONFIG_PLATFORM_MIPS_JZ4760 = n
@@ -1332,6 +1332,8 @@ endif
ifeq ($(CONFIG_PLATFORM_I386_PC), y)
EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
+EXTRA_CFLAGS += -DCONFIG_CONCURRENT_MODE
+EXTRA_CFLAGS += -DCONFIG_RADIO_WORK
SUBARCH := $(shell uname -m | sed -e s/i.86/i386/)
ARCH ?= $(SUBARCH)
--
2.35.3

View File

@@ -0,0 +1,106 @@
From c19457874616df7ab11294c10e5156a892540bf7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= <megi@xff.cz>
Date: Fri, 1 Jan 2021 23:42:16 +0100
Subject: [PATCH 126/389] 8723cs: Port to 5.11
Signed-off-by: Ondrej Jirman <megi@xff.cz>
---
.../rtl8723cs/os_dep/linux/ioctl_cfg80211.c | 2 +-
.../staging/rtl8723cs/os_dep/osdep_service.c | 25 -------------------
2 files changed, 1 insertion(+), 26 deletions(-)
diff --git a/drivers/staging/rtl8723cs/os_dep/linux/ioctl_cfg80211.c b/drivers/staging/rtl8723cs/os_dep/linux/ioctl_cfg80211.c
index 42592bc5d50b..54424a82ce19 100644
--- a/drivers/staging/rtl8723cs/os_dep/linux/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723cs/os_dep/linux/ioctl_cfg80211.c
@@ -454,7 +454,7 @@ u8 rtw_cfg80211_ch_switch_notify(_adapter *adapter, u8 ch, u8 bw, u8 offset,
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 19, 0))
if (started) {
- cfg80211_ch_switch_started_notify(adapter->pnetdev, &chdef, 0);
+ cfg80211_ch_switch_started_notify(adapter->pnetdev, &chdef, 0, false);
goto exit;
}
#endif
diff --git a/drivers/staging/rtl8723cs/os_dep/osdep_service.c b/drivers/staging/rtl8723cs/os_dep/osdep_service.c
index 39b5345b9885..82c887874d41 100644
--- a/drivers/staging/rtl8723cs/os_dep/osdep_service.c
+++ b/drivers/staging/rtl8723cs/os_dep/osdep_service.c
@@ -2496,20 +2496,12 @@ static int isFileReadable(const char *path, u32 *sz)
{
struct file *fp;
int ret = 0;
- mm_segment_t oldfs;
char buf;
fp = filp_open(path, O_RDONLY, 0);
if (IS_ERR(fp))
ret = PTR_ERR(fp);
else {
- oldfs = get_fs();
- #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0))
- set_fs(KERNEL_DS);
- #else
- set_fs(get_ds());
- #endif
-
if (1 != readFile(fp, &buf, 1))
ret = PTR_ERR(fp);
@@ -2521,7 +2513,6 @@ static int isFileReadable(const char *path, u32 *sz)
#endif
}
- set_fs(oldfs);
filp_close(fp, NULL);
}
return ret;
@@ -2537,7 +2528,6 @@ static int isFileReadable(const char *path, u32 *sz)
static int retriveFromFile(const char *path, u8 *buf, u32 sz)
{
int ret = -1;
- mm_segment_t oldfs;
struct file *fp;
if (path && buf) {
@@ -2545,14 +2535,7 @@ static int retriveFromFile(const char *path, u8 *buf, u32 sz)
if (0 == ret) {
RTW_INFO("%s openFile path:%s fp=%p\n", __FUNCTION__, path , fp);
- oldfs = get_fs();
- #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0))
- set_fs(KERNEL_DS);
- #else
- set_fs(get_ds());
- #endif
ret = readFile(fp, buf, sz);
- set_fs(oldfs);
closeFile(fp);
RTW_INFO("%s readFile, ret:%d\n", __FUNCTION__, ret);
@@ -2576,7 +2559,6 @@ static int retriveFromFile(const char *path, u8 *buf, u32 sz)
static int storeToFile(const char *path, u8 *buf, u32 sz)
{
int ret = 0;
- mm_segment_t oldfs;
struct file *fp;
if (path && buf) {
@@ -2584,14 +2566,7 @@ static int storeToFile(const char *path, u8 *buf, u32 sz)
if (0 == ret) {
RTW_INFO("%s openFile path:%s fp=%p\n", __FUNCTION__, path , fp);
- oldfs = get_fs();
- #if (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 1, 0))
- set_fs(KERNEL_DS);
- #else
- set_fs(get_ds());
- #endif
ret = writeFile(fp, buf, sz);
- set_fs(oldfs);
closeFile(fp);
RTW_INFO("%s writeFile, ret:%d\n", __FUNCTION__, ret);
--
2.35.3

View File

@@ -0,0 +1,27 @@
From e39685e57878934a245c30272b2bd40fafb877d3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= <megi@xff.cz>
Date: Tue, 23 Feb 2021 19:08:13 +0100
Subject: [PATCH 128/389] 8723cs: Port to 5.12
---
drivers/staging/rtl8723cs/os_dep/linux/recv_linux.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/rtl8723cs/os_dep/linux/recv_linux.c b/drivers/staging/rtl8723cs/os_dep/linux/recv_linux.c
index 13cd7660ac7e..d1a908a07437 100644
--- a/drivers/staging/rtl8723cs/os_dep/linux/recv_linux.c
+++ b/drivers/staging/rtl8723cs/os_dep/linux/recv_linux.c
@@ -405,8 +405,8 @@ static int napi_recv(_adapter *padapter, int budget)
So, we should prevent cloned SKB go into napi_gro_receive.
*/
if (pregistrypriv->en_gro && !skb_cloned(pskb)) {
- if (rtw_napi_gro_receive(&padapter->napi, pskb) != GRO_DROP)
- rx_ok = _TRUE;
+ rtw_napi_gro_receive(&padapter->napi, pskb);
+ rx_ok = _TRUE;
goto next;
}
#endif /* CONFIG_RTW_GRO */
--
2.35.3

View File

@@ -0,0 +1,334 @@
From 38a15a758568f29a4981deac446d3b5f6ac5fe14 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= <megi@xff.cz>
Date: Mon, 13 Sep 2021 14:38:17 +0200
Subject: [PATCH 133/389] 8723cs: Port to 5.15
Cut out apple talk protocol handling.
Signed-off-by: Ondrej Jirman <megi@xff.cz>
---
drivers/staging/rtl8723cs/core/rtw_br_ext.c | 273 --------------------
1 file changed, 273 deletions(-)
diff --git a/drivers/staging/rtl8723cs/core/rtw_br_ext.c b/drivers/staging/rtl8723cs/core/rtw_br_ext.c
index 9a0effd8b7ea..4251b825c8ae 100644
--- a/drivers/staging/rtl8723cs/core/rtw_br_ext.c
+++ b/drivers/staging/rtl8723cs/core/rtw_br_ext.c
@@ -17,8 +17,6 @@
#ifdef __KERNEL__
#include <linux/if_arp.h>
#include <net/ip.h>
- #include <net/ipx.h>
- #include <linux/atalk.h>
#include <linux/udp.h>
#include <linux/if_pppox.h>
#endif
@@ -57,8 +55,6 @@
#define NAT25_IPV4 01
#define NAT25_IPV6 02
-#define NAT25_IPX 03
-#define NAT25_APPLE 04
#define NAT25_PPPOE 05
#define RTL_RELAY_TAG_LEN (ETH_ALEN)
@@ -73,8 +69,6 @@
0 1 2 3 4 5 6 7 8 9 10
|----|----|----|----|----|----|----|----|----|----|----|
IPv4 |type| | IP addr |
- IPX |type| Net addr | Node addr |
- IPX |type| Net addr |Sckt addr|
Apple |type| Network |node|
PPPoE |type| SID | AC MAC |
-----------------------------------------------------------------*/
@@ -169,39 +163,6 @@ static __inline__ void __nat25_generate_ipv4_network_addr(unsigned char *network
}
-static __inline__ void __nat25_generate_ipx_network_addr_with_node(unsigned char *networkAddr,
- unsigned int *ipxNetAddr, unsigned char *ipxNodeAddr)
-{
- memset(networkAddr, 0, MAX_NETWORK_ADDR_LEN);
-
- networkAddr[0] = NAT25_IPX;
- memcpy(networkAddr + 1, (unsigned char *)ipxNetAddr, 4);
- memcpy(networkAddr + 5, ipxNodeAddr, 6);
-}
-
-
-static __inline__ void __nat25_generate_ipx_network_addr_with_socket(unsigned char *networkAddr,
- unsigned int *ipxNetAddr, unsigned short *ipxSocketAddr)
-{
- memset(networkAddr, 0, MAX_NETWORK_ADDR_LEN);
-
- networkAddr[0] = NAT25_IPX;
- memcpy(networkAddr + 1, (unsigned char *)ipxNetAddr, 4);
- memcpy(networkAddr + 5, (unsigned char *)ipxSocketAddr, 2);
-}
-
-
-static __inline__ void __nat25_generate_apple_network_addr(unsigned char *networkAddr,
- unsigned short *network, unsigned char *node)
-{
- memset(networkAddr, 0, MAX_NETWORK_ADDR_LEN);
-
- networkAddr[0] = NAT25_APPLE;
- memcpy(networkAddr + 1, (unsigned char *)network, 2);
- networkAddr[3] = *node;
-}
-
-
static __inline__ void __nat25_generate_pppoe_network_addr(unsigned char *networkAddr,
unsigned char *ac_mac, unsigned short *sid)
{
@@ -329,19 +290,6 @@ static __inline__ int __nat25_network_hash(unsigned char *networkAddr)
x = networkAddr[7] ^ networkAddr[8] ^ networkAddr[9] ^ networkAddr[10];
- return x & (NAT25_HASH_SIZE - 1);
- } else if (networkAddr[0] == NAT25_IPX) {
- unsigned long x;
-
- x = networkAddr[1] ^ networkAddr[2] ^ networkAddr[3] ^ networkAddr[4] ^ networkAddr[5] ^
- networkAddr[6] ^ networkAddr[7] ^ networkAddr[8] ^ networkAddr[9] ^ networkAddr[10];
-
- return x & (NAT25_HASH_SIZE - 1);
- } else if (networkAddr[0] == NAT25_APPLE) {
- unsigned long x;
-
- x = networkAddr[1] ^ networkAddr[2] ^ networkAddr[3];
-
return x & (NAT25_HASH_SIZE - 1);
} else if (networkAddr[0] == NAT25_PPPOE) {
unsigned long x;
@@ -889,227 +837,6 @@ int nat25_db_handle(_adapter *priv, struct sk_buff *skb, int method)
}
}
- /*---------------------------------------------------*/
- /* Handle IPX and Apple Talk frame */
- /*---------------------------------------------------*/
- else if ((protocol == __constant_htons(ETH_P_IPX)) ||
- (protocol == __constant_htons(ETH_P_ATALK)) ||
- (protocol == __constant_htons(ETH_P_AARP))) {
- unsigned char ipx_header[2] = {0xFF, 0xFF};
- struct ipxhdr *ipx = NULL;
- struct elapaarp *ea = NULL;
- struct ddpehdr *ddp = NULL;
- unsigned char *framePtr = skb->data + ETH_HLEN;
-
- if (protocol == __constant_htons(ETH_P_IPX)) {
- RTW_INFO("NAT25: Protocol=IPX (Ethernet II)\n");
- ipx = (struct ipxhdr *)framePtr;
- } else { /* if(protocol <= __constant_htons(ETH_FRAME_LEN)) */
- if (!memcmp(ipx_header, framePtr, 2)) {
- RTW_INFO("NAT25: Protocol=IPX (Ethernet 802.3)\n");
- ipx = (struct ipxhdr *)framePtr;
- } else {
- unsigned char ipx_8022_type = 0xE0;
- unsigned char snap_8022_type = 0xAA;
-
- if (*framePtr == snap_8022_type) {
- unsigned char ipx_snap_id[5] = {0x0, 0x0, 0x0, 0x81, 0x37}; /* IPX SNAP ID */
- unsigned char aarp_snap_id[5] = {0x00, 0x00, 0x00, 0x80, 0xF3}; /* Apple Talk AARP SNAP ID */
- unsigned char ddp_snap_id[5] = {0x08, 0x00, 0x07, 0x80, 0x9B}; /* Apple Talk DDP SNAP ID */
-
- framePtr += 3; /* eliminate the 802.2 header */
-
- if (!memcmp(ipx_snap_id, framePtr, 5)) {
- framePtr += 5; /* eliminate the SNAP header */
-
- RTW_INFO("NAT25: Protocol=IPX (Ethernet SNAP)\n");
- ipx = (struct ipxhdr *)framePtr;
- } else if (!memcmp(aarp_snap_id, framePtr, 5)) {
- framePtr += 5; /* eliminate the SNAP header */
-
- ea = (struct elapaarp *)framePtr;
- } else if (!memcmp(ddp_snap_id, framePtr, 5)) {
- framePtr += 5; /* eliminate the SNAP header */
-
- ddp = (struct ddpehdr *)framePtr;
- } else {
- DEBUG_WARN("NAT25: Protocol=Ethernet SNAP %02x%02x%02x%02x%02x\n", framePtr[0],
- framePtr[1], framePtr[2], framePtr[3], framePtr[4]);
- return -1;
- }
- } else if (*framePtr == ipx_8022_type) {
- framePtr += 3; /* eliminate the 802.2 header */
-
- if (!memcmp(ipx_header, framePtr, 2)) {
- RTW_INFO("NAT25: Protocol=IPX (Ethernet 802.2)\n");
- ipx = (struct ipxhdr *)framePtr;
- } else
- return -1;
- }
- }
- }
-
- /* IPX */
- if (ipx != NULL) {
- switch (method) {
- case NAT25_CHECK:
- if (!memcmp(skb->data + ETH_ALEN, ipx->ipx_source.node, ETH_ALEN)) {
- RTW_INFO("NAT25: Check IPX skb_copy\n");
- return 0;
- }
- return -1;
-
- case NAT25_INSERT: {
- RTW_INFO("NAT25: Insert IPX, Dest=%08x,%02x%02x%02x%02x%02x%02x,%04x Source=%08x,%02x%02x%02x%02x%02x%02x,%04x\n",
- ipx->ipx_dest.net,
- ipx->ipx_dest.node[0],
- ipx->ipx_dest.node[1],
- ipx->ipx_dest.node[2],
- ipx->ipx_dest.node[3],
- ipx->ipx_dest.node[4],
- ipx->ipx_dest.node[5],
- ipx->ipx_dest.sock,
- ipx->ipx_source.net,
- ipx->ipx_source.node[0],
- ipx->ipx_source.node[1],
- ipx->ipx_source.node[2],
- ipx->ipx_source.node[3],
- ipx->ipx_source.node[4],
- ipx->ipx_source.node[5],
- ipx->ipx_source.sock);
-
- if (!memcmp(skb->data + ETH_ALEN, ipx->ipx_source.node, ETH_ALEN)) {
- RTW_INFO("NAT25: Use IPX Net, and Socket as network addr\n");
-
- __nat25_generate_ipx_network_addr_with_socket(networkAddr, &ipx->ipx_source.net, &ipx->ipx_source.sock);
-
- /* change IPX source node addr to wlan STA address */
- memcpy(ipx->ipx_source.node, GET_MY_HWADDR(priv), ETH_ALEN);
- } else
- __nat25_generate_ipx_network_addr_with_node(networkAddr, &ipx->ipx_source.net, ipx->ipx_source.node);
-
- __nat25_db_network_insert(priv, skb->data + ETH_ALEN, networkAddr);
-
- __nat25_db_print(priv);
- }
- return 0;
-
- case NAT25_LOOKUP: {
- if (!memcmp(GET_MY_HWADDR(priv), ipx->ipx_dest.node, ETH_ALEN)) {
- RTW_INFO("NAT25: Lookup IPX, Modify Destination IPX Node addr\n");
-
- __nat25_generate_ipx_network_addr_with_socket(networkAddr, &ipx->ipx_dest.net, &ipx->ipx_dest.sock);
-
- __nat25_db_network_lookup_and_replace(priv, skb, networkAddr);
-
- /* replace IPX destination node addr with Lookup destination MAC addr */
- memcpy(ipx->ipx_dest.node, skb->data, ETH_ALEN);
- } else {
- __nat25_generate_ipx_network_addr_with_node(networkAddr, &ipx->ipx_dest.net, ipx->ipx_dest.node);
-
- __nat25_db_network_lookup_and_replace(priv, skb, networkAddr);
- }
- }
- return 0;
-
- default:
- return -1;
- }
- }
-
- /* AARP */
- else if (ea != NULL) {
- /* Sanity check fields. */
- if (ea->hw_len != ETH_ALEN || ea->pa_len != AARP_PA_ALEN) {
- DEBUG_WARN("NAT25: Appletalk AARP Sanity check fail!\n");
- return -1;
- }
-
- switch (method) {
- case NAT25_CHECK:
- return 0;
-
- case NAT25_INSERT: {
- /* change to AARP source mac address to wlan STA address */
- memcpy(ea->hw_src, GET_MY_HWADDR(priv), ETH_ALEN);
-
- RTW_INFO("NAT25: Insert AARP, Source=%d,%d Destination=%d,%d\n",
- ea->pa_src_net,
- ea->pa_src_node,
- ea->pa_dst_net,
- ea->pa_dst_node);
-
- __nat25_generate_apple_network_addr(networkAddr, &ea->pa_src_net, &ea->pa_src_node);
-
- __nat25_db_network_insert(priv, skb->data + ETH_ALEN, networkAddr);
-
- __nat25_db_print(priv);
- }
- return 0;
-
- case NAT25_LOOKUP: {
- RTW_INFO("NAT25: Lookup AARP, Source=%d,%d Destination=%d,%d\n",
- ea->pa_src_net,
- ea->pa_src_node,
- ea->pa_dst_net,
- ea->pa_dst_node);
-
- __nat25_generate_apple_network_addr(networkAddr, &ea->pa_dst_net, &ea->pa_dst_node);
-
- __nat25_db_network_lookup_and_replace(priv, skb, networkAddr);
-
- /* change to AARP destination mac address to Lookup result */
- memcpy(ea->hw_dst, skb->data, ETH_ALEN);
- }
- return 0;
-
- default:
- return -1;
- }
- }
-
- /* DDP */
- else if (ddp != NULL) {
- switch (method) {
- case NAT25_CHECK:
- return -1;
-
- case NAT25_INSERT: {
- RTW_INFO("NAT25: Insert DDP, Source=%d,%d Destination=%d,%d\n",
- ddp->deh_snet,
- ddp->deh_snode,
- ddp->deh_dnet,
- ddp->deh_dnode);
-
- __nat25_generate_apple_network_addr(networkAddr, &ddp->deh_snet, &ddp->deh_snode);
-
- __nat25_db_network_insert(priv, skb->data + ETH_ALEN, networkAddr);
-
- __nat25_db_print(priv);
- }
- return 0;
-
- case NAT25_LOOKUP: {
- RTW_INFO("NAT25: Lookup DDP, Source=%d,%d Destination=%d,%d\n",
- ddp->deh_snet,
- ddp->deh_snode,
- ddp->deh_dnet,
- ddp->deh_dnode);
-
- __nat25_generate_apple_network_addr(networkAddr, &ddp->deh_dnet, &ddp->deh_dnode);
-
- __nat25_db_network_lookup_and_replace(priv, skb, networkAddr);
- }
- return 0;
-
- default:
- return -1;
- }
- }
-
- return -1;
- }
-
/*---------------------------------------------------*/
/* Handle PPPoE frame */
/*---------------------------------------------------*/
--
2.35.3

View File

@@ -0,0 +1,52 @@
From 521d5bdd9a90e4d4e8dabfbf484fdab1a45251bc Mon Sep 17 00:00:00 2001
From: Ondrej Jirman <megi@xff.cz>
Date: Tue, 29 Mar 2022 05:23:01 +0200
Subject: [PATCH 136/389] 8723cs: Port to 5.18
Signed-off-by: Ondrej Jirman <megi@xff.cz>
---
drivers/staging/rtl8723cs/core/rtw_br_ext.c | 6 ++++--
drivers/staging/rtl8723cs/core/rtw_mi.c | 2 +-
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/staging/rtl8723cs/core/rtw_br_ext.c b/drivers/staging/rtl8723cs/core/rtw_br_ext.c
index 4251b825c8ae..7b5934d38446 100644
--- a/drivers/staging/rtl8723cs/core/rtw_br_ext.c
+++ b/drivers/staging/rtl8723cs/core/rtw_br_ext.c
@@ -97,6 +97,7 @@ static __inline__ int __nat25_add_pppoe_tag(struct sk_buff *skb, struct pppoe_ta
{
struct pppoe_hdr *ph = (struct pppoe_hdr *)(skb->data + ETH_HLEN);
int data_len;
+ int ph_len = ntohs(ph->length);
data_len = tag->tag_len + TAG_HDR_LEN;
if (skb_tailroom(skb) < data_len) {
@@ -105,9 +106,10 @@ static __inline__ int __nat25_add_pppoe_tag(struct sk_buff *skb, struct pppoe_ta
}
skb_put(skb, data_len);
+
/* have a room for new tag */
- memmove(((unsigned char *)ph->tag + data_len), (unsigned char *)ph->tag, ntohs(ph->length));
- ph->length = htons(ntohs(ph->length) + data_len);
+ memmove(((unsigned char *)ph->tag + data_len), (unsigned char *)ph->tag, ph_len);
+ ph->length = htons(ph_len + data_len);
memcpy((unsigned char *)ph->tag, tag, data_len);
return data_len;
}
diff --git a/drivers/staging/rtl8723cs/core/rtw_mi.c b/drivers/staging/rtl8723cs/core/rtw_mi.c
index 099cd368b330..f125225b7dbe 100644
--- a/drivers/staging/rtl8723cs/core/rtw_mi.c
+++ b/drivers/staging/rtl8723cs/core/rtw_mi.c
@@ -1226,7 +1226,7 @@ u8 rtw_mi_buddy_set_tx_beacon_cmd(_adapter *padapter)
static u8 _rtw_mi_p2p_chk_state(_adapter *adapter, void *data)
{
struct wifidirect_info *pwdinfo = &(adapter->wdinfo);
- enum P2P_STATE state = *(enum P2P_STATE *)data;
+ enum P2P_STATE state = *(u8*)data;
return rtw_p2p_chk_state(pwdinfo, state);
}
--
2.35.3

View File

@@ -0,0 +1,26 @@
From 08327133db6ec5c1bac80ada49c9404b47fe110f Mon Sep 17 00:00:00 2001
From: Ondrej Jirman <megi@xff.cz>
Date: Tue, 23 Aug 2022 20:23:53 +0200
Subject: [PATCH 139/389] 8723cs: Port to 6.0
Signed-off-by: Ondrej Jirman <megi@xff.cz>
---
drivers/staging/rtl8723cs/os_dep/linux/ioctl_cfg80211.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/staging/rtl8723cs/os_dep/linux/ioctl_cfg80211.c b/drivers/staging/rtl8723cs/os_dep/linux/ioctl_cfg80211.c
index e84386a81bce..67fc705a16c0 100644
--- a/drivers/staging/rtl8723cs/os_dep/linux/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723cs/os_dep/linux/ioctl_cfg80211.c
@@ -1107,7 +1107,7 @@ void rtw_cfg80211_indicate_connect(_adapter *padapter)
#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
- roam_info.bssid = cur_network->network.MacAddress;
+ roam_info.links[0].bssid = cur_network->network.MacAddress;
roam_info.req_ie = pmlmepriv->assoc_req + sizeof(struct rtw_ieee80211_hdr_3addr) + 2;
roam_info.req_ie_len = pmlmepriv->assoc_req_len - sizeof(struct rtw_ieee80211_hdr_3addr) - 2;
roam_info.resp_ie = pmlmepriv->assoc_rsp + sizeof(struct rtw_ieee80211_hdr_3addr) + 6;
--
2.35.3

View File

@@ -0,0 +1,34 @@
From 6e627b477d7ca7a58e68e51e4ed84d65948d7eef Mon Sep 17 00:00:00 2001
From: Ondrej Jirman <megi@xff.cz>
Date: Mon, 17 Oct 2022 01:44:10 +0200
Subject: [PATCH 146/389] 8723cs: Port to 6.1-rc1
Signed-off-by: Ondrej Jirman <megi@xff.cz>
---
drivers/staging/rtl8723cs/os_dep/osdep_service.c | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/drivers/staging/rtl8723cs/os_dep/osdep_service.c b/drivers/staging/rtl8723cs/os_dep/osdep_service.c
index dd3fb044993c..0658fdd045dd 100644
--- a/drivers/staging/rtl8723cs/os_dep/osdep_service.c
+++ b/drivers/staging/rtl8723cs/os_dep/osdep_service.c
@@ -2863,15 +2863,7 @@ u64 rtw_division64(u64 x, u64 y)
inline u32 rtw_random32(void)
{
#ifdef PLATFORM_LINUX
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 8, 0))
- return prandom_u32();
-#elif (LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 18))
- u32 random_int;
- get_random_bytes(&random_int , 4);
- return random_int;
-#else
- return random32();
-#endif
+ return get_random_u32();
#elif defined(PLATFORM_WINDOWS)
#error "to be implemented\n"
#elif defined(PLATFORM_FREEBSD)
--
2.35.3

View File

@@ -0,0 +1,75 @@
From 6be81198eee9514eb603fd4a3240d308e8b1dced Mon Sep 17 00:00:00 2001
From: Ondrej Jirman <megi@xff.cz>
Date: Thu, 13 Oct 2022 19:29:43 +0200
Subject: [PATCH 143/389] 8723cs: Port to 6.1
---
.../rtl8723cs/os_dep/linux/ioctl_cfg80211.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/drivers/staging/rtl8723cs/os_dep/linux/ioctl_cfg80211.c b/drivers/staging/rtl8723cs/os_dep/linux/ioctl_cfg80211.c
index 67fc705a16c0..f50a9abaad89 100644
--- a/drivers/staging/rtl8723cs/os_dep/linux/ioctl_cfg80211.c
+++ b/drivers/staging/rtl8723cs/os_dep/linux/ioctl_cfg80211.c
@@ -452,7 +452,7 @@ u8 rtw_cfg80211_ch_switch_notify(_adapter *adapter, u8 ch, u8 bw, u8 offset,
goto exit;
if (started) {
- cfg80211_ch_switch_started_notify(adapter->pnetdev, &chdef, 0, false);
+ cfg80211_ch_switch_started_notify(adapter->pnetdev, &chdef, 0, 0, false);
goto exit;
}
@@ -1867,6 +1867,7 @@ static int rtw_cfg80211_set_encryption(struct net_device *dev, struct ieee_param
}
static int cfg80211_rtw_add_key(struct wiphy *wiphy, struct net_device *ndev
+ , int link_id
, u8 key_index
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE)
, bool pairwise
@@ -2029,6 +2030,7 @@ static int cfg80211_rtw_add_key(struct wiphy *wiphy, struct net_device *ndev
}
static int cfg80211_rtw_get_key(struct wiphy *wiphy, struct net_device *ndev
+ , int link_id
, u8 keyid
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE)
, bool pairwise
@@ -2216,11 +2218,12 @@ static int cfg80211_rtw_get_key(struct wiphy *wiphy, struct net_device *ndev
return ret;
}
-static int cfg80211_rtw_del_key(struct wiphy *wiphy, struct net_device *ndev,
+static int cfg80211_rtw_del_key(struct wiphy *wiphy, struct net_device *ndev
+ , int link_id
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) || defined(COMPAT_KERNEL_RELEASE)
- u8 key_index, bool pairwise, const u8 *mac_addr)
+ , u8 key_index, bool pairwise, const u8 *mac_addr)
#else /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) */
- u8 key_index, const u8 *mac_addr)
+ , u8 key_index, const u8 *mac_addr)
#endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 37)) */
{
_adapter *padapter = (_adapter *)rtw_netdev_priv(ndev);
@@ -2237,7 +2240,7 @@ static int cfg80211_rtw_del_key(struct wiphy *wiphy, struct net_device *ndev,
}
static int cfg80211_rtw_set_default_key(struct wiphy *wiphy,
- struct net_device *ndev, u8 key_index
+ struct net_device *ndev, int link_id, u8 key_index
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 38)) || defined(COMPAT_KERNEL_RELEASE)
, bool unicast, bool multicast
#endif
@@ -2285,7 +2288,7 @@ static int cfg80211_rtw_set_default_key(struct wiphy *wiphy,
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 30))
int cfg80211_rtw_set_default_mgmt_key(struct wiphy *wiphy,
- struct net_device *ndev, u8 key_index)
+ struct net_device *ndev, int link_id, u8 key_index)
{
#define SET_DEF_KEY_PARAM_FMT " key_index=%d"
#define SET_DEF_KEY_PARAM_ARG , key_index
--
2.35.3

View File

@@ -0,0 +1,75 @@
From e0f63499e2671dca6d90dc2d6aeaae8e2d370e8d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= <megi@xff.cz>
Date: Wed, 2 Dec 2020 12:11:32 +0100
Subject: [PATCH 125/389] 8723cs: Resume wifi in a workqueue
Signed-off-by: Ondrej Jirman <megi@xff.cz>
---
drivers/staging/rtl8723cs/Makefile | 1 +
drivers/staging/rtl8723cs/core/rtw_pwrctrl.c | 7 +++++--
drivers/staging/rtl8723cs/include/drv_conf.h | 7 -------
3 files changed, 6 insertions(+), 9 deletions(-)
diff --git a/drivers/staging/rtl8723cs/Makefile b/drivers/staging/rtl8723cs/Makefile
index 0fe39a873866..60c1c864db42 100644
--- a/drivers/staging/rtl8723cs/Makefile
+++ b/drivers/staging/rtl8723cs/Makefile
@@ -1333,6 +1333,7 @@ ifeq ($(CONFIG_PLATFORM_I386_PC), y)
EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
EXTRA_CFLAGS += -DCONFIG_IOCTL_CFG80211 -DRTW_USE_CFG80211_STA_EVENT
EXTRA_CFLAGS += -DCONFIG_RTW_80211R
+EXTRA_CFLAGS += -DCONFIG_RESUME_IN_WORKQUEUE
SUBARCH := $(shell uname -m | sed -e s/i.86/i386/)
ARCH ?= $(SUBARCH)
diff --git a/drivers/staging/rtl8723cs/core/rtw_pwrctrl.c b/drivers/staging/rtl8723cs/core/rtw_pwrctrl.c
index 03dfaf9a6ed7..5c519a5d39bb 100644
--- a/drivers/staging/rtl8723cs/core/rtw_pwrctrl.c
+++ b/drivers/staging/rtl8723cs/core/rtw_pwrctrl.c
@@ -2468,20 +2468,23 @@ static void resume_workitem_callback(struct work_struct *work)
struct pwrctrl_priv *pwrpriv = container_of(work, struct pwrctrl_priv, resume_work);
struct dvobj_priv *dvobj = pwrctl_to_dvobj(pwrpriv);
_adapter *adapter = dvobj_get_primary_adapter(dvobj);
+ PSDIO_DATA psdio = &dvobj->intf_data;
RTW_INFO("%s\n", __FUNCTION__);
rtw_resume_process(adapter);
- rtw_resume_unlock_suspend();
+ pm_relax(&psdio->func->dev);
}
void rtw_resume_in_workqueue(struct pwrctrl_priv *pwrpriv)
{
/* accquire system's suspend lock preventing from falliing asleep while resume in workqueue */
/* rtw_lock_suspend(); */
+ struct dvobj_priv *dvobj = pwrctl_to_dvobj(pwrpriv);
+ PSDIO_DATA psdio = &dvobj->intf_data;
- rtw_resume_lock_suspend();
+ pm_stay_awake(&psdio->func->dev);
#if 1
queue_work(pwrpriv->rtw_workqueue, &pwrpriv->resume_work);
diff --git a/drivers/staging/rtl8723cs/include/drv_conf.h b/drivers/staging/rtl8723cs/include/drv_conf.h
index e8a8a7a8819e..5b528680380f 100644
--- a/drivers/staging/rtl8723cs/include/drv_conf.h
+++ b/drivers/staging/rtl8723cs/include/drv_conf.h
@@ -166,13 +166,6 @@
#endif
*/
-#ifdef CONFIG_RESUME_IN_WORKQUEUE /* this can be removed, because there is no case for this... */
- #if !defined(CONFIG_WAKELOCK) && !defined(CONFIG_ANDROID_POWER)
- #error "enable CONFIG_RESUME_IN_WORKQUEUE without CONFIG_WAKELOCK or CONFIG_ANDROID_POWER will suffer from the danger of wifi's unfunctionality..."
- #error "If you still want to enable CONFIG_RESUME_IN_WORKQUEUE in this case, mask this preprossor checking and GOOD LUCK..."
- #endif
-#endif
-
/* About USB VENDOR REQ */
#if defined(CONFIG_USB_VENDOR_REQ_BUFFER_PREALLOC) && !defined(CONFIG_USB_VENDOR_REQ_MUTEX)
#warning "define CONFIG_USB_VENDOR_REQ_MUTEX for CONFIG_USB_VENDOR_REQ_BUFFER_PREALLOC automatically"
--
2.35.3

View File

@@ -0,0 +1,38 @@
From e9263acb33c740716113d28e5d07729f7147ae1c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= <megi@xff.cz>
Date: Wed, 2 Dec 2020 12:45:21 +0100
Subject: [PATCH 124/389] 8723cs: Set CONFIG_RTW_SDIO_PM_KEEP_POWER = n to fix
suspend (-38)
Device mmc1:0001:1 failed to suspend async: error -38
Signed-off-by: Ondrej Jirman <megi@xff.cz>
---
drivers/staging/rtl8723cs/Makefile | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/staging/rtl8723cs/Makefile b/drivers/staging/rtl8723cs/Makefile
index 5ef5557e58b7..0fe39a873866 100644
--- a/drivers/staging/rtl8723cs/Makefile
+++ b/drivers/staging/rtl8723cs/Makefile
@@ -108,7 +108,7 @@ CONFIG_RTW_LOG_LEVEL = 6
CONFIG_PROC_DEBUG = y
######################## Wake On Lan ##########################
-CONFIG_WOWLAN = y
+CONFIG_WOWLAN = n
#bit3: ARP enable, bit2: deauth, bit1: unicast, bit0: magic pkt.
CONFIG_WAKEUP_TYPE = 0xf
CONFIG_WOW_LPS_MODE = default
@@ -127,7 +127,7 @@ CONFIG_PNO_SUPPORT = n
CONFIG_PNO_SET_DEBUG = n
CONFIG_AP_WOWLAN = n
######### Notify SDIO Host Keep Power During Syspend ##########
-CONFIG_RTW_SDIO_PM_KEEP_POWER = y
+CONFIG_RTW_SDIO_PM_KEEP_POWER = n
###################### MP HW TX MODE FOR VHT #######################
CONFIG_MP_VHT_HW_TX_MODE = n
###################### ROAMING #####################################
--
2.35.3

View File

@@ -0,0 +1,198 @@
From 4b54ad10d37e90df1b1cac7a21e86eddeb6393e8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= <megi@xff.cz>
Date: Wed, 25 Nov 2020 15:04:54 +0100
Subject: [PATCH 120/389] 8723cs: aes_encrypt -> aes_encrypt_128 to avoid
symbol name conflict
The kernel already has aes_encrypt.
Signed-off-by: Ondrej Jirman <megi@xff.cz>
---
.../staging/rtl8723cs/core/crypto/aes-ccm.c | 18 +++++++++---------
.../staging/rtl8723cs/core/crypto/aes-ctr.c | 2 +-
.../staging/rtl8723cs/core/crypto/aes-gcm.c | 6 +++---
.../rtl8723cs/core/crypto/aes-internal-enc.c | 2 +-
.../staging/rtl8723cs/core/crypto/aes-omac1.c | 6 +++---
drivers/staging/rtl8723cs/core/crypto/aes.h | 2 +-
6 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/drivers/staging/rtl8723cs/core/crypto/aes-ccm.c b/drivers/staging/rtl8723cs/core/crypto/aes-ccm.c
index dceec778a6d7..a2309b5f14f5 100644
--- a/drivers/staging/rtl8723cs/core/crypto/aes-ccm.c
+++ b/drivers/staging/rtl8723cs/core/crypto/aes-ccm.c
@@ -40,7 +40,7 @@ static void aes_ccm_auth_start(void *aes, size_t M, size_t L, const u8 *nonce,
WPA_PUT_BE16(&b[AES_BLOCK_SIZE - L], plain_len);
wpa_hexdump_key(_MSG_EXCESSIVE_, "CCM B_0", b, AES_BLOCK_SIZE);
- aes_encrypt(aes, b, x); /* X_1 = E(K, B_0) */
+ aes_encrypt_128(aes, b, x); /* X_1 = E(K, B_0) */
if (!aad_len)
return;
@@ -50,12 +50,12 @@ static void aes_ccm_auth_start(void *aes, size_t M, size_t L, const u8 *nonce,
os_memset(aad_buf + 2 + aad_len, 0, sizeof(aad_buf) - 2 - aad_len);
xor_aes_block(aad_buf, x);
- aes_encrypt(aes, aad_buf, x); /* X_2 = E(K, X_1 XOR B_1) */
+ aes_encrypt_128(aes, aad_buf, x); /* X_2 = E(K, X_1 XOR B_1) */
if (aad_len > AES_BLOCK_SIZE - 2) {
xor_aes_block(&aad_buf[AES_BLOCK_SIZE], x);
/* X_3 = E(K, X_2 XOR B_2) */
- aes_encrypt(aes, &aad_buf[AES_BLOCK_SIZE], x);
+ aes_encrypt_128(aes, &aad_buf[AES_BLOCK_SIZE], x);
}
}
@@ -69,13 +69,13 @@ static void aes_ccm_auth(void *aes, const u8 *data, size_t len, u8 *x)
/* X_i+1 = E(K, X_i XOR B_i) */
xor_aes_block(x, data);
data += AES_BLOCK_SIZE;
- aes_encrypt(aes, x, x);
+ aes_encrypt_128(aes, x, x);
}
if (last) {
/* XOR zero-padded last block */
for (i = 0; i < last; i++)
x[i] ^= *data++;
- aes_encrypt(aes, x, x);
+ aes_encrypt_128(aes, x, x);
}
}
@@ -98,14 +98,14 @@ static void aes_ccm_encr(void *aes, size_t L, const u8 *in, size_t len, u8 *out,
for (i = 1; i <= len / AES_BLOCK_SIZE; i++) {
WPA_PUT_BE16(&a[AES_BLOCK_SIZE - 2], i);
/* S_i = E(K, A_i) */
- aes_encrypt(aes, a, out);
+ aes_encrypt_128(aes, a, out);
xor_aes_block(out, in);
out += AES_BLOCK_SIZE;
in += AES_BLOCK_SIZE;
}
if (last) {
WPA_PUT_BE16(&a[AES_BLOCK_SIZE - 2], i);
- aes_encrypt(aes, a, out);
+ aes_encrypt_128(aes, a, out);
/* XOR zero-padded last block */
for (i = 0; i < last; i++)
*out++ ^= *in++;
@@ -121,7 +121,7 @@ static void aes_ccm_encr_auth(void *aes, size_t M, u8 *x, u8 *a, u8 *auth)
wpa_hexdump_key(_MSG_EXCESSIVE_, "CCM T", x, M);
/* U = T XOR S_0; S_0 = E(K, A_0) */
WPA_PUT_BE16(&a[AES_BLOCK_SIZE - 2], 0);
- aes_encrypt(aes, a, tmp);
+ aes_encrypt_128(aes, a, tmp);
for (i = 0; i < M; i++)
auth[i] = x[i] ^ tmp[i];
wpa_hexdump_key(_MSG_EXCESSIVE_, "CCM U", auth, M);
@@ -136,7 +136,7 @@ static void aes_ccm_decr_auth(void *aes, size_t M, u8 *a, const u8 *auth, u8 *t)
wpa_hexdump_key(_MSG_EXCESSIVE_, "CCM U", auth, M);
/* U = T XOR S_0; S_0 = E(K, A_0) */
WPA_PUT_BE16(&a[AES_BLOCK_SIZE - 2], 0);
- aes_encrypt(aes, a, tmp);
+ aes_encrypt_128(aes, a, tmp);
for (i = 0; i < M; i++)
t[i] = auth[i] ^ tmp[i];
wpa_hexdump_key(_MSG_EXCESSIVE_, "CCM T", t, M);
diff --git a/drivers/staging/rtl8723cs/core/crypto/aes-ctr.c b/drivers/staging/rtl8723cs/core/crypto/aes-ctr.c
index 6c06851ddc68..9533709b7485 100644
--- a/drivers/staging/rtl8723cs/core/crypto/aes-ctr.c
+++ b/drivers/staging/rtl8723cs/core/crypto/aes-ctr.c
@@ -36,7 +36,7 @@ int aes_ctr_encrypt(const u8 *key, size_t key_len, const u8 *nonce,
os_memcpy(counter, nonce, AES_BLOCK_SIZE);
while (left > 0) {
- aes_encrypt(ctx, counter, buf);
+ aes_encrypt_128(ctx, counter, buf);
len = (left < AES_BLOCK_SIZE) ? left : AES_BLOCK_SIZE;
for (j = 0; j < len; j++)
diff --git a/drivers/staging/rtl8723cs/core/crypto/aes-gcm.c b/drivers/staging/rtl8723cs/core/crypto/aes-gcm.c
index 47088102b9cc..76061f53db24 100644
--- a/drivers/staging/rtl8723cs/core/crypto/aes-gcm.c
+++ b/drivers/staging/rtl8723cs/core/crypto/aes-gcm.c
@@ -154,7 +154,7 @@ static void aes_gctr(void *aes, const u8 *icb, const u8 *x, size_t xlen, u8 *y)
os_memcpy(cb, icb, AES_BLOCK_SIZE);
/* Full blocks */
for (i = 0; i < n; i++) {
- aes_encrypt(aes, cb, ypos);
+ aes_encrypt_128(aes, cb, ypos);
xor_block(ypos, xpos);
xpos += AES_BLOCK_SIZE;
ypos += AES_BLOCK_SIZE;
@@ -164,7 +164,7 @@ static void aes_gctr(void *aes, const u8 *icb, const u8 *x, size_t xlen, u8 *y)
last = x + xlen - xpos;
if (last) {
/* Last, partial block */
- aes_encrypt(aes, cb, tmp);
+ aes_encrypt_128(aes, cb, tmp);
for (i = 0; i < last; i++)
*ypos++ = *xpos++ ^ tmp[i];
}
@@ -181,7 +181,7 @@ static void * aes_gcm_init_hash_subkey(const u8 *key, size_t key_len, u8 *H)
/* Generate hash subkey H = AES_K(0^128) */
os_memset(H, 0, AES_BLOCK_SIZE);
- aes_encrypt(aes, H, H);
+ aes_encrypt_128(aes, H, H);
wpa_hexdump_key(_MSG_EXCESSIVE_, "Hash subkey H for GHASH",
H, AES_BLOCK_SIZE);
return aes;
diff --git a/drivers/staging/rtl8723cs/core/crypto/aes-internal-enc.c b/drivers/staging/rtl8723cs/core/crypto/aes-internal-enc.c
index 69e256be95ce..6728363b6bf2 100644
--- a/drivers/staging/rtl8723cs/core/crypto/aes-internal-enc.c
+++ b/drivers/staging/rtl8723cs/core/crypto/aes-internal-enc.c
@@ -114,7 +114,7 @@ void * aes_encrypt_init(const u8 *key, size_t len)
}
-int aes_encrypt(void *ctx, const u8 *plain, u8 *crypt)
+int aes_encrypt_128(void *ctx, const u8 *plain, u8 *crypt)
{
u32 *rk = ctx;
rijndaelEncrypt(ctx, rk[AES_PRIV_NR_POS], plain, crypt);
diff --git a/drivers/staging/rtl8723cs/core/crypto/aes-omac1.c b/drivers/staging/rtl8723cs/core/crypto/aes-omac1.c
index 30b52629f4be..2d20aed87046 100644
--- a/drivers/staging/rtl8723cs/core/crypto/aes-omac1.c
+++ b/drivers/staging/rtl8723cs/core/crypto/aes-omac1.c
@@ -81,12 +81,12 @@ int omac1_aes_vector(const u8 *key, size_t key_len, size_t num_elem,
}
}
if (left > AES_BLOCK_SIZE)
- aes_encrypt(ctx, cbc, cbc);
+ aes_encrypt_128(ctx, cbc, cbc);
left -= AES_BLOCK_SIZE;
}
os_memset(pad, 0, AES_BLOCK_SIZE);
- aes_encrypt(ctx, pad, pad);
+ aes_encrypt_128(ctx, pad, pad);
gf_mulx(pad);
if (left || total_len == 0) {
@@ -110,7 +110,7 @@ int omac1_aes_vector(const u8 *key, size_t key_len, size_t num_elem,
for (i = 0; i < AES_BLOCK_SIZE; i++)
pad[i] ^= cbc[i];
- aes_encrypt(ctx, pad, mac);
+ aes_encrypt_128(ctx, pad, mac);
aes_encrypt_deinit(ctx);
return 0;
}
diff --git a/drivers/staging/rtl8723cs/core/crypto/aes.h b/drivers/staging/rtl8723cs/core/crypto/aes.h
index 8ab3de2ee83f..1aafe3b4e52f 100644
--- a/drivers/staging/rtl8723cs/core/crypto/aes.h
+++ b/drivers/staging/rtl8723cs/core/crypto/aes.h
@@ -12,7 +12,7 @@
#define AES_BLOCK_SIZE 16
void * aes_encrypt_init(const u8 *key, size_t len);
-int aes_encrypt(void *ctx, const u8 *plain, u8 *crypt);
+int aes_encrypt_128(void *ctx, const u8 *plain, u8 *crypt);
void aes_encrypt_deinit(void *ctx);
void * aes_decrypt_init(const u8 *key, size_t len);
int aes_decrypt(void *ctx, const u8 *crypt, u8 *plain);
--
2.35.3

View File

@@ -1,7 +1,8 @@
From f60f1605f5056d543e49fc625ffeeb05621f2ad3 Mon Sep 17 00:00:00 2001
From: Vasily Khoruzhick
From aae7511dd92f82090c08b8d502f1a5d34344b439 Mon Sep 17 00:00:00 2001
From: Vasily Khoruzhick <anarsoul@gmail.com>
Date: Wed, 31 Oct 2018 19:40:18 -0700
Subject: Bluetooth: Add new quirk for broken local ext features max_page
Subject: [PATCH 181/389] Bluetooth: Add new quirk for broken local ext
features max_page
Some adapters (e.g. RTL8723CS) advertise that they have more than
2 pages for local ext features, but they don't support any features
@@ -16,30 +17,30 @@ Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 16ab6ce87883..8e4c16210d18 100644
index 684f1cd28730..dccd175c75b8 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -238,6 +238,13 @@ enum {
* HCI after resume.
@@ -275,6 +275,13 @@ enum {
*/
HCI_QUIRK_NO_SUSPEND_NOTIFIER,
+
HCI_QUIRK_BROKEN_ENHANCED_SETUP_SYNC_CONN,
+ /* When this quirk is set, max_page for local extended features
+ * is set to 1, even if controller reports higher number. Some
+ * controllers (e.g. RTL8723CS) report more pages, but they
+ * don't actually support features declared there.
+ */
+ HCI_QUIRK_BROKEN_LOCAL_EXT_FTR_MAX_PAGE,
+
/*
* When this quirk is set, LE tx power is not queried on startup
* When this quirk is set, the HCI_OP_LE_SET_EXT_SCAN_ENABLE command is
* disabled. This is required for some Broadcom controllers which
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index cfeaee347db3..df3232828978 100644
index faca701bce2a..14f2b8ff3925 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -700,7 +700,9 @@ static void hci_cc_read_local_ext_features(struct hci_dev *hdev,
@@ -881,7 +881,9 @@ static u8 hci_cc_read_local_ext_features(struct hci_dev *hdev, void *data,
if (rp->status)
return;
return rp->status;
- if (hdev->max_page < rp->max_page)
+ if (!test_bit(HCI_QUIRK_BROKEN_LOCAL_EXT_FTR_MAX_PAGE,
@@ -49,5 +50,5 @@ index cfeaee347db3..df3232828978 100644
if (rp->page < HCI_MAX_PAGES)
--
cgit v1.2.3
2.35.3

View File

@@ -1,7 +1,7 @@
From 26e61cffb09c1f5519a4eeb9d9e99239d58b6c2d Mon Sep 17 00:00:00 2001
From: Ondrej Jirman <megous@megous.com>
From 32bb69cc54390f9ca298095c286e5268263ecbec Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ond=C5=99ej=20Jirman?= <megi@xff.cz>
Date: Thu, 1 Jul 2021 11:22:23 +0200
Subject: [PATCH 302/467] Bluetooth: btrtl: add support for the RTL8723CS
Subject: [PATCH 183/389] Bluetooth: btrtl: add support for the RTL8723CS
The Realtek RTL8723CS is SDIO WiFi chip. It also contains a Bluetooth
module which is connected via UART to the host.
@@ -14,14 +14,14 @@ Also this chip declares support for some features it doesn't support
so add a quirk to indicate that these features are broken.
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Signed-off-by: Ondrej Jirman <megous@megous.com>
Signed-off-by: Ondrej Jirman <megi@xff.cz>
---
drivers/bluetooth/btrtl.c | 119 +++++++++++++++++++++++++++++++++++++-
drivers/bluetooth/btrtl.c | 124 ++++++++++++++++++++++++++++++++++++--
drivers/bluetooth/btrtl.h | 5 ++
2 files changed, 121 insertions(+), 3 deletions(-)
2 files changed, 125 insertions(+), 4 deletions(-)
diff --git a/drivers/bluetooth/btrtl.c b/drivers/bluetooth/btrtl.c
index 1f8afa024..fd293a9c4 100644
index fb52313a1d45..3aa02ab48ddd 100644
--- a/drivers/bluetooth/btrtl.c
+++ b/drivers/bluetooth/btrtl.c
@@ -17,7 +17,12 @@
@@ -45,15 +45,15 @@ index 1f8afa024..fd293a9c4 100644
#define IC_INFO(lmps, hcir, hciv, bus) \
.match_flags = IC_MATCH_FL_LMPSUBV | IC_MATCH_FL_HCIREV | \
IC_MATCH_FL_HCIVER | IC_MATCH_FL_HCIBUS, \
@@ -57,6 +63,7 @@ struct id_table {
@@ -59,6 +65,7 @@ struct id_table {
__u16 hci_rev;
__u8 hci_ver;
__u8 hci_bus;
+ __u8 chip_type;
bool config_needed;
bool has_rom_version;
char *fw_name;
@@ -96,6 +103,39 @@ static const struct id_table ic_id_table[] = {
bool has_msft_ext;
@@ -99,6 +106,39 @@ static const struct id_table ic_id_table[] = {
.fw_name = "rtl_bt/rtl8723b_fw.bin",
.cfg_name = "rtl_bt/rtl8723b_config" },
@@ -93,7 +93,7 @@ index 1f8afa024..fd293a9c4 100644
/* 8723D */
{ IC_INFO(RTL_ROM_LMP_8723B, 0xd, 0x8, HCI_USB),
.config_needed = true,
@@ -175,7 +215,8 @@ static const struct id_table ic_id_table[] = {
@@ -208,7 +248,8 @@ static const struct id_table ic_id_table[] = {
};
static const struct id_table *btrtl_match_ic(u16 lmp_subver, u16 hci_rev,
@@ -103,7 +103,7 @@ index 1f8afa024..fd293a9c4 100644
{
int i;
@@ -192,6 +233,9 @@ static const struct id_table *btrtl_match_ic(u16 lmp_subver, u16 hci_rev,
@@ -225,6 +266,9 @@ static const struct id_table *btrtl_match_ic(u16 lmp_subver, u16 hci_rev,
if ((ic_id_table[i].match_flags & IC_MATCH_FL_HCIBUS) &&
(ic_id_table[i].hci_bus != hci_bus))
continue;
@@ -113,7 +113,7 @@ index 1f8afa024..fd293a9c4 100644
break;
}
@@ -274,6 +318,7 @@ static int rtlbt_parse_firmware(struct hci_dev *hdev,
@@ -307,6 +351,7 @@ static int rtlbt_parse_firmware(struct hci_dev *hdev,
{ RTL_ROM_LMP_8723B, 1 },
{ RTL_ROM_LMP_8821A, 2 },
{ RTL_ROM_LMP_8761A, 3 },
@@ -121,7 +121,7 @@ index 1f8afa024..fd293a9c4 100644
{ RTL_ROM_LMP_8822B, 8 },
{ RTL_ROM_LMP_8723B, 9 }, /* 8723D */
{ RTL_ROM_LMP_8821A, 10 }, /* 8821C */
@@ -552,6 +597,48 @@ static int btrtl_setup_rtl8723b(struct hci_dev *hdev,
@@ -587,6 +632,48 @@ static int btrtl_setup_rtl8723b(struct hci_dev *hdev,
return ret;
}
@@ -170,7 +170,7 @@ index 1f8afa024..fd293a9c4 100644
void btrtl_free(struct btrtl_device_info *btrtl_dev)
{
kvfree(btrtl_dev->fw_data);
@@ -568,7 +655,7 @@ struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev,
@@ -603,7 +690,7 @@ struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev,
struct hci_rp_read_local_version *resp;
char cfg_name[40];
u16 hci_rev, lmp_subver;
@@ -179,10 +179,13 @@ index 1f8afa024..fd293a9c4 100644
int ret;
u16 opcode;
u8 cmd[2];
@@ -638,8 +725,14 @@ struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev,
out_free:
kfree_skb(skb);
@@ -629,8 +716,17 @@ struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev,
hci_rev = le16_to_cpu(resp->hci_rev);
lmp_subver = le16_to_cpu(resp->lmp_subver);
+ /*
+ * We assume drop_fw is not needed for devices that have chip_type.
+ */
+ if (rtl_has_chip_type(lmp_subver)) {
+ ret = rtl_read_chip_type(hdev, &chip_type);
+ if (ret)
@@ -193,9 +196,9 @@ index 1f8afa024..fd293a9c4 100644
- hdev->bus);
+ hdev->bus, chip_type);
if (!btrtl_dev->ic_info) {
rtl_dev_info(hdev, "unknown IC info, lmp subver %04x, hci rev %04x, hci ver %04x",
@@ -757,7 +757,7 @@ struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev,
if (!btrtl_dev->ic_info)
btrtl_dev->drop_fw = true;
@@ -673,7 +769,7 @@ struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev,
lmp_subver = le16_to_cpu(resp->lmp_subver);
btrtl_dev->ic_info = btrtl_match_ic(lmp_subver, hci_rev, hci_ver,
@@ -204,7 +207,7 @@ index 1f8afa024..fd293a9c4 100644
}
out_free:
kfree_skb(skb);
@@ -722,6 +815,7 @@ int btrtl_download_firmware(struct hci_dev *hdev,
@@ -755,6 +851,7 @@ int btrtl_download_firmware(struct hci_dev *hdev,
case RTL_ROM_LMP_8761A:
case RTL_ROM_LMP_8822B:
case RTL_ROM_LMP_8852A:
@@ -212,7 +215,7 @@ index 1f8afa024..fd293a9c4 100644
return btrtl_setup_rtl8723b(hdev, btrtl_dev);
default:
rtl_dev_info(hdev, "assuming no firmware upload needed");
@@ -752,6 +846,19 @@ void btrtl_set_quirks(struct hci_dev *hdev, struct btrtl_device_info *btrtl_dev)
@@ -788,6 +885,19 @@ void btrtl_set_quirks(struct hci_dev *hdev, struct btrtl_device_info *btrtl_dev)
rtl_dev_dbg(hdev, "WBS supported not enabled.");
break;
}
@@ -232,7 +235,7 @@ index 1f8afa024..fd293a9c4 100644
}
EXPORT_SYMBOL_GPL(btrtl_set_quirks);
@@ -910,6 +1017,12 @@ MODULE_FIRMWARE("rtl_bt/rtl8723b_fw.bin");
@@ -946,6 +1056,12 @@ MODULE_FIRMWARE("rtl_bt/rtl8723b_fw.bin");
MODULE_FIRMWARE("rtl_bt/rtl8723b_config.bin");
MODULE_FIRMWARE("rtl_bt/rtl8723bs_fw.bin");
MODULE_FIRMWARE("rtl_bt/rtl8723bs_config.bin");
@@ -246,7 +249,7 @@ index 1f8afa024..fd293a9c4 100644
MODULE_FIRMWARE("rtl_bt/rtl8723ds_config.bin");
MODULE_FIRMWARE("rtl_bt/rtl8761a_fw.bin");
diff --git a/drivers/bluetooth/btrtl.h b/drivers/bluetooth/btrtl.h
index 2c441bda3..1c6282241 100644
index 2c441bda390a..1c6282241d2d 100644
--- a/drivers/bluetooth/btrtl.h
+++ b/drivers/bluetooth/btrtl.h
@@ -14,6 +14,11 @@
@@ -262,5 +265,5 @@ index 2c441bda3..1c6282241 100644
__u8 index;
__u8 data[RTL_FRAG_LEN];
--
2.34.0
2.35.3

View File

@@ -1,23 +1,23 @@
From 8fc0422773dc5274fa32e2a5a6ce2e1f0a96d78c Mon Sep 17 00:00:00 2001
From 59bac57a5f727d9fba16789297983c788925b561 Mon Sep 17 00:00:00 2001
From: Vasily Khoruzhick <anarsoul@gmail.com>
Date: Wed, 31 Oct 2018 20:07:41 -0700
Subject: [PATCH 304/467] Bluetooth: hci_h5: Add support for binding RTL8723CS
Subject: [PATCH 185/389] Bluetooth: hci_h5: Add support for binding RTL8723CS
with device tree
RTL8723CS is often used in ARM boards, so add ability to bind it
using device tree.
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Signed-off-by: Ondrej Jirman <megous@megous.com>
Signed-off-by: Ondrej Jirman <megi@xff.cz>
---
drivers/bluetooth/hci_h5.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c
index d49a39d17..c9b54335a 100644
index c5a0409ef84f..0ff9d8477e85 100644
--- a/drivers/bluetooth/hci_h5.c
+++ b/drivers/bluetooth/hci_h5.c
@@ -1100,6 +1100,8 @@ static const struct of_device_id rtl_bluetooth_of_match[] = {
@@ -1102,6 +1102,8 @@ static const struct of_device_id rtl_bluetooth_of_match[] = {
.data = (const void *)&h5_data_rtl8723bs },
{ .compatible = "realtek,rtl8723ds-bt",
.data = (const void *)&h5_data_rtl8723bs },
@@ -27,5 +27,5 @@ index d49a39d17..c9b54335a 100644
{ },
};
--
2.34.0
2.35.3

View File

@@ -0,0 +1,29 @@
From 70b722df3402e550906374b90be41a8ba0fb1f5c Mon Sep 17 00:00:00 2001
From: Ondrej Jirman <megi@xff.cz>
Date: Fri, 2 Dec 2022 22:55:59 +0100
Subject: [PATCH 187/389] bluetooth: h5: Don't re-initialize rtl8723cs on
resume
The power is kept across during sleep, and this is not necessary.
Signed-off-by: Ondrej Jirman <megi@xff.cz>
---
drivers/bluetooth/hci_h5.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c
index 0ff9d8477e85..5d1319e5565c 100644
--- a/drivers/bluetooth/hci_h5.c
+++ b/drivers/bluetooth/hci_h5.c
@@ -1103,7 +1103,7 @@ static const struct of_device_id rtl_bluetooth_of_match[] = {
{ .compatible = "realtek,rtl8723ds-bt",
.data = (const void *)&h5_data_rtl8723bs },
{ .compatible = "realtek,rtl8723cs-bt",
- .data = (const void *)&h5_data_rtl8723bs },
+ .data = (const void *)&h5_data_rtl8822cs },
#endif
{ },
};
--
2.35.3

View File

@@ -0,0 +1,57 @@
From 1a5982e248a18f8eed71c3ffd8057f5922efb523 Mon Sep 17 00:00:00 2001
From: Vasily Khoruzhick <anarsoul@gmail.com>
Date: Wed, 31 Oct 2018 20:05:14 -0700
Subject: [PATCH 179/389] dt-bindings: net: bluetooth: Add rtl8723bs-bluetooth
Add binding document for bluetooth part of RTL8723BS/RTL8723CS
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
---
.../bindings/net/rtl8723bs-bluetooth.txt | 35 +++++++++++++++++++
1 file changed, 35 insertions(+)
create mode 100644 Documentation/devicetree/bindings/net/rtl8723bs-bluetooth.txt
diff --git a/Documentation/devicetree/bindings/net/rtl8723bs-bluetooth.txt b/Documentation/devicetree/bindings/net/rtl8723bs-bluetooth.txt
new file mode 100644
index 000000000000..8357f242ae4c
--- /dev/null
+++ b/Documentation/devicetree/bindings/net/rtl8723bs-bluetooth.txt
@@ -0,0 +1,35 @@
+RTL8723BS/RTL8723CS Bluetooth
+---------------------
+
+RTL8723CS/RTL8723CS is WiFi + BT chip. WiFi part is connected over SDIO, while
+BT is connected over serial. It speaks H5 protocol with few extra commands
+to upload firmware and change module speed.
+
+Required properties:
+
+ - compatible: should be one of the following:
+ * "realtek,rtl8723bs-bt"
+ * "realtek,rtl8723cs-bt"
+Optional properties:
+
+ - device-wake-gpios: GPIO specifier, used to wakeup the BT module (active high)
+ - enable-gpios: GPIO specifier, used to enable the BT module (active high)
+ - host-wake-gpios: GPIO specifier, used to wakeup the host processor (active high)
+ - firmware-postfix: firmware postfix to be used for firmware config
+ - reset-gpios: GPIO specifier, used to reset the BT module (active high)
+
+Example:
+
+&uart1 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&uart1_pins>, <&uart1_rts_cts_pins>;
+ status = "okay";
+
+ bluetooth {
+ compatible = "realtek,rtl8723bs-bt";
+ reset-gpios = <&r_pio 0 4 GPIO_ACTIVE_LOW>; /* PL4 */
+ device-wake-gpios = <&r_pio 0 5 GPIO_ACTIVE_HIGH>; /* PL5 */
+ host-wakeup-gpios = <&r_pio 0 6 GPIO_ACTIVE_HIGH>; /* PL6 */
+ firmware-postfix="pine64";
+ };
+};
--
2.35.3

View File

@@ -140,6 +140,7 @@
patches.armbian/arm64-dts-sun50i-a64-olinuxino-1Ge16GW-enable-bluetooth.patch
patches.armbian/arm64-dts-sun50i-a64.dtsi-adjust-thermal-trip-points.patch
patches.armbian/arm64-dts-sun50i-a64-olinuxino-1Ge16GW-Disable-clock-phase-and-.patch
patches.armbian/arm64-dts-sun50i-a64-pinephone-wowlan.patch
patches.armbian/arm64-dts-sun50i-h6-orangepi-3-add-r_uart-aliase.patch
patches.armbian/arm64-dts-sun50i-h5-add-cpu-opp-refs.patch
patches.armbian/arm64-dts-sun50i-h5-add-termal-zones.patch

View File

@@ -117,6 +117,35 @@
patches.megous/usb-musb-sunxi-Avoid-enabling-host-side-code-on-SoCs-where-it-s.patch
patches.megous/arm64-dts-sun50i-a64-Add-missing-trip-points-for-GPU.patch
patches.megous/arm64-dts-allwinner-sun50i-a64-pinephone-Add-support-for-Pineph.patch
- patches.megous/8723cs-Add-a-new-driver-v5.12.2-7-g2de5ec386.20201013_beta.patch
- patches.megous/8723cs-Make-the-driver-compile-and-probe-drop-rockchip-platform.patch
- patches.megous/8723cs-Enable-OOB-interrupt.patch
- patches.megous/8723cs-Load-the-MAC-address-from-local-mac-address.patch
- patches.megous/8723cs-Modify-makefile-options-to-better-suit-PinePhone-Allwinn.patch
- patches.megous/8723cs-Enable-monitor-mode.patch
- patches.megous/8723cs-Disable-power-saving.patch
- patches.megous/8723cs-aes_encrypt-aes_encrypt_128-to-avoid-symbol-name-conflic.patch
- patches.megous/8723cs-Enable-wifi-power-saving-mode.patch
- patches.megous/8723cs-Enable-TDLS-802.11z-support-direct-sta-sta-connection.patch
- patches.megous/8723cs-Disable-CONFIG_CONCURRENT_MODE.patch
- patches.megous/8723cs-Set-CONFIG_RTW_SDIO_PM_KEEP_POWER-n-to-fix-suspend-38.patch
- patches.megous/8723cs-Resume-wifi-in-a-workqueue.patch
- patches.megous/8723cs-Port-to-5.11.patch
- patches.megous/8723cs-Enable-WoWLAN.patch
- patches.megous/8723cs-Port-to-5.12.patch
- patches.megous/8723cs-Fix-misleading-indentation.patch
- patches.megous/8723cs-Disable-use-of-NAPI.patch
- patches.megous/8723cs-Fix-indentation.patch
- patches.megous/8723cs-Fix-compile-warnings.patch
- patches.megous/8723cs-Port-to-5.15.patch
- patches.megous/8723cs-Clear-wowlan_last_wake_reason-prior-to-suspend.patch
- patches.megous/8723cs-Forward-port-to-5.17.patch
- patches.megous/8723cs-Port-to-5.18.patch
- patches.megous/8723cs-Fix-some-compilation-warnings.patch
- patches.megous/8723cs-Adapt-to-API-changes-in-stable-5.19.2-and-6.0.patch
- patches.megous/8723cs-Port-to-6.0.patch
- patches.megous/8723cs-Port-to-6.1.patch
- patches.megous/8723cs-Port-to-6.1-rc1.patch
patches.megous/tty-serial-8250-dw-Use-fifo-size-from-DTS.patch
patches.megous/arm64-dts-sun50i-a64-Set-fifo-size-for-uarts.patch
patches.megous/ARM-dts-sun8i-a83t-Set-fifo-size-for-uarts.patch
@@ -154,10 +183,15 @@
patches.megous/Revert-drm-sun4i-lvds-Invert-the-LVDS-polarity.patch
patches.megous/arm64-dts-allwinner-Enforce-consistent-MMC-numbering.patch
patches.megous/ARM-dts-sunxi-Add-aliases-for-MMC.patch
- patches.megous/dt-bindings-net-bluetooth-Add-rtl8723bs-bluetooth.patch
patches.megous/of-property-fw_devlink-Support-allwinner-sram-links.patch
- patches.megous/Bluetooth-Add-new-quirk-for-broken-local-ext-features-max_page.patch
patches.megous/rtw89-Fix-crash-by-loading-compressed-firmware-file.patch
- patches.megous/Bluetooth-btrtl-add-support-for-the-RTL8723CS.patch
patches.megous/drm-rockchip-Fix-panic-on-reboot-when-DRM-device-fails-to-bind.patch
- patches.megous/Bluetooth-hci_h5-Add-support-for-binding-RTL8723CS-with-device-.patch
patches.megous/arm64-dts-rockchip-rk356x-Fix-PCIe-register-map-and-ranges.patch
- patches.megous/bluetooth-h5-Don-t-re-initialize-rtl8723cs-on-resume.patch
patches.megous/drm-sun4i-Unify-sun8i_-_layer-structs.patch
patches.megous/drm-sun4i-Add-more-parameters-to-sunxi_engine-commit-callback.patch
patches.megous/drm-sun4i-Fix-layer-zpos-change-atomic-modesetting.patch
@@ -510,6 +544,7 @@
patches.armbian/arm64-dts-sun50i-a64-olinuxino-1Ge16GW-enable-bluetooth.patch
patches.armbian/arm64-dts-sun50i-a64.dtsi-adjust-thermal-trip-points.patch
patches.armbian/arm64-dts-sun50i-a64-olinuxino-1Ge16GW-Disable-clock-phase-and-.patch
patches.armbian/arm64-dts-sun50i-a64-pinephone-wowlan.patch
patches.armbian/arm64-dts-sun50i-h6-orangepi-3-add-r_uart-aliase.patch
patches.armbian/arm64-dts-sun50i-h5-add-cpu-opp-refs.patch
patches.armbian/arm64-dts-sun50i-h5-add-termal-zones.patch

View File

@@ -117,6 +117,35 @@
patches.megous/usb-musb-sunxi-Avoid-enabling-host-side-code-on-SoCs-where-it-s.patch
patches.megous/arm64-dts-sun50i-a64-Add-missing-trip-points-for-GPU.patch
patches.megous/arm64-dts-allwinner-sun50i-a64-pinephone-Add-support-for-Pineph.patch
- patches.megous/8723cs-Add-a-new-driver-v5.12.2-7-g2de5ec386.20201013_beta.patch
- patches.megous/8723cs-Make-the-driver-compile-and-probe-drop-rockchip-platform.patch
- patches.megous/8723cs-Enable-OOB-interrupt.patch
- patches.megous/8723cs-Load-the-MAC-address-from-local-mac-address.patch
- patches.megous/8723cs-Modify-makefile-options-to-better-suit-PinePhone-Allwinn.patch
- patches.megous/8723cs-Enable-monitor-mode.patch
- patches.megous/8723cs-Disable-power-saving.patch
- patches.megous/8723cs-aes_encrypt-aes_encrypt_128-to-avoid-symbol-name-conflic.patch
- patches.megous/8723cs-Enable-wifi-power-saving-mode.patch
- patches.megous/8723cs-Enable-TDLS-802.11z-support-direct-sta-sta-connection.patch
- patches.megous/8723cs-Disable-CONFIG_CONCURRENT_MODE.patch
- patches.megous/8723cs-Set-CONFIG_RTW_SDIO_PM_KEEP_POWER-n-to-fix-suspend-38.patch
- patches.megous/8723cs-Resume-wifi-in-a-workqueue.patch
- patches.megous/8723cs-Port-to-5.11.patch
- patches.megous/8723cs-Enable-WoWLAN.patch
- patches.megous/8723cs-Port-to-5.12.patch
- patches.megous/8723cs-Fix-misleading-indentation.patch
- patches.megous/8723cs-Disable-use-of-NAPI.patch
- patches.megous/8723cs-Fix-indentation.patch
- patches.megous/8723cs-Fix-compile-warnings.patch
- patches.megous/8723cs-Port-to-5.15.patch
- patches.megous/8723cs-Clear-wowlan_last_wake_reason-prior-to-suspend.patch
- patches.megous/8723cs-Forward-port-to-5.17.patch
- patches.megous/8723cs-Port-to-5.18.patch
- patches.megous/8723cs-Fix-some-compilation-warnings.patch
- patches.megous/8723cs-Adapt-to-API-changes-in-stable-5.19.2-and-6.0.patch
- patches.megous/8723cs-Port-to-6.0.patch
- patches.megous/8723cs-Port-to-6.1.patch
- patches.megous/8723cs-Port-to-6.1-rc1.patch
patches.megous/tty-serial-8250-dw-Use-fifo-size-from-DTS.patch
patches.megous/arm64-dts-sun50i-a64-Set-fifo-size-for-uarts.patch
patches.megous/ARM-dts-sun8i-a83t-Set-fifo-size-for-uarts.patch
@@ -154,10 +183,15 @@
patches.megous/Revert-drm-sun4i-lvds-Invert-the-LVDS-polarity.patch
patches.megous/arm64-dts-allwinner-Enforce-consistent-MMC-numbering.patch
patches.megous/ARM-dts-sunxi-Add-aliases-for-MMC.patch
- patches.megous/dt-bindings-net-bluetooth-Add-rtl8723bs-bluetooth.patch
patches.megous/of-property-fw_devlink-Support-allwinner-sram-links.patch
- patches.megous/Bluetooth-Add-new-quirk-for-broken-local-ext-features-max_page.patch
patches.megous/rtw89-Fix-crash-by-loading-compressed-firmware-file.patch
- patches.megous/Bluetooth-btrtl-add-support-for-the-RTL8723CS.patch
patches.megous/drm-rockchip-Fix-panic-on-reboot-when-DRM-device-fails-to-bind.patch
- patches.megous/Bluetooth-hci_h5-Add-support-for-binding-RTL8723CS-with-device-.patch
patches.megous/arm64-dts-rockchip-rk356x-Fix-PCIe-register-map-and-ranges.patch
- patches.megous/bluetooth-h5-Don-t-re-initialize-rtl8723cs-on-resume.patch
patches.megous/drm-sun4i-Unify-sun8i_-_layer-structs.patch
patches.megous/drm-sun4i-Add-more-parameters-to-sunxi_engine-commit-callback.patch
patches.megous/drm-sun4i-Fix-layer-zpos-change-atomic-modesetting.patch

View File

@@ -0,0 +1,12 @@
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
index 53f4c1f66..3c3b3e933 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
@@ -720,6 +720,7 @@ &mmc1 {
non-removable;
post-power-on-delay-ms = <1>; /* wifi power is always on */
status = "okay";
+ keep-power-in-suspend;
rtl8723cs: wifi@1 {
reg = <1>;

View File

@@ -155,6 +155,7 @@
patches.armbian/arm64-dts-sun50i-a64-olinuxino-1Ge16GW-enable-bluetooth.patch
patches.armbian/arm64-dts-sun50i-a64.dtsi-adjust-thermal-trip-points.patch
patches.armbian/arm64-dts-sun50i-a64-olinuxino-1Ge16GW-Disable-clock-phase-and-.patch
patches.armbian/arm64-dts-sun50i-a64-pinephone-wowlan.patch
patches.armbian/arm64-dts-sun50i-h6-orangepi-3-add-r_uart-aliase.patch
patches.armbian/arm64-dts-sun50i-h5-add-cpu-opp-refs.patch
patches.armbian/arm64-dts-sun50i-h5-add-termal-zones.patch

View File

@@ -117,35 +117,35 @@
patches.megous/usb-musb-sunxi-Avoid-enabling-host-side-code-on-SoCs-where-it-s.patch
patches.megous/arm64-dts-sun50i-a64-Add-missing-trip-points-for-GPU.patch
patches.megous/arm64-dts-allwinner-sun50i-a64-pinephone-Add-support-for-Pineph.patch
patches.megous/8723cs-Add-a-new-driver-v5.12.2-7-g2de5ec386.20201013_beta.patch
patches.megous/8723cs-Make-the-driver-compile-and-probe-drop-rockchip-platform.patch
patches.megous/8723cs-Enable-OOB-interrupt.patch
patches.megous/8723cs-Load-the-MAC-address-from-local-mac-address.patch
patches.megous/8723cs-Modify-makefile-options-to-better-suit-PinePhone-Allwinn.patch
patches.megous/8723cs-Enable-monitor-mode.patch
patches.megous/8723cs-Disable-power-saving.patch
patches.megous/8723cs-aes_encrypt-aes_encrypt_128-to-avoid-symbol-name-conflic.patch
patches.megous/8723cs-Enable-wifi-power-saving-mode.patch
patches.megous/8723cs-Enable-TDLS-802.11z-support-direct-sta-sta-connection.patch
patches.megous/8723cs-Disable-CONFIG_CONCURRENT_MODE.patch
patches.megous/8723cs-Set-CONFIG_RTW_SDIO_PM_KEEP_POWER-n-to-fix-suspend-38.patch
patches.megous/8723cs-Resume-wifi-in-a-workqueue.patch
patches.megous/8723cs-Port-to-5.11.patch
patches.megous/8723cs-Enable-WoWLAN.patch
patches.megous/8723cs-Port-to-5.12.patch
patches.megous/8723cs-Fix-misleading-indentation.patch
patches.megous/8723cs-Disable-use-of-NAPI.patch
patches.megous/8723cs-Fix-indentation.patch
patches.megous/8723cs-Fix-compile-warnings.patch
patches.megous/8723cs-Port-to-5.15.patch
patches.megous/8723cs-Clear-wowlan_last_wake_reason-prior-to-suspend.patch
patches.megous/8723cs-Forward-port-to-5.17.patch
patches.megous/8723cs-Port-to-5.18.patch
patches.megous/8723cs-Fix-some-compilation-warnings.patch
patches.megous/8723cs-Adapt-to-API-changes-in-stable-5.19.2-and-6.0.patch
patches.megous/8723cs-Port-to-6.0.patch
patches.megous/8723cs-Port-to-6.1.patch
patches.megous/8723cs-Port-to-6.1-rc1.patch
- patches.megous/8723cs-Add-a-new-driver-v5.12.2-7-g2de5ec386.20201013_beta.patch
- patches.megous/8723cs-Make-the-driver-compile-and-probe-drop-rockchip-platform.patch
- patches.megous/8723cs-Enable-OOB-interrupt.patch
- patches.megous/8723cs-Load-the-MAC-address-from-local-mac-address.patch
- patches.megous/8723cs-Modify-makefile-options-to-better-suit-PinePhone-Allwinn.patch
- patches.megous/8723cs-Enable-monitor-mode.patch
- patches.megous/8723cs-Disable-power-saving.patch
- patches.megous/8723cs-aes_encrypt-aes_encrypt_128-to-avoid-symbol-name-conflic.patch
- patches.megous/8723cs-Enable-wifi-power-saving-mode.patch
- patches.megous/8723cs-Enable-TDLS-802.11z-support-direct-sta-sta-connection.patch
- patches.megous/8723cs-Disable-CONFIG_CONCURRENT_MODE.patch
- patches.megous/8723cs-Set-CONFIG_RTW_SDIO_PM_KEEP_POWER-n-to-fix-suspend-38.patch
- patches.megous/8723cs-Resume-wifi-in-a-workqueue.patch
- patches.megous/8723cs-Port-to-5.11.patch
- patches.megous/8723cs-Enable-WoWLAN.patch
- patches.megous/8723cs-Port-to-5.12.patch
- patches.megous/8723cs-Fix-misleading-indentation.patch
- patches.megous/8723cs-Disable-use-of-NAPI.patch
- patches.megous/8723cs-Fix-indentation.patch
- patches.megous/8723cs-Fix-compile-warnings.patch
- patches.megous/8723cs-Port-to-5.15.patch
- patches.megous/8723cs-Clear-wowlan_last_wake_reason-prior-to-suspend.patch
- patches.megous/8723cs-Forward-port-to-5.17.patch
- patches.megous/8723cs-Port-to-5.18.patch
- patches.megous/8723cs-Fix-some-compilation-warnings.patch
- patches.megous/8723cs-Adapt-to-API-changes-in-stable-5.19.2-and-6.0.patch
- patches.megous/8723cs-Port-to-6.0.patch
- patches.megous/8723cs-Port-to-6.1.patch
- patches.megous/8723cs-Port-to-6.1-rc1.patch
patches.megous/tty-serial-8250-dw-Use-fifo-size-from-DTS.patch
patches.megous/arm64-dts-sun50i-a64-Set-fifo-size-for-uarts.patch
patches.megous/ARM-dts-sun8i-a83t-Set-fifo-size-for-uarts.patch
@@ -187,11 +187,11 @@
patches.megous/drm-rockchip-Fix-panic-on-reboot-when-DRM-device-fails-to-bind.patch
patches.megous/arm64-dts-rockchip-rk356x-Fix-PCIe-register-map-and-ranges.patch
patches.megous/fs-f2fs-Revert-code-to-v6.1.12-and-forward-port.patch
patches.megous/dt-bindings-net-bluetooth-Add-rtl8723bs-bluetooth.patch
patches.megous/Bluetooth-Add-new-quirk-for-broken-local-ext-features-max_page.patch
patches.megous/Bluetooth-btrtl-add-support-for-the-RTL8723CS.patch
patches.megous/Bluetooth-hci_h5-Add-support-for-binding-RTL8723CS-with-device-.patch
patches.megous/bluetooth-h5-Don-t-re-initialize-rtl8723cs-on-resume.patch
- patches.megous/dt-bindings-net-bluetooth-Add-rtl8723bs-bluetooth.patch
- patches.megous/Bluetooth-Add-new-quirk-for-broken-local-ext-features-max_page.patch
- patches.megous/Bluetooth-btrtl-add-support-for-the-RTL8723CS.patch
- patches.megous/Bluetooth-hci_h5-Add-support-for-binding-RTL8723CS-with-device-.patch
- patches.megous/bluetooth-h5-Don-t-re-initialize-rtl8723cs-on-resume.patch
patches.megous/drm-sun4i-Unify-sun8i_-_layer-structs.patch
patches.megous/drm-sun4i-Add-more-parameters-to-sunxi_engine-commit-callback.patch
patches.megous/drm-sun4i-Fix-layer-zpos-change-atomic-modesetting.patch
@@ -551,6 +551,7 @@
patches.armbian/arm64-dts-sun50i-a64-olinuxino-1Ge16GW-enable-bluetooth.patch
patches.armbian/arm64-dts-sun50i-a64.dtsi-adjust-thermal-trip-points.patch
patches.armbian/arm64-dts-sun50i-a64-olinuxino-1Ge16GW-Disable-clock-phase-and-.patch
patches.armbian/arm64-dts-sun50i-a64-pinephone-wowlan.patch
patches.armbian/arm64-dts-sun50i-h6-orangepi-3-add-r_uart-aliase.patch
patches.armbian/arm64-dts-sun50i-h5-add-cpu-opp-refs.patch
patches.armbian/arm64-dts-sun50i-h5-add-termal-zones.patch

View File

@@ -117,37 +117,37 @@
patches.megous/usb-musb-sunxi-Avoid-enabling-host-side-code-on-SoCs-where-it-s.patch
patches.megous/arm64-dts-sun50i-a64-Add-missing-trip-points-for-GPU.patch
patches.megous/arm64-dts-allwinner-sun50i-a64-pinephone-Add-support-for-Pineph.patch
patches.megous/8723cs-Add-a-new-driver-v5.12.2-7-g2de5ec386.20201013_beta.patch
patches.megous/8723cs-Make-the-driver-compile-and-probe-drop-rockchip-platform.patch
patches.megous/8723cs-Enable-OOB-interrupt.patch
patches.megous/8723cs-Load-the-MAC-address-from-local-mac-address.patch
patches.megous/8723cs-Modify-makefile-options-to-better-suit-PinePhone-Allwinn.patch
patches.megous/8723cs-Enable-monitor-mode.patch
patches.megous/8723cs-Disable-power-saving.patch
patches.megous/8723cs-aes_encrypt-aes_encrypt_128-to-avoid-symbol-name-conflic.patch
patches.megous/8723cs-Enable-wifi-power-saving-mode.patch
patches.megous/8723cs-Enable-TDLS-802.11z-support-direct-sta-sta-connection.patch
patches.megous/8723cs-Disable-CONFIG_CONCURRENT_MODE.patch
patches.megous/8723cs-Set-CONFIG_RTW_SDIO_PM_KEEP_POWER-n-to-fix-suspend-38.patch
patches.megous/8723cs-Resume-wifi-in-a-workqueue.patch
patches.megous/8723cs-Port-to-5.11.patch
patches.megous/8723cs-Enable-WoWLAN.patch
patches.megous/8723cs-Port-to-5.12.patch
patches.megous/8723cs-Fix-misleading-indentation.patch
patches.megous/8723cs-Disable-use-of-NAPI.patch
patches.megous/8723cs-Fix-indentation.patch
patches.megous/8723cs-Fix-compile-warnings.patch
patches.megous/8723cs-Port-to-5.15.patch
patches.megous/8723cs-Clear-wowlan_last_wake_reason-prior-to-suspend.patch
patches.megous/8723cs-Forward-port-to-5.17.patch
patches.megous/8723cs-Port-to-5.18.patch
patches.megous/8723cs-Fix-some-compilation-warnings.patch
patches.megous/8723cs-Adapt-to-API-changes-in-stable-5.19.2-and-6.0.patch
patches.megous/8723cs-Port-to-6.0.patch
patches.megous/8723cs-Port-to-6.1.patch
- patches.megous/8723cs-Add-a-new-driver-v5.12.2-7-g2de5ec386.20201013_beta.patch
- patches.megous/8723cs-Make-the-driver-compile-and-probe-drop-rockchip-platform.patch
- patches.megous/8723cs-Enable-OOB-interrupt.patch
- patches.megous/8723cs-Load-the-MAC-address-from-local-mac-address.patch
- patches.megous/8723cs-Modify-makefile-options-to-better-suit-PinePhone-Allwinn.patch
- patches.megous/8723cs-Enable-monitor-mode.patch
- patches.megous/8723cs-Disable-power-saving.patch
- patches.megous/8723cs-aes_encrypt-aes_encrypt_128-to-avoid-symbol-name-conflic.patch
- patches.megous/8723cs-Enable-wifi-power-saving-mode.patch
- patches.megous/8723cs-Enable-TDLS-802.11z-support-direct-sta-sta-connection.patch
- patches.megous/8723cs-Disable-CONFIG_CONCURRENT_MODE.patch
- patches.megous/8723cs-Set-CONFIG_RTW_SDIO_PM_KEEP_POWER-n-to-fix-suspend-38.patch
- patches.megous/8723cs-Resume-wifi-in-a-workqueue.patch
- patches.megous/8723cs-Port-to-5.11.patch
- patches.megous/8723cs-Enable-WoWLAN.patch
- patches.megous/8723cs-Port-to-5.12.patch
- patches.megous/8723cs-Fix-misleading-indentation.patch
- patches.megous/8723cs-Disable-use-of-NAPI.patch
- patches.megous/8723cs-Fix-indentation.patch
- patches.megous/8723cs-Fix-compile-warnings.patch
- patches.megous/8723cs-Port-to-5.15.patch
- patches.megous/8723cs-Clear-wowlan_last_wake_reason-prior-to-suspend.patch
- patches.megous/8723cs-Forward-port-to-5.17.patch
- patches.megous/8723cs-Port-to-5.18.patch
- patches.megous/8723cs-Fix-some-compilation-warnings.patch
- patches.megous/8723cs-Adapt-to-API-changes-in-stable-5.19.2-and-6.0.patch
- patches.megous/8723cs-Port-to-6.0.patch
- patches.megous/8723cs-Port-to-6.1.patch
patches.megous/tty-serial-8250-dw-Use-fifo-size-from-DTS.patch
patches.megous/arm64-dts-sun50i-a64-Set-fifo-size-for-uarts.patch
patches.megous/8723cs-Port-to-6.1-rc1.patch
- patches.megous/8723cs-Port-to-6.1-rc1.patch
patches.megous/ARM-dts-sun8i-a83t-Set-fifo-size-for-uarts.patch
patches.megous/Mark-some-slow-drivers-for-async-probe-with-PROBE_PREFER_ASYNCH.patch
patches.megous/arm64-xor-Select-32regs-without-benchmark-to-speed-up-boot.patch
@@ -187,11 +187,11 @@
patches.megous/drm-rockchip-Fix-panic-on-reboot-when-DRM-device-fails-to-bind.patch
patches.megous/arm64-dts-rockchip-rk356x-Fix-PCIe-register-map-and-ranges.patch
patches.megous/fs-f2fs-Revert-code-to-v6.1.12-and-forward-port.patch
patches.megous/dt-bindings-net-bluetooth-Add-rtl8723bs-bluetooth.patch
patches.megous/Bluetooth-Add-new-quirk-for-broken-local-ext-features-max_page.patch
patches.megous/Bluetooth-btrtl-add-support-for-the-RTL8723CS.patch
patches.megous/Bluetooth-hci_h5-Add-support-for-binding-RTL8723CS-with-device-.patch
patches.megous/bluetooth-h5-Don-t-re-initialize-rtl8723cs-on-resume.patch
- patches.megous/dt-bindings-net-bluetooth-Add-rtl8723bs-bluetooth.patch
- patches.megous/Bluetooth-Add-new-quirk-for-broken-local-ext-features-max_page.patch
- patches.megous/Bluetooth-btrtl-add-support-for-the-RTL8723CS.patch
- patches.megous/Bluetooth-hci_h5-Add-support-for-binding-RTL8723CS-with-device-.patch
- patches.megous/bluetooth-h5-Don-t-re-initialize-rtl8723cs-on-resume.patch
patches.megous/drm-sun4i-Unify-sun8i_-_layer-structs.patch
patches.megous/drm-sun4i-Add-more-parameters-to-sunxi_engine-commit-callback.patch
patches.megous/drm-sun4i-Fix-layer-zpos-change-atomic-modesetting.patch

View File

@@ -1,31 +0,0 @@
From 8fc0422773dc5274fa32e2a5a6ce2e1f0a96d78c Mon Sep 17 00:00:00 2001
From: Vasily Khoruzhick <anarsoul@gmail.com>
Date: Wed, 31 Oct 2018 20:07:41 -0700
Subject: [PATCH 304/467] Bluetooth: hci_h5: Add support for binding RTL8723CS
with device tree
RTL8723CS is often used in ARM boards, so add ability to bind it
using device tree.
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Signed-off-by: Ondrej Jirman <megous@megous.com>
---
drivers/bluetooth/hci_h5.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/bluetooth/hci_h5.c b/drivers/bluetooth/hci_h5.c
index d49a39d17..c9b54335a 100644
--- a/drivers/bluetooth/hci_h5.c
+++ b/drivers/bluetooth/hci_h5.c
@@ -1100,6 +1100,8 @@ static const struct of_device_id rtl_bluetooth_of_match[] = {
.data = (const void *)&h5_data_rtl8723bs },
{ .compatible = "realtek,rtl8723ds-bt",
.data = (const void *)&h5_data_rtl8723bs },
+ { .compatible = "realtek,rtl8723cs-bt",
+ .data = (const void *)&h5_data_rtl8723bs },
#endif
{ },
};
--
2.34.0

View File

@@ -1,42 +0,0 @@
From f0c05140b92cca447cd55a93ad4de141d0f117f1 Mon Sep 17 00:00:00 2001
From: Paolo Sabatino <paolo.sabatino@gmail.com>
Date: Thu, 9 Dec 2021 22:47:36 +0000
Subject: [PATCH] rtl8703bs: add chip type to list and info block
---
drivers/bluetooth/btrtl.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/bluetooth/btrtl.c b/drivers/bluetooth/btrtl.c
index ad4085eede4..2c227bf4e00 100644
--- a/drivers/bluetooth/btrtl.c
+++ b/drivers/bluetooth/btrtl.c
@@ -20,6 +20,7 @@
#define RTL_CHIP_8723CS_CG 3
#define RTL_CHIP_8723CS_VF 4
#define RTL_CHIP_8723CS_XX 5
+#define RTL_CHIP_8703BS 7
#define RTL_EPATCH_SIGNATURE "Realtech"
#define RTL_ROM_LMP_3499 0x3499
#define RTL_ROM_LMP_8703B 0x8703
@@ -136,6 +137,17 @@ static const struct id_table ic_id_table[] = {
.fw_name = "rtl_bt/rtl8723cs_xx_fw.bin",
.cfg_name = "rtl_bt/rtl8723cs_xx_config" },
+ /* 8703BS */
+ { .match_flags = IC_MATCH_FL_LMPSUBV | IC_MATCH_FL_CHIP_TYPE |
+ IC_MATCH_FL_HCIBUS,
+ .lmp_subver = RTL_ROM_LMP_8703B,
+ .chip_type = RTL_CHIP_8703BS,
+ .hci_bus = HCI_UART,
+ .config_needed = true,
+ .has_rom_version = true,
+ .fw_name = "rtl_bt/rtl8723cs_xx_fw.bin",
+ .cfg_name = "rtl_bt/rtl8723cs_xx_config" },
+
/* 8723D */
{ IC_INFO(RTL_ROM_LMP_8723B, 0xd, 0x8, HCI_USB),
.config_needed = true,
--
2.30.2

View File

@@ -1,53 +0,0 @@
From f60f1605f5056d543e49fc625ffeeb05621f2ad3 Mon Sep 17 00:00:00 2001
From: Vasily Khoruzhick
Date: Wed, 31 Oct 2018 19:40:18 -0700
Subject: Bluetooth: Add new quirk for broken local ext features max_page
Some adapters (e.g. RTL8723CS) advertise that they have more than
2 pages for local ext features, but they don't support any features
declared in these pages. RTL8723CS reports max_page = 2 and declares
support for sync train and secure connection, but it responds with
either garbage or with error in status on corresponding commands.
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
---
include/net/bluetooth/hci.h | 7 +++++++
net/bluetooth/hci_event.c | 4 +++-
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/include/net/bluetooth/hci.h b/include/net/bluetooth/hci.h
index 16ab6ce87883..8e4c16210d18 100644
--- a/include/net/bluetooth/hci.h
+++ b/include/net/bluetooth/hci.h
@@ -238,6 +238,13 @@ enum {
* HCI after resume.
*/
HCI_QUIRK_NO_SUSPEND_NOTIFIER,
+
+ /* When this quirk is set, max_page for local extended features
+ * is set to 1, even if controller reports higher number. Some
+ * controllers (e.g. RTL8723CS) report more pages, but they
+ * don't actually support features declared there.
+ */
+ HCI_QUIRK_BROKEN_LOCAL_EXT_FTR_MAX_PAGE,
/*
* When this quirk is set, LE tx power is not queried on startup
diff --git a/net/bluetooth/hci_event.c b/net/bluetooth/hci_event.c
index cfeaee347db3..df3232828978 100644
--- a/net/bluetooth/hci_event.c
+++ b/net/bluetooth/hci_event.c
@@ -700,7 +700,9 @@ static void hci_cc_read_local_ext_features(struct hci_dev *hdev,
if (rp->status)
return;
- if (hdev->max_page < rp->max_page)
+ if (!test_bit(HCI_QUIRK_BROKEN_LOCAL_EXT_FTR_MAX_PAGE,
+ &hdev->quirks) &&
+ hdev->max_page < rp->max_page)
hdev->max_page = rp->max_page;
if (rp->page < HCI_MAX_PAGES)
--
cgit v1.2.3

View File

@@ -1,266 +0,0 @@
From 26e61cffb09c1f5519a4eeb9d9e99239d58b6c2d Mon Sep 17 00:00:00 2001
From: Ondrej Jirman <megous@megous.com>
Date: Thu, 1 Jul 2021 11:22:23 +0200
Subject: [PATCH 302/467] Bluetooth: btrtl: add support for the RTL8723CS
The Realtek RTL8723CS is SDIO WiFi chip. It also contains a Bluetooth
module which is connected via UART to the host.
It shares lmp subversion with 8703B, so Realtek's userspace
initialization tool (rtk_hciattach) differentiates varieties of RTL8723CS
(CG, VF, XX) with RTL8703B using vendor's command to read chip type.
Also this chip declares support for some features it doesn't support
so add a quirk to indicate that these features are broken.
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
Signed-off-by: Ondrej Jirman <megous@megous.com>
---
drivers/bluetooth/btrtl.c | 119 +++++++++++++++++++++++++++++++++++++-
drivers/bluetooth/btrtl.h | 5 ++
2 files changed, 121 insertions(+), 3 deletions(-)
diff --git a/drivers/bluetooth/btrtl.c b/drivers/bluetooth/btrtl.c
index 1f8afa024..fd293a9c4 100644
--- a/drivers/bluetooth/btrtl.c
+++ b/drivers/bluetooth/btrtl.c
@@ -17,7 +17,12 @@
#define VERSION "0.1"
+#define RTL_CHIP_8723CS_CG 3
+#define RTL_CHIP_8723CS_VF 4
+#define RTL_CHIP_8723CS_XX 5
#define RTL_EPATCH_SIGNATURE "Realtech"
+#define RTL_ROM_LMP_3499 0x3499
+#define RTL_ROM_LMP_8703B 0x8703
#define RTL_ROM_LMP_8723A 0x1200
#define RTL_ROM_LMP_8723B 0x8723
#define RTL_ROM_LMP_8821A 0x8821
@@ -30,6 +35,7 @@
#define IC_MATCH_FL_HCIREV (1 << 1)
#define IC_MATCH_FL_HCIVER (1 << 2)
#define IC_MATCH_FL_HCIBUS (1 << 3)
+#define IC_MATCH_FL_CHIP_TYPE (1 << 4)
#define IC_INFO(lmps, hcir, hciv, bus) \
.match_flags = IC_MATCH_FL_LMPSUBV | IC_MATCH_FL_HCIREV | \
IC_MATCH_FL_HCIVER | IC_MATCH_FL_HCIBUS, \
@@ -57,6 +63,7 @@ struct id_table {
__u16 hci_rev;
__u8 hci_ver;
__u8 hci_bus;
+ __u8 chip_type;
bool config_needed;
bool has_rom_version;
char *fw_name;
@@ -96,6 +103,39 @@ static const struct id_table ic_id_table[] = {
.fw_name = "rtl_bt/rtl8723b_fw.bin",
.cfg_name = "rtl_bt/rtl8723b_config" },
+ /* 8723CS-CG */
+ { .match_flags = IC_MATCH_FL_LMPSUBV | IC_MATCH_FL_CHIP_TYPE |
+ IC_MATCH_FL_HCIBUS,
+ .lmp_subver = RTL_ROM_LMP_8703B,
+ .chip_type = RTL_CHIP_8723CS_CG,
+ .hci_bus = HCI_UART,
+ .config_needed = true,
+ .has_rom_version = true,
+ .fw_name = "rtl_bt/rtl8723cs_cg_fw.bin",
+ .cfg_name = "rtl_bt/rtl8723cs_cg_config" },
+
+ /* 8723CS-VF */
+ { .match_flags = IC_MATCH_FL_LMPSUBV | IC_MATCH_FL_CHIP_TYPE |
+ IC_MATCH_FL_HCIBUS,
+ .lmp_subver = RTL_ROM_LMP_8703B,
+ .chip_type = RTL_CHIP_8723CS_VF,
+ .hci_bus = HCI_UART,
+ .config_needed = true,
+ .has_rom_version = true,
+ .fw_name = "rtl_bt/rtl8723cs_vf_fw.bin",
+ .cfg_name = "rtl_bt/rtl8723cs_vf_config" },
+
+ /* 8723CS-XX */
+ { .match_flags = IC_MATCH_FL_LMPSUBV | IC_MATCH_FL_CHIP_TYPE |
+ IC_MATCH_FL_HCIBUS,
+ .lmp_subver = RTL_ROM_LMP_8703B,
+ .chip_type = RTL_CHIP_8723CS_XX,
+ .hci_bus = HCI_UART,
+ .config_needed = true,
+ .has_rom_version = true,
+ .fw_name = "rtl_bt/rtl8723cs_xx_fw.bin",
+ .cfg_name = "rtl_bt/rtl8723cs_xx_config" },
+
/* 8723D */
{ IC_INFO(RTL_ROM_LMP_8723B, 0xd, 0x8, HCI_USB),
.config_needed = true,
@@ -175,7 +215,8 @@ static const struct id_table ic_id_table[] = {
};
static const struct id_table *btrtl_match_ic(u16 lmp_subver, u16 hci_rev,
- u8 hci_ver, u8 hci_bus)
+ u8 hci_ver, u8 hci_bus,
+ u8 chip_type)
{
int i;
@@ -192,6 +233,9 @@ static const struct id_table *btrtl_match_ic(u16 lmp_subver, u16 hci_rev,
if ((ic_id_table[i].match_flags & IC_MATCH_FL_HCIBUS) &&
(ic_id_table[i].hci_bus != hci_bus))
continue;
+ if ((ic_id_table[i].match_flags & IC_MATCH_FL_CHIP_TYPE) &&
+ (ic_id_table[i].chip_type != chip_type))
+ continue;
break;
}
@@ -274,6 +318,7 @@ static int rtlbt_parse_firmware(struct hci_dev *hdev,
{ RTL_ROM_LMP_8723B, 1 },
{ RTL_ROM_LMP_8821A, 2 },
{ RTL_ROM_LMP_8761A, 3 },
+ { RTL_ROM_LMP_8703B, 7 },
{ RTL_ROM_LMP_8822B, 8 },
{ RTL_ROM_LMP_8723B, 9 }, /* 8723D */
{ RTL_ROM_LMP_8821A, 10 }, /* 8821C */
@@ -552,6 +597,48 @@ static int btrtl_setup_rtl8723b(struct hci_dev *hdev,
return ret;
}
+static bool rtl_has_chip_type(u16 lmp_subver)
+{
+ switch (lmp_subver) {
+ case RTL_ROM_LMP_8703B:
+ return true;
+ default:
+ break;
+ }
+
+ return false;
+}
+
+static int rtl_read_chip_type(struct hci_dev *hdev, u8 *type)
+{
+ struct rtl_chip_type_evt *chip_type;
+ struct sk_buff *skb;
+ const unsigned char cmd_buf[] = {0x00, 0x94, 0xa0, 0x00, 0xb0};
+
+ /* Read RTL chip type command */
+ skb = __hci_cmd_sync(hdev, 0xfc61, 5, cmd_buf, HCI_INIT_TIMEOUT);
+ if (IS_ERR(skb)) {
+ rtl_dev_err(hdev, "Read chip type failed (%ld)",
+ PTR_ERR(skb));
+ return PTR_ERR(skb);
+ }
+
+ if (skb->len != sizeof(*chip_type)) {
+ rtl_dev_err(hdev, "RTL chip type event length mismatch");
+ kfree_skb(skb);
+ return -EIO;
+ }
+
+ chip_type = (struct rtl_chip_type_evt *)skb->data;
+ rtl_dev_info(hdev, "chip_type status=%x type=%x",
+ chip_type->status, chip_type->type);
+
+ *type = chip_type->type & 0x0f;
+
+ kfree_skb(skb);
+ return 0;
+}
+
void btrtl_free(struct btrtl_device_info *btrtl_dev)
{
kvfree(btrtl_dev->fw_data);
@@ -568,7 +655,7 @@ struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev,
struct hci_rp_read_local_version *resp;
char cfg_name[40];
u16 hci_rev, lmp_subver;
- u8 hci_ver;
+ u8 hci_ver, chip_type = 0;
int ret;
u16 opcode;
u8 cmd[2];
@@ -638,8 +725,14 @@ struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev,
out_free:
kfree_skb(skb);
+ if (rtl_has_chip_type(lmp_subver)) {
+ ret = rtl_read_chip_type(hdev, &chip_type);
+ if (ret)
+ goto err_free;
+ }
+
btrtl_dev->ic_info = btrtl_match_ic(lmp_subver, hci_rev, hci_ver,
- hdev->bus);
+ hdev->bus, chip_type);
if (!btrtl_dev->ic_info) {
rtl_dev_info(hdev, "unknown IC info, lmp subver %04x, hci rev %04x, hci ver %04x",
@@ -757,7 +757,7 @@ struct btrtl_device_info *btrtl_initialize(struct hci_dev *hdev,
lmp_subver = le16_to_cpu(resp->lmp_subver);
btrtl_dev->ic_info = btrtl_match_ic(lmp_subver, hci_rev, hci_ver,
- hdev->bus);
+ hdev->bus, chip_type);
}
out_free:
kfree_skb(skb);
@@ -722,6 +815,7 @@ int btrtl_download_firmware(struct hci_dev *hdev,
case RTL_ROM_LMP_8761A:
case RTL_ROM_LMP_8822B:
case RTL_ROM_LMP_8852A:
+ case RTL_ROM_LMP_8703B:
return btrtl_setup_rtl8723b(hdev, btrtl_dev);
default:
rtl_dev_info(hdev, "assuming no firmware upload needed");
@@ -752,6 +846,19 @@ void btrtl_set_quirks(struct hci_dev *hdev, struct btrtl_device_info *btrtl_dev)
rtl_dev_dbg(hdev, "WBS supported not enabled.");
break;
}
+
+ switch (btrtl_dev->ic_info->lmp_subver) {
+ case RTL_ROM_LMP_8703B:
+ /* 8723CS reports two pages for local ext features,
+ * but it doesn't support any features from page 2 -
+ * it either responds with garbage or with error status
+ */
+ set_bit(HCI_QUIRK_BROKEN_LOCAL_EXT_FTR_MAX_PAGE,
+ &hdev->quirks);
+ break;
+ default:
+ break;
+ }
}
EXPORT_SYMBOL_GPL(btrtl_set_quirks);
@@ -910,6 +1017,12 @@ MODULE_FIRMWARE("rtl_bt/rtl8723b_fw.bin");
MODULE_FIRMWARE("rtl_bt/rtl8723b_config.bin");
MODULE_FIRMWARE("rtl_bt/rtl8723bs_fw.bin");
MODULE_FIRMWARE("rtl_bt/rtl8723bs_config.bin");
+MODULE_FIRMWARE("rtl_bt/rtl8723cs_cg_fw.bin");
+MODULE_FIRMWARE("rtl_bt/rtl8723cs_cg_config.bin");
+MODULE_FIRMWARE("rtl_bt/rtl8723cs_vf_fw.bin");
+MODULE_FIRMWARE("rtl_bt/rtl8723cs_vf_config.bin");
+MODULE_FIRMWARE("rtl_bt/rtl8723cs_xx_fw.bin");
+MODULE_FIRMWARE("rtl_bt/rtl8723cs_xx_config.bin");
MODULE_FIRMWARE("rtl_bt/rtl8723ds_fw.bin");
MODULE_FIRMWARE("rtl_bt/rtl8723ds_config.bin");
MODULE_FIRMWARE("rtl_bt/rtl8761a_fw.bin");
diff --git a/drivers/bluetooth/btrtl.h b/drivers/bluetooth/btrtl.h
index 2c441bda3..1c6282241 100644
--- a/drivers/bluetooth/btrtl.h
+++ b/drivers/bluetooth/btrtl.h
@@ -14,6 +14,11 @@
struct btrtl_device_info;
+struct rtl_chip_type_evt {
+ __u8 status;
+ __u8 type;
+} __packed;
+
struct rtl_download_cmd {
__u8 index;
__u8 data[RTL_FRAG_LEN];
--
2.34.0

View File

@@ -1,42 +0,0 @@
From f0c05140b92cca447cd55a93ad4de141d0f117f1 Mon Sep 17 00:00:00 2001
From: Paolo Sabatino <paolo.sabatino@gmail.com>
Date: Thu, 9 Dec 2021 22:47:36 +0000
Subject: [PATCH] rtl8703bs: add chip type to list and info block
---
drivers/bluetooth/btrtl.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/bluetooth/btrtl.c b/drivers/bluetooth/btrtl.c
index ad4085eede4..2c227bf4e00 100644
--- a/drivers/bluetooth/btrtl.c
+++ b/drivers/bluetooth/btrtl.c
@@ -20,6 +20,7 @@
#define RTL_CHIP_8723CS_CG 3
#define RTL_CHIP_8723CS_VF 4
#define RTL_CHIP_8723CS_XX 5
+#define RTL_CHIP_8703BS 7
#define RTL_EPATCH_SIGNATURE "Realtech"
#define RTL_ROM_LMP_3499 0x3499
#define RTL_ROM_LMP_8703B 0x8703
@@ -136,6 +137,17 @@ static const struct id_table ic_id_table[] = {
.fw_name = "rtl_bt/rtl8723cs_xx_fw.bin",
.cfg_name = "rtl_bt/rtl8723cs_xx_config" },
+ /* 8703BS */
+ { .match_flags = IC_MATCH_FL_LMPSUBV | IC_MATCH_FL_CHIP_TYPE |
+ IC_MATCH_FL_HCIBUS,
+ .lmp_subver = RTL_ROM_LMP_8703B,
+ .chip_type = RTL_CHIP_8703BS,
+ .hci_bus = HCI_UART,
+ .config_needed = true,
+ .has_rom_version = true,
+ .fw_name = "rtl_bt/rtl8723cs_xx_fw.bin",
+ .cfg_name = "rtl_bt/rtl8723cs_xx_config" },
+
/* 8723D */
{ IC_INFO(RTL_ROM_LMP_8723B, 0xd, 0x8, HCI_USB),
.config_needed = true,
--
2.30.2

View File

@@ -19,23 +19,10 @@ Figured out with help from by #linux-sunxi/Peetz0r.
Signed-off-by: Ondrej Jirman <megi@xff.cz>
---
arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi | 1 +
drivers/staging/rtl8723cs/Makefile | 4 ++--
drivers/staging/rtl8723cs/os_dep/linux/sdio_intf.c | 6 ++----
3 files changed, 5 insertions(+), 6 deletions(-)
2 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
index 53f4c1f66..1a5c51182 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
+++ b/arch/arm64/boot/dts/allwinner/sun50i-a64-pinephone.dtsi
@@ -468,6 +468,7 @@ &cpu3 {
&csi {
pinctrl-0 = <&csi_pins>, <&csi_mclk_pin>;
status = "okay";
+ keep-power-in-suspend;
port {
#address-cells = <1>;
diff --git a/drivers/staging/rtl8723cs/Makefile b/drivers/staging/rtl8723cs/Makefile
index 60c1c864d..b428d679e 100644
--- a/drivers/staging/rtl8723cs/Makefile