17 #include <linux/slab.h>
18 #include <linux/export.h>
27 #define PRI_TOLERANCE 16
42 #define MIN_PPB_THRESH 50
43 #define PPB_THRESH(PPB) ((PPB * MIN_PPB_THRESH + 50) / 100)
44 #define PRF2PRI(PRF) ((1000000 + PRF / 2) / PRF)
46 #define ETSI_PATTERN(ID, WMIN, WMAX, PMIN, PMAX, PRF, PPB) \
48 ID, WMIN, WMAX, (PRF2PRI(PMAX) - PRI_TOLERANCE), \
49 (PRF2PRI(PMIN) * PRF + PRI_TOLERANCE), PRF, PPB * PRF, \
50 PPB_THRESH(PPB), PRI_TOLERANCE, \
64 static const struct radar_types etsi_radar_types_v15 = {
66 .num_radar_types =
ARRAY_SIZE(etsi_radar_ref_types_v15),
67 .radar_types = etsi_radar_ref_types_v15,
72 &etsi_radar_types_v15,
84 for (i = 0; i <
ARRAY_SIZE(dfs_domains); i++) {
85 if (dfs_domains[i]->region == region)
86 return dfs_domains[
i];
145 INIT_LIST_HEAD(&cd->
head);
163 pr_err(
"failed to allocate channel_detector for freq=%d\n", freq);
164 channel_detector_exit(dpd, cd);
182 if (cd->
freq == freq)
185 return channel_detector_create(dpd, freq);
198 channel_detector_reset(dpd, cd);
204 if (!list_empty(&dpd->channel_detectors))
206 channel_detector_exit(dpd, cd);
225 cd = channel_detector_get(dpd, event->freq);
229 ts_wraparound = (
event->ts < dpd->last_pulse_ts);
230 dpd->last_pulse_ts =
event->ts;
236 pr_warn(
"DFS: time stamp wraparound detected, resetting\n");
240 for (i = 0; i < dpd->num_radar_types; i++) {
242 channel_detector_reset(dpd, cd);
255 if (dpd->
region == region)
260 rt = get_dfs_domain_radar_types(region);
267 channel_detector_exit(dpd, cd);
269 dpd->num_radar_types = rt->num_radar_types;
271 dpd->region = region;
277 .set_domain = dpd_set_domain,
278 .add_pulse = dpd_add_pulse,
288 pr_err(
"allocation of dfs_pattern_detector failed\n");
297 pr_err(
"Could not set DFS domain to %d. ", region);