ASoC: msm: Add incall recording support

Add two backend DAIs, and add two mixer controls to route
capture stream to the new backend DAIs. Start/stop record
commands will be sent to CVD if starting/stoping recording,
after voice call is established.

Change-Id: Iabff5390ca8c50ba05ae2dfa31fa3f1a8797f1db
Signed-off-by: Helen Zeng <xiaoyunz@codeaurora.org>
diff --git a/sound/soc/msm/qdsp6/q6voice.h b/sound/soc/msm/qdsp6/q6voice.h
index 03993f6..d330ada 100644
--- a/sound/soc/msm/qdsp6/q6voice.h
+++ b/sound/soc/msm/qdsp6/q6voice.h
@@ -17,6 +17,10 @@
 #define MAX_VOC_PKT_SIZE 642
 #define SESSION_NAME_LEN 20
 
+#define VOC_REC_UPLINK		0x00
+#define VOC_REC_DOWNLINK	0x01
+#define VOC_REC_BOTH		0x02
+
 struct voice_header {
 	uint32_t id;
 	uint32_t data_len;
@@ -43,6 +47,11 @@
 	u16 tx_route_flag;
 };
 
+struct voice_rec_route_state {
+	u16 ul_flag;
+	u16 dl_flag;
+};
+
 enum {
 	VOC_INIT = 0,
 	VOC_RUN,
@@ -324,6 +333,30 @@
 #define VSS_ISTREAM_CMD_STOP_PLAYBACK                   0x00011239
 /* Stop the in-call music delivery on the Tx voice path. */
 
+#define VSS_ISTREAM_CMD_START_RECORD                    0x00011236
+/* Start in-call conversation recording. */
+#define VSS_ISTREAM_CMD_STOP_RECORD                     0x00011237
+/* Stop in-call conversation recording. */
+
+#define VSS_TAP_POINT_NONE                              0x00010F78
+/* Indicates no tapping for specified path. */
+
+#define VSS_TAP_POINT_STREAM_END                        0x00010F79
+/* Indicates that specified path should be tapped at the end of the stream. */
+
+struct vss_istream_cmd_start_record_t {
+	uint32_t rx_tap_point;
+	/* Tap point to use on the Rx path. Supported values are:
+	 * VSS_TAP_POINT_NONE : Do not record Rx path.
+	 * VSS_TAP_POINT_STREAM_END : Rx tap point is at the end of the stream.
+	 */
+	uint32_t tx_tap_point;
+	/* Tap point to use on the Tx path. Supported values are:
+	 * VSS_TAP_POINT_NONE : Do not record tx path.
+	 * VSS_TAP_POINT_STREAM_END : Tx tap point is at the end of the stream.
+	 */
+} __packed;
+
 struct vss_istream_cmd_create_passive_control_session_t {
 	char name[SESSION_NAME_LEN];
 	/**<
@@ -544,6 +577,10 @@
 	struct apr_hdr hdr;
 	struct vss_icommon_cmd_set_ui_property_st_enable_t vss_set_st;
 } __packed;
+struct cvs_start_record_cmd {
+	struct apr_hdr hdr;
+	struct vss_istream_cmd_start_record_t rec_mode;
+} __packed;
 
 /* TO CVP commands */
 
@@ -753,8 +790,9 @@
 };
 
 struct incall_rec_info {
-	uint32_t pending;
+	uint32_t rec_enable;
 	uint32_t rec_mode;
+	uint32_t recording;
 };
 
 struct incall_music_info {
@@ -798,7 +836,12 @@
 	struct voice_dev_route_state voc_route_state;
 
 	u16 session_id;
+
+	struct incall_rec_info rec_info;
+
 	struct incall_music_info music_info;
+
+	struct voice_rec_route_state rec_route_state;
 };
 
 #define MAX_VOC_SESSIONS 2
@@ -866,4 +909,5 @@
 uint16_t voc_get_session_id(char *name);
 
 int voc_start_playback(uint32_t set);
+int voc_start_record(uint32_t port_id, uint32_t set);
 #endif