alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Peter Ujfalusi <peter.ujfalusi@nokia.com>
To: alsa-devel@alsa-project.org
Cc: tiwai@suse.de, broonie@opensource.wolfsonmicro.com, lrg@slimlogic.co.uk
Subject: [RFC 3/4] OMAP3: McBSP: Add interface for transmit FIFO state query
Date: Tue,  2 Mar 2010 15:39:50 +0200	[thread overview]
Message-ID: <1267537191-25254-4-git-send-email-peter.ujfalusi@nokia.com> (raw)
In-Reply-To: <1267537191-25254-1-git-send-email-peter.ujfalusi@nokia.com>

New function for reading the XBUFFSTAT register, which holds
the fill state of the transmit buffer on McBSP.

Signed-off-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
---
 arch/arm/plat-omap/include/plat/mcbsp.h |    4 ++++
 arch/arm/plat-omap/mcbsp.c              |   27 +++++++++++++++++++++++++++
 2 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/arch/arm/plat-omap/include/plat/mcbsp.h b/arch/arm/plat-omap/include/plat/mcbsp.h
index 4f22e5b..98de3d4 100644
--- a/arch/arm/plat-omap/include/plat/mcbsp.h
+++ b/arch/arm/plat-omap/include/plat/mcbsp.h
@@ -147,6 +147,8 @@
 #define OMAP_MCBSP_REG_WAKEUPEN	0xA8
 #define OMAP_MCBSP_REG_XCCR	0xAC
 #define OMAP_MCBSP_REG_RCCR	0xB0
+#define OMAP_MCBSP_REG_XBUFFSTAT	0xB4
+#define OMAP_MCBSP_REG_RBUFFSTAT	0xB8
 
 #define AUDIO_MCBSP_DATAWRITE	(OMAP24XX_MCBSP2_BASE + OMAP_MCBSP_REG_DXR1)
 #define AUDIO_MCBSP_DATAREAD	(OMAP24XX_MCBSP2_BASE + OMAP_MCBSP_REG_DRR1)
@@ -428,6 +430,7 @@ void omap_mcbsp_set_tx_threshold(unsigned int id, u16 threshold);
 void omap_mcbsp_set_rx_threshold(unsigned int id, u16 threshold);
 u16 omap_mcbsp_get_max_tx_threshold(unsigned int id);
 u16 omap_mcbsp_get_max_rx_threshold(unsigned int id);
+u16 omap_mcbsp_get_tx_buffstat(unsigned int id);
 int omap_mcbsp_get_dma_op_mode(unsigned int id);
 #else
 static inline void omap_mcbsp_set_tx_threshold(unsigned int id, u16 threshold)
@@ -436,6 +439,7 @@ static inline void omap_mcbsp_set_rx_threshold(unsigned int id, u16 threshold)
 { }
 static inline u16 omap_mcbsp_get_max_tx_threshold(unsigned int id) { return 0; }
 static inline u16 omap_mcbsp_get_max_rx_threshold(unsigned int id) { return 0; }
+static inline u16 omap_mcbsp_get_tx_buffstat(unsigned int id) { return 0; }
 static inline int omap_mcbsp_get_dma_op_mode(unsigned int id) { return 0; }
 #endif
 int omap_mcbsp_request(unsigned int id);
diff --git a/arch/arm/plat-omap/mcbsp.c b/arch/arm/plat-omap/mcbsp.c
index f757672..e49af86 100644
--- a/arch/arm/plat-omap/mcbsp.c
+++ b/arch/arm/plat-omap/mcbsp.c
@@ -284,6 +284,33 @@ u16 omap_mcbsp_get_max_rx_threshold(unsigned int id)
 EXPORT_SYMBOL(omap_mcbsp_get_max_rx_threshold);
 
 /*
+ * omap_mcbsp_get_tx_buffstat returns the number of used slots in the McBSP FIFO
+ */
+u16 omap_mcbsp_get_tx_buffstat(unsigned int id)
+{
+	struct omap_mcbsp *mcbsp;
+	u16 buffstat;
+
+	if (!omap_mcbsp_check_valid_id(id)) {
+		printk(KERN_ERR "%s: Invalid id (%d)\n", __func__, id + 1);
+		return -ENODEV;
+	}
+	mcbsp = id_to_mcbsp_ptr(id);
+
+	/* Returns the number of free locations in the buffer */
+	buffstat = OMAP_MCBSP_READ(mcbsp->io_base, XBUFFSTAT);
+
+	/* Number of free slots on McBSP ports */
+	if (mcbsp->id == 2)
+		buffstat = 0x500 - buffstat;
+	else
+		buffstat = 0x80 - buffstat;
+
+	return buffstat;
+}
+EXPORT_SYMBOL(omap_mcbsp_get_tx_buffstat);
+
+/*
  * omap_mcbsp_get_dma_op_mode just return the current configured
  * operating mode for the mcbsp channel
  */
-- 
1.7.0

  parent reply	other threads:[~2010-03-02 13:39 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-02 13:39 [RFC 0/4] FIFO caused playback delay (latency) handling in soc Peter Ujfalusi
2010-03-02 13:39 ` [RFC 1/4] ASoC: core: soc level wrapper for pcm_pointer callback Peter Ujfalusi
2010-03-02 13:39 ` [RFC 2/4] ASoC: core: Add delay operation to snd_soc_dai_ops Peter Ujfalusi
2010-03-02 13:45   ` Mark Brown
2010-03-02 13:49     ` Peter Ujfalusi
2010-03-02 13:54       ` Mark Brown
2010-03-02 13:39 ` Peter Ujfalusi [this message]
2010-03-02 13:45   ` [RFC 3/4] OMAP3: McBSP: Add interface for transmit FIFO state query Mark Brown
2010-03-02 13:52   ` Eero Nurkkala
2010-03-02 13:58     ` Liam Girdwood
2010-03-02 14:02     ` Peter Ujfalusi
2010-03-02 14:06     ` Jarkko Nikula
2010-03-03  6:07       ` Eero Nurkkala
2010-03-03  7:03         ` Jarkko Nikula
2010-03-03 10:02           ` Peter Ujfalusi
2010-03-03 10:07             ` Peter Ujfalusi
2010-03-03 14:18             ` Jarkko Nikula
2010-03-03 15:01               ` Peter Ujfalusi
2010-03-04  7:30                 ` Peter Ujfalusi
2010-03-03 19:00             ` ext-Eero.Nurkkala
2010-03-03 19:07               ` ext-Eero.Nurkkala
2010-03-04  7:53                 ` Peter Ujfalusi
2010-03-04  8:09               ` Peter Ujfalusi
2010-03-04  8:46                 ` Eero Nurkkala
2010-03-02 13:39 ` [RFC 4/4] ASoC: OMAP3: Report delay on playback caused by the internal FIFO Peter Ujfalusi
2010-03-02 13:47   ` Mark Brown
2010-03-02 13:52     ` Peter Ujfalusi
2010-03-02 14:06       ` Mark Brown
2010-03-02 13:53 ` [RFC 0/4] FIFO caused playback delay (latency) handling in soc Mark Brown
2010-03-02 23:29 ` Raymond Yau
2010-03-03 10:03   ` Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1267537191-25254-4-git-send-email-peter.ujfalusi@nokia.com \
    --to=peter.ujfalusi@nokia.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=lrg@slimlogic.co.uk \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).