2018-05-01 12:20:40 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0
|
|
|
|
//
|
|
|
|
// Freescale SSI ALSA SoC Digital Audio Interface (DAI) debugging functions
|
|
|
|
//
|
|
|
|
// Copyright 2014 Markus Pargmann <mpa@pengutronix.de>, Pengutronix
|
|
|
|
//
|
|
|
|
// Split from fsl_ssi.c
|
2014-04-28 10:54:43 +00:00
|
|
|
|
|
|
|
#include <linux/debugfs.h>
|
|
|
|
#include <linux/device.h>
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
|
|
|
|
#include "fsl_ssi.h"
|
|
|
|
|
|
|
|
void fsl_ssi_dbg_isr(struct fsl_ssi_dbg *dbg, u32 sisr)
|
|
|
|
{
|
2017-12-18 02:52:03 +00:00
|
|
|
if (sisr & SSI_SISR_RFRC)
|
2014-04-28 10:54:43 +00:00
|
|
|
dbg->stats.rfrc++;
|
|
|
|
|
2017-12-18 02:52:03 +00:00
|
|
|
if (sisr & SSI_SISR_TFRC)
|
2014-04-28 10:54:43 +00:00
|
|
|
dbg->stats.tfrc++;
|
|
|
|
|
2017-12-18 02:52:03 +00:00
|
|
|
if (sisr & SSI_SISR_CMDAU)
|
2014-04-28 10:54:43 +00:00
|
|
|
dbg->stats.cmdau++;
|
|
|
|
|
2017-12-18 02:52:03 +00:00
|
|
|
if (sisr & SSI_SISR_CMDDU)
|
2014-04-28 10:54:43 +00:00
|
|
|
dbg->stats.cmddu++;
|
|
|
|
|
2017-12-18 02:52:03 +00:00
|
|
|
if (sisr & SSI_SISR_RXT)
|
2014-04-28 10:54:43 +00:00
|
|
|
dbg->stats.rxt++;
|
|
|
|
|
2017-12-18 02:52:03 +00:00
|
|
|
if (sisr & SSI_SISR_RDR1)
|
2014-04-28 10:54:43 +00:00
|
|
|
dbg->stats.rdr1++;
|
|
|
|
|
2017-12-18 02:52:03 +00:00
|
|
|
if (sisr & SSI_SISR_RDR0)
|
2014-04-28 10:54:43 +00:00
|
|
|
dbg->stats.rdr0++;
|
|
|
|
|
2017-12-18 02:52:03 +00:00
|
|
|
if (sisr & SSI_SISR_TDE1)
|
2014-04-28 10:54:43 +00:00
|
|
|
dbg->stats.tde1++;
|
|
|
|
|
2017-12-18 02:52:03 +00:00
|
|
|
if (sisr & SSI_SISR_TDE0)
|
2014-04-28 10:54:43 +00:00
|
|
|
dbg->stats.tde0++;
|
|
|
|
|
2017-12-18 02:52:03 +00:00
|
|
|
if (sisr & SSI_SISR_ROE1)
|
2014-04-28 10:54:43 +00:00
|
|
|
dbg->stats.roe1++;
|
|
|
|
|
2017-12-18 02:52:03 +00:00
|
|
|
if (sisr & SSI_SISR_ROE0)
|
2014-04-28 10:54:43 +00:00
|
|
|
dbg->stats.roe0++;
|
|
|
|
|
2017-12-18 02:52:03 +00:00
|
|
|
if (sisr & SSI_SISR_TUE1)
|
2014-04-28 10:54:43 +00:00
|
|
|
dbg->stats.tue1++;
|
|
|
|
|
2017-12-18 02:52:03 +00:00
|
|
|
if (sisr & SSI_SISR_TUE0)
|
2014-04-28 10:54:43 +00:00
|
|
|
dbg->stats.tue0++;
|
|
|
|
|
2017-12-18 02:52:03 +00:00
|
|
|
if (sisr & SSI_SISR_TFS)
|
2014-04-28 10:54:43 +00:00
|
|
|
dbg->stats.tfs++;
|
|
|
|
|
2017-12-18 02:52:03 +00:00
|
|
|
if (sisr & SSI_SISR_RFS)
|
2014-04-28 10:54:43 +00:00
|
|
|
dbg->stats.rfs++;
|
|
|
|
|
2017-12-18 02:52:03 +00:00
|
|
|
if (sisr & SSI_SISR_TLS)
|
2014-04-28 10:54:43 +00:00
|
|
|
dbg->stats.tls++;
|
|
|
|
|
2017-12-18 02:52:03 +00:00
|
|
|
if (sisr & SSI_SISR_RLS)
|
2014-04-28 10:54:43 +00:00
|
|
|
dbg->stats.rls++;
|
|
|
|
|
2017-12-18 02:52:03 +00:00
|
|
|
if (sisr & SSI_SISR_RFF1)
|
2014-04-28 10:54:43 +00:00
|
|
|
dbg->stats.rff1++;
|
|
|
|
|
2017-12-18 02:52:03 +00:00
|
|
|
if (sisr & SSI_SISR_RFF0)
|
2014-04-28 10:54:43 +00:00
|
|
|
dbg->stats.rff0++;
|
|
|
|
|
2017-12-18 02:52:03 +00:00
|
|
|
if (sisr & SSI_SISR_TFE1)
|
2014-04-28 10:54:43 +00:00
|
|
|
dbg->stats.tfe1++;
|
|
|
|
|
2017-12-18 02:52:03 +00:00
|
|
|
if (sisr & SSI_SISR_TFE0)
|
2014-04-28 10:54:43 +00:00
|
|
|
dbg->stats.tfe0++;
|
|
|
|
}
|
|
|
|
|
2020-07-02 19:21:36 +00:00
|
|
|
/*
|
2017-12-18 02:52:02 +00:00
|
|
|
* Show the statistics of a flag only if its interrupt is enabled
|
|
|
|
*
|
|
|
|
* Compilers will optimize it to a no-op if the interrupt is disabled
|
2014-04-28 10:54:43 +00:00
|
|
|
*/
|
|
|
|
#define SIER_SHOW(flag, name) \
|
|
|
|
do { \
|
2017-12-18 02:52:03 +00:00
|
|
|
if (SSI_SIER_##flag) \
|
2014-04-28 10:54:43 +00:00
|
|
|
seq_printf(s, #name "=%u\n", ssi_dbg->stats.name); \
|
|
|
|
} while (0)
|
|
|
|
|
|
|
|
|
2020-07-02 19:21:36 +00:00
|
|
|
/*
|
2017-12-18 02:52:02 +00:00
|
|
|
* Display the statistics for the current SSI device
|
2014-04-28 10:54:43 +00:00
|
|
|
*
|
2017-12-18 02:52:02 +00:00
|
|
|
* To avoid confusion, only show those counts that are enabled
|
2014-04-28 10:54:43 +00:00
|
|
|
*/
|
|
|
|
static int fsl_ssi_stats_show(struct seq_file *s, void *unused)
|
|
|
|
{
|
|
|
|
struct fsl_ssi_dbg *ssi_dbg = s->private;
|
|
|
|
|
|
|
|
SIER_SHOW(RFRC_EN, rfrc);
|
|
|
|
SIER_SHOW(TFRC_EN, tfrc);
|
|
|
|
SIER_SHOW(CMDAU_EN, cmdau);
|
|
|
|
SIER_SHOW(CMDDU_EN, cmddu);
|
|
|
|
SIER_SHOW(RXT_EN, rxt);
|
|
|
|
SIER_SHOW(RDR1_EN, rdr1);
|
|
|
|
SIER_SHOW(RDR0_EN, rdr0);
|
|
|
|
SIER_SHOW(TDE1_EN, tde1);
|
|
|
|
SIER_SHOW(TDE0_EN, tde0);
|
|
|
|
SIER_SHOW(ROE1_EN, roe1);
|
|
|
|
SIER_SHOW(ROE0_EN, roe0);
|
|
|
|
SIER_SHOW(TUE1_EN, tue1);
|
|
|
|
SIER_SHOW(TUE0_EN, tue0);
|
|
|
|
SIER_SHOW(TFS_EN, tfs);
|
|
|
|
SIER_SHOW(RFS_EN, rfs);
|
|
|
|
SIER_SHOW(TLS_EN, tls);
|
|
|
|
SIER_SHOW(RLS_EN, rls);
|
|
|
|
SIER_SHOW(RFF1_EN, rff1);
|
|
|
|
SIER_SHOW(RFF0_EN, rff0);
|
|
|
|
SIER_SHOW(TFE1_EN, tfe1);
|
|
|
|
SIER_SHOW(TFE0_EN, tfe0);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2018-11-05 14:37:30 +00:00
|
|
|
DEFINE_SHOW_ATTRIBUTE(fsl_ssi_stats);
|
2014-04-28 10:54:43 +00:00
|
|
|
|
2019-06-14 09:47:55 +00:00
|
|
|
void fsl_ssi_debugfs_create(struct fsl_ssi_dbg *ssi_dbg, struct device *dev)
|
2014-04-28 10:54:43 +00:00
|
|
|
{
|
|
|
|
ssi_dbg->dbg_dir = debugfs_create_dir(dev_name(dev), NULL);
|
|
|
|
|
2019-06-14 09:47:55 +00:00
|
|
|
debugfs_create_file("stats", 0444, ssi_dbg->dbg_dir, ssi_dbg,
|
|
|
|
&fsl_ssi_stats_fops);
|
2014-04-28 10:54:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
void fsl_ssi_debugfs_remove(struct fsl_ssi_dbg *ssi_dbg)
|
|
|
|
{
|
2019-06-14 09:47:55 +00:00
|
|
|
debugfs_remove_recursive(ssi_dbg->dbg_dir);
|
2014-04-28 10:54:43 +00:00
|
|
|
}
|