From e3e12f52b214121840b44c91de5b3e5af5d3eb84 Mon Sep 17 00:00:00 2001
From: hc <hc@nodka.com>
Date: Mon, 06 Nov 2023 03:04:41 +0000
Subject: [PATCH] rk3568 rt init

---
 kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_linux_priv.h |   47 ++++++++++++++++++++++++++++++-----------------
 1 files changed, 30 insertions(+), 17 deletions(-)

diff --git a/kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_linux_priv.h b/kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_linux_priv.h
index 1eeb27e..019884b 100644
--- a/kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_linux_priv.h
+++ b/kernel/drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd/dhd_linux_priv.h
@@ -128,20 +128,20 @@
 
 	/* Wakelocks */
 #if defined(CONFIG_HAS_WAKELOCK)
-	struct wakeup_source wl_wifi;   /* Wifi wakelock */
-	struct wakeup_source wl_rxwake; /* Wifi rx wakelock */
-	struct wakeup_source wl_ctrlwake; /* Wifi ctrl wakelock */
-	struct wakeup_source wl_wdwake; /* Wifi wd wakelock */
-	struct wakeup_source wl_evtwake; /* Wifi event wakelock */
-	struct wakeup_source wl_pmwake;   /* Wifi pm handler wakelock */
-	struct wakeup_source wl_txflwake; /* Wifi tx flow wakelock */
+	struct wakeup_source *wl_wifi;   /* Wifi wakelock */
+	struct wakeup_source *wl_rxwake; /* Wifi rx wakelock */
+	struct wakeup_source *wl_ctrlwake; /* Wifi ctrl wakelock */
+	struct wakeup_source *wl_wdwake; /* Wifi wd wakelock */
+	struct wakeup_source *wl_evtwake; /* Wifi event wakelock */
+	struct wakeup_source *wl_pmwake;   /* Wifi pm handler wakelock */
+	struct wakeup_source *wl_txflwake; /* Wifi tx flow wakelock */
 #ifdef BCMPCIE_OOB_HOST_WAKE
-	struct wakeup_source wl_intrwake; /* Host wakeup wakelock */
+	struct wakeup_source *wl_intrwake; /* Host wakeup wakelock */
 #endif /* BCMPCIE_OOB_HOST_WAKE */
 #ifdef DHD_USE_SCAN_WAKELOCK
-	struct wakeup_source wl_scanwake;  /* Wifi scan wakelock */
+	struct wakeup_source *wl_scanwake;  /* Wifi scan wakelock */
 #endif /* DHD_USE_SCAN_WAKELOCK */
-	struct wakeup_source wl_nanwake; /* NAN wakelock */
+	struct wakeup_source *wl_nanwake; /* NAN wakelock */
 #endif /* CONFIG_HAS_WAKELOCK */
 
 #if defined(OEM_ANDROID)
@@ -501,16 +501,29 @@
 extern uint fis_enab;
 #endif /* DHD_SSSR_DUMP */
 
+#if defined(ANDROID_VERSION) && (LINUX_VERSION_CODE  >= KERNEL_VERSION(4, 19, 0))
+#define WAKELOCK_BACKPORT
+#endif
+
 #ifdef CONFIG_HAS_WAKELOCK
-enum {
-	WAKE_LOCK_SUSPEND, /* Prevent suspend */
-	WAKE_LOCK_TYPE_COUNT
-};
-#define dhd_wake_lock_init(wakeup_source, type, name)	wakeup_source_add(wakeup_source)
-#define dhd_wake_lock_destroy(wakeup_source)		wakeup_source_remove(wakeup_source)
+#if ((LINUX_VERSION_CODE  >= KERNEL_VERSION(5, 4, 0)) || defined(WAKELOCK_BACKPORT))
+#define dhd_wake_lock_init(wakeup_source, dev, name) \
+do { \
+	wakeup_source = wakeup_source_register(dev, name); \
+} while (0);
+#else
+#define dhd_wake_lock_init(wakeup_source, dev, name) \
+do { \
+	wakeup_source = wakeup_source_register(name); \
+} while (0);
+#endif /* LINUX_VERSION >= 5.4.0 */
+#define dhd_wake_lock_destroy(wakeup_source) \
+do { \
+	wakeup_source_unregister(wakeup_source); \
+} while (0);
 #define dhd_wake_lock(wakeup_source)			__pm_stay_awake(wakeup_source)
 #define dhd_wake_unlock(wakeup_source)			__pm_relax(wakeup_source)
-#define dhd_wake_lock_active(wakeup_source)		((wakeup_source)->active)
+#define dhd_wake_lock_active(wakeup_source)		((wakeup_source)?((wakeup_source)->active):0)
 #define dhd_wake_lock_timeout(wakeup_source, timeout)	\
 	__pm_wakeup_event(wakeup_source, jiffies_to_msecs(timeout))
 #endif /* CONFIG_HAS_WAKELOCK */

--
Gitblit v1.6.2