[9610] wlbt: add regdom revision to .wifiver.info file
authorAlbert Cano <a.canocamps@samsung.com>
Fri, 6 Jul 2018 05:31:03 +0000 (06:31 +0100)
committerIvan Priest <i.priest@samsung.com>
Wed, 11 Jul 2018 17:43:31 +0000 (18:43 +0100)
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 <d.purohit@samsung.com>
Signed-off-by: Albert Cano <a.canocamps@samsung.com>
drivers/misc/samsung/scsc/mxman.c
drivers/net/wireless/scsc/dev.h
drivers/net/wireless/scsc/mgt.c

index daf53b008b20b6d725a1119860ae0d0e2c5152a1..7c13b407bb10076109948d7ed8875d0fc10343cc 100755 (executable)
@@ -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 */
index 3135477de2e7ca4425f335ff9132d87c487875b0..3829dacd1881c8f41e31a7a8a428112d38bf6fb4 100755 (executable)
@@ -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;
index 961478719338407a84a67e940814fec42f77e550..035d300dab4547d526cd3b318a967ce52cf83c5a 100755 (executable)
@@ -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) {