blob: e913e15df0f9f69f2acfdb6c2fa0edcdaf1b3763 [file] [log] [blame]
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07001/* Copyright (c) 2010-2011, Code Aurora Forum. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12#ifndef __Q6AFE_H__
13#define __Q6AFE_H__
14#include <sound/apr_audio.h>
15
16#define MSM_AFE_MONO 0
17#define MSM_AFE_MONO_RIGHT 1
18#define MSM_AFE_MONO_LEFT 2
19#define MSM_AFE_STEREO 3
20
Neema Shettyfeea7742011-09-11 12:30:36 -070021#define MSM_AFE_PORT_TYPE_RX 0
22#define MSM_AFE_PORT_TYPE_TX 1
23
Laxminath Kasam32657ec2011-08-01 19:26:57 +053024#define RT_PROXY_DAI_001_RX 0xE0
25#define RT_PROXY_DAI_001_TX 0xF0
26#define RT_PROXY_DAI_002_RX 0xF1
27#define RT_PROXY_DAI_002_TX 0xE1
28#define VIRTUAL_ID_TO_PORTID(val) ((val & 0xF) | 0x2000)
29
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070030enum {
31 IDX_PRIMARY_I2S_RX = 0,
32 IDX_PRIMARY_I2S_TX = 1,
33 IDX_PCM_RX = 2,
34 IDX_PCM_TX = 3,
35 IDX_SECONDARY_I2S_RX = 4,
36 IDX_SECONDARY_I2S_TX = 5,
37 IDX_MI2S_RX = 6,
38 IDX_MI2S_TX = 7,
39 IDX_HDMI_RX = 8,
40 IDX_RSVD_2 = 9,
41 IDX_RSVD_3 = 10,
42 IDX_DIGI_MIC_TX = 11,
43 IDX_VOICE_RECORD_RX = 12,
44 IDX_VOICE_RECORD_TX = 13,
45 IDX_VOICE_PLAYBACK_TX = 14,
46 IDX_SLIMBUS_0_RX = 15,
47 IDX_SLIMBUS_0_TX = 16,
48 IDX_SLIMBUS_1_RX = 17,
49 IDX_SLIMBUS_1_TX = 18,
50 IDX_SLIMBUS_2_RX = 19,
51 IDX_SLIMBUS_2_TX = 20,
52 IDX_SLIMBUS_3_RX = 21,
53 IDX_SLIMBUS_3_TX = 22,
54 IDX_SLIMBUS_4_RX = 23,
55 IDX_SLIMBUS_4_TX = 24,
56 IDX_INT_BT_SCO_RX = 25,
57 IDX_INT_BT_SCO_TX = 26,
58 IDX_INT_BT_A2DP_RX = 27,
59 IDX_INT_FM_RX = 28,
60 IDX_INT_FM_TX = 29,
Laxminath Kasam32657ec2011-08-01 19:26:57 +053061 IDX_RT_PROXY_PORT_001_RX = 30,
62 IDX_RT_PROXY_PORT_001_TX = 31,
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070063 AFE_MAX_PORTS
64};
65
66int afe_open(u16 port_id, union afe_port_config *afe_config, int rate);
67int afe_close(int port_id);
68int afe_loopback(u16 enable, u16 rx_port, u16 tx_port);
69int afe_sidetone(u16 tx_port_id, u16 rx_port_id, u16 enable, uint16_t gain);
70int afe_loopback_gain(u16 port_id, u16 volume);
71int afe_validate_port(u16 port_id);
72int afe_get_port_index(u16 port_id);
73int afe_start_pseudo_port(u16 port_id);
74int afe_stop_pseudo_port(u16 port_id);
Laxminath Kasam32657ec2011-08-01 19:26:57 +053075int afe_cmd_memory_map(u32 dma_addr_p, u32 dma_buf_sz);
76int afe_cmd_memory_unmap(u32 dma_addr_p);
77
78int afe_register_get_events(u16 port_id,
79 void (*cb) (uint32_t opcode,
80 uint32_t token, uint32_t *payload, void *priv),
81 void *private_data);
82int afe_unregister_get_events(u16 port_id);
83int afe_rt_proxy_port_write(u32 buf_addr_p, int bytes);
84int afe_rt_proxy_port_read(u32 buf_addr_p, int bytes);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070085int afe_port_start_nowait(u16 port_id, union afe_port_config *afe_config,
86 u32 rate);
87int afe_port_stop_nowait(int port_id);
Laxminath Kasam885f5102011-07-14 10:20:21 +053088int afe_apply_gain(u16 port_id, u16 gain);
Jay Wang6a305432011-08-05 16:01:54 -070089int afe_q6_interface_prepare(void);
Neema Shettyfeea7742011-09-11 12:30:36 -070090int afe_get_port_type(u16 port_id);
Laxminath Kasam32657ec2011-08-01 19:26:57 +053091/* if port_id is virtual, convert to physical..
92 * if port_id is already physical, return physical
93 */
94int afe_convert_virtual_to_portid(u16 port_id);
Jay Wang6a305432011-08-05 16:01:54 -070095
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070096#endif /* __Q6AFE_H__ */