Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d9a24270 authored by Dedy Lansky's avatar Dedy Lansky Committed by Gerrit - the friendly Code Review server
Browse files

wil6210: add debugfs to show PMC ring content



PMC is a hardware debug mechanism which allows capturing real time
debug data and stream it to host memory. The driver allocates memory
buffers and set them inside PMC ring of descriptors.
Add pmcring debugfs that application can use to read the binary
content of descriptors inside the PMC ring (cat pmcring).

Change-Id: I39594b2bdd1b956e0ea290acdf251e66bf3e0e0c
Signed-off-by: default avatarDedy Lansky <dlansky@codeaurora.org>
parent 773b595b
Loading
Loading
Loading
Loading
+13 −0
Original line number Diff line number Diff line
@@ -1028,6 +1028,18 @@ static const struct file_operations fops_pmcdata = {
	.llseek		= wil_pmc_llseek,
};

static int wil_pmcring_seq_open(struct inode *inode, struct file *file)
{
	return single_open(file, wil_pmcring_read, inode->i_private);
}

static const struct file_operations fops_pmcring = {
	.open		= wil_pmcring_seq_open,
	.release	= single_release,
	.read		= seq_read,
	.llseek		= seq_lseek,
};

/*---tx_mgmt---*/
/* Write mgmt frame to this file to send it */
static ssize_t wil_write_file_txmgmt(struct file *file, const char __user *buf,
@@ -2569,6 +2581,7 @@ static const struct {
	{"back",	0644,		&fops_back},
	{"pmccfg",	0644,		&fops_pmccfg},
	{"pmcdata",	0444,		&fops_pmcdata},
	{"pmcring",	0444,		&fops_pmcring},
	{"temp",	0444,		&fops_temp},
	{"freq",	0444,		&fops_freq},
	{"link",	0444,		&fops_link},
+27 −1
Original line number Diff line number Diff line
/*
 * Copyright (c) 2012-2015,2017 Qualcomm Atheros, Inc.
 * Copyright (c) 2018, The Linux Foundation. All rights reserved.
 * Copyright (c) 2018,2019 The Linux Foundation. All rights reserved.
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
@@ -18,6 +18,7 @@
#include <linux/types.h>
#include <linux/errno.h>
#include <linux/fs.h>
#include <linux/seq_file.h>
#include "wmi.h"
#include "wil6210.h"
#include "txrx.h"
@@ -431,3 +432,28 @@ loff_t wil_pmc_llseek(struct file *filp, loff_t off, int whence)

	return newpos;
}

int wil_pmcring_read(struct seq_file *s, void *data)
{
	struct wil6210_priv *wil = s->private;
	struct pmc_ctx *pmc = &wil->pmc;
	size_t pmc_ring_size =
		sizeof(struct vring_rx_desc) * pmc->num_descriptors;

	mutex_lock(&pmc->lock);

	if (!wil_is_pmc_allocated(pmc)) {
		wil_err(wil, "error, pmc is not allocated!\n");
		pmc->last_cmd_status = -EPERM;
		mutex_unlock(&pmc->lock);
		return -EPERM;
	}

	wil_dbg_misc(wil, "pmcring_read: size %zu\n", pmc_ring_size);

	seq_write(s, pmc->pring_va, pmc_ring_size);

	mutex_unlock(&pmc->lock);

	return 0;
}
+2 −0
Original line number Diff line number Diff line
/*
 * Copyright (c) 2012-2015 Qualcomm Atheros, Inc.
 * Copyright (c) 2019, The Linux Foundation. All rights reserved.
 *
 * Permission to use, copy, modify, and/or distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
@@ -25,3 +26,4 @@ void wil_pmc_free(struct wil6210_priv *wil, int send_pmc_cmd);
int wil_pmc_last_cmd_status(struct wil6210_priv *wil);
ssize_t wil_pmc_read(struct file *, char __user *, size_t, loff_t *);
loff_t wil_pmc_llseek(struct file *filp, loff_t off, int whence);
int wil_pmcring_read(struct seq_file *s, void *data);