summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSumit Bhattacharya <sumitb@nvidia.com>2014-01-31 10:02:50 +0530
committerBharat Nihalani <bnihalani@nvidia.com>2014-03-12 01:24:31 -0700
commit0adcfe1763f1f56563fe260ad7190b3c915643d4 (patch)
tree3f14c76784d8a40ee51b58894b9aad7041a10874
parent0670c42e535ba0a7a681fbd2f5a5bd24fae02aa4 (diff)
audio: Add shared interface between AVP and kernel
Add tegra_avp_audio.h which is shared interface between AVP and kernel side avp audio driver. Bug 1399922 Change-Id: I7ab59678f35812174cd5d333c70d0ef7a865aed9 Signed-off-by: Sumit Bhattacharya <sumitb@nvidia.com> Reviewed-on: http://git-master/r/362245 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: Ravindra Lokhande <rlokhande@nvidia.com> Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>
-rw-r--r--include/linux/tegra_avp_audio.h171
1 files changed, 171 insertions, 0 deletions
diff --git a/include/linux/tegra_avp_audio.h b/include/linux/tegra_avp_audio.h
new file mode 100644
index 000000000000..da812d07282f
--- /dev/null
+++ b/include/linux/tegra_avp_audio.h
@@ -0,0 +1,171 @@
+/*
+ * tegra_avp_audio.h - Shared interface between AVP and kernel audio avp driver
+ *
+ * Copyright (c) 2013-2014, NVIDIA CORPORATION. All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * version 2 as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ */
+
+#ifndef _TEGRA_AVP_AUDIO_H
+#define _TEGRA_AVP_AUDIO_H
+
+#define USE_IRAM_DEVICE_BUFFER 1
+
+/* Runtime profiling options */
+#define PROFILE_RENDER_PROCESSING 0x00000001
+#define PROFILE_RENDER_OVERALL_PROCESSING \
+ (0x00000002 | PROFILE_RENDER_PROCESSING)
+#define PROFILE_RENDER_MEMORY 0x00000004
+
+#define DEVICE_BUFFER_SIZE (0x1000)
+
+#define RENDERSW_MAX_LOOPBACK_STREAMS 1
+#define RENDERSW_MAX_RENDER_STREAMS 4
+#define RENDERSW_MAX_STREAMS \
+ (RENDERSW_MAX_LOOPBACK_STREAMS + RENDERSW_MAX_RENDER_STREAMS)
+#define RENDERSW_MAX_CHANNELS 2
+
+#define AAC_PAYLOAD_RAW 0
+#define AAC_PAYLOAD_ADTS 1
+#define AAC_PAYLOAD_ADIF 2
+#define AAC_PAYLOAD_LOAS 3
+
+enum KSSTATE {
+ KSSTATE_STOP,
+ KSSTATE_ACQUIRE,
+ KSSTATE_PAUSE,
+ KSSTATE_RUN,
+
+ KSSTATE_Force32 = 0x7fffffff
+};
+
+enum audio_format {
+ FORMAT_PCM,
+ FORMAT_MP3,
+ FORMAT_AAC,
+ FORMAT_WMA,
+ FORMAT_NUM,
+};
+
+enum {
+ CODEC_PCM = 0,
+ CODEC_MP3 = 1,
+ CODEC_AAC = 2,
+ CODEC_WMA = 3,
+ NUM_CODECS,
+};
+
+enum avp_audio_stream_id {
+ loopback_stream_id = 0,
+ pcm_stream_id,
+ pcm2_stream_id,
+ decode_stream_id,
+ decode2_stream_id,
+ max_stream_id
+};
+
+enum tegra_arch {
+ NV_TEGRA_T20 = 0x20,
+ NV_TEGRA_T30 = 0x30,
+ NV_TEGRA_T114 = 0x35,
+ NV_TEGRA_T148 = 0x14,
+ NV_TEGRA_T124 = 0x40,
+ NV_TEGRA_Force32 = 0x7FFFFFFF
+};
+
+enum aac_profile {
+ AAC_PROFILE_MAIN,
+ AAC_PROFILE_LC,
+ AAC_PROFILE_SSR,
+};
+
+enum ucode_desc_params {
+ UCODE_DESC_OFFSET,
+ UCODE_DESC_SIZE,
+ UCODE_DESC_NUM,
+};
+
+struct audio_params {
+ unsigned int rate;
+ unsigned int channels;
+ unsigned int bits_per_sample;
+};
+
+struct stream_data {
+ /* Writeable by mixer */
+ enum KSSTATE stream_state_current;
+ unsigned int halted;
+ unsigned int source_buffer_read_position;
+ unsigned int source_buffer_read_position_fraction;
+ unsigned int source_buffer_presentation_position;
+ unsigned int source_buffer_linear_position;
+ unsigned int source_buffer_frames_decoded;
+ unsigned int stream_notification_offset;
+ unsigned int stream_notification_request;
+
+ /* Read-only for mixer */
+ unsigned int stream_allocated;
+ enum KSSTATE stream_state_target;
+
+ void *source_buffer_system;
+ unsigned int source_buffer_avp;
+ unsigned int source_buffer_size;
+ unsigned int source_buffer_write_position;
+ unsigned int source_buffer_write_count;
+
+ unsigned int stream_notification_interval;
+ int stream_notification_enable;
+
+ struct audio_params stream_params;
+ enum audio_format stream_format;
+ int stream_volume[RENDERSW_MAX_CHANNELS];
+
+ union {
+ /* AAC Specific Data */
+ struct {
+ unsigned int payload_type;
+ unsigned int audio_profile;
+ unsigned int sampling_freq_index;
+ unsigned int sampling_freq;
+ unsigned int channel_configuration;
+ unsigned int extension_sampling_freq_index;
+ unsigned int extension_sampling_freq;
+ } aac;
+ } u;
+};
+
+struct audio_engine_data {
+ unsigned int apb_channel_handle;
+
+ void *device_buffer_system;
+ unsigned int device_buffer_avp;
+
+ unsigned int track_audio_latency;
+ unsigned int hw_write_time;
+
+ unsigned int codec_ucode_base_address;
+ unsigned int codec_ucode_desc[NUM_CODECS][UCODE_DESC_NUM];
+ /* [codec][offset,size] */
+
+ enum KSSTATE device_state_target;
+ unsigned int profile_state;
+
+ struct audio_params device_format;
+
+ enum KSSTATE device_state_current;
+ unsigned int device_buffer_write_position;
+ unsigned int device_buffer_read_position;
+ unsigned int chip_id;
+ unsigned int only_loopback_flag;
+
+ struct stream_data stream[RENDERSW_MAX_STREAMS];
+};
+
+#endif