summaryrefslogtreecommitdiff
path: root/sound
diff options
context:
space:
mode:
authorRavindra Lokhande <rlokhande@nvidia.com>2014-03-18 16:49:34 +0530
committerSachin Nikam <snikam@nvidia.com>2014-03-19 02:11:31 -0700
commitb3f2da517cfdd7446f306417f3e9ee910cbd266e (patch)
tree161a9f11a5689546d741ea54c808ffa83afc4b22 /sound
parent854f451d0775b82204eed3d0e7d05aeb256a7be4 (diff)
ASoC: Tegra: Modify compress/pcm offload callback
Change compress/pcm offload callback to support eos as argument. This argument will be used to convey end of stream information. Bug 1399922 Change-Id: I6fe4638f4aaed7d779a14e799d0b11b62704cd31 Signed-off-by: Ravindra Lokhande <rlokhande@nvidia.com> Reviewed-on: http://git-master/r/383064 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Chandrakanth Gorantla <cgorantla@nvidia.com> Reviewed-by: Sumit Bhattacharya <sumitb@nvidia.com>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/tegra/tegra30_avp.c17
-rw-r--r--sound/soc/tegra/tegra_offload.c9
-rw-r--r--sound/soc/tegra/tegra_offload.h8
3 files changed, 24 insertions, 10 deletions
diff --git a/sound/soc/tegra/tegra30_avp.c b/sound/soc/tegra/tegra30_avp.c
index 012ef284ee18..6416a866ba04 100644
--- a/sound/soc/tegra/tegra30_avp.c
+++ b/sound/soc/tegra/tegra30_avp.c
@@ -123,8 +123,9 @@ struct tegra30_avp_stream {
unsigned int notification_received;
unsigned int source_buffer_offset;
- void (*notify_cb)(void *args);
- void *notify_args;
+ void (*notify_cb)(void *args, unsigned int is_eos);
+ void *notify_args;
+ unsigned int is_drain_called;
};
struct tegra30_avp_audio {
@@ -649,6 +650,7 @@ static void tegra30_avp_stream_notify(void)
struct tegra30_avp_stream *avp_stream;
struct stream_data *stream;
int i;
+ unsigned int eos = 0;
/* dev_vdbg(audio_avp->dev, "tegra30_avp_stream_notify"); */
@@ -670,7 +672,13 @@ static void tegra30_avp_stream_notify(void)
avp_stream->notification_received++;
while (data_processed >= avp_stream->period_size) {
- avp_stream->notify_cb(avp_stream->notify_args);
+ if ((avp_stream->notification_received >=
+ stream->stream_notification_request)
+ && avp_stream->is_drain_called) {
+ eos = 1;
+ }
+ avp_stream->notify_cb(avp_stream->notify_args,
+ eos);
avp_stream->last_notification_offset +=
avp_stream->period_size;
avp_stream->last_notification_offset %=
@@ -904,6 +912,7 @@ static int tegra30_avp_compr_open(int *id)
dev_err(audio_avp->dev, "All AVP COMPR streams are busy");
return -EBUSY;
}
+ audio_avp->avp_stream[*id].is_drain_called = 0;
tegra30_avp_audio_set_state(KSSTATE_RUN);
return 0;
}
@@ -1027,6 +1036,7 @@ static int tegra30_avp_compr_set_params(int id,
static int tegra30_avp_compr_set_state(int id, int state)
{
struct tegra30_avp_audio *audio_avp = avp_audio_ctx;
+ struct tegra30_avp_stream *avp_stream = &audio_avp->avp_stream[id];
dev_vdbg(audio_avp->dev, "%s : id %d state %d",
__func__, id, state);
@@ -1048,6 +1058,7 @@ static int tegra30_avp_compr_set_state(int id, int state)
return 0;
case SND_COMPR_TRIGGER_DRAIN:
/* TODO */
+ avp_stream->is_drain_called = 1;
return 0;
default:
dev_err(audio_avp->dev, "Unsupported state.");
diff --git a/sound/soc/tegra/tegra_offload.c b/sound/soc/tegra/tegra_offload.c
index e18e30ac8f63..465d28f8a961 100644
--- a/sound/soc/tegra/tegra_offload.c
+++ b/sound/soc/tegra/tegra_offload.c
@@ -96,12 +96,15 @@ int tegra_register_offload_ops(struct tegra_offload_ops *ops)
EXPORT_SYMBOL_GPL(tegra_register_offload_ops);
/* Compress playback related APIs */
-static void tegra_offload_compr_fragment_elapsed(void *arg)
+static void tegra_offload_compr_fragment_elapsed(void *arg, unsigned int is_eos)
{
struct snd_compr_stream *stream = arg;
- if (stream)
+ if (stream) {
snd_compr_fragment_elapsed(stream);
+ if (is_eos)
+ snd_compr_drain_notify(stream);
+ }
}
static int tegra_offload_compr_open(struct snd_compr_stream *stream)
@@ -303,7 +306,7 @@ static struct snd_compr_ops tegra_compr_ops = {
};
/* PCM playback related APIs */
-static void tegra_offload_pcm_period_elapsed(void *arg)
+static void tegra_offload_pcm_period_elapsed(void *arg, unsigned int is_eos)
{
struct snd_pcm_substream *substream = arg;
diff --git a/sound/soc/tegra/tegra_offload.h b/sound/soc/tegra/tegra_offload.h
index b0e1fb2e2a48..6a1d0cf1cb56 100644
--- a/sound/soc/tegra/tegra_offload.h
+++ b/sound/soc/tegra/tegra_offload.h
@@ -39,8 +39,8 @@ struct tegra_offload_pcm_params {
int period_size; /* bytes */
struct tegra_offload_mem source_buf;
struct tegra_offload_dma_params dma_params;
- void (*period_elapsed_cb)(void *args);
- void *period_elapsed_args;
+ void (*period_elapsed_cb)(void *args, unsigned int is_eos);
+ void *period_elapsed_args;
};
struct tegra_offload_compr_params {
@@ -51,8 +51,8 @@ struct tegra_offload_compr_params {
int fragment_size; /* bytes */
int fragments;
struct tegra_offload_dma_params dma_params;
- void (*fragments_elapsed_cb)(void *args);
- void *fragments_elapsed_args;
+ void (*fragments_elapsed_cb)(void *args, unsigned int is_eos);
+ void *fragments_elapsed_args;
};
struct tegra_offload_pcm_ops {