From 13015f10596a5eb568c0555b8cdb283f524dc575 Mon Sep 17 00:00:00 2001 From: Arunk Khandavalli Date: Tue, 27 Nov 2018 19:55:52 +0530 Subject: [PATCH] qcacld-3.0: Initial dsc psoc deployement for syfs entries Integrate the sysfs entries to the new dsc psoc infrastructure. Change-Id: I4ccb012125fed7ff41ce9a4d887e0df6091aec23 CRs-Fixed: 2362343 --- core/hdd/src/wlan_hdd_sysfs.c | 87 +++++++++++++++++++++++------------ 1 file changed, 58 insertions(+), 29 deletions(-) diff --git a/core/hdd/src/wlan_hdd_sysfs.c b/core/hdd/src/wlan_hdd_sysfs.c index 2c8c21dff96bc..945f217e345a0 100644 --- a/core/hdd/src/wlan_hdd_sysfs.c +++ b/core/hdd/src/wlan_hdd_sysfs.c @@ -34,6 +34,7 @@ #include #include #include +#include #define MAX_PSOC_ID_SIZE 10 @@ -48,9 +49,7 @@ static struct kobject *driver_kobject; static struct kobject *fw_kobject; static struct kobject *psoc_kobject; -static ssize_t __show_driver_version(struct kobject *kobj, - struct kobj_attribute *attr, - char *buf) +static ssize_t __show_driver_version(char *buf) { return scnprintf(buf, PAGE_SIZE, QWLAN_VERSIONSTR); } @@ -60,22 +59,10 @@ static ssize_t show_driver_version(struct kobject *kobj, char *buf) { ssize_t ret_val; - - cds_ssr_protect(__func__); - ret_val = __show_driver_version(kobj, attr, buf); - cds_ssr_unprotect(__func__); - - return ret_val; -} - -static ssize_t __show_fw_version(struct kobject *kobj, - struct kobj_attribute *attr, - char *buf) -{ - uint32_t major_spid = 0, minor_spid = 0, siid = 0, crmid = 0; - uint32_t sub_id = 0; - struct hdd_context *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); int ret; + QDF_STATUS status; + struct hdd_context *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); + struct dsc_psoc *dsc_psoc; ret = wlan_hdd_validate_context(hdd_ctx); if (ret) { @@ -83,6 +70,24 @@ static ssize_t __show_fw_version(struct kobject *kobj, return ret; } + dsc_psoc = hdd_dsc_psoc_from_wiphy(hdd_ctx->wiphy); + status = dsc_psoc_op_start(dsc_psoc); + if (QDF_IS_STATUS_ERROR(status)) + return qdf_status_to_os_return(status); + + cds_ssr_protect(__func__); + ret_val = __show_driver_version(buf); + cds_ssr_unprotect(__func__); + dsc_psoc_op_stop(dsc_psoc); + return ret_val; +} + +static ssize_t __show_fw_version(struct hdd_context *hdd_ctx, + char *buf) +{ + uint32_t major_spid = 0, minor_spid = 0, siid = 0, crmid = 0; + uint32_t sub_id = 0; + hdd_debug("Rcvd req for FW version"); hdd_get_fw_version(hdd_ctx, &major_spid, &minor_spid, &siid, &crmid); @@ -104,11 +109,26 @@ static ssize_t show_fw_version(struct kobject *kobj, char *buf) { ssize_t ret_val; + struct hdd_context *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); + int ret; + QDF_STATUS status; + struct dsc_psoc *dsc_psoc; + + ret = wlan_hdd_validate_context(hdd_ctx); + if (ret) { + hdd_err("hdd ctx is invalid"); + return ret; + } + + dsc_psoc = hdd_dsc_psoc_from_wiphy(hdd_ctx->wiphy); + status = dsc_psoc_op_start(dsc_psoc); + if (QDF_IS_STATUS_ERROR(status)) + return qdf_status_to_os_return(status); cds_ssr_protect(__func__); - ret_val = __show_fw_version(kobj, attr, buf); + ret_val = __show_fw_version(hdd_ctx, buf); cds_ssr_unprotect(__func__); - + dsc_psoc_op_stop(dsc_psoc); return ret_val; }; @@ -165,11 +185,9 @@ static void hdd_power_debugstats_cb(struct power_stats_response *response, hdd_exit(); } -static ssize_t __show_device_power_stats(struct kobject *kobj, - struct kobj_attribute *attr, +static ssize_t __show_device_power_stats(struct hdd_context *hdd_ctx, char *buf) { - struct hdd_context *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); QDF_STATUS status; struct power_stats_response *chip_power_stats; ssize_t ret_cnt = 0; @@ -185,10 +203,6 @@ static ssize_t __show_device_power_stats(struct kobject *kobj, hdd_enter(); - ret_cnt = wlan_hdd_validate_context(hdd_ctx); - if (ret_cnt) - return ret_cnt; - request = osif_request_alloc(¶ms); if (!request) { hdd_err("Request allocation failure"); @@ -250,11 +264,26 @@ static ssize_t show_device_power_stats(struct kobject *kobj, char *buf) { ssize_t ret_val; + struct hdd_context *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); + int ret; + QDF_STATUS status; + struct dsc_psoc *dsc_psoc; + + ret = wlan_hdd_validate_context(hdd_ctx); + if (ret) { + hdd_err("hdd ctx is invalid"); + return ret; + } + + dsc_psoc = hdd_dsc_psoc_from_wiphy(hdd_ctx->wiphy); + status = dsc_psoc_op_start(dsc_psoc); + if (QDF_IS_STATUS_ERROR(status)) + return qdf_status_to_os_return(status); cds_ssr_protect(__func__); - ret_val = __show_device_power_stats(kobj, attr, buf); + ret_val = __show_device_power_stats(hdd_ctx, buf); cds_ssr_unprotect(__func__); - + dsc_psoc_op_stop(dsc_psoc); return ret_val; }