aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastien Guiriec <s-guiriec@ti.com>2011-09-14 08:18:50 +0200
committerSimon Wilson <simonwilson@google.com>2011-10-11 17:55:44 -0700
commite2e4c142bcf8ac457ac636b5ab74866829a31914 (patch)
treea2f8201c604c4bf679760a99947c76b36afdec73
parentc71e41ef0b3d74b96edd1f29679bae786dbbb9ea (diff)
downloadkernel_samsung_tuna-e2e4c142bcf8ac457ac636b5ab74866829a31914.zip
kernel_samsung_tuna-e2e4c142bcf8ac457ac636b5ab74866829a31914.tar.gz
kernel_samsung_tuna-e2e4c142bcf8ac457ac636b5ab74866829a31914.tar.bz2
ASoC: OMAP ABE: Update ping/pong mode to support 4 buffers.
Current ping/pong mode is supporting only 2 buffers. We can extend the number of buffer to 4 in order to fit with current Audio HAL. This will enable the selection of Ping/pong instead of CBPr and lead to longer time between the different OMAP L3 wake up. Remove duplication of structure definition until rework of ABE code. Change-Id: I2037f50bf46b530f6d22c8306db9f44d9c2856e4 Signed-off-by: Sebastien Guiriec <s-guiriec@ti.com>
-rw-r--r--sound/soc/omap/abe/abe.h18
-rw-r--r--sound/soc/omap/abe/abe_api.h20
-rw-r--r--sound/soc/omap/abe/abe_core.c47
-rw-r--r--sound/soc/omap/abe/abe_dbg.h25
-rw-r--r--sound/soc/omap/abe/abe_irq.c6
-rw-r--r--sound/soc/omap/omap-abe-dsp.c6
6 files changed, 62 insertions, 60 deletions
diff --git a/sound/soc/omap/abe/abe.h b/sound/soc/omap/abe/abe.h
index c465764..103a57c 100644
--- a/sound/soc/omap/abe/abe.h
+++ b/sound/soc/omap/abe/abe.h
@@ -107,24 +107,6 @@ struct omap_abe_equ {
s32 equ_param3;
};
-struct omap_abe {
- void __iomem *io_base[5];
- u32 firmware_version_number;
- u16 MultiFrame[PROCESSING_SLOTS][TASKS_IN_SLOT];
- u32 compensated_mixer_gain;
- u8 muted_gains_indicator[MAX_NBGAIN_CMEM];
- u32 desired_gains_decibel[MAX_NBGAIN_CMEM];
- u32 muted_gains_decibel[MAX_NBGAIN_CMEM];
- u32 desired_gains_linear[MAX_NBGAIN_CMEM];
- u32 desired_ramp_delay_ms[MAX_NBGAIN_CMEM];
- struct mutex mutex;
- u32 warm_boot;
-
- u32 irq_dbg_read_ptr;
-
- struct omap_abe_dbg dbg;
-};
-
extern struct omap_abe *abe;
void omap_abe_dbg_log(struct omap_abe *abe, u32 x, u32 y, u32 z, u32 t);
diff --git a/sound/soc/omap/abe/abe_api.h b/sound/soc/omap/abe/abe_api.h
index 15e8408..a24ec96 100644
--- a/sound/soc/omap/abe/abe_api.h
+++ b/sound/soc/omap/abe/abe_api.h
@@ -93,26 +93,6 @@
#define TASK_ASRC_BT_DL_SLT 18
#define TASK_ASRC_BT_DL_IDX 6
-
-struct omap_abe {
- void __iomem *io_base[5];
- u32 firmware_version_number;
- u16 MultiFrame[PROCESSING_SLOTS][TASKS_IN_SLOT];
- u32 compensated_mixer_gain;
- u8 muted_gains_indicator[MAX_NBGAIN_CMEM];
- u32 desired_gains_decibel[MAX_NBGAIN_CMEM];
- u32 muted_gains_decibel[MAX_NBGAIN_CMEM];
- u32 desired_gains_linear[MAX_NBGAIN_CMEM];
- u32 desired_ramp_delay_ms[MAX_NBGAIN_CMEM];
- struct mutex mutex;
- u32 warm_boot;
-
- u32 irq_dbg_read_ptr;
- u32 dbg_param;
-
- struct omap_abe_dbg dbg;
-};
-
/**
* abe_reset_hal - reset the ABE/HAL
* @rdev: regulator source
diff --git a/sound/soc/omap/abe/abe_core.c b/sound/soc/omap/abe/abe_core.c
index 1532039..7a9ae11 100644
--- a/sound/soc/omap/abe/abe_core.c
+++ b/sound/soc/omap/abe/abe_core.c
@@ -254,6 +254,10 @@ int omap_abe_set_ping_pong_buffer(struct omap_abe *abe, u32 port, u32 n_bytes)
(u32) &(desc_pp);
base_and_size = desc_pp.nextbuff1_BaseAddr;
}
+
+ base_and_size = abe->pp_buf_addr[abe->pp_buf_id_next];
+ abe->pp_buf_id_next = (abe->pp_buf_id_next + 1) & 0x03;
+
base_and_size = (base_and_size & 0xFFFFL) + (n_samples << 16);
sio_pp_desc_address = OMAP_ABE_D_PINGPONGDESC_ADDR + struct_offset;
src = &base_and_size;
@@ -334,6 +338,13 @@ int omap_abe_init_ping_pong_buffer(struct omap_abe *abe,
/* base addresses of the ping pong buffers in U8 unit */
abe_base_address_pingpong[i] = dmem_addr;
}
+
+ for (i = 0; i < 4; i++)
+ abe->pp_buf_addr[i] = OMAP_ABE_D_PING_ADDR + (i * size_bytes);
+ abe->pp_buf_id = 0;
+ abe->pp_buf_id_next = 0;
+ abe->pp_first_irq = 1;
+
/* global data */
abe_size_pingpong = size_bytes;
*p = (u32) OMAP_ABE_D_PING_ADDR;
@@ -371,30 +382,28 @@ int omap_abe_read_offset_from_ping_buffer(struct omap_abe *abe,
the value of the counter */
if ((desc_pp.counter & 0x1) == 0) {
/* the next is buffer0, hence the current is buffer1 */
- switch (abe_port[OMAP_ABE_MM_DL_PORT].format.samp_format) {
- case MONO_MSB:
- case MONO_RSHIFTED_16:
- case STEREO_16_16:
- *n = abe_size_pingpong / 4 +
- desc_pp.nextbuff1_Samples -
- desc_pp.workbuff_Samples;
- break;
- case STEREO_MSB:
- case STEREO_RSHIFTED_16:
- *n = abe_size_pingpong / 8 +
- desc_pp.nextbuff1_Samples -
- desc_pp.workbuff_Samples;
- break;
- default:
- omap_abe_dbg_error(abe, OMAP_ABE_ERR_API,
- ABE_PARAMETER_ERROR);
- break;
- }
+ *n = desc_pp.nextbuff1_Samples -
+ desc_pp.workbuff_Samples;
} else {
/* the next is buffer1, hence the current is buffer0 */
*n = desc_pp.nextbuff0_Samples -
desc_pp.workbuff_Samples;
}
+ switch (abe_port[OMAP_ABE_MM_DL_PORT].format.samp_format) {
+ case MONO_MSB:
+ case MONO_RSHIFTED_16:
+ case STEREO_16_16:
+ *n += abe->pp_buf_id * abe_size_pingpong / 4;
+ break;
+ case STEREO_MSB:
+ case STEREO_RSHIFTED_16:
+ *n += abe->pp_buf_id * abe_size_pingpong / 8;
+ break;
+ default:
+ omap_abe_dbg_error(abe, OMAP_ABE_ERR_API,
+ ABE_PARAMETER_ERROR);
+ return -EINVAL;
+ }
}
return 0;
diff --git a/sound/soc/omap/abe/abe_dbg.h b/sound/soc/omap/abe/abe_dbg.h
index 2cdced9..8639806 100644
--- a/sound/soc/omap/abe/abe_dbg.h
+++ b/sound/soc/omap/abe/abe_dbg.h
@@ -59,6 +59,8 @@
#ifndef _ABE_DBG_H_
#define _ABE_DBG_H_
+#include <linux/mutex.h>
+
#include "abe_typ.h"
#include "abe_dm_addr.h"
@@ -194,6 +196,29 @@ struct omap_abe_dma {
u32 iter;
};
+struct omap_abe {
+ void __iomem *io_base[5];
+ u32 firmware_version_number;
+ u16 MultiFrame[25][8];
+ u32 compensated_mixer_gain;
+ u8 muted_gains_indicator[MAX_NBGAIN_CMEM];
+ u32 desired_gains_decibel[MAX_NBGAIN_CMEM];
+ u32 muted_gains_decibel[MAX_NBGAIN_CMEM];
+ u32 desired_gains_linear[MAX_NBGAIN_CMEM];
+ u32 desired_ramp_delay_ms[MAX_NBGAIN_CMEM];
+ int pp_buf_id;
+ int pp_buf_id_next;
+ int pp_buf_addr[4];
+ int pp_first_irq;
+ struct mutex mutex;
+ u32 warm_boot;
+
+ u32 irq_dbg_read_ptr;
+ u32 dbg_param;
+
+ struct omap_abe_dbg dbg;
+};
+
/**
* omap_abe_dbg_reset
* @dbg: Pointer on abe debug handle
diff --git a/sound/soc/omap/abe/abe_irq.c b/sound/soc/omap/abe/abe_irq.c
index d639894..7749d46 100644
--- a/sound/soc/omap/abe/abe_irq.c
+++ b/sound/soc/omap/abe/abe_irq.c
@@ -81,6 +81,12 @@ extern u32 abe_irq_pingpong_player_id;
*/
void abe_irq_ping_pong(void)
{
+ /* first IRQ doesn't represent a buffer transference completion */
+ if (abe->pp_first_irq)
+ abe->pp_first_irq = 0;
+ else
+ abe->pp_buf_id = (abe->pp_buf_id + 1) & 0x03;
+
abe_call_subroutine(abe_irq_pingpong_player_id, NOPARAMETER,
NOPARAMETER, NOPARAMETER, NOPARAMETER);
}
diff --git a/sound/soc/omap/omap-abe-dsp.c b/sound/soc/omap/omap-abe-dsp.c
index 04e0f4c..80ec069 100644
--- a/sound/soc/omap/omap-abe-dsp.c
+++ b/sound/soc/omap/omap-abe-dsp.c
@@ -1865,8 +1865,8 @@ static const struct snd_pcm_hardware omap_abe_hardware = {
SNDRV_PCM_FMTBIT_S32_LE,
.period_bytes_min = 4 * 1024,
.period_bytes_max = 24 * 1024,
- .periods_min = 2,
- .periods_max = 2,
+ .periods_min = 4,
+ .periods_max = 4,
.buffer_bytes_max = 24 * 1024 * 2,
};
@@ -2257,7 +2257,7 @@ static int aess_hw_params(struct snd_pcm_substream *substream,
/* Memory mapping for hw params */
runtime->dma_area = abe->io_base[0] + dst;
runtime->dma_addr = 0;
- runtime->dma_bytes = period_size * 2;
+ runtime->dma_bytes = period_size * 4;
/* Need to set the first buffer in order to get interrupt */
abe_set_ping_pong_buffer(MM_DL_PORT, period_size);