1 // SPDX-License-Identifier: BSD-3-Clause-Clear
3 * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
4 * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
9 #include "debugfs_htt_stats.h"
11 static ssize_t
ath12k_write_simulate_radar(struct file
*file
,
12 const char __user
*user_buf
,
13 size_t count
, loff_t
*ppos
)
15 struct ath12k
*ar
= file
->private_data
;
18 wiphy_lock(ath12k_ar_to_hw(ar
)->wiphy
);
19 ret
= ath12k_wmi_simulate_radar(ar
);
25 wiphy_unlock(ath12k_ar_to_hw(ar
)->wiphy
);
29 static const struct file_operations fops_simulate_radar
= {
30 .write
= ath12k_write_simulate_radar
,
34 void ath12k_debugfs_soc_create(struct ath12k_base
*ab
)
37 char soc_name
[64] = { 0 };
38 struct dentry
*debugfs_ath12k
;
40 debugfs_ath12k
= debugfs_lookup("ath12k", NULL
);
42 /* a dentry from lookup() needs dput() after we don't use it */
45 debugfs_ath12k
= debugfs_create_dir("ath12k", NULL
);
46 if (IS_ERR_OR_NULL(debugfs_ath12k
))
51 scnprintf(soc_name
, sizeof(soc_name
), "%s-%s", ath12k_bus_str(ab
->hif
.bus
),
54 ab
->debugfs_soc
= debugfs_create_dir(soc_name
, debugfs_ath12k
);
60 void ath12k_debugfs_soc_destroy(struct ath12k_base
*ab
)
62 debugfs_remove_recursive(ab
->debugfs_soc
);
63 ab
->debugfs_soc
= NULL
;
64 /* We are not removing ath12k directory on purpose, even if it
65 * would be empty. This simplifies the directory handling and it's
66 * a minor cosmetic issue to leave an empty ath12k directory to
71 void ath12k_debugfs_register(struct ath12k
*ar
)
73 struct ath12k_base
*ab
= ar
->ab
;
74 struct ieee80211_hw
*hw
= ar
->ah
->hw
;
78 scnprintf(pdev_name
, sizeof(pdev_name
), "%s%d", "mac", ar
->pdev_idx
);
80 ar
->debug
.debugfs_pdev
= debugfs_create_dir(pdev_name
, ab
->debugfs_soc
);
82 /* Create a symlink under ieee80211/phy* */
83 scnprintf(buf
, sizeof(buf
), "../../ath12k/%pd2", ar
->debug
.debugfs_pdev
);
84 ar
->debug
.debugfs_pdev_symlink
= debugfs_create_symlink("ath12k",
85 hw
->wiphy
->debugfsdir
,
88 if (ar
->mac
.sbands
[NL80211_BAND_5GHZ
].channels
) {
89 debugfs_create_file("dfs_simulate_radar", 0200,
90 ar
->debug
.debugfs_pdev
, ar
,
91 &fops_simulate_radar
);
94 ath12k_debugfs_htt_stats_register(ar
);
97 void ath12k_debugfs_unregister(struct ath12k
*ar
)
99 if (!ar
->debug
.debugfs_pdev
)
102 /* Remove symlink under ieee80211/phy* */
103 debugfs_remove(ar
->debug
.debugfs_pdev_symlink
);
104 debugfs_remove_recursive(ar
->debug
.debugfs_pdev
);
105 ar
->debug
.debugfs_pdev_symlink
= NULL
;
106 ar
->debug
.debugfs_pdev
= NULL
;