Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

wl18xx: add dynamic fw traces

add option to dynamically configure the fw
which debug traces to open

Signed-off-by: Guy Mishol <guym@ti.com>
Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Kalle Valo <kvalo@codeaurora.org>

authored by

Guy Mishol and committed by
Kalle Valo
d1c54096 2728cecd

+97 -1
+27
drivers/net/wireless/ti/wl18xx/acx.c
··· 282 282 kfree(acx); 283 283 return ret; 284 284 } 285 + 286 + int wl18xx_acx_dynamic_fw_traces(struct wl1271 *wl) 287 + { 288 + struct acx_dynamic_fw_traces_cfg *acx; 289 + int ret; 290 + 291 + wl1271_debug(DEBUG_ACX, "acx dynamic fw traces config %d", 292 + wl->dynamic_fw_traces); 293 + 294 + acx = kzalloc(sizeof(*acx), GFP_KERNEL); 295 + if (!acx) { 296 + ret = -ENOMEM; 297 + goto out; 298 + } 299 + 300 + acx->dynamic_fw_traces = cpu_to_le32(wl->dynamic_fw_traces); 301 + 302 + ret = wl1271_cmd_configure(wl, ACX_DYNAMIC_TRACES_CFG, 303 + acx, sizeof(*acx)); 304 + if (ret < 0) { 305 + wl1271_warning("acx config dynamic fw traces failed: %d", ret); 306 + goto out; 307 + } 308 + out: 309 + kfree(acx); 310 + return ret; 311 + }
+12 -1
drivers/net/wireless/ti/wl18xx/acx.h
··· 35 35 ACX_PEER_CAP = 0x0056, 36 36 ACX_INTERRUPT_NOTIFY = 0x0057, 37 37 ACX_RX_BA_FILTER = 0x0058, 38 - ACX_AP_SLEEP_CFG = 0x0059 38 + ACX_AP_SLEEP_CFG = 0x0059, 39 + ACX_DYNAMIC_TRACES_CFG = 0x005A, 39 40 }; 40 41 41 42 /* numbers of bits the length field takes (add 1 for the actual number) */ ··· 368 367 u8 idle_conn_thresh; 369 368 } __packed; 370 369 370 + /* 371 + * ACX_DYNAMIC_TRACES_CFG 372 + * configure the FW dynamic traces 373 + */ 374 + struct acx_dynamic_fw_traces_cfg { 375 + struct acx_header header; 376 + __le32 dynamic_fw_traces; 377 + } __packed; 378 + 371 379 int wl18xx_acx_host_if_cfg_bitmap(struct wl1271 *wl, u32 host_cfg_bitmap, 372 380 u32 sdio_blk_size, u32 extra_mem_blks, 373 381 u32 len_field_size); ··· 390 380 int wl18xx_acx_interrupt_notify_config(struct wl1271 *wl, bool action); 391 381 int wl18xx_acx_rx_ba_filter(struct wl1271 *wl, bool action); 392 382 int wl18xx_acx_ap_sleep(struct wl1271 *wl); 383 + int wl18xx_acx_dynamic_fw_traces(struct wl1271 *wl); 393 384 394 385 #endif /* __WL18XX_ACX_H__ */
+50
drivers/net/wireless/ti/wl18xx/debugfs.c
··· 281 281 .llseek = default_llseek, 282 282 }; 283 283 284 + static ssize_t dynamic_fw_traces_write(struct file *file, 285 + const char __user *user_buf, 286 + size_t count, loff_t *ppos) 287 + { 288 + struct wl1271 *wl = file->private_data; 289 + unsigned long value; 290 + int ret; 291 + 292 + ret = kstrtoul_from_user(user_buf, count, 0, &value); 293 + if (ret < 0) 294 + return ret; 295 + 296 + mutex_lock(&wl->mutex); 297 + 298 + wl->dynamic_fw_traces = value; 299 + 300 + if (unlikely(wl->state != WLCORE_STATE_ON)) 301 + goto out; 302 + 303 + ret = wl1271_ps_elp_wakeup(wl); 304 + if (ret < 0) 305 + goto out; 306 + 307 + ret = wl18xx_acx_dynamic_fw_traces(wl); 308 + if (ret < 0) 309 + count = ret; 310 + 311 + wl1271_ps_elp_sleep(wl); 312 + out: 313 + mutex_unlock(&wl->mutex); 314 + return count; 315 + } 316 + 317 + static ssize_t dynamic_fw_traces_read(struct file *file, 318 + char __user *userbuf, 319 + size_t count, loff_t *ppos) 320 + { 321 + struct wl1271 *wl = file->private_data; 322 + return wl1271_format_buffer(userbuf, count, ppos, 323 + "%d\n", wl->dynamic_fw_traces); 324 + } 325 + 326 + static const struct file_operations dynamic_fw_traces_ops = { 327 + .read = dynamic_fw_traces_read, 328 + .write = dynamic_fw_traces_write, 329 + .open = simple_open, 330 + .llseek = default_llseek, 331 + }; 332 + 284 333 int wl18xx_debugfs_add_files(struct wl1271 *wl, 285 334 struct dentry *rootdir) 286 335 { ··· 482 433 483 434 DEBUGFS_ADD(conf, moddir); 484 435 DEBUGFS_ADD(radar_detection, moddir); 436 + DEBUGFS_ADD(dynamic_fw_traces, moddir); 485 437 486 438 return 0; 487 439
+5
drivers/net/wireless/ti/wl18xx/main.c
··· 1159 1159 if (ret < 0) 1160 1160 return ret; 1161 1161 1162 + /* set the dynamic fw traces bitmap */ 1163 + ret = wl18xx_acx_dynamic_fw_traces(wl); 1164 + if (ret < 0) 1165 + return ret; 1166 + 1162 1167 if (checksum_param) { 1163 1168 ret = wl18xx_acx_set_checksum_state(wl); 1164 1169 if (ret != 0)
+3
drivers/net/wireless/ti/wlcore/wlcore.h
··· 500 500 /* interface combinations supported by the hw */ 501 501 const struct ieee80211_iface_combination *iface_combinations; 502 502 u8 n_iface_combinations; 503 + 504 + /* dynamic fw traces */ 505 + u32 dynamic_fw_traces; 503 506 }; 504 507 505 508 int wlcore_probe(struct wl1271 *wl, struct platform_device *pdev);