From b47322da2b4f27ef9a4db71f62a6cab630865b85 Mon Sep 17 00:00:00 2001 From: Albert Cano Date: Fri, 6 Jul 2018 06:31:03 +0100 Subject: [PATCH] [9610] wlbt: add regdom revision to .wifiver.info file 1) Move the .wifiver.info file from common code to Wi-Fi service driver. 2) Read regdom revision from a new added MIB and print it in .wifiver.info file Change-Id: I1d72abc92d15d3d9e5cdf72a301ca6459b24aa2e SCSC-Bug-Id: SSB-41300 Signed-off-by: Debabrata Purohit Signed-off-by: Albert Cano --- drivers/misc/samsung/scsc/mxman.c | 36 -------------------- drivers/net/wireless/scsc/dev.h | 1 + drivers/net/wireless/scsc/mgt.c | 55 ++++++++++++++++++++++++++++++- 3 files changed, 55 insertions(+), 37 deletions(-) diff --git a/drivers/misc/samsung/scsc/mxman.c b/drivers/misc/samsung/scsc/mxman.c index daf53b008b20..7c13b407bb10 100755 --- a/drivers/misc/samsung/scsc/mxman.c +++ b/drivers/misc/samsung/scsc/mxman.c @@ -348,39 +348,6 @@ static int send_mm_msg_stop_blocking(struct mxman *mxman) return 0; } -static void write_m_test_fw_version_file(struct mxman *mxman) -{ - struct file *fp = NULL; - char *filepath = "/data/misc/conn/.wifiver.info"; - char buf[256]; - char *build_id = 0; - - if (mxman) - build_id = mxman->fw_build_id; - - fp = filp_open(filepath, O_WRONLY|O_CREAT, 0644); - - if (IS_ERR(fp)) { - SCSC_TAG_INFO(MXMAN, "version file wasn't found\n"); - return; - } else if (fp == NULL) { - SCSC_TAG_INFO(MXMAN, "%s doesn't exist.\n", filepath); - return; - } - snprintf(buf, sizeof(buf), "drv_ver: %d.%d.%d.%d N (f/w: %s)\n", - SCSC_RELEASE_PRODUCT, SCSC_RELEASE_ITERATION, SCSC_RELEASE_CANDIDATE, SCSC_RELEASE_POINT, - build_id ? build_id : "unknown"); -#ifdef CONFIG_SCSC_WLBTD - scsc_wlbtd_get_and_print_build_type(); -#endif - kernel_write(fp, buf, strlen(buf), 0); - - if (fp) - filp_close(fp, NULL); - - SCSC_TAG_INFO(MXMAN, "Succeed to write firmware/host information to .wifiver.info\n"); -} - static char *chip_version(u32 rf_hw_ver) { switch (rf_hw_ver & 0x00ff) { @@ -433,9 +400,6 @@ static void mxman_print_versions(struct mxman *mxman) #ifdef CONFIG_SCSC_WLBTD scsc_wlbtd_get_and_print_build_type(); #endif - - /* write /data/.wifiver.info */ - write_m_test_fw_version_file(mxman); } /** Receive handler for messages from the FW along the maxwell management transport */ diff --git a/drivers/net/wireless/scsc/dev.h b/drivers/net/wireless/scsc/dev.h index 3135477de2e7..3829dacd1881 100755 --- a/drivers/net/wireless/scsc/dev.h +++ b/drivers/net/wireless/scsc/dev.h @@ -895,6 +895,7 @@ struct slsi_dev { struct scsc_service *service; struct slsi_chip_info_mib chip_info_mib; struct slsi_plat_info_mib plat_info_mib; + u16 reg_dom_version; #ifdef CONFIG_SCSC_WLAN_MUTEX_DEBUG struct slsi_mutex netdev_add_remove_mutex; diff --git a/drivers/net/wireless/scsc/mgt.c b/drivers/net/wireless/scsc/mgt.c index 961478719338..035d300dab45 100755 --- a/drivers/net/wireless/scsc/mgt.c +++ b/drivers/net/wireless/scsc/mgt.c @@ -41,6 +41,9 @@ #define SLSI_MIB_MAX_CLIENT (10) #define SLSI_REG_PARAM_START_INDEX (1) +/* temp until it gets integrated into mib.h by Autogen */ +#define SLSI_PSID_UNIFI_REG_DOM_VERSION 8019 + static char *mib_file_t = "wlan_t.hcf"; module_param(mib_file_t, charp, S_IRUGO | S_IWUSR); MODULE_PARM_DESC(mib_file_t, "mib data filename"); @@ -212,6 +215,47 @@ static void slsi_print_platform_id(struct slsi_dev *sdev) mx140_file_release_conf(sdev->maxwell_core, e); } + +static void write_wifi_version_info_file(struct slsi_dev *sdev) +{ + struct file *fp = NULL; + char *filepath = "/data/misc/conn/.wifiver.info"; + char buf[256]; + char build_id_fw[128]; + char build_id_drv[64]; + + fp = filp_open(filepath, O_WRONLY | O_CREAT | O_TRUNC, 0644); + + if (IS_ERR(fp)) { + SLSI_WARN(sdev, "version file wasn't found\n"); + return; + } else if (!fp) { + SLSI_WARN(sdev, "%s doesn't exist.\n", filepath); + return; + } + + mxman_get_fw_version(build_id_fw, 128); + mxman_get_driver_version(build_id_drv, 64); + + /* WARNING: + * Please do not change the format of the following string + * as it can have fatal consequences. + * The framework parser for the version may depend on this + * exact formatting. + */ + snprintf(buf, sizeof(buf), "%s (f/w_ver: %s\nregDom_ver: %d.%d)\n", + build_id_drv, + build_id_fw, + ((sdev->reg_dom_version >> 8) & 0xFF), (sdev->reg_dom_version & 0xFF)); + + kernel_write(fp, buf, strlen(buf), 0); + + if (fp) + filp_close(fp, NULL); + + SLSI_INFO(sdev, "Succeed to write firmware/host information to .wifiver.info\n"); +} + #ifdef CONFIG_SCSC_WLAN_DEBUG int slsi_start_monitor_mode(struct slsi_dev *sdev, struct net_device *dev) { @@ -388,9 +432,11 @@ int slsi_start(struct slsi_dev *sdev) wiphy_apply_custom_regulatory(sdev->wiphy, sdev->device_config.domain_info.regdomain); } } - /* Do nothing for unifiDefaultCountry == world_domain */ + /* write .wifiver.info */ + write_wifi_version_info_file(sdev); + #ifdef CONFIG_SCSC_WLAN_AP_INFO_FILE /* writing .softap.info in /data/misc/conn */ fp = filp_open(filepath, O_WRONLY | O_CREAT, 0644); @@ -882,6 +928,7 @@ static int slsi_mib_initial_get(struct slsi_dev *sdev) { SLSI_PSID_UNIFI_VHT_CAPABILITIES, {0, 0} }, { SLSI_PSID_UNIFI24_G40_MHZ_CHANNELS, {0, 0} }, { SLSI_PSID_UNIFI_HARDWARE_PLATFORM, {0, 0} }, + { SLSI_PSID_UNIFI_REG_DOM_VERSION, {0, 0} }, #ifdef CONFIG_SCSC_WLAN_WIFI_SHARING { SLSI_PSID_UNIFI_WI_FI_SHARING5_GHZ_CHANNEL, {0, 0} }, #endif @@ -996,6 +1043,12 @@ static int slsi_mib_initial_get(struct slsi_dev *sdev) } else { SLSI_WARN(sdev, "Error reading Hardware platform\n"); } + if (values[++mib_index].type != SLSI_MIB_TYPE_NONE) { /* REG_DOM_VERSION */ + SLSI_CHECK_TYPE(sdev, values[mib_index].type, SLSI_MIB_TYPE_UINT); + sdev->reg_dom_version = values[mib_index].u.uintValue; + } else { + SLSI_WARN(sdev, "Error reading Reg domain version\n"); + } #ifdef CONFIG_SCSC_WLAN_WIFI_SHARING if (values[++mib_index].type == SLSI_MIB_TYPE_OCTET) { /* 5Ghz Allowed Channels */ if (values[mib_index].u.octetValue.dataLength >= 8) { -- 2.20.1