blob: 763a6516d9f0a23dc98f93b7c1c91b0e1824cd5f [file] [log] [blame]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001/*arch/arm/mach-msm/qdsp5iv2/audpp.h
2 *
3 * Copyright (C) 2008 Google, Inc.
Duy Truong790f06d2013-02-13 16:38:12 -08004 * Copyright (c) 2008-2011, The Linux Foundation. All rights reserved.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07005 *
6 * This software is licensed under the terms of the GNU General Public
7 * License version 2, as published by the Free Software Foundation, and
8 * may be copied, distributed, and modified under those terms.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15*/
16
17#ifndef _MACH_QDSP5_V2_AUDPP_H
18#define _MACH_QDSP5_V2_AUDPP_H
19
20#include <mach/qdsp5v2/qdsp5audppcmdi.h>
21
22typedef void (*audpp_event_func)(void *private, unsigned id, uint16_t *msg);
23
24/* worst case delay of 1sec for response */
25#define MSM_AUD_DECODER_WAIT_MS 1000
26#define MSM_AUD_MODE_TUNNEL 0x00000100
27#define MSM_AUD_MODE_NONTUNNEL 0x00000200
28#define MSM_AUD_MODE_LP 0x00000400
29#define MSM_AUD_DECODER_MASK 0x0000FFFF
30#define MSM_AUD_OP_MASK 0xFFFF0000
31
32/* read call timeout for error cases */
33#define MSM_AUD_BUFFER_UPDATE_WAIT_MS 2000
34
35/* stream info error message mask */
36#define AUDPLAY_STREAM_INFO_MSG_MASK 0xFFFF0000
37#define AUDPLAY_ERROR_THRESHOLD_ENABLE 0xFFFFFFFF
38
39#define NON_TUNNEL_MODE_PLAYBACK 1
40#define TUNNEL_MODE_PLAYBACK 0
41
42#define AUDPP_MIXER_ICODEC AUDPP_CMD_CFG_DEV_MIXER_DEV_0
43#define AUDPP_MIXER_1 AUDPP_CMD_CFG_DEV_MIXER_DEV_1
44#define AUDPP_MIXER_2 AUDPP_CMD_CFG_DEV_MIXER_DEV_2
45#define AUDPP_MIXER_3 AUDPP_CMD_CFG_DEV_MIXER_DEV_3
46#define AUDPP_MIXER_HLB AUDPP_CMD_CFG_DEV_MIXER_DEV_4
47#define AUDPP_MIXER_NONHLB (AUDPP_CMD_CFG_DEV_MIXER_DEV_0 | \
48 AUDPP_CMD_CFG_DEV_MIXER_DEV_1 | \
49 AUDPP_CMD_CFG_DEV_MIXER_DEV_2 | \
50 AUDPP_CMD_CFG_DEV_MIXER_DEV_3)
51#define AUDPP_MIXER_UPLINK_RX AUDPP_CMD_CFG_DEV_MIXER_DEV_5
52#define AUDPP_MAX_COPP_DEVICES 6
53
54enum obj_type {
55 COPP,
56 POPP
57};
58
59enum msm_aud_decoder_state {
60 MSM_AUD_DECODER_STATE_NONE = 0,
61 MSM_AUD_DECODER_STATE_FAILURE = 1,
62 MSM_AUD_DECODER_STATE_SUCCESS = 2,
63 MSM_AUD_DECODER_STATE_CLOSE = 3,
64};
65
66int audpp_adec_alloc(unsigned dec_attrb, const char **module_name,
67 unsigned *queueid);
68void audpp_adec_free(int decid);
69
70struct audpp_event_callback {
71 audpp_event_func fn;
72 void *private;
73};
74
75int audpp_register_event_callback(struct audpp_event_callback *eh);
76int audpp_unregister_event_callback(struct audpp_event_callback *eh);
77int is_audpp_enable(void);
78
79int audpp_enable(int id, audpp_event_func func, void *private);
80void audpp_disable(int id, void *private);
81
82int audpp_send_queue1(void *cmd, unsigned len);
83int audpp_send_queue2(void *cmd, unsigned len);
84int audpp_send_queue3(void *cmd, unsigned len);
85
86void audpp_route_stream(unsigned short dec_id, unsigned short mixer_mask);
87
88int audpp_set_volume_and_pan(unsigned id, unsigned volume, int pan,
89 enum obj_type objtype);
90int audpp_pause(unsigned id, int pause);
91int audpp_flush(unsigned id);
92int audpp_query_avsync(int id);
93int audpp_restore_avsync(int id, uint16_t *avsync);
94
95int audpp_dsp_set_eq(unsigned id, unsigned enable,
96 struct audpp_cmd_cfg_object_params_eqalizer *eq,
97 enum obj_type objtype);
98
99int audpp_dsp_set_spa(unsigned id,
100 struct audpp_cmd_cfg_object_params_spectram *spa,
101 enum obj_type objtype);
102
103int audpp_dsp_set_stf(unsigned id, unsigned enable,
104 struct audpp_cmd_cfg_object_params_sidechain *stf,
105 enum obj_type objtype);
106
107int audpp_dsp_set_vol_pan(unsigned id,
108 struct audpp_cmd_cfg_object_params_volume *vol_pan,
109 enum obj_type objtype);
110
111int audpp_dsp_set_mbadrc(unsigned id, unsigned enable,
112 struct audpp_cmd_cfg_object_params_mbadrc *mbadrc,
113 enum obj_type objtype);
114
115int audpp_dsp_set_qconcert_plus(unsigned id, unsigned enable,
116 struct audpp_cmd_cfg_object_params_qconcert *qconcert_plus,
117 enum obj_type objtype);
118
119int audpp_dsp_set_rx_iir(unsigned id, unsigned enable,
120 struct audpp_cmd_cfg_object_params_pcm *iir,
121 enum obj_type objtype);
122
123int audpp_dsp_set_gain_rx(unsigned id,
124 struct audpp_cmd_cfg_cal_gain *calib_gain_rx,
125 enum obj_type objtype);
126int audpp_dsp_set_pbe(unsigned id, unsigned enable,
127 struct audpp_cmd_cfg_pbe *pbe_block,
128 enum obj_type objtype);
129#endif