aboutsummaryrefslogtreecommitdiffstats
path: root/sound/soc/fsl/fsl_ssi.c
diff options
context:
space:
mode:
authorTimur Tabi <timur@freescale.com>2009-03-26 12:42:38 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2009-04-02 11:34:15 -0400
commitd5a908b27adfd7e67b5ab98f674892badcca19c6 (patch)
treea41dca6e9d14d9c79414c7b3dd191c32840df04d /sound/soc/fsl/fsl_ssi.c
parent057de50c0d34b4ef7e15b7a8442a36a396d99c00 (diff)
ASoC: trim SSI sysfs statistics in Freescale MPC8610 sound drivers
Optimize the display of SSI statistics in the Freescale MPC8610 sound driver to display the status count only of the interrupts that were actually enabled. Previously, it would display the counts of all SISR status bits, even those that were not enabled. Signed-off-by: Timur Tabi <timur@freescale.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'sound/soc/fsl/fsl_ssi.c')
-rw-r--r--sound/soc/fsl/fsl_ssi.c79
1 files changed, 47 insertions, 32 deletions
diff --git a/sound/soc/fsl/fsl_ssi.c b/sound/soc/fsl/fsl_ssi.c
index 72823a2b33d6..3711d8454d96 100644
--- a/sound/soc/fsl/fsl_ssi.c
+++ b/sound/soc/fsl/fsl_ssi.c
@@ -60,6 +60,13 @@
60 SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S24_LE) 60 SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S24_LE)
61#endif 61#endif
62 62
63/* SIER bitflag of interrupts to enable */
64#define SIER_FLAGS (CCSR_SSI_SIER_TFRC_EN | CCSR_SSI_SIER_TDMAE | \
65 CCSR_SSI_SIER_TIE | CCSR_SSI_SIER_TUE0_EN | \
66 CCSR_SSI_SIER_TUE1_EN | CCSR_SSI_SIER_RFRC_EN | \
67 CCSR_SSI_SIER_RDMAE | CCSR_SSI_SIER_RIE | \
68 CCSR_SSI_SIER_ROE0_EN | CCSR_SSI_SIER_ROE1_EN)
69
63/** 70/**
64 * fsl_ssi_private: per-SSI private data 71 * fsl_ssi_private: per-SSI private data
65 * 72 *
@@ -140,7 +147,7 @@ static irqreturn_t fsl_ssi_isr(int irq, void *dev_id)
140 were interrupted for. We mask it with the Interrupt Enable register 147 were interrupted for. We mask it with the Interrupt Enable register
141 so that we only check for events that we're interested in. 148 so that we only check for events that we're interested in.
142 */ 149 */
143 sisr = in_be32(&ssi->sisr) & in_be32(&ssi->sier); 150 sisr = in_be32(&ssi->sisr) & SIER_FLAGS;
144 151
145 if (sisr & CCSR_SSI_SISR_RFRC) { 152 if (sisr & CCSR_SSI_SISR_RFRC) {
146 ssi_private->stats.rfrc++; 153 ssi_private->stats.rfrc++;
@@ -324,12 +331,7 @@ static int fsl_ssi_startup(struct snd_pcm_substream *substream,
324 */ 331 */
325 332
326 /* 4. Enable the interrupts and DMA requests */ 333 /* 4. Enable the interrupts and DMA requests */
327 out_be32(&ssi->sier, 334 out_be32(&ssi->sier, SIER_FLAGS);
328 CCSR_SSI_SIER_TFRC_EN | CCSR_SSI_SIER_TDMAE |
329 CCSR_SSI_SIER_TIE | CCSR_SSI_SIER_TUE0_EN |
330 CCSR_SSI_SIER_TUE1_EN | CCSR_SSI_SIER_RFRC_EN |
331 CCSR_SSI_SIER_RDMAE | CCSR_SSI_SIER_RIE |
332 CCSR_SSI_SIER_ROE0_EN | CCSR_SSI_SIER_ROE1_EN);
333 335
334 /* 336 /*
335 * Set the watermark for transmit FIFI 0 and receive FIFO 0. We 337 * Set the watermark for transmit FIFI 0 and receive FIFO 0. We
@@ -590,39 +592,52 @@ static struct snd_soc_dai fsl_ssi_dai_template = {
590 .ops = &fsl_ssi_dai_ops, 592 .ops = &fsl_ssi_dai_ops,
591}; 593};
592 594
595/* Show the statistics of a flag only if its interrupt is enabled. The
596 * compiler will optimze this code to a no-op if the interrupt is not
597 * enabled.
598 */
599#define SIER_SHOW(flag, name) \
600 do { \
601 if (SIER_FLAGS & CCSR_SSI_SIER_##flag) \
602 length += sprintf(buf + length, #name "=%u\n", \
603 ssi_private->stats.name); \
604 } while (0)
605
606
593/** 607/**
594 * fsl_sysfs_ssi_show: display SSI statistics 608 * fsl_sysfs_ssi_show: display SSI statistics
595 * 609 *
596 * Display the statistics for the current SSI device. 610 * Display the statistics for the current SSI device. To avoid confusion,
611 * we only show those counts that are enabled.
597 */ 612 */
598static ssize_t fsl_sysfs_ssi_show(struct device *dev, 613static ssize_t fsl_sysfs_ssi_show(struct device *dev,
599 struct device_attribute *attr, char *buf) 614 struct device_attribute *attr, char *buf)
600{ 615{
601 struct fsl_ssi_private *ssi_private = 616 struct fsl_ssi_private *ssi_private =
602 container_of(attr, struct fsl_ssi_private, dev_attr); 617 container_of(attr, struct fsl_ssi_private, dev_attr);
603 ssize_t length; 618 ssize_t length = 0;
604 619
605 length = sprintf(buf, "rfrc=%u", ssi_private->stats.rfrc); 620 SIER_SHOW(RFRC_EN, rfrc);
606 length += sprintf(buf + length, "\ttfrc=%u", ssi_private->stats.tfrc); 621 SIER_SHOW(TFRC_EN, tfrc);
607 length += sprintf(buf + length, "\tcmdau=%u", ssi_private->stats.cmdau); 622 SIER_SHOW(CMDAU_EN, cmdau);
608 length += sprintf(buf + length, "\tcmddu=%u", ssi_private->stats.cmddu); 623 SIER_SHOW(CMDDU_EN, cmddu);
609 length += sprintf(buf + length, "\trxt=%u", ssi_private->stats.rxt); 624 SIER_SHOW(RXT_EN, rxt);
610 length += sprintf(buf + length, "\trdr1=%u", ssi_private->stats.rdr1); 625 SIER_SHOW(RDR1_EN, rdr1);
611 length += sprintf(buf + length, "\trdr0=%u", ssi_private->stats.rdr0); 626 SIER_SHOW(RDR0_EN, rdr0);
612 length += sprintf(buf + length, "\ttde1=%u", ssi_private->stats.tde1); 627 SIER_SHOW(TDE1_EN, tde1);
613 length += sprintf(buf + length, "\ttde0=%u", ssi_private->stats.tde0); 628 SIER_SHOW(TDE0_EN, tde0);
614 length += sprintf(buf + length, "\troe1=%u", ssi_private->stats.roe1); 629 SIER_SHOW(ROE1_EN, roe1);
615 length += sprintf(buf + length, "\troe0=%u", ssi_private->stats.roe0); 630 SIER_SHOW(ROE0_EN, roe0);
616 length += sprintf(buf + length, "\ttue1=%u", ssi_private->stats.tue1); 631 SIER_SHOW(TUE1_EN, tue1);
617 length += sprintf(buf + length, "\ttue0=%u", ssi_private->stats.tue0); 632 SIER_SHOW(TUE0_EN, tue0);
618 length += sprintf(buf + length, "\ttfs=%u", ssi_private->stats.tfs); 633 SIER_SHOW(TFS_EN, tfs);
619 length += sprintf(buf + length, "\trfs=%u", ssi_private->stats.rfs); 634 SIER_SHOW(RFS_EN, rfs);
620 length += sprintf(buf + length, "\ttls=%u", ssi_private->stats.tls); 635 SIER_SHOW(TLS_EN, tls);
621 length += sprintf(buf + length, "\trls=%u", ssi_private->stats.rls); 636 SIER_SHOW(RLS_EN, rls);
622 length += sprintf(buf + length, "\trff1=%u", ssi_private->stats.rff1); 637 SIER_SHOW(RFF1_EN, rff1);
623 length += sprintf(buf + length, "\trff0=%u", ssi_private->stats.rff0); 638 SIER_SHOW(RFF0_EN, rff0);
624 length += sprintf(buf + length, "\ttfe1=%u", ssi_private->stats.tfe1); 639 SIER_SHOW(TFE1_EN, tfe1);
625 length += sprintf(buf + length, "\ttfe0=%u\n", ssi_private->stats.tfe0); 640 SIER_SHOW(TFE0_EN, tfe0);
626 641
627 return length; 642 return length;
628} 643}