summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorVinod G <vinodg@nvidia.com>2011-03-14 16:46:27 -0700
committerDan Willemsen <dwillemsen@nvidia.com>2011-04-26 15:53:47 -0700
commit74f6c9935950d14539985734204f6160f28e5065 (patch)
treefdce5714480b5a2aab55eddf5e662e5b8833bf55 /sound
parent5b948c30862e35cea291bb1c01ead66e2487c618 (diff)
arm: tegra: Correct the fifo attetion level
Adding the infrastructure to set the fifo attention level based on the buffersize as the dma code is using the same for setting the dma burst size. Original-Change-Id: I54bf673d032ebf6edd534fb6a2e946db0db07402 Reviewed-on: http://git-master/r/22897 Reviewed-by: Vinod Gopalakrishnakurup <vinodg@nvidia.com> Tested-by: Vinod Gopalakrishnakurup <vinodg@nvidia.com> Reviewed-by: Scott Peterson <speterson@nvidia.com> Change-Id: I3172582aa60978f4320e274fa9c9f9e765b0d947
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/tegra/tegra_i2s.c28
-rw-r--r--sound/soc/tegra/tegra_pcm.c2
-rw-r--r--sound/soc/tegra/tegra_soc.h2
3 files changed, 32 insertions, 0 deletions
diff --git a/sound/soc/tegra/tegra_i2s.c b/sound/soc/tegra/tegra_i2s.c
index 5c2d5b40a10e..bc3da49020dc 100644
--- a/sound/soc/tegra/tegra_i2s.c
+++ b/sound/soc/tegra/tegra_i2s.c
@@ -37,6 +37,8 @@ struct tegra_i2s_info {
unsigned int bit_format;
bool i2s_master;
int ref_count;
+ int fifo_tx_attn;
+ int fifo_rx_attn;
struct i2s_runtime_data i2s_regs;
struct das_regs_cache das_regs;
};
@@ -81,10 +83,34 @@ void setup_i2s_dma_request(struct snd_pcm_substream *substream,
return;
}
+void set_fifo_attention(struct snd_pcm_substream *substream,
+ int buffersize)
+{
+ struct snd_soc_pcm_runtime *rtd = substream->private_data;
+ struct snd_soc_dai *cpu_dai = rtd->dai->cpu_dai;
+ struct tegra_i2s_info *info = cpu_dai->private_data;
+ int fifoattn = I2S_FIFO_ATN_LVL_FOUR_SLOTS;
+
+#if !defined(CONFIG_ARCH_TEGRA_2x_SOC)
+ if (buffersize & 0xF)
+ fifoattn = I2S_FIFO_ATN_LVL_ONE_SLOT;
+ else if ((buffersize >> 4) & 0x1)
+ fifoattn = I2S_FIFO_ATN_LVL_FOUR_SLOTS;
+ else
+ fifoattn = I2S_FIFO_ATN_LVL_EIGHT_SLOTS;
+#endif
+
+ if (substream->stream == SNDRV_PCM_STREAM_PLAYBACK)
+ info->fifo_tx_attn = fifoattn;
+ else
+ info->fifo_rx_attn = fifoattn;
+}
/* playback */
static inline void start_i2s_playback(struct snd_soc_dai *cpu_dai)
{
+// struct tegra_i2s_info *info = cpu_dai->private_data;
+
i2s_fifo_set_attention_level(cpu_dai->id, I2S_FIFO_TX,
I2S_FIFO_ATN_LVL_FOUR_SLOTS);
i2s_fifo_enable(cpu_dai->id, I2S_FIFO_TX, 1);
@@ -101,6 +127,8 @@ static inline void stop_i2s_playback(struct snd_soc_dai *cpu_dai)
/* recording */
static inline void start_i2s_capture(struct snd_soc_dai *cpu_dai)
{
+// struct tegra_i2s_info *info = cpu_dai->private_data;
+
i2s_fifo_set_attention_level(cpu_dai->id, I2S_FIFO_RX,
I2S_FIFO_ATN_LVL_FOUR_SLOTS);
i2s_fifo_enable(cpu_dai->id, I2S_FIFO_RX, 1);
diff --git a/sound/soc/tegra/tegra_pcm.c b/sound/soc/tegra/tegra_pcm.c
index f42e981f4ca7..3c1abacf2165 100644
--- a/sound/soc/tegra/tegra_pcm.c
+++ b/sound/soc/tegra/tegra_pcm.c
@@ -58,6 +58,7 @@ static void tegra_pcm_capture(struct tegra_runtime_data *prtd)
if (runtime->dma_addr) {
prtd->size = frames_to_bytes(runtime, runtime->period_size);
+
if (prtd->dma_state != STATE_ABORT) {
prtd->dma_reqid_tail = (prtd->dma_reqid_tail + 1) % DMA_REQ_QCOUNT;
prtd->dma_req[prtd->dma_reqid_tail].dest_addr = buf->addr +
@@ -115,6 +116,7 @@ static int tegra_pcm_hw_params(struct snd_pcm_substream *substream,
struct snd_pcm_hw_params *params)
{
snd_pcm_set_runtime_buffer(substream, &substream->dma_buffer);
+ set_fifo_attention(substream, params_period_bytes(params));
return 0;
}
diff --git a/sound/soc/tegra/tegra_soc.h b/sound/soc/tegra/tegra_soc.h
index cf878f6a77aa..05c9e18ccb43 100644
--- a/sound/soc/tegra/tegra_soc.h
+++ b/sound/soc/tegra/tegra_soc.h
@@ -145,6 +145,8 @@ void setup_dma_request(struct snd_pcm_substream *substream,
struct tegra_dma_req *req,
void (*dma_callback)(struct tegra_dma_req *req),
void *dma_data);
+void set_fifo_attention(struct snd_pcm_substream *substream,
+ int buffersize);
void tegra_switch_set_state(int state);