luckfox-pico-sdk/sysdrv/drv_ko/wifi/aic8800dc/aic8800_fdrv/rwnx_wakelock.c
luckfox-eng29 c27bded97e project:build.sh:optimize the method of determining whether the Ubuntu image is local
sysdrv:Makefile:modify the method of compiling WiFi/BT drivers
sysdrv:drv_ko:wifi:aic8800dc:optimize Bluetooth transmission
sysdrv:tools:board:buildroot:resolve the issue where the USB cannot automatically obtain an IP address
sysdrv:tools:board:luckfox_config:add an optional setting for UART3M1 on the Luckfox Pico Mini
sysdrv:source:kernel:arch:arm👢dts:eliminate display noise on the LF40-72720-ARK
sysdrv:source:uboot:rkbin:bin:rv11:resolve the issue of certain SD card models not being recognized

Refactor:sysdrv:Makefile:obtain WiFi/BT drivers from source compilation on the Ubuntu system
Perf:sysdrv:drv_ko:wifi:aic8800dc:expand WiFi/Bluetooth rfkill management methods, increase Bluetooth communication baud rate, and reduce communication lag
Fix:sysdrv:tools:board:buildroot:resolve the issue where the `rkipc` program overwrites the IP address of USB0 when the camera is activated on the Luckfox Pico Ultra
Fix:source:uboot:rkbin:bin:rv11:resolve the issue where, in the presence of an image on SPI NAND, romboot prioritizes using `.bin` from SPI NAND, causing the SD card to be unrecognized

Signed-off-by: luckfox-eng29 <eng29@luckfox.com>
2024-08-13 10:37:24 +08:00

91 lines
2.1 KiB
C
Executable File

#include <linux/kernel.h>
#include <linux/version.h>
#include <linux/platform_device.h>
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
#include <linux/pm_wakeirq.h>
#else
#include <linux/pm_wakeup.h>
#endif
#include "rwnx_defs.h"
#include "rwnx_wakelock.h"
struct wakeup_source *rwnx_wakeup_init(const char *name)
{
struct wakeup_source *ws;
ws = wakeup_source_create(name);
wakeup_source_add(ws);
return ws;
}
void rwnx_wakeup_deinit(struct wakeup_source *ws)
{
if (ws && ws->active)
__pm_relax(ws);
wakeup_source_remove(ws);
wakeup_source_destroy(ws);
}
struct wakeup_source *rwnx_wakeup_register(struct device *dev, const char *name)
{
#if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)
return wakeup_source_register(dev, name);
#else
#if defined(CONFIG_PLATFORM_ROCKCHIP2) || defined(CONFIG_PLATFORM_ROCKCHIP)
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 5, 0)
return wakeup_source_register(dev, name);
#else
return wakeup_source_register(name);
#endif
#else
return wakeup_source_register(name);
#endif//#if defined(CONFIG_PLATFORM_ROCKCHIP2) || defined(CONFIG_PLATFORM_ROCKCHIP)
#endif//LINUX_VERSION_CODE >= KERNEL_VERSION(5, 4, 0)
}
void rwnx_wakeup_unregister(struct wakeup_source *ws)
{
if (ws && ws->active)
__pm_relax(ws);
wakeup_source_unregister(ws);
}
void rwnx_wakeup_lock(struct wakeup_source *ws)
{
__pm_stay_awake(ws);
}
void rwnx_wakeup_unlock(struct wakeup_source *ws)
{
__pm_relax(ws);
}
void rwnx_wakeup_lock_timeout(struct wakeup_source *ws, unsigned int msec)
{
__pm_wakeup_event(ws, msec);
}
void aicwf_wakeup_lock_init(struct rwnx_hw *rwnx_hw)
{
rwnx_hw->ws_tx = rwnx_wakeup_init("rwnx_tx_wakelock");
rwnx_hw->ws_rx = rwnx_wakeup_init("rwnx_rx_wakelock");
rwnx_hw->ws_irqrx = rwnx_wakeup_init("rwnx_irqrx_wakelock");
rwnx_hw->ws_pwrctrl = rwnx_wakeup_init("rwnx_pwrcrl_wakelock");
}
void aicwf_wakeup_lock_deinit(struct rwnx_hw *rwnx_hw)
{
rwnx_wakeup_deinit(rwnx_hw->ws_tx);
rwnx_wakeup_deinit(rwnx_hw->ws_rx);
rwnx_wakeup_deinit(rwnx_hw->ws_irqrx);
rwnx_wakeup_deinit(rwnx_hw->ws_pwrctrl);
rwnx_hw->ws_tx = NULL;
rwnx_hw->ws_rx = NULL;
rwnx_hw->ws_irqrx = NULL;
rwnx_hw->ws_pwrctrl = NULL;
}