|
@@ -90,6 +90,7 @@ static struct kobject *wlan_kobject;
|
|
|
static struct kobject *driver_kobject;
|
|
|
static struct kobject *fw_kobject;
|
|
|
static struct kobject *psoc_kobject;
|
|
|
+static struct kobject *wifi_kobject;
|
|
|
|
|
|
int
|
|
|
hdd_sysfs_validate_and_copy_buf(char *dest_buf, size_t dest_buf_size,
|
|
@@ -492,6 +493,109 @@ static DEVICE_ATTR(beacon_stats, 0444,
|
|
|
show_beacon_reception_stats, NULL);
|
|
|
#endif
|
|
|
|
|
|
+static ssize_t
|
|
|
+__hdd_sysfs_dump_in_progress_store(struct hdd_context *hdd_ctx,
|
|
|
+ struct kobj_attribute *attr,
|
|
|
+ char const *buf, size_t count)
|
|
|
+{
|
|
|
+ char buf_local[MAX_SYSFS_USER_COMMAND_SIZE_LENGTH + 1];
|
|
|
+ char *sptr, *token;
|
|
|
+ int value, ret;
|
|
|
+
|
|
|
+ if (!wlan_hdd_validate_modules_state(hdd_ctx))
|
|
|
+ return -EINVAL;
|
|
|
+
|
|
|
+ ret = hdd_sysfs_validate_and_copy_buf(buf_local, sizeof(buf_local),
|
|
|
+ buf, count);
|
|
|
+ if (ret) {
|
|
|
+ hdd_err_rl("invalid input");
|
|
|
+ return ret;
|
|
|
+ }
|
|
|
+
|
|
|
+ sptr = buf_local;
|
|
|
+ /* Get value */
|
|
|
+ token = strsep(&sptr, " ");
|
|
|
+ if (!token)
|
|
|
+ return -EINVAL;
|
|
|
+ if (kstrtou32(token, 0, &value))
|
|
|
+ return -EINVAL;
|
|
|
+
|
|
|
+ hdd_debug_rl("dump in progress %d", value);
|
|
|
+ if (value < 0 || value > 1)
|
|
|
+ return -EINVAL;
|
|
|
+
|
|
|
+ hdd_ctx->dump_in_progress = value;
|
|
|
+
|
|
|
+ return count;
|
|
|
+}
|
|
|
+
|
|
|
+static ssize_t hdd_sysfs_dump_in_progress_store(struct kobject *kobj,
|
|
|
+ struct kobj_attribute *attr,
|
|
|
+ char const *buf, size_t count)
|
|
|
+{
|
|
|
+ struct osif_psoc_sync *psoc_sync;
|
|
|
+ struct hdd_context *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
|
|
|
+ ssize_t errno_size;
|
|
|
+ int ret;
|
|
|
+
|
|
|
+ ret = wlan_hdd_validate_context(hdd_ctx);
|
|
|
+ if (ret != 0)
|
|
|
+ return ret;
|
|
|
+
|
|
|
+ errno_size = osif_psoc_sync_op_start(wiphy_dev(hdd_ctx->wiphy),
|
|
|
+ &psoc_sync);
|
|
|
+ if (errno_size)
|
|
|
+ return errno_size;
|
|
|
+
|
|
|
+ errno_size = __hdd_sysfs_dump_in_progress_store(hdd_ctx, attr,
|
|
|
+ buf, count);
|
|
|
+
|
|
|
+ osif_psoc_sync_op_stop(psoc_sync);
|
|
|
+
|
|
|
+ return errno_size;
|
|
|
+}
|
|
|
+
|
|
|
+static ssize_t __hdd_sysfs_dump_in_progress_show(struct hdd_context *hdd_ctx,
|
|
|
+ struct kobj_attribute *attr,
|
|
|
+ char *buf)
|
|
|
+{
|
|
|
+ ssize_t ret_val;
|
|
|
+
|
|
|
+ hdd_debug_rl("dump in progress %d", hdd_ctx->dump_in_progress);
|
|
|
+ ret_val = scnprintf(buf, PAGE_SIZE, "%d\n", hdd_ctx->dump_in_progress);
|
|
|
+
|
|
|
+ return ret_val;
|
|
|
+}
|
|
|
+
|
|
|
+static ssize_t hdd_sysfs_dump_in_progress_show(struct kobject *kobj,
|
|
|
+ struct kobj_attribute *attr,
|
|
|
+ char *buf)
|
|
|
+{
|
|
|
+ struct osif_psoc_sync *psoc_sync;
|
|
|
+ struct hdd_context *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD);
|
|
|
+ ssize_t errno_size;
|
|
|
+ int ret;
|
|
|
+
|
|
|
+ ret = wlan_hdd_validate_context(hdd_ctx);
|
|
|
+ if (ret != 0)
|
|
|
+ return ret;
|
|
|
+
|
|
|
+ errno_size = osif_psoc_sync_op_start(wiphy_dev(hdd_ctx->wiphy),
|
|
|
+ &psoc_sync);
|
|
|
+ if (errno_size)
|
|
|
+ return errno_size;
|
|
|
+
|
|
|
+ errno_size = __hdd_sysfs_dump_in_progress_show(hdd_ctx, attr, buf);
|
|
|
+
|
|
|
+ osif_psoc_sync_op_stop(psoc_sync);
|
|
|
+
|
|
|
+ return errno_size;
|
|
|
+}
|
|
|
+
|
|
|
+static struct kobj_attribute dump_in_progress_attribute =
|
|
|
+ __ATTR(dump_in_progress, 0660, hdd_sysfs_dump_in_progress_show,
|
|
|
+ hdd_sysfs_dump_in_progress_store);
|
|
|
+
|
|
|
static struct kobj_attribute dr_ver_attribute =
|
|
|
__ATTR(driver_version, 0440, show_driver_version, NULL);
|
|
|
static struct kobj_attribute fw_ver_attribute =
|
|
@@ -560,6 +664,48 @@ static void hdd_sysfs_destroy_version_interface(void)
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+static void hdd_sysfs_create_wifi_root_obj(void)
|
|
|
+{
|
|
|
+ wifi_kobject = kobject_create_and_add("wifi", NULL);
|
|
|
+ if (!wifi_kobject)
|
|
|
+ hdd_err("could not allocate wifi kobject");
|
|
|
+}
|
|
|
+
|
|
|
+static void hdd_sysfs_destroy_wifi_root_obj(void)
|
|
|
+{
|
|
|
+ if (!wifi_kobject) {
|
|
|
+ hdd_err("could not get wifi kobject!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ kobject_put(wifi_kobject);
|
|
|
+ wifi_kobject = NULL;
|
|
|
+}
|
|
|
+
|
|
|
+static void hdd_sysfs_create_dump_in_progress_interface(void)
|
|
|
+{
|
|
|
+ int error;
|
|
|
+
|
|
|
+ if (!wifi_kobject) {
|
|
|
+ hdd_err("could not get wifi kobject!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ error = sysfs_create_file(wifi_kobject,
|
|
|
+ &dump_in_progress_attribute.attr);
|
|
|
+ if (error)
|
|
|
+ hdd_err("could not create dump in progress sysfs file");
|
|
|
+}
|
|
|
+
|
|
|
+static void hdd_sysfs_destroy_dump_in_progress_interface(void)
|
|
|
+{
|
|
|
+ if (!wifi_kobject) {
|
|
|
+ hdd_err("could not get wifi kobject!");
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ sysfs_remove_file(wifi_kobject,
|
|
|
+ &dump_in_progress_attribute.attr);
|
|
|
+}
|
|
|
+
|
|
|
#ifdef WLAN_POWER_DEBUG
|
|
|
static void hdd_sysfs_create_powerstats_interface(void)
|
|
|
{
|
|
@@ -825,8 +971,10 @@ void hdd_create_sysfs_files(struct hdd_context *hdd_ctx)
|
|
|
hdd_sysfs_create_driver_root_obj();
|
|
|
hdd_sysfs_create_version_interface(hdd_ctx->psoc);
|
|
|
hdd_sysfs_mem_stats_create(wlan_kobject);
|
|
|
+ hdd_sysfs_create_wifi_root_obj();
|
|
|
if (QDF_GLOBAL_MISSION_MODE == hdd_get_conparam()) {
|
|
|
hdd_sysfs_create_powerstats_interface();
|
|
|
+ hdd_sysfs_create_dump_in_progress_interface();
|
|
|
hdd_sysfs_fw_mode_config_create(driver_kobject);
|
|
|
hdd_sysfs_scan_disable_create(driver_kobject);
|
|
|
hdd_sysfs_wow_ito_create(driver_kobject);
|
|
@@ -861,8 +1009,10 @@ void hdd_destroy_sysfs_files(void)
|
|
|
hdd_sysfs_wow_ito_destroy(driver_kobject);
|
|
|
hdd_sysfs_scan_disable_destroy(driver_kobject);
|
|
|
hdd_sysfs_fw_mode_config_destroy(driver_kobject);
|
|
|
+ hdd_sysfs_destroy_dump_in_progress_interface();
|
|
|
hdd_sysfs_destroy_powerstats_interface();
|
|
|
}
|
|
|
+ hdd_sysfs_destroy_wifi_root_obj();
|
|
|
hdd_sysfs_mem_stats_destroy(wlan_kobject);
|
|
|
hdd_sysfs_destroy_version_interface();
|
|
|
hdd_sysfs_destroy_driver_root_obj();
|