diff options
author | Jaeyoung Kim <jaeyoung.kim@broadcom.corp-partner.google.com> | 2022-04-07 14:25:28 +0900 |
---|---|---|
committer | Roger Wang <wangroger@google.com> | 2022-04-11 09:21:43 +0000 |
commit | e5e3e4244a1df4cb3e25c7efa68ed7e1de92272e (patch) | |
tree | 81fe368efd549f6dbc89f2467751052540ff9b01 /dhd_linux_exportfs.c | |
parent | 02a9a598d09299190a03480638981cacc29c9692 (diff) | |
download | bcm4389-e5e3e4244a1df4cb3e25c7efa68ed7e1de92272e.tar.gz |
bcmdhd: Added TCM test mode selection
GG factory team requested to provide a solution to reduce TCM test time which takes 1-4 seconds.
TCM test works for MFG firmware only and it triggered before FW download from DHD to dongle in dhd_open().
To support the request, we can add the file node 'tcm_test_mode' in /sys/wifi and we can support 3 mode as below.
0 : disable TCM test
1 : run TCM test once after device booting
2 : run TCM test at every FW download (dhd open)- this is the current implementation, so this should be the default value to avoid any regression on current factory lines.
And the test status will be reset when there was mode change.
Bug: 228148666
Signed-off-by: Jaeyoung Kim <jaeyoung.kim@broadcom.corp-partner.google.com>
Test: validated Pixel6 with 10 TC
test1) without the file 'tcm_test_mode' (default mode is 2)
[Thu Apr 7 10:18:04 2022] [10:18:05.319453][dhd][wlan]dhdpcie_download_code_file: dhd_tcm_test_enable 1, dhd_tcm_test_status 0, dhd_tcm_test_mode 2
[Thu Apr 7 10:18:04 2022] [10:18:05.319474][dhd][wlan]dhd_bus_tcm_test: start 200000, size: 2a0000
[Thu Apr 7 10:18:04 2022] [10:18:05.319490][dhd][wlan]dhd_bus_tcm_test: memblock size 2048, #pattern 2
[Thu Apr 7 10:18:07 2022] [10:18:08.220764][dhd][wlan]dhd_bus_tcm_test: Success iter : 2
[Thu Apr 7 10:18:07 2022] [10:18:08.220773][dhd][wlan]dhdpcie_download_code_file: download firmware fw_bcmdhd_mfg.bin
...
[Thu Apr 7 10:22:04 2022] [10:22:05.099051][dhd][wlan]dhdpcie_download_code_file: dhd_tcm_test_enable 1, dhd_tcm_test_status 0, dhd_tcm_test_mode 2
[Thu Apr 7 10:22:04 2022] [10:22:05.099080][dhd][wlan]dhd_bus_tcm_test: start 200000, size: 2a0000
[Thu Apr 7 10:22:04 2022] [10:22:05.099101][dhd][wlan]dhd_bus_tcm_test: memblock size 2048, #pattern 2
[Thu Apr 7 10:22:07 2022] [10:22:08.002377][dhd][wlan]dhd_bus_tcm_test: Success iter : 2
[Thu Apr 7 10:22:07 2022] [10:22:08.002386][dhd][wlan]dhdpcie_download_code_file: download firmware fw_bcmdhd_mfg.bin
test2) echo "0" > tcm_test_mode
[Thu Apr 7 10:48:36 2022] [10:48:37.216048][dhd][wlan]dhdpcie_download_code_file: dhd_tcm_test_enable 1, dhd_tcm_test_status 0, dhd_tcm_test_mode 0
[Thu Apr 7 10:48:36 2022] [10:48:37.216097][dhd][wlan]dhdpcie_download_code_file: download firmware fw_bcmdhd_mfg.bin
...
[Thu Apr 7 10:48:42 2022] [10:48:43.565335][dhd][wlan]dhdpcie_download_code_file: dhd_tcm_test_enable 1, dhd_tcm_test_status 0, dhd_tcm_test_mode 0
[Thu Apr 7 10:48:42 2022] [10:48:43.565356][dhd][wlan]dhdpcie_download_code_file: download firmware fw_bcmdhd_mfg.bin
test3) echo "1" > tcm_test_mode
[Thu Apr 7 10:49:08 2022] [10:49:08.755171][dhd][wlan]dhdpcie_download_code_file: dhd_tcm_test_enable 1, dhd_tcm_test_status 0, dhd_tcm_test_mode 1
[Thu Apr 7 10:49:08 2022] [10:49:08.755199][dhd][wlan]dhd_bus_tcm_test: start 200000, size: 2a0000
[Thu Apr 7 10:49:08 2022] [10:49:08.755222][dhd][wlan]dhd_bus_tcm_test: memblock size 2048, #pattern 2
[Thu Apr 7 10:49:10 2022] [10:49:11.653840][dhd][wlan]dhd_bus_tcm_test: Success iter : 2
...
[Thu Apr 7 10:49:10 2022] [10:49:11.653854][dhd][wlan]dhdpcie_download_code_file: download firmware fw_bcmdhd_mfg.bin
[Thu Apr 7 10:49:16 2022] [10:49:16.923690][dhd][wlan]dhdpcie_download_code_file: dhd_tcm_test_enable 1, dhd_tcm_test_status 2, dhd_tcm_test_mode 1
[Thu Apr 7 10:49:16 2022] [10:49:16.923709][dhd][wlan]dhdpcie_download_code_file: download firmware fw_bcmdhd_mfg.bin
test4) echo "2" > tcm_test_mode
[Thu Apr 7 10:50:29 2022] [10:50:30.467573][dhd][wlan]dhdpcie_download_code_file: dhd_tcm_test_enable 1, dhd_tcm_test_status 0, dhd_tcm_test_mode 2
[Thu Apr 7 10:50:29 2022] [10:50:30.467602][dhd][wlan]dhd_bus_tcm_test: start 200000, size: 2a0000
[Thu Apr 7 10:50:29 2022] [10:50:30.467623][dhd][wlan]dhd_bus_tcm_test: memblock size 2048, #pattern 2
[Thu Apr 7 10:50:32 2022] [10:50:33.376143][dhd][wlan]dhd_bus_tcm_test: Success iter : 2
[Thu Apr 7 10:50:32 2022] [10:50:33.376153][dhd][wlan]dhdpcie_download_code_file: download firmware fw_bcmdhd_mfg.bin
...
[Thu Apr 7 10:50:36 2022] [10:50:37.535986][dhd][wlan]dhdpcie_download_code_file: dhd_tcm_test_enable 1, dhd_tcm_test_status 0, dhd_tcm_test_mode 2
[Thu Apr 7 10:50:36 2022] [10:50:37.536014][dhd][wlan]dhd_bus_tcm_test: start 200000, size: 2a0000
[Thu Apr 7 10:50:36 2022] [10:50:37.536038][dhd][wlan]dhd_bus_tcm_test: memblock size 2048, #pattern 2
[Thu Apr 7 10:50:39 2022] [10:50:40.441813][dhd][wlan]dhd_bus_tcm_test: Success iter : 2
[Thu Apr 7 10:50:39 2022] [10:50:40.441823][dhd][wlan]dhdpcie_download_code_file: download firmware fw_bcmdhd_mfg.bin
test5) change mode 0 -> 1
[Thu Apr 7 10:51:24 2022] [10:51:25.020252][dhd][wlan]dhdpcie_download_code_file: dhd_tcm_test_enable 1, dhd_tcm_test_status 0, dhd_tcm_test_mode 0
[Thu Apr 7 10:51:24 2022] [10:51:25.020272][dhd][wlan]dhdpcie_download_code_file: download firmware fw_bcmdhd_mfg.bin
...
[Thu Apr 7 10:51:34 2022] [10:51:35.027592][dhd][wlan]dhdpcie_download_code_file: dhd_tcm_test_enable 1, dhd_tcm_test_status 0, dhd_tcm_test_mode 1
[Thu Apr 7 10:51:34 2022] [10:51:35.027618][dhd][wlan]dhd_bus_tcm_test: start 200000, size: 2a0000
[Thu Apr 7 10:51:34 2022] [10:51:35.027638][dhd][wlan]dhd_bus_tcm_test: memblock size 2048, #pattern 2
[Thu Apr 7 10:51:37 2022] [10:51:37.907277][dhd][wlan]dhd_bus_tcm_test: Success iter : 2
[Thu Apr 7 10:51:37 2022] [10:51:37.907317][dhd][wlan]dhdpcie_download_code_file: download firmware fw_bcmdhd_mfg.bin
...
[Thu Apr 7 10:52:03 2022] [10:52:03.825264][dhd][wlan]dhdpcie_download_code_file: dhd_tcm_test_enable 1, dhd_tcm_test_status 2, dhd_tcm_test_mode 1
[Thu Apr 7 10:52:03 2022] [10:52:03.825328][dhd][wlan]dhdpcie_download_code_file: download firmware fw_bcmdhd_mfg.bin
test6) change mode 0 -> 2
[Thu Apr 7 10:52:30 2022] [10:52:31.599737][dhd][wlan]dhdpcie_download_code_file: dhd_tcm_test_enable 1, dhd_tcm_test_status 0, dhd_tcm_test_mode 0
[Thu Apr 7 10:52:30 2022] [10:52:31.599759][dhd][wlan]dhdpcie_download_code_file: download firmware fw_bcmdhd_mfg.bin
...
[Thu Apr 7 10:52:44 2022] [10:52:45.674696][dhd][wlan]dhdpcie_download_code_file: dhd_tcm_test_enable 1, dhd_tcm_test_status 0, dhd_tcm_test_mode 2
[Thu Apr 7 10:52:44 2022] [10:52:45.674722][dhd][wlan]dhd_bus_tcm_test: start 200000, size: 2a0000
[Thu Apr 7 10:52:44 2022] [10:52:45.674744][dhd][wlan]dhd_bus_tcm_test: memblock size 2048, #pattern 2
[Thu Apr 7 10:52:47 2022] [10:52:48.596921][dhd][wlan]dhd_bus_tcm_test: Success iter : 2
[Thu Apr 7 10:52:47 2022] [10:52:48.596934][dhd][wlan]dhdpcie_download_code_file: download firmware fw_bcmdhd_mfg.bin
...
[Thu Apr 7 10:52:53 2022] [10:52:53.859731][dhd][wlan]dhdpcie_download_code_file: dhd_tcm_test_enable 1, dhd_tcm_test_status 0, dhd_tcm_test_mode 2
[Thu Apr 7 10:52:53 2022] [10:52:53.859760][dhd][wlan]dhd_bus_tcm_test: start 200000, size: 2a0000
[Thu Apr 7 10:52:53 2022] [10:52:53.859781][dhd][wlan]dhd_bus_tcm_test: memblock size 2048, #pattern 2
[Thu Apr 7 10:52:56 2022] [10:52:56.765252][dhd][wlan]dhd_bus_tcm_test: Success iter : 2
[Thu Apr 7 10:52:56 2022] [10:52:56.765262][dhd][wlan]dhdpcie_download_code_file: download firmware fw_bcmdhd_mfg.bin
test7) change mode 1 -> 0
[Thu Apr 7 10:58:02 2022] [10:58:03.001275][dhd][wlan]dhdpcie_download_code_file: dhd_tcm_test_enable 1, dhd_tcm_test_status 0, dhd_tcm_test_mode 1
[Thu Apr 7 10:58:02 2022] [10:58:03.001344][dhd][wlan]dhd_bus_tcm_test: start 200000, size: 2a0000
[Thu Apr 7 10:58:02 2022] [10:58:03.001399][dhd][wlan]dhd_bus_tcm_test: memblock size 2048, #pattern 2
[Thu Apr 7 10:58:05 2022] [10:58:05.750820][dhd][wlan]dhd_bus_tcm_test: Success iter : 2
[Thu Apr 7 10:58:05 2022] [10:58:05.750867][dhd][wlan]dhdpcie_download_code_file: download firmware fw_bcmdhd_mfg.bin
...
[Thu Apr 7 10:58:12 2022] [10:58:12.915455][dhd][wlan]dhdpcie_download_code_file: dhd_tcm_test_enable 1, dhd_tcm_test_status 2, dhd_tcm_test_mode 1
[Thu Apr 7 10:58:12 2022] [10:58:12.915473][dhd][wlan]dhdpcie_download_code_file: download firmware fw_bcmdhd_mfg.bin
...
[Thu Apr 7 10:58:20 2022] [10:58:21.038445][dhd][wlan]dhdpcie_download_code_file: dhd_tcm_test_enable 1, dhd_tcm_test_status 0, dhd_tcm_test_mode 0
[Thu Apr 7 10:58:20 2022] [10:58:21.038468][dhd][wlan]dhdpcie_download_code_file: download firmware fw_bcmdhd_mfg.bin
test8) change mode 1 -> 2
[Thu Apr 7 10:55:23 2022] [10:55:24.592397][dhd][wlan]dhdpcie_download_code_file: dhd_tcm_test_enable 1, dhd_tcm_test_status 0, dhd_tcm_test_mode 1
[Thu Apr 7 10:55:23 2022] [10:55:24.592424][dhd][wlan]dhd_bus_tcm_test: start 200000, size: 2a0000
[Thu Apr 7 10:55:23 2022] [10:55:24.592446][dhd][wlan]dhd_bus_tcm_test: memblock size 2048, #pattern 2
[Thu Apr 7 10:55:26 2022] [10:55:27.498131][dhd][wlan]dhd_bus_tcm_test: Success iter : 2
[Thu Apr 7 10:55:26 2022] [10:55:27.498140][dhd][wlan]dhdpcie_download_code_file: download firmware fw_bcmdhd_mfg.bin
...
[Thu Apr 7 10:55:30 2022] [10:55:31.388483][dhd][wlan]dhdpcie_download_code_file: dhd_tcm_test_enable 1, dhd_tcm_test_status 2, dhd_tcm_test_mode 1
[Thu Apr 7 10:55:30 2022] [10:55:31.388505][dhd][wlan]dhdpcie_download_code_file: download firmware fw_bcmdhd_mfg.bin
...
[Thu Apr 7 10:55:40 2022] [10:55:41.133597][dhd][wlan]dhdpcie_download_code_file: dhd_tcm_test_enable 1, dhd_tcm_test_status 0, dhd_tcm_test_mode 2
[Thu Apr 7 10:55:40 2022] [10:55:41.133623][dhd][wlan]dhd_bus_tcm_test: start 200000, size: 2a0000
[Thu Apr 7 10:55:40 2022] [10:55:41.133640][dhd][wlan]dhd_bus_tcm_test: memblock size 2048, #pattern 2
[Thu Apr 7 10:55:43 2022] [10:55:43.910360][dhd][wlan]dhd_bus_tcm_test: Success iter : 2
[Thu Apr 7 10:55:43 2022] [10:55:43.910364][dhd][wlan]dhdpcie_download_code_file: download firmware fw_bcmdhd_mfg.bin
test9) change mode 2 -> 0
[Thu Apr 7 10:56:13 2022] [10:56:14.415306][dhd][wlan]dhdpcie_download_code_file: dhd_tcm_test_enable 1, dhd_tcm_test_status 0, dhd_tcm_test_mode 2
[Thu Apr 7 10:56:13 2022] [10:56:14.415332][dhd][wlan]dhd_bus_tcm_test: start 200000, size: 2a0000
[Thu Apr 7 10:56:13 2022] [10:56:14.415354][dhd][wlan]dhd_bus_tcm_test: memblock size 2048, #pattern 2
[Thu Apr 7 10:56:16 2022] [10:56:17.269142][dhd][wlan]dhd_bus_tcm_test: Success iter : 2
[Thu Apr 7 10:56:16 2022] [10:56:17.269164][dhd][wlan]dhdpcie_download_code_file: download firmware fw_bcmdhd_mfg.bin
...
[Thu Apr 7 10:56:27 2022] [10:56:28.579472][dhd][wlan]dhdpcie_download_code_file: dhd_tcm_test_enable 1, dhd_tcm_test_status 0, dhd_tcm_test_mode 0
[Thu Apr 7 10:56:27 2022] [10:56:28.579493][dhd][wlan]dhdpcie_download_code_file: download firmware fw_bcmdhd_mfg.bin
test10) change mode 2 -> 1
[Thu Apr 7 10:56:50 2022] [10:56:50.952061][dhd][wlan]dhdpcie_download_code_file: dhd_tcm_test_enable 1, dhd_tcm_test_status 0, dhd_tcm_test_mode 2
[Thu Apr 7 10:56:50 2022] [10:56:50.952083][dhd][wlan]dhd_bus_tcm_test: start 200000, size: 2a0000
[Thu Apr 7 10:56:50 2022] [10:56:50.952101][dhd][wlan]dhd_bus_tcm_test: memblock size 2048, #pattern 2
[Thu Apr 7 10:56:53 2022] [10:56:53.780964][dhd][wlan]dhd_bus_tcm_test: Success iter : 2
[Thu Apr 7 10:56:53 2022] [10:56:53.781024][dhd][wlan]dhdpcie_download_code_file: download firmware fw_bcmdhd_mfg.bin
...
[Thu Apr 7 10:56:59 2022] [10:57:00.612363][dhd][wlan]dhdpcie_download_code_file: dhd_tcm_test_enable 1, dhd_tcm_test_status 0, dhd_tcm_test_mode 1
[Thu Apr 7 10:56:59 2022] [10:57:00.612392][dhd][wlan]dhd_bus_tcm_test: start 200000, size: 2a0000
[Thu Apr 7 10:56:59 2022] [10:57:00.612412][dhd][wlan]dhd_bus_tcm_test: memblock size 2048, #pattern 2
[Thu Apr 7 10:57:02 2022] [10:57:03.517997][dhd][wlan]dhd_bus_tcm_test: Success iter : 2
[Thu Apr 7 10:57:02 2022] [10:57:03.518007][dhd][wlan]dhdpcie_download_code_file: download firmware fw_bcmdhd_mfg.bin
...
[Thu Apr 7 10:57:25 2022] [10:57:25.909191][dhd][wlan]dhdpcie_download_code_file: dhd_tcm_test_enable 1, dhd_tcm_test_status 2, dhd_tcm_test_mode 1
[Thu Apr 7 10:57:25 2022] [10:57:25.909213][dhd][wlan]dhdpcie_download_code_file: download firmware fw_bcmdhd_mfg.bin
Change-Id: Ia43c2c0fd5264e9ef61d017c1e2b95b87fad6539
Diffstat (limited to 'dhd_linux_exportfs.c')
-rwxr-xr-x[-rw-r--r--] | dhd_linux_exportfs.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/dhd_linux_exportfs.c b/dhd_linux_exportfs.c index 9007598..2a354fc 100644..100755 --- a/dhd_linux_exportfs.c +++ b/dhd_linux_exportfs.c @@ -804,6 +804,40 @@ done: } #endif /* PWRSTATS_SYSFS */ +static ssize_t +show_tcm_test_mode(struct dhd_info *dev, char *buf) +{ + ssize_t ret = 0; + unsigned long mode; + + mode = dhd_tcm_test_mode; + ret = scnprintf(buf, PAGE_SIZE - 1, "%lu \n", + mode); + return ret; +} + +static ssize_t +set_tcm_test_mode(struct dhd_info *dev, const char *buf, size_t count) +{ + unsigned long mode; + + mode = bcm_strtoul(buf, NULL, 10); + + sscanf(buf, "%lu", &mode); + if (mode > TCM_TEST_MODE_ALWAYS ) { + return -EINVAL; + } + + /* reset with the mode change */ + if (dhd_tcm_test_mode != mode) { + dhd_tcm_test_status = TCM_TEST_NOT_RUN; + } + + dhd_tcm_test_mode = (uint)mode; + + return count; +} + /* * Generic Attribute Structure for DHD. * If we have to add a new sysfs entry under /sys/bcm-dhd/, we have @@ -857,6 +891,9 @@ static struct dhd_attr dhd_attr_pwrstats_path = __ATTR(power_stats, 0664, show_pwrstats_path, NULL); #endif /* PWRSTATS_SYSFS */ +static struct dhd_attr dhd_attr_tcm_test_mode = + __ATTR(tcm_test_mode, 0660, show_tcm_test_mode, set_tcm_test_mode); + #define to_dhd(k) container_of(k, struct dhd_info, dhd_kobj) #define to_attr(a) container_of(a, struct dhd_attr, attr) @@ -2249,6 +2286,7 @@ static struct attribute *default_file_attrs[] = { &dhd_attr_fast_rpm_thresh.attr, #endif /* RPM_FAST_TRIGGER */ &dhd_attr_sig_path.attr, + &dhd_attr_tcm_test_mode.attr, NULL }; |