debugfs.c (2c4cdf5950b1a7a9d731c03c56e2cea3bd8ca7b7) debugfs.c (1a2780e0f3bef7288190e1107350d085c49e3d33)
1/*
2 * Copyright (c) 2012 Qualcomm Atheros, Inc.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES

--- 298 unchanged lines hidden (view full) ---

307
308static const struct file_operations fops_memread = {
309 .open = wil_memread_seq_open,
310 .release = single_release,
311 .read = seq_read,
312 .llseek = seq_lseek,
313};
314
1/*
2 * Copyright (c) 2012 Qualcomm Atheros, Inc.
3 *
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES

--- 298 unchanged lines hidden (view full) ---

307
308static const struct file_operations fops_memread = {
309 .open = wil_memread_seq_open,
310 .release = single_release,
311 .read = seq_read,
312 .llseek = seq_lseek,
313};
314
315static int wil_default_open(struct inode *inode, struct file *file)
316{
317 if (inode->i_private)
318 file->private_data = inode->i_private;
319
320 return 0;
321}
322
323static ssize_t wil_read_file_ioblob(struct file *file, char __user *user_buf,
324 size_t count, loff_t *ppos)
325{
326 enum { max_count = 4096 };
327 struct debugfs_blob_wrapper *blob = file->private_data;
328 loff_t pos = *ppos;
329 size_t available = blob->size;
330 void *buf;

--- 25 unchanged lines hidden (view full) ---

356 count -= ret;
357 *ppos = pos + count;
358
359 return count;
360}
361
362static const struct file_operations fops_ioblob = {
363 .read = wil_read_file_ioblob,
315static ssize_t wil_read_file_ioblob(struct file *file, char __user *user_buf,
316 size_t count, loff_t *ppos)
317{
318 enum { max_count = 4096 };
319 struct debugfs_blob_wrapper *blob = file->private_data;
320 loff_t pos = *ppos;
321 size_t available = blob->size;
322 void *buf;

--- 25 unchanged lines hidden (view full) ---

348 count -= ret;
349 *ppos = pos + count;
350
351 return count;
352}
353
354static const struct file_operations fops_ioblob = {
355 .read = wil_read_file_ioblob,
364 .open = wil_default_open,
356 .open = simple_open,
365 .llseek = default_llseek,
366};
367
368static
369struct dentry *wil_debugfs_create_ioblob(const char *name,
370 mode_t mode,
371 struct dentry *parent,
372 struct debugfs_blob_wrapper *blob)

--- 18 unchanged lines hidden (view full) ---

391 rtnl_unlock();
392 wil_reset(wil);
393
394 return len;
395}
396
397static const struct file_operations fops_reset = {
398 .write = wil_write_file_reset,
357 .llseek = default_llseek,
358};
359
360static
361struct dentry *wil_debugfs_create_ioblob(const char *name,
362 mode_t mode,
363 struct dentry *parent,
364 struct debugfs_blob_wrapper *blob)

--- 18 unchanged lines hidden (view full) ---

383 rtnl_unlock();
384 wil_reset(wil);
385
386 return len;
387}
388
389static const struct file_operations fops_reset = {
390 .write = wil_write_file_reset,
399 .open = wil_default_open,
391 .open = simple_open,
400};
401/*---------Tx descriptor------------*/
402
403static int wil_txdesc_debugfs_show(struct seq_file *s, void *data)
404{
405 struct wil6210_priv *wil = s->private;
406 struct vring *vring = &(wil->vring_tx[0]);
407

--- 113 unchanged lines hidden (view full) ---

521 wdev->ssid_len = count;
522 return simple_write_to_buffer(wdev->ssid, wdev->ssid_len, ppos,
523 buf, count);
524}
525
526static const struct file_operations fops_ssid = {
527 .read = wil_read_file_ssid,
528 .write = wil_write_file_ssid,
392};
393/*---------Tx descriptor------------*/
394
395static int wil_txdesc_debugfs_show(struct seq_file *s, void *data)
396{
397 struct wil6210_priv *wil = s->private;
398 struct vring *vring = &(wil->vring_tx[0]);
399

--- 113 unchanged lines hidden (view full) ---

513 wdev->ssid_len = count;
514 return simple_write_to_buffer(wdev->ssid, wdev->ssid_len, ppos,
515 buf, count);
516}
517
518static const struct file_operations fops_ssid = {
519 .read = wil_read_file_ssid,
520 .write = wil_write_file_ssid,
529 .open = wil_default_open,
521 .open = simple_open,
530};
531
522};
523
524/*---------temp------------*/
525static void print_temp(struct seq_file *s, const char *prefix, u32 t)
526{
527 switch (t) {
528 case 0:
529 case ~(u32)0:
530 seq_printf(s, "%s N/A\n", prefix);
531 break;
532 default:
533 seq_printf(s, "%s %d.%03d\n", prefix, t / 1000, t % 1000);
534 break;
535 }
536}
537
538static int wil_temp_debugfs_show(struct seq_file *s, void *data)
539{
540 struct wil6210_priv *wil = s->private;
541 u32 t_m, t_r;
542
543 int rc = wmi_get_temperature(wil, &t_m, &t_r);
544 if (rc) {
545 seq_printf(s, "Failed\n");
546 return 0;
547 }
548
549 print_temp(s, "MAC temperature :", t_m);
550 print_temp(s, "Radio temperature :", t_r);
551
552 return 0;
553}
554
555static int wil_temp_seq_open(struct inode *inode, struct file *file)
556{
557 return single_open(file, wil_temp_debugfs_show, inode->i_private);
558}
559
560static const struct file_operations fops_temp = {
561 .open = wil_temp_seq_open,
562 .release = single_release,
563 .read = seq_read,
564 .llseek = seq_lseek,
565};
566
532/*----------------*/
533int wil6210_debugfs_init(struct wil6210_priv *wil)
534{
535 struct dentry *dbg = wil->debug = debugfs_create_dir(WIL_NAME,
536 wil_to_wiphy(wil)->debugfsdir);
537
538 if (IS_ERR_OR_NULL(dbg))
539 return -ENODEV;

--- 18 unchanged lines hidden (view full) ---

558 HOSTADDR(RGF_DMA_EP_MISC_ICR));
559 wil6210_debugfs_create_pseudo_ISR(wil, dbg);
560 wil6210_debugfs_create_ITR_CNT(wil, dbg);
561
562 debugfs_create_u32("mem_addr", S_IRUGO | S_IWUSR, dbg, &mem_addr);
563 debugfs_create_file("mem_val", S_IRUGO, dbg, wil, &fops_memread);
564
565 debugfs_create_file("reset", S_IWUSR, dbg, wil, &fops_reset);
567/*----------------*/
568int wil6210_debugfs_init(struct wil6210_priv *wil)
569{
570 struct dentry *dbg = wil->debug = debugfs_create_dir(WIL_NAME,
571 wil_to_wiphy(wil)->debugfsdir);
572
573 if (IS_ERR_OR_NULL(dbg))
574 return -ENODEV;

--- 18 unchanged lines hidden (view full) ---

593 HOSTADDR(RGF_DMA_EP_MISC_ICR));
594 wil6210_debugfs_create_pseudo_ISR(wil, dbg);
595 wil6210_debugfs_create_ITR_CNT(wil, dbg);
596
597 debugfs_create_u32("mem_addr", S_IRUGO | S_IWUSR, dbg, &mem_addr);
598 debugfs_create_file("mem_val", S_IRUGO, dbg, wil, &fops_memread);
599
600 debugfs_create_file("reset", S_IWUSR, dbg, wil, &fops_reset);
601 debugfs_create_file("temp", S_IRUGO, dbg, wil, &fops_temp);
566
567 wil->rgf_blob.data = (void * __force)wil->csr + 0;
568 wil->rgf_blob.size = 0xa000;
569 wil_debugfs_create_ioblob("blob_rgf", S_IRUGO, dbg, &wil->rgf_blob);
570
571 wil->fw_code_blob.data = (void * __force)wil->csr + 0x40000;
572 wil->fw_code_blob.size = 0x40000;
573 wil_debugfs_create_ioblob("blob_fw_code", S_IRUGO, dbg,

--- 30 unchanged lines hidden ---
602
603 wil->rgf_blob.data = (void * __force)wil->csr + 0;
604 wil->rgf_blob.size = 0xa000;
605 wil_debugfs_create_ioblob("blob_rgf", S_IRUGO, dbg, &wil->rgf_blob);
606
607 wil->fw_code_blob.data = (void * __force)wil->csr + 0x40000;
608 wil->fw_code_blob.size = 0x40000;
609 wil_debugfs_create_ioblob("blob_fw_code", S_IRUGO, dbg,

--- 30 unchanged lines hidden ---