Files
aic8800d80/drivers/aic8800/aic8800_fdrv/rwnx_radar.h
T
Shen MintaoandClaude Opus 4.7 d66e5cb859 feat: update to SDK v5.0 with comprehensive kernel and device support
Sync WiFi driver, firmware, and DKMS configuration from the bluetooth
branch (which itself is radxa USB driver_fw + Linux 6.16/6.17/6.19
kernel compat). aic_btusb and Bluetooth-specific install.sh logic
are intentionally excluded from main.

Driver updates:
- Add Linux kernel 6.12-6.19 compatibility support
- Add Linux 6.16 timer_container_of and wakelock API support
- Add Debian 6.1.0-26 backport support
- Add USB device ID 368b:8d81 support
- Add AIC8800DW device support
- Add TP-Link Archer TX1U Nano support (USB_VENDOR_ID_TENDA_V2:0x0110)
- Add TENDA series device support (U2, U11, U11 PRO)
- Add AIC8800FC_CUS1-6 series support
- Add AIC8800M80_CUS0-8 series support
- Add UGREEN AIC8800D80 adapter support
- Add Mercury (TP-Link OEM) support
- Allow 1 or 3 USB interfaces (BT-disabled SKUs report 1)

New compat modules:
- aicwf_compat_8800d80n.{c,h}
- aicwf_compat_8800dln.{c,h}

Firmware:
- New: fw/aic8800/, fw/aic8800D80N/, fw/aic8800D80X2/, fw/aic8800DLN/
- Updated: fw/aic8800D80/, fw/aic8800DC/

install.sh:
- Loop over all fw/aic8800* variants instead of hard-coding aic8800D80
- Install usb_modeswitch/1111_1111 config for "Pandora" clone adapter
- Verify firmware install by counting variants

dkms.conf: pass KDIR explicitly to make for cross-kernel builds.

Excluded from this commit (BT-only, kept on bluetooth branch):
- drivers/aic8800/aic_btusb/
- modprobe/aic8800-bt.conf
- diagnose_bt.sh
- install.sh btusb auto-load / hciconfig / bluez status checks

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-20 14:02:08 +08:00

218 lines
6.6 KiB
C

/**
******************************************************************************
*
* @file rwnx_radar.h
*
* @brief Functions to handle radar detection
*
*
* Copyright (C) RivieraWaves 2012-2019
*
******************************************************************************
*/
#ifndef _RWNX_RADAR_H_
#define _RWNX_RADAR_H_
#include <linux/nl80211.h>
struct rwnx_vif;
struct rwnx_hw;
enum rwnx_radar_chain {
RWNX_RADAR_RIU = 0,
RWNX_RADAR_FCU,
RWNX_RADAR_LAST
};
enum rwnx_radar_detector {
RWNX_RADAR_DETECT_DISABLE = 0, /* Ignore radar pulses */
RWNX_RADAR_DETECT_ENABLE = 1, /* Process pattern detection but do not
report radar to upper layer (for test) */
RWNX_RADAR_DETECT_REPORT = 2 /* Process pattern detection and report
radar to upper layer. */
};
/**
* struct pri_sequence - sequence of pulses matching one PRI
* @head: list_head
* @pri: pulse repetition interval (PRI) in usecs
* @dur: duration of sequence in usecs
* @count: number of pulses in this sequence
* @count_falses: number of not matching pulses in this sequence
* @first_ts: time stamp of first pulse in usecs
* @last_ts: time stamp of last pulse in usecs
* @deadline_ts: deadline when this sequence becomes invalid (first_ts + dur)
* @ppb_thresh: Number of pulses to validate detection
* (need for weather radar whose value depends of pri)
*/
struct pri_sequence {
struct list_head head;
u32 pri;
u32 dur;
u32 count;
u32 count_falses;
u64 first_ts;
u64 last_ts;
u64 deadline_ts;
u8 ppb_thresh;
};
#ifdef CONFIG_RWNX_RADAR
#include <linux/workqueue.h>
#include <linux/spinlock.h>
#define RWNX_RADAR_PULSE_MAX 32
/**
* struct rwnx_radar_pulses - List of pulses reported by HW
* @index: write index
* @count: number of valid pulses
* @buffer: buffer of pulses
*/
struct rwnx_radar_pulses {
/* Last radar pulses received */
int index;
int count;
u32 buffer[RWNX_RADAR_PULSE_MAX];
};
/**
* struct dfs_pattern_detector - DFS pattern detector
* @region: active DFS region, NL80211_DFS_UNSET until set
* @num_radar_types: number of different radar types
* @last_pulse_ts: time stamp of last valid pulse in usecs
* @prev_jiffies:
* @radar_detector_specs: array of radar detection specs
* @channel_detectors: list connecting channel_detector elements
*/
struct dfs_pattern_detector {
u8 enabled;
enum nl80211_dfs_regions region;
u8 num_radar_types;
u64 last_pulse_ts;
u32 prev_jiffies;
const struct radar_detector_specs *radar_spec;
struct list_head detectors[];
};
#define NX_NB_RADAR_DETECTED 4
/**
* struct rwnx_radar_detected - List of radar detected
*/
struct rwnx_radar_detected {
u16 index;
u16 count;
s64 time[NX_NB_RADAR_DETECTED];
s16 freq[NX_NB_RADAR_DETECTED];
};
#define RWNX_RADAR_DUMP_EN 1
#ifdef RWNX_RADAR_DUMP_EN
#define RWNX_RADARR_DUMP_NB 32
struct rwnx_radar_dump {
u32 cnt;
u32 idx;
u32 ps[RWNX_RADARR_DUMP_NB];
u64 tm[RWNX_RADARR_DUMP_NB];
u64 ts[RWNX_RADARR_DUMP_NB];
};
#endif
enum rwnx_radar_status {
RWNX_RADAR_IDLE = 0,
RWNX_RADAR_CAC_BUSY = 1,
RWNX_RADAR_CAC_DONE = 2,
RWNX_RADAR_INSERVICE_BUSY = 3,
RWNX_RADAR_INSERVICE_DONE = 4
};
struct rwnx_radar {
struct rwnx_radar_pulses pulses[RWNX_RADAR_LAST];
struct dfs_pattern_detector *dpd[RWNX_RADAR_LAST];
struct rwnx_radar_detected detected[RWNX_RADAR_LAST];
#ifdef RWNX_RADAR_DUMP_EN
struct rwnx_radar_dump *rmem;
#endif
u16 status;
u16 sta_num;
struct work_struct detection_work; /* Work used to process radar pulses */
spinlock_t lock; /* lock for pulses processing */
/* In softmac cac is handled by mac80211 */
#ifdef CONFIG_RWNX_FULLMAC
struct delayed_work cac_work; /* Work used to handle CAC */
struct rwnx_vif *cac_vif; /* vif on which we started CAC */
#endif
};
void rwnx_radar_reset_rmem(struct rwnx_radar *radar);
void rwnx_radar_init_rmem(struct rwnx_radar *radar);
void rwnx_radar_deinit_rmem(struct rwnx_radar *radar);
bool rwnx_radar_detection_init(struct rwnx_radar *radar);
void rwnx_radar_detection_deinit(struct rwnx_radar *radar);
bool rwnx_radar_set_domain(struct rwnx_radar *radar,
enum nl80211_dfs_regions region);
void rwnx_radar_detection_enable(struct rwnx_radar *radar, u8 enable, u8 chain);
bool rwnx_radar_detection_is_enable(struct rwnx_radar *radar, u8 chain);
void rwnx_radar_start_cac(struct rwnx_radar *radar, u32 cac_time_ms,
struct rwnx_vif *vif);
void rwnx_radar_cancel_cac(struct rwnx_radar *radar);
void rwnx_radar_detection_enable_on_cur_channel(struct rwnx_hw *rwnx_hw);
int rwnx_radar_dump_pattern_detector(char *buf, size_t len,
struct rwnx_radar *radar, u8 chain);
int rwnx_radar_dump_radar_detected(char *buf, size_t len,
struct rwnx_radar *radar, u8 chain);
struct pri_detector *pri_detector_init(struct dfs_pattern_detector *dpd,
u16 radar_type, u16 freq);
void print_radar_detect_info(struct pri_detector *pde, struct pri_sequence *ps);
#else
struct rwnx_radar {
};
static inline bool rwnx_radar_detection_init(struct rwnx_radar *radar)
{return true;}
static inline void rwnx_radar_detection_deinit(struct rwnx_radar *radar)
{}
static inline bool rwnx_radar_set_domain(struct rwnx_radar *radar,
enum nl80211_dfs_regions region)
{return true;}
static inline void rwnx_radar_detection_enable(struct rwnx_radar *radar,
u8 enable, u8 chain)
{}
static inline bool rwnx_radar_detection_is_enable(struct rwnx_radar *radar,
u8 chain)
{return false;}
static inline void rwnx_radar_start_cac(struct rwnx_radar *radar,
u32 cac_time_ms, struct rwnx_vif *vif)
{}
static inline void rwnx_radar_cancel_cac(struct rwnx_radar *radar)
{}
static inline void rwnx_radar_detection_enable_on_cur_channel(struct rwnx_hw *rwnx_hw)
{}
static inline int rwnx_radar_dump_pattern_detector(char *buf, size_t len,
struct rwnx_radar *radar,
u8 chain)
{return 0;}
static inline int rwnx_radar_dump_radar_detected(char *buf, size_t len,
struct rwnx_radar *radar,
u8 chain)
{return 0;}
#endif /* CONFIG_RWNX_RADAR */
#endif // _RWNX_RADAR_H_